@promptbook/browser 0.103.0-51 → 0.103.0-53
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/index.es.js +326 -10
- package/esm/index.es.js.map +1 -1
- package/esm/typings/servers.d.ts +8 -1
- package/esm/typings/src/_packages/components.index.d.ts +2 -0
- package/esm/typings/src/_packages/core.index.d.ts +6 -0
- package/esm/typings/src/_packages/types.index.d.ts +2 -0
- package/esm/typings/src/_packages/utils.index.d.ts +2 -0
- package/esm/typings/src/book-2.0/agent-source/AgentBasicInformation.d.ts +1 -0
- package/esm/typings/src/book-2.0/agent-source/AgentModelRequirements.d.ts +7 -0
- package/esm/typings/src/book-2.0/agent-source/createCommitmentRegex.d.ts +2 -2
- package/esm/typings/src/book-components/Chat/Chat/ChatProps.d.ts +10 -0
- package/esm/typings/src/book-components/PromptbookAgent/PromptbookAgent.d.ts +6 -0
- package/esm/typings/src/book-components/_common/HamburgerMenu/HamburgerMenu.d.ts +12 -0
- package/esm/typings/src/book-components/icons/MicIcon.d.ts +8 -0
- package/esm/typings/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentCollectionInSupabase.d.ts +17 -0
- package/esm/typings/src/commitments/MESSAGE/AgentMessageCommitmentDefinition.d.ts +28 -0
- package/esm/typings/src/commitments/MESSAGE/UserMessageCommitmentDefinition.d.ts +28 -0
- package/esm/typings/src/commitments/META_COLOR/META_COLOR.d.ts +38 -0
- package/esm/typings/src/commitments/_base/BaseCommitmentDefinition.d.ts +2 -1
- package/esm/typings/src/commitments/index.d.ts +22 -1
- package/esm/typings/src/execution/LlmExecutionTools.d.ts +9 -0
- package/esm/typings/src/llm-providers/agent/Agent.d.ts +1 -0
- package/esm/typings/src/llm-providers/agent/AgentLlmExecutionTools.d.ts +2 -1
- package/esm/typings/src/llm-providers/agent/RemoteAgent.d.ts +10 -1
- package/esm/typings/src/utils/normalization/normalizeMessageText.d.ts +9 -0
- package/esm/typings/src/utils/normalization/normalizeMessageText.test.d.ts +1 -0
- package/esm/typings/src/version.d.ts +1 -1
- package/package.json +2 -2
- package/umd/index.umd.js +326 -10
- package/umd/index.umd.js.map +1 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { AgentBasicInformation } from '../../book-2.0/agent-source/AgentBasicInformation';
|
|
1
2
|
type PromptbookAgentProps = {
|
|
2
3
|
/**
|
|
3
4
|
* URL of the agent to connect to
|
|
@@ -5,6 +6,11 @@ type PromptbookAgentProps = {
|
|
|
5
6
|
* @example "http://s6.ptbk.io/benjamin-white"
|
|
6
7
|
*/
|
|
7
8
|
agentUrl: string;
|
|
9
|
+
/**
|
|
10
|
+
* Optional metadata to show before the agent is connected
|
|
11
|
+
* Or to override the agent metadata if the agent does not provide it
|
|
12
|
+
*/
|
|
13
|
+
meta?: Partial<AgentBasicInformation['meta']>;
|
|
8
14
|
/**
|
|
9
15
|
* Callback when the window is opened or closed
|
|
10
16
|
*/
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
type HamburgerMenuProps = {
|
|
2
|
+
isOpen: boolean;
|
|
3
|
+
onClick?: () => void;
|
|
4
|
+
className?: string;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* @@@
|
|
8
|
+
*
|
|
9
|
+
* @private Internal component
|
|
10
|
+
*/
|
|
11
|
+
export declare function HamburgerMenu({ isOpen, onClick, className }: HamburgerMenuProps): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -43,6 +43,23 @@ export declare class AgentCollectionInSupabase {
|
|
|
43
43
|
* Deletes an agent from the collection
|
|
44
44
|
*/
|
|
45
45
|
deleteAgent(agentName: string_agent_name): Promise<void>;
|
|
46
|
+
/**
|
|
47
|
+
* List history of an agent
|
|
48
|
+
*/
|
|
49
|
+
listAgentHistory(agentName: string_agent_name): Promise<ReadonlyArray<{
|
|
50
|
+
id: number;
|
|
51
|
+
createdAt: string;
|
|
52
|
+
agentHash: string;
|
|
53
|
+
promptbookEngineVersion: string;
|
|
54
|
+
}>>;
|
|
55
|
+
/**
|
|
56
|
+
* List agents that are in history but not in the active agents list
|
|
57
|
+
*/
|
|
58
|
+
listDeletedAgents(): Promise<ReadonlyArray<string_agent_name>>;
|
|
59
|
+
/**
|
|
60
|
+
* Restore an agent from history
|
|
61
|
+
*/
|
|
62
|
+
restoreAgent(historyId: number): Promise<void>;
|
|
46
63
|
/**
|
|
47
64
|
* Get the Supabase table name with prefix
|
|
48
65
|
*
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { AgentModelRequirements } from '../../book-2.0/agent-source/AgentModelRequirements';
|
|
2
|
+
import { BaseCommitmentDefinition } from '../_base/BaseCommitmentDefinition';
|
|
3
|
+
/**
|
|
4
|
+
* AGENT MESSAGE commitment definition
|
|
5
|
+
*
|
|
6
|
+
* The AGENT MESSAGE commitment defines a message from the agent in the conversation history.
|
|
7
|
+
* It is used to pre-fill the chat with a conversation history or to provide few-shot examples.
|
|
8
|
+
*
|
|
9
|
+
* Example usage in agent source:
|
|
10
|
+
*
|
|
11
|
+
* ```book
|
|
12
|
+
* AGENT MESSAGE What seems to be the issue?
|
|
13
|
+
* ```
|
|
14
|
+
*
|
|
15
|
+
* @private [🪔] Maybe export the commitments through some package
|
|
16
|
+
*/
|
|
17
|
+
export declare class AgentMessageCommitmentDefinition extends BaseCommitmentDefinition<'AGENT MESSAGE'> {
|
|
18
|
+
constructor();
|
|
19
|
+
/**
|
|
20
|
+
* Short one-line description of AGENT MESSAGE.
|
|
21
|
+
*/
|
|
22
|
+
get description(): string;
|
|
23
|
+
/**
|
|
24
|
+
* Markdown documentation for AGENT MESSAGE commitment.
|
|
25
|
+
*/
|
|
26
|
+
get documentation(): string;
|
|
27
|
+
applyToAgentModelRequirements(requirements: AgentModelRequirements, content: string): AgentModelRequirements;
|
|
28
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { AgentModelRequirements } from '../../book-2.0/agent-source/AgentModelRequirements';
|
|
2
|
+
import { BaseCommitmentDefinition } from '../_base/BaseCommitmentDefinition';
|
|
3
|
+
/**
|
|
4
|
+
* USER MESSAGE commitment definition
|
|
5
|
+
*
|
|
6
|
+
* The USER MESSAGE commitment defines a message from the user in the conversation history.
|
|
7
|
+
* It is used to pre-fill the chat with a conversation history or to provide few-shot examples.
|
|
8
|
+
*
|
|
9
|
+
* Example usage in agent source:
|
|
10
|
+
*
|
|
11
|
+
* ```book
|
|
12
|
+
* USER MESSAGE Hello, I have a problem.
|
|
13
|
+
* ```
|
|
14
|
+
*
|
|
15
|
+
* @private [🪔] Maybe export the commitments through some package
|
|
16
|
+
*/
|
|
17
|
+
export declare class UserMessageCommitmentDefinition extends BaseCommitmentDefinition<'USER MESSAGE'> {
|
|
18
|
+
constructor();
|
|
19
|
+
/**
|
|
20
|
+
* Short one-line description of USER MESSAGE.
|
|
21
|
+
*/
|
|
22
|
+
get description(): string;
|
|
23
|
+
/**
|
|
24
|
+
* Markdown documentation for USER MESSAGE commitment.
|
|
25
|
+
*/
|
|
26
|
+
get documentation(): string;
|
|
27
|
+
applyToAgentModelRequirements(requirements: AgentModelRequirements, content: string): AgentModelRequirements;
|
|
28
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { AgentModelRequirements } from '../../book-2.0/agent-source/AgentModelRequirements';
|
|
2
|
+
import { BaseCommitmentDefinition } from '../_base/BaseCommitmentDefinition';
|
|
3
|
+
/**
|
|
4
|
+
* META COLOR commitment definition
|
|
5
|
+
*
|
|
6
|
+
* The META COLOR commitment sets the agent's accent color.
|
|
7
|
+
* This commitment is special because it doesn't affect the system message,
|
|
8
|
+
* but is handled separately in the parsing logic.
|
|
9
|
+
*
|
|
10
|
+
* Example usage in agent source:
|
|
11
|
+
*
|
|
12
|
+
* ```book
|
|
13
|
+
* META COLOR #ff0000
|
|
14
|
+
* META COLOR #00ff00
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* @private [🪔] Maybe export the commitments through some package
|
|
18
|
+
*/
|
|
19
|
+
export declare class MetaColorCommitmentDefinition extends BaseCommitmentDefinition<'META COLOR'> {
|
|
20
|
+
constructor();
|
|
21
|
+
/**
|
|
22
|
+
* Short one-line description of META COLOR.
|
|
23
|
+
*/
|
|
24
|
+
get description(): string;
|
|
25
|
+
/**
|
|
26
|
+
* Markdown documentation for META COLOR commitment.
|
|
27
|
+
*/
|
|
28
|
+
get documentation(): string;
|
|
29
|
+
applyToAgentModelRequirements(requirements: AgentModelRequirements, content: string): AgentModelRequirements;
|
|
30
|
+
/**
|
|
31
|
+
* Extracts the profile color from the content
|
|
32
|
+
* This is used by the parsing logic
|
|
33
|
+
*/
|
|
34
|
+
extractProfileColor(content: string): string | null;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
38
|
+
*/
|
|
@@ -8,7 +8,8 @@ import type { CommitmentDefinition } from './CommitmentDefinition';
|
|
|
8
8
|
*/
|
|
9
9
|
export declare abstract class BaseCommitmentDefinition<TBookCommitment extends string> implements CommitmentDefinition {
|
|
10
10
|
readonly type: TBookCommitment;
|
|
11
|
-
|
|
11
|
+
readonly aliases: string[];
|
|
12
|
+
constructor(type: TBookCommitment, aliases?: string[]);
|
|
12
13
|
/**
|
|
13
14
|
* Short one-line markdown description; concise, may use inline **markdown**.
|
|
14
15
|
* Must be implemented by each concrete commitment.
|
|
@@ -6,9 +6,13 @@ import { FormatCommitmentDefinition } from './FORMAT/FORMAT';
|
|
|
6
6
|
import { GoalCommitmentDefinition } from './GOAL/GOAL';
|
|
7
7
|
import { KnowledgeCommitmentDefinition } from './KNOWLEDGE/KNOWLEDGE';
|
|
8
8
|
import { MemoryCommitmentDefinition } from './MEMORY/MEMORY';
|
|
9
|
+
import { AgentMessageCommitmentDefinition } from './MESSAGE/AgentMessageCommitmentDefinition';
|
|
9
10
|
import { InitialMessageCommitmentDefinition } from './MESSAGE/InitialMessageCommitmentDefinition';
|
|
10
11
|
import { MessageCommitmentDefinition } from './MESSAGE/MESSAGE';
|
|
12
|
+
import { UserMessageCommitmentDefinition } from './MESSAGE/UserMessageCommitmentDefinition';
|
|
11
13
|
import { MetaCommitmentDefinition } from './META/META';
|
|
14
|
+
import { MetaColorCommitmentDefinition } from './META_COLOR/META_COLOR';
|
|
15
|
+
import { MetaImageCommitmentDefinition } from './META_IMAGE/META_IMAGE';
|
|
12
16
|
import { ModelCommitmentDefinition } from './MODEL/MODEL';
|
|
13
17
|
import { NoteCommitmentDefinition } from './NOTE/NOTE';
|
|
14
18
|
import { PersonaCommitmentDefinition } from './PERSONA/PERSONA';
|
|
@@ -24,7 +28,7 @@ import { NotYetImplementedCommitmentDefinition } from './_base/NotYetImplemented
|
|
|
24
28
|
*
|
|
25
29
|
* @private Use functions to access commitments instead of this array directly
|
|
26
30
|
*/
|
|
27
|
-
export declare const COMMITMENT_REGISTRY: readonly [PersonaCommitmentDefinition, PersonaCommitmentDefinition, KnowledgeCommitmentDefinition, MemoryCommitmentDefinition, MemoryCommitmentDefinition, StyleCommitmentDefinition, StyleCommitmentDefinition, RuleCommitmentDefinition, RuleCommitmentDefinition, SampleCommitmentDefinition, SampleCommitmentDefinition, FormatCommitmentDefinition, FormatCommitmentDefinition, ModelCommitmentDefinition, ModelCommitmentDefinition, ActionCommitmentDefinition, ActionCommitmentDefinition, MetaCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, GoalCommitmentDefinition, GoalCommitmentDefinition, InitialMessageCommitmentDefinition, MessageCommitmentDefinition, MessageCommitmentDefinition, ScenarioCommitmentDefinition, ScenarioCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, NotYetImplementedCommitmentDefinition<"EXPECT">, NotYetImplementedCommitmentDefinition<"BEHAVIOUR">, NotYetImplementedCommitmentDefinition<"BEHAVIOURS">, NotYetImplementedCommitmentDefinition<"AVOID">, NotYetImplementedCommitmentDefinition<"AVOIDANCE">, NotYetImplementedCommitmentDefinition<"CONTEXT">];
|
|
31
|
+
export declare const COMMITMENT_REGISTRY: readonly [PersonaCommitmentDefinition, PersonaCommitmentDefinition, KnowledgeCommitmentDefinition, MemoryCommitmentDefinition, MemoryCommitmentDefinition, StyleCommitmentDefinition, StyleCommitmentDefinition, RuleCommitmentDefinition, RuleCommitmentDefinition, SampleCommitmentDefinition, SampleCommitmentDefinition, FormatCommitmentDefinition, FormatCommitmentDefinition, ModelCommitmentDefinition, ModelCommitmentDefinition, ActionCommitmentDefinition, ActionCommitmentDefinition, MetaImageCommitmentDefinition, MetaColorCommitmentDefinition, MetaCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, GoalCommitmentDefinition, GoalCommitmentDefinition, InitialMessageCommitmentDefinition, UserMessageCommitmentDefinition, AgentMessageCommitmentDefinition, MessageCommitmentDefinition, MessageCommitmentDefinition, ScenarioCommitmentDefinition, ScenarioCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, NotYetImplementedCommitmentDefinition<"EXPECT">, NotYetImplementedCommitmentDefinition<"BEHAVIOUR">, NotYetImplementedCommitmentDefinition<"BEHAVIOURS">, NotYetImplementedCommitmentDefinition<"AVOID">, NotYetImplementedCommitmentDefinition<"AVOIDANCE">, NotYetImplementedCommitmentDefinition<"CONTEXT">];
|
|
28
32
|
/**
|
|
29
33
|
* Gets a commitment definition by its type
|
|
30
34
|
* @param type The commitment type to look up
|
|
@@ -55,6 +59,23 @@ export declare function getAllCommitmentTypes(): ReadonlyArray<BookCommitment>;
|
|
|
55
59
|
* @public exported from `@promptbook/core`
|
|
56
60
|
*/
|
|
57
61
|
export declare function isCommitmentSupported(type: BookCommitment): boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Grouped commitment definition
|
|
64
|
+
*
|
|
65
|
+
* @public exported from `@promptbook/core`
|
|
66
|
+
*/
|
|
67
|
+
export type GroupedCommitmentDefinition = {
|
|
68
|
+
primary: CommitmentDefinition;
|
|
69
|
+
aliases: string[];
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* Gets all commitment definitions grouped by their aliases
|
|
73
|
+
*
|
|
74
|
+
* @returns Array of grouped commitment definitions
|
|
75
|
+
*
|
|
76
|
+
* @public exported from `@promptbook/core`
|
|
77
|
+
*/
|
|
78
|
+
export declare function getGroupedCommitmentDefinitions(): ReadonlyArray<GroupedCommitmentDefinition>;
|
|
58
79
|
/**
|
|
59
80
|
* TODO: [🧠] Maybe create through standardized $register
|
|
60
81
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -57,6 +57,15 @@ export type LlmExecutionTools = {
|
|
|
57
57
|
* Calls a chat model with streaming
|
|
58
58
|
*/
|
|
59
59
|
callChatModelStream?(prompt: Prompt, onProgress: (chunk: ChatPromptResult) => void): Promise<ChatPromptResult>;
|
|
60
|
+
/**
|
|
61
|
+
* Calls a voice chat model
|
|
62
|
+
*/
|
|
63
|
+
callVoiceChatModel?(audio: Blob, prompt: Prompt): Promise<{
|
|
64
|
+
text: string;
|
|
65
|
+
audio: Blob;
|
|
66
|
+
userMessage?: string;
|
|
67
|
+
agentMessage?: string;
|
|
68
|
+
}>;
|
|
60
69
|
/**
|
|
61
70
|
* Calls a completion model
|
|
62
71
|
*/
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Promisable } from 'type-fest';
|
|
2
|
+
import type { AgentModelRequirements } from '../../book-2.0/agent-source/AgentModelRequirements';
|
|
2
3
|
import type { string_book } from '../../book-2.0/agent-source/string_book';
|
|
3
4
|
import type { ChatParticipant } from '../../book-components/Chat/types/ChatParticipant';
|
|
4
5
|
import type { AvailableModel } from '../../execution/AvailableModel';
|
|
@@ -54,7 +55,7 @@ export declare class AgentLlmExecutionTools implements LlmExecutionTools {
|
|
|
54
55
|
/**
|
|
55
56
|
* Get cached or create agent model requirements
|
|
56
57
|
*/
|
|
57
|
-
|
|
58
|
+
protected getAgentModelRequirements(): Promise<AgentModelRequirements>;
|
|
58
59
|
get title(): string_title & string_markdown_text;
|
|
59
60
|
get description(): string_markdown;
|
|
60
61
|
get profile(): ChatParticipant | undefined;
|
|
@@ -23,6 +23,7 @@ export declare class RemoteAgent extends Agent {
|
|
|
23
23
|
private agentUrl;
|
|
24
24
|
private _remoteAgentName;
|
|
25
25
|
private _remoteAgentHash;
|
|
26
|
+
private _isVoiceCallingEnabled;
|
|
26
27
|
private constructor();
|
|
27
28
|
get agentName(): string_agent_name;
|
|
28
29
|
get agentHash(): string_agent_hash;
|
|
@@ -31,8 +32,16 @@ export declare class RemoteAgent extends Agent {
|
|
|
31
32
|
*/
|
|
32
33
|
callChatModel(prompt: Prompt): Promise<ChatPromptResult>;
|
|
33
34
|
/**
|
|
34
|
-
* Calls the agent on agents remote server with
|
|
35
|
+
* Calls the agent on agents remote server with voice
|
|
36
|
+
* [✨✷] Only available when voice calling is enabled on the server
|
|
37
|
+
* Returns undefined if voice calling is disabled
|
|
35
38
|
*/
|
|
39
|
+
get callVoiceChatModel(): ((audio: Blob, prompt: Prompt) => Promise<{
|
|
40
|
+
text: string;
|
|
41
|
+
audio: Blob;
|
|
42
|
+
userMessage?: string;
|
|
43
|
+
agentMessage?: string;
|
|
44
|
+
}>) | undefined;
|
|
36
45
|
callChatModelStream(prompt: Prompt, onProgress: (chunk: ChatPromptResult) => void): Promise<ChatPromptResult>;
|
|
37
46
|
}
|
|
38
47
|
/**
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -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.103.0-
|
|
18
|
+
* It follows semantic versioning (e.g., `0.103.0-52`).
|
|
19
19
|
*
|
|
20
20
|
* @generated
|
|
21
21
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@promptbook/browser",
|
|
3
|
-
"version": "0.103.0-
|
|
3
|
+
"version": "0.103.0-53",
|
|
4
4
|
"description": "Promptbook: Turn your company's scattered knowledge into AI ready books",
|
|
5
5
|
"private": false,
|
|
6
6
|
"sideEffects": false,
|
|
@@ -94,7 +94,7 @@
|
|
|
94
94
|
"module": "./esm/index.es.js",
|
|
95
95
|
"typings": "./esm/typings/src/_packages/browser.index.d.ts",
|
|
96
96
|
"peerDependencies": {
|
|
97
|
-
"@promptbook/core": "0.103.0-
|
|
97
|
+
"@promptbook/core": "0.103.0-53"
|
|
98
98
|
},
|
|
99
99
|
"dependencies": {
|
|
100
100
|
"crypto": "1.0.1",
|