@theokit/sdk 5.0.0-next.1 → 5.0.0-next.3

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 (111) hide show
  1. package/CHANGELOG.md +195 -0
  2. package/dist/{agent-XMKRP27S.js → agent-2KJ3IGRA.js} +10 -10
  3. package/dist/{agent-XMKRP27S.js.map → agent-2KJ3IGRA.js.map} +1 -1
  4. package/dist/{agent-CgNzshyV.d.cts → agent-C3KO5LKm.d.cts} +49 -3
  5. package/dist/{agent-CdYJfKr6.d.ts → agent-CvmTR9uf.d.ts} +49 -3
  6. package/dist/{agent-2E7DI47Y.cjs → agent-V6YLX3W6.cjs} +11 -11
  7. package/dist/{agent-2E7DI47Y.cjs.map → agent-V6YLX3W6.cjs.map} +1 -1
  8. package/dist/{chunk-WFC26L6Y.js → chunk-2XRAWOZZ.js} +25 -2
  9. package/dist/chunk-2XRAWOZZ.js.map +1 -0
  10. package/dist/{chunk-XCCGNU3D.js → chunk-4S5TWFIZ.js} +5 -5
  11. package/dist/chunk-4S5TWFIZ.js.map +1 -0
  12. package/dist/{chunk-JTZ74HFD.js → chunk-67ADYSTW.js} +29 -9
  13. package/dist/chunk-67ADYSTW.js.map +1 -0
  14. package/dist/{chunk-2ZLVT7H3.js → chunk-CYKKYNOT.js} +3 -3
  15. package/dist/{chunk-2ZLVT7H3.js.map → chunk-CYKKYNOT.js.map} +1 -1
  16. package/dist/{chunk-WJXOICRC.js → chunk-DX4RUWOK.js} +3 -3
  17. package/dist/{chunk-WJXOICRC.js.map → chunk-DX4RUWOK.js.map} +1 -1
  18. package/dist/{chunk-CEILSTWB.cjs → chunk-GGZ5GPE3.cjs} +29 -8
  19. package/dist/chunk-GGZ5GPE3.cjs.map +1 -0
  20. package/dist/{chunk-7ZK4DJD7.cjs → chunk-GJKMSGZ7.cjs} +4 -4
  21. package/dist/{chunk-7ZK4DJD7.cjs.map → chunk-GJKMSGZ7.cjs.map} +1 -1
  22. package/dist/{chunk-NCGWJ3HS.js → chunk-GO5QW4YL.js} +74 -35
  23. package/dist/chunk-GO5QW4YL.js.map +1 -0
  24. package/dist/{chunk-HWSALKOR.cjs → chunk-H6YM3PV6.cjs} +5 -5
  25. package/dist/chunk-H6YM3PV6.cjs.map +1 -0
  26. package/dist/{chunk-RHZ6HP23.cjs → chunk-IU5N5224.cjs} +8 -8
  27. package/dist/{chunk-RHZ6HP23.cjs.map → chunk-IU5N5224.cjs.map} +1 -1
  28. package/dist/{chunk-UNK4HNJH.js → chunk-J2SH3PNH.js} +3 -3
  29. package/dist/{chunk-UNK4HNJH.js.map → chunk-J2SH3PNH.js.map} +1 -1
  30. package/dist/{chunk-WMH2MSOP.cjs → chunk-K6VDRJ6I.cjs} +114 -75
  31. package/dist/chunk-K6VDRJ6I.cjs.map +1 -0
  32. package/dist/{chunk-2NE7DTOK.cjs → chunk-KBXADFBJ.cjs} +15 -15
  33. package/dist/{chunk-2NE7DTOK.cjs.map → chunk-KBXADFBJ.cjs.map} +1 -1
  34. package/dist/{chunk-6HIACV34.js → chunk-L4RPP6ZC.js} +3 -3
  35. package/dist/{chunk-6HIACV34.js.map → chunk-L4RPP6ZC.js.map} +1 -1
  36. package/dist/{chunk-LKFET5A3.cjs → chunk-LOHMT36V.cjs} +25 -2
  37. package/dist/chunk-LOHMT36V.cjs.map +1 -0
  38. package/dist/{chunk-ILGZ2ZZV.js → chunk-N6OOOYFZ.js} +3 -3
  39. package/dist/{chunk-ILGZ2ZZV.js.map → chunk-N6OOOYFZ.js.map} +1 -1
  40. package/dist/{chunk-LHSWHYF3.cjs → chunk-RXZSVNDG.cjs} +5 -5
  41. package/dist/{chunk-LHSWHYF3.cjs.map → chunk-RXZSVNDG.cjs.map} +1 -1
  42. package/dist/{chunk-G4ZGYKJG.cjs → chunk-SYVWE64W.cjs} +6 -6
  43. package/dist/chunk-SYVWE64W.cjs.map +1 -0
  44. package/dist/{chunk-V6ZY4AX6.cjs → chunk-VNDJS6I3.cjs} +8 -8
  45. package/dist/{chunk-V6ZY4AX6.cjs.map → chunk-VNDJS6I3.cjs.map} +1 -1
  46. package/dist/{chunk-IJM7UGS5.js → chunk-XJZEBGXD.js} +5 -5
  47. package/dist/chunk-XJZEBGXD.js.map +1 -0
  48. package/dist/context/index.cjs +7 -7
  49. package/dist/context/index.js +3 -3
  50. package/dist/{context-74SBFD27.cjs → context-NI33FS2R.cjs} +7 -7
  51. package/dist/{context-74SBFD27.cjs.map → context-NI33FS2R.cjs.map} +1 -1
  52. package/dist/context-Y7B7SI5X.js +6 -0
  53. package/dist/{context-NZ2AC6S7.js.map → context-Y7B7SI5X.js.map} +1 -1
  54. package/dist/{cron-Bw6mSgD4.d.cts → cron-C3PhZED0.d.cts} +1 -1
  55. package/dist/{cron-DJv9oXSZ.d.ts → cron-crfMMdAw.d.ts} +1 -1
  56. package/dist/cron.cjs +10 -10
  57. package/dist/cron.d.cts +3 -3
  58. package/dist/cron.d.ts +3 -3
  59. package/dist/cron.js +9 -9
  60. package/dist/eval.cjs +9 -9
  61. package/dist/eval.js +8 -8
  62. package/dist/{index-manager-QH6OXEV5.js → index-manager-E56WW5RO.js} +5 -5
  63. package/dist/{index-manager-QH6OXEV5.js.map → index-manager-E56WW5RO.js.map} +1 -1
  64. package/dist/{index-manager-DXR2RSFI.cjs → index-manager-OL6HTYAO.cjs} +6 -6
  65. package/dist/{index-manager-DXR2RSFI.cjs.map → index-manager-OL6HTYAO.cjs.map} +1 -1
  66. package/dist/index.cjs +31 -31
  67. package/dist/index.d.cts +5 -5
  68. package/dist/index.d.ts +5 -5
  69. package/dist/index.js +13 -13
  70. package/dist/internal/memory/storage/index.cjs +31 -31
  71. package/dist/internal/memory/storage/index.js +3 -3
  72. package/dist/internal/persistence/index.cjs +4 -4
  73. package/dist/internal/persistence/index.js +1 -1
  74. package/dist/internal/persistence/paths.d.cts +25 -12
  75. package/dist/internal/persistence/paths.d.ts +25 -12
  76. package/dist/internal/runtime/compat/compat-config-file.d.ts +31 -0
  77. package/dist/internal/runtime/compat/foreign-config-sources.d.ts +31 -1
  78. package/dist/internal/runtime/hooks/hooks-executor.d.ts +2 -1
  79. package/dist/internal/runtime/plugin-loader/plugin-bundles.d.ts +2 -1
  80. package/dist/project.cjs +3 -3
  81. package/dist/project.js +1 -1
  82. package/dist/{sdk-agent-Dxjb0IfM.d.cts → sdk-agent-BOiKqOgL.d.cts} +28 -1
  83. package/dist/{sdk-agent-ldzpyAaF.d.ts → sdk-agent-D4a_BR_6.d.ts} +28 -1
  84. package/dist/subagents-loader-TPZLTXYZ.cjs +16 -0
  85. package/dist/{subagents-loader-YWFE7KYE.cjs.map → subagents-loader-TPZLTXYZ.cjs.map} +1 -1
  86. package/dist/subagents-loader-Y6JFYXAY.js +7 -0
  87. package/dist/{subagents-loader-LSKM2UIK.js.map → subagents-loader-Y6JFYXAY.js.map} +1 -1
  88. package/dist/subagents-loader.cjs +3 -3
  89. package/dist/subagents-loader.d.cts +2 -2
  90. package/dist/subagents-loader.d.ts +2 -2
  91. package/dist/subagents-loader.js +2 -2
  92. package/dist/types/agent.d.ts +47 -1
  93. package/dist/types/sdk-agent.d.ts +28 -1
  94. package/dist/workflow.d.cts +1 -1
  95. package/dist/workflow.d.ts +1 -1
  96. package/docs/error-codes.md +21 -21
  97. package/docs/harness-capability-map.md +3 -1
  98. package/package.json +1 -1
  99. package/dist/chunk-CEILSTWB.cjs.map +0 -1
  100. package/dist/chunk-G4ZGYKJG.cjs.map +0 -1
  101. package/dist/chunk-HWSALKOR.cjs.map +0 -1
  102. package/dist/chunk-IJM7UGS5.js.map +0 -1
  103. package/dist/chunk-JTZ74HFD.js.map +0 -1
  104. package/dist/chunk-LKFET5A3.cjs.map +0 -1
  105. package/dist/chunk-NCGWJ3HS.js.map +0 -1
  106. package/dist/chunk-WFC26L6Y.js.map +0 -1
  107. package/dist/chunk-WMH2MSOP.cjs.map +0 -1
  108. package/dist/chunk-XCCGNU3D.js.map +0 -1
  109. package/dist/context-NZ2AC6S7.js +0 -6
  110. package/dist/subagents-loader-LSKM2UIK.js +0 -7
  111. package/dist/subagents-loader-YWFE7KYE.cjs +0 -16
