@theokit/sdk 5.3.0 → 5.3.2

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.
Files changed (46) hide show
  1. package/CHANGELOG.md +103 -0
  2. package/dist/{agent-CvmTR9uf.d.ts → agent-CTbU0O1R.d.ts} +20 -1
  3. package/dist/{agent-GACKKINM.cjs → agent-KJLAWKZB.cjs} +5 -5
  4. package/dist/{agent-GACKKINM.cjs.map → agent-KJLAWKZB.cjs.map} +1 -1
  5. package/dist/{agent-VUNM33WJ.js → agent-PNYJ5S2Y.js} +4 -4
  6. package/dist/{agent-VUNM33WJ.js.map → agent-PNYJ5S2Y.js.map} +1 -1
  7. package/dist/{agent-C3KO5LKm.d.cts → agent-QLwxhXY3.d.cts} +20 -1
  8. package/dist/agent.d.ts +20 -2
  9. package/dist/{chunk-43H4EBS2.js → chunk-363RBGIR.js} +37 -9
  10. package/dist/chunk-363RBGIR.js.map +1 -0
  11. package/dist/{chunk-SSIRPWWD.cjs → chunk-65UMH5V3.cjs} +9 -7
  12. package/dist/chunk-65UMH5V3.cjs.map +1 -0
  13. package/dist/{chunk-AI4MXACC.js → chunk-7L3MIW2F.js} +9 -7
  14. package/dist/chunk-7L3MIW2F.js.map +1 -0
  15. package/dist/{chunk-PEAOQMWE.cjs → chunk-L4XENLQO.cjs} +4 -4
  16. package/dist/{chunk-PEAOQMWE.cjs.map → chunk-L4XENLQO.cjs.map} +1 -1
  17. package/dist/{chunk-DEJCKB65.cjs → chunk-Y46VI73J.cjs} +54 -26
  18. package/dist/chunk-Y46VI73J.cjs.map +1 -0
  19. package/dist/{chunk-WHTMFN4Q.js → chunk-ZITYGJOD.js} +3 -3
  20. package/dist/{chunk-WHTMFN4Q.js.map → chunk-ZITYGJOD.js.map} +1 -1
  21. package/dist/{context-XNREEC7M.js → context-BUIE52VH.js} +3 -3
  22. package/dist/{context-XNREEC7M.js.map → context-BUIE52VH.js.map} +1 -1
  23. package/dist/{context-3YMZDEX5.cjs → context-FCCJQ3FN.cjs} +6 -6
  24. package/dist/{context-3YMZDEX5.cjs.map → context-FCCJQ3FN.cjs.map} +1 -1
  25. package/dist/{cron-crfMMdAw.d.ts → cron-Cl8FrK3D.d.ts} +1 -1
  26. package/dist/{cron-C3PhZED0.d.cts → cron-Dz8AOpy3.d.cts} +1 -1
  27. package/dist/cron.cjs +4 -4
  28. package/dist/cron.d.cts +2 -2
  29. package/dist/cron.d.ts +2 -2
  30. package/dist/cron.js +3 -3
  31. package/dist/eval.cjs +3 -3
  32. package/dist/eval.js +2 -2
  33. package/dist/index.cjs +19 -19
  34. package/dist/index.d.cts +23 -5
  35. package/dist/index.d.ts +23 -5
  36. package/dist/index.js +5 -5
  37. package/dist/subagents-loader.d.cts +1 -1
  38. package/dist/subagents-loader.d.ts +1 -1
  39. package/dist/types/plugin.d.ts +20 -1
  40. package/docs/error-codes.md +2 -2
  41. package/docs/harness-capability-map.md +1 -1
  42. package/package.json +1 -1
  43. package/dist/chunk-43H4EBS2.js.map +0 -1
  44. package/dist/chunk-AI4MXACC.js.map +0 -1
  45. package/dist/chunk-DEJCKB65.cjs.map +0 -1
  46. package/dist/chunk-SSIRPWWD.cjs.map +0 -1
