@qodo/sdk 0.13.4 → 2.0.0-next.1

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 (764) hide show
  1. package/LICENSE +31 -118
  2. package/README.md +133 -121
  3. package/bin/qodo-skills.mjs +13 -0
  4. package/bundled-skills/code-review/SKILL.md +41 -0
  5. package/bundled-skills/pr-summary/SKILL.md +59 -0
  6. package/bundled-skills/test-gen/SKILL.md +47 -0
  7. package/dist/auth/index.browser.d.ts +38 -0
  8. package/dist/auth/index.browser.d.ts.map +1 -0
  9. package/dist/auth/index.browser.js +62 -0
  10. package/dist/auth/index.browser.js.map +1 -0
  11. package/dist/auth/index.d.ts +44 -30
  12. package/dist/auth/index.d.ts.map +1 -1
  13. package/dist/auth/index.js +57 -110
  14. package/dist/auth/index.js.map +1 -1
  15. package/dist/client/AgentsClient.d.ts +33 -0
  16. package/dist/client/AgentsClient.d.ts.map +1 -0
  17. package/dist/client/AgentsClient.js +40 -0
  18. package/dist/client/AgentsClient.js.map +1 -0
  19. package/dist/client/ArtifactsClient.d.ts +43 -0
  20. package/dist/client/ArtifactsClient.d.ts.map +1 -0
  21. package/dist/client/ArtifactsClient.js +54 -0
  22. package/dist/client/ArtifactsClient.js.map +1 -0
  23. package/dist/client/BulletinClient.d.ts +45 -0
  24. package/dist/client/BulletinClient.d.ts.map +1 -0
  25. package/dist/client/BulletinClient.js +51 -0
  26. package/dist/client/BulletinClient.js.map +1 -0
  27. package/dist/client/InfoClient.d.ts +58 -0
  28. package/dist/client/InfoClient.d.ts.map +1 -0
  29. package/dist/client/InfoClient.js +135 -0
  30. package/dist/client/InfoClient.js.map +1 -0
  31. package/dist/client/PipelineClient.d.ts +162 -0
  32. package/dist/client/PipelineClient.d.ts.map +1 -0
  33. package/dist/client/PipelineClient.js +340 -0
  34. package/dist/client/PipelineClient.js.map +1 -0
  35. package/dist/client/QarRegistryClient.d.ts +396 -0
  36. package/dist/client/QarRegistryClient.d.ts.map +1 -0
  37. package/dist/client/QarRegistryClient.js +536 -0
  38. package/dist/client/QarRegistryClient.js.map +1 -0
  39. package/dist/client/QodoClient.d.ts +296 -0
  40. package/dist/client/QodoClient.d.ts.map +1 -0
  41. package/dist/client/QodoClient.js +803 -0
  42. package/dist/client/QodoClient.js.map +1 -0
  43. package/dist/client/SpecsClient.d.ts +121 -0
  44. package/dist/client/SpecsClient.d.ts.map +1 -0
  45. package/dist/client/SpecsClient.js +252 -0
  46. package/dist/client/SpecsClient.js.map +1 -0
  47. package/dist/client/StateClient.d.ts +35 -0
  48. package/dist/client/StateClient.d.ts.map +1 -0
  49. package/dist/client/StateClient.js +36 -0
  50. package/dist/client/StateClient.js.map +1 -0
  51. package/dist/client/TaskClient.d.ts +706 -0
  52. package/dist/client/TaskClient.d.ts.map +1 -0
  53. package/dist/client/TaskClient.js +2522 -0
  54. package/dist/client/TaskClient.js.map +1 -0
  55. package/dist/client/ToolClient.d.ts +278 -0
  56. package/dist/client/ToolClient.d.ts.map +1 -0
  57. package/dist/client/ToolClient.js +1139 -0
  58. package/dist/client/ToolClient.js.map +1 -0
  59. package/dist/client/a2a/index.d.ts +10 -0
  60. package/dist/client/a2a/index.d.ts.map +1 -0
  61. package/dist/client/a2a/index.js +9 -0
  62. package/dist/client/a2a/index.js.map +1 -0
  63. package/dist/client/a2a/registerA2A.d.ts +170 -0
  64. package/dist/client/a2a/registerA2A.d.ts.map +1 -0
  65. package/dist/client/a2a/registerA2A.js +85 -0
  66. package/dist/client/a2a/registerA2A.js.map +1 -0
  67. package/dist/client/connection.d.ts +893 -0
  68. package/dist/client/connection.d.ts.map +1 -0
  69. package/dist/client/connection.js +2189 -0
  70. package/dist/client/connection.js.map +1 -0
  71. package/dist/client/errors.d.ts +735 -0
  72. package/dist/client/errors.d.ts.map +1 -0
  73. package/dist/client/errors.js +921 -0
  74. package/dist/client/errors.js.map +1 -0
  75. package/dist/client/index.d.ts +26 -0
  76. package/dist/client/index.d.ts.map +1 -0
  77. package/dist/client/index.js +20 -0
  78. package/dist/client/index.js.map +1 -0
  79. package/dist/client/inlineGraph.d.ts +66 -0
  80. package/dist/client/inlineGraph.d.ts.map +1 -0
  81. package/dist/client/inlineGraph.js +500 -0
  82. package/dist/client/inlineGraph.js.map +1 -0
  83. package/dist/client/internal/thenable.d.ts +27 -0
  84. package/dist/client/internal/thenable.d.ts.map +1 -0
  85. package/dist/client/internal/thenable.js +31 -0
  86. package/dist/client/internal/thenable.js.map +1 -0
  87. package/dist/client/iterator.d.ts +32 -0
  88. package/dist/client/iterator.d.ts.map +1 -0
  89. package/dist/client/iterator.js +73 -0
  90. package/dist/client/iterator.js.map +1 -0
  91. package/dist/client/mcp/McpClientPool.browser.d.ts +76 -0
  92. package/dist/client/mcp/McpClientPool.browser.d.ts.map +1 -0
  93. package/dist/client/mcp/McpClientPool.browser.js +78 -0
  94. package/dist/client/mcp/McpClientPool.browser.js.map +1 -0
  95. package/dist/client/mcp/McpClientPool.d.ts +236 -0
  96. package/dist/client/mcp/McpClientPool.d.ts.map +1 -0
  97. package/dist/client/mcp/McpClientPool.js +585 -0
  98. package/dist/client/mcp/McpClientPool.js.map +1 -0
  99. package/dist/client/mcp/projection.d.ts +109 -0
  100. package/dist/client/mcp/projection.d.ts.map +1 -0
  101. package/dist/client/mcp/projection.js +446 -0
  102. package/dist/client/mcp/projection.js.map +1 -0
  103. package/dist/client/mcp/substituteEnv.browser.d.ts +18 -0
  104. package/dist/client/mcp/substituteEnv.browser.d.ts.map +1 -0
  105. package/dist/client/mcp/substituteEnv.browser.js +20 -0
  106. package/dist/client/mcp/substituteEnv.browser.js.map +1 -0
  107. package/dist/client/mcp/substituteEnv.d.ts +45 -0
  108. package/dist/client/mcp/substituteEnv.d.ts.map +1 -0
  109. package/dist/client/mcp/substituteEnv.js +63 -0
  110. package/dist/client/mcp/substituteEnv.js.map +1 -0
  111. package/dist/client/observers.d.ts +57 -0
  112. package/dist/client/observers.d.ts.map +1 -0
  113. package/dist/client/observers.js +203 -0
  114. package/dist/client/observers.js.map +1 -0
  115. package/dist/client/options.d.ts +269 -0
  116. package/dist/client/options.d.ts.map +1 -0
  117. package/dist/client/options.js +9 -0
  118. package/dist/client/options.js.map +1 -0
  119. package/dist/client/tools/_readlineApprovalPrompt.browser.d.ts +17 -0
  120. package/dist/client/tools/_readlineApprovalPrompt.browser.d.ts.map +1 -0
  121. package/dist/client/tools/_readlineApprovalPrompt.browser.js +24 -0
  122. package/dist/client/tools/_readlineApprovalPrompt.browser.js.map +1 -0
  123. package/dist/client/tools/_readlineApprovalPrompt.d.ts +33 -0
  124. package/dist/client/tools/_readlineApprovalPrompt.d.ts.map +1 -0
  125. package/dist/client/tools/_readlineApprovalPrompt.js +90 -0
  126. package/dist/client/tools/_readlineApprovalPrompt.js.map +1 -0
  127. package/dist/client/tools/approval.d.ts +280 -0
  128. package/dist/client/tools/approval.d.ts.map +1 -0
  129. package/dist/client/tools/approval.js +229 -0
  130. package/dist/client/tools/approval.js.map +1 -0
  131. package/dist/client/tools/bindFunctionToolDefs.d.ts +156 -0
  132. package/dist/client/tools/bindFunctionToolDefs.d.ts.map +1 -0
  133. package/dist/client/tools/bindFunctionToolDefs.js +360 -0
  134. package/dist/client/tools/bindFunctionToolDefs.js.map +1 -0
  135. package/dist/client/tools/defineFunctionTool.d.ts +277 -0
  136. package/dist/client/tools/defineFunctionTool.d.ts.map +1 -0
  137. package/dist/client/tools/defineFunctionTool.js +190 -0
  138. package/dist/client/tools/defineFunctionTool.js.map +1 -0
  139. package/dist/client/transport.browser.d.ts +20 -0
  140. package/dist/client/transport.browser.d.ts.map +1 -0
  141. package/dist/client/transport.browser.js +29 -0
  142. package/dist/client/transport.browser.js.map +1 -0
  143. package/dist/client/transport.d.ts +47 -0
  144. package/dist/client/transport.d.ts.map +1 -0
  145. package/dist/client/transport.js +102 -0
  146. package/dist/client/transport.js.map +1 -0
  147. package/dist/client/transport.shared.d.ts +30 -0
  148. package/dist/client/transport.shared.d.ts.map +1 -0
  149. package/dist/client/transport.shared.js +40 -0
  150. package/dist/client/transport.shared.js.map +1 -0
  151. package/dist/client/uuid.d.ts +32 -0
  152. package/dist/client/uuid.d.ts.map +1 -0
  153. package/dist/client/uuid.js +65 -0
  154. package/dist/client/uuid.js.map +1 -0
  155. package/dist/index.d.ts +88 -39
  156. package/dist/index.d.ts.map +1 -1
  157. package/dist/index.js +166 -43
  158. package/dist/index.js.map +1 -1
  159. package/dist/observability/attributes.d.ts +136 -0
  160. package/dist/observability/attributes.d.ts.map +1 -0
  161. package/dist/observability/attributes.js +184 -0
  162. package/dist/observability/attributes.js.map +1 -0
  163. package/dist/observability/index.d.ts +14 -0
  164. package/dist/observability/index.d.ts.map +1 -0
  165. package/dist/observability/index.js +11 -0
  166. package/dist/observability/index.js.map +1 -0
  167. package/dist/observability/resolveOTel.browser.d.ts +13 -0
  168. package/dist/observability/resolveOTel.browser.d.ts.map +1 -0
  169. package/dist/observability/resolveOTel.browser.js +14 -0
  170. package/dist/observability/resolveOTel.browser.js.map +1 -0
  171. package/dist/observability/resolveOTel.d.ts +28 -0
  172. package/dist/observability/resolveOTel.d.ts.map +1 -0
  173. package/dist/observability/resolveOTel.js +74 -0
  174. package/dist/observability/resolveOTel.js.map +1 -0
  175. package/dist/observability/spans.d.ts +198 -0
  176. package/dist/observability/spans.d.ts.map +1 -0
  177. package/dist/observability/spans.js +300 -0
  178. package/dist/observability/spans.js.map +1 -0
  179. package/dist/observability/traceContext.d.ts +51 -0
  180. package/dist/observability/traceContext.d.ts.map +1 -0
  181. package/dist/observability/traceContext.js +151 -0
  182. package/dist/observability/traceContext.js.map +1 -0
  183. package/dist/observability/transportMetrics.d.ts +58 -0
  184. package/dist/observability/transportMetrics.d.ts.map +1 -0
  185. package/dist/observability/transportMetrics.js +55 -0
  186. package/dist/observability/transportMetrics.js.map +1 -0
  187. package/dist/qar/agentSpec.d.ts +93 -0
  188. package/dist/qar/agentSpec.d.ts.map +1 -0
  189. package/dist/qar/agentSpec.js +184 -0
  190. package/dist/qar/agentSpec.js.map +1 -0
  191. package/dist/qar/clientEvents.d.ts +86 -0
  192. package/dist/qar/clientEvents.d.ts.map +1 -0
  193. package/dist/qar/clientEvents.js +36 -0
  194. package/dist/qar/clientEvents.js.map +1 -0
  195. package/dist/qar/envelopes.d.ts +227 -0
  196. package/dist/qar/envelopes.d.ts.map +1 -0
  197. package/dist/qar/envelopes.js +67 -0
  198. package/dist/qar/envelopes.js.map +1 -0
  199. package/dist/qar/generated/envelope.d.ts +332 -0
  200. package/dist/qar/generated/envelope.d.ts.map +1 -0
  201. package/dist/qar/generated/envelope.js +15 -0
  202. package/dist/qar/generated/envelope.js.map +1 -0
  203. package/dist/qar/generated/qar-info.d.ts +76 -0
  204. package/dist/qar/generated/qar-info.d.ts.map +1 -0
  205. package/dist/qar/generated/qar-info.js +15 -0
  206. package/dist/qar/generated/qar-info.js.map +1 -0
  207. package/dist/qar/generated/qodo-task-start-payload.d.ts +54 -0
  208. package/dist/qar/generated/qodo-task-start-payload.d.ts.map +1 -0
  209. package/dist/qar/generated/qodo-task-start-payload.js +15 -0
  210. package/dist/qar/generated/qodo-task-start-payload.js.map +1 -0
  211. package/dist/qar/ids.d.ts +19 -0
  212. package/dist/qar/ids.d.ts.map +1 -0
  213. package/dist/qar/ids.js +11 -0
  214. package/dist/qar/ids.js.map +1 -0
  215. package/dist/qar/index.d.ts +24 -0
  216. package/dist/qar/index.d.ts.map +1 -0
  217. package/dist/qar/index.js +16 -0
  218. package/dist/qar/index.js.map +1 -0
  219. package/dist/qar/info.d.ts +37 -0
  220. package/dist/qar/info.d.ts.map +1 -0
  221. package/dist/qar/info.js +17 -0
  222. package/dist/qar/info.js.map +1 -0
  223. package/dist/qar/json.d.ts +14 -0
  224. package/dist/qar/json.d.ts.map +1 -0
  225. package/dist/qar/json.js +9 -0
  226. package/dist/qar/json.js.map +1 -0
  227. package/dist/qar/payloads.d.ts +480 -0
  228. package/dist/qar/payloads.d.ts.map +1 -0
  229. package/dist/qar/payloads.js +37 -0
  230. package/dist/qar/payloads.js.map +1 -0
  231. package/dist/qar/specs.d.ts +604 -0
  232. package/dist/qar/specs.d.ts.map +1 -0
  233. package/dist/qar/specs.js +29 -0
  234. package/dist/qar/specs.js.map +1 -0
  235. package/dist/qar/taskEvents.d.ts +25 -0
  236. package/dist/qar/taskEvents.d.ts.map +1 -0
  237. package/dist/qar/taskEvents.js +22 -0
  238. package/dist/qar/taskEvents.js.map +1 -0
  239. package/dist/qar/trace.d.ts +12 -0
  240. package/dist/qar/trace.d.ts.map +1 -0
  241. package/dist/qar/trace.js +12 -0
  242. package/dist/qar/trace.js.map +1 -0
  243. package/dist/skills/activation.d.ts +177 -0
  244. package/dist/skills/activation.d.ts.map +1 -0
  245. package/dist/skills/activation.js +428 -0
  246. package/dist/skills/activation.js.map +1 -0
  247. package/dist/skills/cli/index.browser.d.ts +18 -0
  248. package/dist/skills/cli/index.browser.d.ts.map +1 -0
  249. package/dist/skills/cli/index.browser.js +27 -0
  250. package/dist/skills/cli/index.browser.js.map +1 -0
  251. package/dist/skills/cli/index.d.ts +37 -0
  252. package/dist/skills/cli/index.d.ts.map +1 -0
  253. package/dist/skills/cli/index.js +494 -0
  254. package/dist/skills/cli/index.js.map +1 -0
  255. package/dist/skills/events.d.ts +255 -0
  256. package/dist/skills/events.d.ts.map +1 -0
  257. package/dist/skills/events.js +224 -0
  258. package/dist/skills/events.js.map +1 -0
  259. package/dist/skills/index.d.ts +45 -0
  260. package/dist/skills/index.d.ts.map +1 -0
  261. package/dist/skills/index.js +34 -0
  262. package/dist/skills/index.js.map +1 -0
  263. package/dist/skills/inject.d.ts +57 -0
  264. package/dist/skills/inject.d.ts.map +1 -0
  265. package/dist/skills/inject.js +162 -0
  266. package/dist/skills/inject.js.map +1 -0
  267. package/dist/skills/lockfile.browser.d.ts +56 -0
  268. package/dist/skills/lockfile.browser.d.ts.map +1 -0
  269. package/dist/skills/lockfile.browser.js +55 -0
  270. package/dist/skills/lockfile.browser.js.map +1 -0
  271. package/dist/skills/lockfile.d.ts +137 -0
  272. package/dist/skills/lockfile.d.ts.map +1 -0
  273. package/dist/skills/lockfile.js +423 -0
  274. package/dist/skills/lockfile.js.map +1 -0
  275. package/dist/skills/manager.browser.d.ts +94 -0
  276. package/dist/skills/manager.browser.d.ts.map +1 -0
  277. package/dist/skills/manager.browser.js +159 -0
  278. package/dist/skills/manager.browser.js.map +1 -0
  279. package/dist/skills/manager.d.ts +362 -0
  280. package/dist/skills/manager.d.ts.map +1 -0
  281. package/dist/skills/manager.js +1386 -0
  282. package/dist/skills/manager.js.map +1 -0
  283. package/dist/skills/mcp/index.d.ts +15 -0
  284. package/dist/skills/mcp/index.d.ts.map +1 -0
  285. package/dist/skills/mcp/index.js +12 -0
  286. package/dist/skills/mcp/index.js.map +1 -0
  287. package/dist/skills/mcp/path.browser.d.ts +27 -0
  288. package/dist/skills/mcp/path.browser.d.ts.map +1 -0
  289. package/dist/skills/mcp/path.browser.js +33 -0
  290. package/dist/skills/mcp/path.browser.js.map +1 -0
  291. package/dist/skills/mcp/path.d.ts +57 -0
  292. package/dist/skills/mcp/path.d.ts.map +1 -0
  293. package/dist/skills/mcp/path.js +150 -0
  294. package/dist/skills/mcp/path.js.map +1 -0
  295. package/dist/skills/mcp/server.browser.d.ts +32 -0
  296. package/dist/skills/mcp/server.browser.d.ts.map +1 -0
  297. package/dist/skills/mcp/server.browser.js +53 -0
  298. package/dist/skills/mcp/server.browser.js.map +1 -0
  299. package/dist/skills/mcp/server.d.ts +144 -0
  300. package/dist/skills/mcp/server.d.ts.map +1 -0
  301. package/dist/skills/mcp/server.js +841 -0
  302. package/dist/skills/mcp/server.js.map +1 -0
  303. package/dist/skills/mcp/types.d.ts +72 -0
  304. package/dist/skills/mcp/types.d.ts.map +1 -0
  305. package/dist/skills/mcp/types.js +20 -0
  306. package/dist/skills/mcp/types.js.map +1 -0
  307. package/dist/skills/mcp/wireDefs.d.ts +58 -0
  308. package/dist/skills/mcp/wireDefs.d.ts.map +1 -0
  309. package/dist/skills/mcp/wireDefs.js +141 -0
  310. package/dist/skills/mcp/wireDefs.js.map +1 -0
  311. package/dist/skills/parser.d.ts +63 -0
  312. package/dist/skills/parser.d.ts.map +1 -0
  313. package/dist/skills/parser.js +755 -0
  314. package/dist/skills/parser.js.map +1 -0
  315. package/dist/skills/prefilter.d.ts +104 -0
  316. package/dist/skills/prefilter.d.ts.map +1 -0
  317. package/dist/skills/prefilter.js +398 -0
  318. package/dist/skills/prefilter.js.map +1 -0
  319. package/dist/skills/preprocess.d.ts +169 -0
  320. package/dist/skills/preprocess.d.ts.map +1 -0
  321. package/dist/skills/preprocess.js +535 -0
  322. package/dist/skills/preprocess.js.map +1 -0
  323. package/dist/skills/render.d.ts +83 -0
  324. package/dist/skills/render.d.ts.map +1 -0
  325. package/dist/skills/render.js +397 -0
  326. package/dist/skills/render.js.map +1 -0
  327. package/dist/skills/sources/index.browser.d.ts +29 -0
  328. package/dist/skills/sources/index.browser.d.ts.map +1 -0
  329. package/dist/skills/sources/index.browser.js +16 -0
  330. package/dist/skills/sources/index.browser.js.map +1 -0
  331. package/dist/skills/sources/index.d.ts +59 -0
  332. package/dist/skills/sources/index.d.ts.map +1 -0
  333. package/dist/skills/sources/index.js +471 -0
  334. package/dist/skills/sources/index.js.map +1 -0
  335. package/dist/skills/sources/walk.browser.d.ts +17 -0
  336. package/dist/skills/sources/walk.browser.d.ts.map +1 -0
  337. package/dist/skills/sources/walk.browser.js +19 -0
  338. package/dist/skills/sources/walk.browser.js.map +1 -0
  339. package/dist/skills/sources/walk.d.ts +68 -0
  340. package/dist/skills/sources/walk.d.ts.map +1 -0
  341. package/dist/skills/sources/walk.js +264 -0
  342. package/dist/skills/sources/walk.js.map +1 -0
  343. package/dist/skills/substitute.d.ts +87 -0
  344. package/dist/skills/substitute.d.ts.map +1 -0
  345. package/dist/skills/substitute.js +322 -0
  346. package/dist/skills/substitute.js.map +1 -0
  347. package/dist/skills/testing/SkillKit.browser.d.ts +62 -0
  348. package/dist/skills/testing/SkillKit.browser.d.ts.map +1 -0
  349. package/dist/skills/testing/SkillKit.browser.js +41 -0
  350. package/dist/skills/testing/SkillKit.browser.js.map +1 -0
  351. package/dist/skills/testing/SkillKit.d.ts +130 -0
  352. package/dist/skills/testing/SkillKit.d.ts.map +1 -0
  353. package/dist/skills/testing/SkillKit.js +316 -0
  354. package/dist/skills/testing/SkillKit.js.map +1 -0
  355. package/dist/skills/testing/index.d.ts +9 -0
  356. package/dist/skills/testing/index.d.ts.map +1 -0
  357. package/dist/skills/testing/index.js +8 -0
  358. package/dist/skills/testing/index.js.map +1 -0
  359. package/dist/skills/trust.d.ts +72 -0
  360. package/dist/skills/trust.d.ts.map +1 -0
  361. package/dist/skills/trust.js +183 -0
  362. package/dist/skills/trust.js.map +1 -0
  363. package/dist/skills/types.d.ts +627 -0
  364. package/dist/skills/types.d.ts.map +1 -0
  365. package/dist/skills/types.js +85 -0
  366. package/dist/skills/types.js.map +1 -0
  367. package/dist/skills/validator.d.ts +95 -0
  368. package/dist/skills/validator.d.ts.map +1 -0
  369. package/dist/skills/validator.js +486 -0
  370. package/dist/skills/validator.js.map +1 -0
  371. package/dist/tracing/PipelineTracer.d.ts +35 -22
  372. package/dist/tracing/PipelineTracer.d.ts.map +1 -1
  373. package/dist/tracing/PipelineTracer.js +106 -61
  374. package/dist/tracing/PipelineTracer.js.map +1 -1
  375. package/dist/tracing/SdkTracer.d.ts +63 -61
  376. package/dist/tracing/SdkTracer.d.ts.map +1 -1
  377. package/dist/tracing/SdkTracer.js +185 -177
  378. package/dist/tracing/SdkTracer.js.map +1 -1
  379. package/dist/tracing/index.d.ts +10 -1
  380. package/dist/tracing/index.d.ts.map +1 -1
  381. package/dist/tracing/index.js +9 -0
  382. package/dist/tracing/index.js.map +1 -1
  383. package/dist/tracing/types.d.ts +89 -16
  384. package/dist/tracing/types.d.ts.map +1 -1
  385. package/dist/tracing/types.js +17 -4
  386. package/dist/tracing/types.js.map +1 -1
  387. package/dist/types.d.ts +6 -1
  388. package/dist/types.d.ts.map +1 -1
  389. package/dist/types.js +4 -0
  390. package/dist/types.js.map +1 -1
  391. package/dist/version.d.ts.map +1 -1
  392. package/dist/version.js +10 -20
  393. package/dist/version.js.map +1 -1
  394. package/package.json +53 -39
  395. package/.claude/skills/qodo-agent/SKILL.md +0 -974
  396. package/.claude/skills/qodo-agent/assets/programmatic-agent.ts +0 -407
  397. package/.claude/skills/qodo-agent/references/builtin-tools.md +0 -342
  398. package/.claude/skills/qodo-agent/references/common-issues.md +0 -537
  399. package/bin/rg +0 -0
  400. package/dist/api/agent.d.ts +0 -105
  401. package/dist/api/agent.d.ts.map +0 -1
  402. package/dist/api/agent.js +0 -963
  403. package/dist/api/agent.js.map +0 -1
  404. package/dist/api/analytics.d.ts +0 -43
  405. package/dist/api/analytics.d.ts.map +0 -1
  406. package/dist/api/analytics.js +0 -163
  407. package/dist/api/analytics.js.map +0 -1
  408. package/dist/api/http.d.ts +0 -5
  409. package/dist/api/http.d.ts.map +0 -1
  410. package/dist/api/http.js +0 -62
  411. package/dist/api/http.js.map +0 -1
  412. package/dist/api/index.d.ts +0 -12
  413. package/dist/api/index.d.ts.map +0 -1
  414. package/dist/api/index.js +0 -17
  415. package/dist/api/index.js.map +0 -1
  416. package/dist/api/taskTracking.d.ts +0 -54
  417. package/dist/api/taskTracking.d.ts.map +0 -1
  418. package/dist/api/taskTracking.js +0 -208
  419. package/dist/api/taskTracking.js.map +0 -1
  420. package/dist/api/types.d.ts +0 -93
  421. package/dist/api/types.d.ts.map +0 -1
  422. package/dist/api/types.js +0 -2
  423. package/dist/api/types.js.map +0 -1
  424. package/dist/api/utils.d.ts +0 -8
  425. package/dist/api/utils.d.ts.map +0 -1
  426. package/dist/api/utils.js +0 -63
  427. package/dist/api/utils.js.map +0 -1
  428. package/dist/api/websocket.d.ts +0 -203
  429. package/dist/api/websocket.d.ts.map +0 -1
  430. package/dist/api/websocket.js +0 -1166
  431. package/dist/api/websocket.js.map +0 -1
  432. package/dist/bin/install-skill.d.ts +0 -14
  433. package/dist/bin/install-skill.d.ts.map +0 -1
  434. package/dist/bin/install-skill.js +0 -125
  435. package/dist/bin/install-skill.js.map +0 -1
  436. package/dist/bin/run-helpers.d.ts +0 -34
  437. package/dist/bin/run-helpers.d.ts.map +0 -1
  438. package/dist/bin/run-helpers.js +0 -186
  439. package/dist/bin/run-helpers.js.map +0 -1
  440. package/dist/bin/run.d.ts +0 -13
  441. package/dist/bin/run.d.ts.map +0 -1
  442. package/dist/bin/run.js +0 -57
  443. package/dist/bin/run.js.map +0 -1
  444. package/dist/clients/index.d.ts +0 -10
  445. package/dist/clients/index.d.ts.map +0 -1
  446. package/dist/clients/index.js +0 -8
  447. package/dist/clients/index.js.map +0 -1
  448. package/dist/clients/info/InfoClient.d.ts +0 -37
  449. package/dist/clients/info/InfoClient.d.ts.map +0 -1
  450. package/dist/clients/info/InfoClient.js +0 -69
  451. package/dist/clients/info/InfoClient.js.map +0 -1
  452. package/dist/clients/info/index.d.ts +0 -4
  453. package/dist/clients/info/index.d.ts.map +0 -1
  454. package/dist/clients/info/index.js +0 -2
  455. package/dist/clients/info/index.js.map +0 -1
  456. package/dist/clients/info/types.d.ts +0 -21
  457. package/dist/clients/info/types.d.ts.map +0 -1
  458. package/dist/clients/info/types.js +0 -2
  459. package/dist/clients/info/types.js.map +0 -1
  460. package/dist/clients/sessions/SessionsClient.d.ts +0 -34
  461. package/dist/clients/sessions/SessionsClient.d.ts.map +0 -1
  462. package/dist/clients/sessions/SessionsClient.js +0 -71
  463. package/dist/clients/sessions/SessionsClient.js.map +0 -1
  464. package/dist/clients/sessions/index.d.ts +0 -4
  465. package/dist/clients/sessions/index.d.ts.map +0 -1
  466. package/dist/clients/sessions/index.js +0 -2
  467. package/dist/clients/sessions/index.js.map +0 -1
  468. package/dist/clients/sessions/types.d.ts +0 -20
  469. package/dist/clients/sessions/types.d.ts.map +0 -1
  470. package/dist/clients/sessions/types.js +0 -2
  471. package/dist/clients/sessions/types.js.map +0 -1
  472. package/dist/clients/tools/ToolsClient.d.ts +0 -39
  473. package/dist/clients/tools/ToolsClient.d.ts.map +0 -1
  474. package/dist/clients/tools/ToolsClient.js +0 -95
  475. package/dist/clients/tools/ToolsClient.js.map +0 -1
  476. package/dist/clients/tools/index.d.ts +0 -4
  477. package/dist/clients/tools/index.d.ts.map +0 -1
  478. package/dist/clients/tools/index.js +0 -2
  479. package/dist/clients/tools/index.js.map +0 -1
  480. package/dist/clients/tools/types.d.ts +0 -14
  481. package/dist/clients/tools/types.d.ts.map +0 -1
  482. package/dist/clients/tools/types.js +0 -2
  483. package/dist/clients/tools/types.js.map +0 -1
  484. package/dist/config/ConfigManager.d.ts +0 -43
  485. package/dist/config/ConfigManager.d.ts.map +0 -1
  486. package/dist/config/ConfigManager.js +0 -472
  487. package/dist/config/ConfigManager.js.map +0 -1
  488. package/dist/config/index.d.ts +0 -6
  489. package/dist/config/index.d.ts.map +0 -1
  490. package/dist/config/index.js +0 -7
  491. package/dist/config/index.js.map +0 -1
  492. package/dist/config/urlConfig.d.ts +0 -15
  493. package/dist/config/urlConfig.d.ts.map +0 -1
  494. package/dist/config/urlConfig.js +0 -75
  495. package/dist/config/urlConfig.js.map +0 -1
  496. package/dist/constants/errors.d.ts +0 -2
  497. package/dist/constants/errors.d.ts.map +0 -1
  498. package/dist/constants/errors.js +0 -2
  499. package/dist/constants/errors.js.map +0 -1
  500. package/dist/constants/index.d.ts +0 -7
  501. package/dist/constants/index.d.ts.map +0 -1
  502. package/dist/constants/index.js +0 -11
  503. package/dist/constants/index.js.map +0 -1
  504. package/dist/constants/tools.d.ts +0 -4
  505. package/dist/constants/tools.d.ts.map +0 -1
  506. package/dist/constants/tools.js +0 -4
  507. package/dist/constants/tools.js.map +0 -1
  508. package/dist/constants/versions.d.ts +0 -2
  509. package/dist/constants/versions.d.ts.map +0 -1
  510. package/dist/constants/versions.js +0 -2
  511. package/dist/constants/versions.js.map +0 -1
  512. package/dist/context/buildUserContext.d.ts +0 -18
  513. package/dist/context/buildUserContext.d.ts.map +0 -1
  514. package/dist/context/buildUserContext.js +0 -34
  515. package/dist/context/buildUserContext.js.map +0 -1
  516. package/dist/context/index.d.ts +0 -9
  517. package/dist/context/index.d.ts.map +0 -1
  518. package/dist/context/index.js +0 -9
  519. package/dist/context/index.js.map +0 -1
  520. package/dist/context/messageManager.d.ts +0 -42
  521. package/dist/context/messageManager.d.ts.map +0 -1
  522. package/dist/context/messageManager.js +0 -322
  523. package/dist/context/messageManager.js.map +0 -1
  524. package/dist/context/taskFocus.d.ts +0 -2
  525. package/dist/context/taskFocus.d.ts.map +0 -1
  526. package/dist/context/taskFocus.js +0 -26
  527. package/dist/context/taskFocus.js.map +0 -1
  528. package/dist/context/userInput.d.ts +0 -3
  529. package/dist/context/userInput.d.ts.map +0 -1
  530. package/dist/context/userInput.js +0 -20
  531. package/dist/context/userInput.js.map +0 -1
  532. package/dist/mcp/MCPManager.d.ts +0 -109
  533. package/dist/mcp/MCPManager.d.ts.map +0 -1
  534. package/dist/mcp/MCPManager.js +0 -592
  535. package/dist/mcp/MCPManager.js.map +0 -1
  536. package/dist/mcp/approvedTools.d.ts +0 -4
  537. package/dist/mcp/approvedTools.d.ts.map +0 -1
  538. package/dist/mcp/approvedTools.js +0 -19
  539. package/dist/mcp/approvedTools.js.map +0 -1
  540. package/dist/mcp/baseServer.d.ts +0 -75
  541. package/dist/mcp/baseServer.d.ts.map +0 -1
  542. package/dist/mcp/baseServer.js +0 -107
  543. package/dist/mcp/baseServer.js.map +0 -1
  544. package/dist/mcp/builtinServers.d.ts +0 -15
  545. package/dist/mcp/builtinServers.d.ts.map +0 -1
  546. package/dist/mcp/builtinServers.js +0 -141
  547. package/dist/mcp/builtinServers.js.map +0 -1
  548. package/dist/mcp/dynamicBEServer.d.ts +0 -20
  549. package/dist/mcp/dynamicBEServer.d.ts.map +0 -1
  550. package/dist/mcp/dynamicBEServer.js +0 -52
  551. package/dist/mcp/dynamicBEServer.js.map +0 -1
  552. package/dist/mcp/index.d.ts +0 -18
  553. package/dist/mcp/index.d.ts.map +0 -1
  554. package/dist/mcp/index.js +0 -23
  555. package/dist/mcp/index.js.map +0 -1
  556. package/dist/mcp/mcpInitialization.d.ts +0 -2
  557. package/dist/mcp/mcpInitialization.d.ts.map +0 -1
  558. package/dist/mcp/mcpInitialization.js +0 -56
  559. package/dist/mcp/mcpInitialization.js.map +0 -1
  560. package/dist/mcp/servers/filesystem.d.ts +0 -44
  561. package/dist/mcp/servers/filesystem.d.ts.map +0 -1
  562. package/dist/mcp/servers/filesystem.js +0 -776
  563. package/dist/mcp/servers/filesystem.js.map +0 -1
  564. package/dist/mcp/servers/git.d.ts +0 -18
  565. package/dist/mcp/servers/git.d.ts.map +0 -1
  566. package/dist/mcp/servers/git.js +0 -441
  567. package/dist/mcp/servers/git.js.map +0 -1
  568. package/dist/mcp/servers/ripgrep.d.ts +0 -39
  569. package/dist/mcp/servers/ripgrep.d.ts.map +0 -1
  570. package/dist/mcp/servers/ripgrep.js +0 -550
  571. package/dist/mcp/servers/ripgrep.js.map +0 -1
  572. package/dist/mcp/servers/shell.d.ts +0 -20
  573. package/dist/mcp/servers/shell.d.ts.map +0 -1
  574. package/dist/mcp/servers/shell.js +0 -519
  575. package/dist/mcp/servers/shell.js.map +0 -1
  576. package/dist/mcp/serversRegistry.d.ts +0 -55
  577. package/dist/mcp/serversRegistry.d.ts.map +0 -1
  578. package/dist/mcp/serversRegistry.js +0 -416
  579. package/dist/mcp/serversRegistry.js.map +0 -1
  580. package/dist/mcp/toolProcessor.d.ts +0 -82
  581. package/dist/mcp/toolProcessor.d.ts.map +0 -1
  582. package/dist/mcp/toolProcessor.js +0 -392
  583. package/dist/mcp/toolProcessor.js.map +0 -1
  584. package/dist/mcp/types.d.ts +0 -29
  585. package/dist/mcp/types.d.ts.map +0 -1
  586. package/dist/mcp/types.js +0 -2
  587. package/dist/mcp/types.js.map +0 -1
  588. package/dist/messages/index.d.ts +0 -8
  589. package/dist/messages/index.d.ts.map +0 -1
  590. package/dist/messages/index.js +0 -7
  591. package/dist/messages/index.js.map +0 -1
  592. package/dist/messages/openai.d.ts +0 -26
  593. package/dist/messages/openai.d.ts.map +0 -1
  594. package/dist/messages/openai.js +0 -55
  595. package/dist/messages/openai.js.map +0 -1
  596. package/dist/messages/types.d.ts +0 -73
  597. package/dist/messages/types.d.ts.map +0 -1
  598. package/dist/messages/types.js +0 -78
  599. package/dist/messages/types.js.map +0 -1
  600. package/dist/parser/index.d.ts +0 -72
  601. package/dist/parser/index.d.ts.map +0 -1
  602. package/dist/parser/index.js +0 -967
  603. package/dist/parser/index.js.map +0 -1
  604. package/dist/parser/types.d.ts +0 -153
  605. package/dist/parser/types.d.ts.map +0 -1
  606. package/dist/parser/types.js +0 -6
  607. package/dist/parser/types.js.map +0 -1
  608. package/dist/parser/utils.d.ts +0 -18
  609. package/dist/parser/utils.d.ts.map +0 -1
  610. package/dist/parser/utils.js +0 -64
  611. package/dist/parser/utils.js.map +0 -1
  612. package/dist/sdk/QodoSDK.d.ts +0 -218
  613. package/dist/sdk/QodoSDK.d.ts.map +0 -1
  614. package/dist/sdk/QodoSDK.js +0 -1115
  615. package/dist/sdk/QodoSDK.js.map +0 -1
  616. package/dist/sdk/artifacts.d.ts +0 -156
  617. package/dist/sdk/artifacts.d.ts.map +0 -1
  618. package/dist/sdk/artifacts.js +0 -166
  619. package/dist/sdk/artifacts.js.map +0 -1
  620. package/dist/sdk/bootstrap.d.ts +0 -16
  621. package/dist/sdk/bootstrap.d.ts.map +0 -1
  622. package/dist/sdk/bootstrap.js +0 -28
  623. package/dist/sdk/bootstrap.js.map +0 -1
  624. package/dist/sdk/builders.d.ts +0 -54
  625. package/dist/sdk/builders.d.ts.map +0 -1
  626. package/dist/sdk/builders.js +0 -117
  627. package/dist/sdk/builders.js.map +0 -1
  628. package/dist/sdk/defaults.d.ts +0 -11
  629. package/dist/sdk/defaults.d.ts.map +0 -1
  630. package/dist/sdk/defaults.js +0 -39
  631. package/dist/sdk/defaults.js.map +0 -1
  632. package/dist/sdk/discovery.d.ts +0 -2
  633. package/dist/sdk/discovery.d.ts.map +0 -1
  634. package/dist/sdk/discovery.js +0 -25
  635. package/dist/sdk/discovery.js.map +0 -1
  636. package/dist/sdk/events.d.ts +0 -269
  637. package/dist/sdk/events.d.ts.map +0 -1
  638. package/dist/sdk/events.js +0 -69
  639. package/dist/sdk/events.js.map +0 -1
  640. package/dist/sdk/exit-expression.d.ts +0 -13
  641. package/dist/sdk/exit-expression.d.ts.map +0 -1
  642. package/dist/sdk/exit-expression.js +0 -35
  643. package/dist/sdk/exit-expression.js.map +0 -1
  644. package/dist/sdk/index.d.ts +0 -17
  645. package/dist/sdk/index.d.ts.map +0 -1
  646. package/dist/sdk/index.js +0 -17
  647. package/dist/sdk/index.js.map +0 -1
  648. package/dist/sdk/middleware.d.ts +0 -59
  649. package/dist/sdk/middleware.d.ts.map +0 -1
  650. package/dist/sdk/middleware.js +0 -69
  651. package/dist/sdk/middleware.js.map +0 -1
  652. package/dist/sdk/pipeline/PipelineBuilder.d.ts +0 -79
  653. package/dist/sdk/pipeline/PipelineBuilder.d.ts.map +0 -1
  654. package/dist/sdk/pipeline/PipelineBuilder.js +0 -129
  655. package/dist/sdk/pipeline/PipelineBuilder.js.map +0 -1
  656. package/dist/sdk/pipeline/PipelineRunner.d.ts +0 -28
  657. package/dist/sdk/pipeline/PipelineRunner.d.ts.map +0 -1
  658. package/dist/sdk/pipeline/PipelineRunner.js +0 -326
  659. package/dist/sdk/pipeline/PipelineRunner.js.map +0 -1
  660. package/dist/sdk/pipeline/compiler.d.ts +0 -24
  661. package/dist/sdk/pipeline/compiler.d.ts.map +0 -1
  662. package/dist/sdk/pipeline/compiler.js +0 -199
  663. package/dist/sdk/pipeline/compiler.js.map +0 -1
  664. package/dist/sdk/pipeline/declarative.d.ts +0 -34
  665. package/dist/sdk/pipeline/declarative.d.ts.map +0 -1
  666. package/dist/sdk/pipeline/declarative.js +0 -9
  667. package/dist/sdk/pipeline/declarative.js.map +0 -1
  668. package/dist/sdk/pipeline/index.d.ts +0 -20
  669. package/dist/sdk/pipeline/index.d.ts.map +0 -1
  670. package/dist/sdk/pipeline/index.js +0 -19
  671. package/dist/sdk/pipeline/index.js.map +0 -1
  672. package/dist/sdk/pipeline/types.d.ts +0 -93
  673. package/dist/sdk/pipeline/types.d.ts.map +0 -1
  674. package/dist/sdk/pipeline/types.js +0 -10
  675. package/dist/sdk/pipeline/types.js.map +0 -1
  676. package/dist/sdk/policies.d.ts +0 -163
  677. package/dist/sdk/policies.d.ts.map +0 -1
  678. package/dist/sdk/policies.js +0 -243
  679. package/dist/sdk/policies.js.map +0 -1
  680. package/dist/sdk/runner/AgentRunner.d.ts +0 -22
  681. package/dist/sdk/runner/AgentRunner.d.ts.map +0 -1
  682. package/dist/sdk/runner/AgentRunner.js +0 -222
  683. package/dist/sdk/runner/AgentRunner.js.map +0 -1
  684. package/dist/sdk/runner/finalize.d.ts +0 -56
  685. package/dist/sdk/runner/finalize.d.ts.map +0 -1
  686. package/dist/sdk/runner/finalize.js +0 -155
  687. package/dist/sdk/runner/finalize.js.map +0 -1
  688. package/dist/sdk/runner/formats.d.ts +0 -7
  689. package/dist/sdk/runner/formats.d.ts.map +0 -1
  690. package/dist/sdk/runner/formats.js +0 -76
  691. package/dist/sdk/runner/formats.js.map +0 -1
  692. package/dist/sdk/runner/index.d.ts +0 -9
  693. package/dist/sdk/runner/index.d.ts.map +0 -1
  694. package/dist/sdk/runner/index.js +0 -9
  695. package/dist/sdk/runner/index.js.map +0 -1
  696. package/dist/sdk/runner/progress.d.ts +0 -3
  697. package/dist/sdk/runner/progress.d.ts.map +0 -1
  698. package/dist/sdk/runner/progress.js +0 -16
  699. package/dist/sdk/runner/progress.js.map +0 -1
  700. package/dist/sdk/schemas.d.ts +0 -72
  701. package/dist/sdk/schemas.d.ts.map +0 -1
  702. package/dist/sdk/schemas.js +0 -282
  703. package/dist/sdk/schemas.js.map +0 -1
  704. package/dist/sdk/trigger-context.d.ts +0 -24
  705. package/dist/sdk/trigger-context.d.ts.map +0 -1
  706. package/dist/sdk/trigger-context.js +0 -136
  707. package/dist/sdk/trigger-context.js.map +0 -1
  708. package/dist/session/SessionContext.d.ts +0 -89
  709. package/dist/session/SessionContext.d.ts.map +0 -1
  710. package/dist/session/SessionContext.js +0 -410
  711. package/dist/session/SessionContext.js.map +0 -1
  712. package/dist/session/environment.d.ts +0 -52
  713. package/dist/session/environment.d.ts.map +0 -1
  714. package/dist/session/environment.js +0 -27
  715. package/dist/session/environment.js.map +0 -1
  716. package/dist/session/history.d.ts +0 -18
  717. package/dist/session/history.d.ts.map +0 -1
  718. package/dist/session/history.js +0 -68
  719. package/dist/session/history.js.map +0 -1
  720. package/dist/session/index.d.ts +0 -10
  721. package/dist/session/index.d.ts.map +0 -1
  722. package/dist/session/index.js +0 -9
  723. package/dist/session/index.js.map +0 -1
  724. package/dist/session/serverData.d.ts +0 -38
  725. package/dist/session/serverData.d.ts.map +0 -1
  726. package/dist/session/serverData.js +0 -261
  727. package/dist/session/serverData.js.map +0 -1
  728. package/dist/tracing/pipelineHelpers.d.ts +0 -29
  729. package/dist/tracing/pipelineHelpers.d.ts.map +0 -1
  730. package/dist/tracing/pipelineHelpers.js +0 -224
  731. package/dist/tracing/pipelineHelpers.js.map +0 -1
  732. package/dist/tracking/Tracker.d.ts +0 -55
  733. package/dist/tracking/Tracker.d.ts.map +0 -1
  734. package/dist/tracking/Tracker.js +0 -217
  735. package/dist/tracking/Tracker.js.map +0 -1
  736. package/dist/tracking/index.d.ts +0 -8
  737. package/dist/tracking/index.d.ts.map +0 -1
  738. package/dist/tracking/index.js +0 -8
  739. package/dist/tracking/index.js.map +0 -1
  740. package/dist/tracking/schemas.d.ts +0 -292
  741. package/dist/tracking/schemas.d.ts.map +0 -1
  742. package/dist/tracking/schemas.js +0 -91
  743. package/dist/tracking/schemas.js.map +0 -1
  744. package/dist/utils/extractSetFlags.d.ts +0 -6
  745. package/dist/utils/extractSetFlags.d.ts.map +0 -1
  746. package/dist/utils/extractSetFlags.js +0 -16
  747. package/dist/utils/extractSetFlags.js.map +0 -1
  748. package/dist/utils/formatTimeAgo.d.ts +0 -2
  749. package/dist/utils/formatTimeAgo.d.ts.map +0 -1
  750. package/dist/utils/formatTimeAgo.js +0 -20
  751. package/dist/utils/formatTimeAgo.js.map +0 -1
  752. package/dist/utils/index.d.ts +0 -12
  753. package/dist/utils/index.d.ts.map +0 -1
  754. package/dist/utils/index.js +0 -12
  755. package/dist/utils/index.js.map +0 -1
  756. package/dist/utils/machineId.d.ts +0 -14
  757. package/dist/utils/machineId.d.ts.map +0 -1
  758. package/dist/utils/machineId.js +0 -66
  759. package/dist/utils/machineId.js.map +0 -1
  760. package/dist/utils/pathUtils.d.ts +0 -22
  761. package/dist/utils/pathUtils.d.ts.map +0 -1
  762. package/dist/utils/pathUtils.js +0 -54
  763. package/dist/utils/pathUtils.js.map +0 -1
  764. package/scripts/download-ripgrep.js +0 -269
