@theokit/sdk 1.8.0 → 1.9.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.
Files changed (66) hide show
  1. package/CHANGELOG.md +63 -22
  2. package/bin/init-claude.mjs +49 -15
  3. package/dist/a2a/index.cjs +12592 -12884
  4. package/dist/a2a/index.cjs.map +1 -1
  5. package/dist/a2a/index.js +12592 -12884
  6. package/dist/a2a/index.js.map +1 -1
  7. package/dist/{cron-BnywDYLq.d.cts → cron-Bse1MbaE.d.cts} +52 -2
  8. package/dist/{cron-CtZvJD9J.d.ts → cron-Ci_NUkUj.d.ts} +52 -2
  9. package/dist/cron.cjs +8763 -9062
  10. package/dist/cron.cjs.map +1 -1
  11. package/dist/cron.d.cts +1 -1
  12. package/dist/cron.d.ts +1 -1
  13. package/dist/cron.js +8763 -9062
  14. package/dist/cron.js.map +1 -1
  15. package/dist/eval.cjs +8776 -9075
  16. package/dist/eval.cjs.map +1 -1
  17. package/dist/eval.js +8776 -9075
  18. package/dist/eval.js.map +1 -1
  19. package/dist/index.cjs +11217 -10037
  20. package/dist/index.cjs.map +1 -1
  21. package/dist/index.d.cts +174 -3
  22. package/dist/index.d.ts +174 -3
  23. package/dist/index.js +11217 -10038
  24. package/dist/index.js.map +1 -1
  25. package/dist/internal/runtime/{cloud-config-serializer.d.ts → cloud/cloud-config-serializer.d.ts} +1 -1
  26. package/dist/internal/runtime/{real-cloud-run.d.ts → cloud/real-cloud-run.d.ts} +1 -1
  27. package/dist/internal/runtime/fixtures/fixture-scripts.d.ts +1 -1
  28. package/dist/internal/runtime/fork-agent.d.ts +1 -1
  29. package/dist/internal/runtime/{local-agent-bootstrap.d.ts → local-agent/local-agent-bootstrap.d.ts} +4 -4
  30. package/dist/internal/runtime/{local-agent-dispatch.d.ts → local-agent/local-agent-dispatch.d.ts} +7 -7
  31. package/dist/internal/runtime/{local-agent-memory-hooks.d.ts → local-agent/local-agent-memory-hooks.d.ts} +2 -2
  32. package/dist/internal/runtime/{local-agent-memory-provider.d.ts → local-agent/local-agent-memory-provider.d.ts} +2 -2
  33. package/dist/internal/runtime/{real-local-run.d.ts → local-agent/real-local-run.d.ts} +1 -1
  34. package/dist/internal/runtime/{memory-path-selector.d.ts → memory/memory-path-selector.d.ts} +1 -1
  35. package/dist/internal/runtime/{memory-provider.d.ts → memory/memory-provider.d.ts} +2 -2
  36. package/dist/internal/runtime/{memory-store.d.ts → memory/memory-store.d.ts} +1 -1
  37. package/dist/internal/runtime/skills/subagents-loader.d.ts +1 -0
  38. package/dist/types/agent.d.ts +3 -3
  39. package/dist/types/fork.d.ts +49 -0
  40. package/dist/types/goal-events.d.ts +1 -1
  41. package/package.json +15 -16
  42. /package/dist/internal/{runtime/cloud-agent.d.ts → agent-loop/budget-gate.d.ts} +0 -0
  43. /package/dist/internal/runtime/{budget-tracker.d.ts → budget/budget-tracker.d.ts} +0 -0
  44. /package/dist/internal/runtime/{budget.d.ts → budget/budget.d.ts} +0 -0
  45. /package/dist/internal/runtime/{cloud-run.d.ts → cloud/cloud-agent.d.ts} +0 -0
  46. /package/dist/internal/runtime/{cloud-payload-types.d.ts → cloud/cloud-payload-types.d.ts} +0 -0
  47. /package/dist/internal/runtime/{cloud-tool-parity.d.ts → cloud/cloud-run.d.ts} +0 -0
  48. /package/dist/internal/runtime/{local-agent-memory.d.ts → cloud/cloud-tool-parity.d.ts} +0 -0
  49. /package/dist/internal/runtime/{hooks-executor.d.ts → hooks/hooks-executor.d.ts} +0 -0
  50. /package/dist/internal/runtime/{hooks-frontmatter.d.ts → hooks/hooks-frontmatter.d.ts} +0 -0
  51. /package/dist/internal/runtime/{hooks-source.d.ts → hooks/hooks-source.d.ts} +0 -0
  52. /package/dist/internal/runtime/{local-agent-invalidate.d.ts → local-agent/local-agent-invalidate.d.ts} +0 -0
  53. /package/dist/internal/runtime/{local-agent-memory-direct.d.ts → local-agent/local-agent-memory-direct.d.ts} +0 -0
  54. /package/dist/internal/runtime/{local-agent-send.d.ts → local-agent/local-agent-memory.d.ts} +0 -0
  55. /package/dist/internal/runtime/{local-agent-personality-extensions.d.ts → local-agent/local-agent-personality-extensions.d.ts} +0 -0
  56. /package/dist/internal/runtime/{local-agent-plugins.d.ts → local-agent/local-agent-plugins.d.ts} +0 -0
  57. /package/dist/internal/runtime/{local-agent-runtime-extensions.d.ts → local-agent/local-agent-runtime-extensions.d.ts} +0 -0
  58. /package/dist/internal/runtime/{local-agent.d.ts → local-agent/local-agent-send.d.ts} +0 -0
  59. /package/dist/internal/runtime/{local-agent-task-wrap.d.ts → local-agent/local-agent-task-wrap.d.ts} +0 -0
  60. /package/dist/internal/runtime/{local-run.d.ts → local-agent/local-agent.d.ts} +0 -0
  61. /package/dist/internal/runtime/{skills-manager.d.ts → local-agent/local-run.d.ts} +0 -0
  62. /package/dist/internal/runtime/{agent-session-store.d.ts → session/agent-session-store.d.ts} +0 -0
  63. /package/dist/internal/runtime/{agent-session.d.ts → session/agent-session.d.ts} +0 -0
  64. /package/dist/internal/runtime/{session-types.d.ts → session/session-types.d.ts} +0 -0
  65. /package/dist/internal/runtime/{skill-frontmatter.d.ts → skills/skill-frontmatter.d.ts} +0 -0
  66. /package/dist/internal/runtime/{subagents-loader.d.ts → skills/skills-manager.d.ts} +0 -0
