@promptbook/utils 0.112.0-62 → 0.112.0-64

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 (55) hide show
  1. package/esm/index.es.js +1 -1
  2. package/esm/src/_packages/components.index.d.ts +4 -0
  3. package/esm/src/_packages/core.index.d.ts +2 -0
  4. package/esm/src/_packages/types.index.d.ts +2 -0
  5. package/esm/src/book-components/Chat/Chat/TeamToolCallModalContent.d.ts +0 -2
  6. package/esm/src/book-components/Chat/Chat/renderTimeoutToolCallDetails.d.ts +7 -1
  7. package/esm/src/book-components/Chat/Chat/useChatInputAreaComposer.d.ts +1 -1
  8. package/esm/src/book-components/Chat/Chat/useChatInputAreaDictation.d.ts +2 -2
  9. package/esm/src/book-components/Chat/hooks/useChatAutoScroll.d.ts +6 -3
  10. package/esm/src/book-components/Chat/types/ChatMessage.d.ts +34 -0
  11. package/esm/src/cli/cli-commands/agent/agentProjectPaths.d.ts +54 -0
  12. package/esm/src/cli/cli-commands/agent/agentRunCliOptions.d.ts +13 -0
  13. package/esm/src/cli/cli-commands/agent/init.d.ts +10 -0
  14. package/esm/src/cli/cli-commands/agent/initializeAgentProjectConfiguration.d.ts +21 -0
  15. package/esm/src/cli/cli-commands/agent/printAgentInitializationSummary.d.ts +7 -0
  16. package/esm/src/cli/cli-commands/agent/run.d.ts +10 -0
  17. package/esm/src/cli/cli-commands/agent/run.test.d.ts +1 -0
  18. package/esm/src/cli/cli-commands/agent/tick.d.ts +10 -0
  19. package/esm/src/cli/cli-commands/agent.d.ts +15 -0
  20. package/esm/src/cli/cli-commands/common/promptRunnerCliOptions.d.ts +86 -0
  21. package/esm/src/commitments/KNOWLEDGE/KNOWLEDGE.d.ts +11 -0
  22. package/esm/src/commitments/KNOWLEDGE/KNOWLEDGE.test.d.ts +1 -0
  23. package/esm/src/commitments/_common/toolRuntimeContext.d.ts +6 -0
  24. package/esm/src/commitments/index.d.ts +2 -1
  25. package/esm/src/llm-providers/openai/OpenAiAgentKitExecutionTools.d.ts +4 -2
  26. package/esm/src/llm-providers/openai/OpenAiAgentKitExecutionToolsOptions.d.ts +9 -0
  27. package/esm/src/version.d.ts +1 -1
  28. package/package.json +1 -1
  29. package/umd/index.umd.js +1 -1
  30. package/umd/src/_packages/components.index.d.ts +4 -0
  31. package/umd/src/_packages/core.index.d.ts +2 -0
  32. package/umd/src/_packages/types.index.d.ts +2 -0
  33. package/umd/src/book-components/Chat/Chat/TeamToolCallModalContent.d.ts +0 -2
  34. package/umd/src/book-components/Chat/Chat/renderTimeoutToolCallDetails.d.ts +7 -1
  35. package/umd/src/book-components/Chat/Chat/useChatInputAreaComposer.d.ts +1 -1
  36. package/umd/src/book-components/Chat/Chat/useChatInputAreaDictation.d.ts +2 -2
  37. package/umd/src/book-components/Chat/hooks/useChatAutoScroll.d.ts +6 -3
  38. package/umd/src/book-components/Chat/types/ChatMessage.d.ts +34 -0
  39. package/umd/src/cli/cli-commands/agent/agentProjectPaths.d.ts +54 -0
  40. package/umd/src/cli/cli-commands/agent/agentRunCliOptions.d.ts +13 -0
  41. package/umd/src/cli/cli-commands/agent/init.d.ts +10 -0
  42. package/umd/src/cli/cli-commands/agent/initializeAgentProjectConfiguration.d.ts +21 -0
  43. package/umd/src/cli/cli-commands/agent/printAgentInitializationSummary.d.ts +7 -0
  44. package/umd/src/cli/cli-commands/agent/run.d.ts +10 -0
  45. package/umd/src/cli/cli-commands/agent/run.test.d.ts +1 -0
  46. package/umd/src/cli/cli-commands/agent/tick.d.ts +10 -0
  47. package/umd/src/cli/cli-commands/agent.d.ts +15 -0
  48. package/umd/src/cli/cli-commands/common/promptRunnerCliOptions.d.ts +86 -0
  49. package/umd/src/commitments/KNOWLEDGE/KNOWLEDGE.d.ts +11 -0
  50. package/umd/src/commitments/KNOWLEDGE/KNOWLEDGE.test.d.ts +1 -0
  51. package/umd/src/commitments/_common/toolRuntimeContext.d.ts +6 -0
  52. package/umd/src/commitments/index.d.ts +2 -1
  53. package/umd/src/llm-providers/openai/OpenAiAgentKitExecutionTools.d.ts +4 -2
  54. package/umd/src/llm-providers/openai/OpenAiAgentKitExecutionToolsOptions.d.ts +9 -0
  55. package/umd/src/version.d.ts +1 -1
package/esm/index.es.js CHANGED
@@ -18,7 +18,7 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
18
18
  * @generated
19
19
  * @see https://github.com/webgptorg/promptbook
20
20
  */
21
- const PROMPTBOOK_ENGINE_VERSION = '0.112.0-62';
21
+ const PROMPTBOOK_ENGINE_VERSION = '0.112.0-64';
22
22
  /**
23
23
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
24
24
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -34,6 +34,7 @@ import type { ChatEffect } from '../book-components/Chat/effects/types/ChatEffec
34
34
  import type { ChatEffectConfig } from '../book-components/Chat/effects/types/ChatEffectConfig';
35
35
  import type { ChatEffectsSystemProps } from '../book-components/Chat/effects/types/ChatEffectsSystemProps';
36
36
  import type { ChatEffectType } from '../book-components/Chat/effects/types/ChatEffectType';
37
+ import type { ChatAutoScrollConfig } from '../book-components/Chat/hooks/useChatAutoScroll';
37
38
  import { useChatAutoScroll } from '../book-components/Chat/hooks/useChatAutoScroll';
38
39
  import type { SendMessageToLlmChatFunction } from '../book-components/Chat/hooks/useSendMessageToLlmChat';
39
40
  import { useSendMessageToLlmChat } from '../book-components/Chat/hooks/useSendMessageToLlmChat';
@@ -61,6 +62,7 @@ import { reactSaveFormatDefinition } from '../book-components/Chat/save/react/re
61
62
  import { txtSaveFormatDefinition } from '../book-components/Chat/save/text/txtSaveFormatDefinition';
62
63
  import type { ChatProgressItem } from '../book-components/Chat/types/ChatMessage';
63
64
  import type { ChatProgressCard } from '../book-components/Chat/types/ChatMessage';
65
+ import type { ChatMessageSource } from '../book-components/Chat/types/ChatMessage';
64
66
  import type { ChatMessageReplyingTo } from '../book-components/Chat/types/ChatMessage';
65
67
  import type { ChatMessage } from '../book-components/Chat/types/ChatMessage';
66
68
  import type { ChatParticipant } from '../book-components/Chat/types/ChatParticipant';
@@ -116,6 +118,7 @@ export type { ChatEffect };
116
118
  export type { ChatEffectConfig };
117
119
  export type { ChatEffectsSystemProps };
118
120
  export type { ChatEffectType };
121
+ export type { ChatAutoScrollConfig };
119
122
  export { useChatAutoScroll };
120
123
  export type { SendMessageToLlmChatFunction };
121
124
  export { useSendMessageToLlmChat };
@@ -143,6 +146,7 @@ export { reactSaveFormatDefinition };
143
146
  export { txtSaveFormatDefinition };
144
147
  export type { ChatProgressItem };
145
148
  export type { ChatProgressCard };
149
+ export type { ChatMessageSource };
146
150
  export type { ChatMessageReplyingTo };
147
151
  export type { ChatMessage };
148
152
  export type { ChatParticipant };
@@ -28,6 +28,7 @@ import { getAllCommitmentTypes } from '../commitments/_common/getAllCommitmentTy
28
28
  import { getCommitmentDefinition } from '../commitments/_common/getCommitmentDefinition';
29
29
  import { getGroupedCommitmentDefinitions } from '../commitments/_common/getGroupedCommitmentDefinitions';
30
30
  import { isCommitmentSupported } from '../commitments/_common/isCommitmentSupported';
31
+ import { KNOWLEDGE_SEARCH_TOOL_NAME } from '../commitments/KNOWLEDGE/KNOWLEDGE';
31
32
  import { NAME } from '../config';
32
33
  import { ADMIN_EMAIL } from '../config';
33
34
  import { PROMPTBOOK_LEGAL_ENTITY } from '../config';
@@ -252,6 +253,7 @@ export { getAllCommitmentTypes };
252
253
  export { getCommitmentDefinition };
253
254
  export { getGroupedCommitmentDefinitions };
254
255
  export { isCommitmentSupported };
256
+ export { KNOWLEDGE_SEARCH_TOOL_NAME };
255
257
  export { NAME };
256
258
  export { ADMIN_EMAIL };
257
259
  export { PROMPTBOOK_LEGAL_ENTITY };
@@ -44,6 +44,7 @@ import type { SourceChipProps } from '../book-components/Chat/SourceChip/SourceC
44
44
  import type { ChatToolCall } from '../book-components/Chat/types/ChatMessage';
45
45
  import type { ChatProgressItem } from '../book-components/Chat/types/ChatMessage';
46
46
  import type { ChatProgressCard } from '../book-components/Chat/types/ChatMessage';
47
+ import type { ChatMessageSource } from '../book-components/Chat/types/ChatMessage';
47
48
  import type { ChatMessageReplyingTo } from '../book-components/Chat/types/ChatMessage';
48
49
  import type { ChatMessage } from '../book-components/Chat/types/ChatMessage';
49
50
  import type { ChatParticipant } from '../book-components/Chat/types/ChatParticipant';
@@ -477,6 +478,7 @@ export type { SourceChipProps };
477
478
  export type { ChatToolCall };
478
479
  export type { ChatProgressItem };
479
480
  export type { ChatProgressCard };
481
+ export type { ChatMessageSource };
480
482
  export type { ChatMessageReplyingTo };
481
483
  export type { ChatMessage };
482
484
  export type { ChatParticipant };
@@ -25,8 +25,6 @@ type TeamToolCallModalContentOptions = {
25
25
  /**
26
26
  * Renders TEAM conversation details, nested actions, and citations.
27
27
  *
28
- * @param options - TEAM modal rendering options.
29
- *
30
28
  * @private function of ChatToolCallModal
31
29
  */
