@promptbook/google 0.112.0-71 → 0.112.0-73
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/index.es.js +1 -1
- package/esm/src/book-3.0/Book.d.ts +6 -0
- package/esm/src/book-components/Chat/save/_common/chatExportRendering.d.ts +28 -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 +1 -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 +4 -4
- package/esm/src/book-components/Chat/save/markdown/mdSaveFormatDefinition.d.ts +1 -1
- 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 +3 -2
- package/esm/src/book-components/Chat/save/pdf/pdfSaveFormatDefinition.d.ts +2 -2
- 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/getToolCallChipletInfo.test.d.ts +1 -0
- package/esm/src/book-components/Chat/utils/renderMarkdown.d.ts +26 -0
- package/esm/src/cli/cli-commands/agent/agentRunCliOptions.d.ts +14 -2
- package/esm/src/cli/cli-commands/agent/initializeAgentRunnerCommand.d.ts +2 -0
- package/esm/src/cli/cli-commands/common/handleActionErrors.d.ts +9 -4
- package/esm/src/cli/cli-commands/run/prepareRunCommandResources.d.ts +20 -0
- package/esm/src/cli/cli-commands/run/resolveRunInputParameters.d.ts +12 -0
- package/esm/src/cli/cli-commands/run/runCommandAction.d.ts +21 -0
- package/esm/src/cli/cli-commands/run/runPipelineExecution.d.ts +14 -0
- package/esm/src/cli/cli-commands/run.d.ts +1 -1
- package/esm/src/conversion/parsePipeline/applyPipelineHead.d.ts +8 -0
- package/esm/src/conversion/parsePipeline/createInitialPipelineJson.d.ts +8 -0
- package/esm/src/conversion/parsePipeline/createUniqueSectionNameResolver.d.ts +14 -0
- package/esm/src/conversion/parsePipeline/defineParameter.d.ts +8 -0
- package/esm/src/conversion/parsePipeline/extractPipelineDescription.d.ts +6 -0
- package/esm/src/conversion/parsePipeline/finalizeParsedPipeline.d.ts +8 -0
- package/esm/src/conversion/parsePipeline/getPipelineIdentification.d.ts +7 -0
- package/esm/src/conversion/parsePipeline/parsePreparedPipelineSections.d.ts +18 -0
- package/esm/src/conversion/parsePipeline/preparePipelineString.d.ts +8 -0
- package/esm/src/conversion/parsePipeline/processPipelineSection.d.ts +9 -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/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 +2 -2
- package/umd/index.umd.js +1 -1
- package/umd/src/book-3.0/Book.d.ts +6 -0
- package/umd/src/book-components/Chat/save/_common/chatExportRendering.d.ts +28 -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 +1 -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 +4 -4
- package/umd/src/book-components/Chat/save/markdown/mdSaveFormatDefinition.d.ts +1 -1
- 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 +3 -2
- package/umd/src/book-components/Chat/save/pdf/pdfSaveFormatDefinition.d.ts +2 -2
- 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/getToolCallChipletInfo.test.d.ts +1 -0
- package/umd/src/book-components/Chat/utils/renderMarkdown.d.ts +26 -0
- package/umd/src/cli/cli-commands/agent/agentRunCliOptions.d.ts +14 -2
- package/umd/src/cli/cli-commands/agent/initializeAgentRunnerCommand.d.ts +2 -0
- package/umd/src/cli/cli-commands/common/handleActionErrors.d.ts +9 -4
- package/umd/src/cli/cli-commands/run/prepareRunCommandResources.d.ts +20 -0
- package/umd/src/cli/cli-commands/run/resolveRunInputParameters.d.ts +12 -0
- package/umd/src/cli/cli-commands/run/runCommandAction.d.ts +21 -0
- package/umd/src/cli/cli-commands/run/runPipelineExecution.d.ts +14 -0
- package/umd/src/cli/cli-commands/run.d.ts +1 -1
- package/umd/src/conversion/parsePipeline/applyPipelineHead.d.ts +8 -0
- package/umd/src/conversion/parsePipeline/createInitialPipelineJson.d.ts +8 -0
- package/umd/src/conversion/parsePipeline/createUniqueSectionNameResolver.d.ts +14 -0
- package/umd/src/conversion/parsePipeline/defineParameter.d.ts +8 -0
- package/umd/src/conversion/parsePipeline/extractPipelineDescription.d.ts +6 -0
- package/umd/src/conversion/parsePipeline/finalizeParsedPipeline.d.ts +8 -0
- package/umd/src/conversion/parsePipeline/getPipelineIdentification.d.ts +7 -0
- package/umd/src/conversion/parsePipeline/parsePreparedPipelineSections.d.ts +18 -0
- package/umd/src/conversion/parsePipeline/preparePipelineString.d.ts +8 -0
- package/umd/src/conversion/parsePipeline/processPipelineSection.d.ts +9 -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/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
|
@@ -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;
|
|
@@ -1,60 +1,13 @@
|
|
|
1
1
|
import { Agent as AgentFromKit } from '@openai/agents';
|
|
2
|
-
import OpenAI from 'openai';
|
|
3
2
|
import type { CallChatModelStreamOptions, LlmExecutionTools } from '../../execution/LlmExecutionTools';
|
|
4
3
|
import type { ChatPromptResult } from '../../execution/PromptResult';
|
|
5
4
|
import type { ModelRequirements } from '../../types/ModelRequirements';
|
|
6
5
|
import type { Prompt } from '../../types/Prompt';
|
|
7
6
|
import type { string_markdown, string_markdown_text } from '../../types/string_markdown';
|
|
8
7
|
import type { string_title } from '../../types/string_title';
|
|
9
|
-
import type { TODO_any } from '../../utils/organization/TODO_any';
|
|
10
8
|
import type { OpenAiAgentKitExecutionToolsOptions } from './OpenAiAgentKitExecutionToolsOptions';
|
|
9
|
+
import { OpenAiAgentKitExecutionToolsOutputTypeMapper } from './OpenAiAgentKitExecutionToolsOutputTypeMapper';
|
|
11
10
|
import { OpenAiVectorStoreHandler } from './OpenAiVectorStoreHandler';
|
|
12
|
-
/**
|
|
13
|
-
* Represents the AgentKit output configuration used to match OpenAI `response_format` expectations.
|
|
14
|
-
*
|
|
15
|
-
* @private utility of Open AI
|
|
16
|
-
*/
|
|
17
|
-
export type AgentOutputType = 'text' | JsonSchemaDefinition;
|
|
18
|
-
/**
|
|
19
|
-
* Type describing Json schema definition entry.
|
|
20
|
-
*/
|
|
21
|
-
type JsonSchemaDefinitionEntry = {
|
|
22
|
-
type?: string;
|
|
23
|
-
description?: string;
|
|
24
|
-
properties?: Record<string, JsonSchemaDefinitionEntry>;
|
|
25
|
-
required?: Array<string>;
|
|
26
|
-
items?: JsonSchemaDefinitionEntry;
|
|
27
|
-
[key: string]: TODO_any;
|
|
28
|
-
};
|
|
29
|
-
/**
|
|
30
|
-
* Definition of Json schema.
|
|
31
|
-
*/
|
|
32
|
-
type JsonSchemaDefinition = {
|
|
33
|
-
type: 'json_schema';
|
|
34
|
-
name: string;
|
|
35
|
-
strict: boolean;
|
|
36
|
-
schema: {
|
|
37
|
-
type: 'object';
|
|
38
|
-
properties: Record<string, JsonSchemaDefinitionEntry>;
|
|
39
|
-
required: Array<string>;
|
|
40
|
-
additionalProperties: boolean;
|
|
41
|
-
description?: string;
|
|
42
|
-
};
|
|
43
|
-
};
|
|
44
|
-
/**
|
|
45
|
-
* Type describing open Ai chat response format.
|
|
46
|
-
*/
|
|
47
|
-
type OpenAiChatResponseFormat = OpenAI.Chat.Completions.ChatCompletionCreateParamsNonStreaming['response_format'];
|
|
48
|
-
/**
|
|
49
|
-
* Maps OpenAI `response_format` payloads to AgentKit output types so the runner can forward
|
|
50
|
-
* structured-output preferences to OpenAI while still reusing the same AgentKit agent instance.
|
|
51
|
-
*
|
|
52
|
-
* @param responseFormat - The OpenAI `response_format` payload from the user request.
|
|
53
|
-
* @returns An Agent output type compatible with the requested schema or `undefined` when no impact is required.
|
|
54
|
-
*
|
|
55
|
-
* @private utility of Open AI
|
|
56
|
-
*/
|
|
57
|
-
export declare function mapResponseFormatToAgentOutputType(responseFormat?: OpenAiChatResponseFormat): AgentOutputType | undefined;
|
|
58
11
|
/**
|
|
59
12
|
* Alias for OpenAI AgentKit agent to avoid naming confusion with Promptbook agents.
|
|
60
13
|
*/
|
|
@@ -66,6 +19,10 @@ type OpenAiAgentKitPreparedAgent = {
|
|
|
66
19
|
readonly agent: OpenAiAgentKitAgent;
|
|
67
20
|
readonly vectorStoreId?: string;
|
|
68
21
|
};
|
|
22
|
+
/**
|
|
23
|
+
* AgentKit output type returned by the dedicated response-format mapper.
|
|
24
|
+
*/
|
|
25
|
+
type OpenAiAgentKitAgentOutputType = ReturnType<typeof OpenAiAgentKitExecutionToolsOutputTypeMapper.mapResponseFormatToAgentOutputType>;
|
|
69
26
|
/**
|
|
70
27
|
* Execution tools for OpenAI AgentKit (Agents SDK).
|
|
71
28
|
*
|
|
@@ -73,9 +30,9 @@ type OpenAiAgentKitPreparedAgent = {
|
|
|
73
30
|
*/
|
|
74
31
|
export declare class OpenAiAgentKitExecutionTools extends OpenAiVectorStoreHandler implements LlmExecutionTools {
|
|
75
32
|
private preparedAgentKitAgent;
|
|
76
|
-
private readonly agentKitToolResultsByCallId;
|
|
77
|
-
private readonly agentKitToolSnapshotsByCallId;
|
|
78
33
|
private readonly agentKitModelName;
|
|
34
|
+
private readonly inputBuilder;
|
|
35
|
+
private readonly toolBuilder;
|
|
79
36
|
/**
|
|
80
37
|
* Creates OpenAI AgentKit execution tools.
|
|
81
38
|
*/
|
|
@@ -113,18 +70,6 @@ export declare class OpenAiAgentKitExecutionTools extends OpenAiVectorStoreHandl
|
|
|
113
70
|
readonly vectorStoreId?: string;
|
|
114
71
|
readonly storeAsPrepared?: boolean;
|
|
115
72
|
}): Promise<OpenAiAgentKitPreparedAgent>;
|
|
116
|
-
/**
|
|
117
|
-
* Ensures the AgentKit SDK is wired to the OpenAI client and API key.
|
|
118
|
-
*/
|
|
119
|
-
private ensureAgentKitDefaults;
|
|
120
|
-
/**
|
|
121
|
-
* Builds the tool list for AgentKit, including hosted file search when applicable.
|
|
122
|
-
*/
|
|
123
|
-
private buildAgentKitTools;
|
|
124
|
-
/**
|
|
125
|
-
* Resolves the configured script tools for tool execution.
|
|
126
|
-
*/
|
|
127
|
-
private resolveScriptTools;
|
|
128
73
|
/**
|
|
129
74
|
* Runs a prepared AgentKit agent and streams results back to the caller.
|
|
130
75
|
*/
|
|
@@ -135,50 +80,28 @@ export declare class OpenAiAgentKitExecutionTools extends OpenAiVectorStoreHandl
|
|
|
135
80
|
readonly onProgress: (chunk: ChatPromptResult & {
|
|
136
81
|
isFinished?: boolean;
|
|
137
82
|
}) => void;
|
|
138
|
-
readonly responseFormatOutputType?:
|
|
83
|
+
readonly responseFormatOutputType?: OpenAiAgentKitAgentOutputType;
|
|
139
84
|
/**
|
|
140
85
|
* Optional abort signal propagated from chat surfaces so stream generation can be cancelled.
|
|
141
86
|
*/
|
|
142
87
|
readonly signal?: AbortSignal;
|
|
143
88
|
}): Promise<ChatPromptResult>;
|
|
144
89
|
/**
|
|
145
|
-
*
|
|
146
|
-
*/
|
|
147
|
-
private buildAgentKitInputItems;
|
|
148
|
-
/**
|
|
149
|
-
* Builds the user message content for AgentKit runs, including file inputs when provided.
|
|
150
|
-
*/
|
|
151
|
-
private buildAgentKitUserContent;
|
|
152
|
-
/**
|
|
153
|
-
* Converts uploaded `File` objects into AgentKit `input_image` entries.
|
|
154
|
-
*/
|
|
155
|
-
private createAgentKitInputImageItemsFromFiles;
|
|
156
|
-
/**
|
|
157
|
-
* Converts image chat attachments into AgentKit `input_image` entries.
|
|
158
|
-
*
|
|
159
|
-
* Note: This keeps images in the same completion request as multimodal input.
|
|
160
|
-
*/
|
|
161
|
-
private createAgentKitInputImageItemsFromAttachments;
|
|
162
|
-
/**
|
|
163
|
-
* Builds AgentKit user content that can include text, uploaded files, and image attachments.
|
|
164
|
-
*/
|
|
165
|
-
private buildAgentKitUserContentWithAttachments;
|
|
166
|
-
/**
|
|
167
|
-
* Normalizes AgentKit tool outputs into a string for Promptbook tool call results.
|
|
168
|
-
*/
|
|
169
|
-
private formatAgentKitToolOutput;
|
|
170
|
-
/**
|
|
171
|
-
* Resolves the assistant-visible AgentKit tool response while preserving structured tool result data.
|
|
90
|
+
* Ensures the AgentKit SDK is wired to the OpenAI client and API key.
|
|
172
91
|
*/
|
|
173
|
-
private
|
|
92
|
+
private ensureAgentKitDefaults;
|
|
174
93
|
/**
|
|
175
|
-
*
|
|
94
|
+
* Builds the tool list for AgentKit while keeping the public facade small.
|
|
176
95
|
*/
|
|
177
|
-
private
|
|
96
|
+
private buildAgentKitTools;
|
|
178
97
|
/**
|
|
179
98
|
* Returns AgentKit-specific options.
|
|
180
99
|
*/
|
|
181
100
|
private get agentKitOptions();
|
|
101
|
+
/**
|
|
102
|
+
* Formats raw prompt content with the AgentKit model injected.
|
|
103
|
+
*/
|
|
104
|
+
private templatePromptContent;
|
|
182
105
|
/**
|
|
183
106
|
* Discriminant for type guards.
|
|
184
107
|
*/
|