@@ -1,15 +1,15 @@
1
1
  import { submit, emitRunEvent } from './chunk-K2VMFZQ5.js';
2
2
  import { enqueueSessionWrite, hydrateSession, persistTurnToTranscript, flushSessionWrites, appendSessionMessage, getSessionMessages, discardSession, clearSession } from './chunk-AWINL3ZC.js';
3
- import { IndexManager } from './chunk-2ZLVT7H3.js';
4
- import { loadHookConfig, warnOnce, currentPersonalityContext, warnPersonalitySwitchInsideFork } from './chunk-IJM7UGS5.js';
3
+ import { IndexManager } from './chunk-CYKKYNOT.js';
4
+ import { loadHookConfig, warnOnce, currentPersonalityContext, warnPersonalitySwitchInsideFork } from './chunk-XJZEBGXD.js';
5
5
  import { extractCodePlugins } from './chunk-2SFBB54R.js';
6
6
  import { createOpenAiCompatibleRuntime } from './chunk-55GB6JYQ.js';
7
7
  import { persistActiveMemoryTranscript } from './chunk-OR6XIWLB.js';
8
- import { writeSessionSummary, resolveMemoryRoot, MEMORY_KINDS, appendFact, readFacts, legacyMemoryJsonPath, memoryMdPath, appendFactToMarkdown } from './chunk-UNK4HNJH.js';
8
+ import { writeSessionSummary, resolveMemoryRoot, MEMORY_KINDS, appendFact, readFacts, legacyMemoryJsonPath, memoryMdPath, appendFactToMarkdown } from './chunk-J2SH3PNH.js';
9
9
  import { FsSessionStore } from './chunk-AAEZSPTC.js';
