@ljoukov/llm 7.0.14 → 7.0.16

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/dist/index.d.cts CHANGED
@@ -221,7 +221,7 @@ type LlmToolOutputContentItem = {
221
221
  readonly text: string;
222
222
  } | LlmInputImagePart | LlmInputFilePart;
223
223
  type LlmImageSize = "1K" | "2K" | "4K";
224
- type LlmThinkingLevel = "low" | "medium" | "high";
224
+ type LlmThinkingLevel = "low" | "medium" | "high" | "xhigh";
225
225
  type LlmWebSearchMode = "cached" | "live";
226
226
  type LlmOpenAiShellNetworkPolicy = {
227
227
  readonly type: "disabled";
@@ -326,6 +326,17 @@ type LlmTextResult = {
326
326
  readonly usage?: LlmUsageTokens;
327
327
  readonly costUsd: number;
328
328
  readonly grounding?: GroundingMetadata;
329
+ readonly openAi?: LlmOpenAiResponseMetadata;
330
+ };
331
+ type LlmOpenAiResponseContainerReference = {
332
+ readonly containerId: string;
333
+ readonly toolType: "shell" | "code_interpreter";
334
+ readonly itemId?: string;
335
+ readonly callId?: string;
336
+ };
337
+ type LlmOpenAiResponseMetadata = {
338
+ readonly responseId?: string;
339
+ readonly containers: readonly LlmOpenAiResponseContainerReference[];
329
340
  };
330
341
  type LlmTextStream = {
331
342
  readonly events: AsyncIterable<LlmStreamEvent>;
@@ -663,6 +674,59 @@ declare const files: {
663
674
  readonly content: typeof filesContent;
664
675
  };
665
676
 
677
+ type LlmOpenAiContainerNetworkPolicy = {
678
+ readonly type: "disabled";
679
+ } | {
680
+ readonly type: "allowlist";
681
+ readonly allowedDomains: readonly string[];
682
+ readonly domainSecrets?: readonly {
683
+ readonly domain: string;
684
+ readonly name: string;
685
+ readonly value: string;
686
+ }[];
687
+ };
688
+ type LlmOpenAiContainerCreateOptions = {
689
+ readonly name: string;
690
+ readonly fileIds?: readonly string[];
691
+ readonly memoryLimit?: "1g" | "4g" | "16g" | "64g";
692
+ readonly networkPolicy?: LlmOpenAiContainerNetworkPolicy;
693
+ readonly expiresAfterMinutes?: number;
694
+ };
695
+ type LlmOpenAiContainer = {
696
+ readonly id: string;
697
+ readonly name: string;
698
+ readonly status: string;
699
+ readonly createdAt?: number;
700
+ readonly lastActiveAt?: number;
701
+ readonly memoryLimit?: "1g" | "4g" | "16g" | "64g";
702
+ };
703
+ type LlmOpenAiContainerFile = {
704
+ readonly id: string;
705
+ readonly containerId: string;
706
+ readonly path: string;
707
+ readonly bytes?: number | null;
708
+ readonly createdAt?: number;
709
+ readonly source?: string;
710
+ };
711
+ type LlmOpenAiContainerFileUpload = {
712
+ readonly containerId: string;
713
+ readonly filename: string;
714
+ readonly data: ArrayBuffer | ArrayBufferView | Blob | Response | AsyncIterable<ArrayBufferView>;
715
+ readonly mimeType?: string;
716
+ };
717
+ declare function createOpenAiContainer(options: LlmOpenAiContainerCreateOptions): Promise<LlmOpenAiContainer>;
718
+ declare function deleteOpenAiContainer(containerId: string): Promise<void>;
719
+ declare function listOpenAiContainerFiles(containerId: string): Promise<readonly LlmOpenAiContainerFile[]>;
720
+ declare function uploadOpenAiContainerFile(upload: LlmOpenAiContainerFileUpload): Promise<LlmOpenAiContainerFile>;
721
+ declare function downloadOpenAiContainerFile(params: {
722
+ readonly containerId: string;
723
+ readonly fileId: string;
724
+ }): Promise<Uint8Array>;
725
+ declare function downloadOpenAiContainerFileText(params: {
726
+ readonly containerId: string;
727
+ readonly fileId: string;
728
+ }): Promise<string>;
729
+
666
730
  /**
667
731
  * Loads `.env.local` from `process.cwd()` once.
668
732
  *
@@ -1108,4 +1172,4 @@ declare const FIREWORKS_DEFAULT_GPT_OSS_120B_MODEL: FireworksModelId;
1108
1172
  declare function isFireworksModelId(value: string): value is FireworksModelId;
1109
1173
  declare function resolveFireworksModelId(model: string): string | undefined;
1110
1174
 
1111
- export { type AgentDirectoryEntry, type AgentFilesystem, type AgentFilesystemToolAccessContext, type AgentFilesystemToolAccessHook, type AgentFilesystemToolAction, type AgentFilesystemToolConfig, type AgentFilesystemToolName, type AgentFilesystemToolProfile, type AgentFilesystemToolSelection, type AgentFilesystemToolsOptions, type AgentLogLineSink, type AgentLoggingConfig, type AgentLoggingSelection, type AgentLoopStream, type AgentPathInfo, type AgentPathKind, type AgentRunCompletedTelemetryEvent, type AgentRunStartedTelemetryEvent, type AgentRunStreamTelemetryEvent, type AgentSubagentToolConfig, type AgentSubagentToolPromptPattern, type AgentSubagentToolSelection, type ApplyPatchAccessContext, type ApplyPatchAccessHook, type ApplyPatchRequest, type ApplyPatchResult, type ApplyPatchToolInput, type AssessmentSubagentInput, CHATGPT_IMAGE_MODEL_IDS, CHATGPT_MODEL_IDS, CODEX_APPLY_PATCH_FREEFORM_TOOL_DESCRIPTION, CODEX_APPLY_PATCH_JSON_TOOL_DESCRIPTION, CODEX_APPLY_PATCH_LARK_GRAMMAR, type CandidateAssessment, type CandidateEvolutionOptions, type CandidateEvolutionResult, type CandidateEvolutionSnapshot, type CandidateEvolutionStats, type CandidateFeedbackEntry, type CandidateIssue, type CandidateProposal, type CandidateRecord, type ChatGptAuthProfile, type ChatGptImageModelId, type ChatGptModelId, type CodexApplyPatchToolInput, type CodexGrepFilesToolInput, type CodexListDirToolInput, type CodexReadFileToolInput, type CodexViewImageToolInput, type CreateApplyPatchToolOptions, DEFAULT_FILE_TTL_SECONDS, DEFAULT_SIGNED_URL_TTL_SECONDS, EXPERIMENTAL_CHATGPT_MODEL_PREFIX, type ExperimentalChatGptModelId, FIREWORKS_DEFAULT_GLM_MODEL, FIREWORKS_DEFAULT_GPT_OSS_120B_MODEL, FIREWORKS_DEFAULT_KIMI_MODEL, FIREWORKS_DEFAULT_MINIMAX_MODEL, FIREWORKS_MODEL_IDS, type FeedbackScope, type FireworksModelId, GEMINI_IMAGE_MODEL_IDS, GEMINI_MODEL_IDS, GEMINI_TEXT_MODEL_IDS, type GeminiGlobToolInput, type GeminiGrepSearchToolInput, type GeminiImageModelId, type GeminiListDirectoryToolInput, type GeminiModelId, type GeminiReadFileToolInput, type GeminiReplaceToolInput, type GeminiRgSearchToolInput, type GeminiTextModelId, type GeminiWriteFileToolInput, type GenerationSubagent, type GenerationSubagentInput, InMemoryAgentFilesystem, type JsonSchema, LLM_IMAGE_MODEL_IDS, LLM_MODEL_IDS, LLM_TEXT_MODEL_IDS, type ListedChatGptModelId, type LlmBaseRequest, type LlmBlockedEvent, type LlmCallCompletedTelemetryEvent, type LlmCallStartedTelemetryEvent, type LlmCallStreamTelemetryEvent, type LlmChatGptGenerateImagesRequest, type LlmContent, type LlmContentPart, type LlmCustomTool, type LlmCustomToolInputFormat, type LlmExecutableTool, type LlmFileCreateParams, type LlmFileDeleted, type LlmFileUploadBackend, type LlmFileUploadEvent, type LlmFileUploadMetrics, type LlmFileUploadMode, type LlmFileUploadSource, type LlmFunctionTool, type LlmGeminiGenerateImagesRequest, type LlmGenerateImagesRequest, type LlmImageData, type LlmImageModelId, type LlmImageSize, type LlmInput, type LlmInputFilePart, type LlmInputImagePart, type LlmInputMessage, LlmJsonCallError, type LlmJsonRequest, type LlmJsonStream, type LlmJsonStreamEvent, type LlmJsonStreamRequest, type LlmMediaResolution, type LlmModelEvent, type LlmModelId, type LlmOpenAiGenerateImagesRequest, type LlmOpenAiImageBackground, type LlmOpenAiImageModeration, type LlmOpenAiImageNumImages, type LlmOpenAiImageOutputFormat, type LlmOpenAiImagePartialImageCount, type LlmOpenAiImageQuality, type LlmOpenAiImageResolution, type LlmOpenAiShellEnvironment, type LlmOpenAiShellNetworkPolicy, type LlmProvider, type LlmStoredFile, type LlmStreamEvent, type LlmTelemetryOperation, type LlmTextDeltaEvent, type LlmTextModelId, type LlmTextRequest, type LlmTextResult, type LlmTextStream, type LlmThinkingLevel, type LlmToolCallCompletedEvent, type LlmToolCallContext, type LlmToolCallResult, type LlmToolCallStartedEvent, type LlmToolCallStreamEvent, type LlmToolConfig, type LlmToolLoopRequest, type LlmToolLoopResult, type LlmToolLoopSteeringAppendResult, type LlmToolLoopSteeringChannel, type LlmToolLoopSteeringInput, type LlmToolLoopSteeringMessage, type LlmToolLoopStep, type LlmToolLoopStream, type LlmToolSet, type LlmUsageEvent, type LlmUsageTokens, type LlmWebSearchMode, type ModelConcurrencyConfig, type ModelConcurrencyProvider, OPENAI_GPT_IMAGE_2_AUTO_RESOLUTION, OPENAI_GPT_IMAGE_2_BACKGROUNDS, OPENAI_GPT_IMAGE_2_MODERATION_LEVELS, OPENAI_GPT_IMAGE_2_NUM_IMAGES, OPENAI_GPT_IMAGE_2_OUTPUT_FORMATS, OPENAI_GPT_IMAGE_2_PARTIAL_IMAGE_COUNTS, OPENAI_GPT_IMAGE_2_POPULAR_RESOLUTIONS, OPENAI_GPT_IMAGE_2_QUALITY_LEVELS, OPENAI_GPT_IMAGE_2_RESOLUTIONS, OPENAI_GPT_IMAGE_2_SIZE_CONSTRAINTS, OPENAI_IMAGE_MODEL_IDS, OPENAI_MODEL_IDS, type OpenAiGptImage2Background, type OpenAiGptImage2CustomResolution, type OpenAiGptImage2ListedResolution, type OpenAiGptImage2Moderation, type OpenAiGptImage2NumImages, type OpenAiGptImage2OutputFormat, type OpenAiGptImage2PartialImageCount, type OpenAiGptImage2PopularResolution, type OpenAiGptImage2Quality, type OpenAiGptImage2Resolution, type OpenAiGptImage2ResolutionValidationResult, type OpenAiImageModelId, type OpenAiModelId, type ParentSelectionConfig, type ParentSelectionMidpoint, type PostCheckRejection, type PostGenerationCheckInput, type RunAgentLoopRequest, type TelemetryConfig, type TelemetryEvent, type TelemetrySelection, type TelemetrySink, appendMarkdownSourcesSection, applyPatch, configureGemini, configureModelConcurrency, configureTelemetry, convertGooglePartsToLlmParts, createApplyPatchTool, createCodexApplyPatchTool, createCodexFilesystemToolSet, createCodexReadFileTool, createFilesystemToolSetForModel, createGeminiFilesystemToolSet, createGeminiReadFileTool, createGlobTool, createGrepFilesTool, createGrepSearchTool, createInMemoryAgentFilesystem, createListDirTool, createListDirectoryTool, createModelAgnosticFilesystemToolSet, createNodeAgentFilesystem, createReplaceTool, createRgSearchTool, createToolLoopSteeringChannel, createViewImageTool, createWriteFileTool, customTool, emptyFileUploadMetrics, encodeChatGptAuthJson, encodeChatGptAuthJsonB64, estimateCallCostUsd, exchangeChatGptOauthCode, files, generateImageInBatches, generateImages, generateJson, generateText, getChatGptAuthProfile, getCurrentToolCallContext, isChatGptImageModelId, isChatGptModelId, isExperimentalChatGptModelId, isFireworksModelId, isGeminiImageModelId, isGeminiModelId, isGeminiTextModelId, isLlmImageModelId, isLlmModelId, isLlmTextModelId, isOpenAiImageModelId, isOpenAiModelId, loadEnvFromFile, loadLocalEnv, parseJsonFromLlmText, refreshChatGptOauthToken, resetModelConcurrencyConfig, resetTelemetry, resolveChatGptImageProviderModel, resolveFilesystemToolProfile, resolveFireworksModelId, runAgentLoop, runCandidateEvolution, runToolLoop, sanitisePartForLogging, streamAgentLoop, streamJson, streamText, streamToolLoop, stripCodexCitationMarkers, toGeminiJsonSchema, tool, validateOpenAiGptImage2Resolution };
1175
+ export { type AgentDirectoryEntry, type AgentFilesystem, type AgentFilesystemToolAccessContext, type AgentFilesystemToolAccessHook, type AgentFilesystemToolAction, type AgentFilesystemToolConfig, type AgentFilesystemToolName, type AgentFilesystemToolProfile, type AgentFilesystemToolSelection, type AgentFilesystemToolsOptions, type AgentLogLineSink, type AgentLoggingConfig, type AgentLoggingSelection, type AgentLoopStream, type AgentPathInfo, type AgentPathKind, type AgentRunCompletedTelemetryEvent, type AgentRunStartedTelemetryEvent, type AgentRunStreamTelemetryEvent, type AgentSubagentToolConfig, type AgentSubagentToolPromptPattern, type AgentSubagentToolSelection, type ApplyPatchAccessContext, type ApplyPatchAccessHook, type ApplyPatchRequest, type ApplyPatchResult, type ApplyPatchToolInput, type AssessmentSubagentInput, CHATGPT_IMAGE_MODEL_IDS, CHATGPT_MODEL_IDS, CODEX_APPLY_PATCH_FREEFORM_TOOL_DESCRIPTION, CODEX_APPLY_PATCH_JSON_TOOL_DESCRIPTION, CODEX_APPLY_PATCH_LARK_GRAMMAR, type CandidateAssessment, type CandidateEvolutionOptions, type CandidateEvolutionResult, type CandidateEvolutionSnapshot, type CandidateEvolutionStats, type CandidateFeedbackEntry, type CandidateIssue, type CandidateProposal, type CandidateRecord, type ChatGptAuthProfile, type ChatGptImageModelId, type ChatGptModelId, type CodexApplyPatchToolInput, type CodexGrepFilesToolInput, type CodexListDirToolInput, type CodexReadFileToolInput, type CodexViewImageToolInput, type CreateApplyPatchToolOptions, DEFAULT_FILE_TTL_SECONDS, DEFAULT_SIGNED_URL_TTL_SECONDS, EXPERIMENTAL_CHATGPT_MODEL_PREFIX, type ExperimentalChatGptModelId, FIREWORKS_DEFAULT_GLM_MODEL, FIREWORKS_DEFAULT_GPT_OSS_120B_MODEL, FIREWORKS_DEFAULT_KIMI_MODEL, FIREWORKS_DEFAULT_MINIMAX_MODEL, FIREWORKS_MODEL_IDS, type FeedbackScope, type FireworksModelId, GEMINI_IMAGE_MODEL_IDS, GEMINI_MODEL_IDS, GEMINI_TEXT_MODEL_IDS, type GeminiGlobToolInput, type GeminiGrepSearchToolInput, type GeminiImageModelId, type GeminiListDirectoryToolInput, type GeminiModelId, type GeminiReadFileToolInput, type GeminiReplaceToolInput, type GeminiRgSearchToolInput, type GeminiTextModelId, type GeminiWriteFileToolInput, type GenerationSubagent, type GenerationSubagentInput, InMemoryAgentFilesystem, type JsonSchema, LLM_IMAGE_MODEL_IDS, LLM_MODEL_IDS, LLM_TEXT_MODEL_IDS, type ListedChatGptModelId, type LlmBaseRequest, type LlmBlockedEvent, type LlmCallCompletedTelemetryEvent, type LlmCallStartedTelemetryEvent, type LlmCallStreamTelemetryEvent, type LlmChatGptGenerateImagesRequest, type LlmContent, type LlmContentPart, type LlmCustomTool, type LlmCustomToolInputFormat, type LlmExecutableTool, type LlmFileCreateParams, type LlmFileDeleted, type LlmFileUploadBackend, type LlmFileUploadEvent, type LlmFileUploadMetrics, type LlmFileUploadMode, type LlmFileUploadSource, type LlmFunctionTool, type LlmGeminiGenerateImagesRequest, type LlmGenerateImagesRequest, type LlmImageData, type LlmImageModelId, type LlmImageSize, type LlmInput, type LlmInputFilePart, type LlmInputImagePart, type LlmInputMessage, LlmJsonCallError, type LlmJsonRequest, type LlmJsonStream, type LlmJsonStreamEvent, type LlmJsonStreamRequest, type LlmMediaResolution, type LlmModelEvent, type LlmModelId, type LlmOpenAiContainer, type LlmOpenAiContainerCreateOptions, type LlmOpenAiContainerFile, type LlmOpenAiContainerFileUpload, type LlmOpenAiContainerNetworkPolicy, type LlmOpenAiGenerateImagesRequest, type LlmOpenAiImageBackground, type LlmOpenAiImageModeration, type LlmOpenAiImageNumImages, type LlmOpenAiImageOutputFormat, type LlmOpenAiImagePartialImageCount, type LlmOpenAiImageQuality, type LlmOpenAiImageResolution, type LlmOpenAiResponseContainerReference, type LlmOpenAiResponseMetadata, type LlmOpenAiShellEnvironment, type LlmOpenAiShellNetworkPolicy, type LlmProvider, type LlmStoredFile, type LlmStreamEvent, type LlmTelemetryOperation, type LlmTextDeltaEvent, type LlmTextModelId, type LlmTextRequest, type LlmTextResult, type LlmTextStream, type LlmThinkingLevel, type LlmToolCallCompletedEvent, type LlmToolCallContext, type LlmToolCallResult, type LlmToolCallStartedEvent, type LlmToolCallStreamEvent, type LlmToolConfig, type LlmToolLoopRequest, type LlmToolLoopResult, type LlmToolLoopSteeringAppendResult, type LlmToolLoopSteeringChannel, type LlmToolLoopSteeringInput, type LlmToolLoopSteeringMessage, type LlmToolLoopStep, type LlmToolLoopStream, type LlmToolSet, type LlmUsageEvent, type LlmUsageTokens, type LlmWebSearchMode, type ModelConcurrencyConfig, type ModelConcurrencyProvider, OPENAI_GPT_IMAGE_2_AUTO_RESOLUTION, OPENAI_GPT_IMAGE_2_BACKGROUNDS, OPENAI_GPT_IMAGE_2_MODERATION_LEVELS, OPENAI_GPT_IMAGE_2_NUM_IMAGES, OPENAI_GPT_IMAGE_2_OUTPUT_FORMATS, OPENAI_GPT_IMAGE_2_PARTIAL_IMAGE_COUNTS, OPENAI_GPT_IMAGE_2_POPULAR_RESOLUTIONS, OPENAI_GPT_IMAGE_2_QUALITY_LEVELS, OPENAI_GPT_IMAGE_2_RESOLUTIONS, OPENAI_GPT_IMAGE_2_SIZE_CONSTRAINTS, OPENAI_IMAGE_MODEL_IDS, OPENAI_MODEL_IDS, type OpenAiGptImage2Background, type OpenAiGptImage2CustomResolution, type OpenAiGptImage2ListedResolution, type OpenAiGptImage2Moderation, type OpenAiGptImage2NumImages, type OpenAiGptImage2OutputFormat, type OpenAiGptImage2PartialImageCount, type OpenAiGptImage2PopularResolution, type OpenAiGptImage2Quality, type OpenAiGptImage2Resolution, type OpenAiGptImage2ResolutionValidationResult, type OpenAiImageModelId, type OpenAiModelId, type ParentSelectionConfig, type ParentSelectionMidpoint, type PostCheckRejection, type PostGenerationCheckInput, type RunAgentLoopRequest, type TelemetryConfig, type TelemetryEvent, type TelemetrySelection, type TelemetrySink, appendMarkdownSourcesSection, applyPatch, configureGemini, configureModelConcurrency, configureTelemetry, convertGooglePartsToLlmParts, createApplyPatchTool, createCodexApplyPatchTool, createCodexFilesystemToolSet, createCodexReadFileTool, createFilesystemToolSetForModel, createGeminiFilesystemToolSet, createGeminiReadFileTool, createGlobTool, createGrepFilesTool, createGrepSearchTool, createInMemoryAgentFilesystem, createListDirTool, createListDirectoryTool, createModelAgnosticFilesystemToolSet, createNodeAgentFilesystem, createOpenAiContainer, createReplaceTool, createRgSearchTool, createToolLoopSteeringChannel, createViewImageTool, createWriteFileTool, customTool, deleteOpenAiContainer, downloadOpenAiContainerFile, downloadOpenAiContainerFileText, emptyFileUploadMetrics, encodeChatGptAuthJson, encodeChatGptAuthJsonB64, estimateCallCostUsd, exchangeChatGptOauthCode, files, generateImageInBatches, generateImages, generateJson, generateText, getChatGptAuthProfile, getCurrentToolCallContext, isChatGptImageModelId, isChatGptModelId, isExperimentalChatGptModelId, isFireworksModelId, isGeminiImageModelId, isGeminiModelId, isGeminiTextModelId, isLlmImageModelId, isLlmModelId, isLlmTextModelId, isOpenAiImageModelId, isOpenAiModelId, listOpenAiContainerFiles, loadEnvFromFile, loadLocalEnv, parseJsonFromLlmText, refreshChatGptOauthToken, resetModelConcurrencyConfig, resetTelemetry, resolveChatGptImageProviderModel, resolveFilesystemToolProfile, resolveFireworksModelId, runAgentLoop, runCandidateEvolution, runToolLoop, sanitisePartForLogging, streamAgentLoop, streamJson, streamText, streamToolLoop, stripCodexCitationMarkers, toGeminiJsonSchema, tool, uploadOpenAiContainerFile, validateOpenAiGptImage2Resolution };
package/dist/index.d.ts CHANGED
@@ -221,7 +221,7 @@ type LlmToolOutputContentItem = {
221
221
  readonly text: string;
222
222
  } | LlmInputImagePart | LlmInputFilePart;
223
223
  type LlmImageSize = "1K" | "2K" | "4K";
224
- type LlmThinkingLevel = "low" | "medium" | "high";
224
+ type LlmThinkingLevel = "low" | "medium" | "high" | "xhigh";
225
225
  type LlmWebSearchMode = "cached" | "live";
226
226
  type LlmOpenAiShellNetworkPolicy = {
227
227
  readonly type: "disabled";
@@ -326,6 +326,17 @@ type LlmTextResult = {
326
326
  readonly usage?: LlmUsageTokens;
327
327
  readonly costUsd: number;
328
328
  readonly grounding?: GroundingMetadata;
329
+ readonly openAi?: LlmOpenAiResponseMetadata;
330
+ };
331
+ type LlmOpenAiResponseContainerReference = {
332
+ readonly containerId: string;
333
+ readonly toolType: "shell" | "code_interpreter";
334
+ readonly itemId?: string;
335
+ readonly callId?: string;
336
+ };
337
+ type LlmOpenAiResponseMetadata = {
338
+ readonly responseId?: string;
339
+ readonly containers: readonly LlmOpenAiResponseContainerReference[];
329
340
  };
330
341
  type LlmTextStream = {
331
342
  readonly events: AsyncIterable<LlmStreamEvent>;
@@ -663,6 +674,59 @@ declare const files: {
663
674
  readonly content: typeof filesContent;
664
675
  };
665
676
 
677
+ type LlmOpenAiContainerNetworkPolicy = {
678
+ readonly type: "disabled";
679
+ } | {
680
+ readonly type: "allowlist";
681
+ readonly allowedDomains: readonly string[];
682
+ readonly domainSecrets?: readonly {
683
+ readonly domain: string;
684
+ readonly name: string;
685
+ readonly value: string;
686
+ }[];
687
+ };
688
+ type LlmOpenAiContainerCreateOptions = {
689
+ readonly name: string;
690
+ readonly fileIds?: readonly string[];
691
+ readonly memoryLimit?: "1g" | "4g" | "16g" | "64g";
692
+ readonly networkPolicy?: LlmOpenAiContainerNetworkPolicy;
693
+ readonly expiresAfterMinutes?: number;
694
+ };
695
+ type LlmOpenAiContainer = {
696
+ readonly id: string;
697
+ readonly name: string;
698
+ readonly status: string;
699
+ readonly createdAt?: number;
700
+ readonly lastActiveAt?: number;
701
+ readonly memoryLimit?: "1g" | "4g" | "16g" | "64g";
702
+ };
703
+ type LlmOpenAiContainerFile = {
704
+ readonly id: string;
705
+ readonly containerId: string;
706
+ readonly path: string;
707
+ readonly bytes?: number | null;
708
+ readonly createdAt?: number;
709
+ readonly source?: string;
710
+ };
711
+ type LlmOpenAiContainerFileUpload = {
712
+ readonly containerId: string;
713
+ readonly filename: string;
714
+ readonly data: ArrayBuffer | ArrayBufferView | Blob | Response | AsyncIterable<ArrayBufferView>;
715
+ readonly mimeType?: string;
716
+ };
717
+ declare function createOpenAiContainer(options: LlmOpenAiContainerCreateOptions): Promise<LlmOpenAiContainer>;
718
+ declare function deleteOpenAiContainer(containerId: string): Promise<void>;
719
+ declare function listOpenAiContainerFiles(containerId: string): Promise<readonly LlmOpenAiContainerFile[]>;
720
+ declare function uploadOpenAiContainerFile(upload: LlmOpenAiContainerFileUpload): Promise<LlmOpenAiContainerFile>;
721
+ declare function downloadOpenAiContainerFile(params: {
722
+ readonly containerId: string;
723
+ readonly fileId: string;
724
+ }): Promise<Uint8Array>;
725
+ declare function downloadOpenAiContainerFileText(params: {
726
+ readonly containerId: string;
727
+ readonly fileId: string;
728
+ }): Promise<string>;
729
+
666
730
  /**
667
731
  * Loads `.env.local` from `process.cwd()` once.
668
732
  *
@@ -1108,4 +1172,4 @@ declare const FIREWORKS_DEFAULT_GPT_OSS_120B_MODEL: FireworksModelId;
1108
1172
  declare function isFireworksModelId(value: string): value is FireworksModelId;
1109
1173
  declare function resolveFireworksModelId(model: string): string | undefined;
1110
1174
 
1111
- export { type AgentDirectoryEntry, type AgentFilesystem, type AgentFilesystemToolAccessContext, type AgentFilesystemToolAccessHook, type AgentFilesystemToolAction, type AgentFilesystemToolConfig, type AgentFilesystemToolName, type AgentFilesystemToolProfile, type AgentFilesystemToolSelection, type AgentFilesystemToolsOptions, type AgentLogLineSink, type AgentLoggingConfig, type AgentLoggingSelection, type AgentLoopStream, type AgentPathInfo, type AgentPathKind, type AgentRunCompletedTelemetryEvent, type AgentRunStartedTelemetryEvent, type AgentRunStreamTelemetryEvent, type AgentSubagentToolConfig, type AgentSubagentToolPromptPattern, type AgentSubagentToolSelection, type ApplyPatchAccessContext, type ApplyPatchAccessHook, type ApplyPatchRequest, type ApplyPatchResult, type ApplyPatchToolInput, type AssessmentSubagentInput, CHATGPT_IMAGE_MODEL_IDS, CHATGPT_MODEL_IDS, CODEX_APPLY_PATCH_FREEFORM_TOOL_DESCRIPTION, CODEX_APPLY_PATCH_JSON_TOOL_DESCRIPTION, CODEX_APPLY_PATCH_LARK_GRAMMAR, type CandidateAssessment, type CandidateEvolutionOptions, type CandidateEvolutionResult, type CandidateEvolutionSnapshot, type CandidateEvolutionStats, type CandidateFeedbackEntry, type CandidateIssue, type CandidateProposal, type CandidateRecord, type ChatGptAuthProfile, type ChatGptImageModelId, type ChatGptModelId, type CodexApplyPatchToolInput, type CodexGrepFilesToolInput, type CodexListDirToolInput, type CodexReadFileToolInput, type CodexViewImageToolInput, type CreateApplyPatchToolOptions, DEFAULT_FILE_TTL_SECONDS, DEFAULT_SIGNED_URL_TTL_SECONDS, EXPERIMENTAL_CHATGPT_MODEL_PREFIX, type ExperimentalChatGptModelId, FIREWORKS_DEFAULT_GLM_MODEL, FIREWORKS_DEFAULT_GPT_OSS_120B_MODEL, FIREWORKS_DEFAULT_KIMI_MODEL, FIREWORKS_DEFAULT_MINIMAX_MODEL, FIREWORKS_MODEL_IDS, type FeedbackScope, type FireworksModelId, GEMINI_IMAGE_MODEL_IDS, GEMINI_MODEL_IDS, GEMINI_TEXT_MODEL_IDS, type GeminiGlobToolInput, type GeminiGrepSearchToolInput, type GeminiImageModelId, type GeminiListDirectoryToolInput, type GeminiModelId, type GeminiReadFileToolInput, type GeminiReplaceToolInput, type GeminiRgSearchToolInput, type GeminiTextModelId, type GeminiWriteFileToolInput, type GenerationSubagent, type GenerationSubagentInput, InMemoryAgentFilesystem, type JsonSchema, LLM_IMAGE_MODEL_IDS, LLM_MODEL_IDS, LLM_TEXT_MODEL_IDS, type ListedChatGptModelId, type LlmBaseRequest, type LlmBlockedEvent, type LlmCallCompletedTelemetryEvent, type LlmCallStartedTelemetryEvent, type LlmCallStreamTelemetryEvent, type LlmChatGptGenerateImagesRequest, type LlmContent, type LlmContentPart, type LlmCustomTool, type LlmCustomToolInputFormat, type LlmExecutableTool, type LlmFileCreateParams, type LlmFileDeleted, type LlmFileUploadBackend, type LlmFileUploadEvent, type LlmFileUploadMetrics, type LlmFileUploadMode, type LlmFileUploadSource, type LlmFunctionTool, type LlmGeminiGenerateImagesRequest, type LlmGenerateImagesRequest, type LlmImageData, type LlmImageModelId, type LlmImageSize, type LlmInput, type LlmInputFilePart, type LlmInputImagePart, type LlmInputMessage, LlmJsonCallError, type LlmJsonRequest, type LlmJsonStream, type LlmJsonStreamEvent, type LlmJsonStreamRequest, type LlmMediaResolution, type LlmModelEvent, type LlmModelId, type LlmOpenAiGenerateImagesRequest, type LlmOpenAiImageBackground, type LlmOpenAiImageModeration, type LlmOpenAiImageNumImages, type LlmOpenAiImageOutputFormat, type LlmOpenAiImagePartialImageCount, type LlmOpenAiImageQuality, type LlmOpenAiImageResolution, type LlmOpenAiShellEnvironment, type LlmOpenAiShellNetworkPolicy, type LlmProvider, type LlmStoredFile, type LlmStreamEvent, type LlmTelemetryOperation, type LlmTextDeltaEvent, type LlmTextModelId, type LlmTextRequest, type LlmTextResult, type LlmTextStream, type LlmThinkingLevel, type LlmToolCallCompletedEvent, type LlmToolCallContext, type LlmToolCallResult, type LlmToolCallStartedEvent, type LlmToolCallStreamEvent, type LlmToolConfig, type LlmToolLoopRequest, type LlmToolLoopResult, type LlmToolLoopSteeringAppendResult, type LlmToolLoopSteeringChannel, type LlmToolLoopSteeringInput, type LlmToolLoopSteeringMessage, type LlmToolLoopStep, type LlmToolLoopStream, type LlmToolSet, type LlmUsageEvent, type LlmUsageTokens, type LlmWebSearchMode, type ModelConcurrencyConfig, type ModelConcurrencyProvider, OPENAI_GPT_IMAGE_2_AUTO_RESOLUTION, OPENAI_GPT_IMAGE_2_BACKGROUNDS, OPENAI_GPT_IMAGE_2_MODERATION_LEVELS, OPENAI_GPT_IMAGE_2_NUM_IMAGES, OPENAI_GPT_IMAGE_2_OUTPUT_FORMATS, OPENAI_GPT_IMAGE_2_PARTIAL_IMAGE_COUNTS, OPENAI_GPT_IMAGE_2_POPULAR_RESOLUTIONS, OPENAI_GPT_IMAGE_2_QUALITY_LEVELS, OPENAI_GPT_IMAGE_2_RESOLUTIONS, OPENAI_GPT_IMAGE_2_SIZE_CONSTRAINTS, OPENAI_IMAGE_MODEL_IDS, OPENAI_MODEL_IDS, type OpenAiGptImage2Background, type OpenAiGptImage2CustomResolution, type OpenAiGptImage2ListedResolution, type OpenAiGptImage2Moderation, type OpenAiGptImage2NumImages, type OpenAiGptImage2OutputFormat, type OpenAiGptImage2PartialImageCount, type OpenAiGptImage2PopularResolution, type OpenAiGptImage2Quality, type OpenAiGptImage2Resolution, type OpenAiGptImage2ResolutionValidationResult, type OpenAiImageModelId, type OpenAiModelId, type ParentSelectionConfig, type ParentSelectionMidpoint, type PostCheckRejection, type PostGenerationCheckInput, type RunAgentLoopRequest, type TelemetryConfig, type TelemetryEvent, type TelemetrySelection, type TelemetrySink, appendMarkdownSourcesSection, applyPatch, configureGemini, configureModelConcurrency, configureTelemetry, convertGooglePartsToLlmParts, createApplyPatchTool, createCodexApplyPatchTool, createCodexFilesystemToolSet, createCodexReadFileTool, createFilesystemToolSetForModel, createGeminiFilesystemToolSet, createGeminiReadFileTool, createGlobTool, createGrepFilesTool, createGrepSearchTool, createInMemoryAgentFilesystem, createListDirTool, createListDirectoryTool, createModelAgnosticFilesystemToolSet, createNodeAgentFilesystem, createReplaceTool, createRgSearchTool, createToolLoopSteeringChannel, createViewImageTool, createWriteFileTool, customTool, emptyFileUploadMetrics, encodeChatGptAuthJson, encodeChatGptAuthJsonB64, estimateCallCostUsd, exchangeChatGptOauthCode, files, generateImageInBatches, generateImages, generateJson, generateText, getChatGptAuthProfile, getCurrentToolCallContext, isChatGptImageModelId, isChatGptModelId, isExperimentalChatGptModelId, isFireworksModelId, isGeminiImageModelId, isGeminiModelId, isGeminiTextModelId, isLlmImageModelId, isLlmModelId, isLlmTextModelId, isOpenAiImageModelId, isOpenAiModelId, loadEnvFromFile, loadLocalEnv, parseJsonFromLlmText, refreshChatGptOauthToken, resetModelConcurrencyConfig, resetTelemetry, resolveChatGptImageProviderModel, resolveFilesystemToolProfile, resolveFireworksModelId, runAgentLoop, runCandidateEvolution, runToolLoop, sanitisePartForLogging, streamAgentLoop, streamJson, streamText, streamToolLoop, stripCodexCitationMarkers, toGeminiJsonSchema, tool, validateOpenAiGptImage2Resolution };
1175
+ export { type AgentDirectoryEntry, type AgentFilesystem, type AgentFilesystemToolAccessContext, type AgentFilesystemToolAccessHook, type AgentFilesystemToolAction, type AgentFilesystemToolConfig, type AgentFilesystemToolName, type AgentFilesystemToolProfile, type AgentFilesystemToolSelection, type AgentFilesystemToolsOptions, type AgentLogLineSink, type AgentLoggingConfig, type AgentLoggingSelection, type AgentLoopStream, type AgentPathInfo, type AgentPathKind, type AgentRunCompletedTelemetryEvent, type AgentRunStartedTelemetryEvent, type AgentRunStreamTelemetryEvent, type AgentSubagentToolConfig, type AgentSubagentToolPromptPattern, type AgentSubagentToolSelection, type ApplyPatchAccessContext, type ApplyPatchAccessHook, type ApplyPatchRequest, type ApplyPatchResult, type ApplyPatchToolInput, type AssessmentSubagentInput, CHATGPT_IMAGE_MODEL_IDS, CHATGPT_MODEL_IDS, CODEX_APPLY_PATCH_FREEFORM_TOOL_DESCRIPTION, CODEX_APPLY_PATCH_JSON_TOOL_DESCRIPTION, CODEX_APPLY_PATCH_LARK_GRAMMAR, type CandidateAssessment, type CandidateEvolutionOptions, type CandidateEvolutionResult, type CandidateEvolutionSnapshot, type CandidateEvolutionStats, type CandidateFeedbackEntry, type CandidateIssue, type CandidateProposal, type CandidateRecord, type ChatGptAuthProfile, type ChatGptImageModelId, type ChatGptModelId, type CodexApplyPatchToolInput, type CodexGrepFilesToolInput, type CodexListDirToolInput, type CodexReadFileToolInput, type CodexViewImageToolInput, type CreateApplyPatchToolOptions, DEFAULT_FILE_TTL_SECONDS, DEFAULT_SIGNED_URL_TTL_SECONDS, EXPERIMENTAL_CHATGPT_MODEL_PREFIX, type ExperimentalChatGptModelId, FIREWORKS_DEFAULT_GLM_MODEL, FIREWORKS_DEFAULT_GPT_OSS_120B_MODEL, FIREWORKS_DEFAULT_KIMI_MODEL, FIREWORKS_DEFAULT_MINIMAX_MODEL, FIREWORKS_MODEL_IDS, type FeedbackScope, type FireworksModelId, GEMINI_IMAGE_MODEL_IDS, GEMINI_MODEL_IDS, GEMINI_TEXT_MODEL_IDS, type GeminiGlobToolInput, type GeminiGrepSearchToolInput, type GeminiImageModelId, type GeminiListDirectoryToolInput, type GeminiModelId, type GeminiReadFileToolInput, type GeminiReplaceToolInput, type GeminiRgSearchToolInput, type GeminiTextModelId, type GeminiWriteFileToolInput, type GenerationSubagent, type GenerationSubagentInput, InMemoryAgentFilesystem, type JsonSchema, LLM_IMAGE_MODEL_IDS, LLM_MODEL_IDS, LLM_TEXT_MODEL_IDS, type ListedChatGptModelId, type LlmBaseRequest, type LlmBlockedEvent, type LlmCallCompletedTelemetryEvent, type LlmCallStartedTelemetryEvent, type LlmCallStreamTelemetryEvent, type LlmChatGptGenerateImagesRequest, type LlmContent, type LlmContentPart, type LlmCustomTool, type LlmCustomToolInputFormat, type LlmExecutableTool, type LlmFileCreateParams, type LlmFileDeleted, type LlmFileUploadBackend, type LlmFileUploadEvent, type LlmFileUploadMetrics, type LlmFileUploadMode, type LlmFileUploadSource, type LlmFunctionTool, type LlmGeminiGenerateImagesRequest, type LlmGenerateImagesRequest, type LlmImageData, type LlmImageModelId, type LlmImageSize, type LlmInput, type LlmInputFilePart, type LlmInputImagePart, type LlmInputMessage, LlmJsonCallError, type LlmJsonRequest, type LlmJsonStream, type LlmJsonStreamEvent, type LlmJsonStreamRequest, type LlmMediaResolution, type LlmModelEvent, type LlmModelId, type LlmOpenAiContainer, type LlmOpenAiContainerCreateOptions, type LlmOpenAiContainerFile, type LlmOpenAiContainerFileUpload, type LlmOpenAiContainerNetworkPolicy, type LlmOpenAiGenerateImagesRequest, type LlmOpenAiImageBackground, type LlmOpenAiImageModeration, type LlmOpenAiImageNumImages, type LlmOpenAiImageOutputFormat, type LlmOpenAiImagePartialImageCount, type LlmOpenAiImageQuality, type LlmOpenAiImageResolution, type LlmOpenAiResponseContainerReference, type LlmOpenAiResponseMetadata, type LlmOpenAiShellEnvironment, type LlmOpenAiShellNetworkPolicy, type LlmProvider, type LlmStoredFile, type LlmStreamEvent, type LlmTelemetryOperation, type LlmTextDeltaEvent, type LlmTextModelId, type LlmTextRequest, type LlmTextResult, type LlmTextStream, type LlmThinkingLevel, type LlmToolCallCompletedEvent, type LlmToolCallContext, type LlmToolCallResult, type LlmToolCallStartedEvent, type LlmToolCallStreamEvent, type LlmToolConfig, type LlmToolLoopRequest, type LlmToolLoopResult, type LlmToolLoopSteeringAppendResult, type LlmToolLoopSteeringChannel, type LlmToolLoopSteeringInput, type LlmToolLoopSteeringMessage, type LlmToolLoopStep, type LlmToolLoopStream, type LlmToolSet, type LlmUsageEvent, type LlmUsageTokens, type LlmWebSearchMode, type ModelConcurrencyConfig, type ModelConcurrencyProvider, OPENAI_GPT_IMAGE_2_AUTO_RESOLUTION, OPENAI_GPT_IMAGE_2_BACKGROUNDS, OPENAI_GPT_IMAGE_2_MODERATION_LEVELS, OPENAI_GPT_IMAGE_2_NUM_IMAGES, OPENAI_GPT_IMAGE_2_OUTPUT_FORMATS, OPENAI_GPT_IMAGE_2_PARTIAL_IMAGE_COUNTS, OPENAI_GPT_IMAGE_2_POPULAR_RESOLUTIONS, OPENAI_GPT_IMAGE_2_QUALITY_LEVELS, OPENAI_GPT_IMAGE_2_RESOLUTIONS, OPENAI_GPT_IMAGE_2_SIZE_CONSTRAINTS, OPENAI_IMAGE_MODEL_IDS, OPENAI_MODEL_IDS, type OpenAiGptImage2Background, type OpenAiGptImage2CustomResolution, type OpenAiGptImage2ListedResolution, type OpenAiGptImage2Moderation, type OpenAiGptImage2NumImages, type OpenAiGptImage2OutputFormat, type OpenAiGptImage2PartialImageCount, type OpenAiGptImage2PopularResolution, type OpenAiGptImage2Quality, type OpenAiGptImage2Resolution, type OpenAiGptImage2ResolutionValidationResult, type OpenAiImageModelId, type OpenAiModelId, type ParentSelectionConfig, type ParentSelectionMidpoint, type PostCheckRejection, type PostGenerationCheckInput, type RunAgentLoopRequest, type TelemetryConfig, type TelemetryEvent, type TelemetrySelection, type TelemetrySink, appendMarkdownSourcesSection, applyPatch, configureGemini, configureModelConcurrency, configureTelemetry, convertGooglePartsToLlmParts, createApplyPatchTool, createCodexApplyPatchTool, createCodexFilesystemToolSet, createCodexReadFileTool, createFilesystemToolSetForModel, createGeminiFilesystemToolSet, createGeminiReadFileTool, createGlobTool, createGrepFilesTool, createGrepSearchTool, createInMemoryAgentFilesystem, createListDirTool, createListDirectoryTool, createModelAgnosticFilesystemToolSet, createNodeAgentFilesystem, createOpenAiContainer, createReplaceTool, createRgSearchTool, createToolLoopSteeringChannel, createViewImageTool, createWriteFileTool, customTool, deleteOpenAiContainer, downloadOpenAiContainerFile, downloadOpenAiContainerFileText, emptyFileUploadMetrics, encodeChatGptAuthJson, encodeChatGptAuthJsonB64, estimateCallCostUsd, exchangeChatGptOauthCode, files, generateImageInBatches, generateImages, generateJson, generateText, getChatGptAuthProfile, getCurrentToolCallContext, isChatGptImageModelId, isChatGptModelId, isExperimentalChatGptModelId, isFireworksModelId, isGeminiImageModelId, isGeminiModelId, isGeminiTextModelId, isLlmImageModelId, isLlmModelId, isLlmTextModelId, isOpenAiImageModelId, isOpenAiModelId, listOpenAiContainerFiles, loadEnvFromFile, loadLocalEnv, parseJsonFromLlmText, refreshChatGptOauthToken, resetModelConcurrencyConfig, resetTelemetry, resolveChatGptImageProviderModel, resolveFilesystemToolProfile, resolveFireworksModelId, runAgentLoop, runCandidateEvolution, runToolLoop, sanitisePartForLogging, streamAgentLoop, streamJson, streamText, streamToolLoop, stripCodexCitationMarkers, toGeminiJsonSchema, tool, uploadOpenAiContainerFile, validateOpenAiGptImage2Resolution };
package/dist/index.js CHANGED
@@ -555,7 +555,7 @@ function resolveOpenAiImagePriceResolution(imageSize) {
555
555
 
556
556
  // src/openai/chatgpt-codex.ts
557
557
  import os2 from "os";
558
- import { TextDecoder } from "util";
558
+ import { TextDecoder as TextDecoder2 } from "util";
559
559
 
560
560
  // src/utils/runtimeSingleton.ts
561
561
  var runtimeSingletonStoreKey = /* @__PURE__ */ Symbol.for("@ljoukov/llm.runtimeSingletonStore");
@@ -1886,7 +1886,7 @@ function buildUserAgent() {
1886
1886
  }
1887
1887
  async function* parseEventStream(stream) {
1888
1888
  const reader = stream.getReader();
1889
- const decoder = new TextDecoder();
1889
+ const decoder = new TextDecoder2();
1890
1890
  let buffer = "";
1891
1891
  while (true) {
1892
1892
  const { done, value } = await reader.read();
@@ -5197,6 +5197,8 @@ function resolveOpenAiReasoningEffort(modelId, thinkingLevel) {
5197
5197
  case "medium":
5198
5198
  return "medium";
5199
5199
  case "high":
5200
+ return "high";
5201
+ case "xhigh":
5200
5202
  return "xhigh";
5201
5203
  }
5202
5204
  }
@@ -5214,7 +5216,7 @@ function toOpenAiReasoningEffort(effort) {
5214
5216
  case "high":
5215
5217
  return "high";
5216
5218
  case "xhigh":
5217
- return "high";
5219
+ return "xhigh";
5218
5220
  }
5219
5221
  }
5220
5222
  function resolveOpenAiVerbosity(modelId) {
@@ -6331,6 +6333,50 @@ function toOpenAiTools(tools, options) {
6331
6333
  }
6332
6334
  });
6333
6335
  }
