@theokit/sdk 4.57.0 → 4.58.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 (98) hide show
  1. package/CHANGELOG.md +99 -0
  2. package/dist/{agent-ZIYCVEZL.js → agent-6WM4QOWS.js} +10 -9
  3. package/dist/{agent-ZIYCVEZL.js.map → agent-6WM4QOWS.js.map} +1 -1
  4. package/dist/{agent-2T2EJIP6.cjs → agent-MIYY7TXV.cjs} +11 -10
  5. package/dist/{agent-2T2EJIP6.cjs.map → agent-MIYY7TXV.cjs.map} +1 -1
  6. package/dist/{chunk-E7JHD6QJ.cjs → chunk-27AXGJMV.cjs} +25 -15
  7. package/dist/chunk-27AXGJMV.cjs.map +1 -0
  8. package/dist/{chunk-LEM2GOMI.js → chunk-5QOIQJ5J.js} +3 -3
  9. package/dist/{chunk-LEM2GOMI.js.map → chunk-5QOIQJ5J.js.map} +1 -1
  10. package/dist/{chunk-E3WZ6Y4H.cjs → chunk-7BG5UH3T.cjs} +8 -8
  11. package/dist/{chunk-E3WZ6Y4H.cjs.map → chunk-7BG5UH3T.cjs.map} +1 -1
  12. package/dist/chunk-AQO3NSRG.cjs +41 -0
  13. package/dist/chunk-AQO3NSRG.cjs.map +1 -0
  14. package/dist/{chunk-7TCRNXNK.js → chunk-CF5OMCZG.js} +40 -16
  15. package/dist/chunk-CF5OMCZG.js.map +1 -0
  16. package/dist/{chunk-U2AC6JUP.cjs → chunk-J2UROOIG.cjs} +2 -27
  17. package/dist/chunk-J2UROOIG.cjs.map +1 -0
  18. package/dist/{chunk-ZNW6V4Y6.cjs → chunk-LKFET5A3.cjs} +23 -2
  19. package/dist/chunk-LKFET5A3.cjs.map +1 -0
  20. package/dist/{chunk-YMA4S2WO.js → chunk-MZ2FGBLZ.js} +33 -11
  21. package/dist/chunk-MZ2FGBLZ.js.map +1 -0
  22. package/dist/{chunk-M2JWHKO6.cjs → chunk-N47KLTKD.cjs} +76 -52
  23. package/dist/chunk-N47KLTKD.cjs.map +1 -0
  24. package/dist/{chunk-53CBTBWO.cjs → chunk-P6H23T43.cjs} +33 -11
  25. package/dist/chunk-P6H23T43.cjs.map +1 -0
  26. package/dist/{chunk-X7O4255I.cjs → chunk-QIRDQZYL.cjs} +4 -4
  27. package/dist/{chunk-X7O4255I.cjs.map → chunk-QIRDQZYL.cjs.map} +1 -1
  28. package/dist/{chunk-7FHZ4VQX.js → chunk-SAVIWMZB.js} +3 -3
  29. package/dist/{chunk-7FHZ4VQX.js.map → chunk-SAVIWMZB.js.map} +1 -1
  30. package/dist/{chunk-UPRJR6IP.js → chunk-UCBJBJ27.js} +3 -25
  31. package/dist/chunk-UCBJBJ27.js.map +1 -0
  32. package/dist/chunk-UFLD2HEV.js +35 -0
  33. package/dist/chunk-UFLD2HEV.js.map +1 -0
  34. package/dist/{chunk-GTKFV7O5.js → chunk-WFC26L6Y.js} +23 -2
  35. package/dist/chunk-WFC26L6Y.js.map +1 -0
  36. package/dist/{chunk-G6EEYRDD.js → chunk-WLZ7XRWH.js} +24 -14
  37. package/dist/chunk-WLZ7XRWH.js.map +1 -0
  38. package/dist/{chunk-HJBMA5MB.cjs → chunk-WNTAPVU5.cjs} +47 -6
  39. package/dist/chunk-WNTAPVU5.cjs.map +1 -0
  40. package/dist/{chunk-2QKTVKH3.js → chunk-ZHPWGIUX.js} +48 -8
  41. package/dist/chunk-ZHPWGIUX.js.map +1 -0
  42. package/dist/context/index.cjs +7 -7
  43. package/dist/context/index.js +3 -3
  44. package/dist/{context-VMIE4BMD.cjs → context-LCKNH2XI.cjs} +7 -6
  45. package/dist/{context-VMIE4BMD.cjs.map → context-LCKNH2XI.cjs.map} +1 -1
  46. package/dist/context-MZSKGKYR.js +7 -0
  47. package/dist/{context-FDOON2DB.js.map → context-MZSKGKYR.js.map} +1 -1
  48. package/dist/cron.cjs +10 -9
  49. package/dist/cron.js +9 -8
  50. package/dist/eval.cjs +9 -8
  51. package/dist/eval.cjs.map +1 -1
  52. package/dist/eval.js +8 -7
  53. package/dist/eval.js.map +1 -1
  54. package/dist/{index-manager-AO4LJQZ4.cjs → index-manager-J2QIDI6I.cjs} +5 -4
  55. package/dist/{index-manager-AO4LJQZ4.cjs.map → index-manager-J2QIDI6I.cjs.map} +1 -1
  56. package/dist/{index-manager-QDPIYIGV.js → index-manager-WYESAVTX.js} +4 -3
  57. package/dist/{index-manager-QDPIYIGV.js.map → index-manager-WYESAVTX.js.map} +1 -1
  58. package/dist/index.cjs +32 -33
  59. package/dist/index.cjs.map +1 -1
  60. package/dist/index.d.cts +1 -1
  61. package/dist/index.d.ts +1 -1
  62. package/dist/index.js +12 -13
  63. package/dist/index.js.map +1 -1
  64. package/dist/internal/memory/storage/markdown-store.d.ts +13 -0
  65. package/dist/internal/persistence/index.cjs +17 -16
  66. package/dist/internal/persistence/index.cjs.map +1 -1
  67. package/dist/internal/persistence/index.js +2 -1
  68. package/dist/internal/persistence/index.js.map +1 -1
  69. package/dist/internal/persistence/paths.d.cts +42 -0
  70. package/dist/internal/persistence/paths.d.ts +42 -0
  71. package/dist/internal/runtime/plugins/plugin-bundles.d.ts +19 -0
  72. package/dist/project.cjs +3 -3
  73. package/dist/project.js +1 -1
  74. package/dist/subagents-loader-6ATCDEKN.js +8 -0
  75. package/dist/{subagents-loader-J54ESLDV.js.map → subagents-loader-6ATCDEKN.js.map} +1 -1
  76. package/dist/subagents-loader-X5QKODCL.cjs +17 -0
  77. package/dist/{subagents-loader-AZIXJ7D3.cjs.map → subagents-loader-X5QKODCL.cjs.map} +1 -1
  78. package/dist/subagents-loader.cjs +3 -2
  79. package/dist/subagents-loader.cjs.map +1 -1
  80. package/dist/subagents-loader.js +2 -1
  81. package/dist/subagents-loader.js.map +1 -1
  82. package/docs/error-codes.md +15 -15
  83. package/package.json +1 -1
  84. package/dist/chunk-2QKTVKH3.js.map +0 -1
  85. package/dist/chunk-53CBTBWO.cjs.map +0 -1
  86. package/dist/chunk-7TCRNXNK.js.map +0 -1
  87. package/dist/chunk-E7JHD6QJ.cjs.map +0 -1
  88. package/dist/chunk-G6EEYRDD.js.map +0 -1
  89. package/dist/chunk-GTKFV7O5.js.map +0 -1
  90. package/dist/chunk-HJBMA5MB.cjs.map +0 -1
  91. package/dist/chunk-M2JWHKO6.cjs.map +0 -1
  92. package/dist/chunk-U2AC6JUP.cjs.map +0 -1
  93. package/dist/chunk-UPRJR6IP.js.map +0 -1
  94. package/dist/chunk-YMA4S2WO.js.map +0 -1
  95. package/dist/chunk-ZNW6V4Y6.cjs.map +0 -1
  96. package/dist/context-FDOON2DB.js +0 -6
  97. package/dist/subagents-loader-AZIXJ7D3.cjs +0 -16
  98. package/dist/subagents-loader-J54ESLDV.js +0 -7
