@promptbook/javascript 0.110.0-1 → 0.110.0-11

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 (54) hide show
  1. package/esm/index.es.js +1 -1
  2. package/esm/index.es.js.map +1 -1
  3. package/esm/typings/src/_packages/components.index.d.ts +4 -0
  4. package/esm/typings/src/_packages/core.index.d.ts +2 -2
  5. package/esm/typings/src/_packages/openai.index.d.ts +8 -4
  6. package/esm/typings/src/_packages/types.index.d.ts +12 -4
  7. package/esm/typings/src/book-2.0/agent-source/AgentModelRequirements.d.ts +22 -21
  8. package/esm/typings/src/book-2.0/agent-source/AgentReferenceResolver.d.ts +18 -0
  9. package/esm/typings/src/book-2.0/agent-source/CreateAgentModelRequirementsOptions.d.ts +12 -0
  10. package/esm/typings/src/book-2.0/agent-source/createAgentModelRequirements.d.ts +8 -2
  11. package/esm/typings/src/book-2.0/agent-source/createAgentModelRequirementsWithCommitments.agentReferenceResolver.test.d.ts +1 -0
  12. package/esm/typings/src/book-2.0/agent-source/createAgentModelRequirementsWithCommitments.d.ts +4 -5
  13. package/esm/typings/src/book-components/Chat/AgentChip/AgentChip.d.ts +5 -1
  14. package/esm/typings/src/book-components/Chat/Chat/ChatActionsBar.d.ts +4 -2
  15. package/esm/typings/src/book-components/Chat/Chat/ChatInputArea.d.ts +1 -0
  16. package/esm/typings/src/book-components/Chat/Chat/ChatMessageItem.d.ts +4 -0
  17. package/esm/typings/src/book-components/Chat/Chat/ChatMessageList.d.ts +1 -0
  18. package/esm/typings/src/book-components/Chat/Chat/ChatProps.d.ts +15 -0
  19. package/esm/typings/src/book-components/Chat/Chat/ChatSoundToggle.d.ts +31 -0
  20. package/esm/typings/src/book-components/Chat/LlmChat/LlmChatProps.d.ts +10 -1
  21. package/esm/typings/src/book-components/Chat/SourceChip/SourceChip.d.ts +5 -1
  22. package/esm/typings/src/book-components/Chat/utils/collectTeamToolCallSummary.d.ts +69 -0
  23. package/esm/typings/src/book-components/Chat/utils/getToolCallChipletInfo.d.ts +13 -13
  24. package/esm/typings/src/book-components/Chat/utils/parseCitationsFromContent.d.ts +9 -0
  25. package/esm/typings/src/book-components/Chat/utils/toolCallParsing.d.ts +4 -0
  26. package/esm/typings/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentsDatabaseSchema.d.ts +0 -3
  27. package/esm/typings/src/commitments/_base/BaseCommitmentDefinition.d.ts +9 -0
  28. package/esm/typings/src/execution/LlmExecutionTools.d.ts +2 -1
  29. package/esm/typings/src/llm-providers/agent/Agent.d.ts +1 -1
  30. package/esm/typings/src/llm-providers/agent/AgentLlmExecutionTools.d.ts +5 -1
  31. package/esm/typings/src/llm-providers/agent/AgentLlmExecutionTools.test.d.ts +1 -0
  32. package/esm/typings/src/llm-providers/agent/AgentOptions.d.ts +10 -0
  33. package/esm/typings/src/llm-providers/agent/CreateAgentLlmExecutionToolsOptions.d.ts +13 -2
  34. package/esm/typings/src/llm-providers/agent/RemoteAgent.d.ts +2 -1
  35. package/esm/typings/src/llm-providers/openai/OpenAiAgentKitExecutionTools.d.ts +150 -0
  36. package/esm/typings/src/llm-providers/openai/OpenAiAgentKitExecutionToolsOptions.d.ts +15 -0
  37. package/esm/typings/src/llm-providers/openai/OpenAiAssistantExecutionTools.d.ts +3 -3
  38. package/esm/typings/src/llm-providers/openai/OpenAiAssistantExecutionToolsOptions.d.ts +3 -4
  39. package/esm/typings/src/llm-providers/openai/OpenAiVectorStoreHandler.d.ts +135 -0
  40. package/esm/typings/src/llm-providers/openai/utils/mapToolsToOpenAi.d.ts +1 -1
  41. package/esm/typings/src/types/LlmToolDefinition.d.ts +1 -0
  42. package/esm/typings/src/types/ModelRequirements.d.ts +9 -0
  43. package/esm/typings/src/utils/DEFAULT_THINKING_MESSAGES.d.ts +8 -0
  44. package/esm/typings/src/utils/agents/resolveAgentAvatarImageUrl.d.ts +29 -0
  45. package/esm/typings/src/utils/knowledge/inlineKnowledgeSource.d.ts +38 -0
  46. package/esm/typings/src/utils/knowledge/inlineKnowledgeSource.test.d.ts +1 -0
  47. package/esm/typings/src/utils/language/getBrowserPreferredSpeechRecognitionLanguage.d.ts +35 -0
  48. package/esm/typings/src/utils/toolCalls/getToolCallIdentity.d.ts +10 -0
  49. package/esm/typings/src/version.d.ts +1 -1
  50. package/package.json +5 -2
  51. package/umd/index.umd.js +1 -1
  52. package/umd/index.umd.js.map +1 -1
  53. package/esm/typings/src/llm-providers/openai/OpenAiAgentExecutionTools.d.ts +0 -43
  54. package/esm/typings/src/llm-providers/openai/createOpenAiAgentExecutionTools.d.ts +0 -11
