@dudko.dev/agent 0.0.38 → 0.0.40

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
@@ -134,6 +134,7 @@ interface ICompactionConfig {
134
134
  auto?: boolean;
135
135
  contextWindowTokens?: number;
136
136
  thresholdTokens?: number;
137
+ thresholdRatio?: number;
137
138
  keepRecentTurns?: number;
138
139
  keepRecentSteps?: number;
139
140
  summaryMaxTokens?: number;
@@ -545,6 +546,8 @@ interface ICompactResult {
545
546
  interface IAgent {
546
547
  run: (options: IAgentRunOptions) => Promise<IAgentRunResult>;
547
548
  listTools: () => IToolCatalogEntry[];
549
+ readonly usage: IUsage;
550
+ resetUsage: () => void;
548
551
  listSkills: () => {
549
552
  name: string;
550
553
  description: string;
@@ -792,12 +795,28 @@ declare const resolveLimits: (config: Pick<IAgentConfig, "limits" | "maxTotalTok
792
795
  */
793
796
  declare const checkLimits: (usage: IUsage, limits: ITokenLimits | undefined) => ILimitBreach | undefined;
794
797
 
798
+ declare const DEFAULT_COMPACTION_THRESHOLD_RATIO = 0.85;
799
+ interface IResolvedCompaction {
800
+ auto: boolean;
801
+ contextWindowTokens: number;
802
+ thresholdTokens: number;
803
+ thresholdRatio: number;
804
+ keepRecentTurns: number;
805
+ keepRecentSteps: number;
806
+ summaryMaxTokens: number;
807
+ maxToolOutputChars: number;
808
+ clearToolResultsAfterTokens: number;
809
+ keepToolResults: number;
810
+ }
811
+ declare const resolveCompaction: (cfg: ICompactionConfig | undefined) => IResolvedCompaction;
795
812
  declare const estimateTokens: (text: string) => number;
796
813
  declare const SUMMARY_PREFIX = "[Summary of earlier conversation]";
797
814
  interface ICompactHistoryOptions {
798
815
  thresholdTokens?: number;
816
+ overheadTokens?: number;
799
817
  keepRecentTurns?: number;
800
818
  summaryMaxTokens?: number;
819
+ maxInputTokens?: number;
801
820
  force?: boolean;
802
821
  signal?: AbortSignal;
803
822
  timeoutMs?: number;
@@ -986,5 +1005,5 @@ interface ISubagentToolOptions {
986
1005
  */
987
1006
  declare const createSubagentTool: (opts: ISubagentToolOptions) => Tool;
988
1007
 
989
- export { DirSkillStore, EgressError, FORGET_SKILL_TOOL, FileOAuthStore, MemoryOAuthStore, MemorySkillStore, NodeOAuthProvider, SAVE_SKILL_TOOL, SUMMARY_PREFIX, ToolBudgetError, ToolDeniedError, WEB_FETCH_TOOL, addUsage, beginMcpOAuth, buildInstructions, checkEgressUrl, checkLimits, checkRedirect, classifyAddress, compactHistory, createAgent, createEgressTools, createLearning, createNodeOAuthProvider, createRunControl, createSafeFetch, createSubagentTool, createToolResultClearer, createWebFetchTool, decideToolPermission, defineSkill, estimateTokens, findSecret, finishMcpOAuth, getCurrentRunId, getCurrentRunSandbox, hostMatches, htmlToText, isReadOnlyTool, loadSkillsFromDir, markReadOnly, matchToolRule, mergeProviderOptions, normalizeSkillName, normalizeUsage, parseSkillMarkdown, redactHeaders, resolveEgressPolicy, resolveLimits, resolvePromptCaching, resolveThinking, searchTools, truncateToolModelOutput, withRollingBreakpoint, withToolOutputLimit };
1008
+ export { DEFAULT_COMPACTION_THRESHOLD_RATIO, DirSkillStore, EgressError, FORGET_SKILL_TOOL, FileOAuthStore, MemoryOAuthStore, MemorySkillStore, NodeOAuthProvider, SAVE_SKILL_TOOL, SUMMARY_PREFIX, ToolBudgetError, ToolDeniedError, WEB_FETCH_TOOL, addUsage, beginMcpOAuth, buildInstructions, checkEgressUrl, checkLimits, checkRedirect, classifyAddress, compactHistory, createAgent, createEgressTools, createLearning, createNodeOAuthProvider, createRunControl, createSafeFetch, createSubagentTool, createToolResultClearer, createWebFetchTool, decideToolPermission, defineSkill, estimateTokens, findSecret, finishMcpOAuth, getCurrentRunId, getCurrentRunSandbox, hostMatches, htmlToText, isReadOnlyTool, loadSkillsFromDir, markReadOnly, matchToolRule, mergeProviderOptions, normalizeSkillName, normalizeUsage, parseSkillMarkdown, redactHeaders, resolveCompaction, resolveEgressPolicy, resolveLimits, resolvePromptCaching, resolveThinking, searchTools, truncateToolModelOutput, withRollingBreakpoint, withToolOutputLimit };
990
1009
  export type { AgentEvent, AgentStage, BudgetKind, EgressErrorCode, EventHandler, IAgent, IAgentConfig, IAgentRunOptions, IAgentRunResult, IAgentStageOverride, IClearedInfo, ICloseOptions, ICompactHistoryOptions, ICompactHistoryResult, ICompactOptions, ICompactResult, ICompactionConfig, IConversationTurn, IEgressPolicy, ILearning, ILearningConfig, ILimitBreach, IMcpHttpServerConfig, IMcpServerConfig, IMcpStdioServerConfig, INodeOAuthProviderOptions, IOAuthRequestOptions, IOAuthStore, IPersistence, IPlan, IPlanStep, IResolvedAddress, IResolvedThinking, IRunSnapshot, ISaveSkillInput, ISearchToolsOptions, ISkill, ISkillOrigin, ISkillStore, IStepResult, IStepStartInfo, ISubagentProfile, ISubagentToolOptions, IThinkingConfig, ITokenLimits, IToolApprovalConfig, IToolApprovalRequest, IToolCatalogEntry, IToolDecision, IToolDecisionInput, IToolResultClearing, IUsage, LogLevel, PromptCachingSetting, ProviderType, ReplanCause, ReplanTrigger, RunControl, SafeFetch, SubagentInfo, SubagentIsolation, ThinkingLevel, ThinkingSetting, TokenLimitKind, ToolApprovalDecision, ToolApprovalMode, ToolPermission, ToolSelectionStrategy, UsagePhase };
package/dist/index.d.ts CHANGED
@@ -134,6 +134,7 @@ interface ICompactionConfig {
134
134
  auto?: boolean;
135
135
  contextWindowTokens?: number;
136
136
  thresholdTokens?: number;
137
+ thresholdRatio?: number;
137
138
  keepRecentTurns?: number;
138
139
  keepRecentSteps?: number;
139
140
  summaryMaxTokens?: number;
@@ -545,6 +546,8 @@ interface ICompactResult {
545
546
  interface IAgent {
546
547
  run: (options: IAgentRunOptions) => Promise<IAgentRunResult>;
547
548
  listTools: () => IToolCatalogEntry[];
549
+ readonly usage: IUsage;
550
+ resetUsage: () => void;
548
551
  listSkills: () => {
549
552
  name: string;
550
553
  description: string;
@@ -792,12 +795,28 @@ declare const resolveLimits: (config: Pick<IAgentConfig, "limits" | "maxTotalTok
792
795
  */
793
796
  declare const checkLimits: (usage: IUsage, limits: ITokenLimits | undefined) => ILimitBreach | undefined;
794
797
 
798
+ declare const DEFAULT_COMPACTION_THRESHOLD_RATIO = 0.85;
799
+ interface IResolvedCompaction {
800
+ auto: boolean;
801
+ contextWindowTokens: number;
802
+ thresholdTokens: number;
803
+ thresholdRatio: number;
804
+ keepRecentTurns: number;
805
+ keepRecentSteps: number;
806
+ summaryMaxTokens: number;
807
+ maxToolOutputChars: number;
808
+ clearToolResultsAfterTokens: number;
809
+ keepToolResults: number;
810
+ }
811
+ declare const resolveCompaction: (cfg: ICompactionConfig | undefined) => IResolvedCompaction;
795
812
  declare const estimateTokens: (text: string) => number;
796
813
  declare const SUMMARY_PREFIX = "[Summary of earlier conversation]";
797
814
  interface ICompactHistoryOptions {
798
815
  thresholdTokens?: number;
816
+ overheadTokens?: number;
799
817
  keepRecentTurns?: number;
800
818
  summaryMaxTokens?: number;
819
+ maxInputTokens?: number;
801
820
  force?: boolean;
802
821
  signal?: AbortSignal;
803
822
  timeoutMs?: number;
@@ -986,5 +1005,5 @@ interface ISubagentToolOptions {
986
1005
  */
987
1006
  declare const createSubagentTool: (opts: ISubagentToolOptions) => Tool;
988
1007
 
989
- export { DirSkillStore, EgressError, FORGET_SKILL_TOOL, FileOAuthStore, MemoryOAuthStore, MemorySkillStore, NodeOAuthProvider, SAVE_SKILL_TOOL, SUMMARY_PREFIX, ToolBudgetError, ToolDeniedError, WEB_FETCH_TOOL, addUsage, beginMcpOAuth, buildInstructions, checkEgressUrl, checkLimits, checkRedirect, classifyAddress, compactHistory, createAgent, createEgressTools, createLearning, createNodeOAuthProvider, createRunControl, createSafeFetch, createSubagentTool, createToolResultClearer, createWebFetchTool, decideToolPermission, defineSkill, estimateTokens, findSecret, finishMcpOAuth, getCurrentRunId, getCurrentRunSandbox, hostMatches, htmlToText, isReadOnlyTool, loadSkillsFromDir, markReadOnly, matchToolRule, mergeProviderOptions, normalizeSkillName, normalizeUsage, parseSkillMarkdown, redactHeaders, resolveEgressPolicy, resolveLimits, resolvePromptCaching, resolveThinking, searchTools, truncateToolModelOutput, withRollingBreakpoint, withToolOutputLimit };
1008
+ export { DEFAULT_COMPACTION_THRESHOLD_RATIO, DirSkillStore, EgressError, FORGET_SKILL_TOOL, FileOAuthStore, MemoryOAuthStore, MemorySkillStore, NodeOAuthProvider, SAVE_SKILL_TOOL, SUMMARY_PREFIX, ToolBudgetError, ToolDeniedError, WEB_FETCH_TOOL, addUsage, beginMcpOAuth, buildInstructions, checkEgressUrl, checkLimits, checkRedirect, classifyAddress, compactHistory, createAgent, createEgressTools, createLearning, createNodeOAuthProvider, createRunControl, createSafeFetch, createSubagentTool, createToolResultClearer, createWebFetchTool, decideToolPermission, defineSkill, estimateTokens, findSecret, finishMcpOAuth, getCurrentRunId, getCurrentRunSandbox, hostMatches, htmlToText, isReadOnlyTool, loadSkillsFromDir, markReadOnly, matchToolRule, mergeProviderOptions, normalizeSkillName, normalizeUsage, parseSkillMarkdown, redactHeaders, resolveCompaction, resolveEgressPolicy, resolveLimits, resolvePromptCaching, resolveThinking, searchTools, truncateToolModelOutput, withRollingBreakpoint, withToolOutputLimit };
990
1009
  export type { AgentEvent, AgentStage, BudgetKind, EgressErrorCode, EventHandler, IAgent, IAgentConfig, IAgentRunOptions, IAgentRunResult, IAgentStageOverride, IClearedInfo, ICloseOptions, ICompactHistoryOptions, ICompactHistoryResult, ICompactOptions, ICompactResult, ICompactionConfig, IConversationTurn, IEgressPolicy, ILearning, ILearningConfig, ILimitBreach, IMcpHttpServerConfig, IMcpServerConfig, IMcpStdioServerConfig, INodeOAuthProviderOptions, IOAuthRequestOptions, IOAuthStore, IPersistence, IPlan, IPlanStep, IResolvedAddress, IResolvedThinking, IRunSnapshot, ISaveSkillInput, ISearchToolsOptions, ISkill, ISkillOrigin, ISkillStore, IStepResult, IStepStartInfo, ISubagentProfile, ISubagentToolOptions, IThinkingConfig, ITokenLimits, IToolApprovalConfig, IToolApprovalRequest, IToolCatalogEntry, IToolDecision, IToolDecisionInput, IToolResultClearing, IUsage, LogLevel, PromptCachingSetting, ProviderType, ReplanCause, ReplanTrigger, RunControl, SafeFetch, SubagentInfo, SubagentIsolation, ThinkingLevel, ThinkingSetting, TokenLimitKind, ToolApprovalDecision, ToolApprovalMode, ToolPermission, ToolSelectionStrategy, UsagePhase };