@theokit/sdk 1.8.1 → 2.0.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 (83) hide show
  1. package/CHANGELOG.md +70 -22
  2. package/bin/init-claude.mjs +0 -0
  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 -26
  42. package/dist/rag/index.cjs +0 -136
  43. package/dist/rag/index.cjs.map +0 -1
  44. package/dist/rag/index.d.cts +0 -11
  45. package/dist/rag/index.d.ts +0 -11
  46. package/dist/rag/index.js +0 -129
  47. package/dist/rag/index.js.map +0 -1
  48. package/dist/rag/reranker.d.cts +0 -26
  49. package/dist/rag/reranker.d.ts +0 -26
  50. package/dist/rag/retriever.d.cts +0 -25
  51. package/dist/rag/retriever.d.ts +0 -25
  52. package/dist/rag/text-splitter.d.cts +0 -12
  53. package/dist/rag/text-splitter.d.ts +0 -12
  54. package/dist/rag/types.d.cts +0 -37
  55. package/dist/rag/types.d.ts +0 -37
  56. package/dist/voice/index.d.ts +0 -7
  57. package/dist/voice/openai-realtime.d.ts +0 -21
  58. package/dist/voice/types.d.ts +0 -35
  59. /package/dist/internal/{runtime/cloud-agent.d.ts → agent-loop/budget-gate.d.ts} +0 -0
  60. /package/dist/internal/runtime/{budget-tracker.d.ts → budget/budget-tracker.d.ts} +0 -0
  61. /package/dist/internal/runtime/{budget.d.ts → budget/budget.d.ts} +0 -0
  62. /package/dist/internal/runtime/{cloud-run.d.ts → cloud/cloud-agent.d.ts} +0 -0
  63. /package/dist/internal/runtime/{cloud-payload-types.d.ts → cloud/cloud-payload-types.d.ts} +0 -0
  64. /package/dist/internal/runtime/{cloud-tool-parity.d.ts → cloud/cloud-run.d.ts} +0 -0
  65. /package/dist/internal/runtime/{local-agent-memory.d.ts → cloud/cloud-tool-parity.d.ts} +0 -0
  66. /package/dist/internal/runtime/{hooks-executor.d.ts → hooks/hooks-executor.d.ts} +0 -0
  67. /package/dist/internal/runtime/{hooks-frontmatter.d.ts → hooks/hooks-frontmatter.d.ts} +0 -0
  68. /package/dist/internal/runtime/{hooks-source.d.ts → hooks/hooks-source.d.ts} +0 -0
  69. /package/dist/internal/runtime/{local-agent-invalidate.d.ts → local-agent/local-agent-invalidate.d.ts} +0 -0
  70. /package/dist/internal/runtime/{local-agent-memory-direct.d.ts → local-agent/local-agent-memory-direct.d.ts} +0 -0
  71. /package/dist/internal/runtime/{local-agent-send.d.ts → local-agent/local-agent-memory.d.ts} +0 -0
  72. /package/dist/internal/runtime/{local-agent-personality-extensions.d.ts → local-agent/local-agent-personality-extensions.d.ts} +0 -0
  73. /package/dist/internal/runtime/{local-agent-plugins.d.ts → local-agent/local-agent-plugins.d.ts} +0 -0
  74. /package/dist/internal/runtime/{local-agent-runtime-extensions.d.ts → local-agent/local-agent-runtime-extensions.d.ts} +0 -0
  75. /package/dist/internal/runtime/{local-agent.d.ts → local-agent/local-agent-send.d.ts} +0 -0
  76. /package/dist/internal/runtime/{local-agent-task-wrap.d.ts → local-agent/local-agent-task-wrap.d.ts} +0 -0
  77. /package/dist/internal/runtime/{local-run.d.ts → local-agent/local-agent.d.ts} +0 -0
  78. /package/dist/internal/runtime/{skills-manager.d.ts → local-agent/local-run.d.ts} +0 -0
  79. /package/dist/internal/runtime/{agent-session-store.d.ts → session/agent-session-store.d.ts} +0 -0
  80. /package/dist/internal/runtime/{agent-session.d.ts → session/agent-session.d.ts} +0 -0
  81. /package/dist/internal/runtime/{session-types.d.ts → session/session-types.d.ts} +0 -0
  82. /package/dist/internal/runtime/{skill-frontmatter.d.ts → skills/skill-frontmatter.d.ts} +0 -0
  83. /package/dist/internal/runtime/{subagents-loader.d.ts → skills/skills-manager.d.ts} +0 -0
@@ -1,5 +1,55 @@
1
1
  import { C as CustomTool, M as ModelSelection, D as SDKUserMessage, F as SendOptions, b as Run, a as McpServerConfig } from './run-DrwUpFxZ.cjs';
2
2
 