package/dist/index.d.ts CHANGED
@@ -2,15 +2,15 @@ import { T as TheokitAgentError, E as ErrorMetadata } from './errors-base-B5g01n
2
2
  export { a as ErrorCode } from './errors-base-B5g01neU.js';
3
3
  import { F as RunEvent, j as CostBreakdown, at as TokenUsage, R as RunResult, M as ModelSelection, C as CustomTool, a as McpServerConfig, T as ToolResultContentBlock, b as Run, P as Processor, c as PermissionMode, d as RunEventSink$1, S as SDKMessage } from './run-CTAdRU3U.js';
4
4
  export { A as AgentConversationTurn, e as AssistantMessage, f as CompletionCheck, g as CompletionCheckResult, h as ConversationStep, i as ConversationTurn, j as CostBreakdown, k as CostSource, l as CostStatus, D as DoomLoopThresholds, G as GenerateOptions, m as GenerateRunResult, I as ImageBlock, n as InputProcessorContext, o as InteractionUpdate, p as McpAuthConfig, q as McpHttpServerConfig, r as McpOAuthConfig, s as McpStdioServerConfig, t as MessageOrigin, u as ModelParameterValue, O as OutputProcessorContext, v as PartialToolCallUpdate, w as ProcessorControls, x as ProcessorTripwire, y as ProcessorViolation, z as RunCompactBoundaryEvent, B as RunCompletionCheckEvent, E as RunErrorDetail, F as RunEvent, H as RunGitInfo, J as RunMemoryDegradedEvent, K as RunOperation, L as RunPermissionDeniedEvent, N as RunRateLimitEvent, Q as RunStatus, U as RunTaskCompletedEvent, V as RunTaskStartedEvent, W as RunTaskUpdatedEvent, X as RunTimelineEvent, Y as RunToCompletionOptions, Z as RunToCompletionResult, _ as RunToolProgressEvent, $ as RunTripwireEvent, a0 as SDKAssistantMessage, a1 as SDKImage, a2 as SDKImageDimension, a3 as SDKObjectDelta, a4 as SDKRequestMessage, a5 as SDKStatusMessage, a6 as SDKSystemMessage, a7 as SDKTaskMessage, a8 as SDKThinkingMessage, a9 as SDKToolUseMessage, aa as SDKUserMessage, ab as SDKUserMessageEvent, ac as SendOptions, ad as ShellCommand, ae as ShellConversationTurn, af as ShellOutput, ag as ShellOutputDeltaUpdate, ah as StepCompletedUpdate, ai as StepStartedUpdate, aj as StreamToCompletionResult, ak as SummaryCompletedUpdate, al as SummaryStartedUpdate, am as SummaryUpdate, an as TextBlock, ao as TextDeltaUpdate, ap as ThinkingCompletedUpdate, aq as ThinkingDeltaUpdate, ar as ThinkingMessage, as as TokenDeltaUpdate, at as TokenUsage, au as ToolCall, av as ToolCallCompletedUpdate, aw as ToolCallStartedUpdate, ax as ToolContextMessage, ay as ToolResult, az as ToolResultGuardOptions, aA as ToolUseBlock, aB as TurnEndedUpdate, aC as UserMessage, aD as UserMessageAppendedUpdate } from './run-CTAdRU3U.js';
