@theokit/sdk 5.0.0-next.1 → 5.0.0-next.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.
Files changed (79) hide show
  1. package/CHANGELOG.md +162 -0
  2. package/dist/{agent-CgNzshyV.d.cts → agent-C3KO5LKm.d.cts} +49 -3
  3. package/dist/{agent-CdYJfKr6.d.ts → agent-CvmTR9uf.d.ts} +49 -3
  4. package/dist/{agent-2E7DI47Y.cjs → agent-GPV2JWZG.cjs} +7 -7
  5. package/dist/{agent-2E7DI47Y.cjs.map → agent-GPV2JWZG.cjs.map} +1 -1
  6. package/dist/{agent-XMKRP27S.js → agent-Y24I5JBM.js} +6 -6
  7. package/dist/{agent-XMKRP27S.js.map → agent-Y24I5JBM.js.map} +1 -1
  8. package/dist/{chunk-XCCGNU3D.js → chunk-4S5TWFIZ.js} +5 -5
  9. package/dist/chunk-4S5TWFIZ.js.map +1 -0
  10. package/dist/{chunk-JTZ74HFD.js → chunk-67ADYSTW.js} +29 -9
  11. package/dist/chunk-67ADYSTW.js.map +1 -0
  12. package/dist/{chunk-CEILSTWB.cjs → chunk-GGZ5GPE3.cjs} +29 -8
  13. package/dist/chunk-GGZ5GPE3.cjs.map +1 -0
  14. package/dist/{chunk-HWSALKOR.cjs → chunk-H6YM3PV6.cjs} +5 -5
  15. package/dist/chunk-H6YM3PV6.cjs.map +1 -0
  16. package/dist/{chunk-NCGWJ3HS.js → chunk-KDR53EO7.js} +71 -32
  17. package/dist/chunk-KDR53EO7.js.map +1 -0
  18. package/dist/{chunk-WMH2MSOP.cjs → chunk-QUAEOKDW.cjs} +95 -56
  19. package/dist/chunk-QUAEOKDW.cjs.map +1 -0
  20. package/dist/{chunk-G4ZGYKJG.cjs → chunk-SYVWE64W.cjs} +6 -6
  21. package/dist/chunk-SYVWE64W.cjs.map +1 -0
  22. package/dist/{chunk-7ZK4DJD7.cjs → chunk-VXDEKILY.cjs} +4 -4
  23. package/dist/{chunk-7ZK4DJD7.cjs.map → chunk-VXDEKILY.cjs.map} +1 -1
  24. package/dist/{chunk-IJM7UGS5.js → chunk-XJZEBGXD.js} +5 -5
  25. package/dist/chunk-XJZEBGXD.js.map +1 -0
  26. package/dist/{chunk-6HIACV34.js → chunk-ZH26RNQA.js} +3 -3
  27. package/dist/{chunk-6HIACV34.js.map → chunk-ZH26RNQA.js.map} +1 -1
  28. package/dist/{context-74SBFD27.cjs → context-NI33FS2R.cjs} +7 -7
  29. package/dist/{context-74SBFD27.cjs.map → context-NI33FS2R.cjs.map} +1 -1
  30. package/dist/context-Y7B7SI5X.js +6 -0
  31. package/dist/{context-NZ2AC6S7.js.map → context-Y7B7SI5X.js.map} +1 -1
  32. package/dist/{cron-Bw6mSgD4.d.cts → cron-C3PhZED0.d.cts} +1 -1
  33. package/dist/{cron-DJv9oXSZ.d.ts → cron-crfMMdAw.d.ts} +1 -1
  34. package/dist/cron.cjs +6 -6
  35. package/dist/cron.d.cts +3 -3
  36. package/dist/cron.d.ts +3 -3
  37. package/dist/cron.js +5 -5
  38. package/dist/eval.cjs +5 -5
  39. package/dist/eval.js +4 -4
  40. package/dist/index.cjs +20 -20
  41. package/dist/index.d.cts +5 -5
  42. package/dist/index.d.ts +5 -5
  43. package/dist/index.js +7 -7
  44. package/dist/internal/persistence/index.cjs +4 -4
  45. package/dist/internal/persistence/index.js +1 -1
  46. package/dist/internal/persistence/paths.d.cts +25 -12
  47. package/dist/internal/persistence/paths.d.ts +25 -12
  48. package/dist/internal/runtime/compat/compat-config-file.d.ts +31 -0
  49. package/dist/internal/runtime/compat/foreign-config-sources.d.ts +31 -1
  50. package/dist/internal/runtime/hooks/hooks-executor.d.ts +2 -1
  51. package/dist/internal/runtime/plugin-loader/plugin-bundles.d.ts +2 -1
  52. package/dist/{sdk-agent-Dxjb0IfM.d.cts → sdk-agent-BOiKqOgL.d.cts} +28 -1
  53. package/dist/{sdk-agent-ldzpyAaF.d.ts → sdk-agent-D4a_BR_6.d.ts} +28 -1
  54. package/dist/subagents-loader-TPZLTXYZ.cjs +16 -0
  55. package/dist/{subagents-loader-YWFE7KYE.cjs.map → subagents-loader-TPZLTXYZ.cjs.map} +1 -1
  56. package/dist/subagents-loader-Y6JFYXAY.js +7 -0
  57. package/dist/{subagents-loader-LSKM2UIK.js.map → subagents-loader-Y6JFYXAY.js.map} +1 -1
  58. package/dist/subagents-loader.cjs +3 -3
  59. package/dist/subagents-loader.d.cts +2 -2
  60. package/dist/subagents-loader.d.ts +2 -2
  61. package/dist/subagents-loader.js +2 -2
  62. package/dist/types/agent.d.ts +47 -1
  63. package/dist/types/sdk-agent.d.ts +28 -1
  64. package/dist/workflow.d.cts +1 -1
  65. package/dist/workflow.d.ts +1 -1
  66. package/docs/error-codes.md +21 -21
  67. package/docs/harness-capability-map.md +3 -1
  68. package/package.json +1 -1
  69. package/dist/chunk-CEILSTWB.cjs.map +0 -1
  70. package/dist/chunk-G4ZGYKJG.cjs.map +0 -1
  71. package/dist/chunk-HWSALKOR.cjs.map +0 -1
  72. package/dist/chunk-IJM7UGS5.js.map +0 -1
  73. package/dist/chunk-JTZ74HFD.js.map +0 -1
  74. package/dist/chunk-NCGWJ3HS.js.map +0 -1
  75. package/dist/chunk-WMH2MSOP.cjs.map +0 -1
  76. package/dist/chunk-XCCGNU3D.js.map +0 -1
  77. package/dist/context-NZ2AC6S7.js +0 -6
  78. package/dist/subagents-loader-LSKM2UIK.js +0 -7
  79. package/dist/subagents-loader-YWFE7KYE.cjs +0 -16
