@promptbook/vercel 0.103.0-35 → 0.103.0-37

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 (24) hide show
  1. package/esm/index.es.js +1 -1
  2. package/esm/typings/src/_packages/core.index.d.ts +4 -0
  3. package/esm/typings/src/_packages/types.index.d.ts +5 -1
  4. package/esm/typings/src/book-2.0/agent-source/AgentBasicInformation.d.ts +1 -0
  5. package/esm/typings/src/book-components/Chat/save/html/htmlSaveFormatDefinition.d.ts +1 -0
  6. package/esm/typings/src/book-components/Chat/save/pdf/pdfSaveFormatDefinition.d.ts +4 -0
  7. package/esm/typings/src/book-components/_common/Tooltip/Tooltip.d.ts +47 -0
  8. package/esm/typings/src/errors/0-index.d.ts +3 -0
  9. package/esm/typings/src/errors/NotAllowed.d.ts +9 -0
  10. package/esm/typings/src/execution/AvailableModel.d.ts +1 -0
  11. package/esm/typings/src/execution/Executables.d.ts +3 -0
  12. package/esm/typings/src/execution/ExecutionTools.d.ts +5 -0
  13. package/esm/typings/src/execution/LlmExecutionTools.d.ts +1 -1
  14. package/esm/typings/src/llm-providers/agent/Agent.d.ts +44 -0
  15. package/esm/typings/src/llm-providers/agent/AgentOptions.d.ts +17 -0
  16. package/esm/typings/src/llm-providers/agent/CreateAgentLlmExecutionToolsOptions.d.ts +16 -0
  17. package/esm/typings/src/llm-providers/agent/createAgentLlmExecutionTools.d.ts +1 -15
  18. package/esm/typings/src/llm-providers/openai/OpenAiAssistantExecutionTools.d.ts +12 -0
  19. package/esm/typings/src/llm-providers/openai/OpenAiAssistantExecutionToolsOptions.d.ts +7 -1
  20. package/esm/typings/src/remote-server/startRemoteServer.d.ts +2 -0
  21. package/esm/typings/src/types/Updatable.d.ts +19 -0
  22. package/esm/typings/src/version.d.ts +1 -1
  23. package/package.json +2 -2
  24. package/umd/index.umd.js +1 -1
package/esm/index.es.js CHANGED
@@ -16,7 +16,7 @@ const BOOK_LANGUAGE_VERSION = '1.0.0';
16
16
  * @generated
17
17
  * @see https://github.com/webgptorg/promptbook
18
18
  */
