@promptbook/vercel 0.103.0-37 → 0.103.0-40

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 (43) hide show
  1. package/esm/index.es.js +1 -1
  2. package/esm/index.es.js.map +1 -1
  3. package/esm/typings/books/index.d.ts +0 -81
  4. package/esm/typings/src/_packages/core.index.d.ts +12 -10
  5. package/esm/typings/src/_packages/node.index.d.ts +4 -2
  6. package/esm/typings/src/_packages/types.index.d.ts +3 -1
  7. package/esm/typings/src/book-components/_common/Modal/Modal.d.ts +1 -1
  8. package/esm/typings/src/cli/cli-commands/start-agents-server.d.ts +14 -0
  9. package/esm/typings/src/cli/cli-commands/{start-server.d.ts → start-pipelines-server.d.ts} +2 -2
  10. package/esm/typings/src/collection/agent-collection/AgentCollection.d.ts +36 -0
  11. package/esm/typings/src/collection/agent-collection/constructors/AgentCollectionInDirectory.d.ts +88 -0
  12. package/esm/typings/src/collection/{PipelineCollection.d.ts → pipeline-collection/PipelineCollection.d.ts} +7 -3
  13. package/esm/typings/src/collection/{SimplePipelineCollection.d.ts → pipeline-collection/SimplePipelineCollection.d.ts} +5 -5
  14. package/esm/typings/src/collection/{constructors/createCollectionFromDirectory.d.ts → pipeline-collection/constructors/createPipelineCollectionFromDirectory.d.ts} +8 -10
  15. package/esm/typings/src/collection/pipeline-collection/constructors/createPipelineCollectionFromJson.d.ts +13 -0
  16. package/esm/typings/src/collection/{constructors/createCollectionFromPromise.d.ts → pipeline-collection/constructors/createPipelineCollectionFromPromise.d.ts} +6 -5
  17. package/esm/typings/src/collection/pipeline-collection/constructors/createPipelineCollectionFromPromise.test.d.ts +1 -0
  18. package/esm/typings/src/collection/{constructors/createCollectionFromUrl.d.ts → pipeline-collection/constructors/createPipelineCollectionFromUrl.d.ts} +3 -3
  19. package/esm/typings/src/collection/{constructors/createSubcollection.d.ts → pipeline-collection/constructors/createPipelineSubcollection.d.ts} +3 -3
  20. package/esm/typings/src/collection/pipeline-collection/pipelineCollectionToJson.d.ts +13 -0
  21. package/esm/typings/src/config.d.ts +8 -1
  22. package/esm/typings/src/execution/FilesystemTools.d.ts +1 -1
  23. package/esm/typings/src/execution/LlmExecutionTools.d.ts +6 -0
  24. package/esm/typings/src/llm-providers/agent/Agent.d.ts +6 -1
  25. package/esm/typings/src/llm-providers/agent/AgentLlmExecutionTools.d.ts +9 -4
  26. package/esm/typings/src/llm-providers/agent/createAgentLlmExecutionTools.d.ts +0 -4
  27. package/esm/typings/src/llm-providers/openai/OpenAiAssistantExecutionTools.d.ts +17 -1
  28. package/esm/typings/src/other/templates/getTemplatesPipelineCollection.d.ts +1 -1
  29. package/esm/typings/src/remote-server/startRemoteServer.d.ts +1 -1
  30. package/esm/typings/src/remote-server/types/RemoteServerOptions.d.ts +22 -8
  31. package/esm/typings/src/transpilers/formatted-book-in-markdown/register.d.ts +1 -1
  32. package/esm/typings/src/utils/files/listAllFiles.d.ts +2 -3
  33. package/esm/typings/src/version.d.ts +1 -1
  34. package/esm/typings/src/wizard/$getCompiledBook.d.ts +1 -2
  35. package/package.json +2 -2
  36. package/umd/index.umd.js +1 -1
  37. package/umd/index.umd.js.map +1 -1
  38. package/esm/typings/src/collection/collectionToJson.d.ts +0 -13
  39. package/esm/typings/src/collection/constructors/createCollectionFromJson.d.ts +0 -13
  40. /package/esm/typings/src/collection/{constructors/createCollectionFromDirectory.test.d.ts → agent-collection/constructors/AgentCollectionInDirectory.test.d.ts} +0 -0
  41. /package/esm/typings/src/collection/{constructors/createCollectionFromJson.test.d.ts → pipeline-collection/constructors/createPipelineCollectionFromDirectory.test.d.ts} +0 -0
  42. /package/esm/typings/src/collection/{constructors/createCollectionFromPromise.test.d.ts → pipeline-collection/constructors/createPipelineCollectionFromJson.test.d.ts} +0 -0
  43. /package/esm/typings/src/collection/{collectionToJson.test.d.ts → pipeline-collection/pipelineCollectionToJson.test.d.ts} +0 -0
