@promptbook/javascript 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 +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 +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
package/README.md
CHANGED
|
@@ -468,7 +468,7 @@ Prompts marked with `[-]` are not ready yet, prompts containing `@@@` are treate
|
|
|
468
468
|
- **Multi-runner execution:** `openai-codex`, `github-copilot`, `cline`, `claude-code`, `opencode`, `gemini`
|
|
469
469
|
- **Context injection:** `--agent agents/coding/developer.book --context AGENTS.md` or inline extra instructions
|
|
470
470
|
- **Reasoning control:** `--thinking-level low|medium|high|xhigh` for supported runners
|
|
471
|
-
- **
|
|
471
|
+
- **Unattended or interactive runs:** default auto mode, or `--no-auto` to wait for user confirmation before each prompt
|
|
472
472
|
- **Git safety:** clean working tree check by default, optional `--ignore-git-changes`
|
|
473
473
|
- **Opt-in remote pushes:** commits stay local unless you explicitly pass `--auto-push`
|
|
474
474
|
- **Prompt triage:** `--priority` to process only more important tasks first
|
|
@@ -490,7 +490,7 @@ npx ts-node ./src/cli/test/ptbk.ts coder run --harness github-copilot --model gp
|
|
|
490
490
|
|
|
491
491
|
npx ts-node ./src/cli/test/ptbk.ts coder run --harness github-copilot --model gpt-5.4 --thinking-level xhigh --agent agents/coding/developer.book --context AGENTS.md --auto-push
|
|
492
492
|
|
|
493
|
-
npx ts-node ./src/cli/test/ptbk.ts coder run --harness github-copilot --model gpt-5.4 --thinking-level xhigh --agent agents/coding/developer.book --context AGENTS.md --ignore-git-changes
|
|
493
|
+
npx ts-node ./src/cli/test/ptbk.ts coder run --harness github-copilot --model gpt-5.4 --thinking-level xhigh --agent agents/coding/developer.book --context AGENTS.md --ignore-git-changes
|
|
494
494
|
|
|
495
495
|
npx ts-node ./src/cli/test/ptbk.ts coder find-refactor-candidates
|
|
496
496
|
|
|
@@ -516,7 +516,7 @@ ptbk coder run --harness github-copilot --model gpt-5.4 --thinking-level xhigh -
|
|
|
516
516
|
|
|
517
517
|
ptbk coder run --harness github-copilot --model gpt-5.4 --thinking-level xhigh --agent agents/coding/developer.book --context AGENTS.md --auto-push
|
|
518
518
|
|
|
519
|
-
ptbk coder run --harness github-copilot --model gpt-5.4 --thinking-level xhigh --agent agents/coding/developer.book --context AGENTS.md --test npm run test --ignore-git-changes
|
|
519
|
+
ptbk coder run --harness github-copilot --model gpt-5.4 --thinking-level xhigh --agent agents/coding/developer.book --context AGENTS.md --test npm run test --ignore-git-changes
|
|
520
520
|
|
|
521
521
|
ptbk coder find-refactor-candidates
|
|
522
522
|
|
|
@@ -546,7 +546,7 @@ ptbk coder verify
|
|
|
546
546
|
| `--context <text-or-file>` | Appends extra instructions inline or from a file like `AGENTS.md`. |
|
|
547
547
|
| `--test <command>` | Runs a verification command after each prompt attempt and feeds failing output back for retries. |
|
|
548
548
|
| `--thinking-level <level>` | Sets reasoning effort for supported runners. |
|
|
549
|
-
| `--no-
|
|
549
|
+
| `--no-auto` | Waits for user confirmation before each prompt instead of running automatically through the queue. |
|
|
550
550
|
| `--ignore-git-changes` | Disables the clean-working-tree guard. |
|
|
551
551
|
| `--priority <n>` | Runs only prompts at or above the given priority. |
|
|
552
552
|
| `--dry-run` | Prints which prompts are ready instead of executing them. |
|
|
@@ -559,7 +559,7 @@ ptbk coder verify
|
|
|
559
559
|
1. Initialize once with `ptbk coder init`.
|
|
560
560
|
2. Customize `prompts/templates/*.md` if needed, then create or write prompt files in `prompts/`.
|
|
561
561
|
3. Customize the starter `AGENTS.md` with repository-specific instructions, then pass `--agent agents/coding/developer.book --context AGENTS.md`.
|
|
562
|
-
4. Run
|
|
562
|
+
4. Run unattended batches by default, or pass `--no-auto` to confirm each prompt interactively.
|
|
563
563
|
5. Finish with `ptbk coder verify` so resolved prompts are archived and broken ones get explicit repair follow-ups.
|
|
564
564
|
|
|
565
565
|
|
package/esm/index.es.js
CHANGED
|
@@ -17,7 +17,7 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
|
|
|
17
17
|
* @generated
|
|
18
18
|
* @see https://github.com/webgptorg/promptbook
|
|
19
19
|
*/
|
|
20
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.112.0-
|
|
20
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.112.0-128';
|
|
21
21
|
/**
|
|
22
22
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
23
23
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -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/esm/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
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@promptbook/javascript",
|
|
3
|
-
"version": "0.112.0-
|
|
3
|
+
"version": "0.112.0-128",
|
|
4
4
|
"description": "Promptbook: Create persistent AI agents that turn your company's scattered knowledge into action",
|
|
5
5
|
"private": false,
|
|
6
6
|
"sideEffects": false,
|
|
@@ -98,7 +98,7 @@
|
|
|
98
98
|
"types": "./esm/src/_packages/javascript.index.d.ts",
|
|
99
99
|
"typings": "./esm/src/_packages/javascript.index.d.ts",
|
|
100
100
|
"peerDependencies": {
|
|
101
|
-
"@promptbook/core": "0.112.0-
|
|
101
|
+
"@promptbook/core": "0.112.0-128"
|
|
102
102
|
},
|
|
103
103
|
"dependencies": {
|
|
104
104
|
"crypto-js": "4.2.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.112.0-
|
|
26
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.112.0-128';
|
|
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
|
|
@@ -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
|
*/
|