10
10
  import { discoverProviderPlugins, validateApiKeyShape, getConfiguredBaseUrl, httpRequest, isFixtureApiKey, presentProviderCredentialEnvVars, buildDefaultSummarizer, shouldUseRealLocalRuntime, parseSseStream, CircuitBreaker, resolveRunProvider, mergeExplicitApiKey, resolveProviderChain, abortError, tryFirstEvent, relayStream, renderToolResultContentText } from './chunk-K3NH62DG.js';
11
11
  import { resolveChildEnv } from './chunk-HKCKOAIO.js';
12
- import { DEFAULT_MAX_BYTES_PER_FILE, runDiscovery, truncateWithMarker } from './chunk-ILGZ2ZZV.js';
12
+ import { DEFAULT_MAX_BYTES_PER_FILE, runDiscovery, truncateWithMarker } from './chunk-N6OOOYFZ.js';
13
13
  import { readVersionedJson, writeVersionedJson } from './chunk-SVQIW5RJ.js';
14
14
  import { toJsonSchema } from './chunk-7I5Z3UBJ.js';
15
15
  import { sanitizeToolInput } from './chunk-FJWQP6EE.js';
@@ -24,8 +24,8 @@ import { expandTilde, defaultBaseDir } from './chunk-JOFVLOFY.js';
24
24
  import { withFileLock } from './chunk-TA3K7SBK.js';
