@theokit/agents 0.38.1 → 0.42.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.
@@ -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 { InlineSkill, SystemPromptResolver, ConversationStorageAdapter, SkillsSettings, ContextSettings, PluginsSettings, Plugin, ProviderRoutingSettings, AgentDefinition as AgentDefinition$1, BudgetTracker, CustomTool, ModelSelection } from '@theokit/sdk';
3
+ import { InlineSkill, SystemPromptResolver, SettingSource, 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';
@@ -191,13 +191,11 @@ interface CompiledAgentOptions {
191
191
  /** Static prompt OR a per-request {@link SystemPromptResolver} (V4-L.1, Axis-B). */
192
192
  systemPrompt?: string | SystemPromptResolver;
193
193
  /**
194
- * Agent-level conversation memory: the `ConversationStorageAdapter` the SDK persists turns to
195
- * (`Agent.getOrCreate({ conversationStorage })`). Populated by `defineAgent({ conversationStorage })`
196
- * / `.conversationStorage(adapter)`. A per-run override (`RuntimeOverrides.conversationStorage`)
197
- * wins over this; absent ⇒ the SDK default store is chosen lazily. Distinct from `@Checkpoint`,
198
- * which only toggles filesystem-vs-memory for the built-in default.
194
+ * theokit-file-based-config opt-in `.theokit/` file-based config roots (`"project"`/`"user"`/…).
195
+ * Projected into `Agent.create({ local: { settingSources } })` by `assembleM8CreateOptions`
196
+ * (merged with `cwd`, decoupled from inline skills). Absent inline (code) config only.
199
197
  */
200
- conversationStorage?: ConversationStorageAdapter;
198
+ settingSources?: readonly SettingSource[];
201
199
  tools: CompiledTool[];
202
200
  agents: Record<string, CompiledSubAgent>;
203
201
  memory?: MemoryOptions;
@@ -563,11 +561,13 @@ interface RuntimeOverrides {
563
561
  /** Per-run SDK budget tracker (inner tool-loop cap; distinct from the loop's USD `budget`). */
564
562
  budgetTracker?: BudgetTracker;
565
563
  /**
566
- * V4-M: conversation store shared across the loop's rounds so history persists
567
- * (round N+1 sees rounds 1..N). Default `InMemoryConversationStorage` (per-run,
568
- * no disk). Pass a `FileSystemConversationStorage`/custom adapter for durable history.
564
+ * SDK 4.0 (SE40) root of the native Claude-shaped `.jsonl` session transcript the SDK writes
565
+ * automatically (`<baseDir>/projects/<encoded-cwd>/<agentId>.jsonl`). The framework threads the
566
+ * app's project root here (see `mount-agent`) so sessions persist per-app; unset ⇒ SDK default
567
+ * (`~/.theokit`). Replaces the removed pluggable `conversationStorage` — persistence is now the
568
+ * SDK's native transcript, not a swappable adapter.
569
569
  */
570
- conversationStorage?: ConversationStorageAdapter;
570
+ baseDir?: string;
571
571
  /**
572
572
  * V4-Q: pre-built SDK `CustomTool[]` forwarded RAW to `Agent.create.tools` (appended after the
573
573
  * compiled tools), bypassing `defineTool` (which requires a Zod schema). Lets an app whose tools
@@ -736,12 +736,14 @@ interface DefineAgentConfig<TInput extends z.ZodType = z.ZodType> {
736
736
  */
737
737
  skills?: SkillsSelection;
738
738
  /**
739
- * Conversation memory: the `ConversationStorageAdapter` the agent persists its turns to. Swap it to
740
- * control WHERE memory lives `InMemoryConversationStorage` (ephemeral, great for tests) vs
741
- * `FileSystemConversationStorage` (durable) vs a custom adapter. Absent ⇒ the SDK picks its default
742
- * store. A per-run override still wins over this agent-level default.
739
+ * theokit-file-based-config opt into `.theokit/` file-based config (skills, subagents, hooks,
740
+ * MCP, context, cron). The SDK discovers config from these roots under the app's `cwd`:
741
+ * `"project"` = `<cwd>/.theokit/`, `"user"` = `~/.theokit/`. Absent ⇒ inline (code) config only.
742
+ * SECURITY: enabling `"project"` enables shell-executing hooks from `.theokit/hooks.json` this
743
+ * is opt-in because `.theokit/` is the app's own repo (informed consent). The SDK owns discovery
744
+ * + execution (G2 / ADR-0040); theokit only wires this into `Agent.create({ local.settingSources })`.
743
745
  */
744
- conversationStorage?: ConversationStorageAdapter;
746
+ settingSources?: readonly SettingSource[];
745
747
  }
746
748
  /**
747
749
  * A branded agent definition — the value {@link defineAgent} returns.
@@ -873,10 +875,12 @@ interface AgentBuilder<TInput extends z.ZodType | UnsetMarker = UnsetMarker, TMo
873
875
  */
874
876
  skills(selection: SkillsSelection): AgentBuilder<TInput, TModel, TContext, TTools>;
875
877
  /**
876
- * Set the agent's conversation memory the `ConversationStorageAdapter` the SDK persists turns to.
877
- * Swap in-memory filesystem custom without touching the runtime. A per-run override still wins.
878
+ * theokit-file-based-config opt into `.theokit/` file-based config (skills, subagents, hooks,
879
+ * MCP, context, cron), discovered by the SDK from the app root (`"project"` = `<cwd>/.theokit/`,
880
+ * `"user"` = `~/.theokit/`). Unset ⇒ inline (code) config only. SECURITY: `"project"` enables
881
+ * shell-executing hooks from `.theokit/hooks.json` — opt-in because `.theokit/` is your own repo.
878
882
  */
879
- conversationStorage(adapter: ConversationStorageAdapter): AgentBuilder<TInput, TModel, TContext, TTools>;
883
+ settingSources(sources: readonly SettingSource[]): AgentBuilder<TInput, TModel, TContext, TTools>;
880
884
  /**
881
885
  * Apply a reusable partial chain (Spring-Boot-style composition). `preset` receives the current
882
886
  * builder and returns an advanced one; its accumulated type-state flows through.
@@ -974,8 +978,18 @@ interface StreamAgentOptions {
974
978
  sessionId: string;
975
979
  /** Enable human-in-the-loop tool approval (M4). Absent ⇒ the M2 non-HITL path, byte-unchanged. */
976
980
  hitl?: StreamHitlOptions;
977
- /** Durable conversation storage for resume (M4); defaults to the SDK per-run in-memory store. */
978
- conversationStorage?: RuntimeOverrides['conversationStorage'];
981
+ /**
982
+ * theokit-file-based-config (EC-1) — the app root `cwd` the SDK resolves `.theokit/` against when
983
+ * `settingSources` is active. The framework boundary (`mountAgent`) threads its resolved
984
+ * `projectRoot` here so discovery points at the app root, NOT `process.cwd()`. Absent ⇒ no `local.cwd`.
985
+ */
986
+ cwd?: RuntimeOverrides['cwd'];
987
+ /**
988
+ * SDK 4.0 (SE40) — root of the native `.jsonl` session transcript. The framework boundary
989
+ * (`mountAgent`) threads the resolved app root here so sessions persist per-app; absent ⇒ the SDK
990
+ * default (`~/.theokit`).
991
+ */
992
+ baseDir?: RuntimeOverrides['baseDir'];
979
993
  /**
980
994
  * The request's abort signal (M4). On client disconnect, the HITL merge queue is closed so the
981
995
  * detached SDK pump stops buffering (bounded memory) and the client stream terminates at once.
@@ -1242,8 +1256,6 @@ interface DelegateOptions {
1242
1256
  agents?: Record<string, AgentDefinition$1>;
1243
1257
  /** Per-run SDK budget tracker (inner tool-loop cap). */
1244
1258
  budgetTracker?: BudgetTracker;
1245
- /** Per-run conversation store (cross-round history). */
1246
- conversationStorage?: ConversationStorageAdapter;
1247
1259
  /** Per-run pre-built SDK tools forwarded raw (V4-Q). */
1248
1260
  sdkTools?: readonly CustomTool[];
1249
1261
  /** Per-round transient retry (V4-P). */
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-CAY5JP9z.js';
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-CE3ie8rG.js';
2
2
  import '@theokit/http';
3
3
  import './types-DVA4LQsA.js';
4
4
  import '@theokit/sdk';
package/dist/bridge.js CHANGED
@@ -46,7 +46,7 @@ import {
46
46
  translateToUIMessageStream,
47
47
  validateUniqueRoutes,
48
48
  walkAgentMetadata
49
- } from "./chunk-MX5JVERM.js";
49
+ } from "./chunk-OFPS2N3U.js";
50
50
  import "./chunk-NERDIS45.js";
51
51
  import "./chunk-7QVYU63E.js";
52
52
  export {
@@ -820,12 +820,15 @@ function assembleM8CreateOptions(compiled) {
820
820
  const base = compiled.systemPrompt;
821
821
  if (compiled.skills) {
822
822
  options.skills = compiled.skills;
823
+ applied.push("skills");
824
+ }
825
+ const settingSources = resolveSettingSources(compiled);
826
+ if (settingSources) {
823
827
  options.local = {
824
- settingSources: [
825
- "project"
826
- ]
828
+ ...options.local,
829
+ settingSources
827
830
  };
828
- applied.push("skills");
831
+ applied.push("settingSources");
829
832
  }
830
833
  if (compiled.context) {
831
834
  options.context = compiled.context;
@@ -847,6 +850,17 @@ function assembleM8CreateOptions(compiled) {
847
850
  };
848
851
  }
849
852
  __name(assembleM8CreateOptions, "assembleM8CreateOptions");
853
+ function resolveSettingSources(compiled) {
854
+ const explicit = compiled.settingSources;
855
+ if (explicit && explicit.length > 0) return [
856
+ ...explicit
857
+ ];
858
+ if (compiled.skills) return [
859
+ "project"
860
+ ];
861
+ return void 0;
862
+ }
863
+ __name(resolveSettingSources, "resolveSettingSources");
850
864
  function realUsageDone(result, t0) {
851
865
  const u = result.usage;
852
866
  const inputTokens = u?.inputTokens ?? 0;
@@ -994,14 +1008,14 @@ __name(buildExtraCreateOptions, "buildExtraCreateOptions");
994
1008
  async function loadSdkRuntime() {
995
1009
  try {
996
1010
  const sdk = await import("@theokit/sdk");
997
- const InMemory = sdk.InMemoryConversationStorage;
1011
+ const skillReadTool = "SkillReadTool" in sdk ? sdk.SkillReadTool : void 0;
998
1012
  return {
999
1013
  Agent: sdk.Agent,
1000
- defineTool: sdk.defineTool,
1001
- InMemoryConversationStorage: InMemory,
1002
- FileSystemConversationStorage: "FileSystemConversationStorage" in sdk ? sdk.FileSystemConversationStorage : InMemory,
1003
- ..."defineSkillReadTool" in sdk ? {
1004
- defineSkillReadTool: sdk.defineSkillReadTool
1014
+ // `.bind` keeps the static factory callable when detached from `sdk.Tool` (it takes no `this`,
1015
+ // but binding is explicit + satisfies unbound-method rather than relying on that).
1016
+ defineTool: sdk.Tool.create.bind(sdk.Tool),
1017
+ ...skillReadTool ? {
1018
+ defineSkillReadTool: /* @__PURE__ */ __name((skills) => skillReadTool.create(skills), "defineSkillReadTool")
1005
1019
  } : {}
1006
1020
  };
1007
1021
  } catch (err) {
@@ -1010,10 +1024,6 @@ async function loadSdkRuntime() {
1010
1024
  }
1011
1025
  }
1012
1026
  __name(loadSdkRuntime, "loadSdkRuntime");
1013
- function newConversationStorage(compiled, InMemory, FileSystem) {
1014
- return compiled.checkpoint?.storage === "filesystem" ? new FileSystem() : new InMemory();
1015
- }
1016
- __name(newConversationStorage, "newConversationStorage");
1017
1027
  function createAsyncQueue() {
1018
1028
  const items = [];
1019
1029
  let wake = null;
@@ -1149,7 +1159,7 @@ function hasZodInputSchema(schema) {
1149
1159
  __name(hasZodInputSchema, "hasZodInputSchema");
1150
1160
  function withRunContext(handler, runContext) {
1151
1161
  return (input, ctx) => handler(input, {
1152
- signal: ctx?.signal,
1162
+ ...ctx,
1153
1163
  context: runContext
1154
1164
  });
1155
1165
  }
@@ -1183,7 +1193,6 @@ function createSdkAgentStream(compiled, compiledTools, apiKey, overrides = {}) {
1183
1193
  const reasoningEffort = overrides.reasoningEffort ?? compiled.reasoningEffort;
1184
1194
  const { parseThinkTags, stripToolDialect } = resolveTextTransformFlags(compiled, overrides);
1185
1195
  const runContext = overrides.runContext ?? compiled.runContext;
1186
- let storage = overrides.conversationStorage ?? compiled.conversationStorage;
1187
1196
  return (message, sessionId, factoryOpts) => ({
1188
1197
  async *[Symbol.asyncIterator]() {
1189
1198
  const runId = `run-${Date.now()}`;
@@ -1198,7 +1207,6 @@ function createSdkAgentStream(compiled, compiledTools, apiKey, overrides = {}) {
1198
1207
  };
1199
1208
  return;
1200
1209
  }
1201
- const { InMemoryConversationStorage, FileSystemConversationStorage } = rt;
1202
1210
  const sdkTools = buildSdkTools(compiledTools, rt.defineTool, overrides.sdkTools, runContext);
1203
1211
  const inlineSkills = compiled.skills?.inline;
1204
1212
  if (inlineSkills !== void 0 && inlineSkills.length > 0 && rt.defineSkillReadTool !== void 0 && !compiledTools.some((t) => t.name === "skill_read")) {
@@ -1216,9 +1224,8 @@ function createSdkAgentStream(compiled, compiledTools, apiKey, overrides = {}) {
1216
1224
  source: runContextSource,
1217
1225
  keys: runContext !== void 0 ? Object.keys(runContext) : []
1218
1226
  });
1219
- storage ??= newConversationStorage(compiled, InMemoryConversationStorage, FileSystemConversationStorage);
1220
1227
  try {
1221
- yield* streamSdkAgent(rt, compiled, sdkTools, storage, {
1228
+ yield* streamSdkAgent(rt, compiled, sdkTools, {
1222
1229
  apiKey,
1223
1230
  model,
1224
1231
  reasoningEffort,
@@ -1243,7 +1250,7 @@ function createSdkAgentStream(compiled, compiledTools, apiKey, overrides = {}) {
1243
1250
  });
1244
1251
  }
1245
1252
  __name(createSdkAgentStream, "createSdkAgentStream");
1246
- async function* streamSdkAgent(rt, compiled, sdkTools, storage, opts) {
1253
+ async function* streamSdkAgent(rt, compiled, sdkTools, opts) {
1247
1254
  const { Agent } = rt;
1248
1255
  const { apiKey, model, reasoningEffort, overrides, parseThinkTags, stripToolDialect, sessionId, message, factoryOpts, runId, t0 } = opts;
1249
1256
  const { options: m8, applied } = assembleM8CreateOptions(compiled);
@@ -1251,6 +1258,10 @@ async function* streamSdkAgent(rt, compiled, sdkTools, storage, opts) {
1251
1258
  ...m8.local,
1252
1259
  cwd: overrides.cwd
1253
1260
  };
1261
+ if (overrides.baseDir !== void 0) m8.local = {
1262
+ ...m8.local,
1263
+ baseDir: overrides.baseDir
1264
+ };
1254
1265
  const extra = buildExtraCreateOptions(overrides, compiled);
1255
1266
  if (applied.length > 0) {
1256
1267
  debugLog("[THEO_AGENT_M8_RUNTIME_APPLIED]", {
@@ -1264,8 +1275,7 @@ async function* streamSdkAgent(rt, compiled, sdkTools, storage, opts) {
1264
1275
  model: buildModelSelection(model, reasoningEffort),
1265
1276
  tools: sdkTools,
1266
1277
  ...m8,
1267
- ...extra,
1268
- conversationStorage: storage
1278
+ ...extra
1269
1279
  });
1270
1280
  try {
1271
1281
  const queue = createAsyncQueue();
@@ -1499,10 +1509,10 @@ function compileAgentDefinition(def) {
1499
1509
  } : {},
1500
1510
  // M13 — skills: a static list → SDK skills.enabled; a resolver → carried for the request path.
1501
1511
  ...compileSkillsSelection(def.skills),
1502
- // Conversation memory: the declared adapter flows to the run path, which hands it to
1503
- // `Agent.getOrCreate({ conversationStorage })`; absent ⇒ the SDK default is chosen lazily.
1504
- ...def.conversationStorage !== void 0 ? {
1505
- conversationStorage: def.conversationStorage
1512
+ // theokit-file-based-config the declared `.theokit/` sources flow to the run path, which
1513
+ // projects them into `Agent.create({ local.settingSources })`; absent ⇒ inline config only.
1514
+ ...def.settingSources !== void 0 ? {
1515
+ settingSources: def.settingSources
1506
1516
  } : {}
1507
1517
  };
1508
1518
  }
@@ -1604,10 +1614,10 @@ function makeBuilder(config) {
1604
1614
  ...config,
1605
1615
  skills: selection
1606
1616
  }), "skills"),
1607
- conversationStorage: /* @__PURE__ */ __name((adapter) => makeBuilder({
1617
+ settingSources: /* @__PURE__ */ __name((sources) => makeBuilder({
1608
1618
  ...config,
1609
- conversationStorage: adapter
1610
- }), "conversationStorage"),
1619
+ settingSources: sources
1620
+ }), "settingSources"),
1611
1621
  use: /* @__PURE__ */ __name((preset) => preset(runtime), "use"),
1612
1622
  build: /* @__PURE__ */ __name(() => defineAgent(config), "build")
1613
1623
  };
@@ -1759,7 +1769,8 @@ __name(appendCheckpointSaved, "appendCheckpointSaved");
1759
1769
  function streamAgentUIMessages(compiled, apiKey, input) {
1760
1770
  const textId = crypto.randomUUID();
1761
1771
  const overrides = {};
1762
- if (input.conversationStorage) overrides.conversationStorage = input.conversationStorage;
1772
+ if (input.cwd !== void 0) overrides.cwd = input.cwd;
1773
+ if (input.baseDir !== void 0) overrides.baseDir = input.baseDir;
1763
1774
  let source;
1764
1775
  if (!input.hitl || input.hitl.gated.size === 0) {
1765
1776
  const events2 = createSdkAgentStream(compiled, compiled.tools, apiKey, overrides)(input.message, input.sessionId);
@@ -2258,8 +2269,8 @@ async function startRound(factory, prompt, sessionId, signal, retry) {
2258
2269
  }
2259
2270
  }, "open");
2260
2271
  if (!retry) return open();
2261
- const { withRetry } = await import("@theokit/sdk/retry");
2262
- return withRetry(open, {
2272
+ const { Retry } = await import("@theokit/sdk/retry");
2273
+ return Retry.create(open, {
2263
2274
  ...retry,
2264
2275
  signal: retry.signal ?? signal
2265
2276
  });
@@ -2444,11 +2455,11 @@ var AgentRunner = class {
2444
2455
  stripToolDialect: opts.stripToolDialect,
2445
2456
  recoverLeakedToolCalls: opts.recoverLeakedToolCalls,
2446
2457
  cwd: opts.cwd,
2458
+ baseDir: opts.baseDir,
2447
2459
  plugins: opts.plugins,
2448
2460
  providers: opts.providers,
2449
2461
  agents: opts.agents,
2450
2462
  budgetTracker: opts.budgetTracker,
2451
- conversationStorage: opts.conversationStorage,
2452
2463
  sdkTools: opts.sdkTools
2453
2464
  });
2454
2465
  const sessionId = opts.sessionId ?? `runner-${crypto.randomUUID()}`;
@@ -2566,7 +2577,6 @@ async function delegate(SubAgentClass, message, opts = {}) {
2566
2577
  providers: opts.providers,
2567
2578
  agents: opts.agents,
2568
2579
  budgetTracker: opts.budgetTracker,
2569
- conversationStorage: opts.conversationStorage,
2570
2580
  sdkTools: opts.sdkTools
2571
2581
  });
2572
2582
  const sessionId = opts.sessionId ?? `sub-${crypto.randomUUID()}`;
@@ -2983,4 +2993,4 @@ export {
2983
2993
  generateAgentManifest,
2984
2994
  agentsPlugin
2985
2995
  };
2986
- //# sourceMappingURL=chunk-MX5JVERM.js.map
2996
+ //# sourceMappingURL=chunk-OFPS2N3U.js.map