@promptbook/cli 0.103.0-52 → 0.103.0-53

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 (107) hide show
  1. package/apps/agents-server/README.md +1 -1
  2. package/apps/agents-server/config.ts +3 -3
  3. package/apps/agents-server/next.config.ts +1 -1
  4. package/apps/agents-server/public/sw.js +16 -0
  5. package/apps/agents-server/src/app/AddAgentButton.tsx +24 -4
  6. package/apps/agents-server/src/app/actions.ts +15 -13
  7. package/apps/agents-server/src/app/admin/chat-feedback/ChatFeedbackClient.tsx +541 -0
  8. package/apps/agents-server/src/app/admin/chat-feedback/page.tsx +22 -0
  9. package/apps/agents-server/src/app/admin/chat-history/ChatHistoryClient.tsx +532 -0
  10. package/apps/agents-server/src/app/admin/chat-history/page.tsx +21 -0
  11. package/apps/agents-server/src/app/admin/metadata/MetadataClient.tsx +241 -27
  12. package/apps/agents-server/src/app/admin/models/page.tsx +22 -0
  13. package/apps/agents-server/src/app/admin/users/[userId]/UserDetailClient.tsx +131 -0
  14. package/apps/agents-server/src/app/admin/users/[userId]/page.tsx +21 -0
  15. package/apps/agents-server/src/app/admin/users/page.tsx +18 -0
  16. package/apps/agents-server/src/app/agents/[agentName]/ClearAgentChatFeedbackButton.tsx +63 -0
  17. package/apps/agents-server/src/app/agents/[agentName]/ClearAgentChatHistoryButton.tsx +63 -0
  18. package/apps/agents-server/src/app/agents/[agentName]/CloneAgentButton.tsx +41 -0
  19. package/apps/agents-server/src/app/agents/[agentName]/InstallPwaButton.tsx +74 -0
  20. package/apps/agents-server/src/app/agents/[agentName]/ServiceWorkerRegister.tsx +24 -0
  21. package/apps/agents-server/src/app/agents/[agentName]/_utils.ts +19 -0
  22. package/apps/agents-server/src/app/agents/[agentName]/api/agents/route.ts +67 -0
  23. package/apps/agents-server/src/app/agents/[agentName]/api/profile/route.ts +3 -0
  24. package/apps/agents-server/src/app/agents/[agentName]/api/voice/route.ts +177 -0
  25. package/apps/agents-server/src/app/agents/[agentName]/book/page.tsx +3 -0
  26. package/apps/agents-server/src/app/agents/[agentName]/book+chat/AgentBookAndChat.tsx +53 -1
  27. package/apps/agents-server/src/app/agents/[agentName]/generateAgentMetadata.ts +11 -11
  28. package/apps/agents-server/src/app/agents/[agentName]/history/RestoreVersionButton.tsx +46 -0
  29. package/apps/agents-server/src/app/agents/[agentName]/history/actions.ts +12 -0
  30. package/apps/agents-server/src/app/agents/[agentName]/history/page.tsx +62 -0
  31. package/apps/agents-server/src/app/agents/[agentName]/images/icon-256.png/route.tsx +80 -0
  32. package/apps/agents-server/src/app/agents/[agentName]/images/screenshot-fullhd.png/route.tsx +92 -0
  33. package/apps/agents-server/src/app/agents/[agentName]/images/screenshot-phone.png/route.tsx +92 -0
  34. package/apps/agents-server/src/app/agents/[agentName]/integration/page.tsx +61 -0
  35. package/apps/agents-server/src/app/agents/[agentName]/opengraph-image.tsx +102 -0
  36. package/apps/agents-server/src/app/agents/[agentName]/page.tsx +41 -22
  37. package/apps/agents-server/src/app/api/agents/[agentName]/clone/route.ts +47 -0
  38. package/apps/agents-server/src/app/api/agents/[agentName]/route.ts +19 -0
  39. package/apps/agents-server/src/app/api/agents/route.ts +22 -13
  40. package/apps/agents-server/src/app/api/auth/login/route.ts +6 -44
  41. package/apps/agents-server/src/app/api/chat-feedback/[id]/route.ts +38 -0
  42. package/apps/agents-server/src/app/api/chat-feedback/route.ts +157 -0
  43. package/apps/agents-server/src/app/api/chat-history/[id]/route.ts +37 -0
  44. package/apps/agents-server/src/app/api/chat-history/route.ts +147 -0
  45. package/apps/agents-server/src/app/api/federated-agents/route.ts +17 -0
  46. package/apps/agents-server/src/app/api/upload/route.ts +9 -1
  47. package/apps/agents-server/src/app/docs/[docId]/page.tsx +62 -0
  48. package/apps/agents-server/src/app/docs/page.tsx +33 -0
  49. package/apps/agents-server/src/app/layout.tsx +29 -3
  50. package/apps/agents-server/src/app/manifest.ts +109 -0
  51. package/apps/agents-server/src/app/page.tsx +8 -45
  52. package/apps/agents-server/src/app/recycle-bin/RestoreAgentButton.tsx +40 -0
  53. package/apps/agents-server/src/app/recycle-bin/actions.ts +27 -0
  54. package/apps/agents-server/src/app/recycle-bin/page.tsx +58 -0
  55. package/apps/agents-server/src/app/restricted/page.tsx +33 -0
  56. package/apps/agents-server/src/app/test/og-image/README.md +1 -0
  57. package/apps/agents-server/src/app/test/og-image/opengraph-image.tsx +37 -0
  58. package/apps/agents-server/src/app/test/og-image/page.tsx +22 -0
  59. package/apps/agents-server/src/components/Footer/Footer.tsx +175 -0
  60. package/apps/agents-server/src/components/Header/Header.tsx +445 -79
  61. package/apps/agents-server/src/components/Homepage/AgentCard.tsx +46 -14
  62. package/apps/agents-server/src/components/Homepage/AgentsList.tsx +58 -0
  63. package/apps/agents-server/src/components/Homepage/Card.tsx +1 -1
  64. package/apps/agents-server/src/components/Homepage/ExternalAgentsSection.tsx +21 -0
  65. package/apps/agents-server/src/components/Homepage/ExternalAgentsSectionClient.tsx +183 -0
  66. package/apps/agents-server/src/components/Homepage/ModelsSection.tsx +75 -0
  67. package/apps/agents-server/src/components/LayoutWrapper/LayoutWrapper.tsx +28 -3
  68. package/apps/agents-server/src/components/LoginDialog/LoginDialog.tsx +18 -17
  69. package/apps/agents-server/src/components/Portal/Portal.tsx +38 -0
  70. package/apps/agents-server/src/components/UsersList/UsersList.tsx +82 -131
  71. package/apps/agents-server/src/components/UsersList/useUsersAdmin.ts +139 -0
  72. package/apps/agents-server/src/database/metadataDefaults.ts +38 -6
  73. package/apps/agents-server/src/middleware.ts +146 -93
  74. package/apps/agents-server/src/tools/$provideServer.ts +2 -2
  75. package/apps/agents-server/src/utils/authenticateUser.ts +42 -0
  76. package/apps/agents-server/src/utils/chatFeedbackAdmin.ts +96 -0
  77. package/apps/agents-server/src/utils/chatHistoryAdmin.ts +96 -0
  78. package/apps/agents-server/src/utils/getEffectiveFederatedServers.ts +22 -0
  79. package/apps/agents-server/src/utils/getFederatedAgents.ts +31 -8
  80. package/apps/agents-server/src/utils/getFederatedServersFromMetadata.ts +10 -0
  81. package/apps/agents-server/src/utils/getVisibleCommitmentDefinitions.ts +12 -0
  82. package/apps/agents-server/src/utils/isUserAdmin.ts +2 -2
  83. package/apps/agents-server/vercel.json +7 -0
  84. package/esm/index.es.js +153 -2
  85. package/esm/index.es.js.map +1 -1
  86. package/esm/typings/servers.d.ts +8 -1
  87. package/esm/typings/src/_packages/components.index.d.ts +2 -0
  88. package/esm/typings/src/_packages/core.index.d.ts +6 -0
  89. package/esm/typings/src/_packages/types.index.d.ts +2 -0
  90. package/esm/typings/src/_packages/utils.index.d.ts +2 -0
  91. package/esm/typings/src/book-2.0/agent-source/AgentModelRequirements.d.ts +7 -0
  92. package/esm/typings/src/book-components/Chat/Chat/ChatProps.d.ts +4 -0
  93. package/esm/typings/src/book-components/_common/HamburgerMenu/HamburgerMenu.d.ts +12 -0
  94. package/esm/typings/src/book-components/icons/MicIcon.d.ts +8 -0
  95. package/esm/typings/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentCollectionInSupabase.d.ts +17 -0
  96. package/esm/typings/src/commitments/MESSAGE/AgentMessageCommitmentDefinition.d.ts +28 -0
  97. package/esm/typings/src/commitments/MESSAGE/UserMessageCommitmentDefinition.d.ts +28 -0
  98. package/esm/typings/src/commitments/index.d.ts +20 -1
  99. package/esm/typings/src/execution/LlmExecutionTools.d.ts +9 -0
  100. package/esm/typings/src/llm-providers/agent/AgentLlmExecutionTools.d.ts +2 -1
  101. package/esm/typings/src/llm-providers/agent/RemoteAgent.d.ts +10 -1
  102. package/esm/typings/src/utils/normalization/normalizeMessageText.d.ts +9 -0
  103. package/esm/typings/src/utils/normalization/normalizeMessageText.test.d.ts +1 -0
  104. package/esm/typings/src/version.d.ts +1 -1
  105. package/package.json +1 -1
  106. package/umd/index.umd.js +153 -2
  107. package/umd/index.umd.js.map +1 -1
