@promptbook/javascript 0.110.0-2 → 0.110.0-4

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.
package/esm/index.es.js CHANGED
@@ -18,7 +18,7 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
18
18
  * @generated
19
19
  * @see https://github.com/webgptorg/promptbook
20
20
  */
21
- const PROMPTBOOK_ENGINE_VERSION = '0.110.0-2';
21
+ const PROMPTBOOK_ENGINE_VERSION = '0.110.0-4';
22
22
  /**
23
23
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
24
24
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -33,7 +33,6 @@ import type { SourceChipProps } from '../book-components/Chat/SourceChip/SourceC
33
33
  import type { ChatToolCall } from '../book-components/Chat/types/ChatMessage';
34
34
  import type { ChatMessage } from '../book-components/Chat/types/ChatMessage';
35
35
  import type { ChatParticipant } from '../book-components/Chat/types/ChatParticipant';
36
- import type { ToolCallChipletInfo } from '../book-components/Chat/utils/getToolCallChipletInfo';
37
36
  import type { ParsedCitation } from '../book-components/Chat/utils/parseCitationsFromContent';
38
37
  import type { MessageButton } from '../book-components/Chat/utils/parseMessageButtons';
39
38
  import type { TeamToolResult } from '../book-components/Chat/utils/toolCallParsing';
@@ -436,7 +435,6 @@ export type { SourceChipProps };
436
435
  export type { ChatToolCall };
437
436
  export type { ChatMessage };
438
437
  export type { ChatParticipant };
439
- export type { ToolCallChipletInfo };
440
438
  export type { ParsedCitation };
441
439
  export type { MessageButton };
442
440
  export type { TeamToolResult };
@@ -21,6 +21,10 @@ export type ChatActionsBarProps = {
21
21
  saveFormats?: Array<string_chat_format_name>;
22
22
  isSaveButtonEnabled: boolean;
23
23
  shouldFadeActions: boolean;
24
+ /**
25
+ * Disables action interactions while scroll is active.
26
+ */
27
+ shouldDisableActions: boolean;
24
28
  onButtonClick: (handler?: (event: MouseEvent<HTMLButtonElement>) => void) => (event: MouseEvent<HTMLButtonElement>) => void;
25
29
  soundSystem?: ChatSoundSystem;
26
30
  };
@@ -15,6 +15,10 @@ export type SourceChipProps = {
15
15
  * Additional CSS class name
16
16
  */
17
17
  className?: string;
18
+ /**
19
+ * Optional suffix text to display after the citation label.
20
+ */
21
+ suffix?: string;
18
22
  };
19
23
  /**
20
24
  * SourceChip component - displays a chip with source document information
@@ -32,4 +36,4 @@ export type SourceChipProps = {
32
36
  *
33
37
  * @private utility of `ChatMessageItem` component
34
38
  */