6336
+ function extractOpenAiResponseMetadata(response) {
6337
+ if (!response || typeof response !== "object") {
6338
+ return void 0;
6339
+ }
6340
+ const record = response;
6341
+ const responseId = typeof record.id === "string" ? record.id : void 0;
6342
+ const output = Array.isArray(record.output) ? record.output : [];
6343
+ const containers = [];
6344
+ const seen = /* @__PURE__ */ new Set();
6345
+ const addContainer = (container) => {
6346
+ const key = `${container.toolType}:${container.containerId}:${container.itemId ?? ""}:${container.callId ?? ""}`;
6347
+ if (seen.has(key)) {
6348
+ return;
6349
+ }
6350
+ seen.add(key);
6351
+ containers.push(container);
6352
+ };
6353
+ for (const item of output) {
6354
+ if (!item || typeof item !== "object") {
6355
+ continue;
6356
+ }
6357
+ const itemRecord = item;
6358
+ const itemId = typeof itemRecord.id === "string" ? itemRecord.id : void 0;
6359
+ const callId = typeof itemRecord.call_id === "string" ? itemRecord.call_id : void 0;
6360
+ if (itemRecord.type === "shell_call") {
6361
+ const environment = itemRecord.environment && typeof itemRecord.environment === "object" ? itemRecord.environment : void 0;
6362
+ const containerId = environment?.type === "container_reference" && typeof environment.container_id === "string" ? environment.container_id : void 0;
6363
+ if (containerId) {
6364
+ addContainer({ containerId, toolType: "shell", itemId, callId });
6365
+ }
6366
+ continue;
6367
+ }
6368
+ if (itemRecord.type === "code_interpreter_call") {
6369
+ const containerId = typeof itemRecord.container_id === "string" ? itemRecord.container_id : void 0;
6370
+ if (containerId) {
6371
+ addContainer({ containerId, toolType: "code_interpreter", itemId, callId });
6372
+ }
6373
+ }
6374
+ }
6375
+ if (!responseId && containers.length === 0) {
6376
+ return void 0;
6377
+ }
6378
+ return { ...responseId ? { responseId } : {}, containers };
6379
+ }
6334
6380
  function mergeTokenUpdates(current, next) {
6335
6381
  if (!next) {
6336
6382
  return current;
@@ -7463,6 +7509,7 @@ function toGeminiThinkingLevel(thinkingLevel) {
7463
7509
  case "medium":
7464
7510
  return ThinkingLevel.MEDIUM;
7465
7511
  case "high":
7512
+ case "xhigh":
7466
7513
  return ThinkingLevel.HIGH;
7467
7514
  }
7468
7515
  }
@@ -7505,6 +7552,7 @@ function resolveGeminiThinkingBudget(modelId, thinkingLevel) {
7505
7552
  case "medium":
7506
7553
  return 4096;
7507
7554
  case "high":
7555
+ case "xhigh":
7508
7556
  return 32768;
7509
7557
  }
7510
7558
  }
