@ljoukov/llm 7.0.10 → 7.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -9
- package/dist/index.cjs +110 -23
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +32 -5
- package/dist/index.d.ts +32 -5
- package/dist/index.js +110 -23
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -19,10 +19,10 @@ declare function estimateCallCostUsd({ modelId, tokens, responseImages, imageSiz
|
|
|
19
19
|
imageSize?: string;
|
|
20
20
|
}): number;
|
|
21
21
|
|
|
22
|
-
declare const OPENAI_MODEL_IDS: readonly ["gpt-5.4", "gpt-5.4-mini", "gpt-5.4-nano"];
|
|
22
|
+
declare const OPENAI_MODEL_IDS: readonly ["gpt-5.5", "gpt-5.5-fast", "gpt-5.4", "gpt-5.4-mini", "gpt-5.4-nano"];
|
|
23
23
|
type OpenAiModelId = (typeof OPENAI_MODEL_IDS)[number];
|
|
24
24
|
declare function isOpenAiModelId(value: string): value is OpenAiModelId;
|
|
25
|
-
declare const CHATGPT_MODEL_IDS: readonly ["chatgpt-gpt-5.4", "chatgpt-gpt-5.4-fast", "chatgpt-gpt-5.4-mini", "chatgpt-gpt-5.3-codex-spark"];
|
|
25
|
+
declare const CHATGPT_MODEL_IDS: readonly ["chatgpt-gpt-5.5", "chatgpt-gpt-5.5-fast", "chatgpt-gpt-5.4", "chatgpt-gpt-5.4-fast", "chatgpt-gpt-5.4-mini", "chatgpt-gpt-5.3-codex-spark"];
|
|
26
26
|
declare const EXPERIMENTAL_CHATGPT_MODEL_PREFIX: "experimental-chatgpt-";
|
|
27
27
|
type ListedChatGptModelId = (typeof CHATGPT_MODEL_IDS)[number];
|
|
28
28
|
type ExperimentalChatGptModelId = `${typeof EXPERIMENTAL_CHATGPT_MODEL_PREFIX}${string}`;
|
|
@@ -162,11 +162,38 @@ type LlmToolOutputContentItem = {
|
|
|
162
162
|
type LlmImageSize = "1K" | "2K" | "4K";
|
|
163
163
|
type LlmThinkingLevel = "low" | "medium" | "high";
|
|
164
164
|
type LlmWebSearchMode = "cached" | "live";
|
|
165
|
+
type LlmOpenAiShellNetworkPolicy = {
|
|
166
|
+
readonly type: "disabled";
|
|
167
|
+
} | {
|
|
168
|
+
readonly type: "allowlist";
|
|
169
|
+
readonly allowedDomains: readonly string[];
|
|
170
|
+
readonly domainSecrets?: readonly {
|
|
171
|
+
readonly domain: string;
|
|
172
|
+
readonly name: string;
|
|
173
|
+
readonly value: string;
|
|
174
|
+
}[];
|
|
175
|
+
};
|
|
176
|
+
type LlmOpenAiShellEnvironment = {
|
|
177
|
+
readonly type?: "container-auto";
|
|
178
|
+
readonly fileIds?: readonly string[];
|
|
179
|
+
readonly memoryLimit?: "1g" | "4g" | "16g" | "64g" | null;
|
|
180
|
+
readonly networkPolicy?: LlmOpenAiShellNetworkPolicy;
|
|
181
|
+
} | {
|
|
182
|
+
readonly type: "container-reference";
|
|
183
|
+
readonly containerId: string;
|
|
184
|
+
};
|
|
165
185
|
type LlmToolConfig = {
|
|
166
186
|
readonly type: "web-search";
|
|
167
187
|
readonly mode?: LlmWebSearchMode;
|
|
168
188
|
} | {
|
|
169
189
|
readonly type: "code-execution";
|
|
190
|
+
} | {
|
|
191
|
+
/**
|
|
192
|
+
* OpenAI hosted shell tool. Runs commands in an OpenAI-managed container,
|
|
193
|
+
* not on the caller's local machine.
|
|
194
|
+
*/
|
|
195
|
+
readonly type: "shell";
|
|
196
|
+
readonly environment?: LlmOpenAiShellEnvironment;
|
|
170
197
|
};
|
|
171
198
|
type LlmTextDeltaEvent = {
|
|
172
199
|
readonly type: "delta";
|
|
@@ -218,11 +245,11 @@ type LlmToolCallCompletedEvent = {
|
|
|
218
245
|
type LlmToolCallStreamEvent = LlmToolCallStartedEvent | LlmToolCallCompletedEvent;
|
|
219
246
|
type LlmStreamEvent = LlmTextDeltaEvent | LlmUsageEvent | LlmModelEvent | LlmBlockedEvent | LlmToolCallStreamEvent;
|
|
220
247
|
type LlmProvider = "openai" | "chatgpt" | "gemini" | "fireworks";
|
|
221
|
-
declare const LLM_TEXT_MODEL_IDS: readonly ["gpt-5.4", "gpt-5.4-mini", "gpt-5.4-nano", "chatgpt-gpt-5.4", "chatgpt-gpt-5.4-fast", "chatgpt-gpt-5.4-mini", "chatgpt-gpt-5.3-codex-spark", "kimi-k2.5", "glm-5", "minimax-m2.1", "gpt-oss-120b", "gemini-3.1-pro-preview", "gemini-3-flash-preview", "gemini-2.5-pro", "gemini-flash-latest", "gemini-flash-lite-latest"];
|
|
248
|
+
declare const LLM_TEXT_MODEL_IDS: readonly ["gpt-5.5", "gpt-5.5-fast", "gpt-5.4", "gpt-5.4-mini", "gpt-5.4-nano", "chatgpt-gpt-5.5", "chatgpt-gpt-5.5-fast", "chatgpt-gpt-5.4", "chatgpt-gpt-5.4-fast", "chatgpt-gpt-5.4-mini", "chatgpt-gpt-5.3-codex-spark", "kimi-k2.5", "glm-5", "minimax-m2.1", "gpt-oss-120b", "gemini-3.1-pro-preview", "gemini-3-flash-preview", "gemini-2.5-pro", "gemini-flash-latest", "gemini-flash-lite-latest"];
|
|
222
249
|
type LlmTextModelId = (typeof LLM_TEXT_MODEL_IDS)[number] | ExperimentalChatGptModelId;
|
|
223
250
|
declare const LLM_IMAGE_MODEL_IDS: readonly ["gemini-3-pro-image-preview", "gemini-3.1-flash-image-preview"];
|
|
224
251
|
type LlmImageModelId = (typeof LLM_IMAGE_MODEL_IDS)[number];
|
|
225
|
-
declare const LLM_MODEL_IDS: readonly ["gpt-5.4", "gpt-5.4-mini", "gpt-5.4-nano", "chatgpt-gpt-5.4", "chatgpt-gpt-5.4-fast", "chatgpt-gpt-5.4-mini", "chatgpt-gpt-5.3-codex-spark", "kimi-k2.5", "glm-5", "minimax-m2.1", "gpt-oss-120b", "gemini-3.1-pro-preview", "gemini-3-flash-preview", "gemini-2.5-pro", "gemini-flash-latest", "gemini-flash-lite-latest", "gemini-3-pro-image-preview", "gemini-3.1-flash-image-preview"];
|
|
252
|
+
declare const LLM_MODEL_IDS: readonly ["gpt-5.5", "gpt-5.5-fast", "gpt-5.4", "gpt-5.4-mini", "gpt-5.4-nano", "chatgpt-gpt-5.5", "chatgpt-gpt-5.5-fast", "chatgpt-gpt-5.4", "chatgpt-gpt-5.4-fast", "chatgpt-gpt-5.4-mini", "chatgpt-gpt-5.3-codex-spark", "kimi-k2.5", "glm-5", "minimax-m2.1", "gpt-oss-120b", "gemini-3.1-pro-preview", "gemini-3-flash-preview", "gemini-2.5-pro", "gemini-flash-latest", "gemini-flash-lite-latest", "gemini-3-pro-image-preview", "gemini-3.1-flash-image-preview"];
|
|
226
253
|
type LlmModelId = LlmTextModelId | LlmImageModelId;
|
|
227
254
|
declare function isLlmTextModelId(value: string): value is LlmTextModelId;
|
|
228
255
|
declare function isLlmImageModelId(value: string): value is LlmImageModelId;
|
|
@@ -1010,4 +1037,4 @@ declare const FIREWORKS_DEFAULT_GPT_OSS_120B_MODEL: FireworksModelId;
|
|
|
1010
1037
|
declare function isFireworksModelId(value: string): value is FireworksModelId;
|
|
1011
1038
|
declare function resolveFireworksModelId(model: string): string | undefined;
|
|
1012
1039
|
|
|
1013
|
-
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_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 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 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 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 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_MODEL_IDS, 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, isChatGptModelId, isExperimentalChatGptModelId, isFireworksModelId, isGeminiImageModelId, isGeminiModelId, isGeminiTextModelId, isLlmImageModelId, isLlmModelId, isLlmTextModelId, isOpenAiModelId, loadEnvFromFile, loadLocalEnv, parseJsonFromLlmText, refreshChatGptOauthToken, resetModelConcurrencyConfig, resetTelemetry, resolveFilesystemToolProfile, resolveFireworksModelId, runAgentLoop, runCandidateEvolution, runToolLoop, sanitisePartForLogging, streamAgentLoop, streamJson, streamText, streamToolLoop, stripCodexCitationMarkers, toGeminiJsonSchema, tool };
|
|
1040
|
+
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_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 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 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 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 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_MODEL_IDS, 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, isChatGptModelId, isExperimentalChatGptModelId, isFireworksModelId, isGeminiImageModelId, isGeminiModelId, isGeminiTextModelId, isLlmImageModelId, isLlmModelId, isLlmTextModelId, isOpenAiModelId, loadEnvFromFile, loadLocalEnv, parseJsonFromLlmText, refreshChatGptOauthToken, resetModelConcurrencyConfig, resetTelemetry, resolveFilesystemToolProfile, resolveFireworksModelId, runAgentLoop, runCandidateEvolution, runToolLoop, sanitisePartForLogging, streamAgentLoop, streamJson, streamText, streamToolLoop, stripCodexCitationMarkers, toGeminiJsonSchema, tool };
|
package/dist/index.d.ts
CHANGED
|
@@ -19,10 +19,10 @@ declare function estimateCallCostUsd({ modelId, tokens, responseImages, imageSiz
|
|
|
19
19
|
imageSize?: string;
|
|
20
20
|
}): number;
|
|
21
21
|
|
|
22
|
-
declare const OPENAI_MODEL_IDS: readonly ["gpt-5.4", "gpt-5.4-mini", "gpt-5.4-nano"];
|
|
22
|
+
declare const OPENAI_MODEL_IDS: readonly ["gpt-5.5", "gpt-5.5-fast", "gpt-5.4", "gpt-5.4-mini", "gpt-5.4-nano"];
|
|
23
23
|
type OpenAiModelId = (typeof OPENAI_MODEL_IDS)[number];
|
|
24
24
|
declare function isOpenAiModelId(value: string): value is OpenAiModelId;
|
|
25
|
-
declare const CHATGPT_MODEL_IDS: readonly ["chatgpt-gpt-5.4", "chatgpt-gpt-5.4-fast", "chatgpt-gpt-5.4-mini", "chatgpt-gpt-5.3-codex-spark"];
|
|
25
|
+
declare const CHATGPT_MODEL_IDS: readonly ["chatgpt-gpt-5.5", "chatgpt-gpt-5.5-fast", "chatgpt-gpt-5.4", "chatgpt-gpt-5.4-fast", "chatgpt-gpt-5.4-mini", "chatgpt-gpt-5.3-codex-spark"];
|
|
26
26
|
declare const EXPERIMENTAL_CHATGPT_MODEL_PREFIX: "experimental-chatgpt-";
|
|
27
27
|
type ListedChatGptModelId = (typeof CHATGPT_MODEL_IDS)[number];
|
|
28
28
|
type ExperimentalChatGptModelId = `${typeof EXPERIMENTAL_CHATGPT_MODEL_PREFIX}${string}`;
|
|
@@ -162,11 +162,38 @@ type LlmToolOutputContentItem = {
|
|
|
162
162
|
type LlmImageSize = "1K" | "2K" | "4K";
|
|
163
163
|
type LlmThinkingLevel = "low" | "medium" | "high";
|
|
164
164
|
type LlmWebSearchMode = "cached" | "live";
|
|
165
|
+
type LlmOpenAiShellNetworkPolicy = {
|
|
166
|
+
readonly type: "disabled";
|
|
167
|
+
} | {
|
|
168
|
+
readonly type: "allowlist";
|
|
169
|
+
readonly allowedDomains: readonly string[];
|
|
170
|
+
readonly domainSecrets?: readonly {
|
|
171
|
+
readonly domain: string;
|
|
172
|
+
readonly name: string;
|
|
173
|
+
readonly value: string;
|
|
174
|
+
}[];
|
|
175
|
+
};
|
|
176
|
+
type LlmOpenAiShellEnvironment = {
|
|
177
|
+
readonly type?: "container-auto";
|
|
178
|
+
readonly fileIds?: readonly string[];
|
|
179
|
+
readonly memoryLimit?: "1g" | "4g" | "16g" | "64g" | null;
|
|
180
|
+
readonly networkPolicy?: LlmOpenAiShellNetworkPolicy;
|
|
181
|
+
} | {
|
|
182
|
+
readonly type: "container-reference";
|
|
183
|
+
readonly containerId: string;
|
|
184
|
+
};
|
|
165
185
|
type LlmToolConfig = {
|
|
166
186
|
readonly type: "web-search";
|
|
167
187
|
readonly mode?: LlmWebSearchMode;
|
|
168
188
|
} | {
|
|
169
189
|
readonly type: "code-execution";
|
|
190
|
+
} | {
|
|
191
|
+
/**
|
|
192
|
+
* OpenAI hosted shell tool. Runs commands in an OpenAI-managed container,
|
|
193
|
+
* not on the caller's local machine.
|
|
194
|
+
*/
|
|
195
|
+
readonly type: "shell";
|
|
196
|
+
readonly environment?: LlmOpenAiShellEnvironment;
|
|
170
197
|
};
|
|
171
198
|
type LlmTextDeltaEvent = {
|
|
172
199
|
readonly type: "delta";
|
|
@@ -218,11 +245,11 @@ type LlmToolCallCompletedEvent = {
|
|
|
218
245
|
type LlmToolCallStreamEvent = LlmToolCallStartedEvent | LlmToolCallCompletedEvent;
|
|
219
246
|
type LlmStreamEvent = LlmTextDeltaEvent | LlmUsageEvent | LlmModelEvent | LlmBlockedEvent | LlmToolCallStreamEvent;
|
|
220
247
|
type LlmProvider = "openai" | "chatgpt" | "gemini" | "fireworks";
|
|
221
|
-
declare const LLM_TEXT_MODEL_IDS: readonly ["gpt-5.4", "gpt-5.4-mini", "gpt-5.4-nano", "chatgpt-gpt-5.4", "chatgpt-gpt-5.4-fast", "chatgpt-gpt-5.4-mini", "chatgpt-gpt-5.3-codex-spark", "kimi-k2.5", "glm-5", "minimax-m2.1", "gpt-oss-120b", "gemini-3.1-pro-preview", "gemini-3-flash-preview", "gemini-2.5-pro", "gemini-flash-latest", "gemini-flash-lite-latest"];
|
|
248
|
+
declare const LLM_TEXT_MODEL_IDS: readonly ["gpt-5.5", "gpt-5.5-fast", "gpt-5.4", "gpt-5.4-mini", "gpt-5.4-nano", "chatgpt-gpt-5.5", "chatgpt-gpt-5.5-fast", "chatgpt-gpt-5.4", "chatgpt-gpt-5.4-fast", "chatgpt-gpt-5.4-mini", "chatgpt-gpt-5.3-codex-spark", "kimi-k2.5", "glm-5", "minimax-m2.1", "gpt-oss-120b", "gemini-3.1-pro-preview", "gemini-3-flash-preview", "gemini-2.5-pro", "gemini-flash-latest", "gemini-flash-lite-latest"];
|
|
222
249
|
type LlmTextModelId = (typeof LLM_TEXT_MODEL_IDS)[number] | ExperimentalChatGptModelId;
|
|
223
250
|
declare const LLM_IMAGE_MODEL_IDS: readonly ["gemini-3-pro-image-preview", "gemini-3.1-flash-image-preview"];
|
|
224
251
|
type LlmImageModelId = (typeof LLM_IMAGE_MODEL_IDS)[number];
|
|
225
|
-
declare const LLM_MODEL_IDS: readonly ["gpt-5.4", "gpt-5.4-mini", "gpt-5.4-nano", "chatgpt-gpt-5.4", "chatgpt-gpt-5.4-fast", "chatgpt-gpt-5.4-mini", "chatgpt-gpt-5.3-codex-spark", "kimi-k2.5", "glm-5", "minimax-m2.1", "gpt-oss-120b", "gemini-3.1-pro-preview", "gemini-3-flash-preview", "gemini-2.5-pro", "gemini-flash-latest", "gemini-flash-lite-latest", "gemini-3-pro-image-preview", "gemini-3.1-flash-image-preview"];
|
|
252
|
+
declare const LLM_MODEL_IDS: readonly ["gpt-5.5", "gpt-5.5-fast", "gpt-5.4", "gpt-5.4-mini", "gpt-5.4-nano", "chatgpt-gpt-5.5", "chatgpt-gpt-5.5-fast", "chatgpt-gpt-5.4", "chatgpt-gpt-5.4-fast", "chatgpt-gpt-5.4-mini", "chatgpt-gpt-5.3-codex-spark", "kimi-k2.5", "glm-5", "minimax-m2.1", "gpt-oss-120b", "gemini-3.1-pro-preview", "gemini-3-flash-preview", "gemini-2.5-pro", "gemini-flash-latest", "gemini-flash-lite-latest", "gemini-3-pro-image-preview", "gemini-3.1-flash-image-preview"];
|
|
226
253
|
type LlmModelId = LlmTextModelId | LlmImageModelId;
|
|
227
254
|
declare function isLlmTextModelId(value: string): value is LlmTextModelId;
|
|
228
255
|
declare function isLlmImageModelId(value: string): value is LlmImageModelId;
|
|
@@ -1010,4 +1037,4 @@ declare const FIREWORKS_DEFAULT_GPT_OSS_120B_MODEL: FireworksModelId;
|
|
|
1010
1037
|
declare function isFireworksModelId(value: string): value is FireworksModelId;
|
|
1011
1038
|
declare function resolveFireworksModelId(model: string): string | undefined;
|
|
1012
1039
|
|
|
1013
|
-
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_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 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 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 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 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_MODEL_IDS, 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, isChatGptModelId, isExperimentalChatGptModelId, isFireworksModelId, isGeminiImageModelId, isGeminiModelId, isGeminiTextModelId, isLlmImageModelId, isLlmModelId, isLlmTextModelId, isOpenAiModelId, loadEnvFromFile, loadLocalEnv, parseJsonFromLlmText, refreshChatGptOauthToken, resetModelConcurrencyConfig, resetTelemetry, resolveFilesystemToolProfile, resolveFireworksModelId, runAgentLoop, runCandidateEvolution, runToolLoop, sanitisePartForLogging, streamAgentLoop, streamJson, streamText, streamToolLoop, stripCodexCitationMarkers, toGeminiJsonSchema, tool };
|
|
1040
|
+
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_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 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 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 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 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_MODEL_IDS, 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, isChatGptModelId, isExperimentalChatGptModelId, isFireworksModelId, isGeminiImageModelId, isGeminiModelId, isGeminiTextModelId, isLlmImageModelId, isLlmModelId, isLlmTextModelId, isOpenAiModelId, loadEnvFromFile, loadLocalEnv, parseJsonFromLlmText, refreshChatGptOauthToken, resetModelConcurrencyConfig, resetTelemetry, resolveFilesystemToolProfile, resolveFireworksModelId, runAgentLoop, runCandidateEvolution, runToolLoop, sanitisePartForLogging, streamAgentLoop, streamJson, streamText, streamToolLoop, stripCodexCitationMarkers, toGeminiJsonSchema, tool };
|
package/dist/index.js
CHANGED
|
@@ -206,16 +206,27 @@ function getGeminiImagePricing(modelId) {
|
|
|
206
206
|
}
|
|
207
207
|
|
|
208
208
|
// src/openai/models.ts
|
|
209
|
-
var OPENAI_MODEL_IDS = [
|
|
209
|
+
var OPENAI_MODEL_IDS = [
|
|
210
|
+
"gpt-5.5",
|
|
211
|
+
"gpt-5.5-fast",
|
|
212
|
+
"gpt-5.4",
|
|
213
|
+
"gpt-5.4-mini",
|
|
214
|
+
"gpt-5.4-nano"
|
|
215
|
+
];
|
|
210
216
|
function isOpenAiModelId(value) {
|
|
211
217
|
return OPENAI_MODEL_IDS.includes(value);
|
|
212
218
|
}
|
|
213
219
|
var CHATGPT_MODEL_IDS = [
|
|
220
|
+
"chatgpt-gpt-5.5",
|
|
221
|
+
"chatgpt-gpt-5.5-fast",
|
|
214
222
|
"chatgpt-gpt-5.4",
|
|
215
223
|
"chatgpt-gpt-5.4-fast",
|
|
216
224
|
"chatgpt-gpt-5.4-mini",
|
|
217
225
|
"chatgpt-gpt-5.3-codex-spark"
|
|
218
226
|
];
|
|
227
|
+
var FAST_MODEL_SUFFIX = "-fast";
|
|
228
|
+
var OPENAI_PRIORITY_MODEL_IDS = ["gpt-5.5-fast"];
|
|
229
|
+
var CHATGPT_PRIORITY_MODEL_IDS = ["chatgpt-gpt-5.5-fast", "chatgpt-gpt-5.4-fast"];
|
|
219
230
|
var EXPERIMENTAL_CHATGPT_MODEL_PREFIX = "experimental-chatgpt-";
|
|
220
231
|
function isExperimentalChatGptModelId(value) {
|
|
221
232
|
return value.startsWith(EXPERIMENTAL_CHATGPT_MODEL_PREFIX) && value.length > EXPERIMENTAL_CHATGPT_MODEL_PREFIX.length;
|
|
@@ -223,6 +234,15 @@ function isExperimentalChatGptModelId(value) {
|
|
|
223
234
|
function isChatGptModelId(value) {
|
|
224
235
|
return CHATGPT_MODEL_IDS.includes(value) || isExperimentalChatGptModelId(value);
|
|
225
236
|
}
|
|
237
|
+
function stripFastSuffix(model) {
|
|
238
|
+
return model.endsWith(FAST_MODEL_SUFFIX) ? model.slice(0, -FAST_MODEL_SUFFIX.length) : model;
|
|
239
|
+
}
|
|
240
|
+
function resolveOpenAiProviderModel(model) {
|
|
241
|
+
return OPENAI_PRIORITY_MODEL_IDS.includes(model) ? stripFastSuffix(model) : model;
|
|
242
|
+
}
|
|
243
|
+
function resolveOpenAiServiceTier(model) {
|
|
244
|
+
return OPENAI_PRIORITY_MODEL_IDS.includes(model) ? "priority" : void 0;
|
|
245
|
+
}
|
|
226
246
|
function stripChatGptPrefix(model) {
|
|
227
247
|
if (isExperimentalChatGptModelId(model)) {
|
|
228
248
|
return model.slice(EXPERIMENTAL_CHATGPT_MODEL_PREFIX.length);
|
|
@@ -230,18 +250,16 @@ function stripChatGptPrefix(model) {
|
|
|
230
250
|
return model.slice("chatgpt-".length);
|
|
231
251
|
}
|
|
232
252
|
function resolveChatGptProviderModel(model) {
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
return "gpt-5.4";
|
|
236
|
-
default:
|
|
237
|
-
return stripChatGptPrefix(model);
|
|
238
|
-
}
|
|
253
|
+
const providerModel = stripChatGptPrefix(model);
|
|
254
|
+
return CHATGPT_PRIORITY_MODEL_IDS.includes(model) ? stripFastSuffix(providerModel) : providerModel;
|
|
239
255
|
}
|
|
240
256
|
function resolveChatGptServiceTier(model) {
|
|
241
|
-
return model
|
|
257
|
+
return CHATGPT_PRIORITY_MODEL_IDS.includes(model) ? "priority" : void 0;
|
|
242
258
|
}
|
|
243
259
|
|
|
244
260
|
// src/openai/pricing.ts
|
|
261
|
+
var OPENAI_GPT_55_FAST_MODEL_IDS = ["gpt-5.5-fast", "chatgpt-gpt-5.5-fast"];
|
|
262
|
+
var OPENAI_GPT_55_STANDARD_MODEL_IDS = ["gpt-5.5", "chatgpt-gpt-5.5"];
|
|
245
263
|
var OPENAI_GPT_54_FAST_MODEL_IDS = ["gpt-5.4-fast", "chatgpt-gpt-5.4-fast"];
|
|
246
264
|
var OPENAI_GPT_54_MINI_MODEL_IDS = ["gpt-5.4-mini", "chatgpt-gpt-5.4-mini"];
|
|
247
265
|
var OPENAI_GPT_54_NANO_MODEL_IDS = ["gpt-5.4-nano"];
|
|
@@ -250,6 +268,16 @@ var OPENAI_GPT_53_CODEX_SPARK_MODEL_IDS = [
|
|
|
250
268
|
"chatgpt-gpt-5.3-codex-spark"
|
|
251
269
|
];
|
|
252
270
|
var OPENAI_GPT_54_STANDARD_MODEL_IDS = ["gpt-5.4", "chatgpt-gpt-5.4"];
|
|
271
|
+
var OPENAI_GPT_55_PRICING = {
|
|
272
|
+
inputRate: 5 / 1e6,
|
|
273
|
+
cachedRate: 0.5 / 1e6,
|
|
274
|
+
outputRate: 30 / 1e6
|
|
275
|
+
};
|
|
276
|
+
var OPENAI_GPT_55_PRIORITY_PRICING = {
|
|
277
|
+
inputRate: 12.5 / 1e6,
|
|
278
|
+
cachedRate: 1.25 / 1e6,
|
|
279
|
+
outputRate: 75 / 1e6
|
|
280
|
+
};
|
|
253
281
|
var OPENAI_GPT_54_PRICING = {
|
|
254
282
|
inputRate: 2.5 / 1e6,
|
|
255
283
|
cachedRate: 0.25 / 1e6,
|
|
@@ -274,6 +302,12 @@ function getOpenAiPricing(modelId) {
|
|
|
274
302
|
if (isExperimentalChatGptModelId(modelId)) {
|
|
275
303
|
return OPENAI_GPT_54_PRICING;
|
|
276
304
|
}
|
|
305
|
+
if (OPENAI_GPT_55_FAST_MODEL_IDS.includes(modelId)) {
|
|
306
|
+
return OPENAI_GPT_55_PRIORITY_PRICING;
|
|
307
|
+
}
|
|
308
|
+
if (OPENAI_GPT_55_STANDARD_MODEL_IDS.includes(modelId)) {
|
|
309
|
+
return OPENAI_GPT_55_PRICING;
|
|
310
|
+
}
|
|
277
311
|
if (OPENAI_GPT_54_FAST_MODEL_IDS.includes(modelId)) {
|
|
278
312
|
return OPENAI_GPT_54_PRIORITY_PRICING;
|
|
279
313
|
}
|
|
@@ -4955,7 +4989,11 @@ function resolveProvider(model) {
|
|
|
4955
4989
|
}
|
|
4956
4990
|
}
|
|
4957
4991
|
if (isOpenAiModelId(model)) {
|
|
4958
|
-
return {
|
|
4992
|
+
return {
|
|
4993
|
+
provider: "openai",
|
|
4994
|
+
model: resolveOpenAiProviderModel(model),
|
|
4995
|
+
serviceTier: resolveOpenAiServiceTier(model)
|
|
4996
|
+
};
|
|
4959
4997
|
}
|
|
4960
4998
|
throw new Error(`Unsupported text model: ${model}`);
|
|
4961
4999
|
}
|
|
@@ -6044,12 +6082,40 @@ function toGeminiTools(tools) {
|
|
|
6044
6082
|
return { googleSearch: {} };
|
|
6045
6083
|
case "code-execution":
|
|
6046
6084
|
return { codeExecution: {} };
|
|
6085
|
+
case "shell":
|
|
6086
|
+
throw new Error("Gemini provider does not support the OpenAI shell tool.");
|
|
6047
6087
|
default:
|
|
6048
6088
|
throw new Error("Unsupported tool configuration");
|
|
6049
6089
|
}
|
|
6050
6090
|
});
|
|
6051
6091
|
}
|
|
6052
|
-
function
|
|
6092
|
+
function toOpenAiShellEnvironment(environment) {
|
|
6093
|
+
if (environment?.type === "container-reference") {
|
|
6094
|
+
return {
|
|
6095
|
+
type: "container_reference",
|
|
6096
|
+
container_id: environment.containerId
|
|
6097
|
+
};
|
|
6098
|
+
}
|
|
6099
|
+
return {
|
|
6100
|
+
type: "container_auto",
|
|
6101
|
+
...environment?.fileIds ? { file_ids: Array.from(environment.fileIds) } : {},
|
|
6102
|
+
...environment?.memoryLimit !== void 0 ? { memory_limit: environment.memoryLimit } : {},
|
|
6103
|
+
...environment?.networkPolicy ? {
|
|
6104
|
+
network_policy: environment.networkPolicy.type === "allowlist" ? {
|
|
6105
|
+
type: "allowlist",
|
|
6106
|
+
allowed_domains: Array.from(environment.networkPolicy.allowedDomains),
|
|
6107
|
+
...environment.networkPolicy.domainSecrets ? {
|
|
6108
|
+
domain_secrets: environment.networkPolicy.domainSecrets.map((secret) => ({
|
|
6109
|
+
domain: secret.domain,
|
|
6110
|
+
name: secret.name,
|
|
6111
|
+
value: secret.value
|
|
6112
|
+
}))
|
|
6113
|
+
} : {}
|
|
6114
|
+
} : { type: "disabled" }
|
|
6115
|
+
} : {}
|
|
6116
|
+
};
|
|
6117
|
+
}
|
|
6118
|
+
function toOpenAiTools(tools, options) {
|
|
6053
6119
|
if (!tools || tools.length === 0) {
|
|
6054
6120
|
return void 0;
|
|
6055
6121
|
}
|
|
@@ -6062,6 +6128,15 @@ function toOpenAiTools(tools) {
|
|
|
6062
6128
|
case "code-execution": {
|
|
6063
6129
|
return { type: "code_interpreter", container: { type: "auto" } };
|
|
6064
6130
|
}
|
|
6131
|
+
case "shell": {
|
|
6132
|
+
if (options.provider !== "openai") {
|
|
6133
|
+
throw new Error("OpenAI shell tool is only supported for OpenAI API models.");
|
|
6134
|
+
}
|
|
6135
|
+
return {
|
|
6136
|
+
type: "shell",
|
|
6137
|
+
environment: toOpenAiShellEnvironment(tool2.environment)
|
|
6138
|
+
};
|
|
6139
|
+
}
|
|
6065
6140
|
default:
|
|
6066
6141
|
throw new Error("Unsupported tool configuration");
|
|
6067
6142
|
}
|
|
@@ -7660,6 +7735,8 @@ async function runTextCall(params) {
|
|
|
7660
7735
|
let responseRole;
|
|
7661
7736
|
let latestUsage;
|
|
7662
7737
|
let responseImages = 0;
|
|
7738
|
+
let sawResponseDelta = false;
|
|
7739
|
+
let sawThoughtDelta = false;
|
|
7663
7740
|
const pushEvent = (event) => {
|
|
7664
7741
|
queue.push(event);
|
|
7665
7742
|
params.onEvent?.(event);
|
|
@@ -7670,8 +7747,10 @@ async function runTextCall(params) {
|
|
|
7670
7747
|
}
|
|
7671
7748
|
responseParts.push({ type: "text", text, ...channel === "thought" ? { thought: true } : {} });
|
|
7672
7749
|
if (channel === "thought") {
|
|
7750
|
+
sawThoughtDelta = true;
|
|
7673
7751
|
callLogger?.appendThoughtDelta(text);
|
|
7674
7752
|
} else {
|
|
7753
|
+
sawResponseDelta = true;
|
|
7675
7754
|
callLogger?.appendResponseDelta(text);
|
|
7676
7755
|
}
|
|
7677
7756
|
pushEvent({ type: "delta", channel, text });
|
|
@@ -7711,7 +7790,7 @@ async function runTextCall(params) {
|
|
|
7711
7790
|
}),
|
|
7712
7791
|
{ model: request.model, provider: "openai" }
|
|
7713
7792
|
);
|
|
7714
|
-
const openAiTools = toOpenAiTools(request.tools);
|
|
7793
|
+
const openAiTools = toOpenAiTools(request.tools, { provider: "openai" });
|
|
7715
7794
|
const reasoningEffort = resolveOpenAiReasoningEffort(
|
|
7716
7795
|
modelForProvider,
|
|
7717
7796
|
request.thinkingLevel
|
|
@@ -7729,6 +7808,7 @@ async function runTextCall(params) {
|
|
|
7729
7808
|
{
|
|
7730
7809
|
model: modelForProvider,
|
|
7731
7810
|
input: openAiInput,
|
|
7811
|
+
...providerInfo.serviceTier ? { service_tier: providerInfo.serviceTier } : {},
|
|
7732
7812
|
reasoning,
|
|
7733
7813
|
text: openAiTextConfig,
|
|
7734
7814
|
...openAiTools ? { tools: openAiTools } : {},
|
|
@@ -7771,12 +7851,17 @@ async function runTextCall(params) {
|
|
|
7771
7851
|
);
|
|
7772
7852
|
}
|
|
7773
7853
|
latestUsage = extractOpenAiUsageTokens(finalResponse.usage);
|
|
7774
|
-
if (
|
|
7854
|
+
if (!sawResponseDelta || !sawThoughtDelta) {
|
|
7855
|
+
const needsResponseFallback = !sawResponseDelta;
|
|
7856
|
+
const needsThoughtFallback = !sawThoughtDelta;
|
|
7775
7857
|
const fallback = extractOpenAiResponseParts(finalResponse);
|
|
7776
7858
|
blocked = blocked || fallback.blocked;
|
|
7777
7859
|
for (const part of fallback.parts) {
|
|
7778
7860
|
if (part.type === "text") {
|
|
7779
|
-
|
|
7861
|
+
const channel = part.thought === true ? "thought" : "response";
|
|
7862
|
+
if (channel === "response" && needsResponseFallback || channel === "thought" && needsThoughtFallback) {
|
|
7863
|
+
pushDelta(channel, part.text);
|
|
7864
|
+
}
|
|
7780
7865
|
} else if (part.type === "inlineData") {
|
|
7781
7866
|
pushInline(part.data, part.mimeType);
|
|
7782
7867
|
}
|
|
@@ -7793,7 +7878,7 @@ async function runTextCall(params) {
|
|
|
7793
7878
|
provider: "chatgpt"
|
|
7794
7879
|
});
|
|
7795
7880
|
const reasoningEffort = resolveOpenAiReasoningEffort(request.model, request.thinkingLevel);
|
|
7796
|
-
const openAiTools = toOpenAiTools(request.tools);
|
|
7881
|
+
const openAiTools = toOpenAiTools(request.tools, { provider: "chatgpt" });
|
|
7797
7882
|
const requestPayload = {
|
|
7798
7883
|
model: modelForProvider,
|
|
7799
7884
|
store: false,
|
|
@@ -7812,18 +7897,18 @@ async function runTextCall(params) {
|
|
|
7812
7897
|
},
|
|
7813
7898
|
...openAiTools ? { tools: openAiTools } : {}
|
|
7814
7899
|
};
|
|
7815
|
-
let
|
|
7816
|
-
let
|
|
7900
|
+
let sawResponseDelta2 = false;
|
|
7901
|
+
let sawThoughtDelta2 = false;
|
|
7817
7902
|
const result2 = await collectChatGptCodexResponseWithRetry({
|
|
7818
7903
|
request: requestPayload,
|
|
7819
7904
|
signal,
|
|
7820
7905
|
onDelta: (delta) => {
|
|
7821
7906
|
if (delta.thoughtDelta) {
|
|
7822
|
-
|
|
7907
|
+
sawThoughtDelta2 = true;
|
|
7823
7908
|
pushDelta("thought", delta.thoughtDelta);
|
|
7824
7909
|
}
|
|
7825
7910
|
if (delta.textDelta) {
|
|
7826
|
-
|
|
7911
|
+
sawResponseDelta2 = true;
|
|
7827
7912
|
pushDelta("response", delta.textDelta);
|
|
7828
7913
|
}
|
|
7829
7914
|
}
|
|
@@ -7839,10 +7924,10 @@ async function runTextCall(params) {
|
|
|
7839
7924
|
latestUsage = extractChatGptUsageTokens(result2.usage);
|
|
7840
7925
|
const fallbackText = typeof result2.text === "string" ? result2.text : "";
|
|
7841
7926
|
const fallbackThoughts = typeof result2.reasoningSummaryText === "string" && result2.reasoningSummaryText.length > 0 ? result2.reasoningSummaryText : typeof result2.reasoningText === "string" ? result2.reasoningText : "";
|
|
7842
|
-
if (!
|
|
7927
|
+
if (!sawThoughtDelta2 && fallbackThoughts.length > 0) {
|
|
7843
7928
|
pushDelta("thought", fallbackThoughts);
|
|
7844
7929
|
}
|
|
7845
|
-
if (!
|
|
7930
|
+
if (!sawResponseDelta2 && fallbackText.length > 0) {
|
|
7846
7931
|
pushDelta("response", fallbackText);
|
|
7847
7932
|
}
|
|
7848
7933
|
} else if (provider === "fireworks") {
|
|
@@ -8562,7 +8647,7 @@ async function runToolLoop(request) {
|
|
|
8562
8647
|
try {
|
|
8563
8648
|
if (providerInfo.provider === "openai") {
|
|
8564
8649
|
const openAiAgentTools = buildOpenAiToolsFromToolSet(request.tools);
|
|
8565
|
-
const openAiNativeTools = toOpenAiTools(request.modelTools);
|
|
8650
|
+
const openAiNativeTools = toOpenAiTools(request.modelTools, { provider: "openai" });
|
|
8566
8651
|
const openAiTools = openAiNativeTools ? [...openAiNativeTools, ...openAiAgentTools] : [...openAiAgentTools];
|
|
8567
8652
|
const reasoningEffort = resolveOpenAiReasoningEffort(
|
|
8568
8653
|
providerInfo.model,
|
|
@@ -8614,6 +8699,7 @@ async function runToolLoop(request) {
|
|
|
8614
8699
|
const stepRequestPayload = {
|
|
8615
8700
|
model: providerInfo.model,
|
|
8616
8701
|
input: preparedInput,
|
|
8702
|
+
...providerInfo.serviceTier ? { service_tier: providerInfo.serviceTier } : {},
|
|
8617
8703
|
...previousResponseId ? { previous_response_id: previousResponseId } : {},
|
|
8618
8704
|
...openAiTools.length > 0 ? { tools: openAiTools } : {},
|
|
8619
8705
|
...openAiTools.length > 0 ? { parallel_tool_calls: true } : {},
|
|
@@ -8642,6 +8728,7 @@ async function runToolLoop(request) {
|
|
|
8642
8728
|
{
|
|
8643
8729
|
model: providerInfo.model,
|
|
8644
8730
|
input: preparedInput,
|
|
8731
|
+
...providerInfo.serviceTier ? { service_tier: providerInfo.serviceTier } : {},
|
|
8645
8732
|
...previousResponseId ? { previous_response_id: previousResponseId } : {},
|
|
8646
8733
|
...openAiTools.length > 0 ? { tools: openAiTools } : {},
|
|
8647
8734
|
...openAiTools.length > 0 ? { parallel_tool_calls: true } : {},
|
|
@@ -8963,7 +9050,7 @@ async function runToolLoop(request) {
|
|
|
8963
9050
|
}
|
|
8964
9051
|
if (providerInfo.provider === "chatgpt") {
|
|
8965
9052
|
const openAiAgentTools = buildOpenAiToolsFromToolSet(request.tools);
|
|
8966
|
-
const openAiNativeTools = toOpenAiTools(request.modelTools);
|
|
9053
|
+
const openAiNativeTools = toOpenAiTools(request.modelTools, { provider: "chatgpt" });
|
|
8967
9054
|
const openAiTools = openAiNativeTools ? [...openAiNativeTools, ...openAiAgentTools] : [...openAiAgentTools];
|
|
8968
9055
|
const reasoningEffort = resolveOpenAiReasoningEffort(request.model, request.thinkingLevel);
|
|
8969
9056
|
const toolLoopInput = toChatGptInput(contents, {
|
|
@@ -12653,7 +12740,7 @@ function isCodexModel(model) {
|
|
|
12653
12740
|
return true;
|
|
12654
12741
|
}
|
|
12655
12742
|
const normalized = model.startsWith("chatgpt-") ? model.slice("chatgpt-".length) : model;
|
|
12656
|
-
return normalized.includes("codex") || normalized === "gpt-5.4" || normalized === "gpt-5.4-fast";
|
|
12743
|
+
return normalized.includes("codex") || normalized === "gpt-5.5" || normalized === "gpt-5.5-fast" || normalized === "gpt-5.4" || normalized === "gpt-5.4-fast";
|
|
12657
12744
|
}
|
|
12658
12745
|
function isGeminiModel(model) {
|
|
12659
12746
|
return model.startsWith("gemini-");
|