@promptbook/types 0.103.0-42 → 0.103.0-43

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 (75) hide show
  1. package/esm/typings/src/_packages/core.index.d.ts +6 -0
  2. package/esm/typings/src/_packages/node.index.d.ts +0 -2
  3. package/esm/typings/src/_packages/types.index.d.ts +14 -0
  4. package/esm/typings/src/_packages/utils.index.d.ts +2 -0
  5. package/esm/typings/src/book-2.0/agent-source/AgentBasicInformation.d.ts +2 -4
  6. package/esm/typings/src/book-2.0/agent-source/padBook.d.ts +1 -1
  7. package/esm/typings/src/book-2.0/agent-source/string_book.d.ts +1 -0
  8. package/esm/typings/src/book-components/AvatarProfile/AvatarProfile/AvatarProfile.d.ts +1 -1
  9. package/esm/typings/src/book-components/BookEditor/BookEditor.d.ts +1 -1
  10. package/esm/typings/src/book-components/Chat/save/_common/ChatSaveFormatDefinition.d.ts +1 -1
  11. package/esm/typings/src/book-components/Chat/types/ChatParticipant.d.ts +1 -1
  12. package/esm/typings/src/book-components/Qr/BrandedQrCode.d.ts +1 -1
  13. package/esm/typings/src/book-components/Qr/useQrCode.d.ts +1 -1
  14. package/esm/typings/src/cli/cli-commands/_boilerplate.d.ts +1 -1
  15. package/esm/typings/src/cli/cli-commands/about.d.ts +1 -1
  16. package/esm/typings/src/cli/cli-commands/hello.d.ts +1 -1
  17. package/esm/typings/src/cli/cli-commands/list-models.d.ts +1 -1
  18. package/esm/typings/src/cli/cli-commands/list-scrapers.d.ts +1 -1
  19. package/esm/typings/src/cli/cli-commands/login.d.ts +1 -1
  20. package/esm/typings/src/cli/cli-commands/make.d.ts +1 -1
  21. package/esm/typings/src/cli/cli-commands/prettify.d.ts +1 -1
  22. package/esm/typings/src/cli/cli-commands/run.d.ts +1 -1
  23. package/esm/typings/src/cli/cli-commands/start-agents-server.d.ts +1 -1
  24. package/esm/typings/src/cli/cli-commands/start-pipelines-server.d.ts +1 -1
  25. package/esm/typings/src/cli/cli-commands/test-command.d.ts +1 -1
  26. package/esm/typings/src/cli/common/$addGlobalOptionsToCommand.d.ts +1 -1
  27. package/esm/typings/src/collection/agent-collection/AgentCollection.d.ts +11 -12
  28. package/esm/typings/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentCollectionInSupabase.d.ts +55 -0
  29. package/esm/typings/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentsDatabaseSchema.d.ts +129 -0
  30. package/esm/typings/src/commands/_common/types/CommandParser.d.ts +1 -1
  31. package/esm/typings/src/config.d.ts +1 -1
  32. package/esm/typings/src/errors/0-index.d.ts +3 -0
  33. package/esm/typings/src/errors/DatabaseError.d.ts +9 -0
  34. package/esm/typings/src/execution/createPipelineExecutor/40-executeAttempts.d.ts +1 -1
  35. package/esm/typings/src/high-level-abstractions/_common/HighLevelAbstraction.d.ts +1 -1
  36. package/esm/typings/src/llm-providers/_common/register/$registeredLlmToolsMessage.d.ts +1 -1
  37. package/esm/typings/src/llm-providers/_common/register/LlmToolsMetadata.d.ts +1 -1
  38. package/esm/typings/src/llm-providers/agent/Agent.d.ts +5 -2
  39. package/esm/typings/src/llm-providers/agent/AgentLlmExecutionTools.d.ts +1 -1
  40. package/esm/typings/src/llm-providers/agent/AgentOptions.d.ts +4 -2
  41. package/esm/typings/src/llm-providers/agent/CreateAgentLlmExecutionToolsOptions.d.ts +2 -2
  42. package/esm/typings/src/llm-providers/agent/createAgentLlmExecutionTools.d.ts +1 -1
  43. package/esm/typings/src/prepare/PrepareAndScrapeOptions.d.ts +1 -0
  44. package/esm/typings/src/remote-server/startAgentServer.d.ts +2 -2
  45. package/esm/typings/src/remote-server/types/RemoteServerOptions.d.ts +0 -19
  46. package/esm/typings/src/storage/env-storage/$EnvStorage.d.ts +1 -1
  47. package/esm/typings/src/transpilers/_common/BookTranspiler.d.ts +5 -1
  48. package/esm/typings/src/transpilers/_common/BookTranspilerOptions.d.ts +1 -1
  49. package/esm/typings/src/transpilers/_common/register/$bookTranspilersRegister.d.ts +1 -1
  50. package/esm/typings/src/transpilers/formatted-book-in-markdown/FormattedBookInMarkdownTranspiler.d.ts +4 -1
  51. package/esm/typings/src/transpilers/formatted-book-in-markdown/register.d.ts +1 -1
  52. package/esm/typings/src/transpilers/openai-sdk/OpenAiSdkTranspiler.d.ts +4 -1
  53. package/esm/typings/src/transpilers/openai-sdk/register.d.ts +1 -1
  54. package/esm/typings/src/utils/color/operators/darken.d.ts +1 -1
  55. package/esm/typings/src/utils/color/operators/grayscale.d.ts +1 -1
  56. package/esm/typings/src/utils/color/operators/lighten.d.ts +1 -1
  57. package/esm/typings/src/utils/color/operators/mixWithColor.d.ts +1 -1
  58. package/esm/typings/src/utils/color/operators/saturate.d.ts +1 -1
  59. package/esm/typings/src/utils/environment/$detectRuntimeEnvironment.d.ts +16 -0
  60. package/esm/typings/src/utils/execCommand/$execCommand.d.ts +1 -1
  61. package/esm/typings/src/utils/execCommand/$execCommands.d.ts +1 -1
  62. package/esm/typings/src/utils/files/$induceBookDownload.d.ts +2 -2
  63. package/esm/typings/src/utils/files/$induceFileDownload.d.ts +2 -2
  64. package/esm/typings/src/utils/files/ObjectUrl.d.ts +1 -1
  65. package/esm/typings/src/utils/misc/aboutPromptbookInformation.d.ts +6 -0
  66. package/esm/typings/src/utils/organization/$side_effect.d.ts +1 -1
  67. package/esm/typings/src/utils/random/$generateBookBoilerplate.d.ts +22 -0
  68. package/esm/typings/src/utils/random/$randomToken.d.ts +1 -0
  69. package/esm/typings/src/utils/serialization/$deepFreeze.d.ts +1 -1
  70. package/esm/typings/src/utils/serialization/serializeToPromptbookJavascript.d.ts +2 -2
  71. package/esm/typings/src/version.d.ts +1 -1
  72. package/package.json +2 -2
  73. package/esm/typings/src/collection/agent-collection/constructors/AgentCollectionInDirectory.d.ts +0 -89
  74. package/esm/typings/src/collection/agent-collection/constructors/AgentCollectionInDirectory.test.d.ts +0 -1
  75. package/esm/typings/src/execution/utils/logLlmCall.d.ts +0 -8
@@ -16,6 +16,7 @@ import { getAllCommitmentDefinitions } from '../book-2.0/commitments/index';
16
16
  import { getAllCommitmentTypes } from '../book-2.0/commitments/index';
17
17
  import { isCommitmentSupported } from '../book-2.0/commitments/index';
18
18
  import { generatePlaceholderAgentProfileImageUrl } from '../book-2.0/utils/generatePlaceholderAgentProfileImageUrl';
