@ljoukov/llm 3.0.15 → 4.0.0

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
@@ -19,8 +19,6 @@ declare function estimateCallCostUsd({ modelId, tokens, responseImages, imageSiz
19
19
  imageSize?: string;
20
20
  }): number;
21
21
 
22
- type OpenAiReasoningEffort = "low" | "medium" | "high" | "xhigh";
23
-
24
22
  type LlmToolCallContext = {
25
23
  readonly toolName: string;
26
24
  readonly toolId: string;
@@ -59,6 +57,7 @@ type LlmToolOutputContentItem = {
59
57
  readonly filename?: string | null;
60
58
  };
61
59
  type LlmImageSize = "1K" | "2K" | "4K";
60
+ type LlmThinkingLevel = "low" | "medium" | "high";
62
61
  type LlmWebSearchMode = "cached" | "live";
63
62
  type LlmToolConfig = {
64
63
  readonly type: "web-search";
@@ -190,7 +189,7 @@ type LlmBaseRequest = {
190
189
  readonly responseModalities?: readonly string[];
191
190
  readonly imageAspectRatio?: string;
192
191
  readonly imageSize?: LlmImageSize;
193
- readonly openAiReasoningEffort?: OpenAiReasoningEffort;
192
+ readonly thinkingLevel?: LlmThinkingLevel;
194
193
  readonly openAiTextFormat?: ResponseTextConfig["format"];
195
194
  readonly signal?: AbortSignal;
196
195
  };
@@ -334,7 +333,7 @@ type LlmToolLoopRequest = LlmInput & {
334
333
  readonly tools: LlmToolSet;
335
334
  readonly modelTools?: readonly LlmToolConfig[];
336
335
  readonly maxSteps?: number;
337
- readonly openAiReasoningEffort?: OpenAiReasoningEffort;
336
+ readonly thinkingLevel?: LlmThinkingLevel;
338
337
  readonly steering?: LlmToolLoopSteeringChannel;
339
338
  readonly onEvent?: (event: LlmStreamEvent) => void;
340
339
  readonly signal?: AbortSignal;
@@ -868,4 +867,4 @@ declare const FIREWORKS_DEFAULT_GPT_OSS_120B_MODEL: FireworksModelId;
868
867
  declare function isFireworksModelId(value: string): value is FireworksModelId;
869
868
  declare function resolveFireworksModelId(model: string): string | undefined;
870
869
 
871
- export { type AgentDirectoryEntry, type AgentFilesystem, type AgentFilesystemToolAccessContext, type AgentFilesystemToolAccessHook, type AgentFilesystemToolAction, type AgentFilesystemToolConfig, type AgentFilesystemToolName, type AgentFilesystemToolProfile, type AgentFilesystemToolSelection, type AgentFilesystemToolsOptions, type AgentLoopStream, type AgentPathInfo, type AgentPathKind, type AgentRunCompletedTelemetryEvent, type AgentRunStartedTelemetryEvent, type AgentRunStreamTelemetryEvent, type AgentSubagentToolConfig, type AgentSubagentToolPromptPattern, type AgentSubagentToolSelection, type AgentTelemetryConfig, type AgentTelemetryEvent, type AgentTelemetrySelection, type AgentTelemetrySink, 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, 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 LlmBaseRequest, type LlmBlockedEvent, type LlmContent, type LlmContentPart, type LlmCustomTool, type LlmCustomToolInputFormat, type LlmExecutableTool, type LlmFunctionTool, type LlmImageData, type LlmImageModelId, type LlmImageSize, type LlmInput, type LlmInputMessage, LlmJsonCallError, type LlmJsonRequest, type LlmJsonStream, type LlmJsonStreamEvent, type LlmJsonStreamRequest, type LlmModelEvent, type LlmModelId, type LlmProvider, type LlmStreamEvent, type LlmTextDeltaEvent, type LlmTextModelId, type LlmTextRequest, type LlmTextResult, type LlmTextStream, 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, appendMarkdownSourcesSection, applyPatch, configureGemini, configureModelConcurrency, convertGooglePartsToLlmParts, createApplyPatchTool, createCodexApplyPatchTool, createCodexFilesystemToolSet, createCodexReadFileTool, createFilesystemToolSetForModel, createGeminiFilesystemToolSet, createGeminiReadFileTool, createGlobTool, createGrepFilesTool, createGrepSearchTool, createInMemoryAgentFilesystem, createListDirTool, createListDirectoryTool, createModelAgnosticFilesystemToolSet, createNodeAgentFilesystem, createReplaceTool, createRgSearchTool, createToolLoopSteeringChannel, createViewImageTool, createWriteFileTool, customTool, encodeChatGptAuthJson, encodeChatGptAuthJsonB64, estimateCallCostUsd, exchangeChatGptOauthCode, generateImageInBatches, generateImages, generateJson, generateText, getChatGptAuthProfile, getCurrentToolCallContext, isChatGptModelId, isFireworksModelId, isGeminiImageModelId, isGeminiModelId, isGeminiTextModelId, isLlmImageModelId, isLlmModelId, isLlmTextModelId, isOpenAiModelId, loadEnvFromFile, loadLocalEnv, parseJsonFromLlmText, refreshChatGptOauthToken, resetModelConcurrencyConfig, resolveFilesystemToolProfile, resolveFireworksModelId, runAgentLoop, runCandidateEvolution, runToolLoop, sanitisePartForLogging, streamAgentLoop, streamJson, streamText, streamToolLoop, stripCodexCitationMarkers, toGeminiJsonSchema, tool };
870
+ export { type AgentDirectoryEntry, type AgentFilesystem, type AgentFilesystemToolAccessContext, type AgentFilesystemToolAccessHook, type AgentFilesystemToolAction, type AgentFilesystemToolConfig, type AgentFilesystemToolName, type AgentFilesystemToolProfile, type AgentFilesystemToolSelection, type AgentFilesystemToolsOptions, type AgentLoopStream, type AgentPathInfo, type AgentPathKind, type AgentRunCompletedTelemetryEvent, type AgentRunStartedTelemetryEvent, type AgentRunStreamTelemetryEvent, type AgentSubagentToolConfig, type AgentSubagentToolPromptPattern, type AgentSubagentToolSelection, type AgentTelemetryConfig, type AgentTelemetryEvent, type AgentTelemetrySelection, type AgentTelemetrySink, 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, 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 LlmBaseRequest, type LlmBlockedEvent, type LlmContent, type LlmContentPart, type LlmCustomTool, type LlmCustomToolInputFormat, type LlmExecutableTool, type LlmFunctionTool, type LlmImageData, type LlmImageModelId, type LlmImageSize, type LlmInput, type LlmInputMessage, LlmJsonCallError, type LlmJsonRequest, type LlmJsonStream, type LlmJsonStreamEvent, type LlmJsonStreamRequest, type LlmModelEvent, type LlmModelId, type LlmProvider, type LlmStreamEvent, 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, appendMarkdownSourcesSection, applyPatch, configureGemini, configureModelConcurrency, convertGooglePartsToLlmParts, createApplyPatchTool, createCodexApplyPatchTool, createCodexFilesystemToolSet, createCodexReadFileTool, createFilesystemToolSetForModel, createGeminiFilesystemToolSet, createGeminiReadFileTool, createGlobTool, createGrepFilesTool, createGrepSearchTool, createInMemoryAgentFilesystem, createListDirTool, createListDirectoryTool, createModelAgnosticFilesystemToolSet, createNodeAgentFilesystem, createReplaceTool, createRgSearchTool, createToolLoopSteeringChannel, createViewImageTool, createWriteFileTool, customTool, encodeChatGptAuthJson, encodeChatGptAuthJsonB64, estimateCallCostUsd, exchangeChatGptOauthCode, generateImageInBatches, generateImages, generateJson, generateText, getChatGptAuthProfile, getCurrentToolCallContext, isChatGptModelId, isFireworksModelId, isGeminiImageModelId, isGeminiModelId, isGeminiTextModelId, isLlmImageModelId, isLlmModelId, isLlmTextModelId, isOpenAiModelId, loadEnvFromFile, loadLocalEnv, parseJsonFromLlmText, refreshChatGptOauthToken, resetModelConcurrencyConfig, resolveFilesystemToolProfile, resolveFireworksModelId, runAgentLoop, runCandidateEvolution, runToolLoop, sanitisePartForLogging, streamAgentLoop, streamJson, streamText, streamToolLoop, stripCodexCitationMarkers, toGeminiJsonSchema, tool };
package/dist/index.d.ts CHANGED
@@ -19,8 +19,6 @@ declare function estimateCallCostUsd({ modelId, tokens, responseImages, imageSiz
19
19
  imageSize?: string;
20
20
  }): number;
21
21
 
22
- type OpenAiReasoningEffort = "low" | "medium" | "high" | "xhigh";
23
-
24
22
  type LlmToolCallContext = {
25
23
  readonly toolName: string;
26
24
  readonly toolId: string;
@@ -59,6 +57,7 @@ type LlmToolOutputContentItem = {
59
57
  readonly filename?: string | null;
60
58
  };
61
59
  type LlmImageSize = "1K" | "2K" | "4K";
60
+ type LlmThinkingLevel = "low" | "medium" | "high";
62
61
  type LlmWebSearchMode = "cached" | "live";
63
62
  type LlmToolConfig = {
64
63
  readonly type: "web-search";
@@ -190,7 +189,7 @@ type LlmBaseRequest = {
190
189
  readonly responseModalities?: readonly string[];
191
190
  readonly imageAspectRatio?: string;
192
191
  readonly imageSize?: LlmImageSize;
193
- readonly openAiReasoningEffort?: OpenAiReasoningEffort;
192
+ readonly thinkingLevel?: LlmThinkingLevel;
194
193
  readonly openAiTextFormat?: ResponseTextConfig["format"];
195
194
  readonly signal?: AbortSignal;
196
195
  };
@@ -334,7 +333,7 @@ type LlmToolLoopRequest = LlmInput & {
334
333
  readonly tools: LlmToolSet;
335
334
  readonly modelTools?: readonly LlmToolConfig[];
336
335
  readonly maxSteps?: number;
337
- readonly openAiReasoningEffort?: OpenAiReasoningEffort;
336
+ readonly thinkingLevel?: LlmThinkingLevel;
338
337
  readonly steering?: LlmToolLoopSteeringChannel;
339
338
  readonly onEvent?: (event: LlmStreamEvent) => void;
340
339
  readonly signal?: AbortSignal;
@@ -868,4 +867,4 @@ declare const FIREWORKS_DEFAULT_GPT_OSS_120B_MODEL: FireworksModelId;
868
867
  declare function isFireworksModelId(value: string): value is FireworksModelId;
869
868
  declare function resolveFireworksModelId(model: string): string | undefined;
870
869
 
871
- export { type AgentDirectoryEntry, type AgentFilesystem, type AgentFilesystemToolAccessContext, type AgentFilesystemToolAccessHook, type AgentFilesystemToolAction, type AgentFilesystemToolConfig, type AgentFilesystemToolName, type AgentFilesystemToolProfile, type AgentFilesystemToolSelection, type AgentFilesystemToolsOptions, type AgentLoopStream, type AgentPathInfo, type AgentPathKind, type AgentRunCompletedTelemetryEvent, type AgentRunStartedTelemetryEvent, type AgentRunStreamTelemetryEvent, type AgentSubagentToolConfig, type AgentSubagentToolPromptPattern, type AgentSubagentToolSelection, type AgentTelemetryConfig, type AgentTelemetryEvent, type AgentTelemetrySelection, type AgentTelemetrySink, 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, 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 LlmBaseRequest, type LlmBlockedEvent, type LlmContent, type LlmContentPart, type LlmCustomTool, type LlmCustomToolInputFormat, type LlmExecutableTool, type LlmFunctionTool, type LlmImageData, type LlmImageModelId, type LlmImageSize, type LlmInput, type LlmInputMessage, LlmJsonCallError, type LlmJsonRequest, type LlmJsonStream, type LlmJsonStreamEvent, type LlmJsonStreamRequest, type LlmModelEvent, type LlmModelId, type LlmProvider, type LlmStreamEvent, type LlmTextDeltaEvent, type LlmTextModelId, type LlmTextRequest, type LlmTextResult, type LlmTextStream, 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, appendMarkdownSourcesSection, applyPatch, configureGemini, configureModelConcurrency, convertGooglePartsToLlmParts, createApplyPatchTool, createCodexApplyPatchTool, createCodexFilesystemToolSet, createCodexReadFileTool, createFilesystemToolSetForModel, createGeminiFilesystemToolSet, createGeminiReadFileTool, createGlobTool, createGrepFilesTool, createGrepSearchTool, createInMemoryAgentFilesystem, createListDirTool, createListDirectoryTool, createModelAgnosticFilesystemToolSet, createNodeAgentFilesystem, createReplaceTool, createRgSearchTool, createToolLoopSteeringChannel, createViewImageTool, createWriteFileTool, customTool, encodeChatGptAuthJson, encodeChatGptAuthJsonB64, estimateCallCostUsd, exchangeChatGptOauthCode, generateImageInBatches, generateImages, generateJson, generateText, getChatGptAuthProfile, getCurrentToolCallContext, isChatGptModelId, isFireworksModelId, isGeminiImageModelId, isGeminiModelId, isGeminiTextModelId, isLlmImageModelId, isLlmModelId, isLlmTextModelId, isOpenAiModelId, loadEnvFromFile, loadLocalEnv, parseJsonFromLlmText, refreshChatGptOauthToken, resetModelConcurrencyConfig, resolveFilesystemToolProfile, resolveFireworksModelId, runAgentLoop, runCandidateEvolution, runToolLoop, sanitisePartForLogging, streamAgentLoop, streamJson, streamText, streamToolLoop, stripCodexCitationMarkers, toGeminiJsonSchema, tool };
870
+ export { type AgentDirectoryEntry, type AgentFilesystem, type AgentFilesystemToolAccessContext, type AgentFilesystemToolAccessHook, type AgentFilesystemToolAction, type AgentFilesystemToolConfig, type AgentFilesystemToolName, type AgentFilesystemToolProfile, type AgentFilesystemToolSelection, type AgentFilesystemToolsOptions, type AgentLoopStream, type AgentPathInfo, type AgentPathKind, type AgentRunCompletedTelemetryEvent, type AgentRunStartedTelemetryEvent, type AgentRunStreamTelemetryEvent, type AgentSubagentToolConfig, type AgentSubagentToolPromptPattern, type AgentSubagentToolSelection, type AgentTelemetryConfig, type AgentTelemetryEvent, type AgentTelemetrySelection, type AgentTelemetrySink, 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, 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 LlmBaseRequest, type LlmBlockedEvent, type LlmContent, type LlmContentPart, type LlmCustomTool, type LlmCustomToolInputFormat, type LlmExecutableTool, type LlmFunctionTool, type LlmImageData, type LlmImageModelId, type LlmImageSize, type LlmInput, type LlmInputMessage, LlmJsonCallError, type LlmJsonRequest, type LlmJsonStream, type LlmJsonStreamEvent, type LlmJsonStreamRequest, type LlmModelEvent, type LlmModelId, type LlmProvider, type LlmStreamEvent, 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, appendMarkdownSourcesSection, applyPatch, configureGemini, configureModelConcurrency, convertGooglePartsToLlmParts, createApplyPatchTool, createCodexApplyPatchTool, createCodexFilesystemToolSet, createCodexReadFileTool, createFilesystemToolSetForModel, createGeminiFilesystemToolSet, createGeminiReadFileTool, createGlobTool, createGrepFilesTool, createGrepSearchTool, createInMemoryAgentFilesystem, createListDirTool, createListDirectoryTool, createModelAgnosticFilesystemToolSet, createNodeAgentFilesystem, createReplaceTool, createRgSearchTool, createToolLoopSteeringChannel, createViewImageTool, createWriteFileTool, customTool, encodeChatGptAuthJson, encodeChatGptAuthJsonB64, estimateCallCostUsd, exchangeChatGptOauthCode, generateImageInBatches, generateImages, generateJson, generateText, getChatGptAuthProfile, getCurrentToolCallContext, isChatGptModelId, isFireworksModelId, isGeminiImageModelId, isGeminiModelId, isGeminiTextModelId, isLlmImageModelId, isLlmModelId, isLlmTextModelId, isOpenAiModelId, loadEnvFromFile, loadLocalEnv, parseJsonFromLlmText, refreshChatGptOauthToken, resetModelConcurrencyConfig, resolveFilesystemToolProfile, resolveFireworksModelId, runAgentLoop, runCandidateEvolution, runToolLoop, sanitisePartForLogging, streamAgentLoop, streamJson, streamText, streamToolLoop, stripCodexCitationMarkers, toGeminiJsonSchema, tool };
package/dist/index.js CHANGED
@@ -4,7 +4,8 @@ import { AsyncLocalStorage } from "async_hooks";
4
4
  import { randomBytes } from "crypto";
5
5
  import {
6
6
  FinishReason,
7
- FunctionCallingConfigMode
7
+ FunctionCallingConfigMode,
8
+ ThinkingLevel
8
9
  } from "@google/genai";
9
10
  import { zodToJsonSchema } from "@alcyone-labs/zod-to-json-schema";
10
11
  import { z as z3 } from "zod";
@@ -3041,9 +3042,16 @@ function resolveProvider(model) {
3041
3042
  function isOpenAiCodexModel(modelId) {
3042
3043
  return modelId.includes("codex");
3043
3044
  }
3044
- function resolveOpenAiReasoningEffort(modelId, override) {
3045
- if (override) {
3046
- return override;
3045
+ function resolveOpenAiReasoningEffort(modelId, thinkingLevel) {
3046
+ if (thinkingLevel) {
3047
+ switch (thinkingLevel) {
3048
+ case "low":
3049
+ return "low";
3050
+ case "medium":
3051
+ return "medium";
3052
+ case "high":
3053
+ return "xhigh";
3054
+ }
3047
3055
  }
3048
3056
  if (isOpenAiCodexModel(modelId)) {
3049
3057
  return "medium";
@@ -4328,10 +4336,42 @@ function extractFireworksToolCalls(message) {
4328
4336
  }
4329
4337
  return calls;
4330
4338
  }
4331
- function resolveGeminiThinkingConfig(modelId) {
4339
+ function toGeminiThinkingLevel(thinkingLevel) {
4340
+ switch (thinkingLevel) {
4341
+ case "low":
4342
+ return ThinkingLevel.LOW;
4343
+ case "medium":
4344
+ return ThinkingLevel.MEDIUM;
4345
+ case "high":
4346
+ return ThinkingLevel.HIGH;
4347
+ }
4348
+ }
4349
+ function toGemini25ProThinkingBudget(thinkingLevel) {
4350
+ switch (thinkingLevel) {
4351
+ case "low":
4352
+ return 256;
4353
+ case "medium":
4354
+ return 4096;
4355
+ case "high":
4356
+ return 32768;
4357
+ }
4358
+ }
4359
+ function resolveGeminiThinkingConfig(modelId, thinkingLevel) {
4332
4360
  if (isGeminiImageModelId(modelId)) {
4333
4361
  return void 0;
4334
4362
  }
4363
+ if (thinkingLevel) {
4364
+ if (modelId === "gemini-2.5-pro") {
4365
+ return {
4366
+ includeThoughts: true,
4367
+ thinkingBudget: toGemini25ProThinkingBudget(thinkingLevel)
4368
+ };
4369
+ }
4370
+ return {
4371
+ includeThoughts: true,
4372
+ thinkingLevel: toGeminiThinkingLevel(thinkingLevel)
4373
+ };
4374
+ }
4335
4375
  switch (modelId) {
4336
4376
  case "gemini-3.1-pro-preview":
4337
4377
  return { includeThoughts: true };
@@ -4418,10 +4458,7 @@ async function runTextCall(params) {
4418
4458
  if (provider === "openai") {
4419
4459
  const openAiInput = toOpenAiInput(contents);
4420
4460
  const openAiTools = toOpenAiTools(request.tools);
4421
- const reasoningEffort = resolveOpenAiReasoningEffort(
4422
- modelForProvider,
4423
- request.openAiReasoningEffort
4424
- );
4461
+ const reasoningEffort = resolveOpenAiReasoningEffort(modelForProvider, request.thinkingLevel);
4425
4462
  const openAiTextConfig = {
4426
4463
  format: request.openAiTextFormat ?? { type: "text" },
4427
4464
  verbosity: resolveOpenAiVerbosity(modelForProvider)
@@ -4491,10 +4528,7 @@ async function runTextCall(params) {
4491
4528
  }, modelForProvider);
4492
4529
  } else if (provider === "chatgpt") {
4493
4530
  const chatGptInput = toChatGptInput(contents);
4494
- const reasoningEffort = resolveOpenAiReasoningEffort(
4495
- request.model,
4496
- request.openAiReasoningEffort
4497
- );
4531
+ const reasoningEffort = resolveOpenAiReasoningEffort(request.model, request.thinkingLevel);
4498
4532
  const openAiTools = toOpenAiTools(request.tools);
4499
4533
  const requestPayload = {
4500
4534
  model: modelForProvider,
@@ -4586,7 +4620,7 @@ async function runTextCall(params) {
4586
4620
  }, modelForProvider);
4587
4621
  } else {
4588
4622
  const geminiContents = contents.map(convertLlmContentToGeminiContent);
4589
- const thinkingConfig = resolveGeminiThinkingConfig(modelForProvider);
4623
+ const thinkingConfig = resolveGeminiThinkingConfig(modelForProvider, request.thinkingLevel);
4590
4624
  const config = {
4591
4625
  maxOutputTokens: 32e3,
4592
4626
  ...thinkingConfig ? { thinkingConfig } : {},
@@ -4764,7 +4798,7 @@ function streamJson(request) {
4764
4798
  tools: request.tools,
4765
4799
  responseMimeType: request.responseMimeType ?? "application/json",
4766
4800
  responseJsonSchema,
4767
- openAiReasoningEffort: request.openAiReasoningEffort,
4801
+ thinkingLevel: request.thinkingLevel,
4768
4802
  ...openAiTextFormatForAttempt ? { openAiTextFormat: openAiTextFormatForAttempt } : {},
4769
4803
  signal
4770
4804
  });
@@ -4841,7 +4875,7 @@ async function generateJson(request) {
4841
4875
  tools: request.tools,
4842
4876
  responseMimeType: request.responseMimeType ?? "application/json",
4843
4877
  responseJsonSchema,
4844
- openAiReasoningEffort: request.openAiReasoningEffort,
4878
+ thinkingLevel: request.thinkingLevel,
4845
4879
  ...openAiTextFormatForAttempt ? { openAiTextFormat: openAiTextFormatForAttempt } : {},
4846
4880
  signal: request.signal
4847
4881
  });
@@ -5107,7 +5141,7 @@ async function runToolLoop(request) {
5107
5141
  const openAiTools = openAiNativeTools ? [...openAiNativeTools, ...openAiAgentTools] : [...openAiAgentTools];
5108
5142
  const reasoningEffort = resolveOpenAiReasoningEffort(
5109
5143
  providerInfo.model,
5110
- request.openAiReasoningEffort
5144
+ request.thinkingLevel
5111
5145
  );
5112
5146
  const textConfig = {
5113
5147
  format: { type: "text" },
@@ -5375,10 +5409,7 @@ async function runToolLoop(request) {
5375
5409
  const openAiAgentTools = buildOpenAiToolsFromToolSet(request.tools);
5376
5410
  const openAiNativeTools = toOpenAiTools(request.modelTools);
5377
5411
  const openAiTools = openAiNativeTools ? [...openAiNativeTools, ...openAiAgentTools] : [...openAiAgentTools];
5378
- const reasoningEffort = resolveOpenAiReasoningEffort(
5379
- request.model,
5380
- request.openAiReasoningEffort
5381
- );
5412
+ const reasoningEffort = resolveOpenAiReasoningEffort(request.model, request.thinkingLevel);
5382
5413
  const toolLoopInput = toChatGptInput(contents);
5383
5414
  const conversationId = `tool-loop-${randomBytes(8).toString("hex")}`;
5384
5415
  const promptCacheKey = conversationId;
@@ -5817,7 +5848,7 @@ async function runToolLoop(request) {
5817
5848
  firstModelEventAtMs = Date.now();
5818
5849
  }
5819
5850
  };
5820
- const thinkingConfig = resolveGeminiThinkingConfig(request.model);
5851
+ const thinkingConfig = resolveGeminiThinkingConfig(request.model, request.thinkingLevel);
5821
5852
  const config = {
5822
5853
  maxOutputTokens: 32e3,
5823
5854
  tools: geminiTools,
@@ -9193,7 +9224,7 @@ function createSubagentController(params) {
9193
9224
  subagentTool: params.subagentSelection,
9194
9225
  modelTools: params.toolLoopRequest.modelTools,
9195
9226
  maxSteps: subagentRequest.maxSteps,
9196
- openAiReasoningEffort: params.toolLoopRequest.openAiReasoningEffort,
9227
+ thinkingLevel: params.toolLoopRequest.thinkingLevel,
9197
9228
  signal: subagentRequest.signal
9198
9229
  },
9199
9230
  {