@@ -3,7 +3,7 @@
3
3
  var chunkKVSAY6NZ_cjs = require('./chunk-KVSAY6NZ.cjs');
4
4
  var chunkY2KYR2ED_cjs = require('./chunk-Y2KYR2ED.cjs');
5
5
  var chunk2NE7DTOK_cjs = require('./chunk-2NE7DTOK.cjs');
6
- var chunkHWSALKOR_cjs = require('./chunk-HWSALKOR.cjs');
6
+ var chunkH6YM3PV6_cjs = require('./chunk-H6YM3PV6.cjs');
7
7
  var chunkBV2MWEMV_cjs = require('./chunk-BV2MWEMV.cjs');
8
8
  var chunkD6POWE7E_cjs = require('./chunk-D6POWE7E.cjs');
9
9
  var chunkTMKTSYDS_cjs = require('./chunk-TMKTSYDS.cjs');
@@ -26,8 +26,8 @@ var chunkGZV6AVRL_cjs = require('./chunk-GZV6AVRL.cjs');
26
26
  var chunkBJUJT5ED_cjs = require('./chunk-BJUJT5ED.cjs');
27
27
  var chunkZF2LDKQQ_cjs = require('./chunk-ZF2LDKQQ.cjs');
28
28
  var chunkJLRLCBJ4_cjs = require('./chunk-JLRLCBJ4.cjs');
29
- var chunkG4ZGYKJG_cjs = require('./chunk-G4ZGYKJG.cjs');
30
- var chunkCEILSTWB_cjs = require('./chunk-CEILSTWB.cjs');
29
+ var chunkSYVWE64W_cjs = require('./chunk-SYVWE64W.cjs');
30
+ var chunkGGZ5GPE3_cjs = require('./chunk-GGZ5GPE3.cjs');
31
31
  var chunkHW7SEELD_cjs = require('./chunk-HW7SEELD.cjs');
32
32
  var chunkATT276RD_cjs = require('./chunk-ATT276RD.cjs');
33
33
  var chunk3EE6LVWT_cjs = require('./chunk-3EE6LVWT.cjs');
@@ -39,10 +39,10 @@ var chunk6LHQPOMI_cjs = require('./chunk-6LHQPOMI.cjs');
39
39
  var promises = require('fs/promises');
40
40
  var crypto = require('crypto');
41
41
  var path = require('path');
42
+ var fs = require('fs');
42
43
  var child_process = require('child_process');
43
44
  var zod = require('zod');
44
45
  var module$1 = require('module');
45
- var fs = require('fs');
46
46
  var os = require('os');
47
47
 
48
48
  var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
