@theokit/agents 0.35.2 → 0.36.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-B3_Vw4qc.d.ts → bridge-entry-DYXCEzdJ.d.ts} +21 -1
- package/dist/bridge.d.ts +1 -1
- package/dist/bridge.js +1 -1
- package/dist/{chunk-7IGNIY3B.js → chunk-RJTRE6BD.js} +12 -3
- package/dist/chunk-RJTRE6BD.js.map +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-7IGNIY3B.js.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ExecutionContext } from '@theokit/http';
|
|
2
2
|
import { A as AgentOptions, g as ToolOptions, M as MainLoopMeta, a as ApprovalOptions, B as BudgetOptions, H as HumanInTheLoopOptions, t as GatewayOptions, z as MemoryOptions, O as SkillsOptions, r as ContextWindowOptions, K as ProjectContextOptions, x as McpServersMap, G as Guardrail, o as CompactionDecoratorConfig, j as CheckpointOptions, R as ReasoningEffort } from './types-DVA4LQsA.js';
|
|
3
|
-
import { SystemPromptResolver, SkillsSettings, ContextSettings, PluginsSettings, Plugin, ProviderRoutingSettings, AgentDefinition as AgentDefinition$1, BudgetTracker,
|
|
3
|
+
import { SystemPromptResolver, ConversationStorageAdapter, SkillsSettings, ContextSettings, PluginsSettings, Plugin, ProviderRoutingSettings, AgentDefinition as AgentDefinition$1, BudgetTracker, CustomTool, ModelSelection } from '@theokit/sdk';
|
|
4
4
|
import { UIMessageChunk } from 'ai';
|
|
5
5
|
import { z } from 'zod';
|
|
6
6
|
import { RetryOptions } from '@theokit/sdk/retry';
|
|
@@ -184,6 +184,14 @@ interface CompiledAgentOptions {
|
|
|
184
184
|
recoverLeakedToolCalls?: boolean;
|
|
185
185
|
/** Static prompt OR a per-request {@link SystemPromptResolver} (V4-L.1, Axis-B). */
|
|
186
186
|
systemPrompt?: string | SystemPromptResolver;
|
|
187
|
+
/**
|
|
188
|
+
* Agent-level conversation memory: the `ConversationStorageAdapter` the SDK persists turns to
|
|
189
|
+
* (`Agent.getOrCreate({ conversationStorage })`). Populated by `defineAgent({ conversationStorage })`
|
|
190
|
+
* / `.conversationStorage(adapter)`. A per-run override (`RuntimeOverrides.conversationStorage`)
|
|
191
|
+
* wins over this; absent ⇒ the SDK default store is chosen lazily. Distinct from `@Checkpoint`,
|
|
192
|
+
* which only toggles filesystem-vs-memory for the built-in default.
|
|
193
|
+
*/
|
|
194
|
+
conversationStorage?: ConversationStorageAdapter;
|
|
187
195
|
tools: CompiledTool[];
|
|
188
196
|
agents: Record<string, CompiledSubAgent>;
|
|
189
197
|
memory?: MemoryOptions;
|
|
@@ -721,6 +729,13 @@ interface DefineAgentConfig<TInput extends z.ZodType = z.ZodType> {
|
|
|
721
729
|
* request path against the run-context). Absent ⇒ the SDK enables every discovered skill.
|
|
722
730
|
*/
|
|
723
731
|
skills?: SkillsSelection;
|
|
732
|
+
/**
|
|
733
|
+
* Conversation memory: the `ConversationStorageAdapter` the agent persists its turns to. Swap it to
|
|
734
|
+
* control WHERE memory lives — `InMemoryConversationStorage` (ephemeral, great for tests) vs
|
|
735
|
+
* `FileSystemConversationStorage` (durable) vs a custom adapter. Absent ⇒ the SDK picks its default
|
|
736
|
+
* store. A per-run override still wins over this agent-level default.
|
|
737
|
+
*/
|
|
738
|
+
conversationStorage?: ConversationStorageAdapter;
|
|
724
739
|
}
|
|
725
740
|
/**
|
|
726
741
|
* A branded agent definition — the value {@link defineAgent} returns.
|
|
@@ -842,6 +857,11 @@ interface AgentBuilder<TInput extends z.ZodType | UnsetMarker = UnsetMarker, TMo
|
|
|
842
857
|
approvals(map: Record<string, HumanInTheLoopOptions>): AgentBuilder<TInput, TModel, TContext, TTools>;
|
|
843
858
|
/** M13 — select skills: a static list OR a per-request resolver `(ctx) => string[]`. */
|
|
844
859
|
skills(selection: SkillsSelection): AgentBuilder<TInput, TModel, TContext, TTools>;
|
|
860
|
+
/**
|
|
861
|
+
* Set the agent's conversation memory — the `ConversationStorageAdapter` the SDK persists turns to.
|
|
862
|
+
* Swap in-memory ⇄ filesystem ⇄ custom without touching the runtime. A per-run override still wins.
|
|
863
|
+
*/
|
|
864
|
+
conversationStorage(adapter: ConversationStorageAdapter): AgentBuilder<TInput, TModel, TContext, TTools>;
|
|
845
865
|
/**
|
|
846
866
|
* Apply a reusable partial chain (Spring-Boot-style composition). `preset` receives the current
|
|
847
867
|
* builder and returns an advanced one; its accumulated type-state flows through.
|
package/dist/bridge.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { c as AGENT_BRAND, d as AfterToolCallContext, e as AgentBuilder, f as AgentDefinition, g as AgentDefinitionError, h as AgentExecutionContext, i as AgentManifest, A as AgentManifestEntry, j as AgentManifestTool, k as AgentRoute, l as AgentRouteContext, m as AgentRunInfo, n as AgentStreamEvent, o as AgentWalkResult, p as AgentWarningCode, q as AgentsPluginOptions, r as ApiErrorContext, s as ApiErrorDecision, t as ApiErrorPolicy, u as ApprovalRequiredEvent, v as ArtifactChunkEvent, w as ArtifactStartEvent, B as BackgroundDelegation, x as BeforeToolCallContext, y as BudgetExceededError, z as CheckpointSavedEvent, C as CompiledAgentOptions, E as CompiledContextWindow, a as CompiledTool, F as ContextualTool, H as DefineAgentConfig, I as DelegateFn, J as DelegateOptions, K as DelegationError, D as DelegationResult, M as DoneEvent, N as ErrorEvent, O as FileEditEvent, Q as InferAgentInput, T as InferAgentToolNames, U as IterationEvent, V as LLMCallContext, Z as McpApprovalSpec, _ as McpRegistryConfig, $ as McpRequestContext, a0 as McpSelection, a1 as PartialToolCallEvent, a2 as ProcessInputContext, a6 as RunStartedEvent, a7 as ScoreVerdict, a8 as ScoredDelegation, a9 as Scorer, aa as SdkMessage, ab as Segment, ae as StateUpdateEvent, S as StreamEvent, af as TextDeltaEvent, ag as ThinkingEvent, ah as ToolCallEvent, ai as ToolCallVeto, aj as ToolHooks, ak as ToolHooksPlugin, al as ToolResultEvent, am as ToolWalkResult, an as ToolboxWalkResult, ao as agent, ap as agentsPlugin, aq as buildModelSelection, ar as compileAgent, as as compileAgentDefinition, at as compileAgentModule, au as compileContextWindow, av as compileProjectContext, aw as compileSkills, ax as compileTools, ay as contextualTool, az as createAgentExecutionContext, aA as createApiErrorHandler, aB as createSdkAgentStream, aC as createThinkTagExtractor, aD as createToolHooksPlugin, aE as delegate, aF as delegateBackground, aG as delegateWithScoring, aH as extractThinkTagStream, aI as generateAgentManifest, aJ as generateAgentRoutes, aK as isAgentContext, aL as isAgentDefinition, aM as isApprovalRequired, aN as isDone, aO as isError, aP as isPartialToolCall, aQ as isTextDelta, aR as isToolCall, aS as isToolResult, aV as mcpRegistry, aW as mcpToolApprovals, aY as projectContextMetadataOnlyKnobs, b0 as resolveMcpServers, b1 as runWithApiErrorHandling, b2 as streamAgentResponse, b3 as streamAgentUIMessages, b4 as translateSdkEvent, b5 as translateToUIMessageStream, b6 as validateUniqueRoutes, b7 as walkAgentMetadata } from './bridge-entry-
|
|
1
|
+
export { c as AGENT_BRAND, d as AfterToolCallContext, e as AgentBuilder, f as AgentDefinition, g as AgentDefinitionError, h as AgentExecutionContext, i as AgentManifest, A as AgentManifestEntry, j as AgentManifestTool, k as AgentRoute, l as AgentRouteContext, m as AgentRunInfo, n as AgentStreamEvent, o as AgentWalkResult, p as AgentWarningCode, q as AgentsPluginOptions, r as ApiErrorContext, s as ApiErrorDecision, t as ApiErrorPolicy, u as ApprovalRequiredEvent, v as ArtifactChunkEvent, w as ArtifactStartEvent, B as BackgroundDelegation, x as BeforeToolCallContext, y as BudgetExceededError, z as CheckpointSavedEvent, C as CompiledAgentOptions, E as CompiledContextWindow, a as CompiledTool, F as ContextualTool, H as DefineAgentConfig, I as DelegateFn, J as DelegateOptions, K as DelegationError, D as DelegationResult, M as DoneEvent, N as ErrorEvent, O as FileEditEvent, Q as InferAgentInput, T as InferAgentToolNames, U as IterationEvent, V as LLMCallContext, Z as McpApprovalSpec, _ as McpRegistryConfig, $ as McpRequestContext, a0 as McpSelection, a1 as PartialToolCallEvent, a2 as ProcessInputContext, a6 as RunStartedEvent, a7 as ScoreVerdict, a8 as ScoredDelegation, a9 as Scorer, aa as SdkMessage, ab as Segment, ae as StateUpdateEvent, S as StreamEvent, af as TextDeltaEvent, ag as ThinkingEvent, ah as ToolCallEvent, ai as ToolCallVeto, aj as ToolHooks, ak as ToolHooksPlugin, al as ToolResultEvent, am as ToolWalkResult, an as ToolboxWalkResult, ao as agent, ap as agentsPlugin, aq as buildModelSelection, ar as compileAgent, as as compileAgentDefinition, at as compileAgentModule, au as compileContextWindow, av as compileProjectContext, aw as compileSkills, ax as compileTools, ay as contextualTool, az as createAgentExecutionContext, aA as createApiErrorHandler, aB as createSdkAgentStream, aC as createThinkTagExtractor, aD as createToolHooksPlugin, aE as delegate, aF as delegateBackground, aG as delegateWithScoring, aH as extractThinkTagStream, aI as generateAgentManifest, aJ as generateAgentRoutes, aK as isAgentContext, aL as isAgentDefinition, aM as isApprovalRequired, aN as isDone, aO as isError, aP as isPartialToolCall, aQ as isTextDelta, aR as isToolCall, aS as isToolResult, aV as mcpRegistry, aW as mcpToolApprovals, aY as projectContextMetadataOnlyKnobs, b0 as resolveMcpServers, b1 as runWithApiErrorHandling, b2 as streamAgentResponse, b3 as streamAgentUIMessages, b4 as translateSdkEvent, b5 as translateToUIMessageStream, b6 as validateUniqueRoutes, b7 as walkAgentMetadata } from './bridge-entry-DYXCEzdJ.js';
|
|
2
2
|
import '@theokit/http';
|
|
3
3
|
import './types-DVA4LQsA.js';
|
|
4
4
|
import '@theokit/sdk';
|
package/dist/bridge.js
CHANGED
|
@@ -1180,7 +1180,7 @@ function createSdkAgentStream(compiled, compiledTools, apiKey, overrides = {}) {
|
|
|
1180
1180
|
const reasoningEffort = overrides.reasoningEffort ?? compiled.reasoningEffort;
|
|
1181
1181
|
const { parseThinkTags, stripToolDialect } = resolveTextTransformFlags(compiled, overrides);
|
|
1182
1182
|
const runContext = overrides.runContext ?? compiled.runContext;
|
|
1183
|
-
let storage = overrides.conversationStorage;
|
|
1183
|
+
let storage = overrides.conversationStorage ?? compiled.conversationStorage;
|
|
1184
1184
|
return (message, sessionId, factoryOpts) => ({
|
|
1185
1185
|
async *[Symbol.asyncIterator]() {
|
|
1186
1186
|
const runId = `run-${Date.now()}`;
|
|
@@ -1491,7 +1491,12 @@ function compileAgentDefinition(def) {
|
|
|
1491
1491
|
hitl: compileApprovals(def)
|
|
1492
1492
|
} : {},
|
|
1493
1493
|
// M13 — skills: a static list → SDK skills.enabled; a resolver → carried for the request path.
|
|
1494
|
-
...compileSkillsSelection(def.skills)
|
|
1494
|
+
...compileSkillsSelection(def.skills),
|
|
1495
|
+
// Conversation memory: the declared adapter flows to the run path, which hands it to
|
|
1496
|
+
// `Agent.getOrCreate({ conversationStorage })`; absent ⇒ the SDK default is chosen lazily.
|
|
1497
|
+
...def.conversationStorage !== void 0 ? {
|
|
1498
|
+
conversationStorage: def.conversationStorage
|
|
1499
|
+
} : {}
|
|
1495
1500
|
};
|
|
1496
1501
|
}
|
|
1497
1502
|
__name(compileAgentDefinition, "compileAgentDefinition");
|
|
@@ -1585,6 +1590,10 @@ function makeBuilder(config) {
|
|
|
1585
1590
|
...config,
|
|
1586
1591
|
skills: selection
|
|
1587
1592
|
}), "skills"),
|
|
1593
|
+
conversationStorage: /* @__PURE__ */ __name((adapter) => makeBuilder({
|
|
1594
|
+
...config,
|
|
1595
|
+
conversationStorage: adapter
|
|
1596
|
+
}), "conversationStorage"),
|
|
1588
1597
|
use: /* @__PURE__ */ __name((preset) => preset(runtime), "use"),
|
|
1589
1598
|
build: /* @__PURE__ */ __name(() => defineAgent(config), "build")
|
|
1590
1599
|
};
|
|
@@ -2960,4 +2969,4 @@ export {
|
|
|
2960
2969
|
generateAgentManifest,
|
|
2961
2970
|
agentsPlugin
|
|
2962
2971
|
};
|
|
2963
|
-
//# sourceMappingURL=chunk-
|
|
2972
|
+
//# sourceMappingURL=chunk-RJTRE6BD.js.map
|