19
+ import { AgentCollectionInSupabase } from '../collection/agent-collection/constructors/agent-collection-in-supabase/AgentCollectionInSupabase';
19
20
  import { createPipelineCollectionFromJson } from '../collection/pipeline-collection/constructors/createPipelineCollectionFromJson';
20
21
  import { createPipelineCollectionFromPromise } from '../collection/pipeline-collection/constructors/createPipelineCollectionFromPromise';
21
22
  import { createPipelineCollectionFromUrl } from '../collection/pipeline-collection/constructors/createPipelineCollectionFromUrl';
@@ -78,6 +79,7 @@ import { PROMPTBOOK_ERRORS } from '../errors/0-index';
78
79
  import { AbstractFormatError } from '../errors/AbstractFormatError';
79
80
  import { AuthenticationError } from '../errors/AuthenticationError';
80
81
  import { CollectionError } from '../errors/CollectionError';
82
+ import { DatabaseError } from '../errors/DatabaseError';
81
83
  import { EnvironmentMismatchError } from '../errors/EnvironmentMismatchError';
82
84
  import { ExpectError } from '../errors/ExpectError';
83
85
  import { KnowledgeScrapeError } from '../errors/KnowledgeScrapeError';
@@ -182,6 +184,7 @@ import { NonTaskSectionTypes } from '../types/SectionType';
182
184
  import { SectionTypes } from '../types/SectionType';
183
185
  import { TaskTypes } from '../types/TaskType';
184
186
  import { aboutPromptbookInformation } from '../utils/misc/aboutPromptbookInformation';
187
+ import { $generateBookBoilerplate } from '../utils/random/$generateBookBoilerplate';
185
188
  import { REMOTE_SERVER_URLS } from '../../servers';
186
189
  export { BOOK_LANGUAGE_VERSION, PROMPTBOOK_ENGINE_VERSION };
187
190
  export { createAgentModelRequirements };
@@ -201,6 +204,7 @@ export { getAllCommitmentDefinitions };
201
204
  export { getAllCommitmentTypes };
202
205
  export { isCommitmentSupported };
203
206
  export { generatePlaceholderAgentProfileImageUrl };
207
+ export { AgentCollectionInSupabase };
204
208
  export { createPipelineCollectionFromJson };
205
209
  export { createPipelineCollectionFromPromise };
206
210
  export { createPipelineCollectionFromUrl };
@@ -263,6 +267,7 @@ export { PROMPTBOOK_ERRORS };
263
267
  export { AbstractFormatError };
264
268
  export { AuthenticationError };
265
269
  export { CollectionError };
270
+ export { DatabaseError };
266
271
  export { EnvironmentMismatchError };
267
272
  export { ExpectError };
268
273
  export { KnowledgeScrapeError };
@@ -367,4 +372,5 @@ export { NonTaskSectionTypes };
367
372
  export { SectionTypes };
368
373
  export { TaskTypes };
369
374
  export { aboutPromptbookInformation };
375
+ export { $generateBookBoilerplate };
370
376
  export { REMOTE_SERVER_URLS };
@@ -1,5 +1,4 @@
1
1
  import { BOOK_LANGUAGE_VERSION, PROMPTBOOK_ENGINE_VERSION } from '../version';
2
- import { AgentCollectionInDirectory } from '../collection/agent-collection/constructors/AgentCollectionInDirectory';
3
2
  import { createPipelineCollectionFromDirectory } from '../collection/pipeline-collection/constructors/createPipelineCollectionFromDirectory';
4
3
  import { $provideExecutablesForNode } from '../executables/$provideExecutablesForNode';
5
4
  import { $provideExecutionToolsForNode } from '../execution/utils/$provideExecutionToolsForNode';
@@ -12,7 +11,6 @@ import { FileCacheStorage } from '../storage/file-cache-storage/FileCacheStorage
12
11
  import { $execCommand } from '../utils/execCommand/$execCommand';
13
12
  import { $execCommands } from '../utils/execCommand/$execCommands';
14
13
  export { BOOK_LANGUAGE_VERSION, PROMPTBOOK_ENGINE_VERSION };
15
- export { AgentCollectionInDirectory };
16
14
  export { createPipelineCollectionFromDirectory };
17
15
  export { $provideExecutablesForNode };
18
16
  export { $provideExecutionToolsForNode };
@@ -23,6 +23,13 @@ import type { ChatParticipant } from '../book-components/Chat/types/ChatParticip
23
23
  import type { MessageButton } from '../book-components/Chat/utils/parseMessageButtons';
24
24
  import type { QrCodeOptions } from '../book-components/Qr/useQrCode';
25
25
  import type { AgentCollection } from '../collection/agent-collection/AgentCollection';
26
+ import type { Json } from '../collection/agent-collection/constructors/agent-collection-in-supabase/AgentsDatabaseSchema';
27
+ import type { AgentsDatabaseSchema } from '../collection/agent-collection/constructors/agent-collection-in-supabase/AgentsDatabaseSchema';
28
+ import type { Tables } from '../collection/agent-collection/constructors/agent-collection-in-supabase/AgentsDatabaseSchema';
29
+ import type { TablesInsert } from '../collection/agent-collection/constructors/agent-collection-in-supabase/AgentsDatabaseSchema';
30
+ import type { TablesUpdate } from '../collection/agent-collection/constructors/agent-collection-in-supabase/AgentsDatabaseSchema';
31
+ import type { Enums } from '../collection/agent-collection/constructors/agent-collection-in-supabase/AgentsDatabaseSchema';
32
+ import type { CompositeTypes } from '../collection/agent-collection/constructors/agent-collection-in-supabase/AgentsDatabaseSchema';
26
33
  import type { PipelineCollection } from '../collection/pipeline-collection/PipelineCollection';
27
34
  import type { Command } from '../commands/_common/types/Command';
28
35
  import type { CommandParser } from '../commands/_common/types/CommandParser';
@@ -364,6 +371,13 @@ export type { ChatParticipant };
364
371
  export type { MessageButton };
365
372
  export type { QrCodeOptions };
366
373
  export type { AgentCollection };
374
+ export type { Json };
375
+ export type { AgentsDatabaseSchema };
376
+ export type { Tables };
377
+ export type { TablesInsert };
378
+ export type { TablesUpdate };
379
+ export type { Enums };
380
+ export type { CompositeTypes };
367
381
  export type { PipelineCollection };
368
382
  export type { Command };
369
383
  export type { CommandParser };
@@ -11,6 +11,7 @@ import { jsonParse } from '../formats/json/utils/jsonParse';
11
11
  import { isValidXmlString } from '../formats/xml/utils/isValidXmlString';
12
12
  import { prompt } from '../pipeline/prompt-notation';
13
13
  import { promptTemplate } from '../pipeline/prompt-notation';
14
+ import { $detectRuntimeEnvironment } from '../utils/environment/$detectRuntimeEnvironment';
14
15
  import { $isRunningInBrowser } from '../utils/environment/$isRunningInBrowser';
15
16
  import { $isRunningInJest } from '../utils/environment/$isRunningInJest';
16
17
  import { $isRunningInNode } from '../utils/environment/$isRunningInNode';
@@ -96,6 +97,7 @@ export { jsonParse };
96
97
  export { isValidXmlString };
97
98
  export { prompt };
98
99
  export { promptTemplate };
100
+ export { $detectRuntimeEnvironment };
99
101
  export { $isRunningInBrowser };
100
102
  export { $isRunningInJest };
101
103
  export { $isRunningInNode };
@@ -1,4 +1,4 @@
1
- import type { string_agent_name, string_url_image } from '../../types/typeAliases';
1
+ import type { string_agent_name, string_color, string_url_image } from '../../types/typeAliases';
2
2
  /**
3
3
  * Unified parameter representation that supports two different notations:
4
4
  * 1. @Parameter - single word parameter starting with @
@@ -41,9 +41,7 @@ export type AgentBasicInformation = {
41
41
  */
