@promptbook/wizard 0.101.0-2 → 0.101.0-21
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 +423 -250
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/components.index.d.ts +20 -0
- package/esm/typings/src/_packages/core.index.d.ts +14 -0
- package/esm/typings/src/_packages/types.index.d.ts +14 -0
- package/esm/typings/src/book-2.0/agent-source/AgentBasicInformation.d.ts +41 -3
- package/esm/typings/src/book-2.0/agent-source/AgentModelRequirements.d.ts +3 -0
- package/esm/typings/src/book-2.0/agent-source/createAgentModelRequirements.d.ts +4 -22
- package/esm/typings/src/book-2.0/agent-source/createAgentModelRequirementsWithCommitments.d.ts +1 -26
- package/esm/typings/src/book-2.0/agent-source/parseParameters.d.ts +13 -0
- package/esm/typings/src/book-2.0/commitments/ACTION/ACTION.d.ts +2 -8
- package/esm/typings/src/book-2.0/commitments/DELETE/DELETE.d.ts +35 -0
- package/esm/typings/src/book-2.0/commitments/FORMAT/FORMAT.d.ts +2 -8
- package/esm/typings/src/book-2.0/commitments/GOAL/GOAL.d.ts +33 -0
- package/esm/typings/src/book-2.0/commitments/KNOWLEDGE/KNOWLEDGE.d.ts +0 -6
- package/esm/typings/src/book-2.0/commitments/MEMORY/MEMORY.d.ts +34 -0
- package/esm/typings/src/book-2.0/commitments/MESSAGE/MESSAGE.d.ts +35 -0
- package/esm/typings/src/book-2.0/commitments/META/META.d.ts +56 -0
- package/esm/typings/src/book-2.0/commitments/META_IMAGE/META_IMAGE.d.ts +0 -6
- package/esm/typings/src/book-2.0/commitments/META_LINK/META_LINK.d.ts +0 -6
- package/esm/typings/src/book-2.0/commitments/MODEL/MODEL.d.ts +25 -10
- package/esm/typings/src/book-2.0/commitments/NOTE/NOTE.d.ts +2 -8
- package/esm/typings/src/book-2.0/commitments/PERSONA/PERSONA.d.ts +2 -8
- package/esm/typings/src/book-2.0/commitments/RULE/RULE.d.ts +0 -12
- package/esm/typings/src/book-2.0/commitments/SAMPLE/SAMPLE.d.ts +0 -12
- package/esm/typings/src/book-2.0/commitments/SCENARIO/SCENARIO.d.ts +34 -0
- package/esm/typings/src/book-2.0/commitments/STYLE/STYLE.d.ts +2 -8
- package/esm/typings/src/book-2.0/commitments/_base/createEmptyAgentModelRequirements.d.ts +1 -1
- package/esm/typings/src/book-2.0/commitments/index.d.ts +7 -3
- package/esm/typings/src/book-2.0/utils/generatePlaceholderAgentProfileImageUrl.d.ts +3 -0
- package/esm/typings/src/book-components/AvatarProfile/AvatarChip/AvatarChip.d.ts +5 -2
- package/esm/typings/src/book-components/AvatarProfile/AvatarProfile/AvatarProfile.d.ts +3 -0
- package/esm/typings/src/book-components/AvatarProfile/AvatarProfile/MockedChat.d.ts +63 -0
- package/esm/typings/src/book-components/AvatarProfile/AvatarProfile/index.d.ts +3 -0
- package/esm/typings/src/book-components/BookEditor/BookEditor.d.ts +18 -0
- package/esm/typings/src/book-components/BookEditor/BookEditorInner.d.ts +2 -12
- package/esm/typings/src/book-components/Chat/Chat/ChatProps.d.ts +29 -0
- package/esm/typings/src/book-components/Chat/LlmChat/LlmChatProps.d.ts +13 -0
- package/esm/typings/src/book-components/Chat/hooks/index.d.ts +2 -0
- package/esm/typings/src/book-components/Chat/hooks/useChatAutoScroll.d.ts +41 -0
- package/esm/typings/src/book-components/Chat/hooks/useSendMessageToLlmChat.d.ts +44 -0
- package/esm/typings/src/book-components/Chat/utils/parseMessageButtons.d.ts +22 -0
- package/esm/typings/src/book-components/icons/PauseIcon.d.ts +8 -0
- package/esm/typings/src/book-components/icons/PlayIcon.d.ts +8 -0
- package/esm/typings/src/execution/PromptResult.d.ts +2 -4
- package/esm/typings/src/execution/createPipelineExecutor/40-executeAttempts.d.ts +1 -2
- package/esm/typings/src/execution/createPipelineExecutor/getKnowledgeForTask.d.ts +1 -3
- package/esm/typings/src/formats/csv/CsvFormatError.d.ts +1 -1
- package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsConfigurationFromEnv.d.ts +1 -1
- package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsForTestingAndScriptsAndPlayground.d.ts +1 -1
- package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsForWizardOrCli.d.ts +1 -2
- package/esm/typings/src/llm-providers/_common/register/createLlmToolsFromConfiguration.d.ts +8 -2
- package/esm/typings/src/llm-providers/_common/utils/removeUnsupportedModelRequirements.d.ts +25 -0
- package/esm/typings/src/llm-providers/_multiple/MultipleLlmExecutionTools.d.ts +7 -18
- package/esm/typings/src/llm-providers/_multiple/getSingleLlmExecutionTools.d.ts +11 -0
- package/esm/typings/src/llm-providers/_multiple/joinLlmExecutionTools.d.ts +2 -1
- package/esm/typings/src/llm-providers/agent/AgentLlmExecutionTools.d.ts +58 -0
- package/esm/typings/src/llm-providers/agent/createAgentLlmExecutionTools.d.ts +29 -0
- package/esm/typings/src/llm-providers/agent/playground/playground.d.ts +8 -0
- package/esm/typings/src/llm-providers/agent/register-configuration.d.ts +11 -0
- package/esm/typings/src/llm-providers/agent/register-constructor.d.ts +13 -0
- package/esm/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionTools.d.ts +3 -8
- package/esm/typings/src/llm-providers/azure-openai/AzureOpenAiExecutionTools.d.ts +4 -5
- package/esm/typings/src/llm-providers/mocked/$fakeTextToExpectations.d.ts +1 -0
- package/esm/typings/src/llm-providers/mocked/MockedEchoLlmExecutionTools.d.ts +4 -10
- package/esm/typings/src/llm-providers/mocked/MockedFackedLlmExecutionTools.d.ts +4 -6
- package/esm/typings/src/llm-providers/ollama/OllamaExecutionTools.d.ts +3 -3
- package/esm/typings/src/llm-providers/openai/OpenAiCompatibleExecutionTools.d.ts +16 -8
- package/esm/typings/src/llm-providers/openai/OpenAiExecutionTools.d.ts +3 -8
- package/esm/typings/src/llm-providers/remote/RemoteLlmExecutionTools.d.ts +5 -14
- package/esm/typings/src/personas/preparePersona.d.ts +1 -0
- package/esm/typings/src/remote-server/openapi-types.d.ts +31 -31
- package/esm/typings/src/scrapers/markdown/MarkdownScraper.d.ts +1 -2
- package/esm/typings/src/types/ModelRequirements.d.ts +2 -4
- package/esm/typings/src/utils/color/utils/colorSaturation.d.ts +1 -1
- package/esm/typings/src/utils/editable/edit-pipeline-string/addPipelineCommand.d.ts +1 -1
- package/esm/typings/src/utils/markdown/humanizeAiText.d.ts +1 -1
- package/esm/typings/src/utils/markdown/promptbookifyAiText.d.ts +2 -2
- package/esm/typings/src/version.d.ts +1 -1
- package/package.json +2 -2
- package/umd/index.umd.js +423 -250
- package/umd/index.umd.js.map +1 -1
- package/esm/typings/src/book-2.0/utils/extractAgentMetadata.d.ts +0 -17
- package/esm/typings/src/book-2.0/utils/extractProfileImageFromSystemMessage.d.ts +0 -12
- package/esm/typings/src/book-components/Chat/examples/ChatMarkdownDemo.d.ts +0 -16
- package/esm/typings/src/expectations/drafts/isDomainNameFree.d.ts +0 -10
- package/esm/typings/src/expectations/drafts/isGithubNameFree.d.ts +0 -10
- package/esm/typings/src/llm-providers/_common/profiles/llmProviderProfiles.d.ts +0 -81
- /package/esm/typings/src/llm-providers/_common/{profiles/test/llmProviderProfiles.test.d.ts → utils/removeUnsupportedModelRequirements.test.d.ts} +0 -0
@@ -7,18 +7,28 @@ import type { AvatarProfileProps } from '../book-components/AvatarProfile/Avatar
|
|
7
7
|
import { AvatarProfile } from '../book-components/AvatarProfile/AvatarProfile/AvatarProfile';
|
8
8
|
import type { AvatarProfileFromSourceProps } from '../book-components/AvatarProfile/AvatarProfile/AvatarProfileFromSource';
|
9
9
|
import { AvatarProfileFromSource } from '../book-components/AvatarProfile/AvatarProfile/AvatarProfileFromSource';
|
10
|
+
import type { MockedChatDelayConfig } from '../book-components/AvatarProfile/AvatarProfile/MockedChat';
|
11
|
+
import type { MockedChatProps } from '../book-components/AvatarProfile/AvatarProfile/MockedChat';
|
12
|
+
import { MockedChat } from '../book-components/AvatarProfile/AvatarProfile/MockedChat';
|
10
13
|
import type { BookEditorProps } from '../book-components/BookEditor/BookEditor';
|
11
14
|
import { BookEditor } from '../book-components/BookEditor/BookEditor';
|
12
15
|
import { DEFAULT_BOOK_FONT_CLASS } from '../book-components/BookEditor/config';
|
13
16
|
import { Chat } from '../book-components/Chat/Chat/Chat';
|
14
17
|
import type { ChatProps } from '../book-components/Chat/Chat/ChatProps';
|
18
|
+
import { useChatAutoScroll } from '../book-components/Chat/hooks/useChatAutoScroll';
|
19
|
+
import type { SendMessageToLlmChatFunction } from '../book-components/Chat/hooks/useSendMessageToLlmChat';
|
20
|
+
import { useSendMessageToLlmChat } from '../book-components/Chat/hooks/useSendMessageToLlmChat';
|
15
21
|
import { LlmChat } from '../book-components/Chat/LlmChat/LlmChat';
|
16
22
|
import type { LlmChatProps } from '../book-components/Chat/LlmChat/LlmChatProps';
|
17
23
|
import type { ChatMessage } from '../book-components/Chat/types/ChatMessage';
|
18
24
|
import type { ChatParticipant } from '../book-components/Chat/types/ChatParticipant';
|
25
|
+
import type { MessageButton } from '../book-components/Chat/utils/parseMessageButtons';
|
26
|
+
import { parseMessageButtons } from '../book-components/Chat/utils/parseMessageButtons';
|
19
27
|
import { renderMarkdown } from '../book-components/Chat/utils/renderMarkdown';
|
20
28
|
import { isMarkdownContent } from '../book-components/Chat/utils/renderMarkdown';
|
21
29
|
import { ArrowIcon } from '../book-components/icons/ArrowIcon';
|
30
|
+
import { PauseIcon } from '../book-components/icons/PauseIcon';
|
31
|
+
import { PlayIcon } from '../book-components/icons/PlayIcon';
|
22
32
|
import { ResetIcon } from '../book-components/icons/ResetIcon';
|
23
33
|
import { SendIcon } from '../book-components/icons/SendIcon';
|
24
34
|
import { TemplateIcon } from '../book-components/icons/TemplateIcon';
|
@@ -31,18 +41,28 @@ export type { AvatarProfileProps };
|
|
31
41
|
export { AvatarProfile };
|
32
42
|
export type { AvatarProfileFromSourceProps };
|
33
43
|
export { AvatarProfileFromSource };
|
44
|
+
export type { MockedChatDelayConfig };
|
45
|
+
export type { MockedChatProps };
|
46
|
+
export { MockedChat };
|
34
47
|
export type { BookEditorProps };
|
35
48
|
export { BookEditor };
|
36
49
|
export { DEFAULT_BOOK_FONT_CLASS };
|
37
50
|
export { Chat };
|
38
51
|
export type { ChatProps };
|
52
|
+
export { useChatAutoScroll };
|
53
|
+
export type { SendMessageToLlmChatFunction };
|
54
|
+
export { useSendMessageToLlmChat };
|
39
55
|
export { LlmChat };
|
40
56
|
export type { LlmChatProps };
|
41
57
|
export type { ChatMessage };
|
42
58
|
export type { ChatParticipant };
|
59
|
+
export type { MessageButton };
|
60
|
+
export { parseMessageButtons };
|
43
61
|
export { renderMarkdown };
|
44
62
|
export { isMarkdownContent };
|
45
63
|
export { ArrowIcon };
|
64
|
+
export { PauseIcon };
|
65
|
+
export { PlayIcon };
|
46
66
|
export { ResetIcon };
|
47
67
|
export { SendIcon };
|
48
68
|
export { TemplateIcon };
|
@@ -1,6 +1,8 @@
|
|
1
1
|
import { BOOK_LANGUAGE_VERSION, PROMPTBOOK_ENGINE_VERSION } from '../version';
|
2
2
|
import { createAgentModelRequirements } from '../book-2.0/agent-source/createAgentModelRequirements';
|
3
|
+
import { createAgentModelRequirementsWithCommitments } from '../book-2.0/agent-source/createAgentModelRequirementsWithCommitments';
|
3
4
|
import { parseAgentSource } from '../book-2.0/agent-source/parseAgentSource';
|
5
|
+
import { parseParameters } from '../book-2.0/agent-source/parseParameters';
|
4
6
|
import { isValidBook } from '../book-2.0/agent-source/string_book';
|
5
7
|
import { validateBook } from '../book-2.0/agent-source/string_book';
|
6
8
|
import { DEFAULT_BOOK } from '../book-2.0/agent-source/string_book';
|
@@ -118,8 +120,13 @@ import { createLlmToolsFromConfiguration } from '../llm-providers/_common/regist
|
|
118
120
|
import { cacheLlmTools } from '../llm-providers/_common/utils/cache/cacheLlmTools';
|
119
121
|
import { countUsage } from '../llm-providers/_common/utils/count-total-usage/countUsage';
|
120
122
|
import { limitTotalUsage } from '../llm-providers/_common/utils/count-total-usage/limitTotalUsage';
|
123
|
+
import { getSingleLlmExecutionTools } from '../llm-providers/_multiple/getSingleLlmExecutionTools';
|
121
124
|
import { joinLlmExecutionTools } from '../llm-providers/_multiple/joinLlmExecutionTools';
|
122
125
|
import { MultipleLlmExecutionTools } from '../llm-providers/_multiple/MultipleLlmExecutionTools';
|
126
|
+
import { AgentLlmExecutionTools } from '../llm-providers/agent/AgentLlmExecutionTools';
|
127
|
+
import { createAgentLlmExecutionTools } from '../llm-providers/agent/createAgentLlmExecutionTools';
|
128
|
+
import { _AgentMetadata } from '../llm-providers/agent/register-configuration';
|
129
|
+
import { _AgentRegistration } from '../llm-providers/agent/register-constructor';
|
123
130
|
import { _AnthropicClaudeMetadataRegistration } from '../llm-providers/anthropic-claude/register-configuration';
|
124
131
|
import { _AzureOpenAiMetadataRegistration } from '../llm-providers/azure-openai/register-configuration';
|
125
132
|
import { _DeepseekMetadataRegistration } from '../llm-providers/deepseek/register-configuration';
|
@@ -165,7 +172,9 @@ import { TaskTypes } from '../types/TaskType';
|
|
165
172
|
import { REMOTE_SERVER_URLS } from '../../servers';
|
166
173
|
export { BOOK_LANGUAGE_VERSION, PROMPTBOOK_ENGINE_VERSION };
|
167
174
|
export { createAgentModelRequirements };
|
175
|
+
export { createAgentModelRequirementsWithCommitments };
|
168
176
|
export { parseAgentSource };
|
177
|
+
export { parseParameters };
|
169
178
|
export { isValidBook };
|
170
179
|
export { validateBook };
|
171
180
|
export { DEFAULT_BOOK };
|
@@ -283,8 +292,13 @@ export { createLlmToolsFromConfiguration };
|
|
283
292
|
export { cacheLlmTools };
|
284
293
|
export { countUsage };
|
285
294
|
export { limitTotalUsage };
|
295
|
+
export { getSingleLlmExecutionTools };
|
286
296
|
export { joinLlmExecutionTools };
|
287
297
|
export { MultipleLlmExecutionTools };
|
298
|
+
export { AgentLlmExecutionTools };
|
299
|
+
export { createAgentLlmExecutionTools };
|
300
|
+
export { _AgentMetadata };
|
301
|
+
export { _AgentRegistration };
|
288
302
|
export { _AnthropicClaudeMetadataRegistration };
|
289
303
|
export { _AzureOpenAiMetadataRegistration };
|
290
304
|
export { _DeepseekMetadataRegistration };
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import type { BookParameter } from '../book-2.0/agent-source/AgentBasicInformation';
|
1
2
|
import type { AgentBasicInformation } from '../book-2.0/agent-source/AgentBasicInformation';
|
2
3
|
import type { AgentModelRequirements } from '../book-2.0/agent-source/AgentModelRequirements';
|
3
4
|
import type { string_book } from '../book-2.0/agent-source/string_book';
|
@@ -8,11 +9,16 @@ import type { AvatarChipProps } from '../book-components/AvatarProfile/AvatarChi
|
|
8
9
|
import type { AvatarChipFromSourceProps } from '../book-components/AvatarProfile/AvatarChip/AvatarChipFromSource';
|
9
10
|
import type { AvatarProfileProps } from '../book-components/AvatarProfile/AvatarProfile/AvatarProfile';
|
10
11
|
import type { AvatarProfileFromSourceProps } from '../book-components/AvatarProfile/AvatarProfile/AvatarProfileFromSource';
|
12
|
+
import type { MockedChatDelayConfig } from '../book-components/AvatarProfile/AvatarProfile/MockedChat';
|
13
|
+
import type { MockedChatProps } from '../book-components/AvatarProfile/AvatarProfile/MockedChat';
|
11
14
|
import type { BookEditorProps } from '../book-components/BookEditor/BookEditor';
|
12
15
|
import type { ChatProps } from '../book-components/Chat/Chat/ChatProps';
|
16
|
+
import type { ChatAutoScrollConfig } from '../book-components/Chat/hooks/useChatAutoScroll';
|
17
|
+
import type { SendMessageToLlmChatFunction } from '../book-components/Chat/hooks/useSendMessageToLlmChat';
|
13
18
|
import type { LlmChatProps } from '../book-components/Chat/LlmChat/LlmChatProps';
|
14
19
|
import type { ChatMessage } from '../book-components/Chat/types/ChatMessage';
|
15
20
|
import type { ChatParticipant } from '../book-components/Chat/types/ChatParticipant';
|
21
|
+
import type { MessageButton } from '../book-components/Chat/utils/parseMessageButtons';
|
16
22
|
import type { PipelineCollection } from '../collection/PipelineCollection';
|
17
23
|
import type { Command } from '../commands/_common/types/Command';
|
18
24
|
import type { CommandParser } from '../commands/_common/types/CommandParser';
|
@@ -90,6 +96,7 @@ import type { LlmToolsOptions } from '../llm-providers/_common/register/LlmTools
|
|
90
96
|
import type { CacheItem } from '../llm-providers/_common/utils/cache/CacheItem';
|
91
97
|
import type { CacheLlmToolsOptions } from '../llm-providers/_common/utils/cache/CacheLlmToolsOptions';
|
92
98
|
import type { LlmExecutionToolsWithTotalUsage } from '../llm-providers/_common/utils/count-total-usage/LlmExecutionToolsWithTotalUsage';
|
99
|
+
import type { CreateAgentLlmExecutionToolsOptions } from '../llm-providers/agent/createAgentLlmExecutionTools';
|
93
100
|
import type { AnthropicClaudeExecutionToolsOptions } from '../llm-providers/anthropic-claude/AnthropicClaudeExecutionToolsOptions';
|
94
101
|
import type { AnthropicClaudeExecutionToolsNonProxiedOptions } from '../llm-providers/anthropic-claude/AnthropicClaudeExecutionToolsOptions';
|
95
102
|
import type { AnthropicClaudeExecutionToolsProxiedOptions } from '../llm-providers/anthropic-claude/AnthropicClaudeExecutionToolsOptions';
|
@@ -320,6 +327,7 @@ import type { CheckSerializableAsJsonOptions } from '../utils/serialization/chec
|
|
320
327
|
import type { ExportJsonOptions } from '../utils/serialization/exportJson';
|
321
328
|
import type { ITakeChain } from '../utils/take/interfaces/ITakeChain';
|
322
329
|
import type { string_promptbook_version } from '../version';
|
330
|
+
export type { BookParameter };
|
323
331
|
export type { AgentBasicInformation };
|
324
332
|
export type { AgentModelRequirements };
|
325
333
|
export type { string_book };
|
@@ -330,11 +338,16 @@ export type { AvatarChipProps };
|
|
330
338
|
export type { AvatarChipFromSourceProps };
|
331
339
|
export type { AvatarProfileProps };
|
332
340
|
export type { AvatarProfileFromSourceProps };
|
341
|
+
export type { MockedChatDelayConfig };
|
342
|
+
export type { MockedChatProps };
|
333
343
|
export type { BookEditorProps };
|
334
344
|
export type { ChatProps };
|
345
|
+
export type { ChatAutoScrollConfig };
|
346
|
+
export type { SendMessageToLlmChatFunction };
|
335
347
|
export type { LlmChatProps };
|
336
348
|
export type { ChatMessage };
|
337
349
|
export type { ChatParticipant };
|
350
|
+
export type { MessageButton };
|
338
351
|
export type { PipelineCollection };
|
339
352
|
export type { Command };
|
340
353
|
export type { CommandParser };
|
@@ -412,6 +425,7 @@ export type { LlmToolsOptions };
|
|
412
425
|
export type { CacheItem };
|
413
426
|
export type { CacheLlmToolsOptions };
|
414
427
|
export type { LlmExecutionToolsWithTotalUsage };
|
428
|
+
export type { CreateAgentLlmExecutionToolsOptions };
|
415
429
|
export type { AnthropicClaudeExecutionToolsOptions };
|
416
430
|
export type { AnthropicClaudeExecutionToolsNonProxiedOptions };
|
417
431
|
export type { AnthropicClaudeExecutionToolsProxiedOptions };
|
@@ -1,4 +1,28 @@
|
|
1
1
|
import type { string_agent_name, string_url_image } from '../../types/typeAliases';
|
2
|
+
/**
|
3
|
+
* Unified parameter representation that supports two different notations:
|
4
|
+
* 1. @Parameter - single word parameter starting with @
|
5
|
+
* 2. {parameterName} or {parameter with multiple words} or {parameterName: description text}
|
6
|
+
* Both notations represent the same syntax feature - parameters
|
7
|
+
*/
|
8
|
+
export type BookParameter = {
|
9
|
+
/**
|
10
|
+
* The raw text of the parameter as it appears in the source
|
11
|
+
*/
|
12
|
+
text: string;
|
13
|
+
/**
|
14
|
+
* The notation used for this parameter
|
15
|
+
*/
|
16
|
+
notation: 'at' | 'brace';
|
17
|
+
/**
|
18
|
+
* The parameter name (without @ or {})
|
19
|
+
*/
|
20
|
+
name: string;
|
21
|
+
/**
|
22
|
+
* Optional description for {parameterName: description} notation
|
23
|
+
*/
|
24
|
+
description?: string;
|
25
|
+
};
|
2
26
|
export type AgentBasicInformation = {
|
3
27
|
/**
|
4
28
|
* Name of the agent
|
@@ -11,10 +35,24 @@ export type AgentBasicInformation = {
|
|
11
35
|
*/
|
12
36
|
personaDescription: string | null;
|
13
37
|
/**
|
14
|
-
*
|
15
|
-
*
|
38
|
+
* Metadata commitments parsed from META lines
|
39
|
+
* Each META commitment has the format "META TYPE content"
|
40
|
+
* When there are multiple meta commitments of the same type, later overrides earlier
|
41
|
+
*/
|
42
|
+
meta: {
|
43
|
+
image?: string_url_image;
|
44
|
+
link?: string;
|
45
|
+
title?: string;
|
46
|
+
description?: string;
|
47
|
+
[key: string]: string | undefined;
|
48
|
+
};
|
49
|
+
/**
|
50
|
+
* Parameters found in the agent source
|
51
|
+
* Supports two different notations for the same syntax feature:
|
52
|
+
* - @Parameter (single word parameter starting with @)
|
53
|
+
* - {parameterName} or {parameter with multiple words} or {parameterName: description text}
|
16
54
|
*/
|
17
|
-
|
55
|
+
parameters: BookParameter[];
|
18
56
|
};
|
19
57
|
/**
|
20
58
|
* TODO: [🕛] Unite `AgentBasicInformation`, `ChatParticipant`, `LlmExecutionTools` + `LlmToolsMetadata`
|
@@ -1,36 +1,18 @@
|
|
1
|
+
import type { AvailableModel } from '../../execution/AvailableModel';
|
2
|
+
import { LlmExecutionTools } from '../../execution/LlmExecutionTools';
|
1
3
|
import type { string_model_name } from '../../types/typeAliases';
|
2
4
|
import type { AgentModelRequirements } from './AgentModelRequirements';
|
3
5
|
import type { string_book } from './string_book';
|
4
6
|
/**
|
5
7
|
* Creates model requirements for an agent based on its source
|
6
|
-
* Results are cached to improve performance for repeated calls with the same agentSource and modelName
|
7
8
|
*
|
8
9
|
* There are 2 similar functions:
|
9
10
|
* - `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.
|
10
|
-
* - `createAgentModelRequirements` which is an asynchronous function that creates model requirements it applies each commitment one by one and works
|
11
|
+
* - `createAgentModelRequirements` which is an asynchronous function that creates model requirements it applies each commitment one by one and works asynchronous.
|
11
12
|
*
|
12
13
|
* @public exported from `@promptbook/core`
|
13
14
|
*/
|
14
|
-
export declare function createAgentModelRequirements(agentSource: string_book, modelName?: string_model_name): Promise<AgentModelRequirements>;
|
15
|
-
/**
|
16
|
-
* Clears the cache for createAgentModelRequirements
|
17
|
-
* Useful when agent sources are updated and cached results should be invalidated
|
18
|
-
*
|
19
|
-
* @private
|
20
|
-
*/
|
21
|
-
export declare function clearAgentModelRequirementsCache(): void;
|
22
|
-
/**
|
23
|
-
* Removes cache entries for a specific agent source (all model variants)
|
24
|
-
* @param agentSource The agent source to remove from cache
|
25
|
-
* @private
|
26
|
-
*/
|
27
|
-
export declare function invalidateAgentModelRequirementsCache(agentSource: string_book): void;
|
28
|
-
/**
|
29
|
-
* Gets the current cache size (for debugging/monitoring)
|
30
|
-
*
|
31
|
-
* @private
|
32
|
-
*/
|
33
|
-
export declare function getAgentModelRequirementsCacheSize(): number;
|
15
|
+
export declare function createAgentModelRequirements(agentSource: string_book, modelName?: string_model_name, availableModels?: readonly AvailableModel[], llmTools?: LlmExecutionTools): Promise<AgentModelRequirements>;
|
34
16
|
/**
|
35
17
|
* Extracts MCP servers from agent source
|
36
18
|
*
|
package/esm/typings/src/book-2.0/agent-source/createAgentModelRequirementsWithCommitments.d.ts
CHANGED
@@ -6,31 +6,6 @@ import type { string_book } from './string_book';
|
|
6
6
|
* This function uses a reduce-like pattern where each commitment applies its changes
|
7
7
|
* to build the final requirements starting from a basic empty model
|
8
8
|
*
|
9
|
-
* @
|
9
|
+
* @public exported from `@promptbook/core`
|
10
10
|
*/
|
11
11
|
export declare function createAgentModelRequirementsWithCommitments(agentSource: string_book, modelName?: string_model_name): Promise<AgentModelRequirements>;
|
12
|
-
/**
|
13
|
-
* Cached version of createAgentModelRequirementsWithCommitments
|
14
|
-
* This maintains the same caching behavior as the original function
|
15
|
-
*
|
16
|
-
* @private
|
17
|
-
*/
|
18
|
-
export declare function createAgentModelRequirementsWithCommitmentsCached(agentSource: string_book, modelName?: string_model_name): Promise<AgentModelRequirements>;
|
19
|
-
/**
|
20
|
-
* Clears the cache for createAgentModelRequirementsWithCommitments
|
21
|
-
*
|
22
|
-
* @private
|
23
|
-
*/
|
24
|
-
export declare function clearAgentModelRequirementsWithCommitmentsCache(): void;
|
25
|
-
/**
|
26
|
-
* Removes cache entries for a specific agent source
|
27
|
-
*
|
28
|
-
* @private
|
29
|
-
*/
|
30
|
-
export declare function invalidateAgentModelRequirementsWithCommitmentsCache(agentSource: string_book): void;
|
31
|
-
/**
|
32
|
-
* Gets the current cache size
|
33
|
-
*
|
34
|
-
* @private
|
35
|
-
*/
|
36
|
-
export declare function getAgentModelRequirementsWithCommitmentsCacheSize(): number;
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import type { BookParameter } from './AgentBasicInformation';
|
2
|
+
/**
|
3
|
+
* Parses parameters from text using both supported notations:
|
4
|
+
* 1. @Parameter - single word parameter starting with @
|
5
|
+
* 2. {parameterName} or {parameter with multiple words} or {parameterName: description text}
|
6
|
+
*
|
7
|
+
* Both notations represent the same syntax feature - parameters
|
8
|
+
*
|
9
|
+
* @param text - Text to extract parameters from
|
10
|
+
* @returns Array of parsed parameters with unified representation
|
11
|
+
* @public exported from `@promptbook/core`
|
12
|
+
*/
|
13
|
+
export declare function parseParameters(text: string): BookParameter[];
|
@@ -15,8 +15,8 @@ import { BaseCommitmentDefinition } from '../_base/BaseCommitmentDefinition';
|
|
15
15
|
*
|
16
16
|
* @private [🪔] Maybe export the commitments through some package
|
17
17
|
*/
|
18
|
-
export declare class ActionCommitmentDefinition extends BaseCommitmentDefinition<'ACTION'> {
|
19
|
-
constructor();
|
18
|
+
export declare class ActionCommitmentDefinition extends BaseCommitmentDefinition<'ACTION' | 'ACTIONS'> {
|
19
|
+
constructor(type?: 'ACTION' | 'ACTIONS');
|
20
20
|
/**
|
21
21
|
* Short one-line description of ACTION.
|
22
22
|
*/
|
@@ -27,12 +27,6 @@ export declare class ActionCommitmentDefinition extends BaseCommitmentDefinition
|
|
27
27
|
get documentation(): string;
|
28
28
|
applyToAgentModelRequirements(requirements: AgentModelRequirements, content: string): AgentModelRequirements;
|
29
29
|
}
|
30
|
-
/**
|
31
|
-
* Singleton instance of the ACTION commitment definition
|
32
|
-
*
|
33
|
-
* @private [🪔] Maybe export the commitments through some package
|
34
|
-
*/
|
35
|
-
export declare const ActionCommitment: ActionCommitmentDefinition;
|
36
30
|
/**
|
37
31
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
38
32
|
*/
|
@@ -0,0 +1,35 @@
|
|
1
|
+
import type { AgentModelRequirements } from '../../agent-source/AgentModelRequirements';
|
2
|
+
import { BaseCommitmentDefinition } from '../_base/BaseCommitmentDefinition';
|
3
|
+
/**
|
4
|
+
* DELETE commitment definition
|
5
|
+
*
|
6
|
+
* The DELETE commitment (and its aliases CANCEL, DISCARD, REMOVE) is used to
|
7
|
+
* remove or disregard certain information or context. This can be useful for
|
8
|
+
* overriding previous commitments or removing unwanted behaviors.
|
9
|
+
*
|
10
|
+
* Example usage in agent source:
|
11
|
+
*
|
12
|
+
* ```book
|
13
|
+
* DELETE Previous formatting requirements
|
14
|
+
* CANCEL All emotional responses
|
15
|
+
* DISCARD Technical jargon explanations
|
16
|
+
* REMOVE Casual conversational style
|
17
|
+
* ```
|
18
|
+
*
|
19
|
+
* @private [🪔] Maybe export the commitments through some package
|
20
|
+
*/
|
21
|
+
export declare class DeleteCommitmentDefinition extends BaseCommitmentDefinition<'DELETE' | 'CANCEL' | 'DISCARD' | 'REMOVE'> {
|
22
|
+
constructor(type: 'DELETE' | 'CANCEL' | 'DISCARD' | 'REMOVE');
|
23
|
+
/**
|
24
|
+
* Short one-line description of DELETE/CANCEL/DISCARD/REMOVE.
|
25
|
+
*/
|
26
|
+
get description(): string;
|
27
|
+
/**
|
28
|
+
* Markdown documentation for DELETE commitment.
|
29
|
+
*/
|
30
|
+
get documentation(): string;
|
31
|
+
applyToAgentModelRequirements(requirements: AgentModelRequirements, content: string): AgentModelRequirements;
|
32
|
+
}
|
33
|
+
/**
|
34
|
+
* Note: [💞] Ignore a discrepancy between file name and entity name
|
35
|
+
*/
|
@@ -16,8 +16,8 @@ import { BaseCommitmentDefinition } from '../_base/BaseCommitmentDefinition';
|
|
16
16
|
*
|
17
17
|
* @private [🪔] Maybe export the commitments through some package
|
18
18
|
*/
|
19
|
-
export declare class FormatCommitmentDefinition extends BaseCommitmentDefinition<'FORMAT'> {
|
20
|
-
constructor();
|
19
|
+
export declare class FormatCommitmentDefinition extends BaseCommitmentDefinition<'FORMAT' | 'FORMATS'> {
|
20
|
+
constructor(type?: 'FORMAT' | 'FORMATS');
|
21
21
|
/**
|
22
22
|
* Short one-line description of FORMAT.
|
23
23
|
*/
|
@@ -28,12 +28,6 @@ export declare class FormatCommitmentDefinition extends BaseCommitmentDefinition
|
|
28
28
|
get documentation(): string;
|
29
29
|
applyToAgentModelRequirements(requirements: AgentModelRequirements, content: string): AgentModelRequirements;
|
30
30
|
}
|
31
|
-
/**
|
32
|
-
* Singleton instance of the FORMAT commitment definition
|
33
|
-
*
|
34
|
-
* @private [🪔] Maybe export the commitments through some package
|
35
|
-
*/
|
36
|
-
export declare const FormatCommitment: FormatCommitmentDefinition;
|
37
31
|
/**
|
38
32
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
39
33
|
*/
|
@@ -0,0 +1,33 @@
|
|
1
|
+
import type { AgentModelRequirements } from '../../agent-source/AgentModelRequirements';
|
2
|
+
import { BaseCommitmentDefinition } from '../_base/BaseCommitmentDefinition';
|
3
|
+
/**
|
4
|
+
* GOAL commitment definition
|
5
|
+
*
|
6
|
+
* The GOAL commitment defines the main goal which should be achieved by the AI assistant.
|
7
|
+
* There can be multiple goals. Later goals are more important than earlier goals.
|
8
|
+
*
|
9
|
+
* Example usage in agent source:
|
10
|
+
*
|
11
|
+
* ```book
|
12
|
+
* GOAL Help users understand complex technical concepts
|
13
|
+
* GOAL Provide accurate and up-to-date information
|
14
|
+
* GOAL Always prioritize user safety and ethical guidelines
|
15
|
+
* ```
|
16
|
+
*
|
17
|
+
* @private [🪔] Maybe export the commitments through some package
|
18
|
+
*/
|
19
|
+
export declare class GoalCommitmentDefinition extends BaseCommitmentDefinition<'GOAL' | 'GOALS'> {
|
20
|
+
constructor(type?: 'GOAL' | 'GOALS');
|
21
|
+
/**
|
22
|
+
* Short one-line description of GOAL.
|
23
|
+
*/
|
24
|
+
get description(): string;
|
25
|
+
/**
|
26
|
+
* Markdown documentation for GOAL commitment.
|
27
|
+
*/
|
28
|
+
get documentation(): string;
|
29
|
+
applyToAgentModelRequirements(requirements: AgentModelRequirements, content: string): AgentModelRequirements;
|
30
|
+
}
|
31
|
+
/**
|
32
|
+
* Note: [💞] Ignore a discrepancy between file name and entity name
|
33
|
+
*/
|
@@ -34,12 +34,6 @@ export declare class KnowledgeCommitmentDefinition extends BaseCommitmentDefinit
|
|
34
34
|
*/
|
35
35
|
private isUrl;
|
36
36
|
}
|
37
|
-
/**
|
38
|
-
* Singleton instance of the KNOWLEDGE commitment definition
|
39
|
-
*
|
40
|
-
* @private [🪔] Maybe export the commitments through some package
|
41
|
-
*/
|
42
|
-
export declare const KnowledgeCommitment: KnowledgeCommitmentDefinition;
|
43
37
|
/**
|
44
38
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
45
39
|
*/
|
@@ -0,0 +1,34 @@
|
|
1
|
+
import type { AgentModelRequirements } from '../../agent-source/AgentModelRequirements';
|
2
|
+
import { BaseCommitmentDefinition } from '../_base/BaseCommitmentDefinition';
|
3
|
+
/**
|
4
|
+
* MEMORY commitment definition
|
5
|
+
*
|
6
|
+
* The MEMORY commitment is similar to KNOWLEDGE but has a focus on remembering past
|
7
|
+
* interactions and user preferences. It helps the agent maintain context about the
|
8
|
+
* user's history, preferences, and previous conversations.
|
9
|
+
*
|
10
|
+
* Example usage in agent source:
|
11
|
+
*
|
12
|
+
* ```book
|
13
|
+
* MEMORY User prefers detailed technical explanations
|
14
|
+
* MEMORY Previously worked on React projects
|
15
|
+
* MEMORY Timezone: UTC-5 (Eastern Time)
|
16
|
+
* ```
|
17
|
+
*
|
18
|
+
* @private [🪔] Maybe export the commitments through some package
|
19
|
+
*/
|
20
|
+
export declare class MemoryCommitmentDefinition extends BaseCommitmentDefinition<'MEMORY' | 'MEMORIES'> {
|
21
|
+
constructor(type?: 'MEMORY' | 'MEMORIES');
|
22
|
+
/**
|
23
|
+
* Short one-line description of MEMORY.
|
24
|
+
*/
|
25
|
+
get description(): string;
|
26
|
+
/**
|
27
|
+
* Markdown documentation for MEMORY commitment.
|
28
|
+
*/
|
29
|
+
get documentation(): string;
|
30
|
+
applyToAgentModelRequirements(requirements: AgentModelRequirements, content: string): AgentModelRequirements;
|
31
|
+
}
|
32
|
+
/**
|
33
|
+
* Note: [💞] Ignore a discrepancy between file name and entity name
|
34
|
+
*/
|
@@ -0,0 +1,35 @@
|
|
1
|
+
import type { AgentModelRequirements } from '../../agent-source/AgentModelRequirements';
|
2
|
+
import { BaseCommitmentDefinition } from '../_base/BaseCommitmentDefinition';
|
3
|
+
/**
|
4
|
+
* MESSAGE commitment definition
|
5
|
+
*
|
6
|
+
* The MESSAGE commitment contains 1:1 text of the message which AI assistant already
|
7
|
+
* sent during the conversation. Later messages are later in the conversation.
|
8
|
+
* It is similar to EXAMPLE but it is not example, it is the real message which
|
9
|
+
* AI assistant already sent.
|
10
|
+
*
|
11
|
+
* Example usage in agent source:
|
12
|
+
*
|
13
|
+
* ```book
|
14
|
+
* MESSAGE Hello! How can I help you today?
|
15
|
+
* MESSAGE I understand you're looking for information about our services.
|
16
|
+
* MESSAGE Based on your requirements, I'd recommend our premium package.
|
17
|
+
* ```
|
18
|
+
*
|
19
|
+
* @private [🪔] Maybe export the commitments through some package
|
20
|
+
*/
|
21
|
+
export declare class MessageCommitmentDefinition extends BaseCommitmentDefinition<'MESSAGE' | 'MESSAGES'> {
|
22
|
+
constructor(type?: 'MESSAGE' | 'MESSAGES');
|
23
|
+
/**
|
24
|
+
* Short one-line description of MESSAGE.
|
25
|
+
*/
|
26
|
+
get description(): string;
|
27
|
+
/**
|
28
|
+
* Markdown documentation for MESSAGE commitment.
|
29
|
+
*/
|
30
|
+
get documentation(): string;
|
31
|
+
applyToAgentModelRequirements(requirements: AgentModelRequirements, content: string): AgentModelRequirements;
|
32
|
+
}
|
33
|
+
/**
|
34
|
+
* Note: [💞] Ignore a discrepancy between file name and entity name
|
35
|
+
*/
|
@@ -0,0 +1,56 @@
|
|
1
|
+
import type { AgentModelRequirements } from '../../agent-source/AgentModelRequirements';
|
2
|
+
import { BaseCommitmentDefinition } from '../_base/BaseCommitmentDefinition';
|
3
|
+
/**
|
4
|
+
* META commitment definition
|
5
|
+
*
|
6
|
+
* The META commitment handles all meta-information about the agent such as:
|
7
|
+
* - META IMAGE: Sets the agent's avatar/profile image URL
|
8
|
+
* - META LINK: Provides profile/source links for the person the agent models
|
9
|
+
* - META TITLE: Sets the agent's display title
|
10
|
+
* - META DESCRIPTION: Sets the agent's description
|
11
|
+
* - META [ANYTHING]: Any other meta information in uppercase format
|
12
|
+
*
|
13
|
+
* These commitments are special because they don't affect the system message,
|
14
|
+
* but are handled separately in the parsing logic for profile display.
|
15
|
+
*
|
16
|
+
* Example usage in agent source:
|
17
|
+
*
|
18
|
+
* ```book
|
19
|
+
* META IMAGE https://example.com/avatar.jpg
|
20
|
+
* META LINK https://twitter.com/username
|
21
|
+
* META TITLE Professional Assistant
|
22
|
+
* META DESCRIPTION An AI assistant specialized in business tasks
|
23
|
+
* META AUTHOR John Doe
|
24
|
+
* META VERSION 1.0
|
25
|
+
* ```
|
26
|
+
*
|
27
|
+
* @private [🪔] Maybe export the commitments through some package
|
28
|
+
*/
|
29
|
+
export declare class MetaCommitmentDefinition extends BaseCommitmentDefinition<`META${string}`> {
|
30
|
+
constructor();
|
31
|
+
/**
|
32
|
+
* Short one-line description of META commitments.
|
33
|
+
*/
|
34
|
+
get description(): string;
|
35
|
+
/**
|
36
|
+
* Markdown documentation for META commitment.
|
37
|
+
*/
|
38
|
+
get documentation(): string;
|
39
|
+
applyToAgentModelRequirements(requirements: AgentModelRequirements, content: string): AgentModelRequirements;
|
40
|
+
/**
|
41
|
+
* Extracts meta information from the content based on the meta type
|
42
|
+
* This is used by the parsing logic
|
43
|
+
*/
|
44
|
+
extractMetaValue(metaType: string, content: string): string | null;
|
45
|
+
/**
|
46
|
+
* Validates if the provided content is a valid URL (for IMAGE and LINK types)
|
47
|
+
*/
|
48
|
+
isValidUrl(content: string): boolean;
|
49
|
+
/**
|
50
|
+
* Checks if this is a known meta type
|
51
|
+
*/
|
52
|
+
isKnownMetaType(metaType: string): boolean;
|
53
|
+
}
|
54
|
+
/**
|
55
|
+
* Note: [💞] Ignore a discrepancy between file name and entity name
|
56
|
+
*/
|
@@ -33,12 +33,6 @@ export declare class MetaImageCommitmentDefinition extends BaseCommitmentDefinit
|
|
33
33
|
*/
|
34
34
|
extractProfileImageUrl(content: string): string | null;
|
35
35
|
}
|
36
|
-
/**
|
37
|
-
* Singleton instance of the META IMAGE commitment definition
|
38
|
-
*
|
39
|
-
* @private [🪔] Maybe export the commitments through some package
|
40
|
-
*/
|
41
|
-
export declare const MetaImageCommitment: MetaImageCommitmentDefinition;
|
42
36
|
/**
|
43
37
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
44
38
|
*/
|
@@ -45,12 +45,6 @@ export declare class MetaLinkCommitmentDefinition extends BaseCommitmentDefiniti
|
|
45
45
|
*/
|
46
46
|
isValidUrl(content: string): boolean;
|
47
47
|
}
|
48
|
-
/**
|
49
|
-
* Singleton instance of the META LINK commitment definition
|
50
|
-
*
|
51
|
-
* @private [🪔] Maybe export the commitments through some package
|
52
|
-
*/
|
53
|
-
export declare const MetaLinkCommitment: MetaLinkCommitmentDefinition;
|
54
48
|
/**
|
55
49
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
56
50
|
*/
|