5
- import { A as AgentOptions, L as LocalOptions, S as SystemPromptResolver, C as CloudOptions, M as MemorySettings, a as AgentDefinition, b as SkillsSettings, c as ListAgentsOptions, d as ListResult, e as SDKAgentInfo, G as GetAgentOptions, f as ListRunsOptions, g as GetRunOptions, h as AgentOperationOptions, i as AgentDescription, P as Plugin$1, j as ProviderProfile, I as InlineSkill, B as BudgetTracker, k as MemoryProvider, l as PreToolCallDecision } from './agent-CvmTR9uf.js';
6
- export { m as ActiveMemoryPassArgs, n as ActiveMemoryPassResult, o as AgentSubagentDescription, p as AgentToolDescription, q as BudgetCheck, r as BudgetTotal, s as BudgetUsageEvent, t as BuiltinToolName, u as CloudEnv, v as CloudRepo, w as CompatSource, x as CompatSourceAdapter, y as CompatSurface, z as CreateSkillSpec, H as HookName, D as MemoryProviderAgentRef, E as MemoryProviderFactory, F as MemoryProviderHandle, J as MemoryProviderInitOptions, K as PluginContext, N as PluginHookDisposer, O as PostAssistantReplyContext, Q as PostToolCallContext, R as PreToolCallContext, T as PreUserSendContext, U as PreUserSendResult, V as ProviderTransform, W as ProviderTransformContext, X as RecordSessionSummaryArgs, Y as SessionLifecycleContext, Z as SessionRecord, _ as SessionStore, $ as SettingSource, a0 as Skill, a1 as SkillsResolver, a2 as SkillsResolverContext, a3 as SystemPromptContext, a4 as SystemPromptMemoryFact, a5 as TelemetrySettings, a6 as ToolCallSummary, a7 as ToolResultTransformContext, a8 as TransformContext } from './agent-CvmTR9uf.js';
5
+ import { A as AgentOptions, L as LocalOptions, S as SystemPromptResolver, C as CloudOptions, M as MemorySettings, a as AgentDefinition, b as SkillsSettings, c as ListAgentsOptions, d as ListResult, e as SDKAgentInfo, G as GetAgentOptions, f as ListRunsOptions, g as GetRunOptions, h as AgentOperationOptions, i as AgentDescription, P as Plugin$1, j as ProviderProfile, I as InlineSkill, B as BudgetTracker, k as MemoryProvider, l as PreToolCallDecision } from './agent-CTbU0O1R.js';
6
+ export { m as ActiveMemoryPassArgs, n as ActiveMemoryPassResult, o as AgentSubagentDescription, p as AgentToolDescription, q as BudgetCheck, r as BudgetTotal, s as BudgetUsageEvent, t as BuiltinToolName, u as CloudEnv, v as CloudRepo, w as CompatSource, x as CompatSourceAdapter, y as CompatSurface, z as CreateSkillSpec, H as HookName, D as MemoryProviderAgentRef, E as MemoryProviderFactory, F as MemoryProviderHandle, J as MemoryProviderInitOptions, K as PluginContext, N as PluginHookDisposer, O as PostAssistantReplyContext, Q as PostToolCallContext, R as PreToolCallContext, T as PreUserSendContext, U as PreUserSendResult, V as ProviderTransform, W as ProviderTransformContext, X as RecordSessionSummaryArgs, Y as SessionLifecycleContext, Z as SessionRecord, _ as SessionStore, $ as SettingSource, a0 as Skill, a1 as SkillsResolver, a2 as SkillsResolverContext, a3 as SystemPromptContext, a4 as SystemPromptMemoryFact, a5 as TelemetrySettings, a6 as ToolCallSummary, a7 as ToolResultTransformContext, a8 as TransformContext } from './agent-CTbU0O1R.js';
7
7
  import * as zod from 'zod';
8
8
  import { ZodType, z } from 'zod';
9
9
  import { S as StructuredOutputError, B as BudgetOptions, a as BudgetHandle, b as BudgetSnapshot } from './errors-CLOAyuiv.js';
10
10
  export { A as AgentDisposedError, c as AgentRunError, d as AgentRunErrorCode, e as AuthenticationError, f as BudgetExceedEvent, g as BudgetExceededError, h as BudgetLimit, i as BudgetMode, j as BudgetScope, k as BudgetThresholdEvent, l as BudgetWindow, C as ConfigurationError, I as IntegrationNotConnectedError, m as InvalidTaskIdError, M as MemoryAdapterError, n as MemoryAdapterErrorCode, N as NetworkError, R as RateLimitError, T as TaskNotFoundError, U as UnknownAgentError, o as UnsupportedBudgetOperationError, p as UnsupportedRunOperationError, q as UnsupportedTaskOperationError, r as isTransientError } from './errors-CLOAyuiv.js';
