@promptbook/node 0.110.0-1 → 0.110.0-10

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.
Files changed (54) hide show
  1. package/esm/index.es.js +1785 -510
  2. package/esm/index.es.js.map +1 -1
  3. package/esm/typings/src/_packages/components.index.d.ts +4 -0
  4. package/esm/typings/src/_packages/core.index.d.ts +2 -2
  5. package/esm/typings/src/_packages/openai.index.d.ts +8 -4
  6. package/esm/typings/src/_packages/types.index.d.ts +12 -4
  7. package/esm/typings/src/book-2.0/agent-source/AgentModelRequirements.d.ts +22 -21
  8. package/esm/typings/src/book-2.0/agent-source/AgentReferenceResolver.d.ts +18 -0
  9. package/esm/typings/src/book-2.0/agent-source/CreateAgentModelRequirementsOptions.d.ts +12 -0
  10. package/esm/typings/src/book-2.0/agent-source/createAgentModelRequirements.d.ts +8 -2
  11. package/esm/typings/src/book-2.0/agent-source/createAgentModelRequirementsWithCommitments.agentReferenceResolver.test.d.ts +1 -0
  12. package/esm/typings/src/book-2.0/agent-source/createAgentModelRequirementsWithCommitments.d.ts +4 -5
  13. package/esm/typings/src/book-components/Chat/AgentChip/AgentChip.d.ts +5 -1
  14. package/esm/typings/src/book-components/Chat/Chat/ChatActionsBar.d.ts +4 -2
  15. package/esm/typings/src/book-components/Chat/Chat/ChatInputArea.d.ts +1 -0
  16. package/esm/typings/src/book-components/Chat/Chat/ChatMessageItem.d.ts +4 -0
  17. package/esm/typings/src/book-components/Chat/Chat/ChatMessageList.d.ts +1 -0
  18. package/esm/typings/src/book-components/Chat/Chat/ChatProps.d.ts +15 -0
  19. package/esm/typings/src/book-components/Chat/Chat/ChatSoundToggle.d.ts +31 -0
  20. package/esm/typings/src/book-components/Chat/LlmChat/LlmChatProps.d.ts +10 -1
  21. package/esm/typings/src/book-components/Chat/SourceChip/SourceChip.d.ts +5 -1
  22. package/esm/typings/src/book-components/Chat/utils/collectTeamToolCallSummary.d.ts +69 -0
  23. package/esm/typings/src/book-components/Chat/utils/getToolCallChipletInfo.d.ts +13 -13
  24. package/esm/typings/src/book-components/Chat/utils/parseCitationsFromContent.d.ts +9 -0
  25. package/esm/typings/src/book-components/Chat/utils/toolCallParsing.d.ts +4 -0
  26. package/esm/typings/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentsDatabaseSchema.d.ts +0 -3
  27. package/esm/typings/src/commitments/_base/BaseCommitmentDefinition.d.ts +9 -0
  28. package/esm/typings/src/execution/LlmExecutionTools.d.ts +2 -1
  29. package/esm/typings/src/llm-providers/agent/Agent.d.ts +1 -1
  30. package/esm/typings/src/llm-providers/agent/AgentLlmExecutionTools.d.ts +5 -1
  31. package/esm/typings/src/llm-providers/agent/AgentLlmExecutionTools.test.d.ts +1 -0
  32. package/esm/typings/src/llm-providers/agent/AgentOptions.d.ts +10 -0
  33. package/esm/typings/src/llm-providers/agent/CreateAgentLlmExecutionToolsOptions.d.ts +13 -2
  34. package/esm/typings/src/llm-providers/agent/RemoteAgent.d.ts +2 -1
  35. package/esm/typings/src/llm-providers/openai/OpenAiAgentKitExecutionTools.d.ts +150 -0
  36. package/esm/typings/src/llm-providers/openai/OpenAiAgentKitExecutionToolsOptions.d.ts +15 -0
  37. package/esm/typings/src/llm-providers/openai/OpenAiAssistantExecutionTools.d.ts +3 -3
  38. package/esm/typings/src/llm-providers/openai/OpenAiAssistantExecutionToolsOptions.d.ts +3 -4
  39. package/esm/typings/src/llm-providers/openai/OpenAiVectorStoreHandler.d.ts +135 -0
  40. package/esm/typings/src/llm-providers/openai/utils/mapToolsToOpenAi.d.ts +1 -1
  41. package/esm/typings/src/types/LlmToolDefinition.d.ts +1 -0
  42. package/esm/typings/src/types/ModelRequirements.d.ts +9 -0
  43. package/esm/typings/src/utils/DEFAULT_THINKING_MESSAGES.d.ts +8 -0
  44. package/esm/typings/src/utils/agents/resolveAgentAvatarImageUrl.d.ts +29 -0
  45. package/esm/typings/src/utils/knowledge/inlineKnowledgeSource.d.ts +38 -0
  46. package/esm/typings/src/utils/knowledge/inlineKnowledgeSource.test.d.ts +1 -0
  47. package/esm/typings/src/utils/language/getBrowserPreferredSpeechRecognitionLanguage.d.ts +35 -0
  48. package/esm/typings/src/utils/toolCalls/getToolCallIdentity.d.ts +10 -0
  49. package/esm/typings/src/version.d.ts +1 -1
  50. package/package.json +7 -3
  51. package/umd/index.umd.js +1788 -514
  52. package/umd/index.umd.js.map +1 -1
  53. package/esm/typings/src/llm-providers/openai/OpenAiAgentExecutionTools.d.ts +0 -43
  54. package/esm/typings/src/llm-providers/openai/createOpenAiAgentExecutionTools.d.ts +0 -11