19
- const PROMPTBOOK_ENGINE_VERSION = '0.103.0-35';
19
+ const PROMPTBOOK_ENGINE_VERSION = '0.103.0-37';
20
20
  /**
21
21
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
22
22
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -82,6 +82,7 @@ import { ExpectError } from '../errors/ExpectError';
82
82
  import { KnowledgeScrapeError } from '../errors/KnowledgeScrapeError';
83
83
  import { LimitReachedError } from '../errors/LimitReachedError';
84
84
  import { MissingToolsError } from '../errors/MissingToolsError';
85
+ import { NotAllowed } from '../errors/NotAllowed';
85
86
  import { NotFoundError } from '../errors/NotFoundError';
86
87
  import { NotYetImplementedError } from '../errors/NotYetImplementedError';
87
88
  import { ParseError } from '../errors/ParseError';
@@ -129,6 +130,7 @@ import { limitTotalUsage } from '../llm-providers/_common/utils/count-total-usag
129
130
  import { getSingleLlmExecutionTools } from '../llm-providers/_multiple/getSingleLlmExecutionTools';
130
131
  import { joinLlmExecutionTools } from '../llm-providers/_multiple/joinLlmExecutionTools';
131
132
  import { MultipleLlmExecutionTools } from '../llm-providers/_multiple/MultipleLlmExecutionTools';
133
+ import { Agent } from '../llm-providers/agent/Agent';
132
134
  import { AgentLlmExecutionTools } from '../llm-providers/agent/AgentLlmExecutionTools';
133
135
  import { createAgentLlmExecutionTools } from '../llm-providers/agent/createAgentLlmExecutionTools';
134
136
  import { _AgentMetadata } from '../llm-providers/agent/register-configuration';
@@ -264,6 +266,7 @@ export { ExpectError };
264
266
  export { KnowledgeScrapeError };
265
267
  export { LimitReachedError };
266
268
  export { MissingToolsError };
269
+ export { NotAllowed };
267
270
  export { NotFoundError };
268
271
  export { NotYetImplementedError };
269
272
  export { ParseError };
@@ -311,6 +314,7 @@ export { limitTotalUsage };
311
314
  export { getSingleLlmExecutionTools };
312
315
  export { joinLlmExecutionTools };
313
316
  export { MultipleLlmExecutionTools };
317
+ export { Agent };
314
318
  export { AgentLlmExecutionTools };
315
319
  export { createAgentLlmExecutionTools };
316
320
  export { _AgentMetadata };
@@ -99,7 +99,8 @@ import type { LlmToolsOptions } from '../llm-providers/_common/register/LlmTools
99
99
  import type { CacheItem } from '../llm-providers/_common/utils/cache/CacheItem';
100
100
  import type { CacheLlmToolsOptions } from '../llm-providers/_common/utils/cache/CacheLlmToolsOptions';
101
101
  import type { LlmExecutionToolsWithTotalUsage } from '../llm-providers/_common/utils/count-total-usage/LlmExecutionToolsWithTotalUsage';
102
- import type { CreateAgentLlmExecutionToolsOptions } from '../llm-providers/agent/createAgentLlmExecutionTools';
102
+ import type { AgentOptions } from '../llm-providers/agent/AgentOptions';
103
+ import type { CreateAgentLlmExecutionToolsOptions } from '../llm-providers/agent/CreateAgentLlmExecutionToolsOptions';
103
104
  import type { AnthropicClaudeExecutionToolsOptions } from '../llm-providers/anthropic-claude/AnthropicClaudeExecutionToolsOptions';
104
105
  import type { AnthropicClaudeExecutionToolsNonProxiedOptions } from '../llm-providers/anthropic-claude/AnthropicClaudeExecutionToolsOptions';
105
106
  import type { AnthropicClaudeExecutionToolsProxiedOptions } from '../llm-providers/anthropic-claude/AnthropicClaudeExecutionToolsOptions';
@@ -310,6 +311,7 @@ import type { number_kilobytes } from '../types/typeAliases';
310
311
  import type { number_megabytes } from '../types/typeAliases';
311
312
  import type { number_gigabytes } from '../types/typeAliases';
312
313
  import type { number_terabytes } from '../types/typeAliases';
314
+ import type { Updatable } from '../types/Updatable';
313
315
  import type { ColorTransformer } from '../utils/color/operators/ColorTransformer';
314
316
  import type { PipelineEditableSerialized } from '../utils/editable/types/PipelineEditableSerialized';
315
317
  import type { ExecCommandOptions } from '../utils/execCommand/ExecCommandOptions';
@@ -437,6 +439,7 @@ export type { LlmToolsOptions };
437
439
  export type { CacheItem };
438
440
  export type { CacheLlmToolsOptions };
439
441
  export type { LlmExecutionToolsWithTotalUsage };
442
+ export type { AgentOptions };
440
443
  export type { CreateAgentLlmExecutionToolsOptions };
441
444
  export type { AnthropicClaudeExecutionToolsOptions };
442
445
  export type { AnthropicClaudeExecutionToolsNonProxiedOptions };
@@ -648,6 +651,7 @@ export type { number_kilobytes };
648
651
  export type { number_megabytes };
649
652
  export type { number_gigabytes };
650
653
  export type { number_terabytes };
654
+ export type { Updatable };
651
655
  export type { ColorTransformer };
652
656
  export type { PipelineEditableSerialized };
653
657
  export type { ExecCommandOptions };
@@ -55,5 +55,6 @@ export type AgentBasicInformation = {
55
55
  parameters: BookParameter[];
56
56
  };
57
57
  /**
58
+ * TODO: All readonly
58
59
  * TODO: [🕛] Unite `AgentBasicInformation`, `ChatParticipant`, `LlmExecutionTools` + `LlmToolsMetadata`
59
60
  */
@@ -15,5 +15,6 @@ export declare const htmlSaveFormatDefinition: {
15
15
  readonly fileExtension: "html";
16
16
  };
17
17
  /**
18
+ * TODO: !!! Add QR code with branding to the footer
18
19
  * TODO: [😬] Take chat save to HTML from existing parallel implementation
19
20
  */
@@ -14,3 +14,7 @@ export declare const pdfSaveFormatDefinition: {
14
14
  readonly mimeType: "application/pdf";
15
15
  readonly fileExtension: "pdf";
16
16
  };
