@theokit/sdk 4.22.0 → 4.24.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 (63) hide show
  1. package/dist/auth/index.cjs +29 -5
  2. package/dist/auth/index.cjs.map +1 -1
  3. package/dist/auth/index.js +29 -5
  4. package/dist/auth/index.js.map +1 -1
  5. package/dist/compaction.cjs +31 -0
  6. package/dist/compaction.cjs.map +1 -1
  7. package/dist/compaction.d.cts +79 -0
  8. package/dist/compaction.d.ts +79 -0
  9. package/dist/compaction.js +28 -1
  10. package/dist/compaction.js.map +1 -1
  11. package/dist/{cron-Bhdyjl0B.d.ts → cron-B_NkE_VM.d.ts} +15 -1
  12. package/dist/{cron-M2Xz7lq2.d.cts → cron-x3muPNgg.d.cts} +15 -1
  13. package/dist/cron.cjs +467 -337
  14. package/dist/cron.cjs.map +1 -1
  15. package/dist/cron.d.cts +2 -2
  16. package/dist/cron.d.ts +2 -2
  17. package/dist/cron.js +467 -337
  18. package/dist/cron.js.map +1 -1
  19. package/dist/{errors-gE8612p9.d.cts → errors-BdL-buYn.d.cts} +1 -1
  20. package/dist/{errors-CG2RpeW-.d.ts → errors-DHZtSNnj.d.ts} +1 -1
  21. package/dist/errors.d.cts +2 -2
  22. package/dist/eval.cjs +467 -337
  23. package/dist/eval.cjs.map +1 -1
  24. package/dist/eval.js +467 -337
  25. package/dist/eval.js.map +1 -1
  26. package/dist/index.cjs +640 -508
  27. package/dist/index.cjs.map +1 -1
  28. package/dist/index.d.cts +21 -12
  29. package/dist/index.d.ts +21 -12
  30. package/dist/index.js +640 -508
  31. package/dist/index.js.map +1 -1
  32. package/dist/internal/auth/credential-store.d.ts +20 -3
  33. package/dist/internal/global-singleton.d.ts +13 -0
  34. package/dist/internal/llm/openai-messages.d.ts +2 -0
  35. package/dist/internal/local-agent/mcp-pool.d.ts +41 -0
  36. package/dist/internal/local-agent/real-local-run.d.ts +2 -0
  37. package/dist/internal/persistence/index.cjs +3 -1
  38. package/dist/internal/persistence/index.cjs.map +1 -1
  39. package/dist/internal/persistence/index.js +3 -1
  40. package/dist/internal/persistence/index.js.map +1 -1
  41. package/dist/internal/providers/registry.d.ts +1 -0
  42. package/dist/internal/runtime/lifecycle/context-budget-event.d.ts +25 -0
  43. package/dist/internal/runtime/lifecycle/goal-marker.d.ts +13 -0
  44. package/dist/internal/runtime/lifecycle/run-until.d.ts +0 -1
  45. package/dist/internal/session/agent-session.d.ts +1 -1
  46. package/dist/internal/session/session-cache.d.ts +20 -0
  47. package/dist/models.cjs +22 -20
  48. package/dist/models.cjs.map +1 -1
  49. package/dist/models.js +22 -20
  50. package/dist/models.js.map +1 -1
  51. package/dist/persistence.cjs +3 -1
  52. package/dist/persistence.cjs.map +1 -1
  53. package/dist/persistence.js +3 -1
  54. package/dist/persistence.js.map +1 -1
  55. package/dist/provider-catalog.json +144 -469
  56. package/dist/{run-DFM1H2jW.d.cts → run-OJbGyweZ.d.cts} +20 -1
  57. package/dist/{run-DFM1H2jW.d.ts → run-OJbGyweZ.d.ts} +20 -1
  58. package/dist/types/agent.d.ts +14 -0
  59. package/dist/types/run-events.d.ts +20 -1
  60. package/dist/workflow.cjs.map +1 -1
  61. package/dist/workflow.js.map +1 -1
  62. package/package.json +2 -2
  63. package/dist/goal-loop.d.ts +0 -35