42
42
  meta: {
43
43
  image?: string_url_image;
44
- link?: string;
45
- title?: string;
46
- description?: string;
44
+ color?: string_color;
47
45
  [key: string]: string | undefined;
48
46
  };
49
47
  /**
@@ -1,4 +1,4 @@
1
- import { string_book } from './string_book';
1
+ import type { string_book } from './string_book';
2
2
  /**
3
3
  * Number of padding lines to add at the end of the book content
4
4
  *
@@ -21,6 +21,7 @@ export declare function validateBook(source: string): string_book;
21
21
  /**
22
22
  * Default book
23
23
  *
24
+ * @deprecated Use `$generateBookBoilerplate` instead
24
25
  * @public exported from `@promptbook/core`
25
26
  */
26
27
  export declare const DEFAULT_BOOK: string_book;
@@ -14,7 +14,7 @@ export type AvatarProfileProps = {
14
14
  /**
15
15
  * The source of the agent, which will be displayed in the BookEditor.
16
16
  */
17
- readonly agentSource: string_book;
17
+ readonly agentSource?: string_book;
18
18
  /**
19
19
  * Optional CSS class name which will be added to root <div> element
20
20
  */
@@ -1,6 +1,6 @@
1
1
  import { CSSProperties } from 'react';
2
2
  import type { Promisable } from 'type-fest';
3
- import { type string_book } from '../../book-2.0/agent-source/string_book';
3
+ import type { string_book } from '../../book-2.0/agent-source/string_book';
4
4
  import type { number_percent, number_positive, string_css_value, string_knowledge_source_content } from '../../types/typeAliases';
5
5
  /**
6
6
  * Default height of the book editor
@@ -1,7 +1,7 @@
1
1
  import type { Promisable } from 'type-fest';
2
2
  import type { string_file_extension, string_mime_type } from '../../../../types/typeAliases';
3
3
  import type { ChatMessage } from '../../types/ChatMessage';
4
- import { ChatParticipant } from '../../types/ChatParticipant';
4
+ import type { ChatParticipant } from '../../types/ChatParticipant';
5
5
  /**
6
6
  * Plugin contract for chat export formatNames
7
7
  *
@@ -1,6 +1,6 @@
1
+ import type { string_book } from '../../../book-2.0/agent-source/string_book';
1
2
  import type { id, string_color, string_person_fullname, string_url_image } from '../../../types/typeAliases';
2
3
  import { Color } from '../../../utils/color/Color';
3
- import type { string_book } from '../../../book-2.0/agent-source/string_book';
4
4
  /**
5
5
  * A participant in the chat
6
6
  *
@@ -1,4 +1,4 @@
1
- import { QrCodeOptions } from './useQrCode';
1
+ import type { QrCodeOptions } from './useQrCode';
2
2
  type BrandedQrCodeProps = QrCodeOptions & {
3
3
  /**
4
4
  * Width and height of the QR code canvas
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import type { QRCodeRenderersOptions } from 'qrcode';
3
- import { string_url_image } from '../../types/typeAliases';
3
+ import type { string_url_image } from '../../types/typeAliases';
4
4
  export type QrCodeOptions = QRCodeRenderersOptions & {
5
5
  value: string | number;
6
6
  logoSrc?: string_url_image;
@@ -1,5 +1,5 @@
1
1
  import type { Command as Program } from 'commander';
2
- import { $side_effect } from '../../utils/organization/$side_effect';
2
+ import type { $side_effect } from '../../utils/organization/$side_effect';
3
3
  /**
4
4
  * Initializes `boilerplate` command for Promptbook CLI utilities
5
5
  *
@@ -1,5 +1,5 @@
1
1
  import type { Command as Program } from 'commander';
2
- import { $side_effect } from '../../utils/organization/$side_effect';
2
+ import type { $side_effect } from '../../utils/organization/$side_effect';
3
3
  /**
4
4
  * Initializes `about` command for Promptbook CLI utilities
5
5
  *
@@ -1,5 +1,5 @@
1
1
  import type { Command as Program } from 'commander';
2
- import { $side_effect } from '../../utils/organization/$side_effect';
2
+ import type { $side_effect } from '../../utils/organization/$side_effect';
3
3
  /**
4
4
  * Initializes testing `hello` command for Promptbook CLI utilities
5
5
  *
@@ -1,5 +1,5 @@
1
1
  import type { Command as Program } from 'commander';
2
- import { $side_effect } from '../../utils/organization/$side_effect';
2
+ import type { $side_effect } from '../../utils/organization/$side_effect';
3
3
  /**
4
4
  * Initializes `list-models` command for Promptbook CLI utilities
5
5
  *
@@ -1,5 +1,5 @@
1
1
  import type { Command as Program } from 'commander';
2
- import { $side_effect } from '../../utils/organization/$side_effect';
2
+ import type { $side_effect } from '../../utils/organization/$side_effect';
3
3
  /**
4
4
  * Initializes `list-scrapers` command for Promptbook CLI utilities
5
5
  *
@@ -1,5 +1,5 @@
1
1
  import type { Command as Program } from 'commander';
2
- import { $side_effect } from '../../utils/organization/$side_effect';
2
+ import type { $side_effect } from '../../utils/organization/$side_effect';
3
3
  /**
4
4
  * Initializes `login` command for Promptbook CLI utilities
5
5
  *
@@ -1,5 +1,5 @@
1
1
  import type { Command as Program } from 'commander';
2
- import { $side_effect } from '../../utils/organization/$side_effect';
2
+ import type { $side_effect } from '../../utils/organization/$side_effect';
3
3
  /**
4
4
  * Initializes `make` command for Promptbook CLI utilities
5
5
  *
@@ -1,5 +1,5 @@
1
1
  import type { Command as Program } from 'commander';
2
- import { $side_effect } from '../../utils/organization/$side_effect';
2
+ import type { $side_effect } from '../../utils/organization/$side_effect';
3
3
  /**
4
4
  * Initializes `prettify` command for Promptbook CLI utilities
5
5
  *
@@ -1,5 +1,5 @@
1
1
  import type { Command as Program } from 'commander';
2
- import { $side_effect } from '../../utils/organization/$side_effect';
2
+ import type { $side_effect } from '../../utils/organization/$side_effect';
3
3
  /**
4
4
  * Initializes `run` command for Promptbook CLI utilities
5
5
  *
@@ -1,5 +1,5 @@
1
1
  import type { Command as Program } from 'commander';
2
- import { $side_effect } from '../../utils/organization/$side_effect';
2
+ import type { $side_effect } from '../../utils/organization/$side_effect';
3
3
  /**
4
4
  * Initializes `start-agents-server` command for Promptbook CLI utilities
5
5
  *
@@ -1,5 +1,5 @@
1
1
  import type { Command as Program } from 'commander';
2
- import { $side_effect } from '../../utils/organization/$side_effect';
2
+ import type { $side_effect } from '../../utils/organization/$side_effect';
3
3
  /**
4
4
  * Initializes `start-pipelines-server` command for Promptbook CLI utilities
5
5
  *
@@ -1,5 +1,5 @@
1
1
  import type { Command as Program } from 'commander';
2
- import { $side_effect } from '../../utils/organization/$side_effect';
2
+ import type { $side_effect } from '../../utils/organization/$side_effect';
3
3
  /**
4
4
  * Initializes `test` command for Promptbook CLI utilities
5
5
  *
@@ -1,5 +1,5 @@
1
1
  import { Command } from 'commander';
2
- import { $side_effect } from '../../utils/organization/$side_effect';
2
+ import type { $side_effect } from '../../utils/organization/$side_effect';
3
3
  /**
4
4
  * Note: `$` is used to indicate that this function is not a pure function - it registers an option in the CLI
5
5
  *
@@ -1,6 +1,7 @@
1
1
  import type { Promisable } from 'type-fest';
2
- import { Agent } from '../../_packages/core.index';
3
- import { string_book } from '../../_packages/types.index';
2
+ import type { AgentBasicInformation } from '../../book-2.0/agent-source/AgentBasicInformation';
3
+ import type { string_book } from '../../book-2.0/agent-source/string_book';
4
+ import { Agent } from '../../llm-providers/agent/Agent';
4
5
  import type { string_agent_name } from '../../types/typeAliases';
5
6
  /**
6
7
  * Collection that groups together multiple AI Agents
@@ -13,26 +14,24 @@ export type AgentCollection = {
13
14
  /**
14
15
  * Gets all agents in the collection
15
16
  */
16
- listAgents(): Promisable<ReadonlyArray<string_agent_name>>;
17
+ listAgents(): Promisable<ReadonlyArray<AgentBasicInformation>>;
17
18
  /**
18
19
  * Get one agent by its name
19
20
  *
20
- * Note: Agents are existing independently of you getting them or not, you can get the same agent multiple times.
21
+ * Note: !!!! Agents are existing independently of you getting them or not, you can get the same agent multiple times.
21
22
  * Note: Agents are changed by interacting with `Agent` objects directly. Only creation and deletion is done via the collection.
22
23
  */
23
- getAgentByName(agentName: string_agent_name): Promisable<Agent>;
24
- /**
25
- * Deletes an agent from the collection
26
- *
27
- * Note: When you want delete an agent by name, first get the agent using `getAgentByName` and then pass it to `deleteAgent`.
28
- */
29
- deleteAgent(agent: Agent): Promisable<void>;
24
+ spawnAgent(agentName: string_agent_name): Promisable<Agent>;
30
25
  /**
31
26
  * Creates a new agent in the collection
32
27
  *
33
28
  * Note: You can set 'PARENT' in the agent source to inherit from another agent in the collection.
34
29
  */
35
- createAgent(agentSource: string_book): Promisable<Agent>;
30
+ createAgent(agentSource: string_book): Promisable<AgentBasicInformation>;
31
+ /**
32
+ * Deletes an agent from the collection
33
+ */
34
+ deleteAgent(agentName: string_agent_name): Promisable<void>;
36
35
  };