@@ -0,0 +1,150 @@
1
+ import { Agent as AgentFromKit } from '@openai/agents';
2
+ import OpenAI from 'openai';
3
+ import { TODO_any } from '../../_packages/types.index';
4
+ import type { LlmExecutionTools } from '../../execution/LlmExecutionTools';
5
+ import type { ChatPromptResult } from '../../execution/PromptResult';
6
+ import type { ModelRequirements } from '../../types/ModelRequirements';
7
+ import type { Prompt } from '../../types/Prompt';
8
+ import type { string_markdown, string_markdown_text, string_title } from '../../types/typeAliases';
9
+ import type { OpenAiAgentKitExecutionToolsOptions } from './OpenAiAgentKitExecutionToolsOptions';
10
+ import { OpenAiVectorStoreHandler } from './OpenAiVectorStoreHandler';
11
+ /**
12
+ * Represents the AgentKit output configuration used to match OpenAI `response_format` expectations.
13
+ *
14
+ * @private utility of Open AI
15
+ */
16
+ export type AgentOutputType = 'text' | JsonSchemaDefinition;
17
+ type JsonSchemaDefinitionEntry = {
18
+ type?: string;
19
+ description?: string;
20
+ properties?: Record<string, JsonSchemaDefinitionEntry>;
21
+ required?: Array<string>;
22
+ items?: JsonSchemaDefinitionEntry;
23
+ [key: string]: TODO_any;
24
+ };
25
+ type JsonSchemaDefinition = {
26
+ type: 'json_schema';
27
+ name: string;
28
+ strict: boolean;
29
+ schema: {
30
+ type: 'object';
31
+ properties: Record<string, JsonSchemaDefinitionEntry>;
32
+ required: Array<string>;
33
+ additionalProperties: boolean;
34
+ description?: string;
35
+ };
36
+ };
37
+ type OpenAiChatResponseFormat = OpenAI.Chat.Completions.ChatCompletionCreateParamsNonStreaming['response_format'];
38
+ /**
39
+ * Maps OpenAI `response_format` payloads to AgentKit output types so the runner can forward
40
+ * structured-output preferences to OpenAI while still reusing the same AgentKit agent instance.
41
+ *
42
+ * @param responseFormat - The OpenAI `response_format` payload from the user request.
43
+ * @returns An Agent output type compatible with the requested schema or `undefined` when no impact is required.
44
+ * @private utility of Open AI
45
+ */
46
+ export declare function mapResponseFormatToAgentOutputType(responseFormat?: OpenAiChatResponseFormat): AgentOutputType | undefined;
47
+ /**
48
+ * Alias for OpenAI AgentKit agent to avoid naming confusion with Promptbook agents.
49
+ */
50
+ type OpenAiAgentKitAgent = AgentFromKit;
51
+ /**
52
+ * Prepared AgentKit agent details.
53
+ */
54
+ type OpenAiAgentKitPreparedAgent = {
55
+ readonly agent: OpenAiAgentKitAgent;
56
+ readonly vectorStoreId?: string;
57
+ };
58
+ /**
59
+ * Execution tools for OpenAI AgentKit (Agents SDK).
60
+ *
61
+ * @public exported from `@promptbook/openai`
62
+ */
63
+ export declare class OpenAiAgentKitExecutionTools extends OpenAiVectorStoreHandler implements LlmExecutionTools {
64
+ private preparedAgentKitAgent;
65
+ private readonly agentKitModelName;
66
+ /**
67
+ * Creates OpenAI AgentKit execution tools.
68
+ */
69
+ constructor(options: OpenAiAgentKitExecutionToolsOptions);
70
+ get title(): string_title & string_markdown_text;
71
+ get description(): string_markdown;
72
+ /**
73
+ * Calls OpenAI AgentKit with a chat prompt (non-streaming).
74
+ */
75
+ callChatModel(prompt: Prompt): Promise<ChatPromptResult>;
76
+ /**
77
+ * Calls OpenAI AgentKit with a chat prompt (streaming).
78
+ */
79
+ callChatModelStream(prompt: Prompt, onProgress: (chunk: ChatPromptResult) => void): Promise<ChatPromptResult>;
80
+ /**
81
+ * Returns a prepared AgentKit agent when the server wants to manage caching externally.
82
+ */
83
+ getPreparedAgentKitAgent(): OpenAiAgentKitPreparedAgent | null;
84
+ /**
85
+ * Stores a prepared AgentKit agent for later reuse by external cache managers.
86
+ */
87
+ setPreparedAgentKitAgent(preparedAgent: OpenAiAgentKitPreparedAgent): void;
88
+ /**
89
+ * Creates a new tools instance bound to a prepared AgentKit agent.
90
+ */
91
+ getPreparedAgentTools(preparedAgent: OpenAiAgentKitPreparedAgent): OpenAiAgentKitExecutionTools;
92
+ /**
93
+ * Prepares an AgentKit agent with optional knowledge sources and tool definitions.
94
+ */
95
+ prepareAgentKitAgent(options: {
96
+ readonly name: string_title;
97
+ readonly instructions: string_markdown;
98
+ readonly knowledgeSources?: ReadonlyArray<string>;
99
+ readonly tools?: ModelRequirements['tools'];
100
+ readonly vectorStoreId?: string;
101
+ readonly storeAsPrepared?: boolean;
102
+ }): Promise<OpenAiAgentKitPreparedAgent>;
103
+ /**
104
+ * Ensures the AgentKit SDK is wired to the OpenAI client and API key.
105
+ */
106
+ private ensureAgentKitDefaults;
107
+ /**
108
+ * Builds the tool list for AgentKit, including hosted file search when applicable.
109
+ */
110
+ private buildAgentKitTools;
111
+ /**
112
+ * Resolves the configured script tools for tool execution.
113
+ */
114
+ private resolveScriptTools;
115
+ /**
116
+ * Runs a prepared AgentKit agent and streams results back to the caller.
117
+ */
118
+ callChatModelStreamWithPreparedAgent(options: {
119
+ readonly openAiAgentKitAgent: OpenAiAgentKitAgent;
120
+ readonly prompt: Prompt;
121
+ readonly rawPromptContent?: string;
122
+ readonly onProgress: (chunk: ChatPromptResult) => void;
123
+ readonly responseFormatOutputType?: AgentOutputType;
124
+ }): Promise<ChatPromptResult>;
125
+ /**
126
+ * Builds AgentKit input items from the prompt and optional thread.
127
+ */
128
+ private buildAgentKitInputItems;
129
+ /**
130
+ * Builds the user message content for AgentKit runs, including file inputs when provided.
131
+ */
132
+ private buildAgentKitUserContent;
133
+ /**
134
+ * Normalizes AgentKit tool outputs into a string for Promptbook tool call results.
135
+ */
136
+ private formatAgentKitToolOutput;
137
+ /**
138
+ * Returns AgentKit-specific options.
139
+ */
140
+ private get agentKitOptions();
141
+ /**
142
+ * Discriminant for type guards.
143
+ */
144
+ protected get discriminant(): string;
145
+ /**
146
+ * Type guard to check if given `LlmExecutionTools` are instanceof `OpenAiAgentKitExecutionTools`.
147
+ */
148
+ static isOpenAiAgentKitExecutionTools(llmExecutionTools: LlmExecutionTools): llmExecutionTools is OpenAiAgentKitExecutionTools;
149
+ }
150
+ export {};
@@ -0,0 +1,15 @@
1
+ import type { string_model_name } from '../../types/typeAliases';
2
+ import type { OpenAiVectorStoreHandlerOptions } from './OpenAiVectorStoreHandler';
3
+ /**
4
+ * Options for `OpenAiAgentKitExecutionTools`.
5
+ *
6
+ * @public exported from `@promptbook/openai`
7
+ */
8
+ export type OpenAiAgentKitExecutionToolsOptions = OpenAiVectorStoreHandlerOptions & {
9
+ /**
10
+ * Base model name used for AgentKit agents.
11
+ *
12
+ * @default gpt-5.2
13
+ */
14
+ readonly agentKitModelName?: string_model_name;
15
+ };
@@ -4,7 +4,7 @@ import type { ModelRequirements } from '../../types/ModelRequirements';
4
4
  import type { Prompt } from '../../types/Prompt';
