@promptbook/fake-llm 0.105.0-21 → 0.105.0-26
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 +121 -4731
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/browser.index.d.ts +2 -0
- package/esm/typings/src/_packages/core.index.d.ts +9 -13
- package/esm/typings/src/_packages/node.index.d.ts +2 -0
- package/esm/typings/src/_packages/types.index.d.ts +12 -2
- package/esm/typings/src/_packages/utils.index.d.ts +2 -0
- package/esm/typings/src/book-2.0/agent-source/AgentBasicInformation.d.ts +1 -1
- package/esm/typings/src/book-components/Chat/AgentChip/AgentChip.d.ts +67 -0
- package/esm/typings/src/book-components/Chat/AgentChip/index.d.ts +2 -0
- package/esm/typings/src/book-components/Chat/Chat/ChatMessageItem.d.ts +23 -0
- package/esm/typings/src/book-components/Chat/Chat/ChatProps.d.ts +10 -0
- package/esm/typings/src/book-components/Chat/LlmChat/FriendlyErrorMessage.d.ts +20 -0
- package/esm/typings/src/book-components/Chat/LlmChat/LlmChatProps.d.ts +8 -0
- package/esm/typings/src/book-components/Chat/SourceChip/SourceChip.d.ts +35 -0
- package/esm/typings/src/book-components/Chat/SourceChip/index.d.ts +2 -0
- package/esm/typings/src/book-components/Chat/types/ChatMessage.d.ts +21 -0
- package/esm/typings/src/book-components/Chat/utils/createTeamToolNameFromUrl.d.ts +12 -0
- package/esm/typings/src/book-components/Chat/utils/getToolCallChipletText.d.ts +21 -0
- package/esm/typings/src/book-components/Chat/utils/loadAgentProfile.d.ts +69 -0
- package/esm/typings/src/book-components/Chat/utils/parseCitationsFromContent.d.ts +53 -0
- package/esm/typings/src/book-components/icons/EmailIcon.d.ts +15 -0
- package/esm/typings/src/commitments/TEMPLATE/TEMPLATE.d.ts +44 -0
- package/esm/typings/src/commitments/TEMPLATE/TEMPLATE.test.d.ts +1 -0
- package/esm/typings/src/commitments/USE_BROWSER/USE_BROWSER.d.ts +16 -2
- package/esm/typings/src/commitments/USE_BROWSER/fetchUrlContent.d.ts +22 -0
- package/esm/typings/src/commitments/USE_BROWSER/fetchUrlContentViaBrowser.d.ts +13 -0
- package/esm/typings/src/commitments/USE_EMAIL/USE_EMAIL.d.ts +48 -0
- package/esm/typings/src/commitments/USE_EMAIL/resolveSendEmailToolForNode.d.ts +11 -0
- package/esm/typings/src/commitments/USE_EMAIL/sendEmailViaBrowser.d.ts +18 -0
- package/esm/typings/src/commitments/_common/commitmentToolFunctions.d.ts +26 -0
- package/esm/typings/src/commitments/_common/getAllCommitmentDefinitions.d.ts +8 -0
- package/esm/typings/src/commitments/_common/getAllCommitmentTypes.d.ts +8 -0
- package/esm/typings/src/commitments/_common/getAllCommitmentsToolFunctionsForBrowser.d.ts +9 -0
- package/esm/typings/src/commitments/_common/getAllCommitmentsToolFunctionsForNode.d.ts +13 -0
- package/esm/typings/src/commitments/_common/getAllCommitmentsToolTitles.d.ts +7 -0
- package/esm/typings/src/commitments/_common/getCommitmentDefinition.d.ts +10 -0
- package/esm/typings/src/commitments/_common/getGroupedCommitmentDefinitions.d.ts +17 -0
- package/esm/typings/src/commitments/_common/isCommitmentSupported.d.ts +9 -0
- package/esm/typings/src/commitments/index.d.ts +3 -64
- package/esm/typings/src/constants.d.ts +4 -0
- package/esm/typings/src/executables/$provideExecutablesForNode.d.ts +1 -0
- package/esm/typings/src/execution/utils/$provideExecutionToolsForNode.d.ts +1 -0
- package/esm/typings/src/pipeline/prompt-notation.d.ts +27 -2
- package/esm/typings/src/pipeline/prompt-notation.test.d.ts +1 -1
- package/esm/typings/src/scrapers/_common/register/$provideFilesystemForNode.d.ts +1 -0
- package/esm/typings/src/scrapers/_common/register/$provideScrapersForNode.d.ts +1 -0
- package/esm/typings/src/scrapers/_common/register/$provideScriptingForNode.d.ts +1 -0
- package/esm/typings/src/version.d.ts +1 -1
- package/esm/typings/src/wizard/wizard.d.ts +1 -4
- package/package.json +2 -4
- package/umd/index.umd.js +123 -4734
- package/umd/index.umd.js.map +1 -1
|
@@ -9,6 +9,8 @@ import type { AvatarProfileProps } from '../book-components/AvatarProfile/Avatar
|
|
|
9
9
|
import type { AvatarProfileFromSourceProps } from '../book-components/AvatarProfile/AvatarProfile/AvatarProfileFromSource';
|
|
10
10
|
import type { BookEditorProps } from '../book-components/BookEditor/BookEditor';
|
|
11
11
|
import type { AgentChatProps } from '../book-components/Chat/AgentChat/AgentChatProps';
|
|
12
|
+
import type { AgentChipData } from '../book-components/Chat/AgentChip/AgentChip';
|
|
13
|
+
import type { AgentChipProps } from '../book-components/Chat/AgentChip/AgentChip';
|
|
12
14
|
import type { ChatSoundSystem } from '../book-components/Chat/Chat/ChatProps';
|
|
13
15
|
import type { ChatProps } from '../book-components/Chat/Chat/ChatProps';
|
|
14
16
|
import type { ChatSoundToggleProps } from '../book-components/Chat/Chat/ChatSoundToggle';
|
|
@@ -18,14 +20,18 @@ import type { ChatEffectsSystemProps } from '../book-components/Chat/effects/typ
|
|
|
18
20
|
import type { ChatEffectType } from '../book-components/Chat/effects/types/ChatEffectType';
|
|
19
21
|
import type { ChatAutoScrollConfig } from '../book-components/Chat/hooks/useChatAutoScroll';
|
|
20
22
|
import type { SendMessageToLlmChatFunction } from '../book-components/Chat/hooks/useSendMessageToLlmChat';
|
|
23
|
+
import type { FriendlyErrorMessage } from '../book-components/Chat/LlmChat/FriendlyErrorMessage';
|
|
21
24
|
import type { LlmChatProps } from '../book-components/Chat/LlmChat/LlmChatProps';
|
|
22
25
|
import type { MockedChatDelayConfig } from '../book-components/Chat/MockedChat/MockedChat';
|
|
23
26
|
import type { MockedChatProps } from '../book-components/Chat/MockedChat/MockedChat';
|
|
24
27
|
import type { ChatSaveFormatDefinition } from '../book-components/Chat/save/_common/ChatSaveFormatDefinition';
|
|
25
28
|
import type { string_chat_format_name } from '../book-components/Chat/save/_common/string_chat_format_name';
|
|
29
|
+
import type { SourceChipProps } from '../book-components/Chat/SourceChip/SourceChip';
|
|
26
30
|
import type { ChatToolCall } from '../book-components/Chat/types/ChatMessage';
|
|
27
31
|
import type { ChatMessage } from '../book-components/Chat/types/ChatMessage';
|
|
28
32
|
import type { ChatParticipant } from '../book-components/Chat/types/ChatParticipant';
|
|
33
|
+
import type { ToolCallChipletInfo } from '../book-components/Chat/utils/getToolCallChipletText';
|
|
34
|
+
import type { ParsedCitation } from '../book-components/Chat/utils/parseCitationsFromContent';
|
|
29
35
|
import type { MessageButton } from '../book-components/Chat/utils/parseMessageButtons';
|
|
30
36
|
import type { TeamToolResult } from '../book-components/Chat/utils/toolCallParsing';
|
|
31
37
|
import type { QrCodeOptions } from '../book-components/Qr/useQrCode';
|
|
@@ -66,7 +72,6 @@ import type { InstrumentCommand } from '../commands/X_INSTRUMENT/InstrumentComma
|
|
|
66
72
|
import type { BookCommitment } from '../commitments/_base/BookCommitment';
|
|
67
73
|
import type { CommitmentDefinition } from '../commitments/_base/CommitmentDefinition';
|
|
68
74
|
import type { ParsedCommitment } from '../commitments/_base/ParsedCommitment';
|
|
69
|
-
import type { GroupedCommitmentDefinition } from '../commitments/index';
|
|
70
75
|
import type { PrettifyOptions } from '../conversion/prettify/PrettifyOptions';
|
|
71
76
|
import type { renderPipelineMermaidOptions } from '../conversion/prettify/renderPipelineMermaidOptions';
|
|
72
77
|
import type { CallbackInterfaceToolsOptions } from '../dialogs/callback/CallbackInterfaceToolsOptions';
|
|
@@ -398,6 +403,8 @@ export type { AvatarProfileProps };
|
|
|
398
403
|
export type { AvatarProfileFromSourceProps };
|
|
399
404
|
export type { BookEditorProps };
|
|
400
405
|
export type { AgentChatProps };
|
|
406
|
+
export type { AgentChipData };
|
|
407
|
+
export type { AgentChipProps };
|
|
401
408
|
export type { ChatSoundSystem };
|
|
402
409
|
export type { ChatProps };
|
|
403
410
|
export type { ChatSoundToggleProps };
|
|
@@ -407,14 +414,18 @@ export type { ChatEffectsSystemProps };
|
|
|
407
414
|
export type { ChatEffectType };
|
|
408
415
|
export type { ChatAutoScrollConfig };
|
|
409
416
|
export type { SendMessageToLlmChatFunction };
|
|
417
|
+
export type { FriendlyErrorMessage };
|
|
410
418
|
export type { LlmChatProps };
|
|
411
419
|
export type { MockedChatDelayConfig };
|
|
412
420
|
export type { MockedChatProps };
|
|
413
421
|
export type { ChatSaveFormatDefinition };
|
|
414
422
|
export type { string_chat_format_name };
|
|
423
|
+
export type { SourceChipProps };
|
|
415
424
|
export type { ChatToolCall };
|
|
416
425
|
export type { ChatMessage };
|
|
417
426
|
export type { ChatParticipant };
|
|
427
|
+
export type { ToolCallChipletInfo };
|
|
428
|
+
export type { ParsedCitation };
|
|
418
429
|
export type { MessageButton };
|
|
419
430
|
export type { TeamToolResult };
|
|
420
431
|
export type { QrCodeOptions };
|
|
@@ -455,7 +466,6 @@ export type { InstrumentCommand };
|
|
|
455
466
|
export type { BookCommitment };
|
|
456
467
|
export type { CommitmentDefinition };
|
|
457
468
|
export type { ParsedCommitment };
|
|
458
|
-
export type { GroupedCommitmentDefinition };
|
|
459
469
|
export type { PrettifyOptions };
|
|
460
470
|
export type { renderPipelineMermaidOptions };
|
|
461
471
|
export type { CallbackInterfaceToolsOptions };
|
|
@@ -9,6 +9,7 @@ import { isValidCsvString } from '../formats/csv/utils/isValidCsvString';
|
|
|
9
9
|
import { isValidJsonString } from '../formats/json/utils/isValidJsonString';
|
|
10
10
|
import { jsonParse } from '../formats/json/utils/jsonParse';
|
|
11
11
|
import { isValidXmlString } from '../formats/xml/utils/isValidXmlString';
|
|
12
|
+
import { PromptString } from '../pipeline/prompt-notation';
|
|
12
13
|
import { prompt } from '../pipeline/prompt-notation';
|
|
13
14
|
import { promptTemplate } from '../pipeline/prompt-notation';
|
|
14
15
|
import { $detectRuntimeEnvironment } from '../utils/environment/$detectRuntimeEnvironment';
|
|
@@ -99,6 +100,7 @@ export { isValidCsvString };
|
|
|
99
100
|
export { isValidJsonString };
|
|
100
101
|
export { jsonParse };
|
|
101
102
|
export { isValidXmlString };
|
|
103
|
+
export { PromptString };
|
|
102
104
|
export { prompt };
|
|
103
105
|
export { promptTemplate };
|
|
104
106
|
export { $detectRuntimeEnvironment };
|
|
@@ -31,7 +31,7 @@ export type AgentCapability = {
|
|
|
31
31
|
/**
|
|
32
32
|
* The type of the capability
|
|
33
33
|
*/
|
|
34
|
-
type: 'browser' | 'search-engine' | 'knowledge' | 'time' | 'inheritance' | 'import' | 'image-generator' | 'team';
|
|
34
|
+
type: 'browser' | 'search-engine' | 'knowledge' | 'time' | 'inheritance' | 'import' | 'image-generator' | 'team' | 'email';
|
|
35
35
|
/**
|
|
36
36
|
* The label to display for this capability
|
|
37
37
|
*/
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { string_url } from '../../../types/typeAliases';
|
|
3
|
+
/**
|
|
4
|
+
* Agent profile information for chip display
|
|
5
|
+
*/
|
|
6
|
+
export type AgentChipData = {
|
|
7
|
+
/**
|
|
8
|
+
* Agent URL (required)
|
|
9
|
+
*/
|
|
10
|
+
url: string_url;
|
|
11
|
+
/**
|
|
12
|
+
* Agent display name/label
|
|
13
|
+
*/
|
|
14
|
+
label?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Agent profile image URL
|
|
17
|
+
*/
|
|
18
|
+
imageUrl?: string_url;
|
|
19
|
+
/**
|
|
20
|
+
* Public URL of the agents server (for generating placeholder images)
|
|
21
|
+
*/
|
|
22
|
+
publicUrl?: string_url;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Props for AgentChip component
|
|
26
|
+
*/
|
|
27
|
+
export type AgentChipProps = {
|
|
28
|
+
/**
|
|
29
|
+
* Agent data to display
|
|
30
|
+
*/
|
|
31
|
+
agent: AgentChipData;
|
|
32
|
+
/**
|
|
33
|
+
* Whether this is an ongoing interaction (shows spinner)
|
|
34
|
+
*/
|
|
35
|
+
isOngoing?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Whether this is clickable (completed state)
|
|
38
|
+
*/
|
|
39
|
+
isClickable?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Click handler
|
|
42
|
+
*/
|
|
43
|
+
onClick?: (event?: React.MouseEvent) => void;
|
|
44
|
+
/**
|
|
45
|
+
* Additional CSS class name
|
|
46
|
+
*/
|
|
47
|
+
className?: string;
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* AgentChip component - displays a chip with agent avatar and name
|
|
51
|
+
*
|
|
52
|
+
* This component is used to display agent interactions in chat messages.
|
|
53
|
+
* It fetches the agent profile if needed and displays the agent's avatar and name.
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* ```tsx
|
|
57
|
+
* <AgentChip
|
|
58
|
+
* agent={{ url: 'https://agents.example.com/joe', label: 'Joe' }}
|
|
59
|
+
* isOngoing={false}
|
|
60
|
+
* isClickable={true}
|
|
61
|
+
* onClick={() => console.log('clicked')}
|
|
62
|
+
* />
|
|
63
|
+
* ```
|
|
64
|
+
*
|
|
65
|
+
* @private utility of `ChatMessageItem` component
|
|
66
|
+
*/
|
|
67
|
+
export declare function AgentChip({ agent, isOngoing, isClickable, onClick, className }: AgentChipProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import type { id } from '../../../types/typeAliases';
|
|
3
3
|
import type { ChatMessage } from '../types/ChatMessage';
|
|
4
4
|
import type { ChatParticipant } from '../types/ChatParticipant';
|
|
5
|
+
import { type ParsedCitation } from '../utils/parseCitationsFromContent';
|
|
5
6
|
import type { ChatProps } from './ChatProps';
|
|
6
7
|
/**
|
|
7
8
|
* Props for the `ChatMessageItem` component
|
|
@@ -38,11 +39,33 @@ type ChatMessageItemProps = Pick<ChatProps, 'onMessage' | 'participants'> & {
|
|
|
38
39
|
* e.g., { "web_search": "Searching the web..." }
|
|
39
40
|
*/
|
|
40
41
|
toolTitles?: Record<string, string>;
|
|
42
|
+
/**
|
|
43
|
+
* Optional metadata about teammates for team tool calls
|
|
44
|
+
* Maps tool name to agent information
|
|
45
|
+
*/
|
|
46
|
+
teammates?: TeammatesMap;
|
|
41
47
|
/**
|
|
42
48
|
* Called when a tool call chiplet is clicked.
|
|
43
49
|
*/
|
|
44
50
|
onToolCallClick?: (toolCall: NonNullable<ChatMessage['toolCalls']>[number]) => void;
|
|
51
|
+
/**
|
|
52
|
+
* Called when a source citation chip is clicked.
|
|
53
|
+
*/
|
|
54
|
+
onCitationClick?: (citation: ParsedCitation) => void;
|
|
45
55
|
};
|
|
56
|
+
/**
|
|
57
|
+
* Metadata for a teammate agent tool.
|
|
58
|
+
*/
|
|
59
|
+
type TeammateMetadata = {
|
|
60
|
+
url: string;
|
|
61
|
+
label?: string;
|
|
62
|
+
instructions?: string;
|
|
63
|
+
toolName: string;
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* Lookup map of teammate metadata by tool name.
|
|
67
|
+
*/
|
|
68
|
+
type TeammatesMap = Record<string, TeammateMetadata>;
|
|
46
69
|
/**
|
|
47
70
|
* Renders a single chat message item with avatar, content, buttons, and rating.
|
|
48
71
|
*
|
|
@@ -169,6 +169,16 @@ export type ChatProps = {
|
|
|
169
169
|
* e.g., { "web_search": "Searching the web..." }
|
|
170
170
|
*/
|
|
171
171
|
readonly toolTitles?: Record<string, string>;
|
|
172
|
+
/**
|
|
173
|
+
* Optional metadata about teammates for team tool calls
|
|
174
|
+
* Maps tool name to agent information
|
|
175
|
+
*/
|
|
176
|
+
readonly teammates?: Record<string, {
|
|
177
|
+
url: string;
|
|
178
|
+
label?: string;
|
|
179
|
+
instructions?: string;
|
|
180
|
+
toolName: string;
|
|
181
|
+
}>;
|
|
172
182
|
/**
|
|
173
183
|
* Optional callback to create a new agent from the template.
|
|
174
184
|
* If provided, renders the [Create Agent] button for book code blocks.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error types for LlmChat component
|
|
3
|
+
*
|
|
4
|
+
* This is a minimal type definition for use in the Promptbook Engine component.
|
|
5
|
+
* The full implementation is in the Agent Server.
|
|
6
|
+
*/
|
|
7
|
+
export type FriendlyErrorMessage = {
|
|
8
|
+
/**
|
|
9
|
+
* @@@
|
|
10
|
+
*/
|
|
11
|
+
title: string;
|
|
12
|
+
/**
|
|
13
|
+
* @@@
|
|
14
|
+
*/
|
|
15
|
+
message: string;
|
|
16
|
+
/**
|
|
17
|
+
* @@@
|
|
18
|
+
*/
|
|
19
|
+
canRetry: boolean;
|
|
20
|
+
};
|
|
@@ -62,4 +62,12 @@ export type LlmChatProps = Omit<ChatProps, 'messages' | 'onMessage' | 'onChange'
|
|
|
62
62
|
* e.g., { "web_search": "Searching the web..." }
|
|
63
63
|
*/
|
|
64
64
|
readonly toolTitles?: Record<string, string>;
|
|
65
|
+
/**
|
|
66
|
+
* Optional custom error handler that will be called when an error occurs during chat.
|
|
67
|
+
* If not provided, errors will be displayed as messages in the chat.
|
|
68
|
+
*
|
|
69
|
+
* @param error - The error that occurred
|
|
70
|
+
* @param retry - Function to retry the last failed message
|
|
71
|
+
*/
|
|
72
|
+
onError?(error: unknown, retry: () => void): void;
|
|
65
73
|
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { ParsedCitation } from '../utils/parseCitationsFromContent';
|
|
2
|
+
/**
|
|
3
|
+
* Props for SourceChip component
|
|
4
|
+
*/
|
|
5
|
+
export type SourceChipProps = {
|
|
6
|
+
/**
|
|
7
|
+
* Citation data to display
|
|
8
|
+
*/
|
|
9
|
+
citation: ParsedCitation;
|
|
10
|
+
/**
|
|
11
|
+
* Click handler
|
|
12
|
+
*/
|
|
13
|
+
onClick?: (citation: ParsedCitation) => void;
|
|
14
|
+
/**
|
|
15
|
+
* Additional CSS class name
|
|
16
|
+
*/
|
|
17
|
+
className?: string;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* SourceChip component - displays a chip with source document information
|
|
21
|
+
*
|
|
22
|
+
* This component is used to display RAG source citations in chat messages.
|
|
23
|
+
* It displays the source document name and citation ID.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```tsx
|
|
27
|
+
* <SourceChip
|
|
28
|
+
* citation={{ id: '5:13', source: 'document.pdf' }}
|
|
29
|
+
* onClick={(citation) => console.log('clicked', citation)}
|
|
30
|
+
* />
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
* @private utility of `ChatMessageItem` component
|
|
34
|
+
*/
|
|
35
|
+
export declare function SourceChip({ citation, onClick, className }: SourceChipProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -66,6 +66,27 @@ export type ChatMessage = Omit<Message<id>, 'direction' | 'recipients' | 'thread
|
|
|
66
66
|
*/
|
|
67
67
|
url: string;
|
|
68
68
|
}>;
|
|
69
|
+
/**
|
|
70
|
+
* Optional source citations/annotations (from RAG systems like OpenAI Assistants)
|
|
71
|
+
*/
|
|
72
|
+
readonly citations?: ReadonlyArray<{
|
|
73
|
+
/**
|
|
74
|
+
* The unique identifier for the citation (e.g., "5:13")
|
|
75
|
+
*/
|
|
76
|
+
id: string;
|
|
77
|
+
/**
|
|
78
|
+
* The source document name (e.g., "document.pdf")
|
|
79
|
+
*/
|
|
80
|
+
source: string;
|
|
81
|
+
/**
|
|
82
|
+
* Optional URL to the source document
|
|
83
|
+
*/
|
|
84
|
+
url?: string;
|
|
85
|
+
/**
|
|
86
|
+
* Optional preview/excerpt from the source
|
|
87
|
+
*/
|
|
88
|
+
excerpt?: string;
|
|
89
|
+
}>;
|
|
69
90
|
};
|
|
70
91
|
/**
|
|
71
92
|
* TODO: Make all fields readonly
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Builds a TEAM tool name from a teammate agent URL.
|
|
3
|
+
*
|
|
4
|
+
* @private utility of chat components
|
|
5
|
+
*/
|
|
6
|
+
export declare function createTeamToolNameFromUrl(url: string): string;
|
|
7
|
+
/**
|
|
8
|
+
* Checks whether a tool name belongs to a TEAM tool.
|
|
9
|
+
*
|
|
10
|
+
* @private utility of chat components
|
|
11
|
+
*/
|
|
12
|
+
export declare function isTeamToolName(name: string): boolean;
|
|
@@ -1,7 +1,21 @@
|
|
|
1
1
|
import type { ToolCall } from '../../../types/ToolCall';
|
|
2
|
+
import type { AgentChipData } from '../AgentChip';
|
|
2
3
|
/**
|
|
3
4
|
* Utility to format tool call information for user-friendly display.
|
|
4
5
|
*/
|
|
6
|
+
/**
|
|
7
|
+
* Tool call chiplet information including agent data for team tools
|
|
8
|
+
*/
|
|
9
|
+
export type ToolCallChipletInfo = {
|
|
10
|
+
/**
|
|
11
|
+
* Display text for the chiplet
|
|
12
|
+
*/
|
|
13
|
+
text: string;
|
|
14
|
+
/**
|
|
15
|
+
* Agent data for team tools (if applicable)
|
|
16
|
+
*/
|
|
17
|
+
agentData?: AgentChipData;
|
|
18
|
+
};
|
|
5
19
|
/**
|
|
6
20
|
* Technical to user-friendly tool names and emojis
|
|
7
21
|
*
|
|
@@ -14,6 +28,13 @@ export declare const TOOL_TITLES: Record<string, {
|
|
|
14
28
|
/**
|
|
15
29
|
* Gets the user-friendly text for a tool call chiplet.
|
|
16
30
|
*
|
|
31
|
+
* @deprecated Use getToolCallChipletInfo instead which returns both text and agent data
|
|
17
32
|
* @private [🧠] Maybe public?
|
|
18
33
|
*/
|
|
19
34
|
export declare function getToolCallChipletText(toolCall: ToolCall): string;
|
|
35
|
+
/**
|
|
36
|
+
* Gets the chiplet information including text and agent data (for team tools).
|
|
37
|
+
*
|
|
38
|
+
* @private [🧠] Maybe public?
|
|
39
|
+
*/
|
|
40
|
+
export declare function getToolCallChipletInfo(toolCall: ToolCall): ToolCallChipletInfo;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { string_url, string_url_image } from '../../../types/typeAliases';
|
|
2
|
+
/**
|
|
3
|
+
* Input data for resolving agent profiles.
|
|
4
|
+
* @private
|
|
5
|
+
*/
|
|
6
|
+
export type AgentProfileInput = {
|
|
7
|
+
url: string_url;
|
|
8
|
+
label?: string;
|
|
9
|
+
imageUrl?: string_url_image;
|
|
10
|
+
publicUrl?: string_url;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Resolved agent profile data for UI usage.
|
|
14
|
+
* @private
|
|
15
|
+
*/
|
|
16
|
+
export type AgentProfileData = {
|
|
17
|
+
label: string;
|
|
18
|
+
imageUrl: string_url_image | null;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Extracts agent name from URL.
|
|
22
|
+
* @private
|
|
23
|
+
*/
|
|
24
|
+
export declare function extractAgentNameFromUrl(url: string): string;
|
|
25
|
+
/**
|
|
26
|
+
* Determines whether a label looks like an autogenerated identifier.
|
|
27
|
+
* @private
|
|
28
|
+
*/
|
|
29
|
+
export declare function isLikelyGeneratedId(label: string): boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Resolves the initial label for an agent without exposing generated IDs.
|
|
32
|
+
* @private
|
|
33
|
+
*/
|
|
34
|
+
export declare function resolveInitialAgentLabel(agent: AgentProfileInput): string;
|
|
35
|
+
/**
|
|
36
|
+
* Picks the best available label from profile data without exposing IDs.
|
|
37
|
+
* @private
|
|
38
|
+
*/
|
|
39
|
+
export declare function resolvePreferredAgentLabel(candidates: Array<string | undefined>, fallback: string): string;
|
|
40
|
+
/**
|
|
41
|
+
* Resolves the agents server base URL from the agent URL or provided public URL.
|
|
42
|
+
* @private
|
|
43
|
+
*/
|
|
44
|
+
export declare function resolveAgentsServerUrl(agentUrl: string, publicUrl?: string_url): string | null;
|
|
45
|
+
/**
|
|
46
|
+
* Resolves the profile image URL, handling relative URLs when needed.
|
|
47
|
+
* @private
|
|
48
|
+
*/
|
|
49
|
+
export declare function resolveProfileImageUrl(profileImageUrl: string_url_image | undefined, agentUrl: string_url, publicUrl?: string_url): string_url_image | null;
|
|
50
|
+
/**
|
|
51
|
+
* Builds a placeholder image URL for the agent when no profile image is available.
|
|
52
|
+
* @private
|
|
53
|
+
*/
|
|
54
|
+
export declare function resolvePlaceholderImageUrl(agent: AgentProfileInput): string_url_image | null;
|
|
55
|
+
/**
|
|
56
|
+
* Returns true when a profile fetch would likely improve the label or image.
|
|
57
|
+
* @private
|
|
58
|
+
*/
|
|
59
|
+
export declare function shouldFetchAgentProfile(agent: AgentProfileInput): boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Resolves fallback profile data without fetching remote metadata.
|
|
62
|
+
* @private
|
|
63
|
+
*/
|
|
64
|
+
export declare function resolveAgentProfileFallback(agent: AgentProfileInput): AgentProfileData;
|
|
65
|
+
/**
|
|
66
|
+
* Loads agent profile data from the agent profile endpoint when needed.
|
|
67
|
+
* @private
|
|
68
|
+
*/
|
|
69
|
+
export declare function loadAgentProfile(agent: AgentProfileInput): Promise<AgentProfileData>;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { ChatMessage } from '../types/ChatMessage';
|
|
2
|
+
/**
|
|
3
|
+
* Type representing a parsed citation from RAG sources
|
|
4
|
+
*/
|
|
5
|
+
export type ParsedCitation = {
|
|
6
|
+
/**
|
|
7
|
+
* The unique identifier for the citation (e.g., "5:13")
|
|
8
|
+
*/
|
|
9
|
+
id: string;
|
|
10
|
+
/**
|
|
11
|
+
* The source document name (e.g., "document.pdf")
|
|
12
|
+
*/
|
|
13
|
+
source: string;
|
|
14
|
+
/**
|
|
15
|
+
* Optional URL to the source document
|
|
16
|
+
*/
|
|
17
|
+
url?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Optional preview/excerpt from the source
|
|
20
|
+
*/
|
|
21
|
+
excerpt?: string;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Parses OpenAI Assistant-style citations from message content
|
|
25
|
+
* Matches patterns like: 【5:13†document.pdf】
|
|
26
|
+
*
|
|
27
|
+
* @param content - The markdown content that may contain citations
|
|
28
|
+
* @returns Array of parsed citations
|
|
29
|
+
*
|
|
30
|
+
* @private utility for internal use
|
|
31
|
+
*/
|
|
32
|
+
export declare function parseCitationsFromContent(content: string): ParsedCitation[];
|
|
33
|
+
/**
|
|
34
|
+
* Removes citation markers from content and returns clean text
|
|
35
|
+
*
|
|
36
|
+
* @param content - The markdown content with citations
|
|
37
|
+
* @returns Content with citation markers removed
|
|
38
|
+
*
|
|
39
|
+
* @private utility for internal use
|
|
40
|
+
*/
|
|
41
|
+
export declare function stripCitationsFromContent(content: string): string;
|
|
42
|
+
/**
|
|
43
|
+
* Extracts citations from a chat message if not already present
|
|
44
|
+
*
|
|
45
|
+
* @param message - The chat message to extract citations from
|
|
46
|
+
* @returns The message with citations array populated
|
|
47
|
+
*
|
|
48
|
+
* @private utility for internal use
|
|
49
|
+
*/
|
|
50
|
+
export declare function extractCitationsFromMessage(message: ChatMessage): ChatMessage;
|
|
51
|
+
/**
|
|
52
|
+
* TODO: Maybe spread into multiple files
|
|
53
|
+
*/
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Props for the EmailIcon component.
|
|
3
|
+
*/
|
|
4
|
+
type EmailIconProps = {
|
|
5
|
+
size?: number;
|
|
6
|
+
color?: string;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Renders an email/envelope icon.
|
|
10
|
+
*
|
|
11
|
+
* @param props - SVG properties augmented with an optional `size`
|
|
12
|
+
* @private internal subcomponent used by various components
|
|
13
|
+
*/
|
|
14
|
+
export declare function EmailIcon({ size, color }: EmailIconProps): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { AgentModelRequirements } from '../../book-2.0/agent-source/AgentModelRequirements';
|
|
2
|
+
import { BaseCommitmentDefinition } from '../_base/BaseCommitmentDefinition';
|
|
3
|
+
/**
|
|
4
|
+
* TEMPLATE commitment definition
|
|
5
|
+
*
|
|
6
|
+
* The TEMPLATE commitment enforces a specific response structure or template
|
|
7
|
+
* that the agent must follow when generating responses. This helps ensure
|
|
8
|
+
* consistent message formatting across all agent interactions.
|
|
9
|
+
*
|
|
10
|
+
* Example usage in agent source:
|
|
11
|
+
*
|
|
12
|
+
* ```book
|
|
13
|
+
* TEMPLATE Always structure your response with: 1) Summary, 2) Details, 3) Next steps
|
|
14
|
+
* TEMPLATE Use the following format: **Question:** [user question] | **Answer:** [your answer]
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* When used without content, it enables template mode which instructs the agent
|
|
18
|
+
* to follow any template patterns defined in other commitments or context.
|
|
19
|
+
*
|
|
20
|
+
* @private [🪔] Maybe export the commitments through some package
|
|
21
|
+
*/
|
|
22
|
+
export declare class TemplateCommitmentDefinition extends BaseCommitmentDefinition<'TEMPLATE' | 'TEMPLATES'> {
|
|
23
|
+
constructor(type?: 'TEMPLATE' | 'TEMPLATES');
|
|
24
|
+
/**
|
|
25
|
+
* Short one-line description of TEMPLATE.
|
|
26
|
+
*/
|
|
27
|
+
get description(): string;
|
|
28
|
+
/**
|
|
29
|
+
* Icon for this commitment.
|
|
30
|
+
*/
|
|
31
|
+
get icon(): string;
|
|
32
|
+
/**
|
|
33
|
+
* Markdown documentation for TEMPLATE commitment.
|
|
34
|
+
*/
|
|
35
|
+
get documentation(): string;
|
|
36
|
+
/**
|
|
37
|
+
* TEMPLATE can be used with or without content.
|
|
38
|
+
*/
|
|
39
|
+
get requiresContent(): boolean;
|
|
40
|
+
applyToAgentModelRequirements(requirements: AgentModelRequirements, content: string): AgentModelRequirements;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
44
|
+
*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,11 +1,17 @@
|
|
|
1
|
+
import { string_javascript_name } from '../../_packages/types.index';
|
|
1
2
|
import type { AgentModelRequirements } from '../../book-2.0/agent-source/AgentModelRequirements';
|
|
3
|
+
import { ToolFunction } from '../../scripting/javascript/JavascriptExecutionToolsOptions';
|
|
2
4
|
import { BaseCommitmentDefinition } from '../_base/BaseCommitmentDefinition';
|
|
3
5
|
/**
|
|
4
6
|
* USE BROWSER commitment definition
|
|
5
7
|
*
|
|
6
|
-
* The `USE BROWSER` commitment indicates that the agent should utilize
|
|
8
|
+
* The `USE BROWSER` commitment indicates that the agent should utilize browser tools
|
|
7
9
|
* to access and retrieve up-to-date information from the internet when necessary.
|
|
8
10
|
*
|
|
11
|
+
* This commitment provides two levels of browser access:
|
|
12
|
+
* 1. One-shot URL fetching: Simple function to fetch and scrape URL content
|
|
13
|
+
* 2. Running browser: For complex tasks like scrolling, clicking, etc. (prepared but not active yet)
|
|
14
|
+
*
|
|
9
15
|
* The content following `USE BROWSER` is ignored (similar to NOTE).
|
|
10
16
|
*
|
|
11
17
|
* Example usage in agent source:
|
|
@@ -38,8 +44,16 @@ export declare class UseBrowserCommitmentDefinition extends BaseCommitmentDefini
|
|
|
38
44
|
/**
|
|
39
45
|
* Gets human-readable titles for tool functions provided by this commitment.
|
|
40
46
|
*/
|
|
41
|
-
getToolTitles(): Record<
|
|
47
|
+
getToolTitles(): Record<string_javascript_name, string>;
|
|
42
48
|
applyToAgentModelRequirements(requirements: AgentModelRequirements, content: string): AgentModelRequirements;
|
|
49
|
+
/**
|
|
50
|
+
* Gets the browser tool function implementations.
|
|
51
|
+
*
|
|
52
|
+
* This method automatically detects the environment and uses:
|
|
53
|
+
* - Server-side: Direct scraping via fetchUrlContent (Node.js)
|
|
54
|
+
* - Browser: Proxy through Agents Server API via fetchUrlContentViaBrowser
|
|
55
|
+
*/
|
|
56
|
+
getToolFunctions(): Record<string_javascript_name, ToolFunction>;
|
|
43
57
|
}
|
|
44
58
|
/**
|
|
45
59
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fetches and scrapes content from a URL (SERVER-SIDE ONLY)
|
|
3
|
+
*
|
|
4
|
+
* This function:
|
|
5
|
+
* 1. Fetches the URL content using promptbookFetch
|
|
6
|
+
* 2. Determines the content type (HTML, PDF, etc.)
|
|
7
|
+
* 3. Uses the appropriate scraper to convert to markdown
|
|
8
|
+
* 4. Returns the scraped markdown content
|
|
9
|
+
*
|
|
10
|
+
* @param url The URL to fetch and scrape
|
|
11
|
+
* @returns Markdown content from the URL
|
|
12
|
+
*
|
|
13
|
+
* @private internal utility for USE BROWSER commitment
|
|
14
|
+
*
|
|
15
|
+
* WARNING: This function should NOT be used directly in browser environments.
|
|
16
|
+
* For browser environments, use fetchUrlContentViaBrowser which proxies through
|
|
17
|
+
* the Agents Server API endpoint at /api/scrape
|
|
18
|
+
*/
|
|
19
|
+
export declare function fetchUrlContent(url: string): Promise<string>;
|
|
20
|
+
/**
|
|
21
|
+
* Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
|
|
22
|
+
*/
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Client-side safe wrapper for fetching URL content
|
|
3
|
+
*
|
|
4
|
+
* This function proxies requests to the Agents Server API endpoint for scraping,
|
|
5
|
+
* making it safe to use in browser environments.
|
|
6
|
+
*
|
|
7
|
+
* @param url The URL to fetch and scrape
|
|
8
|
+
* @param agentsServerUrl The base URL of the agents server (defaults to current origin)
|
|
9
|
+
* @returns Markdown content from the URL
|
|
10
|
+
*
|
|
11
|
+
* @private internal utility for USE BROWSER commitment
|
|
12
|
+
*/
|
|
13
|
+
export declare function fetchUrlContentViaBrowser(url: string, agentsServerUrl?: string): Promise<string>;
|