@promptbook/types 0.110.0-8 → 0.110.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/README.md +0 -4
- package/esm/typings/src/_packages/components.index.d.ts +6 -0
- package/esm/typings/src/_packages/core.index.d.ts +2 -2
- package/esm/typings/src/_packages/types.index.d.ts +10 -0
- package/esm/typings/src/book-2.0/agent-source/AgentModelRequirements.d.ts +22 -21
- package/esm/typings/src/book-2.0/agent-source/AgentReferenceResolver.d.ts +18 -0
- package/esm/typings/src/book-2.0/agent-source/CreateAgentModelRequirementsOptions.d.ts +12 -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/ChatInputArea.d.ts +1 -0
- package/esm/typings/src/book-components/Chat/Chat/ChatMessageItem.d.ts +4 -0
- package/esm/typings/src/book-components/Chat/Chat/ChatMessageList.d.ts +1 -0
- package/esm/typings/src/book-components/Chat/Chat/ChatProps.d.ts +26 -0
- package/esm/typings/src/book-components/Chat/Chat/ChatSoundToggle.d.ts +31 -0
- package/esm/typings/src/book-components/Chat/LlmChat/LlmChatProps.d.ts +6 -0
- package/esm/typings/src/book-components/Chat/hooks/useChatRatings.d.ts +24 -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/icons/ArrowIcon.d.ts +17 -4
- package/esm/typings/src/commitments/_base/BaseCommitmentDefinition.d.ts +9 -0
- package/esm/typings/src/llm-providers/agent/AgentLlmExecutionTools.test.d.ts +1 -0
- package/esm/typings/src/llm-providers/openai/OpenAiAgentKitExecutionTools.d.ts +39 -0
- package/esm/typings/src/types/LlmToolDefinition.d.ts +1 -0
- package/esm/typings/src/types/ModelRequirements.d.ts +9 -0
- package/esm/typings/src/utils/DEFAULT_THINKING_MESSAGES.d.ts +8 -0
- package/esm/typings/src/utils/knowledge/inlineKnowledgeSource.d.ts +38 -0
- package/esm/typings/src/utils/knowledge/inlineKnowledgeSource.test.d.ts +1 -0
- package/esm/typings/src/utils/language/getBrowserPreferredSpeechRecognitionLanguage.d.ts +35 -0
- package/esm/typings/src/version.d.ts +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -27,10 +27,6 @@ Turn your company's scattered knowledge into AI ready Books
|
|
|
27
27
|
|
|
28
28
|
|
|
29
29
|
|
|
30
|
-
<blockquote style="color: #ff8811">
|
|
31
|
-
<b>⚠ Warning:</b> This is a pre-release version of the library. It is not yet ready for production use. Please look at <a href="https://www.npmjs.com/package/@promptbook/core?activeTab=versions">latest stable release</a>.
|
|
32
|
-
</blockquote>
|
|
33
|
-
|
|
34
30
|
## 📦 Package `@promptbook/types`
|
|
35
31
|
|
|
36
32
|
- Promptbooks are [divided into several](#-packages) packages, all are published from [single monorepo](https://github.com/webgptorg/promptbook).
|
|
@@ -15,9 +15,12 @@ import { BookEditor } from '../book-components/BookEditor/BookEditor';
|
|
|
15
15
|
import { AgentChat } from '../book-components/Chat/AgentChat/AgentChat';
|
|
16
16
|
import type { AgentChatProps } from '../book-components/Chat/AgentChat/AgentChatProps';
|
|
17
17
|
import { Chat } from '../book-components/Chat/Chat/Chat';
|
|
18
|
+
import type { ChatFeedbackResponse } from '../book-components/Chat/Chat/ChatProps';
|
|
18
19
|
import type { ChatSoundSystem } from '../book-components/Chat/Chat/ChatProps';
|
|
19
20
|
import type { ChatProps } from '../book-components/Chat/Chat/ChatProps';
|
|
20
21
|
import { ChatSoundToggle } from '../book-components/Chat/Chat/ChatSoundToggle';
|
|
22
|
+
import { ChatVibrationToggle } from '../book-components/Chat/Chat/ChatSoundToggle';
|
|
23
|
+
import { ChatSoundAndVibrationPanel } from '../book-components/Chat/Chat/ChatSoundToggle';
|
|
21
24
|
import { ChatEffectsSystem } from '../book-components/Chat/effects/ChatEffectsSystem';
|
|
22
25
|
import { ConfettiEffect } from '../book-components/Chat/effects/components/ConfettiEffect';
|
|
23
26
|
import { HeartsEffect } from '../book-components/Chat/effects/components/HeartsEffect';
|
|
@@ -85,9 +88,12 @@ export { BookEditor };
|
|
|
85
88
|
export { AgentChat };
|
|
86
89
|
export type { AgentChatProps };
|
|
87
90
|
export { Chat };
|
|
91
|
+
export type { ChatFeedbackResponse };
|
|
88
92
|
export type { ChatSoundSystem };
|
|
89
93
|
export type { ChatProps };
|
|
90
94
|
export { ChatSoundToggle };
|
|
95
|
+
export { ChatVibrationToggle };
|
|
96
|
+
export { ChatSoundAndVibrationPanel };
|
|
91
97
|
export { ChatEffectsSystem };
|
|
92
98
|
export { ConfettiEffect };
|
|
93
99
|
export { HeartsEffect };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BOOK_LANGUAGE_VERSION, PROMPTBOOK_ENGINE_VERSION } from '../version';
|
|
2
2
|
import { computeAgentHash } from '../book-2.0/agent-source/computeAgentHash';
|
|
3
3
|
import { createAgentModelRequirements } from '../book-2.0/agent-source/createAgentModelRequirements';
|
|
4
|
-
import {
|
|
4
|
+
import type { CreateAgentModelRequirementsOptions } from '../book-2.0/agent-source/CreateAgentModelRequirementsOptions';
|
|
5
5
|
import { createDefaultAgentName } from '../book-2.0/agent-source/createDefaultAgentName';
|
|
6
6
|
import { normalizeAgentName } from '../book-2.0/agent-source/normalizeAgentName';
|
|
7
7
|
import { PADDING_LINES } from '../book-2.0/agent-source/padBook';
|
|
@@ -205,7 +205,7 @@ import { PUBLIC_AGENTS_SERVERS } from '../../servers';
|
|
|
205
205
|
export { BOOK_LANGUAGE_VERSION, PROMPTBOOK_ENGINE_VERSION };
|
|
206
206
|
export { computeAgentHash };
|
|
207
207
|
export { createAgentModelRequirements };
|
|
208
|
-
export {
|
|
208
|
+
export type { CreateAgentModelRequirementsOptions };
|
|
209
209
|
export { createDefaultAgentName };
|
|
210
210
|
export { normalizeAgentName };
|
|
211
211
|
export { PADDING_LINES };
|
|
@@ -2,6 +2,7 @@ import type { BookParameter } from '../book-2.0/agent-source/AgentBasicInformati
|
|
|
2
2
|
import type { AgentCapability } from '../book-2.0/agent-source/AgentBasicInformation';
|
|
3
3
|
import type { AgentBasicInformation } from '../book-2.0/agent-source/AgentBasicInformation';
|
|
4
4
|
import type { AgentModelRequirements } from '../book-2.0/agent-source/AgentModelRequirements';
|
|
5
|
+
import type { CreateAgentModelRequirementsOptions } from '../book-2.0/agent-source/CreateAgentModelRequirementsOptions';
|
|
5
6
|
import type { string_book } from '../book-2.0/agent-source/string_book';
|
|
6
7
|
import type { AvatarChipProps } from '../book-components/AvatarProfile/AvatarChip/AvatarChip';
|
|
7
8
|
import type { AvatarChipFromSourceProps } from '../book-components/AvatarProfile/AvatarChip/AvatarChipFromSource';
|
|
@@ -13,9 +14,12 @@ import type { BookEditorProps } from '../book-components/BookEditor/BookEditor';
|
|
|
13
14
|
import type { AgentChatProps } from '../book-components/Chat/AgentChat/AgentChatProps';
|
|
14
15
|
import type { AgentChipData } from '../book-components/Chat/AgentChip/AgentChip';
|
|
15
16
|
import type { AgentChipProps } from '../book-components/Chat/AgentChip/AgentChip';
|
|
17
|
+
import type { ChatFeedbackResponse } from '../book-components/Chat/Chat/ChatProps';
|
|
16
18
|
import type { ChatSoundSystem } from '../book-components/Chat/Chat/ChatProps';
|
|
17
19
|
import type { ChatProps } from '../book-components/Chat/Chat/ChatProps';
|
|
18
20
|
import type { ChatSoundToggleProps } from '../book-components/Chat/Chat/ChatSoundToggle';
|
|
21
|
+
import type { ChatVibrationToggleProps } from '../book-components/Chat/Chat/ChatSoundToggle';
|
|
22
|
+
import type { ChatSoundAndVibrationPanelProps } from '../book-components/Chat/Chat/ChatSoundToggle';
|
|
19
23
|
import type { ChatEffect } from '../book-components/Chat/effects/types/ChatEffect';
|
|
20
24
|
import type { ChatEffectConfig } from '../book-components/Chat/effects/types/ChatEffectConfig';
|
|
21
25
|
import type { ChatEffectsSystemProps } from '../book-components/Chat/effects/types/ChatEffectsSystemProps';
|
|
@@ -373,6 +377,7 @@ import type { number_gigabytes } from '../types/typeAliases';
|
|
|
373
377
|
import type { number_terabytes } from '../types/typeAliases';
|
|
374
378
|
import type { Updatable } from '../types/Updatable';
|
|
375
379
|
import type { ColorTransformer } from '../utils/color/operators/ColorTransformer';
|
|
380
|
+
import type { ThinkingMessageVariant } from '../utils/DEFAULT_THINKING_MESSAGES';
|
|
376
381
|
import type { PipelineEditableSerialized } from '../utils/editable/types/PipelineEditableSerialized';
|
|
377
382
|
import type { ExecCommandOptions } from '../utils/execCommand/ExecCommandOptions';
|
|
378
383
|
import type { ExecCommandOptionsAdvanced } from '../utils/execCommand/ExecCommandOptions';
|
|
@@ -405,6 +410,7 @@ export type { BookParameter };
|
|
|
405
410
|
export type { AgentCapability };
|
|
406
411
|
export type { AgentBasicInformation };
|
|
407
412
|
export type { AgentModelRequirements };
|
|
413
|
+
export type { CreateAgentModelRequirementsOptions };
|
|
408
414
|
export type { string_book };
|
|
409
415
|
export type { AvatarChipProps };
|
|
410
416
|
export type { AvatarChipFromSourceProps };
|
|
@@ -416,9 +422,12 @@ export type { BookEditorProps };
|
|
|
416
422
|
export type { AgentChatProps };
|
|
417
423
|
export type { AgentChipData };
|
|
418
424
|
export type { AgentChipProps };
|
|
425
|
+
export type { ChatFeedbackResponse };
|
|
419
426
|
export type { ChatSoundSystem };
|
|
420
427
|
export type { ChatProps };
|
|
421
428
|
export type { ChatSoundToggleProps };
|
|
429
|
+
export type { ChatVibrationToggleProps };
|
|
430
|
+
export type { ChatSoundAndVibrationPanelProps };
|
|
422
431
|
export type { ChatEffect };
|
|
423
432
|
export type { ChatEffectConfig };
|
|
424
433
|
export type { ChatEffectsSystemProps };
|
|
@@ -776,6 +785,7 @@ export type { number_gigabytes };
|
|
|
776
785
|
export type { number_terabytes };
|
|
777
786
|
export type { Updatable };
|
|
778
787
|
export type { ColorTransformer };
|
|
788
|
+
export type { ThinkingMessageVariant };
|
|
779
789
|
export type { PipelineEditableSerialized };
|
|
780
790
|
export type { ExecCommandOptions };
|
|
781
791
|
export type { ExecCommandOptionsAdvanced };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { LlmToolDefinition } from '../../types/LlmToolDefinition';
|
|
2
2
|
import type { string_agent_url, string_knowledge_source_link } from '../../types/typeAliases';
|
|
3
|
-
import
|
|
3
|
+
import { chococake } from '../../utils/organization/really_any';
|
|
4
4
|
/**
|
|
5
5
|
* Model requirements for an agent
|
|
6
6
|
*
|
|
@@ -12,22 +12,16 @@ export type AgentModelRequirements = {
|
|
|
12
12
|
*/
|
|
13
13
|
readonly systemMessage: string;
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
15
|
+
* Text appended to every user prompt after the user's input and before tools/messages.
|
|
16
|
+
*
|
|
17
|
+
* This allows commitments to emphasize important rules or reminders that should be
|
|
18
|
+
* visible in the prompt in addition to the system message.
|
|
16
19
|
*/
|
|
17
|
-
readonly
|
|
20
|
+
readonly promptSuffix: string;
|
|
18
21
|
/**
|
|
19
|
-
*
|
|
20
|
-
*/
|
|
21
|
-
readonly mcpServers?: ReadonlyArray<string>;
|
|
22
|
-
/**
|
|
23
|
-
* Optional link to the parent agent from which this agent inherits
|
|
24
|
-
*
|
|
25
|
-
* Note: [🆓] There are several cases what the agent ancestor could be:
|
|
26
|
-
* - 1) `parentAgentUrl` is `string_agent_url` valid agent URL
|
|
27
|
-
* - 2) `parentAgentUrl` is explicitly `null` (forcefully no parent)
|
|
28
|
-
* - 3) `parentAgentUrl` is not defined `undefined`, the default ancestor agent, Adam, will be used
|
|
22
|
+
* The model name to use for this agent
|
|
29
23
|
*/
|
|
30
|
-
readonly
|
|
24
|
+
readonly modelName: string;
|
|
31
25
|
/**
|
|
32
26
|
* List of imported agent URLs
|
|
33
27
|
*/
|
|
@@ -64,17 +58,24 @@ export type AgentModelRequirements = {
|
|
|
64
58
|
*/
|
|
65
59
|
readonly tools?: ReadonlyArray<LlmToolDefinition>;
|
|
66
60
|
/**
|
|
67
|
-
*
|
|
68
|
-
* Each commitment can store its own data here
|
|
61
|
+
* Optional list of MCP servers that the agent can connect to
|
|
69
62
|
*/
|
|
70
|
-
readonly
|
|
63
|
+
readonly mcpServers?: ReadonlyArray<string>;
|
|
71
64
|
/**
|
|
72
|
-
*
|
|
73
|
-
|
|
74
|
-
|
|
65
|
+
* The URL of the parent agent to inherit from, or null if there is no parent (i.e., do not inherit from any agent)
|
|
66
|
+
*/
|
|
67
|
+
readonly parentAgentUrl: string_agent_url | null;
|
|
68
|
+
/**
|
|
69
|
+
* Is the agent closed to modification by conversation (i.e., it will not learn from interactions and its source code will remain static during conversation)
|
|
70
|
+
*/
|
|
71
|
+
readonly isClosed: boolean;
|
|
72
|
+
/**
|
|
73
|
+
* Arbitrary metadata storage for commitments
|
|
74
|
+
* Each commitment can store its own data here
|
|
75
75
|
*/
|
|
76
|
-
readonly
|
|
76
|
+
readonly _metadata?: Record<string, chococake>;
|
|
77
77
|
};
|
|
78
78
|
/**
|
|
79
79
|
* TODO: [🐤] DRY `AgentModelRequirements` and `ModelRequirements`
|
|
80
|
+
* TODO: [🧠] `isClosed` and `parentAgentUrl` doesn't truly belong to `AgentModelRequirements` nor agent profile but it is in the `AgentModelRequirements` because of some legacy - maybe figure out better place
|
|
80
81
|
*/
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { BookCommitment } from '../../commitments/_base/BookCommitment';
|
|
2
|
+
/**
|
|
3
|
+
* Resolves compact agent references that appear inside FROM, IMPORT, and TEAM commitments.
|
|
4
|
+
*
|
|
5
|
+
* Implementations are expected to rewrite reference tokens such as `{Activation code agent}`
|
|
6
|
+
* or `@Superagent` into concrete agent URLs before the commitment is applied.
|
|
7
|
+
*
|
|
8
|
+
* @private @@@
|
|
9
|
+
*/
|
|
10
|
+
export type AgentReferenceResolver = {
|
|
11
|
+
/**
|
|
12
|
+
* Normalizes the content of a commitment before it is applied to the model requirements.
|
|
13
|
+
*
|
|
14
|
+
* @param commitmentType - The commitment keyword (e.g. FROM, IMPORT, TEAM)
|
|
15
|
+
* @param content - Original payload of the commitment
|
|
16
|
+
*/
|
|
17
|
+
resolveCommitmentContent(commitmentType: BookCommitment, content: string): Promise<string>;
|
|
18
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { AgentReferenceResolver } from './AgentReferenceResolver';
|
|
2
|
+
/**
|
|
3
|
+
* Options for `createAgentModelRequirements` and `createAgentModelRequirementsWithCommitments`.
|
|
4
|
+
*
|
|
5
|
+
* @public exported from `@promptbook/core`
|
|
6
|
+
*/
|
|
7
|
+
export type CreateAgentModelRequirementsOptions = {
|
|
8
|
+
/**
|
|
9
|
+
* Resolver that transforms compact agent references (FROM, IMPORT, TEAM) into concrete URLs.
|
|
10
|
+
*/
|
|
11
|
+
readonly agentReferenceResolver?: AgentReferenceResolver;
|
|
12
|
+
};
|
|
@@ -2,17 +2,23 @@ import type { AvailableModel } from '../../execution/AvailableModel';
|
|
|
2
2
|
import type { LlmExecutionTools } from '../../execution/LlmExecutionTools';
|
|
3
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
|
+
import type { CreateAgentModelRequirementsOptions } from './CreateAgentModelRequirementsOptions';
|
|
5
6
|
import type { string_book } from './string_book';
|
|
6
7
|
/**
|
|
7
|
-
* Creates model requirements for an agent based on its source
|
|
8
|
+
* Creates model requirements for an agent based on its source.
|
|
8
9
|
*
|
|
9
10
|
* There are 2 similar functions:
|
|
10
11
|
* - `parseAgentSource` which is a lightweight parser for agent source, it parses basic information and its purpose is to be quick and synchronous. The commitments there are hardcoded.
|
|
11
12
|
* - `createAgentModelRequirements` which is an asynchronous function that creates model requirements it applies each commitment one by one and works asynchronous.
|
|
12
13
|
*
|
|
14
|
+
* @param agentSource - Book describing the agent.
|
|
15
|
+
* @param modelName - Optional override for the agent's model.
|
|
16
|
+
* @param availableModels - Models that could fulfill the agent.
|
|
17
|
+
* @param llmTools - Execution tools used when selecting a best model.
|
|
18
|
+
* @param options - Optional hooks such as the agent reference resolver.
|
|
13
19
|
* @public exported from `@promptbook/core`
|
|
14
20
|
*/
|
|
15
|
-
export declare function createAgentModelRequirements(agentSource: string_book, modelName?: string_model_name, availableModels?: readonly AvailableModel[], llmTools?: LlmExecutionTools): Promise<AgentModelRequirements>;
|
|
21
|
+
export declare function createAgentModelRequirements(agentSource: string_book, modelName?: string_model_name, availableModels?: readonly AvailableModel[], llmTools?: LlmExecutionTools, options?: CreateAgentModelRequirementsOptions): Promise<AgentModelRequirements>;
|
|
16
22
|
/**
|
|
17
23
|
* Extracts MCP servers from agent source
|
|
18
24
|
*
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/esm/typings/src/book-2.0/agent-source/createAgentModelRequirementsWithCommitments.d.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import type { string_model_name } from '../../types/typeAliases';
|
|
2
2
|
import type { AgentModelRequirements } from './AgentModelRequirements';
|
|
3
|
+
import type { CreateAgentModelRequirementsOptions } from './CreateAgentModelRequirementsOptions';
|
|
3
4
|
import type { string_book } from './string_book';
|
|
4
5
|
/**
|
|
5
|
-
*
|
|
6
|
-
* This function uses a reduce-like pattern where each commitment applies its changes
|
|
7
|
-
* to build the final requirements starting from a basic empty model
|
|
6
|
+
* @@@
|
|
8
7
|
*
|
|
9
|
-
* @
|
|
8
|
+
* @private @@@
|
|
10
9
|
*/
|
|
11
|
-
export declare function createAgentModelRequirementsWithCommitments(agentSource: string_book, modelName?: string_model_name): Promise<AgentModelRequirements>;
|
|
10
|
+
export declare function createAgentModelRequirementsWithCommitments(agentSource: string_book, modelName?: string_model_name, options?: CreateAgentModelRequirementsOptions): Promise<AgentModelRequirements>;
|
|
@@ -2,6 +2,43 @@ import { CSSProperties } from 'react';
|
|
|
2
2
|
import type { Promisable } from 'type-fest';
|
|
3
3
|
import type { string_book } from '../../book-2.0/agent-source/string_book';
|
|
4
4
|
import type { number_percent, number_positive, string_css_value, string_knowledge_source_content } from '../../types/typeAliases';
|
|
5
|
+
/**
|
|
6
|
+
* Monaco diagnostic shown inside `BookEditor`.
|
|
7
|
+
*
|
|
8
|
+
* @private internal type of `BookEditor`
|
|
9
|
+
*/
|
|
10
|
+
type BookEditorDiagnostic = {
|
|
11
|
+
/**
|
|
12
|
+
* 1-based start line.
|
|
13
|
+
*/
|
|
14
|
+
readonly startLineNumber: number;
|
|
15
|
+
/**
|
|
16
|
+
* 1-based start column.
|
|
17
|
+
*/
|
|
18
|
+
readonly startColumn: number;
|
|
19
|
+
/**
|
|
20
|
+
* 1-based end line.
|
|
21
|
+
*/
|
|
22
|
+
readonly endLineNumber: number;
|
|
23
|
+
/**
|
|
24
|
+
* 1-based end column.
|
|
25
|
+
*/
|
|
26
|
+
readonly endColumn: number;
|
|
27
|
+
/**
|
|
28
|
+
* Diagnostic message shown by Monaco.
|
|
29
|
+
*/
|
|
30
|
+
readonly message: string;
|
|
31
|
+
/**
|
|
32
|
+
* Marker severity used for color coding in Monaco.
|
|
33
|
+
*
|
|
34
|
+
* @default 'error'
|
|
35
|
+
*/
|
|
36
|
+
readonly severity?: 'error' | 'warning' | 'info' | 'hint';
|
|
37
|
+
/**
|
|
38
|
+
* Optional source label shown in Monaco hover.
|
|
39
|
+
*/
|
|
40
|
+
readonly source?: string;
|
|
41
|
+
};
|
|
5
42
|
/**
|
|
6
43
|
* Default height of the book editor
|
|
7
44
|
*
|
|
@@ -76,6 +113,10 @@ export type BookEditorProps = {
|
|
|
76
113
|
* Callback function to handle changes in the book content.
|
|
77
114
|
*/
|
|
78
115
|
onChange?(value: string_book): void;
|
|
116
|
+
/**
|
|
117
|
+
* Optional Monaco diagnostics shown as squiggle markers in the editor.
|
|
118
|
+
*/
|
|
119
|
+
readonly diagnostics?: ReadonlyArray<BookEditorDiagnostic>;
|
|
79
120
|
/**
|
|
80
121
|
* Returns the URL of the uploaded file on CDN or storage.
|
|
81
122
|
*/
|
|
@@ -162,6 +203,7 @@ export type BookEditorProps = {
|
|
|
162
203
|
* @public exported from `@promptbook/components`
|
|
163
204
|
*/
|
|
164
205
|
export declare function BookEditor(props: BookEditorProps): import("react/jsx-runtime").JSX.Element;
|
|
206
|
+
export {};
|
|
165
207
|
/**
|
|
166
208
|
* TODO: [☁️] Export component prop types only to `@promptbook/components` (not `@promptbook/types`)
|
|
167
209
|
*/
|
|
@@ -3,7 +3,6 @@ import type { Promisable } from 'type-fest';
|
|
|
3
3
|
import type { string_chat_format_name } from '../save/_common/string_chat_format_name';
|
|
4
4
|
import type { ChatMessage } from '../types/ChatMessage';
|
|
5
5
|
import type { ChatParticipant } from '../types/ChatParticipant';
|
|
6
|
-
import type { ChatSoundSystem } from './ChatProps';
|
|
7
6
|
/**
|
|
8
7
|
* Props for the Chat actions toolbar.
|
|
9
8
|
*
|
|
@@ -26,7 +25,6 @@ export type ChatActionsBarProps = {
|
|
|
26
25
|
*/
|
|
27
26
|
shouldDisableActions: boolean;
|
|
28
27
|
onButtonClick: (handler?: (event: MouseEvent<HTMLButtonElement>) => void) => (event: MouseEvent<HTMLButtonElement>) => void;
|
|
29
|
-
soundSystem?: ChatSoundSystem;
|
|
30
28
|
};
|
|
31
29
|
/**
|
|
32
30
|
* Renders the action buttons row for Chat.
|
|
@@ -29,6 +29,7 @@ export type ChatInputAreaProps = {
|
|
|
29
29
|
onChange?: ChatProps['onChange'];
|
|
30
30
|
onFileUpload?: ChatProps['onFileUpload'];
|
|
31
31
|
speechRecognition?: ChatProps['speechRecognition'];
|
|
32
|
+
speechRecognitionLanguage?: ChatProps['speechRecognitionLanguage'];
|
|
32
33
|
defaultMessage?: string;
|
|
33
34
|
placeholderMessageContent?: string;
|
|
34
35
|
isFocusedOnLoad?: boolean;
|
|
@@ -52,6 +52,10 @@ type ChatMessageItemProps = Pick<ChatProps, 'onMessage' | 'participants'> & {
|
|
|
52
52
|
* Called when a source citation chip is clicked.
|
|
53
53
|
*/
|
|
54
54
|
onCitationClick?: (citation: ParsedCitation) => void;
|
|
55
|
+
/**
|
|
56
|
+
* Optional sound system for triggering tool chip events.
|
|
57
|
+
*/
|
|
58
|
+
soundSystem?: ChatProps['soundSystem'];
|
|
55
59
|
};
|
|
56
60
|
/**
|
|
57
61
|
* Metadata for a teammate agent tool.
|
|
@@ -27,6 +27,7 @@ export type ChatMessageListProps = {
|
|
|
27
27
|
teammates?: ChatProps['teammates'];
|
|
28
28
|
onToolCallClick?: (toolCall: NonNullable<ChatMessage['toolCalls']>[number]) => void;
|
|
29
29
|
onCitationClick?: (citation: ParsedCitation) => void;
|
|
30
|
+
soundSystem?: ChatProps['soundSystem'];
|
|
30
31
|
setChatMessagesElement: (element: HTMLDivElement | null) => void;
|
|
31
32
|
onScroll: (event: UIEvent<HTMLDivElement>) => void;
|
|
32
33
|
chatMessagesClassName?: string;
|
|
@@ -6,6 +6,17 @@ import { string_color } from '../../../types/typeAliases';
|
|
|
6
6
|
import type { string_chat_format_name } from '../save/_common/string_chat_format_name';
|
|
7
7
|
import type { ChatMessage } from '../types/ChatMessage';
|
|
8
8
|
import type { ChatParticipant } from '../types/ChatParticipant';
|
|
9
|
+
/**
|
|
10
|
+
* Response data returned by the optional `onFeedback` handler.
|
|
11
|
+
*
|
|
12
|
+
* @public exported from `@promptbook/components`
|
|
13
|
+
*/
|
|
14
|
+
export type ChatFeedbackResponse = {
|
|
15
|
+
/**
|
|
16
|
+
* Optional text that should be shown to the user after the feedback is saved.
|
|
17
|
+
*/
|
|
18
|
+
readonly message?: string;
|
|
19
|
+
};
|
|
9
20
|
/**
|
|
10
21
|
* Interface for sound system that can be passed to Chat component
|
|
11
22
|
* This allows the chat to trigger sounds without tight coupling
|
|
@@ -20,6 +31,16 @@ export type ChatSoundSystem = {
|
|
|
20
31
|
isEnabled(): boolean;
|
|
21
32
|
setEnabled(enabled: boolean): void;
|
|
22
33
|
toggle(): boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Optional helpers for haptic vibration state.
|
|
36
|
+
*/
|
|
37
|
+
isVibrationEnabled?(): boolean;
|
|
38
|
+
setVibrationEnabled?(enabled: boolean): void;
|
|
39
|
+
toggleVibration?(): boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Optional vibration helper to stay in sync with sound events.
|
|
42
|
+
*/
|
|
43
|
+
vibrate?(event: string): void;
|
|
23
44
|
};
|
|
24
45
|
/**
|
|
25
46
|
* @public exported from `@promptbook/components`
|
|
@@ -66,6 +87,11 @@ export type ChatProps = {
|
|
|
66
87
|
* Speech recognition provider
|
|
67
88
|
*/
|
|
68
89
|
readonly speechRecognition?: SpeechRecognition;
|
|
90
|
+
/**
|
|
91
|
+
* Optional language tag (BCP 47) to force speech recognition to use a specific language.
|
|
92
|
+
* When not provided, the browser preferences are used with a fallback to `en-US`.
|
|
93
|
+
*/
|
|
94
|
+
readonly speechRecognitionLanguage?: string;
|
|
69
95
|
/**
|
|
70
96
|
* Optional placeholder message for the textarea
|
|
71
97
|
*
|
|
@@ -21,3 +21,34 @@ export type ChatSoundToggleProps = {
|
|
|
21
21
|
* @public exported from `@promptbook/components`
|
|
22
22
|
*/
|
|
23
23
|
export declare function ChatSoundToggle(props: ChatSoundToggleProps): import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
/**
|
|
25
|
+
* Props for the chat vibration toggle.
|
|
26
|
+
*/
|
|
27
|
+
export type ChatVibrationToggleProps = {
|
|
28
|
+
/**
|
|
29
|
+
* The sound system instance that supports vibration helpers.
|
|
30
|
+
*/
|
|
31
|
+
soundSystem: ChatSoundSystem;
|
|
32
|
+
/**
|
|
33
|
+
* Optional CSS class name.
|
|
34
|
+
*/
|
|
35
|
+
className?: string;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* ChatVibrationToggle component that controls haptic feedback.
|
|
39
|
+
*
|
|
40
|
+
* @public exported from `@promptbook/components`
|
|
41
|
+
*/
|
|
42
|
+
export declare function ChatVibrationToggle(props: ChatVibrationToggleProps): import("react/jsx-runtime").JSX.Element | null;
|
|
43
|
+
/**
|
|
44
|
+
* Props for the combined sound and vibration control panel.
|
|
45
|
+
*/
|
|
46
|
+
export type ChatSoundAndVibrationPanelProps = {
|
|
47
|
+
readonly soundSystem: ChatSoundSystem;
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* Renders a compact control panel that surfaces both sound and haptic toggles with richer affordances.
|
|
51
|
+
*
|
|
52
|
+
* @public exported from `@promptbook/components`
|
|
53
|
+
*/
|
|
54
|
+
export declare function ChatSoundAndVibrationPanel(props: ChatSoundAndVibrationPanelProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -62,6 +62,12 @@ export type LlmChatProps = Omit<ChatProps, 'messages' | 'onMessage' | 'onChange'
|
|
|
62
62
|
* e.g., { "web_search": "Searching the web..." }
|
|
63
63
|
*/
|
|
64
64
|
readonly toolTitles?: Record<string, string>;
|
|
65
|
+
/**
|
|
66
|
+
* Custom variants for the placeholder thinking message shown while the agent buffers its response.
|
|
67
|
+
*
|
|
68
|
+
* @default Shared thinking message variants
|
|
69
|
+
*/
|
|
70
|
+
readonly thinkingMessages?: ReadonlyArray<string>;
|
|
65
71
|
/**
|
|
66
72
|
* Optional custom error handler that will be called when an error occurs during chat.
|
|
67
73
|
* If not provided, errors will be displayed as messages in the chat.
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Promisable } from 'type-fest';
|
|
2
2
|
import type { id } from '../../../types/typeAliases';
|
|
3
3
|
import type { ChatMessage } from '../types/ChatMessage';
|
|
4
|
+
import type { ChatFeedbackResponse } from '../Chat/ChatProps';
|
|
4
5
|
/**
|
|
5
6
|
* Input parameters for the chat rating hook.
|
|
6
7
|
*
|
|
@@ -21,12 +22,33 @@ export type UseChatRatingsOptions = {
|
|
|
21
22
|
chatThread: string;
|
|
22
23
|
expectedAnswer: string | null;
|
|
23
24
|
url: string;
|
|
24
|
-
}) => Promisable<void>;
|
|
25
|
+
}) => Promisable<ChatFeedbackResponse | void>;
|
|
25
26
|
/**
|
|
26
27
|
* Whether the UI should apply mobile-specific behavior.
|
|
27
28
|
*/
|
|
28
29
|
isMobile: boolean;
|
|
29
30
|
};
|
|
31
|
+
/**
|
|
32
|
+
* Indicates how the feedback status message should be rendered.
|
|
33
|
+
*
|
|
34
|
+
* @private component of `<Chat/>`
|
|
35
|
+
*/
|
|
36
|
+
export type FeedbackStatusVariant = 'success' | 'error';
|
|
37
|
+
/**
|
|
38
|
+
* Data used to show the transient feedback status toast.
|
|
39
|
+
*
|
|
40
|
+
* @private component of `<Chat/>`
|
|
41
|
+
*/
|
|
42
|
+
export type FeedbackStatus = {
|
|
43
|
+
/**
|
|
44
|
+
* Message displayed to the user.
|
|
45
|
+
*/
|
|
46
|
+
readonly message: string;
|
|
47
|
+
/**
|
|
48
|
+
* Whether the message indicates success or failure.
|
|
49
|
+
*/
|
|
50
|
+
readonly variant: FeedbackStatusVariant;
|
|
51
|
+
};
|
|
30
52
|
/**
|
|
31
53
|
* Rating state tracked for the chat UI.
|
|
32
54
|
*
|
|
@@ -39,7 +61,7 @@ export type ChatRatingsState = {
|
|
|
39
61
|
textRating: string;
|
|
40
62
|
hoveredRating: number;
|
|
41
63
|
expandedMessageId: id | null;
|
|
42
|
-
|
|
64
|
+
feedbackStatus: FeedbackStatus | null;
|
|
43
65
|
};
|
|
44
66
|
/**
|
|
45
67
|
* Rating actions for the chat UI.
|
|
@@ -7,19 +7,13 @@ import type { AgentChipData } from '../AgentChip';
|
|
|
7
7
|
*/
|
|
8
8
|
export type ToolCallChipletInfo = {
|
|
9
9
|
/**
|
|
10
|
-
* Display text for the chiplet
|
|
10
|
+
* Display text for the chiplet.
|
|
11
11
|
*/
|
|
12
12
|
text: string;
|
|
13
13
|
/**
|
|
14
|
-
* Agent data for team tools (if applicable)
|
|
14
|
+
* Agent data for team tools (if applicable).
|
|
15
15
|
*/
|
|
16
16
|
agentData?: AgentChipData;
|
|
17
|
-
/**
|
|
18
|
-
* Whether to wrap the chip text in brackets when rendering.
|
|
19
|
-
*
|
|
20
|
-
* @default true
|
|
21
|
-
*/
|
|
22
|
-
wrapInBrackets?: boolean;
|
|
23
17
|
};
|
|
24
18
|
/**
|
|
25
19
|
* Builds display text for a tool call chiplet.
|
|
@@ -33,12 +27,10 @@ export declare function buildToolCallChipText(chipletInfo: ToolCallChipletInfo):
|
|
|
33
27
|
* Technical to user-friendly tool names and emojis
|
|
34
28
|
*
|
|
35
29
|
* @private utility of `<Chat/>` [🧠] Maybe public?
|
|
36
|
-
*
|
|
37
30
|
*/
|
|
38
31
|
export declare const TOOL_TITLES: Record<string, {
|
|
39
32
|
title: string;
|
|
40
33
|
emoji: string;
|
|
41
|
-
wrapInBrackets?: boolean;
|
|
42
34
|
}>;
|
|
43
35
|
/**
|
|
44
36
|
* Gets the chiplet information including text and agent data (for team tools).
|
|
@@ -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 {};
|
|
@@ -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 {};
|
|
@@ -57,6 +57,15 @@ export declare abstract class BaseCommitmentDefinition<TBookCommitment extends s
|
|
|
57
57
|
* Helper method to append content to the system message
|
|
58
58
|
*/
|
|
59
59
|
protected appendToSystemMessage(requirements: AgentModelRequirements, content: string, separator?: string): AgentModelRequirements;
|
|
60
|
+
/**
|
|
61
|
+
* Helper method to create a new requirements object with updated prompt suffix
|
|
62
|
+
*/
|
|
63
|
+
protected updatePromptSuffix(requirements: AgentModelRequirements, contentUpdate: string | ((currentSuffix: string) => string)): AgentModelRequirements;
|
|
64
|
+
/**
|
|
65
|
+
* Helper method to append content to the prompt suffix
|
|
66
|
+
* Default separator is a single newline for bullet lists.
|
|
67
|
+
*/
|
|
68
|
+
protected appendToPromptSuffix(requirements: AgentModelRequirements, content: string, separator?: string): AgentModelRequirements;
|
|
60
69
|
/**
|
|
61
70
|
* Helper method to add a comment section to the system message
|
|
62
71
|
* Comments are lines starting with # that will be removed from the final system message
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { Agent as AgentFromKit } from '@openai/agents';
|
|
2
|
+
import OpenAI from 'openai';
|
|
3
|
+
import { TODO_any } from '../../_packages/types.index';
|
|
2
4
|
import type { LlmExecutionTools } from '../../execution/LlmExecutionTools';
|
|
3
5
|
import type { ChatPromptResult } from '../../execution/PromptResult';
|
|
4
6
|
import type { ModelRequirements } from '../../types/ModelRequirements';
|
|
@@ -6,6 +8,42 @@ import type { Prompt } from '../../types/Prompt';
|
|
|
6
8
|
import type { string_markdown, string_markdown_text, string_title } from '../../types/typeAliases';
|
|
7
9
|
import type { OpenAiAgentKitExecutionToolsOptions } from './OpenAiAgentKitExecutionToolsOptions';
|
|
8
10
|
import { OpenAiVectorStoreHandler } from './OpenAiVectorStoreHandler';
|
|
11
|
+
/**
|
|
12
|
+
* Represents the AgentKit output configuration used to match OpenAI `response_format` expectations.
|
|
13
|
+
*
|
|
14
|
+
* @private utility of Open AI
|
|
15
|
+
*/
|
|
16
|
+
export type AgentOutputType = 'text' | JsonSchemaDefinition;
|
|
17
|
+
type JsonSchemaDefinitionEntry = {
|
|
18
|
+
type?: string;
|
|
19
|
+
description?: string;
|
|
20
|
+
properties?: Record<string, JsonSchemaDefinitionEntry>;
|
|
21
|
+
required?: Array<string>;
|
|
22
|
+
items?: JsonSchemaDefinitionEntry;
|
|
23
|
+
[key: string]: TODO_any;
|
|
24
|
+
};
|
|
25
|
+
type JsonSchemaDefinition = {
|
|
26
|
+
type: 'json_schema';
|
|
27
|
+
name: string;
|
|
28
|
+
strict: boolean;
|
|
29
|
+
schema: {
|
|
30
|
+
type: 'object';
|
|
31
|
+
properties: Record<string, JsonSchemaDefinitionEntry>;
|
|
32
|
+
required: Array<string>;
|
|
33
|
+
additionalProperties: boolean;
|
|
34
|
+
description?: string;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
type OpenAiChatResponseFormat = OpenAI.Chat.Completions.ChatCompletionCreateParamsNonStreaming['response_format'];
|
|
38
|
+
/**
|
|
39
|
+
* Maps OpenAI `response_format` payloads to AgentKit output types so the runner can forward
|
|
40
|
+
* structured-output preferences to OpenAI while still reusing the same AgentKit agent instance.
|
|
41
|
+
*
|
|
42
|
+
* @param responseFormat - The OpenAI `response_format` payload from the user request.
|
|
43
|
+
* @returns An Agent output type compatible with the requested schema or `undefined` when no impact is required.
|
|
44
|
+
* @private utility of Open AI
|
|
45
|
+
*/
|
|
46
|
+
export declare function mapResponseFormatToAgentOutputType(responseFormat?: OpenAiChatResponseFormat): AgentOutputType | undefined;
|
|
9
47
|
/**
|
|
10
48
|
* Alias for OpenAI AgentKit agent to avoid naming confusion with Promptbook agents.
|
|
11
49
|
*/
|
|
@@ -82,6 +120,7 @@ export declare class OpenAiAgentKitExecutionTools extends OpenAiVectorStoreHandl
|
|
|
82
120
|
readonly prompt: Prompt;
|
|
83
121
|
readonly rawPromptContent?: string;
|
|
84
122
|
readonly onProgress: (chunk: ChatPromptResult) => void;
|
|
123
|
+
readonly responseFormatOutputType?: AgentOutputType;
|
|
85
124
|
}): Promise<ChatPromptResult>;
|
|
86
125
|
/**
|
|
87
126
|
* Builds AgentKit input items from the prompt and optional thread.
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { LlmToolDefinition } from './LlmToolDefinition';
|
|
2
2
|
import type { ModelVariant } from './ModelVariant';
|
|
3
3
|
import type { number_model_temperature, number_seed, string_model_name, string_system_message } from './typeAliases';
|
|
4
|
+
import type OpenAI from 'openai';
|
|
4
5
|
/**
|
|
5
6
|
* Abstract way to specify the LLM.
|
|
6
7
|
* It does not specify the LLM with concrete version itself, only the requirements for the LLM.
|
|
@@ -54,6 +55,14 @@ export type ChatModelRequirements = CommonModelRequirements & {
|
|
|
54
55
|
* Maximum number of tokens that can be generated by the model
|
|
55
56
|
*/
|
|
56
57
|
readonly maxTokens?: number;
|
|
58
|
+
/**
|
|
59
|
+
* Optional OpenAI `response_format` override that should be forwarded to compatible APIs.
|
|
60
|
+
*/
|
|
61
|
+
readonly responseFormat?: OpenAI.Chat.Completions.ChatCompletionCreateParamsNonStreaming['response_format'];
|
|
62
|
+
/**
|
|
63
|
+
* Optional OpenAI `tool_choice` override that should be forwarded to compatible APIs.
|
|
64
|
+
*/
|
|
65
|
+
readonly toolChoice?: OpenAI.Chat.Completions.ChatCompletionToolChoiceOption;
|
|
57
66
|
};
|
|
58
67
|
/**
|
|
59
68
|
* Model requirements for the image generation variant
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Default placeholder variants shown when an agent is still composing a response.
|
|
3
|
+
*
|
|
4
|
+
* @private BUT maybe export via some package
|
|
5
|
+
*/
|
|
6
|
+
export declare const DEFAULT_THINKING_MESSAGES: readonly ["Thinking...", "Searching for information...", "Sorting information..."];
|
|
7
|
+
/** @internal */
|
|
8
|
+
export type ThinkingMessageVariant = (typeof DEFAULT_THINKING_MESSAGES)[number];
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
3
|
+
import type { string_data_url, string_filename } from '../../types/typeAliases';
|
|
4
|
+
/**
|
|
5
|
+
* @@@
|
|
6
|
+
*
|
|
7
|
+
* @private thing of inline knowledge
|
|
8
|
+
*/
|
|
9
|
+
export type InlineKnowledgeSourceFile = {
|
|
10
|
+
readonly filename: string_filename;
|
|
11
|
+
readonly mimeType: string;
|
|
12
|
+
readonly url: string_data_url;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Creates a data URL that represents the inline knowledge content as a text file.
|
|
16
|
+
*
|
|
17
|
+
* @private thing of inline knowledge
|
|
18
|
+
*/
|
|
19
|
+
export declare function createInlineKnowledgeSourceFile(content: string): InlineKnowledgeSourceFile;
|
|
20
|
+
/**
|
|
21
|
+
* Checks whether the provided source string is a data URL that can be decoded.
|
|
22
|
+
*
|
|
23
|
+
* @private thing of inline knowledge
|
|
24
|
+
*/
|
|
25
|
+
export declare function isDataUrlKnowledgeSource(source: string): source is string_data_url;
|
|
26
|
+
/**
|
|
27
|
+
* Parses a data URL-based knowledge source into its raw buffer, filename, and MIME type.
|
|
28
|
+
*
|
|
29
|
+
* @private thing of inline knowledge
|
|
30
|
+
*/
|
|
31
|
+
export declare function parseDataUrlKnowledgeSource(source: string): {
|
|
32
|
+
readonly buffer: Buffer;
|
|
33
|
+
readonly filename: string_filename;
|
|
34
|
+
readonly mimeType: string;
|
|
35
|
+
} | null;
|
|
36
|
+
/**
|
|
37
|
+
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
38
|
+
*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @@@
|
|
3
|
+
*
|
|
4
|
+
* @private function of Agents Server speech recognition language resolution, not a general-purpose utility
|
|
5
|
+
*/
|
|
6
|
+
type ResolveSpeechRecognitionLanguageOptions = {
|
|
7
|
+
/**
|
|
8
|
+
* Overrides the default language resolution when provided.
|
|
9
|
+
*/
|
|
10
|
+
readonly overrideLanguage?: string | null;
|
|
11
|
+
/**
|
|
12
|
+
* Optional Accept-Language header string to derive the speaker language from server-side requests.
|
|
13
|
+
*/
|
|
14
|
+
readonly acceptLanguageHeader?: string | null;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Parses the primary language out of an Accept-Language header value.
|
|
18
|
+
*
|
|
19
|
+
* @private function of Agents Server speech recognition language resolution, not a general-purpose utility
|
|
20
|
+
*/
|
|
21
|
+
export declare function parseSpeechRecognitionLanguageFromAcceptLanguageHeader(header?: string | null): string | undefined;
|
|
22
|
+
/**
|
|
23
|
+
* Reads the browser-reported preferred language list and returns the first valid tag.
|
|
24
|
+
*
|
|
25
|
+
* @private function of Agents Server speech recognition language resolution, not a general-purpose utility
|
|
26
|
+
*/
|
|
27
|
+
export declare function getBrowserPreferredSpeechRecognitionLanguage(): string | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* Resolves a speech recognition language tag by checking an optional override, then the Accept-Language header,
|
|
30
|
+
* then the browser preferences, and finally falling back to a default of `en-US`.
|
|
31
|
+
*
|
|
32
|
+
* @private function of Agents Server speech recognition language resolution, not a general-purpose utility
|
|
33
|
+
*/
|
|
34
|
+
export declare function resolveSpeechRecognitionLanguage(options?: ResolveSpeechRecognitionLanguageOptions): string;
|
|
35
|
+
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-11`).
|
|
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.110.0
|
|
3
|
+
"version": "0.110.0",
|
|
4
4
|
"description": "Promptbook: Turn your company's scattered knowledge into AI ready books",
|
|
5
5
|
"private": false,
|
|
6
6
|
"sideEffects": false,
|
|
@@ -95,6 +95,6 @@
|
|
|
95
95
|
},
|
|
96
96
|
"typings": "./esm/typings/src/_packages/types.index.d.ts",
|
|
97
97
|
"peerDependencies": {
|
|
98
|
-
"@promptbook/core": "0.110.0
|
|
98
|
+
"@promptbook/core": "0.110.0"
|
|
99
99
|
}
|
|
100
100
|
}
|