11
11
  import { P as ProviderRoutingSettings, S as SDKAgent, C as ContextSettings, a as PluginsSettings, J as JudgeResult, G as GoalOptions, b as GoalEvent, c as GoalResult, M as MemoryId, d as SDKProvider } from './sdk-agent-D4a_BR_6.js';
12
12
  export { A as AgentMemory, e as AgentOperation, f as ContextBudget, g as ContextManagerKind, h as ContextSnapshot, i as ContextSource, j as ContextSourceStatus, I as InvalidateCacheOptions, k as MemoryAdapter, l as MemoryAdapterCapabilities, m as MemoryContext, n as MemoryFact, o as MemoryRevision, p as MemoryToolSchema, q as MemoryTurnMessage, r as PersonalityPreset, s as ProviderCapability, t as ProviderRoute, R as ResolvedProviderRoute, u as RunUntilIterator, v as SDKAgentPlugins, w as SDKAgentSkillDetail, x as SDKAgentSkills, y as SDKArtifact, z as SDKContextManager, B as SDKPluginMetadata, D as SDKProvidersManager, E as SystemPromptSkillRef, V as Verdict } from './sdk-agent-D4a_BR_6.js';
13
- export { C as Cron, a as CronCreateOptions, b as CronGetOptions, c as CronJob, d as CronJobStatus, e as CronListOptions, f as CronOperationOptions, g as CronRunOptions, h as CronRuntime, i as CronSchedulerStatus, j as CronStartOptions } from './cron-crfMMdAw.js';
13
+ export { C as Cron, a as CronCreateOptions, b as CronGetOptions, c as CronJob, d as CronJobStatus, e as CronListOptions, f as CronOperationOptions, g as CronRunOptions, h as CronRuntime, i as CronSchedulerStatus, j as CronStartOptions } from './cron-Cl8FrK3D.js';
14
14
  import { StepResult } from './workflow.js';
15
15
  export { Workflow, agentStep, fn } from './workflow.js';
16
16
 
@@ -871,11 +871,29 @@ declare class Agent {
871
871
  */
872
872
  static describe(agentId: string): Promise<AgentDescription>;
873
873
  /**
874
- * Permanently delete a cloud agent.
874
+ * Permanently delete a registered agent — local or cloud.
875
+ *
876
+ * #612 — this HYDRATES before removing, and until it did the method was a no-op against the
877
+ * persisted registry whenever the agent was not already in this process's memory. Which is every
878
+ * agent in a freshly started process: `removeRegisteredAgent` only schedules a save when the entry
879
+ * was in the Map, so `agents.delete()` returned `false`, nothing was scheduled, and
880
+ * `flushRegistrySaves()` flushed an empty queue. The entry survived and this returned normally.
881
+ *
882
+ * Every neighbouring mutator already did this — `rename` and `archive` reach
883
+ * `getRegisteredAgentOrThrow`, which hydrates on a miss. `delete` was the only one that did not.
884
+ *
885
+ * `options.cwd` is read rather than defaulted away: it is declared on `AgentOperationOptions`, and
886
+ * hydrating `process.cwd()` unconditionally is the B-115 defect — an option that compiles and does
887
+ * nothing — on the one path that is supposed to remove data.
888
+ *
889
+ * Deleting an unknown id still resolves rather than throwing, deliberately. `rename` throws
890
+ * `UnknownAgentError` and matching it here is defensible, but it is a breaking change for callers
891
+ * that delete idempotently, and an entry and its transcript can legitimately outlive one another
892
+ * in both directions. That decision belongs to its own change, not to a persistence fix.
875
893
  *
876
894
  * @public
877
895
  */
878
- static delete(agentId: string, _options?: AgentOperationOptions): Promise<void>;
896
+ static delete(agentId: string, options?: AgentOperationOptions): Promise<void>;
879
897
  }
880
898
 