@@ -18,6 +18,8 @@ import { Chat } from '../book-components/Chat/Chat/Chat';
18
18
  import type { ChatSoundSystem } from '../book-components/Chat/Chat/ChatProps';
19
19
  import type { ChatProps } from '../book-components/Chat/Chat/ChatProps';
20
20
  import { ChatSoundToggle } from '../book-components/Chat/Chat/ChatSoundToggle';
21
+ import { ChatVibrationToggle } from '../book-components/Chat/Chat/ChatSoundToggle';
22
+ import { ChatSoundAndVibrationPanel } from '../book-components/Chat/Chat/ChatSoundToggle';
21
23
  import { ChatEffectsSystem } from '../book-components/Chat/effects/ChatEffectsSystem';
22
24
  import { ConfettiEffect } from '../book-components/Chat/effects/components/ConfettiEffect';
23
25
  import { HeartsEffect } from '../book-components/Chat/effects/components/HeartsEffect';
@@ -88,6 +90,8 @@ export { Chat };
88
90
  export type { ChatSoundSystem };
89
91
  export type { ChatProps };
90
92
  export { ChatSoundToggle };
93
+ export { ChatVibrationToggle };
94
+ export { ChatSoundAndVibrationPanel };
91
95
  export { ChatEffectsSystem };
92
96
  export { ConfettiEffect };
93
97
  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 { createAgentModelRequirementsWithCommitments } from '../book-2.0/agent-source/createAgentModelRequirementsWithCommitments';
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 { createAgentModelRequirementsWithCommitments };
208
+ export type { CreateAgentModelRequirementsOptions };
209
209
  export { createDefaultAgentName };
210
210
  export { normalizeAgentName };
211
211
  export { PADDING_LINES };
@@ -1,10 +1,10 @@
1
1
  import { BOOK_LANGUAGE_VERSION, PROMPTBOOK_ENGINE_VERSION } from '../version';
2
- import { createOpenAiAgentExecutionTools } from '../llm-providers/openai/createOpenAiAgentExecutionTools';
3
2
  import { createOpenAiAssistantExecutionTools } from '../llm-providers/openai/createOpenAiAssistantExecutionTools';
4
3
  import { createOpenAiCompatibleExecutionTools } from '../llm-providers/openai/createOpenAiCompatibleExecutionTools';
5
4
  import { createOpenAiExecutionTools } from '../llm-providers/openai/createOpenAiExecutionTools';
6
5
  import { OPENAI_MODELS } from '../llm-providers/openai/openai-models';