@@ -1,16 +1,16 @@
1
1
  'use strict';
2
2
 
3
3
  var chunkKKK3FZ4A_cjs = require('./chunk-KKK3FZ4A.cjs');
4
- var chunkE7JHD6QJ_cjs = require('./chunk-E7JHD6QJ.cjs');
5
- var chunk53CBTBWO_cjs = require('./chunk-53CBTBWO.cjs');
4
+ var chunk27AXGJMV_cjs = require('./chunk-27AXGJMV.cjs');
5
+ var chunkP6H23T43_cjs = require('./chunk-P6H23T43.cjs');
6
6
  var chunkBV2MWEMV_cjs = require('./chunk-BV2MWEMV.cjs');
7
7
  var chunkNGESVVJN_cjs = require('./chunk-NGESVVJN.cjs');
8
8
  var chunkEI2Q7SJ5_cjs = require('./chunk-EI2Q7SJ5.cjs');
9
9
  var chunkQI7WE46I_cjs = require('./chunk-QI7WE46I.cjs');
10
10
  var chunk43GFJ5SD_cjs = require('./chunk-43GFJ5SD.cjs');
11
11
  var chunk2ZPEDVLM_cjs = require('./chunk-2ZPEDVLM.cjs');
12
- var chunkE3WZ6Y4H_cjs = require('./chunk-E3WZ6Y4H.cjs');
13
- var chunkU2AC6JUP_cjs = require('./chunk-U2AC6JUP.cjs');
12
+ var chunk7BG5UH3T_cjs = require('./chunk-7BG5UH3T.cjs');
13
+ var chunkJ2UROOIG_cjs = require('./chunk-J2UROOIG.cjs');
14
14
  var chunkWJVHMTKB_cjs = require('./chunk-WJVHMTKB.cjs');
