@theokit/sdk 4.15.1 → 4.15.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.
package/dist/eval.js CHANGED
@@ -7140,7 +7140,7 @@ var SkillsManager = class {
7140
7140
  }
7141
7141
  async refresh() {
7142
7142
  const skillsRoot = this.skillsDir ?? join(this.cwd, ".theokit", "skills");
7143
- const discovered2 = await discoverSkills(skillsRoot, {
7143
+ const discovered = await discoverSkills(skillsRoot, {
7144
7144
  onInvalidSkill: (info) => {
7145
7145
  process.stderr.write(
7146
7146
  `[theokit-sdk] skill ${info.name} skipped (${info.code}): ${info.message}
@@ -7148,13 +7148,13 @@ var SkillsManager = class {
7148
7148
  );
7149
7149
  }
7150
7150
  });
7151
- this.skills = this.mergeInline(discovered2);
7151
+ this.skills = this.mergeInline(discovered);
7152
7152
  }
7153
7153
  /** M22 — merge inline skills over discovered ones; inline wins on a name conflict. */
7154
- mergeInline(discovered2) {
7155
- if (this.inline === void 0 || this.inline.length === 0) return discovered2;
7154
+ mergeInline(discovered) {
7155
+ if (this.inline === void 0 || this.inline.length === 0) return discovered;
7156
7156
  const inlineNames = new Set(this.inline.map((s) => s.name));
7157
- return [...discovered2.filter((s) => !inlineNames.has(s.name)), ...this.inline];
7157
+ return [...discovered.filter((s) => !inlineNames.has(s.name)), ...this.inline];
7158
7158
  }
7159
7159
  list() {
7160
7160
  return Promise.resolve(this.skills);
@@ -8712,7 +8712,7 @@ var FileContextManager = class {
8712
8712
  const legacy = await loadSources(config, this.cwd);
8713
8713
  const maxBytesPerFile = this.settings.maxBytesPerFile ?? DEFAULT_MAX_BYTES_PER_FILE;
8714
8714
  const maxBytesTotal = this.settings.maxBytesTotal ?? DEFAULT_MAX_BYTES_TOTAL;
8715
- const discovered2 = await runDiscovery({
8715
+ const discovered = await runDiscovery({
8716
8716
  cwd: this.cwd,
8717
8717
  maxBytesPerFile,
8718
8718
  touchedFiles
@@ -8725,7 +8725,7 @@ var FileContextManager = class {
8725
8725
  // matches DEFAULT_DISCOVERY_SPECS theokit-context
8726
8726
  truncated: false
8727
8727
  }));
8728
- const { kept } = applyAggregateCap([...discovered2, ...legacyAsAggregator], maxBytesTotal);
8728
+ const { kept } = applyAggregateCap([...discovered, ...legacyAsAggregator], maxBytesTotal);
8729
8729
  const loadedSources = kept.map((s) => ({
8730
8730
  name: s.id,
8731
8731
  path: s.source,
@@ -12028,7 +12028,15 @@ function registerBuiltins() {
12028
12028
  registerProvider(CEREBRAS);
12029
12029
  registerCatalogProviders();
12030
12030
  }
12031
- var discovered = false;
12031
+ function globalSingleton3(key, create) {
12032
+ const g = globalThis;
12033
+ const sym = Symbol.for(key);
12034
+ if (g[sym] === void 0) g[sym] = create();
12035
+ return g[sym];
12036
+ }
12037
+ var discoveryState = globalSingleton3("theokit-sdk.providers.discovered", () => ({
12038
+ done: false
12039
+ }));
12032
12040
  function pluginsRoot() {
12033
12041
  return join(homedir(), ".theokit", "plugins", "model-providers");
12034
12042
  }
@@ -12042,8 +12050,16 @@ function loadTrustedNames() {
12042
12050
  try {
12043
12051
  const parsed = JSON.parse(readFileSync(path, "utf-8"));
12044
12052
  if (Array.isArray(parsed)) {
12053
+ let discarded = 0;
12045
12054
  for (const name of parsed) {
12046
12055
  if (typeof name === "string" && name.length > 0) trusted.add(name);
12056
+ else discarded += 1;
12057
+ }
12058
+ if (discarded > 0) {
12059
+ process.stderr.write(
12060
+ `[theokit-sdk] WARN: ${path} contains ${discarded} non-string entr${discarded === 1 ? "y" : "ies"} \u2014 discarded (entries must be plugin-name strings)
12061
+ `
12062
+ );
12047
12063
  }
12048
12064
  } else {
12049
12065
  process.stderr.write(
@@ -12065,8 +12081,8 @@ function loadTrustedNames() {
12065
12081
  return trusted;
12066
12082
  }
12067
12083
  async function discoverProviderPlugins() {
12068
- if (discovered) return;
12069
- discovered = true;
12084
+ if (discoveryState.done) return;
12085
+ discoveryState.done = true;
12070
12086
  const root = pluginsRoot();
12071
12087
  if (!existsSync(root)) return;
12072
12088
  let entries;
@@ -12079,7 +12095,7 @@ async function discoverProviderPlugins() {
12079
12095
  for (const entry of entries) {
12080
12096
  if (!trusted.has(entry)) {
12081
12097
  process.stderr.write(
12082
- `[theokit-sdk] WARN: provider plugin "${entry}" is present but NOT trusted \u2014 skipped. To trust it, add "${entry}" to ${trustFilePath()} (JSON array) or THEOKIT_TRUSTED_PROVIDERS.
12098
+ `[theokit-sdk] WARN: provider plugin "${entry}" is present but NOT trusted \u2014 skipped. To trust it, add "${entry}" to ${trustFilePath()} (JSON array of names) or THEOKIT_TRUSTED_PROVIDERS (comma-separated), then restart the process.
12083
12099
  `
12084
12100
  );
12085
12101
  continue;
@@ -18657,6 +18673,7 @@ function resolveAgentPersistenceCwd(options) {
18657
18673
  return process.cwd();
18658
18674
  }
18659
18675
  async function rehydrateExistingAgent(agentId, existing, options) {
18676
+ await discoverProviderPlugins();
18660
18677
  await validateRehydratedAgent(agentId, existing);
18661
18678
  const mergedLocal = options.local !== void 0 && existing.options.local !== void 0 ? { ...existing.options.local, ...options.local } : options.local ?? existing.options.local;
18662
18679
  const mergedOptions = {