7
- import { OpenAiAgentExecutionTools } from '../llm-providers/openai/OpenAiAgentExecutionTools';
6
+ import { OpenAiAgentKitExecutionTools } from '../llm-providers/openai/OpenAiAgentKitExecutionTools';
7
+ import type { OpenAiAgentKitExecutionToolsOptions } from '../llm-providers/openai/OpenAiAgentKitExecutionToolsOptions';
8
8
  import { OpenAiAssistantExecutionTools } from '../llm-providers/openai/OpenAiAssistantExecutionTools';
9
9
  import type { OpenAiAssistantExecutionToolsOptions } from '../llm-providers/openai/OpenAiAssistantExecutionToolsOptions';
10
10
  import { OpenAiCompatibleExecutionTools } from '../llm-providers/openai/OpenAiCompatibleExecutionTools';
@@ -13,16 +13,18 @@ import type { OpenAiCompatibleExecutionToolsNonProxiedOptions } from '../llm-pro
13
13
  import type { OpenAiCompatibleExecutionToolsProxiedOptions } from '../llm-providers/openai/OpenAiCompatibleExecutionToolsOptions';
14
14
  import { OpenAiExecutionTools } from '../llm-providers/openai/OpenAiExecutionTools';
15
15
  import type { OpenAiExecutionToolsOptions } from '../llm-providers/openai/OpenAiExecutionToolsOptions';
16
+ import type { OpenAiVectorStoreHandlerOptions } from '../llm-providers/openai/OpenAiVectorStoreHandler';
17
+ import { OpenAiVectorStoreHandler } from '../llm-providers/openai/OpenAiVectorStoreHandler';
16
18
  import { _OpenAiRegistration } from '../llm-providers/openai/register-constructor';
17
19
  import { _OpenAiAssistantRegistration } from '../llm-providers/openai/register-constructor';
18
20
  import { _OpenAiCompatibleRegistration } from '../llm-providers/openai/register-constructor';
19
21
  export { BOOK_LANGUAGE_VERSION, PROMPTBOOK_ENGINE_VERSION };
20
- export { createOpenAiAgentExecutionTools };
21
22
  export { createOpenAiAssistantExecutionTools };
22
23
  export { createOpenAiCompatibleExecutionTools };
23
24
  export { createOpenAiExecutionTools };
24
25
  export { OPENAI_MODELS };
25
- export { OpenAiAgentExecutionTools };
26
+ export { OpenAiAgentKitExecutionTools };
27
+ export type { OpenAiAgentKitExecutionToolsOptions };
26
28
  export { OpenAiAssistantExecutionTools };
27
29
  export type { OpenAiAssistantExecutionToolsOptions };
28
30
  export { OpenAiCompatibleExecutionTools };
@@ -31,6 +33,8 @@ export type { OpenAiCompatibleExecutionToolsNonProxiedOptions };
31
33
  export type { OpenAiCompatibleExecutionToolsProxiedOptions };
32
34
  export { OpenAiExecutionTools };
33
35
  export type { OpenAiExecutionToolsOptions };
36
+ export type { OpenAiVectorStoreHandlerOptions };
37
+ export { OpenAiVectorStoreHandler };
34
38
  export { _OpenAiRegistration };
35
39
  export { _OpenAiAssistantRegistration };
36
40
  export { _OpenAiCompatibleRegistration };
@@ -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';
@@ -16,6 +17,8 @@ import type { AgentChipProps } from '../book-components/Chat/AgentChip/AgentChip
16
17
  import type { ChatSoundSystem } from '../book-components/Chat/Chat/ChatProps';
17
18
  import type { ChatProps } from '../book-components/Chat/Chat/ChatProps';
18
19
  import type { ChatSoundToggleProps } from '../book-components/Chat/Chat/ChatSoundToggle';
20
+ import type { ChatVibrationToggleProps } from '../book-components/Chat/Chat/ChatSoundToggle';
21
+ import type { ChatSoundAndVibrationPanelProps } from '../book-components/Chat/Chat/ChatSoundToggle';
19
22
  import type { ChatEffect } from '../book-components/Chat/effects/types/ChatEffect';