37
36
  /**
38
37
  * TODO: [🧠][🚙] `AgentXxx` vs `AgentsXxx` naming convention
@@ -0,0 +1,55 @@
1
+ import type { SupabaseClient } from '@supabase/supabase-js';
2
+ import type { AgentBasicInformation } from '../../../../book-2.0/agent-source/AgentBasicInformation';
3
+ import type { string_book } from '../../../../book-2.0/agent-source/string_book';
4
+ import type { CommonToolsOptions } from '../../../../execution/CommonToolsOptions';
5
+ import type { ExecutionTools } from '../../../../execution/ExecutionTools';
6
+ import { Agent } from '../../../../llm-providers/agent/Agent';
7
+ import type { PrepareAndScrapeOptions } from '../../../../prepare/PrepareAndScrapeOptions';
8
+ import type { string_agent_name } from '../../../../types/typeAliases';
9
+ import type { AgentCollection } from '../../AgentCollection';
10
+ import type { AgentsDatabaseSchema } from './AgentsDatabaseSchema';
11
+ /**
12
+ * Agent collection stored in Supabase table
13
+ *
14
+ * Note: This object can work both from Node.js and browser environment depending on the Supabase client provided
15
+ *
16
+ * @public exported from `@promptbook/core`
17
+ * <- TODO: !!! Move to `@promptbook/supabase` package
18
+ */
19
+ export declare class AgentCollectionInSupabase implements AgentCollection {
20
+ private readonly supabaseClient;
21
+ private readonly tools?;
22
+ readonly options?: (PrepareAndScrapeOptions & CommonToolsOptions) | undefined;
23
+ /**
24
+ * @param rootPath - path to the directory with agents
25
+ * @param tools - Execution tools to be used in `Agent` itself and listing the agents
26
+ * @param options - Options for the collection creation
27
+ */
28
+ constructor(supabaseClient: SupabaseClient<AgentsDatabaseSchema>, tools?: Pick<ExecutionTools, "llm" | "fs" | "scrapers"> | undefined, options?: (PrepareAndScrapeOptions & CommonToolsOptions) | undefined);
29
+ /**
30
+ * Cached defined execution tools
31
+ */
32
+ private _definedTools;
33
+ /**
34
+ * Gets all agents in the collection
35
+ */
36
+ listAgents(): Promise<ReadonlyArray<AgentBasicInformation>>;
37
+ /**
38
+ * !!!
39
+ */
40
+ spawnAgent(agentName: string_agent_name): Promise<Agent>;
41
+ /**
42
+ * Creates a new agent in the collection
43
+ *
44
+ * Note: You can set 'PARENT' in the agent source to inherit from another agent in the collection.
45
+ */
46
+ createAgent(agentSource: string_book): Promise<AgentBasicInformation>;
47
+ /**
48
+ * Deletes an agent from the collection
49
+ */
50
+ deleteAgent(agentName: string_agent_name): Promise<void>;
51
+ }
52
+ /**
53
+ * TODO: Write unit test
54
+ * TODO: [🧠][🚙] `AgentXxx` vs `AgentsXxx` naming convention
55
+ */
@@ -0,0 +1,129 @@
1
+ export type Json = string | number | boolean | null | {
2
+ [key: string]: Json | undefined;
3
+ } | Json[];
4
+ export type AgentsDatabaseSchema = {
5
+ graphql_public: {
6
+ Tables: {
7
+ [_ in never]: never;
8
+ };
9
+ Views: {
10
+ [_ in never]: never;
11
+ };
12
+ Functions: {
13
+ graphql: {
14
+ Args: {
15
+ operationName?: string;
16
+ query?: string;
17
+ variables?: Json;
18
+ extensions?: Json;
19
+ };
20
+ Returns: Json;
21
+ };
22
+ };
23
+ Enums: {
24
+ [_ in never]: never;
25
+ };
26
+ CompositeTypes: {
27
+ [_ in never]: never;
28
+ };
29
+ };
30
+ public: {
31
+ Tables: {
32
+ AgentCollection: {
33
+ Row: {
34
+ id: number;
35
+ agentName: string;
36
+ agentProfile: Json;
37
+ createdAt: string;
38
+ updatedAt: string | null;
39
+ agentVersion: number;
40
+ promptbookEngineVersion: string;
41
+ usage: Json | null;
42
+ agentSource: string;
43
+ };
44
+ Insert: {
45
+ id?: number;
46
+ agentName: string;
47
+ createdAt: string;
48
+ updatedAt?: string | null;
49
+ agentVersion: number;
50
+ promptbookEngineVersion: string;
51
+ usage?: Json | null;
52
+ agentSource: string;
53
+ };
54
+ Update: {
55
+ id?: number;
56
+ agentName?: string;
57
+ createdAt?: string;
58
+ updatedAt?: string | null;
59
+ agentVersion?: number;
60
+ promptbookEngineVersion?: string;
61
+ usage?: Json | null;
62
+ agentSource?: string;
63
+ };
64
+ Relationships: [];
65
+ };
66
+ };
67
+ Views: {
68
+ [_ in never]: never;
69
+ };
70
+ Functions: {
71
+ [_ in never]: never;
72
+ };
73
+ Enums: {
74
+ [_ in never]: never;
75
+ };
76
+ CompositeTypes: {
77
+ [_ in never]: never;
78
+ };
79
+ };
80
+ };
81
+ type PublicSchema = AgentsDatabaseSchema[Extract<keyof AgentsDatabaseSchema, 'public'>];
82
+ export type Tables<PublicTableNameOrOptions extends keyof (PublicSchema['Tables'] & PublicSchema['Views']) | {
83
+ schema: keyof AgentsDatabaseSchema;
84
+ }, TableName extends PublicTableNameOrOptions extends {
85
+ schema: keyof AgentsDatabaseSchema;
86
+ } ? keyof (AgentsDatabaseSchema[PublicTableNameOrOptions['schema']]['Tables'] & AgentsDatabaseSchema[PublicTableNameOrOptions['schema']]['Views']) : never = never> = PublicTableNameOrOptions extends {
87
+ schema: keyof AgentsDatabaseSchema;
88
+ } ? (AgentsDatabaseSchema[PublicTableNameOrOptions['schema']]['Tables'] & AgentsDatabaseSchema[PublicTableNameOrOptions['schema']]['Views'])[TableName] extends {
89
+ Row: infer R;
90
+ } ? R : never : PublicTableNameOrOptions extends keyof (PublicSchema['Tables'] & PublicSchema['Views']) ? (PublicSchema['Tables'] & PublicSchema['Views'])[PublicTableNameOrOptions] extends {
91
+ Row: infer R;
92
+ } ? R : never : never;
93
+ export type TablesInsert<PublicTableNameOrOptions extends keyof PublicSchema['Tables'] | {
94
+ schema: keyof AgentsDatabaseSchema;
95
+ }, TableName extends PublicTableNameOrOptions extends {
96
+ schema: keyof AgentsDatabaseSchema;
97
+ } ? keyof AgentsDatabaseSchema[PublicTableNameOrOptions['schema']]['Tables'] : never = never> = PublicTableNameOrOptions extends {
98
+ schema: keyof AgentsDatabaseSchema;
99
+ } ? AgentsDatabaseSchema[PublicTableNameOrOptions['schema']]['Tables'][TableName] extends {
100
+ Insert: infer I;
101
+ } ? I : never : PublicTableNameOrOptions extends keyof PublicSchema['Tables'] ? PublicSchema['Tables'][PublicTableNameOrOptions] extends {
102
+ Insert: infer I;
103
+ } ? I : never : never;
104
+ export type TablesUpdate<PublicTableNameOrOptions extends keyof PublicSchema['Tables'] | {
105
+ schema: keyof AgentsDatabaseSchema;
106
+ }, TableName extends PublicTableNameOrOptions extends {
107
+ schema: keyof AgentsDatabaseSchema;
108
+ } ? keyof AgentsDatabaseSchema[PublicTableNameOrOptions['schema']]['Tables'] : never = never> = PublicTableNameOrOptions extends {
109
+ schema: keyof AgentsDatabaseSchema;
110
+ } ? AgentsDatabaseSchema[PublicTableNameOrOptions['schema']]['Tables'][TableName] extends {
111
+ Update: infer U;
112
+ } ? U : never : PublicTableNameOrOptions extends keyof PublicSchema['Tables'] ? PublicSchema['Tables'][PublicTableNameOrOptions] extends {
113
+ Update: infer U;
114
+ } ? U : never : never;
115
+ export type Enums<PublicEnumNameOrOptions extends keyof PublicSchema['Enums'] | {
116
+ schema: keyof AgentsDatabaseSchema;
117
+ }, EnumName extends PublicEnumNameOrOptions extends {
118
+ schema: keyof AgentsDatabaseSchema;
119
+ } ? keyof AgentsDatabaseSchema[PublicEnumNameOrOptions['schema']]['Enums'] : never = never> = PublicEnumNameOrOptions extends {
120
+ schema: keyof AgentsDatabaseSchema;
121
+ } ? AgentsDatabaseSchema[PublicEnumNameOrOptions['schema']]['Enums'][EnumName] : PublicEnumNameOrOptions extends keyof PublicSchema['Enums'] ? PublicSchema['Enums'][PublicEnumNameOrOptions] : never;
122
+ export type CompositeTypes<PublicCompositeTypeNameOrOptions extends keyof PublicSchema['CompositeTypes'] | {
123
+ schema: keyof AgentsDatabaseSchema;
124
+ }, CompositeTypeName extends PublicCompositeTypeNameOrOptions extends {
125
+ schema: keyof AgentsDatabaseSchema;
126
+ } ? keyof AgentsDatabaseSchema[PublicCompositeTypeNameOrOptions['schema']]['CompositeTypes'] : never = never> = PublicCompositeTypeNameOrOptions extends {
127
+ schema: keyof AgentsDatabaseSchema;
128
+ } ? AgentsDatabaseSchema[PublicCompositeTypeNameOrOptions['schema']]['CompositeTypes'][CompositeTypeName] : PublicCompositeTypeNameOrOptions extends keyof PublicSchema['CompositeTypes'] ? PublicSchema['CompositeTypes'][PublicCompositeTypeNameOrOptions] : never;
129
+ export {};
@@ -3,7 +3,7 @@ import type { PipelineJson } from '../../../pipeline/PipelineJson/PipelineJson';
3
3
  import type { TaskJson } from '../../../pipeline/PipelineJson/TaskJson';
