@promptbook/core 0.112.0-72 → 0.112.0-79
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -9
- package/esm/index.es.js +6495 -4845
- package/esm/index.es.js.map +1 -1
- package/esm/src/avatars/types/AvatarVisualDefinition.d.ts +1 -1
- package/esm/src/avatars/visuals/octopus3d2AvatarVisual.d.ts +7 -0
- package/esm/src/avatars/visuals/octopus3dAvatarVisualShared.d.ts +37 -0
- package/esm/src/book-components/Chat/save/_common/chatExportRendering.d.ts +75 -0
- package/esm/src/book-components/Chat/save/_common/getPromptbookExportBranding.d.ts +18 -0
- package/esm/src/book-components/Chat/save/html/htmlSaveFormatDefinition.d.ts +13 -1
- package/esm/src/book-components/Chat/save/html/htmlSaveFormatDefinition.test.d.ts +1 -0
- package/esm/src/book-components/Chat/save/index.d.ts +5 -5
- package/esm/src/book-components/Chat/save/markdown/mdSaveFormatDefinition.d.ts +5 -3
- package/esm/src/book-components/Chat/save/markdown/mdSaveFormatDefinition.test.d.ts +1 -0
- package/esm/src/book-components/Chat/save/pdf/buildChatPdf.d.ts +4 -3
- package/esm/src/book-components/Chat/save/pdf/pdfSaveFormatDefinition.d.ts +3 -3
- package/esm/src/book-components/Chat/save/pdf/pdfSaveFormatDefinition.test.d.ts +1 -0
- package/esm/src/book-components/Chat/save/react/reactSaveFormatDefinition.test.d.ts +1 -0
- package/esm/src/book-components/Chat/utils/renderMarkdown.d.ts +26 -0
- package/esm/src/cli/cli-commands/agent/agentProjectPaths.d.ts +8 -8
- package/esm/src/cli/cli-commands/agent/agentRunCliOptions.d.ts +2 -0
- package/esm/src/cli/cli-commands/agent/initializeAgentRunnerCommand.d.ts +1 -0
- package/esm/src/cli/cli-commands/agents-server/buildAgentsServer.d.ts +56 -0
- package/esm/src/cli/cli-commands/agents-server/buildAgentsServer.test.d.ts +1 -0
- package/esm/src/cli/cli-commands/agents-server/ensureAgentsServerEnvFile.d.ts +7 -0
- package/esm/src/cli/cli-commands/agents-server/ensureAgentsServerGitignoreFile.d.ts +7 -0
- package/esm/src/cli/cli-commands/agents-server/init.d.ts +9 -0
- package/esm/src/cli/cli-commands/agents-server/init.test.d.ts +1 -0
- package/esm/src/cli/cli-commands/agents-server/initializeAgentsServerProjectConfiguration.d.ts +17 -0
- package/esm/src/cli/cli-commands/agents-server/printAgentsServerInitializationSummary.d.ts +7 -0
- package/esm/src/cli/cli-commands/agents-server/run.d.ts +14 -0
- package/esm/src/cli/cli-commands/agents-server/run.test.d.ts +1 -0
- package/esm/src/cli/cli-commands/agents-server/startAgentsServer.d.ts +23 -0
- package/esm/src/cli/cli-commands/agents-server.d.ts +8 -0
- package/esm/src/cli/cli-commands/common/handleActionErrors.d.ts +9 -4
- package/esm/src/cli/cli-commands/common/projectInitialization.d.ts +65 -0
- package/esm/src/cli/cli-commands/common/promptRunnerCliOptions.d.ts +44 -0
- package/esm/src/cli/common/$deprecateCliCommand.d.ts +8 -0
- package/esm/src/cli/common/$deprecateCliCommand.test.d.ts +1 -0
- package/esm/src/conversion/pipelineJsonToString/appendMarkdownBlock.d.ts +7 -0
- package/esm/src/conversion/pipelineJsonToString/createPipelineCommands.d.ts +7 -0
- package/esm/src/conversion/pipelineJsonToString/createPipelineIntroduction.d.ts +8 -0
- package/esm/src/conversion/pipelineJsonToString/createTaskSerialization.d.ts +23 -0
- package/esm/src/conversion/pipelineJsonToString/stringifyCommands.d.ts +7 -0
- package/esm/src/conversion/pipelineJsonToString/stringifyTask.d.ts +8 -0
- package/esm/src/conversion/pipelineJsonToString.test.d.ts +1 -0
- package/esm/src/execution/createPipelineExecutor/executeSingleAttempt.d.ts +31 -0
- package/esm/src/execution/createPipelineExecutor/handleAttemptFailure.d.ts +40 -0
- package/esm/src/execution/createPipelineExecutor/reportPromptExecution.d.ts +34 -0
- package/esm/src/execution/resolveTaskTldr.d.ts +32 -0
- package/esm/src/execution/resolveTaskTldr.test.d.ts +1 -0
- package/esm/src/llm-providers/agent/AgentLlmExecutionTools.d.ts +22 -63
- package/esm/src/llm-providers/agent/AgentLlmExecutionToolsAgentKitRunner.d.ts +51 -0
- package/esm/src/llm-providers/agent/AgentLlmExecutionToolsOpenAiAssistantRunner.d.ts +43 -0
- package/esm/src/llm-providers/agent/AgentLlmExecutionToolsPromptPreparer.d.ts +41 -0
- package/esm/src/llm-providers/agent/emitAgentLlmExecutionToolsAssistantPreparationProgress.d.ts +26 -0
- package/esm/src/llm-providers/openai/OpenAiAgentKitExecutionTools.d.ts +16 -93
- package/esm/src/llm-providers/openai/OpenAiAgentKitExecutionToolsInputBuilder.d.ts +41 -0
- package/esm/src/llm-providers/openai/OpenAiAgentKitExecutionToolsOutputTypeMapper.d.ts +56 -0
- package/esm/src/llm-providers/openai/OpenAiAgentKitExecutionToolsToolBuilder.d.ts +99 -0
- package/esm/src/llm-providers/openai/OpenAiAssistantExecutionTools.d.ts +24 -120
- package/esm/src/llm-providers/openai/OpenAiAssistantExecutionToolsProgressReporter.d.ts +62 -0
- package/esm/src/llm-providers/openai/OpenAiAssistantExecutionToolsPromptBuilder.d.ts +29 -0
- package/esm/src/llm-providers/openai/OpenAiAssistantExecutionToolsStreamRunner.d.ts +63 -0
- package/esm/src/llm-providers/openai/OpenAiAssistantExecutionToolsToolRunner.d.ts +89 -0
- package/esm/src/llm-providers/openai/OpenAiCompatibleExecutionTools.d.ts +9 -28
- package/esm/src/llm-providers/openai/OpenAiCompatibleModelCatalog.d.ts +31 -0
- package/esm/src/llm-providers/openai/OpenAiCompatibleNonChatPromptCaller.d.ts +57 -0
- package/esm/src/llm-providers/openai/OpenAiCompatibleRequestManager.d.ts +29 -0
- package/esm/src/llm-providers/openai/OpenAiVectorStoreFileBatchHandler.d.ts +51 -0
- package/esm/src/llm-providers/openai/OpenAiVectorStoreFileBatchPoller.d.ts +75 -0
- package/esm/src/llm-providers/openai/OpenAiVectorStoreHandler.d.ts +1 -98
- package/esm/src/llm-providers/openai/OpenAiVectorStoreKnowledgeSourcePreparer.d.ts +44 -0
- package/esm/src/llm-providers/openai/utils/OpenAiCompatibleChatProgressReporter.d.ts +86 -0
- package/esm/src/llm-providers/openai/utils/OpenAiCompatibleChatPromptBuilder.d.ts +57 -0
- package/esm/src/llm-providers/openai/utils/OpenAiCompatibleChatToolCaller.d.ts +57 -0
- package/esm/src/remote-server/startRemoteServer/RemoteServerRuntime.d.ts +14 -0
- package/esm/src/remote-server/startRemoteServer/SocketResponse.d.ts +9 -0
- package/esm/src/remote-server/startRemoteServer/StartRemoteServerConfiguration.d.ts +18 -0
- package/esm/src/remote-server/startRemoteServer/createRemoteServerExpressApp.d.ts +7 -0
- package/esm/src/remote-server/startRemoteServer/createRemoteServerHandle.d.ts +11 -0
- package/esm/src/remote-server/startRemoteServer/createSocketServer.d.ts +9 -0
- package/esm/src/remote-server/startRemoteServer/getExecutionToolsFromIdentification.d.ts +12 -0
- package/esm/src/remote-server/startRemoteServer/registerBookRoutes.d.ts +7 -0
- package/esm/src/remote-server/startRemoteServer/registerExecutionRoutes.d.ts +7 -0
- package/esm/src/remote-server/startRemoteServer/registerListModelsSocketHandler.d.ts +8 -0
- package/esm/src/remote-server/startRemoteServer/registerLoginRoute.d.ts +7 -0
- package/esm/src/remote-server/startRemoteServer/registerNotFoundRoute.d.ts +7 -0
- package/esm/src/remote-server/startRemoteServer/registerOpenAiCompatibleChatCompletionsRoute.d.ts +7 -0
- package/esm/src/remote-server/startRemoteServer/registerOpenApiRoutes.d.ts +7 -0
- package/esm/src/remote-server/startRemoteServer/registerPreparePipelineSocketHandler.d.ts +8 -0
- package/esm/src/remote-server/startRemoteServer/registerPromptSocketHandler.d.ts +8 -0
- package/esm/src/remote-server/startRemoteServer/registerRemoteServerHttpRoutes.d.ts +7 -0
- package/esm/src/remote-server/startRemoteServer/registerRemoteServerSocketHandlers.d.ts +8 -0
- package/esm/src/remote-server/startRemoteServer/registerServerIndexRoute.d.ts +7 -0
- package/esm/src/remote-server/startRemoteServer/resolveStartRemoteServerConfiguration.d.ts +8 -0
- package/esm/src/remote-server/startRemoteServer/respondToSocketRequest.d.ts +8 -0
- package/esm/src/remote-server/startRemoteServer/startListening.d.ts +9 -0
- package/esm/src/scrapers/_common/utils/makeKnowledgeSourceHandler.d.ts +14 -1
- package/esm/src/utils/color/Color.d.ts +4 -44
- package/esm/src/utils/color/ColorValue.d.ts +55 -0
- package/esm/src/utils/color/isHexColorString.d.ts +10 -0
- package/esm/src/utils/color/parseColorString.d.ts +11 -0
- package/esm/src/utils/serialization/serializeToPromptbookJavascript.d.ts +2 -0
- package/esm/src/utils/serialization/serializeToPromptbookJavascript.test.d.ts +1 -0
- package/esm/src/version.d.ts +1 -1
- package/package.json +1 -1
- package/umd/index.umd.js +6453 -4803
- package/umd/index.umd.js.map +1 -1
- package/umd/src/avatars/types/AvatarVisualDefinition.d.ts +1 -1
- package/umd/src/avatars/visuals/octopus3d2AvatarVisual.d.ts +7 -0
- package/umd/src/avatars/visuals/octopus3dAvatarVisualShared.d.ts +37 -0
- package/umd/src/book-components/Chat/save/_common/chatExportRendering.d.ts +75 -0
- package/umd/src/book-components/Chat/save/_common/getPromptbookExportBranding.d.ts +18 -0
- package/umd/src/book-components/Chat/save/html/htmlSaveFormatDefinition.d.ts +13 -1
- package/umd/src/book-components/Chat/save/html/htmlSaveFormatDefinition.test.d.ts +1 -0
- package/umd/src/book-components/Chat/save/index.d.ts +5 -5
- package/umd/src/book-components/Chat/save/markdown/mdSaveFormatDefinition.d.ts +5 -3
- package/umd/src/book-components/Chat/save/markdown/mdSaveFormatDefinition.test.d.ts +1 -0
- package/umd/src/book-components/Chat/save/pdf/buildChatPdf.d.ts +4 -3
- package/umd/src/book-components/Chat/save/pdf/pdfSaveFormatDefinition.d.ts +3 -3
- package/umd/src/book-components/Chat/save/pdf/pdfSaveFormatDefinition.test.d.ts +1 -0
- package/umd/src/book-components/Chat/save/react/reactSaveFormatDefinition.test.d.ts +1 -0
- package/umd/src/book-components/Chat/utils/renderMarkdown.d.ts +26 -0
- package/umd/src/cli/cli-commands/agent/agentProjectPaths.d.ts +8 -8
- package/umd/src/cli/cli-commands/agent/agentRunCliOptions.d.ts +2 -0
- package/umd/src/cli/cli-commands/agent/initializeAgentRunnerCommand.d.ts +1 -0
- package/umd/src/cli/cli-commands/agents-server/buildAgentsServer.d.ts +56 -0
- package/umd/src/cli/cli-commands/agents-server/buildAgentsServer.test.d.ts +1 -0
- package/umd/src/cli/cli-commands/agents-server/ensureAgentsServerEnvFile.d.ts +7 -0
- package/umd/src/cli/cli-commands/agents-server/ensureAgentsServerGitignoreFile.d.ts +7 -0
- package/umd/src/cli/cli-commands/agents-server/init.d.ts +9 -0
- package/umd/src/cli/cli-commands/agents-server/init.test.d.ts +1 -0
- package/umd/src/cli/cli-commands/agents-server/initializeAgentsServerProjectConfiguration.d.ts +17 -0
- package/umd/src/cli/cli-commands/agents-server/printAgentsServerInitializationSummary.d.ts +7 -0
- package/umd/src/cli/cli-commands/agents-server/run.d.ts +14 -0
- package/umd/src/cli/cli-commands/agents-server/run.test.d.ts +1 -0
- package/umd/src/cli/cli-commands/agents-server/startAgentsServer.d.ts +23 -0
- package/umd/src/cli/cli-commands/agents-server.d.ts +8 -0
- package/umd/src/cli/cli-commands/common/handleActionErrors.d.ts +9 -4
- package/umd/src/cli/cli-commands/common/projectInitialization.d.ts +65 -0
- package/umd/src/cli/cli-commands/common/promptRunnerCliOptions.d.ts +44 -0
- package/umd/src/cli/common/$deprecateCliCommand.d.ts +8 -0
- package/umd/src/cli/common/$deprecateCliCommand.test.d.ts +1 -0
- package/umd/src/conversion/pipelineJsonToString/appendMarkdownBlock.d.ts +7 -0
- package/umd/src/conversion/pipelineJsonToString/createPipelineCommands.d.ts +7 -0
- package/umd/src/conversion/pipelineJsonToString/createPipelineIntroduction.d.ts +8 -0
- package/umd/src/conversion/pipelineJsonToString/createTaskSerialization.d.ts +23 -0
- package/umd/src/conversion/pipelineJsonToString/stringifyCommands.d.ts +7 -0
- package/umd/src/conversion/pipelineJsonToString/stringifyTask.d.ts +8 -0
- package/umd/src/conversion/pipelineJsonToString.test.d.ts +1 -0
- package/umd/src/execution/createPipelineExecutor/executeSingleAttempt.d.ts +31 -0
- package/umd/src/execution/createPipelineExecutor/handleAttemptFailure.d.ts +40 -0
- package/umd/src/execution/createPipelineExecutor/reportPromptExecution.d.ts +34 -0
- package/umd/src/execution/resolveTaskTldr.d.ts +32 -0
- package/umd/src/execution/resolveTaskTldr.test.d.ts +1 -0
- package/umd/src/llm-providers/agent/AgentLlmExecutionTools.d.ts +22 -63
- package/umd/src/llm-providers/agent/AgentLlmExecutionToolsAgentKitRunner.d.ts +51 -0
- package/umd/src/llm-providers/agent/AgentLlmExecutionToolsOpenAiAssistantRunner.d.ts +43 -0
- package/umd/src/llm-providers/agent/AgentLlmExecutionToolsPromptPreparer.d.ts +41 -0
- package/umd/src/llm-providers/agent/emitAgentLlmExecutionToolsAssistantPreparationProgress.d.ts +26 -0
- package/umd/src/llm-providers/openai/OpenAiAgentKitExecutionTools.d.ts +16 -93
- package/umd/src/llm-providers/openai/OpenAiAgentKitExecutionToolsInputBuilder.d.ts +41 -0
- package/umd/src/llm-providers/openai/OpenAiAgentKitExecutionToolsOutputTypeMapper.d.ts +56 -0
- package/umd/src/llm-providers/openai/OpenAiAgentKitExecutionToolsToolBuilder.d.ts +99 -0
- package/umd/src/llm-providers/openai/OpenAiAssistantExecutionTools.d.ts +24 -120
- package/umd/src/llm-providers/openai/OpenAiAssistantExecutionToolsProgressReporter.d.ts +62 -0
- package/umd/src/llm-providers/openai/OpenAiAssistantExecutionToolsPromptBuilder.d.ts +29 -0
- package/umd/src/llm-providers/openai/OpenAiAssistantExecutionToolsStreamRunner.d.ts +63 -0
- package/umd/src/llm-providers/openai/OpenAiAssistantExecutionToolsToolRunner.d.ts +89 -0
- package/umd/src/llm-providers/openai/OpenAiCompatibleExecutionTools.d.ts +9 -28
- package/umd/src/llm-providers/openai/OpenAiCompatibleModelCatalog.d.ts +31 -0
- package/umd/src/llm-providers/openai/OpenAiCompatibleNonChatPromptCaller.d.ts +57 -0
- package/umd/src/llm-providers/openai/OpenAiCompatibleRequestManager.d.ts +29 -0
- package/umd/src/llm-providers/openai/OpenAiVectorStoreFileBatchHandler.d.ts +51 -0
- package/umd/src/llm-providers/openai/OpenAiVectorStoreFileBatchPoller.d.ts +75 -0
- package/umd/src/llm-providers/openai/OpenAiVectorStoreHandler.d.ts +1 -98
- package/umd/src/llm-providers/openai/OpenAiVectorStoreKnowledgeSourcePreparer.d.ts +44 -0
- package/umd/src/llm-providers/openai/utils/OpenAiCompatibleChatProgressReporter.d.ts +86 -0
- package/umd/src/llm-providers/openai/utils/OpenAiCompatibleChatPromptBuilder.d.ts +57 -0
- package/umd/src/llm-providers/openai/utils/OpenAiCompatibleChatToolCaller.d.ts +57 -0
- package/umd/src/remote-server/startRemoteServer/RemoteServerRuntime.d.ts +14 -0
- package/umd/src/remote-server/startRemoteServer/SocketResponse.d.ts +9 -0
- package/umd/src/remote-server/startRemoteServer/StartRemoteServerConfiguration.d.ts +18 -0
- package/umd/src/remote-server/startRemoteServer/createRemoteServerExpressApp.d.ts +7 -0
- package/umd/src/remote-server/startRemoteServer/createRemoteServerHandle.d.ts +11 -0
- package/umd/src/remote-server/startRemoteServer/createSocketServer.d.ts +9 -0
- package/umd/src/remote-server/startRemoteServer/getExecutionToolsFromIdentification.d.ts +12 -0
- package/umd/src/remote-server/startRemoteServer/registerBookRoutes.d.ts +7 -0
- package/umd/src/remote-server/startRemoteServer/registerExecutionRoutes.d.ts +7 -0
- package/umd/src/remote-server/startRemoteServer/registerListModelsSocketHandler.d.ts +8 -0
- package/umd/src/remote-server/startRemoteServer/registerLoginRoute.d.ts +7 -0
- package/umd/src/remote-server/startRemoteServer/registerNotFoundRoute.d.ts +7 -0
- package/umd/src/remote-server/startRemoteServer/registerOpenAiCompatibleChatCompletionsRoute.d.ts +7 -0
- package/umd/src/remote-server/startRemoteServer/registerOpenApiRoutes.d.ts +7 -0
- package/umd/src/remote-server/startRemoteServer/registerPreparePipelineSocketHandler.d.ts +8 -0
- package/umd/src/remote-server/startRemoteServer/registerPromptSocketHandler.d.ts +8 -0
- package/umd/src/remote-server/startRemoteServer/registerRemoteServerHttpRoutes.d.ts +7 -0
- package/umd/src/remote-server/startRemoteServer/registerRemoteServerSocketHandlers.d.ts +8 -0
- package/umd/src/remote-server/startRemoteServer/registerServerIndexRoute.d.ts +7 -0
- package/umd/src/remote-server/startRemoteServer/resolveStartRemoteServerConfiguration.d.ts +8 -0
- package/umd/src/remote-server/startRemoteServer/respondToSocketRequest.d.ts +8 -0
- package/umd/src/remote-server/startRemoteServer/startListening.d.ts +9 -0
- package/umd/src/scrapers/_common/utils/makeKnowledgeSourceHandler.d.ts +14 -1
- package/umd/src/utils/color/Color.d.ts +4 -44
- package/umd/src/utils/color/ColorValue.d.ts +55 -0
- package/umd/src/utils/color/isHexColorString.d.ts +10 -0
- package/umd/src/utils/color/parseColorString.d.ts +11 -0
- package/umd/src/utils/serialization/serializeToPromptbookJavascript.d.ts +2 -0
- package/umd/src/utils/serialization/serializeToPromptbookJavascript.test.d.ts +1 -0
- package/umd/src/version.d.ts +1 -1
- package/esm/src/cli/cli-commands/coder/appendBlock.d.ts +0 -6
- package/esm/src/cli/cli-commands/coder/readTextFileIfExists.d.ts +0 -6
- package/umd/src/cli/cli-commands/coder/appendBlock.d.ts +0 -6
- package/umd/src/cli/cli-commands/coder/readTextFileIfExists.d.ts +0 -6
|
@@ -6,6 +6,24 @@ import type { ThinkingLevel } from '../coder/ThinkingLevel';
|
|
|
6
6
|
* @private internal utility of `promptbookCli`
|
|
7
7
|
*/
|
|
8
8
|
export declare const PROMPT_RUNNER_AGENT_NAMES: readonly ["openai-codex", "github-copilot", "cline", "claude-code", "opencode", "gemini"];
|
|
9
|
+
/**
|
|
10
|
+
* Environment variable used as the default runner identifier when `--agent` is omitted.
|
|
11
|
+
*
|
|
12
|
+
* @private internal utility of `promptbookCli`
|
|
13
|
+
*/
|
|
14
|
+
export declare const PTBK_AGENT_ENV = "PTBK_AGENT";
|
|
15
|
+
/**
|
|
16
|
+
* Environment variable used as the default runner model when `--model` is omitted.
|
|
17
|
+
*
|
|
18
|
+
* @private internal utility of `promptbookCli`
|
|
19
|
+
*/
|
|
20
|
+
export declare const PTBK_MODEL_ENV = "PTBK_MODEL";
|
|
21
|
+
/**
|
|
22
|
+
* Environment variable used as the default runner thinking level when `--thinking-level` is omitted.
|
|
23
|
+
*
|
|
24
|
+
* @private internal utility of `promptbookCli`
|
|
25
|
+
*/
|
|
26
|
+
export declare const PTBK_THINKING_LEVEL_ENV = "PTBK_THINKING_LEVEL";
|
|
9
27
|
/**
|
|
10
28
|
* Runner identifier supported by Promptbook CLI agent orchestration commands.
|
|
11
29
|
*
|
|
@@ -29,6 +47,12 @@ export type PromptRunnerCliOptions = {
|
|
|
29
47
|
readonly autoPush: boolean;
|
|
30
48
|
readonly autoPull: boolean;
|
|
31
49
|
};
|
|
50
|
+
/**
|
|
51
|
+
* Commander option bag for runner selection plus terminal/runtime switches shared with server orchestration.
|
|
52
|
+
*
|
|
53
|
+
* @private internal utility of `promptbookCli`
|
|
54
|
+
*/
|
|
55
|
+
export type PromptRunnerSelectionCliOptions = Pick<PromptRunnerCliOptions, 'agent' | 'model' | 'ui' | 'thinkingLevel' | 'allowCredits'>;
|
|
32
56
|
/**
|
|
33
57
|
* Normalized runner options used by runner-backed CLI commands.
|
|
34
58
|
*
|
|
@@ -46,6 +70,12 @@ export type NormalizedPromptRunnerCliOptions = {
|
|
|
46
70
|
readonly autoPush: boolean;
|
|
47
71
|
readonly autoPull: boolean;
|
|
48
72
|
};
|
|
73
|
+
/**
|
|
74
|
+
* Normalized runner selection plus terminal/runtime switches shared with server orchestration.
|
|
75
|
+
*
|
|
76
|
+
* @private internal utility of `promptbookCli`
|
|
77
|
+
*/
|
|
78
|
+
export type NormalizedPromptRunnerSelectionCliOptions = Pick<NormalizedPromptRunnerCliOptions, 'agentName' | 'model' | 'noUi' | 'thinkingLevel' | 'allowCredits'>;
|
|
49
79
|
/**
|
|
50
80
|
* Description block shared by runner-backed CLI commands.
|
|
51
81
|
*
|
|
@@ -70,6 +100,12 @@ export declare const PROMPT_RUNNER_MODEL_OPTION_DESCRIPTION: string;
|
|
|
70
100
|
* @private internal utility of `promptbookCli`
|
|
71
101
|
*/
|
|
72
102
|
export declare function addPromptRunnerSelectionOptions(command: Program): void;
|
|
103
|
+
/**
|
|
104
|
+
* Registers shared runner terminal/runtime flags on a command.
|
|
105
|
+
*
|
|
106
|
+
* @private internal utility of `promptbookCli`
|
|
107
|
+
*/
|
|
108
|
+
export declare function addPromptRunnerRuntimeOptions(command: Program): void;
|
|
73
109
|
/**
|
|
74
110
|
* Registers shared runner execution flags on a command.
|
|
75
111
|
*
|
|
@@ -84,3 +120,11 @@ export declare function addPromptRunnerExecutionOptions(command: Program): void;
|
|
|
84
120
|
export declare function normalizePromptRunnerCliOptions(cliOptions: PromptRunnerCliOptions, options: {
|
|
85
121
|
readonly isAgentRequired: boolean;
|
|
86
122
|
}): NormalizedPromptRunnerCliOptions;
|
|
123
|
+
/**
|
|
124
|
+
* Converts Commander runner selection/runtime flags into the normalized runner shape.
|
|
125
|
+
*
|
|
126
|
+
* @private internal utility of `promptbookCli`
|
|
127
|
+
*/
|
|
128
|
+
export declare function normalizePromptRunnerSelectionCliOptions(cliOptions: PromptRunnerSelectionCliOptions, options: {
|
|
129
|
+
readonly isAgentRequired: boolean;
|
|
130
|
+
}): NormalizedPromptRunnerSelectionCliOptions;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import type { $side_effect } from '../../utils/organization/$side_effect';
|
|
3
|
+
/**
|
|
4
|
+
* Marks one CLI command as deprecated while keeping it available for existing callers.
|
|
5
|
+
*
|
|
6
|
+
* @private utility of CLI
|
|
7
|
+
*/
|
|
8
|
+
export declare function $deprecateCliCommand(command: Command, deprecationMessage: string): $side_effect;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { string_markdown } from '../../types/string_markdown';
|
|
2
|
+
/**
|
|
3
|
+
* Appends one markdown block to an existing markdown document.
|
|
4
|
+
*
|
|
5
|
+
* @private internal utility of `pipelineJsonToString`
|
|
6
|
+
*/
|
|
7
|
+
export declare function appendMarkdownBlock(pipelineString: string_markdown, markdownBlock: string_markdown): string_markdown;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { PipelineJson } from '../../pipeline/PipelineJson/PipelineJson';
|
|
2
|
+
/**
|
|
3
|
+
* Collects pipeline-level commands in the existing serialization order.
|
|
4
|
+
*
|
|
5
|
+
* @private internal utility of `pipelineJsonToString`
|
|
6
|
+
*/
|
|
7
|
+
export declare function createPipelineCommands(pipelineJson: PipelineJson): Array<string>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { PipelineJson } from '../../pipeline/PipelineJson/PipelineJson';
|
|
2
|
+
import type { string_markdown } from '../../types/string_markdown';
|
|
3
|
+
/**
|
|
4
|
+
* Creates the initial markdown heading and description of a pipeline.
|
|
5
|
+
*
|
|
6
|
+
* @private internal utility of `pipelineJsonToString`
|
|
7
|
+
*/
|
|
8
|
+
export declare function createPipelineIntroduction(pipelineJson: PipelineJson): string_markdown;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { TaskJson } from '../../pipeline/PipelineJson/TaskJson';
|
|
2
|
+
/**
|
|
3
|
+
* Code fence language used when stringifying a pipeline task.
|
|
4
|
+
*
|
|
5
|
+
* @private internal type of `createTaskSerialization`
|
|
6
|
+
*/
|
|
7
|
+
type PipelineTaskContentLanguage = 'markdown' | 'text' | 'javascript' | 'typescript' | 'python' | '';
|
|
8
|
+
/**
|
|
9
|
+
* All derived serialization details needed to render one task section.
|
|
10
|
+
*
|
|
11
|
+
* @private internal type of `createTaskSerialization`
|
|
12
|
+
*/
|
|
13
|
+
type TaskSerialization = {
|
|
14
|
+
readonly commands: Array<string>;
|
|
15
|
+
readonly contentLanguage: PipelineTaskContentLanguage;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Collects all task-specific serialization details.
|
|
19
|
+
*
|
|
20
|
+
* @private internal utility of `pipelineJsonToString`
|
|
21
|
+
*/
|
|
22
|
+
export declare function createTaskSerialization(task: TaskJson): TaskSerialization;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { string_markdown } from '../../types/string_markdown';
|
|
2
|
+
/**
|
|
3
|
+
* Renders commands as markdown bullet items.
|
|
4
|
+
*
|
|
5
|
+
* @private internal utility of `pipelineJsonToString`
|
|
6
|
+
*/
|
|
7
|
+
export declare function stringifyCommands(commands: ReadonlyArray<string>): string_markdown;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { TaskJson } from '../../pipeline/PipelineJson/TaskJson';
|
|
2
|
+
import type { string_markdown } from '../../types/string_markdown';
|
|
3
|
+
/**
|
|
4
|
+
* Stringifies one task section of the pipeline.
|
|
5
|
+
*
|
|
6
|
+
* @private internal utility of `pipelineJsonToString`
|
|
7
|
+
*/
|
|
8
|
+
export declare function stringifyTask(task: TaskJson): string_markdown;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { string_parameter_name } from '../../types/string_name';
|
|
2
|
+
import type { LlmExecutionTools } from '../LlmExecutionTools';
|
|
3
|
+
import type { $OngoingTaskResult } from './$OngoingTaskResult';
|
|
4
|
+
import type { ExecuteAttemptsOptions } from './40-executeAttempts';
|
|
5
|
+
/**
|
|
6
|
+
* Executes one loop iteration, from joker resolution or task execution through validation.
|
|
7
|
+
*
|
|
8
|
+
* @private function of `executeAttempts`
|
|
9
|
+
*/
|
|
10
|
+
export declare function executeSingleAttempt(options: {
|
|
11
|
+
/**
|
|
12
|
+
* Metadata describing the current loop iteration.
|
|
13
|
+
*/
|
|
14
|
+
readonly attempt: {
|
|
15
|
+
readonly attemptIndex: number;
|
|
16
|
+
readonly isJokerAttempt: boolean;
|
|
17
|
+
readonly jokerParameterName?: string_parameter_name;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Immutable executor options shared across all attempts.
|
|
21
|
+
*/
|
|
22
|
+
readonly options: ExecuteAttemptsOptions;
|
|
23
|
+
/**
|
|
24
|
+
* Narrowed LLM execution tools for prompt tasks.
|
|
25
|
+
*/
|
|
26
|
+
readonly llmTools: LlmExecutionTools;
|
|
27
|
+
/**
|
|
28
|
+
* Mutable per-task state accumulated across attempts.
|
|
29
|
+
*/
|
|
30
|
+
readonly $ongoingTaskResult: $OngoingTaskResult;
|
|
31
|
+
}): Promise<void>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { PartialDeep, Promisable } from 'type-fest';
|
|
2
|
+
import { ExpectError } from '../../errors/ExpectError';
|
|
3
|
+
import type { PipelineExecutorResult } from '../PipelineExecutorResult';
|
|
4
|
+
import type { $OngoingTaskResult } from './$OngoingTaskResult';
|
|
5
|
+
/**
|
|
6
|
+
* Stores one failed attempt, reports the expectation error, and throws the aggregated retry error after the final
|
|
7
|
+
* regular attempt.
|
|
8
|
+
*
|
|
9
|
+
* @private function of `executeAttempts`
|
|
10
|
+
*/
|
|
11
|
+
export declare function handleAttemptFailure(options: {
|
|
12
|
+
/**
|
|
13
|
+
* Expectation error raised by the current attempt.
|
|
14
|
+
*/
|
|
15
|
+
readonly error: ExpectError;
|
|
16
|
+
/**
|
|
17
|
+
* Zero-based attempt index for the current execution loop.
|
|
18
|
+
*/
|
|
19
|
+
readonly attemptIndex: number;
|
|
20
|
+
/**
|
|
21
|
+
* Maximum number of attempts for the current task type.
|
|
22
|
+
*/
|
|
23
|
+
readonly maxAttempts: number;
|
|
24
|
+
/**
|
|
25
|
+
* Maximum number of model execution attempts for prompt tasks.
|
|
26
|
+
*/
|
|
27
|
+
readonly maxExecutionAttempts: number;
|
|
28
|
+
/**
|
|
29
|
+
* Callback invoked with partial progress updates.
|
|
30
|
+
*/
|
|
31
|
+
onProgress(newOngoingResult: PartialDeep<PipelineExecutorResult>): Promisable<void>;
|
|
32
|
+
/**
|
|
33
|
+
* String identifier for the pipeline, used for error reporting.
|
|
34
|
+
*/
|
|
35
|
+
readonly pipelineIdentification: string;
|
|
36
|
+
/**
|
|
37
|
+
* Mutable per-task execution state.
|
|
38
|
+
*/
|
|
39
|
+
readonly $ongoingTaskResult: $OngoingTaskResult;
|
|
40
|
+
}): void;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { Promisable, ReadonlyDeep, WritableDeep } from 'type-fest';
|
|
2
|
+
import type { TaskJson } from '../../pipeline/PipelineJson/TaskJson';
|
|
3
|
+
import type { LlmCall } from '../../types/LlmCall';
|
|
4
|
+
import type { ExecutionReportJson } from '../execution-report/ExecutionReportJson';
|
|
5
|
+
import type { $OngoingTaskResult } from './$OngoingTaskResult';
|
|
6
|
+
/**
|
|
7
|
+
* Appends the prompt execution report for prompt-task attempts.
|
|
8
|
+
*
|
|
9
|
+
* @private function of `executeAttempts`
|
|
10
|
+
*/
|
|
11
|
+
export declare function reportPromptExecution(options: {
|
|
12
|
+
/**
|
|
13
|
+
* Metadata describing the current loop iteration.
|
|
14
|
+
*/
|
|
15
|
+
readonly attempt: {
|
|
16
|
+
readonly isJokerAttempt: boolean;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Task currently being executed.
|
|
20
|
+
*/
|
|
21
|
+
readonly task: ReadonlyDeep<TaskJson>;
|
|
22
|
+
/**
|
|
23
|
+
* Mutable execution report object to append prompt execution data to.
|
|
24
|
+
*/
|
|
25
|
+
readonly $executionReport: WritableDeep<ExecutionReportJson>;
|
|
26
|
+
/**
|
|
27
|
+
* Optional callback invoked with each LLM call.
|
|
28
|
+
*/
|
|
29
|
+
logLlmCall?(llmCall: LlmCall): Promisable<void>;
|
|
30
|
+
/**
|
|
31
|
+
* Mutable per-task execution state.
|
|
32
|
+
*/
|
|
33
|
+
readonly $ongoingTaskResult: $OngoingTaskResult;
|
|
34
|
+
}): void;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { number_percent } from '../types/number_percent';
|
|
2
|
+
import type { chococake } from '../utils/organization/really_any';
|
|
3
|
+
import type { task_status } from './ExecutionTask';
|
|
4
|
+
/**
|
|
5
|
+
* Shared type for task TLDR information.
|
|
6
|
+
*
|
|
7
|
+
* @private internal type of `ExecutionTask`
|
|
8
|
+
*/
|
|
9
|
+
type TaskTldrInfo = {
|
|
10
|
+
readonly percent: number_percent;
|
|
11
|
+
readonly message: string;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Snapshot of the mutable task state needed to resolve the fallback TLDR.
|
|
15
|
+
*
|
|
16
|
+
* @private internal type of `ExecutionTask`
|
|
17
|
+
*/
|
|
18
|
+
type ResolveTaskTldrOptions = {
|
|
19
|
+
readonly customTldr: TaskTldrInfo | null;
|
|
20
|
+
readonly currentValue: chococake;
|
|
21
|
+
readonly status: task_status;
|
|
22
|
+
readonly createdAt: Date;
|
|
23
|
+
readonly errors: ReadonlyArray<Error>;
|
|
24
|
+
readonly warnings: ReadonlyArray<Error>;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Resolves the short task summary shown in the UI.
|
|
28
|
+
*
|
|
29
|
+
* @private internal helper function of `ExecutionTask`
|
|
30
|
+
*/
|
|
31
|
+
export declare function resolveTaskTldr(options: ResolveTaskTldrOptions): TaskTldrInfo;
|
|
32
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -27,50 +27,49 @@ import type { CreateAgentLlmExecutionToolsOptions } from './CreateAgentLlmExecut
|
|
|
27
27
|
export declare class AgentLlmExecutionTools implements LlmExecutionTools {
|
|
28
28
|
protected readonly options: CreateAgentLlmExecutionToolsOptions;
|
|
29
29
|
/**
|
|
30
|
-
* Cached
|
|
30
|
+
* Cached model requirements to avoid re-parsing the agent source.
|
|
31
31
|
*/
|
|
32
|
-
private
|
|
32
|
+
private _cachedModelRequirements;
|
|
33
33
|
/**
|
|
34
|
-
*
|
|
34
|
+
* Cached parsed agent information.
|
|
35
35
|
*/
|
|
36
|
-
private
|
|
36
|
+
private _cachedAgentInfo;
|
|
37
37
|
/**
|
|
38
|
-
*
|
|
38
|
+
* Optional server-precomputed model requirements reused until the source changes.
|
|
39
39
|
*/
|
|
40
|
-
private
|
|
40
|
+
private precomputedModelRequirements;
|
|
41
41
|
/**
|
|
42
|
-
*
|
|
42
|
+
* Dedicated prompt preparation facade used before backend dispatch.
|
|
43
43
|
*/
|
|
44
|
-
private
|
|
44
|
+
private readonly promptPreparer;
|
|
45
45
|
/**
|
|
46
|
-
*
|
|
46
|
+
* Dedicated OpenAI AgentKit runner used when the wrapped tools support AgentKit preparation.
|
|
47
47
|
*/
|
|
48
|
-
private
|
|
48
|
+
private readonly agentKitRunner;
|
|
49
49
|
/**
|
|
50
|
-
*
|
|
50
|
+
* Dedicated OpenAI Assistant runner used when the wrapped tools use Assistants.
|
|
51
51
|
*/
|
|
52
|
-
private
|
|
52
|
+
private readonly openAiAssistantRunner;
|
|
53
53
|
/**
|
|
54
|
-
* Creates new AgentLlmExecutionTools
|
|
54
|
+
* Creates new AgentLlmExecutionTools.
|
|
55
55
|
*
|
|
56
|
-
* @param
|
|
57
|
-
* @param agentSource The agent source string that defines the agent's behavior
|
|
56
|
+
* @param options - The underlying LLM tools and agent source configuration.
|
|
58
57
|
*/
|
|
59
58
|
constructor(options: CreateAgentLlmExecutionToolsOptions);
|
|
60
59
|
/**
|
|
61
|
-
* Updates the agent source and clears the cache
|
|
60
|
+
* Updates the agent source and clears the cache.
|
|
62
61
|
*
|
|
63
|
-
* @param agentSource The new agent source string
|
|
62
|
+
* @param agentSource - The new agent source string.
|
|
64
63
|
*/
|
|
65
64
|
protected updateAgentSource(agentSource: string_book): void;
|
|
66
65
|
/**
|
|
67
|
-
*
|
|
66
|
+
* Returns cached or parsed agent information.
|
|
68
67
|
*/
|
|
69
68
|
private getAgentInfo;
|
|
70
69
|
/**
|
|
71
|
-
*
|
|
70
|
+
* Returns cached or compiled agent model requirements.
|
|
72
71
|
*
|
|
73
|
-
* Note: [🐤] This is
|
|
72
|
+
* Note: [🐤] This is named `getModelRequirements` *(not `getAgentModelRequirements`)* because in future these two will be united.
|
|
74
73
|
*/
|
|
75
74
|
getModelRequirements(): Promise<AgentModelRequirements>;
|
|
76
75
|
get title(): string_title & string_markdown_text;
|
|
@@ -78,62 +77,22 @@ export declare class AgentLlmExecutionTools implements LlmExecutionTools {
|
|
|
78
77
|
get profile(): ChatParticipant | undefined;
|
|
79
78
|
checkConfiguration(): Promisable<void>;
|
|
80
79
|
/**
|
|
81
|
-
* Returns a virtual model name representing the agent behavior
|
|
80
|
+
* Returns a virtual model name representing the agent behavior.
|
|
82
81
|
*/
|
|
83
82
|
get modelName(): string_model_name;
|
|
84
83
|
listModels(): Promisable<ReadonlyArray<AvailableModel>>;
|
|
85
84
|
/**
|
|
86
|
-
* Calls the chat model with agent-specific system prompt and requirements
|
|
85
|
+
* Calls the chat model with agent-specific system prompt and requirements.
|
|
87
86
|
*/
|
|
88
87
|
callChatModel(prompt: Prompt): Promise<ChatPromptResult>;
|
|
89
88
|
/**
|
|
90
|
-
* Calls the chat model with agent-specific system prompt and requirements with streaming
|
|
89
|
+
* Calls the chat model with agent-specific system prompt and requirements with streaming.
|
|
91
90
|
*/
|
|
92
91
|
callChatModelStream(prompt: Prompt, onProgress: (chunk: ChatPromptResult) => void, options?: CallChatModelStreamOptions): Promise<ChatPromptResult>;
|
|
93
|
-
/**
|
|
94
|
-
* Ensures the agent wrapper only processes chat prompts.
|
|
95
|
-
*/
|
|
96
|
-
private requireChatPrompt;
|
|
97
|
-
/**
|
|
98
|
-
* Resolves agent requirements, attachments, and runtime overrides into one forwarded chat prompt.
|
|
99
|
-
*/
|
|
100
|
-
private prepareChatPrompt;
|
|
101
|
-
/**
|
|
102
|
-
* Removes bookkeeping-only properties from compiled agent requirements before forwarding them.
|
|
103
|
-
*/
|
|
104
|
-
private getSanitizedAgentModelRequirements;
|
|
105
92
|
/**
|
|
106
93
|
* Dispatches one prepared agent prompt to the correct underlying LLM backend.
|
|
107
94
|
*/
|
|
108
95
|
private callPreparedChatModelStream;
|
|
109
|
-
/**
|
|
110
|
-
* Runs one prepared prompt through the OpenAI AgentKit backend.
|
|
111
|
-
*/
|
|
112
|
-
private callOpenAiAgentKitChatModelStream;
|
|
113
|
-
/**
|
|
114
|
-
* Resolves the AgentKit cache state for the current prompt, including external and in-memory caches.
|
|
115
|
-
*/
|
|
116
|
-
private resolveAgentKitCacheState;
|
|
117
|
-
/**
|
|
118
|
-
* Returns a prepared AgentKit agent, creating one only when the cache could not satisfy the request.
|
|
119
|
-
*/
|
|
120
|
-
private getOrPrepareAgentKitAgent;
|
|
121
|
-
/**
|
|
122
|
-
* Stores freshly prepared AgentKit resources back into the in-memory caches when caching is allowed.
|
|
123
|
-
*/
|
|
124
|
-
private storeAgentKitCache;
|
|
125
|
-
/**
|
|
126
|
-
* Runs one prepared prompt through the deprecated OpenAI Assistant backend.
|
|
127
|
-
*/
|
|
128
|
-
private callOpenAiAssistantChatModelStream;
|
|
129
|
-
/**
|
|
130
|
-
* Returns an assistant instance matching the current agent requirements, reusing caches when possible.
|
|
131
|
-
*/
|
|
132
|
-
private getOrPrepareOpenAiAssistant;
|
|
133
|
-
/**
|
|
134
|
-
* Stores one assistant id in the shared assistant cache for this agent title.
|
|
135
|
-
*/
|
|
136
|
-
private storeAssistantCache;
|
|
137
96
|
/**
|
|
138
97
|
* Runs one prepared prompt through generic LLM tools that do not need special assistant preparation.
|
|
139
98
|
*/
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { CallChatModelStreamOptions } from '../../execution/LlmExecutionTools';
|
|
2
|
+
import type { ChatPromptResult, CommonPromptResult } from '../../execution/PromptResult';
|
|
3
|
+
import type { Prompt } from '../../types/Prompt';
|
|
4
|
+
import type { string_model_name } from '../../types/string_model_name';
|
|
5
|
+
import type { string_title } from '../../types/string_title';
|
|
6
|
+
import { OpenAiAgentKitExecutionTools } from '../openai/OpenAiAgentKitExecutionTools';
|
|
7
|
+
import type { AgentLlmExecutionToolsPromptPreparer } from './AgentLlmExecutionToolsPromptPreparer';
|
|
8
|
+
/**
|
|
9
|
+
* Handles OpenAI AgentKit-backed executions for `AgentLlmExecutionTools`.
|
|
10
|
+
*
|
|
11
|
+
* @private internal utility of `AgentLlmExecutionTools`
|
|
12
|
+
*/
|
|
13
|
+
export declare class AgentLlmExecutionToolsAgentKitRunner {
|
|
14
|
+
private readonly context;
|
|
15
|
+
/**
|
|
16
|
+
* Cached AgentKit agents to avoid rebuilding identical instances.
|
|
17
|
+
*/
|
|
18
|
+
private static agentKitAgentCache;
|
|
19
|
+
/**
|
|
20
|
+
* Cache of OpenAI vector stores to avoid creating duplicates.
|
|
21
|
+
*/
|
|
22
|
+
private static vectorStoreCache;
|
|
23
|
+
constructor(context: {
|
|
24
|
+
readonly getTitle: () => string_title;
|
|
25
|
+
readonly getModelName: () => string_model_name;
|
|
26
|
+
readonly isVerbose?: boolean;
|
|
27
|
+
readonly assistantPreparationMode?: 'internal' | 'external';
|
|
28
|
+
});
|
|
29
|
+
/**
|
|
30
|
+
* Runs one prepared prompt through the OpenAI AgentKit backend.
|
|
31
|
+
*/
|
|
32
|
+
callChatModelStream(options: {
|
|
33
|
+
readonly llmTools: OpenAiAgentKitExecutionTools;
|
|
34
|
+
readonly originalPrompt: Prompt;
|
|
35
|
+
readonly preparedChatPrompt: Awaited<ReturnType<AgentLlmExecutionToolsPromptPreparer['prepareChatPrompt']>>;
|
|
36
|
+
readonly onProgress: (chunk: ChatPromptResult) => void;
|
|
37
|
+
readonly streamOptions?: CallChatModelStreamOptions;
|
|
38
|
+
}): Promise<CommonPromptResult>;
|
|
39
|
+
/**
|
|
40
|
+
* Resolves the AgentKit cache state for the current prompt, including external and in-memory caches.
|
|
41
|
+
*/
|
|
42
|
+
private resolveAgentKitCacheState;
|
|
43
|
+
/**
|
|
44
|
+
* Returns a prepared AgentKit agent, creating one only when the cache could not satisfy the request.
|
|
45
|
+
*/
|
|
46
|
+
private getOrPrepareAgentKitAgent;
|
|
47
|
+
/**
|
|
48
|
+
* Stores freshly prepared AgentKit resources back into the in-memory caches when caching is allowed.
|
|
49
|
+
*/
|
|
50
|
+
private storeAgentKitCache;
|
|
51
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { CallChatModelStreamOptions } from '../../execution/LlmExecutionTools';
|
|
2
|
+
import type { ChatPromptResult, CommonPromptResult } from '../../execution/PromptResult';
|
|
3
|
+
import type { Prompt } from '../../types/Prompt';
|
|
4
|
+
import type { string_model_name } from '../../types/string_model_name';
|
|
5
|
+
import type { string_title } from '../../types/string_title';
|
|
6
|
+
import { OpenAiAssistantExecutionTools } from '../openai/OpenAiAssistantExecutionTools';
|
|
7
|
+
import type { AgentLlmExecutionToolsPromptPreparer } from './AgentLlmExecutionToolsPromptPreparer';
|
|
8
|
+
/**
|
|
9
|
+
* Handles deprecated OpenAI Assistant-backed executions for `AgentLlmExecutionTools`.
|
|
10
|
+
*
|
|
11
|
+
* @private internal utility of `AgentLlmExecutionTools`
|
|
12
|
+
*/
|
|
13
|
+
export declare class AgentLlmExecutionToolsOpenAiAssistantRunner {
|
|
14
|
+
private readonly context;
|
|
15
|
+
/**
|
|
16
|
+
* Cache of OpenAI assistants to avoid creating duplicates.
|
|
17
|
+
*/
|
|
18
|
+
private static assistantCache;
|
|
19
|
+
constructor(context: {
|
|
20
|
+
readonly getTitle: () => string_title;
|
|
21
|
+
readonly getModelName: () => string_model_name;
|
|
22
|
+
readonly isVerbose?: boolean;
|
|
23
|
+
readonly assistantPreparationMode?: 'internal' | 'external';
|
|
24
|
+
});
|
|
25
|
+
/**
|
|
26
|
+
* Runs one prepared prompt through the deprecated OpenAI Assistant backend.
|
|
27
|
+
*/
|
|
28
|
+
callChatModelStream(options: {
|
|
29
|
+
readonly llmTools: OpenAiAssistantExecutionTools;
|
|
30
|
+
readonly originalPrompt: Prompt;
|
|
31
|
+
readonly preparedChatPrompt: Awaited<ReturnType<AgentLlmExecutionToolsPromptPreparer['prepareChatPrompt']>>;
|
|
32
|
+
readonly onProgress: (chunk: ChatPromptResult) => void;
|
|
33
|
+
readonly streamOptions?: CallChatModelStreamOptions;
|
|
34
|
+
}): Promise<CommonPromptResult>;
|
|
35
|
+
/**
|
|
36
|
+
* Returns an assistant instance matching the current agent requirements, reusing caches when possible.
|
|
37
|
+
*/
|
|
38
|
+
private getOrPrepareOpenAiAssistant;
|
|
39
|
+
/**
|
|
40
|
+
* Stores one assistant id in the shared assistant cache for this agent title.
|
|
41
|
+
*/
|
|
42
|
+
private storeAssistantCache;
|
|
43
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { AgentModelRequirements } from '../../book-2.0/agent-source/AgentModelRequirements';
|
|
2
|
+
import type { ChatPrompt, Prompt } from '../../types/Prompt';
|
|
3
|
+
import type { string_title } from '../../types/string_title';
|
|
4
|
+
/**
|
|
5
|
+
* Agent model requirements stripped of prompt-only bookkeeping before forwarding to runtime tools.
|
|
6
|
+
*/
|
|
7
|
+
type SanitizedAgentModelRequirements = Omit<AgentModelRequirements, '_metadata' | 'promptSuffix'>;
|
|
8
|
+
/**
|
|
9
|
+
* Resolves runtime prompts into the fully enriched prompt shape forwarded by `AgentLlmExecutionTools`.
|
|
10
|
+
*
|
|
11
|
+
* @private internal utility of `AgentLlmExecutionTools`
|
|
12
|
+
*/
|
|
13
|
+
export declare class AgentLlmExecutionToolsPromptPreparer {
|
|
14
|
+
private readonly context;
|
|
15
|
+
constructor(context: {
|
|
16
|
+
readonly getModelRequirements: () => Promise<AgentModelRequirements>;
|
|
17
|
+
readonly getTitle: () => string_title;
|
|
18
|
+
readonly isVerbose?: boolean;
|
|
19
|
+
readonly hasPrecomputedModelRequirements: () => boolean;
|
|
20
|
+
});
|
|
21
|
+
/**
|
|
22
|
+
* Resolves agent requirements, attachments, and runtime overrides into one forwarded chat prompt.
|
|
23
|
+
*/
|
|
24
|
+
prepareChatPrompt(prompt: Prompt): Promise<{
|
|
25
|
+
readonly forwardedPrompt: ChatPrompt;
|
|
26
|
+
readonly sanitizedRequirements: SanitizedAgentModelRequirements;
|
|
27
|
+
readonly mergedTools: Array<NonNullable<ChatPrompt['tools']>[number]>;
|
|
28
|
+
readonly knowledgeSourcesForAgent?: Array<string>;
|
|
29
|
+
readonly hasAttachmentSources: boolean;
|
|
30
|
+
readonly hasRuntimePromptTools: boolean;
|
|
31
|
+
}>;
|
|
32
|
+
/**
|
|
33
|
+
* Removes bookkeeping-only properties from compiled agent requirements before forwarding them.
|
|
34
|
+
*/
|
|
35
|
+
private getSanitizedAgentModelRequirements;
|
|
36
|
+
/**
|
|
37
|
+
* Ensures the agent wrapper only processes chat prompts.
|
|
38
|
+
*/
|
|
39
|
+
private requireChatPrompt;
|
|
40
|
+
}
|
|
41
|
+
export {};
|
package/umd/src/llm-providers/agent/emitAgentLlmExecutionToolsAssistantPreparationProgress.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { ChatPromptResult } from '../../execution/PromptResult';
|
|
2
|
+
import type { Prompt } from '../../types/Prompt';
|
|
3
|
+
import type { string_model_name } from '../../types/string_model_name';
|
|
4
|
+
/**
|
|
5
|
+
* Emits a progress update to signal assistant preparation before long setup work.
|
|
6
|
+
*
|
|
7
|
+
* @private internal utility of `AgentLlmExecutionTools`
|
|
8
|
+
*/
|
|
9
|
+
export declare function emitAgentLlmExecutionToolsAssistantPreparationProgress(options: {
|
|
10
|
+
/**
|
|
11
|
+
* Callback to send progress updates to the caller.
|
|
12
|
+
*/
|
|
13
|
+
readonly onProgress: (chunk: ChatPromptResult) => void;
|
|
14
|
+
/**
|
|
15
|
+
* Original prompt being executed.
|
|
16
|
+
*/
|
|
17
|
+
readonly prompt: Prompt;
|
|
18
|
+
/**
|
|
19
|
+
* Model name used for the update payload.
|
|
20
|
+
*/
|
|
21
|
+
readonly modelName: string_model_name;
|
|
22
|
+
/**
|
|
23
|
+
* Optional detail describing the current preparation phase.
|
|
24
|
+
*/
|
|
25
|
+
readonly phase?: string;
|
|
26
|
+
}): void;
|