15
15
  var chunk6JSIEDKL_cjs = require('./chunk-6JSIEDKL.cjs');
16
16
  var chunk4O5TGQBW_cjs = require('./chunk-4O5TGQBW.cjs');
@@ -24,7 +24,8 @@ var chunkBUIK7GUA_cjs = require('./chunk-BUIK7GUA.cjs');
24
24
  var chunk2ADR2GSO_cjs = require('./chunk-2ADR2GSO.cjs');
25
25
  var chunkZF2LDKQQ_cjs = require('./chunk-ZF2LDKQQ.cjs');
26
26
  var chunkI6TGFUCO_cjs = require('./chunk-I6TGFUCO.cjs');
27
- var chunkHJBMA5MB_cjs = require('./chunk-HJBMA5MB.cjs');
27
+ var chunkWNTAPVU5_cjs = require('./chunk-WNTAPVU5.cjs');
28
+ var chunkAQO3NSRG_cjs = require('./chunk-AQO3NSRG.cjs');
28
29
  var chunkIWBGCBR6_cjs = require('./chunk-IWBGCBR6.cjs');
29
30
  var chunkXSX2UU6Y_cjs = require('./chunk-XSX2UU6Y.cjs');
30
31
  var chunk3EE6LVWT_cjs = require('./chunk-3EE6LVWT.cjs');
@@ -453,7 +454,7 @@ function registryPath(cwd) {
453
454
  return path.join(cwd, REGISTRY_RELATIVE_PATH);
454
455
  }
