@theokit/sdk 4.63.3 → 4.63.4

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 (61) hide show
  1. package/CHANGELOG.md +67 -0
  2. package/dist/{agent-3JK7VXNN.js → agent-A5XMIVNP.js} +6 -6
  3. package/dist/{agent-3JK7VXNN.js.map → agent-A5XMIVNP.js.map} +1 -1
  4. package/dist/{agent-PVINJTUR.cjs → agent-UX7WFI6B.cjs} +7 -7
  5. package/dist/{agent-PVINJTUR.cjs.map → agent-UX7WFI6B.cjs.map} +1 -1
  6. package/dist/chunk-247ZTLNU.js +73 -0
  7. package/dist/chunk-247ZTLNU.js.map +1 -0
  8. package/dist/{chunk-GPKAF7SG.js → chunk-32WTYBUH.js} +3 -3
  9. package/dist/{chunk-GPKAF7SG.js.map → chunk-32WTYBUH.js.map} +1 -1
  10. package/dist/{chunk-CQBXOJ6U.cjs → chunk-43ZQRWAP.cjs} +5 -5
  11. package/dist/{chunk-CQBXOJ6U.cjs.map → chunk-43ZQRWAP.cjs.map} +1 -1
  12. package/dist/{chunk-JJ3OVRUM.cjs → chunk-7VT4P3Z4.cjs} +136 -35
  13. package/dist/chunk-7VT4P3Z4.cjs.map +1 -0
  14. package/dist/chunk-AKJP2STZ.cjs +81 -0
  15. package/dist/chunk-AKJP2STZ.cjs.map +1 -0
  16. package/dist/{chunk-ZWRG4NWT.cjs → chunk-GMLBYDW4.cjs} +4 -4
  17. package/dist/{chunk-ZWRG4NWT.cjs.map → chunk-GMLBYDW4.cjs.map} +1 -1
  18. package/dist/{chunk-LXI4XZEC.js → chunk-LKBEROHN.js} +3 -3
  19. package/dist/{chunk-LXI4XZEC.js.map → chunk-LKBEROHN.js.map} +1 -1
  20. package/dist/{chunk-25BD2R5G.js → chunk-LYTOXSRH.js} +113 -12
  21. package/dist/chunk-LYTOXSRH.js.map +1 -0
  22. package/dist/{chunk-K5OJUYSZ.js → chunk-NDGGJQTZ.js} +13 -4
  23. package/dist/chunk-NDGGJQTZ.js.map +1 -0
  24. package/dist/{chunk-ZCIRZE37.cjs → chunk-VCLBZAZU.cjs} +14 -5
  25. package/dist/chunk-VCLBZAZU.cjs.map +1 -0
  26. package/dist/{context-AGQ3DIZU.cjs → context-WFLTTMK3.cjs} +7 -7
  27. package/dist/{context-AGQ3DIZU.cjs.map → context-WFLTTMK3.cjs.map} +1 -1
  28. package/dist/context-WI2DFG7V.js +7 -0
  29. package/dist/{context-GQRFBCLP.js.map → context-WI2DFG7V.js.map} +1 -1
  30. package/dist/cron.cjs +6 -6
  31. package/dist/cron.js +5 -5
  32. package/dist/eval.cjs +5 -5
  33. package/dist/eval.js +4 -4
  34. package/dist/index.cjs +20 -20
  35. package/dist/index.js +7 -7
  36. package/dist/internal/agent-loop/replay-messages.d.ts +41 -0
  37. package/dist/internal/local-agent/local-option-keys.d.ts +2 -0
  38. package/dist/internal/persistence/index.cjs +4 -4
  39. package/dist/internal/persistence/index.js +1 -1
  40. package/dist/internal/runtime/compat/foreign-config-sources.d.ts +92 -0
  41. package/dist/internal/runtime/hooks/hooks-executor.d.ts +9 -0
  42. package/dist/internal/runtime/hooks/hooks-source.d.ts +9 -0
  43. package/dist/subagents-loader-UCNO7FUH.cjs +17 -0
  44. package/dist/{subagents-loader-YEUFFPAL.cjs.map → subagents-loader-UCNO7FUH.cjs.map} +1 -1
  45. package/dist/subagents-loader-XP5ERVDZ.js +8 -0
  46. package/dist/{subagents-loader-CRT5LLL3.js.map → subagents-loader-XP5ERVDZ.js.map} +1 -1
  47. package/dist/subagents-loader.cjs +3 -3
  48. package/dist/subagents-loader.js +2 -2
  49. package/docs/error-codes.md +5 -5
  50. package/package.json +1 -1
  51. package/dist/chunk-25BD2R5G.js.map +0 -1
  52. package/dist/chunk-AQO3NSRG.cjs +0 -41
  53. package/dist/chunk-AQO3NSRG.cjs.map +0 -1
  54. package/dist/chunk-JJ3OVRUM.cjs.map +0 -1
  55. package/dist/chunk-K5OJUYSZ.js.map +0 -1
  56. package/dist/chunk-UFLD2HEV.js +0 -35
  57. package/dist/chunk-UFLD2HEV.js.map +0 -1
  58. package/dist/chunk-ZCIRZE37.cjs.map +0 -1
  59. package/dist/context-GQRFBCLP.js +0 -7
  60. package/dist/subagents-loader-CRT5LLL3.js +0 -8
  61. package/dist/subagents-loader-YEUFFPAL.cjs +0 -17
