@rpamis/comet 0.4.0-beta.16 → 0.4.0-beta.18

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 (761) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +85 -56
  3. package/assets/eval-reports/comet-native-vs-beta16-beta17-20260810/native-benchmark-report.html +8 -0
  4. package/assets/eval-reports/comet-native-vs-beta16-beta17-20260810/native-benchmark-report.json +286 -0
  5. package/assets/manifest.json +26 -17
  6. package/assets/skills/comet/SKILL.md +1 -1
  7. package/assets/skills/comet/agents/openai.yaml +3 -0
  8. package/assets/skills/comet/rules/comet-phase-guard.en.md +1 -1
  9. package/assets/skills/comet/rules/comet-phase-guard.md +1 -1
  10. package/assets/skills/comet/rules/comet-workflow-guard.en.md +2 -2
  11. package/assets/skills/comet/rules/comet-workflow-guard.md +2 -2
  12. package/assets/skills/comet/scripts/comet-archive.mjs +128 -128
  13. package/assets/skills/comet/scripts/comet-entry-runtime.mjs +77 -77
  14. package/assets/skills/comet/scripts/comet-guard.mjs +144 -144
  15. package/assets/skills/comet/scripts/comet-handoff.mjs +107 -107
  16. package/assets/skills/comet/scripts/comet-hook-guard.mjs +128 -128
  17. package/assets/skills/comet/scripts/comet-hook-router.mjs +143 -141
  18. package/assets/skills/comet/scripts/comet-resume-probe.mjs +100 -100
  19. package/assets/skills/comet/scripts/comet-runtime.mjs +194 -193
  20. package/assets/skills/comet/scripts/comet-state.mjs +118 -118
  21. package/assets/skills/comet/scripts/comet-yaml-validate.mjs +95 -95
  22. package/assets/skills/comet-any/SKILL.md +2 -1
  23. package/assets/skills/comet-any/agents/openai.yaml +5 -0
  24. package/assets/skills/comet-archive/SKILL.md +7 -6
  25. package/assets/skills/comet-archive/agents/openai.yaml +5 -0
  26. package/assets/skills/comet-build/SKILL.md +28 -68
  27. package/assets/skills/comet-build/agents/openai.yaml +5 -0
  28. package/assets/skills/comet-classic/SKILL.md +28 -22
  29. package/assets/skills/comet-classic/agents/openai.yaml +3 -0
  30. package/assets/skills/{comet → comet-classic}/reference/auto-transition.md +1 -1
  31. package/assets/skills/{comet → comet-classic}/reference/comet-yaml-fields.md +3 -3
  32. package/assets/skills/{comet → comet-classic}/reference/context-recovery.md +5 -5
  33. package/assets/skills/{comet → comet-classic}/reference/debug-gate.md +2 -2
  34. package/assets/skills/{comet → comet-classic}/reference/decision-point.md +1 -1
  35. package/assets/skills/{comet → comet-classic}/reference/dirty-worktree.md +1 -1
  36. package/assets/skills/{comet → comet-classic}/reference/file-structure.md +1 -1
  37. package/assets/skills/{comet → comet-classic}/reference/intent-frame.md +1 -1
  38. package/assets/skills/{comet → comet-classic}/reference/scripts.md +4 -2
  39. package/assets/skills/{comet → comet-classic}/reference/subagent-dispatch.md +1 -1
  40. package/assets/skills/comet-classic/reference/workspace.md +23 -0
  41. package/assets/skills/comet-design/SKILL.md +7 -6
  42. package/assets/skills/comet-design/agents/openai.yaml +5 -0
  43. package/assets/skills/comet-hotfix/SKILL.md +10 -9
  44. package/assets/skills/comet-hotfix/agents/openai.yaml +5 -0
  45. package/assets/skills/comet-native/SKILL.md +60 -171
  46. package/assets/skills/comet-native/agents/openai.yaml +3 -0
  47. package/assets/skills/comet-native/reference/artifacts.md +24 -89
  48. package/assets/skills/comet-native/reference/clarification.md +54 -29
  49. package/assets/skills/comet-native/reference/commands.md +30 -173
  50. package/assets/skills/comet-native/reference/recovery.md +38 -88
  51. package/assets/skills/comet-native/reference/workspace.md +23 -0
  52. package/assets/skills/comet-native/scripts/comet-native-archive.mjs +184 -152
  53. package/assets/skills/comet-native/scripts/comet-native-doctor.mjs +214 -158
  54. package/assets/skills/comet-native/scripts/comet-native-hook-guard.mjs +132 -123
  55. package/assets/skills/comet-native/scripts/comet-native-init.mjs +134 -124
  56. package/assets/skills/comet-native/scripts/comet-native-new.mjs +165 -158
  57. package/assets/skills/comet-native/scripts/comet-native-next.mjs +183 -152
  58. package/assets/skills/comet-native/scripts/comet-native-root.mjs +152 -147
  59. package/assets/skills/comet-native/scripts/comet-native-runtime.mjs +247 -202
  60. package/assets/skills/comet-native/scripts/comet-native-select.mjs +150 -143
  61. package/assets/skills/comet-native/scripts/comet-native-show.mjs +128 -121
  62. package/assets/skills/comet-native/scripts/comet-native-spec.mjs +133 -151
  63. package/assets/skills/comet-native/scripts/comet-native-status.mjs +147 -140
  64. package/assets/skills/comet-open/SKILL.md +31 -11
  65. package/assets/skills/comet-open/agents/openai.yaml +5 -0
  66. package/assets/skills/comet-tweak/SKILL.md +11 -10
  67. package/assets/skills/comet-tweak/agents/openai.yaml +5 -0
  68. package/assets/skills/comet-verify/SKILL.md +9 -8
  69. package/assets/skills/comet-verify/agents/openai.yaml +5 -0
  70. package/assets/skills-zh/comet/SKILL.md +1 -1
  71. package/assets/skills-zh/comet/agents/openai.yaml +3 -0
  72. package/assets/skills-zh/comet-any/SKILL.md +2 -1
  73. package/assets/skills-zh/comet-any/agents/openai.yaml +5 -0
  74. package/assets/skills-zh/comet-archive/SKILL.md +7 -6
  75. package/assets/skills-zh/comet-archive/agents/openai.yaml +5 -0
  76. package/assets/skills-zh/comet-build/SKILL.md +28 -68
  77. package/assets/skills-zh/comet-build/agents/openai.yaml +5 -0
  78. package/assets/skills-zh/comet-classic/SKILL.md +29 -23
  79. package/assets/skills-zh/comet-classic/agents/openai.yaml +3 -0
  80. package/assets/skills-zh/{comet → comet-classic}/reference/auto-transition.md +1 -1
  81. package/assets/skills-zh/{comet → comet-classic}/reference/comet-yaml-fields.md +3 -3
  82. package/assets/skills-zh/{comet → comet-classic}/reference/context-recovery.md +5 -5
  83. package/assets/skills-zh/{comet → comet-classic}/reference/debug-gate.md +2 -2
  84. package/assets/skills-zh/{comet → comet-classic}/reference/decision-point.md +1 -1
  85. package/assets/skills-zh/{comet → comet-classic}/reference/dirty-worktree.md +1 -1
  86. package/assets/skills-zh/{comet → comet-classic}/reference/file-structure.md +1 -1
  87. package/assets/skills-zh/{comet → comet-classic}/reference/intent-frame.md +1 -1
  88. package/assets/skills-zh/{comet → comet-classic}/reference/scripts.md +4 -2
  89. package/assets/skills-zh/{comet → comet-classic}/reference/subagent-dispatch.md +1 -1
  90. package/assets/skills-zh/comet-classic/reference/workspace.md +23 -0
  91. package/assets/skills-zh/comet-design/SKILL.md +7 -6
  92. package/assets/skills-zh/comet-design/agents/openai.yaml +5 -0
  93. package/assets/skills-zh/comet-hotfix/SKILL.md +10 -9
  94. package/assets/skills-zh/comet-hotfix/agents/openai.yaml +5 -0
  95. package/assets/skills-zh/comet-native/SKILL.md +60 -171
  96. package/assets/skills-zh/comet-native/agents/openai.yaml +3 -0
  97. package/assets/skills-zh/comet-native/reference/artifacts.md +24 -89
  98. package/assets/skills-zh/comet-native/reference/clarification.md +40 -15
  99. package/assets/skills-zh/comet-native/reference/commands.md +30 -173
  100. package/assets/skills-zh/comet-native/reference/recovery.md +36 -86
  101. package/assets/skills-zh/comet-native/reference/workspace.md +23 -0
  102. package/assets/skills-zh/comet-open/SKILL.md +31 -11
  103. package/assets/skills-zh/comet-open/agents/openai.yaml +5 -0
  104. package/assets/skills-zh/comet-tweak/SKILL.md +11 -10
  105. package/assets/skills-zh/comet-tweak/agents/openai.yaml +5 -0
  106. package/assets/skills-zh/comet-verify/SKILL.md +9 -8
  107. package/assets/skills-zh/comet-verify/agents/openai.yaml +5 -0
  108. package/bin/fast-runtime-router.js +0 -4
  109. package/dist/app/cli/index.js +20 -1
  110. package/dist/app/cli/index.js.map +1 -1
  111. package/dist/app/commands/classic.d.ts.map +1 -1
  112. package/dist/app/commands/classic.js +2 -0
  113. package/dist/app/commands/classic.js.map +1 -1
  114. package/dist/app/commands/doctor.d.ts.map +1 -1
  115. package/dist/app/commands/doctor.js +8 -0
  116. package/dist/app/commands/doctor.js.map +1 -1
  117. package/dist/app/commands/eval.d.ts +9 -2
  118. package/dist/app/commands/eval.d.ts.map +1 -1
  119. package/dist/app/commands/eval.js +293 -48
  120. package/dist/app/commands/eval.js.map +1 -1
  121. package/dist/app/commands/init.d.ts.map +1 -1
  122. package/dist/app/commands/init.js +11 -2
  123. package/dist/app/commands/init.js.map +1 -1
  124. package/dist/app/commands/update.d.ts.map +1 -1
  125. package/dist/app/commands/update.js +13 -3
  126. package/dist/app/commands/update.js.map +1 -1
  127. package/dist/config/repository-layout.json +0 -8
  128. package/dist/domains/bundle/bundle-platform.d.ts.map +1 -1
  129. package/dist/domains/bundle/bundle-platform.js +8 -0
  130. package/dist/domains/bundle/bundle-platform.js.map +1 -1
  131. package/dist/domains/bundle/types.d.ts +1 -1
  132. package/dist/domains/bundle/types.d.ts.map +1 -1
  133. package/dist/domains/comet-classic/classic-cli.d.ts +1 -1
  134. package/dist/domains/comet-classic/classic-cli.d.ts.map +1 -1
  135. package/dist/domains/comet-classic/classic-cli.js +3 -0
  136. package/dist/domains/comet-classic/classic-cli.js.map +1 -1
  137. package/dist/domains/comet-classic/classic-current-change.d.ts.map +1 -1
  138. package/dist/domains/comet-classic/classic-current-change.js +29 -3
  139. package/dist/domains/comet-classic/classic-current-change.js.map +1 -1
  140. package/dist/domains/comet-classic/classic-guard.js +2 -2
  141. package/dist/domains/comet-classic/classic-guard.js.map +1 -1
  142. package/dist/domains/comet-classic/classic-hook-guard.d.ts.map +1 -1
  143. package/dist/domains/comet-classic/classic-hook-guard.js +14 -1
  144. package/dist/domains/comet-classic/classic-hook-guard.js.map +1 -1
  145. package/dist/domains/comet-classic/classic-state-command.d.ts.map +1 -1
  146. package/dist/domains/comet-classic/classic-state-command.js +31 -8
  147. package/dist/domains/comet-classic/classic-state-command.js.map +1 -1
  148. package/dist/domains/comet-classic/classic-workspace-command.d.ts +3 -0
  149. package/dist/domains/comet-classic/classic-workspace-command.d.ts.map +1 -0
  150. package/dist/domains/comet-classic/classic-workspace-command.js +45 -0
  151. package/dist/domains/comet-classic/classic-workspace-command.js.map +1 -0
  152. package/dist/domains/comet-classic/classic-workspace.d.ts +38 -0
  153. package/dist/domains/comet-classic/classic-workspace.d.ts.map +1 -0
  154. package/dist/domains/comet-classic/classic-workspace.js +315 -0
  155. package/dist/domains/comet-classic/classic-workspace.js.map +1 -0
  156. package/dist/domains/comet-entry/hook-adapter.d.ts.map +1 -1
  157. package/dist/domains/comet-entry/hook-adapter.js +3 -0
  158. package/dist/domains/comet-entry/hook-adapter.js.map +1 -1
  159. package/dist/domains/comet-entry/hook-router-entry.d.ts +2 -0
  160. package/dist/domains/comet-entry/hook-router-entry.d.ts.map +1 -1
  161. package/dist/domains/comet-entry/hook-router-entry.js +32 -3
  162. package/dist/domains/comet-entry/hook-router-entry.js.map +1 -1
  163. package/dist/domains/comet-entry/init-workflow.d.ts.map +1 -1
  164. package/dist/domains/comet-entry/init-workflow.js +13 -5
  165. package/dist/domains/comet-entry/init-workflow.js.map +1 -1
  166. package/dist/domains/comet-entry/project-activation.d.ts.map +1 -1
  167. package/dist/domains/comet-entry/project-activation.js +2 -1
  168. package/dist/domains/comet-entry/project-activation.js.map +1 -1
  169. package/dist/domains/comet-entry/resume-probe.d.ts.map +1 -1
  170. package/dist/domains/comet-entry/resume-probe.js +48 -4
  171. package/dist/domains/comet-entry/resume-probe.js.map +1 -1
  172. package/dist/domains/comet-native/index.d.ts +1 -0
  173. package/dist/domains/comet-native/index.d.ts.map +1 -1
  174. package/dist/domains/comet-native/index.js +1 -0
  175. package/dist/domains/comet-native/index.js.map +1 -1
  176. package/dist/domains/comet-native/native-acceptance.d.ts +4 -3
  177. package/dist/domains/comet-native/native-acceptance.d.ts.map +1 -1
  178. package/dist/domains/comet-native/native-acceptance.js +23 -18
  179. package/dist/domains/comet-native/native-acceptance.js.map +1 -1
  180. package/dist/domains/comet-native/native-archive-command.d.ts.map +1 -1
  181. package/dist/domains/comet-native/native-archive-command.js +204 -61
  182. package/dist/domains/comet-native/native-archive-command.js.map +1 -1
  183. package/dist/domains/comet-native/native-archive-transaction.d.ts.map +1 -1
  184. package/dist/domains/comet-native/native-archive-transaction.js +28 -23
  185. package/dist/domains/comet-native/native-archive-transaction.js.map +1 -1
  186. package/dist/domains/comet-native/native-archive.d.ts +1 -0
  187. package/dist/domains/comet-native/native-archive.d.ts.map +1 -1
  188. package/dist/domains/comet-native/native-archive.js +56 -12
  189. package/dist/domains/comet-native/native-archive.js.map +1 -1
  190. package/dist/domains/comet-native/native-bounded-file.d.ts +32 -2
  191. package/dist/domains/comet-native/native-bounded-file.d.ts.map +1 -1
  192. package/dist/domains/comet-native/native-bounded-file.js +87 -6
  193. package/dist/domains/comet-native/native-bounded-file.js.map +1 -1
  194. package/dist/domains/comet-native/native-build-evidence.d.ts.map +1 -1
  195. package/dist/domains/comet-native/native-build-evidence.js +23 -1
  196. package/dist/domains/comet-native/native-build-evidence.js.map +1 -1
  197. package/dist/domains/comet-native/native-change.d.ts +1 -0
  198. package/dist/domains/comet-native/native-change.d.ts.map +1 -1
  199. package/dist/domains/comet-native/native-change.js +96 -8
  200. package/dist/domains/comet-native/native-change.js.map +1 -1
  201. package/dist/domains/comet-native/native-check-executor.d.ts +36 -0
  202. package/dist/domains/comet-native/native-check-executor.d.ts.map +1 -0
  203. package/dist/domains/comet-native/native-check-executor.js +132 -0
  204. package/dist/domains/comet-native/native-check-executor.js.map +1 -0
  205. package/dist/domains/comet-native/native-check-receipt-model.d.ts +9 -0
  206. package/dist/domains/comet-native/native-check-receipt-model.d.ts.map +1 -1
  207. package/dist/domains/comet-native/native-check-receipt-model.js +70 -8
  208. package/dist/domains/comet-native/native-check-receipt-model.js.map +1 -1
  209. package/dist/domains/comet-native/native-check-receipt-storage.d.ts.map +1 -1
  210. package/dist/domains/comet-native/native-check-receipt-storage.js +9 -8
  211. package/dist/domains/comet-native/native-check-receipt-storage.js.map +1 -1
  212. package/dist/domains/comet-native/native-check-receipt.d.ts.map +1 -1
  213. package/dist/domains/comet-native/native-check-receipt.js +123 -60
  214. package/dist/domains/comet-native/native-check-receipt.js.map +1 -1
  215. package/dist/domains/comet-native/native-checkpoint-command.d.ts.map +1 -1
  216. package/dist/domains/comet-native/native-checkpoint-command.js +0 -6
  217. package/dist/domains/comet-native/native-checkpoint-command.js.map +1 -1
  218. package/dist/domains/comet-native/native-checkpoint-storage.d.ts.map +1 -1
  219. package/dist/domains/comet-native/native-checkpoint-storage.js +27 -19
  220. package/dist/domains/comet-native/native-checkpoint-storage.js.map +1 -1
  221. package/dist/domains/comet-native/native-children.d.ts +49 -0
  222. package/dist/domains/comet-native/native-children.d.ts.map +1 -0
  223. package/dist/domains/comet-native/native-children.js +388 -0
  224. package/dist/domains/comet-native/native-children.js.map +1 -0
  225. package/dist/domains/comet-native/native-cli-help.d.ts +6 -0
  226. package/dist/domains/comet-native/native-cli-help.d.ts.map +1 -0
  227. package/dist/domains/comet-native/native-cli-help.js +192 -0
  228. package/dist/domains/comet-native/native-cli-help.js.map +1 -0
  229. package/dist/domains/comet-native/native-cli-shared.d.ts +2 -2
  230. package/dist/domains/comet-native/native-cli-shared.d.ts.map +1 -1
  231. package/dist/domains/comet-native/native-cli-shared.js +46 -24
  232. package/dist/domains/comet-native/native-cli-shared.js.map +1 -1
  233. package/dist/domains/comet-native/native-cli.d.ts.map +1 -1
  234. package/dist/domains/comet-native/native-cli.js +18 -11
  235. package/dist/domains/comet-native/native-cli.js.map +1 -1
  236. package/dist/domains/comet-native/native-config.d.ts +2 -1
  237. package/dist/domains/comet-native/native-config.d.ts.map +1 -1
  238. package/dist/domains/comet-native/native-config.js +2 -1
  239. package/dist/domains/comet-native/native-config.js.map +1 -1
  240. package/dist/domains/comet-native/native-continuation.d.ts.map +1 -1
  241. package/dist/domains/comet-native/native-continuation.js +175 -147
  242. package/dist/domains/comet-native/native-continuation.js.map +1 -1
  243. package/dist/domains/comet-native/native-diagnostics.d.ts.map +1 -1
  244. package/dist/domains/comet-native/native-diagnostics.js +96 -13
  245. package/dist/domains/comet-native/native-diagnostics.js.map +1 -1
  246. package/dist/domains/comet-native/native-doctor-command.d.ts.map +1 -1
  247. package/dist/domains/comet-native/native-doctor-command.js +332 -0
  248. package/dist/domains/comet-native/native-doctor-command.js.map +1 -1
  249. package/dist/domains/comet-native/native-doctor.d.ts +1 -0
  250. package/dist/domains/comet-native/native-doctor.d.ts.map +1 -1
  251. package/dist/domains/comet-native/native-doctor.js +116 -22
  252. package/dist/domains/comet-native/native-doctor.js.map +1 -1
  253. package/dist/domains/comet-native/native-evidence-projection.d.ts +50 -0
  254. package/dist/domains/comet-native/native-evidence-projection.d.ts.map +1 -0
  255. package/dist/domains/comet-native/native-evidence-projection.js +284 -0
  256. package/dist/domains/comet-native/native-evidence-projection.js.map +1 -0
  257. package/dist/domains/comet-native/native-evidence-retention.d.ts.map +1 -1
  258. package/dist/domains/comet-native/native-evidence-retention.js +14 -12
  259. package/dist/domains/comet-native/native-evidence-retention.js.map +1 -1
  260. package/dist/domains/comet-native/native-evidence-storage.d.ts.map +1 -1
  261. package/dist/domains/comet-native/native-evidence-storage.js +14 -11
  262. package/dist/domains/comet-native/native-evidence-storage.js.map +1 -1
  263. package/dist/domains/comet-native/native-findings.d.ts.map +1 -1
  264. package/dist/domains/comet-native/native-findings.js +18 -0
  265. package/dist/domains/comet-native/native-findings.js.map +1 -1
  266. package/dist/domains/comet-native/native-git-provenance.d.ts +16 -0
  267. package/dist/domains/comet-native/native-git-provenance.d.ts.map +1 -0
  268. package/dist/domains/comet-native/native-git-provenance.js +171 -0
  269. package/dist/domains/comet-native/native-git-provenance.js.map +1 -0
  270. package/dist/domains/comet-native/native-hook-guard.d.ts.map +1 -1
  271. package/dist/domains/comet-native/native-hook-guard.js +199 -19
  272. package/dist/domains/comet-native/native-hook-guard.js.map +1 -1
  273. package/dist/domains/comet-native/native-init-command.d.ts.map +1 -1
  274. package/dist/domains/comet-native/native-init-command.js +14 -2
  275. package/dist/domains/comet-native/native-init-command.js.map +1 -1
  276. package/dist/domains/comet-native/native-local-execution.d.ts +25 -0
  277. package/dist/domains/comet-native/native-local-execution.d.ts.map +1 -0
  278. package/dist/domains/comet-native/native-local-execution.js +241 -0
  279. package/dist/domains/comet-native/native-local-execution.js.map +1 -0
  280. package/dist/domains/comet-native/native-lock.d.ts +1 -1
  281. package/dist/domains/comet-native/native-lock.d.ts.map +1 -1
  282. package/dist/domains/comet-native/native-lock.js +9 -9
  283. package/dist/domains/comet-native/native-lock.js.map +1 -1
  284. package/dist/domains/comet-native/native-loop-runtime.d.ts +63 -0
  285. package/dist/domains/comet-native/native-loop-runtime.d.ts.map +1 -0
  286. package/dist/domains/comet-native/native-loop-runtime.js +580 -0
  287. package/dist/domains/comet-native/native-loop-runtime.js.map +1 -0
  288. package/dist/domains/comet-native/native-mutation-lock.d.ts +2 -0
  289. package/dist/domains/comet-native/native-mutation-lock.d.ts.map +1 -1
  290. package/dist/domains/comet-native/native-mutation-lock.js +23 -2
  291. package/dist/domains/comet-native/native-mutation-lock.js.map +1 -1
  292. package/dist/domains/comet-native/native-new-command.d.ts.map +1 -1
  293. package/dist/domains/comet-native/native-new-command.js +27 -20
  294. package/dist/domains/comet-native/native-new-command.js.map +1 -1
  295. package/dist/domains/comet-native/native-next-command.d.ts.map +1 -1
  296. package/dist/domains/comet-native/native-next-command.js +193 -62
  297. package/dist/domains/comet-native/native-next-command.js.map +1 -1
  298. package/dist/domains/comet-native/native-paths.d.ts +18 -0
  299. package/dist/domains/comet-native/native-paths.d.ts.map +1 -1
  300. package/dist/domains/comet-native/native-paths.js +125 -13
  301. package/dist/domains/comet-native/native-paths.js.map +1 -1
  302. package/dist/domains/comet-native/native-portable-acceptance.d.ts +28 -0
  303. package/dist/domains/comet-native/native-portable-acceptance.d.ts.map +1 -0
  304. package/dist/domains/comet-native/native-portable-acceptance.js +73 -0
  305. package/dist/domains/comet-native/native-portable-acceptance.js.map +1 -0
  306. package/dist/domains/comet-native/native-portable-archive.d.ts +37 -0
  307. package/dist/domains/comet-native/native-portable-archive.d.ts.map +1 -0
  308. package/dist/domains/comet-native/native-portable-archive.js +492 -0
  309. package/dist/domains/comet-native/native-portable-archive.js.map +1 -0
  310. package/dist/domains/comet-native/native-portable-continuation.d.ts +30 -0
  311. package/dist/domains/comet-native/native-portable-continuation.d.ts.map +1 -0
  312. package/dist/domains/comet-native/native-portable-continuation.js +403 -0
  313. package/dist/domains/comet-native/native-portable-continuation.js.map +1 -0
  314. package/dist/domains/comet-native/native-portable-migration-runtime.d.ts +9 -0
  315. package/dist/domains/comet-native/native-portable-migration-runtime.d.ts.map +1 -0
  316. package/dist/domains/comet-native/native-portable-migration-runtime.js +213 -0
  317. package/dist/domains/comet-native/native-portable-migration-runtime.js.map +1 -0
  318. package/dist/domains/comet-native/native-portable-migration.d.ts +42 -0
  319. package/dist/domains/comet-native/native-portable-migration.d.ts.map +1 -0
  320. package/dist/domains/comet-native/native-portable-migration.js +212 -0
  321. package/dist/domains/comet-native/native-portable-migration.js.map +1 -0
  322. package/dist/domains/comet-native/native-portable-recovery.d.ts +15 -0
  323. package/dist/domains/comet-native/native-portable-recovery.d.ts.map +1 -0
  324. package/dist/domains/comet-native/native-portable-recovery.js +203 -0
  325. package/dist/domains/comet-native/native-portable-recovery.js.map +1 -0
  326. package/dist/domains/comet-native/native-portable-runtime.d.ts +155 -0
  327. package/dist/domains/comet-native/native-portable-runtime.d.ts.map +1 -0
  328. package/dist/domains/comet-native/native-portable-runtime.js +1550 -0
  329. package/dist/domains/comet-native/native-portable-runtime.js.map +1 -0
  330. package/dist/domains/comet-native/native-portable-state.d.ts +30 -0
  331. package/dist/domains/comet-native/native-portable-state.d.ts.map +1 -0
  332. package/dist/domains/comet-native/native-portable-state.js +701 -0
  333. package/dist/domains/comet-native/native-portable-state.js.map +1 -0
  334. package/dist/domains/comet-native/native-portable-status.d.ts +65 -0
  335. package/dist/domains/comet-native/native-portable-status.d.ts.map +1 -0
  336. package/dist/domains/comet-native/native-portable-status.js +133 -0
  337. package/dist/domains/comet-native/native-portable-status.js.map +1 -0
  338. package/dist/domains/comet-native/native-portable-text.d.ts +8 -0
  339. package/dist/domains/comet-native/native-portable-text.d.ts.map +1 -0
  340. package/dist/domains/comet-native/native-portable-text.js +28 -0
  341. package/dist/domains/comet-native/native-portable-text.js.map +1 -0
  342. package/dist/domains/comet-native/native-portable-transactions.d.ts +41 -0
  343. package/dist/domains/comet-native/native-portable-transactions.d.ts.map +1 -0
  344. package/dist/domains/comet-native/native-portable-transactions.js +204 -0
  345. package/dist/domains/comet-native/native-portable-transactions.js.map +1 -0
  346. package/dist/domains/comet-native/native-portable-types.d.ts +166 -0
  347. package/dist/domains/comet-native/native-portable-types.d.ts.map +1 -0
  348. package/dist/domains/comet-native/native-portable-types.js +18 -0
  349. package/dist/domains/comet-native/native-portable-types.js.map +1 -0
  350. package/dist/domains/comet-native/native-repair-integration.js +5 -5
  351. package/dist/domains/comet-native/native-repair-integration.js.map +1 -1
  352. package/dist/domains/comet-native/native-resume-view.d.ts.map +1 -1
  353. package/dist/domains/comet-native/native-resume-view.js +1 -5
  354. package/dist/domains/comet-native/native-resume-view.js.map +1 -1
  355. package/dist/domains/comet-native/native-root-move.d.ts.map +1 -1
  356. package/dist/domains/comet-native/native-root-move.js +4 -20
  357. package/dist/domains/comet-native/native-root-move.js.map +1 -1
  358. package/dist/domains/comet-native/native-run-consistency.d.ts.map +1 -1
  359. package/dist/domains/comet-native/native-run-consistency.js +8 -12
  360. package/dist/domains/comet-native/native-run-consistency.js.map +1 -1
  361. package/dist/domains/comet-native/native-run-store.js +4 -4
  362. package/dist/domains/comet-native/native-run-store.js.map +1 -1
  363. package/dist/domains/comet-native/native-runner-input.d.ts +160 -0
  364. package/dist/domains/comet-native/native-runner-input.d.ts.map +1 -0
  365. package/dist/domains/comet-native/native-runner-input.js +347 -0
  366. package/dist/domains/comet-native/native-runner-input.js.map +1 -0
  367. package/dist/domains/comet-native/native-runner-protocol.d.ts +40 -0
  368. package/dist/domains/comet-native/native-runner-protocol.d.ts.map +1 -0
  369. package/dist/domains/comet-native/native-runner-protocol.js +55 -0
  370. package/dist/domains/comet-native/native-runner-protocol.js.map +1 -0
  371. package/dist/domains/comet-native/native-runtime-package.d.ts +3 -0
  372. package/dist/domains/comet-native/native-runtime-package.d.ts.map +1 -1
  373. package/dist/domains/comet-native/native-runtime-package.js +5 -1
  374. package/dist/domains/comet-native/native-runtime-package.js.map +1 -1
  375. package/dist/domains/comet-native/native-schema-migration.d.ts.map +1 -1
  376. package/dist/domains/comet-native/native-schema-migration.js +30 -27
  377. package/dist/domains/comet-native/native-schema-migration.js.map +1 -1
  378. package/dist/domains/comet-native/native-select-command.d.ts.map +1 -1
  379. package/dist/domains/comet-native/native-select-command.js +8 -4
  380. package/dist/domains/comet-native/native-select-command.js.map +1 -1
  381. package/dist/domains/comet-native/native-selection.d.ts.map +1 -1
  382. package/dist/domains/comet-native/native-selection.js +11 -2
  383. package/dist/domains/comet-native/native-selection.js.map +1 -1
  384. package/dist/domains/comet-native/native-show-command.d.ts.map +1 -1
  385. package/dist/domains/comet-native/native-show-command.js +37 -0
  386. package/dist/domains/comet-native/native-show-command.js.map +1 -1
  387. package/dist/domains/comet-native/native-snapshot.d.ts.map +1 -1
  388. package/dist/domains/comet-native/native-snapshot.js +13 -10
  389. package/dist/domains/comet-native/native-snapshot.js.map +1 -1
  390. package/dist/domains/comet-native/native-spec-command.d.ts.map +1 -1
  391. package/dist/domains/comet-native/native-spec-command.js +14 -28
  392. package/dist/domains/comet-native/native-spec-command.js.map +1 -1
  393. package/dist/domains/comet-native/native-specs.js +3 -3
  394. package/dist/domains/comet-native/native-specs.js.map +1 -1
  395. package/dist/domains/comet-native/native-status-command.d.ts.map +1 -1
  396. package/dist/domains/comet-native/native-status-command.js +7 -17
  397. package/dist/domains/comet-native/native-status-command.js.map +1 -1
  398. package/dist/domains/comet-native/native-status-discovery.d.ts +51 -0
  399. package/dist/domains/comet-native/native-status-discovery.d.ts.map +1 -0
  400. package/dist/domains/comet-native/native-status-discovery.js +299 -0
  401. package/dist/domains/comet-native/native-status-discovery.js.map +1 -0
  402. package/dist/domains/comet-native/native-trajectory-recovery.d.ts.map +1 -1
  403. package/dist/domains/comet-native/native-trajectory-recovery.js +6 -9
  404. package/dist/domains/comet-native/native-trajectory-recovery.js.map +1 -1
  405. package/dist/domains/comet-native/native-transaction.d.ts.map +1 -1
  406. package/dist/domains/comet-native/native-transaction.js +31 -20
  407. package/dist/domains/comet-native/native-transaction.js.map +1 -1
  408. package/dist/domains/comet-native/native-transition-evidence.d.ts.map +1 -1
  409. package/dist/domains/comet-native/native-transition-evidence.js +1 -0
  410. package/dist/domains/comet-native/native-transition-evidence.js.map +1 -1
  411. package/dist/domains/comet-native/native-transition-journal.d.ts.map +1 -1
  412. package/dist/domains/comet-native/native-transition-journal.js +71 -22
  413. package/dist/domains/comet-native/native-transition-journal.js.map +1 -1
  414. package/dist/domains/comet-native/native-transitions.d.ts.map +1 -1
  415. package/dist/domains/comet-native/native-transitions.js +167 -15
  416. package/dist/domains/comet-native/native-transitions.js.map +1 -1
  417. package/dist/domains/comet-native/native-types.d.ts +36 -1
  418. package/dist/domains/comet-native/native-types.d.ts.map +1 -1
  419. package/dist/domains/comet-native/native-verification-receipt-runtime.d.ts.map +1 -1
  420. package/dist/domains/comet-native/native-verification-receipt-runtime.js +18 -100
  421. package/dist/domains/comet-native/native-verification-receipt-runtime.js.map +1 -1
  422. package/dist/domains/comet-native/native-verification-report-v2.d.ts +12 -0
  423. package/dist/domains/comet-native/native-verification-report-v2.d.ts.map +1 -0
  424. package/dist/domains/comet-native/native-verification-report-v2.js +141 -0
  425. package/dist/domains/comet-native/native-verification-report-v2.js.map +1 -0
  426. package/dist/domains/comet-native/native-verification-runtime.d.ts.map +1 -1
  427. package/dist/domains/comet-native/native-verification-runtime.js +7 -2
  428. package/dist/domains/comet-native/native-verification-runtime.js.map +1 -1
  429. package/dist/domains/comet-native/native-verification-scope.d.ts +23 -0
  430. package/dist/domains/comet-native/native-verification-scope.d.ts.map +1 -1
  431. package/dist/domains/comet-native/native-verification-scope.js +106 -19
  432. package/dist/domains/comet-native/native-verification-scope.js.map +1 -1
  433. package/dist/domains/comet-native/native-verifier-protocol.d.ts +49 -0
  434. package/dist/domains/comet-native/native-verifier-protocol.d.ts.map +1 -0
  435. package/dist/domains/comet-native/native-verifier-protocol.js +157 -0
  436. package/dist/domains/comet-native/native-verifier-protocol.js.map +1 -0
  437. package/dist/domains/comet-native/native-workspace-finish.d.ts +61 -0
  438. package/dist/domains/comet-native/native-workspace-finish.d.ts.map +1 -0
  439. package/dist/domains/comet-native/native-workspace-finish.js +332 -0
  440. package/dist/domains/comet-native/native-workspace-finish.js.map +1 -0
  441. package/dist/domains/comet-native/native-workspace-preparation.d.ts +32 -0
  442. package/dist/domains/comet-native/native-workspace-preparation.d.ts.map +1 -0
  443. package/dist/domains/comet-native/native-workspace-preparation.js +324 -0
  444. package/dist/domains/comet-native/native-workspace-preparation.js.map +1 -0
  445. package/dist/domains/comet-native/native-workspace.d.ts +9 -1
  446. package/dist/domains/comet-native/native-workspace.d.ts.map +1 -1
  447. package/dist/domains/comet-native/native-workspace.js +109 -11
  448. package/dist/domains/comet-native/native-workspace.js.map +1 -1
  449. package/dist/domains/dashboard/collector.d.ts +1 -1
  450. package/dist/domains/dashboard/collector.d.ts.map +1 -1
  451. package/dist/domains/dashboard/collector.js +102 -87
  452. package/dist/domains/dashboard/collector.js.map +1 -1
  453. package/dist/domains/dashboard/native-adapter.d.ts +155 -126
  454. package/dist/domains/dashboard/native-adapter.d.ts.map +1 -1
  455. package/dist/domains/dashboard/native-adapter.js +165 -268
  456. package/dist/domains/dashboard/native-adapter.js.map +1 -1
  457. package/dist/domains/dashboard/native-collector.d.ts +5 -4
  458. package/dist/domains/dashboard/native-collector.d.ts.map +1 -1
  459. package/dist/domains/dashboard/native-collector.js +506 -439
  460. package/dist/domains/dashboard/native-collector.js.map +1 -1
  461. package/dist/domains/dashboard/native-legacy-adapter.d.ts +37 -0
  462. package/dist/domains/dashboard/native-legacy-adapter.d.ts.map +1 -0
  463. package/dist/domains/dashboard/native-legacy-adapter.js +127 -0
  464. package/dist/domains/dashboard/native-legacy-adapter.js.map +1 -0
  465. package/dist/domains/dashboard/server.d.ts.map +1 -1
  466. package/dist/domains/dashboard/server.js +5 -3
  467. package/dist/domains/dashboard/server.js.map +1 -1
  468. package/dist/domains/dashboard/types.d.ts +5 -0
  469. package/dist/domains/dashboard/types.d.ts.map +1 -1
  470. package/dist/domains/dashboard/web/assets/abnfDiagram-N423BO3Z-B5cFR6hS.js +1 -0
  471. package/dist/domains/dashboard/web/assets/arc-CVQDtMsu.js +1 -0
  472. package/dist/domains/dashboard/web/assets/architectureDiagram-T3A2C74G-C0v0kULK.js +36 -0
  473. package/dist/domains/dashboard/web/assets/blockDiagram-VBNYF7ZC-DpHLuxu4.js +132 -0
  474. package/dist/domains/dashboard/web/assets/{c4Diagram-AAUBKEIU-Ca5zba3N.js → c4Diagram-5PPSVZJV-BHnFxUs1.js} +1 -1
  475. package/dist/domains/dashboard/web/assets/channel-eM0x3m1G.js +1 -0
  476. package/dist/domains/dashboard/web/assets/{chunk-ND2GUHAM-Bj6HWRwi.js → chunk-2GRJ4B5K-CGC9gh5n.js} +1 -1
  477. package/dist/domains/dashboard/web/assets/{chunk-QZHKN3VN-B1kXfg5N.js → chunk-2Q5K7J3B-l4puLU_O.js} +1 -1
  478. package/dist/domains/dashboard/web/assets/chunk-5RXB4S5H-ls9jQHZc.js +231 -0
  479. package/dist/domains/dashboard/web/assets/{chunk-FMBD7UC4-BAJLB5V6.js → chunk-5VM5RSS4-BVavmTEq.js} +1 -1
  480. package/dist/domains/dashboard/web/assets/chunk-6Q2QTUOP-Dungt2g9.js +88 -0
  481. package/dist/domains/dashboard/web/assets/{chunk-727SXJPM-CwghIMO9.js → chunk-GF5L2VYU-BidXO_ZP.js} +5 -5
  482. package/dist/domains/dashboard/web/assets/{chunk-4BX2VUAB-JYluRsP-.js → chunk-JWPE2WC7-57L5Up5X.js} +1 -1
  483. package/dist/domains/dashboard/web/assets/{chunk-2J33WTMH-CCVPBm0J.js → chunk-KBJHAD2P-C5u5vbwr.js} +1 -1
  484. package/dist/domains/dashboard/web/assets/chunk-RYQCIY6F-CvLz21I2.js +1 -0
  485. package/dist/domains/dashboard/web/assets/{chunk-55IACEB6-DfYm7pN7.js → chunk-XXDRQBXY-D5nJpckG.js} +1 -1
  486. package/dist/domains/dashboard/web/assets/classDiagram-JCYQIIEL-CEFhao2K.js +1 -0
  487. package/dist/domains/dashboard/web/assets/classDiagram-v2-OCEON4UE-CEFhao2K.js +1 -0
  488. package/dist/domains/dashboard/web/assets/{cose-bilkent-S5V4N54A-BBrkuiAU.js → cose-bilkent-JH36ORCC-Dp0JAGyE.js} +1 -1
  489. package/dist/domains/dashboard/web/assets/{cynefin-VYW2F7L2-DlFhgQHt.js → cynefin-VYW2F7L2-EjC54l1g.js} +2 -2
  490. package/dist/domains/dashboard/web/assets/cynefinDiagram-MW4NZA55-CpYrW3w3.js +62 -0
  491. package/dist/domains/dashboard/web/assets/dagre-VZM6K2ZE-h5K39rCk.js +4 -0
  492. package/dist/domains/dashboard/web/assets/demo-BfLsKrIL.js +45 -0
  493. package/dist/domains/dashboard/web/assets/diagram-7IWD3JNH-CKQj9O4H.js +30 -0
  494. package/dist/domains/dashboard/web/assets/{diagram-KO2AKTUF-BQahyP-C.js → diagram-B4RE2ZJO-DXRIYcnW.js} +3 -3
  495. package/dist/domains/dashboard/web/assets/diagram-LBJQPF4R-wWutQYmv.js +24 -0
  496. package/dist/domains/dashboard/web/assets/diagram-Q27KOJAE-EgXLJQYi.js +24 -0
  497. package/dist/domains/dashboard/web/assets/diagram-UB23O5K3-CsQRXDQZ.js +41 -0
  498. package/dist/domains/dashboard/web/assets/ebnfDiagram-BXEA7PRR-gm328Eho.js +1 -0
  499. package/dist/domains/dashboard/web/assets/erDiagram-JOGREHBK-BbbMVUx_.js +85 -0
  500. package/dist/domains/dashboard/web/assets/flowDiagram-UKHOOZJN-1Y7scCns.js +156 -0
  501. package/dist/domains/dashboard/web/assets/ganttDiagram-PKOTCBZU-BAoBqczv.js +292 -0
  502. package/dist/domains/dashboard/web/assets/{gitGraphDiagram-PVQCEYII-DCxvMAUJ.js → gitGraphDiagram-DS77QQ5N-CMUAyEzl.js} +3 -3
  503. package/dist/domains/dashboard/web/assets/{graph--OzhPTMs.js → graph-DOmOIIwC.js} +1 -1
  504. package/dist/domains/dashboard/web/assets/{index-Blit0P5Z.js → index-CCApJ0Yr.js} +1 -1
  505. package/dist/domains/dashboard/web/assets/index-DWdm_XBi.js +257 -0
  506. package/dist/domains/dashboard/web/assets/index-DhhbseFJ.css +1 -0
  507. package/dist/domains/dashboard/web/assets/{infoDiagram-5YYISTIA-9qXEkzDe.js → infoDiagram-6WML65LV-BaCdtYYC.js} +1 -1
  508. package/dist/domains/dashboard/web/assets/{ishikawaDiagram-YF4QCWOH-Dkf5othW.js → ishikawaDiagram-WSZJBQD7-DQQlNnjU.js} +4 -4
  509. package/dist/domains/dashboard/web/assets/{journeyDiagram-JHISSGLW-C2_IkO4s.js → journeyDiagram-NVQOT4AX-DW9wUMqn.js} +1 -1
  510. package/dist/domains/dashboard/web/assets/{kanban-definition-UN3LZRKU-BxWgu4DL.js → kanban-definition-27J2QSJJ-C_ITaZ0q.js} +7 -7
  511. package/dist/domains/dashboard/web/assets/layout-D-LzfAck.js +1 -0
  512. package/dist/domains/dashboard/web/assets/{linear-Dkr6p-Ro.js → linear-DXOo6ZRT.js} +1 -1
  513. package/dist/domains/dashboard/web/assets/map-DxJ2ADlA.js +1 -0
  514. package/dist/domains/dashboard/web/assets/mermaid.core-ol-0NI97.js +306 -0
  515. package/dist/domains/dashboard/web/assets/{mindmap-definition-RKZ34NQL-C9xyxGfa.js → mindmap-definition-FAOFIHXS-CHF_HOLV.js} +1 -1
  516. package/dist/domains/dashboard/web/assets/pegDiagram-VL7TDLO6-wQEvkNF8.js +1 -0
  517. package/dist/domains/dashboard/web/assets/pieDiagram-7S7Q4E2Y-C3H3kiIP.js +39 -0
  518. package/dist/domains/dashboard/web/assets/purify.es-Cz4mVeUR.js +3 -0
  519. package/dist/domains/dashboard/web/assets/{quadrantDiagram-W4KKPZXB-Cy6iOcxc.js → quadrantDiagram-CIZ2JOQS-S0FdVzJb.js} +4 -4
  520. package/dist/domains/dashboard/web/assets/railroadDiagram-AXF67PYL-DCDXDaVg.js +1 -0
  521. package/dist/domains/dashboard/web/assets/{requirementDiagram-4Y6WPE33-B_gZONhx.js → requirementDiagram-LRYGKXZP-BW8J4gO_.js} +1 -1
  522. package/dist/domains/dashboard/web/assets/sankeyDiagram-W5VNT64P-DQQBmLoy.js +40 -0
  523. package/dist/domains/dashboard/web/assets/sequenceDiagram-SI44F4Z6-2tDcli0Y.js +162 -0
  524. package/dist/domains/dashboard/web/assets/sizeCapture-X5ZJPWSS-4sEZLBKb.js +1 -0
  525. package/dist/domains/dashboard/web/assets/stateDiagram-OKZ733FA-OgPb8pyR.js +1 -0
  526. package/dist/domains/dashboard/web/assets/stateDiagram-v2-UEYNNEHI-CiDNPr4P.js +1 -0
  527. package/dist/domains/dashboard/web/assets/swimlanes-SLNWSIFB-DR7lwtxd.js +2 -0
  528. package/dist/domains/dashboard/web/assets/swimlanesDiagram-ULZ7WXOC-DggHFP9q.js +8 -0
  529. package/dist/domains/dashboard/web/assets/{timeline-definition-PNZ67QCA-DvONX2YQ.js → timeline-definition-Z64GVDOM-DNIJVlQV.js} +4 -4
  530. package/dist/domains/dashboard/web/assets/vennDiagram-T6HMQDX7-CClhw4QZ.js +34 -0
  531. package/dist/domains/dashboard/web/assets/{wardleyDiagram-YWT4CUSO-cf39WX2o.js → wardleyDiagram-T6FBY63Y-DzR3aFPS.js} +3 -3
  532. package/dist/domains/dashboard/web/assets/xychartDiagram-ELKLHX3M-DZhq0ZRj.js +7 -0
  533. package/dist/domains/dashboard/web/index.html +16 -16
  534. package/dist/domains/dashboard/workspace.d.ts +24 -0
  535. package/dist/domains/dashboard/workspace.d.ts.map +1 -0
  536. package/dist/domains/dashboard/workspace.js +87 -0
  537. package/dist/domains/dashboard/workspace.js.map +1 -0
  538. package/dist/domains/eval/index.d.ts +3 -0
  539. package/dist/domains/eval/index.d.ts.map +1 -1
  540. package/dist/domains/eval/index.js +3 -0
  541. package/dist/domains/eval/index.js.map +1 -1
  542. package/dist/domains/eval/standalone-context.d.ts +19 -0
  543. package/dist/domains/eval/standalone-context.d.ts.map +1 -0
  544. package/dist/domains/eval/standalone-context.js +107 -0
  545. package/dist/domains/eval/standalone-context.js.map +1 -0
  546. package/dist/domains/eval/standalone-static-collect.d.ts +22 -0
  547. package/dist/domains/eval/standalone-static-collect.d.ts.map +1 -0
  548. package/dist/domains/eval/standalone-static-collect.js +779 -0
  549. package/dist/domains/eval/standalone-static-collect.js.map +1 -0
  550. package/dist/domains/eval/user-environment.d.ts +6 -0
  551. package/dist/domains/eval/user-environment.d.ts.map +1 -0
  552. package/dist/domains/eval/user-environment.js +73 -0
  553. package/dist/domains/eval/user-environment.js.map +1 -0
  554. package/dist/domains/integrations/openspec.d.ts +1 -1
  555. package/dist/domains/integrations/openspec.d.ts.map +1 -1
  556. package/dist/domains/integrations/openspec.js +110 -26
  557. package/dist/domains/integrations/openspec.js.map +1 -1
  558. package/dist/domains/integrations/superpowers.d.ts +5 -1
  559. package/dist/domains/integrations/superpowers.d.ts.map +1 -1
  560. package/dist/domains/integrations/superpowers.js +21 -2
  561. package/dist/domains/integrations/superpowers.js.map +1 -1
  562. package/dist/domains/skill/platform-inspect.d.ts.map +1 -1
  563. package/dist/domains/skill/platform-inspect.js +11 -3
  564. package/dist/domains/skill/platform-inspect.js.map +1 -1
  565. package/dist/domains/skill/platform-install.d.ts +8 -2
  566. package/dist/domains/skill/platform-install.d.ts.map +1 -1
  567. package/dist/domains/skill/platform-install.js +115 -34
  568. package/dist/domains/skill/platform-install.js.map +1 -1
  569. package/dist/domains/skill/project-instructions.d.ts.map +1 -1
  570. package/dist/domains/skill/project-instructions.js +5 -3
  571. package/dist/domains/skill/project-instructions.js.map +1 -1
  572. package/dist/domains/skill/uninstall.d.ts.map +1 -1
  573. package/dist/domains/skill/uninstall.js +69 -15
  574. package/dist/domains/skill/uninstall.js.map +1 -1
  575. package/dist/domains/workflow-contract/hook-write-policy.d.ts +9 -0
  576. package/dist/domains/workflow-contract/hook-write-policy.d.ts.map +1 -0
  577. package/dist/domains/workflow-contract/hook-write-policy.js +52 -0
  578. package/dist/domains/workflow-contract/hook-write-policy.js.map +1 -0
  579. package/dist/domains/workflow-contract/index.d.ts +3 -0
  580. package/dist/domains/workflow-contract/index.d.ts.map +1 -1
  581. package/dist/domains/workflow-contract/index.js +2 -0
  582. package/dist/domains/workflow-contract/index.js.map +1 -1
  583. package/dist/domains/workflow-contract/project-config.d.ts +3 -1
  584. package/dist/domains/workflow-contract/project-config.d.ts.map +1 -1
  585. package/dist/domains/workflow-contract/project-config.js +119 -19
  586. package/dist/domains/workflow-contract/project-config.js.map +1 -1
  587. package/dist/domains/workflow-contract/project-gitignore.d.ts +9 -0
  588. package/dist/domains/workflow-contract/project-gitignore.d.ts.map +1 -0
  589. package/dist/domains/workflow-contract/project-gitignore.js +108 -0
  590. package/dist/domains/workflow-contract/project-gitignore.js.map +1 -0
  591. package/dist/domains/workflow-contract/protected-project-path.d.ts +13 -0
  592. package/dist/domains/workflow-contract/protected-project-path.d.ts.map +1 -1
  593. package/dist/domains/workflow-contract/protected-project-path.js +83 -0
  594. package/dist/domains/workflow-contract/protected-project-path.js.map +1 -1
  595. package/dist/domains/workflow-contract/types.d.ts +4 -0
  596. package/dist/domains/workflow-contract/types.d.ts.map +1 -1
  597. package/dist/platform/install/platforms.d.ts +3 -1
  598. package/dist/platform/install/platforms.d.ts.map +1 -1
  599. package/dist/platform/install/platforms.js +22 -2
  600. package/dist/platform/install/platforms.js.map +1 -1
  601. package/dist/platform/paths/git-worktree.d.ts +8 -1
  602. package/dist/platform/paths/git-worktree.d.ts.map +1 -1
  603. package/dist/platform/paths/git-worktree.js +41 -7
  604. package/dist/platform/paths/git-worktree.js.map +1 -1
  605. package/dist/platform/process/external-command.d.ts +13 -0
  606. package/dist/platform/process/external-command.d.ts.map +1 -0
  607. package/dist/platform/process/external-command.js +45 -0
  608. package/dist/platform/process/external-command.js.map +1 -0
  609. package/dist/platform/process/git.d.ts +12 -0
  610. package/dist/platform/process/git.d.ts.map +1 -0
  611. package/dist/platform/process/git.js +86 -0
  612. package/dist/platform/process/git.js.map +1 -0
  613. package/dist/platform/process/spawn-command.d.ts +8 -0
  614. package/dist/platform/process/spawn-command.d.ts.map +1 -0
  615. package/dist/platform/process/spawn-command.js +113 -0
  616. package/dist/platform/process/spawn-command.js.map +1 -0
  617. package/eval/.env.example +115 -0
  618. package/eval/README.md +237 -14
  619. package/eval/langfuse/.env.example +9 -0
  620. package/eval/langfuse/tests/conftest.py +146 -0
  621. package/eval/langfuse/tests/tasks/test_tasks.py +109 -0
  622. package/eval/langfuse/tests/test_adapter.py +272 -0
  623. package/eval/langsmith/.env.example +16 -0
  624. package/eval/langsmith/tests/conftest.py +10 -1
  625. package/eval/local/tasks/comet-classic-layout-lifecycle/environment/current-comet-package.json +4 -2
  626. package/eval/local/tasks/comet-native-clarification/validation/test_native_clarification.py +9 -21
  627. package/eval/local/tasks/comet-native-clarification-depth/validation/test_native_clarification_depth.py +4 -7
  628. package/eval/local/tasks/comet-native-clarification-modes/validation/test_native_clarification_modes.py +4 -10
  629. package/eval/local/tasks/comet-native-interrupted-transition/instruction.md +1 -1
  630. package/eval/local/tasks/comet-native-interrupted-transition/validation/test_native_interrupted_transition.py +15 -16
  631. package/eval/local/tasks/comet-native-repository-fact/instruction.md +2 -2
  632. package/eval/local/tasks/comet-native-repository-fact/validation/test_native_repository_fact.py +8 -2
  633. package/eval/local/tasks/comet-native-wave-b-decision-resume/instruction.md +8 -4
  634. package/eval/local/tasks/comet-native-wave-b-decision-resume/task.toml +6 -6
  635. package/eval/local/tasks/comet-native-wave-b-decision-resume/validation/test_native_wave_b_decision_resume.py +126 -135
  636. package/eval/local/tasks/comet-native-wave-c-verification-integrity/instruction.md +6 -6
  637. package/eval/local/tasks/comet-native-wave-c-verification-integrity/task.toml +8 -8
  638. package/eval/local/tasks/comet-native-wave-c-verification-integrity/validation/test_native_wave_c_verification_integrity.py +97 -317
  639. package/eval/local/tasks/comet-native-wave-d-stagnation-stop/instruction.md +7 -7
  640. package/eval/local/tasks/comet-native-wave-d-stagnation-stop/task.toml +4 -4
  641. package/eval/local/tasks/comet-native-wave-d-stagnation-stop/validation/test_native_wave_d_stagnation_stop.py +130 -199
  642. package/eval/local/tasks/comet-native-wave-e-parallel-safety/instruction.md +5 -5
  643. package/eval/local/tasks/comet-native-wave-e-parallel-safety/task.toml +8 -8
  644. package/eval/local/tasks/comet-native-wave-e-parallel-safety/validation/test_native_wave_e_parallel_safety.py +135 -239
  645. package/eval/local/tasks/comet-native-wave-f-dashboard-readonly/environment/current-comet-package.json +2 -2
  646. package/eval/local/tasks/comet-native-wave-f-dashboard-readonly/instruction.md +3 -3
  647. package/eval/local/tasks/comet-native-wave-f-dashboard-readonly/task.toml +6 -6
  648. package/eval/local/tasks/comet-native-wave-f-dashboard-readonly/validation/test_native_wave_f_dashboard_readonly.py +81 -439
  649. package/eval/local/tasks/comet-native-workflow/instruction.md +5 -4
  650. package/eval/local/tasks/comet-native-workflow/validation/test_native_workflow.py +145 -502
  651. package/eval/local/tasks/index.yaml +5 -5
  652. package/eval/local/tests/conftest.py +701 -80
  653. package/eval/local/tests/scaffold/fixtures/custom-agent/adapter.yaml +19 -0
  654. package/eval/local/tests/scaffold/test_agents.py +76 -0
  655. package/eval/local/tests/scaffold/test_aligned_comparison.py +70 -0
  656. package/eval/local/tests/scaffold/test_auto_tasks.py +350 -0
  657. package/eval/local/tests/scaffold/test_conftest_helpers.py +267 -18
  658. package/eval/local/tests/scaffold/test_custom_agents.py +174 -0
  659. package/eval/local/tests/scaffold/test_eval_context.py +217 -0
  660. package/eval/local/tests/scaffold/test_execution.py +364 -0
  661. package/eval/local/tests/scaffold/test_inline_tasks.py +56 -0
  662. package/eval/local/tests/scaffold/test_langfuse_trajectory.py +263 -0
  663. package/eval/local/tests/scaffold/test_langsmith_conftest.py +63 -0
  664. package/eval/local/tests/scaffold/test_logging.py +162 -0
  665. package/eval/local/tests/scaffold/test_manifest_tasks.py +76 -0
  666. package/eval/local/tests/scaffold/test_manifests.py +396 -0
  667. package/eval/local/tests/scaffold/test_native_aligned_eval.py +163 -35
  668. package/eval/local/tests/scaffold/test_native_wave_evaluations.py +75 -2054
  669. package/eval/local/tests/scaffold/test_profiles.py +64 -6
  670. package/eval/local/tests/scaffold/test_task_resolution.py +212 -0
  671. package/eval/local/tests/scaffold/test_tasks.py +38 -52
  672. package/eval/local/tests/scaffold/test_utils.py +480 -4
  673. package/eval/local/tests/tasks/test_tasks.py +219 -17
  674. package/eval/local/treatments/comet/comet_native_phase1.yaml +7 -4
  675. package/eval/pyproject.toml +9 -4
  676. package/eval/scaffold/__init__.py +6 -0
  677. package/eval/scaffold/docker/agent-overlay.Dockerfile +41 -0
  678. package/eval/scaffold/python/__init__.py +128 -20
  679. package/eval/scaffold/python/agents.py +239 -0
  680. package/eval/scaffold/python/aligned_comparison.py +156 -27
  681. package/eval/scaffold/python/auto_tasks.py +700 -0
  682. package/eval/scaffold/python/custom_agents.py +172 -0
  683. package/eval/scaffold/python/eval_context.py +236 -0
  684. package/eval/scaffold/python/eval_schema.py +135 -0
  685. package/eval/scaffold/python/execution.py +544 -0
  686. package/eval/scaffold/python/generated_task_cache.py +230 -0
  687. package/eval/scaffold/python/generic_llm_judge.py +41 -14
  688. package/eval/scaffold/python/inline_tasks.py +118 -0
  689. package/eval/scaffold/python/judge_config.py +158 -37
  690. package/eval/scaffold/python/langfuse_adapter.py +1023 -0
  691. package/eval/scaffold/python/llm_judge.py +68 -11
  692. package/eval/scaffold/python/logging.py +157 -17
  693. package/eval/scaffold/python/manifest_tasks.py +69 -0
  694. package/eval/scaffold/python/manifests.py +443 -22
  695. package/eval/scaffold/python/native_eval.py +10 -5
  696. package/eval/scaffold/python/paths.py +11 -1
  697. package/eval/scaffold/python/task_resolution.py +176 -0
  698. package/eval/scaffold/python/tasks.py +17 -4
  699. package/eval/scaffold/python/utils.py +167 -11
  700. package/eval/scaffold/python/validation/core.py +48 -2
  701. package/eval/scaffold/python/validation/generic_rubric.py +9 -0
  702. package/eval/scaffold/python/validation/native_v4.py +249 -0
  703. package/eval/scaffold/python/validation/native_wave.py +4 -5
  704. package/eval/scaffold/python/validation/native_workflow.py +199 -98
  705. package/eval/scaffold/python/validation/rubric.py +130 -2
  706. package/eval/scaffold/shell/agent-runtime-config.sh +88 -0
  707. package/eval/scaffold/shell/docker.sh +534 -33
  708. package/eval/scaffold/shell/run-agent-runtime.sh +49 -0
  709. package/eval/scaffold/shell/run-claude-loop.sh +153 -14
  710. package/eval/schemas/comet.eval/v1alpha1.schema.json +244 -0
  711. package/package.json +9 -3
  712. package/assets/skills/comet-native/scripts/comet-native-check.mjs +0 -179
  713. package/assets/skills/comet-native/scripts/comet-native-checkpoint.mjs +0 -179
  714. package/assets/skills/comet-native/scripts/comet-native-evidence.mjs +0 -151
  715. package/assets/skills/comet-native/scripts/comet-native-receipt.mjs +0 -187
  716. package/dist/domains/comet-native/native-check-entry.d.ts +0 -2
  717. package/dist/domains/comet-native/native-check-entry.d.ts.map +0 -1
  718. package/dist/domains/comet-native/native-check-entry.js +0 -4
  719. package/dist/domains/comet-native/native-check-entry.js.map +0 -1
  720. package/dist/domains/comet-native/native-checkpoint-entry.d.ts +0 -2
  721. package/dist/domains/comet-native/native-checkpoint-entry.d.ts.map +0 -1
  722. package/dist/domains/comet-native/native-checkpoint-entry.js +0 -4
  723. package/dist/domains/comet-native/native-checkpoint-entry.js.map +0 -1
  724. package/dist/domains/comet-native/native-evidence-entry.d.ts +0 -2
  725. package/dist/domains/comet-native/native-evidence-entry.d.ts.map +0 -1
  726. package/dist/domains/comet-native/native-evidence-entry.js +0 -4
  727. package/dist/domains/comet-native/native-evidence-entry.js.map +0 -1
  728. package/dist/domains/comet-native/native-receipt-entry.d.ts +0 -2
  729. package/dist/domains/comet-native/native-receipt-entry.d.ts.map +0 -1
  730. package/dist/domains/comet-native/native-receipt-entry.js +0 -4
  731. package/dist/domains/comet-native/native-receipt-entry.js.map +0 -1
  732. package/dist/domains/dashboard/web/assets/arc-ClrSujVb.js +0 -1
  733. package/dist/domains/dashboard/web/assets/architectureDiagram-3BPJPVTR-B4A_t84A.js +0 -36
  734. package/dist/domains/dashboard/web/assets/blockDiagram-GPEHLZMM-D72u2953.js +0 -132
  735. package/dist/domains/dashboard/web/assets/channel-B_u-_i2t.js +0 -1
  736. package/dist/domains/dashboard/web/assets/chunk-AQP2D5EJ-BA_zgMXZ.js +0 -231
  737. package/dist/domains/dashboard/web/assets/classDiagram-4FO5ZUOK-BpA7BPgX.js +0 -1
  738. package/dist/domains/dashboard/web/assets/classDiagram-v2-Q7XG4LA2-BpA7BPgX.js +0 -1
  739. package/dist/domains/dashboard/web/assets/dagre-BM42HDAG-B0Bk5oiP.js +0 -4
  740. package/dist/domains/dashboard/web/assets/demo-DZYPLZpF.js +0 -25
  741. package/dist/domains/dashboard/web/assets/diagram-2AECGRRQ-tvTUiBA2.js +0 -43
  742. package/dist/domains/dashboard/web/assets/diagram-5GNKFQAL-BZfcK29q.js +0 -10
  743. package/dist/domains/dashboard/web/assets/diagram-LMA3HP47-D5bJnW2C.js +0 -24
  744. package/dist/domains/dashboard/web/assets/diagram-OG6HWLK6-DTwWdzWJ.js +0 -24
  745. package/dist/domains/dashboard/web/assets/erDiagram-TEJ5UH35-BbvrdCp9.js +0 -85
  746. package/dist/domains/dashboard/web/assets/flowDiagram-I6XJVG4X-DgbR7Tcc.js +0 -162
  747. package/dist/domains/dashboard/web/assets/ganttDiagram-6RSMTGT7-wWMOA7F4.js +0 -292
  748. package/dist/domains/dashboard/web/assets/index-Bk1o-4VO.css +0 -1
  749. package/dist/domains/dashboard/web/assets/index-g8vyW0R_.js +0 -257
  750. package/dist/domains/dashboard/web/assets/layout-SsrduOYp.js +0 -1
  751. package/dist/domains/dashboard/web/assets/mermaid.core-DZUcsoG4.js +0 -301
  752. package/dist/domains/dashboard/web/assets/pieDiagram-4H26LBE5-Dn67tdOF.js +0 -30
  753. package/dist/domains/dashboard/web/assets/purify.es-VaSPOPhr.js +0 -3
  754. package/dist/domains/dashboard/web/assets/sankeyDiagram-5OEKKPKP-C3u-4dOk.js +0 -40
  755. package/dist/domains/dashboard/web/assets/sequenceDiagram-3UESZ5HK-Xd3ByTVF.js +0 -162
  756. package/dist/domains/dashboard/web/assets/stateDiagram-AJRCARHV-CJGHL7Up.js +0 -1
  757. package/dist/domains/dashboard/web/assets/stateDiagram-v2-BHNVJYJU-rKvBgr6I.js +0 -1
  758. package/dist/domains/dashboard/web/assets/vennDiagram-CIIHVFJN-B-L4qWy4.js +0 -34
  759. package/dist/domains/dashboard/web/assets/xychartDiagram-2RQKCTM6-Dk1vcm3u.js +0 -7
  760. /package/assets/skills/{comet → comet-classic}/reference/classic-layout.md +0 -0
  761. /package/assets/skills-zh/{comet → comet-classic}/reference/classic-layout.md +0 -0
@@ -1,208 +1,208 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as __cometCreateRequire } from 'module';
3
3
  const require = __cometCreateRequire(import.meta.url);
4
- var df=Object.create;var gr=Object.defineProperty;var pf=Object.getOwnPropertyDescriptor;var mf=Object.getOwnPropertyNames;var hf=Object.getPrototypeOf,gf=Object.prototype.hasOwnProperty;var jn=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,n)=>(typeof require<"u"?require:e)[n]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var G=(t,e,n)=>()=>{if(n)throw n[0];try{return t&&(e=t(t=0)),e}catch(i){throw n=[i],i}};var v=(t,e)=>()=>{try{return e||t((e={exports:{}}).exports,e),e.exports}catch(n){throw e=0,n}},wf=(t,e)=>{for(var n in e)gr(t,n,{get:e[n],enumerable:!0})},yf=(t,e,n,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of mf(e))!gf.call(t,r)&&r!==n&&gr(t,r,{get:()=>e[r],enumerable:!(i=pf(e,r))||i.enumerable});return t};var Je=(t,e,n)=>(n=t!=null?df(hf(t)):{},yf(e||!t||!t.__esModule?gr(n,"default",{value:t,enumerable:!0}):n,t));var N=v(U=>{"use strict";var wr=Symbol.for("yaml.alias"),Fo=Symbol.for("yaml.document"),Tn=Symbol.for("yaml.map"),Mo=Symbol.for("yaml.pair"),yr=Symbol.for("yaml.scalar"),In=Symbol.for("yaml.seq"),ge=Symbol.for("yaml.node.type"),vf=t=>!!t&&typeof t=="object"&&t[ge]===wr,bf=t=>!!t&&typeof t=="object"&&t[ge]===Fo,kf=t=>!!t&&typeof t=="object"&&t[ge]===Tn,Sf=t=>!!t&&typeof t=="object"&&t[ge]===Mo,Wo=t=>!!t&&typeof t=="object"&&t[ge]===yr,Cf=t=>!!t&&typeof t=="object"&&t[ge]===In;function Bo(t){if(t&&typeof t=="object")switch(t[ge]){case Tn:case In:return!0}return!1}function Ef(t){if(t&&typeof t=="object")switch(t[ge]){case wr:case Tn:case yr:case In:return!0}return!1}var xf=t=>(Wo(t)||Bo(t))&&!!t.anchor;U.ALIAS=wr;U.DOC=Fo;U.MAP=Tn;U.NODE_TYPE=ge;U.PAIR=Mo;U.SCALAR=yr;U.SEQ=In;U.hasAnchor=xf;U.isAlias=vf;U.isCollection=Bo;U.isDocument=bf;U.isMap=kf;U.isNode=Ef;U.isPair=Sf;U.isScalar=Wo;U.isSeq=Cf});var Ot=v(vr=>{"use strict";var B=N(),Z=Symbol("break visit"),Ko=Symbol("skip children"),de=Symbol("remove node");function $n(t,e){let n=Yo(e);B.isDocument(t)?ft(null,t.contents,n,Object.freeze([t]))===de&&(t.contents=null):ft(null,t,n,Object.freeze([]))}$n.BREAK=Z;$n.SKIP=Ko;$n.REMOVE=de;function ft(t,e,n,i){let r=Uo(t,e,n,i);if(B.isNode(r)||B.isPair(r))return Vo(t,i,r),ft(t,r,n,i);if(typeof r!="symbol"){if(B.isCollection(e)){i=Object.freeze(i.concat(e));for(let s=0;s<e.items.length;++s){let o=ft(s,e.items[s],n,i);if(typeof o=="number")s=o-1;else{if(o===Z)return Z;o===de&&(e.items.splice(s,1),s-=1)}}}else if(B.isPair(e)){i=Object.freeze(i.concat(e));let s=ft("key",e.key,n,i);if(s===Z)return Z;s===de&&(e.key=null);let o=ft("value",e.value,n,i);if(o===Z)return Z;o===de&&(e.value=null)}}return r}async function qn(t,e){let n=Yo(e);B.isDocument(t)?await dt(null,t.contents,n,Object.freeze([t]))===de&&(t.contents=null):await dt(null,t,n,Object.freeze([]))}qn.BREAK=Z;qn.SKIP=Ko;qn.REMOVE=de;async function dt(t,e,n,i){let r=await Uo(t,e,n,i);if(B.isNode(r)||B.isPair(r))return Vo(t,i,r),dt(t,r,n,i);if(typeof r!="symbol"){if(B.isCollection(e)){i=Object.freeze(i.concat(e));for(let s=0;s<e.items.length;++s){let o=await dt(s,e.items[s],n,i);if(typeof o=="number")s=o-1;else{if(o===Z)return Z;o===de&&(e.items.splice(s,1),s-=1)}}}else if(B.isPair(e)){i=Object.freeze(i.concat(e));let s=await dt("key",e.key,n,i);if(s===Z)return Z;s===de&&(e.key=null);let o=await dt("value",e.value,n,i);if(o===Z)return Z;o===de&&(e.value=null)}}return r}function Yo(t){return typeof t=="object"&&(t.Collection||t.Node||t.Value)?Object.assign({Alias:t.Node,Map:t.Node,Scalar:t.Node,Seq:t.Node},t.Value&&{Map:t.Value,Scalar:t.Value,Seq:t.Value},t.Collection&&{Map:t.Collection,Seq:t.Collection},t):t}function Uo(t,e,n,i){if(typeof n=="function")return n(t,e,i);if(B.isMap(e))return n.Map?.(t,e,i);if(B.isSeq(e))return n.Seq?.(t,e,i);if(B.isPair(e))return n.Pair?.(t,e,i);if(B.isScalar(e))return n.Scalar?.(t,e,i);if(B.isAlias(e))return n.Alias?.(t,e,i)}function Vo(t,e,n){let i=e[e.length-1];if(B.isCollection(i))i.items[t]=n;else if(B.isPair(i))t==="key"?i.key=n:i.value=n;else if(B.isDocument(i))i.contents=n;else{let r=B.isAlias(i)?"alias":"scalar";throw new Error(`Cannot replace node with ${r} parent`)}}vr.visit=$n;vr.visitAsync=qn});var br=v(Ho=>{"use strict";var Jo=N(),_f=Ot(),Pf={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},Rf=t=>t.replace(/[!,[\]{}]/g,e=>Pf[e]),At=class t{constructor(e,n){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},t.defaultYaml,e),this.tags=Object.assign({},t.defaultTags,n)}clone(){let e=new t(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){let e=new t(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:t.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},t.defaultTags);break}return e}add(e,n){this.atNextDocument&&(this.yaml={explicit:t.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},t.defaultTags),this.atNextDocument=!1);let i=e.trim().split(/[ \t]+/),r=i.shift();switch(r){case"%TAG":{if(i.length!==2&&(n(0,"%TAG directive should contain exactly two parts"),i.length<2))return!1;let[s,o]=i;return this.tags[s]=o,!0}case"%YAML":{if(this.yaml.explicit=!0,i.length!==1)return n(0,"%YAML directive should contain exactly one part"),!1;let[s]=i;if(s==="1.1"||s==="1.2")return this.yaml.version=s,!0;{let o=/^\d+\.\d+$/.test(s);return n(6,`Unsupported YAML version ${s}`,o),!1}}default:return n(0,`Unknown directive ${r}`,!0),!1}}tagName(e,n){if(e==="!")return"!";if(e[0]!=="!")return n(`Not a valid tag: ${e}`),null;if(e[1]==="<"){let o=e.slice(2,-1);return o==="!"||o==="!!"?(n(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&n("Verbatim tags must end with a >"),o)}let[,i,r]=e.match(/^(.*!)([^!]*)$/s);r||n(`The ${e} tag has no suffix`);let s=this.tags[i];if(s)try{return s+decodeURIComponent(r)}catch(o){return n(String(o)),null}return i==="!"?e:(n(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[n,i]of Object.entries(this.tags))if(e.startsWith(i))return n+Rf(e.substring(i.length));return e[0]==="!"?e:`!<${e}>`}toString(e){let n=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],i=Object.entries(this.tags),r;if(e&&i.length>0&&Jo.isNode(e.contents)){let s={};_f.visit(e.contents,(o,a)=>{Jo.isNode(a)&&a.tag&&(s[a.tag]=!0)}),r=Object.keys(s)}else r=[];for(let[s,o]of i)s==="!!"&&o==="tag:yaml.org,2002:"||(!e||r.some(a=>a.startsWith(o)))&&n.push(`%TAG ${s} ${o}`);return n.join(`
5
- `)}};At.defaultYaml={explicit:!1,version:"1.2"};At.defaultTags={"!!":"tag:yaml.org,2002:"};Ho.Directives=At});var Ln=v(jt=>{"use strict";var Go=N(),Nf=Ot();function Of(t){if(/[\x00-\x19\s,[\]{}]/.test(t)){let n=`Anchor must not contain whitespace or control characters: ${JSON.stringify(t)}`;throw new Error(n)}return!0}function zo(t){let e=new Set;return Nf.visit(t,{Value(n,i){i.anchor&&e.add(i.anchor)}}),e}function Qo(t,e){for(let n=1;;++n){let i=`${t}${n}`;if(!e.has(i))return i}}function Af(t,e){let n=[],i=new Map,r=null;return{onAnchor:s=>{n.push(s),r??(r=zo(t));let o=Qo(e,r);return r.add(o),o},setAnchors:()=>{for(let s of n){let o=i.get(s);if(typeof o=="object"&&o.anchor&&(Go.isScalar(o.node)||Go.isCollection(o.node)))o.node.anchor=o.anchor;else{let a=new Error("Failed to resolve repeated object (this should not happen)");throw a.source=s,a}}},sourceObjects:i}}jt.anchorIsValid=Of;jt.anchorNames=zo;jt.createNodeAnchors=Af;jt.findNewAnchor=Qo});var kr=v(Xo=>{"use strict";function Tt(t,e,n,i){if(i&&typeof i=="object")if(Array.isArray(i))for(let r=0,s=i.length;r<s;++r){let o=i[r],a=Tt(t,i,String(r),o);a===void 0?delete i[r]:a!==o&&(i[r]=a)}else if(i instanceof Map)for(let r of Array.from(i.keys())){let s=i.get(r),o=Tt(t,i,r,s);o===void 0?i.delete(r):o!==s&&i.set(r,o)}else if(i instanceof Set)for(let r of Array.from(i)){let s=Tt(t,i,r,r);s===void 0?i.delete(r):s!==r&&(i.delete(r),i.add(s))}else for(let[r,s]of Object.entries(i)){let o=Tt(t,i,r,s);o===void 0?delete i[r]:o!==s&&(i[r]=o)}return t.call(e,n,i)}Xo.applyReviver=Tt});var Ee=v(ea=>{"use strict";var jf=N();function Zo(t,e,n){if(Array.isArray(t))return t.map((i,r)=>Zo(i,String(r),n));if(t&&typeof t.toJSON=="function"){if(!n||!jf.hasAnchor(t))return t.toJSON(e,n);let i={aliasCount:0,count:1,res:void 0};n.anchors.set(t,i),n.onCreate=s=>{i.res=s,delete n.onCreate};let r=t.toJSON(e,n);return n.onCreate&&n.onCreate(r),r}return typeof t=="bigint"&&!n?.keep?Number(t):t}ea.toJS=Zo});var Dn=v(na=>{"use strict";var Tf=kr(),ta=N(),If=Ee(),Sr=class{constructor(e){Object.defineProperty(this,ta.NODE_TYPE,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:n,maxAliasCount:i,onAnchor:r,reviver:s}={}){if(!ta.isDocument(e))throw new TypeError("A document argument is required");let o={anchors:new Map,doc:e,keep:!0,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof i=="number"?i:100},a=If.toJS(this,"",o);if(typeof r=="function")for(let{count:c,res:l}of o.anchors.values())r(l,c);return typeof s=="function"?Tf.applyReviver(s,{"":a},"",a):a}};na.NodeBase=Sr});var It=v(ia=>{"use strict";var $f=Ln(),qf=Ot(),pt=N(),Lf=Dn(),Df=Ee(),Cr=class extends Lf.NodeBase{constructor(e){super(pt.ALIAS),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e,n){if(n?.maxAliasCount===0)throw new ReferenceError("Alias resolution is disabled");let i;n?.aliasResolveCache?i=n.aliasResolveCache:(i=[],qf.visit(e,{Node:(s,o)=>{(pt.isAlias(o)||pt.hasAnchor(o))&&i.push(o)}}),n&&(n.aliasResolveCache=i));let r;for(let s of i){if(s===this)break;s.anchor===this.source&&(r=s)}return r}toJSON(e,n){if(!n)return{source:this.source};let{anchors:i,doc:r,maxAliasCount:s}=n,o=this.resolve(r,n);if(!o){let c=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(c)}let a=i.get(o);if(a||(Df.toJS(o,null,n),a=i.get(o)),a?.res===void 0){let c="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(c)}if(s>=0&&(a.count+=1,a.aliasCount===0&&(a.aliasCount=Fn(r,o,i)),a.count*a.aliasCount>s)){let c="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(c)}return a.res}toString(e,n,i){let r=`*${this.source}`;if(e){if($f.anchorIsValid(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let s=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(s)}if(e.implicitKey)return`${r} `}return r}};function Fn(t,e,n){if(pt.isAlias(e)){let i=e.resolve(t),r=n&&i&&n.get(i);return r?r.count*r.aliasCount:0}else if(pt.isCollection(e)){let i=0;for(let r of e.items){let s=Fn(t,r,n);s>i&&(i=s)}return i}else if(pt.isPair(e)){let i=Fn(t,e.key,n),r=Fn(t,e.value,n);return Math.max(i,r)}return 1}ia.Alias=Cr});var q=v(Er=>{"use strict";var Ff=N(),Mf=Dn(),Wf=Ee(),Bf=t=>!t||typeof t!="function"&&typeof t!="object",xe=class extends Mf.NodeBase{constructor(e){super(Ff.SCALAR),this.value=e}toJSON(e,n){return n?.keep?this.value:Wf.toJS(this.value,e,n)}toString(){return String(this.value)}};xe.BLOCK_FOLDED="BLOCK_FOLDED";xe.BLOCK_LITERAL="BLOCK_LITERAL";xe.PLAIN="PLAIN";xe.QUOTE_DOUBLE="QUOTE_DOUBLE";xe.QUOTE_SINGLE="QUOTE_SINGLE";Er.Scalar=xe;Er.isScalarValue=Bf});var $t=v(sa=>{"use strict";var Kf=It(),He=N(),ra=q(),Yf="tag:yaml.org,2002:";function Uf(t,e,n){if(e){let i=n.filter(s=>s.tag===e),r=i.find(s=>!s.format)??i[0];if(!r)throw new Error(`Tag ${e} not found`);return r}return n.find(i=>i.identify?.(t)&&!i.format)}function Vf(t,e,n){if(He.isDocument(t)&&(t=t.contents),He.isNode(t))return t;if(He.isPair(t)){let u=n.schema[He.MAP].createNode?.(n.schema,null,n);return u.items.push(t),u}(t instanceof String||t instanceof Number||t instanceof Boolean||typeof BigInt<"u"&&t instanceof BigInt)&&(t=t.valueOf());let{aliasDuplicateObjects:i,onAnchor:r,onTagObj:s,schema:o,sourceObjects:a}=n,c;if(i&&t&&typeof t=="object"){if(c=a.get(t),c)return c.anchor??(c.anchor=r(t)),new Kf.Alias(c.anchor);c={anchor:null,node:null},a.set(t,c)}e?.startsWith("!!")&&(e=Yf+e.slice(2));let l=Uf(t,e,o.tags);if(!l){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let u=new ra.Scalar(t);return c&&(c.node=u),u}l=t instanceof Map?o[He.MAP]:Symbol.iterator in Object(t)?o[He.SEQ]:o[He.MAP]}s&&(s(l),delete n.onTagObj);let d=l?.createNode?l.createNode(n.schema,t,n):typeof l?.nodeClass?.from=="function"?l.nodeClass.from(n.schema,t,n):new ra.Scalar(t);return e?d.tag=e:l.default||(d.tag=l.tag),c&&(c.node=d),d}sa.createNode=Vf});var Wn=v(Mn=>{"use strict";var Jf=$t(),pe=N(),Hf=Dn();function xr(t,e,n){let i=n;for(let r=e.length-1;r>=0;--r){let s=e[r];if(typeof s=="number"&&Number.isInteger(s)&&s>=0){let o=[];o[s]=i,i=o}else i=new Map([[s,i]])}return Jf.createNode(i,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:t,sourceObjects:new Map})}var oa=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,_r=class extends Hf.NodeBase{constructor(e,n){super(e),Object.defineProperty(this,"schema",{value:n,configurable:!0,enumerable:!1,writable:!0})}clone(e){let n=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(n.schema=e),n.items=n.items.map(i=>pe.isNode(i)||pe.isPair(i)?i.clone(e):i),this.range&&(n.range=this.range.slice()),n}addIn(e,n){if(oa(e))this.add(n);else{let[i,...r]=e,s=this.get(i,!0);if(pe.isCollection(s))s.addIn(r,n);else if(s===void 0&&this.schema)this.set(i,xr(this.schema,r,n));else throw new Error(`Expected YAML collection at ${i}. Remaining path: ${r}`)}}deleteIn(e){let[n,...i]=e;if(i.length===0)return this.delete(n);let r=this.get(n,!0);if(pe.isCollection(r))return r.deleteIn(i);throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}getIn(e,n){let[i,...r]=e,s=this.get(i,!0);return r.length===0?!n&&pe.isScalar(s)?s.value:s:pe.isCollection(s)?s.getIn(r,n):void 0}hasAllNullValues(e){return this.items.every(n=>{if(!pe.isPair(n))return!1;let i=n.value;return i==null||e&&pe.isScalar(i)&&i.value==null&&!i.commentBefore&&!i.comment&&!i.tag})}hasIn(e){let[n,...i]=e;if(i.length===0)return this.has(n);let r=this.get(n,!0);return pe.isCollection(r)?r.hasIn(i):!1}setIn(e,n){let[i,...r]=e;if(r.length===0)this.set(i,n);else{let s=this.get(i,!0);if(pe.isCollection(s))s.setIn(r,n);else if(s===void 0&&this.schema)this.set(i,xr(this.schema,r,n));else throw new Error(`Expected YAML collection at ${i}. Remaining path: ${r}`)}}};Mn.Collection=_r;Mn.collectionFromPath=xr;Mn.isEmptyPath=oa});var qt=v(Bn=>{"use strict";var Gf=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function Pr(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var zf=(t,e,n)=>t.endsWith(`
4
+ var vf=Object.create;var gr=Object.defineProperty;var bf=Object.getOwnPropertyDescriptor;var kf=Object.getOwnPropertyNames;var Sf=Object.getPrototypeOf,Cf=Object.prototype.hasOwnProperty;var jn=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,n)=>(typeof require<"u"?require:e)[n]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var B=(t,e,n)=>()=>{if(n)throw n[0];try{return t&&(e=t(t=0)),e}catch(i){throw n=[i],i}};var v=(t,e)=>()=>{try{return e||t((e={exports:{}}).exports,e),e.exports}catch(n){throw e=0,n}},Ef=(t,e)=>{for(var n in e)gr(t,n,{get:e[n],enumerable:!0})},xf=(t,e,n,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of kf(e))!Cf.call(t,r)&&r!==n&&gr(t,r,{get:()=>e[r],enumerable:!(i=bf(e,r))||i.enumerable});return t};var ze=(t,e,n)=>(n=t!=null?vf(Sf(t)):{},xf(e||!t||!t.__esModule?gr(n,"default",{value:t,enumerable:!0}):n,t));var N=v(V=>{"use strict";var wr=Symbol.for("yaml.alias"),Ms=Symbol.for("yaml.document"),Tn=Symbol.for("yaml.map"),Bs=Symbol.for("yaml.pair"),yr=Symbol.for("yaml.scalar"),In=Symbol.for("yaml.seq"),ge=Symbol.for("yaml.node.type"),_f=t=>!!t&&typeof t=="object"&&t[ge]===wr,Pf=t=>!!t&&typeof t=="object"&&t[ge]===Ms,Rf=t=>!!t&&typeof t=="object"&&t[ge]===Tn,Nf=t=>!!t&&typeof t=="object"&&t[ge]===Bs,Ks=t=>!!t&&typeof t=="object"&&t[ge]===yr,Af=t=>!!t&&typeof t=="object"&&t[ge]===In;function Ys(t){if(t&&typeof t=="object")switch(t[ge]){case Tn:case In:return!0}return!1}function Of(t){if(t&&typeof t=="object")switch(t[ge]){case wr:case Tn:case yr:case In:return!0}return!1}var jf=t=>(Ks(t)||Ys(t))&&!!t.anchor;V.ALIAS=wr;V.DOC=Ms;V.MAP=Tn;V.NODE_TYPE=ge;V.PAIR=Bs;V.SCALAR=yr;V.SEQ=In;V.hasAnchor=jf;V.isAlias=_f;V.isCollection=Ys;V.isDocument=Pf;V.isMap=Rf;V.isNode=Of;V.isPair=Nf;V.isScalar=Ks;V.isSeq=Af});var Ot=v(vr=>{"use strict";var K=N(),Z=Symbol("break visit"),Us=Symbol("skip children"),pe=Symbol("remove node");function $n(t,e){let n=Hs(e);K.isDocument(t)?ft(null,t.contents,n,Object.freeze([t]))===pe&&(t.contents=null):ft(null,t,n,Object.freeze([]))}$n.BREAK=Z;$n.SKIP=Us;$n.REMOVE=pe;function ft(t,e,n,i){let r=Vs(t,e,n,i);if(K.isNode(r)||K.isPair(r))return Js(t,i,r),ft(t,r,n,i);if(typeof r!="symbol"){if(K.isCollection(e)){i=Object.freeze(i.concat(e));for(let o=0;o<e.items.length;++o){let s=ft(o,e.items[o],n,i);if(typeof s=="number")o=s-1;else{if(s===Z)return Z;s===pe&&(e.items.splice(o,1),o-=1)}}}else if(K.isPair(e)){i=Object.freeze(i.concat(e));let o=ft("key",e.key,n,i);if(o===Z)return Z;o===pe&&(e.key=null);let s=ft("value",e.value,n,i);if(s===Z)return Z;s===pe&&(e.value=null)}}return r}async function qn(t,e){let n=Hs(e);K.isDocument(t)?await dt(null,t.contents,n,Object.freeze([t]))===pe&&(t.contents=null):await dt(null,t,n,Object.freeze([]))}qn.BREAK=Z;qn.SKIP=Us;qn.REMOVE=pe;async function dt(t,e,n,i){let r=await Vs(t,e,n,i);if(K.isNode(r)||K.isPair(r))return Js(t,i,r),dt(t,r,n,i);if(typeof r!="symbol"){if(K.isCollection(e)){i=Object.freeze(i.concat(e));for(let o=0;o<e.items.length;++o){let s=await dt(o,e.items[o],n,i);if(typeof s=="number")o=s-1;else{if(s===Z)return Z;s===pe&&(e.items.splice(o,1),o-=1)}}}else if(K.isPair(e)){i=Object.freeze(i.concat(e));let o=await dt("key",e.key,n,i);if(o===Z)return Z;o===pe&&(e.key=null);let s=await dt("value",e.value,n,i);if(s===Z)return Z;s===pe&&(e.value=null)}}return r}function Hs(t){return typeof t=="object"&&(t.Collection||t.Node||t.Value)?Object.assign({Alias:t.Node,Map:t.Node,Scalar:t.Node,Seq:t.Node},t.Value&&{Map:t.Value,Scalar:t.Value,Seq:t.Value},t.Collection&&{Map:t.Collection,Seq:t.Collection},t):t}function Vs(t,e,n,i){if(typeof n=="function")return n(t,e,i);if(K.isMap(e))return n.Map?.(t,e,i);if(K.isSeq(e))return n.Seq?.(t,e,i);if(K.isPair(e))return n.Pair?.(t,e,i);if(K.isScalar(e))return n.Scalar?.(t,e,i);if(K.isAlias(e))return n.Alias?.(t,e,i)}function Js(t,e,n){let i=e[e.length-1];if(K.isCollection(i))i.items[t]=n;else if(K.isPair(i))t==="key"?i.key=n:i.value=n;else if(K.isDocument(i))i.contents=n;else{let r=K.isAlias(i)?"alias":"scalar";throw new Error(`Cannot replace node with ${r} parent`)}}vr.visit=$n;vr.visitAsync=qn});var br=v(zs=>{"use strict";var Gs=N(),Tf=Ot(),If={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},$f=t=>t.replace(/[!,[\]{}]/g,e=>If[e]),jt=class t{constructor(e,n){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},t.defaultYaml,e),this.tags=Object.assign({},t.defaultTags,n)}clone(){let e=new t(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){let e=new t(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:t.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},t.defaultTags);break}return e}add(e,n){this.atNextDocument&&(this.yaml={explicit:t.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},t.defaultTags),this.atNextDocument=!1);let i=e.trim().split(/[ \t]+/),r=i.shift();switch(r){case"%TAG":{if(i.length!==2&&(n(0,"%TAG directive should contain exactly two parts"),i.length<2))return!1;let[o,s]=i;return this.tags[o]=s,!0}case"%YAML":{if(this.yaml.explicit=!0,i.length!==1)return n(0,"%YAML directive should contain exactly one part"),!1;let[o]=i;if(o==="1.1"||o==="1.2")return this.yaml.version=o,!0;{let s=/^\d+\.\d+$/.test(o);return n(6,`Unsupported YAML version ${o}`,s),!1}}default:return n(0,`Unknown directive ${r}`,!0),!1}}tagName(e,n){if(e==="!")return"!";if(e[0]!=="!")return n(`Not a valid tag: ${e}`),null;if(e[1]==="<"){let s=e.slice(2,-1);return s==="!"||s==="!!"?(n(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&n("Verbatim tags must end with a >"),s)}let[,i,r]=e.match(/^(.*!)([^!]*)$/s);r||n(`The ${e} tag has no suffix`);let o=this.tags[i];if(o)try{return o+decodeURIComponent(r)}catch(s){return n(String(s)),null}return i==="!"?e:(n(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[n,i]of Object.entries(this.tags))if(e.startsWith(i))return n+$f(e.substring(i.length));return e[0]==="!"?e:`!<${e}>`}toString(e){let n=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],i=Object.entries(this.tags),r;if(e&&i.length>0&&Gs.isNode(e.contents)){let o={};Tf.visit(e.contents,(s,a)=>{Gs.isNode(a)&&a.tag&&(o[a.tag]=!0)}),r=Object.keys(o)}else r=[];for(let[o,s]of i)o==="!!"&&s==="tag:yaml.org,2002:"||(!e||r.some(a=>a.startsWith(s)))&&n.push(`%TAG ${o} ${s}`);return n.join(`
5
+ `)}};jt.defaultYaml={explicit:!1,version:"1.2"};jt.defaultTags={"!!":"tag:yaml.org,2002:"};zs.Directives=jt});var Ln=v(Tt=>{"use strict";var Qs=N(),qf=Ot();function Lf(t){if(/[\x00-\x19\s,[\]{}]/.test(t)){let n=`Anchor must not contain whitespace or control characters: ${JSON.stringify(t)}`;throw new Error(n)}return!0}function Xs(t){let e=new Set;return qf.visit(t,{Value(n,i){i.anchor&&e.add(i.anchor)}}),e}function Zs(t,e){for(let n=1;;++n){let i=`${t}${n}`;if(!e.has(i))return i}}function Df(t,e){let n=[],i=new Map,r=null;return{onAnchor:o=>{n.push(o),r??(r=Xs(t));let s=Zs(e,r);return r.add(s),s},setAnchors:()=>{for(let o of n){let s=i.get(o);if(typeof s=="object"&&s.anchor&&(Qs.isScalar(s.node)||Qs.isCollection(s.node)))s.node.anchor=s.anchor;else{let a=new Error("Failed to resolve repeated object (this should not happen)");throw a.source=o,a}}},sourceObjects:i}}Tt.anchorIsValid=Lf;Tt.anchorNames=Xs;Tt.createNodeAnchors=Df;Tt.findNewAnchor=Zs});var kr=v(ea=>{"use strict";function It(t,e,n,i){if(i&&typeof i=="object")if(Array.isArray(i))for(let r=0,o=i.length;r<o;++r){let s=i[r],a=It(t,i,String(r),s);a===void 0?delete i[r]:a!==s&&(i[r]=a)}else if(i instanceof Map)for(let r of Array.from(i.keys())){let o=i.get(r),s=It(t,i,r,o);s===void 0?i.delete(r):s!==o&&i.set(r,s)}else if(i instanceof Set)for(let r of Array.from(i)){let o=It(t,i,r,r);o===void 0?i.delete(r):o!==r&&(i.delete(r),i.add(o))}else for(let[r,o]of Object.entries(i)){let s=It(t,i,r,o);s===void 0?delete i[r]:s!==o&&(i[r]=s)}return t.call(e,n,i)}ea.applyReviver=It});var xe=v(na=>{"use strict";var Ff=N();function ta(t,e,n){if(Array.isArray(t))return t.map((i,r)=>ta(i,String(r),n));if(t&&typeof t.toJSON=="function"){if(!n||!Ff.hasAnchor(t))return t.toJSON(e,n);let i={aliasCount:0,count:1,res:void 0};n.anchors.set(t,i),n.onCreate=o=>{i.res=o,delete n.onCreate};let r=t.toJSON(e,n);return n.onCreate&&n.onCreate(r),r}return typeof t=="bigint"&&!n?.keep?Number(t):t}na.toJS=ta});var Dn=v(ra=>{"use strict";var Wf=kr(),ia=N(),Mf=xe(),Sr=class{constructor(e){Object.defineProperty(this,ia.NODE_TYPE,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:n,maxAliasCount:i,onAnchor:r,reviver:o}={}){if(!ia.isDocument(e))throw new TypeError("A document argument is required");let s={anchors:new Map,doc:e,keep:!0,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof i=="number"?i:100},a=Mf.toJS(this,"",s);if(typeof r=="function")for(let{count:c,res:l}of s.anchors.values())r(l,c);return typeof o=="function"?Wf.applyReviver(o,{"":a},"",a):a}};ra.NodeBase=Sr});var $t=v(oa=>{"use strict";var Bf=Ln(),Kf=Ot(),pt=N(),Yf=Dn(),Uf=xe(),Cr=class extends Yf.NodeBase{constructor(e){super(pt.ALIAS),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e,n){if(n?.maxAliasCount===0)throw new ReferenceError("Alias resolution is disabled");let i;n?.aliasResolveCache?i=n.aliasResolveCache:(i=[],Kf.visit(e,{Node:(o,s)=>{(pt.isAlias(s)||pt.hasAnchor(s))&&i.push(s)}}),n&&(n.aliasResolveCache=i));let r;for(let o of i){if(o===this)break;o.anchor===this.source&&(r=o)}return r}toJSON(e,n){if(!n)return{source:this.source};let{anchors:i,doc:r,maxAliasCount:o}=n,s=this.resolve(r,n);if(!s){let c=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(c)}let a=i.get(s);if(a||(Uf.toJS(s,null,n),a=i.get(s)),a?.res===void 0){let c="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(c)}if(o>=0&&(a.count+=1,a.aliasCount===0&&(a.aliasCount=Fn(r,s,i)),a.count*a.aliasCount>o)){let c="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(c)}return a.res}toString(e,n,i){let r=`*${this.source}`;if(e){if(Bf.anchorIsValid(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let o=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(o)}if(e.implicitKey)return`${r} `}return r}};function Fn(t,e,n){if(pt.isAlias(e)){let i=e.resolve(t),r=n&&i&&n.get(i);return r?r.count*r.aliasCount:0}else if(pt.isCollection(e)){let i=0;for(let r of e.items){let o=Fn(t,r,n);o>i&&(i=o)}return i}else if(pt.isPair(e)){let i=Fn(t,e.key,n),r=Fn(t,e.value,n);return Math.max(i,r)}return 1}oa.Alias=Cr});var L=v(Er=>{"use strict";var Hf=N(),Vf=Dn(),Jf=xe(),Gf=t=>!t||typeof t!="function"&&typeof t!="object",_e=class extends Vf.NodeBase{constructor(e){super(Hf.SCALAR),this.value=e}toJSON(e,n){return n?.keep?this.value:Jf.toJS(this.value,e,n)}toString(){return String(this.value)}};_e.BLOCK_FOLDED="BLOCK_FOLDED";_e.BLOCK_LITERAL="BLOCK_LITERAL";_e.PLAIN="PLAIN";_e.QUOTE_DOUBLE="QUOTE_DOUBLE";_e.QUOTE_SINGLE="QUOTE_SINGLE";Er.Scalar=_e;Er.isScalarValue=Gf});var qt=v(aa=>{"use strict";var zf=$t(),Qe=N(),sa=L(),Qf="tag:yaml.org,2002:";function Xf(t,e,n){if(e){let i=n.filter(o=>o.tag===e),r=i.find(o=>!o.format)??i[0];if(!r)throw new Error(`Tag ${e} not found`);return r}return n.find(i=>i.identify?.(t)&&!i.format)}function Zf(t,e,n){if(Qe.isDocument(t)&&(t=t.contents),Qe.isNode(t))return t;if(Qe.isPair(t)){let u=n.schema[Qe.MAP].createNode?.(n.schema,null,n);return u.items.push(t),u}(t instanceof String||t instanceof Number||t instanceof Boolean||typeof BigInt<"u"&&t instanceof BigInt)&&(t=t.valueOf());let{aliasDuplicateObjects:i,onAnchor:r,onTagObj:o,schema:s,sourceObjects:a}=n,c;if(i&&t&&typeof t=="object"){if(c=a.get(t),c)return c.anchor??(c.anchor=r(t)),new zf.Alias(c.anchor);c={anchor:null,node:null},a.set(t,c)}e?.startsWith("!!")&&(e=Qf+e.slice(2));let l=Xf(t,e,s.tags);if(!l){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let u=new sa.Scalar(t);return c&&(c.node=u),u}l=t instanceof Map?s[Qe.MAP]:Symbol.iterator in Object(t)?s[Qe.SEQ]:s[Qe.MAP]}o&&(o(l),delete n.onTagObj);let f=l?.createNode?l.createNode(n.schema,t,n):typeof l?.nodeClass?.from=="function"?l.nodeClass.from(n.schema,t,n):new sa.Scalar(t);return e?f.tag=e:l.default||(f.tag=l.tag),c&&(c.node=f),f}aa.createNode=Zf});var Mn=v(Wn=>{"use strict";var ed=qt(),me=N(),td=Dn();function xr(t,e,n){let i=n;for(let r=e.length-1;r>=0;--r){let o=e[r];if(typeof o=="number"&&Number.isInteger(o)&&o>=0){let s=[];s[o]=i,i=s}else i=new Map([[o,i]])}return ed.createNode(i,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:t,sourceObjects:new Map})}var ca=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,_r=class extends td.NodeBase{constructor(e,n){super(e),Object.defineProperty(this,"schema",{value:n,configurable:!0,enumerable:!1,writable:!0})}clone(e){let n=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(n.schema=e),n.items=n.items.map(i=>me.isNode(i)||me.isPair(i)?i.clone(e):i),this.range&&(n.range=this.range.slice()),n}addIn(e,n){if(ca(e))this.add(n);else{let[i,...r]=e,o=this.get(i,!0);if(me.isCollection(o))o.addIn(r,n);else if(o===void 0&&this.schema)this.set(i,xr(this.schema,r,n));else throw new Error(`Expected YAML collection at ${i}. Remaining path: ${r}`)}}deleteIn(e){let[n,...i]=e;if(i.length===0)return this.delete(n);let r=this.get(n,!0);if(me.isCollection(r))return r.deleteIn(i);throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}getIn(e,n){let[i,...r]=e,o=this.get(i,!0);return r.length===0?!n&&me.isScalar(o)?o.value:o:me.isCollection(o)?o.getIn(r,n):void 0}hasAllNullValues(e){return this.items.every(n=>{if(!me.isPair(n))return!1;let i=n.value;return i==null||e&&me.isScalar(i)&&i.value==null&&!i.commentBefore&&!i.comment&&!i.tag})}hasIn(e){let[n,...i]=e;if(i.length===0)return this.has(n);let r=this.get(n,!0);return me.isCollection(r)?r.hasIn(i):!1}setIn(e,n){let[i,...r]=e;if(r.length===0)this.set(i,n);else{let o=this.get(i,!0);if(me.isCollection(o))o.setIn(r,n);else if(o===void 0&&this.schema)this.set(i,xr(this.schema,r,n));else throw new Error(`Expected YAML collection at ${i}. Remaining path: ${r}`)}}};Wn.Collection=_r;Wn.collectionFromPath=xr;Wn.isEmptyPath=ca});var Lt=v(Bn=>{"use strict";var nd=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function Pr(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var id=(t,e,n)=>t.endsWith(`
6
6
  `)?Pr(n,e):n.includes(`
7
7
  `)?`
8
- `+Pr(n,e):(t.endsWith(" ")?"":" ")+n;Bn.indentComment=Pr;Bn.lineComment=zf;Bn.stringifyComment=Gf});var ca=v(Lt=>{"use strict";var Qf="flow",Rr="block",Kn="quoted";function Xf(t,e,n="flow",{indentAtStart:i,lineWidth:r=80,minContentWidth:s=20,onFold:o,onOverflow:a}={}){if(!r||r<0)return t;r<s&&(s=0);let c=Math.max(1+s,1+r-e.length);if(t.length<=c)return t;let l=[],d={},u=r-e.length;typeof i=="number"&&(i>r-Math.max(2,s)?l.push(0):u=r-i);let f,h,w=!1,p=-1,m=-1,g=-1;n===Rr&&(p=aa(t,p,e.length),p!==-1&&(u=p+c));for(let k;k=t[p+=1];){if(n===Kn&&k==="\\"){switch(m=p,t[p+1]){case"x":p+=3;break;case"u":p+=5;break;case"U":p+=9;break;default:p+=1}g=p}if(k===`
9
- `)n===Rr&&(p=aa(t,p,e.length)),u=p+e.length+c,f=void 0;else{if(k===" "&&h&&h!==" "&&h!==`
8
+ `+Pr(n,e):(t.endsWith(" ")?"":" ")+n;Bn.indentComment=Pr;Bn.lineComment=id;Bn.stringifyComment=nd});var ua=v(Dt=>{"use strict";var rd="flow",Rr="block",Kn="quoted";function od(t,e,n="flow",{indentAtStart:i,lineWidth:r=80,minContentWidth:o=20,onFold:s,onOverflow:a}={}){if(!r||r<0)return t;r<o&&(o=0);let c=Math.max(1+o,1+r-e.length);if(t.length<=c)return t;let l=[],f={},u=r-e.length;typeof i=="number"&&(i>r-Math.max(2,o)?l.push(0):u=r-i);let d,h,w=!1,p=-1,m=-1,g=-1;n===Rr&&(p=la(t,p,e.length),p!==-1&&(u=p+c));for(let k;k=t[p+=1];){if(n===Kn&&k==="\\"){switch(m=p,t[p+1]){case"x":p+=3;break;case"u":p+=5;break;case"U":p+=9;break;default:p+=1}g=p}if(k===`
9
+ `)n===Rr&&(p=la(t,p,e.length)),u=p+e.length+c,d=void 0;else{if(k===" "&&h&&h!==" "&&h!==`
10
10
  `&&h!==" "){let C=t[p+1];C&&C!==" "&&C!==`
11
- `&&C!==" "&&(f=p)}if(p>=u)if(f)l.push(f),u=f+c,f=void 0;else if(n===Kn){for(;h===" "||h===" ";)h=k,k=t[p+=1],w=!0;let C=p>g+1?p-2:m-1;if(d[C])return t;l.push(C),d[C]=!0,u=C+c,f=void 0}else w=!0}h=k}if(w&&a&&a(),l.length===0)return t;o&&o();let y=t.slice(0,l[0]);for(let k=0;k<l.length;++k){let C=l[k],x=l[k+1]||t.length;C===0?y=`
12
- ${e}${t.slice(0,x)}`:(n===Kn&&d[C]&&(y+=`${t[C]}\\`),y+=`
13
- ${e}${t.slice(C+1,x)}`)}return y}function aa(t,e,n){let i=e,r=e+1,s=t[r];for(;s===" "||s===" ";)if(e<r+n)s=t[++e];else{do s=t[++e];while(s&&s!==`
14
- `);i=e,r=e+1,s=t[r]}return i}Lt.FOLD_BLOCK=Rr;Lt.FOLD_FLOW=Qf;Lt.FOLD_QUOTED=Kn;Lt.foldFlowLines=Xf});var Ft=v(la=>{"use strict";var ae=q(),_e=ca(),Un=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),Vn=t=>/^(%|---|\.\.\.)/m.test(t);function Zf(t,e,n){if(!e||e<0)return!1;let i=e-n,r=t.length;if(r<=i)return!1;for(let s=0,o=0;s<r;++s)if(t[s]===`
15
- `){if(s-o>i)return!0;if(o=s+1,r-o<=i)return!1}return!0}function Dt(t,e){let n=JSON.stringify(t);if(e.options.doubleQuotedAsJSON)return n;let{implicitKey:i}=e,r=e.options.doubleQuotedMinMultiLineLength,s=e.indent||(Vn(t)?" ":""),o="",a=0;for(let c=0,l=n[c];l;l=n[++c])if(l===" "&&n[c+1]==="\\"&&n[c+2]==="n"&&(o+=n.slice(a,c)+"\\ ",c+=1,a=c,l="\\"),l==="\\")switch(n[c+1]){case"u":{o+=n.slice(a,c);let d=n.substr(c+2,4);switch(d){case"0000":o+="\\0";break;case"0007":o+="\\a";break;case"000b":o+="\\v";break;case"001b":o+="\\e";break;case"0085":o+="\\N";break;case"00a0":o+="\\_";break;case"2028":o+="\\L";break;case"2029":o+="\\P";break;default:d.substr(0,2)==="00"?o+="\\x"+d.substr(2):o+=n.substr(c,6)}c+=5,a=c+1}break;case"n":if(i||n[c+2]==='"'||n.length<r)c+=1;else{for(o+=n.slice(a,c)+`
11
+ `&&C!==" "&&(d=p)}if(p>=u)if(d)l.push(d),u=d+c,d=void 0;else if(n===Kn){for(;h===" "||h===" ";)h=k,k=t[p+=1],w=!0;let C=p>g+1?p-2:m-1;if(f[C])return t;l.push(C),f[C]=!0,u=C+c,d=void 0}else w=!0}h=k}if(w&&a&&a(),l.length===0)return t;s&&s();let y=t.slice(0,l[0]);for(let k=0;k<l.length;++k){let C=l[k],x=l[k+1]||t.length;C===0?y=`
12
+ ${e}${t.slice(0,x)}`:(n===Kn&&f[C]&&(y+=`${t[C]}\\`),y+=`
13
+ ${e}${t.slice(C+1,x)}`)}return y}function la(t,e,n){let i=e,r=e+1,o=t[r];for(;o===" "||o===" ";)if(e<r+n)o=t[++e];else{do o=t[++e];while(o&&o!==`
14
+ `);i=e,r=e+1,o=t[r]}return i}Dt.FOLD_BLOCK=Rr;Dt.FOLD_FLOW=rd;Dt.FOLD_QUOTED=Kn;Dt.foldFlowLines=od});var Wt=v(fa=>{"use strict";var ce=L(),Pe=ua(),Un=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),Hn=t=>/^(%|---|\.\.\.)/m.test(t);function sd(t,e,n){if(!e||e<0)return!1;let i=e-n,r=t.length;if(r<=i)return!1;for(let o=0,s=0;o<r;++o)if(t[o]===`
15
+ `){if(o-s>i)return!0;if(s=o+1,r-s<=i)return!1}return!0}function Ft(t,e){let n=JSON.stringify(t);if(e.options.doubleQuotedAsJSON)return n;let{implicitKey:i}=e,r=e.options.doubleQuotedMinMultiLineLength,o=e.indent||(Hn(t)?" ":""),s="",a=0;for(let c=0,l=n[c];l;l=n[++c])if(l===" "&&n[c+1]==="\\"&&n[c+2]==="n"&&(s+=n.slice(a,c)+"\\ ",c+=1,a=c,l="\\"),l==="\\")switch(n[c+1]){case"u":{s+=n.slice(a,c);let f=n.substr(c+2,4);switch(f){case"0000":s+="\\0";break;case"0007":s+="\\a";break;case"000b":s+="\\v";break;case"001b":s+="\\e";break;case"0085":s+="\\N";break;case"00a0":s+="\\_";break;case"2028":s+="\\L";break;case"2029":s+="\\P";break;default:f.substr(0,2)==="00"?s+="\\x"+f.substr(2):s+=n.substr(c,6)}c+=5,a=c+1}break;case"n":if(i||n[c+2]==='"'||n.length<r)c+=1;else{for(s+=n.slice(a,c)+`
16
16
 
17
- `;n[c+2]==="\\"&&n[c+3]==="n"&&n[c+4]!=='"';)o+=`
18
- `,c+=2;o+=s,n[c+2]===" "&&(o+="\\"),c+=1,a=c+1}break;default:c+=1}return o=a?o+n.slice(a):n,i?o:_e.foldFlowLines(o,s,_e.FOLD_QUOTED,Un(e,!1))}function Nr(t,e){if(e.options.singleQuote===!1||e.implicitKey&&t.includes(`
19
- `)||/[ \t]\n|\n[ \t]/.test(t))return Dt(t,e);let n=e.indent||(Vn(t)?" ":""),i="'"+t.replace(/'/g,"''").replace(/\n+/g,`$&
20
- ${n}`)+"'";return e.implicitKey?i:_e.foldFlowLines(i,n,_e.FOLD_FLOW,Un(e,!1))}function mt(t,e){let{singleQuote:n}=e.options,i;if(n===!1)i=Dt;else{let r=t.includes('"'),s=t.includes("'");r&&!s?i=Nr:s&&!r?i=Dt:i=n?Nr:Dt}return i(t,e)}var Or;try{Or=new RegExp(`(^|(?<!
17
+ `;n[c+2]==="\\"&&n[c+3]==="n"&&n[c+4]!=='"';)s+=`
18
+ `,c+=2;s+=o,n[c+2]===" "&&(s+="\\"),c+=1,a=c+1}break;default:c+=1}return s=a?s+n.slice(a):n,i?s:Pe.foldFlowLines(s,o,Pe.FOLD_QUOTED,Un(e,!1))}function Nr(t,e){if(e.options.singleQuote===!1||e.implicitKey&&t.includes(`
19
+ `)||/[ \t]\n|\n[ \t]/.test(t))return Ft(t,e);let n=e.indent||(Hn(t)?" ":""),i="'"+t.replace(/'/g,"''").replace(/\n+/g,`$&
20
+ ${n}`)+"'";return e.implicitKey?i:Pe.foldFlowLines(i,n,Pe.FOLD_FLOW,Un(e,!1))}function mt(t,e){let{singleQuote:n}=e.options,i;if(n===!1)i=Ft;else{let r=t.includes('"'),o=t.includes("'");r&&!o?i=Nr:o&&!r?i=Ft:i=n?Nr:Ft}return i(t,e)}var Ar;try{Ar=new RegExp(`(^|(?<!
21
21
  ))
22
22
  +(?!
23
- |$)`,"g")}catch{Or=/\n+(?!\n|$)/g}function Yn({comment:t,type:e,value:n},i,r,s){let{blockQuote:o,commentString:a,lineWidth:c}=i.options;if(!o||/\n[\t ]+$/.test(n))return mt(n,i);let l=i.indent||(i.forceBlockIndent||Vn(n)?" ":""),d=o==="literal"?!0:o==="folded"||e===ae.Scalar.BLOCK_FOLDED?!1:e===ae.Scalar.BLOCK_LITERAL?!0:!Zf(n,c,l.length);if(!n)return d?`|
23
+ |$)`,"g")}catch{Ar=/\n+(?!\n|$)/g}function Yn({comment:t,type:e,value:n},i,r,o){let{blockQuote:s,commentString:a,lineWidth:c}=i.options;if(!s||/\n[\t ]+$/.test(n))return mt(n,i);let l=i.indent||(i.forceBlockIndent||Hn(n)?" ":""),f=s==="literal"?!0:s==="folded"||e===ce.Scalar.BLOCK_FOLDED?!1:e===ce.Scalar.BLOCK_LITERAL?!0:!sd(n,c,l.length);if(!n)return f?`|
24
24
  `:`>
25
- `;let u,f;for(f=n.length;f>0;--f){let x=n[f-1];if(x!==`
26
- `&&x!==" "&&x!==" ")break}let h=n.substring(f),w=h.indexOf(`
27
- `);w===-1?u="-":n===h||w!==h.length-1?(u="+",s&&s()):u="",h&&(n=n.slice(0,-h.length),h[h.length-1]===`
28
- `&&(h=h.slice(0,-1)),h=h.replace(Or,`$&${l}`));let p=!1,m,g=-1;for(m=0;m<n.length;++m){let x=n[m];if(x===" ")p=!0;else if(x===`
29
- `)g=m;else break}let y=n.substring(0,g<m?g+1:m);y&&(n=n.substring(y.length),y=y.replace(/\n+/g,`$&${l}`));let C=(p?l?"2":"1":"")+u;if(t&&(C+=" "+a(t.replace(/ ?[\r\n]+/g," ")),r&&r()),!d){let x=n.replace(/\n+/g,`
30
- $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${l}`),P=!1,j=Un(i,!0);o!=="folded"&&e!==ae.Scalar.BLOCK_FOLDED&&(j.onOverflow=()=>{P=!0});let b=_e.foldFlowLines(`${y}${x}${h}`,l,_e.FOLD_BLOCK,j);if(!P)return`>${C}
25
+ `;let u,d;for(d=n.length;d>0;--d){let x=n[d-1];if(x!==`
26
+ `&&x!==" "&&x!==" ")break}let h=n.substring(d),w=h.indexOf(`
27
+ `);w===-1?u="-":n===h||w!==h.length-1?(u="+",o&&o()):u="",h&&(n=n.slice(0,-h.length),h[h.length-1]===`
28
+ `&&(h=h.slice(0,-1)),h=h.replace(Ar,`$&${l}`));let p=!1,m,g=-1;for(m=0;m<n.length;++m){let x=n[m];if(x===" ")p=!0;else if(x===`
29
+ `)g=m;else break}let y=n.substring(0,g<m?g+1:m);y&&(n=n.substring(y.length),y=y.replace(/\n+/g,`$&${l}`));let C=(p?l?"2":"1":"")+u;if(t&&(C+=" "+a(t.replace(/ ?[\r\n]+/g," ")),r&&r()),!f){let x=n.replace(/\n+/g,`
30
+ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${l}`),P=!1,j=Un(i,!0);s!=="folded"&&e!==ce.Scalar.BLOCK_FOLDED&&(j.onOverflow=()=>{P=!0});let b=Pe.foldFlowLines(`${y}${x}${h}`,l,Pe.FOLD_BLOCK,j);if(!P)return`>${C}
31
31
  ${l}${b}`}return n=n.replace(/\n+/g,`$&${l}`),`|${C}
32
- ${l}${y}${n}${h}`}function ed(t,e,n,i){let{type:r,value:s}=t,{actualString:o,implicitKey:a,indent:c,indentStep:l,inFlow:d}=e;if(a&&s.includes(`
33
- `)||d&&/[[\]{},]/.test(s))return mt(s,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(s))return a||d||!s.includes(`
34
- `)?mt(s,e):Yn(t,e,n,i);if(!a&&!d&&r!==ae.Scalar.PLAIN&&s.includes(`
35
- `))return Yn(t,e,n,i);if(Vn(s)){if(c==="")return e.forceBlockIndent=!0,Yn(t,e,n,i);if(a&&c===l)return mt(s,e)}let u=s.replace(/\n+/g,`$&
36
- ${c}`);if(o){let f=p=>p.default&&p.tag!=="tag:yaml.org,2002:str"&&p.test?.test(u),{compat:h,tags:w}=e.doc.schema;if(w.some(f)||h?.some(f))return mt(s,e)}return a?u:_e.foldFlowLines(u,c,_e.FOLD_FLOW,Un(e,!1))}function td(t,e,n,i){let{implicitKey:r,inFlow:s}=e,o=typeof t.value=="string"?t:Object.assign({},t,{value:String(t.value)}),{type:a}=t;a!==ae.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(a=ae.Scalar.QUOTE_DOUBLE);let c=d=>{switch(d){case ae.Scalar.BLOCK_FOLDED:case ae.Scalar.BLOCK_LITERAL:return r||s?mt(o.value,e):Yn(o,e,n,i);case ae.Scalar.QUOTE_DOUBLE:return Dt(o.value,e);case ae.Scalar.QUOTE_SINGLE:return Nr(o.value,e);case ae.Scalar.PLAIN:return ed(o,e,n,i);default:return null}},l=c(a);if(l===null){let{defaultKeyType:d,defaultStringType:u}=e.options,f=r&&d||u;if(l=c(f),l===null)throw new Error(`Unsupported default string type ${f}`)}return l}la.stringifyString=td});var Mt=v(Ar=>{"use strict";var nd=Ln(),Pe=N(),id=qt(),rd=Ft();function sd(t,e){let n=Object.assign({blockQuote:!0,commentString:id.stringifyComment,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:"true",verifyAliasOrder:!0},t.schema.toStringOptions,e),i;switch(n.collectionStyle){case"block":i=!1;break;case"flow":i=!0;break;default:i=null}return{anchors:new Set,doc:t,flowCollectionPadding:n.flowCollectionPadding?" ":"",indent:"",indentStep:typeof n.indent=="number"?" ".repeat(n.indent):" ",inFlow:i,options:n}}function od(t,e){if(e.tag){let r=t.filter(s=>s.tag===e.tag);if(r.length>0)return r.find(s=>s.format===e.format)??r[0]}let n,i;if(Pe.isScalar(e)){i=e.value;let r=t.filter(s=>s.identify?.(i));if(r.length>1){let s=r.filter(o=>o.test);s.length>0&&(r=s)}n=r.find(s=>s.format===e.format)??r.find(s=>!s.format)}else i=e,n=t.find(r=>r.nodeClass&&i instanceof r.nodeClass);if(!n){let r=i?.constructor?.name??(i===null?"null":typeof i);throw new Error(`Tag not resolved for ${r} value`)}return n}function ad(t,e,{anchors:n,doc:i}){if(!i.directives)return"";let r=[],s=(Pe.isScalar(t)||Pe.isCollection(t))&&t.anchor;s&&nd.anchorIsValid(s)&&(n.add(s),r.push(`&${s}`));let o=t.tag??(e.default?null:e.tag);return o&&r.push(i.directives.tagString(o)),r.join(" ")}function cd(t,e,n,i){if(Pe.isPair(t))return t.toString(e,n,i);if(Pe.isAlias(t)){if(e.doc.directives)return t.toString(e);if(e.resolvedAliases?.has(t))throw new TypeError("Cannot stringify circular structure without alias nodes");e.resolvedAliases?e.resolvedAliases.add(t):e.resolvedAliases=new Set([t]),t=t.resolve(e.doc)}let r,s=Pe.isNode(t)?t:e.doc.createNode(t,{onTagObj:c=>r=c});r??(r=od(e.doc.schema.tags,s));let o=ad(s,r,e);o.length>0&&(e.indentAtStart=(e.indentAtStart??0)+o.length+1);let a=typeof r.stringify=="function"?r.stringify(s,e,n,i):Pe.isScalar(s)?rd.stringifyString(s,e,n,i):s.toString(e,n,i);return o?Pe.isScalar(s)||a[0]==="{"||a[0]==="["?`${o} ${a}`:`${o}
37
- ${e.indent}${a}`:a}Ar.createStringifyContext=sd;Ar.stringify=cd});var pa=v(da=>{"use strict";var we=N(),ua=q(),fa=Mt(),Wt=qt();function ld({key:t,value:e},n,i,r){let{allNullValues:s,doc:o,indent:a,indentStep:c,options:{commentString:l,indentSeq:d,simpleKeys:u}}=n,f=we.isNode(t)&&t.comment||null;if(u){if(f)throw new Error("With simple keys, key nodes cannot have comments");if(we.isCollection(t)||!we.isNode(t)&&typeof t=="object"){let j="With simple keys, collection cannot be used as a key value";throw new Error(j)}}let h=!u&&(!t||f&&e==null&&!n.inFlow||we.isCollection(t)||(we.isScalar(t)?t.type===ua.Scalar.BLOCK_FOLDED||t.type===ua.Scalar.BLOCK_LITERAL:typeof t=="object"));n=Object.assign({},n,{allNullValues:!1,implicitKey:!h&&(u||!s),indent:a+c});let w=!1,p=!1,m=fa.stringify(t,n,()=>w=!0,()=>p=!0);if(!h&&!n.inFlow&&m.length>1024){if(u)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");h=!0}if(n.inFlow){if(s||e==null)return w&&i&&i(),m===""?"?":h?`? ${m}`:m}else if(s&&!u||e==null&&h)return m=`? ${m}`,f&&!w?m+=Wt.lineComment(m,n.indent,l(f)):p&&r&&r(),m;w&&(f=null),h?(f&&(m+=Wt.lineComment(m,n.indent,l(f))),m=`? ${m}
38
- ${a}:`):(m=`${m}:`,f&&(m+=Wt.lineComment(m,n.indent,l(f))));let g,y,k;we.isNode(e)?(g=!!e.spaceBefore,y=e.commentBefore,k=e.comment):(g=!1,y=null,k=null,e&&typeof e=="object"&&(e=o.createNode(e))),n.implicitKey=!1,!h&&!f&&we.isScalar(e)&&(n.indentAtStart=m.length+1),p=!1,!d&&c.length>=2&&!n.inFlow&&!h&&we.isSeq(e)&&!e.flow&&!e.tag&&!e.anchor&&(n.indent=n.indent.substring(2));let C=!1,x=fa.stringify(e,n,()=>C=!0,()=>p=!0),P=" ";if(f||g||y){if(P=g?`
32
+ ${l}${y}${n}${h}`}function ad(t,e,n,i){let{type:r,value:o}=t,{actualString:s,implicitKey:a,indent:c,indentStep:l,inFlow:f}=e;if(a&&o.includes(`
33
+ `)||f&&/[[\]{},]/.test(o))return mt(o,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(o))return a||f||!o.includes(`
34
+ `)?mt(o,e):Yn(t,e,n,i);if(!a&&!f&&r!==ce.Scalar.PLAIN&&o.includes(`
35
+ `))return Yn(t,e,n,i);if(Hn(o)){if(c==="")return e.forceBlockIndent=!0,Yn(t,e,n,i);if(a&&c===l)return mt(o,e)}let u=o.replace(/\n+/g,`$&
36
+ ${c}`);if(s){let d=p=>p.default&&p.tag!=="tag:yaml.org,2002:str"&&p.test?.test(u),{compat:h,tags:w}=e.doc.schema;if(w.some(d)||h?.some(d))return mt(o,e)}return a?u:Pe.foldFlowLines(u,c,Pe.FOLD_FLOW,Un(e,!1))}function cd(t,e,n,i){let{implicitKey:r,inFlow:o}=e,s=typeof t.value=="string"?t:Object.assign({},t,{value:String(t.value)}),{type:a}=t;a!==ce.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(s.value)&&(a=ce.Scalar.QUOTE_DOUBLE);let c=f=>{switch(f){case ce.Scalar.BLOCK_FOLDED:case ce.Scalar.BLOCK_LITERAL:return r||o?mt(s.value,e):Yn(s,e,n,i);case ce.Scalar.QUOTE_DOUBLE:return Ft(s.value,e);case ce.Scalar.QUOTE_SINGLE:return Nr(s.value,e);case ce.Scalar.PLAIN:return ad(s,e,n,i);default:return null}},l=c(a);if(l===null){let{defaultKeyType:f,defaultStringType:u}=e.options,d=r&&f||u;if(l=c(d),l===null)throw new Error(`Unsupported default string type ${d}`)}return l}fa.stringifyString=cd});var Mt=v(Or=>{"use strict";var ld=Ln(),Re=N(),ud=Lt(),fd=Wt();function dd(t,e){let n=Object.assign({blockQuote:!0,commentString:ud.stringifyComment,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:"true",verifyAliasOrder:!0},t.schema.toStringOptions,e),i;switch(n.collectionStyle){case"block":i=!1;break;case"flow":i=!0;break;default:i=null}return{anchors:new Set,doc:t,flowCollectionPadding:n.flowCollectionPadding?" ":"",indent:"",indentStep:typeof n.indent=="number"?" ".repeat(n.indent):" ",inFlow:i,options:n}}function pd(t,e){if(e.tag){let r=t.filter(o=>o.tag===e.tag);if(r.length>0)return r.find(o=>o.format===e.format)??r[0]}let n,i;if(Re.isScalar(e)){i=e.value;let r=t.filter(o=>o.identify?.(i));if(r.length>1){let o=r.filter(s=>s.test);o.length>0&&(r=o)}n=r.find(o=>o.format===e.format)??r.find(o=>!o.format)}else i=e,n=t.find(r=>r.nodeClass&&i instanceof r.nodeClass);if(!n){let r=i?.constructor?.name??(i===null?"null":typeof i);throw new Error(`Tag not resolved for ${r} value`)}return n}function md(t,e,{anchors:n,doc:i}){if(!i.directives)return"";let r=[],o=(Re.isScalar(t)||Re.isCollection(t))&&t.anchor;o&&ld.anchorIsValid(o)&&(n.add(o),r.push(`&${o}`));let s=t.tag??(e.default?null:e.tag);return s&&r.push(i.directives.tagString(s)),r.join(" ")}function hd(t,e,n,i){if(Re.isPair(t))return t.toString(e,n,i);if(Re.isAlias(t)){if(e.doc.directives)return t.toString(e);if(e.resolvedAliases?.has(t))throw new TypeError("Cannot stringify circular structure without alias nodes");e.resolvedAliases?e.resolvedAliases.add(t):e.resolvedAliases=new Set([t]),t=t.resolve(e.doc)}let r,o=Re.isNode(t)?t:e.doc.createNode(t,{onTagObj:c=>r=c});r??(r=pd(e.doc.schema.tags,o));let s=md(o,r,e);s.length>0&&(e.indentAtStart=(e.indentAtStart??0)+s.length+1);let a=typeof r.stringify=="function"?r.stringify(o,e,n,i):Re.isScalar(o)?fd.stringifyString(o,e,n,i):o.toString(e,n,i);return s?Re.isScalar(o)||a[0]==="{"||a[0]==="["?`${s} ${a}`:`${s}
37
+ ${e.indent}${a}`:a}Or.createStringifyContext=dd;Or.stringify=hd});var ha=v(ma=>{"use strict";var we=N(),da=L(),pa=Mt(),Bt=Lt();function gd({key:t,value:e},n,i,r){let{allNullValues:o,doc:s,indent:a,indentStep:c,options:{commentString:l,indentSeq:f,simpleKeys:u}}=n,d=we.isNode(t)&&t.comment||null;if(u){if(d)throw new Error("With simple keys, key nodes cannot have comments");if(we.isCollection(t)||!we.isNode(t)&&typeof t=="object"){let j="With simple keys, collection cannot be used as a key value";throw new Error(j)}}let h=!u&&(!t||d&&e==null&&!n.inFlow||we.isCollection(t)||(we.isScalar(t)?t.type===da.Scalar.BLOCK_FOLDED||t.type===da.Scalar.BLOCK_LITERAL:typeof t=="object"));n=Object.assign({},n,{allNullValues:!1,implicitKey:!h&&(u||!o),indent:a+c});let w=!1,p=!1,m=pa.stringify(t,n,()=>w=!0,()=>p=!0);if(!h&&!n.inFlow&&m.length>1024){if(u)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");h=!0}if(n.inFlow){if(o||e==null)return w&&i&&i(),m===""?"?":h?`? ${m}`:m}else if(o&&!u||e==null&&h)return m=`? ${m}`,d&&!w?m+=Bt.lineComment(m,n.indent,l(d)):p&&r&&r(),m;w&&(d=null),h?(d&&(m+=Bt.lineComment(m,n.indent,l(d))),m=`? ${m}
38
+ ${a}:`):(m=`${m}:`,d&&(m+=Bt.lineComment(m,n.indent,l(d))));let g,y,k;we.isNode(e)?(g=!!e.spaceBefore,y=e.commentBefore,k=e.comment):(g=!1,y=null,k=null,e&&typeof e=="object"&&(e=s.createNode(e))),n.implicitKey=!1,!h&&!d&&we.isScalar(e)&&(n.indentAtStart=m.length+1),p=!1,!f&&c.length>=2&&!n.inFlow&&!h&&we.isSeq(e)&&!e.flow&&!e.tag&&!e.anchor&&(n.indent=n.indent.substring(2));let C=!1,x=pa.stringify(e,n,()=>C=!0,()=>p=!0),P=" ";if(d||g||y){if(P=g?`
39
39
  `:"",y){let j=l(y);P+=`
40
- ${Wt.indentComment(j,n.indent)}`}x===""&&!n.inFlow?P===`
40
+ ${Bt.indentComment(j,n.indent)}`}x===""&&!n.inFlow?P===`
41
41
  `&&k&&(P=`
42
42
 
43
43
  `):P+=`
44
44
  ${n.indent}`}else if(!h&&we.isCollection(e)){let j=x[0],b=x.indexOf(`
45
- `),M=b!==-1,Ce=n.inFlow??e.flow??e.items.length===0;if(M||!Ce){let ut=!1;if(M&&(j==="&"||j==="!")){let W=x.indexOf(" ");j==="&"&&W!==-1&&W<b&&x[W+1]==="!"&&(W=x.indexOf(" ",W+1)),(W===-1||b<W)&&(ut=!0)}ut||(P=`
45
+ `),W=b!==-1,Ee=n.inFlow??e.flow??e.items.length===0;if(W||!Ee){let ut=!1;if(W&&(j==="&"||j==="!")){let M=x.indexOf(" ");j==="&"&&M!==-1&&M<b&&x[M+1]==="!"&&(M=x.indexOf(" ",M+1)),(M===-1||b<M)&&(ut=!0)}ut||(P=`
46
46
  ${n.indent}`)}}else(x===""||x[0]===`
47
- `)&&(P="");return m+=P+x,n.inFlow?C&&i&&i():k&&!C?m+=Wt.lineComment(m,n.indent,l(k)):p&&r&&r(),m}da.stringifyPair=ld});var Tr=v(jr=>{"use strict";var ma=jn("process");function ud(t,...e){t==="debug"&&console.log(...e)}function fd(t,e){(t==="debug"||t==="warn")&&(typeof ma.emitWarning=="function"?ma.emitWarning(e):console.warn(e))}jr.debug=ud;jr.warn=fd});var Qn=v(zn=>{"use strict";var Gn=N(),ha=q(),Jn="<<",Hn={identify:t=>t===Jn||typeof t=="symbol"&&t.description===Jn,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new ha.Scalar(Symbol(Jn)),{addToJSMap:ga}),stringify:()=>Jn},dd=(t,e)=>(Hn.identify(e)||Gn.isScalar(e)&&(!e.type||e.type===ha.Scalar.PLAIN)&&Hn.identify(e.value))&&t?.doc.schema.tags.some(n=>n.tag===Hn.tag&&n.default);function ga(t,e,n){let i=wa(t,n);if(Gn.isSeq(i))for(let r of i.items)Ir(t,e,r);else if(Array.isArray(i))for(let r of i)Ir(t,e,r);else Ir(t,e,i)}function Ir(t,e,n){let i=wa(t,n);if(!Gn.isMap(i))throw new Error("Merge sources must be maps or map aliases");let r=i.toJSON(null,t,Map);for(let[s,o]of r)e instanceof Map?e.has(s)||e.set(s,o):e instanceof Set?e.add(s):Object.prototype.hasOwnProperty.call(e,s)||Object.defineProperty(e,s,{value:o,writable:!0,enumerable:!0,configurable:!0});return e}function wa(t,e){return t&&Gn.isAlias(e)?e.resolve(t.doc,t):e}zn.addMergeToJSMap=ga;zn.isMergeKey=dd;zn.merge=Hn});var qr=v(ba=>{"use strict";var pd=Tr(),ya=Qn(),md=Mt(),va=N(),$r=Ee();function hd(t,e,{key:n,value:i}){if(va.isNode(n)&&n.addToJSMap)n.addToJSMap(t,e,i);else if(ya.isMergeKey(t,n))ya.addMergeToJSMap(t,e,i);else{let r=$r.toJS(n,"",t);if(e instanceof Map)e.set(r,$r.toJS(i,r,t));else if(e instanceof Set)e.add(r);else{let s=gd(n,r,t),o=$r.toJS(i,s,t);s in e?Object.defineProperty(e,s,{value:o,writable:!0,enumerable:!0,configurable:!0}):e[s]=o}}return e}function gd(t,e,n){if(e===null)return"";if(typeof e!="object")return String(e);if(va.isNode(t)&&n?.doc){let i=md.createStringifyContext(n.doc,{});i.anchors=new Set;for(let s of n.anchors.keys())i.anchors.add(s.anchor);i.inFlow=!0,i.inStringifyKey=!0;let r=t.toString(i);if(!n.mapKeyWarned){let s=JSON.stringify(r);s.length>40&&(s=s.substring(0,36)+'..."'),pd.warn(n.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${s}. Set mapAsMap: true to use object keys.`),n.mapKeyWarned=!0}return r}return JSON.stringify(e)}ba.addPairToJSMap=hd});var Re=v(Lr=>{"use strict";var ka=$t(),wd=pa(),yd=qr(),Xn=N();function vd(t,e,n){let i=ka.createNode(t,void 0,n),r=ka.createNode(e,void 0,n);return new Zn(i,r)}var Zn=class t{constructor(e,n=null){Object.defineProperty(this,Xn.NODE_TYPE,{value:Xn.PAIR}),this.key=e,this.value=n}clone(e){let{key:n,value:i}=this;return Xn.isNode(n)&&(n=n.clone(e)),Xn.isNode(i)&&(i=i.clone(e)),new t(n,i)}toJSON(e,n){let i=n?.mapAsMap?new Map:{};return yd.addPairToJSMap(n,i,this)}toString(e,n,i){return e?.doc?wd.stringifyPair(this,e,n,i):JSON.stringify(this)}};Lr.Pair=Zn;Lr.createPair=vd});var Dr=v(Ca=>{"use strict";var Ge=N(),Sa=Mt(),ei=qt();function bd(t,e,n){return(e.inFlow??t.flow?Sd:kd)(t,e,n)}function kd({comment:t,items:e},n,{blockItemPrefix:i,flowChars:r,itemIndent:s,onChompKeep:o,onComment:a}){let{indent:c,options:{commentString:l}}=n,d=Object.assign({},n,{indent:s,type:null}),u=!1,f=[];for(let w=0;w<e.length;++w){let p=e[w],m=null;if(Ge.isNode(p))!u&&p.spaceBefore&&f.push(""),ti(n,f,p.commentBefore,u),p.comment&&(m=p.comment);else if(Ge.isPair(p)){let y=Ge.isNode(p.key)?p.key:null;y&&(!u&&y.spaceBefore&&f.push(""),ti(n,f,y.commentBefore,u))}u=!1;let g=Sa.stringify(p,d,()=>m=null,()=>u=!0);m&&(g+=ei.lineComment(g,s,l(m))),u&&m&&(u=!1),f.push(i+g)}let h;if(f.length===0)h=r.start+r.end;else{h=f[0];for(let w=1;w<f.length;++w){let p=f[w];h+=p?`
47
+ `)&&(P="");return m+=P+x,n.inFlow?C&&i&&i():k&&!C?m+=Bt.lineComment(m,n.indent,l(k)):p&&r&&r(),m}ma.stringifyPair=gd});var Tr=v(jr=>{"use strict";var ga=jn("process");function wd(t,...e){t==="debug"&&console.log(...e)}function yd(t,e){(t==="debug"||t==="warn")&&(typeof ga.emitWarning=="function"?ga.emitWarning(e):console.warn(e))}jr.debug=wd;jr.warn=yd});var Qn=v(zn=>{"use strict";var Gn=N(),wa=L(),Vn="<<",Jn={identify:t=>t===Vn||typeof t=="symbol"&&t.description===Vn,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new wa.Scalar(Symbol(Vn)),{addToJSMap:ya}),stringify:()=>Vn},vd=(t,e)=>(Jn.identify(e)||Gn.isScalar(e)&&(!e.type||e.type===wa.Scalar.PLAIN)&&Jn.identify(e.value))&&t?.doc.schema.tags.some(n=>n.tag===Jn.tag&&n.default);function ya(t,e,n){let i=va(t,n);if(Gn.isSeq(i))for(let r of i.items)Ir(t,e,r);else if(Array.isArray(i))for(let r of i)Ir(t,e,r);else Ir(t,e,i)}function Ir(t,e,n){let i=va(t,n);if(!Gn.isMap(i))throw new Error("Merge sources must be maps or map aliases");let r=i.toJSON(null,t,Map);for(let[o,s]of r)e instanceof Map?e.has(o)||e.set(o,s):e instanceof Set?e.add(o):Object.prototype.hasOwnProperty.call(e,o)||Object.defineProperty(e,o,{value:s,writable:!0,enumerable:!0,configurable:!0});return e}function va(t,e){return t&&Gn.isAlias(e)?e.resolve(t.doc,t):e}zn.addMergeToJSMap=ya;zn.isMergeKey=vd;zn.merge=Jn});var qr=v(Sa=>{"use strict";var bd=Tr(),ba=Qn(),kd=Mt(),ka=N(),$r=xe();function Sd(t,e,{key:n,value:i}){if(ka.isNode(n)&&n.addToJSMap)n.addToJSMap(t,e,i);else if(ba.isMergeKey(t,n))ba.addMergeToJSMap(t,e,i);else{let r=$r.toJS(n,"",t);if(e instanceof Map)e.set(r,$r.toJS(i,r,t));else if(e instanceof Set)e.add(r);else{let o=Cd(n,r,t),s=$r.toJS(i,o,t);o in e?Object.defineProperty(e,o,{value:s,writable:!0,enumerable:!0,configurable:!0}):e[o]=s}}return e}function Cd(t,e,n){if(e===null)return"";if(typeof e!="object")return String(e);if(ka.isNode(t)&&n?.doc){let i=kd.createStringifyContext(n.doc,{});i.anchors=new Set;for(let o of n.anchors.keys())i.anchors.add(o.anchor);i.inFlow=!0,i.inStringifyKey=!0;let r=t.toString(i);if(!n.mapKeyWarned){let o=JSON.stringify(r);o.length>40&&(o=o.substring(0,36)+'..."'),bd.warn(n.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${o}. Set mapAsMap: true to use object keys.`),n.mapKeyWarned=!0}return r}return JSON.stringify(e)}Sa.addPairToJSMap=Sd});var Ne=v(Lr=>{"use strict";var Ca=qt(),Ed=ha(),xd=qr(),Xn=N();function _d(t,e,n){let i=Ca.createNode(t,void 0,n),r=Ca.createNode(e,void 0,n);return new Zn(i,r)}var Zn=class t{constructor(e,n=null){Object.defineProperty(this,Xn.NODE_TYPE,{value:Xn.PAIR}),this.key=e,this.value=n}clone(e){let{key:n,value:i}=this;return Xn.isNode(n)&&(n=n.clone(e)),Xn.isNode(i)&&(i=i.clone(e)),new t(n,i)}toJSON(e,n){let i=n?.mapAsMap?new Map:{};return xd.addPairToJSMap(n,i,this)}toString(e,n,i){return e?.doc?Ed.stringifyPair(this,e,n,i):JSON.stringify(this)}};Lr.Pair=Zn;Lr.createPair=_d});var Dr=v(xa=>{"use strict";var Xe=N(),Ea=Mt(),ei=Lt();function Pd(t,e,n){return(e.inFlow??t.flow?Nd:Rd)(t,e,n)}function Rd({comment:t,items:e},n,{blockItemPrefix:i,flowChars:r,itemIndent:o,onChompKeep:s,onComment:a}){let{indent:c,options:{commentString:l}}=n,f=Object.assign({},n,{indent:o,type:null}),u=!1,d=[];for(let w=0;w<e.length;++w){let p=e[w],m=null;if(Xe.isNode(p))!u&&p.spaceBefore&&d.push(""),ti(n,d,p.commentBefore,u),p.comment&&(m=p.comment);else if(Xe.isPair(p)){let y=Xe.isNode(p.key)?p.key:null;y&&(!u&&y.spaceBefore&&d.push(""),ti(n,d,y.commentBefore,u))}u=!1;let g=Ea.stringify(p,f,()=>m=null,()=>u=!0);m&&(g+=ei.lineComment(g,o,l(m))),u&&m&&(u=!1),d.push(i+g)}let h;if(d.length===0)h=r.start+r.end;else{h=d[0];for(let w=1;w<d.length;++w){let p=d[w];h+=p?`
48
48
  ${c}${p}`:`
49
49
  `}}return t?(h+=`
50
- `+ei.indentComment(l(t),c),a&&a()):u&&o&&o(),h}function Sd({items:t},e,{flowChars:n,itemIndent:i}){let{indent:r,indentStep:s,flowCollectionPadding:o,options:{commentString:a}}=e;i+=s;let c=Object.assign({},e,{indent:i,inFlow:!0,type:null}),l=!1,d=0,u=[];for(let w=0;w<t.length;++w){let p=t[w],m=null;if(Ge.isNode(p))p.spaceBefore&&u.push(""),ti(e,u,p.commentBefore,!1),p.comment&&(m=p.comment);else if(Ge.isPair(p)){let y=Ge.isNode(p.key)?p.key:null;y&&(y.spaceBefore&&u.push(""),ti(e,u,y.commentBefore,!1),y.comment&&(l=!0));let k=Ge.isNode(p.value)?p.value:null;k?(k.comment&&(m=k.comment),k.commentBefore&&(l=!0)):p.value==null&&y?.comment&&(m=y.comment)}m&&(l=!0);let g=Sa.stringify(p,c,()=>m=null);l||(l=u.length>d||g.includes(`
51
- `)),w<t.length-1?g+=",":e.options.trailingComma&&(e.options.lineWidth>0&&(l||(l=u.reduce((y,k)=>y+k.length+2,2)+(g.length+2)>e.options.lineWidth)),l&&(g+=",")),m&&(g+=ei.lineComment(g,i,a(m))),u.push(g),d=u.length}let{start:f,end:h}=n;if(u.length===0)return f+h;if(!l){let w=u.reduce((p,m)=>p+m.length+2,2);l=e.options.lineWidth>0&&w>e.options.lineWidth}if(l){let w=f;for(let p of u)w+=p?`
52
- ${s}${r}${p}`:`
50
+ `+ei.indentComment(l(t),c),a&&a()):u&&s&&s(),h}function Nd({items:t},e,{flowChars:n,itemIndent:i}){let{indent:r,indentStep:o,flowCollectionPadding:s,options:{commentString:a}}=e;i+=o;let c=Object.assign({},e,{indent:i,inFlow:!0,type:null}),l=!1,f=0,u=[];for(let w=0;w<t.length;++w){let p=t[w],m=null;if(Xe.isNode(p))p.spaceBefore&&u.push(""),ti(e,u,p.commentBefore,!1),p.comment&&(m=p.comment);else if(Xe.isPair(p)){let y=Xe.isNode(p.key)?p.key:null;y&&(y.spaceBefore&&u.push(""),ti(e,u,y.commentBefore,!1),y.comment&&(l=!0));let k=Xe.isNode(p.value)?p.value:null;k?(k.comment&&(m=k.comment),k.commentBefore&&(l=!0)):p.value==null&&y?.comment&&(m=y.comment)}m&&(l=!0);let g=Ea.stringify(p,c,()=>m=null);l||(l=u.length>f||g.includes(`
51
+ `)),w<t.length-1?g+=",":e.options.trailingComma&&(e.options.lineWidth>0&&(l||(l=u.reduce((y,k)=>y+k.length+2,2)+(g.length+2)>e.options.lineWidth)),l&&(g+=",")),m&&(g+=ei.lineComment(g,i,a(m))),u.push(g),f=u.length}let{start:d,end:h}=n;if(u.length===0)return d+h;if(!l){let w=u.reduce((p,m)=>p+m.length+2,2);l=e.options.lineWidth>0&&w>e.options.lineWidth}if(l){let w=d;for(let p of u)w+=p?`
52
+ ${o}${r}${p}`:`
53
53
  `;return`${w}
54
- ${r}${h}`}else return`${f}${o}${u.join(" ")}${o}${h}`}function ti({indent:t,options:{commentString:e}},n,i,r){if(i&&r&&(i=i.replace(/^\n+/,"")),i){let s=ei.indentComment(e(i),t);n.push(s.trimStart())}}Ca.stringifyCollection=bd});var Oe=v(Mr=>{"use strict";var Cd=Dr(),Ed=qr(),xd=Wn(),Ne=N(),ni=Re(),_d=q();function Bt(t,e){let n=Ne.isScalar(e)?e.value:e;for(let i of t)if(Ne.isPair(i)&&(i.key===e||i.key===n||Ne.isScalar(i.key)&&i.key.value===n))return i}var Fr=class extends xd.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(Ne.MAP,e),this.items=[]}static from(e,n,i){let{keepUndefined:r,replacer:s}=i,o=new this(e),a=(c,l)=>{if(typeof s=="function")l=s.call(n,c,l);else if(Array.isArray(s)&&!s.includes(c))return;(l!==void 0||r)&&o.items.push(ni.createPair(c,l,i))};if(n instanceof Map)for(let[c,l]of n)a(c,l);else if(n&&typeof n=="object")for(let c of Object.keys(n))a(c,n[c]);return typeof e.sortMapEntries=="function"&&o.items.sort(e.sortMapEntries),o}add(e,n){let i;Ne.isPair(e)?i=e:!e||typeof e!="object"||!("key"in e)?i=new ni.Pair(e,e?.value):i=new ni.Pair(e.key,e.value);let r=Bt(this.items,i.key),s=this.schema?.sortMapEntries;if(r){if(!n)throw new Error(`Key ${i.key} already set`);Ne.isScalar(r.value)&&_d.isScalarValue(i.value)?r.value.value=i.value:r.value=i.value}else if(s){let o=this.items.findIndex(a=>s(i,a)<0);o===-1?this.items.push(i):this.items.splice(o,0,i)}else this.items.push(i)}delete(e){let n=Bt(this.items,e);return n?this.items.splice(this.items.indexOf(n),1).length>0:!1}get(e,n){let r=Bt(this.items,e)?.value;return(!n&&Ne.isScalar(r)?r.value:r)??void 0}has(e){return!!Bt(this.items,e)}set(e,n){this.add(new ni.Pair(e,n),!0)}toJSON(e,n,i){let r=i?new i:n?.mapAsMap?new Map:{};n?.onCreate&&n.onCreate(r);for(let s of this.items)Ed.addPairToJSMap(n,r,s);return r}toString(e,n,i){if(!e)return JSON.stringify(this);for(let r of this.items)if(!Ne.isPair(r))throw new Error(`Map items must all be pairs; found ${JSON.stringify(r)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),Cd.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:i,onComment:n})}};Mr.YAMLMap=Fr;Mr.findPair=Bt});var ht=v(xa=>{"use strict";var Pd=N(),Ea=Oe(),Rd={collection:"map",default:!0,nodeClass:Ea.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(t,e){return Pd.isMap(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,n)=>Ea.YAMLMap.from(t,e,n)};xa.map=Rd});var Ae=v(_a=>{"use strict";var Nd=$t(),Od=Dr(),Ad=Wn(),ri=N(),jd=q(),Td=Ee(),Wr=class extends Ad.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(ri.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let n=ii(e);return typeof n!="number"?!1:this.items.splice(n,1).length>0}get(e,n){let i=ii(e);if(typeof i!="number")return;let r=this.items[i];return!n&&ri.isScalar(r)?r.value:r}has(e){let n=ii(e);return typeof n=="number"&&n<this.items.length}set(e,n){let i=ii(e);if(typeof i!="number")throw new Error(`Expected a valid index, not ${e}.`);let r=this.items[i];ri.isScalar(r)&&jd.isScalarValue(n)?r.value=n:this.items[i]=n}toJSON(e,n){let i=[];n?.onCreate&&n.onCreate(i);let r=0;for(let s of this.items)i.push(Td.toJS(s,String(r++),n));return i}toString(e,n,i){return e?Od.stringifyCollection(this,e,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(e.indent||"")+" ",onChompKeep:i,onComment:n}):JSON.stringify(this)}static from(e,n,i){let{replacer:r}=i,s=new this(e);if(n&&Symbol.iterator in Object(n)){let o=0;for(let a of n){if(typeof r=="function"){let c=n instanceof Set?a:String(o++);a=r.call(n,c,a)}s.items.push(Nd.createNode(a,void 0,i))}}return s}};function ii(t){let e=ri.isScalar(t)?t.value:t;return e&&typeof e=="string"&&(e=Number(e)),typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}_a.YAMLSeq=Wr});var gt=v(Ra=>{"use strict";var Id=N(),Pa=Ae(),$d={collection:"seq",default:!0,nodeClass:Pa.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(t,e){return Id.isSeq(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,n)=>Pa.YAMLSeq.from(t,e,n)};Ra.seq=$d});var Kt=v(Na=>{"use strict";var qd=Ft(),Ld={identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify(t,e,n,i){return e=Object.assign({actualString:!0},e),qd.stringifyString(t,e,n,i)}};Na.string=Ld});var si=v(ja=>{"use strict";var Oa=q(),Aa={identify:t=>t==null,createNode:()=>new Oa.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new Oa.Scalar(null),stringify:({source:t},e)=>typeof t=="string"&&Aa.test.test(t)?t:e.options.nullStr};ja.nullTag=Aa});var Br=v(Ia=>{"use strict";var Dd=q(),Ta={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new Dd.Scalar(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},n){if(t&&Ta.test.test(t)){let i=t[0]==="t"||t[0]==="T";if(e===i)return t}return e?n.options.trueStr:n.options.falseStr}};Ia.boolTag=Ta});var wt=v($a=>{"use strict";function Fd({format:t,minFractionDigits:e,tag:n,value:i}){if(typeof i=="bigint")return String(i);let r=typeof i=="number"?i:Number(i);if(!isFinite(r))return isNaN(r)?".nan":r<0?"-.inf":".inf";let s=Object.is(i,-0)?"-0":JSON.stringify(i);if(!t&&e&&(!n||n==="tag:yaml.org,2002:float")&&/^-?\d/.test(s)&&!s.includes("e")){let o=s.indexOf(".");o<0&&(o=s.length,s+=".");let a=e-(s.length-o-1);for(;a-- >0;)s+="0"}return s}$a.stringifyNumber=Fd});var Yr=v(oi=>{"use strict";var Md=q(),Kr=wt(),Wd={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:t=>t.slice(-3).toLowerCase()==="nan"?NaN:t[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:Kr.stringifyNumber},Bd={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:t=>parseFloat(t),stringify(t){let e=Number(t.value);return isFinite(e)?e.toExponential():Kr.stringifyNumber(t)}},Kd={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(t){let e=new Md.Scalar(parseFloat(t)),n=t.indexOf(".");return n!==-1&&t[t.length-1]==="0"&&(e.minFractionDigits=t.length-n-1),e},stringify:Kr.stringifyNumber};oi.float=Kd;oi.floatExp=Bd;oi.floatNaN=Wd});var Vr=v(ci=>{"use strict";var qa=wt(),ai=t=>typeof t=="bigint"||Number.isInteger(t),Ur=(t,e,n,{intAsBigInt:i})=>i?BigInt(t):parseInt(t.substring(e),n);function La(t,e,n){let{value:i}=t;return ai(i)&&i>=0?n+i.toString(e):qa.stringifyNumber(t)}var Yd={identify:t=>ai(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(t,e,n)=>Ur(t,2,8,n),stringify:t=>La(t,8,"0o")},Ud={identify:ai,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,n)=>Ur(t,0,10,n),stringify:qa.stringifyNumber},Vd={identify:t=>ai(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(t,e,n)=>Ur(t,2,16,n),stringify:t=>La(t,16,"0x")};ci.int=Ud;ci.intHex=Vd;ci.intOct=Yd});var Fa=v(Da=>{"use strict";var Jd=ht(),Hd=si(),Gd=gt(),zd=Kt(),Qd=Br(),Jr=Yr(),Hr=Vr(),Xd=[Jd.map,Gd.seq,zd.string,Hd.nullTag,Qd.boolTag,Hr.intOct,Hr.int,Hr.intHex,Jr.floatNaN,Jr.floatExp,Jr.float];Da.schema=Xd});var Ba=v(Wa=>{"use strict";var Zd=q(),ep=ht(),tp=gt();function Ma(t){return typeof t=="bigint"||Number.isInteger(t)}var li=({value:t})=>JSON.stringify(t),np=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:li},{identify:t=>t==null,createNode:()=>new Zd.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:li},{identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:t=>t==="true",stringify:li},{identify:Ma,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(t,e,{intAsBigInt:n})=>n?BigInt(t):parseInt(t,10),stringify:({value:t})=>Ma(t)?t.toString():JSON.stringify(t)},{identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:t=>parseFloat(t),stringify:li}],ip={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},rp=[ep.map,tp.seq].concat(np,ip);Wa.schema=rp});var zr=v(Ka=>{"use strict";var Yt=jn("buffer"),Gr=q(),sp=Ft(),op={identify:t=>t instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(t,e){if(typeof Yt.Buffer=="function")return Yt.Buffer.from(t,"base64");if(typeof atob=="function"){let n=atob(t.replace(/[\n\r]/g,"")),i=new Uint8Array(n.length);for(let r=0;r<n.length;++r)i[r]=n.charCodeAt(r);return i}else return e("This environment does not support reading binary tags; either Buffer or atob is required"),t},stringify({comment:t,type:e,value:n},i,r,s){if(!n)return"";let o=n,a;if(typeof Yt.Buffer=="function")a=o instanceof Yt.Buffer?o.toString("base64"):Yt.Buffer.from(o.buffer).toString("base64");else if(typeof btoa=="function"){let c="";for(let l=0;l<o.length;++l)c+=String.fromCharCode(o[l]);a=btoa(c)}else throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(e??(e=Gr.Scalar.BLOCK_LITERAL),e!==Gr.Scalar.QUOTE_DOUBLE){let c=Math.max(i.options.lineWidth-i.indent.length,i.options.minContentWidth),l=Math.ceil(a.length/c),d=new Array(l);for(let u=0,f=0;u<l;++u,f+=c)d[u]=a.substr(f,c);a=d.join(e===Gr.Scalar.BLOCK_LITERAL?`
55
- `:" ")}return sp.stringifyString({comment:t,type:e,value:a},i,r,s)}};Ka.binary=op});var di=v(fi=>{"use strict";var ui=N(),Qr=Re(),ap=q(),cp=Ae();function Ya(t,e){if(ui.isSeq(t))for(let n=0;n<t.items.length;++n){let i=t.items[n];if(!ui.isPair(i)){if(ui.isMap(i)){i.items.length>1&&e("Each pair must have its own sequence indicator");let r=i.items[0]||new Qr.Pair(new ap.Scalar(null));if(i.commentBefore&&(r.key.commentBefore=r.key.commentBefore?`${i.commentBefore}
56
- ${r.key.commentBefore}`:i.commentBefore),i.comment){let s=r.value??r.key;s.comment=s.comment?`${i.comment}
57
- ${s.comment}`:i.comment}i=r}t.items[n]=ui.isPair(i)?i:new Qr.Pair(i)}}else e("Expected a sequence for this tag");return t}function Ua(t,e,n){let{replacer:i}=n,r=new cp.YAMLSeq(t);r.tag="tag:yaml.org,2002:pairs";let s=0;if(e&&Symbol.iterator in Object(e))for(let o of e){typeof i=="function"&&(o=i.call(e,String(s++),o));let a,c;if(Array.isArray(o))if(o.length===2)a=o[0],c=o[1];else throw new TypeError(`Expected [key, value] tuple: ${o}`);else if(o&&o instanceof Object){let l=Object.keys(o);if(l.length===1)a=l[0],c=o[a];else throw new TypeError(`Expected tuple with one key, not ${l.length} keys`)}else a=o;r.items.push(Qr.createPair(a,c,n))}return r}var lp={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:Ya,createNode:Ua};fi.createPairs=Ua;fi.pairs=lp;fi.resolvePairs=Ya});var es=v(Zr=>{"use strict";var Va=N(),Xr=Ee(),Ut=Oe(),up=Ae(),Ja=di(),ze=class t extends up.YAMLSeq{constructor(){super(),this.add=Ut.YAMLMap.prototype.add.bind(this),this.delete=Ut.YAMLMap.prototype.delete.bind(this),this.get=Ut.YAMLMap.prototype.get.bind(this),this.has=Ut.YAMLMap.prototype.has.bind(this),this.set=Ut.YAMLMap.prototype.set.bind(this),this.tag=t.tag}toJSON(e,n){if(!n)return super.toJSON(e);let i=new Map;n?.onCreate&&n.onCreate(i);for(let r of this.items){let s,o;if(Va.isPair(r)?(s=Xr.toJS(r.key,"",n),o=Xr.toJS(r.value,s,n)):s=Xr.toJS(r,"",n),i.has(s))throw new Error("Ordered maps must not include duplicate keys");i.set(s,o)}return i}static from(e,n,i){let r=Ja.createPairs(e,n,i),s=new this;return s.items=r.items,s}};ze.tag="tag:yaml.org,2002:omap";var fp={collection:"seq",identify:t=>t instanceof Map,nodeClass:ze,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let n=Ja.resolvePairs(t,e),i=[];for(let{key:r}of n.items)Va.isScalar(r)&&(i.includes(r.value)?e(`Ordered maps must not include duplicate keys: ${r.value}`):i.push(r.value));return Object.assign(new ze,n)},createNode:(t,e,n)=>ze.from(t,e,n)};Zr.YAMLOMap=ze;Zr.omap=fp});var Xa=v(ts=>{"use strict";var Ha=q();function Ga({value:t,source:e},n){return e&&(t?za:Qa).test.test(e)?e:t?n.options.trueStr:n.options.falseStr}var za={identify:t=>t===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new Ha.Scalar(!0),stringify:Ga},Qa={identify:t=>t===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new Ha.Scalar(!1),stringify:Ga};ts.falseTag=Qa;ts.trueTag=za});var Za=v(pi=>{"use strict";var dp=q(),ns=wt(),pp={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:t=>t.slice(-3).toLowerCase()==="nan"?NaN:t[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:ns.stringifyNumber},mp={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:t=>parseFloat(t.replace(/_/g,"")),stringify(t){let e=Number(t.value);return isFinite(e)?e.toExponential():ns.stringifyNumber(t)}},hp={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(t){let e=new dp.Scalar(parseFloat(t.replace(/_/g,""))),n=t.indexOf(".");if(n!==-1){let i=t.substring(n+1).replace(/_/g,"");i[i.length-1]==="0"&&(e.minFractionDigits=i.length)}return e},stringify:ns.stringifyNumber};pi.float=hp;pi.floatExp=mp;pi.floatNaN=pp});var tc=v(Jt=>{"use strict";var ec=wt(),Vt=t=>typeof t=="bigint"||Number.isInteger(t);function mi(t,e,n,{intAsBigInt:i}){let r=t[0];if((r==="-"||r==="+")&&(e+=1),t=t.substring(e).replace(/_/g,""),i){switch(n){case 2:t=`0b${t}`;break;case 8:t=`0o${t}`;break;case 16:t=`0x${t}`;break}let o=BigInt(t);return r==="-"?BigInt(-1)*o:o}let s=parseInt(t,n);return r==="-"?-1*s:s}function is(t,e,n){let{value:i}=t;if(Vt(i)){let r=i.toString(e);return i<0?"-"+n+r.substr(1):n+r}return ec.stringifyNumber(t)}var gp={identify:Vt,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,n)=>mi(t,2,2,n),stringify:t=>is(t,2,"0b")},wp={identify:Vt,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,n)=>mi(t,1,8,n),stringify:t=>is(t,8,"0")},yp={identify:Vt,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,n)=>mi(t,0,10,n),stringify:ec.stringifyNumber},vp={identify:Vt,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,n)=>mi(t,2,16,n),stringify:t=>is(t,16,"0x")};Jt.int=yp;Jt.intBin=gp;Jt.intHex=vp;Jt.intOct=wp});var ss=v(rs=>{"use strict";var wi=N(),hi=Re(),gi=Oe(),Qe=class t extends gi.YAMLMap{constructor(e){super(e),this.tag=t.tag}add(e){let n;wi.isPair(e)?n=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?n=new hi.Pair(e.key,null):n=new hi.Pair(e,null),gi.findPair(this.items,n.key)||this.items.push(n)}get(e,n){let i=gi.findPair(this.items,e);return!n&&wi.isPair(i)?wi.isScalar(i.key)?i.key.value:i.key:i}set(e,n){if(typeof n!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof n}`);let i=gi.findPair(this.items,e);i&&!n?this.items.splice(this.items.indexOf(i),1):!i&&n&&this.items.push(new hi.Pair(e))}toJSON(e,n){return super.toJSON(e,n,Set)}toString(e,n,i){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),n,i);throw new Error("Set items must all have null values")}static from(e,n,i){let{replacer:r}=i,s=new this(e);if(n&&Symbol.iterator in Object(n))for(let o of n)typeof r=="function"&&(o=r.call(n,o,o)),s.items.push(hi.createPair(o,null,i));return s}};Qe.tag="tag:yaml.org,2002:set";var bp={collection:"map",identify:t=>t instanceof Set,nodeClass:Qe,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,n)=>Qe.from(t,e,n),resolve(t,e){if(wi.isMap(t)){if(t.hasAllNullValues(!0))return Object.assign(new Qe,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}};rs.YAMLSet=Qe;rs.set=bp});var as=v(yi=>{"use strict";var kp=wt();function os(t,e){let n=t[0],i=n==="-"||n==="+"?t.substring(1):t,r=o=>e?BigInt(o):Number(o),s=i.replace(/_/g,"").split(":").reduce((o,a)=>o*r(60)+r(a),r(0));return n==="-"?r(-1)*s:s}function nc(t){let{value:e}=t,n=o=>o;if(typeof e=="bigint")n=o=>BigInt(o);else if(isNaN(e)||!isFinite(e))return kp.stringifyNumber(t);let i="";e<0&&(i="-",e*=n(-1));let r=n(60),s=[e%r];return e<60?s.unshift(0):(e=(e-s[0])/r,s.unshift(e%r),e>=60&&(e=(e-s[0])/r,s.unshift(e))),i+s.map(o=>String(o).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var Sp={identify:t=>typeof t=="bigint"||Number.isInteger(t),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(t,e,{intAsBigInt:n})=>os(t,n),stringify:nc},Cp={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:t=>os(t,!1),stringify:nc},ic={identify:t=>t instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(t){let e=t.match(ic.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,n,i,r,s,o,a]=e.map(Number),c=e[7]?Number((e[7]+"00").substr(1,3)):0,l=Date.UTC(n,i-1,r,s||0,o||0,a||0,c),d=e[8];if(d&&d!=="Z"){let u=os(d,!1);Math.abs(u)<30&&(u*=60),l-=6e4*u}return new Date(l)},stringify:({value:t})=>t?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};yi.floatTime=Cp;yi.intTime=Sp;yi.timestamp=ic});var oc=v(sc=>{"use strict";var Ep=ht(),xp=si(),_p=gt(),Pp=Kt(),Rp=zr(),rc=Xa(),cs=Za(),vi=tc(),Np=Qn(),Op=es(),Ap=di(),jp=ss(),ls=as(),Tp=[Ep.map,_p.seq,Pp.string,xp.nullTag,rc.trueTag,rc.falseTag,vi.intBin,vi.intOct,vi.int,vi.intHex,cs.floatNaN,cs.floatExp,cs.float,Rp.binary,Np.merge,Op.omap,Ap.pairs,jp.set,ls.intTime,ls.floatTime,ls.timestamp];sc.schema=Tp});var gc=v(ds=>{"use strict";var uc=ht(),Ip=si(),fc=gt(),$p=Kt(),qp=Br(),us=Yr(),fs=Vr(),Lp=Fa(),Dp=Ba(),dc=zr(),Ht=Qn(),pc=es(),mc=di(),ac=oc(),hc=ss(),bi=as(),cc=new Map([["core",Lp.schema],["failsafe",[uc.map,fc.seq,$p.string]],["json",Dp.schema],["yaml11",ac.schema],["yaml-1.1",ac.schema]]),lc={binary:dc.binary,bool:qp.boolTag,float:us.float,floatExp:us.floatExp,floatNaN:us.floatNaN,floatTime:bi.floatTime,int:fs.int,intHex:fs.intHex,intOct:fs.intOct,intTime:bi.intTime,map:uc.map,merge:Ht.merge,null:Ip.nullTag,omap:pc.omap,pairs:mc.pairs,seq:fc.seq,set:hc.set,timestamp:bi.timestamp},Fp={"tag:yaml.org,2002:binary":dc.binary,"tag:yaml.org,2002:merge":Ht.merge,"tag:yaml.org,2002:omap":pc.omap,"tag:yaml.org,2002:pairs":mc.pairs,"tag:yaml.org,2002:set":hc.set,"tag:yaml.org,2002:timestamp":bi.timestamp};function Mp(t,e,n){let i=cc.get(e);if(i&&!t)return n&&!i.includes(Ht.merge)?i.concat(Ht.merge):i.slice();let r=i;if(!r)if(Array.isArray(t))r=[];else{let s=Array.from(cc.keys()).filter(o=>o!=="yaml11").map(o=>JSON.stringify(o)).join(", ");throw new Error(`Unknown schema "${e}"; use one of ${s} or define customTags array`)}if(Array.isArray(t))for(let s of t)r=r.concat(s);else typeof t=="function"&&(r=t(r.slice()));return n&&(r=r.concat(Ht.merge)),r.reduce((s,o)=>{let a=typeof o=="string"?lc[o]:o;if(!a){let c=JSON.stringify(o),l=Object.keys(lc).map(d=>JSON.stringify(d)).join(", ");throw new Error(`Unknown custom tag ${c}; use one of ${l}`)}return s.includes(a)||s.push(a),s},[])}ds.coreKnownTags=Fp;ds.getTags=Mp});var hs=v(wc=>{"use strict";var ps=N(),Wp=ht(),Bp=gt(),Kp=Kt(),ki=gc(),Yp=(t,e)=>t.key<e.key?-1:t.key>e.key?1:0,ms=class t{constructor({compat:e,customTags:n,merge:i,resolveKnownTags:r,schema:s,sortMapEntries:o,toStringDefaults:a}){this.compat=Array.isArray(e)?ki.getTags(e,"compat"):e?ki.getTags(null,e):null,this.name=typeof s=="string"&&s||"core",this.knownTags=r?ki.coreKnownTags:{},this.tags=ki.getTags(n,this.name,i),this.toStringOptions=a??null,Object.defineProperty(this,ps.MAP,{value:Wp.map}),Object.defineProperty(this,ps.SCALAR,{value:Kp.string}),Object.defineProperty(this,ps.SEQ,{value:Bp.seq}),this.sortMapEntries=typeof o=="function"?o:o===!0?Yp:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};wc.Schema=ms});var vc=v(yc=>{"use strict";var Up=N(),gs=Mt(),Gt=qt();function Vp(t,e){let n=[],i=e.directives===!0;if(e.directives!==!1&&t.directives){let c=t.directives.toString(t);c?(n.push(c),i=!0):t.directives.docStart&&(i=!0)}i&&n.push("---");let r=gs.createStringifyContext(t,e),{commentString:s}=r.options;if(t.commentBefore){n.length!==1&&n.unshift("");let c=s(t.commentBefore);n.unshift(Gt.indentComment(c,""))}let o=!1,a=null;if(t.contents){if(Up.isNode(t.contents)){if(t.contents.spaceBefore&&i&&n.push(""),t.contents.commentBefore){let d=s(t.contents.commentBefore);n.push(Gt.indentComment(d,""))}r.forceBlockIndent=!!t.comment,a=t.contents.comment}let c=a?void 0:()=>o=!0,l=gs.stringify(t.contents,r,()=>a=null,c);a&&(l+=Gt.lineComment(l,"",s(a))),(l[0]==="|"||l[0]===">")&&n[n.length-1]==="---"?n[n.length-1]=`--- ${l}`:n.push(l)}else n.push(gs.stringify(t.contents,r));if(t.directives?.docEnd)if(t.comment){let c=s(t.comment);c.includes(`
58
- `)?(n.push("..."),n.push(Gt.indentComment(c,""))):n.push(`... ${c}`)}else n.push("...");else{let c=t.comment;c&&o&&(c=c.replace(/^\n+/,"")),c&&((!o||a)&&n[n.length-1]!==""&&n.push(""),n.push(Gt.indentComment(s(c),"")))}return n.join(`
54
+ ${r}${h}`}else return`${d}${s}${u.join(" ")}${s}${h}`}function ti({indent:t,options:{commentString:e}},n,i,r){if(i&&r&&(i=i.replace(/^\n+/,"")),i){let o=ei.indentComment(e(i),t);n.push(o.trimStart())}}xa.stringifyCollection=Pd});var Oe=v(Wr=>{"use strict";var Ad=Dr(),Od=qr(),jd=Mn(),Ae=N(),ni=Ne(),Td=L();function Kt(t,e){let n=Ae.isScalar(e)?e.value:e;for(let i of t)if(Ae.isPair(i)&&(i.key===e||i.key===n||Ae.isScalar(i.key)&&i.key.value===n))return i}var Fr=class extends jd.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(Ae.MAP,e),this.items=[]}static from(e,n,i){let{keepUndefined:r,replacer:o}=i,s=new this(e),a=(c,l)=>{if(typeof o=="function")l=o.call(n,c,l);else if(Array.isArray(o)&&!o.includes(c))return;(l!==void 0||r)&&s.items.push(ni.createPair(c,l,i))};if(n instanceof Map)for(let[c,l]of n)a(c,l);else if(n&&typeof n=="object")for(let c of Object.keys(n))a(c,n[c]);return typeof e.sortMapEntries=="function"&&s.items.sort(e.sortMapEntries),s}add(e,n){let i;Ae.isPair(e)?i=e:!e||typeof e!="object"||!("key"in e)?i=new ni.Pair(e,e?.value):i=new ni.Pair(e.key,e.value);let r=Kt(this.items,i.key),o=this.schema?.sortMapEntries;if(r){if(!n)throw new Error(`Key ${i.key} already set`);Ae.isScalar(r.value)&&Td.isScalarValue(i.value)?r.value.value=i.value:r.value=i.value}else if(o){let s=this.items.findIndex(a=>o(i,a)<0);s===-1?this.items.push(i):this.items.splice(s,0,i)}else this.items.push(i)}delete(e){let n=Kt(this.items,e);return n?this.items.splice(this.items.indexOf(n),1).length>0:!1}get(e,n){let r=Kt(this.items,e)?.value;return(!n&&Ae.isScalar(r)?r.value:r)??void 0}has(e){return!!Kt(this.items,e)}set(e,n){this.add(new ni.Pair(e,n),!0)}toJSON(e,n,i){let r=i?new i:n?.mapAsMap?new Map:{};n?.onCreate&&n.onCreate(r);for(let o of this.items)Od.addPairToJSMap(n,r,o);return r}toString(e,n,i){if(!e)return JSON.stringify(this);for(let r of this.items)if(!Ae.isPair(r))throw new Error(`Map items must all be pairs; found ${JSON.stringify(r)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),Ad.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:i,onComment:n})}};Wr.YAMLMap=Fr;Wr.findPair=Kt});var ht=v(Pa=>{"use strict";var Id=N(),_a=Oe(),$d={collection:"map",default:!0,nodeClass:_a.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(t,e){return Id.isMap(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,n)=>_a.YAMLMap.from(t,e,n)};Pa.map=$d});var je=v(Ra=>{"use strict";var qd=qt(),Ld=Dr(),Dd=Mn(),ri=N(),Fd=L(),Wd=xe(),Mr=class extends Dd.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(ri.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let n=ii(e);return typeof n!="number"?!1:this.items.splice(n,1).length>0}get(e,n){let i=ii(e);if(typeof i!="number")return;let r=this.items[i];return!n&&ri.isScalar(r)?r.value:r}has(e){let n=ii(e);return typeof n=="number"&&n<this.items.length}set(e,n){let i=ii(e);if(typeof i!="number")throw new Error(`Expected a valid index, not ${e}.`);let r=this.items[i];ri.isScalar(r)&&Fd.isScalarValue(n)?r.value=n:this.items[i]=n}toJSON(e,n){let i=[];n?.onCreate&&n.onCreate(i);let r=0;for(let o of this.items)i.push(Wd.toJS(o,String(r++),n));return i}toString(e,n,i){return e?Ld.stringifyCollection(this,e,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(e.indent||"")+" ",onChompKeep:i,onComment:n}):JSON.stringify(this)}static from(e,n,i){let{replacer:r}=i,o=new this(e);if(n&&Symbol.iterator in Object(n)){let s=0;for(let a of n){if(typeof r=="function"){let c=n instanceof Set?a:String(s++);a=r.call(n,c,a)}o.items.push(qd.createNode(a,void 0,i))}}return o}};function ii(t){let e=ri.isScalar(t)?t.value:t;return e&&typeof e=="string"&&(e=Number(e)),typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}Ra.YAMLSeq=Mr});var gt=v(Aa=>{"use strict";var Md=N(),Na=je(),Bd={collection:"seq",default:!0,nodeClass:Na.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(t,e){return Md.isSeq(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,n)=>Na.YAMLSeq.from(t,e,n)};Aa.seq=Bd});var Yt=v(Oa=>{"use strict";var Kd=Wt(),Yd={identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify(t,e,n,i){return e=Object.assign({actualString:!0},e),Kd.stringifyString(t,e,n,i)}};Oa.string=Yd});var oi=v(Ia=>{"use strict";var ja=L(),Ta={identify:t=>t==null,createNode:()=>new ja.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new ja.Scalar(null),stringify:({source:t},e)=>typeof t=="string"&&Ta.test.test(t)?t:e.options.nullStr};Ia.nullTag=Ta});var Br=v(qa=>{"use strict";var Ud=L(),$a={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new Ud.Scalar(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},n){if(t&&$a.test.test(t)){let i=t[0]==="t"||t[0]==="T";if(e===i)return t}return e?n.options.trueStr:n.options.falseStr}};qa.boolTag=$a});var wt=v(La=>{"use strict";function Hd({format:t,minFractionDigits:e,tag:n,value:i}){if(typeof i=="bigint")return String(i);let r=typeof i=="number"?i:Number(i);if(!isFinite(r))return isNaN(r)?".nan":r<0?"-.inf":".inf";let o=Object.is(i,-0)?"-0":JSON.stringify(i);if(!t&&e&&(!n||n==="tag:yaml.org,2002:float")&&/^-?\d/.test(o)&&!o.includes("e")){let s=o.indexOf(".");s<0&&(s=o.length,o+=".");let a=e-(o.length-s-1);for(;a-- >0;)o+="0"}return o}La.stringifyNumber=Hd});var Yr=v(si=>{"use strict";var Vd=L(),Kr=wt(),Jd={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:t=>t.slice(-3).toLowerCase()==="nan"?NaN:t[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:Kr.stringifyNumber},Gd={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:t=>parseFloat(t),stringify(t){let e=Number(t.value);return isFinite(e)?e.toExponential():Kr.stringifyNumber(t)}},zd={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(t){let e=new Vd.Scalar(parseFloat(t)),n=t.indexOf(".");return n!==-1&&t[t.length-1]==="0"&&(e.minFractionDigits=t.length-n-1),e},stringify:Kr.stringifyNumber};si.float=zd;si.floatExp=Gd;si.floatNaN=Jd});var Hr=v(ci=>{"use strict";var Da=wt(),ai=t=>typeof t=="bigint"||Number.isInteger(t),Ur=(t,e,n,{intAsBigInt:i})=>i?BigInt(t):parseInt(t.substring(e),n);function Fa(t,e,n){let{value:i}=t;return ai(i)&&i>=0?n+i.toString(e):Da.stringifyNumber(t)}var Qd={identify:t=>ai(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(t,e,n)=>Ur(t,2,8,n),stringify:t=>Fa(t,8,"0o")},Xd={identify:ai,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,n)=>Ur(t,0,10,n),stringify:Da.stringifyNumber},Zd={identify:t=>ai(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(t,e,n)=>Ur(t,2,16,n),stringify:t=>Fa(t,16,"0x")};ci.int=Xd;ci.intHex=Zd;ci.intOct=Qd});var Ma=v(Wa=>{"use strict";var ep=ht(),tp=oi(),np=gt(),ip=Yt(),rp=Br(),Vr=Yr(),Jr=Hr(),op=[ep.map,np.seq,ip.string,tp.nullTag,rp.boolTag,Jr.intOct,Jr.int,Jr.intHex,Vr.floatNaN,Vr.floatExp,Vr.float];Wa.schema=op});var Ya=v(Ka=>{"use strict";var sp=L(),ap=ht(),cp=gt();function Ba(t){return typeof t=="bigint"||Number.isInteger(t)}var li=({value:t})=>JSON.stringify(t),lp=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:li},{identify:t=>t==null,createNode:()=>new sp.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:li},{identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:t=>t==="true",stringify:li},{identify:Ba,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(t,e,{intAsBigInt:n})=>n?BigInt(t):parseInt(t,10),stringify:({value:t})=>Ba(t)?t.toString():JSON.stringify(t)},{identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:t=>parseFloat(t),stringify:li}],up={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},fp=[ap.map,cp.seq].concat(lp,up);Ka.schema=fp});var zr=v(Ua=>{"use strict";var Ut=jn("buffer"),Gr=L(),dp=Wt(),pp={identify:t=>t instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(t,e){if(typeof Ut.Buffer=="function")return Ut.Buffer.from(t,"base64");if(typeof atob=="function"){let n=atob(t.replace(/[\n\r]/g,"")),i=new Uint8Array(n.length);for(let r=0;r<n.length;++r)i[r]=n.charCodeAt(r);return i}else return e("This environment does not support reading binary tags; either Buffer or atob is required"),t},stringify({comment:t,type:e,value:n},i,r,o){if(!n)return"";let s=n,a;if(typeof Ut.Buffer=="function")a=s instanceof Ut.Buffer?s.toString("base64"):Ut.Buffer.from(s.buffer).toString("base64");else if(typeof btoa=="function"){let c="";for(let l=0;l<s.length;++l)c+=String.fromCharCode(s[l]);a=btoa(c)}else throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(e??(e=Gr.Scalar.BLOCK_LITERAL),e!==Gr.Scalar.QUOTE_DOUBLE){let c=Math.max(i.options.lineWidth-i.indent.length,i.options.minContentWidth),l=Math.ceil(a.length/c),f=new Array(l);for(let u=0,d=0;u<l;++u,d+=c)f[u]=a.substr(d,c);a=f.join(e===Gr.Scalar.BLOCK_LITERAL?`
55
+ `:" ")}return dp.stringifyString({comment:t,type:e,value:a},i,r,o)}};Ua.binary=pp});var di=v(fi=>{"use strict";var ui=N(),Qr=Ne(),mp=L(),hp=je();function Ha(t,e){if(ui.isSeq(t))for(let n=0;n<t.items.length;++n){let i=t.items[n];if(!ui.isPair(i)){if(ui.isMap(i)){i.items.length>1&&e("Each pair must have its own sequence indicator");let r=i.items[0]||new Qr.Pair(new mp.Scalar(null));if(i.commentBefore&&(r.key.commentBefore=r.key.commentBefore?`${i.commentBefore}
56
+ ${r.key.commentBefore}`:i.commentBefore),i.comment){let o=r.value??r.key;o.comment=o.comment?`${i.comment}
57
+ ${o.comment}`:i.comment}i=r}t.items[n]=ui.isPair(i)?i:new Qr.Pair(i)}}else e("Expected a sequence for this tag");return t}function Va(t,e,n){let{replacer:i}=n,r=new hp.YAMLSeq(t);r.tag="tag:yaml.org,2002:pairs";let o=0;if(e&&Symbol.iterator in Object(e))for(let s of e){typeof i=="function"&&(s=i.call(e,String(o++),s));let a,c;if(Array.isArray(s))if(s.length===2)a=s[0],c=s[1];else throw new TypeError(`Expected [key, value] tuple: ${s}`);else if(s&&s instanceof Object){let l=Object.keys(s);if(l.length===1)a=l[0],c=s[a];else throw new TypeError(`Expected tuple with one key, not ${l.length} keys`)}else a=s;r.items.push(Qr.createPair(a,c,n))}return r}var gp={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:Ha,createNode:Va};fi.createPairs=Va;fi.pairs=gp;fi.resolvePairs=Ha});var eo=v(Zr=>{"use strict";var Ja=N(),Xr=xe(),Ht=Oe(),wp=je(),Ga=di(),Ze=class t extends wp.YAMLSeq{constructor(){super(),this.add=Ht.YAMLMap.prototype.add.bind(this),this.delete=Ht.YAMLMap.prototype.delete.bind(this),this.get=Ht.YAMLMap.prototype.get.bind(this),this.has=Ht.YAMLMap.prototype.has.bind(this),this.set=Ht.YAMLMap.prototype.set.bind(this),this.tag=t.tag}toJSON(e,n){if(!n)return super.toJSON(e);let i=new Map;n?.onCreate&&n.onCreate(i);for(let r of this.items){let o,s;if(Ja.isPair(r)?(o=Xr.toJS(r.key,"",n),s=Xr.toJS(r.value,o,n)):o=Xr.toJS(r,"",n),i.has(o))throw new Error("Ordered maps must not include duplicate keys");i.set(o,s)}return i}static from(e,n,i){let r=Ga.createPairs(e,n,i),o=new this;return o.items=r.items,o}};Ze.tag="tag:yaml.org,2002:omap";var yp={collection:"seq",identify:t=>t instanceof Map,nodeClass:Ze,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let n=Ga.resolvePairs(t,e),i=[];for(let{key:r}of n.items)Ja.isScalar(r)&&(i.includes(r.value)?e(`Ordered maps must not include duplicate keys: ${r.value}`):i.push(r.value));return Object.assign(new Ze,n)},createNode:(t,e,n)=>Ze.from(t,e,n)};Zr.YAMLOMap=Ze;Zr.omap=yp});var ec=v(to=>{"use strict";var za=L();function Qa({value:t,source:e},n){return e&&(t?Xa:Za).test.test(e)?e:t?n.options.trueStr:n.options.falseStr}var Xa={identify:t=>t===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new za.Scalar(!0),stringify:Qa},Za={identify:t=>t===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new za.Scalar(!1),stringify:Qa};to.falseTag=Za;to.trueTag=Xa});var tc=v(pi=>{"use strict";var vp=L(),no=wt(),bp={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:t=>t.slice(-3).toLowerCase()==="nan"?NaN:t[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:no.stringifyNumber},kp={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:t=>parseFloat(t.replace(/_/g,"")),stringify(t){let e=Number(t.value);return isFinite(e)?e.toExponential():no.stringifyNumber(t)}},Sp={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(t){let e=new vp.Scalar(parseFloat(t.replace(/_/g,""))),n=t.indexOf(".");if(n!==-1){let i=t.substring(n+1).replace(/_/g,"");i[i.length-1]==="0"&&(e.minFractionDigits=i.length)}return e},stringify:no.stringifyNumber};pi.float=Sp;pi.floatExp=kp;pi.floatNaN=bp});var ic=v(Jt=>{"use strict";var nc=wt(),Vt=t=>typeof t=="bigint"||Number.isInteger(t);function mi(t,e,n,{intAsBigInt:i}){let r=t[0];if((r==="-"||r==="+")&&(e+=1),t=t.substring(e).replace(/_/g,""),i){switch(n){case 2:t=`0b${t}`;break;case 8:t=`0o${t}`;break;case 16:t=`0x${t}`;break}let s=BigInt(t);return r==="-"?BigInt(-1)*s:s}let o=parseInt(t,n);return r==="-"?-1*o:o}function io(t,e,n){let{value:i}=t;if(Vt(i)){let r=i.toString(e);return i<0?"-"+n+r.substr(1):n+r}return nc.stringifyNumber(t)}var Cp={identify:Vt,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,n)=>mi(t,2,2,n),stringify:t=>io(t,2,"0b")},Ep={identify:Vt,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,n)=>mi(t,1,8,n),stringify:t=>io(t,8,"0")},xp={identify:Vt,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,n)=>mi(t,0,10,n),stringify:nc.stringifyNumber},_p={identify:Vt,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,n)=>mi(t,2,16,n),stringify:t=>io(t,16,"0x")};Jt.int=xp;Jt.intBin=Cp;Jt.intHex=_p;Jt.intOct=Ep});var oo=v(ro=>{"use strict";var wi=N(),hi=Ne(),gi=Oe(),et=class t extends gi.YAMLMap{constructor(e){super(e),this.tag=t.tag}add(e){let n;wi.isPair(e)?n=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?n=new hi.Pair(e.key,null):n=new hi.Pair(e,null),gi.findPair(this.items,n.key)||this.items.push(n)}get(e,n){let i=gi.findPair(this.items,e);return!n&&wi.isPair(i)?wi.isScalar(i.key)?i.key.value:i.key:i}set(e,n){if(typeof n!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof n}`);let i=gi.findPair(this.items,e);i&&!n?this.items.splice(this.items.indexOf(i),1):!i&&n&&this.items.push(new hi.Pair(e))}toJSON(e,n){return super.toJSON(e,n,Set)}toString(e,n,i){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),n,i);throw new Error("Set items must all have null values")}static from(e,n,i){let{replacer:r}=i,o=new this(e);if(n&&Symbol.iterator in Object(n))for(let s of n)typeof r=="function"&&(s=r.call(n,s,s)),o.items.push(hi.createPair(s,null,i));return o}};et.tag="tag:yaml.org,2002:set";var Pp={collection:"map",identify:t=>t instanceof Set,nodeClass:et,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,n)=>et.from(t,e,n),resolve(t,e){if(wi.isMap(t)){if(t.hasAllNullValues(!0))return Object.assign(new et,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}};ro.YAMLSet=et;ro.set=Pp});var ao=v(yi=>{"use strict";var Rp=wt();function so(t,e){let n=t[0],i=n==="-"||n==="+"?t.substring(1):t,r=s=>e?BigInt(s):Number(s),o=i.replace(/_/g,"").split(":").reduce((s,a)=>s*r(60)+r(a),r(0));return n==="-"?r(-1)*o:o}function rc(t){let{value:e}=t,n=s=>s;if(typeof e=="bigint")n=s=>BigInt(s);else if(isNaN(e)||!isFinite(e))return Rp.stringifyNumber(t);let i="";e<0&&(i="-",e*=n(-1));let r=n(60),o=[e%r];return e<60?o.unshift(0):(e=(e-o[0])/r,o.unshift(e%r),e>=60&&(e=(e-o[0])/r,o.unshift(e))),i+o.map(s=>String(s).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var Np={identify:t=>typeof t=="bigint"||Number.isInteger(t),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(t,e,{intAsBigInt:n})=>so(t,n),stringify:rc},Ap={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:t=>so(t,!1),stringify:rc},oc={identify:t=>t instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(t){let e=t.match(oc.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,n,i,r,o,s,a]=e.map(Number),c=e[7]?Number((e[7]+"00").substr(1,3)):0,l=Date.UTC(n,i-1,r,o||0,s||0,a||0,c),f=e[8];if(f&&f!=="Z"){let u=so(f,!1);Math.abs(u)<30&&(u*=60),l-=6e4*u}return new Date(l)},stringify:({value:t})=>t?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};yi.floatTime=Ap;yi.intTime=Np;yi.timestamp=oc});var cc=v(ac=>{"use strict";var Op=ht(),jp=oi(),Tp=gt(),Ip=Yt(),$p=zr(),sc=ec(),co=tc(),vi=ic(),qp=Qn(),Lp=eo(),Dp=di(),Fp=oo(),lo=ao(),Wp=[Op.map,Tp.seq,Ip.string,jp.nullTag,sc.trueTag,sc.falseTag,vi.intBin,vi.intOct,vi.int,vi.intHex,co.floatNaN,co.floatExp,co.float,$p.binary,qp.merge,Lp.omap,Dp.pairs,Fp.set,lo.intTime,lo.floatTime,lo.timestamp];ac.schema=Wp});var yc=v(po=>{"use strict";var dc=ht(),Mp=oi(),pc=gt(),Bp=Yt(),Kp=Br(),uo=Yr(),fo=Hr(),Yp=Ma(),Up=Ya(),mc=zr(),Gt=Qn(),hc=eo(),gc=di(),lc=cc(),wc=oo(),bi=ao(),uc=new Map([["core",Yp.schema],["failsafe",[dc.map,pc.seq,Bp.string]],["json",Up.schema],["yaml11",lc.schema],["yaml-1.1",lc.schema]]),fc={binary:mc.binary,bool:Kp.boolTag,float:uo.float,floatExp:uo.floatExp,floatNaN:uo.floatNaN,floatTime:bi.floatTime,int:fo.int,intHex:fo.intHex,intOct:fo.intOct,intTime:bi.intTime,map:dc.map,merge:Gt.merge,null:Mp.nullTag,omap:hc.omap,pairs:gc.pairs,seq:pc.seq,set:wc.set,timestamp:bi.timestamp},Hp={"tag:yaml.org,2002:binary":mc.binary,"tag:yaml.org,2002:merge":Gt.merge,"tag:yaml.org,2002:omap":hc.omap,"tag:yaml.org,2002:pairs":gc.pairs,"tag:yaml.org,2002:set":wc.set,"tag:yaml.org,2002:timestamp":bi.timestamp};function Vp(t,e,n){let i=uc.get(e);if(i&&!t)return n&&!i.includes(Gt.merge)?i.concat(Gt.merge):i.slice();let r=i;if(!r)if(Array.isArray(t))r=[];else{let o=Array.from(uc.keys()).filter(s=>s!=="yaml11").map(s=>JSON.stringify(s)).join(", ");throw new Error(`Unknown schema "${e}"; use one of ${o} or define customTags array`)}if(Array.isArray(t))for(let o of t)r=r.concat(o);else typeof t=="function"&&(r=t(r.slice()));return n&&(r=r.concat(Gt.merge)),r.reduce((o,s)=>{let a=typeof s=="string"?fc[s]:s;if(!a){let c=JSON.stringify(s),l=Object.keys(fc).map(f=>JSON.stringify(f)).join(", ");throw new Error(`Unknown custom tag ${c}; use one of ${l}`)}return o.includes(a)||o.push(a),o},[])}po.coreKnownTags=Hp;po.getTags=Vp});var go=v(vc=>{"use strict";var mo=N(),Jp=ht(),Gp=gt(),zp=Yt(),ki=yc(),Qp=(t,e)=>t.key<e.key?-1:t.key>e.key?1:0,ho=class t{constructor({compat:e,customTags:n,merge:i,resolveKnownTags:r,schema:o,sortMapEntries:s,toStringDefaults:a}){this.compat=Array.isArray(e)?ki.getTags(e,"compat"):e?ki.getTags(null,e):null,this.name=typeof o=="string"&&o||"core",this.knownTags=r?ki.coreKnownTags:{},this.tags=ki.getTags(n,this.name,i),this.toStringOptions=a??null,Object.defineProperty(this,mo.MAP,{value:Jp.map}),Object.defineProperty(this,mo.SCALAR,{value:zp.string}),Object.defineProperty(this,mo.SEQ,{value:Gp.seq}),this.sortMapEntries=typeof s=="function"?s:s===!0?Qp:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};vc.Schema=ho});var kc=v(bc=>{"use strict";var Xp=N(),wo=Mt(),zt=Lt();function Zp(t,e){let n=[],i=e.directives===!0;if(e.directives!==!1&&t.directives){let c=t.directives.toString(t);c?(n.push(c),i=!0):t.directives.docStart&&(i=!0)}i&&n.push("---");let r=wo.createStringifyContext(t,e),{commentString:o}=r.options;if(t.commentBefore){n.length!==1&&n.unshift("");let c=o(t.commentBefore);n.unshift(zt.indentComment(c,""))}let s=!1,a=null;if(t.contents){if(Xp.isNode(t.contents)){if(t.contents.spaceBefore&&i&&n.push(""),t.contents.commentBefore){let f=o(t.contents.commentBefore);n.push(zt.indentComment(f,""))}r.forceBlockIndent=!!t.comment,a=t.contents.comment}let c=a?void 0:()=>s=!0,l=wo.stringify(t.contents,r,()=>a=null,c);a&&(l+=zt.lineComment(l,"",o(a))),(l[0]==="|"||l[0]===">")&&n[n.length-1]==="---"?n[n.length-1]=`--- ${l}`:n.push(l)}else n.push(wo.stringify(t.contents,r));if(t.directives?.docEnd)if(t.comment){let c=o(t.comment);c.includes(`
58
+ `)?(n.push("..."),n.push(zt.indentComment(c,""))):n.push(`... ${c}`)}else n.push("...");else{let c=t.comment;c&&s&&(c=c.replace(/^\n+/,"")),c&&((!s||a)&&n[n.length-1]!==""&&n.push(""),n.push(zt.indentComment(o(c),"")))}return n.join(`
59
59
  `)+`
60
- `}yc.stringifyDocument=Vp});var zt=v(bc=>{"use strict";var Jp=It(),yt=Wn(),re=N(),Hp=Re(),Gp=Ee(),zp=hs(),Qp=vc(),ws=Ln(),Xp=kr(),Zp=$t(),ys=br(),vs=class t{constructor(e,n,i){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,re.NODE_TYPE,{value:re.DOC});let r=null;typeof n=="function"||Array.isArray(n)?r=n:i===void 0&&n&&(i=n,n=void 0);let s=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},i);this.options=s;let{version:o}=s;i?._directives?(this.directives=i._directives.atDocument(),this.directives.yaml.explicit&&(o=this.directives.yaml.version)):this.directives=new ys.Directives({version:o}),this.setSchema(o,i),this.contents=e===void 0?null:this.createNode(e,r,i)}clone(){let e=Object.create(t.prototype,{[re.NODE_TYPE]:{value:re.DOC}});return e.commentBefore=this.commentBefore,e.comment=this.comment,e.errors=this.errors.slice(),e.warnings=this.warnings.slice(),e.options=Object.assign({},this.options),this.directives&&(e.directives=this.directives.clone()),e.schema=this.schema.clone(),e.contents=re.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){vt(this.contents)&&this.contents.add(e)}addIn(e,n){vt(this.contents)&&this.contents.addIn(e,n)}createAlias(e,n){if(!e.anchor){let i=ws.anchorNames(this);e.anchor=!n||i.has(n)?ws.findNewAnchor(n||"a",i):n}return new Jp.Alias(e.anchor)}createNode(e,n,i){let r;if(typeof n=="function")e=n.call({"":e},"",e),r=n;else if(Array.isArray(n)){let m=y=>typeof y=="number"||y instanceof String||y instanceof Number,g=n.filter(m).map(String);g.length>0&&(n=n.concat(g)),r=n}else i===void 0&&n&&(i=n,n=void 0);let{aliasDuplicateObjects:s,anchorPrefix:o,flow:a,keepUndefined:c,onTagObj:l,tag:d}=i??{},{onAnchor:u,setAnchors:f,sourceObjects:h}=ws.createNodeAnchors(this,o||"a"),w={aliasDuplicateObjects:s??!0,keepUndefined:c??!1,onAnchor:u,onTagObj:l,replacer:r,schema:this.schema,sourceObjects:h},p=Zp.createNode(e,d,w);return a&&re.isCollection(p)&&(p.flow=!0),f(),p}createPair(e,n,i={}){let r=this.createNode(e,null,i),s=this.createNode(n,null,i);return new Hp.Pair(r,s)}delete(e){return vt(this.contents)?this.contents.delete(e):!1}deleteIn(e){return yt.isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):vt(this.contents)?this.contents.deleteIn(e):!1}get(e,n){return re.isCollection(this.contents)?this.contents.get(e,n):void 0}getIn(e,n){return yt.isEmptyPath(e)?!n&&re.isScalar(this.contents)?this.contents.value:this.contents:re.isCollection(this.contents)?this.contents.getIn(e,n):void 0}has(e){return re.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return yt.isEmptyPath(e)?this.contents!==void 0:re.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,n){this.contents==null?this.contents=yt.collectionFromPath(this.schema,[e],n):vt(this.contents)&&this.contents.set(e,n)}setIn(e,n){yt.isEmptyPath(e)?this.contents=n:this.contents==null?this.contents=yt.collectionFromPath(this.schema,Array.from(e),n):vt(this.contents)&&this.contents.setIn(e,n)}setSchema(e,n={}){typeof e=="number"&&(e=String(e));let i;switch(e){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new ys.Directives({version:"1.1"}),i={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=e:this.directives=new ys.Directives({version:e}),i={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,i=null;break;default:{let r=JSON.stringify(e);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${r}`)}}if(n.schema instanceof Object)this.schema=n.schema;else if(i)this.schema=new zp.Schema(Object.assign(i,n));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:e,jsonArg:n,mapAsMap:i,maxAliasCount:r,onAnchor:s,reviver:o}={}){let a={anchors:new Map,doc:this,keep:!e,mapAsMap:i===!0,mapKeyWarned:!1,maxAliasCount:typeof r=="number"?r:100},c=Gp.toJS(this.contents,n??"",a);if(typeof s=="function")for(let{count:l,res:d}of a.anchors.values())s(d,l);return typeof o=="function"?Xp.applyReviver(o,{"":c},"",c):c}toJSON(e,n){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:n})}toString(e={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in e&&(!Number.isInteger(e.indent)||Number(e.indent)<=0)){let n=JSON.stringify(e.indent);throw new Error(`"indent" option must be a positive integer, not ${n}`)}return Qp.stringifyDocument(this,e)}};function vt(t){if(re.isCollection(t))return!0;throw new Error("Expected a YAML collection as document contents")}bc.Document=vs});var Zt=v(Xt=>{"use strict";var Qt=class extends Error{constructor(e,n,i,r){super(),this.name=e,this.code=i,this.message=r,this.pos=n}},bs=class extends Qt{constructor(e,n,i){super("YAMLParseError",e,n,i)}},ks=class extends Qt{constructor(e,n,i){super("YAMLWarning",e,n,i)}},em=(t,e)=>n=>{if(n.pos[0]===-1)return;n.linePos=n.pos.map(a=>e.linePos(a));let{line:i,col:r}=n.linePos[0];n.message+=` at line ${i}, column ${r}`;let s=r-1,o=t.substring(e.lineStarts[i-1],e.lineStarts[i]).replace(/[\n\r]+$/,"");if(s>=60&&o.length>80){let a=Math.min(s-39,o.length-79);o="…"+o.substring(a),s-=a-1}if(o.length>80&&(o=o.substring(0,79)+"…"),i>1&&/^ *$/.test(o.substring(0,s))){let a=t.substring(e.lineStarts[i-2],e.lineStarts[i-1]);a.length>80&&(a=a.substring(0,79)+`…
61
- `),o=a+o}if(/[^ ]/.test(o)){let a=1,c=n.linePos[1];c?.line===i&&c.col>r&&(a=Math.max(1,Math.min(c.col-r,80-s)));let l=" ".repeat(s)+"^".repeat(a);n.message+=`:
60
+ `}bc.stringifyDocument=Zp});var Qt=v(Sc=>{"use strict";var em=$t(),yt=Mn(),re=N(),tm=Ne(),nm=xe(),im=go(),rm=kc(),yo=Ln(),om=kr(),sm=qt(),vo=br(),bo=class t{constructor(e,n,i){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,re.NODE_TYPE,{value:re.DOC});let r=null;typeof n=="function"||Array.isArray(n)?r=n:i===void 0&&n&&(i=n,n=void 0);let o=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},i);this.options=o;let{version:s}=o;i?._directives?(this.directives=i._directives.atDocument(),this.directives.yaml.explicit&&(s=this.directives.yaml.version)):this.directives=new vo.Directives({version:s}),this.setSchema(s,i),this.contents=e===void 0?null:this.createNode(e,r,i)}clone(){let e=Object.create(t.prototype,{[re.NODE_TYPE]:{value:re.DOC}});return e.commentBefore=this.commentBefore,e.comment=this.comment,e.errors=this.errors.slice(),e.warnings=this.warnings.slice(),e.options=Object.assign({},this.options),this.directives&&(e.directives=this.directives.clone()),e.schema=this.schema.clone(),e.contents=re.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){vt(this.contents)&&this.contents.add(e)}addIn(e,n){vt(this.contents)&&this.contents.addIn(e,n)}createAlias(e,n){if(!e.anchor){let i=yo.anchorNames(this);e.anchor=!n||i.has(n)?yo.findNewAnchor(n||"a",i):n}return new em.Alias(e.anchor)}createNode(e,n,i){let r;if(typeof n=="function")e=n.call({"":e},"",e),r=n;else if(Array.isArray(n)){let m=y=>typeof y=="number"||y instanceof String||y instanceof Number,g=n.filter(m).map(String);g.length>0&&(n=n.concat(g)),r=n}else i===void 0&&n&&(i=n,n=void 0);let{aliasDuplicateObjects:o,anchorPrefix:s,flow:a,keepUndefined:c,onTagObj:l,tag:f}=i??{},{onAnchor:u,setAnchors:d,sourceObjects:h}=yo.createNodeAnchors(this,s||"a"),w={aliasDuplicateObjects:o??!0,keepUndefined:c??!1,onAnchor:u,onTagObj:l,replacer:r,schema:this.schema,sourceObjects:h},p=sm.createNode(e,f,w);return a&&re.isCollection(p)&&(p.flow=!0),d(),p}createPair(e,n,i={}){let r=this.createNode(e,null,i),o=this.createNode(n,null,i);return new tm.Pair(r,o)}delete(e){return vt(this.contents)?this.contents.delete(e):!1}deleteIn(e){return yt.isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):vt(this.contents)?this.contents.deleteIn(e):!1}get(e,n){return re.isCollection(this.contents)?this.contents.get(e,n):void 0}getIn(e,n){return yt.isEmptyPath(e)?!n&&re.isScalar(this.contents)?this.contents.value:this.contents:re.isCollection(this.contents)?this.contents.getIn(e,n):void 0}has(e){return re.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return yt.isEmptyPath(e)?this.contents!==void 0:re.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,n){this.contents==null?this.contents=yt.collectionFromPath(this.schema,[e],n):vt(this.contents)&&this.contents.set(e,n)}setIn(e,n){yt.isEmptyPath(e)?this.contents=n:this.contents==null?this.contents=yt.collectionFromPath(this.schema,Array.from(e),n):vt(this.contents)&&this.contents.setIn(e,n)}setSchema(e,n={}){typeof e=="number"&&(e=String(e));let i;switch(e){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new vo.Directives({version:"1.1"}),i={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=e:this.directives=new vo.Directives({version:e}),i={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,i=null;break;default:{let r=JSON.stringify(e);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${r}`)}}if(n.schema instanceof Object)this.schema=n.schema;else if(i)this.schema=new im.Schema(Object.assign(i,n));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:e,jsonArg:n,mapAsMap:i,maxAliasCount:r,onAnchor:o,reviver:s}={}){let a={anchors:new Map,doc:this,keep:!e,mapAsMap:i===!0,mapKeyWarned:!1,maxAliasCount:typeof r=="number"?r:100},c=nm.toJS(this.contents,n??"",a);if(typeof o=="function")for(let{count:l,res:f}of a.anchors.values())o(f,l);return typeof s=="function"?om.applyReviver(s,{"":c},"",c):c}toJSON(e,n){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:n})}toString(e={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in e&&(!Number.isInteger(e.indent)||Number(e.indent)<=0)){let n=JSON.stringify(e.indent);throw new Error(`"indent" option must be a positive integer, not ${n}`)}return rm.stringifyDocument(this,e)}};function vt(t){if(re.isCollection(t))return!0;throw new Error("Expected a YAML collection as document contents")}Sc.Document=bo});var en=v(Zt=>{"use strict";var Xt=class extends Error{constructor(e,n,i,r){super(),this.name=e,this.code=i,this.message=r,this.pos=n}},ko=class extends Xt{constructor(e,n,i){super("YAMLParseError",e,n,i)}},So=class extends Xt{constructor(e,n,i){super("YAMLWarning",e,n,i)}},am=(t,e)=>n=>{if(n.pos[0]===-1)return;n.linePos=n.pos.map(a=>e.linePos(a));let{line:i,col:r}=n.linePos[0];n.message+=` at line ${i}, column ${r}`;let o=r-1,s=t.substring(e.lineStarts[i-1],e.lineStarts[i]).replace(/[\n\r]+$/,"");if(o>=60&&s.length>80){let a=Math.min(o-39,s.length-79);s="…"+s.substring(a),o-=a-1}if(s.length>80&&(s=s.substring(0,79)+"…"),i>1&&/^ *$/.test(s.substring(0,o))){let a=t.substring(e.lineStarts[i-2],e.lineStarts[i-1]);a.length>80&&(a=a.substring(0,79)+`…
61
+ `),s=a+s}if(/[^ ]/.test(s)){let a=1,c=n.linePos[1];c?.line===i&&c.col>r&&(a=Math.max(1,Math.min(c.col-r,80-o)));let l=" ".repeat(o)+"^".repeat(a);n.message+=`:
62
62
 
63
- ${o}
63
+ ${s}
64
64
  ${l}
65
- `}};Xt.YAMLError=Qt;Xt.YAMLParseError=bs;Xt.YAMLWarning=ks;Xt.prettifyError=em});var en=v(kc=>{"use strict";function tm(t,{flow:e,indicator:n,next:i,offset:r,onError:s,parentIndent:o,startOnNewline:a}){let c=!1,l=a,d=a,u="",f="",h=!1,w=!1,p=null,m=null,g=null,y=null,k=null,C=null,x=null;for(let b of t)switch(w&&(b.type!=="space"&&b.type!=="newline"&&b.type!=="comma"&&s(b.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),w=!1),p&&(l&&b.type!=="comment"&&b.type!=="newline"&&s(p,"TAB_AS_INDENT","Tabs are not allowed as indentation"),p=null),b.type){case"space":!e&&(n!=="doc-start"||i?.type!=="flow-collection")&&b.source.includes(" ")&&(p=b),d=!0;break;case"comment":{d||s(b,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let M=b.source.substring(1)||" ";u?u+=f+M:u=M,f="",l=!1;break}case"newline":l?u?u+=b.source:(!C||n!=="seq-item-ind")&&(c=!0):f+=b.source,l=!0,h=!0,(m||g)&&(y=b),d=!0;break;case"anchor":m&&s(b,"MULTIPLE_ANCHORS","A node can have at most one anchor"),b.source.endsWith(":")&&s(b.offset+b.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),m=b,x??(x=b.offset),l=!1,d=!1,w=!0;break;case"tag":{g&&s(b,"MULTIPLE_TAGS","A node can have at most one tag"),g=b,x??(x=b.offset),l=!1,d=!1,w=!0;break}case n:(m||g)&&s(b,"BAD_PROP_ORDER",`Anchors and tags must be after the ${b.source} indicator`),C&&s(b,"UNEXPECTED_TOKEN",`Unexpected ${b.source} in ${e??"collection"}`),C=b,l=n==="seq-item-ind"||n==="explicit-key-ind",d=!1;break;case"comma":if(e){k&&s(b,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),k=b,l=!1,d=!1;break}default:s(b,"UNEXPECTED_TOKEN",`Unexpected ${b.type} token`),l=!1,d=!1}let P=t[t.length-1],j=P?P.offset+P.source.length:r;return w&&i&&i.type!=="space"&&i.type!=="newline"&&i.type!=="comma"&&(i.type!=="scalar"||i.source!=="")&&s(i.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),p&&(l&&p.indent<=o||i?.type==="block-map"||i?.type==="block-seq")&&s(p,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:k,found:C,spaceBefore:c,comment:u,hasNewline:h,anchor:m,tag:g,newlineAfterProp:y,end:j,start:x??j}}kc.resolveProps=tm});var Si=v(Sc=>{"use strict";function Ss(t){if(!t)return null;switch(t.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(t.source.includes(`
66
- `))return!0;if(t.end){for(let e of t.end)if(e.type==="newline")return!0}return!1;case"flow-collection":for(let e of t.items){for(let n of e.start)if(n.type==="newline")return!0;if(e.sep){for(let n of e.sep)if(n.type==="newline")return!0}if(Ss(e.key)||Ss(e.value))return!0}return!1;default:return!0}}Sc.containsNewline=Ss});var Cs=v(Cc=>{"use strict";var nm=Si();function im(t,e,n){if(e?.type==="flow-collection"){let i=e.end[0];i.indent===t&&(i.source==="]"||i.source==="}")&&nm.containsNewline(e)&&n(i,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}Cc.flowIndentCheck=im});var Es=v(xc=>{"use strict";var Ec=N();function rm(t,e,n){let{uniqueKeys:i}=t.options;if(i===!1)return!1;let r=typeof i=="function"?i:(s,o)=>s===o||Ec.isScalar(s)&&Ec.isScalar(o)&&s.value===o.value;return e.some(s=>r(s.key,n))}xc.mapIncludes=rm});var Ac=v(Oc=>{"use strict";var _c=Re(),sm=Oe(),Pc=en(),om=Si(),Rc=Cs(),am=Es(),Nc="All mapping items must start at the same column";function cm({composeNode:t,composeEmptyNode:e},n,i,r,s){let o=s?.nodeClass??sm.YAMLMap,a=new o(n.schema);n.atRoot&&(n.atRoot=!1);let c=i.offset,l=null;for(let d of i.items){let{start:u,key:f,sep:h,value:w}=d,p=Pc.resolveProps(u,{indicator:"explicit-key-ind",next:f??h?.[0],offset:c,onError:r,parentIndent:i.indent,startOnNewline:!0}),m=!p.found;if(m){if(f&&(f.type==="block-seq"?r(c,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in f&&f.indent!==i.indent&&r(c,"BAD_INDENT",Nc)),!p.anchor&&!p.tag&&!h){l=p.end,p.comment&&(a.comment?a.comment+=`
67
- `+p.comment:a.comment=p.comment);continue}(p.newlineAfterProp||om.containsNewline(f))&&r(f??u[u.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else p.found?.indent!==i.indent&&r(c,"BAD_INDENT",Nc);n.atKey=!0;let g=p.end,y=f?t(n,f,p,r):e(n,g,u,null,p,r);n.schema.compat&&Rc.flowIndentCheck(i.indent,f,r),n.atKey=!1,am.mapIncludes(n,a.items,y)&&r(g,"DUPLICATE_KEY","Map keys must be unique");let k=Pc.resolveProps(h??[],{indicator:"map-value-ind",next:w,offset:y.range[2],onError:r,parentIndent:i.indent,startOnNewline:!f||f.type==="block-scalar"});if(c=k.end,k.found){m&&(w?.type==="block-map"&&!k.hasNewline&&r(c,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),n.options.strict&&p.start<k.found.offset-1024&&r(y.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));let C=w?t(n,w,k,r):e(n,c,h,null,k,r);n.schema.compat&&Rc.flowIndentCheck(i.indent,w,r),c=C.range[2];let x=new _c.Pair(y,C);n.options.keepSourceTokens&&(x.srcToken=d),a.items.push(x)}else{m&&r(y.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),k.comment&&(y.comment?y.comment+=`
68
- `+k.comment:y.comment=k.comment);let C=new _c.Pair(y);n.options.keepSourceTokens&&(C.srcToken=d),a.items.push(C)}}return l&&l<c&&r(l,"IMPOSSIBLE","Map comment with trailing content"),a.range=[i.offset,c,l??c],a}Oc.resolveBlockMap=cm});var Tc=v(jc=>{"use strict";var lm=Ae(),um=en(),fm=Cs();function dm({composeNode:t,composeEmptyNode:e},n,i,r,s){let o=s?.nodeClass??lm.YAMLSeq,a=new o(n.schema);n.atRoot&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let c=i.offset,l=null;for(let{start:d,value:u}of i.items){let f=um.resolveProps(d,{indicator:"seq-item-ind",next:u,offset:c,onError:r,parentIndent:i.indent,startOnNewline:!0});if(!f.found)if(f.anchor||f.tag||u)u?.type==="block-seq"?r(f.end,"BAD_INDENT","All sequence items must start at the same column"):r(c,"MISSING_CHAR","Sequence item without - indicator");else{l=f.end,f.comment&&(a.comment=f.comment);continue}let h=u?t(n,u,f,r):e(n,f.end,d,null,f,r);n.schema.compat&&fm.flowIndentCheck(i.indent,u,r),c=h.range[2],a.items.push(h)}return a.range=[i.offset,c,l??c],a}jc.resolveBlockSeq=dm});var bt=v(Ic=>{"use strict";function pm(t,e,n,i){let r="";if(t){let s=!1,o="";for(let a of t){let{source:c,type:l}=a;switch(l){case"space":s=!0;break;case"comment":{n&&!s&&i(a,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let d=c.substring(1)||" ";r?r+=o+d:r=d,o="";break}case"newline":r&&(o+=c),s=!0;break;default:i(a,"UNEXPECTED_TOKEN",`Unexpected ${l} at node end`)}e+=c.length}}return{comment:r,offset:e}}Ic.resolveEnd=pm});var Dc=v(Lc=>{"use strict";var mm=N(),hm=Re(),$c=Oe(),gm=Ae(),wm=bt(),qc=en(),ym=Si(),vm=Es(),xs="Block collections are not allowed within flow collections",_s=t=>t&&(t.type==="block-map"||t.type==="block-seq");function bm({composeNode:t,composeEmptyNode:e},n,i,r,s){let o=i.start.source==="{",a=o?"flow map":"flow sequence",c=s?.nodeClass??(o?$c.YAMLMap:gm.YAMLSeq),l=new c(n.schema);l.flow=!0;let d=n.atRoot;d&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let u=i.offset+i.start.source.length;for(let m=0;m<i.items.length;++m){let g=i.items[m],{start:y,key:k,sep:C,value:x}=g,P=qc.resolveProps(y,{flow:a,indicator:"explicit-key-ind",next:k??C?.[0],offset:u,onError:r,parentIndent:i.indent,startOnNewline:!1});if(!P.found){if(!P.anchor&&!P.tag&&!C&&!x){m===0&&P.comma?r(P.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`):m<i.items.length-1&&r(P.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${a}`),P.comment&&(l.comment?l.comment+=`
69
- `+P.comment:l.comment=P.comment),u=P.end;continue}!o&&n.options.strict&&ym.containsNewline(k)&&r(k,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(m===0)P.comma&&r(P.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`);else if(P.comma||r(P.start,"MISSING_CHAR",`Missing , between ${a} items`),P.comment){let j="";e:for(let b of y)switch(b.type){case"comma":case"space":break;case"comment":j=b.source.substring(1);break e;default:break e}if(j){let b=l.items[l.items.length-1];mm.isPair(b)&&(b=b.value??b.key),b.comment?b.comment+=`
70
- `+j:b.comment=j,P.comment=P.comment.substring(j.length+1)}}if(!o&&!C&&!P.found){let j=x?t(n,x,P,r):e(n,P.end,C,null,P,r);l.items.push(j),u=j.range[2],_s(x)&&r(j.range,"BLOCK_IN_FLOW",xs)}else{n.atKey=!0;let j=P.end,b=k?t(n,k,P,r):e(n,j,y,null,P,r);_s(k)&&r(b.range,"BLOCK_IN_FLOW",xs),n.atKey=!1;let M=qc.resolveProps(C??[],{flow:a,indicator:"map-value-ind",next:x,offset:b.range[2],onError:r,parentIndent:i.indent,startOnNewline:!1});if(M.found){if(!o&&!P.found&&n.options.strict){if(C)for(let W of C){if(W===M.found)break;if(W.type==="newline"){r(W,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}P.start<M.found.offset-1024&&r(M.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else x&&("source"in x&&x.source?.[0]===":"?r(x,"MISSING_CHAR",`Missing space after : in ${a}`):r(M.start,"MISSING_CHAR",`Missing , or : between ${a} items`));let Ce=x?t(n,x,M,r):M.found?e(n,M.end,C,null,M,r):null;Ce?_s(x)&&r(Ce.range,"BLOCK_IN_FLOW",xs):M.comment&&(b.comment?b.comment+=`
71
- `+M.comment:b.comment=M.comment);let ut=new hm.Pair(b,Ce);if(n.options.keepSourceTokens&&(ut.srcToken=g),o){let W=l;vm.mapIncludes(n,W.items,b)&&r(j,"DUPLICATE_KEY","Map keys must be unique"),W.items.push(ut)}else{let W=new $c.YAMLMap(n.schema);W.flow=!0,W.items.push(ut);let Do=(Ce??b).range;W.range=[b.range[0],Do[1],Do[2]],l.items.push(W)}u=Ce?Ce.range[2]:M.end}}let f=o?"}":"]",[h,...w]=i.end,p=u;if(h?.source===f)p=h.offset+h.source.length;else{let m=a[0].toUpperCase()+a.substring(1),g=d?`${m} must end with a ${f}`:`${m} in block collection must be sufficiently indented and end with a ${f}`;r(u,d?"MISSING_CHAR":"BAD_INDENT",g),h&&h.source.length!==1&&w.unshift(h)}if(w.length>0){let m=wm.resolveEnd(w,p,n.options.strict,r);m.comment&&(l.comment?l.comment+=`
72
- `+m.comment:l.comment=m.comment),l.range=[i.offset,p,m.offset]}else l.range=[i.offset,p,p];return l}Lc.resolveFlowCollection=bm});var Mc=v(Fc=>{"use strict";var km=N(),Sm=q(),Cm=Oe(),Em=Ae(),xm=Ac(),_m=Tc(),Pm=Dc();function Ps(t,e,n,i,r,s){let o=n.type==="block-map"?xm.resolveBlockMap(t,e,n,i,s):n.type==="block-seq"?_m.resolveBlockSeq(t,e,n,i,s):Pm.resolveFlowCollection(t,e,n,i,s),a=o.constructor;return r==="!"||r===a.tagName?(o.tag=a.tagName,o):(r&&(o.tag=r),o)}function Rm(t,e,n,i,r){let s=i.tag,o=s?e.directives.tagName(s.source,f=>r(s,"TAG_RESOLVE_FAILED",f)):null;if(n.type==="block-seq"){let{anchor:f,newlineAfterProp:h}=i,w=f&&s?f.offset>s.offset?f:s:f??s;w&&(!h||h.offset<w.offset)&&r(w,"MISSING_CHAR","Missing newline after block sequence props")}let a=n.type==="block-map"?"map":n.type==="block-seq"?"seq":n.start.source==="{"?"map":"seq";if(!s||!o||o==="!"||o===Cm.YAMLMap.tagName&&a==="map"||o===Em.YAMLSeq.tagName&&a==="seq")return Ps(t,e,n,r,o);let c=e.schema.tags.find(f=>f.tag===o&&f.collection===a);if(!c){let f=e.schema.knownTags[o];if(f?.collection===a)e.schema.tags.push(Object.assign({},f,{default:!1})),c=f;else return f?r(s,"BAD_COLLECTION_TYPE",`${f.tag} used for ${a} collection, but expects ${f.collection??"scalar"}`,!0):r(s,"TAG_RESOLVE_FAILED",`Unresolved tag: ${o}`,!0),Ps(t,e,n,r,o)}let l=Ps(t,e,n,r,o,c),d=c.resolve?.(l,f=>r(s,"TAG_RESOLVE_FAILED",f),e.options)??l,u=km.isNode(d)?d:new Sm.Scalar(d);return u.range=l.range,u.tag=o,c?.format&&(u.format=c.format),u}Fc.composeCollection=Rm});var Ns=v(Wc=>{"use strict";var Rs=q();function Nm(t,e,n){let i=e.offset,r=Om(e,t.options.strict,n);if(!r)return{value:"",type:null,comment:"",range:[i,i,i]};let s=r.mode===">"?Rs.Scalar.BLOCK_FOLDED:Rs.Scalar.BLOCK_LITERAL,o=e.source?Am(e.source):[],a=o.length;for(let p=o.length-1;p>=0;--p){let m=o[p][1];if(m===""||m==="\r")a=p;else break}if(a===0){let p=r.chomp==="+"&&o.length>0?`
73
- `.repeat(Math.max(1,o.length-1)):"",m=i+r.length;return e.source&&(m+=e.source.length),{value:p,type:s,comment:r.comment,range:[i,m,m]}}let c=e.indent+r.indent,l=e.offset+r.length,d=0;for(let p=0;p<a;++p){let[m,g]=o[p];if(g===""||g==="\r")r.indent===0&&m.length>c&&(c=m.length);else{m.length<c&&n(l+m.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator"),r.indent===0&&(c=m.length),d=p,c===0&&!t.atRoot&&n(l,"BAD_INDENT","Block scalar values in collections must be indented");break}l+=m.length+g.length+1}for(let p=o.length-1;p>=a;--p)o[p][0].length>c&&(a=p+1);let u="",f="",h=!1;for(let p=0;p<d;++p)u+=o[p][0].slice(c)+`
74
- `;for(let p=d;p<a;++p){let[m,g]=o[p];l+=m.length+g.length+1;let y=g[g.length-1]==="\r";if(y&&(g=g.slice(0,-1)),g&&m.length<c){let C=`Block scalar lines must not be less indented than their ${r.indent?"explicit indentation indicator":"first line"}`;n(l-g.length-(y?2:1),"BAD_INDENT",C),m=""}s===Rs.Scalar.BLOCK_LITERAL?(u+=f+m.slice(c)+g,f=`
75
- `):m.length>c||g[0]===" "?(f===" "?f=`
76
- `:!h&&f===`
77
- `&&(f=`
65
+ `}};Zt.YAMLError=Xt;Zt.YAMLParseError=ko;Zt.YAMLWarning=So;Zt.prettifyError=am});var tn=v(Cc=>{"use strict";function cm(t,{flow:e,indicator:n,next:i,offset:r,onError:o,parentIndent:s,startOnNewline:a}){let c=!1,l=a,f=a,u="",d="",h=!1,w=!1,p=null,m=null,g=null,y=null,k=null,C=null,x=null;for(let b of t)switch(w&&(b.type!=="space"&&b.type!=="newline"&&b.type!=="comma"&&o(b.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),w=!1),p&&(l&&b.type!=="comment"&&b.type!=="newline"&&o(p,"TAB_AS_INDENT","Tabs are not allowed as indentation"),p=null),b.type){case"space":!e&&(n!=="doc-start"||i?.type!=="flow-collection")&&b.source.includes(" ")&&(p=b),f=!0;break;case"comment":{f||o(b,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let W=b.source.substring(1)||" ";u?u+=d+W:u=W,d="",l=!1;break}case"newline":l?u?u+=b.source:(!C||n!=="seq-item-ind")&&(c=!0):d+=b.source,l=!0,h=!0,(m||g)&&(y=b),f=!0;break;case"anchor":m&&o(b,"MULTIPLE_ANCHORS","A node can have at most one anchor"),b.source.endsWith(":")&&o(b.offset+b.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),m=b,x??(x=b.offset),l=!1,f=!1,w=!0;break;case"tag":{g&&o(b,"MULTIPLE_TAGS","A node can have at most one tag"),g=b,x??(x=b.offset),l=!1,f=!1,w=!0;break}case n:(m||g)&&o(b,"BAD_PROP_ORDER",`Anchors and tags must be after the ${b.source} indicator`),C&&o(b,"UNEXPECTED_TOKEN",`Unexpected ${b.source} in ${e??"collection"}`),C=b,l=n==="seq-item-ind"||n==="explicit-key-ind",f=!1;break;case"comma":if(e){k&&o(b,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),k=b,l=!1,f=!1;break}default:o(b,"UNEXPECTED_TOKEN",`Unexpected ${b.type} token`),l=!1,f=!1}let P=t[t.length-1],j=P?P.offset+P.source.length:r;return w&&i&&i.type!=="space"&&i.type!=="newline"&&i.type!=="comma"&&(i.type!=="scalar"||i.source!=="")&&o(i.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),p&&(l&&p.indent<=s||i?.type==="block-map"||i?.type==="block-seq")&&o(p,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:k,found:C,spaceBefore:c,comment:u,hasNewline:h,anchor:m,tag:g,newlineAfterProp:y,end:j,start:x??j}}Cc.resolveProps=cm});var Si=v(Ec=>{"use strict";function Co(t){if(!t)return null;switch(t.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(t.source.includes(`
66
+ `))return!0;if(t.end){for(let e of t.end)if(e.type==="newline")return!0}return!1;case"flow-collection":for(let e of t.items){for(let n of e.start)if(n.type==="newline")return!0;if(e.sep){for(let n of e.sep)if(n.type==="newline")return!0}if(Co(e.key)||Co(e.value))return!0}return!1;default:return!0}}Ec.containsNewline=Co});var Eo=v(xc=>{"use strict";var lm=Si();function um(t,e,n){if(e?.type==="flow-collection"){let i=e.end[0];i.indent===t&&(i.source==="]"||i.source==="}")&&lm.containsNewline(e)&&n(i,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}xc.flowIndentCheck=um});var xo=v(Pc=>{"use strict";var _c=N();function fm(t,e,n){let{uniqueKeys:i}=t.options;if(i===!1)return!1;let r=typeof i=="function"?i:(o,s)=>o===s||_c.isScalar(o)&&_c.isScalar(s)&&o.value===s.value;return e.some(o=>r(o.key,n))}Pc.mapIncludes=fm});var Tc=v(jc=>{"use strict";var Rc=Ne(),dm=Oe(),Nc=tn(),pm=Si(),Ac=Eo(),mm=xo(),Oc="All mapping items must start at the same column";function hm({composeNode:t,composeEmptyNode:e},n,i,r,o){let s=o?.nodeClass??dm.YAMLMap,a=new s(n.schema);n.atRoot&&(n.atRoot=!1);let c=i.offset,l=null;for(let f of i.items){let{start:u,key:d,sep:h,value:w}=f,p=Nc.resolveProps(u,{indicator:"explicit-key-ind",next:d??h?.[0],offset:c,onError:r,parentIndent:i.indent,startOnNewline:!0}),m=!p.found;if(m){if(d&&(d.type==="block-seq"?r(c,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in d&&d.indent!==i.indent&&r(c,"BAD_INDENT",Oc)),!p.anchor&&!p.tag&&!h){l=p.end,p.comment&&(a.comment?a.comment+=`
67
+ `+p.comment:a.comment=p.comment);continue}(p.newlineAfterProp||pm.containsNewline(d))&&r(d??u[u.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else p.found?.indent!==i.indent&&r(c,"BAD_INDENT",Oc);n.atKey=!0;let g=p.end,y=d?t(n,d,p,r):e(n,g,u,null,p,r);n.schema.compat&&Ac.flowIndentCheck(i.indent,d,r),n.atKey=!1,mm.mapIncludes(n,a.items,y)&&r(g,"DUPLICATE_KEY","Map keys must be unique");let k=Nc.resolveProps(h??[],{indicator:"map-value-ind",next:w,offset:y.range[2],onError:r,parentIndent:i.indent,startOnNewline:!d||d.type==="block-scalar"});if(c=k.end,k.found){m&&(w?.type==="block-map"&&!k.hasNewline&&r(c,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),n.options.strict&&p.start<k.found.offset-1024&&r(y.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));let C=w?t(n,w,k,r):e(n,c,h,null,k,r);n.schema.compat&&Ac.flowIndentCheck(i.indent,w,r),c=C.range[2];let x=new Rc.Pair(y,C);n.options.keepSourceTokens&&(x.srcToken=f),a.items.push(x)}else{m&&r(y.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),k.comment&&(y.comment?y.comment+=`
68
+ `+k.comment:y.comment=k.comment);let C=new Rc.Pair(y);n.options.keepSourceTokens&&(C.srcToken=f),a.items.push(C)}}return l&&l<c&&r(l,"IMPOSSIBLE","Map comment with trailing content"),a.range=[i.offset,c,l??c],a}jc.resolveBlockMap=hm});var $c=v(Ic=>{"use strict";var gm=je(),wm=tn(),ym=Eo();function vm({composeNode:t,composeEmptyNode:e},n,i,r,o){let s=o?.nodeClass??gm.YAMLSeq,a=new s(n.schema);n.atRoot&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let c=i.offset,l=null;for(let{start:f,value:u}of i.items){let d=wm.resolveProps(f,{indicator:"seq-item-ind",next:u,offset:c,onError:r,parentIndent:i.indent,startOnNewline:!0});if(!d.found)if(d.anchor||d.tag||u)u?.type==="block-seq"?r(d.end,"BAD_INDENT","All sequence items must start at the same column"):r(c,"MISSING_CHAR","Sequence item without - indicator");else{l=d.end,d.comment&&(a.comment=d.comment);continue}let h=u?t(n,u,d,r):e(n,d.end,f,null,d,r);n.schema.compat&&ym.flowIndentCheck(i.indent,u,r),c=h.range[2],a.items.push(h)}return a.range=[i.offset,c,l??c],a}Ic.resolveBlockSeq=vm});var bt=v(qc=>{"use strict";function bm(t,e,n,i){let r="";if(t){let o=!1,s="";for(let a of t){let{source:c,type:l}=a;switch(l){case"space":o=!0;break;case"comment":{n&&!o&&i(a,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let f=c.substring(1)||" ";r?r+=s+f:r=f,s="";break}case"newline":r&&(s+=c),o=!0;break;default:i(a,"UNEXPECTED_TOKEN",`Unexpected ${l} at node end`)}e+=c.length}}return{comment:r,offset:e}}qc.resolveEnd=bm});var Wc=v(Fc=>{"use strict";var km=N(),Sm=Ne(),Lc=Oe(),Cm=je(),Em=bt(),Dc=tn(),xm=Si(),_m=xo(),_o="Block collections are not allowed within flow collections",Po=t=>t&&(t.type==="block-map"||t.type==="block-seq");function Pm({composeNode:t,composeEmptyNode:e},n,i,r,o){let s=i.start.source==="{",a=s?"flow map":"flow sequence",c=o?.nodeClass??(s?Lc.YAMLMap:Cm.YAMLSeq),l=new c(n.schema);l.flow=!0;let f=n.atRoot;f&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let u=i.offset+i.start.source.length;for(let m=0;m<i.items.length;++m){let g=i.items[m],{start:y,key:k,sep:C,value:x}=g,P=Dc.resolveProps(y,{flow:a,indicator:"explicit-key-ind",next:k??C?.[0],offset:u,onError:r,parentIndent:i.indent,startOnNewline:!1});if(!P.found){if(!P.anchor&&!P.tag&&!C&&!x){m===0&&P.comma?r(P.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`):m<i.items.length-1&&r(P.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${a}`),P.comment&&(l.comment?l.comment+=`
69
+ `+P.comment:l.comment=P.comment),u=P.end;continue}!s&&n.options.strict&&xm.containsNewline(k)&&r(k,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(m===0)P.comma&&r(P.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`);else if(P.comma||r(P.start,"MISSING_CHAR",`Missing , between ${a} items`),P.comment){let j="";e:for(let b of y)switch(b.type){case"comma":case"space":break;case"comment":j=b.source.substring(1);break e;default:break e}if(j){let b=l.items[l.items.length-1];km.isPair(b)&&(b=b.value??b.key),b.comment?b.comment+=`
70
+ `+j:b.comment=j,P.comment=P.comment.substring(j.length+1)}}if(!s&&!C&&!P.found){let j=x?t(n,x,P,r):e(n,P.end,C,null,P,r);l.items.push(j),u=j.range[2],Po(x)&&r(j.range,"BLOCK_IN_FLOW",_o)}else{n.atKey=!0;let j=P.end,b=k?t(n,k,P,r):e(n,j,y,null,P,r);Po(k)&&r(b.range,"BLOCK_IN_FLOW",_o),n.atKey=!1;let W=Dc.resolveProps(C??[],{flow:a,indicator:"map-value-ind",next:x,offset:b.range[2],onError:r,parentIndent:i.indent,startOnNewline:!1});if(W.found){if(!s&&!P.found&&n.options.strict){if(C)for(let M of C){if(M===W.found)break;if(M.type==="newline"){r(M,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}P.start<W.found.offset-1024&&r(W.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else x&&("source"in x&&x.source?.[0]===":"?r(x,"MISSING_CHAR",`Missing space after : in ${a}`):r(W.start,"MISSING_CHAR",`Missing , or : between ${a} items`));let Ee=x?t(n,x,W,r):W.found?e(n,W.end,C,null,W,r):null;Ee?Po(x)&&r(Ee.range,"BLOCK_IN_FLOW",_o):W.comment&&(b.comment?b.comment+=`
71
+ `+W.comment:b.comment=W.comment);let ut=new Sm.Pair(b,Ee);if(n.options.keepSourceTokens&&(ut.srcToken=g),s){let M=l;_m.mapIncludes(n,M.items,b)&&r(j,"DUPLICATE_KEY","Map keys must be unique"),M.items.push(ut)}else{let M=new Lc.YAMLMap(n.schema);M.flow=!0,M.items.push(ut);let Ws=(Ee??b).range;M.range=[b.range[0],Ws[1],Ws[2]],l.items.push(M)}u=Ee?Ee.range[2]:W.end}}let d=s?"}":"]",[h,...w]=i.end,p=u;if(h?.source===d)p=h.offset+h.source.length;else{let m=a[0].toUpperCase()+a.substring(1),g=f?`${m} must end with a ${d}`:`${m} in block collection must be sufficiently indented and end with a ${d}`;r(u,f?"MISSING_CHAR":"BAD_INDENT",g),h&&h.source.length!==1&&w.unshift(h)}if(w.length>0){let m=Em.resolveEnd(w,p,n.options.strict,r);m.comment&&(l.comment?l.comment+=`
72
+ `+m.comment:l.comment=m.comment),l.range=[i.offset,p,m.offset]}else l.range=[i.offset,p,p];return l}Fc.resolveFlowCollection=Pm});var Bc=v(Mc=>{"use strict";var Rm=N(),Nm=L(),Am=Oe(),Om=je(),jm=Tc(),Tm=$c(),Im=Wc();function Ro(t,e,n,i,r,o){let s=n.type==="block-map"?jm.resolveBlockMap(t,e,n,i,o):n.type==="block-seq"?Tm.resolveBlockSeq(t,e,n,i,o):Im.resolveFlowCollection(t,e,n,i,o),a=s.constructor;return r==="!"||r===a.tagName?(s.tag=a.tagName,s):(r&&(s.tag=r),s)}function $m(t,e,n,i,r){let o=i.tag,s=o?e.directives.tagName(o.source,d=>r(o,"TAG_RESOLVE_FAILED",d)):null;if(n.type==="block-seq"){let{anchor:d,newlineAfterProp:h}=i,w=d&&o?d.offset>o.offset?d:o:d??o;w&&(!h||h.offset<w.offset)&&r(w,"MISSING_CHAR","Missing newline after block sequence props")}let a=n.type==="block-map"?"map":n.type==="block-seq"?"seq":n.start.source==="{"?"map":"seq";if(!o||!s||s==="!"||s===Am.YAMLMap.tagName&&a==="map"||s===Om.YAMLSeq.tagName&&a==="seq")return Ro(t,e,n,r,s);let c=e.schema.tags.find(d=>d.tag===s&&d.collection===a);if(!c){let d=e.schema.knownTags[s];if(d?.collection===a)e.schema.tags.push(Object.assign({},d,{default:!1})),c=d;else return d?r(o,"BAD_COLLECTION_TYPE",`${d.tag} used for ${a} collection, but expects ${d.collection??"scalar"}`,!0):r(o,"TAG_RESOLVE_FAILED",`Unresolved tag: ${s}`,!0),Ro(t,e,n,r,s)}let l=Ro(t,e,n,r,s,c),f=c.resolve?.(l,d=>r(o,"TAG_RESOLVE_FAILED",d),e.options)??l,u=Rm.isNode(f)?f:new Nm.Scalar(f);return u.range=l.range,u.tag=s,c?.format&&(u.format=c.format),u}Mc.composeCollection=$m});var Ao=v(Kc=>{"use strict";var No=L();function qm(t,e,n){let i=e.offset,r=Lm(e,t.options.strict,n);if(!r)return{value:"",type:null,comment:"",range:[i,i,i]};let o=r.mode===">"?No.Scalar.BLOCK_FOLDED:No.Scalar.BLOCK_LITERAL,s=e.source?Dm(e.source):[],a=s.length;for(let p=s.length-1;p>=0;--p){let m=s[p][1];if(m===""||m==="\r")a=p;else break}if(a===0){let p=r.chomp==="+"&&s.length>0?`
73
+ `.repeat(Math.max(1,s.length-1)):"",m=i+r.length;return e.source&&(m+=e.source.length),{value:p,type:o,comment:r.comment,range:[i,m,m]}}let c=e.indent+r.indent,l=e.offset+r.length,f=0;for(let p=0;p<a;++p){let[m,g]=s[p];if(g===""||g==="\r")r.indent===0&&m.length>c&&(c=m.length);else{m.length<c&&n(l+m.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator"),r.indent===0&&(c=m.length),f=p,c===0&&!t.atRoot&&n(l,"BAD_INDENT","Block scalar values in collections must be indented");break}l+=m.length+g.length+1}for(let p=s.length-1;p>=a;--p)s[p][0].length>c&&(a=p+1);let u="",d="",h=!1;for(let p=0;p<f;++p)u+=s[p][0].slice(c)+`
74
+ `;for(let p=f;p<a;++p){let[m,g]=s[p];l+=m.length+g.length+1;let y=g[g.length-1]==="\r";if(y&&(g=g.slice(0,-1)),g&&m.length<c){let C=`Block scalar lines must not be less indented than their ${r.indent?"explicit indentation indicator":"first line"}`;n(l-g.length-(y?2:1),"BAD_INDENT",C),m=""}o===No.Scalar.BLOCK_LITERAL?(u+=d+m.slice(c)+g,d=`
75
+ `):m.length>c||g[0]===" "?(d===" "?d=`
76
+ `:!h&&d===`
77
+ `&&(d=`
78
78
 
79
- `),u+=f+m.slice(c)+g,f=`
80
- `,h=!0):g===""?f===`
79
+ `),u+=d+m.slice(c)+g,d=`
80
+ `,h=!0):g===""?d===`
81
81
  `?u+=`
82
- `:f=`
83
- `:(u+=f+g,f=" ",h=!1)}switch(r.chomp){case"-":break;case"+":for(let p=a;p<o.length;++p)u+=`
84
- `+o[p][0].slice(c);u[u.length-1]!==`
82
+ `:d=`
83
+ `:(u+=d+g,d=" ",h=!1)}switch(r.chomp){case"-":break;case"+":for(let p=a;p<s.length;++p)u+=`
84
+ `+s[p][0].slice(c);u[u.length-1]!==`
85
85
  `&&(u+=`
86
86
  `);break;default:u+=`
87
- `}let w=i+r.length+e.source.length;return{value:u,type:s,comment:r.comment,range:[i,w,w]}}function Om({offset:t,props:e},n,i){if(e[0].type!=="block-scalar-header")return i(e[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:r}=e[0],s=r[0],o=0,a="",c=-1;for(let f=1;f<r.length;++f){let h=r[f];if(!a&&(h==="-"||h==="+"))a=h;else{let w=Number(h);!o&&w?o=w:c===-1&&(c=t+f)}}c!==-1&&i(c,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${r}`);let l=!1,d="",u=r.length;for(let f=1;f<e.length;++f){let h=e[f];switch(h.type){case"space":l=!0;case"newline":u+=h.source.length;break;case"comment":n&&!l&&i(h,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),u+=h.source.length,d=h.source.substring(1);break;case"error":i(h,"UNEXPECTED_TOKEN",h.message),u+=h.source.length;break;default:{let w=`Unexpected token in block scalar header: ${h.type}`;i(h,"UNEXPECTED_TOKEN",w);let p=h.source;p&&typeof p=="string"&&(u+=p.length)}}}return{mode:s,indent:o,chomp:a,comment:d,length:u}}function Am(t){let e=t.split(/\n( *)/),n=e[0],i=n.match(/^( *)/),s=[i?.[1]?[i[1],n.slice(i[1].length)]:["",n]];for(let o=1;o<e.length;o+=2)s.push([e[o],e[o+1]]);return s}Wc.resolveBlockScalar=Nm});var As=v(Kc=>{"use strict";var Os=q(),jm=bt();function Tm(t,e,n){let{offset:i,type:r,source:s,end:o}=t,a,c,l=(f,h,w)=>n(i+f,h,w);switch(r){case"scalar":a=Os.Scalar.PLAIN,c=Im(s,l);break;case"single-quoted-scalar":a=Os.Scalar.QUOTE_SINGLE,c=$m(s,l);break;case"double-quoted-scalar":a=Os.Scalar.QUOTE_DOUBLE,c=qm(s,l);break;default:return n(t,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${r}`),{value:"",type:null,comment:"",range:[i,i+s.length,i+s.length]}}let d=i+s.length,u=jm.resolveEnd(o,d,e,n);return{value:c,type:a,comment:u.comment,range:[i,d,u.offset]}}function Im(t,e){let n="";switch(t[0]){case" ":n="a tab character";break;case",":n="flow indicator character ,";break;case"%":n="directive indicator character %";break;case"|":case">":{n=`block scalar indicator ${t[0]}`;break}case"@":case"`":{n=`reserved character ${t[0]}`;break}}return n&&e(0,"BAD_SCALAR_START",`Plain value cannot start with ${n}`),Bc(t)}function $m(t,e){return(t[t.length-1]!=="'"||t.length===1)&&e(t.length,"MISSING_CHAR","Missing closing 'quote"),Bc(t.slice(1,-1)).replace(/''/g,"'")}function Bc(t){let e,n;try{e=new RegExp(`(.*?)(?<![ ])[ ]*\r?
87
+ `}let w=i+r.length+e.source.length;return{value:u,type:o,comment:r.comment,range:[i,w,w]}}function Lm({offset:t,props:e},n,i){if(e[0].type!=="block-scalar-header")return i(e[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:r}=e[0],o=r[0],s=0,a="",c=-1;for(let d=1;d<r.length;++d){let h=r[d];if(!a&&(h==="-"||h==="+"))a=h;else{let w=Number(h);!s&&w?s=w:c===-1&&(c=t+d)}}c!==-1&&i(c,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${r}`);let l=!1,f="",u=r.length;for(let d=1;d<e.length;++d){let h=e[d];switch(h.type){case"space":l=!0;case"newline":u+=h.source.length;break;case"comment":n&&!l&&i(h,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),u+=h.source.length,f=h.source.substring(1);break;case"error":i(h,"UNEXPECTED_TOKEN",h.message),u+=h.source.length;break;default:{let w=`Unexpected token in block scalar header: ${h.type}`;i(h,"UNEXPECTED_TOKEN",w);let p=h.source;p&&typeof p=="string"&&(u+=p.length)}}}return{mode:o,indent:s,chomp:a,comment:f,length:u}}function Dm(t){let e=t.split(/\n( *)/),n=e[0],i=n.match(/^( *)/),o=[i?.[1]?[i[1],n.slice(i[1].length)]:["",n]];for(let s=1;s<e.length;s+=2)o.push([e[s],e[s+1]]);return o}Kc.resolveBlockScalar=qm});var jo=v(Uc=>{"use strict";var Oo=L(),Fm=bt();function Wm(t,e,n){let{offset:i,type:r,source:o,end:s}=t,a,c,l=(d,h,w)=>n(i+d,h,w);switch(r){case"scalar":a=Oo.Scalar.PLAIN,c=Mm(o,l);break;case"single-quoted-scalar":a=Oo.Scalar.QUOTE_SINGLE,c=Bm(o,l);break;case"double-quoted-scalar":a=Oo.Scalar.QUOTE_DOUBLE,c=Km(o,l);break;default:return n(t,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${r}`),{value:"",type:null,comment:"",range:[i,i+o.length,i+o.length]}}let f=i+o.length,u=Fm.resolveEnd(s,f,e,n);return{value:c,type:a,comment:u.comment,range:[i,f,u.offset]}}function Mm(t,e){let n="";switch(t[0]){case" ":n="a tab character";break;case",":n="flow indicator character ,";break;case"%":n="directive indicator character %";break;case"|":case">":{n=`block scalar indicator ${t[0]}`;break}case"@":case"`":{n=`reserved character ${t[0]}`;break}}return n&&e(0,"BAD_SCALAR_START",`Plain value cannot start with ${n}`),Yc(t)}function Bm(t,e){return(t[t.length-1]!=="'"||t.length===1)&&e(t.length,"MISSING_CHAR","Missing closing 'quote"),Yc(t.slice(1,-1)).replace(/''/g,"'")}function Yc(t){let e,n;try{e=new RegExp(`(.*?)(?<![ ])[ ]*\r?
88
88
  `,"sy"),n=new RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
89
- `,"sy")}catch{e=/(.*?)[ \t]*\r?\n/sy,n=/[ \t]*(.*?)[ \t]*\r?\n/sy}let i=e.exec(t);if(!i)return t;let r=i[1],s=" ",o=e.lastIndex;for(n.lastIndex=o;i=n.exec(t);)i[1]===""?s===`
90
- `?r+=s:s=`
91
- `:(r+=s+i[1],s=" "),o=n.lastIndex;let a=/[ \t]*(.*)/sy;return a.lastIndex=o,i=a.exec(t),r+s+(i?.[1]??"")}function qm(t,e){let n="";for(let i=1;i<t.length-1;++i){let r=t[i];if(!(r==="\r"&&t[i+1]===`
89
+ `,"sy")}catch{e=/(.*?)[ \t]*\r?\n/sy,n=/[ \t]*(.*?)[ \t]*\r?\n/sy}let i=e.exec(t);if(!i)return t;let r=i[1],o=" ",s=e.lastIndex;for(n.lastIndex=s;i=n.exec(t);)i[1]===""?o===`
90
+ `?r+=o:o=`
91
+ `:(r+=o+i[1],o=" "),s=n.lastIndex;let a=/[ \t]*(.*)/sy;return a.lastIndex=s,i=a.exec(t),r+o+(i?.[1]??"")}function Km(t,e){let n="";for(let i=1;i<t.length-1;++i){let r=t[i];if(!(r==="\r"&&t[i+1]===`
92
92
  `))if(r===`
93
- `){let{fold:s,offset:o}=Lm(t,i);n+=s,i=o}else if(r==="\\"){let s=t[++i],o=Dm[s];if(o)n+=o;else if(s===`
94
- `)for(s=t[i+1];s===" "||s===" ";)s=t[++i+1];else if(s==="\r"&&t[i+1]===`
95
- `)for(s=t[++i+1];s===" "||s===" ";)s=t[++i+1];else if(s==="x"||s==="u"||s==="U"){let a=s==="x"?2:s==="u"?4:8;n+=Fm(t,i+1,a,e),i+=a}else{let a=t.substr(i-1,2);e(i-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),n+=a}}else if(r===" "||r===" "){let s=i,o=t[i+1];for(;o===" "||o===" ";)o=t[++i+1];o!==`
96
- `&&!(o==="\r"&&t[i+2]===`
97
- `)&&(n+=i>s?t.slice(s,i+1):r)}else n+=r}return(t[t.length-1]!=='"'||t.length===1)&&e(t.length,"MISSING_CHAR",'Missing closing "quote'),n}function Lm(t,e){let n="",i=t[e+1];for(;(i===" "||i===" "||i===`
93
+ `){let{fold:o,offset:s}=Ym(t,i);n+=o,i=s}else if(r==="\\"){let o=t[++i],s=Um[o];if(s)n+=s;else if(o===`
94
+ `)for(o=t[i+1];o===" "||o===" ";)o=t[++i+1];else if(o==="\r"&&t[i+1]===`
95
+ `)for(o=t[++i+1];o===" "||o===" ";)o=t[++i+1];else if(o==="x"||o==="u"||o==="U"){let a=o==="x"?2:o==="u"?4:8;n+=Hm(t,i+1,a,e),i+=a}else{let a=t.substr(i-1,2);e(i-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),n+=a}}else if(r===" "||r===" "){let o=i,s=t[i+1];for(;s===" "||s===" ";)s=t[++i+1];s!==`
96
+ `&&!(s==="\r"&&t[i+2]===`
97
+ `)&&(n+=i>o?t.slice(o,i+1):r)}else n+=r}return(t[t.length-1]!=='"'||t.length===1)&&e(t.length,"MISSING_CHAR",'Missing closing "quote'),n}function Ym(t,e){let n="",i=t[e+1];for(;(i===" "||i===" "||i===`
98
98
  `||i==="\r")&&!(i==="\r"&&t[e+2]!==`
99
99
  `);)i===`
100
100
  `&&(n+=`
101
- `),e+=1,i=t[e+1];return n||(n=" "),{fold:n,offset:e}}var Dm={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
102
- `,r:"\r",t:" ",v:"\v",N:"…",_:" ",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function Fm(t,e,n,i){let r=t.substr(e,n),o=r.length===n&&/^[0-9a-fA-F]+$/.test(r)?parseInt(r,16):NaN;try{return String.fromCodePoint(o)}catch{let a=t.substr(e-2,n+2);return i(e-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),a}}Kc.resolveFlowScalar=Tm});var Vc=v(Uc=>{"use strict";var Xe=N(),Yc=q(),Mm=Ns(),Wm=As();function Bm(t,e,n,i){let{value:r,type:s,comment:o,range:a}=e.type==="block-scalar"?Mm.resolveBlockScalar(t,e,i):Wm.resolveFlowScalar(e,t.options.strict,i),c=n?t.directives.tagName(n.source,u=>i(n,"TAG_RESOLVE_FAILED",u)):null,l;t.options.stringKeys&&t.atKey?l=t.schema[Xe.SCALAR]:c?l=Km(t.schema,r,c,n,i):e.type==="scalar"?l=Ym(t,r,e,i):l=t.schema[Xe.SCALAR];let d;try{let u=l.resolve(r,f=>i(n??e,"TAG_RESOLVE_FAILED",f),t.options);d=Xe.isScalar(u)?u:new Yc.Scalar(u)}catch(u){let f=u instanceof Error?u.message:String(u);i(n??e,"TAG_RESOLVE_FAILED",f),d=new Yc.Scalar(r)}return d.range=a,d.source=r,s&&(d.type=s),c&&(d.tag=c),l.format&&(d.format=l.format),o&&(d.comment=o),d}function Km(t,e,n,i,r){if(n==="!")return t[Xe.SCALAR];let s=[];for(let a of t.tags)if(!a.collection&&a.tag===n)if(a.default&&a.test)s.push(a);else return a;for(let a of s)if(a.test?.test(e))return a;let o=t.knownTags[n];return o&&!o.collection?(t.tags.push(Object.assign({},o,{default:!1,test:void 0})),o):(r(i,"TAG_RESOLVE_FAILED",`Unresolved tag: ${n}`,n!=="tag:yaml.org,2002:str"),t[Xe.SCALAR])}function Ym({atKey:t,directives:e,schema:n},i,r,s){let o=n.tags.find(a=>(a.default===!0||t&&a.default==="key")&&a.test?.test(i))||n[Xe.SCALAR];if(n.compat){let a=n.compat.find(c=>c.default&&c.test?.test(i))??n[Xe.SCALAR];if(o.tag!==a.tag){let c=e.tagString(o.tag),l=e.tagString(a.tag),d=`Value may be parsed as either ${c} or ${l}`;s(r,"TAG_RESOLVE_FAILED",d,!0)}}return o}Uc.composeScalar=Bm});var Hc=v(Jc=>{"use strict";function Um(t,e,n){if(e){n??(n=e.length);for(let i=n-1;i>=0;--i){let r=e[i];switch(r.type){case"space":case"comment":case"newline":t-=r.source.length;continue}for(r=e[++i];r?.type==="space";)t+=r.source.length,r=e[++i];break}}return t}Jc.emptyScalarPosition=Um});var Qc=v(Ts=>{"use strict";var Vm=It(),Jm=N(),Hm=Mc(),Gc=Vc(),Gm=bt(),zm=Hc(),Qm={composeNode:zc,composeEmptyNode:js};function zc(t,e,n,i){let r=t.atKey,{spaceBefore:s,comment:o,anchor:a,tag:c}=n,l,d=!0;switch(e.type){case"alias":l=Xm(t,e,i),(a||c)&&i(e,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":l=Gc.composeScalar(t,e,c,i),a&&(l.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{l=Hm.composeCollection(Qm,t,e,n,i),a&&(l.anchor=a.source.substring(1))}catch(u){let f=u instanceof Error?u.message:String(u);i(e,"RESOURCE_EXHAUSTION",f)}break;default:{let u=e.type==="error"?e.message:`Unsupported token (type: ${e.type})`;i(e,"UNEXPECTED_TOKEN",u),d=!1}}return l??(l=js(t,e.offset,void 0,null,n,i)),a&&l.anchor===""&&i(a,"BAD_ALIAS","Anchor cannot be an empty string"),r&&t.options.stringKeys&&(!Jm.isScalar(l)||typeof l.value!="string"||l.tag&&l.tag!=="tag:yaml.org,2002:str")&&i(c??e,"NON_STRING_KEY","With stringKeys, all keys must be strings"),s&&(l.spaceBefore=!0),o&&(e.type==="scalar"&&e.source===""?l.comment=o:l.commentBefore=o),t.options.keepSourceTokens&&d&&(l.srcToken=e),l}function js(t,e,n,i,{spaceBefore:r,comment:s,anchor:o,tag:a,end:c},l){let d={type:"scalar",offset:zm.emptyScalarPosition(e,n,i),indent:-1,source:""},u=Gc.composeScalar(t,d,a,l);return o&&(u.anchor=o.source.substring(1),u.anchor===""&&l(o,"BAD_ALIAS","Anchor cannot be an empty string")),r&&(u.spaceBefore=!0),s&&(u.comment=s,u.range[2]=c),u}function Xm({options:t},{offset:e,source:n,end:i},r){let s=new Vm.Alias(n.substring(1));s.source===""&&r(e,"BAD_ALIAS","Alias cannot be an empty string"),s.source.endsWith(":")&&r(e+n.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let o=e+n.length,a=Gm.resolveEnd(i,o,t.strict,r);return s.range=[e,o,a.offset],a.comment&&(s.comment=a.comment),s}Ts.composeEmptyNode=js;Ts.composeNode=zc});var el=v(Zc=>{"use strict";var Zm=zt(),Xc=Qc(),eh=bt(),th=en();function nh(t,e,{offset:n,start:i,value:r,end:s},o){let a=Object.assign({_directives:e},t),c=new Zm.Document(void 0,a),l={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},d=th.resolveProps(i,{indicator:"doc-start",next:r??s?.[0],offset:n,onError:o,parentIndent:0,startOnNewline:!0});d.found&&(c.directives.docStart=!0,r&&(r.type==="block-map"||r.type==="block-seq")&&!d.hasNewline&&o(d.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),c.contents=r?Xc.composeNode(l,r,d,o):Xc.composeEmptyNode(l,d.end,i,null,d,o);let u=c.contents.range[2],f=eh.resolveEnd(s,u,!1,o);return f.comment&&(c.comment=f.comment),c.range=[n,u,f.offset],c}Zc.composeDoc=nh});var $s=v(il=>{"use strict";var ih=jn("process"),rh=br(),sh=zt(),tn=Zt(),tl=N(),oh=el(),ah=bt();function nn(t){if(typeof t=="number")return[t,t+1];if(Array.isArray(t))return t.length===2?t:[t[0],t[1]];let{offset:e,source:n}=t;return[e,e+(typeof n=="string"?n.length:1)]}function nl(t){let e="",n=!1,i=!1;for(let r=0;r<t.length;++r){let s=t[r];switch(s[0]){case"#":e+=(e===""?"":i?`
101
+ `),e+=1,i=t[e+1];return n||(n=" "),{fold:n,offset:e}}var Um={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
102
+ `,r:"\r",t:" ",v:"\v",N:"…",_:" ",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function Hm(t,e,n,i){let r=t.substr(e,n),s=r.length===n&&/^[0-9a-fA-F]+$/.test(r)?parseInt(r,16):NaN;try{return String.fromCodePoint(s)}catch{let a=t.substr(e-2,n+2);return i(e-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),a}}Uc.resolveFlowScalar=Wm});var Jc=v(Vc=>{"use strict";var tt=N(),Hc=L(),Vm=Ao(),Jm=jo();function Gm(t,e,n,i){let{value:r,type:o,comment:s,range:a}=e.type==="block-scalar"?Vm.resolveBlockScalar(t,e,i):Jm.resolveFlowScalar(e,t.options.strict,i),c=n?t.directives.tagName(n.source,u=>i(n,"TAG_RESOLVE_FAILED",u)):null,l;t.options.stringKeys&&t.atKey?l=t.schema[tt.SCALAR]:c?l=zm(t.schema,r,c,n,i):e.type==="scalar"?l=Qm(t,r,e,i):l=t.schema[tt.SCALAR];let f;try{let u=l.resolve(r,d=>i(n??e,"TAG_RESOLVE_FAILED",d),t.options);f=tt.isScalar(u)?u:new Hc.Scalar(u)}catch(u){let d=u instanceof Error?u.message:String(u);i(n??e,"TAG_RESOLVE_FAILED",d),f=new Hc.Scalar(r)}return f.range=a,f.source=r,o&&(f.type=o),c&&(f.tag=c),l.format&&(f.format=l.format),s&&(f.comment=s),f}function zm(t,e,n,i,r){if(n==="!")return t[tt.SCALAR];let o=[];for(let a of t.tags)if(!a.collection&&a.tag===n)if(a.default&&a.test)o.push(a);else return a;for(let a of o)if(a.test?.test(e))return a;let s=t.knownTags[n];return s&&!s.collection?(t.tags.push(Object.assign({},s,{default:!1,test:void 0})),s):(r(i,"TAG_RESOLVE_FAILED",`Unresolved tag: ${n}`,n!=="tag:yaml.org,2002:str"),t[tt.SCALAR])}function Qm({atKey:t,directives:e,schema:n},i,r,o){let s=n.tags.find(a=>(a.default===!0||t&&a.default==="key")&&a.test?.test(i))||n[tt.SCALAR];if(n.compat){let a=n.compat.find(c=>c.default&&c.test?.test(i))??n[tt.SCALAR];if(s.tag!==a.tag){let c=e.tagString(s.tag),l=e.tagString(a.tag),f=`Value may be parsed as either ${c} or ${l}`;o(r,"TAG_RESOLVE_FAILED",f,!0)}}return s}Vc.composeScalar=Gm});var zc=v(Gc=>{"use strict";function Xm(t,e,n){if(e){n??(n=e.length);for(let i=n-1;i>=0;--i){let r=e[i];switch(r.type){case"space":case"comment":case"newline":t-=r.source.length;continue}for(r=e[++i];r?.type==="space";)t+=r.source.length,r=e[++i];break}}return t}Gc.emptyScalarPosition=Xm});var Zc=v(Io=>{"use strict";var Zm=$t(),eh=N(),th=Bc(),Qc=Jc(),nh=bt(),ih=zc(),rh={composeNode:Xc,composeEmptyNode:To};function Xc(t,e,n,i){let r=t.atKey,{spaceBefore:o,comment:s,anchor:a,tag:c}=n,l,f=!0;switch(e.type){case"alias":l=oh(t,e,i),(a||c)&&i(e,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":l=Qc.composeScalar(t,e,c,i),a&&(l.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{l=th.composeCollection(rh,t,e,n,i),a&&(l.anchor=a.source.substring(1))}catch(u){let d=u instanceof Error?u.message:String(u);i(e,"RESOURCE_EXHAUSTION",d)}break;default:{let u=e.type==="error"?e.message:`Unsupported token (type: ${e.type})`;i(e,"UNEXPECTED_TOKEN",u),f=!1}}return l??(l=To(t,e.offset,void 0,null,n,i)),a&&l.anchor===""&&i(a,"BAD_ALIAS","Anchor cannot be an empty string"),r&&t.options.stringKeys&&(!eh.isScalar(l)||typeof l.value!="string"||l.tag&&l.tag!=="tag:yaml.org,2002:str")&&i(c??e,"NON_STRING_KEY","With stringKeys, all keys must be strings"),o&&(l.spaceBefore=!0),s&&(e.type==="scalar"&&e.source===""?l.comment=s:l.commentBefore=s),t.options.keepSourceTokens&&f&&(l.srcToken=e),l}function To(t,e,n,i,{spaceBefore:r,comment:o,anchor:s,tag:a,end:c},l){let f={type:"scalar",offset:ih.emptyScalarPosition(e,n,i),indent:-1,source:""},u=Qc.composeScalar(t,f,a,l);return s&&(u.anchor=s.source.substring(1),u.anchor===""&&l(s,"BAD_ALIAS","Anchor cannot be an empty string")),r&&(u.spaceBefore=!0),o&&(u.comment=o,u.range[2]=c),u}function oh({options:t},{offset:e,source:n,end:i},r){let o=new Zm.Alias(n.substring(1));o.source===""&&r(e,"BAD_ALIAS","Alias cannot be an empty string"),o.source.endsWith(":")&&r(e+n.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let s=e+n.length,a=nh.resolveEnd(i,s,t.strict,r);return o.range=[e,s,a.offset],a.comment&&(o.comment=a.comment),o}Io.composeEmptyNode=To;Io.composeNode=Xc});var nl=v(tl=>{"use strict";var sh=Qt(),el=Zc(),ah=bt(),ch=tn();function lh(t,e,{offset:n,start:i,value:r,end:o},s){let a=Object.assign({_directives:e},t),c=new sh.Document(void 0,a),l={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},f=ch.resolveProps(i,{indicator:"doc-start",next:r??o?.[0],offset:n,onError:s,parentIndent:0,startOnNewline:!0});f.found&&(c.directives.docStart=!0,r&&(r.type==="block-map"||r.type==="block-seq")&&!f.hasNewline&&s(f.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),c.contents=r?el.composeNode(l,r,f,s):el.composeEmptyNode(l,f.end,i,null,f,s);let u=c.contents.range[2],d=ah.resolveEnd(o,u,!1,s);return d.comment&&(c.comment=d.comment),c.range=[n,u,d.offset],c}tl.composeDoc=lh});var qo=v(ol=>{"use strict";var uh=jn("process"),fh=br(),dh=Qt(),nn=en(),il=N(),ph=nl(),mh=bt();function rn(t){if(typeof t=="number")return[t,t+1];if(Array.isArray(t))return t.length===2?t:[t[0],t[1]];let{offset:e,source:n}=t;return[e,e+(typeof n=="string"?n.length:1)]}function rl(t){let e="",n=!1,i=!1;for(let r=0;r<t.length;++r){let o=t[r];switch(o[0]){case"#":e+=(e===""?"":i?`
103
103
 
104
104
  `:`
105
- `)+(s.substring(1)||" "),n=!0,i=!1;break;case"%":t[r+1]?.[0]!=="#"&&(r+=1),n=!1;break;default:n||(i=!0),n=!1}}return{comment:e,afterEmptyLine:i}}var Is=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(n,i,r,s)=>{let o=nn(n);s?this.warnings.push(new tn.YAMLWarning(o,i,r)):this.errors.push(new tn.YAMLParseError(o,i,r))},this.directives=new rh.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,n){let{comment:i,afterEmptyLine:r}=nl(this.prelude);if(i){let s=e.contents;if(n)e.comment=e.comment?`${e.comment}
106
- ${i}`:i;else if(r||e.directives.docStart||!s)e.commentBefore=i;else if(tl.isCollection(s)&&!s.flow&&s.items.length>0){let o=s.items[0];tl.isPair(o)&&(o=o.key);let a=o.commentBefore;o.commentBefore=a?`${i}
107
- ${a}`:i}else{let o=s.commentBefore;s.commentBefore=o?`${i}
108
- ${o}`:i}}if(n){for(let s=0;s<this.errors.length;++s)e.errors.push(this.errors[s]);for(let s=0;s<this.warnings.length;++s)e.warnings.push(this.warnings[s])}else e.errors=this.errors,e.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:nl(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,n=!1,i=-1){for(let r of e)yield*this.next(r);yield*this.end(n,i)}*next(e){switch(ih.env.LOG_STREAM&&console.dir(e,{depth:null}),e.type){case"directive":this.directives.add(e.source,(n,i,r)=>{let s=nn(e);s[0]+=n,this.onError(s,"BAD_DIRECTIVE",i,r)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let n=oh.composeDoc(this.options,this.directives,e,this.onError);this.atDirectives&&!n.directives.docStart&&this.onError(e,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(n,!1),this.doc&&(yield this.doc),this.doc=n,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(e.source);break;case"error":{let n=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,i=new tn.YAMLParseError(nn(e),"UNEXPECTED_TOKEN",n);this.atDirectives||!this.doc?this.errors.push(i):this.doc.errors.push(i);break}case"doc-end":{if(!this.doc){let i="Unexpected doc-end without preceding document";this.errors.push(new tn.YAMLParseError(nn(e),"UNEXPECTED_TOKEN",i));break}this.doc.directives.docEnd=!0;let n=ah.resolveEnd(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),n.comment){let i=this.doc.comment;this.doc.comment=i?`${i}
109
- ${n.comment}`:n.comment}this.doc.range[2]=n.offset;break}default:this.errors.push(new tn.YAMLParseError(nn(e),"UNEXPECTED_TOKEN",`Unsupported token ${e.type}`))}}*end(e=!1,n=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let i=Object.assign({_directives:this.directives},this.options),r=new sh.Document(void 0,i);this.atDirectives&&this.onError(n,"MISSING_CHAR","Missing directives-end indicator line"),r.range=[0,n,n],this.decorate(r,!1),yield r}}};il.Composer=Is});var ol=v(Ci=>{"use strict";var ch=Ns(),lh=As(),uh=Zt(),rl=Ft();function fh(t,e=!0,n){if(t){let i=(r,s,o)=>{let a=typeof r=="number"?r:Array.isArray(r)?r[0]:r.offset;if(n)n(a,s,o);else throw new uh.YAMLParseError([a,a+1],s,o)};switch(t.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return lh.resolveFlowScalar(t,e,i);case"block-scalar":return ch.resolveBlockScalar({options:{strict:e}},t,i)}}return null}function dh(t,e){let{implicitKey:n=!1,indent:i,inFlow:r=!1,offset:s=-1,type:o="PLAIN"}=e,a=rl.stringifyString({type:o,value:t},{implicitKey:n,indent:i>0?" ".repeat(i):"",inFlow:r,options:{blockQuote:!0,lineWidth:-1}}),c=e.end??[{type:"newline",offset:-1,indent:i,source:`
105
+ `)+(o.substring(1)||" "),n=!0,i=!1;break;case"%":t[r+1]?.[0]!=="#"&&(r+=1),n=!1;break;default:n||(i=!0),n=!1}}return{comment:e,afterEmptyLine:i}}var $o=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(n,i,r,o)=>{let s=rn(n);o?this.warnings.push(new nn.YAMLWarning(s,i,r)):this.errors.push(new nn.YAMLParseError(s,i,r))},this.directives=new fh.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,n){let{comment:i,afterEmptyLine:r}=rl(this.prelude);if(i){let o=e.contents;if(n)e.comment=e.comment?`${e.comment}
106
+ ${i}`:i;else if(r||e.directives.docStart||!o)e.commentBefore=i;else if(il.isCollection(o)&&!o.flow&&o.items.length>0){let s=o.items[0];il.isPair(s)&&(s=s.key);let a=s.commentBefore;s.commentBefore=a?`${i}
107
+ ${a}`:i}else{let s=o.commentBefore;o.commentBefore=s?`${i}
108
+ ${s}`:i}}if(n){for(let o=0;o<this.errors.length;++o)e.errors.push(this.errors[o]);for(let o=0;o<this.warnings.length;++o)e.warnings.push(this.warnings[o])}else e.errors=this.errors,e.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:rl(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,n=!1,i=-1){for(let r of e)yield*this.next(r);yield*this.end(n,i)}*next(e){switch(uh.env.LOG_STREAM&&console.dir(e,{depth:null}),e.type){case"directive":this.directives.add(e.source,(n,i,r)=>{let o=rn(e);o[0]+=n,this.onError(o,"BAD_DIRECTIVE",i,r)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let n=ph.composeDoc(this.options,this.directives,e,this.onError);this.atDirectives&&!n.directives.docStart&&this.onError(e,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(n,!1),this.doc&&(yield this.doc),this.doc=n,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(e.source);break;case"error":{let n=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,i=new nn.YAMLParseError(rn(e),"UNEXPECTED_TOKEN",n);this.atDirectives||!this.doc?this.errors.push(i):this.doc.errors.push(i);break}case"doc-end":{if(!this.doc){let i="Unexpected doc-end without preceding document";this.errors.push(new nn.YAMLParseError(rn(e),"UNEXPECTED_TOKEN",i));break}this.doc.directives.docEnd=!0;let n=mh.resolveEnd(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),n.comment){let i=this.doc.comment;this.doc.comment=i?`${i}
109
+ ${n.comment}`:n.comment}this.doc.range[2]=n.offset;break}default:this.errors.push(new nn.YAMLParseError(rn(e),"UNEXPECTED_TOKEN",`Unsupported token ${e.type}`))}}*end(e=!1,n=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let i=Object.assign({_directives:this.directives},this.options),r=new dh.Document(void 0,i);this.atDirectives&&this.onError(n,"MISSING_CHAR","Missing directives-end indicator line"),r.range=[0,n,n],this.decorate(r,!1),yield r}}};ol.Composer=$o});var cl=v(Ci=>{"use strict";var hh=Ao(),gh=jo(),wh=en(),sl=Wt();function yh(t,e=!0,n){if(t){let i=(r,o,s)=>{let a=typeof r=="number"?r:Array.isArray(r)?r[0]:r.offset;if(n)n(a,o,s);else throw new wh.YAMLParseError([a,a+1],o,s)};switch(t.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return gh.resolveFlowScalar(t,e,i);case"block-scalar":return hh.resolveBlockScalar({options:{strict:e}},t,i)}}return null}function vh(t,e){let{implicitKey:n=!1,indent:i,inFlow:r=!1,offset:o=-1,type:s="PLAIN"}=e,a=sl.stringifyString({type:s,value:t},{implicitKey:n,indent:i>0?" ".repeat(i):"",inFlow:r,options:{blockQuote:!0,lineWidth:-1}}),c=e.end??[{type:"newline",offset:-1,indent:i,source:`
110
110
  `}];switch(a[0]){case"|":case">":{let l=a.indexOf(`
111
- `),d=a.substring(0,l),u=a.substring(l+1)+`
112
- `,f=[{type:"block-scalar-header",offset:s,indent:i,source:d}];return sl(f,c)||f.push({type:"newline",offset:-1,indent:i,source:`
113
- `}),{type:"block-scalar",offset:s,indent:i,props:f,source:u}}case'"':return{type:"double-quoted-scalar",offset:s,indent:i,source:a,end:c};case"'":return{type:"single-quoted-scalar",offset:s,indent:i,source:a,end:c};default:return{type:"scalar",offset:s,indent:i,source:a,end:c}}}function ph(t,e,n={}){let{afterKey:i=!1,implicitKey:r=!1,inFlow:s=!1,type:o}=n,a="indent"in t?t.indent:null;if(i&&typeof a=="number"&&(a+=2),!o)switch(t.type){case"single-quoted-scalar":o="QUOTE_SINGLE";break;case"double-quoted-scalar":o="QUOTE_DOUBLE";break;case"block-scalar":{let l=t.props[0];if(l.type!=="block-scalar-header")throw new Error("Invalid block scalar header");o=l.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:o="PLAIN"}let c=rl.stringifyString({type:o,value:e},{implicitKey:r||a===null,indent:a!==null&&a>0?" ".repeat(a):"",inFlow:s,options:{blockQuote:!0,lineWidth:-1}});switch(c[0]){case"|":case">":mh(t,c);break;case'"':qs(t,c,"double-quoted-scalar");break;case"'":qs(t,c,"single-quoted-scalar");break;default:qs(t,c,"scalar")}}function mh(t,e){let n=e.indexOf(`
111
+ `),f=a.substring(0,l),u=a.substring(l+1)+`
112
+ `,d=[{type:"block-scalar-header",offset:o,indent:i,source:f}];return al(d,c)||d.push({type:"newline",offset:-1,indent:i,source:`
113
+ `}),{type:"block-scalar",offset:o,indent:i,props:d,source:u}}case'"':return{type:"double-quoted-scalar",offset:o,indent:i,source:a,end:c};case"'":return{type:"single-quoted-scalar",offset:o,indent:i,source:a,end:c};default:return{type:"scalar",offset:o,indent:i,source:a,end:c}}}function bh(t,e,n={}){let{afterKey:i=!1,implicitKey:r=!1,inFlow:o=!1,type:s}=n,a="indent"in t?t.indent:null;if(i&&typeof a=="number"&&(a+=2),!s)switch(t.type){case"single-quoted-scalar":s="QUOTE_SINGLE";break;case"double-quoted-scalar":s="QUOTE_DOUBLE";break;case"block-scalar":{let l=t.props[0];if(l.type!=="block-scalar-header")throw new Error("Invalid block scalar header");s=l.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:s="PLAIN"}let c=sl.stringifyString({type:s,value:e},{implicitKey:r||a===null,indent:a!==null&&a>0?" ".repeat(a):"",inFlow:o,options:{blockQuote:!0,lineWidth:-1}});switch(c[0]){case"|":case">":kh(t,c);break;case'"':Lo(t,c,"double-quoted-scalar");break;case"'":Lo(t,c,"single-quoted-scalar");break;default:Lo(t,c,"scalar")}}function kh(t,e){let n=e.indexOf(`
114
114
  `),i=e.substring(0,n),r=e.substring(n+1)+`
115
- `;if(t.type==="block-scalar"){let s=t.props[0];if(s.type!=="block-scalar-header")throw new Error("Invalid block scalar header");s.source=i,t.source=r}else{let{offset:s}=t,o="indent"in t?t.indent:-1,a=[{type:"block-scalar-header",offset:s,indent:o,source:i}];sl(a,"end"in t?t.end:void 0)||a.push({type:"newline",offset:-1,indent:o,source:`
116
- `});for(let c of Object.keys(t))c!=="type"&&c!=="offset"&&delete t[c];Object.assign(t,{type:"block-scalar",indent:o,props:a,source:r})}}function sl(t,e){if(e)for(let n of e)switch(n.type){case"space":case"comment":t.push(n);break;case"newline":return t.push(n),!0}return!1}function qs(t,e,n){switch(t.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":t.type=n,t.source=e;break;case"block-scalar":{let i=t.props.slice(1),r=e.length;t.props[0].type==="block-scalar-header"&&(r-=t.props[0].source.length);for(let s of i)s.offset+=r;delete t.props,Object.assign(t,{type:n,source:e,end:i});break}case"block-map":case"block-seq":{let r={type:"newline",offset:t.offset+e.length,indent:t.indent,source:`
117
- `};delete t.items,Object.assign(t,{type:n,source:e,end:[r]});break}default:{let i="indent"in t?t.indent:-1,r="end"in t&&Array.isArray(t.end)?t.end.filter(s=>s.type==="space"||s.type==="comment"||s.type==="newline"):[];for(let s of Object.keys(t))s!=="type"&&s!=="offset"&&delete t[s];Object.assign(t,{type:n,indent:i,source:e,end:r})}}}Ci.createScalarToken=dh;Ci.resolveAsScalar=fh;Ci.setScalarValue=ph});var cl=v(al=>{"use strict";var hh=t=>"type"in t?xi(t):Ei(t);function xi(t){switch(t.type){case"block-scalar":{let e="";for(let n of t.props)e+=xi(n);return e+t.source}case"block-map":case"block-seq":{let e="";for(let n of t.items)e+=Ei(n);return e}case"flow-collection":{let e=t.start.source;for(let n of t.items)e+=Ei(n);for(let n of t.end)e+=n.source;return e}case"document":{let e=Ei(t);if(t.end)for(let n of t.end)e+=n.source;return e}default:{let e=t.source;if("end"in t&&t.end)for(let n of t.end)e+=n.source;return e}}}function Ei({start:t,key:e,sep:n,value:i}){let r="";for(let s of t)r+=s.source;if(e&&(r+=xi(e)),n)for(let s of n)r+=s.source;return i&&(r+=xi(i)),r}al.stringify=hh});var dl=v(fl=>{"use strict";var Ls=Symbol("break visit"),gh=Symbol("skip children"),ll=Symbol("remove item");function Ze(t,e){"type"in t&&t.type==="document"&&(t={start:t.start,value:t.value}),ul(Object.freeze([]),t,e)}Ze.BREAK=Ls;Ze.SKIP=gh;Ze.REMOVE=ll;Ze.itemAtPath=(t,e)=>{let n=t;for(let[i,r]of e){let s=n?.[i];if(s&&"items"in s)n=s.items[r];else return}return n};Ze.parentCollection=(t,e)=>{let n=Ze.itemAtPath(t,e.slice(0,-1)),i=e[e.length-1][0],r=n?.[i];if(r&&"items"in r)return r;throw new Error("Parent collection not found")};function ul(t,e,n){let i=n(e,t);if(typeof i=="symbol")return i;for(let r of["key","value"]){let s=e[r];if(s&&"items"in s){for(let o=0;o<s.items.length;++o){let a=ul(Object.freeze(t.concat([[r,o]])),s.items[o],n);if(typeof a=="number")o=a-1;else{if(a===Ls)return Ls;a===ll&&(s.items.splice(o,1),o-=1)}}typeof i=="function"&&r==="key"&&(i=i(e,t))}}return typeof i=="function"?i(e,t):i}fl.visit=Ze});var _i=v(ee=>{"use strict";var Ds=ol(),wh=cl(),yh=dl(),Fs="\uFEFF",Ms="",Ws="",Bs="",vh=t=>!!t&&"items"in t,bh=t=>!!t&&(t.type==="scalar"||t.type==="single-quoted-scalar"||t.type==="double-quoted-scalar"||t.type==="block-scalar");function kh(t){switch(t){case Fs:return"<BOM>";case Ms:return"<DOC>";case Ws:return"<FLOW_END>";case Bs:return"<SCALAR>";default:return JSON.stringify(t)}}function Sh(t){switch(t){case Fs:return"byte-order-mark";case Ms:return"doc-mode";case Ws:return"flow-error-end";case Bs:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
115
+ `;if(t.type==="block-scalar"){let o=t.props[0];if(o.type!=="block-scalar-header")throw new Error("Invalid block scalar header");o.source=i,t.source=r}else{let{offset:o}=t,s="indent"in t?t.indent:-1,a=[{type:"block-scalar-header",offset:o,indent:s,source:i}];al(a,"end"in t?t.end:void 0)||a.push({type:"newline",offset:-1,indent:s,source:`
116
+ `});for(let c of Object.keys(t))c!=="type"&&c!=="offset"&&delete t[c];Object.assign(t,{type:"block-scalar",indent:s,props:a,source:r})}}function al(t,e){if(e)for(let n of e)switch(n.type){case"space":case"comment":t.push(n);break;case"newline":return t.push(n),!0}return!1}function Lo(t,e,n){switch(t.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":t.type=n,t.source=e;break;case"block-scalar":{let i=t.props.slice(1),r=e.length;t.props[0].type==="block-scalar-header"&&(r-=t.props[0].source.length);for(let o of i)o.offset+=r;delete t.props,Object.assign(t,{type:n,source:e,end:i});break}case"block-map":case"block-seq":{let r={type:"newline",offset:t.offset+e.length,indent:t.indent,source:`
117
+ `};delete t.items,Object.assign(t,{type:n,source:e,end:[r]});break}default:{let i="indent"in t?t.indent:-1,r="end"in t&&Array.isArray(t.end)?t.end.filter(o=>o.type==="space"||o.type==="comment"||o.type==="newline"):[];for(let o of Object.keys(t))o!=="type"&&o!=="offset"&&delete t[o];Object.assign(t,{type:n,indent:i,source:e,end:r})}}}Ci.createScalarToken=vh;Ci.resolveAsScalar=yh;Ci.setScalarValue=bh});var ul=v(ll=>{"use strict";var Sh=t=>"type"in t?xi(t):Ei(t);function xi(t){switch(t.type){case"block-scalar":{let e="";for(let n of t.props)e+=xi(n);return e+t.source}case"block-map":case"block-seq":{let e="";for(let n of t.items)e+=Ei(n);return e}case"flow-collection":{let e=t.start.source;for(let n of t.items)e+=Ei(n);for(let n of t.end)e+=n.source;return e}case"document":{let e=Ei(t);if(t.end)for(let n of t.end)e+=n.source;return e}default:{let e=t.source;if("end"in t&&t.end)for(let n of t.end)e+=n.source;return e}}}function Ei({start:t,key:e,sep:n,value:i}){let r="";for(let o of t)r+=o.source;if(e&&(r+=xi(e)),n)for(let o of n)r+=o.source;return i&&(r+=xi(i)),r}ll.stringify=Sh});var ml=v(pl=>{"use strict";var Do=Symbol("break visit"),Ch=Symbol("skip children"),fl=Symbol("remove item");function nt(t,e){"type"in t&&t.type==="document"&&(t={start:t.start,value:t.value}),dl(Object.freeze([]),t,e)}nt.BREAK=Do;nt.SKIP=Ch;nt.REMOVE=fl;nt.itemAtPath=(t,e)=>{let n=t;for(let[i,r]of e){let o=n?.[i];if(o&&"items"in o)n=o.items[r];else return}return n};nt.parentCollection=(t,e)=>{let n=nt.itemAtPath(t,e.slice(0,-1)),i=e[e.length-1][0],r=n?.[i];if(r&&"items"in r)return r;throw new Error("Parent collection not found")};function dl(t,e,n){let i=n(e,t);if(typeof i=="symbol")return i;for(let r of["key","value"]){let o=e[r];if(o&&"items"in o){for(let s=0;s<o.items.length;++s){let a=dl(Object.freeze(t.concat([[r,s]])),o.items[s],n);if(typeof a=="number")s=a-1;else{if(a===Do)return Do;a===fl&&(o.items.splice(s,1),s-=1)}}typeof i=="function"&&r==="key"&&(i=i(e,t))}}return typeof i=="function"?i(e,t):i}pl.visit=nt});var _i=v(ee=>{"use strict";var Fo=cl(),Eh=ul(),xh=ml(),Wo="\uFEFF",Mo="",Bo="",Ko="",_h=t=>!!t&&"items"in t,Ph=t=>!!t&&(t.type==="scalar"||t.type==="single-quoted-scalar"||t.type==="double-quoted-scalar"||t.type==="block-scalar");function Rh(t){switch(t){case Wo:return"<BOM>";case Mo:return"<DOC>";case Bo:return"<FLOW_END>";case Ko:return"<SCALAR>";default:return JSON.stringify(t)}}function Nh(t){switch(t){case Wo:return"byte-order-mark";case Mo:return"doc-mode";case Bo:return"flow-error-end";case Ko:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
118
118
  `:case`\r
119
- `:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(t[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}ee.createScalarToken=Ds.createScalarToken;ee.resolveAsScalar=Ds.resolveAsScalar;ee.setScalarValue=Ds.setScalarValue;ee.stringify=wh.stringify;ee.visit=yh.visit;ee.BOM=Fs;ee.DOCUMENT=Ms;ee.FLOW_END=Ws;ee.SCALAR=Bs;ee.isCollection=vh;ee.isScalar=bh;ee.prettyToken=kh;ee.tokenType=Sh});var Us=v(ml=>{"use strict";var rn=_i();function ce(t){switch(t){case void 0:case" ":case`
120
- `:case"\r":case" ":return!0;default:return!1}}var pl=new Set("0123456789ABCDEFabcdef"),Ch=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),Pi=new Set(",[]{}"),Eh=new Set(` ,[]{}
121
- \r `),Ks=t=>!t||Eh.has(t),Ys=class{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(e,n=!1){if(e){if(typeof e!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+e:e,this.lineEndPos=null}this.atEnd=!n;let i=this.next??"stream";for(;i&&(n||this.hasChars(1));)i=yield*this.parseNext(i)}atLineEnd(){let e=this.pos,n=this.buffer[e];for(;n===" "||n===" ";)n=this.buffer[++e];return!n||n==="#"||n===`
119
+ `:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(t[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}ee.createScalarToken=Fo.createScalarToken;ee.resolveAsScalar=Fo.resolveAsScalar;ee.setScalarValue=Fo.setScalarValue;ee.stringify=Eh.stringify;ee.visit=xh.visit;ee.BOM=Wo;ee.DOCUMENT=Mo;ee.FLOW_END=Bo;ee.SCALAR=Ko;ee.isCollection=_h;ee.isScalar=Ph;ee.prettyToken=Rh;ee.tokenType=Nh});var Ho=v(gl=>{"use strict";var on=_i();function le(t){switch(t){case void 0:case" ":case`
120
+ `:case"\r":case" ":return!0;default:return!1}}var hl=new Set("0123456789ABCDEFabcdef"),Ah=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),Pi=new Set(",[]{}"),Oh=new Set(` ,[]{}
121
+ \r `),Yo=t=>!t||Oh.has(t),Uo=class{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(e,n=!1){if(e){if(typeof e!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+e:e,this.lineEndPos=null}this.atEnd=!n;let i=this.next??"stream";for(;i&&(n||this.hasChars(1));)i=yield*this.parseNext(i)}atLineEnd(){let e=this.pos,n=this.buffer[e];for(;n===" "||n===" ";)n=this.buffer[++e];return!n||n==="#"||n===`
122
122
  `?!0:n==="\r"?this.buffer[e+1]===`
123
123
  `:!1}charAt(e){return this.buffer[this.pos+e]}continueScalar(e){let n=this.buffer[e];if(this.indentNext>0){let i=0;for(;n===" ";)n=this.buffer[++i+e];if(n==="\r"){let r=this.buffer[i+e+1];if(r===`
124
124
  `||!r&&!this.atEnd)return e+i+1}return n===`
125
- `||i>=this.indentNext||!n&&!this.atEnd?e+i:-1}if(n==="-"||n==="."){let i=this.buffer.substr(e,3);if((i==="---"||i==="...")&&ce(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;return(typeof e!="number"||e!==-1&&e<this.pos)&&(e=this.buffer.indexOf(`
126
- `,this.pos),this.lineEndPos=e),e===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[e-1]==="\r"&&(e-=1),this.buffer.substring(this.pos,e))}hasChars(e){return this.pos+e<=this.buffer.length}setNext(e){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=e,null}peek(e){return this.buffer.substr(this.pos,e)}*parseNext(e){switch(e){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let e=this.getLine();if(e===null)return this.setNext("stream");if(e[0]===rn.BOM&&(yield*this.pushCount(1),e=e.substring(1)),e[0]==="%"){let n=e.length,i=e.indexOf("#");for(;i!==-1;){let s=e[i-1];if(s===" "||s===" "){n=i-1;break}else i=e.indexOf("#",i+1)}for(;;){let s=e[n-1];if(s===" "||s===" ")n-=1;else break}let r=(yield*this.pushCount(n))+(yield*this.pushSpaces(!0));return yield*this.pushCount(e.length-r),this.pushNewline(),"stream"}if(this.atLineEnd()){let n=yield*this.pushSpaces(!0);return yield*this.pushCount(e.length-n),yield*this.pushNewline(),"stream"}return yield rn.DOCUMENT,yield*this.parseLineStart()}*parseLineStart(){let e=this.charAt(0);if(!e&&!this.atEnd)return this.setNext("line-start");if(e==="-"||e==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");let n=this.peek(3);if((n==="---"||n==="...")&&ce(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,n==="---"?"doc":"stream"}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!ce(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[e,n]=this.peek(2);if(!n&&!this.atEnd)return this.setNext("block-start");if((e==="-"||e==="?"||e===":")&&ce(n)){let i=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=i,"block-start"}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let e=this.getLine();if(e===null)return this.setNext("doc");let n=yield*this.pushIndicators();switch(e[n]){case"#":yield*this.pushCount(e.length-n);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(Ks),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return n+=yield*this.parseBlockScalarHeader(),n+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-n),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,n,i=-1;do e=yield*this.pushNewline(),e>0?(n=yield*this.pushSpaces(!1),this.indentValue=i=n):n=0,n+=yield*this.pushSpaces(!0);while(e+n>0);let r=this.getLine();if(r===null)return this.setNext("flow");if((i!==-1&&i<this.indentNext&&r[0]!=="#"||i===0&&(r.startsWith("---")||r.startsWith("..."))&&ce(r[3]))&&!(i===this.indentNext-1&&this.flowLevel===1&&(r[0]==="]"||r[0]==="}")))return this.flowLevel=0,yield rn.FLOW_END,yield*this.parseLineStart();let s=0;for(;r[s]===",";)s+=yield*this.pushCount(1),s+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(s+=yield*this.pushIndicators(),r[s]){case void 0:return"flow";case"#":return yield*this.pushCount(r.length-s),"flow";case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel+=1,"flow";case"}":case"]":return yield*this.pushCount(1),this.flowKey=!0,this.flowLevel-=1,this.flowLevel?"flow":"doc";case"*":return yield*this.pushUntil(Ks),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let o=this.charAt(1);if(this.flowKey||ce(o)||o===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let e=this.charAt(0),n=this.buffer.indexOf(e,this.pos+1);if(e==="'")for(;n!==-1&&this.buffer[n+1]==="'";)n=this.buffer.indexOf("'",n+2);else for(;n!==-1;){let s=0;for(;this.buffer[n-1-s]==="\\";)s+=1;if(s%2===0)break;n=this.buffer.indexOf('"',n+1)}let i=this.buffer.substring(0,n),r=i.indexOf(`
127
- `,this.pos);if(r!==-1){for(;r!==-1;){let s=this.continueScalar(r+1);if(s===-1)break;r=i.indexOf(`
128
- `,s)}r!==-1&&(n=r-(i[r-1]==="\r"?2:1))}if(n===-1){if(!this.atEnd)return this.setNext("quoted-scalar");n=this.buffer.length}return yield*this.pushToIndex(n+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let e=this.pos;for(;;){let n=this.buffer[++e];if(n==="+")this.blockScalarKeep=!0;else if(n>"0"&&n<="9")this.blockScalarIndent=Number(n)-1;else if(n!=="-")break}return yield*this.pushUntil(n=>ce(n)||n==="#")}*parseBlockScalar(){let e=this.pos-1,n=0,i;e:for(let s=this.pos;i=this.buffer[s];++s)switch(i){case" ":n+=1;break;case`
129
- `:e=s,n=0;break;case"\r":{let o=this.buffer[s+1];if(!o&&!this.atEnd)return this.setNext("block-scalar");if(o===`
130
- `)break}default:break e}if(!i&&!this.atEnd)return this.setNext("block-scalar");if(n>=this.indentNext){this.blockScalarIndent===-1?this.indentNext=n:this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{let s=this.continueScalar(e+1);if(s===-1)break;e=this.buffer.indexOf(`
131
- `,s)}while(e!==-1);if(e===-1){if(!this.atEnd)return this.setNext("block-scalar");e=this.buffer.length}}let r=e+1;for(i=this.buffer[r];i===" ";)i=this.buffer[++r];if(i===" "){for(;i===" "||i===" "||i==="\r"||i===`
132
- `;)i=this.buffer[++r];e=r-1}else if(!this.blockScalarKeep)do{let s=e-1,o=this.buffer[s];o==="\r"&&(o=this.buffer[--s]);let a=s;for(;o===" ";)o=this.buffer[--s];if(o===`
133
- `&&s>=this.pos&&s+1+n>a)e=s;else break}while(!0);return yield rn.SCALAR,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,n=this.pos-1,i=this.pos-1,r;for(;r=this.buffer[++i];)if(r===":"){let s=this.buffer[i+1];if(ce(s)||e&&Pi.has(s))break;n=i}else if(ce(r)){let s=this.buffer[i+1];if(r==="\r"&&(s===`
125
+ `||i>=this.indentNext||!n&&!this.atEnd?e+i:-1}if(n==="-"||n==="."){let i=this.buffer.substr(e,3);if((i==="---"||i==="...")&&le(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;return(typeof e!="number"||e!==-1&&e<this.pos)&&(e=this.buffer.indexOf(`
126
+ `,this.pos),this.lineEndPos=e),e===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[e-1]==="\r"&&(e-=1),this.buffer.substring(this.pos,e))}hasChars(e){return this.pos+e<=this.buffer.length}setNext(e){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=e,null}peek(e){return this.buffer.substr(this.pos,e)}*parseNext(e){switch(e){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let e=this.getLine();if(e===null)return this.setNext("stream");if(e[0]===on.BOM&&(yield*this.pushCount(1),e=e.substring(1)),e[0]==="%"){let n=e.length,i=e.indexOf("#");for(;i!==-1;){let o=e[i-1];if(o===" "||o===" "){n=i-1;break}else i=e.indexOf("#",i+1)}for(;;){let o=e[n-1];if(o===" "||o===" ")n-=1;else break}let r=(yield*this.pushCount(n))+(yield*this.pushSpaces(!0));return yield*this.pushCount(e.length-r),this.pushNewline(),"stream"}if(this.atLineEnd()){let n=yield*this.pushSpaces(!0);return yield*this.pushCount(e.length-n),yield*this.pushNewline(),"stream"}return yield on.DOCUMENT,yield*this.parseLineStart()}*parseLineStart(){let e=this.charAt(0);if(!e&&!this.atEnd)return this.setNext("line-start");if(e==="-"||e==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");let n=this.peek(3);if((n==="---"||n==="...")&&le(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,n==="---"?"doc":"stream"}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!le(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[e,n]=this.peek(2);if(!n&&!this.atEnd)return this.setNext("block-start");if((e==="-"||e==="?"||e===":")&&le(n)){let i=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=i,"block-start"}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let e=this.getLine();if(e===null)return this.setNext("doc");let n=yield*this.pushIndicators();switch(e[n]){case"#":yield*this.pushCount(e.length-n);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(Yo),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return n+=yield*this.parseBlockScalarHeader(),n+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-n),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,n,i=-1;do e=yield*this.pushNewline(),e>0?(n=yield*this.pushSpaces(!1),this.indentValue=i=n):n=0,n+=yield*this.pushSpaces(!0);while(e+n>0);let r=this.getLine();if(r===null)return this.setNext("flow");if((i!==-1&&i<this.indentNext&&r[0]!=="#"||i===0&&(r.startsWith("---")||r.startsWith("..."))&&le(r[3]))&&!(i===this.indentNext-1&&this.flowLevel===1&&(r[0]==="]"||r[0]==="}")))return this.flowLevel=0,yield on.FLOW_END,yield*this.parseLineStart();let o=0;for(;r[o]===",";)o+=yield*this.pushCount(1),o+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(o+=yield*this.pushIndicators(),r[o]){case void 0:return"flow";case"#":return yield*this.pushCount(r.length-o),"flow";case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel+=1,"flow";case"}":case"]":return yield*this.pushCount(1),this.flowKey=!0,this.flowLevel-=1,this.flowLevel?"flow":"doc";case"*":return yield*this.pushUntil(Yo),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let s=this.charAt(1);if(this.flowKey||le(s)||s===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let e=this.charAt(0),n=this.buffer.indexOf(e,this.pos+1);if(e==="'")for(;n!==-1&&this.buffer[n+1]==="'";)n=this.buffer.indexOf("'",n+2);else for(;n!==-1;){let o=0;for(;this.buffer[n-1-o]==="\\";)o+=1;if(o%2===0)break;n=this.buffer.indexOf('"',n+1)}let i=this.buffer.substring(0,n),r=i.indexOf(`
127
+ `,this.pos);if(r!==-1){for(;r!==-1;){let o=this.continueScalar(r+1);if(o===-1)break;r=i.indexOf(`
128
+ `,o)}r!==-1&&(n=r-(i[r-1]==="\r"?2:1))}if(n===-1){if(!this.atEnd)return this.setNext("quoted-scalar");n=this.buffer.length}return yield*this.pushToIndex(n+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let e=this.pos;for(;;){let n=this.buffer[++e];if(n==="+")this.blockScalarKeep=!0;else if(n>"0"&&n<="9")this.blockScalarIndent=Number(n)-1;else if(n!=="-")break}return yield*this.pushUntil(n=>le(n)||n==="#")}*parseBlockScalar(){let e=this.pos-1,n=0,i;e:for(let o=this.pos;i=this.buffer[o];++o)switch(i){case" ":n+=1;break;case`
129
+ `:e=o,n=0;break;case"\r":{let s=this.buffer[o+1];if(!s&&!this.atEnd)return this.setNext("block-scalar");if(s===`
130
+ `)break}default:break e}if(!i&&!this.atEnd)return this.setNext("block-scalar");if(n>=this.indentNext){this.blockScalarIndent===-1?this.indentNext=n:this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{let o=this.continueScalar(e+1);if(o===-1)break;e=this.buffer.indexOf(`
131
+ `,o)}while(e!==-1);if(e===-1){if(!this.atEnd)return this.setNext("block-scalar");e=this.buffer.length}}let r=e+1;for(i=this.buffer[r];i===" ";)i=this.buffer[++r];if(i===" "){for(;i===" "||i===" "||i==="\r"||i===`
132
+ `;)i=this.buffer[++r];e=r-1}else if(!this.blockScalarKeep)do{let o=e-1,s=this.buffer[o];s==="\r"&&(s=this.buffer[--o]);let a=o;for(;s===" ";)s=this.buffer[--o];if(s===`
133
+ `&&o>=this.pos&&o+1+n>a)e=o;else break}while(!0);return yield on.SCALAR,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,n=this.pos-1,i=this.pos-1,r;for(;r=this.buffer[++i];)if(r===":"){let o=this.buffer[i+1];if(le(o)||e&&Pi.has(o))break;n=i}else if(le(r)){let o=this.buffer[i+1];if(r==="\r"&&(o===`
134
134
  `?(i+=1,r=`
135
- `,s=this.buffer[i+1]):n=i),s==="#"||e&&Pi.has(s))break;if(r===`
136
- `){let o=this.continueScalar(i+1);if(o===-1)break;i=Math.max(i,o-2)}}else{if(e&&Pi.has(r))break;n=i}return!r&&!this.atEnd?this.setNext("plain-scalar"):(yield rn.SCALAR,yield*this.pushToIndex(n+1,!0),e?"flow":"doc")}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,n){let i=this.buffer.slice(this.pos,e);return i?(yield i,this.pos+=i.length,i.length):(n&&(yield""),0)}*pushIndicators(){let e=0;e:for(;;){switch(this.charAt(0)){case"!":e+=yield*this.pushTag(),e+=yield*this.pushSpaces(!0);continue e;case"&":e+=yield*this.pushUntil(Ks),e+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let n=this.flowLevel>0,i=this.charAt(1);if(ce(i)||n&&Pi.has(i)){n?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,e+=yield*this.pushCount(1),e+=yield*this.pushSpaces(!0);continue e}}}break e}return e}*pushTag(){if(this.charAt(1)==="<"){let e=this.pos+2,n=this.buffer[e];for(;!ce(n)&&n!==">";)n=this.buffer[++e];return yield*this.pushToIndex(n===">"?e+1:e,!1)}else{let e=this.pos+1,n=this.buffer[e];for(;n;)if(Ch.has(n))n=this.buffer[++e];else if(n==="%"&&pl.has(this.buffer[e+1])&&pl.has(this.buffer[e+2]))n=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){let e=this.buffer[this.pos];return e===`
135
+ `,o=this.buffer[i+1]):n=i),o==="#"||e&&Pi.has(o))break;if(r===`
136
+ `){let s=this.continueScalar(i+1);if(s===-1)break;i=Math.max(i,s-2)}}else{if(e&&Pi.has(r))break;n=i}return!r&&!this.atEnd?this.setNext("plain-scalar"):(yield on.SCALAR,yield*this.pushToIndex(n+1,!0),e?"flow":"doc")}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,n){let i=this.buffer.slice(this.pos,e);return i?(yield i,this.pos+=i.length,i.length):(n&&(yield""),0)}*pushIndicators(){let e=0;e:for(;;){switch(this.charAt(0)){case"!":e+=yield*this.pushTag(),e+=yield*this.pushSpaces(!0);continue e;case"&":e+=yield*this.pushUntil(Yo),e+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let n=this.flowLevel>0,i=this.charAt(1);if(le(i)||n&&Pi.has(i)){n?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,e+=yield*this.pushCount(1),e+=yield*this.pushSpaces(!0);continue e}}}break e}return e}*pushTag(){if(this.charAt(1)==="<"){let e=this.pos+2,n=this.buffer[e];for(;!le(n)&&n!==">";)n=this.buffer[++e];return yield*this.pushToIndex(n===">"?e+1:e,!1)}else{let e=this.pos+1,n=this.buffer[e];for(;n;)if(Ah.has(n))n=this.buffer[++e];else if(n==="%"&&hl.has(this.buffer[e+1])&&hl.has(this.buffer[e+2]))n=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){let e=this.buffer[this.pos];return e===`
137
137
  `?yield*this.pushCount(1):e==="\r"&&this.charAt(1)===`
138
- `?yield*this.pushCount(2):0}*pushSpaces(e){let n=this.pos-1,i;do i=this.buffer[++n];while(i===" "||e&&i===" ");let r=n-this.pos;return r>0&&(yield this.buffer.substr(this.pos,r),this.pos=n),r}*pushUntil(e){let n=this.pos,i=this.buffer[n];for(;!e(i);)i=this.buffer[++n];return yield*this.pushToIndex(n,!1)}};ml.Lexer=Ys});var Js=v(hl=>{"use strict";var Vs=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let n=0,i=this.lineStarts.length;for(;n<i;){let s=n+i>>1;this.lineStarts[s]<e?n=s+1:i=s}if(this.lineStarts[n]===e)return{line:n+1,col:1};if(n===0)return{line:0,col:e};let r=this.lineStarts[n-1];return{line:n,col:e-r+1}}}};hl.LineCounter=Vs});var Gs=v(bl=>{"use strict";var xh=jn("process"),gl=_i(),_h=Us();function je(t,e){for(let n=0;n<t.length;++n)if(t[n].type===e)return!0;return!1}function wl(t){for(let e=0;e<t.length;++e)switch(t[e].type){case"space":case"comment":case"newline":break;default:return e}return-1}function vl(t){switch(t?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function Ri(t){switch(t.type){case"document":return t.start;case"block-map":{let e=t.items[t.items.length-1];return e.sep??e.start}case"block-seq":return t.items[t.items.length-1].start;default:return[]}}function kt(t){if(t.length===0)return[];let e=t.length;e:for(;--e>=0;)switch(t[e].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;t[++e]?.type==="space";);return t.splice(e,t.length)}function Ni(t,e){if(e.length<1e5)Array.prototype.push.apply(t,e);else for(let n=0;n<e.length;++n)t.push(e[n])}function yl(t){if(t.start.type==="flow-seq-start")for(let e of t.items)e.sep&&!e.value&&!je(e.start,"explicit-key-ind")&&!je(e.sep,"map-value-ind")&&(e.key&&(e.value=e.key),delete e.key,vl(e.value)?e.value.end?Ni(e.value.end,e.sep):e.value.end=e.sep:Ni(e.start,e.sep),delete e.sep)}var Hs=class{constructor(e){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new _h.Lexer,this.onNewLine=e}*parse(e,n=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let i of this.lexer.lex(e,n))yield*this.next(i);n||(yield*this.end())}*next(e){if(this.source=e,xh.env.LOG_TOKENS&&console.log("|",gl.prettyToken(e)),this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}let n=gl.tokenType(e);if(n)if(n==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=n,yield*this.step(),n){case"newline":this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+e.length);break;case"space":this.atNewLine&&e[0]===" "&&(this.indent+=e.length);break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":this.atNewLine&&(this.indent+=e.length);break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=e.length}else{let i=`Not a YAML token: ${e}`;yield*this.pop({type:"error",offset:this.offset,message:i,source:e}),this.offset+=e.length}}*end(){for(;this.stack.length>0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let e=this.peek(1);if(this.type==="doc-end"&&e?.type!=="doc-end"){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!e)return yield*this.stream();switch(e.type){case"document":return yield*this.document(e);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(e);case"block-scalar":return yield*this.blockScalar(e);case"block-map":return yield*this.blockMap(e);case"block-seq":return yield*this.blockSequence(e);case"flow-collection":return yield*this.flowCollection(e);case"doc-end":return yield*this.documentEnd(e)}yield*this.pop()}peek(e){return this.stack[this.stack.length-e]}*pop(e){let n=e??this.stack.pop();if(!n)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield n;else{let i=this.peek(1);switch(n.type==="block-scalar"?n.indent="indent"in i?i.indent:0:n.type==="flow-collection"&&i.type==="document"&&(n.indent=0),n.type==="flow-collection"&&yl(n),i.type){case"document":i.value=n;break;case"block-scalar":i.props.push(n);break;case"block-map":{let r=i.items[i.items.length-1];if(r.value){i.items.push({start:[],key:n,sep:[]}),this.onKeyLine=!0;return}else if(r.sep)r.value=n;else{Object.assign(r,{key:n,sep:[]}),this.onKeyLine=!r.explicitKey;return}break}case"block-seq":{let r=i.items[i.items.length-1];r.value?i.items.push({start:[],value:n}):r.value=n;break}case"flow-collection":{let r=i.items[i.items.length-1];!r||r.value?i.items.push({start:[],key:n,sep:[]}):r.sep?r.value=n:Object.assign(r,{key:n,sep:[]});return}default:yield*this.pop(),yield*this.pop(n)}if((i.type==="document"||i.type==="block-map"||i.type==="block-seq")&&(n.type==="block-map"||n.type==="block-seq")){let r=n.items[n.items.length-1];r&&!r.sep&&!r.value&&r.start.length>0&&wl(r.start)===-1&&(n.indent===0||r.start.every(s=>s.type!=="comment"||s.indent<n.indent))&&(i.type==="document"?i.end=r.start:i.items.push({start:r.start}),n.items.splice(-1,1))}}}*stream(){switch(this.type){case"directive-line":yield{type:"directive",offset:this.offset,source:this.source};return;case"byte-order-mark":case"space":case"comment":case"newline":yield this.sourceToken;return;case"doc-mode":case"doc-start":{let e={type:"document",offset:this.offset,start:[]};this.type==="doc-start"&&e.start.push(this.sourceToken),this.stack.push(e);return}}yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(e){if(e.value)return yield*this.lineEnd(e);switch(this.type){case"doc-start":{wl(e.start)!==-1?(yield*this.pop(),yield*this.step()):e.start.push(this.sourceToken);return}case"anchor":case"tag":case"space":case"comment":case"newline":e.start.push(this.sourceToken);return}let n=this.startBlockValue(e);n?this.stack.push(n):yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(e){if(this.type==="map-value-ind"){let n=Ri(this.peek(2)),i=kt(n),r;e.end?(r=e.end,r.push(this.sourceToken),delete e.end):r=[this.sourceToken];let s={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:i,key:e,sep:r}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=s}else yield*this.lineEnd(e)}*blockScalar(e){switch(this.type){case"space":case"comment":case"newline":e.props.push(this.sourceToken);return;case"scalar":if(e.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let n=this.source.indexOf(`
138
+ `?yield*this.pushCount(2):0}*pushSpaces(e){let n=this.pos-1,i;do i=this.buffer[++n];while(i===" "||e&&i===" ");let r=n-this.pos;return r>0&&(yield this.buffer.substr(this.pos,r),this.pos=n),r}*pushUntil(e){let n=this.pos,i=this.buffer[n];for(;!e(i);)i=this.buffer[++n];return yield*this.pushToIndex(n,!1)}};gl.Lexer=Uo});var Jo=v(wl=>{"use strict";var Vo=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let n=0,i=this.lineStarts.length;for(;n<i;){let o=n+i>>1;this.lineStarts[o]<e?n=o+1:i=o}if(this.lineStarts[n]===e)return{line:n+1,col:1};if(n===0)return{line:0,col:e};let r=this.lineStarts[n-1];return{line:n,col:e-r+1}}}};wl.LineCounter=Vo});var zo=v(Sl=>{"use strict";var jh=jn("process"),yl=_i(),Th=Ho();function Te(t,e){for(let n=0;n<t.length;++n)if(t[n].type===e)return!0;return!1}function vl(t){for(let e=0;e<t.length;++e)switch(t[e].type){case"space":case"comment":case"newline":break;default:return e}return-1}function kl(t){switch(t?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function Ri(t){switch(t.type){case"document":return t.start;case"block-map":{let e=t.items[t.items.length-1];return e.sep??e.start}case"block-seq":return t.items[t.items.length-1].start;default:return[]}}function kt(t){if(t.length===0)return[];let e=t.length;e:for(;--e>=0;)switch(t[e].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;t[++e]?.type==="space";);return t.splice(e,t.length)}function Ni(t,e){if(e.length<1e5)Array.prototype.push.apply(t,e);else for(let n=0;n<e.length;++n)t.push(e[n])}function bl(t){if(t.start.type==="flow-seq-start")for(let e of t.items)e.sep&&!e.value&&!Te(e.start,"explicit-key-ind")&&!Te(e.sep,"map-value-ind")&&(e.key&&(e.value=e.key),delete e.key,kl(e.value)?e.value.end?Ni(e.value.end,e.sep):e.value.end=e.sep:Ni(e.start,e.sep),delete e.sep)}var Go=class{constructor(e){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new Th.Lexer,this.onNewLine=e}*parse(e,n=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let i of this.lexer.lex(e,n))yield*this.next(i);n||(yield*this.end())}*next(e){if(this.source=e,jh.env.LOG_TOKENS&&console.log("|",yl.prettyToken(e)),this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}let n=yl.tokenType(e);if(n)if(n==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=n,yield*this.step(),n){case"newline":this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+e.length);break;case"space":this.atNewLine&&e[0]===" "&&(this.indent+=e.length);break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":this.atNewLine&&(this.indent+=e.length);break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=e.length}else{let i=`Not a YAML token: ${e}`;yield*this.pop({type:"error",offset:this.offset,message:i,source:e}),this.offset+=e.length}}*end(){for(;this.stack.length>0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let e=this.peek(1);if(this.type==="doc-end"&&e?.type!=="doc-end"){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!e)return yield*this.stream();switch(e.type){case"document":return yield*this.document(e);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(e);case"block-scalar":return yield*this.blockScalar(e);case"block-map":return yield*this.blockMap(e);case"block-seq":return yield*this.blockSequence(e);case"flow-collection":return yield*this.flowCollection(e);case"doc-end":return yield*this.documentEnd(e)}yield*this.pop()}peek(e){return this.stack[this.stack.length-e]}*pop(e){let n=e??this.stack.pop();if(!n)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield n;else{let i=this.peek(1);switch(n.type==="block-scalar"?n.indent="indent"in i?i.indent:0:n.type==="flow-collection"&&i.type==="document"&&(n.indent=0),n.type==="flow-collection"&&bl(n),i.type){case"document":i.value=n;break;case"block-scalar":i.props.push(n);break;case"block-map":{let r=i.items[i.items.length-1];if(r.value){i.items.push({start:[],key:n,sep:[]}),this.onKeyLine=!0;return}else if(r.sep)r.value=n;else{Object.assign(r,{key:n,sep:[]}),this.onKeyLine=!r.explicitKey;return}break}case"block-seq":{let r=i.items[i.items.length-1];r.value?i.items.push({start:[],value:n}):r.value=n;break}case"flow-collection":{let r=i.items[i.items.length-1];!r||r.value?i.items.push({start:[],key:n,sep:[]}):r.sep?r.value=n:Object.assign(r,{key:n,sep:[]});return}default:yield*this.pop(),yield*this.pop(n)}if((i.type==="document"||i.type==="block-map"||i.type==="block-seq")&&(n.type==="block-map"||n.type==="block-seq")){let r=n.items[n.items.length-1];r&&!r.sep&&!r.value&&r.start.length>0&&vl(r.start)===-1&&(n.indent===0||r.start.every(o=>o.type!=="comment"||o.indent<n.indent))&&(i.type==="document"?i.end=r.start:i.items.push({start:r.start}),n.items.splice(-1,1))}}}*stream(){switch(this.type){case"directive-line":yield{type:"directive",offset:this.offset,source:this.source};return;case"byte-order-mark":case"space":case"comment":case"newline":yield this.sourceToken;return;case"doc-mode":case"doc-start":{let e={type:"document",offset:this.offset,start:[]};this.type==="doc-start"&&e.start.push(this.sourceToken),this.stack.push(e);return}}yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(e){if(e.value)return yield*this.lineEnd(e);switch(this.type){case"doc-start":{vl(e.start)!==-1?(yield*this.pop(),yield*this.step()):e.start.push(this.sourceToken);return}case"anchor":case"tag":case"space":case"comment":case"newline":e.start.push(this.sourceToken);return}let n=this.startBlockValue(e);n?this.stack.push(n):yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(e){if(this.type==="map-value-ind"){let n=Ri(this.peek(2)),i=kt(n),r;e.end?(r=e.end,r.push(this.sourceToken),delete e.end):r=[this.sourceToken];let o={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:i,key:e,sep:r}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=o}else yield*this.lineEnd(e)}*blockScalar(e){switch(this.type){case"space":case"comment":case"newline":e.props.push(this.sourceToken);return;case"scalar":if(e.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let n=this.source.indexOf(`
139
139
  `)+1;for(;n!==0;)this.onNewLine(this.offset+n),n=this.source.indexOf(`
140
- `,n)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let n=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,n.value){let i="end"in n.value?n.value.end:void 0;(Array.isArray(i)?i[i.length-1]:void 0)?.type==="comment"?i?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)e.items.push({start:[this.sourceToken]});else if(n.sep)n.sep.push(this.sourceToken);else{if(this.atIndentedComment(n.start,e.indent)){let r=e.items[e.items.length-2]?.value?.end;if(Array.isArray(r)){Ni(r,n.start),r.push(this.sourceToken),e.items.pop();return}}n.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let i=!this.onKeyLine&&this.indent===e.indent,r=i&&(n.sep||n.explicitKey)&&this.type!=="seq-item-ind",s=[];if(r&&n.sep&&!n.value){let o=[];for(let a=0;a<n.sep.length;++a){let c=n.sep[a];switch(c.type){case"newline":o.push(a);break;case"space":break;case"comment":c.indent>e.indent&&(o.length=0);break;default:o.length=0}}o.length>=2&&(s=n.sep.splice(o[1]))}switch(this.type){case"anchor":case"tag":r||n.value?(s.push(this.sourceToken),e.items.push({start:s}),this.onKeyLine=!0):n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"explicit-key-ind":!n.sep&&!n.explicitKey?(n.start.push(this.sourceToken),n.explicitKey=!0):r||n.value?(s.push(this.sourceToken),e.items.push({start:s,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(n.explicitKey)if(n.sep)if(n.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(je(n.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:null,sep:[this.sourceToken]}]});else if(vl(n.key)&&!je(n.sep,"newline")){let o=kt(n.start),a=n.key,c=n.sep;c.push(this.sourceToken),delete n.key,delete n.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:a,sep:c}]})}else s.length>0?n.sep=n.sep.concat(s,this.sourceToken):n.sep.push(this.sourceToken);else if(je(n.start,"newline"))Object.assign(n,{key:null,sep:[this.sourceToken]});else{let o=kt(n.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]})}else n.sep?n.value||r?e.items.push({start:s,key:null,sep:[this.sourceToken]}):je(n.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):n.sep.push(this.sourceToken):Object.assign(n,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let o=this.flowScalar(this.type);r||n.value?(e.items.push({start:s,key:o,sep:[]}),this.onKeyLine=!0):n.sep?this.stack.push(o):(Object.assign(n,{key:o,sep:[]}),this.onKeyLine=!0);return}default:{let o=this.startBlockValue(e);if(o){if(o.type==="block-seq"){if(!n.explicitKey&&n.sep&&!je(n.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else i&&e.items.push({start:s});this.stack.push(o);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let n=e.items[e.items.length-1];switch(this.type){case"newline":if(n.value){let i="end"in n.value?n.value.end:void 0;(Array.isArray(i)?i[i.length-1]:void 0)?.type==="comment"?i?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(n.start,e.indent)){let r=e.items[e.items.length-2]?.value?.end;if(Array.isArray(r)){Ni(r,n.start),r.push(this.sourceToken),e.items.pop();return}}n.start.push(this.sourceToken)}return;case"anchor":case"tag":if(n.value||this.indent<=e.indent)break;n.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;n.value||je(n.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return}if(this.indent>e.indent){let i=this.startBlockValue(e);if(i){this.stack.push(i);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let n=e.items[e.items.length-1];if(this.type==="flow-error-end"){let i;do yield*this.pop(),i=this.peek(1);while(i?.type==="flow-collection")}else if(e.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!n||n.sep?e.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return;case"map-value-ind":!n||n.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):n.sep?n.sep.push(this.sourceToken):Object.assign(n,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!n||n.value?e.items.push({start:[this.sourceToken]}):n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let r=this.flowScalar(this.type);!n||n.value?e.items.push({start:[],key:r,sep:[]}):n.sep?this.stack.push(r):Object.assign(n,{key:r,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}let i=this.startBlockValue(e);i?this.stack.push(i):(yield*this.pop(),yield*this.step())}else{let i=this.peek(2);if(i.type==="block-map"&&(this.type==="map-value-ind"&&i.indent===e.indent||this.type==="newline"&&!i.items[i.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&i.type!=="flow-collection"){let r=Ri(i),s=kt(r);yl(e);let o=e.end.splice(1,e.end.length);o.push(this.sourceToken);let a={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:s,key:e,sep:o}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=a}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let n=this.source.indexOf(`
140
+ `,n)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let n=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,n.value){let i="end"in n.value?n.value.end:void 0;(Array.isArray(i)?i[i.length-1]:void 0)?.type==="comment"?i?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)e.items.push({start:[this.sourceToken]});else if(n.sep)n.sep.push(this.sourceToken);else{if(this.atIndentedComment(n.start,e.indent)){let r=e.items[e.items.length-2]?.value?.end;if(Array.isArray(r)){Ni(r,n.start),r.push(this.sourceToken),e.items.pop();return}}n.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let i=!this.onKeyLine&&this.indent===e.indent,r=i&&(n.sep||n.explicitKey)&&this.type!=="seq-item-ind",o=[];if(r&&n.sep&&!n.value){let s=[];for(let a=0;a<n.sep.length;++a){let c=n.sep[a];switch(c.type){case"newline":s.push(a);break;case"space":break;case"comment":c.indent>e.indent&&(s.length=0);break;default:s.length=0}}s.length>=2&&(o=n.sep.splice(s[1]))}switch(this.type){case"anchor":case"tag":r||n.value?(o.push(this.sourceToken),e.items.push({start:o}),this.onKeyLine=!0):n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"explicit-key-ind":!n.sep&&!n.explicitKey?(n.start.push(this.sourceToken),n.explicitKey=!0):r||n.value?(o.push(this.sourceToken),e.items.push({start:o,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(n.explicitKey)if(n.sep)if(n.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(Te(n.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]});else if(kl(n.key)&&!Te(n.sep,"newline")){let s=kt(n.start),a=n.key,c=n.sep;c.push(this.sourceToken),delete n.key,delete n.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:a,sep:c}]})}else o.length>0?n.sep=n.sep.concat(o,this.sourceToken):n.sep.push(this.sourceToken);else if(Te(n.start,"newline"))Object.assign(n,{key:null,sep:[this.sourceToken]});else{let s=kt(n.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:null,sep:[this.sourceToken]}]})}else n.sep?n.value||r?e.items.push({start:o,key:null,sep:[this.sourceToken]}):Te(n.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):n.sep.push(this.sourceToken):Object.assign(n,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let s=this.flowScalar(this.type);r||n.value?(e.items.push({start:o,key:s,sep:[]}),this.onKeyLine=!0):n.sep?this.stack.push(s):(Object.assign(n,{key:s,sep:[]}),this.onKeyLine=!0);return}default:{let s=this.startBlockValue(e);if(s){if(s.type==="block-seq"){if(!n.explicitKey&&n.sep&&!Te(n.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else i&&e.items.push({start:o});this.stack.push(s);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let n=e.items[e.items.length-1];switch(this.type){case"newline":if(n.value){let i="end"in n.value?n.value.end:void 0;(Array.isArray(i)?i[i.length-1]:void 0)?.type==="comment"?i?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(n.start,e.indent)){let r=e.items[e.items.length-2]?.value?.end;if(Array.isArray(r)){Ni(r,n.start),r.push(this.sourceToken),e.items.pop();return}}n.start.push(this.sourceToken)}return;case"anchor":case"tag":if(n.value||this.indent<=e.indent)break;n.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;n.value||Te(n.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return}if(this.indent>e.indent){let i=this.startBlockValue(e);if(i){this.stack.push(i);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let n=e.items[e.items.length-1];if(this.type==="flow-error-end"){let i;do yield*this.pop(),i=this.peek(1);while(i?.type==="flow-collection")}else if(e.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!n||n.sep?e.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return;case"map-value-ind":!n||n.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):n.sep?n.sep.push(this.sourceToken):Object.assign(n,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!n||n.value?e.items.push({start:[this.sourceToken]}):n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let r=this.flowScalar(this.type);!n||n.value?e.items.push({start:[],key:r,sep:[]}):n.sep?this.stack.push(r):Object.assign(n,{key:r,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}let i=this.startBlockValue(e);i?this.stack.push(i):(yield*this.pop(),yield*this.step())}else{let i=this.peek(2);if(i.type==="block-map"&&(this.type==="map-value-ind"&&i.indent===e.indent||this.type==="newline"&&!i.items[i.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&i.type!=="flow-collection"){let r=Ri(i),o=kt(r);bl(e);let s=e.end.splice(1,e.end.length);s.push(this.sourceToken);let a={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:o,key:e,sep:s}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=a}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let n=this.source.indexOf(`
141
141
  `)+1;for(;n!==0;)this.onNewLine(this.offset+n),n=this.source.indexOf(`
142
- `,n)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let n=Ri(e),i=kt(n);return i.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let n=Ri(e),i=kt(n);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,n){return this.type!=="comment"||this.indent<=n?!1:e.every(i=>i.type==="newline"||i.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};bl.Parser=Hs});var xl=v(on=>{"use strict";var kl=$s(),Ph=zt(),sn=Zt(),Rh=Tr(),Nh=N(),Oh=Js(),Sl=Gs();function Cl(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new Oh.LineCounter||null,prettyErrors:e}}function Ah(t,e={}){let{lineCounter:n,prettyErrors:i}=Cl(e),r=new Sl.Parser(n?.addNewLine),s=new kl.Composer(e),o=Array.from(s.compose(r.parse(t)));if(i&&n)for(let a of o)a.errors.forEach(sn.prettifyError(t,n)),a.warnings.forEach(sn.prettifyError(t,n));return o.length>0?o:Object.assign([],{empty:!0},s.streamInfo())}function El(t,e={}){let{lineCounter:n,prettyErrors:i}=Cl(e),r=new Sl.Parser(n?.addNewLine),s=new kl.Composer(e),o=null;for(let a of s.compose(r.parse(t),!0,t.length))if(!o)o=a;else if(o.options.logLevel!=="silent"){o.errors.push(new sn.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return i&&n&&(o.errors.forEach(sn.prettifyError(t,n)),o.warnings.forEach(sn.prettifyError(t,n))),o}function jh(t,e,n){let i;typeof e=="function"?i=e:n===void 0&&e&&typeof e=="object"&&(n=e);let r=El(t,n);if(!r)return null;if(r.warnings.forEach(s=>Rh.warn(r.options.logLevel,s)),r.errors.length>0){if(r.options.logLevel!=="silent")throw r.errors[0];r.errors=[]}return r.toJS(Object.assign({reviver:i},n))}function Th(t,e,n){let i=null;if(typeof e=="function"||Array.isArray(e)?i=e:n===void 0&&e&&(n=e),typeof n=="string"&&(n=n.length),typeof n=="number"){let r=Math.round(n);n=r<1?void 0:r>8?{indent:8}:{indent:r}}if(t===void 0){let{keepUndefined:r}=n??e??{};if(!r)return}return Nh.isDocument(t)&&!i?t.toString(n):new Ph.Document(t,i,n).toString(n)}on.parse=jh;on.parseAllDocuments=Ah;on.parseDocument=El;on.stringify=Th});var Ie=v(O=>{"use strict";var Ih=$s(),$h=zt(),qh=hs(),zs=Zt(),Lh=It(),Te=N(),Dh=Re(),Fh=q(),Mh=Oe(),Wh=Ae(),Bh=_i(),Kh=Us(),Yh=Js(),Uh=Gs(),Oi=xl(),_l=Ot();O.Composer=Ih.Composer;O.Document=$h.Document;O.Schema=qh.Schema;O.YAMLError=zs.YAMLError;O.YAMLParseError=zs.YAMLParseError;O.YAMLWarning=zs.YAMLWarning;O.Alias=Lh.Alias;O.isAlias=Te.isAlias;O.isCollection=Te.isCollection;O.isDocument=Te.isDocument;O.isMap=Te.isMap;O.isNode=Te.isNode;O.isPair=Te.isPair;O.isScalar=Te.isScalar;O.isSeq=Te.isSeq;O.Pair=Dh.Pair;O.Scalar=Fh.Scalar;O.YAMLMap=Mh.YAMLMap;O.YAMLSeq=Wh.YAMLSeq;O.CST=Bh;O.Lexer=Kh.Lexer;O.LineCounter=Yh.LineCounter;O.Parser=Uh.Parser;O.parse=Oi.parse;O.parseAllDocuments=Oi.parseAllDocuments;O.parseDocument=Oi.parseDocument;O.stringify=Oi.stringify;O.visit=_l.visit;O.visitAsync=_l.visitAsync});var Ai=G(()=>{"use strict"});function $e(t){return t!==0&&t!==0n&&t!=="0"}function ji(t,e){return $e(t.dev)&&$e(e.dev)&&$e(t.ino)&&$e(e.ino)}function ye(t,e){let n=$e(t.dev)&&$e(e.dev);if(n&&t.dev!==e.dev)return!1;let i=$e(t.ino)&&$e(e.ino);return i&&t.ino!==e.ino?!1:n&&i?!0:t.birthtime===e.birthtime}var Ti=G(()=>{"use strict"});import{randomUUID as Vh}from"crypto";import{constants as Jh,promises as L}from"fs";import V from"path";async function Qs(t,e){try{return await L.link(t,e),{linked:!0}}catch(n){let i=n.code;if(i!=="ENOTSUP"&&i!=="EOPNOTSUPP")throw n}return await L.copyFile(t,e,Jh.COPYFILE_EXCL),{linked:!1}}function St(t,e){let n=V.relative(t,e);return n===""||!V.isAbsolute(n)&&n!==".."&&!n.startsWith(`..${V.sep}`)}function $i(t){return{dev:t.dev,ino:t.ino,birthtime:t.birthtimeMs}}function Hh(t,e){return ye(t,$i(e))}function Ii(t,e){let n=$i(t),i=$i(e);return ji(n,i)?ye(n,i):ye(n,i)&&t.birthtimeMs===e.birthtimeMs&&t.ctimeMs===e.ctimeMs&&t.size===e.size}async function qi(t){let e=await L.lstat(t);if(!e.isDirectory()||e.isSymbolicLink())throw new Error(`Contained atomic write parent must be a real directory: ${t}`);return{path:t,realPath:await L.realpath(t),...$i(e)}}async function qe(t){for(let e of t){let n=await L.lstat(e.path);if(!n.isDirectory()||n.isSymbolicLink()||!Hh(e,n)||await L.realpath(e.path)!==e.realPath)throw new Error(`Contained atomic write parent changed before commit: ${e.path}`)}}async function Gh(t,e){let n=V.resolve(t),i=V.resolve(e);if(!St(n,i))throw new Error(`Contained atomic write parent is outside its managed root: ${e}`);let r=[await qi(n)],s=V.relative(n,i).split(V.sep).filter(Boolean),o=n;for(let a of s){await qe(r),o=V.join(o,a);try{await L.mkdir(o)}catch(l){if(l.code!=="EEXIST")throw l}let c=await qi(o);if(!St(r[0].realPath,c.realPath))throw new Error(`Contained atomic write parent resolves outside its managed root: ${o}`);r.push(c)}return await qe(r),r}async function zh(t,e){let n=V.resolve(t),i=V.resolve(e);if(!St(n,i))throw new Error(`Contained file parent is outside its managed root: ${e}`);let r=[await qi(n)],s=V.relative(n,i).split(V.sep).filter(Boolean),o=n;for(let a of s){o=V.join(o,a);try{let c=await qi(o);if(!St(r[0].realPath,c.realPath))throw new Error(`Contained file parent resolves outside its managed root: ${o}`);r.push(c)}catch(c){if(c.code==="ENOENT")return null;throw c}}return await qe(r),r}async function Pl(t){let e;try{e=await L.open(t,"r"),await e.sync()}catch(n){let i=n.code;if(!["EACCES","EBADF","EINVAL","EISDIR","ENOTSUP","EPERM"].includes(i??""))throw n}finally{await e?.close()}}async function Qh(t,e,n){let i=V.dirname(t),r=await Gh(n.containedRoot,i),s=V.join(i,`.${V.basename(t)}.${Vh()}.tmp`),o,a;try{await n.beforeTemporaryOpen?.(),o=await L.open(s,"wx"),a=await o.stat();let[c,l]=await Promise.all([L.lstat(s),L.realpath(s)]);if(await qe(r),!c.isFile()||c.isSymbolicLink()||!Ii(a,c)||!St(r[0].realPath,l))throw new Error("Contained atomic write temporary file opened outside its managed parent");if(typeof e=="string"?await o.writeFile(e,"utf8"):await o.writeFile(e),await o.sync(),!Ii(a,await o.stat()))throw new Error("Contained atomic write temporary file changed while writing");await o.close(),o=void 0,await n.beforeCommit?.(),await qe(r);let d=await L.lstat(s);if(!d.isFile()||d.isSymbolicLink()||!Ii(d,a))throw new Error("Contained atomic write temporary file changed before commit");n.exclusive?(await Qs(s,t),await L.unlink(s)):await L.rename(s,t),await Pl(i)}catch(c){await o?.close();try{await qe(r),await L.rm(s,{force:!0})}catch{}throw c}}async function me(t,e,n){await Qh(t,e,n)}async function Xs(t,e){let n=V.dirname(t),i=await zh(e.containedRoot,n);if(!i)return!1;let r,s;try{r=await L.lstat(t),s=await L.realpath(t)}catch(c){if(c.code==="ENOENT")return!1;throw c}if(!r.isFile()||r.isSymbolicLink()||!St(i[0].realPath,s))throw new Error("Contained file removal target must be a regular file inside its managed root");await e.beforeRemove?.(),await qe(i);let[o,a]=await Promise.all([L.lstat(t),L.realpath(t)]);if(!o.isFile()||o.isSymbolicLink()||!Ii(r,o)||a!==s)throw new Error("Contained file removal target changed before removal");return await L.unlink(t),await qe(i),await Pl(n),!0}var et=G(()=>{"use strict";Ti()});var Rl=G(()=>{"use strict"});var Zs=G(()=>{"use strict";Ai()});var Nl=G(()=>{"use strict";Ai();Zs()});import Li from"path";function rg(t,e){if(typeof t!="string")throw new Error(`${e} must be a string`);let n=t.trim();if(n.length===0||Li.posix.isAbsolute(n)||Li.win32.isAbsolute(n)||/^(?:~|[\\/])/u.test(n))throw new Error(`${e} must be a project-relative path`);if(n===".")return[];let i=n.replaceAll("\\","/").split("/");if(i.some(r=>r===".."))throw new Error(`${e} must stay inside the project root`);if(i.some(r=>r===""||r==="."))throw new Error(`${e} must not contain empty or dot path segments`);return i}function an(t){let e=rg(t,"native.artifact_root");return e.length===0?".":e.join("/")}function jl(t,e="docs"){let n=t??e;if(n!=="legacy"&&n!=="docs")throw new Error("classic.artifact_layout must be legacy or docs");return n}function tt(t,e,n=!1){if(typeof t!="string")throw new Error(`${e} must be a string`);let i=t.trim().replaceAll("\\","/");if(i.length===0||Li.posix.isAbsolute(i)||Li.win32.isAbsolute(i)||/^(?:~|[\\/])/u.test(i))throw new Error(`${e} must be relative to its declared path base`);let r=i.split("/");if(r.some(s=>s===".."))throw new Error(`${e} must stay inside its declared path base`);if(r.some(s=>s===""||s==="."))throw new Error(`${e} must not contain empty or dot path segments`);if(!n&&/[*?]/u.test(i))throw new Error(`${e} cannot contain wildcards`);return r.join("/")}function cn(t,e){if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`${e} must be a mapping`);return t}function Tl(t,e,n){let i=t??e;if(i!=="en"&&i!=="zh-CN")throw new Error(`${n} must be en or zh-CN`);return i}function Il(t,e){if(typeof t!="string"||t.length===0||t.includes("\\")||t.includes("\0")||t.startsWith("/")||t.split("/").includes(".."))throw new Error(`${e} contains an unsafe pattern`);if(t.length>to)throw new Error(`${e} exceeds ${to} characters`);let n=0;for(let i=0;i<t.length;i+=1)t[i]==="?"?n+=1:t[i]==="*"&&(n+=1,t[i+1]==="*"&&(i+=1));if(n>no)throw new Error(`${e} contains more than ${no} wildcard tokens`);return t}function Ol(t,e,n){if(t===void 0)return[...n];if(!Array.isArray(t))throw new Error(`${e} contains an unsafe pattern`);return[...new Set(t.map(i=>Il(i,e)))].sort((i,r)=>i.localeCompare(r,"en"))}function eo(t,e,n){let i=t??e;if(!Number.isSafeInteger(i)||i<1)throw new Error(`${n} must be a positive integer`);return i}function sg(t){if(t===void 0)return{...se,include:[...se.include],exclude:[...se.exclude]};let e=cn(t,"native.snapshot");return{include:Ol(e.include,"native.snapshot.include",se.include),exclude:Ol(e.exclude,"native.snapshot.exclude",se.exclude),max_files:eo(e.max_files,se.max_files,"native.snapshot.max_files"),max_total_bytes:eo(e.max_total_bytes,se.max_total_bytes,"native.snapshot.max_total_bytes"),max_duration_ms:eo(e.max_duration_ms,se.max_duration_ms,"native.snapshot.max_duration_ms")}}function og(t){if(t===void 0)return;let e=cn(t,"native.pending_root_move"),n=e.id,i=e.from_artifact_root,r=e.to_artifact_root,s=e.stage;if(typeof n!="string"||!/^[a-f0-9-]{8,}$/u.test(n))throw new Error("native.pending_root_move.id is invalid");if(typeof i!="string"||typeof r!="string")throw new Error("native.pending_root_move roots must be strings");if(s!=="copying"&&s!=="ready"&&s!=="switched")throw new Error("native.pending_root_move.stage is invalid");let o;if(e.cleanup!==void 0){let a=cn(e.cleanup,"native.pending_root_move.cleanup"),c=a.kind,l=a.state,d=a.manifest_hash;if(c!=="forward-source"&&c!=="restart-staging"&&c!=="rollback-destination"&&c!=="rollback-staging")throw new Error("native.pending_root_move.cleanup.kind is invalid");if(l!=="prepared"&&l!=="quarantined"&&l!=="deleting")throw new Error("native.pending_root_move.cleanup.state is invalid");if(typeof d!="string"||!/^[a-f0-9]{64}$/u.test(d))throw new Error("native.pending_root_move.cleanup.manifest_hash is invalid");o={kind:c,state:l,manifestHash:d}}return{id:n,fromArtifactRoot:an(i),toArtifactRoot:an(r),stage:s,...o?{cleanup:o}:{}}}function ag(t,e={}){let n=cn(t,"native"),i=n.artifact_root??(e.allowMissingArtifactRoot?"docs":void 0);if(typeof i!="string")throw new Error("native.artifact_root must be a string");let r=n.clarification_mode??"sequential";if(r!=="sequential"&&r!=="batch")throw new Error("native.clarification_mode must be sequential or batch");let s=n.archive_confirmation??"automatic";if(s!=="automatic"&&s!=="required")throw new Error("native.archive_confirmation must be automatic or required");let o=n.max_verify_failures??Al;if(!Number.isSafeInteger(o)||o<1)throw new Error("native.max_verify_failures must be a positive integer");let a=og(n.pending_root_move);return{artifact_root:an(i),language:Tl(n.language,"en","native.language"),clarification_mode:r,archive_confirmation:s,max_verify_failures:o,snapshot:sg(n.snapshot),...a?{pending_root_move:a}:{}}}function cg(t){let e=cn(t,"classic"),n=e.context_compression??"off";if(n!=="off"&&n!=="beta")throw new Error("classic.context_compression must be off or beta");let i=e.review_mode??"standard";if(i!=="off"&&i!=="standard"&&i!=="thorough")throw new Error("classic.review_mode must be off, standard, or thorough");let r=e.auto_transition??!0;if(typeof r!="boolean")throw new Error("classic.auto_transition must be true or false");return{artifact_layout:jl(e.artifact_layout),language:Tl(e.language,"zh-CN","classic.language"),context_compression:n,review_mode:i,auto_transition:r}}function lg(t){let e=t??!0;if(typeof e!="boolean")throw new Error("ambient_resume must be true or false");return e}function ug(t,e,n,i,r){let s=t.schema!==void 0;if(!(s||t.default_workflow!==void 0||t.workflows!==void 0||!r.allowPartialProject&&t.native!==void 0)||r.allowPartialProject&&!s)return null;if(t.schema!=="comet.project.v1")throw new Error("Unsupported Comet project schema");if(t.default_workflow!=="native"&&t.default_workflow!=="classic")throw new Error("default_workflow must be native or classic");let a=t.workflows??[t.default_workflow];if(!Array.isArray(a)||a.length===0||a.some(l=>l!=="native"&&l!=="classic"))throw new Error("workflows must contain native and/or classic");let c=[...new Set(a)];if(!c.includes(t.default_workflow))throw new Error("workflows must include default_workflow");if(c.includes("native")&&!e)throw new Error("native must be a mapping");return{schema:"comet.project.v1",default_workflow:t.default_workflow,workflows:c,ambient_resume:i,...e?{native:e}:{},...n?{classic:n}:{}}}function Le(t,e={}){let n=(0,io.parseDocument)(t,{uniqueKeys:!0});if(n.errors.length>0)throw new Error(`Invalid .comet/config.yaml: ${n.errors[0].message}`);let i=n.toJS();if(i==null)return{value:{},config:null,ambient_resume:!0};if(typeof i!="object"||Array.isArray(i))throw new Error("Invalid .comet/config.yaml: root must be a mapping");let r=i,s=lg(r.ambient_resume),o=r.native===void 0?void 0:ag(r.native,{allowMissingArtifactRoot:e.allowMissingNativeFields}),a=r.classic===void 0?void 0:cg(r.classic),c=ug(r,o,a,s,{allowPartialProject:e.allowPartialProject??!1});return{value:r,config:c,ambient_resume:s,...o?{native:o}:{},...a?{classic:a}:{}}}function ro(t="docs",e="en"){return{schema:"comet.project.v1",default_workflow:"native",ambient_resume:!0,native:{artifact_root:an(t),language:e,clarification_mode:"sequential",archive_confirmation:"automatic",max_verify_failures:Al,snapshot:{...se,include:[...se.include],exclude:[...se.exclude]}}}}var io,Ct,to,no,Al,ig,se,ve=G(()=>{"use strict";io=Je(Ie(),1),Ct=64*1024,to=1024,no=64,Al=5,ig=[".agents/skills/**",".amazonq/skills/**",".augment/skills/**",".bob/skills/**",".claude/skills/**",".cline/skills/**",".codebuddy/skills/**",".continue/skills/**",".cospec/skills/**",".crush/skills/**",".cursor/skills/**",".factory/skills/**",".forge/skills/**",".gemini/skills/**",".github/skills/**",".iflow/skills/**",".junie/skills/**",".kilocode/skills/**",".kimi-code/skills/**",".kiro/skills/**",".lingma/skills/**",".mimocode/skills/**",".opencode/skills/**",".pi/skills/**",".qoder/skills/**",".qwen/skills/**",".roo/skills/**",".trae-cn/skills/**",".trae/skills/**",".windsurf/skills/**",".zcode/skills/**"],se={include:["**/*"],exclude:[...ig],max_files:1e4,max_total_bytes:256*1024*1024,max_duration_ms:6e4}});import{constants as Di,promises as nt}from"fs";function so(t){return"birthtimeNs"in t&&typeof t.birthtimeNs=="bigint"?t.birthtimeNs:t.birthtimeMs}function $l(t){return"ctimeNs"in t&&typeof t.ctimeNs=="bigint"?t.ctimeNs:t.ctimeMs}function ln(t){return{dev:t.dev,ino:t.ino,birthtime:so(t)}}function Fi(t,e){let n=ln(t),i=ln(e);return ji(n,i)?ye(n,i):ye(n,i)&&so(t)===so(e)&&$l(t)===$l(e)&&t.size===e.size}async function ql(t,e,n={}){if(!Number.isSafeInteger(e)||e<1)throw new Error("race-safe read byte limit must be a positive integer");let i=n.label??"file",r=n.bigint===!0,s=await nt.lstat(t,{bigint:r});if(!s.isFile()||s.isSymbolicLink())throw new De("not-regular-file",`${i} must be a regular file`);if(BigInt(s.size)>BigInt(e))throw new De("too-large",`${i} exceeds ${e} bytes`);let o=await nt.realpath(t);await n.verify?.("pre-open",{realPath:o,identity:ln(s)});let a=process.platform==="win32"?Di.O_RDONLY:Di.O_RDONLY|Di.O_NOFOLLOW|Di.O_NONBLOCK,c;try{c=await nt.open(t,a)}catch(l){throw l.code==="ELOOP"?new De("not-regular-file",`${i} must be a regular file`,{cause:l}):l}try{let[l,d,u]=await Promise.all([c.stat({bigint:r}),nt.lstat(t,{bigint:r}),nt.realpath(t)]);if(!l.isFile()||!d.isFile()||d.isSymbolicLink()||u!==o||!Fi(s,l)||!Fi(s,d))throw new De("changed",`${i} changed while opening`);await n.verify?.("post-open",{realPath:u,identity:ln(l)}),await n.hooks?.afterOpen?.();let f=[],h=0,w=Buffer.allocUnsafe(Math.min(64*1024,e+1));for(;;){let y=e+1-h,{bytesRead:k}=await c.read(w,0,Math.min(w.length,y),null);if(k===0)break;if(h+=k,h>e)throw new De("too-large",`${i} exceeds ${e} bytes`);f.push(Buffer.from(w.subarray(0,k)))}await n.hooks?.beforeFinalCheck?.();let[p,m,g]=await Promise.all([c.stat({bigint:r}),nt.lstat(t,{bigint:r}),nt.realpath(t)]);if(!m.isFile()||m.isSymbolicLink()||g!==o||!Fi(s,p)||!Fi(s,m))throw new De("changed",`${i} changed while reading`);return await n.verify?.("post-read",{realPath:g,identity:ln(p)}),{bytes:Buffer.concat(f,h),stat:p,realPath:g}}finally{await c.close()}}var De,Ll=G(()=>{"use strict";Ti();De=class extends Error{reason;constructor(e,n,i){super(n,i),this.name="RaceSafeReadError",this.reason=e}}});import{promises as Mi}from"fs";import Fe from"path";function fg(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}function oo(t,e){let n=Fe.relative(t,e);return n===""||!Fe.isAbsolute(n)&&n!==".."&&!n.startsWith(`..${Fe.sep}`)}async function Dl(t,e){let n=Fe.resolve(t),i=await Mi.lstat(n);if(!i.isDirectory()||i.isSymbolicLink())throw new Error(`${e} project root must be a real directory`);return Mi.realpath(n)}async function Fl(t,e,n,i){let r=t;for(let s=0;s<n.length;s++){r=Fe.join(r,n[s]);let o;try{o=await Mi.lstat(r)}catch(d){if(fg(d))return{exists:!1,kind:"missing"};throw d}let a=Fe.relative(t,r).replaceAll("\\","/");if(o.isSymbolicLink())throw new Error(`${i.label} crosses a symbolic link or junction at ${a}`);let c=s===n.length-1;if(!c&&!o.isDirectory())throw new Error(`${i.label} ancestor ${a} must be a real directory`);if(c&&(i.expected==="file"&&!o.isFile()||i.expected==="directory"&&!o.isDirectory()||i.expected==="any"&&!o.isFile()&&!o.isDirectory()))throw new Error(`${i.label} must be a real ${i.expected}`);let l=await Mi.realpath(r);if(!oo(e,l))throw new Error(`${i.label} resolves outside the project root`);if(c)return{exists:!0,kind:o.isFile()?"file":o.isDirectory()?"directory":"missing"}}return{exists:!0,kind:"directory"}}async function D(t,e,n){let i=tt(e,n.label),r=Fe.resolve(t),s=await Dl(r,n.label),o=i.split("/"),a=Fe.resolve(r,...o);if(!oo(r,a))throw new Error(`${n.label} must stay inside the project root`);let c=await Fl(r,s,o,n);return{projectRoot:r,target:a,relative:i,exists:c.exists,kind:c.kind}}async function Wi(t,e,n){return(await D(t,e,{...n,expected:"file"})).exists}async function J(t,e,n,i){let r=await D(t,e,{label:i.label,expected:"file"});if(!r.exists){let o=new Error(`${i.label} does not exist`);throw o.code="ENOENT",o}let s=await Dl(r.projectRoot,i.label);return ql(r.target,n,{...i,verify:async(o,a)=>{if(!oo(s,a.realPath))throw new Error(`${i.label} resolves outside the project root`);await Fl(r.projectRoot,s,r.relative.split("/"),{label:i.label,expected:"file"})}})}var le=G(()=>{"use strict";Ll();ve()});function dg(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}function pg(t){let e=(0,Wl.parseDocument)(t,{uniqueKeys:!0});if(e.errors.length>0)throw new Error(`Invalid global Comet config: ${e.errors[0].message}`);let n=e.toJS();if(n==null)return{};if(typeof n!="object"||Array.isArray(n))throw new Error("Invalid global Comet config: root must be a mapping");return n}function Kl(t){if(t.native?.pending_root_move)throw new Error("Global Comet config cannot contain native.pending_root_move");let e=t.native?(({pending_root_move:n,...i})=>i)(t.native):void 0;return{...t,schema:"comet.global.v1",...e?{native:e}:{}}}function mg(t){let e=Le(JSON.stringify({...t,schema:"comet.project.v1"})).config;if(!e)throw new Error("Invalid global Comet config: workflow template is incomplete");return Kl(e)}function hg(t){let e=Le(t,{allowPartialProject:!0,allowMissingNativeFields:!0});if(!e.native&&!e.classic)return null;let n=e.native?"native":"classic",i=e.native?.language??e.classic?.language??"en",r=ro(e.native?.artifact_root??"docs",i);return{schema:"comet.global.v1",default_workflow:n,workflows:[n],ambient_resume:e.ambient_resume,...e.native?{native:{...r.native,...e.native}}:{},...e.classic?{classic:e.classic}:{}}}function Yl(t){let e=pg(t);if(Object.keys(e).length===0)return null;if(e.schema===void 0)return hg(t);if(e.schema!=="comet.global.v1")throw new Error("Unsupported Comet global schema");return mg(e)}async function co(t){try{let e=await J(t,Bl,Ct,{label:"global Comet config"});return Yl(e.bytes.toString("utf8"))}catch(e){if(dg(e))return null;throw e}}var Wl,Bl,lo=G(()=>{"use strict";Wl=Je(Ie(),1);et();ve();le();Bl=".comet/config.yaml"});import{createHash as gg}from"crypto";function wg(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}async function Me(t,e={}){return(await Bi(t,e)).document}async function yg(t){try{return(await J(t,un,Ct,{label:un})).bytes}catch(e){if(wg(e))return null;throw e}}function vg(t){return t?{exists:!0,sha256:gg("sha256").update(t).digest("hex")}:{exists:!1,sha256:null}}async function Bi(t,e={}){let n=await yg(t);return{document:n?Le(n.toString("utf8"),e):null,identity:vg(n)}}var un,it=G(()=>{"use strict";ve();le();un=".comet/config.yaml"});var Nk,uo=G(()=>{"use strict";et();it();le();Nk=16*1024});var fo=G(()=>{"use strict";et();ve();it();le();uo()});var Vl=G(()=>{"use strict";Ai();et();Rl();Nl();ve();lo();le();it();fo();uo();Zs()});import{TextDecoder as xg}from"util";function Jl(t){return{dev:t.dev,ino:t.ino,birthtime:t.birthtimeMs}}function _g(t,e){try{return new xg("utf-8",{fatal:!0}).decode(t.bytes)}catch(n){throw new Error(`${e} is not valid UTF-8`,{cause:n})}}async function po(t,e,n,i,r={}){try{let s=await J(t,e,n,{label:i,hooks:r.hooks});return{result:s,text:_g(s,i)}}catch(s){let o=s.code;if(o==="ENOENT"||o==="ENOTDIR")return null;throw s}}async function fn(t,e,n,i,r={}){return(await po(t,e,n,i,r))?.text??null}async function rt(t,e,n,i,r,s={}){if(Buffer.byteLength(n,"utf8")>i)throw new Error(`${r} exceeds ${i} bytes`);let o=await po(t,e,i,r),a=await D(t,e,{label:r,expected:"file"});await me(a.target,n,{containedRoot:a.projectRoot,beforeCommit:async()=>{await s.beforeCommit?.();let c=await po(t,e,i,r);if(!(!o&&!c)){if(!o||!c)throw new Error(`${r} changed before commit`);if(o.result.realPath!==c.result.realPath||!ye(Jl(o.result.stat),Jl(c.result.stat))||o.text!==c.text)throw new Error(`${r} changed before commit`)}}})}async function Ki(t,e,n,i,r,s={}){let o=await fn(t,e,i,r);await rt(t,e,`${o??""}${n}`,i,r,s)}async function mo(t,e,n,i={}){let r=await D(t,e,{label:n,expected:"file"});return r.exists?Xs(r.target,{containedRoot:r.projectRoot,beforeRemove:i.beforeRemove}):!1}var Yi=G(()=>{"use strict";Vl();Ti()});var cu={};wf(cu,{RUN_STATE_FILE:()=>er,applyRunStateToDocument:()=>yo,readRunState:()=>vo,removeRunState:()=>bo,runStateFromDocument:()=>Zi,writeRunState:()=>tr});import Zg from"path";function En(t,e){let n=t[e];if(typeof n!="string"||n.length===0)throw new Error(`Invalid Run state: ${e} must be a non-empty string`);return n}function Cn(t,e){let n=En(t,e);if(Zg.isAbsolute(n)||/^(?:[A-Za-z]:|[\\/]|~)/u.test(n)||n.split(/[\\/]/u).includes(".."))throw new Error(`Invalid Run state: ${e} must stay inside the change directory`);return n}function ew(t){let e=t.run_retries??"{}",n;try{n=typeof e=="string"?JSON.parse(e):e}catch(i){throw new Error("Invalid Run state: run_retries must be a JSON object",{cause:i})}if(!n||typeof n!="object"||Array.isArray(n))throw new Error("Invalid Run state: run_retries must be a JSON object");for(let i of Object.values(n))if(!Number.isInteger(i)||Number(i)<0)throw new Error("Invalid Run state: retry counts must be non-negative integers");return n}function Zi(t){if(!t.run_id)return null;let e=En(t,"run_id"),n=En(t,"skill"),i=En(t,"skill_version"),r=En(t,"skill_hash"),s=Cn(t,"pending_ref"),o=Cn(t,"trajectory_ref"),a=Cn(t,"context_ref"),c=Cn(t,"artifacts_ref"),l=Cn(t,"checkpoint_ref"),d=Number(t.iteration);if(!Number.isInteger(d)||d<0)throw new Error("Invalid Run state: iteration must be a non-negative integer");if(t.orchestration!=="deterministic"&&t.orchestration!=="adaptive")throw new Error("Invalid Run state: orchestration must be deterministic or adaptive");if(t.run_status!=="running"&&t.run_status!=="waiting"&&t.run_status!=="completed"&&t.run_status!=="failed")throw new Error("Invalid Run state: run_status is invalid");return{runId:e,skill:n,skillVersion:i,skillHash:r,orchestration:t.orchestration,currentStep:ou(t,"current_step"),iteration:d,pending:ou(t,"pending"),pendingRef:s,trajectoryRef:o,contextRef:a,artifactsRef:c,checkpointRef:l,status:t.run_status,retries:ew(t)}}function yo(t,e){e?t.run_id=e.runId:delete t.run_id}function tw(t){return{runId:t.runId,skill:t.skill,skillVersion:t.skillVersion,skillHash:t.skillHash,orchestration:t.orchestration,currentStep:t.currentStep,iteration:t.iteration,pending:t.pending,pendingRef:t.pendingRef,trajectoryRef:t.trajectoryRef,contextRef:t.contextRef,artifactsRef:t.artifactsRef,checkpointRef:t.checkpointRef,status:t.status,retries:t.retries}}function nw(t){let e={run_id:t.runId,skill:t.skill,skill_version:t.skillVersion,skill_hash:t.skillHash,orchestration:t.orchestration,current_step:t.currentStep,iteration:t.iteration,pending:t.pending,pending_ref:t.pendingRef,trajectory_ref:t.trajectoryRef,context_ref:t.contextRef,artifacts_ref:t.artifactsRef,checkpoint_ref:t.checkpointRef,run_status:t.status,run_retries:JSON.stringify(t.retries)};return Zi(e)}async function vo(t,e={}){let n=await fn(t,er,au,"Run state",e);if(n===null)return null;let i=JSON.parse(n);return nw(i)}async function tr(t,e,n={}){await rt(t,er,JSON.stringify(tw(e),null,2),au,"Run state",n)}async function bo(t,e={}){await mo(t,er,"Run state",e)}var ou,er,au,nr=G(()=>{"use strict";Yi();ou=(t,e)=>{let n=t[e];return n==null?null:String(n)};er=".comet/run-state.json",au=256*1024});var of=Je(Ie(),1);import{spawnSync as $y}from"child_process";import{createHash as sf}from"crypto";import{promises as qy}from"fs";import T from"path";import Ji from"path";Yi();import Ui from"path";var dn={trajectory:8*1024*1024,artifacts:1024*1024,context:1024*1024,pendingAction:256*1024,checkpoint:256*1024};function pn(t,e){if(Ui.isAbsolute(e))throw new Error("Run path must stay inside the change directory");let n=Ui.resolve(t),i=Ui.resolve(n,e);if(i!==n&&!i.startsWith(n+Ui.sep))throw new Error("Run path must stay inside the change directory")}async function mn(t,e,n,i={}){pn(t,e),await Ki(t,e,`${JSON.stringify(n)}
143
- `,dn.trajectory,"Run trajectory",i)}async function Vi(t,e,n={}){pn(t,e);let i=await fn(t,e,dn.trajectory,"Run trajectory",n);return i===null?[]:i.split(/\r?\n/).map((r,s)=>({line:r,number:s+1})).filter(({line:r})=>r.length>0).map(({line:r,number:s})=>{try{return JSON.parse(r)}catch(o){throw new Error(`Invalid Trajectory event at line ${s}`,{cause:o})}})}async function Hl(t,e,n,i={}){pn(t,e),await rt(t,e,JSON.stringify(n,null,2)+`
144
- `,dn.artifacts,"Run artifacts",i)}async function Gl(t,e,n,i={}){pn(t,e),await rt(t,e,n,dn.context,"Run context",i)}async function zl(t,e,n,i={}){pn(t,e),await rt(t,e,JSON.stringify(n,null,2)+`
145
- `,dn.checkpoint,"Run checkpoint",i)}function Pg(t){if(t!=="build"&&t!=="verify")throw new Error(`Invalid command check scope: '${String(t)}'`)}function Rg(t,e="."){if(e.trim().length===0)throw new Error("Command check cwd cannot be blank");let n=Ji.resolve(t),i=Ji.resolve(n,e);if(i!==n&&!i.startsWith(n+Ji.sep))throw new Error(`Command check cwd must resolve within the project root: '${e}'`);return Ji.relative(n,i).replaceAll("\\","/")||"."}function Ng(t,e){if(e.type!=="command_check_recorded")return null;let n=e.data;if(typeof n!="object"||n===null||Array.isArray(n))return null;let{scope:i,command:r,exitCode:s,cwd:o}=n;if(i!=="build"&&i!=="verify"||typeof r!="string"||r.trim().length===0||!Number.isInteger(s)||typeof o!="string")return null;let a;try{a=Rg(t,o)}catch{return null}return{sequence:e.sequence,timestamp:e.timestamp,runId:e.runId,scope:i,command:r,exitCode:s,cwd:a}}async function Ql(t,e,n,i){Pg(i);let r=await Vi(e,n.trajectoryRef);for(let s=r.length-1;s>=0;s-=1){let o=r[s];if(o.runId!==n.runId)continue;let a=Ng(t,o);if(a?.scope===i)return a}return null}import{promises as Kg}from"fs";import be from"path";import{promises as Zl}from"fs";import $ from"path";import{promises as Og}from"fs";async function hn(t){try{return await Og.access(t),!0}catch(e){if(Ag(e))return!1;throw e}}function Ag(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}ve();it();fo();le();var gn=class extends Error{code="classic-layout-unavailable";constructor(e="Classic artifact layout is unavailable from .comet/config.yaml"){super(e),this.name="ClassicLayoutUnavailableError"}},Xl=".comet/config.yaml";function eu(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}async function tu(t){await D(t,Xl,{label:Xl,expected:"file"})}function Hi(t,e){let n=$.resolve(t),i=e==="docs"?$.join(n,"docs"):n,r=$.join(i,"openspec"),s=$.join(n,"docs","superpowers");return{projectRoot:n,artifactLayout:e,openSpecBase:i,openSpecRoot:r,changesDir:$.join(r,"changes"),archiveDir:$.join(r,"changes","archive"),specsDir:$.join(r,"specs"),superpowersRoot:s,superpowersSpecsDir:$.join(s,"specs"),superpowersPlansDir:$.join(s,"plans"),superpowersReportsDir:$.join(s,"reports")}}async function jg(t){await tu(t);let e=await Me(t,{allowPartialProject:!0,allowMissingNativeFields:!0});if(!e?.config)throw new gn;if(!(e.config.workflows??[e.config.default_workflow]).includes("classic"))throw new gn("Classic artifact layout is unavailable because Classic is not enabled");return e.classic?.artifact_layout??"legacy"}async function Tg(t,e){return Hi(t,e??await jg(t))}async function Ig(t){try{return await Zl.lstat(t),!0}catch(e){if(eu(e))return!1;throw e}}async function $g(t,e){let n=await Tg(t,e),i=n.artifactLayout==="legacy"?"docs":"legacy",r=Hi(t,i).openSpecRoot,[s,o]=await Promise.all([D(n.projectRoot,z(n.projectRoot,n.openSpecRoot),{label:"Configured Classic OpenSpec root",expected:"directory"}),Ig(r)]),a=s.exists;return{paths:n,configuredRootExists:a,alternateRoot:r,alternateRootExists:o,dualRoots:a&&o}}async function qg(t){let e=[t.openSpecRoot,t.changesDir,t.archiveDir,t.specsDir,t.superpowersRoot,t.superpowersSpecsDir,t.superpowersPlansDir,t.superpowersReportsDir];for(let n of e){let i=z(t.projectRoot,n);await D(t.projectRoot,i,{label:`Classic managed physical path ${i}`,expected:"directory"})}}async function We(t,e){let n=await $g(t,e);if(await qg(n.paths),!n.configuredRootExists){let i=z(n.paths.projectRoot,n.paths.openSpecRoot),r=z(n.paths.projectRoot,n.alternateRoot);throw new gn(`Configured Classic OpenSpec root is missing: ${i} (alternate ${r} is ${n.alternateRootExists?"present":"missing"})`)}return n.paths}async function ho(t,e){let n=$.join($.resolve(t),".comet","classic-root-move.json");if(await hn(n))throw new Error("Classic root move transaction is incomplete; inspect it with comet doctor and recover it explicitly before writing");let i=await We(t,e);if(!await hn(i.openSpecRoot))throw new Error(`Configured Classic OpenSpec root is missing: ${z(i.projectRoot,i.openSpecRoot)}`);return i}async function st(t){let e=$.resolve(t),n=null;try{(await Zl.lstat(e)).isDirectory()||(e=$.dirname(e))}catch(i){if(!eu(i))throw i}for(;;){$.basename(e)==="openspec"&&(n=$.dirname(e));let i=$.join(e,".comet","config.yaml"),r=!1;if(await hn(i))try{await tu(e);let o=(await Me(e))?.value;r=!!o&&typeof o=="object"&&!Array.isArray(o)&&(o.schema==="comet.project.v1"||o.default_workflow!==void 0||o.native!==void 0)}catch{}if(r||await hn($.join(e,".git")))return e;let s=$.dirname(e);if(s===e)return n??$.resolve(t);e=s}}function z(t,e){return $.relative($.resolve(t),e).replaceAll("\\","/")}le();ve();import bn from"path";import{promises as Dg}from"fs";import zi from"path";et();ve();le();import wn from"path";var Lg=2*1024*1024;function nu(t,e,n){let i=wn.resolve(t),r=wn.isAbsolute(e)?wn.resolve(e):wn.resolve(i,e),s=wn.relative(i,r).replaceAll("\\","/");return{root:i,relative:tt(s,n),target:r}}async function Be(t,e,n){let i=nu(t,e,n.label);return D(i.root,i.relative,n)}async function yn(t,e,n){return(await Be(t,e,{label:n.label,expected:n.expected??"any"})).exists}async function iu(t,e,n,i){return await yn(t,e,{label:n,expected:"file"})?(await Gi(t,e,{label:n,hooks:i})).byteLength>0:!1}async function te(t,e,n){return(await Gi(t,e,n)).toString("utf8")}async function Gi(t,e,n){let i=nu(t,e,n.label);return(await J(i.root,i.relative,n.maxBytes??Lg,{label:n.label,hooks:n.hooks})).bytes}function vn(t){return t?/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u.test(t)?t.includes("..")?"Change name cannot contain '..' (path traversal not allowed)":null:`Invalid change name: '${t}'
146
- Valid format: lowercase kebab-case (a-z, 0-9, single hyphens)`:"Change name cannot be empty"}function wo(t){let e=vn(t);if(e)throw new Error(e)}function Fg(t,e){return{label:z(t,e),directory:e}}async function go(t,e,n){let i=Fg(t,e);if(!(await Be(t,e,{label:n,expected:"directory"})).exists)return{change:i,exists:!1,stateExists:!1};let s=await Be(t,zi.join(e,".comet.yaml"),{label:`${n} state`,expected:"file"});return{change:i,exists:!0,stateExists:s.exists}}function Mg(t,e){let n=e.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&");return new RegExp(`^\\d{4}-\\d{2}-\\d{2}-${n}$`,"u").test(t)}async function Wg(t,e,n,i={}){if(!i.skipExactCompatibility){let o=await go(t,zi.join(e,n),`Classic archived change ${n}`);if(o.exists)return o.change}if(!(await Be(t,e,{label:"Classic archive directory",expected:"directory"})).exists)return null;let s=[];for(let o of await Dg.readdir(e,{withFileTypes:!0})){if(!Mg(o.name,n))continue;let a=await go(t,zi.join(e,o.name),`Classic archived change ${o.name}`);a.exists&&a.stateExists&&s.push(a.change)}return s.sort((o,a)=>a.directory.localeCompare(o.directory))[0]??null}async function Qi(t,e=process.cwd()){wo(t);let n=await We(e),i=await go(n.projectRoot,zi.join(n.changesDir,t),`Classic active change ${t}`);if(i.exists)return i.change;let r=await Wg(n.projectRoot,n.archiveDir,t);return r||i.change}function Bg(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}async function ru(t,e,n,i){let r=tt(n,"Classic handoff artifact pointer");if((await D(t,r,{label:"Classic handoff artifact",expected:"file"})).exists)return null;let o=await We(t),a=`${z(t,o.changesDir)}/`,l=(o.artifactLayout==="docs"?[a,"openspec/changes/"]:[a]).find(y=>r.startsWith(y));if(!l)return null;let d=r.slice(l.length).split("/");if(d.length<4||d[1]!==".comet"||d.slice(2).some(y=>y.length===0))return null;let u=d[0];wo(u);let f=d.slice(2),h=bn.resolve(e);if(bn.dirname(h)!==bn.resolve(o.archiveDir))return null;let w=bn.basename(h),p=/^\d{4}-\d{2}-\d{2}-(.+)$/u.exec(w);if(w!==u&&p?.[1]!==u)return null;await D(t,z(t,h),{label:"Classic archived change directory",expected:"directory"});let m=bn.join(h,".comet",...f),g=z(t,m);try{return await J(t,g,i,{label:"Historical Classic archived handoff artifact"}),g}catch(y){if(Bg(y))return null;throw y}}le();var su=2*1024*1024;function kn(t,e){return be.relative(t,e).split(be.sep).join("/")}async function Sn(t,e,n,i,r){if(!n)return{code:e,satisfied:!1};let s=n.replaceAll("\\","/");if(r)return{code:e,satisfied:!1,source:s,detail:`Classic layout is unsafe or unavailable: ${r instanceof Error?r.message:String(r)}`};try{if(i){let a=i.artifactLayout==="legacy"?"docs":"legacy",c=z(t,Hi(t,a).openSpecRoot);if((s===c||s.startsWith(`${c}/`))&&(await D(t,s,{label:`${e} artifact`,expected:"file"})).exists)return{code:e,satisfied:!1,source:s,detail:"standalone OpenSpec root is not a Comet artifact root"}}let o=await Wi(t,s,{label:`${e} artifact`});return{code:e,satisfied:o,source:s,...o?{resolvedSource:s}:{}}}catch(o){return{code:e,satisfied:!1,source:s,detail:`unsafe artifact pointer outside the project or through a special path: ${o instanceof Error?o.message:String(o)}`}}}async function Yg(t,e,n,i){try{i??=await We(t)}catch(s){return{code:"design.handoff",satisfied:!1,...n?{source:n.replaceAll("\\","/")}:{},detail:`Classic layout is unsafe or unavailable for handoff evidence: ${s instanceof Error?s.message:String(s)}`}}let r=await Sn(t,"design.handoff",n,i);if(!n||r.satisfied||r.detail)return r;try{let s=await ru(t,e,n,su);return s?{...r,satisfied:!0,resolvedSource:s,detail:`resolved historical legacy pointer from archived change: ${s}`}:r}catch(s){return{...r,satisfied:!1,detail:`unsafe archived handoff fallback: ${s instanceof Error?s.message:String(s)}`}}}async function Xi(t,e,n){return Sn(t,e,kn(t,n))}async function Ug(t,e){let n=be.join(e,"specs"),i;try{let o=kn(t,n);if(!(await D(t,o,{label:"OpenSpec delta-spec directory",expected:"directory"})).exists)return{code:"openspec.delta-spec",satisfied:!1};i=await Kg.readdir(n)}catch(o){return o.code==="ENOENT"?{code:"openspec.delta-spec",satisfied:!1}:{code:"openspec.delta-spec",satisfied:!1,detail:`unsafe delta-spec path: ${o instanceof Error?o.message:String(o)}`}}let r=i.map(o=>be.join(n,o,"spec.md")),s=(await Promise.all(r.map(async o=>{try{return await Wi(t,kn(t,o),{label:"OpenSpec delta spec"})?o:null}catch{return null}}))).filter(o=>o!==null);return{code:"openspec.delta-spec",satisfied:s.length>0,source:s[0]?kn(t,s[0]):void 0,detail:`${s.length} delta spec${s.length===1?"":"s"}`}}async function Vg(t,e){let n,i=kn(t,e);try{n=(await J(t,i,su,{label:"Classic tasks artifact"})).bytes.toString("utf8")}catch(o){return o.code==="ENOENT"?{code:"build.tasks-complete",satisfied:!1}:{code:"build.tasks-complete",satisfied:!1,source:i,detail:`unsafe tasks artifact: ${o instanceof Error?o.message:String(o)}`}}let r=[...n.matchAll(/^\s*[-*]\s+\[([ xX])\]\s+/gmu)],s=r.filter(o=>o[1].toLowerCase()==="x").length;return{code:"build.tasks-complete",satisfied:r.length>0&&s===r.length,source:i,detail:`${s} of ${r.length} tasks complete`}}function ot(t,e){return t.some(n=>n.code===e&&n.satisfied)}async function Ke(t,e){let n=await st(t),i=e.classic,r=be.join(t,"proposal.md"),s=be.join(t,"design.md"),o=be.join(t,"tasks.md"),a=e.run?be.resolve(t,e.run.checkpointRef):be.join(t,".comet","checkpoint.json"),c,l;try{c=await We(n)}catch(f){l=f}let d=await Promise.all([Xi(n,"openspec.proposal",r),Xi(n,"openspec.design",s),Xi(n,"openspec.tasks",o),Ug(n,t),Sn(n,"design.document",i?.designDoc??null,c,l),Sn(n,"build.plan",i?.plan??null,c,l),Vg(n,o),Sn(n,"verification.report",i?.verificationReport??null,c,l),Yg(n,t,i?.handoffContext??null,c),Xi(n,"run.checkpoint",a)]),u=d.find(f=>f.code==="design.handoff");return u&&!i?.handoffHash&&(u.satisfied=!1,u.detail="handoff hash is missing"),d.push({code:"archive.confirmed",satisfied:i?.archiveConfirmation==="confirmed"}),d}import{promises as Lu}from"fs";import ie from"path";import{fileURLToPath as Du}from"url";import{createHash as Hw,randomUUID as Gw}from"crypto";import{promises as Ro}from"fs";import ke from"path";function Jg(t){return t.classicProfile??t.workflow}function Hg(t){return!t.buildMode||!t.tddMode||!t.isolation||!t.verifyMode?!1:t.buildMode==="subagent-driven-development"?t.subagentDispatch==="confirmed":t.buildMode==="direct"?t.directOverride===!0:!0}function Gg(t){return t.buildMode==="direct"&&t.tddMode==="direct"&&t.isolation!==null&&t.verifyMode==="light"}function zg(t,e,n){if(e.verifyResult==="fail")return t==="full"?"full.build.fix":`${t}.build.execute`;if(t==="full"){if(!ot(n,"build.plan"))return"full.build.plan";if(e.buildPause==="plan-ready")return"full.build.plan-ready";if(!Hg(e))return"full.build.configure"}else if(!Gg(e))throw new Error(`${t} build configuration is incomplete`);return ot(n,"build.tasks-complete")?`${t}.build.complete`:`${t}.build.execute`}function Qg(t,e,n){return e.verifyResult!=="pass"||!ot(n,"verification.report")?`${t}.verify.run`:`${t}.verify.branch`}function Xg(t,e){if(e.verifyResult!=="pass")throw new Error("archive requires verify_result=pass");return e.archiveConfirmation==="confirmed"?`${t}.archive.execute`:`${t}.archive.confirm`}function Et(t,e){let n=Jg(t);if(t.archived&&t.phase!=="archive")throw new Error("archived=true requires phase=archive");if(t.archived)return"completed";if(n!=="full"&&t.phase==="design")throw new Error(`${n} workflow cannot enter design`);switch(t.phase){case"open":return`${n}.open`;case"design":return ot(e,"design.handoff")?"full.design.document":"full.design.handoff";case"build":return zg(n,t,e);case"verify":return Qg(n,t,e);case"archive":return Xg(n,t)}}var sr=Je(Ie(),1);et();le();import rr from"path";nr();var lu=["full","hotfix","tweak"],at=1,iw=["open","design","build","verify","archive"],rw=["en","zh-CN"],sw=["off","beta"],ow=["subagent-driven-development","executing-plans","direct"],aw=["plan-ready"],cw=["confirmed"],lw=["tdd","direct"],uw=["off","standard","thorough"],fw=["current","branch","worktree"],dw=["light","full"],pw=["pending","pass","fail"],mw=["pending","handled"],hw=["pending","confirmed"],_t=["workflow","language","phase","context_compression","build_mode","build_pause","subagent_dispatch","tdd_mode","review_mode","isolation","bound_branch","verify_mode","auto_transition","base_ref","design_doc","plan","verify_result","verify_failures","verification_report","branch_status","created_at","verified_at","archive_confirmation","archived","direct_override","handoff_context","handoff_hash","classic_profile","classic_migration"],So=["run_id"],gw=new Set([..._t,...So]),ww=["workflow","phase","design_doc","plan","build_mode","isolation","verify_mode","verify_result","verified_at","archived"];function uu(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function xt(t,e){let n=t[e];if(n==null||n==="")return null;if(typeof n!="string")throw new Error(`Invalid Classic state: ${e} must be a string or null`);return n}function Q(t,e,n,i=!0){let r=t[e];if(r==null||r===""){if(i)return null;throw new Error(`Invalid Classic state: ${e} is required`)}if(typeof r!="string"||!n.includes(r))throw new Error(`Invalid Classic state: ${e} must be one of ${n.join(", ")}${i?" or null":""}`);return r}function ko(t,e,n=!0){let i=t[e];if(i==null||i===""){if(n)return null;throw new Error(`Invalid Classic state: ${e} is required`)}if(typeof i!="boolean")throw new Error(`Invalid Classic state: ${e} must be true or false`);return i}function yw(t,e,n=0){let i=t[e];if(i==null||i==="")return n;if(typeof i!="number"||!Number.isInteger(i)||i<0)throw new Error(`Invalid Classic state: ${e} must be a non-negative integer`);return i}function ir(t,e){let n=xt(t,e);if(n===null)return null;if(/^(?:[A-Za-z]:|[\\/]|~)/u.test(n)||n.split(/[\\/]/u).includes(".."))throw new Error(`Invalid Classic state: ${e} must be a relative repository path`);return n}function vw(t,e){let n=xt(t,e);if(n!==null&&!/^[a-f0-9]{64}$/u.test(n))throw new Error(`Invalid Classic state: ${e} must be a sha256 hex digest`);return n}function bw(t){let e=t.classic_migration;if(e==null||e==="")return null;if(e!==at)throw new Error(`Invalid Classic state: classic_migration must be ${at}`);return e}function kw(t){if(!_t.some(n=>uu(t,n)))return null;for(let n of ww)if(!uu(t,n))return null;return{workflow:Q(t,"workflow",lu,!1),language:Q(t,"language",rw),phase:Q(t,"phase",iw,!1),contextCompression:Q(t,"context_compression",sw),buildMode:Q(t,"build_mode",ow),buildPause:Q(t,"build_pause",aw),subagentDispatch:Q(t,"subagent_dispatch",cw),tddMode:Q(t,"tdd_mode",lw),reviewMode:Q(t,"review_mode",uw),isolation:Q(t,"isolation",fw),boundBranch:xt(t,"bound_branch"),verifyMode:Q(t,"verify_mode",dw),autoTransition:ko(t,"auto_transition"),baseRef:xt(t,"base_ref"),designDoc:ir(t,"design_doc"),plan:ir(t,"plan"),verifyResult:Q(t,"verify_result",pw,!1),verifyFailures:yw(t,"verify_failures"),verificationReport:ir(t,"verification_report"),branchStatus:Q(t,"branch_status",mw),createdAt:xt(t,"created_at"),verifiedAt:xt(t,"verified_at"),archiveConfirmation:Q(t,"archive_confirmation",hw),archived:ko(t,"archived",!1),directOverride:ko(t,"direct_override"),handoffContext:ir(t,"handoff_context"),handoffHash:vw(t,"handoff_hash"),classicProfile:Q(t,"classic_profile",lu),classicMigration:bw(t)}}function Co(t,e){let n=e??null;if(n===null&&e===void 0&&t.run_id&&t.skill)try{n=Zi(t)}catch(i){let r=i instanceof Error?i.message:String(i);throw new Error(r.replace(/^Invalid Run state:/u,"Invalid Classic state:"),{cause:i})}return{classic:kw(t),run:n,unknownKeys:Object.keys(t).filter(i=>!gw.has(i))}}function fu(t){return{workflow:t.workflow,language:t.language,phase:t.phase,context_compression:t.contextCompression,build_mode:t.buildMode,build_pause:t.buildPause,subagent_dispatch:t.subagentDispatch,tdd_mode:t.tddMode,review_mode:t.reviewMode,isolation:t.isolation,bound_branch:t.boundBranch,verify_mode:t.verifyMode,auto_transition:t.autoTransition,base_ref:t.baseRef,design_doc:t.designDoc,plan:t.plan,verify_result:t.verifyResult,verify_failures:t.verifyFailures,verification_report:t.verificationReport,branch_status:t.branchStatus,created_at:t.createdAt,verified_at:t.verifiedAt,archive_confirmation:t.archiveConfirmation,archived:t.archived,direct_override:t.directOverride,handoff_context:t.handoffContext,handoff_hash:t.handoffHash,classic_profile:t.classicProfile,classic_migration:t.classicMigration}}nr();var Sw=2*1024*1024;function xn(t){let e=t.toJS();if(e===null)return{};if(typeof e!="object"||Array.isArray(e))throw new Error("Invalid Classic state document: root must be a mapping");return e}function du(t,e,n){t.get(e)!==n&&t.set(e,n)}function Cw(t,e){if(e.classic)for(let[n,i]of Object.entries(fu(e.classic)))du(t,n,i);else for(let n of _t)t.delete(n);yo(t.toJS(),e.run),e.run?du(t,"run_id",e.run.runId):t.delete("run_id")}function Ew(t){let e=["skill","skill_version","skill_hash","orchestration","current_step","iteration","pending","pending_ref","trajectory_ref","context_ref","artifacts_ref","checkpoint_ref","run_status","run_retries"];for(let n of e)t.delete(n)}function xw(t){let e=!1;for(let n of["build_command","verify_command"])t.has(n)&&(t.delete(n),e=!0);return e}async function pu(t){let e;try{e=(await J(rr.dirname(t),rr.basename(t),Sw,{label:"Classic state document"})).bytes.toString("utf8")}catch(i){if(i.code!=="ENOENT")throw i;return new sr.Document({})}let n=(0,sr.parseDocument)(e);if(n.errors.length>0)throw new Error(`Invalid Classic state document: ${n.errors[0].message}`);return xn(n),n}async function Ye(t,e={}){let n=e.migrate!==!1,i=rr.join(t,".comet.yaml"),r=await pu(i),s=xn(r),o=xw(r);o&&(s=xn(r));let a=await vo(t);if(!a&&s.run_id&&s.skill){let{runStateFromDocument:c}=await Promise.resolve().then(()=>(nr(),cu));a=c(s),a&&n&&(await tr(t,a),Ew(r),o=!0)}return o&&n&&await me(i,r.toString(),{containedRoot:t}),Co(xn(r),a)}async function or(t,e,n={}){let i=rr.join(t,".comet.yaml"),r=await pu(i);Cw(r,{...e,unknownKeys:e.unknownKeys??[]}),Co(xn(r),e.run??null),await me(i,r.toString(),{containedRoot:t,beforeCommit:n.beforeCommit}),e.run?await tr(t,e.run):await bo(t)}function mu(t,e,n){return{runId:e,skill:t.definition.metadata.name,skillVersion:t.definition.metadata.version,skillHash:n,orchestration:t.definition.orchestration.mode,currentStep:t.definition.orchestration.entry??null,iteration:0,pending:null,pendingRef:".comet/pending-action.json",trajectoryRef:".comet/trajectory.jsonl",contextRef:".comet/context.md",artifactsRef:".comet/artifacts.json",checkpointRef:".comet/checkpoint.json",status:"running",retries:{}}}import{createHash as Ru,randomUUID as Kw}from"crypto";import{promises as K}from"fs";import F from"path";var wu=Je(Ie(),1);import{promises as Eo}from"fs";import oe from"path";var _w=["invoke_skill","call_tool","handoff","ask_user","checkpoint"],Pw=["deterministic","adaptive"],Rw=["function","mcp","script","agent"],Nw=["none","read","write","external"],Ow=["progress","step","completion"],Aw=["artifact_exists","state_equals"];function ct(t,e,n){return new Error(`${t}: ${e} ${n}`)}function ne(t,e,n="document"){if(t===null||typeof t!="object"||Array.isArray(t))throw ct(e,n,"must be an object")}function Ue(t,e,n){if(!Array.isArray(t))throw ct(e,n,"must be an array")}function X(t,e,n){if(typeof t!="string")throw ct(e,n,"must be a string")}function ue(t,e,n,i){e in t&&X(t[e],n,`${i}.${e}`)}function yu(t,e,n,i){if(e in t&&typeof t[e]!="boolean")throw ct(n,`${i}.${e}`,"must be a boolean")}function Ve(t,e,n,i){if(typeof t!="string"||!e.includes(t))throw ct(n,i,`must be one of ${e.join(", ")}`)}function ar(t,e,n){Ue(t,e,n),t.forEach((i,r)=>{X(i,e,`${n}[${r}]`)})}function hu(t,e,n){ne(t,e,n),X(t.name,e,`${n}.name`),X(t.description,e,`${n}.description`),yu(t,"required",e,n)}function jw(t,e,n){ne(t,e,n),X(t.id,e,`${n}.id`),ue(t,"source",e,n),ue(t,"version",e,n)}function Tw(t,e,n){ne(t,e,n),X(t.id,e,`${n}.id`),X(t.role,e,`${n}.role`),ue(t,"instructions",e,n)}function Iw(t,e,n){ne(t,e,n),X(t.id,e,`${n}.id`),Ve(t.kind,Rw,e,`${n}.kind`),X(t.source,e,`${n}.source`),Ve(t.sideEffect,Nw,e,`${n}.sideEffect`),yu(t,"requiresConfirmation",e,n)}function $w(t,e,n){ne(t,e,n),Ve(t.type,_w,e,`${n}.type`),ue(t,"ref",e,n),ue(t,"prompt",e,n),ue(t,"question",e,n),"options"in t&&ar(t.options,e,`${n}.options`)}function qw(t,e,n){ne(t,e,n),X(t.id,e,`${n}.id`),$w(t.action,e,`${n}.action`),ue(t,"next",e,n),"completionEvals"in t&&ar(t.completionEvals,e,`${n}.completionEvals`)}function Lw(t,e){let n="goal";ne(t,e,n),X(t.statement,e,`${n}.statement`),Ue(t.inputs,e,`${n}.inputs`),t.inputs.forEach((i,r)=>{hu(i,e,`${n}.inputs[${r}]`)}),Ue(t.outputs,e,`${n}.outputs`),t.outputs.forEach((i,r)=>{hu(i,e,`${n}.outputs[${r}]`)}),ar(t.success,e,`${n}.success`)}function Dw(t,e){let n="orchestration";ne(t,e,n),Ve(t.mode,Pw,e,`${n}.mode`),ue(t,"entry",e,n),"steps"in t&&(Ue(t.steps,e,`${n}.steps`),t.steps.forEach((i,r)=>{qw(i,e,`${n}.steps[${r}]`)}))}function vu(t,e){return ne(t,e),Ve(t.apiVersion,["comet/v1alpha1"],e,"apiVersion"),Ve(t.kind,["Skill"],e,"kind"),ne(t.metadata,e,"metadata"),X(t.metadata.name,e,"metadata.name"),X(t.metadata.version,e,"metadata.version"),X(t.metadata.description,e,"metadata.description"),Lw(t.goal,e),Dw(t.orchestration,e),Ue(t.skills,e,"skills"),t.skills.forEach((n,i)=>{jw(n,e,`skills[${i}]`)}),Ue(t.agents,e,"agents"),t.agents.forEach((n,i)=>{Tw(n,e,`agents[${i}]`)}),Ue(t.tools,e,"tools"),t.tools.forEach((n,i)=>{Iw(n,e,`tools[${i}]`)}),t}function bu(t,e){ne(t,e);for(let n of["allowedSkills","allowedAgents","allowedTools","confirmationRequiredFor"])n in t&&ar(t[n],e,n);for(let n of["maxIterations","maxRetriesPerAction"])if(n in t&&(typeof t[n]!="number"||!Number.isFinite(t[n])))throw ct(e,n,"must be a finite number");return t}function Fw(t,e){return ne(t,e),"runtime"in t&&ku(t.runtime,e,"runtime"),t}function ku(t,e,n){return Ue(t,e,n),t.forEach((i,r)=>{let s=`${n}[${r}]`;ne(i,e,s),X(i.id,e,`${s}.id`),Ve(i.scope,Ow,e,`${s}.scope`),Ve(i.type,Aw,e,`${s}.type`),ue(i,"artifact",e,s),ue(i,"field",e,s),ue(i,"equals",e,s)}),t}async function xo(t){let e=await Eo.readFile(t,"utf8");try{return(0,wu.parse)(e)}catch(n){let i=n instanceof Error?n.message:String(n);throw ct(t,"document",i)}}async function Mw(t){try{return await xo(t)}catch(e){if(e.code==="ENOENT")return null;throw e}}async function gu(t){try{return await Eo.access(t),!0}catch(e){if(e.code==="ENOENT")return!1;throw e}}async function Ww(t){let e=oe.join(t,"checks.yaml"),n=oe.join(t,"evals.yaml"),[i,r]=await Promise.all([gu(e),gu(n)]);if(r)throw new Error(`${n}: evals.yaml is no longer supported; use checks.yaml`);return i?{document:Fw(await xo(e),e)}:{document:null}}async function Su(t){let e=oe.resolve(t.root),n=oe.resolve(t.controlRoot);t.requireSkillMarkdown&&await Eo.access(oe.join(e,"SKILL.md"));let i=oe.join(n,"skill.yaml"),r=oe.join(n,"guardrails.yaml"),s=vu(await xo(i),i),o=await Mw(r),a=o===null?null:bu(o,r),c=await Ww(n),l={allowedSkills:s.skills.map(d=>d.id),allowedAgents:s.agents.map(d=>d.id),allowedTools:s.tools.map(d=>d.id),maxIterations:50,maxRetriesPerAction:3,confirmationRequiredFor:s.tools.filter(d=>d.requiresConfirmation).map(d=>d.id)};return{root:e,packageKind:t.packageKind==="runtime"?"runtime":void 0,definition:s,guardrails:{...l,...a},evals:c.document?.runtime??[]}}async function Cu(t){let e=oe.resolve(t);return Su({root:e,controlRoot:oe.join(e,"comet"),packageKind:"skill",requireSkillMarkdown:!0})}async function Eu(t){let e=oe.resolve(t);return Su({root:e,controlRoot:e,packageKind:"runtime",requireSkillMarkdown:!1})}function xu(t,e,n=oe.join(e,"package.json")){ne(t,n);let i=t.packageKind==="runtime"?"runtime":void 0,r=vu(t.definition,n),s=bu(t.guardrails,n),o=ku(t.evals,n,"evals"),a={allowedSkills:r.skills.map(c=>c.id),allowedAgents:r.agents.map(c=>c.id),allowedTools:r.tools.map(c=>c.id),maxIterations:50,maxRetriesPerAction:3,confirmationRequiredFor:r.tools.filter(c=>c.requiresConfirmation).map(c=>c.id)};return{root:oe.resolve(e),packageKind:i,definition:r,guardrails:{...a,...s},evals:o}}import _u from"path";function Bw(t,e,n,i){t.type==="invoke_skill"&&!e.definition.skills.some(r=>r.id===t.ref)&&n.push(`step ${i} references undeclared skill: ${t.ref??"(missing)"}`),t.type==="call_tool"&&!e.definition.tools.some(r=>r.id===t.ref)&&n.push(`step ${i} references undeclared tool: ${t.ref??"(missing)"}`),t.type==="handoff"&&!e.definition.agents.some(r=>r.id===t.ref)&&n.push(`step ${i} references undeclared agent: ${t.ref??"(missing)"}`),t.type==="ask_user"&&!t.question&&n.push(`step ${i} ask_user action requires question`)}function Pu(t){let e=[],{definition:n,guardrails:i,evals:r}=t;n.apiVersion!=="comet/v1alpha1"&&e.push("unsupported apiVersion"),n.kind!=="Skill"&&e.push("kind must be Skill"),n.metadata.name||e.push("metadata.name is required"),n.goal.statement||e.push("goal.statement is required"),i.maxIterations<1&&e.push("maxIterations must be at least 1"),i.maxRetriesPerAction<0&&e.push("maxRetriesPerAction must not be negative");let s=n.orchestration.steps??[];if(n.orchestration.mode==="adaptive")(n.orchestration.entry||s.length>0)&&e.push("adaptive orchestration must not define entry or steps");else{let o=new Set;for(let a of s)o.has(a.id)&&e.push(`duplicate step id: ${a.id}`),o.add(a.id),Bw(a.action,t,e,a.id);(!n.orchestration.entry||!o.has(n.orchestration.entry))&&e.push(`orchestration.entry references unknown step: ${n.orchestration.entry??"(missing)"}`);for(let a of s){a.next&&!o.has(a.next)&&e.push(`step ${a.id} has unknown next step: ${a.next}`);for(let c of a.completionEvals??[])r.some(l=>l.id===c)||e.push(`step ${a.id} references unknown eval: ${c}`)}}for(let o of n.tools){if(o.kind!=="script")continue;let a=_u.posix.normalize(o.source.replaceAll("\\","/"));(_u.isAbsolute(o.source)||a===".."||a.startsWith("../"))&&e.push(`script tool ${o.id} must reference a relative path inside the Skill package`)}for(let o of i.allowedSkills)n.skills.some(a=>a.id===o)||e.push(`guardrails allow undeclared skill: ${o}`);for(let o of i.allowedAgents)n.agents.some(a=>a.id===o)||e.push(`guardrails allow undeclared agent: ${o}`);for(let o of i.allowedTools)n.tools.some(a=>a.id===o)||e.push(`guardrails allow undeclared tool: ${o}`);return e}function cr(t){return Array.isArray(t)?t.map(cr):t&&typeof t=="object"?Object.fromEntries(Object.entries(t).sort(([e],[n])=>e.localeCompare(n)).map(([e,n])=>[e,cr(n)])):t}function Yw(t){return cr({...t.packageKind==="runtime"?{packageKind:"runtime"}:{},definition:t.definition,guardrails:t.guardrails,evals:t.evals})}function Uw(t){return F.posix.normalize(t.replaceAll("\\","/"))}function Pt(t,e,n){let i=F.relative(t,e);if(!(i===""||!F.isAbsolute(i)&&!i.startsWith(`..${F.sep}`)))throw new Error(`${n} resolves outside the Skill package`)}async function Nu(t,e,n){let i=Uw(e);if(F.posix.isAbsolute(i)||i===".."||i.startsWith("../"))throw new Error(`${n} resolves outside the Skill package`);let r=F.resolve(t,...i.split("/"));Pt(t,r,n);let s;try{s=await K.realpath(r)}catch(o){throw o.code==="ENOENT"?new Error(`${n} does not exist: ${e}`,{cause:o}):o}if(Pt(t,s,n),!(await K.stat(s)).isFile())throw new Error(`${n} is not a file: ${e}`);return{path:i,content:await K.readFile(s)}}async function Vw(t){let e=await K.realpath(t.root),n=t.packageKind==="runtime"?[]:[await Nu(e,"SKILL.md","SKILL.md")];for(let i of t.definition.tools)i.kind==="script"&&n.push(await Nu(e,i.source,`Script tool ${i.id}`));return n.sort((i,r)=>i.path.localeCompare(r.path))}function Jw(t,e){let n=e.map(i=>({path:i.path,sha256:Ru("sha256").update(i.content).digest("hex")}));return Ru("sha256").update(JSON.stringify(cr({package:t,files:n}))).digest("hex")}function ju(t){return JSON.stringify(t,null,2)+`
147
- `}async function Tu(t){let e=Yw(t),n=await Vw(t);return{document:e,files:n,hash:Jw(e,n)}}async function lr(t){return(await Tu(t)).hash}async function Ou(t){try{return await K.access(t),!0}catch(e){if(e.code==="ENOENT")return!1;throw e}}async function Au(t,e){try{if((await K.readFile(F.join(t,"sha256"),"utf8")).trim()!==e.hash)throw new Error("hash mismatch");if(await K.readFile(F.join(t,"package.json"),"utf8")!==ju(e.document))throw new Error("package mismatch");for(let r of e.files)if(!(await K.readFile(F.join(t,...r.path.split("/")))).equals(r.content))throw new Error(`file mismatch: ${r.path}`)}catch(n){throw new Error(`Existing Skill snapshot is invalid: ${e.hash}`,{cause:n})}}async function _o(t,e){let n=await Tu(t),i=F.resolve(e,".comet","skill-snapshots"),r=F.join(i,n.hash);if(await K.mkdir(i,{recursive:!0}),await Ou(r))return await Au(r,n),{hash:n.hash,snapshotDir:r};let s=F.join(i,`.tmp-${Kw()}`);Pt(i,s,"Temporary snapshot"),Pt(i,r,"Published snapshot");try{await K.mkdir(s);for(let o of n.files){let a=F.join(s,...o.path.split("/"));Pt(s,a,`Snapshot file ${o.path}`),await K.mkdir(F.dirname(a),{recursive:!0}),await K.writeFile(a,o.content)}await K.writeFile(F.join(s,"package.json"),ju(n.document)),await K.writeFile(F.join(s,"sha256"),n.hash+`
148
- `),await K.rename(s,r)}catch(o){if(await Ou(r)){try{await Au(r,n)}finally{await K.rm(s,{recursive:!0,force:!0})}return{hash:n.hash,snapshotDir:r}}throw await K.rm(s,{recursive:!0,force:!0}),o}return{hash:n.hash,snapshotDir:r}}async function Po(t,e){if(!/^[a-f0-9]{64}$/u.test(e))throw new Error(`Invalid Skill snapshot hash: ${e}`);let n=F.resolve(t,".comet","skill-snapshots"),i=F.join(n,e);Pt(n,i,"Skill snapshot");try{let r=(await K.readFile(F.join(i,"sha256"),"utf8")).trim();if(r!==e)throw new Error(`stored hash is ${r||"(empty)"}`);let s=F.join(i,"package.json"),o=JSON.parse(await K.readFile(s,"utf8")),a=xu(o,i,s),c=Pu(a);if(c.length>0)throw new Error(c.map(d=>` - ${d}`).join(`
149
- `));let l=await lr(a);if(l!==e)throw new Error(`calculated hash is ${l}`);return a}catch(r){throw new Error(`Skill snapshot is invalid or missing: ${e}`,{cause:r})}}async function Iu(t){try{return await Ro.access(t),!0}catch(e){if(e.code==="ENOENT")return!1;throw e}}function $u(t){return Hw("sha256").update(t).digest("hex")}function zw(t){return $u(JSON.stringify(Object.fromEntries(Object.entries(t).sort(([e],[n])=>e.localeCompare(n)))))}function Qw(t){return t.replaceAll(".","_").replaceAll("-","_")}async function Xw(t,e){let n=await st(t),i=Object.fromEntries(e.filter(o=>o.satisfied&&o.source).map(o=>[Qw(o.code),o.source])),r=ke.join(t,"subagent-progress.md");await Iu(r)&&(i.subagent_progress=ke.relative(n,r).split(ke.sep).join("/"));let s=e.find(o=>o.code==="design.handoff"&&o.satisfied);return s?.source&&(i.handoff_context=s.source),i}function Zw(t,e,n){return[{sequence:1,timestamp:n,type:"run_started",runId:t.runId,data:{skill:t.skill,skillVersion:t.skillVersion,skillHash:t.skillHash}},{sequence:2,timestamp:n,type:"state_migrated",runId:t.runId,data:{kind:"classic",migrationVersion:at,profile:e,source:"pre-migration"}}]}async function ey(t){await Promise.all(t.map(e=>Ro.rm(e,{recursive:!0,force:!0})))}async function qu(t,e){let n=await Ye(t);if(!n.classic)throw new Error("Classic migration requires a legacy state projection");let i=n.classic,r=i.classicProfile??i.workflow;if(n.run){if(i.classicMigration!==at)throw new Error("Classic Run exists without a supported classic_migration marker");if(n.run.skill!==e.skillPackage.definition.metadata.name)throw new Error(`Classic Run skill mismatch: expected ${e.skillPackage.definition.metadata.name}, got ${n.run.skill}`);if(await lr(e.skillPackage)!==n.run.skillHash)return await Po(t,n.run.skillHash),{classic:i,run:n.run,evidence:await Ke(t,n),migrated:!1,snapshotDir:ke.join(t,".comet","skill-snapshots",n.run.skillHash)};let f=await _o(e.skillPackage,t);return{classic:i,run:n.run,evidence:await Ke(t,n),migrated:!1,snapshotDir:f.snapshotDir}}let s=await Ke(t,n),o=Et(i,s);if(!e.skillPackage.definition.orchestration.steps?.some(u=>u.id===o))throw new Error(`Classic Skill package does not define resolved step: ${o}`);let a=await lr(e.skillPackage),c=ke.join(t,".comet","skill-snapshots",a),l=await Iu(c),d=[];try{let u=await _o(e.skillPackage,t),f=mu(e.skillPackage,e.runId?.()??Gw(),u.hash);f.currentStep=o,o==="completed"&&(f.status="completed");let h={...i,classicProfile:r,classicMigration:at},w=await Xw(t,s),p=await st(t),m=s.find(C=>C.code==="design.handoff"&&C.satisfied),g=null;m?.source&&(g=await te(p,m.resolvedSource??m.source,{label:"Classic migration handoff context",hooks:e.handoffReadHooks}),await Gl(t,f.contextRef,g),d.push(ke.resolve(t,f.contextRef))),await Hl(t,f.artifactsRef,w),d.push(ke.resolve(t,f.artifactsRef));let y=(e.now?.()??new Date).toISOString(),k={runId:f.runId,stateVersion:1,trajectoryOffset:2,contextHash:g===null?null:$u(g),artifactsHash:zw(w),createdAt:y};await zl(t,f.checkpointRef,k),d.push(ke.resolve(t,f.checkpointRef)),d.push(ke.resolve(t,f.trajectoryRef));for(let C of Zw(f,r,y))await mn(t,f.trajectoryRef,C);return await or(t,{classic:h,run:f,unknownKeys:n.unknownKeys}),{classic:h,run:f,evidence:s,migrated:!0,snapshotDir:u.snapshotDir}}catch(u){throw await ey(d),l||await Ro.rm(c,{recursive:!0,force:!0}),u}}async function ty(t){try{return(await Lu.stat(t)).isDirectory()}catch(e){if(e.code==="ENOENT")return!1;throw e}}async function ur(t){try{return(await Lu.stat(t)).isFile()}catch(e){if(e.code==="ENOENT")return!1;throw e}}async function ny(t){return await ty(t)?await ur(ie.join(t,"skill.yaml"))?!0:await ur(ie.join(t,"SKILL.md"))&&await ur(ie.join(t,"comet","skill.yaml")):!1}function iy(t){return{root:t,packageKind:"runtime",definition:{apiVersion:"comet/v1alpha1",kind:"Skill",metadata:{name:"comet-classic",version:"1",description:"Internal compatibility orchestration for classic Comet full, hotfix, and tweak workflows"},goal:{statement:"Advance or restore a classic Comet Run without changing the user command surface",inputs:[{name:"classic-state",description:"Validated ClassicState consistent with the Run projection",required:!0},{name:"evidence",description:"Structured evidence produced by the Classic Evidence collector",required:!0}],outputs:[{name:"run-state",description:"Atomically synchronized Classic and Run state",required:!0}],success:["Legacy fields and Run fields remain consistent","Every step invokes only a declared public Comet Skill","The completed state passes its completion eval"]},orchestration:{mode:"deterministic",entry:"full.open",steps:[{id:"full.open",action:{type:"invoke_skill",ref:"comet-open"},next:"full.design.handoff"},{id:"full.design.handoff",action:{type:"invoke_skill",ref:"comet-design"},next:"full.design.document"},{id:"full.design.document",action:{type:"invoke_skill",ref:"comet-design"},next:"full.build.plan"},{id:"full.build.plan",action:{type:"invoke_skill",ref:"comet-build"},next:"full.build.plan-ready"},{id:"full.build.plan-ready",action:{type:"invoke_skill",ref:"comet-build"},next:"full.build.configure"},{id:"full.build.configure",action:{type:"invoke_skill",ref:"comet-build"},next:"full.build.execute"},{id:"full.build.execute",action:{type:"invoke_skill",ref:"comet-build"},next:"full.build.complete"},{id:"full.build.complete",action:{type:"invoke_skill",ref:"comet-build"},next:"full.verify.run"},{id:"full.build.fix",action:{type:"invoke_skill",ref:"comet-build"},next:"full.build.execute"},{id:"full.verify.run",action:{type:"invoke_skill",ref:"comet-verify"},next:"full.verify.branch"},{id:"full.verify.branch",action:{type:"invoke_skill",ref:"comet-verify"},next:"full.archive.confirm"},{id:"full.archive.confirm",action:{type:"invoke_skill",ref:"comet-archive"},next:"full.archive.execute"},{id:"full.archive.execute",action:{type:"invoke_skill",ref:"comet-archive"},next:"completed"},{id:"hotfix.open",action:{type:"invoke_skill",ref:"comet-hotfix"},next:"hotfix.build.execute"},{id:"hotfix.build.execute",action:{type:"invoke_skill",ref:"comet-build"},next:"hotfix.build.complete"},{id:"hotfix.build.complete",action:{type:"invoke_skill",ref:"comet-build"},next:"hotfix.verify.run"},{id:"hotfix.verify.run",action:{type:"invoke_skill",ref:"comet-verify"},next:"hotfix.verify.branch"},{id:"hotfix.verify.branch",action:{type:"invoke_skill",ref:"comet-verify"},next:"hotfix.archive.confirm"},{id:"hotfix.archive.confirm",action:{type:"invoke_skill",ref:"comet-archive"},next:"hotfix.archive.execute"},{id:"hotfix.archive.execute",action:{type:"invoke_skill",ref:"comet-archive"},next:"completed"},{id:"tweak.open",action:{type:"invoke_skill",ref:"comet-tweak"},next:"tweak.build.execute"},{id:"tweak.build.execute",action:{type:"invoke_skill",ref:"comet-build"},next:"tweak.build.complete"},{id:"tweak.build.complete",action:{type:"invoke_skill",ref:"comet-build"},next:"tweak.verify.run"},{id:"tweak.verify.run",action:{type:"invoke_skill",ref:"comet-verify"},next:"tweak.verify.branch"},{id:"tweak.verify.branch",action:{type:"invoke_skill",ref:"comet-verify"},next:"tweak.archive.confirm"},{id:"tweak.archive.confirm",action:{type:"invoke_skill",ref:"comet-archive"},next:"tweak.archive.execute"},{id:"tweak.archive.execute",action:{type:"invoke_skill",ref:"comet-archive"},next:"completed"},{id:"completed",action:{type:"checkpoint"},completionEvals:["classic-completed"]}]},skills:[{id:"comet-open"},{id:"comet-design"},{id:"comet-build"},{id:"comet-verify"},{id:"comet-archive"},{id:"comet-hotfix"},{id:"comet-tweak"}],agents:[],tools:[]},guardrails:{allowedSkills:["comet-open","comet-design","comet-build","comet-verify","comet-archive","comet-hotfix","comet-tweak"],allowedAgents:[],allowedTools:[],maxIterations:500,maxRetriesPerAction:3,confirmationRequiredFor:[]},evals:[{id:"classic-completed",scope:"completion",type:"state_equals",field:"status",equals:"completed"}]}}async function ry(){let t=ie.dirname(Du(import.meta.url)),e=[process.env.COMET_RUNTIME_CLASSIC_ROOT,ie.resolve(t,"..","runtime","classic"),ie.resolve(t,"..","..","comet","runtime","classic"),ie.resolve(t,"..","..","assets","skills","comet","runtime","classic"),ie.resolve("assets","skills","comet","runtime","classic"),process.env.COMET_CLASSIC_SKILL_ROOT,ie.resolve(t,"..","..","comet-classic"),ie.resolve(t,"..","..","assets","skills","comet-classic"),ie.resolve("assets","skills","comet-classic")].filter(n=>!!n);for(let n of e)if(await ny(n))return n;return null}async function sy(t){return await ur(ie.join(t,"skill.yaml"))?Eu(t):Cu(t)}async function fr(t){let e=await ry();return qu(t,{skillPackage:e?await sy(e):iy(ie.dirname(Du(import.meta.url)))})}async function Fu(t){let e=await Ye(t),n=Array.from(new Set(e.unknownKeys)).sort();if(n.length>0)throw new Error(`Invalid Classic state: unknown field(s): ${n.join(", ")}`);return fr(t)}async function Mu(t,e,n,i){let r=await Ye(t);if(!r.classic||!r.run)throw new Error("Classic transition requires synchronized Classic and Run projections");let s=await Ke(t,{classic:e,run:n,unknownKeys:r.unknownKeys}),o=Et(e,s),a={...n,currentStep:o,iteration:n.iteration+1,status:o==="completed"?"completed":"running"};await or(t,{classic:e,run:a,unknownKeys:r.unknownKeys});let c=await Vi(t,a.trajectoryRef);return await mn(t,a.trajectoryRef,{sequence:c.length+1,timestamp:new Date().toISOString(),type:"state_transitioned",runId:a.runId,data:{kind:"classic",fromStep:n.currentStep,toStep:o,...i}}),a}var Wu={"full.open":["openspec.proposal","openspec.tasks"],"full.design.handoff":["openspec.proposal","openspec.design","openspec.tasks"],"full.design.document":["design.handoff"],"full.build.plan":["openspec.tasks"],"full.build.plan-ready":["build.plan"],"full.build.configure":["build.plan"],"full.build.execute":["build.plan"],"full.build.complete":["build.tasks-complete"],"full.verify.run":["build.tasks-complete"],"full.verify.branch":["verification.report"],"full.archive.confirm":["verification.report"],"full.archive.execute":["archive.confirmed"]};function oy(t){return Wu[t]?Wu[t]:t.endsWith(".open")?["openspec.proposal","openspec.tasks"]:t.endsWith(".build.execute")?[]:t.endsWith(".build.complete")?["build.tasks-complete"]:t.endsWith(".verify.run")?["build.tasks-complete"]:t.endsWith(".verify.branch")?["verification.report"]:t.endsWith(".archive.confirm")?["verification.report"]:t.endsWith(".archive.execute")?["archive.confirmed"]:[]}function Bu(t,e){let n=oy(t),i=n.filter(r=>!ot(e,r));return{stepId:t,passed:i.length===0,requiredEvidence:n,missingEvidence:i}}function ay(t){switch(t){case"open":return"/comet-open";case"design":return"/comet-design";case"build":return"/comet-build";case"verify":return"/comet-verify";case"archive":return"/comet-archive";default:return null}}async function Ku(t,e){try{let n=await Fu(t),i=await Ke(t,{classic:n.classic,run:n.run,unknownKeys:[]}),r=Et(n.classic,i);return{name:e,valid:!0,workflow:n.classic.workflow,phase:n.classic.phase,currentStep:r,nextCommand:ay(n.classic.phase),runtimeMode:"engine-projection",runtimeEval:Bu(r,i),evidence:i}}catch(n){return{name:e,valid:!1,workflow:"unknown",phase:"invalid",currentStep:null,nextCommand:null,runtimeMode:"invalid",runtimeEval:null,evidence:[],error:n instanceof Error?n.message:String(n)}}}Yi();import cy from"path";var ly=cy.join(".comet","state-events.jsonl"),uy=8*1024*1024;async function Yu(t,e){let n={schemaVersion:1,timestamp:new Date().toISOString(),...e};return await Ki(t,ly,`${JSON.stringify(n)}
150
- `,uy,"Classic state event log"),n}var fy={"open-complete":{event:"open-complete",from:"open",guardRefs:["open-artifacts-present"]},"design-complete":{event:"design-complete",from:"design",guardRefs:["design-evidence-present"]},"build-complete":{event:"build-complete",from:"build",guardRefs:["build-decisions-selected"]},"verify-pass":{event:"verify-pass",from:"verify",guardRefs:["verification-report-present"]},"verify-fail":{event:"verify-fail",from:"verify",guardRefs:["verification-failed"]},"archive-confirm":{event:"archive-confirm",from:"archive",guardRefs:["archive-final-confirmation"]},"archive-reopen":{event:"archive-reopen",from:"archive",guardRefs:["archive-not-finalized"]},archived:{event:"archived",from:"archive",guardRefs:["verify-result-pass","archive-confirmed"]},"preset-escalate":{event:"preset-escalate",from:"build",guardRefs:["preset-workflow"]}},Uu={open:"open-complete",design:"design-complete",build:"build-complete",verify:"verify-pass"};function dy(t){return t.toISOString().slice(0,10)}function R(t,e,n,i){let r=t[n];t[n]=i,r!==i&&e.push({field:n,from:r,to:i})}function Vu(t,e,n={}){let i=fy[e];if(t.phase!==i.from)throw new Error(`Cannot apply ${e}: phase is '${t.phase}', expected '${i.from}'`);let r={...t},s=[],o=n.now??new Date;if(e==="open-complete")R(r,s,"phase",r.workflow==="full"?"design":"build");else if(e==="design-complete")R(r,s,"phase","build");else if(e==="build-complete"){let a=r.verifyResult==="fail";R(r,s,"phase","verify"),R(r,s,"verifyResult","pending"),R(r,s,"branchStatus","pending"),a||R(r,s,"verificationReport",null)}else if(e==="verify-pass")R(r,s,"verifyResult","pass"),R(r,s,"verifyFailures",0),R(r,s,"phase","archive"),R(r,s,"verifiedAt",dy(o)),R(r,s,"archiveConfirmation","pending"),R(r,s,"branchStatus","pending");else if(e==="verify-fail")R(r,s,"verifyResult","fail"),R(r,s,"verifyFailures",r.verifyFailures+1),R(r,s,"phase","build"),R(r,s,"branchStatus","pending");else if(e==="preset-escalate"){if(r.workflow!=="hotfix"&&r.workflow!=="tweak")throw new Error(`Cannot apply ${e}: workflow must be hotfix or tweak, got '${r.workflow}'`);R(r,s,"workflow","full"),R(r,s,"classicProfile","full"),R(r,s,"phase","design"),R(r,s,"designDoc",null),R(r,s,"buildPause",null),R(r,s,"buildMode",null),R(r,s,"subagentDispatch",null),R(r,s,"tddMode",null),R(r,s,"reviewMode",null),R(r,s,"isolation",null),R(r,s,"boundBranch",null),R(r,s,"verifyMode",null),R(r,s,"directOverride",null)}else if(e==="archive-confirm"){if(r.verifyResult!=="pass")throw new Error(`Cannot apply ${e}: verifyResult must be pass`);if(r.archived)throw new Error(`Cannot apply ${e}: already archived`);R(r,s,"archiveConfirmation","confirmed")}else if(e==="archive-reopen"){if(r.archived)throw new Error(`Cannot apply ${e}: already archived`);R(r,s,"verifyResult","pending"),R(r,s,"verifyFailures",0),R(r,s,"phase","verify"),R(r,s,"verifiedAt",null),R(r,s,"archiveConfirmation",null),R(r,s,"branchStatus","pending")}else{if(r.verifyResult!=="pass")throw new Error(`Cannot apply ${e}: verifyResult must be pass`);if(r.archiveConfirmation!=="confirmed")throw new Error(`Cannot apply ${e}: archiveConfirmation must be confirmed`);R(r,s,"archived",!0)}return{classic:r,effects:s,definition:i}}var Nn=Je(Ie(),1);import Hu from"path";import{AsyncLocalStorage as py}from"async_hooks";import{promises as Ju}from"fs";import _n from"path";var dr=new py;function my(t,e){let n=_n.relative(t,e);return n===""||!_n.isAbsolute(n)&&n!==".."&&!n.startsWith(`..${_n.sep}`)}async function hy(t){let e=_n.resolve(t.invocationCwd??process.cwd()),n=_n.resolve(t.projectRoot??await st(e)),[i,r]=await Promise.all([Ju.realpath(e),Ju.realpath(n)]);if(!my(r,i))throw new Error(`Classic command invocation cwd is outside the discovered project: ${e}`);return{invocationCwd:e,projectRoot:n}}async function pr(t,e){let n=dr.getStore();if(n)return e(n);let i=await hy(t);return dr.run(i,()=>e(i))}function I(){let t=dr.getStore();if(!t)throw new Error("Classic command project context is unavailable");return t.projectRoot}function mr(){let t=dr.getStore();if(!t)throw new Error("Classic command invocation context is unavailable");return t.invocationCwd}var gy="\x1B[32m",Pn="\x1B[31m",wy="\x1B[33m",yy="\x1B[0m",vy=["workflow","phase","design_doc","plan","build_mode","isolation","verify_mode","verify_result","verified_at","archived"],by={workflow:["full","hotfix","tweak"],language:["en","zh-CN"],phase:["open","design","build","verify","archive"],context_compression:["off","beta"],build_mode:["subagent-driven-development","executing-plans","direct"],build_pause:["plan-ready"],subagent_dispatch:["confirmed"],tdd_mode:["tdd","direct"],review_mode:["off","standard","thorough"],isolation:["current","branch","worktree"],verify_mode:["light","full"],auto_transition:["true","false"],verify_result:["pending","pass","fail"],branch_status:["pending","handled"],archive_confirmation:["pending","confirmed"],archived:["true","false"],direct_override:["true","false"],classic_profile:["full","hotfix","tweak"],classic_migration:["1"]},ky=new Set([..._t,...So,"classic_profile","classic_migration"]);function lt(t,e){return`${t}${e}${yy}`}function Rn(t){return t==null?"":typeof t=="object"?JSON.stringify(t):String(t)}var Gu=async(t,e)=>pr(e,async()=>{let n=t[0],i=vn(n);if(i)return{exitCode:1,stderr:lt(Pn,`ERROR: ${i}`)};let r=I(),{directory:s,label:o}=await Qi(n,r),a=Hu.join(s,".comet.yaml"),c=[`[VALIDATE] ${o}/.comet.yaml`],l=0,d=0,u=m=>{l+=1,c.push(lt(Pn,` FAIL: ${m}`))},f=m=>{d+=1,c.push(lt(wy,` WARN: ${m}`))},h;try{h=await te(r,a,{label:`Classic state ${o}/.comet.yaml`})}catch(m){if(m.code==="ENOENT")return u(".comet.yaml does not exist"),c.push("",lt(Pn,`${l} error(s), ${d} warning(s) — validation FAILED`)),{exitCode:1,stderr:c.join(`
151
- `)};throw m}let w=(0,Nn.parseDocument)(h);if(w.errors.length>0||!(0,Nn.isMap)(w.contents)){for(let m of w.errors)u(m.message);return(0,Nn.isMap)(w.contents)||u("document root must be a mapping"),c.push("",lt(Pn,`${l} error(s), ${d} warning(s) — validation FAILED`)),{exitCode:1,stderr:c.join(`
152
- `)}}let p=w.toJS();for(let m of vy)Object.prototype.hasOwnProperty.call(p,m)||u(`missing required field '${m}'`);for(let[m,g]of Object.entries(by)){if(!Object.prototype.hasOwnProperty.call(p,m))continue;let y=Rn(p[m]);if(!y){m==="auto_transition"&&u(`${m}='' is not valid. Expected: ${g.join(" ")}`);continue}g.includes(y)||u(`${m}='${y}' is not valid. Expected: ${g.join(" ")}`)}if(Object.prototype.hasOwnProperty.call(p,"bound_branch")){let m=p.bound_branch;m!==null&&typeof m!="string"&&u(`bound_branch='${Rn(m)}' is not a string or null`)}if(Object.prototype.hasOwnProperty.call(p,"verify_failures")){let m=p.verify_failures;(typeof m!="number"||!Number.isInteger(m)||m<0)&&u(`verify_failures='${Rn(m)}' is not a non-negative integer`)}for(let m of["design_doc","plan","handoff_context","verification_report"]){let g=Rn(p[m]);if(g){if(/^(?:[A-Za-z]:|[\\/]|~)/u.test(g)||g.split(/[\\/]/u).includes("..")){u(`${m}='${g}' must be a relative repository path`);continue}try{await yn(r,Hu.resolve(r,g),{label:`${m} artifact pointer`,expected:"file"})||u(`${m}='${g}' does not exist on disk`)}catch(y){u(`${m}='${g}' is unsafe: ${y instanceof Error?y.message:String(y)}`)}}}for(let m of["handoff_hash"]){let g=Rn(p[m]);g&&!/^[a-f0-9]{64}$/u.test(g)&&u(`${m}='${g}' is not a sha256 hex digest`)}for(let m of Object.keys(p))ky.has(m)||f(`unknown field '${m}' found`);return c.push(""),l>0?(c.push(lt(Pn,`${l} error(s), ${d} warning(s) — validation FAILED`)),{exitCode:1,stderr:c.join(`
153
- `)}):(c.push(lt(gy,`0 errors, ${d} warning(s) — validation PASSED`)),{exitCode:0,stderr:c.join(`
154
- `)})});lo();it();import Sy from"os";import hr from"path";function Cy(t={}){let e=t.cwd??process.cwd(),n=t.homeDir??Sy.homedir(),i=[{file:hr.resolve(e,".comet","config.yaml"),source:".comet/config.yaml",scope:"project"},{file:hr.resolve(n,".comet","config.yaml"),source:"~/.comet/config.yaml",scope:"global"}];return i.filter((r,s)=>i.findIndex(o=>o.file===r.file)===s)}async function zu(t,e={}){for(let n of Cy(e)){let i=hr.dirname(hr.dirname(n.file)),r=n.scope==="global"?(await co(i))?.classic:(await Me(i,{allowPartialProject:!0}))?.value.classic;if(!r||typeof r!="object"||Array.isArray(r))continue;let s=r[t];if(s!=null)return{value:String(s),source:n.source}}return null}it();var Oo=Je(Ie(),1);import{execFileSync as Qu}from"child_process";import{randomUUID as _y}from"crypto";import{promises as On}from"fs";import Xu from"path";var Ey=null;function xy(t,e){let n=t;for(let i of e)n+="\0"+(typeof i=="string"?i:JSON.stringify(i));return n}function No(t,e){return(...n)=>{let i=Ey;if(i===null)return e(...n);let r=xy(`sync:${t}`,n),s=i.entries.get(r);if(s)return s.value;let o=e(...n);return i.entries.set(r,{value:o}),o}}function Py(t){try{let e=Qu("git",["rev-parse","--abbrev-ref","HEAD"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();return e&&e!=="HEAD"?e:null}catch{return null}}var Ry=No("liveGitBranch",t=>Py(t));function Ny(t){try{return Qu("git",["rev-parse","--is-inside-work-tree"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()==="true"}catch{return!1}}var Oy=No("isGitWorkTree",t=>Ny(t)),Ay=["current","branch","worktree"];function Zu(t){return Ay.includes(t)}function jy(t){return Zu(t.isolation)?t.boundBranch===null&&t.currentBranch===null&&t.gitWorkTree===!1?{status:"not-applicable"}:t.boundBranch===null?t.currentBranch===null?{status:"unbound-detached"}:{status:"needs-heal",branch:t.currentBranch}:t.currentBranch===t.boundBranch?{status:"ok"}:{status:"drift",boundBranch:t.boundBranch,currentBranch:t.currentBranch}:{status:"not-applicable"}}async function ef(t,e){let n=Xu.join(t,".comet.yaml"),i=(0,Oo.parseDocument)(await On.readFile(n,"utf8"),{uniqueKeys:!1});if(i.errors.length>0)throw new Error(`Invalid .comet.yaml: ${i.errors[0].message}`);let r=i.toJS()??{},s=typeof r.isolation=="string"?r.isolation:null,o=typeof r.bound_branch=="string"&&r.bound_branch!==""?r.bound_branch:null,a=Zu(s),c=Ry(e.cwd),l=a&&o===null&&c===null?Oy(e.cwd):!0,d=jy({isolation:s,boundBranch:o,currentBranch:c,gitWorkTree:l});return d.status==="needs-heal"&&e.heal?(await Ty(t,d.branch),{status:"healed",branch:d.branch,bindingRequired:a,currentBranch:c}):{...d,bindingRequired:a,currentBranch:c}}async function Ty(t,e){let n=Xu.join(t,".comet.yaml"),i=(0,Oo.parseDocument)(await On.readFile(n,"utf8"),{uniqueKeys:!1});i.set("bound_branch",e);let r=`${n}.${_y()}.tmp`;try{await On.writeFile(r,i.toString(),"utf8"),await On.rename(r,n)}catch(s){throw await On.rm(r,{force:!0}),s}}function Iy(t){return t??"detached HEAD"}function tf(t,e,n){return`change '${t}' is bound to branch '${e}', but current branch is '${Iy(n)}'.
155
- Next: ask the user to confirm — switch back to '${e}', or run \`comet state rebind ${t}\` after explicit confirmation.`}function nf(t){return`change '${t}' uses a branch-bound workspace mode but has no bound branch and HEAD is detached; checkout a branch first before continuing.`}var Ly="\x1B[32m",Dy="\x1B[31m",Fy="\x1B[33m",Io="\x1B[0m",My=["open","design","build","verify","archive"],Wy={open:"=== Guard: open → next ===",design:"=== Guard: design → build ===",build:"=== Guard: build → verify ===",verify:"=== Guard: verify → archive ===",archive:"=== Guard: archive completeness ==="},By={open:" [APPLY] .comet.yaml updated: phase=PLACEHOLDER",design:" [APPLY] .comet.yaml updated: phase=build",build:" [APPLY] .comet.yaml updated: phase=verify, verify_result=pending",verify:" [APPLY] .comet.yaml updated: phase=archive, verify_result=pass"},Ky={branchStatus:"branch_status",phase:"phase",verificationReport:"verification_report",verifiedAt:"verified_at",verifyResult:"verify_result"};function Rt(t){return`${Ly}${t}${Io}`}function Se(t){return`${Dy}${t}${Io}`}function Yy(t){return`${Fy}${t}${Io}`}function Uy(t){return Ky[t]??String(t)}function Vy(t){return t===null?"null":t===void 0?"":typeof t=="object"?JSON.stringify(t):String(t)}var fe=class extends Error{constructor(n,i=1){super(n);this.exitCode=i}exitCode},To=class{stderr=[];diagnostics;toResult(e=0){return{exitCode:e,...this.diagnostics?{stdout:JSON.stringify({diagnostics:this.diagnostics})+`
142
+ `,n)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let n=Ri(e),i=kt(n);return i.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let n=Ri(e),i=kt(n);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,n){return this.type!=="comment"||this.indent<=n?!1:e.every(i=>i.type==="newline"||i.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};Sl.Parser=Go});var Pl=v(an=>{"use strict";var Cl=qo(),Ih=Qt(),sn=en(),$h=Tr(),qh=N(),Lh=Jo(),El=zo();function xl(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new Lh.LineCounter||null,prettyErrors:e}}function Dh(t,e={}){let{lineCounter:n,prettyErrors:i}=xl(e),r=new El.Parser(n?.addNewLine),o=new Cl.Composer(e),s=Array.from(o.compose(r.parse(t)));if(i&&n)for(let a of s)a.errors.forEach(sn.prettifyError(t,n)),a.warnings.forEach(sn.prettifyError(t,n));return s.length>0?s:Object.assign([],{empty:!0},o.streamInfo())}function _l(t,e={}){let{lineCounter:n,prettyErrors:i}=xl(e),r=new El.Parser(n?.addNewLine),o=new Cl.Composer(e),s=null;for(let a of o.compose(r.parse(t),!0,t.length))if(!s)s=a;else if(s.options.logLevel!=="silent"){s.errors.push(new sn.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return i&&n&&(s.errors.forEach(sn.prettifyError(t,n)),s.warnings.forEach(sn.prettifyError(t,n))),s}function Fh(t,e,n){let i;typeof e=="function"?i=e:n===void 0&&e&&typeof e=="object"&&(n=e);let r=_l(t,n);if(!r)return null;if(r.warnings.forEach(o=>$h.warn(r.options.logLevel,o)),r.errors.length>0){if(r.options.logLevel!=="silent")throw r.errors[0];r.errors=[]}return r.toJS(Object.assign({reviver:i},n))}function Wh(t,e,n){let i=null;if(typeof e=="function"||Array.isArray(e)?i=e:n===void 0&&e&&(n=e),typeof n=="string"&&(n=n.length),typeof n=="number"){let r=Math.round(n);n=r<1?void 0:r>8?{indent:8}:{indent:r}}if(t===void 0){let{keepUndefined:r}=n??e??{};if(!r)return}return qh.isDocument(t)&&!i?t.toString(n):new Ih.Document(t,i,n).toString(n)}an.parse=Fh;an.parseAllDocuments=Dh;an.parseDocument=_l;an.stringify=Wh});var $e=v(A=>{"use strict";var Mh=qo(),Bh=Qt(),Kh=go(),Qo=en(),Yh=$t(),Ie=N(),Uh=Ne(),Hh=L(),Vh=Oe(),Jh=je(),Gh=_i(),zh=Ho(),Qh=Jo(),Xh=zo(),Ai=Pl(),Rl=Ot();A.Composer=Mh.Composer;A.Document=Bh.Document;A.Schema=Kh.Schema;A.YAMLError=Qo.YAMLError;A.YAMLParseError=Qo.YAMLParseError;A.YAMLWarning=Qo.YAMLWarning;A.Alias=Yh.Alias;A.isAlias=Ie.isAlias;A.isCollection=Ie.isCollection;A.isDocument=Ie.isDocument;A.isMap=Ie.isMap;A.isNode=Ie.isNode;A.isPair=Ie.isPair;A.isScalar=Ie.isScalar;A.isSeq=Ie.isSeq;A.Pair=Uh.Pair;A.Scalar=Hh.Scalar;A.YAMLMap=Vh.YAMLMap;A.YAMLSeq=Jh.YAMLSeq;A.CST=Gh;A.Lexer=zh.Lexer;A.LineCounter=Qh.LineCounter;A.Parser=Xh.Parser;A.parse=Ai.parse;A.parseAllDocuments=Ai.parseAllDocuments;A.parseDocument=Ai.parseDocument;A.stringify=Ai.stringify;A.visit=Rl.visit;A.visitAsync=Rl.visitAsync});var Oi=B(()=>{"use strict"});function qe(t){return t!==0&&t!==0n&&t!=="0"}function ji(t,e){return qe(t.dev)&&qe(e.dev)&&qe(t.ino)&&qe(e.ino)}function ye(t,e){let n=qe(t.dev)&&qe(e.dev);if(n&&t.dev!==e.dev)return!1;let i=qe(t.ino)&&qe(e.ino);return i&&t.ino!==e.ino?!1:n&&i?!0:t.birthtime===e.birthtime}var Ti=B(()=>{"use strict"});import{randomUUID as Zh}from"crypto";import{constants as eg,promises as D}from"fs";import J from"path";async function Xo(t,e){try{return await D.link(t,e),{linked:!0}}catch(n){let i=n.code;if(i!=="ENOTSUP"&&i!=="EOPNOTSUPP")throw n}return await D.copyFile(t,e,eg.COPYFILE_EXCL),{linked:!1}}function St(t,e){let n=J.relative(t,e);return n===""||!J.isAbsolute(n)&&n!==".."&&!n.startsWith(`..${J.sep}`)}function $i(t){return{dev:t.dev,ino:t.ino,birthtime:t.birthtimeMs}}function tg(t,e){return ye(t,$i(e))}function Ii(t,e){let n=$i(t),i=$i(e);return ji(n,i)?ye(n,i):ye(n,i)&&t.birthtimeMs===e.birthtimeMs&&t.ctimeMs===e.ctimeMs&&t.size===e.size}async function qi(t){let e=await D.lstat(t);if(!e.isDirectory()||e.isSymbolicLink())throw new Error(`Contained atomic write parent must be a real directory: ${t}`);return{path:t,realPath:await D.realpath(t),...$i(e)}}async function Le(t){for(let e of t){let n=await D.lstat(e.path);if(!n.isDirectory()||n.isSymbolicLink()||!tg(e,n)||await D.realpath(e.path)!==e.realPath)throw new Error(`Contained atomic write parent changed before commit: ${e.path}`)}}async function ng(t,e){let n=J.resolve(t),i=J.resolve(e);if(!St(n,i))throw new Error(`Contained atomic write parent is outside its managed root: ${e}`);let r=[await qi(n)],o=J.relative(n,i).split(J.sep).filter(Boolean),s=n;for(let a of o){await Le(r),s=J.join(s,a);try{await D.mkdir(s)}catch(l){if(l.code!=="EEXIST")throw l}let c=await qi(s);if(!St(r[0].realPath,c.realPath))throw new Error(`Contained atomic write parent resolves outside its managed root: ${s}`);r.push(c)}return await Le(r),r}async function ig(t,e){let n=J.resolve(t),i=J.resolve(e);if(!St(n,i))throw new Error(`Contained file parent is outside its managed root: ${e}`);let r=[await qi(n)],o=J.relative(n,i).split(J.sep).filter(Boolean),s=n;for(let a of o){s=J.join(s,a);try{let c=await qi(s);if(!St(r[0].realPath,c.realPath))throw new Error(`Contained file parent resolves outside its managed root: ${s}`);r.push(c)}catch(c){if(c.code==="ENOENT")return null;throw c}}return await Le(r),r}async function Nl(t){let e;try{e=await D.open(t,"r"),await e.sync()}catch(n){let i=n.code;if(!["EACCES","EBADF","EINVAL","EISDIR","ENOTSUP","EPERM"].includes(i??""))throw n}finally{await e?.close()}}async function rg(t,e,n){let i=J.dirname(t),r=await ng(n.containedRoot,i),o=J.join(i,`.${J.basename(t)}.${Zh()}.tmp`),s,a;try{await n.beforeTemporaryOpen?.(),s=await D.open(o,"wx"),a=await s.stat();let[c,l]=await Promise.all([D.lstat(o),D.realpath(o)]);if(await Le(r),!c.isFile()||c.isSymbolicLink()||!Ii(a,c)||!St(r[0].realPath,l))throw new Error("Contained atomic write temporary file opened outside its managed parent");if(typeof e=="string"?await s.writeFile(e,"utf8"):await s.writeFile(e),await s.sync(),!Ii(a,await s.stat()))throw new Error("Contained atomic write temporary file changed while writing");await s.close(),s=void 0,await n.beforeCommit?.(),await Le(r);let f=await D.lstat(o);if(!f.isFile()||f.isSymbolicLink()||!Ii(f,a))throw new Error("Contained atomic write temporary file changed before commit");n.exclusive?(await Xo(o,t),await D.unlink(o)):await D.rename(o,t),await Nl(i)}catch(c){await s?.close();try{await Le(r),await D.rm(o,{force:!0})}catch{}throw c}}async function ue(t,e,n){await rg(t,e,n)}async function Zo(t,e){let n=J.dirname(t),i=await ig(e.containedRoot,n);if(!i)return!1;let r,o;try{r=await D.lstat(t),o=await D.realpath(t)}catch(c){if(c.code==="ENOENT")return!1;throw c}if(!r.isFile()||r.isSymbolicLink()||!St(i[0].realPath,o))throw new Error("Contained file removal target must be a regular file inside its managed root");await e.beforeRemove?.(),await Le(i);let[s,a]=await Promise.all([D.lstat(t),D.realpath(t)]);if(!s.isFile()||s.isSymbolicLink()||!Ii(r,s)||a!==o)throw new Error("Contained file removal target changed before removal");return await D.unlink(t),await Le(i),await Nl(n),!0}var De=B(()=>{"use strict";Ti()});var Al=B(()=>{"use strict"});var es=B(()=>{"use strict";Oi()});var Ol=B(()=>{"use strict";Oi();es()});import Li from"path";function pg(t,e){if(typeof t!="string")throw new Error(`${e} must be a string`);let n=t.trim();if(n.length===0||Li.posix.isAbsolute(n)||Li.win32.isAbsolute(n)||/^(?:~|[\\/])/u.test(n))throw new Error(`${e} must be a project-relative path`);if(n===".")return[];let i=n.replaceAll("\\","/").split("/");if(i.some(r=>r===".."))throw new Error(`${e} must stay inside the project root`);if(i.some(r=>r===""||r==="."))throw new Error(`${e} must not contain empty or dot path segments`);return i}function cn(t){let e=pg(t,"native.artifact_root");return e.length===0?".":e.join("/")}function Il(t,e="docs"){let n=t??e;if(n!=="legacy"&&n!=="docs")throw new Error("classic.artifact_layout must be legacy or docs");return n}function Fe(t,e,n=!1){if(typeof t!="string")throw new Error(`${e} must be a string`);let i=t.trim().replaceAll("\\","/");if(i.length===0||Li.posix.isAbsolute(i)||Li.win32.isAbsolute(i)||/^(?:~|[\\/])/u.test(i))throw new Error(`${e} must be relative to its declared path base`);let r=i.split("/");if(r.some(o=>o===".."))throw new Error(`${e} must stay inside its declared path base`);if(r.some(o=>o===""||o==="."))throw new Error(`${e} must not contain empty or dot path segments`);if(!n&&/[*?]/u.test(i))throw new Error(`${e} cannot contain wildcards`);return r.join("/")}function Ct(t,e){if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`${e} must be a mapping`);return t}function $l(t,e,n){let i=t??e;if(i!=="en"&&i!=="zh-CN")throw new Error(`${n} must be en or zh-CN`);return i}function ql(t,e){if(typeof t!="string"||t.length===0||t.includes("\\")||t.includes("\0")||t.startsWith("/")||t.split("/").includes(".."))throw new Error(`${e} contains an unsafe pattern`);if(t.length>ns)throw new Error(`${e} exceeds ${ns} characters`);let n=0;for(let i=0;i<t.length;i+=1)t[i]==="?"?n+=1:t[i]==="*"&&(n+=1,t[i+1]==="*"&&(i+=1));if(n>is)throw new Error(`${e} contains more than ${is} wildcard tokens`);return t}function jl(t,e,n){if(t===void 0)return[...n];if(!Array.isArray(t))throw new Error(`${e} contains an unsafe pattern`);return[...new Set(t.map(i=>ql(i,e)))].sort((i,r)=>i.localeCompare(r,"en"))}function ts(t,e,n){let i=t??e;if(!Number.isSafeInteger(i)||i<1)throw new Error(`${n} must be a positive integer`);return i}function mg(t){if(t===void 0)return{...oe,include:[...oe.include],exclude:[...oe.exclude]};let e=Ct(t,"native.snapshot");return{include:jl(e.include,"native.snapshot.include",oe.include),exclude:jl(e.exclude,"native.snapshot.exclude",oe.exclude),max_files:ts(e.max_files,oe.max_files,"native.snapshot.max_files"),max_total_bytes:ts(e.max_total_bytes,oe.max_total_bytes,"native.snapshot.max_total_bytes"),max_duration_ms:ts(e.max_duration_ms,oe.max_duration_ms,"native.snapshot.max_duration_ms")}}function hg(t){if(t===void 0)return;let e=Ct(t,"native.pending_root_move"),n=e.id,i=e.from_artifact_root,r=e.to_artifact_root,o=e.stage;if(typeof n!="string"||!/^[a-f0-9-]{8,}$/u.test(n))throw new Error("native.pending_root_move.id is invalid");if(typeof i!="string"||typeof r!="string")throw new Error("native.pending_root_move roots must be strings");if(o!=="copying"&&o!=="ready"&&o!=="switched")throw new Error("native.pending_root_move.stage is invalid");let s;if(e.cleanup!==void 0){let a=Ct(e.cleanup,"native.pending_root_move.cleanup"),c=a.kind,l=a.state,f=a.manifest_hash;if(c!=="forward-source"&&c!=="restart-staging"&&c!=="rollback-destination"&&c!=="rollback-staging")throw new Error("native.pending_root_move.cleanup.kind is invalid");if(l!=="prepared"&&l!=="quarantined"&&l!=="deleting")throw new Error("native.pending_root_move.cleanup.state is invalid");if(typeof f!="string"||!/^[a-f0-9]{64}$/u.test(f))throw new Error("native.pending_root_move.cleanup.manifest_hash is invalid");s={kind:c,state:l,manifestHash:f}}return{id:n,fromArtifactRoot:cn(i),toArtifactRoot:cn(r),stage:o,...s?{cleanup:s}:{}}}function gg(t,e={}){let n=Ct(t,"native"),i=n.artifact_root??(e.allowMissingArtifactRoot?"docs":void 0);if(typeof i!="string")throw new Error("native.artifact_root must be a string");let r=n.clarification_mode??"batch";if(r!=="sequential"&&r!=="batch")throw new Error("native.clarification_mode must be sequential or batch");let o=n.archive_confirmation??"automatic";if(o!=="automatic"&&o!=="required")throw new Error("native.archive_confirmation must be automatic or required");let s=n.max_verify_failures??Tl;if(!Number.isSafeInteger(s)||s<1)throw new Error("native.max_verify_failures must be a positive integer");let a=hg(n.pending_root_move);return{artifact_root:cn(i),language:$l(n.language,"en","native.language"),clarification_mode:r,archive_confirmation:o,max_verify_failures:s,snapshot:mg(n.snapshot),...a?{pending_root_move:a}:{}}}function wg(t){let e=Ct(t,"classic"),n=e.context_compression??"off";if(n!=="off"&&n!=="beta")throw new Error("classic.context_compression must be off or beta");let i=e.review_mode??"standard";if(i!=="off"&&i!=="standard"&&i!=="thorough")throw new Error("classic.review_mode must be off, standard, or thorough");let r=e.auto_transition??!0;if(typeof r!="boolean")throw new Error("classic.auto_transition must be true or false");return{artifact_layout:Il(e.artifact_layout),language:$l(e.language,"zh-CN","classic.language"),context_compression:n,review_mode:i,auto_transition:r}}function yg(t){let n=Ct(t,"hook").allow_paths??[];if(!Array.isArray(n))throw new Error("hook.allow_paths must be an array");return{allow_paths:[...new Set(n.map((i,r)=>Fe(i,`hook.allow_paths[${r}]`)))]}}function vg(t){let e=t??!0;if(typeof e!="boolean")throw new Error("ambient_resume must be true or false");return e}function bg(t,e,n,i,r,o){let s=t.schema!==void 0;if(!(s||t.default_workflow!==void 0||t.workflows!==void 0||!o.allowPartialProject&&t.native!==void 0)||o.allowPartialProject&&!s)return null;if(t.schema!=="comet.project.v1")throw new Error("Unsupported Comet project schema");if(t.default_workflow!=="native"&&t.default_workflow!=="classic")throw new Error("default_workflow must be native or classic");let c=t.workflows??[t.default_workflow];if(!Array.isArray(c)||c.length===0||c.some(f=>f!=="native"&&f!=="classic"))throw new Error("workflows must contain native and/or classic");let l=[...new Set(c)];if(!l.includes(t.default_workflow))throw new Error("workflows must include default_workflow");if(l.includes("native")&&!n)throw new Error("native must be a mapping");return{schema:"comet.project.v1",default_workflow:t.default_workflow,workflows:l,ambient_resume:r,...e?{hook:e}:{},...n?{native:n}:{},...i?{classic:i}:{}}}function We(t,e={}){let n=(0,rs.parseDocument)(t,{uniqueKeys:!0});if(n.errors.length>0)throw new Error(`Invalid .comet/config.yaml: ${n.errors[0].message}`);let i=n.toJS();if(i==null)return{value:{},config:null,ambient_resume:!0};if(typeof i!="object"||Array.isArray(i))throw new Error("Invalid .comet/config.yaml: root must be a mapping");let r=i,o=vg(r.ambient_resume),s=r.hook===void 0?void 0:yg(r.hook),a=r.native===void 0?void 0:gg(r.native,{allowMissingArtifactRoot:e.allowMissingNativeFields}),c=r.classic===void 0?void 0:wg(r.classic),l=bg(r,s,a,c,o,{allowPartialProject:e.allowPartialProject??!1});return{value:r,config:l,ambient_resume:o,...s?{hook:s}:{},...a?{native:a}:{},...c?{classic:c}:{}}}function os(t="docs",e="en"){return{schema:"comet.project.v1",default_workflow:"native",ambient_resume:!0,native:{artifact_root:cn(t),language:e,clarification_mode:"batch",archive_confirmation:"automatic",max_verify_failures:Tl,snapshot:{...oe,include:[...oe.include],exclude:[...oe.exclude]}}}}var rs,Et,ns,is,Tl,ug,fg,dg,oe,ve=B(()=>{"use strict";rs=ze($e(),1),Et=64*1024,ns=1024,is=64,Tl=5,ug=[".agents/skills/**",".amazonq/skills/**",".augment/skills/**",".bob/skills/**",".claude/skills/**",".cline/skills/**",".codebuddy/skills/**",".workbuddy/skills/**",".continue/skills/**",".cospec/skills/**",".crush/skills/**",".cursor/skills/**",".factory/skills/**",".forge/skills/**",".gemini/skills/**",".github/skills/**",".iflow/skills/**",".junie/skills/**",".kilocode/skills/**",".kimi-code/skills/**",".kiro/skills/**",".lingma/skills/**",".mimocode/skills/**",".opencode/skills/**",".pi/skills/**",".qoder/skills/**",".qwen/skills/**",".roo/skills/**",".trae-cn/skills/**",".trae/skills/**",".windsurf/skills/**",".zcode/skills/**"],fg=["**/.idea/**","**/.vscode/**",".codex/skills/**","**/node_modules/**","**/.next/**","**/.nuxt/**","**/.output/**","**/.svelte-kit/**","**/.vite/**","**/.parcel-cache/**","**/.turbo/**","**/.nx/cache/**","**/dist/**","**/build/**","**/out/**","**/coverage/**","**/.nyc_output/**","**/target/**","**/.gradle/**","**/.cxx/**","**/.externalNativeBuild/**","**/captures/**","**/__pycache__/**","**/.pytest_cache/**","**/.mypy_cache/**","**/.ruff_cache/**","**/.tox/**","**/.nox/**","**/.venv/**","**/venv/**","**/obj/**","**/CMakeFiles/**","**/cmake-build-*/**","**/.cache/**","**/tmp/**","**/temp/**","**/logs/**","**/*.tsbuildinfo","**/*.log","**/.DS_Store","**/Thumbs.db"],dg=[...ug,...fg].sort((t,e)=>t.localeCompare(e,"en")),oe={include:["**/*"],exclude:[...dg],max_files:1e4,max_total_bytes:256*1024*1024,max_duration_ms:6e4}});import{constants as Di,promises as it}from"fs";function ss(t){return"birthtimeNs"in t&&typeof t.birthtimeNs=="bigint"?t.birthtimeNs:t.birthtimeMs}function Ll(t){return"ctimeNs"in t&&typeof t.ctimeNs=="bigint"?t.ctimeNs:t.ctimeMs}function ln(t){return{dev:t.dev,ino:t.ino,birthtime:ss(t)}}function Fi(t,e){let n=ln(t),i=ln(e);return ji(n,i)?ye(n,i):ye(n,i)&&ss(t)===ss(e)&&Ll(t)===Ll(e)&&t.size===e.size}async function Dl(t,e,n={}){if(!Number.isSafeInteger(e)||e<1)throw new Error("race-safe read byte limit must be a positive integer");let i=n.label??"file",r=n.bigint===!0,o=await it.lstat(t,{bigint:r});if(!o.isFile()||o.isSymbolicLink())throw new Me("not-regular-file",`${i} must be a regular file`);if(BigInt(o.size)>BigInt(e))throw new Me("too-large",`${i} exceeds ${e} bytes`);let s=await it.realpath(t);await n.verify?.("pre-open",{realPath:s,identity:ln(o)});let a=process.platform==="win32"?Di.O_RDONLY:Di.O_RDONLY|Di.O_NOFOLLOW|Di.O_NONBLOCK,c;try{c=await it.open(t,a)}catch(l){throw l.code==="ELOOP"?new Me("not-regular-file",`${i} must be a regular file`,{cause:l}):l}try{let[l,f,u]=await Promise.all([c.stat({bigint:r}),it.lstat(t,{bigint:r}),it.realpath(t)]);if(!l.isFile()||!f.isFile()||f.isSymbolicLink()||u!==s||!Fi(o,l)||!Fi(o,f))throw new Me("changed",`${i} changed while opening`);await n.verify?.("post-open",{realPath:u,identity:ln(l)}),await n.hooks?.afterOpen?.();let d=[],h=0,w=Buffer.allocUnsafe(Math.min(64*1024,e+1));for(;;){let y=e+1-h,{bytesRead:k}=await c.read(w,0,Math.min(w.length,y),null);if(k===0)break;if(h+=k,h>e)throw new Me("too-large",`${i} exceeds ${e} bytes`);d.push(Buffer.from(w.subarray(0,k)))}await n.hooks?.beforeFinalCheck?.();let[p,m,g]=await Promise.all([c.stat({bigint:r}),it.lstat(t,{bigint:r}),it.realpath(t)]);if(!m.isFile()||m.isSymbolicLink()||g!==s||!Fi(o,p)||!Fi(o,m))throw new Me("changed",`${i} changed while reading`);return await n.verify?.("post-read",{realPath:g,identity:ln(p)}),{bytes:Buffer.concat(d,h),stat:p,realPath:g}}finally{await c.close()}}var Me,Fl=B(()=>{"use strict";Ti();Me=class extends Error{reason;constructor(e,n,i){super(n,i),this.name="RaceSafeReadError",this.reason=e}}});import{promises as Wi}from"fs";import Be from"path";function kg(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}function as(t,e){let n=Be.relative(t,e);return n===""||!Be.isAbsolute(n)&&n!==".."&&!n.startsWith(`..${Be.sep}`)}async function Wl(t,e){let n=Be.resolve(t),i=await Wi.lstat(n);if(!i.isDirectory()||i.isSymbolicLink())throw new Error(`${e} project root must be a real directory`);return Wi.realpath(n)}async function Ml(t,e,n,i){let r=t;for(let o=0;o<n.length;o++){r=Be.join(r,n[o]);let s;try{s=await Wi.lstat(r)}catch(f){if(kg(f))return{exists:!1,kind:"missing"};throw f}let a=Be.relative(t,r).replaceAll("\\","/");if(s.isSymbolicLink())throw new Error(`${i.label} crosses a symbolic link or junction at ${a}`);let c=o===n.length-1;if(!c&&!s.isDirectory())throw new Error(`${i.label} ancestor ${a} must be a real directory`);if(c&&(i.expected==="file"&&!s.isFile()||i.expected==="directory"&&!s.isDirectory()||i.expected==="any"&&!s.isFile()&&!s.isDirectory()))throw new Error(`${i.label} must be a real ${i.expected}`);let l=await Wi.realpath(r);if(!as(e,l))throw new Error(`${i.label} resolves outside the project root`);if(c)return{exists:!0,kind:s.isFile()?"file":s.isDirectory()?"directory":"missing"}}return{exists:!0,kind:"directory"}}async function q(t,e,n){let i=Fe(e,n.label),r=Be.resolve(t),o=await Wl(r,n.label),s=i.split("/"),a=Be.resolve(r,...s);if(!as(r,a))throw new Error(`${n.label} must stay inside the project root`);let c=await Ml(r,o,s,n);return{projectRoot:r,target:a,relative:i,exists:c.exists,kind:c.kind}}async function Mi(t,e,n){return(await q(t,e,{...n,expected:"file"})).exists}async function H(t,e,n,i){let r=await q(t,e,{label:i.label,expected:"file"});if(!r.exists){let s=new Error(`${i.label} does not exist`);throw s.code="ENOENT",s}let o=await Wl(r.projectRoot,i.label);return Dl(r.target,n,{...i,verify:async(s,a)=>{if(!as(o,a.realPath))throw new Error(`${i.label} resolves outside the project root`);await Ml(r.projectRoot,o,r.relative.split("/"),{label:i.label,expected:"file"})}})}var se=B(()=>{"use strict";Fl();ve()});function Sg(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}function Cg(t){let e=(0,Kl.parseDocument)(t,{uniqueKeys:!0});if(e.errors.length>0)throw new Error(`Invalid global Comet config: ${e.errors[0].message}`);let n=e.toJS();if(n==null)return{};if(typeof n!="object"||Array.isArray(n))throw new Error("Invalid global Comet config: root must be a mapping");return n}function Ul(t){if(t.native?.pending_root_move)throw new Error("Global Comet config cannot contain native.pending_root_move");let e=t.native?(({pending_root_move:n,...i})=>i)(t.native):void 0;return{...t,schema:"comet.global.v1",...e?{native:e}:{}}}function Eg(t){let e=We(JSON.stringify({...t,schema:"comet.project.v1"})).config;if(!e)throw new Error("Invalid global Comet config: workflow template is incomplete");return Ul(e)}function xg(t){let e=We(t,{allowPartialProject:!0,allowMissingNativeFields:!0});if(!e.native&&!e.classic)return null;let n=e.native?"native":"classic",i=e.native?.language??e.classic?.language??"en",r=os(e.native?.artifact_root??"docs",i);return{schema:"comet.global.v1",default_workflow:n,workflows:[n],ambient_resume:e.ambient_resume,...e.native?{native:{...r.native,...e.native}}:{},...e.classic?{classic:e.classic}:{}}}function Hl(t){let e=Cg(t);if(Object.keys(e).length===0)return null;if(e.schema===void 0)return xg(t);if(e.schema!=="comet.global.v1")throw new Error("Unsupported Comet global schema");return Eg(e)}async function ls(t){try{let e=await H(t,Yl,Et,{label:"global Comet config"});return Hl(e.bytes.toString("utf8"))}catch(e){if(Sg(e))return null;throw e}}var Kl,Yl,us=B(()=>{"use strict";Kl=ze($e(),1);De();ve();se();Yl=".comet/config.yaml"});import{createHash as _g}from"crypto";function Pg(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}async function be(t,e={}){return(await Bi(t,e)).document}async function Rg(t){try{return(await H(t,un,Et,{label:un})).bytes}catch(e){if(Pg(e))return null;throw e}}function Ng(t){return t?{exists:!0,sha256:_g("sha256").update(t).digest("hex")}:{exists:!1,sha256:null}}async function Bi(t,e={}){let n=await Rg(t);return{document:n?We(n.toString("utf8"),e):null,identity:Ng(n)}}async function fs(t){return(await be(t))?.config??null}var un,Ke=B(()=>{"use strict";ve();se();un=".comet/config.yaml"});var Lk,ds=B(()=>{"use strict";De();Ke();se();Lk=16*1024});var ps=B(()=>{"use strict";De();ve();Ke();se();ds()});var Jk,Jl=B(()=>{"use strict";De();se();Jk=4*1024*1024});function zl(t,e){let n=t;for(let i of e)n+="\0"+(typeof i=="string"?i:JSON.stringify(i));return n}function Ql(t,e){return(...n)=>{let i=Gl;if(i===null)return e(...n);let r=zl(`async:${t}`,n),o=i.entries.get(r);if(o)return o.value;let s=e(...n).catch(a=>{throw i.entries.delete(r),a});return i.entries.set(r,{value:s}),s}}function ms(t,e){return(...n)=>{let i=Gl;if(i===null)return e(...n);let r=zl(`sync:${t}`,n),o=i.entries.get(r);if(o)return o.value;let s=e(...n);return i.entries.set(r,{value:s}),s}}var Gl,hs=B(()=>{"use strict";Gl=null});var Zk,Xl=B(()=>{"use strict";hs();Ke();Zk=Ql("hookWritePolicy",async t=>(await fs(t))?.hook??{allow_paths:[]})});var Zl=B(()=>{"use strict";Oi();De();Al();Ol();ve();us();se();Ke();ps();Jl();Xl();ds();es()});import{TextDecoder as $g}from"util";function eu(t){return{dev:t.dev,ino:t.ino,birthtime:t.birthtimeMs}}function qg(t,e){try{return new $g("utf-8",{fatal:!0}).decode(t.bytes)}catch(n){throw new Error(`${e} is not valid UTF-8`,{cause:n})}}async function gs(t,e,n,i,r={}){try{let o=await H(t,e,n,{label:i,hooks:r.hooks});return{result:o,text:qg(o,i)}}catch(o){let s=o.code;if(s==="ENOENT"||s==="ENOTDIR")return null;throw o}}async function fn(t,e,n,i,r={}){return(await gs(t,e,n,i,r))?.text??null}async function rt(t,e,n,i,r,o={}){if(Buffer.byteLength(n,"utf8")>i)throw new Error(`${r} exceeds ${i} bytes`);let s=await gs(t,e,i,r),a=await q(t,e,{label:r,expected:"file"});await ue(a.target,n,{containedRoot:a.projectRoot,beforeCommit:async()=>{await o.beforeCommit?.();let c=await gs(t,e,i,r);if(!(!s&&!c)){if(!s||!c)throw new Error(`${r} changed before commit`);if(s.result.realPath!==c.result.realPath||!ye(eu(s.result.stat),eu(c.result.stat))||s.text!==c.text)throw new Error(`${r} changed before commit`)}}})}async function Ki(t,e,n,i,r,o={}){let s=await fn(t,e,i,r);await rt(t,e,`${s??""}${n}`,i,r,o)}async function ws(t,e,n,i={}){let r=await q(t,e,{label:n,expected:"file"});return r.exists?Zo(r.target,{containedRoot:r.projectRoot,beforeRemove:i.beforeRemove}):!1}var Yi=B(()=>{"use strict";Zl();Ti()});var hu={};Ef(hu,{RUN_STATE_FILE:()=>er,applyRunStateToDocument:()=>ks,readRunState:()=>Ss,removeRunState:()=>Cs,runStateFromDocument:()=>Zi,writeRunState:()=>tr});import lw from"path";function En(t,e){let n=t[e];if(typeof n!="string"||n.length===0)throw new Error(`Invalid Run state: ${e} must be a non-empty string`);return n}function Cn(t,e){let n=En(t,e);if(lw.isAbsolute(n)||/^(?:[A-Za-z]:|[\\/]|~)/u.test(n)||n.split(/[\\/]/u).includes(".."))throw new Error(`Invalid Run state: ${e} must stay inside the change directory`);return n}function uw(t){let e=t.run_retries??"{}",n;try{n=typeof e=="string"?JSON.parse(e):e}catch(i){throw new Error("Invalid Run state: run_retries must be a JSON object",{cause:i})}if(!n||typeof n!="object"||Array.isArray(n))throw new Error("Invalid Run state: run_retries must be a JSON object");for(let i of Object.values(n))if(!Number.isInteger(i)||Number(i)<0)throw new Error("Invalid Run state: retry counts must be non-negative integers");return n}function Zi(t){if(!t.run_id)return null;let e=En(t,"run_id"),n=En(t,"skill"),i=En(t,"skill_version"),r=En(t,"skill_hash"),o=Cn(t,"pending_ref"),s=Cn(t,"trajectory_ref"),a=Cn(t,"context_ref"),c=Cn(t,"artifacts_ref"),l=Cn(t,"checkpoint_ref"),f=Number(t.iteration);if(!Number.isInteger(f)||f<0)throw new Error("Invalid Run state: iteration must be a non-negative integer");if(t.orchestration!=="deterministic"&&t.orchestration!=="adaptive")throw new Error("Invalid Run state: orchestration must be deterministic or adaptive");if(t.run_status!=="running"&&t.run_status!=="waiting"&&t.run_status!=="completed"&&t.run_status!=="failed")throw new Error("Invalid Run state: run_status is invalid");return{runId:e,skill:n,skillVersion:i,skillHash:r,orchestration:t.orchestration,currentStep:pu(t,"current_step"),iteration:f,pending:pu(t,"pending"),pendingRef:o,trajectoryRef:s,contextRef:a,artifactsRef:c,checkpointRef:l,status:t.run_status,retries:uw(t)}}function ks(t,e){e?t.run_id=e.runId:delete t.run_id}function fw(t){return{runId:t.runId,skill:t.skill,skillVersion:t.skillVersion,skillHash:t.skillHash,orchestration:t.orchestration,currentStep:t.currentStep,iteration:t.iteration,pending:t.pending,pendingRef:t.pendingRef,trajectoryRef:t.trajectoryRef,contextRef:t.contextRef,artifactsRef:t.artifactsRef,checkpointRef:t.checkpointRef,status:t.status,retries:t.retries}}function dw(t){let e={run_id:t.runId,skill:t.skill,skill_version:t.skillVersion,skill_hash:t.skillHash,orchestration:t.orchestration,current_step:t.currentStep,iteration:t.iteration,pending:t.pending,pending_ref:t.pendingRef,trajectory_ref:t.trajectoryRef,context_ref:t.contextRef,artifacts_ref:t.artifactsRef,checkpoint_ref:t.checkpointRef,run_status:t.status,run_retries:JSON.stringify(t.retries)};return Zi(e)}async function Ss(t,e={}){let n=await fn(t,er,mu,"Run state",e);if(n===null)return null;let i=JSON.parse(n);return dw(i)}async function tr(t,e,n={}){await rt(t,er,JSON.stringify(fw(e),null,2),mu,"Run state",n)}async function Cs(t,e={}){await ws(t,er,"Run state",e)}var pu,er,mu,nr=B(()=>{"use strict";Yi();pu=(t,e)=>{let n=t[e];return n==null?null:String(n)};er=".comet/run-state.json",mu=256*1024});var pf=ze($e(),1);import{spawnSync as Ky}from"child_process";import{createHash as df}from"crypto";import{promises as Yy}from"fs";import T from"path";import Vi from"path";Yi();import Ui from"path";var dn={trajectory:8*1024*1024,artifacts:1024*1024,context:1024*1024,pendingAction:256*1024,checkpoint:256*1024};function pn(t,e){if(Ui.isAbsolute(e))throw new Error("Run path must stay inside the change directory");let n=Ui.resolve(t),i=Ui.resolve(n,e);if(i!==n&&!i.startsWith(n+Ui.sep))throw new Error("Run path must stay inside the change directory")}async function mn(t,e,n,i={}){pn(t,e),await Ki(t,e,`${JSON.stringify(n)}
143
+ `,dn.trajectory,"Run trajectory",i)}async function Hi(t,e,n={}){pn(t,e);let i=await fn(t,e,dn.trajectory,"Run trajectory",n);return i===null?[]:i.split(/\r?\n/).map((r,o)=>({line:r,number:o+1})).filter(({line:r})=>r.length>0).map(({line:r,number:o})=>{try{return JSON.parse(r)}catch(s){throw new Error(`Invalid Trajectory event at line ${o}`,{cause:s})}})}async function tu(t,e,n,i={}){pn(t,e),await rt(t,e,JSON.stringify(n,null,2)+`
144
+ `,dn.artifacts,"Run artifacts",i)}async function nu(t,e,n,i={}){pn(t,e),await rt(t,e,n,dn.context,"Run context",i)}async function iu(t,e,n,i={}){pn(t,e),await rt(t,e,JSON.stringify(n,null,2)+`
145
+ `,dn.checkpoint,"Run checkpoint",i)}function Lg(t){if(t!=="build"&&t!=="verify")throw new Error(`Invalid command check scope: '${String(t)}'`)}function Dg(t,e="."){if(e.trim().length===0)throw new Error("Command check cwd cannot be blank");let n=Vi.resolve(t),i=Vi.resolve(n,e);if(i!==n&&!i.startsWith(n+Vi.sep))throw new Error(`Command check cwd must resolve within the project root: '${e}'`);return Vi.relative(n,i).replaceAll("\\","/")||"."}function Fg(t,e){if(e.type!=="command_check_recorded")return null;let n=e.data;if(typeof n!="object"||n===null||Array.isArray(n))return null;let{scope:i,command:r,exitCode:o,cwd:s}=n;if(i!=="build"&&i!=="verify"||typeof r!="string"||r.trim().length===0||!Number.isInteger(o)||typeof s!="string")return null;let a;try{a=Dg(t,s)}catch{return null}return{sequence:e.sequence,timestamp:e.timestamp,runId:e.runId,scope:i,command:r,exitCode:o,cwd:a}}async function ru(t,e,n,i){Lg(i);let r=await Hi(e,n.trajectoryRef);for(let o=r.length-1;o>=0;o-=1){let s=r[o];if(s.runId!==n.runId)continue;let a=Fg(t,s);if(a?.scope===i)return a}return null}import{promises as Zg}from"fs";import ke from"path";import{promises as su}from"fs";import $ from"path";import{promises as Wg}from"fs";async function hn(t){try{return await Wg.access(t),!0}catch(e){if(Mg(e))return!1;throw e}}function Mg(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}ve();Ke();ps();se();var gn=class extends Error{code="classic-layout-unavailable";constructor(e="Classic artifact layout is unavailable from .comet/config.yaml"){super(e),this.name="ClassicLayoutUnavailableError"}},ou=".comet/config.yaml";function au(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}async function cu(t){await q(t,ou,{label:ou,expected:"file"})}function Ji(t,e){let n=$.resolve(t),i=e==="docs"?$.join(n,"docs"):n,r=$.join(i,"openspec"),o=$.join(n,"docs","superpowers");return{projectRoot:n,artifactLayout:e,openSpecBase:i,openSpecRoot:r,changesDir:$.join(r,"changes"),archiveDir:$.join(r,"changes","archive"),specsDir:$.join(r,"specs"),superpowersRoot:o,superpowersSpecsDir:$.join(o,"specs"),superpowersPlansDir:$.join(o,"plans"),superpowersReportsDir:$.join(o,"reports")}}async function Bg(t){await cu(t);let e=await be(t,{allowPartialProject:!0,allowMissingNativeFields:!0});if(!e?.config)throw new gn;if(!(e.config.workflows??[e.config.default_workflow]).includes("classic"))throw new gn("Classic artifact layout is unavailable because Classic is not enabled");return e.classic?.artifact_layout??"legacy"}async function Kg(t,e){return Ji(t,e??await Bg(t))}async function Yg(t){try{return await su.lstat(t),!0}catch(e){if(au(e))return!1;throw e}}async function Ug(t,e){let n=await Kg(t,e),i=n.artifactLayout==="legacy"?"docs":"legacy",r=Ji(t,i).openSpecRoot,[o,s]=await Promise.all([q(n.projectRoot,z(n.projectRoot,n.openSpecRoot),{label:"Configured Classic OpenSpec root",expected:"directory"}),Yg(r)]),a=o.exists;return{paths:n,configuredRootExists:a,alternateRoot:r,alternateRootExists:s,dualRoots:a&&s}}async function Hg(t){let e=[t.openSpecRoot,t.changesDir,t.archiveDir,t.specsDir,t.superpowersRoot,t.superpowersSpecsDir,t.superpowersPlansDir,t.superpowersReportsDir];for(let n of e){let i=z(t.projectRoot,n);await q(t.projectRoot,i,{label:`Classic managed physical path ${i}`,expected:"directory"})}}async function Ye(t,e){let n=await Ug(t,e);if(await Hg(n.paths),!n.configuredRootExists){let i=z(n.paths.projectRoot,n.paths.openSpecRoot),r=z(n.paths.projectRoot,n.alternateRoot);throw new gn(`Configured Classic OpenSpec root is missing: ${i} (alternate ${r} is ${n.alternateRootExists?"present":"missing"})`)}return n.paths}async function ys(t,e){let n=$.join($.resolve(t),".comet","classic-root-move.json");if(await hn(n))throw new Error("Classic root move transaction is incomplete; inspect it with comet doctor and recover it explicitly before writing");let i=await Ye(t,e);if(!await hn(i.openSpecRoot))throw new Error(`Configured Classic OpenSpec root is missing: ${z(i.projectRoot,i.openSpecRoot)}`);return i}async function ot(t){let e=$.resolve(t),n=null;try{(await su.lstat(e)).isDirectory()||(e=$.dirname(e))}catch(i){if(!au(i))throw i}for(;;){$.basename(e)==="openspec"&&(n=$.dirname(e));let i=$.join(e,".comet","config.yaml"),r=!1;if(await hn(i))try{await cu(e);let s=(await be(e))?.value;r=!!s&&typeof s=="object"&&!Array.isArray(s)&&(s.schema==="comet.project.v1"||s.default_workflow!==void 0||s.native!==void 0)}catch{}if(r||await hn($.join(e,".git")))return e;let o=$.dirname(e);if(o===e)return n??$.resolve(t);e=o}}function z(t,e){return $.relative($.resolve(t),e).replaceAll("\\","/")}se();ve();import bn from"path";import{promises as Jg}from"fs";import zi from"path";De();ve();se();import wn from"path";var Vg=2*1024*1024;function lu(t,e,n){let i=wn.resolve(t),r=wn.isAbsolute(e)?wn.resolve(e):wn.resolve(i,e),o=wn.relative(i,r).replaceAll("\\","/");return{root:i,relative:Fe(o,n),target:r}}async function Ue(t,e,n){let i=lu(t,e,n.label);return q(i.root,i.relative,n)}async function yn(t,e,n){return(await Ue(t,e,{label:n.label,expected:n.expected??"any"})).exists}async function uu(t,e,n,i){return await yn(t,e,{label:n,expected:"file"})?(await Gi(t,e,{label:n,hooks:i})).byteLength>0:!1}async function te(t,e,n){return(await Gi(t,e,n)).toString("utf8")}async function Gi(t,e,n){let i=lu(t,e,n.label);return(await H(i.root,i.relative,n.maxBytes??Vg,{label:n.label,hooks:n.hooks})).bytes}function vn(t){return t?/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u.test(t)?t.includes("..")?"Change name cannot contain '..' (path traversal not allowed)":null:`Invalid change name: '${t}'
146
+ Valid format: lowercase kebab-case (a-z, 0-9, single hyphens)`:"Change name cannot be empty"}function bs(t){let e=vn(t);if(e)throw new Error(e)}function Gg(t,e){return{label:z(t,e),directory:e}}async function vs(t,e,n){let i=Gg(t,e);if(!(await Ue(t,e,{label:n,expected:"directory"})).exists)return{change:i,exists:!1,stateExists:!1};let o=await Ue(t,zi.join(e,".comet.yaml"),{label:`${n} state`,expected:"file"});return{change:i,exists:!0,stateExists:o.exists}}function zg(t,e){let n=e.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&");return new RegExp(`^\\d{4}-\\d{2}-\\d{2}-${n}$`,"u").test(t)}async function Qg(t,e,n,i={}){if(!i.skipExactCompatibility){let s=await vs(t,zi.join(e,n),`Classic archived change ${n}`);if(s.exists)return s.change}if(!(await Ue(t,e,{label:"Classic archive directory",expected:"directory"})).exists)return null;let o=[];for(let s of await Jg.readdir(e,{withFileTypes:!0})){if(!zg(s.name,n))continue;let a=await vs(t,zi.join(e,s.name),`Classic archived change ${s.name}`);a.exists&&a.stateExists&&o.push(a.change)}return o.sort((s,a)=>a.directory.localeCompare(s.directory))[0]??null}async function Qi(t,e=process.cwd()){bs(t);let n=await Ye(e),i=await vs(n.projectRoot,zi.join(n.changesDir,t),`Classic active change ${t}`);if(i.exists)return i.change;let r=await Qg(n.projectRoot,n.archiveDir,t);return r||i.change}function Xg(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}async function fu(t,e,n,i){let r=Fe(n,"Classic handoff artifact pointer");if((await q(t,r,{label:"Classic handoff artifact",expected:"file"})).exists)return null;let s=await Ye(t),a=`${z(t,s.changesDir)}/`,l=(s.artifactLayout==="docs"?[a,"openspec/changes/"]:[a]).find(y=>r.startsWith(y));if(!l)return null;let f=r.slice(l.length).split("/");if(f.length<4||f[1]!==".comet"||f.slice(2).some(y=>y.length===0))return null;let u=f[0];bs(u);let d=f.slice(2),h=bn.resolve(e);if(bn.dirname(h)!==bn.resolve(s.archiveDir))return null;let w=bn.basename(h),p=/^\d{4}-\d{2}-\d{2}-(.+)$/u.exec(w);if(w!==u&&p?.[1]!==u)return null;await q(t,z(t,h),{label:"Classic archived change directory",expected:"directory"});let m=bn.join(h,".comet",...d),g=z(t,m);try{return await H(t,g,i,{label:"Historical Classic archived handoff artifact"}),g}catch(y){if(Xg(y))return null;throw y}}se();var du=2*1024*1024;function kn(t,e){return ke.relative(t,e).split(ke.sep).join("/")}async function Sn(t,e,n,i,r){if(!n)return{code:e,satisfied:!1};let o=n.replaceAll("\\","/");if(r)return{code:e,satisfied:!1,source:o,detail:`Classic layout is unsafe or unavailable: ${r instanceof Error?r.message:String(r)}`};try{if(i){let a=i.artifactLayout==="legacy"?"docs":"legacy",c=z(t,Ji(t,a).openSpecRoot);if((o===c||o.startsWith(`${c}/`))&&(await q(t,o,{label:`${e} artifact`,expected:"file"})).exists)return{code:e,satisfied:!1,source:o,detail:"standalone OpenSpec root is not a Comet artifact root"}}let s=await Mi(t,o,{label:`${e} artifact`});return{code:e,satisfied:s,source:o,...s?{resolvedSource:o}:{}}}catch(s){return{code:e,satisfied:!1,source:o,detail:`unsafe artifact pointer outside the project or through a special path: ${s instanceof Error?s.message:String(s)}`}}}async function ew(t,e,n,i){try{i??=await Ye(t)}catch(o){return{code:"design.handoff",satisfied:!1,...n?{source:n.replaceAll("\\","/")}:{},detail:`Classic layout is unsafe or unavailable for handoff evidence: ${o instanceof Error?o.message:String(o)}`}}let r=await Sn(t,"design.handoff",n,i);if(!n||r.satisfied||r.detail)return r;try{let o=await fu(t,e,n,du);return o?{...r,satisfied:!0,resolvedSource:o,detail:`resolved historical legacy pointer from archived change: ${o}`}:r}catch(o){return{...r,satisfied:!1,detail:`unsafe archived handoff fallback: ${o instanceof Error?o.message:String(o)}`}}}async function Xi(t,e,n){return Sn(t,e,kn(t,n))}async function tw(t,e){let n=ke.join(e,"specs"),i;try{let s=kn(t,n);if(!(await q(t,s,{label:"OpenSpec delta-spec directory",expected:"directory"})).exists)return{code:"openspec.delta-spec",satisfied:!1};i=await Zg.readdir(n)}catch(s){return s.code==="ENOENT"?{code:"openspec.delta-spec",satisfied:!1}:{code:"openspec.delta-spec",satisfied:!1,detail:`unsafe delta-spec path: ${s instanceof Error?s.message:String(s)}`}}let r=i.map(s=>ke.join(n,s,"spec.md")),o=(await Promise.all(r.map(async s=>{try{return await Mi(t,kn(t,s),{label:"OpenSpec delta spec"})?s:null}catch{return null}}))).filter(s=>s!==null);return{code:"openspec.delta-spec",satisfied:o.length>0,source:o[0]?kn(t,o[0]):void 0,detail:`${o.length} delta spec${o.length===1?"":"s"}`}}async function nw(t,e){let n,i=kn(t,e);try{n=(await H(t,i,du,{label:"Classic tasks artifact"})).bytes.toString("utf8")}catch(s){return s.code==="ENOENT"?{code:"build.tasks-complete",satisfied:!1}:{code:"build.tasks-complete",satisfied:!1,source:i,detail:`unsafe tasks artifact: ${s instanceof Error?s.message:String(s)}`}}let r=[...n.matchAll(/^\s*[-*]\s+\[([ xX])\]\s+/gmu)],o=r.filter(s=>s[1].toLowerCase()==="x").length;return{code:"build.tasks-complete",satisfied:r.length>0&&o===r.length,source:i,detail:`${o} of ${r.length} tasks complete`}}function st(t,e){return t.some(n=>n.code===e&&n.satisfied)}async function He(t,e){let n=await ot(t),i=e.classic,r=ke.join(t,"proposal.md"),o=ke.join(t,"design.md"),s=ke.join(t,"tasks.md"),a=e.run?ke.resolve(t,e.run.checkpointRef):ke.join(t,".comet","checkpoint.json"),c,l;try{c=await Ye(n)}catch(d){l=d}let f=await Promise.all([Xi(n,"openspec.proposal",r),Xi(n,"openspec.design",o),Xi(n,"openspec.tasks",s),tw(n,t),Sn(n,"design.document",i?.designDoc??null,c,l),Sn(n,"build.plan",i?.plan??null,c,l),nw(n,s),Sn(n,"verification.report",i?.verificationReport??null,c,l),ew(n,t,i?.handoffContext??null,c),Xi(n,"run.checkpoint",a)]),u=f.find(d=>d.code==="design.handoff");return u&&!i?.handoffHash&&(u.satisfied=!1,u.detail="handoff hash is missing"),f.push({code:"archive.confirmed",satisfied:i?.archiveConfirmation==="confirmed"}),f}import{promises as Yu}from"fs";import ie from"path";import{fileURLToPath as Uu}from"url";import{createHash as ry,randomUUID as oy}from"crypto";import{promises as Os}from"fs";import Se from"path";function iw(t){return t.classicProfile??t.workflow}function rw(t){return!t.buildMode||!t.tddMode||!t.isolation||!t.verifyMode?!1:t.buildMode==="subagent-driven-development"?t.subagentDispatch==="confirmed":t.buildMode==="direct"?t.directOverride===!0:!0}function ow(t){return t.buildMode==="direct"&&t.tddMode==="direct"&&t.isolation!==null&&t.verifyMode==="light"}function sw(t,e,n){if(e.verifyResult==="fail")return t==="full"?"full.build.fix":`${t}.build.execute`;if(t==="full"){if(!st(n,"build.plan"))return"full.build.plan";if(e.buildPause==="plan-ready")return"full.build.plan-ready";if(!rw(e))return"full.build.configure"}else if(!ow(e))throw new Error(`${t} build configuration is incomplete`);return st(n,"build.tasks-complete")?`${t}.build.complete`:`${t}.build.execute`}function aw(t,e,n){return e.verifyResult!=="pass"||!st(n,"verification.report")?`${t}.verify.run`:`${t}.verify.branch`}function cw(t,e){if(e.verifyResult!=="pass")throw new Error("archive requires verify_result=pass");return e.archiveConfirmation==="confirmed"?`${t}.archive.execute`:`${t}.archive.confirm`}function xt(t,e){let n=iw(t);if(t.archived&&t.phase!=="archive")throw new Error("archived=true requires phase=archive");if(t.archived)return"completed";if(n!=="full"&&t.phase==="design")throw new Error(`${n} workflow cannot enter design`);switch(t.phase){case"open":return`${n}.open`;case"design":return st(e,"design.handoff")?"full.design.document":"full.design.handoff";case"build":return sw(n,t,e);case"verify":return aw(n,t,e);case"archive":return cw(n,t)}}var or=ze($e(),1);De();se();import rr from"path";nr();var gu=["full","hotfix","tweak"],at=1,pw=["open","design","build","verify","archive"],mw=["en","zh-CN"],hw=["off","beta"],gw=["subagent-driven-development","executing-plans","direct"],ww=["plan-ready"],yw=["confirmed"],vw=["tdd","direct"],bw=["off","standard","thorough"],kw=["current","branch","worktree"],Sw=["light","full"],Cw=["pending","pass","fail"],Ew=["pending","handled"],xw=["pending","confirmed"],Pt=["workflow","language","phase","context_compression","build_mode","build_pause","subagent_dispatch","tdd_mode","review_mode","isolation","bound_branch","verify_mode","auto_transition","base_ref","design_doc","plan","verify_result","verify_failures","verification_report","branch_status","created_at","verified_at","archive_confirmation","archived","direct_override","handoff_context","handoff_hash","classic_profile","classic_migration"],xs=["run_id"],_w=new Set([...Pt,...xs]),Pw=["workflow","phase","design_doc","plan","build_mode","isolation","verify_mode","verify_result","verified_at","archived"];function wu(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function _t(t,e){let n=t[e];if(n==null||n==="")return null;if(typeof n!="string")throw new Error(`Invalid Classic state: ${e} must be a string or null`);return n}function Q(t,e,n,i=!0){let r=t[e];if(r==null||r===""){if(i)return null;throw new Error(`Invalid Classic state: ${e} is required`)}if(typeof r!="string"||!n.includes(r))throw new Error(`Invalid Classic state: ${e} must be one of ${n.join(", ")}${i?" or null":""}`);return r}function Es(t,e,n=!0){let i=t[e];if(i==null||i===""){if(n)return null;throw new Error(`Invalid Classic state: ${e} is required`)}if(typeof i!="boolean")throw new Error(`Invalid Classic state: ${e} must be true or false`);return i}function Rw(t,e,n=0){let i=t[e];if(i==null||i==="")return n;if(typeof i!="number"||!Number.isInteger(i)||i<0)throw new Error(`Invalid Classic state: ${e} must be a non-negative integer`);return i}function ir(t,e){let n=_t(t,e);if(n===null)return null;if(/^(?:[A-Za-z]:|[\\/]|~)/u.test(n)||n.split(/[\\/]/u).includes(".."))throw new Error(`Invalid Classic state: ${e} must be a relative repository path`);return n}function Nw(t,e){let n=_t(t,e);if(n!==null&&!/^[a-f0-9]{64}$/u.test(n))throw new Error(`Invalid Classic state: ${e} must be a sha256 hex digest`);return n}function Aw(t){let e=t.classic_migration;if(e==null||e==="")return null;if(e!==at)throw new Error(`Invalid Classic state: classic_migration must be ${at}`);return e}function Ow(t){if(!Pt.some(n=>wu(t,n)))return null;for(let n of Pw)if(!wu(t,n))return null;return{workflow:Q(t,"workflow",gu,!1),language:Q(t,"language",mw),phase:Q(t,"phase",pw,!1),contextCompression:Q(t,"context_compression",hw),buildMode:Q(t,"build_mode",gw),buildPause:Q(t,"build_pause",ww),subagentDispatch:Q(t,"subagent_dispatch",yw),tddMode:Q(t,"tdd_mode",vw),reviewMode:Q(t,"review_mode",bw),isolation:Q(t,"isolation",kw),boundBranch:_t(t,"bound_branch"),verifyMode:Q(t,"verify_mode",Sw),autoTransition:Es(t,"auto_transition"),baseRef:_t(t,"base_ref"),designDoc:ir(t,"design_doc"),plan:ir(t,"plan"),verifyResult:Q(t,"verify_result",Cw,!1),verifyFailures:Rw(t,"verify_failures"),verificationReport:ir(t,"verification_report"),branchStatus:Q(t,"branch_status",Ew),createdAt:_t(t,"created_at"),verifiedAt:_t(t,"verified_at"),archiveConfirmation:Q(t,"archive_confirmation",xw),archived:Es(t,"archived",!1),directOverride:Es(t,"direct_override"),handoffContext:ir(t,"handoff_context"),handoffHash:Nw(t,"handoff_hash"),classicProfile:Q(t,"classic_profile",gu),classicMigration:Aw(t)}}function _s(t,e){let n=e??null;if(n===null&&e===void 0&&t.run_id&&t.skill)try{n=Zi(t)}catch(i){let r=i instanceof Error?i.message:String(i);throw new Error(r.replace(/^Invalid Run state:/u,"Invalid Classic state:"),{cause:i})}return{classic:Ow(t),run:n,unknownKeys:Object.keys(t).filter(i=>!_w.has(i))}}function yu(t){return{workflow:t.workflow,language:t.language,phase:t.phase,context_compression:t.contextCompression,build_mode:t.buildMode,build_pause:t.buildPause,subagent_dispatch:t.subagentDispatch,tdd_mode:t.tddMode,review_mode:t.reviewMode,isolation:t.isolation,bound_branch:t.boundBranch,verify_mode:t.verifyMode,auto_transition:t.autoTransition,base_ref:t.baseRef,design_doc:t.designDoc,plan:t.plan,verify_result:t.verifyResult,verify_failures:t.verifyFailures,verification_report:t.verificationReport,branch_status:t.branchStatus,created_at:t.createdAt,verified_at:t.verifiedAt,archive_confirmation:t.archiveConfirmation,archived:t.archived,direct_override:t.directOverride,handoff_context:t.handoffContext,handoff_hash:t.handoffHash,classic_profile:t.classicProfile,classic_migration:t.classicMigration}}nr();var jw=2*1024*1024;function xn(t){let e=t.toJS();if(e===null)return{};if(typeof e!="object"||Array.isArray(e))throw new Error("Invalid Classic state document: root must be a mapping");return e}function vu(t,e,n){t.get(e)!==n&&t.set(e,n)}function Tw(t,e){if(e.classic)for(let[n,i]of Object.entries(yu(e.classic)))vu(t,n,i);else for(let n of Pt)t.delete(n);ks(t.toJS(),e.run),e.run?vu(t,"run_id",e.run.runId):t.delete("run_id")}function Iw(t){let e=["skill","skill_version","skill_hash","orchestration","current_step","iteration","pending","pending_ref","trajectory_ref","context_ref","artifacts_ref","checkpoint_ref","run_status","run_retries"];for(let n of e)t.delete(n)}function $w(t){let e=!1;for(let n of["build_command","verify_command"])t.has(n)&&(t.delete(n),e=!0);return e}async function bu(t){let e;try{e=(await H(rr.dirname(t),rr.basename(t),jw,{label:"Classic state document"})).bytes.toString("utf8")}catch(i){if(i.code!=="ENOENT")throw i;return new or.Document({})}let n=(0,or.parseDocument)(e);if(n.errors.length>0)throw new Error(`Invalid Classic state document: ${n.errors[0].message}`);return xn(n),n}async function Ve(t,e={}){let n=e.migrate!==!1,i=rr.join(t,".comet.yaml"),r=await bu(i),o=xn(r),s=$w(r);s&&(o=xn(r));let a=await Ss(t);if(!a&&o.run_id&&o.skill){let{runStateFromDocument:c}=await Promise.resolve().then(()=>(nr(),hu));a=c(o),a&&n&&(await tr(t,a),Iw(r),s=!0)}return s&&n&&await ue(i,r.toString(),{containedRoot:t}),_s(xn(r),a)}async function sr(t,e,n={}){let i=rr.join(t,".comet.yaml"),r=await bu(i);Tw(r,{...e,unknownKeys:e.unknownKeys??[]}),_s(xn(r),e.run??null),await ue(i,r.toString(),{containedRoot:t,beforeCommit:n.beforeCommit}),e.run?await tr(t,e.run):await Cs(t)}function ku(t,e,n){return{runId:e,skill:t.definition.metadata.name,skillVersion:t.definition.metadata.version,skillHash:n,orchestration:t.definition.orchestration.mode,currentStep:t.definition.orchestration.entry??null,iteration:0,pending:null,pendingRef:".comet/pending-action.json",trajectoryRef:".comet/trajectory.jsonl",contextRef:".comet/context.md",artifactsRef:".comet/artifacts.json",checkpointRef:".comet/checkpoint.json",status:"running",retries:{}}}import{createHash as $u,randomUUID as Zw}from"crypto";import{promises as Y}from"fs";import F from"path";var Eu=ze($e(),1);import{promises as Ps}from"fs";import ae from"path";var qw=["invoke_skill","call_tool","handoff","ask_user","checkpoint"],Lw=["deterministic","adaptive"],Dw=["function","mcp","script","agent"],Fw=["none","read","write","external"],Ww=["progress","step","completion"],Mw=["artifact_exists","state_equals"];function ct(t,e,n){return new Error(`${t}: ${e} ${n}`)}function ne(t,e,n="document"){if(t===null||typeof t!="object"||Array.isArray(t))throw ct(e,n,"must be an object")}function Je(t,e,n){if(!Array.isArray(t))throw ct(e,n,"must be an array")}function X(t,e,n){if(typeof t!="string")throw ct(e,n,"must be a string")}function fe(t,e,n,i){e in t&&X(t[e],n,`${i}.${e}`)}function xu(t,e,n,i){if(e in t&&typeof t[e]!="boolean")throw ct(n,`${i}.${e}`,"must be a boolean")}function Ge(t,e,n,i){if(typeof t!="string"||!e.includes(t))throw ct(n,i,`must be one of ${e.join(", ")}`)}function ar(t,e,n){Je(t,e,n),t.forEach((i,r)=>{X(i,e,`${n}[${r}]`)})}function Su(t,e,n){ne(t,e,n),X(t.name,e,`${n}.name`),X(t.description,e,`${n}.description`),xu(t,"required",e,n)}function Bw(t,e,n){ne(t,e,n),X(t.id,e,`${n}.id`),fe(t,"source",e,n),fe(t,"version",e,n)}function Kw(t,e,n){ne(t,e,n),X(t.id,e,`${n}.id`),X(t.role,e,`${n}.role`),fe(t,"instructions",e,n)}function Yw(t,e,n){ne(t,e,n),X(t.id,e,`${n}.id`),Ge(t.kind,Dw,e,`${n}.kind`),X(t.source,e,`${n}.source`),Ge(t.sideEffect,Fw,e,`${n}.sideEffect`),xu(t,"requiresConfirmation",e,n)}function Uw(t,e,n){ne(t,e,n),Ge(t.type,qw,e,`${n}.type`),fe(t,"ref",e,n),fe(t,"prompt",e,n),fe(t,"question",e,n),"options"in t&&ar(t.options,e,`${n}.options`)}function Hw(t,e,n){ne(t,e,n),X(t.id,e,`${n}.id`),Uw(t.action,e,`${n}.action`),fe(t,"next",e,n),"completionEvals"in t&&ar(t.completionEvals,e,`${n}.completionEvals`)}function Vw(t,e){let n="goal";ne(t,e,n),X(t.statement,e,`${n}.statement`),Je(t.inputs,e,`${n}.inputs`),t.inputs.forEach((i,r)=>{Su(i,e,`${n}.inputs[${r}]`)}),Je(t.outputs,e,`${n}.outputs`),t.outputs.forEach((i,r)=>{Su(i,e,`${n}.outputs[${r}]`)}),ar(t.success,e,`${n}.success`)}function Jw(t,e){let n="orchestration";ne(t,e,n),Ge(t.mode,Lw,e,`${n}.mode`),fe(t,"entry",e,n),"steps"in t&&(Je(t.steps,e,`${n}.steps`),t.steps.forEach((i,r)=>{Hw(i,e,`${n}.steps[${r}]`)}))}function _u(t,e){return ne(t,e),Ge(t.apiVersion,["comet/v1alpha1"],e,"apiVersion"),Ge(t.kind,["Skill"],e,"kind"),ne(t.metadata,e,"metadata"),X(t.metadata.name,e,"metadata.name"),X(t.metadata.version,e,"metadata.version"),X(t.metadata.description,e,"metadata.description"),Vw(t.goal,e),Jw(t.orchestration,e),Je(t.skills,e,"skills"),t.skills.forEach((n,i)=>{Bw(n,e,`skills[${i}]`)}),Je(t.agents,e,"agents"),t.agents.forEach((n,i)=>{Kw(n,e,`agents[${i}]`)}),Je(t.tools,e,"tools"),t.tools.forEach((n,i)=>{Yw(n,e,`tools[${i}]`)}),t}function Pu(t,e){ne(t,e);for(let n of["allowedSkills","allowedAgents","allowedTools","confirmationRequiredFor"])n in t&&ar(t[n],e,n);for(let n of["maxIterations","maxRetriesPerAction"])if(n in t&&(typeof t[n]!="number"||!Number.isFinite(t[n])))throw ct(e,n,"must be a finite number");return t}function Gw(t,e){return ne(t,e),"runtime"in t&&Ru(t.runtime,e,"runtime"),t}function Ru(t,e,n){return Je(t,e,n),t.forEach((i,r)=>{let o=`${n}[${r}]`;ne(i,e,o),X(i.id,e,`${o}.id`),Ge(i.scope,Ww,e,`${o}.scope`),Ge(i.type,Mw,e,`${o}.type`),fe(i,"artifact",e,o),fe(i,"field",e,o),fe(i,"equals",e,o)}),t}async function Rs(t){let e=await Ps.readFile(t,"utf8");try{return(0,Eu.parse)(e)}catch(n){let i=n instanceof Error?n.message:String(n);throw ct(t,"document",i)}}async function zw(t){try{return await Rs(t)}catch(e){if(e.code==="ENOENT")return null;throw e}}async function Cu(t){try{return await Ps.access(t),!0}catch(e){if(e.code==="ENOENT")return!1;throw e}}async function Qw(t){let e=ae.join(t,"checks.yaml"),n=ae.join(t,"evals.yaml"),[i,r]=await Promise.all([Cu(e),Cu(n)]);if(r)throw new Error(`${n}: evals.yaml is no longer supported; use checks.yaml`);return i?{document:Gw(await Rs(e),e)}:{document:null}}async function Nu(t){let e=ae.resolve(t.root),n=ae.resolve(t.controlRoot);t.requireSkillMarkdown&&await Ps.access(ae.join(e,"SKILL.md"));let i=ae.join(n,"skill.yaml"),r=ae.join(n,"guardrails.yaml"),o=_u(await Rs(i),i),s=await zw(r),a=s===null?null:Pu(s,r),c=await Qw(n),l={allowedSkills:o.skills.map(f=>f.id),allowedAgents:o.agents.map(f=>f.id),allowedTools:o.tools.map(f=>f.id),maxIterations:50,maxRetriesPerAction:3,confirmationRequiredFor:o.tools.filter(f=>f.requiresConfirmation).map(f=>f.id)};return{root:e,packageKind:t.packageKind==="runtime"?"runtime":void 0,definition:o,guardrails:{...l,...a},evals:c.document?.runtime??[]}}async function Au(t){let e=ae.resolve(t);return Nu({root:e,controlRoot:ae.join(e,"comet"),packageKind:"skill",requireSkillMarkdown:!0})}async function Ou(t){let e=ae.resolve(t);return Nu({root:e,controlRoot:e,packageKind:"runtime",requireSkillMarkdown:!1})}function ju(t,e,n=ae.join(e,"package.json")){ne(t,n);let i=t.packageKind==="runtime"?"runtime":void 0,r=_u(t.definition,n),o=Pu(t.guardrails,n),s=Ru(t.evals,n,"evals"),a={allowedSkills:r.skills.map(c=>c.id),allowedAgents:r.agents.map(c=>c.id),allowedTools:r.tools.map(c=>c.id),maxIterations:50,maxRetriesPerAction:3,confirmationRequiredFor:r.tools.filter(c=>c.requiresConfirmation).map(c=>c.id)};return{root:ae.resolve(e),packageKind:i,definition:r,guardrails:{...a,...o},evals:s}}import Tu from"path";function Xw(t,e,n,i){t.type==="invoke_skill"&&!e.definition.skills.some(r=>r.id===t.ref)&&n.push(`step ${i} references undeclared skill: ${t.ref??"(missing)"}`),t.type==="call_tool"&&!e.definition.tools.some(r=>r.id===t.ref)&&n.push(`step ${i} references undeclared tool: ${t.ref??"(missing)"}`),t.type==="handoff"&&!e.definition.agents.some(r=>r.id===t.ref)&&n.push(`step ${i} references undeclared agent: ${t.ref??"(missing)"}`),t.type==="ask_user"&&!t.question&&n.push(`step ${i} ask_user action requires question`)}function Iu(t){let e=[],{definition:n,guardrails:i,evals:r}=t;n.apiVersion!=="comet/v1alpha1"&&e.push("unsupported apiVersion"),n.kind!=="Skill"&&e.push("kind must be Skill"),n.metadata.name||e.push("metadata.name is required"),n.goal.statement||e.push("goal.statement is required"),i.maxIterations<1&&e.push("maxIterations must be at least 1"),i.maxRetriesPerAction<0&&e.push("maxRetriesPerAction must not be negative");let o=n.orchestration.steps??[];if(n.orchestration.mode==="adaptive")(n.orchestration.entry||o.length>0)&&e.push("adaptive orchestration must not define entry or steps");else{let s=new Set;for(let a of o)s.has(a.id)&&e.push(`duplicate step id: ${a.id}`),s.add(a.id),Xw(a.action,t,e,a.id);(!n.orchestration.entry||!s.has(n.orchestration.entry))&&e.push(`orchestration.entry references unknown step: ${n.orchestration.entry??"(missing)"}`);for(let a of o){a.next&&!s.has(a.next)&&e.push(`step ${a.id} has unknown next step: ${a.next}`);for(let c of a.completionEvals??[])r.some(l=>l.id===c)||e.push(`step ${a.id} references unknown eval: ${c}`)}}for(let s of n.tools){if(s.kind!=="script")continue;let a=Tu.posix.normalize(s.source.replaceAll("\\","/"));(Tu.isAbsolute(s.source)||a===".."||a.startsWith("../"))&&e.push(`script tool ${s.id} must reference a relative path inside the Skill package`)}for(let s of i.allowedSkills)n.skills.some(a=>a.id===s)||e.push(`guardrails allow undeclared skill: ${s}`);for(let s of i.allowedAgents)n.agents.some(a=>a.id===s)||e.push(`guardrails allow undeclared agent: ${s}`);for(let s of i.allowedTools)n.tools.some(a=>a.id===s)||e.push(`guardrails allow undeclared tool: ${s}`);return e}function cr(t){return Array.isArray(t)?t.map(cr):t&&typeof t=="object"?Object.fromEntries(Object.entries(t).sort(([e],[n])=>e.localeCompare(n)).map(([e,n])=>[e,cr(n)])):t}function ey(t){return cr({...t.packageKind==="runtime"?{packageKind:"runtime"}:{},definition:t.definition,guardrails:t.guardrails,evals:t.evals})}function ty(t){return F.posix.normalize(t.replaceAll("\\","/"))}function Rt(t,e,n){let i=F.relative(t,e);if(!(i===""||!F.isAbsolute(i)&&!i.startsWith(`..${F.sep}`)))throw new Error(`${n} resolves outside the Skill package`)}async function qu(t,e,n){let i=ty(e);if(F.posix.isAbsolute(i)||i===".."||i.startsWith("../"))throw new Error(`${n} resolves outside the Skill package`);let r=F.resolve(t,...i.split("/"));Rt(t,r,n);let o;try{o=await Y.realpath(r)}catch(s){throw s.code==="ENOENT"?new Error(`${n} does not exist: ${e}`,{cause:s}):s}if(Rt(t,o,n),!(await Y.stat(o)).isFile())throw new Error(`${n} is not a file: ${e}`);return{path:i,content:await Y.readFile(o)}}async function ny(t){let e=await Y.realpath(t.root),n=t.packageKind==="runtime"?[]:[await qu(e,"SKILL.md","SKILL.md")];for(let i of t.definition.tools)i.kind==="script"&&n.push(await qu(e,i.source,`Script tool ${i.id}`));return n.sort((i,r)=>i.path.localeCompare(r.path))}function iy(t,e){let n=e.map(i=>({path:i.path,sha256:$u("sha256").update(i.content).digest("hex")}));return $u("sha256").update(JSON.stringify(cr({package:t,files:n}))).digest("hex")}function Fu(t){return JSON.stringify(t,null,2)+`
147
+ `}async function Wu(t){let e=ey(t),n=await ny(t);return{document:e,files:n,hash:iy(e,n)}}async function lr(t){return(await Wu(t)).hash}async function Lu(t){try{return await Y.access(t),!0}catch(e){if(e.code==="ENOENT")return!1;throw e}}async function Du(t,e){try{if((await Y.readFile(F.join(t,"sha256"),"utf8")).trim()!==e.hash)throw new Error("hash mismatch");if(await Y.readFile(F.join(t,"package.json"),"utf8")!==Fu(e.document))throw new Error("package mismatch");for(let r of e.files)if(!(await Y.readFile(F.join(t,...r.path.split("/")))).equals(r.content))throw new Error(`file mismatch: ${r.path}`)}catch(n){throw new Error(`Existing Skill snapshot is invalid: ${e.hash}`,{cause:n})}}async function Ns(t,e){let n=await Wu(t),i=F.resolve(e,".comet","skill-snapshots"),r=F.join(i,n.hash);if(await Y.mkdir(i,{recursive:!0}),await Lu(r))return await Du(r,n),{hash:n.hash,snapshotDir:r};let o=F.join(i,`.tmp-${Zw()}`);Rt(i,o,"Temporary snapshot"),Rt(i,r,"Published snapshot");try{await Y.mkdir(o);for(let s of n.files){let a=F.join(o,...s.path.split("/"));Rt(o,a,`Snapshot file ${s.path}`),await Y.mkdir(F.dirname(a),{recursive:!0}),await Y.writeFile(a,s.content)}await Y.writeFile(F.join(o,"package.json"),Fu(n.document)),await Y.writeFile(F.join(o,"sha256"),n.hash+`
148
+ `),await Y.rename(o,r)}catch(s){if(await Lu(r)){try{await Du(r,n)}finally{await Y.rm(o,{recursive:!0,force:!0})}return{hash:n.hash,snapshotDir:r}}throw await Y.rm(o,{recursive:!0,force:!0}),s}return{hash:n.hash,snapshotDir:r}}async function As(t,e){if(!/^[a-f0-9]{64}$/u.test(e))throw new Error(`Invalid Skill snapshot hash: ${e}`);let n=F.resolve(t,".comet","skill-snapshots"),i=F.join(n,e);Rt(n,i,"Skill snapshot");try{let r=(await Y.readFile(F.join(i,"sha256"),"utf8")).trim();if(r!==e)throw new Error(`stored hash is ${r||"(empty)"}`);let o=F.join(i,"package.json"),s=JSON.parse(await Y.readFile(o,"utf8")),a=ju(s,i,o),c=Iu(a);if(c.length>0)throw new Error(c.map(f=>` - ${f}`).join(`
149
+ `));let l=await lr(a);if(l!==e)throw new Error(`calculated hash is ${l}`);return a}catch(r){throw new Error(`Skill snapshot is invalid or missing: ${e}`,{cause:r})}}async function Mu(t){try{return await Os.access(t),!0}catch(e){if(e.code==="ENOENT")return!1;throw e}}function Bu(t){return ry("sha256").update(t).digest("hex")}function sy(t){return Bu(JSON.stringify(Object.fromEntries(Object.entries(t).sort(([e],[n])=>e.localeCompare(n)))))}function ay(t){return t.replaceAll(".","_").replaceAll("-","_")}async function cy(t,e){let n=await ot(t),i=Object.fromEntries(e.filter(s=>s.satisfied&&s.source).map(s=>[ay(s.code),s.source])),r=Se.join(t,"subagent-progress.md");await Mu(r)&&(i.subagent_progress=Se.relative(n,r).split(Se.sep).join("/"));let o=e.find(s=>s.code==="design.handoff"&&s.satisfied);return o?.source&&(i.handoff_context=o.source),i}function ly(t,e,n){return[{sequence:1,timestamp:n,type:"run_started",runId:t.runId,data:{skill:t.skill,skillVersion:t.skillVersion,skillHash:t.skillHash}},{sequence:2,timestamp:n,type:"state_migrated",runId:t.runId,data:{kind:"classic",migrationVersion:at,profile:e,source:"pre-migration"}}]}async function uy(t){await Promise.all(t.map(e=>Os.rm(e,{recursive:!0,force:!0})))}async function Ku(t,e){let n=await Ve(t);if(!n.classic)throw new Error("Classic migration requires a legacy state projection");let i=n.classic,r=i.classicProfile??i.workflow;if(n.run){if(i.classicMigration!==at)throw new Error("Classic Run exists without a supported classic_migration marker");if(n.run.skill!==e.skillPackage.definition.metadata.name)throw new Error(`Classic Run skill mismatch: expected ${e.skillPackage.definition.metadata.name}, got ${n.run.skill}`);if(await lr(e.skillPackage)!==n.run.skillHash)return await As(t,n.run.skillHash),{classic:i,run:n.run,evidence:await He(t,n),migrated:!1,snapshotDir:Se.join(t,".comet","skill-snapshots",n.run.skillHash)};let d=await Ns(e.skillPackage,t);return{classic:i,run:n.run,evidence:await He(t,n),migrated:!1,snapshotDir:d.snapshotDir}}let o=await He(t,n),s=xt(i,o);if(!e.skillPackage.definition.orchestration.steps?.some(u=>u.id===s))throw new Error(`Classic Skill package does not define resolved step: ${s}`);let a=await lr(e.skillPackage),c=Se.join(t,".comet","skill-snapshots",a),l=await Mu(c),f=[];try{let u=await Ns(e.skillPackage,t),d=ku(e.skillPackage,e.runId?.()??oy(),u.hash);d.currentStep=s,s==="completed"&&(d.status="completed");let h={...i,classicProfile:r,classicMigration:at},w=await cy(t,o),p=await ot(t),m=o.find(C=>C.code==="design.handoff"&&C.satisfied),g=null;m?.source&&(g=await te(p,m.resolvedSource??m.source,{label:"Classic migration handoff context",hooks:e.handoffReadHooks}),await nu(t,d.contextRef,g),f.push(Se.resolve(t,d.contextRef))),await tu(t,d.artifactsRef,w),f.push(Se.resolve(t,d.artifactsRef));let y=(e.now?.()??new Date).toISOString(),k={runId:d.runId,stateVersion:1,trajectoryOffset:2,contextHash:g===null?null:Bu(g),artifactsHash:sy(w),createdAt:y};await iu(t,d.checkpointRef,k),f.push(Se.resolve(t,d.checkpointRef)),f.push(Se.resolve(t,d.trajectoryRef));for(let C of ly(d,r,y))await mn(t,d.trajectoryRef,C);return await sr(t,{classic:h,run:d,unknownKeys:n.unknownKeys}),{classic:h,run:d,evidence:o,migrated:!0,snapshotDir:u.snapshotDir}}catch(u){throw await uy(f),l||await Os.rm(c,{recursive:!0,force:!0}),u}}async function fy(t){try{return(await Yu.stat(t)).isDirectory()}catch(e){if(e.code==="ENOENT")return!1;throw e}}async function ur(t){try{return(await Yu.stat(t)).isFile()}catch(e){if(e.code==="ENOENT")return!1;throw e}}async function dy(t){return await fy(t)?await ur(ie.join(t,"skill.yaml"))?!0:await ur(ie.join(t,"SKILL.md"))&&await ur(ie.join(t,"comet","skill.yaml")):!1}function py(t){return{root:t,packageKind:"runtime",definition:{apiVersion:"comet/v1alpha1",kind:"Skill",metadata:{name:"comet-classic",version:"1",description:"Internal compatibility orchestration for classic Comet full, hotfix, and tweak workflows"},goal:{statement:"Advance or restore a classic Comet Run without changing the user command surface",inputs:[{name:"classic-state",description:"Validated ClassicState consistent with the Run projection",required:!0},{name:"evidence",description:"Structured evidence produced by the Classic Evidence collector",required:!0}],outputs:[{name:"run-state",description:"Atomically synchronized Classic and Run state",required:!0}],success:["Legacy fields and Run fields remain consistent","Every step invokes only a declared public Comet Skill","The completed state passes its completion eval"]},orchestration:{mode:"deterministic",entry:"full.open",steps:[{id:"full.open",action:{type:"invoke_skill",ref:"comet-open"},next:"full.design.handoff"},{id:"full.design.handoff",action:{type:"invoke_skill",ref:"comet-design"},next:"full.design.document"},{id:"full.design.document",action:{type:"invoke_skill",ref:"comet-design"},next:"full.build.plan"},{id:"full.build.plan",action:{type:"invoke_skill",ref:"comet-build"},next:"full.build.plan-ready"},{id:"full.build.plan-ready",action:{type:"invoke_skill",ref:"comet-build"},next:"full.build.configure"},{id:"full.build.configure",action:{type:"invoke_skill",ref:"comet-build"},next:"full.build.execute"},{id:"full.build.execute",action:{type:"invoke_skill",ref:"comet-build"},next:"full.build.complete"},{id:"full.build.complete",action:{type:"invoke_skill",ref:"comet-build"},next:"full.verify.run"},{id:"full.build.fix",action:{type:"invoke_skill",ref:"comet-build"},next:"full.build.execute"},{id:"full.verify.run",action:{type:"invoke_skill",ref:"comet-verify"},next:"full.verify.branch"},{id:"full.verify.branch",action:{type:"invoke_skill",ref:"comet-verify"},next:"full.archive.confirm"},{id:"full.archive.confirm",action:{type:"invoke_skill",ref:"comet-archive"},next:"full.archive.execute"},{id:"full.archive.execute",action:{type:"invoke_skill",ref:"comet-archive"},next:"completed"},{id:"hotfix.open",action:{type:"invoke_skill",ref:"comet-hotfix"},next:"hotfix.build.execute"},{id:"hotfix.build.execute",action:{type:"invoke_skill",ref:"comet-build"},next:"hotfix.build.complete"},{id:"hotfix.build.complete",action:{type:"invoke_skill",ref:"comet-build"},next:"hotfix.verify.run"},{id:"hotfix.verify.run",action:{type:"invoke_skill",ref:"comet-verify"},next:"hotfix.verify.branch"},{id:"hotfix.verify.branch",action:{type:"invoke_skill",ref:"comet-verify"},next:"hotfix.archive.confirm"},{id:"hotfix.archive.confirm",action:{type:"invoke_skill",ref:"comet-archive"},next:"hotfix.archive.execute"},{id:"hotfix.archive.execute",action:{type:"invoke_skill",ref:"comet-archive"},next:"completed"},{id:"tweak.open",action:{type:"invoke_skill",ref:"comet-tweak"},next:"tweak.build.execute"},{id:"tweak.build.execute",action:{type:"invoke_skill",ref:"comet-build"},next:"tweak.build.complete"},{id:"tweak.build.complete",action:{type:"invoke_skill",ref:"comet-build"},next:"tweak.verify.run"},{id:"tweak.verify.run",action:{type:"invoke_skill",ref:"comet-verify"},next:"tweak.verify.branch"},{id:"tweak.verify.branch",action:{type:"invoke_skill",ref:"comet-verify"},next:"tweak.archive.confirm"},{id:"tweak.archive.confirm",action:{type:"invoke_skill",ref:"comet-archive"},next:"tweak.archive.execute"},{id:"tweak.archive.execute",action:{type:"invoke_skill",ref:"comet-archive"},next:"completed"},{id:"completed",action:{type:"checkpoint"},completionEvals:["classic-completed"]}]},skills:[{id:"comet-open"},{id:"comet-design"},{id:"comet-build"},{id:"comet-verify"},{id:"comet-archive"},{id:"comet-hotfix"},{id:"comet-tweak"}],agents:[],tools:[]},guardrails:{allowedSkills:["comet-open","comet-design","comet-build","comet-verify","comet-archive","comet-hotfix","comet-tweak"],allowedAgents:[],allowedTools:[],maxIterations:500,maxRetriesPerAction:3,confirmationRequiredFor:[]},evals:[{id:"classic-completed",scope:"completion",type:"state_equals",field:"status",equals:"completed"}]}}async function my(){let t=ie.dirname(Uu(import.meta.url)),e=[process.env.COMET_RUNTIME_CLASSIC_ROOT,ie.resolve(t,"..","runtime","classic"),ie.resolve(t,"..","..","comet","runtime","classic"),ie.resolve(t,"..","..","assets","skills","comet","runtime","classic"),ie.resolve("assets","skills","comet","runtime","classic"),process.env.COMET_CLASSIC_SKILL_ROOT,ie.resolve(t,"..","..","comet-classic"),ie.resolve(t,"..","..","assets","skills","comet-classic"),ie.resolve("assets","skills","comet-classic")].filter(n=>!!n);for(let n of e)if(await dy(n))return n;return null}async function hy(t){return await ur(ie.join(t,"skill.yaml"))?Ou(t):Au(t)}async function fr(t){let e=await my();return Ku(t,{skillPackage:e?await hy(e):py(ie.dirname(Uu(import.meta.url)))})}async function Hu(t){let e=await Ve(t),n=Array.from(new Set(e.unknownKeys)).sort();if(n.length>0)throw new Error(`Invalid Classic state: unknown field(s): ${n.join(", ")}`);return fr(t)}async function Vu(t,e,n,i){let r=await Ve(t);if(!r.classic||!r.run)throw new Error("Classic transition requires synchronized Classic and Run projections");let o=await He(t,{classic:e,run:n,unknownKeys:r.unknownKeys}),s=xt(e,o),a={...n,currentStep:s,iteration:n.iteration+1,status:s==="completed"?"completed":"running"};await sr(t,{classic:e,run:a,unknownKeys:r.unknownKeys});let c=await Hi(t,a.trajectoryRef);return await mn(t,a.trajectoryRef,{sequence:c.length+1,timestamp:new Date().toISOString(),type:"state_transitioned",runId:a.runId,data:{kind:"classic",fromStep:n.currentStep,toStep:s,...i}}),a}var Ju={"full.open":["openspec.proposal","openspec.tasks"],"full.design.handoff":["openspec.proposal","openspec.design","openspec.tasks"],"full.design.document":["design.handoff"],"full.build.plan":["openspec.tasks"],"full.build.plan-ready":["build.plan"],"full.build.configure":["build.plan"],"full.build.execute":["build.plan"],"full.build.complete":["build.tasks-complete"],"full.verify.run":["build.tasks-complete"],"full.verify.branch":["verification.report"],"full.archive.confirm":["verification.report"],"full.archive.execute":["archive.confirmed"]};function gy(t){return Ju[t]?Ju[t]:t.endsWith(".open")?["openspec.proposal","openspec.tasks"]:t.endsWith(".build.execute")?[]:t.endsWith(".build.complete")?["build.tasks-complete"]:t.endsWith(".verify.run")?["build.tasks-complete"]:t.endsWith(".verify.branch")?["verification.report"]:t.endsWith(".archive.confirm")?["verification.report"]:t.endsWith(".archive.execute")?["archive.confirmed"]:[]}function Gu(t,e){let n=gy(t),i=n.filter(r=>!st(e,r));return{stepId:t,passed:i.length===0,requiredEvidence:n,missingEvidence:i}}function wy(t){switch(t){case"open":return"/comet-open";case"design":return"/comet-design";case"build":return"/comet-build";case"verify":return"/comet-verify";case"archive":return"/comet-archive";default:return null}}async function zu(t,e){try{let n=await Hu(t),i=await He(t,{classic:n.classic,run:n.run,unknownKeys:[]}),r=xt(n.classic,i);return{name:e,valid:!0,workflow:n.classic.workflow,phase:n.classic.phase,currentStep:r,nextCommand:wy(n.classic.phase),runtimeMode:"engine-projection",runtimeEval:Gu(r,i),evidence:i}}catch(n){return{name:e,valid:!1,workflow:"unknown",phase:"invalid",currentStep:null,nextCommand:null,runtimeMode:"invalid",runtimeEval:null,evidence:[],error:n instanceof Error?n.message:String(n)}}}Yi();import yy from"path";var vy=yy.join(".comet","state-events.jsonl"),by=8*1024*1024;async function Qu(t,e){let n={schemaVersion:1,timestamp:new Date().toISOString(),...e};return await Ki(t,vy,`${JSON.stringify(n)}
150
+ `,by,"Classic state event log"),n}var ky={"open-complete":{event:"open-complete",from:"open",guardRefs:["open-artifacts-present"]},"design-complete":{event:"design-complete",from:"design",guardRefs:["design-evidence-present"]},"build-complete":{event:"build-complete",from:"build",guardRefs:["build-decisions-selected"]},"verify-pass":{event:"verify-pass",from:"verify",guardRefs:["verification-report-present"]},"verify-fail":{event:"verify-fail",from:"verify",guardRefs:["verification-failed"]},"archive-confirm":{event:"archive-confirm",from:"archive",guardRefs:["archive-final-confirmation"]},"archive-reopen":{event:"archive-reopen",from:"archive",guardRefs:["archive-not-finalized"]},archived:{event:"archived",from:"archive",guardRefs:["verify-result-pass","archive-confirmed"]},"preset-escalate":{event:"preset-escalate",from:"build",guardRefs:["preset-workflow"]}},Xu={open:"open-complete",design:"design-complete",build:"build-complete",verify:"verify-pass"};function Sy(t){return t.toISOString().slice(0,10)}function R(t,e,n,i){let r=t[n];t[n]=i,r!==i&&e.push({field:n,from:r,to:i})}function Zu(t,e,n={}){let i=ky[e];if(t.phase!==i.from)throw new Error(`Cannot apply ${e}: phase is '${t.phase}', expected '${i.from}'`);let r={...t},o=[],s=n.now??new Date;if(e==="open-complete")R(r,o,"phase",r.workflow==="full"?"design":"build");else if(e==="design-complete")R(r,o,"phase","build");else if(e==="build-complete"){let a=r.verifyResult==="fail";R(r,o,"phase","verify"),R(r,o,"verifyResult","pending"),R(r,o,"branchStatus","pending"),a||R(r,o,"verificationReport",null)}else if(e==="verify-pass")R(r,o,"verifyResult","pass"),R(r,o,"verifyFailures",0),R(r,o,"phase","archive"),R(r,o,"verifiedAt",Sy(s)),R(r,o,"archiveConfirmation","pending"),R(r,o,"branchStatus","pending");else if(e==="verify-fail")R(r,o,"verifyResult","fail"),R(r,o,"verifyFailures",r.verifyFailures+1),R(r,o,"phase","build"),R(r,o,"branchStatus","pending");else if(e==="preset-escalate"){if(r.workflow!=="hotfix"&&r.workflow!=="tweak")throw new Error(`Cannot apply ${e}: workflow must be hotfix or tweak, got '${r.workflow}'`);R(r,o,"workflow","full"),R(r,o,"classicProfile","full"),R(r,o,"phase","design"),R(r,o,"designDoc",null),R(r,o,"buildPause",null),R(r,o,"buildMode",null),R(r,o,"subagentDispatch",null),R(r,o,"tddMode",null),R(r,o,"reviewMode",null),R(r,o,"isolation",null),R(r,o,"boundBranch",null),R(r,o,"verifyMode",null),R(r,o,"directOverride",null)}else if(e==="archive-confirm"){if(r.verifyResult!=="pass")throw new Error(`Cannot apply ${e}: verifyResult must be pass`);if(r.archived)throw new Error(`Cannot apply ${e}: already archived`);R(r,o,"archiveConfirmation","confirmed")}else if(e==="archive-reopen"){if(r.archived)throw new Error(`Cannot apply ${e}: already archived`);R(r,o,"verifyResult","pending"),R(r,o,"verifyFailures",0),R(r,o,"phase","verify"),R(r,o,"verifiedAt",null),R(r,o,"archiveConfirmation",null),R(r,o,"branchStatus","pending")}else{if(r.verifyResult!=="pass")throw new Error(`Cannot apply ${e}: verifyResult must be pass`);if(r.archiveConfirmation!=="confirmed")throw new Error(`Cannot apply ${e}: archiveConfirmation must be confirmed`);R(r,o,"archived",!0)}return{classic:r,effects:o,definition:i}}var Nn=ze($e(),1);import tf from"path";import{AsyncLocalStorage as Cy}from"async_hooks";import{promises as ef}from"fs";import _n from"path";var dr=new Cy;function Ey(t,e){let n=_n.relative(t,e);return n===""||!_n.isAbsolute(n)&&n!==".."&&!n.startsWith(`..${_n.sep}`)}async function xy(t){let e=_n.resolve(t.invocationCwd??process.cwd()),n=_n.resolve(t.projectRoot??await ot(e)),[i,r]=await Promise.all([ef.realpath(e),ef.realpath(n)]);if(!Ey(r,i))throw new Error(`Classic command invocation cwd is outside the discovered project: ${e}`);return{invocationCwd:e,projectRoot:n}}async function pr(t,e){let n=dr.getStore();if(n)return e(n);let i=await xy(t);return dr.run(i,()=>e(i))}function I(){let t=dr.getStore();if(!t)throw new Error("Classic command project context is unavailable");return t.projectRoot}function mr(){let t=dr.getStore();if(!t)throw new Error("Classic command invocation context is unavailable");return t.invocationCwd}var _y="\x1B[32m",Pn="\x1B[31m",Py="\x1B[33m",Ry="\x1B[0m",Ny=["workflow","phase","design_doc","plan","build_mode","isolation","verify_mode","verify_result","verified_at","archived"],Ay={workflow:["full","hotfix","tweak"],language:["en","zh-CN"],phase:["open","design","build","verify","archive"],context_compression:["off","beta"],build_mode:["subagent-driven-development","executing-plans","direct"],build_pause:["plan-ready"],subagent_dispatch:["confirmed"],tdd_mode:["tdd","direct"],review_mode:["off","standard","thorough"],isolation:["current","branch","worktree"],verify_mode:["light","full"],auto_transition:["true","false"],verify_result:["pending","pass","fail"],branch_status:["pending","handled"],archive_confirmation:["pending","confirmed"],archived:["true","false"],direct_override:["true","false"],classic_profile:["full","hotfix","tweak"],classic_migration:["1"]},Oy=new Set([...Pt,...xs,"classic_profile","classic_migration"]);function lt(t,e){return`${t}${e}${Ry}`}function Rn(t){return t==null?"":typeof t=="object"?JSON.stringify(t):String(t)}var nf=async(t,e)=>pr(e,async()=>{let n=t[0],i=vn(n);if(i)return{exitCode:1,stderr:lt(Pn,`ERROR: ${i}`)};let r=I(),{directory:o,label:s}=await Qi(n,r),a=tf.join(o,".comet.yaml"),c=[`[VALIDATE] ${s}/.comet.yaml`],l=0,f=0,u=m=>{l+=1,c.push(lt(Pn,` FAIL: ${m}`))},d=m=>{f+=1,c.push(lt(Py,` WARN: ${m}`))},h;try{h=await te(r,a,{label:`Classic state ${s}/.comet.yaml`})}catch(m){if(m.code==="ENOENT")return u(".comet.yaml does not exist"),c.push("",lt(Pn,`${l} error(s), ${f} warning(s) — validation FAILED`)),{exitCode:1,stderr:c.join(`
151
+ `)};throw m}let w=(0,Nn.parseDocument)(h);if(w.errors.length>0||!(0,Nn.isMap)(w.contents)){for(let m of w.errors)u(m.message);return(0,Nn.isMap)(w.contents)||u("document root must be a mapping"),c.push("",lt(Pn,`${l} error(s), ${f} warning(s) — validation FAILED`)),{exitCode:1,stderr:c.join(`
152
+ `)}}let p=w.toJS();for(let m of Ny)Object.prototype.hasOwnProperty.call(p,m)||u(`missing required field '${m}'`);for(let[m,g]of Object.entries(Ay)){if(!Object.prototype.hasOwnProperty.call(p,m))continue;let y=Rn(p[m]);if(!y){m==="auto_transition"&&u(`${m}='' is not valid. Expected: ${g.join(" ")}`);continue}g.includes(y)||u(`${m}='${y}' is not valid. Expected: ${g.join(" ")}`)}if(Object.prototype.hasOwnProperty.call(p,"bound_branch")){let m=p.bound_branch;m!==null&&typeof m!="string"&&u(`bound_branch='${Rn(m)}' is not a string or null`)}if(Object.prototype.hasOwnProperty.call(p,"verify_failures")){let m=p.verify_failures;(typeof m!="number"||!Number.isInteger(m)||m<0)&&u(`verify_failures='${Rn(m)}' is not a non-negative integer`)}for(let m of["design_doc","plan","handoff_context","verification_report"]){let g=Rn(p[m]);if(g){if(/^(?:[A-Za-z]:|[\\/]|~)/u.test(g)||g.split(/[\\/]/u).includes("..")){u(`${m}='${g}' must be a relative repository path`);continue}try{await yn(r,tf.resolve(r,g),{label:`${m} artifact pointer`,expected:"file"})||u(`${m}='${g}' does not exist on disk`)}catch(y){u(`${m}='${g}' is unsafe: ${y instanceof Error?y.message:String(y)}`)}}}for(let m of["handoff_hash"]){let g=Rn(p[m]);g&&!/^[a-f0-9]{64}$/u.test(g)&&u(`${m}='${g}' is not a sha256 hex digest`)}for(let m of Object.keys(p))Oy.has(m)||d(`unknown field '${m}' found`);return c.push(""),l>0?(c.push(lt(Pn,`${l} error(s), ${f} warning(s) — validation FAILED`)),{exitCode:1,stderr:c.join(`
153
+ `)}):(c.push(lt(_y,`0 errors, ${f} warning(s) — validation PASSED`)),{exitCode:0,stderr:c.join(`
154
+ `)})});us();Ke();import jy from"os";import hr from"path";function Ty(t={}){let e=t.cwd??process.cwd(),n=t.homeDir??jy.homedir(),i=[{file:hr.resolve(e,".comet","config.yaml"),source:".comet/config.yaml",scope:"project"},{file:hr.resolve(n,".comet","config.yaml"),source:"~/.comet/config.yaml",scope:"global"}];return i.filter((r,o)=>i.findIndex(s=>s.file===r.file)===o)}async function rf(t,e={}){for(let n of Ty(e)){let i=hr.dirname(hr.dirname(n.file)),r=n.scope==="global"?(await ls(i))?.classic:(await be(i,{allowPartialProject:!0}))?.value.classic;if(!r||typeof r!="object"||Array.isArray(r))continue;let o=r[t];if(o!=null)return{value:String(o),source:n.source}}return null}Ke();var js=ze($e(),1);hs();import{execFileSync as of}from"child_process";import{randomUUID as Iy}from"crypto";import{promises as An}from"fs";import sf from"path";function $y(t){try{let e=of("git",["rev-parse","--abbrev-ref","HEAD"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();return e&&e!=="HEAD"?e:null}catch{return null}}var qy=ms("liveGitBranch",t=>$y(t));function Ly(t){try{return of("git",["rev-parse","--is-inside-work-tree"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()==="true"}catch{return!1}}var Dy=ms("isGitWorkTree",t=>Ly(t)),Fy=["current","branch","worktree"];function af(t){return Fy.includes(t)}function Wy(t){return af(t.isolation)?t.boundBranch===null&&t.currentBranch===null&&t.gitWorkTree===!1?{status:"not-applicable"}:t.boundBranch===null?t.currentBranch===null?{status:"unbound-detached"}:{status:"needs-heal",branch:t.currentBranch}:t.currentBranch===t.boundBranch?{status:"ok"}:{status:"drift",boundBranch:t.boundBranch,currentBranch:t.currentBranch}:{status:"not-applicable"}}async function cf(t,e){let n=sf.join(t,".comet.yaml"),i=(0,js.parseDocument)(await An.readFile(n,"utf8"),{uniqueKeys:!1});if(i.errors.length>0)throw new Error(`Invalid .comet.yaml: ${i.errors[0].message}`);let r=i.toJS()??{},o=typeof r.isolation=="string"?r.isolation:null,s=typeof r.bound_branch=="string"&&r.bound_branch!==""?r.bound_branch:null,a=af(o),c=qy(e.cwd),l=a&&s===null&&c===null?Dy(e.cwd):!0,f=Wy({isolation:o,boundBranch:s,currentBranch:c,gitWorkTree:l});return f.status==="needs-heal"&&e.heal?(await My(t,f.branch),{status:"healed",branch:f.branch,bindingRequired:a,currentBranch:c}):{...f,bindingRequired:a,currentBranch:c}}async function My(t,e){let n=sf.join(t,".comet.yaml"),i=(0,js.parseDocument)(await An.readFile(n,"utf8"),{uniqueKeys:!1});i.set("bound_branch",e);let r=`${n}.${Iy()}.tmp`;try{await An.writeFile(r,i.toString(),"utf8"),await An.rename(r,n)}catch(o){throw await An.rm(r,{force:!0}),o}}function By(t){return t??"detached HEAD"}function lf(t,e,n){return`change '${t}' is bound to branch '${e}', but current branch is '${By(n)}'.
155
+ Next: ask the user to confirm — switch back to '${e}', or run \`comet state rebind ${t}\` after explicit confirmation.`}function uf(t){return`change '${t}' uses a branch-bound workspace mode but has no bound branch and HEAD is detached; checkout a branch first before continuing.`}var Uy="\x1B[32m",Hy="\x1B[31m",Vy="\x1B[33m",qs="\x1B[0m",Jy=["open","design","build","verify","archive"],Gy={open:"=== Guard: open → next ===",design:"=== Guard: design → build ===",build:"=== Guard: build → verify ===",verify:"=== Guard: verify → archive ===",archive:"=== Guard: archive completeness ==="},zy={open:" [APPLY] .comet.yaml updated: phase=PLACEHOLDER",design:" [APPLY] .comet.yaml updated: phase=build",build:" [APPLY] .comet.yaml updated: phase=verify, verify_result=pending",verify:" [APPLY] .comet.yaml updated: phase=archive, verify_result=pass"},Qy={branchStatus:"branch_status",phase:"phase",verificationReport:"verification_report",verifiedAt:"verified_at",verifyResult:"verify_result"};function Nt(t){return`${Uy}${t}${qs}`}function Ce(t){return`${Hy}${t}${qs}`}function Xy(t){return`${Vy}${t}${qs}`}function Zy(t){return Qy[t]??String(t)}function ev(t){return t===null?"null":t===void 0?"":typeof t=="object"?JSON.stringify(t):String(t)}var de=class extends Error{constructor(n,i=1){super(n);this.exitCode=i}exitCode},$s=class{stderr=[];diagnostics;toResult(e=0){return{exitCode:e,...this.diagnostics?{stdout:JSON.stringify({diagnostics:this.diagnostics})+`
156
156
  `}:{},...this.stderr.length>0?{stderr:this.stderr.join(`
157
157
  `)+`
158
- `}:{}}}};async function Y(t){let e=I();return yn(e,t,{label:`Classic guard path ${T.relative(e,T.resolve(e,t)).replaceAll("\\","/")}`})}async function H(t){let e=I();return iu(e,t,`Classic guard file ${T.relative(e,T.resolve(e,t)).replaceAll("\\","/")}`)}function Jy(t){let e=vn(t);if(e)throw new fe(Se(`ERROR: ${e}`))}async function Hy(t){return(await Qi(t,I())).directory}async function A(t,e){let n=T.join(t,".comet.yaml"),i=(0,of.parseDocument)(await te(I(),n,{label:`Classic state ${t}/.comet.yaml`}),{uniqueKeys:!1});if(i.errors.length>0)throw new fe(`ERROR: Invalid .comet.yaml: ${i.errors[0].message}`);let s=i.toJS()[e];return s==null?"":typeof s=="object"?JSON.stringify(s):String(s)}async function Gy(t,e){let n=await A(e,t);return n&&n!=="null"?n:(await zu(t,{cwd:I()}))?.value??""}async function zy(t){let e=await Gy("language",t);if(!e)return"en";if(e==="en"||e==="zh-CN")return e;throw new Error(`configured language '${e}' is invalid; expected en or zh-CN.`)}function Qy(t){let e=[],n=!1;for(let i of t.split(/\r?\n/u)){if(/^\s*```/u.test(i)){n=!n;continue}n||e.push(i)}return e.join(`
159
- `)}function Xy(t){return t.match(/[\u4e00-\u9fff]/gu)?.length??0}function Zy(t){return t.match(/[A-Za-z][A-Za-z0-9_-]{2,}/gu)?.length??0}async function he(t,e){let n=await zy(t),i=Qy(await te(I(),e,{label:`Classic language-check artifact ${e}`})),r=Xy(i),s=Zy(i);return n==="zh-CN"&&r<20&&s>=20?S(`configured language is zh-CN, but ${e} appears to be English-dominant (cjk_chars=${r}, english_words=${s}).
160
- Next: regenerate or rewrite this artifact in Chinese while preserving necessary technical terms.`):n==="en"&&r>20&&r>s?S(`configured language is en, but ${e} appears to be Chinese-dominant (cjk_chars=${r}, english_words=${s}).
161
- Next: regenerate or rewrite this artifact in English while preserving necessary technical terms.`):_()}async function af(t){return sf("sha256").update(await Gi(I(),t,{label:`Classic handoff source ${t}`})).digest("hex")}async function $o(t){let e=z(I(),t),n=[`${e}/proposal.md`,`${e}/design.md`,`${e}/tasks.md`],i=`${e}/specs`;if(await Y(i)){await Be(I(),i,{label:`Classic delta-spec directory ${i}`,expected:"directory"});for(let r of(await qy.readdir(i)).sort()){let s=`${i}/${r}/spec.md`;await Y(s)&&n.push(s)}}return n}async function ev(t){let e=[];for(let n of await $o(t))await Y(n)&&e.push(`path:${n}`,`sha256:${await af(n)}`);return sf("sha256").update(e.join(`
162
- `)).digest("hex")}async function tv(t,e){if(!await Y(t))throw new fe(Se(`FATAL: change directory not found: ${t}`));if(!await Y(T.join(t,".comet.yaml")))throw new fe(Se(`FATAL: .comet.yaml not found in ${t}`));await Be(I(),T.join(t,".comet"),{label:`Classic runtime directory for ${e}`,expected:"directory"});let n=await Gu([e],{json:!1});if(n.exitCode!==0)throw n.stderr&&process.stderr.write(n.stderr.endsWith(`
158
+ `}:{}}}};async function U(t){let e=I();return yn(e,t,{label:`Classic guard path ${T.relative(e,T.resolve(e,t)).replaceAll("\\","/")}`})}async function G(t){let e=I();return uu(e,t,`Classic guard file ${T.relative(e,T.resolve(e,t)).replaceAll("\\","/")}`)}function tv(t){let e=vn(t);if(e)throw new de(Ce(`ERROR: ${e}`))}async function nv(t){return(await Qi(t,I())).directory}async function O(t,e){let n=T.join(t,".comet.yaml"),i=(0,pf.parseDocument)(await te(I(),n,{label:`Classic state ${t}/.comet.yaml`}),{uniqueKeys:!1});if(i.errors.length>0)throw new de(`ERROR: Invalid .comet.yaml: ${i.errors[0].message}`);let o=i.toJS()[e];return o==null?"":typeof o=="object"?JSON.stringify(o):String(o)}async function iv(t,e){let n=await O(e,t);return n&&n!=="null"?n:(await rf(t,{cwd:I()}))?.value??""}async function rv(t){let e=await iv("language",t);if(!e)return"en";if(e==="en"||e==="zh-CN")return e;throw new Error(`configured language '${e}' is invalid; expected en or zh-CN.`)}function ov(t){let e=[],n=!1;for(let i of t.split(/\r?\n/u)){if(/^\s*```/u.test(i)){n=!n;continue}n||e.push(i)}return e.join(`
159
+ `)}function sv(t){return t.match(/[\u4e00-\u9fff]/gu)?.length??0}function av(t){return t.match(/[A-Za-z][A-Za-z0-9_-]{2,}/gu)?.length??0}async function he(t,e){let n=await rv(t),i=ov(await te(I(),e,{label:`Classic language-check artifact ${e}`})),r=sv(i),o=av(i);return n==="zh-CN"&&r<20&&o>=20?S(`configured language is zh-CN, but ${e} appears to be English-dominant (cjk_chars=${r}, english_words=${o}).
160
+ Next: regenerate or rewrite this artifact in Chinese while preserving necessary technical terms.`):n==="en"&&r>20&&r>o?S(`configured language is en, but ${e} appears to be Chinese-dominant (cjk_chars=${r}, english_words=${o}).
161
+ Next: regenerate or rewrite this artifact in English while preserving necessary technical terms.`):_()}async function mf(t){return df("sha256").update(await Gi(I(),t,{label:`Classic handoff source ${t}`})).digest("hex")}async function Ls(t){let e=z(I(),t),n=[`${e}/proposal.md`,`${e}/design.md`,`${e}/tasks.md`],i=`${e}/specs`;if(await U(i)){let r=await Ue(I(),i,{label:`Classic delta-spec directory ${i}`,expected:"directory"});for(let o of(await Yy.readdir(r.target)).sort()){let s=`${i}/${o}/spec.md`;await U(s)&&n.push(s)}}return n}async function cv(t){let e=[];for(let n of await Ls(t))await U(n)&&e.push(`path:${n}`,`sha256:${await mf(n)}`);return df("sha256").update(e.join(`
162
+ `)).digest("hex")}async function lv(t,e){if(!await U(t))throw new de(Ce(`FATAL: change directory not found: ${t}`));if(!await U(T.join(t,".comet.yaml")))throw new de(Ce(`FATAL: .comet.yaml not found in ${t}`));await Ue(I(),T.join(t,".comet"),{label:`Classic runtime directory for ${e}`,expected:"directory"});let n=await nf([e],{json:!1});if(n.exitCode!==0)throw n.stderr&&process.stderr.write(n.stderr.endsWith(`
163
163
  `)?n.stderr:`${n.stderr}
164
- `),new fe(Se("FATAL: .comet.yaml schema validation failed"));let i=await Ye(t),r=Array.from(new Set(i.unknownKeys)).sort();if(r.length>0)throw new fe(Se(`FATAL: .comet.yaml has unknown field(s): ${r.join(", ")}`))}function nv(t,e){if(e.passed){if(t.stderr.push(Rt(` [PASS] ${e.description}`)),e.detail)for(let n of e.detail.split(`
165
- `))t.stderr.push(Rt(` ${n}`))}else if(t.stderr.push(Se(` [FAIL] ${e.description}`)),e.detail)for(let n of e.detail.split(`
166
- `))t.stderr.push(Se(` ${n}`))}function E(t,e){return async()=>{try{let n=await e();return{description:t,passed:n.passed,detail:("detail"in n?n.detail:"")??""}}catch(n){return{description:t,passed:!1,detail:n instanceof Error?n.message:String(n)}}}}function _(t){return{passed:!0,...t?{detail:t}:{}}}function S(t){return{passed:!1,detail:t}}async function Nt(t,e){let n=!1;for(let i of e){let r=await i();nv(t,r),r.passed||(n=!0)}return n}var iv=["package.json with a build script","pom.xml","Cargo.toml"];async function rv(t){try{let e=await Me(I(),{allowPartialProject:!0});return e?Object.prototype.hasOwnProperty.call(e.value,t):!1}catch(e){throw new Error(`.comet/config.yaml is invalid YAML (${e instanceof Error?e.message:String(e)}); cannot check for removed "${t}" field. Fix the config and retry.`,{cause:e})}}function sv(t){return{status:1,output:`${t} has been removed from .comet/config.yaml. Delete this field and run any required ${t==="build_command"?"build":"verification"} command manually before retrying.`}}function ov(t){let e=$y(t,{shell:!0,cwd:mr(),encoding:"utf8",timeout:3e5});return{status:e.status??1,output:`${e.stdout??""}${e.stderr??""}`.replace(/\n+$/u,"")}}function An(t){return T.resolve(mr(),t)}async function av(){let t=An("package.json");return await Y(t)&&typeof JSON.parse(await te(I(),t,{label:"package.json"})).scripts?.build=="string"?"npm run build":await Y(An("pom.xml"))?process.platform==="win32"?await Y(An("mvnw.cmd"))?"mvnw.cmd compile -q":"mvn.cmd compile -q":await Y(An("mvnw"))?"./mvnw compile -q":"mvn compile -q":await Y(An("Cargo.toml"))?"cargo build":null}function rf(t){return`Evidence: recorded command-check at ${t.timestamp}; command: ${t.command}; cwd: ${t.cwd}`}function Ao(t,e,n){return`comet state record-check ${t} ${e} --command "${n}" --exit-code 0`}async function cf(t,e,n,i){if(process.env.COMET_SKIP_BUILD==="1")return{status:0,output:"SKIPPED via COMET_SKIP_BUILD=1"};let r=i==="build"?["build_command"]:["verify_command","build_command"];for(let a of r)if(await rv(a))return sv(a);let s=i==="build"?await av():null;if(s)return ov(s);let o=await Ql(I(),t,n,i);return o?o.exitCode!==0?{status:o.exitCode,output:`Latest recorded ${i} check failed with exit code ${o.exitCode}.
167
- ${rf(o)}
164
+ `),new de(Ce("FATAL: .comet.yaml schema validation failed"));let i=await Ve(t),r=Array.from(new Set(i.unknownKeys)).sort();if(r.length>0)throw new de(Ce(`FATAL: .comet.yaml has unknown field(s): ${r.join(", ")}`))}function uv(t,e){if(e.passed){if(t.stderr.push(Nt(` [PASS] ${e.description}`)),e.detail)for(let n of e.detail.split(`
165
+ `))t.stderr.push(Nt(` ${n}`))}else if(t.stderr.push(Ce(` [FAIL] ${e.description}`)),e.detail)for(let n of e.detail.split(`
166
+ `))t.stderr.push(Ce(` ${n}`))}function E(t,e){return async()=>{try{let n=await e();return{description:t,passed:n.passed,detail:("detail"in n?n.detail:"")??""}}catch(n){return{description:t,passed:!1,detail:n instanceof Error?n.message:String(n)}}}}function _(t){return{passed:!0,...t?{detail:t}:{}}}function S(t){return{passed:!1,detail:t}}async function At(t,e){let n=!1;for(let i of e){let r=await i();uv(t,r),r.passed||(n=!0)}return n}var fv=["package.json with a build script","pom.xml","Cargo.toml"];async function dv(t){try{let e=await be(I(),{allowPartialProject:!0});return e?Object.prototype.hasOwnProperty.call(e.value,t):!1}catch(e){throw new Error(`.comet/config.yaml is invalid YAML (${e instanceof Error?e.message:String(e)}); cannot check for removed "${t}" field. Fix the config and retry.`,{cause:e})}}function pv(t){return{status:1,output:`${t} has been removed from .comet/config.yaml. Delete this field and run any required ${t==="build_command"?"build":"verification"} command manually before retrying.`}}function mv(t){let e=Ky(t,{shell:!0,cwd:mr(),encoding:"utf8",timeout:3e5});return{status:e.status??1,output:`${e.stdout??""}${e.stderr??""}`.replace(/\n+$/u,"")}}function On(t){return T.resolve(mr(),t)}async function hv(){let t=On("package.json");return await U(t)&&typeof JSON.parse(await te(I(),t,{label:"package.json"})).scripts?.build=="string"?"npm run build":await U(On("pom.xml"))?process.platform==="win32"?await U(On("mvnw.cmd"))?"mvnw.cmd compile -q":"mvn.cmd compile -q":await U(On("mvnw"))?"./mvnw compile -q":"mvn compile -q":await U(On("Cargo.toml"))?"cargo build":null}function ff(t){return`Evidence: recorded command-check at ${t.timestamp}; command: ${t.command}; cwd: ${t.cwd}`}function Ts(t,e,n){return`comet state record-check ${t} ${e} --command "${n}" --exit-code 0`}async function hf(t,e,n,i){if(process.env.COMET_SKIP_BUILD==="1")return{status:0,output:"SKIPPED via COMET_SKIP_BUILD=1"};let r=i==="build"?["build_command"]:["verify_command","build_command"];for(let a of r)if(await dv(a))return pv(a);let o=i==="build"?await hv():null;if(o)return mv(o);let s=await ru(I(),t,n,i);return s?s.exitCode!==0?{status:s.exitCode,output:`Latest recorded ${i} check failed with exit code ${s.exitCode}.
167
+ ${ff(s)}
168
168
  Next: rerun the command successfully, then record it with:
169
- ${Ao(e,i,o.command)}`}:{status:0,output:rf(o)}:{status:1,output:i==="build"?`No inferred build command or recorded build check. Detection searched: ${iv.join(", ")}.
169
+ ${Ts(e,i,s.command)}`}:{status:0,output:ff(s)}:{status:1,output:i==="build"?`No inferred build command or recorded build check. Detection searched: ${fv.join(", ")}.
170
170
  Next: run the required command, then record it with:
171
- ${Ao(e,i,"<command>")}`:`No recorded verify check.
171
+ ${Ts(e,i,"<command>")}`:`No recorded verify check.
172
172
  Next: run the required verification command, then record it with:
173
- ${Ao(e,i,"<command>")}`}}async function qo(t){let e=T.join(t,"tasks.md");if(!await Y(e))return S(`tasks.md is missing at ${e}
173
+ ${Ts(e,i,"<command>")}`}}async function Ds(t){let e=T.join(t,"tasks.md");if(!await U(e))return S(`tasks.md is missing at ${e}
174
174
  Next: restore or create tasks.md for this change before leaving build.`);let n=await te(I(),e,{label:`Classic tasks ${e}`});if(!/- \[x\]/u.test(n))return S(`tasks.md has no completed tasks.
175
- Next: complete implementation tasks and mark them with '- [x]'.`);let i=n.split(/\r?\n/u).map((r,s)=>({line:r,number:s+1})).filter(r=>/^- \[ \]/u.test(r.line));return i.length>0?S(`Unfinished tasks:
175
+ Next: complete implementation tasks and mark them with '- [x]'.`);let i=n.split(/\r?\n/u).map((r,o)=>({line:r,number:o+1})).filter(r=>/^- \[ \]/u.test(r.line));return i.length>0?S(`Unfinished tasks:
176
176
  ${i.map(r=>`${r.number}:${r.line}`).join(`
177
177
  `)}
178
- Next: complete or explicitly remove unfinished tasks, then mark tasks.md with '- [x]'.`):_()}async function cv(t){let e=T.join(t,"tasks.md");return await Y(e)?/- \[/u.test(await te(I(),e,{label:`Classic tasks ${e}`})):!1}async function lv(t){let e=await A(t,"plan");if(!e||e==="null")return _();if(!await Y(e))return S(`plan file is missing at ${e}
179
- Next: restore the Superpowers plan file or update .comet.yaml plan before leaving build.`);let i=(await te(I(),e,{label:`Classic plan ${e}`})).split(/\r?\n/u).map((r,s)=>({line:r,number:s+1})).filter(r=>/^\s*- \[ \]/u.test(r.line));return i.length>0?S(`Unfinished Superpowers plan tasks:
178
+ Next: complete or explicitly remove unfinished tasks, then mark tasks.md with '- [x]'.`):_()}async function gv(t){let e=T.join(t,"tasks.md");return await U(e)?/- \[/u.test(await te(I(),e,{label:`Classic tasks ${e}`})):!1}async function wv(t){let e=await O(t,"plan");if(!e||e==="null")return _();if(!await U(e))return S(`plan file is missing at ${e}
179
+ Next: restore the Superpowers plan file or update .comet.yaml plan before leaving build.`);let i=(await te(I(),e,{label:`Classic plan ${e}`})).split(/\r?\n/u).map((r,o)=>({line:r,number:o+1})).filter(r=>/^\s*- \[ \]/u.test(r.line));return i.length>0?S(`Unfinished Superpowers plan tasks:
180
180
  ${i.map(r=>`${r.number}:${r.line}`).join(`
181
181
  `)}
182
- Next: check off corresponding completed plan tasks, then commit the plan update.`):_()}async function Lo(t,e){let n;try{n=await ef(t,{heal:!0,cwd:mr()})}catch(i){throw new fe(`ERROR: ${i instanceof Error?i.message:String(i)}`)}switch(n.status){case"drift":return S(tf(e,n.boundBranch,n.currentBranch));case"unbound-detached":return S(nf(e));case"healed":return _(`bound_branch lazily set to ${n.branch}`);case"needs-heal":case"ok":case"not-applicable":return _();default:{let i=n;throw new Error(`unhandled branch binding status: ${JSON.stringify(i)}`)}}}async function uv(t,e){let n=await A(t,"isolation");return n==="current"||n==="branch"||n==="worktree"?_():S(`isolation must be current, branch, or worktree, got '${n||"null"}'
182
+ Next: check off corresponding completed plan tasks, then commit the plan update.`):_()}async function Fs(t,e){let n;try{n=await cf(t,{heal:!0,cwd:mr()})}catch(i){throw new de(`ERROR: ${i instanceof Error?i.message:String(i)}`)}switch(n.status){case"drift":return S(lf(e,n.boundBranch,n.currentBranch));case"unbound-detached":return S(uf(e));case"healed":return _(`bound_branch lazily set to ${n.branch}`);case"needs-heal":case"ok":case"not-applicable":return _();default:{let i=n;throw new Error(`unhandled branch binding status: ${JSON.stringify(i)}`)}}}async function yv(t,e){let n=await O(t,"isolation");return n==="current"||n==="branch"||n==="worktree"?_():S(`isolation must be current, branch, or worktree, got '${n||"null"}'
183
183
  Next: choose a valid workspace mode, prepare it when needed, then run:
184
- comet state set ${e} isolation <current|branch|worktree>`)}async function fv(t,e){let n=await A(t,"build_mode");return["subagent-driven-development","executing-plans","direct"].includes(n)?_():S(`build_mode must be selected before leaving build, got '${n||"null"}'
184
+ comet state set ${e} isolation <current|branch|worktree>`)}async function vv(t,e){let n=await O(t,"build_mode");return["subagent-driven-development","executing-plans","direct"].includes(n)?_():S(`build_mode must be selected before leaving build, got '${n||"null"}'
185
185
  Next: ask the user to choose an execution mode, then run:
186
- comet state set ${e} build_mode <subagent-driven-development|executing-plans>`)}async function dv(t){let e=await A(t,"workflow"),n=await A(t,"build_mode"),i=await A(t,"direct_override");return n!=="direct"||e==="hotfix"||e==="tweak"||i==="true"?_():S(`build_mode=direct is only allowed for hotfix/tweak unless direct_override: true is recorded
187
- Next: choose executing-plans or subagent-driven-development, or stop and ask the user for an explicit direct override.`)}async function pv(t,e){let n=await A(t,"build_mode"),i=await A(t,"subagent_dispatch");return n!=="subagent-driven-development"||i==="confirmed"?_():S(`subagent_dispatch must be confirmed before using build_mode=subagent-driven-development
186
+ comet state set ${e} build_mode <subagent-driven-development|executing-plans>`)}async function bv(t){let e=await O(t,"workflow"),n=await O(t,"build_mode"),i=await O(t,"direct_override");return n!=="direct"||e==="hotfix"||e==="tweak"||i==="true"?_():S(`build_mode=direct is only allowed for hotfix/tweak unless direct_override: true is recorded
187
+ Next: choose executing-plans or subagent-driven-development, or stop and ask the user for an explicit direct override.`)}async function kv(t,e){let n=await O(t,"build_mode"),i=await O(t,"subagent_dispatch");return n!=="subagent-driven-development"||i==="confirmed"?_():S(`subagent_dispatch must be confirmed before using build_mode=subagent-driven-development
188
188
  Next: record the selected subagent-driven execution, then run:
189
- comet state set ${e} subagent_dispatch confirmed`)}async function mv(t,e){let n=await A(t,"workflow");if(n==="hotfix"||n==="tweak")return _();let i=await A(t,"tdd_mode");return i==="tdd"||i==="direct"?_():S(`tdd_mode must be tdd or direct for full workflow, got '${i||"null"}'
189
+ comet state set ${e} subagent_dispatch confirmed`)}async function Sv(t,e){let n=await O(t,"workflow");if(n==="hotfix"||n==="tweak")return _();let i=await O(t,"tdd_mode");return i==="tdd"||i==="direct"?_():S(`tdd_mode must be tdd or direct for full workflow, got '${i||"null"}'
190
190
  Next: ask the user to choose TDD enforcement level, then run:
191
- comet state set ${e} tdd_mode <tdd|direct>`)}async function hv(t,e){let n=await A(t,"workflow");if(n==="hotfix"||n==="tweak")return _();let i=await A(t,"review_mode");return i==="off"||i==="standard"||i==="thorough"?_():S(`review_mode must be off, standard, or thorough before leaving build, got '${i||"null"}'
191
+ comet state set ${e} tdd_mode <tdd|direct>`)}async function Cv(t,e){let n=await O(t,"workflow");if(n==="hotfix"||n==="tweak")return _();let i=await O(t,"review_mode");return i==="off"||i==="standard"||i==="thorough"?_():S(`review_mode must be off, standard, or thorough before leaving build, got '${i||"null"}'
192
192
  Next: ask the user to choose review strength, then run:
193
- comet state set ${e} review_mode <off|standard|thorough>`)}async function gv(t){let e=await A(t,"verification_report");return!!e&&e!=="null"&&await Y(e)}async function wv(t){return await A(t,"branch_status")==="handled"}async function yv(t){return await A(t,"archived")==="true"}async function jo(t,e,n){let i=(await te(I(),t,{label:`Classic Design Doc ${t}`})).replace(/^\uFEFF/u,""),r=!1;for(let s of i.split(/\r?\n/u)){if(!r){s==="---"&&(r=!0);continue}if(s==="---")break;if(new RegExp(`^${e}: ['"]?${n}['"]?\\s*$`,"u").test(s))return!0}return!1}async function vv(t,e){let n=await A(t,"design_doc");return n&&n!=="null"&&await Y(n)?_():S(`design_doc must point to an existing Superpowers Design Doc for full workflow before leaving design.
194
- Next: create the Design Doc and run: comet state set ${e} design_doc <path>`)}async function bv(t,e){let n=await A(t,"handoff_context"),i=await A(t,"handoff_hash");if(!n||n==="null")return S(`handoff_context is missing from .comet.yaml
195
- Next: run node "$COMET_HANDOFF" ${e} design --write before invoking Superpowers.`);if(!await H(n))return S(`handoff_context does not point to a non-empty file: ${n}
193
+ comet state set ${e} review_mode <off|standard|thorough>`)}async function Ev(t){let e=await O(t,"verification_report");return!!e&&e!=="null"&&await U(e)}async function xv(t){return await O(t,"branch_status")==="handled"}async function _v(t){return await O(t,"archived")==="true"}async function Is(t,e,n){let i=(await te(I(),t,{label:`Classic Design Doc ${t}`})).replace(/^\uFEFF/u,""),r=!1;for(let o of i.split(/\r?\n/u)){if(!r){o==="---"&&(r=!0);continue}if(o==="---")break;if(new RegExp(`^${e}: ['"]?${n}['"]?\\s*$`,"u").test(o))return!0}return!1}async function Pv(t,e){let n=await O(t,"design_doc");return n&&n!=="null"&&await U(n)?_():S(`design_doc must point to an existing Superpowers Design Doc for full workflow before leaving design.
194
+ Next: create the Design Doc and run: comet state set ${e} design_doc <path>`)}async function Rv(t,e){let n=await O(t,"handoff_context"),i=await O(t,"handoff_hash");if(!n||n==="null")return S(`handoff_context is missing from .comet.yaml
195
+ Next: run node "$COMET_HANDOFF" ${e} design --write before invoking Superpowers.`);if(!await G(n))return S(`handoff_context does not point to a non-empty file: ${n}
196
196
  Next: regenerate the design handoff with comet handoff ${e} design --write.`);if(!/^[a-f0-9]{64}$/u.test(i))return S(`handoff_hash is missing or invalid: ${i||"null"}
197
- Next: regenerate the design handoff with comet handoff ${e} design --write.`);let r=await ev(t);if(r!==i)return S(`OpenSpec artifacts changed after handoff was generated.
197
+ Next: regenerate the design handoff with comet handoff ${e} design --write.`);let r=await cv(t);if(r!==i)return S(`OpenSpec artifacts changed after handoff was generated.
198
198
  Expected handoff_hash: ${i}
199
199
  Actual handoff_hash: ${r}
200
- Next: run comet handoff ${e} design --write so Superpowers receives the current OpenSpec context.`);let s=`${n.replace(/\.json$/u,"")}.md`;return await H(s)?_():S(`design handoff markdown is missing or empty: ${s}
201
- Next: regenerate the design handoff with comet handoff ${e} design --write.`)}async function kv(t){let e=await A(t,"handoff_context");if(!e||e==="null")return S("handoff_context is missing from .comet.yaml");let n=`${e.replace(/\.json$/u,"")}.md`;if(!await H(n))return S(`design handoff markdown is missing or empty: ${n}`);let i=await te(I(),n,{label:`Classic handoff markdown ${n}`}),r=new Set(i.split(/\r?\n/u)),s=[];/^Generated-by: comet-handoff\.sh$/mu.test(i)||s.push("handoff markdown is missing Generated-by marker"),/^- Mode: (compact|full|beta)$/mu.test(i)||s.push("handoff markdown is missing Mode marker");for(let o of await $o(t))await Y(o)&&(r.has(`- Source: ${o}`)||s.push(`handoff markdown is missing source reference: ${o}`),r.has(`- SHA256: ${await af(o)}`)||s.push(`handoff markdown is missing current sha256 for: ${o}`));return s.length===0?_():S(s.join(`
202
- `))}async function lf(t){return await A(t,"context_compression")||"off"}async function Sv(t){if(await lf(t)!=="beta")return _();let e=await A(t,"handoff_context");if(!e||e==="null")return S("handoff_context is missing from .comet.yaml");if(!await H(e))return S(`spec-context.json is missing or empty: ${e}`);let n=await te(I(),e,{label:`Classic handoff context ${e}`}),i=[],r;try{r=JSON.parse(n)}catch(a){return S(`spec-context.json invalid JSON: ${a instanceof Error?a.message:String(a)}`)}if(!r||typeof r!="object"||Array.isArray(r))return S("spec-context.json root must be an object");let s=r;typeof s.change!="string"&&i.push("spec-context.json missing 'change' field"),typeof s.phase!="string"&&i.push("spec-context.json missing 'phase' field"),s.mode!=="beta"&&i.push("spec-context.json mode is not beta"),typeof s.context_hash!="string"&&i.push("spec-context.json missing 'context_hash' field"),Array.isArray(s.files)||i.push("spec-context.json missing 'files' field");let o=Array.isArray(s.files)?s.files.filter(a=>!!a&&typeof a=="object"&&!Array.isArray(a)):[];for(let a of await $o(t))await Y(a)&&(o.some(c=>c.path===a&&typeof c.sha256=="string")||i.push(`spec-context.json missing source file reference: ${a}`));return i.length===0?_():S(i.join(`
203
- `))}async function Cv(t,e){let n=await A(e,"workflow"),i=[E("proposal.md exists and non-empty",async()=>await H(T.join(e,"proposal.md"))?_():S("")),E("proposal.md matches configured language",()=>he(e,T.join(e,"proposal.md"))),E("tasks.md exists and non-empty",async()=>await H(T.join(e,"tasks.md"))?_():S("")),E("tasks.md matches configured language",()=>he(e,T.join(e,"tasks.md"))),E("tasks.md has at least one task",async()=>await cv(e)?_():S(""))];return n==="full"&&i.splice(1,0,E("design.md exists and non-empty",async()=>await H(T.join(e,"design.md"))?_():S("")),E("design.md matches configured language",()=>he(e,T.join(e,"design.md")))),Nt(t,i)}async function Ev(t,e,n){let i=await A(e,"design_doc"),r=await A(e,"workflow"),s=[E("proposal.md exists",async()=>await H(T.join(e,"proposal.md"))?_():S("")),E("proposal.md matches configured language",()=>he(e,T.join(e,"proposal.md"))),E("design.md exists",async()=>await H(T.join(e,"design.md"))?_():S("")),E("design.md matches configured language",()=>he(e,T.join(e,"design.md"))),E("tasks.md exists",async()=>await H(T.join(e,"tasks.md"))?_():S("")),E("tasks.md matches configured language",()=>he(e,T.join(e,"tasks.md"))),E("design handoff context exists",()=>bv(e,n)),E("design handoff markdown is traceable",()=>kv(e))];await lf(e)==="beta"&&s.push(E("beta spec-context.json is structurally valid",()=>Sv(e))),r==="full"&&s.push(E("design_doc is recorded for full workflow",()=>vv(e,n)));let o=await Nt(t,s);return i&&i!=="null"?o=await Nt(t,[E(`Design Doc (${i}) exists`,async()=>await H(i)?_():S("")),E("Design Doc matches configured language",()=>he(e,i)),E("Design Doc frontmatter links current change",async()=>await H(i)&&await jo(i,"comet_change",n)?_():S("")),E("Design Doc declares technical design role",async()=>await H(i)&&await jo(i,"role","technical-design")?_():S("")),E("Design Doc declares OpenSpec as canonical spec",async()=>await H(i)&&await jo(i,"canonical_spec","openspec")?_():S(""))])||o:r!=="full"&&t.stderr.push(Yy(" [WARN] No design_doc recorded in .comet.yaml (optional for hotfix/tweak)")),o}async function xv(t,e,n,i){return Nt(t,[E("bound branch matches workspace mode",()=>Lo(e,n)),E("isolation selected",()=>uv(e,n)),E("build_mode selected",()=>fv(e,n)),E("build_mode allowed for workflow",()=>dv(e)),E("subagent dispatch confirmed",()=>pv(e,n)),E("tdd_mode selected",()=>mv(e,n)),E("review_mode selected",()=>hv(e,n)),E("tasks.md all tasks checked",()=>qo(e)),E("Superpowers plan all tasks checked",()=>lv(e)),E("proposal.md exists",async()=>await H(T.join(e,"proposal.md"))?_():S("")),E("proposal.md matches configured language",()=>he(e,T.join(e,"proposal.md"))),E("Superpowers plan matches configured language",async()=>{let r=await A(e,"plan");return!r||r==="null"||!await Y(r)?_():he(e,r)}),E("Build passes",async()=>{let r=await cf(e,n,i,"build");return r.status===0?_(r.output):S(r.output)})])}async function _v(t,e,n,i){return Nt(t,[E("bound branch matches workspace mode",()=>Lo(e,n)),E("tasks.md all tasks checked",()=>qo(e)),E("Verification passes",async()=>{let r=await cf(e,n,i,"verify");return r.status===0?_(r.output):S(r.output)}),E("verification_report exists",async()=>await gv(e)?_():S("")),E("verification_report matches configured language",async()=>{let r=await A(e,"verification_report");return!r||r==="null"||!await Y(r)?_():he(e,r)})])}async function Pv(t,e,n){return Nt(t,[E("bound branch matches workspace mode",()=>Lo(e,n)),E("archived is true",async()=>await yv(e)?_():S("")),E("proposal.md exists",async()=>await H(T.join(e,"proposal.md"))?_():S("")),E("design.md exists",async()=>await H(T.join(e,"design.md"))?_():S("")),E("tasks.md all tasks checked",()=>qo(e)),E("branch_status=handled",async()=>await wv(e)?_():S(""))])}async function Rv(t,e,n,i){let r=Uu[i];if(!r)return;let s=await fr(n),o=Vu(s.classic,r);await Mu(n,o.classic,s.run,{event:r,phase:i,source:"comet-guard"}),await Yu(n,{change:e,event:r,source:"comet-guard",from:s.classic,to:o.classic,effects:o.effects});for(let l of o.effects)t.stderr.push(Rt(`[SET] ${Uy(l.field)}=${Vy(l.to)}`));t.stderr.push(Rt(`[TRANSITION] ${r}`));let a=By[i],c=i==="open"?a.replace("PLACEHOLDER",o.classic.phase):a;t.stderr.push(Rt(c))}var uf=async(t,e)=>pr(e,async()=>{let n=new To,[i,r,s]=t;try{if(Jy(i),!r||!My.includes(r))throw new fe(`${Se(`Unknown phase: ${r??""}`)}
204
- Valid phases: open, design, build, verify, archive`);await ho(I());let o=await Hy(i);await tv(o,i);let a=await fr(o),c=await Ku(o,i);e.json&&(n.diagnostics={change:i,phase:r,currentStep:c.currentStep,runtimeEval:c.runtimeEval}),n.stderr.push(Wy[r]);let l;return r==="open"?l=await Cv(n,o):r==="design"?l=await Ev(n,o,i):r==="build"?l=await xv(n,o,i,a.run):r==="verify"?l=await _v(n,o,i,a.run):l=await Pv(n,o,i),l?(n.stderr.push(""),n.stderr.push(Se("BLOCKED — fix failing checks before proceeding to next phase")),n.toResult(1)):(n.stderr.push(""),n.stderr.push(Rt("ALL CHECKS PASSED — ready for next phase")),s==="--apply"&&await Rv(n,i,o,r),n.toResult(0))}catch(o){if(o instanceof fe){for(let a of o.message.split(`
205
- `))n.stderr.push(a);return n.toResult(o.exitCode)}throw o}});function Nv(t,e){return{exitCode:e.exitCode,stdout:JSON.stringify({command:t,exitCode:e.exitCode,...e.stdout===void 0?{}:{stdout:e.stdout},...e.stderr===void 0?{}:{stderr:e.stderr}})+`
206
- `}}async function ff(t,e,n=process.argv.slice(2)){let i=n.includes("--json"),r=n.filter(a=>a!=="--json"),s;try{s=await e(r,{json:i})}catch(a){s={exitCode:70,stderr:a instanceof Error?a.message:String(a)}}let o=i?Nv(t,s):s;return o.stdout&&process.stdout.write(o.stdout),o.stderr&&process.stderr.write(o.stderr+(o.stderr.endsWith(`
200
+ Next: run comet handoff ${e} design --write so Superpowers receives the current OpenSpec context.`);let o=`${n.replace(/\.json$/u,"")}.md`;return await G(o)?_():S(`design handoff markdown is missing or empty: ${o}
201
+ Next: regenerate the design handoff with comet handoff ${e} design --write.`)}async function Nv(t){let e=await O(t,"handoff_context");if(!e||e==="null")return S("handoff_context is missing from .comet.yaml");let n=`${e.replace(/\.json$/u,"")}.md`;if(!await G(n))return S(`design handoff markdown is missing or empty: ${n}`);let i=await te(I(),n,{label:`Classic handoff markdown ${n}`}),r=new Set(i.split(/\r?\n/u)),o=[];/^Generated-by: comet-handoff\.sh$/mu.test(i)||o.push("handoff markdown is missing Generated-by marker"),/^- Mode: (compact|full|beta)$/mu.test(i)||o.push("handoff markdown is missing Mode marker");for(let s of await Ls(t))await U(s)&&(r.has(`- Source: ${s}`)||o.push(`handoff markdown is missing source reference: ${s}`),r.has(`- SHA256: ${await mf(s)}`)||o.push(`handoff markdown is missing current sha256 for: ${s}`));return o.length===0?_():S(o.join(`
202
+ `))}async function gf(t){return await O(t,"context_compression")||"off"}async function Av(t){if(await gf(t)!=="beta")return _();let e=await O(t,"handoff_context");if(!e||e==="null")return S("handoff_context is missing from .comet.yaml");if(!await G(e))return S(`spec-context.json is missing or empty: ${e}`);let n=await te(I(),e,{label:`Classic handoff context ${e}`}),i=[],r;try{r=JSON.parse(n)}catch(a){return S(`spec-context.json invalid JSON: ${a instanceof Error?a.message:String(a)}`)}if(!r||typeof r!="object"||Array.isArray(r))return S("spec-context.json root must be an object");let o=r;typeof o.change!="string"&&i.push("spec-context.json missing 'change' field"),typeof o.phase!="string"&&i.push("spec-context.json missing 'phase' field"),o.mode!=="beta"&&i.push("spec-context.json mode is not beta"),typeof o.context_hash!="string"&&i.push("spec-context.json missing 'context_hash' field"),Array.isArray(o.files)||i.push("spec-context.json missing 'files' field");let s=Array.isArray(o.files)?o.files.filter(a=>!!a&&typeof a=="object"&&!Array.isArray(a)):[];for(let a of await Ls(t))await U(a)&&(s.some(c=>c.path===a&&typeof c.sha256=="string")||i.push(`spec-context.json missing source file reference: ${a}`));return i.length===0?_():S(i.join(`
203
+ `))}async function Ov(t,e){let n=await O(e,"workflow"),i=[E("proposal.md exists and non-empty",async()=>await G(T.join(e,"proposal.md"))?_():S("")),E("proposal.md matches configured language",()=>he(e,T.join(e,"proposal.md"))),E("tasks.md exists and non-empty",async()=>await G(T.join(e,"tasks.md"))?_():S("")),E("tasks.md matches configured language",()=>he(e,T.join(e,"tasks.md"))),E("tasks.md has at least one task",async()=>await gv(e)?_():S(""))];return n==="full"&&i.splice(1,0,E("design.md exists and non-empty",async()=>await G(T.join(e,"design.md"))?_():S("")),E("design.md matches configured language",()=>he(e,T.join(e,"design.md")))),At(t,i)}async function jv(t,e,n){let i=await O(e,"design_doc"),r=await O(e,"workflow"),o=[E("proposal.md exists",async()=>await G(T.join(e,"proposal.md"))?_():S("")),E("proposal.md matches configured language",()=>he(e,T.join(e,"proposal.md"))),E("design.md exists",async()=>await G(T.join(e,"design.md"))?_():S("")),E("design.md matches configured language",()=>he(e,T.join(e,"design.md"))),E("tasks.md exists",async()=>await G(T.join(e,"tasks.md"))?_():S("")),E("tasks.md matches configured language",()=>he(e,T.join(e,"tasks.md"))),E("design handoff context exists",()=>Rv(e,n)),E("design handoff markdown is traceable",()=>Nv(e))];await gf(e)==="beta"&&o.push(E("beta spec-context.json is structurally valid",()=>Av(e))),r==="full"&&o.push(E("design_doc is recorded for full workflow",()=>Pv(e,n)));let s=await At(t,o);return i&&i!=="null"?s=await At(t,[E(`Design Doc (${i}) exists`,async()=>await G(i)?_():S("")),E("Design Doc matches configured language",()=>he(e,i)),E("Design Doc frontmatter links current change",async()=>await G(i)&&await Is(i,"comet_change",n)?_():S("")),E("Design Doc declares technical design role",async()=>await G(i)&&await Is(i,"role","technical-design")?_():S("")),E("Design Doc declares OpenSpec as canonical spec",async()=>await G(i)&&await Is(i,"canonical_spec","openspec")?_():S(""))])||s:r!=="full"&&t.stderr.push(Xy(" [WARN] No design_doc recorded in .comet.yaml (optional for hotfix/tweak)")),s}async function Tv(t,e,n,i){return At(t,[E("bound branch matches workspace mode",()=>Fs(e,n)),E("isolation selected",()=>yv(e,n)),E("build_mode selected",()=>vv(e,n)),E("build_mode allowed for workflow",()=>bv(e)),E("subagent dispatch confirmed",()=>kv(e,n)),E("tdd_mode selected",()=>Sv(e,n)),E("review_mode selected",()=>Cv(e,n)),E("tasks.md all tasks checked",()=>Ds(e)),E("Superpowers plan all tasks checked",()=>wv(e)),E("proposal.md exists",async()=>await G(T.join(e,"proposal.md"))?_():S("")),E("proposal.md matches configured language",()=>he(e,T.join(e,"proposal.md"))),E("Superpowers plan matches configured language",async()=>{let r=await O(e,"plan");return!r||r==="null"||!await U(r)?_():he(e,r)}),E("Build passes",async()=>{let r=await hf(e,n,i,"build");return r.status===0?_(r.output):S(r.output)})])}async function Iv(t,e,n,i){return At(t,[E("bound branch matches workspace mode",()=>Fs(e,n)),E("tasks.md all tasks checked",()=>Ds(e)),E("Verification passes",async()=>{let r=await hf(e,n,i,"verify");return r.status===0?_(r.output):S(r.output)}),E("verification_report exists",async()=>await Ev(e)?_():S("")),E("verification_report matches configured language",async()=>{let r=await O(e,"verification_report");return!r||r==="null"||!await U(r)?_():he(e,r)})])}async function $v(t,e,n){return At(t,[E("bound branch matches workspace mode",()=>Fs(e,n)),E("archived is true",async()=>await _v(e)?_():S("")),E("proposal.md exists",async()=>await G(T.join(e,"proposal.md"))?_():S("")),E("design.md exists",async()=>await G(T.join(e,"design.md"))?_():S("")),E("tasks.md all tasks checked",()=>Ds(e)),E("branch_status=handled",async()=>await xv(e)?_():S(""))])}async function qv(t,e,n,i){let r=Xu[i];if(!r)return;let o=await fr(n),s=Zu(o.classic,r);await Vu(n,s.classic,o.run,{event:r,phase:i,source:"comet-guard"}),await Qu(n,{change:e,event:r,source:"comet-guard",from:o.classic,to:s.classic,effects:s.effects});for(let l of s.effects)t.stderr.push(Nt(`[SET] ${Zy(l.field)}=${ev(l.to)}`));t.stderr.push(Nt(`[TRANSITION] ${r}`));let a=zy[i],c=i==="open"?a.replace("PLACEHOLDER",s.classic.phase):a;t.stderr.push(Nt(c))}var wf=async(t,e)=>pr(e,async()=>{let n=new $s,[i,r,o]=t;try{if(tv(i),!r||!Jy.includes(r))throw new de(`${Ce(`Unknown phase: ${r??""}`)}
204
+ Valid phases: open, design, build, verify, archive`);await ys(I());let s=await nv(i);await lv(s,i);let a=await fr(s),c=await zu(s,i);e.json&&(n.diagnostics={change:i,phase:r,currentStep:c.currentStep,runtimeEval:c.runtimeEval}),n.stderr.push(Gy[r]);let l;return r==="open"?l=await Ov(n,s):r==="design"?l=await jv(n,s,i):r==="build"?l=await Tv(n,s,i,a.run):r==="verify"?l=await Iv(n,s,i,a.run):l=await $v(n,s,i),l?(n.stderr.push(""),n.stderr.push(Ce("BLOCKED — fix failing checks before proceeding to next phase")),n.toResult(1)):(n.stderr.push(""),n.stderr.push(Nt("ALL CHECKS PASSED — ready for next phase")),o==="--apply"&&await qv(n,i,s,r),n.toResult(0))}catch(s){if(s instanceof de){for(let a of s.message.split(`
205
+ `))n.stderr.push(a);return n.toResult(s.exitCode)}throw s}});function Lv(t,e){return{exitCode:e.exitCode,stdout:JSON.stringify({command:t,exitCode:e.exitCode,...e.stdout===void 0?{}:{stdout:e.stdout},...e.stderr===void 0?{}:{stderr:e.stderr}})+`
206
+ `}}async function yf(t,e,n=process.argv.slice(2)){let i=n.includes("--json"),r=n.filter(a=>a!=="--json"),o;try{o=await e(r,{json:i})}catch(a){o={exitCode:70,stderr:a instanceof Error?a.message:String(a)}}let s=i?Lv(t,o):o;return s.stdout&&process.stdout.write(s.stdout),s.stderr&&process.stderr.write(s.stderr+(s.stderr.endsWith(`
207
207
  `)?"":`
208
- `)),o.exitCode}process.exitCode=await ff("guard",uf);
208
+ `)),s.exitCode}process.exitCode=await yf("guard",wf);