@theokit/agents 0.6.0 → 0.8.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/bridge-entry-CAI1139f.d.ts +625 -0
- package/dist/bridge.d.ts +4 -552
- package/dist/bridge.js +2 -2
- package/dist/{chunk-KTYBQ7HY.js → chunk-BCSRKDP6.js} +189 -40
- package/dist/chunk-BCSRKDP6.js.map +1 -0
- package/dist/{chunk-MVEY7HEY.js → chunk-GVPUUKKE.js} +19 -1
- package/dist/chunk-GVPUUKKE.js.map +1 -0
- package/dist/{chunk-XWVZS2PQ.js → chunk-SKTJS4QQ.js} +2 -2
- package/dist/decorators.d.ts +2 -2
- package/dist/decorators.js +6 -2
- package/dist/index.d.ts +122 -74
- package/dist/index.js +15 -3
- package/dist/{skills-DmN1HGUb.d.ts → skills-BHnHPn7p.d.ts} +13 -1
- package/package.json +3 -3
- package/dist/chunk-KTYBQ7HY.js.map +0 -1
- package/dist/chunk-MVEY7HEY.js.map +0 -1
- /package/dist/{chunk-XWVZS2PQ.js.map → chunk-SKTJS4QQ.js.map} +0 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,74 +1,95 @@
|
|
|
1
1
|
export { Agent, Artifact, ArtifactOptions, ArtifactResult, Audit, Budget, Checkpoint, CheckpointOptions, CheckpointState, CheckpointStorage, CheckpointStrategy, CommandPermissions, CompactionStrategy, Conversation, ConversationOptions, ConversationStorage, EditFormat, EditFormatType, FilesystemPermissions, Hook, HookEntry, HookPoint, HumanInTheLoop, HumanInTheLoopOptions, MainLoop, Mixin, Model, Observable, ObservableEntry, Policy, RequiresApproval, RequiresCapability, Sandbox, SandboxOptions, SubAgents, TimeoutAction, Tool, Toolbox, Trace, applyDecorators, getAgentConfig, getArtifactConfig, getCheckpointConfig, getConversationConfig, getHooks, getHooksByPoint, getHumanInTheLoopConfig, getMainLoop, getMixins, getObservableByChannel, getObservables, getSandboxConfig, getSubAgents, getToolConfig, getToolMethods, getToolboxConfig, isCommandAllowed, isPathAllowed } from './decorators.js';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
export { A as AgentOptions, a as ApprovalOptions, B as BudgetOptions, C as Compaction, b as CompactionDecoratorConfig, c as ContextCompactionStrategy, d as ContextWindow, e as ContextWindowOptions, G as Gateway, f as GatewayOptions, I as IndexStrategy, M as MCP, g as MainLoopMeta, h as MainLoopOptions, i as McpServerConfig, j as McpServersMap, k as Memory, l as MemoryOptions, m as MemoryProvider, n as MemoryScope, P as PlatformName, o as PolicyHandler, p as ProjectContext, q as ProjectContextOptions, R as RelevanceStrategy, S as SessionStrategy, r as Skills, s as SkillsOptions, T as ToolOptions, t as ToolboxOptions, u as getCompactionConfig, v as getContextWindowConfig, w as getGatewayConfig, x as getMcpConfig, y as getMemoryConfig, z as getProjectContextConfig, D as getSkillsConfig, E as resolveSessionId } from './skills-BHnHPn7p.js';
|
|
3
|
+
import { L as LoopOutcome, a as LoopStrategy, C as CompiledAgentOptions, S as StreamEvent, D as DelegationResult } from './bridge-entry-CAI1139f.js';
|
|
4
|
+
export { A as AgentExecutionContext, b as AgentManifest, c as AgentManifestEntry, d as AgentManifestTool, e as AgentRoute, f as AgentRouteContext, g as AgentRunInfo, h as AgentStreamEvent, i as AgentWalkResult, j as AgentWarningCode, k as AgentsPluginOptions, l as ApprovalRequiredEvent, m as ArtifactChunkEvent, n as ArtifactStartEvent, B as BudgetExceededError, o as CheckpointSavedEvent, p as CompiledContextWindow, q as CompiledTool, r as DEFAULT_MAX_ITERATIONS, s as DelegateOptions, t as DelegationError, u as DoneEvent, E as ErrorEvent, F as FileEditEvent, I as IterationEvent, v as LoopFinishReason, w as LoopStrategyConfig, R as RunStartedEvent, x as SdkMessage, y as StateUpdateEvent, T as TextDeltaEvent, z as ThinkingEvent, G as ToolCallEvent, H as ToolResultEvent, J as ToolWalkResult, K as ToolboxWalkResult, M as agentsPlugin, N as compileAgent, O as compileContextWindow, P as compileProjectContext, Q as compileSkills, U as compileTools, V as createAgentExecutionContext, W as createSdkAgentStream, X as delegate, Y as generateAgentManifest, Z as generateAgentRoutes, _ as isAgentContext, $ as isApprovalRequired, a0 as isDone, a1 as isError, a2 as isTextDelta, a3 as isToolCall, a4 as isToolResult, a5 as loopStrategyConfigSchema, a6 as projectContextMetadataOnlyKnobs, a7 as resolveLoopStrategy, a8 as streamAgentResponse, a9 as translateSdkEvent, aa as validateUniqueRoutes, ab as walkAgentMetadata } from './bridge-entry-CAI1139f.js';
|
|
5
|
+
import { CompressibleMessage } from '@theokit/sdk/compaction';
|
|
6
|
+
export { CompressibleMessage } from '@theokit/sdk/compaction';
|
|
6
7
|
import { z } from 'zod';
|
|
7
8
|
import '@theokit/http';
|
|
8
9
|
import '@theokit/sdk';
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
|
-
*
|
|
12
|
-
*
|
|
12
|
+
* TranscriptCompactionStrategy — a named, callable transcript-compaction authoring layer
|
|
13
|
+
* (Strategy pattern, V4-F). Mirrors `ReflectionStrategy`/`LoopStrategy`: interface
|
|
14
|
+
* + zod config schema + a `'token-budget'` default + `resolveCompactionStrategy`.
|
|
13
15
|
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
16
|
+
* The `'token-budget'` strategy DELEGATES to the SDK's `compactTranscript` (ADR D2 /
|
|
17
|
+
* G2 / sdk-runtime.md — the SDK owns the algorithm; agents owns the named interface;
|
|
18
|
+
* no reimplementation). Per ADR D1 it is CALLABLE by the app (exposed as
|
|
19
|
+
* `AgentRunner.compaction`), NOT auto-invoked by the reflective loop — the SDK owns
|
|
20
|
+
* per-turn context, so the app decides WHEN to compact and supplies the `summarize`
|
|
21
|
+
* callback (its own LLM). EC-6: consumers whose transcript rows carry roles outside
|
|
22
|
+
* the SDK's `CompressibleMessage` union (e.g. `'tool'`) cast at the call site, exactly
|
|
23
|
+
* as the SDK's own type contract requires.
|
|
20
24
|
*
|
|
21
|
-
* referencia: knowledge-base/references/mastra
|
|
25
|
+
* referencia: knowledge-base/references/mastra compaction (named strategy over a budget).
|
|
22
26
|
*/
|
|
23
27
|
|
|
24
|
-
/**
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
28
|
+
/** Token budget mirrored from theocode's proven `DEFAULT_KEEP_TOKENS` (server/lib/compaction.ts). */
|
|
29
|
+
declare const DEFAULT_KEEP_TOKENS = 8000;
|
|
30
|
+
/**
|
|
31
|
+
* App-supplied summarizer: collapse the older window into one turn (the app's LLM).
|
|
32
|
+
* Signature matches the SDK `compactTranscript` contract — receives the older window
|
|
33
|
+
* AND the (optionally overridden) summary template.
|
|
34
|
+
*/
|
|
35
|
+
type Summarize = (older: CompressibleMessage[], template: string) => Promise<CompressibleMessage>;
|
|
36
|
+
/**
|
|
37
|
+
* Per-call options for {@link TranscriptCompactionStrategy.compact} — a faithful
|
|
38
|
+
* pass-through of the SDK `CompactTranscriptOptions` knobs the app controls. Defaults
|
|
39
|
+
* are the SDK's, EXCEPT `failSafe` which defaults `true` here: a thrown `summarize`
|
|
40
|
+
* returns the ORIGINAL transcript + a structured warn instead of losing it — compaction
|
|
41
|
+
* is an optimization, never a cause of data loss (error-handling discipline). The app
|
|
42
|
+
* passes `failSafe: false` to opt into fail-fast propagation.
|
|
43
|
+
*/
|
|
44
|
+
interface CompactionCallOptions {
|
|
45
|
+
/** Override the strategy's configured `keepTokens` for this call. */
|
|
46
|
+
readonly keepTokens?: number;
|
|
47
|
+
/** Summarize the older window; if omitted, the SDK drops it (its documented contract). */
|
|
48
|
+
readonly summarize?: Summarize;
|
|
49
|
+
/** Checkpoint marker (SDK default when omitted). */
|
|
50
|
+
readonly marker?: string;
|
|
51
|
+
/** Summary template passed to `summarize` (SDK default when omitted). */
|
|
52
|
+
readonly summaryTemplate?: string;
|
|
53
|
+
/** When true (DEFAULT here), a thrown `summarize` returns the original transcript + a warn. */
|
|
54
|
+
readonly failSafe?: boolean;
|
|
40
55
|
}
|
|
41
|
-
/**
|
|
42
|
-
interface
|
|
43
|
-
/**
|
|
44
|
-
readonly name:
|
|
45
|
-
/**
|
|
46
|
-
readonly
|
|
47
|
-
/**
|
|
48
|
-
|
|
56
|
+
/** A named, callable compaction strategy. Pure of I/O except the delegated SDK call. */
|
|
57
|
+
interface TranscriptCompactionStrategy {
|
|
58
|
+
/** Strategy identifier (e.g. `'token-budget'`). */
|
|
59
|
+
readonly name: string;
|
|
60
|
+
/** The configured token budget (from `@Compaction` / `.compaction()` / default). */
|
|
61
|
+
readonly keepTokens: number;
|
|
62
|
+
/**
|
|
63
|
+
* Compact `messages` to the (optionally overridden) token budget via the SDK's
|
|
64
|
+
* `compactTranscript`. Returns the compacted transcript; never mutates the input.
|
|
65
|
+
*/
|
|
66
|
+
compact(messages: CompressibleMessage[], options?: CompactionCallOptions): Promise<CompressibleMessage[]>;
|
|
49
67
|
}
|
|
50
|
-
/**
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}>;
|
|
59
|
-
maxIterations: z.ZodNumber;
|
|
68
|
+
/**
|
|
69
|
+
* Serializable config for a TranscriptCompactionStrategy (SSoT per type-safety.md / G3).
|
|
70
|
+
* `keepTokens` is REQUIRED for `'token-budget'` (EC-2 / G10 — no silent degradation
|
|
71
|
+
* to the SDK's turn-count `keepRecent` default; the strategy is named for token budget).
|
|
72
|
+
*/
|
|
73
|
+
declare const compactionStrategyConfigSchema: z.ZodObject<{
|
|
74
|
+
name: z.ZodLiteral<"token-budget">;
|
|
75
|
+
keepTokens: z.ZodNumber;
|
|
60
76
|
}, z.core.$strip>;
|
|
61
|
-
type
|
|
77
|
+
type CompactionStrategyConfig = z.infer<typeof compactionStrategyConfigSchema>;
|
|
62
78
|
/**
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
* - `
|
|
66
|
-
*
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
79
|
+
* Resolve a `@Compaction` / `.compaction()` declaration to a concrete strategy.
|
|
80
|
+
* Throws (Zod) on an unknown name or a missing/invalid `keepTokens` (EC-2/EC-5 —
|
|
81
|
+
* fail-fast, mirrors `resolveLoopStrategy`). The returned strategy's `compact`
|
|
82
|
+
* delegates to `compactTranscript`, defaulting `keepTokens` to the configured value.
|
|
83
|
+
*/
|
|
84
|
+
declare function resolveCompactionStrategy(name: string, config: {
|
|
85
|
+
keepTokens?: number;
|
|
86
|
+
}): TranscriptCompactionStrategy;
|
|
87
|
+
/**
|
|
88
|
+
* The default `'token-budget'` strategy (what `@Compaction('token-budget')` without
|
|
89
|
+
* an explicit budget resolves to). Carries {@link DEFAULT_KEEP_TOKENS}; the app may
|
|
90
|
+
* override per call via `compact(messages, { keepTokens })`.
|
|
70
91
|
*/
|
|
71
|
-
declare
|
|
92
|
+
declare const tokenBudgetCompactionStrategy: TranscriptCompactionStrategy;
|
|
72
93
|
|
|
73
94
|
/**
|
|
74
95
|
* ReflectionStrategy — composes INTO the loop between rounds (the loop calls
|
|
@@ -131,8 +152,9 @@ declare const noopReflectionStrategy: ReflectionStrategy;
|
|
|
131
152
|
* compiles the agent and resolves the SAME `{ compiled, loopStrategy }` that
|
|
132
153
|
* `delegate()` resolves for the decorator path (two on-ramps, one runtime).
|
|
133
154
|
* `build()` is the compile boundary (no I/O, no IoC — standalone, mirrors
|
|
134
|
-
* Spring's `ChatClient.builder(...).build()`); `run()`
|
|
135
|
-
* `
|
|
155
|
+
* Spring's `ChatClient.builder(...).build()`); `stream()`/`run()` do the I/O via
|
|
156
|
+
* `runReflectiveLoopStream` (the SAME loop `delegate()` drains — DRY, ADR 0031).
|
|
157
|
+
* V4-D-stream: `stream()` yields events live (SSE-first); `run()` drains it to a result.
|
|
136
158
|
*
|
|
137
159
|
* referencia: knowledge-base/references/spring-ai DefaultChatClientBuilder.java (build() returns standalone).
|
|
138
160
|
*/
|
|
@@ -152,6 +174,19 @@ interface AgentRunnerRunOptions {
|
|
|
152
174
|
* A built, runnable agent. Construct via {@link AgentRunner.builder} — the
|
|
153
175
|
* constructor takes already-resolved state and is an internal detail.
|
|
154
176
|
*/
|
|
177
|
+
/** Already-resolved state handed to the {@link AgentRunner} constructor (internal). */
|
|
178
|
+
interface AgentRunnerState {
|
|
179
|
+
readonly compiled: CompiledAgentOptions;
|
|
180
|
+
readonly agentName: string;
|
|
181
|
+
/** The resolved terminal-decision strategy (parity with `delegate()`). */
|
|
182
|
+
readonly loopStrategy: LoopStrategy;
|
|
183
|
+
/** The resolved between-round reflection (default or `.reflection(custom)` override). */
|
|
184
|
+
readonly reflectionStrategy: ReflectionStrategy;
|
|
185
|
+
/** Recorded streaming preference (see {@link AgentRunner.streamEnabled}). */
|
|
186
|
+
readonly streamEnabled: boolean;
|
|
187
|
+
/** The resolved compaction strategy, or `undefined` when none is declared (EC-4). */
|
|
188
|
+
readonly compaction?: TranscriptCompactionStrategy;
|
|
189
|
+
}
|
|
155
190
|
declare class AgentRunner {
|
|
156
191
|
private readonly compiled;
|
|
157
192
|
private readonly agentName;
|
|
@@ -160,27 +195,31 @@ declare class AgentRunner {
|
|
|
160
195
|
/** The resolved between-round reflection (default or `.reflection(custom)` override). */
|
|
161
196
|
readonly reflectionStrategy: ReflectionStrategy;
|
|
162
197
|
/**
|
|
163
|
-
* Recorded streaming preference. The reflective loop currently always
|
|
164
|
-
*
|
|
165
|
-
*
|
|
166
|
-
*
|
|
198
|
+
* Recorded streaming preference. The reflective loop currently always streams via
|
|
199
|
+
* the SDK `Run.stream()`; a non-streaming collect mode is future work — the flag is
|
|
200
|
+
* captured + exposed here, not yet branched on (honest per G10: documented, not a
|
|
201
|
+
* silent no-op).
|
|
167
202
|
*/
|
|
168
203
|
readonly streamEnabled: boolean;
|
|
169
|
-
constructor(compiled: CompiledAgentOptions, agentName: string,
|
|
170
|
-
/** The resolved terminal-decision strategy (parity with `delegate()`). */
|
|
171
|
-
loopStrategy: LoopStrategy,
|
|
172
|
-
/** The resolved between-round reflection (default or `.reflection(custom)` override). */
|
|
173
|
-
reflectionStrategy: ReflectionStrategy,
|
|
174
204
|
/**
|
|
175
|
-
*
|
|
176
|
-
*
|
|
177
|
-
*
|
|
178
|
-
*
|
|
205
|
+
* V4-F: the resolved compaction strategy (from `@Compaction` or `.compaction()`),
|
|
206
|
+
* or `undefined` when neither is declared — compaction is opt-in (EC-4). CALLABLE
|
|
207
|
+
* by the app (ADR D1: `runner.compaction?.compact(messages, { summarize })`); the
|
|
208
|
+
* reflective loop does NOT auto-invoke it (the SDK owns per-turn context).
|
|
179
209
|
*/
|
|
180
|
-
|
|
210
|
+
readonly compaction?: TranscriptCompactionStrategy;
|
|
211
|
+
constructor(state: AgentRunnerState);
|
|
181
212
|
/** Start a fluent builder for `AgentClass`. */
|
|
182
213
|
static builder(AgentClass: Function): AgentRunnerBuilder;
|
|
183
|
-
/**
|
|
214
|
+
/**
|
|
215
|
+
* V4-D-stream: stream the agent's events LIVE across the reflective loop, returning
|
|
216
|
+
* the aggregated {@link DelegationResult} as the generator's return value. This is the
|
|
217
|
+
* on-ramp for streaming-first apps (SSE) — `runReflectiveLoopStream` yields every
|
|
218
|
+
* round's events before the loop terminates. `streamEnabled` is honored: when the
|
|
219
|
+
* builder set `.stream(false)`, callers should use {@link run} instead.
|
|
220
|
+
*/
|
|
221
|
+
stream(message: string, opts: AgentRunnerRunOptions): AsyncGenerator<StreamEvent, DelegationResult>;
|
|
222
|
+
/** Run the agent to a terminal result via the shared reflective loop (collect mode). */
|
|
184
223
|
run(message: string, opts: AgentRunnerRunOptions): Promise<DelegationResult>;
|
|
185
224
|
}
|
|
186
225
|
/** Fluent builder — accumulates config; `build()` is the compile boundary. */
|
|
@@ -188,13 +227,22 @@ declare class AgentRunnerBuilder {
|
|
|
188
227
|
private readonly AgentClass;
|
|
189
228
|
private reflectionOverride?;
|
|
190
229
|
private streamEnabled;
|
|
230
|
+
private compactionOverride?;
|
|
191
231
|
constructor(AgentClass: Function);
|
|
192
232
|
/** Override the default reflection strategy (OCP — plan Drawback #2). No arg ⇒ keep default. */
|
|
193
233
|
reflection(strategy?: ReflectionStrategy): this;
|
|
194
234
|
/** Record the streaming preference (see {@link AgentRunner.streamEnabled}). */
|
|
195
235
|
stream(enabled?: boolean): this;
|
|
236
|
+
/**
|
|
237
|
+
* V4-F: declare the compaction strategy (e.g. `.compaction('token-budget', { keepTokens: 8000 })`).
|
|
238
|
+
* Resolved + validated at {@link build} (EC-5 — fail-fast there, not here). This builder
|
|
239
|
+
* call WINS over a `@Compaction` decorator on the same agent (EC-1 — explicit override).
|
|
240
|
+
*/
|
|
241
|
+
compaction(name: string, options?: {
|
|
242
|
+
keepTokens?: number;
|
|
243
|
+
}): this;
|
|
196
244
|
/** Walk + compile + resolve strategies — the compile→execute boundary (no I/O). */
|
|
197
245
|
build(): AgentRunner;
|
|
198
246
|
}
|
|
199
247
|
|
|
200
|
-
export { AgentRunner, AgentRunnerBuilder, type AgentRunnerRunOptions, CompiledAgentOptions,
|
|
248
|
+
export { AgentRunner, AgentRunnerBuilder, type AgentRunnerRunOptions, type CompactionCallOptions, type CompactionStrategyConfig, CompiledAgentOptions, DEFAULT_KEEP_TOKENS, DelegationResult, LoopOutcome, LoopStrategy, type ReflectionResult, type ReflectionStrategy, type ReflectionStrategyConfig, StreamEvent, type Summarize, type TranscriptCompactionStrategy, compactionStrategyConfigSchema, ladderReflectionStrategy, noopReflectionStrategy, reflectionStrategyConfigSchema, resolveCompactionStrategy, tokenBudgetCompactionStrategy };
|
package/dist/index.js
CHANGED
|
@@ -27,15 +27,17 @@ import {
|
|
|
27
27
|
getToolboxConfig,
|
|
28
28
|
isCommandAllowed,
|
|
29
29
|
isPathAllowed
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-SKTJS4QQ.js";
|
|
31
31
|
import {
|
|
32
32
|
AgentRunner,
|
|
33
33
|
AgentRunnerBuilder,
|
|
34
34
|
AgentWarningCode,
|
|
35
35
|
BudgetExceededError,
|
|
36
|
+
DEFAULT_KEEP_TOKENS,
|
|
36
37
|
DEFAULT_MAX_ITERATIONS,
|
|
37
38
|
DelegationError,
|
|
38
39
|
agentsPlugin,
|
|
40
|
+
compactionStrategyConfigSchema,
|
|
39
41
|
compileAgent,
|
|
40
42
|
compileContextWindow,
|
|
41
43
|
compileProjectContext,
|
|
@@ -58,16 +60,19 @@ import {
|
|
|
58
60
|
noopReflectionStrategy,
|
|
59
61
|
projectContextMetadataOnlyKnobs,
|
|
60
62
|
reflectionStrategyConfigSchema,
|
|
63
|
+
resolveCompactionStrategy,
|
|
61
64
|
resolveLoopStrategy,
|
|
62
65
|
streamAgentResponse,
|
|
66
|
+
tokenBudgetCompactionStrategy,
|
|
63
67
|
translateSdkEvent,
|
|
64
68
|
validateUniqueRoutes,
|
|
65
69
|
walkAgentMetadata
|
|
66
|
-
} from "./chunk-
|
|
70
|
+
} from "./chunk-BCSRKDP6.js";
|
|
67
71
|
import {
|
|
68
72
|
Agent,
|
|
69
73
|
Audit,
|
|
70
74
|
Budget,
|
|
75
|
+
Compaction,
|
|
71
76
|
ContextWindow,
|
|
72
77
|
Gateway,
|
|
73
78
|
MCP,
|
|
@@ -81,6 +86,7 @@ import {
|
|
|
81
86
|
SubAgents,
|
|
82
87
|
Trace,
|
|
83
88
|
getAgentConfig,
|
|
89
|
+
getCompactionConfig,
|
|
84
90
|
getContextWindowConfig,
|
|
85
91
|
getGatewayConfig,
|
|
86
92
|
getMcpConfig,
|
|
@@ -90,7 +96,7 @@ import {
|
|
|
90
96
|
getSkillsConfig,
|
|
91
97
|
getSubAgents,
|
|
92
98
|
resolveSessionId
|
|
93
|
-
} from "./chunk-
|
|
99
|
+
} from "./chunk-GVPUUKKE.js";
|
|
94
100
|
import "./chunk-7QVYU63E.js";
|
|
95
101
|
export {
|
|
96
102
|
Agent,
|
|
@@ -102,8 +108,10 @@ export {
|
|
|
102
108
|
Budget,
|
|
103
109
|
BudgetExceededError,
|
|
104
110
|
Checkpoint,
|
|
111
|
+
Compaction,
|
|
105
112
|
ContextWindow,
|
|
106
113
|
Conversation,
|
|
114
|
+
DEFAULT_KEEP_TOKENS,
|
|
107
115
|
DEFAULT_MAX_ITERATIONS,
|
|
108
116
|
DelegationError,
|
|
109
117
|
EditFormat,
|
|
@@ -128,6 +136,7 @@ export {
|
|
|
128
136
|
Trace,
|
|
129
137
|
agentsPlugin,
|
|
130
138
|
applyDecorators,
|
|
139
|
+
compactionStrategyConfigSchema,
|
|
131
140
|
compileAgent,
|
|
132
141
|
compileContextWindow,
|
|
133
142
|
compileProjectContext,
|
|
@@ -141,6 +150,7 @@ export {
|
|
|
141
150
|
getAgentConfig,
|
|
142
151
|
getArtifactConfig,
|
|
143
152
|
getCheckpointConfig,
|
|
153
|
+
getCompactionConfig,
|
|
144
154
|
getContextWindowConfig,
|
|
145
155
|
getConversationConfig,
|
|
146
156
|
getGatewayConfig,
|
|
@@ -174,9 +184,11 @@ export {
|
|
|
174
184
|
noopReflectionStrategy,
|
|
175
185
|
projectContextMetadataOnlyKnobs,
|
|
176
186
|
reflectionStrategyConfigSchema,
|
|
187
|
+
resolveCompactionStrategy,
|
|
177
188
|
resolveLoopStrategy,
|
|
178
189
|
resolveSessionId,
|
|
179
190
|
streamAgentResponse,
|
|
191
|
+
tokenBudgetCompactionStrategy,
|
|
180
192
|
translateSdkEvent,
|
|
181
193
|
validateUniqueRoutes,
|
|
182
194
|
walkAgentMetadata
|
|
@@ -66,6 +66,18 @@ type PolicyHandler = (user: {
|
|
|
66
66
|
roles: string[];
|
|
67
67
|
}) => boolean;
|
|
68
68
|
|
|
69
|
+
/** Stored `@Compaction` declaration (resolved + validated at `AgentRunner.build()`). */
|
|
70
|
+
interface CompactionDecoratorConfig {
|
|
71
|
+
/** Strategy name (e.g. `'token-budget'`). Validated at resolve time. */
|
|
72
|
+
name: string;
|
|
73
|
+
/** Token budget for `'token-budget'`. Required at resolve time (EC-2). */
|
|
74
|
+
keepTokens?: number;
|
|
75
|
+
}
|
|
76
|
+
declare function Compaction(name: string, options?: {
|
|
77
|
+
keepTokens?: number;
|
|
78
|
+
}): ClassDecorator;
|
|
79
|
+
declare function getCompactionConfig(target: Function): CompactionDecoratorConfig | undefined;
|
|
80
|
+
|
|
69
81
|
type ContextCompactionStrategy = 'truncate-oldest' | 'summarize-oldest' | 'sliding-window' | 'priority-based';
|
|
70
82
|
interface ContextWindowOptions {
|
|
71
83
|
/** Maximum tokens before compaction triggers. */
|
|
@@ -167,4 +179,4 @@ interface SkillsOptions {
|
|
|
167
179
|
declare function Skills(namesOrOptions: string[] | SkillsOptions): ClassDecorator;
|
|
168
180
|
declare function getSkillsConfig(target: Function): SkillsOptions | undefined;
|
|
169
181
|
|
|
170
|
-
export { type AgentOptions as A, type BudgetOptions as B,
|
|
182
|
+
export { type AgentOptions as A, type BudgetOptions as B, Compaction as C, getSkillsConfig as D, resolveSessionId as E, Gateway as G, type IndexStrategy as I, MCP as M, type PlatformName as P, type RelevanceStrategy as R, type SessionStrategy as S, type ToolOptions as T, type ApprovalOptions as a, type CompactionDecoratorConfig as b, type ContextCompactionStrategy as c, ContextWindow as d, type ContextWindowOptions as e, type GatewayOptions as f, type MainLoopMeta as g, type MainLoopOptions as h, type McpServerConfig as i, type McpServersMap as j, Memory as k, type MemoryOptions as l, type MemoryProvider as m, type MemoryScope as n, type PolicyHandler as o, ProjectContext as p, type ProjectContextOptions as q, Skills as r, type SkillsOptions as s, type ToolboxOptions as t, getCompactionConfig as u, getContextWindowConfig as v, getGatewayConfig as w, getMcpConfig as x, getMemoryConfig as y, getProjectContextConfig as z };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theokit/agents",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "Unified decorator runtime — AI agents as first-class citizens of the TheoKit pipeline. @Agent() compiles to SDK Agent.create(), @Tool() compiles to defineTool().",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
38
|
"@theokit/http": ">=0.1.0-alpha.0",
|
|
39
|
-
"@theokit/sdk": ">=2.
|
|
39
|
+
"@theokit/sdk": ">=2.9.0",
|
|
40
40
|
"@theokit/sdk-tools": ">=0.2.0",
|
|
41
41
|
"reflect-metadata": ">=0.2.0",
|
|
42
42
|
"zod": "^4.0.0"
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"@theokit/http": "workspace:*",
|
|
51
|
-
"@theokit/sdk": "^2.
|
|
51
|
+
"@theokit/sdk": "^2.9.0",
|
|
52
52
|
"@theokit/sdk-tools": "^0.2.0",
|
|
53
53
|
"reflect-metadata": "^0.2.2",
|
|
54
54
|
"tsup": "^8.5.1",
|