881
899
  /**
package/dist/index.js CHANGED
@@ -8,15 +8,15 @@ import { Workflow, agentStep } from './chunk-HFEJE7AC.js';
8
8
  export { Workflow, agentStep, fn } from './chunk-HFEJE7AC.js';
9
9
  import './chunk-GBCVPKHE.js';
10
10
  import './chunk-HY66GLM6.js';
11
- export { Cron } from './chunk-WHTMFN4Q.js';
12
- import { MEMORY_EMBEDDING_ADAPTERS, resolveSessionDir, DEFAULT_AGENTIC_MODEL_ID, Agent } from './chunk-43H4EBS2.js';
13
- export { Agent, AgentBuilder, Tool, ToolError, UsageAccumulator, computeCost, getPricingEntry } from './chunk-43H4EBS2.js';
11
+ export { Cron } from './chunk-ZITYGJOD.js';
12
+ import { MEMORY_EMBEDDING_ADAPTERS, resolveSessionDir, DEFAULT_AGENTIC_MODEL_ID, Agent } from './chunk-363RBGIR.js';
13
+ export { Agent, AgentBuilder, Tool, ToolError, UsageAccumulator, computeCost, getPricingEntry } from './chunk-363RBGIR.js';
14
14
  import { configure, submit, list, get, cancel, subscribe } from './chunk-K2VMFZQ5.js';
15
15
  export { emitRunEvent } from './chunk-K2VMFZQ5.js';
16
16
  import './chunk-AWINL3ZC.js';
17
17
  import './chunk-K2BQQ445.js';
18
18
  import './chunk-7SZAV6QG.js';
19
- import './chunk-AI4MXACC.js';
19
+ import './chunk-7L3MIW2F.js';
20
20
  import './chunk-2SFBB54R.js';
21
21
  import './chunk-55GB6JYQ.js';
22
22
  import './chunk-H73MEMQB.js';
@@ -1792,7 +1792,7 @@ function isBuiltAgent(m) {
1792
1792
  return typeof m.send === "function";
1793
1793
  }
1794
1794
  async function materialize(def, index) {
1795
- const { Agent: Agent2 } = await import('./agent-VUNM33WJ.js');
1795
+ const { Agent: Agent2 } = await import('./agent-PNYJ5S2Y.js');
1796
1796
  return Agent2.create({
1797
1797
  // `AgentDefinition.model` admits the sentinel `'inherit'`, which is not a model id. Inheriting
1798
1798
  // here means "declare nothing and let the default apply" — forwarding the literal would create
@@ -1,4 +1,4 @@
1
- import { a as AgentDefinition } from './agent-C3KO5LKm.cjs';
1
+ import { a as AgentDefinition } from './agent-QLwxhXY3.cjs';
2
2
  import './sdk-agent-BOiKqOgL.cjs';
3
3
  import './run-CTAdRU3U.cjs';
4
4
  import 'zod';
@@ -1,4 +1,4 @@
1
- import { a as AgentDefinition } from './agent-CvmTR9uf.js';
1
+ import { a as AgentDefinition } from './agent-CTbU0O1R.js';
2
2
  import './sdk-agent-D4a_BR_6.js';
3
3
  import './run-CTAdRU3U.js';
4
4
  import 'zod';
@@ -41,6 +41,8 @@ import type { ProviderProfile } from "./provider-profile.js";
41
41
  * `on_session_end`, `post_assistant_reply`) is fire-and-forget: the return value is DISCARDED. A
42
42
  * policy that needs to change a tool result belongs on `transform_tool_result` — put it on
43
43
  * `post_tool_call` and it quietly degrades to observation.
44
+ * - `on_session_start` / `on_session_end` fire once per **run**, not once per agent lifetime — see
45
+ * {@link SessionLifecycleContext}. Build an agent per turn and they fire on every message.
44
46
  *
45
47
  * Failure is asymmetric too. A fire-and-forget or transform handler that throws is caught, logged to
46
48
  * stderr, and the run continues. A `pre_tool_call` handler that throws is NOT caught by the hook
@@ -120,7 +122,24 @@ export interface LlmCallContext {
120
122
  /** Iteration index (0-based) of the current turn, when available. */
121
123
  iteration?: number;
122
124
  }