4
4
  import type { string_markdown_text, string_name, string_promptbook_documentation_url } from '../../../types/typeAliases';
5
5
  import type { string_SCREAMING_CASE } from '../../../utils/normalization/normalizeTo_SCREAMING_CASE';
6
- import { $side_effect } from '../../../utils/organization/$side_effect';
6
+ import type { $side_effect } from '../../../utils/organization/$side_effect';
7
7
  import type { ___and___ } from '../../../utils/organization/___and___';
8
8
  import type { CommandUsagePlace } from './CommandUsagePlaces';
9
9
  /**
@@ -1,7 +1,7 @@
1
- import { Color } from './_packages/color.index';
2
1
  import type { CsvSettings } from './formats/csv/CsvSettings';
3
2
  import type { IntermediateFilesStrategy } from './types/IntermediateFilesStrategy';
4
3
  import type { string_app_id, string_email, string_name, string_promptbook_server_url } from './types/typeAliases';
4
+ import { Color } from './utils/color/Color';
5
5
  /**
6
6
  * Warning message for the generated sections and files files
7
7
  *
@@ -2,6 +2,7 @@ import { CsvFormatError } from '../formats/csv/CsvFormatError';
2
2
  import { AbstractFormatError } from './AbstractFormatError';
3
3
  import { AuthenticationError } from './AuthenticationError';
4
4
  import { CollectionError } from './CollectionError';
5
+ import { DatabaseError } from './DatabaseError';
5
6
  import { EnvironmentMismatchError } from './EnvironmentMismatchError';
6
7
  import { ExpectError } from './ExpectError';
7
8
  import { KnowledgeScrapeError } from './KnowledgeScrapeError';
@@ -42,6 +43,7 @@ export declare const PROMPTBOOK_ERRORS: {
42
43
  readonly UnexpectedError: typeof UnexpectedError;
43
44
  readonly WrappedError: typeof WrappedError;
44
45
  readonly NotAllowed: typeof NotAllowed;
46
+ readonly DatabaseError: typeof DatabaseError;
45
47
  };
46
48
  /**
47
49
  * Index of all javascript errors
@@ -91,6 +93,7 @@ export declare const ALL_ERRORS: {
91
93
  readonly UnexpectedError: typeof UnexpectedError;
92
94
  readonly WrappedError: typeof WrappedError;
93
95
  readonly NotAllowed: typeof NotAllowed;
96
+ readonly DatabaseError: typeof DatabaseError;
94
97
  };
95
98
  /**
96
99
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -0,0 +1,9 @@
1
+ /**
2
+ * This error indicates error from the database
3
+ *
4
+ * @public exported from `@promptbook/core`
5
+ */
6
+ export declare class DatabaseError extends Error {
7
+ readonly name = "DatabaseError";
8
+ constructor(message: string);
9
+ }
@@ -1,9 +1,9 @@
1
1
  import type { PartialDeep, Promisable, ReadonlyDeep, WritableDeep } from 'type-fest';
