@promptbook/color 0.104.0-9 → 0.105.0-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.
Files changed (65) hide show
  1. package/esm/index.es.js +2 -2
  2. package/esm/index.es.js.map +1 -1
  3. package/esm/typings/src/_packages/components.index.d.ts +0 -6
  4. package/esm/typings/src/_packages/core.index.d.ts +10 -6
  5. package/esm/typings/src/_packages/types.index.d.ts +8 -0
  6. package/esm/typings/src/_packages/utils.index.d.ts +2 -0
  7. package/esm/typings/src/book-2.0/agent-source/AgentBasicInformation.d.ts +24 -0
  8. package/esm/typings/src/book-2.0/agent-source/AgentModelRequirements.d.ts +16 -2
  9. package/esm/typings/src/book-2.0/agent-source/createAgentModelRequirements.tools.test.d.ts +1 -0
  10. package/esm/typings/src/book-2.0/utils/generatePlaceholderAgentProfileImageUrl.d.ts +1 -1
  11. package/esm/typings/src/book-components/Chat/save/_common/string_chat_format_name.d.ts +1 -1
  12. package/esm/typings/src/book-components/Chat/types/ChatMessage.d.ts +23 -3
  13. package/esm/typings/src/book-components/_common/Dropdown/Dropdown.d.ts +5 -1
  14. package/esm/typings/src/book-components/_common/HamburgerMenu/HamburgerMenu.d.ts +5 -1
  15. package/esm/typings/src/book-components/icons/AboutIcon.d.ts +5 -1
  16. package/esm/typings/src/book-components/icons/AttachmentIcon.d.ts +6 -2
  17. package/esm/typings/src/book-components/icons/CameraIcon.d.ts +6 -2
  18. package/esm/typings/src/book-components/icons/DownloadIcon.d.ts +5 -1
  19. package/esm/typings/src/book-components/icons/MenuIcon.d.ts +5 -1
  20. package/esm/typings/src/book-components/icons/SaveIcon.d.ts +6 -2
  21. package/esm/typings/src/collection/agent-collection/AgentCollection.d.ts +1 -1
  22. package/esm/typings/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentCollectionInSupabase.d.ts +9 -7
  23. package/esm/typings/src/commands/_common/types/Command.d.ts +1 -1
  24. package/esm/typings/src/commitments/IMPORT/IMPORT.d.ts +34 -0
  25. package/esm/typings/src/commitments/META/META_DESCRIPTION.d.ts +41 -0
  26. package/esm/typings/src/commitments/USE_SEARCH_ENGINE/USE_SEARCH_ENGINE.d.ts +2 -2
  27. package/esm/typings/src/commitments/_base/BookCommitment.d.ts +1 -1
  28. package/esm/typings/src/commitments/index.d.ts +2 -1
  29. package/esm/typings/src/config.d.ts +14 -1
  30. package/esm/typings/src/errors/utils/deserializeError.d.ts +1 -1
  31. package/esm/typings/src/execution/PromptResult.d.ts +24 -1
  32. package/esm/typings/src/formfactors/_common/FormfactorDefinition.d.ts +1 -1
  33. package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsForTestingAndScriptsAndPlayground.d.ts +1 -1
  34. package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsForWizardOrCli.d.ts +1 -1
  35. package/esm/typings/src/llm-providers/_common/utils/count-total-usage/LlmExecutionToolsWithTotalUsage.d.ts +1 -1
  36. package/esm/typings/src/llm-providers/_common/utils/count-total-usage/countUsage.d.ts +8 -4
  37. package/esm/typings/src/llm-providers/_common/utils/count-total-usage/limitTotalUsage.d.ts +1 -1
  38. package/esm/typings/src/llm-providers/_multiple/getSingleLlmExecutionTools.d.ts +1 -1
  39. package/esm/typings/src/llm-providers/_multiple/joinLlmExecutionTools.d.ts +12 -8
  40. package/esm/typings/src/llm-providers/agent/Agent.d.ts +7 -1
  41. package/esm/typings/src/llm-providers/agent/AgentLlmExecutionTools.d.ts +1 -1
  42. package/esm/typings/src/llm-providers/openai/OpenAiCompatibleExecutionToolsOptions.d.ts +5 -0
  43. package/esm/typings/src/llm-providers/openai/utils/mapToolsToOpenAi.d.ts +8 -0
  44. package/esm/typings/src/remote-server/ui/ServerApp.d.ts +5 -1
  45. package/esm/typings/src/scrapers/_common/utils/promptbookFetch.test.d.ts +1 -0
  46. package/esm/typings/src/search-engines/SearchEngine.d.ts +9 -0
  47. package/esm/typings/src/search-engines/SearchResult.d.ts +18 -0
  48. package/esm/typings/src/search-engines/bing/BingSearchEngine.d.ts +15 -0
  49. package/esm/typings/src/search-engines/dummy/DummySearchEngine.d.ts +15 -0
  50. package/esm/typings/src/types/LlmToolDefinition.d.ts +27 -0
  51. package/esm/typings/src/types/ModelRequirements.d.ts +13 -0
  52. package/esm/typings/src/types/Prompt.d.ts +13 -0
  53. package/esm/typings/src/types/typeAliasEmoji.d.ts +2 -2
  54. package/esm/typings/src/utils/misc/parseNumber.d.ts +1 -1
  55. package/esm/typings/src/utils/random/$randomAgentPersona.d.ts +7 -2
  56. package/esm/typings/src/utils/random/$randomItem.d.ts +1 -1
  57. package/esm/typings/src/utils/random/$randomSeed.d.ts +1 -1
  58. package/esm/typings/src/utils/validators/url/isValidAgentUrl.d.ts +16 -0
  59. package/esm/typings/src/utils/validators/url/isValidAgentUrl.test.d.ts +1 -0
  60. package/esm/typings/src/utils/validators/url/isValidPipelineUrl.d.ts +2 -1
  61. package/esm/typings/src/utils/validators/url/isValidUrl.d.ts +4 -3
  62. package/esm/typings/src/version.d.ts +1 -1
  63. package/package.json +2 -2
  64. package/umd/index.umd.js +2 -2
  65. package/umd/index.umd.js.map +1 -1
