@a5c-ai/agent-platform 5.0.1-staging.016f0b0e8119

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 (545) hide show
  1. package/README.md +48 -0
  2. package/dist/anycli/cache.d.ts +45 -0
  3. package/dist/anycli/cache.d.ts.map +1 -0
  4. package/dist/anycli/cache.js +118 -0
  5. package/dist/anycli/index.d.ts +10 -0
  6. package/dist/anycli/index.d.ts.map +1 -0
  7. package/dist/anycli/index.js +25 -0
  8. package/dist/anycli/types.d.ts +32 -0
  9. package/dist/anycli/types.d.ts.map +1 -0
  10. package/dist/anycli/types.js +9 -0
  11. package/dist/api/breakpoints.d.ts +93 -0
  12. package/dist/api/breakpoints.d.ts.map +1 -0
  13. package/dist/api/breakpoints.js +334 -0
  14. package/dist/api/effects.d.ts +14 -0
  15. package/dist/api/effects.d.ts.map +1 -0
  16. package/dist/api/effects.js +306 -0
  17. package/dist/api/effectsTypes.d.ts +79 -0
  18. package/dist/api/effectsTypes.d.ts.map +1 -0
  19. package/dist/api/effectsTypes.js +6 -0
  20. package/dist/api/eventStream.d.ts +34 -0
  21. package/dist/api/eventStream.d.ts.map +1 -0
  22. package/dist/api/eventStream.js +126 -0
  23. package/dist/api/index.d.ts +10 -0
  24. package/dist/api/index.d.ts.map +1 -0
  25. package/dist/api/index.js +27 -0
  26. package/dist/api/runs.d.ts +85 -0
  27. package/dist/api/runs.d.ts.map +1 -0
  28. package/dist/api/runs.js +247 -0
  29. package/dist/api/utils.d.ts +28 -0
  30. package/dist/api/utils.d.ts.map +1 -0
  31. package/dist/api/utils.js +74 -0
  32. package/dist/breakpoints/approvalChains.d.ts +68 -0
  33. package/dist/breakpoints/approvalChains.d.ts.map +1 -0
  34. package/dist/breakpoints/approvalChains.js +111 -0
  35. package/dist/breakpoints/delegation.d.ts +42 -0
  36. package/dist/breakpoints/delegation.d.ts.map +1 -0
  37. package/dist/breakpoints/delegation.js +199 -0
  38. package/dist/breakpoints/delegationTypes.d.ts +46 -0
  39. package/dist/breakpoints/delegationTypes.d.ts.map +1 -0
  40. package/dist/breakpoints/delegationTypes.js +10 -0
  41. package/dist/breakpoints/postures.d.ts +28 -0
  42. package/dist/breakpoints/postures.d.ts.map +1 -0
  43. package/dist/breakpoints/postures.js +100 -0
  44. package/dist/compression/compaction.d.ts +82 -0
  45. package/dist/compression/compaction.d.ts.map +1 -0
  46. package/dist/compression/compaction.js +310 -0
  47. package/dist/cost/claudeCodeParser.d.ts +81 -0
  48. package/dist/cost/claudeCodeParser.d.ts.map +1 -0
  49. package/dist/cost/claudeCodeParser.js +232 -0
  50. package/dist/cost/collector.d.ts +42 -0
  51. package/dist/cost/collector.d.ts.map +1 -0
  52. package/dist/cost/collector.js +105 -0
  53. package/dist/cost/effectCost.d.ts +23 -0
  54. package/dist/cost/effectCost.d.ts.map +1 -0
  55. package/dist/cost/effectCost.js +26 -0
  56. package/dist/cost/index.d.ts +7 -0
  57. package/dist/cost/index.d.ts.map +1 -0
  58. package/dist/cost/index.js +28 -0
  59. package/dist/cost/journal.d.ts +40 -0
  60. package/dist/cost/journal.d.ts.map +1 -0
  61. package/dist/cost/journal.js +137 -0
  62. package/dist/cost/types.d.ts +164 -0
  63. package/dist/cost/types.d.ts.map +1 -0
  64. package/dist/cost/types.js +228 -0
  65. package/dist/daemon/automationExecutor.d.ts +16 -0
  66. package/dist/daemon/automationExecutor.d.ts.map +1 -0
  67. package/dist/daemon/automationExecutor.js +222 -0
  68. package/dist/daemon/config.d.ts +8 -0
  69. package/dist/daemon/config.d.ts.map +1 -0
  70. package/dist/daemon/config.js +209 -0
  71. package/dist/daemon/daemonLog.d.ts +13 -0
  72. package/dist/daemon/daemonLog.d.ts.map +1 -0
  73. package/dist/daemon/daemonLog.js +64 -0
  74. package/dist/daemon/fileWatcher.d.ts +9 -0
  75. package/dist/daemon/fileWatcher.d.ts.map +1 -0
  76. package/dist/daemon/fileWatcher.js +141 -0
  77. package/dist/daemon/index.d.ts +9 -0
  78. package/dist/daemon/index.d.ts.map +1 -0
  79. package/dist/daemon/index.js +25 -0
  80. package/dist/daemon/lifecycle.d.ts +12 -0
  81. package/dist/daemon/lifecycle.d.ts.map +1 -0
  82. package/dist/daemon/lifecycle.js +257 -0
  83. package/dist/daemon/loop.d.ts +21 -0
  84. package/dist/daemon/loop.d.ts.map +1 -0
  85. package/dist/daemon/loop.js +196 -0
  86. package/dist/daemon/timerScheduler.d.ts +13 -0
  87. package/dist/daemon/timerScheduler.d.ts.map +1 -0
  88. package/dist/daemon/timerScheduler.js +122 -0
  89. package/dist/daemon/types.d.ts +93 -0
  90. package/dist/daemon/types.d.ts.map +1 -0
  91. package/dist/daemon/types.js +25 -0
  92. package/dist/daemon/webhookListener.d.ts +6 -0
  93. package/dist/daemon/webhookListener.d.ts.map +1 -0
  94. package/dist/daemon/webhookListener.js +110 -0
  95. package/dist/governance/authority.d.ts +68 -0
  96. package/dist/governance/authority.d.ts.map +1 -0
  97. package/dist/governance/authority.js +136 -0
  98. package/dist/governance/bridge.d.ts +17 -0
  99. package/dist/governance/bridge.d.ts.map +1 -0
  100. package/dist/governance/bridge.js +46 -0
  101. package/dist/governance/builtins.d.ts +25 -0
  102. package/dist/governance/builtins.d.ts.map +1 -0
  103. package/dist/governance/builtins.js +67 -0
  104. package/dist/governance/categories.d.ts +58 -0
  105. package/dist/governance/categories.d.ts.map +1 -0
  106. package/dist/governance/categories.js +120 -0
  107. package/dist/governance/decisionTrail.d.ts +60 -0
  108. package/dist/governance/decisionTrail.d.ts.map +1 -0
  109. package/dist/governance/decisionTrail.js +68 -0
  110. package/dist/governance/engine.d.ts +20 -0
  111. package/dist/governance/engine.d.ts.map +1 -0
  112. package/dist/governance/engine.js +124 -0
  113. package/dist/governance/index.d.ts +20 -0
  114. package/dist/governance/index.d.ts.map +1 -0
  115. package/dist/governance/index.js +75 -0
  116. package/dist/governance/logging.d.ts +18 -0
  117. package/dist/governance/logging.d.ts.map +1 -0
  118. package/dist/governance/logging.js +83 -0
  119. package/dist/governance/mandate.d.ts +83 -0
  120. package/dist/governance/mandate.d.ts.map +1 -0
  121. package/dist/governance/mandate.js +180 -0
  122. package/dist/governance/permissionEvents.d.ts +51 -0
  123. package/dist/governance/permissionEvents.d.ts.map +1 -0
  124. package/dist/governance/permissionEvents.js +52 -0
  125. package/dist/governance/permissionPropagation.d.ts +18 -0
  126. package/dist/governance/permissionPropagation.d.ts.map +1 -0
  127. package/dist/governance/permissionPropagation.js +58 -0
  128. package/dist/governance/postureBridge.d.ts +17 -0
  129. package/dist/governance/postureBridge.d.ts.map +1 -0
  130. package/dist/governance/postureBridge.js +117 -0
  131. package/dist/governance/sandboxBridge.d.ts +49 -0
  132. package/dist/governance/sandboxBridge.d.ts.map +1 -0
  133. package/dist/governance/sandboxBridge.js +77 -0
  134. package/dist/governance/sandboxPolicy.d.ts +51 -0
  135. package/dist/governance/sandboxPolicy.d.ts.map +1 -0
  136. package/dist/governance/sandboxPolicy.js +177 -0
  137. package/dist/governance/types.d.ts +3 -0
  138. package/dist/governance/types.d.ts.map +1 -0
  139. package/dist/governance/types.js +5 -0
  140. package/dist/harness/amux/amuxBridge.d.ts +71 -0
  141. package/dist/harness/amux/amuxBridge.d.ts.map +1 -0
  142. package/dist/harness/amux/amuxBridge.js +117 -0
  143. package/dist/harness/amux/amuxClientFactory.d.ts +29 -0
  144. package/dist/harness/amux/amuxClientFactory.d.ts.map +1 -0
  145. package/dist/harness/amux/amuxClientFactory.js +90 -0
  146. package/dist/harness/amux/amuxEventEmitter.d.ts +51 -0
  147. package/dist/harness/amux/amuxEventEmitter.d.ts.map +1 -0
  148. package/dist/harness/amux/amuxEventEmitter.js +143 -0
  149. package/dist/harness/amux/amuxEventMapper.d.ts +58 -0
  150. package/dist/harness/amux/amuxEventMapper.d.ts.map +1 -0
  151. package/dist/harness/amux/amuxEventMapper.js +92 -0
  152. package/dist/harness/amux/amuxHarnessMap.d.ts +25 -0
  153. package/dist/harness/amux/amuxHarnessMap.d.ts.map +1 -0
  154. package/dist/harness/amux/amuxHarnessMap.js +55 -0
  155. package/dist/harness/amux/amuxStdinReader.d.ts +45 -0
  156. package/dist/harness/amux/amuxStdinReader.d.ts.map +1 -0
  157. package/dist/harness/amux/amuxStdinReader.js +106 -0
  158. package/dist/harness/amux/amuxTypes.d.ts +122 -0
  159. package/dist/harness/amux/amuxTypes.d.ts.map +1 -0
  160. package/dist/harness/amux/amuxTypes.js +11 -0
  161. package/dist/harness/amux/index.d.ts +17 -0
  162. package/dist/harness/amux/index.d.ts.map +1 -0
  163. package/dist/harness/amux/index.js +34 -0
  164. package/dist/harness/backgroundTracker.d.ts +64 -0
  165. package/dist/harness/backgroundTracker.d.ts.map +1 -0
  166. package/dist/harness/backgroundTracker.js +107 -0
  167. package/dist/harness/builtInHarness.d.ts +3 -0
  168. package/dist/harness/builtInHarness.d.ts.map +1 -0
  169. package/dist/harness/builtInHarness.js +18 -0
  170. package/dist/harness/capabilityRouter.d.ts +76 -0
  171. package/dist/harness/capabilityRouter.d.ts.map +1 -0
  172. package/dist/harness/capabilityRouter.js +176 -0
  173. package/dist/harness/fallbackChains.d.ts +42 -0
  174. package/dist/harness/fallbackChains.d.ts.map +1 -0
  175. package/dist/harness/fallbackChains.js +69 -0
  176. package/dist/harness/hostContract.d.ts +63 -0
  177. package/dist/harness/hostContract.d.ts.map +1 -0
  178. package/dist/harness/hostContract.js +136 -0
  179. package/dist/harness/index.d.ts +18 -0
  180. package/dist/harness/index.d.ts.map +1 -0
  181. package/dist/harness/index.js +91 -0
  182. package/dist/harness/internal/createRun/askUserQuestion.d.ts +11 -0
  183. package/dist/harness/internal/createRun/askUserQuestion.d.ts.map +1 -0
  184. package/dist/harness/internal/createRun/askUserQuestion.js +162 -0
  185. package/dist/harness/internal/createRun/index.d.ts +25 -0
  186. package/dist/harness/internal/createRun/index.d.ts.map +1 -0
  187. package/dist/harness/internal/createRun/index.js +137 -0
  188. package/dist/harness/internal/createRun/orchestration/constants.d.ts +7 -0
  189. package/dist/harness/internal/createRun/orchestration/constants.d.ts.map +1 -0
  190. package/dist/harness/internal/createRun/orchestration/constants.js +13 -0
  191. package/dist/harness/internal/createRun/orchestration/effects.d.ts +43 -0
  192. package/dist/harness/internal/createRun/orchestration/effects.d.ts.map +1 -0
  193. package/dist/harness/internal/createRun/orchestration/effects.js +490 -0
  194. package/dist/harness/internal/createRun/orchestration/effectsHelpers.d.ts +20 -0
  195. package/dist/harness/internal/createRun/orchestration/effectsHelpers.d.ts.map +1 -0
  196. package/dist/harness/internal/createRun/orchestration/effectsHelpers.js +79 -0
  197. package/dist/harness/internal/createRun/orchestration/externalPhase.d.ts +3 -0
  198. package/dist/harness/internal/createRun/orchestration/externalPhase.d.ts.map +1 -0
  199. package/dist/harness/internal/createRun/orchestration/externalPhase.js +319 -0
  200. package/dist/harness/internal/createRun/orchestration/externalPhaseHelpers.d.ts +16 -0
  201. package/dist/harness/internal/createRun/orchestration/externalPhaseHelpers.d.ts.map +1 -0
  202. package/dist/harness/internal/createRun/orchestration/externalPhaseHelpers.js +104 -0
  203. package/dist/harness/internal/createRun/orchestration/index.d.ts +14 -0
  204. package/dist/harness/internal/createRun/orchestration/index.d.ts.map +1 -0
  205. package/dist/harness/internal/createRun/orchestration/index.js +36 -0
  206. package/dist/harness/internal/createRun/orchestration/internalPhase.d.ts +3 -0
  207. package/dist/harness/internal/createRun/orchestration/internalPhase.d.ts.map +1 -0
  208. package/dist/harness/internal/createRun/orchestration/internalPhase.js +464 -0
  209. package/dist/harness/internal/createRun/orchestration/internalTools.d.ts +26 -0
  210. package/dist/harness/internal/createRun/orchestration/internalTools.d.ts.map +1 -0
  211. package/dist/harness/internal/createRun/orchestration/internalTools.js +262 -0
  212. package/dist/harness/internal/createRun/orchestration/internalToolsHelpers.d.ts +17 -0
  213. package/dist/harness/internal/createRun/orchestration/internalToolsHelpers.d.ts.map +1 -0
  214. package/dist/harness/internal/createRun/orchestration/internalToolsHelpers.js +23 -0
  215. package/dist/harness/internal/createRun/orchestration/taskResult.d.ts +10 -0
  216. package/dist/harness/internal/createRun/orchestration/taskResult.d.ts.map +1 -0
  217. package/dist/harness/internal/createRun/orchestration/taskResult.js +67 -0
  218. package/dist/harness/internal/createRun/orchestration/types.d.ts +46 -0
  219. package/dist/harness/internal/createRun/orchestration/types.d.ts.map +1 -0
  220. package/dist/harness/internal/createRun/orchestration/types.js +2 -0
  221. package/dist/harness/internal/createRun/orchestration/verbose.d.ts +7 -0
  222. package/dist/harness/internal/createRun/orchestration/verbose.d.ts.map +1 -0
  223. package/dist/harness/internal/createRun/orchestration/verbose.js +240 -0
  224. package/dist/harness/internal/createRun/output.d.ts +38 -0
  225. package/dist/harness/internal/createRun/output.d.ts.map +1 -0
  226. package/dist/harness/internal/createRun/output.js +415 -0
  227. package/dist/harness/internal/createRun/pi.d.ts +34 -0
  228. package/dist/harness/internal/createRun/pi.d.ts.map +1 -0
  229. package/dist/harness/internal/createRun/pi.js +216 -0
  230. package/dist/harness/internal/createRun/planProcess/agentOutput.d.ts +5 -0
  231. package/dist/harness/internal/createRun/planProcess/agentOutput.d.ts.map +1 -0
  232. package/dist/harness/internal/createRun/planProcess/agentOutput.js +113 -0
  233. package/dist/harness/internal/createRun/planProcess/delegation.d.ts +23 -0
  234. package/dist/harness/internal/createRun/planProcess/delegation.d.ts.map +1 -0
  235. package/dist/harness/internal/createRun/planProcess/delegation.js +176 -0
  236. package/dist/harness/internal/createRun/planProcess/external.d.ts +14 -0
  237. package/dist/harness/internal/createRun/planProcess/external.d.ts.map +1 -0
  238. package/dist/harness/internal/createRun/planProcess/external.js +139 -0
  239. package/dist/harness/internal/createRun/planProcess/index.d.ts +12 -0
  240. package/dist/harness/internal/createRun/planProcess/index.d.ts.map +1 -0
  241. package/dist/harness/internal/createRun/planProcess/index.js +24 -0
  242. package/dist/harness/internal/createRun/planProcess/paths.d.ts +7 -0
  243. package/dist/harness/internal/createRun/planProcess/paths.d.ts.map +1 -0
  244. package/dist/harness/internal/createRun/planProcess/paths.js +98 -0
  245. package/dist/harness/internal/createRun/planProcess/phase.d.ts +6 -0
  246. package/dist/harness/internal/createRun/planProcess/phase.d.ts.map +1 -0
  247. package/dist/harness/internal/createRun/planProcess/phase.js +361 -0
  248. package/dist/harness/internal/createRun/planProcess/phaseHelpers.d.ts +37 -0
  249. package/dist/harness/internal/createRun/planProcess/phaseHelpers.d.ts.map +1 -0
  250. package/dist/harness/internal/createRun/planProcess/phaseHelpers.js +159 -0
  251. package/dist/harness/internal/createRun/planProcess/phaseTypes.d.ts +25 -0
  252. package/dist/harness/internal/createRun/planProcess/phaseTypes.d.ts.map +1 -0
  253. package/dist/harness/internal/createRun/planProcess/phaseTypes.js +6 -0
  254. package/dist/harness/internal/createRun/planProcess/prompts.d.ts +20 -0
  255. package/dist/harness/internal/createRun/planProcess/prompts.d.ts.map +1 -0
  256. package/dist/harness/internal/createRun/planProcess/prompts.js +208 -0
  257. package/dist/harness/internal/createRun/planProcess/recovery.d.ts +18 -0
  258. package/dist/harness/internal/createRun/planProcess/recovery.d.ts.map +1 -0
  259. package/dist/harness/internal/createRun/planProcess/recovery.js +188 -0
  260. package/dist/harness/internal/createRun/planProcess/recovery.test.d.ts +2 -0
  261. package/dist/harness/internal/createRun/planProcess/recovery.test.d.ts.map +1 -0
  262. package/dist/harness/internal/createRun/planProcess/recovery.test.js +68 -0
  263. package/dist/harness/internal/createRun/planProcess/runState.d.ts +40 -0
  264. package/dist/harness/internal/createRun/planProcess/runState.d.ts.map +1 -0
  265. package/dist/harness/internal/createRun/planProcess/runState.js +179 -0
  266. package/dist/harness/internal/createRun/planProcess/understandIntent.d.ts +22 -0
  267. package/dist/harness/internal/createRun/planProcess/understandIntent.d.ts.map +1 -0
  268. package/dist/harness/internal/createRun/planProcess/understandIntent.js +65 -0
  269. package/dist/harness/internal/createRun/planProcess/validation.d.ts +2 -0
  270. package/dist/harness/internal/createRun/planProcess/validation.d.ts.map +1 -0
  271. package/dist/harness/internal/createRun/planProcess/validation.js +212 -0
  272. package/dist/harness/internal/createRun/planProcess/validationSource.d.ts +11 -0
  273. package/dist/harness/internal/createRun/planProcess/validationSource.d.ts.map +1 -0
  274. package/dist/harness/internal/createRun/planProcess/validationSource.js +328 -0
  275. package/dist/harness/internal/createRun/planProcess/validationText.d.ts +3 -0
  276. package/dist/harness/internal/createRun/planProcess/validationText.d.ts.map +1 -0
  277. package/dist/harness/internal/createRun/planProcess/validationText.js +145 -0
  278. package/dist/harness/internal/createRun/prompts.d.ts +49 -0
  279. package/dist/harness/internal/createRun/prompts.d.ts.map +1 -0
  280. package/dist/harness/internal/createRun/prompts.js +307 -0
  281. package/dist/harness/internal/createRun/resumeState.d.ts +28 -0
  282. package/dist/harness/internal/createRun/resumeState.d.ts.map +1 -0
  283. package/dist/harness/internal/createRun/resumeState.js +133 -0
  284. package/dist/harness/internal/createRun/utils.d.ts +182 -0
  285. package/dist/harness/internal/createRun/utils.d.ts.map +1 -0
  286. package/dist/harness/internal/createRun/utils.js +133 -0
  287. package/dist/harness/internal.d.ts +13 -0
  288. package/dist/harness/internal.d.ts.map +1 -0
  289. package/dist/harness/internal.js +149 -0
  290. package/dist/harness/invoker/launch.d.ts +20 -0
  291. package/dist/harness/invoker/launch.d.ts.map +1 -0
  292. package/dist/harness/invoker/launch.js +23 -0
  293. package/dist/harness/invoker/processControl.d.ts +11 -0
  294. package/dist/harness/invoker/processControl.d.ts.map +1 -0
  295. package/dist/harness/invoker/processControl.js +50 -0
  296. package/dist/harness/invoker.d.ts +43 -0
  297. package/dist/harness/invoker.d.ts.map +1 -0
  298. package/dist/harness/invoker.js +210 -0
  299. package/dist/harness/modeSelector.d.ts +50 -0
  300. package/dist/harness/modeSelector.d.ts.map +1 -0
  301. package/dist/harness/modeSelector.js +124 -0
  302. package/dist/harness/modelSelection.d.ts +37 -0
  303. package/dist/harness/modelSelection.d.ts.map +1 -0
  304. package/dist/harness/modelSelection.js +81 -0
  305. package/dist/harness/operatorCommands.d.ts +38 -0
  306. package/dist/harness/operatorCommands.d.ts.map +1 -0
  307. package/dist/harness/operatorCommands.js +118 -0
  308. package/dist/harness/piSecureSandbox.d.ts +8 -0
  309. package/dist/harness/piSecureSandbox.d.ts.map +1 -0
  310. package/dist/harness/piSecureSandbox.js +366 -0
  311. package/dist/harness/piSecureSandboxTypes.d.ts +51 -0
  312. package/dist/harness/piSecureSandboxTypes.d.ts.map +1 -0
  313. package/dist/harness/piSecureSandboxTypes.js +6 -0
  314. package/dist/harness/piWrapper/compaction.d.ts +13 -0
  315. package/dist/harness/piWrapper/compaction.d.ts.map +1 -0
  316. package/dist/harness/piWrapper/compaction.js +38 -0
  317. package/dist/harness/piWrapper/instructionPrompts.d.ts +2 -0
  318. package/dist/harness/piWrapper/instructionPrompts.d.ts.map +1 -0
  319. package/dist/harness/piWrapper/instructionPrompts.js +97 -0
  320. package/dist/harness/piWrapper/moduleSupport.d.ts +77 -0
  321. package/dist/harness/piWrapper/moduleSupport.d.ts.map +1 -0
  322. package/dist/harness/piWrapper/moduleSupport.js +204 -0
  323. package/dist/harness/piWrapper.d.ts +80 -0
  324. package/dist/harness/piWrapper.d.ts.map +1 -0
  325. package/dist/harness/piWrapper.js +389 -0
  326. package/dist/harness/piWrapper.test.d.ts +2 -0
  327. package/dist/harness/piWrapper.test.d.ts.map +1 -0
  328. package/dist/harness/piWrapper.test.js +193 -0
  329. package/dist/harness/planMode.d.ts +68 -0
  330. package/dist/harness/planMode.d.ts.map +1 -0
  331. package/dist/harness/planMode.js +145 -0
  332. package/dist/harness/selectionPolicies.d.ts +29 -0
  333. package/dist/harness/selectionPolicies.d.ts.map +1 -0
  334. package/dist/harness/selectionPolicies.js +165 -0
  335. package/dist/harness/types.d.ts +266 -0
  336. package/dist/harness/types.d.ts.map +1 -0
  337. package/dist/harness/types.js +34 -0
  338. package/dist/index.d.ts +16 -0
  339. package/dist/index.d.ts.map +1 -0
  340. package/dist/index.js +54 -0
  341. package/dist/interaction/askUserQuestion/core.d.ts +8 -0
  342. package/dist/interaction/askUserQuestion/core.d.ts.map +1 -0
  343. package/dist/interaction/askUserQuestion/core.js +112 -0
  344. package/dist/interaction/askUserQuestion/terminal.d.ts +15 -0
  345. package/dist/interaction/askUserQuestion/terminal.d.ts.map +1 -0
  346. package/dist/interaction/askUserQuestion/terminal.js +128 -0
  347. package/dist/interaction/askUserQuestion.d.ts +10 -0
  348. package/dist/interaction/askUserQuestion.d.ts.map +1 -0
  349. package/dist/interaction/askUserQuestion.js +295 -0
  350. package/dist/interaction/askUserQuestionTypes.d.ts +31 -0
  351. package/dist/interaction/askUserQuestionTypes.d.ts.map +1 -0
  352. package/dist/interaction/askUserQuestionTypes.js +6 -0
  353. package/dist/interaction/index.d.ts +4 -0
  354. package/dist/interaction/index.d.ts.map +1 -0
  355. package/dist/interaction/index.js +20 -0
  356. package/dist/interaction/interactionRouter.d.ts +25 -0
  357. package/dist/interaction/interactionRouter.d.ts.map +1 -0
  358. package/dist/interaction/interactionRouter.js +55 -0
  359. package/dist/mcp/channels/allowlist.d.ts +19 -0
  360. package/dist/mcp/channels/allowlist.d.ts.map +1 -0
  361. package/dist/mcp/channels/allowlist.js +140 -0
  362. package/dist/mcp/channels/channelManager.d.ts +64 -0
  363. package/dist/mcp/channels/channelManager.d.ts.map +1 -0
  364. package/dist/mcp/channels/channelManager.js +137 -0
  365. package/dist/mcp/channels/inboundQueue.d.ts +47 -0
  366. package/dist/mcp/channels/inboundQueue.d.ts.map +1 -0
  367. package/dist/mcp/channels/inboundQueue.js +96 -0
  368. package/dist/mcp/channels/index.d.ts +17 -0
  369. package/dist/mcp/channels/index.d.ts.map +1 -0
  370. package/dist/mcp/channels/index.js +39 -0
  371. package/dist/mcp/channels/outbound.d.ts +33 -0
  372. package/dist/mcp/channels/outbound.d.ts.map +1 -0
  373. package/dist/mcp/channels/outbound.js +94 -0
  374. package/dist/mcp/channels/permissionRelay.d.ts +62 -0
  375. package/dist/mcp/channels/permissionRelay.d.ts.map +1 -0
  376. package/dist/mcp/channels/permissionRelay.js +159 -0
  377. package/dist/mcp/channels/types.d.ts +135 -0
  378. package/dist/mcp/channels/types.d.ts.map +1 -0
  379. package/dist/mcp/channels/types.js +16 -0
  380. package/dist/mcp/client/config.d.ts +28 -0
  381. package/dist/mcp/client/config.d.ts.map +1 -0
  382. package/dist/mcp/client/config.js +142 -0
  383. package/dist/mcp/client/executor.d.ts +30 -0
  384. package/dist/mcp/client/executor.d.ts.map +1 -0
  385. package/dist/mcp/client/executor.js +60 -0
  386. package/dist/mcp/client/index.d.ts +12 -0
  387. package/dist/mcp/client/index.d.ts.map +1 -0
  388. package/dist/mcp/client/index.js +27 -0
  389. package/dist/mcp/client/manager.d.ts +74 -0
  390. package/dist/mcp/client/manager.d.ts.map +1 -0
  391. package/dist/mcp/client/manager.js +214 -0
  392. package/dist/mcp/client/toolRegistry.d.ts +50 -0
  393. package/dist/mcp/client/toolRegistry.d.ts.map +1 -0
  394. package/dist/mcp/client/toolRegistry.js +118 -0
  395. package/dist/mcp/client/types.d.ts +96 -0
  396. package/dist/mcp/client/types.d.ts.map +1 -0
  397. package/dist/mcp/client/types.js +15 -0
  398. package/dist/mcp/transport/index.d.ts +9 -0
  399. package/dist/mcp/transport/index.d.ts.map +1 -0
  400. package/dist/mcp/transport/index.js +13 -0
  401. package/dist/mcp/transport/session.d.ts +18 -0
  402. package/dist/mcp/transport/session.d.ts.map +1 -0
  403. package/dist/mcp/transport/session.js +78 -0
  404. package/dist/mcp/transport/types.d.ts +19 -0
  405. package/dist/mcp/transport/types.d.ts.map +1 -0
  406. package/dist/mcp/transport/types.js +7 -0
  407. package/dist/mcp/transport/websocket.d.ts +41 -0
  408. package/dist/mcp/transport/websocket.d.ts.map +1 -0
  409. package/dist/mcp/transport/websocket.js +271 -0
  410. package/dist/observability/health.d.ts +19 -0
  411. package/dist/observability/health.d.ts.map +1 -0
  412. package/dist/observability/health.js +129 -0
  413. package/dist/observability/index.d.ts +7 -0
  414. package/dist/observability/index.d.ts.map +1 -0
  415. package/dist/observability/index.js +22 -0
  416. package/dist/observability/runStatus.d.ts +44 -0
  417. package/dist/observability/runStatus.d.ts.map +1 -0
  418. package/dist/observability/runStatus.js +169 -0
  419. package/dist/observability/timeline.d.ts +11 -0
  420. package/dist/observability/timeline.d.ts.map +1 -0
  421. package/dist/observability/timeline.js +176 -0
  422. package/dist/observability/types.d.ts +62 -0
  423. package/dist/observability/types.d.ts.map +1 -0
  424. package/dist/observability/types.js +8 -0
  425. package/dist/observability/webhooks.d.ts +68 -0
  426. package/dist/observability/webhooks.d.ts.map +1 -0
  427. package/dist/observability/webhooks.js +132 -0
  428. package/dist/plugins/index.d.ts +11 -0
  429. package/dist/plugins/index.d.ts.map +1 -0
  430. package/dist/plugins/index.js +18 -0
  431. package/dist/plugins/loader.d.ts +37 -0
  432. package/dist/plugins/loader.d.ts.map +1 -0
  433. package/dist/plugins/loader.js +112 -0
  434. package/dist/plugins/sandbox.d.ts +38 -0
  435. package/dist/plugins/sandbox.d.ts.map +1 -0
  436. package/dist/plugins/sandbox.js +109 -0
  437. package/dist/plugins/types.d.ts +27 -0
  438. package/dist/plugins/types.d.ts.map +1 -0
  439. package/dist/plugins/types.js +7 -0
  440. package/dist/plugins/version-check.d.ts +23 -0
  441. package/dist/plugins/version-check.d.ts.map +1 -0
  442. package/dist/plugins/version-check.js +70 -0
  443. package/dist/processes/index.d.ts +12 -0
  444. package/dist/processes/index.d.ts.map +1 -0
  445. package/dist/processes/index.js +15 -0
  446. package/dist/processes/recommender.d.ts +36 -0
  447. package/dist/processes/recommender.d.ts.map +1 -0
  448. package/dist/processes/recommender.js +73 -0
  449. package/dist/processes/scorer.d.ts +26 -0
  450. package/dist/processes/scorer.d.ts.map +1 -0
  451. package/dist/processes/scorer.js +104 -0
  452. package/dist/processes/types.d.ts +48 -0
  453. package/dist/processes/types.d.ts.map +1 -0
  454. package/dist/processes/types.js +9 -0
  455. package/dist/runtime/index.d.ts +3 -0
  456. package/dist/runtime/index.d.ts.map +1 -0
  457. package/dist/runtime/index.js +28 -0
  458. package/dist/seams/contract.d.ts +63 -0
  459. package/dist/seams/contract.d.ts.map +1 -0
  460. package/dist/seams/contract.js +138 -0
  461. package/dist/seams/contract.test.d.ts +2 -0
  462. package/dist/seams/contract.test.d.ts.map +1 -0
  463. package/dist/seams/contract.test.js +99 -0
  464. package/dist/seams/index.d.ts +3 -0
  465. package/dist/seams/index.d.ts.map +1 -0
  466. package/dist/seams/index.js +8 -0
  467. package/dist/session/context.d.ts +22 -0
  468. package/dist/session/context.d.ts.map +1 -0
  469. package/dist/session/context.js +113 -0
  470. package/dist/session/continuityState.d.ts +39 -0
  471. package/dist/session/continuityState.d.ts.map +1 -0
  472. package/dist/session/continuityState.js +164 -0
  473. package/dist/session/cost.d.ts +63 -0
  474. package/dist/session/cost.d.ts.map +1 -0
  475. package/dist/session/cost.js +194 -0
  476. package/dist/session/discovery.d.ts +22 -0
  477. package/dist/session/discovery.d.ts.map +1 -0
  478. package/dist/session/discovery.js +35 -0
  479. package/dist/session/history.d.ts +30 -0
  480. package/dist/session/history.d.ts.map +1 -0
  481. package/dist/session/history.js +143 -0
  482. package/dist/session/index.d.ts +7 -0
  483. package/dist/session/index.d.ts.map +1 -0
  484. package/dist/session/index.js +70 -0
  485. package/dist/session/memoryExtraction.d.ts +65 -0
  486. package/dist/session/memoryExtraction.d.ts.map +1 -0
  487. package/dist/session/memoryExtraction.js +201 -0
  488. package/dist/session/parse.d.ts +45 -0
  489. package/dist/session/parse.d.ts.map +1 -0
  490. package/dist/session/parse.js +170 -0
  491. package/dist/session/persistence.d.ts +46 -0
  492. package/dist/session/persistence.d.ts.map +1 -0
  493. package/dist/session/persistence.js +180 -0
  494. package/dist/session/types.d.ts +267 -0
  495. package/dist/session/types.d.ts.map +1 -0
  496. package/dist/session/types.js +45 -0
  497. package/dist/session/write.d.ts +61 -0
  498. package/dist/session/write.d.ts.map +1 -0
  499. package/dist/session/write.js +213 -0
  500. package/dist/skills/chain.d.ts +31 -0
  501. package/dist/skills/chain.d.ts.map +1 -0
  502. package/dist/skills/chain.js +113 -0
  503. package/dist/skills/discovery.d.ts +34 -0
  504. package/dist/skills/discovery.d.ts.map +1 -0
  505. package/dist/skills/discovery.js +185 -0
  506. package/dist/skills/index.d.ts +12 -0
  507. package/dist/skills/index.d.ts.map +1 -0
  508. package/dist/skills/index.js +18 -0
  509. package/dist/skills/router.d.ts +35 -0
  510. package/dist/skills/router.d.ts.map +1 -0
  511. package/dist/skills/router.js +143 -0
  512. package/dist/skills/types.d.ts +33 -0
  513. package/dist/skills/types.d.ts.map +1 -0
  514. package/dist/skills/types.js +5 -0
  515. package/dist/storage/atomic.d.ts +2 -0
  516. package/dist/storage/atomic.d.ts.map +1 -0
  517. package/dist/storage/atomic.js +54 -0
  518. package/dist/storage/clock.d.ts +2 -0
  519. package/dist/storage/clock.d.ts.map +1 -0
  520. package/dist/storage/clock.js +6 -0
  521. package/dist/storage/index.d.ts +7 -0
  522. package/dist/storage/index.d.ts.map +1 -0
  523. package/dist/storage/index.js +9 -0
  524. package/dist/storage/journalWatcher.d.ts +24 -0
  525. package/dist/storage/journalWatcher.d.ts.map +1 -0
  526. package/dist/storage/journalWatcher.js +172 -0
  527. package/dist/storage/paths.d.ts +5 -0
  528. package/dist/storage/paths.d.ts.map +1 -0
  529. package/dist/storage/paths.js +26 -0
  530. package/dist/storage/snapshotState.d.ts +10 -0
  531. package/dist/storage/snapshotState.d.ts.map +1 -0
  532. package/dist/storage/snapshotState.js +15 -0
  533. package/dist/storage/storeTaskArtifacts.d.ts +6 -0
  534. package/dist/storage/storeTaskArtifacts.d.ts.map +1 -0
  535. package/dist/storage/storeTaskArtifacts.js +55 -0
  536. package/dist/storage/types.d.ts +21 -0
  537. package/dist/storage/types.d.ts.map +1 -0
  538. package/dist/storage/types.js +2 -0
  539. package/dist/tasks/crud.d.ts +33 -0
  540. package/dist/tasks/crud.d.ts.map +1 -0
  541. package/dist/tasks/crud.js +150 -0
  542. package/dist/tasks/index.d.ts +2 -0
  543. package/dist/tasks/index.d.ts.map +1 -0
  544. package/dist/tasks/index.js +9 -0
  545. package/package.json +159 -0
