@fifthrevision/axle 0.30.1 → 0.31.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.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { $ as ThinkingContinuity, At as SpanOptions, B as AxleUserMessage, C as CompactionPart, Ct as EventLevel, D as SubagentAction, Dt as Span, E as ProviderToolAction, Et as LLMResult, F as TurnStatus, Ft as ToolResult, G as ContentPartCitation, H as CitationOutputSpan, I as AxleAssistantMessage, It as TraceWriter, J as ContentPartText, K as ContentPartFile, L as AxleMessage, M as Turn, Mt as SpanStatus, N as TurnMetadata, Nt as SpanType, O as TextPart, Ot as SpanData, P as TurnPart, Pt as TokenUsage, Q as MessageMetadata, R as AxleToolCallMessage, S as CitationPart, St as UsageEntry, T as FilePart, Tt as LLMResponse, U as CitationSource, V as Citation, W as ContentPart, X as ContentPartToolCall, Y as ContentPartThinking, Z as DocumentLocator, _ as ActionPart, _t as FileResolver, a as CompactionStamp, at as ModelError, b as AnnotationPlacement, bt as Stats, c as ExecutableTool, ct as ProviderOptions, d as ToolDefinition, dt as DeferredFileInfo, et as ToolResultPart, f as ToolProgressChunk, ft as FileInfo, g as TurnEvent, gt as FileResolveRequest, h as AnnotationTarget, ht as FileResolveFormat, it as ContextUsage, j as ToolAction, jt as SpanResult, k as ThinkingPart, kt as SpanEvent, l as ProviderTool, lt as ResolvedProviderTool, m as AnnotationEvent, mt as FileProviderId, n as TranscriptApplyResult, nt as AxleModelRequestOptions, o as getCompactionStamp, ot as ModelResult, p as ToolRegistry, pt as FileKind, q as ContentPartProviderTool, r as TranscriptInput, rt as AxleStopReason, s as validateCompactedMessages, st as ProviderClientOptions, t as Transcript, tt as AIProvider, u as ToolContext, ut as ToolChoice, v as ActionResult, vt as ResolvedFileSource, w as CompactionUpdate, wt as LLMRequest, x as AnnotationStatus, xt as TokenStats, y as Annotation, yt as loadFileContent, z as AxleToolCallResult } from "./transcript-D69LP3XR.js";
1
+ import { $ as ThinkingContinuity, At as SpanData, B as AxleUserMessage, C as CompactionPart, Ct as TokenStats, D as SubagentAction, Dt as LLMResponse, E as ProviderToolAction, Et as LLMRequest, F as TurnStatus, Ft as SpanType, G as ContentPartCitation, H as CitationOutputSpan, I as AxleAssistantMessage, It as TokenUsage, J as ContentPartText, K as ContentPartFile, L as AxleMessage, Lt as ToolResult, M as Turn, Mt as SpanOptions, N as TurnMetadata, Nt as SpanResult, O as TextPart, Ot as LLMResult, P as TurnPart, Pt as SpanStatus, Q as MessageMetadata, R as AxleToolCallMessage, Rt as TraceWriter, S as CitationPart, St as Stats, T as FilePart, Tt as EventLevel, U as CitationSource, V as Citation, W as ContentPart, X as ContentPartToolCall, Y as ContentPartThinking, Z as DocumentLocator, _ as ActionPart, _t as FileResolveFormat, a as CompactionStamp, at as ModelError, b as AnnotationPlacement, bt as ResolvedFileSource, c as ExecutableTool, ct as ProviderOptions, d as ToolDefinition, dt as ReasoningEffort, et as ToolResultPart, f as ToolProgressChunk, ft as ReasoningSetting, g as TurnEvent, gt as FileProviderId, h as AnnotationTarget, ht as FileKind, it as ContextUsage, j as ToolAction, jt as SpanEvent, k as ThinkingPart, kt as Span, l as ProviderTool, lt as ResolvedProviderTool, m as AnnotationEvent, mt as FileInfo, n as TranscriptApplyResult, nt as AxleModelRequestOptions, o as getCompactionStamp, ot as ModelResult, p as ToolRegistry, pt as DeferredFileInfo, q as ContentPartProviderTool, r as TranscriptInput, rt as AxleStopReason, s as validateCompactedMessages, st as ProviderClientOptions, t as Transcript, tt as AIProvider, u as ToolContext, ut as ToolChoice, v as ActionResult, vt as FileResolveRequest, w as CompactionUpdate, wt as UsageEntry, x as AnnotationStatus, xt as loadFileContent, y as Annotation, yt as FileResolver, z as AxleToolCallResult } from "./transcript-BuUBiQX6.js";
2
2
  import * as z$2 from "zod";