17
+ /**
18
+ * TODO: !!! Add QR code with branding to the footer
19
+ * TODO: !!! Add print option
20
+ */
@@ -0,0 +1,47 @@
1
+ import { ReactNode } from 'react';
2
+ type TooltipProps = {
3
+ /**
4
+ * The content to display in the tooltip
5
+ */
6
+ content: string;
7
+ /**
8
+ * The element that triggers the tooltip
9
+ */
10
+ children: ReactNode;
11
+ /**
12
+ * The position of the tooltip relative to the trigger element
13
+ * @default "top"
14
+ */
15
+ position?: 'top' | 'right' | 'bottom' | 'left';
16
+ /**
17
+ * Optional delay before showing the tooltip (in milliseconds)
18
+ * @default 0
19
+ */
20
+ delay?: number;
21
+ /**
22
+ * Render the tooltip wrapper as a block-level element that spans full width.
23
+ * Useful when wrapping grid/list items so the clickable area matches the visual card.
24
+ * @default false
25
+ */
26
+ block?: boolean;
27
+ /**
28
+ * Enable tooltip on touch devices. By default tooltips are disabled on touch to avoid
29
+ * stealing clicks from the underlying element (eg. agent card selection).
30
+ * @default false
31
+ */
32
+ isEnabledOnTouch?: boolean;
33
+ /**
34
+ * If true, the tooltip will not be displayed but the content will still be rendered.
35
+ * In this case <Tooltip> is equivalent to a <React.Fragment> with the content.
36
+ *
37
+ * Note: Tooltip sometimes breaks the hover, temporarily disable via this prop
38
+ */
39
+ isDisabled?: boolean;
40
+ };
41
+ /**
42
+ * A tooltip component that displays additional information when hovering over an element
43
+ *
44
+ * @private Used internally in book components
45
+ */
46
+ export declare function Tooltip({ content, children, position, delay, block, isEnabledOnTouch: enableOnTouch, isDisabled, }: TooltipProps): import("react/jsx-runtime").JSX.Element;
47
+ export {};
@@ -7,6 +7,7 @@ import { ExpectError } from './ExpectError';
7
7
  import { KnowledgeScrapeError } from './KnowledgeScrapeError';
8
8
  import { LimitReachedError } from './LimitReachedError';
9
9
  import { MissingToolsError } from './MissingToolsError';
10
+ import { NotAllowed } from './NotAllowed';
10
11
  import { NotFoundError } from './NotFoundError';
11
12
  import { NotYetImplementedError } from './NotYetImplementedError';
12
13
  import { ParseError } from './ParseError';
@@ -40,6 +41,7 @@ export declare const PROMPTBOOK_ERRORS: {
40
41
  readonly PromptbookFetchError: typeof PromptbookFetchError;
41
42
  readonly UnexpectedError: typeof UnexpectedError;
42
43
  readonly WrappedError: typeof WrappedError;
44
+ readonly NotAllowed: typeof NotAllowed;
43
45
  };
44
46
  /**
45
47
  * Index of all javascript errors
@@ -88,6 +90,7 @@ export declare const ALL_ERRORS: {
88
90
  readonly PromptbookFetchError: typeof PromptbookFetchError;
89
91
  readonly UnexpectedError: typeof UnexpectedError;
90
92
  readonly WrappedError: typeof WrappedError;
93
+ readonly NotAllowed: typeof NotAllowed;
91
94
  };
92
95
  /**
93
96
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -0,0 +1,9 @@
1
+ /**
2
+ * This error indicates that promptbook operation is not allowed
3
+ *
4
+ * @public exported from `@promptbook/core`
5
+ */
6
+ export declare class NotAllowed extends Error {
7
+ readonly name = "NotAllowed";
8
+ constructor(message: string);
9
+ }
@@ -46,5 +46,6 @@ export type AvailableModel = {
46
46
  readonly isDeprecated?: boolean;
47
47
  };
48
48
  /**
49
+ * TODO: [🕛] Extend this from sth like `AgentBasicInformation` / `ModelBasicInformation`
49
50
  * TODO: [🧠] Maybe rename to something else - like `ModelInformation` or `ModelMetadata`
50
51
  */
@@ -16,3 +16,6 @@ export type Executables = {
16
16
  */
17
17
  libreOfficePath?: string_executable_path;
18
18
  };
19
+ /**
20
+ * <- TODO: Add !!! `browserPath` to `Executables`
21
+ */
@@ -67,3 +67,8 @@ export type ExecutionTools = {
67
67
  */
68
68
  readonly userInterface?: UserInterfaceTools;
69
69
  };