@@ -5,9 +5,12 @@ import type { string_agent_name, string_agent_permanent_id } from '../../../../t
5
5
  import { AgentCollectionInSupabaseOptions } from './AgentCollectionInSupabaseOptions';
6
6
  import type { AgentsDatabaseSchema } from './AgentsDatabaseSchema';
7
7
  /**
8
- * Agent collection stored in Supabase table
8
+ * Agent collection stored in a Supabase table.
9
9
  *
10
- * Note: This object can work both from Node.js and browser environment depending on the Supabase client provided
10
+ * This class provides a way to manage a collection of agents (pipelines) using Supabase
11
+ * as the storage backend. It supports listing, creating, updating, and soft-deleting agents.
12
+ *
13
+ * Note: This object can work both from Node.js and browser environment depending on the Supabase client provided.
11
14
  *
12
15
  * @public exported from `@promptbook/core`
13
16
  * <- TODO: [🐱‍🚀] Move to `@promptbook/supabase` package
@@ -16,9 +19,8 @@ export declare class AgentCollectionInSupabase {
16
19
  private readonly supabaseClient;
17
20
  readonly options?: AgentCollectionInSupabaseOptions | undefined;
18
21
  /**
19
- * @param rootPath - path to the directory with agents
20
- * @param tools - Execution tools to be used in [🐱‍🚀] `Agent` itself and listing the agents
21
- * @param options - Options for the collection creation
22
+ * @param supabaseClient - The initialized Supabase client
23
+ * @param options - Configuration options for the collection (e.g., table prefix, verbosity)
22
24
  */
23
25
  constructor(supabaseClient: SupabaseClient<AgentsDatabaseSchema>, options?: AgentCollectionInSupabaseOptions | undefined);
24
26
  /**
@@ -26,11 +28,11 @@ export declare class AgentCollectionInSupabase {
26
28
  */
27
29
  listAgents(): Promise<ReadonlyArray<AgentBasicInformation>>;
28
30
  /**
29
- * [🐱‍🚀]@@@
31
+ * Retrieves the permanent ID of an agent by its name or permanent ID.
30
32
  */
31
33
  getAgentPermanentId(agentNameOrPermanentId: string_agent_name | string_agent_permanent_id): Promise<string_agent_permanent_id>;
32
34
  /**
33
- * [🐱‍🚀]@@@
35
+ * Retrieves the source code of an agent by its name or permanent ID.
34
36
  */
35
37
  getAgentSource(agentNameOrPermanentId: string_agent_name | string_agent_permanent_id): Promise<string_book>;
36
38
  /**
@@ -3,4 +3,4 @@ import { COMMANDS } from '../../index';
3
3
  * Command is one piece of the book file section which adds some logic to the task or the whole pipeline.
4
4
  * It is parsed from the markdown from ul/ol items - one command per one item.
5
5
  */