32
30
  export declare function TeamToolCallModalContent(options: TeamToolCallModalContentOptions): ReactElement;
@@ -1,5 +1,11 @@
1
1
  import { type ReactElement } from 'react';
2
2
  import type { TODO_any } from '../../../utils/organization/TODO_any';
3
+ /**
4
+ * Translation overrides used by timeout detail rendering.
5
+ *
6
+ * @private function of ChatToolCallModal
7
+ */
8
+ type TimeoutToolCallTranslations = import('./ChatProps').ChatUiTranslations;
3
9
  /**
4
10
  * Rendering options for timeout tool calls.
5
11
  *
@@ -33,7 +39,7 @@ type RenderTimeoutToolCallDetailsOptions = {
33
39
  /**
34
40
  * Optional translation overrides.
35
41
  */
36
- chatUiTranslations?: import('./ChatProps').ChatUiTranslations;
42
+ chatUiTranslations?: TimeoutToolCallTranslations;
37
43
  };
38
44
  /**
39
45
  * Renders the timeout-specific tool call detail view.
@@ -32,7 +32,7 @@ export declare function useChatInputAreaComposer(props: UseChatInputAreaComposer
32
32
  messageContent: string;
33
33
  messageContentRef: import("react").RefObject<string>;
34
34
  applyMessageContent: (nextContent: string) => void;
35
- handleTextInputChange: (event: ChangeEvent<HTMLTextAreaElement>) => void;
35
+ handleTextInputChange: (event: ChangeEvent<HTMLTextAreaElement, Element>) => void;
36
36
  handleComposerKeyDown: (event: ReactKeyboardEvent<HTMLTextAreaElement>) => void;
37
37
  handleSend: () => Promise<void>;
38
38
  };
@@ -1,4 +1,4 @@
1
- import { type MutableRefObject } from 'react';
1
+ import { type Dispatch, type MutableRefObject, type SetStateAction } from 'react';
2
2
  import type { SpeechRecognitionErrorCode } from '../../../types/SpeechRecognition';
3
3
  import type { ChatProps } from './ChatProps';
4
4
  import { type DictationRefinementSettings } from './refineFinalDictationChunk';
@@ -38,7 +38,7 @@ export declare function useChatInputAreaDictation({ speechRecognition, speechRec
38
38
  dictationError: DictationError | null;
39
39
  dictationLastFinalChunk: string;
40
40
  dictationEditableChunk: string;
41
- setDictationEditableChunk: import("react").Dispatch<import("react").SetStateAction<string>>;
41
+ setDictationEditableChunk: Dispatch<SetStateAction<string>>;
42
42
  canBacktrack: boolean;
43
43
  dictationSettings: DictationRefinementSettings;
44
44
  handleDictationSettingChange: (settingName: keyof DictationRefinementSettings, checked: boolean) => void;
@@ -1,5 +1,8 @@
1
+ import { type UIEvent } from 'react';
1
2
  /**
2
- * Configuration for the auto-scroll behavior
3
+ * Configuration for the auto-scroll behavior.
4
+ *
5
+ * @public exported from `@promptbook/components`
3
6
  */
4
7
  export type ChatAutoScrollConfig = {
5
8
  /**
@@ -32,8 +35,8 @@ export type ChatAutoScrollConfig = {
32
35
  export declare function useChatAutoScroll(config?: ChatAutoScrollConfig): {
33
36
  isAutoScrolling: boolean;
34
37
  chatMessagesRef: (element: HTMLDivElement | null) => void;
35
- handleScroll: (event: React.UIEvent<HTMLDivElement>) => void;
36
- handleMessagesChange: (isStreaming?: boolean) => void;
38
+ handleScroll: (event: UIEvent<HTMLDivElement, globalThis.UIEvent>) => void;
39
+ handleMessagesChange: (isStreaming?: boolean | undefined) => void;
37
40
  scrollToBottom: () => void;
38
41
  enableAutoScroll: () => void;
39
42
  disableAutoScroll: () => void;
@@ -58,6 +58,36 @@ export type ChatProgressCard = {
58
58
  */
59
59
  readonly isVisible?: boolean;
60
60
  };
61
+ /**
62
+ * Source used by an assistant message.
63
+ *
64
+ * This is used for knowledge-search results and other RAG systems that can
65
+ * attach structured source metadata independently of inline citation markers.
66
+ *
67
+ * @public exported from `@promptbook/components`
68
+ */
69
+ export type ChatMessageSource = {
70
+ /**
71
+ * The unique identifier for the source citation (e.g., "0:0")
72
+ */
73
+ readonly id: string;
74
+ /**
75
+ * The source document name (e.g., "document.pdf")
76
+ */
77
+ readonly source: string;
78
+ /**
79
+ * Optional URL to the source document
80
+ */
81
+ readonly url?: string;
82
+ /**
83
+ * Optional preview/excerpt from the source
84
+ */
85
+ readonly excerpt?: string;
86
+ /**
87
+ * Optional retrieval score.
88
+ */
89
+ readonly score?: number;
90
+ };
61
91
  /**
62
92
  * Serialized reference to an earlier chat message quoted by a reply bubble.
63
93
  *
@@ -255,6 +285,10 @@ export type ChatMessage = Omit<Message<id>, 'direction' | 'recipients' | 'thread
255
285
  */
256
286
  excerpt?: string;
257
287
  }>;