@@ -0,0 +1,213 @@
1
+ "use strict";
2
+ /**
3
+ * Session state file writing utilities.
4
+ * Provides atomic writes for session state files.
5
+ */
6
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
7
+ if (k2 === undefined) k2 = k;
8
+ var desc = Object.getOwnPropertyDescriptor(m, k);
9
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
10
+ desc = { enumerable: true, get: function() { return m[k]; } };
11
+ }
12
+ Object.defineProperty(o, k2, desc);
13
+ }) : (function(o, m, k, k2) {
14
+ if (k2 === undefined) k2 = k;
15
+ o[k2] = m[k];
16
+ }));
17
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
18
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
19
+ }) : function(o, v) {
20
+ o["default"] = v;
21
+ });
22
+ var __importStar = (this && this.__importStar) || (function () {
23
+ var ownKeys = function(o) {
24
+ ownKeys = Object.getOwnPropertyNames || function (o) {
25
+ var ar = [];
26
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
27
+ return ar;
28
+ };
29
+ return ownKeys(o);
30
+ };
31
+ return function (mod) {
32
+ if (mod && mod.__esModule) return mod;
33
+ var result = {};
34
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
35
+ __setModuleDefault(result, mod);
36
+ return result;
37
+ };
38
+ })();
39
+ Object.defineProperty(exports, "__esModule", { value: true });
40
+ exports.serializeSessionState = serializeSessionState;
41
+ exports.createSessionFileContent = createSessionFileContent;
42
+ exports.writeSessionFile = writeSessionFile;
43
+ exports.updateSessionState = updateSessionState;
44
+ exports.addRunToSession = addRunToSession;
45
+ exports.getSessionRuns = getSessionRuns;
46
+ exports.getCurrentTimestamp = getCurrentTimestamp;
47
+ exports.isoToEpochSeconds = isoToEpochSeconds;
48
+ exports.updateIterationTimes = updateIterationTimes;
49
+ const node_fs_1 = require("node:fs");
50
+ const path = __importStar(require("node:path"));
51
+ const types_1 = require("./types");
52
+ /**
53
+ * Serialize session state to YAML frontmatter format.
54
+ */
55
+ function serializeSessionState(state) {
56
+ const lines = [];
57
+ lines.push(`active: ${state.active}`);
58
+ lines.push(`iteration: ${state.iteration}`);
59
+ lines.push(`max_iterations: ${state.maxIterations}`);
60
+ lines.push(`run_id: "${state.runId}"`);
61
+ lines.push(`run_ids: ${state.runIds.join(',')}`);
62
+ lines.push(`started_at: "${state.startedAt}"`);
63
+ lines.push(`last_iteration_at: "${state.lastIterationAt}"`);
64
+ lines.push(`iteration_times: ${state.iterationTimes.join(',')}`);
65
+ for (const [key, value] of Object.entries(state.metadata ?? {})) {
66
+ lines.push(`metadata_${key}: "${String(value).replace(/\\/g, '\\\\').replace(/"/g, '\\"')}"`);
67
+ }
68
+ return lines.join('\n');
69
+ }
70
+ /**
71
+ * Create full session file content with YAML frontmatter and prompt.
72
+ */
73
+ function createSessionFileContent(state, prompt) {
74
+ const frontmatter = serializeSessionState(state);
75
+ return `---\n${frontmatter}\n---\n\n${prompt}\n`;
76
+ }
77
+ /**
78
+ * Write session state file atomically.
79
+ * Uses temp file + rename pattern to ensure atomic writes.
80
+ */
81
+ async function writeSessionFile(filePath, state, prompt) {
82
+ const content = createSessionFileContent(state, prompt);
83
+ const dir = path.dirname(filePath);
84
+ const tempPath = `${filePath}.tmp.${process.pid}`;
85
+ try {
86
+ // Ensure directory exists
87
+ await node_fs_1.promises.mkdir(dir, { recursive: true });
88
+ // Write to temp file
89
+ await node_fs_1.promises.writeFile(tempPath, content, 'utf8');
90
+ // Atomic rename
91
+ await node_fs_1.promises.rename(tempPath, filePath);
92
+ }
93
+ catch (error) {
94
+ // Clean up temp file on error
95
+ try {
96
+ await node_fs_1.promises.unlink(tempPath);
97
+ }
98
+ catch {
99
+ // Ignore cleanup errors
100
+ }
101
+ const err = error;
102
+ throw new types_1.SessionError(`Failed to write session state file: ${err.message}`, types_1.SessionErrorCode.FS_ERROR, { filePath, originalError: err.message });
103
+ }
104
+ }
105
+ /**
106
+ * Update specific fields in an existing session state file.
107
+ * Reads, modifies, and atomically writes the file.
108
+ */
109
+ async function updateSessionState(filePath, updates, existingContent) {
110
+ let state;
111
+ let prompt;
112
+ if (existingContent) {
113
+ state = existingContent.state;
114
+ prompt = existingContent.prompt;
115
+ }
116
+ else {
117
+ // Read existing file
118
+ const { readSessionFile } = await Promise.resolve().then(() => __importStar(require('./parse')));
119
+ const file = await readSessionFile(filePath);
120
+ state = file.state;
121
+ prompt = file.prompt;
122
+ }
123
+ // Apply updates
124
+ const updatedState = {
125
+ ...state,
126
+ ...updates,
127
+ };
128
+ // Write updated file
129
+ await writeSessionFile(filePath, updatedState, prompt);
130
+ return updatedState;
131
+ }
132
+ /**
133
+ * Bind a new run to the session, retiring the previous active run to history.
134
+ *
135
+ * Invariant: only one run is active at a time (`runId`).
136
+ * The previous `runId` (if any) is pushed into `runIds` as audit history.
137
+ * Idempotent: re-binding the same runId is a no-op.
138
+ *
139
+ * Throws if the caller tries to bind a new run while `runId` is still set
140
+ * and `retirePrevious` is not explicitly true — this forces callers to
141
+ * acknowledge that the prior run is done.
142
+ */
143
+ function addRunToSession(state, runId, options) {
144
+ // Idempotent: already bound to this run
145
+ if (state.runId === runId)
146
+ return state;
147
+ // Guard: refuse to silently overwrite an active run
148
+ if (state.runId && !options?.retirePrevious) {
149
+ throw new types_1.SessionError(`Session already bound to run ${state.runId}. ` +
150
+ `Pass { retirePrevious: true } to retire it and bind ${runId}.`, types_1.SessionErrorCode.RUN_ALREADY_ASSOCIATED, { currentRunId: state.runId, requestedRunId: runId });
151
+ }
152
+ // Retire the old runId into history (if not already there)
153
+ const runIds = [...state.runIds];
154
+ if (state.runId && !runIds.includes(state.runId)) {
155
+ runIds.push(state.runId);
156
+ }
157
+ // Add the new one to the audit trail too
158
+ if (!runIds.includes(runId)) {
159
+ runIds.push(runId);
160
+ }
161
+ return { ...state, runId, runIds };
162
+ }
163
+ /**
164
+ * Get the historical audit trail of all run IDs for this session (GAP-SESSION-001).
165
+ * Falls back to [runId] when runIds is empty for backward compatibility
166
+ * with sessions created before the runIds field existed.
167
+ */
168
+ function getSessionRuns(state) {
169
+ if (state.runIds.length > 0)
170
+ return state.runIds;
171
+ return state.runId ? [state.runId] : [];
172
+ }
173
+ /**
174
+ * Get current ISO timestamp.
175
+ */
176
+ function getCurrentTimestamp() {
177
+ return new Date().toISOString().replace(/\.\d{3}Z$/, 'Z');
178
+ }
179
+ /**
180
+ * Convert ISO timestamp to epoch seconds.
181
+ * Returns null if conversion fails.
182
+ */
183
+ function isoToEpochSeconds(isoTimestamp) {
184
+ if (!isoTimestamp)
185
+ return null;
186
+ try {
187
+ const date = new Date(isoTimestamp);
188
+ if (Number.isNaN(date.getTime()))
189
+ return null;
190
+ return Math.floor(date.getTime() / 1000);
191
+ }
192
+ catch {
193
+ return null;
194
+ }
195
+ }
196
+ /**
197
+ * Calculate iteration duration and update times array.
198
+ * Keeps only the last 10 durations for diagnostics.
199
+ */
200
+ function updateIterationTimes(existingTimes, lastIterationAt, currentTime) {
201
+ const lastEpoch = isoToEpochSeconds(lastIterationAt);
202
+ const currentEpoch = isoToEpochSeconds(currentTime);
203
+ if (lastEpoch === null || currentEpoch === null) {
204
+ return existingTimes;
205
+ }
206
+ const duration = currentEpoch - lastEpoch;
207
+ if (duration <= 0) {
208
+ return existingTimes;
209
+ }
210
+ const newTimes = [...existingTimes, duration];
211
+ // Keep only last 10
212
+ return newTimes.slice(-10);
213
+ }
@@ -0,0 +1,31 @@
1
+ /**
2
+ * SkillChainBuilder — assembles an ordered chain of skill invocations with
3
+ * dependency tracking and topological validation.
4
+ */
5
+ import type { SkillChain, SkillChainStep } from './types';
6
+ import type { SkillRouter } from './router';
7
+ /**
8
+ * Build a SkillChain from individual steps, producing a topologically sorted
9
+ * execution order that respects `dependsOn` declarations.
10
+ */
11
+ export declare class SkillChainBuilder {
12
+ private readonly steps;
13
+ private description;
14
+ /** Append a step to the chain. */
15
+ addStep(step: SkillChainStep): this;
16
+ /** Set the chain's human-readable description. */
17
+ setDescription(description: string): this;
18
+ /**
19
+ * Build the chain, topologically sorting steps so that every step appears
20
+ * after all of its `dependsOn` prerequisites.
21
+ *
22
+ * Throws if the dependency graph contains a cycle.
23
+ */
24
+ build(): SkillChain;
25
+ /**
26
+ * Validate that every skill referenced in the chain is registered in the
27
+ * given router. Returns an array of missing skill names (empty = valid).
28
+ */
29
+ validate(router: SkillRouter): string[];
30
+ }
31
+ //# sourceMappingURL=chain.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chain.d.ts","sourceRoot":"","sources":["../../src/skills/chain.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAC1D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAE5C;;;GAGG;AACH,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAwB;IAC9C,OAAO,CAAC,WAAW,CAAM;IAEzB,kCAAkC;IAClC,OAAO,CAAC,IAAI,EAAE,cAAc,GAAG,IAAI;IAKnC,kDAAkD;IAClD,cAAc,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI;IAKzC;;;;;OAKG;IACH,KAAK,IAAI,UAAU;IAQnB;;;OAGG;IACH,QAAQ,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,EAAE;CASxC"}
@@ -0,0 +1,113 @@
1
+ "use strict";
2
+ /**
3
+ * SkillChainBuilder — assembles an ordered chain of skill invocations with
4
+ * dependency tracking and topological validation.
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.SkillChainBuilder = void 0;
8
+ /**
9
+ * Build a SkillChain from individual steps, producing a topologically sorted
10
+ * execution order that respects `dependsOn` declarations.
11
+ */
12
+ class SkillChainBuilder {
13
+ steps = [];
14
+ description = '';
15
+ /** Append a step to the chain. */
16
+ addStep(step) {
17
+ this.steps.push(step);
18
+ return this;
19
+ }
20
+ /** Set the chain's human-readable description. */
21
+ setDescription(description) {
22
+ this.description = description;
23
+ return this;
24
+ }
25
+ /**
26
+ * Build the chain, topologically sorting steps so that every step appears
27
+ * after all of its `dependsOn` prerequisites.
28
+ *
29
+ * Throws if the dependency graph contains a cycle.
30
+ */
31
+ build() {
32
+ const sorted = topologicalSort(this.steps);
33
+ return {
34
+ steps: sorted,
35
+ description: this.description,
36
+ };
37
+ }
38
+ /**
39
+ * Validate that every skill referenced in the chain is registered in the
40
+ * given router. Returns an array of missing skill names (empty = valid).
41
+ */
42
+ validate(router) {
43
+ const missing = [];
44
+ for (const step of this.steps) {
45
+ if (!router.get(step.skillName)) {
46
+ missing.push(step.skillName);
47
+ }
48
+ }
49
+ return missing;
50
+ }
51
+ }
52
+ exports.SkillChainBuilder = SkillChainBuilder;
53
+ // ---- topological sort (Kahn's algorithm) ----
54
+ function topologicalSort(steps) {
55
+ const byName = new Map();
56
+ for (const step of steps) {
57
+ byName.set(step.skillName, step);
58
+ }
59
+ // Build adjacency and in-degree structures
60
+ const inDegree = new Map();
61
+ const dependents = new Map(); // prerequisite -> list of dependents
62
+ for (const step of steps) {
63
+ if (!inDegree.has(step.skillName)) {
64
+ inDegree.set(step.skillName, 0);
65
+ }
66
+ if (step.dependsOn) {
67
+ for (const dep of step.dependsOn) {
68
+ inDegree.set(step.skillName, (inDegree.get(step.skillName) ?? 0) + 1);
69
+ const list = dependents.get(dep) ?? [];
70
+ list.push(step.skillName);
71
+ dependents.set(dep, list);
72
+ // Ensure dep has an in-degree entry even if it wasn't added as a step
73
+ if (!inDegree.has(dep)) {
74
+ inDegree.set(dep, 0);
75
+ }
76
+ }
77
+ }
78
+ }
79
+ // Collect nodes with in-degree 0
80
+ const queue = [];
81
+ for (const [name, degree] of inDegree) {
82
+ if (degree === 0) {
83
+ queue.push(name);
84
+ }
85
+ }
86
+ // Stable ordering: sort the initial queue alphabetically
87
+ queue.sort();
88
+ const sorted = [];
89
+ while (queue.length > 0) {
90
+ const current = queue.shift();
91
+ const step = byName.get(current);
92
+ if (step) {
93
+ sorted.push(step);
94
+ }
95
+ for (const dependent of dependents.get(current) ?? []) {
96
+ const newDegree = (inDegree.get(dependent) ?? 1) - 1;
97
+ inDegree.set(dependent, newDegree);
98
+ if (newDegree === 0) {
99
+ queue.push(dependent);
100
+ queue.sort(); // keep stable ordering
101
+ }
102
+ }
103
+ }
104
+ // If we didn't visit every step, there's a cycle
105
+ if (sorted.length < steps.length) {
106
+ const visited = new Set(sorted.map((s) => s.skillName));
107
+ const cycleMembers = steps
108
+ .filter((s) => !visited.has(s.skillName))
109
+ .map((s) => s.skillName);
110
+ throw new Error(`Dependency cycle detected among skills: ${cycleMembers.join(', ')}`);
111
+ }
112
+ return sorted;
113
+ }
@@ -0,0 +1,34 @@
1
+ /**
2
+ * SkillDiscoveryService — scans directories for SKILL.md files, parses
3
+ * frontmatter, and converts them to SkillDescriptor instances for the router.
4
+ */
5
+ import type { SkillDescriptor } from './types';
6
+ /** Raw parsed representation from a SKILL.md file before normalization. */
7
+ export interface RawSkillEntry {
8
+ name: string;
9
+ description: string;
10
+ capabilities: string[];
11
+ triggers: string[];
12
+ domain: string | undefined;
13
+ filePath: string;
14
+ frontmatter: Record<string, unknown>;
15
+ }
16
+ export declare class SkillDiscoveryService {
17
+ /**
18
+ * Parse a single SKILL.md file into a RawSkillEntry.
19
+ */
20
+ parseSkillFile(filePath: string): RawSkillEntry;
21
+ /**
22
+ * Convert a RawSkillEntry (or any raw-shaped object) to a SkillDescriptor.
23
+ */
24
+ toDescriptor(raw: RawSkillEntry, source?: SkillDescriptor['source']): SkillDescriptor;
25
+ /**
26
+ * Scan a single directory tree for SKILL.md files and return descriptors.
27
+ */
28
+ discoverLocal(dir: string): SkillDescriptor[];
29
+ /**
30
+ * Scan multiple plugin directories and return descriptors with source='plugin'.
31
+ */
32
+ discoverPlugins(dirs: string[]): SkillDescriptor[];
33
+ }
34
+ //# sourceMappingURL=discovery.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"discovery.d.ts","sourceRoot":"","sources":["../../src/skills/discovery.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/C,2EAA2E;AAC3E,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACtC;AA0HD,qBAAa,qBAAqB;IAChC;;OAEG;IACH,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,aAAa;IAgC/C;;OAEG;IACH,YAAY,CACV,GAAG,EAAE,aAAa,EAClB,MAAM,GAAE,eAAe,CAAC,QAAQ,CAAW,GAC1C,eAAe;IAYlB;;OAEG;IACH,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,eAAe,EAAE;IAM7C;;OAEG;IACH,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,eAAe,EAAE;CAWnD"}
@@ -0,0 +1,185 @@
1
+ "use strict";
2
+ /**
3
+ * SkillDiscoveryService — scans directories for SKILL.md files, parses
4
+ * frontmatter, and converts them to SkillDescriptor instances for the router.
5
+ */
6
+ var __importDefault = (this && this.__importDefault) || function (mod) {
7
+ return (mod && mod.__esModule) ? mod : { "default": mod };
8
+ };
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.SkillDiscoveryService = void 0;
11
+ const node_fs_1 = __importDefault(require("node:fs"));
12
+ const node_path_1 = __importDefault(require("node:path"));
13
+ // ---- frontmatter parsing ----
14
+ function parseFrontmatter(content) {
15
+ const match = content.match(/^---\s*\r?\n([\s\S]*?)\r?\n---\s*\r?\n?/);
16
+ if (!match) {
17
+ return { frontmatter: {}, body: content };
18
+ }
19
+ // Lightweight YAML-like parser for simple key: value pairs and arrays.
20
+ // Avoids pulling in a full YAML parser dependency.
21
+ const lines = (match[1] ?? '').split(/\r?\n/);
22
+ const fm = {};
23
+ let currentKey = '';
24
+ let currentArray = null;
25
+ for (const line of lines) {
26
+ const arrayItem = line.match(/^\s+-\s+(.*)/);
27
+ if (arrayItem && currentKey) {
28
+ if (!currentArray) {
29
+ currentArray = [];
30
+ }
31
+ currentArray.push(arrayItem[1].trim());
32
+ continue;
33
+ }
34
+ // Flush pending array
35
+ if (currentArray && currentKey) {
36
+ fm[currentKey] = currentArray;
37
+ currentArray = null;
38
+ }
39
+ const kvMatch = line.match(/^(\w[\w-]*):\s*(.*)/);
40
+ if (kvMatch) {
41
+ currentKey = kvMatch[1];
42
+ const value = kvMatch[2].trim();
43
+ if (value.length > 0) {
44
+ // Inline array: [a, b, c]
45
+ if (value.startsWith('[') && value.endsWith(']')) {
46
+ fm[currentKey] = value
47
+ .slice(1, -1)
48
+ .split(',')
49
+ .map((s) => s.trim().replace(/^["']|["']$/g, ''))
50
+ .filter((s) => s.length > 0);
51
+ }
52
+ else {
53
+ fm[currentKey] = value.replace(/^["']|["']$/g, '');
54
+ }
55
+ }
56
+ }
57
+ }
58
+ // Flush trailing array
59
+ if (currentArray && currentKey) {
60
+ fm[currentKey] = currentArray;
61
+ }
62
+ return { frontmatter: fm, body: content.slice(match[0].length) };
63
+ }
64
+ function firstParagraph(body) {
65
+ const lines = body
66
+ .split(/\r?\n/)
67
+ .map((l) => l.trim())
68
+ .filter((l) => l.length > 0 && !l.startsWith('#') && !l.startsWith('```'));
69
+ return lines[0] ?? '';
70
+ }
71
+ function toStringArray(value) {
72
+ if (Array.isArray(value)) {
73
+ return value.filter((v) => typeof v === 'string' && v.length > 0);
74
+ }
75
+ if (typeof value === 'string' && value.length > 0) {
76
+ return [value];
77
+ }
78
+ return [];
79
+ }
80
+ // ---- filesystem helpers ----
81
+ function isDir(p) {
82
+ try {
83
+ return node_fs_1.default.statSync(p).isDirectory();
84
+ }
85
+ catch {
86
+ return false;
87
+ }
88
+ }
89
+ function readFileUtf8(p) {
90
+ return node_fs_1.default.readFileSync(p, 'utf8');
91
+ }
92
+ function walkForSkillFiles(dir) {
93
+ const results = [];
94
+ const walk = (current) => {
95
+ let entries;
96
+ try {
97
+ entries = node_fs_1.default.readdirSync(current);
98
+ }
99
+ catch {
100
+ return;
101
+ }
102
+ for (const entry of entries) {
103
+ if (entry.startsWith('.'))
104
+ continue;
105
+ const full = node_path_1.default.join(current, entry);
106
+ if (isDir(full)) {
107
+ walk(full);
108
+ }
109
+ else if (entry === 'SKILL.md') {
110
+ results.push(full);
111
+ }
112
+ }
113
+ };
114
+ walk(dir);
115
+ return results.sort();
116
+ }
117
+ // ---- public API ----
118
+ class SkillDiscoveryService {
119
+ /**
120
+ * Parse a single SKILL.md file into a RawSkillEntry.
121
+ */
122
+ parseSkillFile(filePath) {
123
+ const content = readFileUtf8(filePath);
124
+ const { frontmatter, body } = parseFrontmatter(content);
125
+ const name = typeof frontmatter.name === 'string' && frontmatter.name.length > 0
126
+ ? frontmatter.name
127
+ : node_path_1.default.basename(node_path_1.default.dirname(filePath));
128
+ const description = typeof frontmatter.description === 'string' && frontmatter.description.length > 0
129
+ ? frontmatter.description
130
+ : firstParagraph(body);
131
+ const capabilities = toStringArray(frontmatter.capabilities);
132
+ const triggers = toStringArray(frontmatter.triggers);
133
+ const domain = typeof frontmatter.domain === 'string' && frontmatter.domain.length > 0
134
+ ? frontmatter.domain
135
+ : undefined;
136
+ return {
137
+ name,
138
+ description,
139
+ capabilities,
140
+ triggers,
141
+ domain,
142
+ filePath,
143
+ frontmatter,
144
+ };
145
+ }
146
+ /**
147
+ * Convert a RawSkillEntry (or any raw-shaped object) to a SkillDescriptor.
148
+ */
149
+ toDescriptor(raw, source = 'local') {
150
+ return {
151
+ name: raw.name,
152
+ description: raw.description,
153
+ capabilities: raw.capabilities.length > 0 ? raw.capabilities : undefined,
154
+ source,
155
+ triggers: raw.triggers.length > 0 ? raw.triggers : undefined,
156
+ domain: raw.domain,
157
+ filePath: raw.filePath,
158
+ };
159
+ }
160
+ /**
161
+ * Scan a single directory tree for SKILL.md files and return descriptors.
162
+ */
163
+ discoverLocal(dir) {
164
+ if (!isDir(dir))
165
+ return [];
166
+ const files = walkForSkillFiles(dir);
167
+ return files.map((f) => this.toDescriptor(this.parseSkillFile(f), 'local'));
168
+ }
169
+ /**
170
+ * Scan multiple plugin directories and return descriptors with source='plugin'.
171
+ */
172
+ discoverPlugins(dirs) {
173
+ const results = [];
174
+ for (const dir of dirs) {
175
+ if (!isDir(dir))
176
+ continue;
177
+ const files = walkForSkillFiles(dir);
178
+ for (const f of files) {
179
+ results.push(this.toDescriptor(this.parseSkillFile(f), 'plugin'));
180
+ }
181
+ }
182
+ return results;
183
+ }
184
+ }
185
+ exports.SkillDiscoveryService = SkillDiscoveryService;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Skill routing module for L6 Agent-Platform.
3
+ *
4
+ * Provides skill registration, criteria-based matching, filesystem discovery,
5
+ * and chain-of-skills orchestration.
6
+ */
7
+ export type { SkillDescriptor, SkillMatchCriteria, SkillMatchResult, SkillChainStep, SkillChain, } from './types';
8
+ export { SkillRouter } from './router';
9
+ export { SkillDiscoveryService } from './discovery';
10
+ export type { RawSkillEntry } from './discovery';
11
+ export { SkillChainBuilder } from './chain';
12
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/skills/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,YAAY,EACV,eAAe,EACf,kBAAkB,EAClB,gBAAgB,EAChB,cAAc,EACd,UAAU,GACX,MAAM,SAAS,CAAC;AAGjB,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAGvC,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACpD,YAAY,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAGjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC"}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ /**
3
+ * Skill routing module for L6 Agent-Platform.
4
+ *
5
+ * Provides skill registration, criteria-based matching, filesystem discovery,
6
+ * and chain-of-skills orchestration.
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.SkillChainBuilder = exports.SkillDiscoveryService = exports.SkillRouter = void 0;
10
+ // Router
11
+ var router_1 = require("./router");
12
+ Object.defineProperty(exports, "SkillRouter", { enumerable: true, get: function () { return router_1.SkillRouter; } });
13
+ // Discovery
14
+ var discovery_1 = require("./discovery");
15
+ Object.defineProperty(exports, "SkillDiscoveryService", { enumerable: true, get: function () { return discovery_1.SkillDiscoveryService; } });
16
+ // Chain builder
17
+ var chain_1 = require("./chain");
18
+ Object.defineProperty(exports, "SkillChainBuilder", { enumerable: true, get: function () { return chain_1.SkillChainBuilder; } });
@@ -0,0 +1,35 @@
1
+ /**
2
+ * SkillRouter — registers skill descriptors and scores them against match criteria.
3
+ *
4
+ * Scoring strategy:
5
+ * 1. Keyword overlap between criteria text (taskType + context) and the skill's
6
+ * description / capabilities / triggers.
7
+ * 2. Exact domain match bonus.
8
+ * 3. Trigger pattern match bonus.
9
+ * 4. Capability intersection bonus.
10
+ */
11
+ import type { SkillDescriptor, SkillMatchCriteria, SkillMatchResult } from './types';
12
+ export declare class SkillRouter {
13
+ private readonly skills;
14
+ /** Register a skill descriptor. Replaces any existing entry with the same name. */
15
+ register(descriptor: SkillDescriptor): void;
16
+ /** Remove a skill by name. Returns true if it existed. */
17
+ unregister(name: string): boolean;
18
+ /** Return the number of registered skills. */
19
+ get size(): number;
20
+ /** Iterate over all registered descriptors. */
21
+ descriptors(): IterableIterator<SkillDescriptor>;
22
+ /** Retrieve a registered descriptor by name. */
23
+ get(name: string): SkillDescriptor | undefined;
24
+ /**
25
+ * Score every registered skill against the given criteria and return
26
+ * results sorted by descending score. Skills that score 0 are excluded.
27
+ */
28
+ match(criteria: SkillMatchCriteria): SkillMatchResult[];
29
+ /**
30
+ * Return the single best matching skill, or undefined when nothing matches.
31
+ */
32
+ select(criteria: SkillMatchCriteria): SkillMatchResult | undefined;
33
+ private scoreSkill;
34
+ }
35
+ //# sourceMappingURL=router.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../../src/skills/router.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EACV,eAAe,EACf,kBAAkB,EAClB,gBAAgB,EACjB,MAAM,SAAS,CAAC;AA2BjB,qBAAa,WAAW;IACtB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAsC;IAE7D,mFAAmF;IACnF,QAAQ,CAAC,UAAU,EAAE,eAAe,GAAG,IAAI;IAI3C,0DAA0D;IAC1D,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAIjC,8CAA8C;IAC9C,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED,+CAA+C;IAC/C,WAAW,IAAI,gBAAgB,CAAC,eAAe,CAAC;IAIhD,gDAAgD;IAChD,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe,GAAG,SAAS;IAI9C;;;OAGG;IACH,KAAK,CAAC,QAAQ,EAAE,kBAAkB,GAAG,gBAAgB,EAAE;IAavD;;OAEG;IACH,MAAM,CAAC,QAAQ,EAAE,kBAAkB,GAAG,gBAAgB,GAAG,SAAS;IAOlE,OAAO,CAAC,UAAU;CAwEnB"}