455
456
  async function loadRegistry(cwd) {
456
- return chunkU2AC6JUP_cjs.readVersionedJson({
457
+ return chunkJ2UROOIG_cjs.readVersionedJson({
457
458
  path: registryPath(cwd),
458
459
  currentVersion: SCHEMA_VERSION,
459
460
  defaultValue: () => ({}),
@@ -477,7 +478,7 @@ async function saveRegistry(cwd, agents2) {
477
478
  }
478
479
  const path = registryPath(cwd);
479
480
  await chunkZF2LDKQQ_cjs.withCwdMutex(`registry:${cwd}`, async () => {
480
- await chunkU2AC6JUP_cjs.writeVersionedJson(path, serialized, SCHEMA_VERSION);
481
+ await chunkJ2UROOIG_cjs.writeVersionedJson(path, serialized, SCHEMA_VERSION);
481
482
  });
482
483
  }
483
484
  function toSerialized(agent) {
@@ -884,7 +885,7 @@ async function readLegacyFacts(jsonPath) {
884
885
  }
885
886
  async function writeMigratedFacts(cwd, jsonPath, facts) {
886
887
  try {
887
- for (const fact of facts) await chunkE7JHD6QJ_cjs.appendFactToMarkdown(cwd, fact);
888
+ for (const fact of facts) await chunk27AXGJMV_cjs.appendFactToMarkdown(cwd, fact);
888
889
  await promises.unlink(jsonPath).catch(() => void 0);
889
890
  chunkNUKRL3I6_cjs.diag(`[theokit-sdk] migrated ${facts.length} fact(s) from ${jsonPath} to MEMORY.md
890
891
  `);
@@ -901,11 +902,11 @@ async function migrateLegacyJson(cwd, config) {
901
902
  const key = `${cwd}::${config.namespace ?? "default"}::${config.scope ?? "agent"}::${config.userId ?? "default"}`;
902
903
  if (migrationRun.has(key)) return { migrated: false, factCount: 0, reason: "already-migrated" };
903
904
  migrationRun.add(key);
904
- const jsonPath = chunkE7JHD6QJ_cjs.legacyMemoryJsonPath(cwd, config);
905
+ const jsonPath = chunk27AXGJMV_cjs.legacyMemoryJsonPath(cwd, config);
905
906
  if (!await fileExists(jsonPath)) {
906
907
  return { migrated: false, factCount: 0, reason: "no-legacy-json" };
907
908
  }
908
- if (await fileExists(chunkE7JHD6QJ_cjs.memoryMdPath(cwd))) {
909
+ if (await fileExists(chunk27AXGJMV_cjs.memoryMdPath(cwd))) {
909
910
  chunkNUKRL3I6_cjs.diag(
910
911
  `[theokit-sdk] memory migration skipped: both MEMORY.md and legacy JSON exist at ${jsonPath}; leaving both intact
911
912
  `
@@ -932,12 +933,12 @@ function extractMemoryKind(message) {
932
933
  const declared = match?.[1];
933
934
  if (declared === void 0) return void 0;
934
935
  const lowered = declared.toLowerCase();
935
- return chunkE7JHD6QJ_cjs.MEMORY_KINDS.includes(lowered) ? lowered : void 0;
936
+ return chunk27AXGJMV_cjs.MEMORY_KINDS.includes(lowered) ? lowered : void 0;
936
937
  }
937
938
  async function readMemoryFacts(cwd, config) {
938
939
  if (!config.enabled) return [];
939
940
  await migrateLegacyJson(cwd, config);
940
- return chunkE7JHD6QJ_cjs.readFacts(cwd, config);
941
+ return chunk27AXGJMV_cjs.readFacts(cwd, config);
941
942
  }
942
943
  async function appendMemoryFact(cwd, config, fact) {
943
944
  if (!config.enabled) return;
@@ -946,7 +947,7 @@ async function appendMemoryFact(cwd, config, fact) {
946
947
  text: chunkJTB5Q42C_cjs.redactSecrets(fact.text),
947
948
  ...fact.kind === void 0 ? {} : { kind: fact.kind }
948
949
  };
949
- await chunkE7JHD6QJ_cjs.appendFact(cwd, config, sanitized);
950
+ await chunk27AXGJMV_cjs.appendFact(cwd, config, sanitized);
950
951
  }
951
952
 
952
953
  // src/internal/runtime/fixtures/fixture-scripts.ts
@@ -2158,14 +2159,14 @@ async function readState(filePath) {
2158
2159
  try {
2159
2160
  parsed = JSON.parse(raw);
2160
2161
  } catch {
2161
- chunk53CBTBWO_cjs.warnOnce(
2162
+ chunkP6H23T43_cjs.warnOnce(
2162
2163
  "personality-store-json-parse",
2163
2164
  "[theokit-sdk] personality.json is malformed; treating as empty"
2164
2165
  );
2165
2166
  return emptyState();
2166
2167
  }
2167
2168
  if (!isStateV1(parsed)) {
2168
- chunk53CBTBWO_cjs.warnOnce(
2169
+ chunkP6H23T43_cjs.warnOnce(
2169
2170
  "personality-store-bad-version",
2170
2171
  `[theokit-sdk] personality.json has unknown version; treating as empty (file kept untouched)`
2171
2172
  );
@@ -2196,7 +2197,7 @@ var PersonalityStore = class {
2196
2197
  try {
2197
2198
  await this.#persist(agentId, slug);
2198
2199
  } catch (err) {
2199
- chunk53CBTBWO_cjs.warnOnce(
2200
+ chunkP6H23T43_cjs.warnOnce(
2200
2201
  `personality-store-persist-failure-${agentId}`,
2201
2202
  `[theokit-sdk] personality persist failed for ${chunkJTB5Q42C_cjs.redactSecrets(agentId)}: ${chunkJTB5Q42C_cjs.redactSecrets(
2202
2203
  err.message
@@ -2213,7 +2214,7 @@ var PersonalityStore = class {
2213
2214
  try {
2214
2215
  state = await readState(filePath);
2215
2216
  } catch (err) {
2216
- chunk53CBTBWO_cjs.warnOnce(
2217
+ chunkP6H23T43_cjs.warnOnce(
2217
2218
  `personality-store-hydrate-failure-${agentId}`,
2218
2219
  `[theokit-sdk] personality hydrate failed for ${chunkJTB5Q42C_cjs.redactSecrets(agentId)}: ${chunkJTB5Q42C_cjs.redactSecrets(
2219
2220
  err.message
@@ -2242,7 +2243,7 @@ var PersonalityStore = class {
2242
2243
  });
2243
2244
  }
2244
2245
  #filePath() {
2245
- return path.join(chunkU2AC6JUP_cjs.getTheokitHome(this.#cwd), FILE_NAME);
2246
+ return path.join(chunkAQO3NSRG_cjs.getTheokitHome(this.#cwd), FILE_NAME);
2246
2247
  }
2247
2248
  };
2248
2249
 
@@ -2603,7 +2604,7 @@ var HooksExecutor = class {
2603
2604
  this.config = {};
2604
2605
  return;
2605
2606
  }
2606
- this.config = await chunk53CBTBWO_cjs.loadHookConfig(this.cwd);
2607
+ this.config = await chunkP6H23T43_cjs.loadHookConfig(this.cwd);
2607
2608
  }
2608
2609
  /** Fire every hook registered for `event` and aggregate the decisions. */
2609
2610
  async run(payload) {
@@ -2799,7 +2800,7 @@ async function runPostRunLifecycle(inputs) {
2799
2800
  if (memoryProvider?.recordSessionSummary !== void 0) {
2800
2801
  await memoryProvider.recordSessionSummary(summaryArgs);
2801
2802
  } else {
2802
- await chunkE7JHD6QJ_cjs.writeSessionSummary(summaryArgs);
2803
+ await chunk27AXGJMV_cjs.writeSessionSummary(summaryArgs);
2803
2804
  }
2804
2805
  if (!shouldUsePortMemoryPath()) {
2805
2806
  void memoryGlue.syncIfReady();
@@ -2926,13 +2927,24 @@ var SkillsManager = class {
2926
2927
  await this.refresh();
2927
2928
  }
2928
2929
  async refresh() {
2929
- const skillsRoot = this.skillsDir ?? path.join(this.cwd, ".theokit", "skills");
2930
- const discovered = await chunk3YJNUKYN_cjs.discoverSkills(skillsRoot, {
2931
- onInvalidSkill: (info) => {
2932
- chunkNUKRL3I6_cjs.diag(`[theokit-sdk] skill ${info.name} skipped (${info.code}): ${info.message}
2930
+ const roots = this.skillsDir === void 0 ? [
2931
+ ...chunkAQO3NSRG_cjs.projectConfigRoots(this.cwd).map((root) => path.join(root, "skills")),
2932
+ ...(await chunkWNTAPVU5_cjs.pluginBundleDirs(this.cwd)).map((bundle) => path.join(bundle, "skills"))
2933
+ ] : [this.skillsDir];
2934
+ const discovered = [];
2935
+ const seen = /* @__PURE__ */ new Set();
2936
+ for (const root of roots) {
2937
+ for (const skill of await chunk3YJNUKYN_cjs.discoverSkills(root, {
2938
+ onInvalidSkill: (info) => {
2939
+ chunkNUKRL3I6_cjs.diag(`[theokit-sdk] skill ${info.name} skipped (${info.code}): ${info.message}
2933
2940
  `);
2941
+ }
2942
+ })) {
2943
+ if (seen.has(skill.name)) continue;
2944
+ seen.add(skill.name);
2945
+ discovered.push(skill);
2934
2946
  }
2935
- });
2947
+ }
2936
2948
  this.skills = this.mergeInline(discovered);
2937
2949
  }
2938
2950
  /** M22 — merge inline skills over discovered ones; inline wins on a name conflict. */
@@ -3412,7 +3424,7 @@ var HISTOGRAM_NAMES = {
3412
3424
  };
3413
3425
  function safeRequire(moduleName) {
3414
3426
  try {
3415
- const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-M2JWHKO6.cjs', document.baseURI).href)));
3427
+ const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-N47KLTKD.cjs', document.baseURI).href)));
3416
3428
  return r(moduleName);
3417
3429
  } catch {
3418
3430
  return void 0;
@@ -3640,7 +3652,7 @@ var cachedOtel;
3640
3652
  function loadOtel() {
3641
3653
  if (cachedOtel === void 0) {
3642
3654
  try {
3643
- const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-M2JWHKO6.cjs', document.baseURI).href)));
3655
+ const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-N47KLTKD.cjs', document.baseURI).href)));
3644
3656
  const mod = r("@opentelemetry/api");
3645
3657
  cachedOtel = mod;
3646
3658
  } catch {
@@ -3959,7 +3971,7 @@ function applyAggregateCap(sources, maxTotal) {
3959
3971
  }
3960
3972
  const remaining = maxTotal - totalBytes;
3961
3973
  if (remaining > 0) {
3962
- const { finalContent } = chunkE3WZ6Y4H_cjs.truncateWithMarker(s.content, remaining);
3974
+ const { finalContent } = chunk7BG5UH3T_cjs.truncateWithMarker(s.content, remaining);
3963
3975
  kept.push({ ...s, content: finalContent, truncated: true });
3964
3976
  totalBytes = maxTotal;
3965
3977
  } else {
@@ -4033,9 +4045,9 @@ var FileContextManager = class {
4033
4045
  this.lastScope = [...touchedFiles];
4034
4046
  const config = await loadContextConfig(this.cwd);
4035
4047
  const legacy = await loadSources(config, this.cwd);
4036
- const maxBytesPerFile = this.settings.maxBytesPerFile ?? chunkE3WZ6Y4H_cjs.DEFAULT_MAX_BYTES_PER_FILE;
4048
+ const maxBytesPerFile = this.settings.maxBytesPerFile ?? chunk7BG5UH3T_cjs.DEFAULT_MAX_BYTES_PER_FILE;
4037
4049
  const maxBytesTotal = this.settings.maxBytesTotal ?? DEFAULT_MAX_BYTES_TOTAL;
4038
- const discovered = await chunkE3WZ6Y4H_cjs.runDiscovery({
4050
+ const discovered = await chunk7BG5UH3T_cjs.runDiscovery({
4039
4051
  cwd: this.cwd,
4040
4052
  maxBytesPerFile,
4041
4053
  skipLegacyTheokitContext: true,
@@ -4104,7 +4116,7 @@ async function loadContextConfig(cwd) {
4104
4116
  });
4105
4117
  if (mdEntities.length > 0) {
4106
4118
  if (fs.existsSync(jsonPath)) {
4107
- chunk53CBTBWO_cjs.warnOnce(
4119
+ chunkP6H23T43_cjs.warnOnce(
4108
4120
  "context-both-present",
4109
4121
  "[theokit-sdk] both .theokit/context/ and .theokit/context.json detected \u2014 using markdown; remove context.json"
4110
4122
  );
@@ -4114,7 +4126,7 @@ async function loadContextConfig(cwd) {
4114
4126
  };
4115
4127
  }
4116
4128
  if (!fs.existsSync(jsonPath)) return { sources: [] };
4117
- chunk53CBTBWO_cjs.warnOnce(
4129
+ chunkP6H23T43_cjs.warnOnce(
4118
4130
  "context-json-deprecated",
4119
4131
  "[theokit-sdk] .theokit/context.json is deprecated; migrate to .theokit/context/<name>.md via theokit-migrate-config"
4120
4132
  );
@@ -4248,25 +4260,37 @@ var PluginsManager = class {
4248
4260
  }
4249
4261
  await this.refresh();
4250
4262
  }
4251
- // biome-ignore lint/complexity/noExcessiveCognitiveComplexity: MD-first + JSON fallback + both-present detection per plugin folder — branch table is clearer inlined.
4252
4263
  async refresh() {
4253
4264
  this.plugins = [];
4254
- const pluginsRoot = path.join(this.cwd, ".theokit", "plugins");
4265
+ for (const pluginsRoot of chunkAQO3NSRG_cjs.pluginBundleRoots(this.cwd)) {
4266
+ await this.refreshRoot(pluginsRoot);
4267
+ }
4268
+ }
4269
+ // biome-ignore lint/complexity/noExcessiveCognitiveComplexity: MD-first + JSON fallback + CLI location + both-present detection per plugin folder — branch table is clearer inlined.
4270
+ async refreshRoot(pluginsRoot) {
4255
4271
  const entries = await chunkIWBGCBR6_cjs.readWorkspaceDir(pluginsRoot, "plugins_read_error", "plugins directory");
4256
4272
  for (const entry of entries) {
4257
4273
  if (!entry.isDirectory()) continue;
4258
4274
  const folderName = entry.name;
4275
+ const cliPath = path.join(pluginsRoot, folderName, ".claude-plugin", "plugin.json");
4276
+ if (fs.existsSync(cliPath)) {
4277
+ const cliMetadata = await loadPluginManifestFromJson(cliPath, folderName);
4278
+ if (this.enabled === void 0 || this.enabled.includes(cliMetadata.name)) {
4279
+ this.plugins.push(cliMetadata);
4280
+ }
4281
+ continue;
4282
+ }
4259
4283
  const mdPath = path.join(pluginsRoot, folderName, "PLUGIN.md");
4260
4284
  const jsonPath = path.join(pluginsRoot, folderName, "plugin.json");
4261
4285
  const metadata = fs.existsSync(mdPath) ? await loadPluginManifestFromMarkdown(pluginsRoot, folderName) : await loadPluginManifestFromJson(jsonPath, folderName);
4262
4286
  if (fs.existsSync(mdPath) && fs.existsSync(jsonPath)) {
4263
- chunk53CBTBWO_cjs.warnOnce(
4287
+ chunkP6H23T43_cjs.warnOnce(
4264
4288
  `plugin-${folderName}-both`,
4265
4289
  `[theokit-sdk] both ${folderName}/PLUGIN.md and ${folderName}/plugin.json detected \u2014 using markdown; remove plugin.json`
4266
4290
  );
4267
4291
  }
4268
4292
  if (!fs.existsSync(mdPath) && fs.existsSync(jsonPath)) {
4269
- chunk53CBTBWO_cjs.warnOnce(
4293
+ chunkP6H23T43_cjs.warnOnce(
4270
4294
  "plugin-json-deprecated",
4271
4295
  "[theokit-sdk] plugin.json manifests are deprecated; migrate to PLUGIN.md via theokit-migrate-config"
4272
4296
  );
@@ -7014,7 +7038,7 @@ function applyPersonalityFilter(exposedTools, whitelist, opts) {
7014
7038
  if (exposedSet.has(name)) continue;
7015
7039
  const hint = suggestClosest(name, exposedSet);
7016
7040
  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)`;
7017
- chunk53CBTBWO_cjs.warnOnce(
7041
+ chunkP6H23T43_cjs.warnOnce(
7018
7042
  `personality-tool-missing|${opts?.agentId ?? "?"}|${opts?.personalityName ?? "?"}|${name}`,
7019
7043
  message
7020
7044
  );
@@ -7739,7 +7763,7 @@ async function reloadLocalAgent(agent) {
7739
7763
  if (agent.context !== void 0) await agent.context.refresh();
7740
7764
  if (agent.skillsManager !== void 0) await agent.skillsManager.refresh();
7741
7765
  if (agent.pluginsManager !== void 0) await agent.pluginsManager.refresh();
7742
- return await chunkHJBMA5MB_cjs.loadSubagents(
7766
+ return await chunkWNTAPVU5_cjs.loadSubagents(
7743
7767
  agent.workspaceCwd,
7744
7768
  agent.settingSourcesIncludeProject,
7745
7769
  agent.options.agents
@@ -7747,7 +7771,7 @@ async function reloadLocalAgent(agent) {
7747
7771
  }
7748
7772
  async function persistActiveMemoryTranscript(cwd, transcript) {
7749
7773
  try {
7750
- const dir = path.join(chunkE7JHD6QJ_cjs.memoryDir(cwd), "transcripts", "active-memory");
7774
+ const dir = path.join(chunk27AXGJMV_cjs.memoryDir(cwd), "transcripts", "active-memory");
7751
7775
  const file = path.join(dir, `${transcript.runId}.json`);
7752
7776
  await chunkI6TGFUCO_cjs.atomicWriteJson(file, transcript);
7753
7777
  } catch (cause) {
@@ -8377,7 +8401,7 @@ function createMemorySearchTool(opts) {
8377
8401
  };
8378
8402
  }
8379
8403
  function createMemoryGetTool(opts) {
8380
- const memoryRoot = path.resolve(chunkE7JHD6QJ_cjs.memoryDir(opts.cwd));
8404
+ const memoryRoot = path.resolve(chunk27AXGJMV_cjs.memoryDir(opts.cwd));
8381
8405
  return {
8382
8406
  name: "memory_get",
8383
8407
  description: GET_DESCRIPTION,
@@ -8483,7 +8507,7 @@ var LocalAgentMemory = class {
8483
8507
  const openOpts = { cwd: this.workspaceCwd };
8484
8508
  if (embedding !== void 0) openOpts.embedding = embedding;
8485
8509
  if (cfg?.backend !== void 0) openOpts.backend = cfg.backend;
8486
- this.index = await chunkE7JHD6QJ_cjs.IndexManager.open(openOpts);
8510
+ this.index = await chunk27AXGJMV_cjs.IndexManager.open(openOpts);
8487
8511
  await this.index.sync();
8488
8512
  this.toolsCache = [
8489
8513
  createMemorySearchTool({ index: this.index }),
@@ -8741,7 +8765,7 @@ function createLocalAgentMemoryProvider(opts) {
8741
8765
  return { facts: [], systemPromptAdditions: summary };
8742
8766
  },
8743
8767
  async recordSessionSummary(args) {
8744
- await chunkE7JHD6QJ_cjs.writeSessionSummary(args);
8768
+ await chunk27AXGJMV_cjs.writeSessionSummary(args);
8745
8769
  },
8746
8770
  async sync(handle) {
8747
8771
  const state = handle[INTERNAL_LAM_KEY];
@@ -8831,7 +8855,7 @@ function addEntity(byName, entity, origin, collisionMap) {
8831
8855
  );
8832
8856
  }
8833
8857
  if (origin === "project" && collisionMap?.has(fm.name)) {
8834
- chunk53CBTBWO_cjs.warnOnce(
8858
+ chunkP6H23T43_cjs.warnOnce(
8835
8859
  `personality-collision-${fm.name}`,
8836
8860
  `[theokit-sdk] personality "${fm.name}" overridden by project preset`
8837
8861
  );
@@ -8881,14 +8905,14 @@ async function performPersonalitySwitch(args) {
8881
8905
 
8882
8906
  // src/internal/local-agent/local-agent-personality-extensions.ts
8883
8907
  function resolveActivePersonalityPreset(args) {
8884
- const forkCtx = chunk53CBTBWO_cjs.currentPersonalityContext();
8908
+ const forkCtx = chunkP6H23T43_cjs.currentPersonalityContext();
8885
8909
  const slug = forkCtx !== void 0 ? forkCtx.slug : args.personalityStore.active(args.agentId);
8886
8910
  if (slug === void 0) return void 0;
8887
8911
  return args.personalityRegistry?.get(slug);
8888
8912
  }
8889
8913
  async function ensurePersonalityRegistryIfNeeded(args) {
8890
8914
  if (args.personalityRegistry !== void 0) return args.personalityRegistry;
8891
- const forkSlug = chunk53CBTBWO_cjs.currentPersonalityContext()?.slug;
8915
+ const forkSlug = chunkP6H23T43_cjs.currentPersonalityContext()?.slug;
8892
8916
  const ownSlug = args.personalityStore.active(args.agentId);
8893
8917
  if (forkSlug === void 0 && ownSlug === void 0) return void 0;
8894
8918
  return await PersonalityRegistry.load(args.workspaceCwd);
@@ -8902,8 +8926,8 @@ ${preset.systemPrompt}`;
8902
8926
  }
8903
8927
  async function localAgentUsePersonality(args) {
8904
8928
  if (args.disposed) throw new Error("Agent has been disposed");
8905
- if (chunk53CBTBWO_cjs.currentPersonalityContext() !== void 0) {
8906
- chunk53CBTBWO_cjs.warnPersonalitySwitchInsideFork(args.agentId);
8929
+ if (chunkP6H23T43_cjs.currentPersonalityContext() !== void 0) {
8930
+ chunkP6H23T43_cjs.warnPersonalitySwitchInsideFork(args.agentId);
8907
8931
  return null;
8908
8932
  }
8909
8933
  let registry = args.personalityRegistry;
@@ -8965,7 +8989,7 @@ async function* localAgentStreamToCompletion(agent, message, options) {
8965
8989
  async function localAgentFork(parent, options) {
8966
8990
  const { forkAgentImpl } = await import('./fork-agent-Y2IK2RYU.cjs');
8967
8991
  const { getAgentFacade } = await import('./agent-factory-registry-UU46BUMU.cjs');
8968
- const { withPersonalityContext } = await import('./context-VMIE4BMD.cjs');
8992
+ const { withPersonalityContext } = await import('./context-LCKNH2XI.cjs');
8969
8993
  const create = getAgentFacade().create;
8970
8994
  return withPersonalityContext(
8971
8995
  { slug: parent.personalitySlugSnapshot, isFork: true },
@@ -9513,7 +9537,7 @@ var LocalAgent = class {
9513
9537
  if (this.pluginsManager !== void 0) await this.pluginsManager.initialize();
9514
9538
  const codePlugins = chunkBV2MWEMV_cjs.extractCodePlugins(this.options.plugins);
9515
9539
  await this.pluginManagerCode.initialize(codePlugins);
9516
- this.resolvedSubagents = await chunkHJBMA5MB_cjs.loadSubagents(
9540
+ this.resolvedSubagents = await chunkWNTAPVU5_cjs.loadSubagents(
9517
9541
  this.workspaceCwd,
9518
9542
  this.settingSourcesIncludeProject,
9519
9543
  this.options.agents
@@ -10475,7 +10499,7 @@ var Agent = class _Agent {
10475
10499
  */
10476
10500
  static async describe(agentId) {
10477
10501
  const agent = await getRegisteredAgentOrThrow(agentId);
10478
- const { loadSubagents: loadSubagents2 } = await import('./subagents-loader-AZIXJ7D3.cjs');
10502
+ const { loadSubagents: loadSubagents2 } = await import('./subagents-loader-X5QKODCL.cjs');
10479
10503
  const settingSources = agent.options.local?.settingSources;
10480
10504
  const subagents = await loadSubagents2(
10481
10505
  agent.cwd ?? process.cwd(),
@@ -10560,5 +10584,5 @@ exports.computeCost = computeCost;
10560
10584
  exports.generateCronId = generateCronId;
10561
10585
  exports.getPricingEntry = getPricingEntry;
10562
10586
  exports.openRouterMemoryEmbeddingProviderAdapter = openRouterMemoryEmbeddingProviderAdapter;
10563
- //# sourceMappingURL=chunk-M2JWHKO6.cjs.map
10564
- //# sourceMappingURL=chunk-M2JWHKO6.cjs.map
10587
+ //# sourceMappingURL=chunk-N47KLTKD.cjs.map
10588
+ //# sourceMappingURL=chunk-N47KLTKD.cjs.map