@@ -1,12 +1,12 @@
1
- import type { PipelineJson } from '../pipeline/PipelineJson/PipelineJson';
2
- import type { Prompt } from '../types/Prompt';
3
- import type { string_pipeline_url } from '../types/typeAliases';
1
+ import type { PipelineJson } from '../../pipeline/PipelineJson/PipelineJson';
2
+ import type { Prompt } from '../../types/Prompt';
3
+ import type { string_pipeline_url } from '../../types/typeAliases';
4
4
  import type { PipelineCollection } from './PipelineCollection';
5
5
  /**
6
6
  * Library of pipelines that groups together pipelines for an application.
7
7
  * This implementation is a very thin wrapper around the Array / Map of pipelines.
8
8
  *
9
- * @private internal function of `createCollectionFromJson`, use `createCollectionFromJson` instead
9
+ * @private internal function of `createPipelineCollectionFromJson`, use `createPipelineCollectionFromJson` instead
10
10
  * @see https://github.com/webgptorg/pipeline#pipeline-collection
11
11
  */
12
12
  export declare class SimplePipelineCollection implements PipelineCollection {
@@ -17,7 +17,7 @@ export declare class SimplePipelineCollection implements PipelineCollection {
17
17
  * @param pipelines Array of pipeline JSON objects to include in the collection
18
18
  *
19
19
  * Note: During the construction logic of all pipelines are validated
20
- * Note: It is not recommended to use this constructor directly, use `createCollectionFromJson` *(or other variant)* instead
20
+ * Note: It is not recommended to use this constructor directly, use `createPipelineCollectionFromJson` *(or other variant)* instead
21
21
  */
22
22
  constructor(...pipelines: ReadonlyArray<PipelineJson>);
23
23
  /**
@@ -1,12 +1,12 @@
1
- import type { ExecutionTools } from '../../execution/ExecutionTools';
2
- import type { PrepareAndScrapeOptions } from '../../prepare/PrepareAndScrapeOptions';
3
- import type { string_dirname, string_pipeline_root_url } from '../../types/typeAliases';
1
+ import type { ExecutionTools } from '../../../execution/ExecutionTools';
2
+ import type { PrepareAndScrapeOptions } from '../../../prepare/PrepareAndScrapeOptions';
3
+ import type { string_dirname, string_pipeline_root_url } from '../../../types/typeAliases';
4
4
  import type { PipelineCollection } from '../PipelineCollection';
5
5
  /**
6
- * Options for `createCollectionFromDirectory` function
6
+ * Options for `createPipelineCollectionFromDirectory` function
7
7
  *
8
8
  * Note: `rootDirname` is not needed because it is the folder in which `.book` or `.book` file is located
9
- * This is not same as `path` which is the first argument of `createCollectionFromDirectory` - it can be a subfolder
9
+ * This is not same as `path` which is the first argument of `createPipelineCollectionFromDirectory` - it can be a subfolder
10
10
  */
11
11
  type CreatePipelineCollectionFromDirectoryOptions = Omit<PrepareAndScrapeOptions, 'rootDirname'> & {
12
12
  /**
@@ -27,8 +27,6 @@ type CreatePipelineCollectionFromDirectoryOptions = Omit<PrepareAndScrapeOptions
27
27
  * It has 2 purposes:
28
28
  * 1) Every pipeline in the collection is checked if it is a child of `rootUrl`
29
29
  * 2) If the pipeline does not have a URL, it is created from the `rootUrl` and path to the pipeline
30
- *
31
- * @default false
32
30
  */
33
31
  rootUrl?: string_pipeline_root_url;
34
32
  /**
@@ -46,7 +44,7 @@ type CreatePipelineCollectionFromDirectoryOptions = Omit<PrepareAndScrapeOptions
46
44
  isCrashedOnError?: boolean;
47
45
  };
48
46
  /**
49
- * Constructs Pipeline from given directory
47
+ * Constructs `PipelineCollection` from given directory
50
48
  *
51
49
  * Note: Works only in Node.js environment because it reads the file system
52
50
  *
@@ -56,9 +54,9 @@ type CreatePipelineCollectionFromDirectoryOptions = Omit<PrepareAndScrapeOptions
56
54
  * @returns PipelineCollection
57
55
  * @public exported from `@promptbook/node`
58
56
  */
59
- export declare function createCollectionFromDirectory(rootPath: string_dirname, tools?: Pick<ExecutionTools, 'llm' | 'fs' | 'scrapers'>, options?: CreatePipelineCollectionFromDirectoryOptions): Promise<PipelineCollection>;
57
+ export declare function createPipelineCollectionFromDirectory(rootPath: string_dirname, tools?: Pick<ExecutionTools, 'llm' | 'fs' | 'scrapers'>, options?: CreatePipelineCollectionFromDirectoryOptions): Promise<PipelineCollection>;
60
58
  export {};
61
59
  /**
62
- * TODO: [🖇] What about symlinks? Maybe option isSymlinksFollowed
60
+ * TODO: [🖇] What about symlinks? Maybe option `isSymlinksFollowed`
63
61
  * TODO: Maybe move from `@promptbook/node` to `@promptbook/core` as we removes direct dependency on `fs`
64
62
  */
@@ -0,0 +1,13 @@
1
+ import type { PipelineJson } from '../../../pipeline/PipelineJson/PipelineJson';
2
+ import type { PipelineCollection } from '../PipelineCollection';
3
+ /**
4
+ * Creates `PipelineCollection` from array of PipelineJson or PipelineString
5
+ *
6
+ * Note: Functions `pipelineCollectionToJson` and `createPipelineCollectionFromJson` are complementary
7
+ * Note: Syntax, parsing, and logic consistency checks are performed on all sources during build
8
+ *
9
+ * @param promptbookSources
10
+ * @returns PipelineCollection
11
+ * @public exported from `@promptbook/core`
12
+ */
13
+ export declare function createPipelineCollectionFromJson(...promptbooks: ReadonlyArray<PipelineJson>): PipelineCollection;
@@ -1,23 +1,24 @@
1
- import type { PipelineJson } from '../../pipeline/PipelineJson/PipelineJson';
1
+ import type { PipelineJson } from '../../../pipeline/PipelineJson/PipelineJson';
2
2
  import type { PipelineCollection } from '../PipelineCollection';
3
3
  /**
4
- * Constructs Promptbook from async sources
4
+ * Constructs `PipelineCollection` from async sources
5
+ *
5
6
  * It can be one of the following:
6
7
  * - Promise of array of PipelineJson or PipelineString
7
8
  * - Factory function that returns Promise of array of PipelineJson or PipelineString
8
9
  *
9
10
  * Note: This is useful as internal tool for other constructor functions like
10
- * `createCollectionFromUrl` or `createCollectionFromDirectory`
11
+ * `createPipelineCollectionFromUrl` or `createPipelineCollectionFromDirectory`
11
12
  * Consider using those functions instead of this one
12
13
  *
13
14
  * Note: The function does NOT return promise it returns the collection directly which waits for the sources to be resolved
14
15
  * when error occurs in given promise or factory function, it is thrown during `listPipelines` or `getPipelineByUrl` call
15
16
  *
16
- * Note: Consider using `createCollectionFromDirectory` or `createCollectionFromUrl`
17
+ * Note: Consider using `createPipelineCollectionFromDirectory` or `createPipelineCollectionFromUrl`
17
18
  *
18
19
  * @param promptbookSourcesPromiseOrFactory
19
20
  * @returns PipelineCollection
20
21
  * @deprecated Do not use, it will became internal tool for other constructor functions
21
22
  * @public exported from `@promptbook/core`
22
23
  */
23
- export declare function createCollectionFromPromise(promptbookSourcesPromiseOrFactory: Promise<ReadonlyArray<PipelineJson>> | (() => Promise<ReadonlyArray<PipelineJson>>)): PipelineCollection;
24
+ export declare function createPipelineCollectionFromPromise(promptbookSourcesPromiseOrFactory: Promise<ReadonlyArray<PipelineJson>> | (() => Promise<ReadonlyArray<PipelineJson>>)): PipelineCollection;
@@ -1,7 +1,7 @@
1
- import type { string_url } from '../../types/typeAliases';
1
+ import type { string_url } from '../../../types/typeAliases';
2
2
  import type { PipelineCollection } from '../PipelineCollection';
3
3
  /**
4
- * Options for `createCollectionFromDirectory` function
4
+ * Options for `createPipelineCollectionFromDirectory` function
5
5
  */
6
6
  type CreatePipelineCollectionFromUrlyOptions = {
7
7
  /**
@@ -22,7 +22,7 @@ type CreatePipelineCollectionFromUrlyOptions = {
22
22
  * @returns PipelineCollection
23
23
  * @public exported from `@promptbook/core`
24
24
  */
25
- export declare function createCollectionFromUrl(url: string_url | URL, options: CreatePipelineCollectionFromUrlyOptions): Promise<PipelineCollection>;
25
+ export declare function createPipelineCollectionFromUrl(url: string_url | URL, options: CreatePipelineCollectionFromUrlyOptions): Promise<PipelineCollection>;
26
26
  export {};
27
27
  /**
28
28
  * TODO: [main] !!4 [🧠] Library precompilation and do not mix markdown and json promptbooks
@@ -1,7 +1,7 @@
1
- import type { string_pipeline_url } from '../../types/typeAliases';
1
+ import type { string_pipeline_url } from '../../../types/typeAliases';
2
2
  import type { PipelineCollection } from '../PipelineCollection';
3
3
  /**
4
- * Creates PipelineCollection as a subset of another PipelineCollection
4
+ * Creates `PipelineCollection` as a subset of another `PipelineCollection`
5
5
  *
6
6
  * Note: You can use any type of collection as a parent collection - local, remote, etc.
7
7
  * Note: This is just a thin wrapper / proxy around the parent collection
@@ -10,4 +10,4 @@ import type { PipelineCollection } from '../PipelineCollection';
10
10
  * @returns PipelineCollection
11
11
  * @public exported from `@promptbook/core`
12
12
  */
13
- export declare function createSubcollection(collection: PipelineCollection, predicate: (url: string_pipeline_url) => boolean): PipelineCollection;
13
+ export declare function createPipelineSubcollection(collection: PipelineCollection, predicate: (url: string_pipeline_url) => boolean): PipelineCollection;
@@ -0,0 +1,13 @@
1
+ import type { PipelineJson } from '../../pipeline/PipelineJson/PipelineJson';
2
+ import type { PipelineCollection } from './PipelineCollection';
3
+ /**
4
+ * Converts PipelineCollection to serialized JSON
5
+ *
6
+ * Note: Functions `pipelineCollectionToJson` and `createPipelineCollectionFromJson` are complementary
7
+ *
8
+ * @public exported from `@promptbook/core`
9
+ */
10
+ export declare function pipelineCollectionToJson(collection: PipelineCollection): Promise<ReadonlyArray<PipelineJson>>;
11
+ /**
12
+ * TODO: [🧠] Maybe clear `sourceFile` or clear when exposing through API or remote server
13
+ */
@@ -233,6 +233,13 @@ export declare const DEFAULT_MAX_KNOWLEDGE_SOURCES_SCRAPING_TOTAL = 200;
233
233
  * @public exported from `@promptbook/core`
234
234
  */
235
235
  export declare const DEFAULT_BOOKS_DIRNAME = "./books";
236
+ /**
237
+ * Where to store your agents (also book files)
238
+ * This is kind of a "src" for your books
239
+ *
240
+ * @public exported from `@promptbook/core`
241
+ */
242
+ export declare const DEFAULT_AGENTS_DIRNAME = "./agents";
236
243
  /**
237
244
  * Where to store the temporary downloads
238
245
  *
@@ -270,7 +277,7 @@ export declare const CLI_APP_ID: string_app_id;
270
277
  */
271
278
  export declare const PLAYGROUND_APP_ID: string_app_id;
272
279
  /**
273
- * The name of the builded pipeline collection made by CLI `ptbk make` and for lookup in `createCollectionFromDirectory`
280
+ * The name of the builded pipeline collection made by CLI `ptbk make` and for lookup in `createPipelineCollectionFromDirectory`
274
281
  *
275
282
  * @public exported from `@promptbook/core`
276
283
  */
@@ -3,7 +3,7 @@ import type fs from 'fs/promises';
3
3
  /**
4
4
  * Container for all the tools needed to manipulate with filesystem
5
5
  */
6
- export type FilesystemTools = Pick<typeof fs, 'access' | 'constants' | 'readFile' | 'writeFile' | 'stat' | 'readdir' | 'mkdir'>;
6
+ export type FilesystemTools = Pick<typeof fs, 'access' | 'constants' | 'readFile' | 'writeFile' | 'stat' | 'readdir' | 'mkdir' | 'watch'>;
7
7
  /**
8
8
  * TODO: Implement destroyable pattern to free resources
9
9
  */
@@ -9,6 +9,12 @@ import type { ChatPromptResult, CompletionPromptResult, EmbeddingPromptResult }
9
9
  * On its interface it exposes common methods for prompt execution.
10
10
  * Inside (in constructor) it calls OpenAI, Azure, GPU, proxy, cache, logging,...
11
11
  *
12
+ * Note: [🦖] There are several different things in Promptbook:
13
+ * - `Agent` - which represents an AI Agent with its source, memories, actions, etc. Agent is a higher-level abstraction which is internally using:
14
+ * - `LlmExecutionTools` - which wraps one or more LLM models and provides an interface to execute them
15
+ * - `AgentLlmExecutionTools` - which is a specific implementation of `LlmExecutionTools` that wraps another LlmExecutionTools and applies agent-specific system prompts and requirements
16
+ * - `OpenAiAssistantExecutionTools` - which is a specific implementation of `LlmExecutionTools` for OpenAI models with assistant capabilities, recommended for usage in `Agent` or `AgentLlmExecutionTools`
17
+ *
12
18
  * @see https://github.com/webgptorg/promptbook#llm-execution-tools
13
19
  */
14
20
  export type LlmExecutionTools = {
@@ -2,8 +2,13 @@ import { BehaviorSubject } from 'rxjs';
2
2
  import { AgentBasicInformation, BookParameter, LlmExecutionTools, string_agent_name, string_book, string_url_image } from '../../_packages/types.index';
3
3
  import { AgentOptions } from './AgentOptions';
4
4
  /**
5
- * Note: !!!! `Agent` vs `LlmExecutionTools`
5
+ * Represents one AI Agent
6
6
  *
7
+ * Note: [🦖] There are several different things in Promptbook:
8
+ * - `Agent` - which represents an AI Agent with its source, memories, actions, etc. Agent is a higher-level abstraction which is internally using:
9
+ * - `LlmExecutionTools` - which wraps one or more LLM models and provides an interface to execute them
10
+ * - `AgentLlmExecutionTools` - which is a specific implementation of `LlmExecutionTools` that wraps another LlmExecutionTools and applies agent-specific system prompts and requirements
11
+ * - `OpenAiAssistantExecutionTools` - which is a specific implementation of `LlmExecutionTools` for OpenAI models with assistant capabilities, recommended for usage in `Agent` or `AgentLlmExecutionTools`
7
12
  *
8
13
  * @public exported from `@promptbook/core`
9
14
  */
@@ -1,20 +1,25 @@
1
1
  import type { Promisable } from 'type-fest';
2
- import type { string_book } from '../../book-2.0/agent-source/string_book';
3
2
  import type { ChatParticipant } from '../../book-components/Chat/types/ChatParticipant';
4
3
  import type { AvailableModel } from '../../execution/AvailableModel';
5
4
  import type { LlmExecutionTools } from '../../execution/LlmExecutionTools';
6
5
  import type { ChatPromptResult } from '../../execution/PromptResult';
7
6
  import type { Prompt } from '../../types/Prompt';
8
7
  import type { string_markdown, string_markdown_text, string_model_name, string_title } from '../../types/typeAliases';
8
+ import { 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
12
12
  *
13
+ * Note: [🦖] There are several different things in Promptbook:
14
+ * - `Agent` - which represents an AI Agent with its source, memories, actions, etc. Agent is a higher-level abstraction which is internally using:
15
+ * - `LlmExecutionTools` - which wraps one or more LLM models and provides an interface to execute them
16
+ * - `AgentLlmExecutionTools` - which is a specific implementation of `LlmExecutionTools` that wraps another LlmExecutionTools and applies agent-specific system prompts and requirements
17
+ * - `OpenAiAssistantExecutionTools` - which is a specific implementation of `LlmExecutionTools` for OpenAI models with assistant capabilities, recommended for usage in `Agent` or `AgentLlmExecutionTools`
18
+ *
13
19
  * @public exported from `@promptbook/core`
14
20
  */
15
21
  export declare class AgentLlmExecutionTools implements LlmExecutionTools {
16
- private readonly llmTools;
17
- private readonly agentSource;
22
+ private readonly options;
18
23
  /**
19
24
  * Cached model requirements to avoid re-parsing the agent source
20
25
  */
@@ -29,7 +34,7 @@ export declare class AgentLlmExecutionTools implements LlmExecutionTools {
29
34
  * @param llmTools The underlying LLM execution tools to wrap
30
35
  * @param agentSource The agent source string that defines the agent's behavior
31
36
  */
32
- constructor(llmTools: LlmExecutionTools, agentSource: string_book);
37
+ constructor(options: CreateAgentLlmExecutionToolsOptions);
33
38
  /**
34
39
  * Get cached or parse agent information
35
40
  */
@@ -9,7 +9,3 @@ export declare const createAgentLlmExecutionTools: ((options: CreateAgentLlmExec
9
9
  packageName: string;
10
10
  className: string;
11
11
  };
12
- /**
13
- * TODO: [🧠] Consider adding validation for agent source format
14
- * TODO: [🧠] Consider adding options for caching behavior
15
- */
@@ -9,6 +9,12 @@ import { OpenAiExecutionTools } from './OpenAiExecutionTools';
9
9
  *
10
10
  * This is useful for calling OpenAI API with a single assistant, for more wide usage use `OpenAiExecutionTools`.
11
11
  *
12
+ * Note: [🦖] There are several different things in Promptbook:
13
+ * - `Agent` - which represents an AI Agent with its source, memories, actions, etc. Agent is a higher-level abstraction which is internally using:
14
+ * - `LlmExecutionTools` - which wraps one or more LLM models and provides an interface to execute them
15
+ * - `AgentLlmExecutionTools` - which is a specific implementation of `LlmExecutionTools` that wraps another LlmExecutionTools and applies agent-specific system prompts and requirements
16
+ * - `OpenAiAssistantExecutionTools` - which is a specific implementation of `LlmExecutionTools` for OpenAI models with assistant capabilities, recommended for usage in `Agent` or `AgentLlmExecutionTools`
17
+ *
12
18
  * @public exported from `@promptbook/openai`
13
19
  */
14
20
  export declare class OpenAiAssistantExecutionTools extends OpenAiExecutionTools implements LlmExecutionTools {
@@ -26,7 +32,17 @@ export declare class OpenAiAssistantExecutionTools extends OpenAiExecutionTools
26
32
  * Calls OpenAI API to use a chat model.
27
33
  */
28
34
  callChatModel(prompt: Pick<Prompt, 'content' | 'parameters' | 'modelRequirements' | 'format'>): Promise<ChatPromptResult>;
29
- createNewAssistant(): Promise<OpenAiAssistantExecutionTools>;
35
+ playground(): Promise<void>;
36
+ createNewAssistant(options: {
37
+ /**
38
+ * Name of the new assistant
39
+ */
40
+ readonly name: string_title;
41
+ /**
42
+ * Instructions for the new assistant
43
+ */
44
+ readonly instructions: string_markdown;
45
+ }): Promise<OpenAiAssistantExecutionTools>;
30
46
  /**
31
47
  * Discriminant for type guards
32
48
  */
@@ -1,4 +1,4 @@
1
- import type { PipelineCollection } from '../../collection/PipelineCollection';
1
+ import type { PipelineCollection } from '../../collection/pipeline-collection/pipeline-collection/PipelineCollection';
2
2
  /**
3
3
  * Get pipeline collection for Untitled Promptbook project
4
4
  *
@@ -18,7 +18,7 @@ export declare function startRemoteServer<TCustomOptions = undefined>(options: R
18
18
  * TODO: Split this file into multiple functions - handler for each request
19
19
  * TODO: Maybe use `$exportJson`
20
20
  * TODO: [🧠][🛍] Maybe not `isAnonymous: boolean` BUT `mode: 'ANONYMOUS'|'COLLECTION'`
21
- * TODO: [⚖] Expose the collection to be able to connect to same collection via createCollectionFromUrl
21
+ * TODO: [⚖] Expose the collection to be able to connect to same collection via createPipelineCollectionFromUrl
22
22
  * TODO: Handle progress - support streaming
23
23
  * TODO: [🗯] Do not hang up immediately but wait until client closes OR timeout
24
24
  * TODO: [🗯] Timeout on chat to free up resources
@@ -1,17 +1,13 @@
1
1
  import type { Request, Response } from 'express';
2
2
  import type { Promisable } from 'type-fest';
3
- import type { PipelineCollection } from '../../collection/PipelineCollection';
3
+ import { really_any } from '../../_packages/types.index';
4
+ import type { PipelineCollection } from '../../collection/pipeline-collection/PipelineCollection';
4
5
  import { AuthenticationError } from '../../errors/AuthenticationError';
5
6
  import type { CommonToolsOptions } from '../../execution/CommonToolsOptions';
6
7
  import type { ExecutionTools } from '../../execution/ExecutionTools';
7
8
  import type { LlmExecutionTools } from '../../execution/LlmExecutionTools';
8
- import type { string_app_id } from '../../types/typeAliases';
9
- import type { string_email } from '../../types/typeAliases';
10
- import type { string_password } from '../../types/typeAliases';
11
- import type { string_token } from '../../types/typeAliases';
12
- import type { string_user_id } from '../../types/typeAliases';
13
- import type { ApplicationModeIdentification } from '../socket-types/_subtypes/Identification';
14
- import type { Identification } from '../socket-types/_subtypes/Identification';
9
+ import type { string_app_id, string_email, string_password, string_token, string_user_id } from '../../types/typeAliases';
10
+ import type { ApplicationModeIdentification, Identification } from '../socket-types/_subtypes/Identification';
15
11
  /**
16
12
  * Options for configuring the Promptbook remote server.
17
13
  *
@@ -31,6 +27,24 @@ export type RemoteServerOptions<TCustomOptions> = CommonToolsOptions & {
31
27
  * @property {number} port The port number the server will listen on.
32
28
  */
33
29
  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
+ };
34
48
  /**
35
49
  * Enable rich UI (React + Tailwind) at `/` path.
36
50
  * Default: true
@@ -7,7 +7,7 @@ import { Registration } from '../../_packages/types.index';
7
7
  * @public exported from `@promptbook/wizard`
8
8
  * @public exported from `@promptbook/cli`
9
9
  *
10
- * TODO: !!!! Which package should export this?
10
+ * TODO: !!! Which package should export this?
11
11
  */
12
12
  export declare const _FormattedBookInMarkdownTranspilerRegistration: Registration;
13
13
  /**
@@ -1,13 +1,12 @@
1
1
  import type { FilesystemTools } from '../../execution/FilesystemTools';
2
- import type { string_dirname } from '../../types/typeAliases';
3
- import type { string_filename } from '../../types/typeAliases';
2
+ import type { string_dirname, string_filename } from '../../types/typeAliases';
4
3
  /**
5
4
  * Reads all files in the directory
6
5
  *
7
6
  * @param path
8
7
  * @param isRecursive
9
8
  * @returns List of all files in the directory
10
- * @private internal function of `createCollectionFromDirectory`
9
+ * @private internal function of `AgentCollectionInDirectory` and `createPipelineCollectionFromDirectory`
11
10
  */
12
11
  export declare function listAllFiles(path: string_dirname, isRecursive: boolean, fs: FilesystemTools): Promise<Array<string_filename>>;
13
12
  /**
@@ -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-36`).
18
+ * It follows semantic versioning (e.g., `0.103.0-39`).
19
19
  *
20
20
  * @generated
21
21
  */
@@ -2,8 +2,7 @@ import type { ExecutionTools } from '../execution/ExecutionTools';
2
2
  import type { PipelineJson } from '../pipeline/PipelineJson/PipelineJson';
3
3
  import type { PipelineString } from '../pipeline/PipelineString';
4
4
  import type { PrepareAndScrapeOptions } from '../prepare/PrepareAndScrapeOptions';
5
- import type { string_filename } from '../types/typeAliases';
6
- import type { string_pipeline_url } from '../types/typeAliases';
5
+ import type { string_filename, string_pipeline_url } from '../types/typeAliases';
7
6
  /**
8
7
  * @see ./wizard.ts `getPipeline` method
9
8
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promptbook/vercel",
3
- "version": "0.103.0-37",
3
+ "version": "0.103.0-40",
4
4
  "description": "Promptbook: Turn your company's scattered knowledge into AI ready books",
5
5
  "private": false,
6
6
  "sideEffects": false,
@@ -94,7 +94,7 @@
94
94
  "module": "./esm/index.es.js",
95
95
  "typings": "./esm/typings/src/_packages/vercel.index.d.ts",
96
96
  "peerDependencies": {
97
- "@promptbook/core": "0.103.0-37"
97
+ "@promptbook/core": "0.103.0-40"
98
98
  },
99
99
  "dependencies": {
100
100
  "colors": "^1.4.0",
package/umd/index.umd.js CHANGED
@@ -23,7 +23,7 @@
23
23
  * @generated
24
24
  * @see https://github.com/webgptorg/promptbook
25
25
  */
26
- const PROMPTBOOK_ENGINE_VERSION = '0.103.0-37';
26
+ const PROMPTBOOK_ENGINE_VERSION = '0.103.0-40';
27
27
  /**
28
28
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
29
29
  * Note: [💞] Ignore a discrepancy between file name and entity name