288
+ /**
289
+ * Optional structured sources used to produce this message.
290
+ */
291
+ readonly sources?: ReadonlyArray<ChatMessageSource>;
258
292
  /**
259
293
  * Optional structured progress-card payload shown while a response is still in progress.
260
294
  */
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Relative path to the local agent source initialized by `ptbk agent init`.
3
+ *
4
+ * @private internal utility of `ptbk agent`
5
+ */
6
+ export declare const AGENT_BOOK_FILE_PATH = "agent.book";
7
+ /**
8
+ * Relative path to the message queue root initialized by `ptbk agent init`.
9
+ *
10
+ * @private internal utility of `ptbk agent`
11
+ */
12
+ export declare const AGENT_MESSAGES_DIRECTORY_PATH = "messages";
13
+ /**
14
+ * Relative path to queued user messages consumed by `ptbk agent tick`.
15
+ *
16
+ * @private internal utility of `ptbk agent`
17
+ */
18
+ export declare const AGENT_QUEUED_MESSAGES_DIRECTORY_PATH: string;
19
+ /**
20
+ * Relative path to answered messages written by `ptbk agent tick`.
21
+ *
22
+ * @private internal utility of `ptbk agent`
23
+ */
24
+ export declare const AGENT_FINISHED_MESSAGES_DIRECTORY_PATH: string;
25
+ /**
26
+ * Relative path to local knowledge files referenced by the default agent prompt.
27
+ *
28
+ * @private internal utility of `ptbk agent`
29
+ */
30
+ export declare const AGENT_KNOWLEDGE_DIRECTORY_PATH = "knowledge";
31
+ /**
32
+ * Relative path to local agent documentation initialized by `ptbk agent init`.
33
+ *
34
+ * @private internal utility of `ptbk agent`
35
+ */
36
+ export declare const AGENT_DOCS_DIRECTORY_PATH = "docs";
37
+ /**
38
+ * Relative path to the local Book language manual used by the coding runner prompt.
39
+ *
40
+ * @private internal utility of `ptbk agent`
41
+ */
42
+ export declare const AGENT_BOOK_LANGUAGE_MANUAL_FILE_PATH: string;
43
+ /**
44
+ * Returns the default local agent book content.
45
+ *
46
+ * @private internal utility of `ptbk agent`
47
+ */
48
+ export declare function getDefaultAgentBookContent(): string;
49
+ /**
50
+ * Returns the default local Book language manual content.
51
+ *
52
+ * @private internal utility of `ptbk agent`
53
+ */
54
+ export declare function getDefaultBookLanguageManualContent(): string;
@@ -0,0 +1,13 @@
1
+ import type { NormalizedPromptRunnerCliOptions, PromptRunnerCliOptions } from '../common/promptRunnerCliOptions';
2
+ /**
3
+ * Options passed from `ptbk agent` CLI commands to the message runner.
4
+ *
5
+ * @private internal utility of `ptbk agent`
6
+ */
7
+ export type AgentRunCliOptions = PromptRunnerCliOptions;
8
+ /**
9
+ * Converts Commander options into the `scripts/run-agent-messages` option shape.
10
+ *
11
+ * @private internal utility of `ptbk agent`
12
+ */
13
+ export declare function createAgentRunOptionsFromCliOptions(cliOptions: AgentRunCliOptions): NormalizedPromptRunnerCliOptions;
@@ -0,0 +1,10 @@
1
+ import type { Command as Program } from 'commander';
2
+ import type { $side_effect } from '../../../utils/organization/$side_effect';
3
+ /**
4
+ * Initializes `agent init` command for Promptbook CLI utilities.
5
+ *
6
+ * Note: `$` is used to indicate that this function is not a pure function - it registers a command in the CLI.
7
+ *
8
+ * @private internal function of `promptbookCli`
9
+ */
10
+ export declare function $initializeAgentInitCommand(program: Program): $side_effect;
@@ -0,0 +1,21 @@
1
+ import type { InitializationStatus } from '../coder/boilerplateTemplates';
2
+ /**
3
+ * Result summary returned after local agent configuration initialization.
4
+ *
5
+ * @private internal utility of `ptbk agent init`
6
+ */
7
+ export type AgentInitializationSummary = {
8
+ readonly messagesDirectoryStatus: InitializationStatus;
9
+ readonly queuedMessagesDirectoryStatus: InitializationStatus;
10
+ readonly finishedMessagesDirectoryStatus: InitializationStatus;
11
+ readonly knowledgeDirectoryStatus: InitializationStatus;
12
+ readonly docsDirectoryStatus: InitializationStatus;
13
+ readonly agentBookFileStatus: InitializationStatus;
14
+ readonly bookLanguageManualFileStatus: InitializationStatus;
15
+ };
16
+ /**
17
+ * Creates local agent queue, knowledge, and instruction files in the current project.
18
+ *
19
+ * @private internal utility of `ptbk agent init`
20
+ */
21
+ export declare function initializeAgentProjectConfiguration(projectPath: string): Promise<AgentInitializationSummary>;
@@ -0,0 +1,7 @@
1
+ import type { AgentInitializationSummary } from './initializeAgentProjectConfiguration';
2
+ /**
3
+ * Prints a readable summary of initialized local agent files.
4
+ *
5
+ * @private internal utility of `ptbk agent init`
6
+ */
7
+ export declare function printAgentInitializationSummary(summary: AgentInitializationSummary): void;
@@ -0,0 +1,10 @@
1
+ import type { Command as Program } from 'commander';
2
+ import type { $side_effect } from '../../../utils/organization/$side_effect';
3
+ /**
4
+ * Initializes `agent run` command for Promptbook CLI utilities.
5
+ *
6
+ * Note: `$` is used to indicate that this function is not a pure function - it registers a command in the CLI.
7
+ *
8
+ * @private internal function of `promptbookCli`
9
+ */
10
+ export declare function $initializeAgentRunCommand(program: Program): $side_effect;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,10 @@
1
+ import type { Command as Program } from 'commander';
2
+ import type { $side_effect } from '../../../utils/organization/$side_effect';
3
+ /**
4
+ * Initializes `agent tick` command for Promptbook CLI utilities.
5
+ *
6
+ * Note: `$` is used to indicate that this function is not a pure function - it registers a command in the CLI.
7
+ *
8
+ * @private internal function of `promptbookCli`
9
+ */
10
+ export declare function $initializeAgentTickCommand(program: Program): $side_effect;
@@ -0,0 +1,15 @@
1
+ import type { Command as Program } from 'commander';
2
+ import type { $side_effect } from '../../utils/organization/$side_effect';
3
+ /**
4
+ * Initializes `agent` command with subcommands for Promptbook CLI utilities.
5
+ *
6
+ * The agent command provides utilities for repository-backed message queues:
7
+ * - init: Initialize local agent queue and instruction files
8
+ * - tick: Answer one queued message and exit
9
+ * - run: Watch the queue and answer messages one by one
10
+ *
11
+ * Note: `$` is used to indicate that this function is not a pure function - it registers a command in the CLI.
12
+ *
13
+ * @private internal function of `promptbookCli`
14
+ */
15
+ export declare function $initializeAgentCommand(program: Program): $side_effect;
@@ -0,0 +1,86 @@
1
+ import { Command as Program } from 'commander';
2
+ import { type ThinkingLevel } from '../coder/ThinkingLevel';
3
+ /**
4
+ * Runner identifiers supported by Promptbook CLI agent orchestration commands.
5
+ *
6
+ * @private internal utility of `promptbookCli`
7
+ */
8
+ export declare const PROMPT_RUNNER_AGENT_NAMES: readonly ["openai-codex", "github-copilot", "cline", "claude-code", "opencode", "gemini"];
9
+ /**
10
+ * Runner identifier supported by Promptbook CLI agent orchestration commands.
11
+ *
12
+ * @private internal utility of `promptbookCli`
13
+ */
14
+ export type PromptRunnerAgentName = (typeof PROMPT_RUNNER_AGENT_NAMES)[number];
15
+ /**
16
+ * Commander option bag for shared runner flags.
17
+ *
18
+ * @private internal utility of `promptbookCli`
19
+ */
20
+ export type PromptRunnerCliOptions = {
21
+ readonly agent?: string;
22
+ readonly model?: string;
23
+ readonly ui: boolean;
24
+ readonly thinkingLevel?: ThinkingLevel;
25
+ readonly commit: boolean;
26
+ readonly ignoreGitChanges: boolean;
27
+ readonly allowCredits: boolean;
28
+ readonly normalizeLineEndings: boolean;
29
+ readonly autoPush: boolean;
30
+ readonly autoPull: boolean;
31
+ };
32
+ /**
33
+ * Normalized runner options used by runner-backed CLI commands.
34
+ *
35
+ * @private internal utility of `promptbookCli`
36
+ */
37
+ export type NormalizedPromptRunnerCliOptions = {
38
+ readonly agentName?: PromptRunnerAgentName;
39
+ readonly model?: string;
40
+ readonly noUi: boolean;
41
+ readonly thinkingLevel?: ThinkingLevel;
42
+ readonly noCommit: boolean;
43
+ readonly ignoreGitChanges: boolean;
44
+ readonly allowCredits: boolean;
45
+ readonly normalizeLineEndings: boolean;
46
+ readonly autoPush: boolean;
47
+ readonly autoPull: boolean;
48
+ };
49
+ /**
50
+ * Description block shared by runner-backed CLI commands.
51
+ *
52
+ * @private internal utility of `promptbookCli`
53
+ */
54
+ export declare const PROMPT_RUNNER_DESCRIPTION: string;
55
+ /**
56
+ * Commander description for the `--agent` option.
57
+ *
58
+ * @private internal utility of `promptbookCli`
59
+ */
60
+ export declare const PROMPT_RUNNER_AGENT_OPTION_DESCRIPTION = "Select runner: openai-codex, github-copilot, cline, claude-code, opencode, gemini (required for non-dry-run)";
61
+ /**
62
+ * Commander description for the `--model` option.
63
+ *
64
+ * @private internal utility of `promptbookCli`
65
+ */
66
+ export declare const PROMPT_RUNNER_MODEL_OPTION_DESCRIPTION: string;
67
+ /**
68
+ * Registers runner selection flags on a command.
69
+ *
70
+ * @private internal utility of `promptbookCli`
71
+ */
72
+ export declare function addPromptRunnerSelectionOptions(command: Program): void;
73
+ /**
74
+ * Registers shared runner execution flags on a command.
75
+ *
76
+ * @private internal utility of `promptbookCli`
77
+ */
78
+ export declare function addPromptRunnerExecutionOptions(command: Program): void;
79
+ /**
80
+ * Converts Commander runner flags into normalized runner options.
81
+ *
82
+ * @private internal utility of `promptbookCli`
83
+ */
84
+ export declare function normalizePromptRunnerCliOptions(cliOptions: PromptRunnerCliOptions, options: {
85
+ readonly isAgentRequired: boolean;
86
+ }): NormalizedPromptRunnerCliOptions;
@@ -1,5 +1,12 @@
1
+ import type { string_javascript_name } from '../../_packages/types.index';
1
2
  import type { AgentModelRequirements } from '../../book-2.0/agent-source/AgentModelRequirements';