@@ -1,3 +1,3 @@
1
- import type { AgentOptions } from "../../types/agent.js";
1
+ import type { AgentOptions } from "../../../types/agent.js";
2
2
  import type { CloudAgentPayload } from "./cloud-payload-types.js";
3
3
  export declare function serializeCloudAgentConfig(options: AgentOptions): CloudAgentPayload;
@@ -1,2 +1,2 @@
1
- import type { Run } from "../../types/run.js";
1
+ import type { Run } from "../../../types/run.js";
2
2
  export declare function createRealCloudRun(options: CreateRealCloudRunOptions): Run;
@@ -1,5 +1,5 @@
1
1
  import type { FixtureRequest, FixtureScript } from "./fixture-types.js";
2
- export { extractMemoryFact, isMemoryWritePrompt } from "../memory-store.js";
2
+ export { extractMemoryFact, isMemoryWritePrompt } from "../memory/memory-store.js";
3
3
  export declare function isMemoryRecallPrompt(message: string, request: FixtureRequest): boolean;
4
4
  export declare function memoryWriteScript(request: FixtureRequest): FixtureScript;
5
5
  export declare function memoryRecallScript(request: FixtureRequest): FixtureScript;
@@ -12,4 +12,4 @@
12
12
  *
13
13
  * @internal
14
14
  */
15
- export {};
15
+ export type { ForkOptions, ForkResult } from "../../types/fork.js";
@@ -7,10 +7,10 @@
7
7
  *
8
8
  * @internal
9
9
  */