6
- export type Command = ReturnType<typeof COMMANDS[number]['parse']>;
6
+ export type Command = ReturnType<(typeof COMMANDS)[number]['parse']>;
@@ -0,0 +1,34 @@
1
+ import type { AgentModelRequirements } from '../../book-2.0/agent-source/AgentModelRequirements';
2
+ import { BaseCommitmentDefinition } from '../_base/BaseCommitmentDefinition';
3
+ /**
4
+ * IMPORT commitment definition
5
+ *
6
+ * The IMPORT commitment tells the agent to import content from another agent at the current location.
7
+ *
8
+ * Example usage in agent source:
9
+ *
10
+ * ```book
11
+ * IMPORT https://s6.ptbk.io/benjamin-white
12
+ * ```
13
+ *
14
+ * @private [🪔] Maybe export the commitments through some package
15
+ */
16
+ export declare class ImportCommitmentDefinition extends BaseCommitmentDefinition<'IMPORT' | 'IMPORTS'> {
17
+ constructor(type?: 'IMPORT' | 'IMPORTS');
18
+ /**
19
+ * Short one-line description of IMPORT.
20
+ */
21
+ get description(): string;
22
+ /**
23
+ * Icon for this commitment.
24
+ */
25
+ get icon(): string;
26
+ /**
27
+ * Markdown documentation for IMPORT commitment.
28
+ */
29
+ get documentation(): string;
30
+ applyToAgentModelRequirements(requirements: AgentModelRequirements, content: string): AgentModelRequirements;
31
+ }
32
+ /**
33
+ * Note: [💞] Ignore a discrepancy between file name and entity name
34
+ */
@@ -0,0 +1,41 @@
1
+ import type { AgentModelRequirements } from '../../book-2.0/agent-source/AgentModelRequirements';
2
+ import { BaseCommitmentDefinition } from '../_base/BaseCommitmentDefinition';
3
+ /**
4
+ * META DESCRIPTION commitment definition
5
+ *
6
+ * The META DESCRIPTION commitment sets the agent's meta description for the profile page.
7
+ * This commitment is special because it doesn't affect the system message,
8
+ * but is handled separately in the parsing logic.
9
+ *
10
+ * Example usage in agent source:
11
+ *
12
+ * ```book
13
+ * META DESCRIPTION An AI assistant specialized in business tasks
14
+ * ```
15
+ *
16
+ * @private [🪔] Maybe export the commitments through some package
17
+ */
18
+ export declare class MetaDescriptionCommitmentDefinition extends BaseCommitmentDefinition<'META DESCRIPTION'> {
19
+ constructor();
20
+ /**
21
+ * Short one-line description of META DESCRIPTION.
22
+ */
23
+ get description(): string;
24
+ /**
25
+ * Icon for this commitment.
26
+ */
27
+ get icon(): string;
28
+ /**
29
+ * Markdown documentation for META DESCRIPTION commitment.
30
+ */
31
+ get documentation(): string;
32
+ applyToAgentModelRequirements(requirements: AgentModelRequirements, content: string): AgentModelRequirements;
33
+ /**
34
+ * Extracts the meta description from the content
35
+ * This is used by the parsing logic
36
+ */
37
+ extractMetaDescription(content: string): string | null;
38
+ }
39
+ /**
40
+ * Note: [💞] Ignore a discrepancy between file name and entity name
41
+ */
@@ -6,13 +6,13 @@ import { BaseCommitmentDefinition } from '../_base/BaseCommitmentDefinition';
6
6
  * The `USE SEARCH ENGINE` commitment indicates that the agent should utilize a search engine tool
7
7
  * to access and retrieve up-to-date information from the internet when necessary.
8
8
  *
9
- * The content following `USE SEARCH ENGINE` is ignored (similar to NOTE).
9
+ * The content following `USE SEARCH ENGINE` is an arbitrary text that the agent should know (e.g. search scope or instructions).
10
10
  *
11
11
  * Example usage in agent source:
12
12
  *
13
13
  * ```book
14
14
  * USE SEARCH ENGINE
15
- * USE SEARCH ENGINE This will be ignored
15
+ * USE SEARCH ENGINE Hledej informace o Přemyslovcích
16
16
  * ```
17
17
  *
18
18
  * @private [🪔] Maybe export the commitments through some package
@@ -2,4 +2,4 @@ import { COMMITMENT_REGISTRY } from '../index';
2
2
  /**
3
3
  * All available book commitment types
4
4
  */
5
- export type BookCommitment = typeof COMMITMENT_REGISTRY[number]['type'];
5
+ export type BookCommitment = (typeof COMMITMENT_REGISTRY)[number]['type'];
@@ -7,6 +7,7 @@ import { DeleteCommitmentDefinition } from './DELETE/DELETE';
7
7
  import { DictionaryCommitmentDefinition } from './DICTIONARY/DICTIONARY';
8
8
  import { FormatCommitmentDefinition } from './FORMAT/FORMAT';
9
9
  import { FromCommitmentDefinition } from './FROM/FROM';
10
+ import { ImportCommitmentDefinition } from './IMPORT/IMPORT';
10
11
  import { GoalCommitmentDefinition } from './GOAL/GOAL';
11
12
  import { KnowledgeCommitmentDefinition } from './KNOWLEDGE/KNOWLEDGE';
12
13
  import { LanguageCommitmentDefinition } from './LANGUAGE/LANGUAGE';
@@ -40,7 +41,7 @@ import { NotYetImplementedCommitmentDefinition } from './_base/NotYetImplemented
40
41
  *
41
42
  * @private Use functions to access commitments instead of this array directly
42
43
  */