2
3
  import { BaseCommitmentDefinition } from '../_base/BaseCommitmentDefinition';
4
+ /**
5
+ * Name of the tool used by agents to search configured `KNOWLEDGE` sources.
6
+ *
7
+ * @public exported from `@promptbook/core`
8
+ */
9
+ export declare const KNOWLEDGE_SEARCH_TOOL_NAME: string;
3
10
  /**
4
11
  * KNOWLEDGE commitment definition
5
12
  *
@@ -37,4 +44,8 @@ export declare class KnowledgeCommitmentDefinition extends BaseCommitmentDefinit
37
44
  */
38
45
  get documentation(): string;
39
46
  applyToAgentModelRequirements(requirements: AgentModelRequirements, content: string): AgentModelRequirements;
47
+ /**
48
+ * Gets human-readable titles for tool functions provided by this commitment.
49
+ */
50
+ getToolTitles(): Record<string_javascript_name, string>;
40
51
  }
@@ -0,0 +1 @@
1
+ export {};
@@ -98,6 +98,12 @@ export type ToolRuntimeContext = {
98
98
  localServerUrl?: string;
99
99
  teamInternalAccessToken?: string;
100
100
  };
101
+ knowledge?: {
102
+ /**
103
+ * Final materialized knowledge sources available to the current agent.
104
+ */
105
+ sources?: string[];
106
+ };
101
107
  spawn?: {
102
108
  depth?: number;
103
109
  parentRunId?: string;
@@ -50,6 +50,7 @@ import { UseSpawnCommitmentDefinition } from './USE_SPAWN/USE_SPAWN';
50
50
  import { UseTimeoutCommitmentDefinition } from './USE_TIMEOUT/USE_TIMEOUT';
51
51
  import { UseTimeCommitmentDefinition } from './USE_TIME/USE_TIME';
52
52
  import { UseUserLocationCommitmentDefinition } from './USE_USER_LOCATION/USE_USER_LOCATION';
53
+ import { WalletCommitmentDefinition } from './WALLET/WALLET';
53
54
  import { WritingRulesCommitmentDefinition } from './WRITING_RULES/WRITING_RULES';
54
55
  import { WritingSampleCommitmentDefinition } from './WRITING_SAMPLE/WRITING_SAMPLE';
55
56
  import { NotYetImplementedCommitmentDefinition } from './_base/NotYetImplementedCommitmentDefinition';
@@ -60,4 +61,4 @@ import { NotYetImplementedCommitmentDefinition } from './_base/NotYetImplemented
60
61
  *
61
62
  * @private Use functions to access commitments instead of this array directly
62
63
  */
63
- export declare const COMMITMENT_REGISTRY: readonly [PersonaCommitmentDefinition, PersonaCommitmentDefinition, KnowledgeCommitmentDefinition, MemoryCommitmentDefinition, MemoryCommitmentDefinition, StyleCommitmentDefinition, StyleCommitmentDefinition, RuleCommitmentDefinition, RuleCommitmentDefinition, LanguageCommitmentDefinition, LanguageCommitmentDefinition, WritingSampleCommitmentDefinition, WritingRulesCommitmentDefinition, SampleCommitmentDefinition, SampleCommitmentDefinition, FormatCommitmentDefinition, FormatCommitmentDefinition, TemplateCommitmentDefinition, TemplateCommitmentDefinition, FromCommitmentDefinition, ImportCommitmentDefinition, ImportCommitmentDefinition, ModelCommitmentDefinition, ModelCommitmentDefinition, ActionCommitmentDefinition, ActionCommitmentDefinition, ComponentCommitmentDefinition, MetaAvatarCommitmentDefinition, MetaImageCommitmentDefinition, MetaColorCommitmentDefinition, MetaFontCommitmentDefinition, MetaLinkCommitmentDefinition, MetaDomainCommitmentDefinition, MetaDisclaimerCommitmentDefinition, MetaInputPlaceholderCommitmentDefinition, MetaCommitmentDefinition, MetaVoiceCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, GoalCommitmentDefinition, GoalCommitmentDefinition, InitialMessageCommitmentDefinition, UserMessageCommitmentDefinition, InternalMessageCommitmentDefinition, AgentMessageCommitmentDefinition, MessageSuffixCommitmentDefinition, MessageCommitmentDefinition, MessageCommitmentDefinition, ScenarioCommitmentDefinition, ScenarioCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, DictionaryCommitmentDefinition, OpenCommitmentDefinition, ClosedCommitmentDefinition, TeamCommitmentDefinition, UseBrowserCommitmentDefinition, UseDeepSearchCommitmentDefinition, UseSearchEngineCommitmentDefinition, UseSpawnCommitmentDefinition, UseTimeoutCommitmentDefinition, UseTimeCommitmentDefinition, UseUserLocationCommitmentDefinition, UseCalendarCommitmentDefinition, UseEmailCommitmentDefinition, UsePopupCommitmentDefinition, UseImageGeneratorCommitmentDefinition, UseMcpCommitmentDefinition, UsePrivacyCommitmentDefinition, UseProjectCommitmentDefinition, NotYetImplementedCommitmentDefinition<"EXPECT">, NotYetImplementedCommitmentDefinition<"BEHAVIOUR">, NotYetImplementedCommitmentDefinition<"BEHAVIOURS">, NotYetImplementedCommitmentDefinition<"AVOID">, NotYetImplementedCommitmentDefinition<"AVOIDANCE">, NotYetImplementedCommitmentDefinition<"CONTEXT">];
64
+ export declare const COMMITMENT_REGISTRY: readonly [PersonaCommitmentDefinition, PersonaCommitmentDefinition, KnowledgeCommitmentDefinition, MemoryCommitmentDefinition, MemoryCommitmentDefinition, StyleCommitmentDefinition, StyleCommitmentDefinition, RuleCommitmentDefinition, RuleCommitmentDefinition, LanguageCommitmentDefinition, LanguageCommitmentDefinition, WritingSampleCommitmentDefinition, WritingRulesCommitmentDefinition, SampleCommitmentDefinition, SampleCommitmentDefinition, FormatCommitmentDefinition, FormatCommitmentDefinition, TemplateCommitmentDefinition, TemplateCommitmentDefinition, FromCommitmentDefinition, ImportCommitmentDefinition, ImportCommitmentDefinition, ModelCommitmentDefinition, ModelCommitmentDefinition, ActionCommitmentDefinition, ActionCommitmentDefinition, ComponentCommitmentDefinition, MetaAvatarCommitmentDefinition, MetaImageCommitmentDefinition, MetaColorCommitmentDefinition, MetaFontCommitmentDefinition, MetaLinkCommitmentDefinition, MetaDomainCommitmentDefinition, MetaDisclaimerCommitmentDefinition, MetaInputPlaceholderCommitmentDefinition, MetaCommitmentDefinition, MetaVoiceCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, GoalCommitmentDefinition, GoalCommitmentDefinition, InitialMessageCommitmentDefinition, UserMessageCommitmentDefinition, InternalMessageCommitmentDefinition, AgentMessageCommitmentDefinition, MessageSuffixCommitmentDefinition, MessageCommitmentDefinition, MessageCommitmentDefinition, WalletCommitmentDefinition, WalletCommitmentDefinition, ScenarioCommitmentDefinition, ScenarioCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, DictionaryCommitmentDefinition, OpenCommitmentDefinition, ClosedCommitmentDefinition, TeamCommitmentDefinition, UseBrowserCommitmentDefinition, UseDeepSearchCommitmentDefinition, UseSearchEngineCommitmentDefinition, UseSpawnCommitmentDefinition, UseTimeoutCommitmentDefinition, UseTimeCommitmentDefinition, UseUserLocationCommitmentDefinition, UseCalendarCommitmentDefinition, UseEmailCommitmentDefinition, UsePopupCommitmentDefinition, UseImageGeneratorCommitmentDefinition, UseMcpCommitmentDefinition, UsePrivacyCommitmentDefinition, UseProjectCommitmentDefinition, NotYetImplementedCommitmentDefinition<"EXPECT">, NotYetImplementedCommitmentDefinition<"BEHAVIOUR">, NotYetImplementedCommitmentDefinition<"BEHAVIOURS">, NotYetImplementedCommitmentDefinition<"AVOID">, NotYetImplementedCommitmentDefinition<"AVOIDANCE">, NotYetImplementedCommitmentDefinition<"CONTEXT">];
@@ -1,4 +1,3 @@
1
- import type { Tool as AgentKitTool } from '@openai/agents';
2
1
  import { Agent as AgentFromKit } from '@openai/agents';
3
2
  import OpenAI from 'openai';
4
3
  import { TODO_any } from '../../_packages/types.index';
@@ -110,7 +109,6 @@ export declare class OpenAiAgentKitExecutionTools extends OpenAiVectorStoreHandl
110
109
  readonly instructions: string_markdown;
111
110
  readonly knowledgeSources?: ReadonlyArray<string>;
112
111
  readonly tools?: ModelRequirements['tools'];
113
- readonly nativeAgentKitTools?: ReadonlyArray<AgentKitTool>;
114
112
  readonly vectorStoreId?: string;
115
113
  readonly storeAsPrepared?: boolean;
116
114
  }): Promise<OpenAiAgentKitPreparedAgent>;