@@ -28,8 +28,15 @@ type ServerConfiguration = {
28
28
  * @public exported from `@promptbook/core`
29
29
  */
30
30
  export declare const REMOTE_SERVER_URLS: Array<ServerConfiguration>;
31
+ /**
32
+ * Remote servers that are auto-federated by the Agents Server.
33
+ *
34
+ * These servers are always added in addition to the `FEDERATED_SERVERS` metadata.
35
+ *
36
+ * @public exported from `@promptbook/core`
37
+ */
38
+ export declare const AUTO_FEDERATED_AGENT_SERVER_URLS: Array<string_promptbook_server_url>;
31
39
  export {};
32
40
  /**
33
- * TODO: [🐱‍🚀] Auto-federated server from url in here
34
41
  * Note: [💞] Ignore a discrepancy between file name and entity name
35
42
  */
@@ -45,6 +45,7 @@ import type { MessageButton } from '../book-components/Chat/utils/parseMessageBu
45
45
  import { parseMessageButtons } from '../book-components/Chat/utils/parseMessageButtons';
46
46
  import { ArrowIcon } from '../book-components/icons/ArrowIcon';
47
47
  import { AttachmentIcon } from '../book-components/icons/AttachmentIcon';
48
+ import { MicIcon } from '../book-components/icons/MicIcon';
48
49
  import { PauseIcon } from '../book-components/icons/PauseIcon';
49
50
  import { PlayIcon } from '../book-components/icons/PlayIcon';
50
51
  import { ResetIcon } from '../book-components/icons/ResetIcon';
@@ -104,6 +105,7 @@ export type { MessageButton };
104
105
  export { parseMessageButtons };
105
106
  export { ArrowIcon };
106
107
  export { AttachmentIcon };
108
+ export { MicIcon };
107
109
  export { PauseIcon };
108
110
  export { PlayIcon };
109
111
  export { ResetIcon };
@@ -25,6 +25,8 @@ import { getCommitmentDefinition } from '../commitments/index';
25
25
  import { getAllCommitmentDefinitions } from '../commitments/index';
26
26
  import { getAllCommitmentTypes } from '../commitments/index';
27
27
  import { isCommitmentSupported } from '../commitments/index';
28
+ import type { GroupedCommitmentDefinition } from '../commitments/index';
29
+ import { getGroupedCommitmentDefinitions } from '../commitments/index';
28
30
  import { NAME } from '../config';
29
31
  import { ADMIN_EMAIL } from '../config';
30
32
  import { ADMIN_GITHUB_NAME } from '../config';
@@ -190,6 +192,7 @@ import { TaskTypes } from '../types/TaskType';
190
192
  import { aboutPromptbookInformation } from '../utils/misc/aboutPromptbookInformation';
191
193
  import { $generateBookBoilerplate } from '../utils/random/$generateBookBoilerplate';
192
194
  import { REMOTE_SERVER_URLS } from '../../servers';
195
+ import { AUTO_FEDERATED_AGENT_SERVER_URLS } from '../../servers';
193
196
  export { BOOK_LANGUAGE_VERSION, PROMPTBOOK_ENGINE_VERSION };
194
197
  export { computeAgentHash };
195
198
  export { createAgentModelRequirements };
@@ -217,6 +220,8 @@ export { getCommitmentDefinition };
217
220
  export { getAllCommitmentDefinitions };
218
221
  export { getAllCommitmentTypes };
219
222
  export { isCommitmentSupported };
223
+ export type { GroupedCommitmentDefinition };
224
+ export { getGroupedCommitmentDefinitions };
220
225
  export { NAME };
221
226
  export { ADMIN_EMAIL };
222
227
  export { ADMIN_GITHUB_NAME };
@@ -382,3 +387,4 @@ export { TaskTypes };
382
387
  export { aboutPromptbookInformation };
383
388
  export { $generateBookBoilerplate };
384
389
  export { REMOTE_SERVER_URLS };
390
+ export { AUTO_FEDERATED_AGENT_SERVER_URLS };
@@ -57,6 +57,7 @@ import type { InstrumentCommand } from '../commands/X_INSTRUMENT/InstrumentComma
57
57
  import type { BookCommitment } from '../commitments/_base/BookCommitment';
58
58
  import type { CommitmentDefinition } from '../commitments/_base/CommitmentDefinition';
59
59
  import type { ParsedCommitment } from '../commitments/_base/ParsedCommitment';
60
+ import type { GroupedCommitmentDefinition } from '../commitments/index';
60
61
  import type { PrettifyOptions } from '../conversion/prettify/PrettifyOptions';
61
62
  import type { renderPipelineMermaidOptions } from '../conversion/prettify/renderPipelineMermaidOptions';
62
63
  import type { CallbackInterfaceToolsOptions } from '../dialogs/callback/CallbackInterfaceToolsOptions';
@@ -414,6 +415,7 @@ export type { InstrumentCommand };
414
415
  export type { BookCommitment };
415
416
  export type { CommitmentDefinition };
416
417
  export type { ParsedCommitment };
418
+ export type { GroupedCommitmentDefinition };
417
419
  export type { PrettifyOptions };
418
420
  export type { renderPipelineMermaidOptions };
419
421
  export type { CallbackInterfaceToolsOptions };
@@ -40,6 +40,7 @@ import { nameToUriPart } from '../utils/normalization/nameToUriPart';
40
40
  import { nameToUriParts } from '../utils/normalization/nameToUriParts';
41
41
  import type { string_kebab_case } from '../utils/normalization/normalize-to-kebab-case';
42
42
  import { normalizeToKebabCase } from '../utils/normalization/normalize-to-kebab-case';
43
+ import { normalizeMessageText } from '../utils/normalization/normalizeMessageText';
43
44
  import type { string_camelCase } from '../utils/normalization/normalizeTo_camelCase';
44
45
  import { normalizeTo_camelCase } from '../utils/normalization/normalizeTo_camelCase';
45
46
  import type { string_PascalCase } from '../utils/normalization/normalizeTo_PascalCase';
@@ -127,6 +128,7 @@ export { nameToUriPart };
127
128
  export { nameToUriParts };
128
129
  export type { string_kebab_case };
129
130
  export { normalizeToKebabCase };
131
+ export { normalizeMessageText };
130
132
  export type { string_camelCase };
131
133
  export { normalizeTo_camelCase };
132
134
  export type { string_PascalCase };
@@ -22,6 +22,13 @@ export type AgentModelRequirements = {
22
22
  * Optional list of knowledge source links that the agent can use
23
23
  */
24
24
  readonly knowledgeSources?: ReadonlyArray<string_knowledge_source_link>;
25
+ /**
26
+ * List of sample conversations (question/answer pairs)
27
+ */
28
+ readonly samples?: ReadonlyArray<{
29
+ question: string;
30
+ answer: string;
31
+ }>;
25
32
  /**
26
33
  * Temperature for the agent's responses, controlling randomness
27
34
  */
@@ -44,6 +44,10 @@ export type ChatProps = {
44
44
  * Determines whether the voice recognition button is rendered
45
45
  */
46
46
  readonly isVoiceRecognitionButtonShown?: boolean;
47
+ /**
48
+ * Optional callback to trigger voice input
49
+ */
50
+ onVoiceInput?(): void;
47
51
  /**
48
52
  * The language code to use for voice recognition
49
53
  */
@@ -0,0 +1,12 @@
1
+ type HamburgerMenuProps = {
2
+ isOpen: boolean;
3
+ onClick?: () => void;
4
+ className?: string;
5
+ };
6
+ /**
7
+ * @@@
8
+ *
9
+ * @private Internal component
10
+ */
11
+ export declare function HamburgerMenu({ isOpen, onClick, className }: HamburgerMenuProps): import("react/jsx-runtime").JSX.Element;
12
+ export {};
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Shows simple microphone icon
3
+ *
4
+ * @public exported from `@promptbook/components`
5
+ */
6
+ export declare const MicIcon: ({ size }: {
7
+ size: number;
8
+ }) => import("react/jsx-runtime").JSX.Element;
@@ -43,6 +43,23 @@ export declare class AgentCollectionInSupabase {
43
43
  * Deletes an agent from the collection
44
44
  */
45
45
  deleteAgent(agentName: string_agent_name): Promise<void>;
46
+ /**
47
+ * List history of an agent
48
+ */
49
+ listAgentHistory(agentName: string_agent_name): Promise<ReadonlyArray<{
50
+ id: number;
51
+ createdAt: string;
52
+ agentHash: string;
53
+ promptbookEngineVersion: string;
54
+ }>>;
55
+ /**
56
+ * List agents that are in history but not in the active agents list
57
+ */
58
+ listDeletedAgents(): Promise<ReadonlyArray<string_agent_name>>;
59
+ /**
60
+ * Restore an agent from history
61
+ */
62
+ restoreAgent(historyId: number): Promise<void>;
46
63
  /**
47
64
  * Get the Supabase table name with prefix
48
65
  *
@@ -0,0 +1,28 @@
1
+ import type { AgentModelRequirements } from '../../book-2.0/agent-source/AgentModelRequirements';
2
+ import { BaseCommitmentDefinition } from '../_base/BaseCommitmentDefinition';
3
+ /**
4
+ * AGENT MESSAGE commitment definition
5
+ *
6
+ * The AGENT MESSAGE commitment defines a message from the agent in the conversation history.
7
+ * It is used to pre-fill the chat with a conversation history or to provide few-shot examples.
8
+ *
9
+ * Example usage in agent source:
10
+ *
11
+ * ```book
12
+ * AGENT MESSAGE What seems to be the issue?
13
+ * ```
14
+ *
15
+ * @private [🪔] Maybe export the commitments through some package
16
+ */
17
+ export declare class AgentMessageCommitmentDefinition extends BaseCommitmentDefinition<'AGENT MESSAGE'> {
18
+ constructor();
19
+ /**
20
+ * Short one-line description of AGENT MESSAGE.
21
+ */
22
+ get description(): string;
23
+ /**
24
+ * Markdown documentation for AGENT MESSAGE commitment.
25
+ */
26
+ get documentation(): string;
27
+ applyToAgentModelRequirements(requirements: AgentModelRequirements, content: string): AgentModelRequirements;
28
+ }
@@ -0,0 +1,28 @@
1
+ import type { AgentModelRequirements } from '../../book-2.0/agent-source/AgentModelRequirements';
2
+ import { BaseCommitmentDefinition } from '../_base/BaseCommitmentDefinition';
3
+ /**
4
+ * USER MESSAGE commitment definition
5
+ *
6
+ * The USER MESSAGE commitment defines a message from the user in the conversation history.
7
+ * It is used to pre-fill the chat with a conversation history or to provide few-shot examples.
8
+ *
9
+ * Example usage in agent source:
10
+ *
11
+ * ```book
12
+ * USER MESSAGE Hello, I have a problem.
13
+ * ```
14
+ *
15
+ * @private [🪔] Maybe export the commitments through some package
16
+ */
17
+ export declare class UserMessageCommitmentDefinition extends BaseCommitmentDefinition<'USER MESSAGE'> {
18
+ constructor();
19
+ /**
20
+ * Short one-line description of USER MESSAGE.
21
+ */
22
+ get description(): string;
23
+ /**
24
+ * Markdown documentation for USER MESSAGE commitment.
25
+ */
26
+ get documentation(): string;
27
+ applyToAgentModelRequirements(requirements: AgentModelRequirements, content: string): AgentModelRequirements;
28
+ }
@@ -6,8 +6,10 @@ import { FormatCommitmentDefinition } from './FORMAT/FORMAT';
6
6
  import { GoalCommitmentDefinition } from './GOAL/GOAL';
7
7
  import { KnowledgeCommitmentDefinition } from './KNOWLEDGE/KNOWLEDGE';
8
8
  import { MemoryCommitmentDefinition } from './MEMORY/MEMORY';
9
+ import { AgentMessageCommitmentDefinition } from './MESSAGE/AgentMessageCommitmentDefinition';
9
10
  import { InitialMessageCommitmentDefinition } from './MESSAGE/InitialMessageCommitmentDefinition';
10
11
  import { MessageCommitmentDefinition } from './MESSAGE/MESSAGE';
12
+ import { UserMessageCommitmentDefinition } from './MESSAGE/UserMessageCommitmentDefinition';
11
13
  import { MetaCommitmentDefinition } from './META/META';
12
14
  import { MetaColorCommitmentDefinition } from './META_COLOR/META_COLOR';
13
15
  import { MetaImageCommitmentDefinition } from './META_IMAGE/META_IMAGE';
@@ -26,7 +28,7 @@ import { NotYetImplementedCommitmentDefinition } from './_base/NotYetImplemented
26
28
  *
27
29
  * @private Use functions to access commitments instead of this array directly
28
30
  */
29
- export declare const COMMITMENT_REGISTRY: readonly [PersonaCommitmentDefinition, PersonaCommitmentDefinition, KnowledgeCommitmentDefinition, MemoryCommitmentDefinition, MemoryCommitmentDefinition, StyleCommitmentDefinition, StyleCommitmentDefinition, RuleCommitmentDefinition, RuleCommitmentDefinition, SampleCommitmentDefinition, SampleCommitmentDefinition, FormatCommitmentDefinition, FormatCommitmentDefinition, ModelCommitmentDefinition, ModelCommitmentDefinition, ActionCommitmentDefinition, ActionCommitmentDefinition, MetaImageCommitmentDefinition, MetaColorCommitmentDefinition, MetaCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, GoalCommitmentDefinition, GoalCommitmentDefinition, InitialMessageCommitmentDefinition, MessageCommitmentDefinition, MessageCommitmentDefinition, ScenarioCommitmentDefinition, ScenarioCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, NotYetImplementedCommitmentDefinition<"EXPECT">, NotYetImplementedCommitmentDefinition<"BEHAVIOUR">, NotYetImplementedCommitmentDefinition<"BEHAVIOURS">, NotYetImplementedCommitmentDefinition<"AVOID">, NotYetImplementedCommitmentDefinition<"AVOIDANCE">, NotYetImplementedCommitmentDefinition<"CONTEXT">];
31
+ export declare const COMMITMENT_REGISTRY: readonly [PersonaCommitmentDefinition, PersonaCommitmentDefinition, KnowledgeCommitmentDefinition, MemoryCommitmentDefinition, MemoryCommitmentDefinition, StyleCommitmentDefinition, StyleCommitmentDefinition, RuleCommitmentDefinition, RuleCommitmentDefinition, SampleCommitmentDefinition, SampleCommitmentDefinition, FormatCommitmentDefinition, FormatCommitmentDefinition, ModelCommitmentDefinition, ModelCommitmentDefinition, ActionCommitmentDefinition, ActionCommitmentDefinition, MetaImageCommitmentDefinition, MetaColorCommitmentDefinition, MetaCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, GoalCommitmentDefinition, GoalCommitmentDefinition, InitialMessageCommitmentDefinition, UserMessageCommitmentDefinition, AgentMessageCommitmentDefinition, MessageCommitmentDefinition, MessageCommitmentDefinition, ScenarioCommitmentDefinition, ScenarioCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, NotYetImplementedCommitmentDefinition<"EXPECT">, NotYetImplementedCommitmentDefinition<"BEHAVIOUR">, NotYetImplementedCommitmentDefinition<"BEHAVIOURS">, NotYetImplementedCommitmentDefinition<"AVOID">, NotYetImplementedCommitmentDefinition<"AVOIDANCE">, NotYetImplementedCommitmentDefinition<"CONTEXT">];
30
32
  /**
31
33
  * Gets a commitment definition by its type
32
34
  * @param type The commitment type to look up
@@ -57,6 +59,23 @@ export declare function getAllCommitmentTypes(): ReadonlyArray<BookCommitment>;
57
59
  * @public exported from `@promptbook/core`
58
60
  */
59
61
  export declare function isCommitmentSupported(type: BookCommitment): boolean;
62
+ /**
63
+ * Grouped commitment definition
64
+ *
65
+ * @public exported from `@promptbook/core`
66
+ */
67
+ export type GroupedCommitmentDefinition = {
68
+ primary: CommitmentDefinition;
69
+ aliases: string[];
70
+ };
71
+ /**
72
+ * Gets all commitment definitions grouped by their aliases
73
+ *
74
+ * @returns Array of grouped commitment definitions
75
+ *
76
+ * @public exported from `@promptbook/core`
77
+ */
78
+ export declare function getGroupedCommitmentDefinitions(): ReadonlyArray<GroupedCommitmentDefinition>;
60
79
  /**
61
80
  * TODO: [🧠] Maybe create through standardized $register
62
81
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -57,6 +57,15 @@ export type LlmExecutionTools = {
57
57
  * Calls a chat model with streaming
58
58
  */
59
59
  callChatModelStream?(prompt: Prompt, onProgress: (chunk: ChatPromptResult) => void): Promise<ChatPromptResult>;
60
+ /**
61
+ * Calls a voice chat model
62
+ */
63
+ callVoiceChatModel?(audio: Blob, prompt: Prompt): Promise<{
64
+ text: string;
65
+ audio: Blob;
66
+ userMessage?: string;
67
+ agentMessage?: string;
68
+ }>;
60
69
  /**
61
70
  * Calls a completion model
62
71
  */
@@ -1,4 +1,5 @@
1
1
  import type { Promisable } from 'type-fest';
2
+ import type { AgentModelRequirements } from '../../book-2.0/agent-source/AgentModelRequirements';
2
3
  import type { string_book } from '../../book-2.0/agent-source/string_book';
3
4
  import type { ChatParticipant } from '../../book-components/Chat/types/ChatParticipant';
4
5
  import type { AvailableModel } from '../../execution/AvailableModel';
@@ -54,7 +55,7 @@ export declare class AgentLlmExecutionTools implements LlmExecutionTools {
54
55
  /**
55
56
  * Get cached or create agent model requirements
56
57
  */
57
- private getAgentModelRequirements;
58
+ protected getAgentModelRequirements(): Promise<AgentModelRequirements>;
58
59
  get title(): string_title & string_markdown_text;
59
60
  get description(): string_markdown;
60
61
  get profile(): ChatParticipant | undefined;
@@ -23,6 +23,7 @@ export declare class RemoteAgent extends Agent {
23
23
  private agentUrl;
24
24
  private _remoteAgentName;
25
25
  private _remoteAgentHash;
26
+ private _isVoiceCallingEnabled;
26
27
  private constructor();
27
28
  get agentName(): string_agent_name;
28
29
  get agentHash(): string_agent_hash;
@@ -31,8 +32,16 @@ export declare class RemoteAgent extends Agent {
31
32
  */
32
33
  callChatModel(prompt: Prompt): Promise<ChatPromptResult>;
33
34
  /**
34
- * Calls the agent on agents remote server with streaming
35
+ * Calls the agent on agents remote server with voice
36
+ * [✨✷] Only available when voice calling is enabled on the server
37
+ * Returns undefined if voice calling is disabled
35
38
  */
39
+ get callVoiceChatModel(): ((audio: Blob, prompt: Prompt) => Promise<{
40
+ text: string;
41
+ audio: Blob;
42
+ userMessage?: string;
43
+ agentMessage?: string;
44
+ }>) | undefined;
36
45
  callChatModelStream(prompt: Prompt, onProgress: (chunk: ChatPromptResult) => void): Promise<ChatPromptResult>;
37
46
  }
38
47
  /**
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Normalizes message text for comparison
3
+ *
4
+ * @param text The message text to normalize
5
+ * @returns The normalized message text
6
+ *
7
+ * @public exported from `@promptbook/utils`
8
+ */
9
+ export declare function normalizeMessageText(text: string): string;
@@ -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.103.0-51`).
18
+ * It follows semantic versioning (e.g., `0.103.0-52`).
19
19
  *
20
20
  * @generated
21
21
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promptbook/cli",
3
- "version": "0.103.0-52",
3
+ "version": "0.103.0-53",
4
4
  "description": "Promptbook: Turn your company's scattered knowledge into AI ready books",
5
5
  "private": false,
6
6
  "sideEffects": false,
package/umd/index.umd.js CHANGED
@@ -56,12 +56,23 @@
56
56
  * @generated
57
57
  * @see https://github.com/webgptorg/promptbook
58
58
  */
59
- const PROMPTBOOK_ENGINE_VERSION = '0.103.0-52';
59
+ const PROMPTBOOK_ENGINE_VERSION = '0.103.0-53';
60
60
  /**
61
61
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
62
62
  * Note: [💞] Ignore a discrepancy between file name and entity name
63
63
  */
64
64
 
65
+ /**
66
+ * Core Promptbook server configuration.
67
+ *
68
+ * This server is also used for auto-federation in the Agents Server.
69
+ */
70
+ const CORE_SERVER = {
71
+ title: 'Promptbook Core',
72
+ description: `Core Promptbook server used for auto-federation`,
73
+ owner: 'AI Web, LLC <legal@ptbk.io> (https://www.ptbk.io/)',
74
+ urls: ['https://core.ptbk.io/'],
75
+ };
65
76
  /**
66
77
  * Available remote servers for the Promptbook
67
78
  *
@@ -83,6 +94,7 @@
83
94
  owner: 'AI Web, LLC <legal@ptbk.io> (https://www.ptbk.io/)',
84
95
  urls: ['https://s6.ptbk.io/'],
85
96
  },
97
+ CORE_SERVER,
86
98
  /*
87
99
  Note: Working on older version of Promptbook and not supported anymore
88
100
  {
@@ -95,7 +107,6 @@
95
107
  */
96
108
  ];
97
109
  /**
98
- * TODO: [🐱‍🚀] Auto-federated server from url in here
99
110
  * Note: [💞] Ignore a discrepancy between file name and entity name
100
111
  */
101
112
 
@@ -20690,12 +20701,15 @@
20690
20701
  fileStreams.push(file);
20691
20702
  }
20692
20703
  else {
20704
+ /*
20705
+ TODO: [🐱‍🚀] Resolve problem with browser environment
20693
20706
  // Assume it's a local file path
20694
20707
  // Note: This will work in Node.js environment
20695
20708
  // For browser environments, this would need different handling
20696
20709
  const fs = await import('fs');
20697
20710
  const fileStream = fs.createReadStream(source);
20698
20711
  fileStreams.push(fileStream);
20712
+ */
20699
20713
  }
20700
20714
  }
20701
20715
  catch (error) {
@@ -20784,12 +20798,15 @@
20784
20798
  fileStreams.push(file);
20785
20799
  }
20786
20800
  else {
20801
+ /*
20802
+ TODO: [🐱‍🚀] Resolve problem with browser environment
20787
20803
  // Assume it's a local file path
20788
20804
  // Note: This will work in Node.js environment
20789
20805
  // For browser environments, this would need different handling
20790
20806
  const fs = await import('fs');
20791
20807
  const fileStream = fs.createReadStream(source);
20792
20808
  fileStreams.push(fileStream);
20809
+ */
20793
20810
  }
20794
20811
  }
20795
20812
  catch (error) {
@@ -23068,6 +23085,77 @@
23068
23085
  * Note: [💞] Ignore a discrepancy between file name and entity name
23069
23086
  */
23070
23087
 
23088
+ /**
23089
+ * AGENT MESSAGE commitment definition
23090
+ *
23091
+ * The AGENT MESSAGE commitment defines a message from the agent in the conversation history.
23092
+ * It is used to pre-fill the chat with a conversation history or to provide few-shot examples.
23093
+ *
23094
+ * Example usage in agent source:
23095
+ *
23096
+ * ```book
23097
+ * AGENT MESSAGE What seems to be the issue?
23098
+ * ```
23099
+ *
23100
+ * @private [🪔] Maybe export the commitments through some package
23101
+ */
23102
+ class AgentMessageCommitmentDefinition extends BaseCommitmentDefinition {
23103
+ constructor() {
23104
+ super('AGENT MESSAGE');
23105
+ }
23106
+ /**
23107
+ * Short one-line description of AGENT MESSAGE.
23108
+ */
23109
+ get description() {
23110
+ return 'Defines a **message from the agent** in the conversation history.';
23111
+ }
23112
+ /**
23113
+ * Markdown documentation for AGENT MESSAGE commitment.
23114
+ */
23115
+ get documentation() {
23116
+ return spaceTrim.spaceTrim(`
23117
+ # ${this.type}
23118
+
23119
+ Defines a message from the agent in the conversation history. This is used to pre-fill the chat with a conversation history or to provide few-shot examples.
23120
+
23121
+ ## Key aspects
23122
+
23123
+ - Represents a message sent by the agent.
23124
+ - Used for setting up conversation context.
23125
+ - Can be used in conjunction with USER MESSAGE.
23126
+
23127
+ ## Examples
23128
+
23129
+ \`\`\`book
23130
+ Conversation History
23131
+
23132
+ USER MESSAGE Hello, I have a problem.
23133
+ AGENT MESSAGE What seems to be the issue?
23134
+ USER MESSAGE My computer is not starting.
23135
+ \`\`\`
23136
+ `);
23137
+ }
23138
+ applyToAgentModelRequirements(requirements, content) {
23139
+ // AGENT MESSAGE is for UI display purposes / conversation history construction
23140
+ // and typically doesn't need to be added to the system prompt or model requirements directly.
23141
+ // It is extracted separately for the chat interface.
23142
+ var _a;
23143
+ const pendingUserMessage = (_a = requirements.metadata) === null || _a === void 0 ? void 0 : _a.pendingUserMessage;
23144
+ if (pendingUserMessage) {
23145
+ const newSample = { question: pendingUserMessage, answer: content };
23146
+ const newSamples = [...(requirements.samples || []), newSample];
23147
+ const newMetadata = { ...requirements.metadata };
23148
+ delete newMetadata.pendingUserMessage;
23149
+ return {
23150
+ ...requirements,
23151
+ samples: newSamples,
23152
+ metadata: newMetadata,
23153
+ };
23154
+ }
23155
+ return requirements;
23156
+ }
23157
+ }
23158
+
23071
23159
  /**
23072
23160
  * INITIAL MESSAGE commitment definition
23073
23161
  *
@@ -23232,6 +23320,67 @@
23232
23320
  * Note: [💞] Ignore a discrepancy between file name and entity name
23233
23321
  */
23234
23322
 
23323
+ /**
23324
+ * USER MESSAGE commitment definition
23325
+ *
23326
+ * The USER MESSAGE commitment defines a message from the user in the conversation history.
23327
+ * It is used to pre-fill the chat with a conversation history or to provide few-shot examples.
23328
+ *
23329
+ * Example usage in agent source:
23330
+ *
23331
+ * ```book
23332
+ * USER MESSAGE Hello, I have a problem.
23333
+ * ```
23334
+ *
23335
+ * @private [🪔] Maybe export the commitments through some package
23336
+ */
23337
+ class UserMessageCommitmentDefinition extends BaseCommitmentDefinition {
23338
+ constructor() {
23339
+ super('USER MESSAGE');
23340
+ }
23341
+ /**
23342
+ * Short one-line description of USER MESSAGE.
23343
+ */
23344
+ get description() {
23345
+ return 'Defines a **message from the user** in the conversation history.';
23346
+ }
23347
+ /**
23348
+ * Markdown documentation for USER MESSAGE commitment.
23349
+ */
23350
+ get documentation() {
23351
+ return spaceTrim.spaceTrim(`
23352
+ # ${this.type}
23353
+
23354
+ Defines a message from the user in the conversation history. This is used to pre-fill the chat with a conversation history or to provide few-shot examples.
23355
+
23356
+ ## Key aspects
23357
+
23358
+ - Represents a message sent by the user.
23359
+ - Used for setting up conversation context.
23360
+ - Can be used in conjunction with AGENT MESSAGE.
23361
+
23362
+ ## Examples
23363
+
23364
+ \`\`\`book
23365
+ Conversation History
23366
+
23367
+ USER MESSAGE Hello, I have a problem.
23368
+ AGENT MESSAGE What seems to be the issue?
23369
+ USER MESSAGE My computer is not starting.
23370
+ \`\`\`
23371
+ `);
23372
+ }
23373
+ applyToAgentModelRequirements(requirements, content) {
23374
+ return {
23375
+ ...requirements,
23376
+ metadata: {
23377
+ ...requirements.metadata,
23378
+ pendingUserMessage: content,
23379
+ },
23380
+ };
23381
+ }
23382
+ }
23383
+
23235
23384
  /**
23236
23385
  * META commitment definition
23237
23386
  *
@@ -24445,6 +24594,8 @@
24445
24594
  new GoalCommitmentDefinition('GOAL'),
24446
24595
  new GoalCommitmentDefinition('GOALS'),
24447
24596
  new InitialMessageCommitmentDefinition(),
24597
+ new UserMessageCommitmentDefinition(),
24598
+ new AgentMessageCommitmentDefinition(),
24448
24599
  new MessageCommitmentDefinition('MESSAGE'),
24449
24600
  new MessageCommitmentDefinition('MESSAGES'),
24450
24601
  new ScenarioCommitmentDefinition('SCENARIO'),