@promptbook/vercel 0.105.0-0 → 0.105.0-10
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 +2 -1
- 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 +4 -0
- package/esm/typings/src/_packages/types.index.d.ts +16 -0
- package/esm/typings/src/_packages/utils.index.d.ts +2 -0
- package/esm/typings/src/book-2.0/agent-source/AgentBasicInformation.d.ts +15 -3
- package/esm/typings/src/book-2.0/agent-source/AgentModelRequirements.d.ts +11 -1
- package/esm/typings/src/book-2.0/agent-source/communication-samples.test.d.ts +1 -0
- package/esm/typings/src/book-2.0/agent-source/createAgentModelRequirementsWithCommitments.blocks.test.d.ts +1 -0
- package/esm/typings/src/book-2.0/agent-source/createAgentModelRequirementsWithCommitments.import.test.d.ts +1 -0
- package/esm/typings/src/book-2.0/agent-source/parseAgentSource.import.test.d.ts +1 -0
- package/esm/typings/src/book-2.0/agent-source/parseAgentSourceWithCommitments.blocks.test.d.ts +1 -0
- package/esm/typings/src/book-components/Chat/AgentChat/AgentChatProps.d.ts +5 -0
- package/esm/typings/src/book-components/Chat/Chat/ChatMessageItem.d.ts +15 -1
- package/esm/typings/src/book-components/Chat/Chat/ChatProps.d.ts +20 -9
- package/esm/typings/src/book-components/Chat/LlmChat/LlmChatProps.d.ts +5 -0
- package/esm/typings/src/book-components/Chat/types/ChatMessage.d.ts +43 -0
- package/esm/typings/src/commitments/NOTE/NOTE.d.ts +2 -2
- package/esm/typings/src/commitments/USE_BROWSER/USE_BROWSER.d.ts +4 -0
- package/esm/typings/src/commitments/USE_SEARCH_ENGINE/USE_SEARCH_ENGINE.d.ts +10 -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 +44 -0
- package/esm/typings/src/commitments/USE_TIME/USE_TIME.test.d.ts +1 -0
- package/esm/typings/src/commitments/_base/BaseCommitmentDefinition.d.ts +14 -0
- package/esm/typings/src/commitments/_base/CommitmentDefinition.d.ts +14 -0
- package/esm/typings/src/commitments/index.d.ts +17 -2
- package/esm/typings/src/config.d.ts +1 -0
- package/esm/typings/src/execution/LlmExecutionTools.d.ts +3 -1
- package/esm/typings/src/import-plugins/$fileImportPlugins.d.ts +7 -0
- package/esm/typings/src/import-plugins/AgentFileImportPlugin.d.ts +7 -0
- package/esm/typings/src/import-plugins/FileImportPlugin.d.ts +24 -0
- package/esm/typings/src/import-plugins/JsonFileImportPlugin.d.ts +7 -0
- package/esm/typings/src/import-plugins/TextFileImportPlugin.d.ts +7 -0
- package/esm/typings/src/llm-providers/_common/utils/cache/cacheLlmTools.d.ts +2 -1
- package/esm/typings/src/llm-providers/_common/utils/count-total-usage/countUsage.d.ts +2 -2
- package/esm/typings/src/llm-providers/agent/Agent.d.ts +14 -2
- package/esm/typings/src/llm-providers/agent/AgentLlmExecutionTools.d.ts +3 -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/openai/OpenAiAssistantExecutionTools.d.ts +10 -0
- package/esm/typings/src/llm-providers/openai/OpenAiCompatibleExecutionTools.d.ts +7 -0
- package/esm/typings/src/llm-providers/remote/RemoteLlmExecutionTools.d.ts +1 -1
- package/esm/typings/src/scripting/javascript/JavascriptExecutionToolsOptions.d.ts +6 -1
- 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 +32 -0
- package/esm/typings/src/types/ModelRequirements.d.ts +6 -12
- package/esm/typings/src/types/SpeechRecognition.d.ts +58 -0
- package/esm/typings/src/types/typeAliases.d.ts +4 -0
- package/esm/typings/src/utils/execCommand/$execCommandNormalizeOptions.d.ts +2 -3
- package/esm/typings/src/utils/execCommand/ExecCommandOptions.d.ts +7 -1
- 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/utils/organization/keepImported.d.ts +9 -0
- package/esm/typings/src/utils/organization/keepTypeImported.d.ts +0 -1
- package/esm/typings/src/utils/random/$generateBookBoilerplate.d.ts +4 -0
- package/esm/typings/src/utils/random/$randomAgentPersona.d.ts +2 -1
- package/esm/typings/src/utils/random/$randomAgentRule.d.ts +14 -0
- package/esm/typings/src/version.d.ts +1 -1
- package/package.json +2 -2
- package/umd/index.umd.js +2 -1
- package/umd/index.umd.js.map +1 -1
|
@@ -29,6 +29,7 @@ import { CountUtils } from '../utils/expectation-counters/index';
|
|
|
29
29
|
import { $getCurrentDate } from '../utils/misc/$getCurrentDate';
|
|
30
30
|
import { computeHash } from '../utils/misc/computeHash';
|
|
31
31
|
import { debounce } from '../utils/misc/debounce';
|
|
32
|
+
import { linguisticHash } from '../utils/misc/linguisticHash';
|
|
32
33
|
import { parseNumber } from '../utils/misc/parseNumber';
|
|
33
34
|
import { capitalize } from '../utils/normalization/capitalize';
|
|
34
35
|
import { decapitalize } from '../utils/normalization/decapitalize';
|
|
@@ -118,6 +119,7 @@ export { CountUtils };
|
|
|
118
119
|
export { $getCurrentDate };
|
|
119
120
|
export { computeHash };
|
|
120
121
|
export { debounce };
|
|
122
|
+
export { linguisticHash };
|
|
121
123
|
export { parseNumber };
|
|
122
124
|
export { capitalize };
|
|
123
125
|
export { decapitalize };
|
|
@@ -31,7 +31,7 @@ export type AgentCapability = {
|
|
|
31
31
|
/**
|
|
32
32
|
* The type of the capability
|
|
33
33
|
*/
|
|
34
|
-
type: 'browser' | 'search-engine' | 'knowledge';
|
|
34
|
+
type: 'browser' | 'search-engine' | 'knowledge' | 'time' | 'inheritance' | 'import';
|
|
35
35
|
/**
|
|
36
36
|
* The label to display for this capability
|
|
37
37
|
*/
|
|
@@ -40,6 +40,11 @@ export type AgentCapability = {
|
|
|
40
40
|
* The name of the icon to display for this capability
|
|
41
41
|
*/
|
|
42
42
|
iconName: string;
|
|
43
|
+
/**
|
|
44
|
+
* Optional link to another agent
|
|
45
|
+
* This is used for 'inheritance' and 'import' types
|
|
46
|
+
*/
|
|
47
|
+
agentUrl?: string_agent_url;
|
|
43
48
|
};
|
|
44
49
|
export type AgentBasicInformation = {
|
|
45
50
|
/**
|
|
@@ -90,12 +95,19 @@ export type AgentBasicInformation = {
|
|
|
90
95
|
* - @Parameter (single word parameter starting with @)
|
|
91
96
|
* - {parameterName} or {parameter with multiple words} or {parameterName: description text}
|
|
92
97
|
*/
|
|
93
|
-
parameters: BookParameter
|
|
98
|
+
parameters: Array<BookParameter>;
|
|
94
99
|
/**
|
|
95
100
|
* Capabilities of the agent
|
|
96
101
|
* This is parsed from commitments like USE BROWSER, USE SEARCH ENGINE, KNOWLEDGE, etc.
|
|
97
102
|
*/
|
|
98
|
-
capabilities: AgentCapability
|
|
103
|
+
capabilities: Array<AgentCapability>;
|
|
104
|
+
/**
|
|
105
|
+
* List of sample conversations (question/answer pairs)
|
|
106
|
+
*/
|
|
107
|
+
samples: Array<{
|
|
108
|
+
question: string | null;
|
|
109
|
+
answer: string;
|
|
110
|
+
}>;
|
|
99
111
|
};
|
|
100
112
|
/**
|
|
101
113
|
* TODO: [🐱🚀] Make all properties of `AgentBasicInformation` readonly
|
|
@@ -32,6 +32,10 @@ export type AgentModelRequirements = {
|
|
|
32
32
|
* List of imported agent URLs
|
|
33
33
|
*/
|
|
34
34
|
readonly importedAgentUrls?: ReadonlyArray<string_agent_url>;
|
|
35
|
+
/**
|
|
36
|
+
* List of imported file URLs or paths
|
|
37
|
+
*/
|
|
38
|
+
readonly importedFileUrls?: ReadonlyArray<string>;
|
|
35
39
|
/**
|
|
36
40
|
* Optional list of knowledge source links that the agent can use
|
|
37
41
|
*/
|
|
@@ -40,7 +44,7 @@ export type AgentModelRequirements = {
|
|
|
40
44
|
* List of sample conversations (question/answer pairs)
|
|
41
45
|
*/
|
|
42
46
|
readonly samples?: ReadonlyArray<{
|
|
43
|
-
question: string;
|
|
47
|
+
question: string | null;
|
|
44
48
|
answer: string;
|
|
45
49
|
}>;
|
|
46
50
|
/**
|
|
@@ -64,6 +68,12 @@ export type AgentModelRequirements = {
|
|
|
64
68
|
* Each commitment can store its own data here
|
|
65
69
|
*/
|
|
66
70
|
readonly metadata?: Record<string, TODO_any>;
|
|
71
|
+
/**
|
|
72
|
+
* Notes associated with the agent
|
|
73
|
+
*
|
|
74
|
+
* Note: This does not affect agent behavior in any way
|
|
75
|
+
*/
|
|
76
|
+
readonly notes?: ReadonlyArray<string>;
|
|
67
77
|
};
|
|
68
78
|
/**
|
|
69
79
|
* TODO: [🐤] DRY `AgentModelRequirements` and `ModelRequirements`
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/esm/typings/src/book-2.0/agent-source/parseAgentSourceWithCommitments.blocks.test.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -10,4 +10,9 @@ export type AgentChatProps = Omit<LlmChatProps, 'thread' | 'llmTools' | 'initial
|
|
|
10
10
|
* The agent to chat with
|
|
11
11
|
*/
|
|
12
12
|
readonly agent: Agent;
|
|
13
|
+
/**
|
|
14
|
+
* Optional mapping of technical tool names to human-readable titles.
|
|
15
|
+
* e.g., { "web_search": "Searching the web..." }
|
|
16
|
+
*/
|
|
17
|
+
readonly toolTitles?: Record<string, string>;
|
|
13
18
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { id } from '../../../types/typeAliases';
|
|
3
|
+
import type { TODO_any } from '../../../utils/organization/TODO_any';
|
|
3
4
|
import type { ChatMessage } from '../types/ChatMessage';
|
|
4
5
|
import type { ChatParticipant } from '../types/ChatParticipant';
|
|
5
6
|
import type { ChatProps } from './ChatProps';
|
|
@@ -33,11 +34,24 @@ type ChatMessageItemProps = Pick<ChatProps, 'onMessage' | 'participants'> & {
|
|
|
33
34
|
* Called when the create agent button is pressed for book code blocks.
|
|
34
35
|
*/
|
|
35
36
|
onCreateAgent?: (bookContent: string) => void;
|
|
37
|
+
/**
|
|
38
|
+
* Optional mapping of technical tool names to human-readable titles.
|
|
39
|
+
* e.g., { "web_search": "Searching the web..." }
|
|
40
|
+
*/
|
|
41
|
+
toolTitles?: Record<string, string>;
|
|
42
|
+
/**
|
|
43
|
+
* Called when a tool call chiplet is clicked.
|
|
44
|
+
*/
|
|
45
|
+
onToolCallClick?: (toolCall: {
|
|
46
|
+
name: string;
|
|
47
|
+
arguments?: TODO_any;
|
|
48
|
+
result?: TODO_any;
|
|
49
|
+
}) => void;
|
|
36
50
|
};
|
|
37
51
|
/**
|
|
38
52
|
* Renders a single chat message item with avatar, content, buttons, and rating.
|
|
39
53
|
*
|
|
40
54
|
* @private internal subcomponent of `<Chat>` component
|
|
41
55
|
*/
|
|
42
|
-
export declare const ChatMessageItem: import("react").MemoExoticComponent<({ message, participant, participants, isLastMessage, onMessage, setExpandedMessageId, isExpanded, currentRating, handleRating, mode, isCopyButtonEnabled, isFeedbackEnabled, onCopy, onCreateAgent, }: ChatMessageItemProps) => import("react/jsx-runtime").JSX.Element>;
|
|
56
|
+
export declare const ChatMessageItem: import("react").MemoExoticComponent<({ message, participant, participants, isLastMessage, onMessage, setExpandedMessageId, isExpanded, currentRating, handleRating, mode, isCopyButtonEnabled, isFeedbackEnabled, onCopy, onCreateAgent, toolTitles, onToolCallClick, }: ChatMessageItemProps) => import("react/jsx-runtime").JSX.Element>;
|
|
43
57
|
export {};
|
|
@@ -5,6 +5,8 @@ import type { ChatMessage } from '../types/ChatMessage';
|
|
|
5
5
|
import type { ChatParticipant } from '../types/ChatParticipant';
|
|
6
6
|
import { string_color } from '../../../types/typeAliases';
|
|
7
7
|
import { Color } from '../../../_packages/color.index';
|
|
8
|
+
import { SpeechRecognition } from '../../../types/SpeechRecognition';
|
|
9
|
+
import type { TODO_any } from '../../../utils/organization/TODO_any';
|
|
8
10
|
/**
|
|
9
11
|
* @public exported from `@promptbook/components`
|
|
10
12
|
*/
|
|
@@ -47,13 +49,9 @@ export type ChatProps = {
|
|
|
47
49
|
*/
|
|
48
50
|
readonly isVoiceRecognitionButtonShown?: boolean;
|
|
49
51
|
/**
|
|
50
|
-
*
|
|
52
|
+
* Speech recognition provider
|
|
51
53
|
*/
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* The language code to use for voice recognition
|
|
55
|
-
*/
|
|
56
|
-
readonly voiceLanguage?: string;
|
|
54
|
+
readonly speechRecognition?: SpeechRecognition;
|
|
57
55
|
/**
|
|
58
56
|
* Optional placeholder message for the textarea
|
|
59
57
|
*
|
|
@@ -152,6 +150,16 @@ export type ChatProps = {
|
|
|
152
150
|
* Keys should match ChatMessage.from values (e.g., 'USER', 'AGENT_{id}', etc.)
|
|
153
151
|
*/
|
|
154
152
|
readonly participants?: ReadonlyArray<ChatParticipant>;
|
|
153
|
+
/**
|
|
154
|
+
* Optional mapping of technical tool names to human-readable titles.
|
|
155
|
+
* e.g., { "web_search": "Searching the web..." }
|
|
156
|
+
*/
|
|
157
|
+
readonly toolTitles?: Record<string, string>;
|
|
158
|
+
/**
|
|
159
|
+
* Optional callback to create a new agent from the template.
|
|
160
|
+
* If provided, renders the [Create Agent] button for book code blocks.
|
|
161
|
+
*/
|
|
162
|
+
onCreateAgent?: (bookContent: string) => void;
|
|
155
163
|
/**
|
|
156
164
|
* Optional callback for handling user feedback on messages
|
|
157
165
|
* When provided, star rating buttons (1-5 stars) will be displayed next to each message
|
|
@@ -188,10 +196,13 @@ export type ChatProps = {
|
|
|
188
196
|
*/
|
|
189
197
|
isCopyButtonEnabled?: boolean;
|
|
190
198
|
/**
|
|
191
|
-
*
|
|
192
|
-
* When provided, "Create Agent" buttons will be shown for book code blocks.
|
|
199
|
+
* Called when a tool call chiplet is clicked.
|
|
193
200
|
*/
|
|
194
|
-
|
|
201
|
+
onToolCallClick?: (toolCall: {
|
|
202
|
+
name: string;
|
|
203
|
+
arguments?: TODO_any;
|
|
204
|
+
result?: TODO_any;
|
|
205
|
+
}) => void;
|
|
195
206
|
};
|
|
196
207
|
/**
|
|
197
208
|
* TODO: [☁️] Export component prop types only to `@promptbook/components` (not `@promptbook/types`)
|
|
@@ -57,4 +57,9 @@ export type LlmChatProps = Omit<ChatProps, 'messages' | 'onMessage' | 'onChange'
|
|
|
57
57
|
* This is useful for seamless transitions from other pages.
|
|
58
58
|
*/
|
|
59
59
|
readonly autoExecuteMessage?: string;
|
|
60
|
+
/**
|
|
61
|
+
* Optional mapping of technical tool names to human-readable titles.
|
|
62
|
+
* e.g., { "web_search": "Searching the web..." }
|
|
63
|
+
*/
|
|
64
|
+
readonly toolTitles?: Record<string, string>;
|
|
60
65
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Message } from '../../../types/Message';
|
|
2
2
|
import type { id, string_markdown } from '../../../types/typeAliases';
|
|
3
|
+
import type { TODO_any } from '../../../utils/organization/TODO_any';
|
|
3
4
|
/**
|
|
4
5
|
* Represents a single message within a chat interface.
|
|
5
6
|
*
|
|
@@ -33,6 +34,48 @@ export type ChatMessage = Omit<Message<id>, 'direction' | 'recipients' | 'thread
|
|
|
33
34
|
* Indicates if the message was sent via a voice call
|
|
34
35
|
*/
|
|
35
36
|
isVoiceCall?: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Optional tool calls made during the execution
|
|
39
|
+
*/
|
|
40
|
+
readonly ongoingToolCalls?: ReadonlyArray<{
|
|
41
|
+
/**
|
|
42
|
+
* Name of the tool
|
|
43
|
+
*/
|
|
44
|
+
readonly name: string;
|
|
45
|
+
/**
|
|
46
|
+
* Arguments for the tool call
|
|
47
|
+
*/
|
|
48
|
+
readonly arguments?: string | Record<string, TODO_any>;
|
|
49
|
+
/**
|
|
50
|
+
* Result of the tool call
|
|
51
|
+
*/
|
|
52
|
+
readonly result?: TODO_any;
|
|
53
|
+
/**
|
|
54
|
+
* Raw tool call from the model
|
|
55
|
+
*/
|
|
56
|
+
readonly rawToolCall?: TODO_any;
|
|
57
|
+
}>;
|
|
58
|
+
/**
|
|
59
|
+
* Optional tool calls that have been completed
|
|
60
|
+
*/
|
|
61
|
+
readonly completedToolCalls?: ReadonlyArray<{
|
|
62
|
+
/**
|
|
63
|
+
* Name of the tool
|
|
64
|
+
*/
|
|
65
|
+
readonly name: string;
|
|
66
|
+
/**
|
|
67
|
+
* Arguments for the tool call
|
|
68
|
+
*/
|
|
69
|
+
readonly arguments?: string | Record<string, TODO_any>;
|
|
70
|
+
/**
|
|
71
|
+
* Result of the tool call
|
|
72
|
+
*/
|
|
73
|
+
readonly result?: TODO_any;
|
|
74
|
+
/**
|
|
75
|
+
* Raw tool call from the model
|
|
76
|
+
*/
|
|
77
|
+
readonly rawToolCall?: TODO_any;
|
|
78
|
+
}>;
|
|
36
79
|
/**
|
|
37
80
|
* Optional file attachments
|
|
38
81
|
*/
|
|
@@ -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
|
*/
|
|
@@ -35,6 +35,10 @@ export declare class UseBrowserCommitmentDefinition extends BaseCommitmentDefini
|
|
|
35
35
|
* Markdown documentation for USE BROWSER commitment.
|
|
36
36
|
*/
|
|
37
37
|
get documentation(): string;
|
|
38
|
+
/**
|
|
39
|
+
* Gets human-readable titles for tool functions provided by this commitment.
|
|
40
|
+
*/
|
|
41
|
+
getToolTitles(): Record<string, string>;
|
|
38
42
|
applyToAgentModelRequirements(requirements: AgentModelRequirements, content: string): AgentModelRequirements;
|
|
39
43
|
}
|
|
40
44
|
/**
|
|
@@ -1,4 +1,6 @@
|
|
|
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 SEARCH ENGINE commitment definition
|
|
@@ -32,6 +34,14 @@ export declare class UseSearchEngineCommitmentDefinition extends BaseCommitmentD
|
|
|
32
34
|
*/
|
|
33
35
|
get documentation(): string;
|
|
34
36
|
applyToAgentModelRequirements(requirements: AgentModelRequirements, content: string): AgentModelRequirements;
|
|
37
|
+
/**
|
|
38
|
+
* Gets human-readable titles for tool functions provided by this commitment.
|
|
39
|
+
*/
|
|
40
|
+
getToolTitles(): Record<string_javascript_name, string>;
|
|
41
|
+
/**
|
|
42
|
+
* Gets the `web_search` tool function implementation.
|
|
43
|
+
*/
|
|
44
|
+
getToolFunctions(): Record<string_javascript_name, ToolFunction>;
|
|
35
45
|
}
|
|
36
46
|
/**
|
|
37
47
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,44 @@
|
|
|
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
|
+
* USE TIME commitment definition
|
|
7
|
+
*
|
|
8
|
+
* The `USE TIME` commitment indicates that the agent should be able to determine the current date and time.
|
|
9
|
+
*
|
|
10
|
+
* Example usage in agent source:
|
|
11
|
+
*
|
|
12
|
+
* ```book
|
|
13
|
+
* USE TIME
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* @private [🪔] Maybe export the commitments through some package
|
|
17
|
+
*/
|
|
18
|
+
export declare class UseTimeCommitmentDefinition extends BaseCommitmentDefinition<'USE TIME'> {
|
|
19
|
+
constructor();
|
|
20
|
+
/**
|
|
21
|
+
* Short one-line description of USE TIME.
|
|
22
|
+
*/
|
|
23
|
+
get description(): string;
|
|
24
|
+
/**
|
|
25
|
+
* Icon for this commitment.
|
|
26
|
+
*/
|
|
27
|
+
get icon(): string;
|
|
28
|
+
/**
|
|
29
|
+
* Markdown documentation for USE TIME commitment.
|
|
30
|
+
*/
|
|
31
|
+
get documentation(): string;
|
|
32
|
+
applyToAgentModelRequirements(requirements: AgentModelRequirements, content: string): AgentModelRequirements;
|
|
33
|
+
/**
|
|
34
|
+
* Gets human-readable titles for tool functions provided by this commitment.
|
|
35
|
+
*/
|
|
36
|
+
getToolTitles(): Record<string_javascript_name, string>;
|
|
37
|
+
/**
|
|
38
|
+
* Gets the `get_current_time` tool function implementation.
|
|
39
|
+
*/
|
|
40
|
+
getToolFunctions(): Record<string_javascript_name, ToolFunction>;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
44
|
+
*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { AgentModelRequirements } from '../../book-2.0/agent-source/AgentModelRequirements';
|
|
2
|
+
import { ToolFunction } from '../../scripting/javascript/JavascriptExecutionToolsOptions';
|
|
3
|
+
import { string_javascript_name } from '../../types/typeAliases';
|
|
2
4
|
import type { CommitmentDefinition } from './CommitmentDefinition';
|
|
3
5
|
/**
|
|
4
6
|
* Base implementation of CommitmentDefinition that provides common functionality
|
|
@@ -61,4 +63,16 @@ export declare abstract class BaseCommitmentDefinition<TBookCommitment extends s
|
|
|
61
63
|
* but can be useful for organizing and structuring the message during processing
|
|
62
64
|
*/
|
|
63
65
|
protected addCommentSection(requirements: AgentModelRequirements, commentTitle: string, content: string, position?: 'beginning' | 'end'): AgentModelRequirements;
|
|
66
|
+
/**
|
|
67
|
+
* Gets tool function implementations provided by this commitment
|
|
68
|
+
*
|
|
69
|
+
* When the `applyToAgentModelRequirements` adds tools to the requirements, this method should return the corresponding function definitions.
|
|
70
|
+
*/
|
|
71
|
+
getToolFunctions(): Record<string_javascript_name, ToolFunction>;
|
|
72
|
+
/**
|
|
73
|
+
* Gets human-readable titles for tool functions provided by this commitment
|
|
74
|
+
*
|
|
75
|
+
* This is used in the UI to show a user-friendly name instead of the technical function name.
|
|
76
|
+
*/
|
|
77
|
+
getToolTitles(): Record<string_javascript_name, string>;
|
|
64
78
|
}
|
|
@@ -1,4 +1,6 @@
|
|
|
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
|
/**
|
|
3
5
|
* Definition of a commitment that can be applied to agent model requirements
|
|
4
6
|
*
|
|
@@ -50,4 +52,16 @@ export type CommitmentDefinition = {
|
|
|
50
52
|
* @returns Updated agent model requirements
|
|
51
53
|
*/
|
|
52
54
|
applyToAgentModelRequirements(requirements: AgentModelRequirements, content: string): AgentModelRequirements;
|
|
55
|
+
/**
|
|
56
|
+
* Gets tool function implementations provided by this commitment
|
|
57
|
+
*
|
|
58
|
+
* When the `applyToAgentModelRequirements` adds tools to the requirements, this method should return the corresponding function definitions.
|
|
59
|
+
*/
|
|
60
|
+
getToolFunctions(): Record<string_javascript_name, ToolFunction>;
|
|
61
|
+
/**
|
|
62
|
+
* Gets human-readable titles for tool functions provided by this commitment
|
|
63
|
+
*
|
|
64
|
+
* This is used in the UI to show a user-friendly name instead of the technical function name.
|
|
65
|
+
*/
|
|
66
|
+
getToolTitles(): Record<string_javascript_name, string>;
|
|
53
67
|
};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { BookCommitment } from './_base/BookCommitment';
|
|
2
2
|
import type { CommitmentDefinition } from './_base/CommitmentDefinition';
|
|
3
|
+
import { ToolFunction } from '../scripting/javascript/JavascriptExecutionToolsOptions';
|
|
4
|
+
import { string_javascript_name } from '../types/typeAliases';
|
|
3
5
|
import { ActionCommitmentDefinition } from './ACTION/ACTION';
|
|
4
6
|
import { ClosedCommitmentDefinition } from './CLOSED/CLOSED';
|
|
5
7
|
import { ComponentCommitmentDefinition } from './COMPONENT/COMPONENT';
|
|
@@ -7,8 +9,8 @@ import { DeleteCommitmentDefinition } from './DELETE/DELETE';
|
|
|
7
9
|
import { DictionaryCommitmentDefinition } from './DICTIONARY/DICTIONARY';
|
|
8
10
|
import { FormatCommitmentDefinition } from './FORMAT/FORMAT';
|
|
9
11
|
import { FromCommitmentDefinition } from './FROM/FROM';
|
|
10
|
-
import { ImportCommitmentDefinition } from './IMPORT/IMPORT';
|
|
11
12
|
import { GoalCommitmentDefinition } from './GOAL/GOAL';
|
|
13
|
+
import { ImportCommitmentDefinition } from './IMPORT/IMPORT';
|
|
12
14
|
import { KnowledgeCommitmentDefinition } from './KNOWLEDGE/KNOWLEDGE';
|
|
13
15
|
import { LanguageCommitmentDefinition } from './LANGUAGE/LANGUAGE';
|
|
14
16
|
import { MemoryCommitmentDefinition } from './MEMORY/MEMORY';
|
|
@@ -33,6 +35,7 @@ import { UseCommitmentDefinition } from './USE/USE';
|
|
|
33
35
|
import { UseBrowserCommitmentDefinition } from './USE_BROWSER/USE_BROWSER';
|
|
34
36
|
import { UseMcpCommitmentDefinition } from './USE_MCP/USE_MCP';
|
|
35
37
|
import { UseSearchEngineCommitmentDefinition } from './USE_SEARCH_ENGINE/USE_SEARCH_ENGINE';
|
|
38
|
+
import { UseTimeCommitmentDefinition } from './USE_TIME/USE_TIME';
|
|
36
39
|
import { NotYetImplementedCommitmentDefinition } from './_base/NotYetImplementedCommitmentDefinition';
|
|
37
40
|
/**
|
|
38
41
|
* Registry of all available commitment definitions
|
|
@@ -41,7 +44,7 @@ import { NotYetImplementedCommitmentDefinition } from './_base/NotYetImplemented
|
|
|
41
44
|
*
|
|
42
45
|
* @private Use functions to access commitments instead of this array directly
|
|
43
46
|
*/
|
|
44
|
-
export declare const COMMITMENT_REGISTRY: readonly [PersonaCommitmentDefinition, PersonaCommitmentDefinition, KnowledgeCommitmentDefinition, MemoryCommitmentDefinition, MemoryCommitmentDefinition, StyleCommitmentDefinition, StyleCommitmentDefinition, RuleCommitmentDefinition, RuleCommitmentDefinition, LanguageCommitmentDefinition, LanguageCommitmentDefinition, SampleCommitmentDefinition, SampleCommitmentDefinition, FormatCommitmentDefinition, FormatCommitmentDefinition, FromCommitmentDefinition, ImportCommitmentDefinition, ImportCommitmentDefinition, ModelCommitmentDefinition, ModelCommitmentDefinition, ActionCommitmentDefinition, ActionCommitmentDefinition, ComponentCommitmentDefinition, MetaImageCommitmentDefinition, MetaColorCommitmentDefinition, MetaFontCommitmentDefinition, MetaLinkCommitmentDefinition, MetaCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, GoalCommitmentDefinition, GoalCommitmentDefinition, InitialMessageCommitmentDefinition, UserMessageCommitmentDefinition, AgentMessageCommitmentDefinition, MessageCommitmentDefinition, MessageCommitmentDefinition, ScenarioCommitmentDefinition, ScenarioCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, DictionaryCommitmentDefinition, OpenCommitmentDefinition, ClosedCommitmentDefinition, UseBrowserCommitmentDefinition, UseSearchEngineCommitmentDefinition, UseMcpCommitmentDefinition, UseCommitmentDefinition, NotYetImplementedCommitmentDefinition<"EXPECT">, NotYetImplementedCommitmentDefinition<"BEHAVIOUR">, NotYetImplementedCommitmentDefinition<"BEHAVIOURS">, NotYetImplementedCommitmentDefinition<"AVOID">, NotYetImplementedCommitmentDefinition<"AVOIDANCE">, NotYetImplementedCommitmentDefinition<"CONTEXT">];
|
|
47
|
+
export declare const COMMITMENT_REGISTRY: readonly [PersonaCommitmentDefinition, PersonaCommitmentDefinition, KnowledgeCommitmentDefinition, MemoryCommitmentDefinition, MemoryCommitmentDefinition, StyleCommitmentDefinition, StyleCommitmentDefinition, RuleCommitmentDefinition, RuleCommitmentDefinition, LanguageCommitmentDefinition, LanguageCommitmentDefinition, SampleCommitmentDefinition, SampleCommitmentDefinition, FormatCommitmentDefinition, FormatCommitmentDefinition, FromCommitmentDefinition, ImportCommitmentDefinition, ImportCommitmentDefinition, ModelCommitmentDefinition, ModelCommitmentDefinition, ActionCommitmentDefinition, ActionCommitmentDefinition, ComponentCommitmentDefinition, MetaImageCommitmentDefinition, MetaColorCommitmentDefinition, MetaFontCommitmentDefinition, MetaLinkCommitmentDefinition, MetaCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, GoalCommitmentDefinition, GoalCommitmentDefinition, InitialMessageCommitmentDefinition, UserMessageCommitmentDefinition, AgentMessageCommitmentDefinition, MessageCommitmentDefinition, MessageCommitmentDefinition, ScenarioCommitmentDefinition, ScenarioCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, DictionaryCommitmentDefinition, OpenCommitmentDefinition, ClosedCommitmentDefinition, UseBrowserCommitmentDefinition, UseSearchEngineCommitmentDefinition, UseTimeCommitmentDefinition, UseMcpCommitmentDefinition, UseCommitmentDefinition, NotYetImplementedCommitmentDefinition<"EXPECT">, NotYetImplementedCommitmentDefinition<"BEHAVIOUR">, NotYetImplementedCommitmentDefinition<"BEHAVIOURS">, NotYetImplementedCommitmentDefinition<"AVOID">, NotYetImplementedCommitmentDefinition<"AVOIDANCE">, NotYetImplementedCommitmentDefinition<"CONTEXT">];
|
|
45
48
|
/**
|
|
46
49
|
* Gets a commitment definition by its type
|
|
47
50
|
* @param type The commitment type to look up
|
|
@@ -89,6 +92,18 @@ export type GroupedCommitmentDefinition = {
|
|
|
89
92
|
* @public exported from `@promptbook/core`
|
|
90
93
|
*/
|
|
91
94
|
export declare function getGroupedCommitmentDefinitions(): ReadonlyArray<GroupedCommitmentDefinition>;
|
|
95
|
+
/**
|
|
96
|
+
* Gets all function implementations provided by all commitments
|
|
97
|
+
*
|
|
98
|
+
* @public exported from `@promptbook/core`
|
|
99
|
+
*/
|
|
100
|
+
export declare function getAllCommitmentsToolFunctions(): Record<string_javascript_name, ToolFunction>;
|
|
101
|
+
/**
|
|
102
|
+
* Gets all tool titles provided by all commitments
|
|
103
|
+
*
|
|
104
|
+
* @public exported from `@promptbook/core`
|
|
105
|
+
*/
|
|
106
|
+
export declare function getAllCommitmentsToolTitles(): Record<string_javascript_name, string>;
|
|
92
107
|
/**
|
|
93
108
|
* TODO: [🧠] Maybe create through standardized $register
|
|
94
109
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -63,6 +63,7 @@ export declare const PROMPTBOOK_SYNTAX_COLORS: {
|
|
|
63
63
|
readonly SEPARATOR: import("./utils/take/interfaces/ITakeChain").WithTake<Color>;
|
|
64
64
|
readonly COMMITMENT: import("./utils/take/interfaces/ITakeChain").WithTake<Color>;
|
|
65
65
|
readonly PARAMETER: import("./utils/take/interfaces/ITakeChain").WithTake<Color>;
|
|
66
|
+
readonly CODE_BLOCK: import("./utils/take/interfaces/ITakeChain").WithTake<Color>;
|
|
66
67
|
};
|
|
67
68
|
/**
|
|
68
69
|
* Chat color of the Promptbook (in chat)
|
|
@@ -56,7 +56,9 @@ export type LlmExecutionTools = {
|
|
|
56
56
|
/**
|
|
57
57
|
* Calls a chat model with streaming
|
|
58
58
|
*/
|
|
59
|
-
callChatModelStream?(prompt: Prompt, onProgress: (chunk: ChatPromptResult
|
|
59
|
+
callChatModelStream?(prompt: Prompt, onProgress: (chunk: ChatPromptResult & {
|
|
60
|
+
isFinished?: boolean;
|
|
61
|
+
}) => void): Promise<ChatPromptResult>;
|
|
60
62
|
/**
|
|
61
63
|
* Calls a voice chat model
|
|
62
64
|
*/
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { string_mime_type } from '../types/typeAliases';
|
|
2
|
+
/**
|
|
3
|
+
* Type for file import plugins
|
|
4
|
+
*
|
|
5
|
+
* Each plugin handles a specific set of MIME types or file extensions.
|
|
6
|
+
*/
|
|
7
|
+
export type FileImportPlugin = {
|
|
8
|
+
/**
|
|
9
|
+
* Unique name of the plugin
|
|
10
|
+
*/
|
|
11
|
+
readonly name: string;
|
|
12
|
+
/**
|
|
13
|
+
* Checks if the plugin can handle the given MIME type or file extension
|
|
14
|
+
*/
|
|
15
|
+
canImport(mimeType: string_mime_type): boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Processes the file content and returns the string to be placed in the agent book
|
|
18
|
+
*
|
|
19
|
+
* @param content - The raw content of the file
|
|
20
|
+
* @param mimeType - The MIME type of the file
|
|
21
|
+
* @returns The processed content (e.g. wrapped in code block)
|
|
22
|
+
*/
|
|
23
|
+
import(content: string, mimeType: string_mime_type): string | Promise<string>;
|
|
24
|
+
};
|
|
@@ -4,9 +4,10 @@ import type { CacheLlmToolsOptions } from './CacheLlmToolsOptions';
|
|
|
4
4
|
* Intercepts LLM tools and counts total usage of the tools
|
|
5
5
|
*
|
|
6
6
|
* Note: It can take extended `LlmExecutionTools` and cache the
|
|
7
|
+
* Note: Returns full proxy of all LLM tool properties and methods
|
|
7
8
|
*
|
|
8
9
|
* @param llmTools LLM tools to be intercepted with usage counting, it can contain extra methods like `totalUsage`
|
|
9
|
-
* @returns LLM tools with same functionality with added
|
|
10
|
+
* @returns Full proxy of LLM tools with same functionality with added caching
|
|
10
11
|
* @public exported from `@promptbook/core`
|
|
11
12
|
*/
|
|
12
13
|
export declare function cacheLlmTools<TLlmTools extends LlmExecutionTools>(llmTools: TLlmTools, options?: Partial<CacheLlmToolsOptions>): TLlmTools;
|
|
@@ -8,10 +8,10 @@ import type { LlmExecutionToolsWithTotalUsage } from './LlmExecutionToolsWithTot
|
|
|
8
8
|
* in real-time through an observable.
|
|
9
9
|
*
|
|
10
10
|
* @param llmTools - The LLM tools to be intercepted and tracked
|
|
11
|
-
* @returns
|
|
11
|
+
* @returns Full proxy of the tools with added usage tracking capabilities
|
|
12
12
|
* @public exported from `@promptbook/core`
|
|
13
13
|
*/
|
|
14
|
-
export declare function countUsage(llmTools:
|
|
14
|
+
export declare function countUsage<TLlmTools extends LlmExecutionTools>(llmTools: TLlmTools): TLlmTools & LlmExecutionToolsWithTotalUsage;
|
|
15
15
|
/**
|
|
16
16
|
* TODO: [🧠][💸] Maybe make some common abstraction `interceptLlmTools` and use here (or use javascript Proxy?)
|
|
17
17
|
* TODO: [🧠] Is there some meaningfull way how to test this util
|
|
@@ -42,7 +42,14 @@ export declare class Agent extends AgentLlmExecutionTools implements LlmExecutio
|
|
|
42
42
|
* Capabilities of the agent
|
|
43
43
|
* This is parsed from commitments like USE BROWSER, USE SEARCH ENGINE, KNOWLEDGE, etc.
|
|
44
44
|
*/
|
|
45
|
-
capabilities: AgentCapability
|
|
45
|
+
capabilities: Array<AgentCapability>;
|
|
46
|
+
/**
|
|
47
|
+
* List of sample conversations (question/answer pairs)
|
|
48
|
+
*/
|
|
49
|
+
samples: Array<{
|
|
50
|
+
question: string | null;
|
|
51
|
+
answer: string;
|
|
52
|
+
}>;
|
|
46
53
|
/**
|
|
47
54
|
* Computed hash of the agent source for integrity verification
|
|
48
55
|
*/
|
|
@@ -60,11 +67,16 @@ export declare class Agent extends AgentLlmExecutionTools implements LlmExecutio
|
|
|
60
67
|
description?: string;
|
|
61
68
|
[key: string]: string | undefined;
|
|
62
69
|
};
|
|
70
|
+
/**
|
|
71
|
+
* Human-readable titles for tool functions
|
|
72
|
+
*/
|
|
73
|
+
toolTitles: Record<string, string>;
|
|
63
74
|
/**
|
|
64
75
|
* Not used in Agent, always returns empty array
|
|
65
76
|
*/
|
|
66
|
-
get parameters(): BookParameter
|
|
77
|
+
get parameters(): Array<BookParameter>;
|
|
67
78
|
readonly agentSource: BehaviorSubject<string_book>;
|
|
79
|
+
private readonly teacherAgent;
|
|
68
80
|
constructor(options: AgentOptions);
|
|
69
81
|
/**
|
|
70
82
|
* Calls the chat model with agent-specific system prompt and requirements with streaming
|
|
@@ -54,8 +54,10 @@ export declare class AgentLlmExecutionTools implements LlmExecutionTools {
|
|
|
54
54
|
private getAgentInfo;
|
|
55
55
|
/**
|
|
56
56
|
* Get cached or create agent model requirements
|
|
57
|
+
*
|
|
58
|
+
* Note: [🐤] This is names `getModelRequirements` *(not `getAgentModelRequirements`)* because in future these two will be united
|
|
57
59
|
*/
|
|
58
|
-
|
|
60
|
+
getModelRequirements(): Promise<AgentModelRequirements>;
|
|
59
61
|
get title(): string_title & string_markdown_text;
|
|
60
62
|
get description(): string_markdown;
|
|
61
63
|
get profile(): ChatParticipant | undefined;
|