@@ -7515,6 +7563,7 @@ function resolveGeminiThinkingBudget(modelId, thinkingLevel) {
7515
7563
  case "medium":
7516
7564
  return 8192;
7517
7565
  case "high":
7566
+ case "xhigh":
7518
7567
  return 24576;
7519
7568
  }
7520
7569
  }
@@ -7525,6 +7574,7 @@ function resolveGeminiThinkingBudget(modelId, thinkingLevel) {
7525
7574
  case "medium":
7526
7575
  return 8192;
7527
7576
  case "high":
7577
+ case "xhigh":
7528
7578
  return 16384;
7529
7579
  }
7530
7580
  }
@@ -7942,6 +7992,7 @@ async function runTextCall(params) {
7942
7992
  let modelVersion = request.model;
7943
7993
  let blocked = false;
7944
7994
  let grounding;
7995
+ let openAi;
7945
7996
  const responseParts = [];
7946
7997
  let responseRole;
7947
7998
  let latestUsage;
@@ -8052,6 +8103,7 @@ async function runTextCall(params) {
8052
8103
  }
8053
8104
  }
8054
8105
  const finalResponse = await stream.finalResponse();
8106
+ openAi = extractOpenAiResponseMetadata(finalResponse);
8055
8107
  modelVersion = typeof finalResponse.model === "string" ? finalResponse.model : request.model;
