@promptbook/remote-server 0.112.0-126 → 0.112.0-128
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/README.md +5 -5
- package/esm/index.es.js +221 -51
- package/esm/index.es.js.map +1 -1
- package/esm/src/_packages/components.index.d.ts +2 -0
- package/esm/src/_packages/types.index.d.ts +2 -0
- package/esm/src/avatars/avatarAnimationScheduler.d.ts +4 -0
- package/esm/src/book-components/Chat/Chat/ChatCitationModal.d.ts +2 -0
- package/esm/src/book-components/Chat/Chat/ChatMessageItem.d.ts +4 -0
- package/esm/src/book-components/Chat/Chat/ChatMessageList.d.ts +4 -0
- package/esm/src/book-components/Chat/Chat/ChatProps.d.ts +5 -0
- package/esm/src/book-components/Chat/Chat/ChatToolCallModal.d.ts +2 -0
- package/esm/src/book-components/Chat/Chat/ChatToolCallModalContent.d.ts +3 -1
- package/esm/src/book-components/Chat/Chat/TeamToolCallModalContent.d.ts +2 -0
- package/esm/src/book-components/Chat/SourceChip/SourceChip.d.ts +6 -1
- package/esm/src/book-components/Chat/hooks/useResolvedCitationLabel.d.ts +12 -0
- package/esm/src/book-components/Chat/types/ChatMessage.d.ts +4 -0
- package/esm/src/book-components/Chat/types/ChatParticipant.d.ts +1 -1
- package/esm/src/book-components/Chat/types/CitationLabelResolver.d.ts +8 -0
- package/esm/src/book-components/Chat/utils/citationHelpers.d.ts +9 -0
- package/esm/src/book-components/Chat/utils/decodeJsonUnicodeEscapesInMarkdownText.d.ts +14 -0
- package/esm/src/book-components/Chat/utils/decodeJsonUnicodeEscapesInMarkdownText.test.d.ts +1 -0
- package/esm/src/book-components/Chat/utils/parseCitationsFromContent.d.ts +4 -0
- package/esm/src/version.d.ts +1 -1
- package/package.json +2 -2
- package/umd/index.umd.js +221 -51
- package/umd/index.umd.js.map +1 -1
- package/umd/src/_packages/components.index.d.ts +2 -0
- package/umd/src/_packages/types.index.d.ts +2 -0
- package/umd/src/avatars/avatarAnimationScheduler.d.ts +4 -0
- package/umd/src/book-components/Chat/Chat/ChatCitationModal.d.ts +2 -0
- package/umd/src/book-components/Chat/Chat/ChatMessageItem.d.ts +4 -0
- package/umd/src/book-components/Chat/Chat/ChatMessageList.d.ts +4 -0
- package/umd/src/book-components/Chat/Chat/ChatProps.d.ts +5 -0
- package/umd/src/book-components/Chat/Chat/ChatToolCallModal.d.ts +2 -0
- package/umd/src/book-components/Chat/Chat/ChatToolCallModalContent.d.ts +3 -1
- package/umd/src/book-components/Chat/Chat/TeamToolCallModalContent.d.ts +2 -0
- package/umd/src/book-components/Chat/SourceChip/SourceChip.d.ts +6 -1
- package/umd/src/book-components/Chat/hooks/useResolvedCitationLabel.d.ts +12 -0
- package/umd/src/book-components/Chat/types/ChatMessage.d.ts +4 -0
- package/umd/src/book-components/Chat/types/ChatParticipant.d.ts +1 -1
- package/umd/src/book-components/Chat/types/CitationLabelResolver.d.ts +8 -0
- package/umd/src/book-components/Chat/utils/citationHelpers.d.ts +9 -0
- package/umd/src/book-components/Chat/utils/decodeJsonUnicodeEscapesInMarkdownText.d.ts +14 -0
- package/umd/src/book-components/Chat/utils/decodeJsonUnicodeEscapesInMarkdownText.test.d.ts +1 -0
- package/umd/src/book-components/Chat/utils/parseCitationsFromContent.d.ts +4 -0
- package/umd/src/version.d.ts +1 -1
|
@@ -66,6 +66,7 @@ import type { ChatProgressCard } from '../book-components/Chat/types/ChatMessage
|
|
|
66
66
|
import type { ChatMessageReplyingTo } from '../book-components/Chat/types/ChatMessage';
|
|
67
67
|
import type { ChatMessage } from '../book-components/Chat/types/ChatMessage';
|
|
68
68
|
import type { ChatParticipant } from '../book-components/Chat/types/ChatParticipant';
|
|
69
|
+
import type { CitationLabelResolver } from '../book-components/Chat/types/CitationLabelResolver';
|
|
69
70
|
import type { MessageButton } from '../book-components/Chat/utils/parseMessageButtons';
|
|
70
71
|
import { parseMessageButtons } from '../book-components/Chat/utils/parseMessageButtons';
|
|
71
72
|
import { ArrowIcon } from '../book-components/icons/ArrowIcon';
|
|
@@ -150,6 +151,7 @@ export type { ChatProgressCard };
|
|
|
150
151
|
export type { ChatMessageReplyingTo };
|
|
151
152
|
export type { ChatMessage };
|
|
152
153
|
export type { ChatParticipant };
|
|
154
|
+
export type { CitationLabelResolver };
|
|
153
155
|
export type { MessageButton };
|
|
154
156
|
export { parseMessageButtons };
|
|
155
157
|
export { ArrowIcon };
|
|
@@ -55,6 +55,7 @@ import type { ChatProgressCard } from '../book-components/Chat/types/ChatMessage
|
|
|
55
55
|
import type { ChatMessageReplyingTo } from '../book-components/Chat/types/ChatMessage';
|
|
56
56
|
import type { ChatMessage } from '../book-components/Chat/types/ChatMessage';
|
|
57
57
|
import type { ChatParticipant } from '../book-components/Chat/types/ChatParticipant';
|
|
58
|
+
import type { CitationLabelResolver } from '../book-components/Chat/types/CitationLabelResolver';
|
|
58
59
|
import type { ParsedCitation } from '../book-components/Chat/utils/parseCitationsFromContent';
|
|
59
60
|
import type { MessageButton } from '../book-components/Chat/utils/parseMessageButtons';
|
|
60
61
|
import type { TeamToolResult } from '../book-components/Chat/utils/toolCallParsing/TeamToolResult';
|
|
@@ -496,6 +497,7 @@ export type { ChatProgressCard };
|
|
|
496
497
|
export type { ChatMessageReplyingTo };
|
|
497
498
|
export type { ChatMessage };
|
|
498
499
|
export type { ChatParticipant };
|
|
500
|
+
export type { CitationLabelResolver };
|
|
499
501
|
export type { ParsedCitation };
|
|
500
502
|
export type { MessageButton };
|
|
501
503
|
export type { TeamToolResult };
|
|
@@ -7,6 +7,10 @@ type AvatarAnimationListener = (now: number) => void;
|
|
|
7
7
|
/**
|
|
8
8
|
* Registers one avatar animation callback in the shared animation loop.
|
|
9
9
|
*
|
|
10
|
+
* Each listener is staggered at registration time so it does not fire on the same animation
|
|
11
|
+
* frame as the existing listeners, and the shared loop further caps how many listeners run
|
|
12
|
+
* per frame, keeping the main thread responsive when many avatars are mounted.
|
|
13
|
+
*
|
|
10
14
|
* @param avatarAnimationListener Frame callback invoked on every animation frame.
|
|
11
15
|
* @returns Cleanup function that unregisters the callback.
|
|
12
16
|
*
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ChatParticipant } from '../types/ChatParticipant';
|
|
2
|
+
import type { CitationLabelResolver } from '../types/CitationLabelResolver';
|
|
2
3
|
import type { ParsedCitation } from '../utils/parseCitationsFromContent';
|
|
3
4
|
import type { ChatSoundSystem } from './ChatProps';
|
|
4
5
|
/**
|
|
@@ -10,6 +11,7 @@ export type ChatCitationModalProps = {
|
|
|
10
11
|
isOpen: boolean;
|
|
11
12
|
citation: ParsedCitation | null;
|
|
12
13
|
participants: ReadonlyArray<ChatParticipant>;
|
|
14
|
+
resolveCitationLabel?: CitationLabelResolver;
|
|
13
15
|
soundSystem?: ChatSoundSystem;
|
|
14
16
|
onClose: () => void;
|
|
15
17
|
};
|
|
@@ -38,6 +38,10 @@ type ChatMessageItemProps = Pick<ChatProps, 'onMessage' | 'onActionButton' | 'on
|
|
|
38
38
|
* Optional localized labels used by timestamp metadata.
|
|
39
39
|
*/
|
|
40
40
|
timingTranslations?: ChatProps['timingTranslations'];
|
|
41
|
+
/**
|
|
42
|
+
* Optional resolver for turning technical citation sources into page/document titles.
|
|
43
|
+
*/
|
|
44
|
+
resolveCitationLabel?: ChatProps['resolveCitationLabel'];
|
|
41
45
|
/**
|
|
42
46
|
* Optional moment locale used to format message timestamps.
|
|
43
47
|
*/
|
|
@@ -32,6 +32,10 @@ export type ChatMessageListProps = {
|
|
|
32
32
|
* Optional localized labels used by timestamp metadata.
|
|
33
33
|
*/
|
|
34
34
|
timingTranslations?: ChatProps['timingTranslations'];
|
|
35
|
+
/**
|
|
36
|
+
* Optional resolver for turning technical citation sources into page/document titles.
|
|
37
|
+
*/
|
|
38
|
+
resolveCitationLabel?: ChatProps['resolveCitationLabel'];
|
|
35
39
|
/**
|
|
36
40
|
* Optional moment locale used to format message timestamps.
|
|
37
41
|
*/
|
|
@@ -8,6 +8,7 @@ import type { AgentChipData } from '../AgentChip/AgentChip';
|
|
|
8
8
|
import type { string_chat_format_name } from '../save/_common/string_chat_format_name';
|
|
9
9
|
import type { ChatMessage } from '../types/ChatMessage';
|
|
10
10
|
import type { ChatParticipant } from '../types/ChatParticipant';
|
|
11
|
+
import type { CitationLabelResolver } from '../types/CitationLabelResolver';
|
|
11
12
|
import type { ChatSaveFormatHandlerMap } from '../save/_common/ChatSaveFormatHandler';
|
|
12
13
|
/**
|
|
13
14
|
* Response data returned by the optional `onFeedback` handler.
|
|
@@ -715,6 +716,10 @@ export type ChatProps = {
|
|
|
715
716
|
* Optional localized labels used by timestamp metadata shown under messages.
|
|
716
717
|
*/
|
|
717
718
|
readonly timingTranslations?: ChatTimingTranslations;
|
|
719
|
+
/**
|
|
720
|
+
* Optional resolver for turning technical citation sources into page/document titles.
|
|
721
|
+
*/
|
|
722
|
+
readonly resolveCitationLabel?: CitationLabelResolver;
|
|
718
723
|
/**
|
|
719
724
|
* Optional localized labels for general Chat UI elements such as button labels,
|
|
720
725
|
* lifecycle state badges, tool call modal strings, and the default input placeholder.
|
|
@@ -3,6 +3,7 @@ import type { WithTake } from '../../../utils/take/interfaces/ITakeChain';
|
|
|
3
3
|
import type { AgentChipData } from '../AgentChip/AgentChip';
|
|
4
4
|
import type { ChatMessage } from '../types/ChatMessage';
|
|
5
5
|
import type { ChatParticipant } from '../types/ChatParticipant';
|
|
6
|
+
import type { CitationLabelResolver } from '../types/CitationLabelResolver';
|
|
6
7
|
/**
|
|
7
8
|
* Props for the tool call details modal.
|
|
8
9
|
*
|
|
@@ -20,6 +21,7 @@ export type ChatToolCallModalProps = {
|
|
|
20
21
|
toolCallIdentity?: string | null;
|
|
21
22
|
onClose: () => void;
|
|
22
23
|
toolTitles?: Record<string, string>;
|
|
24
|
+
resolveCitationLabel?: CitationLabelResolver;
|
|
23
25
|
agentParticipant?: ChatParticipant;
|
|
24
26
|
buttonColor: WithTake<Color>;
|
|
25
27
|
/**
|
|
@@ -3,6 +3,7 @@ import { Color } from '../../../utils/color/Color';
|
|
|
3
3
|
import type { WithTake } from '../../../utils/take/interfaces/ITakeChain';
|
|
4
4
|
import type { ChatMessage } from '../types/ChatMessage';
|
|
5
5
|
import type { ChatParticipant } from '../types/ChatParticipant';
|
|
6
|
+
import type { CitationLabelResolver } from '../types/CitationLabelResolver';
|
|
6
7
|
import type { TeamToolCallSummary, TransitiveToolCall } from '../utils/collectTeamToolCallSummary';
|
|
7
8
|
import type { AgentProfileData } from '../utils/loadAgentProfile';
|
|
8
9
|
import type { TeamToolResult } from '../utils/toolCallParsing/TeamToolResult';
|
|
@@ -27,6 +28,7 @@ type ChatToolCallModalContentProps = {
|
|
|
27
28
|
readonly isAdvancedView: boolean;
|
|
28
29
|
readonly locale?: string;
|
|
29
30
|
readonly mode: 'LIGHT' | 'DARK';
|
|
31
|
+
readonly resolveCitationLabel?: CitationLabelResolver;
|
|
30
32
|
readonly onClearSelectedTeamToolCall: () => void;
|
|
31
33
|
readonly onRequestAdvancedView: () => void;
|
|
32
34
|
readonly onSelectTeamToolCall: (toolCall: TransitiveToolCall) => void;
|
|
@@ -43,5 +45,5 @@ type ChatToolCallModalContentProps = {
|
|
|
43
45
|
*
|
|
44
46
|
* @private component of `ChatToolCallModal`
|
|
45
47
|
*/
|
|
46
|
-
export declare function ChatToolCallModalContent({ agentParticipant, availableTools, buttonColor, chatUiTranslations, focusedToolCall, isAdvancedView, locale, mode, onClearSelectedTeamToolCall, onRequestAdvancedView, onSelectTeamToolCall, selectedTeamToolCall, teamProfiles, teamResult, teamToolCallSummary, toolCall, toolCallDate, toolTitles, }: ChatToolCallModalContentProps): ReactElement;
|
|
48
|
+
export declare function ChatToolCallModalContent({ agentParticipant, availableTools, buttonColor, chatUiTranslations, focusedToolCall, isAdvancedView, locale, mode, resolveCitationLabel, onClearSelectedTeamToolCall, onRequestAdvancedView, onSelectTeamToolCall, selectedTeamToolCall, teamProfiles, teamResult, teamToolCallSummary, toolCall, toolCallDate, toolTitles, }: ChatToolCallModalContentProps): ReactElement;
|
|
47
49
|
export {};
|
|
@@ -2,6 +2,7 @@ import { type ReactElement } from 'react';
|
|
|
2
2
|
import { Color } from '../../../utils/color/Color';
|
|
3
3
|
import type { WithTake } from '../../../utils/take/interfaces/ITakeChain';
|
|
4
4
|
import type { ChatParticipant } from '../types/ChatParticipant';
|
|
5
|
+
import type { CitationLabelResolver } from '../types/CitationLabelResolver';
|
|
5
6
|
import type { TeamToolCallSummary, TransitiveToolCall } from '../utils/collectTeamToolCallSummary';
|
|
6
7
|
import type { AgentProfileData } from '../utils/loadAgentProfile';
|
|
7
8
|
import type { TeamToolResult } from '../utils/toolCallParsing/TeamToolResult';
|
|
@@ -19,6 +20,7 @@ type TeamToolCallModalContentOptions = {
|
|
|
19
20
|
onClearSelectedTeamToolCall: () => void;
|
|
20
21
|
teamProfiles: Record<string, AgentProfileData>;
|
|
21
22
|
toolTitles?: Record<string, string>;
|
|
23
|
+
resolveCitationLabel?: CitationLabelResolver;
|
|
22
24
|
agentParticipant?: ChatParticipant;
|
|
23
25
|
buttonColor: WithTake<Color>;
|
|
24
26
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { CitationLabelResolver } from '../types/CitationLabelResolver';
|
|
1
2
|
import type { ParsedCitation } from '../utils/parseCitationsFromContent';
|
|
2
3
|
/**
|
|
3
4
|
* Props for SourceChip component
|
|
@@ -19,6 +20,10 @@ export type SourceChipProps = {
|
|
|
19
20
|
* Optional suffix text to display after the citation label.
|
|
20
21
|
*/
|
|
21
22
|
suffix?: string;
|
|
23
|
+
/**
|
|
24
|
+
* Optional resolver for richer citation labels.
|
|
25
|
+
*/
|
|
26
|
+
resolveCitationLabel?: CitationLabelResolver;
|
|
22
27
|
/**
|
|
23
28
|
* Controls whether the technical citation id is shown inside the chip label.
|
|
24
29
|
*/
|
|
@@ -41,4 +46,4 @@ export type SourceChipProps = {
|
|
|
41
46
|
*
|
|
42
47
|
* @private utility of `ChatMessageItem` component
|
|
43
48
|
*/
|
|
44
|
-
export declare function SourceChip({ citation, onClick, className, suffix, isCitationIdVisible }: SourceChipProps): import("react/jsx-runtime").JSX.Element;
|
|
49
|
+
export declare function SourceChip({ citation, onClick, className, suffix, resolveCitationLabel, isCitationIdVisible, }: SourceChipProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { CitationLabelResolver } from '../types/CitationLabelResolver';
|
|
2
|
+
import type { ParsedCitation } from '../utils/parseCitationsFromContent';
|
|
3
|
+
/**
|
|
4
|
+
* Resolves the best available label for one citation.
|
|
5
|
+
*
|
|
6
|
+
* @param citation - Citation metadata.
|
|
7
|
+
* @param resolveCitationLabel - Optional async host resolver.
|
|
8
|
+
* @returns Current label, starting with a synchronous fallback and updating when the resolver finishes.
|
|
9
|
+
*
|
|
10
|
+
* @private hook of `<Chat/>`
|
|
11
|
+
*/
|
|
12
|
+
export declare function useResolvedCitationLabel(citation: ParsedCitation, resolveCitationLabel?: CitationLabelResolver): string;
|
|
@@ -254,6 +254,10 @@ export type ChatMessage = Omit<Message<id>, 'direction' | 'recipients' | 'thread
|
|
|
254
254
|
* Optional URL to the source document
|
|
255
255
|
*/
|
|
256
256
|
url?: string;
|
|
257
|
+
/**
|
|
258
|
+
* Optional human-readable source title.
|
|
259
|
+
*/
|
|
260
|
+
title?: string;
|
|
257
261
|
/**
|
|
258
262
|
* Optional preview/excerpt from the source
|
|
259
263
|
*/
|
|
@@ -47,7 +47,7 @@ export type ChatParticipant = {
|
|
|
47
47
|
* Knowledge sources (documents, URLs) used by the agent
|
|
48
48
|
* Used for resolving document citations when the agent references sources
|
|
49
49
|
*/
|
|
50
|
-
knowledgeSources?:
|
|
50
|
+
knowledgeSources?: ReadonlyArray<{
|
|
51
51
|
url: string;
|
|
52
52
|
filename: string;
|
|
53
53
|
}>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Promisable } from 'type-fest';
|
|
2
|
+
import type { ParsedCitation } from '../utils/parseCitationsFromContent';
|
|
3
|
+
/**
|
|
4
|
+
* Optional host-provided resolver for citation display labels.
|
|
5
|
+
*
|
|
6
|
+
* @public exported from `@promptbook/components`
|
|
7
|
+
*/
|
|
8
|
+
export type CitationLabelResolver = (citation: ParsedCitation) => Promisable<string | null | undefined>;
|
|
@@ -37,3 +37,12 @@ export declare function getCitationLabel(citation: ParsedCitation): string;
|
|
|
37
37
|
* @private utility of `<Chat/>` citation rendering
|
|
38
38
|
*/
|
|
39
39
|
export declare function resolveCitationPreviewUrl(citation: ParsedCitation, participants: ReadonlyArray<ChatParticipant>): string | null;
|
|
40
|
+
/**
|
|
41
|
+
* Creates a readable fallback label from a citation source when no title metadata is available.
|
|
42
|
+
*
|
|
43
|
+
* @param source - Raw citation source value.
|
|
44
|
+
* @returns Human-friendly source label.
|
|
45
|
+
*
|
|
46
|
+
* @private utility of `<Chat/>` citation rendering
|
|
47
|
+
*/
|
|
48
|
+
export declare function createReadableCitationSourceLabel(source: string): string;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { string_markdown } from '../../../types/string_markdown';
|
|
2
|
+
/**
|
|
3
|
+
* Decodes JSON-style Unicode escape sequences in markdown prose while preserving code.
|
|
4
|
+
*
|
|
5
|
+
* Model/tool output can occasionally arrive as already JSON-escaped text, which makes
|
|
6
|
+
* natural-language replies render `\u00fd` instead of the decoded character. This
|
|
7
|
+
* keeps code examples intact by skipping fenced code blocks and inline code spans.
|
|
8
|
+
*
|
|
9
|
+
* @param markdown - Markdown chat content to normalize for display.
|
|
10
|
+
* @returns Markdown chat content with non-ASCII JSON Unicode escapes decoded.
|
|
11
|
+
*
|
|
12
|
+
* @private internal utility of `<Chat/>`
|
|
13
|
+
*/
|
|
14
|
+
export declare function decodeJsonUnicodeEscapesInMarkdownText(markdown: string_markdown): string_markdown;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/umd/src/version.d.ts
CHANGED
|
@@ -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.112.0-
|
|
18
|
+
* It follows semantic versioning (e.g., `0.112.0-126`).
|
|
19
19
|
*
|
|
20
20
|
* @generated
|
|
21
21
|
*/
|