70
+ /**
71
+ * <- TODO: Add !!! `promptbookAgent` to `ExecutionTools`
72
+ * <- TODO: Add !!! `mcps` to `ExecutionTools`
73
+ * <- TODO: Add !!! `prepareCache` to `ExecutionTools`
74
+ */
@@ -56,7 +56,7 @@ export type LlmExecutionTools = {
56
56
  callEmbeddingModel?(prompt: Prompt): Promise<EmbeddingPromptResult>;
57
57
  };
58
58
  /**
59
- * TODO: [🕛] Extend this from sth class
59
+ * TODO: [🕛] Extend this from sth class - like `AgentBasicInformation` / `ModelBasicInformation``
60
60
  * TODO: [🍚] Implement destroyable pattern to free resources
61
61
  * TODO: [🏳] Add `callTranslationModel`
62
62
  * TODO: [🧠] Emulation of one type of model with another one - emuate chat with completion; emulate translation with chat
@@ -0,0 +1,44 @@
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';
4
+ /**
5
+ * Note: !!!! `Agent` vs `LlmExecutionTools`
6
+ *
7
+ *
8
+ * @public exported from `@promptbook/core`
9
+ */
10
+ export declare class Agent implements AgentBasicInformation {
11
+ private readonly options;
12
+ /**
13
+ * Name of the agent
14
+ */
15
+ agentName: string_agent_name | null;
16
+ /**
17
+ * Description of the agent
18
+ */
19
+ personaDescription: string | null;
20
+ /**
21
+ * Metadata like image or color
22
+ */
23
+ meta: {
24
+ image?: string_url_image;
25
+ link?: string;
26
+ title?: string;
27
+ description?: string;
28
+ [key: string]: string | undefined;
29
+ };
30
+ /**
31
+ * Not used in Agent, always returns empty array
32
+ */
33
+ get parameters(): BookParameter[];
34
+ readonly agentSource: BehaviorSubject<string_book>;
35
+ constructor(options: AgentOptions);
36
+ /**
37
+ * Creates LlmExecutionTools which exposes the agent as a model
38
+ */
39
+ getLlmExecutionTools(): LlmExecutionTools;
40
+ }
41
+ /**
42
+ * TODO: [🧠][😰]Agent is not working with the parameters, should it be?
43
+ * TODO: !!! Agent on remote server
44
+ */
@@ -0,0 +1,17 @@
1
+ import { CommonToolsOptions, ExecutionTools, string_book } from '../../_packages/types.index';
2
+ import { Updatable } from '../../types/Updatable';
3
+ /**
4
+ * Options for creating an Agent
5
+ */
6
+ export type AgentOptions = CommonToolsOptions & {
7
+ /**
8
+ * The execution tools available to the agent
9
+ *
10
+ * Here the agent has access to various LLM models, browser, scrapers, LibreOffice, tools, etc.
11
+ */
12
+ executionTools: ExecutionTools;
13
+ /**
14
+ * The source of the agent
15
+ */
16
+ agentSource: Updatable<string_book>;
17
+ };
@@ -0,0 +1,16 @@
1
+ import type { string_book } from '../../_packages/types.index';
2
+ import type { LlmExecutionTools } from '../../execution/LlmExecutionTools';
3
+ import type { OpenAiAssistantExecutionTools } from '../openai/OpenAiAssistantExecutionTools';
4
+ /**
5
+ * Options for creating AgentLlmExecutionTools
6
+ */
7
+ export type CreateAgentLlmExecutionToolsOptions = {
8
+ /**
9
+ * The underlying LLM execution tools to wrap
10
+ */
11
+ llmTools: LlmExecutionTools | OpenAiAssistantExecutionTools;
12
+ /**
13
+ * The agent source string that defines the agent's behavior
14
+ */
15
+ agentSource: string_book;
16
+ };
@@ -1,19 +1,5 @@
1
- import type { string_book } from '../../book-2.0/agent-source/string_book';
2
- import type { LlmExecutionTools } from '../../execution/LlmExecutionTools';
3
1
  import { AgentLlmExecutionTools } from './AgentLlmExecutionTools';
4
- /**
5
- * Options for creating AgentLlmExecutionTools
6
- */
7
- export type CreateAgentLlmExecutionToolsOptions = {
8
- /**
9
- * The underlying LLM execution tools to wrap
10
- */
11
- llmTools: LlmExecutionTools;
12
- /**
13
- * The agent source string that defines the agent's behavior
14
- */
15
- agentSource: string_book;
16
- };
2
+ import { CreateAgentLlmExecutionToolsOptions } from './CreateAgentLlmExecutionToolsOptions';
17
3
  /**
18
4
  * Creates new AgentLlmExecutionTools that wrap underlying LLM tools with agent-specific behavior
19
5
  *
@@ -13,6 +13,7 @@ import { OpenAiExecutionTools } from './OpenAiExecutionTools';
13
13
  */