20
23
  import type { ChatEffectConfig } from '../book-components/Chat/effects/types/ChatEffectConfig';
21
24
  import type { ChatEffectsSystemProps } from '../book-components/Chat/effects/types/ChatEffectsSystemProps';
@@ -33,7 +36,6 @@ import type { SourceChipProps } from '../book-components/Chat/SourceChip/SourceC
33
36
  import type { ChatToolCall } from '../book-components/Chat/types/ChatMessage';
34
37
  import type { ChatMessage } from '../book-components/Chat/types/ChatMessage';
35
38
  import type { ChatParticipant } from '../book-components/Chat/types/ChatParticipant';
36
- import type { ToolCallChipletInfo } from '../book-components/Chat/utils/getToolCallChipletInfo';
37
39
  import type { ParsedCitation } from '../book-components/Chat/utils/parseCitationsFromContent';
38
40
  import type { MessageButton } from '../book-components/Chat/utils/parseMessageButtons';
39
41
  import type { TeamToolResult } from '../book-components/Chat/utils/toolCallParsing';
@@ -139,12 +141,13 @@ import type { AzureOpenAiExecutionToolsOptions } from '../llm-providers/azure-op
139
141
  import type { DeepseekExecutionToolsOptions } from '../llm-providers/deepseek/DeepseekExecutionToolsOptions';
140
142
  import type { GoogleExecutionToolsOptions } from '../llm-providers/google/GoogleExecutionToolsOptions';
141
143
  import type { OllamaExecutionToolsOptions } from '../llm-providers/ollama/OllamaExecutionToolsOptions';
142
- import type { OpenAiAgentExecutionToolsOptions } from '../llm-providers/openai/OpenAiAgentExecutionTools';
144
+ import type { OpenAiAgentKitExecutionToolsOptions } from '../llm-providers/openai/OpenAiAgentKitExecutionToolsOptions';
143
145
  import type { OpenAiAssistantExecutionToolsOptions } from '../llm-providers/openai/OpenAiAssistantExecutionToolsOptions';
144
146
  import type { OpenAiCompatibleExecutionToolsOptions } from '../llm-providers/openai/OpenAiCompatibleExecutionToolsOptions';
145
147
  import type { OpenAiCompatibleExecutionToolsNonProxiedOptions } from '../llm-providers/openai/OpenAiCompatibleExecutionToolsOptions';
146
148
  import type { OpenAiCompatibleExecutionToolsProxiedOptions } from '../llm-providers/openai/OpenAiCompatibleExecutionToolsOptions';
147
149
  import type { OpenAiExecutionToolsOptions } from '../llm-providers/openai/OpenAiExecutionToolsOptions';
150
+ import type { OpenAiVectorStoreHandlerOptions } from '../llm-providers/openai/OpenAiVectorStoreHandler';
148
151
  import type { VercelExecutionToolsOptions } from '../llm-providers/vercel/VercelExecutionToolsOptions';
149
152
  import type { VercelProvider } from '../llm-providers/vercel/VercelProvider';
150
153
  import type { IsPipelineImplementingInterfaceOptions } from '../pipeline/PipelineInterface/isPipelineImplementingInterface';
@@ -373,6 +376,7 @@ import type { number_gigabytes } from '../types/typeAliases';
373
376
  import type { number_terabytes } from '../types/typeAliases';
374
377
  import type { Updatable } from '../types/Updatable';
375
378
  import type { ColorTransformer } from '../utils/color/operators/ColorTransformer';
379
+ import type { ThinkingMessageVariant } from '../utils/DEFAULT_THINKING_MESSAGES';
376
380
  import type { PipelineEditableSerialized } from '../utils/editable/types/PipelineEditableSerialized';
377
381
  import type { ExecCommandOptions } from '../utils/execCommand/ExecCommandOptions';
378
382
  import type { ExecCommandOptionsAdvanced } from '../utils/execCommand/ExecCommandOptions';
@@ -405,6 +409,7 @@ export type { BookParameter };
405
409
  export type { AgentCapability };
406
410
  export type { AgentBasicInformation };