3
3
  import { ZodObject, z } from "zod";
4
4
 
@@ -693,20 +693,44 @@ interface PromptCompactorOptions {
693
693
  provider: AIProvider;
694
694
  model: string;
695
695
  prompt: string;
696
+ /** Estimated context size at which automatic triggers compact. */
696
697
  thresholdTokens: number;
697
- targetTokens: number;
698
- recentUserMessages?: number;
698
+ /** Requested summary length, in words. Default 1000. */
699
+ summaryWords?: number;
700
+ /**
701
+ * Budget for recent user messages kept verbatim. Defaults to a tenth of
702
+ * `thresholdTokens`; 0 keeps none.
703
+ */
704
+ appendixTokens?: number;
705
+ reasoning?: ReasoningSetting;
706
+ providerOptions?: ProviderOptions;
699
707
  }
708
+ /**
709
+ * Prompt-based compactor: summarizes the conversation with the configured
710
+ * model and appends recent user messages verbatim.
711
+ *
712
+ * The summary side is words-native: `summaryWords` steers the prompt, the
713
+ * result is measured in words, one relative-shrink rewrite runs if it lands
714
+ * over ~1.3× the request, and word-boundary truncation is the last resort.
715
+ * The request sends no output cap, so thinking models reason within the
716
+ * provider's own ceiling. The appendix side stays token-denominated: up to
717
+ * the last ten user messages, evicted oldest-first to fit `appendixTokens`.
718
+ *
719
+ * @experimental Compaction is under active design and may change in any release.
720
+ */
700
721
  declare class PromptCompactor {
701
722
  private readonly provider;
702
723
  private readonly model;
703
724
  private readonly prompt;
704
725
  private readonly thresholdTokens;
705
- private readonly targetTokens;
706
- private readonly recentUserMessages;
726
+ private readonly summaryWords;
727
+ private readonly appendixTokens;
728
+ private readonly reasoning;
729
+ private readonly providerOptions;
707
730
  constructor(options: PromptCompactorOptions);
708
731
  readonly shouldCompactOnTrigger: ShouldCompactOnTriggerCallback;
709
732
  readonly compact: CompactionCallback;
733
+ private generateSummary;
710
734
  }
711
735
  //#endregion
712
736
  //#region src/errors/AxleAgentAbortError.d.ts
@@ -1107,15 +1131,9 @@ declare class SimpleWriter implements TraceWriter {
1107
1131
  onEvent(span: SpanData, event: SpanEvent): void;
1108
1132
  }
1109
1133
  //#endregion
1110
- //#region src/store/types.d.ts
1111
- interface FileStore {
1112
- read(path: string): Promise<string | null>;
1113
- write(path: string, content: string): Promise<void>;
1114
- }
1115
- //#endregion
1116
1134
  //#region src/utils/stats.d.ts
1117
1135
  declare function createStats(): Stats;
1118
1136
  declare function addStats(total: Stats, usage?: Stats): void;
1119
1137
  declare function mergeStats(...usages: Array<Stats | undefined>): Stats;
1120
1138
  //#endregion