package/dist/models.js CHANGED
@@ -6,6 +6,14 @@ import { createHash, randomBytes } from 'crypto';
6
6
  import { homedir } from 'os';
7
7
 
8
8
  // src/internal/providers/catalog-loader.ts
9
+
10
+ // src/internal/global-singleton.ts
11
+ function globalSingleton(key, create) {
12
+ const g = globalThis;
13
+ const sym = Symbol.for(key);
14
+ if (g[sym] === void 0) g[sym] = create();
15
+ return g[sym];
16
+ }
9
17
  var MODALITIES = ["text", "audio", "image", "video", "pdf"];
10
18
  var costSchema = z.object({
11
19
  /** USD per 1M tokens (models.dev convention). */
@@ -41,12 +49,6 @@ var catalogModelSchema = z.object({
41
49
  }).loose();
42
50
 
43
51
  // src/internal/providers/registry.ts
44
- function globalSingleton(key, create) {
45
- const g = globalThis;
46
- const sym = Symbol.for(key);
47
- if (g[sym] === void 0) g[sym] = create();
48
- return g[sym];
49
- }
50
52
  var REGISTRY = globalSingleton(
51
53
  "theokit-sdk.providers.registry",
52
54
  () => /* @__PURE__ */ new Map()
@@ -76,21 +78,15 @@ function getProviderProfile(name) {
76
78
 
77
79
  // src/internal/providers/catalog-loader.ts
78
80
  var __dirname_resolved = dirname(fileURLToPath(import.meta.url));
79
- function globalSingleton2(key, create) {
80
- const g = globalThis;
81
- const sym = Symbol.for(key);
82
- if (g[sym] === void 0) g[sym] = create();
83
- return g[sym];
84
- }
85
- var modelInfoIndex = globalSingleton2(
81
+ var modelInfoIndex = globalSingleton(
86
82
  "theokit-sdk.providers.model-info-index",
87
83
  () => /* @__PURE__ */ new Map()
88
84
  );
89
- var patchedModelKeys = globalSingleton2(
85
+ var patchedModelKeys = globalSingleton(
90
86
  "theokit-sdk.providers.model-info-patched",
91
87
  () => /* @__PURE__ */ new Set()
92
88
  );
93
- var indexState = globalSingleton2("theokit-sdk.providers.model-info-loaded", () => ({
89
+ var indexState = globalSingleton("theokit-sdk.providers.model-info-loaded", () => ({
94
90
  loaded: false
95
91
  }));
96
92
  function getCatalogModelInfo(key) {
@@ -296,6 +292,12 @@ var TheokitAgentError = class extends Error {
296
292
  if (options.metadata !== void 0) this.metadata = options.metadata;
297
293
  }
298
294
  };
295
+ var AuthenticationError = class extends TheokitAgentError {
296
+ name = "AuthenticationError";
297
+ constructor(message, options = {}) {
298
+ super(message, { ...options, isRetryable: false });
299
+ }
300
+ };
299
301
  var ConfigurationError = class extends TheokitAgentError {
300
302
  name = "ConfigurationError";
301
303
  constructor(message, options = {}) {
@@ -536,11 +538,11 @@ function credentialHome(config, env = {}) {
536
538
  function authFilePath(config, env = {}) {
537
539
  return join(credentialHome(config, env), config.fileName);
538
540
  }
539
- var CredentialError = class extends Error {
540
- constructor(message) {
541
- super(message);
542
- this.name = "CredentialError";
543
- }
541
+ var CredentialError = class extends AuthenticationError {
542
+ // Field, not an assignment in the constructor: `AuthenticationError.name` is `override readonly`
543
+ // (`errors.ts:174`), so `this.name = …` does not compile. Caught by `tsc`, not by vitest — the
544
+ // suite was green with the broken assignment because the transpiler strips the type.
545
+ name = "CredentialError";
544
546
  };
545
547
  var apiFileSchema = z.object({
546
548
  type: z.literal("api").optional(),