2
2
  import type { PipelineJson } from '../../pipeline/PipelineJson/PipelineJson';
3
3
  import type { TaskJson } from '../../pipeline/PipelineJson/TaskJson';
4
+ import type { LlmCall } from '../../types/LlmCall';
4
5
  import type { Parameters, string_parameter_name } from '../../types/typeAliases';
5
6
  import type { TODO_string } from '../../utils/organization/TODO_string';
6
- import type { LlmCall } from '../../types/LlmCall';
7
7
  import type { ExecutionReportJson } from '../execution-report/ExecutionReportJson';
8
8
  import type { PipelineExecutorResult } from '../PipelineExecutorResult';
9
9
  import type { CreatePipelineExecutorOptions } from './00-CreatePipelineExecutorOptions';
@@ -1,5 +1,5 @@
1
1
  import type { $PipelineJson } from '../../commands/_common/types/CommandParser';
2
- import { $side_effect } from '../../utils/organization/$side_effect';
2
+ import type { $side_effect } from '../../utils/organization/$side_effect';
3
3
  /**
4
4
  * Used in `parsePipeline`
5
5
  *
@@ -1,5 +1,5 @@
1
1
  import type { string_filename, string_markdown } from '../../../types/typeAliases';
2
- import { $side_effect } from '../../../utils/organization/$side_effect';
2
+ import type { $side_effect } from '../../../utils/organization/$side_effect';
3
3
  /**
4
4
  * Pass the `.env` file which was used to configure LLM tools
5
5
  *
@@ -26,7 +26,7 @@ export type LlmToolsMetadata = Registered & {
26
26
  /**
27
27
  * How is the model provider important and should be sorted in the list of available providers?
28
28
  */
29
- readonly order: typeof MODEL_ORDERS[keyof typeof MODEL_ORDERS] | number;
29
+ readonly order: (typeof MODEL_ORDERS)[keyof typeof MODEL_ORDERS] | number;
30
30
  /**
31
31
  * List of environment variables that can be used to configure the provider
32
32
  *
@@ -1,6 +1,9 @@
1
1
  import { BehaviorSubject } from 'rxjs';
2
- import { AgentBasicInformation, BookParameter, LlmExecutionTools, string_agent_name, string_book, string_url_image } from '../../_packages/types.index';
3
- import { AgentOptions } from './AgentOptions';
2
+ import type { AgentBasicInformation, BookParameter } from '../../book-2.0/agent-source/AgentBasicInformation';
3
+ import type { string_book } from '../../book-2.0/agent-source/string_book';
4
+ import type { LlmExecutionTools } from '../../execution/LlmExecutionTools';
5
+ import type { string_agent_name, string_url_image } from '../../types/typeAliases';
6
+ import type { AgentOptions } from './AgentOptions';
4
7
  /**
5
8
  * Represents one AI Agent
6
9
  *
@@ -5,7 +5,7 @@ import type { LlmExecutionTools } from '../../execution/LlmExecutionTools';
5
5
  import type { ChatPromptResult } from '../../execution/PromptResult';
6
6
  import type { Prompt } from '../../types/Prompt';
7
7
  import type { string_markdown, string_markdown_text, string_model_name, string_title } from '../../types/typeAliases';
8
- import { CreateAgentLlmExecutionToolsOptions } from './CreateAgentLlmExecutionToolsOptions';
8
+ import type { CreateAgentLlmExecutionToolsOptions } from './CreateAgentLlmExecutionToolsOptions';
9
9
  /**
10
10
  * Execution Tools for calling LLM models with a predefined agent "soul"
11
11
  * This wraps underlying LLM execution tools and applies agent-specific system prompts and requirements
@@ -1,5 +1,7 @@
1
- import { CommonToolsOptions, ExecutionTools, string_book } from '../../_packages/types.index';
2
- import { Updatable } from '../../types/Updatable';
1
+ import type { string_book } from '../../book-2.0/agent-source/string_book';
2
+ import type { CommonToolsOptions } from '../../execution/CommonToolsOptions';
3
+ import type { ExecutionTools } from '../../execution/ExecutionTools';
4
+ import type { Updatable } from '../../types/Updatable';
3
5
  /**
4
6
  * Options for creating an Agent
5
7
  */
@@ -1,6 +1,6 @@
1
- import type { string_book } from '../../_packages/types.index';
1
+ import type { string_book } from '../../book-2.0/agent-source/string_book';
2
2
  import type { LlmExecutionTools } from '../../execution/LlmExecutionTools';
3
- import type { OpenAiAssistantExecutionTools } from '../openai/OpenAiAssistantExecutionTools';
3
+ import { OpenAiAssistantExecutionTools } from '../openai/OpenAiAssistantExecutionTools';
4
4
  /**
5
5
  * Options for creating AgentLlmExecutionTools
6
6
  */
@@ -1,5 +1,5 @@
1
1
  import { AgentLlmExecutionTools } from './AgentLlmExecutionTools';
2
- import { CreateAgentLlmExecutionToolsOptions } from './CreateAgentLlmExecutionToolsOptions';
2
+ import type { CreateAgentLlmExecutionToolsOptions } from './CreateAgentLlmExecutionToolsOptions';
3
3
  /**
4
4
  * Creates new AgentLlmExecutionTools that wrap underlying LLM tools with agent-specific behavior
5
5
  *
@@ -47,5 +47,6 @@ export type PrepareAndScrapeOptions = {
47
47
  readonly isVerbose?: boolean;
48
48
  };
49
49
  /**
50
+ * TODO: [🧠] Maybe extend from `CommonToolsOptions`
50
51
  * TODO: [🧠] Maybe split `PrepareAndScrapeOptions` and `ScrapeOptions` (`ScrapeOptions` should be extended from `PrepareAndScrapeOptions`)
51
52
  */