@@ -3,7 +3,7 @@
3
3
  var chunk3FFAEAUJ_cjs = require('./chunk-3FFAEAUJ.cjs');
4
4
  var chunkRMWTPV3M_cjs = require('./chunk-RMWTPV3M.cjs');
5
5
  var chunkVLVVJLDH_cjs = require('./chunk-VLVVJLDH.cjs');
6
- var chunkZCIRZE37_cjs = require('./chunk-ZCIRZE37.cjs');
6
+ var chunkVCLBZAZU_cjs = require('./chunk-VCLBZAZU.cjs');
7
7
  var chunkBV2MWEMV_cjs = require('./chunk-BV2MWEMV.cjs');
8
8
  var chunkKQ7TS7WW_cjs = require('./chunk-KQ7TS7WW.cjs');
9
9
  var chunkGKEFRLU7_cjs = require('./chunk-GKEFRLU7.cjs');
@@ -26,8 +26,8 @@ var chunk5HEG4CQH_cjs = require('./chunk-5HEG4CQH.cjs');
26
26
  var chunkUU36SHFY_cjs = require('./chunk-UU36SHFY.cjs');
27
27
  var chunkZF2LDKQQ_cjs = require('./chunk-ZF2LDKQQ.cjs');
28
28
  var chunkUALX2J2Q_cjs = require('./chunk-UALX2J2Q.cjs');
29
- var chunkCQBXOJ6U_cjs = require('./chunk-CQBXOJ6U.cjs');
30
- var chunkAQO3NSRG_cjs = require('./chunk-AQO3NSRG.cjs');
29
+ var chunk43ZQRWAP_cjs = require('./chunk-43ZQRWAP.cjs');
30
+ var chunkAKJP2STZ_cjs = require('./chunk-AKJP2STZ.cjs');
31
31
  var chunk4CLOXP6H_cjs = require('./chunk-4CLOXP6H.cjs');
32
32
  var chunkDXGZ2NUG_cjs = require('./chunk-DXGZ2NUG.cjs');
33
33
  var chunk3EE6LVWT_cjs = require('./chunk-3EE6LVWT.cjs');
