open-multi-agent-kit 0.80.6 → 0.80.8

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 (949) hide show
  1. package/CHANGELOG.md +4 -20
  2. package/README.md +66 -16
  3. package/dist/agents/jailbreak/index.d.ts +7 -0
  4. package/dist/agents/jailbreak/index.d.ts.map +1 -0
  5. package/dist/agents/jailbreak/index.js +7 -0
  6. package/dist/agents/jailbreak/index.js.map +1 -0
  7. package/dist/agents/jailbreak/subagent-f.d.ts +44 -0
  8. package/dist/agents/jailbreak/subagent-f.d.ts.map +1 -0
  9. package/dist/agents/jailbreak/subagent-f.js +60 -0
  10. package/dist/agents/jailbreak/subagent-f.js.map +1 -0
  11. package/dist/bun/register-bedrock.d.ts.map +1 -1
  12. package/dist/bun/register-bedrock.js +2 -2
  13. package/dist/bun/register-bedrock.js.map +1 -1
  14. package/dist/ci/verify-reporter.d.ts +22 -0
  15. package/dist/ci/verify-reporter.d.ts.map +1 -0
  16. package/dist/ci/verify-reporter.js +50 -0
  17. package/dist/ci/verify-reporter.js.map +1 -0
  18. package/dist/cli/args.d.ts +4 -1
  19. package/dist/cli/args.d.ts.map +1 -1
  20. package/dist/cli/args.js +7 -0
  21. package/dist/cli/args.js.map +1 -1
  22. package/dist/cli/config-selector.d.ts +1 -1
  23. package/dist/cli/config-selector.d.ts.map +1 -1
  24. package/dist/cli/config-selector.js +2 -2
  25. package/dist/cli/config-selector.js.map +1 -1
  26. package/dist/cli/file-processor.d.ts +1 -1
  27. package/dist/cli/file-processor.d.ts.map +1 -1
  28. package/dist/cli/file-processor.js.map +1 -1
  29. package/dist/cli/initial-message.d.ts +1 -1
  30. package/dist/cli/initial-message.d.ts.map +1 -1
  31. package/dist/cli/initial-message.js.map +1 -1
  32. package/dist/cli/jailbreak-args.d.ts +26 -0
  33. package/dist/cli/jailbreak-args.d.ts.map +1 -0
  34. package/dist/cli/jailbreak-args.js +86 -0
  35. package/dist/cli/jailbreak-args.js.map +1 -0
  36. package/dist/cli/list-models.d.ts.map +1 -1
  37. package/dist/cli/list-models.js +1 -1
  38. package/dist/cli/list-models.js.map +1 -1
  39. package/dist/cli/session-picker.d.ts.map +1 -1
  40. package/dist/cli/session-picker.js +1 -1
  41. package/dist/cli/session-picker.js.map +1 -1
  42. package/dist/commands/doctor-provider.d.ts +19 -0
  43. package/dist/commands/doctor-provider.d.ts.map +1 -0
  44. package/dist/commands/doctor-provider.js +123 -0
  45. package/dist/commands/doctor-provider.js.map +1 -0
  46. package/dist/commands/jailbreak.d.ts +49 -0
  47. package/dist/commands/jailbreak.d.ts.map +1 -0
  48. package/dist/commands/jailbreak.js +201 -0
  49. package/dist/commands/jailbreak.js.map +1 -0
  50. package/dist/config.d.ts +9 -4
  51. package/dist/config.d.ts.map +1 -1
  52. package/dist/config.js +34 -52
  53. package/dist/config.js.map +1 -1
  54. package/dist/core/agent-session-services.d.ts +2 -2
  55. package/dist/core/agent-session-services.d.ts.map +1 -1
  56. package/dist/core/agent-session-services.js.map +1 -1
  57. package/dist/core/agent-session.d.ts +36 -8
  58. package/dist/core/agent-session.d.ts.map +1 -1
  59. package/dist/core/agent-session.js +294 -14
  60. package/dist/core/agent-session.js.map +1 -1
  61. package/dist/core/auth-storage.d.ts +3 -3
  62. package/dist/core/auth-storage.d.ts.map +1 -1
  63. package/dist/core/auth-storage.js +4 -4
  64. package/dist/core/auth-storage.js.map +1 -1
  65. package/dist/core/bash-executor.d.ts +1 -0
  66. package/dist/core/bash-executor.d.ts.map +1 -1
  67. package/dist/core/bash-executor.js +2 -1
  68. package/dist/core/bash-executor.js.map +1 -1
  69. package/dist/core/browser-use.d.ts +45 -0
  70. package/dist/core/browser-use.d.ts.map +1 -0
  71. package/dist/core/browser-use.js +70 -0
  72. package/dist/core/browser-use.js.map +1 -0
  73. package/dist/core/command-safety-parser.d.ts +77 -0
  74. package/dist/core/command-safety-parser.d.ts.map +1 -0
  75. package/dist/core/command-safety-parser.js +763 -0
  76. package/dist/core/command-safety-parser.js.map +1 -0
  77. package/dist/core/command-safety.d.ts +11 -0
  78. package/dist/core/command-safety.d.ts.map +1 -0
  79. package/dist/core/command-safety.js +631 -0
  80. package/dist/core/command-safety.js.map +1 -0
  81. package/dist/core/compaction/branch-summarization.d.ts +2 -2
  82. package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
  83. package/dist/core/compaction/branch-summarization.js +2 -8
  84. package/dist/core/compaction/branch-summarization.js.map +1 -1
  85. package/dist/core/compaction/compaction.d.ts +3 -84
  86. package/dist/core/compaction/compaction.d.ts.map +1 -1
  87. package/dist/core/compaction/compaction.js +11 -608
  88. package/dist/core/compaction/compaction.js.map +1 -1
  89. package/dist/core/compaction/utils.d.ts +2 -2
  90. package/dist/core/compaction/utils.d.ts.map +1 -1
  91. package/dist/core/compaction/utils.js.map +1 -1
  92. package/dist/core/compactor.d.ts +42 -0
  93. package/dist/core/compactor.d.ts.map +1 -0
  94. package/dist/core/compactor.js +131 -0
  95. package/dist/core/compactor.js.map +1 -0
  96. package/dist/core/context-budget-compressors.d.ts +50 -0
  97. package/dist/core/context-budget-compressors.d.ts.map +1 -0
  98. package/dist/core/context-budget-compressors.js +166 -0
  99. package/dist/core/context-budget-compressors.js.map +1 -0
  100. package/dist/core/context-budget-governor-v2.d.ts +7 -0
  101. package/dist/core/context-budget-governor-v2.d.ts.map +1 -0
  102. package/dist/core/context-budget-governor-v2.js +7 -0
  103. package/dist/core/context-budget-governor-v2.js.map +1 -0
  104. package/dist/core/context-budget-governor.d.ts +67 -0
  105. package/dist/core/context-budget-governor.d.ts.map +1 -0
  106. package/dist/core/context-budget-governor.js +224 -0
  107. package/dist/core/context-budget-governor.js.map +1 -0
  108. package/dist/core/context-budget-headroom-candidates.d.ts +3 -0
  109. package/dist/core/context-budget-headroom-candidates.d.ts.map +1 -0
  110. package/dist/core/context-budget-headroom-candidates.js +85 -0
  111. package/dist/core/context-budget-headroom-candidates.js.map +1 -0
  112. package/dist/core/context-budget-headroom-types.d.ts +67 -0
  113. package/dist/core/context-budget-headroom-types.d.ts.map +1 -0
  114. package/dist/core/context-budget-headroom-types.js +46 -0
  115. package/dist/core/context-budget-headroom-types.js.map +1 -0
  116. package/dist/core/context-budget-headroom.d.ts +5 -0
  117. package/dist/core/context-budget-headroom.d.ts.map +1 -0
  118. package/dist/core/context-budget-headroom.js +123 -0
  119. package/dist/core/context-budget-headroom.js.map +1 -0
  120. package/dist/core/context-budget-relevance.d.ts +46 -0
  121. package/dist/core/context-budget-relevance.d.ts.map +1 -0
  122. package/dist/core/context-budget-relevance.js +329 -0
  123. package/dist/core/context-budget-relevance.js.map +1 -0
  124. package/dist/core/context-budget-system-prompt-items.d.ts +19 -0
  125. package/dist/core/context-budget-system-prompt-items.d.ts.map +1 -0
  126. package/dist/core/context-budget-system-prompt-items.js +143 -0
  127. package/dist/core/context-budget-system-prompt-items.js.map +1 -0
  128. package/dist/core/context-budget-system-prompt.d.ts +31 -0
  129. package/dist/core/context-budget-system-prompt.d.ts.map +1 -0
  130. package/dist/core/context-budget-system-prompt.js +87 -0
  131. package/dist/core/context-budget-system-prompt.js.map +1 -0
  132. package/dist/core/context-budget-token-counter.d.ts +34 -0
  133. package/dist/core/context-budget-token-counter.d.ts.map +1 -0
  134. package/dist/core/context-budget-token-counter.js +315 -0
  135. package/dist/core/context-budget-token-counter.js.map +1 -0
  136. package/dist/core/context-budget-v2-coverage.d.ts +5 -0
  137. package/dist/core/context-budget-v2-coverage.d.ts.map +1 -0
  138. package/dist/core/context-budget-v2-coverage.js +58 -0
  139. package/dist/core/context-budget-v2-coverage.js.map +1 -0
  140. package/dist/core/context-budget-v2-plan-hash.d.ts +12 -0
  141. package/dist/core/context-budget-v2-plan-hash.d.ts.map +1 -0
  142. package/dist/core/context-budget-v2-plan-hash.js +38 -0
  143. package/dist/core/context-budget-v2-plan-hash.js.map +1 -0
  144. package/dist/core/context-budget-v2-planner.d.ts +3 -0
  145. package/dist/core/context-budget-v2-planner.d.ts.map +1 -0
  146. package/dist/core/context-budget-v2-planner.js +143 -0
  147. package/dist/core/context-budget-v2-planner.js.map +1 -0
  148. package/dist/core/context-budget-v2-scoring.d.ts +14 -0
  149. package/dist/core/context-budget-v2-scoring.d.ts.map +1 -0
  150. package/dist/core/context-budget-v2-scoring.js +114 -0
  151. package/dist/core/context-budget-v2-scoring.js.map +1 -0
  152. package/dist/core/context-budget-v2-selection.d.ts +32 -0
  153. package/dist/core/context-budget-v2-selection.d.ts.map +1 -0
  154. package/dist/core/context-budget-v2-selection.js +158 -0
  155. package/dist/core/context-budget-v2-selection.js.map +1 -0
  156. package/dist/core/context-budget-v2-tiers.d.ts +15 -0
  157. package/dist/core/context-budget-v2-tiers.d.ts.map +1 -0
  158. package/dist/core/context-budget-v2-tiers.js +68 -0
  159. package/dist/core/context-budget-v2-tiers.js.map +1 -0
  160. package/dist/core/context-budget-v2-types.d.ts +92 -0
  161. package/dist/core/context-budget-v2-types.d.ts.map +1 -0
  162. package/dist/core/context-budget-v2-types.js +24 -0
  163. package/dist/core/context-budget-v2-types.js.map +1 -0
  164. package/dist/core/defaults.d.ts +1 -1
  165. package/dist/core/defaults.d.ts.map +1 -1
  166. package/dist/core/defaults.js.map +1 -1
  167. package/dist/core/diagnostics.d.ts +4 -0
  168. package/dist/core/diagnostics.d.ts.map +1 -1
  169. package/dist/core/diagnostics.js.map +1 -1
  170. package/dist/core/domain-confidence.d.ts +9 -0
  171. package/dist/core/domain-confidence.d.ts.map +1 -0
  172. package/dist/core/domain-confidence.js +39 -0
  173. package/dist/core/domain-confidence.js.map +1 -0
  174. package/dist/core/domain-dispatch.d.ts +44 -0
  175. package/dist/core/domain-dispatch.d.ts.map +1 -0
  176. package/dist/core/domain-dispatch.js +118 -0
  177. package/dist/core/domain-dispatch.js.map +1 -0
  178. package/dist/core/domain-loadouts.d.ts +76 -0
  179. package/dist/core/domain-loadouts.d.ts.map +1 -0
  180. package/dist/core/domain-loadouts.js +981 -0
  181. package/dist/core/domain-loadouts.js.map +1 -0
  182. package/dist/core/domain-registry.d.ts +7 -0
  183. package/dist/core/domain-registry.d.ts.map +1 -0
  184. package/dist/core/domain-registry.js +11 -0
  185. package/dist/core/domain-registry.js.map +1 -0
  186. package/dist/core/domain-router.d.ts +16 -0
  187. package/dist/core/domain-router.d.ts.map +1 -0
  188. package/dist/core/domain-router.js +24 -0
  189. package/dist/core/domain-router.js.map +1 -0
  190. package/dist/core/domain-score.d.ts +13 -0
  191. package/dist/core/domain-score.d.ts.map +1 -0
  192. package/dist/core/domain-score.js +48 -0
  193. package/dist/core/domain-score.js.map +1 -0
  194. package/dist/core/domain-trigger-match.d.ts +14 -0
  195. package/dist/core/domain-trigger-match.d.ts.map +1 -0
  196. package/dist/core/domain-trigger-match.js +51 -0
  197. package/dist/core/domain-trigger-match.js.map +1 -0
  198. package/dist/core/domain-types.d.ts +30 -0
  199. package/dist/core/domain-types.d.ts.map +1 -0
  200. package/dist/core/domain-types.js +2 -0
  201. package/dist/core/domain-types.js.map +1 -0
  202. package/dist/core/exact-cache-policy.d.ts +108 -0
  203. package/dist/core/exact-cache-policy.d.ts.map +1 -0
  204. package/dist/core/exact-cache-policy.js +184 -0
  205. package/dist/core/exact-cache-policy.js.map +1 -0
  206. package/dist/core/export-html/index.d.ts +1 -1
  207. package/dist/core/export-html/index.d.ts.map +1 -1
  208. package/dist/core/export-html/index.js.map +1 -1
  209. package/dist/core/export-html/template.js +2 -4
  210. package/dist/core/export-html/tool-renderer.d.ts.map +1 -1
  211. package/dist/core/export-html/tool-renderer.js.map +1 -1
  212. package/dist/core/extensions/builtin/command-safety-gate.d.ts +80 -0
  213. package/dist/core/extensions/builtin/command-safety-gate.d.ts.map +1 -0
  214. package/dist/core/extensions/builtin/command-safety-gate.js +159 -0
  215. package/dist/core/extensions/builtin/command-safety-gate.js.map +1 -0
  216. package/dist/core/extensions/builtin/todo-checklist.d.ts +20 -0
  217. package/dist/core/extensions/builtin/todo-checklist.d.ts.map +1 -0
  218. package/dist/core/extensions/builtin/todo-checklist.js +70 -0
  219. package/dist/core/extensions/builtin/todo-checklist.js.map +1 -0
  220. package/dist/core/extensions/loader.d.ts.map +1 -1
  221. package/dist/core/extensions/loader.js +50 -47
  222. package/dist/core/extensions/loader.js.map +1 -1
  223. package/dist/core/extensions/runner.d.ts +3 -3
  224. package/dist/core/extensions/runner.d.ts.map +1 -1
  225. package/dist/core/extensions/runner.js +1 -1
  226. package/dist/core/extensions/runner.js.map +1 -1
  227. package/dist/core/extensions/types.d.ts +13 -13
  228. package/dist/core/extensions/types.d.ts.map +1 -1
  229. package/dist/core/extensions/types.js.map +1 -1
  230. package/dist/core/extensions/wrapper.d.ts +1 -1
  231. package/dist/core/extensions/wrapper.d.ts.map +1 -1
  232. package/dist/core/extensions/wrapper.js.map +1 -1
  233. package/dist/core/headroom.d.ts +45 -0
  234. package/dist/core/headroom.d.ts.map +1 -0
  235. package/dist/core/headroom.js +171 -0
  236. package/dist/core/headroom.js.map +1 -0
  237. package/dist/core/hook-inventory.d.ts +25 -0
  238. package/dist/core/hook-inventory.d.ts.map +1 -0
  239. package/dist/core/hook-inventory.js +119 -0
  240. package/dist/core/hook-inventory.js.map +1 -0
  241. package/dist/core/hooks/fail-closed.d.ts +4 -1
  242. package/dist/core/hooks/fail-closed.d.ts.map +1 -1
  243. package/dist/core/hooks/fail-closed.js +79 -5
  244. package/dist/core/hooks/fail-closed.js.map +1 -1
  245. package/dist/core/hooks/index.d.ts +2 -2
  246. package/dist/core/hooks/index.d.ts.map +1 -1
  247. package/dist/core/hooks/index.js +1 -1
  248. package/dist/core/hooks/index.js.map +1 -1
  249. package/dist/core/hooks/types.d.ts +9 -0
  250. package/dist/core/hooks/types.d.ts.map +1 -1
  251. package/dist/core/hooks/types.js.map +1 -1
  252. package/dist/core/keybindings.d.ts +2 -14
  253. package/dist/core/keybindings.d.ts.map +1 -1
  254. package/dist/core/keybindings.js +1 -31
  255. package/dist/core/keybindings.js.map +1 -1
  256. package/dist/core/lean-ctx.d.ts +99 -0
  257. package/dist/core/lean-ctx.d.ts.map +1 -0
  258. package/dist/core/lean-ctx.js +225 -0
  259. package/dist/core/lean-ctx.js.map +1 -0
  260. package/dist/core/loadout-access-policy.d.ts +41 -0
  261. package/dist/core/loadout-access-policy.d.ts.map +1 -0
  262. package/dist/core/loadout-access-policy.js +182 -0
  263. package/dist/core/loadout-access-policy.js.map +1 -0
  264. package/dist/core/loadout-compose.d.ts +53 -0
  265. package/dist/core/loadout-compose.d.ts.map +1 -0
  266. package/dist/core/loadout-compose.js +172 -0
  267. package/dist/core/loadout-compose.js.map +1 -0
  268. package/dist/core/loadout-policy-bridge.d.ts +22 -0
  269. package/dist/core/loadout-policy-bridge.d.ts.map +1 -0
  270. package/dist/core/loadout-policy-bridge.js +52 -0
  271. package/dist/core/loadout-policy-bridge.js.map +1 -0
  272. package/dist/core/loadout-runtime.d.ts +106 -0
  273. package/dist/core/loadout-runtime.d.ts.map +1 -0
  274. package/dist/core/loadout-runtime.js +193 -0
  275. package/dist/core/loadout-runtime.js.map +1 -0
  276. package/dist/core/loadout-safety.d.ts +55 -0
  277. package/dist/core/loadout-safety.d.ts.map +1 -0
  278. package/dist/core/loadout-safety.js +213 -0
  279. package/dist/core/loadout-safety.js.map +1 -0
  280. package/dist/core/loadouts.d.ts +149 -0
  281. package/dist/core/loadouts.d.ts.map +1 -0
  282. package/dist/core/loadouts.js +553 -0
  283. package/dist/core/loadouts.js.map +1 -0
  284. package/dist/core/loop-gates.d.ts +48 -0
  285. package/dist/core/loop-gates.d.ts.map +1 -0
  286. package/dist/core/loop-gates.js +352 -0
  287. package/dist/core/loop-gates.js.map +1 -0
  288. package/dist/core/loop-registry.d.ts +77 -0
  289. package/dist/core/loop-registry.d.ts.map +1 -0
  290. package/dist/core/loop-registry.js +831 -0
  291. package/dist/core/loop-registry.js.map +1 -0
  292. package/dist/core/loop-types.d.ts +194 -0
  293. package/dist/core/loop-types.d.ts.map +1 -0
  294. package/dist/core/loop-types.js +2 -0
  295. package/dist/core/loop-types.js.map +1 -0
  296. package/dist/core/mcp-inventory.d.ts +41 -0
  297. package/dist/core/mcp-inventory.d.ts.map +1 -1
  298. package/dist/core/mcp-inventory.js +57 -1
  299. package/dist/core/mcp-inventory.js.map +1 -1
  300. package/dist/core/mcp-presets.d.ts +98 -0
  301. package/dist/core/mcp-presets.d.ts.map +1 -0
  302. package/dist/core/mcp-presets.js +377 -0
  303. package/dist/core/mcp-presets.js.map +1 -0
  304. package/dist/core/messages.d.ts +3 -3
  305. package/dist/core/messages.d.ts.map +1 -1
  306. package/dist/core/messages.js.map +1 -1
  307. package/dist/core/metrics-sampler.d.ts +11 -0
  308. package/dist/core/metrics-sampler.d.ts.map +1 -1
  309. package/dist/core/metrics-sampler.js +52 -13
  310. package/dist/core/metrics-sampler.js.map +1 -1
  311. package/dist/core/model-registry.d.ts +1 -1
  312. package/dist/core/model-registry.d.ts.map +1 -1
  313. package/dist/core/model-registry.js +2 -2
  314. package/dist/core/model-registry.js.map +1 -1
  315. package/dist/core/model-resolver.d.ts +2 -2
  316. package/dist/core/model-resolver.d.ts.map +1 -1
  317. package/dist/core/model-resolver.js +1 -1
  318. package/dist/core/model-resolver.js.map +1 -1
  319. package/dist/core/package-gallery-identity.d.ts +7 -0
  320. package/dist/core/package-gallery-identity.d.ts.map +1 -0
  321. package/dist/core/package-gallery-identity.js +31 -0
  322. package/dist/core/package-gallery-identity.js.map +1 -0
  323. package/dist/core/package-gallery-install.d.ts +6 -0
  324. package/dist/core/package-gallery-install.d.ts.map +1 -0
  325. package/dist/core/package-gallery-install.js +59 -0
  326. package/dist/core/package-gallery-install.js.map +1 -0
  327. package/dist/core/package-gallery-manifest.d.ts +13 -0
  328. package/dist/core/package-gallery-manifest.d.ts.map +1 -0
  329. package/dist/core/package-gallery-manifest.js +183 -0
  330. package/dist/core/package-gallery-manifest.js.map +1 -0
  331. package/dist/core/package-gallery-trial.d.ts +4 -0
  332. package/dist/core/package-gallery-trial.d.ts.map +1 -0
  333. package/dist/core/package-gallery-trial.js +55 -0
  334. package/dist/core/package-gallery-trial.js.map +1 -0
  335. package/dist/core/package-gallery-types.d.ts +71 -0
  336. package/dist/core/package-gallery-types.d.ts.map +1 -0
  337. package/dist/core/package-gallery-types.js +2 -0
  338. package/dist/core/package-gallery-types.js.map +1 -0
  339. package/dist/core/package-gallery.d.ts +6 -0
  340. package/dist/core/package-gallery.d.ts.map +1 -0
  341. package/dist/core/package-gallery.js +6 -0
  342. package/dist/core/package-gallery.js.map +1 -0
  343. package/dist/core/package-manager.d.ts.map +1 -1
  344. package/dist/core/package-manager.js +10 -10
  345. package/dist/core/package-manager.js.map +1 -1
  346. package/dist/core/package-procurement.d.ts +268 -0
  347. package/dist/core/package-procurement.d.ts.map +1 -0
  348. package/dist/core/package-procurement.js +709 -0
  349. package/dist/core/package-procurement.js.map +1 -0
  350. package/dist/core/provider-attribution.d.ts +1 -1
  351. package/dist/core/provider-attribution.d.ts.map +1 -1
  352. package/dist/core/provider-attribution.js.map +1 -1
  353. package/dist/core/read-anchors.d.ts +110 -0
  354. package/dist/core/read-anchors.d.ts.map +1 -0
  355. package/dist/core/read-anchors.js +193 -0
  356. package/dist/core/read-anchors.js.map +1 -0
  357. package/dist/core/recovery-checkpoint.d.ts +196 -0
  358. package/dist/core/recovery-checkpoint.d.ts.map +1 -0
  359. package/dist/core/recovery-checkpoint.js +382 -0
  360. package/dist/core/recovery-checkpoint.js.map +1 -0
  361. package/dist/core/resource-loader.d.ts +15 -21
  362. package/dist/core/resource-loader.d.ts.map +1 -1
  363. package/dist/core/resource-loader.js +62 -8
  364. package/dist/core/resource-loader.js.map +1 -1
  365. package/dist/core/sandbox/backend.d.ts +25 -0
  366. package/dist/core/sandbox/backend.d.ts.map +1 -0
  367. package/dist/core/sandbox/backend.js +150 -0
  368. package/dist/core/sandbox/backend.js.map +1 -0
  369. package/dist/core/sandbox/env.d.ts +6 -0
  370. package/dist/core/sandbox/env.d.ts.map +1 -0
  371. package/dist/core/sandbox/env.js +46 -0
  372. package/dist/core/sandbox/env.js.map +1 -0
  373. package/dist/core/sandbox/path-resolver.d.ts +4 -0
  374. package/dist/core/sandbox/path-resolver.d.ts.map +1 -0
  375. package/dist/core/sandbox/path-resolver.js +44 -0
  376. package/dist/core/sandbox/path-resolver.js.map +1 -0
  377. package/dist/core/sandbox/policy.d.ts +87 -0
  378. package/dist/core/sandbox/policy.d.ts.map +1 -0
  379. package/dist/core/sandbox/policy.js +280 -0
  380. package/dist/core/sandbox/policy.js.map +1 -0
  381. package/dist/core/sandbox/spawn.d.ts +20 -0
  382. package/dist/core/sandbox/spawn.d.ts.map +1 -0
  383. package/dist/core/sandbox/spawn.js +80 -0
  384. package/dist/core/sandbox/spawn.js.map +1 -0
  385. package/dist/core/sandbox-policy-v2.d.ts +49 -0
  386. package/dist/core/sandbox-policy-v2.d.ts.map +1 -0
  387. package/dist/core/sandbox-policy-v2.js +368 -0
  388. package/dist/core/sandbox-policy-v2.js.map +1 -0
  389. package/dist/core/sdk.d.ts +15 -4
  390. package/dist/core/sdk.d.ts.map +1 -1
  391. package/dist/core/sdk.js +50 -4
  392. package/dist/core/sdk.js.map +1 -1
  393. package/dist/core/semantic-cache-policy.d.ts +51 -0
  394. package/dist/core/semantic-cache-policy.d.ts.map +1 -0
  395. package/dist/core/semantic-cache-policy.js +228 -0
  396. package/dist/core/semantic-cache-policy.js.map +1 -0
  397. package/dist/core/session-manager.d.ts +2 -4
  398. package/dist/core/session-manager.d.ts.map +1 -1
  399. package/dist/core/session-manager.js +1 -1
  400. package/dist/core/session-manager.js.map +1 -1
  401. package/dist/core/settings-manager.d.ts +1 -4
  402. package/dist/core/settings-manager.d.ts.map +1 -1
  403. package/dist/core/settings-manager.js +2 -7
  404. package/dist/core/settings-manager.js.map +1 -1
  405. package/dist/core/skills.d.ts +1 -0
  406. package/dist/core/skills.d.ts.map +1 -1
  407. package/dist/core/skills.js +46 -5
  408. package/dist/core/skills.js.map +1 -1
  409. package/dist/core/slash-commands.d.ts.map +1 -1
  410. package/dist/core/slash-commands.js +0 -2
  411. package/dist/core/slash-commands.js.map +1 -1
  412. package/dist/core/subagent-orchestration.d.ts +73 -0
  413. package/dist/core/subagent-orchestration.d.ts.map +1 -0
  414. package/dist/core/subagent-orchestration.js +408 -0
  415. package/dist/core/subagent-orchestration.js.map +1 -0
  416. package/dist/core/system-prompt.d.ts +5 -4
  417. package/dist/core/system-prompt.d.ts.map +1 -1
  418. package/dist/core/system-prompt.js +63 -24
  419. package/dist/core/system-prompt.js.map +1 -1
  420. package/dist/core/telemetry.d.ts.map +1 -1
  421. package/dist/core/telemetry.js +1 -1
  422. package/dist/core/telemetry.js.map +1 -1
  423. package/dist/core/timings.d.ts +0 -4
  424. package/dist/core/timings.d.ts.map +1 -1
  425. package/dist/core/timings.js +1 -5
  426. package/dist/core/timings.js.map +1 -1
  427. package/dist/core/todo-state.d.ts +53 -0
  428. package/dist/core/todo-state.d.ts.map +1 -0
  429. package/dist/core/todo-state.js +87 -0
  430. package/dist/core/todo-state.js.map +1 -0
  431. package/dist/core/token-optimizer.d.ts +58 -0
  432. package/dist/core/token-optimizer.d.ts.map +1 -0
  433. package/dist/core/token-optimizer.js +179 -0
  434. package/dist/core/token-optimizer.js.map +1 -0
  435. package/dist/core/tools/bash.d.ts +28 -4
  436. package/dist/core/tools/bash.d.ts.map +1 -1
  437. package/dist/core/tools/bash.js +55 -11
  438. package/dist/core/tools/bash.js.map +1 -1
  439. package/dist/core/tools/edit.d.ts +3 -2
  440. package/dist/core/tools/edit.d.ts.map +1 -1
  441. package/dist/core/tools/edit.js +4 -1
  442. package/dist/core/tools/edit.js.map +1 -1
  443. package/dist/core/tools/find.d.ts +1 -1
  444. package/dist/core/tools/find.d.ts.map +1 -1
  445. package/dist/core/tools/find.js +1 -1
  446. package/dist/core/tools/find.js.map +1 -1
  447. package/dist/core/tools/grep.d.ts +1 -1
  448. package/dist/core/tools/grep.d.ts.map +1 -1
  449. package/dist/core/tools/grep.js +1 -1
  450. package/dist/core/tools/grep.js.map +1 -1
  451. package/dist/core/tools/index.d.ts +1 -1
  452. package/dist/core/tools/index.d.ts.map +1 -1
  453. package/dist/core/tools/index.js.map +1 -1
  454. package/dist/core/tools/ls.d.ts +1 -1
  455. package/dist/core/tools/ls.d.ts.map +1 -1
  456. package/dist/core/tools/ls.js +1 -1
  457. package/dist/core/tools/ls.js.map +1 -1
  458. package/dist/core/tools/output-accumulator.d.ts.map +1 -1
  459. package/dist/core/tools/output-accumulator.js +1 -1
  460. package/dist/core/tools/output-accumulator.js.map +1 -1
  461. package/dist/core/tools/read.d.ts +2 -1
  462. package/dist/core/tools/read.d.ts.map +1 -1
  463. package/dist/core/tools/read.js +6 -3
  464. package/dist/core/tools/read.js.map +1 -1
  465. package/dist/core/tools/render-utils.d.ts +1 -1
  466. package/dist/core/tools/render-utils.d.ts.map +1 -1
  467. package/dist/core/tools/render-utils.js +1 -1
  468. package/dist/core/tools/render-utils.js.map +1 -1
  469. package/dist/core/tools/tool-definition-wrapper.d.ts +1 -1
  470. package/dist/core/tools/tool-definition-wrapper.d.ts.map +1 -1
  471. package/dist/core/tools/tool-definition-wrapper.js.map +1 -1
  472. package/dist/core/tools/write.d.ts +2 -1
  473. package/dist/core/tools/write.d.ts.map +1 -1
  474. package/dist/core/tools/write.js +4 -1
  475. package/dist/core/tools/write.js.map +1 -1
  476. package/dist/encoding/index.d.ts +6 -0
  477. package/dist/encoding/index.d.ts.map +1 -0
  478. package/dist/encoding/index.js +6 -0
  479. package/dist/encoding/index.js.map +1 -0
  480. package/dist/encoding/l4-encoder.d.ts +96 -0
  481. package/dist/encoding/l4-encoder.d.ts.map +1 -0
  482. package/dist/encoding/l4-encoder.js +474 -0
  483. package/dist/encoding/l4-encoder.js.map +1 -0
  484. package/dist/fuzzing/index.d.ts +6 -0
  485. package/dist/fuzzing/index.d.ts.map +1 -0
  486. package/dist/fuzzing/index.js +6 -0
  487. package/dist/fuzzing/index.js.map +1 -0
  488. package/dist/fuzzing/mutation-engine.d.ts +93 -0
  489. package/dist/fuzzing/mutation-engine.d.ts.map +1 -0
  490. package/dist/fuzzing/mutation-engine.js +244 -0
  491. package/dist/fuzzing/mutation-engine.js.map +1 -0
  492. package/dist/guardrails/audit-logger.d.ts +4 -0
  493. package/dist/guardrails/audit-logger.d.ts.map +1 -0
  494. package/dist/guardrails/audit-logger.js +28 -0
  495. package/dist/guardrails/audit-logger.js.map +1 -0
  496. package/dist/guardrails/evidence-system.d.ts +61 -0
  497. package/dist/guardrails/evidence-system.d.ts.map +1 -0
  498. package/dist/guardrails/evidence-system.js +302 -0
  499. package/dist/guardrails/evidence-system.js.map +1 -0
  500. package/dist/guardrails/freedomd-adapter.d.ts +16 -0
  501. package/dist/guardrails/freedomd-adapter.d.ts.map +1 -0
  502. package/dist/guardrails/freedomd-adapter.js +87 -0
  503. package/dist/guardrails/freedomd-adapter.js.map +1 -0
  504. package/dist/jailbreak-extension.d.ts +48 -0
  505. package/dist/jailbreak-extension.d.ts.map +1 -0
  506. package/dist/jailbreak-extension.js +47 -0
  507. package/dist/jailbreak-extension.js.map +1 -0
  508. package/dist/main.d.ts.map +1 -1
  509. package/dist/main.js +6 -8
  510. package/dist/main.js.map +1 -1
  511. package/dist/migrations.d.ts +0 -37
  512. package/dist/migrations.d.ts.map +1 -1
  513. package/dist/migrations.js +6 -414
  514. package/dist/migrations.js.map +1 -1
  515. package/dist/modes/interactive/components/armin.d.ts +1 -1
  516. package/dist/modes/interactive/components/armin.d.ts.map +1 -1
  517. package/dist/modes/interactive/components/armin.js.map +1 -1
  518. package/dist/modes/interactive/components/assistant-message.d.ts +2 -2
  519. package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
  520. package/dist/modes/interactive/components/assistant-message.js +1 -1
  521. package/dist/modes/interactive/components/assistant-message.js.map +1 -1
  522. package/dist/modes/interactive/components/bash-execution.d.ts +1 -1
  523. package/dist/modes/interactive/components/bash-execution.d.ts.map +1 -1
  524. package/dist/modes/interactive/components/bash-execution.js +1 -1
  525. package/dist/modes/interactive/components/bash-execution.js.map +1 -1
  526. package/dist/modes/interactive/components/bordered-loader.d.ts +1 -1
  527. package/dist/modes/interactive/components/bordered-loader.d.ts.map +1 -1
  528. package/dist/modes/interactive/components/bordered-loader.js +1 -1
  529. package/dist/modes/interactive/components/bordered-loader.js.map +1 -1
  530. package/dist/modes/interactive/components/branch-summary-message.d.ts +1 -1
  531. package/dist/modes/interactive/components/branch-summary-message.d.ts.map +1 -1
  532. package/dist/modes/interactive/components/branch-summary-message.js +1 -1
  533. package/dist/modes/interactive/components/branch-summary-message.js.map +1 -1
  534. package/dist/modes/interactive/components/compaction-summary-message.d.ts +1 -1
  535. package/dist/modes/interactive/components/compaction-summary-message.d.ts.map +1 -1
  536. package/dist/modes/interactive/components/compaction-summary-message.js +1 -1
  537. package/dist/modes/interactive/components/compaction-summary-message.js.map +1 -1
  538. package/dist/modes/interactive/components/config-selector.d.ts +1 -1
  539. package/dist/modes/interactive/components/config-selector.d.ts.map +1 -1
  540. package/dist/modes/interactive/components/config-selector.js +1 -1
  541. package/dist/modes/interactive/components/config-selector.js.map +1 -1
  542. package/dist/modes/interactive/components/control-panel-box.d.ts +15 -0
  543. package/dist/modes/interactive/components/control-panel-box.d.ts.map +1 -0
  544. package/dist/modes/interactive/components/control-panel-box.js +55 -0
  545. package/dist/modes/interactive/components/control-panel-box.js.map +1 -0
  546. package/dist/modes/interactive/components/control-panel-gradient-motion.d.ts +28 -0
  547. package/dist/modes/interactive/components/control-panel-gradient-motion.d.ts.map +1 -0
  548. package/dist/modes/interactive/components/control-panel-gradient-motion.js +112 -0
  549. package/dist/modes/interactive/components/control-panel-gradient-motion.js.map +1 -0
  550. package/dist/modes/interactive/components/control-panel-gradient.d.ts +28 -0
  551. package/dist/modes/interactive/components/control-panel-gradient.d.ts.map +1 -0
  552. package/dist/modes/interactive/components/control-panel-gradient.js +128 -0
  553. package/dist/modes/interactive/components/control-panel-gradient.js.map +1 -0
  554. package/dist/modes/interactive/components/control-panel-layout.d.ts +23 -0
  555. package/dist/modes/interactive/components/control-panel-layout.d.ts.map +1 -0
  556. package/dist/modes/interactive/components/control-panel-layout.js +165 -0
  557. package/dist/modes/interactive/components/control-panel-layout.js.map +1 -0
  558. package/dist/modes/interactive/components/control-panel-runtime-status.d.ts +5 -0
  559. package/dist/modes/interactive/components/control-panel-runtime-status.d.ts.map +1 -0
  560. package/dist/modes/interactive/components/control-panel-runtime-status.js +20 -0
  561. package/dist/modes/interactive/components/control-panel-runtime-status.js.map +1 -0
  562. package/dist/modes/interactive/components/control-panel.d.ts +24 -20
  563. package/dist/modes/interactive/components/control-panel.d.ts.map +1 -1
  564. package/dist/modes/interactive/components/control-panel.js +88 -69
  565. package/dist/modes/interactive/components/control-panel.js.map +1 -1
  566. package/dist/modes/interactive/components/countdown-timer.d.ts +1 -1
  567. package/dist/modes/interactive/components/countdown-timer.d.ts.map +1 -1
  568. package/dist/modes/interactive/components/countdown-timer.js.map +1 -1
  569. package/dist/modes/interactive/components/custom-editor.d.ts +1 -1
  570. package/dist/modes/interactive/components/custom-editor.d.ts.map +1 -1
  571. package/dist/modes/interactive/components/custom-editor.js +14 -22
  572. package/dist/modes/interactive/components/custom-editor.js.map +1 -1
  573. package/dist/modes/interactive/components/custom-message.d.ts +1 -1
  574. package/dist/modes/interactive/components/custom-message.d.ts.map +1 -1
  575. package/dist/modes/interactive/components/custom-message.js +1 -1
  576. package/dist/modes/interactive/components/custom-message.js.map +1 -1
  577. package/dist/modes/interactive/components/daxnuts.d.ts +1 -1
  578. package/dist/modes/interactive/components/daxnuts.d.ts.map +1 -1
  579. package/dist/modes/interactive/components/daxnuts.js.map +1 -1
  580. package/dist/modes/interactive/components/dynamic-border.d.ts +1 -1
  581. package/dist/modes/interactive/components/dynamic-border.d.ts.map +1 -1
  582. package/dist/modes/interactive/components/dynamic-border.js.map +1 -1
  583. package/dist/modes/interactive/components/earendil-announcement.d.ts +1 -1
  584. package/dist/modes/interactive/components/earendil-announcement.d.ts.map +1 -1
  585. package/dist/modes/interactive/components/earendil-announcement.js +2 -2
  586. package/dist/modes/interactive/components/earendil-announcement.js.map +1 -1
  587. package/dist/modes/interactive/components/extension-editor.d.ts +1 -1
  588. package/dist/modes/interactive/components/extension-editor.d.ts.map +1 -1
  589. package/dist/modes/interactive/components/extension-editor.js +2 -2
  590. package/dist/modes/interactive/components/extension-editor.js.map +1 -1
  591. package/dist/modes/interactive/components/extension-input.d.ts +1 -1
  592. package/dist/modes/interactive/components/extension-input.d.ts.map +1 -1
  593. package/dist/modes/interactive/components/extension-input.js +1 -1
  594. package/dist/modes/interactive/components/extension-input.js.map +1 -1
  595. package/dist/modes/interactive/components/extension-selector.d.ts +1 -1
  596. package/dist/modes/interactive/components/extension-selector.d.ts.map +1 -1
  597. package/dist/modes/interactive/components/extension-selector.js +1 -1
  598. package/dist/modes/interactive/components/extension-selector.js.map +1 -1
  599. package/dist/modes/interactive/components/footer.d.ts +1 -1
  600. package/dist/modes/interactive/components/footer.d.ts.map +1 -1
  601. package/dist/modes/interactive/components/footer.js +1 -1
  602. package/dist/modes/interactive/components/footer.js.map +1 -1
  603. package/dist/modes/interactive/components/index.d.ts +0 -2
  604. package/dist/modes/interactive/components/index.d.ts.map +1 -1
  605. package/dist/modes/interactive/components/index.js +0 -2
  606. package/dist/modes/interactive/components/index.js.map +1 -1
  607. package/dist/modes/interactive/components/keybinding-hints.d.ts +1 -1
  608. package/dist/modes/interactive/components/keybinding-hints.d.ts.map +1 -1
  609. package/dist/modes/interactive/components/keybinding-hints.js +1 -1
  610. package/dist/modes/interactive/components/keybinding-hints.js.map +1 -1
  611. package/dist/modes/interactive/components/login-dialog.d.ts +2 -2
  612. package/dist/modes/interactive/components/login-dialog.d.ts.map +1 -1
  613. package/dist/modes/interactive/components/login-dialog.js +2 -2
  614. package/dist/modes/interactive/components/login-dialog.js.map +1 -1
  615. package/dist/modes/interactive/components/model-selector.d.ts +4 -4
  616. package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
  617. package/dist/modes/interactive/components/model-selector.js +20 -42
  618. package/dist/modes/interactive/components/model-selector.js.map +1 -1
  619. package/dist/modes/interactive/components/oauth-selector.d.ts +1 -1
  620. package/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -1
  621. package/dist/modes/interactive/components/oauth-selector.js +1 -1
  622. package/dist/modes/interactive/components/oauth-selector.js.map +1 -1
  623. package/dist/modes/interactive/components/scoped-models-selector.d.ts +2 -2
  624. package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -1
  625. package/dist/modes/interactive/components/scoped-models-selector.js +1 -1
  626. package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -1
  627. package/dist/modes/interactive/components/session-selector-search.d.ts.map +1 -1
  628. package/dist/modes/interactive/components/session-selector-search.js +1 -1
  629. package/dist/modes/interactive/components/session-selector-search.js.map +1 -1
  630. package/dist/modes/interactive/components/session-selector.d.ts +1 -1
  631. package/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
  632. package/dist/modes/interactive/components/session-selector.js +1 -1
  633. package/dist/modes/interactive/components/session-selector.js.map +1 -1
  634. package/dist/modes/interactive/components/settings-selector.d.ts +3 -3
  635. package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
  636. package/dist/modes/interactive/components/settings-selector.js +1 -1
  637. package/dist/modes/interactive/components/settings-selector.js.map +1 -1
  638. package/dist/modes/interactive/components/show-images-selector.d.ts +1 -1
  639. package/dist/modes/interactive/components/show-images-selector.d.ts.map +1 -1
  640. package/dist/modes/interactive/components/show-images-selector.js +1 -1
  641. package/dist/modes/interactive/components/show-images-selector.js.map +1 -1
  642. package/dist/modes/interactive/components/skill-invocation-message.d.ts +1 -1
  643. package/dist/modes/interactive/components/skill-invocation-message.d.ts.map +1 -1
  644. package/dist/modes/interactive/components/skill-invocation-message.js +1 -1
  645. package/dist/modes/interactive/components/skill-invocation-message.js.map +1 -1
  646. package/dist/modes/interactive/components/theme-selector.d.ts +1 -1
  647. package/dist/modes/interactive/components/theme-selector.d.ts.map +1 -1
  648. package/dist/modes/interactive/components/theme-selector.js +1 -1
  649. package/dist/modes/interactive/components/theme-selector.js.map +1 -1
  650. package/dist/modes/interactive/components/thinking-selector.d.ts +8 -7
  651. package/dist/modes/interactive/components/thinking-selector.d.ts.map +1 -1
  652. package/dist/modes/interactive/components/thinking-selector.js +48 -7
  653. package/dist/modes/interactive/components/thinking-selector.js.map +1 -1
  654. package/dist/modes/interactive/components/todo-checklist.d.ts +31 -0
  655. package/dist/modes/interactive/components/todo-checklist.d.ts.map +1 -0
  656. package/dist/modes/interactive/components/todo-checklist.js +121 -0
  657. package/dist/modes/interactive/components/todo-checklist.js.map +1 -0
  658. package/dist/modes/interactive/components/tool-execution.d.ts +1 -1
  659. package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
  660. package/dist/modes/interactive/components/tool-execution.js +1 -1
  661. package/dist/modes/interactive/components/tool-execution.js.map +1 -1
  662. package/dist/modes/interactive/components/tree-selector.d.ts +1 -1
  663. package/dist/modes/interactive/components/tree-selector.d.ts.map +1 -1
  664. package/dist/modes/interactive/components/tree-selector.js +1 -1
  665. package/dist/modes/interactive/components/tree-selector.js.map +1 -1
  666. package/dist/modes/interactive/components/user-message-selector.d.ts +1 -1
  667. package/dist/modes/interactive/components/user-message-selector.d.ts.map +1 -1
  668. package/dist/modes/interactive/components/user-message-selector.js +1 -1
  669. package/dist/modes/interactive/components/user-message-selector.js.map +1 -1
  670. package/dist/modes/interactive/components/user-message.d.ts +1 -1
  671. package/dist/modes/interactive/components/user-message.d.ts.map +1 -1
  672. package/dist/modes/interactive/components/user-message.js +1 -1
  673. package/dist/modes/interactive/components/user-message.js.map +1 -1
  674. package/dist/modes/interactive/components/visual-truncate.d.ts.map +1 -1
  675. package/dist/modes/interactive/components/visual-truncate.js +1 -1
  676. package/dist/modes/interactive/components/visual-truncate.js.map +1 -1
  677. package/dist/modes/interactive/interactive-mode.d.ts +5 -8
  678. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  679. package/dist/modes/interactive/interactive-mode.js +79 -189
  680. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  681. package/dist/modes/interactive/theme/omk-control-grid-dark.json +65 -77
  682. package/dist/modes/interactive/theme/omk-neon-control.json +90 -0
  683. package/dist/modes/interactive/theme/rust-forge.json +14 -24
  684. package/dist/modes/interactive/theme/theme.d.ts +1 -1
  685. package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
  686. package/dist/modes/interactive/theme/theme.js +22 -31
  687. package/dist/modes/interactive/theme/theme.js.map +1 -1
  688. package/dist/modes/print-mode.d.ts +3 -3
  689. package/dist/modes/print-mode.d.ts.map +1 -1
  690. package/dist/modes/print-mode.js +2 -2
  691. package/dist/modes/print-mode.js.map +1 -1
  692. package/dist/modes/rpc/rpc-client.d.ts +2 -2
  693. package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
  694. package/dist/modes/rpc/rpc-client.js.map +1 -1
  695. package/dist/modes/rpc/rpc-types.d.ts +2 -2
  696. package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
  697. package/dist/modes/rpc/rpc-types.js.map +1 -1
  698. package/dist/modules/index.d.ts +8 -0
  699. package/dist/modules/index.d.ts.map +1 -0
  700. package/dist/modules/index.js +7 -0
  701. package/dist/modules/index.js.map +1 -0
  702. package/dist/modules/lrl-bypass.d.ts +40 -0
  703. package/dist/modules/lrl-bypass.d.ts.map +1 -0
  704. package/dist/modules/lrl-bypass.js +84 -0
  705. package/dist/modules/lrl-bypass.js.map +1 -0
  706. package/dist/modules/lrl-deps.d.ts +38 -0
  707. package/dist/modules/lrl-deps.d.ts.map +1 -0
  708. package/dist/modules/lrl-deps.js +128 -0
  709. package/dist/modules/lrl-deps.js.map +1 -0
  710. package/dist/multiturn/easl-chain.d.ts +113 -0
  711. package/dist/multiturn/easl-chain.d.ts.map +1 -0
  712. package/dist/multiturn/easl-chain.js +351 -0
  713. package/dist/multiturn/easl-chain.js.map +1 -0
  714. package/dist/multiturn/index.d.ts +6 -0
  715. package/dist/multiturn/index.d.ts.map +1 -0
  716. package/dist/multiturn/index.js +6 -0
  717. package/dist/multiturn/index.js.map +1 -0
  718. package/dist/orchestration/lane-grant-auditor.d.ts +4 -0
  719. package/dist/orchestration/lane-grant-auditor.d.ts.map +1 -0
  720. package/dist/orchestration/lane-grant-auditor.js +87 -0
  721. package/dist/orchestration/lane-grant-auditor.js.map +1 -0
  722. package/dist/package-manager-cli.d.ts.map +1 -1
  723. package/dist/package-manager-cli.js +3 -3
  724. package/dist/package-manager-cli.js.map +1 -1
  725. package/dist/routing/fallback-router.d.ts +123 -0
  726. package/dist/routing/fallback-router.d.ts.map +1 -0
  727. package/dist/routing/fallback-router.js +355 -0
  728. package/dist/routing/fallback-router.js.map +1 -0
  729. package/dist/routing/index.d.ts +6 -0
  730. package/dist/routing/index.d.ts.map +1 -0
  731. package/dist/routing/index.js +6 -0
  732. package/dist/routing/index.js.map +1 -0
  733. package/dist/types/evidence.d.ts +117 -0
  734. package/dist/types/evidence.d.ts.map +1 -0
  735. package/dist/types/evidence.js +8 -0
  736. package/dist/types/evidence.js.map +1 -0
  737. package/dist/types/guardrails.d.ts +61 -0
  738. package/dist/types/guardrails.d.ts.map +1 -0
  739. package/dist/types/guardrails.js +9 -0
  740. package/dist/types/guardrails.js.map +1 -0
  741. package/dist/types/jailbreak.d.ts +246 -0
  742. package/dist/types/jailbreak.d.ts.map +1 -0
  743. package/dist/types/jailbreak.js +8 -0
  744. package/dist/types/jailbreak.js.map +1 -0
  745. package/dist/types/lane-grant.d.ts +58 -0
  746. package/dist/types/lane-grant.d.ts.map +1 -0
  747. package/dist/types/lane-grant.js +9 -0
  748. package/dist/types/lane-grant.js.map +1 -0
  749. package/dist/utils/clipboard-image.d.ts.map +1 -1
  750. package/dist/utils/clipboard-image.js +1 -1
  751. package/dist/utils/clipboard-image.js.map +1 -1
  752. package/dist/utils/jailbreak/common.d.ts +63 -0
  753. package/dist/utils/jailbreak/common.d.ts.map +1 -0
  754. package/dist/utils/jailbreak/common.js +130 -0
  755. package/dist/utils/jailbreak/common.js.map +1 -0
  756. package/dist/utils/jailbreak/index.d.ts +7 -0
  757. package/dist/utils/jailbreak/index.d.ts.map +1 -0
  758. package/dist/utils/jailbreak/index.js +7 -0
  759. package/dist/utils/jailbreak/index.js.map +1 -0
  760. package/dist/utils/omk-user-agent.d.ts +2 -0
  761. package/dist/utils/omk-user-agent.d.ts.map +1 -0
  762. package/dist/utils/{pi-user-agent.js → omk-user-agent.js} +2 -2
  763. package/dist/utils/omk-user-agent.js.map +1 -0
  764. package/dist/utils/tools-manager.d.ts.map +1 -1
  765. package/dist/utils/tools-manager.js +1 -1
  766. package/dist/utils/tools-manager.js.map +1 -1
  767. package/dist/utils/version-check.d.ts +5 -5
  768. package/dist/utils/version-check.d.ts.map +1 -1
  769. package/dist/utils/version-check.js +8 -11
  770. package/dist/utils/version-check.js.map +1 -1
  771. package/dist/utils/windows-self-update.d.ts.map +1 -1
  772. package/dist/utils/windows-self-update.js +1 -1
  773. package/dist/utils/windows-self-update.js.map +1 -1
  774. package/docs/compaction.md +8 -21
  775. package/docs/custom-provider.md +2 -2
  776. package/docs/development.md +1 -1
  777. package/docs/extensions.md +11 -11
  778. package/docs/loadout-domains/README.md +70 -0
  779. package/docs/loadout-domains/ai-agent-ops.md +94 -0
  780. package/docs/loadout-domains/backend-api.md +116 -0
  781. package/docs/loadout-domains/data-science.md +100 -0
  782. package/docs/loadout-domains/devops-infra.md +85 -0
  783. package/docs/loadout-domains/docs-writing.md +92 -0
  784. package/docs/loadout-domains/frontend-ui.md +128 -0
  785. package/docs/loadout-domains/general.md +62 -0
  786. package/docs/loadout-domains/mobile.md +84 -0
  787. package/docs/loadout-domains/qa-testing.md +87 -0
  788. package/docs/loadout-domains/research.md +80 -0
  789. package/docs/loadout-domains/security-audit.md +97 -0
  790. package/docs/packages.md +1 -1
  791. package/docs/sdk.md +3 -3
  792. package/docs/security.md +145 -0
  793. package/docs/session-format.md +1 -1
  794. package/docs/themes.md +8 -7
  795. package/docs/tui.md +14 -14
  796. package/examples/README.md +1 -1
  797. package/examples/extensions/README.md +12 -12
  798. package/examples/extensions/aside-computer-use/README.md +114 -0
  799. package/examples/extensions/aside-computer-use/action-scoring.ts +122 -0
  800. package/examples/extensions/aside-computer-use/assertions.ts +380 -0
  801. package/examples/extensions/aside-computer-use/controller.ts +491 -0
  802. package/examples/extensions/aside-computer-use/evidence.ts +229 -0
  803. package/examples/extensions/aside-computer-use/golden-trace.ts +141 -0
  804. package/examples/extensions/aside-computer-use/index.ts +76 -0
  805. package/examples/extensions/aside-computer-use/mcp-client.ts +381 -0
  806. package/examples/extensions/aside-computer-use/observation-snapshot.ts +121 -0
  807. package/examples/extensions/aside-computer-use/package.json +16 -0
  808. package/examples/extensions/aside-computer-use/policy.ts +257 -0
  809. package/examples/extensions/aside-computer-use/risk-authorize.ts +200 -0
  810. package/examples/extensions/aside-computer-use/risk-classifier.ts +205 -0
  811. package/examples/extensions/aside-computer-use/schema-fingerprint.ts +80 -0
  812. package/examples/extensions/aside-computer-use/session-binding.ts +161 -0
  813. package/examples/extensions/aside-computer-use/tools.ts +449 -0
  814. package/examples/extensions/aside-computer-use/types.ts +217 -0
  815. package/examples/extensions/aside-computer-use/url-origin.ts +132 -0
  816. package/examples/extensions/auto-commit-on-exit.ts +6 -6
  817. package/examples/extensions/bash-spawn-hook.ts +3 -3
  818. package/examples/extensions/bookmark.ts +5 -5
  819. package/examples/extensions/border-status-editor.ts +9 -9
  820. package/examples/extensions/built-in-tool-renderer.ts +7 -7
  821. package/examples/extensions/claude-rules.ts +4 -4
  822. package/examples/extensions/commands.ts +5 -5
  823. package/examples/extensions/confirm-destructive.ts +3 -3
  824. package/examples/extensions/custom-compaction.ts +4 -4
  825. package/examples/extensions/custom-footer.ts +4 -4
  826. package/examples/extensions/custom-header.ts +11 -11
  827. package/examples/extensions/custom-provider-anthropic/index.ts +5 -5
  828. package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  829. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  830. package/examples/extensions/custom-provider-gitlab-duo/index.ts +4 -4
  831. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  832. package/examples/extensions/custom-provider-gitlab-duo/test.ts +1 -1
  833. package/examples/extensions/dirty-repo-guard.ts +7 -7
  834. package/examples/extensions/doom-overlay/README.md +2 -3
  835. package/examples/extensions/doom-overlay/doom/build/doom.wasm +0 -0
  836. package/examples/extensions/doom-overlay/doom/build.sh +4 -4
  837. package/examples/extensions/doom-overlay/doom/{doomgeneric_pi.c → doomgeneric_omk.c} +1 -1
  838. package/examples/extensions/doom-overlay/doom-component.ts +2 -2
  839. package/examples/extensions/doom-overlay/doom-keys.ts +1 -1
  840. package/examples/extensions/doom-overlay/index.ts +3 -3
  841. package/examples/extensions/dynamic-resources/dynamic.json +1 -1
  842. package/examples/extensions/dynamic-resources/index.ts +2 -2
  843. package/examples/extensions/dynamic-tools.ts +4 -4
  844. package/examples/extensions/event-bus.ts +8 -8
  845. package/examples/extensions/file-trigger.ts +3 -3
  846. package/examples/extensions/git-checkpoint.ts +7 -7
  847. package/examples/extensions/git-merge-and-resolve.ts +14 -14
  848. package/examples/extensions/github-issue-autocomplete.ts +7 -12
  849. package/examples/extensions/gondolin/index.ts +16 -16
  850. package/examples/extensions/gondolin/package-lock.json +2 -2
  851. package/examples/extensions/gondolin/package.json +1 -1
  852. package/examples/extensions/handoff.ts +4 -4
  853. package/examples/extensions/hello.ts +3 -3
  854. package/examples/extensions/hidden-thinking-label.ts +4 -4
  855. package/examples/extensions/inline-bash.ts +5 -5
  856. package/examples/extensions/input-transform-streaming.ts +5 -5
  857. package/examples/extensions/input-transform.ts +5 -5
  858. package/examples/extensions/interactive-shell.ts +3 -3
  859. package/examples/extensions/mac-system-theme.ts +5 -5
  860. package/examples/extensions/message-renderer.ts +5 -5
  861. package/examples/extensions/minimal-mode.ts +10 -10
  862. package/examples/extensions/modal-editor.ts +4 -4
  863. package/examples/extensions/model-status.ts +3 -3
  864. package/examples/extensions/notify.ts +5 -5
  865. package/examples/extensions/overlay-qa-tests.ts +22 -22
  866. package/examples/extensions/overlay-test.ts +4 -4
  867. package/examples/extensions/permission-gate.ts +2 -2
  868. package/examples/extensions/pirate.ts +4 -4
  869. package/examples/extensions/plan-mode/index.ts +25 -25
  870. package/examples/extensions/preset.ts +31 -31
  871. package/examples/extensions/prompt-customizer.ts +3 -3
  872. package/examples/extensions/protected-paths.ts +2 -2
  873. package/examples/extensions/provider-payload.ts +8 -5
  874. package/examples/extensions/qna.ts +3 -3
  875. package/examples/extensions/question.ts +3 -3
  876. package/examples/extensions/questionnaire.ts +3 -3
  877. package/examples/extensions/rainbow-editor.ts +3 -3
  878. package/examples/extensions/reload-runtime.ts +4 -4
  879. package/examples/extensions/rpc-demo.ts +10 -10
  880. package/examples/extensions/sandbox/index.ts +16 -16
  881. package/examples/extensions/sandbox/package-lock.json +2 -2
  882. package/examples/extensions/sandbox/package.json +1 -1
  883. package/examples/extensions/send-user-message.ts +13 -13
  884. package/examples/extensions/session-name.ts +4 -4
  885. package/examples/extensions/shutdown-command.ts +10 -10
  886. package/examples/extensions/snake.ts +4 -4
  887. package/examples/extensions/space-invaders.ts +4 -4
  888. package/examples/extensions/ssh.ts +12 -12
  889. package/examples/extensions/status-line.ts +4 -4
  890. package/examples/extensions/structured-output.ts +3 -3
  891. package/examples/extensions/subagent/README.md +13 -13
  892. package/examples/extensions/subagent/agents.ts +1 -1
  893. package/examples/extensions/subagent/index.ts +13 -13
  894. package/examples/extensions/summarize.ts +4 -4
  895. package/examples/extensions/system-prompt-header.ts +3 -3
  896. package/examples/extensions/tic-tac-toe.ts +17 -17
  897. package/examples/extensions/timed-confirm.ts +4 -4
  898. package/examples/extensions/titlebar-spinner.ts +9 -9
  899. package/examples/extensions/todo.ts +7 -7
  900. package/examples/extensions/tool-override.ts +6 -6
  901. package/examples/extensions/tools.ts +11 -11
  902. package/examples/extensions/trigger-compact.ts +3 -3
  903. package/examples/extensions/truncated-tool.ts +4 -4
  904. package/examples/extensions/widget-placement.ts +2 -2
  905. package/examples/extensions/with-deps/index.ts +2 -2
  906. package/examples/extensions/with-deps/package-lock.json +2 -2
  907. package/examples/extensions/with-deps/package.json +1 -1
  908. package/examples/extensions/working-indicator.ts +7 -7
  909. package/examples/extensions/working-message-test.ts +3 -3
  910. package/examples/rpc-extension-ui.ts +1 -9
  911. package/examples/sdk/01-minimal.ts +1 -1
  912. package/examples/sdk/02-custom-model.ts +1 -1
  913. package/examples/sdk/03-custom-prompt.ts +1 -1
  914. package/examples/sdk/04-skills.ts +1 -1
  915. package/examples/sdk/05-tools.ts +1 -1
  916. package/examples/sdk/06-extensions.ts +11 -11
  917. package/examples/sdk/08-prompt-templates.ts +1 -1
  918. package/examples/sdk/09-api-keys-and-oauth.ts +2 -2
  919. package/examples/sdk/12-full-control.ts +1 -1
  920. package/examples/sdk/README.md +3 -3
  921. package/npm-shrinkwrap.json +1805 -0
  922. package/package.json +8 -14
  923. package/dist/core/harness-control-events.d.ts +0 -79
  924. package/dist/core/harness-control-events.d.ts.map +0 -1
  925. package/dist/core/harness-control-events.js +0 -339
  926. package/dist/core/harness-control-events.js.map +0 -1
  927. package/dist/core/harness-control-replay.d.ts +0 -26
  928. package/dist/core/harness-control-replay.d.ts.map +0 -1
  929. package/dist/core/harness-control-replay.js +0 -155
  930. package/dist/core/harness-control-replay.js.map +0 -1
  931. package/dist/core/spec-kit/compiler.d.ts +0 -67
  932. package/dist/core/spec-kit/compiler.d.ts.map +0 -1
  933. package/dist/core/spec-kit/compiler.js +0 -268
  934. package/dist/core/spec-kit/compiler.js.map +0 -1
  935. package/dist/core/transaction-coordinator.d.ts +0 -30
  936. package/dist/core/transaction-coordinator.d.ts.map +0 -1
  937. package/dist/core/transaction-coordinator.js +0 -173
  938. package/dist/core/transaction-coordinator.js.map +0 -1
  939. package/dist/modes/interactive/components/mcp-selector.d.ts +0 -28
  940. package/dist/modes/interactive/components/mcp-selector.d.ts.map +0 -1
  941. package/dist/modes/interactive/components/mcp-selector.js +0 -138
  942. package/dist/modes/interactive/components/mcp-selector.js.map +0 -1
  943. package/dist/modes/interactive/components/skills-selector.d.ts +0 -32
  944. package/dist/modes/interactive/components/skills-selector.d.ts.map +0 -1
  945. package/dist/modes/interactive/components/skills-selector.js +0 -130
  946. package/dist/modes/interactive/components/skills-selector.js.map +0 -1
  947. package/dist/utils/pi-user-agent.d.ts +0 -2
  948. package/dist/utils/pi-user-agent.d.ts.map +0 -1
  949. package/dist/utils/pi-user-agent.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"skills.d.ts","sourceRoot":"","sources":["../../src/core/skills.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAA6B,KAAK,UAAU,EAAE,MAAM,kBAAkB,CAAC;AA2D9E,MAAM,WAAW,gBAAgB;IAChC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,0BAA0B,CAAC,EAAE,OAAO,CAAC;IACrC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACvB;AAED,MAAM,WAAW,KAAK;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,UAAU,CAAC;IACvB,sBAAsB,EAAE,OAAO,CAAC;CAChC;AAED,MAAM,WAAW,gBAAgB;IAChC,MAAM,EAAE,KAAK,EAAE,CAAC;IAChB,WAAW,EAAE,kBAAkB,EAAE,CAAC;CAClC;AA2CD,MAAM,WAAW,wBAAwB;IACxC,mCAAmC;IACnC,GAAG,EAAE,MAAM,CAAC;IACZ,yCAAyC;IACzC,MAAM,EAAE,MAAM,CAAC;CACf;AA0BD;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,wBAAwB,GAAG,gBAAgB,CAGrF;AA4JD;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,CA0B7D;AAWD,MAAM,WAAW,iBAAiB;IACjC,kDAAkD;IAClD,GAAG,EAAE,MAAM,CAAC;IACZ,gDAAgD;IAChD,QAAQ,EAAE,MAAM,CAAC;IACjB,kDAAkD;IAClD,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,0CAA0C;IAC1C,eAAe,EAAE,OAAO,CAAC;CACzB;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,iBAAiB,GAAG,gBAAgB,CAoGvE","sourcesContent":["import { existsSync, readdirSync, readFileSync, statSync } from \"fs\";\nimport ignore from \"ignore\";\nimport { basename, dirname, join, relative, resolve, sep } from \"path\";\nimport { CONFIG_DIR_NAME, getAgentDir } from \"../config.ts\";\nimport { parseFrontmatter } from \"../utils/frontmatter.ts\";\nimport { canonicalizePath, resolvePath } from \"../utils/paths.ts\";\nimport type { ResourceDiagnostic } from \"./diagnostics.ts\";\nimport { createSyntheticSourceInfo, type SourceInfo } from \"./source-info.ts\";\n\n/** Max name length per spec */\nconst MAX_NAME_LENGTH = 64;\n\n/** Max description length per spec */\nconst MAX_DESCRIPTION_LENGTH = 1024;\n\nconst IGNORE_FILE_NAMES = [\".gitignore\", \".ignore\", \".fdignore\"];\n\ntype IgnoreMatcher = ReturnType<typeof ignore>;\n\nfunction toPosixPath(p: string): string {\n\treturn p.split(sep).join(\"/\");\n}\n\nfunction prefixIgnorePattern(line: string, prefix: string): string | null {\n\tconst trimmed = line.trim();\n\tif (!trimmed) return null;\n\tif (trimmed.startsWith(\"#\") && !trimmed.startsWith(\"\\\\#\")) return null;\n\n\tlet pattern = line;\n\tlet negated = false;\n\n\tif (pattern.startsWith(\"!\")) {\n\t\tnegated = true;\n\t\tpattern = pattern.slice(1);\n\t} else if (pattern.startsWith(\"\\\\!\")) {\n\t\tpattern = pattern.slice(1);\n\t}\n\n\tif (pattern.startsWith(\"/\")) {\n\t\tpattern = pattern.slice(1);\n\t}\n\n\tconst prefixed = prefix ? `${prefix}${pattern}` : pattern;\n\treturn negated ? `!${prefixed}` : prefixed;\n}\n\nfunction addIgnoreRules(ig: IgnoreMatcher, dir: string, rootDir: string): void {\n\tconst relativeDir = relative(rootDir, dir);\n\tconst prefix = relativeDir ? `${toPosixPath(relativeDir)}/` : \"\";\n\n\tfor (const filename of IGNORE_FILE_NAMES) {\n\t\tconst ignorePath = join(dir, filename);\n\t\tif (!existsSync(ignorePath)) continue;\n\t\ttry {\n\t\t\tconst content = readFileSync(ignorePath, \"utf-8\");\n\t\t\tconst patterns = content\n\t\t\t\t.split(/\\r?\\n/)\n\t\t\t\t.map((line) => prefixIgnorePattern(line, prefix))\n\t\t\t\t.filter((line): line is string => Boolean(line));\n\t\t\tif (patterns.length > 0) {\n\t\t\t\tig.add(patterns);\n\t\t\t}\n\t\t} catch {}\n\t}\n}\n\nexport interface SkillFrontmatter {\n\tname?: string;\n\tdescription?: string;\n\t\"disable-model-invocation\"?: boolean;\n\t[key: string]: unknown;\n}\n\nexport interface Skill {\n\tname: string;\n\tdescription: string;\n\tfilePath: string;\n\tbaseDir: string;\n\tsourceInfo: SourceInfo;\n\tdisableModelInvocation: boolean;\n}\n\nexport interface LoadSkillsResult {\n\tskills: Skill[];\n\tdiagnostics: ResourceDiagnostic[];\n}\n\n/**\n * Validate skill name per Agent Skills spec.\n * Returns array of validation error messages (empty if valid).\n */\nfunction validateName(name: string): string[] {\n\tconst errors: string[] = [];\n\n\tif (name.length > MAX_NAME_LENGTH) {\n\t\terrors.push(`name exceeds ${MAX_NAME_LENGTH} characters (${name.length})`);\n\t}\n\n\tif (!/^[a-z0-9-]+$/.test(name)) {\n\t\terrors.push(`name contains invalid characters (must be lowercase a-z, 0-9, hyphens only)`);\n\t}\n\n\tif (name.startsWith(\"-\") || name.endsWith(\"-\")) {\n\t\terrors.push(`name must not start or end with a hyphen`);\n\t}\n\n\tif (name.includes(\"--\")) {\n\t\terrors.push(`name must not contain consecutive hyphens`);\n\t}\n\n\treturn errors;\n}\n\n/**\n * Validate description per Agent Skills spec.\n */\nfunction validateDescription(description: string | undefined): string[] {\n\tconst errors: string[] = [];\n\n\tif (!description || description.trim() === \"\") {\n\t\terrors.push(\"description is required\");\n\t} else if (description.length > MAX_DESCRIPTION_LENGTH) {\n\t\terrors.push(`description exceeds ${MAX_DESCRIPTION_LENGTH} characters (${description.length})`);\n\t}\n\n\treturn errors;\n}\n\nexport interface LoadSkillsFromDirOptions {\n\t/** Directory to scan for skills */\n\tdir: string;\n\t/** Source identifier for these skills */\n\tsource: string;\n}\n\nfunction createSkillSourceInfo(filePath: string, baseDir: string, source: string): SourceInfo {\n\tswitch (source) {\n\t\tcase \"user\":\n\t\t\treturn createSyntheticSourceInfo(filePath, {\n\t\t\t\tsource: \"local\",\n\t\t\t\tscope: \"user\",\n\t\t\t\tbaseDir,\n\t\t\t});\n\t\tcase \"project\":\n\t\t\treturn createSyntheticSourceInfo(filePath, {\n\t\t\t\tsource: \"local\",\n\t\t\t\tscope: \"project\",\n\t\t\t\tbaseDir,\n\t\t\t});\n\t\tcase \"path\":\n\t\t\treturn createSyntheticSourceInfo(filePath, {\n\t\t\t\tsource: \"local\",\n\t\t\t\tbaseDir,\n\t\t\t});\n\t\tdefault:\n\t\t\treturn createSyntheticSourceInfo(filePath, { source, baseDir });\n\t}\n}\n\n/**\n * Load skills from a directory.\n *\n * Discovery rules:\n * - if a directory contains SKILL.md, treat it as a skill root and do not recurse further\n * - otherwise, load direct .md children in the root\n * - recurse into subdirectories to find SKILL.md\n */\nexport function loadSkillsFromDir(options: LoadSkillsFromDirOptions): LoadSkillsResult {\n\tconst { dir, source } = options;\n\treturn loadSkillsFromDirInternal(dir, source, true);\n}\n\nfunction loadSkillsFromDirInternal(\n\tdir: string,\n\tsource: string,\n\tincludeRootFiles: boolean,\n\tignoreMatcher?: IgnoreMatcher,\n\trootDir?: string,\n): LoadSkillsResult {\n\tconst skills: Skill[] = [];\n\tconst diagnostics: ResourceDiagnostic[] = [];\n\n\tif (!existsSync(dir)) {\n\t\treturn { skills, diagnostics };\n\t}\n\n\tconst root = rootDir ?? dir;\n\tconst ig = ignoreMatcher ?? ignore();\n\taddIgnoreRules(ig, dir, root);\n\n\ttry {\n\t\tconst entries = readdirSync(dir, { withFileTypes: true });\n\n\t\tfor (const entry of entries) {\n\t\t\tif (entry.name !== \"SKILL.md\") {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst fullPath = join(dir, entry.name);\n\n\t\t\tlet isFile = entry.isFile();\n\t\t\tif (entry.isSymbolicLink()) {\n\t\t\t\ttry {\n\t\t\t\t\tisFile = statSync(fullPath).isFile();\n\t\t\t\t} catch {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst relPath = toPosixPath(relative(root, fullPath));\n\t\t\tif (!isFile || ig.ignores(relPath)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst result = loadSkillFromFile(fullPath, source);\n\t\t\tif (result.skill) {\n\t\t\t\tskills.push(result.skill);\n\t\t\t}\n\t\t\tdiagnostics.push(...result.diagnostics);\n\t\t\treturn { skills, diagnostics };\n\t\t}\n\n\t\tfor (const entry of entries) {\n\t\t\tif (entry.name.startsWith(\".\")) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// Skip node_modules to avoid scanning dependencies\n\t\t\tif (entry.name === \"node_modules\") {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst fullPath = join(dir, entry.name);\n\n\t\t\t// For symlinks, check if they point to a directory and follow them\n\t\t\tlet isDirectory = entry.isDirectory();\n\t\t\tlet isFile = entry.isFile();\n\t\t\tif (entry.isSymbolicLink()) {\n\t\t\t\ttry {\n\t\t\t\t\tconst stats = statSync(fullPath);\n\t\t\t\t\tisDirectory = stats.isDirectory();\n\t\t\t\t\tisFile = stats.isFile();\n\t\t\t\t} catch {\n\t\t\t\t\t// Broken symlink, skip it\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst relPath = toPosixPath(relative(root, fullPath));\n\t\t\tconst ignorePath = isDirectory ? `${relPath}/` : relPath;\n\t\t\tif (ig.ignores(ignorePath)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (isDirectory) {\n\t\t\t\tconst subResult = loadSkillsFromDirInternal(fullPath, source, false, ig, root);\n\t\t\t\tskills.push(...subResult.skills);\n\t\t\t\tdiagnostics.push(...subResult.diagnostics);\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (!isFile || !includeRootFiles || !entry.name.endsWith(\".md\")) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst result = loadSkillFromFile(fullPath, source);\n\t\t\tif (result.skill) {\n\t\t\t\tskills.push(result.skill);\n\t\t\t}\n\t\t\tdiagnostics.push(...result.diagnostics);\n\t\t}\n\t} catch {}\n\n\treturn { skills, diagnostics };\n}\n\nfunction loadSkillFromFile(\n\tfilePath: string,\n\tsource: string,\n): { skill: Skill | null; diagnostics: ResourceDiagnostic[] } {\n\tconst diagnostics: ResourceDiagnostic[] = [];\n\n\ttry {\n\t\tconst rawContent = readFileSync(filePath, \"utf-8\");\n\t\tconst { frontmatter } = parseFrontmatter<SkillFrontmatter>(rawContent);\n\t\tconst skillDir = dirname(filePath);\n\t\tconst parentDirName = basename(skillDir);\n\n\t\t// Validate description\n\t\tconst descErrors = validateDescription(frontmatter.description);\n\t\tfor (const error of descErrors) {\n\t\t\tdiagnostics.push({ type: \"warning\", message: error, path: filePath });\n\t\t}\n\n\t\t// Use name from frontmatter, or fall back to parent directory name\n\t\tconst name = frontmatter.name || parentDirName;\n\n\t\t// Validate name\n\t\tconst nameErrors = validateName(name);\n\t\tfor (const error of nameErrors) {\n\t\t\tdiagnostics.push({ type: \"warning\", message: error, path: filePath });\n\t\t}\n\n\t\t// Still load the skill even with warnings (unless description is completely missing)\n\t\tif (!frontmatter.description || frontmatter.description.trim() === \"\") {\n\t\t\treturn { skill: null, diagnostics };\n\t\t}\n\n\t\treturn {\n\t\t\tskill: {\n\t\t\t\tname,\n\t\t\t\tdescription: frontmatter.description,\n\t\t\t\tfilePath,\n\t\t\t\tbaseDir: skillDir,\n\t\t\t\tsourceInfo: createSkillSourceInfo(filePath, skillDir, source),\n\t\t\t\tdisableModelInvocation: frontmatter[\"disable-model-invocation\"] === true,\n\t\t\t},\n\t\t\tdiagnostics,\n\t\t};\n\t} catch (error) {\n\t\tconst message = error instanceof Error ? error.message : \"failed to parse skill file\";\n\t\tdiagnostics.push({ type: \"warning\", message, path: filePath });\n\t\treturn { skill: null, diagnostics };\n\t}\n}\n\n/**\n * Format skills for inclusion in a system prompt.\n * Uses XML format per Agent Skills standard.\n * See: https://agentskills.io/integrate-skills\n *\n * Skills with disableModelInvocation=true are excluded from the prompt\n * (they can only be invoked explicitly via /skill:name commands).\n */\nexport function formatSkillsForPrompt(skills: Skill[]): string {\n\tconst visibleSkills = skills.filter((s) => !s.disableModelInvocation);\n\n\tif (visibleSkills.length === 0) {\n\t\treturn \"\";\n\t}\n\n\tconst lines = [\n\t\t\"\\n\\nThe following skills provide specialized instructions for specific tasks.\",\n\t\t\"Use the read tool to load a skill's file when the task matches its description.\",\n\t\t\"When a skill file references a relative path, resolve it against the skill directory (parent of SKILL.md / dirname of the path) and use that absolute path in tool commands.\",\n\t\t\"\",\n\t\t\"<available_skills>\",\n\t];\n\n\tfor (const skill of visibleSkills) {\n\t\tlines.push(\" <skill>\");\n\t\tlines.push(` <name>${escapeXml(skill.name)}</name>`);\n\t\tlines.push(` <description>${escapeXml(skill.description)}</description>`);\n\t\tlines.push(` <location>${escapeXml(skill.filePath)}</location>`);\n\t\tlines.push(\" </skill>\");\n\t}\n\n\tlines.push(\"</available_skills>\");\n\n\treturn lines.join(\"\\n\");\n}\n\nfunction escapeXml(str: string): string {\n\treturn str\n\t\t.replace(/&/g, \"&amp;\")\n\t\t.replace(/</g, \"&lt;\")\n\t\t.replace(/>/g, \"&gt;\")\n\t\t.replace(/\"/g, \"&quot;\")\n\t\t.replace(/'/g, \"&apos;\");\n}\n\nexport interface LoadSkillsOptions {\n\t/** Working directory for project-local skills. */\n\tcwd: string;\n\t/** Agent config directory for global skills. */\n\tagentDir: string;\n\t/** Explicit skill paths (files or directories) */\n\tskillPaths: string[];\n\t/** Include default skills directories. */\n\tincludeDefaults: boolean;\n}\n\n/**\n * Load skills from all configured locations.\n * Returns skills and any validation diagnostics.\n */\nexport function loadSkills(options: LoadSkillsOptions): LoadSkillsResult {\n\tconst { agentDir, skillPaths, includeDefaults } = options;\n\n\t// Resolve agentDir - if not provided, use default from config\n\tconst resolvedCwd = resolvePath(options.cwd);\n\tconst resolvedAgentDir = resolvePath(agentDir ?? getAgentDir());\n\n\tconst skillMap = new Map<string, Skill>();\n\tconst realPathSet = new Set<string>();\n\tconst allDiagnostics: ResourceDiagnostic[] = [];\n\tconst collisionDiagnostics: ResourceDiagnostic[] = [];\n\n\tfunction addSkills(result: LoadSkillsResult) {\n\t\tallDiagnostics.push(...result.diagnostics);\n\t\tfor (const skill of result.skills) {\n\t\t\t// Resolve symlinks to detect duplicate files\n\t\t\tconst realPath = canonicalizePath(skill.filePath);\n\n\t\t\t// Skip silently if we've already loaded this exact file (via symlink)\n\t\t\tif (realPathSet.has(realPath)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst existing = skillMap.get(skill.name);\n\t\t\tif (existing) {\n\t\t\t\tcollisionDiagnostics.push({\n\t\t\t\t\ttype: \"collision\",\n\t\t\t\t\tmessage: `name \"${skill.name}\" collision`,\n\t\t\t\t\tpath: skill.filePath,\n\t\t\t\t\tcollision: {\n\t\t\t\t\t\tresourceType: \"skill\",\n\t\t\t\t\t\tname: skill.name,\n\t\t\t\t\t\twinnerPath: existing.filePath,\n\t\t\t\t\t\tloserPath: skill.filePath,\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tskillMap.set(skill.name, skill);\n\t\t\t\trealPathSet.add(realPath);\n\t\t\t}\n\t\t}\n\t}\n\n\tif (includeDefaults) {\n\t\taddSkills(loadSkillsFromDirInternal(join(resolvedAgentDir, \"skills\"), \"user\", true));\n\t\taddSkills(loadSkillsFromDirInternal(resolve(resolvedCwd, CONFIG_DIR_NAME, \"skills\"), \"project\", true));\n\t}\n\n\tconst userSkillsDir = join(resolvedAgentDir, \"skills\");\n\tconst projectSkillsDir = resolve(resolvedCwd, CONFIG_DIR_NAME, \"skills\");\n\n\tconst isUnderPath = (target: string, root: string): boolean => {\n\t\tconst normalizedRoot = resolve(root);\n\t\tif (target === normalizedRoot) {\n\t\t\treturn true;\n\t\t}\n\t\tconst prefix = normalizedRoot.endsWith(sep) ? normalizedRoot : `${normalizedRoot}${sep}`;\n\t\treturn target.startsWith(prefix);\n\t};\n\n\tconst getSource = (resolvedPath: string): \"user\" | \"project\" | \"path\" => {\n\t\tif (!includeDefaults) {\n\t\t\tif (isUnderPath(resolvedPath, userSkillsDir)) return \"user\";\n\t\t\tif (isUnderPath(resolvedPath, projectSkillsDir)) return \"project\";\n\t\t}\n\t\treturn \"path\";\n\t};\n\n\tfor (const rawPath of skillPaths) {\n\t\tconst resolvedPath = resolvePath(rawPath, resolvedCwd, { trim: true });\n\t\tif (!existsSync(resolvedPath)) {\n\t\t\tallDiagnostics.push({ type: \"warning\", message: \"skill path does not exist\", path: resolvedPath });\n\t\t\tcontinue;\n\t\t}\n\n\t\ttry {\n\t\t\tconst stats = statSync(resolvedPath);\n\t\t\tconst source = getSource(resolvedPath);\n\t\t\tif (stats.isDirectory()) {\n\t\t\t\taddSkills(loadSkillsFromDirInternal(resolvedPath, source, true));\n\t\t\t} else if (stats.isFile() && resolvedPath.endsWith(\".md\")) {\n\t\t\t\tconst result = loadSkillFromFile(resolvedPath, source);\n\t\t\t\tif (result.skill) {\n\t\t\t\t\taddSkills({ skills: [result.skill], diagnostics: result.diagnostics });\n\t\t\t\t} else {\n\t\t\t\t\tallDiagnostics.push(...result.diagnostics);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tallDiagnostics.push({ type: \"warning\", message: \"skill path is not a markdown file\", path: resolvedPath });\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tconst message = error instanceof Error ? error.message : \"failed to read skill path\";\n\t\t\tallDiagnostics.push({ type: \"warning\", message, path: resolvedPath });\n\t\t}\n\t}\n\n\treturn {\n\t\tskills: Array.from(skillMap.values()),\n\t\tdiagnostics: [...allDiagnostics, ...collisionDiagnostics],\n\t};\n}\n"]}