1121
- export { type AIProvider, type ActionPart, type ActionResult, Agent, type AgentConfig, type AgentDefinition, type AgentDefinitionRequestOptions, type AgentDefinitionResolver, type AgentErrorResult, type AgentHandle, type AgentResult, type AgentSession, type Annotation, type AnnotationEvent, type AnnotationPlacement, type AnnotationStatus, type AnnotationTarget, type AutomaticCompactionTrigger, AxleAbortError, AxleAgentAbortError, type AxleAssistantMessage, type AxleConfiguration, AxleError, type AxleFailure, type AxleMessage, type AxleModelRequestOptions, AxleStopReason, type AxleToolCallMessage, type AxleToolCallResult, AxleToolFatalError, type AxleUserMessage, type BraveWebSearchOptions, type ChatCompletionsOptions, type ChatCompletionsVendor, type Citation, type CitationOutputSpan, type CitationPart, type CitationSource, type CompactionCallback, type CompactionConfig, type CompactionPart, type CompactionStamp, type CompactionTrigger, type CompactionUpdate, type ContentPart, type ContentPartCitation, type ContentPartFile, type ContentPartProviderTool, type ContentPartText, type ContentPartThinking, type ContentPartToolCall, type ContextUsage, type CreateAgentToolOptions, type DeferredFileInfo, type DocumentLocator, type EventLevel, type ExecutableTool, type FileInfo, type FileKind, type FilePart, type FileProviderId, type FileResolveFormat, type FileResolveRequest, type FileResolver, type FileStore, type GenerateError, type GenerateInstructParams, type GenerateInstructResult, type GenerateParams, type GenerateResult, type Handle, Instruct, type InstructContextSection, type InstructInputs, type InstructOptions, type InstructRenderOptions, type InstructResponse, InstructVariableError, type InstructVarsMode, type LLMRequest, type LLMResponse, type LLMResult, type LogEntry, type LogFn, LogWriter, MCP, type MCPConfig, type MCPHttpConfig, type MCPStdioConfig, type MaybePromise, type MessageMetadata, type ObservabilityOptions, type OutputSchema, type ParallelToolResult, type ParallelizeOptions, type ParsedSchema, PromptCompactor, type PromptCompactorOptions, type ProviderClientOptions, type ProviderDefinition, type ProviderOptions, type ProviderTool, type ProviderToolAction, type ProviderToolDefinitionRef, type ResolvedAgentDefinition, type ResolvedFileSource, type SavedAgent, type SendMessageOptions, type ShouldCompactOnTriggerCallback, SimpleWriter, type SimpleWriterOptions, type Span, type SpanData, type SpanEvent, type SpanOptions, type SpanResult, type SpanStatus, type SpanType, type Stats, type StreamEvent, type StreamEventCallback, type StreamHandle, type StreamInstructHandle, type StreamInstructParams, type StreamInstructResult, type StreamParams, type StreamResult, type SubagentAction, TaskError, type TextPart, type ThinkingContinuity, type ThinkingPart, type TokenStats, type TokenUsage, type ToolAction, type ToolBatchCompleteCallback, type ToolChoice, type ToolContext, type ToolDefinition, type ToolDefinitionRef, type ToolProgressChunk, ToolRegistry, type ToolResult, type ToolResultPart, type TraceWriter, Tracer, type TracerOptions, Transcript, type TranscriptApplyResult, type TranscriptInput, type Turn, type TurnEvent, TurnEventBuilder, type TurnEventCallback, type TurnMetadata, type TurnPart, type TurnStatus, type UsageEntry, type WebSearchBackend, type WebSearchBackendContext, type WebSearchRequest, type WebSearchResponse, type WebSearchResult, addStats, anthropic, braveWebSearch, chatCompletions, configureAxle, createAgentConfig, createAgentTool, createStats, estimateContextUsage, gemini, generate, generateStep, getCompactionStamp, loadFileContent, mergeStats, openai, parallelize, parseResponse, stream, validateCompactedMessages };
1139
+ export { type AIProvider, type ActionPart, type ActionResult, Agent, type AgentConfig, type AgentDefinition, type AgentDefinitionRequestOptions, type AgentDefinitionResolver, type AgentErrorResult, type AgentHandle, type AgentResult, type AgentSession, type Annotation, type AnnotationEvent, type AnnotationPlacement, type AnnotationStatus, type AnnotationTarget, type AutomaticCompactionTrigger, AxleAbortError, AxleAgentAbortError, type AxleAssistantMessage, type AxleConfiguration, AxleError, type AxleFailure, type AxleMessage, type AxleModelRequestOptions, AxleStopReason, type AxleToolCallMessage, type AxleToolCallResult, AxleToolFatalError, type AxleUserMessage, type BraveWebSearchOptions, type ChatCompletionsOptions, type ChatCompletionsVendor, type Citation, type CitationOutputSpan, type CitationPart, type CitationSource, type CompactionCallback, type CompactionConfig, type CompactionPart, type CompactionStamp, type CompactionTrigger, type CompactionUpdate, type ContentPart, type ContentPartCitation, type ContentPartFile, type ContentPartProviderTool, type ContentPartText, type ContentPartThinking, type ContentPartToolCall, type ContextUsage, type CreateAgentToolOptions, type DeferredFileInfo, type DocumentLocator, type EventLevel, type ExecutableTool, type FileInfo, type FileKind, type FilePart, type FileProviderId, type FileResolveFormat, type FileResolveRequest, type FileResolver, type GenerateError, type GenerateInstructParams, type GenerateInstructResult, type GenerateParams, type GenerateResult, type Handle, Instruct, type InstructContextSection, type InstructInputs, type InstructOptions, type InstructRenderOptions, type InstructResponse, InstructVariableError, type InstructVarsMode, type LLMRequest, type LLMResponse, type LLMResult, type LogEntry, type LogFn, LogWriter, MCP, type MCPConfig, type MCPHttpConfig, type MCPStdioConfig, type MaybePromise, type MessageMetadata, type ObservabilityOptions, type OutputSchema, type ParallelToolResult, type ParallelizeOptions, type ParsedSchema, PromptCompactor, type PromptCompactorOptions, type ProviderClientOptions, type ProviderDefinition, type ProviderOptions, type ProviderTool, type ProviderToolAction, type ProviderToolDefinitionRef, type ReasoningEffort, type ReasoningSetting, type ResolvedAgentDefinition, type ResolvedFileSource, type SavedAgent, type SendMessageOptions, type ShouldCompactOnTriggerCallback, SimpleWriter, type SimpleWriterOptions, type Span, type SpanData, type SpanEvent, type SpanOptions, type SpanResult, type SpanStatus, type SpanType, type Stats, type StreamEvent, type StreamEventCallback, type StreamHandle, type StreamInstructHandle, type StreamInstructParams, type StreamInstructResult, type StreamParams, type StreamResult, type SubagentAction, TaskError, type TextPart, type ThinkingContinuity, type ThinkingPart, type TokenStats, type TokenUsage, type ToolAction, type ToolBatchCompleteCallback, type ToolChoice, type ToolContext, type ToolDefinition, type ToolDefinitionRef, type ToolProgressChunk, ToolRegistry, type ToolResult, type ToolResultPart, type TraceWriter, Tracer, type TracerOptions, Transcript, type TranscriptApplyResult, type TranscriptInput, type Turn, type TurnEvent, TurnEventBuilder, type TurnEventCallback, type TurnMetadata, type TurnPart, type TurnStatus, type UsageEntry, type WebSearchBackend, type WebSearchBackendContext, type WebSearchRequest, type WebSearchResponse, type WebSearchResult, addStats, anthropic, braveWebSearch, chatCompletions, configureAxle, createAgentConfig, createAgentTool, createStats, estimateContextUsage, gemini, generate, generateStep, getCompactionStamp, loadFileContent, mergeStats, openai, parallelize, parseResponse, stream, validateCompactedMessages };