407
411
  export type { AgentModelRequirements };
412
+ export type { CreateAgentModelRequirementsOptions };
408
413
  export type { string_book };
409
414
  export type { AvatarChipProps };
410
415
  export type { AvatarChipFromSourceProps };
@@ -419,6 +424,8 @@ export type { AgentChipProps };
419
424
  export type { ChatSoundSystem };
420
425
  export type { ChatProps };
421
426
  export type { ChatSoundToggleProps };
427
+ export type { ChatVibrationToggleProps };
428
+ export type { ChatSoundAndVibrationPanelProps };
422
429
  export type { ChatEffect };
423
430
  export type { ChatEffectConfig };
424
431
  export type { ChatEffectsSystemProps };
@@ -436,7 +443,6 @@ export type { SourceChipProps };
436
443
  export type { ChatToolCall };
437
444
  export type { ChatMessage };
438
445
  export type { ChatParticipant };
439
- export type { ToolCallChipletInfo };
440
446
  export type { ParsedCitation };
441
447
  export type { MessageButton };
442
448
  export type { TeamToolResult };
@@ -542,12 +548,13 @@ export type { AzureOpenAiExecutionToolsOptions };
542
548
  export type { DeepseekExecutionToolsOptions };
543
549
  export type { GoogleExecutionToolsOptions };
544
550
  export type { OllamaExecutionToolsOptions };
545
- export type { OpenAiAgentExecutionToolsOptions };
551
+ export type { OpenAiAgentKitExecutionToolsOptions };
546
552
  export type { OpenAiAssistantExecutionToolsOptions };
547
553
  export type { OpenAiCompatibleExecutionToolsOptions };
548
554
  export type { OpenAiCompatibleExecutionToolsNonProxiedOptions };
549
555
  export type { OpenAiCompatibleExecutionToolsProxiedOptions };
550
556
  export type { OpenAiExecutionToolsOptions };
557
+ export type { OpenAiVectorStoreHandlerOptions };
551
558
  export type { VercelExecutionToolsOptions };
552
559
  export type { VercelProvider };
553
560
  export type { IsPipelineImplementingInterfaceOptions };
@@ -776,6 +783,7 @@ export type { number_gigabytes };
776
783
  export type { number_terabytes };
777
784
  export type { Updatable };
778
785
  export type { ColorTransformer };
786
+ export type { ThinkingMessageVariant };
779
787
  export type { PipelineEditableSerialized };
780
788
  export type { ExecCommandOptions };
781
789
  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 type { TODO_any } from '../../utils/organization/TODO_any';
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
- * The model name to use for this agent
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 modelName: string;
20
+ readonly promptSuffix: string;
18
21
  /**
19
- * Optional list of MCP servers that the agent can connect to
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 parentAgentUrl?: string_agent_url | null;
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
- * Arbitrary metadata storage for commitments
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 metadata?: Record<string, TODO_any>;
63
+ readonly mcpServers?: ReadonlyArray<string>;
71
64
  /**
72
- * Notes associated with the agent
73
- *
74
- * Note: This does not affect agent behavior in any way
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 notes?: ReadonlyArray<string>;
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
  *
@@ -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
- * Creates agent model requirements using the new commitment system
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
- * @public exported from `@promptbook/core`
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>;
@@ -45,6 +45,10 @@ export type AgentChipProps = {
45
45
  * Additional CSS class name
46
46
  */
47
47
  className?: string;
48
+ /**
49
+ * Optional suffix appended to the agent label (e.g., " (2x)").
50
+ */
51
+ labelSuffix?: string;
48
52
  };
49
53
  /**
50
54
  * AgentChip component - displays a chip with agent avatar and name
@@ -64,4 +68,4 @@ export type AgentChipProps = {
64
68
  *
65
69
  * @private utility of `ChatMessageItem` component
66
70
  */
67
- export declare function AgentChip({ agent, isOngoing, isClickable, onClick, className }: AgentChipProps): import("react/jsx-runtime").JSX.Element;
71
+ export declare function AgentChip({ agent, isOngoing, isClickable, onClick, className, labelSuffix, }: AgentChipProps): import("react/jsx-runtime").JSX.Element;
@@ -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
  *