123
- /** #65 — context for the `on_session_start` / `on_session_end` hooks. @public */
125
+ /**
126
+ * #65 — context for the `on_session_start` / `on_session_end` hooks.
127
+ *
128
+ * **These fire once per RUN, not once per agent lifetime**, and the `runId` on this very context is
129
+ * the tell: it changes every time they fire. "Session" here means one pass through the agent loop.
130
+ *
131
+ * The distinction is invisible to an application that creates an agent once and sends many messages
132
+ * — there, per-run and per-session coincide. It is decisive for one that builds an agent **per
133
+ * turn**: `on_session_start` then fires on every message, which is the opposite of what a handler
134
+ * named for a session start usually assumes.
135
+ *
136
+ * Stated here because it was not stated anywhere a consumer could read it. The only accurate
137
+ * sentence lived in an internal comment at the firing site, and in 2026-09 that cost two people
138
+ * hours and produced a defect report filed against this package for behaviour that is correct.
139
+ * `test_on_session_start_fires_once_per_run_and_again_on_the_next_run` now pins it.
140
+ *
141
+ * @public
142
+ */
124
143
  export interface SessionLifecycleContext {
125
144
  agentId: string;
126
145
  runId: string;
@@ -79,10 +79,10 @@ Branch on `code`, never on the message: messages carry context (an id, a path, a
79
79
  | `handoff_target_required` | domain | ConfigurationError | `packages/sdk-handoff/src/handoff.ts:111` |
80
80
  | `hitl_timeout` | domain | HitlTimeoutError | `packages/sdk/src/internal/runtime/tools/hitl-middleware.ts:42` +1 |
81
81
  | `hook_denied` | domain | ConfigurationError | `packages/sdk/src/internal/local-agent/local-agent.ts:454` |
82
- | `hooks_invalid_command` | domain | ConfigurationError | `packages/sdk/src/internal/runtime/hooks/hooks-source.ts:272` |
82
+ | `hooks_invalid_command` | domain | ConfigurationError | `packages/sdk/src/internal/runtime/hooks/hooks-source.ts:295` |
83
83
  | `hooks_json_invalid` | domain | ConfigurationError | `packages/sdk/src/internal/runtime/hooks/hooks-source.ts:190` +2 |
84
84
  | `hooks_read_error` | domain | ConfigurationError | `packages/sdk/src/internal/runtime/hooks/hooks-source.ts:181` |
85
- | `hooks_unsupported_type` | domain | ConfigurationError | `packages/sdk/src/internal/runtime/hooks/hooks-source.ts:266` |
85
+ | `hooks_unsupported_type` | domain | ConfigurationError | `packages/sdk/src/internal/runtime/hooks/hooks-source.ts:289` |
86
86
  | `interactive_unavailable` | domain | InteractiveUnavailableError | `packages/sdk/src/interactive/types.ts:28` +1 |
87
87
  | `INTERNAL_SERVER_ERROR` | domain | — | `packages/sdk/src/server/errors-envelope.ts:100` |
88
88
  | `invalid_argument` | domain | TheokitAgentError | `packages/sdk/src/compaction.ts:79` |
@@ -357,7 +357,7 @@ A symbol listed under two specifiers is reachable from both, but that does NOT m
357
357
  | `Security` | class | Public security namespace (T2.1, ADR D68). |
358
358
  | `SecurityFloorInput` | interface | The vocabulary, the layer names, and the values to resolve. |
359
359
  | `SendOptions` | interface | Per-send overrides and callbacks. |
360
- | `SessionLifecycleContext` | interface | #65 — context for the `on_session_start` / `on_session_end` hooks. |
360
+ | `SessionLifecycleContext` | interface | #65 — context for the `on_session_start` / `on_session_end` hooks. |
361
361
  | `SessionMessage` | interface | One turn of a session. |
362
362
  | `SessionMessagePart` | type | One structured element of a {@link SessionMessage } . |
363
363
  | `SessionRecord` | interface | One transcript record — a single line of the session JSONL file, and the unit the pluggable `SessionStore` seam reads and writes. |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theokit/sdk",
3
- "version": "5.3.0",
3
+ "version": "5.3.2",
4
4
  "description": "TypeScript SDK for the Theo agent harness — same surface, local or cloud.",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://github.com/usetheokit/theokit-sdk#readme",