@@ -1,5 +1,5 @@
1
- import { TODO_any } from '../_packages/types.index';
2
- import { number_port } from '../types/typeAliases';
1
+ import type { number_port } from '../types/typeAliases';
2
+ import type { TODO_any } from '../utils/organization/TODO_any';
3
3
  type AgentsServerOptions = {
4
4
  /**
5
5
  * !!!
@@ -1,6 +1,5 @@
1
1
  import type { Request, Response } from 'express';
2
2
  import type { Promisable } from 'type-fest';
3
- import { really_any } from '../../_packages/types.index';
4
3
  import type { PipelineCollection } from '../../collection/pipeline-collection/PipelineCollection';
5
4
  import { AuthenticationError } from '../../errors/AuthenticationError';
6
5
  import type { CommonToolsOptions } from '../../execution/CommonToolsOptions';
@@ -27,24 +26,6 @@ export type RemoteServerOptions<TCustomOptions> = CommonToolsOptions & {
27
26
  * @property {number} port The port number the server will listen on.
28
27
  */
29
28
  readonly port: number;
30
- /**
31
- * CORS options to apply to all endpoints (REST, UI, socket.io, etc.).
32
- * Accepts the same options as the `cors` npm package and socket.io's CORS config.
33
- * If not provided, defaults to permissive CORS (origin: '*').
34
- * @see https://www.npmjs.com/package/cors
35
- * @see https://socket.io/docs/v4/server-options/#cors
36
- */
37
- readonly cors?: {
38
- origin?: string | string[] | boolean;
39
- methods?: string | string[];
40
- allowedHeaders?: string | string[];
41
- exposedHeaders?: string | string[];
42
- credentials?: boolean;
43
- maxAge?: number;
44
- preflightContinue?: boolean;
45
- optionsSuccessStatus?: number;
46
- [key: string]: really_any;
47
- };
48
29
  /**
49
30
  * Enable rich UI (React + Tailwind) at `/` path.
50
31
  * Default: true
@@ -1,5 +1,5 @@
1
+ import type { $side_effect } from '../../utils/organization/$side_effect';
1
2
  import type { PromptbookStorage } from '../_common/PromptbookStorage';
2
- import { $side_effect } from '../../utils/organization/$side_effect';
3
3
  /**
4
4
  * Stores data in .env variables
5
5
  *
@@ -1,5 +1,9 @@
1
1
  import { Promisable } from 'type-fest';
2
- import { BookTranspilerOptions, ExecutionTools, Registered, string_book, string_name, string_script, string_title } from '../../_packages/types.index';
2
+ import type { string_book } from '../../book-2.0/agent-source/string_book';
3
+ import type { ExecutionTools } from '../../execution/ExecutionTools';
4
+ import type { string_name, string_script, string_title } from '../../types/typeAliases';
5
+ import type { Registered } from '../../utils/misc/$Register';
6
+ import type { BookTranspilerOptions } from './BookTranspilerOptions';
3
7
  /**
4
8
  * Transpiler takes a book and transpiles it into another format (e.g., Langchain).
5
9
  */
@@ -1,4 +1,4 @@
1
- import { CommonToolsOptions } from '../../execution/CommonToolsOptions';
1
+ import type { CommonToolsOptions } from '../../execution/CommonToolsOptions';
2
2
  /**
3
3
  * Options for the BookTranspiler.
4
4
  */
@@ -1,5 +1,5 @@
1
1
  import { $Register } from '../../../utils/misc/$Register';
2
- import { BookTranspiler } from '../BookTranspiler';
2
+ import type { BookTranspiler } from '../BookTranspiler';
3
3
  /**
4
4
  * Register for book transpilers.
5
5
  *
@@ -1,4 +1,7 @@
1
- import { BookTranspilerOptions, ExecutionTools, string_book, string_markdown } from '../../_packages/types.index';
1
+ import type { string_book } from '../../book-2.0/agent-source/string_book';
2
+ import type { ExecutionTools } from '../../execution/ExecutionTools';
3
+ import type { string_markdown } from '../../types/typeAliases';
4
+ import type { BookTranspilerOptions } from '../_common/BookTranspilerOptions';
2
5
  /**
3
6
  * Converts a book into a 1:1 formatted markdown
4
7
  *
@@ -1,4 +1,4 @@
1
- import { Registration } from '../../_packages/types.index';
1
+ import type { Registration } from '../../utils/misc/$Register';
2
2
  /**
3
3
  * Registration of transpiler
4
4
  *
@@ -1,4 +1,7 @@
1
- import { BookTranspilerOptions, ExecutionTools, string_book, string_script } from '../../_packages/types.index';
1
+ import type { string_book } from '../../book-2.0/agent-source/string_book';
2
+ import type { ExecutionTools } from '../../execution/ExecutionTools';
3
+ import type { string_script } from '../../types/typeAliases';
4
+ import type { BookTranspilerOptions } from '../_common/BookTranspilerOptions';
2
5
  /**
3
6
  * Transpiler to Javascript code using OpenAI SDK.
4
7
  *
@@ -1,4 +1,4 @@
1
- import { Registration } from '../../_packages/types.index';
1
+ import type { Registration } from '../../utils/misc/$Register';
2
2
  /**
3
3
  * Registration of transpiler
4
4
  *
@@ -1,4 +1,4 @@
1
- import { number_percent } from '../../../types/typeAliases';
1
+ import type { number_percent } from '../../../types/typeAliases';
2
2
  import type { ColorTransformer } from './ColorTransformer';
3
3
  /**
4
4
  * Makes color transformer which darker the given color
@@ -1,4 +1,4 @@
1
- import { number_percent } from '../../../types/typeAliases';
1
+ import type { number_percent } from '../../../types/typeAliases';
2
2
  import type { ColorTransformer } from './ColorTransformer';
3
3
  /**
4
4
  * Makes color transformer which returns a grayscale version of the color
@@ -1,5 +1,5 @@
1
+ import type { number_percent } from '../../../types/typeAliases';
1
2
  import type { ColorTransformer } from './ColorTransformer';
2
- import { number_percent } from '../../../types/typeAliases';
3
3
  /**
4
4
  * Makes color transformer which lighten the given color
5
5
  *
@@ -1,6 +1,6 @@
1
+ import type { number_percent } from '../../../types/typeAliases';
1
2
  import { Color } from '../Color';
2
3
  import type { ColorTransformer } from './ColorTransformer';
3
- import { number_percent } from '../../../types/typeAliases';
4
4
  /**
5
5
  * Makes color transformer which returns a mix of two colors based on a ratio
6
6
  *
@@ -1,4 +1,4 @@
1
- import { number_percent } from '../../../types/typeAliases';
1
+ import type { number_percent } from '../../../types/typeAliases';
2
2
  import type { ColorTransformer } from './ColorTransformer';
3
3
  /**
4
4
  * Makes color transformer which saturate the given color
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Returns information about the current runtime environment
3
+ *
4
+ * Note: `$` is used to indicate that this function is not a pure function - it looks at the global object to determine the environments
5
+ *
6
+ * @public exported from `@promptbook/utils`
7
+ */
8
+ export declare function $detectRuntimeEnvironment(): {
9
+ isRunningInBrowser: any;
10
+ isRunningInJest: any;
11
+ isRunningInNode: any;
12
+ isRunningInWebWorker: any;
13
+ };
14
+ /**
15
+ * TODO: [🎺] Also detect and report node version here
16
+ */
@@ -1,4 +1,4 @@
1
- import { $side_effect } from '../organization/$side_effect';
1
+ import type { $side_effect } from '../organization/$side_effect';
2
2
  import type { ExecCommandOptions } from './ExecCommandOptions';
3
3
  /**
4
4
  * Run one command in a shell
@@ -1,4 +1,4 @@
1
- import { $side_effect } from '../organization/$side_effect';
1
+ import type { $side_effect } from '../organization/$side_effect';
2
2
  /**
3
3
  * Run multiple commands in a shell in sequence
4
4
  *
@@ -1,5 +1,5 @@
1
- import { string_book } from '../../_packages/types.index';
2
- import { $side_effect } from '../organization/$side_effect';
1
+ import type { string_book } from '../../book-2.0/agent-source/string_book';
2
+ import type { $side_effect } from '../organization/$side_effect';
3
3
  /**
4
4
  * Download a Book in a browser
5
5
  *
@@ -1,5 +1,5 @@
1
- import { string_url } from '../../types/typeAliases';
2
- import { $side_effect } from '../organization/$side_effect';
1
+ import type { string_url } from '../../types/typeAliases';
2
+ import type { $side_effect } from '../organization/$side_effect';
3
3
  /**
4
4
  * Download a File in a browser
5
5
  *
@@ -1,5 +1,5 @@
1
1
  import { IDestroyable, Registration } from 'destroyable';
2
- import { string_mime_type, string_url } from '../../types/typeAliases';
2
+ import type { string_mime_type, string_url } from '../../types/typeAliases';
3
3
  /**
4
4
  * Converts Blob, File or MediaSource to url using URL.createObjectURL
5
5
  *
@@ -6,6 +6,12 @@ export type AboutPromptbookInformationOptions = {
6
6
  * @default true
7
7
  */
8
8
  isServersInfoIncluded?: boolean;
9
+ /**
10
+ * Include information about runtime environment
11
+ *
12
+ * @default true
13
+ */
14
+ isRuntimeEnvironmentInfoIncluded?: boolean;
9
15
  };
