@cuylabs/agent-core 0.5.0 → 0.7.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/README.md +85 -372
- package/dist/{builder-RcTZuYnO.d.ts → builder-BRvqCcIk.d.ts} +2 -2
- package/dist/{resolver-DOfZ-xuk.d.ts → capability-resolver-CgRGsWVX.d.ts} +1 -1
- package/dist/{chunk-IMGQOTU2.js → chunk-3HNO5SVI.js} +286 -690
- package/dist/chunk-5K7AQVOU.js +619 -0
- package/dist/{chunk-QAQADS4X.js → chunk-BNSHUWCV.js} +1 -0
- package/dist/{chunk-OTUGSCED.js → chunk-CDTV2UYU.js} +159 -1
- package/dist/chunk-IEFIQENH.js +73 -0
- package/dist/chunk-N7P4PN3O.js +84 -0
- package/dist/{chunk-QWFMX226.js → chunk-QGOGIP7T.js} +148 -15
- package/dist/chunk-VNQBHPCT.js +398 -0
- package/dist/{chunk-X635CM2F.js → chunk-ZPMACVZK.js} +1 -1
- package/dist/context/index.js +1 -1
- package/dist/host/index.d.ts +45 -0
- package/dist/host/index.js +8 -0
- package/dist/{index-p0kOsVsE.d.ts → index-C33hlD6H.d.ts} +12 -7
- package/dist/{index-tmhaADz5.d.ts → index-CfBGYrpd.d.ts} +121 -2
- package/dist/index.d.ts +107 -126
- package/dist/index.js +322 -597
- package/dist/inference/index.d.ts +59 -0
- package/dist/inference/index.js +25 -0
- package/dist/middleware/index.d.ts +8 -4
- package/dist/middleware/index.js +5 -3
- package/dist/models/index.d.ts +104 -2
- package/dist/models/index.js +40 -6
- package/dist/prompt/index.d.ts +10 -6
- package/dist/reasoning/index.d.ts +54 -8
- package/dist/reasoning/index.js +2 -3
- package/dist/{registry-CuRWWtcT.d.ts → registry-BDLIHOQB.d.ts} +1 -1
- package/dist/{runner-C7aMP_x3.d.ts → runner-DSKaEz3z.d.ts} +290 -7
- package/dist/runtime/index.d.ts +41 -7
- package/dist/runtime/index.js +15 -6
- package/dist/scope/index.d.ts +10 -0
- package/dist/scope/index.js +14 -0
- package/dist/{session-manager-Uawm2Le7.d.ts → session-manager-B_CWGTsl.d.ts} +1 -1
- package/dist/skill/index.d.ts +7 -5
- package/dist/storage/index.d.ts +2 -2
- package/dist/sub-agent/index.d.ts +12 -8
- package/dist/tool/index.d.ts +8 -4
- package/dist/tool/index.js +4 -3
- package/dist/{tool-pFAnJc5Y.d.ts → tool-Db1Ue-1U.d.ts} +1 -1
- package/dist/{tool-DYp6-cC3.d.ts → tool-HUtkiVBx.d.ts} +5 -99
- package/dist/tracking/index.d.ts +3 -1
- package/dist/types-9jGQUjqW.d.ts +29 -0
- package/dist/types-CHiPh8U2.d.ts +100 -0
- package/dist/types-CqDZTh4d.d.ts +335 -0
- package/dist/types-FRpzzg_9.d.ts +355 -0
- package/package.json +19 -8
- package/dist/capabilities/index.d.ts +0 -97
- package/dist/capabilities/index.js +0 -46
- package/dist/chunk-6TDTQJ4P.js +0 -116
- package/dist/chunk-DWYX7ASF.js +0 -26
- package/dist/chunk-FG4MD5MU.js +0 -54
- package/dist/config-D2xeGEHK.d.ts +0 -52
- package/dist/identifiers-BLUxFqV_.d.ts +0 -12
- package/dist/network-D76DS5ot.d.ts +0 -5
- package/dist/types-MM1JoX5T.d.ts +0 -810
package/dist/index.d.ts
CHANGED
|
@@ -1,40 +1,47 @@
|
|
|
1
|
-
import { P as Preset, A as AppliedPreset, a as Agent } from './index-
|
|
2
|
-
export {
|
|
3
|
-
import { LanguageModel,
|
|
1
|
+
import { P as Preset, A as AppliedPreset, a as AgentConfig, b as Agent } from './index-C33hlD6H.js';
|
|
2
|
+
export { c as AgentProfile, C as CompactionConfig, D as DEFAULT_MAX_CONCURRENT, d as DEFAULT_MAX_SPAWN_DEPTH, e as DEFAULT_SESSION_TITLE_PREFIX, f as PRUNE_PROTECTED_TOOLS, S as SubAgentCompletedResult, g as SubAgentHandle, h as SubAgentStatus, i as SubAgentToolConfig, j as SubAgentTracker, k as SubAgentUsage, T as TracingConfig, l as createAgent, m as createSubAgentTools } from './index-C33hlD6H.js';
|
|
3
|
+
import { LanguageModel, Tool as Tool$1, TelemetrySettings, ModelMessage } from 'ai';
|
|
4
|
+
import { M as Message, T as TokenUsage } from './messages-BYWGn8TY.js';
|
|
5
|
+
export { A as AssistantMessage, a as MessageBase, b as MessageError, c as MessageRole, S as Session, d as SystemMessage, e as ToolMessage, U as UserMessage } from './messages-BYWGn8TY.js';
|
|
6
|
+
import { T as Tool } from './tool-Db1Ue-1U.js';
|
|
7
|
+
export { C as CompatibleSchema, I as InferSchemaOutput, R as RemoteSkillEntry, e as RemoteSkillIndex, d as SkillConfig, b as SkillContent, f as SkillDiscoveryError, S as SkillDiscoveryResult, a as SkillMetadata, c as SkillResource, g as SkillResourceType, h as SkillScope, i as SkillSource, j as SkillSourceType, k as defineTool } from './tool-Db1Ue-1U.js';
|
|
8
|
+
import { T as ToolHost } from './types-CHiPh8U2.js';
|
|
9
|
+
export { D as DirEntry, E as ExecOptions, a as ExecResult, F as FileStat } from './types-CHiPh8U2.js';
|
|
10
|
+
import { M as MiddlewareRunner, A as AgentEvent, d as StreamProvider, E as EnhancedTools } from './runner-DSKaEz3z.js';
|
|
11
|
+
export { h as AgentMiddleware, i as AgentModelHooks, j as AgentStatus, g as AgentTurnBoundaryKind, k as ApprovalEvent, B as BlockedModelCall, l as EnvironmentInfo, I as InstructionFile, m as ModelCallContext, e as ModelCallInput, n as ModelCallOutput, c as ModelFamily, o as ProcessorResult, a as PromptBuildContext, P as PromptConfig, b as PromptSection, f as StepProcessingResult, S as StreamChunk, p as StreamInput, q as StreamProviderConfig, r as StreamProviderFactory, s as StreamProviderInput, t as StreamProviderResult, T as ToolCallDecision } from './runner-DSKaEz3z.js';
|
|
12
|
+
import { E as ErrorCategory, R as ResponseHeaders, g as InterventionController } from './types-FRpzzg_9.js';
|
|
13
|
+
export { A as AnyInferenceResult, a as AnyStreamResult, C as CustomStreamProvider, b as CustomStreamResult, D as DEFAULT_MAX_OUTPUT_TOKENS, h as DEFAULT_RETRY_CONFIG, c as InferenceCustomResult, d as InferenceStepInfo, I as InferenceStreamInput, e as InferenceStreamResult, i as LLMError, j as LLMErrorOptions, L as LLMStreamInput, f as LLMStreamResult, O as OUTPUT_TOKEN_MAX, k as OnInterventionApplied, P as PendingIntervention, l as RetryConfig, m as RetryHandlerOptions, n as RetryState, S as StepInfo, T as ToolExecutionMode, o as calculateDelay, p as createRetryHandler, q as createRetryState, s as shouldRetry, r as sleep, w as withRetry } from './types-FRpzzg_9.js';
|
|
4
14
|
import { R as ReasoningLevel } from './types-CQaXbRsS.js';
|
|
5
|
-
export { a as ReasoningConfig } from './types-CQaXbRsS.js';
|
|
6
|
-
import {
|
|
7
|
-
export {
|
|
8
|
-
import {
|
|
9
|
-
export {
|
|
10
|
-
import {
|
|
11
|
-
export {
|
|
12
|
-
import {
|
|
13
|
-
export { C as
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
export {
|
|
17
|
-
export {
|
|
18
|
-
export {
|
|
19
|
-
export {
|
|
20
|
-
export {
|
|
21
|
-
export {
|
|
22
|
-
export {
|
|
23
|
-
export {
|
|
24
|
-
export { B as BranchEntry, C as CompactionEntry, a as CreateSessionOptions, F as FileEntry, M as MessageEntry, b as MetadataEntry, S as STORAGE_VERSION, c as SessionContext, d as SessionEntry, e as SessionHeader, f as SessionInfo, g as SessionManager, h as SessionStorage } from './session-manager-Uawm2Le7.js';
|
|
25
|
-
export { FileStorage, FileStorageOptions, MemoryStorage, buildMessagesFromEntries, configureDefaultSessionManager, deserializeMessage, generateEntryId, getDataDir, getDefaultSessionManager, getLeafId, getProjectSessionsDir, getSessionsDir, parseJSONL, serializeMessage, toJSONL } from './storage/index.js';
|
|
26
|
-
export { AgentTaskChatAdapter, AgentTaskCheckpointReason, AgentTaskCheckpointStrategy, AgentTaskCheckpointStrategyInput, AgentTaskExecutionCheckpoint, AgentTaskExecutionContext, AgentTaskExecutionRun, AgentTaskExecutionSnapshot, AgentTaskObserver, AgentTaskPayload, AgentTaskResult, AgentTaskRunner, AgentTaskRunnerOptions, AgentWorkflowAssistantMessageSnapshot, AgentWorkflowCommitResult, AgentWorkflowMessageSnapshot, AgentWorkflowModelStepPlan, AgentWorkflowModelStepResult, AgentWorkflowOperationPlan, AgentWorkflowOutputCommitPlan, AgentWorkflowReplayDecision, AgentWorkflowStepCommitPlan, AgentWorkflowSystemMessageSnapshot, AgentWorkflowToolBatchResult, AgentWorkflowToolCallPlan, AgentWorkflowToolCallResult, AgentWorkflowToolCallSnapshot, AgentWorkflowToolMessageSnapshot, AgentWorkflowTurnPhase, AgentWorkflowTurnState, AgentWorkflowUserMessageSnapshot, CreateAgentWorkflowTurnStateOptions, applyAgentWorkflowCommitResult, applyAgentWorkflowModelStepResult, applyAgentWorkflowToolBatchResult, applyAgentWorkflowToolCallResult, cloneAgentWorkflowTurnState, commitOutput, commitStep, convertAgentMessagesToModelMessages, createAgentTaskRunner, createAgentTurnStepCommitBatch, createAgentWorkflowTurnState, defaultAgentTaskCheckpointStrategy, failAgentWorkflowTurnState, planNextAgentWorkflowOperation, prepareModelStep, recordAgentWorkflowReplayDecision, restoreAgentWorkflowMessage, restoreAgentWorkflowMessages, runModelStep, runToolBatch, snapshotAgentWorkflowMessage, snapshotAgentWorkflowMessages } from './runtime/index.js';
|
|
27
|
-
import { R as RiskLevel, A as ApprovalConfig, a as ApprovalRule } from './index-tmhaADz5.js';
|
|
28
|
-
export { b as ApprovalAction, c as ApprovalMiddlewareConfig, d as ApprovalRequest, O as OtelMiddlewareConfig, T as TelemetryConfig, e as TelemetryConfigResult, f as approvalMiddleware, g as createTelemetryConfig, o as otelMiddleware } from './index-tmhaADz5.js';
|
|
15
|
+
export { E as EXTENDED_LEVELS, F as FIXED_LEVELS, a as ReasoningConfig, S as STANDARD_LEVELS, s as shouldIncludeReasoningSummary } from './types-CQaXbRsS.js';
|
|
16
|
+
import { ContextManager } from './context/index.js';
|
|
17
|
+
export { ContextLimits, DEFAULT_CONTEXT_LIMITS, PruneContextOptions, PruneResult, SummarizationOptions, estimateConversationTokens, estimateMessageTokens, estimateTokens, findCutPoint, generateSummary, isContextOverflowing, pruneContext, pruneToolResults, shouldPruneContext } from './context/index.js';
|
|
18
|
+
import { T as TurnChangeTracker } from './tracker-DClqYqTj.js';
|
|
19
|
+
export { F as FileBaseline, a as TurnFileChange, b as TurnSummary, c as TurnTrackerConfig, U as UndoResult, d as createTurnTracker } from './tracker-DClqYqTj.js';
|
|
20
|
+
import { P as PromptBuilder } from './builder-BRvqCcIk.js';
|
|
21
|
+
export { c as createPromptBuilder } from './builder-BRvqCcIk.js';
|
|
22
|
+
import { S as SessionManager } from './session-manager-B_CWGTsl.js';
|
|
23
|
+
export { B as BranchEntry, C as CompactionEntry, a as ConfigChangeEntry, b as CreateSessionOptions, E as EntryBase, F as FileEntry, M as MessageEntry, c as MetadataEntry, d as STORAGE_VERSION, e as SerializedMessage, f as SessionContext, g as SessionEntry, h as SessionHeader, i as SessionInfo, j as SessionStorage } from './session-manager-B_CWGTsl.js';
|
|
24
|
+
export { ExecuteAgentToolCallOptions, ExecuteAgentToolCallResult, MAX_BYTES, MAX_LINES, TRUNCATE_DIR, TRUNCATE_GLOB, ToolRegistry, ToolSpec, TruncateResult, defaultRegistry, executeAgentToolCall, formatSize, normalizeToolReplayPolicy, truncateOutput } from './tool/index.js';
|
|
25
|
+
import { R as RiskLevel, A as ApprovalConfig, a as ApprovalRule } from './index-CfBGYrpd.js';
|
|
26
|
+
export { b as ApprovalAction, c as ApprovalMiddlewareConfig, d as ApprovalRequest, C as CacheTTL, O as OtelMiddlewareConfig, P as PromptCacheConfig, T as TelemetryConfig, e as TelemetryConfigResult, f as approvalMiddleware, g as createTelemetryConfig, o as otelMiddleware, p as promptCacheMiddleware } from './index-CfBGYrpd.js';
|
|
27
|
+
export { AdapterSettings, CacheCapabilitySource, CapabilityCache, CapabilityOverrides, Directory, EngineSpec, Directory as ModelDirectory, Resolver as ModelResolver, ModelSpec, PatternCapabilitySource, RemoteCapabilityFetcher, RemoteCapabilitySource, Resolver, SyncResolver, applyCapabilityOverride, createResolver, findCapabilityOverride, getModelId, getNetworkStatus, getProviderCompatibility, getProviderId, inferProvider, likelySupportsReasoning } from './models/index.js';
|
|
28
|
+
export { C as CapabilitySource, D as DEFAULT_RESOLVER_OPTIONS, I as InputModality, M as ModelCapabilities, a as ModelCapabilityResolver, b as ModelEntry, N as NetworkStatus, O as OutputModality, P as ProviderCompatibility, R as ResolutionResult, c as ResolverOptions, S as SourcePriority, d as SourceResult, e as configureResolver, f as extractModelId, g as extractProvider, h as getDefaultResolver } from './capability-resolver-CgRGsWVX.js';
|
|
29
|
+
export { FileStorage, FileStorageOptions, MemoryStorage, buildEntryPath, buildMessagesFromEntries, configureDefaultSessionManager, createMessageEntry, createMetadataEntry, deserializeMessage, extractSessionInfo, generateEntryId, getDataDir, getDefaultSessionManager, getGitRootHash, getLeafId, getProjectId, getProjectSessionsDir, getSessionsDir, parseJSONL, serializeMessage, toJSONL, toJSONLBatch } from './storage/index.js';
|
|
30
|
+
export { AgentTaskChatAdapter, AgentTaskCheckpointReason, AgentTaskCheckpointStrategy, AgentTaskCheckpointStrategyInput, AgentTaskExecutionCheckpoint, AgentTaskExecutionContext, AgentTaskExecutionRun, AgentTaskExecutionSnapshot, AgentTaskObserver, AgentTaskPayload, AgentTaskResult, AgentTaskRunner, AgentTaskRunnerOptions, AgentWorkflowAssistantMessageSnapshot, AgentWorkflowCommitResult, AgentWorkflowMessageSnapshot, AgentWorkflowModelStepPlan, AgentWorkflowModelStepResult, AgentWorkflowOperationPlan, AgentWorkflowOutputCommitPlan, AgentWorkflowReplayDecision, AgentWorkflowStepCommitPlan, AgentWorkflowSystemMessageSnapshot, AgentWorkflowToolBatchResult, AgentWorkflowToolCallPlan, AgentWorkflowToolCallResult, AgentWorkflowToolCallSnapshot, AgentWorkflowToolMessageSnapshot, AgentWorkflowTurnPhase, AgentWorkflowTurnState, AgentWorkflowUserMessageSnapshot, ContextOverflowError, CreateAgentWorkflowTurnStateOptions, DoomLoopError, applyAgentWorkflowCommitResult, applyAgentWorkflowModelStepResult, applyAgentWorkflowToolBatchResult, applyAgentWorkflowToolCallResult, cloneAgentWorkflowTurnState, commitOutput, commitStep, convertAgentMessagesToModelMessages, createAgentTaskRunner, createAgentTurnStepCommitBatch, createAgentWorkflowTurnState, defaultAgentTaskCheckpointStrategy, failAgentWorkflowTurnState, planNextAgentWorkflowOperation, prepareModelStep, processStepStream, processStream, recordAgentWorkflowReplayDecision, restoreAgentWorkflowMessage, restoreAgentWorkflowMessages, runModelStep, runToolBatch, snapshotAgentWorkflowMessage, snapshotAgentWorkflowMessages } from './runtime/index.js';
|
|
31
|
+
export { A as AgentTurnActiveToolCall, a as AgentTurnBoundaryMetadata, b as AgentTurnBoundarySnapshot, c as AgentTurnCommitApplier, d as AgentTurnCommitBatch, e as AgentTurnCommitOptions, f as AgentTurnEngine, g as AgentTurnEngineOptions, h as AgentTurnPhase, i as AgentTurnResolvedToolCall, j as AgentTurnState, k as AgentTurnStateAdvanceOptions, l as AgentTurnStepCommitSnapshot, m as AgentTurnStepCommitToolCall, n as AgentTurnStepCommitToolResult, o as AgentTurnStepRuntimeConfig, C as CommitOutputOptions, p as CommitStepOptions, q as CreateAgentTurnStateOptions, r as CreateAgentTurnStepCommitBatchOptions, D as DoomLoopAction, s as DoomLoopHandler, t as DoomLoopRequest, P as PrepareModelStepOptions, u as PreparedAgentModelStep, v as ProcessorOptions, w as ProcessorOutput, R as RunModelStepOptions, x as RunToolBatchOptions, y as RunToolBatchResult, S as StepProcessingOptions, z as StepProcessingOutput, B as advanceAgentTurnState, E as createAgentTurnEngine, F as createAgentTurnState, G as failAgentTurnState } from './types-CqDZTh4d.js';
|
|
32
|
+
export { F as FileOperationMeta, N as NormalizedToolReplayPolicy, b as ToolContext, T as ToolMetadata, e as ToolReplayMode, a as ToolReplayPolicy, c as ToolResult, f as ToolSideEffectLevel, d as TurnTrackerContext } from './tool-HUtkiVBx.js';
|
|
33
|
+
export { Inference, LLM, buildToolSet, stream, streamOnce, streamStep } from './inference/index.js';
|
|
29
34
|
export { ChangeSet, Checkpoint, CheckpointConfig, CheckpointManager, FileChange, TrackedToolMetadata, clearCheckpoints, createCheckpointManager, extractFilePathsFromArgs, shouldCaptureBaseline, withFileTracking } from './tracking/index.js';
|
|
35
|
+
export { buildAnthropicOptions, buildBedrockOptions, buildGoogleOptions, buildGroqOptions, buildOpenAIOptions, buildOpenRouterOptions, buildReasoningOptions, buildReasoningOptionsSync, buildXAIOptions, getProviderOptionsKey, getReasoningConfig, getReasoningConfigSync, supportsReasoning, supportsReasoningSync } from './reasoning/index.js';
|
|
30
36
|
export { H as HttpTransportConfig, M as MCPConfig, a as MCPManager, b as MCPPrompt, c as MCPResource, d as MCPServerConfig, e as MCPServerStatus, S as SseTransportConfig, f as StdioTransportConfig } from './types-VQgymC1N.js';
|
|
31
37
|
export { createMCPManager, defineServer, httpServer, sseServer, stdioServer } from './mcp/index.js';
|
|
38
|
+
export { DockerHostOptions, dockerHost, localHost } from './host/index.js';
|
|
39
|
+
export { DEFAULT_INSTRUCTION_PATTERNS, DEFAULT_MAX_DEPTH, DEFAULT_MAX_FILE_SIZE, PRIORITY_BASE, PRIORITY_CUSTOM, PRIORITY_ENVIRONMENT, PRIORITY_INSTRUCTIONS, PRIORITY_OVERRIDE, PRIORITY_SKILLS, detectModelFamily, discoverInstructions, formatEnvironment, formatInstructions, gatherEnvironment, getAvailableFamilies, getTemplate, loadGlobalInstructions, summarizeEnvironment } from './prompt/index.js';
|
|
32
40
|
export { DEFAULT_EXTERNAL_DIRS, DEFAULT_MAX_SCAN_DEPTH, DEFAULT_SKILL_MAX_SIZE, SKILL_FILENAME, createSkillResourceTool, createSkillTool, createSkillTools, discoverSkills, inferResourceType, loadResourceContent, loadSkillContent, loadSkillMetadata, parseFrontmatter } from './skill/index.js';
|
|
33
|
-
export { S as SkillRegistry, c as createSkillRegistry, e as emptySkillRegistry } from './registry-
|
|
34
|
-
export { AdapterSettings, EngineSpec, Directory as ModelDirectory, Resolver as ModelResolver, ModelSpec, SyncResolver, createResolver } from './models/index.js';
|
|
35
|
-
export { ExecuteAgentToolCallOptions, ExecuteAgentToolCallResult, MAX_BYTES, MAX_LINES, TRUNCATE_DIR, TRUNCATE_GLOB, ToolRegistry, ToolSpec, TruncateResult, defaultRegistry, executeAgentToolCall, formatSize, normalizeToolReplayPolicy, truncateOutput } from './tool/index.js';
|
|
41
|
+
export { S as SkillRegistry, c as createSkillRegistry, e as emptySkillRegistry } from './registry-BDLIHOQB.js';
|
|
36
42
|
import 'zod';
|
|
37
43
|
import '@ai-sdk/provider-utils';
|
|
44
|
+
import './types-9jGQUjqW.js';
|
|
38
45
|
|
|
39
46
|
/**
|
|
40
47
|
* Mutable runtime state held by an `Agent` instance.
|
|
@@ -75,6 +82,13 @@ declare function createPreset(options: Partial<Preset> & {
|
|
|
75
82
|
name: string;
|
|
76
83
|
}): Preset;
|
|
77
84
|
|
|
85
|
+
declare const explore: Preset;
|
|
86
|
+
declare const plan: Preset;
|
|
87
|
+
declare const review: Preset;
|
|
88
|
+
declare const quick: Preset;
|
|
89
|
+
declare const careful: Preset;
|
|
90
|
+
declare const code: Preset;
|
|
91
|
+
declare const watch: Preset;
|
|
78
92
|
declare const Presets: {
|
|
79
93
|
readonly explore: Preset;
|
|
80
94
|
readonly plan: Preset;
|
|
@@ -85,70 +99,41 @@ declare const Presets: {
|
|
|
85
99
|
readonly watch: Preset;
|
|
86
100
|
};
|
|
87
101
|
|
|
88
|
-
/**
|
|
89
|
-
* Doom loop error thrown when repeated tool calls are detected.
|
|
90
|
-
*/
|
|
91
|
-
declare class DoomLoopError extends Error {
|
|
92
|
-
readonly toolName: string;
|
|
93
|
-
readonly repeatCount: number;
|
|
94
|
-
readonly input: unknown;
|
|
95
|
-
constructor(toolName: string, repeatCount: number, input: unknown);
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* Context overflow error.
|
|
100
|
-
*/
|
|
101
|
-
declare class ContextOverflowError extends Error {
|
|
102
|
-
readonly inputTokens: number;
|
|
103
|
-
readonly limit: number;
|
|
104
|
-
constructor(inputTokens: number, limit: number);
|
|
105
|
-
}
|
|
106
|
-
|
|
107
102
|
declare function isRetryableCategory(category: ErrorCategory): boolean;
|
|
103
|
+
declare function parseRetryDelay(headers: ResponseHeaders): number | undefined;
|
|
108
104
|
|
|
109
105
|
declare function isRetryable(error: unknown): boolean;
|
|
110
106
|
declare function getRetryDelay(error: unknown): number | undefined;
|
|
111
107
|
declare function getErrorCategory(error: unknown): ErrorCategory;
|
|
112
108
|
|
|
113
|
-
/**
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
tools: Record<string, Tool.Info>;
|
|
118
|
-
cwd: string;
|
|
119
|
-
sessionID: string;
|
|
120
|
-
messageID: string;
|
|
109
|
+
/** Everything the chat loop needs from the Agent instance. */
|
|
110
|
+
interface ChatLoopDeps {
|
|
111
|
+
sessionId: string;
|
|
112
|
+
message: string;
|
|
121
113
|
abort: AbortSignal;
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
declare function streamStep(input: LLMStreamInput): Promise<AnyStreamResult>;
|
|
140
|
-
|
|
141
|
-
declare const LLM: {
|
|
142
|
-
readonly buildToolSet: typeof buildToolSet;
|
|
143
|
-
readonly stream: typeof stream;
|
|
144
|
-
readonly streamOnce: typeof streamOnce;
|
|
145
|
-
readonly streamStep: typeof streamStep;
|
|
146
|
-
};
|
|
114
|
+
systemOverride?: string;
|
|
115
|
+
sessions: SessionManager;
|
|
116
|
+
tools: Record<string, Tool.Info>;
|
|
117
|
+
config: Required<Pick<AgentConfig, "model" | "systemPrompt" | "cwd" | "maxOutputTokens" | "maxSteps">> & AgentConfig;
|
|
118
|
+
turnTracker: TurnChangeTracker;
|
|
119
|
+
interventionCtrl: InterventionController;
|
|
120
|
+
middlewareRunner: MiddlewareRunner;
|
|
121
|
+
contextManager: ContextManager;
|
|
122
|
+
rememberedDoomLoopTools: Set<string>;
|
|
123
|
+
reasoningLevel: ReasoningLevel;
|
|
124
|
+
promptBuilder?: PromptBuilder;
|
|
125
|
+
host: ToolHost;
|
|
126
|
+
mcpTools: Record<string, Tool$1>;
|
|
127
|
+
telemetrySettings?: TelemetrySettings;
|
|
128
|
+
toModelMessages: (messages: Message[]) => ModelMessage[];
|
|
129
|
+
setIsStreaming: (value: boolean) => void;
|
|
130
|
+
}
|
|
147
131
|
|
|
148
132
|
/**
|
|
149
|
-
*
|
|
133
|
+
* Run the core chat loop: input commit → step loop → output commit →
|
|
134
|
+
* auto-compaction → turn summary → complete.
|
|
150
135
|
*/
|
|
151
|
-
declare function
|
|
136
|
+
declare function runChatLoop(deps: ChatLoopDeps): AsyncGenerator<AgentEvent>;
|
|
152
137
|
|
|
153
138
|
/**
|
|
154
139
|
* Concurrent sub-agent execution.
|
|
@@ -210,6 +195,43 @@ declare function runConcurrent(tasks: Array<{
|
|
|
210
195
|
abort?: AbortSignal;
|
|
211
196
|
}): Promise<SubAgentResult[]>;
|
|
212
197
|
|
|
198
|
+
/**
|
|
199
|
+
* Agent defaults — constants used by the Agent constructor.
|
|
200
|
+
*/
|
|
201
|
+
/**
|
|
202
|
+
* Generic fallback system prompt.
|
|
203
|
+
*
|
|
204
|
+
* Only used when the consumer provides a flat `systemPrompt` string
|
|
205
|
+
* without any value (i.e. the field exists but is empty/undefined).
|
|
206
|
+
* When the prompt pipeline is active, this is never used.
|
|
207
|
+
*
|
|
208
|
+
* Domain-specific prompts (coding, browsing, etc.) belong in
|
|
209
|
+
* consumer packages like agent-code, not here.
|
|
210
|
+
*/
|
|
211
|
+
declare const DEFAULT_SYSTEM_PROMPT = "You are a capable AI assistant with access to tools.\n\nThink step by step about what you need to do.\nUse the available tools to accomplish tasks.\nVerify your results after each action.\n\nIf a tool fails, try an alternative approach \u2014 do not give up after a single error.\nKeep working until the task is fully resolved or you have exhausted all options.";
|
|
212
|
+
/** Default max steps */
|
|
213
|
+
declare const DEFAULT_MAX_STEPS = 50;
|
|
214
|
+
/** Default max output tokens */
|
|
215
|
+
declare const DEFAULT_MAX_TOKENS = 32000;
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* Check if a model requires a custom stream provider.
|
|
219
|
+
*/
|
|
220
|
+
declare function needsCustomStreamProvider(model: LanguageModel, customPatterns?: string[]): boolean;
|
|
221
|
+
/**
|
|
222
|
+
* Check if tools array has stream provider factory attached.
|
|
223
|
+
*/
|
|
224
|
+
declare function hasStreamProviderFactory(tools: unknown): tools is EnhancedTools & {
|
|
225
|
+
__streamProviderFactory: NonNullable<EnhancedTools["__streamProviderFactory"]>;
|
|
226
|
+
};
|
|
227
|
+
/**
|
|
228
|
+
* Auto-detect and configure stream provider from model and tools.
|
|
229
|
+
*
|
|
230
|
+
* Returns the configured stream provider, or undefined if standard
|
|
231
|
+
* AI SDK streaming should be used.
|
|
232
|
+
*/
|
|
233
|
+
declare function autoDetectStreamProvider(model: LanguageModel, tools: unknown, explicitProvider: unknown): StreamProvider | undefined;
|
|
234
|
+
|
|
213
235
|
/**
|
|
214
236
|
* Get the risk level for a tool.
|
|
215
237
|
*/
|
|
@@ -244,45 +266,4 @@ declare function createApprovalHandler(config?: ApprovalConfig): {
|
|
|
244
266
|
};
|
|
245
267
|
type ApprovalHandler = ReturnType<typeof createApprovalHandler>;
|
|
246
268
|
|
|
247
|
-
|
|
248
|
-
* LocalHost — executes tools on the local machine.
|
|
249
|
-
*
|
|
250
|
-
* Default ToolHost implementation. Uses Node's `child_process.spawn`
|
|
251
|
-
* for commands and `node:fs/promises` for file operations.
|
|
252
|
-
*/
|
|
253
|
-
|
|
254
|
-
/**
|
|
255
|
-
* Create a ToolHost that runs everything on the local machine.
|
|
256
|
-
*
|
|
257
|
-
* @param defaultCwd Working directory for commands when none is specified.
|
|
258
|
-
* Defaults to `process.cwd()`.
|
|
259
|
-
*/
|
|
260
|
-
declare function localHost(defaultCwd?: string): ToolHost;
|
|
261
|
-
|
|
262
|
-
/**
|
|
263
|
-
* Configuration for creating a Docker-backed `ToolHost`.
|
|
264
|
-
*/
|
|
265
|
-
interface DockerHostOptions {
|
|
266
|
-
/**
|
|
267
|
-
* The container to connect to. Either:
|
|
268
|
-
* - A string container name or ID
|
|
269
|
-
* - A Dockerode `Container`-like object
|
|
270
|
-
*/
|
|
271
|
-
container: string | {
|
|
272
|
-
id: string;
|
|
273
|
-
modem?: unknown;
|
|
274
|
-
};
|
|
275
|
-
/** User to run commands as inside the container. */
|
|
276
|
-
user?: string;
|
|
277
|
-
/** Default working directory inside the container. */
|
|
278
|
-
workdir?: string;
|
|
279
|
-
/**
|
|
280
|
-
* Dockerode constructor options.
|
|
281
|
-
* Only used when `container` is a string.
|
|
282
|
-
*/
|
|
283
|
-
dockerOptions?: Record<string, unknown>;
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
declare function dockerHost(options: DockerHostOptions): Promise<ToolHost>;
|
|
287
|
-
|
|
288
|
-
export { Agent, type AgentState, AnyStreamResult, AppliedPreset, ApprovalConfig, ApprovalDeniedError, type ApprovalHandler, ApprovalRule, ApprovalTimeoutError, ContextOverflowError, type DockerHostOptions, DoomLoopError, ErrorCategory, LLM, LLMStreamInput, MiddlewareRunner, Preset, Presets, ProcessorOptions, ProcessorOutput, ReasoningLevel, RiskLevel, type SubAgentResult, TokenUsage, Tool, ToolHost, TurnTrackerContext, applyPreset, createApprovalHandler, createPreset, dockerHost, filterTools, getErrorCategory, getRetryDelay, getToolRisk, isRetryable, isRetryableCategory, localHost, mergePresets, processStream, runConcurrent };
|
|
269
|
+
export { Agent, AgentConfig, AgentEvent, type AgentState, AppliedPreset, ApprovalConfig, ApprovalDeniedError, type ApprovalHandler, ApprovalRule, ApprovalTimeoutError, type ChatLoopDeps, ContextManager, DEFAULT_MAX_STEPS, DEFAULT_MAX_TOKENS, DEFAULT_SYSTEM_PROMPT, EnhancedTools, ErrorCategory, InterventionController, Message, MiddlewareRunner, Preset, Presets, PromptBuilder, ReasoningLevel, ResponseHeaders, RiskLevel, SessionManager, StreamProvider, type SubAgentResult, TokenUsage, Tool, ToolHost, TurnChangeTracker, applyPreset, autoDetectStreamProvider, careful, code, createApprovalHandler, createPreset, explore, filterTools, getErrorCategory, getRetryDelay, getToolRisk, hasStreamProviderFactory, isRetryable, isRetryableCategory, mergePresets, needsCustomStreamProvider, parseRetryDelay, plan, quick, review, runChatLoop, runConcurrent, watch };
|