3
+ /**
4
+ * Fork primitive public type contracts (T1.2, ADRs D110-D114).
5
+ *
6
+ * Extracted into a leaf type module (arch-review ADR 0001) so the public
7
+ * `types/agent.ts` barrel can reference `ForkOptions`/`ForkResult` without
8
+ * importing the `internal/runtime/fork-agent.ts` implementation — which in
9
+ * turn imports back from `types/agent.ts`. That mutual reference created a
10
+ * type-only `madge` cycle. These interfaces are self-contained (no SDKAgent
11
+ * / AgentOptions references), so co-locating them here breaks the cycle with
12
+ * no runtime change. `fork-agent.ts` re-exports them for back-compat.
13
+ */
14
+ /**
15
+ * Caller-supplied fork configuration. See `forkAgentImpl`.
16
+ *
17
+ * @public
18
+ */
19
+ interface ForkOptions {
20
+ /**
21
+ * Tool subset visible to the fork. Names must match the canonical (post-repair)
22
+ * tool name — typically lowercase. Tools not in this set return a `tool_result`
23
+ * with `"Tool blocked by fork whitelist"` content (EC-H).
24
+ */
25
+ allowedTools: Set<string>;
26
+ /** Task prompt sent to the fork. */
27
+ prompt: string;
28
+ /** Override system prompt. Default: byte-identical inheritance from parent (D112). */
29
+ systemPrompt?: string;
30
+ /** Memory write provenance tag (D114). Default `"fork"`. */
31
+ forkOrigin?: string;
32
+ }
33
+ /**
34
+ * Outcome of a fork run.
35
+ *
36
+ * @public
37
+ */
38
+ interface ForkResult {
39
+ /** Final agent response text (`undefined` when the fork produced no result). */
40
+ result: string | undefined;
41
+ /** Tool calls executed inside the fork. */
42
+ toolCalls: ReadonlyArray<{
43
+ name: string;
44
+ input: Record<string, unknown>;
45
+ }>;
46
+ /** Aggregate token usage reported by the run. */
47
+ usage: {
48
+ inputTokens: number;
49
+ outputTokens: number;
50
+ };
51
+ }
52
+
3
53
  /**
4
54
  * Public event types emitted by {@link SDKAgent.runUntil} (ADRs D115-D117).
5
55
  *
@@ -66,7 +116,7 @@ interface GoalResult {
66
116
  finalResponse: string | undefined;
67
117
  }
68
118
  /**
69
- * Return type of {@link import("../internal/runtime/local-agent.js").LocalAgent.runUntil}.
119
+ * Return type of {@link import("../internal/runtime/local-agent/local-agent.js").LocalAgent.runUntil}.
70
120
  * Extracted so the LocalAgent method signature stays a single line (G8 LoC budget).
71
121
  *
72
122
  * @public
@@ -1388,7 +1438,7 @@ interface SDKAgent {
1388
1438
  *
1389
1439
  * @public
1390
1440
  */
1391
- fork?(options: undefined): Promise<undefined>;
1441
+ fork?(options: ForkOptions): Promise<ForkResult>;
1392
1442
  /**
1393
1443
  * Direct API to third-party memory adapter(s) registered via
1394
1444
  * `plugins: [...]` (ADR D141 / D142). Returns `null` when no adapter
@@ -1,5 +1,55 @@
1
1
  import { C as CustomTool, M as ModelSelection, D as SDKUserMessage, F as SendOptions, b as Run, a as McpServerConfig } from './run-DrwUpFxZ.js';
2
2
 
3
+ /**
4
+ * Fork primitive public type contracts (T1.2, ADRs D110-D114).
5
+ *
6
+ * Extracted into a leaf type module (arch-review ADR 0001) so the public
7
+ * `types/agent.ts` barrel can reference `ForkOptions`/`ForkResult` without
8
+ * importing the `internal/runtime/fork-agent.ts` implementation — which in
9
+ * turn imports back from `types/agent.ts`. That mutual reference created a
10
+ * type-only `madge` cycle. These interfaces are self-contained (no SDKAgent
11
+ * / AgentOptions references), so co-locating them here breaks the cycle with
12
+ * no runtime change. `fork-agent.ts` re-exports them for back-compat.
13
+ */
14
+ /**
15
+ * Caller-supplied fork configuration. See `forkAgentImpl`.
16
+ *
17
+ * @public
18
+ */
19
+ interface ForkOptions {
20
+ /**
21
+ * Tool subset visible to the fork. Names must match the canonical (post-repair)
22
+ * tool name — typically lowercase. Tools not in this set return a `tool_result`
23
+ * with `"Tool blocked by fork whitelist"` content (EC-H).
24
+ */
25
+ allowedTools: Set<string>;
26
+ /** Task prompt sent to the fork. */
27
+ prompt: string;
28
+ /** Override system prompt. Default: byte-identical inheritance from parent (D112). */
29
+ systemPrompt?: string;
30
+ /** Memory write provenance tag (D114). Default `"fork"`. */
31
+ forkOrigin?: string;
32
+ }
33
+ /**
34
+ * Outcome of a fork run.
35
+ *
36
+ * @public
37
+ */
38
+ interface ForkResult {
39
+ /** Final agent response text (`undefined` when the fork produced no result). */
40
+ result: string | undefined;
41
+ /** Tool calls executed inside the fork. */
42
+ toolCalls: ReadonlyArray<{
43
+ name: string;
44
+ input: Record<string, unknown>;
45
+ }>;
46
+ /** Aggregate token usage reported by the run. */
47
+ usage: {
48
+ inputTokens: number;
49
+ outputTokens: number;
50
+ };
51
+ }
52
+
3
53
  /**
4
54
  * Public event types emitted by {@link SDKAgent.runUntil} (ADRs D115-D117).
5
55
  *
@@ -66,7 +116,7 @@ interface GoalResult {
66
116
  finalResponse: string | undefined;
67
117
  }
68
118
  /**
69
- * Return type of {@link import("../internal/runtime/local-agent.js").LocalAgent.runUntil}.
119
+ * Return type of {@link import("../internal/runtime/local-agent/local-agent.js").LocalAgent.runUntil}.
70
120
  * Extracted so the LocalAgent method signature stays a single line (G8 LoC budget).
71
121
  *
72
122
  * @public
@@ -1388,7 +1438,7 @@ interface SDKAgent {
1388
1438
  *
1389
1439
  * @public
1390
1440
  */
1391
- fork?(options: undefined): Promise<undefined>;
1441
+ fork?(options: ForkOptions): Promise<ForkResult>;
1392
1442
  /**
1393
1443
  * Direct API to third-party memory adapter(s) registered via
1394
1444
  * `plugins: [...]` (ADR D141 / D142). Returns `null` when no adapter