43
- export declare const COMMITMENT_REGISTRY: readonly [PersonaCommitmentDefinition, PersonaCommitmentDefinition, KnowledgeCommitmentDefinition, MemoryCommitmentDefinition, MemoryCommitmentDefinition, StyleCommitmentDefinition, StyleCommitmentDefinition, RuleCommitmentDefinition, RuleCommitmentDefinition, LanguageCommitmentDefinition, LanguageCommitmentDefinition, SampleCommitmentDefinition, SampleCommitmentDefinition, FormatCommitmentDefinition, FormatCommitmentDefinition, FromCommitmentDefinition, ModelCommitmentDefinition, ModelCommitmentDefinition, ActionCommitmentDefinition, ActionCommitmentDefinition, ComponentCommitmentDefinition, MetaImageCommitmentDefinition, MetaColorCommitmentDefinition, MetaFontCommitmentDefinition, MetaLinkCommitmentDefinition, MetaCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, GoalCommitmentDefinition, GoalCommitmentDefinition, InitialMessageCommitmentDefinition, UserMessageCommitmentDefinition, AgentMessageCommitmentDefinition, MessageCommitmentDefinition, MessageCommitmentDefinition, ScenarioCommitmentDefinition, ScenarioCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, DictionaryCommitmentDefinition, OpenCommitmentDefinition, ClosedCommitmentDefinition, UseBrowserCommitmentDefinition, UseSearchEngineCommitmentDefinition, UseMcpCommitmentDefinition, UseCommitmentDefinition, NotYetImplementedCommitmentDefinition<"EXPECT">, NotYetImplementedCommitmentDefinition<"BEHAVIOUR">, NotYetImplementedCommitmentDefinition<"BEHAVIOURS">, NotYetImplementedCommitmentDefinition<"AVOID">, NotYetImplementedCommitmentDefinition<"AVOIDANCE">, NotYetImplementedCommitmentDefinition<"CONTEXT">];
44
+ export declare const COMMITMENT_REGISTRY: readonly [PersonaCommitmentDefinition, PersonaCommitmentDefinition, KnowledgeCommitmentDefinition, MemoryCommitmentDefinition, MemoryCommitmentDefinition, StyleCommitmentDefinition, StyleCommitmentDefinition, RuleCommitmentDefinition, RuleCommitmentDefinition, LanguageCommitmentDefinition, LanguageCommitmentDefinition, SampleCommitmentDefinition, SampleCommitmentDefinition, FormatCommitmentDefinition, FormatCommitmentDefinition, FromCommitmentDefinition, ImportCommitmentDefinition, ImportCommitmentDefinition, ModelCommitmentDefinition, ModelCommitmentDefinition, ActionCommitmentDefinition, ActionCommitmentDefinition, ComponentCommitmentDefinition, MetaImageCommitmentDefinition, MetaColorCommitmentDefinition, MetaFontCommitmentDefinition, MetaLinkCommitmentDefinition, MetaCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, GoalCommitmentDefinition, GoalCommitmentDefinition, InitialMessageCommitmentDefinition, UserMessageCommitmentDefinition, AgentMessageCommitmentDefinition, MessageCommitmentDefinition, MessageCommitmentDefinition, ScenarioCommitmentDefinition, ScenarioCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, DictionaryCommitmentDefinition, OpenCommitmentDefinition, ClosedCommitmentDefinition, UseBrowserCommitmentDefinition, UseSearchEngineCommitmentDefinition, UseMcpCommitmentDefinition, UseCommitmentDefinition, NotYetImplementedCommitmentDefinition<"EXPECT">, NotYetImplementedCommitmentDefinition<"BEHAVIOUR">, NotYetImplementedCommitmentDefinition<"BEHAVIOURS">, NotYetImplementedCommitmentDefinition<"AVOID">, NotYetImplementedCommitmentDefinition<"AVOIDANCE">, NotYetImplementedCommitmentDefinition<"CONTEXT">];
44
45
  /**
45
46
  * Gets a commitment definition by its type
46
47
  * @param type The commitment type to look up
@@ -1,6 +1,6 @@
1
1
  import type { CsvSettings } from './formats/csv/CsvSettings';
2
2
  import type { IntermediateFilesStrategy } from './types/IntermediateFilesStrategy';
3
- import type { string_app_id, string_email, string_name, string_promptbook_server_url } from './types/typeAliases';
3
+ import type { string_app_id, string_email, string_legal_entity, string_name, string_promptbook_server_url } from './types/typeAliases';
4
4
  import { Color } from './utils/color/Color';
5
5
  /**
6
6
  * Warning message for the generated sections and files files
@@ -22,6 +22,12 @@ export declare const NAME = "Promptbook";
22
22
  * @public exported from `@promptbook/core`
23
23
  */
24
24
  export declare const ADMIN_EMAIL: string_email;
25
+ /**
26
+ * Email of the responsible person
27
+ *
28
+ * @public exported from `@promptbook/core`
29
+ */
30
+ export declare const PROMPTBOOK_LEGAL_ENTITY: string_legal_entity;
25
31
  /**
26
32
  * Name of the responsible person for the Promptbook on GitHub
27
33
  *
@@ -207,6 +213,12 @@ export declare const DEFAULT_INTERMEDIATE_FILES_STRATEGY: IntermediateFilesStrat
207
213
  * @public exported from `@promptbook/core`
208
214
  */
209
215
  export declare const DEFAULT_MAX_PARALLEL_COUNT = 5;