25
25
  import { withCwdMutex } from './chunk-Q5EWJPRY.js';
26
26
  import { sweepStaleAtomicTemps, atomicWriteJson } from './chunk-3JHIFQ4I.js';
27
- import { loadSubagents, pluginBundleDirs } from './chunk-XCCGNU3D.js';
28
- import { reportUndeclaredSources, undefinedVariablesIn, getTheokitHome, adapterForConfigPath, projectConfigRoots, pluginBundleRoots } from './chunk-JTZ74HFD.js';
27
+ import { loadSubagents, pluginBundleDirs } from './chunk-4S5TWFIZ.js';
28
+ import { reportUndeclaredSources, theokitConfigRoot, undefinedVariablesIn, getTheokitHome, adapterForConfigPath, projectConfigRoots, pluginBundleRoots } from './chunk-67ADYSTW.js';
29
29
  import { readWorkspaceDir, parseSimpleYaml } from './chunk-JNAA4G4H.js';
30
30
  import { resolveEffectiveContextWindow, CONTEXT_WINDOW_FLOOR, CONTEXT_WINDOW_MARGIN } from './chunk-6M2OIS4Y.js';
31
31
  import { parseModelId } from './chunk-R7WIIPUR.js';
@@ -36,11 +36,11 @@ import { AgentRunError, coerceToKnownAgentRunErrorCode, UnknownAgentError, Confi
36
36
  import { diag, resolveApiKey, API_KEY_ENV_VAR, redactSecrets, diagFailure } from './chunk-CZJ6Q7CW.js';
37
37
  import { stat, mkdir, readFile, readdir, access, unlink } from 'fs/promises';
38
38
  import { randomUUID, createHash } from 'crypto';
39
- import { join, dirname, resolve, isAbsolute } from 'path';
39
+ import { join, dirname, resolve, relative, isAbsolute } from 'path';
40
+ import { existsSync, readFileSync } from 'fs';
40
41
  import { spawn } from 'child_process';
41
42
  import { z } from 'zod';
42
43
  import { createRequire } from 'module';
43
- import { existsSync } from 'fs';
44
44
  import { homedir } from 'os';
45
45
 
46
46
  // src/agent-builder.ts
@@ -269,7 +269,7 @@ function enabledPluginNames(plugins) {
269
269
  // src/internal/runtime/registry/agent-registry-store.ts
270
270
  var SCHEMA_VERSION = 1;
271
271
  var LEGACY_SCHEMA_VERSION_STRING = "1.0";
272
- var REGISTRY_RELATIVE_PATH = join(".theokit", "agents", "registry.json");
272
+ var REGISTRY_RELATIVE_SUFFIX = join("agents", "registry.json");
273
273
  function stripSecretsFromOptions(options) {
274
274
  return assignDefined({
275
275
  name: options.name,
@@ -379,7 +379,7 @@ function serializeAgents(agents2) {
379
379
  return out;
380
380
  }
381
381
  function registryPath(cwd) {
382
- return join(cwd, REGISTRY_RELATIVE_PATH);
382
+ return join(theokitConfigRoot(cwd), REGISTRY_RELATIVE_SUFFIX);
383
383
  }
384
384
  async function loadRegistry(cwd) {
385
385
  void sweepStaleAtomicTemps(registryPath(cwd)).catch(() => void 0);
@@ -2518,6 +2518,37 @@ function removeAll(arr, toRemove) {
2518
2518
  if (idx !== -1) arr.splice(idx, 1);
2519
2519
  }
2520
2520
  }
2521
+ function readCompatConfigFile(cwd) {
2522
+ const path = join(theokitConfigRoot(cwd), "config.json");
2523
+ if (!existsSync(path)) return [];
2524
+ let raw;
2525
+ try {
2526
+ raw = readFileSync(path, "utf8");
2527
+ } catch {
2528
+ return [];
2529
+ }
2530
+ let parsed;
2531
+ try {
2532
+ parsed = JSON.parse(raw);
2533
+ } catch (cause) {
2534
+ diag(
2535
+ `[theokit] ${path} is not valid JSON \u2014 ignoring its "compat.adapters" (${cause.message}).
2536
+ `
2537
+ );
2538
+ return [];
2539
+ }
2540
+ const adapters = parsed.compat?.adapters;
2541
+ if (adapters === void 0) return [];
2542
+ if (!Array.isArray(adapters)) {
2543
+ diag(`[theokit] ${path}: "compat.adapters" must be an array \u2014 ignoring it.
2544
+ `);
2545
+ return [];
2546
+ }
2547
+ return adapters;
2548
+ }
2549
+ function resolveCompatSources(options, cwd) {
2550
+ return options.local?.compatSources ?? readCompatConfigFile(cwd);
2551
+ }
2521
2552
  function spawnAndCollect(options) {
2522
2553
  return new Promise((resolve) => {
2523
2554
  const timeoutMs = options.timeoutMs ?? 3e4;
@@ -2818,7 +2849,9 @@ var SkillsManager = class {
2818
2849
  }
2819
2850
  async refresh() {
2820
2851
  const roots = this.skillsDir === void 0 ? [
2821
- ...projectConfigRoots(this.cwd, this.compatSources).map((root) => join(root, "skills")),
2852
+ ...projectConfigRoots(this.cwd, this.compatSources, "skills").map(
2853
+ (root) => join(root, "skills")
2854
+ ),
2822
2855
  ...(await pluginBundleDirs(this.cwd, this.compatSources)).map((b) => join(b, "skills"))
2823
2856
  ] : [this.skillsDir];
2824
2857
  const discovered = [];
@@ -2963,7 +2996,7 @@ async function resolveSendSkills(inputs, userText, memoryFacts) {
2963
2996
  inputs.settingSourcesIncludeProject,
2964
2997
  settings.skillsDir,
2965
2998
  settings.inline,
2966
- inputs.options.local?.compatSources ?? []
2999
+ resolveCompatSources(inputs.options, inputs.workspaceCwd)
2967
3000
  );
2968
3001
  await manager.initialize();
2969
3002
  return { manager, autoInject: settings.autoInject ?? true };
@@ -4100,8 +4133,8 @@ var FileContextManager = class {
4100
4133
  }
4101
4134
  };
4102
4135
  async function loadContextConfig(cwd) {
4103
- const mdDir = join(cwd, ".theokit", "context");
4104
- const jsonPath = join(cwd, ".theokit", "context.json");
4136
+ const mdDir = join(theokitConfigRoot(cwd), "context");
4137
+ const jsonPath = join(theokitConfigRoot(cwd), "context.json");
4105
4138
  const mdEntities = await loadMarkdownEntities({
4106
4139
  dir: mdDir,
4107
4140
  schema: ContextSourceFrontmatterSchema,
@@ -4273,7 +4306,7 @@ var PluginsManager = class {
4273
4306
  const folderName = entry.name;
4274
4307
  const cliPath = join(pluginsRoot, folderName, ".claude-plugin", "plugin.json");
4275
4308
  if (existsSync(cliPath)) {
4276
- const cliMetadata = await loadPluginManifestFromJson(cliPath, folderName);
4309
+ const cliMetadata = await loadPluginManifestFromJson(this.cwd, cliPath, folderName);
4277
4310
  if (this.enabled === void 0 || this.enabled.includes(cliMetadata.name)) {
4278
4311
  this.plugins.push(cliMetadata);
4279
4312
  }
@@ -4281,7 +4314,7 @@ var PluginsManager = class {
4281
4314
  }
4282
4315
  const mdPath = join(pluginsRoot, folderName, "PLUGIN.md");
4283
4316
  const jsonPath = join(pluginsRoot, folderName, "plugin.json");
4284
- const metadata = existsSync(mdPath) ? await loadPluginManifestFromMarkdown(pluginsRoot, folderName) : await loadPluginManifestFromJson(jsonPath, folderName);
4317
+ const metadata = existsSync(mdPath) ? await loadPluginManifestFromMarkdown(this.cwd, pluginsRoot, folderName) : await loadPluginManifestFromJson(this.cwd, jsonPath, folderName);
4285
4318
  if (existsSync(mdPath) && existsSync(jsonPath)) {
4286
4319
  warnOnce(
4287
4320
  `plugin-${folderName}-both`,
@@ -4296,7 +4329,7 @@ var PluginsManager = class {
4296
4329
  );
4297
4330
  }
4298
4331
  if (this.enabled === void 0 || this.enabled.includes(metadata.name)) {
4299
- await this.assertEntryFileExists(metadata, folderName);
4332
+ await this.assertEntryFileExists(metadata, folderName, pluginsRoot);
4300
4333
  this.plugins.push(metadata);
4301
4334
  }
4302
4335
  }
@@ -4304,10 +4337,10 @@ var PluginsManager = class {
4304
4337
  list() {
4305
4338
  return Promise.resolve(this.plugins);
4306
4339
  }
4307
- async assertEntryFileExists(metadata, folderName) {
4340
+ async assertEntryFileExists(metadata, folderName, pluginsRoot) {
4308
4341
  const entry = metadata.entry;
4309
4342
  if (entry === void 0) return;
4310
- const pluginRoot = join(this.cwd, ".theokit", "plugins", folderName);
4343
+ const pluginRoot = join(pluginsRoot, folderName);
4311
4344
  const entryPath = safePathJoin(pluginRoot, entry);
4312
4345
  try {
4313
4346
  await readFile(entryPath, "utf8");
@@ -4343,7 +4376,7 @@ var PluginsManager = class {
4343
4376
  }
4344
4377
  }
4345
4378
  };
4346
- async function loadPluginManifestFromJson(manifestPath, folderName) {
4379
+ async function loadPluginManifestFromJson(cwd, manifestPath, folderName) {
4347
4380
  let raw;
4348
4381
  try {
4349
4382
  raw = await readFile(manifestPath, "utf8");
@@ -4371,12 +4404,12 @@ async function loadPluginManifestFromJson(manifestPath, folderName) {
4371
4404
  const name = typeof record.name === "string" ? record.name : folderName;
4372
4405
  const version = typeof record.version === "string" ? record.version : "0.0.0";
4373
4406
  const capabilities = Array.isArray(record.capabilities) ? record.capabilities.filter((cap) => typeof cap === "string") : [];
4374
- const source = manifestPath.slice(manifestPath.indexOf(".theokit/"));
4407
+ const source = relative(cwd, manifestPath);
4375
4408
  const metadata = { name, version, capabilities, source };
4376
4409
  if (typeof record.entry === "string") metadata.entry = record.entry;
4377
4410
  return metadata;
4378
4411
  }
4379
- async function loadPluginManifestFromMarkdown(pluginsRoot, folderName) {
4412
+ async function loadPluginManifestFromMarkdown(cwd, pluginsRoot, folderName) {
4380
4413
  const mdPath = join(pluginsRoot, folderName, "PLUGIN.md");
4381
4414
  let raw;
4382
4415
  try {
@@ -4402,7 +4435,7 @@ async function loadPluginManifestFromMarkdown(pluginsRoot, folderName) {
4402
4435
  });
4403
4436
  }
4404
4437
  const fm = entity.frontmatter;
4405
- const source = mdPath.slice(mdPath.indexOf(".theokit/"));
4438
+ const source = relative(cwd, mdPath);
4406
4439
  const metadata = {
4407
4440
  name: fm.name ?? folderName,
4408
4441
  version: fm.version ?? "0.0.0",
@@ -4458,14 +4491,20 @@ function buildSkills(args, out) {
4458
4491
  staticSkills?.inline,
4459
4492
  // #524 — the same declaration the per-send manager reads. Omitting it here would make
4460
4493
  // `agent.skills` disagree with the system prompt about which skills exist.
4461
- args.options.local?.compatSources ?? []
4494
+ resolveCompatSources(args.options, args.workspaceCwd)
4462
4495
  );
4463
4496
  const localSkills = out.skillsManager;
4464
4497
  out.skills = {
4465
4498
  // Project to the public shape (name + description only). Inline skills carry
4466
4499
  // their body + references on the object; `list()` must never leak them —
4467
4500
  // the body is reachable exclusively through `get()`.
4468
- list: async () => (await localSkills.list()).map((s) => ({ name: s.name, description: s.description })),
4501
+ list: async () => (await localSkills.list()).map((s) => ({
4502
+ name: s.name,
4503
+ description: s.description,
4504
+ // The PATH, never the body. Dropping it with the body answered a question nobody asked and
4505
+ // silenced the one #524 is about: which root did this skill come from.
4506
+ ...s.source === void 0 ? {} : { source: s.source }
4507
+ })),
4469
4508
  get: (name) => localSkills.get(name)
4470
4509
  };
4471
4510
  }
@@ -4479,7 +4518,7 @@ function buildPlugins(args, out) {
4479
4518
  args.settingSourcesIncludePlugins,
4480
4519
  false,
4481
4520
  void 0,
4482
- args.options.local?.compatSources ?? []
4521
+ resolveCompatSources(args.options, args.workspaceCwd)
4483
4522
  );
4484
4523
  const localPlugins = out.pluginsManager;
4485
4524
  out.plugins = { list: () => localPlugins.list() };
@@ -7610,7 +7649,7 @@ async function dispatchLocalRun(args) {
7610
7649
  });
7611
7650
  }
7612
7651
  async function readProjectMcpServers(cwd) {
7613
- const path = join(cwd, ".theokit", "mcp.json");
7652
+ const path = join(theokitConfigRoot(cwd), "mcp.json");
7614
7653
  try {
7615
7654
  const raw = await readFile(path, "utf8");
7616
7655
  const parsed = JSON.parse(raw);
@@ -8871,7 +8910,7 @@ var PersonalityFrontmatterSchema = z.object({
8871
8910
  var RESERVED_CLEAR_SLUGS = ["none", "default", "neutral"];
8872
8911
 
8873
8912
  // src/internal/personality/registry.ts
8874
- var PROJECT_SUBDIR = ".theokit/personalities";
8913
+ var PERSONALITIES_SUFFIX = "personalities";
8875
8914
  var USER_SUBDIR = ".theokit/personalities";
8876
8915
  var PersonalityRegistry = class _PersonalityRegistry {
8877
8916
  #byName;
@@ -8886,7 +8925,7 @@ var PersonalityRegistry = class _PersonalityRegistry {
8886
8925
  * @internal
8887
8926
  */
8888
8927
  static async load(cwd) {
8889
- const projectDir = join(cwd, PROJECT_SUBDIR);
8928
+ const projectDir = join(theokitConfigRoot(cwd), PERSONALITIES_SUFFIX);
8890
8929
  const userDir = join(homedir(), USER_SUBDIR);
8891
8930
  const [userEntities, projectEntities] = await Promise.all([
8892
8931
  loadMarkdownEntities({
@@ -9070,7 +9109,7 @@ async function* localAgentStreamToCompletion(agent, message, options) {
9070
9109
  async function localAgentFork(parent, options) {
9071
9110
  const { forkAgentImpl } = await import('./fork-agent-S2EPIML7.js');
9072
9111
  const { getAgentFacade } = await import('./agent-factory-registry-ZVTABLEY.js');
9073
- const { withPersonalityContext } = await import('./context-NZ2AC6S7.js');
9112
+ const { withPersonalityContext } = await import('./context-Y7B7SI5X.js');
9074
9113
  const create = getAgentFacade().create;
9075
9114
  return withPersonalityContext(
9076
9115
  { slug: parent.personalitySlugSnapshot, isFork: true },
@@ -9861,7 +9900,7 @@ var LocalAgent = class {
9861
9900
  this.pluginsManager = sub.pluginsManager;
9862
9901
  if (sub.plugins !== void 0) this.plugins = sub.plugins;
9863
9902
  reportUnknownLocalOptions(options.local);
9864
- const compatSources = options.local?.compatSources ?? [];
9903
+ const compatSources = resolveCompatSources(options, this.workspaceCwd);
9865
9904
  reportUndeclaredSources(this.workspaceCwd, compatSources);
9866
9905
  this.hooksExecutor = new HooksExecutor(this.workspaceCwd, compatSources);
9867
9906
  this.defaultMemoryProviderForLoop = createLocalAgentMemoryProvider({
@@ -9894,7 +9933,7 @@ var LocalAgent = class {
9894
9933
  this.workspaceCwd,
9895
9934
  this.settingSourcesIncludeProject,
9896
9935
  this.options.agents,
9897
- this.options.local?.compatSources ?? []
9936
+ resolveCompatSources(this.options, this.workspaceCwd)
9898
9937
  );
9899
9938
  await acquireLeaseIfPossible(this.sessionStore, this.agentId);
9900
9939
  try {
@@ -10843,7 +10882,7 @@ var Agent = class _Agent {
10843
10882
  */
10844
10883
  static async describe(agentId) {
10845
10884
  const agent = await getRegisteredAgentOrThrow(agentId);
10846
- const { loadSubagents: loadSubagents2 } = await import('./subagents-loader-LSKM2UIK.js');
10885
+ const { loadSubagents: loadSubagents2 } = await import('./subagents-loader-Y6JFYXAY.js');
10847
10886
  const settingSources = agent.options.local?.settingSources;
10848
10887
  const subagents = await loadSubagents2(
10849
10888
  agent.cwd ?? process.cwd(),
@@ -10931,5 +10970,5 @@ async function openLocalStore(reg) {
10931
10970
  }
10932
10971
 
10933
10972
  export { Agent, AgentBuilder, DEFAULT_AGENTIC_MODEL_ID, MEMORY_EMBEDDING_ADAPTERS, Tool, ToolError, UsageAccumulator, computeCost, generateCronId, getPricingEntry, openRouterMemoryEmbeddingProviderAdapter };
10934
- //# sourceMappingURL=chunk-NCGWJ3HS.js.map
10935
- //# sourceMappingURL=chunk-NCGWJ3HS.js.map
10973
+ //# sourceMappingURL=chunk-GO5QW4YL.js.map
10974
+ //# sourceMappingURL=chunk-GO5QW4YL.js.map