@promptbook/color 0.105.0-3 → 0.105.0-31
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 +36 -77
- package/esm/index.es.js +1 -1
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/browser.index.d.ts +4 -0
- package/esm/typings/src/_packages/components.index.d.ts +20 -0
- package/esm/typings/src/_packages/core.index.d.ts +19 -11
- package/esm/typings/src/_packages/node.index.d.ts +2 -0
- package/esm/typings/src/_packages/openai.index.d.ts +2 -0
- package/esm/typings/src/_packages/types.index.d.ts +44 -2
- package/esm/typings/src/_packages/utils.index.d.ts +4 -0
- package/esm/typings/src/book-2.0/agent-source/AgentBasicInformation.d.ts +6 -1
- package/esm/typings/src/book-2.0/agent-source/parseTeamCommitment.d.ts +28 -0
- package/esm/typings/src/book-components/Chat/AgentChat/AgentChatProps.d.ts +5 -0
- 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 +33 -1
- package/esm/typings/src/book-components/Chat/Chat/ChatProps.d.ts +89 -11
- package/esm/typings/src/book-components/Chat/Chat/ChatSoundToggle.d.ts +23 -0
- package/esm/typings/src/book-components/Chat/Chat/ClockIcon.d.ts +9 -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 +13 -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/effects/ChatEffectsSystem.d.ts +14 -0
- package/esm/typings/src/book-components/Chat/effects/components/ConfettiEffect.d.ts +18 -0
- package/esm/typings/src/book-components/Chat/effects/components/HeartsEffect.d.ts +18 -0
- package/esm/typings/src/book-components/Chat/effects/configs/defaultEffectConfigs.d.ts +7 -0
- package/esm/typings/src/book-components/Chat/effects/index.d.ts +18 -0
- package/esm/typings/src/book-components/Chat/effects/types/ChatEffect.d.ts +20 -0
- package/esm/typings/src/book-components/Chat/effects/types/ChatEffectConfig.d.ts +21 -0
- package/esm/typings/src/book-components/Chat/effects/types/ChatEffectType.d.ts +6 -0
- package/esm/typings/src/book-components/Chat/effects/types/ChatEffectsSystemProps.d.ts +32 -0
- package/esm/typings/src/book-components/Chat/effects/utils/detectEffects.d.ts +12 -0
- package/esm/typings/src/book-components/Chat/types/ChatMessage.d.ts +37 -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 +40 -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/Chat/utils/resolveCitationUrl.d.ts +11 -0
- package/esm/typings/src/book-components/Chat/utils/toolCallParsing.d.ts +64 -0
- package/esm/typings/src/book-components/icons/EmailIcon.d.ts +15 -0
- package/esm/typings/src/commitments/NOTE/NOTE.d.ts +2 -2
- package/esm/typings/src/commitments/TEAM/TEAM.d.ts +45 -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 +19 -1
- 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/USE_IMAGE_GENERATOR/USE_IMAGE_GENERATOR.d.ts +46 -0
- package/esm/typings/src/commitments/USE_IMAGE_GENERATOR/USE_IMAGE_GENERATOR.test.d.ts +1 -0
- package/esm/typings/src/commitments/USE_SEARCH_ENGINE/USE_SEARCH_ENGINE.d.ts +11 -0
- package/esm/typings/src/commitments/USE_SEARCH_ENGINE/USE_SEARCH_ENGINE.test.d.ts +1 -0
- package/esm/typings/src/commitments/USE_TIME/USE_TIME.d.ts +6 -0
- package/esm/typings/src/commitments/_base/BaseCommitmentDefinition.d.ts +6 -0
- package/esm/typings/src/commitments/_base/CommitmentDefinition.d.ts +6 -0
- package/esm/typings/src/commitments/_base/formatOptionalInstructionBlock.d.ts +6 -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 +5 -58
- package/esm/typings/src/constants.d.ts +129 -0
- package/esm/typings/src/executables/$provideExecutablesForNode.d.ts +1 -0
- package/esm/typings/src/execution/AvailableModel.d.ts +5 -4
- package/esm/typings/src/execution/LlmExecutionTools.d.ts +3 -1
- package/esm/typings/src/execution/PromptResult.d.ts +2 -19
- package/esm/typings/src/execution/utils/$provideExecutionToolsForNode.d.ts +1 -0
- package/esm/typings/src/llm-providers/agent/Agent.d.ts +7 -1
- package/esm/typings/src/llm-providers/agent/AgentLlmExecutionTools.d.ts +6 -1
- package/esm/typings/src/llm-providers/agent/AgentOptions.d.ts +7 -0
- package/esm/typings/src/llm-providers/agent/RemoteAgent.d.ts +1 -0
- package/esm/typings/src/llm-providers/agent/RemoteAgentOptions.d.ts +1 -1
- package/esm/typings/src/llm-providers/google/createGoogleExecutionTools.d.ts +1 -0
- package/esm/typings/src/llm-providers/openai/OpenAiAgentExecutionTools.d.ts +43 -0
- package/esm/typings/src/llm-providers/openai/OpenAiAssistantExecutionTools.d.ts +4 -2
- package/esm/typings/src/llm-providers/openai/OpenAiCompatibleExecutionTools.d.ts +8 -1
- package/esm/typings/src/llm-providers/openai/utils/uploadFilesToOpenAi.d.ts +7 -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/search-engines/SearchEngine.d.ts +1 -1
- package/esm/typings/src/search-engines/_index.d.ts +6 -0
- package/esm/typings/src/search-engines/bing/BingSearchEngine.d.ts +1 -1
- package/esm/typings/src/search-engines/dummy/DummySearchEngine.d.ts +1 -1
- package/esm/typings/src/search-engines/google/GoogleSearchEngine.d.ts +18 -0
- package/esm/typings/src/search-engines/serp/SerpSearchEngine.d.ts +15 -0
- package/esm/typings/src/speech-recognition/BrowserSpeechRecognition.d.ts +21 -0
- package/esm/typings/src/speech-recognition/OpenAiSpeechRecognition.d.ts +35 -0
- package/esm/typings/src/types/ModelRequirements.d.ts +6 -0
- package/esm/typings/src/types/Prompt.d.ts +12 -0
- package/esm/typings/src/types/SpeechRecognition.d.ts +58 -0
- package/esm/typings/src/types/ToolCall.d.ts +37 -0
- package/esm/typings/src/types/typeAliases.d.ts +4 -0
- package/esm/typings/src/utils/misc/linguisticHash.d.ts +6 -0
- package/esm/typings/src/utils/misc/linguisticHash.test.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 -2
- package/umd/index.umd.js +1 -1
- package/umd/index.umd.js.map +1 -1
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
type HeartsEffectProps = {
|
|
2
|
+
/**
|
|
3
|
+
* Unique identifier for this effect instance
|
|
4
|
+
*/
|
|
5
|
+
effectId: string;
|
|
6
|
+
/**
|
|
7
|
+
* Callback when the effect completes
|
|
8
|
+
*/
|
|
9
|
+
onComplete?: () => void;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Hearts effect component
|
|
13
|
+
* Renders floating hearts that rise from the bottom of the screen
|
|
14
|
+
*
|
|
15
|
+
* @public exported from `@promptbook/components`
|
|
16
|
+
*/
|
|
17
|
+
export declare function HeartsEffect(props: HeartsEffectProps): import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Chat effects system exports
|
|
3
|
+
*
|
|
4
|
+
* @packageDocumentation
|
|
5
|
+
*/
|
|
6
|
+
export { ChatEffectsSystem } from './ChatEffectsSystem';
|
|
7
|
+
export { ConfettiEffect } from './components/ConfettiEffect';
|
|
8
|
+
export { HeartsEffect } from './components/HeartsEffect';
|
|
9
|
+
export { defaultEffectConfigs } from './configs/defaultEffectConfigs';
|
|
10
|
+
export type { ChatEffect } from './types/ChatEffect';
|
|
11
|
+
export type { ChatEffectConfig } from './types/ChatEffectConfig';
|
|
12
|
+
export type { ChatEffectsSystemProps } from './types/ChatEffectsSystemProps';
|
|
13
|
+
export type { ChatEffectType } from './types/ChatEffectType';
|
|
14
|
+
export { detectEffects } from './utils/detectEffects';
|
|
15
|
+
/**
|
|
16
|
+
* TODO: !!!!! To rules: Do not create index files that re-ex-port from multiple files, import directly instead or use full register
|
|
17
|
+
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
18
|
+
*/
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { ChatEffectType } from './ChatEffectType';
|
|
2
|
+
/**
|
|
3
|
+
* Represents a chat effect instance
|
|
4
|
+
*
|
|
5
|
+
* @public exported from `@promptbook/components`
|
|
6
|
+
*/
|
|
7
|
+
export type ChatEffect = {
|
|
8
|
+
/**
|
|
9
|
+
* Unique identifier for this effect instance
|
|
10
|
+
*/
|
|
11
|
+
id: string;
|
|
12
|
+
/**
|
|
13
|
+
* Type of effect
|
|
14
|
+
*/
|
|
15
|
+
type: ChatEffectType;
|
|
16
|
+
/**
|
|
17
|
+
* Timestamp when the effect was triggered
|
|
18
|
+
*/
|
|
19
|
+
timestamp: number;
|
|
20
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ChatEffectType } from './ChatEffectType';
|
|
2
|
+
/**
|
|
3
|
+
* Configuration for a chat effect trigger
|
|
4
|
+
*
|
|
5
|
+
* @public exported from `@promptbook/components`
|
|
6
|
+
*/
|
|
7
|
+
export type ChatEffectConfig = {
|
|
8
|
+
/**
|
|
9
|
+
* Emoji or pattern that triggers this effect
|
|
10
|
+
*/
|
|
11
|
+
trigger: string | RegExp;
|
|
12
|
+
/**
|
|
13
|
+
* Type of effect to trigger
|
|
14
|
+
*/
|
|
15
|
+
effectType: ChatEffectType;
|
|
16
|
+
/**
|
|
17
|
+
* Whether to match all heart emojis (❤️, 💙, 💚, etc.)
|
|
18
|
+
* Only relevant for heart effects
|
|
19
|
+
*/
|
|
20
|
+
matchAllHeartEmojis?: boolean;
|
|
21
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { ChatSoundSystem } from '../../Chat/ChatProps';
|
|
2
|
+
import type { ChatMessage } from '../../types/ChatMessage';
|
|
3
|
+
import type { ChatEffectConfig } from './ChatEffectConfig';
|
|
4
|
+
/**
|
|
5
|
+
* Props for the ChatEffectsSystem component
|
|
6
|
+
*
|
|
7
|
+
* @public exported from `@promptbook/components`
|
|
8
|
+
*/
|
|
9
|
+
export type ChatEffectsSystemProps = {
|
|
10
|
+
/**
|
|
11
|
+
* Array of chat messages to monitor for effect triggers
|
|
12
|
+
*/
|
|
13
|
+
messages: ReadonlyArray<ChatMessage>;
|
|
14
|
+
/**
|
|
15
|
+
* Array of effect configurations
|
|
16
|
+
* Defines which emojis/patterns trigger which effects
|
|
17
|
+
*/
|
|
18
|
+
effectConfigs: ReadonlyArray<ChatEffectConfig>;
|
|
19
|
+
/**
|
|
20
|
+
* Optional filter function to determine if a message should trigger effects
|
|
21
|
+
* By default, only agent messages trigger effects
|
|
22
|
+
*/
|
|
23
|
+
shouldTriggerEffect?: (message: ChatMessage) => boolean;
|
|
24
|
+
/**
|
|
25
|
+
* CSS class name for the effects container
|
|
26
|
+
*/
|
|
27
|
+
className?: string;
|
|
28
|
+
/**
|
|
29
|
+
* Optional sound system to play sounds when effects are triggered
|
|
30
|
+
*/
|
|
31
|
+
soundSystem?: ChatSoundSystem;
|
|
32
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ChatMessage } from '../../types/ChatMessage';
|
|
2
|
+
import type { ChatEffectConfig } from '../types/ChatEffectConfig';
|
|
3
|
+
import type { ChatEffectType } from '../types/ChatEffectType';
|
|
4
|
+
/**
|
|
5
|
+
* Detects which effects should be triggered based on message content
|
|
6
|
+
*
|
|
7
|
+
* @param message - The chat message to analyze
|
|
8
|
+
* @param effectConfigs - Array of effect configurations
|
|
9
|
+
* @returns Array of unique effect types to trigger
|
|
10
|
+
* @private utility function of Effects system
|
|
11
|
+
*/
|
|
12
|
+
export declare function detectEffects(message: ChatMessage, effectConfigs: ReadonlyArray<ChatEffectConfig>): ChatEffectType[];
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { Message } from '../../../types/Message';
|
|
2
|
+
import type { ToolCall } from '../../../types/ToolCall';
|
|
2
3
|
import type { id, string_markdown } from '../../../types/typeAliases';
|
|
4
|
+
export type ChatToolCall = ToolCall;
|
|
3
5
|
/**
|
|
4
6
|
* Represents a single message within a chat interface.
|
|
5
7
|
*
|
|
@@ -33,6 +35,20 @@ export type ChatMessage = Omit<Message<id>, 'direction' | 'recipients' | 'thread
|
|
|
33
35
|
* Indicates if the message was sent via a voice call
|
|
34
36
|
*/
|
|
35
37
|
isVoiceCall?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Optional tool calls made during the execution
|
|
40
|
+
*/
|
|
41
|
+
readonly ongoingToolCalls?: ReadonlyArray<ChatToolCall>;
|
|
42
|
+
/**
|
|
43
|
+
* Optional tool calls used to produce this message.
|
|
44
|
+
*/
|
|
45
|
+
readonly toolCalls?: ReadonlyArray<ChatToolCall>;
|
|
46
|
+
/**
|
|
47
|
+
* Optional tool calls that have been completed
|
|
48
|
+
*
|
|
49
|
+
* @deprecated Use `toolCalls` instead.
|
|
50
|
+
*/
|
|
51
|
+
readonly completedToolCalls?: ReadonlyArray<ChatToolCall>;
|
|
36
52
|
/**
|
|
37
53
|
* Optional file attachments
|
|
38
54
|
*/
|
|
@@ -50,6 +66,27 @@ export type ChatMessage = Omit<Message<id>, 'direction' | 'recipients' | 'thread
|
|
|
50
66
|
*/
|
|
51
67
|
url: string;
|
|
52
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
|
+
}>;
|
|
53
90
|
};
|
|
54
91
|
/**
|
|
55
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;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { ToolCall } from '../../../types/ToolCall';
|
|
2
|
+
import type { AgentChipData } from '../AgentChip';
|
|
3
|
+
/**
|
|
4
|
+
* Utility to format tool call information for user-friendly display.
|
|
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
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Technical to user-friendly tool names and emojis
|
|
21
|
+
*
|
|
22
|
+
* @private [🧠] Maybe public?
|
|
23
|
+
*/
|
|
24
|
+
export declare const TOOL_TITLES: Record<string, {
|
|
25
|
+
title: string;
|
|
26
|
+
emoji: string;
|
|
27
|
+
}>;
|
|
28
|
+
/**
|
|
29
|
+
* Gets the user-friendly text for a tool call chiplet.
|
|
30
|
+
*
|
|
31
|
+
* @deprecated Use getToolCallChipletInfo instead which returns both text and agent data
|
|
32
|
+
* @private [🧠] Maybe public?
|
|
33
|
+
*/
|
|
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,11 @@
|
|
|
1
|
+
import { ChatParticipant } from '../types/ChatParticipant';
|
|
2
|
+
/**
|
|
3
|
+
* Resolves the URL for a citation source by looking up KNOWLEDGE commitments in the agent's source code.
|
|
4
|
+
*
|
|
5
|
+
* @param source - The source filename (e.g. "document.pdf")
|
|
6
|
+
* @param participants - List of chat participants to search in
|
|
7
|
+
* @returns The resolved URL if found, or null
|
|
8
|
+
*
|
|
9
|
+
* @private utility of <Chat/> component
|
|
10
|
+
*/
|
|
11
|
+
export declare function resolveCitationUrl(source: string, participants: ReadonlyArray<ChatParticipant>): string | null;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { ToolCall } from '../../../types/ToolCall';
|
|
2
|
+
import type { TODO_any } from '../../../utils/organization/TODO_any';
|
|
3
|
+
/**
|
|
4
|
+
* @@@
|
|
5
|
+
*
|
|
6
|
+
* @private utility of `<Chat/>` component
|
|
7
|
+
*/
|
|
8
|
+
export declare function parseToolCallArguments(toolCall: Pick<ToolCall, 'arguments'>): Record<string, TODO_any>;
|
|
9
|
+
/**
|
|
10
|
+
* @@@
|
|
11
|
+
*
|
|
12
|
+
* @private utility of `<Chat/>` component
|
|
13
|
+
*/
|
|
14
|
+
export declare function parseToolCallResult(result: ToolCall['result']): TODO_any;
|
|
15
|
+
type SearchResultsExtraction = {
|
|
16
|
+
results: Array<TODO_any>;
|
|
17
|
+
rawText: string | null;
|
|
18
|
+
};
|
|
19
|
+
export type TeamToolResult = {
|
|
20
|
+
teammate?: {
|
|
21
|
+
url?: string;
|
|
22
|
+
label?: string;
|
|
23
|
+
instructions?: string;
|
|
24
|
+
toolName?: string;
|
|
25
|
+
};
|
|
26
|
+
request?: string;
|
|
27
|
+
response?: string;
|
|
28
|
+
error?: string | null;
|
|
29
|
+
conversation?: Array<{
|
|
30
|
+
sender?: string;
|
|
31
|
+
name?: string;
|
|
32
|
+
role?: string;
|
|
33
|
+
content?: string;
|
|
34
|
+
}>;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* @@@
|
|
38
|
+
*
|
|
39
|
+
* @private utility of `<Chat/>` component
|
|
40
|
+
*/
|
|
41
|
+
export declare function extractSearchResults(resultRaw: TODO_any): SearchResultsExtraction;
|
|
42
|
+
/**
|
|
43
|
+
* @@@
|
|
44
|
+
*
|
|
45
|
+
* @private utility of `<Chat/>` component
|
|
46
|
+
*/
|
|
47
|
+
export declare function parseTeamToolResult(resultRaw: TODO_any): TeamToolResult | null;
|
|
48
|
+
/**
|
|
49
|
+
* @@@
|
|
50
|
+
*
|
|
51
|
+
* @private utility of `<Chat/>` component
|
|
52
|
+
*/
|
|
53
|
+
export declare function getToolCallTimestamp(toolCall: Pick<ToolCall, 'createdAt'>): Date | null;
|
|
54
|
+
/**
|
|
55
|
+
* @@@
|
|
56
|
+
*
|
|
57
|
+
* @private utility of `<Chat/>` component
|
|
58
|
+
*/
|
|
59
|
+
export declare function getToolCallResultDate(result: ToolCall['result']): Date | null;
|
|
60
|
+
export {};
|
|
61
|
+
/**
|
|
62
|
+
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
63
|
+
* <- TODO: But maybe split into multiple files later?
|
|
64
|
+
*/
|
|
@@ -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 {};
|
|
@@ -26,8 +26,8 @@ import { BaseCommitmentDefinition } from '../_base/BaseCommitmentDefinition';
|
|
|
26
26
|
*
|
|
27
27
|
* @private [🪔] Maybe export the commitments through some package
|
|
28
28
|
*/
|
|
29
|
-
export declare class NoteCommitmentDefinition extends BaseCommitmentDefinition<'NOTE' | 'NOTES' | 'COMMENT' | 'NONCE'> {
|
|
30
|
-
constructor(type?: 'NOTE' | 'NOTES' | 'COMMENT' | 'NONCE');
|
|
29
|
+
export declare class NoteCommitmentDefinition extends BaseCommitmentDefinition<'NOTE' | 'NOTES' | 'COMMENT' | 'NONCE' | 'TODO'> {
|
|
30
|
+
constructor(type?: 'NOTE' | 'NOTES' | 'COMMENT' | 'NONCE' | 'TODO');
|
|
31
31
|
/**
|
|
32
32
|
* Short one-line description of NOTE.
|
|
33
33
|
*/
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { string_javascript_name } from '../../_packages/types.index';
|
|
2
|
+
import type { AgentModelRequirements } from '../../book-2.0/agent-source/AgentModelRequirements';
|
|
3
|
+
import { ToolFunction } from '../../scripting/javascript/JavascriptExecutionToolsOptions';
|
|
4
|
+
import { BaseCommitmentDefinition } from '../_base/BaseCommitmentDefinition';
|
|
5
|
+
/**
|
|
6
|
+
* TEAM commitment definition
|
|
7
|
+
*
|
|
8
|
+
* The `TEAM` commitment defines teammates that the agent can consult via tools.
|
|
9
|
+
*
|
|
10
|
+
* Example usage in agent source:
|
|
11
|
+
*
|
|
12
|
+
* ```book
|
|
13
|
+
* TEAM https://agents.ptbk.ik/agents/joe-green
|
|
14
|
+
* TEAM You can talk with http://localhost:4440/agents/GMw67JN8TXxN7y to discuss the legal aspects.
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* @private [??] Maybe export the commitments through some package
|
|
18
|
+
*/
|
|
19
|
+
export declare class TeamCommitmentDefinition extends BaseCommitmentDefinition<'TEAM'> {
|
|
20
|
+
constructor();
|
|
21
|
+
/**
|
|
22
|
+
* Short one-line description of TEAM.
|
|
23
|
+
*/
|
|
24
|
+
get description(): string;
|
|
25
|
+
/**
|
|
26
|
+
* Icon for this commitment.
|
|
27
|
+
*/
|
|
28
|
+
get icon(): string;
|
|
29
|
+
/**
|
|
30
|
+
* Markdown documentation for TEAM commitment.
|
|
31
|
+
*/
|
|
32
|
+
get documentation(): string;
|
|
33
|
+
applyToAgentModelRequirements(requirements: AgentModelRequirements, content: string): AgentModelRequirements;
|
|
34
|
+
/**
|
|
35
|
+
* Gets human-readable titles for tool functions provided by this commitment.
|
|
36
|
+
*/
|
|
37
|
+
getToolTitles(): Record<string_javascript_name, string>;
|
|
38
|
+
/**
|
|
39
|
+
* Gets tool function implementations for teammate tools.
|
|
40
|
+
*/
|
|
41
|
+
getToolFunctions(): Record<string_javascript_name, ToolFunction>;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
45
|
+
*/
|
|
@@ -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:
|
|
@@ -35,7 +41,19 @@ export declare class UseBrowserCommitmentDefinition extends BaseCommitmentDefini
|
|
|
35
41
|
* Markdown documentation for USE BROWSER commitment.
|
|
36
42
|
*/
|
|
37
43
|
get documentation(): string;
|
|
44
|
+
/**
|
|
45
|
+
* Gets human-readable titles for tool functions provided by this commitment.
|
|
46
|
+
*/
|
|
47
|
+
getToolTitles(): Record<string_javascript_name, string>;
|
|
38
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>;
|
|
39
57
|
}
|
|
40
58
|
/**
|
|
41
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>;
|