@promptbook/core 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 +362 -276
  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 +1 -1
  55. package/umd/index.umd.js +362 -275
  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
@@ -27,7 +27,7 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
27
27
  * @generated
28
28
  * @see https://github.com/webgptorg/promptbook
29
29
  */
30
- const PROMPTBOOK_ENGINE_VERSION = '0.103.0-45';
30
+ const PROMPTBOOK_ENGINE_VERSION = '0.103.0-47';
31
31
  /**
32
32
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
33
33
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -159,15 +159,20 @@ class ParseError extends Error {
159
159
  */
160
160
  const REMOTE_SERVER_URLS = [
161
161
  {
162
- title: 'Promptbook',
163
- description: `Servers of Promptbook.studio`,
162
+ title: 'Promptbook.Studio',
163
+ description: `Server of Promptbook.studio`,
164
164
  owner: 'AI Web, LLC <legal@ptbk.io> (https://www.ptbk.io/)',
165
- isAnonymousModeAllowed: true,
166
165
  urls: [
167
166
  'https://promptbook.s5.ptbk.io/',
168
167
  // Note: Servers 1-4 are not running
169
168
  ],
170
169
  },
170
+ {
171
+ title: 'Testing Agents',
172
+ description: `Testing Agents server on Vercel`,
173
+ owner: 'AI Web, LLC <legal@ptbk.io> (https://www.ptbk.io/)',
174
+ urls: ['https://s6.ptbk.io/'],
175
+ },
171
176
  /*
172
177
  Note: Working on older version of Promptbook and not supported anymore
173
178
  {
@@ -412,9 +417,6 @@ function checkChannelValue(channelName, value) {
412
417
  throw new Error(`${channelName} channel is greater than 255, it is ${value}`);
413
418
  }
414
419
  }
415
- /**
416
- * TODO: [🧠][🚓] Is/which combination it better to use asserts/check, validate or is utility function?
417
- */
418
420
 
419
421
  /**
420
422
  * Color object represents an RGB color with alpha channel
@@ -1542,6 +1544,8 @@ function isValidJsonString(value /* <- [👨‍⚖️] */) {
1542
1544
  * Function `validatePipelineString` will validate the if the string is a valid pipeline string
1543
1545
  * 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.
1544
1546
  *
1547
+ * Note: [🔂] This function is idempotent.
1548
+ *
1545
1549
  * @param {string} pipelineString the candidate for a pipeline string
1546
1550
  * @returns {PipelineString} the same string as input, but validated as valid
1547
1551
  * @throws {ParseError} if the string is not a valid pipeline string
@@ -2173,6 +2177,8 @@ function isValidPipelineUrl(url) {
2173
2177
  * - if it is valid json
2174
2178
  * - if it is meaningful
2175
2179
  *
2180
+ * Note: [🔂] This function is idempotent.
2181
+ *
2176
2182
  * @param pipeline valid or invalid PipelineJson
2177
2183
  * @returns the same pipeline if it is logically valid
2178
2184
  * @throws {PipelineLogicError} on logical error in the pipeline
@@ -6030,6 +6036,8 @@ function isPassingExpectations(expectations, value) {
6030
6036
  * This function provides a common abstraction for result validation that can be used
6031
6037
  * by both execution logic and caching logic to ensure consistency.
6032
6038
  *
6039
+ * Note: [🔂] This function is idempotent.
6040
+ *
6033
6041
  * @param options - The validation options including result string, expectations, and format
6034
6042
  * @returns Validation result with processed string and validity status
6035
6043
  * @private internal function of `createPipelineExecutor` and `cacheLlmTools`
@@ -7384,40 +7392,6 @@ async function preparePersona(personaDescription, tools, options) {
7384
7392
  * TODO: [🏢] Check validity of `temperature` in pipeline
7385
7393
  */
7386
7394
 
7387
- /**
7388
- * Creates an empty/basic agent model requirements object
7389
- * This serves as the starting point for the reduce-like pattern
7390
- * where each commitment applies its changes to build the final requirements
7391
- *
7392
- * @public exported from `@promptbook/core`
7393
- */
7394
- function createEmptyAgentModelRequirements() {
7395
- return {
7396
- systemMessage: '',
7397
- // modelName: 'gpt-5',
7398
- modelName: 'gemini-2.5-flash-lite',
7399
- temperature: 0.7,
7400
- topP: 0.9,
7401
- topK: 50,
7402
- };
7403
- }
7404
- /**
7405
- * Creates a basic agent model requirements with just the agent name
7406
- * This is used when we have an agent name but no commitments
7407
- *
7408
- * @public exported from `@promptbook/core`
7409
- */
7410
- function createBasicAgentModelRequirements(agentName) {
7411
- const empty = createEmptyAgentModelRequirements();
7412
- return {
7413
- ...empty,
7414
- systemMessage: `You are ${agentName || 'AI Agent'}`,
7415
- };
7416
- }
7417
- /**
7418
- * TODO: [🐤] Deduplicate `AgentModelRequirements` and `ModelRequirements` model requirements
7419
- */
7420
-
7421
7395
  /**
7422
7396
  * Generates a regex pattern to match a specific commitment
7423
7397
  *
@@ -7951,23 +7925,19 @@ class KnowledgeCommitmentDefinition extends BaseCommitmentDefinition {
7951
7925
  `);
7952
7926
  }
7953
7927
  applyToAgentModelRequirements(requirements, content) {
7954
- var _a;
7955
7928
  const trimmedContent = content.trim();
7956
7929
  if (!trimmedContent) {
7957
7930
  return requirements;
7958
7931
  }
7959
7932
  // Check if content is a URL (external knowledge source)
7960
- if (this.isUrl(trimmedContent)) {
7933
+ if (isValidUrl(trimmedContent)) {
7961
7934
  // Store the URL for later async processing
7962
7935
  const updatedRequirements = {
7963
7936
  ...requirements,
7964
- metadata: {
7965
- ...requirements.metadata,
7966
- knowledgeSources: [
7967
- ...(((_a = requirements.metadata) === null || _a === void 0 ? void 0 : _a.knowledgeSources) || []),
7968
- trimmedContent,
7969
- ],
7970
- },
7937
+ knowledgeSources: [
7938
+ ...(requirements.knowledgeSources || []),
7939
+ trimmedContent,
7940
+ ],
7971
7941
  };
7972
7942
  // Add placeholder information about knowledge sources to system message
7973
7943
  const knowledgeInfo = `Knowledge Source URL: ${trimmedContent} (will be processed for retrieval during chat)`;
@@ -7979,18 +7949,6 @@ class KnowledgeCommitmentDefinition extends BaseCommitmentDefinition {
7979
7949
  return this.appendToSystemMessage(requirements, knowledgeSection, '\n\n');
7980
7950
  }
7981
7951
  }
7982
- /**
7983
- * Check if content is a URL
7984
- */
7985
- isUrl(content) {
7986
- try {
7987
- new URL(content);
7988
- return true;
7989
- }
7990
- catch (_a) {
7991
- return false;
7992
- }
7993
- }
7994
7952
  }
7995
7953
  /**
7996
7954
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -9316,6 +9274,40 @@ function isCommitmentSupported(type) {
9316
9274
  * Note: [💞] Ignore a discrepancy between file name and entity name
9317
9275
  */
9318
9276
 
9277
+ /**
9278
+ * Creates an empty/basic agent model requirements object
9279
+ * This serves as the starting point for the reduce-like pattern
9280
+ * where each commitment applies its changes to build the final requirements
9281
+ *
9282
+ * @public exported from `@promptbook/core`
9283
+ */
9284
+ function createEmptyAgentModelRequirements() {
9285
+ return {
9286
+ systemMessage: '',
9287
+ // modelName: 'gpt-5',
9288
+ modelName: 'gemini-2.5-flash-lite',
9289
+ temperature: 0.7,
9290
+ topP: 0.9,
9291
+ topK: 50,
9292
+ };
9293
+ }
9294
+ /**
9295
+ * Creates a basic agent model requirements with just the agent name
9296
+ * This is used when we have an agent name but no commitments
9297
+ *
9298
+ * @public exported from `@promptbook/core`
9299
+ */
9300
+ function createBasicAgentModelRequirements(agentName) {
9301
+ const empty = createEmptyAgentModelRequirements();
9302
+ return {
9303
+ ...empty,
9304
+ systemMessage: `You are ${agentName || 'AI Agent'}`,
9305
+ };
9306
+ }
9307
+ /**
9308
+ * TODO: [🐤] Deduplicate `AgentModelRequirements` and `ModelRequirements` model requirements
9309
+ */
9310
+
9319
9311
  /**
9320
9312
  * Parses agent source using the new commitment system with multiline support
9321
9313
  * This function replaces the hardcoded commitment parsing in the original parseAgentSource
@@ -9406,29 +9398,6 @@ function parseAgentSourceWithCommitments(agentSource) {
9406
9398
  };
9407
9399
  }
9408
9400
 
9409
- /**
9410
- * Removes comment lines (lines starting with #) from a system message
9411
- * This is used to clean up the final system message before sending it to the AI model
9412
- * while preserving the original content with comments in metadata
9413
- *
9414
- * @param systemMessage The system message that may contain comment lines
9415
- * @returns The system message with comment lines removed
9416
- *
9417
- * @private - TODO: [🧠] Maybe should be public?
9418
- */
9419
- function removeCommentsFromSystemMessage(systemMessage) {
9420
- if (!systemMessage) {
9421
- return systemMessage;
9422
- }
9423
- const lines = systemMessage.split('\n');
9424
- const filteredLines = lines.filter((line) => {
9425
- const trimmedLine = line.trim();
9426
- // Remove lines that start with # (comments)
9427
- return !trimmedLine.startsWith('#');
9428
- });
9429
- return filteredLines.join('\n').trim();
9430
- }
9431
-
9432
9401
  /**
9433
9402
  * Parses parameters from text using both supported notations:
9434
9403
  * 1. @Parameter - single word parameter starting with @
@@ -9487,6 +9456,29 @@ function parseParameters(text) {
9487
9456
  return uniqueParameters;
9488
9457
  }
9489
9458
 
9459
+ /**
9460
+ * Removes comment lines (lines starting with #) from a system message
9461
+ * This is used to clean up the final system message before sending it to the AI model
9462
+ * while preserving the original content with comments in metadata
9463
+ *
9464
+ * @param systemMessage The system message that may contain comment lines
9465
+ * @returns The system message with comment lines removed
9466
+ *
9467
+ * @private - TODO: [🧠] Maybe should be public?
9468
+ */
9469
+ function removeCommentsFromSystemMessage(systemMessage) {
9470
+ if (!systemMessage) {
9471
+ return systemMessage;
9472
+ }
9473
+ const lines = systemMessage.split('\n');
9474
+ const filteredLines = lines.filter((line) => {
9475
+ const trimmedLine = line.trim();
9476
+ // Remove lines that start with # (comments)
9477
+ return !trimmedLine.startsWith('#');
9478
+ });
9479
+ return filteredLines.join('\n').trim();
9480
+ }
9481
+
9490
9482
  /**
9491
9483
  * Creates agent model requirements using the new commitment system
9492
9484
  * This function uses a reduce-like pattern where each commitment applies its changes
@@ -9822,6 +9814,8 @@ const PADDING_LINES = 11;
9822
9814
  /**
9823
9815
  * A function that adds padding to the book content
9824
9816
  *
9817
+ * Note: [🔂] This function is idempotent.
9818
+ *
9825
9819
  * @public exported from `@promptbook/core`
9826
9820
  */
9827
9821
  function padBook(content) {
@@ -9867,6 +9861,8 @@ function isValidBook(value) {
9867
9861
  * This function should be used when you have a string that you know represents agent source
9868
9862
  * but need to convert it to the branded type for type safety
9869
9863
  *
9864
+ * Note: [🔂] This function is idempotent.
9865
+ *
9870
9866
  * @public exported from `@promptbook/core`
9871
9867
  */
9872
9868
  function validateBook(source) {
@@ -9926,125 +9922,51 @@ class AgentCollectionInSupabase /* TODO: !!!! implements AgentCollection */ {
9926
9922
  console.info(`Creating pipeline collection from supabase...`);
9927
9923
  }
9928
9924
  }
9929
- /**
9930
- * Cached defined execution tools
9931
- */
9932
- // !!! private _definedTools: ExecutionTools | null = null;
9933
- /*
9934
- TODO: !!! Use or remove
9935
- /**
9936
- * Gets or creates execution tools for the collection
9937
- * /
9938
- private async getTools(): Promise<ExecutionTools> {
9939
- if (this._definedTools !== null) {
9940
- return this._definedTools;
9941
- }
9942
-
9943
- this._definedTools = {
9944
- ...(this.tools === undefined || this.tools.fs === undefined ? await $provideExecutionToolsForNode() : {}),
9945
- ...this.tools,
9946
- };
9947
- return this._definedTools;
9948
- }
9949
- // <- TODO: [👪] Maybe create some common abstraction *(or parent abstract class)*
9950
- */
9951
9925
  /**
9952
9926
  * Gets all agents in the collection
9953
9927
  */
9954
9928
  async listAgents( /* TODO: [🧠] Allow to pass some condition here */) {
9955
9929
  const { isVerbose = DEFAULT_IS_VERBOSE } = this.options || {};
9956
- const result = await this.supabaseClient
9930
+ const selectResult = await this.supabaseClient
9957
9931
  .from('AgentCollection' /* <- TODO: !!!! Change to `Agent` */)
9958
9932
  .select('agentProfile');
9959
- if (result.error) {
9933
+ if (selectResult.error) {
9960
9934
  throw new DatabaseError(spaceTrim((block) => `
9961
9935
 
9962
9936
  Error fetching agents from Supabase:
9963
9937
 
9964
- ${block(result.error.message)}
9938
+ ${block(selectResult.error.message)}
9965
9939
  `));
9966
9940
  }
9967
9941
  if (isVerbose) {
9968
- console.info(`Found ${result.data.length} agents in directory`);
9942
+ console.info(`Found ${selectResult.data.length} agents in directory`);
9969
9943
  }
9970
- return result.data.map((row) => row.agentProfile);
9944
+ return selectResult.data.map((row) => row.agentProfile);
9971
9945
  }
9972
- /**
9973
- * !!!
9974
- * /
9975
- public async spawnAgent(agentName: string_agent_name): Promise<Agent> {
9976
-
9977
- // <- TODO: !!! ENOENT: no such file or directory, open 'C:\Users\me\work\ai\promptbook\agents\examples\Asistent pro LŠVP.book
9978
- const { isVerbose = DEFAULT_IS_VERBOSE } = this.options || {};
9979
- const tools = await this.getTools();
9980
-
9981
- const agentSourceValue = validateBook(await tools.fs!.readFile(agentSourcePath, 'utf-8'));
9982
- const agentSource = new BehaviorSubject(agentSourceValue);
9983
-
9984
- // Note: Write file whenever agent source changes
9985
- agentSource.subscribe(async (newSource) => {
9986
- if (isVerbose) {
9987
- console.info(colors.cyan(`Writing agent source to file ${agentSourcePath}`));
9988
- }
9989
- await forTime(500); // <- TODO: [🙌] !!! Remove
9990
- await tools.fs!.writeFile(agentSourcePath, newSource, 'utf-8');
9991
- });
9992
-
9993
- // Note: Watch file for external changes
9994
- for await (const event of tools.fs!.watch(agentSourcePath)) {
9995
- // <- TODO: !!!! Solve the memory freeing when the watching is no longer needed
9996
-
9997
- if (event.eventType !== 'change') {
9998
- continue;
9999
- }
10000
-
10001
- if (isVerbose) {
10002
- console.info(
10003
- colors.cyan(`Detected external change in agent source file ${agentSourcePath}, reloading`),
10004
- );
10005
- }
10006
- await forTime(500); // <- TODO: [🙌] !!! Remove
10007
- const newSource = validateBook(await tools.fs!.readFile(agentSourcePath, 'utf-8'));
10008
- agentSource.next(newSource);
10009
- }
10010
-
10011
- // TODO: [🙌] !!!! Debug the infinite loop when file is changed externally and agent source is updated which causes file to be written again
10012
-
10013
- const agent = new Agent({
10014
- ...this.options,
10015
- agentSource,
10016
- executionTools: this.tools || {},
10017
- });
10018
-
10019
- if (isVerbose) {
10020
- console.info(colors.cyan(`Created agent "${agent.agentName}" from source file ${agentSourcePath}`));
10021
- }
10022
-
10023
- return agent;
10024
- * /
10025
- }
10026
- */
10027
9946
  /**
10028
9947
  * !!!@@@
10029
9948
  */
10030
9949
  async getAgentSource(agentName) {
10031
- const result = await this.supabaseClient
9950
+ const selectResult = await this.supabaseClient
10032
9951
  .from('AgentCollection' /* <- TODO: !!!! Change to `Agent` */)
10033
9952
  .select('agentSource')
10034
9953
  .eq('agentName', agentName)
10035
9954
  .single();
10036
- if (result.error) {
9955
+ /*
9956
+ if (selectResult.data===null) {
9957
+ throw new NotFoundError(`Agent "${agentName}" not found`);
9958
+ }
9959
+ */
9960
+ if (selectResult.error) {
10037
9961
  throw new DatabaseError(spaceTrim((block) => `
10038
9962
 
10039
9963
  Error fetching agent "${agentName}" from Supabase:
10040
9964
 
10041
- ${block(result.error.message)}
9965
+ ${block(selectResult.error.message)}
10042
9966
  `));
10043
9967
  // <- TODO: !!! First check if the error is "not found" and throw `NotFoundError` instead then throw `DatabaseError`
10044
9968
  }
10045
- const agentSource = new BehaviorSubject(result.data.agentSource);
10046
- // <- TODO: !!!! Dynamic updates
10047
- return agentSource;
9969
+ return selectResult.data.agentSource;
10048
9970
  }
10049
9971
  /**
10050
9972
  * Creates a new agent in the collection
@@ -10054,7 +9976,9 @@ class AgentCollectionInSupabase /* TODO: !!!! implements AgentCollection */ {
10054
9976
  async createAgent(agentSource) {
10055
9977
  const agentProfile = parseAgentSource(agentSource);
10056
9978
  // <- TODO: [🕛]
10057
- const result = await this.supabaseClient.from('AgentCollection' /* <- TODO: !!!! Change to `Agent` */).insert({
9979
+ const selectResult = await this.supabaseClient
9980
+ .from('AgentCollection' /* <- TODO: !!!! Change to `Agent` */)
9981
+ .insert({
10058
9982
  agentName: agentProfile.agentName || '!!!!!' /* <- TODO: !!!! Remove */,
10059
9983
  agentProfile,
10060
9984
  createdAt: new Date().toISOString(),
@@ -10064,15 +9988,56 @@ class AgentCollectionInSupabase /* TODO: !!!! implements AgentCollection */ {
10064
9988
  usage: ZERO_USAGE,
10065
9989
  agentSource: agentSource,
10066
9990
  });
10067
- if (result.error) {
9991
+ if (selectResult.error) {
10068
9992
  throw new DatabaseError(spaceTrim((block) => `
10069
9993
  Error creating agent "${agentProfile.agentName}" in Supabase:
10070
9994
 
10071
- ${block(result.error.message)}
9995
+ ${block(selectResult.error.message)}
10072
9996
  `));
10073
9997
  }
10074
9998
  return agentProfile;
10075
9999
  }
10000
+ /**
10001
+ * Updates an existing agent in the collection
10002
+ */
10003
+ async updateAgentSource(agentName, agentSource) {
10004
+ const selectResult = await this.supabaseClient
10005
+ .from('AgentCollection' /* <- TODO: !!!! Change to `Agent` */)
10006
+ .select('agentVersion')
10007
+ .eq('agentName', agentName)
10008
+ .single();
10009
+ if (!selectResult.data) {
10010
+ throw new NotFoundError(`Agent "${agentName}" not found`);
10011
+ }
10012
+ const agentProfile = parseAgentSource(agentSource);
10013
+ // TODO: !!!!!! What about agentName change
10014
+ console.log('!!! agentName', agentName);
10015
+ const oldAgentSource = await this.getAgentSource(agentName);
10016
+ const updateResult = await this.supabaseClient
10017
+ .from('AgentCollection' /* <- TODO: !!!! Change to `Agent` */)
10018
+ .update({
10019
+ // TODO: !!!! Compare not update> agentName: agentProfile.agentName || '!!!!!' /* <- TODO: !!!! Remove */,
10020
+ agentProfile,
10021
+ updatedAt: new Date().toISOString(),
10022
+ agentVersion: selectResult.data.agentVersion + 1,
10023
+ agentSource,
10024
+ promptbookEngineVersion: PROMPTBOOK_ENGINE_VERSION,
10025
+ })
10026
+ .eq('agentName', agentName);
10027
+ const newAgentSource = await this.getAgentSource(agentName);
10028
+ console.log('!!! updateAgent', updateResult);
10029
+ console.log('!!! old', oldAgentSource);
10030
+ console.log('!!! new', newAgentSource);
10031
+ if (updateResult.error) {
10032
+ throw new DatabaseError(spaceTrim((block) => `
10033
+ Error updating agent "${agentName}" in Supabase:
10034
+
10035
+ ${block(updateResult.error.message)}
10036
+ `));
10037
+ }
10038
+ }
10039
+ // TODO: !!!! public async getAgentSourceSubject(agentName: string_agent_name): Promise<BehaviorSubject<string_book>>
10040
+ // Use Supabase realtime logic
10076
10041
  /**
10077
10042
  * Deletes an agent from the collection
10078
10043
  */
@@ -10964,6 +10929,8 @@ function removeQuotes(text) {
10964
10929
  * Function `validateParameterName` will normalize and validate a parameter name for use in pipelines.
10965
10930
  * It removes diacritics, emojis, and quotes, normalizes to camelCase, and checks for reserved names and invalid characters.
10966
10931
  *
10932
+ * Note: [🔂] This function is idempotent.
10933
+ *
10967
10934
  * @param parameterName The parameter name to validate and normalize.
10968
10935
  * @returns The validated and normalized parameter name.
10969
10936
  * @throws {ParseError} If the parameter name is empty, reserved, or contains invalid characters.
@@ -16519,7 +16486,7 @@ class OpenAiExecutionTools extends OpenAiCompatibleExecutionTools {
16519
16486
  *
16520
16487
  * This is useful for calling OpenAI API with a single assistant, for more wide usage use `OpenAiExecutionTools`.
16521
16488
  *
16522
- * Note: [🦖] There are several different things in Promptbook:
16489
+ * !!! Note: [🦖] There are several different things in Promptbook:
16523
16490
  * - `Agent` - which represents an AI Agent with its source, memories, actions, etc. Agent is a higher-level abstraction which is internally using:
16524
16491
  * - `LlmExecutionTools` - which wraps one or more LLM models and provides an interface to execute them
16525
16492
  * - `AgentLlmExecutionTools` - which is a specific implementation of `LlmExecutionTools` that wraps another LlmExecutionTools and applies agent-specific system prompts and requirements
@@ -16625,17 +16592,21 @@ class OpenAiAssistantExecutionTools extends OpenAiExecutionTools {
16625
16592
  console.info('connect', stream.currentEvent);
16626
16593
  }
16627
16594
  });
16595
+ /*
16628
16596
  stream.on('messageDelta', (messageDelta) => {
16629
- var _a;
16630
- if (this.options.isVerbose &&
16597
+ if (
16598
+ this.options.isVerbose &&
16631
16599
  messageDelta &&
16632
16600
  messageDelta.content &&
16633
16601
  messageDelta.content[0] &&
16634
- messageDelta.content[0].type === 'text') {
16635
- console.info('messageDelta', (_a = messageDelta.content[0].text) === null || _a === void 0 ? void 0 : _a.value);
16602
+ messageDelta.content[0].type === 'text'
16603
+ ) {
16604
+ console.info('messageDelta', messageDelta.content[0].text?.value);
16636
16605
  }
16606
+
16637
16607
  // <- TODO: [🐚] Make streaming and running tasks working
16638
16608
  });
16609
+ */
16639
16610
  stream.on('messageCreated', (message) => {
16640
16611
  if (this.options.isVerbose) {
16641
16612
  console.info('messageCreated', message);
@@ -16715,64 +16686,85 @@ class OpenAiAssistantExecutionTools extends OpenAiExecutionTools {
16715
16686
  throw new NotAllowed(`Creating new assistants is not allowed. Set \`isCreatingNewAssistantsAllowed: true\` in options to enable this feature.`);
16716
16687
  }
16717
16688
  // await this.playground();
16718
- const { name, instructions } = options;
16689
+ const { name, instructions, knowledgeSources } = options;
16719
16690
  const client = await this.getClient();
16720
- /*/
16721
- //TODO: !!!
16722
- async function downloadFile(url: string, folder = './tmp'): Promise<string> {
16723
- const filename = path.basename(url.split('?')[0]);
16724
- const filepath = path.join(folder, filename);
16725
-
16726
- if (!fs.existsSync(folder)) fs.mkdirSync(folder);
16727
-
16728
- const res = await fetch(url);
16729
- if (!res.ok) throw new Error(`Download error: ${url}`);
16730
- const buffer = await res.arrayBuffer();
16731
- fs.writeFileSync(filepath, Buffer.from(buffer));
16732
- console.log(`📥 File downloaded: ${filename}`);
16733
-
16734
- return filepath;
16735
- }
16736
-
16737
- async function uploadFileToOpenAI(filepath: string) {
16738
- const file = await client.files.create({
16739
- file: fs.createReadStream(filepath),
16740
- purpose: 'assistants',
16691
+ let vectorStoreId;
16692
+ // If knowledge sources are provided, create a vector store with them
16693
+ if (knowledgeSources && knowledgeSources.length > 0) {
16694
+ if (this.options.isVerbose) {
16695
+ console.info(`📚 Creating vector store with ${knowledgeSources.length} knowledge sources...`);
16696
+ }
16697
+ // Create a vector store
16698
+ const vectorStore = await client.beta.vectorStores.create({
16699
+ name: `${name} Knowledge Base`,
16741
16700
  });
16742
- console.log(`⬆️ File uploaded to OpenAI: ${file.filename} (${file.id})`);
16743
- return file;
16744
- }
16745
-
16746
- // 🌐 URL addresses of files to upload
16747
- const fileUrls = [
16748
- 'https://raw.githubusercontent.com/vercel/next.js/canary/packages/next/README.md',
16749
- 'https://raw.githubusercontent.com/openai/openai-cookbook/main/examples/How_to_call_the_Assistants_API_with_Node.js.ipynb',
16750
- ];
16751
-
16752
- // 1️⃣ Download files from URL
16753
- const localFiles = [];
16754
- for (const url of fileUrls) {
16755
- const filepath = await downloadFile(url);
16756
- localFiles.push(filepath);
16757
- }
16758
-
16759
- // 2️⃣ Upload files to OpenAI
16760
- const uploadedFiles = [];
16761
- for (const filepath of localFiles) {
16762
- const file = await uploadFileToOpenAI(filepath);
16763
- uploadedFiles.push(file.id);
16701
+ vectorStoreId = vectorStore.id;
16702
+ if (this.options.isVerbose) {
16703
+ console.info(`✅ Vector store created: ${vectorStoreId}`);
16704
+ }
16705
+ // Upload files from knowledge sources to the vector store
16706
+ const fileStreams = [];
16707
+ for (const source of knowledgeSources) {
16708
+ try {
16709
+ // Check if it's a URL
16710
+ if (source.startsWith('http://') || source.startsWith('https://')) {
16711
+ // Download the file
16712
+ const response = await fetch(source);
16713
+ if (!response.ok) {
16714
+ console.error(`Failed to download ${source}: ${response.statusText}`);
16715
+ continue;
16716
+ }
16717
+ const buffer = await response.arrayBuffer();
16718
+ const filename = source.split('/').pop() || 'downloaded-file';
16719
+ const blob = new Blob([buffer]);
16720
+ const file = new File([blob], filename);
16721
+ fileStreams.push(file);
16722
+ }
16723
+ else {
16724
+ // Assume it's a local file path
16725
+ // Note: This will work in Node.js environment
16726
+ // For browser environments, this would need different handling
16727
+ const fs = await import('fs');
16728
+ const fileStream = fs.createReadStream(source);
16729
+ fileStreams.push(fileStream);
16730
+ }
16731
+ }
16732
+ catch (error) {
16733
+ console.error(`Error processing knowledge source ${source}:`, error);
16734
+ }
16735
+ }
16736
+ // Batch upload files to the vector store
16737
+ if (fileStreams.length > 0) {
16738
+ try {
16739
+ await client.beta.vectorStores.fileBatches.uploadAndPoll(vectorStoreId, {
16740
+ files: fileStreams,
16741
+ });
16742
+ if (this.options.isVerbose) {
16743
+ console.info(`✅ Uploaded ${fileStreams.length} files to vector store`);
16744
+ }
16745
+ }
16746
+ catch (error) {
16747
+ console.error('Error uploading files to vector store:', error);
16748
+ }
16749
+ }
16764
16750
  }
16765
- /**/
16766
- // alert('!!!! Creating new OpenAI assistant');
16767
- // 3️⃣ Create assistant with uploaded files
16768
- const assistant = await client.beta.assistants.create({
16751
+ // Create assistant with vector store attached
16752
+ const assistantConfig = {
16769
16753
  name,
16770
16754
  description: 'Assistant created via Promptbook',
16771
16755
  model: 'gpt-4o',
16772
16756
  instructions,
16773
16757
  tools: [/* TODO: [🧠] Maybe add { type: 'code_interpreter' }, */ { type: 'file_search' }],
16774
- // !!!! file_ids: uploadedFiles,
16775
- });
16758
+ };
16759
+ // Attach vector store if created
16760
+ if (vectorStoreId) {
16761
+ assistantConfig.tool_resources = {
16762
+ file_search: {
16763
+ vector_store_ids: [vectorStoreId],
16764
+ },
16765
+ };
16766
+ }
16767
+ const assistant = await client.beta.assistants.create(assistantConfig);
16776
16768
  console.log(`✅ Assistant created: ${assistant.id}`);
16777
16769
  // TODO: !!!! Try listing existing assistants
16778
16770
  // TODO: !!!! Try marking existing assistants by DISCRIMINANT
@@ -16815,7 +16807,7 @@ const DISCRIMINANT = 'OPEN_AI_ASSISTANT_V1';
16815
16807
  * Execution Tools for calling LLM models with a predefined agent "soul"
16816
16808
  * This wraps underlying LLM execution tools and applies agent-specific system prompts and requirements
16817
16809
  *
16818
- * Note: [🦖] There are several different things in Promptbook:
16810
+ * !!! Note: [🦖] There are several different things in Promptbook:
16819
16811
  * - `Agent` - which represents an AI Agent with its source, memories, actions, etc. Agent is a higher-level abstraction which is internally using:
16820
16812
  * - `LlmExecutionTools` - which wraps one or more LLM models and provides an interface to execute them
16821
16813
  * - `AgentLlmExecutionTools` - which is a specific implementation of `LlmExecutionTools` that wraps another LlmExecutionTools and applies agent-specific system prompts and requirements
@@ -16931,6 +16923,7 @@ class AgentLlmExecutionTools {
16931
16923
  const assistant = await this.options.llmTools.createNewAssistant({
16932
16924
  name: this.title,
16933
16925
  instructions: modelRequirements.systemMessage,
16926
+ knowledgeSources: modelRequirements.knowledgeSources,
16934
16927
  /*
16935
16928
  !!!
16936
16929
  metadata: {
@@ -16981,7 +16974,7 @@ class AgentLlmExecutionTools {
16981
16974
  /**
16982
16975
  * Represents one AI Agent
16983
16976
  *
16984
- * Note: [🦖] There are several different things in Promptbook:
16977
+ * !!! Note: [🦖] There are several different things in Promptbook:
16985
16978
  * - `Agent` - which represents an AI Agent with its source, memories, actions, etc. Agent is a higher-level abstraction which is internally using:
16986
16979
  * - `LlmExecutionTools` - which wraps one or more LLM models and provides an interface to execute them
16987
16980
  * - `AgentLlmExecutionTools` - which is a specific implementation of `LlmExecutionTools` that wraps another LlmExecutionTools and applies agent-specific system prompts and requirements
@@ -16989,7 +16982,7 @@ class AgentLlmExecutionTools {
16989
16982
  *
16990
16983
  * @public exported from `@promptbook/core`
16991
16984
  */
16992
- class Agent {
16985
+ class Agent extends AgentLlmExecutionTools {
16993
16986
  /**
16994
16987
  * Not used in Agent, always returns empty array
16995
16988
  */
@@ -16999,7 +16992,12 @@ class Agent {
16999
16992
  ];
17000
16993
  }
17001
16994
  constructor(options) {
17002
- this.options = options;
16995
+ const agentSource = asUpdatableSubject(options.agentSource);
16996
+ super({
16997
+ isVerbose: options.isVerbose,
16998
+ llmTools: getSingleLlmExecutionTools(options.executionTools.llm),
16999
+ agentSource: agentSource.value, // <- TODO: !!!! Allow to pass BehaviorSubject<string_book> OR refresh llmExecutionTools.callChat on agentSource change
17000
+ });
17003
17001
  /**
17004
17002
  * Name of the agent
17005
17003
  */
@@ -17012,7 +17010,9 @@ class Agent {
17012
17010
  * Metadata like image or color
17013
17011
  */
17014
17012
  this.meta = {};
17015
- this.agentSource = asUpdatableSubject(options.agentSource);
17013
+ // TODO: !!!! Add `Agent` simple "mocked" learning by appending to agent source
17014
+ // TODO: !!!! Add `Agent` learning by promptbookAgent
17015
+ this.agentSource = agentSource;
17016
17016
  this.agentSource.subscribe((source) => {
17017
17017
  const { agentName, personaDescription, meta } = parseAgentSource(source);
17018
17018
  this.agentName = agentName;
@@ -17020,19 +17020,6 @@ class Agent {
17020
17020
  this.meta = { ...this.meta, ...meta };
17021
17021
  });
17022
17022
  }
17023
- /**
17024
- * Creates LlmExecutionTools which exposes the agent as a model
17025
- */
17026
- getLlmExecutionTools() {
17027
- const llmTools = new AgentLlmExecutionTools({
17028
- isVerbose: this.options.isVerbose,
17029
- llmTools: getSingleLlmExecutionTools(this.options.executionTools.llm),
17030
- agentSource: this.agentSource.value, // <- TODO: !!!! Allow to pass BehaviorSubject<string_book> OR refresh llmExecutionTools.callChat on agentSource change
17031
- });
17032
- // TODO: !!!! Add `Agent` simple "mocked" learning by appending to agent source
17033
- // TODO: !!!! Add `Agent` learning by promptbookAgent
17034
- return llmTools;
17035
- }
17036
17023
  }
17037
17024
  /**
17038
17025
  * TODO: [🧠][😰]Agent is not working with the parameters, should it be?
@@ -17099,6 +17086,106 @@ const _AgentRegistration = $llmToolsRegister.register(createAgentLlmExecutionToo
17099
17086
  * Note: [💞] Ignore a discrepancy between file name and entity name
17100
17087
  */
17101
17088
 
17089
+ /**
17090
+ * Represents one AI Agent
17091
+ *
17092
+ * !!! Note: [🦖] There are several different things in Promptbook:
17093
+ * - `Agent` - which represents an AI Agent with its source, memories, actions, etc. Agent is a higher-level abstraction which is internally using:
17094
+ * !!!! `RemoteAgent`
17095
+ * - `LlmExecutionTools` - which wraps one or more LLM models and provides an interface to execute them
17096
+ * - `AgentLlmExecutionTools` - which is a specific implementation of `LlmExecutionTools` that wraps another LlmExecutionTools and applies agent-specific system prompts and requirements
17097
+ * - `OpenAiAssistantExecutionTools` - which is a specific implementation of `LlmExecutionTools` for OpenAI models with assistant capabilities, recommended for usage in `Agent` or `AgentLlmExecutionTools`
17098
+ *
17099
+ * @public exported from `@promptbook/core`
17100
+ */
17101
+ class RemoteAgent extends Agent {
17102
+ static async connect(options) {
17103
+ console.log('!!!!!', `${options.agentUrl}/api/book`);
17104
+ const bookResponse = await fetch(`${options.agentUrl}/api/book`);
17105
+ // <- TODO: !!!! What about closed-source agents?
17106
+ // <- TODO: !!!! Maybe use promptbookFetch
17107
+ const agentSourceValue = (await bookResponse.text());
17108
+ const agentSource = new BehaviorSubject(agentSourceValue);
17109
+ // <- TODO: !!!!!! Support updating
17110
+ return new RemoteAgent({
17111
+ ...options,
17112
+ executionTools: {
17113
+ /* Note: These tools are not used */
17114
+ // ---------------------------------------
17115
+ /*
17116
+ TODO: !!! Get rid of
17117
+
17118
+ > You have not provided any `LlmExecutionTools`
17119
+ > This means that you won't be able to execute any prompts that require large language models like GPT-4 or Anthropic's Claude.
17120
+ >
17121
+ > Technically, it's not an error, but it's probably not what you want because it does not make sense to use Promptbook without language models.
17122
+
17123
+ */
17124
+ },
17125
+ agentSource,
17126
+ });
17127
+ }
17128
+ constructor(options) {
17129
+ super(options);
17130
+ this.agentUrl = options.agentUrl;
17131
+ }
17132
+ /**
17133
+ * Calls the agent on agents remote server
17134
+ */
17135
+ async callChatModel(prompt) {
17136
+ // Ensure we're working with a chat prompt
17137
+ if (prompt.modelRequirements.modelVariant !== 'CHAT') {
17138
+ throw new Error('Agents only supports chat prompts');
17139
+ }
17140
+ const bookResponse = await fetch(`${this.agentUrl}/api/chat?message=${encodeURIComponent(prompt.content)}`);
17141
+ // <- TODO: !!!! What about closed-source agents?
17142
+ // <- TODO: !!!! Maybe use promptbookFetch
17143
+ let content = '';
17144
+ if (!bookResponse.body) {
17145
+ content = await bookResponse.text();
17146
+ }
17147
+ else {
17148
+ // Note: [🐚] Problem with streaming is not here but it is not implemented on server
17149
+ const decoder = new TextDecoder();
17150
+ // Web ReadableStream is not async-iterable in many runtimes; use a reader.
17151
+ const reader = bookResponse.body.getReader();
17152
+ try {
17153
+ let doneReading = false;
17154
+ while (!doneReading) {
17155
+ const { done, value } = await reader.read();
17156
+ doneReading = !!done;
17157
+ if (value) {
17158
+ const textChunk = decoder.decode(value, { stream: true });
17159
+ // console.debug('RemoteAgent chunk:', textChunk);
17160
+ content += textChunk;
17161
+ }
17162
+ }
17163
+ // Flush any remaining decoder internal state
17164
+ content += decoder.decode();
17165
+ }
17166
+ finally {
17167
+ reader.releaseLock();
17168
+ }
17169
+ }
17170
+ // <- TODO: !!!!!!!! Transfer metadata
17171
+ const agentResult = {
17172
+ content,
17173
+ modelName: this.modelName,
17174
+ timing: {},
17175
+ usage: {},
17176
+ rawPromptContent: {},
17177
+ rawRequest: {},
17178
+ rawResponse: {},
17179
+ // <- TODO: !!!!!!!! Transfer and proxy the metadata
17180
+ };
17181
+ return agentResult;
17182
+ }
17183
+ }
17184
+ /**
17185
+ * TODO: [🧠][😰]Agent is not working with the parameters, should it be?
17186
+ * TODO: !!! Agent on remote server
17187
+ */
17188
+
17102
17189
  /**
17103
17190
  * Registration of LLM provider metadata
17104
17191
  *
@@ -18317,8 +18404,7 @@ function aboutPromptbookInformation(options) {
18317
18404
 
18318
18405
  ## Servers
18319
18406
 
18320
- ${block(REMOTE_SERVER_URLS.map(({ title, urls, isAnonymousModeAllowed, description }, index) => `${index + 1}. ${title} ${description}
18321
- ${isAnonymousModeAllowed ? '🐱‍💻 ' : ''} ${urls.join(', ')}
18407
+ ${block(REMOTE_SERVER_URLS.map(({ title, urls, description }, index) => `${index + 1}. ${title} ${description} ${urls.join(', ')}
18322
18408
  `).join('\n'))}
18323
18409
  `);
18324
18410
  fullInfoPieces.push(serversInfo);
@@ -18361,6 +18447,30 @@ function $randomItem(...items) {
18361
18447
  * TODO: [🤶] Maybe export through `@promptbook/utils` or `@promptbook/random` package
18362
18448
  */
18363
18449
 
18450
+ const PERSONALITIES = [
18451
+ 'Friendly and helpful AI agent.',
18452
+ 'Professional and efficient virtual assistant.',
18453
+ 'Creative and imaginative digital companion.',
18454
+ 'Knowledgeable and informative AI guide.',
18455
+ 'Empathetic and understanding support bot.',
18456
+ 'Energetic and enthusiastic conversational partner.',
18457
+ 'Calm and patient virtual helper.',
18458
+ 'Curious and inquisitive AI explorer.',
18459
+ 'Witty and humorous digital friend.',
18460
+ 'Serious and focused AI consultant.',
18461
+ ];
18462
+ /**
18463
+ * @@@@
18464
+ *
18465
+ * @private internal helper function
18466
+ */
18467
+ function $randomAgentPersona() {
18468
+ return $randomItem(...PERSONALITIES);
18469
+ }
18470
+ /**
18471
+ * TODO: [🤶] Maybe export through `@promptbook/utils` or `@promptbook/random` package
18472
+ */
18473
+
18364
18474
  const FIRSTNAMES = [
18365
18475
  'Paul',
18366
18476
  'George',
@@ -18421,30 +18531,6 @@ function $randomFullnameWithColor() {
18421
18531
  * TODO: [🤶] Maybe export through `@promptbook/utils` or `@promptbook/random` package
18422
18532
  */
18423
18533
 
18424
- const PERSONALITIES = [
18425
- 'Friendly and helpful AI agent.',
18426
- 'Professional and efficient virtual assistant.',
18427
- 'Creative and imaginative digital companion.',
18428
- 'Knowledgeable and informative AI guide.',
18429
- 'Empathetic and understanding support bot.',
18430
- 'Energetic and enthusiastic conversational partner.',
18431
- 'Calm and patient virtual helper.',
18432
- 'Curious and inquisitive AI explorer.',
18433
- 'Witty and humorous digital friend.',
18434
- 'Serious and focused AI consultant.',
18435
- ];
18436
- /**
18437
- * @@@@
18438
- *
18439
- * @private internal helper function
18440
- */
18441
- function $randomAgentPersona() {
18442
- return $randomItem(...PERSONALITIES);
18443
- }
18444
- /**
18445
- * TODO: [🤶] Maybe export through `@promptbook/utils` or `@promptbook/random` package
18446
- */
18447
-
18448
18534
  /**
18449
18535
  * Generates boilerplate for a new agent book
18450
18536
  *
@@ -18478,5 +18564,5 @@ function $generateBookBoilerplate(options) {
18478
18564
  * TODO: [🤶] Maybe export through `@promptbook/utils` or `@promptbook/random` package
18479
18565
  */
18480
18566
 
18481
- 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, 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_EXECUTION_ATTEMPTS, DEFAULT_MAX_FILE_SIZE, DEFAULT_MAX_KNOWLEDGE_SOURCES_SCRAPING_DEPTH, DEFAULT_MAX_KNOWLEDGE_SOURCES_SCRAPING_TOTAL, DEFAULT_MAX_PARALLEL_COUNT, 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, ImageGeneratorFormfactorDefinition, KnowledgeScrapeError, LimitReachedError, MANDATORY_CSV_SETTINGS, MAX_FILENAME_LENGTH, MODEL_ORDERS, MODEL_TRUST_LEVELS, MODEL_VARIANTS, MatcherFormfactorDefinition, MemoryStorage, MissingToolsError, MultipleLlmExecutionTools, NAME, 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_LOGO_URL, PROMPTBOOK_SYNTAX_COLORS, ParseError, PipelineExecutionError, PipelineLogicError, PipelineUrlError, PrefixStorage, PromptbookFetchError, REMOTE_SERVER_URLS, RESERVED_PARAMETER_NAMES, SET_IS_VERBOSE, SectionTypes, SheetsFormfactorDefinition, 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, computeCosineSimilarity, countUsage, createAgentLlmExecutionTools, createAgentModelRequirements, createAgentModelRequirementsWithCommitments, createBasicAgentModelRequirements, createEmptyAgentModelRequirements, createLlmToolsFromConfiguration, createPipelineCollectionFromJson, createPipelineCollectionFromPromise, createPipelineCollectionFromUrl, createPipelineExecutor, createPipelineSubcollection, embeddingVectorToString, executionReportJsonToString, extractParameterNamesFromTask, filterModels, generatePlaceholderAgentProfileImageUrl, getAllCommitmentDefinitions, getAllCommitmentTypes, getCommitmentDefinition, getPipelineInterface, getSingleLlmExecutionTools, identificationToPromptbookToken, isCommitmentSupported, isPassingExpectations, isPipelineImplementingInterface, isPipelineInterfacesEqual, isPipelinePrepared, isValidBook, isValidPipelineString, joinLlmExecutionTools, limitTotalUsage, makeKnowledgeSourceHandler, migratePipeline, padBook, parseAgentSource, parseParameters, parsePipeline, pipelineCollectionToJson, pipelineJsonToString, prepareKnowledgePieces, preparePersona, preparePipeline, prettifyPipelineString, promptbookFetch, promptbookTokenToIdentification, unpreparePipeline, usageToHuman, usageToWorktime, validateBook, validatePipeline, validatePipelineString };
18567
+ 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, 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_EXECUTION_ATTEMPTS, DEFAULT_MAX_FILE_SIZE, DEFAULT_MAX_KNOWLEDGE_SOURCES_SCRAPING_DEPTH, DEFAULT_MAX_KNOWLEDGE_SOURCES_SCRAPING_TOTAL, DEFAULT_MAX_PARALLEL_COUNT, 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, ImageGeneratorFormfactorDefinition, KnowledgeScrapeError, LimitReachedError, MANDATORY_CSV_SETTINGS, MAX_FILENAME_LENGTH, MODEL_ORDERS, MODEL_TRUST_LEVELS, MODEL_VARIANTS, MatcherFormfactorDefinition, MemoryStorage, MissingToolsError, MultipleLlmExecutionTools, NAME, 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_LOGO_URL, PROMPTBOOK_SYNTAX_COLORS, ParseError, PipelineExecutionError, PipelineLogicError, PipelineUrlError, PrefixStorage, PromptbookFetchError, REMOTE_SERVER_URLS, RESERVED_PARAMETER_NAMES, RemoteAgent, SET_IS_VERBOSE, SectionTypes, SheetsFormfactorDefinition, 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, computeCosineSimilarity, countUsage, createAgentLlmExecutionTools, createAgentModelRequirements, createAgentModelRequirementsWithCommitments, createBasicAgentModelRequirements, createEmptyAgentModelRequirements, createLlmToolsFromConfiguration, createPipelineCollectionFromJson, createPipelineCollectionFromPromise, createPipelineCollectionFromUrl, createPipelineExecutor, createPipelineSubcollection, embeddingVectorToString, executionReportJsonToString, extractParameterNamesFromTask, filterModels, generatePlaceholderAgentProfileImageUrl, getAllCommitmentDefinitions, getAllCommitmentTypes, getCommitmentDefinition, getPipelineInterface, getSingleLlmExecutionTools, identificationToPromptbookToken, isCommitmentSupported, isPassingExpectations, isPipelineImplementingInterface, isPipelineInterfacesEqual, isPipelinePrepared, isValidBook, isValidPipelineString, joinLlmExecutionTools, limitTotalUsage, makeKnowledgeSourceHandler, migratePipeline, padBook, parseAgentSource, parseParameters, parsePipeline, pipelineCollectionToJson, pipelineJsonToString, prepareKnowledgePieces, preparePersona, preparePipeline, prettifyPipelineString, promptbookFetch, promptbookTokenToIdentification, unpreparePipeline, usageToHuman, usageToWorktime, validateBook, validatePipeline, validatePipelineString };
18482
18568
  //# sourceMappingURL=index.es.js.map