@theokit/sdk 2.0.0 → 2.0.1

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 (57) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/a2a/index.cjs +154 -148
  3. package/dist/a2a/index.cjs.map +1 -1
  4. package/dist/a2a/index.js +154 -148
  5. package/dist/a2a/index.js.map +1 -1
  6. package/dist/{cron-Ci_NUkUj.d.ts → cron-Bj8-Aq1O.d.ts} +1 -1
  7. package/dist/{cron-Bse1MbaE.d.cts → cron-DFG9-W17.d.cts} +1 -1
  8. package/dist/cron.cjs +135 -128
  9. package/dist/cron.cjs.map +1 -1
  10. package/dist/cron.d.cts +1 -1
  11. package/dist/cron.d.ts +1 -1
  12. package/dist/cron.js +138 -131
  13. package/dist/cron.js.map +1 -1
  14. package/dist/eval.cjs +134 -124
  15. package/dist/eval.cjs.map +1 -1
  16. package/dist/eval.d.cts +1 -0
  17. package/dist/eval.d.ts +1 -0
  18. package/dist/eval.js +137 -127
  19. package/dist/eval.js.map +1 -1
  20. package/dist/index.cjs +113 -106
  21. package/dist/index.cjs.map +1 -1
  22. package/dist/index.d.cts +2 -2
  23. package/dist/index.d.ts +2 -2
  24. package/dist/index.js +113 -106
  25. package/dist/index.js.map +1 -1
  26. package/dist/internal/runtime/{fork-agent.d.ts → lifecycle/fork-agent.d.ts} +1 -1
  27. package/dist/internal/runtime/{run-until.d.ts → lifecycle/run-until.d.ts} +3 -3
  28. package/dist/internal/runtime/local-agent/local-agent-bootstrap.d.ts +1 -1
  29. package/dist/internal/runtime/registry/agent-factory-registry.d.ts +12 -9
  30. package/dist/internal/scorers/llm-judge.d.ts +4 -4
  31. package/dist/internal/security/index.d.cts +1 -1
  32. package/dist/internal/security/index.d.ts +1 -1
  33. package/dist/types/fork.d.ts +1 -1
  34. package/dist/workflow.cjs +2 -2
  35. package/dist/workflow.cjs.map +1 -1
  36. package/dist/workflow.js +2 -2
  37. package/dist/workflow.js.map +1 -1
  38. package/package.json +6 -2
  39. /package/dist/internal/{errors/mappers → error-mappers}/anthropic.d.ts +0 -0
  40. /package/dist/internal/{errors/mappers → error-mappers}/bedrock.d.ts +0 -0
  41. /package/dist/internal/{errors/mappers → error-mappers}/ollama.d.ts +0 -0
  42. /package/dist/internal/{errors/mappers → error-mappers}/openai-compatible.d.ts +0 -0
  43. /package/dist/internal/{errors/mappers → error-mappers}/shared.d.ts +0 -0
  44. /package/dist/internal/{errors/mappers → error-mappers}/vertex.d.ts +0 -0
  45. /package/dist/internal/runtime/{abort-utils.d.ts → concurrency/abort-utils.d.ts} +0 -0
  46. /package/dist/internal/runtime/{async-local-storage.d.ts → concurrency/async-local-storage.d.ts} +0 -0
  47. /package/dist/internal/runtime/{async-semaphore.d.ts → concurrency/async-semaphore.d.ts} +0 -0
  48. /package/dist/internal/runtime/{default-model.d.ts → config/default-model.d.ts} +0 -0
  49. /package/dist/internal/runtime/{providers-manager.d.ts → config/providers-manager.d.ts} +0 -0
  50. /package/dist/internal/runtime/{workspace-dir.d.ts → config/workspace-dir.d.ts} +0 -0
  51. /package/dist/internal/runtime/{yaml-frontmatter.d.ts → context/yaml-frontmatter.d.ts} +0 -0
  52. /package/dist/internal/runtime/{post-run-lifecycle.d.ts → lifecycle/post-run-lifecycle.d.ts} +0 -0
  53. /package/dist/internal/runtime/{spawn-collect.d.ts → lifecycle/spawn-collect.d.ts} +0 -0
  54. /package/dist/internal/runtime/{system-prompt.d.ts → system-prompt/system-prompt.d.ts} +0 -0
  55. /package/dist/internal/runtime/{shell-tool.d.ts → tools/shell-tool.d.ts} +0 -0
  56. /package/dist/internal/runtime/{validate-agent-options.d.ts → validation/validate-agent-options.d.ts} +0 -0
  57. /package/dist/internal/runtime/{validate-response.d.ts → validation/validate-response.d.ts} +0 -0
