@promptbook/types 0.104.0-0 โ 0.104.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/esm/typings/src/_packages/core.index.d.ts +2 -0
- package/esm/typings/src/_packages/types.index.d.ts +10 -2
- package/esm/typings/src/book-2.0/agent-source/AgentBasicInformation.d.ts +6 -1
- package/esm/typings/src/book-2.0/agent-source/createAgentModelRequirements.d.ts +6 -6
- package/esm/typings/src/book-2.0/agent-source/createAgentModelRequirementsWithCommitments.closed.test.d.ts +1 -0
- package/esm/typings/src/book-2.0/utils/generatePlaceholderAgentProfileImageUrl.d.ts +3 -3
- package/esm/typings/src/book-components/Chat/Chat/ChatMessageItem.d.ts +5 -1
- package/esm/typings/src/book-components/Chat/Chat/ChatProps.d.ts +5 -0
- package/esm/typings/src/book-components/Chat/CodeBlock/CodeBlock.d.ts +13 -0
- package/esm/typings/src/book-components/Chat/MarkdownContent/MarkdownContent.d.ts +1 -0
- package/esm/typings/src/book-components/Chat/types/ChatMessage.d.ts +7 -11
- package/esm/typings/src/book-components/_common/Dropdown/Dropdown.d.ts +2 -2
- package/esm/typings/src/book-components/_common/MenuHoisting/MenuHoistingContext.d.ts +56 -0
- package/esm/typings/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentCollectionInSupabase.d.ts +21 -11
- package/esm/typings/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentsDatabaseSchema.d.ts +80 -14
- package/esm/typings/src/commitments/DICTIONARY/DICTIONARY.d.ts +46 -0
- package/esm/typings/src/commitments/index.d.ts +2 -1
- package/esm/typings/src/llm-providers/_multiple/MultipleLlmExecutionTools.d.ts +6 -2
- package/esm/typings/src/llm-providers/agent/AgentLlmExecutionTools.d.ts +1 -1
- package/esm/typings/src/llm-providers/ollama/OllamaExecutionTools.d.ts +1 -1
- package/esm/typings/src/llm-providers/openai/createOpenAiCompatibleExecutionTools.d.ts +1 -1
- package/esm/typings/src/llm-providers/remote/RemoteLlmExecutionTools.d.ts +1 -0
- package/esm/typings/src/types/Message.d.ts +49 -0
- package/esm/typings/src/types/ModelRequirements.d.ts +38 -14
- package/esm/typings/src/types/typeAliases.d.ts +23 -1
- package/esm/typings/src/utils/color/utils/colorToDataUrl.d.ts +2 -1
- package/esm/typings/src/utils/environment/$detectRuntimeEnvironment.d.ts +4 -4
- package/esm/typings/src/utils/environment/$isRunningInBrowser.d.ts +1 -1
- package/esm/typings/src/utils/environment/$isRunningInJest.d.ts +1 -1
- package/esm/typings/src/utils/environment/$isRunningInNode.d.ts +1 -1
- package/esm/typings/src/utils/environment/$isRunningInWebWorker.d.ts +1 -1
- package/esm/typings/src/utils/markdown/extractAllBlocksFromMarkdown.d.ts +2 -2
- package/esm/typings/src/utils/markdown/extractOneBlockFromMarkdown.d.ts +2 -2
- package/esm/typings/src/utils/random/$randomBase58.d.ts +12 -0
- package/esm/typings/src/version.d.ts +1 -1
- package/package.json +2 -2
- package/esm/typings/src/book-2.0/utils/generateGravatarUrl.d.ts +0 -10
|
@@ -191,6 +191,7 @@ import { SectionTypes } from '../types/SectionType';
|
|
|
191
191
|
import { TaskTypes } from '../types/TaskType';
|
|
192
192
|
import { aboutPromptbookInformation } from '../utils/misc/aboutPromptbookInformation';
|
|
193
193
|
import { $generateBookBoilerplate } from '../utils/random/$generateBookBoilerplate';
|
|
194
|
+
import { CORE_SERVER } from '../../servers';
|
|
194
195
|
import { REMOTE_SERVER_URLS } from '../../servers';
|
|
195
196
|
import { AUTO_FEDERATED_AGENT_SERVER_URLS } from '../../servers';
|
|
196
197
|
export { BOOK_LANGUAGE_VERSION, PROMPTBOOK_ENGINE_VERSION };
|
|
@@ -386,5 +387,6 @@ export { SectionTypes };
|
|
|
386
387
|
export { TaskTypes };
|
|
387
388
|
export { aboutPromptbookInformation };
|
|
388
389
|
export { $generateBookBoilerplate };
|
|
390
|
+
export { CORE_SERVER };
|
|
389
391
|
export { REMOTE_SERVER_URLS };
|
|
390
392
|
export { AUTO_FEDERATED_AGENT_SERVER_URLS };
|
|
@@ -185,6 +185,7 @@ import type { BookTranspiler } from '../transpilers/_common/BookTranspiler';
|
|
|
185
185
|
import type { BookTranspilerOptions } from '../transpilers/_common/BookTranspilerOptions';
|
|
186
186
|
import type { IntermediateFilesStrategy } from '../types/IntermediateFilesStrategy';
|
|
187
187
|
import type { LlmCall } from '../types/LlmCall';
|
|
188
|
+
import type { Message } from '../types/Message';
|
|
188
189
|
import type { ModelRequirements } from '../types/ModelRequirements';
|
|
189
190
|
import type { CompletionModelRequirements } from '../types/ModelRequirements';
|
|
190
191
|
import type { ChatModelRequirements } from '../types/ModelRequirements';
|
|
@@ -205,6 +206,7 @@ import type { string_char_emoji } from '../types/typeAliasEmoji';
|
|
|
205
206
|
import type { string_business_category_name } from '../types/typeAliases';
|
|
206
207
|
import type { string_model_name } from '../types/typeAliases';
|
|
207
208
|
import type { string_prompt } from '../types/typeAliases';
|
|
209
|
+
import type { string_prompt_image } from '../types/typeAliases';
|
|
208
210
|
import type { string_template } from '../types/typeAliases';
|
|
209
211
|
import type { string_text_prompt } from '../types/typeAliases';
|
|
210
212
|
import type { string_chat_prompt } from '../types/typeAliases';
|
|
@@ -225,6 +227,7 @@ import type { string_title } from '../types/typeAliases';
|
|
|
225
227
|
import type { string_agent_name } from '../types/typeAliases';
|
|
226
228
|
import type { string_agent_name_in_book } from '../types/typeAliases';
|
|
227
229
|
import type { string_agent_hash } from '../types/typeAliases';
|
|
230
|
+
import type { string_agent_permanent_id } from '../types/typeAliases';
|
|
228
231
|
import type { string_persona_description } from '../types/typeAliases';
|
|
229
232
|
import type { string_model_description } from '../types/typeAliases';
|
|
230
233
|
import type { string_knowledge_source_content } from '../types/typeAliases';
|
|
@@ -275,6 +278,7 @@ import type { string_uuid } from '../types/typeAliases';
|
|
|
275
278
|
import type { string_app_id } from '../types/typeAliases';
|
|
276
279
|
import type { string_user_id } from '../types/typeAliases';
|
|
277
280
|
import type { string_sha256 } from '../types/typeAliases';
|
|
281
|
+
import type { string_base_58 } from '../types/typeAliases';
|
|
278
282
|
import type { string_semantic_version } from '../types/typeAliases';
|
|
279
283
|
import type { string_version_dependency } from '../types/typeAliases';
|
|
280
284
|
import type { string_file_extension } from '../types/typeAliases';
|
|
@@ -337,7 +341,7 @@ import type { ColorTransformer } from '../utils/color/operators/ColorTransformer
|
|
|
337
341
|
import type { PipelineEditableSerialized } from '../utils/editable/types/PipelineEditableSerialized';
|
|
338
342
|
import type { ExecCommandOptions } from '../utils/execCommand/ExecCommandOptions';
|
|
339
343
|
import type { ExecCommandOptionsAdvanced } from '../utils/execCommand/ExecCommandOptions';
|
|
340
|
-
import type {
|
|
344
|
+
import type { MarkdownCodeBlock } from '../utils/markdown/extractAllBlocksFromMarkdown';
|
|
341
345
|
import type { MarkdownSection } from '../utils/markdown/parseMarkdownSection';
|
|
342
346
|
import type { Registered } from '../utils/misc/$Register';
|
|
343
347
|
import type { Registration } from '../utils/misc/$Register';
|
|
@@ -549,6 +553,7 @@ export type { BookTranspiler };
|
|
|
549
553
|
export type { BookTranspilerOptions };
|
|
550
554
|
export type { IntermediateFilesStrategy };
|
|
551
555
|
export type { LlmCall };
|
|
556
|
+
export type { Message };
|
|
552
557
|
export type { ModelRequirements };
|
|
553
558
|
export type { CompletionModelRequirements };
|
|
554
559
|
export type { ChatModelRequirements };
|
|
@@ -569,6 +574,7 @@ export type { string_char_emoji };
|
|
|
569
574
|
export type { string_business_category_name };
|
|
570
575
|
export type { string_model_name };
|
|
571
576
|
export type { string_prompt };
|
|
577
|
+
export type { string_prompt_image };
|
|
572
578
|
export type { string_template };
|
|
573
579
|
export type { string_text_prompt };
|
|
574
580
|
export type { string_chat_prompt };
|
|
@@ -589,6 +595,7 @@ export type { string_title };
|
|
|
589
595
|
export type { string_agent_name };
|
|
590
596
|
export type { string_agent_name_in_book };
|
|
591
597
|
export type { string_agent_hash };
|
|
598
|
+
export type { string_agent_permanent_id };
|
|
592
599
|
export type { string_persona_description };
|
|
593
600
|
export type { string_model_description };
|
|
594
601
|
export type { string_knowledge_source_content };
|
|
@@ -639,6 +646,7 @@ export type { string_uuid };
|
|
|
639
646
|
export type { string_app_id };
|
|
640
647
|
export type { string_user_id };
|
|
641
648
|
export type { string_sha256 };
|
|
649
|
+
export type { string_base_58 };
|
|
642
650
|
export type { string_semantic_version };
|
|
643
651
|
export type { string_version_dependency };
|
|
644
652
|
export type { string_file_extension };
|
|
@@ -701,7 +709,7 @@ export type { ColorTransformer };
|
|
|
701
709
|
export type { PipelineEditableSerialized };
|
|
702
710
|
export type { ExecCommandOptions };
|
|
703
711
|
export type { ExecCommandOptionsAdvanced };
|
|
704
|
-
export type {
|
|
712
|
+
export type { MarkdownCodeBlock };
|
|
705
713
|
export type { MarkdownSection };
|
|
706
714
|
export type { Registered };
|
|
707
715
|
export type { Registration };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { string_agent_hash, string_agent_name, string_agent_url, string_color, string_fonts, string_url_image } from '../../types/typeAliases';
|
|
1
|
+
import type { string_agent_hash, string_agent_name, string_agent_permanent_id, string_agent_url, string_color, string_fonts, string_url_image } from '../../types/typeAliases';
|
|
2
2
|
/**
|
|
3
3
|
* Unified parameter representation that supports two different notations:
|
|
4
4
|
* 1. @Parameter - single word parameter starting with @
|
|
@@ -33,6 +33,11 @@ export type AgentBasicInformation = {
|
|
|
33
33
|
* Hash of the agent source for integrity verification
|
|
34
34
|
*/
|
|
35
35
|
agentHash: string_agent_hash;
|
|
36
|
+
/**
|
|
37
|
+
* Unique identifier of the agent
|
|
38
|
+
* This is a random base58 string assigned by the server
|
|
39
|
+
*/
|
|
40
|
+
permanentId?: string_agent_permanent_id;
|
|
36
41
|
/**
|
|
37
42
|
* Optional description of the agent
|
|
38
43
|
* This is the line starting with "PERSONA"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AvailableModel } from '../../execution/AvailableModel';
|
|
2
2
|
import type { LlmExecutionTools } from '../../execution/LlmExecutionTools';
|
|
3
|
-
import type { string_model_name } from '../../types/typeAliases';
|
|
3
|
+
import type { string_agent_name, string_model_name, string_system_message, string_url_image } from '../../types/typeAliases';
|
|
4
4
|
import type { AgentModelRequirements } from './AgentModelRequirements';
|
|
5
5
|
import type { string_book } from './string_book';
|
|
6
6
|
/**
|
|
@@ -27,18 +27,18 @@ export declare function extractMcpServers(agentSource: string_book): string[];
|
|
|
27
27
|
* @deprecated Use createAgentModelRequirements instead
|
|
28
28
|
* @private
|
|
29
29
|
*/
|
|
30
|
-
export declare function createAgentSystemMessage(agentSource: string_book): Promise<
|
|
30
|
+
export declare function createAgentSystemMessage(agentSource: string_book): Promise<string_system_message>;
|
|
31
31
|
/**
|
|
32
32
|
* Extracts the agent name from the first line of the agent source
|
|
33
33
|
* @deprecated Use parseAgentSource instead
|
|
34
34
|
* @private
|
|
35
35
|
*/
|
|
36
|
-
export declare function extractAgentName(agentSource: string_book):
|
|
36
|
+
export declare function extractAgentName(agentSource: string_book): string_agent_name;
|
|
37
37
|
/**
|
|
38
|
-
* Extracts the profile image URL from agent source or returns
|
|
38
|
+
* Extracts the profile image URL from agent source or returns default avatar fallback
|
|
39
39
|
* @param agentSource The agent source string that may contain META IMAGE line
|
|
40
|
-
* @returns Profile image URL (from source or
|
|
40
|
+
* @returns Profile image URL (from source or default avatar fallback)
|
|
41
41
|
* @deprecated Use parseAgentSource instead
|
|
42
42
|
* @private
|
|
43
43
|
*/
|
|
44
|
-
export declare function extractAgentProfileImage(agentSource: string_book):
|
|
44
|
+
export declare function extractAgentProfileImage(agentSource: string_book): string_url_image | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import type { string_agent_name, string_url_image } from '../../types/typeAliases';
|
|
1
|
+
import type { string_agent_name, string_agent_permanent_id, string_url, string_url_image } from '../../types/typeAliases';
|
|
2
2
|
/**
|
|
3
3
|
* Generates an image for the agent to use as profile image
|
|
4
4
|
*
|
|
5
|
-
* @param
|
|
5
|
+
* @param agentId - The permanent ID of the agent
|
|
6
6
|
* @returns The placeholder profile image URL for the agent
|
|
7
7
|
*
|
|
8
8
|
* @public exported from `@promptbook/core`
|
|
9
9
|
*/
|
|
10
|
-
export declare function generatePlaceholderAgentProfileImageUrl(
|
|
10
|
+
export declare function generatePlaceholderAgentProfileImageUrl(agentIdOrName: string_agent_permanent_id | string_agent_name, agentsServerUrl?: URL | string_url): string_url_image;
|
|
11
11
|
/**
|
|
12
12
|
* TODO: [๐คน] Figure out best placeholder image generator https://i.pravatar.cc/1000?u=568
|
|
13
13
|
*/
|
|
@@ -29,11 +29,15 @@ type ChatMessageItemProps = Pick<ChatProps, 'onMessage' | 'participants'> & {
|
|
|
29
29
|
* Called when the copy button is pressed.
|
|
30
30
|
*/
|
|
31
31
|
onCopy?: () => void;
|
|
32
|
+
/**
|
|
33
|
+
* Called when the create agent button is pressed for book code blocks.
|
|
34
|
+
*/
|
|
35
|
+
onCreateAgent?: (bookContent: string) => void;
|
|
32
36
|
};
|
|
33
37
|
/**
|
|
34
38
|
* Renders a single chat message item with avatar, content, buttons, and rating.
|
|
35
39
|
*
|
|
36
40
|
* @private internal subcomponent of `<Chat>` component
|
|
37
41
|
*/
|
|
38
|
-
export declare const ChatMessageItem: import("react").MemoExoticComponent<({ message, participant, participants, isLastMessage, onMessage, setExpandedMessageId, isExpanded, currentRating, handleRating, mode, isCopyButtonEnabled, isFeedbackEnabled, onCopy, }: ChatMessageItemProps) => import("react/jsx-runtime").JSX.Element>;
|
|
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>;
|
|
39
43
|
export {};
|
|
@@ -187,6 +187,11 @@ export type ChatProps = {
|
|
|
187
187
|
* @default true
|
|
188
188
|
*/
|
|
189
189
|
isCopyButtonEnabled?: boolean;
|
|
190
|
+
/**
|
|
191
|
+
* Optional callback for creating an agent from a book code block.
|
|
192
|
+
* When provided, "Create Agent" buttons will be shown for book code blocks.
|
|
193
|
+
*/
|
|
194
|
+
onCreateAgent?: (bookContent: string) => void;
|
|
190
195
|
};
|
|
191
196
|
/**
|
|
192
197
|
* TODO: [โ๏ธ] Export component prop types only to `@promptbook/components` (not `@promptbook/types`)
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
type CodeBlockProps = {
|
|
2
|
+
code: string;
|
|
3
|
+
language?: string;
|
|
4
|
+
className?: string;
|
|
5
|
+
onCreateAgent?: (bookContent: string) => void;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Component to render a code block with syntax highlighting, copy, download, and create agent options.
|
|
9
|
+
*
|
|
10
|
+
* @private Internal utility of `<ChatMessage />` component
|
|
11
|
+
*/
|
|
12
|
+
export declare function CodeBlock({ code, language, className, onCreateAgent }: CodeBlockProps): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export {};
|
|
@@ -2,6 +2,7 @@ import type { string_markdown } from '../../../types/typeAliases';
|
|
|
2
2
|
type MarkdownContentProps = {
|
|
3
3
|
content: string_markdown;
|
|
4
4
|
className?: string;
|
|
5
|
+
onCreateAgent?: (bookContent: string) => void;
|
|
5
6
|
};
|
|
6
7
|
/**
|
|
7
8
|
* Renders markdown content with support for code highlighting, math, and tables.
|
|
@@ -1,22 +1,17 @@
|
|
|
1
|
+
import { Message } from '../../../types/Message';
|
|
1
2
|
import type { id, string_markdown } from '../../../types/typeAliases';
|
|
2
3
|
/**
|
|
3
4
|
* A message in the chat
|
|
4
5
|
*
|
|
5
6
|
* @public exported from `@promptbook/components`
|
|
6
7
|
*/
|
|
7
|
-
export type ChatMessage = {
|
|
8
|
+
export type ChatMessage = Omit<Message<id>, 'direction' | 'recipients' | 'threadId' | 'metadata'> & {
|
|
8
9
|
/**
|
|
9
|
-
*
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Date when the message was created
|
|
14
|
-
*/
|
|
15
|
-
date?: Date;
|
|
16
|
-
/**
|
|
17
|
-
* The name of the participant who sent the message
|
|
10
|
+
* Force the channel to be 'PROMPTBOOK_CHAT'
|
|
11
|
+
*
|
|
12
|
+
* @default 'PROMPTBOOK_CHAT'
|
|
18
13
|
*/
|
|
19
|
-
|
|
14
|
+
channel?: 'PROMPTBOOK_CHAT';
|
|
20
15
|
/**
|
|
21
16
|
* The content of the message with optional markdown formatting
|
|
22
17
|
*/
|
|
@@ -37,6 +32,7 @@ export type ChatMessage = {
|
|
|
37
32
|
isVoiceCall?: boolean;
|
|
38
33
|
};
|
|
39
34
|
/**
|
|
35
|
+
* TODO: Make all fields readonly
|
|
40
36
|
* TODO: Delete `expectedAnswer` from ChatMessage
|
|
41
37
|
* TODO: Rename `date` into `created`+`modified`
|
|
42
38
|
*/
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Item that can be hoisted to the top menu
|
|
4
|
+
*
|
|
5
|
+
* @private mechanism inside Promptbook
|
|
6
|
+
*/
|
|
7
|
+
export type HoistedMenuItem = {
|
|
8
|
+
/**
|
|
9
|
+
* Unique key for the menu item
|
|
10
|
+
*/
|
|
11
|
+
key?: string;
|
|
12
|
+
/**
|
|
13
|
+
* Icon to display
|
|
14
|
+
*/
|
|
15
|
+
icon: ReactNode;
|
|
16
|
+
/**
|
|
17
|
+
* Name/Tooltip of the item
|
|
18
|
+
*/
|
|
19
|
+
name: string;
|
|
20
|
+
/**
|
|
21
|
+
* Action to perform when clicked
|
|
22
|
+
*/
|
|
23
|
+
onClick: () => void;
|
|
24
|
+
/**
|
|
25
|
+
* If true, the item is active/toggled
|
|
26
|
+
*/
|
|
27
|
+
isActive?: boolean;
|
|
28
|
+
};
|
|
29
|
+
type MenuHoistingContextType = {
|
|
30
|
+
/**
|
|
31
|
+
* The currently hoisted menu items
|
|
32
|
+
*/
|
|
33
|
+
menu: HoistedMenuItem[];
|
|
34
|
+
/**
|
|
35
|
+
* Set the hoisted menu items
|
|
36
|
+
*/
|
|
37
|
+
setMenu: (items: HoistedMenuItem[]) => void;
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* Provider for menu hoisting
|
|
41
|
+
*
|
|
42
|
+
* @private mechanism inside Promptbook
|
|
43
|
+
*/
|
|
44
|
+
export declare function MenuHoistingProvider({ children }: {
|
|
45
|
+
children: ReactNode;
|
|
46
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
47
|
+
/**
|
|
48
|
+
* Hook to use the menu hoisting system
|
|
49
|
+
*
|
|
50
|
+
* @private mechanism inside Promptbook
|
|
51
|
+
*/
|
|
52
|
+
export declare function useMenuHoisting(): MenuHoistingContextType | null;
|
|
53
|
+
export {};
|
|
54
|
+
/**
|
|
55
|
+
* Note: [๐] Ignore a discrepancy between file name and entity name
|
|
56
|
+
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { SupabaseClient } from '@supabase/supabase-js';
|
|
2
2
|
import type { AgentBasicInformation } from '../../../../book-2.0/agent-source/AgentBasicInformation';
|
|
3
3
|
import type { string_book } from '../../../../book-2.0/agent-source/string_book';
|
|
4
|
-
import type { string_agent_name } from '../../../../types/typeAliases';
|
|
4
|
+
import type { string_agent_name, string_agent_permanent_id } from '../../../../types/typeAliases';
|
|
5
5
|
import { AgentCollectionInSupabaseOptions } from './AgentCollectionInSupabaseOptions';
|
|
6
6
|
import type { AgentsDatabaseSchema } from './AgentsDatabaseSchema';
|
|
7
7
|
/**
|
|
@@ -28,38 +28,48 @@ export declare class AgentCollectionInSupabase {
|
|
|
28
28
|
/**
|
|
29
29
|
* [๐ฑโ๐]@@@
|
|
30
30
|
*/
|
|
31
|
-
|
|
31
|
+
getAgentPermanentId(agentNameOrPermanentId: string_agent_name | string_agent_permanent_id): Promise<string_agent_permanent_id>;
|
|
32
|
+
/**
|
|
33
|
+
* [๐ฑโ๐]@@@
|
|
34
|
+
*/
|
|
35
|
+
getAgentSource(agentNameOrPermanentId: string_agent_name | string_agent_permanent_id): Promise<string_book>;
|
|
32
36
|
/**
|
|
33
37
|
* Creates a new agent in the collection
|
|
34
38
|
*
|
|
35
39
|
* Note: You can set 'PARENT' in the agent source to inherit from another agent in the collection.
|
|
36
40
|
*/
|
|
37
|
-
createAgent(agentSource: string_book): Promise<AgentBasicInformation
|
|
41
|
+
createAgent(agentSource: string_book): Promise<AgentBasicInformation & Required<Pick<AgentBasicInformation, 'permanentId'>>>;
|
|
38
42
|
/**
|
|
39
43
|
* Updates an existing agent in the collection
|
|
40
44
|
*/
|
|
41
|
-
updateAgentSource(
|
|
45
|
+
updateAgentSource(permanentId: string_agent_permanent_id, agentSource: string_book): Promise<void>;
|
|
42
46
|
/**
|
|
43
|
-
*
|
|
47
|
+
* List agents that are soft deleted (deletedAt IS NOT NULL)
|
|
44
48
|
*/
|
|
45
|
-
|
|
49
|
+
listDeletedAgents(): Promise<ReadonlyArray<AgentBasicInformation>>;
|
|
46
50
|
/**
|
|
47
51
|
* List history of an agent
|
|
48
52
|
*/
|
|
49
|
-
listAgentHistory(
|
|
53
|
+
listAgentHistory(permanentId: string_agent_permanent_id): Promise<ReadonlyArray<{
|
|
50
54
|
id: number;
|
|
51
55
|
createdAt: string;
|
|
52
56
|
agentHash: string;
|
|
53
57
|
promptbookEngineVersion: string;
|
|
54
58
|
}>>;
|
|
55
59
|
/**
|
|
56
|
-
*
|
|
60
|
+
* Restore a soft-deleted agent by setting deletedAt to NULL
|
|
61
|
+
*/
|
|
62
|
+
restoreAgent(permanentId: string_agent_permanent_id): Promise<void>;
|
|
63
|
+
/**
|
|
64
|
+
* Restore an agent from a specific history entry
|
|
65
|
+
*
|
|
66
|
+
* This will update the current agent with the source from the history entry
|
|
57
67
|
*/
|
|
58
|
-
|
|
68
|
+
restoreAgentFromHistory(historyId: number): Promise<void>;
|
|
59
69
|
/**
|
|
60
|
-
*
|
|
70
|
+
* Soft delete an agent by setting deletedAt to current timestamp
|
|
61
71
|
*/
|
|
62
|
-
|
|
72
|
+
deleteAgent(permanentId: string_agent_permanent_id): Promise<void>;
|
|
63
73
|
/**
|
|
64
74
|
* Get the Supabase table name with prefix
|
|
65
75
|
*
|
|
@@ -3,11 +3,12 @@
|
|
|
3
3
|
* Source of truth: `/apps/agents-server/src/database/schema.sql` *(do not edit table structure here manually)*
|
|
4
4
|
*
|
|
5
5
|
* [๐ฝ] Prompt:
|
|
6
|
-
* Re-generate this sub-schema
|
|
6
|
+
* Re-generate this sub-schema from `/apps/agents-server/src/database/schema.ts` *(which was generated from `/apps/agents-server/src/database/migrations/*.sql`)*
|
|
7
|
+
* `AgentsDatabaseSchema` is strict subset of `AgentsServerDatabase`
|
|
7
8
|
* Generate Supabase TypeScript schema which is a subset of `AgentsServerDatabase`
|
|
8
9
|
* containing only tables `Agent` and `AgentHistory`
|
|
9
10
|
*
|
|
10
|
-
* NOTE: This file intentionally omits all other tables (
|
|
11
|
+
* NOTE: This file intentionally omits all other tables (`Metadata`, `ChatHistory`, `ChatFeedback`, `User`, `LlmCache`, etc.)
|
|
11
12
|
* and any extra schemas (e.g. `graphql_public`) to remain a strict subset.
|
|
12
13
|
*/
|
|
13
14
|
export type Json = string | number | boolean | null | {
|
|
@@ -22,6 +23,7 @@ export type AgentsDatabaseSchema = {
|
|
|
22
23
|
agentName: string;
|
|
23
24
|
createdAt: string;
|
|
24
25
|
updatedAt: string | null;
|
|
26
|
+
permanentId: string | null;
|
|
25
27
|
agentHash: string;
|
|
26
28
|
agentSource: string;
|
|
27
29
|
agentProfile: Json;
|
|
@@ -29,12 +31,15 @@ export type AgentsDatabaseSchema = {
|
|
|
29
31
|
usage: Json | null;
|
|
30
32
|
preparedModelRequirements: Json | null;
|
|
31
33
|
preparedExternals: Json | null;
|
|
34
|
+
deletedAt: string | null;
|
|
35
|
+
visibility: 'PUBLIC' | 'PRIVATE';
|
|
32
36
|
};
|
|
33
37
|
Insert: {
|
|
34
38
|
id?: number;
|
|
35
39
|
agentName: string;
|
|
36
40
|
createdAt: string;
|
|
37
41
|
updatedAt?: string | null;
|
|
42
|
+
permanentId?: string | null;
|
|
38
43
|
agentHash: string;
|
|
39
44
|
agentSource: string;
|
|
40
45
|
agentProfile: Json;
|
|
@@ -42,12 +47,15 @@ export type AgentsDatabaseSchema = {
|
|
|
42
47
|
usage?: Json | null;
|
|
43
48
|
preparedModelRequirements?: Json | null;
|
|
44
49
|
preparedExternals?: Json | null;
|
|
50
|
+
deletedAt?: string | null;
|
|
51
|
+
visibility?: 'PUBLIC' | 'PRIVATE';
|
|
45
52
|
};
|
|
46
53
|
Update: {
|
|
47
54
|
id?: number;
|
|
48
55
|
agentName?: string;
|
|
49
56
|
createdAt?: string;
|
|
50
57
|
updatedAt?: string | null;
|
|
58
|
+
permanentId?: string | null;
|
|
51
59
|
agentHash?: string;
|
|
52
60
|
agentSource?: string;
|
|
53
61
|
agentProfile?: Json;
|
|
@@ -55,6 +63,8 @@ export type AgentsDatabaseSchema = {
|
|
|
55
63
|
usage?: Json | null;
|
|
56
64
|
preparedModelRequirements?: Json | null;
|
|
57
65
|
preparedExternals?: Json | null;
|
|
66
|
+
deletedAt?: string | null;
|
|
67
|
+
visibility?: 'PUBLIC' | 'PRIVATE';
|
|
58
68
|
};
|
|
59
69
|
Relationships: [];
|
|
60
70
|
};
|
|
@@ -63,6 +73,7 @@ export type AgentsDatabaseSchema = {
|
|
|
63
73
|
id: number;
|
|
64
74
|
createdAt: string;
|
|
65
75
|
agentName: string;
|
|
76
|
+
permanentId: string;
|
|
66
77
|
agentHash: string;
|
|
67
78
|
previousAgentHash: string | null;
|
|
68
79
|
agentSource: string;
|
|
@@ -72,6 +83,7 @@ export type AgentsDatabaseSchema = {
|
|
|
72
83
|
id?: number;
|
|
73
84
|
createdAt: string;
|
|
74
85
|
agentName: string;
|
|
86
|
+
permanentId: string;
|
|
75
87
|
agentHash: string;
|
|
76
88
|
previousAgentHash?: string | null;
|
|
77
89
|
agentSource: string;
|
|
@@ -81,26 +93,80 @@ export type AgentsDatabaseSchema = {
|
|
|
81
93
|
id?: number;
|
|
82
94
|
createdAt?: string;
|
|
83
95
|
agentName?: string;
|
|
96
|
+
permanentId?: string;
|
|
84
97
|
agentHash?: string;
|
|
85
98
|
previousAgentHash?: string | null;
|
|
86
99
|
agentSource?: string;
|
|
87
100
|
promptbookEngineVersion?: string;
|
|
88
101
|
};
|
|
102
|
+
Relationships: [
|
|
103
|
+
{
|
|
104
|
+
foreignKeyName: 'AgentHistory_permanentId_fkey';
|
|
105
|
+
columns: ['permanentId'];
|
|
106
|
+
referencedRelation: 'Agent';
|
|
107
|
+
referencedColumns: ['permanentId'];
|
|
108
|
+
}
|
|
109
|
+
];
|
|
110
|
+
};
|
|
111
|
+
GenerationLock: {
|
|
112
|
+
Row: {
|
|
113
|
+
id: number;
|
|
114
|
+
createdAt: string;
|
|
115
|
+
updatedAt: string;
|
|
116
|
+
lockKey: string;
|
|
117
|
+
expiresAt: string;
|
|
118
|
+
};
|
|
119
|
+
Insert: {
|
|
120
|
+
id?: number;
|
|
121
|
+
createdAt?: string;
|
|
122
|
+
updatedAt?: string;
|
|
123
|
+
lockKey: string;
|
|
124
|
+
expiresAt: string;
|
|
125
|
+
};
|
|
126
|
+
Update: {
|
|
127
|
+
id?: number;
|
|
128
|
+
createdAt?: string;
|
|
129
|
+
updatedAt?: string;
|
|
130
|
+
lockKey?: string;
|
|
131
|
+
expiresAt?: string;
|
|
132
|
+
};
|
|
133
|
+
Relationships: [];
|
|
134
|
+
};
|
|
135
|
+
Image: {
|
|
136
|
+
Row: {
|
|
137
|
+
id: number;
|
|
138
|
+
createdAt: string;
|
|
139
|
+
updatedAt: string;
|
|
140
|
+
filename: string;
|
|
141
|
+
prompt: string;
|
|
142
|
+
cdnUrl: string;
|
|
143
|
+
cdnKey: string;
|
|
144
|
+
};
|
|
145
|
+
Insert: {
|
|
146
|
+
id?: number;
|
|
147
|
+
createdAt?: string;
|
|
148
|
+
updatedAt?: string;
|
|
149
|
+
filename: string;
|
|
150
|
+
prompt: string;
|
|
151
|
+
cdnUrl: string;
|
|
152
|
+
cdnKey: string;
|
|
153
|
+
};
|
|
154
|
+
Update: {
|
|
155
|
+
id?: number;
|
|
156
|
+
createdAt?: string;
|
|
157
|
+
updatedAt?: string;
|
|
158
|
+
filename?: string;
|
|
159
|
+
prompt?: string;
|
|
160
|
+
cdnUrl?: string;
|
|
161
|
+
cdnKey?: string;
|
|
162
|
+
};
|
|
89
163
|
Relationships: [];
|
|
90
164
|
};
|
|
91
165
|
};
|
|
92
|
-
Views:
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
[_ in never]: never;
|
|
97
|
-
};
|
|
98
|
-
Enums: {
|
|
99
|
-
[_ in never]: never;
|
|
100
|
-
};
|
|
101
|
-
CompositeTypes: {
|
|
102
|
-
[_ in never]: never;
|
|
103
|
-
};
|
|
166
|
+
Views: Record<string, never>;
|
|
167
|
+
Functions: Record<string, never>;
|
|
168
|
+
Enums: Record<string, never>;
|
|
169
|
+
CompositeTypes: Record<string, never>;
|
|
104
170
|
};
|
|
105
171
|
};
|
|
106
172
|
type PublicSchema = AgentsDatabaseSchema[Extract<keyof AgentsDatabaseSchema, 'public'>];
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { AgentModelRequirements } from '../../book-2.0/agent-source/AgentModelRequirements';
|
|
2
|
+
import { BaseCommitmentDefinition } from '../_base/BaseCommitmentDefinition';
|
|
3
|
+
/**
|
|
4
|
+
* DICTIONARY commitment definition
|
|
5
|
+
*
|
|
6
|
+
* The DICTIONARY commitment defines specific terms and their meanings that the agent should use correctly
|
|
7
|
+
* in its reasoning and responses. This ensures consistent terminology usage.
|
|
8
|
+
*
|
|
9
|
+
* Key features:
|
|
10
|
+
* - Multiple DICTIONARY commitments are automatically merged into one
|
|
11
|
+
* - Content is placed in a dedicated section of the system message
|
|
12
|
+
* - Terms and definitions are stored in metadata.DICTIONARY for debugging
|
|
13
|
+
* - Agent should use the defined terms correctly in responses
|
|
14
|
+
*
|
|
15
|
+
* Example usage in agent source:
|
|
16
|
+
*
|
|
17
|
+
* ```book
|
|
18
|
+
* Legal Assistant
|
|
19
|
+
*
|
|
20
|
+
* PERSONA You are a knowledgeable legal assistant
|
|
21
|
+
* DICTIONARY Misdemeanor is a minor wrongdoing or criminal offense
|
|
22
|
+
* DICTIONARY Felony is a serious crime usually punishable by imprisonment for more than one year
|
|
23
|
+
* DICTIONARY Tort is a civil wrong that causes harm or loss to another person, leading to legal liability
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* @private [๐ช] Maybe export the commitments through some package
|
|
27
|
+
*/
|
|
28
|
+
export declare class DictionaryCommitmentDefinition extends BaseCommitmentDefinition<'DICTIONARY'> {
|
|
29
|
+
constructor();
|
|
30
|
+
/**
|
|
31
|
+
* Short one-line description of DICTIONARY.
|
|
32
|
+
*/
|
|
33
|
+
get description(): string;
|
|
34
|
+
/**
|
|
35
|
+
* Icon for this commitment.
|
|
36
|
+
*/
|
|
37
|
+
get icon(): string;
|
|
38
|
+
/**
|
|
39
|
+
* Markdown documentation for DICTIONARY commitment.
|
|
40
|
+
*/
|
|
41
|
+
get documentation(): string;
|
|
42
|
+
applyToAgentModelRequirements(requirements: AgentModelRequirements, content: string): AgentModelRequirements;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Note: [๐] Ignore a discrepancy between file name and entity name
|
|
46
|
+
*/
|
|
@@ -4,6 +4,7 @@ import { ActionCommitmentDefinition } from './ACTION/ACTION';
|
|
|
4
4
|
import { ClosedCommitmentDefinition } from './CLOSED/CLOSED';
|
|
5
5
|
import { ComponentCommitmentDefinition } from './COMPONENT/COMPONENT';
|
|
6
6
|
import { DeleteCommitmentDefinition } from './DELETE/DELETE';
|
|
7
|
+
import { DictionaryCommitmentDefinition } from './DICTIONARY/DICTIONARY';
|
|
7
8
|
import { FormatCommitmentDefinition } from './FORMAT/FORMAT';
|
|
8
9
|
import { FromCommitmentDefinition } from './FROM/FROM';
|
|
9
10
|
import { GoalCommitmentDefinition } from './GOAL/GOAL';
|
|
@@ -39,7 +40,7 @@ import { NotYetImplementedCommitmentDefinition } from './_base/NotYetImplemented
|
|
|
39
40
|
*
|
|
40
41
|
* @private Use functions to access commitments instead of this array directly
|
|
41
42
|
*/
|
|
42
|
-
export declare const COMMITMENT_REGISTRY: readonly [PersonaCommitmentDefinition, PersonaCommitmentDefinition, KnowledgeCommitmentDefinition, MemoryCommitmentDefinition, MemoryCommitmentDefinition, StyleCommitmentDefinition, StyleCommitmentDefinition, RuleCommitmentDefinition, RuleCommitmentDefinition, LanguageCommitmentDefinition, LanguageCommitmentDefinition, SampleCommitmentDefinition, SampleCommitmentDefinition, FormatCommitmentDefinition, FormatCommitmentDefinition, FromCommitmentDefinition, 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, OpenCommitmentDefinition, ClosedCommitmentDefinition, UseBrowserCommitmentDefinition, UseSearchEngineCommitmentDefinition, UseMcpCommitmentDefinition, UseCommitmentDefinition, NotYetImplementedCommitmentDefinition<"EXPECT">, NotYetImplementedCommitmentDefinition<"BEHAVIOUR">, NotYetImplementedCommitmentDefinition<"BEHAVIOURS">, NotYetImplementedCommitmentDefinition<"AVOID">, NotYetImplementedCommitmentDefinition<"AVOIDANCE">, NotYetImplementedCommitmentDefinition<"CONTEXT">];
|
|
43
|
+
export declare const COMMITMENT_REGISTRY: readonly [PersonaCommitmentDefinition, PersonaCommitmentDefinition, KnowledgeCommitmentDefinition, MemoryCommitmentDefinition, MemoryCommitmentDefinition, StyleCommitmentDefinition, StyleCommitmentDefinition, RuleCommitmentDefinition, RuleCommitmentDefinition, LanguageCommitmentDefinition, LanguageCommitmentDefinition, SampleCommitmentDefinition, SampleCommitmentDefinition, FormatCommitmentDefinition, FormatCommitmentDefinition, FromCommitmentDefinition, 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">];
|
|
43
44
|
/**
|
|
44
45
|
* Gets a commitment definition by its type
|
|
45
46
|
* @param type The commitment type to look up
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { ChatParticipant } from '../../book-components/Chat/types/ChatParticipant';
|
|
2
2
|
import type { AvailableModel } from '../../execution/AvailableModel';
|
|
3
3
|
import type { LlmExecutionTools } from '../../execution/LlmExecutionTools';
|
|
4
|
-
import type { ChatPromptResult, CompletionPromptResult, EmbeddingPromptResult, PromptResult } from '../../execution/PromptResult';
|
|
5
|
-
import type { ChatPrompt, CompletionPrompt, EmbeddingPrompt, Prompt } from '../../types/Prompt';
|
|
4
|
+
import type { ChatPromptResult, CompletionPromptResult, EmbeddingPromptResult, ImagePromptResult, PromptResult } from '../../execution/PromptResult';
|
|
5
|
+
import type { ChatPrompt, CompletionPrompt, EmbeddingPrompt, ImagePrompt, Prompt } from '../../types/Prompt';
|
|
6
6
|
import type { string_markdown, string_markdown_text, string_title } from '../../types/typeAliases';
|
|
7
7
|
/**
|
|
8
8
|
* Multiple LLM Execution Tools is a proxy server that uses multiple execution tools internally and exposes the executor interface externally.
|
|
@@ -43,6 +43,10 @@ export declare class MultipleLlmExecutionTools implements LlmExecutionTools {
|
|
|
43
43
|
* Calls the best available embedding model
|
|
44
44
|
*/
|
|
45
45
|
callEmbeddingModel(prompt: EmbeddingPrompt): Promise<EmbeddingPromptResult>;
|
|
46
|
+
/**
|
|
47
|
+
* Calls the best available embedding model
|
|
48
|
+
*/
|
|
49
|
+
callImageGenerationModel(prompt: ImagePrompt): Promise<ImagePromptResult>;
|
|
46
50
|
/**
|
|
47
51
|
* Calls the best available model
|
|
48
52
|
*
|
|
@@ -22,7 +22,7 @@ import type { CreateAgentLlmExecutionToolsOptions } from './CreateAgentLlmExecut
|
|
|
22
22
|
* @public exported from `@promptbook/core`
|
|
23
23
|
*/
|
|
24
24
|
export declare class AgentLlmExecutionTools implements LlmExecutionTools {
|
|
25
|
-
|
|
25
|
+
protected readonly options: CreateAgentLlmExecutionToolsOptions;
|
|
26
26
|
/**
|
|
27
27
|
* Cache of OpenAI assistants to avoid creating duplicates
|
|
28
28
|
*/
|
|
@@ -39,7 +39,7 @@ export declare class OllamaExecutionTools extends OpenAiCompatibleExecutionTools
|
|
|
39
39
|
*/
|
|
40
40
|
protected getDefaultEmbeddingModel(): AvailableModel;
|
|
41
41
|
/**
|
|
42
|
-
* Default model for
|
|
42
|
+
* Default model for completion variant.
|
|
43
43
|
*/
|
|
44
44
|
protected getDefaultImageGenerationModel(): AvailableModel;
|
|
45
45
|
}
|
|
@@ -64,7 +64,7 @@ export declare class HardcodedOpenAiCompatibleExecutionTools extends OpenAiCompa
|
|
|
64
64
|
*/
|
|
65
65
|
protected getDefaultEmbeddingModel(): AvailableModel;
|
|
66
66
|
/**
|
|
67
|
-
* Default model for
|
|
67
|
+
* Default model for completion variant.
|
|
68
68
|
*/
|
|
69
69
|
protected getDefaultImageGenerationModel(): AvailableModel;
|
|
70
70
|
}
|
|
@@ -46,6 +46,7 @@ export declare class RemoteLlmExecutionTools<TCustomOptions = undefined> impleme
|
|
|
46
46
|
private callCommonModel;
|
|
47
47
|
}
|
|
48
48
|
/**
|
|
49
|
+
* TODO: !!!! Deprecate pipeline server and all of its components
|
|
49
50
|
* TODO: Maybe use `$exportJson`
|
|
50
51
|
* TODO: [๐ง ][๐] Maybe not `isAnonymous: boolean` BUT `mode: 'ANONYMOUS'|'COLLECTION'`
|
|
51
52
|
* TODO: [๐] Allow to list compatible models with each variant
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { Arrayable } from 'type-fest';
|
|
2
|
+
import { really_any } from '../_packages/types.index';
|
|
3
|
+
import { id, string_date_iso8601, string_markdown } from './typeAliases';
|
|
4
|
+
/**
|
|
5
|
+
* A generic message structure for various communication channels
|
|
6
|
+
*/
|
|
7
|
+
export type Message<TParticipant> = {
|
|
8
|
+
/**
|
|
9
|
+
* Unique identifier of the message
|
|
10
|
+
*/
|
|
11
|
+
readonly id?: id;
|
|
12
|
+
/**
|
|
13
|
+
* Date when the message was created
|
|
14
|
+
*/
|
|
15
|
+
readonly createdAt?: Date | string_date_iso8601;
|
|
16
|
+
/**
|
|
17
|
+
* The communication channel of the message
|
|
18
|
+
*/
|
|
19
|
+
readonly channel?: 'PROMPTBOOK_CHAT' | 'EMAIL' | 'SMS' | 'WHATSAPP' | 'TELEGRAM' | 'SIGNAL' | string | 'UNKNOWN';
|
|
20
|
+
/**
|
|
21
|
+
* Is the message send from the Promptbook or to the Promptbook
|
|
22
|
+
*/
|
|
23
|
+
readonly direction?: 'INBOUND' | 'OUTBOUND' | 'INTERNAL' | 'INITIAL';
|
|
24
|
+
/**
|
|
25
|
+
* Who sent the message
|
|
26
|
+
*/
|
|
27
|
+
readonly sender: TParticipant;
|
|
28
|
+
/**
|
|
29
|
+
* Who are the recipients of the message
|
|
30
|
+
*/
|
|
31
|
+
readonly recipients?: Readonly<Arrayable<TParticipant>>;
|
|
32
|
+
/**
|
|
33
|
+
* The content of the message as markdown
|
|
34
|
+
*
|
|
35
|
+
* Note: We are converting all message content to markdown for consistency
|
|
36
|
+
*/
|
|
37
|
+
readonly content: string_markdown;
|
|
38
|
+
/**
|
|
39
|
+
* The thread identifier the message belongs to
|
|
40
|
+
*
|
|
41
|
+
* - `null` means the message is not part of any thread
|
|
42
|
+
* - `undefined` means that we don't know if the message is part of a thread or not
|
|
43
|
+
*/
|
|
44
|
+
readonly threadId?: id | null;
|
|
45
|
+
/**
|
|
46
|
+
* Arbitrary metadata associated with the message
|
|
47
|
+
*/
|
|
48
|
+
readonly metadata?: Readonly<Record<string, really_any>>;
|
|
49
|
+
};
|
|
@@ -17,7 +17,17 @@ export type CompletionModelRequirements = CommonModelRequirements & {
|
|
|
17
17
|
/**
|
|
18
18
|
* Completion model variant
|
|
19
19
|
*/
|
|
20
|
-
modelVariant: 'COMPLETION';
|
|
20
|
+
readonly modelVariant: 'COMPLETION';
|
|
21
|
+
/**
|
|
22
|
+
* The temperature of the model
|
|
23
|
+
*
|
|
24
|
+
* Note: [๐ฑ] Promptbook is using just `temperature` (not `top_k` and `top_p`)
|
|
25
|
+
*/
|
|
26
|
+
readonly temperature?: number_model_temperature;
|
|
27
|
+
/**
|
|
28
|
+
* Maximum number of tokens that can be generated by the model
|
|
29
|
+
*/
|
|
30
|
+
readonly maxTokens?: number;
|
|
21
31
|
};
|
|
22
32
|
/**
|
|
23
33
|
* Model requirements for the chat variant
|
|
@@ -28,11 +38,21 @@ export type ChatModelRequirements = CommonModelRequirements & {
|
|
|
28
38
|
/**
|
|
29
39
|
* Chat model variant
|
|
30
40
|
*/
|
|
31
|
-
modelVariant: 'CHAT';
|
|
41
|
+
readonly modelVariant: 'CHAT';
|
|
32
42
|
/**
|
|
33
43
|
* System message to be used in the model
|
|
34
44
|
*/
|
|
35
45
|
readonly systemMessage?: string_system_message;
|
|
46
|
+
/**
|
|
47
|
+
* The temperature of the model
|
|
48
|
+
*
|
|
49
|
+
* Note: [๐ฑ] Promptbook is using just `temperature` (not `top_k` and `top_p`)
|
|
50
|
+
*/
|
|
51
|
+
readonly temperature?: number_model_temperature;
|
|
52
|
+
/**
|
|
53
|
+
* Maximum number of tokens that can be generated by the model
|
|
54
|
+
*/
|
|
55
|
+
readonly maxTokens?: number;
|
|
36
56
|
};
|
|
37
57
|
/**
|
|
38
58
|
* Model requirements for the image generation variant
|
|
@@ -43,7 +63,21 @@ export type ImageGenerationModelRequirements = CommonModelRequirements & {
|
|
|
43
63
|
/**
|
|
44
64
|
* Image generation model variant
|
|
45
65
|
*/
|
|
46
|
-
modelVariant: 'IMAGE_GENERATION';
|
|
66
|
+
readonly modelVariant: 'IMAGE_GENERATION';
|
|
67
|
+
/**
|
|
68
|
+
* Size of the generated image
|
|
69
|
+
*
|
|
70
|
+
* e.g. '1536x1536'
|
|
71
|
+
*/
|
|
72
|
+
readonly size?: '1024x1024' | '1792x1024' | '1024x1792' | `${number}x${number}`;
|
|
73
|
+
/**
|
|
74
|
+
* Quality of the generated image
|
|
75
|
+
*/
|
|
76
|
+
readonly quality?: 'standard' | 'hd';
|
|
77
|
+
/**
|
|
78
|
+
* Style of the generated image
|
|
79
|
+
*/
|
|
80
|
+
readonly style?: 'vivid' | 'natural';
|
|
47
81
|
};
|
|
48
82
|
/**
|
|
49
83
|
* Model requirements for the embedding variant
|
|
@@ -54,7 +88,7 @@ export type EmbeddingModelRequirements = CommonModelRequirements & {
|
|
|
54
88
|
/**
|
|
55
89
|
* Embedding model variant
|
|
56
90
|
*/
|
|
57
|
-
modelVariant: 'EMBEDDING';
|
|
91
|
+
readonly modelVariant: 'EMBEDDING';
|
|
58
92
|
};
|
|
59
93
|
/**
|
|
60
94
|
* Common properties for all model requirements variants
|
|
@@ -84,20 +118,10 @@ export type CommonModelRequirements = {
|
|
|
84
118
|
* @example 'gpt-4', 'gpt-4-32k-0314', 'gpt-3.5-turbo-instruct',...
|
|
85
119
|
*/
|
|
86
120
|
readonly modelName?: string_model_name;
|
|
87
|
-
/**
|
|
88
|
-
* The temperature of the model
|
|
89
|
-
*
|
|
90
|
-
* Note: [๐ฑ] Promptbook is using just `temperature` (not `top_k` and `top_p`)
|
|
91
|
-
*/
|
|
92
|
-
readonly temperature?: number_model_temperature;
|
|
93
121
|
/**
|
|
94
122
|
* Seed for the model
|
|
95
123
|
*/
|
|
96
124
|
readonly seed?: number_seed;
|
|
97
|
-
/**
|
|
98
|
-
* Maximum number of tokens that can be generated by the model
|
|
99
|
-
*/
|
|
100
|
-
readonly maxTokens?: number;
|
|
101
125
|
};
|
|
102
126
|
/**
|
|
103
127
|
* TODO: [๐ง ][๐] `seed` should maybe be somewhere else (not in `ModelRequirements`) (similar that `user` identification is not here)
|
|
@@ -14,9 +14,15 @@ export type string_model_name = 'gpt-4' | 'gpt-4-0314' | 'gpt-4-0613' | 'gpt-4-3
|
|
|
14
14
|
/**
|
|
15
15
|
* Semantic helper
|
|
16
16
|
*
|
|
17
|
-
* For example `"
|
|
17
|
+
* For example `"How many eyes does a cat have?"`
|
|
18
18
|
*/
|
|
19
19
|
export type string_prompt = string;
|
|
20
|
+
/**
|
|
21
|
+
* Semantic helper
|
|
22
|
+
*
|
|
23
|
+
* For example `"A cat wearing a hat"`
|
|
24
|
+
*/
|
|
25
|
+
export type string_prompt_image = string;
|
|
20
26
|
/**
|
|
21
27
|
* Semantic helper
|
|
22
28
|
*
|
|
@@ -140,6 +146,8 @@ export type string_title = string;
|
|
|
140
146
|
* Semantic helper
|
|
141
147
|
*
|
|
142
148
|
* For example `"My AI Assistant"`
|
|
149
|
+
*
|
|
150
|
+
* TODO: !!!! Brand the type
|
|
143
151
|
*/
|
|
144
152
|
export type string_agent_name = string;
|
|
145
153
|
/**
|
|
@@ -154,6 +162,14 @@ export type string_agent_name_in_book = string;
|
|
|
154
162
|
* For example `"b126926439c5fcb83609888a11283723c1ef137c0ad599a77a1be81812bd221d"`
|
|
155
163
|
*/
|
|
156
164
|
export type string_agent_hash = string_sha256;
|
|
165
|
+
/**
|
|
166
|
+
* Semantic helper
|
|
167
|
+
*
|
|
168
|
+
* For example `"3mJr7AoUXx2Wqd"`
|
|
169
|
+
*
|
|
170
|
+
* TODO: !!!! Brand the type
|
|
171
|
+
*/
|
|
172
|
+
export type string_agent_permanent_id = string_base_58;
|
|
157
173
|
/**
|
|
158
174
|
* Unstructured description of the persona
|
|
159
175
|
*
|
|
@@ -499,6 +515,12 @@ export type string_user_id = id | string_email;
|
|
|
499
515
|
* For example `"b126926439c5fcb83609888a11283723c1ef137c0ad599a77a1be81812bd221d"`
|
|
500
516
|
*/
|
|
501
517
|
export type string_sha256 = string;
|
|
518
|
+
/**
|
|
519
|
+
* Semantic helper
|
|
520
|
+
*
|
|
521
|
+
* For example `"4JmF3b2J5dGVz"`
|
|
522
|
+
*/
|
|
523
|
+
export type string_base_58 = string;
|
|
502
524
|
/**
|
|
503
525
|
* Semantic helper
|
|
504
526
|
*
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import { string_color, string_data_url, string_url_image } from '../../../types/typeAliases';
|
|
1
2
|
import { Color } from '../Color';
|
|
2
3
|
/**
|
|
3
4
|
* Makes data url from color
|
|
4
5
|
*
|
|
5
6
|
* @public exported from `@promptbook/color`
|
|
6
7
|
*/
|
|
7
|
-
export declare function colorToDataUrl(color: Color):
|
|
8
|
+
export declare function colorToDataUrl(color: Color | string_color): string_data_url & string_url_image;
|
|
8
9
|
/**
|
|
9
10
|
* TODO: Make as functions NOT const
|
|
10
11
|
*/
|
|
@@ -6,10 +6,10 @@
|
|
|
6
6
|
* @public exported from `@promptbook/utils`
|
|
7
7
|
*/
|
|
8
8
|
export declare function $detectRuntimeEnvironment(): {
|
|
9
|
-
isRunningInBrowser:
|
|
10
|
-
isRunningInJest:
|
|
11
|
-
isRunningInNode:
|
|
12
|
-
isRunningInWebWorker:
|
|
9
|
+
isRunningInBrowser: boolean;
|
|
10
|
+
isRunningInJest: boolean;
|
|
11
|
+
isRunningInNode: boolean;
|
|
12
|
+
isRunningInWebWorker: boolean;
|
|
13
13
|
};
|
|
14
14
|
/**
|
|
15
15
|
* TODO: [๐บ] Also detect and report node version here
|
|
@@ -2,7 +2,7 @@ import type { string_markdown } from '../../types/typeAliases';
|
|
|
2
2
|
/**
|
|
3
3
|
* Single code block inside markdown.
|
|
4
4
|
*/
|
|
5
|
-
export type
|
|
5
|
+
export type MarkdownCodeBlock = {
|
|
6
6
|
/**
|
|
7
7
|
* Which notation was used to open the code block
|
|
8
8
|
*/
|
|
@@ -30,7 +30,7 @@ export type CodeBlock = {
|
|
|
30
30
|
* @throws {ParseError} if block is not closed properly
|
|
31
31
|
* @public exported from `@promptbook/markdown-utils`
|
|
32
32
|
*/
|
|
33
|
-
export declare function extractAllBlocksFromMarkdown(markdown: string_markdown): ReadonlyArray<
|
|
33
|
+
export declare function extractAllBlocksFromMarkdown(markdown: string_markdown): ReadonlyArray<MarkdownCodeBlock>;
|
|
34
34
|
/**
|
|
35
35
|
* TODO: Maybe name for `blockNotation` instead of '```' and '>'
|
|
36
36
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { string_markdown } from '../../types/typeAliases';
|
|
2
|
-
import type {
|
|
2
|
+
import type { MarkdownCodeBlock } from './extractAllBlocksFromMarkdown';
|
|
3
3
|
/**
|
|
4
4
|
* Extracts exactly ONE code block from markdown.
|
|
5
5
|
*
|
|
@@ -16,7 +16,7 @@ import type { CodeBlock } from './extractAllBlocksFromMarkdown';
|
|
|
16
16
|
* @public exported from `@promptbook/markdown-utils`
|
|
17
17
|
* @throws {ParseError} if there is not exactly one code block in the markdown
|
|
18
18
|
*/
|
|
19
|
-
export declare function extractOneBlockFromMarkdown(markdown: string_markdown):
|
|
19
|
+
export declare function extractOneBlockFromMarkdown(markdown: string_markdown): MarkdownCodeBlock;
|
|
20
20
|
/***
|
|
21
21
|
* TODO: [๐][๐ป] Decide of this is internal utility, external util OR validator/postprocessor
|
|
22
22
|
*/
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generates random base58 string
|
|
3
|
+
*
|
|
4
|
+
* Note: `$` is used to indicate that this function is not a pure function - it is not deterministic
|
|
5
|
+
* Note: This function is cryptographically secure (it uses crypto.randomBytes internally)
|
|
6
|
+
*
|
|
7
|
+
* @param length - length of the string
|
|
8
|
+
* @returns secure random base58 string
|
|
9
|
+
*
|
|
10
|
+
* @private internal helper function
|
|
11
|
+
*/
|
|
12
|
+
export declare function $randomBase58(length: number): string;
|
|
@@ -15,7 +15,7 @@ export declare const BOOK_LANGUAGE_VERSION: string_semantic_version;
|
|
|
15
15
|
export declare const PROMPTBOOK_ENGINE_VERSION: string_promptbook_version;
|
|
16
16
|
/**
|
|
17
17
|
* Represents the version string of the Promptbook engine.
|
|
18
|
-
* It follows semantic versioning (e.g., `0.
|
|
18
|
+
* It follows semantic versioning (e.g., `0.104.0-9`).
|
|
19
19
|
*
|
|
20
20
|
* @generated
|
|
21
21
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@promptbook/types",
|
|
3
|
-
"version": "0.104.0-
|
|
3
|
+
"version": "0.104.0-10",
|
|
4
4
|
"description": "Promptbook: Turn your company's scattered knowledge into AI ready books",
|
|
5
5
|
"private": false,
|
|
6
6
|
"sideEffects": false,
|
|
@@ -92,6 +92,6 @@
|
|
|
92
92
|
},
|
|
93
93
|
"typings": "./esm/typings/src/_packages/types.index.d.ts",
|
|
94
94
|
"peerDependencies": {
|
|
95
|
-
"@promptbook/core": "0.104.0-
|
|
95
|
+
"@promptbook/core": "0.104.0-10"
|
|
96
96
|
}
|
|
97
97
|
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { string_agent_name } from '../../types/typeAliases';
|
|
2
|
-
/**
|
|
3
|
-
* Generates a gravatar URL based on agent name for fallback avatar
|
|
4
|
-
*
|
|
5
|
-
* @param agentName The agent name to generate avatar for
|
|
6
|
-
* @returns Gravatar URL
|
|
7
|
-
*
|
|
8
|
-
* @private - [๐คน] The fact that profile image is Gravatar is just implementation detail which should be hidden for consumer
|
|
9
|
-
*/
|
|
10
|
-
export declare function generateGravatarUrl(agentName?: string_agent_name): string;
|