@@ -2170,14 +2170,14 @@ async function readState(filePath) {
2170
2170
  try {
2171
2171
  parsed = JSON.parse(raw);
2172
2172
  } catch {
2173
- chunkZCIRZE37_cjs.warnOnce(
2173
+ chunkVCLBZAZU_cjs.warnOnce(
2174
2174
  "personality-store-json-parse",
2175
2175
  "[theokit-sdk] personality.json is malformed; treating as empty"
2176
2176
  );
2177
2177
  return emptyState();
2178
2178
  }
2179
2179
  if (!isStateV1(parsed)) {
2180
- chunkZCIRZE37_cjs.warnOnce(
2180
+ chunkVCLBZAZU_cjs.warnOnce(
2181
2181
  "personality-store-bad-version",
2182
2182
  `[theokit-sdk] personality.json has unknown version; treating as empty (file kept untouched)`
2183
2183
  );
@@ -2208,7 +2208,7 @@ var PersonalityStore = class {
2208
2208
  try {
2209
2209
  await this.#persist(agentId, slug);
2210
2210
  } catch (err) {
2211
- chunkZCIRZE37_cjs.warnOnce(
2211
+ chunkVCLBZAZU_cjs.warnOnce(
2212
2212
  `personality-store-persist-failure-${agentId}`,
2213
2213
  `[theokit-sdk] personality persist failed for ${chunkXL7Q7HB2_cjs.redactSecrets(agentId)}: ${chunkXL7Q7HB2_cjs.redactSecrets(
2214
2214
  err.message
@@ -2225,7 +2225,7 @@ var PersonalityStore = class {
2225
2225
  try {
2226
2226
  state = await readState(filePath);
2227
2227
  } catch (err) {
2228
- chunkZCIRZE37_cjs.warnOnce(
2228
+ chunkVCLBZAZU_cjs.warnOnce(
2229
2229
  `personality-store-hydrate-failure-${agentId}`,
2230
2230
  `[theokit-sdk] personality hydrate failed for ${chunkXL7Q7HB2_cjs.redactSecrets(agentId)}: ${chunkXL7Q7HB2_cjs.redactSecrets(
2231
2231
  err.message
@@ -2254,7 +2254,7 @@ var PersonalityStore = class {
2254
2254
  });
2255
2255
  }
2256
2256
  #filePath() {
2257
- return path.join(chunkAQO3NSRG_cjs.getTheokitHome(this.#cwd), FILE_NAME);
2257
+ return path.join(chunkAKJP2STZ_cjs.getTheokitHome(this.#cwd), FILE_NAME);
2258
2258
  }
2259
2259
  };
2260
2260
 
@@ -2598,6 +2598,8 @@ function spawnAndCollect(options) {
2598
2598
  settle({ stdout, stderr, exitCode: code, timedOut });
2599
2599
  });
2600
2600
  if (options.stdin !== void 0 && child.stdin !== null) {
2601
+ child.stdin.on("error", () => {
2602
+ });
2601
2603
  child.stdin.end(options.stdin);
2602
2604
  }
2603
2605
  });
@@ -2615,7 +2617,7 @@ var HooksExecutor = class {
2615
2617
  this.config = {};
2616
2618
  return;
2617
2619
  }
2618
- this.config = await chunkZCIRZE37_cjs.loadHookConfig(this.cwd);
2620
+ this.config = await chunkVCLBZAZU_cjs.loadHookConfig(this.cwd);
2619
2621
  }
2620
2622
  /** Fire every hook registered for `event` and aggregate the decisions. */
2621
2623
  async run(payload) {
@@ -2650,10 +2652,12 @@ var HooksExecutor = class {
2650
2652
  }
2651
2653
  async executeOne(command, payload) {
2652
2654
  const timeoutMs = command.timeoutMs ?? 3e4;
2655
+ const env = runtimeEnvFor(command.sourcePath, this.cwd);
2653
2656
  const result = await spawnAndCollect({
2654
2657
  command: "sh",
2655
2658
  args: ["-c", command.command],
2656
2659
  cwd: this.cwd,
2660
+ ...Object.keys(env).length > 0 ? { env } : {},
2657
2661
  timeoutMs,
2658
2662
  stdin: JSON.stringify(payload)
2659
2663
  });
@@ -2664,14 +2668,22 @@ var HooksExecutor = class {
2664
2668
  return { decision: "deny", reason: `Hook spawn failed: ${result.spawnError.message}` };
2665
2669
  }
2666
2670
  if (result.exitCode !== 0) {
2671
+ const stderr = result.stderr.trim();
2672
+ const base = stderr.length > 0 ? stderr : `Hook exited with code ${result.exitCode}`;
2673
+ const missing = chunkAKJP2STZ_cjs.undefinedVariablesIn(command.command, env);
2674
+ if (missing.length === 0) return { decision: "deny", reason: base };
2667
2675
  return {
2668
2676
  decision: "deny",
2669
- reason: result.stderr.trim().length > 0 ? result.stderr.trim() : `Hook exited with code ${result.exitCode}`
2677
+ reason: `${base} \u2014 this hook came from ${command.sourcePath ?? "an unrecorded source"} and uses ${missing.map((n) => `$${n}`).join(", ")}, which nothing defines here. A variable this runtime does not supply expands to the empty string, so the error above names a path rather than the cause.`
2670
2678
  };
2671
2679
  }
2672
2680
  return parseDecisionFromStdout(result.stdout);
2673
2681
  }
2674
2682
  };
2683
+ function runtimeEnvFor(sourcePath, cwd) {
2684
+ if (sourcePath === void 0) return {};
2685
+ return chunkAKJP2STZ_cjs.adapterForConfigPath(sourcePath)?.runtimeEnv(cwd) ?? {};
2686
+ }
2675
2687
  function parseDecisionFromStdout(stdout) {
2676
2688
  const trimmed = stdout.trim();
2677
2689
  if (trimmed.length === 0) return { decision: "allow" };
@@ -2942,8 +2954,8 @@ var SkillsManager = class {
2942
2954
  }
2943
2955
  async refresh() {
2944
2956
  const roots = this.skillsDir === void 0 ? [
2945
- ...chunkAQO3NSRG_cjs.projectConfigRoots(this.cwd).map((root) => path.join(root, "skills")),
2946
- ...(await chunkCQBXOJ6U_cjs.pluginBundleDirs(this.cwd)).map((bundle) => path.join(bundle, "skills"))
2957
+ ...chunkAKJP2STZ_cjs.projectConfigRoots(this.cwd).map((root) => path.join(root, "skills")),
2958
+ ...(await chunk43ZQRWAP_cjs.pluginBundleDirs(this.cwd)).map((bundle) => path.join(bundle, "skills"))
2947
2959
  ] : [this.skillsDir];
2948
2960
  const discovered = [];
2949
2961
  const seen = /* @__PURE__ */ new Set();
@@ -3448,7 +3460,7 @@ var HISTOGRAM_NAMES = {
3448
3460
  };
3449
3461
  function safeRequire(moduleName) {
3450
3462
  try {
3451
- const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-JJ3OVRUM.cjs', document.baseURI).href)));
3463
+ const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-7VT4P3Z4.cjs', document.baseURI).href)));
3452
3464
  return r(moduleName);
3453
3465
  } catch {
3454
3466
  return void 0;
@@ -3676,7 +3688,7 @@ var cachedOtel;
3676
3688
  function loadOtel() {
3677
3689
  if (cachedOtel === void 0) {
3678
3690
  try {
3679
- const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-JJ3OVRUM.cjs', document.baseURI).href)));
3691
+ const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-7VT4P3Z4.cjs', document.baseURI).href)));
3680
3692
  const mod = r("@opentelemetry/api");
3681
3693
  cachedOtel = mod;
3682
3694
  } catch {
@@ -4140,7 +4152,7 @@ async function loadContextConfig(cwd) {
4140
4152
  });
4141
4153
  if (mdEntities.length > 0) {
4142
4154
  if (fs.existsSync(jsonPath)) {
4143
- chunkZCIRZE37_cjs.warnOnce(
4155
+ chunkVCLBZAZU_cjs.warnOnce(
4144
4156
  "context-both-present",
4145
4157
  "[theokit-sdk] both .theokit/context/ and .theokit/context.json detected \u2014 using markdown; remove context.json"
4146
4158
  );
@@ -4150,7 +4162,7 @@ async function loadContextConfig(cwd) {
4150
4162
  };
4151
4163
  }
4152
4164
  if (!fs.existsSync(jsonPath)) return { sources: [] };
4153
- chunkZCIRZE37_cjs.warnOnce(
4165
+ chunkVCLBZAZU_cjs.warnOnce(
4154
4166
  "context-json-deprecated",
4155
4167
  "[theokit-sdk] .theokit/context.json is deprecated; migrate to .theokit/context/<name>.md via theokit-migrate-config"
4156
4168
  );
@@ -4286,7 +4298,7 @@ var PluginsManager = class {
4286
4298
  }
4287
4299
  async refresh() {
4288
4300
  this.plugins = [];
4289
- for (const pluginsRoot of chunkAQO3NSRG_cjs.pluginBundleRoots(this.cwd)) {
4301
+ for (const pluginsRoot of chunkAKJP2STZ_cjs.pluginBundleRoots(this.cwd)) {
4290
4302
  await this.refreshRoot(pluginsRoot);
4291
4303
  }
4292
4304
  }
@@ -4308,13 +4320,13 @@ var PluginsManager = class {
4308
4320
  const jsonPath = path.join(pluginsRoot, folderName, "plugin.json");
4309
4321
  const metadata = fs.existsSync(mdPath) ? await loadPluginManifestFromMarkdown(pluginsRoot, folderName) : await loadPluginManifestFromJson(jsonPath, folderName);
4310
4322
  if (fs.existsSync(mdPath) && fs.existsSync(jsonPath)) {
4311
- chunkZCIRZE37_cjs.warnOnce(
4323
+ chunkVCLBZAZU_cjs.warnOnce(
4312
4324
  `plugin-${folderName}-both`,
4313
4325
  `[theokit-sdk] both ${folderName}/PLUGIN.md and ${folderName}/plugin.json detected \u2014 using markdown; remove plugin.json`
4314
4326
  );
4315
4327
  }
4316
4328
  if (!fs.existsSync(mdPath) && fs.existsSync(jsonPath)) {
4317
- chunkZCIRZE37_cjs.warnOnce(
4329
+ chunkVCLBZAZU_cjs.warnOnce(
4318
4330
  "plugin-json-deprecated",
4319
4331
  "[theokit-sdk] plugin.json manifests are deprecated; migrate to PLUGIN.md via theokit-migrate-config"
4320
4332
  );
@@ -4814,6 +4826,44 @@ var UsageAccumulator = class {
4814
4826
  }
4815
4827
  };
4816
4828
 
4829
+ // src/internal/agent-loop/replay-messages.ts
4830
+ function replayMessages(prior) {
4831
+ return prior.flatMap(replayTurn);
4832
+ }
4833
+ function replayTurn(msg) {
4834
+ if (msg.parts === void 0 || msg.parts.length === 0) {
4835
+ return [{ role: msg.role, content: [{ type: "text", text: msg.text }] }];
4836
+ }
4837
+ const { own, results } = splitParts(msg.parts);
4838
+ const out = [];
4839
+ if (own.length > 0) out.push({ role: msg.role, content: own });
4840
+ if (results.length > 0) out.push({ role: "user", content: results });
4841
+ return out;
4842
+ }
4843
+ function splitParts(parts) {
4844
+ const own = [];
4845
+ const results = [];
4846
+ for (const part of parts) {
4847
+ if (part.type === "tool_result") {
4848
+ results.push(toToolResult(part));
4849
+ continue;
4850
+ }
4851
+ if (part.type === "text" && part.text.length === 0) continue;
4852
+ own.push({ ...part });
4853
+ }
4854
+ return { own, results };
4855
+ }
4856
+ function toToolResult(part) {
4857
+ return {
4858
+ type: "tool_result",
4859
+ toolUseId: part.toolUseId,
4860
+ // `SessionMessagePart` holds the blocks readonly and `LlmToolResultPart` takes a mutable array:
4861
+ // same elements, different variance, so the copy is the whole conversion.
4862
+ content: typeof part.content === "string" ? part.content : [...part.content],
4863
+ ...part.isError === void 0 ? {} : { isError: part.isError }
4864
+ };
4865
+ }
4866
+
4817
4867
  // src/internal/agent-loop/live-events.ts
4818
4868
  var LiveEventLog = class extends Array {
4819
4869
  /**
@@ -4965,10 +5015,7 @@ async function initLoopContext(inputs) {
4965
5015
  buildUserEvent(inputs)
4966
5016
  ]);
4967
5017
  if (inputs.onLoopEvent !== void 0) events.subscribe(inputs.onLoopEvent);
4968
- const priorMessages = (inputs.priorMessages ?? []).map((msg) => ({
4969
- role: msg.role,
4970
- content: [{ type: "text", text: msg.text }]
4971
- }));
5018
+ const priorMessages = replayMessages(inputs.priorMessages ?? []);
4972
5019
  let memorySystemPromptAdditions;
4973
5020
  if (inputs.memoryProvider !== void 0 && memoryProviderHandle !== void 0) {
4974
5021
  try {
@@ -7062,7 +7109,7 @@ function applyPersonalityFilter(exposedTools, whitelist, opts) {
7062
7109
  if (exposedSet.has(name)) continue;
7063
7110
  const hint = suggestClosest(name, exposedSet);
7064
7111
  const message = hint !== void 0 ? `[theokit-sdk] personality "${opts?.personalityName ?? "?"}" references unknown tool "${name}"; did you mean "${hint}"?` : `[theokit-sdk] personality "${opts?.personalityName ?? "?"}" references unknown tool "${name}" (not exposed)`;
7065
- chunkZCIRZE37_cjs.warnOnce(
7112
+ chunkVCLBZAZU_cjs.warnOnce(
7066
7113
  `personality-tool-missing|${opts?.agentId ?? "?"}|${opts?.personalityName ?? "?"}|${name}`,
7067
7114
  message
7068
7115
  );
@@ -7787,7 +7834,7 @@ async function reloadLocalAgent(agent) {
7787
7834
  if (agent.context !== void 0) await agent.context.refresh();
7788
7835
  if (agent.skillsManager !== void 0) await agent.skillsManager.refresh();
7789
7836
  if (agent.pluginsManager !== void 0) await agent.pluginsManager.refresh();
7790
- return await chunkCQBXOJ6U_cjs.loadSubagents(
7837
+ return await chunk43ZQRWAP_cjs.loadSubagents(
7791
7838
  agent.workspaceCwd,
7792
7839
  agent.settingSourcesIncludeProject,
7793
7840
  agent.options.agents
@@ -8879,7 +8926,7 @@ function addEntity(byName, entity, origin, collisionMap) {
8879
8926
  );
8880
8927
  }
8881
8928
  if (origin === "project" && collisionMap?.has(fm.name)) {
8882
- chunkZCIRZE37_cjs.warnOnce(
8929
+ chunkVCLBZAZU_cjs.warnOnce(
8883
8930
  `personality-collision-${fm.name}`,
8884
8931
  `[theokit-sdk] personality "${fm.name}" overridden by project preset`
8885
8932
  );
@@ -8929,14 +8976,14 @@ async function performPersonalitySwitch(args) {
8929
8976
 
8930
8977
  // src/internal/local-agent/local-agent-personality-extensions.ts
8931
8978
  function resolveActivePersonalityPreset(args) {
8932
- const forkCtx = chunkZCIRZE37_cjs.currentPersonalityContext();
8979
+ const forkCtx = chunkVCLBZAZU_cjs.currentPersonalityContext();
8933
8980
  const slug = forkCtx !== void 0 ? forkCtx.slug : args.personalityStore.active(args.agentId);
8934
8981
  if (slug === void 0) return void 0;
8935
8982
  return args.personalityRegistry?.get(slug);
8936
8983
  }
8937
8984
  async function ensurePersonalityRegistryIfNeeded(args) {
8938
8985
  if (args.personalityRegistry !== void 0) return args.personalityRegistry;
8939
- const forkSlug = chunkZCIRZE37_cjs.currentPersonalityContext()?.slug;
8986
+ const forkSlug = chunkVCLBZAZU_cjs.currentPersonalityContext()?.slug;
8940
8987
  const ownSlug = args.personalityStore.active(args.agentId);
8941
8988
  if (forkSlug === void 0 && ownSlug === void 0) return void 0;
8942
8989
  return await PersonalityRegistry.load(args.workspaceCwd);
@@ -8950,8 +8997,8 @@ ${preset.systemPrompt}`;
8950
8997
  }
8951
8998
  async function localAgentUsePersonality(args) {
8952
8999
  if (args.disposed) throw new Error("Agent has been disposed");
8953
- if (chunkZCIRZE37_cjs.currentPersonalityContext() !== void 0) {
8954
- chunkZCIRZE37_cjs.warnPersonalitySwitchInsideFork(args.agentId);
9000
+ if (chunkVCLBZAZU_cjs.currentPersonalityContext() !== void 0) {
9001
+ chunkVCLBZAZU_cjs.warnPersonalitySwitchInsideFork(args.agentId);
8955
9002
  return null;
8956
9003
  }
8957
9004
  let registry = args.personalityRegistry;
@@ -9013,7 +9060,7 @@ async function* localAgentStreamToCompletion(agent, message, options) {
9013
9060
  async function localAgentFork(parent, options) {
9014
9061
  const { forkAgentImpl } = await import('./fork-agent-Y2IK2RYU.cjs');
9015
9062
  const { getAgentFacade } = await import('./agent-factory-registry-UU46BUMU.cjs');
9016
- const { withPersonalityContext } = await import('./context-AGQ3DIZU.cjs');
9063
+ const { withPersonalityContext } = await import('./context-WFLTTMK3.cjs');
9017
9064
  const create = getAgentFacade().create;
9018
9065
  return withPersonalityContext(
9019
9066
  { slug: parent.personalitySlugSnapshot, isFork: true },
@@ -9652,6 +9699,59 @@ function registerRunAsTask(run, agentId, taskOpt, userText) {
9652
9699
  });
9653
9700
  }
9654
9701
 
9702
+ // src/internal/local-agent/local-option-keys.ts
9703
+ var KNOWN_LOCAL_OPTION_KEYS = /* @__PURE__ */ new Set([
9704
+ "cwd",
9705
+ "settingSources",
9706
+ "sandboxOptions",
9707
+ "sessionDir",
9708
+ "baseDir",
9709
+ "sessionStore"
9710
+ ]);
9711
+ var reported = /* @__PURE__ */ new Set();
9712
+ function distance(a, b) {
9713
+ let previous = Array.from({ length: b.length + 1 }, (_, j) => j);
9714
+ for (let i = 1; i <= a.length; i++) {
9715
+ const current = [i, ...new Array(b.length).fill(0)];
9716
+ for (let j = 1; j <= b.length; j++) {
9717
+ const cost = a.charAt(i - 1) === b.charAt(j - 1) ? 0 : 1;
9718
+ current[j] = Math.min(
9719
+ (previous[j] ?? 0) + 1,
9720
+ (current[j - 1] ?? 0) + 1,
9721
+ (previous[j - 1] ?? 0) + cost
9722
+ );
9723
+ }
9724
+ previous = current;
9725
+ }
9726
+ return previous[b.length] ?? 0;
9727
+ }
9728
+ function nearest(key) {
9729
+ let best;
9730
+ let bestDistance = 4;
9731
+ for (const known of KNOWN_LOCAL_OPTION_KEYS) {
9732
+ const d = distance(key.toLowerCase(), known.toLowerCase());
9733
+ if (d < bestDistance) {
9734
+ bestDistance = d;
9735
+ best = known;
9736
+ }
9737
+ }
9738
+ return best;
9739
+ }
9740
+ function reportUnknownLocalOptions(local) {
9741
+ if (local === void 0) return;
9742
+ for (const key of Object.keys(local)) {
9743
+ if (KNOWN_LOCAL_OPTION_KEYS.has(key)) continue;
9744
+ if (reported.has(key)) continue;
9745
+ reported.add(key);
9746
+ const guess = nearest(key);
9747
+ const hint = guess === void 0 ? "" : ` Did you mean \`${guess}\`?`;
9748
+ chunkEG4QM7ZJ_cjs.diag(
9749
+ `[theokit] \`local.${key}\` is not an option this SDK version knows, so it was ignored.${hint}
9750
+ `
9751
+ );
9752
+ }
9753
+ }
9754
+
9655
9755
  // src/internal/local-agent/local-agent.ts
9656
9756
  var LocalAgent = class {
9657
9757
  agentId;
@@ -9732,6 +9832,7 @@ var LocalAgent = class {
9732
9832
  if (sub.skills !== void 0) this.skills = sub.skills;
9733
9833
  this.pluginsManager = sub.pluginsManager;
9734
9834
  if (sub.plugins !== void 0) this.plugins = sub.plugins;
9835
+ reportUnknownLocalOptions(options.local);
9735
9836
  this.hooksExecutor = new HooksExecutor(this.workspaceCwd);
9736
9837
  this.memoryGlue = new LocalAgentMemory(options, this.workspaceCwd, this.agentId);
9737
9838
  this.defaultMemoryProviderForLoop = createLocalAgentMemoryProvider({
@@ -9760,7 +9861,7 @@ var LocalAgent = class {
9760
9861
  if (this.pluginsManager !== void 0) await this.pluginsManager.initialize();
9761
9862
  const codePlugins = chunkBV2MWEMV_cjs.extractCodePlugins(this.options.plugins);
9762
9863
  await this.pluginManagerCode.initialize(codePlugins);
9763
- this.resolvedSubagents = await chunkCQBXOJ6U_cjs.loadSubagents(
9864
+ this.resolvedSubagents = await chunk43ZQRWAP_cjs.loadSubagents(
9764
9865
  this.workspaceCwd,
9765
9866
  this.settingSourcesIncludeProject,
9766
9867
  this.options.agents
@@ -10722,7 +10823,7 @@ var Agent = class _Agent {
10722
10823
  */
10723
10824
  static async describe(agentId) {
10724
10825
  const agent = await getRegisteredAgentOrThrow(agentId);
10725
- const { loadSubagents: loadSubagents2 } = await import('./subagents-loader-YEUFFPAL.cjs');
10826
+ const { loadSubagents: loadSubagents2 } = await import('./subagents-loader-UCNO7FUH.cjs');
10726
10827
  const settingSources = agent.options.local?.settingSources;
10727
10828
  const subagents = await loadSubagents2(
10728
10829
  agent.cwd ?? process.cwd(),
@@ -10807,5 +10908,5 @@ exports.computeCost = computeCost;
10807
10908
  exports.generateCronId = generateCronId;
10808
10909
  exports.getPricingEntry = getPricingEntry;
10809
10910
  exports.openRouterMemoryEmbeddingProviderAdapter = openRouterMemoryEmbeddingProviderAdapter;
10810
- //# sourceMappingURL=chunk-JJ3OVRUM.cjs.map
10811
- //# sourceMappingURL=chunk-JJ3OVRUM.cjs.map
10911
+ //# sourceMappingURL=chunk-7VT4P3Z4.cjs.map
10912
+ //# sourceMappingURL=chunk-7VT4P3Z4.cjs.map