216
+ /**
217
+ * The maximum depth to which recursion can occur
218
+ *
219
+ * @public exported from `@promptbook/core`
220
+ */
221
+ export declare const DEFAULT_MAX_RECURSION = 10;
210
222
  /**
211
223
  * The maximum number of attempts to execute LLM task before giving up
212
224
  *
@@ -295,6 +307,7 @@ export declare const MOMENT_ARG_THRESHOLDS: {
295
307
  /**
296
308
  * Default remote server URL for the Promptbook
297
309
  *
310
+ * @deprecated TODO: !!! Deprecate all things related to pipelines and pipelines server
298
311
  * @public exported from `@promptbook/core`
299
312
  */
300
313
  export declare const DEFAULT_REMOTE_SERVER_URL: string_promptbook_server_url;
@@ -4,4 +4,4 @@ import type { ErrorJson } from './ErrorJson';
4
4
  *
5
5
  * @public exported from `@promptbook/utils`
6
6
  */
7
- export declare function deserializeError(error: ErrorJson): Error;
7
+ export declare function deserializeError(error: ErrorJson, isStackAddedToMessage?: boolean): Error;
@@ -1,4 +1,5 @@
1
1
  import type { string_date_iso8601, string_model_name, string_prompt } from '../types/typeAliases';
2
+ import type { TODO_any } from '../utils/organization/TODO_any';
2
3
  import type { TODO_object } from '../utils/organization/TODO_object';
3
4
  import type { EmbeddingVector } from './EmbeddingVector';
4
5
  import type { Usage } from './Usage';
@@ -21,7 +22,29 @@ export type CompletionPromptResult = CommonPromptResult;
21
22
  *
22
23
  * Note: [🚉] This is fully serializable as JSON
23
24
  */
24
- export type ChatPromptResult = CommonPromptResult & {};
25
+ export type ChatPromptResult = CommonPromptResult & {
26
+ /**
27
+ * Optional tool calls made during the execution
28
+ */
29
+ readonly toolCalls?: ReadonlyArray<{
30
+ /**
31
+ * Name of the tool
32
+ */
33
+ readonly name: string;
34
+ /**
35
+ * Arguments of the tool call
36
+ */
37
+ readonly arguments: string;
38
+ /**
39
+ * Result of the tool call
40
+ */
41
+ readonly result: string;
42
+ /**
43
+ * Raw tool call from the model
44
+ */
45
+ readonly rawToolCall: TODO_any;
46
+ }>;
47
+ };
25
48
  /**
26
49
  * Image prompt result
27
50
  *
@@ -7,4 +7,4 @@ import { FORMFACTOR_DEFINITIONS } from '../index';
7
7
  * Note: [🚉] This is fully serializable as JSON
8
8
  * @see https://github.com/webgptorg/promptbook/discussions/172
9
9
  */