14
14
  export declare class OpenAiAssistantExecutionTools extends OpenAiExecutionTools implements LlmExecutionTools {
15
15
  private readonly assistantId;
16
+ private readonly isCreatingNewAssistantsAllowed;
16
17
  /**
17
18
  * Creates OpenAI Execution Tools.
18
19
  *
@@ -25,6 +26,17 @@ export declare class OpenAiAssistantExecutionTools extends OpenAiExecutionTools
25
26
  * Calls OpenAI API to use a chat model.
26
27
  */
27
28
  callChatModel(prompt: Pick<Prompt, 'content' | 'parameters' | 'modelRequirements' | 'format'>): Promise<ChatPromptResult>;
29
+ createNewAssistant(): Promise<OpenAiAssistantExecutionTools>;
30
+ /**
31
+ * Discriminant for type guards
32
+ */
33
+ protected get discriminant(): string;
34
+ /**
35
+ * Type guard to check if given `LlmExecutionTools` are instanceof `OpenAiAssistantExecutionTools`
36
+ *
37
+ * Note: This is useful when you can possibly have multiple versions of `@promptbook/openai` installed
38
+ */
39
+ static isOpenAiAssistantExecutionTools(llmExecutionTools: LlmExecutionTools): llmExecutionTools is OpenAiAssistantExecutionTools;
28
40
  }
29
41
  /**
30
42
  * TODO: [🧠][🧙‍♂️] Maybe there can be some wizard for those who want to use just OpenAI
@@ -7,8 +7,14 @@ import type { OpenAiCompatibleExecutionToolsOptions } from './OpenAiCompatibleEx
7
7
  * @public exported from `@promptbook/openai`
8
8
  */
9
9
  export type OpenAiAssistantExecutionToolsOptions = OpenAiCompatibleExecutionToolsOptions & ClientOptions & {
10
+ /**
11
+ * Whether creating new assistants is allowed
12
+ *
13
+ * @default false
14
+ */
15
+ readonly isCreatingNewAssistantsAllowed?: boolean;
10
16
  /**
11
17
  * Which assistant to use
12
18
  */
13
- assistantId: string_token;
19
+ readonly assistantId: string_token;
14
20
  };
@@ -11,6 +11,8 @@ import type { RemoteServerOptions } from './types/RemoteServerOptions';
11
11
  */
12
12
  export declare function startRemoteServer<TCustomOptions = undefined>(options: RemoteServerOptions<TCustomOptions>): RemoteServer;
13
13
  /**
14
+ * TODO !!!! Add agent
15
+ * TODO: !!!! Allow to chat with agents directly via remote server
14
16
  * TODO: [🕋] Use here `aboutPromptbookInformation`
15
17
  * TODO: [🌡] Add CORS and security - probably via `helmet`
16
18
  * TODO: Split this file into multiple functions - handler for each request
@@ -0,0 +1,19 @@
1
+ import { BehaviorSubject } from 'rxjs';
2
+ /**
3
+ * A type that represents a value that can be updated over time:
4
+ *
5
+ * 1) It can be a static value of type `TValue`
6
+ * 2) Or a `BehaviorSubject` that emits values of type `TValue`
7
+ * 3) Or pair of `[getValue, setValue]` functions for getting and setting the value
8
+ */
9
+ export type Updatable<TValue> = TValue | BehaviorSubject<TValue> | [TValue, (value: TValue) => void];
10
+ /**
11
+ * Restricts an Updatable to a (2) BehaviorSubject variant
12
+ *
13
+ * @see Updatable
14
+ * @private internal utility <- TODO: [🧠] Maybe export from `@promptbook/types`
15
+ */
16
+ export declare function asUpdatableSubject<TValue>(value: Updatable<TValue>): BehaviorSubject<TValue>;
17
+ /**
18
+ * TODO: [🧠] Maybe `BehaviorSubject` is too heavy for this use case, maybe just tuple `[value,setValue]` is enough
19
+ */
@@ -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-34`).
18
+ * It follows semantic versioning (e.g., `0.103.0-36`).
19
19
  *
20
20
  * @generated
21
21
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promptbook/vercel",
3
- "version": "0.103.0-35",
3
+ "version": "0.103.0-37",
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-35"
97
+ "@promptbook/core": "0.103.0-37"
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-35';
26
+ const PROMPTBOOK_ENGINE_VERSION = '0.103.0-37';
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