35
- export declare function SourceChip({ citation, onClick, className }: SourceChipProps): import("react/jsx-runtime").JSX.Element;
39
+ export declare function SourceChip({ citation, onClick, className, suffix }: SourceChipProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,69 @@
1
+ import { type ToolCall } from '../../../types/ToolCall';
2
+ import type { ParsedCitation } from './parseCitationsFromContent';
3
+ /**
4
+ * Origin metadata for a tool call or citation executed by a teammate.
5
+ *
6
+ * @private utility of `<Chat/>`
7
+ */
8
+ export type ToolCallOrigin = {
9
+ /**
10
+ * Human-readable label for the teammate.
11
+ */
12
+ label: string;
13
+ /**
14
+ * Optional teammate URL.
15
+ */
16
+ url?: string;
17
+ /**
18
+ * Optional tool name for the teammate.
19
+ */
20
+ toolName?: string;
21
+ };
22
+ /**
23
+ * Tool call data enriched with its teammate origin.
24
+ *
25
+ * @private utility of `<Chat/>`
26
+ */
27
+ export type TransitiveToolCall = {
28
+ /**
29
+ * Tool call executed by the teammate.
30
+ */
31
+ toolCall: ToolCall;
32
+ /**
33
+ * Teammate origin metadata for the tool call.
34
+ */
35
+ origin: ToolCallOrigin;
36
+ };
37
+ /**
38
+ * Citation data enriched with its teammate origin.
39
+ *
40
+ * @private utility of `<Chat/>`
41
+ */
42
+ export type TransitiveCitation = ParsedCitation & {
43
+ /**
44
+ * Teammate origin metadata for the citation.
45
+ */
46
+ origin: ToolCallOrigin;
47
+ };
48
+ /**
49
+ * Aggregated teammate tool calls and citations derived from TEAM tool results.
50
+ *
51
+ * @private utility of `<Chat/>`
52
+ */
53
+ export type TeamToolCallSummary = {
54
+ /**
55
+ * Tool calls executed by teammates, flattened transitively.
56
+ */
57
+ toolCalls: TransitiveToolCall[];
58
+ /**
59
+ * Citations referenced by teammates, flattened transitively.
60
+ */
61
+ citations: TransitiveCitation[];
62
+ };
63
+ /**
64
+ * Collects tool calls and citations from TEAM tool call results, resolving nested teammate chains.
65
+ *
66
+ * @param toolCalls - Tool calls from the top-level agent message.
67
+ * @private utility of `<Chat/>`
68
+ */
69
+ export declare function collectTeamToolCallSummary(toolCalls: ReadonlyArray<ToolCall> | undefined): TeamToolCallSummary;
@@ -1,10 +1,9 @@
1
1
  import { type ToolCall } from '../../../types/ToolCall';
2
2
  import type { AgentChipData } from '../AgentChip';
3
- /**
4
- * Utility to format tool call information for user-friendly display.
5
- */
6
3
  /**
7
4
  * Tool call chiplet information including agent data for team tools
5
+ *
6
+ * @private utility of `<Chat/>`
8
7
  */
9
8
  export type ToolCallChipletInfo = {
10
9
  /**
@@ -22,10 +21,19 @@ export type ToolCallChipletInfo = {
22
21
  */
23
22
  wrapInBrackets?: boolean;
24
23
  };
24
+ /**
25
+ * Builds display text for a tool call chiplet.
26
+ *
27
+ * @param chipletInfo - Chiplet metadata for the tool call.
28
+ *
29
+ * @private utility of `<Chat/>`
30
+ */
31
+ export declare function buildToolCallChipText(chipletInfo: ToolCallChipletInfo): string;
25
32
  /**
26
33
  * Technical to user-friendly tool names and emojis
27
34
  *
28
- * @private [🧠] Maybe public?
35
+ * @private utility of `<Chat/>` [🧠] Maybe public?
36
+ *
29
37
  */
30
38
  export declare const TOOL_TITLES: Record<string, {
31
39
  title: string;
@@ -39,6 +39,15 @@ export declare function parseCitationsFromContent(content: string): ParsedCitati
39
39
  * @private utility for internal use
40
40
  */
41
41
  export declare function stripCitationsFromContent(content: string): string;
42
+ /**
43
+ * Deduplicates citations by source while preserving the first-seen order.
44
+ *
45
+ * @param citations - Parsed citations to deduplicate.
46
+ * @returns Deduplicated citations in original order.
47
+ *
48
+ * @private utility for internal use
49
+ */
50
+ export declare function dedupeCitationsBySource(citations: ReadonlyArray<ParsedCitation>): ParsedCitation[];
42
51
  /**
43
52
  * Extracts citations from a chat message if not already present
44
53
  *
@@ -25,6 +25,10 @@ export type TeamToolResult = {
25
25
  };
26
26
  request?: string;
27
27
  response?: string;
28
+ /**
29
+ * Tool calls executed by the teammate while answering.
30
+ */
31
+ toolCalls?: ReadonlyArray<ToolCall>;
28
32
  error?: string | null;
29
33
  conversation?: Array<{
30
34
  sender?: string;
@@ -13,6 +13,15 @@ export type AgentOptions = CommonToolsOptions & {
13
13
  * Here the agent has access to various LLM models, browser, scrapers, LibreOffice, tools, etc.
14
14
  */
15
15
  executionTools: ExecutionTools;
16
+ /**
17
+ * How to manage OpenAI assistant preparation when using OpenAiAssistantExecutionTools.
18
+ *
19
+ * Use `external` when an external cache manager already created the assistant and
20
+ * the agent should use it as-is.
21
+ *
22
+ * @default internal
23
+ */
24
+ assistantPreparationMode?: 'internal' | 'external';
16
25
  /**
17
26
  * The source of the agent
18
27
  */
@@ -10,6 +10,15 @@ export type CreateAgentLlmExecutionToolsOptions = CommonToolsOptions & {
10
10
  * The underlying LLM execution tools to wrap
11
11
  */
12
12
  llmTools: LlmExecutionTools | OpenAiAssistantExecutionTools;
13
+ /**
14
+ * How to manage OpenAI assistant preparation when using OpenAiAssistantExecutionTools.
15
+ *
16
+ * Use `external` when an external cache manager already created the assistant and
17
+ * the agent should use it as-is.
18
+ *
19
+ * @default internal
20
+ */
21
+ assistantPreparationMode?: 'internal' | 'external';
13
22
  /**
14
23
  * The agent source string that defines the agent's behavior
15
24
  */
@@ -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;
@@ -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-1`).
18
+ * It follows semantic versioning (e.g., `0.110.0-2`).
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-2",
3
+ "version": "0.110.0-4",
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/javascript.index.d.ts",
96
96
  "peerDependencies": {
97
- "@promptbook/core": "0.110.0-2"
97
+ "@promptbook/core": "0.110.0-4"
98
98
  },
99
99
  "dependencies": {
100
100
  "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-2';
25
+ const PROMPTBOOK_ENGINE_VERSION = '0.110.0-4';
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