8056
8108
  pushEvent({ type: "model", modelVersion });
8057
8109
  if (finalResponse.error) {
@@ -8295,6 +8347,7 @@ async function runTextCall(params) {
8295
8347
  costUsd,
8296
8348
  usage: latestUsage,
8297
8349
  grounding: grounding ? sanitiseLogValue(grounding) : void 0,
8350
+ openAi: openAi ? sanitiseLogValue(openAi) : void 0,
8298
8351
  responseChars: text.length,
8299
8352
  thoughtChars: thoughts.length,
8300
8353
  responseImages,
@@ -8311,7 +8364,8 @@ async function runTextCall(params) {
8311
8364
  blocked,
8312
8365
  usage: latestUsage,
8313
8366
  costUsd,
8314
- grounding
8367
+ grounding,
8368
+ openAi
8315
8369
  };
8316
8370
  } catch (error) {
8317
8371
  const partialParts = mergeConsecutiveTextParts(responseParts);
@@ -10960,6 +11014,104 @@ function appendMarkdownSourcesSection(value, sources) {
10960
11014
  ${lines}`;
10961
11015
  }
10962
11016
 
11017
+ // src/openai/containers.ts
11018
+ import { toFile as toFile2 } from "openai";
11019
+ function toOpenAiContainerNetworkPolicy(policy) {
11020
+ if (!policy) {
11021
+ return void 0;
11022
+ }
11023
+ if (policy.type === "disabled") {
11024
+ return { type: "disabled" };
11025
+ }
11026
+ return {
11027
+ type: "allowlist",
11028
+ allowed_domains: Array.from(policy.allowedDomains),
11029
+ ...policy.domainSecrets ? {
11030
+ domain_secrets: policy.domainSecrets.map((secret) => ({
11031
+ domain: secret.domain,
11032
+ name: secret.name,
11033
+ value: secret.value
11034
+ }))
11035
+ } : {}
11036
+ };
11037
+ }
11038
+ function toContainer(container) {
11039
+ return {
11040
+ id: String(container.id),
11041
+ name: typeof container.name === "string" ? container.name : "",
11042
+ status: typeof container.status === "string" ? container.status : "",
11043
+ ...typeof container.created_at === "number" ? { createdAt: container.created_at } : {},
11044
+ ...typeof container.last_active_at === "number" ? { lastActiveAt: container.last_active_at } : {},
11045
+ ...typeof container.memory_limit === "string" ? { memoryLimit: container.memory_limit } : {}
11046
+ };
11047
+ }
11048
+ function toContainerFile(file) {
11049
+ return {
11050
+ id: String(file.id),
11051
+ containerId: typeof file.container_id === "string" ? file.container_id : "",
11052
+ path: typeof file.path === "string" ? file.path : "",
11053
+ ...typeof file.bytes === "number" || file.bytes === null ? { bytes: file.bytes } : {},
11054
+ ...typeof file.created_at === "number" ? { createdAt: file.created_at } : {},
11055
+ ...typeof file.source === "string" ? { source: file.source } : {}
11056
+ };
11057
+ }
11058
+ async function createOpenAiContainer(options) {
11059
+ const container = await runOpenAiCall(
11060
+ async (client) => await client.containers.create({
11061
+ name: options.name,
11062
+ ...options.fileIds ? { file_ids: Array.from(options.fileIds) } : {},
11063
+ ...options.memoryLimit ? { memory_limit: options.memoryLimit } : {},
11064
+ ...options.networkPolicy ? { network_policy: toOpenAiContainerNetworkPolicy(options.networkPolicy) } : {},
11065
+ ...options.expiresAfterMinutes ? {
11066
+ expires_after: {
11067
+ anchor: "last_active_at",
11068
+ minutes: options.expiresAfterMinutes
11069
+ }
11070
+ } : {}
11071
+ }),
11072
+ "openai-containers"
11073
+ );
11074
+ return toContainer(container);
11075
+ }
11076
+ async function deleteOpenAiContainer(containerId) {
11077
+ await runOpenAiCall(
11078
+ async (client) => await client.containers.delete(containerId),
11079
+ "openai-containers"
11080
+ );
11081
+ }
11082
+ async function listOpenAiContainerFiles(containerId) {
11083
+ const files2 = [];
11084
+ await runOpenAiCall(async (client) => {
11085
+ for await (const file of client.containers.files.list(containerId)) {
11086
+ files2.push(toContainerFile(file));
11087
+ }
11088
+ }, "openai-containers");
11089
+ return files2;
11090
+ }
11091
+ async function uploadOpenAiContainerFile(upload) {
11092
+ const file = await toFile2(upload.data, upload.filename, {
11093
+ ...upload.mimeType ? { type: upload.mimeType } : {}
11094
+ });
11095
+ const created = await runOpenAiCall(
11096
+ async (client) => await client.containers.files.create(upload.containerId, { file }),
11097
+ "openai-containers"
11098
+ );
11099
+ return toContainerFile(created);
11100
+ }
11101
+ async function downloadOpenAiContainerFile(params) {
11102
+ const response = await runOpenAiCall(
11103
+ async (client) => await client.containers.files.content.retrieve(params.fileId, {
11104
+ container_id: params.containerId
11105
+ }),
11106
+ "openai-containers"
11107
+ );
11108
+ return new Uint8Array(await response.arrayBuffer());
11109
+ }
11110
+ async function downloadOpenAiContainerFileText(params) {
11111
+ const bytes = await downloadOpenAiContainerFile(params);
11112
+ return new TextDecoder().decode(bytes);
11113
+ }
11114
+
10963
11115
  // src/agent.ts
10964
11116
  import { randomBytes as randomBytes3 } from "crypto";
10965
11117
  import path9 from "path";
@@ -14759,12 +14911,16 @@ export {
14759
14911
  createListDirectoryTool,
14760
14912
  createModelAgnosticFilesystemToolSet,
14761
14913
  createNodeAgentFilesystem,
14914
+ createOpenAiContainer,
14762
14915
  createReplaceTool,
14763
14916
  createRgSearchTool,
14764
14917
  createToolLoopSteeringChannel,
14765
14918
  createViewImageTool,
14766
14919
  createWriteFileTool,
14767
14920
  customTool,
14921
+ deleteOpenAiContainer,
14922
+ downloadOpenAiContainerFile,
14923
+ downloadOpenAiContainerFileText,
14768
14924
  emptyFileUploadMetrics,
14769
14925
  encodeChatGptAuthJson,
14770
14926
  encodeChatGptAuthJsonB64,
@@ -14789,6 +14945,7 @@ export {
14789
14945
  isLlmTextModelId,
14790
14946
  isOpenAiImageModelId,
14791
14947
  isOpenAiModelId,
14948
+ listOpenAiContainerFiles,
14792
14949
  loadEnvFromFile,
14793
14950
  loadLocalEnv,
14794
14951
  parseJsonFromLlmText,
@@ -14809,6 +14966,7 @@ export {
14809
14966
  stripCodexCitationMarkers,
14810
14967
  toGeminiJsonSchema,
14811
14968
  tool,
14969
+ uploadOpenAiContainerFile,
14812
14970
  validateOpenAiGptImage2Resolution
14813
14971
  };
14814
14972
  //# sourceMappingURL=index.js.map