@promptbook/templates 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 +630 -683
  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 +630 -683
  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
@@ -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/templates",
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,
@@ -95,7 +95,7 @@
95
95
  "module": "./esm/index.es.js",
96
96
  "typings": "./esm/typings/src/_packages/templates.index.d.ts",
97
97
  "peerDependencies": {
98
- "@promptbook/core": "0.103.0-37"
98
+ "@promptbook/core": "0.103.0-40"
99
99
  },
100
100
  "dependencies": {
101
101
  "spacetrim": "0.11.60"