10
16
  /**
11
17
  * Provide information about Promptbook, engine version, book language version, servers, ...
@@ -1,4 +1,4 @@
1
- import { really_any } from './really_any';
1
+ import type { really_any } from './really_any';
2
2
  /**
3
3
  * Organizational helper to mark a function that produces side effects
4
4
  *
@@ -0,0 +1,22 @@
1
+ import type { PartialDeep } from 'type-fest';
2
+ import type { AgentBasicInformation } from '../../book-2.0/agent-source/AgentBasicInformation';
3
+ import { string_book } from '../../book-2.0/agent-source/string_book';
4
+ import { string_agent_name } from '../../types/typeAliases';
5
+ type GenerateBookBoilerplateOptions = PartialDeep<Omit<AgentBasicInformation, 'parameters'>> & {
6
+ /**
7
+ * Name of the parent agent to inherit from
8
+ *
9
+ * @default 'Adam'
10
+ */
11
+ parentAgentName?: string_agent_name;
12
+ };
13
+ /**
14
+ * Generates boilerplate for a new agent book
15
+ *
16
+ * Note: `$` is used to indicate that this function is not a pure function - it is not deterministic
17
+ * Note: This function is using cryptographically secure components internally
18
+ *
19
+ * @public exported from `@promptbook/core`
20
+ */
21
+ export declare function $generateBookBoilerplate(options?: GenerateBookBoilerplateOptions): string_book;
22
+ export {};
@@ -2,6 +2,7 @@ import type { string_token } from '../../types/typeAliases';
2
2
  /**
3
3
  * Generates random token
4
4
  *
5
+ * Note: `$` is used to indicate that this function is not a pure function - it is not deterministic
5
6
  * Note: This function is cryptographically secure (it uses crypto.randomBytes internally)
6
7
  *
7
8
  * @private internal helper function
@@ -1,5 +1,5 @@
1
1
  import type { ReadonlyDeep } from 'type-fest';
2
- import { $side_effect } from '../organization/$side_effect';
2
+ import type { $side_effect } from '../organization/$side_effect';
3
3
  /**
4
4
  * Freezes the given object and all its nested objects recursively
5
5
  *
@@ -1,5 +1,5 @@
1
- import { string_javascript } from '../../types/typeAliases';
2
- import { TODO_any } from '../organization/TODO_any';
1
+ import type { string_javascript } from '../../types/typeAliases';
2
+ import type { TODO_any } from '../organization/TODO_any';
3
3
  type SerializeToPromptbookJavascriptReturn = {
4
4
  /**
5
5
  * Array of import statements required for the `value` to work
@@ -15,7 +15,7 @@ export declare const BOOK_LANGUAGE_VERSION: string_semantic_version;
15
15
  export declare const PROMPTBOOK_ENGINE_VERSION: string_promptbook_version;
16
16
  /**
17
17
  * Represents the version string of the Promptbook engine.
18
- * It follows semantic versioning (e.g., `0.103.0-41`).
18
+ * It follows semantic versioning (e.g., `0.103.0-42`).
19
19
  *
20
20
  * @generated
21
21
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promptbook/types",
3
- "version": "0.103.0-42",
3
+ "version": "0.103.0-43",
4
4
  "description": "Promptbook: Turn your company's scattered knowledge into AI ready books",
5
5
  "private": false,
6
6
  "sideEffects": false,
@@ -92,6 +92,6 @@
92
92
  },
93
93
  "typings": "./esm/typings/src/_packages/types.index.d.ts",
94
94
  "peerDependencies": {
95
- "@promptbook/core": "0.103.0-42"
95
+ "@promptbook/core": "0.103.0-43"
96
96
  }
97
97
  }
@@ -1,89 +0,0 @@
1
- import { Agent } from '../../../_packages/core.index';
2
- import { CommonToolsOptions, string_book } from '../../../_packages/types.index';
3
- import type { ExecutionTools } from '../../../execution/ExecutionTools';
4
- import type { PrepareAndScrapeOptions } from '../../../prepare/PrepareAndScrapeOptions';
5
- import type { string_agent_name, string_dirname } from '../../../types/typeAliases';
6
- import type { AgentCollection } from '../AgentCollection';
7
- /**
8
- * Options for `createAgentCollectionFromDirectory` function
9
- *
10
- * Note: `rootDirname` is not needed because it is the folder in which `.book` or `.book` file is located
11
- * This is not same as `path` which is the first argument of `createAgentCollectionFromDirectory` - it can be a subfolder
12
- */
13
- type CreateAgentCollectionInDirectoryOptions = Omit<PrepareAndScrapeOptions, 'rootDirname'> & CommonToolsOptions & {
14
- /**
15
- * If true, the directory is searched recursively for pipelines
16
- *
17
- * @default true
18
- */
19
- isRecursive?: boolean;
20
- /**
21
- * If true, directory will be scanned only when needed not during the construction
22
- *
23
- * @default false
24
- */
25
- isLazyLoaded?: boolean;
26
- /**
27
- * If true, whole collection creation crashes on error in any pipeline
28
- * If true and isLazyLoaded is true, the error is thrown on first access to the pipeline
29
- *
30
- * @default true
31
- */
32
- isCrashedOnError?: boolean;
33
- };
34
- /**
35
- * Agent collection stored in directory
36
- *
37
- * Note: Works only in Node.js environment because it reads the file system
38
- *
39
- * @public exported from `@promptbook/node`
40
- */
41
- export declare class AgentCollectionInDirectory implements AgentCollection {
42
- readonly rootPath: string_dirname;
43
- private readonly tools?;
44
- readonly options?: CreateAgentCollectionInDirectoryOptions | undefined;
45
- /**
46
- * @param rootPath - path to the directory with agents
47
- * @param tools - Execution tools to be used in `Agent` itself and listing the agents
48
- * @param options - Options for the collection creation
49
- */
50
- constructor(rootPath: string_dirname, tools?: Pick<ExecutionTools, "llm" | "fs" | "scrapers"> | undefined, options?: CreateAgentCollectionInDirectoryOptions | undefined);
51
- /**
52
- * Cached defined execution tools
53
- */
54
- private _definedTools;
55
- /**
56
- * Gets or creates execution tools for the collection
57
- */
58
- private getTools;
59
- /**
60
- * Gets all agents in the collection
61
- */
62
- listAgents(): Promise<ReadonlyArray<string_agent_name>>;
63
- /**
64
- * Get one agent by its name
65
- *
66
- * Note: Agents are existing independently of you getting them or not, you can get the same agent multiple times.
67
- * Note: Agents are changed by interacting with `Agent` objects directly. Only creation and deletion is done via the collection.
68
- */
69
- getAgentByName(agentName: string_agent_name): Promise<Agent>;
70
- /**
71
- * Deletes an agent from the collection
72
- *
73
- * Note: When you want delete an agent by name, first get the agent using `getAgentByName` and then pass it to `deleteAgent`.
74
- */
75
- deleteAgent(agent: Agent): Promise<void>;
76
- /**
77
- * Creates a new agent in the collection
78
- *
79
- * Note: You can set 'PARENT' in the agent source to inherit from another agent in the collection.
80
- */
81
- createAgent(agentSource: string_book): Promise<Agent>;
82
- }
83
- export {};
84
- /**
85
- * TODO: [🧠][🚙] `AgentXxx` vs `AgentsXxx` naming convention
86
- * TODO: [🖇] What about symlinks? Maybe option `isSymlinksFollowed`
87
- * TODO: [🧠] Maybe add option `isImmutable`
88
- * Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
89
- */
@@ -1,8 +0,0 @@
1
- import type { LlmCall } from '../../types/LlmCall';
2
- import type { ExecutionPromptReportJson } from '../execution-report/ExecutionPromptReportJson';
3
- /**
4
- * Logs an LLM call with the given report.
5
- *
6
- * @private internal utility of `createPipelineExecutor`
7
- */
8
- export declare function logLlmCall(logLlmCall: (llmCall: LlmCall) => void, report: ExecutionPromptReportJson): void;