10
- export type FormfactorDefinition = typeof FORMFACTOR_DEFINITIONS[number];
10
+ export type FormfactorDefinition = (typeof FORMFACTOR_DEFINITIONS)[number];
@@ -21,7 +21,7 @@ export declare function $provideLlmToolsForTestingAndScriptsAndPlayground(option
21
21
  export {};
22
22
  /**
23
23
  * Note: [⚪] This should never be in any released package
24
- * TODO: [👷‍♂️] @@@ Manual about construction of llmTools
24
+ * TODO: [👷‍♂️] Write a comprehensive manual about the construction of LLM tools
25
25
  * TODO: This should be maybe not under `_common` but under `utils-internal` / `utils/internal`
26
26
  * TODO: [®] DRY Register logi
27
27
  */
@@ -51,7 +51,7 @@ export declare function $provideLlmToolsForWizardOrCli(options?: ProvideLlmTools
51
51
  export {};
52
52
  /**
53
53
  * Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
54
- * TODO: [👷‍♂️] @@@ Manual about construction of llmTools
54
+ * TODO: [👷‍♂️] Write a comprehensive manual about the construction of LLM tools
55
55
  * TODO: [🥃] Allow `ptbk make` without llm tools
56
56
  * TODO: This should be maybe not under `_common` but under `utils-internal` / `utils/internal`
57
57
  * TODO: [®] DRY Register logic
@@ -17,6 +17,6 @@ export type LlmExecutionToolsWithTotalUsage = LlmExecutionTools & {
17
17
  spending(): Observable<Usage>;
18
18
  };
19
19
  /**
20
- * TODO: [👷‍♂️] @@@ Manual about construction of llmTools
20
+ * TODO: [👷‍♂️] Write a comprehensive manual about the construction of LLM tools
21
21
  * Note: [🥫] Not using getter `get totalUsage` but `getTotalUsage` to allow this object to be proxied
22
22
  */
@@ -1,10 +1,14 @@
1
1
  import type { LlmExecutionTools } from '../../../../execution/LlmExecutionTools';
2
2
  import type { LlmExecutionToolsWithTotalUsage } from './LlmExecutionToolsWithTotalUsage';
3
3
  /**
4
- * Intercepts LLM tools and counts total usage of the tools
4
+ * Intercepts LLM tools and counts total usage of the tools.
5
5
  *
6
- * @param llmTools LLM tools to be intercepted with usage counting
7
- * @returns LLM tools with same functionality with added total cost counting
6
+ * This function wraps the provided `LlmExecutionTools` with a proxy that tracks the cumulative
7
+ * usage (tokens, cost, etc.) across all model calls. It provides a way to monitor spending
8
+ * in real-time through an observable.
9
+ *
10
+ * @param llmTools - The LLM tools to be intercepted and tracked
11
+ * @returns An augmented version of the tools that includes usage tracking capabilities
8
12
  * @public exported from `@promptbook/core`
9
13
  */
10
14
  export declare function countUsage(llmTools: LlmExecutionTools): LlmExecutionToolsWithTotalUsage;
@@ -13,5 +17,5 @@ export declare function countUsage(llmTools: LlmExecutionTools): LlmExecutionToo
13
17
  * TODO: [🧠] Is there some meaningfull way how to test this util
14
18
  * TODO: [🧠][🌯] Maybe a way how to hide ability to `get totalUsage`
15
19
  * > const [llmToolsWithUsage,getUsage] = countTotalUsage(llmTools);
16
- * TODO: [👷‍♂️] @@@ Manual about construction of llmTools
20
+ * TODO: [👷‍♂️] Write a comprehensive manual explaining the construction and usage of LLM tools in the Promptbook ecosystem
17
21
  */
@@ -32,5 +32,5 @@ export {};
32
32
  * TODO: [🧠][💸] Maybe make some common abstraction `interceptLlmTools` and use here (or use javascript Proxy?)
33
33
  * TODO: [🧠] Is there some meaningfull way how to test this util
34
34
  * TODO: [🧠][🌯] Maybe a way how to hide ability to `get totalUsage`
35
- * TODO: [👷‍♂️] @@@ Manual about construction of llmTools
35
+ * TODO: [👷‍♂️] Write a comprehensive manual about the construction of LLM tools
36
36
  */
@@ -8,5 +8,5 @@ import { MultipleLlmExecutionTools } from './MultipleLlmExecutionTools';
8
8
  export declare function getSingleLlmExecutionTools(oneOrMoreLlmExecutionTools: undefined | LlmExecutionTools | ReadonlyArray<LlmExecutionTools>): LlmExecutionTools | MultipleLlmExecutionTools;
9
9
  /**
10
10
  * TODO: [🙆] `getSingleLlmExecutionTools` vs `joinLlmExecutionTools` - explain difference or pick one
11
- * TODO: [👷‍♂️] @@@ Manual about construction of llmTools
11
+ * TODO: [👷‍♂️] Write a comprehensive manual about how to construct and use LLM execution tools in Promptbook
12
12
  */
@@ -2,22 +2,26 @@ import type { LlmExecutionTools } from '../../execution/LlmExecutionTools';
2
2
  import type { string_markdown_text, string_title } from '../../types/typeAliases';
3
3
  import { MultipleLlmExecutionTools } from './MultipleLlmExecutionTools';
4
4
  /**
5
- * Joins multiple LLM Execution Tools into one
5
+ * Joins multiple LLM Execution Tools into one.
6
6
  *
7
- * @returns {LlmExecutionTools} Single wrapper for multiple LlmExecutionTools
7
+ * This function takes a list of `LlmExecutionTools` and returns a single unified
8
+ * `MultipleLlmExecutionTools` object. It provides failover and aggregation logic:
8
9
  *
9
- * 0) If there is no LlmExecutionTools, it warns and returns valid but empty LlmExecutionTools
10
- * 1) If there is only one LlmExecutionTools, it returns it wrapped in a proxy object
11
- * 2) If there are multiple LlmExecutionTools, first will be used first, second will be used if the first hasn`t defined model variant or fails, etc.
12
- * 3) When all LlmExecutionTools fail, it throws an error with a list of all errors merged into one
10
+ * 1. **Failover**: When a model call is made, it tries providers in the order they were provided.
11
+ * If the first provider doesn't support the requested model or fails, it tries the next one.
12
+ * 2. **Aggregation**: `listModels` returns a combined list of all models available from all providers.
13
+ * 3. **Empty case**: If no tools are provided, it logs a warning (as Promptbook requires LLMs to function).
13
14
  *
15
+ * @param title - A descriptive title for this collection of joined tools
16
+ * @param llmExecutionTools - An array of execution tools to be joined
17
+ * @returns A single unified execution tool wrapper
14
18
  *
15
- * Tip: You don't have to use this function directly, just pass an array of LlmExecutionTools to the `ExecutionTools`
19
+ * Tip: You don't have to use this function directly, just pass an array of LlmExecutionTools to the `ExecutionTools`.
16
20
  *
17
21
  * @public exported from `@promptbook/core`
18
22
  */
19
23
  export declare function joinLlmExecutionTools(title: string_title & string_markdown_text, ...llmExecutionTools: ReadonlyArray<LlmExecutionTools>): MultipleLlmExecutionTools;
20
24
  /**
21
25
  * TODO: [🙆] `getSingleLlmExecutionTools` vs `joinLlmExecutionTools` - explain difference or pick one
22
- * TODO: [👷‍♂️] @@@ Manual about construction of llmTools
26
+ * TODO: [👷‍♂️] Write a comprehensive manual about how to construct and use LLM execution tools in Promptbook
23
27
  */
@@ -1,5 +1,5 @@
1
1
  import { BehaviorSubject } from 'rxjs';
2
- import type { AgentBasicInformation, BookParameter } from '../../book-2.0/agent-source/AgentBasicInformation';
2
+ import type { AgentBasicInformation, AgentCapability, BookParameter } from '../../book-2.0/agent-source/AgentBasicInformation';
3
3
  import type { string_book } from '../../book-2.0/agent-source/string_book';
4
4
  import type { LlmExecutionTools } from '../../execution/LlmExecutionTools';
5
5
  import type { ChatPromptResult } from '../../execution/PromptResult';
@@ -20,6 +20,7 @@ import type { AgentOptions } from './AgentOptions';
20
20
  * @public exported from `@promptbook/core`
21
21
  */
22
22
  export declare class Agent extends AgentLlmExecutionTools implements LlmExecutionTools, AgentBasicInformation {
23
+ #private;
23
24
  private _agentName;
24
25
  /**
25
26
  * Name of the agent
@@ -37,6 +38,11 @@ export declare class Agent extends AgentLlmExecutionTools implements LlmExecutio
37
38
  * Links found in the agent source
38
39
  */
39
40
  links: Array<string_agent_url>;
41
+ /**
42
+ * Capabilities of the agent
43
+ * This is parsed from commitments like USE BROWSER, USE SEARCH ENGINE, KNOWLEDGE, etc.
44
+ */
45
+ capabilities: AgentCapability[];
40
46
  /**
41
47
  * Computed hash of the agent source for integrity verification
42
48
  */
@@ -22,7 +22,7 @@ import type { CreateAgentLlmExecutionToolsOptions } from './CreateAgentLlmExecut
22
22
  * @public exported from `@promptbook/core`
23
23
  */
24
24
  export declare class AgentLlmExecutionTools implements LlmExecutionTools {
25
- private readonly options;
25
+ protected readonly options: CreateAgentLlmExecutionToolsOptions;
26
26
  /**
27
27
  * Cache of OpenAI assistants to avoid creating duplicates
28
28
  */
@@ -1,5 +1,6 @@
1
1
  import type { ClientOptions } from 'openai';
2
2
  import type { CommonToolsOptions } from '../../execution/CommonToolsOptions';
3
+ import type { ExecutionTools } from '../../execution/ExecutionTools';
3
4
  import type { RemoteClientOptions } from '../../remote-server/types/RemoteClientOptions';
4
5
  /**
5
6
  * Options for `createOpenAiCompatibleExecutionTools` and `OpenAiCompatibleExecutionTools`
@@ -28,6 +29,10 @@ export type OpenAiCompatibleExecutionToolsNonProxiedOptions = CommonToolsOptions
28
29
  * @example 'https://api.deepseek.com/v1' (DeepSeek)
29
30
  */
30
31
  baseURL?: string;
32
+ /**
33
+ * Tools for executing the scripts
34
+ */
35
+ readonly executionTools?: Pick<ExecutionTools, 'script'>;
31
36
  isProxied?: false;
32
37
  };
33
38
  /**
@@ -0,0 +1,8 @@
1
+ import type OpenAI from 'openai';
2
+ import type { LlmToolDefinition } from '../../../types/LlmToolDefinition';
3
+ /**
4
+ * Maps Promptbook tools to OpenAI tools.
5
+ *
6
+ * @private
7
+ */
8
+ export declare function mapToolsToOpenAi(tools: ReadonlyArray<LlmToolDefinition>): Array<OpenAI.Chat.Completions.ChatCompletionTool>;
@@ -1,7 +1,11 @@
1
1
  import type { ServerInfo } from './types';
2
2
  /**
3
- * @@@
3
+ * Renders the full HTML document for the Promptbook Server UI.
4
4
  *
5
+ * This component provides the root structure of the server information page,
6
+ * including necessary meta tags, Tailwind CSS styling, and the server details body.
7
+ *
8
+ * @param props - Contains server information such as versions, port, and pipelines
5
9
  * @private internal utility of Remote Server
6
10
  */
7
11
  export declare function HtmlDoc({ info }: {
@@ -0,0 +1,9 @@
1
+ import type { Promisable } from 'type-fest';
2
+ import type { string_markdown, string_markdown_text, string_title } from '../types/typeAliases';
3
+ import type { SearchResult } from './SearchResult';
4
+ export type SearchEngine = {
5
+ readonly title: string_title & string_markdown_text;
6
+ readonly description?: string_markdown;
7
+ checkConfiguration(): Promisable<void>;
8
+ search(query: string): Promise<SearchResult[]>;
9
+ };
@@ -0,0 +1,18 @@
1
+ import type { string_url } from '../types/typeAliases';
2
+ /**
3
+ * Represents a search result from a search engine.
4
+ */
5
+ export type SearchResult = {
6
+ /**
7
+ * The title of the search result.
8
+ */
9
+ title: string;
10
+ /**
11
+ * The URL of the search result.
12
+ */
13
+ url: string_url;
14
+ /**
15
+ * A short snippet or description of the search result.
16
+ */
17
+ snippet: string;
18
+ };
@@ -0,0 +1,15 @@
1
+ import type { Promisable } from 'type-fest';
2
+ import type { string_markdown, string_markdown_text, string_title } from '../../types/typeAliases';
3
+ import type { SearchEngine } from '../SearchEngine';
4
+ import type { SearchResult } from '../SearchResult';
5
+ /**
6
+ * A search engine implementation that uses the Bing Web Search API.
7
+ *
8
+ * @private <- TODO: !!!! Export via some package
9
+ */
10
+ export declare class BingSearchEngine implements SearchEngine {
11
+ get title(): string_title & string_markdown_text;
12
+ get description(): string_markdown;
13
+ checkConfiguration(): Promisable<void>;
14
+ search(query: string): Promise<SearchResult[]>;
15
+ }
@@ -0,0 +1,15 @@
1
+ import type { Promisable } from 'type-fest';
2
+ import type { string_markdown, string_markdown_text, string_title } from '../../types/typeAliases';
3
+ import type { SearchEngine } from '../SearchEngine';
4
+ import type { SearchResult } from '../SearchResult';
5
+ /**
6
+ * A dummy implementation of SearchEngine for testing purposes.
7
+ *
8
+ * @private <- TODO: !!!! Export via some package, maybe `@promptbook/search-engines` or `@promptbook/fake-llm`
9
+ */
10
+ export declare class DummySearchEngine implements SearchEngine {
11
+ get title(): string_title & string_markdown_text;
12
+ get description(): string_markdown;
13
+ checkConfiguration(): Promisable<void>;
14
+ search(query: string): Promise<SearchResult[]>;
15
+ }
@@ -0,0 +1,27 @@
1
+ import type { string_markdown_text, string_name } from './typeAliases';
2
+ /**
3
+ * Definition of a tool that can be used by the model
4
+ *
5
+ * Note: [🚉] This is fully serializable as JSON
6
+ */
7
+ export type LlmToolDefinition = {
8
+ /**
9
+ * Name of the tool
10
+ */
11
+ readonly name: string_name;
12
+ /**
13
+ * Description of the tool
14
+ */
15
+ readonly description: string_markdown_text;
16
+ /**
17
+ * Parameters of the tool in JSON Schema format
18
+ */
19
+ readonly parameters: {
20
+ readonly type: 'object';
21
+ readonly properties: Record<string, {
22
+ type: string;
23
+ description?: string;
24
+ }>;
25
+ readonly required?: string[];
26
+ };
27
+ };
@@ -1,3 +1,4 @@
1
+ import type { LlmToolDefinition } from './LlmToolDefinition';
1
2
  import type { ModelVariant } from './ModelVariant';
2
3
  import type { number_model_temperature, number_seed, string_model_name, string_system_message } from './typeAliases';
3
4
  /**
@@ -28,6 +29,12 @@ export type CompletionModelRequirements = CommonModelRequirements & {
28
29
  * Maximum number of tokens that can be generated by the model
29
30
  */
30
31
  readonly maxTokens?: number;
32
+ /**
33
+ * Tools available for the model
34
+ *
35
+ * Note: [🚉] This is fully serializable as JSON
36
+ */
37
+ readonly tools?: LlmToolDefinition[];
31
38
  };
32
39
  /**
33
40
  * Model requirements for the chat variant
@@ -53,6 +60,12 @@ export type ChatModelRequirements = CommonModelRequirements & {
53
60
  * Maximum number of tokens that can be generated by the model
54
61
  */
55
62
  readonly maxTokens?: number;
63
+ /**
64
+ * Tools available for the model
65
+ *
66
+ * Note: [🚉] This is fully serializable as JSON
67
+ */
68
+ readonly tools?: LlmToolDefinition[];
56
69
  };
57
70
  /**
58
71
  * Model requirements for the image generation variant
@@ -1,6 +1,7 @@
1
1
  import type { FormatCommand } from '../commands/FORMAT/FormatCommand';
2
2
  import type { ChatMessage } from '../book-components/Chat/types/ChatMessage';
3
3
  import type { Expectations } from '../pipeline/PipelineJson/Expectations';
4
+ import type { LlmToolDefinition } from './LlmToolDefinition';
4
5
  import type { ChatModelRequirements } from './ModelRequirements';
5
6
  import type { CompletionModelRequirements } from './ModelRequirements';
6
7
  import type { EmbeddingModelRequirements } from './ModelRequirements';
@@ -44,6 +45,18 @@ export type ChatPrompt = CommonPrompt & {
44
45
  * Optional chat thread (history of previous messages)
45
46
  */
46
47
  thread?: ChatMessage[];
48
+ /**
49
+ * Optional file attachments
50
+ */
51
+ attachments?: Array<{
52
+ name: string;
53
+ type: string;
54
+ url: string;
55
+ }>;
56
+ /**
57
+ * Optional tools that can be called by the model
58
+ */
59
+ tools?: Array<LlmToolDefinition>;
47
60
  };
48
61
  /**
49
62
  * Image prompt