@theokit/agents 0.44.4 → 0.44.6

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, SettingSource, SkillsSettings, ContextSettings, CustomTool, PluginsSettings, Plugin, ProviderRoutingSettings, AgentDefinition as AgentDefinition$1, BudgetTracker, ModelSelection } from '@theokit/sdk';
3
+ import { InlineSkill, SystemPromptResolver, SettingSource, MemorySettings, SkillsSettings, ContextSettings, CustomTool, PluginsSettings, Plugin, ProviderRoutingSettings, AgentDefinition as AgentDefinition$1, BudgetTracker, ModelSelection } from '@theokit/sdk';
4
4
  import { z } from 'zod';
5
5
  import { UIMessageChunk } from 'ai';
6
6
  import { RetryOptions } from '@theokit/sdk/retry';
@@ -200,7 +200,7 @@ interface CompiledAgentOptions {
200
200
  plugins?: readonly unknown[];
201
201
  tools: CompiledTool[];
202
202
  agents: Record<string, CompiledSubAgent>;
203
- memory?: MemoryOptions;
203
+ memory?: MemoryOptions | MemorySettings;
204
204
  skills?: SkillsSettings;
205
205
  context?: ContextSettings;
206
206
  /**
@@ -587,6 +587,13 @@ interface DefineAgentConfig<TInput extends z.ZodType = z.ZodType> {
587
587
  * + execution (G2 / ADR-0040); theokit only wires this into `Agent.create({ local.settingSources })`.
588
588
  */
589
589
  settingSources?: readonly SettingSource[];
590
+ /**
591
+ * M49 — durable memory (the SDK's `.theokit/memory/` subsystem: `Remember:` capture, MEMORY.md
592
+ * store, auto-injected `<memory>` block, `memory_search`/`memory_get` tools). The shape is the
593
+ * SDK's own `MemorySettings` — the canonical runtime contract. Projected into
594
+ * `Agent.create({ memory })` by `assembleM8CreateOptions`.
595
+ */
596
+ memory?: MemorySettings;
590
597
  /**
591
598
  * Code `Plugin` objects forwarded to `Agent.create({ plugins })` — EXTENSION units (tools,
592
599
  * commands, model providers, memory adapters). For lifecycle interception use {@link hooks}.
@@ -648,9 +655,25 @@ declare function compileAgentDefinition(def: AgentDefinition): CompiledAgentOpti
648
655
  * one object (rather than positional params) so the per-request surface can grow without
649
656
  * a parameter explosion. Each field is Axis-A SWAP — a value the app holds at call time.
650
657
  */
658
+ /**
659
+ * A multimodal image for a send turn — the SDK's `SDKImage` shape, typed locally because `@theokit/sdk`
660
+ * is an optional peer (dynamic import). Either a URL or inline base64 `{ data, mimeType }`.
661
+ */
662
+ type BridgeImage = {
663
+ url: string;
664
+ } | {
665
+ data: string;
666
+ mimeType: string;
667
+ };
651
668
  interface RuntimeOverrides {
652
669
  /** Overrides the model for this call (`?? compiled.model ?? default`). */
653
670
  model?: string;
671
+ /**
672
+ * M35 (multimodal) — images to send alongside the text. When present, the SDK send switches from the
673
+ * plain-string form to the structured `{ text, images }` form (`SDKUserMessage`). Absent ⇒ the
674
+ * string path is byte-unchanged (back-compat).
675
+ */
676
+ images?: readonly BridgeImage[];
654
677
  /**
655
678
  * Per-run extended-thinking effort (`?? compiled.reasoningEffort`). Mapped to the SDK
656
679
  * `ModelSelection.params` so the provider produces reasoning (surfaced as `thinking` StreamEvents).
@@ -940,6 +963,12 @@ interface AgentBuilder<TInput extends z.ZodType | UnsetMarker = UnsetMarker, TMo
940
963
  * shell-executing hooks from `.theokit/hooks.json` — opt-in because `.theokit/` is your own repo.
941
964
  */
942
965
  settingSources(sources: readonly SettingSource[]): AgentBuilder<TInput, TModel, TContext, TTools>;
966
+ /**
967
+ * M49 — enable the SDK's durable memory for this agent (`.theokit/memory/` in the run cwd:
968
+ * `Remember:` capture with secret redaction, auto-injected recall, memory tools). Takes the SDK's
969
+ * `MemorySettings` verbatim — `{ enabled: true }` is the minimal opt-in.
970
+ */
971
+ memory(settings: MemorySettings): AgentBuilder<TInput, TModel, TContext, TTools>;
943
972
  /**
944
973
  * Attach LIFECYCLE HOOKS in code, keyed by `HookName` — the builder-chain seam for intercepting
945
974
  * the agent loop. `pre_tool_call` may VETO a tool by returning `{ block: true, message }` before
@@ -1070,6 +1099,8 @@ interface StreamHitlOptions {
1070
1099
  interface StreamAgentOptions {
1071
1100
  message: string;
1072
1101
  sessionId: string;
1102
+ /** M35 (multimodal) — images to send alongside the text. Absent ⇒ the string send path is unchanged. */
1103
+ images?: RuntimeOverrides['images'];
1073
1104
  /** Enable human-in-the-loop tool approval (M4). Absent ⇒ the M2 non-HITL path, byte-unchanged. */
1074
1105
  hitl?: StreamHitlOptions;
1075
1106
  /**
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 AgentTurnMetadata, p as AgentWalkResult, q as AgentWarningCode, r as AgentsPluginOptions, s as ApiErrorContext, t as ApiErrorDecision, u as ApiErrorPolicy, v as ApprovalRequiredEvent, w as ArtifactChunkEvent, x as ArtifactStartEvent, B as BackgroundDelegation, y as BeforeToolCallContext, z as BudgetExceededError, E as CheckpointSavedEvent, C as CompiledAgentOptions, F as CompiledContextWindow, a as CompiledTool, G as ContextualTool, I as DefineAgentConfig, J as DelegateFn, K as DelegateOptions, M as DelegationError, D as DelegationResult, N as DoneEvent, O as ErrorEvent, P as FileEditEvent, T as InferAgentInput, U as InferAgentToolNames, V as IterationEvent, W as LLMCallContext, _ as McpApprovalSpec, $ as McpRegistryConfig, a0 as McpRequestContext, a1 as McpSelection, a2 as PartialToolCallEvent, a3 as ProcessInputContext, a7 as RunStartedEvent, a8 as ScoreVerdict, a9 as ScoredDelegation, aa as Scorer, ab as SdkAgentHandle, ac as SdkMessage, ad as Segment, ag as StateUpdateEvent, S as StreamEvent, ah as TextDeltaEvent, ai as ThinkingEvent, aj as ToolCallEvent, ak as ToolCallVeto, al as ToolHooks, am as ToolHooksPlugin, an as ToolResultEvent, ao as ToolWalkResult, ap as ToolboxWalkResult, aq as agent, ar as agentsPlugin, as as buildModelSelection, at as compileAgent, au as compileAgentDefinition, av as compileAgentModule, aw as compileContextWindow, ax as compileProjectContext, ay as compileSkills, az as compileTools, aA as contextualTool, aB as createAgentExecutionContext, aC as createApiErrorHandler, aD as createSdkAgentStream, aE as createThinkTagExtractor, aF as createToolHooksPlugin, aG as delegate, aH as delegateBackground, aI as delegateWithScoring, aJ as extractThinkTagStream, aK as generateAgentManifest, aL as generateAgentRoutes, aM as isAgentContext, aN as isAgentDefinition, aO as isApprovalRequired, aP as isDone, aQ as isError, aR as isPartialToolCall, aS as isTextDelta, aT as isToolCall, aU as isToolResult, aX as mcpRegistry, aY as mcpToolApprovals, a_ as projectContextMetadataOnlyKnobs, b2 as resolveMcpServers, b3 as runWithApiErrorHandling, b4 as streamAgentResponse, b5 as streamAgentUIMessages, b6 as toAgentFactory, b7 as translateSdkEvent, b8 as translateToUIMessageStream, b9 as validateUniqueRoutes, ba as walkAgentMetadata } from './bridge-entry-BtFJdaCe.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 AgentTurnMetadata, p as AgentWalkResult, q as AgentWarningCode, r as AgentsPluginOptions, s as ApiErrorContext, t as ApiErrorDecision, u as ApiErrorPolicy, v as ApprovalRequiredEvent, w as ArtifactChunkEvent, x as ArtifactStartEvent, B as BackgroundDelegation, y as BeforeToolCallContext, z as BudgetExceededError, E as CheckpointSavedEvent, C as CompiledAgentOptions, F as CompiledContextWindow, a as CompiledTool, G as ContextualTool, I as DefineAgentConfig, J as DelegateFn, K as DelegateOptions, M as DelegationError, D as DelegationResult, N as DoneEvent, O as ErrorEvent, P as FileEditEvent, T as InferAgentInput, U as InferAgentToolNames, V as IterationEvent, W as LLMCallContext, _ as McpApprovalSpec, $ as McpRegistryConfig, a0 as McpRequestContext, a1 as McpSelection, a2 as PartialToolCallEvent, a3 as ProcessInputContext, a7 as RunStartedEvent, a8 as ScoreVerdict, a9 as ScoredDelegation, aa as Scorer, ab as SdkAgentHandle, ac as SdkMessage, ad as Segment, ag as StateUpdateEvent, S as StreamEvent, ah as TextDeltaEvent, ai as ThinkingEvent, aj as ToolCallEvent, ak as ToolCallVeto, al as ToolHooks, am as ToolHooksPlugin, an as ToolResultEvent, ao as ToolWalkResult, ap as ToolboxWalkResult, aq as agent, ar as agentsPlugin, as as buildModelSelection, at as compileAgent, au as compileAgentDefinition, av as compileAgentModule, aw as compileContextWindow, ax as compileProjectContext, ay as compileSkills, az as compileTools, aA as contextualTool, aB as createAgentExecutionContext, aC as createApiErrorHandler, aD as createSdkAgentStream, aE as createThinkTagExtractor, aF as createToolHooksPlugin, aG as delegate, aH as delegateBackground, aI as delegateWithScoring, aJ as extractThinkTagStream, aK as generateAgentManifest, aL as generateAgentRoutes, aM as isAgentContext, aN as isAgentDefinition, aO as isApprovalRequired, aP as isDone, aQ as isError, aR as isPartialToolCall, aS as isTextDelta, aT as isToolCall, aU as isToolResult, aX as mcpRegistry, aY as mcpToolApprovals, a_ as projectContextMetadataOnlyKnobs, b2 as resolveMcpServers, b3 as runWithApiErrorHandling, b4 as streamAgentResponse, b5 as streamAgentUIMessages, b6 as toAgentFactory, b7 as translateSdkEvent, b8 as translateToUIMessageStream, b9 as validateUniqueRoutes, ba as walkAgentMetadata } from './bridge-entry-D2u56i8T.js';
2
2
  import '@theokit/http';
3
3
  import './types-DVA4LQsA.js';
4
4
  import '@theokit/sdk';
package/dist/bridge.js CHANGED
@@ -47,7 +47,7 @@ import {
47
47
  translateToUIMessageStream,
48
48
  validateUniqueRoutes,
49
49
  walkAgentMetadata
50
- } from "./chunk-TFGN3AJV.js";
50
+ } from "./chunk-K74V6J3S.js";
51
51
  import "./chunk-NERDIS45.js";
52
52
  import "./chunk-7QVYU63E.js";
53
53
  export {
@@ -562,6 +562,10 @@ function compileAgentDefinition(def) {
562
562
  ...def.settingSources !== void 0 ? {
563
563
  settingSources: def.settingSources
564
564
  } : {},
565
+ // M49 — memory flows to the projection layer; `assembleM8CreateOptions` forwards it to Agent.create.
566
+ ...def.memory !== void 0 ? {
567
+ memory: def.memory
568
+ } : {},
565
569
  // Hooks are converted here — the layer EVERY path converges on — rather than on the builder, so
566
570
  // `defineAgent({ hooks })` cannot type-check and silently no-op. A lifecycle hook that is
567
571
  // declared but never registered is a security gate that does not gate.
@@ -980,6 +984,12 @@ function assembleM8CreateOptions(compiled) {
980
984
  options.mcpServers = compiled.mcpServers;
981
985
  applied.push("mcpServers");
982
986
  }
987
+ if (compiled.memory !== void 0) {
988
+ options.memory = "enabled" in compiled.memory ? compiled.memory : {
989
+ enabled: true
990
+ };
991
+ applied.push("memory");
992
+ }
983
993
  return {
984
994
  options,
985
995
  applied
@@ -1425,7 +1435,11 @@ async function* streamSdkAgent(rt, compiled, sdkTools, opts) {
1425
1435
  onDelta
1426
1436
  };
1427
1437
  if (factoryOpts?.disableTools === true) sendOptions.toolChoice = "none";
1428
- const sendPromise = agent2.send(message, sendOptions);
1438
+ const sendInput = overrides.images && overrides.images.length > 0 ? {
1439
+ text: message,
1440
+ images: overrides.images
1441
+ } : message;
1442
+ const sendPromise = agent2.send(sendInput, sendOptions);
1429
1443
  const openStream = /* @__PURE__ */ __name(async () => (await sendPromise).stream(), "openStream");
1430
1444
  const merged = mergeDeltaStream(queue, openStream, runId, state);
1431
1445
  for await (const event of applyTextTransforms(merged, {
@@ -1729,6 +1743,10 @@ function makeBuilder(config) {
1729
1743
  ...config,
1730
1744
  settingSources: sources
1731
1745
  }), "settingSources"),
1746
+ memory: /* @__PURE__ */ __name((settings) => makeBuilder({
1747
+ ...config,
1748
+ memory: settings
1749
+ }), "memory"),
1732
1750
  hooks: /* @__PURE__ */ __name((map) => makeBuilder({
1733
1751
  ...config,
1734
1752
  hooks: map
@@ -1894,6 +1912,7 @@ function streamAgentUIMessages(compiled, apiKey, input) {
1894
1912
  const overrides = {};
1895
1913
  if (input.cwd !== void 0) overrides.cwd = input.cwd;
1896
1914
  if (input.baseDir !== void 0) overrides.baseDir = input.baseDir;
1915
+ if (input.images !== void 0) overrides.images = input.images;
1897
1916
  let source;
1898
1917
  if (!input.hitl || input.hitl.gated.size === 0) {
1899
1918
  const events2 = createSdkAgentStream(compiled, compiled.tools, apiKey, overrides)(input.message, input.sessionId);
@@ -3117,4 +3136,4 @@ export {
3117
3136
  generateAgentManifest,
3118
3137
  agentsPlugin
3119
3138
  };
3120
- //# sourceMappingURL=chunk-TFGN3AJV.js.map
3139
+ //# sourceMappingURL=chunk-K74V6J3S.js.map