10
- import { FileContextManager } from "./context/context-manager.js";
11
- import { type PluginMetadata, PluginsManager } from "./plugins/plugins-manager.js";
12
- import { ProvidersManagerImpl } from "./providers-manager.js";
13
- import { type SkillMetadata, SkillsManager } from "./skills-manager.js";
10
+ import { FileContextManager } from "../context/context-manager.js";
11
+ import { type PluginMetadata, PluginsManager } from "../plugins/plugins-manager.js";
12
+ import { ProvidersManagerImpl } from "../providers-manager.js";
13
+ import { type SkillMetadata, SkillsManager } from "../skills/skills-manager.js";
14
14
  export declare function registerLocalAgent(args: {
15
15
  agentId: string;
16
16
  model: ModelSelection | undefined;
@@ -4,13 +4,13 @@
4
4
  *
5
5
  * @internal
6
6
  */
7
- import type { AgentDefinition, AgentOptions, ModelSelection } from "../../types/agent.js";
8
- import type { Run, SDKUserMessage, SendOptions } from "../../types/run.js";
9
- import type { MemoryToolSpec } from "../agent-loop/loop-types.js";
10
- import type { PersonalityPreset } from "../personality/types.js";
11
- import type { PluginManager } from "../plugins/manager.js";
12
- import type { HooksExecutor } from "./hooks-executor.js";
13
- import type { MemoryFact } from "./memory-store.js";
7
+ import type { AgentDefinition, AgentOptions, ModelSelection } from "../../../types/agent.js";
8
+ import type { Run, SDKUserMessage, SendOptions } from "../../../types/run.js";
9
+ import type { MemoryToolSpec } from "../../agent-loop/loop-types.js";
10
+ import type { PersonalityPreset } from "../../personality/types.js";
11
+ import type { PluginManager } from "../../plugins/manager.js";
12
+ import type { HooksExecutor } from "../hooks/hooks-executor.js";
13
+ import type { MemoryFact } from "../memory/memory-store.js";
14
14
  import { createRealLocalRun } from "./real-local-run.js";
15
15
  export interface DispatchInputs {
16
16
  agentId: string;
@@ -10,8 +10,8 @@
10
10
  *
11
11
  * @internal
12
12
  */
13
- import type { Run, SDKUserMessage, SendOptions } from "../../types/run.js";
14
- import type { PluginManager } from "../plugins/manager.js";
13
+ import type { Run, SDKUserMessage, SendOptions } from "../../../types/run.js";
14
+ import type { PluginManager } from "../../plugins/manager.js";
15
15
  /**
16
16
  * EC-A + EC-G + EC-H: fire `pre_user_send` hooks, cap recalled context,
17
17
  * and prepend it as a `<memory-context>` fence around the original
@@ -25,8 +25,8 @@
25
25
  * @internal — sdk-core's bridging glue. Replaced by sdk-memory rich impl
26
26
  * in Stage 3.
27
27
  */
28
- import type { TelemetryHandle } from "../telemetry/tracer.js";
29
- import type { MemoryProvider } from "./memory-provider.js";
28
+ import type { TelemetryHandle } from "../../telemetry/tracer.js";
29
+ import type { MemoryProvider } from "../memory/memory-provider.js";
30
30
  /**
31
31
  * Options for `createLocalAgentMemoryProvider`. Mirrors what
32
32
  * `LocalAgentMemory`'s constructor needs.
@@ -1,2 +1,2 @@
1
- import type { Run } from "../../types/run.js";
1
+ import type { Run } from "../../../types/run.js";
2
2
  export declare function createRealLocalRun(options: CreateRealLocalRunOptions): Run;
@@ -19,7 +19,7 @@
19
19
  *
20
20
  * @internal
21
21
  */
22
- import type { MemoryToolSpec } from "../agent-loop/loop-types.js";
22
+ import type { MemoryToolSpec } from "../../agent-loop/loop-types.js";
23
23
  import type { MemoryProvider } from "./memory-provider.js";
24
24
  /** Env var name — internal, not in public docs yet. */
25
25
  export declare const PORT_MEMORY_PATH_ENV_VAR = "THEOKIT_PORT_MEMORY_PATH";
@@ -28,8 +28,8 @@
28
28
  *
29
29
  * @public — surface-level interface; impls are internal-but-replaceable.
30
30
  */
31
- import type { CustomTool, SDKAgent } from "../../types/agent.js";
32
- import type { MemoryAdapter, MemoryFact } from "../../types/memory-adapter.js";
31
+ import type { CustomTool, SDKAgent } from "../../../types/agent.js";
32
+ import type { MemoryAdapter, MemoryFact } from "../../../types/memory-adapter.js";
33
33
  /** Result of `MemoryProvider.runActivePass(...)` — what the kernel injects into the LLM call. */
34
34
  export interface ActiveMemoryPassResult {
35
35
  /** Compressed memory facts to seed the LLM's context window for this turn. */
@@ -1,4 +1,4 @@
1
- import { type MemoryConfig, type MemoryFact, redactSecrets } from "../memory/types.js";
1
+ import { type MemoryConfig, type MemoryFact, redactSecrets } from "../../memory/types.js";
2
2
  export { redactSecrets };
3
3
  export declare function readMemoryFacts(cwd: string, config: MemoryConfig): Promise<MemoryFact[]>;
4
4
  export declare function appendMemoryFact(cwd: string, config: MemoryConfig, fact: MemoryFact): Promise<void>;
@@ -0,0 +1 @@
1
+ export {};
@@ -478,7 +478,7 @@ export interface AgentOptions {
478
478
  *
479
479
  * @public
480
480
  */
481
- budgetTracker?: import("../internal/runtime/budget-tracker.js").BudgetTracker;
481
+ budgetTracker?: import("../internal/runtime/budget/budget-tracker.js").BudgetTracker;
482
482
  /**
483
483
  * Pluggable memory subsystem (SDK 2.0 Phase 1 / T1.3 — Hexagonal
484
484
  * Architecture interface inversion). When provided, the agent loop
@@ -502,7 +502,7 @@ export interface AgentOptions {
502
502
  *
503
503
  * @public
504
504
  */
505
- memoryProvider?: import("../internal/runtime/memory-provider.js").MemoryProvider;
505
+ memoryProvider?: import("../internal/runtime/memory/memory-provider.js").MemoryProvider;
506
506
  }
507
507
  /**
508
508
  * Artifact produced inside an agent's workspace. Cloud-only.
@@ -607,7 +607,7 @@ export interface SDKAgent {
607
607
  *
608
608
  * @public
609
609
  */
610
- fork?(options: import("../internal/runtime/fork-agent.js").ForkOptions): Promise<import("../internal/runtime/fork-agent.js").ForkResult>;
610
+ fork?(options: import("./fork.js").ForkOptions): Promise<import("./fork.js").ForkResult>;
611
611
  /**
612
612
  * Direct API to third-party memory adapter(s) registered via
613
613
  * `plugins: [...]` (ADR D141 / D142). Returns `null` when no adapter
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Fork primitive public type contracts (T1.2, ADRs D110-D114).
3
+ *
4
+ * Extracted into a leaf type module (arch-review ADR 0001) so the public
5
+ * `types/agent.ts` barrel can reference `ForkOptions`/`ForkResult` without
6
+ * importing the `internal/runtime/fork-agent.ts` implementation — which in
7
+ * turn imports back from `types/agent.ts`. That mutual reference created a
8
+ * type-only `madge` cycle. These interfaces are self-contained (no SDKAgent
9
+ * / AgentOptions references), so co-locating them here breaks the cycle with
10
+ * no runtime change. `fork-agent.ts` re-exports them for back-compat.
11
+ */
12
+ /**
13
+ * Caller-supplied fork configuration. See `forkAgentImpl`.
14
+ *
15
+ * @public
16
+ */
17
+ export interface ForkOptions {
18
+ /**
19
+ * Tool subset visible to the fork. Names must match the canonical (post-repair)
20
+ * tool name — typically lowercase. Tools not in this set return a `tool_result`
21
+ * with `"Tool blocked by fork whitelist"` content (EC-H).
22
+ */
23
+ allowedTools: Set<string>;
24
+ /** Task prompt sent to the fork. */
25
+ prompt: string;
26
+ /** Override system prompt. Default: byte-identical inheritance from parent (D112). */
27
+ systemPrompt?: string;
28
+ /** Memory write provenance tag (D114). Default `"fork"`. */
29
+ forkOrigin?: string;
30
+ }
31
+ /**
32
+ * Outcome of a fork run.
33
+ *
34
+ * @public
35
+ */
36
+ export interface ForkResult {
37
+ /** Final agent response text (`undefined` when the fork produced no result). */
38
+ result: string | undefined;
39
+ /** Tool calls executed inside the fork. */
40
+ toolCalls: ReadonlyArray<{
41
+ name: string;
42
+ input: Record<string, unknown>;
43
+ }>;
44
+ /** Aggregate token usage reported by the run. */
45
+ usage: {
46
+ inputTokens: number;
47
+ outputTokens: number;
48
+ };
49
+ }
@@ -64,7 +64,7 @@ export interface GoalResult {
64
64
  finalResponse: string | undefined;
65
65
  }
66
66
  /**
67
- * Return type of {@link import("../internal/runtime/local-agent.js").LocalAgent.runUntil}.
67
+ * Return type of {@link import("../internal/runtime/local-agent/local-agent.js").LocalAgent.runUntil}.
68
68
  * Extracted so the LocalAgent method signature stays a single line (G8 LoC budget).
69
69
  *
70
70
  * @public
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theokit/sdk",
3
- "version": "1.8.0",
3
+ "version": "1.9.0",
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/usetheo/theokit-sdk#readme",
@@ -214,15 +214,6 @@
214
214
  "theokit-migrate-memory": "./bin/theokit-migrate-memory.mjs"
215
215
  },
216
216
  "sideEffects": false,
217
- "scripts": {
218
- "build": "tsup && cp src/internal/providers/provider-catalog.json dist/provider-catalog.json",
219
- "test": "vitest run --no-file-parallelism",
220
- "test:watch": "vitest",
221
- "typecheck": "tsc --noEmit",
222
- "clean": "rm -rf dist",
223
- "docs:json": "typedoc --options typedoc.json",
224
- "docs:drift": "tsx scripts/check-docs-drift.ts"
225
- },
226
217
  "peerDependencies": {
227
218
  "@lancedb/lancedb": "^0.30.0",
228
219
  "@types/ws": ">=8.0.0",
@@ -256,8 +247,7 @@
256
247
  }
257
248
  },
258
249
  "publishConfig": {
259
- "access": "public",
260
- "provenance": true
250
+ "access": "public"
261
251
  },
262
252
  "keywords": [
263
253
  "agent",
@@ -280,8 +270,6 @@
280
270
  "devDependencies": {
281
271
  "@opentelemetry/api": "^1.9.1",
282
272
  "@opentelemetry/sdk-trace-base": "^1.30.1",
283
- "@theokit/sdk-handoff": "workspace:*",
284
- "@theokit/sdk-memory": "workspace:*",
285
273
  "@types/better-sqlite3": "^7.6.13",
286
274
  "@types/proper-lockfile": "^4.1.4",
287
275
  "@types/ws": "^8.18.0",
@@ -291,6 +279,17 @@
291
279
  "sqlite-vec": "^0.1.9",
292
280
  "typedoc": "^0.28.19",
293
281
  "ws": "^8.18.0",
294
- "zod": "^4.0.0"
282
+ "zod": "^4.0.0",
283
+ "@theokit/sdk-handoff": "0.1.0",
284
+ "@theokit/sdk-memory": "0.1.0"
285
+ },
286
+ "scripts": {
287
+ "build": "tsup && cp src/internal/providers/provider-catalog.json dist/provider-catalog.json",
288
+ "test": "vitest run --no-file-parallelism",
289
+ "test:watch": "vitest",
290
+ "typecheck": "tsc --noEmit",
291
+ "clean": "rm -rf dist",
292
+ "docs:json": "typedoc --options typedoc.json",
293
+ "docs:drift": "tsx scripts/check-docs-drift.ts"
295
294
  }
296
- }
295
+ }