@@ -12,4 +12,4 @@
12
12
  *
13
13
  * @internal
14
14
  */
15
- export type { ForkOptions, ForkResult } from "../../types/fork.js";
15
+ export type { ForkOptions, ForkResult } from "../../../types/fork.js";
@@ -12,9 +12,9 @@
12
12
  *
13
13
  * @internal
14
14
  */
15
- import type { GoalEvent, GoalOptions, GoalResult } from "../../types/goal-events.js";
16
- import type { JudgeContext, JudgeOptions } from "../judge/judge-call.js";
17
- import type { JudgeResult } from "../judge/types.js";
15
+ import type { GoalEvent, GoalOptions, GoalResult } from "../../../types/goal-events.js";
16
+ import type { JudgeContext, JudgeOptions } from "../../judge/judge-call.js";
17
+ import type { JudgeResult } from "../../judge/types.js";
18
18
  /** DI contract: the judge is the only external touchpoint. */
19
19
  export interface RunUntilDeps {
20
20
  judge: (ctx: JudgeContext, opts?: JudgeOptions) => Promise<JudgeResult>;
@@ -7,9 +7,9 @@
7
7
  *
8
8
  * @internal
9
9
  */
10
+ import { ProvidersManagerImpl } from "../config/providers-manager.js";
10
11
  import { FileContextManager } from "../context/context-manager.js";
11
12
  import { type PluginMetadata, PluginsManager } from "../plugins/plugins-manager.js";
12
- import { ProvidersManagerImpl } from "../providers-manager.js";
13
13
  import { type SkillMetadata, SkillsManager } from "../skills/skills-manager.js";
14
14
  export declare function registerLocalAgent(args: {
15
15
  agentId: string;
@@ -1,16 +1,19 @@
1
1
  /**
2
- * Tiny DI registry for `Agent.create` (T4.2 + T4.3 wiring).
2
+ * Internal DI seam for the public `Agent` facade.
3
3
  *
4
- * `LocalAgent.runUntil` and `LocalAgent.fork` need to spawn auxiliary
5
- * agents via `Agent.create`. A direct import would form a cycle
6
- * (`agent.ts` already imports `LocalAgent`). This module is the seam:
7
- * `agent.ts` registers the factory at module init time; LocalAgent
8
- * reads it on-demand.
4
+ * Several internal subsystems (`LocalAgent.runUntil`/`fork`, eval, scorers,
5
+ * cron) need to invoke `Agent.create`/`prompt`/`get`/`resume`/`batch`. A direct
6
+ * `import { Agent }` would invert the public-api -> internal dependency
7
+ * direction (and `agent.ts` already imports much of `internal/`). This module
8
+ * is the inversion seam: `agent.ts` registers the facade at module-init time;
9
+ * internal consumers read it on-demand via `getAgentFacade()`. The
10
+ * `internal-must-not-import-facade` dependency-cruiser rule enforces that no
11
+ * `internal/*` module bypasses this seam with a direct facade import.
9
12
  *
10
13
  * Throws if accessed before registration — should never happen because
11
- * `agent.ts` evaluation always precedes `LocalAgent.runUntil()` calls
12
- * (the user must call `Agent.create()` to obtain the LocalAgent first).
14
+ * `agent.ts` evaluation always precedes any internal call (the consumer must
15
+ * obtain a handle from the `Agent` facade first).
13
16
  *
14
17
  * @internal
15
18
  */
16
- export type AgentCreateFn = (options: AgentOptions) => Promise<SDKAgent>;
19
+ export {};
@@ -1,13 +1,13 @@
1
1
  /**
2
2
  * LLM-as-judge scorer implementation (ADR D205).
3
3
  *
4
- * Builds a transient agent with the judge model + apiKey, calls
5
- * `Agent.prompt` with a structured judge prompt, parses score from
6
- * the response. Returns 0 (with diagnostic reason) on any parse failure.
4
+ * Builds a transient agent with the judge model + apiKey, calls the public
5
+ * Agent facade's `prompt` (via the `getAgentFacade()` inversion seam) with a
6
+ * structured judge prompt, parses score from the response. Returns 0 (with
7
+ * diagnostic reason) on any parse failure.
7
8
  *
8
9
  * @internal
9
10
  */
10
- import type { ModelSelection } from "../../types/agent.js";
11
11
  import type { Score } from "../../types/eval.js";
12
12
  import type { ProviderRoutingSettings } from "../../types/providers.js";
13
13
  export interface LlmJudgeOptions {
@@ -2,7 +2,7 @@
2
2
  * Barrel for the canonical secret-redaction module (ADRs D68-D73).
3
3
  *
4
4
  * Consumers across the SDK output boundaries import from here:
5
- * `internal/errors/mappers/shared.ts`, `internal/telemetry/tracer.ts`,
5
+ * `internal/error-mappers/shared.ts`, `internal/telemetry/tracer.ts`,
6
6
  * `internal/runtime/agent-session-store.ts`,
7
7
  * `internal/memory/migrate-sqlite-to-lance.ts`.
8
8
  *
@@ -2,7 +2,7 @@
2
2
  * Barrel for the canonical secret-redaction module (ADRs D68-D73).
3
3
  *
4
4
  * Consumers across the SDK output boundaries import from here:
5
- * `internal/errors/mappers/shared.ts`, `internal/telemetry/tracer.ts`,
5
+ * `internal/error-mappers/shared.ts`, `internal/telemetry/tracer.ts`,
6
6
  * `internal/runtime/agent-session-store.ts`,
7
7
  * `internal/memory/migrate-sqlite-to-lance.ts`.
8
8
  *
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * Extracted into a leaf type module (arch-review ADR 0001) so the public
5
5
  * `types/agent.ts` barrel can reference `ForkOptions`/`ForkResult` without
6
- * importing the `internal/runtime/fork-agent.ts` implementation — which in
6
+ * importing the `internal/runtime/lifecycle/fork-agent.ts` implementation — which in
7
7
  * turn imports back from `types/agent.ts`. That mutual reference created a
8
8
  * type-only `madge` cycle. These interfaces are self-contained (no SDKAgent
9
9
  * / AgentOptions references), so co-locating them here breaks the cycle with
package/dist/workflow.cjs CHANGED
@@ -927,7 +927,7 @@ var init_step_fn = __esm({
927
927
  }
928
928
  });
929
929
 
930
- // src/internal/runtime/async-semaphore.ts
930
+ // src/internal/runtime/concurrency/async-semaphore.ts
931
931
  function createSemaphore(permits) {
932
932
  if (!Number.isInteger(permits) || permits < 1) {
933
933
  throw new ConfigurationError(
@@ -965,7 +965,7 @@ function createSemaphore(permits) {
965
965
  };
966
966
  }
967
967
  var init_async_semaphore = __esm({
968
- "src/internal/runtime/async-semaphore.ts"() {
968
+ "src/internal/runtime/concurrency/async-semaphore.ts"() {
969
969
  init_errors();
970
970
  }
971
971
  });