@ljoukov/llm 3.0.14 → 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.cjs +94 -26
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -5
- package/dist/index.d.ts +4 -5
- package/dist/index.js +96 -27
- package/dist/index.js.map +1 -1
- package/package.json +6 -4
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
|
|
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
|
|
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
|
|
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
|
|
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";
|
|
@@ -86,9 +87,14 @@ var FIREWORKS_GLM_5_PRICING = {
|
|
|
86
87
|
};
|
|
87
88
|
var FIREWORKS_MINIMAX_M21_PRICING = {
|
|
88
89
|
inputRate: 0.3 / 1e6,
|
|
89
|
-
cachedRate: 0.
|
|
90
|
+
cachedRate: 0.03 / 1e6,
|
|
90
91
|
outputRate: 1.2 / 1e6
|
|
91
92
|
};
|
|
93
|
+
var FIREWORKS_GPT_OSS_120B_PRICING = {
|
|
94
|
+
inputRate: 0.15 / 1e6,
|
|
95
|
+
cachedRate: 0.075 / 1e6,
|
|
96
|
+
outputRate: 0.6 / 1e6
|
|
97
|
+
};
|
|
92
98
|
function getFireworksPricing(modelId) {
|
|
93
99
|
if (modelId.includes("kimi-k2.5") || modelId.includes("kimi-k2p5")) {
|
|
94
100
|
return FIREWORKS_KIMI_K25_PRICING;
|
|
@@ -99,6 +105,9 @@ function getFireworksPricing(modelId) {
|
|
|
99
105
|
if (modelId.includes("minimax-m2.1") || modelId.includes("minimax-m2p1")) {
|
|
100
106
|
return FIREWORKS_MINIMAX_M21_PRICING;
|
|
101
107
|
}
|
|
108
|
+
if (modelId.includes("gpt-oss-120b")) {
|
|
109
|
+
return FIREWORKS_GPT_OSS_120B_PRICING;
|
|
110
|
+
}
|
|
102
111
|
return void 0;
|
|
103
112
|
}
|
|
104
113
|
|
|
@@ -130,7 +139,16 @@ var GEMINI_2_5_FLASH_PRICING = {
|
|
|
130
139
|
outputRateLow: 2.5 / 1e6,
|
|
131
140
|
outputRateHigh: 2.5 / 1e6
|
|
132
141
|
};
|
|
133
|
-
var
|
|
142
|
+
var GEMINI_2_5_FLASH_LITE_PRICING = {
|
|
143
|
+
threshold: 2e5,
|
|
144
|
+
inputRateLow: 0.1 / 1e6,
|
|
145
|
+
inputRateHigh: 0.1 / 1e6,
|
|
146
|
+
cachedRateLow: 0.025 / 1e6,
|
|
147
|
+
cachedRateHigh: 0.025 / 1e6,
|
|
148
|
+
outputRateLow: 0.4 / 1e6,
|
|
149
|
+
outputRateHigh: 0.4 / 1e6
|
|
150
|
+
};
|
|
151
|
+
var GEMINI_3_PRO_IMAGE_PREVIEW_PRICING = {
|
|
134
152
|
inputRate: 2 / 1e6,
|
|
135
153
|
cachedRate: 0.2 / 1e6,
|
|
136
154
|
outputTextRate: 12 / 1e6,
|
|
@@ -141,11 +159,26 @@ var GEMINI_IMAGE_PREVIEW_PRICING = {
|
|
|
141
159
|
"4K": 0.24
|
|
142
160
|
}
|
|
143
161
|
};
|
|
162
|
+
var GEMINI_3_1_FLASH_IMAGE_PREVIEW_PRICING = {
|
|
163
|
+
inputRate: 0.5 / 1e6,
|
|
164
|
+
cachedRate: 0.125 / 1e6,
|
|
165
|
+
outputTextRate: 3 / 1e6,
|
|
166
|
+
outputImageRate: 60 / 1e6,
|
|
167
|
+
imagePrices: {
|
|
168
|
+
"512": 0.045,
|
|
169
|
+
"1K": 0.067,
|
|
170
|
+
"2K": 0.101,
|
|
171
|
+
"4K": 0.15
|
|
172
|
+
}
|
|
173
|
+
};
|
|
144
174
|
function getGeminiProPricing(modelId) {
|
|
145
175
|
if (modelId.includes("gemini-2.5-pro")) {
|
|
146
176
|
return GEMINI_2_5_PRO_PRICING;
|
|
147
177
|
}
|
|
148
|
-
if (modelId.includes("gemini-
|
|
178
|
+
if (modelId.includes("gemini-flash-lite-latest")) {
|
|
179
|
+
return GEMINI_2_5_FLASH_LITE_PRICING;
|
|
180
|
+
}
|
|
181
|
+
if (modelId.includes("gemini-2.5-flash") || modelId.includes("gemini-flash-latest") || modelId.includes("gemini-3-flash-preview")) {
|
|
149
182
|
return GEMINI_2_5_FLASH_PRICING;
|
|
150
183
|
}
|
|
151
184
|
if (modelId.includes("gemini-3-pro") || modelId.includes("gemini-3.1-pro")) {
|
|
@@ -154,8 +187,14 @@ function getGeminiProPricing(modelId) {
|
|
|
154
187
|
return void 0;
|
|
155
188
|
}
|
|
156
189
|
function getGeminiImagePricing(modelId) {
|
|
190
|
+
if (modelId.includes("gemini-3.1-flash-image-preview")) {
|
|
191
|
+
return GEMINI_3_1_FLASH_IMAGE_PREVIEW_PRICING;
|
|
192
|
+
}
|
|
193
|
+
if (modelId.includes("gemini-3-pro-image-preview")) {
|
|
194
|
+
return GEMINI_3_PRO_IMAGE_PREVIEW_PRICING;
|
|
195
|
+
}
|
|
157
196
|
if (modelId.includes("image-preview")) {
|
|
158
|
-
return
|
|
197
|
+
return GEMINI_3_PRO_IMAGE_PREVIEW_PRICING;
|
|
159
198
|
}
|
|
160
199
|
return void 0;
|
|
161
200
|
}
|
|
@@ -3003,9 +3042,16 @@ function resolveProvider(model) {
|
|
|
3003
3042
|
function isOpenAiCodexModel(modelId) {
|
|
3004
3043
|
return modelId.includes("codex");
|
|
3005
3044
|
}
|
|
3006
|
-
function resolveOpenAiReasoningEffort(modelId,
|
|
3007
|
-
if (
|
|
3008
|
-
|
|
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
|
+
}
|
|
3009
3055
|
}
|
|
3010
3056
|
if (isOpenAiCodexModel(modelId)) {
|
|
3011
3057
|
return "medium";
|
|
@@ -4290,10 +4336,42 @@ function extractFireworksToolCalls(message) {
|
|
|
4290
4336
|
}
|
|
4291
4337
|
return calls;
|
|
4292
4338
|
}
|
|
4293
|
-
function
|
|
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) {
|
|
4294
4360
|
if (isGeminiImageModelId(modelId)) {
|
|
4295
4361
|
return void 0;
|
|
4296
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
|
+
}
|
|
4297
4375
|
switch (modelId) {
|
|
4298
4376
|
case "gemini-3.1-pro-preview":
|
|
4299
4377
|
return { includeThoughts: true };
|
|
@@ -4380,10 +4458,7 @@ async function runTextCall(params) {
|
|
|
4380
4458
|
if (provider === "openai") {
|
|
4381
4459
|
const openAiInput = toOpenAiInput(contents);
|
|
4382
4460
|
const openAiTools = toOpenAiTools(request.tools);
|
|
4383
|
-
const reasoningEffort = resolveOpenAiReasoningEffort(
|
|
4384
|
-
modelForProvider,
|
|
4385
|
-
request.openAiReasoningEffort
|
|
4386
|
-
);
|
|
4461
|
+
const reasoningEffort = resolveOpenAiReasoningEffort(modelForProvider, request.thinkingLevel);
|
|
4387
4462
|
const openAiTextConfig = {
|
|
4388
4463
|
format: request.openAiTextFormat ?? { type: "text" },
|
|
4389
4464
|
verbosity: resolveOpenAiVerbosity(modelForProvider)
|
|
@@ -4453,10 +4528,7 @@ async function runTextCall(params) {
|
|
|
4453
4528
|
}, modelForProvider);
|
|
4454
4529
|
} else if (provider === "chatgpt") {
|
|
4455
4530
|
const chatGptInput = toChatGptInput(contents);
|
|
4456
|
-
const reasoningEffort = resolveOpenAiReasoningEffort(
|
|
4457
|
-
request.model,
|
|
4458
|
-
request.openAiReasoningEffort
|
|
4459
|
-
);
|
|
4531
|
+
const reasoningEffort = resolveOpenAiReasoningEffort(request.model, request.thinkingLevel);
|
|
4460
4532
|
const openAiTools = toOpenAiTools(request.tools);
|
|
4461
4533
|
const requestPayload = {
|
|
4462
4534
|
model: modelForProvider,
|
|
@@ -4548,7 +4620,7 @@ async function runTextCall(params) {
|
|
|
4548
4620
|
}, modelForProvider);
|
|
4549
4621
|
} else {
|
|
4550
4622
|
const geminiContents = contents.map(convertLlmContentToGeminiContent);
|
|
4551
|
-
const thinkingConfig = resolveGeminiThinkingConfig(modelForProvider);
|
|
4623
|
+
const thinkingConfig = resolveGeminiThinkingConfig(modelForProvider, request.thinkingLevel);
|
|
4552
4624
|
const config = {
|
|
4553
4625
|
maxOutputTokens: 32e3,
|
|
4554
4626
|
...thinkingConfig ? { thinkingConfig } : {},
|
|
@@ -4726,7 +4798,7 @@ function streamJson(request) {
|
|
|
4726
4798
|
tools: request.tools,
|
|
4727
4799
|
responseMimeType: request.responseMimeType ?? "application/json",
|
|
4728
4800
|
responseJsonSchema,
|
|
4729
|
-
|
|
4801
|
+
thinkingLevel: request.thinkingLevel,
|
|
4730
4802
|
...openAiTextFormatForAttempt ? { openAiTextFormat: openAiTextFormatForAttempt } : {},
|
|
4731
4803
|
signal
|
|
4732
4804
|
});
|
|
@@ -4803,7 +4875,7 @@ async function generateJson(request) {
|
|
|
4803
4875
|
tools: request.tools,
|
|
4804
4876
|
responseMimeType: request.responseMimeType ?? "application/json",
|
|
4805
4877
|
responseJsonSchema,
|
|
4806
|
-
|
|
4878
|
+
thinkingLevel: request.thinkingLevel,
|
|
4807
4879
|
...openAiTextFormatForAttempt ? { openAiTextFormat: openAiTextFormatForAttempt } : {},
|
|
4808
4880
|
signal: request.signal
|
|
4809
4881
|
});
|
|
@@ -5069,7 +5141,7 @@ async function runToolLoop(request) {
|
|
|
5069
5141
|
const openAiTools = openAiNativeTools ? [...openAiNativeTools, ...openAiAgentTools] : [...openAiAgentTools];
|
|
5070
5142
|
const reasoningEffort = resolveOpenAiReasoningEffort(
|
|
5071
5143
|
providerInfo.model,
|
|
5072
|
-
request.
|
|
5144
|
+
request.thinkingLevel
|
|
5073
5145
|
);
|
|
5074
5146
|
const textConfig = {
|
|
5075
5147
|
format: { type: "text" },
|
|
@@ -5337,10 +5409,7 @@ async function runToolLoop(request) {
|
|
|
5337
5409
|
const openAiAgentTools = buildOpenAiToolsFromToolSet(request.tools);
|
|
5338
5410
|
const openAiNativeTools = toOpenAiTools(request.modelTools);
|
|
5339
5411
|
const openAiTools = openAiNativeTools ? [...openAiNativeTools, ...openAiAgentTools] : [...openAiAgentTools];
|
|
5340
|
-
const reasoningEffort = resolveOpenAiReasoningEffort(
|
|
5341
|
-
request.model,
|
|
5342
|
-
request.openAiReasoningEffort
|
|
5343
|
-
);
|
|
5412
|
+
const reasoningEffort = resolveOpenAiReasoningEffort(request.model, request.thinkingLevel);
|
|
5344
5413
|
const toolLoopInput = toChatGptInput(contents);
|
|
5345
5414
|
const conversationId = `tool-loop-${randomBytes(8).toString("hex")}`;
|
|
5346
5415
|
const promptCacheKey = conversationId;
|
|
@@ -5779,7 +5848,7 @@ async function runToolLoop(request) {
|
|
|
5779
5848
|
firstModelEventAtMs = Date.now();
|
|
5780
5849
|
}
|
|
5781
5850
|
};
|
|
5782
|
-
const thinkingConfig = resolveGeminiThinkingConfig(request.model);
|
|
5851
|
+
const thinkingConfig = resolveGeminiThinkingConfig(request.model, request.thinkingLevel);
|
|
5783
5852
|
const config = {
|
|
5784
5853
|
maxOutputTokens: 32e3,
|
|
5785
5854
|
tools: geminiTools,
|
|
@@ -9155,7 +9224,7 @@ function createSubagentController(params) {
|
|
|
9155
9224
|
subagentTool: params.subagentSelection,
|
|
9156
9225
|
modelTools: params.toolLoopRequest.modelTools,
|
|
9157
9226
|
maxSteps: subagentRequest.maxSteps,
|
|
9158
|
-
|
|
9227
|
+
thinkingLevel: params.toolLoopRequest.thinkingLevel,
|
|
9159
9228
|
signal: subagentRequest.signal
|
|
9160
9229
|
},
|
|
9161
9230
|
{
|