@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,77 +1,77 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as __cometCreateRequire } from 'module';
3
3
  const require = __cometCreateRequire(import.meta.url);
4
- var Tf=Object.create;var _r=Object.defineProperty;var If=Object.getOwnPropertyDescriptor;var jf=Object.getOwnPropertyNames;var $f=Object.getPrototypeOf,qf=Object.prototype.hasOwnProperty;var Fn=(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 U=(t,e,n)=>()=>{if(n)throw n[0];try{return t&&(e=t(t=0)),e}catch(i){throw n=[i],i}};var w=(t,e)=>()=>{try{return e||t((e={exports:{}}).exports,e),e.exports}catch(n){throw e=0,n}},Lf=(t,e)=>{for(var n in e)_r(t,n,{get:e[n],enumerable:!0})},Df=(t,e,n,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of jf(e))!qf.call(t,r)&&r!==n&&_r(t,r,{get:()=>e[r],enumerable:!(i=If(e,r))||i.enumerable});return t};var ct=(t,e,n)=>(n=t!=null?Tf($f(t)):{},Df(e||!t||!t.__esModule?_r(n,"default",{value:t,enumerable:!0}):n,t));var P=w(F=>{"use strict";var xr=Symbol.for("yaml.alias"),na=Symbol.for("yaml.document"),Wn=Symbol.for("yaml.map"),ia=Symbol.for("yaml.pair"),Pr=Symbol.for("yaml.scalar"),Bn=Symbol.for("yaml.seq"),we=Symbol.for("yaml.node.type"),Mf=t=>!!t&&typeof t=="object"&&t[we]===xr,Ff=t=>!!t&&typeof t=="object"&&t[we]===na,Wf=t=>!!t&&typeof t=="object"&&t[we]===Wn,Bf=t=>!!t&&typeof t=="object"&&t[we]===ia,ra=t=>!!t&&typeof t=="object"&&t[we]===Pr,Kf=t=>!!t&&typeof t=="object"&&t[we]===Bn;function sa(t){if(t&&typeof t=="object")switch(t[we]){case Wn:case Bn:return!0}return!1}function Uf(t){if(t&&typeof t=="object")switch(t[we]){case xr:case Wn:case Pr:case Bn:return!0}return!1}var Yf=t=>(ra(t)||sa(t))&&!!t.anchor;F.ALIAS=xr;F.DOC=na;F.MAP=Wn;F.NODE_TYPE=we;F.PAIR=ia;F.SCALAR=Pr;F.SEQ=Bn;F.hasAnchor=Yf;F.isAlias=Mf;F.isCollection=sa;F.isDocument=Ff;F.isMap=Wf;F.isNode=Uf;F.isPair=Bf;F.isScalar=ra;F.isSeq=Kf});var Tt=w(Or=>{"use strict";var M=P(),G=Symbol("break visit"),oa=Symbol("skip children"),de=Symbol("remove node");function Kn(t,e){let n=aa(e);M.isDocument(t)?lt(null,t.contents,n,Object.freeze([t]))===de&&(t.contents=null):lt(null,t,n,Object.freeze([]))}Kn.BREAK=G;Kn.SKIP=oa;Kn.REMOVE=de;function lt(t,e,n,i){let r=ca(t,e,n,i);if(M.isNode(r)||M.isPair(r))return la(t,i,r),lt(t,r,n,i);if(typeof r!="symbol"){if(M.isCollection(e)){i=Object.freeze(i.concat(e));for(let s=0;s<e.items.length;++s){let o=lt(s,e.items[s],n,i);if(typeof o=="number")s=o-1;else{if(o===G)return G;o===de&&(e.items.splice(s,1),s-=1)}}}else if(M.isPair(e)){i=Object.freeze(i.concat(e));let s=lt("key",e.key,n,i);if(s===G)return G;s===de&&(e.key=null);let o=lt("value",e.value,n,i);if(o===G)return G;o===de&&(e.value=null)}}return r}async function Un(t,e){let n=aa(e);M.isDocument(t)?await ut(null,t.contents,n,Object.freeze([t]))===de&&(t.contents=null):await ut(null,t,n,Object.freeze([]))}Un.BREAK=G;Un.SKIP=oa;Un.REMOVE=de;async function ut(t,e,n,i){let r=await ca(t,e,n,i);if(M.isNode(r)||M.isPair(r))return la(t,i,r),ut(t,r,n,i);if(typeof r!="symbol"){if(M.isCollection(e)){i=Object.freeze(i.concat(e));for(let s=0;s<e.items.length;++s){let o=await ut(s,e.items[s],n,i);if(typeof o=="number")s=o-1;else{if(o===G)return G;o===de&&(e.items.splice(s,1),s-=1)}}}else if(M.isPair(e)){i=Object.freeze(i.concat(e));let s=await ut("key",e.key,n,i);if(s===G)return G;s===de&&(e.key=null);let o=await ut("value",e.value,n,i);if(o===G)return G;o===de&&(e.value=null)}}return r}function aa(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 ca(t,e,n,i){if(typeof n=="function")return n(t,e,i);if(M.isMap(e))return n.Map?.(t,e,i);if(M.isSeq(e))return n.Seq?.(t,e,i);if(M.isPair(e))return n.Pair?.(t,e,i);if(M.isScalar(e))return n.Scalar?.(t,e,i);if(M.isAlias(e))return n.Alias?.(t,e,i)}function la(t,e,n){let i=e[e.length-1];if(M.isCollection(i))i.items[t]=n;else if(M.isPair(i))t==="key"?i.key=n:i.value=n;else if(M.isDocument(i))i.contents=n;else{let r=M.isAlias(i)?"alias":"scalar";throw new Error(`Cannot replace node with ${r} parent`)}}Or.visit=Kn;Or.visitAsync=Un});var Nr=w(fa=>{"use strict";var ua=P(),Vf=Tt(),Jf={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},Hf=t=>t.replace(/[!,[\]{}]/g,e=>Jf[e]),It=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+Hf(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&&ua.isNode(e.contents)){let s={};Vf.visit(e.contents,(o,a)=>{ua.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
- `)}};It.defaultYaml={explicit:!1,version:"1.2"};It.defaultTags={"!!":"tag:yaml.org,2002:"};fa.Directives=It});var Yn=w(jt=>{"use strict";var da=P(),Gf=Tt();function zf(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 pa(t){let e=new Set;return Gf.visit(t,{Value(n,i){i.anchor&&e.add(i.anchor)}}),e}function ma(t,e){for(let n=1;;++n){let i=`${t}${n}`;if(!e.has(i))return i}}function Xf(t,e){let n=[],i=new Map,r=null;return{onAnchor:s=>{n.push(s),r??(r=pa(t));let o=ma(e,r);return r.add(o),o},setAnchors:()=>{for(let s of n){let o=i.get(s);if(typeof o=="object"&&o.anchor&&(da.isScalar(o.node)||da.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=zf;jt.anchorNames=pa;jt.createNodeAnchors=Xf;jt.findNewAnchor=ma});var Ar=w(ha=>{"use strict";function $t(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=$t(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=$t(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=$t(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=$t(t,i,r,s);o===void 0?delete i[r]:o!==s&&(i[r]=o)}return t.call(e,n,i)}ha.applyReviver=$t});var xe=w(wa=>{"use strict";var Qf=P();function ga(t,e,n){if(Array.isArray(t))return t.map((i,r)=>ga(i,String(r),n));if(t&&typeof t.toJSON=="function"){if(!n||!Qf.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}wa.toJS=ga});var Vn=w(va=>{"use strict";var Zf=Ar(),ya=P(),ed=xe(),Tr=class{constructor(e){Object.defineProperty(this,ya.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(!ya.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=ed.toJS(this,"",o);if(typeof r=="function")for(let{count:c,res:l}of o.anchors.values())r(l,c);return typeof s=="function"?Zf.applyReviver(s,{"":a},"",a):a}};va.NodeBase=Tr});var qt=w(ba=>{"use strict";var td=Yn(),nd=Tt(),ft=P(),id=Vn(),rd=xe(),Ir=class extends id.NodeBase{constructor(e){super(ft.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=[],nd.visit(e,{Node:(s,o)=>{(ft.isAlias(o)||ft.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||(rd.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=Jn(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(td.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 Jn(t,e,n){if(ft.isAlias(e)){let i=e.resolve(t),r=n&&i&&n.get(i);return r?r.count*r.aliasCount:0}else if(ft.isCollection(e)){let i=0;for(let r of e.items){let s=Jn(t,r,n);s>i&&(i=s)}return i}else if(ft.isPair(e)){let i=Jn(t,e.key,n),r=Jn(t,e.value,n);return Math.max(i,r)}return 1}ba.Alias=Ir});var $=w(jr=>{"use strict";var sd=P(),od=Vn(),ad=xe(),cd=t=>!t||typeof t!="function"&&typeof t!="object",Pe=class extends od.NodeBase{constructor(e){super(sd.SCALAR),this.value=e}toJSON(e,n){return n?.keep?this.value:ad.toJS(this.value,e,n)}toString(){return String(this.value)}};Pe.BLOCK_FOLDED="BLOCK_FOLDED";Pe.BLOCK_LITERAL="BLOCK_LITERAL";Pe.PLAIN="PLAIN";Pe.QUOTE_DOUBLE="QUOTE_DOUBLE";Pe.QUOTE_SINGLE="QUOTE_SINGLE";jr.Scalar=Pe;jr.isScalarValue=cd});var Lt=w(Sa=>{"use strict";var ld=qt(),He=P(),ka=$(),ud="tag:yaml.org,2002:";function fd(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 dd(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 ld.Alias(c.anchor);c={anchor:null,node:null},a.set(t,c)}e?.startsWith("!!")&&(e=ud+e.slice(2));let l=fd(t,e,o.tags);if(!l){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let u=new ka.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 f=l?.createNode?l.createNode(n.schema,t,n):typeof l?.nodeClass?.from=="function"?l.nodeClass.from(n.schema,t,n):new ka.Scalar(t);return e?f.tag=e:l.default||(f.tag=l.tag),c&&(c.node=f),f}Sa.createNode=dd});var Gn=w(Hn=>{"use strict";var pd=Lt(),pe=P(),md=Vn();function $r(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 pd.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,qr=class extends md.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(Ca(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,$r(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,$r(this.schema,r,n));else throw new Error(`Expected YAML collection at ${i}. Remaining path: ${r}`)}}};Hn.Collection=qr;Hn.collectionFromPath=$r;Hn.isEmptyPath=Ca});var Dt=w(zn=>{"use strict";var hd=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function Lr(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var gd=(t,e,n)=>t.endsWith(`
6
- `)?Lr(n,e):n.includes(`
4
+ var Jf=Object.create;var Li=Object.defineProperty;var zf=Object.getOwnPropertyDescriptor;var Xf=Object.getOwnPropertyNames;var Qf=Object.getPrototypeOf,Zf=Object.prototype.hasOwnProperty;var Vn=(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 W=(t,e,n)=>()=>{if(n)throw n[0];try{return t&&(e=t(t=0)),e}catch(r){throw n=[r],r}};var w=(t,e)=>()=>{try{return e||t((e={exports:{}}).exports,e),e.exports}catch(n){throw e=0,n}},ed=(t,e)=>{for(var n in e)Li(t,n,{get:e[n],enumerable:!0})},td=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Xf(e))!Zf.call(t,i)&&i!==n&&Li(t,i,{get:()=>e[i],enumerable:!(r=zf(e,i))||r.enumerable});return t};var Qe=(t,e,n)=>(n=t!=null?Jf(Qf(t)):{},td(e||!t||!t.__esModule?Li(n,"default",{value:t,enumerable:!0}):n,t));var P=w(B=>{"use strict";var qi=Symbol.for("yaml.alias"),ga=Symbol.for("yaml.document"),Hn=Symbol.for("yaml.map"),wa=Symbol.for("yaml.pair"),Di=Symbol.for("yaml.scalar"),Jn=Symbol.for("yaml.seq"),ye=Symbol.for("yaml.node.type"),nd=t=>!!t&&typeof t=="object"&&t[ye]===qi,rd=t=>!!t&&typeof t=="object"&&t[ye]===ga,id=t=>!!t&&typeof t=="object"&&t[ye]===Hn,od=t=>!!t&&typeof t=="object"&&t[ye]===wa,ya=t=>!!t&&typeof t=="object"&&t[ye]===Di,sd=t=>!!t&&typeof t=="object"&&t[ye]===Jn;function va(t){if(t&&typeof t=="object")switch(t[ye]){case Hn:case Jn:return!0}return!1}function ad(t){if(t&&typeof t=="object")switch(t[ye]){case qi:case Hn:case Di:case Jn:return!0}return!1}var cd=t=>(ya(t)||va(t))&&!!t.anchor;B.ALIAS=qi;B.DOC=ga;B.MAP=Hn;B.NODE_TYPE=ye;B.PAIR=wa;B.SCALAR=Di;B.SEQ=Jn;B.hasAnchor=cd;B.isAlias=nd;B.isCollection=va;B.isDocument=rd;B.isMap=id;B.isNode=ad;B.isPair=od;B.isScalar=ya;B.isSeq=sd});var Lt=w(Wi=>{"use strict";var M=P(),J=Symbol("break visit"),ba=Symbol("skip children"),me=Symbol("remove node");function zn(t,e){let n=ka(e);M.isDocument(t)?mt(null,t.contents,n,Object.freeze([t]))===me&&(t.contents=null):mt(null,t,n,Object.freeze([]))}zn.BREAK=J;zn.SKIP=ba;zn.REMOVE=me;function mt(t,e,n,r){let i=Sa(t,e,n,r);if(M.isNode(i)||M.isPair(i))return Ca(t,r,i),mt(t,i,n,r);if(typeof i!="symbol"){if(M.isCollection(e)){r=Object.freeze(r.concat(e));for(let o=0;o<e.items.length;++o){let s=mt(o,e.items[o],n,r);if(typeof s=="number")o=s-1;else{if(s===J)return J;s===me&&(e.items.splice(o,1),o-=1)}}}else if(M.isPair(e)){r=Object.freeze(r.concat(e));let o=mt("key",e.key,n,r);if(o===J)return J;o===me&&(e.key=null);let s=mt("value",e.value,n,r);if(s===J)return J;s===me&&(e.value=null)}}return i}async function Xn(t,e){let n=ka(e);M.isDocument(t)?await ht(null,t.contents,n,Object.freeze([t]))===me&&(t.contents=null):await ht(null,t,n,Object.freeze([]))}Xn.BREAK=J;Xn.SKIP=ba;Xn.REMOVE=me;async function ht(t,e,n,r){let i=await Sa(t,e,n,r);if(M.isNode(i)||M.isPair(i))return Ca(t,r,i),ht(t,i,n,r);if(typeof i!="symbol"){if(M.isCollection(e)){r=Object.freeze(r.concat(e));for(let o=0;o<e.items.length;++o){let s=await ht(o,e.items[o],n,r);if(typeof s=="number")o=s-1;else{if(s===J)return J;s===me&&(e.items.splice(o,1),o-=1)}}}else if(M.isPair(e)){r=Object.freeze(r.concat(e));let o=await ht("key",e.key,n,r);if(o===J)return J;o===me&&(e.key=null);let s=await ht("value",e.value,n,r);if(s===J)return J;s===me&&(e.value=null)}}return i}function ka(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 Sa(t,e,n,r){if(typeof n=="function")return n(t,e,r);if(M.isMap(e))return n.Map?.(t,e,r);if(M.isSeq(e))return n.Seq?.(t,e,r);if(M.isPair(e))return n.Pair?.(t,e,r);if(M.isScalar(e))return n.Scalar?.(t,e,r);if(M.isAlias(e))return n.Alias?.(t,e,r)}function Ca(t,e,n){let r=e[e.length-1];if(M.isCollection(r))r.items[t]=n;else if(M.isPair(r))t==="key"?r.key=n:r.value=n;else if(M.isDocument(r))r.contents=n;else{let i=M.isAlias(r)?"alias":"scalar";throw new Error(`Cannot replace node with ${i} parent`)}}Wi.visit=zn;Wi.visitAsync=Xn});var Mi=w(Ra=>{"use strict";var Ea=P(),ld=Lt(),ud={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},fd=t=>t.replace(/[!,[\]{}]/g,e=>ud[e]),qt=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 r=e.trim().split(/[ \t]+/),i=r.shift();switch(i){case"%TAG":{if(r.length!==2&&(n(0,"%TAG directive should contain exactly two parts"),r.length<2))return!1;let[o,s]=r;return this.tags[o]=s,!0}case"%YAML":{if(this.yaml.explicit=!0,r.length!==1)return n(0,"%YAML directive should contain exactly one part"),!1;let[o]=r;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 ${i}`,!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[,r,i]=e.match(/^(.*!)([^!]*)$/s);i||n(`The ${e} tag has no suffix`);let o=this.tags[r];if(o)try{return o+decodeURIComponent(i)}catch(s){return n(String(s)),null}return r==="!"?e:(n(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[n,r]of Object.entries(this.tags))if(e.startsWith(r))return n+fd(e.substring(r.length));return e[0]==="!"?e:`!<${e}>`}toString(e){let n=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],r=Object.entries(this.tags),i;if(e&&r.length>0&&Ea.isNode(e.contents)){let o={};ld.visit(e.contents,(s,a)=>{Ea.isNode(a)&&a.tag&&(o[a.tag]=!0)}),i=Object.keys(o)}else i=[];for(let[o,s]of r)o==="!!"&&s==="tag:yaml.org,2002:"||(!e||i.some(a=>a.startsWith(s)))&&n.push(`%TAG ${o} ${s}`);return n.join(`
5
+ `)}};qt.defaultYaml={explicit:!1,version:"1.2"};qt.defaultTags={"!!":"tag:yaml.org,2002:"};Ra.Directives=qt});var Qn=w(Dt=>{"use strict";var _a=P(),dd=Lt();function pd(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 xa(t){let e=new Set;return dd.visit(t,{Value(n,r){r.anchor&&e.add(r.anchor)}}),e}function Pa(t,e){for(let n=1;;++n){let r=`${t}${n}`;if(!e.has(r))return r}}function md(t,e){let n=[],r=new Map,i=null;return{onAnchor:o=>{n.push(o),i??(i=xa(t));let s=Pa(e,i);return i.add(s),s},setAnchors:()=>{for(let o of n){let s=r.get(o);if(typeof s=="object"&&s.anchor&&(_a.isScalar(s.node)||_a.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:r}}Dt.anchorIsValid=pd;Dt.anchorNames=xa;Dt.createNodeAnchors=md;Dt.findNewAnchor=Pa});var Fi=w(Oa=>{"use strict";function Wt(t,e,n,r){if(r&&typeof r=="object")if(Array.isArray(r))for(let i=0,o=r.length;i<o;++i){let s=r[i],a=Wt(t,r,String(i),s);a===void 0?delete r[i]:a!==s&&(r[i]=a)}else if(r instanceof Map)for(let i of Array.from(r.keys())){let o=r.get(i),s=Wt(t,r,i,o);s===void 0?r.delete(i):s!==o&&r.set(i,s)}else if(r instanceof Set)for(let i of Array.from(r)){let o=Wt(t,r,i,i);o===void 0?r.delete(i):o!==i&&(r.delete(i),r.add(o))}else for(let[i,o]of Object.entries(r)){let s=Wt(t,r,i,o);s===void 0?delete r[i]:s!==o&&(r[i]=s)}return t.call(e,n,r)}Oa.applyReviver=Wt});var Ae=w(Na=>{"use strict";var hd=P();function Aa(t,e,n){if(Array.isArray(t))return t.map((r,i)=>Aa(r,String(i),n));if(t&&typeof t.toJSON=="function"){if(!n||!hd.hasAnchor(t))return t.toJSON(e,n);let r={aliasCount:0,count:1,res:void 0};n.anchors.set(t,r),n.onCreate=o=>{r.res=o,delete n.onCreate};let i=t.toJSON(e,n);return n.onCreate&&n.onCreate(i),i}return typeof t=="bigint"&&!n?.keep?Number(t):t}Na.toJS=Aa});var Zn=w(Ta=>{"use strict";var gd=Fi(),ja=P(),wd=Ae(),Bi=class{constructor(e){Object.defineProperty(this,ja.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:r,onAnchor:i,reviver:o}={}){if(!ja.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 r=="number"?r:100},a=wd.toJS(this,"",s);if(typeof i=="function")for(let{count:c,res:l}of s.anchors.values())i(l,c);return typeof o=="function"?gd.applyReviver(o,{"":a},"",a):a}};Ta.NodeBase=Bi});var Mt=w(Ia=>{"use strict";var yd=Qn(),vd=Lt(),gt=P(),bd=Zn(),kd=Ae(),Ki=class extends bd.NodeBase{constructor(e){super(gt.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 r;n?.aliasResolveCache?r=n.aliasResolveCache:(r=[],vd.visit(e,{Node:(o,s)=>{(gt.isAlias(s)||gt.hasAnchor(s))&&r.push(s)}}),n&&(n.aliasResolveCache=r));let i;for(let o of r){if(o===this)break;o.anchor===this.source&&(i=o)}return i}toJSON(e,n){if(!n)return{source:this.source};let{anchors:r,doc:i,maxAliasCount:o}=n,s=this.resolve(i,n);if(!s){let c=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(c)}let a=r.get(s);if(a||(kd.toJS(s,null,n),a=r.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=er(i,s,r)),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,r){let i=`*${this.source}`;if(e){if(yd.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`${i} `}return i}};function er(t,e,n){if(gt.isAlias(e)){let r=e.resolve(t),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}else if(gt.isCollection(e)){let r=0;for(let i of e.items){let o=er(t,i,n);o>r&&(r=o)}return r}else if(gt.isPair(e)){let r=er(t,e.key,n),i=er(t,e.value,n);return Math.max(r,i)}return 1}Ia.Alias=Ki});var $=w(Ui=>{"use strict";var Sd=P(),Cd=Zn(),Ed=Ae(),Rd=t=>!t||typeof t!="function"&&typeof t!="object",Ne=class extends Cd.NodeBase{constructor(e){super(Sd.SCALAR),this.value=e}toJSON(e,n){return n?.keep?this.value:Ed.toJS(this.value,e,n)}toString(){return String(this.value)}};Ne.BLOCK_FOLDED="BLOCK_FOLDED";Ne.BLOCK_LITERAL="BLOCK_LITERAL";Ne.PLAIN="PLAIN";Ne.QUOTE_DOUBLE="QUOTE_DOUBLE";Ne.QUOTE_SINGLE="QUOTE_SINGLE";Ui.Scalar=Ne;Ui.isScalarValue=Rd});var Ft=w(La=>{"use strict";var _d=Mt(),Ze=P(),$a=$(),xd="tag:yaml.org,2002:";function Pd(t,e,n){if(e){let r=n.filter(o=>o.tag===e),i=r.find(o=>!o.format)??r[0];if(!i)throw new Error(`Tag ${e} not found`);return i}return n.find(r=>r.identify?.(t)&&!r.format)}function Od(t,e,n){if(Ze.isDocument(t)&&(t=t.contents),Ze.isNode(t))return t;if(Ze.isPair(t)){let u=n.schema[Ze.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:r,onAnchor:i,onTagObj:o,schema:s,sourceObjects:a}=n,c;if(r&&t&&typeof t=="object"){if(c=a.get(t),c)return c.anchor??(c.anchor=i(t)),new _d.Alias(c.anchor);c={anchor:null,node:null},a.set(t,c)}e?.startsWith("!!")&&(e=xd+e.slice(2));let l=Pd(t,e,s.tags);if(!l){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let u=new $a.Scalar(t);return c&&(c.node=u),u}l=t instanceof Map?s[Ze.MAP]:Symbol.iterator in Object(t)?s[Ze.SEQ]:s[Ze.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 $a.Scalar(t);return e?f.tag=e:l.default||(f.tag=l.tag),c&&(c.node=f),f}La.createNode=Od});var nr=w(tr=>{"use strict";var Ad=Ft(),he=P(),Nd=Zn();function Yi(t,e,n){let r=n;for(let i=e.length-1;i>=0;--i){let o=e[i];if(typeof o=="number"&&Number.isInteger(o)&&o>=0){let s=[];s[o]=r,r=s}else r=new Map([[o,r]])}return Ad.createNode(r,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:t,sourceObjects:new Map})}var qa=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,Gi=class extends Nd.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(r=>he.isNode(r)||he.isPair(r)?r.clone(e):r),this.range&&(n.range=this.range.slice()),n}addIn(e,n){if(qa(e))this.add(n);else{let[r,...i]=e,o=this.get(r,!0);if(he.isCollection(o))o.addIn(i,n);else if(o===void 0&&this.schema)this.set(r,Yi(this.schema,i,n));else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${i}`)}}deleteIn(e){let[n,...r]=e;if(r.length===0)return this.delete(n);let i=this.get(n,!0);if(he.isCollection(i))return i.deleteIn(r);throw new Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}getIn(e,n){let[r,...i]=e,o=this.get(r,!0);return i.length===0?!n&&he.isScalar(o)?o.value:o:he.isCollection(o)?o.getIn(i,n):void 0}hasAllNullValues(e){return this.items.every(n=>{if(!he.isPair(n))return!1;let r=n.value;return r==null||e&&he.isScalar(r)&&r.value==null&&!r.commentBefore&&!r.comment&&!r.tag})}hasIn(e){let[n,...r]=e;if(r.length===0)return this.has(n);let i=this.get(n,!0);return he.isCollection(i)?i.hasIn(r):!1}setIn(e,n){let[r,...i]=e;if(i.length===0)this.set(r,n);else{let o=this.get(r,!0);if(he.isCollection(o))o.setIn(i,n);else if(o===void 0&&this.schema)this.set(r,Yi(this.schema,i,n));else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${i}`)}}};tr.Collection=Gi;tr.collectionFromPath=Yi;tr.isEmptyPath=qa});var Bt=w(rr=>{"use strict";var jd=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function Vi(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var Td=(t,e,n)=>t.endsWith(`
6
+ `)?Vi(n,e):n.includes(`
7
7
  `)?`
8
- `+Lr(n,e):(t.endsWith(" ")?"":" ")+n;zn.indentComment=Lr;zn.lineComment=gd;zn.stringifyComment=hd});var Ra=w(Mt=>{"use strict";var wd="flow",Dr="block",Xn="quoted";function yd(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=[],f={},u=r-e.length;typeof i=="number"&&(i>r-Math.max(2,s)?l.push(0):u=r-i);let d,m,g=!1,p=-1,h=-1,v=-1;n===Dr&&(p=Ea(t,p,e.length),p!==-1&&(u=p+c));for(let S;S=t[p+=1];){if(n===Xn&&S==="\\"){switch(h=p,t[p+1]){case"x":p+=3;break;case"u":p+=5;break;case"U":p+=9;break;default:p+=1}v=p}if(S===`
9
- `)n===Dr&&(p=Ea(t,p,e.length)),u=p+e.length+c,d=void 0;else{if(S===" "&&m&&m!==" "&&m!==`
8
+ `+Vi(n,e):(t.endsWith(" ")?"":" ")+n;rr.indentComment=Vi;rr.lineComment=Td;rr.stringifyComment=jd});var Wa=w(Kt=>{"use strict";var Id="flow",Hi="block",ir="quoted";function $d(t,e,n="flow",{indentAtStart:r,lineWidth:i=80,minContentWidth:o=20,onFold:s,onOverflow:a}={}){if(!i||i<0)return t;i<o&&(o=0);let c=Math.max(1+o,1+i-e.length);if(t.length<=c)return t;let l=[],f={},u=i-e.length;typeof r=="number"&&(r>i-Math.max(2,o)?l.push(0):u=i-r);let d,m,g=!1,p=-1,h=-1,v=-1;n===Hi&&(p=Da(t,p,e.length),p!==-1&&(u=p+c));for(let S;S=t[p+=1];){if(n===ir&&S==="\\"){switch(h=p,t[p+1]){case"x":p+=3;break;case"u":p+=5;break;case"U":p+=9;break;default:p+=1}v=p}if(S===`
9
+ `)n===Hi&&(p=Da(t,p,e.length)),u=p+e.length+c,d=void 0;else{if(S===" "&&m&&m!==" "&&m!==`
10
10
  `&&m!==" "){let R=t[p+1];R&&R!==" "&&R!==`
11
- `&&R!==" "&&(d=p)}if(p>=u)if(d)l.push(d),u=d+c,d=void 0;else if(n===Xn){for(;m===" "||m===" ";)m=S,S=t[p+=1],g=!0;let R=p>v+1?p-2:h-1;if(f[R])return t;l.push(R),f[R]=!0,u=R+c,d=void 0}else g=!0}m=S}if(g&&a&&a(),l.length===0)return t;o&&o();let y=t.slice(0,l[0]);for(let S=0;S<l.length;++S){let R=l[S],_=l[S+1]||t.length;R===0?y=`
12
- ${e}${t.slice(0,_)}`:(n===Xn&&f[R]&&(y+=`${t[R]}\\`),y+=`
13
- ${e}${t.slice(R+1,_)}`)}return y}function Ea(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}Mt.FOLD_BLOCK=Dr;Mt.FOLD_FLOW=wd;Mt.FOLD_QUOTED=Xn;Mt.foldFlowLines=yd});var Wt=w(_a=>{"use strict";var re=$(),Oe=Ra(),Zn=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),ei=t=>/^(%|---|\.\.\.)/m.test(t);function vd(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 Ft(t,e){let n=JSON.stringify(t);if(e.options.doubleQuotedAsJSON)return n;let{implicitKey:i}=e,r=e.options.doubleQuotedMinMultiLineLength,s=e.indent||(ei(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 f=n.substr(c+2,4);switch(f){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:f.substr(0,2)==="00"?o+="\\x"+f.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
+ `&&R!==" "&&(d=p)}if(p>=u)if(d)l.push(d),u=d+c,d=void 0;else if(n===ir){for(;m===" "||m===" ";)m=S,S=t[p+=1],g=!0;let R=p>v+1?p-2:h-1;if(f[R])return t;l.push(R),f[R]=!0,u=R+c,d=void 0}else g=!0}m=S}if(g&&a&&a(),l.length===0)return t;s&&s();let y=t.slice(0,l[0]);for(let S=0;S<l.length;++S){let R=l[S],_=l[S+1]||t.length;R===0?y=`
12
+ ${e}${t.slice(0,_)}`:(n===ir&&f[R]&&(y+=`${t[R]}\\`),y+=`
13
+ ${e}${t.slice(R+1,_)}`)}return y}function Da(t,e,n){let r=e,i=e+1,o=t[i];for(;o===" "||o===" ";)if(e<i+n)o=t[++e];else{do o=t[++e];while(o&&o!==`
14
+ `);r=e,i=e+1,o=t[i]}return r}Kt.FOLD_BLOCK=Hi;Kt.FOLD_FLOW=Id;Kt.FOLD_QUOTED=ir;Kt.foldFlowLines=$d});var Yt=w(Ma=>{"use strict";var ae=$(),je=Wa(),sr=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),ar=t=>/^(%|---|\.\.\.)/m.test(t);function Ld(t,e,n){if(!e||e<0)return!1;let r=e-n,i=t.length;if(i<=r)return!1;for(let o=0,s=0;o<i;++o)if(t[o]===`
15
+ `){if(o-s>r)return!0;if(s=o+1,i-s<=r)return!1}return!0}function Ut(t,e){let n=JSON.stringify(t);if(e.options.doubleQuotedAsJSON)return n;let{implicitKey:r}=e,i=e.options.doubleQuotedMinMultiLineLength,o=e.indent||(ar(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(r||n[c+2]==='"'||n.length<i)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:Oe.foldFlowLines(o,s,Oe.FOLD_QUOTED,Zn(e,!1))}function Mr(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||(ei(t)?" ":""),i="'"+t.replace(/'/g,"''").replace(/\n+/g,`$&
20
- ${n}`)+"'";return e.implicitKey?i:Oe.foldFlowLines(i,n,Oe.FOLD_FLOW,Zn(e,!1))}function dt(t,e){let{singleQuote:n}=e.options,i;if(n===!1)i=Ft;else{let r=t.includes('"'),s=t.includes("'");r&&!s?i=Mr:s&&!r?i=Ft:i=n?Mr:Ft}return i(t,e)}var Fr;try{Fr=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,r?s:je.foldFlowLines(s,o,je.FOLD_QUOTED,sr(e,!1))}function Ji(t,e){if(e.options.singleQuote===!1||e.implicitKey&&t.includes(`
19
+ `)||/[ \t]\n|\n[ \t]/.test(t))return Ut(t,e);let n=e.indent||(ar(t)?" ":""),r="'"+t.replace(/'/g,"''").replace(/\n+/g,`$&
20
+ ${n}`)+"'";return e.implicitKey?r:je.foldFlowLines(r,n,je.FOLD_FLOW,sr(e,!1))}function wt(t,e){let{singleQuote:n}=e.options,r;if(n===!1)r=Ut;else{let i=t.includes('"'),o=t.includes("'");i&&!o?r=Ji:o&&!i?r=Ut:r=n?Ji:Ut}return r(t,e)}var zi;try{zi=new RegExp(`(^|(?<!
21
21
  ))
22
22
  +(?!
23
- |$)`,"g")}catch{Fr=/\n+(?!\n|$)/g}function Qn({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 dt(n,i);let l=i.indent||(i.forceBlockIndent||ei(n)?" ":""),f=o==="literal"?!0:o==="folded"||e===re.Scalar.BLOCK_FOLDED?!1:e===re.Scalar.BLOCK_LITERAL?!0:!vd(n,c,l.length);if(!n)return f?`|
23
+ |$)`,"g")}catch{zi=/\n+(?!\n|$)/g}function or({comment:t,type:e,value:n},r,i,o){let{blockQuote:s,commentString:a,lineWidth:c}=r.options;if(!s||/\n[\t ]+$/.test(n))return wt(n,r);let l=r.indent||(r.forceBlockIndent||ar(n)?" ":""),f=s==="literal"?!0:s==="folded"||e===ae.Scalar.BLOCK_FOLDED?!1:e===ae.Scalar.BLOCK_LITERAL?!0:!Ld(n,c,l.length);if(!n)return f?`|
24
24
  `:`>
25
25
  `;let u,d;for(d=n.length;d>0;--d){let _=n[d-1];if(_!==`
26
26
  `&&_!==" "&&_!==" ")break}let m=n.substring(d),g=m.indexOf(`
27
- `);g===-1?u="-":n===m||g!==m.length-1?(u="+",s&&s()):u="",m&&(n=n.slice(0,-m.length),m[m.length-1]===`
28
- `&&(m=m.slice(0,-1)),m=m.replace(Fr,`$&${l}`));let p=!1,h,v=-1;for(h=0;h<n.length;++h){let _=n[h];if(_===" ")p=!0;else if(_===`
29
- `)v=h;else break}let y=n.substring(0,v<h?v+1:h);y&&(n=n.substring(y.length),y=y.replace(/\n+/g,`$&${l}`));let R=(p?l?"2":"1":"")+u;if(t&&(R+=" "+a(t.replace(/ ?[\r\n]+/g," ")),r&&r()),!f){let _=n.replace(/\n+/g,`
30
- $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${l}`),E=!1,N=Zn(i,!0);o!=="folded"&&e!==re.Scalar.BLOCK_FOLDED&&(N.onOverflow=()=>{E=!0});let k=Oe.foldFlowLines(`${y}${_}${m}`,l,Oe.FOLD_BLOCK,N);if(!E)return`>${R}
27
+ `);g===-1?u="-":n===m||g!==m.length-1?(u="+",o&&o()):u="",m&&(n=n.slice(0,-m.length),m[m.length-1]===`
28
+ `&&(m=m.slice(0,-1)),m=m.replace(zi,`$&${l}`));let p=!1,h,v=-1;for(h=0;h<n.length;++h){let _=n[h];if(_===" ")p=!0;else if(_===`
29
+ `)v=h;else break}let y=n.substring(0,v<h?v+1:h);y&&(n=n.substring(y.length),y=y.replace(/\n+/g,`$&${l}`));let R=(p?l?"2":"1":"")+u;if(t&&(R+=" "+a(t.replace(/ ?[\r\n]+/g," ")),i&&i()),!f){let _=n.replace(/\n+/g,`
30
+ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${l}`),E=!1,A=sr(r,!0);s!=="folded"&&e!==ae.Scalar.BLOCK_FOLDED&&(A.onOverflow=()=>{E=!0});let k=je.foldFlowLines(`${y}${_}${m}`,l,je.FOLD_BLOCK,A);if(!E)return`>${R}
31
31
  ${l}${k}`}return n=n.replace(/\n+/g,`$&${l}`),`|${R}
32
- ${l}${y}${n}${m}`}function bd(t,e,n,i){let{type:r,value:s}=t,{actualString:o,implicitKey:a,indent:c,indentStep:l,inFlow:f}=e;if(a&&s.includes(`
33
- `)||f&&/[[\]{},]/.test(s))return dt(s,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(s))return a||f||!s.includes(`
34
- `)?dt(s,e):Qn(t,e,n,i);if(!a&&!f&&r!==re.Scalar.PLAIN&&s.includes(`
35
- `))return Qn(t,e,n,i);if(ei(s)){if(c==="")return e.forceBlockIndent=!0,Qn(t,e,n,i);if(a&&c===l)return dt(s,e)}let u=s.replace(/\n+/g,`$&
36
- ${c}`);if(o){let d=p=>p.default&&p.tag!=="tag:yaml.org,2002:str"&&p.test?.test(u),{compat:m,tags:g}=e.doc.schema;if(g.some(d)||m?.some(d))return dt(s,e)}return a?u:Oe.foldFlowLines(u,c,Oe.FOLD_FLOW,Zn(e,!1))}function kd(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!==re.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(a=re.Scalar.QUOTE_DOUBLE);let c=f=>{switch(f){case re.Scalar.BLOCK_FOLDED:case re.Scalar.BLOCK_LITERAL:return r||s?dt(o.value,e):Qn(o,e,n,i);case re.Scalar.QUOTE_DOUBLE:return Ft(o.value,e);case re.Scalar.QUOTE_SINGLE:return Mr(o.value,e);case re.Scalar.PLAIN:return bd(o,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}_a.stringifyString=kd});var Bt=w(Wr=>{"use strict";var Sd=Yn(),Ne=P(),Cd=Dt(),Ed=Wt();function Rd(t,e){let n=Object.assign({blockQuote:!0,commentString:Cd.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 _d(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(Ne.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 xd(t,e,{anchors:n,doc:i}){if(!i.directives)return"";let r=[],s=(Ne.isScalar(t)||Ne.isCollection(t))&&t.anchor;s&&Sd.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 Pd(t,e,n,i){if(Ne.isPair(t))return t.toString(e,n,i);if(Ne.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=Ne.isNode(t)?t:e.doc.createNode(t,{onTagObj:c=>r=c});r??(r=_d(e.doc.schema.tags,s));let o=xd(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):Ne.isScalar(s)?Ed.stringifyString(s,e,n,i):s.toString(e,n,i);return o?Ne.isScalar(s)||a[0]==="{"||a[0]==="["?`${o} ${a}`:`${o}
37
- ${e.indent}${a}`:a}Wr.createStringifyContext=Rd;Wr.stringify=Pd});var Na=w(Oa=>{"use strict";var ye=P(),xa=$(),Pa=Bt(),Kt=Dt();function Od({key:t,value:e},n,i,r){let{allNullValues:s,doc:o,indent:a,indentStep:c,options:{commentString:l,indentSeq:f,simpleKeys:u}}=n,d=ye.isNode(t)&&t.comment||null;if(u){if(d)throw new Error("With simple keys, key nodes cannot have comments");if(ye.isCollection(t)||!ye.isNode(t)&&typeof t=="object"){let N="With simple keys, collection cannot be used as a key value";throw new Error(N)}}let m=!u&&(!t||d&&e==null&&!n.inFlow||ye.isCollection(t)||(ye.isScalar(t)?t.type===xa.Scalar.BLOCK_FOLDED||t.type===xa.Scalar.BLOCK_LITERAL:typeof t=="object"));n=Object.assign({},n,{allNullValues:!1,implicitKey:!m&&(u||!s),indent:a+c});let g=!1,p=!1,h=Pa.stringify(t,n,()=>g=!0,()=>p=!0);if(!m&&!n.inFlow&&h.length>1024){if(u)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");m=!0}if(n.inFlow){if(s||e==null)return g&&i&&i(),h===""?"?":m?`? ${h}`:h}else if(s&&!u||e==null&&m)return h=`? ${h}`,d&&!g?h+=Kt.lineComment(h,n.indent,l(d)):p&&r&&r(),h;g&&(d=null),m?(d&&(h+=Kt.lineComment(h,n.indent,l(d))),h=`? ${h}
38
- ${a}:`):(h=`${h}:`,d&&(h+=Kt.lineComment(h,n.indent,l(d))));let v,y,S;ye.isNode(e)?(v=!!e.spaceBefore,y=e.commentBefore,S=e.comment):(v=!1,y=null,S=null,e&&typeof e=="object"&&(e=o.createNode(e))),n.implicitKey=!1,!m&&!d&&ye.isScalar(e)&&(n.indentAtStart=h.length+1),p=!1,!f&&c.length>=2&&!n.inFlow&&!m&&ye.isSeq(e)&&!e.flow&&!e.tag&&!e.anchor&&(n.indent=n.indent.substring(2));let R=!1,_=Pa.stringify(e,n,()=>R=!0,()=>p=!0),E=" ";if(d||v||y){if(E=v?`
39
- `:"",y){let N=l(y);E+=`
40
- ${Kt.indentComment(N,n.indent)}`}_===""&&!n.inFlow?E===`
32
+ ${l}${y}${n}${m}`}function qd(t,e,n,r){let{type:i,value:o}=t,{actualString:s,implicitKey:a,indent:c,indentStep:l,inFlow:f}=e;if(a&&o.includes(`
33
+ `)||f&&/[[\]{},]/.test(o))return wt(o,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(o))return a||f||!o.includes(`
34
+ `)?wt(o,e):or(t,e,n,r);if(!a&&!f&&i!==ae.Scalar.PLAIN&&o.includes(`
35
+ `))return or(t,e,n,r);if(ar(o)){if(c==="")return e.forceBlockIndent=!0,or(t,e,n,r);if(a&&c===l)return wt(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:m,tags:g}=e.doc.schema;if(g.some(d)||m?.some(d))return wt(o,e)}return a?u:je.foldFlowLines(u,c,je.FOLD_FLOW,sr(e,!1))}function Dd(t,e,n,r){let{implicitKey:i,inFlow:o}=e,s=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(s.value)&&(a=ae.Scalar.QUOTE_DOUBLE);let c=f=>{switch(f){case ae.Scalar.BLOCK_FOLDED:case ae.Scalar.BLOCK_LITERAL:return i||o?wt(s.value,e):or(s,e,n,r);case ae.Scalar.QUOTE_DOUBLE:return Ut(s.value,e);case ae.Scalar.QUOTE_SINGLE:return Ji(s.value,e);case ae.Scalar.PLAIN:return qd(s,e,n,r);default:return null}},l=c(a);if(l===null){let{defaultKeyType:f,defaultStringType:u}=e.options,d=i&&f||u;if(l=c(d),l===null)throw new Error(`Unsupported default string type ${d}`)}return l}Ma.stringifyString=Dd});var Gt=w(Xi=>{"use strict";var Wd=Qn(),Te=P(),Md=Bt(),Fd=Yt();function Bd(t,e){let n=Object.assign({blockQuote:!0,commentString:Md.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),r;switch(n.collectionStyle){case"block":r=!1;break;case"flow":r=!0;break;default:r=null}return{anchors:new Set,doc:t,flowCollectionPadding:n.flowCollectionPadding?" ":"",indent:"",indentStep:typeof n.indent=="number"?" ".repeat(n.indent):" ",inFlow:r,options:n}}function Kd(t,e){if(e.tag){let i=t.filter(o=>o.tag===e.tag);if(i.length>0)return i.find(o=>o.format===e.format)??i[0]}let n,r;if(Te.isScalar(e)){r=e.value;let i=t.filter(o=>o.identify?.(r));if(i.length>1){let o=i.filter(s=>s.test);o.length>0&&(i=o)}n=i.find(o=>o.format===e.format)??i.find(o=>!o.format)}else r=e,n=t.find(i=>i.nodeClass&&r instanceof i.nodeClass);if(!n){let i=r?.constructor?.name??(r===null?"null":typeof r);throw new Error(`Tag not resolved for ${i} value`)}return n}function Ud(t,e,{anchors:n,doc:r}){if(!r.directives)return"";let i=[],o=(Te.isScalar(t)||Te.isCollection(t))&&t.anchor;o&&Wd.anchorIsValid(o)&&(n.add(o),i.push(`&${o}`));let s=t.tag??(e.default?null:e.tag);return s&&i.push(r.directives.tagString(s)),i.join(" ")}function Yd(t,e,n,r){if(Te.isPair(t))return t.toString(e,n,r);if(Te.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 i,o=Te.isNode(t)?t:e.doc.createNode(t,{onTagObj:c=>i=c});i??(i=Kd(e.doc.schema.tags,o));let s=Ud(o,i,e);s.length>0&&(e.indentAtStart=(e.indentAtStart??0)+s.length+1);let a=typeof i.stringify=="function"?i.stringify(o,e,n,r):Te.isScalar(o)?Fd.stringifyString(o,e,n,r):o.toString(e,n,r);return s?Te.isScalar(o)||a[0]==="{"||a[0]==="["?`${s} ${a}`:`${s}
37
+ ${e.indent}${a}`:a}Xi.createStringifyContext=Bd;Xi.stringify=Yd});var Ua=w(Ka=>{"use strict";var ve=P(),Fa=$(),Ba=Gt(),Vt=Bt();function Gd({key:t,value:e},n,r,i){let{allNullValues:o,doc:s,indent:a,indentStep:c,options:{commentString:l,indentSeq:f,simpleKeys:u}}=n,d=ve.isNode(t)&&t.comment||null;if(u){if(d)throw new Error("With simple keys, key nodes cannot have comments");if(ve.isCollection(t)||!ve.isNode(t)&&typeof t=="object"){let A="With simple keys, collection cannot be used as a key value";throw new Error(A)}}let m=!u&&(!t||d&&e==null&&!n.inFlow||ve.isCollection(t)||(ve.isScalar(t)?t.type===Fa.Scalar.BLOCK_FOLDED||t.type===Fa.Scalar.BLOCK_LITERAL:typeof t=="object"));n=Object.assign({},n,{allNullValues:!1,implicitKey:!m&&(u||!o),indent:a+c});let g=!1,p=!1,h=Ba.stringify(t,n,()=>g=!0,()=>p=!0);if(!m&&!n.inFlow&&h.length>1024){if(u)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");m=!0}if(n.inFlow){if(o||e==null)return g&&r&&r(),h===""?"?":m?`? ${h}`:h}else if(o&&!u||e==null&&m)return h=`? ${h}`,d&&!g?h+=Vt.lineComment(h,n.indent,l(d)):p&&i&&i(),h;g&&(d=null),m?(d&&(h+=Vt.lineComment(h,n.indent,l(d))),h=`? ${h}
38
+ ${a}:`):(h=`${h}:`,d&&(h+=Vt.lineComment(h,n.indent,l(d))));let v,y,S;ve.isNode(e)?(v=!!e.spaceBefore,y=e.commentBefore,S=e.comment):(v=!1,y=null,S=null,e&&typeof e=="object"&&(e=s.createNode(e))),n.implicitKey=!1,!m&&!d&&ve.isScalar(e)&&(n.indentAtStart=h.length+1),p=!1,!f&&c.length>=2&&!n.inFlow&&!m&&ve.isSeq(e)&&!e.flow&&!e.tag&&!e.anchor&&(n.indent=n.indent.substring(2));let R=!1,_=Ba.stringify(e,n,()=>R=!0,()=>p=!0),E=" ";if(d||v||y){if(E=v?`
39
+ `:"",y){let A=l(y);E+=`
40
+ ${Vt.indentComment(A,n.indent)}`}_===""&&!n.inFlow?E===`
41
41
  `&&S&&(E=`
42
42
 
43
43
  `):E+=`
44
- ${n.indent}`}else if(!m&&ye.isCollection(e)){let N=_[0],k=_.indexOf(`
45
- `),L=k!==-1,_e=n.inFlow??e.flow??e.items.length===0;if(L||!_e){let at=!1;if(L&&(N==="&"||N==="!")){let D=_.indexOf(" ");N==="&"&&D!==-1&&D<k&&_[D+1]==="!"&&(D=_.indexOf(" ",D+1)),(D===-1||k<D)&&(at=!0)}at||(E=`
44
+ ${n.indent}`}else if(!m&&ve.isCollection(e)){let A=_[0],k=_.indexOf(`
45
+ `),q=k!==-1,Oe=n.inFlow??e.flow??e.items.length===0;if(q||!Oe){let pt=!1;if(q&&(A==="&"||A==="!")){let D=_.indexOf(" ");A==="&"&&D!==-1&&D<k&&_[D+1]==="!"&&(D=_.indexOf(" ",D+1)),(D===-1||k<D)&&(pt=!0)}pt||(E=`
46
46
  ${n.indent}`)}}else(_===""||_[0]===`
47
- `)&&(E="");return h+=E+_,n.inFlow?R&&i&&i():S&&!R?h+=Kt.lineComment(h,n.indent,l(S)):p&&r&&r(),h}Oa.stringifyPair=Od});var Kr=w(Br=>{"use strict";var Aa=Fn("process");function Nd(t,...e){t==="debug"&&console.log(...e)}function Ad(t,e){(t==="debug"||t==="warn")&&(typeof Aa.emitWarning=="function"?Aa.emitWarning(e):console.warn(e))}Br.debug=Nd;Br.warn=Ad});var si=w(ri=>{"use strict";var ii=P(),Ta=$(),ti="<<",ni={identify:t=>t===ti||typeof t=="symbol"&&t.description===ti,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new Ta.Scalar(Symbol(ti)),{addToJSMap:Ia}),stringify:()=>ti},Td=(t,e)=>(ni.identify(e)||ii.isScalar(e)&&(!e.type||e.type===Ta.Scalar.PLAIN)&&ni.identify(e.value))&&t?.doc.schema.tags.some(n=>n.tag===ni.tag&&n.default);function Ia(t,e,n){let i=ja(t,n);if(ii.isSeq(i))for(let r of i.items)Ur(t,e,r);else if(Array.isArray(i))for(let r of i)Ur(t,e,r);else Ur(t,e,i)}function Ur(t,e,n){let i=ja(t,n);if(!ii.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 ja(t,e){return t&&ii.isAlias(e)?e.resolve(t.doc,t):e}ri.addMergeToJSMap=Ia;ri.isMergeKey=Td;ri.merge=ni});var Vr=w(La=>{"use strict";var Id=Kr(),$a=si(),jd=Bt(),qa=P(),Yr=xe();function $d(t,e,{key:n,value:i}){if(qa.isNode(n)&&n.addToJSMap)n.addToJSMap(t,e,i);else if($a.isMergeKey(t,n))$a.addMergeToJSMap(t,e,i);else{let r=Yr.toJS(n,"",t);if(e instanceof Map)e.set(r,Yr.toJS(i,r,t));else if(e instanceof Set)e.add(r);else{let s=qd(n,r,t),o=Yr.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 qd(t,e,n){if(e===null)return"";if(typeof e!="object")return String(e);if(qa.isNode(t)&&n?.doc){let i=jd.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)+'..."'),Id.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)}La.addPairToJSMap=$d});var Ae=w(Jr=>{"use strict";var Da=Lt(),Ld=Na(),Dd=Vr(),oi=P();function Md(t,e,n){let i=Da.createNode(t,void 0,n),r=Da.createNode(e,void 0,n);return new ai(i,r)}var ai=class t{constructor(e,n=null){Object.defineProperty(this,oi.NODE_TYPE,{value:oi.PAIR}),this.key=e,this.value=n}clone(e){let{key:n,value:i}=this;return oi.isNode(n)&&(n=n.clone(e)),oi.isNode(i)&&(i=i.clone(e)),new t(n,i)}toJSON(e,n){let i=n?.mapAsMap?new Map:{};return Dd.addPairToJSMap(n,i,this)}toString(e,n,i){return e?.doc?Ld.stringifyPair(this,e,n,i):JSON.stringify(this)}};Jr.Pair=ai;Jr.createPair=Md});var Hr=w(Fa=>{"use strict";var Ge=P(),Ma=Bt(),ci=Dt();function Fd(t,e,n){return(e.inFlow??t.flow?Bd:Wd)(t,e,n)}function Wd({comment:t,items:e},n,{blockItemPrefix:i,flowChars:r,itemIndent:s,onChompKeep:o,onComment:a}){let{indent:c,options:{commentString:l}}=n,f=Object.assign({},n,{indent:s,type:null}),u=!1,d=[];for(let g=0;g<e.length;++g){let p=e[g],h=null;if(Ge.isNode(p))!u&&p.spaceBefore&&d.push(""),li(n,d,p.commentBefore,u),p.comment&&(h=p.comment);else if(Ge.isPair(p)){let y=Ge.isNode(p.key)?p.key:null;y&&(!u&&y.spaceBefore&&d.push(""),li(n,d,y.commentBefore,u))}u=!1;let v=Ma.stringify(p,f,()=>h=null,()=>u=!0);h&&(v+=ci.lineComment(v,s,l(h))),u&&h&&(u=!1),d.push(i+v)}let m;if(d.length===0)m=r.start+r.end;else{m=d[0];for(let g=1;g<d.length;++g){let p=d[g];m+=p?`
47
+ `)&&(E="");return h+=E+_,n.inFlow?R&&r&&r():S&&!R?h+=Vt.lineComment(h,n.indent,l(S)):p&&i&&i(),h}Ka.stringifyPair=Gd});var Zi=w(Qi=>{"use strict";var Ya=Vn("process");function Vd(t,...e){t==="debug"&&console.log(...e)}function Hd(t,e){(t==="debug"||t==="warn")&&(typeof Ya.emitWarning=="function"?Ya.emitWarning(e):console.warn(e))}Qi.debug=Vd;Qi.warn=Hd});var dr=w(fr=>{"use strict";var ur=P(),Ga=$(),cr="<<",lr={identify:t=>t===cr||typeof t=="symbol"&&t.description===cr,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new Ga.Scalar(Symbol(cr)),{addToJSMap:Va}),stringify:()=>cr},Jd=(t,e)=>(lr.identify(e)||ur.isScalar(e)&&(!e.type||e.type===Ga.Scalar.PLAIN)&&lr.identify(e.value))&&t?.doc.schema.tags.some(n=>n.tag===lr.tag&&n.default);function Va(t,e,n){let r=Ha(t,n);if(ur.isSeq(r))for(let i of r.items)eo(t,e,i);else if(Array.isArray(r))for(let i of r)eo(t,e,i);else eo(t,e,r)}function eo(t,e,n){let r=Ha(t,n);if(!ur.isMap(r))throw new Error("Merge sources must be maps or map aliases");let i=r.toJSON(null,t,Map);for(let[o,s]of i)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 Ha(t,e){return t&&ur.isAlias(e)?e.resolve(t.doc,t):e}fr.addMergeToJSMap=Va;fr.isMergeKey=Jd;fr.merge=lr});var no=w(Xa=>{"use strict";var zd=Zi(),Ja=dr(),Xd=Gt(),za=P(),to=Ae();function Qd(t,e,{key:n,value:r}){if(za.isNode(n)&&n.addToJSMap)n.addToJSMap(t,e,r);else if(Ja.isMergeKey(t,n))Ja.addMergeToJSMap(t,e,r);else{let i=to.toJS(n,"",t);if(e instanceof Map)e.set(i,to.toJS(r,i,t));else if(e instanceof Set)e.add(i);else{let o=Zd(n,i,t),s=to.toJS(r,o,t);o in e?Object.defineProperty(e,o,{value:s,writable:!0,enumerable:!0,configurable:!0}):e[o]=s}}return e}function Zd(t,e,n){if(e===null)return"";if(typeof e!="object")return String(e);if(za.isNode(t)&&n?.doc){let r=Xd.createStringifyContext(n.doc,{});r.anchors=new Set;for(let o of n.anchors.keys())r.anchors.add(o.anchor);r.inFlow=!0,r.inStringifyKey=!0;let i=t.toString(r);if(!n.mapKeyWarned){let o=JSON.stringify(i);o.length>40&&(o=o.substring(0,36)+'..."'),zd.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 i}return JSON.stringify(e)}Xa.addPairToJSMap=Qd});var Ie=w(ro=>{"use strict";var Qa=Ft(),ep=Ua(),tp=no(),pr=P();function np(t,e,n){let r=Qa.createNode(t,void 0,n),i=Qa.createNode(e,void 0,n);return new mr(r,i)}var mr=class t{constructor(e,n=null){Object.defineProperty(this,pr.NODE_TYPE,{value:pr.PAIR}),this.key=e,this.value=n}clone(e){let{key:n,value:r}=this;return pr.isNode(n)&&(n=n.clone(e)),pr.isNode(r)&&(r=r.clone(e)),new t(n,r)}toJSON(e,n){let r=n?.mapAsMap?new Map:{};return tp.addPairToJSMap(n,r,this)}toString(e,n,r){return e?.doc?ep.stringifyPair(this,e,n,r):JSON.stringify(this)}};ro.Pair=mr;ro.createPair=np});var io=w(ec=>{"use strict";var et=P(),Za=Gt(),hr=Bt();function rp(t,e,n){return(e.inFlow??t.flow?op:ip)(t,e,n)}function ip({comment:t,items:e},n,{blockItemPrefix:r,flowChars:i,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 g=0;g<e.length;++g){let p=e[g],h=null;if(et.isNode(p))!u&&p.spaceBefore&&d.push(""),gr(n,d,p.commentBefore,u),p.comment&&(h=p.comment);else if(et.isPair(p)){let y=et.isNode(p.key)?p.key:null;y&&(!u&&y.spaceBefore&&d.push(""),gr(n,d,y.commentBefore,u))}u=!1;let v=Za.stringify(p,f,()=>h=null,()=>u=!0);h&&(v+=hr.lineComment(v,o,l(h))),u&&h&&(u=!1),d.push(r+v)}let m;if(d.length===0)m=i.start+i.end;else{m=d[0];for(let g=1;g<d.length;++g){let p=d[g];m+=p?`
48
48
  ${c}${p}`:`
49
49
  `}}return t?(m+=`
50
- `+ci.indentComment(l(t),c),a&&a()):u&&o&&o(),m}function Bd({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,f=0,u=[];for(let g=0;g<t.length;++g){let p=t[g],h=null;if(Ge.isNode(p))p.spaceBefore&&u.push(""),li(e,u,p.commentBefore,!1),p.comment&&(h=p.comment);else if(Ge.isPair(p)){let y=Ge.isNode(p.key)?p.key:null;y&&(y.spaceBefore&&u.push(""),li(e,u,y.commentBefore,!1),y.comment&&(l=!0));let S=Ge.isNode(p.value)?p.value:null;S?(S.comment&&(h=S.comment),S.commentBefore&&(l=!0)):p.value==null&&y?.comment&&(h=y.comment)}h&&(l=!0);let v=Ma.stringify(p,c,()=>h=null);l||(l=u.length>f||v.includes(`
51
- `)),g<t.length-1?v+=",":e.options.trailingComma&&(e.options.lineWidth>0&&(l||(l=u.reduce((y,S)=>y+S.length+2,2)+(v.length+2)>e.options.lineWidth)),l&&(v+=",")),h&&(v+=ci.lineComment(v,i,a(h))),u.push(v),f=u.length}let{start:d,end:m}=n;if(u.length===0)return d+m;if(!l){let g=u.reduce((p,h)=>p+h.length+2,2);l=e.options.lineWidth>0&&g>e.options.lineWidth}if(l){let g=d;for(let p of u)g+=p?`
52
- ${s}${r}${p}`:`
50
+ `+hr.indentComment(l(t),c),a&&a()):u&&s&&s(),m}function op({items:t},e,{flowChars:n,itemIndent:r}){let{indent:i,indentStep:o,flowCollectionPadding:s,options:{commentString:a}}=e;r+=o;let c=Object.assign({},e,{indent:r,inFlow:!0,type:null}),l=!1,f=0,u=[];for(let g=0;g<t.length;++g){let p=t[g],h=null;if(et.isNode(p))p.spaceBefore&&u.push(""),gr(e,u,p.commentBefore,!1),p.comment&&(h=p.comment);else if(et.isPair(p)){let y=et.isNode(p.key)?p.key:null;y&&(y.spaceBefore&&u.push(""),gr(e,u,y.commentBefore,!1),y.comment&&(l=!0));let S=et.isNode(p.value)?p.value:null;S?(S.comment&&(h=S.comment),S.commentBefore&&(l=!0)):p.value==null&&y?.comment&&(h=y.comment)}h&&(l=!0);let v=Za.stringify(p,c,()=>h=null);l||(l=u.length>f||v.includes(`
51
+ `)),g<t.length-1?v+=",":e.options.trailingComma&&(e.options.lineWidth>0&&(l||(l=u.reduce((y,S)=>y+S.length+2,2)+(v.length+2)>e.options.lineWidth)),l&&(v+=",")),h&&(v+=hr.lineComment(v,r,a(h))),u.push(v),f=u.length}let{start:d,end:m}=n;if(u.length===0)return d+m;if(!l){let g=u.reduce((p,h)=>p+h.length+2,2);l=e.options.lineWidth>0&&g>e.options.lineWidth}if(l){let g=d;for(let p of u)g+=p?`
52
+ ${o}${i}${p}`:`
53
53
  `;return`${g}
54
- ${r}${m}`}else return`${d}${o}${u.join(" ")}${o}${m}`}function li({indent:t,options:{commentString:e}},n,i,r){if(i&&r&&(i=i.replace(/^\n+/,"")),i){let s=ci.indentComment(e(i),t);n.push(s.trimStart())}}Fa.stringifyCollection=Fd});var Ie=w(zr=>{"use strict";var Kd=Hr(),Ud=Vr(),Yd=Gn(),Te=P(),ui=Ae(),Vd=$();function Ut(t,e){let n=Te.isScalar(e)?e.value:e;for(let i of t)if(Te.isPair(i)&&(i.key===e||i.key===n||Te.isScalar(i.key)&&i.key.value===n))return i}var Gr=class extends Yd.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(Te.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(ui.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;Te.isPair(e)?i=e:!e||typeof e!="object"||!("key"in e)?i=new ui.Pair(e,e?.value):i=new ui.Pair(e.key,e.value);let r=Ut(this.items,i.key),s=this.schema?.sortMapEntries;if(r){if(!n)throw new Error(`Key ${i.key} already set`);Te.isScalar(r.value)&&Vd.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=Ut(this.items,e);return n?this.items.splice(this.items.indexOf(n),1).length>0:!1}get(e,n){let r=Ut(this.items,e)?.value;return(!n&&Te.isScalar(r)?r.value:r)??void 0}has(e){return!!Ut(this.items,e)}set(e,n){this.add(new ui.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)Ud.addPairToJSMap(n,r,s);return r}toString(e,n,i){if(!e)return JSON.stringify(this);for(let r of this.items)if(!Te.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})),Kd.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:i,onComment:n})}};zr.YAMLMap=Gr;zr.findPair=Ut});var pt=w(Ba=>{"use strict";var Jd=P(),Wa=Ie(),Hd={collection:"map",default:!0,nodeClass:Wa.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(t,e){return Jd.isMap(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,n)=>Wa.YAMLMap.from(t,e,n)};Ba.map=Hd});var je=w(Ka=>{"use strict";var Gd=Lt(),zd=Hr(),Xd=Gn(),di=P(),Qd=$(),Zd=xe(),Xr=class extends Xd.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(di.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let n=fi(e);return typeof n!="number"?!1:this.items.splice(n,1).length>0}get(e,n){let i=fi(e);if(typeof i!="number")return;let r=this.items[i];return!n&&di.isScalar(r)?r.value:r}has(e){let n=fi(e);return typeof n=="number"&&n<this.items.length}set(e,n){let i=fi(e);if(typeof i!="number")throw new Error(`Expected a valid index, not ${e}.`);let r=this.items[i];di.isScalar(r)&&Qd.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(Zd.toJS(s,String(r++),n));return i}toString(e,n,i){return e?zd.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(Gd.createNode(a,void 0,i))}}return s}};function fi(t){let e=di.isScalar(t)?t.value:t;return e&&typeof e=="string"&&(e=Number(e)),typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}Ka.YAMLSeq=Xr});var mt=w(Ya=>{"use strict";var ep=P(),Ua=je(),tp={collection:"seq",default:!0,nodeClass:Ua.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(t,e){return ep.isSeq(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,n)=>Ua.YAMLSeq.from(t,e,n)};Ya.seq=tp});var Yt=w(Va=>{"use strict";var np=Wt(),ip={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),np.stringifyString(t,e,n,i)}};Va.string=ip});var pi=w(Ga=>{"use strict";var Ja=$(),Ha={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"&&Ha.test.test(t)?t:e.options.nullStr};Ga.nullTag=Ha});var Qr=w(Xa=>{"use strict";var rp=$(),za={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new rp.Scalar(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},n){if(t&&za.test.test(t)){let i=t[0]==="t"||t[0]==="T";if(e===i)return t}return e?n.options.trueStr:n.options.falseStr}};Xa.boolTag=za});var ht=w(Qa=>{"use strict";function sp({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}Qa.stringifyNumber=sp});var es=w(mi=>{"use strict";var op=$(),Zr=ht(),ap={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:Zr.stringifyNumber},cp={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():Zr.stringifyNumber(t)}},lp={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 op.Scalar(parseFloat(t)),n=t.indexOf(".");return n!==-1&&t[t.length-1]==="0"&&(e.minFractionDigits=t.length-n-1),e},stringify:Zr.stringifyNumber};mi.float=lp;mi.floatExp=cp;mi.floatNaN=ap});var ns=w(gi=>{"use strict";var Za=ht(),hi=t=>typeof t=="bigint"||Number.isInteger(t),ts=(t,e,n,{intAsBigInt:i})=>i?BigInt(t):parseInt(t.substring(e),n);function ec(t,e,n){let{value:i}=t;return hi(i)&&i>=0?n+i.toString(e):Za.stringifyNumber(t)}var up={identify:t=>hi(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(t,e,n)=>ts(t,2,8,n),stringify:t=>ec(t,8,"0o")},fp={identify:hi,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,n)=>ts(t,0,10,n),stringify:Za.stringifyNumber},dp={identify:t=>hi(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(t,e,n)=>ts(t,2,16,n),stringify:t=>ec(t,16,"0x")};gi.int=fp;gi.intHex=dp;gi.intOct=up});var nc=w(tc=>{"use strict";var pp=pt(),mp=pi(),hp=mt(),gp=Yt(),wp=Qr(),is=es(),rs=ns(),yp=[pp.map,hp.seq,gp.string,mp.nullTag,wp.boolTag,rs.intOct,rs.int,rs.intHex,is.floatNaN,is.floatExp,is.float];tc.schema=yp});var sc=w(rc=>{"use strict";var vp=$(),bp=pt(),kp=mt();function ic(t){return typeof t=="bigint"||Number.isInteger(t)}var wi=({value:t})=>JSON.stringify(t),Sp=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:wi},{identify:t=>t==null,createNode:()=>new vp.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:wi},{identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:t=>t==="true",stringify:wi},{identify:ic,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})=>ic(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:wi}],Cp={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},Ep=[bp.map,kp.seq].concat(Sp,Cp);rc.schema=Ep});var os=w(oc=>{"use strict";var Vt=Fn("buffer"),ss=$(),Rp=Wt(),_p={identify:t=>t instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(t,e){if(typeof Vt.Buffer=="function")return Vt.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 Vt.Buffer=="function")a=o instanceof Vt.Buffer?o.toString("base64"):Vt.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=ss.Scalar.BLOCK_LITERAL),e!==ss.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===ss.Scalar.BLOCK_LITERAL?`
55
- `:" ")}return Rp.stringifyString({comment:t,type:e,value:a},i,r,s)}};oc.binary=_p});var bi=w(vi=>{"use strict";var yi=P(),as=Ae(),xp=$(),Pp=je();function ac(t,e){if(yi.isSeq(t))for(let n=0;n<t.items.length;++n){let i=t.items[n];if(!yi.isPair(i)){if(yi.isMap(i)){i.items.length>1&&e("Each pair must have its own sequence indicator");let r=i.items[0]||new as.Pair(new xp.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]=yi.isPair(i)?i:new as.Pair(i)}}else e("Expected a sequence for this tag");return t}function cc(t,e,n){let{replacer:i}=n,r=new Pp.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(as.createPair(a,c,n))}return r}var Op={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:ac,createNode:cc};vi.createPairs=cc;vi.pairs=Op;vi.resolvePairs=ac});var us=w(ls=>{"use strict";var lc=P(),cs=xe(),Jt=Ie(),Np=je(),uc=bi(),ze=class t extends Np.YAMLSeq{constructor(){super(),this.add=Jt.YAMLMap.prototype.add.bind(this),this.delete=Jt.YAMLMap.prototype.delete.bind(this),this.get=Jt.YAMLMap.prototype.get.bind(this),this.has=Jt.YAMLMap.prototype.has.bind(this),this.set=Jt.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(lc.isPair(r)?(s=cs.toJS(r.key,"",n),o=cs.toJS(r.value,s,n)):s=cs.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=uc.createPairs(e,n,i),s=new this;return s.items=r.items,s}};ze.tag="tag:yaml.org,2002:omap";var Ap={collection:"seq",identify:t=>t instanceof Map,nodeClass:ze,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let n=uc.resolvePairs(t,e),i=[];for(let{key:r}of n.items)lc.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)};ls.YAMLOMap=ze;ls.omap=Ap});var hc=w(fs=>{"use strict";var fc=$();function dc({value:t,source:e},n){return e&&(t?pc:mc).test.test(e)?e:t?n.options.trueStr:n.options.falseStr}var pc={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 fc.Scalar(!0),stringify:dc},mc={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 fc.Scalar(!1),stringify:dc};fs.falseTag=mc;fs.trueTag=pc});var gc=w(ki=>{"use strict";var Tp=$(),ds=ht(),Ip={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:ds.stringifyNumber},jp={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():ds.stringifyNumber(t)}},$p={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 Tp.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:ds.stringifyNumber};ki.float=$p;ki.floatExp=jp;ki.floatNaN=Ip});var yc=w(Gt=>{"use strict";var wc=ht(),Ht=t=>typeof t=="bigint"||Number.isInteger(t);function Si(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 ps(t,e,n){let{value:i}=t;if(Ht(i)){let r=i.toString(e);return i<0?"-"+n+r.substr(1):n+r}return wc.stringifyNumber(t)}var qp={identify:Ht,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,n)=>Si(t,2,2,n),stringify:t=>ps(t,2,"0b")},Lp={identify:Ht,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,n)=>Si(t,1,8,n),stringify:t=>ps(t,8,"0")},Dp={identify:Ht,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,n)=>Si(t,0,10,n),stringify:wc.stringifyNumber},Mp={identify:Ht,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,n)=>Si(t,2,16,n),stringify:t=>ps(t,16,"0x")};Gt.int=Dp;Gt.intBin=qp;Gt.intHex=Mp;Gt.intOct=Lp});var hs=w(ms=>{"use strict";var Ri=P(),Ci=Ae(),Ei=Ie(),Xe=class t extends Ei.YAMLMap{constructor(e){super(e),this.tag=t.tag}add(e){let n;Ri.isPair(e)?n=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?n=new Ci.Pair(e.key,null):n=new Ci.Pair(e,null),Ei.findPair(this.items,n.key)||this.items.push(n)}get(e,n){let i=Ei.findPair(this.items,e);return!n&&Ri.isPair(i)?Ri.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=Ei.findPair(this.items,e);i&&!n?this.items.splice(this.items.indexOf(i),1):!i&&n&&this.items.push(new Ci.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(Ci.createPair(o,null,i));return s}};Xe.tag="tag:yaml.org,2002:set";var Fp={collection:"map",identify:t=>t instanceof Set,nodeClass:Xe,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,n)=>Xe.from(t,e,n),resolve(t,e){if(Ri.isMap(t)){if(t.hasAllNullValues(!0))return Object.assign(new Xe,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}};ms.YAMLSet=Xe;ms.set=Fp});var ws=w(_i=>{"use strict";var Wp=ht();function gs(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 vc(t){let{value:e}=t,n=o=>o;if(typeof e=="bigint")n=o=>BigInt(o);else if(isNaN(e)||!isFinite(e))return Wp.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 Bp={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})=>gs(t,n),stringify:vc},Kp={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=>gs(t,!1),stringify:vc},bc={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(bc.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),f=e[8];if(f&&f!=="Z"){let u=gs(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$/,"")??""};_i.floatTime=Kp;_i.intTime=Bp;_i.timestamp=bc});var Cc=w(Sc=>{"use strict";var Up=pt(),Yp=pi(),Vp=mt(),Jp=Yt(),Hp=os(),kc=hc(),ys=gc(),xi=yc(),Gp=si(),zp=us(),Xp=bi(),Qp=hs(),vs=ws(),Zp=[Up.map,Vp.seq,Jp.string,Yp.nullTag,kc.trueTag,kc.falseTag,xi.intBin,xi.intOct,xi.int,xi.intHex,ys.floatNaN,ys.floatExp,ys.float,Hp.binary,Gp.merge,zp.omap,Xp.pairs,Qp.set,vs.intTime,vs.floatTime,vs.timestamp];Sc.schema=Zp});var Ic=w(Ss=>{"use strict";var xc=pt(),em=pi(),Pc=mt(),tm=Yt(),nm=Qr(),bs=es(),ks=ns(),im=nc(),rm=sc(),Oc=os(),zt=si(),Nc=us(),Ac=bi(),Ec=Cc(),Tc=hs(),Pi=ws(),Rc=new Map([["core",im.schema],["failsafe",[xc.map,Pc.seq,tm.string]],["json",rm.schema],["yaml11",Ec.schema],["yaml-1.1",Ec.schema]]),_c={binary:Oc.binary,bool:nm.boolTag,float:bs.float,floatExp:bs.floatExp,floatNaN:bs.floatNaN,floatTime:Pi.floatTime,int:ks.int,intHex:ks.intHex,intOct:ks.intOct,intTime:Pi.intTime,map:xc.map,merge:zt.merge,null:em.nullTag,omap:Nc.omap,pairs:Ac.pairs,seq:Pc.seq,set:Tc.set,timestamp:Pi.timestamp},sm={"tag:yaml.org,2002:binary":Oc.binary,"tag:yaml.org,2002:merge":zt.merge,"tag:yaml.org,2002:omap":Nc.omap,"tag:yaml.org,2002:pairs":Ac.pairs,"tag:yaml.org,2002:set":Tc.set,"tag:yaml.org,2002:timestamp":Pi.timestamp};function om(t,e,n){let i=Rc.get(e);if(i&&!t)return n&&!i.includes(zt.merge)?i.concat(zt.merge):i.slice();let r=i;if(!r)if(Array.isArray(t))r=[];else{let s=Array.from(Rc.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(zt.merge)),r.reduce((s,o)=>{let a=typeof o=="string"?_c[o]:o;if(!a){let c=JSON.stringify(o),l=Object.keys(_c).map(f=>JSON.stringify(f)).join(", ");throw new Error(`Unknown custom tag ${c}; use one of ${l}`)}return s.includes(a)||s.push(a),s},[])}Ss.coreKnownTags=sm;Ss.getTags=om});var Rs=w(jc=>{"use strict";var Cs=P(),am=pt(),cm=mt(),lm=Yt(),Oi=Ic(),um=(t,e)=>t.key<e.key?-1:t.key>e.key?1:0,Es=class t{constructor({compat:e,customTags:n,merge:i,resolveKnownTags:r,schema:s,sortMapEntries:o,toStringDefaults:a}){this.compat=Array.isArray(e)?Oi.getTags(e,"compat"):e?Oi.getTags(null,e):null,this.name=typeof s=="string"&&s||"core",this.knownTags=r?Oi.coreKnownTags:{},this.tags=Oi.getTags(n,this.name,i),this.toStringOptions=a??null,Object.defineProperty(this,Cs.MAP,{value:am.map}),Object.defineProperty(this,Cs.SCALAR,{value:lm.string}),Object.defineProperty(this,Cs.SEQ,{value:cm.seq}),this.sortMapEntries=typeof o=="function"?o:o===!0?um:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};jc.Schema=Es});var qc=w($c=>{"use strict";var fm=P(),_s=Bt(),Xt=Dt();function dm(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=_s.createStringifyContext(t,e),{commentString:s}=r.options;if(t.commentBefore){n.length!==1&&n.unshift("");let c=s(t.commentBefore);n.unshift(Xt.indentComment(c,""))}let o=!1,a=null;if(t.contents){if(fm.isNode(t.contents)){if(t.contents.spaceBefore&&i&&n.push(""),t.contents.commentBefore){let f=s(t.contents.commentBefore);n.push(Xt.indentComment(f,""))}r.forceBlockIndent=!!t.comment,a=t.contents.comment}let c=a?void 0:()=>o=!0,l=_s.stringify(t.contents,r,()=>a=null,c);a&&(l+=Xt.lineComment(l,"",s(a))),(l[0]==="|"||l[0]===">")&&n[n.length-1]==="---"?n[n.length-1]=`--- ${l}`:n.push(l)}else n.push(_s.stringify(t.contents,r));if(t.directives?.docEnd)if(t.comment){let c=s(t.comment);c.includes(`
58
- `)?(n.push("..."),n.push(Xt.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(Xt.indentComment(s(c),"")))}return n.join(`
54
+ ${i}${m}`}else return`${d}${s}${u.join(" ")}${s}${m}`}function gr({indent:t,options:{commentString:e}},n,r,i){if(r&&i&&(r=r.replace(/^\n+/,"")),r){let o=hr.indentComment(e(r),t);n.push(o.trimStart())}}ec.stringifyCollection=rp});var Le=w(so=>{"use strict";var sp=io(),ap=no(),cp=nr(),$e=P(),wr=Ie(),lp=$();function Ht(t,e){let n=$e.isScalar(e)?e.value:e;for(let r of t)if($e.isPair(r)&&(r.key===e||r.key===n||$e.isScalar(r.key)&&r.key.value===n))return r}var oo=class extends cp.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super($e.MAP,e),this.items=[]}static from(e,n,r){let{keepUndefined:i,replacer:o}=r,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||i)&&s.items.push(wr.createPair(c,l,r))};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 r;$e.isPair(e)?r=e:!e||typeof e!="object"||!("key"in e)?r=new wr.Pair(e,e?.value):r=new wr.Pair(e.key,e.value);let i=Ht(this.items,r.key),o=this.schema?.sortMapEntries;if(i){if(!n)throw new Error(`Key ${r.key} already set`);$e.isScalar(i.value)&&lp.isScalarValue(r.value)?i.value.value=r.value:i.value=r.value}else if(o){let s=this.items.findIndex(a=>o(r,a)<0);s===-1?this.items.push(r):this.items.splice(s,0,r)}else this.items.push(r)}delete(e){let n=Ht(this.items,e);return n?this.items.splice(this.items.indexOf(n),1).length>0:!1}get(e,n){let i=Ht(this.items,e)?.value;return(!n&&$e.isScalar(i)?i.value:i)??void 0}has(e){return!!Ht(this.items,e)}set(e,n){this.add(new wr.Pair(e,n),!0)}toJSON(e,n,r){let i=r?new r:n?.mapAsMap?new Map:{};n?.onCreate&&n.onCreate(i);for(let o of this.items)ap.addPairToJSMap(n,i,o);return i}toString(e,n,r){if(!e)return JSON.stringify(this);for(let i of this.items)if(!$e.isPair(i))throw new Error(`Map items must all be pairs; found ${JSON.stringify(i)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),sp.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:r,onComment:n})}};so.YAMLMap=oo;so.findPair=Ht});var yt=w(nc=>{"use strict";var up=P(),tc=Le(),fp={collection:"map",default:!0,nodeClass:tc.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(t,e){return up.isMap(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,n)=>tc.YAMLMap.from(t,e,n)};nc.map=fp});var qe=w(rc=>{"use strict";var dp=Ft(),pp=io(),mp=nr(),vr=P(),hp=$(),gp=Ae(),ao=class extends mp.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(vr.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let n=yr(e);return typeof n!="number"?!1:this.items.splice(n,1).length>0}get(e,n){let r=yr(e);if(typeof r!="number")return;let i=this.items[r];return!n&&vr.isScalar(i)?i.value:i}has(e){let n=yr(e);return typeof n=="number"&&n<this.items.length}set(e,n){let r=yr(e);if(typeof r!="number")throw new Error(`Expected a valid index, not ${e}.`);let i=this.items[r];vr.isScalar(i)&&hp.isScalarValue(n)?i.value=n:this.items[r]=n}toJSON(e,n){let r=[];n?.onCreate&&n.onCreate(r);let i=0;for(let o of this.items)r.push(gp.toJS(o,String(i++),n));return r}toString(e,n,r){return e?pp.stringifyCollection(this,e,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(e.indent||"")+" ",onChompKeep:r,onComment:n}):JSON.stringify(this)}static from(e,n,r){let{replacer:i}=r,o=new this(e);if(n&&Symbol.iterator in Object(n)){let s=0;for(let a of n){if(typeof i=="function"){let c=n instanceof Set?a:String(s++);a=i.call(n,c,a)}o.items.push(dp.createNode(a,void 0,r))}}return o}};function yr(t){let e=vr.isScalar(t)?t.value:t;return e&&typeof e=="string"&&(e=Number(e)),typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}rc.YAMLSeq=ao});var vt=w(oc=>{"use strict";var wp=P(),ic=qe(),yp={collection:"seq",default:!0,nodeClass:ic.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(t,e){return wp.isSeq(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,n)=>ic.YAMLSeq.from(t,e,n)};oc.seq=yp});var Jt=w(sc=>{"use strict";var vp=Yt(),bp={identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify(t,e,n,r){return e=Object.assign({actualString:!0},e),vp.stringifyString(t,e,n,r)}};sc.string=bp});var br=w(lc=>{"use strict";var ac=$(),cc={identify:t=>t==null,createNode:()=>new ac.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new ac.Scalar(null),stringify:({source:t},e)=>typeof t=="string"&&cc.test.test(t)?t:e.options.nullStr};lc.nullTag=cc});var co=w(fc=>{"use strict";var kp=$(),uc={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new kp.Scalar(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},n){if(t&&uc.test.test(t)){let r=t[0]==="t"||t[0]==="T";if(e===r)return t}return e?n.options.trueStr:n.options.falseStr}};fc.boolTag=uc});var bt=w(dc=>{"use strict";function Sp({format:t,minFractionDigits:e,tag:n,value:r}){if(typeof r=="bigint")return String(r);let i=typeof r=="number"?r:Number(r);if(!isFinite(i))return isNaN(i)?".nan":i<0?"-.inf":".inf";let o=Object.is(r,-0)?"-0":JSON.stringify(r);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}dc.stringifyNumber=Sp});var uo=w(kr=>{"use strict";var Cp=$(),lo=bt(),Ep={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:lo.stringifyNumber},Rp={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():lo.stringifyNumber(t)}},_p={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 Cp.Scalar(parseFloat(t)),n=t.indexOf(".");return n!==-1&&t[t.length-1]==="0"&&(e.minFractionDigits=t.length-n-1),e},stringify:lo.stringifyNumber};kr.float=_p;kr.floatExp=Rp;kr.floatNaN=Ep});var po=w(Cr=>{"use strict";var pc=bt(),Sr=t=>typeof t=="bigint"||Number.isInteger(t),fo=(t,e,n,{intAsBigInt:r})=>r?BigInt(t):parseInt(t.substring(e),n);function mc(t,e,n){let{value:r}=t;return Sr(r)&&r>=0?n+r.toString(e):pc.stringifyNumber(t)}var xp={identify:t=>Sr(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(t,e,n)=>fo(t,2,8,n),stringify:t=>mc(t,8,"0o")},Pp={identify:Sr,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,n)=>fo(t,0,10,n),stringify:pc.stringifyNumber},Op={identify:t=>Sr(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(t,e,n)=>fo(t,2,16,n),stringify:t=>mc(t,16,"0x")};Cr.int=Pp;Cr.intHex=Op;Cr.intOct=xp});var gc=w(hc=>{"use strict";var Ap=yt(),Np=br(),jp=vt(),Tp=Jt(),Ip=co(),mo=uo(),ho=po(),$p=[Ap.map,jp.seq,Tp.string,Np.nullTag,Ip.boolTag,ho.intOct,ho.int,ho.intHex,mo.floatNaN,mo.floatExp,mo.float];hc.schema=$p});var vc=w(yc=>{"use strict";var Lp=$(),qp=yt(),Dp=vt();function wc(t){return typeof t=="bigint"||Number.isInteger(t)}var Er=({value:t})=>JSON.stringify(t),Wp=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:Er},{identify:t=>t==null,createNode:()=>new Lp.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:Er},{identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:t=>t==="true",stringify:Er},{identify:wc,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})=>wc(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:Er}],Mp={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},Fp=[qp.map,Dp.seq].concat(Wp,Mp);yc.schema=Fp});var wo=w(bc=>{"use strict";var zt=Vn("buffer"),go=$(),Bp=Yt(),Kp={identify:t=>t instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(t,e){if(typeof zt.Buffer=="function")return zt.Buffer.from(t,"base64");if(typeof atob=="function"){let n=atob(t.replace(/[\n\r]/g,"")),r=new Uint8Array(n.length);for(let i=0;i<n.length;++i)r[i]=n.charCodeAt(i);return r}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},r,i,o){if(!n)return"";let s=n,a;if(typeof zt.Buffer=="function")a=s instanceof zt.Buffer?s.toString("base64"):zt.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=go.Scalar.BLOCK_LITERAL),e!==go.Scalar.QUOTE_DOUBLE){let c=Math.max(r.options.lineWidth-r.indent.length,r.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===go.Scalar.BLOCK_LITERAL?`
55
+ `:" ")}return Bp.stringifyString({comment:t,type:e,value:a},r,i,o)}};bc.binary=Kp});var xr=w(_r=>{"use strict";var Rr=P(),yo=Ie(),Up=$(),Yp=qe();function kc(t,e){if(Rr.isSeq(t))for(let n=0;n<t.items.length;++n){let r=t.items[n];if(!Rr.isPair(r)){if(Rr.isMap(r)){r.items.length>1&&e("Each pair must have its own sequence indicator");let i=r.items[0]||new yo.Pair(new Up.Scalar(null));if(r.commentBefore&&(i.key.commentBefore=i.key.commentBefore?`${r.commentBefore}
56
+ ${i.key.commentBefore}`:r.commentBefore),r.comment){let o=i.value??i.key;o.comment=o.comment?`${r.comment}
57
+ ${o.comment}`:r.comment}r=i}t.items[n]=Rr.isPair(r)?r:new yo.Pair(r)}}else e("Expected a sequence for this tag");return t}function Sc(t,e,n){let{replacer:r}=n,i=new Yp.YAMLSeq(t);i.tag="tag:yaml.org,2002:pairs";let o=0;if(e&&Symbol.iterator in Object(e))for(let s of e){typeof r=="function"&&(s=r.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;i.items.push(yo.createPair(a,c,n))}return i}var Gp={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:kc,createNode:Sc};_r.createPairs=Sc;_r.pairs=Gp;_r.resolvePairs=kc});var ko=w(bo=>{"use strict";var Cc=P(),vo=Ae(),Xt=Le(),Vp=qe(),Ec=xr(),tt=class t extends Vp.YAMLSeq{constructor(){super(),this.add=Xt.YAMLMap.prototype.add.bind(this),this.delete=Xt.YAMLMap.prototype.delete.bind(this),this.get=Xt.YAMLMap.prototype.get.bind(this),this.has=Xt.YAMLMap.prototype.has.bind(this),this.set=Xt.YAMLMap.prototype.set.bind(this),this.tag=t.tag}toJSON(e,n){if(!n)return super.toJSON(e);let r=new Map;n?.onCreate&&n.onCreate(r);for(let i of this.items){let o,s;if(Cc.isPair(i)?(o=vo.toJS(i.key,"",n),s=vo.toJS(i.value,o,n)):o=vo.toJS(i,"",n),r.has(o))throw new Error("Ordered maps must not include duplicate keys");r.set(o,s)}return r}static from(e,n,r){let i=Ec.createPairs(e,n,r),o=new this;return o.items=i.items,o}};tt.tag="tag:yaml.org,2002:omap";var Hp={collection:"seq",identify:t=>t instanceof Map,nodeClass:tt,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let n=Ec.resolvePairs(t,e),r=[];for(let{key:i}of n.items)Cc.isScalar(i)&&(r.includes(i.value)?e(`Ordered maps must not include duplicate keys: ${i.value}`):r.push(i.value));return Object.assign(new tt,n)},createNode:(t,e,n)=>tt.from(t,e,n)};bo.YAMLOMap=tt;bo.omap=Hp});var Oc=w(So=>{"use strict";var Rc=$();function _c({value:t,source:e},n){return e&&(t?xc:Pc).test.test(e)?e:t?n.options.trueStr:n.options.falseStr}var xc={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 Rc.Scalar(!0),stringify:_c},Pc={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 Rc.Scalar(!1),stringify:_c};So.falseTag=Pc;So.trueTag=xc});var Ac=w(Pr=>{"use strict";var Jp=$(),Co=bt(),zp={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:Co.stringifyNumber},Xp={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():Co.stringifyNumber(t)}},Qp={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 Jp.Scalar(parseFloat(t.replace(/_/g,""))),n=t.indexOf(".");if(n!==-1){let r=t.substring(n+1).replace(/_/g,"");r[r.length-1]==="0"&&(e.minFractionDigits=r.length)}return e},stringify:Co.stringifyNumber};Pr.float=Qp;Pr.floatExp=Xp;Pr.floatNaN=zp});var jc=w(Zt=>{"use strict";var Nc=bt(),Qt=t=>typeof t=="bigint"||Number.isInteger(t);function Or(t,e,n,{intAsBigInt:r}){let i=t[0];if((i==="-"||i==="+")&&(e+=1),t=t.substring(e).replace(/_/g,""),r){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 i==="-"?BigInt(-1)*s:s}let o=parseInt(t,n);return i==="-"?-1*o:o}function Eo(t,e,n){let{value:r}=t;if(Qt(r)){let i=r.toString(e);return r<0?"-"+n+i.substr(1):n+i}return Nc.stringifyNumber(t)}var Zp={identify:Qt,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,n)=>Or(t,2,2,n),stringify:t=>Eo(t,2,"0b")},em={identify:Qt,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,n)=>Or(t,1,8,n),stringify:t=>Eo(t,8,"0")},tm={identify:Qt,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,n)=>Or(t,0,10,n),stringify:Nc.stringifyNumber},nm={identify:Qt,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,n)=>Or(t,2,16,n),stringify:t=>Eo(t,16,"0x")};Zt.int=tm;Zt.intBin=Zp;Zt.intHex=nm;Zt.intOct=em});var _o=w(Ro=>{"use strict";var jr=P(),Ar=Ie(),Nr=Le(),nt=class t extends Nr.YAMLMap{constructor(e){super(e),this.tag=t.tag}add(e){let n;jr.isPair(e)?n=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?n=new Ar.Pair(e.key,null):n=new Ar.Pair(e,null),Nr.findPair(this.items,n.key)||this.items.push(n)}get(e,n){let r=Nr.findPair(this.items,e);return!n&&jr.isPair(r)?jr.isScalar(r.key)?r.key.value:r.key:r}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 r=Nr.findPair(this.items,e);r&&!n?this.items.splice(this.items.indexOf(r),1):!r&&n&&this.items.push(new Ar.Pair(e))}toJSON(e,n){return super.toJSON(e,n,Set)}toString(e,n,r){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),n,r);throw new Error("Set items must all have null values")}static from(e,n,r){let{replacer:i}=r,o=new this(e);if(n&&Symbol.iterator in Object(n))for(let s of n)typeof i=="function"&&(s=i.call(n,s,s)),o.items.push(Ar.createPair(s,null,r));return o}};nt.tag="tag:yaml.org,2002:set";var rm={collection:"map",identify:t=>t instanceof Set,nodeClass:nt,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,n)=>nt.from(t,e,n),resolve(t,e){if(jr.isMap(t)){if(t.hasAllNullValues(!0))return Object.assign(new nt,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}};Ro.YAMLSet=nt;Ro.set=rm});var Po=w(Tr=>{"use strict";var im=bt();function xo(t,e){let n=t[0],r=n==="-"||n==="+"?t.substring(1):t,i=s=>e?BigInt(s):Number(s),o=r.replace(/_/g,"").split(":").reduce((s,a)=>s*i(60)+i(a),i(0));return n==="-"?i(-1)*o:o}function Tc(t){let{value:e}=t,n=s=>s;if(typeof e=="bigint")n=s=>BigInt(s);else if(isNaN(e)||!isFinite(e))return im.stringifyNumber(t);let r="";e<0&&(r="-",e*=n(-1));let i=n(60),o=[e%i];return e<60?o.unshift(0):(e=(e-o[0])/i,o.unshift(e%i),e>=60&&(e=(e-o[0])/i,o.unshift(e))),r+o.map(s=>String(s).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var om={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})=>xo(t,n),stringify:Tc},sm={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=>xo(t,!1),stringify:Tc},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,r,i,o,s,a]=e.map(Number),c=e[7]?Number((e[7]+"00").substr(1,3)):0,l=Date.UTC(n,r-1,i,o||0,s||0,a||0,c),f=e[8];if(f&&f!=="Z"){let u=xo(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$/,"")??""};Tr.floatTime=sm;Tr.intTime=om;Tr.timestamp=Ic});var qc=w(Lc=>{"use strict";var am=yt(),cm=br(),lm=vt(),um=Jt(),fm=wo(),$c=Oc(),Oo=Ac(),Ir=jc(),dm=dr(),pm=ko(),mm=xr(),hm=_o(),Ao=Po(),gm=[am.map,lm.seq,um.string,cm.nullTag,$c.trueTag,$c.falseTag,Ir.intBin,Ir.intOct,Ir.int,Ir.intHex,Oo.floatNaN,Oo.floatExp,Oo.float,fm.binary,dm.merge,pm.omap,mm.pairs,hm.set,Ao.intTime,Ao.floatTime,Ao.timestamp];Lc.schema=gm});var Vc=w(To=>{"use strict";var Fc=yt(),wm=br(),Bc=vt(),ym=Jt(),vm=co(),No=uo(),jo=po(),bm=gc(),km=vc(),Kc=wo(),en=dr(),Uc=ko(),Yc=xr(),Dc=qc(),Gc=_o(),$r=Po(),Wc=new Map([["core",bm.schema],["failsafe",[Fc.map,Bc.seq,ym.string]],["json",km.schema],["yaml11",Dc.schema],["yaml-1.1",Dc.schema]]),Mc={binary:Kc.binary,bool:vm.boolTag,float:No.float,floatExp:No.floatExp,floatNaN:No.floatNaN,floatTime:$r.floatTime,int:jo.int,intHex:jo.intHex,intOct:jo.intOct,intTime:$r.intTime,map:Fc.map,merge:en.merge,null:wm.nullTag,omap:Uc.omap,pairs:Yc.pairs,seq:Bc.seq,set:Gc.set,timestamp:$r.timestamp},Sm={"tag:yaml.org,2002:binary":Kc.binary,"tag:yaml.org,2002:merge":en.merge,"tag:yaml.org,2002:omap":Uc.omap,"tag:yaml.org,2002:pairs":Yc.pairs,"tag:yaml.org,2002:set":Gc.set,"tag:yaml.org,2002:timestamp":$r.timestamp};function Cm(t,e,n){let r=Wc.get(e);if(r&&!t)return n&&!r.includes(en.merge)?r.concat(en.merge):r.slice();let i=r;if(!i)if(Array.isArray(t))i=[];else{let o=Array.from(Wc.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)i=i.concat(o);else typeof t=="function"&&(i=t(i.slice()));return n&&(i=i.concat(en.merge)),i.reduce((o,s)=>{let a=typeof s=="string"?Mc[s]:s;if(!a){let c=JSON.stringify(s),l=Object.keys(Mc).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},[])}To.coreKnownTags=Sm;To.getTags=Cm});var Lo=w(Hc=>{"use strict";var Io=P(),Em=yt(),Rm=vt(),_m=Jt(),Lr=Vc(),xm=(t,e)=>t.key<e.key?-1:t.key>e.key?1:0,$o=class t{constructor({compat:e,customTags:n,merge:r,resolveKnownTags:i,schema:o,sortMapEntries:s,toStringDefaults:a}){this.compat=Array.isArray(e)?Lr.getTags(e,"compat"):e?Lr.getTags(null,e):null,this.name=typeof o=="string"&&o||"core",this.knownTags=i?Lr.coreKnownTags:{},this.tags=Lr.getTags(n,this.name,r),this.toStringOptions=a??null,Object.defineProperty(this,Io.MAP,{value:Em.map}),Object.defineProperty(this,Io.SCALAR,{value:_m.string}),Object.defineProperty(this,Io.SEQ,{value:Rm.seq}),this.sortMapEntries=typeof s=="function"?s:s===!0?xm:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};Hc.Schema=$o});var zc=w(Jc=>{"use strict";var Pm=P(),qo=Gt(),tn=Bt();function Om(t,e){let n=[],r=e.directives===!0;if(e.directives!==!1&&t.directives){let c=t.directives.toString(t);c?(n.push(c),r=!0):t.directives.docStart&&(r=!0)}r&&n.push("---");let i=qo.createStringifyContext(t,e),{commentString:o}=i.options;if(t.commentBefore){n.length!==1&&n.unshift("");let c=o(t.commentBefore);n.unshift(tn.indentComment(c,""))}let s=!1,a=null;if(t.contents){if(Pm.isNode(t.contents)){if(t.contents.spaceBefore&&r&&n.push(""),t.contents.commentBefore){let f=o(t.contents.commentBefore);n.push(tn.indentComment(f,""))}i.forceBlockIndent=!!t.comment,a=t.contents.comment}let c=a?void 0:()=>s=!0,l=qo.stringify(t.contents,i,()=>a=null,c);a&&(l+=tn.lineComment(l,"",o(a))),(l[0]==="|"||l[0]===">")&&n[n.length-1]==="---"?n[n.length-1]=`--- ${l}`:n.push(l)}else n.push(qo.stringify(t.contents,i));if(t.directives?.docEnd)if(t.comment){let c=o(t.comment);c.includes(`
58
+ `)?(n.push("..."),n.push(tn.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(tn.indentComment(o(c),"")))}return n.join(`
59
59
  `)+`
60
- `}$c.stringifyDocument=dm});var Qt=w(Lc=>{"use strict";var pm=qt(),gt=Gn(),te=P(),mm=Ae(),hm=xe(),gm=Rs(),wm=qc(),xs=Yn(),ym=Ar(),vm=Lt(),Ps=Nr(),Os=class t{constructor(e,n,i){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,te.NODE_TYPE,{value:te.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 Ps.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,{[te.NODE_TYPE]:{value:te.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=te.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){wt(this.contents)&&this.contents.add(e)}addIn(e,n){wt(this.contents)&&this.contents.addIn(e,n)}createAlias(e,n){if(!e.anchor){let i=xs.anchorNames(this);e.anchor=!n||i.has(n)?xs.findNewAnchor(n||"a",i):n}return new pm.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 h=y=>typeof y=="number"||y instanceof String||y instanceof Number,v=n.filter(h).map(String);v.length>0&&(n=n.concat(v)),r=n}else i===void 0&&n&&(i=n,n=void 0);let{aliasDuplicateObjects:s,anchorPrefix:o,flow:a,keepUndefined:c,onTagObj:l,tag:f}=i??{},{onAnchor:u,setAnchors:d,sourceObjects:m}=xs.createNodeAnchors(this,o||"a"),g={aliasDuplicateObjects:s??!0,keepUndefined:c??!1,onAnchor:u,onTagObj:l,replacer:r,schema:this.schema,sourceObjects:m},p=vm.createNode(e,f,g);return a&&te.isCollection(p)&&(p.flow=!0),d(),p}createPair(e,n,i={}){let r=this.createNode(e,null,i),s=this.createNode(n,null,i);return new mm.Pair(r,s)}delete(e){return wt(this.contents)?this.contents.delete(e):!1}deleteIn(e){return gt.isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):wt(this.contents)?this.contents.deleteIn(e):!1}get(e,n){return te.isCollection(this.contents)?this.contents.get(e,n):void 0}getIn(e,n){return gt.isEmptyPath(e)?!n&&te.isScalar(this.contents)?this.contents.value:this.contents:te.isCollection(this.contents)?this.contents.getIn(e,n):void 0}has(e){return te.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return gt.isEmptyPath(e)?this.contents!==void 0:te.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,n){this.contents==null?this.contents=gt.collectionFromPath(this.schema,[e],n):wt(this.contents)&&this.contents.set(e,n)}setIn(e,n){gt.isEmptyPath(e)?this.contents=n:this.contents==null?this.contents=gt.collectionFromPath(this.schema,Array.from(e),n):wt(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 Ps.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 Ps.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 gm.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=hm.toJS(this.contents,n??"",a);if(typeof s=="function")for(let{count:l,res:f}of a.anchors.values())s(f,l);return typeof o=="function"?ym.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 wm.stringifyDocument(this,e)}};function wt(t){if(te.isCollection(t))return!0;throw new Error("Expected a YAML collection as document contents")}Lc.Document=Os});var tn=w(en=>{"use strict";var Zt=class extends Error{constructor(e,n,i,r){super(),this.name=e,this.code=i,this.message=r,this.pos=n}},Ns=class extends Zt{constructor(e,n,i){super("YAMLParseError",e,n,i)}},As=class extends Zt{constructor(e,n,i){super("YAMLWarning",e,n,i)}},bm=(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
+ `}Jc.stringifyDocument=Om});var nn=w(Xc=>{"use strict";var Am=Mt(),kt=nr(),ne=P(),Nm=Ie(),jm=Ae(),Tm=Lo(),Im=zc(),Do=Qn(),$m=Fi(),Lm=Ft(),Wo=Mi(),Mo=class t{constructor(e,n,r){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,ne.NODE_TYPE,{value:ne.DOC});let i=null;typeof n=="function"||Array.isArray(n)?i=n:r===void 0&&n&&(r=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"},r);this.options=o;let{version:s}=o;r?._directives?(this.directives=r._directives.atDocument(),this.directives.yaml.explicit&&(s=this.directives.yaml.version)):this.directives=new Wo.Directives({version:s}),this.setSchema(s,r),this.contents=e===void 0?null:this.createNode(e,i,r)}clone(){let e=Object.create(t.prototype,{[ne.NODE_TYPE]:{value:ne.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=ne.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){St(this.contents)&&this.contents.add(e)}addIn(e,n){St(this.contents)&&this.contents.addIn(e,n)}createAlias(e,n){if(!e.anchor){let r=Do.anchorNames(this);e.anchor=!n||r.has(n)?Do.findNewAnchor(n||"a",r):n}return new Am.Alias(e.anchor)}createNode(e,n,r){let i;if(typeof n=="function")e=n.call({"":e},"",e),i=n;else if(Array.isArray(n)){let h=y=>typeof y=="number"||y instanceof String||y instanceof Number,v=n.filter(h).map(String);v.length>0&&(n=n.concat(v)),i=n}else r===void 0&&n&&(r=n,n=void 0);let{aliasDuplicateObjects:o,anchorPrefix:s,flow:a,keepUndefined:c,onTagObj:l,tag:f}=r??{},{onAnchor:u,setAnchors:d,sourceObjects:m}=Do.createNodeAnchors(this,s||"a"),g={aliasDuplicateObjects:o??!0,keepUndefined:c??!1,onAnchor:u,onTagObj:l,replacer:i,schema:this.schema,sourceObjects:m},p=Lm.createNode(e,f,g);return a&&ne.isCollection(p)&&(p.flow=!0),d(),p}createPair(e,n,r={}){let i=this.createNode(e,null,r),o=this.createNode(n,null,r);return new Nm.Pair(i,o)}delete(e){return St(this.contents)?this.contents.delete(e):!1}deleteIn(e){return kt.isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):St(this.contents)?this.contents.deleteIn(e):!1}get(e,n){return ne.isCollection(this.contents)?this.contents.get(e,n):void 0}getIn(e,n){return kt.isEmptyPath(e)?!n&&ne.isScalar(this.contents)?this.contents.value:this.contents:ne.isCollection(this.contents)?this.contents.getIn(e,n):void 0}has(e){return ne.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return kt.isEmptyPath(e)?this.contents!==void 0:ne.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,n){this.contents==null?this.contents=kt.collectionFromPath(this.schema,[e],n):St(this.contents)&&this.contents.set(e,n)}setIn(e,n){kt.isEmptyPath(e)?this.contents=n:this.contents==null?this.contents=kt.collectionFromPath(this.schema,Array.from(e),n):St(this.contents)&&this.contents.setIn(e,n)}setSchema(e,n={}){typeof e=="number"&&(e=String(e));let r;switch(e){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new Wo.Directives({version:"1.1"}),r={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=e:this.directives=new Wo.Directives({version:e}),r={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,r=null;break;default:{let i=JSON.stringify(e);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${i}`)}}if(n.schema instanceof Object)this.schema=n.schema;else if(r)this.schema=new Tm.Schema(Object.assign(r,n));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:e,jsonArg:n,mapAsMap:r,maxAliasCount:i,onAnchor:o,reviver:s}={}){let a={anchors:new Map,doc:this,keep:!e,mapAsMap:r===!0,mapKeyWarned:!1,maxAliasCount:typeof i=="number"?i:100},c=jm.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"?$m.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 Im.stringifyDocument(this,e)}};function St(t){if(ne.isCollection(t))return!0;throw new Error("Expected a YAML collection as document contents")}Xc.Document=Mo});var sn=w(on=>{"use strict";var rn=class extends Error{constructor(e,n,r,i){super(),this.name=e,this.code=r,this.message=i,this.pos=n}},Fo=class extends rn{constructor(e,n,r){super("YAMLParseError",e,n,r)}},Bo=class extends rn{constructor(e,n,r){super("YAMLWarning",e,n,r)}},qm=(t,e)=>n=>{if(n.pos[0]===-1)return;n.linePos=n.pos.map(a=>e.linePos(a));let{line:r,col:i}=n.linePos[0];n.message+=` at line ${r}, column ${i}`;let o=i-1,s=t.substring(e.lineStarts[r-1],e.lineStarts[r]).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)+"…"),r>1&&/^ *$/.test(s.substring(0,o))){let a=t.substring(e.lineStarts[r-2],e.lineStarts[r-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===r&&c.col>i&&(a=Math.max(1,Math.min(c.col-i,80-o)));let l=" ".repeat(o)+"^".repeat(a);n.message+=`:
62
62
 
63
- ${o}
63
+ ${s}
64
64
  ${l}
65
- `}};en.YAMLError=Zt;en.YAMLParseError=Ns;en.YAMLWarning=As;en.prettifyError=bm});var nn=w(Dc=>{"use strict";function km(t,{flow:e,indicator:n,next:i,offset:r,onError:s,parentIndent:o,startOnNewline:a}){let c=!1,l=a,f=a,u="",d="",m=!1,g=!1,p=null,h=null,v=null,y=null,S=null,R=null,_=null;for(let k of t)switch(g&&(k.type!=="space"&&k.type!=="newline"&&k.type!=="comma"&&s(k.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),g=!1),p&&(l&&k.type!=="comment"&&k.type!=="newline"&&s(p,"TAB_AS_INDENT","Tabs are not allowed as indentation"),p=null),k.type){case"space":!e&&(n!=="doc-start"||i?.type!=="flow-collection")&&k.source.includes(" ")&&(p=k),f=!0;break;case"comment":{f||s(k,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let L=k.source.substring(1)||" ";u?u+=d+L:u=L,d="",l=!1;break}case"newline":l?u?u+=k.source:(!R||n!=="seq-item-ind")&&(c=!0):d+=k.source,l=!0,m=!0,(h||v)&&(y=k),f=!0;break;case"anchor":h&&s(k,"MULTIPLE_ANCHORS","A node can have at most one anchor"),k.source.endsWith(":")&&s(k.offset+k.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),h=k,_??(_=k.offset),l=!1,f=!1,g=!0;break;case"tag":{v&&s(k,"MULTIPLE_TAGS","A node can have at most one tag"),v=k,_??(_=k.offset),l=!1,f=!1,g=!0;break}case n:(h||v)&&s(k,"BAD_PROP_ORDER",`Anchors and tags must be after the ${k.source} indicator`),R&&s(k,"UNEXPECTED_TOKEN",`Unexpected ${k.source} in ${e??"collection"}`),R=k,l=n==="seq-item-ind"||n==="explicit-key-ind",f=!1;break;case"comma":if(e){S&&s(k,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),S=k,l=!1,f=!1;break}default:s(k,"UNEXPECTED_TOKEN",`Unexpected ${k.type} token`),l=!1,f=!1}let E=t[t.length-1],N=E?E.offset+E.source.length:r;return g&&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:S,found:R,spaceBefore:c,comment:u,hasNewline:m,anchor:h,tag:v,newlineAfterProp:y,end:N,start:_??N}}Dc.resolveProps=km});var Ni=w(Mc=>{"use strict";function Ts(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(Ts(e.key)||Ts(e.value))return!0}return!1;default:return!0}}Mc.containsNewline=Ts});var Is=w(Fc=>{"use strict";var Sm=Ni();function Cm(t,e,n){if(e?.type==="flow-collection"){let i=e.end[0];i.indent===t&&(i.source==="]"||i.source==="}")&&Sm.containsNewline(e)&&n(i,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}Fc.flowIndentCheck=Cm});var js=w(Bc=>{"use strict";var Wc=P();function Em(t,e,n){let{uniqueKeys:i}=t.options;if(i===!1)return!1;let r=typeof i=="function"?i:(s,o)=>s===o||Wc.isScalar(s)&&Wc.isScalar(o)&&s.value===o.value;return e.some(s=>r(s.key,n))}Bc.mapIncludes=Em});var Hc=w(Jc=>{"use strict";var Kc=Ae(),Rm=Ie(),Uc=nn(),_m=Ni(),Yc=Is(),xm=js(),Vc="All mapping items must start at the same column";function Pm({composeNode:t,composeEmptyNode:e},n,i,r,s){let o=s?.nodeClass??Rm.YAMLMap,a=new o(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:m,value:g}=f,p=Uc.resolveProps(u,{indicator:"explicit-key-ind",next:d??m?.[0],offset:c,onError:r,parentIndent:i.indent,startOnNewline:!0}),h=!p.found;if(h){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",Vc)),!p.anchor&&!p.tag&&!m){l=p.end,p.comment&&(a.comment?a.comment+=`
67
- `+p.comment:a.comment=p.comment);continue}(p.newlineAfterProp||_m.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",Vc);n.atKey=!0;let v=p.end,y=d?t(n,d,p,r):e(n,v,u,null,p,r);n.schema.compat&&Yc.flowIndentCheck(i.indent,d,r),n.atKey=!1,xm.mapIncludes(n,a.items,y)&&r(v,"DUPLICATE_KEY","Map keys must be unique");let S=Uc.resolveProps(m??[],{indicator:"map-value-ind",next:g,offset:y.range[2],onError:r,parentIndent:i.indent,startOnNewline:!d||d.type==="block-scalar"});if(c=S.end,S.found){h&&(g?.type==="block-map"&&!S.hasNewline&&r(c,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),n.options.strict&&p.start<S.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 R=g?t(n,g,S,r):e(n,c,m,null,S,r);n.schema.compat&&Yc.flowIndentCheck(i.indent,g,r),c=R.range[2];let _=new Kc.Pair(y,R);n.options.keepSourceTokens&&(_.srcToken=f),a.items.push(_)}else{h&&r(y.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),S.comment&&(y.comment?y.comment+=`
68
- `+S.comment:y.comment=S.comment);let R=new Kc.Pair(y);n.options.keepSourceTokens&&(R.srcToken=f),a.items.push(R)}}return l&&l<c&&r(l,"IMPOSSIBLE","Map comment with trailing content"),a.range=[i.offset,c,l??c],a}Jc.resolveBlockMap=Pm});var zc=w(Gc=>{"use strict";var Om=je(),Nm=nn(),Am=Is();function Tm({composeNode:t,composeEmptyNode:e},n,i,r,s){let o=s?.nodeClass??Om.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:f,value:u}of i.items){let d=Nm.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 m=u?t(n,u,d,r):e(n,d.end,f,null,d,r);n.schema.compat&&Am.flowIndentCheck(i.indent,u,r),c=m.range[2],a.items.push(m)}return a.range=[i.offset,c,l??c],a}Gc.resolveBlockSeq=Tm});var yt=w(Xc=>{"use strict";function Im(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 f=c.substring(1)||" ";r?r+=o+f:r=f,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}}Xc.resolveEnd=Im});var tl=w(el=>{"use strict";var jm=P(),$m=Ae(),Qc=Ie(),qm=je(),Lm=yt(),Zc=nn(),Dm=Ni(),Mm=js(),$s="Block collections are not allowed within flow collections",qs=t=>t&&(t.type==="block-map"||t.type==="block-seq");function Fm({composeNode:t,composeEmptyNode:e},n,i,r,s){let o=i.start.source==="{",a=o?"flow map":"flow sequence",c=s?.nodeClass??(o?Qc.YAMLMap:qm.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 h=0;h<i.items.length;++h){let v=i.items[h],{start:y,key:S,sep:R,value:_}=v,E=Zc.resolveProps(y,{flow:a,indicator:"explicit-key-ind",next:S??R?.[0],offset:u,onError:r,parentIndent:i.indent,startOnNewline:!1});if(!E.found){if(!E.anchor&&!E.tag&&!R&&!_){h===0&&E.comma?r(E.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`):h<i.items.length-1&&r(E.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${a}`),E.comment&&(l.comment?l.comment+=`
69
- `+E.comment:l.comment=E.comment),u=E.end;continue}!o&&n.options.strict&&Dm.containsNewline(S)&&r(S,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(h===0)E.comma&&r(E.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`);else if(E.comma||r(E.start,"MISSING_CHAR",`Missing , between ${a} items`),E.comment){let N="";e:for(let k of y)switch(k.type){case"comma":case"space":break;case"comment":N=k.source.substring(1);break e;default:break e}if(N){let k=l.items[l.items.length-1];jm.isPair(k)&&(k=k.value??k.key),k.comment?k.comment+=`
70
- `+N:k.comment=N,E.comment=E.comment.substring(N.length+1)}}if(!o&&!R&&!E.found){let N=_?t(n,_,E,r):e(n,E.end,R,null,E,r);l.items.push(N),u=N.range[2],qs(_)&&r(N.range,"BLOCK_IN_FLOW",$s)}else{n.atKey=!0;let N=E.end,k=S?t(n,S,E,r):e(n,N,y,null,E,r);qs(S)&&r(k.range,"BLOCK_IN_FLOW",$s),n.atKey=!1;let L=Zc.resolveProps(R??[],{flow:a,indicator:"map-value-ind",next:_,offset:k.range[2],onError:r,parentIndent:i.indent,startOnNewline:!1});if(L.found){if(!o&&!E.found&&n.options.strict){if(R)for(let D of R){if(D===L.found)break;if(D.type==="newline"){r(D,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}E.start<L.found.offset-1024&&r(L.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else _&&("source"in _&&_.source?.[0]===":"?r(_,"MISSING_CHAR",`Missing space after : in ${a}`):r(L.start,"MISSING_CHAR",`Missing , or : between ${a} items`));let _e=_?t(n,_,L,r):L.found?e(n,L.end,R,null,L,r):null;_e?qs(_)&&r(_e.range,"BLOCK_IN_FLOW",$s):L.comment&&(k.comment?k.comment+=`
71
- `+L.comment:k.comment=L.comment);let at=new $m.Pair(k,_e);if(n.options.keepSourceTokens&&(at.srcToken=v),o){let D=l;Mm.mapIncludes(n,D.items,k)&&r(N,"DUPLICATE_KEY","Map keys must be unique"),D.items.push(at)}else{let D=new Qc.YAMLMap(n.schema);D.flow=!0,D.items.push(at);let ta=(_e??k).range;D.range=[k.range[0],ta[1],ta[2]],l.items.push(D)}u=_e?_e.range[2]:L.end}}let d=o?"}":"]",[m,...g]=i.end,p=u;if(m?.source===d)p=m.offset+m.source.length;else{let h=a[0].toUpperCase()+a.substring(1),v=f?`${h} must end with a ${d}`:`${h} in block collection must be sufficiently indented and end with a ${d}`;r(u,f?"MISSING_CHAR":"BAD_INDENT",v),m&&m.source.length!==1&&g.unshift(m)}if(g.length>0){let h=Lm.resolveEnd(g,p,n.options.strict,r);h.comment&&(l.comment?l.comment+=`
72
- `+h.comment:l.comment=h.comment),l.range=[i.offset,p,h.offset]}else l.range=[i.offset,p,p];return l}el.resolveFlowCollection=Fm});var il=w(nl=>{"use strict";var Wm=P(),Bm=$(),Km=Ie(),Um=je(),Ym=Hc(),Vm=zc(),Jm=tl();function Ls(t,e,n,i,r,s){let o=n.type==="block-map"?Ym.resolveBlockMap(t,e,n,i,s):n.type==="block-seq"?Vm.resolveBlockSeq(t,e,n,i,s):Jm.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 Hm(t,e,n,i,r){let s=i.tag,o=s?e.directives.tagName(s.source,d=>r(s,"TAG_RESOLVE_FAILED",d)):null;if(n.type==="block-seq"){let{anchor:d,newlineAfterProp:m}=i,g=d&&s?d.offset>s.offset?d:s:d??s;g&&(!m||m.offset<g.offset)&&r(g,"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===Km.YAMLMap.tagName&&a==="map"||o===Um.YAMLSeq.tagName&&a==="seq")return Ls(t,e,n,r,o);let c=e.schema.tags.find(d=>d.tag===o&&d.collection===a);if(!c){let d=e.schema.knownTags[o];if(d?.collection===a)e.schema.tags.push(Object.assign({},d,{default:!1})),c=d;else return d?r(s,"BAD_COLLECTION_TYPE",`${d.tag} used for ${a} collection, but expects ${d.collection??"scalar"}`,!0):r(s,"TAG_RESOLVE_FAILED",`Unresolved tag: ${o}`,!0),Ls(t,e,n,r,o)}let l=Ls(t,e,n,r,o,c),f=c.resolve?.(l,d=>r(s,"TAG_RESOLVE_FAILED",d),e.options)??l,u=Wm.isNode(f)?f:new Bm.Scalar(f);return u.range=l.range,u.tag=o,c?.format&&(u.format=c.format),u}nl.composeCollection=Hm});var Ms=w(rl=>{"use strict";var Ds=$();function Gm(t,e,n){let i=e.offset,r=zm(e,t.options.strict,n);if(!r)return{value:"",type:null,comment:"",range:[i,i,i]};let s=r.mode===">"?Ds.Scalar.BLOCK_FOLDED:Ds.Scalar.BLOCK_LITERAL,o=e.source?Xm(e.source):[],a=o.length;for(let p=o.length-1;p>=0;--p){let h=o[p][1];if(h===""||h==="\r")a=p;else break}if(a===0){let p=r.chomp==="+"&&o.length>0?`
73
- `.repeat(Math.max(1,o.length-1)):"",h=i+r.length;return e.source&&(h+=e.source.length),{value:p,type:s,comment:r.comment,range:[i,h,h]}}let c=e.indent+r.indent,l=e.offset+r.length,f=0;for(let p=0;p<a;++p){let[h,v]=o[p];if(v===""||v==="\r")r.indent===0&&h.length>c&&(c=h.length);else{h.length<c&&n(l+h.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator"),r.indent===0&&(c=h.length),f=p,c===0&&!t.atRoot&&n(l,"BAD_INDENT","Block scalar values in collections must be indented");break}l+=h.length+v.length+1}for(let p=o.length-1;p>=a;--p)o[p][0].length>c&&(a=p+1);let u="",d="",m=!1;for(let p=0;p<f;++p)u+=o[p][0].slice(c)+`
74
- `;for(let p=f;p<a;++p){let[h,v]=o[p];l+=h.length+v.length+1;let y=v[v.length-1]==="\r";if(y&&(v=v.slice(0,-1)),v&&h.length<c){let R=`Block scalar lines must not be less indented than their ${r.indent?"explicit indentation indicator":"first line"}`;n(l-v.length-(y?2:1),"BAD_INDENT",R),h=""}s===Ds.Scalar.BLOCK_LITERAL?(u+=d+h.slice(c)+v,d=`
65
+ `}};on.YAMLError=rn;on.YAMLParseError=Fo;on.YAMLWarning=Bo;on.prettifyError=qm});var an=w(Qc=>{"use strict";function Dm(t,{flow:e,indicator:n,next:r,offset:i,onError:o,parentIndent:s,startOnNewline:a}){let c=!1,l=a,f=a,u="",d="",m=!1,g=!1,p=null,h=null,v=null,y=null,S=null,R=null,_=null;for(let k of t)switch(g&&(k.type!=="space"&&k.type!=="newline"&&k.type!=="comma"&&o(k.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),g=!1),p&&(l&&k.type!=="comment"&&k.type!=="newline"&&o(p,"TAB_AS_INDENT","Tabs are not allowed as indentation"),p=null),k.type){case"space":!e&&(n!=="doc-start"||r?.type!=="flow-collection")&&k.source.includes(" ")&&(p=k),f=!0;break;case"comment":{f||o(k,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let q=k.source.substring(1)||" ";u?u+=d+q:u=q,d="",l=!1;break}case"newline":l?u?u+=k.source:(!R||n!=="seq-item-ind")&&(c=!0):d+=k.source,l=!0,m=!0,(h||v)&&(y=k),f=!0;break;case"anchor":h&&o(k,"MULTIPLE_ANCHORS","A node can have at most one anchor"),k.source.endsWith(":")&&o(k.offset+k.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),h=k,_??(_=k.offset),l=!1,f=!1,g=!0;break;case"tag":{v&&o(k,"MULTIPLE_TAGS","A node can have at most one tag"),v=k,_??(_=k.offset),l=!1,f=!1,g=!0;break}case n:(h||v)&&o(k,"BAD_PROP_ORDER",`Anchors and tags must be after the ${k.source} indicator`),R&&o(k,"UNEXPECTED_TOKEN",`Unexpected ${k.source} in ${e??"collection"}`),R=k,l=n==="seq-item-ind"||n==="explicit-key-ind",f=!1;break;case"comma":if(e){S&&o(k,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),S=k,l=!1,f=!1;break}default:o(k,"UNEXPECTED_TOKEN",`Unexpected ${k.type} token`),l=!1,f=!1}let E=t[t.length-1],A=E?E.offset+E.source.length:i;return g&&r&&r.type!=="space"&&r.type!=="newline"&&r.type!=="comma"&&(r.type!=="scalar"||r.source!=="")&&o(r.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),p&&(l&&p.indent<=s||r?.type==="block-map"||r?.type==="block-seq")&&o(p,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:S,found:R,spaceBefore:c,comment:u,hasNewline:m,anchor:h,tag:v,newlineAfterProp:y,end:A,start:_??A}}Qc.resolveProps=Dm});var qr=w(Zc=>{"use strict";function Ko(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(Ko(e.key)||Ko(e.value))return!0}return!1;default:return!0}}Zc.containsNewline=Ko});var Uo=w(el=>{"use strict";var Wm=qr();function Mm(t,e,n){if(e?.type==="flow-collection"){let r=e.end[0];r.indent===t&&(r.source==="]"||r.source==="}")&&Wm.containsNewline(e)&&n(r,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}el.flowIndentCheck=Mm});var Yo=w(nl=>{"use strict";var tl=P();function Fm(t,e,n){let{uniqueKeys:r}=t.options;if(r===!1)return!1;let i=typeof r=="function"?r:(o,s)=>o===s||tl.isScalar(o)&&tl.isScalar(s)&&o.value===s.value;return e.some(o=>i(o.key,n))}nl.mapIncludes=Fm});var cl=w(al=>{"use strict";var rl=Ie(),Bm=Le(),il=an(),Km=qr(),ol=Uo(),Um=Yo(),sl="All mapping items must start at the same column";function Ym({composeNode:t,composeEmptyNode:e},n,r,i,o){let s=o?.nodeClass??Bm.YAMLMap,a=new s(n.schema);n.atRoot&&(n.atRoot=!1);let c=r.offset,l=null;for(let f of r.items){let{start:u,key:d,sep:m,value:g}=f,p=il.resolveProps(u,{indicator:"explicit-key-ind",next:d??m?.[0],offset:c,onError:i,parentIndent:r.indent,startOnNewline:!0}),h=!p.found;if(h){if(d&&(d.type==="block-seq"?i(c,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in d&&d.indent!==r.indent&&i(c,"BAD_INDENT",sl)),!p.anchor&&!p.tag&&!m){l=p.end,p.comment&&(a.comment?a.comment+=`
67
+ `+p.comment:a.comment=p.comment);continue}(p.newlineAfterProp||Km.containsNewline(d))&&i(d??u[u.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else p.found?.indent!==r.indent&&i(c,"BAD_INDENT",sl);n.atKey=!0;let v=p.end,y=d?t(n,d,p,i):e(n,v,u,null,p,i);n.schema.compat&&ol.flowIndentCheck(r.indent,d,i),n.atKey=!1,Um.mapIncludes(n,a.items,y)&&i(v,"DUPLICATE_KEY","Map keys must be unique");let S=il.resolveProps(m??[],{indicator:"map-value-ind",next:g,offset:y.range[2],onError:i,parentIndent:r.indent,startOnNewline:!d||d.type==="block-scalar"});if(c=S.end,S.found){h&&(g?.type==="block-map"&&!S.hasNewline&&i(c,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),n.options.strict&&p.start<S.found.offset-1024&&i(y.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));let R=g?t(n,g,S,i):e(n,c,m,null,S,i);n.schema.compat&&ol.flowIndentCheck(r.indent,g,i),c=R.range[2];let _=new rl.Pair(y,R);n.options.keepSourceTokens&&(_.srcToken=f),a.items.push(_)}else{h&&i(y.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),S.comment&&(y.comment?y.comment+=`
68
+ `+S.comment:y.comment=S.comment);let R=new rl.Pair(y);n.options.keepSourceTokens&&(R.srcToken=f),a.items.push(R)}}return l&&l<c&&i(l,"IMPOSSIBLE","Map comment with trailing content"),a.range=[r.offset,c,l??c],a}al.resolveBlockMap=Ym});var ul=w(ll=>{"use strict";var Gm=qe(),Vm=an(),Hm=Uo();function Jm({composeNode:t,composeEmptyNode:e},n,r,i,o){let s=o?.nodeClass??Gm.YAMLSeq,a=new s(n.schema);n.atRoot&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let c=r.offset,l=null;for(let{start:f,value:u}of r.items){let d=Vm.resolveProps(f,{indicator:"seq-item-ind",next:u,offset:c,onError:i,parentIndent:r.indent,startOnNewline:!0});if(!d.found)if(d.anchor||d.tag||u)u?.type==="block-seq"?i(d.end,"BAD_INDENT","All sequence items must start at the same column"):i(c,"MISSING_CHAR","Sequence item without - indicator");else{l=d.end,d.comment&&(a.comment=d.comment);continue}let m=u?t(n,u,d,i):e(n,d.end,f,null,d,i);n.schema.compat&&Hm.flowIndentCheck(r.indent,u,i),c=m.range[2],a.items.push(m)}return a.range=[r.offset,c,l??c],a}ll.resolveBlockSeq=Jm});var Ct=w(fl=>{"use strict";function zm(t,e,n,r){let i="";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&&r(a,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let f=c.substring(1)||" ";i?i+=s+f:i=f,s="";break}case"newline":i&&(s+=c),o=!0;break;default:r(a,"UNEXPECTED_TOKEN",`Unexpected ${l} at node end`)}e+=c.length}}return{comment:i,offset:e}}fl.resolveEnd=zm});var hl=w(ml=>{"use strict";var Xm=P(),Qm=Ie(),dl=Le(),Zm=qe(),eh=Ct(),pl=an(),th=qr(),nh=Yo(),Go="Block collections are not allowed within flow collections",Vo=t=>t&&(t.type==="block-map"||t.type==="block-seq");function rh({composeNode:t,composeEmptyNode:e},n,r,i,o){let s=r.start.source==="{",a=s?"flow map":"flow sequence",c=o?.nodeClass??(s?dl.YAMLMap:Zm.YAMLSeq),l=new c(n.schema);l.flow=!0;let f=n.atRoot;f&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let u=r.offset+r.start.source.length;for(let h=0;h<r.items.length;++h){let v=r.items[h],{start:y,key:S,sep:R,value:_}=v,E=pl.resolveProps(y,{flow:a,indicator:"explicit-key-ind",next:S??R?.[0],offset:u,onError:i,parentIndent:r.indent,startOnNewline:!1});if(!E.found){if(!E.anchor&&!E.tag&&!R&&!_){h===0&&E.comma?i(E.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`):h<r.items.length-1&&i(E.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${a}`),E.comment&&(l.comment?l.comment+=`
69
+ `+E.comment:l.comment=E.comment),u=E.end;continue}!s&&n.options.strict&&th.containsNewline(S)&&i(S,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(h===0)E.comma&&i(E.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`);else if(E.comma||i(E.start,"MISSING_CHAR",`Missing , between ${a} items`),E.comment){let A="";e:for(let k of y)switch(k.type){case"comma":case"space":break;case"comment":A=k.source.substring(1);break e;default:break e}if(A){let k=l.items[l.items.length-1];Xm.isPair(k)&&(k=k.value??k.key),k.comment?k.comment+=`
70
+ `+A:k.comment=A,E.comment=E.comment.substring(A.length+1)}}if(!s&&!R&&!E.found){let A=_?t(n,_,E,i):e(n,E.end,R,null,E,i);l.items.push(A),u=A.range[2],Vo(_)&&i(A.range,"BLOCK_IN_FLOW",Go)}else{n.atKey=!0;let A=E.end,k=S?t(n,S,E,i):e(n,A,y,null,E,i);Vo(S)&&i(k.range,"BLOCK_IN_FLOW",Go),n.atKey=!1;let q=pl.resolveProps(R??[],{flow:a,indicator:"map-value-ind",next:_,offset:k.range[2],onError:i,parentIndent:r.indent,startOnNewline:!1});if(q.found){if(!s&&!E.found&&n.options.strict){if(R)for(let D of R){if(D===q.found)break;if(D.type==="newline"){i(D,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}E.start<q.found.offset-1024&&i(q.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else _&&("source"in _&&_.source?.[0]===":"?i(_,"MISSING_CHAR",`Missing space after : in ${a}`):i(q.start,"MISSING_CHAR",`Missing , or : between ${a} items`));let Oe=_?t(n,_,q,i):q.found?e(n,q.end,R,null,q,i):null;Oe?Vo(_)&&i(Oe.range,"BLOCK_IN_FLOW",Go):q.comment&&(k.comment?k.comment+=`
71
+ `+q.comment:k.comment=q.comment);let pt=new Qm.Pair(k,Oe);if(n.options.keepSourceTokens&&(pt.srcToken=v),s){let D=l;nh.mapIncludes(n,D.items,k)&&i(A,"DUPLICATE_KEY","Map keys must be unique"),D.items.push(pt)}else{let D=new dl.YAMLMap(n.schema);D.flow=!0,D.items.push(pt);let ha=(Oe??k).range;D.range=[k.range[0],ha[1],ha[2]],l.items.push(D)}u=Oe?Oe.range[2]:q.end}}let d=s?"}":"]",[m,...g]=r.end,p=u;if(m?.source===d)p=m.offset+m.source.length;else{let h=a[0].toUpperCase()+a.substring(1),v=f?`${h} must end with a ${d}`:`${h} in block collection must be sufficiently indented and end with a ${d}`;i(u,f?"MISSING_CHAR":"BAD_INDENT",v),m&&m.source.length!==1&&g.unshift(m)}if(g.length>0){let h=eh.resolveEnd(g,p,n.options.strict,i);h.comment&&(l.comment?l.comment+=`
72
+ `+h.comment:l.comment=h.comment),l.range=[r.offset,p,h.offset]}else l.range=[r.offset,p,p];return l}ml.resolveFlowCollection=rh});var wl=w(gl=>{"use strict";var ih=P(),oh=$(),sh=Le(),ah=qe(),ch=cl(),lh=ul(),uh=hl();function Ho(t,e,n,r,i,o){let s=n.type==="block-map"?ch.resolveBlockMap(t,e,n,r,o):n.type==="block-seq"?lh.resolveBlockSeq(t,e,n,r,o):uh.resolveFlowCollection(t,e,n,r,o),a=s.constructor;return i==="!"||i===a.tagName?(s.tag=a.tagName,s):(i&&(s.tag=i),s)}function fh(t,e,n,r,i){let o=r.tag,s=o?e.directives.tagName(o.source,d=>i(o,"TAG_RESOLVE_FAILED",d)):null;if(n.type==="block-seq"){let{anchor:d,newlineAfterProp:m}=r,g=d&&o?d.offset>o.offset?d:o:d??o;g&&(!m||m.offset<g.offset)&&i(g,"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===sh.YAMLMap.tagName&&a==="map"||s===ah.YAMLSeq.tagName&&a==="seq")return Ho(t,e,n,i,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?i(o,"BAD_COLLECTION_TYPE",`${d.tag} used for ${a} collection, but expects ${d.collection??"scalar"}`,!0):i(o,"TAG_RESOLVE_FAILED",`Unresolved tag: ${s}`,!0),Ho(t,e,n,i,s)}let l=Ho(t,e,n,i,s,c),f=c.resolve?.(l,d=>i(o,"TAG_RESOLVE_FAILED",d),e.options)??l,u=ih.isNode(f)?f:new oh.Scalar(f);return u.range=l.range,u.tag=s,c?.format&&(u.format=c.format),u}gl.composeCollection=fh});var zo=w(yl=>{"use strict";var Jo=$();function dh(t,e,n){let r=e.offset,i=ph(e,t.options.strict,n);if(!i)return{value:"",type:null,comment:"",range:[r,r,r]};let o=i.mode===">"?Jo.Scalar.BLOCK_FOLDED:Jo.Scalar.BLOCK_LITERAL,s=e.source?mh(e.source):[],a=s.length;for(let p=s.length-1;p>=0;--p){let h=s[p][1];if(h===""||h==="\r")a=p;else break}if(a===0){let p=i.chomp==="+"&&s.length>0?`
73
+ `.repeat(Math.max(1,s.length-1)):"",h=r+i.length;return e.source&&(h+=e.source.length),{value:p,type:o,comment:i.comment,range:[r,h,h]}}let c=e.indent+i.indent,l=e.offset+i.length,f=0;for(let p=0;p<a;++p){let[h,v]=s[p];if(v===""||v==="\r")i.indent===0&&h.length>c&&(c=h.length);else{h.length<c&&n(l+h.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator"),i.indent===0&&(c=h.length),f=p,c===0&&!t.atRoot&&n(l,"BAD_INDENT","Block scalar values in collections must be indented");break}l+=h.length+v.length+1}for(let p=s.length-1;p>=a;--p)s[p][0].length>c&&(a=p+1);let u="",d="",m=!1;for(let p=0;p<f;++p)u+=s[p][0].slice(c)+`
74
+ `;for(let p=f;p<a;++p){let[h,v]=s[p];l+=h.length+v.length+1;let y=v[v.length-1]==="\r";if(y&&(v=v.slice(0,-1)),v&&h.length<c){let R=`Block scalar lines must not be less indented than their ${i.indent?"explicit indentation indicator":"first line"}`;n(l-v.length-(y?2:1),"BAD_INDENT",R),h=""}o===Jo.Scalar.BLOCK_LITERAL?(u+=d+h.slice(c)+v,d=`
75
75
  `):h.length>c||v[0]===" "?(d===" "?d=`
76
76
  `:!m&&d===`
77
77
  `&&(d=`
@@ -80,87 +80,87 @@ ${l}
80
80
  `,m=!0):v===""?d===`
81
81
  `?u+=`
82
82
  `:d=`
83
- `:(u+=d+v,d=" ",m=!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]!==`
83
+ `:(u+=d+v,d=" ",m=!1)}switch(i.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 g=i+r.length+e.source.length;return{value:u,type:s,comment:r.comment,range:[i,g,g]}}function zm({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 d=1;d<r.length;++d){let m=r[d];if(!a&&(m==="-"||m==="+"))a=m;else{let g=Number(m);!o&&g?o=g: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 m=e[d];switch(m.type){case"space":l=!0;case"newline":u+=m.source.length;break;case"comment":n&&!l&&i(m,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),u+=m.source.length,f=m.source.substring(1);break;case"error":i(m,"UNEXPECTED_TOKEN",m.message),u+=m.source.length;break;default:{let g=`Unexpected token in block scalar header: ${m.type}`;i(m,"UNEXPECTED_TOKEN",g);let p=m.source;p&&typeof p=="string"&&(u+=p.length)}}}return{mode:s,indent:o,chomp:a,comment:f,length:u}}function Xm(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}rl.resolveBlockScalar=Gm});var Ws=w(ol=>{"use strict";var Fs=$(),Qm=yt();function Zm(t,e,n){let{offset:i,type:r,source:s,end:o}=t,a,c,l=(d,m,g)=>n(i+d,m,g);switch(r){case"scalar":a=Fs.Scalar.PLAIN,c=eh(s,l);break;case"single-quoted-scalar":a=Fs.Scalar.QUOTE_SINGLE,c=th(s,l);break;case"double-quoted-scalar":a=Fs.Scalar.QUOTE_DOUBLE,c=nh(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 f=i+s.length,u=Qm.resolveEnd(o,f,e,n);return{value:c,type:a,comment:u.comment,range:[i,f,u.offset]}}function eh(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}`),sl(t)}function th(t,e){return(t[t.length-1]!=="'"||t.length===1)&&e(t.length,"MISSING_CHAR","Missing closing 'quote"),sl(t.slice(1,-1)).replace(/''/g,"'")}function sl(t){let e,n;try{e=new RegExp(`(.*?)(?<![ ])[ ]*\r?
87
+ `}let g=r+i.length+e.source.length;return{value:u,type:o,comment:i.comment,range:[r,g,g]}}function ph({offset:t,props:e},n,r){if(e[0].type!=="block-scalar-header")return r(e[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:i}=e[0],o=i[0],s=0,a="",c=-1;for(let d=1;d<i.length;++d){let m=i[d];if(!a&&(m==="-"||m==="+"))a=m;else{let g=Number(m);!s&&g?s=g:c===-1&&(c=t+d)}}c!==-1&&r(c,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${i}`);let l=!1,f="",u=i.length;for(let d=1;d<e.length;++d){let m=e[d];switch(m.type){case"space":l=!0;case"newline":u+=m.source.length;break;case"comment":n&&!l&&r(m,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),u+=m.source.length,f=m.source.substring(1);break;case"error":r(m,"UNEXPECTED_TOKEN",m.message),u+=m.source.length;break;default:{let g=`Unexpected token in block scalar header: ${m.type}`;r(m,"UNEXPECTED_TOKEN",g);let p=m.source;p&&typeof p=="string"&&(u+=p.length)}}}return{mode:o,indent:s,chomp:a,comment:f,length:u}}function mh(t){let e=t.split(/\n( *)/),n=e[0],r=n.match(/^( *)/),o=[r?.[1]?[r[1],n.slice(r[1].length)]:["",n]];for(let s=1;s<e.length;s+=2)o.push([e[s],e[s+1]]);return o}yl.resolveBlockScalar=dh});var Qo=w(bl=>{"use strict";var Xo=$(),hh=Ct();function gh(t,e,n){let{offset:r,type:i,source:o,end:s}=t,a,c,l=(d,m,g)=>n(r+d,m,g);switch(i){case"scalar":a=Xo.Scalar.PLAIN,c=wh(o,l);break;case"single-quoted-scalar":a=Xo.Scalar.QUOTE_SINGLE,c=yh(o,l);break;case"double-quoted-scalar":a=Xo.Scalar.QUOTE_DOUBLE,c=vh(o,l);break;default:return n(t,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${i}`),{value:"",type:null,comment:"",range:[r,r+o.length,r+o.length]}}let f=r+o.length,u=hh.resolveEnd(s,f,e,n);return{value:c,type:a,comment:u.comment,range:[r,f,u.offset]}}function wh(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}`),vl(t)}function yh(t,e){return(t[t.length-1]!=="'"||t.length===1)&&e(t.length,"MISSING_CHAR","Missing closing 'quote"),vl(t.slice(1,-1)).replace(/''/g,"'")}function vl(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 nh(t,e){let n="";for(let i=1;i<t.length-1;++i){let r=t[i];if(!(r==="\r"&&t[i+1]===`
92
- `))if(r===`
93
- `){let{fold:s,offset:o}=ih(t,i);n+=s,i=o}else if(r==="\\"){let s=t[++i],o=rh[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+=sh(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 ih(t,e){let n="",i=t[e+1];for(;(i===" "||i===" "||i===`
98
- `||i==="\r")&&!(i==="\r"&&t[e+2]!==`
99
- `);)i===`
89
+ `,"sy")}catch{e=/(.*?)[ \t]*\r?\n/sy,n=/[ \t]*(.*?)[ \t]*\r?\n/sy}let r=e.exec(t);if(!r)return t;let i=r[1],o=" ",s=e.lastIndex;for(n.lastIndex=s;r=n.exec(t);)r[1]===""?o===`
90
+ `?i+=o:o=`
91
+ `:(i+=o+r[1],o=" "),s=n.lastIndex;let a=/[ \t]*(.*)/sy;return a.lastIndex=s,r=a.exec(t),i+o+(r?.[1]??"")}function vh(t,e){let n="";for(let r=1;r<t.length-1;++r){let i=t[r];if(!(i==="\r"&&t[r+1]===`
92
+ `))if(i===`
93
+ `){let{fold:o,offset:s}=bh(t,r);n+=o,r=s}else if(i==="\\"){let o=t[++r],s=kh[o];if(s)n+=s;else if(o===`
94
+ `)for(o=t[r+1];o===" "||o===" ";)o=t[++r+1];else if(o==="\r"&&t[r+1]===`
95
+ `)for(o=t[++r+1];o===" "||o===" ";)o=t[++r+1];else if(o==="x"||o==="u"||o==="U"){let a=o==="x"?2:o==="u"?4:8;n+=Sh(t,r+1,a,e),r+=a}else{let a=t.substr(r-1,2);e(r-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),n+=a}}else if(i===" "||i===" "){let o=r,s=t[r+1];for(;s===" "||s===" ";)s=t[++r+1];s!==`
96
+ `&&!(s==="\r"&&t[r+2]===`
97
+ `)&&(n+=r>o?t.slice(o,r+1):i)}else n+=i}return(t[t.length-1]!=='"'||t.length===1)&&e(t.length,"MISSING_CHAR",'Missing closing "quote'),n}function bh(t,e){let n="",r=t[e+1];for(;(r===" "||r===" "||r===`
98
+ `||r==="\r")&&!(r==="\r"&&t[e+2]!==`
99
+ `);)r===`
100
100
  `&&(n+=`
101
- `),e+=1,i=t[e+1];return n||(n=" "),{fold:n,offset:e}}var rh={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
102
- `,r:"\r",t:" ",v:"\v",N:"…",_:" ",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function sh(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}}ol.resolveFlowScalar=Zm});var ll=w(cl=>{"use strict";var Qe=P(),al=$(),oh=Ms(),ah=Ws();function ch(t,e,n,i){let{value:r,type:s,comment:o,range:a}=e.type==="block-scalar"?oh.resolveBlockScalar(t,e,i):ah.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[Qe.SCALAR]:c?l=lh(t.schema,r,c,n,i):e.type==="scalar"?l=uh(t,r,e,i):l=t.schema[Qe.SCALAR];let f;try{let u=l.resolve(r,d=>i(n??e,"TAG_RESOLVE_FAILED",d),t.options);f=Qe.isScalar(u)?u:new al.Scalar(u)}catch(u){let d=u instanceof Error?u.message:String(u);i(n??e,"TAG_RESOLVE_FAILED",d),f=new al.Scalar(r)}return f.range=a,f.source=r,s&&(f.type=s),c&&(f.tag=c),l.format&&(f.format=l.format),o&&(f.comment=o),f}function lh(t,e,n,i,r){if(n==="!")return t[Qe.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[Qe.SCALAR])}function uh({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[Qe.SCALAR];if(n.compat){let a=n.compat.find(c=>c.default&&c.test?.test(i))??n[Qe.SCALAR];if(o.tag!==a.tag){let c=e.tagString(o.tag),l=e.tagString(a.tag),f=`Value may be parsed as either ${c} or ${l}`;s(r,"TAG_RESOLVE_FAILED",f,!0)}}return o}cl.composeScalar=ch});var fl=w(ul=>{"use strict";function fh(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}ul.emptyScalarPosition=fh});var ml=w(Ks=>{"use strict";var dh=qt(),ph=P(),mh=il(),dl=ll(),hh=yt(),gh=fl(),wh={composeNode:pl,composeEmptyNode:Bs};function pl(t,e,n,i){let r=t.atKey,{spaceBefore:s,comment:o,anchor:a,tag:c}=n,l,f=!0;switch(e.type){case"alias":l=yh(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=dl.composeScalar(t,e,c,i),a&&(l.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{l=mh.composeCollection(wh,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=Bs(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&&(!ph.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&&f&&(l.srcToken=e),l}function Bs(t,e,n,i,{spaceBefore:r,comment:s,anchor:o,tag:a,end:c},l){let f={type:"scalar",offset:gh.emptyScalarPosition(e,n,i),indent:-1,source:""},u=dl.composeScalar(t,f,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 yh({options:t},{offset:e,source:n,end:i},r){let s=new dh.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=hh.resolveEnd(i,o,t.strict,r);return s.range=[e,o,a.offset],a.comment&&(s.comment=a.comment),s}Ks.composeEmptyNode=Bs;Ks.composeNode=pl});var wl=w(gl=>{"use strict";var vh=Qt(),hl=ml(),bh=yt(),kh=nn();function Sh(t,e,{offset:n,start:i,value:r,end:s},o){let a=Object.assign({_directives:e},t),c=new vh.Document(void 0,a),l={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},f=kh.resolveProps(i,{indicator:"doc-start",next:r??s?.[0],offset:n,onError:o,parentIndent:0,startOnNewline:!0});f.found&&(c.directives.docStart=!0,r&&(r.type==="block-map"||r.type==="block-seq")&&!f.hasNewline&&o(f.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),c.contents=r?hl.composeNode(l,r,f,o):hl.composeEmptyNode(l,f.end,i,null,f,o);let u=c.contents.range[2],d=bh.resolveEnd(s,u,!1,o);return d.comment&&(c.comment=d.comment),c.range=[n,u,d.offset],c}gl.composeDoc=Sh});var Ys=w(bl=>{"use strict";var Ch=Fn("process"),Eh=Nr(),Rh=Qt(),rn=tn(),yl=P(),_h=wl(),xh=yt();function sn(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 vl(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,r=t[e+1];return n||(n=" "),{fold:n,offset:e}}var kh={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
102
+ `,r:"\r",t:" ",v:"\v",N:"…",_:" ",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function Sh(t,e,n,r){let i=t.substr(e,n),s=i.length===n&&/^[0-9a-fA-F]+$/.test(i)?parseInt(i,16):NaN;try{return String.fromCodePoint(s)}catch{let a=t.substr(e-2,n+2);return r(e-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),a}}bl.resolveFlowScalar=gh});var Cl=w(Sl=>{"use strict";var rt=P(),kl=$(),Ch=zo(),Eh=Qo();function Rh(t,e,n,r){let{value:i,type:o,comment:s,range:a}=e.type==="block-scalar"?Ch.resolveBlockScalar(t,e,r):Eh.resolveFlowScalar(e,t.options.strict,r),c=n?t.directives.tagName(n.source,u=>r(n,"TAG_RESOLVE_FAILED",u)):null,l;t.options.stringKeys&&t.atKey?l=t.schema[rt.SCALAR]:c?l=_h(t.schema,i,c,n,r):e.type==="scalar"?l=xh(t,i,e,r):l=t.schema[rt.SCALAR];let f;try{let u=l.resolve(i,d=>r(n??e,"TAG_RESOLVE_FAILED",d),t.options);f=rt.isScalar(u)?u:new kl.Scalar(u)}catch(u){let d=u instanceof Error?u.message:String(u);r(n??e,"TAG_RESOLVE_FAILED",d),f=new kl.Scalar(i)}return f.range=a,f.source=i,o&&(f.type=o),c&&(f.tag=c),l.format&&(f.format=l.format),s&&(f.comment=s),f}function _h(t,e,n,r,i){if(n==="!")return t[rt.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):(i(r,"TAG_RESOLVE_FAILED",`Unresolved tag: ${n}`,n!=="tag:yaml.org,2002:str"),t[rt.SCALAR])}function xh({atKey:t,directives:e,schema:n},r,i,o){let s=n.tags.find(a=>(a.default===!0||t&&a.default==="key")&&a.test?.test(r))||n[rt.SCALAR];if(n.compat){let a=n.compat.find(c=>c.default&&c.test?.test(r))??n[rt.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(i,"TAG_RESOLVE_FAILED",f,!0)}}return s}Sl.composeScalar=Rh});var Rl=w(El=>{"use strict";function Ph(t,e,n){if(e){n??(n=e.length);for(let r=n-1;r>=0;--r){let i=e[r];switch(i.type){case"space":case"comment":case"newline":t-=i.source.length;continue}for(i=e[++r];i?.type==="space";)t+=i.source.length,i=e[++r];break}}return t}El.emptyScalarPosition=Ph});var Pl=w(es=>{"use strict";var Oh=Mt(),Ah=P(),Nh=wl(),_l=Cl(),jh=Ct(),Th=Rl(),Ih={composeNode:xl,composeEmptyNode:Zo};function xl(t,e,n,r){let i=t.atKey,{spaceBefore:o,comment:s,anchor:a,tag:c}=n,l,f=!0;switch(e.type){case"alias":l=$h(t,e,r),(a||c)&&r(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=_l.composeScalar(t,e,c,r),a&&(l.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{l=Nh.composeCollection(Ih,t,e,n,r),a&&(l.anchor=a.source.substring(1))}catch(u){let d=u instanceof Error?u.message:String(u);r(e,"RESOURCE_EXHAUSTION",d)}break;default:{let u=e.type==="error"?e.message:`Unsupported token (type: ${e.type})`;r(e,"UNEXPECTED_TOKEN",u),f=!1}}return l??(l=Zo(t,e.offset,void 0,null,n,r)),a&&l.anchor===""&&r(a,"BAD_ALIAS","Anchor cannot be an empty string"),i&&t.options.stringKeys&&(!Ah.isScalar(l)||typeof l.value!="string"||l.tag&&l.tag!=="tag:yaml.org,2002:str")&&r(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 Zo(t,e,n,r,{spaceBefore:i,comment:o,anchor:s,tag:a,end:c},l){let f={type:"scalar",offset:Th.emptyScalarPosition(e,n,r),indent:-1,source:""},u=_l.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")),i&&(u.spaceBefore=!0),o&&(u.comment=o,u.range[2]=c),u}function $h({options:t},{offset:e,source:n,end:r},i){let o=new Oh.Alias(n.substring(1));o.source===""&&i(e,"BAD_ALIAS","Alias cannot be an empty string"),o.source.endsWith(":")&&i(e+n.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let s=e+n.length,a=jh.resolveEnd(r,s,t.strict,i);return o.range=[e,s,a.offset],a.comment&&(o.comment=a.comment),o}es.composeEmptyNode=Zo;es.composeNode=xl});var Nl=w(Al=>{"use strict";var Lh=nn(),Ol=Pl(),qh=Ct(),Dh=an();function Wh(t,e,{offset:n,start:r,value:i,end:o},s){let a=Object.assign({_directives:e},t),c=new Lh.Document(void 0,a),l={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},f=Dh.resolveProps(r,{indicator:"doc-start",next:i??o?.[0],offset:n,onError:s,parentIndent:0,startOnNewline:!0});f.found&&(c.directives.docStart=!0,i&&(i.type==="block-map"||i.type==="block-seq")&&!f.hasNewline&&s(f.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),c.contents=i?Ol.composeNode(l,i,f,s):Ol.composeEmptyNode(l,f.end,r,null,f,s);let u=c.contents.range[2],d=qh.resolveEnd(o,u,!1,s);return d.comment&&(c.comment=d.comment),c.range=[n,u,d.offset],c}Al.composeDoc=Wh});var ns=w(Il=>{"use strict";var Mh=Vn("process"),Fh=Mi(),Bh=nn(),cn=sn(),jl=P(),Kh=Nl(),Uh=Ct();function ln(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 Tl(t){let e="",n=!1,r=!1;for(let i=0;i<t.length;++i){let o=t[i];switch(o[0]){case"#":e+=(e===""?"":r?`
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 Us=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(n,i,r,s)=>{let o=sn(n);s?this.warnings.push(new rn.YAMLWarning(o,i,r)):this.errors.push(new rn.YAMLParseError(o,i,r))},this.directives=new Eh.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,n){let{comment:i,afterEmptyLine:r}=vl(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(yl.isCollection(s)&&!s.flow&&s.items.length>0){let o=s.items[0];yl.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:vl(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(Ch.env.LOG_STREAM&&console.dir(e,{depth:null}),e.type){case"directive":this.directives.add(e.source,(n,i,r)=>{let s=sn(e);s[0]+=n,this.onError(s,"BAD_DIRECTIVE",i,r)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let n=_h.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 rn.YAMLParseError(sn(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 rn.YAMLParseError(sn(e),"UNEXPECTED_TOKEN",i));break}this.doc.directives.docEnd=!0;let n=xh.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 rn.YAMLParseError(sn(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 Rh.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}}};bl.Composer=Us});var Cl=w(Ai=>{"use strict";var Ph=Ms(),Oh=Ws(),Nh=tn(),kl=Wt();function Ah(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 Nh.YAMLParseError([a,a+1],s,o)};switch(t.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return Oh.resolveFlowScalar(t,e,i);case"block-scalar":return Ph.resolveBlockScalar({options:{strict:e}},t,i)}}return null}function Th(t,e){let{implicitKey:n=!1,indent:i,inFlow:r=!1,offset:s=-1,type:o="PLAIN"}=e,a=kl.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,r=!1;break;case"%":t[i+1]?.[0]!=="#"&&(i+=1),n=!1;break;default:n||(r=!0),n=!1}}return{comment:e,afterEmptyLine:r}}var ts=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(n,r,i,o)=>{let s=ln(n);o?this.warnings.push(new cn.YAMLWarning(s,r,i)):this.errors.push(new cn.YAMLParseError(s,r,i))},this.directives=new Fh.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,n){let{comment:r,afterEmptyLine:i}=Tl(this.prelude);if(r){let o=e.contents;if(n)e.comment=e.comment?`${e.comment}
106
+ ${r}`:r;else if(i||e.directives.docStart||!o)e.commentBefore=r;else if(jl.isCollection(o)&&!o.flow&&o.items.length>0){let s=o.items[0];jl.isPair(s)&&(s=s.key);let a=s.commentBefore;s.commentBefore=a?`${r}
107
+ ${a}`:r}else{let s=o.commentBefore;o.commentBefore=s?`${r}
108
+ ${s}`:r}}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:Tl(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,n=!1,r=-1){for(let i of e)yield*this.next(i);yield*this.end(n,r)}*next(e){switch(Mh.env.LOG_STREAM&&console.dir(e,{depth:null}),e.type){case"directive":this.directives.add(e.source,(n,r,i)=>{let o=ln(e);o[0]+=n,this.onError(o,"BAD_DIRECTIVE",r,i)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let n=Kh.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,r=new cn.YAMLParseError(ln(e),"UNEXPECTED_TOKEN",n);this.atDirectives||!this.doc?this.errors.push(r):this.doc.errors.push(r);break}case"doc-end":{if(!this.doc){let r="Unexpected doc-end without preceding document";this.errors.push(new cn.YAMLParseError(ln(e),"UNEXPECTED_TOKEN",r));break}this.doc.directives.docEnd=!0;let n=Uh.resolveEnd(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),n.comment){let r=this.doc.comment;this.doc.comment=r?`${r}
109
+ ${n.comment}`:n.comment}this.doc.range[2]=n.offset;break}default:this.errors.push(new cn.YAMLParseError(ln(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 r=Object.assign({_directives:this.directives},this.options),i=new Bh.Document(void 0,r);this.atDirectives&&this.onError(n,"MISSING_CHAR","Missing directives-end indicator line"),i.range=[0,n,n],this.decorate(i,!1),yield i}}};Il.Composer=ts});var ql=w(Dr=>{"use strict";var Yh=zo(),Gh=Qo(),Vh=sn(),$l=Yt();function Hh(t,e=!0,n){if(t){let r=(i,o,s)=>{let a=typeof i=="number"?i:Array.isArray(i)?i[0]:i.offset;if(n)n(a,o,s);else throw new Vh.YAMLParseError([a,a+1],o,s)};switch(t.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return Gh.resolveFlowScalar(t,e,r);case"block-scalar":return Yh.resolveBlockScalar({options:{strict:e}},t,r)}}return null}function Jh(t,e){let{implicitKey:n=!1,indent:r,inFlow:i=!1,offset:o=-1,type:s="PLAIN"}=e,a=$l.stringifyString({type:s,value:t},{implicitKey:n,indent:r>0?" ".repeat(r):"",inFlow:i,options:{blockQuote:!0,lineWidth:-1}}),c=e.end??[{type:"newline",offset:-1,indent:r,source:`
110
110
  `}];switch(a[0]){case"|":case">":{let l=a.indexOf(`
111
111
  `),f=a.substring(0,l),u=a.substring(l+1)+`
112
- `,d=[{type:"block-scalar-header",offset:s,indent:i,source:f}];return Sl(d,c)||d.push({type:"newline",offset:-1,indent:i,source:`
113
- `}),{type:"block-scalar",offset:s,indent:i,props:d,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 Ih(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=kl.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">":jh(t,c);break;case'"':Vs(t,c,"double-quoted-scalar");break;case"'":Vs(t,c,"single-quoted-scalar");break;default:Vs(t,c,"scalar")}}function jh(t,e){let n=e.indexOf(`
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 Vs(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})}}}Ai.createScalarToken=Th;Ai.resolveAsScalar=Ah;Ai.setScalarValue=Ih});var Rl=w(El=>{"use strict";var $h=t=>"type"in t?Ii(t):Ti(t);function Ii(t){switch(t.type){case"block-scalar":{let e="";for(let n of t.props)e+=Ii(n);return e+t.source}case"block-map":case"block-seq":{let e="";for(let n of t.items)e+=Ti(n);return e}case"flow-collection":{let e=t.start.source;for(let n of t.items)e+=Ti(n);for(let n of t.end)e+=n.source;return e}case"document":{let e=Ti(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 Ti({start:t,key:e,sep:n,value:i}){let r="";for(let s of t)r+=s.source;if(e&&(r+=Ii(e)),n)for(let s of n)r+=s.source;return i&&(r+=Ii(i)),r}El.stringify=$h});var Ol=w(Pl=>{"use strict";var Js=Symbol("break visit"),qh=Symbol("skip children"),_l=Symbol("remove item");function Ze(t,e){"type"in t&&t.type==="document"&&(t={start:t.start,value:t.value}),xl(Object.freeze([]),t,e)}Ze.BREAK=Js;Ze.SKIP=qh;Ze.REMOVE=_l;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 xl(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=xl(Object.freeze(t.concat([[r,o]])),s.items[o],n);if(typeof a=="number")o=a-1;else{if(a===Js)return Js;a===_l&&(s.items.splice(o,1),o-=1)}}typeof i=="function"&&r==="key"&&(i=i(e,t))}}return typeof i=="function"?i(e,t):i}Pl.visit=Ze});var ji=w(z=>{"use strict";var Hs=Cl(),Lh=Rl(),Dh=Ol(),Gs="\uFEFF",zs="",Xs="",Qs="",Mh=t=>!!t&&"items"in t,Fh=t=>!!t&&(t.type==="scalar"||t.type==="single-quoted-scalar"||t.type==="double-quoted-scalar"||t.type==="block-scalar");function Wh(t){switch(t){case Gs:return"<BOM>";case zs:return"<DOC>";case Xs:return"<FLOW_END>";case Qs:return"<SCALAR>";default:return JSON.stringify(t)}}function Bh(t){switch(t){case Gs:return"byte-order-mark";case zs:return"doc-mode";case Xs:return"flow-error-end";case Qs:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
112
+ `,d=[{type:"block-scalar-header",offset:o,indent:r,source:f}];return Ll(d,c)||d.push({type:"newline",offset:-1,indent:r,source:`
113
+ `}),{type:"block-scalar",offset:o,indent:r,props:d,source:u}}case'"':return{type:"double-quoted-scalar",offset:o,indent:r,source:a,end:c};case"'":return{type:"single-quoted-scalar",offset:o,indent:r,source:a,end:c};default:return{type:"scalar",offset:o,indent:r,source:a,end:c}}}function zh(t,e,n={}){let{afterKey:r=!1,implicitKey:i=!1,inFlow:o=!1,type:s}=n,a="indent"in t?t.indent:null;if(r&&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=$l.stringifyString({type:s,value:e},{implicitKey:i||a===null,indent:a!==null&&a>0?" ".repeat(a):"",inFlow:o,options:{blockQuote:!0,lineWidth:-1}});switch(c[0]){case"|":case">":Xh(t,c);break;case'"':rs(t,c,"double-quoted-scalar");break;case"'":rs(t,c,"single-quoted-scalar");break;default:rs(t,c,"scalar")}}function Xh(t,e){let n=e.indexOf(`
114
+ `),r=e.substring(0,n),i=e.substring(n+1)+`
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=r,t.source=i}else{let{offset:o}=t,s="indent"in t?t.indent:-1,a=[{type:"block-scalar-header",offset:o,indent:s,source:r}];Ll(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:i})}}function Ll(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 rs(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 r=t.props.slice(1),i=e.length;t.props[0].type==="block-scalar-header"&&(i-=t.props[0].source.length);for(let o of r)o.offset+=i;delete t.props,Object.assign(t,{type:n,source:e,end:r});break}case"block-map":case"block-seq":{let i={type:"newline",offset:t.offset+e.length,indent:t.indent,source:`
117
+ `};delete t.items,Object.assign(t,{type:n,source:e,end:[i]});break}default:{let r="indent"in t?t.indent:-1,i="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:r,source:e,end:i})}}}Dr.createScalarToken=Jh;Dr.resolveAsScalar=Hh;Dr.setScalarValue=zh});var Wl=w(Dl=>{"use strict";var Qh=t=>"type"in t?Mr(t):Wr(t);function Mr(t){switch(t.type){case"block-scalar":{let e="";for(let n of t.props)e+=Mr(n);return e+t.source}case"block-map":case"block-seq":{let e="";for(let n of t.items)e+=Wr(n);return e}case"flow-collection":{let e=t.start.source;for(let n of t.items)e+=Wr(n);for(let n of t.end)e+=n.source;return e}case"document":{let e=Wr(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 Wr({start:t,key:e,sep:n,value:r}){let i="";for(let o of t)i+=o.source;if(e&&(i+=Mr(e)),n)for(let o of n)i+=o.source;return r&&(i+=Mr(r)),i}Dl.stringify=Qh});var Kl=w(Bl=>{"use strict";var is=Symbol("break visit"),Zh=Symbol("skip children"),Ml=Symbol("remove item");function it(t,e){"type"in t&&t.type==="document"&&(t={start:t.start,value:t.value}),Fl(Object.freeze([]),t,e)}it.BREAK=is;it.SKIP=Zh;it.REMOVE=Ml;it.itemAtPath=(t,e)=>{let n=t;for(let[r,i]of e){let o=n?.[r];if(o&&"items"in o)n=o.items[i];else return}return n};it.parentCollection=(t,e)=>{let n=it.itemAtPath(t,e.slice(0,-1)),r=e[e.length-1][0],i=n?.[r];if(i&&"items"in i)return i;throw new Error("Parent collection not found")};function Fl(t,e,n){let r=n(e,t);if(typeof r=="symbol")return r;for(let i of["key","value"]){let o=e[i];if(o&&"items"in o){for(let s=0;s<o.items.length;++s){let a=Fl(Object.freeze(t.concat([[i,s]])),o.items[s],n);if(typeof a=="number")s=a-1;else{if(a===is)return is;a===Ml&&(o.items.splice(s,1),s-=1)}}typeof r=="function"&&i==="key"&&(r=r(e,t))}}return typeof r=="function"?r(e,t):r}Bl.visit=it});var Fr=w(z=>{"use strict";var os=ql(),eg=Wl(),tg=Kl(),ss="\uFEFF",as="",cs="",ls="",ng=t=>!!t&&"items"in t,rg=t=>!!t&&(t.type==="scalar"||t.type==="single-quoted-scalar"||t.type==="double-quoted-scalar"||t.type==="block-scalar");function ig(t){switch(t){case ss:return"<BOM>";case as:return"<DOC>";case cs:return"<FLOW_END>";case ls:return"<SCALAR>";default:return JSON.stringify(t)}}function og(t){switch(t){case ss:return"byte-order-mark";case as:return"doc-mode";case cs:return"flow-error-end";case ls: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}z.createScalarToken=Hs.createScalarToken;z.resolveAsScalar=Hs.resolveAsScalar;z.setScalarValue=Hs.setScalarValue;z.stringify=Lh.stringify;z.visit=Dh.visit;z.BOM=Gs;z.DOCUMENT=zs;z.FLOW_END=Xs;z.SCALAR=Qs;z.isCollection=Mh;z.isScalar=Fh;z.prettyToken=Wh;z.tokenType=Bh});var to=w(Al=>{"use strict";var on=ji();function se(t){switch(t){case void 0:case" ":case`
120
- `:case"\r":case" ":return!0;default:return!1}}var Nl=new Set("0123456789ABCDEFabcdef"),Kh=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),$i=new Set(",[]{}"),Uh=new Set(` ,[]{}
121
- \r `),Zs=t=>!t||Uh.has(t),eo=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}z.createScalarToken=os.createScalarToken;z.resolveAsScalar=os.resolveAsScalar;z.setScalarValue=os.setScalarValue;z.stringify=eg.stringify;z.visit=tg.visit;z.BOM=ss;z.DOCUMENT=as;z.FLOW_END=cs;z.SCALAR=ls;z.isCollection=ng;z.isScalar=rg;z.prettyToken=ig;z.tokenType=og});var ds=w(Yl=>{"use strict";var un=Fr();function ce(t){switch(t){case void 0:case" ":case`
120
+ `:case"\r":case" ":return!0;default:return!1}}var Ul=new Set("0123456789ABCDEFabcdef"),sg=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),Br=new Set(",[]{}"),ag=new Set(` ,[]{}
121
+ \r `),us=t=>!t||ag.has(t),fs=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 r=this.next??"stream";for(;r&&(n||this.hasChars(1));)r=yield*this.parseNext(r)}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
- `:!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
- `||!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==="...")&&se(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 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 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==="...")&&se(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&&!se(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===":")&&se(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(Zs),"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("..."))&&se(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 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(Zs),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let o=this.charAt(1);if(this.flowKey||se(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=>se(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 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 s=this.buffer[i+1];if(se(s)||e&&$i.has(s))break;n=i}else if(se(r)){let s=this.buffer[i+1];if(r==="\r"&&(s===`
134
- `?(i+=1,r=`
135
- `,s=this.buffer[i+1]):n=i),s==="#"||e&&$i.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&&$i.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(Zs),e+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let n=this.flowLevel>0,i=this.charAt(1);if(se(i)||n&&$i.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(;!se(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(Kh.has(n))n=this.buffer[++e];else if(n==="%"&&Nl.has(this.buffer[e+1])&&Nl.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===`
123
+ `:!1}charAt(e){return this.buffer[this.pos+e]}continueScalar(e){let n=this.buffer[e];if(this.indentNext>0){let r=0;for(;n===" ";)n=this.buffer[++r+e];if(n==="\r"){let i=this.buffer[r+e+1];if(i===`
124
+ `||!i&&!this.atEnd)return e+r+1}return n===`
125
+ `||r>=this.indentNext||!n&&!this.atEnd?e+r:-1}if(n==="-"||n==="."){let r=this.buffer.substr(e,3);if((r==="---"||r==="...")&&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]===un.BOM&&(yield*this.pushCount(1),e=e.substring(1)),e[0]==="%"){let n=e.length,r=e.indexOf("#");for(;r!==-1;){let o=e[r-1];if(o===" "||o===" "){n=r-1;break}else r=e.indexOf("#",r+1)}for(;;){let o=e[n-1];if(o===" "||o===" ")n-=1;else break}let i=(yield*this.pushCount(n))+(yield*this.pushSpaces(!0));return yield*this.pushCount(e.length-i),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 un.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 r=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=r,"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(us),"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,r=-1;do e=yield*this.pushNewline(),e>0?(n=yield*this.pushSpaces(!1),this.indentValue=r=n):n=0,n+=yield*this.pushSpaces(!0);while(e+n>0);let i=this.getLine();if(i===null)return this.setNext("flow");if((r!==-1&&r<this.indentNext&&i[0]!=="#"||r===0&&(i.startsWith("---")||i.startsWith("..."))&&ce(i[3]))&&!(r===this.indentNext-1&&this.flowLevel===1&&(i[0]==="]"||i[0]==="}")))return this.flowLevel=0,yield un.FLOW_END,yield*this.parseLineStart();let o=0;for(;i[o]===",";)o+=yield*this.pushCount(1),o+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(o+=yield*this.pushIndicators(),i[o]){case void 0:return"flow";case"#":return yield*this.pushCount(i.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(us),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let s=this.charAt(1);if(this.flowKey||ce(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 r=this.buffer.substring(0,n),i=r.indexOf(`
127
+ `,this.pos);if(i!==-1){for(;i!==-1;){let o=this.continueScalar(i+1);if(o===-1)break;i=r.indexOf(`
128
+ `,o)}i!==-1&&(n=i-(r[i-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,r;e:for(let o=this.pos;r=this.buffer[o];++o)switch(r){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(!r&&!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 i=e+1;for(r=this.buffer[i];r===" ";)r=this.buffer[++i];if(r===" "){for(;r===" "||r===" "||r==="\r"||r===`
132
+ `;)r=this.buffer[++i];e=i-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 un.SCALAR,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,n=this.pos-1,r=this.pos-1,i;for(;i=this.buffer[++r];)if(i===":"){let o=this.buffer[r+1];if(ce(o)||e&&Br.has(o))break;n=r}else if(ce(i)){let o=this.buffer[r+1];if(i==="\r"&&(o===`
134
+ `?(r+=1,i=`
135
+ `,o=this.buffer[r+1]):n=r),o==="#"||e&&Br.has(o))break;if(i===`
136
+ `){let s=this.continueScalar(r+1);if(s===-1)break;r=Math.max(r,s-2)}}else{if(e&&Br.has(i))break;n=r}return!i&&!this.atEnd?this.setNext("plain-scalar"):(yield un.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 r=this.buffer.slice(this.pos,e);return r?(yield r,this.pos+=r.length,r.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(us),e+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let n=this.flowLevel>0,r=this.charAt(1);if(ce(r)||n&&Br.has(r)){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(sg.has(n))n=this.buffer[++e];else if(n==="%"&&Ul.has(this.buffer[e+1])&&Ul.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)}};Al.Lexer=eo});var io=w(Tl=>{"use strict";var no=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}}}};Tl.LineCounter=no});var so=w(Ll=>{"use strict";var Yh=Fn("process"),Il=ji(),Vh=to();function $e(t,e){for(let n=0;n<t.length;++n)if(t[n].type===e)return!0;return!1}function jl(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 ql(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 qi(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 vt(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 Li(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 $l(t){if(t.start.type==="flow-seq-start")for(let e of t.items)e.sep&&!e.value&&!$e(e.start,"explicit-key-ind")&&!$e(e.sep,"map-value-ind")&&(e.key&&(e.value=e.key),delete e.key,ql(e.value)?e.value.end?Li(e.value.end,e.sep):e.value.end=e.sep:Li(e.start,e.sep),delete e.sep)}var ro=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 Vh.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,Yh.env.LOG_TOKENS&&console.log("|",Il.prettyToken(e)),this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}let n=Il.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"&&$l(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&&jl(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":{jl(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=qi(this.peek(2)),i=vt(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,r;do r=this.buffer[++n];while(r===" "||e&&r===" ");let i=n-this.pos;return i>0&&(yield this.buffer.substr(this.pos,i),this.pos=n),i}*pushUntil(e){let n=this.pos,r=this.buffer[n];for(;!e(r);)r=this.buffer[++n];return yield*this.pushToIndex(n,!1)}};Yl.Lexer=fs});var ms=w(Gl=>{"use strict";var ps=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let n=0,r=this.lineStarts.length;for(;n<r;){let o=n+r>>1;this.lineStarts[o]<e?n=o+1:r=o}if(this.lineStarts[n]===e)return{line:n+1,col:1};if(n===0)return{line:0,col:e};let i=this.lineStarts[n-1];return{line:n,col:e-i+1}}}};Gl.LineCounter=ps});var gs=w(Xl=>{"use strict";var cg=Vn("process"),Vl=Fr(),lg=ds();function De(t,e){for(let n=0;n<t.length;++n)if(t[n].type===e)return!0;return!1}function Hl(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 zl(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 Kr(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 Et(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 Ur(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 Jl(t){if(t.start.type==="flow-seq-start")for(let e of t.items)e.sep&&!e.value&&!De(e.start,"explicit-key-ind")&&!De(e.sep,"map-value-ind")&&(e.key&&(e.value=e.key),delete e.key,zl(e.value)?e.value.end?Ur(e.value.end,e.sep):e.value.end=e.sep:Ur(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 lg.Lexer,this.onNewLine=e}*parse(e,n=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let r of this.lexer.lex(e,n))yield*this.next(r);n||(yield*this.end())}*next(e){if(this.source=e,cg.env.LOG_TOKENS&&console.log("|",Vl.prettyToken(e)),this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}let n=Vl.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 r=`Not a YAML token: ${e}`;yield*this.pop({type:"error",offset:this.offset,message:r,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 r=this.peek(1);switch(n.type==="block-scalar"?n.indent="indent"in r?r.indent:0:n.type==="flow-collection"&&r.type==="document"&&(n.indent=0),n.type==="flow-collection"&&Jl(n),r.type){case"document":r.value=n;break;case"block-scalar":r.props.push(n);break;case"block-map":{let i=r.items[r.items.length-1];if(i.value){r.items.push({start:[],key:n,sep:[]}),this.onKeyLine=!0;return}else if(i.sep)i.value=n;else{Object.assign(i,{key:n,sep:[]}),this.onKeyLine=!i.explicitKey;return}break}case"block-seq":{let i=r.items[r.items.length-1];i.value?r.items.push({start:[],value:n}):i.value=n;break}case"flow-collection":{let i=r.items[r.items.length-1];!i||i.value?r.items.push({start:[],key:n,sep:[]}):i.sep?i.value=n:Object.assign(i,{key:n,sep:[]});return}default:yield*this.pop(),yield*this.pop(n)}if((r.type==="document"||r.type==="block-map"||r.type==="block-seq")&&(n.type==="block-map"||n.type==="block-seq")){let i=n.items[n.items.length-1];i&&!i.sep&&!i.value&&i.start.length>0&&Hl(i.start)===-1&&(n.indent===0||i.start.every(o=>o.type!=="comment"||o.indent<n.indent))&&(r.type==="document"?r.end=i.start:r.items.push({start:i.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":{Hl(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=Kr(this.peek(2)),r=Et(n),i;e.end?(i=e.end,i.push(this.sourceToken),delete e.end):i=[this.sourceToken];let o={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:r,key:e,sep:i}]};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)){Li(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($e(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(ql(n.key)&&!$e(n.sep,"newline")){let o=vt(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($e(n.start,"newline"))Object.assign(n,{key:null,sep:[this.sourceToken]});else{let o=vt(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]}):$e(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&&!$e(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)){Li(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||$e(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=qi(i),s=vt(r);$l(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 r="end"in n.value?n.value.end:void 0;(Array.isArray(r)?r[r.length-1]:void 0)?.type==="comment"?r?.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 i=e.items[e.items.length-2]?.value?.end;if(Array.isArray(i)){Ur(i,n.start),i.push(this.sourceToken),e.items.pop();return}}n.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let r=!this.onKeyLine&&this.indent===e.indent,i=r&&(n.sep||n.explicitKey)&&this.type!=="seq-item-ind",o=[];if(i&&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":i||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):i||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(De(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(zl(n.key)&&!De(n.sep,"newline")){let s=Et(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(De(n.start,"newline"))Object.assign(n,{key:null,sep:[this.sourceToken]});else{let s=Et(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||i?e.items.push({start:o,key:null,sep:[this.sourceToken]}):De(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);i||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&&!De(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 r&&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 r="end"in n.value?n.value.end:void 0;(Array.isArray(r)?r[r.length-1]:void 0)?.type==="comment"?r?.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 i=e.items[e.items.length-2]?.value?.end;if(Array.isArray(i)){Ur(i,n.start),i.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||De(n.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return}if(this.indent>e.indent){let r=this.startBlockValue(e);if(r){this.stack.push(r);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let n=e.items[e.items.length-1];if(this.type==="flow-error-end"){let r;do yield*this.pop(),r=this.peek(1);while(r?.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 i=this.flowScalar(this.type);!n||n.value?e.items.push({start:[],key:i,sep:[]}):n.sep?this.stack.push(i):Object.assign(n,{key:i,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}let r=this.startBlockValue(e);r?this.stack.push(r):(yield*this.pop(),yield*this.step())}else{let r=this.peek(2);if(r.type==="block-map"&&(this.type==="map-value-ind"&&r.indent===e.indent||this.type==="newline"&&!r.items[r.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&r.type!=="flow-collection"){let i=Kr(r),o=Et(i);Jl(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=qi(e),i=vt(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=qi(e),i=vt(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())}}};Ll.Parser=ro});var Bl=w(cn=>{"use strict";var Dl=Ys(),Jh=Qt(),an=tn(),Hh=Kr(),Gh=P(),zh=io(),Ml=so();function Fl(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new zh.LineCounter||null,prettyErrors:e}}function Xh(t,e={}){let{lineCounter:n,prettyErrors:i}=Fl(e),r=new Ml.Parser(n?.addNewLine),s=new Dl.Composer(e),o=Array.from(s.compose(r.parse(t)));if(i&&n)for(let a of o)a.errors.forEach(an.prettifyError(t,n)),a.warnings.forEach(an.prettifyError(t,n));return o.length>0?o:Object.assign([],{empty:!0},s.streamInfo())}function Wl(t,e={}){let{lineCounter:n,prettyErrors:i}=Fl(e),r=new Ml.Parser(n?.addNewLine),s=new Dl.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 an.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return i&&n&&(o.errors.forEach(an.prettifyError(t,n)),o.warnings.forEach(an.prettifyError(t,n))),o}function Qh(t,e,n){let i;typeof e=="function"?i=e:n===void 0&&e&&typeof e=="object"&&(n=e);let r=Wl(t,n);if(!r)return null;if(r.warnings.forEach(s=>Hh.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 Zh(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 Gh.isDocument(t)&&!i?t.toString(n):new Jh.Document(t,i,n).toString(n)}cn.parse=Qh;cn.parseAllDocuments=Xh;cn.parseDocument=Wl;cn.stringify=Zh});var et=w(A=>{"use strict";var eg=Ys(),tg=Qt(),ng=Rs(),oo=tn(),ig=qt(),qe=P(),rg=Ae(),sg=$(),og=Ie(),ag=je(),cg=ji(),lg=to(),ug=io(),fg=so(),Di=Bl(),Kl=Tt();A.Composer=eg.Composer;A.Document=tg.Document;A.Schema=ng.Schema;A.YAMLError=oo.YAMLError;A.YAMLParseError=oo.YAMLParseError;A.YAMLWarning=oo.YAMLWarning;A.Alias=ig.Alias;A.isAlias=qe.isAlias;A.isCollection=qe.isCollection;A.isDocument=qe.isDocument;A.isMap=qe.isMap;A.isNode=qe.isNode;A.isPair=qe.isPair;A.isScalar=qe.isScalar;A.isSeq=qe.isSeq;A.Pair=rg.Pair;A.Scalar=sg.Scalar;A.YAMLMap=og.YAMLMap;A.YAMLSeq=ag.YAMLSeq;A.CST=cg;A.Lexer=lg.Lexer;A.LineCounter=ug.LineCounter;A.Parser=fg.Parser;A.parse=Di.parse;A.parseAllDocuments=Di.parseAllDocuments;A.parseDocument=Di.parseDocument;A.stringify=Di.stringify;A.visit=Kl.visit;A.visitAsync=Kl.visitAsync});function Le(t){return t!==0&&t!==0n&&t!=="0"}function Mi(t,e){return Le(t.dev)&&Le(e.dev)&&Le(t.ino)&&Le(e.ino)}function ve(t,e){let n=Le(t.dev)&&Le(e.dev);if(n&&t.dev!==e.dev)return!1;let i=Le(t.ino)&&Le(e.ino);return i&&t.ino!==e.ino?!1:n&&i?!0:t.birthtime===e.birthtime}var Fi=U(()=>{"use strict"});import{constants as Wi,promises as tt}from"fs";function ao(t){return"birthtimeNs"in t&&typeof t.birthtimeNs=="bigint"?t.birthtimeNs:t.birthtimeMs}function Ul(t){return"ctimeNs"in t&&typeof t.ctimeNs=="bigint"?t.ctimeNs:t.ctimeMs}function ln(t){return{dev:t.dev,ino:t.ino,birthtime:ao(t)}}function Bi(t,e){let n=ln(t),i=ln(e);return Mi(n,i)?ve(n,i):ve(n,i)&&ao(t)===ao(e)&&Ul(t)===Ul(e)&&t.size===e.size}async function Ki(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 tt.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 tt.realpath(t);await n.verify?.("pre-open",{realPath:o,identity:ln(s)});let a=process.platform==="win32"?Wi.O_RDONLY:Wi.O_RDONLY|Wi.O_NOFOLLOW|Wi.O_NONBLOCK,c;try{c=await tt.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,f,u]=await Promise.all([c.stat({bigint:r}),tt.lstat(t,{bigint:r}),tt.realpath(t)]);if(!l.isFile()||!f.isFile()||f.isSymbolicLink()||u!==o||!Bi(s,l)||!Bi(s,f))throw new De("changed",`${i} changed while opening`);await n.verify?.("post-open",{realPath:u,identity:ln(l)}),await n.hooks?.afterOpen?.();let d=[],m=0,g=Buffer.allocUnsafe(Math.min(64*1024,e+1));for(;;){let y=e+1-m,{bytesRead:S}=await c.read(g,0,Math.min(g.length,y),null);if(S===0)break;if(m+=S,m>e)throw new De("too-large",`${i} exceeds ${e} bytes`);d.push(Buffer.from(g.subarray(0,S)))}await n.hooks?.beforeFinalCheck?.();let[p,h,v]=await Promise.all([c.stat({bigint:r}),tt.lstat(t,{bigint:r}),tt.realpath(t)]);if(!h.isFile()||h.isSymbolicLink()||v!==o||!Bi(s,p)||!Bi(s,h))throw new De("changed",`${i} changed while reading`);return await n.verify?.("post-read",{realPath:v,identity:ln(p)}),{bytes:Buffer.concat(d,m),stat:p,realPath:v}}finally{await c.close()}}var De,co=U(()=>{"use strict";Fi();De=class extends Error{reason;constructor(e,n,i){super(n,i),this.name="RaceSafeReadError",this.reason=e}}});import Ji from"path";function Sg(t,e){if(typeof t!="string")throw new Error(`${e} must be a string`);let n=t.trim();if(n.length===0||Ji.posix.isAbsolute(n)||Ji.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 hn(t){let e=Sg(t,"native.artifact_root");return e.length===0?".":e.join("/")}function su(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 Me(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||Ji.posix.isAbsolute(i)||Ji.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 gn(t,e){if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`${e} must be a mapping`);return t}function ou(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 au(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>vo)throw new Error(`${e} exceeds ${vo} 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>bo)throw new Error(`${e} contains more than ${bo} wildcard tokens`);return t}function iu(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=>au(i,e)))].sort((i,r)=>i.localeCompare(r,"en"))}function yo(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 Cg(t){if(t===void 0)return{...ne,include:[...ne.include],exclude:[...ne.exclude]};let e=gn(t,"native.snapshot");return{include:iu(e.include,"native.snapshot.include",ne.include),exclude:iu(e.exclude,"native.snapshot.exclude",ne.exclude),max_files:yo(e.max_files,ne.max_files,"native.snapshot.max_files"),max_total_bytes:yo(e.max_total_bytes,ne.max_total_bytes,"native.snapshot.max_total_bytes"),max_duration_ms:yo(e.max_duration_ms,ne.max_duration_ms,"native.snapshot.max_duration_ms")}}function Eg(t){if(t===void 0)return;let e=gn(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=gn(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");o={kind:c,state:l,manifestHash:f}}return{id:n,fromArtifactRoot:hn(i),toArtifactRoot:hn(r),stage:s,...o?{cleanup:o}:{}}}function Rg(t,e={}){let n=gn(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??ru;if(!Number.isSafeInteger(o)||o<1)throw new Error("native.max_verify_failures must be a positive integer");let a=Eg(n.pending_root_move);return{artifact_root:hn(i),language:ou(n.language,"en","native.language"),clarification_mode:r,archive_confirmation:s,max_verify_failures:o,snapshot:Cg(n.snapshot),...a?{pending_root_move:a}:{}}}function _g(t){let e=gn(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:su(e.artifact_layout),language:ou(e.language,"zh-CN","classic.language"),context_compression:n,review_mode:i,auto_transition:r}}function xg(t){let e=t??!0;if(typeof e!="boolean")throw new Error("ambient_resume must be true or false");return e}function Pg(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 Fe(t,e={}){let n=(0,ko.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=xg(r.ambient_resume),o=r.native===void 0?void 0:Rg(r.native,{allowMissingArtifactRoot:e.allowMissingNativeFields}),a=r.classic===void 0?void 0:_g(r.classic),c=Pg(r,o,a,s,{allowPartialProject:e.allowPartialProject??!1});return{value:r,config:c,ambient_resume:s,...o?{native:o}:{},...a?{classic:a}:{}}}function So(t="docs",e="en"){return{schema:"comet.project.v1",default_workflow:"native",ambient_resume:!0,native:{artifact_root:hn(t),language:e,clarification_mode:"sequential",archive_confirmation:"automatic",max_verify_failures:ru,snapshot:{...ne,include:[...ne.include],exclude:[...ne.exclude]}}}}var ko,bt,vo,bo,ru,kg,ne,be=U(()=>{"use strict";ko=ct(et(),1),bt=64*1024,vo=1024,bo=64,ru=5,kg=[".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/**"],ne={include:["**/*"],exclude:[...kg],max_files:1e4,max_total_bytes:256*1024*1024,max_duration_ms:6e4}});import{promises as We}from"fs";import oe from"path";function cu(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}function Hi(t,e){let n=oe.relative(t,e);return n===""||!oe.isAbsolute(n)&&n!==".."&&!n.startsWith(`..${oe.sep}`)}async function Co(t,e){let n=oe.resolve(t),i=await We.lstat(n);if(!i.isDirectory()||i.isSymbolicLink())throw new Error(`${e} project root must be a real directory`);return We.realpath(n)}async function Eo(t,e,n,i){let r=t;for(let s=0;s<n.length;s++){r=oe.join(r,n[s]);let o;try{o=await We.lstat(r)}catch(f){if(cu(f))return{exists:!1,kind:"missing"};throw f}let a=oe.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 We.realpath(r);if(!Hi(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 j(t,e,n){let i=Me(e,n.label),r=oe.resolve(t),s=await Co(r,n.label),o=i.split("/"),a=oe.resolve(r,...o);if(!Hi(r,a))throw new Error(`${n.label} must stay inside the project root`);let c=await Eo(r,s,o,n);return{projectRoot:r,target:a,relative:i,exists:c.exists,kind:c.kind}}async function Ro(t,e,n){let i=Me(e,n.label),r=oe.resolve(t),s=await Co(r,n.label),o=i.split("/"),a=r;for(let c of o){a=oe.join(a,c);let l;try{l=await We.lstat(a)}catch(d){if(!cu(d))throw d;try{await We.mkdir(a)}catch(m){if(m.code!=="EEXIST")throw m}l=await We.lstat(a)}let f=oe.relative(r,a).replaceAll("\\","/");if(l.isSymbolicLink())throw new Error(`${n.label} crosses a symbolic link or junction at ${f}`);if(!l.isDirectory())throw new Error(`${n.label} directory ${f} must be a real directory`);let u=await We.realpath(a);if(!Hi(s,u))throw new Error(`${n.label} resolves outside the project root`)}return await Eo(r,s,o,{label:n.label,expected:"directory"}),a}async function Gi(t,e,n){return(await j(t,e,{...n,expected:"file"})).exists}async function W(t,e,n,i){let r=await j(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 Co(r.projectRoot,i.label);return Ki(r.target,n,{...i,verify:async(o,a)=>{if(!Hi(s,a.realPath))throw new Error(`${i.label} resolves outside the project root`);await Eo(r.projectRoot,s,r.relative.split("/"),{label:i.label,expected:"file"})}})}var ae=U(()=>{"use strict";co();be()});import{createHash as Og}from"crypto";function Ng(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}async function kt(t,e={}){return(await zi(t,e)).document}async function Ag(t){try{return(await W(t,wn,bt,{label:wn})).bytes}catch(e){if(Ng(e))return null;throw e}}function Tg(t){return t?{exists:!0,sha256:Og("sha256").update(t).digest("hex")}:{exists:!1,sha256:null}}async function zi(t,e={}){let n=await Ag(t);return{document:n?Fe(n.toString("utf8"),e):null,identity:Tg(n)}}var wn,St=U(()=>{"use strict";be();ae();wn=".comet/config.yaml"});import{randomUUID as Ig}from"crypto";import{constants as jg,promises as q}from"fs";import B from"path";async function _o(t,e){try{return await q.link(t,e),{linked:!0}}catch(n){let i=n.code;if(i!=="ENOTSUP"&&i!=="EOPNOTSUPP")throw n}return await q.copyFile(t,e,jg.COPYFILE_EXCL),{linked:!1}}function Ct(t,e){let n=B.relative(t,e);return n===""||!B.isAbsolute(n)&&n!==".."&&!n.startsWith(`..${B.sep}`)}function Qi(t){return{dev:t.dev,ino:t.ino,birthtime:t.birthtimeMs}}function $g(t,e){return ve(t,Qi(e))}function Xi(t,e){let n=Qi(t),i=Qi(e);return Mi(n,i)?ve(n,i):ve(n,i)&&t.birthtimeMs===e.birthtimeMs&&t.ctimeMs===e.ctimeMs&&t.size===e.size}async function Zi(t){let e=await q.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 q.realpath(t),...Qi(e)}}async function Be(t){for(let e of t){let n=await q.lstat(e.path);if(!n.isDirectory()||n.isSymbolicLink()||!$g(e,n)||await q.realpath(e.path)!==e.realPath)throw new Error(`Contained atomic write parent changed before commit: ${e.path}`)}}async function qg(t,e){let n=B.resolve(t),i=B.resolve(e);if(!Ct(n,i))throw new Error(`Contained atomic write parent is outside its managed root: ${e}`);let r=[await Zi(n)],s=B.relative(n,i).split(B.sep).filter(Boolean),o=n;for(let a of s){await Be(r),o=B.join(o,a);try{await q.mkdir(o)}catch(l){if(l.code!=="EEXIST")throw l}let c=await Zi(o);if(!Ct(r[0].realPath,c.realPath))throw new Error(`Contained atomic write parent resolves outside its managed root: ${o}`);r.push(c)}return await Be(r),r}async function Lg(t,e){let n=B.resolve(t),i=B.resolve(e);if(!Ct(n,i))throw new Error(`Contained file parent is outside its managed root: ${e}`);let r=[await Zi(n)],s=B.relative(n,i).split(B.sep).filter(Boolean),o=n;for(let a of s){o=B.join(o,a);try{let c=await Zi(o);if(!Ct(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 Be(r),r}async function lu(t){let e;try{e=await q.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 Dg(t,e,n){let i=B.dirname(t),r=await qg(n.containedRoot,i),s=B.join(i,`.${B.basename(t)}.${Ig()}.tmp`),o,a;try{await n.beforeTemporaryOpen?.(),o=await q.open(s,"wx"),a=await o.stat();let[c,l]=await Promise.all([q.lstat(s),q.realpath(s)]);if(await Be(r),!c.isFile()||c.isSymbolicLink()||!Xi(a,c)||!Ct(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(),!Xi(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 Be(r);let f=await q.lstat(s);if(!f.isFile()||f.isSymbolicLink()||!Xi(f,a))throw new Error("Contained atomic write temporary file changed before commit");n.exclusive?(await _o(s,t),await q.unlink(s)):await q.rename(s,t),await lu(i)}catch(c){await o?.close();try{await Be(r),await q.rm(s,{force:!0})}catch{}throw c}}async function ce(t,e,n){await Dg(t,e,n)}async function xo(t,e){let n=B.dirname(t),i=await Lg(e.containedRoot,n);if(!i)return!1;let r,s;try{r=await q.lstat(t),s=await q.realpath(t)}catch(c){if(c.code==="ENOENT")return!1;throw c}if(!r.isFile()||r.isSymbolicLink()||!Ct(i[0].realPath,s))throw new Error("Contained file removal target must be a regular file inside its managed root");await e.beforeRemove?.(),await Be(i);let[o,a]=await Promise.all([q.lstat(t),q.realpath(t)]);if(!o.isFile()||o.isSymbolicLink()||!Xi(r,o)||a!==s)throw new Error("Contained file removal target changed before removal");return await q.unlink(t),await Be(i),await lu(n),!0}var nt=U(()=>{"use strict";Fi()});var _k,Po=U(()=>{"use strict";nt();St();ae();_k=16*1024});var No=U(()=>{"use strict";nt();be();St();ae();Po()});var ir=U(()=>{"use strict"});var Cu=U(()=>{"use strict"});var To=U(()=>{"use strict";ir()});var Eu=U(()=>{"use strict";ir();To()});function rw(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}function sw(t){let e=(0,Ru.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 xu(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 ow(t){let e=Fe(JSON.stringify({...t,schema:"comet.project.v1"})).config;if(!e)throw new Error("Invalid global Comet config: workflow template is incomplete");return xu(e)}function aw(t){let e=Fe(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=So(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 Pu(t){let e=sw(t);if(Object.keys(e).length===0)return null;if(e.schema===void 0)return aw(t);if(e.schema!=="comet.global.v1")throw new Error("Unsupported Comet global schema");return ow(e)}async function Io(t){try{let e=await W(t,_u,bt,{label:"global Comet config"});return Pu(e.bytes.toString("utf8"))}catch(e){if(rw(e))return null;throw e}}var Ru,_u,jo=U(()=>{"use strict";Ru=ct(et(),1);nt();be();ae();_u=".comet/config.yaml"});var Ou=U(()=>{"use strict";ir();nt();Cu();Eu();be();jo();ae();St();No();Po();To()});import{TextDecoder as cw}from"util";function Nu(t){return{dev:t.dev,ino:t.ino,birthtime:t.birthtimeMs}}function lw(t,e){try{return new cw("utf-8",{fatal:!0}).decode(t.bytes)}catch(n){throw new Error(`${e} is not valid UTF-8`,{cause:n})}}async function $o(t,e,n,i,r={}){try{let s=await W(t,e,n,{label:i,hooks:r.hooks});return{result:s,text:lw(s,i)}}catch(s){let o=s.code;if(o==="ENOENT"||o==="ENOTDIR")return null;throw s}}async function Cn(t,e,n,i,r={}){return(await $o(t,e,n,i,r))?.text??null}async function rr(t,e,n,i,r,s={}){if(Buffer.byteLength(n,"utf8")>i)throw new Error(`${r} exceeds ${i} bytes`);let o=await $o(t,e,i,r),a=await j(t,e,{label:r,expected:"file"});await ce(a.target,n,{containedRoot:a.projectRoot,beforeCommit:async()=>{await s.beforeCommit?.();let c=await $o(t,e,i,r);if(!(!o&&!c)){if(!o||!c)throw new Error(`${r} changed before commit`);if(o.result.realPath!==c.result.realPath||!ve(Nu(o.result.stat),Nu(c.result.stat))||o.text!==c.text)throw new Error(`${r} changed before commit`)}}})}async function sr(t,e,n,i,r,s={}){let o=await Cn(t,e,i,r);await rr(t,e,`${o??""}${n}`,i,r,s)}async function qo(t,e,n,i={}){let r=await j(t,e,{label:n,expected:"file"});return r.exists?xo(r.target,{containedRoot:r.projectRoot,beforeRemove:i.beforeRemove}):!1}var or=U(()=>{"use strict";Ou();Fi()});var Iu={};Lf(Iu,{RUN_STATE_FILE:()=>cr,applyRunStateToDocument:()=>Lo,readRunState:()=>_n,removeRunState:()=>Do,runStateFromDocument:()=>ar,writeRunState:()=>lr});import uw from"path";function Rn(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 En(t,e){let n=Rn(t,e);if(uw.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 fw(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 ar(t){if(!t.run_id)return null;let e=Rn(t,"run_id"),n=Rn(t,"skill"),i=Rn(t,"skill_version"),r=Rn(t,"skill_hash"),s=En(t,"pending_ref"),o=En(t,"trajectory_ref"),a=En(t,"context_ref"),c=En(t,"artifacts_ref"),l=En(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:Au(t,"current_step"),iteration:f,pending:Au(t,"pending"),pendingRef:s,trajectoryRef:o,contextRef:a,artifactsRef:c,checkpointRef:l,status:t.run_status,retries:fw(t)}}function Lo(t,e){e?t.run_id=e.runId:delete t.run_id}function dw(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 pw(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 ar(e)}async function _n(t,e={}){let n=await Cn(t,cr,Tu,"Run state",e);if(n===null)return null;let i=JSON.parse(n);return pw(i)}async function lr(t,e,n={}){await rr(t,cr,JSON.stringify(dw(e),null,2),Tu,"Run state",n)}async function Do(t,e={}){await qo(t,cr,"Run state",e)}var Au,cr,Tu,xn=U(()=>{"use strict";or();Au=(t,e)=>{let n=t[e];return n==null?null:String(n)};cr=".comet/run-state.json",Tu=256*1024});var Mn=ct(et(),1);import{spawnSync as jy}from"child_process";import{promises as $y}from"fs";import O from"path";co();import{randomUUID as dg}from"crypto";import{promises as un}from"fs";import Vl from"path";var lo="comet.selection.v2",pg=16*1024;function Ui(t){return Vl.join(t,".comet","current-change.json")}function mg(t){return!!t&&typeof t=="object"&&!Array.isArray(t)}function Yl(t){return t===null||typeof t=="string"}function Jl(t){let e;try{e=JSON.parse(t)}catch(n){throw new Error(`current change selection contains invalid JSON: ${n instanceof Error?n.message:String(n)}`,{cause:n})}if(!mg(e))throw new Error("current change selection must be a JSON object");if(e.version===1){if(typeof e.change!="string")throw new Error("legacy current change selection change must be a string");if(e.branch!==void 0&&!Yl(e.branch))throw new Error("legacy current change selection branch must be a string or null");return{selection:{schema:lo,workflow:"classic",change:e.change,branch:e.branch??null},legacy:!0}}if(e.schema!==lo)throw new Error(`current change selection schema must be ${lo}`);if(e.workflow!=="native"&&e.workflow!=="classic")throw new Error("current change selection workflow must be native or classic");if(typeof e.change!="string")throw new Error("current change selection change must be a string");if(!Yl(e.branch))throw new Error("current change selection branch must be a string or null");if(e.workflow==="native"&&e.branch!==null)throw new Error("Native current change selection branch must be null");return{selection:e,legacy:!1}}async function uo(t){let e;try{let i=Ui(t),{bytes:r}=await Ki(i,pg,{label:"current change selection"});e=r.toString("utf8")}catch(i){if(i.code==="ENOENT")return{status:"missing"};throw new Error(`cannot read current change selection: ${i instanceof Error?i.message:String(i)}`,{cause:i})}return{status:"selected",...Jl(e)}}async function Hl(t,e){let n=Jl(JSON.stringify(e));if(n.legacy)throw new Error("cannot write a legacy current change selection");let i=Ui(t),r=`${i}.${dg()}.tmp`;await un.mkdir(Vl.dirname(i),{recursive:!0});try{await un.writeFile(r,`${JSON.stringify(n.selection,null,2)}
143
- `,"utf8"),await un.rename(r,i)}catch(s){throw await un.rm(r,{force:!0}),s}}async function Gl(t){await un.rm(Ui(t),{force:!0})}var zl=null;function Xl(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=zl;if(i===null)return e(...n);let r=Xl(`async:${t}`,n),s=i.entries.get(r);if(s)return s.value;let o=e(...n).catch(a=>{throw i.entries.delete(r),a});return i.entries.set(r,{value:o}),o}}function fo(t,e){return(...n)=>{let i=zl;if(i===null)return e(...n);let r=Xl(`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}}var po=ct(et(),1);import{execFileSync as Zl}from"child_process";import{randomUUID as hg}from"crypto";import{promises as fn}from"fs";import eu from"path";function Yi(t){try{let e=Zl("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 gg=fo("liveGitBranch",t=>Yi(t));function mo(t){try{return Zl("git",["rev-parse","--is-inside-work-tree"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()==="true"}catch{return!1}}var wg=fo("isGitWorkTree",t=>mo(t)),yg=["current","branch","worktree"];function Vi(t){return yg.includes(t)}function ho(t){return Vi(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 dn(t,e){let n=eu.join(t,".comet.yaml"),i=(0,po.parseDocument)(await fn.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=Vi(s),c=gg(e.cwd),l=a&&o===null&&c===null?wg(e.cwd):!0,f=ho({isolation:s,boundBranch:o,currentBranch:c,gitWorkTree:l});return f.status==="needs-heal"&&e.heal?(await go(t,f.branch),{status:"healed",branch:f.branch,bindingRequired:a,currentBranch:c}):{...f,bindingRequired:a,currentBranch:c}}async function go(t,e){let n=eu.join(t,".comet.yaml"),i=(0,po.parseDocument)(await fn.readFile(n,"utf8"),{uniqueKeys:!1});i.set("bound_branch",e);let r=`${n}.${hg()}.tmp`;try{await fn.writeFile(r,i.toString(),"utf8"),await fn.rename(r,n)}catch(s){throw await fn.rm(r,{force:!0}),s}}function tu(t){return t??"detached HEAD"}function nu(t,e,n){return`change '${t}' is bound to branch '${e}', but current branch is '${tu(n)}'.
144
- Next: ask the user to confirm — switch back to '${e}', or run \`comet state rebind ${t}\` after explicit confirmation.`}function wo(t,e,n){return`change '${t}' is bound to branch '${e}', but current branch is '${tu(n)}'`}function pn(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.`}import{promises as Gg}from"fs";import Et from"path";import{promises as pu}from"fs";import I from"path";import{promises as vg}from"fs";async function mn(t){try{return await vg.access(t),!0}catch(e){if(bg(e))return!1;throw e}}function bg(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}be();St();No();ae();var yn=class extends Error{code="classic-layout-unavailable";constructor(e="Classic artifact layout is unavailable from .comet/config.yaml"){super(e),this.name="ClassicLayoutUnavailableError"}},du=".comet/config.yaml";function mu(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}async function hu(t){await j(t,du,{label:du,expected:"file"})}function er(t,e){let n=I.resolve(t),i=e==="docs"?I.join(n,"docs"):n,r=I.join(i,"openspec"),s=I.join(n,"docs","superpowers");return{projectRoot:n,artifactLayout:e,openSpecBase:i,openSpecRoot:r,changesDir:I.join(r,"changes"),archiveDir:I.join(r,"changes","archive"),specsDir:I.join(r,"specs"),superpowersRoot:s,superpowersSpecsDir:I.join(s,"specs"),superpowersPlansDir:I.join(s,"plans"),superpowersReportsDir:I.join(s,"reports")}}async function Kg(t){await hu(t);let e=await kt(t,{allowPartialProject:!0,allowMissingNativeFields:!0});if(!e?.config)throw new yn;if(!(e.config.workflows??[e.config.default_workflow]).includes("classic"))throw new yn("Classic artifact layout is unavailable because Classic is not enabled");return e.classic?.artifact_layout??"legacy"}async function Ug(t,e){return er(t,e??await Kg(t))}async function Yg(t){try{return await pu.lstat(t),!0}catch(e){if(mu(e))return!1;throw e}}async function Vg(t,e){let n=await Ug(t,e),i=n.artifactLayout==="legacy"?"docs":"legacy",r=er(t,i).openSpecRoot,[s,o]=await Promise.all([j(n.projectRoot,Z(n.projectRoot,n.openSpecRoot),{label:"Configured Classic OpenSpec root",expected:"directory"}),Yg(r)]),a=s.exists;return{paths:n,configuredRootExists:a,alternateRoot:r,alternateRootExists:o,dualRoots:a&&o}}async function Jg(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 j(t.projectRoot,i,{label:`Classic managed physical path ${i}`,expected:"directory"})}}async function ee(t,e){let n=await Vg(t,e);if(await Jg(n.paths),!n.configuredRootExists){let i=Z(n.paths.projectRoot,n.paths.openSpecRoot),r=Z(n.paths.projectRoot,n.alternateRoot);throw new yn(`Configured Classic OpenSpec root is missing: ${i} (alternate ${r} is ${n.alternateRootExists?"present":"missing"})`)}return n.paths}async function tr(t,e){let n=I.join(I.resolve(t),".comet","classic-root-move.json");if(await mn(n))throw new Error("Classic root move transaction is incomplete; inspect it with comet doctor and recover it explicitly before writing");let i=await ee(t,e);if(!await mn(i.openSpecRoot))throw new Error(`Configured Classic OpenSpec root is missing: ${Z(i.projectRoot,i.openSpecRoot)}`);return i}async function vn(t){let e=I.resolve(t),n=null;try{(await pu.lstat(e)).isDirectory()||(e=I.dirname(e))}catch(i){if(!mu(i))throw i}for(;;){I.basename(e)==="openspec"&&(n=I.dirname(e));let i=I.join(e,".comet","config.yaml"),r=!1;if(await mn(i))try{await hu(e);let o=(await kt(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 mn(I.join(e,".git")))return e;let s=I.dirname(e);if(s===e)return n??I.resolve(t);e=s}}function Z(t,e){return I.relative(I.resolve(t),e).replaceAll("\\","/")}nt();be();ae();import bn from"path";var Hg=2*1024*1024;function nr(t,e,n){let i=bn.resolve(t),r=bn.isAbsolute(e)?bn.resolve(e):bn.resolve(i,e),s=bn.relative(i,r).replaceAll("\\","/");return{root:i,relative:Me(s,n),target:r}}async function Ke(t,e,n){let i=nr(t,e,n.label);return j(i.root,i.relative,n)}async function kn(t,e,n){return(await Ke(t,e,{label:n.label,expected:n.expected??"any"})).exists}async function gu(t,e,n,i){return await kn(t,e,{label:n,expected:"file"})?(await wu(t,e,{label:n,hooks:i})).byteLength>0:!1}async function Ue(t,e,n){return(await wu(t,e,n)).toString("utf8")}async function wu(t,e,n){let i=nr(t,e,n.label);return(await W(i.root,i.relative,n.maxBytes??Hg,{label:n.label,hooks:n.hooks})).bytes}async function yu(t,e,n){let i=nr(t,e,n);return Ro(i.root,i.relative,{label:n})}async function vu(t,e,n,i){let r=nr(t,e,i.label);await j(r.root,r.relative,{label:i.label,expected:"file"}),await ce(r.target,n,{containedRoot:r.root,beforeTemporaryOpen:i.beforeTemporaryOpen,beforeCommit:i.beforeCommit,exclusive:i.exclusive})}function Ao(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}'
145
- Valid format: lowercase kebab-case (a-z, 0-9, single hyphens)`:"Change name cannot be empty"}function it(t){let e=Ao(t);if(e)throw new Error(e)}function zg(t,e){return{label:Z(t,e),directory:e}}async function Sn(t,e,n){let i=zg(t,e);if(!(await Ke(t,e,{label:n,expected:"directory"})).exists)return{change:i,exists:!1,stateExists:!1};let s=await Ke(t,Et.join(e,".comet.yaml"),{label:`${n} state`,expected:"file"});return{change:i,exists:!0,stateExists:s.exists}}function Xg(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 o=await Sn(t,Et.join(e,n),`Classic archived change ${n}`);if(o.exists)return o.change}if(!(await Ke(t,e,{label:"Classic archive directory",expected:"directory"})).exists)return null;let s=[];for(let o of await Gg.readdir(e,{withFileTypes:!0})){if(!Xg(o.name,n))continue;let a=await Sn(t,Et.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 bu(t,e=process.cwd()){it(t);let n=await ee(e),i=await Sn(n.projectRoot,Et.join(n.changesDir,t),`Classic active change ${t}`);return{...i.change,exists:i.exists,stateExists:i.stateExists}}async function ku(t,e=process.cwd()){it(t);let n=await tr(e),i=Et.join(n.changesDir,t),r=await Sn(n.projectRoot,i,`Classic active change ${t}`);return r.exists||await yu(n.projectRoot,i,`Classic active change ${t}`),r.change}async function Su(t,e=process.cwd()){it(t);let n=await ee(e),i=await Sn(n.projectRoot,Et.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}var dr=ct(et(),1);nt();ae();import fr from"path";xn();var ju=["full","hotfix","tweak"],Pn=1,mw=["open","design","build","verify","archive"],hw=["en","zh-CN"],gw=["off","beta"],ww=["subagent-driven-development","executing-plans","direct"],yw=["plan-ready"],vw=["confirmed"],bw=["tdd","direct"],kw=["off","standard","thorough"],Sw=["current","branch","worktree"],Cw=["light","full"],Ew=["pending","pass","fail"],Rw=["pending","handled"],_w=["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"],Fo=["run_id"],xw=new Set([..._t,...Fo]),Pw=["workflow","phase","design_doc","plan","build_mode","isolation","verify_mode","verify_result","verified_at","archived"];function $u(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function Rt(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 V(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 Mo(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 Ow(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 ur(t,e){let n=Rt(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=Rt(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!==Pn)throw new Error(`Invalid Classic state: classic_migration must be ${Pn}`);return e}function Tw(t){if(!_t.some(n=>$u(t,n)))return null;for(let n of Pw)if(!$u(t,n))return null;return{workflow:V(t,"workflow",ju,!1),language:V(t,"language",hw),phase:V(t,"phase",mw,!1),contextCompression:V(t,"context_compression",gw),buildMode:V(t,"build_mode",ww),buildPause:V(t,"build_pause",yw),subagentDispatch:V(t,"subagent_dispatch",vw),tddMode:V(t,"tdd_mode",bw),reviewMode:V(t,"review_mode",kw),isolation:V(t,"isolation",Sw),boundBranch:Rt(t,"bound_branch"),verifyMode:V(t,"verify_mode",Cw),autoTransition:Mo(t,"auto_transition"),baseRef:Rt(t,"base_ref"),designDoc:ur(t,"design_doc"),plan:ur(t,"plan"),verifyResult:V(t,"verify_result",Ew,!1),verifyFailures:Ow(t,"verify_failures"),verificationReport:ur(t,"verification_report"),branchStatus:V(t,"branch_status",Rw),createdAt:Rt(t,"created_at"),verifiedAt:Rt(t,"verified_at"),archiveConfirmation:V(t,"archive_confirmation",_w),archived:Mo(t,"archived",!1),directOverride:Mo(t,"direct_override"),handoffContext:ur(t,"handoff_context"),handoffHash:Nw(t,"handoff_hash"),classicProfile:V(t,"classic_profile",ju),classicMigration:Aw(t)}}function On(t,e){let n=e??null;if(n===null&&e===void 0&&t.run_id&&t.skill)try{n=ar(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:Tw(t),run:n,unknownKeys:Object.keys(t).filter(i=>!xw.has(i))}}function qu(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}}xn();var Iw=2*1024*1024;function Nn(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 Lu(t,e,n){t.get(e)!==n&&t.set(e,n)}function jw(t,e){if(e.classic)for(let[n,i]of Object.entries(qu(e.classic)))Lu(t,n,i);else for(let n of _t)t.delete(n);Lo(t.toJS(),e.run),e.run?Lu(t,"run_id",e.run.runId):t.delete("run_id")}function $w(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 qw(t){let e=!1;for(let n of["build_command","verify_command"])t.has(n)&&(t.delete(n),e=!0);return e}async function Du(t){let e;try{e=(await W(fr.dirname(t),fr.basename(t),Iw,{label:"Classic state document"})).bytes.toString("utf8")}catch(i){if(i.code!=="ENOENT")throw i;return new dr.Document({})}let n=(0,dr.parseDocument)(e);if(n.errors.length>0)throw new Error(`Invalid Classic state document: ${n.errors[0].message}`);return Nn(n),n}async function me(t,e={}){let n=e.migrate!==!1,i=fr.join(t,".comet.yaml"),r=await Du(i),s=Nn(r),o=qw(r);o&&(s=Nn(r));let a=await _n(t);if(!a&&s.run_id&&s.skill){let{runStateFromDocument:c}=await Promise.resolve().then(()=>(xn(),Iu));a=c(s),a&&n&&(await lr(t,a),$w(r),o=!0)}return o&&n&&await ce(i,r.toString(),{containedRoot:t}),On(Nn(r),a)}async function xt(t,e,n={}){let i=fr.join(t,".comet.yaml"),r=await Du(i);jw(r,{...e,unknownKeys:e.unknownKeys??[]}),On(Nn(r),e.run??null),await ce(i,r.toString(),{containedRoot:t,beforeCommit:n.beforeCommit}),e.run?await lr(t,e.run):await Do(t)}var Lw=Ql("readCometCurrentSelection",t=>uo(t));async function Mu(t,e){it(e);let n=await bu(e,t);if(!n.stateExists)throw new Error(`Cannot select current change '${e}': active change state not found`);let i=await me(n.directory,{migrate:!1});if(!i.classic)throw new Error(`Cannot select current change '${e}': Classic state is incomplete`);if(i.classic.archived)throw new Error(`Cannot select current change '${e}': change is archived`);return n.directory}async function Fu(t,e){let n=await Mu(t,e),i=await dn(n,{heal:!0,cwd:t});if(i.status==="drift")throw new Error(wo(e,i.boundBranch,i.currentBranch));if(i.status==="unbound-detached")throw new Error(pn(e));let r={schema:"comet.selection.v2",workflow:"classic",change:e,branch:i.currentBranch};return await Hl(t,r),r}async function Wu(t){let e;try{e=await Lw(t)}catch(s){return{status:"stale",reason:s instanceof Error?s.message:String(s)}}if(e.status==="missing")return{status:"missing"};if(e.selection.workflow!=="classic")return{status:"stale",reason:`current change '${e.selection.change}' belongs to Native, not Classic`};let n=e.selection,i;try{i=await Mu(t,n.change)}catch(s){return{status:"stale",reason:s instanceof Error?s.message:String(s)}}let r=await dn(i,{heal:!1,cwd:t});return r.status==="drift"?{status:"stale",reason:wo(n.change,r.boundBranch,r.currentBranch)}:r.status==="unbound-detached"?{status:"stale",reason:pn(n.change)}:r.status==="ok"?{status:"selected",selection:n}:n.branch!==null&&r.currentBranch!==n.branch?{status:"stale",reason:`current change '${n.change}' was selected on branch '${n.branch}', current branch is '${r.currentBranch??"detached HEAD"}'`}:{status:"selected",selection:n}}async function Bu(t){let e;try{e=await uo(t)}catch{return}e.status==="selected"&&e.selection.workflow==="classic"&&await Gl(t)}import{promises as Mw}from"fs";import ke from"path";ae();be();import An from"path";function Dw(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}async function Ku(t,e,n,i){let r=Me(n,"Classic handoff artifact pointer");if((await j(t,r,{label:"Classic handoff artifact",expected:"file"})).exists)return null;let o=await ee(t),a=`${Z(t,o.changesDir)}/`,l=(o.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];it(u);let d=f.slice(2),m=An.resolve(e);if(An.dirname(m)!==An.resolve(o.archiveDir))return null;let g=An.basename(m),p=/^\d{4}-\d{2}-\d{2}-(.+)$/u.exec(g);if(g!==u&&p?.[1]!==u)return null;await j(t,Z(t,m),{label:"Classic archived change directory",expected:"directory"});let h=An.join(m,".comet",...d),v=Z(t,h);try{return await W(t,v,i,{label:"Historical Classic archived handoff artifact"}),v}catch(y){if(Dw(y))return null;throw y}}ae();var Uu=2*1024*1024;function Tn(t,e){return ke.relative(t,e).split(ke.sep).join("/")}async function In(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,er(t,a).openSpecRoot);if((s===c||s.startsWith(`${c}/`))&&(await j(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 Gi(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 Fw(t,e,n,i){try{i??=await ee(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 In(t,"design.handoff",n,i);if(!n||r.satisfied||r.detail)return r;try{let s=await Ku(t,e,n,Uu);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 pr(t,e,n){return In(t,e,Tn(t,n))}async function Ww(t,e){let n=ke.join(e,"specs"),i;try{let o=Tn(t,n);if(!(await j(t,o,{label:"OpenSpec delta-spec directory",expected:"directory"})).exists)return{code:"openspec.delta-spec",satisfied:!1};i=await Mw.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=>ke.join(n,o,"spec.md")),s=(await Promise.all(r.map(async o=>{try{return await Gi(t,Tn(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]?Tn(t,s[0]):void 0,detail:`${s.length} delta spec${s.length===1?"":"s"}`}}async function Bw(t,e){let n,i=Tn(t,e);try{n=(await W(t,i,Uu,{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 jn(t,e){return t.some(n=>n.code===e&&n.satisfied)}async function Pt(t,e){let n=await vn(t),i=e.classic,r=ke.join(t,"proposal.md"),s=ke.join(t,"design.md"),o=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 ee(n)}catch(d){l=d}let f=await Promise.all([pr(n,"openspec.proposal",r),pr(n,"openspec.design",s),pr(n,"openspec.tasks",o),Ww(n,t),In(n,"design.document",i?.designDoc??null,c,l),In(n,"build.plan",i?.plan??null,c,l),Bw(n,o),In(n,"verification.report",i?.verificationReport??null,c,l),Fw(n,t,i?.handoffContext??null,c),pr(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{AsyncLocalStorage as Kw}from"async_hooks";import{promises as Yu}from"fs";import $n from"path";var mr=new Kw;function Uw(t,e){let n=$n.relative(t,e);return n===""||!$n.isAbsolute(n)&&n!==".."&&!n.startsWith(`..${$n.sep}`)}async function Yw(t){let e=$n.resolve(t.invocationCwd??process.cwd()),n=$n.resolve(t.projectRoot??await vn(e)),[i,r]=await Promise.all([Yu.realpath(e),Yu.realpath(n)]);if(!Uw(r,i))throw new Error(`Classic command invocation cwd is outside the discovered project: ${e}`);return{invocationCwd:e,projectRoot:n}}async function Vu(t,e){let n=mr.getStore();if(n)return e(n);let i=await Yw(t);return mr.run(i,()=>e(i))}function T(){let t=mr.getStore();if(!t)throw new Error("Classic command project context is unavailable");return t.projectRoot}function qn(){let t=mr.getStore();if(!t)throw new Error("Classic command invocation context is unavailable");return t.invocationCwd}function Vw(t){return t.classicProfile??t.workflow}function Jw(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 Hw(t){return t.buildMode==="direct"&&t.tddMode==="direct"&&t.isolation!==null&&t.verifyMode==="light"}function Gw(t,e,n){if(e.verifyResult==="fail")return t==="full"?"full.build.fix":`${t}.build.execute`;if(t==="full"){if(!jn(n,"build.plan"))return"full.build.plan";if(e.buildPause==="plan-ready")return"full.build.plan-ready";if(!Jw(e))return"full.build.configure"}else if(!Hw(e))throw new Error(`${t} build configuration is incomplete`);return jn(n,"build.tasks-complete")?`${t}.build.complete`:`${t}.build.execute`}function zw(t,e,n){return e.verifyResult!=="pass"||!jn(n,"verification.report")?`${t}.verify.run`:`${t}.verify.branch`}function Xw(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 Ot(t,e){let n=Vw(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 jn(e,"design.handoff")?"full.design.document":"full.design.handoff";case"build":return Gw(n,t,e);case"verify":return zw(n,t,e);case"archive":return Xw(n,t)}}import{promises as df}from"fs";import Q from"path";import{fileURLToPath as pf}from"url";or();import hr from"path";var Ju={trajectory:8*1024*1024,artifacts:1024*1024,context:1024*1024,pendingAction:256*1024,checkpoint:256*1024};function Hu(t,e){if(hr.isAbsolute(e))throw new Error("Run path must stay inside the change directory");let n=hr.resolve(t),i=hr.resolve(n,e);if(i!==n&&!i.startsWith(n+hr.sep))throw new Error("Run path must stay inside the change directory")}async function rt(t,e,n,i={}){Hu(t,e),await sr(t,e,`${JSON.stringify(n)}
146
- `,Ju.trajectory,"Run trajectory",i)}async function Nt(t,e,n={}){Hu(t,e);let i=await Cn(t,e,Ju.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})}})}import{createHash as lf,randomUUID as YC}from"crypto";import{promises as At}from"fs";import he from"path";var Xu=ct(et(),1);import{promises as Wo}from"fs";import ie from"path";var Qw=["invoke_skill","call_tool","handoff","ask_user","checkpoint"],Zw=["deterministic","adaptive"],ey=["function","mcp","script","agent"],ty=["none","read","write","external"],ny=["progress","step","completion"],iy=["artifact_exists","state_equals"];function st(t,e,n){return new Error(`${t}: ${e} ${n}`)}function X(t,e,n="document"){if(t===null||typeof t!="object"||Array.isArray(t))throw st(e,n,"must be an object")}function Ye(t,e,n){if(!Array.isArray(t))throw st(e,n,"must be an array")}function J(t,e,n){if(typeof t!="string")throw st(e,n,"must be a string")}function le(t,e,n,i){e in t&&J(t[e],n,`${i}.${e}`)}function Qu(t,e,n,i){if(e in t&&typeof t[e]!="boolean")throw st(n,`${i}.${e}`,"must be a boolean")}function Ve(t,e,n,i){if(typeof t!="string"||!e.includes(t))throw st(n,i,`must be one of ${e.join(", ")}`)}function gr(t,e,n){Ye(t,e,n),t.forEach((i,r)=>{J(i,e,`${n}[${r}]`)})}function Gu(t,e,n){X(t,e,n),J(t.name,e,`${n}.name`),J(t.description,e,`${n}.description`),Qu(t,"required",e,n)}function ry(t,e,n){X(t,e,n),J(t.id,e,`${n}.id`),le(t,"source",e,n),le(t,"version",e,n)}function sy(t,e,n){X(t,e,n),J(t.id,e,`${n}.id`),J(t.role,e,`${n}.role`),le(t,"instructions",e,n)}function oy(t,e,n){X(t,e,n),J(t.id,e,`${n}.id`),Ve(t.kind,ey,e,`${n}.kind`),J(t.source,e,`${n}.source`),Ve(t.sideEffect,ty,e,`${n}.sideEffect`),Qu(t,"requiresConfirmation",e,n)}function ay(t,e,n){X(t,e,n),Ve(t.type,Qw,e,`${n}.type`),le(t,"ref",e,n),le(t,"prompt",e,n),le(t,"question",e,n),"options"in t&&gr(t.options,e,`${n}.options`)}function cy(t,e,n){X(t,e,n),J(t.id,e,`${n}.id`),ay(t.action,e,`${n}.action`),le(t,"next",e,n),"completionEvals"in t&&gr(t.completionEvals,e,`${n}.completionEvals`)}function ly(t,e){let n="goal";X(t,e,n),J(t.statement,e,`${n}.statement`),Ye(t.inputs,e,`${n}.inputs`),t.inputs.forEach((i,r)=>{Gu(i,e,`${n}.inputs[${r}]`)}),Ye(t.outputs,e,`${n}.outputs`),t.outputs.forEach((i,r)=>{Gu(i,e,`${n}.outputs[${r}]`)}),gr(t.success,e,`${n}.success`)}function uy(t,e){let n="orchestration";X(t,e,n),Ve(t.mode,Zw,e,`${n}.mode`),le(t,"entry",e,n),"steps"in t&&(Ye(t.steps,e,`${n}.steps`),t.steps.forEach((i,r)=>{cy(i,e,`${n}.steps[${r}]`)}))}function Zu(t,e){return X(t,e),Ve(t.apiVersion,["comet/v1alpha1"],e,"apiVersion"),Ve(t.kind,["Skill"],e,"kind"),X(t.metadata,e,"metadata"),J(t.metadata.name,e,"metadata.name"),J(t.metadata.version,e,"metadata.version"),J(t.metadata.description,e,"metadata.description"),ly(t.goal,e),uy(t.orchestration,e),Ye(t.skills,e,"skills"),t.skills.forEach((n,i)=>{ry(n,e,`skills[${i}]`)}),Ye(t.agents,e,"agents"),t.agents.forEach((n,i)=>{sy(n,e,`agents[${i}]`)}),Ye(t.tools,e,"tools"),t.tools.forEach((n,i)=>{oy(n,e,`tools[${i}]`)}),t}function ef(t,e){X(t,e);for(let n of["allowedSkills","allowedAgents","allowedTools","confirmationRequiredFor"])n in t&&gr(t[n],e,n);for(let n of["maxIterations","maxRetriesPerAction"])if(n in t&&(typeof t[n]!="number"||!Number.isFinite(t[n])))throw st(e,n,"must be a finite number");return t}function fy(t,e){return X(t,e),"runtime"in t&&tf(t.runtime,e,"runtime"),t}function tf(t,e,n){return Ye(t,e,n),t.forEach((i,r)=>{let s=`${n}[${r}]`;X(i,e,s),J(i.id,e,`${s}.id`),Ve(i.scope,ny,e,`${s}.scope`),Ve(i.type,iy,e,`${s}.type`),le(i,"artifact",e,s),le(i,"field",e,s),le(i,"equals",e,s)}),t}async function Bo(t){let e=await Wo.readFile(t,"utf8");try{return(0,Xu.parse)(e)}catch(n){let i=n instanceof Error?n.message:String(n);throw st(t,"document",i)}}async function dy(t){try{return await Bo(t)}catch(e){if(e.code==="ENOENT")return null;throw e}}async function zu(t){try{return await Wo.access(t),!0}catch(e){if(e.code==="ENOENT")return!1;throw e}}async function py(t){let e=ie.join(t,"checks.yaml"),n=ie.join(t,"evals.yaml"),[i,r]=await Promise.all([zu(e),zu(n)]);if(r)throw new Error(`${n}: evals.yaml is no longer supported; use checks.yaml`);return i?{document:fy(await Bo(e),e)}:{document:null}}async function nf(t){let e=ie.resolve(t.root),n=ie.resolve(t.controlRoot);t.requireSkillMarkdown&&await Wo.access(ie.join(e,"SKILL.md"));let i=ie.join(n,"skill.yaml"),r=ie.join(n,"guardrails.yaml"),s=Zu(await Bo(i),i),o=await dy(r),a=o===null?null:ef(o,r),c=await py(n),l={allowedSkills:s.skills.map(f=>f.id),allowedAgents:s.agents.map(f=>f.id),allowedTools:s.tools.map(f=>f.id),maxIterations:50,maxRetriesPerAction:3,confirmationRequiredFor:s.tools.filter(f=>f.requiresConfirmation).map(f=>f.id)};return{root:e,packageKind:t.packageKind==="runtime"?"runtime":void 0,definition:s,guardrails:{...l,...a},evals:c.document?.runtime??[]}}async function rf(t){let e=ie.resolve(t);return nf({root:e,controlRoot:ie.join(e,"comet"),packageKind:"skill",requireSkillMarkdown:!0})}async function sf(t){let e=ie.resolve(t);return nf({root:e,controlRoot:e,packageKind:"runtime",requireSkillMarkdown:!1})}function of(t,e,n=ie.join(e,"package.json")){X(t,n);let i=t.packageKind==="runtime"?"runtime":void 0,r=Zu(t.definition,n),s=ef(t.guardrails,n),o=tf(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:ie.resolve(e),packageKind:i,definition:r,guardrails:{...a,...s},evals:o}}import af from"path";function my(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 cf(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),my(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=af.posix.normalize(o.source.replaceAll("\\","/"));(af.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 wr(t){return Array.isArray(t)?t.map(wr):t&&typeof t=="object"?Object.fromEntries(Object.entries(t).sort(([e],[n])=>e.localeCompare(n)).map(([e,n])=>[e,wr(n)])):t}function hy(t){return wr({...t.packageKind==="runtime"?{packageKind:"runtime"}:{},definition:t.definition,guardrails:t.guardrails,evals:t.evals})}function gy(t){return he.posix.normalize(t.replaceAll("\\","/"))}function Ko(t,e,n){let i=he.relative(t,e);if(!(i===""||!he.isAbsolute(i)&&!i.startsWith(`..${he.sep}`)))throw new Error(`${n} resolves outside the Skill package`)}async function uf(t,e,n){let i=gy(e);if(he.posix.isAbsolute(i)||i===".."||i.startsWith("../"))throw new Error(`${n} resolves outside the Skill package`);let r=he.resolve(t,...i.split("/"));Ko(t,r,n);let s;try{s=await At.realpath(r)}catch(o){throw o.code==="ENOENT"?new Error(`${n} does not exist: ${e}`,{cause:o}):o}if(Ko(t,s,n),!(await At.stat(s)).isFile())throw new Error(`${n} is not a file: ${e}`);return{path:i,content:await At.readFile(s)}}async function wy(t){let e=await At.realpath(t.root),n=t.packageKind==="runtime"?[]:[await uf(e,"SKILL.md","SKILL.md")];for(let i of t.definition.tools)i.kind==="script"&&n.push(await uf(e,i.source,`Script tool ${i.id}`));return n.sort((i,r)=>i.path.localeCompare(r.path))}function yy(t,e){let n=e.map(i=>({path:i.path,sha256:lf("sha256").update(i.content).digest("hex")}));return lf("sha256").update(JSON.stringify(wr({package:t,files:n}))).digest("hex")}async function vy(t){let e=hy(t),n=await wy(t);return{document:e,files:n,hash:yy(e,n)}}async function ff(t){return(await vy(t)).hash}async function Uo(t,e){if(!/^[a-f0-9]{64}$/u.test(e))throw new Error(`Invalid Skill snapshot hash: ${e}`);let n=he.resolve(t,".comet","skill-snapshots"),i=he.join(n,e);Ko(n,i,"Skill snapshot");try{let r=(await At.readFile(he.join(i,"sha256"),"utf8")).trim();if(r!==e)throw new Error(`stored hash is ${r||"(empty)"}`);let s=he.join(i,"package.json"),o=JSON.parse(await At.readFile(s,"utf8")),a=of(o,i,s),c=cf(a);if(c.length>0)throw new Error(c.map(f=>` - ${f}`).join(`
147
- `));let l=await ff(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 by(t){try{return(await df.stat(t)).isDirectory()}catch(e){if(e.code==="ENOENT")return!1;throw e}}async function yr(t){try{return(await df.stat(t)).isFile()}catch(e){if(e.code==="ENOENT")return!1;throw e}}async function ky(t){return await by(t)?await yr(Q.join(t,"skill.yaml"))?!0:await yr(Q.join(t,"SKILL.md"))&&await yr(Q.join(t,"comet","skill.yaml")):!1}function Sy(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 Cy(){let t=Q.dirname(pf(import.meta.url)),e=[process.env.COMET_RUNTIME_CLASSIC_ROOT,Q.resolve(t,"..","runtime","classic"),Q.resolve(t,"..","..","comet","runtime","classic"),Q.resolve(t,"..","..","assets","skills","comet","runtime","classic"),Q.resolve("assets","skills","comet","runtime","classic"),process.env.COMET_CLASSIC_SKILL_ROOT,Q.resolve(t,"..","..","comet-classic"),Q.resolve(t,"..","..","assets","skills","comet-classic"),Q.resolve("assets","skills","comet-classic")].filter(n=>!!n);for(let n of e)if(await ky(n))return n;return null}async function Ey(t){return await yr(Q.join(t,"skill.yaml"))?sf(t):rf(t)}async function mf(t,e){let n=e??await me(t,{migrate:!1}),i=Array.from(new Set(n.unknownKeys)).sort();if(i.length>0)throw new Error(`Invalid Classic state: unknown field(s): ${i.join(", ")}`);if(!n.classic||!n.run)throw new Error("Classic runtime validation requires synchronized Classic and Run projections");if(n.classic.classicMigration!==Pn)throw new Error("Classic Run exists without a supported classic_migration marker");let r=await Cy(),s=r?await Ey(r):Sy(Q.dirname(pf(import.meta.url)));if(n.run.skill!==s.definition.metadata.name)throw new Error(`Classic Run skill mismatch: expected ${s.definition.metadata.name}, got ${n.run.skill}`);let o=await Uo(t,n.run.skillHash);if(o.definition.metadata.name!==n.run.skill)throw new Error(`Classic Run snapshot skill mismatch: expected ${n.run.skill}, got ${o.definition.metadata.name}`);let a=await Pt(t,n),c=Ot(n.classic,a);if(n.run.currentStep!==c)throw new Error(`Classic Run step mismatch: expected ${c}, got ${n.run.currentStep}`);return{classic:n.classic,run:n.run,evidence:a,migrated:!1,snapshotDir:Q.join(t,".comet","skill-snapshots",n.run.skillHash)}}async function hf(t,e,n,i){let r=await me(t);if(!r.classic||!r.run)throw new Error("Classic transition requires synchronized Classic and Run projections");let s=await Pt(t,{classic:e,run:n,unknownKeys:r.unknownKeys}),o=Ot(e,s),a={...n,currentStep:o,iteration:n.iteration+1,status:o==="completed"?"completed":"running"};await xt(t,{classic:e,run:a,unknownKeys:r.unknownKeys});let c=await Nt(t,a.trajectoryRef);return await rt(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}or();import Ry from"path";var _y=Ry.join(".comet","state-events.jsonl"),xy=8*1024*1024;async function Yo(t,e){let n={schemaVersion:1,timestamp:new Date().toISOString(),...e};return await sr(t,_y,`${JSON.stringify(n)}
148
- `,xy,"Classic state event log"),n}var gf=["open-complete","design-complete","build-complete","verify-pass","verify-fail","archive-confirm","archive-reopen","archived","preset-escalate"],Py={"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"]}};function Oy(t){return t.toISOString().slice(0,10)}function x(t,e,n,i){let r=t[n];t[n]=i,r!==i&&e.push({field:n,from:r,to:i})}function wf(t,e,n={}){let i=Py[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")x(r,s,"phase",r.workflow==="full"?"design":"build");else if(e==="design-complete")x(r,s,"phase","build");else if(e==="build-complete"){let a=r.verifyResult==="fail";x(r,s,"phase","verify"),x(r,s,"verifyResult","pending"),x(r,s,"branchStatus","pending"),a||x(r,s,"verificationReport",null)}else if(e==="verify-pass")x(r,s,"verifyResult","pass"),x(r,s,"verifyFailures",0),x(r,s,"phase","archive"),x(r,s,"verifiedAt",Oy(o)),x(r,s,"archiveConfirmation","pending"),x(r,s,"branchStatus","pending");else if(e==="verify-fail")x(r,s,"verifyResult","fail"),x(r,s,"verifyFailures",r.verifyFailures+1),x(r,s,"phase","build"),x(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}'`);x(r,s,"workflow","full"),x(r,s,"classicProfile","full"),x(r,s,"phase","design"),x(r,s,"designDoc",null),x(r,s,"buildPause",null),x(r,s,"buildMode",null),x(r,s,"subagentDispatch",null),x(r,s,"tddMode",null),x(r,s,"reviewMode",null),x(r,s,"isolation",null),x(r,s,"boundBranch",null),x(r,s,"verifyMode",null),x(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`);x(r,s,"archiveConfirmation","confirmed")}else if(e==="archive-reopen"){if(r.archived)throw new Error(`Cannot apply ${e}: already archived`);x(r,s,"verifyResult","pending"),x(r,s,"verifyFailures",0),x(r,s,"phase","verify"),x(r,s,"verifiedAt",null),x(r,s,"archiveConfirmation",null),x(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`);x(r,s,"archived",!0)}return{classic:r,effects:s,definition:i}}xn();import vr from"path";function Ny(t){if(t!=="build"&&t!=="verify")throw new Error(`Invalid command check scope: '${String(t)}'`)}function Ay(t,e="."){if(e.trim().length===0)throw new Error("Command check cwd cannot be blank");let n=vr.resolve(t),i=vr.resolve(n,e);if(i!==n&&!i.startsWith(n+vr.sep))throw new Error(`Command check cwd must resolve within the project root: '${e}'`);return vr.relative(n,i).replaceAll("\\","/")||"."}async function yf(t,e,n,i){if(Ny(i.scope),typeof i.command!="string"||i.command.trim().length===0)throw new Error("Command check command cannot be blank");if(!Number.isInteger(i.exitCode))throw new Error("Command check exitCode must be an integer");let s={sequence:(await Nt(e,n.trajectoryRef)).reduce((o,a)=>Math.max(o,a.sequence),0)+1,timestamp:new Date().toISOString(),runId:n.runId,scope:i.scope,command:i.command,exitCode:i.exitCode,cwd:Ay(t,i.cwd)};return await rt(e,n.trajectoryRef,{sequence:s.sequence,timestamp:s.timestamp,type:"command_check_recorded",runId:s.runId,data:{scope:s.scope,command:s.command,exitCode:s.exitCode,cwd:s.cwd}}),s}jo();St();import Ty from"os";import br from"path";function Iy(t={}){let e=t.cwd??process.cwd(),n=t.homeDir??Ty.homedir(),i=[{file:br.resolve(e,".comet","config.yaml"),source:".comet/config.yaml",scope:"project"},{file:br.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 Vo(t,e={}){for(let n of Iy(e)){let i=br.dirname(br.dirname(n.file)),r=n.scope==="global"?(await Io(i))?.classic:(await kt(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}import ot from"node:path";async function vf(t,e){if(!e||e==="null")return{status:"missing",recordedPath:null};let n=await ee(t),i=ot.resolve(t,e),r=ot.relative(n.superpowersPlansDir,i);return ot.isAbsolute(e)||!r||r.startsWith(`..${ot.sep}`)||ot.isAbsolute(r)||r.includes(ot.sep)||ot.extname(r).toLowerCase()!==".md"?{status:"broken",recordedPath:e}:await kn(t,e,{label:`Classic build plan ${e}`,expected:"file"})?{status:"ready",recordedPath:e}:{status:"broken",recordedPath:e}}var qy="\x1B[32m",Ly="\x1B[31m",Dy="\x1B[33m",Xo="\x1B[0m",Ln=["full","hotfix","tweak"],Qo=["open","design","build","verify","archive"],kf=["en","zh-CN"],My=gf,Ho=new Set([...Fo,"archive_confirmation","verify_failures","classic_profile","classic_migration","bound_branch"]),Fy=new Set(_t.filter(t=>!Ho.has(t))),Wy={workflow:Ln,phase:Qo,context_compression:["off","beta"],build_mode:["subagent-driven-development","executing-plans","direct"],build_pause:["null","plan-ready"],subagent_dispatch:["null","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:Ln,classic_migration:["1"]},By=new Set(["design_doc","plan","verification_report","handoff_context"]),Ky={archived:"archived",branchStatus:"branch_status",classicProfile:"classic_profile",designDoc:"design_doc",language:"language",phase:"phase",verificationReport:"verification_report",verifiedAt:"verified_at",archiveConfirmation:"archive_confirmation",verifyResult:"verify_result",verifyFailures:"verify_failures",workflow:"workflow"},Dn=class extends Error{constructor(n,i=1){super(n);this.exitCode=i}exitCode},Sr=class{stdout=[];stderr=[];result(e=0){return{exitCode:e,...this.stdout.length>0?{stdout:this.stdout.join(`
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=Kr(e),r=Et(n);return r.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let n=Kr(e),r=Et(n);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,n){return this.type!=="comment"||this.indent<=n?!1:e.every(r=>r.type==="newline"||r.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())}}};Xl.Parser=hs});var nu=w(dn=>{"use strict";var Ql=ns(),ug=nn(),fn=sn(),fg=Zi(),dg=P(),pg=ms(),Zl=gs();function eu(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new pg.LineCounter||null,prettyErrors:e}}function mg(t,e={}){let{lineCounter:n,prettyErrors:r}=eu(e),i=new Zl.Parser(n?.addNewLine),o=new Ql.Composer(e),s=Array.from(o.compose(i.parse(t)));if(r&&n)for(let a of s)a.errors.forEach(fn.prettifyError(t,n)),a.warnings.forEach(fn.prettifyError(t,n));return s.length>0?s:Object.assign([],{empty:!0},o.streamInfo())}function tu(t,e={}){let{lineCounter:n,prettyErrors:r}=eu(e),i=new Zl.Parser(n?.addNewLine),o=new Ql.Composer(e),s=null;for(let a of o.compose(i.parse(t),!0,t.length))if(!s)s=a;else if(s.options.logLevel!=="silent"){s.errors.push(new fn.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return r&&n&&(s.errors.forEach(fn.prettifyError(t,n)),s.warnings.forEach(fn.prettifyError(t,n))),s}function hg(t,e,n){let r;typeof e=="function"?r=e:n===void 0&&e&&typeof e=="object"&&(n=e);let i=tu(t,n);if(!i)return null;if(i.warnings.forEach(o=>fg.warn(i.options.logLevel,o)),i.errors.length>0){if(i.options.logLevel!=="silent")throw i.errors[0];i.errors=[]}return i.toJS(Object.assign({reviver:r},n))}function gg(t,e,n){let r=null;if(typeof e=="function"||Array.isArray(e)?r=e:n===void 0&&e&&(n=e),typeof n=="string"&&(n=n.length),typeof n=="number"){let i=Math.round(n);n=i<1?void 0:i>8?{indent:8}:{indent:i}}if(t===void 0){let{keepUndefined:i}=n??e??{};if(!i)return}return dg.isDocument(t)&&!r?t.toString(n):new ug.Document(t,r,n).toString(n)}dn.parse=hg;dn.parseAllDocuments=mg;dn.parseDocument=tu;dn.stringify=gg});var Me=w(N=>{"use strict";var wg=ns(),yg=nn(),vg=Lo(),ws=sn(),bg=Mt(),We=P(),kg=Ie(),Sg=$(),Cg=Le(),Eg=qe(),Rg=Fr(),_g=ds(),xg=ms(),Pg=gs(),Yr=nu(),ru=Lt();N.Composer=wg.Composer;N.Document=yg.Document;N.Schema=vg.Schema;N.YAMLError=ws.YAMLError;N.YAMLParseError=ws.YAMLParseError;N.YAMLWarning=ws.YAMLWarning;N.Alias=bg.Alias;N.isAlias=We.isAlias;N.isCollection=We.isCollection;N.isDocument=We.isDocument;N.isMap=We.isMap;N.isNode=We.isNode;N.isPair=We.isPair;N.isScalar=We.isScalar;N.isSeq=We.isSeq;N.Pair=kg.Pair;N.Scalar=Sg.Scalar;N.YAMLMap=Cg.YAMLMap;N.YAMLSeq=Eg.YAMLSeq;N.CST=Rg;N.Lexer=_g.Lexer;N.LineCounter=xg.LineCounter;N.Parser=Pg.Parser;N.parse=Yr.parse;N.parseAllDocuments=Yr.parseAllDocuments;N.parseDocument=Yr.parseDocument;N.stringify=Yr.stringify;N.visit=ru.visit;N.visitAsync=ru.visitAsync});function Fe(t){return t!==0&&t!==0n&&t!=="0"}function Gr(t,e){return Fe(t.dev)&&Fe(e.dev)&&Fe(t.ino)&&Fe(e.ino)}function be(t,e){let n=Fe(t.dev)&&Fe(e.dev);if(n&&t.dev!==e.dev)return!1;let r=Fe(t.ino)&&Fe(e.ino);return r&&t.ino!==e.ino?!1:n&&r?!0:t.birthtime===e.birthtime}var Vr=W(()=>{"use strict"});import{constants as Hr,promises as ot}from"fs";function ys(t){return"birthtimeNs"in t&&typeof t.birthtimeNs=="bigint"?t.birthtimeNs:t.birthtimeMs}function iu(t){return"ctimeNs"in t&&typeof t.ctimeNs=="bigint"?t.ctimeNs:t.ctimeMs}function pn(t){return{dev:t.dev,ino:t.ino,birthtime:ys(t)}}function Jr(t,e){let n=pn(t),r=pn(e);return Gr(n,r)?be(n,r):be(n,r)&&ys(t)===ys(e)&&iu(t)===iu(e)&&t.size===e.size}async function zr(t,e,n={}){if(!Number.isSafeInteger(e)||e<1)throw new Error("race-safe read byte limit must be a positive integer");let r=n.label??"file",i=n.bigint===!0,o=await ot.lstat(t,{bigint:i});if(!o.isFile()||o.isSymbolicLink())throw new Be("not-regular-file",`${r} must be a regular file`);if(BigInt(o.size)>BigInt(e))throw new Be("too-large",`${r} exceeds ${e} bytes`);let s=await ot.realpath(t);await n.verify?.("pre-open",{realPath:s,identity:pn(o)});let a=process.platform==="win32"?Hr.O_RDONLY:Hr.O_RDONLY|Hr.O_NOFOLLOW|Hr.O_NONBLOCK,c;try{c=await ot.open(t,a)}catch(l){throw l.code==="ELOOP"?new Be("not-regular-file",`${r} must be a regular file`,{cause:l}):l}try{let[l,f,u]=await Promise.all([c.stat({bigint:i}),ot.lstat(t,{bigint:i}),ot.realpath(t)]);if(!l.isFile()||!f.isFile()||f.isSymbolicLink()||u!==s||!Jr(o,l)||!Jr(o,f))throw new Be("changed",`${r} changed while opening`);await n.verify?.("post-open",{realPath:u,identity:pn(l)}),await n.hooks?.afterOpen?.();let d=[],m=0,g=Buffer.allocUnsafe(Math.min(64*1024,e+1));for(;;){let y=e+1-m,{bytesRead:S}=await c.read(g,0,Math.min(g.length,y),null);if(S===0)break;if(m+=S,m>e)throw new Be("too-large",`${r} exceeds ${e} bytes`);d.push(Buffer.from(g.subarray(0,S)))}await n.hooks?.beforeFinalCheck?.();let[p,h,v]=await Promise.all([c.stat({bigint:i}),ot.lstat(t,{bigint:i}),ot.realpath(t)]);if(!h.isFile()||h.isSymbolicLink()||v!==s||!Jr(o,p)||!Jr(o,h))throw new Be("changed",`${r} changed while reading`);return await n.verify?.("post-read",{realPath:v,identity:pn(p)}),{bytes:Buffer.concat(d,m),stat:p,realPath:v}}finally{await c.close()}}var Be,vs=W(()=>{"use strict";Vr();Be=class extends Error{reason;constructor(e,n,r){super(n,r),this.name="RaceSafeReadError",this.reason=e}}});function fu(t,e){let n=t;for(let r of e)n+="\0"+(typeof r=="string"?r:JSON.stringify(r));return n}function Qr(t,e){return(...n)=>{let r=uu;if(r===null)return e(...n);let i=fu(`async:${t}`,n),o=r.entries.get(i);if(o)return o.value;let s=e(...n).catch(a=>{throw r.entries.delete(i),a});return r.entries.set(i,{value:s}),s}}function Ss(t,e){return(...n)=>{let r=uu;if(r===null)return e(...n);let i=fu(`sync:${t}`,n),o=r.entries.get(i);if(o)return o.value;let s=e(...n);return r.entries.set(i,{value:s}),s}}var uu,Zr=W(()=>{"use strict";uu=null});import ti from"path";function Fg(t,e){if(typeof t!="string")throw new Error(`${e} must be a string`);let n=t.trim();if(n.length===0||ti.posix.isAbsolute(n)||ti.win32.isAbsolute(n)||/^(?:~|[\\/])/u.test(n))throw new Error(`${e} must be a project-relative path`);if(n===".")return[];let r=n.replaceAll("\\","/").split("/");if(r.some(i=>i===".."))throw new Error(`${e} must stay inside the project root`);if(r.some(i=>i===""||i==="."))throw new Error(`${e} must not contain empty or dot path segments`);return r}function bn(t){let e=Fg(t,"native.artifact_root");return e.length===0?".":e.join("/")}function yu(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 ke(t,e,n=!1){if(typeof t!="string")throw new Error(`${e} must be a string`);let r=t.trim().replaceAll("\\","/");if(r.length===0||ti.posix.isAbsolute(r)||ti.win32.isAbsolute(r)||/^(?:~|[\\/])/u.test(r))throw new Error(`${e} must be relative to its declared path base`);let i=r.split("/");if(i.some(o=>o===".."))throw new Error(`${e} must stay inside its declared path base`);if(i.some(o=>o===""||o==="."))throw new Error(`${e} must not contain empty or dot path segments`);if(!n&&/[*?]/u.test(r))throw new Error(`${e} cannot contain wildcards`);return i.join("/")}function Rt(t,e){if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`${e} must be a mapping`);return t}function vu(t,e,n){let r=t??e;if(r!=="en"&&r!=="zh-CN")throw new Error(`${n} must be en or zh-CN`);return r}function bu(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>Os)throw new Error(`${e} exceeds ${Os} characters`);let n=0;for(let r=0;r<t.length;r+=1)t[r]==="?"?n+=1:t[r]==="*"&&(n+=1,t[r+1]==="*"&&(r+=1));if(n>As)throw new Error(`${e} contains more than ${As} wildcard tokens`);return t}function gu(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(r=>bu(r,e)))].sort((r,i)=>r.localeCompare(i,"en"))}function Ps(t,e,n){let r=t??e;if(!Number.isSafeInteger(r)||r<1)throw new Error(`${n} must be a positive integer`);return r}function Bg(t){if(t===void 0)return{...re,include:[...re.include],exclude:[...re.exclude]};let e=Rt(t,"native.snapshot");return{include:gu(e.include,"native.snapshot.include",re.include),exclude:gu(e.exclude,"native.snapshot.exclude",re.exclude),max_files:Ps(e.max_files,re.max_files,"native.snapshot.max_files"),max_total_bytes:Ps(e.max_total_bytes,re.max_total_bytes,"native.snapshot.max_total_bytes"),max_duration_ms:Ps(e.max_duration_ms,re.max_duration_ms,"native.snapshot.max_duration_ms")}}function Kg(t){if(t===void 0)return;let e=Rt(t,"native.pending_root_move"),n=e.id,r=e.from_artifact_root,i=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 r!="string"||typeof i!="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=Rt(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:bn(r),toArtifactRoot:bn(i),stage:o,...s?{cleanup:s}:{}}}function Ug(t,e={}){let n=Rt(t,"native"),r=n.artifact_root??(e.allowMissingArtifactRoot?"docs":void 0);if(typeof r!="string")throw new Error("native.artifact_root must be a string");let i=n.clarification_mode??"batch";if(i!=="sequential"&&i!=="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??wu;if(!Number.isSafeInteger(s)||s<1)throw new Error("native.max_verify_failures must be a positive integer");let a=Kg(n.pending_root_move);return{artifact_root:bn(r),language:vu(n.language,"en","native.language"),clarification_mode:i,archive_confirmation:o,max_verify_failures:s,snapshot:Bg(n.snapshot),...a?{pending_root_move:a}:{}}}function Yg(t){let e=Rt(t,"classic"),n=e.context_compression??"off";if(n!=="off"&&n!=="beta")throw new Error("classic.context_compression must be off or beta");let r=e.review_mode??"standard";if(r!=="off"&&r!=="standard"&&r!=="thorough")throw new Error("classic.review_mode must be off, standard, or thorough");let i=e.auto_transition??!0;if(typeof i!="boolean")throw new Error("classic.auto_transition must be true or false");return{artifact_layout:yu(e.artifact_layout),language:vu(e.language,"zh-CN","classic.language"),context_compression:n,review_mode:r,auto_transition:i}}function Gg(t){let n=Rt(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((r,i)=>ke(r,`hook.allow_paths[${i}]`)))]}}function Vg(t){let e=t??!0;if(typeof e!="boolean")throw new Error("ambient_resume must be true or false");return e}function Hg(t,e,n,r,i,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:i,...e?{hook:e}:{},...n?{native:n}:{},...r?{classic:r}:{}}}function Ke(t,e={}){let n=(0,Ns.parseDocument)(t,{uniqueKeys:!0});if(n.errors.length>0)throw new Error(`Invalid .comet/config.yaml: ${n.errors[0].message}`);let r=n.toJS();if(r==null)return{value:{},config:null,ambient_resume:!0};if(typeof r!="object"||Array.isArray(r))throw new Error("Invalid .comet/config.yaml: root must be a mapping");let i=r,o=Vg(i.ambient_resume),s=i.hook===void 0?void 0:Gg(i.hook),a=i.native===void 0?void 0:Ug(i.native,{allowMissingArtifactRoot:e.allowMissingNativeFields}),c=i.classic===void 0?void 0:Yg(i.classic),l=Hg(i,s,a,c,o,{allowPartialProject:e.allowPartialProject??!1});return{value:i,config:l,ambient_resume:o,...s?{hook:s}:{},...a?{native:a}:{},...c?{classic:c}:{}}}function js(t="docs",e="en"){return{schema:"comet.project.v1",default_workflow:"native",ambient_resume:!0,native:{artifact_root:bn(t),language:e,clarification_mode:"batch",archive_confirmation:"automatic",max_verify_failures:wu,snapshot:{...re,include:[...re.include],exclude:[...re.exclude]}}}}var Ns,_t,Os,As,wu,Dg,Wg,Mg,re,Se=W(()=>{"use strict";Ns=Qe(Me(),1),_t=64*1024,Os=1024,As=64,wu=5,Dg=[".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/**"],Wg=["**/.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"],Mg=[...Dg,...Wg].sort((t,e)=>t.localeCompare(e,"en")),re={include:["**/*"],exclude:[...Mg],max_files:1e4,max_total_bytes:256*1024*1024,max_duration_ms:6e4}});import{promises as Ue}from"fs";import le from"path";function ku(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}function ni(t,e){let n=le.relative(t,e);return n===""||!le.isAbsolute(n)&&n!==".."&&!n.startsWith(`..${le.sep}`)}async function Ts(t,e){let n=le.resolve(t),r=await Ue.lstat(n);if(!r.isDirectory()||r.isSymbolicLink())throw new Error(`${e} project root must be a real directory`);return Ue.realpath(n)}async function Is(t,e,n,r){let i=t;for(let o=0;o<n.length;o++){i=le.join(i,n[o]);let s;try{s=await Ue.lstat(i)}catch(f){if(ku(f))return{exists:!1,kind:"missing"};throw f}let a=le.relative(t,i).replaceAll("\\","/");if(s.isSymbolicLink())throw new Error(`${r.label} crosses a symbolic link or junction at ${a}`);let c=o===n.length-1;if(!c&&!s.isDirectory())throw new Error(`${r.label} ancestor ${a} must be a real directory`);if(c&&(r.expected==="file"&&!s.isFile()||r.expected==="directory"&&!s.isDirectory()||r.expected==="any"&&!s.isFile()&&!s.isDirectory()))throw new Error(`${r.label} must be a real ${r.expected}`);let l=await Ue.realpath(i);if(!ni(e,l))throw new Error(`${r.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 T(t,e,n){let r=ke(e,n.label),i=le.resolve(t),o=await Ts(i,n.label),s=r.split("/"),a=le.resolve(i,...s);if(!ni(i,a))throw new Error(`${n.label} must stay inside the project root`);let c=await Is(i,o,s,n);return{projectRoot:i,target:a,relative:r,exists:c.exists,kind:c.kind}}async function $s(t,e,n){let r=ke(e,n.label),i=le.resolve(t),o=await Ts(i,n.label),s=r.split("/"),a=i;for(let c of s){a=le.join(a,c);let l;try{l=await Ue.lstat(a)}catch(d){if(!ku(d))throw d;try{await Ue.mkdir(a)}catch(m){if(m.code!=="EEXIST")throw m}l=await Ue.lstat(a)}let f=le.relative(i,a).replaceAll("\\","/");if(l.isSymbolicLink())throw new Error(`${n.label} crosses a symbolic link or junction at ${f}`);if(!l.isDirectory())throw new Error(`${n.label} directory ${f} must be a real directory`);let u=await Ue.realpath(a);if(!ni(o,u))throw new Error(`${n.label} resolves outside the project root`)}return await Is(i,o,s,{label:n.label,expected:"directory"}),a}async function ri(t,e,n){return(await T(t,e,{...n,expected:"file"})).exists}async function F(t,e,n,r){let i=await T(t,e,{label:r.label,expected:"file"});if(!i.exists){let s=new Error(`${r.label} does not exist`);throw s.code="ENOENT",s}let o=await Ts(i.projectRoot,r.label);return zr(i.target,n,{...r,verify:async(s,a)=>{if(!ni(o,a.realPath))throw new Error(`${r.label} resolves outside the project root`);await Is(i.projectRoot,o,i.relative.split("/"),{label:r.label,expected:"file"})}})}var ie=W(()=>{"use strict";vs();Se()});import{createHash as Jg}from"crypto";function zg(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}async function st(t,e={}){return(await ii(t,e)).document}async function Xg(t){try{return(await F(t,kn,_t,{label:kn})).bytes}catch(e){if(zg(e))return null;throw e}}function Qg(t){return t?{exists:!0,sha256:Jg("sha256").update(t).digest("hex")}:{exists:!1,sha256:null}}async function ii(t,e={}){let n=await Xg(t);return{document:n?Ke(n.toString("utf8"),e):null,identity:Qg(n)}}async function Ls(t){return(await st(t))?.config??null}var kn,at=W(()=>{"use strict";Se();ie();kn=".comet/config.yaml"});import{randomUUID as Zg}from"crypto";import{constants as ew,promises as L}from"fs";import K from"path";async function qs(t,e){try{return await L.link(t,e),{linked:!0}}catch(n){let r=n.code;if(r!=="ENOTSUP"&&r!=="EOPNOTSUPP")throw n}return await L.copyFile(t,e,ew.COPYFILE_EXCL),{linked:!1}}function xt(t,e){let n=K.relative(t,e);return n===""||!K.isAbsolute(n)&&n!==".."&&!n.startsWith(`..${K.sep}`)}function si(t){return{dev:t.dev,ino:t.ino,birthtime:t.birthtimeMs}}function tw(t,e){return be(t,si(e))}function oi(t,e){let n=si(t),r=si(e);return Gr(n,r)?be(n,r):be(n,r)&&t.birthtimeMs===e.birthtimeMs&&t.ctimeMs===e.ctimeMs&&t.size===e.size}async function ai(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),...si(e)}}async function Ye(t){for(let e of t){let n=await L.lstat(e.path);if(!n.isDirectory()||n.isSymbolicLink()||!tw(e,n)||await L.realpath(e.path)!==e.realPath)throw new Error(`Contained atomic write parent changed before commit: ${e.path}`)}}async function nw(t,e){let n=K.resolve(t),r=K.resolve(e);if(!xt(n,r))throw new Error(`Contained atomic write parent is outside its managed root: ${e}`);let i=[await ai(n)],o=K.relative(n,r).split(K.sep).filter(Boolean),s=n;for(let a of o){await Ye(i),s=K.join(s,a);try{await L.mkdir(s)}catch(l){if(l.code!=="EEXIST")throw l}let c=await ai(s);if(!xt(i[0].realPath,c.realPath))throw new Error(`Contained atomic write parent resolves outside its managed root: ${s}`);i.push(c)}return await Ye(i),i}async function rw(t,e){let n=K.resolve(t),r=K.resolve(e);if(!xt(n,r))throw new Error(`Contained file parent is outside its managed root: ${e}`);let i=[await ai(n)],o=K.relative(n,r).split(K.sep).filter(Boolean),s=n;for(let a of o){s=K.join(s,a);try{let c=await ai(s);if(!xt(i[0].realPath,c.realPath))throw new Error(`Contained file parent resolves outside its managed root: ${s}`);i.push(c)}catch(c){if(c.code==="ENOENT")return null;throw c}}return await Ye(i),i}async function Su(t){let e;try{e=await L.open(t,"r"),await e.sync()}catch(n){let r=n.code;if(!["EACCES","EBADF","EINVAL","EISDIR","ENOTSUP","EPERM"].includes(r??""))throw n}finally{await e?.close()}}async function iw(t,e,n){let r=K.dirname(t),i=await nw(n.containedRoot,r),o=K.join(r,`.${K.basename(t)}.${Zg()}.tmp`),s,a;try{await n.beforeTemporaryOpen?.(),s=await L.open(o,"wx"),a=await s.stat();let[c,l]=await Promise.all([L.lstat(o),L.realpath(o)]);if(await Ye(i),!c.isFile()||c.isSymbolicLink()||!oi(a,c)||!xt(i[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(),!oi(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 Ye(i);let f=await L.lstat(o);if(!f.isFile()||f.isSymbolicLink()||!oi(f,a))throw new Error("Contained atomic write temporary file changed before commit");n.exclusive?(await qs(o,t),await L.unlink(o)):await L.rename(o,t),await Su(r)}catch(c){await s?.close();try{await Ye(i),await L.rm(o,{force:!0})}catch{}throw c}}async function oe(t,e,n){await iw(t,e,n)}async function Ds(t,e){let n=K.dirname(t),r=await rw(e.containedRoot,n);if(!r)return!1;let i,o;try{i=await L.lstat(t),o=await L.realpath(t)}catch(c){if(c.code==="ENOENT")return!1;throw c}if(!i.isFile()||i.isSymbolicLink()||!xt(r[0].realPath,o))throw new Error("Contained file removal target must be a regular file inside its managed root");await e.beforeRemove?.(),await Ye(r);let[s,a]=await Promise.all([L.lstat(t),L.realpath(t)]);if(!s.isFile()||s.isSymbolicLink()||!oi(i,s)||a!==o)throw new Error("Contained file removal target changed before removal");return await L.unlink(t),await Ye(r),await Su(n),!0}var Ge=W(()=>{"use strict";Vr()});var iS,Ws=W(()=>{"use strict";Ge();at();ie();iS=16*1024});var Fs=W(()=>{"use strict";Ge();Se();at();ie();Ws()});var fi=W(()=>{"use strict"});var Iu=W(()=>{"use strict"});var Us=W(()=>{"use strict";fi()});var $u=W(()=>{"use strict";fi();Us()});function Ew(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}function Rw(t){let e=(0,Lu.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 Du(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,...r})=>r)(t.native):void 0;return{...t,schema:"comet.global.v1",...e?{native:e}:{}}}function _w(t){let e=Ke(JSON.stringify({...t,schema:"comet.project.v1"})).config;if(!e)throw new Error("Invalid global Comet config: workflow template is incomplete");return Du(e)}function xw(t){let e=Ke(t,{allowPartialProject:!0,allowMissingNativeFields:!0});if(!e.native&&!e.classic)return null;let n=e.native?"native":"classic",r=e.native?.language??e.classic?.language??"en",i=js(e.native?.artifact_root??"docs",r);return{schema:"comet.global.v1",default_workflow:n,workflows:[n],ambient_resume:e.ambient_resume,...e.native?{native:{...i.native,...e.native}}:{},...e.classic?{classic:e.classic}:{}}}function Wu(t){let e=Rw(t);if(Object.keys(e).length===0)return null;if(e.schema===void 0)return xw(t);if(e.schema!=="comet.global.v1")throw new Error("Unsupported Comet global schema");return _w(e)}async function Ys(t){try{let e=await F(t,qu,_t,{label:"global Comet config"});return Wu(e.bytes.toString("utf8"))}catch(e){if(Ew(e))return null;throw e}}var Lu,qu,Gs=W(()=>{"use strict";Lu=Qe(Me(),1);Ge();Se();ie();qu=".comet/config.yaml"});var US,Mu=W(()=>{"use strict";Ge();ie();US=4*1024*1024});var HS,Fu=W(()=>{"use strict";Zr();at();HS=Qr("hookWritePolicy",async t=>(await Ls(t))?.hook??{allow_paths:[]})});var Bu=W(()=>{"use strict";fi();Ge();Iu();$u();Se();Gs();ie();at();Fs();Mu();Fu();Ws();Us()});import{TextDecoder as Pw}from"util";function Ku(t){return{dev:t.dev,ino:t.ino,birthtime:t.birthtimeMs}}function Ow(t,e){try{return new Pw("utf-8",{fatal:!0}).decode(t.bytes)}catch(n){throw new Error(`${e} is not valid UTF-8`,{cause:n})}}async function Vs(t,e,n,r,i={}){try{let o=await F(t,e,n,{label:r,hooks:i.hooks});return{result:o,text:Ow(o,r)}}catch(o){let s=o.code;if(s==="ENOENT"||s==="ENOTDIR")return null;throw o}}async function xn(t,e,n,r,i={}){return(await Vs(t,e,n,r,i))?.text??null}async function di(t,e,n,r,i,o={}){if(Buffer.byteLength(n,"utf8")>r)throw new Error(`${i} exceeds ${r} bytes`);let s=await Vs(t,e,r,i),a=await T(t,e,{label:i,expected:"file"});await oe(a.target,n,{containedRoot:a.projectRoot,beforeCommit:async()=>{await o.beforeCommit?.();let c=await Vs(t,e,r,i);if(!(!s&&!c)){if(!s||!c)throw new Error(`${i} changed before commit`);if(s.result.realPath!==c.result.realPath||!be(Ku(s.result.stat),Ku(c.result.stat))||s.text!==c.text)throw new Error(`${i} changed before commit`)}}})}async function pi(t,e,n,r,i,o={}){let s=await xn(t,e,r,i);await di(t,e,`${s??""}${n}`,r,i,o)}async function Hs(t,e,n,r={}){let i=await T(t,e,{label:n,expected:"file"});return i.exists?Ds(i.target,{containedRoot:i.projectRoot,beforeRemove:r.beforeRemove}):!1}var mi=W(()=>{"use strict";Bu();Vr()});var Gu={};ed(Gu,{RUN_STATE_FILE:()=>gi,applyRunStateToDocument:()=>Js,readRunState:()=>An,removeRunState:()=>zs,runStateFromDocument:()=>hi,writeRunState:()=>wi});import Aw from"path";function On(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 Pn(t,e){let n=On(t,e);if(Aw.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 Nw(t){let e=t.run_retries??"{}",n;try{n=typeof e=="string"?JSON.parse(e):e}catch(r){throw new Error("Invalid Run state: run_retries must be a JSON object",{cause:r})}if(!n||typeof n!="object"||Array.isArray(n))throw new Error("Invalid Run state: run_retries must be a JSON object");for(let r of Object.values(n))if(!Number.isInteger(r)||Number(r)<0)throw new Error("Invalid Run state: retry counts must be non-negative integers");return n}function hi(t){if(!t.run_id)return null;let e=On(t,"run_id"),n=On(t,"skill"),r=On(t,"skill_version"),i=On(t,"skill_hash"),o=Pn(t,"pending_ref"),s=Pn(t,"trajectory_ref"),a=Pn(t,"context_ref"),c=Pn(t,"artifacts_ref"),l=Pn(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:r,skillHash:i,orchestration:t.orchestration,currentStep:Uu(t,"current_step"),iteration:f,pending:Uu(t,"pending"),pendingRef:o,trajectoryRef:s,contextRef:a,artifactsRef:c,checkpointRef:l,status:t.run_status,retries:Nw(t)}}function Js(t,e){e?t.run_id=e.runId:delete t.run_id}function jw(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 Tw(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 hi(e)}async function An(t,e={}){let n=await xn(t,gi,Yu,"Run state",e);if(n===null)return null;let r=JSON.parse(n);return Tw(r)}async function wi(t,e,n={}){await di(t,gi,JSON.stringify(jw(e),null,2),Yu,"Run state",n)}async function zs(t,e={}){await Hs(t,gi,"Run state",e)}var Uu,gi,Yu,Nn=W(()=>{"use strict";mi();Uu=(t,e)=>{let n=t[e];return n==null?null:String(n)};gi=".comet/run-state.json",Yu=256*1024});var Gn=Qe(Me(),1);import{spawnSync as dv}from"child_process";import{promises as pv}from"fs";import O from"path";vs();import{randomUUID as Og}from"crypto";import{promises as mn}from"fs";import su from"path";var bs="comet.selection.v2",Ag=16*1024;function Xr(t){return su.join(t,".comet","current-change.json")}function Ng(t){return!!t&&typeof t=="object"&&!Array.isArray(t)}function ou(t){return t===null||typeof t=="string"}function au(t){let e;try{e=JSON.parse(t)}catch(n){throw new Error(`current change selection contains invalid JSON: ${n instanceof Error?n.message:String(n)}`,{cause:n})}if(!Ng(e))throw new Error("current change selection must be a JSON object");if(e.version===1){if(typeof e.change!="string")throw new Error("legacy current change selection change must be a string");if(e.branch!==void 0&&!ou(e.branch))throw new Error("legacy current change selection branch must be a string or null");return{selection:{schema:bs,workflow:"classic",change:e.change,branch:e.branch??null},legacy:!0}}if(e.schema!==bs)throw new Error(`current change selection schema must be ${bs}`);if(e.workflow!=="native"&&e.workflow!=="classic")throw new Error("current change selection workflow must be native or classic");if(typeof e.change!="string")throw new Error("current change selection change must be a string");if(!ou(e.branch))throw new Error("current change selection branch must be a string or null");if(e.workflow==="native"&&e.branch!==null)throw new Error("Native current change selection branch must be null");return{selection:e,legacy:!1}}async function ks(t){let e;try{let r=Xr(t),{bytes:i}=await zr(r,Ag,{label:"current change selection"});e=i.toString("utf8")}catch(r){if(r.code==="ENOENT")return{status:"missing"};throw new Error(`cannot read current change selection: ${r instanceof Error?r.message:String(r)}`,{cause:r})}return{status:"selected",...au(e)}}async function cu(t,e){let n=au(JSON.stringify(e));if(n.legacy)throw new Error("cannot write a legacy current change selection");let r=Xr(t),i=`${r}.${Og()}.tmp`;await mn.mkdir(su.dirname(r),{recursive:!0});try{await mn.writeFile(i,`${JSON.stringify(n.selection,null,2)}
143
+ `,"utf8"),await mn.rename(i,r)}catch(o){throw await mn.rm(i,{force:!0}),o}}async function lu(t){await mn.rm(Xr(t),{force:!0})}Zr();var Cs=Qe(Me(),1);Zr();import{execFileSync as du}from"child_process";import{randomUUID as jg}from"crypto";import{promises as hn}from"fs";import pu from"path";function gn(t){try{let e=du("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 Tg=Ss("liveGitBranch",t=>gn(t));function Es(t){try{return du("git",["rev-parse","--is-inside-work-tree"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()==="true"}catch{return!1}}var Ig=Ss("isGitWorkTree",t=>Es(t)),$g=["current","branch","worktree"];function ei(t){return $g.includes(t)}function Rs(t){return ei(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 wn(t,e){let n=pu.join(t,".comet.yaml"),r=(0,Cs.parseDocument)(await hn.readFile(n,"utf8"),{uniqueKeys:!1});if(r.errors.length>0)throw new Error(`Invalid .comet.yaml: ${r.errors[0].message}`);let i=r.toJS()??{},o=typeof i.isolation=="string"?i.isolation:null,s=typeof i.bound_branch=="string"&&i.bound_branch!==""?i.bound_branch:null,a=ei(o),c=Tg(e.cwd),l=a&&s===null&&c===null?Ig(e.cwd):!0,f=Rs({isolation:o,boundBranch:s,currentBranch:c,gitWorkTree:l});return f.status==="needs-heal"&&e.heal?(await _s(t,f.branch),{status:"healed",branch:f.branch,bindingRequired:a,currentBranch:c}):{...f,bindingRequired:a,currentBranch:c}}async function _s(t,e){let n=pu.join(t,".comet.yaml"),r=(0,Cs.parseDocument)(await hn.readFile(n,"utf8"),{uniqueKeys:!1});r.set("bound_branch",e);let i=`${n}.${jg()}.tmp`;try{await hn.writeFile(i,r.toString(),"utf8"),await hn.rename(i,n)}catch(o){throw await hn.rm(i,{force:!0}),o}}function mu(t){return t??"detached HEAD"}function hu(t,e,n){return`change '${t}' is bound to branch '${e}', but current branch is '${mu(n)}'.
144
+ Next: ask the user to confirm — switch back to '${e}', or run \`comet state rebind ${t}\` after explicit confirmation.`}function xs(t,e,n){return`change '${t}' is bound to branch '${e}', but current branch is '${mu(n)}'`}function yn(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.`}import{promises as hw}from"fs";import Pt from"path";import{promises as _u}from"fs";import I from"path";import{promises as Lg}from"fs";async function vn(t){try{return await Lg.access(t),!0}catch(e){if(qg(e))return!1;throw e}}function qg(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}Se();at();Fs();ie();var ct=class extends Error{code="classic-layout-unavailable";constructor(e="Classic artifact layout is unavailable from .comet/config.yaml"){super(e),this.name="ClassicLayoutUnavailableError"}},Ru=".comet/config.yaml";function xu(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}async function Pu(t){await T(t,Ru,{label:Ru,expected:"file"})}function ci(t,e){let n=I.resolve(t),r=e==="docs"?I.join(n,"docs"):n,i=I.join(r,"openspec"),o=I.join(n,"docs","superpowers");return{projectRoot:n,artifactLayout:e,openSpecBase:r,openSpecRoot:i,changesDir:I.join(i,"changes"),archiveDir:I.join(i,"changes","archive"),specsDir:I.join(i,"specs"),superpowersRoot:o,superpowersSpecsDir:I.join(o,"specs"),superpowersPlansDir:I.join(o,"plans"),superpowersReportsDir:I.join(o,"reports")}}async function lw(t){await Pu(t);let e=await st(t,{allowPartialProject:!0,allowMissingNativeFields:!0});if(!e?.config)throw new ct;if(!(e.config.workflows??[e.config.default_workflow]).includes("classic"))throw new ct("Classic artifact layout is unavailable because Classic is not enabled");return e.classic?.artifact_layout??"legacy"}async function uw(t,e){return ci(t,e??await lw(t))}async function fw(t){try{return await _u.lstat(t),!0}catch(e){if(xu(e))return!1;throw e}}async function dw(t,e){let n=await uw(t,e),r=n.artifactLayout==="legacy"?"docs":"legacy",i=ci(t,r).openSpecRoot,[o,s]=await Promise.all([T(n.projectRoot,Z(n.projectRoot,n.openSpecRoot),{label:"Configured Classic OpenSpec root",expected:"directory"}),fw(i)]),a=o.exists;return{paths:n,configuredRootExists:a,alternateRoot:i,alternateRootExists:s,dualRoots:a&&s}}async function pw(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 r=Z(t.projectRoot,n);await T(t.projectRoot,r,{label:`Classic managed physical path ${r}`,expected:"directory"})}}async function ee(t,e){let n=await dw(t,e);if(await pw(n.paths),!n.configuredRootExists){let r=Z(n.paths.projectRoot,n.paths.openSpecRoot),i=Z(n.paths.projectRoot,n.alternateRoot);throw new ct(`Configured Classic OpenSpec root is missing: ${r} (alternate ${i} is ${n.alternateRootExists?"present":"missing"})`)}return n.paths}async function li(t,e){let n=I.join(I.resolve(t),".comet","classic-root-move.json");if(await vn(n))throw new Error("Classic root move transaction is incomplete; inspect it with comet doctor and recover it explicitly before writing");let r=await ee(t,e);if(!await vn(r.openSpecRoot))throw new Error(`Configured Classic OpenSpec root is missing: ${Z(r.projectRoot,r.openSpecRoot)}`);return r}async function Sn(t){let e=I.resolve(t),n=null;try{(await _u.lstat(e)).isDirectory()||(e=I.dirname(e))}catch(r){if(!xu(r))throw r}for(;;){I.basename(e)==="openspec"&&(n=I.dirname(e));let r=I.join(e,".comet","config.yaml"),i=!1;if(await vn(r))try{await Pu(e);let s=(await st(e))?.value;i=!!s&&typeof s=="object"&&!Array.isArray(s)&&(s.schema==="comet.project.v1"||s.default_workflow!==void 0||s.native!==void 0)}catch{}if(i||await vn(I.join(e,".git")))return e;let o=I.dirname(e);if(o===e)return n??I.resolve(t);e=o}}function Z(t,e){return I.relative(I.resolve(t),e).replaceAll("\\","/")}Ge();Se();ie();import Cn from"path";var mw=2*1024*1024;function ui(t,e,n){let r=Cn.resolve(t),i=Cn.isAbsolute(e)?Cn.resolve(e):Cn.resolve(r,e),o=Cn.relative(r,i).replaceAll("\\","/");return{root:r,relative:ke(o,n),target:i}}async function Ve(t,e,n){let r=ui(t,e,n.label);return T(r.root,r.relative,n)}async function En(t,e,n){return(await Ve(t,e,{label:n.label,expected:n.expected??"any"})).exists}async function Ou(t,e,n,r){return await En(t,e,{label:n,expected:"file"})?(await Au(t,e,{label:n,hooks:r})).byteLength>0:!1}async function He(t,e,n){return(await Au(t,e,n)).toString("utf8")}async function Au(t,e,n){let r=ui(t,e,n.label);return(await F(r.root,r.relative,n.maxBytes??mw,{label:n.label,hooks:n.hooks})).bytes}async function Nu(t,e,n){let r=ui(t,e,n);return $s(r.root,r.relative,{label:n})}async function ju(t,e,n,r){let i=ui(t,e,r.label);await T(i.root,i.relative,{label:r.label,expected:"file"}),await oe(i.target,n,{containedRoot:i.root,beforeTemporaryOpen:r.beforeTemporaryOpen,beforeCommit:r.beforeCommit,exclusive:r.exclusive})}function Bs(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}'
145
+ Valid format: lowercase kebab-case (a-z, 0-9, single hyphens)`:"Change name cannot be empty"}function Ce(t){let e=Bs(t);if(e)throw new Error(e)}function gw(t,e){return{label:Z(t,e),directory:e}}async function Rn(t,e,n){let r=gw(t,e);if(!(await Ve(t,e,{label:n,expected:"directory"})).exists)return{change:r,exists:!1,stateExists:!1};let o=await Ve(t,Pt.join(e,".comet.yaml"),{label:`${n} state`,expected:"file"});return{change:r,exists:!0,stateExists:o.exists}}function ww(t,e){let n=e.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&");return new RegExp(`^\\d{4}-\\d{2}-\\d{2}-${n}$`,"u").test(t)}async function yw(t,e,n,r={}){if(!r.skipExactCompatibility){let s=await Rn(t,Pt.join(e,n),`Classic archived change ${n}`);if(s.exists)return s.change}if(!(await Ve(t,e,{label:"Classic archive directory",expected:"directory"})).exists)return null;let o=[];for(let s of await hw.readdir(e,{withFileTypes:!0})){if(!ww(s.name,n))continue;let a=await Rn(t,Pt.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 _n(t,e=process.cwd()){Ce(t);let n=await ee(e),r=await Rn(n.projectRoot,Pt.join(n.changesDir,t),`Classic active change ${t}`);return{...r.change,exists:r.exists,stateExists:r.stateExists}}async function Tu(t,e=process.cwd()){Ce(t);let n=await li(e),r=Pt.join(n.changesDir,t),i=await Rn(n.projectRoot,r,`Classic active change ${t}`);return i.exists||await Nu(n.projectRoot,r,`Classic active change ${t}`),i.change}async function Ks(t,e=process.cwd()){Ce(t);let n=await ee(e),r=await Rn(n.projectRoot,Pt.join(n.changesDir,t),`Classic active change ${t}`);if(r.exists)return r.change;let i=await yw(n.projectRoot,n.archiveDir,t);return i||r.change}var bi=Qe(Me(),1);Ge();ie();import vi from"path";Nn();var Vu=["full","hotfix","tweak"],jn=1,Iw=["open","design","build","verify","archive"],$w=["en","zh-CN"],Lw=["off","beta"],qw=["subagent-driven-development","executing-plans","direct"],Dw=["plan-ready"],Ww=["confirmed"],Mw=["tdd","direct"],Fw=["off","standard","thorough"],Bw=["current","branch","worktree"],Kw=["light","full"],Uw=["pending","pass","fail"],Yw=["pending","handled"],Gw=["pending","confirmed"],At=["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"],Qs=["run_id"],Vw=new Set([...At,...Qs]),Hw=["workflow","phase","design_doc","plan","build_mode","isolation","verify_mode","verify_result","verified_at","archived"];function Hu(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function Ot(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 G(t,e,n,r=!0){let i=t[e];if(i==null||i===""){if(r)return null;throw new Error(`Invalid Classic state: ${e} is required`)}if(typeof i!="string"||!n.includes(i))throw new Error(`Invalid Classic state: ${e} must be one of ${n.join(", ")}${r?" or null":""}`);return i}function Xs(t,e,n=!0){let r=t[e];if(r==null||r===""){if(n)return null;throw new Error(`Invalid Classic state: ${e} is required`)}if(typeof r!="boolean")throw new Error(`Invalid Classic state: ${e} must be true or false`);return r}function Jw(t,e,n=0){let r=t[e];if(r==null||r==="")return n;if(typeof r!="number"||!Number.isInteger(r)||r<0)throw new Error(`Invalid Classic state: ${e} must be a non-negative integer`);return r}function yi(t,e){let n=Ot(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 zw(t,e){let n=Ot(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 Xw(t){let e=t.classic_migration;if(e==null||e==="")return null;if(e!==jn)throw new Error(`Invalid Classic state: classic_migration must be ${jn}`);return e}function Qw(t){if(!At.some(n=>Hu(t,n)))return null;for(let n of Hw)if(!Hu(t,n))return null;return{workflow:G(t,"workflow",Vu,!1),language:G(t,"language",$w),phase:G(t,"phase",Iw,!1),contextCompression:G(t,"context_compression",Lw),buildMode:G(t,"build_mode",qw),buildPause:G(t,"build_pause",Dw),subagentDispatch:G(t,"subagent_dispatch",Ww),tddMode:G(t,"tdd_mode",Mw),reviewMode:G(t,"review_mode",Fw),isolation:G(t,"isolation",Bw),boundBranch:Ot(t,"bound_branch"),verifyMode:G(t,"verify_mode",Kw),autoTransition:Xs(t,"auto_transition"),baseRef:Ot(t,"base_ref"),designDoc:yi(t,"design_doc"),plan:yi(t,"plan"),verifyResult:G(t,"verify_result",Uw,!1),verifyFailures:Jw(t,"verify_failures"),verificationReport:yi(t,"verification_report"),branchStatus:G(t,"branch_status",Yw),createdAt:Ot(t,"created_at"),verifiedAt:Ot(t,"verified_at"),archiveConfirmation:G(t,"archive_confirmation",Gw),archived:Xs(t,"archived",!1),directOverride:Xs(t,"direct_override"),handoffContext:yi(t,"handoff_context"),handoffHash:zw(t,"handoff_hash"),classicProfile:G(t,"classic_profile",Vu),classicMigration:Xw(t)}}function Tn(t,e){let n=e??null;if(n===null&&e===void 0&&t.run_id&&t.skill)try{n=hi(t)}catch(r){let i=r instanceof Error?r.message:String(r);throw new Error(i.replace(/^Invalid Run state:/u,"Invalid Classic state:"),{cause:r})}return{classic:Qw(t),run:n,unknownKeys:Object.keys(t).filter(r=>!Vw.has(r))}}function Ju(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}}Nn();var Zw=2*1024*1024;function In(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 zu(t,e,n){t.get(e)!==n&&t.set(e,n)}function ey(t,e){if(e.classic)for(let[n,r]of Object.entries(Ju(e.classic)))zu(t,n,r);else for(let n of At)t.delete(n);Js(t.toJS(),e.run),e.run?zu(t,"run_id",e.run.runId):t.delete("run_id")}function ty(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 ny(t){let e=!1;for(let n of["build_command","verify_command"])t.has(n)&&(t.delete(n),e=!0);return e}async function Xu(t){let e;try{e=(await F(vi.dirname(t),vi.basename(t),Zw,{label:"Classic state document"})).bytes.toString("utf8")}catch(r){if(r.code!=="ENOENT")throw r;return new bi.Document({})}let n=(0,bi.parseDocument)(e);if(n.errors.length>0)throw new Error(`Invalid Classic state document: ${n.errors[0].message}`);return In(n),n}async function ue(t,e={}){let n=e.migrate!==!1,r=vi.join(t,".comet.yaml"),i=await Xu(r),o=In(i),s=ny(i);s&&(o=In(i));let a=await An(t);if(!a&&o.run_id&&o.skill){let{runStateFromDocument:c}=await Promise.resolve().then(()=>(Nn(),Gu));a=c(o),a&&n&&(await wi(t,a),ty(i),s=!0)}return s&&n&&await oe(r,i.toString(),{containedRoot:t}),Tn(In(i),a)}async function Nt(t,e,n={}){let r=vi.join(t,".comet.yaml"),i=await Xu(r);ey(i,{...e,unknownKeys:e.unknownKeys??[]}),Tn(In(i),e.run??null),await oe(r,i.toString(),{containedRoot:t,beforeCommit:n.beforeCommit}),e.run?await wi(t,e.run):await zs(t)}var nf=Qe(Me(),1);import{promises as tf}from"node:fs";import te from"node:path";import{execFileSync as ry}from"node:child_process";var iy=3e4,oy=8*1024*1024,Zs=class extends Error{constructor(n,r,i){super(`git ${r.join(" ")} failed${i?`: ${i}`:""}`);this.cwd=n;this.args=r;this.stderr=i;this.name="GitCommandError"}cwd;args;stderr};function sy(t,e){try{return ry("git",["-C",t,...e],{encoding:"utf8",stdio:["ignore","pipe","pipe"],timeout:iy,maxBuffer:oy,windowsHide:!0})}catch(n){let r=typeof n.stderr=="string"?n.stderr.trim():Buffer.isBuffer(n.stderr)?n.stderr.toString("utf8").trim():"";throw new Zs(t,e,r)}}function ki(t,e){return sy(t,e).trim()}import{execFileSync as ay}from"child_process";import $n from"path";function lt(t,e){return ay("git",["-C",t,...e],{encoding:"utf8",stdio:["ignore","pipe","ignore"],timeout:1e4,windowsHide:!0}).trim()}function cy(t,e){let n=$n.normalize(t),r=$n.normalize(e);return process.platform==="win32"?n.toLowerCase()===r.toLowerCase():n===r}function Ln(t){try{let e=$n.resolve(lt(t,["rev-parse","--show-toplevel"])),r=lt(t,["worktree","list","--porcelain","-z"]).split("\0").find(s=>s.startsWith("worktree ")),i=r?$n.resolve(r.slice(9)):e,o=null;try{o=lt(t,["symbolic-ref","--quiet","--short","HEAD"])||null}catch{}return{isGitWorktree:!0,isSecondaryWorktree:!cy(e,i),currentWorktreeRoot:e,primaryWorktreeRoot:i,currentBranch:o}}catch{return{isGitWorktree:!1,isSecondaryWorktree:!1,currentWorktreeRoot:null,primaryWorktreeRoot:null,currentBranch:null}}}function Qu(t){try{lt(t,["rev-parse","--is-inside-work-tree"]);let e=lt(t,["worktree","list","--porcelain"]).split(/\r?\n/u),n=[],r=null;for(let i of e)i.startsWith("worktree ")?(r&&n.push(r),r={root:$n.resolve(i.slice(9)),branch:null,detached:!1}):r&&i.startsWith("branch refs/heads/")?r.branch=i.slice(18):r&&i==="detached"&&(r.detached=!0);return r&&n.push(r),n}catch{return[]}}function Zu(t,e){try{return lt(t,["check-ref-format","--branch",e]),lt(t,["show-ref","--verify",`refs/heads/${e}`]),!0}catch{return!1}}function Si(t,e){let n=te.normalize(t),r=te.normalize(e);return process.platform==="win32"?n.toLowerCase()===r.toLowerCase():n===r}function ef(t,e){let n=te.relative(t,e);return n===""||!te.isAbsolute(n)&&n!==".."&&!n.startsWith(`..${te.sep}`)}async function ly(t){try{throw await tf.lstat(t),new Error(`Classic worktree path already exists: ${t}`)}catch(e){if(e.code!=="ENOENT")throw e}}function uy(t,e,n){let r=te.resolve(t,n??te.join(".worktrees",e));if(!ef(t,r))throw new Error("Classic worktree path must remain inside the primary worktree");let i=te.resolve(t,ki(t,["rev-parse","--git-common-dir"]));if(ef(i,r))throw new Error("Classic worktree path cannot be inside the Git common directory");return r}async function fy(t,e,n){let r;try{r=await _n(n,t)}catch{return null}if(!r.stateExists)return null;let i;try{i=(0,nf.parseDocument)(await tf.readFile(te.join(r.directory,".comet.yaml"),"utf8"))}catch{return null}let o=i.toJS()??{};return{projectRoot:te.resolve(t),worktree:e,changeDirectory:r.directory,isolation:typeof o.isolation=="string"?o.isolation:null,boundBranch:typeof o.bound_branch=="string"?o.bound_branch:null,branch:e?.branch??Ln(t).currentBranch}}async function dy(t,e){let n=Qu(t),r=n.length>0?[...n]:[{root:te.resolve(t),branch:null,detached:!1}];r.some(o=>Si(o.root,t))||r.push({root:te.resolve(t),branch:Ln(t).currentBranch,detached:!1});let i=(await Promise.all(r.map(o=>fy(o.root,o,e)))).filter(o=>o!==null);return{entries:n,candidates:i}}function py(t){return t.isolation===null||t.boundBranch===null&&t.branch!==null||t.boundBranch===null&&t.branch===null&&t.worktree?.detached===!1?!0:t.boundBranch!==null&&t.boundBranch===t.branch}async function my(t,e,n){let r=Ln(t);if(!r.primaryWorktreeRoot)throw new Error("Classic Git primary worktree is unavailable");let i=r.primaryWorktreeRoot,o=uy(i,e);return await ly(o),ki(i,["worktree","prune"]),ki(i,["worktree","add",o,n]),o}async function Ci(t){let e=te.resolve(t.projectRoot),{entries:n,candidates:r}=await dy(e,t.name);if(r.length===0)throw new Error(`Classic change '${t.name}' was not found in any registered Git worktree`);let i=r.filter(py),s=i.find(u=>Si(u.projectRoot,e))??i[0];if(s)return{schema:"comet.classic.workspace-resolution.v1",change:t.name,projectRoot:s.projectRoot,branch:s.branch,isolation:s.isolation,routed:!Si(s.projectRoot,e),recreatedWorktree:!1};let a=r.find(u=>Si(u.projectRoot,e));if(a&&a.isolation!=="worktree")return{schema:"comet.classic.workspace-resolution.v1",change:t.name,projectRoot:a.projectRoot,branch:a.branch,isolation:a.isolation,routed:!1,recreatedWorktree:!1};let c=r.find(u=>u.boundBranch!==null),l=c?.boundBranch,f=Ln(e);if(c?.isolation==="worktree"&&l&&f.primaryWorktreeRoot&&Zu(e,l)&&!n.some(u=>u.branch===l)){let u=await my(e,t.name,l);return{schema:"comet.classic.workspace-resolution.v1",change:t.name,projectRoot:u,branch:l,isolation:c.isolation,routed:!0,recreatedWorktree:!0}}throw l?new Error(`Classic change '${t.name}' is bound to branch '${l}', but no registered worktree is aligned; ask the user to rebind only if that branch was intentionally renamed or taken over.`):new Error(`Classic change '${t.name}' has no bound branch in its isolated workspace; ask the user to confirm a rebind before continuing.`)}var hy=Qr("readCometCurrentSelection",t=>ks(t));async function ea(t,e){Ce(e);let n=await _n(e,t);if(!n.stateExists)throw new Error(`Cannot select current change '${e}': active change state not found`);let r=await ue(n.directory,{migrate:!1});if(!r.classic)throw new Error(`Cannot select current change '${e}': Classic state is incomplete`);if(r.classic.archived)throw new Error(`Cannot select current change '${e}': change is archived`);return n.directory}async function rf(t,e){Ce(e);let n={label:"",directory:"",exists:!1,stateExists:!1};try{n=await _n(e,t)}catch(c){if(!(c instanceof ct))throw c}let r;try{r=await Ci({projectRoot:t,name:e})}catch(c){throw n.stateExists||await ea(t,e),c}let i=r.projectRoot,o=await ea(i,e),s=await wn(o,{heal:!0,cwd:i});if(s.status==="drift")throw new Error(xs(e,s.boundBranch,s.currentBranch));if(s.status==="unbound-detached")throw new Error(yn(e));let a={schema:"comet.selection.v2",workflow:"classic",change:e,branch:s.currentBranch};return await cu(i,a),a}async function of(t){let e;try{e=await hy(t)}catch(o){return{status:"stale",reason:o instanceof Error?o.message:String(o)}}if(e.status==="missing")return{status:"missing"};if(e.selection.workflow!=="classic")return{status:"stale",reason:`current change '${e.selection.change}' belongs to Native, not Classic`};let n=e.selection,r;try{r=await ea(t,n.change)}catch(o){return{status:"stale",reason:o instanceof Error?o.message:String(o)}}let i=await wn(r,{heal:!1,cwd:t});return i.status==="drift"?{status:"stale",reason:xs(n.change,i.boundBranch,i.currentBranch)}:i.status==="unbound-detached"?{status:"stale",reason:yn(n.change)}:i.status==="ok"?{status:"selected",selection:n}:n.branch!==null&&i.currentBranch!==n.branch?{status:"stale",reason:`current change '${n.change}' was selected on branch '${n.branch}', current branch is '${i.currentBranch??"detached HEAD"}'`}:{status:"selected",selection:n}}async function sf(t){let e;try{e=await ks(t)}catch{return}e.status==="selected"&&e.selection.workflow==="classic"&&await lu(t)}import{promises as wy}from"fs";import Ee from"path";ie();Se();import qn from"path";function gy(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}async function af(t,e,n,r){let i=ke(n,"Classic handoff artifact pointer");if((await T(t,i,{label:"Classic handoff artifact",expected:"file"})).exists)return null;let s=await ee(t),a=`${Z(t,s.changesDir)}/`,l=(s.artifactLayout==="docs"?[a,"openspec/changes/"]:[a]).find(y=>i.startsWith(y));if(!l)return null;let f=i.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];Ce(u);let d=f.slice(2),m=qn.resolve(e);if(qn.dirname(m)!==qn.resolve(s.archiveDir))return null;let g=qn.basename(m),p=/^\d{4}-\d{2}-\d{2}-(.+)$/u.exec(g);if(g!==u&&p?.[1]!==u)return null;await T(t,Z(t,m),{label:"Classic archived change directory",expected:"directory"});let h=qn.join(m,".comet",...d),v=Z(t,h);try{return await F(t,v,r,{label:"Historical Classic archived handoff artifact"}),v}catch(y){if(gy(y))return null;throw y}}ie();var cf=2*1024*1024;function Dn(t,e){return Ee.relative(t,e).split(Ee.sep).join("/")}async function Wn(t,e,n,r,i){if(!n)return{code:e,satisfied:!1};let o=n.replaceAll("\\","/");if(i)return{code:e,satisfied:!1,source:o,detail:`Classic layout is unsafe or unavailable: ${i instanceof Error?i.message:String(i)}`};try{if(r){let a=r.artifactLayout==="legacy"?"docs":"legacy",c=Z(t,ci(t,a).openSpecRoot);if((o===c||o.startsWith(`${c}/`))&&(await T(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 ri(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 yy(t,e,n,r){try{r??=await ee(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 i=await Wn(t,"design.handoff",n,r);if(!n||i.satisfied||i.detail)return i;try{let o=await af(t,e,n,cf);return o?{...i,satisfied:!0,resolvedSource:o,detail:`resolved historical legacy pointer from archived change: ${o}`}:i}catch(o){return{...i,satisfied:!1,detail:`unsafe archived handoff fallback: ${o instanceof Error?o.message:String(o)}`}}}async function Ei(t,e,n){return Wn(t,e,Dn(t,n))}async function vy(t,e){let n=Ee.join(e,"specs"),r;try{let s=Dn(t,n);if(!(await T(t,s,{label:"OpenSpec delta-spec directory",expected:"directory"})).exists)return{code:"openspec.delta-spec",satisfied:!1};r=await wy.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 i=r.map(s=>Ee.join(n,s,"spec.md")),o=(await Promise.all(i.map(async s=>{try{return await ri(t,Dn(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]?Dn(t,o[0]):void 0,detail:`${o.length} delta spec${o.length===1?"":"s"}`}}async function by(t,e){let n,r=Dn(t,e);try{n=(await F(t,r,cf,{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:r,detail:`unsafe tasks artifact: ${s instanceof Error?s.message:String(s)}`}}let i=[...n.matchAll(/^\s*[-*]\s+\[([ xX])\]\s+/gmu)],o=i.filter(s=>s[1].toLowerCase()==="x").length;return{code:"build.tasks-complete",satisfied:i.length>0&&o===i.length,source:r,detail:`${o} of ${i.length} tasks complete`}}function Mn(t,e){return t.some(n=>n.code===e&&n.satisfied)}async function jt(t,e){let n=await Sn(t),r=e.classic,i=Ee.join(t,"proposal.md"),o=Ee.join(t,"design.md"),s=Ee.join(t,"tasks.md"),a=e.run?Ee.resolve(t,e.run.checkpointRef):Ee.join(t,".comet","checkpoint.json"),c,l;try{c=await ee(n)}catch(d){l=d}let f=await Promise.all([Ei(n,"openspec.proposal",i),Ei(n,"openspec.design",o),Ei(n,"openspec.tasks",s),vy(n,t),Wn(n,"design.document",r?.designDoc??null,c,l),Wn(n,"build.plan",r?.plan??null,c,l),by(n,s),Wn(n,"verification.report",r?.verificationReport??null,c,l),yy(n,t,r?.handoffContext??null,c),Ei(n,"run.checkpoint",a)]),u=f.find(d=>d.code==="design.handoff");return u&&!r?.handoffHash&&(u.satisfied=!1,u.detail="handoff hash is missing"),f.push({code:"archive.confirmed",satisfied:r?.archiveConfirmation==="confirmed"}),f}import{AsyncLocalStorage as ky}from"async_hooks";import{promises as lf}from"fs";import Fn from"path";var Ri=new ky;function Sy(t,e){let n=Fn.relative(t,e);return n===""||!Fn.isAbsolute(n)&&n!==".."&&!n.startsWith(`..${Fn.sep}`)}async function Cy(t){let e=Fn.resolve(t.invocationCwd??process.cwd()),n=Fn.resolve(t.projectRoot??await Sn(e)),[r,i]=await Promise.all([lf.realpath(e),lf.realpath(n)]);if(!Sy(i,r))throw new Error(`Classic command invocation cwd is outside the discovered project: ${e}`);return{invocationCwd:e,projectRoot:n}}async function uf(t,e){let n=Ri.getStore();if(n)return e(n);let r=await Cy(t);return Ri.run(r,()=>e(r))}function j(){let t=Ri.getStore();if(!t)throw new Error("Classic command project context is unavailable");return t.projectRoot}function Bn(){let t=Ri.getStore();if(!t)throw new Error("Classic command invocation context is unavailable");return t.invocationCwd}function Ey(t){return t.classicProfile??t.workflow}function Ry(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 _y(t){return t.buildMode==="direct"&&t.tddMode==="direct"&&t.isolation!==null&&t.verifyMode==="light"}function xy(t,e,n){if(e.verifyResult==="fail")return t==="full"?"full.build.fix":`${t}.build.execute`;if(t==="full"){if(!Mn(n,"build.plan"))return"full.build.plan";if(e.buildPause==="plan-ready")return"full.build.plan-ready";if(!Ry(e))return"full.build.configure"}else if(!_y(e))throw new Error(`${t} build configuration is incomplete`);return Mn(n,"build.tasks-complete")?`${t}.build.complete`:`${t}.build.execute`}function Py(t,e,n){return e.verifyResult!=="pass"||!Mn(n,"verification.report")?`${t}.verify.run`:`${t}.verify.branch`}function Oy(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 Tt(t,e){let n=Ey(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 Mn(e,"design.handoff")?"full.design.document":"full.design.handoff";case"build":return xy(n,t,e);case"verify":return Py(n,t,e);case"archive":return Oy(n,t)}}import{promises as Of}from"fs";import Q from"path";import{fileURLToPath as Af}from"url";mi();import _i from"path";var ff={trajectory:8*1024*1024,artifacts:1024*1024,context:1024*1024,pendingAction:256*1024,checkpoint:256*1024};function df(t,e){if(_i.isAbsolute(e))throw new Error("Run path must stay inside the change directory");let n=_i.resolve(t),r=_i.resolve(n,e);if(r!==n&&!r.startsWith(n+_i.sep))throw new Error("Run path must stay inside the change directory")}async function ut(t,e,n,r={}){df(t,e),await pi(t,e,`${JSON.stringify(n)}
146
+ `,ff.trajectory,"Run trajectory",r)}async function It(t,e,n={}){df(t,e);let r=await xn(t,e,ff.trajectory,"Run trajectory",n);return r===null?[]:r.split(/\r?\n/).map((i,o)=>({line:i,number:o+1})).filter(({line:i})=>i.length>0).map(({line:i,number:o})=>{try{return JSON.parse(i)}catch(s){throw new Error(`Invalid Trajectory event at line ${o}`,{cause:s})}})}import{createHash as _f,randomUUID as zE}from"crypto";import{promises as $t}from"fs";import ge from"path";var hf=Qe(Me(),1);import{promises as ta}from"fs";import se from"path";var Ay=["invoke_skill","call_tool","handoff","ask_user","checkpoint"],Ny=["deterministic","adaptive"],jy=["function","mcp","script","agent"],Ty=["none","read","write","external"],Iy=["progress","step","completion"],$y=["artifact_exists","state_equals"];function ft(t,e,n){return new Error(`${t}: ${e} ${n}`)}function X(t,e,n="document"){if(t===null||typeof t!="object"||Array.isArray(t))throw ft(e,n,"must be an object")}function Je(t,e,n){if(!Array.isArray(t))throw ft(e,n,"must be an array")}function V(t,e,n){if(typeof t!="string")throw ft(e,n,"must be a string")}function fe(t,e,n,r){e in t&&V(t[e],n,`${r}.${e}`)}function gf(t,e,n,r){if(e in t&&typeof t[e]!="boolean")throw ft(n,`${r}.${e}`,"must be a boolean")}function ze(t,e,n,r){if(typeof t!="string"||!e.includes(t))throw ft(n,r,`must be one of ${e.join(", ")}`)}function xi(t,e,n){Je(t,e,n),t.forEach((r,i)=>{V(r,e,`${n}[${i}]`)})}function pf(t,e,n){X(t,e,n),V(t.name,e,`${n}.name`),V(t.description,e,`${n}.description`),gf(t,"required",e,n)}function Ly(t,e,n){X(t,e,n),V(t.id,e,`${n}.id`),fe(t,"source",e,n),fe(t,"version",e,n)}function qy(t,e,n){X(t,e,n),V(t.id,e,`${n}.id`),V(t.role,e,`${n}.role`),fe(t,"instructions",e,n)}function Dy(t,e,n){X(t,e,n),V(t.id,e,`${n}.id`),ze(t.kind,jy,e,`${n}.kind`),V(t.source,e,`${n}.source`),ze(t.sideEffect,Ty,e,`${n}.sideEffect`),gf(t,"requiresConfirmation",e,n)}function Wy(t,e,n){X(t,e,n),ze(t.type,Ay,e,`${n}.type`),fe(t,"ref",e,n),fe(t,"prompt",e,n),fe(t,"question",e,n),"options"in t&&xi(t.options,e,`${n}.options`)}function My(t,e,n){X(t,e,n),V(t.id,e,`${n}.id`),Wy(t.action,e,`${n}.action`),fe(t,"next",e,n),"completionEvals"in t&&xi(t.completionEvals,e,`${n}.completionEvals`)}function Fy(t,e){let n="goal";X(t,e,n),V(t.statement,e,`${n}.statement`),Je(t.inputs,e,`${n}.inputs`),t.inputs.forEach((r,i)=>{pf(r,e,`${n}.inputs[${i}]`)}),Je(t.outputs,e,`${n}.outputs`),t.outputs.forEach((r,i)=>{pf(r,e,`${n}.outputs[${i}]`)}),xi(t.success,e,`${n}.success`)}function By(t,e){let n="orchestration";X(t,e,n),ze(t.mode,Ny,e,`${n}.mode`),fe(t,"entry",e,n),"steps"in t&&(Je(t.steps,e,`${n}.steps`),t.steps.forEach((r,i)=>{My(r,e,`${n}.steps[${i}]`)}))}function wf(t,e){return X(t,e),ze(t.apiVersion,["comet/v1alpha1"],e,"apiVersion"),ze(t.kind,["Skill"],e,"kind"),X(t.metadata,e,"metadata"),V(t.metadata.name,e,"metadata.name"),V(t.metadata.version,e,"metadata.version"),V(t.metadata.description,e,"metadata.description"),Fy(t.goal,e),By(t.orchestration,e),Je(t.skills,e,"skills"),t.skills.forEach((n,r)=>{Ly(n,e,`skills[${r}]`)}),Je(t.agents,e,"agents"),t.agents.forEach((n,r)=>{qy(n,e,`agents[${r}]`)}),Je(t.tools,e,"tools"),t.tools.forEach((n,r)=>{Dy(n,e,`tools[${r}]`)}),t}function yf(t,e){X(t,e);for(let n of["allowedSkills","allowedAgents","allowedTools","confirmationRequiredFor"])n in t&&xi(t[n],e,n);for(let n of["maxIterations","maxRetriesPerAction"])if(n in t&&(typeof t[n]!="number"||!Number.isFinite(t[n])))throw ft(e,n,"must be a finite number");return t}function Ky(t,e){return X(t,e),"runtime"in t&&vf(t.runtime,e,"runtime"),t}function vf(t,e,n){return Je(t,e,n),t.forEach((r,i)=>{let o=`${n}[${i}]`;X(r,e,o),V(r.id,e,`${o}.id`),ze(r.scope,Iy,e,`${o}.scope`),ze(r.type,$y,e,`${o}.type`),fe(r,"artifact",e,o),fe(r,"field",e,o),fe(r,"equals",e,o)}),t}async function na(t){let e=await ta.readFile(t,"utf8");try{return(0,hf.parse)(e)}catch(n){let r=n instanceof Error?n.message:String(n);throw ft(t,"document",r)}}async function Uy(t){try{return await na(t)}catch(e){if(e.code==="ENOENT")return null;throw e}}async function mf(t){try{return await ta.access(t),!0}catch(e){if(e.code==="ENOENT")return!1;throw e}}async function Yy(t){let e=se.join(t,"checks.yaml"),n=se.join(t,"evals.yaml"),[r,i]=await Promise.all([mf(e),mf(n)]);if(i)throw new Error(`${n}: evals.yaml is no longer supported; use checks.yaml`);return r?{document:Ky(await na(e),e)}:{document:null}}async function bf(t){let e=se.resolve(t.root),n=se.resolve(t.controlRoot);t.requireSkillMarkdown&&await ta.access(se.join(e,"SKILL.md"));let r=se.join(n,"skill.yaml"),i=se.join(n,"guardrails.yaml"),o=wf(await na(r),r),s=await Uy(i),a=s===null?null:yf(s,i),c=await Yy(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 kf(t){let e=se.resolve(t);return bf({root:e,controlRoot:se.join(e,"comet"),packageKind:"skill",requireSkillMarkdown:!0})}async function Sf(t){let e=se.resolve(t);return bf({root:e,controlRoot:e,packageKind:"runtime",requireSkillMarkdown:!1})}function Cf(t,e,n=se.join(e,"package.json")){X(t,n);let r=t.packageKind==="runtime"?"runtime":void 0,i=wf(t.definition,n),o=yf(t.guardrails,n),s=vf(t.evals,n,"evals"),a={allowedSkills:i.skills.map(c=>c.id),allowedAgents:i.agents.map(c=>c.id),allowedTools:i.tools.map(c=>c.id),maxIterations:50,maxRetriesPerAction:3,confirmationRequiredFor:i.tools.filter(c=>c.requiresConfirmation).map(c=>c.id)};return{root:se.resolve(e),packageKind:r,definition:i,guardrails:{...a,...o},evals:s}}import Ef from"path";function Gy(t,e,n,r){t.type==="invoke_skill"&&!e.definition.skills.some(i=>i.id===t.ref)&&n.push(`step ${r} references undeclared skill: ${t.ref??"(missing)"}`),t.type==="call_tool"&&!e.definition.tools.some(i=>i.id===t.ref)&&n.push(`step ${r} references undeclared tool: ${t.ref??"(missing)"}`),t.type==="handoff"&&!e.definition.agents.some(i=>i.id===t.ref)&&n.push(`step ${r} references undeclared agent: ${t.ref??"(missing)"}`),t.type==="ask_user"&&!t.question&&n.push(`step ${r} ask_user action requires question`)}function Rf(t){let e=[],{definition:n,guardrails:r,evals:i}=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"),r.maxIterations<1&&e.push("maxIterations must be at least 1"),r.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),Gy(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??[])i.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=Ef.posix.normalize(s.source.replaceAll("\\","/"));(Ef.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 r.allowedSkills)n.skills.some(a=>a.id===s)||e.push(`guardrails allow undeclared skill: ${s}`);for(let s of r.allowedAgents)n.agents.some(a=>a.id===s)||e.push(`guardrails allow undeclared agent: ${s}`);for(let s of r.allowedTools)n.tools.some(a=>a.id===s)||e.push(`guardrails allow undeclared tool: ${s}`);return e}function Pi(t){return Array.isArray(t)?t.map(Pi):t&&typeof t=="object"?Object.fromEntries(Object.entries(t).sort(([e],[n])=>e.localeCompare(n)).map(([e,n])=>[e,Pi(n)])):t}function Vy(t){return Pi({...t.packageKind==="runtime"?{packageKind:"runtime"}:{},definition:t.definition,guardrails:t.guardrails,evals:t.evals})}function Hy(t){return ge.posix.normalize(t.replaceAll("\\","/"))}function ra(t,e,n){let r=ge.relative(t,e);if(!(r===""||!ge.isAbsolute(r)&&!r.startsWith(`..${ge.sep}`)))throw new Error(`${n} resolves outside the Skill package`)}async function xf(t,e,n){let r=Hy(e);if(ge.posix.isAbsolute(r)||r===".."||r.startsWith("../"))throw new Error(`${n} resolves outside the Skill package`);let i=ge.resolve(t,...r.split("/"));ra(t,i,n);let o;try{o=await $t.realpath(i)}catch(s){throw s.code==="ENOENT"?new Error(`${n} does not exist: ${e}`,{cause:s}):s}if(ra(t,o,n),!(await $t.stat(o)).isFile())throw new Error(`${n} is not a file: ${e}`);return{path:r,content:await $t.readFile(o)}}async function Jy(t){let e=await $t.realpath(t.root),n=t.packageKind==="runtime"?[]:[await xf(e,"SKILL.md","SKILL.md")];for(let r of t.definition.tools)r.kind==="script"&&n.push(await xf(e,r.source,`Script tool ${r.id}`));return n.sort((r,i)=>r.path.localeCompare(i.path))}function zy(t,e){let n=e.map(r=>({path:r.path,sha256:_f("sha256").update(r.content).digest("hex")}));return _f("sha256").update(JSON.stringify(Pi({package:t,files:n}))).digest("hex")}async function Xy(t){let e=Vy(t),n=await Jy(t);return{document:e,files:n,hash:zy(e,n)}}async function Pf(t){return(await Xy(t)).hash}async function ia(t,e){if(!/^[a-f0-9]{64}$/u.test(e))throw new Error(`Invalid Skill snapshot hash: ${e}`);let n=ge.resolve(t,".comet","skill-snapshots"),r=ge.join(n,e);ra(n,r,"Skill snapshot");try{let i=(await $t.readFile(ge.join(r,"sha256"),"utf8")).trim();if(i!==e)throw new Error(`stored hash is ${i||"(empty)"}`);let o=ge.join(r,"package.json"),s=JSON.parse(await $t.readFile(o,"utf8")),a=Cf(s,r,o),c=Rf(a);if(c.length>0)throw new Error(c.map(f=>` - ${f}`).join(`
147
+ `));let l=await Pf(a);if(l!==e)throw new Error(`calculated hash is ${l}`);return a}catch(i){throw new Error(`Skill snapshot is invalid or missing: ${e}`,{cause:i})}}async function Qy(t){try{return(await Of.stat(t)).isDirectory()}catch(e){if(e.code==="ENOENT")return!1;throw e}}async function Oi(t){try{return(await Of.stat(t)).isFile()}catch(e){if(e.code==="ENOENT")return!1;throw e}}async function Zy(t){return await Qy(t)?await Oi(Q.join(t,"skill.yaml"))?!0:await Oi(Q.join(t,"SKILL.md"))&&await Oi(Q.join(t,"comet","skill.yaml")):!1}function ev(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 tv(){let t=Q.dirname(Af(import.meta.url)),e=[process.env.COMET_RUNTIME_CLASSIC_ROOT,Q.resolve(t,"..","runtime","classic"),Q.resolve(t,"..","..","comet","runtime","classic"),Q.resolve(t,"..","..","assets","skills","comet","runtime","classic"),Q.resolve("assets","skills","comet","runtime","classic"),process.env.COMET_CLASSIC_SKILL_ROOT,Q.resolve(t,"..","..","comet-classic"),Q.resolve(t,"..","..","assets","skills","comet-classic"),Q.resolve("assets","skills","comet-classic")].filter(n=>!!n);for(let n of e)if(await Zy(n))return n;return null}async function nv(t){return await Oi(Q.join(t,"skill.yaml"))?Sf(t):kf(t)}async function Nf(t,e){let n=e??await ue(t,{migrate:!1}),r=Array.from(new Set(n.unknownKeys)).sort();if(r.length>0)throw new Error(`Invalid Classic state: unknown field(s): ${r.join(", ")}`);if(!n.classic||!n.run)throw new Error("Classic runtime validation requires synchronized Classic and Run projections");if(n.classic.classicMigration!==jn)throw new Error("Classic Run exists without a supported classic_migration marker");let i=await tv(),o=i?await nv(i):ev(Q.dirname(Af(import.meta.url)));if(n.run.skill!==o.definition.metadata.name)throw new Error(`Classic Run skill mismatch: expected ${o.definition.metadata.name}, got ${n.run.skill}`);let s=await ia(t,n.run.skillHash);if(s.definition.metadata.name!==n.run.skill)throw new Error(`Classic Run snapshot skill mismatch: expected ${n.run.skill}, got ${s.definition.metadata.name}`);let a=await jt(t,n),c=Tt(n.classic,a);if(n.run.currentStep!==c)throw new Error(`Classic Run step mismatch: expected ${c}, got ${n.run.currentStep}`);return{classic:n.classic,run:n.run,evidence:a,migrated:!1,snapshotDir:Q.join(t,".comet","skill-snapshots",n.run.skillHash)}}async function jf(t,e,n,r){let i=await ue(t);if(!i.classic||!i.run)throw new Error("Classic transition requires synchronized Classic and Run projections");let o=await jt(t,{classic:e,run:n,unknownKeys:i.unknownKeys}),s=Tt(e,o),a={...n,currentStep:s,iteration:n.iteration+1,status:s==="completed"?"completed":"running"};await Nt(t,{classic:e,run:a,unknownKeys:i.unknownKeys});let c=await It(t,a.trajectoryRef);return await ut(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,...r}}),a}mi();import rv from"path";var iv=rv.join(".comet","state-events.jsonl"),ov=8*1024*1024;async function oa(t,e){let n={schemaVersion:1,timestamp:new Date().toISOString(),...e};return await pi(t,iv,`${JSON.stringify(n)}
148
+ `,ov,"Classic state event log"),n}var Tf=["open-complete","design-complete","build-complete","verify-pass","verify-fail","archive-confirm","archive-reopen","archived","preset-escalate"],sv={"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"]}};function av(t){return t.toISOString().slice(0,10)}function x(t,e,n,r){let i=t[n];t[n]=r,i!==r&&e.push({field:n,from:i,to:r})}function If(t,e,n={}){let r=sv[e];if(t.phase!==r.from)throw new Error(`Cannot apply ${e}: phase is '${t.phase}', expected '${r.from}'`);let i={...t},o=[],s=n.now??new Date;if(e==="open-complete")x(i,o,"phase",i.workflow==="full"?"design":"build");else if(e==="design-complete")x(i,o,"phase","build");else if(e==="build-complete"){let a=i.verifyResult==="fail";x(i,o,"phase","verify"),x(i,o,"verifyResult","pending"),x(i,o,"branchStatus","pending"),a||x(i,o,"verificationReport",null)}else if(e==="verify-pass")x(i,o,"verifyResult","pass"),x(i,o,"verifyFailures",0),x(i,o,"phase","archive"),x(i,o,"verifiedAt",av(s)),x(i,o,"archiveConfirmation","pending"),x(i,o,"branchStatus","pending");else if(e==="verify-fail")x(i,o,"verifyResult","fail"),x(i,o,"verifyFailures",i.verifyFailures+1),x(i,o,"phase","build"),x(i,o,"branchStatus","pending");else if(e==="preset-escalate"){if(i.workflow!=="hotfix"&&i.workflow!=="tweak")throw new Error(`Cannot apply ${e}: workflow must be hotfix or tweak, got '${i.workflow}'`);x(i,o,"workflow","full"),x(i,o,"classicProfile","full"),x(i,o,"phase","design"),x(i,o,"designDoc",null),x(i,o,"buildPause",null),x(i,o,"buildMode",null),x(i,o,"subagentDispatch",null),x(i,o,"tddMode",null),x(i,o,"reviewMode",null),x(i,o,"isolation",null),x(i,o,"boundBranch",null),x(i,o,"verifyMode",null),x(i,o,"directOverride",null)}else if(e==="archive-confirm"){if(i.verifyResult!=="pass")throw new Error(`Cannot apply ${e}: verifyResult must be pass`);if(i.archived)throw new Error(`Cannot apply ${e}: already archived`);x(i,o,"archiveConfirmation","confirmed")}else if(e==="archive-reopen"){if(i.archived)throw new Error(`Cannot apply ${e}: already archived`);x(i,o,"verifyResult","pending"),x(i,o,"verifyFailures",0),x(i,o,"phase","verify"),x(i,o,"verifiedAt",null),x(i,o,"archiveConfirmation",null),x(i,o,"branchStatus","pending")}else{if(i.verifyResult!=="pass")throw new Error(`Cannot apply ${e}: verifyResult must be pass`);if(i.archiveConfirmation!=="confirmed")throw new Error(`Cannot apply ${e}: archiveConfirmation must be confirmed`);x(i,o,"archived",!0)}return{classic:i,effects:o,definition:r}}Nn();import Ai from"path";function cv(t){if(t!=="build"&&t!=="verify")throw new Error(`Invalid command check scope: '${String(t)}'`)}function lv(t,e="."){if(e.trim().length===0)throw new Error("Command check cwd cannot be blank");let n=Ai.resolve(t),r=Ai.resolve(n,e);if(r!==n&&!r.startsWith(n+Ai.sep))throw new Error(`Command check cwd must resolve within the project root: '${e}'`);return Ai.relative(n,r).replaceAll("\\","/")||"."}async function $f(t,e,n,r){if(cv(r.scope),typeof r.command!="string"||r.command.trim().length===0)throw new Error("Command check command cannot be blank");if(!Number.isInteger(r.exitCode))throw new Error("Command check exitCode must be an integer");let o={sequence:(await It(e,n.trajectoryRef)).reduce((s,a)=>Math.max(s,a.sequence),0)+1,timestamp:new Date().toISOString(),runId:n.runId,scope:r.scope,command:r.command,exitCode:r.exitCode,cwd:lv(t,r.cwd)};return await ut(e,n.trajectoryRef,{sequence:o.sequence,timestamp:o.timestamp,type:"command_check_recorded",runId:o.runId,data:{scope:o.scope,command:o.command,exitCode:o.exitCode,cwd:o.cwd}}),o}Gs();at();import uv from"os";import Ni from"path";function fv(t={}){let e=t.cwd??process.cwd(),n=t.homeDir??uv.homedir(),r=[{file:Ni.resolve(e,".comet","config.yaml"),source:".comet/config.yaml",scope:"project"},{file:Ni.resolve(n,".comet","config.yaml"),source:"~/.comet/config.yaml",scope:"global"}];return r.filter((i,o)=>r.findIndex(s=>s.file===i.file)===o)}async function sa(t,e={}){for(let n of fv(e)){let r=Ni.dirname(Ni.dirname(n.file)),i=n.scope==="global"?(await Ys(r))?.classic:(await st(r,{allowPartialProject:!0}))?.value.classic;if(!i||typeof i!="object"||Array.isArray(i))continue;let o=i[t];if(o!=null)return{value:String(o),source:n.source}}return null}import dt from"node:path";async function Lf(t,e){if(!e||e==="null")return{status:"missing",recordedPath:null};let n=await ee(t),r=dt.resolve(t,e),i=dt.relative(n.superpowersPlansDir,r);return dt.isAbsolute(e)||!i||i.startsWith(`..${dt.sep}`)||dt.isAbsolute(i)||i.includes(dt.sep)||dt.extname(i).toLowerCase()!==".md"?{status:"broken",recordedPath:e}:await En(t,e,{label:`Classic build plan ${e}`,expected:"file"})?{status:"ready",recordedPath:e}:{status:"broken",recordedPath:e}}var mv="\x1B[32m",hv="\x1B[31m",gv="\x1B[33m",fa="\x1B[0m",Kn=["full","hotfix","tweak"],da=["open","design","build","verify","archive"],Df=["en","zh-CN"],wv=Tf,ca=new Set([...Qs,"archive_confirmation","verify_failures","classic_profile","classic_migration","bound_branch"]),yv=new Set(At.filter(t=>!ca.has(t))),vv={workflow:Kn,phase:da,context_compression:["off","beta"],build_mode:["subagent-driven-development","executing-plans","direct"],build_pause:["null","plan-ready"],subagent_dispatch:["null","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:Kn,classic_migration:["1"]},bv=new Set(["design_doc","plan","verification_report","handoff_context"]),kv={archived:"archived",branchStatus:"branch_status",classicProfile:"classic_profile",designDoc:"design_doc",language:"language",phase:"phase",verificationReport:"verification_report",verifiedAt:"verified_at",archiveConfirmation:"archive_confirmation",verifyResult:"verify_result",verifyFailures:"verify_failures",workflow:"workflow"},Un=class extends Error{constructor(n,r=1){super(n);this.exitCode=r}exitCode},Ti=class{stdout=[];stderr=[];result(e=0){return{exitCode:e,...this.stdout.length>0?{stdout:this.stdout.join(`
149
149
  `)+`
150
150
  `}:{},...this.stderr.length>0?{stderr:this.stderr.join(`
151
- `)}:{}}}};function ue(t){return`${qy}${t}${Xo}`}function Go(t){return`${Ly}${t}${Xo}`}function bf(t){return`${Dy}${t}${Xo}`}function b(t){throw new Dn(t)}function fe(t){let e=Ao(t);e&&b(`ERROR: ${e}`)}function Er(t,e){e.includes(t)||b(`ERROR: Invalid value: '${t}'
152
- Valid values: ${e.join(" ")}`)}function Cr(t,e){if(kf.includes(t))return t;b(`ERROR: Invalid language from ${e}: '${t}'
153
- Valid values: en, zh-CN`)}function Sf(t,e){!t||t==="null"||(/^(?:[A-Za-z]:|[\\/]|~)/u.test(t)&&b(`ERROR: ${e} must be a relative path within the repo: '${t}'`),t.split(/[\\/]/u).includes("..")&&b(`ERROR: ${e} cannot contain '..' (path traversal not allowed): '${t}'`))}async function K(t){let e=T();return kn(e,t,{label:`Classic project path ${O.relative(e,O.resolve(e,t)).replaceAll("\\","/")}`})}async function Re(t){let e=T();return gu(e,t,`Classic project file ${O.relative(e,O.resolve(e,t)).replaceAll("\\","/")}`)}async function Uy(t){return Su(t,T())}async function Rr(t){let e,n=T();try{e=await Ue(n,t,{label:`Classic state ${O.relative(n,t).replaceAll("\\","/")}`})}catch(r){throw r.code==="ENOENT"&&b(`ERROR: .comet.yaml not found at ${O.relative(n,t).replaceAll("\\","/")}`),r}let i=(0,Mn.parseDocument)(e,{uniqueKeys:!1});return i.errors.length>0&&b(`ERROR: Invalid .comet.yaml: ${i.errors[0].message}`),i}async function Zo(t,e){await vu(T(),t,e,{label:"Classic state write target"})}function zo(t){return t===null?"null":t===void 0?"":typeof t=="object"?JSON.stringify(t):String(t)}function Cf(t){return Ky[t]??String(t)}function Ef(t){return t===null?"null":zo(t)}function H(t,e,n,i){let r=t[e];return typeof r=="string"&&n.includes(r)?r:i}function Se(t,e){let n=t[e];return n==null||n===""?null:typeof n=="string"?n:String(n)}function Jo(t,e){let n=t[e];return n==null||n===""?null:typeof n=="boolean"?n:n==="true"?!0:n==="false"?!1:null}function Yy(t,e,n=0){let i=t[e];return typeof i=="number"&&Number.isInteger(i)&&i>=0?i:n}function Vy(t){let e=H(t,"workflow",Ln,"full");return{workflow:e,language:H(t,"language",kf,null),phase:H(t,"phase",Qo,"open"),contextCompression:H(t,"context_compression",["off","beta"],null),buildMode:H(t,"build_mode",["subagent-driven-development","executing-plans","direct"],null),buildPause:H(t,"build_pause",["plan-ready"],null),subagentDispatch:H(t,"subagent_dispatch",["confirmed"],null),tddMode:H(t,"tdd_mode",["tdd","direct"],null),reviewMode:H(t,"review_mode",["off","standard","thorough"],null),isolation:H(t,"isolation",["current","branch","worktree"],null),boundBranch:Se(t,"bound_branch"),verifyMode:H(t,"verify_mode",["light","full"],null),autoTransition:Jo(t,"auto_transition"),baseRef:Se(t,"base_ref"),designDoc:Se(t,"design_doc"),plan:Se(t,"plan"),verifyResult:H(t,"verify_result",["pending","pass","fail"],"pending"),verifyFailures:Yy(t,"verify_failures"),verificationReport:Se(t,"verification_report"),branchStatus:H(t,"branch_status",["pending","handled"],null),createdAt:Se(t,"created_at"),verifiedAt:Se(t,"verified_at"),archiveConfirmation:H(t,"archive_confirmation",["pending","confirmed"],null),archived:Jo(t,"archived")??!1,directOverride:Jo(t,"direct_override"),handoffContext:Se(t,"handoff_context"),handoffHash:Se(t,"handoff_hash"),classicProfile:H(t,"classic_profile",Ln,e),classicMigration:typeof t.classic_migration=="number"?t.classic_migration:null}}async function ea(t){return(await Vo(t,{cwd:T()}))?.value??null}async function Rf(){if(process.env.COMET_LANGUAGE)return Cr(process.env.COMET_LANGUAGE,"COMET_LANGUAGE");let t=await Vo("language",{cwd:T()});return t?Cr(t.value,t.source):"en"}async function Jy(){let t=process.env.COMET_CONTEXT_COMPRESSION??await ea("context_compression")??"off";return["off","beta"].includes(t)||b(`ERROR: Invalid context_compression: '${t}'
154
- Valid values: off, beta`),t}async function _f(){let t=process.env.COMET_AUTO_TRANSITION??await ea("auto_transition")??"true";return["true","false"].includes(t)||b(`ERROR: Invalid auto_transition: '${t}'
155
- Valid values: true, false`),t}async function Hy(){let t=process.env.COMET_REVIEW_MODE??await ea("review_mode")??"standard";return["null","off","standard","thorough"].includes(t)||b(`ERROR: Invalid review_mode: '${t}'
156
- Valid values: off, standard, thorough`),t==="null"?null:t}function xf(t){let e=jy("git",t,{encoding:"utf8"});return e.status===0?e.stdout.trim():null}async function ge(t){let e=await Uy(t);return await Ke(T(),O.join(e.directory,".comet"),{label:`Classic runtime directory for ${t}`,expected:"directory"}),{...e,file:O.join(e.directory,".comet.yaml")}}async function C(t,e){let{file:n}=await ge(t),s=(await Rr(n)).toJS()[e];return e==="language"?s==null||s===""?Rf():Cr(zo(s),".comet.yaml"):e==="auto_transition"&&(s==null||s==="")?_f():zo(s)}function Pf(t,e){let n=(0,Mn.parseDocument)(`${t}: ${e}
157
- `);return n.errors.length>0&&b(`ERROR: Invalid value: '${e}'`),n.get(t)}async function Gy(t,e){if(t==="language"){Cr(e,"language");return}let n=Wy[t];n&&Er(e,n),By.has(t)&&(Sf(e,t),e&&e!=="null"&&await Ke(T(),e,{label:`${t} artifact pointer`,expected:"file"})),(t==="skill_hash"||t==="handoff_hash")&&!/^[a-f0-9]{64}$/u.test(e)&&b(`ERROR: ${t} must be a sha256 hex digest`),t==="iteration"&&!/^[0-9]+$/u.test(e)&&b("ERROR: iteration must be a non-negative integer")}async function Of(t,e,n,i,r={}){Ho.has(n)&&!r.machineOwned&&b(`ERROR: '${n}' is a machine-owned field and cannot be set directly`),!Fy.has(n)&&!Ho.has(n)&&b(`ERROR: Unknown field: '${n}'`),n==="phase"&&!r.internal&&process.env.COMET_FORCE_PHASE!=="1"&&b(`ERROR: Setting 'phase' directly is not allowed; it bypasses state machine evidence checks.
151
+ `)}:{}}}};function de(t){return`${mv}${t}${fa}`}function la(t){return`${hv}${t}${fa}`}function qf(t){return`${gv}${t}${fa}`}function b(t){throw new Un(t)}function pe(t){let e=Bs(t);e&&b(`ERROR: ${e}`)}function Yn(t,e){e.includes(t)||b(`ERROR: Invalid value: '${t}'
152
+ Valid values: ${e.join(" ")}`)}function Ii(t,e){if(Df.includes(t))return t;b(`ERROR: Invalid language from ${e}: '${t}'
153
+ Valid values: en, zh-CN`)}function Wf(t,e){!t||t==="null"||(/^(?:[A-Za-z]:|[\\/]|~)/u.test(t)&&b(`ERROR: ${e} must be a relative path within the repo: '${t}'`),t.split(/[\\/]/u).includes("..")&&b(`ERROR: ${e} cannot contain '..' (path traversal not allowed): '${t}'`))}async function U(t){let e=j();return En(e,t,{label:`Classic project path ${O.relative(e,O.resolve(e,t)).replaceAll("\\","/")}`})}async function Pe(t){let e=j();return Ou(e,t,`Classic project file ${O.relative(e,O.resolve(e,t)).replaceAll("\\","/")}`)}async function Sv(t){return Ks(t,j())}async function $i(t){let e,n=j();try{e=await He(n,t,{label:`Classic state ${O.relative(n,t).replaceAll("\\","/")}`})}catch(i){throw i.code==="ENOENT"&&b(`ERROR: .comet.yaml not found at ${O.relative(n,t).replaceAll("\\","/")}`),i}let r=(0,Gn.parseDocument)(e,{uniqueKeys:!1});return r.errors.length>0&&b(`ERROR: Invalid .comet.yaml: ${r.errors[0].message}`),r}async function pa(t,e){await ju(j(),t,e,{label:"Classic state write target"})}function ua(t){return t===null?"null":t===void 0?"":typeof t=="object"?JSON.stringify(t):String(t)}function Mf(t){return kv[t]??String(t)}function Ff(t){return t===null?"null":ua(t)}function H(t,e,n,r){let i=t[e];return typeof i=="string"&&n.includes(i)?i:r}function Re(t,e){let n=t[e];return n==null||n===""?null:typeof n=="string"?n:String(n)}function aa(t,e){let n=t[e];return n==null||n===""?null:typeof n=="boolean"?n:n==="true"?!0:n==="false"?!1:null}function Cv(t,e,n=0){let r=t[e];return typeof r=="number"&&Number.isInteger(r)&&r>=0?r:n}function Ev(t){let e=H(t,"workflow",Kn,"full");return{workflow:e,language:H(t,"language",Df,null),phase:H(t,"phase",da,"open"),contextCompression:H(t,"context_compression",["off","beta"],null),buildMode:H(t,"build_mode",["subagent-driven-development","executing-plans","direct"],null),buildPause:H(t,"build_pause",["plan-ready"],null),subagentDispatch:H(t,"subagent_dispatch",["confirmed"],null),tddMode:H(t,"tdd_mode",["tdd","direct"],null),reviewMode:H(t,"review_mode",["off","standard","thorough"],null),isolation:H(t,"isolation",["current","branch","worktree"],null),boundBranch:Re(t,"bound_branch"),verifyMode:H(t,"verify_mode",["light","full"],null),autoTransition:aa(t,"auto_transition"),baseRef:Re(t,"base_ref"),designDoc:Re(t,"design_doc"),plan:Re(t,"plan"),verifyResult:H(t,"verify_result",["pending","pass","fail"],"pending"),verifyFailures:Cv(t,"verify_failures"),verificationReport:Re(t,"verification_report"),branchStatus:H(t,"branch_status",["pending","handled"],null),createdAt:Re(t,"created_at"),verifiedAt:Re(t,"verified_at"),archiveConfirmation:H(t,"archive_confirmation",["pending","confirmed"],null),archived:aa(t,"archived")??!1,directOverride:aa(t,"direct_override"),handoffContext:Re(t,"handoff_context"),handoffHash:Re(t,"handoff_hash"),classicProfile:H(t,"classic_profile",Kn,e),classicMigration:typeof t.classic_migration=="number"?t.classic_migration:null}}async function ma(t){return(await sa(t,{cwd:j()}))?.value??null}async function Bf(){if(process.env.COMET_LANGUAGE)return Ii(process.env.COMET_LANGUAGE,"COMET_LANGUAGE");let t=await sa("language",{cwd:j()});return t?Ii(t.value,t.source):"en"}async function Rv(){let t=process.env.COMET_CONTEXT_COMPRESSION??await ma("context_compression")??"off";return["off","beta"].includes(t)||b(`ERROR: Invalid context_compression: '${t}'
154
+ Valid values: off, beta`),t}async function Kf(){let t=process.env.COMET_AUTO_TRANSITION??await ma("auto_transition")??"true";return["true","false"].includes(t)||b(`ERROR: Invalid auto_transition: '${t}'
155
+ Valid values: true, false`),t}async function _v(){let t=process.env.COMET_REVIEW_MODE??await ma("review_mode")??"standard";return["null","off","standard","thorough"].includes(t)||b(`ERROR: Invalid review_mode: '${t}'
156
+ Valid values: off, standard, thorough`),t==="null"?null:t}function Uf(t){let e=dv("git",t,{cwd:j(),encoding:"utf8"});return e.status===0?e.stdout.trim():null}async function we(t){let e=await Sv(t);return await Ve(j(),O.join(e.directory,".comet"),{label:`Classic runtime directory for ${t}`,expected:"directory"}),{...e,file:O.join(e.directory,".comet.yaml")}}async function C(t,e){let{file:n}=await we(t),o=(await $i(n)).toJS()[e];return e==="language"?o==null||o===""?Bf():Ii(ua(o),".comet.yaml"):e==="auto_transition"&&(o==null||o==="")?Kf():ua(o)}function Yf(t,e){let n=(0,Gn.parseDocument)(`${t}: ${e}
157
+ `);return n.errors.length>0&&b(`ERROR: Invalid value: '${e}'`),n.get(t)}async function xv(t,e){if(t==="language"){Ii(e,"language");return}let n=vv[t];n&&Yn(e,n),bv.has(t)&&(Wf(e,t),e&&e!=="null"&&await Ve(j(),e,{label:`${t} artifact pointer`,expected:"file"})),(t==="skill_hash"||t==="handoff_hash")&&!/^[a-f0-9]{64}$/u.test(e)&&b(`ERROR: ${t} must be a sha256 hex digest`),t==="iteration"&&!/^[0-9]+$/u.test(e)&&b("ERROR: iteration must be a non-negative integer")}async function Gf(t,e,n,r,i={}){ca.has(n)&&!i.machineOwned&&b(`ERROR: '${n}' is a machine-owned field and cannot be set directly`),!yv.has(n)&&!ca.has(n)&&b(`ERROR: Unknown field: '${n}'`),n==="phase"&&!i.internal&&process.env.COMET_FORCE_PHASE!=="1"&&b(`ERROR: Setting 'phase' directly is not allowed; it bypasses state machine evidence checks.
158
158
  Use: comet-state.mjs transition <change-name> <event>
159
- Repair-only escape hatch: COMET_FORCE_PHASE=1 comet-state.mjs set <change-name> phase <value>`),await Gy(n,i);let{file:s,directory:o}=await ge(e),a=await Rr(s),c=a.toJS()??{};if(a.set(n,Pf(n,i)),n==="isolation")if(Vi(i)){let u=typeof c.isolation=="string"?c.isolation:null,d=c.bound_branch;if(!(typeof d=="string"&&d!=="")||u!==i){let g=qn(),p=Yi(g),h=ho({isolation:i,boundBranch:null,currentBranch:p,gitWorkTree:p===null?mo(g):!0});h.status==="needs-heal"?a.set("bound_branch",h.branch):h.status==="unbound-detached"?b(`ERROR: cannot bind isolation=${i} while HEAD is detached; checkout a branch first`):a.set("bound_branch",null)}}else a.set("bound_branch",null);let l=await _n(o),f=On(a.toJS(),l);if(f.run){f.classic||b("ERROR: migrated Run is missing its Classic projection");let u=await Pt(o,f),d=Ot(f.classic,u),m=d!==f.run.currentStep,g={...f.run,currentStep:d,iteration:f.run.iteration+(m?1:0),status:d==="completed"?"completed":"running"};if(await xt(o,{classic:f.classic,run:g,unknownKeys:f.unknownKeys}),m){let p=await Nt(o,g.trajectoryRef);await rt(o,g.trajectoryRef,{sequence:p.length+1,timestamp:new Date().toISOString(),type:"state_transitioned",runId:g.runId,data:{kind:"classic-config",field:n,fromStep:f.run.currentStep,toStep:d}})}}else await Zo(s,a.toString());n==="phase"&&!r.internal&&t.stderr.push(bf("WARNING: Setting 'phase' directly bypasses state machine constraints."),bf(" Consider using: comet-state.mjs transition <change-name> <event>")),t.stderr.push(ue(`[SET] ${n}=${i}`))}async function zy(t,e,n){fe(e),Er(n,Ln);let i=await ku(e,T()),{label:r,directory:s}=i,o=O.join(s,".comet.yaml");await K(o)&&b(`ERROR: .comet.yaml already exists at ${r}/.comet.yaml`);let a=n!=="full",c=a?"off":await Hy(),l=new Mn.Document({workflow:n,language:await Rf(),phase:"open",context_compression:await Jy(),build_mode:a?"direct":null,build_pause:null,subagent_dispatch:null,tdd_mode:a?"direct":null,review_mode:c,isolation:null,verify_mode:a?"light":null,auto_transition:await _f()==="true",base_ref:xf(["rev-parse","--verify","HEAD"]),design_doc:null,plan:null,verify_result:"pending",verify_failures:0,verification_report:null,branch_status:"pending",created_at:new Date().toISOString().slice(0,10),verified_at:null,archive_confirmation:null,archived:!1});await Zo(o,l.toString()),t.stdout.push(ue(`Initialized: ${r}/.comet.yaml (workflow=${n})`))}async function Ce(t,e){let n=await C(t,"phase");n!==e&&b(`ERROR: Cannot transition '${t}': expected phase ${e}, got ${n}`)}async function Xy(t){let e=await C(t,"workflow"),n=await C(t,"build_mode"),i=await C(t,"isolation"),r=await C(t,"direct_override"),s=await C(t,"subagent_dispatch"),o=await C(t,"tdd_mode"),a=await C(t,"review_mode");["current","branch","worktree"].includes(i)||b(`ERROR: Cannot transition '${t}': isolation must be current, branch, or worktree, got '${i||"null"}'`),["subagent-driven-development","executing-plans","direct"].includes(n)||b(`ERROR: Cannot transition '${t}': build_mode must be selected before leaving build, got '${n||"null"}'`),n==="direct"&&!["hotfix","tweak"].includes(e)&&r!=="true"&&b(`ERROR: Cannot transition '${t}': build_mode=direct is only allowed for hotfix/tweak unless direct_override=true`),n==="subagent-driven-development"&&s!=="confirmed"&&b(`ERROR: Cannot transition '${t}': subagent_dispatch must be confirmed before using build_mode=subagent-driven-development`),e==="full"&&(!o||o==="null")&&b(`ERROR: Cannot transition '${t}': tdd_mode must be selected before leaving build (full workflow)`),e==="full"&&!["off","standard","thorough"].includes(a)&&b(`ERROR: Cannot transition '${t}': review_mode must be selected before leaving build (full workflow); review_mode must be off, standard, or thorough, got '${a||"null"}'`)}async function Qy(t){let{directory:e}=await ge(t),n=await C(t,"workflow");for(let i of["proposal.md","tasks.md"])await Re(O.join(e,i))||b(`ERROR: Cannot transition '${t}': ${i} must exist and be non-empty before leaving open`);n==="full"&&!await Re(O.join(e,"design.md"))&&b(`ERROR: Cannot transition '${t}': design.md must exist and be non-empty before leaving open`)}async function Zy(t){let e=await C(t,"design_doc");(!e||e==="null"||!await Re(O.resolve(e)))&&b(`ERROR: Cannot transition '${t}': design_doc must point to an existing Design Doc before leaving design`)}async function ev(t,e){let n=O.join(t,".comet.yaml"),i=await Rr(n);for(let r of e){let s=Cf(r.field);i.set(s,Pf(s,Ef(r.to)))}await Zo(n,i.toString())}async function tv(t,e,n){let{directory:i}=await ge(e),r=await me(i),s=r.classic,o=!1;if(!s){r.run&&b("ERROR: Classic state projection is missing");let c=await Rr(O.join(i,".comet.yaml"));s=Vy(c.toJS()),o=!0}let a=wf(s,n);r.run?await hf(i,a.classic,r.run,{event:n,source:"comet-state"}):o?await ev(i,a.effects):await xt(i,{classic:a.classic,run:null,unknownKeys:r.unknownKeys}),await Yo(i,{change:e,event:n,source:"comet-state",from:s,to:a.classic,effects:a.effects});for(let c of a.effects)t.stderr.push(ue(`[SET] ${Cf(c.field)}=${Ef(c.to)}`));t.stderr.push(ue(`[TRANSITION] ${n}`))}async function nv(t,e,n){if(fe(e),Er(n,My),n==="open-complete")await Ce(e,"open"),await Qy(e);else if(n==="design-complete")await Ce(e,"design"),await Zy(e);else if(n==="build-complete")await Ce(e,"build"),await Xy(e);else if(n==="verify-pass"){await Ce(e,"verify");let i=await C(e,"verification_report");(!i||!await K(O.resolve(i)))&&b(`ERROR: Cannot transition '${e}': verification_report must point to an existing report file`)}else if(n==="verify-fail")await Ce(e,"verify");else if(n==="archive-confirm")await Ce(e,"archive"),await C(e,"verify_result")!=="pass"&&b(`ERROR: Cannot transition '${e}': verify_result must be pass before archiving`),await C(e,"archived")==="true"&&b(`ERROR: Cannot transition '${e}': already archived`);else if(n==="preset-escalate"){await Ce(e,"build");let i=await C(e,"workflow");["hotfix","tweak"].includes(i)||b(`ERROR: Cannot transition '${e}': preset-escalate only applies to hotfix/tweak, got workflow='${i}'`)}else n==="archive-reopen"?(await Ce(e,"archive"),await C(e,"archived")==="true"&&b(`ERROR: Cannot transition '${e}': already archived`)):(await Ce(e,"archive"),await C(e,"verify_result")!=="pass"&&b(`ERROR: Cannot transition '${e}': verify_result must be pass before archiving`),await C(e,"archive_confirmation")!=="confirmed"&&b(`ERROR: Cannot transition '${e}': archive_confirmation must be confirmed before archiving`));await tv(t,e,n)}async function iv(t,e){fe(e);let{file:n,label:i}=await ge(e);await K(n)||b(`ERROR: .comet.yaml not found at ${i}/.comet.yaml`);let r=await C(e,"phase"),s=await C(e,"workflow"),o=await C(e,"auto_transition");if(await C(e,"archived")==="true"){t.stdout.push("NEXT: done");return}let a=r==="open"?"comet-open":r==="design"?"comet-design":r==="verify"?"comet-verify":r==="archive"?"comet-archive":r==="build"?s==="hotfix"?"comet-hotfix":s==="tweak"?"comet-tweak":"comet-build":null;a||b(`ERROR: Cannot resolve next step for '${e}': unknown phase '${r||"null"}'`),t.stdout.push(`NEXT: ${o==="false"?"manual":"auto"}`,`SKILL: ${a}`),o==="false"&&t.stdout.push(`HINT: phase is '${r}'; run /${a} manually to continue`)}async function rv(t,e,n){Sf(e,"task file"),n||b("ERROR: Task text cannot be empty");let i=O.resolve(T(),e);await K(i)||b(`ERROR: Task file not found: ${e}`);let s=(await Ue(T(),i,{label:"Classic task-checkoff file"})).split(/\r?\n/u).filter(a=>[`- [ ] ${n}`,`- [x] ${n}`,`- [X] ${n}`].includes(a)),o=s.filter(a=>/^- \[[xX]\] /u.test(a));s.length!==1&&b(`ERROR: task text must appear exactly once in ${e} (found ${s.length}): ${n}`),o.length!==1&&b(`ERROR: task is not checked in ${e}: ${n}`),t.stdout.push("TASK_CHECKOFF: PASS",`FILE: ${e}`,`TASK: ${n}`)}async function sv(t,e,n){fe(e),Er(n,Qo);let{file:i,directory:r,label:s}=await ge(e);t.stdout.push(`=== Entry Check: comet-${n} ===`),await K(i)||b(`ERROR: .comet.yaml not found at ${s}/.comet.yaml`);let o=!1,a=u=>t.stdout.push(` ${ue("[PASS]")} ${u}`),c=u=>{t.stdout.push(` ${Go("[FAIL]")} ${u}`),o=!0},l=async(u,d)=>{let m=await C(e,u);(m===d?a:c)(`${u}=${m} (expected: ${d})`)};if(a(".comet.yaml exists"),await l("phase",n),n==="design"){await l("workflow","full");let u=await C(e,"design_doc");(!u||u==="null"?a:c)(u?`design_doc=${u} (expected: empty/null)`:"design_doc is empty/null");for(let d of["proposal.md","design.md","tasks.md"])(await Re(O.join(r,d))?a:c)(`${d} ${await Re(O.join(r,d))?"non-empty":"missing or empty"}`)}else if(n==="build"){let u=await C(e,"workflow"),d=await C(e,"design_doc");u==="full"?(d&&d!=="null"&&await K(O.resolve(d))?a:c)(`design_doc=${d} (expected: non-null and file exists)`):a(`workflow=${u} (design_doc not required)`);for(let m of["proposal.md","tasks.md"])(await Re(O.join(r,m))?a:c)(`${m} ${await Re(O.join(r,m))?"non-empty":"missing or empty"}`)}else if(n==="verify"){let u=await C(e,"verify_result");(["","null","pending"].includes(u)?a:c)(`verify_result=${u} (expected: pending or null)`)}else if(n==="archive"){await l("verify_result","pass");let u=await C(e,"archived");(u!=="true"?a:c)(`archived=${u} (expected: not true)`)}let f=await dn(r,{heal:!0,cwd:qn()});if(f.bindingRequired)switch(f.status){case"drift":c(nu(e,f.boundBranch,f.currentBranch));break;case"unbound-detached":c(pn(e));break;case"healed":a(`bound_branch lazily set to ${f.branch}`);break;case"needs-heal":case"ok":case"not-applicable":a("bound_branch matches current branch");break;default:{let u=f;throw new Error(`unhandled branch binding status: ${JSON.stringify(u)}`)}}if(t.stdout.push(""),o)throw t.stderr.push(Go("BLOCKED — fix failing checks before proceeding")),new Dn("",1);t.stderr.push(ue("ALL CHECKS PASSED — ready to proceed"))}async function Y(t,e,n){return!e||e==="null"?` - ${t}: PENDING`:n&&!await K(O.resolve(n))?` - ${t}: BROKEN (path ${e} does not exist)`:` - ${t}: DONE (${e})`}async function ov(t,e){t.stdout.push(" Artifacts:");let n=0;for(let i of["proposal.md","design.md","tasks.md"]){let r=await Re(O.join(e,i));r&&(n+=1),t.stdout.push(` - ${i}: ${r?"DONE":"PENDING"}`)}t.stdout.push("",n===3?"Recovery action: All artifacts complete. Run /comet-open user confirmation, then guard to transition.":n===0?"Recovery action: No artifacts created yet. Start from /comet-open Step 1 (explore and clarify).":"Recovery action: Some artifacts incomplete. Resume /comet-open from the first missing artifact.")}async function av(t,e,n){t.stdout.push(" Artifacts:");for(let o of["proposal.md","design.md","tasks.md"])t.stdout.push(` - ${o}: ${await Re(O.join(n,o))?"DONE":"MISSING (unexpected in design phase)"}`);let i=await C(e,"handoff_context"),r=await C(e,"handoff_hash"),s=await C(e,"design_doc");t.stdout.push(""," Design progress:",await Y("handoff_context",i,i),await Y("handoff_hash",r),await Y("design_doc",s,s),""),s&&s!=="null"&&await K(O.resolve(s))?t.stdout.push("Recovery action: Design Doc already created and linked. Run guard to transition to build."):i&&i!=="null"&&await K(O.resolve(i))?t.stdout.push("Recovery action: Handoff generated but Design Doc not yet created. Resume from brainstorming confirmation (Step 1c)."):t.stdout.push("Recovery action: No handoff generated yet. Start from Step 1a (generate handoff package).")}async function cv(t,e,n,i){let r=await C(e,"isolation"),s=await C(e,"build_mode"),o=await C(e,"build_pause"),a=await C(e,"subagent_dispatch"),c=await C(e,"tdd_mode"),l=await C(e,"review_mode"),f=await C(e,"plan"),u=await vf(T(),f),d=[" Build decisions:",await Y("isolation",r),await Y("build_mode",s),await Y("build_pause",o),await Y("tdd_mode",c),await Y("review_mode",l)];(s==="subagent-driven-development"||a&&a!=="null")&&d.push(await Y("subagent_dispatch",a)),t.stdout.push(...d,""," Plan:",await Y("plan",f,f),"");let m=O.join(n,"tasks.md");if(!await K(m)){t.stdout.push(" Tasks: tasks.md MISSING","","Recovery action: tasks.md missing. Verify change directory integrity.");return}let g=(await Ue(T(),m,{label:"Classic change tasks"})).split(/\r?\n/u),p=g.filter(E=>/^\s*- \[[ xX]\] /u.test(E)).length,h=g.filter(E=>/^\s*- \[[xX]\] /u.test(E)).length,v=p-h,y=0,S=0;if(u.status==="ready"){let E=(await Ue(T(),f,{label:"Classic build plan"})).split(/\r?\n/u);y=E.filter(N=>/^\s*- \[[ xX]\] /u.test(N)).length,S=E.filter(N=>/^\s*- \[[xX]\] /u.test(N)).length}let R=y-S;t.stdout.push(` Tasks: ${h}/${p} done, ${v} pending`),y>0&&t.stdout.push(` Plan tasks: ${S}/${y} done, ${R} pending`),t.stdout.push("");let _=lv(e,O.relative(T(),n).replaceAll("\\","/"),i,r,s,o,a,c,l,u,v,R);t.stdout.push(_)}function Je(t){return!t||t==="null"}function lv(t,e,n,i,r,s,o,a,c,l,f,u){let d=l.status==="ready",m=n==="full"&&(Je(a)||Je(c));return s==="plan-ready"&&d&&(Je(i)||Je(r)||m)?n==="full"?"Recovery action: Plan-ready pause detected. Ask the user whether to continue, then choose isolation, build mode, TDD mode, and review mode without regenerating the plan.":"Recovery action: Plan-ready pause detected. Ask the user whether to continue, then choose isolation and build mode without regenerating the plan.":n==="full"&&!d?uv(t,e,l):s==="plan-ready"?r==="subagent-driven-development"&&(f>0||u>0)?o==="confirmed"?"Recovery action: Plan-ready pause is stale because build decisions are already selected. Clear build_pause to null, then inspect the first unchecked task (OpenSpec or plan additions) against recent git history/diff. If implemented, check it off; otherwise dispatch a subagent. Do not execute the pending task directly in the main window.":"Recovery action: Plan-ready pause is stale and selected subagent execution is not recorded. Run comet state set <change-name> subagent_dispatch confirmed, then continue from the first unchecked task through subagent execution.":f>0||u>0?"Recovery action: Plan-ready pause is stale because build decisions are already selected. Clear build_pause to null, then continue from the first unchecked task.":"Recovery action: Plan-ready pause is stale and all tasks are done. Clear build_pause to null, then run guard to transition to verify.":Je(i)?"Recovery action: Isolation not selected. Use the current platform's user confirmation mechanism to ask user for branch/worktree choice.":Je(r)?"Recovery action: Build mode not selected. Use the current platform's user confirmation mechanism to ask user for execution method.":n==="full"&&Je(a)?"Recovery action: TDD mode not selected. Use the current platform's user confirmation mechanism to ask user for tdd or direct.":n==="full"&&Je(c)?"Recovery action: Review mode not selected. Use the current platform's user confirmation mechanism to ask user for off, standard, or thorough.":f>0?r==="subagent-driven-development"?o==="confirmed"?"Recovery action: Read tasks.md and the Superpowers plan (which may include additions beyond OpenSpec), then inspect the first unchecked task against recent git history/diff. If implemented, check it off; otherwise dispatch a subagent. Do not execute the pending task directly in the main window.":"Recovery action: Selected subagent execution is not recorded. Run comet state set <change-name> subagent_dispatch confirmed, then continue from the first unchecked task through subagent execution.":"Recovery action: Read tasks.md and continue from first unchecked task.":u>0?r==="subagent-driven-development"?o==="confirmed"?"Recovery action: Read the Superpowers plan, then inspect the first unchecked Superpowers plan task against recent git history/diff. If implemented, check it off; otherwise dispatch a subagent. Do not execute the pending task directly in the main window.":"Recovery action: Selected subagent execution is not recorded. Run comet state set <change-name> subagent_dispatch confirmed, then continue from the first unchecked task through subagent execution.":"Recovery action: Read the Superpowers plan and continue from the first unchecked plan task.":"Recovery action: All tasks done. Run guard to transition to verify."}function uv(t,e,n){let i=n.status==="missing",r=i?"classic-build-plan-missing":"classic-build-plan-broken",s=i?"plan is not recorded":"the recorded plan path does not resolve to a file",o=i?[]:[`RECORDED_PLAN: ${n.recordedPath}`],a=i?`comet state set ${t} plan <repository-relative-plan-path>`:`comet state set ${t} plan <new-repository-relative-plan-path>`,c=i?["2. Load the Superpowers writing-plans Skill.",`3. Read the Design Doc path from "comet state get ${t} design_doc" and read ${e}/tasks.md.`,"4. Create the implementation plan under docs/superpowers/plans/.","5. Record the plan path:",` ${a}`]:[`2. Restore the plan file at ${n.recordedPath}, or load the Superpowers writing-plans Skill and create a replacement under docs/superpowers/plans/.`,"3. When creating a replacement, record its path:",` ${a}`];return["COMET_RECOVERY: required",`ERROR_CODE: ${r}`,`CHANGE: ${t}`,"WORKFLOW: full","PHASE: build",`STATE: ${s}`,...o,"","ALLOWED_RECOVERY_WRITES:","- docs/superpowers/plans/<plan-file>.md","- Comet state updates performed by the comet CLI",`- ${e} artifacts allowed by the build phase`,"","RECOVERY:",`1. Resume /comet-build for ${t} and return to Step 1.`,...c,`${i?"6":"4"}. Verify recovery:`,` comet state check ${t} build --recover`,"","SUCCESS: plan is reported as DONE and recovery no longer returns classic-build-plan-missing or classic-build-plan-broken.","RETRY: resume build configuration or retry the blocked Write/Edit only after SUCCESS.","PROHIBITED: do not execute tasks.md or write project source before SUCCESS; tasks.md is not a substitute for the implementation plan.","If writing-plans is unavailable, stop and report the missing Skill instead of bypassing this recovery."].join(`
160
- `)}async function fv(t,e){let n=await C(e,"verify_result"),i=await C(e,"verify_failures"),r=await C(e,"verify_mode"),s=await C(e,"verification_report"),o=await C(e,"branch_status");t.stdout.push(" Verification:",await Y("verify_result",n),` - verify_failures: ${i||"0"}`,await Y("verify_mode",r),await Y("verification_report",s,s),o==="handled"?" - branch_status: LEGACY (handled before archive; archive still owns final closure)":" - branch_status: DEFERRED (handled after the archive commit)","",n==="pass"?"Recovery action: Verification complete. Continue to archive; branch handling happens after archive changes are committed.":n==="fail"?"Recovery action: Verification failed and rolled back to build. Resume from /comet-build.":"Recovery action: Verification not yet started or in progress. Run scale assessment then verify.")}async function dv(t,e){let n=await C(e,"archive_confirmation");t.stdout.push(" Archive:",await Y("verify_result",await C(e,"verify_result")),await Y("archive_confirmation",n),await Y("archived",await C(e,"archived")),"",n==="confirmed"?"Recovery action: Archive is confirmed. Run /comet-archive to complete archiving.":"Recovery action: Ask for final archive confirmation in /comet-archive before running the archive command.")}async function pv(t,e){fe(e);let{file:n,directory:i,label:r}=await ge(e);await K(n)||b(`ERROR: .comet.yaml not found at ${r}/.comet.yaml`);let s=await C(e,"phase"),o=await C(e,"workflow");t.stdout.push(`=== Recovery Context: ${e} ===`,`Phase: ${s}`,`Workflow: ${o}`,"","State fields:"),s==="open"?await ov(t,i):s==="design"?await av(t,e,i):s==="build"?await cv(t,e,i,o):s==="verify"?await fv(t,e):s==="archive"?await dv(t,e):b(`ERROR: Unknown phase: ${s}`),t.stdout.push("","=== End Recovery Context ===")}async function mv(t,e){fe(e);let{file:n,directory:i,label:r}=await ge(e);await K(n)||b(`ERROR: .comet.yaml not found at ${r}/.comet.yaml`);let s=O.join(i,"tasks.md"),o=await K(s)?(await Ue(T(),s,{label:"Classic scale task file"})).split(/\r?\n/u).filter(g=>/^- \[/u.test(g)).length:0,a=O.join(i,"specs"),c=0;if(await K(a))for(let g of await $y.readdir(a))await K(O.join(a,g,"spec.md"))&&(c+=1);let l=await C(e,"plan"),f="";l&&l!=="null"&&await K(l)&&(f=(await Ue(T(),l,{label:"Classic scale plan"})).match(/^base-ref:\s*(.+)$/mu)?.[1].trim()??""),f||(f=await C(e,"base_ref"));let u=xf(["diff","--name-only",...f&&f!=="null"?[`${f}...HEAD`]:["HEAD"]]),d=u?u.split(/\r?\n/u).filter(Boolean).length:0,m=o>3||c>1||d>8?"full":"light";await Of(new Sr,e,"verify_mode",m),t.stderr.push(`=== Scale Assessment: ${e} ===`,` Tasks: ${o} (threshold: 3)`,` Delta specs: ${c} capabilities (threshold: 1)`,` Changed files: ${d} (threshold: 8)`,` → Result: ${m}`,ue(`[SCALE] verify_mode=${m}`))}function hv(t){let e,n,i;for(let r=0;r<t.length;r+=2){let s=t[r];["--command","--exit-code","--cwd"].includes(s)||b(`ERROR: Unknown option: ${s}`);let o=t[r+1];o===void 0&&b(`ERROR: Missing value for option: ${s}`),s==="--command"?e=o:s==="--exit-code"?n=o:i=o}return e===void 0&&b("ERROR: Missing option: --command"),n===void 0&&b("ERROR: Missing option: --exit-code"),/^-?\d+$/u.test(n)||b("ERROR: --exit-code must be an integer"),{command:e,exitCode:Number(n),...i===void 0?{}:{cwd:i}}}async function gv(t,e,n,i){fe(e),n!=="build"&&n!=="verify"&&b(`ERROR: Invalid command check scope: '${n}'`);let r=hv(i),{directory:s,file:o}=await ge(e),a=T(),c=(await ee(a)).changesDir;(O.dirname(s)!==c||!await K(o))&&b(`ERROR: command checks require an active change: ${e}`);try{let l=await me(s,{migrate:!1});if(!l.classic||!l.run)throw new Error("command checks require an existing synchronized Classic Run");let{run:f}=await mf(s,l),u=await yf(a,s,f,{scope:n,...r,cwd:r.cwd??(O.relative(a,qn()).replaceAll("\\","/")||".")});t.stderr.push(ue(`[RECORDED] ${u.scope} exit=${u.exitCode} cwd=${u.cwd} command=${u.command}`))}catch(l){b(`ERROR: ${l.message}`)}}function Ee(t,e,n){t.length<e&&b(n)}function kr(t,e,n){t.length!==e&&b(n)}var wv=new Set(["init","set","transition","check","scale","record-check","rebind","select","clear-selection"]);async function yv(t){if(!(!t||!wv.has(t)))try{await tr(T())}catch(e){b(`ERROR: ${e instanceof Error?e.message:String(e)}`)}}async function vv(t,e){fe(e);try{let n=await Fu(T(),e),i=await C(e,"bound_branch"),r=i&&i!=="null"?i:null;t.stderr.push(ue(`[SELECTED] current change: ${n.change}${r?` (branch: ${r})`:""}`))}catch(n){b(`ERROR: ${n instanceof Error?n.message:String(n)}`)}}async function bv(t,e){fe(e);let{directory:n}=await ge(e),i=await C(e,"bound_branch");(!i||i==="null")&&b(`ERROR: '${e}' is not yet bound; use 'comet state set ${e} isolation <current|branch|worktree>' to establish the first binding`);let r=Yi(qn());r===null&&b("ERROR: cannot rebind while HEAD is detached; checkout a branch first");let s=await me(n);s.classic||b("ERROR: Classic state projection is missing"),await go(n,r);let o={...s.classic,boundBranch:r};await Yo(n,{change:e,event:"rebind",source:"comet-state",from:s.classic,to:o,effects:[{field:"boundBranch",from:i,to:r}]}),t.stderr.push(ue(`[REBIND] bound_branch: ${i} → ${r}`))}async function kv(t){let e=await Wu(T());if(e.status==="selected"){t.stdout.push(e.selection.change);return}e.status==="missing"&&b(`ERROR: no current change selected
159
+ Repair-only escape hatch: COMET_FORCE_PHASE=1 comet-state.mjs set <change-name> phase <value>`),await xv(n,r);let{file:o,directory:s}=await we(e),a=await $i(o),c=a.toJS()??{};if(a.set(n,Yf(n,r)),n==="isolation")if(ei(r)){let u=typeof c.isolation=="string"?c.isolation:null,d=c.bound_branch;if(!(typeof d=="string"&&d!=="")||u!==r){let g=Bn(),p=gn(g),h=Rs({isolation:r,boundBranch:null,currentBranch:p,gitWorkTree:p===null?Es(g):!0});h.status==="needs-heal"?a.set("bound_branch",h.branch):h.status==="unbound-detached"?b(`ERROR: cannot bind isolation=${r} while HEAD is detached; checkout a branch first`):a.set("bound_branch",null)}}else a.set("bound_branch",null);let l=await An(s),f=Tn(a.toJS(),l);if(f.run){f.classic||b("ERROR: migrated Run is missing its Classic projection");let u=await jt(s,f),d=Tt(f.classic,u),m=d!==f.run.currentStep,g={...f.run,currentStep:d,iteration:f.run.iteration+(m?1:0),status:d==="completed"?"completed":"running"};if(await Nt(s,{classic:f.classic,run:g,unknownKeys:f.unknownKeys}),m){let p=await It(s,g.trajectoryRef);await ut(s,g.trajectoryRef,{sequence:p.length+1,timestamp:new Date().toISOString(),type:"state_transitioned",runId:g.runId,data:{kind:"classic-config",field:n,fromStep:f.run.currentStep,toStep:d}})}}else await pa(o,a.toString());n==="phase"&&!i.internal&&t.stderr.push(qf("WARNING: Setting 'phase' directly bypasses state machine constraints."),qf(" Consider using: comet-state.mjs transition <change-name> <event>")),t.stderr.push(de(`[SET] ${n}=${r}`))}async function Pv(t,e,n,r=null){pe(e),Yn(n,Kn),r!==null&&Yn(r,["current","branch","worktree"]);let i=r!==null?gn(j()):null;r!==null&&r!=="current"&&i===null&&b(`ERROR: cannot bind isolation=${r} while HEAD is detached; checkout a branch first`);let o=await Tu(e,j()),{label:s,directory:a}=o,c=O.join(a,".comet.yaml");await U(c)&&b(`ERROR: .comet.yaml already exists at ${s}/.comet.yaml`);let l=n!=="full",f=l?"off":await _v(),u=new Gn.Document({workflow:n,language:await Bf(),phase:"open",context_compression:await Rv(),build_mode:l?"direct":null,build_pause:null,subagent_dispatch:null,tdd_mode:l?"direct":null,review_mode:f,isolation:r,verify_mode:l?"light":null,auto_transition:await Kf()==="true",base_ref:Uf(["rev-parse","--verify","HEAD"]),design_doc:null,plan:null,verify_result:"pending",verify_failures:0,verification_report:null,branch_status:"pending",created_at:new Date().toISOString().slice(0,10),verified_at:null,archive_confirmation:null,archived:!1});r!==null&&u.set("bound_branch",i),await pa(c,u.toString()),t.stdout.push(de(`Initialized: ${s}/.comet.yaml (workflow=${n})`))}async function _e(t,e){let n=await C(t,"phase");n!==e&&b(`ERROR: Cannot transition '${t}': expected phase ${e}, got ${n}`)}async function Ov(t){let e=await C(t,"workflow"),n=await C(t,"build_mode"),r=await C(t,"isolation"),i=await C(t,"direct_override"),o=await C(t,"subagent_dispatch"),s=await C(t,"tdd_mode"),a=await C(t,"review_mode");["current","branch","worktree"].includes(r)||b(`ERROR: Cannot transition '${t}': isolation must be current, branch, or worktree, got '${r||"null"}'`),["subagent-driven-development","executing-plans","direct"].includes(n)||b(`ERROR: Cannot transition '${t}': build_mode must be selected before leaving build, got '${n||"null"}'`),n==="direct"&&!["hotfix","tweak"].includes(e)&&i!=="true"&&b(`ERROR: Cannot transition '${t}': build_mode=direct is only allowed for hotfix/tweak unless direct_override=true`),n==="subagent-driven-development"&&o!=="confirmed"&&b(`ERROR: Cannot transition '${t}': subagent_dispatch must be confirmed before using build_mode=subagent-driven-development`),e==="full"&&(!s||s==="null")&&b(`ERROR: Cannot transition '${t}': tdd_mode must be selected before leaving build (full workflow)`),e==="full"&&!["off","standard","thorough"].includes(a)&&b(`ERROR: Cannot transition '${t}': review_mode must be selected before leaving build (full workflow); review_mode must be off, standard, or thorough, got '${a||"null"}'`)}async function Av(t){let{directory:e}=await we(t),n=await C(t,"workflow");for(let r of["proposal.md","tasks.md"])await Pe(O.join(e,r))||b(`ERROR: Cannot transition '${t}': ${r} must exist and be non-empty before leaving open`);n==="full"&&!await Pe(O.join(e,"design.md"))&&b(`ERROR: Cannot transition '${t}': design.md must exist and be non-empty before leaving open`)}async function Nv(t){let e=await C(t,"design_doc");(!e||e==="null"||!await Pe(O.resolve(e)))&&b(`ERROR: Cannot transition '${t}': design_doc must point to an existing Design Doc before leaving design`)}async function jv(t,e){let n=O.join(t,".comet.yaml"),r=await $i(n);for(let i of e){let o=Mf(i.field);r.set(o,Yf(o,Ff(i.to)))}await pa(n,r.toString())}async function Tv(t,e,n){let{directory:r}=await we(e),i=await ue(r),o=i.classic,s=!1;if(!o){i.run&&b("ERROR: Classic state projection is missing");let c=await $i(O.join(r,".comet.yaml"));o=Ev(c.toJS()),s=!0}let a=If(o,n);i.run?await jf(r,a.classic,i.run,{event:n,source:"comet-state"}):s?await jv(r,a.effects):await Nt(r,{classic:a.classic,run:null,unknownKeys:i.unknownKeys}),await oa(r,{change:e,event:n,source:"comet-state",from:o,to:a.classic,effects:a.effects});for(let c of a.effects)t.stderr.push(de(`[SET] ${Mf(c.field)}=${Ff(c.to)}`));t.stderr.push(de(`[TRANSITION] ${n}`))}async function Iv(t,e,n){if(pe(e),Yn(n,wv),n==="open-complete")await _e(e,"open"),await Av(e);else if(n==="design-complete")await _e(e,"design"),await Nv(e);else if(n==="build-complete")await _e(e,"build"),await Ov(e);else if(n==="verify-pass"){await _e(e,"verify");let r=await C(e,"verification_report");(!r||!await U(O.resolve(r)))&&b(`ERROR: Cannot transition '${e}': verification_report must point to an existing report file`)}else if(n==="verify-fail")await _e(e,"verify");else if(n==="archive-confirm")await _e(e,"archive"),await C(e,"verify_result")!=="pass"&&b(`ERROR: Cannot transition '${e}': verify_result must be pass before archiving`),await C(e,"archived")==="true"&&b(`ERROR: Cannot transition '${e}': already archived`);else if(n==="preset-escalate"){await _e(e,"build");let r=await C(e,"workflow");["hotfix","tweak"].includes(r)||b(`ERROR: Cannot transition '${e}': preset-escalate only applies to hotfix/tweak, got workflow='${r}'`)}else n==="archive-reopen"?(await _e(e,"archive"),await C(e,"archived")==="true"&&b(`ERROR: Cannot transition '${e}': already archived`)):(await _e(e,"archive"),await C(e,"verify_result")!=="pass"&&b(`ERROR: Cannot transition '${e}': verify_result must be pass before archiving`),await C(e,"archive_confirmation")!=="confirmed"&&b(`ERROR: Cannot transition '${e}': archive_confirmation must be confirmed before archiving`));await Tv(t,e,n)}async function $v(t,e){pe(e);let{file:n,label:r}=await we(e);await U(n)||b(`ERROR: .comet.yaml not found at ${r}/.comet.yaml`);let i=await C(e,"phase"),o=await C(e,"workflow"),s=await C(e,"auto_transition");if(await C(e,"archived")==="true"){t.stdout.push("NEXT: done");return}let a=i==="open"?"comet-open":i==="design"?"comet-design":i==="verify"?"comet-verify":i==="archive"?"comet-archive":i==="build"?o==="hotfix"?"comet-hotfix":o==="tweak"?"comet-tweak":"comet-build":null;a||b(`ERROR: Cannot resolve next step for '${e}': unknown phase '${i||"null"}'`),t.stdout.push(`NEXT: ${s==="false"?"manual":"auto"}`,`SKILL: ${a}`),s==="false"&&t.stdout.push(`HINT: phase is '${i}'; run /${a} manually to continue`)}async function Lv(t,e,n){Wf(e,"task file"),n||b("ERROR: Task text cannot be empty");let r=O.resolve(j(),e);await U(r)||b(`ERROR: Task file not found: ${e}`);let o=(await He(j(),r,{label:"Classic task-checkoff file"})).split(/\r?\n/u).filter(a=>[`- [ ] ${n}`,`- [x] ${n}`,`- [X] ${n}`].includes(a)),s=o.filter(a=>/^- \[[xX]\] /u.test(a));o.length!==1&&b(`ERROR: task text must appear exactly once in ${e} (found ${o.length}): ${n}`),s.length!==1&&b(`ERROR: task is not checked in ${e}: ${n}`),t.stdout.push("TASK_CHECKOFF: PASS",`FILE: ${e}`,`TASK: ${n}`)}async function qv(t,e,n){pe(e),Yn(n,da);let{file:r,directory:i,label:o}=await we(e);t.stdout.push(`=== Entry Check: comet-${n} ===`),await U(r)||b(`ERROR: .comet.yaml not found at ${o}/.comet.yaml`);let s=!1,a=u=>t.stdout.push(` ${de("[PASS]")} ${u}`),c=u=>{t.stdout.push(` ${la("[FAIL]")} ${u}`),s=!0},l=async(u,d)=>{let m=await C(e,u);(m===d?a:c)(`${u}=${m} (expected: ${d})`)};if(a(".comet.yaml exists"),await l("phase",n),n==="design"){await l("workflow","full");let u=await C(e,"design_doc");(!u||u==="null"?a:c)(u?`design_doc=${u} (expected: empty/null)`:"design_doc is empty/null");for(let d of["proposal.md","design.md","tasks.md"])(await Pe(O.join(i,d))?a:c)(`${d} ${await Pe(O.join(i,d))?"non-empty":"missing or empty"}`)}else if(n==="build"){let u=await C(e,"workflow"),d=await C(e,"design_doc");u==="full"?(d&&d!=="null"&&await U(O.resolve(d))?a:c)(`design_doc=${d} (expected: non-null and file exists)`):a(`workflow=${u} (design_doc not required)`);for(let m of["proposal.md","tasks.md"])(await Pe(O.join(i,m))?a:c)(`${m} ${await Pe(O.join(i,m))?"non-empty":"missing or empty"}`)}else if(n==="verify"){let u=await C(e,"verify_result");(["","null","pending"].includes(u)?a:c)(`verify_result=${u} (expected: pending or null)`)}else if(n==="archive"){await l("verify_result","pass");let u=await C(e,"archived");(u!=="true"?a:c)(`archived=${u} (expected: not true)`)}let f=await wn(i,{heal:!0,cwd:Bn()});if(f.bindingRequired)switch(f.status){case"drift":c(hu(e,f.boundBranch,f.currentBranch));break;case"unbound-detached":c(yn(e));break;case"healed":a(`bound_branch lazily set to ${f.branch}`);break;case"needs-heal":case"ok":case"not-applicable":a("bound_branch matches current branch");break;default:{let u=f;throw new Error(`unhandled branch binding status: ${JSON.stringify(u)}`)}}if(t.stdout.push(""),s)throw t.stderr.push(la("BLOCKED — fix failing checks before proceeding")),new Un("",1);t.stderr.push(de("ALL CHECKS PASSED — ready to proceed"))}async function Y(t,e,n){return!e||e==="null"?` - ${t}: PENDING`:n&&!await U(O.resolve(n))?` - ${t}: BROKEN (path ${e} does not exist)`:` - ${t}: DONE (${e})`}async function Dv(t,e){t.stdout.push(" Artifacts:");let n=0;for(let r of["proposal.md","design.md","tasks.md"]){let i=await Pe(O.join(e,r));i&&(n+=1),t.stdout.push(` - ${r}: ${i?"DONE":"PENDING"}`)}t.stdout.push("",n===3?"Recovery action: All artifacts complete. Run /comet-open user confirmation, then guard to transition.":n===0?"Recovery action: No artifacts created yet. Start from /comet-open Step 1 (explore and clarify).":"Recovery action: Some artifacts incomplete. Resume /comet-open from the first missing artifact.")}async function Wv(t,e,n){t.stdout.push(" Artifacts:");for(let s of["proposal.md","design.md","tasks.md"])t.stdout.push(` - ${s}: ${await Pe(O.join(n,s))?"DONE":"MISSING (unexpected in design phase)"}`);let r=await C(e,"handoff_context"),i=await C(e,"handoff_hash"),o=await C(e,"design_doc");t.stdout.push(""," Design progress:",await Y("handoff_context",r,r),await Y("handoff_hash",i),await Y("design_doc",o,o),""),o&&o!=="null"&&await U(O.resolve(o))?t.stdout.push("Recovery action: Design Doc already created and linked. Run guard to transition to build."):r&&r!=="null"&&await U(O.resolve(r))?t.stdout.push("Recovery action: Handoff generated but Design Doc not yet created. Resume from brainstorming confirmation (Step 1c)."):t.stdout.push("Recovery action: No handoff generated yet. Start from Step 1a (generate handoff package).")}async function Mv(t,e,n,r){let i=await C(e,"isolation"),o=await C(e,"build_mode"),s=await C(e,"build_pause"),a=await C(e,"subagent_dispatch"),c=await C(e,"tdd_mode"),l=await C(e,"review_mode"),f=await C(e,"plan"),u=await Lf(j(),f),d=[" Build decisions:",await Y("isolation",i),await Y("build_mode",o),await Y("build_pause",s),await Y("tdd_mode",c),await Y("review_mode",l)];(o==="subagent-driven-development"||a&&a!=="null")&&d.push(await Y("subagent_dispatch",a)),t.stdout.push(...d,""," Plan:",await Y("plan",f,f),"");let m=O.join(n,"tasks.md");if(!await U(m)){t.stdout.push(" Tasks: tasks.md MISSING","","Recovery action: tasks.md missing. Verify change directory integrity.");return}let g=(await He(j(),m,{label:"Classic change tasks"})).split(/\r?\n/u),p=g.filter(E=>/^\s*- \[[ xX]\] /u.test(E)).length,h=g.filter(E=>/^\s*- \[[xX]\] /u.test(E)).length,v=p-h,y=0,S=0;if(u.status==="ready"){let E=(await He(j(),f,{label:"Classic build plan"})).split(/\r?\n/u);y=E.filter(A=>/^\s*- \[[ xX]\] /u.test(A)).length,S=E.filter(A=>/^\s*- \[[xX]\] /u.test(A)).length}let R=y-S;t.stdout.push(` Tasks: ${h}/${p} done, ${v} pending`),y>0&&t.stdout.push(` Plan tasks: ${S}/${y} done, ${R} pending`),t.stdout.push("");let _=Fv(e,O.relative(j(),n).replaceAll("\\","/"),r,i,o,s,a,c,l,u,v,R);t.stdout.push(_)}function Xe(t){return!t||t==="null"}function Fv(t,e,n,r,i,o,s,a,c,l,f,u){let d=l.status==="ready",m=n==="full"&&(Xe(a)||Xe(c));return o==="plan-ready"&&d&&(Xe(r)||Xe(i)||m)?n==="full"?"Recovery action: Plan-ready pause detected. Ask the user whether to continue, then choose isolation, build mode, TDD mode, and review mode without regenerating the plan.":"Recovery action: Plan-ready pause detected. Ask the user whether to continue, then choose isolation and build mode without regenerating the plan.":n==="full"&&!d?Bv(t,e,l):o==="plan-ready"?i==="subagent-driven-development"&&(f>0||u>0)?s==="confirmed"?"Recovery action: Plan-ready pause is stale because build decisions are already selected. Clear build_pause to null, then inspect the first unchecked task (OpenSpec or plan additions) against recent git history/diff. If implemented, check it off; otherwise dispatch a subagent. Do not execute the pending task directly in the main window.":"Recovery action: Plan-ready pause is stale and selected subagent execution is not recorded. Run comet state set <change-name> subagent_dispatch confirmed, then continue from the first unchecked task through subagent execution.":f>0||u>0?"Recovery action: Plan-ready pause is stale because build decisions are already selected. Clear build_pause to null, then continue from the first unchecked task.":"Recovery action: Plan-ready pause is stale and all tasks are done. Clear build_pause to null, then run guard to transition to verify.":Xe(r)?"Recovery action: Isolation not selected. Use the current platform's user confirmation mechanism to ask user for branch/worktree choice.":Xe(i)?"Recovery action: Build mode not selected. Use the current platform's user confirmation mechanism to ask user for execution method.":n==="full"&&Xe(a)?"Recovery action: TDD mode not selected. Use the current platform's user confirmation mechanism to ask user for tdd or direct.":n==="full"&&Xe(c)?"Recovery action: Review mode not selected. Use the current platform's user confirmation mechanism to ask user for off, standard, or thorough.":f>0?i==="subagent-driven-development"?s==="confirmed"?"Recovery action: Read tasks.md and the Superpowers plan (which may include additions beyond OpenSpec), then inspect the first unchecked task against recent git history/diff. If implemented, check it off; otherwise dispatch a subagent. Do not execute the pending task directly in the main window.":"Recovery action: Selected subagent execution is not recorded. Run comet state set <change-name> subagent_dispatch confirmed, then continue from the first unchecked task through subagent execution.":"Recovery action: Read tasks.md and continue from first unchecked task.":u>0?i==="subagent-driven-development"?s==="confirmed"?"Recovery action: Read the Superpowers plan, then inspect the first unchecked Superpowers plan task against recent git history/diff. If implemented, check it off; otherwise dispatch a subagent. Do not execute the pending task directly in the main window.":"Recovery action: Selected subagent execution is not recorded. Run comet state set <change-name> subagent_dispatch confirmed, then continue from the first unchecked task through subagent execution.":"Recovery action: Read the Superpowers plan and continue from the first unchecked plan task.":"Recovery action: All tasks done. Run guard to transition to verify."}function Bv(t,e,n){let r=n.status==="missing",i=r?"classic-build-plan-missing":"classic-build-plan-broken",o=r?"plan is not recorded":"the recorded plan path does not resolve to a file",s=r?[]:[`RECORDED_PLAN: ${n.recordedPath}`],a=r?`comet state set ${t} plan <repository-relative-plan-path>`:`comet state set ${t} plan <new-repository-relative-plan-path>`,c=r?["2. Load the Superpowers writing-plans Skill.",`3. Read the Design Doc path from "comet state get ${t} design_doc" and read ${e}/tasks.md.`,"4. Create the implementation plan under docs/superpowers/plans/.","5. Record the plan path:",` ${a}`]:[`2. Restore the plan file at ${n.recordedPath}, or load the Superpowers writing-plans Skill and create a replacement under docs/superpowers/plans/.`,"3. When creating a replacement, record its path:",` ${a}`];return["COMET_RECOVERY: required",`ERROR_CODE: ${i}`,`CHANGE: ${t}`,"WORKFLOW: full","PHASE: build",`STATE: ${o}`,...s,"","ALLOWED_RECOVERY_WRITES:","- docs/superpowers/plans/<plan-file>.md","- Comet state updates performed by the comet CLI",`- ${e} artifacts allowed by the build phase`,"","RECOVERY:",`1. Resume /comet-build for ${t} and return to Step 1.`,...c,`${r?"6":"4"}. Verify recovery:`,` comet state check ${t} build --recover`,"","SUCCESS: plan is reported as DONE and recovery no longer returns classic-build-plan-missing or classic-build-plan-broken.","RETRY: resume build configuration or retry the blocked Write/Edit only after SUCCESS.","PROHIBITED: do not execute tasks.md or write project source before SUCCESS; tasks.md is not a substitute for the implementation plan.","If writing-plans is unavailable, stop and report the missing Skill instead of bypassing this recovery."].join(`
160
+ `)}async function Kv(t,e){let n=await C(e,"verify_result"),r=await C(e,"verify_failures"),i=await C(e,"verify_mode"),o=await C(e,"verification_report"),s=await C(e,"branch_status");t.stdout.push(" Verification:",await Y("verify_result",n),` - verify_failures: ${r||"0"}`,await Y("verify_mode",i),await Y("verification_report",o,o),s==="handled"?" - branch_status: LEGACY (handled before archive; archive still owns final closure)":" - branch_status: DEFERRED (handled after the archive commit)","",n==="pass"?"Recovery action: Verification complete. Continue to archive; branch handling happens after archive changes are committed.":n==="fail"?"Recovery action: Verification failed and rolled back to build. Resume from /comet-build.":"Recovery action: Verification not yet started or in progress. Run scale assessment then verify.")}async function Uv(t,e){let n=await C(e,"archive_confirmation");t.stdout.push(" Archive:",await Y("verify_result",await C(e,"verify_result")),await Y("archive_confirmation",n),await Y("archived",await C(e,"archived")),"",n==="confirmed"?"Recovery action: Archive is confirmed. Run /comet-archive to complete archiving.":"Recovery action: Ask for final archive confirmation in /comet-archive before running the archive command.")}async function Yv(t,e){pe(e);let{file:n,directory:r,label:i}=await we(e);await U(n)||b(`ERROR: .comet.yaml not found at ${i}/.comet.yaml`);let o=await C(e,"phase"),s=await C(e,"workflow");t.stdout.push(`=== Recovery Context: ${e} ===`,`Phase: ${o}`,`Workflow: ${s}`,"","State fields:"),o==="open"?await Dv(t,r):o==="design"?await Wv(t,e,r):o==="build"?await Mv(t,e,r,s):o==="verify"?await Kv(t,e):o==="archive"?await Uv(t,e):b(`ERROR: Unknown phase: ${o}`),t.stdout.push("","=== End Recovery Context ===")}async function Gv(t,e){pe(e);let{file:n,directory:r,label:i}=await we(e);await U(n)||b(`ERROR: .comet.yaml not found at ${i}/.comet.yaml`);let o=O.join(r,"tasks.md"),s=await U(o)?(await He(j(),o,{label:"Classic scale task file"})).split(/\r?\n/u).filter(g=>/^- \[/u.test(g)).length:0,a=O.join(r,"specs"),c=0;if(await U(a))for(let g of await pv.readdir(a))await U(O.join(a,g,"spec.md"))&&(c+=1);let l=await C(e,"plan"),f="";l&&l!=="null"&&await U(l)&&(f=(await He(j(),l,{label:"Classic scale plan"})).match(/^base-ref:\s*(.+)$/mu)?.[1].trim()??""),f||(f=await C(e,"base_ref"));let u=Uf(["diff","--name-only",...f&&f!=="null"?[`${f}...HEAD`]:["HEAD"]]),d=u?u.split(/\r?\n/u).filter(Boolean).length:0,m=s>3||c>1||d>8?"full":"light";await Gf(new Ti,e,"verify_mode",m),t.stderr.push(`=== Scale Assessment: ${e} ===`,` Tasks: ${s} (threshold: 3)`,` Delta specs: ${c} capabilities (threshold: 1)`,` Changed files: ${d} (threshold: 8)`,` → Result: ${m}`,de(`[SCALE] verify_mode=${m}`))}function Vv(t){let e,n,r;for(let i=0;i<t.length;i+=2){let o=t[i];["--command","--exit-code","--cwd"].includes(o)||b(`ERROR: Unknown option: ${o}`);let s=t[i+1];s===void 0&&b(`ERROR: Missing value for option: ${o}`),o==="--command"?e=s:o==="--exit-code"?n=s:r=s}return e===void 0&&b("ERROR: Missing option: --command"),n===void 0&&b("ERROR: Missing option: --exit-code"),/^-?\d+$/u.test(n)||b("ERROR: --exit-code must be an integer"),{command:e,exitCode:Number(n),...r===void 0?{}:{cwd:r}}}async function Hv(t,e,n,r){pe(e),n!=="build"&&n!=="verify"&&b(`ERROR: Invalid command check scope: '${n}'`);let i=Vv(r),{directory:o,file:s}=await we(e),a=j(),c=(await ee(a)).changesDir;(O.dirname(o)!==c||!await U(s))&&b(`ERROR: command checks require an active change: ${e}`);try{let l=await ue(o,{migrate:!1});if(!l.classic||!l.run)throw new Error("command checks require an existing synchronized Classic Run");let{run:f}=await Nf(o,l),u=await $f(a,o,f,{scope:n,...i,cwd:i.cwd??(O.relative(a,Bn()).replaceAll("\\","/")||".")});t.stderr.push(de(`[RECORDED] ${u.scope} exit=${u.exitCode} cwd=${u.cwd} command=${u.command}`))}catch(l){b(`ERROR: ${l.message}`)}}function xe(t,e,n){t.length<e&&b(n)}function ji(t,e,n){t.length!==e&&b(n)}var Jv=new Set(["init","set","transition","check","scale","record-check","rebind","select","clear-selection"]);async function zv(t){if(!(!t||!Jv.has(t)))try{await li(j())}catch(e){b(`ERROR: ${e instanceof Error?e.message:String(e)}`)}}async function Xv(t,e){pe(e);try{let n=j(),r=await Ci({projectRoot:n,name:e}),i=await rf(r.projectRoot,e),o=await Ks(e,r.projectRoot),a=(await ue(o.directory,{migrate:!1})).classic?.boundBranch??null;t.stderr.push(de(`[SELECTED] current change: ${i.change}${a?` (branch: ${a})`:""}${r.routed?` (workspace: ${r.projectRoot})`:""}`))}catch(n){b(`ERROR: ${n instanceof Error?n.message:String(n)}`)}}async function Qv(t,e){pe(e);let{directory:n}=await we(e),r=await C(e,"bound_branch");(!r||r==="null")&&b(`ERROR: '${e}' is not yet bound; use 'comet state set ${e} isolation <current|branch|worktree>' to establish the first binding`);let i=gn(Bn());i===null&&b("ERROR: cannot rebind while HEAD is detached; checkout a branch first");let o=await ue(n);o.classic||b("ERROR: Classic state projection is missing"),await _s(n,i);let s={...o.classic,boundBranch:i};await oa(n,{change:e,event:"rebind",source:"comet-state",from:o.classic,to:s,effects:[{field:"boundBranch",from:r,to:i}]}),t.stderr.push(de(`[REBIND] bound_branch: ${r} → ${i}`))}async function Zv(t){let e=await of(j());if(e.status==="selected"){t.stdout.push(e.selection.change);return}e.status==="missing"&&b(`ERROR: no current change selected
161
161
  Use: comet-state.mjs select <change-name>`),b(`ERROR: current change selection is stale: ${e.reason}
162
- Use: comet-state.mjs select <change-name>`)}async function Sv(t){await Bu(T()),t.stderr.push(ue("[CLEARED] current change selection"))}var Nf=async(t,e)=>Vu(e,async()=>{let n=new Sr;try{let[i,...r]=t;return await yv(i),i==="init"?(Ee(r,2,"Usage: comet-state.mjs init <change-name> <workflow>"),await zy(n,r[0],r[1])):i==="get"?(Ee(r,2,"Usage: comet-state.mjs get <change-name> <field>"),fe(r[0]),n.stdout.push(await C(r[0],r[1]))):i==="set"?(Ee(r,3,"Usage: comet-state.mjs set <change-name> <field> <value>"),fe(r[0]),await Of(n,r[0],r[1],r[2])):i==="transition"?(Ee(r,2,"Usage: comet-state.mjs transition <change-name> <event>"),await nv(n,r[0],r[1])):i==="check"?(Ee(r,2,"Usage: comet-state.mjs check <change-name> <phase> [--recover]"),r[2]==="--recover"?await pv(n,r[0]):await sv(n,r[0],r[1])):i==="scale"?(Ee(r,1,"Usage: comet-state.mjs scale <change-name>"),await mv(n,r[0])):i==="record-check"?(Ee(r,2,"Usage: comet state record-check <change> <build|verify> --command <text> --exit-code <int> [--cwd <path>]"),await gv(n,r[0],r[1],r.slice(2))):i==="task-checkoff"?(Ee(r,2,"Usage: comet-state.mjs task-checkoff <file> <task-text>"),await rv(n,r[0],r[1])):i==="rebind"?(kr(r,1,"Usage: comet-state.mjs rebind <change-name>"),await bv(n,r[0])):i==="select"?(kr(r,1,"Usage: comet-state.mjs select <change-name>"),await vv(n,r[0])):i==="current"?(kr(r,0,"Usage: comet-state.mjs current"),await kv(n)):i==="clear-selection"?(kr(r,0,"Usage: comet-state.mjs clear-selection"),await Sv(n)):i==="next"?(Ee(r,1,"Usage: comet-state.mjs next <change-name>"),await iv(n,r[0])):b(`Unknown subcommand: ${i??""}`),n.result()}catch(i){if(!(i instanceof Dn))throw i;if(i.message)for(let r of i.message.split(`
163
- `))n.stderr.push(Go(r));return n.result(i.exitCode)}});function Cv(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}})+`
164
- `}}async function Af(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?Cv(t,s):s;return o.stdout&&process.stdout.write(o.stdout),o.stderr&&process.stderr.write(o.stderr+(o.stderr.endsWith(`
162
+ Use: comet-state.mjs select <change-name>`)}async function eb(t){await sf(j()),t.stderr.push(de("[CLEARED] current change selection"))}var Vf=async(t,e)=>uf(e,async()=>{let n=new Ti;try{let[r,...i]=t;if(await zv(r),r==="init"){xe(i,2,"Usage: comet-state.mjs init <change-name> <workflow>");let o=i.slice(2),s=null;o.length>0&&((o.length!==2||o[0]!=="--isolation")&&b("Usage: comet-state.mjs init <change-name> <workflow> [--isolation <mode>]"),s=o[1]),await Pv(n,i[0],i[1],s)}else r==="get"?(xe(i,2,"Usage: comet-state.mjs get <change-name> <field>"),pe(i[0]),n.stdout.push(await C(i[0],i[1]))):r==="set"?(xe(i,3,"Usage: comet-state.mjs set <change-name> <field> <value>"),pe(i[0]),await Gf(n,i[0],i[1],i[2])):r==="transition"?(xe(i,2,"Usage: comet-state.mjs transition <change-name> <event>"),await Iv(n,i[0],i[1])):r==="check"?(xe(i,2,"Usage: comet-state.mjs check <change-name> <phase> [--recover]"),i[2]==="--recover"?await Yv(n,i[0]):await qv(n,i[0],i[1])):r==="scale"?(xe(i,1,"Usage: comet-state.mjs scale <change-name>"),await Gv(n,i[0])):r==="record-check"?(xe(i,2,"Usage: comet state record-check <change> <build|verify> --command <text> --exit-code <int> [--cwd <path>]"),await Hv(n,i[0],i[1],i.slice(2))):r==="task-checkoff"?(xe(i,2,"Usage: comet-state.mjs task-checkoff <file> <task-text>"),await Lv(n,i[0],i[1])):r==="rebind"?(ji(i,1,"Usage: comet-state.mjs rebind <change-name>"),await Qv(n,i[0])):r==="select"?(ji(i,1,"Usage: comet-state.mjs select <change-name>"),await Xv(n,i[0])):r==="current"?(ji(i,0,"Usage: comet-state.mjs current"),await Zv(n)):r==="clear-selection"?(ji(i,0,"Usage: comet-state.mjs clear-selection"),await eb(n)):r==="next"?(xe(i,1,"Usage: comet-state.mjs next <change-name>"),await $v(n,i[0])):b(`Unknown subcommand: ${r??""}`);return n.result()}catch(r){if(!(r instanceof Un))throw r;if(r.message)for(let i of r.message.split(`
163
+ `))n.stderr.push(la(i));return n.result(r.exitCode)}});function tb(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}})+`
164
+ `}}async function Hf(t,e,n=process.argv.slice(2)){let r=n.includes("--json"),i=n.filter(a=>a!=="--json"),o;try{o=await e(i,{json:r})}catch(a){o={exitCode:70,stderr:a instanceof Error?a.message:String(a)}}let s=r?tb(t,o):o;return s.stdout&&process.stdout.write(s.stdout),s.stderr&&process.stderr.write(s.stderr+(s.stderr.endsWith(`
165
165
  `)?"":`
166
- `)),o.exitCode}process.exitCode=await Af("state",Nf);
166
+ `)),s.exitCode}process.exitCode=await Hf("state",Vf);