@@ -21,8 +20,11 @@ export type ChatActionsBarProps = {
21
20
  saveFormats?: Array<string_chat_format_name>;
22
21
  isSaveButtonEnabled: boolean;
23
22
  shouldFadeActions: boolean;
23
+ /**
24
+ * Disables action interactions while scroll is active.
25
+ */
26
+ shouldDisableActions: boolean;
24
27
  onButtonClick: (handler?: (event: MouseEvent<HTMLButtonElement>) => void) => (event: MouseEvent<HTMLButtonElement>) => void;
25
- soundSystem?: ChatSoundSystem;
26
28
  };
27
29
  /**
28
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;
@@ -20,6 +20,16 @@ export type ChatSoundSystem = {
20
20
  isEnabled(): boolean;
21
21
  setEnabled(enabled: boolean): void;
22
22
  toggle(): boolean;
23
+ /**
24
+ * Optional helpers for haptic vibration state.
25
+ */
26
+ isVibrationEnabled?(): boolean;
27
+ setVibrationEnabled?(enabled: boolean): void;
28
+ toggleVibration?(): boolean;
29
+ /**
30
+ * Optional vibration helper to stay in sync with sound events.
31
+ */
32
+ vibrate?(event: string): void;
23
33
  };
24
34
  /**
25
35
  * @public exported from `@promptbook/components`
@@ -66,6 +76,11 @@ export type ChatProps = {
66
76
  * Speech recognition provider
67
77
  */
68
78
  readonly speechRecognition?: SpeechRecognition;
79
+ /**
80
+ * Optional language tag (BCP 47) to force speech recognition to use a specific language.
81
+ * When not provided, the browser preferences are used with a fallback to `en-US`.
82
+ */
83
+ readonly speechRecognitionLanguage?: string;
69
84
  /**
70
85
  * Optional placeholder message for the textarea
71
86
  *
@@ -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.
@@ -69,5 +75,8 @@ export type LlmChatProps = Omit<ChatProps, 'messages' | 'onMessage' | 'onChange'
69
75
  * @param error - The error that occurred
70
76
  * @param retry - Function to retry the last failed message
71
77
  */
72
- onError?(error: unknown, retry: () => void): void;
78
+ onError?(error: unknown, retry: () => void, failedMessage: {
79
+ content: string;
80
+ attachments: ChatMessage['attachments'];
81
+ }): void;
73
82
  };
@@ -15,6 +15,10 @@ export type SourceChipProps = {
15
15
  * Additional CSS class name
16
16
  */
17
17
  className?: string;
18
+ /**
19
+ * Optional suffix text to display after the citation label.
20
+ */
21
+ suffix?: string;
18
22
  };
19
23
  /**
20
24
  * SourceChip component - displays a chip with source document information
@@ -32,4 +36,4 @@ export type SourceChipProps = {
32
36
  *
33
37
  * @private utility of `ChatMessageItem` component
34
38
  */