@@ -0,0 +1,755 @@
1
+ /**
2
+ * `SKILL.md` parser — frontmatter (minimal YAML subset) + body.
3
+ *
4
+ * **Why a hand-rolled YAML parser rather than `js-yaml` or `yaml`?** The SDK
5
+ * 2.0 has zero runtime dependencies except `ws`. Adding a 60–100 KB YAML
6
+ * parser to every install for the bounded skill-frontmatter shape would be
7
+ * disproportionate. The frontmatter contract (`skills.md` §2) covers a
8
+ * narrow YAML subset: top-level map → scalars, lists, and shallow maps. The
9
+ * 29-skill OSS survey shows no anchors, no refs, no flow-style collections,
10
+ * no tag types. We implement that subset, document the limits, and reject
11
+ * anything we don't support as a parse error.
12
+ *
13
+ * Supported YAML features:
14
+ *
15
+ * - `key: value` block-style map entries (top-level).
16
+ * - Scalar values: bare strings, single-quoted, double-quoted (with `\n` /
17
+ * `\t` / `\"` / `\\` escapes), numbers, booleans (`true`/`false`/`yes`/`no`/`on`/`off`),
18
+ * null (`null`/`~`).
19
+ * - Folded scalars: `>` and `>-`.
20
+ * - Literal scalars: `|` and `|-`.
21
+ * - Block sequences: `- item` lists, possibly of strings or `{ key: value }` maps.
22
+ * - Inline flow scalars on one line: `[a, b, c]` and `{ a: 1, b: 2 }` (shallow only).
23
+ * - Comments: `#` to end of line.
24
+ *
25
+ * Unsupported (rejected): anchors (`&`/`*`), explicit tags (`!!str`),
26
+ * complex keys, multi-line flow collections, nested maps under list entries
27
+ * beyond one level.
28
+ *
29
+ * Trailing blank lines inside literal/folded blocks are stripped per `-`
30
+ * chomp; `>+` / `|+` keep blanks (rare in skill frontmatter — supported).
31
+ */
32
+ /**
33
+ * Parse a `SKILL.md` document.
34
+ *
35
+ * Format: `---\n<yaml>\n---\n<body>`. The leading delimiter must be on the
36
+ * first line; trailing CR characters are normalized.
37
+ *
38
+ * Throws `SkillParseError` on:
39
+ * - missing frontmatter delimiters
40
+ * - YAML parse failure inside the subset we support
41
+ * - top-level YAML value that isn't a map
42
+ */
43
+ export function parseSkillDocument(text) {
44
+ const normalized = text.replace(/\r\n/g, '\n').replace(/\r/g, '\n');
45
+ // Strict opener: the file must start with `---\n` (allow a UTF-8 BOM).
46
+ const withoutBom = normalized.startsWith('') ? normalized.slice(1) : normalized;
47
+ if (!withoutBom.startsWith('---\n') && withoutBom !== '---') {
48
+ throw new SkillParseError('frontmatter is required; expected leading `---` delimiter');
49
+ }
50
+ const afterOpen = withoutBom.slice(4);
51
+ const closeIdx = findFrontmatterClose(afterOpen);
52
+ if (closeIdx === -1) {
53
+ throw new SkillParseError('frontmatter unterminated; expected closing `---` delimiter');
54
+ }
55
+ const yamlText = afterOpen.slice(0, closeIdx);
56
+ // body starts after the closing delimiter line; skip a single trailing
57
+ // newline if present so `body` matches the file's narrative content.
58
+ let bodyStart = closeIdx + 4; // past `\n---\n` excluding the leading `\n`
59
+ // Actually `closeIdx` is the offset of the close `---` within afterOpen,
60
+ // and the close line is `---` on its own. Recompute:
61
+ // findFrontmatterClose returns the offset of the leading `\n` before `---`.
62
+ // The closing line is `---` + optional `\n`. So body starts at:
63
+ // closeIdx + length('\n---') + (one trailing newline if present)
64
+ const closeMarkerLength = '\n---'.length; // 4
65
+ bodyStart = closeIdx + closeMarkerLength;
66
+ if (afterOpen[bodyStart] === '\n')
67
+ bodyStart += 1;
68
+ const body = afterOpen.slice(bodyStart);
69
+ const parsed = parseYamlMap(yamlText);
70
+ return { frontmatter: parsed, body };
71
+ }
72
+ /**
73
+ * Find the position of the closing `---` delimiter line in `text` (which is
74
+ * the YAML payload + body — the leading `---\n` has already been stripped).
75
+ *
76
+ * Returns the offset of the leading `\n` of the closing `\n---` token, or
77
+ * `-1` if no closing delimiter is found. The closing line must consist of
78
+ * exactly `---` (allowing trailing whitespace + a newline or EOF).
79
+ */
80
+ function findFrontmatterClose(text) {
81
+ // Walk line-by-line so a `---` embedded inside a literal/folded block can't
82
+ // false-match: those would be indented or quoted, but a strict line-anchor
83
+ // check is the simplest defense.
84
+ let pos = 0;
85
+ while (pos < text.length) {
86
+ const lineEnd = text.indexOf('\n', pos);
87
+ const line = lineEnd === -1 ? text.slice(pos) : text.slice(pos, lineEnd);
88
+ if (line.trimEnd() === '---') {
89
+ // Match must be preceded by start-of-document OR a newline. By
90
+ // construction `pos === 0` (only on the very first line of YAML, which
91
+ // can't itself be the close) or `text[pos-1] === '\n'`. Both qualify.
92
+ // Subtract 1 because the caller's offset math expects the leading
93
+ // `\n` to be part of the matched region. When the closing `---` is on
94
+ // the first line of YAML (impossible, but handle defensively), use 0.
95
+ return pos === 0 ? 0 : pos - 1;
96
+ }
97
+ if (lineEnd === -1)
98
+ break;
99
+ pos = lineEnd + 1;
100
+ }
101
+ return -1;
102
+ }
103
+ // ---------------------------------------------------------------------------
104
+ // YAML subset parser
105
+ // ---------------------------------------------------------------------------
106
+ /**
107
+ * Parse a YAML document containing exactly one top-level map. Throws
108
+ * `SkillParseError` on shape violations or feature use outside the
109
+ * documented subset.
110
+ */
111
+ function parseYamlMap(text) {
112
+ const lines = splitLines(text);
113
+ const ctx = { lines, pos: 0 };
114
+ const result = parseBlockMap(ctx, 0);
115
+ // After parsing the top-level map, every remaining line must be blank or
116
+ // a comment. Anything else means we stopped mid-document — typically a
117
+ // sub-map that didn't dedent back.
118
+ while (ctx.pos < ctx.lines.length) {
119
+ const line = ctx.lines[ctx.pos];
120
+ if (!isBlankOrComment(line.raw)) {
121
+ throw new SkillParseError(`unexpected content after top-level map at line ${line.lineNo}: ${trim(line.raw)}`);
122
+ }
123
+ ctx.pos += 1;
124
+ }
125
+ return result;
126
+ }
127
+ function splitLines(text) {
128
+ const out = [];
129
+ let lineNo = 1;
130
+ const split = text.split('\n');
131
+ // YAML's last line is informational; if the input ends in `\n` we get a
132
+ // trailing empty string in `split` which we silently drop.
133
+ if (split.length > 0 && split[split.length - 1] === '')
134
+ split.pop();
135
+ for (const raw of split) {
136
+ const indent = countIndent(raw);
137
+ out.push({ lineNo, raw, indent, content: raw.slice(indent) });
138
+ lineNo += 1;
139
+ }
140
+ return out;
141
+ }
142
+ function countIndent(raw) {
143
+ let i = 0;
144
+ while (i < raw.length && raw.charCodeAt(i) === 0x20 /* space */)
145
+ i += 1;
146
+ if (i < raw.length && raw.charCodeAt(i) === 0x09 /* tab */) {
147
+ throw new SkillParseError(`tab indentation is not allowed (line content: ${trim(raw)})`);
148
+ }
149
+ return i;
150
+ }
151
+ function isBlankOrComment(raw) {
152
+ const t = raw.trim();
153
+ return t.length === 0 || t.startsWith('#');
154
+ }
155
+ function trim(s) {
156
+ return s.length > 80 ? `${s.slice(0, 80)}…` : s;
157
+ }
158
+ /**
159
+ * Parse a block-style map starting at the current position, where every
160
+ * map entry must be indented to exactly `expectedIndent` columns. Returns
161
+ * once the next non-blank line dedents below `expectedIndent` or EOF.
162
+ *
163
+ * On the first call (top-level), `expectedIndent` is 0.
164
+ */
165
+ /**
166
+ * Map keys we refuse to set on any parsed object — prototype-pollution
167
+ * defense. Any of these inside a `SKILL.md` is a parse error, not silent
168
+ * ignore: silently dropping would let attackers detect filtering and
169
+ * craft payloads around it, and a loud error makes the rejection visible
170
+ * to the operator running the discovery.
171
+ */
172
+ const FORBIDDEN_MAP_KEYS = new Set([
173
+ '__proto__',
174
+ 'constructor',
175
+ 'prototype',
176
+ ]);
177
+ function parseBlockMap(ctx, expectedIndent) {
178
+ // `Object.create(null)` so the result has no inherited prototype to
179
+ // poison via `__proto__` even if a downstream consumer iterates with
180
+ // `for…in` or accesses `.constructor`. Combined with the
181
+ // `FORBIDDEN_MAP_KEYS` reject, this closes prototype-chain frontmatter
182
+ // injection (Qodo review finding #1).
183
+ const out = Object.create(null);
184
+ while (ctx.pos < ctx.lines.length) {
185
+ const line = ctx.lines[ctx.pos];
186
+ if (isBlankOrComment(line.raw)) {
187
+ ctx.pos += 1;
188
+ continue;
189
+ }
190
+ if (line.indent < expectedIndent)
191
+ break;
192
+ if (line.indent > expectedIndent) {
193
+ throw new SkillParseError(`unexpected indent at line ${line.lineNo}; expected ${expectedIndent} cols, got ${line.indent}`);
194
+ }
195
+ // Expect `key: ...` (with optional comment after the value).
196
+ const colonIdx = findMapColon(line.content);
197
+ if (colonIdx === -1) {
198
+ throw new SkillParseError(`expected 'key: value' map entry at line ${line.lineNo}: ${trim(line.raw)}`);
199
+ }
200
+ const key = parseMapKey(line.content.slice(0, colonIdx), line.lineNo);
201
+ if (FORBIDDEN_MAP_KEYS.has(key)) {
202
+ throw new SkillParseError(`forbidden map key at line ${line.lineNo}: ${JSON.stringify(key)} would mutate the object prototype`);
203
+ }
204
+ let rest = line.content.slice(colonIdx + 1);
205
+ // Strip a single leading space so `key: value` and `key:value` both work.
206
+ if (rest.startsWith(' '))
207
+ rest = rest.slice(1);
208
+ rest = stripTrailingComment(rest).trimEnd();
209
+ ctx.pos += 1;
210
+ if (rest === '') {
211
+ // Value is on subsequent indented lines. Peek to decide map vs list vs block scalar.
212
+ const nextNonBlank = peekNextNonBlank(ctx);
213
+ if (nextNonBlank === null) {
214
+ out[key] = null;
215
+ continue;
216
+ }
217
+ if (nextNonBlank.indent <= expectedIndent) {
218
+ out[key] = null;
219
+ continue;
220
+ }
221
+ if (nextNonBlank.content.startsWith('- ') || nextNonBlank.content === '-') {
222
+ out[key] = parseBlockSequence(ctx, nextNonBlank.indent);
223
+ }
224
+ else {
225
+ out[key] = parseBlockMap(ctx, nextNonBlank.indent);
226
+ }
227
+ continue;
228
+ }
229
+ // Value on the same line. Could be a block scalar header (`>-`, `|`),
230
+ // flow scalar, or plain.
231
+ if (rest === '|' || rest === '|-' || rest === '|+' || rest === '>' || rest === '>-' || rest === '>+') {
232
+ out[key] = parseBlockScalar(ctx, expectedIndent, rest);
233
+ continue;
234
+ }
235
+ if (rest === '[]') {
236
+ out[key] = [];
237
+ continue;
238
+ }
239
+ if (rest === '{}') {
240
+ out[key] = {};
241
+ continue;
242
+ }
243
+ out[key] = parseFlowScalar(rest, line.lineNo);
244
+ }
245
+ return out;
246
+ }
247
+ /**
248
+ * Parse a block sequence (`- item` lines) starting at `ctx.pos`, where every
249
+ * entry is indented to exactly `entryIndent` columns. Returns once the next
250
+ * non-blank line dedents below `entryIndent`.
251
+ *
252
+ * Each entry value may be a scalar (`- foo`), an inline flow collection
253
+ * (`- [1, 2]`), or a one-level-deep block map (`- key: value\n other: ...`).
254
+ */
255
+ function parseBlockSequence(ctx, entryIndent) {
256
+ const out = [];
257
+ while (ctx.pos < ctx.lines.length) {
258
+ const line = ctx.lines[ctx.pos];
259
+ if (isBlankOrComment(line.raw)) {
260
+ ctx.pos += 1;
261
+ continue;
262
+ }
263
+ if (line.indent < entryIndent)
264
+ break;
265
+ if (line.indent > entryIndent) {
266
+ throw new SkillParseError(`unexpected indent inside block sequence at line ${line.lineNo}`);
267
+ }
268
+ if (!line.content.startsWith('-')) {
269
+ throw new SkillParseError(`expected '-' at start of sequence entry at line ${line.lineNo}: ${trim(line.raw)}`);
270
+ }
271
+ let entryBody = line.content.slice(1);
272
+ if (entryBody.startsWith(' '))
273
+ entryBody = entryBody.slice(1);
274
+ entryBody = stripTrailingComment(entryBody).trimEnd();
275
+ ctx.pos += 1;
276
+ if (entryBody === '') {
277
+ // Multi-line entry: indented map or sub-sequence.
278
+ const next = peekNextNonBlank(ctx);
279
+ if (next === null || next.indent <= entryIndent) {
280
+ out.push(null);
281
+ continue;
282
+ }
283
+ if (next.content.startsWith('- ') || next.content === '-') {
284
+ out.push(parseBlockSequence(ctx, next.indent));
285
+ }
286
+ else {
287
+ out.push(parseBlockMap(ctx, next.indent));
288
+ }
289
+ continue;
290
+ }
291
+ // Inline map after the dash: `- key: value`. Only the simplest single-key
292
+ // case is supported on this line; subsequent keys must be indented to
293
+ // entryIndent + 2 (the body column after `- `).
294
+ const colonIdx = findMapColon(entryBody);
295
+ if (colonIdx !== -1 && couldBeMapKey(entryBody.slice(0, colonIdx))) {
296
+ const key = parseMapKey(entryBody.slice(0, colonIdx), line.lineNo);
297
+ if (FORBIDDEN_MAP_KEYS.has(key)) {
298
+ throw new SkillParseError(`forbidden map key at line ${line.lineNo}: ${JSON.stringify(key)} would mutate the object prototype`);
299
+ }
300
+ let valueText = entryBody.slice(colonIdx + 1);
301
+ if (valueText.startsWith(' '))
302
+ valueText = valueText.slice(1);
303
+ // Prototype-pollution defense — see `parseBlockMap` for rationale.
304
+ const map = Object.create(null);
305
+ if (valueText === '') {
306
+ const next = peekNextNonBlank(ctx);
307
+ if (next !== null && next.indent > entryIndent) {
308
+ map[key] = parseBlockMap(ctx, next.indent);
309
+ }
310
+ else {
311
+ map[key] = null;
312
+ }
313
+ }
314
+ else {
315
+ map[key] = parseFlowScalar(valueText, line.lineNo);
316
+ }
317
+ // Continuation map keys on subsequent lines at entryIndent + 2.
318
+ while (ctx.pos < ctx.lines.length) {
319
+ const cont = ctx.lines[ctx.pos];
320
+ if (isBlankOrComment(cont.raw)) {
321
+ ctx.pos += 1;
322
+ continue;
323
+ }
324
+ if (cont.indent <= entryIndent)
325
+ break;
326
+ // The dash sits at column `entryIndent`; the body column is
327
+ // `entryIndent + 2`. Continuation keys at that body column belong
328
+ // to the same map entry.
329
+ if (cont.indent !== entryIndent + 2) {
330
+ throw new SkillParseError(`unexpected continuation indent inside sequence-of-maps entry at line ${cont.lineNo}`);
331
+ }
332
+ const colon = findMapColon(cont.content);
333
+ if (colon === -1) {
334
+ throw new SkillParseError(`expected 'key: value' continuation at line ${cont.lineNo}`);
335
+ }
336
+ const contKey = parseMapKey(cont.content.slice(0, colon), cont.lineNo);
337
+ if (FORBIDDEN_MAP_KEYS.has(contKey)) {
338
+ throw new SkillParseError(`forbidden map key at line ${cont.lineNo}: ${JSON.stringify(contKey)} would mutate the object prototype`);
339
+ }
340
+ let contValue = cont.content.slice(colon + 1);
341
+ if (contValue.startsWith(' '))
342
+ contValue = contValue.slice(1);
343
+ contValue = stripTrailingComment(contValue).trimEnd();
344
+ ctx.pos += 1;
345
+ if (contValue === '') {
346
+ const next = peekNextNonBlank(ctx);
347
+ if (next !== null && next.indent > cont.indent) {
348
+ map[contKey] = parseBlockMap(ctx, next.indent);
349
+ }
350
+ else {
351
+ map[contKey] = null;
352
+ }
353
+ }
354
+ else if (contValue === '|' ||
355
+ contValue === '|-' ||
356
+ contValue === '|+' ||
357
+ contValue === '>' ||
358
+ contValue === '>-' ||
359
+ contValue === '>+') {
360
+ map[contKey] = parseBlockScalar(ctx, cont.indent, contValue);
361
+ }
362
+ else {
363
+ map[contKey] = parseFlowScalar(contValue, cont.lineNo);
364
+ }
365
+ }
366
+ out.push(map);
367
+ continue;
368
+ }
369
+ // Plain scalar entry.
370
+ out.push(parseFlowScalar(entryBody, line.lineNo));
371
+ }
372
+ return out;
373
+ }
374
+ function peekNextNonBlank(ctx) {
375
+ let i = ctx.pos;
376
+ while (i < ctx.lines.length) {
377
+ const line = ctx.lines[i];
378
+ if (!isBlankOrComment(line.raw))
379
+ return line;
380
+ i += 1;
381
+ }
382
+ return null;
383
+ }
384
+ /**
385
+ * Locate the `key: value` separator colon in a single-line map entry.
386
+ *
387
+ * The colon must be followed by space or end-of-line; bare colons inside a
388
+ * quoted key or value (e.g. `"foo:bar"`) are ignored. Returns the byte
389
+ * offset of the colon, or `-1` if no map colon is found.
390
+ */
391
+ function findMapColon(line) {
392
+ let i = 0;
393
+ while (i < line.length) {
394
+ const ch = line[i];
395
+ if (ch === '"') {
396
+ const end = findStringEnd(line, i, '"');
397
+ if (end === -1)
398
+ return -1;
399
+ i = end + 1;
400
+ continue;
401
+ }
402
+ if (ch === "'") {
403
+ const end = findStringEnd(line, i, "'");
404
+ if (end === -1)
405
+ return -1;
406
+ i = end + 1;
407
+ continue;
408
+ }
409
+ if (ch === '#')
410
+ return -1; // comment — no map key here
411
+ if (ch === ':') {
412
+ const next = line[i + 1];
413
+ if (next === undefined || next === ' ' || next === '\t')
414
+ return i;
415
+ }
416
+ i += 1;
417
+ }
418
+ return -1;
419
+ }
420
+ /**
421
+ * Lightweight check that the substring before a colon looks like a YAML map
422
+ * key. Used to disambiguate `- key: value` from `- some-text:with-colon`
423
+ * (which is a plain string entry per the standard's `: ` requirement —
424
+ * already handled at `findMapColon`).
425
+ */
426
+ function couldBeMapKey(s) {
427
+ return /^[A-Za-z_$@'"][^:]*$/.test(s) && s.trim().length > 0;
428
+ }
429
+ function parseMapKey(raw, lineNo) {
430
+ const trimmed = raw.trim();
431
+ if (trimmed.length === 0) {
432
+ throw new SkillParseError(`empty map key at line ${lineNo}`);
433
+ }
434
+ if (trimmed.startsWith('"') || trimmed.startsWith("'")) {
435
+ const quote = trimmed.startsWith('"') ? '"' : "'";
436
+ const end = findStringEnd(trimmed, 0, quote);
437
+ if (end !== trimmed.length - 1) {
438
+ throw new SkillParseError(`malformed quoted map key at line ${lineNo}: ${trim(raw)}`);
439
+ }
440
+ return decodeQuotedScalar(trimmed, quote);
441
+ }
442
+ if (trimmed.includes('?') || trimmed.startsWith('!')) {
443
+ throw new SkillParseError(`complex/tagged YAML keys are not supported at line ${lineNo}: ${trim(raw)}`);
444
+ }
445
+ return trimmed;
446
+ }
447
+ function stripTrailingComment(s) {
448
+ // Strip an unquoted `# comment` from a flow-scalar value. Quoted strings
449
+ // protect their contents.
450
+ let i = 0;
451
+ let inSingle = false;
452
+ let inDouble = false;
453
+ while (i < s.length) {
454
+ const ch = s[i];
455
+ if (ch === '\\' && inDouble) {
456
+ i += 2;
457
+ continue;
458
+ }
459
+ if (ch === '"' && !inSingle)
460
+ inDouble = !inDouble;
461
+ else if (ch === "'" && !inDouble)
462
+ inSingle = !inSingle;
463
+ else if (ch === '#' && !inDouble && !inSingle) {
464
+ // Comment marker must be preceded by whitespace or start-of-string.
465
+ const prev = i === 0 ? ' ' : s[i - 1];
466
+ if (prev === ' ' || prev === '\t' || i === 0)
467
+ return s.slice(0, i);
468
+ }
469
+ i += 1;
470
+ }
471
+ return s;
472
+ }
473
+ /**
474
+ * Parse a one-line flow scalar — quoted string, number, boolean, null, or
475
+ * shallow inline collection.
476
+ */
477
+ function parseFlowScalar(text, lineNo) {
478
+ const t = text.trim();
479
+ if (t === '')
480
+ return null;
481
+ if (t.startsWith('"')) {
482
+ const end = findStringEnd(t, 0, '"');
483
+ if (end !== t.length - 1) {
484
+ throw new SkillParseError(`malformed double-quoted scalar at line ${lineNo}: ${trim(text)}`);
485
+ }
486
+ return decodeQuotedScalar(t, '"');
487
+ }
488
+ if (t.startsWith("'")) {
489
+ const end = findStringEnd(t, 0, "'");
490
+ if (end !== t.length - 1) {
491
+ throw new SkillParseError(`malformed single-quoted scalar at line ${lineNo}: ${trim(text)}`);
492
+ }
493
+ return decodeQuotedScalar(t, "'");
494
+ }
495
+ if (t.startsWith('[')) {
496
+ return parseFlowSequence(t, lineNo);
497
+ }
498
+ if (t.startsWith('{')) {
499
+ return parseFlowMap(t, lineNo);
500
+ }
501
+ if (t === 'null' || t === '~' || t === 'Null' || t === 'NULL')
502
+ return null;
503
+ if (t === 'true' || t === 'True' || t === 'TRUE' || t === 'yes' || t === 'Yes' || t === 'YES' || t === 'on' || t === 'On' || t === 'ON')
504
+ return true;
505
+ if (t === 'false' || t === 'False' || t === 'FALSE' || t === 'no' || t === 'No' || t === 'NO' || t === 'off' || t === 'Off' || t === 'OFF')
506
+ return false;
507
+ // Try numeric — integer or float.
508
+ if (/^-?\d+$/.test(t)) {
509
+ const n = Number(t);
510
+ if (Number.isFinite(n) && Number.isSafeInteger(n))
511
+ return n;
512
+ }
513
+ if (/^-?\d+\.\d+(e[-+]?\d+)?$/i.test(t)) {
514
+ const n = Number(t);
515
+ if (Number.isFinite(n))
516
+ return n;
517
+ }
518
+ // Fall through — plain string.
519
+ return t;
520
+ }
521
+ function parseFlowSequence(text, lineNo) {
522
+ if (!text.endsWith(']')) {
523
+ throw new SkillParseError(`unterminated flow sequence at line ${lineNo}`);
524
+ }
525
+ const inner = text.slice(1, -1).trim();
526
+ if (inner.length === 0)
527
+ return [];
528
+ const parts = splitFlowParts(inner, lineNo);
529
+ return parts.map((p) => parseFlowScalar(p, lineNo));
530
+ }
531
+ function parseFlowMap(text, lineNo) {
532
+ if (!text.endsWith('}')) {
533
+ throw new SkillParseError(`unterminated flow map at line ${lineNo}`);
534
+ }
535
+ const inner = text.slice(1, -1).trim();
536
+ if (inner.length === 0)
537
+ return Object.create(null);
538
+ const parts = splitFlowParts(inner, lineNo);
539
+ // Prototype-pollution defense — see `parseBlockMap` for rationale.
540
+ const out = Object.create(null);
541
+ for (const part of parts) {
542
+ const colon = findMapColon(part);
543
+ if (colon === -1) {
544
+ throw new SkillParseError(`flow map entry missing ':' at line ${lineNo}: ${trim(part)}`);
545
+ }
546
+ const key = parseMapKey(part.slice(0, colon), lineNo);
547
+ if (FORBIDDEN_MAP_KEYS.has(key)) {
548
+ throw new SkillParseError(`forbidden map key at line ${lineNo}: ${JSON.stringify(key)} would mutate the object prototype`);
549
+ }
550
+ const value = part.slice(colon + 1).trim();
551
+ out[key] = parseFlowScalar(value, lineNo);
552
+ }
553
+ return out;
554
+ }
555
+ function splitFlowParts(inner, lineNo) {
556
+ const parts = [];
557
+ let depth = 0;
558
+ let start = 0;
559
+ let inSingle = false;
560
+ let inDouble = false;
561
+ for (let i = 0; i < inner.length; i++) {
562
+ const ch = inner[i];
563
+ if (ch === '\\' && inDouble) {
564
+ i += 1;
565
+ continue;
566
+ }
567
+ if (ch === '"' && !inSingle) {
568
+ inDouble = !inDouble;
569
+ continue;
570
+ }
571
+ if (ch === "'" && !inDouble) {
572
+ inSingle = !inSingle;
573
+ continue;
574
+ }
575
+ if (inSingle || inDouble)
576
+ continue;
577
+ if (ch === '[' || ch === '{')
578
+ depth += 1;
579
+ else if (ch === ']' || ch === '}')
580
+ depth -= 1;
581
+ else if (ch === ',' && depth === 0) {
582
+ parts.push(inner.slice(start, i).trim());
583
+ start = i + 1;
584
+ }
585
+ }
586
+ if (depth !== 0 || inSingle || inDouble) {
587
+ throw new SkillParseError(`unbalanced flow collection at line ${lineNo}`);
588
+ }
589
+ parts.push(inner.slice(start).trim());
590
+ return parts;
591
+ }
592
+ function findStringEnd(s, openIdx, quote) {
593
+ let i = openIdx + 1;
594
+ while (i < s.length) {
595
+ const ch = s[i];
596
+ if (quote === '"' && ch === '\\') {
597
+ i += 2;
598
+ continue;
599
+ }
600
+ if (quote === "'" && ch === "'" && s[i + 1] === "'") {
601
+ // single-quoted YAML doubles a quote to escape it
602
+ i += 2;
603
+ continue;
604
+ }
605
+ if (ch === quote)
606
+ return i;
607
+ i += 1;
608
+ }
609
+ return -1;
610
+ }
611
+ function decodeQuotedScalar(text, quote) {
612
+ const inner = text.slice(1, -1);
613
+ if (quote === "'") {
614
+ // single-quoted: only `''` -> `'`.
615
+ return inner.replace(/''/g, "'");
616
+ }
617
+ // double-quoted: handle common backslash escapes.
618
+ let out = '';
619
+ for (let i = 0; i < inner.length; i++) {
620
+ const ch = inner[i];
621
+ if (ch !== '\\') {
622
+ out += ch;
623
+ continue;
624
+ }
625
+ const next = inner[i + 1];
626
+ i += 1;
627
+ switch (next) {
628
+ case 'n':
629
+ out += '\n';
630
+ break;
631
+ case 't':
632
+ out += '\t';
633
+ break;
634
+ case 'r':
635
+ out += '\r';
636
+ break;
637
+ case '"':
638
+ out += '"';
639
+ break;
640
+ case '\\':
641
+ out += '\\';
642
+ break;
643
+ case '/':
644
+ out += '/';
645
+ break;
646
+ case 'b':
647
+ out += '\b';
648
+ break;
649
+ case 'f':
650
+ out += '\f';
651
+ break;
652
+ case '0':
653
+ out += '\0';
654
+ break;
655
+ case undefined:
656
+ // trailing backslash — treat literally
657
+ out += '\\';
658
+ break;
659
+ default:
660
+ // Unknown escape — preserve literally so consumers see what's wrong
661
+ out += `\\${next}`;
662
+ }
663
+ }
664
+ return out;
665
+ }
666
+ /**
667
+ * Parse a block scalar (`|`, `|-`, `|+`, `>`, `>-`, `>+`) starting at
668
+ * `ctx.pos`. The header (`rest`) is the scalar's style indicator. The
669
+ * scalar reads consecutive lines indented strictly more than `parentIndent`
670
+ * until a dedent or EOF.
671
+ */
672
+ function parseBlockScalar(ctx, parentIndent, header) {
673
+ const isFolded = header.startsWith('>');
674
+ const chomping = header.endsWith('-') ? 'strip' : header.endsWith('+') ? 'keep' : 'clip';
675
+ // Determine the scalar's indent: the leading whitespace of the first
676
+ // non-blank line strictly greater than `parentIndent`.
677
+ let scalarIndent = null;
678
+ const collected = [];
679
+ while (ctx.pos < ctx.lines.length) {
680
+ const line = ctx.lines[ctx.pos];
681
+ if (line.raw === '' || /^\s*$/.test(line.raw)) {
682
+ // Blank — keep as empty string. Decisions on the trailing blank set
683
+ // are deferred to the chomping pass below.
684
+ collected.push('');
685
+ ctx.pos += 1;
686
+ continue;
687
+ }
688
+ if (scalarIndent === null) {
689
+ if (line.indent <= parentIndent)
690
+ break;
691
+ scalarIndent = line.indent;
692
+ }
693
+ else if (line.indent < scalarIndent) {
694
+ // a non-blank line dedenting below scalar indent ends the scalar
695
+ break;
696
+ }
697
+ collected.push(line.raw.slice(scalarIndent));
698
+ ctx.pos += 1;
699
+ }
700
+ // Apply chomping to trailing blanks.
701
+ while (collected.length > 0 &&
702
+ collected[collected.length - 1] === '' &&
703
+ (chomping === 'strip' || chomping === 'clip')) {
704
+ collected.pop();
705
+ }
706
+ if (isFolded) {
707
+ return foldBlockLines(collected) + chompingEnding(chomping);
708
+ }
709
+ return collected.join('\n') + chompingEnding(chomping);
710
+ }
711
+ function chompingEnding(c) {
712
+ if (c === 'strip')
713
+ return '';
714
+ return '\n';
715
+ }
716
+ /**
717
+ * Fold a list of block lines per YAML `>` folding semantics:
718
+ * adjacent non-empty lines join with a single space; blank lines turn into
719
+ * one newline (more than one blank → that many newlines minus one).
720
+ */
721
+ function foldBlockLines(lines) {
722
+ let out = '';
723
+ let prevBlank = false;
724
+ for (let i = 0; i < lines.length; i++) {
725
+ const line = lines[i];
726
+ if (line === '') {
727
+ out += '\n';
728
+ prevBlank = true;
729
+ continue;
730
+ }
731
+ if (i === 0) {
732
+ out += line;
733
+ }
734
+ else if (prevBlank) {
735
+ out += line;
736
+ }
737
+ else {
738
+ out += ` ${line}`;
739
+ }
740
+ prevBlank = false;
741
+ }
742
+ return out;
743
+ }
744
+ /**
745
+ * Thrown by `parseSkillDocument` and the underlying YAML walker. The
746
+ * manager wraps these into `sdk.skill.error` events with the offending
747
+ * skill's path attached.
748
+ */
749
+ export class SkillParseError extends Error {
750
+ constructor(message) {
751
+ super(message);
752
+ this.name = 'SkillParseError';
753
+ }
754
+ }
755
+ //# sourceMappingURL=parser.js.map