@@ -272,7 +272,7 @@ function enabledPluginNames(plugins) {
272
272
  // src/internal/runtime/registry/agent-registry-store.ts
273
273
  var SCHEMA_VERSION = 1;
274
274
  var LEGACY_SCHEMA_VERSION_STRING = "1.0";
275
- var REGISTRY_RELATIVE_PATH = path.join(".theokit", "agents", "registry.json");
275
+ var REGISTRY_RELATIVE_SUFFIX = path.join("agents", "registry.json");
276
276
  function stripSecretsFromOptions(options) {
277
277
  return assignDefined({
278
278
  name: options.name,
@@ -382,7 +382,7 @@ function serializeAgents(agents2) {
382
382
  return out;
383
383
  }
384
384
  function registryPath(cwd) {
385
- return path.join(cwd, REGISTRY_RELATIVE_PATH);
385
+ return path.join(chunkGGZ5GPE3_cjs.theokitConfigRoot(cwd), REGISTRY_RELATIVE_SUFFIX);
386
386
  }
387
387
  async function loadRegistry(cwd) {
388
388
  void chunkJLRLCBJ4_cjs.sweepStaleAtomicTemps(registryPath(cwd)).catch(() => void 0);
@@ -2121,14 +2121,14 @@ async function readState(filePath) {
2121
2121
  try {
2122
2122
  parsed = JSON.parse(raw);
2123
2123
  } catch {
2124
- chunkHWSALKOR_cjs.warnOnce(
2124
+ chunkH6YM3PV6_cjs.warnOnce(
2125
2125
  "personality-store-json-parse",
2126
2126
  "[theokit-sdk] personality.json is malformed; treating as empty"
2127
2127
  );
2128
2128
  return emptyState();
2129
2129
  }
2130
2130
  if (!isStateV1(parsed)) {
2131
- chunkHWSALKOR_cjs.warnOnce(
2131
+ chunkH6YM3PV6_cjs.warnOnce(
2132
2132
  "personality-store-bad-version",
2133
2133
  `[theokit-sdk] personality.json has unknown version; treating as empty (file kept untouched)`
2134
2134
  );
@@ -2159,7 +2159,7 @@ var PersonalityStore = class {
2159
2159
  try {
2160
2160
  await this.#persist(agentId, slug);
2161
2161
  } catch (err) {
2162
- chunkHWSALKOR_cjs.warnOnce(
2162
+ chunkH6YM3PV6_cjs.warnOnce(
2163
2163
  `personality-store-persist-failure-${agentId}`,
2164
2164
  `[theokit-sdk] personality persist failed for ${chunk6LHQPOMI_cjs.redactSecrets(agentId)}: ${chunk6LHQPOMI_cjs.redactSecrets(
2165
2165
  err.message
@@ -2176,7 +2176,7 @@ var PersonalityStore = class {
2176
2176
  try {
2177
2177
  state = await readState(filePath);
2178
2178
  } catch (err) {
2179
- chunkHWSALKOR_cjs.warnOnce(
2179
+ chunkH6YM3PV6_cjs.warnOnce(
2180
2180
  `personality-store-hydrate-failure-${agentId}`,
2181
2181
  `[theokit-sdk] personality hydrate failed for ${chunk6LHQPOMI_cjs.redactSecrets(agentId)}: ${chunk6LHQPOMI_cjs.redactSecrets(
2182
2182
  err.message
@@ -2205,7 +2205,7 @@ var PersonalityStore = class {
2205
2205
  });
2206
2206
  }
2207
2207
  #filePath() {
2208
- return path.join(chunkCEILSTWB_cjs.getTheokitHome(this.#cwd), FILE_NAME);
2208
+ return path.join(chunkGGZ5GPE3_cjs.getTheokitHome(this.#cwd), FILE_NAME);
2209
2209
  }
2210
2210
  };
2211
2211
 
@@ -2521,6 +2521,37 @@ function removeAll(arr, toRemove) {
2521
2521
  if (idx !== -1) arr.splice(idx, 1);
2522
2522
  }
2523
2523
  }
2524
+ function readCompatConfigFile(cwd) {
2525
+ const path$1 = path.join(chunkGGZ5GPE3_cjs.theokitConfigRoot(cwd), "config.json");
2526
+ if (!fs.existsSync(path$1)) return [];
2527
+ let raw;
2528
+ try {
2529
+ raw = fs.readFileSync(path$1, "utf8");
2530
+ } catch {
2531
+ return [];
2532
+ }
2533
+ let parsed;
2534
+ try {
2535
+ parsed = JSON.parse(raw);
2536
+ } catch (cause) {
2537
+ chunk6LHQPOMI_cjs.diag(
2538
+ `[theokit] ${path$1} is not valid JSON \u2014 ignoring its "compat.adapters" (${cause.message}).
2539
+ `
2540
+ );
2541
+ return [];
2542
+ }
2543
+ const adapters = parsed.compat?.adapters;
2544
+ if (adapters === void 0) return [];
2545
+ if (!Array.isArray(adapters)) {
2546
+ chunk6LHQPOMI_cjs.diag(`[theokit] ${path$1}: "compat.adapters" must be an array \u2014 ignoring it.
2547
+ `);
2548
+ return [];
2549
+ }
2550
+ return adapters;
2551
+ }
2552
+ function resolveCompatSources(options, cwd) {
2553
+ return options.local?.compatSources ?? readCompatConfigFile(cwd);
2554
+ }
2524
2555
  function spawnAndCollect(options) {
2525
2556
  return new Promise((resolve) => {
2526
2557
  const timeoutMs = options.timeoutMs ?? 3e4;
@@ -2583,7 +2614,7 @@ var HooksExecutor = class {
2583
2614
  this.config = {};
2584
2615
  return;
2585
2616
  }
2586
- this.config = await chunkHWSALKOR_cjs.loadHookConfig(this.cwd, this.compatSources);
2617
+ this.config = await chunkH6YM3PV6_cjs.loadHookConfig(this.cwd, this.compatSources);
2587
2618
  }
2588
2619
  /** Fire every hook registered for `event` and aggregate the decisions. */
2589
2620
  async run(payload) {
@@ -2636,7 +2667,7 @@ var HooksExecutor = class {
2636
2667
  if (result.exitCode !== 0) {
2637
2668
  const stderr = result.stderr.trim();
2638
2669
  const base = stderr.length > 0 ? stderr : `Hook exited with code ${result.exitCode}`;
2639
- const missing = chunkCEILSTWB_cjs.undefinedVariablesIn(command.command, env);
2670
+ const missing = chunkGGZ5GPE3_cjs.undefinedVariablesIn(command.command, env);
2640
2671
  if (missing.length === 0) return { decision: "deny", reason: base };
2641
2672
  return {
2642
2673
  decision: "deny",
@@ -2648,7 +2679,7 @@ var HooksExecutor = class {
2648
2679
  };
2649
2680
  function runtimeEnvFor(sourcePath, cwd) {
2650
2681
  if (sourcePath === void 0) return {};
2651
- return chunkCEILSTWB_cjs.adapterForConfigPath(sourcePath)?.runtimeEnv(cwd) ?? {};
2682
+ return chunkGGZ5GPE3_cjs.adapterForConfigPath(sourcePath)?.runtimeEnv(cwd) ?? {};
2652
2683
  }
2653
2684
  function parseDecisionFromStdout(stdout) {
2654
2685
  const trimmed = stdout.trim();
@@ -2821,8 +2852,10 @@ var SkillsManager = class {
2821
2852
  }
2822
2853
  async refresh() {
2823
2854
  const roots = this.skillsDir === void 0 ? [
2824
- ...chunkCEILSTWB_cjs.projectConfigRoots(this.cwd, this.compatSources).map((root) => path.join(root, "skills")),
2825
- ...(await chunkG4ZGYKJG_cjs.pluginBundleDirs(this.cwd, this.compatSources)).map((b) => path.join(b, "skills"))
2855
+ ...chunkGGZ5GPE3_cjs.projectConfigRoots(this.cwd, this.compatSources, "skills").map(
2856
+ (root) => path.join(root, "skills")
2857
+ ),
2858
+ ...(await chunkSYVWE64W_cjs.pluginBundleDirs(this.cwd, this.compatSources)).map((b) => path.join(b, "skills"))
2826
2859
  ] : [this.skillsDir];
2827
2860
  const discovered = [];
2828
2861
  const seen = /* @__PURE__ */ new Set();
@@ -2966,7 +2999,7 @@ async function resolveSendSkills(inputs, userText, memoryFacts) {
2966
2999
  inputs.settingSourcesIncludeProject,
2967
3000
  settings.skillsDir,
2968
3001
  settings.inline,
2969
- inputs.options.local?.compatSources ?? []
3002
+ resolveCompatSources(inputs.options, inputs.workspaceCwd)
2970
3003
  );
2971
3004
  await manager.initialize();
2972
3005
  return { manager, autoInject: settings.autoInject ?? true };
@@ -3406,7 +3439,7 @@ var HISTOGRAM_NAMES = {
3406
3439
  };
3407
3440
  function safeRequire(moduleName) {
3408
3441
  try {
3409
- const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-WMH2MSOP.cjs', document.baseURI).href)));
3442
+ const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-QUAEOKDW.cjs', document.baseURI).href)));
3410
3443
  return r(moduleName);
3411
3444
  } catch {
3412
3445
  return void 0;
@@ -3649,7 +3682,7 @@ var cachedOtel;
3649
3682
  function loadOtel() {
3650
3683
  if (cachedOtel === void 0) {
3651
3684
  try {
3652
- const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-WMH2MSOP.cjs', document.baseURI).href)));
3685
+ const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-QUAEOKDW.cjs', document.baseURI).href)));
3653
3686
  const mod = r("@opentelemetry/api");
3654
3687
  cachedOtel = mod;
3655
3688
  } catch {
@@ -4103,8 +4136,8 @@ var FileContextManager = class {
4103
4136
  }
4104
4137
  };
4105
4138
  async function loadContextConfig(cwd) {
4106
- const mdDir = path.join(cwd, ".theokit", "context");
4107
- const jsonPath = path.join(cwd, ".theokit", "context.json");
4139
+ const mdDir = path.join(chunkGGZ5GPE3_cjs.theokitConfigRoot(cwd), "context");
4140
+ const jsonPath = path.join(chunkGGZ5GPE3_cjs.theokitConfigRoot(cwd), "context.json");
4108
4141
  const mdEntities = await loadMarkdownEntities({
4109
4142
  dir: mdDir,
4110
4143
  schema: ContextSourceFrontmatterSchema,
@@ -4113,7 +4146,7 @@ async function loadContextConfig(cwd) {
4113
4146
  });
4114
4147
  if (mdEntities.length > 0) {
4115
4148
  if (fs.existsSync(jsonPath)) {
4116
- chunkHWSALKOR_cjs.warnOnce(
4149
+ chunkH6YM3PV6_cjs.warnOnce(
4117
4150
  "context-both-present",
4118
4151
  "[theokit-sdk] both .theokit/context/ and .theokit/context.json detected \u2014 using markdown; remove context.json"
4119
4152
  );
@@ -4123,7 +4156,7 @@ async function loadContextConfig(cwd) {
4123
4156
  };
4124
4157
  }
4125
4158
  if (!fs.existsSync(jsonPath)) return { sources: [] };
4126
- chunkHWSALKOR_cjs.warnOnce(
4159
+ chunkH6YM3PV6_cjs.warnOnce(
4127
4160
  "context-json-deprecated",
4128
4161
  // Names no command: `theokit-migrate-config` was unpublished with the `bin` entry, and a warning
4129
4162
  // that tells you to run something the package does not ship is worse than one that tells you
@@ -4264,7 +4297,7 @@ var PluginsManager = class {
4264
4297
  }
4265
4298
  async refresh() {
4266
4299
  this.plugins = [];
4267
- for (const pluginsRoot of chunkCEILSTWB_cjs.pluginBundleRoots(this.cwd, this.compatSources)) {
4300
+ for (const pluginsRoot of chunkGGZ5GPE3_cjs.pluginBundleRoots(this.cwd, this.compatSources)) {
4268
4301
  await this.refreshRoot(pluginsRoot);
4269
4302
  }
4270
4303
  }
@@ -4276,7 +4309,7 @@ var PluginsManager = class {
4276
4309
  const folderName = entry.name;
4277
4310
  const cliPath = path.join(pluginsRoot, folderName, ".claude-plugin", "plugin.json");
4278
4311
  if (fs.existsSync(cliPath)) {
4279
- const cliMetadata = await loadPluginManifestFromJson(cliPath, folderName);
4312
+ const cliMetadata = await loadPluginManifestFromJson(this.cwd, cliPath, folderName);
4280
4313
  if (this.enabled === void 0 || this.enabled.includes(cliMetadata.name)) {
4281
4314
  this.plugins.push(cliMetadata);
4282
4315
  }
@@ -4284,22 +4317,22 @@ var PluginsManager = class {
4284
4317
  }
4285
4318
  const mdPath = path.join(pluginsRoot, folderName, "PLUGIN.md");
4286
4319
  const jsonPath = path.join(pluginsRoot, folderName, "plugin.json");
4287
- const metadata = fs.existsSync(mdPath) ? await loadPluginManifestFromMarkdown(pluginsRoot, folderName) : await loadPluginManifestFromJson(jsonPath, folderName);
4320
+ const metadata = fs.existsSync(mdPath) ? await loadPluginManifestFromMarkdown(this.cwd, pluginsRoot, folderName) : await loadPluginManifestFromJson(this.cwd, jsonPath, folderName);
4288
4321
  if (fs.existsSync(mdPath) && fs.existsSync(jsonPath)) {
4289
- chunkHWSALKOR_cjs.warnOnce(
4322
+ chunkH6YM3PV6_cjs.warnOnce(
4290
4323
  `plugin-${folderName}-both`,
4291
4324
  `[theokit-sdk] both ${folderName}/PLUGIN.md and ${folderName}/plugin.json detected \u2014 using markdown; remove plugin.json`
4292
4325
  );
4293
4326
  }
4294
4327
  if (!fs.existsSync(mdPath) && fs.existsSync(jsonPath)) {
4295
- chunkHWSALKOR_cjs.warnOnce(
4328
+ chunkH6YM3PV6_cjs.warnOnce(
4296
4329
  "plugin-json-deprecated",
4297
4330
  // Same reason as the context.json warning: the CLI it used to name is no longer published.
4298
4331
  "[theokit-sdk] plugin.json manifests are deprecated; replace each with a PLUGIN.md"
4299
4332
  );
4300
4333
  }
4301
4334
  if (this.enabled === void 0 || this.enabled.includes(metadata.name)) {
4302
- await this.assertEntryFileExists(metadata, folderName);
4335
+ await this.assertEntryFileExists(metadata, folderName, pluginsRoot);
4303
4336
  this.plugins.push(metadata);
4304
4337
  }
4305
4338
  }
@@ -4307,10 +4340,10 @@ var PluginsManager = class {
4307
4340
  list() {
4308
4341
  return Promise.resolve(this.plugins);
4309
4342
  }
4310
- async assertEntryFileExists(metadata, folderName) {
4343
+ async assertEntryFileExists(metadata, folderName, pluginsRoot) {
4311
4344
  const entry = metadata.entry;
4312
4345
  if (entry === void 0) return;
4313
- const pluginRoot = path.join(this.cwd, ".theokit", "plugins", folderName);
4346
+ const pluginRoot = path.join(pluginsRoot, folderName);
4314
4347
  const entryPath = chunk7A6535RA_cjs.safePathJoin(pluginRoot, entry);
4315
4348
  try {
4316
4349
  await promises.readFile(entryPath, "utf8");
@@ -4346,7 +4379,7 @@ var PluginsManager = class {
4346
4379
  }
4347
4380
  }
4348
4381
  };
4349
- async function loadPluginManifestFromJson(manifestPath, folderName) {
4382
+ async function loadPluginManifestFromJson(cwd, manifestPath, folderName) {
4350
4383
  let raw;
4351
4384
  try {
4352
4385
  raw = await promises.readFile(manifestPath, "utf8");
@@ -4374,12 +4407,12 @@ async function loadPluginManifestFromJson(manifestPath, folderName) {
4374
4407
  const name = typeof record.name === "string" ? record.name : folderName;
4375
4408
  const version = typeof record.version === "string" ? record.version : "0.0.0";
4376
4409
  const capabilities = Array.isArray(record.capabilities) ? record.capabilities.filter((cap) => typeof cap === "string") : [];
4377
- const source = manifestPath.slice(manifestPath.indexOf(".theokit/"));
4410
+ const source = path.relative(cwd, manifestPath);
4378
4411
  const metadata = { name, version, capabilities, source };
4379
4412
  if (typeof record.entry === "string") metadata.entry = record.entry;
4380
4413
  return metadata;
4381
4414
  }
4382
- async function loadPluginManifestFromMarkdown(pluginsRoot, folderName) {
4415
+ async function loadPluginManifestFromMarkdown(cwd, pluginsRoot, folderName) {
4383
4416
  const mdPath = path.join(pluginsRoot, folderName, "PLUGIN.md");
4384
4417
  let raw;
4385
4418
  try {
@@ -4405,7 +4438,7 @@ async function loadPluginManifestFromMarkdown(pluginsRoot, folderName) {
4405
4438
  });
4406
4439
  }
4407
4440
  const fm = entity.frontmatter;
4408
- const source = mdPath.slice(mdPath.indexOf(".theokit/"));
4441
+ const source = path.relative(cwd, mdPath);
4409
4442
  const metadata = {
4410
4443
  name: fm.name ?? folderName,
4411
4444
  version: fm.version ?? "0.0.0",
@@ -4461,14 +4494,20 @@ function buildSkills(args, out) {
4461
4494
  staticSkills?.inline,
4462
4495
  // #524 — the same declaration the per-send manager reads. Omitting it here would make
4463
4496
  // `agent.skills` disagree with the system prompt about which skills exist.
4464
- args.options.local?.compatSources ?? []
4497
+ resolveCompatSources(args.options, args.workspaceCwd)
4465
4498
  );
4466
4499
  const localSkills = out.skillsManager;
4467
4500
  out.skills = {
4468
4501
  // Project to the public shape (name + description only). Inline skills carry
4469
4502
  // their body + references on the object; `list()` must never leak them —
4470
4503
  // the body is reachable exclusively through `get()`.
4471
- list: async () => (await localSkills.list()).map((s) => ({ name: s.name, description: s.description })),
4504
+ list: async () => (await localSkills.list()).map((s) => ({
4505
+ name: s.name,
4506
+ description: s.description,
4507
+ // The PATH, never the body. Dropping it with the body answered a question nobody asked and
4508
+ // silenced the one #524 is about: which root did this skill come from.
4509
+ ...s.source === void 0 ? {} : { source: s.source }
4510
+ })),
4472
4511
  get: (name) => localSkills.get(name)
4473
4512
  };
4474
4513
  }
@@ -4482,7 +4521,7 @@ function buildPlugins(args, out) {
4482
4521
  args.settingSourcesIncludePlugins,
4483
4522
  false,
4484
4523
  void 0,
4485
- args.options.local?.compatSources ?? []
4524
+ resolveCompatSources(args.options, args.workspaceCwd)
4486
4525
  );
4487
4526
  const localPlugins = out.pluginsManager;
4488
4527
  out.plugins = { list: () => localPlugins.list() };
@@ -7170,7 +7209,7 @@ function applyPersonalityFilter(exposedTools, whitelist, opts) {
7170
7209
  if (exposedSet.has(name)) continue;
7171
7210
  const hint = suggestClosest(name, exposedSet);
7172
7211
  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)`;
7173
- chunkHWSALKOR_cjs.warnOnce(
7212
+ chunkH6YM3PV6_cjs.warnOnce(
7174
7213
  `personality-tool-missing|${opts?.agentId ?? "?"}|${opts?.personalityName ?? "?"}|${name}`,
7175
7214
  message
7176
7215
  );
@@ -7613,7 +7652,7 @@ async function dispatchLocalRun(args) {
7613
7652
  });
7614
7653
  }
7615
7654
  async function readProjectMcpServers(cwd) {
7616
- const path$1 = path.join(cwd, ".theokit", "mcp.json");
7655
+ const path$1 = path.join(chunkGGZ5GPE3_cjs.theokitConfigRoot(cwd), "mcp.json");
7617
7656
  try {
7618
7657
  const raw = await promises.readFile(path$1, "utf8");
7619
7658
  const parsed = JSON.parse(raw);
@@ -7855,7 +7894,7 @@ async function reloadLocalAgent(agent) {
7855
7894
  if (agent.context !== void 0) await agent.context.refresh();
7856
7895
  if (agent.skillsManager !== void 0) await agent.skillsManager.refresh();
7857
7896
  if (agent.pluginsManager !== void 0) await agent.pluginsManager.refresh();
7858
- return await chunkG4ZGYKJG_cjs.loadSubagents(
7897
+ return await chunkSYVWE64W_cjs.loadSubagents(
7859
7898
  agent.workspaceCwd,
7860
7899
  agent.settingSourcesIncludeProject,
7861
7900
  agent.options.agents
@@ -8874,7 +8913,7 @@ var PersonalityFrontmatterSchema = zod.z.object({
8874
8913
  var RESERVED_CLEAR_SLUGS = ["none", "default", "neutral"];
8875
8914
 
8876
8915
  // src/internal/personality/registry.ts
8877
- var PROJECT_SUBDIR = ".theokit/personalities";
8916
+ var PERSONALITIES_SUFFIX = "personalities";
8878
8917
  var USER_SUBDIR = ".theokit/personalities";
8879
8918
  var PersonalityRegistry = class _PersonalityRegistry {
8880
8919
  #byName;
@@ -8889,7 +8928,7 @@ var PersonalityRegistry = class _PersonalityRegistry {
8889
8928
  * @internal
8890
8929
  */
8891
8930
  static async load(cwd) {
8892
- const projectDir = path.join(cwd, PROJECT_SUBDIR);
8931
+ const projectDir = path.join(chunkGGZ5GPE3_cjs.theokitConfigRoot(cwd), PERSONALITIES_SUFFIX);
8893
8932
  const userDir = path.join(os.homedir(), USER_SUBDIR);
8894
8933
  const [userEntities, projectEntities] = await Promise.all([
8895
8934
  loadMarkdownEntities({
@@ -8941,7 +8980,7 @@ function addEntity(byName, entity, origin, collisionMap) {
8941
8980
  );
8942
8981
  }
8943
8982
  if (origin === "project" && collisionMap?.has(fm.name)) {
8944
- chunkHWSALKOR_cjs.warnOnce(
8983
+ chunkH6YM3PV6_cjs.warnOnce(
8945
8984
  `personality-collision-${fm.name}`,
8946
8985
  `[theokit-sdk] personality "${fm.name}" overridden by project preset`
8947
8986
  );
@@ -8991,14 +9030,14 @@ async function performPersonalitySwitch(args) {
8991
9030
 
8992
9031
  // src/internal/local-agent/local-agent-personality-extensions.ts
8993
9032
  function resolveActivePersonalityPreset(args) {
8994
- const forkCtx = chunkHWSALKOR_cjs.currentPersonalityContext();
9033
+ const forkCtx = chunkH6YM3PV6_cjs.currentPersonalityContext();
8995
9034
  const slug = forkCtx !== void 0 ? forkCtx.slug : args.personalityStore.active(args.agentId);
8996
9035
  if (slug === void 0) return void 0;
8997
9036
  return args.personalityRegistry?.get(slug);
8998
9037
  }
8999
9038
  async function ensurePersonalityRegistryIfNeeded(args) {
9000
9039
  if (args.personalityRegistry !== void 0) return args.personalityRegistry;
9001
- const forkSlug = chunkHWSALKOR_cjs.currentPersonalityContext()?.slug;
9040
+ const forkSlug = chunkH6YM3PV6_cjs.currentPersonalityContext()?.slug;
9002
9041
  const ownSlug = args.personalityStore.active(args.agentId);
9003
9042
  if (forkSlug === void 0 && ownSlug === void 0) return void 0;
9004
9043
  return await PersonalityRegistry.load(args.workspaceCwd);
@@ -9011,8 +9050,8 @@ function applyPersonalityOverlay(preset, base) {
9011
9050
  ${preset.systemPrompt}`;
9012
9051
  }
9013
9052
  async function localAgentUsePersonality(agent, name, opts) {
9014
- if (chunkHWSALKOR_cjs.currentPersonalityContext() !== void 0) {
9015
- chunkHWSALKOR_cjs.warnPersonalitySwitchInsideFork(agent.agentId);
9053
+ if (chunkH6YM3PV6_cjs.currentPersonalityContext() !== void 0) {
9054
+ chunkH6YM3PV6_cjs.warnPersonalitySwitchInsideFork(agent.agentId);
9016
9055
  return null;
9017
9056
  }
9018
9057
  if (agent.personalityRegistry === void 0) {
@@ -9073,7 +9112,7 @@ async function* localAgentStreamToCompletion(agent, message, options) {
9073
9112
  async function localAgentFork(parent, options) {
9074
9113
  const { forkAgentImpl } = await import('./fork-agent-WAEQI2DL.cjs');
9075
9114
  const { getAgentFacade } = await import('./agent-factory-registry-UU46BUMU.cjs');
9076
- const { withPersonalityContext } = await import('./context-74SBFD27.cjs');
9115
+ const { withPersonalityContext } = await import('./context-NI33FS2R.cjs');
9077
9116
  const create = getAgentFacade().create;
9078
9117
  return withPersonalityContext(
9079
9118
  { slug: parent.personalitySlugSnapshot, isFork: true },
@@ -9864,8 +9903,8 @@ var LocalAgent = class {
9864
9903
  this.pluginsManager = sub.pluginsManager;
9865
9904
  if (sub.plugins !== void 0) this.plugins = sub.plugins;
9866
9905
  reportUnknownLocalOptions(options.local);
9867
- const compatSources = options.local?.compatSources ?? [];
9868
- chunkCEILSTWB_cjs.reportUndeclaredSources(this.workspaceCwd, compatSources);
9906
+ const compatSources = resolveCompatSources(options, this.workspaceCwd);
9907
+ chunkGGZ5GPE3_cjs.reportUndeclaredSources(this.workspaceCwd, compatSources);
9869
9908
  this.hooksExecutor = new HooksExecutor(this.workspaceCwd, compatSources);
9870
9909
  this.defaultMemoryProviderForLoop = createLocalAgentMemoryProvider({
9871
9910
  agentOptions: options,
@@ -9893,11 +9932,11 @@ var LocalAgent = class {
9893
9932
  if (this.pluginsManager !== void 0) await this.pluginsManager.initialize();
9894
9933
  const codePlugins = chunkBV2MWEMV_cjs.extractCodePlugins(this.options.plugins);
9895
9934
  await this.pluginManagerCode.initialize(codePlugins);
9896
- this.resolvedSubagents = await chunkG4ZGYKJG_cjs.loadSubagents(
9935
+ this.resolvedSubagents = await chunkSYVWE64W_cjs.loadSubagents(
9897
9936
  this.workspaceCwd,
9898
9937
  this.settingSourcesIncludeProject,
9899
9938
  this.options.agents,
9900
- this.options.local?.compatSources ?? []
9939
+ resolveCompatSources(this.options, this.workspaceCwd)
9901
9940
  );
9902
9941
  await acquireLeaseIfPossible(this.sessionStore, this.agentId);
9903
9942
  try {
@@ -10846,7 +10885,7 @@ var Agent = class _Agent {
10846
10885
  */
10847
10886
  static async describe(agentId) {
10848
10887
  const agent = await getRegisteredAgentOrThrow(agentId);
10849
- const { loadSubagents: loadSubagents2 } = await import('./subagents-loader-YWFE7KYE.cjs');
10888
+ const { loadSubagents: loadSubagents2 } = await import('./subagents-loader-TPZLTXYZ.cjs');
10850
10889
  const settingSources = agent.options.local?.settingSources;
10851
10890
  const subagents = await loadSubagents2(
10852
10891
  agent.cwd ?? process.cwd(),
@@ -10944,5 +10983,5 @@ exports.computeCost = computeCost;
10944
10983
  exports.generateCronId = generateCronId;
10945
10984
  exports.getPricingEntry = getPricingEntry;
10946
10985
  exports.openRouterMemoryEmbeddingProviderAdapter = openRouterMemoryEmbeddingProviderAdapter;
10947
- //# sourceMappingURL=chunk-WMH2MSOP.cjs.map
10948
- //# sourceMappingURL=chunk-WMH2MSOP.cjs.map
10986
+ //# sourceMappingURL=chunk-QUAEOKDW.cjs.map
10987
+ //# sourceMappingURL=chunk-QUAEOKDW.cjs.map