35
- export declare function SourceChip({ citation, onClick, className }: SourceChipProps): import("react/jsx-runtime").JSX.Element;
39
+ export declare function SourceChip({ citation, onClick, className, suffix }: SourceChipProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,69 @@
1
+ import { type ToolCall } from '../../../types/ToolCall';
2
+ import type { ParsedCitation } from './parseCitationsFromContent';
3
+ /**
4
+ * Origin metadata for a tool call or citation executed by a teammate.
5
+ *
6
+ * @private utility of `<Chat/>`
7
+ */
8
+ export type ToolCallOrigin = {
9
+ /**
10
+ * Human-readable label for the teammate.
11
+ */
12
+ label: string;
13
+ /**
14
+ * Optional teammate URL.
15
+ */
16
+ url?: string;
17
+ /**
18
+ * Optional tool name for the teammate.
19
+ */
20
+ toolName?: string;
21
+ };
22
+ /**
23
+ * Tool call data enriched with its teammate origin.
24
+ *
25
+ * @private utility of `<Chat/>`
26
+ */
27
+ export type TransitiveToolCall = {
28
+ /**
29
+ * Tool call executed by the teammate.
30
+ */
31
+ toolCall: ToolCall;
32
+ /**
33
+ * Teammate origin metadata for the tool call.
34
+ */
35
+ origin: ToolCallOrigin;
36
+ };
37
+ /**
38
+ * Citation data enriched with its teammate origin.
39
+ *
40
+ * @private utility of `<Chat/>`
41
+ */
42
+ export type TransitiveCitation = ParsedCitation & {
43
+ /**
44
+ * Teammate origin metadata for the citation.
45
+ */
46
+ origin: ToolCallOrigin;
47
+ };
48
+ /**
49
+ * Aggregated teammate tool calls and citations derived from TEAM tool results.
50
+ *
51
+ * @private utility of `<Chat/>`
52
+ */
53
+ export type TeamToolCallSummary = {
54
+ /**
55
+ * Tool calls executed by teammates, flattened transitively.
56
+ */
57
+ toolCalls: TransitiveToolCall[];
58
+ /**
59
+ * Citations referenced by teammates, flattened transitively.
60
+ */
61
+ citations: TransitiveCitation[];
62
+ };
63
+ /**
64
+ * Collects tool calls and citations from TEAM tool call results, resolving nested teammate chains.
65
+ *
66
+ * @param toolCalls - Tool calls from the top-level agent message.
67
+ * @private utility of `<Chat/>`
68
+ */
69
+ export declare function collectTeamToolCallSummary(toolCalls: ReadonlyArray<ToolCall> | undefined): TeamToolCallSummary;
@@ -1,36 +1,36 @@
1
1
  import { type ToolCall } from '../../../types/ToolCall';
2
2
  import type { AgentChipData } from '../AgentChip';
3
- /**
4
- * Utility to format tool call information for user-friendly display.
5
- */
6
3
  /**
7
4
  * Tool call chiplet information including agent data for team tools
5
+ *
6
+ * @private utility of `<Chat/>`
8
7
  */
9
8
  export type ToolCallChipletInfo = {
10
9
  /**
11
- * Display text for the chiplet
10
+ * Display text for the chiplet.
12
11
  */
13
12
  text: string;
14
13
  /**
15
- * Agent data for team tools (if applicable)
14
+ * Agent data for team tools (if applicable).
16
15
  */
17
16
  agentData?: AgentChipData;
18
- /**
19
- * Whether to wrap the chip text in brackets when rendering.
20
- *
21
- * @default true
22
- */
23
- wrapInBrackets?: boolean;
24
17
  };
18
+ /**
19
+ * Builds display text for a tool call chiplet.
20
+ *
21
+ * @param chipletInfo - Chiplet metadata for the tool call.
22
+ *
23
+ * @private utility of `<Chat/>`
24
+ */
25
+ export declare function buildToolCallChipText(chipletInfo: ToolCallChipletInfo): string;
25
26
  /**
26
27
  * Technical to user-friendly tool names and emojis
27
28
  *
28
- * @private [🧠] Maybe public?
29
+ * @private utility of `<Chat/>` [🧠] Maybe public?
29
30
  */
30
31
  export declare const TOOL_TITLES: Record<string, {
31
32
  title: string;
32
33
  emoji: string;
33
- wrapInBrackets?: boolean;
34
34
  }>;
35
35
  /**
36
36
  * Gets the chiplet information including text and agent data (for team tools).
@@ -39,6 +39,15 @@ export declare function parseCitationsFromContent(content: string): ParsedCitati
39
39
  * @private utility for internal use
40
40
  */
41
41
  export declare function stripCitationsFromContent(content: string): string;
42
+ /**
43
+ * Deduplicates citations by source while preserving the first-seen order.
44
+ *
45
+ * @param citations - Parsed citations to deduplicate.
46
+ * @returns Deduplicated citations in original order.
47
+ *
48
+ * @private utility for internal use
49
+ */
50
+ export declare function dedupeCitationsBySource(citations: ReadonlyArray<ParsedCitation>): ParsedCitation[];
42
51
  /**
43
52
  * Extracts citations from a chat message if not already present
44
53
  *