@promptbook/components 0.110.0-9 → 0.111.0-0
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 +3376 -722
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/components.index.d.ts +4 -0
- package/esm/typings/src/_packages/core.index.d.ts +2 -2
- package/esm/typings/src/_packages/types.index.d.ts +6 -0
- package/esm/typings/src/_packages/utils.index.d.ts +12 -0
- package/esm/typings/src/book-2.0/agent-source/AgentReferenceResolver.d.ts +18 -0
- package/esm/typings/src/book-2.0/agent-source/BookEditable.d.ts +41 -0
- package/esm/typings/src/book-2.0/agent-source/CreateAgentModelRequirementsOptions.d.ts +17 -0
- package/esm/typings/src/book-2.0/agent-source/createAgentModelRequirements.d.ts +8 -2
- package/esm/typings/src/book-2.0/agent-source/createAgentModelRequirementsWithCommitments.agentReferenceResolver.test.d.ts +1 -0
- package/esm/typings/src/book-2.0/agent-source/createAgentModelRequirementsWithCommitments.d.ts +4 -5
- package/esm/typings/src/book-components/BookEditor/BookEditor.d.ts +42 -0
- package/esm/typings/src/book-components/Chat/Chat/ChatActionsBar.d.ts +0 -2
- package/esm/typings/src/book-components/Chat/Chat/ChatProps.d.ts +11 -0
- package/esm/typings/src/book-components/Chat/Chat/ChatSoundToggle.d.ts +12 -0
- package/esm/typings/src/book-components/Chat/Chat/ImagePromptRenderer.d.ts +21 -0
- package/esm/typings/src/book-components/Chat/LlmChat/LlmChatProps.d.ts +5 -0
- package/esm/typings/src/book-components/Chat/LlmChat/defaults.d.ts +9 -0
- package/esm/typings/src/book-components/Chat/hooks/useChatRatings.d.ts +24 -2
- package/esm/typings/src/book-components/Chat/save/_common/ChatSaveFormatDefinition.d.ts +7 -1
- package/esm/typings/src/book-components/Chat/save/html/htmlSaveFormatDefinition.d.ts +6 -5
- package/esm/typings/src/book-components/Chat/save/index.d.ts +3 -3
- package/esm/typings/src/book-components/Chat/save/pdf/buildChatPdf.d.ts +11 -0
- package/esm/typings/src/book-components/Chat/save/pdf/pdfSaveFormatDefinition.d.ts +2 -2
- package/esm/typings/src/book-components/Chat/utils/getToolCallChipletInfo.d.ts +2 -10
- package/esm/typings/src/book-components/Chat/utils/parseCitationMarker.d.ts +75 -0
- package/esm/typings/src/book-components/Chat/utils/parseCitationsFromContent.d.ts +3 -1
- package/esm/typings/src/book-components/Chat/utils/parseCitationsFromContent.test.d.ts +1 -0
- package/esm/typings/src/book-components/Chat/utils/parseImagePrompts.d.ts +42 -0
- package/esm/typings/src/book-components/Chat/utils/parseImagePrompts.test.d.ts +1 -0
- package/esm/typings/src/book-components/icons/ArrowIcon.d.ts +17 -4
- package/esm/typings/src/commitments/MEMORY/MEMORY.d.ts +67 -0
- package/esm/typings/src/commitments/MEMORY/MEMORY.test.d.ts +1 -0
- package/esm/typings/src/commitments/_common/toolRuntimeContext.d.ts +49 -0
- package/esm/typings/src/constants/streaming.d.ts +20 -0
- package/esm/typings/src/llm-providers/openai/utils/buildToolInvocationScript.d.ts +9 -0
- package/esm/typings/src/utils/clientVersion.d.ts +51 -0
- package/esm/typings/src/utils/knowledge/inlineKnowledgeSource.d.ts +13 -9
- package/esm/typings/src/utils/normalization/constructImageFilename.d.ts +18 -0
- package/esm/typings/src/utils/normalization/constructImageFilename.test.d.ts +1 -0
- package/esm/typings/src/version.d.ts +1 -1
- package/package.json +3 -1
- package/umd/index.umd.js +3377 -725
- package/umd/index.umd.js.map +1 -1
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Default citation identifier used for simplified citation markers without an explicit position.
|
|
3
|
+
*
|
|
4
|
+
* @private utility of `<Chat/>`
|
|
5
|
+
*/
|
|
6
|
+
export declare const DEFAULT_SIMPLIFIED_CITATION_ID = "0:0";
|
|
7
|
+
/**
|
|
8
|
+
* Parsed citation marker normalized to the full OpenAI-style notation.
|
|
9
|
+
*
|
|
10
|
+
* @private utility of `<Chat/>`
|
|
11
|
+
*/
|
|
12
|
+
export type CitationMarker = {
|
|
13
|
+
/**
|
|
14
|
+
* Citation identifier (for example `7:15`).
|
|
15
|
+
*/
|
|
16
|
+
id: string;
|
|
17
|
+
/**
|
|
18
|
+
* Citation source filename or label.
|
|
19
|
+
*/
|
|
20
|
+
source: string;
|
|
21
|
+
/**
|
|
22
|
+
* Original marker exactly as found in the content.
|
|
23
|
+
*/
|
|
24
|
+
raw: string;
|
|
25
|
+
/**
|
|
26
|
+
* Full normalized marker (`【id†source】`).
|
|
27
|
+
*/
|
|
28
|
+
normalized: string;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Creates a global regular expression that matches citation markers wrapped in `【...】`.
|
|
32
|
+
*
|
|
33
|
+
* @private utility of `<Chat/>`
|
|
34
|
+
*/
|
|
35
|
+
export declare function createCitationMarkerRegex(): RegExp;
|
|
36
|
+
/**
|
|
37
|
+
* Parses one citation marker and normalizes it to full notation.
|
|
38
|
+
*
|
|
39
|
+
* @param rawMarker - Marker including outer brackets.
|
|
40
|
+
* @returns Parsed marker or `null` when the marker is invalid.
|
|
41
|
+
*
|
|
42
|
+
* @private utility of `<Chat/>`
|
|
43
|
+
*/
|
|
44
|
+
export declare function parseCitationMarker(rawMarker: string): CitationMarker | null;
|
|
45
|
+
/**
|
|
46
|
+
* Parses all citation markers from content and normalizes each to full notation.
|
|
47
|
+
*
|
|
48
|
+
* @param content - Content that may contain citation markers.
|
|
49
|
+
* @returns Parsed citation markers in their original order.
|
|
50
|
+
*
|
|
51
|
+
* @private utility of `<Chat/>`
|
|
52
|
+
*/
|
|
53
|
+
export declare function parseCitationMarkersFromContent(content: string): CitationMarker[];
|
|
54
|
+
/**
|
|
55
|
+
* Replaces all citation markers in content using normalized marker metadata.
|
|
56
|
+
*
|
|
57
|
+
* @param content - Content that may contain citation markers.
|
|
58
|
+
* @param replacer - Replacement callback for each valid marker.
|
|
59
|
+
* @returns Content with citation markers replaced.
|
|
60
|
+
*
|
|
61
|
+
* @private utility of `<Chat/>`
|
|
62
|
+
*/
|
|
63
|
+
export declare function replaceCitationMarkers(content: string, replacer: (marker: CitationMarker) => string): string;
|
|
64
|
+
/**
|
|
65
|
+
* Normalizes simplified citation markers to full notation.
|
|
66
|
+
*
|
|
67
|
+
* Example:
|
|
68
|
+
* - `【document.pdf】` -> `【0:0†document.pdf】`
|
|
69
|
+
*
|
|
70
|
+
* @param content - Content that may contain simplified markers.
|
|
71
|
+
* @returns Content where every citation marker is in full notation.
|
|
72
|
+
*
|
|
73
|
+
* @private utility of `<Chat/>`
|
|
74
|
+
*/
|
|
75
|
+
export declare function normalizeCitationMarkersToFullNotation(content: string): string;
|
|
@@ -22,7 +22,9 @@ export type ParsedCitation = {
|
|
|
22
22
|
};
|
|
23
23
|
/**
|
|
24
24
|
* Parses OpenAI Assistant-style citations from message content
|
|
25
|
-
* Matches
|
|
25
|
+
* Matches both:
|
|
26
|
+
* - Full notation: `【5:13†document.pdf】`
|
|
27
|
+
* - Simplified notation: `【document.pdf】`
|
|
26
28
|
*
|
|
27
29
|
* @param content - The markdown content that may contain citations
|
|
28
30
|
* @returns Array of parsed citations
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Segment representing parts of a chat message that contain either raw text or an image prompt.
|
|
3
|
+
*
|
|
4
|
+
* @private internal helper of `<ChatMessageItem/>`
|
|
5
|
+
*/
|
|
6
|
+
export type ImagePromptSegment = ImagePromptTextSegment | ImagePromptImageSegment;
|
|
7
|
+
/**
|
|
8
|
+
* Raw text segment that can be rendered as markdown.
|
|
9
|
+
*
|
|
10
|
+
* @private internal helper of `<ChatMessageItem/>`
|
|
11
|
+
*/
|
|
12
|
+
export type ImagePromptTextSegment = {
|
|
13
|
+
type: 'text';
|
|
14
|
+
content: string;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Image prompt segment that needs to fire the image generation pipeline.
|
|
18
|
+
*
|
|
19
|
+
* @private internal helper of `<ChatMessageItem/>`
|
|
20
|
+
*/
|
|
21
|
+
export type ImagePromptImageSegment = {
|
|
22
|
+
type: 'image';
|
|
23
|
+
/**
|
|
24
|
+
* Accessible alt text provided by the agent.
|
|
25
|
+
*/
|
|
26
|
+
alt: string;
|
|
27
|
+
/**
|
|
28
|
+
* Prompt text that will be sent to the image generation API.
|
|
29
|
+
*/
|
|
30
|
+
prompt: string;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Splits a chat message into text and image prompt segments.
|
|
34
|
+
*
|
|
35
|
+
* @param content - Raw markdown string produced by the agent.
|
|
36
|
+
* @returns Ordered list of segments that preserves the original message flow.
|
|
37
|
+
* @private internal helper of `<ChatMessageItem/>`
|
|
38
|
+
*/
|
|
39
|
+
export declare function splitMessageContentByImagePrompts(content: string): ReadonlyArray<ImagePromptSegment>;
|
|
40
|
+
/**
|
|
41
|
+
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
42
|
+
*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,9 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Supported arrow directions.
|
|
3
|
+
*
|
|
4
|
+
* @private internal typing helper for `<ArrowIcon/>`
|
|
5
|
+
*/
|
|
6
|
+
type ArrowDirection = 'DOWN' | 'UP';
|
|
7
|
+
/**
|
|
8
|
+
* Props for rendering a directional arrow icon.
|
|
9
|
+
*
|
|
10
|
+
* @private internal props typing for `<ArrowIcon/>`
|
|
11
|
+
*/
|
|
12
|
+
type ArrowIconProps = {
|
|
13
|
+
direction: ArrowDirection;
|
|
14
|
+
size: number;
|
|
15
|
+
};
|
|
1
16
|
/**
|
|
2
17
|
* Shows simple arrow icon pointing up or down
|
|
3
18
|
*
|
|
4
19
|
* @public exported from `@promptbook/components`
|
|
5
20
|
*/
|
|
6
|
-
export declare const ArrowIcon: ({ direction, size }:
|
|
7
|
-
|
|
8
|
-
size: number;
|
|
9
|
-
}) => import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
export declare const ArrowIcon: ({ direction, size }: ArrowIconProps) => import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
export {};
|
|
@@ -1,5 +1,63 @@
|
|
|
1
|
+
import { string_javascript_name } from '../../_packages/types.index';
|
|
1
2
|
import type { AgentModelRequirements } from '../../book-2.0/agent-source/AgentModelRequirements';
|
|
3
|
+
import { ToolFunction } from '../../scripting/javascript/JavascriptExecutionToolsOptions';
|
|
2
4
|
import { BaseCommitmentDefinition } from '../_base/BaseCommitmentDefinition';
|
|
5
|
+
/**
|
|
6
|
+
* Memory record returned by runtime adapters.
|
|
7
|
+
*
|
|
8
|
+
* @private internal MEMORY commitment types
|
|
9
|
+
*/
|
|
10
|
+
export type MemoryToolRecord = {
|
|
11
|
+
id?: string;
|
|
12
|
+
content: string;
|
|
13
|
+
isGlobal: boolean;
|
|
14
|
+
createdAt?: string;
|
|
15
|
+
updatedAt?: string;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Runtime context for MEMORY tools resolved from hidden tool arguments.
|
|
19
|
+
*
|
|
20
|
+
* @private internal MEMORY commitment types
|
|
21
|
+
*/
|
|
22
|
+
export type MemoryToolRuntimeContext = {
|
|
23
|
+
readonly enabled: boolean;
|
|
24
|
+
readonly userId?: number;
|
|
25
|
+
readonly username?: string;
|
|
26
|
+
readonly agentId?: string;
|
|
27
|
+
readonly agentName?: string;
|
|
28
|
+
readonly isTeamConversation: boolean;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Runtime adapter interface used by MEMORY tools.
|
|
32
|
+
*
|
|
33
|
+
* @private internal MEMORY commitment types
|
|
34
|
+
*/
|
|
35
|
+
export type MemoryToolRuntimeAdapter = {
|
|
36
|
+
retrieveMemories(args: {
|
|
37
|
+
query?: string;
|
|
38
|
+
limit?: number;
|
|
39
|
+
}, runtimeContext: MemoryToolRuntimeContext): Promise<MemoryToolRecord[]>;
|
|
40
|
+
storeMemory(args: {
|
|
41
|
+
content: string;
|
|
42
|
+
isGlobal: boolean;
|
|
43
|
+
}, runtimeContext: MemoryToolRuntimeContext): Promise<MemoryToolRecord>;
|
|
44
|
+
updateMemory(args: {
|
|
45
|
+
memoryId: string;
|
|
46
|
+
content: string;
|
|
47
|
+
isGlobal?: boolean;
|
|
48
|
+
}, runtimeContext: MemoryToolRuntimeContext): Promise<MemoryToolRecord>;
|
|
49
|
+
deleteMemory(args: {
|
|
50
|
+
memoryId: string;
|
|
51
|
+
}, runtimeContext: MemoryToolRuntimeContext): Promise<{
|
|
52
|
+
id?: string;
|
|
53
|
+
}>;
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* Sets runtime adapter used by MEMORY commitment tools.
|
|
57
|
+
*
|
|
58
|
+
* @private internal runtime wiring for MEMORY commitment
|
|
59
|
+
*/
|
|
60
|
+
export declare function setMemoryToolRuntimeAdapter(adapter: MemoryToolRuntimeAdapter | null): void;
|
|
3
61
|
/**
|
|
4
62
|
* MEMORY commitment definition
|
|
5
63
|
*
|
|
@@ -19,6 +77,7 @@ import { BaseCommitmentDefinition } from '../_base/BaseCommitmentDefinition';
|
|
|
19
77
|
*/
|
|
20
78
|
export declare class MemoryCommitmentDefinition extends BaseCommitmentDefinition<'MEMORY' | 'MEMORIES'> {
|
|
21
79
|
constructor(type?: 'MEMORY' | 'MEMORIES');
|
|
80
|
+
get requiresContent(): boolean;
|
|
22
81
|
/**
|
|
23
82
|
* Short one-line description of MEMORY.
|
|
24
83
|
*/
|
|
@@ -32,6 +91,14 @@ export declare class MemoryCommitmentDefinition extends BaseCommitmentDefinition
|
|
|
32
91
|
*/
|
|
33
92
|
get documentation(): string;
|
|
34
93
|
applyToAgentModelRequirements(requirements: AgentModelRequirements, content: string): AgentModelRequirements;
|
|
94
|
+
/**
|
|
95
|
+
* Gets human-readable titles for MEMORY tool functions.
|
|
96
|
+
*/
|
|
97
|
+
getToolTitles(): Record<string_javascript_name, string>;
|
|
98
|
+
/**
|
|
99
|
+
* Gets MEMORY tool function implementations.
|
|
100
|
+
*/
|
|
101
|
+
getToolFunctions(): Record<string_javascript_name, ToolFunction>;
|
|
35
102
|
}
|
|
36
103
|
/**
|
|
37
104
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { TODO_any } from '../../_packages/types.index';
|
|
2
|
+
/**
|
|
3
|
+
* Prompt parameter key used to pass hidden runtime context to tool execution.
|
|
4
|
+
*
|
|
5
|
+
* @private internal runtime wiring for commitment tools
|
|
6
|
+
*/
|
|
7
|
+
export declare const TOOL_RUNTIME_CONTEXT_PARAMETER = "promptbookToolRuntimeContext";
|
|
8
|
+
/**
|
|
9
|
+
* Hidden argument key used to pass runtime context into individual tool calls.
|
|
10
|
+
*
|
|
11
|
+
* @private internal runtime wiring for commitment tools
|
|
12
|
+
*/
|
|
13
|
+
export declare const TOOL_RUNTIME_CONTEXT_ARGUMENT = "__promptbookToolRuntimeContext";
|
|
14
|
+
/**
|
|
15
|
+
* Runtime context shape shared across commitment tools.
|
|
16
|
+
*
|
|
17
|
+
* @private internal runtime wiring for commitment tools
|
|
18
|
+
*/
|
|
19
|
+
export type ToolRuntimeContext = {
|
|
20
|
+
memory?: {
|
|
21
|
+
enabled?: boolean;
|
|
22
|
+
userId?: number;
|
|
23
|
+
username?: string;
|
|
24
|
+
agentId?: string;
|
|
25
|
+
agentName?: string;
|
|
26
|
+
isTeamConversation?: boolean;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Parses unknown runtime context payload into a normalized object.
|
|
31
|
+
*
|
|
32
|
+
* @private internal runtime wiring for commitment tools
|
|
33
|
+
*/
|
|
34
|
+
export declare function parseToolRuntimeContext(rawValue: unknown): ToolRuntimeContext | null;
|
|
35
|
+
/**
|
|
36
|
+
* Reads runtime context attached to tool call arguments.
|
|
37
|
+
*
|
|
38
|
+
* @private internal runtime wiring for commitment tools
|
|
39
|
+
*/
|
|
40
|
+
export declare function readToolRuntimeContextFromToolArgs(args: Record<string, TODO_any>): ToolRuntimeContext | null;
|
|
41
|
+
/**
|
|
42
|
+
* Serializes runtime context for prompt parameters.
|
|
43
|
+
*
|
|
44
|
+
* @private internal runtime wiring for commitment tools
|
|
45
|
+
*/
|
|
46
|
+
export declare function serializeToolRuntimeContext(context: ToolRuntimeContext): string;
|
|
47
|
+
/**
|
|
48
|
+
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
49
|
+
*/
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Keep-alive helpers used for streaming chat responses.
|
|
3
|
+
*
|
|
4
|
+
* These constants coordinate the signal sent by the Agents Server streaming
|
|
5
|
+
* endpoint and the parser in the SDK so we can distinguish between
|
|
6
|
+
* real content and occasional pings.
|
|
7
|
+
*
|
|
8
|
+
* @private internal streaming helper for Promptbook chat connections
|
|
9
|
+
*/
|
|
10
|
+
export declare const CHAT_STREAM_KEEP_ALIVE_TOKEN = "STREAM_KEEP_ALIVE";
|
|
11
|
+
/**
|
|
12
|
+
* Interval (milliseconds) between keep-alive pings emitted while the chat server
|
|
13
|
+
* is still composing the reply.
|
|
14
|
+
*
|
|
15
|
+
* @private internal streaming helper for Promptbook chat connections
|
|
16
|
+
*/
|
|
17
|
+
export declare const CHAT_STREAM_KEEP_ALIVE_INTERVAL_MS = 25000;
|
|
18
|
+
/**
|
|
19
|
+
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
20
|
+
*/
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Builds a tool invocation script that injects hidden runtime context into tool args.
|
|
3
|
+
*
|
|
4
|
+
* @private utility of OpenAI tool execution wrappers
|
|
5
|
+
*/
|
|
6
|
+
export declare function buildToolInvocationScript(options: {
|
|
7
|
+
readonly functionName: string;
|
|
8
|
+
readonly functionArgsExpression: string;
|
|
9
|
+
}): string;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HTTP header used by Promptbook clients to advertise their release version.
|
|
3
|
+
*
|
|
4
|
+
* @public exported from `@promptbook/utils`
|
|
5
|
+
*/
|
|
6
|
+
export declare const CLIENT_VERSION_HEADER = "x-promptbook-client-version";
|
|
7
|
+
/**
|
|
8
|
+
* The latest client (engine) version that the server expects.
|
|
9
|
+
*
|
|
10
|
+
* @public exported from `@promptbook/utils`
|
|
11
|
+
*/
|
|
12
|
+
export declare const CLIENT_LATEST_VERSION: string;
|
|
13
|
+
/**
|
|
14
|
+
* Determines if the provided version string exactly matches the latest release.
|
|
15
|
+
*
|
|
16
|
+
* @param version - Version string obtained from a request header.
|
|
17
|
+
* @returns True when the version equals `CLIENT_LATEST_VERSION`.
|
|
18
|
+
*
|
|
19
|
+
* @public exported from `@promptbook/utils`
|
|
20
|
+
*/
|
|
21
|
+
export declare function isClientVersionCompatible(version: unknown): version is string;
|
|
22
|
+
/**
|
|
23
|
+
* Formats the message that should be shown when a client is out of date.
|
|
24
|
+
*
|
|
25
|
+
* @param clientVersion - The version reported by the client (optional).
|
|
26
|
+
* @returns User-facing text explaining how to fix the mismatch.
|
|
27
|
+
*
|
|
28
|
+
* @public exported from `@promptbook/utils`
|
|
29
|
+
*/
|
|
30
|
+
export declare function formatClientVersionMismatchMessage(clientVersion?: string | null): string;
|
|
31
|
+
/**
|
|
32
|
+
* Creates a headers object that includes the client version header.
|
|
33
|
+
*
|
|
34
|
+
* @param headers - Optional base headers to clone.
|
|
35
|
+
* @returns New headers object augmented with `CLIENT_VERSION_HEADER`.
|
|
36
|
+
*
|
|
37
|
+
* @public exported from `@promptbook/utils`
|
|
38
|
+
*/
|
|
39
|
+
export declare function attachClientVersionHeader<T extends Record<string, string> = Record<string, string>>(headers?: T): T & Record<typeof CLIENT_VERSION_HEADER, string>;
|
|
40
|
+
/**
|
|
41
|
+
* Normalizes the client version reported inside a `HeadersInit` object.
|
|
42
|
+
*
|
|
43
|
+
* @param headers - Headers collection to read from.
|
|
44
|
+
* @returns The trimmed client version or `null` when it is missing.
|
|
45
|
+
*
|
|
46
|
+
* @public exported from `@promptbook/utils`
|
|
47
|
+
*/
|
|
48
|
+
export declare function getClientVersionFromHeaders(headers?: HeadersInit): string | null;
|
|
49
|
+
/**
|
|
50
|
+
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
51
|
+
*/
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
/// <reference types="node" />
|
|
3
|
-
import type { string_data_url, string_filename } from '../../types/typeAliases';
|
|
3
|
+
import type { string_data_url, string_filename, string_knowledge_source_link } from '../../types/typeAliases';
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* @private thing of inline knowledge
|
|
5
|
+
* @private Internal representation of inline knowledge prepared for uploads.
|
|
8
6
|
*/
|
|
9
7
|
export type InlineKnowledgeSourceFile = {
|
|
10
8
|
readonly filename: string_filename;
|
|
11
9
|
readonly mimeType: string;
|
|
12
|
-
readonly
|
|
10
|
+
readonly buffer: Buffer;
|
|
13
11
|
};
|
|
14
12
|
/**
|
|
15
|
-
*
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
* @private Function signature used to upload inline knowledge files to external storage.
|
|
14
|
+
*/
|
|
15
|
+
export type InlineKnowledgeSourceUploader = (file: InlineKnowledgeSourceFile) => Promise<string_knowledge_source_link>;
|
|
16
|
+
/**
|
|
17
|
+
* @private Converts inline knowledge into the internal metadata form used for uploads.
|
|
18
18
|
*/
|
|
19
19
|
export declare function createInlineKnowledgeSourceFile(content: string): InlineKnowledgeSourceFile;
|
|
20
20
|
/**
|
|
@@ -23,10 +23,14 @@ export declare function createInlineKnowledgeSourceFile(content: string): Inline
|
|
|
23
23
|
* @private thing of inline knowledge
|
|
24
24
|
*/
|
|
25
25
|
export declare function isDataUrlKnowledgeSource(source: string): source is string_data_url;
|
|
26
|
+
/**
|
|
27
|
+
* @private Converts a stored inline knowledge file into a data URL for backwards compatibility.
|
|
28
|
+
*/
|
|
29
|
+
export declare function inlineKnowledgeSourceToDataUrl(source: InlineKnowledgeSourceFile): string_knowledge_source_link;
|
|
26
30
|
/**
|
|
27
31
|
* Parses a data URL-based knowledge source into its raw buffer, filename, and MIME type.
|
|
28
32
|
*
|
|
29
|
-
* @private
|
|
33
|
+
* @private utility of inline knowledge processing
|
|
30
34
|
*/
|
|
31
35
|
export declare function parseDataUrlKnowledgeSource(source: string): {
|
|
32
36
|
readonly buffer: Buffer;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Constructs a standardized filename for a generated image based on its prompt and parameters.
|
|
3
|
+
*
|
|
4
|
+
* @param params - The parameters for the image generation
|
|
5
|
+
* @returns The constructed filename
|
|
6
|
+
*
|
|
7
|
+
* @private internal helper for image generation pipeline
|
|
8
|
+
*/
|
|
9
|
+
export declare function constructImageFilename(params: {
|
|
10
|
+
prompt: string;
|
|
11
|
+
model?: string;
|
|
12
|
+
size?: string;
|
|
13
|
+
quality?: string;
|
|
14
|
+
style?: string;
|
|
15
|
+
attachments?: Array<{
|
|
16
|
+
url: string;
|
|
17
|
+
}>;
|
|
18
|
+
}): string;
|
|
@@ -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.110.0
|
|
18
|
+
* It follows semantic versioning (e.g., `0.110.0`).
|
|
19
19
|
*
|
|
20
20
|
* @generated
|
|
21
21
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@promptbook/components",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.111.0-0",
|
|
4
4
|
"description": "Promptbook: Turn your company's scattered knowledge into AI ready books",
|
|
5
5
|
"private": false,
|
|
6
6
|
"sideEffects": false,
|
|
@@ -105,8 +105,10 @@
|
|
|
105
105
|
"crypto": "1.0.1",
|
|
106
106
|
"crypto-js": "4.2.0",
|
|
107
107
|
"destroyable": "0.12.141",
|
|
108
|
+
"jspdf": "^4.1.0",
|
|
108
109
|
"katex": "0.16.25",
|
|
109
110
|
"moment": "2.30.1",
|
|
111
|
+
"monaco-editor": "0.54.0",
|
|
110
112
|
"openai": "6.18.0",
|
|
111
113
|
"papaparse": "5.4.1",
|
|
112
114
|
"qrcode": "1.5.4",
|