@@ -180,6 +178,10 @@ export declare class OpenAiAgentKitExecutionTools extends OpenAiVectorStoreHandl
180
178
  * Returns AgentKit-specific options.
181
179
  */
182
180
  private get agentKitOptions();
181
+ /**
182
+ * Returns true when hosted OpenAI vector-store search should back `knowledgeSources`.
183
+ */
184
+ private get isNativeKnowledgeSearchEnabled();
183
185
  /**
184
186
  * Discriminant for type guards.
185
187
  */
@@ -12,4 +12,13 @@ export type OpenAiAgentKitExecutionToolsOptions = OpenAiVectorStoreHandlerOption
12
12
  * @default gpt-5.2
13
13
  */
14
14
  readonly agentKitModelName?: string_model_name;
15
+ /**
16
+ * Enables OpenAI hosted vector-store file search for `knowledgeSources`.
17
+ *
18
+ * Agents Server sets this to `false` because it uses a DB-backed LlamaIndex
19
+ * implementation exposed through the `knowledge_search` tool instead.
20
+ *
21
+ * @default true
22
+ */
23
+ readonly isNativeKnowledgeSearchEnabled?: boolean;
15
24
  };
@@ -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.112.0-61`).
18
+ * It follows semantic versioning (e.g., `0.112.0-63`).
19
19
  *
20
20
  * @generated
21
21
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promptbook/utils",
3
- "version": "0.112.0-62",
3
+ "version": "0.112.0-64",
4
4
  "description": "Promptbook: Create persistent AI agents that turn your company's scattered knowledge into action",
5
5
  "private": false,
6
6
  "sideEffects": false,
package/umd/index.umd.js CHANGED
@@ -22,7 +22,7 @@
22
22
  * @generated
23
23
  * @see https://github.com/webgptorg/promptbook
24
24
  */
25
- const PROMPTBOOK_ENGINE_VERSION = '0.112.0-62';
25
+ const PROMPTBOOK_ENGINE_VERSION = '0.112.0-64';
26
26
  /**
27
27
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
28
28
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -34,6 +34,7 @@ import type { ChatEffect } from '../book-components/Chat/effects/types/ChatEffec
34
34
  import type { ChatEffectConfig } from '../book-components/Chat/effects/types/ChatEffectConfig';
35
35
  import type { ChatEffectsSystemProps } from '../book-components/Chat/effects/types/ChatEffectsSystemProps';
36
36
  import type { ChatEffectType } from '../book-components/Chat/effects/types/ChatEffectType';
37
+ import type { ChatAutoScrollConfig } from '../book-components/Chat/hooks/useChatAutoScroll';
37
38
  import { useChatAutoScroll } from '../book-components/Chat/hooks/useChatAutoScroll';
38
39
  import type { SendMessageToLlmChatFunction } from '../book-components/Chat/hooks/useSendMessageToLlmChat';
39
40
  import { useSendMessageToLlmChat } from '../book-components/Chat/hooks/useSendMessageToLlmChat';
@@ -61,6 +62,7 @@ import { reactSaveFormatDefinition } from '../book-components/Chat/save/react/re
61
62
  import { txtSaveFormatDefinition } from '../book-components/Chat/save/text/txtSaveFormatDefinition';
62
63
  import type { ChatProgressItem } from '../book-components/Chat/types/ChatMessage';
63
64
  import type { ChatProgressCard } from '../book-components/Chat/types/ChatMessage';
65
+ import type { ChatMessageSource } from '../book-components/Chat/types/ChatMessage';
64
66
  import type { ChatMessageReplyingTo } from '../book-components/Chat/types/ChatMessage';
65
67
  import type { ChatMessage } from '../book-components/Chat/types/ChatMessage';
66
68
  import type { ChatParticipant } from '../book-components/Chat/types/ChatParticipant';
@@ -116,6 +118,7 @@ export type { ChatEffect };
116
118
  export type { ChatEffectConfig };
117
119
  export type { ChatEffectsSystemProps };
118
120
  export type { ChatEffectType };
121
+ export type { ChatAutoScrollConfig };
119
122
  export { useChatAutoScroll };
120
123
  export type { SendMessageToLlmChatFunction };
121
124
  export { useSendMessageToLlmChat };
@@ -143,6 +146,7 @@ export { reactSaveFormatDefinition };
143
146
  export { txtSaveFormatDefinition };
144
147
  export type { ChatProgressItem };
145
148
  export type { ChatProgressCard };
149
+ export type { ChatMessageSource };
146
150
  export type { ChatMessageReplyingTo };
147
151
  export type { ChatMessage };
148
152
  export type { ChatParticipant };
@@ -28,6 +28,7 @@ import { getAllCommitmentTypes } from '../commitments/_common/getAllCommitmentTy
28
28
  import { getCommitmentDefinition } from '../commitments/_common/getCommitmentDefinition';
29
29
  import { getGroupedCommitmentDefinitions } from '../commitments/_common/getGroupedCommitmentDefinitions';
30
30
  import { isCommitmentSupported } from '../commitments/_common/isCommitmentSupported';
31
+ import { KNOWLEDGE_SEARCH_TOOL_NAME } from '../commitments/KNOWLEDGE/KNOWLEDGE';
31
32
  import { NAME } from '../config';
32
33
  import { ADMIN_EMAIL } from '../config';
33
34
  import { PROMPTBOOK_LEGAL_ENTITY } from '../config';
@@ -252,6 +253,7 @@ export { getAllCommitmentTypes };
252
253
  export { getCommitmentDefinition };
253
254
  export { getGroupedCommitmentDefinitions };
254
255
  export { isCommitmentSupported };
256
+ export { KNOWLEDGE_SEARCH_TOOL_NAME };
255
257
  export { NAME };
256
258
  export { ADMIN_EMAIL };
257
259
  export { PROMPTBOOK_LEGAL_ENTITY };
@@ -44,6 +44,7 @@ import type { SourceChipProps } from '../book-components/Chat/SourceChip/SourceC
44
44
  import type { ChatToolCall } from '../book-components/Chat/types/ChatMessage';
45
45
  import type { ChatProgressItem } from '../book-components/Chat/types/ChatMessage';
46
46
  import type { ChatProgressCard } from '../book-components/Chat/types/ChatMessage';
47
+ import type { ChatMessageSource } from '../book-components/Chat/types/ChatMessage';
47
48
  import type { ChatMessageReplyingTo } from '../book-components/Chat/types/ChatMessage';
48
49
  import type { ChatMessage } from '../book-components/Chat/types/ChatMessage';
49
50
  import type { ChatParticipant } from '../book-components/Chat/types/ChatParticipant';
@@ -477,6 +478,7 @@ export type { SourceChipProps };
477
478
  export type { ChatToolCall };
478
479
  export type { ChatProgressItem };
479
480
  export type { ChatProgressCard };
481
+ export type { ChatMessageSource };
480
482
  export type { ChatMessageReplyingTo };
481
483
  export type { ChatMessage };
482
484
  export type { ChatParticipant };
@@ -25,8 +25,6 @@ type TeamToolCallModalContentOptions = {
25
25
  /**
26
26
  * Renders TEAM conversation details, nested actions, and citations.
27
27
  *
28
- * @param options - TEAM modal rendering options.
29
- *
30
28
  * @private function of ChatToolCallModal
31
29
  */
32
30
  export declare function TeamToolCallModalContent(options: TeamToolCallModalContentOptions): ReactElement;
@@ -1,5 +1,11 @@
1
1
  import { type ReactElement } from 'react';
2
2
  import type { TODO_any } from '../../../utils/organization/TODO_any';
3
+ /**
4
+ * Translation overrides used by timeout detail rendering.
5
+ *
6
+ * @private function of ChatToolCallModal
7
+ */
8
+ type TimeoutToolCallTranslations = import('./ChatProps').ChatUiTranslations;
3
9
  /**
4
10
  * Rendering options for timeout tool calls.
5
11
  *
@@ -33,7 +39,7 @@ type RenderTimeoutToolCallDetailsOptions = {
33
39
  /**
34
40
  * Optional translation overrides.
35
41
  */
36
- chatUiTranslations?: import('./ChatProps').ChatUiTranslations;
42
+ chatUiTranslations?: TimeoutToolCallTranslations;
37
43
  };
38
44
  /**
39
45
  * Renders the timeout-specific tool call detail view.
@@ -32,7 +32,7 @@ export declare function useChatInputAreaComposer(props: UseChatInputAreaComposer
32
32
  messageContent: string;
33
33
  messageContentRef: import("react").RefObject<string>;
34
34
  applyMessageContent: (nextContent: string) => void;
35
- handleTextInputChange: (event: ChangeEvent<HTMLTextAreaElement>) => void;
35
+ handleTextInputChange: (event: ChangeEvent<HTMLTextAreaElement, Element>) => void;
36
36
  handleComposerKeyDown: (event: ReactKeyboardEvent<HTMLTextAreaElement>) => void;
37
37
  handleSend: () => Promise<void>;
38
38
  };
@@ -1,4 +1,4 @@
1
- import { type MutableRefObject } from 'react';
1
+ import { type Dispatch, type MutableRefObject, type SetStateAction } from 'react';
2
2
  import type { SpeechRecognitionErrorCode } from '../../../types/SpeechRecognition';
3
3
  import type { ChatProps } from './ChatProps';
4
4
  import { type DictationRefinementSettings } from './refineFinalDictationChunk';
@@ -38,7 +38,7 @@ export declare function useChatInputAreaDictation({ speechRecognition, speechRec
38
38
  dictationError: DictationError | null;
39
39
  dictationLastFinalChunk: string;
40
40
  dictationEditableChunk: string;
41
- setDictationEditableChunk: import("react").Dispatch<import("react").SetStateAction<string>>;
41
+ setDictationEditableChunk: Dispatch<SetStateAction<string>>;
42
42
  canBacktrack: boolean;
43
43
  dictationSettings: DictationRefinementSettings;
44
44
  handleDictationSettingChange: (settingName: keyof DictationRefinementSettings, checked: boolean) => void;
@@ -1,5 +1,8 @@
1
+ import { type UIEvent } from 'react';
1
2
  /**
2
- * Configuration for the auto-scroll behavior
3
+ * Configuration for the auto-scroll behavior.
4
+ *
5
+ * @public exported from `@promptbook/components`
3
6
  */
4
7
  export type ChatAutoScrollConfig = {
5
8
  /**
@@ -32,8 +35,8 @@ export type ChatAutoScrollConfig = {
32
35
  export declare function useChatAutoScroll(config?: ChatAutoScrollConfig): {
33
36
  isAutoScrolling: boolean;
34
37
  chatMessagesRef: (element: HTMLDivElement | null) => void;
35
- handleScroll: (event: React.UIEvent<HTMLDivElement>) => void;
36
- handleMessagesChange: (isStreaming?: boolean) => void;
38
+ handleScroll: (event: UIEvent<HTMLDivElement, globalThis.UIEvent>) => void;
39
+ handleMessagesChange: (isStreaming?: boolean | undefined) => void;
37
40
  scrollToBottom: () => void;
38
41
  enableAutoScroll: () => void;
39
42
  disableAutoScroll: () => void;
@@ -58,6 +58,36 @@ export type ChatProgressCard = {
58
58
  */
59
59
  readonly isVisible?: boolean;
60
60
  };
61
+ /**
62
+ * Source used by an assistant message.
63
+ *
64
+ * This is used for knowledge-search results and other RAG systems that can
65
+ * attach structured source metadata independently of inline citation markers.
66
+ *
67
+ * @public exported from `@promptbook/components`
68
+ */
69
+ export type ChatMessageSource = {
70
+ /**
71
+ * The unique identifier for the source citation (e.g., "0:0")
72
+ */
73
+ readonly id: string;
74
+ /**
75
+ * The source document name (e.g., "document.pdf")
76
+ */
77
+ readonly source: string;
78
+ /**
79
+ * Optional URL to the source document
80
+ */
81
+ readonly url?: string;
82
+ /**
83
+ * Optional preview/excerpt from the source
84
+ */
85
+ readonly excerpt?: string;
86
+ /**
87
+ * Optional retrieval score.
88
+ */
89
+ readonly score?: number;
90
+ };
61
91
  /**
62
92
  * Serialized reference to an earlier chat message quoted by a reply bubble.
63
93
  *
@@ -255,6 +285,10 @@ export type ChatMessage = Omit<Message<id>, 'direction' | 'recipients' | 'thread
255
285
  */
256
286
  excerpt?: string;
257
287
  }>;
288
+ /**
289
+ * Optional structured sources used to produce this message.
290
+ */
291
+ readonly sources?: ReadonlyArray<ChatMessageSource>;
258
292
  /**
259
293
  * Optional structured progress-card payload shown while a response is still in progress.
260
294
  */
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Relative path to the local agent source initialized by `ptbk agent init`.
3
+ *
4
+ * @private internal utility of `ptbk agent`
5
+ */
6
+ export declare const AGENT_BOOK_FILE_PATH = "agent.book";
7
+ /**
8
+ * Relative path to the message queue root initialized by `ptbk agent init`.
9
+ *
10
+ * @private internal utility of `ptbk agent`
11
+ */
12
+ export declare const AGENT_MESSAGES_DIRECTORY_PATH = "messages";
13
+ /**
14
+ * Relative path to queued user messages consumed by `ptbk agent tick`.
15
+ *
16
+ * @private internal utility of `ptbk agent`
17
+ */
18
+ export declare const AGENT_QUEUED_MESSAGES_DIRECTORY_PATH: string;
19
+ /**
20
+ * Relative path to answered messages written by `ptbk agent tick`.
21
+ *
22
+ * @private internal utility of `ptbk agent`
23
+ */
24
+ export declare const AGENT_FINISHED_MESSAGES_DIRECTORY_PATH: string;
25
+ /**
26
+ * Relative path to local knowledge files referenced by the default agent prompt.
27
+ *
28
+ * @private internal utility of `ptbk agent`
29
+ */
30
+ export declare const AGENT_KNOWLEDGE_DIRECTORY_PATH = "knowledge";
31
+ /**
32
+ * Relative path to local agent documentation initialized by `ptbk agent init`.
33
+ *
34
+ * @private internal utility of `ptbk agent`
35
+ */
36
+ export declare const AGENT_DOCS_DIRECTORY_PATH = "docs";
37
+ /**
38
+ * Relative path to the local Book language manual used by the coding runner prompt.
39
+ *
40
+ * @private internal utility of `ptbk agent`
41
+ */
42
+ export declare const AGENT_BOOK_LANGUAGE_MANUAL_FILE_PATH: string;
43
+ /**
44
+ * Returns the default local agent book content.
45
+ *
46
+ * @private internal utility of `ptbk agent`
47
+ */
48
+ export declare function getDefaultAgentBookContent(): string;
49
+ /**
50
+ * Returns the default local Book language manual content.
51
+ *
52
+ * @private internal utility of `ptbk agent`
53
+ */
54
+ export declare function getDefaultBookLanguageManualContent(): string;
@@ -0,0 +1,13 @@
1
+ import type { NormalizedPromptRunnerCliOptions, PromptRunnerCliOptions } from '../common/promptRunnerCliOptions';
2
+ /**
3
+ * Options passed from `ptbk agent` CLI commands to the message runner.
4
+ *
5
+ * @private internal utility of `ptbk agent`
6
+ */
7
+ export type AgentRunCliOptions = PromptRunnerCliOptions;
8
+ /**
9
+ * Converts Commander options into the `scripts/run-agent-messages` option shape.
10
+ *
11
+ * @private internal utility of `ptbk agent`
12
+ */
13
+ export declare function createAgentRunOptionsFromCliOptions(cliOptions: AgentRunCliOptions): NormalizedPromptRunnerCliOptions;
@@ -0,0 +1,10 @@
1
+ import type { Command as Program } from 'commander';
2
+ import type { $side_effect } from '../../../utils/organization/$side_effect';
3
+ /**
4
+ * Initializes `agent init` command for Promptbook CLI utilities.
5
+ *
6
+ * Note: `$` is used to indicate that this function is not a pure function - it registers a command in the CLI.
7
+ *
8
+ * @private internal function of `promptbookCli`
9
+ */
10
+ export declare function $initializeAgentInitCommand(program: Program): $side_effect;
@@ -0,0 +1,21 @@
1
+ import type { InitializationStatus } from '../coder/boilerplateTemplates';
2
+ /**
3
+ * Result summary returned after local agent configuration initialization.
4
+ *
5
+ * @private internal utility of `ptbk agent init`
6
+ */
7
+ export type AgentInitializationSummary = {
8
+ readonly messagesDirectoryStatus: InitializationStatus;
9
+ readonly queuedMessagesDirectoryStatus: InitializationStatus;
10
+ readonly finishedMessagesDirectoryStatus: InitializationStatus;
11
+ readonly knowledgeDirectoryStatus: InitializationStatus;
12
+ readonly docsDirectoryStatus: InitializationStatus;
13
+ readonly agentBookFileStatus: InitializationStatus;
14
+ readonly bookLanguageManualFileStatus: InitializationStatus;
15
+ };
16
+ /**
17
+ * Creates local agent queue, knowledge, and instruction files in the current project.
18
+ *
19
+ * @private internal utility of `ptbk agent init`
20
+ */
21
+ export declare function initializeAgentProjectConfiguration(projectPath: string): Promise<AgentInitializationSummary>;
@@ -0,0 +1,7 @@
1
+ import type { AgentInitializationSummary } from './initializeAgentProjectConfiguration';
2
+ /**
3
+ * Prints a readable summary of initialized local agent files.
4
+ *
5
+ * @private internal utility of `ptbk agent init`
6
+ */
7
+ export declare function printAgentInitializationSummary(summary: AgentInitializationSummary): void;
@@ -0,0 +1,10 @@
1
+ import type { Command as Program } from 'commander';
2
+ import type { $side_effect } from '../../../utils/organization/$side_effect';
3
+ /**
4
+ * Initializes `agent run` command for Promptbook CLI utilities.
5
+ *
6
+ * Note: `$` is used to indicate that this function is not a pure function - it registers a command in the CLI.
7
+ *
8
+ * @private internal function of `promptbookCli`
9
+ */
10
+ export declare function $initializeAgentRunCommand(program: Program): $side_effect;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,10 @@
1
+ import type { Command as Program } from 'commander';
2
+ import type { $side_effect } from '../../../utils/organization/$side_effect';
3
+ /**
4
+ * Initializes `agent tick` command for Promptbook CLI utilities.
5
+ *
6
+ * Note: `$` is used to indicate that this function is not a pure function - it registers a command in the CLI.
7
+ *
8
+ * @private internal function of `promptbookCli`
9
+ */
10
+ export declare function $initializeAgentTickCommand(program: Program): $side_effect;
@@ -0,0 +1,15 @@
1
+ import type { Command as Program } from 'commander';
2
+ import type { $side_effect } from '../../utils/organization/$side_effect';
3
+ /**
4
+ * Initializes `agent` command with subcommands for Promptbook CLI utilities.
5
+ *
6
+ * The agent command provides utilities for repository-backed message queues:
7
+ * - init: Initialize local agent queue and instruction files
8
+ * - tick: Answer one queued message and exit
9
+ * - run: Watch the queue and answer messages one by one
10
+ *
11
+ * Note: `$` is used to indicate that this function is not a pure function - it registers a command in the CLI.
12
+ *
13
+ * @private internal function of `promptbookCli`
14
+ */
15
+ export declare function $initializeAgentCommand(program: Program): $side_effect;
@@ -0,0 +1,86 @@
1
+ import { Command as Program } from 'commander';
2
+ import { type ThinkingLevel } from '../coder/ThinkingLevel';
3
+ /**
4
+ * Runner identifiers supported by Promptbook CLI agent orchestration commands.
5
+ *
6
+ * @private internal utility of `promptbookCli`
7
+ */
8
+ export declare const PROMPT_RUNNER_AGENT_NAMES: readonly ["openai-codex", "github-copilot", "cline", "claude-code", "opencode", "gemini"];
9
+ /**
10
+ * Runner identifier supported by Promptbook CLI agent orchestration commands.
11
+ *
12
+ * @private internal utility of `promptbookCli`
13
+ */
14
+ export type PromptRunnerAgentName = (typeof PROMPT_RUNNER_AGENT_NAMES)[number];
15
+ /**
16
+ * Commander option bag for shared runner flags.
17
+ *
18
+ * @private internal utility of `promptbookCli`
19
+ */
20
+ export type PromptRunnerCliOptions = {
21
+ readonly agent?: string;
22
+ readonly model?: string;
23
+ readonly ui: boolean;
24
+ readonly thinkingLevel?: ThinkingLevel;
25
+ readonly commit: boolean;
26
+ readonly ignoreGitChanges: boolean;
27
+ readonly allowCredits: boolean;
28
+ readonly normalizeLineEndings: boolean;
29
+ readonly autoPush: boolean;
30
+ readonly autoPull: boolean;
31
+ };
32
+ /**
33
+ * Normalized runner options used by runner-backed CLI commands.
34
+ *
35
+ * @private internal utility of `promptbookCli`
36
+ */
37
+ export type NormalizedPromptRunnerCliOptions = {
38
+ readonly agentName?: PromptRunnerAgentName;
39
+ readonly model?: string;
40
+ readonly noUi: boolean;
41
+ readonly thinkingLevel?: ThinkingLevel;
42
+ readonly noCommit: boolean;
43
+ readonly ignoreGitChanges: boolean;
44
+ readonly allowCredits: boolean;
45
+ readonly normalizeLineEndings: boolean;
46
+ readonly autoPush: boolean;
47
+ readonly autoPull: boolean;
48
+ };
49
+ /**
50
+ * Description block shared by runner-backed CLI commands.
51
+ *
52
+ * @private internal utility of `promptbookCli`
53
+ */
54
+ export declare const PROMPT_RUNNER_DESCRIPTION: string;
55
+ /**
56
+ * Commander description for the `--agent` option.
57
+ *
58
+ * @private internal utility of `promptbookCli`
59
+ */
60
+ export declare const PROMPT_RUNNER_AGENT_OPTION_DESCRIPTION = "Select runner: openai-codex, github-copilot, cline, claude-code, opencode, gemini (required for non-dry-run)";
61
+ /**
62
+ * Commander description for the `--model` option.
63
+ *
64
+ * @private internal utility of `promptbookCli`
65
+ */
66
+ export declare const PROMPT_RUNNER_MODEL_OPTION_DESCRIPTION: string;
67
+ /**
68
+ * Registers runner selection flags on a command.
69
+ *
70
+ * @private internal utility of `promptbookCli`
71
+ */
72
+ export declare function addPromptRunnerSelectionOptions(command: Program): void;
73
+ /**
74
+ * Registers shared runner execution flags on a command.
75
+ *
76
+ * @private internal utility of `promptbookCli`
77
+ */
78
+ export declare function addPromptRunnerExecutionOptions(command: Program): void;
79
+ /**
80
+ * Converts Commander runner flags into normalized runner options.
81
+ *
82
+ * @private internal utility of `promptbookCli`
83
+ */
84
+ export declare function normalizePromptRunnerCliOptions(cliOptions: PromptRunnerCliOptions, options: {
85
+ readonly isAgentRequired: boolean;
86
+ }): NormalizedPromptRunnerCliOptions;
@@ -1,5 +1,12 @@
1
+ import type { string_javascript_name } from '../../_packages/types.index';
1
2
  import type { AgentModelRequirements } from '../../book-2.0/agent-source/AgentModelRequirements';
2
3
  import { BaseCommitmentDefinition } from '../_base/BaseCommitmentDefinition';
4
+ /**
5
+ * Name of the tool used by agents to search configured `KNOWLEDGE` sources.
6
+ *
7
+ * @public exported from `@promptbook/core`
8
+ */
9
+ export declare const KNOWLEDGE_SEARCH_TOOL_NAME: string;
3
10
  /**
4
11
  * KNOWLEDGE commitment definition
5
12
  *
@@ -37,4 +44,8 @@ export declare class KnowledgeCommitmentDefinition extends BaseCommitmentDefinit
37
44
  */
38
45
  get documentation(): string;
39
46
  applyToAgentModelRequirements(requirements: AgentModelRequirements, content: string): AgentModelRequirements;
47
+ /**
48
+ * Gets human-readable titles for tool functions provided by this commitment.
49
+ */
50
+ getToolTitles(): Record<string_javascript_name, string>;
40
51
  }
@@ -0,0 +1 @@
1
+ export {};
@@ -98,6 +98,12 @@ export type ToolRuntimeContext = {
98
98
  localServerUrl?: string;
99
99
  teamInternalAccessToken?: string;
100
100
  };
101
+ knowledge?: {
102
+ /**
103
+ * Final materialized knowledge sources available to the current agent.
104
+ */
105
+ sources?: string[];
106
+ };
101
107
  spawn?: {
102
108
  depth?: number;
103
109
  parentRunId?: string;
@@ -50,6 +50,7 @@ import { UseSpawnCommitmentDefinition } from './USE_SPAWN/USE_SPAWN';
50
50
  import { UseTimeoutCommitmentDefinition } from './USE_TIMEOUT/USE_TIMEOUT';
51
51
  import { UseTimeCommitmentDefinition } from './USE_TIME/USE_TIME';
52
52
  import { UseUserLocationCommitmentDefinition } from './USE_USER_LOCATION/USE_USER_LOCATION';
53
+ import { WalletCommitmentDefinition } from './WALLET/WALLET';
53
54
  import { WritingRulesCommitmentDefinition } from './WRITING_RULES/WRITING_RULES';
54
55
  import { WritingSampleCommitmentDefinition } from './WRITING_SAMPLE/WRITING_SAMPLE';
55
56
  import { NotYetImplementedCommitmentDefinition } from './_base/NotYetImplementedCommitmentDefinition';
@@ -60,4 +61,4 @@ import { NotYetImplementedCommitmentDefinition } from './_base/NotYetImplemented
60
61
  *
61
62
  * @private Use functions to access commitments instead of this array directly
62
63
  */
63
- export declare const COMMITMENT_REGISTRY: readonly [PersonaCommitmentDefinition, PersonaCommitmentDefinition, KnowledgeCommitmentDefinition, MemoryCommitmentDefinition, MemoryCommitmentDefinition, StyleCommitmentDefinition, StyleCommitmentDefinition, RuleCommitmentDefinition, RuleCommitmentDefinition, LanguageCommitmentDefinition, LanguageCommitmentDefinition, WritingSampleCommitmentDefinition, WritingRulesCommitmentDefinition, SampleCommitmentDefinition, SampleCommitmentDefinition, FormatCommitmentDefinition, FormatCommitmentDefinition, TemplateCommitmentDefinition, TemplateCommitmentDefinition, FromCommitmentDefinition, ImportCommitmentDefinition, ImportCommitmentDefinition, ModelCommitmentDefinition, ModelCommitmentDefinition, ActionCommitmentDefinition, ActionCommitmentDefinition, ComponentCommitmentDefinition, MetaAvatarCommitmentDefinition, MetaImageCommitmentDefinition, MetaColorCommitmentDefinition, MetaFontCommitmentDefinition, MetaLinkCommitmentDefinition, MetaDomainCommitmentDefinition, MetaDisclaimerCommitmentDefinition, MetaInputPlaceholderCommitmentDefinition, MetaCommitmentDefinition, MetaVoiceCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, GoalCommitmentDefinition, GoalCommitmentDefinition, InitialMessageCommitmentDefinition, UserMessageCommitmentDefinition, InternalMessageCommitmentDefinition, AgentMessageCommitmentDefinition, MessageSuffixCommitmentDefinition, MessageCommitmentDefinition, MessageCommitmentDefinition, ScenarioCommitmentDefinition, ScenarioCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, DictionaryCommitmentDefinition, OpenCommitmentDefinition, ClosedCommitmentDefinition, TeamCommitmentDefinition, UseBrowserCommitmentDefinition, UseDeepSearchCommitmentDefinition, UseSearchEngineCommitmentDefinition, UseSpawnCommitmentDefinition, UseTimeoutCommitmentDefinition, UseTimeCommitmentDefinition, UseUserLocationCommitmentDefinition, UseCalendarCommitmentDefinition, UseEmailCommitmentDefinition, UsePopupCommitmentDefinition, UseImageGeneratorCommitmentDefinition, UseMcpCommitmentDefinition, UsePrivacyCommitmentDefinition, UseProjectCommitmentDefinition, NotYetImplementedCommitmentDefinition<"EXPECT">, NotYetImplementedCommitmentDefinition<"BEHAVIOUR">, NotYetImplementedCommitmentDefinition<"BEHAVIOURS">, NotYetImplementedCommitmentDefinition<"AVOID">, NotYetImplementedCommitmentDefinition<"AVOIDANCE">, NotYetImplementedCommitmentDefinition<"CONTEXT">];
64
+ export declare const COMMITMENT_REGISTRY: readonly [PersonaCommitmentDefinition, PersonaCommitmentDefinition, KnowledgeCommitmentDefinition, MemoryCommitmentDefinition, MemoryCommitmentDefinition, StyleCommitmentDefinition, StyleCommitmentDefinition, RuleCommitmentDefinition, RuleCommitmentDefinition, LanguageCommitmentDefinition, LanguageCommitmentDefinition, WritingSampleCommitmentDefinition, WritingRulesCommitmentDefinition, SampleCommitmentDefinition, SampleCommitmentDefinition, FormatCommitmentDefinition, FormatCommitmentDefinition, TemplateCommitmentDefinition, TemplateCommitmentDefinition, FromCommitmentDefinition, ImportCommitmentDefinition, ImportCommitmentDefinition, ModelCommitmentDefinition, ModelCommitmentDefinition, ActionCommitmentDefinition, ActionCommitmentDefinition, ComponentCommitmentDefinition, MetaAvatarCommitmentDefinition, MetaImageCommitmentDefinition, MetaColorCommitmentDefinition, MetaFontCommitmentDefinition, MetaLinkCommitmentDefinition, MetaDomainCommitmentDefinition, MetaDisclaimerCommitmentDefinition, MetaInputPlaceholderCommitmentDefinition, MetaCommitmentDefinition, MetaVoiceCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, GoalCommitmentDefinition, GoalCommitmentDefinition, InitialMessageCommitmentDefinition, UserMessageCommitmentDefinition, InternalMessageCommitmentDefinition, AgentMessageCommitmentDefinition, MessageSuffixCommitmentDefinition, MessageCommitmentDefinition, MessageCommitmentDefinition, WalletCommitmentDefinition, WalletCommitmentDefinition, ScenarioCommitmentDefinition, ScenarioCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, DictionaryCommitmentDefinition, OpenCommitmentDefinition, ClosedCommitmentDefinition, TeamCommitmentDefinition, UseBrowserCommitmentDefinition, UseDeepSearchCommitmentDefinition, UseSearchEngineCommitmentDefinition, UseSpawnCommitmentDefinition, UseTimeoutCommitmentDefinition, UseTimeCommitmentDefinition, UseUserLocationCommitmentDefinition, UseCalendarCommitmentDefinition, UseEmailCommitmentDefinition, UsePopupCommitmentDefinition, UseImageGeneratorCommitmentDefinition, UseMcpCommitmentDefinition, UsePrivacyCommitmentDefinition, UseProjectCommitmentDefinition, NotYetImplementedCommitmentDefinition<"EXPECT">, NotYetImplementedCommitmentDefinition<"BEHAVIOUR">, NotYetImplementedCommitmentDefinition<"BEHAVIOURS">, NotYetImplementedCommitmentDefinition<"AVOID">, NotYetImplementedCommitmentDefinition<"AVOIDANCE">, NotYetImplementedCommitmentDefinition<"CONTEXT">];
@@ -1,4 +1,3 @@
1
- import type { Tool as AgentKitTool } from '@openai/agents';
2
1
  import { Agent as AgentFromKit } from '@openai/agents';
3
2
  import OpenAI from 'openai';
4
3
  import { TODO_any } from '../../_packages/types.index';
@@ -110,7 +109,6 @@ export declare class OpenAiAgentKitExecutionTools extends OpenAiVectorStoreHandl
110
109
  readonly instructions: string_markdown;
111
110
  readonly knowledgeSources?: ReadonlyArray<string>;
112
111
  readonly tools?: ModelRequirements['tools'];
113
- readonly nativeAgentKitTools?: ReadonlyArray<AgentKitTool>;
114
112
  readonly vectorStoreId?: string;
115
113
  readonly storeAsPrepared?: boolean;
116
114
  }): Promise<OpenAiAgentKitPreparedAgent>;
@@ -180,6 +178,10 @@ export declare class OpenAiAgentKitExecutionTools extends OpenAiVectorStoreHandl
180
178
  * Returns AgentKit-specific options.
181
179
  */
182
180
  private get agentKitOptions();
181
+ /**
182
+ * Returns true when hosted OpenAI vector-store search should back `knowledgeSources`.
183
+ */
184
+ private get isNativeKnowledgeSearchEnabled();
183
185
  /**
184
186
  * Discriminant for type guards.
185
187
  */
@@ -12,4 +12,13 @@ export type OpenAiAgentKitExecutionToolsOptions = OpenAiVectorStoreHandlerOption
12
12
  * @default gpt-5.2
13
13
  */
14
14
  readonly agentKitModelName?: string_model_name;
15
+ /**
16
+ * Enables OpenAI hosted vector-store file search for `knowledgeSources`.
17
+ *
18
+ * Agents Server sets this to `false` because it uses a DB-backed LlamaIndex
19
+ * implementation exposed through the `knowledge_search` tool instead.
20
+ *
21
+ * @default true
22
+ */
23
+ readonly isNativeKnowledgeSearchEnabled?: boolean;
15
24
  };
@@ -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.112.0-61`).
18
+ * It follows semantic versioning (e.g., `0.112.0-63`).
19
19
  *
20
20
  * @generated
21
21
  */