@fifthrevision/axle 0.29.0 → 0.30.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 +96 -172
- package/dist/index.js +21 -25
- package/dist/transcript-BzpiXJtU.js +1 -0
- package/dist/{accumulator-e_1Eq0jB.d.ts → transcript-D69LP3XR.d.ts} +93 -68
- package/dist/ui.d.ts +2 -2
- package/dist/ui.js +1 -1
- package/package.json +1 -1
- package/dist/accumulator-BQuyGJN_.js +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as
|
|
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";
|
|
2
2
|
import * as z$2 from "zod";
|
|
3
3
|
import { ZodObject, z } from "zod";
|
|
4
4
|
|
|
@@ -99,6 +99,10 @@ declare function parseResponse<T extends OutputSchema>(rawValue: string, schema?
|
|
|
99
99
|
//#region src/core/Instruct.d.ts
|
|
100
100
|
type InstructInputs = Record<string, unknown>;
|
|
101
101
|
type InstructVarsMode = "required" | "optional";
|
|
102
|
+
interface InstructRenderOptions {
|
|
103
|
+
vars?: InstructVarsMode;
|
|
104
|
+
}
|
|
105
|
+
type InstructResponse<TSchema extends OutputSchema | undefined> = TSchema extends OutputSchema ? ParsedSchema<TSchema> : string;
|
|
102
106
|
interface InstructContextSection {
|
|
103
107
|
content: string;
|
|
104
108
|
title?: string;
|
|
@@ -135,103 +139,12 @@ declare class Instruct<TSchema extends OutputSchema | undefined = undefined> {
|
|
|
135
139
|
title?: string;
|
|
136
140
|
}): this;
|
|
137
141
|
hasFiles(): boolean;
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
}):
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
/**
|
|
145
|
-
* Complete state for constructing a `History`. Reconstructing from a saved
|
|
146
|
-
* session goes through the constructor — there is no field-by-field mutation.
|
|
147
|
-
*/
|
|
148
|
-
interface HistoryInit<TAnnotation extends Annotation = Annotation> {
|
|
149
|
-
turns?: Turn<TAnnotation>[];
|
|
150
|
-
messages?: AxleMessage[];
|
|
151
|
-
archive?: AxleMessage[];
|
|
152
|
-
compactions?: CompactionRecord[];
|
|
153
|
-
sessionAnnotations?: TAnnotation[];
|
|
154
|
-
}
|
|
155
|
-
/**
|
|
156
|
-
* In-memory conversation and presentation state for an agent.
|
|
157
|
-
*
|
|
158
|
-
* All state is private; reads return copies and writes go through
|
|
159
|
-
* use-case-specific methods:
|
|
160
|
-
*
|
|
161
|
-
* - `messages` — the active, model-facing conversation. Requests are built
|
|
162
|
-
* from it; compaction replaces it.
|
|
163
|
-
* - `archive` — every message ever appended, in order, untouched by
|
|
164
|
-
* compaction. The chronological record, for inspection only.
|
|
165
|
-
* - `turns` — the renderable session turns: user/agent entries and compaction entries.
|
|
166
|
-
* Forever-accumulating; consumers decide how to render or prune it.
|
|
167
|
-
* - `compactions` — receipts for each applied compaction.
|
|
168
|
-
* - `sessionAnnotations` — session-level render annotations.
|
|
169
|
-
*
|
|
170
|
-
* @typeParam TAnnotation - Annotation union supported by the host renderer.
|
|
171
|
-
*/
|
|
172
|
-
declare class History<TAnnotation extends Annotation = Annotation> {
|
|
173
|
-
private _turns;
|
|
174
|
-
private _messages;
|
|
175
|
-
private _archive;
|
|
176
|
-
private _compactions;
|
|
177
|
-
private _sessionAnnotations;
|
|
178
|
-
constructor(init?: HistoryInit<TAnnotation>);
|
|
179
|
-
get turns(): Turn<TAnnotation>[];
|
|
180
|
-
get messages(): AxleMessage[];
|
|
181
|
-
get archive(): AxleMessage[];
|
|
182
|
-
get compactions(): CompactionRecord[];
|
|
183
|
-
get sessionAnnotations(): TAnnotation[];
|
|
184
|
-
/**
|
|
185
|
-
* Append conversation messages. Every appended message goes to both the
|
|
186
|
-
* active conversation and the archive, so the archive is always the
|
|
187
|
-
* complete chronological record regardless of compaction.
|
|
188
|
-
*
|
|
189
|
-
* @internal The Agent is History's only writer. Direct writes bypass the
|
|
190
|
-
* work queue and the event fold, desynchronizing engine state.
|
|
191
|
-
*/
|
|
192
|
-
append(messages: AxleMessage | AxleMessage[]): void;
|
|
193
|
-
/**
|
|
194
|
-
* Replace the renderable turn state wholesale. Used to sync the
|
|
195
|
-
* accumulated state after applying a turn event.
|
|
196
|
-
*
|
|
197
|
-
* @internal The Agent is History's only writer. External writes are
|
|
198
|
-
* overwritten by the agent's accumulator on the next event.
|
|
199
|
-
*/
|
|
200
|
-
replaceTurns(turns: Turn<TAnnotation>[], sessionAnnotations: TAnnotation[]): void;
|
|
201
|
-
/**
|
|
202
|
-
* Apply a compaction: the new state replaces the active conversation and
|
|
203
|
-
* the record is kept. The archive is untouched — it already holds
|
|
204
|
-
* everything ever appended. The corresponding compaction turn arrives
|
|
205
|
-
* through the event fold, not here.
|
|
206
|
-
*
|
|
207
|
-
* @internal The Agent is History's only writer; use `agent.compact()`.
|
|
208
|
-
* @experimental Compaction is under active design and may change in any release.
|
|
209
|
-
*/
|
|
210
|
-
compact(messages: AxleMessage[], record: CompactionRecord): void;
|
|
211
|
-
}
|
|
212
|
-
//#endregion
|
|
213
|
-
//#region src/memory/types.d.ts
|
|
214
|
-
interface MemoryContext {
|
|
215
|
-
/** Optional agent name provided by the host. */
|
|
216
|
-
agentName?: string;
|
|
217
|
-
/** Stable conversation/session id from the agent. */
|
|
218
|
-
sessionId: string;
|
|
219
|
-
/** Current system prompt, before memory augmentation. */
|
|
220
|
-
system?: string;
|
|
221
|
-
/** Full message context available for recall or extraction. */
|
|
222
|
-
messages: AxleMessage[];
|
|
223
|
-
/** Newly produced messages to record after a turn completes. */
|
|
224
|
-
newMessages?: AxleMessage[];
|
|
225
|
-
/** Optional tracing context. */
|
|
226
|
-
span?: Span;
|
|
227
|
-
}
|
|
228
|
-
interface RecallResult {
|
|
229
|
-
systemSuffix?: string;
|
|
230
|
-
}
|
|
231
|
-
interface AgentMemory {
|
|
232
|
-
recall(context: MemoryContext): Promise<RecallResult>;
|
|
233
|
-
record(context: MemoryContext): Promise<void>;
|
|
234
|
-
tools?(): ExecutableTool[];
|
|
142
|
+
toMessage(options?: {
|
|
143
|
+
metadata?: MessageMetadata;
|
|
144
|
+
}): AxleUserMessage;
|
|
145
|
+
parse(final: AxleAssistantMessage | undefined): InstructResponse<TSchema> | null;
|
|
146
|
+
validate(options?: InstructRenderOptions): void;
|
|
147
|
+
render(options?: InstructRenderOptions): string;
|
|
235
148
|
}
|
|
236
149
|
//#endregion
|
|
237
150
|
//#region src/observability/log.d.ts
|
|
@@ -431,7 +344,7 @@ interface AgentConfig extends Omit<AxleModelRequestOptions, "signal"> {
|
|
|
431
344
|
sessionId?: string;
|
|
432
345
|
/** Optional system/developer instruction. */
|
|
433
346
|
system?: string;
|
|
434
|
-
/** Optional agent name
|
|
347
|
+
/** Optional agent name. */
|
|
435
348
|
name?: string;
|
|
436
349
|
/** Executable tools available to the agent. */
|
|
437
350
|
tools?: ExecutableTool[];
|
|
@@ -439,8 +352,6 @@ interface AgentConfig extends Omit<AxleModelRequestOptions, "signal"> {
|
|
|
439
352
|
providerTools?: ProviderTool[];
|
|
440
353
|
/** MCP clients whose tools should be lazily resolved. */
|
|
441
354
|
mcps?: MCP[];
|
|
442
|
-
/** Optional memory implementation. */
|
|
443
|
-
memory?: AgentMemory;
|
|
444
355
|
/** Observability: structured logging and optional span tracing. */
|
|
445
356
|
observability?: ObservabilityOptions;
|
|
446
357
|
/** Optional file resolver for request file references. */
|
|
@@ -503,13 +414,13 @@ interface AgentDefinitionRequestOptions extends Omit<AxleModelRequestOptions, "s
|
|
|
503
414
|
*
|
|
504
415
|
* This is deliberately not executable by itself. Hosts resolve provider and
|
|
505
416
|
* tool references into runtime objects using an `AgentDefinitionResolver`.
|
|
506
|
-
* Harness concerns such as
|
|
507
|
-
*
|
|
417
|
+
* Harness concerns such as file resolvers, tracing, transport, and stores
|
|
418
|
+
* should be modeled outside this core definition.
|
|
508
419
|
*/
|
|
509
420
|
interface AgentDefinition {
|
|
510
421
|
/** Agent definition schema version. */
|
|
511
422
|
version: 1;
|
|
512
|
-
/** Optional agent name
|
|
423
|
+
/** Optional agent name. */
|
|
513
424
|
name?: string;
|
|
514
425
|
/** Provider reference resolved by the host. */
|
|
515
426
|
provider: ProviderDefinition;
|
|
@@ -547,40 +458,31 @@ interface ResolvedAgentDefinition {
|
|
|
547
458
|
*/
|
|
548
459
|
type AgentDefinitionResolver = (definition: AgentDefinition) => MaybePromise<ResolvedAgentDefinition>;
|
|
549
460
|
/**
|
|
550
|
-
* Serializable continuation
|
|
551
|
-
*
|
|
552
|
-
* This is the data needed to continue a model conversation and restore the
|
|
553
|
-
* renderable turn state. It intentionally does not include executable runtime
|
|
554
|
-
* objects such as providers, tools, MCP clients, memory implementations, file
|
|
555
|
-
* resolvers, or tracers. Recreate those from host-owned configuration, then
|
|
556
|
-
* construct a new agent with the session: `new Agent(config, session)`.
|
|
461
|
+
* Serializable continuation state for an `Agent`: the pure model-facing
|
|
462
|
+
* conversation, nothing else.
|
|
557
463
|
*
|
|
558
|
-
*
|
|
464
|
+
* It intentionally does not include executable runtime objects (providers,
|
|
465
|
+
* tools, MCP clients, file resolvers, tracers) or renderable turn
|
|
466
|
+
* state — transcripts are folds of the event stream owned by the host; persist
|
|
467
|
+
* your `Transcript.turns` alongside this if you want one back. Recreate
|
|
468
|
+
* runtime objects from host-owned configuration, then construct a new agent
|
|
469
|
+
* with the session: `new Agent(config, session)`. Unknown keys in stored
|
|
470
|
+
* sessions from older versions are ignored.
|
|
559
471
|
*/
|
|
560
|
-
interface AgentSession
|
|
561
|
-
/** Agent session schema version. */
|
|
562
|
-
version: 1;
|
|
472
|
+
interface AgentSession {
|
|
563
473
|
/** Stable conversation/session id. */
|
|
564
474
|
sessionId: string;
|
|
565
475
|
/** Active model-facing conversation used for continuation. */
|
|
566
476
|
messages: AxleMessage[];
|
|
567
|
-
/** Complete chronological record of every appended message, untouched by compaction. May be empty; absent in pre-compaction snapshots. */
|
|
568
|
-
archive?: AxleMessage[];
|
|
569
|
-
/** Compaction records, in order. Empty when no compaction has run; absent in pre-compaction snapshots. */
|
|
570
|
-
compactions?: CompactionRecord[];
|
|
571
|
-
/** Renderable turn state for exact UI restoration. */
|
|
572
|
-
turns?: Turn<TAnnotation>[];
|
|
573
|
-
/** Session-level annotations for generic renderer state. */
|
|
574
|
-
sessionAnnotations?: TAnnotation[];
|
|
575
477
|
}
|
|
576
478
|
/**
|
|
577
479
|
* Serializable saved agent payload: definition plus continuation state.
|
|
578
480
|
*/
|
|
579
|
-
interface SavedAgent
|
|
481
|
+
interface SavedAgent {
|
|
580
482
|
/** Serializable recipe used to reconstruct runtime config. */
|
|
581
483
|
definition: AgentDefinition;
|
|
582
|
-
/** Serializable continuation
|
|
583
|
-
session: AgentSession
|
|
484
|
+
/** Serializable continuation state. */
|
|
485
|
+
session: AgentSession;
|
|
584
486
|
}
|
|
585
487
|
interface AgentResult<T = string> {
|
|
586
488
|
ok: true;
|
|
@@ -599,37 +501,64 @@ interface AgentErrorResult {
|
|
|
599
501
|
type AgentHandle<T = string> = Handle<AgentResult<T> | AgentErrorResult>;
|
|
600
502
|
type TurnEventCallback = (event: TurnEvent) => void;
|
|
601
503
|
/**
|
|
602
|
-
*
|
|
603
|
-
*
|
|
604
|
-
*
|
|
605
|
-
* usage estimate is local), or the complete new active conversation. The
|
|
606
|
-
* engine owns validation, record stamping, state processing, and event
|
|
607
|
-
* emission.
|
|
504
|
+
* Compaction is split into three layers, each with one job: `triggers` say
|
|
505
|
+
* *when to ask automatically*, `shouldCompactOnTrigger` filters those
|
|
506
|
+
* automatic requests, and `compact` does the work.
|
|
608
507
|
*
|
|
609
508
|
* @experimental Compaction is under active design and may change in any release.
|
|
610
509
|
*/
|
|
611
|
-
type
|
|
510
|
+
type AutomaticCompactionTrigger = "beforeTurn" | "afterTurn";
|
|
511
|
+
type CompactionTrigger = "manual" | AutomaticCompactionTrigger;
|
|
512
|
+
/**
|
|
513
|
+
* The decision: should an automatically triggered compaction run now?
|
|
514
|
+
* Omitted on the config, every configured automatic trigger runs. Explicit
|
|
515
|
+
* `agent.compact()` calls bypass this policy. Keep it cheap; it runs on every
|
|
516
|
+
* configured automatic boundary and must return its boolean synchronously.
|
|
517
|
+
*/
|
|
518
|
+
type ShouldCompactOnTriggerCallback = (state: {
|
|
519
|
+
messages: AxleMessage[];
|
|
520
|
+
}, context: {
|
|
521
|
+
usage: ContextUsage;
|
|
522
|
+
trigger: AutomaticCompactionTrigger;
|
|
523
|
+
}) => boolean;
|
|
524
|
+
/**
|
|
525
|
+
* The work: produce the complete new active conversation, and optionally a
|
|
526
|
+
* reader-facing `summary` for the transcript part. There is no decline path —
|
|
527
|
+
* declining automatic work is `shouldCompactOnTrigger`'s job — and failures
|
|
528
|
+
* throw. Publish transient display state through `ctx.emit`; updates replace
|
|
529
|
+
* fields on the running part and keep the event stream flowing during long
|
|
530
|
+
* summarizations.
|
|
531
|
+
*
|
|
532
|
+
* `summary` is a presentation choice, independent of the model-facing
|
|
533
|
+
* messages: it can be the summary text itself, or something else entirely
|
|
534
|
+
* ("Reduced the context by 50%"). Omitted, the latest emitted summary remains;
|
|
535
|
+
* without one, the part renders as a bare divider. Stamp output messages via `MessageMetadata`
|
|
536
|
+
* (`axleCompaction: { id, role }`, see `CompactionStamp`) so your own prior
|
|
537
|
+
* output is recognizable on later runs.
|
|
538
|
+
*/
|
|
612
539
|
type CompactionCallback = (state: {
|
|
613
540
|
messages: AxleMessage[];
|
|
614
541
|
}, context: {
|
|
615
542
|
usage: ContextUsage;
|
|
616
543
|
signal?: AbortSignal;
|
|
617
|
-
trigger: CompactionTrigger;
|
|
618
|
-
/**
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
}) => MaybePromise<AxleMessage[] | null>;
|
|
544
|
+
trigger: CompactionTrigger; /** Engine-generated id for this compaction; the emitted part shares it. */
|
|
545
|
+
id: string; /** Update transient reader-facing state on the running part. */
|
|
546
|
+
emit: (update: CompactionUpdate) => void;
|
|
547
|
+
}) => MaybePromise<{
|
|
548
|
+
messages: AxleMessage[];
|
|
549
|
+
summary?: string;
|
|
550
|
+
}>;
|
|
625
551
|
/**
|
|
626
|
-
* Compaction
|
|
627
|
-
* automatically. Manual `agent.compact()` is
|
|
552
|
+
* Compaction wiring: the work, the optional decision policy, and the turn
|
|
553
|
+
* boundaries that invoke them automatically. Manual `agent.compact()` is
|
|
554
|
+
* always available.
|
|
628
555
|
*
|
|
629
556
|
* @experimental Compaction is under active design and may change in any release.
|
|
630
557
|
*/
|
|
631
558
|
interface CompactionConfig {
|
|
632
559
|
compact: CompactionCallback;
|
|
560
|
+
/** Automatic-trigger policy. Absent = run at every configured trigger. */
|
|
561
|
+
shouldCompactOnTrigger?: ShouldCompactOnTriggerCallback;
|
|
633
562
|
triggers?: {
|
|
634
563
|
beforeTurn?: boolean;
|
|
635
564
|
afterTurn?: boolean;
|
|
@@ -648,7 +577,6 @@ interface SendMessageOptions extends AxleModelRequestOptions {
|
|
|
648
577
|
declare class Agent {
|
|
649
578
|
readonly provider: AIProvider;
|
|
650
579
|
readonly model: string;
|
|
651
|
-
readonly history: History;
|
|
652
580
|
readonly name?: string;
|
|
653
581
|
readonly fileResolver?: FileResolver;
|
|
654
582
|
readonly requestOptions: Omit<AxleModelRequestOptions, "signal">;
|
|
@@ -657,7 +585,6 @@ declare class Agent {
|
|
|
657
585
|
system: string | undefined;
|
|
658
586
|
private mcps;
|
|
659
587
|
private resolvedMcps;
|
|
660
|
-
private memory?;
|
|
661
588
|
private spanParent?;
|
|
662
589
|
private ownedTracer?;
|
|
663
590
|
private eventCallbacks;
|
|
@@ -665,18 +592,22 @@ declare class Agent {
|
|
|
665
592
|
private scheduler;
|
|
666
593
|
private turnActive;
|
|
667
594
|
private stopRequested;
|
|
668
|
-
private
|
|
595
|
+
private transcript;
|
|
596
|
+
private messagesInternal;
|
|
669
597
|
/**
|
|
670
598
|
* Create an agent from runtime config and, optionally, restore saved session state.
|
|
671
599
|
*
|
|
672
600
|
* When both `config.sessionId` and `session.sessionId` are supplied, the
|
|
673
|
-
* restored session id wins.
|
|
601
|
+
* restored session id wins. Unknown keys in sessions stored by older axle
|
|
602
|
+
* versions are ignored.
|
|
674
603
|
*/
|
|
675
604
|
constructor(config: AgentConfig, session?: AgentSession);
|
|
676
605
|
addMcp(mcp: MCP): void;
|
|
677
606
|
addMcps(mcps: MCP[]): void;
|
|
678
607
|
hasTools(): boolean;
|
|
679
608
|
on(callback: TurnEventCallback): () => void;
|
|
609
|
+
/** The active, model-facing conversation. Requests are built from it; compaction replaces it. */
|
|
610
|
+
get messages(): AxleMessage[];
|
|
680
611
|
context(): ContextUsage;
|
|
681
612
|
private estimateContext;
|
|
682
613
|
/** Schedule a FIFO conversation turn. */
|
|
@@ -702,7 +633,6 @@ declare class Agent {
|
|
|
702
633
|
*/
|
|
703
634
|
clear(): number;
|
|
704
635
|
private executeTurn;
|
|
705
|
-
private run;
|
|
706
636
|
private resolveMcpTools;
|
|
707
637
|
/**
|
|
708
638
|
* Set the compaction implementation and its optional automatic triggers.
|
|
@@ -710,13 +640,15 @@ declare class Agent {
|
|
|
710
640
|
*/
|
|
711
641
|
setCompaction(config: CompactionConfig): void;
|
|
712
642
|
/**
|
|
713
|
-
* Run the registered compaction
|
|
643
|
+
* Run the registered compaction against the active conversation.
|
|
714
644
|
*
|
|
715
|
-
* Compaction is optional: with no
|
|
716
|
-
*
|
|
717
|
-
*
|
|
718
|
-
*
|
|
719
|
-
*
|
|
645
|
+
* Compaction is optional: with no config registered this resolves `false`.
|
|
646
|
+
* Otherwise the call is enqueued behind in-flight sends so compaction never
|
|
647
|
+
* races a turn. Explicit compaction bypasses `shouldCompactOnTrigger`: the
|
|
648
|
+
* engine opens a turn, streams the `CompactionPart` in it, and resolves
|
|
649
|
+
* `true` once applied. Failures settle the part and turn as errored on the
|
|
650
|
+
* transcript and reject.
|
|
651
|
+
* Cancellation rejects with `AxleAgentAbortError`, matching `send()`.
|
|
720
652
|
*
|
|
721
653
|
* Do not await this from inside a running send (a tool's `execute`,
|
|
722
654
|
* `onToolCall`, or a compaction callback): the send holds the queue, so the
|
|
@@ -724,28 +656,23 @@ declare class Agent {
|
|
|
724
656
|
*/
|
|
725
657
|
compact(options?: {
|
|
726
658
|
signal?: AbortSignal;
|
|
727
|
-
}): Promise<
|
|
659
|
+
}): Promise<boolean>;
|
|
728
660
|
private runCompaction;
|
|
729
661
|
/**
|
|
730
662
|
* Capture the serializable session state for later continuation.
|
|
731
663
|
*
|
|
732
664
|
* Enqueued behind in-flight sends and compactions, so the capture is
|
|
733
665
|
* always at rest — a snapshot never contains a streaming or running turn.
|
|
734
|
-
* The returned object
|
|
735
|
-
*
|
|
736
|
-
*
|
|
666
|
+
* The returned object is the pure continuation: session id and the active
|
|
667
|
+
* model-facing conversation. It contains no renderable turn state —
|
|
668
|
+
* transcripts are host-owned; persist your `Transcript.turns`
|
|
669
|
+
* alongside it.
|
|
737
670
|
*
|
|
738
671
|
* Do not await this from inside a running send (a tool's `execute`,
|
|
739
672
|
* `onToolCall`, or a compaction callback): the send holds the queue, so the
|
|
740
673
|
* nested call deadlocks.
|
|
741
674
|
*/
|
|
742
675
|
snapshot(): Promise<AgentSession>;
|
|
743
|
-
/**
|
|
744
|
-
* The single write path for renderable turn state: every event folds
|
|
745
|
-
* through the agent-lifetime accumulator, History mirrors the result, and
|
|
746
|
-
* subscribers are notified. Engine-internal state and consumer-folded
|
|
747
|
-
* state agree by construction because they run the same fold.
|
|
748
|
-
*/
|
|
749
676
|
private emitEvent;
|
|
750
677
|
private toToolDefinitions;
|
|
751
678
|
}
|
|
@@ -756,14 +683,11 @@ declare class Agent {
|
|
|
756
683
|
*
|
|
757
684
|
* Core resolves only what it can safely construct from serializable data. The
|
|
758
685
|
* host remains responsible for executable dependencies such as providers,
|
|
759
|
-
* tools, and MCP clients. Harness runtime services such as
|
|
760
|
-
*
|
|
686
|
+
* tools, and MCP clients. Harness runtime services such as file resolvers
|
|
687
|
+
* should be layered onto the returned config by the host.
|
|
761
688
|
*/
|
|
762
689
|
declare function createAgentConfig(definition: AgentDefinition, resolver: AgentDefinitionResolver): Promise<AgentConfig>;
|
|
763
690
|
//#endregion
|
|
764
|
-
//#region src/core/userTurn.d.ts
|
|
765
|
-
type InstructResponse<TSchema extends OutputSchema | undefined> = TSchema extends OutputSchema ? ParsedSchema<TSchema> : string;
|
|
766
|
-
//#endregion
|
|
767
691
|
//#region src/compaction/PromptCompactor.d.ts
|
|
768
692
|
interface PromptCompactorOptions {
|
|
769
693
|
provider: AIProvider;
|
|
@@ -774,7 +698,6 @@ interface PromptCompactorOptions {
|
|
|
774
698
|
recentUserMessages?: number;
|
|
775
699
|
}
|
|
776
700
|
declare class PromptCompactor {
|
|
777
|
-
readonly compact: CompactionCallback;
|
|
778
701
|
private readonly provider;
|
|
779
702
|
private readonly model;
|
|
780
703
|
private readonly prompt;
|
|
@@ -782,7 +705,8 @@ declare class PromptCompactor {
|
|
|
782
705
|
private readonly targetTokens;
|
|
783
706
|
private readonly recentUserMessages;
|
|
784
707
|
constructor(options: PromptCompactorOptions);
|
|
785
|
-
|
|
708
|
+
readonly shouldCompactOnTrigger: ShouldCompactOnTriggerCallback;
|
|
709
|
+
readonly compact: CompactionCallback;
|
|
786
710
|
}
|
|
787
711
|
//#endregion
|
|
788
712
|
//#region src/errors/AxleAgentAbortError.d.ts
|
|
@@ -1194,4 +1118,4 @@ declare function createStats(): Stats;
|
|
|
1194
1118
|
declare function addStats(total: Stats, usage?: Stats): void;
|
|
1195
1119
|
declare function mergeStats(...usages: Array<Stats | undefined>): Stats;
|
|
1196
1120
|
//#endregion
|
|
1197
|
-
export { type AIProvider, type
|
|
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 };
|