5
5
  import type { string_markdown, string_markdown_text, string_title, string_token } from '../../types/typeAliases';
6
6
  import type { OpenAiAssistantExecutionToolsOptions } from './OpenAiAssistantExecutionToolsOptions';
7
- import { OpenAiExecutionTools } from './OpenAiExecutionTools';
7
+ import { OpenAiVectorStoreHandler } from './OpenAiVectorStoreHandler';
8
8
  /**
9
9
  * Execution Tools for calling OpenAI API Assistants
10
10
  *
@@ -17,10 +17,10 @@ import { OpenAiExecutionTools } from './OpenAiExecutionTools';
17
17
  * - `OpenAiAssistantExecutionTools` - which is a specific implementation of `LlmExecutionTools` for OpenAI models with assistant capabilities, recommended for usage in `Agent` or `AgentLlmExecutionTools`
18
18
  * - `RemoteAgent` - which is an `Agent` that connects to a Promptbook Agents Server
19
19
  *
20
+ * @deprecated Use `OpenAiAgentKitExecutionTools` instead.
20
21
  * @public exported from `@promptbook/openai`
21
- * @deprecated Use `OpenAiAgentExecutionTools` instead which uses the new OpenAI Responses API
22
22
  */
23
- export declare class OpenAiAssistantExecutionTools extends OpenAiExecutionTools implements LlmExecutionTools {
23
+ export declare class OpenAiAssistantExecutionTools extends OpenAiVectorStoreHandler implements LlmExecutionTools {
24
24
  readonly assistantId: string_token;
25
25
  private readonly isCreatingNewAssistantsAllowed;
26
26
  /**
@@ -1,18 +1,17 @@
1
- import type { ClientOptions } from 'openai';
2
1
  import type { string_token } from '../../types/typeAliases';
3
- import type { OpenAiCompatibleExecutionToolsOptions } from './OpenAiCompatibleExecutionToolsOptions';
2
+ import type { OpenAiVectorStoreHandlerOptions } from './OpenAiVectorStoreHandler';
4
3
  /**
5
4
  * Options for `createOpenAiAssistantExecutionTools` and `OpenAiAssistantExecutionTools`
6
5
  *
7
6
  * @public exported from `@promptbook/openai`
8
7
  */
9
- export type OpenAiAssistantExecutionToolsOptions = OpenAiCompatibleExecutionToolsOptions & ClientOptions & {
8
+ export type OpenAiAssistantExecutionToolsOptions = OpenAiVectorStoreHandlerOptions & {
10
9
  /**
11
10
  * Whether creating new assistants is allowed
12
11
  *
13
12
  * @default false
14
13
  */
15
- readonly isCreatingNewAssistantsAllowed?: boolean;
14
+ readonly isCreatingNewAssistantsAllowed: boolean;
16
15
  /**
17
16
  * Which assistant to use
18
17
  */
@@ -0,0 +1,135 @@
1
+ import type { ClientOptions } from 'openai';
2
+ import OpenAI from 'openai';
3
+ import { TODO_any } from '../../_packages/types.index';
4
+ import type { string_title } from '../../types/typeAliases';
5
+ import type { OpenAiCompatibleExecutionToolsOptions } from './OpenAiCompatibleExecutionToolsOptions';
6
+ import { OpenAiExecutionTools } from './OpenAiExecutionTools';
7
+ /**
8
+ * Metadata for uploaded knowledge source files used for vector store diagnostics.
9
+ */
10
+ type KnowledgeSourceUploadMetadata = {
11
+ readonly fileId: string;
12
+ readonly filename: string;
13
+ readonly sizeBytes?: number;
14
+ };
15
+ /**
16
+ * Shared options for OpenAI vector store handling.
17
+ *
18
+ * @public exported from `@promptbook/openai`
19
+ */
20
+ export type OpenAiVectorStoreHandlerOptions = OpenAiCompatibleExecutionToolsOptions & ClientOptions & {
21
+ /**
22
+ * Per-knowledge-source download timeout in milliseconds when preparing vector stores.
23
+ *
24
+ * @default 30000
25
+ */
26
+ readonly knowledgeSourceDownloadTimeoutMs?: number;
27
+ /**
28
+ * Max concurrency for uploading knowledge source files to the vector store.
29
+ *
30
+ * @default 5
31
+ */
32
+ readonly knowledgeSourceUploadMaxConcurrency?: number;
33
+ /**
34
+ * Poll interval in milliseconds when waiting for vector store file batch processing.
35
+ *
36
+ * @default 5000
37
+ */
38
+ readonly knowledgeSourceUploadPollIntervalMs?: number;
39
+ /**
40
+ * Overall timeout in milliseconds for vector store file batch processing.
41
+ *
42
+ * @default 900000
43
+ */
44
+ readonly knowledgeSourceUploadTimeoutMs?: number;
45
+ /**
46
+ * Whether we should continue even if vector store ingestion stalls.
47
+ *
48
+ * @default true
49
+ */
50
+ readonly shouldContinueOnVectorStoreStall?: boolean;
51
+ };
52
+ /**
53
+ * Base class for OpenAI execution tools that need hosted vector stores.
54
+ *
55
+ * @public exported from `@promptbook/openai`
56
+ */
57
+ export declare abstract class OpenAiVectorStoreHandler extends OpenAiExecutionTools {
58
+ /**
59
+ * Returns the per-knowledge-source download timeout in milliseconds.
60
+ */
61
+ protected getKnowledgeSourceDownloadTimeoutMs(): number;
62
+ /**
63
+ * Returns the max concurrency for knowledge source uploads.
64
+ */
65
+ protected getKnowledgeSourceUploadMaxConcurrency(): number;
66
+ /**
67
+ * Returns the polling interval in milliseconds for vector store uploads.
68
+ */
69
+ protected getKnowledgeSourceUploadPollIntervalMs(): number;
70
+ /**
71
+ * Returns the overall upload timeout in milliseconds for vector store uploads.
72
+ */
73
+ protected getKnowledgeSourceUploadTimeoutMs(): number;
74
+ /**
75
+ * Returns true if we should continue even if vector store ingestion stalls.
76
+ */
77
+ protected shouldContinueOnVectorStoreStall(): boolean;
78
+ /**
79
+ * Returns vector-store-specific options with extended settings.
80
+ */
81
+ protected get vectorStoreOptions(): OpenAiVectorStoreHandlerOptions;
82
+ /**
83
+ * Returns the OpenAI vector stores API surface, supporting stable and beta SDKs.
84
+ */
85
+ protected getVectorStoresApi(client: OpenAI): TODO_any;
86
+ /**
87
+ * Downloads a knowledge source URL into a File for vector store upload.
88
+ */
89
+ protected downloadKnowledgeSourceFile(options: {
90
+ readonly source: string;
91
+ readonly timeoutMs: number;
92
+ readonly logLabel: string;
93
+ }): Promise<{
94
+ readonly file: File;
95
+ readonly sizeBytes: number;
96
+ readonly filename: string;
97
+ readonly elapsedMs: number;
98
+ } | null>;
99
+ /**
100
+ * Logs vector store file batch diagnostics to help trace ingestion stalls or failures.
101
+ */
102
+ protected logVectorStoreFileBatchDiagnostics(options: {
103
+ readonly client: OpenAI;
104
+ readonly vectorStoreId: string;
105
+ readonly batchId: string;
106
+ readonly uploadedFiles: ReadonlyArray<KnowledgeSourceUploadMetadata>;
107
+ readonly logLabel: string;
108
+ readonly reason: 'stalled' | 'timeout' | 'failed';
109
+ }): Promise<void>;
110
+ /**
111
+ * Uploads knowledge source files to the vector store and polls until processing completes.
112
+ */
113
+ protected uploadKnowledgeSourceFilesToVectorStore(options: {
114
+ readonly client: OpenAI;
115
+ readonly vectorStoreId: string;
116
+ readonly files: ReadonlyArray<File>;
117
+ readonly totalBytes: number;
118
+ readonly logLabel: string;
119
+ }): Promise<TODO_any | null>;
120
+ /**
121
+ * Creates a vector store and uploads knowledge sources, returning its ID.
122
+ */
123
+ protected createVectorStoreWithKnowledgeSources(options: {
124
+ readonly client: OpenAI;
125
+ readonly name: string_title;
126
+ readonly knowledgeSources: ReadonlyArray<string>;
127
+ readonly logLabel: string;
128
+ }): Promise<{
129
+ readonly vectorStoreId: string;
130
+ readonly uploadedFileCount: number;
131
+ readonly skippedCount: number;
132
+ readonly totalBytes: number;
133
+ }>;
134
+ }
135
+ export {};
@@ -5,4 +5,4 @@ import type { LlmToolDefinition } from '../../../types/LlmToolDefinition';
5
5
  *
6
6
  * @private
7
7
  */
8
- export declare function mapToolsToOpenAi(tools: ReadonlyArray<LlmToolDefinition>): Array<OpenAI.Chat.Completions.ChatCompletionTool>;
8
+ export declare function mapToolsToOpenAi(tools: ReadonlyArray<LlmToolDefinition>): Array<OpenAI.Chat.Completions.ChatCompletionTool & OpenAI.Beta.AssistantTool>;
@@ -23,5 +23,6 @@ export type LlmToolDefinition = {
23
23
  description?: string;
24
24
  }>;
25
25
  readonly required?: string[];
26
+ readonly additionalProperties?: boolean;
26
27
  };
27
28
  };
@@ -1,6 +1,7 @@
1
1
  import type { LlmToolDefinition } from './LlmToolDefinition';
2
2
  import type { ModelVariant } from './ModelVariant';
3
3
  import type { number_model_temperature, number_seed, string_model_name, string_system_message } from './typeAliases';
4
+ import type OpenAI from 'openai';
4
5
  /**
5
6
  * Abstract way to specify the LLM.
6
7
  * It does not specify the LLM with concrete version itself, only the requirements for the LLM.
@@ -54,6 +55,14 @@ export type ChatModelRequirements = CommonModelRequirements & {
54
55
  * Maximum number of tokens that can be generated by the model
55
56
  */
56
57
  readonly maxTokens?: number;
58
+ /**
59
+ * Optional OpenAI `response_format` override that should be forwarded to compatible APIs.
60
+ */
61
+ readonly responseFormat?: OpenAI.Chat.Completions.ChatCompletionCreateParamsNonStreaming['response_format'];
62
+ /**
63
+ * Optional OpenAI `tool_choice` override that should be forwarded to compatible APIs.
64
+ */
65
+ readonly toolChoice?: OpenAI.Chat.Completions.ChatCompletionToolChoiceOption;
57
66
  };
58
67
  /**
59
68
  * Model requirements for the image generation variant
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Default placeholder variants shown when an agent is still composing a response.
3
+ *
4
+ * @private BUT maybe export via some package
5
+ */
6
+ export declare const DEFAULT_THINKING_MESSAGES: readonly ["Thinking...", "Searching for information...", "Sorting information..."];
7
+ /** @internal */
8
+ export type ThinkingMessageVariant = (typeof DEFAULT_THINKING_MESSAGES)[number];
@@ -0,0 +1,29 @@
1
+ import type { AgentBasicInformation } from '../../book-2.0/agent-source/AgentBasicInformation';
2
+ import type { string_url, string_url_image } from '../../types/typeAliases';
3
+ /**
4
+ * Options for resolving agent avatar URLs.
5
+ *
6
+ * @private utility of `<Chat/>`
7
+ */
8
+ export type ResolveAgentAvatarImageUrlOptions = {
9
+ /**
10
+ * Agent metadata used for avatar resolution.
11
+ */
12
+ readonly agent: Pick<AgentBasicInformation, 'agentName' | 'permanentId' | 'meta'>;
13
+ /**
14
+ * Optional base URL used to resolve relative meta images and placeholders.
15
+ */
16
+ readonly baseUrl?: string_url;
17
+ };
18
+ /**
19
+ * Resolve the fallback avatar URL for an agent.
20
+ *
21
+ * @private utility of `<Chat/>`
22
+ */
23
+ export declare function resolveAgentAvatarFallbackUrl(options: ResolveAgentAvatarImageUrlOptions): string_url_image | null;
24
+ /**
25
+ * Resolve the best avatar URL for an agent, preferring META IMAGE and falling back to placeholders.
26
+ *
27
+ * @private utility of `<Chat/>`
28
+ */
29
+ export declare function resolveAgentAvatarImageUrl(options: ResolveAgentAvatarImageUrlOptions): string_url_image | null;
@@ -0,0 +1,38 @@
1
+ /// <reference types="node" />
2
+ /// <reference types="node" />
3
+ import type { string_data_url, string_filename } from '../../types/typeAliases';
4
+ /**
5
+ * @@@
6
+ *
7
+ * @private thing of inline knowledge
8
+ */
9
+ export type InlineKnowledgeSourceFile = {
10
+ readonly filename: string_filename;
11
+ readonly mimeType: string;
12
+ readonly url: string_data_url;
13
+ };
14
+ /**
15
+ * Creates a data URL that represents the inline knowledge content as a text file.
16
+ *
17
+ * @private thing of inline knowledge
18
+ */
19
+ export declare function createInlineKnowledgeSourceFile(content: string): InlineKnowledgeSourceFile;
20
+ /**
21
+ * Checks whether the provided source string is a data URL that can be decoded.
22
+ *
23
+ * @private thing of inline knowledge
24
+ */
25
+ export declare function isDataUrlKnowledgeSource(source: string): source is string_data_url;
26
+ /**
27
+ * Parses a data URL-based knowledge source into its raw buffer, filename, and MIME type.
28
+ *
29
+ * @private thing of inline knowledge
30
+ */
31
+ export declare function parseDataUrlKnowledgeSource(source: string): {
32
+ readonly buffer: Buffer;
33
+ readonly filename: string_filename;
34
+ readonly mimeType: string;
35
+ } | null;
36
+ /**
37
+ * Note: [💞] Ignore a discrepancy between file name and entity name
38
+ */
@@ -0,0 +1,35 @@
1
+ /**
2
+ * @@@
3
+ *
4
+ * @private function of Agents Server speech recognition language resolution, not a general-purpose utility
5
+ */
6
+ type ResolveSpeechRecognitionLanguageOptions = {
7
+ /**
8
+ * Overrides the default language resolution when provided.
9
+ */
10
+ readonly overrideLanguage?: string | null;
11
+ /**
12
+ * Optional Accept-Language header string to derive the speaker language from server-side requests.
13
+ */
14
+ readonly acceptLanguageHeader?: string | null;
15
+ };
16
+ /**
17
+ * Parses the primary language out of an Accept-Language header value.
18
+ *
19
+ * @private function of Agents Server speech recognition language resolution, not a general-purpose utility
20
+ */
21
+ export declare function parseSpeechRecognitionLanguageFromAcceptLanguageHeader(header?: string | null): string | undefined;
22
+ /**
23
+ * Reads the browser-reported preferred language list and returns the first valid tag.
24
+ *
25
+ * @private function of Agents Server speech recognition language resolution, not a general-purpose utility
26
+ */
27
+ export declare function getBrowserPreferredSpeechRecognitionLanguage(): string | undefined;
28
+ /**
29
+ * Resolves a speech recognition language tag by checking an optional override, then the Accept-Language header,
30
+ * then the browser preferences, and finally falling back to a default of `en-US`.
31
+ *
32
+ * @private function of Agents Server speech recognition language resolution, not a general-purpose utility
33
+ */
34
+ export declare function resolveSpeechRecognitionLanguage(options?: ResolveSpeechRecognitionLanguageOptions): string;
35
+ export {};
@@ -0,0 +1,10 @@
1
+ import type { ToolCall } from '../../types/ToolCall';
2
+ /**
3
+ * Builds a stable identity string for tool calls across partial updates.
4
+ *
5
+ * @param toolCall - Tool call entry to identify.
6
+ * @returns Stable identity string for deduplication.
7
+ *
8
+ * @private function of <Chat/>
9
+ */
10
+ export declare function getToolCallIdentity(toolCall: ToolCall): string;
@@ -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.110.0-0`).
18
+ * It follows semantic versioning (e.g., `0.110.0-10`).
19
19
  *
20
20
  * @generated
21
21
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promptbook/javascript",
3
- "version": "0.110.0-1",
3
+ "version": "0.110.0-11",
4
4
  "description": "Promptbook: Turn your company's scattered knowledge into AI ready books",
5
5
  "private": false,
6
6
  "sideEffects": false,
@@ -90,11 +90,14 @@
90
90
  "node": ">=18.18.0",
91
91
  "npm": ">=8.0.0"
92
92
  },
93
+ "overrides": {
94
+ "zod": "$zod"
95
+ },
93
96
  "main": "./umd/index.umd.js",
94
97
  "module": "./esm/index.es.js",
95
98
  "typings": "./esm/typings/src/_packages/javascript.index.d.ts",
96
99
  "peerDependencies": {
97
- "@promptbook/core": "0.110.0-1"
100
+ "@promptbook/core": "0.110.0-11"
98
101
  },
99
102
  "dependencies": {
100
103
  "crypto": "1.0.1",
package/umd/index.umd.js CHANGED
@@ -22,7 +22,7 @@
22
22
  * @generated
23
23
  * @see https://github.com/webgptorg/promptbook
24
24
  */
25
- const PROMPTBOOK_ENGINE_VERSION = '0.110.0-1';
25
+ const PROMPTBOOK_ENGINE_VERSION = '0.110.0-11';
26
26
  /**
27
27
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
28
28
  * Note: [💞] Ignore a discrepancy between file name and entity name