@promptbook/wizard 0.100.0-6 → 0.100.0-61
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 +2 -8
- package/esm/index.es.js +651 -150
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/color.index.d.ts +50 -0
- package/esm/typings/src/_packages/components.index.d.ts +36 -0
- package/esm/typings/src/_packages/core.index.d.ts +30 -0
- package/esm/typings/src/_packages/types.index.d.ts +38 -0
- package/esm/typings/src/book-2.0/agent-source/parseAgentSource.d.ts +30 -0
- package/esm/typings/src/book-2.0/agent-source/parseAgentSource.test.d.ts +1 -0
- package/esm/typings/src/book-2.0/agent-source/string_book.d.ts +26 -0
- package/esm/typings/src/book-2.0/commitments/ACTION/ACTION.d.ts +38 -0
- package/esm/typings/src/book-2.0/commitments/FORMAT/FORMAT.d.ts +39 -0
- package/esm/typings/src/book-2.0/commitments/KNOWLEDGE/KNOWLEDGE.d.ts +45 -0
- package/esm/typings/src/book-2.0/commitments/META_IMAGE/META_IMAGE.d.ts +44 -0
- package/esm/typings/src/book-2.0/commitments/META_LINK/META_LINK.d.ts +56 -0
- package/esm/typings/src/book-2.0/commitments/MODEL/MODEL.d.ts +39 -0
- package/esm/typings/src/book-2.0/commitments/NOTE/NOTE.d.ts +49 -0
- package/esm/typings/src/book-2.0/commitments/PERSONA/PERSONA.d.ts +46 -0
- package/esm/typings/src/book-2.0/commitments/RULE/RULE.d.ts +44 -0
- package/esm/typings/src/book-2.0/commitments/SAMPLE/SAMPLE.d.ts +44 -0
- package/esm/typings/src/book-2.0/commitments/STYLE/STYLE.d.ts +38 -0
- package/esm/typings/src/book-2.0/commitments/_base/BaseCommitmentDefinition.d.ts +52 -0
- package/esm/typings/src/book-2.0/commitments/_base/BookCommitment.d.ts +5 -0
- package/esm/typings/src/book-2.0/commitments/_base/CommitmentDefinition.d.ts +48 -0
- package/esm/typings/src/book-2.0/commitments/_base/NotYetImplementedCommitmentDefinition.d.ts +22 -0
- package/esm/typings/src/book-2.0/commitments/_base/createEmptyAgentModelRequirements.d.ts +19 -0
- package/esm/typings/src/book-2.0/commitments/_misc/AgentModelRequirements.d.ts +37 -0
- package/esm/typings/src/book-2.0/commitments/_misc/AgentSourceParseResult.d.ts +18 -0
- package/esm/typings/src/book-2.0/commitments/_misc/ParsedCommitment.d.ts +22 -0
- package/esm/typings/src/book-2.0/commitments/_misc/createAgentModelRequirements.d.ts +62 -0
- package/esm/typings/src/book-2.0/commitments/_misc/createAgentModelRequirementsWithCommitments.d.ts +36 -0
- package/esm/typings/src/book-2.0/commitments/_misc/createCommitmentRegex.d.ts +20 -0
- package/esm/typings/src/book-2.0/commitments/_misc/parseAgentSourceWithCommitments.d.ts +24 -0
- package/esm/typings/src/book-2.0/commitments/_misc/removeCommentsFromSystemMessage.d.ts +11 -0
- package/esm/typings/src/book-2.0/commitments/index.d.ts +56 -0
- package/esm/typings/src/book-2.0/utils/profileImageUtils.d.ts +39 -0
- package/esm/typings/src/book-components/AvatarProfile/AvatarChip/AvatarChip.d.ts +35 -0
- package/esm/typings/src/book-components/AvatarProfile/AvatarChip/AvatarChipFromSource.d.ts +21 -0
- package/esm/typings/src/book-components/AvatarProfile/AvatarChip/index.d.ts +2 -0
- package/esm/typings/src/book-components/AvatarProfile/AvatarProfile/AvatarProfile.d.ts +26 -0
- package/esm/typings/src/book-components/AvatarProfile/AvatarProfile/AvatarProfileFromSource.d.ts +19 -0
- package/esm/typings/src/book-components/BookEditor/BookEditor.d.ts +35 -0
- package/esm/typings/src/book-components/BookEditor/BookEditorInner.d.ts +15 -0
- package/esm/typings/src/book-components/BookEditor/config.d.ts +10 -0
- package/esm/typings/src/book-components/BookEditor/injectCssModuleIntoShadowRoot.d.ts +11 -0
- package/esm/typings/src/book-components/Chat/Chat/Chat.d.ts +20 -0
- package/esm/typings/src/book-components/Chat/Chat/ChatProps.d.ts +110 -0
- package/esm/typings/src/book-components/Chat/LlmChat/LlmChat.d.ts +14 -0
- package/esm/typings/src/book-components/Chat/LlmChat/LlmChat.test.d.ts +1 -0
- package/esm/typings/src/book-components/Chat/LlmChat/LlmChatProps.d.ts +24 -0
- package/esm/typings/src/book-components/Chat/types/ChatMessage.d.ts +16 -0
- package/esm/typings/src/book-components/Chat/types/ChatParticipant.d.ts +32 -0
- package/esm/typings/src/book-components/Chat/utils/ChatPersistence.d.ts +25 -0
- package/esm/typings/src/book-components/Chat/utils/ExportFormat.d.ts +4 -0
- package/esm/typings/src/book-components/Chat/utils/addUtmParamsToUrl.d.ts +7 -0
- package/esm/typings/src/book-components/Chat/utils/createShortLinkForChat.d.ts +7 -0
- package/esm/typings/src/book-components/Chat/utils/downloadFile.d.ts +6 -0
- package/esm/typings/src/book-components/Chat/utils/exportChatHistory.d.ts +9 -0
- package/esm/typings/src/book-components/Chat/utils/generatePdfContent.d.ts +8 -0
- package/esm/typings/src/book-components/Chat/utils/generateQrDataUrl.d.ts +7 -0
- package/esm/typings/src/book-components/Chat/utils/getPromptbookBranding.d.ts +6 -0
- package/esm/typings/src/book-components/Chat/utils/messagesToHtml.d.ts +8 -0
- package/esm/typings/src/book-components/Chat/utils/messagesToJson.d.ts +7 -0
- package/esm/typings/src/book-components/Chat/utils/messagesToMarkdown.d.ts +8 -0
- package/esm/typings/src/book-components/Chat/utils/messagesToText.d.ts +8 -0
- package/esm/typings/src/book-components/_common/react-utils/classNames.d.ts +7 -0
- package/esm/typings/src/book-components/_common/react-utils/collectCssTextsForClass.d.ts +7 -0
- package/esm/typings/src/book-components/_common/react-utils/escapeHtml.d.ts +6 -0
- package/esm/typings/src/book-components/_common/react-utils/escapeRegex.d.ts +6 -0
- package/esm/typings/src/config.d.ts +19 -0
- package/esm/typings/src/execution/AvailableModel.d.ts +4 -0
- package/esm/typings/src/execution/ExecutionTask.d.ts +27 -1
- package/esm/typings/src/execution/LlmExecutionTools.d.ts +8 -0
- package/esm/typings/src/execution/createPipelineExecutor/40-executeAttempts.d.ts +6 -1
- package/esm/typings/src/llm-providers/_common/filterModels.d.ts +0 -3
- package/esm/typings/src/llm-providers/_common/profiles/llmProviderProfiles.d.ts +81 -0
- package/esm/typings/src/llm-providers/_common/profiles/test/llmProviderProfiles.test.d.ts +1 -0
- package/esm/typings/src/llm-providers/_multiple/MultipleLlmExecutionTools.d.ts +5 -0
- package/esm/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionTools.d.ts +5 -5
- package/esm/typings/src/llm-providers/anthropic-claude/anthropic-claude-models.d.ts +1 -1
- package/esm/typings/src/llm-providers/deepseek/deepseek-models.d.ts +1 -1
- package/esm/typings/src/llm-providers/google/google-models.d.ts +1 -1
- package/esm/typings/src/llm-providers/mocked/MockedEchoLlmExecutionTools.d.ts +5 -0
- package/esm/typings/src/llm-providers/ollama/ollama-models.d.ts +1 -1
- package/esm/typings/src/llm-providers/openai/OpenAiCompatibleExecutionTools.d.ts +8 -0
- package/esm/typings/src/llm-providers/openai/OpenAiExecutionTools.d.ts +5 -0
- package/esm/typings/src/llm-providers/openai/openai-models.d.ts +1 -1
- package/esm/typings/src/llm-providers/remote/RemoteLlmExecutionTools.d.ts +5 -0
- package/esm/typings/src/pipeline/book-notation.d.ts +2 -1
- package/esm/typings/src/playground/permanent/error-handling-playground.d.ts +5 -0
- package/esm/typings/src/types/ModelRequirements.d.ts +0 -2
- package/esm/typings/src/types/typeAliases.d.ts +6 -0
- package/esm/typings/src/utils/color/$randomColor.d.ts +11 -0
- package/esm/typings/src/utils/color/Color.d.ts +180 -0
- package/esm/typings/src/utils/color/css-colors.d.ts +159 -0
- package/esm/typings/src/utils/color/internal-utils/checkChannelValue.d.ts +14 -0
- package/esm/typings/src/utils/color/internal-utils/hslToRgb.d.ts +17 -0
- package/esm/typings/src/utils/color/internal-utils/rgbToHsl.d.ts +17 -0
- package/esm/typings/src/utils/color/operators/ColorTransformer.d.ts +5 -0
- package/esm/typings/src/utils/color/operators/darken.d.ts +9 -0
- package/esm/typings/src/utils/color/operators/furthest.d.ts +16 -0
- package/esm/typings/src/utils/color/operators/grayscale.d.ts +9 -0
- package/esm/typings/src/utils/color/operators/lighten.d.ts +12 -0
- package/esm/typings/src/utils/color/operators/mixWithColor.d.ts +11 -0
- package/esm/typings/src/utils/color/operators/nearest.d.ts +10 -0
- package/esm/typings/src/utils/color/operators/negative.d.ts +7 -0
- package/esm/typings/src/utils/color/operators/negativeLightness.d.ts +7 -0
- package/esm/typings/src/utils/color/operators/withAlpha.d.ts +9 -0
- package/esm/typings/src/utils/color/utils/areColorsEqual.d.ts +14 -0
- package/esm/typings/src/utils/color/utils/colorDistance.d.ts +21 -0
- package/esm/typings/src/utils/color/utils/colorHue.d.ts +11 -0
- package/esm/typings/src/utils/color/utils/colorHueDistance.d.ts +11 -0
- package/esm/typings/src/utils/color/utils/colorHueDistance.test.d.ts +1 -0
- package/esm/typings/src/utils/color/utils/colorLuminance.d.ts +9 -0
- package/esm/typings/src/utils/color/utils/colorSatulightion.d.ts +7 -0
- package/esm/typings/src/utils/color/utils/colorSaturation.d.ts +9 -0
- package/esm/typings/src/utils/color/utils/colorToDataUrl.d.ts +10 -0
- package/esm/typings/src/utils/color/utils/mixColors.d.ts +11 -0
- package/esm/typings/src/utils/organization/preserve.d.ts +21 -0
- package/esm/typings/src/utils/take/classes/TakeChain.d.ts +11 -0
- package/esm/typings/src/utils/take/interfaces/ITakeChain.d.ts +12 -0
- package/esm/typings/src/utils/take/interfaces/Takeable.d.ts +7 -0
- package/esm/typings/src/utils/take/take.d.ts +12 -0
- package/esm/typings/src/utils/take/take.test.d.ts +1 -0
- package/esm/typings/src/version.d.ts +1 -1
- package/package.json +2 -3
- package/umd/index.umd.js +655 -154
- package/umd/index.umd.js.map +1 -1
- package/esm/typings/src/scripting/javascript/utils/preserve.d.ts +0 -14
@@ -0,0 +1,21 @@
|
|
1
|
+
import type { string_book } from '../../../book-2.0/agent-source/string_book';
|
2
|
+
import type { AvatarChipProps } from './AvatarChip';
|
3
|
+
/**
|
4
|
+
* Props of `AvatarChipFromSource`
|
5
|
+
*
|
6
|
+
* @public exported from `@promptbook/components`
|
7
|
+
*/
|
8
|
+
export type AvatarChipFromSourceProps = Omit<AvatarChipProps, 'avatarBasicInformation'> & {
|
9
|
+
/**
|
10
|
+
* Avatar to be shown
|
11
|
+
*/
|
12
|
+
readonly source: string_book;
|
13
|
+
};
|
14
|
+
/**
|
15
|
+
* Shows a chip with avatar's avatar and name based on the avatar source string
|
16
|
+
*
|
17
|
+
* This component is wrapped around the `<AvatarChip/>`, it just parses the avatar source string into `AvatarBasicInformation` and passes it to the `<AvatarChip/>` component.
|
18
|
+
*
|
19
|
+
* @public exported from `@promptbook/components`
|
20
|
+
*/
|
21
|
+
export declare function AvatarChipFromSource(props: AvatarChipFromSourceProps): import("react/jsx-runtime").JSX.Element;
|
@@ -0,0 +1,26 @@
|
|
1
|
+
import type { AgentBasicInformation } from '../../../book-2.0/agent-source/parseAgentSource';
|
2
|
+
import type { string_css_class } from '../../../types/typeAliases';
|
3
|
+
/**
|
4
|
+
* Props of `AvatarProfile`
|
5
|
+
*
|
6
|
+
* @public exported from `@promptbook/components`
|
7
|
+
*/
|
8
|
+
export type AvatarProfileProps = {
|
9
|
+
/**
|
10
|
+
* Agent to be shown
|
11
|
+
*/
|
12
|
+
readonly agent: AgentBasicInformation & {
|
13
|
+
agentTitle?: string;
|
14
|
+
agentDescription?: string;
|
15
|
+
};
|
16
|
+
/**
|
17
|
+
* Optional CSS class name which will be added to root <div> element
|
18
|
+
*/
|
19
|
+
readonly className?: string_css_class;
|
20
|
+
};
|
21
|
+
/**
|
22
|
+
* Shows a box with user avatar, name and description
|
23
|
+
*
|
24
|
+
* @public exported from `@promptbook/components`
|
25
|
+
*/
|
26
|
+
export declare function AvatarProfile(props: AvatarProfileProps): import("react/jsx-runtime").JSX.Element;
|
package/esm/typings/src/book-components/AvatarProfile/AvatarProfile/AvatarProfileFromSource.d.ts
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
import type { string_book } from '../../../book-2.0/agent-source/string_book';
|
2
|
+
import type { AvatarProfileProps } from './AvatarProfile';
|
3
|
+
/**
|
4
|
+
* Props of `AvatarProfileFromSource`
|
5
|
+
*
|
6
|
+
* @public exported from `@promptbook/components`
|
7
|
+
*/
|
8
|
+
export type AvatarProfileFromSourceProps = Omit<AvatarProfileProps, 'agent'> & {
|
9
|
+
/**
|
10
|
+
* Agent source to be shown
|
11
|
+
*/
|
12
|
+
readonly agentSource: string_book;
|
13
|
+
};
|
14
|
+
/**
|
15
|
+
* Shows a box with user avatar, name and description from a string source
|
16
|
+
*
|
17
|
+
* @public exported from `@promptbook/components`
|
18
|
+
*/
|
19
|
+
export declare function AvatarProfileFromSource(props: AvatarProfileFromSourceProps): import("react/jsx-runtime").JSX.Element;
|
@@ -0,0 +1,35 @@
|
|
1
|
+
import type { string_book } from '../../book-2.0/agent-source/string_book';
|
2
|
+
/**
|
3
|
+
* Props of `BookEditor`
|
4
|
+
*
|
5
|
+
* @public exported from `@promptbook/components`
|
6
|
+
*/
|
7
|
+
export type BookEditorProps = {
|
8
|
+
/**
|
9
|
+
* Additional CSS classes to apply to the editor container.
|
10
|
+
*/
|
11
|
+
readonly className?: string;
|
12
|
+
/**
|
13
|
+
* CSS className for a font (e.g. from next/font) to style the editor text.
|
14
|
+
* If omitted, defaults to system serif fonts.
|
15
|
+
*/
|
16
|
+
readonly fontClassName?: string;
|
17
|
+
/**
|
18
|
+
* The book which is being edited.
|
19
|
+
*/
|
20
|
+
readonly value?: string_book;
|
21
|
+
/**
|
22
|
+
* Callback function to handle changes in the book content.
|
23
|
+
*/
|
24
|
+
onChange?(value: string_book): void;
|
25
|
+
/**
|
26
|
+
* If true, logs verbose debug info to the console and shows additional visual cues
|
27
|
+
*/
|
28
|
+
readonly isVerbose?: boolean;
|
29
|
+
};
|
30
|
+
/**
|
31
|
+
* Renders a book editor
|
32
|
+
*
|
33
|
+
* @public exported from `@promptbook/components`
|
34
|
+
*/
|
35
|
+
export declare function BookEditor(props: BookEditorProps): import("react/jsx-runtime").JSX.Element;
|
@@ -0,0 +1,15 @@
|
|
1
|
+
import type { string_book } from '../../book-2.0/agent-source/string_book';
|
2
|
+
/**
|
3
|
+
* @private util of `<BookEditor />`
|
4
|
+
*/
|
5
|
+
export type BookEditorInnerProps = {
|
6
|
+
className?: string;
|
7
|
+
fontClassName?: string;
|
8
|
+
value?: string_book;
|
9
|
+
onChange?(value: string_book): void;
|
10
|
+
isVerbose?: boolean;
|
11
|
+
};
|
12
|
+
/**
|
13
|
+
* @private util of `<BookEditor />`
|
14
|
+
*/
|
15
|
+
export declare function BookEditorInner(props: BookEditorInnerProps): import("react/jsx-runtime").JSX.Element;
|
@@ -0,0 +1,10 @@
|
|
1
|
+
/**
|
2
|
+
* Default font class name for the BookEditor component
|
3
|
+
* In Next.js environments, you can override this by importing the font directly
|
4
|
+
*
|
5
|
+
* @public exported from `@promptbook/components`
|
6
|
+
*/
|
7
|
+
export declare const DEFAULT_BOOK_FONT_CLASS: any;
|
8
|
+
/**
|
9
|
+
* Note: [💞] Ignore a discrepancy between file name and entity name
|
10
|
+
*/
|
@@ -0,0 +1,11 @@
|
|
1
|
+
/**
|
2
|
+
* Inject the CSS module rules (derived from imported `styles`) into the provided shadow root.
|
3
|
+
* This allows CSS modules (which are normally emitted into the document head) to be
|
4
|
+
* available inside the component's shadow DOM.
|
5
|
+
*
|
6
|
+
* @private within the promptbook components <- TODO: Maybe make promptbook util from this
|
7
|
+
*/
|
8
|
+
export declare function injectCssModuleIntoShadowRoot(shadowRoot: ShadowRoot): void;
|
9
|
+
/**
|
10
|
+
* TODO: Make some utility functions for working with CSS modules in shadow DOM independent of `BookEditor.module.css`
|
11
|
+
*/
|
@@ -0,0 +1,20 @@
|
|
1
|
+
import type { ChatProps } from './ChatProps';
|
2
|
+
/**
|
3
|
+
* @deprecated use `isComplete` instead
|
4
|
+
* @private util of `<Chat />`
|
5
|
+
*/
|
6
|
+
export declare const LOADING_INTERACTIVE_IMAGE = "Loading...";
|
7
|
+
/**
|
8
|
+
* Renders a chat with messages and input for new messages
|
9
|
+
*
|
10
|
+
* Note: 🔇 This component does NOT have speak functionality, it just allows to trigger voice recognition
|
11
|
+
*
|
12
|
+
* Note: There are multiple chat components:
|
13
|
+
* - `<Chat/>` renders chat as it is without any logic
|
14
|
+
* - `<LlmChat/>` connected to LLM Execution Tools of Promptbook
|
15
|
+
*
|
16
|
+
* Use <WorkerChat/> or <SignalChat/> in most cases.
|
17
|
+
*
|
18
|
+
* @public exported from `@promptbook/components`
|
19
|
+
*/
|
20
|
+
export declare function Chat(props: ChatProps): import("react/jsx-runtime").JSX.Element;
|
@@ -0,0 +1,110 @@
|
|
1
|
+
import type { CSSProperties, ReactNode } from 'react';
|
2
|
+
import type { Promisable } from 'type-fest';
|
3
|
+
import type { ChatMessage } from '../types/ChatMessage';
|
4
|
+
import type { ChatParticipant } from '../types/ChatParticipant';
|
5
|
+
/**
|
6
|
+
* @public exported from `@promptbook/components`
|
7
|
+
*/
|
8
|
+
export type ChatProps = {
|
9
|
+
/**
|
10
|
+
* Optional callback to create a new agent from the template.
|
11
|
+
* If provided, renders the [Use this template] button.
|
12
|
+
*/
|
13
|
+
onUseTemplate?(): void;
|
14
|
+
/**
|
15
|
+
* Messages to render - they are rendered as they are
|
16
|
+
*/
|
17
|
+
readonly messages: ReadonlyArray<ChatMessage>;
|
18
|
+
/**
|
19
|
+
* Called every time the user types or dictated a message
|
20
|
+
*/
|
21
|
+
onChange?(messageContent: string): void;
|
22
|
+
/**
|
23
|
+
* Called when user sends a message
|
24
|
+
*
|
25
|
+
* Note: You must handle the message yourself and add it to the `messages` array
|
26
|
+
*/
|
27
|
+
onMessage(messageContent: string): Promisable<void>;
|
28
|
+
/**
|
29
|
+
* Optional callback, when set, button for resetting chat will be shown
|
30
|
+
*/
|
31
|
+
onReset?(): Promisable<void>;
|
32
|
+
/**
|
33
|
+
* Determines whether the voice recognition button is rendered
|
34
|
+
*/
|
35
|
+
readonly isVoiceRecognitionButtonShown?: boolean;
|
36
|
+
/**
|
37
|
+
* The language code to use for voice recognition
|
38
|
+
*/
|
39
|
+
readonly voiceLanguage?: string;
|
40
|
+
/**
|
41
|
+
* Optional placeholder message for the textarea
|
42
|
+
*
|
43
|
+
* @default "Write a message"
|
44
|
+
*/
|
45
|
+
readonly placeholderMessageContent?: string;
|
46
|
+
/**
|
47
|
+
* Optional preset message in chat
|
48
|
+
*/
|
49
|
+
readonly defaultMessage?: string;
|
50
|
+
/**
|
51
|
+
* List of tasks that are currently in progress that should be displayed
|
52
|
+
*/
|
53
|
+
readonly tasksProgress?: Array<{
|
54
|
+
id: string;
|
55
|
+
name: string;
|
56
|
+
progress?: number;
|
57
|
+
}>;
|
58
|
+
/**
|
59
|
+
* Content to be shown inside the chat bar in head
|
60
|
+
* If not provided, the chat bar will not be rendered
|
61
|
+
*/
|
62
|
+
readonly children?: ReactNode;
|
63
|
+
/**
|
64
|
+
* Optional CSS class name which will be added to root <div/> element
|
65
|
+
*/
|
66
|
+
readonly className?: string;
|
67
|
+
/**
|
68
|
+
* Optional CSS style which will be added to root <div/> element
|
69
|
+
*/
|
70
|
+
readonly style?: CSSProperties;
|
71
|
+
/**
|
72
|
+
* Voice call props - when provided, voice call button will be shown
|
73
|
+
*/
|
74
|
+
readonly voiceCallProps?: {
|
75
|
+
selectedModel: string;
|
76
|
+
providerClients: Map<string, unknown>;
|
77
|
+
currentPersonaContent?: string;
|
78
|
+
onVoiceMessage?: (content: string, isVoiceCall: boolean) => void;
|
79
|
+
onAssistantVoiceResponse?: (content: string, isVoiceCall: boolean) => void;
|
80
|
+
onVoiceCallStateChange?: (isVoiceCalling: boolean) => void;
|
81
|
+
};
|
82
|
+
/**
|
83
|
+
* Indicates whether a voice call is currently active
|
84
|
+
*/
|
85
|
+
readonly isVoiceCalling?: boolean;
|
86
|
+
/**
|
87
|
+
* Whether experimental features are enabled (required for voice calling)
|
88
|
+
*/
|
89
|
+
readonly isExperimental?: boolean;
|
90
|
+
/**
|
91
|
+
* Whether the save button is enabled and shown
|
92
|
+
*/
|
93
|
+
readonly isSaveButtonEnabled?: boolean;
|
94
|
+
/**
|
95
|
+
* Is the writing textarea automatically focused?
|
96
|
+
*
|
97
|
+
* @default true on Desktop false on mobile (to prevent mobile keyboard from popping up)
|
98
|
+
*/
|
99
|
+
readonly isFocusedOnLoad?: boolean;
|
100
|
+
/**
|
101
|
+
* Optional markdown header to include at the top of exported files.
|
102
|
+
* Example: "## Discussion Topic\n\nSome topic here"
|
103
|
+
*/
|
104
|
+
readonly exportHeaderMarkdown?: string;
|
105
|
+
/**
|
106
|
+
* Optional mapping of participant IDs (message.from) to display metadata for exports.
|
107
|
+
* Keys should match ChatMessage.from values (e.g., 'USER', 'AGENT_{id}', etc.)
|
108
|
+
*/
|
109
|
+
readonly participants?: ReadonlyArray<ChatParticipant>;
|
110
|
+
};
|
@@ -0,0 +1,14 @@
|
|
1
|
+
import type { LlmChatProps } from './LlmChatProps';
|
2
|
+
/**
|
3
|
+
* LlmChat component that provides chat functionality with LLM integration
|
4
|
+
*
|
5
|
+
* This component internally manages messages, participants, and task progress,
|
6
|
+
* and uses the provided LLM tools to generate responses via `LlmExecutionTools.callChatModel`.
|
7
|
+
*
|
8
|
+
* Note: There are multiple chat components:
|
9
|
+
* - `<Chat/>` renders chat as it is without any logic
|
10
|
+
* - `<LlmChat/>` connected to LLM Execution Tools of Promptbook
|
11
|
+
*
|
12
|
+
* @public exported from `@promptbook/components`
|
13
|
+
*/
|
14
|
+
export declare function LlmChat(props: LlmChatProps): import("react/jsx-runtime").JSX.Element;
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1,24 @@
|
|
1
|
+
import type { LlmExecutionTools } from '../../../execution/LlmExecutionTools';
|
2
|
+
import type { ChatProps } from '../Chat/ChatProps';
|
3
|
+
import type { ChatMessage } from '../types/ChatMessage';
|
4
|
+
import type { ChatParticipant } from '../types/ChatParticipant';
|
5
|
+
/**
|
6
|
+
* Props for LlmChat component, derived from ChatProps but with LLM-specific modifications
|
7
|
+
*
|
8
|
+
* @public exported from `@promptbook/components`
|
9
|
+
*/
|
10
|
+
export type LlmChatProps = Omit<ChatProps, 'messages' | 'onMessage' | 'onChange'> & {
|
11
|
+
/**
|
12
|
+
* LLM execution tools for chatting with the model
|
13
|
+
*/
|
14
|
+
readonly llmTools: LlmExecutionTools;
|
15
|
+
/**
|
16
|
+
* Optional key for persisting conversation in localStorage
|
17
|
+
* When provided, the conversation will be saved and restored from localStorage
|
18
|
+
*/
|
19
|
+
readonly persistenceKey?: string;
|
20
|
+
/**
|
21
|
+
* Called when the chat state changes (messages, participants, etc.)
|
22
|
+
*/
|
23
|
+
onChange?(messages: ReadonlyArray<ChatMessage>, participants: ReadonlyArray<ChatParticipant>): void;
|
24
|
+
};
|
@@ -0,0 +1,16 @@
|
|
1
|
+
import type { string_markdown } from '../../../types/typeAliases';
|
2
|
+
import type { string_name } from '../../../types/typeAliases';
|
3
|
+
/**
|
4
|
+
* A message in the chat
|
5
|
+
*
|
6
|
+
* @public exported from `@promptbook/components`
|
7
|
+
*/
|
8
|
+
export type ChatMessage = {
|
9
|
+
id: string;
|
10
|
+
date: Date;
|
11
|
+
from: string_name;
|
12
|
+
content: string_markdown;
|
13
|
+
isComplete?: boolean;
|
14
|
+
expectedAnswer?: string;
|
15
|
+
isVoiceCall?: boolean;
|
16
|
+
};
|
@@ -0,0 +1,32 @@
|
|
1
|
+
import type { string_color } from '../../../types/typeAliases';
|
2
|
+
import type { string_name } from '../../../types/typeAliases';
|
3
|
+
import type { string_person_fullname } from '../../../types/typeAliases';
|
4
|
+
import type { string_url_image } from '../../../types/typeAliases';
|
5
|
+
import { Color } from '../../../utils/color/Color';
|
6
|
+
/**
|
7
|
+
* A participant in the chat
|
8
|
+
*
|
9
|
+
* @public exported from `@promptbook/components`
|
10
|
+
*/
|
11
|
+
export type ChatParticipant = {
|
12
|
+
/**
|
13
|
+
* Identifies the participant by their name, same as `message.from`
|
14
|
+
*/
|
15
|
+
name: string_name;
|
16
|
+
/**
|
17
|
+
* Full name of the participant
|
18
|
+
*/
|
19
|
+
fullname: string_person_fullname;
|
20
|
+
/**
|
21
|
+
* Am I the participant? (i.e. is this the user)
|
22
|
+
*/
|
23
|
+
isMe?: boolean;
|
24
|
+
/**
|
25
|
+
* Profile picture
|
26
|
+
*/
|
27
|
+
avatarSrc?: string_url_image;
|
28
|
+
/**
|
29
|
+
* Color associated with the participant
|
30
|
+
*/
|
31
|
+
color: string_color | Color;
|
32
|
+
};
|
@@ -0,0 +1,25 @@
|
|
1
|
+
import type { ChatMessage } from '../types/ChatMessage';
|
2
|
+
/**
|
3
|
+
* Utility functions for persisting chat conversations in localStorage
|
4
|
+
*
|
5
|
+
* @private util of `LlmChat`
|
6
|
+
*/
|
7
|
+
export declare class ChatPersistence {
|
8
|
+
private static readonly STORAGE_PREFIX;
|
9
|
+
/**
|
10
|
+
* Save messages to localStorage under the given key
|
11
|
+
*/
|
12
|
+
static saveMessages(persistenceKey: string, messages: ReadonlyArray<ChatMessage>): void;
|
13
|
+
/**
|
14
|
+
* Load messages from localStorage for the given key
|
15
|
+
*/
|
16
|
+
static loadMessages(persistenceKey: string): ChatMessage[];
|
17
|
+
/**
|
18
|
+
* Clear messages from localStorage for the given key
|
19
|
+
*/
|
20
|
+
static clearMessages(persistenceKey: string): void;
|
21
|
+
/**
|
22
|
+
* Check if localStorage is available
|
23
|
+
*/
|
24
|
+
static isAvailable(): boolean;
|
25
|
+
}
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import type { ChatMessage } from '../types/ChatMessage';
|
2
|
+
import type { ChatParticipant } from '../types/ChatParticipant';
|
3
|
+
import type { ExportFormat } from './ExportFormat';
|
4
|
+
/**
|
5
|
+
* Exports chat messages in the specified format
|
6
|
+
*
|
7
|
+
* @private utility of `<Chat/>` component
|
8
|
+
*/
|
9
|
+
export declare function exportChatHistory(messages: ChatMessage[], format: ExportFormat, headerMarkdown?: string, participants?: ReadonlyArray<ChatParticipant>): Promise<void>;
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import type { ChatMessage } from '../types/ChatMessage';
|
2
|
+
import type { ChatParticipant } from '../types/ChatParticipant';
|
3
|
+
/**
|
4
|
+
* Generates PDF content using HTML and triggers print dialog
|
5
|
+
*
|
6
|
+
* @private utility of `<Chat/>` component
|
7
|
+
*/
|
8
|
+
export declare function generatePdfContent(messages: ChatMessage[], shareUrl: string, qrDataUrl?: string | null, headerMarkdown?: string, participants?: ReadonlyArray<ChatParticipant>): void;
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import type { ChatMessage } from '../types/ChatMessage';
|
2
|
+
import type { ChatParticipant } from '../types/ChatParticipant';
|
3
|
+
/**
|
4
|
+
* Converts chat messages to HTML format
|
5
|
+
*
|
6
|
+
* @private utility of `<Chat/>` component
|
7
|
+
*/
|
8
|
+
export declare function messagesToHtml(messages: ChatMessage[], shareUrl: string, qrDataUrl?: string | null, headerMarkdown?: string, participants?: ReadonlyArray<ChatParticipant>): string;
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import type { ChatMessage } from '../types/ChatMessage';
|
2
|
+
import type { ChatParticipant } from '../types/ChatParticipant';
|
3
|
+
/**
|
4
|
+
* Converts chat messages to Markdown format
|
5
|
+
*
|
6
|
+
* @private utility of `<Chat/>` component
|
7
|
+
*/
|
8
|
+
export declare function messagesToMarkdown(messages: ChatMessage[], shareUrl: string, qrDataUrl?: string | null, headerMarkdown?: string, participants?: ReadonlyArray<ChatParticipant>): string;
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import type { ChatMessage } from '../types/ChatMessage';
|
2
|
+
import type { ChatParticipant } from '../types/ChatParticipant';
|
3
|
+
/**
|
4
|
+
* Converts chat messages to plain text format
|
5
|
+
*
|
6
|
+
* @private utility of `<Chat/>` component
|
7
|
+
*/
|
8
|
+
export declare function messagesToText(messages: ChatMessage[], shareUrl: string, headerMarkdown?: string, participants?: ReadonlyArray<ChatParticipant>): string;
|
@@ -0,0 +1,7 @@
|
|
1
|
+
import type { string_css_class } from '../../../types/typeAliases';
|
2
|
+
/**
|
3
|
+
* Utility function for joining multiple truthy class names into one string
|
4
|
+
*
|
5
|
+
* @private within the `@promptbook/components`
|
6
|
+
*/
|
7
|
+
export declare function classNames(...classes: Array<string_css_class | undefined | false | null>): string_css_class;
|
@@ -0,0 +1,7 @@
|
|
1
|
+
/**
|
2
|
+
* Collect matching CSS texts from document stylesheets for a given class.
|
3
|
+
* This will skip cross-origin stylesheets (they throw when accessed).
|
4
|
+
*
|
5
|
+
* @private within the promptbook components <- TODO: Maybe make promptbook util from this
|
6
|
+
*/
|
7
|
+
export declare function collectCssTextsForClass(className: string): string[];
|
@@ -281,6 +281,12 @@ export declare function SET_IS_VERBOSE(isVerbose: boolean): void;
|
|
281
281
|
* @public exported from `@promptbook/core`
|
282
282
|
*/
|
283
283
|
export declare const DEFAULT_IS_AUTO_INSTALLED = false;
|
284
|
+
/**
|
285
|
+
* Default simulated duration for a task in milliseconds (used for progress reporting)
|
286
|
+
*
|
287
|
+
* @public exported from `@promptbook/core`
|
288
|
+
*/
|
289
|
+
export declare const DEFAULT_TASK_SIMULATED_DURATION_MS: number;
|
284
290
|
/**
|
285
291
|
* Function name for generated function via `ptbk make` to get the pipeline collection
|
286
292
|
*
|
@@ -295,6 +301,19 @@ export declare const DEFAULT_GET_PIPELINE_COLLECTION_FUNCTION_NAME = "getPipelin
|
|
295
301
|
* @public exported from `@promptbook/core`
|
296
302
|
*/
|
297
303
|
export declare const DEFAULT_MAX_REQUESTS_PER_MINUTE = 60;
|
304
|
+
/**
|
305
|
+
* API request timeout in milliseconds
|
306
|
+
* Can be overridden via API_REQUEST_TIMEOUT environment variable
|
307
|
+
*
|
308
|
+
* @public exported from `@promptbook/core`
|
309
|
+
*/
|
310
|
+
export declare const API_REQUEST_TIMEOUT: number;
|
311
|
+
/**
|
312
|
+
* URL of the Promptbook logo
|
313
|
+
*
|
314
|
+
* @public exported from `@promptbook/core`
|
315
|
+
*/
|
316
|
+
export declare const PROMPTBOOK_LOGO_URL = "https://promptbook.studio/logos/logo-blue-white-256.png";
|
298
317
|
/**
|
299
318
|
* Indicates whether pipeline logic validation is enabled. When true, the pipeline logic is checked for consistency.
|
300
319
|
*
|
@@ -40,6 +40,10 @@ export type AvailableModel = {
|
|
40
40
|
readonly prompt: number_usd;
|
41
41
|
readonly output: number_usd;
|
42
42
|
};
|
43
|
+
/**
|
44
|
+
* If the model is deprecated, it should not be used for new tasks
|
45
|
+
*/
|
46
|
+
readonly isDeprecated?: boolean;
|
43
47
|
};
|
44
48
|
/**
|
45
49
|
* TODO: [🧠] Maybe rename to something else - like `ModelInformation` or `ModelMetadata`
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import type { Observable } from 'rxjs';
|
2
2
|
import { PartialDeep } from 'type-fest';
|
3
|
+
import type { number_percent } from '../types/typeAliases';
|
3
4
|
import type { task_id } from '../types/typeAliases';
|
4
5
|
import type { string_SCREAMING_CASE } from '../utils/normalization/normalizeTo_SCREAMING_CASE';
|
5
6
|
import type { string_promptbook_version } from '../version';
|
@@ -19,7 +20,8 @@ type CreateTaskOptions<TTaskResult extends AbstractTaskResult> = {
|
|
19
20
|
readonly title: AbstractTask<TTaskResult>['title'];
|
20
21
|
/**
|
21
22
|
* Callback that processes the task and updates the ongoing result
|
22
|
-
* @param
|
23
|
+
* @param updateOngoingResult Function to update the partial result of the task processing
|
24
|
+
* @param updateTldr Function to update tldr progress information
|
23
25
|
* @returns The final task result
|
24
26
|
*/
|
25
27
|
taskProcessCallback(updateOngoingResult: (newOngoingResult: PartialDeep<TTaskResult> & {
|
@@ -27,6 +29,9 @@ type CreateTaskOptions<TTaskResult extends AbstractTaskResult> = {
|
|
27
29
|
* Optional update of the task title
|
28
30
|
*/
|
29
31
|
readonly title?: AbstractTask<TTaskResult>['title'];
|
32
|
+
}) => void, updateTldr: (tldrInfo: {
|
33
|
+
readonly percent: number_percent;
|
34
|
+
readonly message: string;
|
30
35
|
}) => void): Promise<TTaskResult>;
|
31
36
|
};
|
32
37
|
/**
|
@@ -80,6 +85,19 @@ export type AbstractTask<TTaskResult extends AbstractTaskResult> = {
|
|
80
85
|
* Status of the task
|
81
86
|
*/
|
82
87
|
readonly status: task_status;
|
88
|
+
/**
|
89
|
+
* Short summary of the task status for quick overview in the UI
|
90
|
+
*/
|
91
|
+
readonly tldr: {
|
92
|
+
/**
|
93
|
+
* Progress in percentage from 0 to 1 (100%) that can be used to display a progress bar
|
94
|
+
*/
|
95
|
+
readonly percent: number_percent;
|
96
|
+
/**
|
97
|
+
* Short summary message of the task status that can be displayed in the UI
|
98
|
+
*/
|
99
|
+
readonly message: string;
|
100
|
+
};
|
83
101
|
/**
|
84
102
|
* Date when the task was created
|
85
103
|
*/
|
@@ -92,6 +110,14 @@ export type AbstractTask<TTaskResult extends AbstractTaskResult> = {
|
|
92
110
|
* Gets a promise that resolves with the task result
|
93
111
|
*/
|
94
112
|
asPromise(options?: {
|
113
|
+
/**
|
114
|
+
* Do the task throws on error
|
115
|
+
*
|
116
|
+
* - If `true` when error occurs the returned promise will rejects
|
117
|
+
* - If `false` the promise will resolve with object with all listed errors and warnings and partial result
|
118
|
+
*
|
119
|
+
* @default true
|
120
|
+
*/
|
95
121
|
readonly isCrashedOnError?: boolean;
|
96
122
|
}): Promise<TTaskResult>;
|
97
123
|
/**
|