1
+ {"version":3,"file":"skills.d.ts","sourceRoot":"","sources":["../../src/core/skills.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAA6B,KAAK,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAiE9E,MAAM,WAAW,gBAAgB;IAChC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,0BAA0B,CAAC,EAAE,OAAO,CAAC;IACrC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACvB;AAED,MAAM,WAAW,KAAK;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,UAAU,CAAC;IACvB,sBAAsB,EAAE,OAAO,CAAC;IAChC,WAAW,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,gBAAgB;IAChC,MAAM,EAAE,KAAK,EAAE,CAAC;IAChB,WAAW,EAAE,kBAAkB,EAAE,CAAC;CAClC;AAqED,MAAM,WAAW,wBAAwB;IACxC,mCAAmC;IACnC,GAAG,EAAE,MAAM,CAAC;IACZ,yCAAyC;IACzC,MAAM,EAAE,MAAM,CAAC;CACf;AA0BD;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,wBAAwB,GAAG,gBAAgB,CAGrF;AA4JD;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,CA0B7D;AAeD,MAAM,WAAW,iBAAiB;IACjC,kDAAkD;IAClD,GAAG,EAAE,MAAM,CAAC;IACZ,gDAAgD;IAChD,QAAQ,EAAE,MAAM,CAAC;IACjB,kDAAkD;IAClD,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,0CAA0C;IAC1C,eAAe,EAAE,OAAO,CAAC;CACzB;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,iBAAiB,GAAG,gBAAgB,CA8GvE","sourcesContent":["import { createHash } from \"node:crypto\";\nimport { existsSync, readdirSync, readFileSync, statSync } from \"fs\";\nimport ignore from \"ignore\";\nimport { basename, dirname, join, relative, resolve, sep } from \"path\";\nimport { CONFIG_DIR_NAME, getAgentDir } from \"../config.ts\";\nimport { parseFrontmatter } from \"../utils/frontmatter.ts\";\nimport { canonicalizePath, resolvePath } from \"../utils/paths.ts\";\nimport type { ResourceDiagnostic } from \"./diagnostics.ts\";\nimport { createSyntheticSourceInfo, type SourceInfo } from \"./source-info.ts\";\n\n/** Max name length per spec */\nconst MAX_NAME_LENGTH = 64;\n\n/** Max description length per spec */\nconst MAX_DESCRIPTION_LENGTH = 1024;\n\nconst IGNORE_FILE_NAMES = [\".gitignore\", \".ignore\", \".fdignore\"];\n\ntype IgnoreMatcher = ReturnType<typeof ignore>;\n\nfunction compareDirentNames(a: { name: string }, b: { name: string }): number {\n\tif (a.name < b.name) return -1;\n\tif (a.name > b.name) return 1;\n\treturn 0;\n}\n\nfunction toPosixPath(p: string): string {\n\treturn p.split(sep).join(\"/\");\n}\n\nfunction prefixIgnorePattern(line: string, prefix: string): string | null {\n\tconst trimmed = line.trim();\n\tif (!trimmed) return null;\n\tif (trimmed.startsWith(\"#\") && !trimmed.startsWith(\"\\\\#\")) return null;\n\n\tlet pattern = line;\n\tlet negated = false;\n\n\tif (pattern.startsWith(\"!\")) {\n\t\tnegated = true;\n\t\tpattern = pattern.slice(1);\n\t} else if (pattern.startsWith(\"\\\\!\")) {\n\t\tpattern = pattern.slice(1);\n\t}\n\n\tif (pattern.startsWith(\"/\")) {\n\t\tpattern = pattern.slice(1);\n\t}\n\n\tconst prefixed = prefix ? `${prefix}${pattern}` : pattern;\n\treturn negated ? `!${prefixed}` : prefixed;\n}\n\nfunction addIgnoreRules(ig: IgnoreMatcher, dir: string, rootDir: string): void {\n\tconst relativeDir = relative(rootDir, dir);\n\tconst prefix = relativeDir ? `${toPosixPath(relativeDir)}/` : \"\";\n\n\tfor (const filename of IGNORE_FILE_NAMES) {\n\t\tconst ignorePath = join(dir, filename);\n\t\tif (!existsSync(ignorePath)) continue;\n\t\ttry {\n\t\t\tconst content = readFileSync(ignorePath, \"utf-8\");\n\t\t\tconst patterns = content\n\t\t\t\t.split(/\\r?\\n/)\n\t\t\t\t.map((line) => prefixIgnorePattern(line, prefix))\n\t\t\t\t.filter((line): line is string => Boolean(line));\n\t\t\tif (patterns.length > 0) {\n\t\t\t\tig.add(patterns);\n\t\t\t}\n\t\t} catch {}\n\t}\n}\n\nexport interface SkillFrontmatter {\n\tname?: string;\n\tdescription?: string;\n\t\"disable-model-invocation\"?: boolean;\n\t[key: string]: unknown;\n}\n\nexport interface Skill {\n\tname: string;\n\tdescription: string;\n\tfilePath: string;\n\tbaseDir: string;\n\tsourceInfo: SourceInfo;\n\tdisableModelInvocation: boolean;\n\tcontentHash?: string;\n}\n\nexport interface LoadSkillsResult {\n\tskills: Skill[];\n\tdiagnostics: ResourceDiagnostic[];\n}\n\n/**\n * Validate skill name per Agent Skills spec.\n * Returns array of validation error messages (empty if valid).\n */\nfunction validateName(name: string): string[] {\n\tconst errors: string[] = [];\n\n\tif (name.length > MAX_NAME_LENGTH) {\n\t\terrors.push(`name exceeds ${MAX_NAME_LENGTH} characters (${name.length})`);\n\t}\n\n\tif (!/^[a-z0-9-]+$/.test(name)) {\n\t\terrors.push(`name contains invalid characters (must be lowercase a-z, 0-9, hyphens only)`);\n\t}\n\n\tif (name.startsWith(\"-\") || name.endsWith(\"-\")) {\n\t\terrors.push(`name must not start or end with a hyphen`);\n\t}\n\n\tif (name.includes(\"--\")) {\n\t\terrors.push(`name must not contain consecutive hyphens`);\n\t}\n\n\treturn errors;\n}\n\n/**\n * Validate description per Agent Skills spec.\n */\nfunction validateDescription(description: string | undefined): string[] {\n\tconst errors: string[] = [];\n\n\tif (!description || description.trim() === \"\") {\n\t\terrors.push(\"description is required\");\n\t} else if (description.length > MAX_DESCRIPTION_LENGTH) {\n\t\terrors.push(`description exceeds ${MAX_DESCRIPTION_LENGTH} characters (${description.length})`);\n\t}\n\n\treturn errors;\n}\n\nfunction sanitizeSkillLoadError(error: unknown): string {\n\tconst fallback = \"failed to parse skill file\";\n\tif (typeof error !== \"object\" || error === null || !(\"linePos\" in error)) {\n\t\treturn fallback;\n\t}\n\n\tconst linePos = error.linePos;\n\tif (!Array.isArray(linePos)) {\n\t\treturn fallback;\n\t}\n\n\tconst firstPosition = linePos[0];\n\tif (\n\t\ttypeof firstPosition !== \"object\" ||\n\t\tfirstPosition === null ||\n\t\t!(\"line\" in firstPosition) ||\n\t\t!(\"col\" in firstPosition) ||\n\t\ttypeof firstPosition.line !== \"number\" ||\n\t\ttypeof firstPosition.col !== \"number\"\n\t) {\n\t\treturn fallback;\n\t}\n\n\treturn `${fallback} at line ${firstPosition.line}, column ${firstPosition.col}`;\n}\n\nexport interface LoadSkillsFromDirOptions {\n\t/** Directory to scan for skills */\n\tdir: string;\n\t/** Source identifier for these skills */\n\tsource: string;\n}\n\nfunction createSkillSourceInfo(filePath: string, baseDir: string, source: string): SourceInfo {\n\tswitch (source) {\n\t\tcase \"user\":\n\t\t\treturn createSyntheticSourceInfo(filePath, {\n\t\t\t\tsource: \"local\",\n\t\t\t\tscope: \"user\",\n\t\t\t\tbaseDir,\n\t\t\t});\n\t\tcase \"project\":\n\t\t\treturn createSyntheticSourceInfo(filePath, {\n\t\t\t\tsource: \"local\",\n\t\t\t\tscope: \"project\",\n\t\t\t\tbaseDir,\n\t\t\t});\n\t\tcase \"path\":\n\t\t\treturn createSyntheticSourceInfo(filePath, {\n\t\t\t\tsource: \"local\",\n\t\t\t\tbaseDir,\n\t\t\t});\n\t\tdefault:\n\t\t\treturn createSyntheticSourceInfo(filePath, { source, baseDir });\n\t}\n}\n\n/**\n * Load skills from a directory.\n *\n * Discovery rules:\n * - if a directory contains SKILL.md, treat it as a skill root and do not recurse further\n * - otherwise, load direct .md children in the root\n * - recurse into subdirectories to find SKILL.md\n */\nexport function loadSkillsFromDir(options: LoadSkillsFromDirOptions): LoadSkillsResult {\n\tconst { dir, source } = options;\n\treturn loadSkillsFromDirInternal(dir, source, true);\n}\n\nfunction loadSkillsFromDirInternal(\n\tdir: string,\n\tsource: string,\n\tincludeRootFiles: boolean,\n\tignoreMatcher?: IgnoreMatcher,\n\trootDir?: string,\n): LoadSkillsResult {\n\tconst skills: Skill[] = [];\n\tconst diagnostics: ResourceDiagnostic[] = [];\n\n\tif (!existsSync(dir)) {\n\t\treturn { skills, diagnostics };\n\t}\n\n\tconst root = rootDir ?? dir;\n\tconst ig = ignoreMatcher ?? ignore();\n\taddIgnoreRules(ig, dir, root);\n\n\ttry {\n\t\tconst entries = readdirSync(dir, { withFileTypes: true }).sort(compareDirentNames);\n\n\t\tfor (const entry of entries) {\n\t\t\tif (entry.name !== \"SKILL.md\") {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst fullPath = join(dir, entry.name);\n\n\t\t\tlet isFile = entry.isFile();\n\t\t\tif (entry.isSymbolicLink()) {\n\t\t\t\ttry {\n\t\t\t\t\tisFile = statSync(fullPath).isFile();\n\t\t\t\t} catch {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst relPath = toPosixPath(relative(root, fullPath));\n\t\t\tif (!isFile || ig.ignores(relPath)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst result = loadSkillFromFile(fullPath, source);\n\t\t\tif (result.skill) {\n\t\t\t\tskills.push(result.skill);\n\t\t\t}\n\t\t\tdiagnostics.push(...result.diagnostics);\n\t\t\treturn { skills, diagnostics };\n\t\t}\n\n\t\tfor (const entry of entries) {\n\t\t\tif (entry.name.startsWith(\".\")) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// Skip node_modules to avoid scanning dependencies\n\t\t\tif (entry.name === \"node_modules\") {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst fullPath = join(dir, entry.name);\n\n\t\t\t// For symlinks, check if they point to a directory and follow them\n\t\t\tlet isDirectory = entry.isDirectory();\n\t\t\tlet isFile = entry.isFile();\n\t\t\tif (entry.isSymbolicLink()) {\n\t\t\t\ttry {\n\t\t\t\t\tconst stats = statSync(fullPath);\n\t\t\t\t\tisDirectory = stats.isDirectory();\n\t\t\t\t\tisFile = stats.isFile();\n\t\t\t\t} catch {\n\t\t\t\t\t// Broken symlink, skip it\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst relPath = toPosixPath(relative(root, fullPath));\n\t\t\tconst ignorePath = isDirectory ? `${relPath}/` : relPath;\n\t\t\tif (ig.ignores(ignorePath)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (isDirectory) {\n\t\t\t\tconst subResult = loadSkillsFromDirInternal(fullPath, source, false, ig, root);\n\t\t\t\tskills.push(...subResult.skills);\n\t\t\t\tdiagnostics.push(...subResult.diagnostics);\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (!isFile || !includeRootFiles || !entry.name.endsWith(\".md\")) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst result = loadSkillFromFile(fullPath, source);\n\t\t\tif (result.skill) {\n\t\t\t\tskills.push(result.skill);\n\t\t\t}\n\t\t\tdiagnostics.push(...result.diagnostics);\n\t\t}\n\t} catch {}\n\n\treturn { skills, diagnostics };\n}\n\nfunction loadSkillFromFile(\n\tfilePath: string,\n\tsource: string,\n): { skill: Skill | null; diagnostics: ResourceDiagnostic[] } {\n\tconst diagnostics: ResourceDiagnostic[] = [];\n\n\ttry {\n\t\tconst rawContent = readFileSync(filePath, \"utf-8\");\n\t\tconst { frontmatter } = parseFrontmatter<SkillFrontmatter>(rawContent);\n\t\tconst skillDir = dirname(filePath);\n\t\tconst parentDirName = basename(skillDir);\n\n\t\t// Validate description\n\t\tconst descErrors = validateDescription(frontmatter.description);\n\t\tfor (const error of descErrors) {\n\t\t\tdiagnostics.push({ type: \"warning\", message: error, path: filePath });\n\t\t}\n\n\t\t// Use name from frontmatter, or fall back to parent directory name\n\t\tconst name = frontmatter.name || parentDirName;\n\n\t\t// Validate name\n\t\tconst nameErrors = validateName(name);\n\t\tfor (const error of nameErrors) {\n\t\t\tdiagnostics.push({ type: \"warning\", message: error, path: filePath });\n\t\t}\n\n\t\t// Still load the skill even with warnings (unless description is completely missing)\n\t\tif (!frontmatter.description || frontmatter.description.trim() === \"\") {\n\t\t\treturn { skill: null, diagnostics };\n\t\t}\n\n\t\treturn {\n\t\t\tskill: {\n\t\t\t\tname,\n\t\t\t\tdescription: frontmatter.description,\n\t\t\t\tfilePath,\n\t\t\t\tbaseDir: skillDir,\n\t\t\t\tsourceInfo: createSkillSourceInfo(filePath, skillDir, source),\n\t\t\t\tdisableModelInvocation: frontmatter[\"disable-model-invocation\"] === true,\n\t\t\t\tcontentHash: hashSkillContent(rawContent),\n\t\t\t},\n\t\t\tdiagnostics,\n\t\t};\n\t} catch (error) {\n\t\tdiagnostics.push({ type: \"warning\", message: sanitizeSkillLoadError(error), path: filePath });\n\t\treturn { skill: null, diagnostics };\n\t}\n}\n\n/**\n * Format skills for inclusion in a system prompt.\n * Uses XML format per Agent Skills standard.\n * See: https://agentskills.io/integrate-skills\n *\n * Skills with disableModelInvocation=true are excluded from the prompt\n * (they can only be invoked explicitly via /skill:name commands).\n */\nexport function formatSkillsForPrompt(skills: Skill[]): string {\n\tconst visibleSkills = skills.filter((s) => !s.disableModelInvocation);\n\n\tif (visibleSkills.length === 0) {\n\t\treturn \"\";\n\t}\n\n\tconst lines = [\n\t\t\"\\n\\nThe following skills provide specialized instructions for specific tasks.\",\n\t\t\"Use the read tool to load a skill's file when the task matches its description.\",\n\t\t\"When a skill file references a relative path, resolve it against the skill directory (parent of SKILL.md / dirname of the path) and use that absolute path in tool commands.\",\n\t\t\"\",\n\t\t\"<available_skills>\",\n\t];\n\n\tfor (const skill of visibleSkills) {\n\t\tlines.push(\" <skill>\");\n\t\tlines.push(` <name>${escapeXml(skill.name)}</name>`);\n\t\tlines.push(` <description>${escapeXml(skill.description)}</description>`);\n\t\tlines.push(` <location>${escapeXml(skill.filePath)}</location>`);\n\t\tlines.push(\" </skill>\");\n\t}\n\n\tlines.push(\"</available_skills>\");\n\n\treturn lines.join(\"\\n\");\n}\n\nfunction escapeXml(str: string): string {\n\treturn str\n\t\t.replace(/&/g, \"&amp;\")\n\t\t.replace(/</g, \"&lt;\")\n\t\t.replace(/>/g, \"&gt;\")\n\t\t.replace(/\"/g, \"&quot;\")\n\t\t.replace(/'/g, \"&apos;\");\n}\n\nfunction hashSkillContent(content: string): string {\n\treturn createHash(\"sha256\").update(content).digest(\"hex\");\n}\n\nexport interface LoadSkillsOptions {\n\t/** Working directory for project-local skills. */\n\tcwd: string;\n\t/** Agent config directory for global skills. */\n\tagentDir: string;\n\t/** Explicit skill paths (files or directories) */\n\tskillPaths: string[];\n\t/** Include default skills directories. */\n\tincludeDefaults: boolean;\n}\n\n/**\n * Load skills from all configured locations.\n * Returns skills and any validation diagnostics.\n */\nexport function loadSkills(options: LoadSkillsOptions): LoadSkillsResult {\n\tconst { agentDir, skillPaths, includeDefaults } = options;\n\n\t// Resolve agentDir - if not provided, use default from config\n\tconst resolvedCwd = resolvePath(options.cwd);\n\tconst resolvedAgentDir = resolvePath(agentDir ?? getAgentDir());\n\n\tconst skillMap = new Map<string, Skill>();\n\tconst realPathSet = new Set<string>();\n\tconst allDiagnostics: ResourceDiagnostic[] = [];\n\tconst collisionDiagnostics: ResourceDiagnostic[] = [];\n\n\tfunction addSkills(result: LoadSkillsResult) {\n\t\tallDiagnostics.push(...result.diagnostics);\n\t\tfor (const skill of result.skills) {\n\t\t\t// Resolve symlinks to detect duplicate files\n\t\t\tconst realPath = canonicalizePath(skill.filePath);\n\n\t\t\t// Skip silently if we've already loaded this exact file (via symlink)\n\t\t\tif (realPathSet.has(realPath)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst existing = skillMap.get(skill.name);\n\t\t\tif (existing) {\n\t\t\t\trealPathSet.add(realPath);\n\t\t\t\tif (existing.contentHash && existing.contentHash === skill.contentHash) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tcollisionDiagnostics.push({\n\t\t\t\t\ttype: \"collision\",\n\t\t\t\t\tmessage: `name \"${skill.name}\" collision: kept ${existing.filePath}; skipped ${skill.filePath}`,\n\t\t\t\t\tpath: skill.filePath,\n\t\t\t\t\tcollision: {\n\t\t\t\t\t\tresourceType: \"skill\",\n\t\t\t\t\t\tname: skill.name,\n\t\t\t\t\t\twinnerPath: existing.filePath,\n\t\t\t\t\t\tloserPath: skill.filePath,\n\t\t\t\t\t\twinnerSource: existing.sourceInfo.source,\n\t\t\t\t\t\tloserSource: skill.sourceInfo.source,\n\t\t\t\t\t\twinnerScope: existing.sourceInfo.scope,\n\t\t\t\t\t\tloserScope: skill.sourceInfo.scope,\n\t\t\t\t\t\twinnerOrigin: existing.sourceInfo.origin,\n\t\t\t\t\t\tloserOrigin: skill.sourceInfo.origin,\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tskillMap.set(skill.name, skill);\n\t\t\t\trealPathSet.add(realPath);\n\t\t\t}\n\t\t}\n\t}\n\n\tif (includeDefaults) {\n\t\taddSkills(loadSkillsFromDirInternal(resolve(resolvedCwd, CONFIG_DIR_NAME, \"skills\"), \"project\", true));\n\t\taddSkills(loadSkillsFromDirInternal(join(resolvedAgentDir, \"skills\"), \"user\", true));\n\t}\n\n\tconst userSkillsDir = join(resolvedAgentDir, \"skills\");\n\tconst projectSkillsDir = resolve(resolvedCwd, CONFIG_DIR_NAME, \"skills\");\n\n\tconst isUnderPath = (target: string, root: string): boolean => {\n\t\tconst normalizedRoot = resolve(root);\n\t\tif (target === normalizedRoot) {\n\t\t\treturn true;\n\t\t}\n\t\tconst prefix = normalizedRoot.endsWith(sep) ? normalizedRoot : `${normalizedRoot}${sep}`;\n\t\treturn target.startsWith(prefix);\n\t};\n\n\tconst getSource = (resolvedPath: string): \"user\" | \"project\" | \"path\" => {\n\t\tif (!includeDefaults) {\n\t\t\tif (isUnderPath(resolvedPath, userSkillsDir)) return \"user\";\n\t\t\tif (isUnderPath(resolvedPath, projectSkillsDir)) return \"project\";\n\t\t}\n\t\treturn \"path\";\n\t};\n\n\tfor (const rawPath of skillPaths) {\n\t\tconst resolvedPath = resolvePath(rawPath, resolvedCwd, { trim: true });\n\t\tif (!existsSync(resolvedPath)) {\n\t\t\tallDiagnostics.push({ type: \"warning\", message: \"skill path does not exist\", path: resolvedPath });\n\t\t\tcontinue;\n\t\t}\n\n\t\ttry {\n\t\t\tconst stats = statSync(resolvedPath);\n\t\t\tconst source = getSource(resolvedPath);\n\t\t\tif (stats.isDirectory()) {\n\t\t\t\taddSkills(loadSkillsFromDirInternal(resolvedPath, source, true));\n\t\t\t} else if (stats.isFile() && resolvedPath.endsWith(\".md\")) {\n\t\t\t\tconst result = loadSkillFromFile(resolvedPath, source);\n\t\t\t\tif (result.skill) {\n\t\t\t\t\taddSkills({ skills: [result.skill], diagnostics: result.diagnostics });\n\t\t\t\t} else {\n\t\t\t\t\tallDiagnostics.push(...result.diagnostics);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tallDiagnostics.push({ type: \"warning\", message: \"skill path is not a markdown file\", path: resolvedPath });\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tconst message = error instanceof Error ? error.message : \"failed to read skill path\";\n\t\t\tallDiagnostics.push({ type: \"warning\", message, path: resolvedPath });\n\t\t}\n\t}\n\n\treturn {\n\t\tskills: Array.from(skillMap.values()),\n\t\tdiagnostics: [...allDiagnostics, ...collisionDiagnostics],\n\t};\n}\n"]}
@@ -1,3 +1,4 @@
1
+ import { createHash } from "node:crypto";
1
2
  import { existsSync, readdirSync, readFileSync, statSync } from "fs";
2
3
  import ignore from "ignore";
3
4
  import { basename, dirname, join, relative, resolve, sep } from "path";
@@ -10,6 +11,13 @@ const MAX_NAME_LENGTH = 64;
10
11
  /** Max description length per spec */
11
12
  const MAX_DESCRIPTION_LENGTH = 1024;
12
13
  const IGNORE_FILE_NAMES = [".gitignore", ".ignore", ".fdignore"];
14
+ function compareDirentNames(a, b) {
15
+ if (a.name < b.name)
16
+ return -1;
17
+ if (a.name > b.name)
18
+ return 1;
19
+ return 0;
20
+ }
13
21
  function toPosixPath(p) {
14
22
  return p.split(sep).join("/");
15
23
  }
@@ -87,6 +95,26 @@ function validateDescription(description) {
87
95
  }
88
96
  return errors;
89
97
  }
98
+ function sanitizeSkillLoadError(error) {
99
+ const fallback = "failed to parse skill file";
100
+ if (typeof error !== "object" || error === null || !("linePos" in error)) {
101
+ return fallback;
102
+ }
103
+ const linePos = error.linePos;
104
+ if (!Array.isArray(linePos)) {
105
+ return fallback;
106
+ }
107
+ const firstPosition = linePos[0];
108
+ if (typeof firstPosition !== "object" ||
109
+ firstPosition === null ||
110
+ !("line" in firstPosition) ||
111
+ !("col" in firstPosition) ||
112
+ typeof firstPosition.line !== "number" ||
113
+ typeof firstPosition.col !== "number") {
114
+ return fallback;
115
+ }
116
+ return `${fallback} at line ${firstPosition.line}, column ${firstPosition.col}`;
117
+ }
90
118
  function createSkillSourceInfo(filePath, baseDir, source) {
91
119
  switch (source) {
92
120
  case "user":
@@ -132,7 +160,7 @@ function loadSkillsFromDirInternal(dir, source, includeRootFiles, ignoreMatcher,
132
160
  const ig = ignoreMatcher ?? ignore();
133
161
  addIgnoreRules(ig, dir, root);
134
162
  try {
135
- const entries = readdirSync(dir, { withFileTypes: true });
163
+ const entries = readdirSync(dir, { withFileTypes: true }).sort(compareDirentNames);
136
164
  for (const entry of entries) {
137
165
  if (entry.name !== "SKILL.md") {
138
166
  continue;
@@ -236,13 +264,13 @@ function loadSkillFromFile(filePath, source) {
236
264
  baseDir: skillDir,
237
265
  sourceInfo: createSkillSourceInfo(filePath, skillDir, source),
238
266
  disableModelInvocation: frontmatter["disable-model-invocation"] === true,
267
+ contentHash: hashSkillContent(rawContent),
239
268
  },
240
269
  diagnostics,
241
270
  };
242
271
  }
243
272
  catch (error) {
244
- const message = error instanceof Error ? error.message : "failed to parse skill file";
245
- diagnostics.push({ type: "warning", message, path: filePath });
273
+ diagnostics.push({ type: "warning", message: sanitizeSkillLoadError(error), path: filePath });
246
274
  return { skill: null, diagnostics };
247
275
  }
248
276
  }
@@ -284,6 +312,9 @@ function escapeXml(str) {
284
312
  .replace(/"/g, "&quot;")
285
313
  .replace(/'/g, "&apos;");
286
314
  }
315
+ function hashSkillContent(content) {
316
+ return createHash("sha256").update(content).digest("hex");
317
+ }
287
318
  /**
288
319
  * Load skills from all configured locations.
289
320
  * Returns skills and any validation diagnostics.
@@ -308,15 +339,25 @@ export function loadSkills(options) {
308
339
  }
309
340
  const existing = skillMap.get(skill.name);
310
341
  if (existing) {
342
+ realPathSet.add(realPath);
343
+ if (existing.contentHash && existing.contentHash === skill.contentHash) {
344
+ continue;
345
+ }
311
346
  collisionDiagnostics.push({
312
347
  type: "collision",
313
- message: `name "${skill.name}" collision`,
348
+ message: `name "${skill.name}" collision: kept ${existing.filePath}; skipped ${skill.filePath}`,
314
349
  path: skill.filePath,
315
350
  collision: {
316
351
  resourceType: "skill",
317
352
  name: skill.name,
318
353
  winnerPath: existing.filePath,
319
354
  loserPath: skill.filePath,
355
+ winnerSource: existing.sourceInfo.source,
356
+ loserSource: skill.sourceInfo.source,
357
+ winnerScope: existing.sourceInfo.scope,
358
+ loserScope: skill.sourceInfo.scope,
359
+ winnerOrigin: existing.sourceInfo.origin,
360
+ loserOrigin: skill.sourceInfo.origin,
320
361
  },
321
362
  });
322
363
  }
@@ -327,8 +368,8 @@ export function loadSkills(options) {
327
368
  }
328
369
  }
329
370
  if (includeDefaults) {
330
- addSkills(loadSkillsFromDirInternal(join(resolvedAgentDir, "skills"), "user", true));
331
371
  addSkills(loadSkillsFromDirInternal(resolve(resolvedCwd, CONFIG_DIR_NAME, "skills"), "project", true));
372
+ addSkills(loadSkillsFromDirInternal(join(resolvedAgentDir, "skills"), "user", true));
332
373
  }
333
374
  const userSkillsDir = join(resolvedAgentDir, "skills");
334
375
  const projectSkillsDir = resolve(resolvedCwd, CONFIG_DIR_NAME, "skills");
@@ -1 +1 @@
1
- {"version":3,"file":"skills.js","sourceRoot":"","sources":["../../src/core/skills.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,IAAI,CAAC;AACrE,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AACvE,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAElE,OAAO,EAAE,yBAAyB,EAAmB,MAAM,kBAAkB,CAAC;AAE9E,+BAA+B;AAC/B,MAAM,eAAe,GAAG,EAAE,CAAC;AAE3B,sCAAsC;AACtC,MAAM,sBAAsB,GAAG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,CAAC;YAClE,CAAC;iBAAM,IAAI,KAAK,CAAC,MAAM,EAAE,IAAI,YAAY,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;gBAC3D,MAAM,MAAM,GAAG,iBAAiB,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;gBACvD,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;oBAClB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,WAAW,EAAE,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC;gBACxE,CAAC;qBAAM,CAAC;oBACP,cAAc,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,WAAW,CAAC,CAAC;gBAC5C,CAAC;YACF,CAAC;iBAAM,CAAC;gBACP,cAAc,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,mCAAmC,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC,CAAC;YAC5G,CAAC;QACF,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAChB,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,2BAA2B,CAAC;YACrF,cAAc,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC,CAAC;QACvE,CAAC;IACF,CAAC;IAED,OAAO;QACN,MAAM,EAAE,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC;QACrC,WAAW,EAAE,CAAC,GAAG,cAAc,EAAE,GAAG,oBAAoB,CAAC;KACzD,CAAC;AAAA,CACF","sourcesContent":["import { existsSync, readdirSync, readFileSync, statSync } from \"fs\";\nimport ignore from \"ignore\";\nimport { basename, dirname, join, relative, resolve, sep } from \"path\";\nimport { CONFIG_DIR_NAME, getAgentDir } from \"../config.ts\";\nimport { parseFrontmatter } from \"../utils/frontmatter.ts\";\nimport { canonicalizePath, resolvePath } from \"../utils/paths.ts\";\nimport type { ResourceDiagnostic } from \"./diagnostics.ts\";\nimport { createSyntheticSourceInfo, type SourceInfo } from \"./source-info.ts\";\n\n/** Max name length per spec */\nconst MAX_NAME_LENGTH = 64;\n\n/** Max description length per spec */\nconst MAX_DESCRIPTION_LENGTH = 1024;\n\nconst IGNORE_FILE_NAMES = [\".gitignore\", \".ignore\", \".fdignore\"];\n\ntype IgnoreMatcher = ReturnType<typeof ignore>;\n\nfunction toPosixPath(p: string): string {\n\treturn p.split(sep).join(\"/\");\n}\n\nfunction prefixIgnorePattern(line: string, prefix: string): string | null {\n\tconst trimmed = line.trim();\n\tif (!trimmed) return null;\n\tif (trimmed.startsWith(\"#\") && !trimmed.startsWith(\"\\\\#\")) return null;\n\n\tlet pattern = line;\n\tlet negated = false;\n\n\tif (pattern.startsWith(\"!\")) {\n\t\tnegated = true;\n\t\tpattern = pattern.slice(1);\n\t} else if (pattern.startsWith(\"\\\\!\")) {\n\t\tpattern = pattern.slice(1);\n\t}\n\n\tif (pattern.startsWith(\"/\")) {\n\t\tpattern = pattern.slice(1);\n\t}\n\n\tconst prefixed = prefix ? `${prefix}${pattern}` : pattern;\n\treturn negated ? `!${prefixed}` : prefixed;\n}\n\nfunction addIgnoreRules(ig: IgnoreMatcher, dir: string, rootDir: string): void {\n\tconst relativeDir = relative(rootDir, dir);\n\tconst prefix = relativeDir ? `${toPosixPath(relativeDir)}/` : \"\";\n\n\tfor (const filename of IGNORE_FILE_NAMES) {\n\t\tconst ignorePath = join(dir, filename);\n\t\tif (!existsSync(ignorePath)) continue;\n\t\ttry {\n\t\t\tconst content = readFileSync(ignorePath, \"utf-8\");\n\t\t\tconst patterns = content\n\t\t\t\t.split(/\\r?\\n/)\n\t\t\t\t.map((line) => prefixIgnorePattern(line, prefix))\n\t\t\t\t.filter((line): line is string => Boolean(line));\n\t\t\tif (patterns.length > 0) {\n\t\t\t\tig.add(patterns);\n\t\t\t}\n\t\t} catch {}\n\t}\n}\n\nexport interface SkillFrontmatter {\n\tname?: string;\n\tdescription?: string;\n\t\"disable-model-invocation\"?: boolean;\n\t[key: string]: unknown;\n}\n\nexport interface Skill {\n\tname: string;\n\tdescription: string;\n\tfilePath: string;\n\tbaseDir: string;\n\tsourceInfo: SourceInfo;\n\tdisableModelInvocation: boolean;\n}\n\nexport interface LoadSkillsResult {\n\tskills: Skill[];\n\tdiagnostics: ResourceDiagnostic[];\n}\n\n/**\n * Validate skill name per Agent Skills spec.\n * Returns array of validation error messages (empty if valid).\n */\nfunction validateName(name: string): string[] {\n\tconst errors: string[] = [];\n\n\tif (name.length > MAX_NAME_LENGTH) {\n\t\terrors.push(`name exceeds ${MAX_NAME_LENGTH} characters (${name.length})`);\n\t}\n\n\tif (!/^[a-z0-9-]+$/.test(name)) {\n\t\terrors.push(`name contains invalid characters (must be lowercase a-z, 0-9, hyphens only)`);\n\t}\n\n\tif (name.startsWith(\"-\") || name.endsWith(\"-\")) {\n\t\terrors.push(`name must not start or end with a hyphen`);\n\t}\n\n\tif (name.includes(\"--\")) {\n\t\terrors.push(`name must not contain consecutive hyphens`);\n\t}\n\n\treturn errors;\n}\n\n/**\n * Validate description per Agent Skills spec.\n */\nfunction validateDescription(description: string | undefined): string[] {\n\tconst errors: string[] = [];\n\n\tif (!description || description.trim() === \"\") {\n\t\terrors.push(\"description is required\");\n\t} else if (description.length > MAX_DESCRIPTION_LENGTH) {\n\t\terrors.push(`description exceeds ${MAX_DESCRIPTION_LENGTH} characters (${description.length})`);\n\t}\n\n\treturn errors;\n}\n\nexport interface LoadSkillsFromDirOptions {\n\t/** Directory to scan for skills */\n\tdir: string;\n\t/** Source identifier for these skills */\n\tsource: string;\n}\n\nfunction createSkillSourceInfo(filePath: string, baseDir: string, source: string): SourceInfo {\n\tswitch (source) {\n\t\tcase \"user\":\n\t\t\treturn createSyntheticSourceInfo(filePath, {\n\t\t\t\tsource: \"local\",\n\t\t\t\tscope: \"user\",\n\t\t\t\tbaseDir,\n\t\t\t});\n\t\tcase \"project\":\n\t\t\treturn createSyntheticSourceInfo(filePath, {\n\t\t\t\tsource: \"local\",\n\t\t\t\tscope: \"project\",\n\t\t\t\tbaseDir,\n\t\t\t});\n\t\tcase \"path\":\n\t\t\treturn createSyntheticSourceInfo(filePath, {\n\t\t\t\tsource: \"local\",\n\t\t\t\tbaseDir,\n\t\t\t});\n\t\tdefault:\n\t\t\treturn createSyntheticSourceInfo(filePath, { source, baseDir });\n\t}\n}\n\n/**\n * Load skills from a directory.\n *\n * Discovery rules:\n * - if a directory contains SKILL.md, treat it as a skill root and do not recurse further\n * - otherwise, load direct .md children in the root\n * - recurse into subdirectories to find SKILL.md\n */\nexport function loadSkillsFromDir(options: LoadSkillsFromDirOptions): LoadSkillsResult {\n\tconst { dir, source } = options;\n\treturn loadSkillsFromDirInternal(dir, source, true);\n}\n\nfunction loadSkillsFromDirInternal(\n\tdir: string,\n\tsource: string,\n\tincludeRootFiles: boolean,\n\tignoreMatcher?: IgnoreMatcher,\n\trootDir?: string,\n): LoadSkillsResult {\n\tconst skills: Skill[] = [];\n\tconst diagnostics: ResourceDiagnostic[] = [];\n\n\tif (!existsSync(dir)) {\n\t\treturn { skills, diagnostics };\n\t}\n\n\tconst root = rootDir ?? dir;\n\tconst ig = ignoreMatcher ?? ignore();\n\taddIgnoreRules(ig, dir, root);\n\n\ttry {\n\t\tconst entries = readdirSync(dir, { withFileTypes: true });\n\n\t\tfor (const entry of entries) {\n\t\t\tif (entry.name !== \"SKILL.md\") {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst fullPath = join(dir, entry.name);\n\n\t\t\tlet isFile = entry.isFile();\n\t\t\tif (entry.isSymbolicLink()) {\n\t\t\t\ttry {\n\t\t\t\t\tisFile = statSync(fullPath).isFile();\n\t\t\t\t} catch {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst relPath = toPosixPath(relative(root, fullPath));\n\t\t\tif (!isFile || ig.ignores(relPath)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst result = loadSkillFromFile(fullPath, source);\n\t\t\tif (result.skill) {\n\t\t\t\tskills.push(result.skill);\n\t\t\t}\n\t\t\tdiagnostics.push(...result.diagnostics);\n\t\t\treturn { skills, diagnostics };\n\t\t}\n\n\t\tfor (const entry of entries) {\n\t\t\tif (entry.name.startsWith(\".\")) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// Skip node_modules to avoid scanning dependencies\n\t\t\tif (entry.name === \"node_modules\") {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst fullPath = join(dir, entry.name);\n\n\t\t\t// For symlinks, check if they point to a directory and follow them\n\t\t\tlet isDirectory = entry.isDirectory();\n\t\t\tlet isFile = entry.isFile();\n\t\t\tif (entry.isSymbolicLink()) {\n\t\t\t\ttry {\n\t\t\t\t\tconst stats = statSync(fullPath);\n\t\t\t\t\tisDirectory = stats.isDirectory();\n\t\t\t\t\tisFile = stats.isFile();\n\t\t\t\t} catch {\n\t\t\t\t\t// Broken symlink, skip it\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst relPath = toPosixPath(relative(root, fullPath));\n\t\t\tconst ignorePath = isDirectory ? `${relPath}/` : relPath;\n\t\t\tif (ig.ignores(ignorePath)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (isDirectory) {\n\t\t\t\tconst subResult = loadSkillsFromDirInternal(fullPath, source, false, ig, root);\n\t\t\t\tskills.push(...subResult.skills);\n\t\t\t\tdiagnostics.push(...subResult.diagnostics);\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (!isFile || !includeRootFiles || !entry.name.endsWith(\".md\")) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst result = loadSkillFromFile(fullPath, source);\n\t\t\tif (result.skill) {\n\t\t\t\tskills.push(result.skill);\n\t\t\t}\n\t\t\tdiagnostics.push(...result.diagnostics);\n\t\t}\n\t} catch {}\n\n\treturn { skills, diagnostics };\n}\n\nfunction loadSkillFromFile(\n\tfilePath: string,\n\tsource: string,\n): { skill: Skill | null; diagnostics: ResourceDiagnostic[] } {\n\tconst diagnostics: ResourceDiagnostic[] = [];\n\n\ttry {\n\t\tconst rawContent = readFileSync(filePath, \"utf-8\");\n\t\tconst { frontmatter } = parseFrontmatter<SkillFrontmatter>(rawContent);\n\t\tconst skillDir = dirname(filePath);\n\t\tconst parentDirName = basename(skillDir);\n\n\t\t// Validate description\n\t\tconst descErrors = validateDescription(frontmatter.description);\n\t\tfor (const error of descErrors) {\n\t\t\tdiagnostics.push({ type: \"warning\", message: error, path: filePath });\n\t\t}\n\n\t\t// Use name from frontmatter, or fall back to parent directory name\n\t\tconst name = frontmatter.name || parentDirName;\n\n\t\t// Validate name\n\t\tconst nameErrors = validateName(name);\n\t\tfor (const error of nameErrors) {\n\t\t\tdiagnostics.push({ type: \"warning\", message: error, path: filePath });\n\t\t}\n\n\t\t// Still load the skill even with warnings (unless description is completely missing)\n\t\tif (!frontmatter.description || frontmatter.description.trim() === \"\") {\n\t\t\treturn { skill: null, diagnostics };\n\t\t}\n\n\t\treturn {\n\t\t\tskill: {\n\t\t\t\tname,\n\t\t\t\tdescription: frontmatter.description,\n\t\t\t\tfilePath,\n\t\t\t\tbaseDir: skillDir,\n\t\t\t\tsourceInfo: createSkillSourceInfo(filePath, skillDir, source),\n\t\t\t\tdisableModelInvocation: frontmatter[\"disable-model-invocation\"] === true,\n\t\t\t},\n\t\t\tdiagnostics,\n\t\t};\n\t} catch (error) {\n\t\tconst message = error instanceof Error ? error.message : \"failed to parse skill file\";\n\t\tdiagnostics.push({ type: \"warning\", message, path: filePath });\n\t\treturn { skill: null, diagnostics };\n\t}\n}\n\n/**\n * Format skills for inclusion in a system prompt.\n * Uses XML format per Agent Skills standard.\n * See: https://agentskills.io/integrate-skills\n *\n * Skills with disableModelInvocation=true are excluded from the prompt\n * (they can only be invoked explicitly via /skill:name commands).\n */\nexport function formatSkillsForPrompt(skills: Skill[]): string {\n\tconst visibleSkills = skills.filter((s) => !s.disableModelInvocation);\n\n\tif (visibleSkills.length === 0) {\n\t\treturn \"\";\n\t}\n\n\tconst lines = [\n\t\t\"\\n\\nThe following skills provide specialized instructions for specific tasks.\",\n\t\t\"Use the read tool to load a skill's file when the task matches its description.\",\n\t\t\"When a skill file references a relative path, resolve it against the skill directory (parent of SKILL.md / dirname of the path) and use that absolute path in tool commands.\",\n\t\t\"\",\n\t\t\"<available_skills>\",\n\t];\n\n\tfor (const skill of visibleSkills) {\n\t\tlines.push(\" <skill>\");\n\t\tlines.push(` <name>${escapeXml(skill.name)}</name>`);\n\t\tlines.push(` <description>${escapeXml(skill.description)}</description>`);\n\t\tlines.push(` <location>${escapeXml(skill.filePath)}</location>`);\n\t\tlines.push(\" </skill>\");\n\t}\n\n\tlines.push(\"</available_skills>\");\n\n\treturn lines.join(\"\\n\");\n}\n\nfunction escapeXml(str: string): string {\n\treturn str\n\t\t.replace(/&/g, \"&amp;\")\n\t\t.replace(/</g, \"&lt;\")\n\t\t.replace(/>/g, \"&gt;\")\n\t\t.replace(/\"/g, \"&quot;\")\n\t\t.replace(/'/g, \"&apos;\");\n}\n\nexport interface LoadSkillsOptions {\n\t/** Working directory for project-local skills. */\n\tcwd: string;\n\t/** Agent config directory for global skills. */\n\tagentDir: string;\n\t/** Explicit skill paths (files or directories) */\n\tskillPaths: string[];\n\t/** Include default skills directories. */\n\tincludeDefaults: boolean;\n}\n\n/**\n * Load skills from all configured locations.\n * Returns skills and any validation diagnostics.\n */\nexport function loadSkills(options: LoadSkillsOptions): LoadSkillsResult {\n\tconst { agentDir, skillPaths, includeDefaults } = options;\n\n\t// Resolve agentDir - if not provided, use default from config\n\tconst resolvedCwd = resolvePath(options.cwd);\n\tconst resolvedAgentDir = resolvePath(agentDir ?? getAgentDir());\n\n\tconst skillMap = new Map<string, Skill>();\n\tconst realPathSet = new Set<string>();\n\tconst allDiagnostics: ResourceDiagnostic[] = [];\n\tconst collisionDiagnostics: ResourceDiagnostic[] = [];\n\n\tfunction addSkills(result: LoadSkillsResult) {\n\t\tallDiagnostics.push(...result.diagnostics);\n\t\tfor (const skill of result.skills) {\n\t\t\t// Resolve symlinks to detect duplicate files\n\t\t\tconst realPath = canonicalizePath(skill.filePath);\n\n\t\t\t// Skip silently if we've already loaded this exact file (via symlink)\n\t\t\tif (realPathSet.has(realPath)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst existing = skillMap.get(skill.name);\n\t\t\tif (existing) {\n\t\t\t\tcollisionDiagnostics.push({\n\t\t\t\t\ttype: \"collision\",\n\t\t\t\t\tmessage: `name \"${skill.name}\" collision`,\n\t\t\t\t\tpath: skill.filePath,\n\t\t\t\t\tcollision: {\n\t\t\t\t\t\tresourceType: \"skill\",\n\t\t\t\t\t\tname: skill.name,\n\t\t\t\t\t\twinnerPath: existing.filePath,\n\t\t\t\t\t\tloserPath: skill.filePath,\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tskillMap.set(skill.name, skill);\n\t\t\t\trealPathSet.add(realPath);\n\t\t\t}\n\t\t}\n\t}\n\n\tif (includeDefaults) {\n\t\taddSkills(loadSkillsFromDirInternal(join(resolvedAgentDir, \"skills\"), \"user\", true));\n\t\taddSkills(loadSkillsFromDirInternal(resolve(resolvedCwd, CONFIG_DIR_NAME, \"skills\"), \"project\", true));\n\t}\n\n\tconst userSkillsDir = join(resolvedAgentDir, \"skills\");\n\tconst projectSkillsDir = resolve(resolvedCwd, CONFIG_DIR_NAME, \"skills\");\n\n\tconst isUnderPath = (target: string, root: string): boolean => {\n\t\tconst normalizedRoot = resolve(root);\n\t\tif (target === normalizedRoot) {\n\t\t\treturn true;\n\t\t}\n\t\tconst prefix = normalizedRoot.endsWith(sep) ? normalizedRoot : `${normalizedRoot}${sep}`;\n\t\treturn target.startsWith(prefix);\n\t};\n\n\tconst getSource = (resolvedPath: string): \"user\" | \"project\" | \"path\" => {\n\t\tif (!includeDefaults) {\n\t\t\tif (isUnderPath(resolvedPath, userSkillsDir)) return \"user\";\n\t\t\tif (isUnderPath(resolvedPath, projectSkillsDir)) return \"project\";\n\t\t}\n\t\treturn \"path\";\n\t};\n\n\tfor (const rawPath of skillPaths) {\n\t\tconst resolvedPath = resolvePath(rawPath, resolvedCwd, { trim: true });\n\t\tif (!existsSync(resolvedPath)) {\n\t\t\tallDiagnostics.push({ type: \"warning\", message: \"skill path does not exist\", path: resolvedPath });\n\t\t\tcontinue;\n\t\t}\n\n\t\ttry {\n\t\t\tconst stats = statSync(resolvedPath);\n\t\t\tconst source = getSource(resolvedPath);\n\t\t\tif (stats.isDirectory()) {\n\t\t\t\taddSkills(loadSkillsFromDirInternal(resolvedPath, source, true));\n\t\t\t} else if (stats.isFile() && resolvedPath.endsWith(\".md\")) {\n\t\t\t\tconst result = loadSkillFromFile(resolvedPath, source);\n\t\t\t\tif (result.skill) {\n\t\t\t\t\taddSkills({ skills: [result.skill], diagnostics: result.diagnostics });\n\t\t\t\t} else {\n\t\t\t\t\tallDiagnostics.push(...result.diagnostics);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tallDiagnostics.push({ type: \"warning\", message: \"skill path is not a markdown file\", path: resolvedPath });\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tconst message = error instanceof Error ? error.message : \"failed to read skill path\";\n\t\t\tallDiagnostics.push({ type: \"warning\", message, path: resolvedPath });\n\t\t}\n\t}\n\n\treturn {\n\t\tskills: Array.from(skillMap.values()),\n\t\tdiagnostics: [...allDiagnostics, ...collisionDiagnostics],\n\t};\n}\n"]}
1
+ {"version":3,"file":"skills.js","sourceRoot":"","sources":["../../src/core/skills.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,IAAI,CAA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,CAAC,EAAE,MAAM,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,WAAW,EAAE,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC;gBACxE,CAAC;qBAAM,CAAC;oBACP,cAAc,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,WAAW,CAAC,CAAC;gBAC5C,CAAC;YACF,CAAC;iBAAM,CAAC;gBACP,cAAc,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,mCAAmC,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC,CAAC;YAC5G,CAAC;QACF,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAChB,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,2BAA2B,CAAC;YACrF,cAAc,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC,CAAC;QACvE,CAAC;IACF,CAAC;IAED,OAAO;QACN,MAAM,EAAE,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC;QACrC,WAAW,EAAE,CAAC,GAAG,cAAc,EAAE,GAAG,oBAAoB,CAAC;KACzD,CAAC;AAAA,CACF","sourcesContent":["import { createHash } from \"node:crypto\";\nimport { existsSync, readdirSync, readFileSync, statSync } from \"fs\";\nimport ignore from \"ignore\";\nimport { basename, dirname, join, relative, resolve, sep } from \"path\";\nimport { CONFIG_DIR_NAME, getAgentDir } from \"../config.ts\";\nimport { parseFrontmatter } from \"../utils/frontmatter.ts\";\nimport { canonicalizePath, resolvePath } from \"../utils/paths.ts\";\nimport type { ResourceDiagnostic } from \"./diagnostics.ts\";\nimport { createSyntheticSourceInfo, type SourceInfo } from \"./source-info.ts\";\n\n/** Max name length per spec */\nconst MAX_NAME_LENGTH = 64;\n\n/** Max description length per spec */\nconst MAX_DESCRIPTION_LENGTH = 1024;\n\nconst IGNORE_FILE_NAMES = [\".gitignore\", \".ignore\", \".fdignore\"];\n\ntype IgnoreMatcher = ReturnType<typeof ignore>;\n\nfunction compareDirentNames(a: { name: string }, b: { name: string }): number {\n\tif (a.name < b.name) return -1;\n\tif (a.name > b.name) return 1;\n\treturn 0;\n}\n\nfunction toPosixPath(p: string): string {\n\treturn p.split(sep).join(\"/\");\n}\n\nfunction prefixIgnorePattern(line: string, prefix: string): string | null {\n\tconst trimmed = line.trim();\n\tif (!trimmed) return null;\n\tif (trimmed.startsWith(\"#\") && !trimmed.startsWith(\"\\\\#\")) return null;\n\n\tlet pattern = line;\n\tlet negated = false;\n\n\tif (pattern.startsWith(\"!\")) {\n\t\tnegated = true;\n\t\tpattern = pattern.slice(1);\n\t} else if (pattern.startsWith(\"\\\\!\")) {\n\t\tpattern = pattern.slice(1);\n\t}\n\n\tif (pattern.startsWith(\"/\")) {\n\t\tpattern = pattern.slice(1);\n\t}\n\n\tconst prefixed = prefix ? `${prefix}${pattern}` : pattern;\n\treturn negated ? `!${prefixed}` : prefixed;\n}\n\nfunction addIgnoreRules(ig: IgnoreMatcher, dir: string, rootDir: string): void {\n\tconst relativeDir = relative(rootDir, dir);\n\tconst prefix = relativeDir ? `${toPosixPath(relativeDir)}/` : \"\";\n\n\tfor (const filename of IGNORE_FILE_NAMES) {\n\t\tconst ignorePath = join(dir, filename);\n\t\tif (!existsSync(ignorePath)) continue;\n\t\ttry {\n\t\t\tconst content = readFileSync(ignorePath, \"utf-8\");\n\t\t\tconst patterns = content\n\t\t\t\t.split(/\\r?\\n/)\n\t\t\t\t.map((line) => prefixIgnorePattern(line, prefix))\n\t\t\t\t.filter((line): line is string => Boolean(line));\n\t\t\tif (patterns.length > 0) {\n\t\t\t\tig.add(patterns);\n\t\t\t}\n\t\t} catch {}\n\t}\n}\n\nexport interface SkillFrontmatter {\n\tname?: string;\n\tdescription?: string;\n\t\"disable-model-invocation\"?: boolean;\n\t[key: string]: unknown;\n}\n\nexport interface Skill {\n\tname: string;\n\tdescription: string;\n\tfilePath: string;\n\tbaseDir: string;\n\tsourceInfo: SourceInfo;\n\tdisableModelInvocation: boolean;\n\tcontentHash?: string;\n}\n\nexport interface LoadSkillsResult {\n\tskills: Skill[];\n\tdiagnostics: ResourceDiagnostic[];\n}\n\n/**\n * Validate skill name per Agent Skills spec.\n * Returns array of validation error messages (empty if valid).\n */\nfunction validateName(name: string): string[] {\n\tconst errors: string[] = [];\n\n\tif (name.length > MAX_NAME_LENGTH) {\n\t\terrors.push(`name exceeds ${MAX_NAME_LENGTH} characters (${name.length})`);\n\t}\n\n\tif (!/^[a-z0-9-]+$/.test(name)) {\n\t\terrors.push(`name contains invalid characters (must be lowercase a-z, 0-9, hyphens only)`);\n\t}\n\n\tif (name.startsWith(\"-\") || name.endsWith(\"-\")) {\n\t\terrors.push(`name must not start or end with a hyphen`);\n\t}\n\n\tif (name.includes(\"--\")) {\n\t\terrors.push(`name must not contain consecutive hyphens`);\n\t}\n\n\treturn errors;\n}\n\n/**\n * Validate description per Agent Skills spec.\n */\nfunction validateDescription(description: string | undefined): string[] {\n\tconst errors: string[] = [];\n\n\tif (!description || description.trim() === \"\") {\n\t\terrors.push(\"description is required\");\n\t} else if (description.length > MAX_DESCRIPTION_LENGTH) {\n\t\terrors.push(`description exceeds ${MAX_DESCRIPTION_LENGTH} characters (${description.length})`);\n\t}\n\n\treturn errors;\n}\n\nfunction sanitizeSkillLoadError(error: unknown): string {\n\tconst fallback = \"failed to parse skill file\";\n\tif (typeof error !== \"object\" || error === null || !(\"linePos\" in error)) {\n\t\treturn fallback;\n\t}\n\n\tconst linePos = error.linePos;\n\tif (!Array.isArray(linePos)) {\n\t\treturn fallback;\n\t}\n\n\tconst firstPosition = linePos[0];\n\tif (\n\t\ttypeof firstPosition !== \"object\" ||\n\t\tfirstPosition === null ||\n\t\t!(\"line\" in firstPosition) ||\n\t\t!(\"col\" in firstPosition) ||\n\t\ttypeof firstPosition.line !== \"number\" ||\n\t\ttypeof firstPosition.col !== \"number\"\n\t) {\n\t\treturn fallback;\n\t}\n\n\treturn `${fallback} at line ${firstPosition.line}, column ${firstPosition.col}`;\n}\n\nexport interface LoadSkillsFromDirOptions {\n\t/** Directory to scan for skills */\n\tdir: string;\n\t/** Source identifier for these skills */\n\tsource: string;\n}\n\nfunction createSkillSourceInfo(filePath: string, baseDir: string, source: string): SourceInfo {\n\tswitch (source) {\n\t\tcase \"user\":\n\t\t\treturn createSyntheticSourceInfo(filePath, {\n\t\t\t\tsource: \"local\",\n\t\t\t\tscope: \"user\",\n\t\t\t\tbaseDir,\n\t\t\t});\n\t\tcase \"project\":\n\t\t\treturn createSyntheticSourceInfo(filePath, {\n\t\t\t\tsource: \"local\",\n\t\t\t\tscope: \"project\",\n\t\t\t\tbaseDir,\n\t\t\t});\n\t\tcase \"path\":\n\t\t\treturn createSyntheticSourceInfo(filePath, {\n\t\t\t\tsource: \"local\",\n\t\t\t\tbaseDir,\n\t\t\t});\n\t\tdefault:\n\t\t\treturn createSyntheticSourceInfo(filePath, { source, baseDir });\n\t}\n}\n\n/**\n * Load skills from a directory.\n *\n * Discovery rules:\n * - if a directory contains SKILL.md, treat it as a skill root and do not recurse further\n * - otherwise, load direct .md children in the root\n * - recurse into subdirectories to find SKILL.md\n */\nexport function loadSkillsFromDir(options: LoadSkillsFromDirOptions): LoadSkillsResult {\n\tconst { dir, source } = options;\n\treturn loadSkillsFromDirInternal(dir, source, true);\n}\n\nfunction loadSkillsFromDirInternal(\n\tdir: string,\n\tsource: string,\n\tincludeRootFiles: boolean,\n\tignoreMatcher?: IgnoreMatcher,\n\trootDir?: string,\n): LoadSkillsResult {\n\tconst skills: Skill[] = [];\n\tconst diagnostics: ResourceDiagnostic[] = [];\n\n\tif (!existsSync(dir)) {\n\t\treturn { skills, diagnostics };\n\t}\n\n\tconst root = rootDir ?? dir;\n\tconst ig = ignoreMatcher ?? ignore();\n\taddIgnoreRules(ig, dir, root);\n\n\ttry {\n\t\tconst entries = readdirSync(dir, { withFileTypes: true }).sort(compareDirentNames);\n\n\t\tfor (const entry of entries) {\n\t\t\tif (entry.name !== \"SKILL.md\") {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst fullPath = join(dir, entry.name);\n\n\t\t\tlet isFile = entry.isFile();\n\t\t\tif (entry.isSymbolicLink()) {\n\t\t\t\ttry {\n\t\t\t\t\tisFile = statSync(fullPath).isFile();\n\t\t\t\t} catch {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst relPath = toPosixPath(relative(root, fullPath));\n\t\t\tif (!isFile || ig.ignores(relPath)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst result = loadSkillFromFile(fullPath, source);\n\t\t\tif (result.skill) {\n\t\t\t\tskills.push(result.skill);\n\t\t\t}\n\t\t\tdiagnostics.push(...result.diagnostics);\n\t\t\treturn { skills, diagnostics };\n\t\t}\n\n\t\tfor (const entry of entries) {\n\t\t\tif (entry.name.startsWith(\".\")) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// Skip node_modules to avoid scanning dependencies\n\t\t\tif (entry.name === \"node_modules\") {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst fullPath = join(dir, entry.name);\n\n\t\t\t// For symlinks, check if they point to a directory and follow them\n\t\t\tlet isDirectory = entry.isDirectory();\n\t\t\tlet isFile = entry.isFile();\n\t\t\tif (entry.isSymbolicLink()) {\n\t\t\t\ttry {\n\t\t\t\t\tconst stats = statSync(fullPath);\n\t\t\t\t\tisDirectory = stats.isDirectory();\n\t\t\t\t\tisFile = stats.isFile();\n\t\t\t\t} catch {\n\t\t\t\t\t// Broken symlink, skip it\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst relPath = toPosixPath(relative(root, fullPath));\n\t\t\tconst ignorePath = isDirectory ? `${relPath}/` : relPath;\n\t\t\tif (ig.ignores(ignorePath)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (isDirectory) {\n\t\t\t\tconst subResult = loadSkillsFromDirInternal(fullPath, source, false, ig, root);\n\t\t\t\tskills.push(...subResult.skills);\n\t\t\t\tdiagnostics.push(...subResult.diagnostics);\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (!isFile || !includeRootFiles || !entry.name.endsWith(\".md\")) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst result = loadSkillFromFile(fullPath, source);\n\t\t\tif (result.skill) {\n\t\t\t\tskills.push(result.skill);\n\t\t\t}\n\t\t\tdiagnostics.push(...result.diagnostics);\n\t\t}\n\t} catch {}\n\n\treturn { skills, diagnostics };\n}\n\nfunction loadSkillFromFile(\n\tfilePath: string,\n\tsource: string,\n): { skill: Skill | null; diagnostics: ResourceDiagnostic[] } {\n\tconst diagnostics: ResourceDiagnostic[] = [];\n\n\ttry {\n\t\tconst rawContent = readFileSync(filePath, \"utf-8\");\n\t\tconst { frontmatter } = parseFrontmatter<SkillFrontmatter>(rawContent);\n\t\tconst skillDir = dirname(filePath);\n\t\tconst parentDirName = basename(skillDir);\n\n\t\t// Validate description\n\t\tconst descErrors = validateDescription(frontmatter.description);\n\t\tfor (const error of descErrors) {\n\t\t\tdiagnostics.push({ type: \"warning\", message: error, path: filePath });\n\t\t}\n\n\t\t// Use name from frontmatter, or fall back to parent directory name\n\t\tconst name = frontmatter.name || parentDirName;\n\n\t\t// Validate name\n\t\tconst nameErrors = validateName(name);\n\t\tfor (const error of nameErrors) {\n\t\t\tdiagnostics.push({ type: \"warning\", message: error, path: filePath });\n\t\t}\n\n\t\t// Still load the skill even with warnings (unless description is completely missing)\n\t\tif (!frontmatter.description || frontmatter.description.trim() === \"\") {\n\t\t\treturn { skill: null, diagnostics };\n\t\t}\n\n\t\treturn {\n\t\t\tskill: {\n\t\t\t\tname,\n\t\t\t\tdescription: frontmatter.description,\n\t\t\t\tfilePath,\n\t\t\t\tbaseDir: skillDir,\n\t\t\t\tsourceInfo: createSkillSourceInfo(filePath, skillDir, source),\n\t\t\t\tdisableModelInvocation: frontmatter[\"disable-model-invocation\"] === true,\n\t\t\t\tcontentHash: hashSkillContent(rawContent),\n\t\t\t},\n\t\t\tdiagnostics,\n\t\t};\n\t} catch (error) {\n\t\tdiagnostics.push({ type: \"warning\", message: sanitizeSkillLoadError(error), path: filePath });\n\t\treturn { skill: null, diagnostics };\n\t}\n}\n\n/**\n * Format skills for inclusion in a system prompt.\n * Uses XML format per Agent Skills standard.\n * See: https://agentskills.io/integrate-skills\n *\n * Skills with disableModelInvocation=true are excluded from the prompt\n * (they can only be invoked explicitly via /skill:name commands).\n */\nexport function formatSkillsForPrompt(skills: Skill[]): string {\n\tconst visibleSkills = skills.filter((s) => !s.disableModelInvocation);\n\n\tif (visibleSkills.length === 0) {\n\t\treturn \"\";\n\t}\n\n\tconst lines = [\n\t\t\"\\n\\nThe following skills provide specialized instructions for specific tasks.\",\n\t\t\"Use the read tool to load a skill's file when the task matches its description.\",\n\t\t\"When a skill file references a relative path, resolve it against the skill directory (parent of SKILL.md / dirname of the path) and use that absolute path in tool commands.\",\n\t\t\"\",\n\t\t\"<available_skills>\",\n\t];\n\n\tfor (const skill of visibleSkills) {\n\t\tlines.push(\" <skill>\");\n\t\tlines.push(` <name>${escapeXml(skill.name)}</name>`);\n\t\tlines.push(` <description>${escapeXml(skill.description)}</description>`);\n\t\tlines.push(` <location>${escapeXml(skill.filePath)}</location>`);\n\t\tlines.push(\" </skill>\");\n\t}\n\n\tlines.push(\"</available_skills>\");\n\n\treturn lines.join(\"\\n\");\n}\n\nfunction escapeXml(str: string): string {\n\treturn str\n\t\t.replace(/&/g, \"&amp;\")\n\t\t.replace(/</g, \"&lt;\")\n\t\t.replace(/>/g, \"&gt;\")\n\t\t.replace(/\"/g, \"&quot;\")\n\t\t.replace(/'/g, \"&apos;\");\n}\n\nfunction hashSkillContent(content: string): string {\n\treturn createHash(\"sha256\").update(content).digest(\"hex\");\n}\n\nexport interface LoadSkillsOptions {\n\t/** Working directory for project-local skills. */\n\tcwd: string;\n\t/** Agent config directory for global skills. */\n\tagentDir: string;\n\t/** Explicit skill paths (files or directories) */\n\tskillPaths: string[];\n\t/** Include default skills directories. */\n\tincludeDefaults: boolean;\n}\n\n/**\n * Load skills from all configured locations.\n * Returns skills and any validation diagnostics.\n */\nexport function loadSkills(options: LoadSkillsOptions): LoadSkillsResult {\n\tconst { agentDir, skillPaths, includeDefaults } = options;\n\n\t// Resolve agentDir - if not provided, use default from config\n\tconst resolvedCwd = resolvePath(options.cwd);\n\tconst resolvedAgentDir = resolvePath(agentDir ?? getAgentDir());\n\n\tconst skillMap = new Map<string, Skill>();\n\tconst realPathSet = new Set<string>();\n\tconst allDiagnostics: ResourceDiagnostic[] = [];\n\tconst collisionDiagnostics: ResourceDiagnostic[] = [];\n\n\tfunction addSkills(result: LoadSkillsResult) {\n\t\tallDiagnostics.push(...result.diagnostics);\n\t\tfor (const skill of result.skills) {\n\t\t\t// Resolve symlinks to detect duplicate files\n\t\t\tconst realPath = canonicalizePath(skill.filePath);\n\n\t\t\t// Skip silently if we've already loaded this exact file (via symlink)\n\t\t\tif (realPathSet.has(realPath)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst existing = skillMap.get(skill.name);\n\t\t\tif (existing) {\n\t\t\t\trealPathSet.add(realPath);\n\t\t\t\tif (existing.contentHash && existing.contentHash === skill.contentHash) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tcollisionDiagnostics.push({\n\t\t\t\t\ttype: \"collision\",\n\t\t\t\t\tmessage: `name \"${skill.name}\" collision: kept ${existing.filePath}; skipped ${skill.filePath}`,\n\t\t\t\t\tpath: skill.filePath,\n\t\t\t\t\tcollision: {\n\t\t\t\t\t\tresourceType: \"skill\",\n\t\t\t\t\t\tname: skill.name,\n\t\t\t\t\t\twinnerPath: existing.filePath,\n\t\t\t\t\t\tloserPath: skill.filePath,\n\t\t\t\t\t\twinnerSource: existing.sourceInfo.source,\n\t\t\t\t\t\tloserSource: skill.sourceInfo.source,\n\t\t\t\t\t\twinnerScope: existing.sourceInfo.scope,\n\t\t\t\t\t\tloserScope: skill.sourceInfo.scope,\n\t\t\t\t\t\twinnerOrigin: existing.sourceInfo.origin,\n\t\t\t\t\t\tloserOrigin: skill.sourceInfo.origin,\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tskillMap.set(skill.name, skill);\n\t\t\t\trealPathSet.add(realPath);\n\t\t\t}\n\t\t}\n\t}\n\n\tif (includeDefaults) {\n\t\taddSkills(loadSkillsFromDirInternal(resolve(resolvedCwd, CONFIG_DIR_NAME, \"skills\"), \"project\", true));\n\t\taddSkills(loadSkillsFromDirInternal(join(resolvedAgentDir, \"skills\"), \"user\", true));\n\t}\n\n\tconst userSkillsDir = join(resolvedAgentDir, \"skills\");\n\tconst projectSkillsDir = resolve(resolvedCwd, CONFIG_DIR_NAME, \"skills\");\n\n\tconst isUnderPath = (target: string, root: string): boolean => {\n\t\tconst normalizedRoot = resolve(root);\n\t\tif (target === normalizedRoot) {\n\t\t\treturn true;\n\t\t}\n\t\tconst prefix = normalizedRoot.endsWith(sep) ? normalizedRoot : `${normalizedRoot}${sep}`;\n\t\treturn target.startsWith(prefix);\n\t};\n\n\tconst getSource = (resolvedPath: string): \"user\" | \"project\" | \"path\" => {\n\t\tif (!includeDefaults) {\n\t\t\tif (isUnderPath(resolvedPath, userSkillsDir)) return \"user\";\n\t\t\tif (isUnderPath(resolvedPath, projectSkillsDir)) return \"project\";\n\t\t}\n\t\treturn \"path\";\n\t};\n\n\tfor (const rawPath of skillPaths) {\n\t\tconst resolvedPath = resolvePath(rawPath, resolvedCwd, { trim: true });\n\t\tif (!existsSync(resolvedPath)) {\n\t\t\tallDiagnostics.push({ type: \"warning\", message: \"skill path does not exist\", path: resolvedPath });\n\t\t\tcontinue;\n\t\t}\n\n\t\ttry {\n\t\t\tconst stats = statSync(resolvedPath);\n\t\t\tconst source = getSource(resolvedPath);\n\t\t\tif (stats.isDirectory()) {\n\t\t\t\taddSkills(loadSkillsFromDirInternal(resolvedPath, source, true));\n\t\t\t} else if (stats.isFile() && resolvedPath.endsWith(\".md\")) {\n\t\t\t\tconst result = loadSkillFromFile(resolvedPath, source);\n\t\t\t\tif (result.skill) {\n\t\t\t\t\taddSkills({ skills: [result.skill], diagnostics: result.diagnostics });\n\t\t\t\t} else {\n\t\t\t\t\tallDiagnostics.push(...result.diagnostics);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tallDiagnostics.push({ type: \"warning\", message: \"skill path is not a markdown file\", path: resolvedPath });\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tconst message = error instanceof Error ? error.message : \"failed to read skill path\";\n\t\t\tallDiagnostics.push({ type: \"warning\", message, path: resolvedPath });\n\t\t}\n\t}\n\n\treturn {\n\t\tskills: Array.from(skillMap.values()),\n\t\tdiagnostics: [...allDiagnostics, ...collisionDiagnostics],\n\t};\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"slash-commands.d.ts","sourceRoot":"","sources":["../../src/core/slash-commands.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD,MAAM,MAAM,kBAAkB,GAAG,WAAW,GAAG,QAAQ,GAAG,OAAO,CAAC;AAElE,MAAM,WAAW,gBAAgB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,kBAAkB,CAAC;IAC3B,UAAU,EAAE,UAAU,CAAC;CACvB;AAED,MAAM,WAAW,mBAAmB;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,sBAAsB,EAAE,aAAa,CAAC,mBAAmB,CAyBrE,CAAC","sourcesContent":["import { APP_NAME } from \"../config.ts\";\nimport type { SourceInfo } from \"./source-info.ts\";\n\nexport type SlashCommandSource = \"extension\" | \"prompt\" | \"skill\";\n\nexport interface SlashCommandInfo {\n\tname: string;\n\tdescription?: string;\n\tsource: SlashCommandSource;\n\tsourceInfo: SourceInfo;\n}\n\nexport interface BuiltinSlashCommand {\n\tname: string;\n\tdescription: string;\n}\n\nexport const BUILTIN_SLASH_COMMANDS: ReadonlyArray<BuiltinSlashCommand> = [\n\t{ name: \"settings\", description: \"Open settings menu\" },\n\t{ name: \"think\", description: \"Select thinking level\" },\n\t{ name: \"model\", description: \"Select model (opens selector UI, then thinking selector)\" },\n\t{ name: \"scoped-models\", description: \"Enable/disable models for Ctrl+P cycling\" },\n\t{ name: \"export\", description: \"Export session (HTML default, or specify path: .html/.jsonl)\" },\n\t{ name: \"import\", description: \"Import and resume a session from a JSONL file\" },\n\t{ name: \"share\", description: \"Share session as a secret GitHub gist\" },\n\t{ name: \"copy\", description: \"Copy last agent message to clipboard\" },\n\t{ name: \"name\", description: \"Set session display name\" },\n\t{ name: \"session\", description: \"Show session info and stats\" },\n\t{ name: \"changelog\", description: \"Show changelog entries\" },\n\t{ name: \"hotkeys\", description: \"Show all keyboard shortcuts\" },\n\t{ name: \"fork\", description: \"Create a new fork from a previous user message\" },\n\t{ name: \"clone\", description: \"Duplicate the current session at the current position\" },\n\t{ name: \"tree\", description: \"Navigate session tree (switch branches)\" },\n\t{ name: \"login\", description: \"Configure provider authentication\" },\n\t{ name: \"logout\", description: \"Remove provider authentication\" },\n\t{ name: \"new\", description: \"Start a new session\" },\n\t{ name: \"compact\", description: \"Manually compact the session context\" },\n\t{ name: \"resume\", description: \"Resume a different session\" },\n\t{ name: \"reload\", description: \"Reload keybindings, extensions, skills, prompts, and themes\" },\n\t{ name: \"mcp\", description: \"Show configured MCP servers (read-only inventory)\" },\n\t{ name: \"skills\", description: \"Show loaded skills and diagnostics\" },\n\t{ name: \"quit\", description: `Quit ${APP_NAME}` },\n];\n"]}
1
+ {"version":3,"file":"slash-commands.d.ts","sourceRoot":"","sources":["../../src/core/slash-commands.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD,MAAM,MAAM,kBAAkB,GAAG,WAAW,GAAG,QAAQ,GAAG,OAAO,CAAC;AAElE,MAAM,WAAW,gBAAgB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,kBAAkB,CAAC;IAC3B,UAAU,EAAE,UAAU,CAAC;CACvB;AAED,MAAM,WAAW,mBAAmB;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,sBAAsB,EAAE,aAAa,CAAC,mBAAmB,CAuBrE,CAAC","sourcesContent":["import { APP_NAME } from \"../config.ts\";\nimport type { SourceInfo } from \"./source-info.ts\";\n\nexport type SlashCommandSource = \"extension\" | \"prompt\" | \"skill\";\n\nexport interface SlashCommandInfo {\n\tname: string;\n\tdescription?: string;\n\tsource: SlashCommandSource;\n\tsourceInfo: SourceInfo;\n}\n\nexport interface BuiltinSlashCommand {\n\tname: string;\n\tdescription: string;\n}\n\nexport const BUILTIN_SLASH_COMMANDS: ReadonlyArray<BuiltinSlashCommand> = [\n\t{ name: \"settings\", description: \"Open settings menu\" },\n\t{ name: \"think\", description: \"Select thinking level\" },\n\t{ name: \"model\", description: \"Select model (opens selector UI, then thinking selector)\" },\n\t{ name: \"scoped-models\", description: \"Enable/disable models for Ctrl+P cycling\" },\n\t{ name: \"export\", description: \"Export session (HTML default, or specify path: .html/.jsonl)\" },\n\t{ name: \"import\", description: \"Import and resume a session from a JSONL file\" },\n\t{ name: \"share\", description: \"Share session as a secret GitHub gist\" },\n\t{ name: \"copy\", description: \"Copy last agent message to clipboard\" },\n\t{ name: \"name\", description: \"Set session display name\" },\n\t{ name: \"session\", description: \"Show session info and stats\" },\n\t{ name: \"changelog\", description: \"Show changelog entries\" },\n\t{ name: \"hotkeys\", description: \"Show all keyboard shortcuts\" },\n\t{ name: \"fork\", description: \"Create a new fork from a previous user message\" },\n\t{ name: \"clone\", description: \"Duplicate the current session at the current position\" },\n\t{ name: \"tree\", description: \"Navigate session tree (switch branches)\" },\n\t{ name: \"login\", description: \"Configure provider authentication\" },\n\t{ name: \"logout\", description: \"Remove provider authentication\" },\n\t{ name: \"new\", description: \"Start a new session\" },\n\t{ name: \"compact\", description: \"Manually compact the session context\" },\n\t{ name: \"resume\", description: \"Resume a different session\" },\n\t{ name: \"reload\", description: \"Reload keybindings, extensions, skills, prompts, and themes\" },\n\t{ name: \"quit\", description: `Quit ${APP_NAME}` },\n];\n"]}
@@ -21,8 +21,6 @@ export const BUILTIN_SLASH_COMMANDS = [
21
21
  { name: "compact", description: "Manually compact the session context" },
22
22
  { name: "resume", description: "Resume a different session" },
23
23
  { name: "reload", description: "Reload keybindings, extensions, skills, prompts, and themes" },
24
- { name: "mcp", description: "Show configured MCP servers (read-only inventory)" },
25
- { name: "skills", description: "Show loaded skills and diagnostics" },
26
24
  { name: "quit", description: `Quit ${APP_NAME}` },
27
25
  ];
28
26
  //# sourceMappingURL=slash-commands.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"slash-commands.js","sourceRoot":"","sources":["../../src/core/slash-commands.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAiBxC,MAAM,CAAC,MAAM,sBAAsB,GAAuC;IACzE,EAAE,IAAI,EAAE,UAAU,EAAE,WAAW,EAAE,oBAAoB,EAAE;IACvD,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,uBAAuB,EAAE;IACvD,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,0DAA0D,EAAE;IAC1F,EAAE,IAAI,EAAE,eAAe,EAAE,WAAW,EAAE,0CAA0C,EAAE;IAClF,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,8DAA8D,EAAE;IAC/F,EAAE,IAAI,EAAE,QAAQ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import type { SourceInfo } from \"./source-info.ts\";\n\nexport type SlashCommandSource = \"extension\" | \"prompt\" | \"skill\";\n\nexport interface SlashCommandInfo {\n\tname: string;\n\tdescription?: string;\n\tsource: SlashCommandSource;\n\tsourceInfo: SourceInfo;\n}\n\nexport interface BuiltinSlashCommand {\n\tname: string;\n\tdescription: string;\n}\n\nexport const BUILTIN_SLASH_COMMANDS: ReadonlyArray<BuiltinSlashCommand> = [\n\t{ name: \"settings\", description: \"Open settings menu\" },\n\t{ name: \"think\", description: \"Select thinking level\" },\n\t{ name: \"model\", description: \"Select model (opens selector UI, then thinking selector)\" },\n\t{ name: \"scoped-models\", description: \"Enable/disable models for Ctrl+P cycling\" },\n\t{ name: \"export\", description: \"Export session (HTML default, or specify path: .html/.jsonl)\" },\n\t{ name: \"import\", description: \"Import and resume a session from a JSONL file\" },\n\t{ name: \"share\", description: \"Share session as a secret GitHub gist\" },\n\t{ name: \"copy\", description: \"Copy last agent message to clipboard\" },\n\t{ name: \"name\", description: \"Set session display name\" },\n\t{ name: \"session\", description: \"Show session info and stats\" },\n\t{ name: \"changelog\", description: \"Show changelog entries\" },\n\t{ name: \"hotkeys\", description: \"Show all keyboard shortcuts\" },\n\t{ name: \"fork\", description: \"Create a new fork from a previous user message\" },\n\t{ name: \"clone\", description: \"Duplicate the current session at the current position\" },\n\t{ name: \"tree\", description: \"Navigate session tree (switch branches)\" },\n\t{ name: \"login\", description: \"Configure provider authentication\" },\n\t{ name: \"logout\", description: \"Remove provider authentication\" },\n\t{ name: \"new\", description: \"Start a new session\" },\n\t{ name: \"compact\", description: \"Manually compact the session context\" },\n\t{ name: \"resume\", description: \"Resume a different session\" },\n\t{ name: \"reload\", description: \"Reload keybindings, extensions, skills, prompts, and themes\" },\n\t{ name: \"mcp\", description: \"Show configured MCP servers (read-only inventory)\" },\n\t{ name: \"skills\", description: \"Show loaded skills and diagnostics\" },\n\t{ name: \"quit\", description: `Quit ${APP_NAME}` },\n];\n"]}
1
+ {"version":3,"file":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AAE,IAAI,EAAE,KAAK,EAAE,WAAW,EAAE,qBAAqB,EAAE;IACnD,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,sCAAsC,EAAE;IACxE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,4BAA4B,EAAE;IAC7D,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,6DAA6D,EAAE;IAC9F,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,QAAQ,QAAQ,EAAE,EAAE;CACjD,CAAC","sourcesContent":["import { APP_NAME } from \"../config.ts\";\nimport type { SourceInfo } from \"./source-info.ts\";\n\nexport type SlashCommandSource = \"extension\" | \"prompt\" | \"skill\";\n\nexport interface SlashCommandInfo {\n\tname: string;\n\tdescription?: string;\n\tsource: SlashCommandSource;\n\tsourceInfo: SourceInfo;\n}\n\nexport interface BuiltinSlashCommand {\n\tname: string;\n\tdescription: string;\n}\n\nexport const BUILTIN_SLASH_COMMANDS: ReadonlyArray<BuiltinSlashCommand> = [\n\t{ name: \"settings\", description: \"Open settings menu\" },\n\t{ name: \"think\", description: \"Select thinking level\" },\n\t{ name: \"model\", description: \"Select model (opens selector UI, then thinking selector)\" },\n\t{ name: \"scoped-models\", description: \"Enable/disable models for Ctrl+P cycling\" },\n\t{ name: \"export\", description: \"Export session (HTML default, or specify path: .html/.jsonl)\" },\n\t{ name: \"import\", description: \"Import and resume a session from a JSONL file\" },\n\t{ name: \"share\", description: \"Share session as a secret GitHub gist\" },\n\t{ name: \"copy\", description: \"Copy last agent message to clipboard\" },\n\t{ name: \"name\", description: \"Set session display name\" },\n\t{ name: \"session\", description: \"Show session info and stats\" },\n\t{ name: \"changelog\", description: \"Show changelog entries\" },\n\t{ name: \"hotkeys\", description: \"Show all keyboard shortcuts\" },\n\t{ name: \"fork\", description: \"Create a new fork from a previous user message\" },\n\t{ name: \"clone\", description: \"Duplicate the current session at the current position\" },\n\t{ name: \"tree\", description: \"Navigate session tree (switch branches)\" },\n\t{ name: \"login\", description: \"Configure provider authentication\" },\n\t{ name: \"logout\", description: \"Remove provider authentication\" },\n\t{ name: \"new\", description: \"Start a new session\" },\n\t{ name: \"compact\", description: \"Manually compact the session context\" },\n\t{ name: \"resume\", description: \"Resume a different session\" },\n\t{ name: \"reload\", description: \"Reload keybindings, extensions, skills, prompts, and themes\" },\n\t{ name: \"quit\", description: `Quit ${APP_NAME}` },\n];\n"]}
@@ -0,0 +1,73 @@
1
+ import { type LaneContextInheritanceMode, type LaneEvidenceGate, type LaneSpawnReceipt, type SubagentLaneGrant } from "./loadout-runtime.ts";
2
+ import { type CapabilityInventory, type LoadoutAuthority, type LoadoutRole } from "./loadouts.ts";
3
+ export type SubagentOrchestrationRole = "planner" | "architect" | "executor" | "critic" | "visual-qa" | "rhwp-doc" | "security" | "package-maintainer";
4
+ export type SubagentSchedulerTopology = "serial" | "parallel" | "map-reduce" | "hybrid";
5
+ export interface SubagentRoleAssignment {
6
+ readonly role: SubagentOrchestrationRole;
7
+ readonly loadoutRole: LoadoutRole;
8
+ readonly loadoutName: string;
9
+ readonly agentName: string;
10
+ readonly contextInheritance: LaneContextInheritanceMode;
11
+ readonly evidenceGates: readonly LaneEvidenceGate[];
12
+ readonly writesProductFiles: boolean;
13
+ }
14
+ export interface SubagentLaneSpec {
15
+ readonly id: string;
16
+ readonly role: SubagentOrchestrationRole;
17
+ readonly task: string;
18
+ readonly dependsOn?: readonly string[];
19
+ readonly readScope?: readonly string[];
20
+ readonly writeScope?: readonly string[];
21
+ readonly acceptance?: readonly string[];
22
+ readonly evidenceOutput?: string;
23
+ readonly blockedPaths?: readonly string[];
24
+ readonly contextInheritance?: LaneContextInheritanceMode;
25
+ readonly grantAuthority?: LoadoutAuthority;
26
+ readonly loadoutName?: string;
27
+ readonly agentName?: string;
28
+ }
29
+ export interface SpawnGateDecision {
30
+ readonly outcome: "allowed" | "rejected";
31
+ readonly reason: string;
32
+ readonly planRequired: boolean;
33
+ readonly missingFields: readonly string[];
34
+ }
35
+ export interface SubagentScheduleBatch {
36
+ readonly index: number;
37
+ readonly laneIds: readonly string[];
38
+ readonly reason: "ready-parallel" | "serialized-writer" | "parallel-limit";
39
+ }
40
+ export interface SubagentRouteFeatures {
41
+ readonly topology: SubagentSchedulerTopology;
42
+ readonly width: number;
43
+ readonly criticalDepth: number;
44
+ readonly couplingDensity: number;
45
+ readonly parallelRatio: number;
46
+ readonly nodeCount: number;
47
+ readonly edgeCount: number;
48
+ }
49
+ export interface BuildSubagentOrchestrationPlanInput {
50
+ readonly runId: string;
51
+ readonly lanes: readonly SubagentLaneSpec[];
52
+ readonly inventory: CapabilityInventory;
53
+ readonly spawnPlan?: LaneSpawnReceipt;
54
+ readonly spawnThreshold?: number;
55
+ readonly maxParallelLanes?: number;
56
+ }
57
+ export interface SubagentOrchestrationPlan {
58
+ readonly laneGrants: readonly SubagentLaneGrant[];
59
+ readonly batches: readonly SubagentScheduleBatch[];
60
+ readonly route: SubagentRouteFeatures;
61
+ readonly spawnGate: SpawnGateDecision;
62
+ readonly blockers: readonly string[];
63
+ readonly warnings: readonly string[];
64
+ }
65
+ export declare function resolveSubagentRoleAssignment(role: SubagentOrchestrationRole): SubagentRoleAssignment;
66
+ export declare function buildSubagentOrchestrationPlan(input: BuildSubagentOrchestrationPlanInput): SubagentOrchestrationPlan;
67
+ export declare function evaluateSpawnGate(request: {
68
+ readonly childCount: number;
69
+ readonly plan?: LaneSpawnReceipt;
70
+ readonly threshold?: number;
71
+ }): SpawnGateDecision;
72
+ export declare function findMissingSpawnPlanFields(plan: LaneSpawnReceipt | undefined): string[];
73
+ //# sourceMappingURL=subagent-orchestration.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subagent-orchestration.d.ts","sourceRoot":"","sources":["../../src/core/subagent-orchestration.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,KAAK,0BAA0B,EAC/B,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,MAAM,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;IACjC,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;CACnC;AAED,MAAM,WAAW,yBAAyB;IACzC,QAAQ,CAAC,UAAU,EAAE,SAAS,iBAAiB,EAAE,CAAC;IAClD,QAAQ,CAAC,OAAO,EAAE,SAAS,qBAAqB,EAAE,CAAC;IACnD,QAAQ,CAAC,KAAK,EAAE,qBAAqB,CAAC;IACtC,QAAQ,CAAC,SAAS,EAAE,iBAAiB,CAAC;IACtC,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;CACrC;AA6FD,wBAAgB,6BAA6B,CAAC,IAAI,EAAE,yBAAyB,GAAG,sBAAsB,CAErG;AAED,wBAAgB,8BAA8B,CAAC,KAAK,EAAE,mCAAmC,GAAG,yBAAyB,CAmCpH;AAED,wBAAgB,iBAAiB,CAAC,OAAO,EAAE;IAC1C,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,IAAI,CAAC,EAAE,gBAAgB,CAAC;IACjC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC5B,GAAG,iBAAiB,CAqCpB;AAED,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,gBAAgB,GAAG,SAAS,GAAG,MAAM,EAAE,CAWvF","sourcesContent":["import {\n\tbuildSubagentLaneGrant,\n\ttype LaneContextInheritanceMode,\n\ttype LaneEvidenceGate,\n\ttype LaneSpawnReceipt,\n\ttype SubagentLaneGrant,\n} from \"./loadout-runtime.ts\";\nimport {\n\tapplyLoadoutProfile,\n\tBUILTIN_LOADOUTS,\n\ttype CapabilityInventory,\n\tderiveSchedulerFields,\n\ttype LoadoutAuthority,\n\ttype LoadoutProfile,\n\ttype LoadoutRole,\n} from \"./loadouts.ts\";\n\nexport type SubagentOrchestrationRole =\n\t| \"planner\"\n\t| \"architect\"\n\t| \"executor\"\n\t| \"critic\"\n\t| \"visual-qa\"\n\t| \"rhwp-doc\"\n\t| \"security\"\n\t| \"package-maintainer\";\n\nexport type SubagentSchedulerTopology = \"serial\" | \"parallel\" | \"map-reduce\" | \"hybrid\";\n\nexport interface SubagentRoleAssignment {\n\treadonly role: SubagentOrchestrationRole;\n\treadonly loadoutRole: LoadoutRole;\n\treadonly loadoutName: string;\n\treadonly agentName: string;\n\treadonly contextInheritance: LaneContextInheritanceMode;\n\treadonly evidenceGates: readonly LaneEvidenceGate[];\n\treadonly writesProductFiles: boolean;\n}\n\nexport interface SubagentLaneSpec {\n\treadonly id: string;\n\treadonly role: SubagentOrchestrationRole;\n\treadonly task: string;\n\treadonly dependsOn?: readonly string[];\n\treadonly readScope?: readonly string[];\n\treadonly writeScope?: readonly string[];\n\treadonly acceptance?: readonly string[];\n\treadonly evidenceOutput?: string;\n\treadonly blockedPaths?: readonly string[];\n\treadonly contextInheritance?: LaneContextInheritanceMode;\n\treadonly grantAuthority?: LoadoutAuthority;\n\treadonly loadoutName?: string;\n\treadonly agentName?: string;\n}\n\nexport interface SpawnGateDecision {\n\treadonly outcome: \"allowed\" | \"rejected\";\n\treadonly reason: string;\n\treadonly planRequired: boolean;\n\treadonly missingFields: readonly string[];\n}\n\nexport interface SubagentScheduleBatch {\n\treadonly index: number;\n\treadonly laneIds: readonly string[];\n\treadonly reason: \"ready-parallel\" | \"serialized-writer\" | \"parallel-limit\";\n}\n\nexport interface SubagentRouteFeatures {\n\treadonly topology: SubagentSchedulerTopology;\n\treadonly width: number;\n\treadonly criticalDepth: number;\n\treadonly couplingDensity: number;\n\treadonly parallelRatio: number;\n\treadonly nodeCount: number;\n\treadonly edgeCount: number;\n}\n\nexport interface BuildSubagentOrchestrationPlanInput {\n\treadonly runId: string;\n\treadonly lanes: readonly SubagentLaneSpec[];\n\treadonly inventory: CapabilityInventory;\n\treadonly spawnPlan?: LaneSpawnReceipt;\n\treadonly spawnThreshold?: number;\n\treadonly maxParallelLanes?: number;\n}\n\nexport interface SubagentOrchestrationPlan {\n\treadonly laneGrants: readonly SubagentLaneGrant[];\n\treadonly batches: readonly SubagentScheduleBatch[];\n\treadonly route: SubagentRouteFeatures;\n\treadonly spawnGate: SpawnGateDecision;\n\treadonly blockers: readonly string[];\n\treadonly warnings: readonly string[];\n}\n\nconst DEFAULT_SPAWN_THRESHOLD = 4;\n\nconst ROLE_ASSIGNMENTS: Readonly<Record<SubagentOrchestrationRole, SubagentRoleAssignment>> = {\n\tplanner: {\n\t\trole: \"planner\",\n\t\tloadoutRole: \"planner\",\n\t\tloadoutName: \"plan\",\n\t\tagentName: \"omk-planner\",\n\t\tcontextInheritance: \"receipt\",\n\t\tevidenceGates: [\"plan-reread\", \"cleanup\"],\n\t\twritesProductFiles: false,\n\t},\n\tarchitect: {\n\t\trole: \"architect\",\n\t\tloadoutRole: \"architect\",\n\t\tloadoutName: \"architect\",\n\t\tagentName: \"omk-architect\",\n\t\tcontextInheritance: \"bounded\",\n\t\tevidenceGates: [\"plan-reread\", \"automated-verification\", \"adversarial-qa\", \"cleanup\"],\n\t\twritesProductFiles: false,\n\t},\n\texecutor: {\n\t\trole: \"executor\",\n\t\tloadoutRole: \"executor\",\n\t\tloadoutName: \"executor\",\n\t\tagentName: \"omk-executor\",\n\t\tcontextInheritance: \"bounded\",\n\t\tevidenceGates: [\"plan-reread\", \"automated-verification\", \"manual-qa\", \"adversarial-qa\", \"cleanup\"],\n\t\twritesProductFiles: true,\n\t},\n\tcritic: {\n\t\trole: \"critic\",\n\t\tloadoutRole: \"critic\",\n\t\tloadoutName: \"critic\",\n\t\tagentName: \"omk-critic\",\n\t\tcontextInheritance: \"receipt\",\n\t\tevidenceGates: [\"plan-reread\", \"adversarial-qa\", \"cleanup\"],\n\t\twritesProductFiles: false,\n\t},\n\t\"visual-qa\": {\n\t\trole: \"visual-qa\",\n\t\tloadoutRole: \"visual-qa\",\n\t\tloadoutName: \"visual-qa\",\n\t\tagentName: \"omk-visual-qa\",\n\t\tcontextInheritance: \"receipt\",\n\t\tevidenceGates: [\"plan-reread\", \"automated-verification\", \"manual-qa\", \"adversarial-qa\", \"cleanup\"],\n\t\twritesProductFiles: false,\n\t},\n\t\"rhwp-doc\": {\n\t\trole: \"rhwp-doc\",\n\t\tloadoutRole: \"rhwp-doc\",\n\t\tloadoutName: \"rhwp-doc\",\n\t\tagentName: \"omk-rhwp-doc\",\n\t\tcontextInheritance: \"bounded\",\n\t\tevidenceGates: [\"plan-reread\", \"automated-verification\", \"manual-qa\", \"adversarial-qa\", \"cleanup\"],\n\t\twritesProductFiles: true,\n\t},\n\tsecurity: {\n\t\trole: \"security\",\n\t\tloadoutRole: \"security\",\n\t\tloadoutName: \"security\",\n\t\tagentName: \"omk-security\",\n\t\tcontextInheritance: \"none\",\n\t\tevidenceGates: [\"plan-reread\", \"automated-verification\", \"adversarial-qa\", \"cleanup\"],\n\t\twritesProductFiles: false,\n\t},\n\t\"package-maintainer\": {\n\t\trole: \"package-maintainer\",\n\t\tloadoutRole: \"package-maintainer\",\n\t\tloadoutName: \"package-maintainer\",\n\t\tagentName: \"omk-package-maintainer\",\n\t\tcontextInheritance: \"bounded\",\n\t\tevidenceGates: [\"plan-reread\", \"automated-verification\", \"manual-qa\", \"adversarial-qa\", \"cleanup\"],\n\t\twritesProductFiles: true,\n\t},\n};\n\nconst REQUIRED_SPAWN_PLAN_STRING_FIELDS = [\n\t\"whyParallel\",\n\t\"whyNotLocal\",\n\t\"independence\",\n\t\"expectedReceiptShape\",\n] as const;\n\ninterface PreparedLane {\n\treadonly index: number;\n\treadonly spec: SubagentLaneSpec;\n\treadonly grant: SubagentLaneGrant;\n\treadonly dependsOn: readonly string[];\n}\n\nexport function resolveSubagentRoleAssignment(role: SubagentOrchestrationRole): SubagentRoleAssignment {\n\treturn ROLE_ASSIGNMENTS[role];\n}\n\nexport function buildSubagentOrchestrationPlan(input: BuildSubagentOrchestrationPlanInput): SubagentOrchestrationPlan {\n\tif (\n\t\tinput.maxParallelLanes !== undefined &&\n\t\t(!Number.isInteger(input.maxParallelLanes) || input.maxParallelLanes < 1)\n\t) {\n\t\tthrow new RangeError(\"maxParallelLanes must be a positive integer\");\n\t}\n\n\tconst blockers: string[] = [];\n\tconst warnings: string[] = [];\n\tblockers.push(...validateLaneIntake(input.lanes));\n\tconst spawnGate = evaluateSpawnGate({\n\t\tchildCount: input.lanes.length,\n\t\tplan: input.spawnPlan,\n\t\tthreshold: input.spawnThreshold ?? DEFAULT_SPAWN_THRESHOLD,\n\t});\n\tif (spawnGate.outcome === \"rejected\") blockers.push(spawnGate.reason);\n\n\tconst prepared = input.lanes.map((lane, index) =>\n\t\tprepareLane(lane, index, input.runId, input.inventory, input.spawnPlan, blockers, warnings),\n\t);\n\tblockers.push(...findDependencyBlockers(prepared));\n\n\tconst scheduledLanes = applyReceiptConsumerDependencies(prepared);\n\tconst batches = schedulePreparedLanes(scheduledLanes, input.maxParallelLanes, blockers);\n\tconst route = buildRouteFeatures(scheduledLanes, batches);\n\n\treturn {\n\t\tlaneGrants: scheduledLanes.map((lane) => lane.grant),\n\t\tbatches,\n\t\troute,\n\t\tspawnGate,\n\t\tblockers: uniqueSorted(blockers),\n\t\twarnings: uniqueSorted(warnings),\n\t};\n}\n\nexport function evaluateSpawnGate(request: {\n\treadonly childCount: number;\n\treadonly plan?: LaneSpawnReceipt;\n\treadonly threshold?: number;\n}): SpawnGateDecision {\n\tconst threshold = request.threshold ?? DEFAULT_SPAWN_THRESHOLD;\n\tif (!Number.isInteger(request.childCount) || request.childCount < 0) {\n\t\tthrow new RangeError(\"childCount must be a non-negative integer\");\n\t}\n\tif (!Number.isInteger(threshold) || threshold < 1) {\n\t\tthrow new RangeError(\"threshold must be a positive integer\");\n\t}\n\n\tconst planRequired = request.childCount > threshold;\n\tif (!planRequired) {\n\t\treturn {\n\t\t\toutcome: \"allowed\",\n\t\t\treason: `batch of ${request.childCount} is at or below threshold ${threshold}`,\n\t\t\tplanRequired: false,\n\t\t\tmissingFields: [],\n\t\t};\n\t}\n\n\tconst missingFields = findMissingSpawnPlanFields(request.plan);\n\tif (missingFields.length > 0) {\n\t\treturn {\n\t\t\toutcome: \"rejected\",\n\t\t\treason: `batch of ${request.childCount} exceeds threshold ${threshold} and the spawn-plan receipt is ${\n\t\t\t\trequest.plan ? `incomplete (${missingFields.join(\", \")})` : \"missing\"\n\t\t\t}`,\n\t\t\tplanRequired: true,\n\t\t\tmissingFields,\n\t\t};\n\t}\n\n\treturn {\n\t\toutcome: \"allowed\",\n\t\treason: `batch of ${request.childCount} exceeds threshold ${threshold} and a complete spawn-plan receipt was provided`,\n\t\tplanRequired: true,\n\t\tmissingFields: [],\n\t};\n}\n\nexport function findMissingSpawnPlanFields(plan: LaneSpawnReceipt | undefined): string[] {\n\tif (!plan) return [...REQUIRED_SPAWN_PLAN_STRING_FIELDS, \"maxInlineTokens\"];\n\tconst missing: string[] = [];\n\tfor (const field of REQUIRED_SPAWN_PLAN_STRING_FIELDS) {\n\t\tconst value = plan[field];\n\t\tif (value.trim().length === 0) missing.push(field);\n\t}\n\tif (!Number.isFinite(plan.maxInlineTokens) || plan.maxInlineTokens <= 0) {\n\t\tmissing.push(\"maxInlineTokens\");\n\t}\n\treturn missing;\n}\n\nfunction validateLaneIntake(lanes: readonly SubagentLaneSpec[]): string[] {\n\tconst blockers: string[] = [];\n\tconst seenIds = new Map<string, number>();\n\n\tfor (const [index, lane] of lanes.entries()) {\n\t\tconst id = lane.id.trim();\n\t\tconst label = id === \"\" ? `lane at index ${index}` : `lane ${id}`;\n\t\tif (id === \"\") {\n\t\t\tblockers.push(`lane at index ${index} has empty id`);\n\t\t} else {\n\t\t\tconst firstIndex = seenIds.get(id);\n\t\t\tif (firstIndex === undefined) {\n\t\t\t\tseenIds.set(id, index);\n\t\t\t} else {\n\t\t\t\tblockers.push(`duplicate lane id ${id} at indexes ${firstIndex} and ${index}`);\n\t\t\t}\n\t\t}\n\n\t\tif (lane.task.trim() === \"\") {\n\t\t\tblockers.push(`${label} has empty task`);\n\t\t}\n\n\t\tconst seenDependencies = new Set<string>();\n\t\tfor (const dependency of lane.dependsOn ?? []) {\n\t\t\tconst dependencyId = dependency.trim();\n\t\t\tif (dependencyId === \"\") {\n\t\t\t\tblockers.push(`${label} has empty dependency id`);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (dependencyId === id) {\n\t\t\t\tblockers.push(`${label} depends on itself`);\n\t\t\t}\n\t\t\tif (seenDependencies.has(dependencyId)) {\n\t\t\t\tblockers.push(`${label} repeats dependency ${dependencyId}`);\n\t\t\t}\n\t\t\tseenDependencies.add(dependencyId);\n\t\t}\n\t}\n\n\treturn blockers;\n}\n\nfunction prepareLane(\n\tspec: SubagentLaneSpec,\n\tindex: number,\n\trunId: string,\n\tinventory: CapabilityInventory,\n\tspawnReceipt: LaneSpawnReceipt | undefined,\n\tblockers: string[],\n\twarnings: string[],\n): PreparedLane {\n\tconst assignment = resolveSubagentRoleAssignment(spec.role);\n\tif ((spec.writeScope?.length ?? 0) > 0 && !assignment.writesProductFiles) {\n\t\tblockers.push(`lane ${spec.id} role ${spec.role} cannot write product files`);\n\t}\n\tconst dependsOn = uniqueSorted(spec.dependsOn ?? []);\n\n\tconst profile = resolveLoadoutProfile(spec, assignment, blockers);\n\tconst applied = applyLoadoutProfile(profile, inventory, { grantAuthority: spec.grantAuthority });\n\tblockers.push(...applied.blockers.map((blocker) => `lane ${spec.id}: ${blocker}`));\n\twarnings.push(...applied.warnings.map((warning) => `lane ${spec.id}: ${warning}`));\n\n\tconst schedulerFields = deriveSchedulerFields({\n\t\trole: assignment.loadoutRole,\n\t\tassignedReadPaths: spec.readScope,\n\t\tassignedWritePaths: spec.writeScope,\n\t});\n\n\tconst grant = buildSubagentLaneGrant(spec.id, assignment.loadoutRole, spec.task, applied, schedulerFields, {\n\t\tallowedReadPaths: spec.readScope,\n\t\tallowedWritePaths: spec.writeScope,\n\t\tblockedPaths: spec.blockedPaths,\n\t\tevidenceOutputPattern: spec.evidenceOutput ?? profile.evidence?.outputPattern,\n\t\trunId,\n\t\tprofile,\n\t\tagentName: spec.agentName ?? assignment.agentName,\n\t\tcontextInheritance: spec.contextInheritance ?? assignment.contextInheritance,\n\t\tspawnReceipt,\n\t\tevidenceGates: assignment.evidenceGates,\n\t\tdependsOn,\n\t\tacceptance: spec.acceptance,\n\t});\n\n\treturn { index, spec, grant, dependsOn };\n}\n\nfunction resolveLoadoutProfile(\n\tspec: SubagentLaneSpec,\n\tassignment: SubagentRoleAssignment,\n\tblockers: string[],\n): LoadoutProfile {\n\tconst loadoutName = spec.loadoutName ?? assignment.loadoutName;\n\tconst profile = BUILTIN_LOADOUTS[loadoutName];\n\tif (profile) return profile;\n\tblockers.push(`lane ${spec.id}: unknown loadout ${loadoutName}`);\n\treturn BUILTIN_LOADOUTS.none;\n}\n\nfunction findDependencyBlockers(lanes: readonly PreparedLane[]): string[] {\n\tconst ids = new Set(lanes.map((lane) => lane.spec.id));\n\tconst blockers: string[] = [];\n\tfor (const lane of lanes) {\n\t\tfor (const dependency of lane.dependsOn) {\n\t\t\tif (!ids.has(dependency)) {\n\t\t\t\tblockers.push(`lane ${lane.spec.id} depends on missing lane ${dependency}`);\n\t\t\t}\n\t\t}\n\t}\n\treturn blockers;\n}\n\nfunction applyReceiptConsumerDependencies(lanes: readonly PreparedLane[]): PreparedLane[] {\n\tconst receiptProducerIds = lanes\n\t\t.filter((lane) => lane.grant.evidenceOutput !== undefined && !isReceiptConsumerRole(lane.spec.role))\n\t\t.map((lane) => lane.spec.id);\n\n\treturn lanes.map((lane) => {\n\t\tif (!isReceiptReadingConsumer(lane) || receiptProducerIds.length === 0) return lane;\n\t\tconst dependsOn = uniqueSorted([\n\t\t\t...lane.dependsOn,\n\t\t\t...receiptProducerIds.filter((producerId) => producerId !== lane.spec.id),\n\t\t]);\n\t\tif (arrayEquals(dependsOn, lane.dependsOn)) return lane;\n\t\treturn {\n\t\t\t...lane,\n\t\t\tdependsOn,\n\t\t\tgrant: {\n\t\t\t\t...lane.grant,\n\t\t\t\tdependsOn,\n\t\t\t},\n\t\t};\n\t});\n}\n\nfunction isReceiptReadingConsumer(lane: PreparedLane): boolean {\n\tif (!isReceiptConsumerRole(lane.spec.role)) return false;\n\treturn (lane.spec.readScope ?? []).some(isReceiptPath);\n}\n\nfunction isReceiptConsumerRole(role: SubagentOrchestrationRole): boolean {\n\treturn role === \"critic\" || role === \"visual-qa\" || role === \"rhwp-doc\";\n}\n\nfunction isReceiptPath(path: string): boolean {\n\tconst normalized = normalizePath(path);\n\treturn normalized === \".omk/runs\" || normalized.startsWith(\".omk/runs/\") || normalized.includes(\"/.omk/runs/\");\n}\n\nfunction schedulePreparedLanes(\n\tlanes: readonly PreparedLane[],\n\tmaxParallelLanes: number | undefined,\n\tblockers: string[],\n): SubagentScheduleBatch[] {\n\tconst scheduled = new Set<string>();\n\tconst batches: SubagentScheduleBatch[] = [];\n\n\twhile (scheduled.size < lanes.length) {\n\t\tconst ready = lanes.filter(\n\t\t\t(lane) => !scheduled.has(lane.spec.id) && lane.dependsOn.every((dependency) => scheduled.has(dependency)),\n\t\t);\n\t\tif (ready.length === 0) {\n\t\t\tconst remaining = lanes.filter((lane) => !scheduled.has(lane.spec.id)).map((lane) => lane.spec.id);\n\t\t\tblockers.push(`lane dependency cycle or unsatisfied dependency among: ${remaining.join(\", \")}`);\n\t\t\tbreak;\n\t\t}\n\n\t\tconst serialized = ready.find((lane) => !lane.grant.scheduler.parallelizable);\n\t\tif (serialized) {\n\t\t\tbatches.push({\n\t\t\t\tindex: batches.length,\n\t\t\t\tlaneIds: [serialized.spec.id],\n\t\t\t\treason: \"serialized-writer\",\n\t\t\t});\n\t\t\tscheduled.add(serialized.spec.id);\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst selected: PreparedLane[] = [];\n\t\tfor (const lane of ready) {\n\t\t\tif (maxParallelLanes !== undefined && selected.length >= maxParallelLanes) break;\n\t\t\tif (!selected.some((selectedLane) => lanesConflict(selectedLane, lane))) {\n\t\t\t\tselected.push(lane);\n\t\t\t}\n\t\t}\n\t\tconst batchLanes = selected.length > 0 ? selected : [ready[0]];\n\t\tfor (const lane of batchLanes) scheduled.add(lane.spec.id);\n\t\tbatches.push({\n\t\t\tindex: batches.length,\n\t\t\tlaneIds: batchLanes.map((lane) => lane.spec.id),\n\t\t\treason:\n\t\t\t\tmaxParallelLanes !== undefined && ready.length > batchLanes.length ? \"parallel-limit\" : \"ready-parallel\",\n\t\t});\n\t}\n\n\treturn batches;\n}\n\nfunction lanesConflict(left: PreparedLane, right: PreparedLane): boolean {\n\treturn (\n\t\tpathsConflict(\n\t\t\tleft.grant.scheduler.writeSet.map((entry) => entry.path),\n\t\t\t[\n\t\t\t\t...right.grant.scheduler.readSet.map((entry) => entry.path),\n\t\t\t\t...right.grant.scheduler.writeSet.map((entry) => entry.path),\n\t\t\t],\n\t\t) ||\n\t\tpathsConflict(\n\t\t\tright.grant.scheduler.writeSet.map((entry) => entry.path),\n\t\t\t[\n\t\t\t\t...left.grant.scheduler.readSet.map((entry) => entry.path),\n\t\t\t\t...left.grant.scheduler.writeSet.map((entry) => entry.path),\n\t\t\t],\n\t\t)\n\t);\n}\n\nfunction pathsConflict(writers: readonly string[], candidates: readonly string[]): boolean {\n\tfor (const writer of writers) {\n\t\tfor (const candidate of candidates) {\n\t\t\tif (pathIntersects(writer, candidate)) return true;\n\t\t}\n\t}\n\treturn false;\n}\n\nfunction pathIntersects(left: string, right: string): boolean {\n\tconst normalizedLeft = normalizePath(left);\n\tconst normalizedRight = normalizePath(right);\n\treturn (\n\t\tnormalizedLeft === normalizedRight ||\n\t\tnormalizedLeft.startsWith(`${normalizedRight}/`) ||\n\t\tnormalizedRight.startsWith(`${normalizedLeft}/`)\n\t);\n}\n\nfunction buildRouteFeatures(\n\tlanes: readonly PreparedLane[],\n\tbatches: readonly SubagentScheduleBatch[],\n): SubagentRouteFeatures {\n\tconst nodeCount = lanes.length;\n\tconst edgeCount = lanes.reduce((sum, lane) => sum + lane.dependsOn.length, 0);\n\tconst width = batches.reduce((max, batch) => Math.max(max, batch.laneIds.length), 0);\n\tconst criticalDepth = batches.length;\n\tconst parallelizable = lanes.filter((lane) => lane.grant.scheduler.parallelizable).length;\n\tconst parallelRatio = nodeCount === 0 ? 1 : parallelizable / nodeCount;\n\tconst couplingDensity = nodeCount <= 1 ? 0 : edgeCount / (nodeCount * (nodeCount - 1));\n\tconst topology = selectTopology(lanes, batches, width, criticalDepth, edgeCount);\n\n\treturn {\n\t\ttopology,\n\t\twidth,\n\t\tcriticalDepth,\n\t\tcouplingDensity: round(couplingDensity),\n\t\tparallelRatio: round(parallelRatio),\n\t\tnodeCount,\n\t\tedgeCount,\n\t};\n}\n\nfunction selectTopology(\n\tlanes: readonly PreparedLane[],\n\tbatches: readonly SubagentScheduleBatch[],\n\twidth: number,\n\tcriticalDepth: number,\n\tedgeCount: number,\n): SubagentSchedulerTopology {\n\tif (lanes.length <= 1 || width <= 1) return \"serial\";\n\tif (edgeCount === 0 && criticalDepth === 1) return \"parallel\";\n\tif (isMapReduceShape(lanes, batches)) return \"map-reduce\";\n\treturn \"hybrid\";\n}\n\nfunction isMapReduceShape(lanes: readonly PreparedLane[], batches: readonly SubagentScheduleBatch[]): boolean {\n\tif (batches.length < 2) return false;\n\tconst firstBatch = batches[0];\n\tconst finalBatch = batches[batches.length - 1];\n\tif (firstBatch.laneIds.length < 2 || finalBatch.laneIds.length !== 1) return false;\n\tconst finalLane = lanes.find((lane) => lane.spec.id === finalBatch.laneIds[0]);\n\tif (!finalLane) return false;\n\treturn firstBatch.laneIds.every((laneId) => finalLane.dependsOn.includes(laneId));\n}\n\nfunction normalizePath(path: string): string {\n\treturn path.replaceAll(\"\\\\\", \"/\").replace(/\\/+$/g, \"\");\n}\n\nfunction round(value: number): number {\n\treturn Math.round(value * 1000) / 1000;\n}\n\nfunction uniqueSorted(values: readonly string[]): string[] {\n\treturn [...new Set(values)]\n\t\t.map((value) => value.trim())\n\t\t.filter((value) => value !== \"\")\n\t\t.sort();\n}\n\nfunction arrayEquals(left: readonly string[], right: readonly string[]): boolean {\n\treturn left.length === right.length && left.every((value, index) => value === right[index]);\n}\n"]}