@rpamis/comet 0.4.0-beta.15 → 0.4.0-beta.17

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 (587) hide show
  1. package/README.md +37 -33
  2. package/assets/eval-reports/comet-native-vs-beta16-beta17-20260810/native-benchmark-report.html +8 -0
  3. package/assets/eval-reports/comet-native-vs-beta16-beta17-20260810/native-benchmark-report.json +286 -0
  4. package/assets/manifest.json +25 -17
  5. package/assets/skills/comet/SKILL.md +1 -1
  6. package/assets/skills/comet/agents/openai.yaml +3 -0
  7. package/assets/skills/comet/rules/comet-phase-guard.en.md +1 -1
  8. package/assets/skills/comet/rules/comet-phase-guard.md +1 -1
  9. package/assets/skills/comet/rules/comet-workflow-guard.en.md +2 -2
  10. package/assets/skills/comet/rules/comet-workflow-guard.md +2 -2
  11. package/assets/skills/comet/scripts/comet-archive.mjs +75 -75
  12. package/assets/skills/comet/scripts/comet-entry-runtime.mjs +47 -47
  13. package/assets/skills/comet/scripts/comet-guard.mjs +119 -119
  14. package/assets/skills/comet/scripts/comet-handoff.mjs +80 -80
  15. package/assets/skills/comet/scripts/comet-hook-guard.mjs +78 -78
  16. package/assets/skills/comet/scripts/comet-hook-router.mjs +142 -140
  17. package/assets/skills/comet/scripts/comet-resume-probe.mjs +89 -89
  18. package/assets/skills/comet/scripts/comet-runtime.mjs +148 -148
  19. package/assets/skills/comet/scripts/comet-state.mjs +72 -72
  20. package/assets/skills/comet/scripts/comet-yaml-validate.mjs +94 -94
  21. package/assets/skills/comet-any/SKILL.md +2 -1
  22. package/assets/skills/comet-any/agents/openai.yaml +5 -0
  23. package/assets/skills/comet-archive/SKILL.md +7 -6
  24. package/assets/skills/comet-archive/agents/openai.yaml +5 -0
  25. package/assets/skills/comet-build/SKILL.md +14 -13
  26. package/assets/skills/comet-build/agents/openai.yaml +5 -0
  27. package/assets/skills/comet-classic/SKILL.md +14 -14
  28. package/assets/skills/comet-classic/agents/openai.yaml +3 -0
  29. package/assets/skills/{comet → comet-classic}/reference/auto-transition.md +1 -1
  30. package/assets/skills/{comet → comet-classic}/reference/comet-yaml-fields.md +2 -2
  31. package/assets/skills/{comet → comet-classic}/reference/context-recovery.md +5 -5
  32. package/assets/skills/{comet → comet-classic}/reference/debug-gate.md +2 -2
  33. package/assets/skills/{comet → comet-classic}/reference/decision-point.md +1 -1
  34. package/assets/skills/{comet → comet-classic}/reference/dirty-worktree.md +1 -1
  35. package/assets/skills/{comet → comet-classic}/reference/file-structure.md +1 -1
  36. package/assets/skills/{comet → comet-classic}/reference/intent-frame.md +1 -1
  37. package/assets/skills/{comet → comet-classic}/reference/scripts.md +1 -1
  38. package/assets/skills/{comet → comet-classic}/reference/subagent-dispatch.md +1 -1
  39. package/assets/skills/comet-design/SKILL.md +7 -6
  40. package/assets/skills/comet-design/agents/openai.yaml +5 -0
  41. package/assets/skills/comet-hotfix/SKILL.md +10 -9
  42. package/assets/skills/comet-hotfix/agents/openai.yaml +5 -0
  43. package/assets/skills/comet-native/SKILL.md +54 -168
  44. package/assets/skills/comet-native/agents/openai.yaml +3 -0
  45. package/assets/skills/comet-native/reference/artifacts.md +23 -89
  46. package/assets/skills/comet-native/reference/clarification.md +54 -29
  47. package/assets/skills/comet-native/reference/commands.md +30 -173
  48. package/assets/skills/comet-native/reference/recovery.md +38 -88
  49. package/assets/skills/comet-native/reference/workspace.md +23 -0
  50. package/assets/skills/comet-native/scripts/comet-native-archive.mjs +184 -152
  51. package/assets/skills/comet-native/scripts/comet-native-doctor.mjs +219 -163
  52. package/assets/skills/comet-native/scripts/comet-native-hook-guard.mjs +125 -116
  53. package/assets/skills/comet-native/scripts/comet-native-init.mjs +134 -124
  54. package/assets/skills/comet-native/scripts/comet-native-new.mjs +170 -163
  55. package/assets/skills/comet-native/scripts/comet-native-next.mjs +179 -148
  56. package/assets/skills/comet-native/scripts/comet-native-root.mjs +152 -147
  57. package/assets/skills/comet-native/scripts/comet-native-runtime.mjs +247 -202
  58. package/assets/skills/comet-native/scripts/comet-native-select.mjs +153 -146
  59. package/assets/skills/comet-native/scripts/comet-native-show.mjs +117 -110
  60. package/assets/skills/comet-native/scripts/comet-native-spec.mjs +133 -151
  61. package/assets/skills/comet-native/scripts/comet-native-status.mjs +146 -139
  62. package/assets/skills/comet-open/SKILL.md +7 -6
  63. package/assets/skills/comet-open/agents/openai.yaml +5 -0
  64. package/assets/skills/comet-tweak/SKILL.md +11 -10
  65. package/assets/skills/comet-tweak/agents/openai.yaml +5 -0
  66. package/assets/skills/comet-verify/SKILL.md +9 -8
  67. package/assets/skills/comet-verify/agents/openai.yaml +5 -0
  68. package/assets/skills-zh/comet/SKILL.md +1 -1
  69. package/assets/skills-zh/comet/agents/openai.yaml +3 -0
  70. package/assets/skills-zh/comet-any/SKILL.md +2 -1
  71. package/assets/skills-zh/comet-any/agents/openai.yaml +5 -0
  72. package/assets/skills-zh/comet-archive/SKILL.md +7 -6
  73. package/assets/skills-zh/comet-archive/agents/openai.yaml +5 -0
  74. package/assets/skills-zh/comet-build/SKILL.md +14 -13
  75. package/assets/skills-zh/comet-build/agents/openai.yaml +5 -0
  76. package/assets/skills-zh/comet-classic/SKILL.md +15 -15
  77. package/assets/skills-zh/comet-classic/agents/openai.yaml +3 -0
  78. package/assets/skills-zh/{comet → comet-classic}/reference/auto-transition.md +1 -1
  79. package/assets/skills-zh/{comet → comet-classic}/reference/comet-yaml-fields.md +2 -2
  80. package/assets/skills-zh/{comet → comet-classic}/reference/context-recovery.md +5 -5
  81. package/assets/skills-zh/{comet → comet-classic}/reference/debug-gate.md +2 -2
  82. package/assets/skills-zh/{comet → comet-classic}/reference/decision-point.md +1 -1
  83. package/assets/skills-zh/{comet → comet-classic}/reference/dirty-worktree.md +1 -1
  84. package/assets/skills-zh/{comet → comet-classic}/reference/file-structure.md +1 -1
  85. package/assets/skills-zh/{comet → comet-classic}/reference/intent-frame.md +1 -1
  86. package/assets/skills-zh/{comet → comet-classic}/reference/scripts.md +1 -1
  87. package/assets/skills-zh/{comet → comet-classic}/reference/subagent-dispatch.md +1 -1
  88. package/assets/skills-zh/comet-design/SKILL.md +7 -6
  89. package/assets/skills-zh/comet-design/agents/openai.yaml +5 -0
  90. package/assets/skills-zh/comet-hotfix/SKILL.md +10 -9
  91. package/assets/skills-zh/comet-hotfix/agents/openai.yaml +5 -0
  92. package/assets/skills-zh/comet-native/SKILL.md +54 -168
  93. package/assets/skills-zh/comet-native/agents/openai.yaml +3 -0
  94. package/assets/skills-zh/comet-native/reference/artifacts.md +23 -89
  95. package/assets/skills-zh/comet-native/reference/clarification.md +40 -15
  96. package/assets/skills-zh/comet-native/reference/commands.md +30 -173
  97. package/assets/skills-zh/comet-native/reference/recovery.md +36 -86
  98. package/assets/skills-zh/comet-native/reference/workspace.md +23 -0
  99. package/assets/skills-zh/comet-open/SKILL.md +7 -6
  100. package/assets/skills-zh/comet-open/agents/openai.yaml +5 -0
  101. package/assets/skills-zh/comet-tweak/SKILL.md +11 -10
  102. package/assets/skills-zh/comet-tweak/agents/openai.yaml +5 -0
  103. package/assets/skills-zh/comet-verify/SKILL.md +9 -8
  104. package/assets/skills-zh/comet-verify/agents/openai.yaml +5 -0
  105. package/bin/fast-runtime-router.js +0 -4
  106. package/dist/app/commands/doctor.d.ts.map +1 -1
  107. package/dist/app/commands/doctor.js +16 -2
  108. package/dist/app/commands/doctor.js.map +1 -1
  109. package/dist/app/commands/init.d.ts.map +1 -1
  110. package/dist/app/commands/init.js +9 -1
  111. package/dist/app/commands/init.js.map +1 -1
  112. package/dist/app/commands/update.d.ts.map +1 -1
  113. package/dist/app/commands/update.js +9 -2
  114. package/dist/app/commands/update.js.map +1 -1
  115. package/dist/config/repository-layout.json +0 -8
  116. package/dist/domains/bundle/bundle-platform.d.ts.map +1 -1
  117. package/dist/domains/bundle/bundle-platform.js +8 -0
  118. package/dist/domains/bundle/bundle-platform.js.map +1 -1
  119. package/dist/domains/bundle/types.d.ts +1 -1
  120. package/dist/domains/bundle/types.d.ts.map +1 -1
  121. package/dist/domains/comet-classic/classic-evidence.d.ts.map +1 -1
  122. package/dist/domains/comet-classic/classic-evidence.js +45 -9
  123. package/dist/domains/comet-classic/classic-evidence.js.map +1 -1
  124. package/dist/domains/comet-classic/classic-layout-initialization.d.ts +4 -3
  125. package/dist/domains/comet-classic/classic-layout-initialization.d.ts.map +1 -1
  126. package/dist/domains/comet-classic/classic-layout-initialization.js +13 -9
  127. package/dist/domains/comet-classic/classic-layout-initialization.js.map +1 -1
  128. package/dist/domains/comet-classic/classic-layout.d.ts +2 -11
  129. package/dist/domains/comet-classic/classic-layout.d.ts.map +1 -1
  130. package/dist/domains/comet-classic/classic-layout.js +22 -28
  131. package/dist/domains/comet-classic/classic-layout.js.map +1 -1
  132. package/dist/domains/comet-classic/classic-root-command.d.ts.map +1 -1
  133. package/dist/domains/comet-classic/classic-root-command.js +6 -1
  134. package/dist/domains/comet-classic/classic-root-command.js.map +1 -1
  135. package/dist/domains/comet-entry/hook-adapter.d.ts.map +1 -1
  136. package/dist/domains/comet-entry/hook-adapter.js +6 -0
  137. package/dist/domains/comet-entry/hook-adapter.js.map +1 -1
  138. package/dist/domains/comet-entry/hook-router-entry.d.ts.map +1 -1
  139. package/dist/domains/comet-entry/hook-router-entry.js +11 -2
  140. package/dist/domains/comet-entry/hook-router-entry.js.map +1 -1
  141. package/dist/domains/comet-entry/project-activation.d.ts.map +1 -1
  142. package/dist/domains/comet-entry/project-activation.js +2 -1
  143. package/dist/domains/comet-entry/project-activation.js.map +1 -1
  144. package/dist/domains/comet-entry/resume-probe.d.ts.map +1 -1
  145. package/dist/domains/comet-entry/resume-probe.js +48 -4
  146. package/dist/domains/comet-entry/resume-probe.js.map +1 -1
  147. package/dist/domains/comet-native/native-acceptance.d.ts +4 -3
  148. package/dist/domains/comet-native/native-acceptance.d.ts.map +1 -1
  149. package/dist/domains/comet-native/native-acceptance.js +23 -18
  150. package/dist/domains/comet-native/native-acceptance.js.map +1 -1
  151. package/dist/domains/comet-native/native-archive-command.d.ts.map +1 -1
  152. package/dist/domains/comet-native/native-archive-command.js +204 -61
  153. package/dist/domains/comet-native/native-archive-command.js.map +1 -1
  154. package/dist/domains/comet-native/native-archive-transaction.d.ts.map +1 -1
  155. package/dist/domains/comet-native/native-archive-transaction.js +28 -23
  156. package/dist/domains/comet-native/native-archive-transaction.js.map +1 -1
  157. package/dist/domains/comet-native/native-archive.d.ts +1 -0
  158. package/dist/domains/comet-native/native-archive.d.ts.map +1 -1
  159. package/dist/domains/comet-native/native-archive.js +56 -12
  160. package/dist/domains/comet-native/native-archive.js.map +1 -1
  161. package/dist/domains/comet-native/native-bounded-file.d.ts +32 -2
  162. package/dist/domains/comet-native/native-bounded-file.d.ts.map +1 -1
  163. package/dist/domains/comet-native/native-bounded-file.js +87 -6
  164. package/dist/domains/comet-native/native-bounded-file.js.map +1 -1
  165. package/dist/domains/comet-native/native-build-evidence.d.ts.map +1 -1
  166. package/dist/domains/comet-native/native-build-evidence.js +23 -1
  167. package/dist/domains/comet-native/native-build-evidence.js.map +1 -1
  168. package/dist/domains/comet-native/native-change.d.ts +1 -0
  169. package/dist/domains/comet-native/native-change.d.ts.map +1 -1
  170. package/dist/domains/comet-native/native-change.js +96 -8
  171. package/dist/domains/comet-native/native-change.js.map +1 -1
  172. package/dist/domains/comet-native/native-check-executor.d.ts +36 -0
  173. package/dist/domains/comet-native/native-check-executor.d.ts.map +1 -0
  174. package/dist/domains/comet-native/native-check-executor.js +132 -0
  175. package/dist/domains/comet-native/native-check-executor.js.map +1 -0
  176. package/dist/domains/comet-native/native-check-receipt-model.d.ts +9 -0
  177. package/dist/domains/comet-native/native-check-receipt-model.d.ts.map +1 -1
  178. package/dist/domains/comet-native/native-check-receipt-model.js +70 -8
  179. package/dist/domains/comet-native/native-check-receipt-model.js.map +1 -1
  180. package/dist/domains/comet-native/native-check-receipt-storage.d.ts.map +1 -1
  181. package/dist/domains/comet-native/native-check-receipt-storage.js +9 -8
  182. package/dist/domains/comet-native/native-check-receipt-storage.js.map +1 -1
  183. package/dist/domains/comet-native/native-check-receipt.d.ts.map +1 -1
  184. package/dist/domains/comet-native/native-check-receipt.js +123 -60
  185. package/dist/domains/comet-native/native-check-receipt.js.map +1 -1
  186. package/dist/domains/comet-native/native-checkpoint-command.d.ts.map +1 -1
  187. package/dist/domains/comet-native/native-checkpoint-command.js +0 -6
  188. package/dist/domains/comet-native/native-checkpoint-command.js.map +1 -1
  189. package/dist/domains/comet-native/native-checkpoint-storage.d.ts.map +1 -1
  190. package/dist/domains/comet-native/native-checkpoint-storage.js +27 -19
  191. package/dist/domains/comet-native/native-checkpoint-storage.js.map +1 -1
  192. package/dist/domains/comet-native/native-cli-help.d.ts +6 -0
  193. package/dist/domains/comet-native/native-cli-help.d.ts.map +1 -0
  194. package/dist/domains/comet-native/native-cli-help.js +192 -0
  195. package/dist/domains/comet-native/native-cli-help.js.map +1 -0
  196. package/dist/domains/comet-native/native-cli-shared.d.ts +2 -2
  197. package/dist/domains/comet-native/native-cli-shared.d.ts.map +1 -1
  198. package/dist/domains/comet-native/native-cli-shared.js +46 -24
  199. package/dist/domains/comet-native/native-cli-shared.js.map +1 -1
  200. package/dist/domains/comet-native/native-cli.d.ts.map +1 -1
  201. package/dist/domains/comet-native/native-cli.js +18 -11
  202. package/dist/domains/comet-native/native-cli.js.map +1 -1
  203. package/dist/domains/comet-native/native-config.d.ts +2 -1
  204. package/dist/domains/comet-native/native-config.d.ts.map +1 -1
  205. package/dist/domains/comet-native/native-config.js +2 -1
  206. package/dist/domains/comet-native/native-config.js.map +1 -1
  207. package/dist/domains/comet-native/native-continuation.d.ts.map +1 -1
  208. package/dist/domains/comet-native/native-continuation.js +175 -147
  209. package/dist/domains/comet-native/native-continuation.js.map +1 -1
  210. package/dist/domains/comet-native/native-diagnostics.d.ts.map +1 -1
  211. package/dist/domains/comet-native/native-diagnostics.js +96 -13
  212. package/dist/domains/comet-native/native-diagnostics.js.map +1 -1
  213. package/dist/domains/comet-native/native-doctor-command.d.ts.map +1 -1
  214. package/dist/domains/comet-native/native-doctor-command.js +327 -0
  215. package/dist/domains/comet-native/native-doctor-command.js.map +1 -1
  216. package/dist/domains/comet-native/native-doctor.d.ts +1 -0
  217. package/dist/domains/comet-native/native-doctor.d.ts.map +1 -1
  218. package/dist/domains/comet-native/native-doctor.js +116 -22
  219. package/dist/domains/comet-native/native-doctor.js.map +1 -1
  220. package/dist/domains/comet-native/native-evidence-projection.d.ts +50 -0
  221. package/dist/domains/comet-native/native-evidence-projection.d.ts.map +1 -0
  222. package/dist/domains/comet-native/native-evidence-projection.js +284 -0
  223. package/dist/domains/comet-native/native-evidence-projection.js.map +1 -0
  224. package/dist/domains/comet-native/native-evidence-retention.d.ts.map +1 -1
  225. package/dist/domains/comet-native/native-evidence-retention.js +14 -12
  226. package/dist/domains/comet-native/native-evidence-retention.js.map +1 -1
  227. package/dist/domains/comet-native/native-evidence-storage.d.ts.map +1 -1
  228. package/dist/domains/comet-native/native-evidence-storage.js +14 -11
  229. package/dist/domains/comet-native/native-evidence-storage.js.map +1 -1
  230. package/dist/domains/comet-native/native-findings.d.ts.map +1 -1
  231. package/dist/domains/comet-native/native-findings.js +18 -0
  232. package/dist/domains/comet-native/native-findings.js.map +1 -1
  233. package/dist/domains/comet-native/native-git-provenance.d.ts +16 -0
  234. package/dist/domains/comet-native/native-git-provenance.d.ts.map +1 -0
  235. package/dist/domains/comet-native/native-git-provenance.js +171 -0
  236. package/dist/domains/comet-native/native-git-provenance.js.map +1 -0
  237. package/dist/domains/comet-native/native-hook-guard.d.ts.map +1 -1
  238. package/dist/domains/comet-native/native-hook-guard.js +159 -18
  239. package/dist/domains/comet-native/native-hook-guard.js.map +1 -1
  240. package/dist/domains/comet-native/native-init-command.d.ts.map +1 -1
  241. package/dist/domains/comet-native/native-init-command.js +14 -2
  242. package/dist/domains/comet-native/native-init-command.js.map +1 -1
  243. package/dist/domains/comet-native/native-local-execution.d.ts +25 -0
  244. package/dist/domains/comet-native/native-local-execution.d.ts.map +1 -0
  245. package/dist/domains/comet-native/native-local-execution.js +241 -0
  246. package/dist/domains/comet-native/native-local-execution.js.map +1 -0
  247. package/dist/domains/comet-native/native-lock.d.ts +1 -1
  248. package/dist/domains/comet-native/native-lock.d.ts.map +1 -1
  249. package/dist/domains/comet-native/native-lock.js +9 -9
  250. package/dist/domains/comet-native/native-lock.js.map +1 -1
  251. package/dist/domains/comet-native/native-loop-runtime.d.ts +63 -0
  252. package/dist/domains/comet-native/native-loop-runtime.d.ts.map +1 -0
  253. package/dist/domains/comet-native/native-loop-runtime.js +580 -0
  254. package/dist/domains/comet-native/native-loop-runtime.js.map +1 -0
  255. package/dist/domains/comet-native/native-mutation-lock.d.ts +2 -0
  256. package/dist/domains/comet-native/native-mutation-lock.d.ts.map +1 -1
  257. package/dist/domains/comet-native/native-mutation-lock.js +23 -2
  258. package/dist/domains/comet-native/native-mutation-lock.js.map +1 -1
  259. package/dist/domains/comet-native/native-new-command.d.ts.map +1 -1
  260. package/dist/domains/comet-native/native-new-command.js +27 -20
  261. package/dist/domains/comet-native/native-new-command.js.map +1 -1
  262. package/dist/domains/comet-native/native-next-command.d.ts.map +1 -1
  263. package/dist/domains/comet-native/native-next-command.js +114 -63
  264. package/dist/domains/comet-native/native-next-command.js.map +1 -1
  265. package/dist/domains/comet-native/native-paths.d.ts +18 -0
  266. package/dist/domains/comet-native/native-paths.d.ts.map +1 -1
  267. package/dist/domains/comet-native/native-paths.js +125 -13
  268. package/dist/domains/comet-native/native-paths.js.map +1 -1
  269. package/dist/domains/comet-native/native-portable-acceptance.d.ts +28 -0
  270. package/dist/domains/comet-native/native-portable-acceptance.d.ts.map +1 -0
  271. package/dist/domains/comet-native/native-portable-acceptance.js +73 -0
  272. package/dist/domains/comet-native/native-portable-acceptance.js.map +1 -0
  273. package/dist/domains/comet-native/native-portable-archive.d.ts +37 -0
  274. package/dist/domains/comet-native/native-portable-archive.d.ts.map +1 -0
  275. package/dist/domains/comet-native/native-portable-archive.js +492 -0
  276. package/dist/domains/comet-native/native-portable-archive.js.map +1 -0
  277. package/dist/domains/comet-native/native-portable-continuation.d.ts +29 -0
  278. package/dist/domains/comet-native/native-portable-continuation.d.ts.map +1 -0
  279. package/dist/domains/comet-native/native-portable-continuation.js +341 -0
  280. package/dist/domains/comet-native/native-portable-continuation.js.map +1 -0
  281. package/dist/domains/comet-native/native-portable-migration-runtime.d.ts +9 -0
  282. package/dist/domains/comet-native/native-portable-migration-runtime.d.ts.map +1 -0
  283. package/dist/domains/comet-native/native-portable-migration-runtime.js +213 -0
  284. package/dist/domains/comet-native/native-portable-migration-runtime.js.map +1 -0
  285. package/dist/domains/comet-native/native-portable-migration.d.ts +42 -0
  286. package/dist/domains/comet-native/native-portable-migration.d.ts.map +1 -0
  287. package/dist/domains/comet-native/native-portable-migration.js +212 -0
  288. package/dist/domains/comet-native/native-portable-migration.js.map +1 -0
  289. package/dist/domains/comet-native/native-portable-recovery.d.ts +15 -0
  290. package/dist/domains/comet-native/native-portable-recovery.d.ts.map +1 -0
  291. package/dist/domains/comet-native/native-portable-recovery.js +203 -0
  292. package/dist/domains/comet-native/native-portable-recovery.js.map +1 -0
  293. package/dist/domains/comet-native/native-portable-runtime.d.ts +150 -0
  294. package/dist/domains/comet-native/native-portable-runtime.d.ts.map +1 -0
  295. package/dist/domains/comet-native/native-portable-runtime.js +1444 -0
  296. package/dist/domains/comet-native/native-portable-runtime.js.map +1 -0
  297. package/dist/domains/comet-native/native-portable-state.d.ts +30 -0
  298. package/dist/domains/comet-native/native-portable-state.d.ts.map +1 -0
  299. package/dist/domains/comet-native/native-portable-state.js +688 -0
  300. package/dist/domains/comet-native/native-portable-state.js.map +1 -0
  301. package/dist/domains/comet-native/native-portable-status.d.ts +62 -0
  302. package/dist/domains/comet-native/native-portable-status.d.ts.map +1 -0
  303. package/dist/domains/comet-native/native-portable-status.js +125 -0
  304. package/dist/domains/comet-native/native-portable-status.js.map +1 -0
  305. package/dist/domains/comet-native/native-portable-text.d.ts +8 -0
  306. package/dist/domains/comet-native/native-portable-text.d.ts.map +1 -0
  307. package/dist/domains/comet-native/native-portable-text.js +28 -0
  308. package/dist/domains/comet-native/native-portable-text.js.map +1 -0
  309. package/dist/domains/comet-native/native-portable-transactions.d.ts +41 -0
  310. package/dist/domains/comet-native/native-portable-transactions.d.ts.map +1 -0
  311. package/dist/domains/comet-native/native-portable-transactions.js +204 -0
  312. package/dist/domains/comet-native/native-portable-transactions.js.map +1 -0
  313. package/dist/domains/comet-native/native-portable-types.d.ts +165 -0
  314. package/dist/domains/comet-native/native-portable-types.d.ts.map +1 -0
  315. package/dist/domains/comet-native/native-portable-types.js +18 -0
  316. package/dist/domains/comet-native/native-portable-types.js.map +1 -0
  317. package/dist/domains/comet-native/native-repair-integration.js +5 -5
  318. package/dist/domains/comet-native/native-repair-integration.js.map +1 -1
  319. package/dist/domains/comet-native/native-resume-view.d.ts.map +1 -1
  320. package/dist/domains/comet-native/native-resume-view.js +1 -5
  321. package/dist/domains/comet-native/native-resume-view.js.map +1 -1
  322. package/dist/domains/comet-native/native-root-move.d.ts.map +1 -1
  323. package/dist/domains/comet-native/native-root-move.js +4 -20
  324. package/dist/domains/comet-native/native-root-move.js.map +1 -1
  325. package/dist/domains/comet-native/native-run-consistency.d.ts.map +1 -1
  326. package/dist/domains/comet-native/native-run-consistency.js +8 -12
  327. package/dist/domains/comet-native/native-run-consistency.js.map +1 -1
  328. package/dist/domains/comet-native/native-run-store.js +4 -4
  329. package/dist/domains/comet-native/native-run-store.js.map +1 -1
  330. package/dist/domains/comet-native/native-runner-input.d.ts +160 -0
  331. package/dist/domains/comet-native/native-runner-input.d.ts.map +1 -0
  332. package/dist/domains/comet-native/native-runner-input.js +347 -0
  333. package/dist/domains/comet-native/native-runner-input.js.map +1 -0
  334. package/dist/domains/comet-native/native-runner-protocol.d.ts +40 -0
  335. package/dist/domains/comet-native/native-runner-protocol.d.ts.map +1 -0
  336. package/dist/domains/comet-native/native-runner-protocol.js +55 -0
  337. package/dist/domains/comet-native/native-runner-protocol.js.map +1 -0
  338. package/dist/domains/comet-native/native-runtime-package.d.ts +3 -0
  339. package/dist/domains/comet-native/native-runtime-package.d.ts.map +1 -1
  340. package/dist/domains/comet-native/native-runtime-package.js +5 -1
  341. package/dist/domains/comet-native/native-runtime-package.js.map +1 -1
  342. package/dist/domains/comet-native/native-schema-migration.d.ts.map +1 -1
  343. package/dist/domains/comet-native/native-schema-migration.js +30 -27
  344. package/dist/domains/comet-native/native-schema-migration.js.map +1 -1
  345. package/dist/domains/comet-native/native-select-command.d.ts.map +1 -1
  346. package/dist/domains/comet-native/native-select-command.js +8 -4
  347. package/dist/domains/comet-native/native-select-command.js.map +1 -1
  348. package/dist/domains/comet-native/native-selection.d.ts.map +1 -1
  349. package/dist/domains/comet-native/native-selection.js +11 -2
  350. package/dist/domains/comet-native/native-selection.js.map +1 -1
  351. package/dist/domains/comet-native/native-show-command.d.ts.map +1 -1
  352. package/dist/domains/comet-native/native-show-command.js +36 -0
  353. package/dist/domains/comet-native/native-show-command.js.map +1 -1
  354. package/dist/domains/comet-native/native-snapshot.d.ts.map +1 -1
  355. package/dist/domains/comet-native/native-snapshot.js +13 -10
  356. package/dist/domains/comet-native/native-snapshot.js.map +1 -1
  357. package/dist/domains/comet-native/native-spec-command.d.ts.map +1 -1
  358. package/dist/domains/comet-native/native-spec-command.js +14 -28
  359. package/dist/domains/comet-native/native-spec-command.js.map +1 -1
  360. package/dist/domains/comet-native/native-specs.js +3 -3
  361. package/dist/domains/comet-native/native-specs.js.map +1 -1
  362. package/dist/domains/comet-native/native-status-command.d.ts.map +1 -1
  363. package/dist/domains/comet-native/native-status-command.js +7 -17
  364. package/dist/domains/comet-native/native-status-command.js.map +1 -1
  365. package/dist/domains/comet-native/native-status-discovery.d.ts +51 -0
  366. package/dist/domains/comet-native/native-status-discovery.d.ts.map +1 -0
  367. package/dist/domains/comet-native/native-status-discovery.js +299 -0
  368. package/dist/domains/comet-native/native-status-discovery.js.map +1 -0
  369. package/dist/domains/comet-native/native-trajectory-recovery.d.ts.map +1 -1
  370. package/dist/domains/comet-native/native-trajectory-recovery.js +6 -9
  371. package/dist/domains/comet-native/native-trajectory-recovery.js.map +1 -1
  372. package/dist/domains/comet-native/native-transaction.d.ts.map +1 -1
  373. package/dist/domains/comet-native/native-transaction.js +31 -20
  374. package/dist/domains/comet-native/native-transaction.js.map +1 -1
  375. package/dist/domains/comet-native/native-transition-evidence.d.ts.map +1 -1
  376. package/dist/domains/comet-native/native-transition-evidence.js +1 -0
  377. package/dist/domains/comet-native/native-transition-evidence.js.map +1 -1
  378. package/dist/domains/comet-native/native-transition-journal.d.ts.map +1 -1
  379. package/dist/domains/comet-native/native-transition-journal.js +71 -22
  380. package/dist/domains/comet-native/native-transition-journal.js.map +1 -1
  381. package/dist/domains/comet-native/native-transitions.d.ts.map +1 -1
  382. package/dist/domains/comet-native/native-transitions.js +167 -15
  383. package/dist/domains/comet-native/native-transitions.js.map +1 -1
  384. package/dist/domains/comet-native/native-types.d.ts +36 -1
  385. package/dist/domains/comet-native/native-types.d.ts.map +1 -1
  386. package/dist/domains/comet-native/native-verification-receipt-runtime.d.ts.map +1 -1
  387. package/dist/domains/comet-native/native-verification-receipt-runtime.js +18 -100
  388. package/dist/domains/comet-native/native-verification-receipt-runtime.js.map +1 -1
  389. package/dist/domains/comet-native/native-verification-report-v2.d.ts +12 -0
  390. package/dist/domains/comet-native/native-verification-report-v2.d.ts.map +1 -0
  391. package/dist/domains/comet-native/native-verification-report-v2.js +141 -0
  392. package/dist/domains/comet-native/native-verification-report-v2.js.map +1 -0
  393. package/dist/domains/comet-native/native-verification-runtime.d.ts.map +1 -1
  394. package/dist/domains/comet-native/native-verification-runtime.js +7 -2
  395. package/dist/domains/comet-native/native-verification-runtime.js.map +1 -1
  396. package/dist/domains/comet-native/native-verification-scope.d.ts +23 -0
  397. package/dist/domains/comet-native/native-verification-scope.d.ts.map +1 -1
  398. package/dist/domains/comet-native/native-verification-scope.js +106 -19
  399. package/dist/domains/comet-native/native-verification-scope.js.map +1 -1
  400. package/dist/domains/comet-native/native-verifier-protocol.d.ts +49 -0
  401. package/dist/domains/comet-native/native-verifier-protocol.d.ts.map +1 -0
  402. package/dist/domains/comet-native/native-verifier-protocol.js +157 -0
  403. package/dist/domains/comet-native/native-verifier-protocol.js.map +1 -0
  404. package/dist/domains/comet-native/native-workspace-finish.d.ts +61 -0
  405. package/dist/domains/comet-native/native-workspace-finish.d.ts.map +1 -0
  406. package/dist/domains/comet-native/native-workspace-finish.js +332 -0
  407. package/dist/domains/comet-native/native-workspace-finish.js.map +1 -0
  408. package/dist/domains/comet-native/native-workspace-preparation.d.ts +32 -0
  409. package/dist/domains/comet-native/native-workspace-preparation.d.ts.map +1 -0
  410. package/dist/domains/comet-native/native-workspace-preparation.js +265 -0
  411. package/dist/domains/comet-native/native-workspace-preparation.js.map +1 -0
  412. package/dist/domains/comet-native/native-workspace.d.ts +9 -1
  413. package/dist/domains/comet-native/native-workspace.d.ts.map +1 -1
  414. package/dist/domains/comet-native/native-workspace.js +109 -11
  415. package/dist/domains/comet-native/native-workspace.js.map +1 -1
  416. package/dist/domains/dashboard/native-adapter.d.ts +136 -127
  417. package/dist/domains/dashboard/native-adapter.d.ts.map +1 -1
  418. package/dist/domains/dashboard/native-adapter.js +157 -271
  419. package/dist/domains/dashboard/native-adapter.js.map +1 -1
  420. package/dist/domains/dashboard/native-collector.d.ts +4 -4
  421. package/dist/domains/dashboard/native-collector.d.ts.map +1 -1
  422. package/dist/domains/dashboard/native-collector.js +230 -412
  423. package/dist/domains/dashboard/native-collector.js.map +1 -1
  424. package/dist/domains/dashboard/native-legacy-adapter.d.ts +30 -0
  425. package/dist/domains/dashboard/native-legacy-adapter.d.ts.map +1 -0
  426. package/dist/domains/dashboard/native-legacy-adapter.js +115 -0
  427. package/dist/domains/dashboard/native-legacy-adapter.js.map +1 -0
  428. package/dist/domains/dashboard/web/assets/{arc-ClrSujVb.js → arc-CkuYweSh.js} +1 -1
  429. package/dist/domains/dashboard/web/assets/{architectureDiagram-3BPJPVTR-B4A_t84A.js → architectureDiagram-3BPJPVTR--tTGrKam.js} +1 -1
  430. package/dist/domains/dashboard/web/assets/{blockDiagram-GPEHLZMM-D72u2953.js → blockDiagram-GPEHLZMM-DLKYOixs.js} +1 -1
  431. package/dist/domains/dashboard/web/assets/{c4Diagram-AAUBKEIU-Ca5zba3N.js → c4Diagram-AAUBKEIU-BL17BIb8.js} +1 -1
  432. package/dist/domains/dashboard/web/assets/channel-Cg__FSMr.js +1 -0
  433. package/dist/domains/dashboard/web/assets/{chunk-2J33WTMH-CCVPBm0J.js → chunk-2J33WTMH-B_DDS2IK.js} +1 -1
  434. package/dist/domains/dashboard/web/assets/{chunk-4BX2VUAB-JYluRsP-.js → chunk-4BX2VUAB-vQyyh3eG.js} +1 -1
  435. package/dist/domains/dashboard/web/assets/{chunk-55IACEB6-DfYm7pN7.js → chunk-55IACEB6-Cug8J1Qa.js} +1 -1
  436. package/dist/domains/dashboard/web/assets/{chunk-727SXJPM-CwghIMO9.js → chunk-727SXJPM-pMreYMW7.js} +1 -1
  437. package/dist/domains/dashboard/web/assets/{chunk-AQP2D5EJ-BA_zgMXZ.js → chunk-AQP2D5EJ-BUkV_rb7.js} +1 -1
  438. package/dist/domains/dashboard/web/assets/{chunk-FMBD7UC4-BAJLB5V6.js → chunk-FMBD7UC4-CQXqBSqQ.js} +1 -1
  439. package/dist/domains/dashboard/web/assets/{chunk-ND2GUHAM-Bj6HWRwi.js → chunk-ND2GUHAM-XWLMOyd4.js} +1 -1
  440. package/dist/domains/dashboard/web/assets/{chunk-QZHKN3VN-B1kXfg5N.js → chunk-QZHKN3VN-4drjXzHQ.js} +1 -1
  441. package/dist/domains/dashboard/web/assets/classDiagram-4FO5ZUOK-CsC-pvu9.js +1 -0
  442. package/dist/domains/dashboard/web/assets/classDiagram-v2-Q7XG4LA2-CsC-pvu9.js +1 -0
  443. package/dist/domains/dashboard/web/assets/{cose-bilkent-S5V4N54A-BBrkuiAU.js → cose-bilkent-S5V4N54A-IQKP-hgj.js} +1 -1
  444. package/dist/domains/dashboard/web/assets/{cynefin-VYW2F7L2-DlFhgQHt.js → cynefin-VYW2F7L2-CvvRO4J2.js} +1 -1
  445. package/dist/domains/dashboard/web/assets/{dagre-BM42HDAG-B0Bk5oiP.js → dagre-BM42HDAG-DeOQo7bP.js} +1 -1
  446. package/dist/domains/dashboard/web/assets/demo-CeIDHUFJ.js +24 -0
  447. package/dist/domains/dashboard/web/assets/{diagram-2AECGRRQ-tvTUiBA2.js → diagram-2AECGRRQ-IQd_jQwB.js} +1 -1
  448. package/dist/domains/dashboard/web/assets/{diagram-5GNKFQAL-BZfcK29q.js → diagram-5GNKFQAL-Dllkdt0m.js} +1 -1
  449. package/dist/domains/dashboard/web/assets/{diagram-KO2AKTUF-BQahyP-C.js → diagram-KO2AKTUF-CN_LYqvT.js} +1 -1
  450. package/dist/domains/dashboard/web/assets/{diagram-LMA3HP47-D5bJnW2C.js → diagram-LMA3HP47-DK36WkNN.js} +1 -1
  451. package/dist/domains/dashboard/web/assets/{diagram-OG6HWLK6-DTwWdzWJ.js → diagram-OG6HWLK6-iqUnMYEh.js} +1 -1
  452. package/dist/domains/dashboard/web/assets/{erDiagram-TEJ5UH35-BbvrdCp9.js → erDiagram-TEJ5UH35-Bc64lzy8.js} +1 -1
  453. package/dist/domains/dashboard/web/assets/{flowDiagram-I6XJVG4X-DgbR7Tcc.js → flowDiagram-I6XJVG4X-UfOqef9j.js} +1 -1
  454. package/dist/domains/dashboard/web/assets/{ganttDiagram-6RSMTGT7-wWMOA7F4.js → ganttDiagram-6RSMTGT7-D-u6Aauc.js} +1 -1
  455. package/dist/domains/dashboard/web/assets/{gitGraphDiagram-PVQCEYII-DCxvMAUJ.js → gitGraphDiagram-PVQCEYII-CaWEk3PM.js} +1 -1
  456. package/dist/domains/dashboard/web/assets/index-BFwKBVTJ.css +1 -0
  457. package/dist/domains/dashboard/web/assets/{index-Blit0P5Z.js → index-BNyOfAhu.js} +1 -1
  458. package/dist/domains/dashboard/web/assets/index-COZ_03uK.js +257 -0
  459. package/dist/domains/dashboard/web/assets/{infoDiagram-5YYISTIA-9qXEkzDe.js → infoDiagram-5YYISTIA-BK07mNG0.js} +1 -1
  460. package/dist/domains/dashboard/web/assets/{ishikawaDiagram-YF4QCWOH-Dkf5othW.js → ishikawaDiagram-YF4QCWOH-mWnmaWfZ.js} +1 -1
  461. package/dist/domains/dashboard/web/assets/{journeyDiagram-JHISSGLW-C2_IkO4s.js → journeyDiagram-JHISSGLW-BPy-P7xx.js} +1 -1
  462. package/dist/domains/dashboard/web/assets/{kanban-definition-UN3LZRKU-BxWgu4DL.js → kanban-definition-UN3LZRKU-3Jq9c_lo.js} +1 -1
  463. package/dist/domains/dashboard/web/assets/{linear-Dkr6p-Ro.js → linear-kQyEW-4G.js} +1 -1
  464. package/dist/domains/dashboard/web/assets/{mermaid.core-DZUcsoG4.js → mermaid.core-COBBjtVH.js} +4 -4
  465. package/dist/domains/dashboard/web/assets/{mindmap-definition-RKZ34NQL-C9xyxGfa.js → mindmap-definition-RKZ34NQL-CyyurUpv.js} +1 -1
  466. package/dist/domains/dashboard/web/assets/{pieDiagram-4H26LBE5-Dn67tdOF.js → pieDiagram-4H26LBE5-CJro_XKk.js} +1 -1
  467. package/dist/domains/dashboard/web/assets/{quadrantDiagram-W4KKPZXB-Cy6iOcxc.js → quadrantDiagram-W4KKPZXB-CpayUMjH.js} +1 -1
  468. package/dist/domains/dashboard/web/assets/{requirementDiagram-4Y6WPE33-B_gZONhx.js → requirementDiagram-4Y6WPE33-Bi8YpfnA.js} +1 -1
  469. package/dist/domains/dashboard/web/assets/{sankeyDiagram-5OEKKPKP-C3u-4dOk.js → sankeyDiagram-5OEKKPKP-Wx60WwHe.js} +1 -1
  470. package/dist/domains/dashboard/web/assets/{sequenceDiagram-3UESZ5HK-Xd3ByTVF.js → sequenceDiagram-3UESZ5HK-BiMsRFbc.js} +1 -1
  471. package/dist/domains/dashboard/web/assets/{stateDiagram-AJRCARHV-CJGHL7Up.js → stateDiagram-AJRCARHV-BrURMY0R.js} +1 -1
  472. package/dist/domains/dashboard/web/assets/stateDiagram-v2-BHNVJYJU-BpEE-yEg.js +1 -0
  473. package/dist/domains/dashboard/web/assets/{timeline-definition-PNZ67QCA-DvONX2YQ.js → timeline-definition-PNZ67QCA-aHrrtV-b.js} +1 -1
  474. package/dist/domains/dashboard/web/assets/{vennDiagram-CIIHVFJN-B-L4qWy4.js → vennDiagram-CIIHVFJN-DGB16bvR.js} +1 -1
  475. package/dist/domains/dashboard/web/assets/{wardleyDiagram-YWT4CUSO-cf39WX2o.js → wardleyDiagram-YWT4CUSO-RVQbcySh.js} +1 -1
  476. package/dist/domains/dashboard/web/assets/{xychartDiagram-2RQKCTM6-Dk1vcm3u.js → xychartDiagram-2RQKCTM6-DMzzwDVX.js} +1 -1
  477. package/dist/domains/dashboard/web/index.html +2 -2
  478. package/dist/domains/factory/package.d.ts.map +1 -1
  479. package/dist/domains/factory/package.js +7 -22
  480. package/dist/domains/factory/package.js.map +1 -1
  481. package/dist/domains/skill/platform-inspect.d.ts.map +1 -1
  482. package/dist/domains/skill/platform-inspect.js +11 -3
  483. package/dist/domains/skill/platform-inspect.js.map +1 -1
  484. package/dist/domains/skill/platform-install.d.ts +7 -1
  485. package/dist/domains/skill/platform-install.d.ts.map +1 -1
  486. package/dist/domains/skill/platform-install.js +114 -33
  487. package/dist/domains/skill/platform-install.js.map +1 -1
  488. package/dist/domains/skill/uninstall.d.ts.map +1 -1
  489. package/dist/domains/skill/uninstall.js +69 -15
  490. package/dist/domains/skill/uninstall.js.map +1 -1
  491. package/dist/domains/workflow-contract/index.d.ts +1 -0
  492. package/dist/domains/workflow-contract/index.d.ts.map +1 -1
  493. package/dist/domains/workflow-contract/index.js +1 -0
  494. package/dist/domains/workflow-contract/index.js.map +1 -1
  495. package/dist/domains/workflow-contract/project-config.d.ts +2 -0
  496. package/dist/domains/workflow-contract/project-config.d.ts.map +1 -1
  497. package/dist/domains/workflow-contract/project-config.js +77 -17
  498. package/dist/domains/workflow-contract/project-config.js.map +1 -1
  499. package/dist/domains/workflow-contract/project-gitignore.d.ts +9 -0
  500. package/dist/domains/workflow-contract/project-gitignore.d.ts.map +1 -0
  501. package/dist/domains/workflow-contract/project-gitignore.js +108 -0
  502. package/dist/domains/workflow-contract/project-gitignore.js.map +1 -0
  503. package/dist/platform/install/platforms.d.ts +3 -1
  504. package/dist/platform/install/platforms.d.ts.map +1 -1
  505. package/dist/platform/install/platforms.js +9 -0
  506. package/dist/platform/install/platforms.js.map +1 -1
  507. package/dist/platform/paths/git-worktree.d.ts +2 -1
  508. package/dist/platform/paths/git-worktree.d.ts.map +1 -1
  509. package/dist/platform/paths/git-worktree.js +14 -1
  510. package/dist/platform/paths/git-worktree.js.map +1 -1
  511. package/dist/platform/process/external-command.d.ts +13 -0
  512. package/dist/platform/process/external-command.d.ts.map +1 -0
  513. package/dist/platform/process/external-command.js +45 -0
  514. package/dist/platform/process/external-command.js.map +1 -0
  515. package/dist/platform/process/git.d.ts +12 -0
  516. package/dist/platform/process/git.d.ts.map +1 -0
  517. package/dist/platform/process/git.js +86 -0
  518. package/dist/platform/process/git.js.map +1 -0
  519. package/dist/platform/process/spawn-command.d.ts +8 -0
  520. package/dist/platform/process/spawn-command.d.ts.map +1 -0
  521. package/dist/platform/process/spawn-command.js +113 -0
  522. package/dist/platform/process/spawn-command.js.map +1 -0
  523. package/eval/local/tasks/comet-native-clarification/validation/test_native_clarification.py +9 -21
  524. package/eval/local/tasks/comet-native-clarification-depth/validation/test_native_clarification_depth.py +4 -7
  525. package/eval/local/tasks/comet-native-clarification-modes/validation/test_native_clarification_modes.py +4 -10
  526. package/eval/local/tasks/comet-native-interrupted-transition/instruction.md +1 -1
  527. package/eval/local/tasks/comet-native-interrupted-transition/validation/test_native_interrupted_transition.py +15 -16
  528. package/eval/local/tasks/comet-native-repository-fact/instruction.md +2 -2
  529. package/eval/local/tasks/comet-native-repository-fact/validation/test_native_repository_fact.py +8 -2
  530. package/eval/local/tasks/comet-native-wave-b-decision-resume/instruction.md +8 -4
  531. package/eval/local/tasks/comet-native-wave-b-decision-resume/task.toml +6 -6
  532. package/eval/local/tasks/comet-native-wave-b-decision-resume/validation/test_native_wave_b_decision_resume.py +126 -135
  533. package/eval/local/tasks/comet-native-wave-c-verification-integrity/instruction.md +6 -6
  534. package/eval/local/tasks/comet-native-wave-c-verification-integrity/task.toml +8 -8
  535. package/eval/local/tasks/comet-native-wave-c-verification-integrity/validation/test_native_wave_c_verification_integrity.py +97 -317
  536. package/eval/local/tasks/comet-native-wave-d-stagnation-stop/instruction.md +7 -7
  537. package/eval/local/tasks/comet-native-wave-d-stagnation-stop/task.toml +4 -4
  538. package/eval/local/tasks/comet-native-wave-d-stagnation-stop/validation/test_native_wave_d_stagnation_stop.py +130 -199
  539. package/eval/local/tasks/comet-native-wave-e-parallel-safety/instruction.md +5 -5
  540. package/eval/local/tasks/comet-native-wave-e-parallel-safety/task.toml +8 -8
  541. package/eval/local/tasks/comet-native-wave-e-parallel-safety/validation/test_native_wave_e_parallel_safety.py +135 -239
  542. package/eval/local/tasks/comet-native-wave-f-dashboard-readonly/instruction.md +3 -3
  543. package/eval/local/tasks/comet-native-wave-f-dashboard-readonly/task.toml +6 -6
  544. package/eval/local/tasks/comet-native-wave-f-dashboard-readonly/validation/test_native_wave_f_dashboard_readonly.py +81 -439
  545. package/eval/local/tasks/comet-native-workflow/instruction.md +5 -4
  546. package/eval/local/tasks/comet-native-workflow/validation/test_native_workflow.py +145 -502
  547. package/eval/local/tasks/index.yaml +5 -5
  548. package/eval/local/tests/scaffold/test_native_aligned_eval.py +146 -35
  549. package/eval/local/tests/scaffold/test_native_wave_evaluations.py +75 -2054
  550. package/eval/local/tests/scaffold/test_tasks.py +38 -52
  551. package/eval/local/tests/tasks/test_tasks.py +3 -3
  552. package/eval/local/treatments/comet/comet_native_phase1.yaml +7 -4
  553. package/eval/scaffold/python/native_eval.py +10 -5
  554. package/eval/scaffold/python/validation/native_v4.py +249 -0
  555. package/eval/scaffold/python/validation/native_wave.py +4 -5
  556. package/eval/scaffold/python/validation/native_workflow.py +193 -97
  557. package/eval/scaffold/python/validation/rubric.py +114 -1
  558. package/package.json +8 -5
  559. package/assets/skills/comet-native/scripts/comet-native-check.mjs +0 -179
  560. package/assets/skills/comet-native/scripts/comet-native-checkpoint.mjs +0 -179
  561. package/assets/skills/comet-native/scripts/comet-native-evidence.mjs +0 -151
  562. package/assets/skills/comet-native/scripts/comet-native-receipt.mjs +0 -187
  563. package/dist/domains/comet-native/native-check-entry.d.ts +0 -2
  564. package/dist/domains/comet-native/native-check-entry.d.ts.map +0 -1
  565. package/dist/domains/comet-native/native-check-entry.js +0 -4
  566. package/dist/domains/comet-native/native-check-entry.js.map +0 -1
  567. package/dist/domains/comet-native/native-checkpoint-entry.d.ts +0 -2
  568. package/dist/domains/comet-native/native-checkpoint-entry.d.ts.map +0 -1
  569. package/dist/domains/comet-native/native-checkpoint-entry.js +0 -4
  570. package/dist/domains/comet-native/native-checkpoint-entry.js.map +0 -1
  571. package/dist/domains/comet-native/native-evidence-entry.d.ts +0 -2
  572. package/dist/domains/comet-native/native-evidence-entry.d.ts.map +0 -1
  573. package/dist/domains/comet-native/native-evidence-entry.js +0 -4
  574. package/dist/domains/comet-native/native-evidence-entry.js.map +0 -1
  575. package/dist/domains/comet-native/native-receipt-entry.d.ts +0 -2
  576. package/dist/domains/comet-native/native-receipt-entry.d.ts.map +0 -1
  577. package/dist/domains/comet-native/native-receipt-entry.js +0 -4
  578. package/dist/domains/comet-native/native-receipt-entry.js.map +0 -1
  579. package/dist/domains/dashboard/web/assets/channel-B_u-_i2t.js +0 -1
  580. package/dist/domains/dashboard/web/assets/classDiagram-4FO5ZUOK-BpA7BPgX.js +0 -1
  581. package/dist/domains/dashboard/web/assets/classDiagram-v2-Q7XG4LA2-BpA7BPgX.js +0 -1
  582. package/dist/domains/dashboard/web/assets/demo-DZYPLZpF.js +0 -25
  583. package/dist/domains/dashboard/web/assets/index-Bk1o-4VO.css +0 -1
  584. package/dist/domains/dashboard/web/assets/index-g8vyW0R_.js +0 -257
  585. package/dist/domains/dashboard/web/assets/stateDiagram-v2-BHNVJYJU-rKvBgr6I.js +0 -1
  586. /package/assets/skills/{comet → comet-classic}/reference/classic-layout.md +0 -0
  587. /package/assets/skills-zh/{comet → comet-classic}/reference/classic-layout.md +0 -0
@@ -1,41 +1,41 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as __cometCreateRequire } from 'module';
3
3
  const require = __cometCreateRequire(import.meta.url);
4
- var ff=Object.create;var hr=Object.defineProperty;var df=Object.getOwnPropertyDescriptor;var pf=Object.getOwnPropertyNames;var mf=Object.getPrototypeOf,hf=Object.prototype.hasOwnProperty;var jn=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,n)=>(typeof require<"u"?require:e)[n]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var G=(t,e,n)=>()=>{if(n)throw n[0];try{return t&&(e=t(t=0)),e}catch(i){throw n=[i],i}};var v=(t,e)=>()=>{try{return e||t((e={exports:{}}).exports,e),e.exports}catch(n){throw e=0,n}},gf=(t,e)=>{for(var n in e)hr(t,n,{get:e[n],enumerable:!0})},wf=(t,e,n,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of pf(e))!hf.call(t,r)&&r!==n&&hr(t,r,{get:()=>e[r],enumerable:!(i=df(e,r))||i.enumerable});return t};var Ve=(t,e,n)=>(n=t!=null?ff(mf(t)):{},wf(e||!t||!t.__esModule?hr(n,"default",{value:t,enumerable:!0}):n,t));var N=v(U=>{"use strict";var gr=Symbol.for("yaml.alias"),Fo=Symbol.for("yaml.document"),Tn=Symbol.for("yaml.map"),Mo=Symbol.for("yaml.pair"),wr=Symbol.for("yaml.scalar"),In=Symbol.for("yaml.seq"),ge=Symbol.for("yaml.node.type"),yf=t=>!!t&&typeof t=="object"&&t[ge]===gr,vf=t=>!!t&&typeof t=="object"&&t[ge]===Fo,bf=t=>!!t&&typeof t=="object"&&t[ge]===Tn,kf=t=>!!t&&typeof t=="object"&&t[ge]===Mo,Wo=t=>!!t&&typeof t=="object"&&t[ge]===wr,Sf=t=>!!t&&typeof t=="object"&&t[ge]===In;function Bo(t){if(t&&typeof t=="object")switch(t[ge]){case Tn:case In:return!0}return!1}function Cf(t){if(t&&typeof t=="object")switch(t[ge]){case gr:case Tn:case wr:case In:return!0}return!1}var Ef=t=>(Wo(t)||Bo(t))&&!!t.anchor;U.ALIAS=gr;U.DOC=Fo;U.MAP=Tn;U.NODE_TYPE=ge;U.PAIR=Mo;U.SCALAR=wr;U.SEQ=In;U.hasAnchor=Ef;U.isAlias=yf;U.isCollection=Bo;U.isDocument=vf;U.isMap=bf;U.isNode=Cf;U.isPair=kf;U.isScalar=Wo;U.isSeq=Sf});var Ot=v(yr=>{"use strict";var B=N(),Z=Symbol("break visit"),Ko=Symbol("skip children"),de=Symbol("remove node");function $n(t,e){let n=Yo(e);B.isDocument(t)?ft(null,t.contents,n,Object.freeze([t]))===de&&(t.contents=null):ft(null,t,n,Object.freeze([]))}$n.BREAK=Z;$n.SKIP=Ko;$n.REMOVE=de;function ft(t,e,n,i){let r=Uo(t,e,n,i);if(B.isNode(r)||B.isPair(r))return Vo(t,i,r),ft(t,r,n,i);if(typeof r!="symbol"){if(B.isCollection(e)){i=Object.freeze(i.concat(e));for(let s=0;s<e.items.length;++s){let o=ft(s,e.items[s],n,i);if(typeof o=="number")s=o-1;else{if(o===Z)return Z;o===de&&(e.items.splice(s,1),s-=1)}}}else if(B.isPair(e)){i=Object.freeze(i.concat(e));let s=ft("key",e.key,n,i);if(s===Z)return Z;s===de&&(e.key=null);let o=ft("value",e.value,n,i);if(o===Z)return Z;o===de&&(e.value=null)}}return r}async function qn(t,e){let n=Yo(e);B.isDocument(t)?await dt(null,t.contents,n,Object.freeze([t]))===de&&(t.contents=null):await dt(null,t,n,Object.freeze([]))}qn.BREAK=Z;qn.SKIP=Ko;qn.REMOVE=de;async function dt(t,e,n,i){let r=await Uo(t,e,n,i);if(B.isNode(r)||B.isPair(r))return Vo(t,i,r),dt(t,r,n,i);if(typeof r!="symbol"){if(B.isCollection(e)){i=Object.freeze(i.concat(e));for(let s=0;s<e.items.length;++s){let o=await dt(s,e.items[s],n,i);if(typeof o=="number")s=o-1;else{if(o===Z)return Z;o===de&&(e.items.splice(s,1),s-=1)}}}else if(B.isPair(e)){i=Object.freeze(i.concat(e));let s=await dt("key",e.key,n,i);if(s===Z)return Z;s===de&&(e.key=null);let o=await dt("value",e.value,n,i);if(o===Z)return Z;o===de&&(e.value=null)}}return r}function Yo(t){return typeof t=="object"&&(t.Collection||t.Node||t.Value)?Object.assign({Alias:t.Node,Map:t.Node,Scalar:t.Node,Seq:t.Node},t.Value&&{Map:t.Value,Scalar:t.Value,Seq:t.Value},t.Collection&&{Map:t.Collection,Seq:t.Collection},t):t}function Uo(t,e,n,i){if(typeof n=="function")return n(t,e,i);if(B.isMap(e))return n.Map?.(t,e,i);if(B.isSeq(e))return n.Seq?.(t,e,i);if(B.isPair(e))return n.Pair?.(t,e,i);if(B.isScalar(e))return n.Scalar?.(t,e,i);if(B.isAlias(e))return n.Alias?.(t,e,i)}function Vo(t,e,n){let i=e[e.length-1];if(B.isCollection(i))i.items[t]=n;else if(B.isPair(i))t==="key"?i.key=n:i.value=n;else if(B.isDocument(i))i.contents=n;else{let r=B.isAlias(i)?"alias":"scalar";throw new Error(`Cannot replace node with ${r} parent`)}}yr.visit=$n;yr.visitAsync=qn});var vr=v(Ho=>{"use strict";var Jo=N(),xf=Ot(),_f={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},Pf=t=>t.replace(/[!,[\]{}]/g,e=>_f[e]),At=class t{constructor(e,n){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},t.defaultYaml,e),this.tags=Object.assign({},t.defaultTags,n)}clone(){let e=new t(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){let e=new t(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:t.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},t.defaultTags);break}return e}add(e,n){this.atNextDocument&&(this.yaml={explicit:t.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},t.defaultTags),this.atNextDocument=!1);let i=e.trim().split(/[ \t]+/),r=i.shift();switch(r){case"%TAG":{if(i.length!==2&&(n(0,"%TAG directive should contain exactly two parts"),i.length<2))return!1;let[s,o]=i;return this.tags[s]=o,!0}case"%YAML":{if(this.yaml.explicit=!0,i.length!==1)return n(0,"%YAML directive should contain exactly one part"),!1;let[s]=i;if(s==="1.1"||s==="1.2")return this.yaml.version=s,!0;{let o=/^\d+\.\d+$/.test(s);return n(6,`Unsupported YAML version ${s}`,o),!1}}default:return n(0,`Unknown directive ${r}`,!0),!1}}tagName(e,n){if(e==="!")return"!";if(e[0]!=="!")return n(`Not a valid tag: ${e}`),null;if(e[1]==="<"){let o=e.slice(2,-1);return o==="!"||o==="!!"?(n(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&n("Verbatim tags must end with a >"),o)}let[,i,r]=e.match(/^(.*!)([^!]*)$/s);r||n(`The ${e} tag has no suffix`);let s=this.tags[i];if(s)try{return s+decodeURIComponent(r)}catch(o){return n(String(o)),null}return i==="!"?e:(n(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[n,i]of Object.entries(this.tags))if(e.startsWith(i))return n+Pf(e.substring(i.length));return e[0]==="!"?e:`!<${e}>`}toString(e){let n=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],i=Object.entries(this.tags),r;if(e&&i.length>0&&Jo.isNode(e.contents)){let s={};xf.visit(e.contents,(o,a)=>{Jo.isNode(a)&&a.tag&&(s[a.tag]=!0)}),r=Object.keys(s)}else r=[];for(let[s,o]of i)s==="!!"&&o==="tag:yaml.org,2002:"||(!e||r.some(a=>a.startsWith(o)))&&n.push(`%TAG ${s} ${o}`);return n.join(`
5
- `)}};At.defaultYaml={explicit:!1,version:"1.2"};At.defaultTags={"!!":"tag:yaml.org,2002:"};Ho.Directives=At});var Ln=v(jt=>{"use strict";var Go=N(),Rf=Ot();function Nf(t){if(/[\x00-\x19\s,[\]{}]/.test(t)){let n=`Anchor must not contain whitespace or control characters: ${JSON.stringify(t)}`;throw new Error(n)}return!0}function zo(t){let e=new Set;return Rf.visit(t,{Value(n,i){i.anchor&&e.add(i.anchor)}}),e}function Qo(t,e){for(let n=1;;++n){let i=`${t}${n}`;if(!e.has(i))return i}}function Of(t,e){let n=[],i=new Map,r=null;return{onAnchor:s=>{n.push(s),r??(r=zo(t));let o=Qo(e,r);return r.add(o),o},setAnchors:()=>{for(let s of n){let o=i.get(s);if(typeof o=="object"&&o.anchor&&(Go.isScalar(o.node)||Go.isCollection(o.node)))o.node.anchor=o.anchor;else{let a=new Error("Failed to resolve repeated object (this should not happen)");throw a.source=s,a}}},sourceObjects:i}}jt.anchorIsValid=Nf;jt.anchorNames=zo;jt.createNodeAnchors=Of;jt.findNewAnchor=Qo});var br=v(Xo=>{"use strict";function Tt(t,e,n,i){if(i&&typeof i=="object")if(Array.isArray(i))for(let r=0,s=i.length;r<s;++r){let o=i[r],a=Tt(t,i,String(r),o);a===void 0?delete i[r]:a!==o&&(i[r]=a)}else if(i instanceof Map)for(let r of Array.from(i.keys())){let s=i.get(r),o=Tt(t,i,r,s);o===void 0?i.delete(r):o!==s&&i.set(r,o)}else if(i instanceof Set)for(let r of Array.from(i)){let s=Tt(t,i,r,r);s===void 0?i.delete(r):s!==r&&(i.delete(r),i.add(s))}else for(let[r,s]of Object.entries(i)){let o=Tt(t,i,r,s);o===void 0?delete i[r]:o!==s&&(i[r]=o)}return t.call(e,n,i)}Xo.applyReviver=Tt});var Ee=v(ea=>{"use strict";var Af=N();function Zo(t,e,n){if(Array.isArray(t))return t.map((i,r)=>Zo(i,String(r),n));if(t&&typeof t.toJSON=="function"){if(!n||!Af.hasAnchor(t))return t.toJSON(e,n);let i={aliasCount:0,count:1,res:void 0};n.anchors.set(t,i),n.onCreate=s=>{i.res=s,delete n.onCreate};let r=t.toJSON(e,n);return n.onCreate&&n.onCreate(r),r}return typeof t=="bigint"&&!n?.keep?Number(t):t}ea.toJS=Zo});var Dn=v(na=>{"use strict";var jf=br(),ta=N(),Tf=Ee(),kr=class{constructor(e){Object.defineProperty(this,ta.NODE_TYPE,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:n,maxAliasCount:i,onAnchor:r,reviver:s}={}){if(!ta.isDocument(e))throw new TypeError("A document argument is required");let o={anchors:new Map,doc:e,keep:!0,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof i=="number"?i:100},a=Tf.toJS(this,"",o);if(typeof r=="function")for(let{count:c,res:l}of o.anchors.values())r(l,c);return typeof s=="function"?jf.applyReviver(s,{"":a},"",a):a}};na.NodeBase=kr});var It=v(ia=>{"use strict";var If=Ln(),$f=Ot(),pt=N(),qf=Dn(),Lf=Ee(),Sr=class extends qf.NodeBase{constructor(e){super(pt.ALIAS),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e,n){if(n?.maxAliasCount===0)throw new ReferenceError("Alias resolution is disabled");let i;n?.aliasResolveCache?i=n.aliasResolveCache:(i=[],$f.visit(e,{Node:(s,o)=>{(pt.isAlias(o)||pt.hasAnchor(o))&&i.push(o)}}),n&&(n.aliasResolveCache=i));let r;for(let s of i){if(s===this)break;s.anchor===this.source&&(r=s)}return r}toJSON(e,n){if(!n)return{source:this.source};let{anchors:i,doc:r,maxAliasCount:s}=n,o=this.resolve(r,n);if(!o){let c=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(c)}let a=i.get(o);if(a||(Lf.toJS(o,null,n),a=i.get(o)),a?.res===void 0){let c="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(c)}if(s>=0&&(a.count+=1,a.aliasCount===0&&(a.aliasCount=Fn(r,o,i)),a.count*a.aliasCount>s)){let c="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(c)}return a.res}toString(e,n,i){let r=`*${this.source}`;if(e){if(If.anchorIsValid(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let s=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(s)}if(e.implicitKey)return`${r} `}return r}};function Fn(t,e,n){if(pt.isAlias(e)){let i=e.resolve(t),r=n&&i&&n.get(i);return r?r.count*r.aliasCount:0}else if(pt.isCollection(e)){let i=0;for(let r of e.items){let s=Fn(t,r,n);s>i&&(i=s)}return i}else if(pt.isPair(e)){let i=Fn(t,e.key,n),r=Fn(t,e.value,n);return Math.max(i,r)}return 1}ia.Alias=Sr});var q=v(Cr=>{"use strict";var Df=N(),Ff=Dn(),Mf=Ee(),Wf=t=>!t||typeof t!="function"&&typeof t!="object",xe=class extends Ff.NodeBase{constructor(e){super(Df.SCALAR),this.value=e}toJSON(e,n){return n?.keep?this.value:Mf.toJS(this.value,e,n)}toString(){return String(this.value)}};xe.BLOCK_FOLDED="BLOCK_FOLDED";xe.BLOCK_LITERAL="BLOCK_LITERAL";xe.PLAIN="PLAIN";xe.QUOTE_DOUBLE="QUOTE_DOUBLE";xe.QUOTE_SINGLE="QUOTE_SINGLE";Cr.Scalar=xe;Cr.isScalarValue=Wf});var $t=v(sa=>{"use strict";var Bf=It(),Je=N(),ra=q(),Kf="tag:yaml.org,2002:";function Yf(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 Uf(t,e,n){if(Je.isDocument(t)&&(t=t.contents),Je.isNode(t))return t;if(Je.isPair(t)){let u=n.schema[Je.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 Bf.Alias(c.anchor);c={anchor:null,node:null},a.set(t,c)}e?.startsWith("!!")&&(e=Kf+e.slice(2));let l=Yf(t,e,o.tags);if(!l){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let u=new ra.Scalar(t);return c&&(c.node=u),u}l=t instanceof Map?o[Je.MAP]:Symbol.iterator in Object(t)?o[Je.SEQ]:o[Je.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 ra.Scalar(t);return e?f.tag=e:l.default||(f.tag=l.tag),c&&(c.node=f),f}sa.createNode=Uf});var Wn=v(Mn=>{"use strict";var Vf=$t(),pe=N(),Jf=Dn();function Er(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 Vf.createNode(i,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:t,sourceObjects:new Map})}var oa=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,xr=class extends Jf.NodeBase{constructor(e,n){super(e),Object.defineProperty(this,"schema",{value:n,configurable:!0,enumerable:!1,writable:!0})}clone(e){let n=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(n.schema=e),n.items=n.items.map(i=>pe.isNode(i)||pe.isPair(i)?i.clone(e):i),this.range&&(n.range=this.range.slice()),n}addIn(e,n){if(oa(e))this.add(n);else{let[i,...r]=e,s=this.get(i,!0);if(pe.isCollection(s))s.addIn(r,n);else if(s===void 0&&this.schema)this.set(i,Er(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,Er(this.schema,r,n));else throw new Error(`Expected YAML collection at ${i}. Remaining path: ${r}`)}}};Mn.Collection=xr;Mn.collectionFromPath=Er;Mn.isEmptyPath=oa});var qt=v(Bn=>{"use strict";var Hf=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function _r(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var Gf=(t,e,n)=>t.endsWith(`
6
- `)?_r(n,e):n.includes(`
4
+ var mf=Object.create;var gr=Object.defineProperty;var pf=Object.getOwnPropertyDescriptor;var hf=Object.getOwnPropertyNames;var gf=Object.getPrototypeOf,wf=Object.prototype.hasOwnProperty;var jn=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,n)=>(typeof require<"u"?require:e)[n]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var V=(t,e,n)=>()=>{if(n)throw n[0];try{return t&&(e=t(t=0)),e}catch(i){throw n=[i],i}};var v=(t,e)=>()=>{try{return e||t((e={exports:{}}).exports,e),e.exports}catch(n){throw e=0,n}},yf=(t,e)=>{for(var n in e)gr(t,n,{get:e[n],enumerable:!0})},vf=(t,e,n,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of hf(e))!wf.call(t,r)&&r!==n&&gr(t,r,{get:()=>e[r],enumerable:!(i=pf(e,r))||i.enumerable});return t};var He=(t,e,n)=>(n=t!=null?mf(gf(t)):{},vf(e||!t||!t.__esModule?gr(n,"default",{value:t,enumerable:!0}):n,t));var N=v(J=>{"use strict";var wr=Symbol.for("yaml.alias"),Fo=Symbol.for("yaml.document"),Tn=Symbol.for("yaml.map"),Mo=Symbol.for("yaml.pair"),yr=Symbol.for("yaml.scalar"),In=Symbol.for("yaml.seq"),ge=Symbol.for("yaml.node.type"),bf=t=>!!t&&typeof t=="object"&&t[ge]===wr,kf=t=>!!t&&typeof t=="object"&&t[ge]===Fo,Sf=t=>!!t&&typeof t=="object"&&t[ge]===Tn,Cf=t=>!!t&&typeof t=="object"&&t[ge]===Mo,Wo=t=>!!t&&typeof t=="object"&&t[ge]===yr,Ef=t=>!!t&&typeof t=="object"&&t[ge]===In;function Bo(t){if(t&&typeof t=="object")switch(t[ge]){case Tn:case In:return!0}return!1}function xf(t){if(t&&typeof t=="object")switch(t[ge]){case wr:case Tn:case yr:case In:return!0}return!1}var _f=t=>(Wo(t)||Bo(t))&&!!t.anchor;J.ALIAS=wr;J.DOC=Fo;J.MAP=Tn;J.NODE_TYPE=ge;J.PAIR=Mo;J.SCALAR=yr;J.SEQ=In;J.hasAnchor=_f;J.isAlias=bf;J.isCollection=Bo;J.isDocument=kf;J.isMap=Sf;J.isNode=xf;J.isPair=Cf;J.isScalar=Wo;J.isSeq=Ef});var At=v(vr=>{"use strict";var B=N(),Z=Symbol("break visit"),Ko=Symbol("skip children"),me=Symbol("remove node");function $n(t,e){let n=Yo(e);B.isDocument(t)?ft(null,t.contents,n,Object.freeze([t]))===me&&(t.contents=null):ft(null,t,n,Object.freeze([]))}$n.BREAK=Z;$n.SKIP=Ko;$n.REMOVE=me;function ft(t,e,n,i){let r=Uo(t,e,n,i);if(B.isNode(r)||B.isPair(r))return Vo(t,i,r),ft(t,r,n,i);if(typeof r!="symbol"){if(B.isCollection(e)){i=Object.freeze(i.concat(e));for(let s=0;s<e.items.length;++s){let o=ft(s,e.items[s],n,i);if(typeof o=="number")s=o-1;else{if(o===Z)return Z;o===me&&(e.items.splice(s,1),s-=1)}}}else if(B.isPair(e)){i=Object.freeze(i.concat(e));let s=ft("key",e.key,n,i);if(s===Z)return Z;s===me&&(e.key=null);let o=ft("value",e.value,n,i);if(o===Z)return Z;o===me&&(e.value=null)}}return r}async function qn(t,e){let n=Yo(e);B.isDocument(t)?await dt(null,t.contents,n,Object.freeze([t]))===me&&(t.contents=null):await dt(null,t,n,Object.freeze([]))}qn.BREAK=Z;qn.SKIP=Ko;qn.REMOVE=me;async function dt(t,e,n,i){let r=await Uo(t,e,n,i);if(B.isNode(r)||B.isPair(r))return Vo(t,i,r),dt(t,r,n,i);if(typeof r!="symbol"){if(B.isCollection(e)){i=Object.freeze(i.concat(e));for(let s=0;s<e.items.length;++s){let o=await dt(s,e.items[s],n,i);if(typeof o=="number")s=o-1;else{if(o===Z)return Z;o===me&&(e.items.splice(s,1),s-=1)}}}else if(B.isPair(e)){i=Object.freeze(i.concat(e));let s=await dt("key",e.key,n,i);if(s===Z)return Z;s===me&&(e.key=null);let o=await dt("value",e.value,n,i);if(o===Z)return Z;o===me&&(e.value=null)}}return r}function Yo(t){return typeof t=="object"&&(t.Collection||t.Node||t.Value)?Object.assign({Alias:t.Node,Map:t.Node,Scalar:t.Node,Seq:t.Node},t.Value&&{Map:t.Value,Scalar:t.Value,Seq:t.Value},t.Collection&&{Map:t.Collection,Seq:t.Collection},t):t}function Uo(t,e,n,i){if(typeof n=="function")return n(t,e,i);if(B.isMap(e))return n.Map?.(t,e,i);if(B.isSeq(e))return n.Seq?.(t,e,i);if(B.isPair(e))return n.Pair?.(t,e,i);if(B.isScalar(e))return n.Scalar?.(t,e,i);if(B.isAlias(e))return n.Alias?.(t,e,i)}function Vo(t,e,n){let i=e[e.length-1];if(B.isCollection(i))i.items[t]=n;else if(B.isPair(i))t==="key"?i.key=n:i.value=n;else if(B.isDocument(i))i.contents=n;else{let r=B.isAlias(i)?"alias":"scalar";throw new Error(`Cannot replace node with ${r} parent`)}}vr.visit=$n;vr.visitAsync=qn});var br=v(Ho=>{"use strict";var Jo=N(),Pf=At(),Rf={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},Nf=t=>t.replace(/[!,[\]{}]/g,e=>Rf[e]),Ot=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+Nf(e.substring(i.length));return e[0]==="!"?e:`!<${e}>`}toString(e){let n=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],i=Object.entries(this.tags),r;if(e&&i.length>0&&Jo.isNode(e.contents)){let s={};Pf.visit(e.contents,(o,a)=>{Jo.isNode(a)&&a.tag&&(s[a.tag]=!0)}),r=Object.keys(s)}else r=[];for(let[s,o]of i)s==="!!"&&o==="tag:yaml.org,2002:"||(!e||r.some(a=>a.startsWith(o)))&&n.push(`%TAG ${s} ${o}`);return n.join(`
5
+ `)}};Ot.defaultYaml={explicit:!1,version:"1.2"};Ot.defaultTags={"!!":"tag:yaml.org,2002:"};Ho.Directives=Ot});var Ln=v(jt=>{"use strict";var Go=N(),Af=At();function Of(t){if(/[\x00-\x19\s,[\]{}]/.test(t)){let n=`Anchor must not contain whitespace or control characters: ${JSON.stringify(t)}`;throw new Error(n)}return!0}function zo(t){let e=new Set;return Af.visit(t,{Value(n,i){i.anchor&&e.add(i.anchor)}}),e}function Qo(t,e){for(let n=1;;++n){let i=`${t}${n}`;if(!e.has(i))return i}}function jf(t,e){let n=[],i=new Map,r=null;return{onAnchor:s=>{n.push(s),r??(r=zo(t));let o=Qo(e,r);return r.add(o),o},setAnchors:()=>{for(let s of n){let o=i.get(s);if(typeof o=="object"&&o.anchor&&(Go.isScalar(o.node)||Go.isCollection(o.node)))o.node.anchor=o.anchor;else{let a=new Error("Failed to resolve repeated object (this should not happen)");throw a.source=s,a}}},sourceObjects:i}}jt.anchorIsValid=Of;jt.anchorNames=zo;jt.createNodeAnchors=jf;jt.findNewAnchor=Qo});var kr=v(Xo=>{"use strict";function Tt(t,e,n,i){if(i&&typeof i=="object")if(Array.isArray(i))for(let r=0,s=i.length;r<s;++r){let o=i[r],a=Tt(t,i,String(r),o);a===void 0?delete i[r]:a!==o&&(i[r]=a)}else if(i instanceof Map)for(let r of Array.from(i.keys())){let s=i.get(r),o=Tt(t,i,r,s);o===void 0?i.delete(r):o!==s&&i.set(r,o)}else if(i instanceof Set)for(let r of Array.from(i)){let s=Tt(t,i,r,r);s===void 0?i.delete(r):s!==r&&(i.delete(r),i.add(s))}else for(let[r,s]of Object.entries(i)){let o=Tt(t,i,r,s);o===void 0?delete i[r]:o!==s&&(i[r]=o)}return t.call(e,n,i)}Xo.applyReviver=Tt});var Ee=v(ea=>{"use strict";var Tf=N();function Zo(t,e,n){if(Array.isArray(t))return t.map((i,r)=>Zo(i,String(r),n));if(t&&typeof t.toJSON=="function"){if(!n||!Tf.hasAnchor(t))return t.toJSON(e,n);let i={aliasCount:0,count:1,res:void 0};n.anchors.set(t,i),n.onCreate=s=>{i.res=s,delete n.onCreate};let r=t.toJSON(e,n);return n.onCreate&&n.onCreate(r),r}return typeof t=="bigint"&&!n?.keep?Number(t):t}ea.toJS=Zo});var Dn=v(na=>{"use strict";var If=kr(),ta=N(),$f=Ee(),Sr=class{constructor(e){Object.defineProperty(this,ta.NODE_TYPE,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:n,maxAliasCount:i,onAnchor:r,reviver:s}={}){if(!ta.isDocument(e))throw new TypeError("A document argument is required");let o={anchors:new Map,doc:e,keep:!0,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof i=="number"?i:100},a=$f.toJS(this,"",o);if(typeof r=="function")for(let{count:c,res:l}of o.anchors.values())r(l,c);return typeof s=="function"?If.applyReviver(s,{"":a},"",a):a}};na.NodeBase=Sr});var It=v(ia=>{"use strict";var qf=Ln(),Lf=At(),mt=N(),Df=Dn(),Ff=Ee(),Cr=class extends Df.NodeBase{constructor(e){super(mt.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=[],Lf.visit(e,{Node:(s,o)=>{(mt.isAlias(o)||mt.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||(Ff.toJS(o,null,n),a=i.get(o)),a?.res===void 0){let c="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(c)}if(s>=0&&(a.count+=1,a.aliasCount===0&&(a.aliasCount=Fn(r,o,i)),a.count*a.aliasCount>s)){let c="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(c)}return a.res}toString(e,n,i){let r=`*${this.source}`;if(e){if(qf.anchorIsValid(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let s=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(s)}if(e.implicitKey)return`${r} `}return r}};function Fn(t,e,n){if(mt.isAlias(e)){let i=e.resolve(t),r=n&&i&&n.get(i);return r?r.count*r.aliasCount:0}else if(mt.isCollection(e)){let i=0;for(let r of e.items){let s=Fn(t,r,n);s>i&&(i=s)}return i}else if(mt.isPair(e)){let i=Fn(t,e.key,n),r=Fn(t,e.value,n);return Math.max(i,r)}return 1}ia.Alias=Cr});var L=v(Er=>{"use strict";var Mf=N(),Wf=Dn(),Bf=Ee(),Kf=t=>!t||typeof t!="function"&&typeof t!="object",xe=class extends Wf.NodeBase{constructor(e){super(Mf.SCALAR),this.value=e}toJSON(e,n){return n?.keep?this.value:Bf.toJS(this.value,e,n)}toString(){return String(this.value)}};xe.BLOCK_FOLDED="BLOCK_FOLDED";xe.BLOCK_LITERAL="BLOCK_LITERAL";xe.PLAIN="PLAIN";xe.QUOTE_DOUBLE="QUOTE_DOUBLE";xe.QUOTE_SINGLE="QUOTE_SINGLE";Er.Scalar=xe;Er.isScalarValue=Kf});var $t=v(sa=>{"use strict";var Yf=It(),Ge=N(),ra=L(),Uf="tag:yaml.org,2002:";function Vf(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 Jf(t,e,n){if(Ge.isDocument(t)&&(t=t.contents),Ge.isNode(t))return t;if(Ge.isPair(t)){let u=n.schema[Ge.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 Yf.Alias(c.anchor);c={anchor:null,node:null},a.set(t,c)}e?.startsWith("!!")&&(e=Uf+e.slice(2));let l=Vf(t,e,o.tags);if(!l){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let u=new ra.Scalar(t);return c&&(c.node=u),u}l=t instanceof Map?o[Ge.MAP]:Symbol.iterator in Object(t)?o[Ge.SEQ]:o[Ge.MAP]}s&&(s(l),delete n.onTagObj);let d=l?.createNode?l.createNode(n.schema,t,n):typeof l?.nodeClass?.from=="function"?l.nodeClass.from(n.schema,t,n):new ra.Scalar(t);return e?d.tag=e:l.default||(d.tag=l.tag),c&&(c.node=d),d}sa.createNode=Jf});var Wn=v(Mn=>{"use strict";var Hf=$t(),pe=N(),Gf=Dn();function xr(t,e,n){let i=n;for(let r=e.length-1;r>=0;--r){let s=e[r];if(typeof s=="number"&&Number.isInteger(s)&&s>=0){let o=[];o[s]=i,i=o}else i=new Map([[s,i]])}return Hf.createNode(i,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:t,sourceObjects:new Map})}var oa=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,_r=class extends Gf.NodeBase{constructor(e,n){super(e),Object.defineProperty(this,"schema",{value:n,configurable:!0,enumerable:!1,writable:!0})}clone(e){let n=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(n.schema=e),n.items=n.items.map(i=>pe.isNode(i)||pe.isPair(i)?i.clone(e):i),this.range&&(n.range=this.range.slice()),n}addIn(e,n){if(oa(e))this.add(n);else{let[i,...r]=e,s=this.get(i,!0);if(pe.isCollection(s))s.addIn(r,n);else if(s===void 0&&this.schema)this.set(i,xr(this.schema,r,n));else throw new Error(`Expected YAML collection at ${i}. Remaining path: ${r}`)}}deleteIn(e){let[n,...i]=e;if(i.length===0)return this.delete(n);let r=this.get(n,!0);if(pe.isCollection(r))return r.deleteIn(i);throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}getIn(e,n){let[i,...r]=e,s=this.get(i,!0);return r.length===0?!n&&pe.isScalar(s)?s.value:s:pe.isCollection(s)?s.getIn(r,n):void 0}hasAllNullValues(e){return this.items.every(n=>{if(!pe.isPair(n))return!1;let i=n.value;return i==null||e&&pe.isScalar(i)&&i.value==null&&!i.commentBefore&&!i.comment&&!i.tag})}hasIn(e){let[n,...i]=e;if(i.length===0)return this.has(n);let r=this.get(n,!0);return pe.isCollection(r)?r.hasIn(i):!1}setIn(e,n){let[i,...r]=e;if(r.length===0)this.set(i,n);else{let s=this.get(i,!0);if(pe.isCollection(s))s.setIn(r,n);else if(s===void 0&&this.schema)this.set(i,xr(this.schema,r,n));else throw new Error(`Expected YAML collection at ${i}. Remaining path: ${r}`)}}};Mn.Collection=_r;Mn.collectionFromPath=xr;Mn.isEmptyPath=oa});var qt=v(Bn=>{"use strict";var zf=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function Pr(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var Qf=(t,e,n)=>t.endsWith(`
6
+ `)?Pr(n,e):n.includes(`
7
7
  `)?`
8
- `+_r(n,e):(t.endsWith(" ")?"":" ")+n;Bn.indentComment=_r;Bn.lineComment=Gf;Bn.stringifyComment=Hf});var ca=v(Lt=>{"use strict";var zf="flow",Pr="block",Kn="quoted";function Qf(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,h,w=!1,p=-1,m=-1,g=-1;n===Pr&&(p=aa(t,p,e.length),p!==-1&&(u=p+c));for(let k;k=t[p+=1];){if(n===Kn&&k==="\\"){switch(m=p,t[p+1]){case"x":p+=3;break;case"u":p+=5;break;case"U":p+=9;break;default:p+=1}g=p}if(k===`
9
- `)n===Pr&&(p=aa(t,p,e.length)),u=p+e.length+c,d=void 0;else{if(k===" "&&h&&h!==" "&&h!==`
10
- `&&h!==" "){let C=t[p+1];C&&C!==" "&&C!==`
11
- `&&C!==" "&&(d=p)}if(p>=u)if(d)l.push(d),u=d+c,d=void 0;else if(n===Kn){for(;h===" "||h===" ";)h=k,k=t[p+=1],w=!0;let C=p>g+1?p-2:m-1;if(f[C])return t;l.push(C),f[C]=!0,u=C+c,d=void 0}else w=!0}h=k}if(w&&a&&a(),l.length===0)return t;o&&o();let y=t.slice(0,l[0]);for(let k=0;k<l.length;++k){let C=l[k],x=l[k+1]||t.length;C===0?y=`
12
- ${e}${t.slice(0,x)}`:(n===Kn&&f[C]&&(y+=`${t[C]}\\`),y+=`
8
+ `+Pr(n,e):(t.endsWith(" ")?"":" ")+n;Bn.indentComment=Pr;Bn.lineComment=Qf;Bn.stringifyComment=zf});var ca=v(Lt=>{"use strict";var Xf="flow",Rr="block",Kn="quoted";function Zf(t,e,n="flow",{indentAtStart:i,lineWidth:r=80,minContentWidth:s=20,onFold:o,onOverflow:a}={}){if(!r||r<0)return t;r<s&&(s=0);let c=Math.max(1+s,1+r-e.length);if(t.length<=c)return t;let l=[],d={},u=r-e.length;typeof i=="number"&&(i>r-Math.max(2,s)?l.push(0):u=r-i);let f,h,w=!1,m=-1,p=-1,g=-1;n===Rr&&(m=aa(t,m,e.length),m!==-1&&(u=m+c));for(let k;k=t[m+=1];){if(n===Kn&&k==="\\"){switch(p=m,t[m+1]){case"x":m+=3;break;case"u":m+=5;break;case"U":m+=9;break;default:m+=1}g=m}if(k===`
9
+ `)n===Rr&&(m=aa(t,m,e.length)),u=m+e.length+c,f=void 0;else{if(k===" "&&h&&h!==" "&&h!==`
10
+ `&&h!==" "){let C=t[m+1];C&&C!==" "&&C!==`
11
+ `&&C!==" "&&(f=m)}if(m>=u)if(f)l.push(f),u=f+c,f=void 0;else if(n===Kn){for(;h===" "||h===" ";)h=k,k=t[m+=1],w=!0;let C=m>g+1?m-2:p-1;if(d[C])return t;l.push(C),d[C]=!0,u=C+c,f=void 0}else w=!0}h=k}if(w&&a&&a(),l.length===0)return t;o&&o();let y=t.slice(0,l[0]);for(let k=0;k<l.length;++k){let C=l[k],x=l[k+1]||t.length;C===0?y=`
12
+ ${e}${t.slice(0,x)}`:(n===Kn&&d[C]&&(y+=`${t[C]}\\`),y+=`
13
13
  ${e}${t.slice(C+1,x)}`)}return y}function aa(t,e,n){let i=e,r=e+1,s=t[r];for(;s===" "||s===" ";)if(e<r+n)s=t[++e];else{do s=t[++e];while(s&&s!==`
14
- `);i=e,r=e+1,s=t[r]}return i}Lt.FOLD_BLOCK=Pr;Lt.FOLD_FLOW=zf;Lt.FOLD_QUOTED=Kn;Lt.foldFlowLines=Qf});var Ft=v(la=>{"use strict";var ae=q(),_e=ca(),Un=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),Vn=t=>/^(%|---|\.\.\.)/m.test(t);function Xf(t,e,n){if(!e||e<0)return!1;let i=e-n,r=t.length;if(r<=i)return!1;for(let s=0,o=0;s<r;++s)if(t[s]===`
15
- `){if(s-o>i)return!0;if(o=s+1,r-o<=i)return!1}return!0}function Dt(t,e){let n=JSON.stringify(t);if(e.options.doubleQuotedAsJSON)return n;let{implicitKey:i}=e,r=e.options.doubleQuotedMinMultiLineLength,s=e.indent||(Vn(t)?" ":""),o="",a=0;for(let c=0,l=n[c];l;l=n[++c])if(l===" "&&n[c+1]==="\\"&&n[c+2]==="n"&&(o+=n.slice(a,c)+"\\ ",c+=1,a=c,l="\\"),l==="\\")switch(n[c+1]){case"u":{o+=n.slice(a,c);let 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)+`
14
+ `);i=e,r=e+1,s=t[r]}return i}Lt.FOLD_BLOCK=Rr;Lt.FOLD_FLOW=Xf;Lt.FOLD_QUOTED=Kn;Lt.foldFlowLines=Zf});var Ft=v(la=>{"use strict";var ce=L(),_e=ca(),Un=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),Vn=t=>/^(%|---|\.\.\.)/m.test(t);function ed(t,e,n){if(!e||e<0)return!1;let i=e-n,r=t.length;if(r<=i)return!1;for(let s=0,o=0;s<r;++s)if(t[s]===`
15
+ `){if(s-o>i)return!0;if(o=s+1,r-o<=i)return!1}return!0}function Dt(t,e){let n=JSON.stringify(t);if(e.options.doubleQuotedAsJSON)return n;let{implicitKey:i}=e,r=e.options.doubleQuotedMinMultiLineLength,s=e.indent||(Vn(t)?" ":""),o="",a=0;for(let c=0,l=n[c];l;l=n[++c])if(l===" "&&n[c+1]==="\\"&&n[c+2]==="n"&&(o+=n.slice(a,c)+"\\ ",c+=1,a=c,l="\\"),l==="\\")switch(n[c+1]){case"u":{o+=n.slice(a,c);let d=n.substr(c+2,4);switch(d){case"0000":o+="\\0";break;case"0007":o+="\\a";break;case"000b":o+="\\v";break;case"001b":o+="\\e";break;case"0085":o+="\\N";break;case"00a0":o+="\\_";break;case"2028":o+="\\L";break;case"2029":o+="\\P";break;default:d.substr(0,2)==="00"?o+="\\x"+d.substr(2):o+=n.substr(c,6)}c+=5,a=c+1}break;case"n":if(i||n[c+2]==='"'||n.length<r)c+=1;else{for(o+=n.slice(a,c)+`
16
16
 
17
17
  `;n[c+2]==="\\"&&n[c+3]==="n"&&n[c+4]!=='"';)o+=`
18
- `,c+=2;o+=s,n[c+2]===" "&&(o+="\\"),c+=1,a=c+1}break;default:c+=1}return o=a?o+n.slice(a):n,i?o:_e.foldFlowLines(o,s,_e.FOLD_QUOTED,Un(e,!1))}function Rr(t,e){if(e.options.singleQuote===!1||e.implicitKey&&t.includes(`
18
+ `,c+=2;o+=s,n[c+2]===" "&&(o+="\\"),c+=1,a=c+1}break;default:c+=1}return o=a?o+n.slice(a):n,i?o:_e.foldFlowLines(o,s,_e.FOLD_QUOTED,Un(e,!1))}function Nr(t,e){if(e.options.singleQuote===!1||e.implicitKey&&t.includes(`
19
19
  `)||/[ \t]\n|\n[ \t]/.test(t))return Dt(t,e);let n=e.indent||(Vn(t)?" ":""),i="'"+t.replace(/'/g,"''").replace(/\n+/g,`$&
20
- ${n}`)+"'";return e.implicitKey?i:_e.foldFlowLines(i,n,_e.FOLD_FLOW,Un(e,!1))}function mt(t,e){let{singleQuote:n}=e.options,i;if(n===!1)i=Dt;else{let r=t.includes('"'),s=t.includes("'");r&&!s?i=Rr:s&&!r?i=Dt:i=n?Rr:Dt}return i(t,e)}var Nr;try{Nr=new RegExp(`(^|(?<!
20
+ ${n}`)+"'";return e.implicitKey?i:_e.foldFlowLines(i,n,_e.FOLD_FLOW,Un(e,!1))}function pt(t,e){let{singleQuote:n}=e.options,i;if(n===!1)i=Dt;else{let r=t.includes('"'),s=t.includes("'");r&&!s?i=Nr:s&&!r?i=Dt:i=n?Nr:Dt}return i(t,e)}var Ar;try{Ar=new RegExp(`(^|(?<!
21
21
  ))
22
22
  +(?!
23
- |$)`,"g")}catch{Nr=/\n+(?!\n|$)/g}function Yn({comment:t,type:e,value:n},i,r,s){let{blockQuote:o,commentString:a,lineWidth:c}=i.options;if(!o||/\n[\t ]+$/.test(n))return mt(n,i);let l=i.indent||(i.forceBlockIndent||Vn(n)?" ":""),f=o==="literal"?!0:o==="folded"||e===ae.Scalar.BLOCK_FOLDED?!1:e===ae.Scalar.BLOCK_LITERAL?!0:!Xf(n,c,l.length);if(!n)return f?`|
23
+ |$)`,"g")}catch{Ar=/\n+(?!\n|$)/g}function Yn({comment:t,type:e,value:n},i,r,s){let{blockQuote:o,commentString:a,lineWidth:c}=i.options;if(!o||/\n[\t ]+$/.test(n))return pt(n,i);let l=i.indent||(i.forceBlockIndent||Vn(n)?" ":""),d=o==="literal"?!0:o==="folded"||e===ce.Scalar.BLOCK_FOLDED?!1:e===ce.Scalar.BLOCK_LITERAL?!0:!ed(n,c,l.length);if(!n)return d?`|
24
24
  `:`>
25
- `;let u,d;for(d=n.length;d>0;--d){let x=n[d-1];if(x!==`
26
- `&&x!==" "&&x!==" ")break}let h=n.substring(d),w=h.indexOf(`
25
+ `;let u,f;for(f=n.length;f>0;--f){let x=n[f-1];if(x!==`
26
+ `&&x!==" "&&x!==" ")break}let h=n.substring(f),w=h.indexOf(`
27
27
  `);w===-1?u="-":n===h||w!==h.length-1?(u="+",s&&s()):u="",h&&(n=n.slice(0,-h.length),h[h.length-1]===`
28
- `&&(h=h.slice(0,-1)),h=h.replace(Nr,`$&${l}`));let p=!1,m,g=-1;for(m=0;m<n.length;++m){let x=n[m];if(x===" ")p=!0;else if(x===`
29
- `)g=m;else break}let y=n.substring(0,g<m?g+1:m);y&&(n=n.substring(y.length),y=y.replace(/\n+/g,`$&${l}`));let C=(p?l?"2":"1":"")+u;if(t&&(C+=" "+a(t.replace(/ ?[\r\n]+/g," ")),r&&r()),!f){let x=n.replace(/\n+/g,`
30
- $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${l}`),P=!1,j=Un(i,!0);o!=="folded"&&e!==ae.Scalar.BLOCK_FOLDED&&(j.onOverflow=()=>{P=!0});let b=_e.foldFlowLines(`${y}${x}${h}`,l,_e.FOLD_BLOCK,j);if(!P)return`>${C}
28
+ `&&(h=h.slice(0,-1)),h=h.replace(Ar,`$&${l}`));let m=!1,p,g=-1;for(p=0;p<n.length;++p){let x=n[p];if(x===" ")m=!0;else if(x===`
29
+ `)g=p;else break}let y=n.substring(0,g<p?g+1:p);y&&(n=n.substring(y.length),y=y.replace(/\n+/g,`$&${l}`));let C=(m?l?"2":"1":"")+u;if(t&&(C+=" "+a(t.replace(/ ?[\r\n]+/g," ")),r&&r()),!d){let x=n.replace(/\n+/g,`
30
+ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${l}`),P=!1,j=Un(i,!0);o!=="folded"&&e!==ce.Scalar.BLOCK_FOLDED&&(j.onOverflow=()=>{P=!0});let b=_e.foldFlowLines(`${y}${x}${h}`,l,_e.FOLD_BLOCK,j);if(!P)return`>${C}
31
31
  ${l}${b}`}return n=n.replace(/\n+/g,`$&${l}`),`|${C}
32
- ${l}${y}${n}${h}`}function Zf(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 mt(s,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(s))return a||f||!s.includes(`
34
- `)?mt(s,e):Yn(t,e,n,i);if(!a&&!f&&r!==ae.Scalar.PLAIN&&s.includes(`
35
- `))return Yn(t,e,n,i);if(Vn(s)){if(c==="")return e.forceBlockIndent=!0,Yn(t,e,n,i);if(a&&c===l)return mt(s,e)}let u=s.replace(/\n+/g,`$&
36
- ${c}`);if(o){let d=p=>p.default&&p.tag!=="tag:yaml.org,2002:str"&&p.test?.test(u),{compat:h,tags:w}=e.doc.schema;if(w.some(d)||h?.some(d))return mt(s,e)}return a?u:_e.foldFlowLines(u,c,_e.FOLD_FLOW,Un(e,!1))}function ed(t,e,n,i){let{implicitKey:r,inFlow:s}=e,o=typeof t.value=="string"?t:Object.assign({},t,{value:String(t.value)}),{type:a}=t;a!==ae.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(a=ae.Scalar.QUOTE_DOUBLE);let c=f=>{switch(f){case ae.Scalar.BLOCK_FOLDED:case ae.Scalar.BLOCK_LITERAL:return r||s?mt(o.value,e):Yn(o,e,n,i);case ae.Scalar.QUOTE_DOUBLE:return Dt(o.value,e);case ae.Scalar.QUOTE_SINGLE:return Rr(o.value,e);case ae.Scalar.PLAIN:return Zf(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}la.stringifyString=ed});var Mt=v(Or=>{"use strict";var td=Ln(),Pe=N(),nd=qt(),id=Ft();function rd(t,e){let n=Object.assign({blockQuote:!0,commentString:nd.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 sd(t,e){if(e.tag){let r=t.filter(s=>s.tag===e.tag);if(r.length>0)return r.find(s=>s.format===e.format)??r[0]}let n,i;if(Pe.isScalar(e)){i=e.value;let r=t.filter(s=>s.identify?.(i));if(r.length>1){let s=r.filter(o=>o.test);s.length>0&&(r=s)}n=r.find(s=>s.format===e.format)??r.find(s=>!s.format)}else i=e,n=t.find(r=>r.nodeClass&&i instanceof r.nodeClass);if(!n){let r=i?.constructor?.name??(i===null?"null":typeof i);throw new Error(`Tag not resolved for ${r} value`)}return n}function od(t,e,{anchors:n,doc:i}){if(!i.directives)return"";let r=[],s=(Pe.isScalar(t)||Pe.isCollection(t))&&t.anchor;s&&td.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 ad(t,e,n,i){if(Pe.isPair(t))return t.toString(e,n,i);if(Pe.isAlias(t)){if(e.doc.directives)return t.toString(e);if(e.resolvedAliases?.has(t))throw new TypeError("Cannot stringify circular structure without alias nodes");e.resolvedAliases?e.resolvedAliases.add(t):e.resolvedAliases=new Set([t]),t=t.resolve(e.doc)}let r,s=Pe.isNode(t)?t:e.doc.createNode(t,{onTagObj:c=>r=c});r??(r=sd(e.doc.schema.tags,s));let o=od(s,r,e);o.length>0&&(e.indentAtStart=(e.indentAtStart??0)+o.length+1);let a=typeof r.stringify=="function"?r.stringify(s,e,n,i):Pe.isScalar(s)?id.stringifyString(s,e,n,i):s.toString(e,n,i);return o?Pe.isScalar(s)||a[0]==="{"||a[0]==="["?`${o} ${a}`:`${o}
37
- ${e.indent}${a}`:a}Or.createStringifyContext=rd;Or.stringify=ad});var pa=v(da=>{"use strict";var we=N(),ua=q(),fa=Mt(),Wt=qt();function cd({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=we.isNode(t)&&t.comment||null;if(u){if(d)throw new Error("With simple keys, key nodes cannot have comments");if(we.isCollection(t)||!we.isNode(t)&&typeof t=="object"){let j="With simple keys, collection cannot be used as a key value";throw new Error(j)}}let h=!u&&(!t||d&&e==null&&!n.inFlow||we.isCollection(t)||(we.isScalar(t)?t.type===ua.Scalar.BLOCK_FOLDED||t.type===ua.Scalar.BLOCK_LITERAL:typeof t=="object"));n=Object.assign({},n,{allNullValues:!1,implicitKey:!h&&(u||!s),indent:a+c});let w=!1,p=!1,m=fa.stringify(t,n,()=>w=!0,()=>p=!0);if(!h&&!n.inFlow&&m.length>1024){if(u)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");h=!0}if(n.inFlow){if(s||e==null)return w&&i&&i(),m===""?"?":h?`? ${m}`:m}else if(s&&!u||e==null&&h)return m=`? ${m}`,d&&!w?m+=Wt.lineComment(m,n.indent,l(d)):p&&r&&r(),m;w&&(d=null),h?(d&&(m+=Wt.lineComment(m,n.indent,l(d))),m=`? ${m}
38
- ${a}:`):(m=`${m}:`,d&&(m+=Wt.lineComment(m,n.indent,l(d))));let g,y,k;we.isNode(e)?(g=!!e.spaceBefore,y=e.commentBefore,k=e.comment):(g=!1,y=null,k=null,e&&typeof e=="object"&&(e=o.createNode(e))),n.implicitKey=!1,!h&&!d&&we.isScalar(e)&&(n.indentAtStart=m.length+1),p=!1,!f&&c.length>=2&&!n.inFlow&&!h&&we.isSeq(e)&&!e.flow&&!e.tag&&!e.anchor&&(n.indent=n.indent.substring(2));let C=!1,x=fa.stringify(e,n,()=>C=!0,()=>p=!0),P=" ";if(d||g||y){if(P=g?`
32
+ ${l}${y}${n}${h}`}function td(t,e,n,i){let{type:r,value:s}=t,{actualString:o,implicitKey:a,indent:c,indentStep:l,inFlow:d}=e;if(a&&s.includes(`
33
+ `)||d&&/[[\]{},]/.test(s))return pt(s,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(s))return a||d||!s.includes(`
34
+ `)?pt(s,e):Yn(t,e,n,i);if(!a&&!d&&r!==ce.Scalar.PLAIN&&s.includes(`
35
+ `))return Yn(t,e,n,i);if(Vn(s)){if(c==="")return e.forceBlockIndent=!0,Yn(t,e,n,i);if(a&&c===l)return pt(s,e)}let u=s.replace(/\n+/g,`$&
36
+ ${c}`);if(o){let f=m=>m.default&&m.tag!=="tag:yaml.org,2002:str"&&m.test?.test(u),{compat:h,tags:w}=e.doc.schema;if(w.some(f)||h?.some(f))return pt(s,e)}return a?u:_e.foldFlowLines(u,c,_e.FOLD_FLOW,Un(e,!1))}function nd(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!==ce.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(a=ce.Scalar.QUOTE_DOUBLE);let c=d=>{switch(d){case ce.Scalar.BLOCK_FOLDED:case ce.Scalar.BLOCK_LITERAL:return r||s?pt(o.value,e):Yn(o,e,n,i);case ce.Scalar.QUOTE_DOUBLE:return Dt(o.value,e);case ce.Scalar.QUOTE_SINGLE:return Nr(o.value,e);case ce.Scalar.PLAIN:return td(o,e,n,i);default:return null}},l=c(a);if(l===null){let{defaultKeyType:d,defaultStringType:u}=e.options,f=r&&d||u;if(l=c(f),l===null)throw new Error(`Unsupported default string type ${f}`)}return l}la.stringifyString=nd});var Mt=v(Or=>{"use strict";var id=Ln(),Pe=N(),rd=qt(),sd=Ft();function od(t,e){let n=Object.assign({blockQuote:!0,commentString:rd.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 ad(t,e){if(e.tag){let r=t.filter(s=>s.tag===e.tag);if(r.length>0)return r.find(s=>s.format===e.format)??r[0]}let n,i;if(Pe.isScalar(e)){i=e.value;let r=t.filter(s=>s.identify?.(i));if(r.length>1){let s=r.filter(o=>o.test);s.length>0&&(r=s)}n=r.find(s=>s.format===e.format)??r.find(s=>!s.format)}else i=e,n=t.find(r=>r.nodeClass&&i instanceof r.nodeClass);if(!n){let r=i?.constructor?.name??(i===null?"null":typeof i);throw new Error(`Tag not resolved for ${r} value`)}return n}function cd(t,e,{anchors:n,doc:i}){if(!i.directives)return"";let r=[],s=(Pe.isScalar(t)||Pe.isCollection(t))&&t.anchor;s&&id.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 ld(t,e,n,i){if(Pe.isPair(t))return t.toString(e,n,i);if(Pe.isAlias(t)){if(e.doc.directives)return t.toString(e);if(e.resolvedAliases?.has(t))throw new TypeError("Cannot stringify circular structure without alias nodes");e.resolvedAliases?e.resolvedAliases.add(t):e.resolvedAliases=new Set([t]),t=t.resolve(e.doc)}let r,s=Pe.isNode(t)?t:e.doc.createNode(t,{onTagObj:c=>r=c});r??(r=ad(e.doc.schema.tags,s));let o=cd(s,r,e);o.length>0&&(e.indentAtStart=(e.indentAtStart??0)+o.length+1);let a=typeof r.stringify=="function"?r.stringify(s,e,n,i):Pe.isScalar(s)?sd.stringifyString(s,e,n,i):s.toString(e,n,i);return o?Pe.isScalar(s)||a[0]==="{"||a[0]==="["?`${o} ${a}`:`${o}
37
+ ${e.indent}${a}`:a}Or.createStringifyContext=od;Or.stringify=ld});var ma=v(da=>{"use strict";var we=N(),ua=L(),fa=Mt(),Wt=qt();function ud({key:t,value:e},n,i,r){let{allNullValues:s,doc:o,indent:a,indentStep:c,options:{commentString:l,indentSeq:d,simpleKeys:u}}=n,f=we.isNode(t)&&t.comment||null;if(u){if(f)throw new Error("With simple keys, key nodes cannot have comments");if(we.isCollection(t)||!we.isNode(t)&&typeof t=="object"){let j="With simple keys, collection cannot be used as a key value";throw new Error(j)}}let h=!u&&(!t||f&&e==null&&!n.inFlow||we.isCollection(t)||(we.isScalar(t)?t.type===ua.Scalar.BLOCK_FOLDED||t.type===ua.Scalar.BLOCK_LITERAL:typeof t=="object"));n=Object.assign({},n,{allNullValues:!1,implicitKey:!h&&(u||!s),indent:a+c});let w=!1,m=!1,p=fa.stringify(t,n,()=>w=!0,()=>m=!0);if(!h&&!n.inFlow&&p.length>1024){if(u)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");h=!0}if(n.inFlow){if(s||e==null)return w&&i&&i(),p===""?"?":h?`? ${p}`:p}else if(s&&!u||e==null&&h)return p=`? ${p}`,f&&!w?p+=Wt.lineComment(p,n.indent,l(f)):m&&r&&r(),p;w&&(f=null),h?(f&&(p+=Wt.lineComment(p,n.indent,l(f))),p=`? ${p}
38
+ ${a}:`):(p=`${p}:`,f&&(p+=Wt.lineComment(p,n.indent,l(f))));let g,y,k;we.isNode(e)?(g=!!e.spaceBefore,y=e.commentBefore,k=e.comment):(g=!1,y=null,k=null,e&&typeof e=="object"&&(e=o.createNode(e))),n.implicitKey=!1,!h&&!f&&we.isScalar(e)&&(n.indentAtStart=p.length+1),m=!1,!d&&c.length>=2&&!n.inFlow&&!h&&we.isSeq(e)&&!e.flow&&!e.tag&&!e.anchor&&(n.indent=n.indent.substring(2));let C=!1,x=fa.stringify(e,n,()=>C=!0,()=>m=!0),P=" ";if(f||g||y){if(P=g?`
39
39
  `:"",y){let j=l(y);P+=`
40
40
  ${Wt.indentComment(j,n.indent)}`}x===""&&!n.inFlow?P===`
41
41
  `&&k&&(P=`
@@ -44,165 +44,165 @@ ${Wt.indentComment(j,n.indent)}`}x===""&&!n.inFlow?P===`
44
44
  ${n.indent}`}else if(!h&&we.isCollection(e)){let j=x[0],b=x.indexOf(`
45
45
  `),M=b!==-1,Ce=n.inFlow??e.flow??e.items.length===0;if(M||!Ce){let ut=!1;if(M&&(j==="&"||j==="!")){let W=x.indexOf(" ");j==="&"&&W!==-1&&W<b&&x[W+1]==="!"&&(W=x.indexOf(" ",W+1)),(W===-1||b<W)&&(ut=!0)}ut||(P=`
46
46
  ${n.indent}`)}}else(x===""||x[0]===`
47
- `)&&(P="");return m+=P+x,n.inFlow?C&&i&&i():k&&!C?m+=Wt.lineComment(m,n.indent,l(k)):p&&r&&r(),m}da.stringifyPair=cd});var jr=v(Ar=>{"use strict";var ma=jn("process");function ld(t,...e){t==="debug"&&console.log(...e)}function ud(t,e){(t==="debug"||t==="warn")&&(typeof ma.emitWarning=="function"?ma.emitWarning(e):console.warn(e))}Ar.debug=ld;Ar.warn=ud});var Qn=v(zn=>{"use strict";var Gn=N(),ha=q(),Jn="<<",Hn={identify:t=>t===Jn||typeof t=="symbol"&&t.description===Jn,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new ha.Scalar(Symbol(Jn)),{addToJSMap:ga}),stringify:()=>Jn},fd=(t,e)=>(Hn.identify(e)||Gn.isScalar(e)&&(!e.type||e.type===ha.Scalar.PLAIN)&&Hn.identify(e.value))&&t?.doc.schema.tags.some(n=>n.tag===Hn.tag&&n.default);function ga(t,e,n){let i=wa(t,n);if(Gn.isSeq(i))for(let r of i.items)Tr(t,e,r);else if(Array.isArray(i))for(let r of i)Tr(t,e,r);else Tr(t,e,i)}function Tr(t,e,n){let i=wa(t,n);if(!Gn.isMap(i))throw new Error("Merge sources must be maps or map aliases");let r=i.toJSON(null,t,Map);for(let[s,o]of r)e instanceof Map?e.has(s)||e.set(s,o):e instanceof Set?e.add(s):Object.prototype.hasOwnProperty.call(e,s)||Object.defineProperty(e,s,{value:o,writable:!0,enumerable:!0,configurable:!0});return e}function wa(t,e){return t&&Gn.isAlias(e)?e.resolve(t.doc,t):e}zn.addMergeToJSMap=ga;zn.isMergeKey=fd;zn.merge=Hn});var $r=v(ba=>{"use strict";var dd=jr(),ya=Qn(),pd=Mt(),va=N(),Ir=Ee();function md(t,e,{key:n,value:i}){if(va.isNode(n)&&n.addToJSMap)n.addToJSMap(t,e,i);else if(ya.isMergeKey(t,n))ya.addMergeToJSMap(t,e,i);else{let r=Ir.toJS(n,"",t);if(e instanceof Map)e.set(r,Ir.toJS(i,r,t));else if(e instanceof Set)e.add(r);else{let s=hd(n,r,t),o=Ir.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 hd(t,e,n){if(e===null)return"";if(typeof e!="object")return String(e);if(va.isNode(t)&&n?.doc){let i=pd.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)+'..."'),dd.warn(n.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${s}. Set mapAsMap: true to use object keys.`),n.mapKeyWarned=!0}return r}return JSON.stringify(e)}ba.addPairToJSMap=md});var Re=v(qr=>{"use strict";var ka=$t(),gd=pa(),wd=$r(),Xn=N();function yd(t,e,n){let i=ka.createNode(t,void 0,n),r=ka.createNode(e,void 0,n);return new Zn(i,r)}var Zn=class t{constructor(e,n=null){Object.defineProperty(this,Xn.NODE_TYPE,{value:Xn.PAIR}),this.key=e,this.value=n}clone(e){let{key:n,value:i}=this;return Xn.isNode(n)&&(n=n.clone(e)),Xn.isNode(i)&&(i=i.clone(e)),new t(n,i)}toJSON(e,n){let i=n?.mapAsMap?new Map:{};return wd.addPairToJSMap(n,i,this)}toString(e,n,i){return e?.doc?gd.stringifyPair(this,e,n,i):JSON.stringify(this)}};qr.Pair=Zn;qr.createPair=yd});var Lr=v(Ca=>{"use strict";var He=N(),Sa=Mt(),ei=qt();function vd(t,e,n){return(e.inFlow??t.flow?kd:bd)(t,e,n)}function bd({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 w=0;w<e.length;++w){let p=e[w],m=null;if(He.isNode(p))!u&&p.spaceBefore&&d.push(""),ti(n,d,p.commentBefore,u),p.comment&&(m=p.comment);else if(He.isPair(p)){let y=He.isNode(p.key)?p.key:null;y&&(!u&&y.spaceBefore&&d.push(""),ti(n,d,y.commentBefore,u))}u=!1;let g=Sa.stringify(p,f,()=>m=null,()=>u=!0);m&&(g+=ei.lineComment(g,s,l(m))),u&&m&&(u=!1),d.push(i+g)}let h;if(d.length===0)h=r.start+r.end;else{h=d[0];for(let w=1;w<d.length;++w){let p=d[w];h+=p?`
48
- ${c}${p}`:`
47
+ `)&&(P="");return p+=P+x,n.inFlow?C&&i&&i():k&&!C?p+=Wt.lineComment(p,n.indent,l(k)):m&&r&&r(),p}da.stringifyPair=ud});var Tr=v(jr=>{"use strict";var pa=jn("process");function fd(t,...e){t==="debug"&&console.log(...e)}function dd(t,e){(t==="debug"||t==="warn")&&(typeof pa.emitWarning=="function"?pa.emitWarning(e):console.warn(e))}jr.debug=fd;jr.warn=dd});var Qn=v(zn=>{"use strict";var Gn=N(),ha=L(),Jn="<<",Hn={identify:t=>t===Jn||typeof t=="symbol"&&t.description===Jn,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new ha.Scalar(Symbol(Jn)),{addToJSMap:ga}),stringify:()=>Jn},md=(t,e)=>(Hn.identify(e)||Gn.isScalar(e)&&(!e.type||e.type===ha.Scalar.PLAIN)&&Hn.identify(e.value))&&t?.doc.schema.tags.some(n=>n.tag===Hn.tag&&n.default);function ga(t,e,n){let i=wa(t,n);if(Gn.isSeq(i))for(let r of i.items)Ir(t,e,r);else if(Array.isArray(i))for(let r of i)Ir(t,e,r);else Ir(t,e,i)}function Ir(t,e,n){let i=wa(t,n);if(!Gn.isMap(i))throw new Error("Merge sources must be maps or map aliases");let r=i.toJSON(null,t,Map);for(let[s,o]of r)e instanceof Map?e.has(s)||e.set(s,o):e instanceof Set?e.add(s):Object.prototype.hasOwnProperty.call(e,s)||Object.defineProperty(e,s,{value:o,writable:!0,enumerable:!0,configurable:!0});return e}function wa(t,e){return t&&Gn.isAlias(e)?e.resolve(t.doc,t):e}zn.addMergeToJSMap=ga;zn.isMergeKey=md;zn.merge=Hn});var qr=v(ba=>{"use strict";var pd=Tr(),ya=Qn(),hd=Mt(),va=N(),$r=Ee();function gd(t,e,{key:n,value:i}){if(va.isNode(n)&&n.addToJSMap)n.addToJSMap(t,e,i);else if(ya.isMergeKey(t,n))ya.addMergeToJSMap(t,e,i);else{let r=$r.toJS(n,"",t);if(e instanceof Map)e.set(r,$r.toJS(i,r,t));else if(e instanceof Set)e.add(r);else{let s=wd(n,r,t),o=$r.toJS(i,s,t);s in e?Object.defineProperty(e,s,{value:o,writable:!0,enumerable:!0,configurable:!0}):e[s]=o}}return e}function wd(t,e,n){if(e===null)return"";if(typeof e!="object")return String(e);if(va.isNode(t)&&n?.doc){let i=hd.createStringifyContext(n.doc,{});i.anchors=new Set;for(let s of n.anchors.keys())i.anchors.add(s.anchor);i.inFlow=!0,i.inStringifyKey=!0;let r=t.toString(i);if(!n.mapKeyWarned){let s=JSON.stringify(r);s.length>40&&(s=s.substring(0,36)+'..."'),pd.warn(n.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${s}. Set mapAsMap: true to use object keys.`),n.mapKeyWarned=!0}return r}return JSON.stringify(e)}ba.addPairToJSMap=gd});var Re=v(Lr=>{"use strict";var ka=$t(),yd=ma(),vd=qr(),Xn=N();function bd(t,e,n){let i=ka.createNode(t,void 0,n),r=ka.createNode(e,void 0,n);return new Zn(i,r)}var Zn=class t{constructor(e,n=null){Object.defineProperty(this,Xn.NODE_TYPE,{value:Xn.PAIR}),this.key=e,this.value=n}clone(e){let{key:n,value:i}=this;return Xn.isNode(n)&&(n=n.clone(e)),Xn.isNode(i)&&(i=i.clone(e)),new t(n,i)}toJSON(e,n){let i=n?.mapAsMap?new Map:{};return vd.addPairToJSMap(n,i,this)}toString(e,n,i){return e?.doc?yd.stringifyPair(this,e,n,i):JSON.stringify(this)}};Lr.Pair=Zn;Lr.createPair=bd});var Dr=v(Ca=>{"use strict";var ze=N(),Sa=Mt(),ei=qt();function kd(t,e,n){return(e.inFlow??t.flow?Cd:Sd)(t,e,n)}function Sd({comment:t,items:e},n,{blockItemPrefix:i,flowChars:r,itemIndent:s,onChompKeep:o,onComment:a}){let{indent:c,options:{commentString:l}}=n,d=Object.assign({},n,{indent:s,type:null}),u=!1,f=[];for(let w=0;w<e.length;++w){let m=e[w],p=null;if(ze.isNode(m))!u&&m.spaceBefore&&f.push(""),ti(n,f,m.commentBefore,u),m.comment&&(p=m.comment);else if(ze.isPair(m)){let y=ze.isNode(m.key)?m.key:null;y&&(!u&&y.spaceBefore&&f.push(""),ti(n,f,y.commentBefore,u))}u=!1;let g=Sa.stringify(m,d,()=>p=null,()=>u=!0);p&&(g+=ei.lineComment(g,s,l(p))),u&&p&&(u=!1),f.push(i+g)}let h;if(f.length===0)h=r.start+r.end;else{h=f[0];for(let w=1;w<f.length;++w){let m=f[w];h+=m?`
48
+ ${c}${m}`:`
49
49
  `}}return t?(h+=`
50
- `+ei.indentComment(l(t),c),a&&a()):u&&o&&o(),h}function kd({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 w=0;w<t.length;++w){let p=t[w],m=null;if(He.isNode(p))p.spaceBefore&&u.push(""),ti(e,u,p.commentBefore,!1),p.comment&&(m=p.comment);else if(He.isPair(p)){let y=He.isNode(p.key)?p.key:null;y&&(y.spaceBefore&&u.push(""),ti(e,u,y.commentBefore,!1),y.comment&&(l=!0));let k=He.isNode(p.value)?p.value:null;k?(k.comment&&(m=k.comment),k.commentBefore&&(l=!0)):p.value==null&&y?.comment&&(m=y.comment)}m&&(l=!0);let g=Sa.stringify(p,c,()=>m=null);l||(l=u.length>f||g.includes(`
51
- `)),w<t.length-1?g+=",":e.options.trailingComma&&(e.options.lineWidth>0&&(l||(l=u.reduce((y,k)=>y+k.length+2,2)+(g.length+2)>e.options.lineWidth)),l&&(g+=",")),m&&(g+=ei.lineComment(g,i,a(m))),u.push(g),f=u.length}let{start:d,end:h}=n;if(u.length===0)return d+h;if(!l){let w=u.reduce((p,m)=>p+m.length+2,2);l=e.options.lineWidth>0&&w>e.options.lineWidth}if(l){let w=d;for(let p of u)w+=p?`
52
- ${s}${r}${p}`:`
50
+ `+ei.indentComment(l(t),c),a&&a()):u&&o&&o(),h}function Cd({items:t},e,{flowChars:n,itemIndent:i}){let{indent:r,indentStep:s,flowCollectionPadding:o,options:{commentString:a}}=e;i+=s;let c=Object.assign({},e,{indent:i,inFlow:!0,type:null}),l=!1,d=0,u=[];for(let w=0;w<t.length;++w){let m=t[w],p=null;if(ze.isNode(m))m.spaceBefore&&u.push(""),ti(e,u,m.commentBefore,!1),m.comment&&(p=m.comment);else if(ze.isPair(m)){let y=ze.isNode(m.key)?m.key:null;y&&(y.spaceBefore&&u.push(""),ti(e,u,y.commentBefore,!1),y.comment&&(l=!0));let k=ze.isNode(m.value)?m.value:null;k?(k.comment&&(p=k.comment),k.commentBefore&&(l=!0)):m.value==null&&y?.comment&&(p=y.comment)}p&&(l=!0);let g=Sa.stringify(m,c,()=>p=null);l||(l=u.length>d||g.includes(`
51
+ `)),w<t.length-1?g+=",":e.options.trailingComma&&(e.options.lineWidth>0&&(l||(l=u.reduce((y,k)=>y+k.length+2,2)+(g.length+2)>e.options.lineWidth)),l&&(g+=",")),p&&(g+=ei.lineComment(g,i,a(p))),u.push(g),d=u.length}let{start:f,end:h}=n;if(u.length===0)return f+h;if(!l){let w=u.reduce((m,p)=>m+p.length+2,2);l=e.options.lineWidth>0&&w>e.options.lineWidth}if(l){let w=f;for(let m of u)w+=m?`
52
+ ${s}${r}${m}`:`
53
53
  `;return`${w}
54
- ${r}${h}`}else return`${d}${o}${u.join(" ")}${o}${h}`}function ti({indent:t,options:{commentString:e}},n,i,r){if(i&&r&&(i=i.replace(/^\n+/,"")),i){let s=ei.indentComment(e(i),t);n.push(s.trimStart())}}Ca.stringifyCollection=vd});var Oe=v(Fr=>{"use strict";var Sd=Lr(),Cd=$r(),Ed=Wn(),Ne=N(),ni=Re(),xd=q();function Bt(t,e){let n=Ne.isScalar(e)?e.value:e;for(let i of t)if(Ne.isPair(i)&&(i.key===e||i.key===n||Ne.isScalar(i.key)&&i.key.value===n))return i}var Dr=class extends Ed.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(Ne.MAP,e),this.items=[]}static from(e,n,i){let{keepUndefined:r,replacer:s}=i,o=new this(e),a=(c,l)=>{if(typeof s=="function")l=s.call(n,c,l);else if(Array.isArray(s)&&!s.includes(c))return;(l!==void 0||r)&&o.items.push(ni.createPair(c,l,i))};if(n instanceof Map)for(let[c,l]of n)a(c,l);else if(n&&typeof n=="object")for(let c of Object.keys(n))a(c,n[c]);return typeof e.sortMapEntries=="function"&&o.items.sort(e.sortMapEntries),o}add(e,n){let i;Ne.isPair(e)?i=e:!e||typeof e!="object"||!("key"in e)?i=new ni.Pair(e,e?.value):i=new ni.Pair(e.key,e.value);let r=Bt(this.items,i.key),s=this.schema?.sortMapEntries;if(r){if(!n)throw new Error(`Key ${i.key} already set`);Ne.isScalar(r.value)&&xd.isScalarValue(i.value)?r.value.value=i.value:r.value=i.value}else if(s){let o=this.items.findIndex(a=>s(i,a)<0);o===-1?this.items.push(i):this.items.splice(o,0,i)}else this.items.push(i)}delete(e){let n=Bt(this.items,e);return n?this.items.splice(this.items.indexOf(n),1).length>0:!1}get(e,n){let r=Bt(this.items,e)?.value;return(!n&&Ne.isScalar(r)?r.value:r)??void 0}has(e){return!!Bt(this.items,e)}set(e,n){this.add(new ni.Pair(e,n),!0)}toJSON(e,n,i){let r=i?new i:n?.mapAsMap?new Map:{};n?.onCreate&&n.onCreate(r);for(let s of this.items)Cd.addPairToJSMap(n,r,s);return r}toString(e,n,i){if(!e)return JSON.stringify(this);for(let r of this.items)if(!Ne.isPair(r))throw new Error(`Map items must all be pairs; found ${JSON.stringify(r)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),Sd.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:i,onComment:n})}};Fr.YAMLMap=Dr;Fr.findPair=Bt});var ht=v(xa=>{"use strict";var _d=N(),Ea=Oe(),Pd={collection:"map",default:!0,nodeClass:Ea.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(t,e){return _d.isMap(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,n)=>Ea.YAMLMap.from(t,e,n)};xa.map=Pd});var Ae=v(_a=>{"use strict";var Rd=$t(),Nd=Lr(),Od=Wn(),ri=N(),Ad=q(),jd=Ee(),Mr=class extends Od.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(ri.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let n=ii(e);return typeof n!="number"?!1:this.items.splice(n,1).length>0}get(e,n){let i=ii(e);if(typeof i!="number")return;let r=this.items[i];return!n&&ri.isScalar(r)?r.value:r}has(e){let n=ii(e);return typeof n=="number"&&n<this.items.length}set(e,n){let i=ii(e);if(typeof i!="number")throw new Error(`Expected a valid index, not ${e}.`);let r=this.items[i];ri.isScalar(r)&&Ad.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(jd.toJS(s,String(r++),n));return i}toString(e,n,i){return e?Nd.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(Rd.createNode(a,void 0,i))}}return s}};function ii(t){let e=ri.isScalar(t)?t.value:t;return e&&typeof e=="string"&&(e=Number(e)),typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}_a.YAMLSeq=Mr});var gt=v(Ra=>{"use strict";var Td=N(),Pa=Ae(),Id={collection:"seq",default:!0,nodeClass:Pa.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(t,e){return Td.isSeq(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,n)=>Pa.YAMLSeq.from(t,e,n)};Ra.seq=Id});var Kt=v(Na=>{"use strict";var $d=Ft(),qd={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),$d.stringifyString(t,e,n,i)}};Na.string=qd});var si=v(ja=>{"use strict";var Oa=q(),Aa={identify:t=>t==null,createNode:()=>new Oa.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new Oa.Scalar(null),stringify:({source:t},e)=>typeof t=="string"&&Aa.test.test(t)?t:e.options.nullStr};ja.nullTag=Aa});var Wr=v(Ia=>{"use strict";var Ld=q(),Ta={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new Ld.Scalar(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},n){if(t&&Ta.test.test(t)){let i=t[0]==="t"||t[0]==="T";if(e===i)return t}return e?n.options.trueStr:n.options.falseStr}};Ia.boolTag=Ta});var wt=v($a=>{"use strict";function Dd({format:t,minFractionDigits:e,tag:n,value:i}){if(typeof i=="bigint")return String(i);let r=typeof i=="number"?i:Number(i);if(!isFinite(r))return isNaN(r)?".nan":r<0?"-.inf":".inf";let s=Object.is(i,-0)?"-0":JSON.stringify(i);if(!t&&e&&(!n||n==="tag:yaml.org,2002:float")&&/^-?\d/.test(s)&&!s.includes("e")){let o=s.indexOf(".");o<0&&(o=s.length,s+=".");let a=e-(s.length-o-1);for(;a-- >0;)s+="0"}return s}$a.stringifyNumber=Dd});var Kr=v(oi=>{"use strict";var Fd=q(),Br=wt(),Md={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:Br.stringifyNumber},Wd={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():Br.stringifyNumber(t)}},Bd={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 Fd.Scalar(parseFloat(t)),n=t.indexOf(".");return n!==-1&&t[t.length-1]==="0"&&(e.minFractionDigits=t.length-n-1),e},stringify:Br.stringifyNumber};oi.float=Bd;oi.floatExp=Wd;oi.floatNaN=Md});var Ur=v(ci=>{"use strict";var qa=wt(),ai=t=>typeof t=="bigint"||Number.isInteger(t),Yr=(t,e,n,{intAsBigInt:i})=>i?BigInt(t):parseInt(t.substring(e),n);function La(t,e,n){let{value:i}=t;return ai(i)&&i>=0?n+i.toString(e):qa.stringifyNumber(t)}var Kd={identify:t=>ai(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(t,e,n)=>Yr(t,2,8,n),stringify:t=>La(t,8,"0o")},Yd={identify:ai,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,n)=>Yr(t,0,10,n),stringify:qa.stringifyNumber},Ud={identify:t=>ai(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(t,e,n)=>Yr(t,2,16,n),stringify:t=>La(t,16,"0x")};ci.int=Yd;ci.intHex=Ud;ci.intOct=Kd});var Fa=v(Da=>{"use strict";var Vd=ht(),Jd=si(),Hd=gt(),Gd=Kt(),zd=Wr(),Vr=Kr(),Jr=Ur(),Qd=[Vd.map,Hd.seq,Gd.string,Jd.nullTag,zd.boolTag,Jr.intOct,Jr.int,Jr.intHex,Vr.floatNaN,Vr.floatExp,Vr.float];Da.schema=Qd});var Ba=v(Wa=>{"use strict";var Xd=q(),Zd=ht(),ep=gt();function Ma(t){return typeof t=="bigint"||Number.isInteger(t)}var li=({value:t})=>JSON.stringify(t),tp=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:li},{identify:t=>t==null,createNode:()=>new Xd.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:li},{identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:t=>t==="true",stringify:li},{identify:Ma,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(t,e,{intAsBigInt:n})=>n?BigInt(t):parseInt(t,10),stringify:({value:t})=>Ma(t)?t.toString():JSON.stringify(t)},{identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:t=>parseFloat(t),stringify:li}],np={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},ip=[Zd.map,ep.seq].concat(tp,np);Wa.schema=ip});var Gr=v(Ka=>{"use strict";var Yt=jn("buffer"),Hr=q(),rp=Ft(),sp={identify:t=>t instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(t,e){if(typeof Yt.Buffer=="function")return Yt.Buffer.from(t,"base64");if(typeof atob=="function"){let n=atob(t.replace(/[\n\r]/g,"")),i=new Uint8Array(n.length);for(let r=0;r<n.length;++r)i[r]=n.charCodeAt(r);return i}else return e("This environment does not support reading binary tags; either Buffer or atob is required"),t},stringify({comment:t,type:e,value:n},i,r,s){if(!n)return"";let o=n,a;if(typeof Yt.Buffer=="function")a=o instanceof Yt.Buffer?o.toString("base64"):Yt.Buffer.from(o.buffer).toString("base64");else if(typeof btoa=="function"){let c="";for(let l=0;l<o.length;++l)c+=String.fromCharCode(o[l]);a=btoa(c)}else throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(e??(e=Hr.Scalar.BLOCK_LITERAL),e!==Hr.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===Hr.Scalar.BLOCK_LITERAL?`
55
- `:" ")}return rp.stringifyString({comment:t,type:e,value:a},i,r,s)}};Ka.binary=sp});var di=v(fi=>{"use strict";var ui=N(),zr=Re(),op=q(),ap=Ae();function Ya(t,e){if(ui.isSeq(t))for(let n=0;n<t.items.length;++n){let i=t.items[n];if(!ui.isPair(i)){if(ui.isMap(i)){i.items.length>1&&e("Each pair must have its own sequence indicator");let r=i.items[0]||new zr.Pair(new op.Scalar(null));if(i.commentBefore&&(r.key.commentBefore=r.key.commentBefore?`${i.commentBefore}
54
+ ${r}${h}`}else return`${f}${o}${u.join(" ")}${o}${h}`}function ti({indent:t,options:{commentString:e}},n,i,r){if(i&&r&&(i=i.replace(/^\n+/,"")),i){let s=ei.indentComment(e(i),t);n.push(s.trimStart())}}Ca.stringifyCollection=kd});var Ae=v(Mr=>{"use strict";var Ed=Dr(),xd=qr(),_d=Wn(),Ne=N(),ni=Re(),Pd=L();function Bt(t,e){let n=Ne.isScalar(e)?e.value:e;for(let i of t)if(Ne.isPair(i)&&(i.key===e||i.key===n||Ne.isScalar(i.key)&&i.key.value===n))return i}var Fr=class extends _d.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(Ne.MAP,e),this.items=[]}static from(e,n,i){let{keepUndefined:r,replacer:s}=i,o=new this(e),a=(c,l)=>{if(typeof s=="function")l=s.call(n,c,l);else if(Array.isArray(s)&&!s.includes(c))return;(l!==void 0||r)&&o.items.push(ni.createPair(c,l,i))};if(n instanceof Map)for(let[c,l]of n)a(c,l);else if(n&&typeof n=="object")for(let c of Object.keys(n))a(c,n[c]);return typeof e.sortMapEntries=="function"&&o.items.sort(e.sortMapEntries),o}add(e,n){let i;Ne.isPair(e)?i=e:!e||typeof e!="object"||!("key"in e)?i=new ni.Pair(e,e?.value):i=new ni.Pair(e.key,e.value);let r=Bt(this.items,i.key),s=this.schema?.sortMapEntries;if(r){if(!n)throw new Error(`Key ${i.key} already set`);Ne.isScalar(r.value)&&Pd.isScalarValue(i.value)?r.value.value=i.value:r.value=i.value}else if(s){let o=this.items.findIndex(a=>s(i,a)<0);o===-1?this.items.push(i):this.items.splice(o,0,i)}else this.items.push(i)}delete(e){let n=Bt(this.items,e);return n?this.items.splice(this.items.indexOf(n),1).length>0:!1}get(e,n){let r=Bt(this.items,e)?.value;return(!n&&Ne.isScalar(r)?r.value:r)??void 0}has(e){return!!Bt(this.items,e)}set(e,n){this.add(new ni.Pair(e,n),!0)}toJSON(e,n,i){let r=i?new i:n?.mapAsMap?new Map:{};n?.onCreate&&n.onCreate(r);for(let s of this.items)xd.addPairToJSMap(n,r,s);return r}toString(e,n,i){if(!e)return JSON.stringify(this);for(let r of this.items)if(!Ne.isPair(r))throw new Error(`Map items must all be pairs; found ${JSON.stringify(r)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),Ed.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:i,onComment:n})}};Mr.YAMLMap=Fr;Mr.findPair=Bt});var ht=v(xa=>{"use strict";var Rd=N(),Ea=Ae(),Nd={collection:"map",default:!0,nodeClass:Ea.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(t,e){return Rd.isMap(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,n)=>Ea.YAMLMap.from(t,e,n)};xa.map=Nd});var Oe=v(_a=>{"use strict";var Ad=$t(),Od=Dr(),jd=Wn(),ri=N(),Td=L(),Id=Ee(),Wr=class extends jd.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(ri.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let n=ii(e);return typeof n!="number"?!1:this.items.splice(n,1).length>0}get(e,n){let i=ii(e);if(typeof i!="number")return;let r=this.items[i];return!n&&ri.isScalar(r)?r.value:r}has(e){let n=ii(e);return typeof n=="number"&&n<this.items.length}set(e,n){let i=ii(e);if(typeof i!="number")throw new Error(`Expected a valid index, not ${e}.`);let r=this.items[i];ri.isScalar(r)&&Td.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(Id.toJS(s,String(r++),n));return i}toString(e,n,i){return e?Od.stringifyCollection(this,e,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(e.indent||"")+" ",onChompKeep:i,onComment:n}):JSON.stringify(this)}static from(e,n,i){let{replacer:r}=i,s=new this(e);if(n&&Symbol.iterator in Object(n)){let o=0;for(let a of n){if(typeof r=="function"){let c=n instanceof Set?a:String(o++);a=r.call(n,c,a)}s.items.push(Ad.createNode(a,void 0,i))}}return s}};function ii(t){let e=ri.isScalar(t)?t.value:t;return e&&typeof e=="string"&&(e=Number(e)),typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}_a.YAMLSeq=Wr});var gt=v(Ra=>{"use strict";var $d=N(),Pa=Oe(),qd={collection:"seq",default:!0,nodeClass:Pa.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(t,e){return $d.isSeq(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,n)=>Pa.YAMLSeq.from(t,e,n)};Ra.seq=qd});var Kt=v(Na=>{"use strict";var Ld=Ft(),Dd={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),Ld.stringifyString(t,e,n,i)}};Na.string=Dd});var si=v(ja=>{"use strict";var Aa=L(),Oa={identify:t=>t==null,createNode:()=>new Aa.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new Aa.Scalar(null),stringify:({source:t},e)=>typeof t=="string"&&Oa.test.test(t)?t:e.options.nullStr};ja.nullTag=Oa});var Br=v(Ia=>{"use strict";var Fd=L(),Ta={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new Fd.Scalar(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},n){if(t&&Ta.test.test(t)){let i=t[0]==="t"||t[0]==="T";if(e===i)return t}return e?n.options.trueStr:n.options.falseStr}};Ia.boolTag=Ta});var wt=v($a=>{"use strict";function Md({format:t,minFractionDigits:e,tag:n,value:i}){if(typeof i=="bigint")return String(i);let r=typeof i=="number"?i:Number(i);if(!isFinite(r))return isNaN(r)?".nan":r<0?"-.inf":".inf";let s=Object.is(i,-0)?"-0":JSON.stringify(i);if(!t&&e&&(!n||n==="tag:yaml.org,2002:float")&&/^-?\d/.test(s)&&!s.includes("e")){let o=s.indexOf(".");o<0&&(o=s.length,s+=".");let a=e-(s.length-o-1);for(;a-- >0;)s+="0"}return s}$a.stringifyNumber=Md});var Yr=v(oi=>{"use strict";var Wd=L(),Kr=wt(),Bd={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:t=>t.slice(-3).toLowerCase()==="nan"?NaN:t[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:Kr.stringifyNumber},Kd={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:t=>parseFloat(t),stringify(t){let e=Number(t.value);return isFinite(e)?e.toExponential():Kr.stringifyNumber(t)}},Yd={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 Wd.Scalar(parseFloat(t)),n=t.indexOf(".");return n!==-1&&t[t.length-1]==="0"&&(e.minFractionDigits=t.length-n-1),e},stringify:Kr.stringifyNumber};oi.float=Yd;oi.floatExp=Kd;oi.floatNaN=Bd});var Vr=v(ci=>{"use strict";var qa=wt(),ai=t=>typeof t=="bigint"||Number.isInteger(t),Ur=(t,e,n,{intAsBigInt:i})=>i?BigInt(t):parseInt(t.substring(e),n);function La(t,e,n){let{value:i}=t;return ai(i)&&i>=0?n+i.toString(e):qa.stringifyNumber(t)}var Ud={identify:t=>ai(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(t,e,n)=>Ur(t,2,8,n),stringify:t=>La(t,8,"0o")},Vd={identify:ai,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,n)=>Ur(t,0,10,n),stringify:qa.stringifyNumber},Jd={identify:t=>ai(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(t,e,n)=>Ur(t,2,16,n),stringify:t=>La(t,16,"0x")};ci.int=Vd;ci.intHex=Jd;ci.intOct=Ud});var Fa=v(Da=>{"use strict";var Hd=ht(),Gd=si(),zd=gt(),Qd=Kt(),Xd=Br(),Jr=Yr(),Hr=Vr(),Zd=[Hd.map,zd.seq,Qd.string,Gd.nullTag,Xd.boolTag,Hr.intOct,Hr.int,Hr.intHex,Jr.floatNaN,Jr.floatExp,Jr.float];Da.schema=Zd});var Ba=v(Wa=>{"use strict";var em=L(),tm=ht(),nm=gt();function Ma(t){return typeof t=="bigint"||Number.isInteger(t)}var li=({value:t})=>JSON.stringify(t),im=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:li},{identify:t=>t==null,createNode:()=>new em.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:li},{identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:t=>t==="true",stringify:li},{identify:Ma,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(t,e,{intAsBigInt:n})=>n?BigInt(t):parseInt(t,10),stringify:({value:t})=>Ma(t)?t.toString():JSON.stringify(t)},{identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:t=>parseFloat(t),stringify:li}],rm={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},sm=[tm.map,nm.seq].concat(im,rm);Wa.schema=sm});var zr=v(Ka=>{"use strict";var Yt=jn("buffer"),Gr=L(),om=Ft(),am={identify:t=>t instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(t,e){if(typeof Yt.Buffer=="function")return Yt.Buffer.from(t,"base64");if(typeof atob=="function"){let n=atob(t.replace(/[\n\r]/g,"")),i=new Uint8Array(n.length);for(let r=0;r<n.length;++r)i[r]=n.charCodeAt(r);return i}else return e("This environment does not support reading binary tags; either Buffer or atob is required"),t},stringify({comment:t,type:e,value:n},i,r,s){if(!n)return"";let o=n,a;if(typeof Yt.Buffer=="function")a=o instanceof Yt.Buffer?o.toString("base64"):Yt.Buffer.from(o.buffer).toString("base64");else if(typeof btoa=="function"){let c="";for(let l=0;l<o.length;++l)c+=String.fromCharCode(o[l]);a=btoa(c)}else throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(e??(e=Gr.Scalar.BLOCK_LITERAL),e!==Gr.Scalar.QUOTE_DOUBLE){let c=Math.max(i.options.lineWidth-i.indent.length,i.options.minContentWidth),l=Math.ceil(a.length/c),d=new Array(l);for(let u=0,f=0;u<l;++u,f+=c)d[u]=a.substr(f,c);a=d.join(e===Gr.Scalar.BLOCK_LITERAL?`
55
+ `:" ")}return om.stringifyString({comment:t,type:e,value:a},i,r,s)}};Ka.binary=am});var di=v(fi=>{"use strict";var ui=N(),Qr=Re(),cm=L(),lm=Oe();function Ya(t,e){if(ui.isSeq(t))for(let n=0;n<t.items.length;++n){let i=t.items[n];if(!ui.isPair(i)){if(ui.isMap(i)){i.items.length>1&&e("Each pair must have its own sequence indicator");let r=i.items[0]||new Qr.Pair(new cm.Scalar(null));if(i.commentBefore&&(r.key.commentBefore=r.key.commentBefore?`${i.commentBefore}
56
56
  ${r.key.commentBefore}`:i.commentBefore),i.comment){let s=r.value??r.key;s.comment=s.comment?`${i.comment}
57
- ${s.comment}`:i.comment}i=r}t.items[n]=ui.isPair(i)?i:new zr.Pair(i)}}else e("Expected a sequence for this tag");return t}function Ua(t,e,n){let{replacer:i}=n,r=new ap.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(zr.createPair(a,c,n))}return r}var cp={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:Ya,createNode:Ua};fi.createPairs=Ua;fi.pairs=cp;fi.resolvePairs=Ya});var Zr=v(Xr=>{"use strict";var Va=N(),Qr=Ee(),Ut=Oe(),lp=Ae(),Ja=di(),Ge=class t extends lp.YAMLSeq{constructor(){super(),this.add=Ut.YAMLMap.prototype.add.bind(this),this.delete=Ut.YAMLMap.prototype.delete.bind(this),this.get=Ut.YAMLMap.prototype.get.bind(this),this.has=Ut.YAMLMap.prototype.has.bind(this),this.set=Ut.YAMLMap.prototype.set.bind(this),this.tag=t.tag}toJSON(e,n){if(!n)return super.toJSON(e);let i=new Map;n?.onCreate&&n.onCreate(i);for(let r of this.items){let s,o;if(Va.isPair(r)?(s=Qr.toJS(r.key,"",n),o=Qr.toJS(r.value,s,n)):s=Qr.toJS(r,"",n),i.has(s))throw new Error("Ordered maps must not include duplicate keys");i.set(s,o)}return i}static from(e,n,i){let r=Ja.createPairs(e,n,i),s=new this;return s.items=r.items,s}};Ge.tag="tag:yaml.org,2002:omap";var up={collection:"seq",identify:t=>t instanceof Map,nodeClass:Ge,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let n=Ja.resolvePairs(t,e),i=[];for(let{key:r}of n.items)Va.isScalar(r)&&(i.includes(r.value)?e(`Ordered maps must not include duplicate keys: ${r.value}`):i.push(r.value));return Object.assign(new Ge,n)},createNode:(t,e,n)=>Ge.from(t,e,n)};Xr.YAMLOMap=Ge;Xr.omap=up});var Xa=v(es=>{"use strict";var Ha=q();function Ga({value:t,source:e},n){return e&&(t?za:Qa).test.test(e)?e:t?n.options.trueStr:n.options.falseStr}var za={identify:t=>t===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new Ha.Scalar(!0),stringify:Ga},Qa={identify:t=>t===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new Ha.Scalar(!1),stringify:Ga};es.falseTag=Qa;es.trueTag=za});var Za=v(pi=>{"use strict";var fp=q(),ts=wt(),dp={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:ts.stringifyNumber},pp={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():ts.stringifyNumber(t)}},mp={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 fp.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:ts.stringifyNumber};pi.float=mp;pi.floatExp=pp;pi.floatNaN=dp});var tc=v(Jt=>{"use strict";var ec=wt(),Vt=t=>typeof t=="bigint"||Number.isInteger(t);function mi(t,e,n,{intAsBigInt:i}){let r=t[0];if((r==="-"||r==="+")&&(e+=1),t=t.substring(e).replace(/_/g,""),i){switch(n){case 2:t=`0b${t}`;break;case 8:t=`0o${t}`;break;case 16:t=`0x${t}`;break}let o=BigInt(t);return r==="-"?BigInt(-1)*o:o}let s=parseInt(t,n);return r==="-"?-1*s:s}function ns(t,e,n){let{value:i}=t;if(Vt(i)){let r=i.toString(e);return i<0?"-"+n+r.substr(1):n+r}return ec.stringifyNumber(t)}var hp={identify:Vt,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,n)=>mi(t,2,2,n),stringify:t=>ns(t,2,"0b")},gp={identify:Vt,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,n)=>mi(t,1,8,n),stringify:t=>ns(t,8,"0")},wp={identify:Vt,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,n)=>mi(t,0,10,n),stringify:ec.stringifyNumber},yp={identify:Vt,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,n)=>mi(t,2,16,n),stringify:t=>ns(t,16,"0x")};Jt.int=wp;Jt.intBin=hp;Jt.intHex=yp;Jt.intOct=gp});var rs=v(is=>{"use strict";var wi=N(),hi=Re(),gi=Oe(),ze=class t extends gi.YAMLMap{constructor(e){super(e),this.tag=t.tag}add(e){let n;wi.isPair(e)?n=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?n=new hi.Pair(e.key,null):n=new hi.Pair(e,null),gi.findPair(this.items,n.key)||this.items.push(n)}get(e,n){let i=gi.findPair(this.items,e);return!n&&wi.isPair(i)?wi.isScalar(i.key)?i.key.value:i.key:i}set(e,n){if(typeof n!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof n}`);let i=gi.findPair(this.items,e);i&&!n?this.items.splice(this.items.indexOf(i),1):!i&&n&&this.items.push(new hi.Pair(e))}toJSON(e,n){return super.toJSON(e,n,Set)}toString(e,n,i){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),n,i);throw new Error("Set items must all have null values")}static from(e,n,i){let{replacer:r}=i,s=new this(e);if(n&&Symbol.iterator in Object(n))for(let o of n)typeof r=="function"&&(o=r.call(n,o,o)),s.items.push(hi.createPair(o,null,i));return s}};ze.tag="tag:yaml.org,2002:set";var vp={collection:"map",identify:t=>t instanceof Set,nodeClass:ze,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,n)=>ze.from(t,e,n),resolve(t,e){if(wi.isMap(t)){if(t.hasAllNullValues(!0))return Object.assign(new ze,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}};is.YAMLSet=ze;is.set=vp});var os=v(yi=>{"use strict";var bp=wt();function ss(t,e){let n=t[0],i=n==="-"||n==="+"?t.substring(1):t,r=o=>e?BigInt(o):Number(o),s=i.replace(/_/g,"").split(":").reduce((o,a)=>o*r(60)+r(a),r(0));return n==="-"?r(-1)*s:s}function nc(t){let{value:e}=t,n=o=>o;if(typeof e=="bigint")n=o=>BigInt(o);else if(isNaN(e)||!isFinite(e))return bp.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 kp={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})=>ss(t,n),stringify:nc},Sp={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=>ss(t,!1),stringify:nc},ic={identify:t=>t instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(t){let e=t.match(ic.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,n,i,r,s,o,a]=e.map(Number),c=e[7]?Number((e[7]+"00").substr(1,3)):0,l=Date.UTC(n,i-1,r,s||0,o||0,a||0,c),f=e[8];if(f&&f!=="Z"){let u=ss(f,!1);Math.abs(u)<30&&(u*=60),l-=6e4*u}return new Date(l)},stringify:({value:t})=>t?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};yi.floatTime=Sp;yi.intTime=kp;yi.timestamp=ic});var oc=v(sc=>{"use strict";var Cp=ht(),Ep=si(),xp=gt(),_p=Kt(),Pp=Gr(),rc=Xa(),as=Za(),vi=tc(),Rp=Qn(),Np=Zr(),Op=di(),Ap=rs(),cs=os(),jp=[Cp.map,xp.seq,_p.string,Ep.nullTag,rc.trueTag,rc.falseTag,vi.intBin,vi.intOct,vi.int,vi.intHex,as.floatNaN,as.floatExp,as.float,Pp.binary,Rp.merge,Np.omap,Op.pairs,Ap.set,cs.intTime,cs.floatTime,cs.timestamp];sc.schema=jp});var gc=v(fs=>{"use strict";var uc=ht(),Tp=si(),fc=gt(),Ip=Kt(),$p=Wr(),ls=Kr(),us=Ur(),qp=Fa(),Lp=Ba(),dc=Gr(),Ht=Qn(),pc=Zr(),mc=di(),ac=oc(),hc=rs(),bi=os(),cc=new Map([["core",qp.schema],["failsafe",[uc.map,fc.seq,Ip.string]],["json",Lp.schema],["yaml11",ac.schema],["yaml-1.1",ac.schema]]),lc={binary:dc.binary,bool:$p.boolTag,float:ls.float,floatExp:ls.floatExp,floatNaN:ls.floatNaN,floatTime:bi.floatTime,int:us.int,intHex:us.intHex,intOct:us.intOct,intTime:bi.intTime,map:uc.map,merge:Ht.merge,null:Tp.nullTag,omap:pc.omap,pairs:mc.pairs,seq:fc.seq,set:hc.set,timestamp:bi.timestamp},Dp={"tag:yaml.org,2002:binary":dc.binary,"tag:yaml.org,2002:merge":Ht.merge,"tag:yaml.org,2002:omap":pc.omap,"tag:yaml.org,2002:pairs":mc.pairs,"tag:yaml.org,2002:set":hc.set,"tag:yaml.org,2002:timestamp":bi.timestamp};function Fp(t,e,n){let i=cc.get(e);if(i&&!t)return n&&!i.includes(Ht.merge)?i.concat(Ht.merge):i.slice();let r=i;if(!r)if(Array.isArray(t))r=[];else{let s=Array.from(cc.keys()).filter(o=>o!=="yaml11").map(o=>JSON.stringify(o)).join(", ");throw new Error(`Unknown schema "${e}"; use one of ${s} or define customTags array`)}if(Array.isArray(t))for(let s of t)r=r.concat(s);else typeof t=="function"&&(r=t(r.slice()));return n&&(r=r.concat(Ht.merge)),r.reduce((s,o)=>{let a=typeof o=="string"?lc[o]:o;if(!a){let c=JSON.stringify(o),l=Object.keys(lc).map(f=>JSON.stringify(f)).join(", ");throw new Error(`Unknown custom tag ${c}; use one of ${l}`)}return s.includes(a)||s.push(a),s},[])}fs.coreKnownTags=Dp;fs.getTags=Fp});var ms=v(wc=>{"use strict";var ds=N(),Mp=ht(),Wp=gt(),Bp=Kt(),ki=gc(),Kp=(t,e)=>t.key<e.key?-1:t.key>e.key?1:0,ps=class t{constructor({compat:e,customTags:n,merge:i,resolveKnownTags:r,schema:s,sortMapEntries:o,toStringDefaults:a}){this.compat=Array.isArray(e)?ki.getTags(e,"compat"):e?ki.getTags(null,e):null,this.name=typeof s=="string"&&s||"core",this.knownTags=r?ki.coreKnownTags:{},this.tags=ki.getTags(n,this.name,i),this.toStringOptions=a??null,Object.defineProperty(this,ds.MAP,{value:Mp.map}),Object.defineProperty(this,ds.SCALAR,{value:Bp.string}),Object.defineProperty(this,ds.SEQ,{value:Wp.seq}),this.sortMapEntries=typeof o=="function"?o:o===!0?Kp:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};wc.Schema=ps});var vc=v(yc=>{"use strict";var Yp=N(),hs=Mt(),Gt=qt();function Up(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=hs.createStringifyContext(t,e),{commentString:s}=r.options;if(t.commentBefore){n.length!==1&&n.unshift("");let c=s(t.commentBefore);n.unshift(Gt.indentComment(c,""))}let o=!1,a=null;if(t.contents){if(Yp.isNode(t.contents)){if(t.contents.spaceBefore&&i&&n.push(""),t.contents.commentBefore){let f=s(t.contents.commentBefore);n.push(Gt.indentComment(f,""))}r.forceBlockIndent=!!t.comment,a=t.contents.comment}let c=a?void 0:()=>o=!0,l=hs.stringify(t.contents,r,()=>a=null,c);a&&(l+=Gt.lineComment(l,"",s(a))),(l[0]==="|"||l[0]===">")&&n[n.length-1]==="---"?n[n.length-1]=`--- ${l}`:n.push(l)}else n.push(hs.stringify(t.contents,r));if(t.directives?.docEnd)if(t.comment){let c=s(t.comment);c.includes(`
57
+ ${s.comment}`:i.comment}i=r}t.items[n]=ui.isPair(i)?i:new Qr.Pair(i)}}else e("Expected a sequence for this tag");return t}function Ua(t,e,n){let{replacer:i}=n,r=new lm.YAMLSeq(t);r.tag="tag:yaml.org,2002:pairs";let s=0;if(e&&Symbol.iterator in Object(e))for(let o of e){typeof i=="function"&&(o=i.call(e,String(s++),o));let a,c;if(Array.isArray(o))if(o.length===2)a=o[0],c=o[1];else throw new TypeError(`Expected [key, value] tuple: ${o}`);else if(o&&o instanceof Object){let l=Object.keys(o);if(l.length===1)a=l[0],c=o[a];else throw new TypeError(`Expected tuple with one key, not ${l.length} keys`)}else a=o;r.items.push(Qr.createPair(a,c,n))}return r}var um={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:Ya,createNode:Ua};fi.createPairs=Ua;fi.pairs=um;fi.resolvePairs=Ya});var es=v(Zr=>{"use strict";var Va=N(),Xr=Ee(),Ut=Ae(),fm=Oe(),Ja=di(),Qe=class t extends fm.YAMLSeq{constructor(){super(),this.add=Ut.YAMLMap.prototype.add.bind(this),this.delete=Ut.YAMLMap.prototype.delete.bind(this),this.get=Ut.YAMLMap.prototype.get.bind(this),this.has=Ut.YAMLMap.prototype.has.bind(this),this.set=Ut.YAMLMap.prototype.set.bind(this),this.tag=t.tag}toJSON(e,n){if(!n)return super.toJSON(e);let i=new Map;n?.onCreate&&n.onCreate(i);for(let r of this.items){let s,o;if(Va.isPair(r)?(s=Xr.toJS(r.key,"",n),o=Xr.toJS(r.value,s,n)):s=Xr.toJS(r,"",n),i.has(s))throw new Error("Ordered maps must not include duplicate keys");i.set(s,o)}return i}static from(e,n,i){let r=Ja.createPairs(e,n,i),s=new this;return s.items=r.items,s}};Qe.tag="tag:yaml.org,2002:omap";var dm={collection:"seq",identify:t=>t instanceof Map,nodeClass:Qe,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let n=Ja.resolvePairs(t,e),i=[];for(let{key:r}of n.items)Va.isScalar(r)&&(i.includes(r.value)?e(`Ordered maps must not include duplicate keys: ${r.value}`):i.push(r.value));return Object.assign(new Qe,n)},createNode:(t,e,n)=>Qe.from(t,e,n)};Zr.YAMLOMap=Qe;Zr.omap=dm});var Xa=v(ts=>{"use strict";var Ha=L();function Ga({value:t,source:e},n){return e&&(t?za:Qa).test.test(e)?e:t?n.options.trueStr:n.options.falseStr}var za={identify:t=>t===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new Ha.Scalar(!0),stringify:Ga},Qa={identify:t=>t===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new Ha.Scalar(!1),stringify:Ga};ts.falseTag=Qa;ts.trueTag=za});var Za=v(mi=>{"use strict";var mm=L(),ns=wt(),pm={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:t=>t.slice(-3).toLowerCase()==="nan"?NaN:t[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:ns.stringifyNumber},hm={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:t=>parseFloat(t.replace(/_/g,"")),stringify(t){let e=Number(t.value);return isFinite(e)?e.toExponential():ns.stringifyNumber(t)}},gm={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 mm.Scalar(parseFloat(t.replace(/_/g,""))),n=t.indexOf(".");if(n!==-1){let i=t.substring(n+1).replace(/_/g,"");i[i.length-1]==="0"&&(e.minFractionDigits=i.length)}return e},stringify:ns.stringifyNumber};mi.float=gm;mi.floatExp=hm;mi.floatNaN=pm});var tc=v(Jt=>{"use strict";var ec=wt(),Vt=t=>typeof t=="bigint"||Number.isInteger(t);function pi(t,e,n,{intAsBigInt:i}){let r=t[0];if((r==="-"||r==="+")&&(e+=1),t=t.substring(e).replace(/_/g,""),i){switch(n){case 2:t=`0b${t}`;break;case 8:t=`0o${t}`;break;case 16:t=`0x${t}`;break}let o=BigInt(t);return r==="-"?BigInt(-1)*o:o}let s=parseInt(t,n);return r==="-"?-1*s:s}function is(t,e,n){let{value:i}=t;if(Vt(i)){let r=i.toString(e);return i<0?"-"+n+r.substr(1):n+r}return ec.stringifyNumber(t)}var wm={identify:Vt,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,n)=>pi(t,2,2,n),stringify:t=>is(t,2,"0b")},ym={identify:Vt,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,n)=>pi(t,1,8,n),stringify:t=>is(t,8,"0")},vm={identify:Vt,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,n)=>pi(t,0,10,n),stringify:ec.stringifyNumber},bm={identify:Vt,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,n)=>pi(t,2,16,n),stringify:t=>is(t,16,"0x")};Jt.int=vm;Jt.intBin=wm;Jt.intHex=bm;Jt.intOct=ym});var ss=v(rs=>{"use strict";var wi=N(),hi=Re(),gi=Ae(),Xe=class t extends gi.YAMLMap{constructor(e){super(e),this.tag=t.tag}add(e){let n;wi.isPair(e)?n=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?n=new hi.Pair(e.key,null):n=new hi.Pair(e,null),gi.findPair(this.items,n.key)||this.items.push(n)}get(e,n){let i=gi.findPair(this.items,e);return!n&&wi.isPair(i)?wi.isScalar(i.key)?i.key.value:i.key:i}set(e,n){if(typeof n!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof n}`);let i=gi.findPair(this.items,e);i&&!n?this.items.splice(this.items.indexOf(i),1):!i&&n&&this.items.push(new hi.Pair(e))}toJSON(e,n){return super.toJSON(e,n,Set)}toString(e,n,i){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),n,i);throw new Error("Set items must all have null values")}static from(e,n,i){let{replacer:r}=i,s=new this(e);if(n&&Symbol.iterator in Object(n))for(let o of n)typeof r=="function"&&(o=r.call(n,o,o)),s.items.push(hi.createPair(o,null,i));return s}};Xe.tag="tag:yaml.org,2002:set";var km={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(wi.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}};rs.YAMLSet=Xe;rs.set=km});var as=v(yi=>{"use strict";var Sm=wt();function os(t,e){let n=t[0],i=n==="-"||n==="+"?t.substring(1):t,r=o=>e?BigInt(o):Number(o),s=i.replace(/_/g,"").split(":").reduce((o,a)=>o*r(60)+r(a),r(0));return n==="-"?r(-1)*s:s}function nc(t){let{value:e}=t,n=o=>o;if(typeof e=="bigint")n=o=>BigInt(o);else if(isNaN(e)||!isFinite(e))return Sm.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 Cm={identify:t=>typeof t=="bigint"||Number.isInteger(t),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(t,e,{intAsBigInt:n})=>os(t,n),stringify:nc},Em={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:t=>os(t,!1),stringify:nc},ic={identify:t=>t instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(t){let e=t.match(ic.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,n,i,r,s,o,a]=e.map(Number),c=e[7]?Number((e[7]+"00").substr(1,3)):0,l=Date.UTC(n,i-1,r,s||0,o||0,a||0,c),d=e[8];if(d&&d!=="Z"){let u=os(d,!1);Math.abs(u)<30&&(u*=60),l-=6e4*u}return new Date(l)},stringify:({value:t})=>t?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};yi.floatTime=Em;yi.intTime=Cm;yi.timestamp=ic});var oc=v(sc=>{"use strict";var xm=ht(),_m=si(),Pm=gt(),Rm=Kt(),Nm=zr(),rc=Xa(),cs=Za(),vi=tc(),Am=Qn(),Om=es(),jm=di(),Tm=ss(),ls=as(),Im=[xm.map,Pm.seq,Rm.string,_m.nullTag,rc.trueTag,rc.falseTag,vi.intBin,vi.intOct,vi.int,vi.intHex,cs.floatNaN,cs.floatExp,cs.float,Nm.binary,Am.merge,Om.omap,jm.pairs,Tm.set,ls.intTime,ls.floatTime,ls.timestamp];sc.schema=Im});var gc=v(ds=>{"use strict";var uc=ht(),$m=si(),fc=gt(),qm=Kt(),Lm=Br(),us=Yr(),fs=Vr(),Dm=Fa(),Fm=Ba(),dc=zr(),Ht=Qn(),mc=es(),pc=di(),ac=oc(),hc=ss(),bi=as(),cc=new Map([["core",Dm.schema],["failsafe",[uc.map,fc.seq,qm.string]],["json",Fm.schema],["yaml11",ac.schema],["yaml-1.1",ac.schema]]),lc={binary:dc.binary,bool:Lm.boolTag,float:us.float,floatExp:us.floatExp,floatNaN:us.floatNaN,floatTime:bi.floatTime,int:fs.int,intHex:fs.intHex,intOct:fs.intOct,intTime:bi.intTime,map:uc.map,merge:Ht.merge,null:$m.nullTag,omap:mc.omap,pairs:pc.pairs,seq:fc.seq,set:hc.set,timestamp:bi.timestamp},Mm={"tag:yaml.org,2002:binary":dc.binary,"tag:yaml.org,2002:merge":Ht.merge,"tag:yaml.org,2002:omap":mc.omap,"tag:yaml.org,2002:pairs":pc.pairs,"tag:yaml.org,2002:set":hc.set,"tag:yaml.org,2002:timestamp":bi.timestamp};function Wm(t,e,n){let i=cc.get(e);if(i&&!t)return n&&!i.includes(Ht.merge)?i.concat(Ht.merge):i.slice();let r=i;if(!r)if(Array.isArray(t))r=[];else{let s=Array.from(cc.keys()).filter(o=>o!=="yaml11").map(o=>JSON.stringify(o)).join(", ");throw new Error(`Unknown schema "${e}"; use one of ${s} or define customTags array`)}if(Array.isArray(t))for(let s of t)r=r.concat(s);else typeof t=="function"&&(r=t(r.slice()));return n&&(r=r.concat(Ht.merge)),r.reduce((s,o)=>{let a=typeof o=="string"?lc[o]:o;if(!a){let c=JSON.stringify(o),l=Object.keys(lc).map(d=>JSON.stringify(d)).join(", ");throw new Error(`Unknown custom tag ${c}; use one of ${l}`)}return s.includes(a)||s.push(a),s},[])}ds.coreKnownTags=Mm;ds.getTags=Wm});var hs=v(wc=>{"use strict";var ms=N(),Bm=ht(),Km=gt(),Ym=Kt(),ki=gc(),Um=(t,e)=>t.key<e.key?-1:t.key>e.key?1:0,ps=class t{constructor({compat:e,customTags:n,merge:i,resolveKnownTags:r,schema:s,sortMapEntries:o,toStringDefaults:a}){this.compat=Array.isArray(e)?ki.getTags(e,"compat"):e?ki.getTags(null,e):null,this.name=typeof s=="string"&&s||"core",this.knownTags=r?ki.coreKnownTags:{},this.tags=ki.getTags(n,this.name,i),this.toStringOptions=a??null,Object.defineProperty(this,ms.MAP,{value:Bm.map}),Object.defineProperty(this,ms.SCALAR,{value:Ym.string}),Object.defineProperty(this,ms.SEQ,{value:Km.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}};wc.Schema=ps});var vc=v(yc=>{"use strict";var Vm=N(),gs=Mt(),Gt=qt();function Jm(t,e){let n=[],i=e.directives===!0;if(e.directives!==!1&&t.directives){let c=t.directives.toString(t);c?(n.push(c),i=!0):t.directives.docStart&&(i=!0)}i&&n.push("---");let r=gs.createStringifyContext(t,e),{commentString:s}=r.options;if(t.commentBefore){n.length!==1&&n.unshift("");let c=s(t.commentBefore);n.unshift(Gt.indentComment(c,""))}let o=!1,a=null;if(t.contents){if(Vm.isNode(t.contents)){if(t.contents.spaceBefore&&i&&n.push(""),t.contents.commentBefore){let d=s(t.contents.commentBefore);n.push(Gt.indentComment(d,""))}r.forceBlockIndent=!!t.comment,a=t.contents.comment}let c=a?void 0:()=>o=!0,l=gs.stringify(t.contents,r,()=>a=null,c);a&&(l+=Gt.lineComment(l,"",s(a))),(l[0]==="|"||l[0]===">")&&n[n.length-1]==="---"?n[n.length-1]=`--- ${l}`:n.push(l)}else n.push(gs.stringify(t.contents,r));if(t.directives?.docEnd)if(t.comment){let c=s(t.comment);c.includes(`
58
58
  `)?(n.push("..."),n.push(Gt.indentComment(c,""))):n.push(`... ${c}`)}else n.push("...");else{let c=t.comment;c&&o&&(c=c.replace(/^\n+/,"")),c&&((!o||a)&&n[n.length-1]!==""&&n.push(""),n.push(Gt.indentComment(s(c),"")))}return n.join(`
59
59
  `)+`
60
- `}yc.stringifyDocument=Up});var zt=v(bc=>{"use strict";var Vp=It(),yt=Wn(),re=N(),Jp=Re(),Hp=Ee(),Gp=ms(),zp=vc(),gs=Ln(),Qp=br(),Xp=$t(),ws=vr(),ys=class t{constructor(e,n,i){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,re.NODE_TYPE,{value:re.DOC});let r=null;typeof n=="function"||Array.isArray(n)?r=n:i===void 0&&n&&(i=n,n=void 0);let s=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},i);this.options=s;let{version:o}=s;i?._directives?(this.directives=i._directives.atDocument(),this.directives.yaml.explicit&&(o=this.directives.yaml.version)):this.directives=new ws.Directives({version:o}),this.setSchema(o,i),this.contents=e===void 0?null:this.createNode(e,r,i)}clone(){let e=Object.create(t.prototype,{[re.NODE_TYPE]:{value:re.DOC}});return e.commentBefore=this.commentBefore,e.comment=this.comment,e.errors=this.errors.slice(),e.warnings=this.warnings.slice(),e.options=Object.assign({},this.options),this.directives&&(e.directives=this.directives.clone()),e.schema=this.schema.clone(),e.contents=re.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){vt(this.contents)&&this.contents.add(e)}addIn(e,n){vt(this.contents)&&this.contents.addIn(e,n)}createAlias(e,n){if(!e.anchor){let i=gs.anchorNames(this);e.anchor=!n||i.has(n)?gs.findNewAnchor(n||"a",i):n}return new Vp.Alias(e.anchor)}createNode(e,n,i){let r;if(typeof n=="function")e=n.call({"":e},"",e),r=n;else if(Array.isArray(n)){let m=y=>typeof y=="number"||y instanceof String||y instanceof Number,g=n.filter(m).map(String);g.length>0&&(n=n.concat(g)),r=n}else i===void 0&&n&&(i=n,n=void 0);let{aliasDuplicateObjects:s,anchorPrefix:o,flow:a,keepUndefined:c,onTagObj:l,tag:f}=i??{},{onAnchor:u,setAnchors:d,sourceObjects:h}=gs.createNodeAnchors(this,o||"a"),w={aliasDuplicateObjects:s??!0,keepUndefined:c??!1,onAnchor:u,onTagObj:l,replacer:r,schema:this.schema,sourceObjects:h},p=Xp.createNode(e,f,w);return a&&re.isCollection(p)&&(p.flow=!0),d(),p}createPair(e,n,i={}){let r=this.createNode(e,null,i),s=this.createNode(n,null,i);return new Jp.Pair(r,s)}delete(e){return vt(this.contents)?this.contents.delete(e):!1}deleteIn(e){return yt.isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):vt(this.contents)?this.contents.deleteIn(e):!1}get(e,n){return re.isCollection(this.contents)?this.contents.get(e,n):void 0}getIn(e,n){return yt.isEmptyPath(e)?!n&&re.isScalar(this.contents)?this.contents.value:this.contents:re.isCollection(this.contents)?this.contents.getIn(e,n):void 0}has(e){return re.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return yt.isEmptyPath(e)?this.contents!==void 0:re.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,n){this.contents==null?this.contents=yt.collectionFromPath(this.schema,[e],n):vt(this.contents)&&this.contents.set(e,n)}setIn(e,n){yt.isEmptyPath(e)?this.contents=n:this.contents==null?this.contents=yt.collectionFromPath(this.schema,Array.from(e),n):vt(this.contents)&&this.contents.setIn(e,n)}setSchema(e,n={}){typeof e=="number"&&(e=String(e));let i;switch(e){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new ws.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 ws.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 Gp.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=Hp.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"?Qp.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 zp.stringifyDocument(this,e)}};function vt(t){if(re.isCollection(t))return!0;throw new Error("Expected a YAML collection as document contents")}bc.Document=ys});var Zt=v(Xt=>{"use strict";var Qt=class extends Error{constructor(e,n,i,r){super(),this.name=e,this.code=i,this.message=r,this.pos=n}},vs=class extends Qt{constructor(e,n,i){super("YAMLParseError",e,n,i)}},bs=class extends Qt{constructor(e,n,i){super("YAMLWarning",e,n,i)}},Zp=(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)+`…
60
+ `}yc.stringifyDocument=Jm});var zt=v(bc=>{"use strict";var Hm=It(),yt=Wn(),re=N(),Gm=Re(),zm=Ee(),Qm=hs(),Xm=vc(),ws=Ln(),Zm=kr(),ep=$t(),ys=br(),vs=class t{constructor(e,n,i){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,re.NODE_TYPE,{value:re.DOC});let r=null;typeof n=="function"||Array.isArray(n)?r=n:i===void 0&&n&&(i=n,n=void 0);let s=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},i);this.options=s;let{version:o}=s;i?._directives?(this.directives=i._directives.atDocument(),this.directives.yaml.explicit&&(o=this.directives.yaml.version)):this.directives=new ys.Directives({version:o}),this.setSchema(o,i),this.contents=e===void 0?null:this.createNode(e,r,i)}clone(){let e=Object.create(t.prototype,{[re.NODE_TYPE]:{value:re.DOC}});return e.commentBefore=this.commentBefore,e.comment=this.comment,e.errors=this.errors.slice(),e.warnings=this.warnings.slice(),e.options=Object.assign({},this.options),this.directives&&(e.directives=this.directives.clone()),e.schema=this.schema.clone(),e.contents=re.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){vt(this.contents)&&this.contents.add(e)}addIn(e,n){vt(this.contents)&&this.contents.addIn(e,n)}createAlias(e,n){if(!e.anchor){let i=ws.anchorNames(this);e.anchor=!n||i.has(n)?ws.findNewAnchor(n||"a",i):n}return new Hm.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 p=y=>typeof y=="number"||y instanceof String||y instanceof Number,g=n.filter(p).map(String);g.length>0&&(n=n.concat(g)),r=n}else i===void 0&&n&&(i=n,n=void 0);let{aliasDuplicateObjects:s,anchorPrefix:o,flow:a,keepUndefined:c,onTagObj:l,tag:d}=i??{},{onAnchor:u,setAnchors:f,sourceObjects:h}=ws.createNodeAnchors(this,o||"a"),w={aliasDuplicateObjects:s??!0,keepUndefined:c??!1,onAnchor:u,onTagObj:l,replacer:r,schema:this.schema,sourceObjects:h},m=ep.createNode(e,d,w);return a&&re.isCollection(m)&&(m.flow=!0),f(),m}createPair(e,n,i={}){let r=this.createNode(e,null,i),s=this.createNode(n,null,i);return new Gm.Pair(r,s)}delete(e){return vt(this.contents)?this.contents.delete(e):!1}deleteIn(e){return yt.isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):vt(this.contents)?this.contents.deleteIn(e):!1}get(e,n){return re.isCollection(this.contents)?this.contents.get(e,n):void 0}getIn(e,n){return yt.isEmptyPath(e)?!n&&re.isScalar(this.contents)?this.contents.value:this.contents:re.isCollection(this.contents)?this.contents.getIn(e,n):void 0}has(e){return re.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return yt.isEmptyPath(e)?this.contents!==void 0:re.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,n){this.contents==null?this.contents=yt.collectionFromPath(this.schema,[e],n):vt(this.contents)&&this.contents.set(e,n)}setIn(e,n){yt.isEmptyPath(e)?this.contents=n:this.contents==null?this.contents=yt.collectionFromPath(this.schema,Array.from(e),n):vt(this.contents)&&this.contents.setIn(e,n)}setSchema(e,n={}){typeof e=="number"&&(e=String(e));let i;switch(e){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new ys.Directives({version:"1.1"}),i={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=e:this.directives=new ys.Directives({version:e}),i={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,i=null;break;default:{let r=JSON.stringify(e);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${r}`)}}if(n.schema instanceof Object)this.schema=n.schema;else if(i)this.schema=new Qm.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=zm.toJS(this.contents,n??"",a);if(typeof s=="function")for(let{count:l,res:d}of a.anchors.values())s(d,l);return typeof o=="function"?Zm.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 Xm.stringifyDocument(this,e)}};function vt(t){if(re.isCollection(t))return!0;throw new Error("Expected a YAML collection as document contents")}bc.Document=vs});var Zt=v(Xt=>{"use strict";var Qt=class extends Error{constructor(e,n,i,r){super(),this.name=e,this.code=i,this.message=r,this.pos=n}},bs=class extends Qt{constructor(e,n,i){super("YAMLParseError",e,n,i)}},ks=class extends Qt{constructor(e,n,i){super("YAMLWarning",e,n,i)}},tp=(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
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+=`:
62
62
 
63
63
  ${o}
64
64
  ${l}
65
- `}};Xt.YAMLError=Qt;Xt.YAMLParseError=vs;Xt.YAMLWarning=bs;Xt.prettifyError=Zp});var en=v(kc=>{"use strict";function em(t,{flow:e,indicator:n,next:i,offset:r,onError:s,parentIndent:o,startOnNewline:a}){let c=!1,l=a,f=a,u="",d="",h=!1,w=!1,p=null,m=null,g=null,y=null,k=null,C=null,x=null;for(let b of t)switch(w&&(b.type!=="space"&&b.type!=="newline"&&b.type!=="comma"&&s(b.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),w=!1),p&&(l&&b.type!=="comment"&&b.type!=="newline"&&s(p,"TAB_AS_INDENT","Tabs are not allowed as indentation"),p=null),b.type){case"space":!e&&(n!=="doc-start"||i?.type!=="flow-collection")&&b.source.includes(" ")&&(p=b),f=!0;break;case"comment":{f||s(b,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let M=b.source.substring(1)||" ";u?u+=d+M:u=M,d="",l=!1;break}case"newline":l?u?u+=b.source:(!C||n!=="seq-item-ind")&&(c=!0):d+=b.source,l=!0,h=!0,(m||g)&&(y=b),f=!0;break;case"anchor":m&&s(b,"MULTIPLE_ANCHORS","A node can have at most one anchor"),b.source.endsWith(":")&&s(b.offset+b.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),m=b,x??(x=b.offset),l=!1,f=!1,w=!0;break;case"tag":{g&&s(b,"MULTIPLE_TAGS","A node can have at most one tag"),g=b,x??(x=b.offset),l=!1,f=!1,w=!0;break}case n:(m||g)&&s(b,"BAD_PROP_ORDER",`Anchors and tags must be after the ${b.source} indicator`),C&&s(b,"UNEXPECTED_TOKEN",`Unexpected ${b.source} in ${e??"collection"}`),C=b,l=n==="seq-item-ind"||n==="explicit-key-ind",f=!1;break;case"comma":if(e){k&&s(b,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),k=b,l=!1,f=!1;break}default:s(b,"UNEXPECTED_TOKEN",`Unexpected ${b.type} token`),l=!1,f=!1}let P=t[t.length-1],j=P?P.offset+P.source.length:r;return w&&i&&i.type!=="space"&&i.type!=="newline"&&i.type!=="comma"&&(i.type!=="scalar"||i.source!=="")&&s(i.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),p&&(l&&p.indent<=o||i?.type==="block-map"||i?.type==="block-seq")&&s(p,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:k,found:C,spaceBefore:c,comment:u,hasNewline:h,anchor:m,tag:g,newlineAfterProp:y,end:j,start:x??j}}kc.resolveProps=em});var Si=v(Sc=>{"use strict";function ks(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(ks(e.key)||ks(e.value))return!0}return!1;default:return!0}}Sc.containsNewline=ks});var Ss=v(Cc=>{"use strict";var tm=Si();function nm(t,e,n){if(e?.type==="flow-collection"){let i=e.end[0];i.indent===t&&(i.source==="]"||i.source==="}")&&tm.containsNewline(e)&&n(i,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}Cc.flowIndentCheck=nm});var Cs=v(xc=>{"use strict";var Ec=N();function im(t,e,n){let{uniqueKeys:i}=t.options;if(i===!1)return!1;let r=typeof i=="function"?i:(s,o)=>s===o||Ec.isScalar(s)&&Ec.isScalar(o)&&s.value===o.value;return e.some(s=>r(s.key,n))}xc.mapIncludes=im});var Ac=v(Oc=>{"use strict";var _c=Re(),rm=Oe(),Pc=en(),sm=Si(),Rc=Ss(),om=Cs(),Nc="All mapping items must start at the same column";function am({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:h,value:w}=f,p=Pc.resolveProps(u,{indicator:"explicit-key-ind",next:d??h?.[0],offset:c,onError:r,parentIndent:i.indent,startOnNewline:!0}),m=!p.found;if(m){if(d&&(d.type==="block-seq"?r(c,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in d&&d.indent!==i.indent&&r(c,"BAD_INDENT",Nc)),!p.anchor&&!p.tag&&!h){l=p.end,p.comment&&(a.comment?a.comment+=`
67
- `+p.comment:a.comment=p.comment);continue}(p.newlineAfterProp||sm.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",Nc);n.atKey=!0;let g=p.end,y=d?t(n,d,p,r):e(n,g,u,null,p,r);n.schema.compat&&Rc.flowIndentCheck(i.indent,d,r),n.atKey=!1,om.mapIncludes(n,a.items,y)&&r(g,"DUPLICATE_KEY","Map keys must be unique");let k=Pc.resolveProps(h??[],{indicator:"map-value-ind",next:w,offset:y.range[2],onError:r,parentIndent:i.indent,startOnNewline:!d||d.type==="block-scalar"});if(c=k.end,k.found){m&&(w?.type==="block-map"&&!k.hasNewline&&r(c,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),n.options.strict&&p.start<k.found.offset-1024&&r(y.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));let C=w?t(n,w,k,r):e(n,c,h,null,k,r);n.schema.compat&&Rc.flowIndentCheck(i.indent,w,r),c=C.range[2];let x=new _c.Pair(y,C);n.options.keepSourceTokens&&(x.srcToken=f),a.items.push(x)}else{m&&r(y.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),k.comment&&(y.comment?y.comment+=`
68
- `+k.comment:y.comment=k.comment);let C=new _c.Pair(y);n.options.keepSourceTokens&&(C.srcToken=f),a.items.push(C)}}return l&&l<c&&r(l,"IMPOSSIBLE","Map comment with trailing content"),a.range=[i.offset,c,l??c],a}Oc.resolveBlockMap=am});var Tc=v(jc=>{"use strict";var cm=Ae(),lm=en(),um=Ss();function fm({composeNode:t,composeEmptyNode:e},n,i,r,s){let o=s?.nodeClass??cm.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=lm.resolveProps(f,{indicator:"seq-item-ind",next:u,offset:c,onError:r,parentIndent:i.indent,startOnNewline:!0});if(!d.found)if(d.anchor||d.tag||u)u?.type==="block-seq"?r(d.end,"BAD_INDENT","All sequence items must start at the same column"):r(c,"MISSING_CHAR","Sequence item without - indicator");else{l=d.end,d.comment&&(a.comment=d.comment);continue}let h=u?t(n,u,d,r):e(n,d.end,f,null,d,r);n.schema.compat&&um.flowIndentCheck(i.indent,u,r),c=h.range[2],a.items.push(h)}return a.range=[i.offset,c,l??c],a}jc.resolveBlockSeq=fm});var bt=v(Ic=>{"use strict";function dm(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}}Ic.resolveEnd=dm});var Dc=v(Lc=>{"use strict";var pm=N(),mm=Re(),$c=Oe(),hm=Ae(),gm=bt(),qc=en(),wm=Si(),ym=Cs(),Es="Block collections are not allowed within flow collections",xs=t=>t&&(t.type==="block-map"||t.type==="block-seq");function vm({composeNode:t,composeEmptyNode:e},n,i,r,s){let o=i.start.source==="{",a=o?"flow map":"flow sequence",c=s?.nodeClass??(o?$c.YAMLMap:hm.YAMLSeq),l=new c(n.schema);l.flow=!0;let f=n.atRoot;f&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let u=i.offset+i.start.source.length;for(let m=0;m<i.items.length;++m){let g=i.items[m],{start:y,key:k,sep:C,value:x}=g,P=qc.resolveProps(y,{flow:a,indicator:"explicit-key-ind",next:k??C?.[0],offset:u,onError:r,parentIndent:i.indent,startOnNewline:!1});if(!P.found){if(!P.anchor&&!P.tag&&!C&&!x){m===0&&P.comma?r(P.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`):m<i.items.length-1&&r(P.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${a}`),P.comment&&(l.comment?l.comment+=`
69
- `+P.comment:l.comment=P.comment),u=P.end;continue}!o&&n.options.strict&&wm.containsNewline(k)&&r(k,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(m===0)P.comma&&r(P.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`);else if(P.comma||r(P.start,"MISSING_CHAR",`Missing , between ${a} items`),P.comment){let j="";e:for(let b of y)switch(b.type){case"comma":case"space":break;case"comment":j=b.source.substring(1);break e;default:break e}if(j){let b=l.items[l.items.length-1];pm.isPair(b)&&(b=b.value??b.key),b.comment?b.comment+=`
70
- `+j:b.comment=j,P.comment=P.comment.substring(j.length+1)}}if(!o&&!C&&!P.found){let j=x?t(n,x,P,r):e(n,P.end,C,null,P,r);l.items.push(j),u=j.range[2],xs(x)&&r(j.range,"BLOCK_IN_FLOW",Es)}else{n.atKey=!0;let j=P.end,b=k?t(n,k,P,r):e(n,j,y,null,P,r);xs(k)&&r(b.range,"BLOCK_IN_FLOW",Es),n.atKey=!1;let M=qc.resolveProps(C??[],{flow:a,indicator:"map-value-ind",next:x,offset:b.range[2],onError:r,parentIndent:i.indent,startOnNewline:!1});if(M.found){if(!o&&!P.found&&n.options.strict){if(C)for(let W of C){if(W===M.found)break;if(W.type==="newline"){r(W,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}P.start<M.found.offset-1024&&r(M.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else x&&("source"in x&&x.source?.[0]===":"?r(x,"MISSING_CHAR",`Missing space after : in ${a}`):r(M.start,"MISSING_CHAR",`Missing , or : between ${a} items`));let Ce=x?t(n,x,M,r):M.found?e(n,M.end,C,null,M,r):null;Ce?xs(x)&&r(Ce.range,"BLOCK_IN_FLOW",Es):M.comment&&(b.comment?b.comment+=`
71
- `+M.comment:b.comment=M.comment);let ut=new mm.Pair(b,Ce);if(n.options.keepSourceTokens&&(ut.srcToken=g),o){let W=l;ym.mapIncludes(n,W.items,b)&&r(j,"DUPLICATE_KEY","Map keys must be unique"),W.items.push(ut)}else{let W=new $c.YAMLMap(n.schema);W.flow=!0,W.items.push(ut);let Do=(Ce??b).range;W.range=[b.range[0],Do[1],Do[2]],l.items.push(W)}u=Ce?Ce.range[2]:M.end}}let d=o?"}":"]",[h,...w]=i.end,p=u;if(h?.source===d)p=h.offset+h.source.length;else{let m=a[0].toUpperCase()+a.substring(1),g=f?`${m} must end with a ${d}`:`${m} in block collection must be sufficiently indented and end with a ${d}`;r(u,f?"MISSING_CHAR":"BAD_INDENT",g),h&&h.source.length!==1&&w.unshift(h)}if(w.length>0){let m=gm.resolveEnd(w,p,n.options.strict,r);m.comment&&(l.comment?l.comment+=`
72
- `+m.comment:l.comment=m.comment),l.range=[i.offset,p,m.offset]}else l.range=[i.offset,p,p];return l}Lc.resolveFlowCollection=vm});var Mc=v(Fc=>{"use strict";var bm=N(),km=q(),Sm=Oe(),Cm=Ae(),Em=Ac(),xm=Tc(),_m=Dc();function _s(t,e,n,i,r,s){let o=n.type==="block-map"?Em.resolveBlockMap(t,e,n,i,s):n.type==="block-seq"?xm.resolveBlockSeq(t,e,n,i,s):_m.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 Pm(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:h}=i,w=d&&s?d.offset>s.offset?d:s:d??s;w&&(!h||h.offset<w.offset)&&r(w,"MISSING_CHAR","Missing newline after block sequence props")}let a=n.type==="block-map"?"map":n.type==="block-seq"?"seq":n.start.source==="{"?"map":"seq";if(!s||!o||o==="!"||o===Sm.YAMLMap.tagName&&a==="map"||o===Cm.YAMLSeq.tagName&&a==="seq")return _s(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),_s(t,e,n,r,o)}let l=_s(t,e,n,r,o,c),f=c.resolve?.(l,d=>r(s,"TAG_RESOLVE_FAILED",d),e.options)??l,u=bm.isNode(f)?f:new km.Scalar(f);return u.range=l.range,u.tag=o,c?.format&&(u.format=c.format),u}Fc.composeCollection=Pm});var Rs=v(Wc=>{"use strict";var Ps=q();function Rm(t,e,n){let i=e.offset,r=Nm(e,t.options.strict,n);if(!r)return{value:"",type:null,comment:"",range:[i,i,i]};let s=r.mode===">"?Ps.Scalar.BLOCK_FOLDED:Ps.Scalar.BLOCK_LITERAL,o=e.source?Om(e.source):[],a=o.length;for(let p=o.length-1;p>=0;--p){let m=o[p][1];if(m===""||m==="\r")a=p;else break}if(a===0){let p=r.chomp==="+"&&o.length>0?`
73
- `.repeat(Math.max(1,o.length-1)):"",m=i+r.length;return e.source&&(m+=e.source.length),{value:p,type:s,comment:r.comment,range:[i,m,m]}}let c=e.indent+r.indent,l=e.offset+r.length,f=0;for(let p=0;p<a;++p){let[m,g]=o[p];if(g===""||g==="\r")r.indent===0&&m.length>c&&(c=m.length);else{m.length<c&&n(l+m.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator"),r.indent===0&&(c=m.length),f=p,c===0&&!t.atRoot&&n(l,"BAD_INDENT","Block scalar values in collections must be indented");break}l+=m.length+g.length+1}for(let p=o.length-1;p>=a;--p)o[p][0].length>c&&(a=p+1);let u="",d="",h=!1;for(let p=0;p<f;++p)u+=o[p][0].slice(c)+`
74
- `;for(let p=f;p<a;++p){let[m,g]=o[p];l+=m.length+g.length+1;let y=g[g.length-1]==="\r";if(y&&(g=g.slice(0,-1)),g&&m.length<c){let C=`Block scalar lines must not be less indented than their ${r.indent?"explicit indentation indicator":"first line"}`;n(l-g.length-(y?2:1),"BAD_INDENT",C),m=""}s===Ps.Scalar.BLOCK_LITERAL?(u+=d+m.slice(c)+g,d=`
75
- `):m.length>c||g[0]===" "?(d===" "?d=`
76
- `:!h&&d===`
77
- `&&(d=`
65
+ `}};Xt.YAMLError=Qt;Xt.YAMLParseError=bs;Xt.YAMLWarning=ks;Xt.prettifyError=tp});var en=v(kc=>{"use strict";function np(t,{flow:e,indicator:n,next:i,offset:r,onError:s,parentIndent:o,startOnNewline:a}){let c=!1,l=a,d=a,u="",f="",h=!1,w=!1,m=null,p=null,g=null,y=null,k=null,C=null,x=null;for(let b of t)switch(w&&(b.type!=="space"&&b.type!=="newline"&&b.type!=="comma"&&s(b.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),w=!1),m&&(l&&b.type!=="comment"&&b.type!=="newline"&&s(m,"TAB_AS_INDENT","Tabs are not allowed as indentation"),m=null),b.type){case"space":!e&&(n!=="doc-start"||i?.type!=="flow-collection")&&b.source.includes(" ")&&(m=b),d=!0;break;case"comment":{d||s(b,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let M=b.source.substring(1)||" ";u?u+=f+M:u=M,f="",l=!1;break}case"newline":l?u?u+=b.source:(!C||n!=="seq-item-ind")&&(c=!0):f+=b.source,l=!0,h=!0,(p||g)&&(y=b),d=!0;break;case"anchor":p&&s(b,"MULTIPLE_ANCHORS","A node can have at most one anchor"),b.source.endsWith(":")&&s(b.offset+b.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),p=b,x??(x=b.offset),l=!1,d=!1,w=!0;break;case"tag":{g&&s(b,"MULTIPLE_TAGS","A node can have at most one tag"),g=b,x??(x=b.offset),l=!1,d=!1,w=!0;break}case n:(p||g)&&s(b,"BAD_PROP_ORDER",`Anchors and tags must be after the ${b.source} indicator`),C&&s(b,"UNEXPECTED_TOKEN",`Unexpected ${b.source} in ${e??"collection"}`),C=b,l=n==="seq-item-ind"||n==="explicit-key-ind",d=!1;break;case"comma":if(e){k&&s(b,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),k=b,l=!1,d=!1;break}default:s(b,"UNEXPECTED_TOKEN",`Unexpected ${b.type} token`),l=!1,d=!1}let P=t[t.length-1],j=P?P.offset+P.source.length:r;return w&&i&&i.type!=="space"&&i.type!=="newline"&&i.type!=="comma"&&(i.type!=="scalar"||i.source!=="")&&s(i.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),m&&(l&&m.indent<=o||i?.type==="block-map"||i?.type==="block-seq")&&s(m,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:k,found:C,spaceBefore:c,comment:u,hasNewline:h,anchor:p,tag:g,newlineAfterProp:y,end:j,start:x??j}}kc.resolveProps=np});var Si=v(Sc=>{"use strict";function Ss(t){if(!t)return null;switch(t.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(t.source.includes(`
66
+ `))return!0;if(t.end){for(let e of t.end)if(e.type==="newline")return!0}return!1;case"flow-collection":for(let e of t.items){for(let n of e.start)if(n.type==="newline")return!0;if(e.sep){for(let n of e.sep)if(n.type==="newline")return!0}if(Ss(e.key)||Ss(e.value))return!0}return!1;default:return!0}}Sc.containsNewline=Ss});var Cs=v(Cc=>{"use strict";var ip=Si();function rp(t,e,n){if(e?.type==="flow-collection"){let i=e.end[0];i.indent===t&&(i.source==="]"||i.source==="}")&&ip.containsNewline(e)&&n(i,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}Cc.flowIndentCheck=rp});var Es=v(xc=>{"use strict";var Ec=N();function sp(t,e,n){let{uniqueKeys:i}=t.options;if(i===!1)return!1;let r=typeof i=="function"?i:(s,o)=>s===o||Ec.isScalar(s)&&Ec.isScalar(o)&&s.value===o.value;return e.some(s=>r(s.key,n))}xc.mapIncludes=sp});var Oc=v(Ac=>{"use strict";var _c=Re(),op=Ae(),Pc=en(),ap=Si(),Rc=Cs(),cp=Es(),Nc="All mapping items must start at the same column";function lp({composeNode:t,composeEmptyNode:e},n,i,r,s){let o=s?.nodeClass??op.YAMLMap,a=new o(n.schema);n.atRoot&&(n.atRoot=!1);let c=i.offset,l=null;for(let d of i.items){let{start:u,key:f,sep:h,value:w}=d,m=Pc.resolveProps(u,{indicator:"explicit-key-ind",next:f??h?.[0],offset:c,onError:r,parentIndent:i.indent,startOnNewline:!0}),p=!m.found;if(p){if(f&&(f.type==="block-seq"?r(c,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in f&&f.indent!==i.indent&&r(c,"BAD_INDENT",Nc)),!m.anchor&&!m.tag&&!h){l=m.end,m.comment&&(a.comment?a.comment+=`
67
+ `+m.comment:a.comment=m.comment);continue}(m.newlineAfterProp||ap.containsNewline(f))&&r(f??u[u.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else m.found?.indent!==i.indent&&r(c,"BAD_INDENT",Nc);n.atKey=!0;let g=m.end,y=f?t(n,f,m,r):e(n,g,u,null,m,r);n.schema.compat&&Rc.flowIndentCheck(i.indent,f,r),n.atKey=!1,cp.mapIncludes(n,a.items,y)&&r(g,"DUPLICATE_KEY","Map keys must be unique");let k=Pc.resolveProps(h??[],{indicator:"map-value-ind",next:w,offset:y.range[2],onError:r,parentIndent:i.indent,startOnNewline:!f||f.type==="block-scalar"});if(c=k.end,k.found){p&&(w?.type==="block-map"&&!k.hasNewline&&r(c,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),n.options.strict&&m.start<k.found.offset-1024&&r(y.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));let C=w?t(n,w,k,r):e(n,c,h,null,k,r);n.schema.compat&&Rc.flowIndentCheck(i.indent,w,r),c=C.range[2];let x=new _c.Pair(y,C);n.options.keepSourceTokens&&(x.srcToken=d),a.items.push(x)}else{p&&r(y.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),k.comment&&(y.comment?y.comment+=`
68
+ `+k.comment:y.comment=k.comment);let C=new _c.Pair(y);n.options.keepSourceTokens&&(C.srcToken=d),a.items.push(C)}}return l&&l<c&&r(l,"IMPOSSIBLE","Map comment with trailing content"),a.range=[i.offset,c,l??c],a}Ac.resolveBlockMap=lp});var Tc=v(jc=>{"use strict";var up=Oe(),fp=en(),dp=Cs();function mp({composeNode:t,composeEmptyNode:e},n,i,r,s){let o=s?.nodeClass??up.YAMLSeq,a=new o(n.schema);n.atRoot&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let c=i.offset,l=null;for(let{start:d,value:u}of i.items){let f=fp.resolveProps(d,{indicator:"seq-item-ind",next:u,offset:c,onError:r,parentIndent:i.indent,startOnNewline:!0});if(!f.found)if(f.anchor||f.tag||u)u?.type==="block-seq"?r(f.end,"BAD_INDENT","All sequence items must start at the same column"):r(c,"MISSING_CHAR","Sequence item without - indicator");else{l=f.end,f.comment&&(a.comment=f.comment);continue}let h=u?t(n,u,f,r):e(n,f.end,d,null,f,r);n.schema.compat&&dp.flowIndentCheck(i.indent,u,r),c=h.range[2],a.items.push(h)}return a.range=[i.offset,c,l??c],a}jc.resolveBlockSeq=mp});var bt=v(Ic=>{"use strict";function pp(t,e,n,i){let r="";if(t){let s=!1,o="";for(let a of t){let{source:c,type:l}=a;switch(l){case"space":s=!0;break;case"comment":{n&&!s&&i(a,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let d=c.substring(1)||" ";r?r+=o+d:r=d,o="";break}case"newline":r&&(o+=c),s=!0;break;default:i(a,"UNEXPECTED_TOKEN",`Unexpected ${l} at node end`)}e+=c.length}}return{comment:r,offset:e}}Ic.resolveEnd=pp});var Dc=v(Lc=>{"use strict";var hp=N(),gp=Re(),$c=Ae(),wp=Oe(),yp=bt(),qc=en(),vp=Si(),bp=Es(),xs="Block collections are not allowed within flow collections",_s=t=>t&&(t.type==="block-map"||t.type==="block-seq");function kp({composeNode:t,composeEmptyNode:e},n,i,r,s){let o=i.start.source==="{",a=o?"flow map":"flow sequence",c=s?.nodeClass??(o?$c.YAMLMap:wp.YAMLSeq),l=new c(n.schema);l.flow=!0;let d=n.atRoot;d&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let u=i.offset+i.start.source.length;for(let p=0;p<i.items.length;++p){let g=i.items[p],{start:y,key:k,sep:C,value:x}=g,P=qc.resolveProps(y,{flow:a,indicator:"explicit-key-ind",next:k??C?.[0],offset:u,onError:r,parentIndent:i.indent,startOnNewline:!1});if(!P.found){if(!P.anchor&&!P.tag&&!C&&!x){p===0&&P.comma?r(P.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`):p<i.items.length-1&&r(P.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${a}`),P.comment&&(l.comment?l.comment+=`
69
+ `+P.comment:l.comment=P.comment),u=P.end;continue}!o&&n.options.strict&&vp.containsNewline(k)&&r(k,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(p===0)P.comma&&r(P.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`);else if(P.comma||r(P.start,"MISSING_CHAR",`Missing , between ${a} items`),P.comment){let j="";e:for(let b of y)switch(b.type){case"comma":case"space":break;case"comment":j=b.source.substring(1);break e;default:break e}if(j){let b=l.items[l.items.length-1];hp.isPair(b)&&(b=b.value??b.key),b.comment?b.comment+=`
70
+ `+j:b.comment=j,P.comment=P.comment.substring(j.length+1)}}if(!o&&!C&&!P.found){let j=x?t(n,x,P,r):e(n,P.end,C,null,P,r);l.items.push(j),u=j.range[2],_s(x)&&r(j.range,"BLOCK_IN_FLOW",xs)}else{n.atKey=!0;let j=P.end,b=k?t(n,k,P,r):e(n,j,y,null,P,r);_s(k)&&r(b.range,"BLOCK_IN_FLOW",xs),n.atKey=!1;let M=qc.resolveProps(C??[],{flow:a,indicator:"map-value-ind",next:x,offset:b.range[2],onError:r,parentIndent:i.indent,startOnNewline:!1});if(M.found){if(!o&&!P.found&&n.options.strict){if(C)for(let W of C){if(W===M.found)break;if(W.type==="newline"){r(W,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}P.start<M.found.offset-1024&&r(M.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else x&&("source"in x&&x.source?.[0]===":"?r(x,"MISSING_CHAR",`Missing space after : in ${a}`):r(M.start,"MISSING_CHAR",`Missing , or : between ${a} items`));let Ce=x?t(n,x,M,r):M.found?e(n,M.end,C,null,M,r):null;Ce?_s(x)&&r(Ce.range,"BLOCK_IN_FLOW",xs):M.comment&&(b.comment?b.comment+=`
71
+ `+M.comment:b.comment=M.comment);let ut=new gp.Pair(b,Ce);if(n.options.keepSourceTokens&&(ut.srcToken=g),o){let W=l;bp.mapIncludes(n,W.items,b)&&r(j,"DUPLICATE_KEY","Map keys must be unique"),W.items.push(ut)}else{let W=new $c.YAMLMap(n.schema);W.flow=!0,W.items.push(ut);let Do=(Ce??b).range;W.range=[b.range[0],Do[1],Do[2]],l.items.push(W)}u=Ce?Ce.range[2]:M.end}}let f=o?"}":"]",[h,...w]=i.end,m=u;if(h?.source===f)m=h.offset+h.source.length;else{let p=a[0].toUpperCase()+a.substring(1),g=d?`${p} must end with a ${f}`:`${p} in block collection must be sufficiently indented and end with a ${f}`;r(u,d?"MISSING_CHAR":"BAD_INDENT",g),h&&h.source.length!==1&&w.unshift(h)}if(w.length>0){let p=yp.resolveEnd(w,m,n.options.strict,r);p.comment&&(l.comment?l.comment+=`
72
+ `+p.comment:l.comment=p.comment),l.range=[i.offset,m,p.offset]}else l.range=[i.offset,m,m];return l}Lc.resolveFlowCollection=kp});var Mc=v(Fc=>{"use strict";var Sp=N(),Cp=L(),Ep=Ae(),xp=Oe(),_p=Oc(),Pp=Tc(),Rp=Dc();function Ps(t,e,n,i,r,s){let o=n.type==="block-map"?_p.resolveBlockMap(t,e,n,i,s):n.type==="block-seq"?Pp.resolveBlockSeq(t,e,n,i,s):Rp.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 Np(t,e,n,i,r){let s=i.tag,o=s?e.directives.tagName(s.source,f=>r(s,"TAG_RESOLVE_FAILED",f)):null;if(n.type==="block-seq"){let{anchor:f,newlineAfterProp:h}=i,w=f&&s?f.offset>s.offset?f:s:f??s;w&&(!h||h.offset<w.offset)&&r(w,"MISSING_CHAR","Missing newline after block sequence props")}let a=n.type==="block-map"?"map":n.type==="block-seq"?"seq":n.start.source==="{"?"map":"seq";if(!s||!o||o==="!"||o===Ep.YAMLMap.tagName&&a==="map"||o===xp.YAMLSeq.tagName&&a==="seq")return Ps(t,e,n,r,o);let c=e.schema.tags.find(f=>f.tag===o&&f.collection===a);if(!c){let f=e.schema.knownTags[o];if(f?.collection===a)e.schema.tags.push(Object.assign({},f,{default:!1})),c=f;else return f?r(s,"BAD_COLLECTION_TYPE",`${f.tag} used for ${a} collection, but expects ${f.collection??"scalar"}`,!0):r(s,"TAG_RESOLVE_FAILED",`Unresolved tag: ${o}`,!0),Ps(t,e,n,r,o)}let l=Ps(t,e,n,r,o,c),d=c.resolve?.(l,f=>r(s,"TAG_RESOLVE_FAILED",f),e.options)??l,u=Sp.isNode(d)?d:new Cp.Scalar(d);return u.range=l.range,u.tag=o,c?.format&&(u.format=c.format),u}Fc.composeCollection=Np});var Ns=v(Wc=>{"use strict";var Rs=L();function Ap(t,e,n){let i=e.offset,r=Op(e,t.options.strict,n);if(!r)return{value:"",type:null,comment:"",range:[i,i,i]};let s=r.mode===">"?Rs.Scalar.BLOCK_FOLDED:Rs.Scalar.BLOCK_LITERAL,o=e.source?jp(e.source):[],a=o.length;for(let m=o.length-1;m>=0;--m){let p=o[m][1];if(p===""||p==="\r")a=m;else break}if(a===0){let m=r.chomp==="+"&&o.length>0?`
73
+ `.repeat(Math.max(1,o.length-1)):"",p=i+r.length;return e.source&&(p+=e.source.length),{value:m,type:s,comment:r.comment,range:[i,p,p]}}let c=e.indent+r.indent,l=e.offset+r.length,d=0;for(let m=0;m<a;++m){let[p,g]=o[m];if(g===""||g==="\r")r.indent===0&&p.length>c&&(c=p.length);else{p.length<c&&n(l+p.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator"),r.indent===0&&(c=p.length),d=m,c===0&&!t.atRoot&&n(l,"BAD_INDENT","Block scalar values in collections must be indented");break}l+=p.length+g.length+1}for(let m=o.length-1;m>=a;--m)o[m][0].length>c&&(a=m+1);let u="",f="",h=!1;for(let m=0;m<d;++m)u+=o[m][0].slice(c)+`
74
+ `;for(let m=d;m<a;++m){let[p,g]=o[m];l+=p.length+g.length+1;let y=g[g.length-1]==="\r";if(y&&(g=g.slice(0,-1)),g&&p.length<c){let C=`Block scalar lines must not be less indented than their ${r.indent?"explicit indentation indicator":"first line"}`;n(l-g.length-(y?2:1),"BAD_INDENT",C),p=""}s===Rs.Scalar.BLOCK_LITERAL?(u+=f+p.slice(c)+g,f=`
75
+ `):p.length>c||g[0]===" "?(f===" "?f=`
76
+ `:!h&&f===`
77
+ `&&(f=`
78
78
 
79
- `),u+=d+m.slice(c)+g,d=`
80
- `,h=!0):g===""?d===`
79
+ `),u+=f+p.slice(c)+g,f=`
80
+ `,h=!0):g===""?f===`
81
81
  `?u+=`
82
- `:d=`
83
- `:(u+=d+g,d=" ",h=!1)}switch(r.chomp){case"-":break;case"+":for(let p=a;p<o.length;++p)u+=`
84
- `+o[p][0].slice(c);u[u.length-1]!==`
82
+ `:f=`
83
+ `:(u+=f+g,f=" ",h=!1)}switch(r.chomp){case"-":break;case"+":for(let m=a;m<o.length;++m)u+=`
84
+ `+o[m][0].slice(c);u[u.length-1]!==`
85
85
  `&&(u+=`
86
86
  `);break;default:u+=`
87
- `}let w=i+r.length+e.source.length;return{value:u,type:s,comment:r.comment,range:[i,w,w]}}function Nm({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 h=r[d];if(!a&&(h==="-"||h==="+"))a=h;else{let w=Number(h);!o&&w?o=w:c===-1&&(c=t+d)}}c!==-1&&i(c,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${r}`);let l=!1,f="",u=r.length;for(let d=1;d<e.length;++d){let h=e[d];switch(h.type){case"space":l=!0;case"newline":u+=h.source.length;break;case"comment":n&&!l&&i(h,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),u+=h.source.length,f=h.source.substring(1);break;case"error":i(h,"UNEXPECTED_TOKEN",h.message),u+=h.source.length;break;default:{let w=`Unexpected token in block scalar header: ${h.type}`;i(h,"UNEXPECTED_TOKEN",w);let p=h.source;p&&typeof p=="string"&&(u+=p.length)}}}return{mode:s,indent:o,chomp:a,comment:f,length:u}}function Om(t){let e=t.split(/\n( *)/),n=e[0],i=n.match(/^( *)/),s=[i?.[1]?[i[1],n.slice(i[1].length)]:["",n]];for(let o=1;o<e.length;o+=2)s.push([e[o],e[o+1]]);return s}Wc.resolveBlockScalar=Rm});var Os=v(Kc=>{"use strict";var Ns=q(),Am=bt();function jm(t,e,n){let{offset:i,type:r,source:s,end:o}=t,a,c,l=(d,h,w)=>n(i+d,h,w);switch(r){case"scalar":a=Ns.Scalar.PLAIN,c=Tm(s,l);break;case"single-quoted-scalar":a=Ns.Scalar.QUOTE_SINGLE,c=Im(s,l);break;case"double-quoted-scalar":a=Ns.Scalar.QUOTE_DOUBLE,c=$m(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=Am.resolveEnd(o,f,e,n);return{value:c,type:a,comment:u.comment,range:[i,f,u.offset]}}function Tm(t,e){let n="";switch(t[0]){case" ":n="a tab character";break;case",":n="flow indicator character ,";break;case"%":n="directive indicator character %";break;case"|":case">":{n=`block scalar indicator ${t[0]}`;break}case"@":case"`":{n=`reserved character ${t[0]}`;break}}return n&&e(0,"BAD_SCALAR_START",`Plain value cannot start with ${n}`),Bc(t)}function Im(t,e){return(t[t.length-1]!=="'"||t.length===1)&&e(t.length,"MISSING_CHAR","Missing closing 'quote"),Bc(t.slice(1,-1)).replace(/''/g,"'")}function Bc(t){let e,n;try{e=new RegExp(`(.*?)(?<![ ])[ ]*\r?
87
+ `}let w=i+r.length+e.source.length;return{value:u,type:s,comment:r.comment,range:[i,w,w]}}function Op({offset:t,props:e},n,i){if(e[0].type!=="block-scalar-header")return i(e[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:r}=e[0],s=r[0],o=0,a="",c=-1;for(let f=1;f<r.length;++f){let h=r[f];if(!a&&(h==="-"||h==="+"))a=h;else{let w=Number(h);!o&&w?o=w:c===-1&&(c=t+f)}}c!==-1&&i(c,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${r}`);let l=!1,d="",u=r.length;for(let f=1;f<e.length;++f){let h=e[f];switch(h.type){case"space":l=!0;case"newline":u+=h.source.length;break;case"comment":n&&!l&&i(h,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),u+=h.source.length,d=h.source.substring(1);break;case"error":i(h,"UNEXPECTED_TOKEN",h.message),u+=h.source.length;break;default:{let w=`Unexpected token in block scalar header: ${h.type}`;i(h,"UNEXPECTED_TOKEN",w);let m=h.source;m&&typeof m=="string"&&(u+=m.length)}}}return{mode:s,indent:o,chomp:a,comment:d,length:u}}function jp(t){let e=t.split(/\n( *)/),n=e[0],i=n.match(/^( *)/),s=[i?.[1]?[i[1],n.slice(i[1].length)]:["",n]];for(let o=1;o<e.length;o+=2)s.push([e[o],e[o+1]]);return s}Wc.resolveBlockScalar=Ap});var Os=v(Kc=>{"use strict";var As=L(),Tp=bt();function Ip(t,e,n){let{offset:i,type:r,source:s,end:o}=t,a,c,l=(f,h,w)=>n(i+f,h,w);switch(r){case"scalar":a=As.Scalar.PLAIN,c=$p(s,l);break;case"single-quoted-scalar":a=As.Scalar.QUOTE_SINGLE,c=qp(s,l);break;case"double-quoted-scalar":a=As.Scalar.QUOTE_DOUBLE,c=Lp(s,l);break;default:return n(t,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${r}`),{value:"",type:null,comment:"",range:[i,i+s.length,i+s.length]}}let d=i+s.length,u=Tp.resolveEnd(o,d,e,n);return{value:c,type:a,comment:u.comment,range:[i,d,u.offset]}}function $p(t,e){let n="";switch(t[0]){case" ":n="a tab character";break;case",":n="flow indicator character ,";break;case"%":n="directive indicator character %";break;case"|":case">":{n=`block scalar indicator ${t[0]}`;break}case"@":case"`":{n=`reserved character ${t[0]}`;break}}return n&&e(0,"BAD_SCALAR_START",`Plain value cannot start with ${n}`),Bc(t)}function qp(t,e){return(t[t.length-1]!=="'"||t.length===1)&&e(t.length,"MISSING_CHAR","Missing closing 'quote"),Bc(t.slice(1,-1)).replace(/''/g,"'")}function Bc(t){let e,n;try{e=new RegExp(`(.*?)(?<![ ])[ ]*\r?
88
88
  `,"sy"),n=new RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
89
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
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 $m(t,e){let n="";for(let i=1;i<t.length-1;++i){let r=t[i];if(!(r==="\r"&&t[i+1]===`
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 Lp(t,e){let n="";for(let i=1;i<t.length-1;++i){let r=t[i];if(!(r==="\r"&&t[i+1]===`
92
92
  `))if(r===`
93
- `){let{fold:s,offset:o}=qm(t,i);n+=s,i=o}else if(r==="\\"){let s=t[++i],o=Lm[s];if(o)n+=o;else if(s===`
93
+ `){let{fold:s,offset:o}=Dp(t,i);n+=s,i=o}else if(r==="\\"){let s=t[++i],o=Fp[s];if(o)n+=o;else if(s===`
94
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+=Dm(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!==`
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+=Mp(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
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 qm(t,e){let n="",i=t[e+1];for(;(i===" "||i===" "||i===`
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 Dp(t,e){let n="",i=t[e+1];for(;(i===" "||i===" "||i===`
98
98
  `||i==="\r")&&!(i==="\r"&&t[e+2]!==`
99
99
  `);)i===`
100
100
  `&&(n+=`
101
- `),e+=1,i=t[e+1];return n||(n=" "),{fold:n,offset:e}}var Lm={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
102
- `,r:"\r",t:" ",v:"\v",N:"…",_:" ",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function Dm(t,e,n,i){let r=t.substr(e,n),o=r.length===n&&/^[0-9a-fA-F]+$/.test(r)?parseInt(r,16):NaN;try{return String.fromCodePoint(o)}catch{let a=t.substr(e-2,n+2);return i(e-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),a}}Kc.resolveFlowScalar=jm});var Vc=v(Uc=>{"use strict";var Qe=N(),Yc=q(),Fm=Rs(),Mm=Os();function Wm(t,e,n,i){let{value:r,type:s,comment:o,range:a}=e.type==="block-scalar"?Fm.resolveBlockScalar(t,e,i):Mm.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=Bm(t.schema,r,c,n,i):e.type==="scalar"?l=Km(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 Yc.Scalar(u)}catch(u){let d=u instanceof Error?u.message:String(u);i(n??e,"TAG_RESOLVE_FAILED",d),f=new Yc.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 Bm(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 Km({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}Uc.composeScalar=Wm});var Hc=v(Jc=>{"use strict";function Ym(t,e,n){if(e){n??(n=e.length);for(let i=n-1;i>=0;--i){let r=e[i];switch(r.type){case"space":case"comment":case"newline":t-=r.source.length;continue}for(r=e[++i];r?.type==="space";)t+=r.source.length,r=e[++i];break}}return t}Jc.emptyScalarPosition=Ym});var Qc=v(js=>{"use strict";var Um=It(),Vm=N(),Jm=Mc(),Gc=Vc(),Hm=bt(),Gm=Hc(),zm={composeNode:zc,composeEmptyNode:As};function zc(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=Qm(t,e,i),(a||c)&&i(e,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":l=Gc.composeScalar(t,e,c,i),a&&(l.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{l=Jm.composeCollection(zm,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=As(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&&(!Vm.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 As(t,e,n,i,{spaceBefore:r,comment:s,anchor:o,tag:a,end:c},l){let f={type:"scalar",offset:Gm.emptyScalarPosition(e,n,i),indent:-1,source:""},u=Gc.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 Qm({options:t},{offset:e,source:n,end:i},r){let s=new Um.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=Hm.resolveEnd(i,o,t.strict,r);return s.range=[e,o,a.offset],a.comment&&(s.comment=a.comment),s}js.composeEmptyNode=As;js.composeNode=zc});var el=v(Zc=>{"use strict";var Xm=zt(),Xc=Qc(),Zm=bt(),eh=en();function th(t,e,{offset:n,start:i,value:r,end:s},o){let a=Object.assign({_directives:e},t),c=new Xm.Document(void 0,a),l={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},f=eh.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?Xc.composeNode(l,r,f,o):Xc.composeEmptyNode(l,f.end,i,null,f,o);let u=c.contents.range[2],d=Zm.resolveEnd(s,u,!1,o);return d.comment&&(c.comment=d.comment),c.range=[n,u,d.offset],c}Zc.composeDoc=th});var Is=v(il=>{"use strict";var nh=jn("process"),ih=vr(),rh=zt(),tn=Zt(),tl=N(),sh=el(),oh=bt();function nn(t){if(typeof t=="number")return[t,t+1];if(Array.isArray(t))return t.length===2?t:[t[0],t[1]];let{offset:e,source:n}=t;return[e,e+(typeof n=="string"?n.length:1)]}function nl(t){let e="",n=!1,i=!1;for(let r=0;r<t.length;++r){let s=t[r];switch(s[0]){case"#":e+=(e===""?"":i?`
101
+ `),e+=1,i=t[e+1];return n||(n=" "),{fold:n,offset:e}}var Fp={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
102
+ `,r:"\r",t:" ",v:"\v",N:"…",_:" ",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function Mp(t,e,n,i){let r=t.substr(e,n),o=r.length===n&&/^[0-9a-fA-F]+$/.test(r)?parseInt(r,16):NaN;try{return String.fromCodePoint(o)}catch{let a=t.substr(e-2,n+2);return i(e-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),a}}Kc.resolveFlowScalar=Ip});var Vc=v(Uc=>{"use strict";var Ze=N(),Yc=L(),Wp=Ns(),Bp=Os();function Kp(t,e,n,i){let{value:r,type:s,comment:o,range:a}=e.type==="block-scalar"?Wp.resolveBlockScalar(t,e,i):Bp.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[Ze.SCALAR]:c?l=Yp(t.schema,r,c,n,i):e.type==="scalar"?l=Up(t,r,e,i):l=t.schema[Ze.SCALAR];let d;try{let u=l.resolve(r,f=>i(n??e,"TAG_RESOLVE_FAILED",f),t.options);d=Ze.isScalar(u)?u:new Yc.Scalar(u)}catch(u){let f=u instanceof Error?u.message:String(u);i(n??e,"TAG_RESOLVE_FAILED",f),d=new Yc.Scalar(r)}return d.range=a,d.source=r,s&&(d.type=s),c&&(d.tag=c),l.format&&(d.format=l.format),o&&(d.comment=o),d}function Yp(t,e,n,i,r){if(n==="!")return t[Ze.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[Ze.SCALAR])}function Up({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[Ze.SCALAR];if(n.compat){let a=n.compat.find(c=>c.default&&c.test?.test(i))??n[Ze.SCALAR];if(o.tag!==a.tag){let c=e.tagString(o.tag),l=e.tagString(a.tag),d=`Value may be parsed as either ${c} or ${l}`;s(r,"TAG_RESOLVE_FAILED",d,!0)}}return o}Uc.composeScalar=Kp});var Hc=v(Jc=>{"use strict";function Vp(t,e,n){if(e){n??(n=e.length);for(let i=n-1;i>=0;--i){let r=e[i];switch(r.type){case"space":case"comment":case"newline":t-=r.source.length;continue}for(r=e[++i];r?.type==="space";)t+=r.source.length,r=e[++i];break}}return t}Jc.emptyScalarPosition=Vp});var Qc=v(Ts=>{"use strict";var Jp=It(),Hp=N(),Gp=Mc(),Gc=Vc(),zp=bt(),Qp=Hc(),Xp={composeNode:zc,composeEmptyNode:js};function zc(t,e,n,i){let r=t.atKey,{spaceBefore:s,comment:o,anchor:a,tag:c}=n,l,d=!0;switch(e.type){case"alias":l=Zp(t,e,i),(a||c)&&i(e,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":l=Gc.composeScalar(t,e,c,i),a&&(l.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{l=Gp.composeCollection(Xp,t,e,n,i),a&&(l.anchor=a.source.substring(1))}catch(u){let f=u instanceof Error?u.message:String(u);i(e,"RESOURCE_EXHAUSTION",f)}break;default:{let u=e.type==="error"?e.message:`Unsupported token (type: ${e.type})`;i(e,"UNEXPECTED_TOKEN",u),d=!1}}return l??(l=js(t,e.offset,void 0,null,n,i)),a&&l.anchor===""&&i(a,"BAD_ALIAS","Anchor cannot be an empty string"),r&&t.options.stringKeys&&(!Hp.isScalar(l)||typeof l.value!="string"||l.tag&&l.tag!=="tag:yaml.org,2002:str")&&i(c??e,"NON_STRING_KEY","With stringKeys, all keys must be strings"),s&&(l.spaceBefore=!0),o&&(e.type==="scalar"&&e.source===""?l.comment=o:l.commentBefore=o),t.options.keepSourceTokens&&d&&(l.srcToken=e),l}function js(t,e,n,i,{spaceBefore:r,comment:s,anchor:o,tag:a,end:c},l){let d={type:"scalar",offset:Qp.emptyScalarPosition(e,n,i),indent:-1,source:""},u=Gc.composeScalar(t,d,a,l);return o&&(u.anchor=o.source.substring(1),u.anchor===""&&l(o,"BAD_ALIAS","Anchor cannot be an empty string")),r&&(u.spaceBefore=!0),s&&(u.comment=s,u.range[2]=c),u}function Zp({options:t},{offset:e,source:n,end:i},r){let s=new Jp.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=zp.resolveEnd(i,o,t.strict,r);return s.range=[e,o,a.offset],a.comment&&(s.comment=a.comment),s}Ts.composeEmptyNode=js;Ts.composeNode=zc});var el=v(Zc=>{"use strict";var eh=zt(),Xc=Qc(),th=bt(),nh=en();function ih(t,e,{offset:n,start:i,value:r,end:s},o){let a=Object.assign({_directives:e},t),c=new eh.Document(void 0,a),l={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},d=nh.resolveProps(i,{indicator:"doc-start",next:r??s?.[0],offset:n,onError:o,parentIndent:0,startOnNewline:!0});d.found&&(c.directives.docStart=!0,r&&(r.type==="block-map"||r.type==="block-seq")&&!d.hasNewline&&o(d.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),c.contents=r?Xc.composeNode(l,r,d,o):Xc.composeEmptyNode(l,d.end,i,null,d,o);let u=c.contents.range[2],f=th.resolveEnd(s,u,!1,o);return f.comment&&(c.comment=f.comment),c.range=[n,u,f.offset],c}Zc.composeDoc=ih});var $s=v(il=>{"use strict";var rh=jn("process"),sh=br(),oh=zt(),tn=Zt(),tl=N(),ah=el(),ch=bt();function nn(t){if(typeof t=="number")return[t,t+1];if(Array.isArray(t))return t.length===2?t:[t[0],t[1]];let{offset:e,source:n}=t;return[e,e+(typeof n=="string"?n.length:1)]}function nl(t){let e="",n=!1,i=!1;for(let r=0;r<t.length;++r){let s=t[r];switch(s[0]){case"#":e+=(e===""?"":i?`
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 Ts=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(n,i,r,s)=>{let o=nn(n);s?this.warnings.push(new tn.YAMLWarning(o,i,r)):this.errors.push(new tn.YAMLParseError(o,i,r))},this.directives=new ih.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,n){let{comment:i,afterEmptyLine:r}=nl(this.prelude);if(i){let s=e.contents;if(n)e.comment=e.comment?`${e.comment}
105
+ `)+(s.substring(1)||" "),n=!0,i=!1;break;case"%":t[r+1]?.[0]!=="#"&&(r+=1),n=!1;break;default:n||(i=!0),n=!1}}return{comment:e,afterEmptyLine:i}}var Is=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(n,i,r,s)=>{let o=nn(n);s?this.warnings.push(new tn.YAMLWarning(o,i,r)):this.errors.push(new tn.YAMLParseError(o,i,r))},this.directives=new sh.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,n){let{comment:i,afterEmptyLine:r}=nl(this.prelude);if(i){let s=e.contents;if(n)e.comment=e.comment?`${e.comment}
106
106
  ${i}`:i;else if(r||e.directives.docStart||!s)e.commentBefore=i;else if(tl.isCollection(s)&&!s.flow&&s.items.length>0){let o=s.items[0];tl.isPair(o)&&(o=o.key);let a=o.commentBefore;o.commentBefore=a?`${i}
107
107
  ${a}`:i}else{let o=s.commentBefore;s.commentBefore=o?`${i}
108
- ${o}`:i}}if(n){for(let s=0;s<this.errors.length;++s)e.errors.push(this.errors[s]);for(let s=0;s<this.warnings.length;++s)e.warnings.push(this.warnings[s])}else e.errors=this.errors,e.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:nl(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,n=!1,i=-1){for(let r of e)yield*this.next(r);yield*this.end(n,i)}*next(e){switch(nh.env.LOG_STREAM&&console.dir(e,{depth:null}),e.type){case"directive":this.directives.add(e.source,(n,i,r)=>{let s=nn(e);s[0]+=n,this.onError(s,"BAD_DIRECTIVE",i,r)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let n=sh.composeDoc(this.options,this.directives,e,this.onError);this.atDirectives&&!n.directives.docStart&&this.onError(e,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(n,!1),this.doc&&(yield this.doc),this.doc=n,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(e.source);break;case"error":{let n=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,i=new tn.YAMLParseError(nn(e),"UNEXPECTED_TOKEN",n);this.atDirectives||!this.doc?this.errors.push(i):this.doc.errors.push(i);break}case"doc-end":{if(!this.doc){let i="Unexpected doc-end without preceding document";this.errors.push(new tn.YAMLParseError(nn(e),"UNEXPECTED_TOKEN",i));break}this.doc.directives.docEnd=!0;let n=oh.resolveEnd(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),n.comment){let i=this.doc.comment;this.doc.comment=i?`${i}
109
- ${n.comment}`:n.comment}this.doc.range[2]=n.offset;break}default:this.errors.push(new tn.YAMLParseError(nn(e),"UNEXPECTED_TOKEN",`Unsupported token ${e.type}`))}}*end(e=!1,n=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let i=Object.assign({_directives:this.directives},this.options),r=new 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}}};il.Composer=Ts});var ol=v(Ci=>{"use strict";var ah=Rs(),ch=Os(),lh=Zt(),rl=Ft();function uh(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 lh.YAMLParseError([a,a+1],s,o)};switch(t.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return ch.resolveFlowScalar(t,e,i);case"block-scalar":return ah.resolveBlockScalar({options:{strict:e}},t,i)}}return null}function fh(t,e){let{implicitKey:n=!1,indent:i,inFlow:r=!1,offset:s=-1,type:o="PLAIN"}=e,a=rl.stringifyString({type:o,value:t},{implicitKey:n,indent:i>0?" ".repeat(i):"",inFlow:r,options:{blockQuote:!0,lineWidth:-1}}),c=e.end??[{type:"newline",offset:-1,indent:i,source:`
108
+ ${o}`:i}}if(n){for(let s=0;s<this.errors.length;++s)e.errors.push(this.errors[s]);for(let s=0;s<this.warnings.length;++s)e.warnings.push(this.warnings[s])}else e.errors=this.errors,e.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:nl(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,n=!1,i=-1){for(let r of e)yield*this.next(r);yield*this.end(n,i)}*next(e){switch(rh.env.LOG_STREAM&&console.dir(e,{depth:null}),e.type){case"directive":this.directives.add(e.source,(n,i,r)=>{let s=nn(e);s[0]+=n,this.onError(s,"BAD_DIRECTIVE",i,r)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let n=ah.composeDoc(this.options,this.directives,e,this.onError);this.atDirectives&&!n.directives.docStart&&this.onError(e,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(n,!1),this.doc&&(yield this.doc),this.doc=n,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(e.source);break;case"error":{let n=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,i=new tn.YAMLParseError(nn(e),"UNEXPECTED_TOKEN",n);this.atDirectives||!this.doc?this.errors.push(i):this.doc.errors.push(i);break}case"doc-end":{if(!this.doc){let i="Unexpected doc-end without preceding document";this.errors.push(new tn.YAMLParseError(nn(e),"UNEXPECTED_TOKEN",i));break}this.doc.directives.docEnd=!0;let n=ch.resolveEnd(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),n.comment){let i=this.doc.comment;this.doc.comment=i?`${i}
109
+ ${n.comment}`:n.comment}this.doc.range[2]=n.offset;break}default:this.errors.push(new tn.YAMLParseError(nn(e),"UNEXPECTED_TOKEN",`Unsupported token ${e.type}`))}}*end(e=!1,n=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let i=Object.assign({_directives:this.directives},this.options),r=new oh.Document(void 0,i);this.atDirectives&&this.onError(n,"MISSING_CHAR","Missing directives-end indicator line"),r.range=[0,n,n],this.decorate(r,!1),yield r}}};il.Composer=Is});var ol=v(Ci=>{"use strict";var lh=Ns(),uh=Os(),fh=Zt(),rl=Ft();function dh(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 fh.YAMLParseError([a,a+1],s,o)};switch(t.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return uh.resolveFlowScalar(t,e,i);case"block-scalar":return lh.resolveBlockScalar({options:{strict:e}},t,i)}}return null}function mh(t,e){let{implicitKey:n=!1,indent:i,inFlow:r=!1,offset:s=-1,type:o="PLAIN"}=e,a=rl.stringifyString({type:o,value:t},{implicitKey:n,indent:i>0?" ".repeat(i):"",inFlow:r,options:{blockQuote:!0,lineWidth:-1}}),c=e.end??[{type:"newline",offset:-1,indent:i,source:`
110
110
  `}];switch(a[0]){case"|":case">":{let l=a.indexOf(`
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 dh(t,e,n={}){let{afterKey:i=!1,implicitKey:r=!1,inFlow:s=!1,type:o}=n,a="indent"in t?t.indent:null;if(i&&typeof a=="number"&&(a+=2),!o)switch(t.type){case"single-quoted-scalar":o="QUOTE_SINGLE";break;case"double-quoted-scalar":o="QUOTE_DOUBLE";break;case"block-scalar":{let l=t.props[0];if(l.type!=="block-scalar-header")throw new Error("Invalid block scalar header");o=l.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:o="PLAIN"}let c=rl.stringifyString({type:o,value:e},{implicitKey:r||a===null,indent:a!==null&&a>0?" ".repeat(a):"",inFlow:s,options:{blockQuote:!0,lineWidth:-1}});switch(c[0]){case"|":case">":ph(t,c);break;case'"':$s(t,c,"double-quoted-scalar");break;case"'":$s(t,c,"single-quoted-scalar");break;default:$s(t,c,"scalar")}}function ph(t,e){let n=e.indexOf(`
111
+ `),d=a.substring(0,l),u=a.substring(l+1)+`
112
+ `,f=[{type:"block-scalar-header",offset:s,indent:i,source:d}];return sl(f,c)||f.push({type:"newline",offset:-1,indent:i,source:`
113
+ `}),{type:"block-scalar",offset:s,indent:i,props:f,source:u}}case'"':return{type:"double-quoted-scalar",offset:s,indent:i,source:a,end:c};case"'":return{type:"single-quoted-scalar",offset:s,indent:i,source:a,end:c};default:return{type:"scalar",offset:s,indent:i,source:a,end:c}}}function ph(t,e,n={}){let{afterKey:i=!1,implicitKey:r=!1,inFlow:s=!1,type:o}=n,a="indent"in t?t.indent:null;if(i&&typeof a=="number"&&(a+=2),!o)switch(t.type){case"single-quoted-scalar":o="QUOTE_SINGLE";break;case"double-quoted-scalar":o="QUOTE_DOUBLE";break;case"block-scalar":{let l=t.props[0];if(l.type!=="block-scalar-header")throw new Error("Invalid block scalar header");o=l.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:o="PLAIN"}let c=rl.stringifyString({type:o,value:e},{implicitKey:r||a===null,indent:a!==null&&a>0?" ".repeat(a):"",inFlow:s,options:{blockQuote:!0,lineWidth:-1}});switch(c[0]){case"|":case">":hh(t,c);break;case'"':qs(t,c,"double-quoted-scalar");break;case"'":qs(t,c,"single-quoted-scalar");break;default:qs(t,c,"scalar")}}function hh(t,e){let n=e.indexOf(`
114
114
  `),i=e.substring(0,n),r=e.substring(n+1)+`
115
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 $s(t,e,n){switch(t.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":t.type=n,t.source=e;break;case"block-scalar":{let i=t.props.slice(1),r=e.length;t.props[0].type==="block-scalar-header"&&(r-=t.props[0].source.length);for(let s of i)s.offset+=r;delete t.props,Object.assign(t,{type:n,source:e,end:i});break}case"block-map":case"block-seq":{let r={type:"newline",offset:t.offset+e.length,indent:t.indent,source:`
117
- `};delete t.items,Object.assign(t,{type:n,source:e,end:[r]});break}default:{let i="indent"in t?t.indent:-1,r="end"in t&&Array.isArray(t.end)?t.end.filter(s=>s.type==="space"||s.type==="comment"||s.type==="newline"):[];for(let s of Object.keys(t))s!=="type"&&s!=="offset"&&delete t[s];Object.assign(t,{type:n,indent:i,source:e,end:r})}}}Ci.createScalarToken=fh;Ci.resolveAsScalar=uh;Ci.setScalarValue=dh});var cl=v(al=>{"use strict";var mh=t=>"type"in t?xi(t):Ei(t);function xi(t){switch(t.type){case"block-scalar":{let e="";for(let n of t.props)e+=xi(n);return e+t.source}case"block-map":case"block-seq":{let e="";for(let n of t.items)e+=Ei(n);return e}case"flow-collection":{let e=t.start.source;for(let n of t.items)e+=Ei(n);for(let n of t.end)e+=n.source;return e}case"document":{let e=Ei(t);if(t.end)for(let n of t.end)e+=n.source;return e}default:{let e=t.source;if("end"in t&&t.end)for(let n of t.end)e+=n.source;return e}}}function Ei({start:t,key:e,sep:n,value:i}){let r="";for(let s of t)r+=s.source;if(e&&(r+=xi(e)),n)for(let s of n)r+=s.source;return i&&(r+=xi(i)),r}al.stringify=mh});var dl=v(fl=>{"use strict";var qs=Symbol("break visit"),hh=Symbol("skip children"),ll=Symbol("remove item");function Xe(t,e){"type"in t&&t.type==="document"&&(t={start:t.start,value:t.value}),ul(Object.freeze([]),t,e)}Xe.BREAK=qs;Xe.SKIP=hh;Xe.REMOVE=ll;Xe.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};Xe.parentCollection=(t,e)=>{let n=Xe.itemAtPath(t,e.slice(0,-1)),i=e[e.length-1][0],r=n?.[i];if(r&&"items"in r)return r;throw new Error("Parent collection not found")};function ul(t,e,n){let i=n(e,t);if(typeof i=="symbol")return i;for(let r of["key","value"]){let s=e[r];if(s&&"items"in s){for(let o=0;o<s.items.length;++o){let a=ul(Object.freeze(t.concat([[r,o]])),s.items[o],n);if(typeof a=="number")o=a-1;else{if(a===qs)return qs;a===ll&&(s.items.splice(o,1),o-=1)}}typeof i=="function"&&r==="key"&&(i=i(e,t))}}return typeof i=="function"?i(e,t):i}fl.visit=Xe});var _i=v(ee=>{"use strict";var Ls=ol(),gh=cl(),wh=dl(),Ds="\uFEFF",Fs="",Ms="",Ws="",yh=t=>!!t&&"items"in t,vh=t=>!!t&&(t.type==="scalar"||t.type==="single-quoted-scalar"||t.type==="double-quoted-scalar"||t.type==="block-scalar");function bh(t){switch(t){case Ds:return"<BOM>";case Fs:return"<DOC>";case Ms:return"<FLOW_END>";case Ws:return"<SCALAR>";default:return JSON.stringify(t)}}function kh(t){switch(t){case Ds:return"byte-order-mark";case Fs:return"doc-mode";case Ms:return"flow-error-end";case Ws:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
116
+ `});for(let c of Object.keys(t))c!=="type"&&c!=="offset"&&delete t[c];Object.assign(t,{type:"block-scalar",indent:o,props:a,source:r})}}function sl(t,e){if(e)for(let n of e)switch(n.type){case"space":case"comment":t.push(n);break;case"newline":return t.push(n),!0}return!1}function qs(t,e,n){switch(t.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":t.type=n,t.source=e;break;case"block-scalar":{let i=t.props.slice(1),r=e.length;t.props[0].type==="block-scalar-header"&&(r-=t.props[0].source.length);for(let s of i)s.offset+=r;delete t.props,Object.assign(t,{type:n,source:e,end:i});break}case"block-map":case"block-seq":{let r={type:"newline",offset:t.offset+e.length,indent:t.indent,source:`
117
+ `};delete t.items,Object.assign(t,{type:n,source:e,end:[r]});break}default:{let i="indent"in t?t.indent:-1,r="end"in t&&Array.isArray(t.end)?t.end.filter(s=>s.type==="space"||s.type==="comment"||s.type==="newline"):[];for(let s of Object.keys(t))s!=="type"&&s!=="offset"&&delete t[s];Object.assign(t,{type:n,indent:i,source:e,end:r})}}}Ci.createScalarToken=mh;Ci.resolveAsScalar=dh;Ci.setScalarValue=ph});var cl=v(al=>{"use strict";var gh=t=>"type"in t?xi(t):Ei(t);function xi(t){switch(t.type){case"block-scalar":{let e="";for(let n of t.props)e+=xi(n);return e+t.source}case"block-map":case"block-seq":{let e="";for(let n of t.items)e+=Ei(n);return e}case"flow-collection":{let e=t.start.source;for(let n of t.items)e+=Ei(n);for(let n of t.end)e+=n.source;return e}case"document":{let e=Ei(t);if(t.end)for(let n of t.end)e+=n.source;return e}default:{let e=t.source;if("end"in t&&t.end)for(let n of t.end)e+=n.source;return e}}}function Ei({start:t,key:e,sep:n,value:i}){let r="";for(let s of t)r+=s.source;if(e&&(r+=xi(e)),n)for(let s of n)r+=s.source;return i&&(r+=xi(i)),r}al.stringify=gh});var dl=v(fl=>{"use strict";var Ls=Symbol("break visit"),wh=Symbol("skip children"),ll=Symbol("remove item");function et(t,e){"type"in t&&t.type==="document"&&(t={start:t.start,value:t.value}),ul(Object.freeze([]),t,e)}et.BREAK=Ls;et.SKIP=wh;et.REMOVE=ll;et.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};et.parentCollection=(t,e)=>{let n=et.itemAtPath(t,e.slice(0,-1)),i=e[e.length-1][0],r=n?.[i];if(r&&"items"in r)return r;throw new Error("Parent collection not found")};function ul(t,e,n){let i=n(e,t);if(typeof i=="symbol")return i;for(let r of["key","value"]){let s=e[r];if(s&&"items"in s){for(let o=0;o<s.items.length;++o){let a=ul(Object.freeze(t.concat([[r,o]])),s.items[o],n);if(typeof a=="number")o=a-1;else{if(a===Ls)return Ls;a===ll&&(s.items.splice(o,1),o-=1)}}typeof i=="function"&&r==="key"&&(i=i(e,t))}}return typeof i=="function"?i(e,t):i}fl.visit=et});var _i=v(ee=>{"use strict";var Ds=ol(),yh=cl(),vh=dl(),Fs="\uFEFF",Ms="",Ws="",Bs="",bh=t=>!!t&&"items"in t,kh=t=>!!t&&(t.type==="scalar"||t.type==="single-quoted-scalar"||t.type==="double-quoted-scalar"||t.type==="block-scalar");function Sh(t){switch(t){case Fs:return"<BOM>";case Ms:return"<DOC>";case Ws:return"<FLOW_END>";case Bs:return"<SCALAR>";default:return JSON.stringify(t)}}function Ch(t){switch(t){case Fs:return"byte-order-mark";case Ms:return"doc-mode";case Ws:return"flow-error-end";case Bs:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
118
118
  `:case`\r
119
- `:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(t[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}ee.createScalarToken=Ls.createScalarToken;ee.resolveAsScalar=Ls.resolveAsScalar;ee.setScalarValue=Ls.setScalarValue;ee.stringify=gh.stringify;ee.visit=wh.visit;ee.BOM=Ds;ee.DOCUMENT=Fs;ee.FLOW_END=Ms;ee.SCALAR=Ws;ee.isCollection=yh;ee.isScalar=vh;ee.prettyToken=bh;ee.tokenType=kh});var Ys=v(ml=>{"use strict";var rn=_i();function ce(t){switch(t){case void 0:case" ":case`
120
- `:case"\r":case" ":return!0;default:return!1}}var pl=new Set("0123456789ABCDEFabcdef"),Sh=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),Pi=new Set(",[]{}"),Ch=new Set(` ,[]{}
121
- \r `),Bs=t=>!t||Ch.has(t),Ks=class{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(e,n=!1){if(e){if(typeof e!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+e:e,this.lineEndPos=null}this.atEnd=!n;let i=this.next??"stream";for(;i&&(n||this.hasChars(1));)i=yield*this.parseNext(i)}atLineEnd(){let e=this.pos,n=this.buffer[e];for(;n===" "||n===" ";)n=this.buffer[++e];return!n||n==="#"||n===`
119
+ `:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(t[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}ee.createScalarToken=Ds.createScalarToken;ee.resolveAsScalar=Ds.resolveAsScalar;ee.setScalarValue=Ds.setScalarValue;ee.stringify=yh.stringify;ee.visit=vh.visit;ee.BOM=Fs;ee.DOCUMENT=Ms;ee.FLOW_END=Ws;ee.SCALAR=Bs;ee.isCollection=bh;ee.isScalar=kh;ee.prettyToken=Sh;ee.tokenType=Ch});var Us=v(pl=>{"use strict";var rn=_i();function le(t){switch(t){case void 0:case" ":case`
120
+ `:case"\r":case" ":return!0;default:return!1}}var ml=new Set("0123456789ABCDEFabcdef"),Eh=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),Pi=new Set(",[]{}"),xh=new Set(` ,[]{}
121
+ \r `),Ks=t=>!t||xh.has(t),Ys=class{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(e,n=!1){if(e){if(typeof e!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+e:e,this.lineEndPos=null}this.atEnd=!n;let i=this.next??"stream";for(;i&&(n||this.hasChars(1));)i=yield*this.parseNext(i)}atLineEnd(){let e=this.pos,n=this.buffer[e];for(;n===" "||n===" ";)n=this.buffer[++e];return!n||n==="#"||n===`
122
122
  `?!0:n==="\r"?this.buffer[e+1]===`
123
123
  `:!1}charAt(e){return this.buffer[this.pos+e]}continueScalar(e){let n=this.buffer[e];if(this.indentNext>0){let i=0;for(;n===" ";)n=this.buffer[++i+e];if(n==="\r"){let r=this.buffer[i+e+1];if(r===`
124
124
  `||!r&&!this.atEnd)return e+i+1}return n===`
125
- `||i>=this.indentNext||!n&&!this.atEnd?e+i:-1}if(n==="-"||n==="."){let i=this.buffer.substr(e,3);if((i==="---"||i==="...")&&ce(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;return(typeof e!="number"||e!==-1&&e<this.pos)&&(e=this.buffer.indexOf(`
126
- `,this.pos),this.lineEndPos=e),e===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[e-1]==="\r"&&(e-=1),this.buffer.substring(this.pos,e))}hasChars(e){return this.pos+e<=this.buffer.length}setNext(e){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=e,null}peek(e){return this.buffer.substr(this.pos,e)}*parseNext(e){switch(e){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let e=this.getLine();if(e===null)return this.setNext("stream");if(e[0]===rn.BOM&&(yield*this.pushCount(1),e=e.substring(1)),e[0]==="%"){let n=e.length,i=e.indexOf("#");for(;i!==-1;){let s=e[i-1];if(s===" "||s===" "){n=i-1;break}else i=e.indexOf("#",i+1)}for(;;){let s=e[n-1];if(s===" "||s===" ")n-=1;else break}let r=(yield*this.pushCount(n))+(yield*this.pushSpaces(!0));return yield*this.pushCount(e.length-r),this.pushNewline(),"stream"}if(this.atLineEnd()){let n=yield*this.pushSpaces(!0);return yield*this.pushCount(e.length-n),yield*this.pushNewline(),"stream"}return yield rn.DOCUMENT,yield*this.parseLineStart()}*parseLineStart(){let e=this.charAt(0);if(!e&&!this.atEnd)return this.setNext("line-start");if(e==="-"||e==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");let n=this.peek(3);if((n==="---"||n==="...")&&ce(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,n==="---"?"doc":"stream"}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!ce(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[e,n]=this.peek(2);if(!n&&!this.atEnd)return this.setNext("block-start");if((e==="-"||e==="?"||e===":")&&ce(n)){let i=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=i,"block-start"}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let e=this.getLine();if(e===null)return this.setNext("doc");let n=yield*this.pushIndicators();switch(e[n]){case"#":yield*this.pushCount(e.length-n);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(Bs),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return n+=yield*this.parseBlockScalarHeader(),n+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-n),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,n,i=-1;do e=yield*this.pushNewline(),e>0?(n=yield*this.pushSpaces(!1),this.indentValue=i=n):n=0,n+=yield*this.pushSpaces(!0);while(e+n>0);let r=this.getLine();if(r===null)return this.setNext("flow");if((i!==-1&&i<this.indentNext&&r[0]!=="#"||i===0&&(r.startsWith("---")||r.startsWith("..."))&&ce(r[3]))&&!(i===this.indentNext-1&&this.flowLevel===1&&(r[0]==="]"||r[0]==="}")))return this.flowLevel=0,yield rn.FLOW_END,yield*this.parseLineStart();let s=0;for(;r[s]===",";)s+=yield*this.pushCount(1),s+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(s+=yield*this.pushIndicators(),r[s]){case void 0:return"flow";case"#":return yield*this.pushCount(r.length-s),"flow";case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel+=1,"flow";case"}":case"]":return yield*this.pushCount(1),this.flowKey=!0,this.flowLevel-=1,this.flowLevel?"flow":"doc";case"*":return yield*this.pushUntil(Bs),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let o=this.charAt(1);if(this.flowKey||ce(o)||o===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let e=this.charAt(0),n=this.buffer.indexOf(e,this.pos+1);if(e==="'")for(;n!==-1&&this.buffer[n+1]==="'";)n=this.buffer.indexOf("'",n+2);else for(;n!==-1;){let s=0;for(;this.buffer[n-1-s]==="\\";)s+=1;if(s%2===0)break;n=this.buffer.indexOf('"',n+1)}let i=this.buffer.substring(0,n),r=i.indexOf(`
125
+ `||i>=this.indentNext||!n&&!this.atEnd?e+i:-1}if(n==="-"||n==="."){let i=this.buffer.substr(e,3);if((i==="---"||i==="...")&&le(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;return(typeof e!="number"||e!==-1&&e<this.pos)&&(e=this.buffer.indexOf(`
126
+ `,this.pos),this.lineEndPos=e),e===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[e-1]==="\r"&&(e-=1),this.buffer.substring(this.pos,e))}hasChars(e){return this.pos+e<=this.buffer.length}setNext(e){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=e,null}peek(e){return this.buffer.substr(this.pos,e)}*parseNext(e){switch(e){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let e=this.getLine();if(e===null)return this.setNext("stream");if(e[0]===rn.BOM&&(yield*this.pushCount(1),e=e.substring(1)),e[0]==="%"){let n=e.length,i=e.indexOf("#");for(;i!==-1;){let s=e[i-1];if(s===" "||s===" "){n=i-1;break}else i=e.indexOf("#",i+1)}for(;;){let s=e[n-1];if(s===" "||s===" ")n-=1;else break}let r=(yield*this.pushCount(n))+(yield*this.pushSpaces(!0));return yield*this.pushCount(e.length-r),this.pushNewline(),"stream"}if(this.atLineEnd()){let n=yield*this.pushSpaces(!0);return yield*this.pushCount(e.length-n),yield*this.pushNewline(),"stream"}return yield rn.DOCUMENT,yield*this.parseLineStart()}*parseLineStart(){let e=this.charAt(0);if(!e&&!this.atEnd)return this.setNext("line-start");if(e==="-"||e==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");let n=this.peek(3);if((n==="---"||n==="...")&&le(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,n==="---"?"doc":"stream"}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!le(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[e,n]=this.peek(2);if(!n&&!this.atEnd)return this.setNext("block-start");if((e==="-"||e==="?"||e===":")&&le(n)){let i=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=i,"block-start"}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let e=this.getLine();if(e===null)return this.setNext("doc");let n=yield*this.pushIndicators();switch(e[n]){case"#":yield*this.pushCount(e.length-n);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(Ks),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return n+=yield*this.parseBlockScalarHeader(),n+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-n),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,n,i=-1;do e=yield*this.pushNewline(),e>0?(n=yield*this.pushSpaces(!1),this.indentValue=i=n):n=0,n+=yield*this.pushSpaces(!0);while(e+n>0);let r=this.getLine();if(r===null)return this.setNext("flow");if((i!==-1&&i<this.indentNext&&r[0]!=="#"||i===0&&(r.startsWith("---")||r.startsWith("..."))&&le(r[3]))&&!(i===this.indentNext-1&&this.flowLevel===1&&(r[0]==="]"||r[0]==="}")))return this.flowLevel=0,yield rn.FLOW_END,yield*this.parseLineStart();let s=0;for(;r[s]===",";)s+=yield*this.pushCount(1),s+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(s+=yield*this.pushIndicators(),r[s]){case void 0:return"flow";case"#":return yield*this.pushCount(r.length-s),"flow";case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel+=1,"flow";case"}":case"]":return yield*this.pushCount(1),this.flowKey=!0,this.flowLevel-=1,this.flowLevel?"flow":"doc";case"*":return yield*this.pushUntil(Ks),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let o=this.charAt(1);if(this.flowKey||le(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
127
  `,this.pos);if(r!==-1){for(;r!==-1;){let s=this.continueScalar(r+1);if(s===-1)break;r=i.indexOf(`
128
- `,s)}r!==-1&&(n=r-(i[r-1]==="\r"?2:1))}if(n===-1){if(!this.atEnd)return this.setNext("quoted-scalar");n=this.buffer.length}return yield*this.pushToIndex(n+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let e=this.pos;for(;;){let n=this.buffer[++e];if(n==="+")this.blockScalarKeep=!0;else if(n>"0"&&n<="9")this.blockScalarIndent=Number(n)-1;else if(n!=="-")break}return yield*this.pushUntil(n=>ce(n)||n==="#")}*parseBlockScalar(){let e=this.pos-1,n=0,i;e:for(let s=this.pos;i=this.buffer[s];++s)switch(i){case" ":n+=1;break;case`
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=>le(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
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
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
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
132
  `;)i=this.buffer[++r];e=r-1}else if(!this.blockScalarKeep)do{let s=e-1,o=this.buffer[s];o==="\r"&&(o=this.buffer[--s]);let a=s;for(;o===" ";)o=this.buffer[--s];if(o===`
133
- `&&s>=this.pos&&s+1+n>a)e=s;else break}while(!0);return yield rn.SCALAR,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,n=this.pos-1,i=this.pos-1,r;for(;r=this.buffer[++i];)if(r===":"){let s=this.buffer[i+1];if(ce(s)||e&&Pi.has(s))break;n=i}else if(ce(r)){let s=this.buffer[i+1];if(r==="\r"&&(s===`
133
+ `&&s>=this.pos&&s+1+n>a)e=s;else break}while(!0);return yield rn.SCALAR,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,n=this.pos-1,i=this.pos-1,r;for(;r=this.buffer[++i];)if(r===":"){let s=this.buffer[i+1];if(le(s)||e&&Pi.has(s))break;n=i}else if(le(r)){let s=this.buffer[i+1];if(r==="\r"&&(s===`
134
134
  `?(i+=1,r=`
135
135
  `,s=this.buffer[i+1]):n=i),s==="#"||e&&Pi.has(s))break;if(r===`
136
- `){let o=this.continueScalar(i+1);if(o===-1)break;i=Math.max(i,o-2)}}else{if(e&&Pi.has(r))break;n=i}return!r&&!this.atEnd?this.setNext("plain-scalar"):(yield rn.SCALAR,yield*this.pushToIndex(n+1,!0),e?"flow":"doc")}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,n){let i=this.buffer.slice(this.pos,e);return i?(yield i,this.pos+=i.length,i.length):(n&&(yield""),0)}*pushIndicators(){let e=0;e:for(;;){switch(this.charAt(0)){case"!":e+=yield*this.pushTag(),e+=yield*this.pushSpaces(!0);continue e;case"&":e+=yield*this.pushUntil(Bs),e+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let n=this.flowLevel>0,i=this.charAt(1);if(ce(i)||n&&Pi.has(i)){n?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,e+=yield*this.pushCount(1),e+=yield*this.pushSpaces(!0);continue e}}}break e}return e}*pushTag(){if(this.charAt(1)==="<"){let e=this.pos+2,n=this.buffer[e];for(;!ce(n)&&n!==">";)n=this.buffer[++e];return yield*this.pushToIndex(n===">"?e+1:e,!1)}else{let e=this.pos+1,n=this.buffer[e];for(;n;)if(Sh.has(n))n=this.buffer[++e];else if(n==="%"&&pl.has(this.buffer[e+1])&&pl.has(this.buffer[e+2]))n=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){let e=this.buffer[this.pos];return e===`
136
+ `){let o=this.continueScalar(i+1);if(o===-1)break;i=Math.max(i,o-2)}}else{if(e&&Pi.has(r))break;n=i}return!r&&!this.atEnd?this.setNext("plain-scalar"):(yield rn.SCALAR,yield*this.pushToIndex(n+1,!0),e?"flow":"doc")}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,n){let i=this.buffer.slice(this.pos,e);return i?(yield i,this.pos+=i.length,i.length):(n&&(yield""),0)}*pushIndicators(){let e=0;e:for(;;){switch(this.charAt(0)){case"!":e+=yield*this.pushTag(),e+=yield*this.pushSpaces(!0);continue e;case"&":e+=yield*this.pushUntil(Ks),e+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let n=this.flowLevel>0,i=this.charAt(1);if(le(i)||n&&Pi.has(i)){n?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,e+=yield*this.pushCount(1),e+=yield*this.pushSpaces(!0);continue e}}}break e}return e}*pushTag(){if(this.charAt(1)==="<"){let e=this.pos+2,n=this.buffer[e];for(;!le(n)&&n!==">";)n=this.buffer[++e];return yield*this.pushToIndex(n===">"?e+1:e,!1)}else{let e=this.pos+1,n=this.buffer[e];for(;n;)if(Eh.has(n))n=this.buffer[++e];else if(n==="%"&&ml.has(this.buffer[e+1])&&ml.has(this.buffer[e+2]))n=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){let e=this.buffer[this.pos];return e===`
137
137
  `?yield*this.pushCount(1):e==="\r"&&this.charAt(1)===`
138
- `?yield*this.pushCount(2):0}*pushSpaces(e){let n=this.pos-1,i;do i=this.buffer[++n];while(i===" "||e&&i===" ");let r=n-this.pos;return r>0&&(yield this.buffer.substr(this.pos,r),this.pos=n),r}*pushUntil(e){let n=this.pos,i=this.buffer[n];for(;!e(i);)i=this.buffer[++n];return yield*this.pushToIndex(n,!1)}};ml.Lexer=Ks});var Vs=v(hl=>{"use strict";var Us=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let n=0,i=this.lineStarts.length;for(;n<i;){let s=n+i>>1;this.lineStarts[s]<e?n=s+1:i=s}if(this.lineStarts[n]===e)return{line:n+1,col:1};if(n===0)return{line:0,col:e};let r=this.lineStarts[n-1];return{line:n,col:e-r+1}}}};hl.LineCounter=Us});var Hs=v(bl=>{"use strict";var Eh=jn("process"),gl=_i(),xh=Ys();function je(t,e){for(let n=0;n<t.length;++n)if(t[n].type===e)return!0;return!1}function wl(t){for(let e=0;e<t.length;++e)switch(t[e].type){case"space":case"comment":case"newline":break;default:return e}return-1}function vl(t){switch(t?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function Ri(t){switch(t.type){case"document":return t.start;case"block-map":{let e=t.items[t.items.length-1];return e.sep??e.start}case"block-seq":return t.items[t.items.length-1].start;default:return[]}}function kt(t){if(t.length===0)return[];let e=t.length;e:for(;--e>=0;)switch(t[e].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;t[++e]?.type==="space";);return t.splice(e,t.length)}function Ni(t,e){if(e.length<1e5)Array.prototype.push.apply(t,e);else for(let n=0;n<e.length;++n)t.push(e[n])}function yl(t){if(t.start.type==="flow-seq-start")for(let e of t.items)e.sep&&!e.value&&!je(e.start,"explicit-key-ind")&&!je(e.sep,"map-value-ind")&&(e.key&&(e.value=e.key),delete e.key,vl(e.value)?e.value.end?Ni(e.value.end,e.sep):e.value.end=e.sep:Ni(e.start,e.sep),delete e.sep)}var Js=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 xh.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,Eh.env.LOG_TOKENS&&console.log("|",gl.prettyToken(e)),this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}let n=gl.tokenType(e);if(n)if(n==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=n,yield*this.step(),n){case"newline":this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+e.length);break;case"space":this.atNewLine&&e[0]===" "&&(this.indent+=e.length);break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":this.atNewLine&&(this.indent+=e.length);break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=e.length}else{let i=`Not a YAML token: ${e}`;yield*this.pop({type:"error",offset:this.offset,message:i,source:e}),this.offset+=e.length}}*end(){for(;this.stack.length>0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let e=this.peek(1);if(this.type==="doc-end"&&e?.type!=="doc-end"){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!e)return yield*this.stream();switch(e.type){case"document":return yield*this.document(e);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(e);case"block-scalar":return yield*this.blockScalar(e);case"block-map":return yield*this.blockMap(e);case"block-seq":return yield*this.blockSequence(e);case"flow-collection":return yield*this.flowCollection(e);case"doc-end":return yield*this.documentEnd(e)}yield*this.pop()}peek(e){return this.stack[this.stack.length-e]}*pop(e){let n=e??this.stack.pop();if(!n)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield n;else{let i=this.peek(1);switch(n.type==="block-scalar"?n.indent="indent"in i?i.indent:0:n.type==="flow-collection"&&i.type==="document"&&(n.indent=0),n.type==="flow-collection"&&yl(n),i.type){case"document":i.value=n;break;case"block-scalar":i.props.push(n);break;case"block-map":{let r=i.items[i.items.length-1];if(r.value){i.items.push({start:[],key:n,sep:[]}),this.onKeyLine=!0;return}else if(r.sep)r.value=n;else{Object.assign(r,{key:n,sep:[]}),this.onKeyLine=!r.explicitKey;return}break}case"block-seq":{let r=i.items[i.items.length-1];r.value?i.items.push({start:[],value:n}):r.value=n;break}case"flow-collection":{let r=i.items[i.items.length-1];!r||r.value?i.items.push({start:[],key:n,sep:[]}):r.sep?r.value=n:Object.assign(r,{key:n,sep:[]});return}default:yield*this.pop(),yield*this.pop(n)}if((i.type==="document"||i.type==="block-map"||i.type==="block-seq")&&(n.type==="block-map"||n.type==="block-seq")){let r=n.items[n.items.length-1];r&&!r.sep&&!r.value&&r.start.length>0&&wl(r.start)===-1&&(n.indent===0||r.start.every(s=>s.type!=="comment"||s.indent<n.indent))&&(i.type==="document"?i.end=r.start:i.items.push({start:r.start}),n.items.splice(-1,1))}}}*stream(){switch(this.type){case"directive-line":yield{type:"directive",offset:this.offset,source:this.source};return;case"byte-order-mark":case"space":case"comment":case"newline":yield this.sourceToken;return;case"doc-mode":case"doc-start":{let e={type:"document",offset:this.offset,start:[]};this.type==="doc-start"&&e.start.push(this.sourceToken),this.stack.push(e);return}}yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(e){if(e.value)return yield*this.lineEnd(e);switch(this.type){case"doc-start":{wl(e.start)!==-1?(yield*this.pop(),yield*this.step()):e.start.push(this.sourceToken);return}case"anchor":case"tag":case"space":case"comment":case"newline":e.start.push(this.sourceToken);return}let n=this.startBlockValue(e);n?this.stack.push(n):yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(e){if(this.type==="map-value-ind"){let n=Ri(this.peek(2)),i=kt(n),r;e.end?(r=e.end,r.push(this.sourceToken),delete e.end):r=[this.sourceToken];let s={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:i,key:e,sep:r}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=s}else yield*this.lineEnd(e)}*blockScalar(e){switch(this.type){case"space":case"comment":case"newline":e.props.push(this.sourceToken);return;case"scalar":if(e.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let n=this.source.indexOf(`
138
+ `?yield*this.pushCount(2):0}*pushSpaces(e){let n=this.pos-1,i;do i=this.buffer[++n];while(i===" "||e&&i===" ");let r=n-this.pos;return r>0&&(yield this.buffer.substr(this.pos,r),this.pos=n),r}*pushUntil(e){let n=this.pos,i=this.buffer[n];for(;!e(i);)i=this.buffer[++n];return yield*this.pushToIndex(n,!1)}};pl.Lexer=Ys});var Js=v(hl=>{"use strict";var Vs=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let n=0,i=this.lineStarts.length;for(;n<i;){let s=n+i>>1;this.lineStarts[s]<e?n=s+1:i=s}if(this.lineStarts[n]===e)return{line:n+1,col:1};if(n===0)return{line:0,col:e};let r=this.lineStarts[n-1];return{line:n,col:e-r+1}}}};hl.LineCounter=Vs});var Gs=v(bl=>{"use strict";var _h=jn("process"),gl=_i(),Ph=Us();function je(t,e){for(let n=0;n<t.length;++n)if(t[n].type===e)return!0;return!1}function wl(t){for(let e=0;e<t.length;++e)switch(t[e].type){case"space":case"comment":case"newline":break;default:return e}return-1}function vl(t){switch(t?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function Ri(t){switch(t.type){case"document":return t.start;case"block-map":{let e=t.items[t.items.length-1];return e.sep??e.start}case"block-seq":return t.items[t.items.length-1].start;default:return[]}}function kt(t){if(t.length===0)return[];let e=t.length;e:for(;--e>=0;)switch(t[e].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;t[++e]?.type==="space";);return t.splice(e,t.length)}function Ni(t,e){if(e.length<1e5)Array.prototype.push.apply(t,e);else for(let n=0;n<e.length;++n)t.push(e[n])}function yl(t){if(t.start.type==="flow-seq-start")for(let e of t.items)e.sep&&!e.value&&!je(e.start,"explicit-key-ind")&&!je(e.sep,"map-value-ind")&&(e.key&&(e.value=e.key),delete e.key,vl(e.value)?e.value.end?Ni(e.value.end,e.sep):e.value.end=e.sep:Ni(e.start,e.sep),delete e.sep)}var Hs=class{constructor(e){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new Ph.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,_h.env.LOG_TOKENS&&console.log("|",gl.prettyToken(e)),this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}let n=gl.tokenType(e);if(n)if(n==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=n,yield*this.step(),n){case"newline":this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+e.length);break;case"space":this.atNewLine&&e[0]===" "&&(this.indent+=e.length);break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":this.atNewLine&&(this.indent+=e.length);break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=e.length}else{let i=`Not a YAML token: ${e}`;yield*this.pop({type:"error",offset:this.offset,message:i,source:e}),this.offset+=e.length}}*end(){for(;this.stack.length>0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let e=this.peek(1);if(this.type==="doc-end"&&e?.type!=="doc-end"){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!e)return yield*this.stream();switch(e.type){case"document":return yield*this.document(e);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(e);case"block-scalar":return yield*this.blockScalar(e);case"block-map":return yield*this.blockMap(e);case"block-seq":return yield*this.blockSequence(e);case"flow-collection":return yield*this.flowCollection(e);case"doc-end":return yield*this.documentEnd(e)}yield*this.pop()}peek(e){return this.stack[this.stack.length-e]}*pop(e){let n=e??this.stack.pop();if(!n)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield n;else{let i=this.peek(1);switch(n.type==="block-scalar"?n.indent="indent"in i?i.indent:0:n.type==="flow-collection"&&i.type==="document"&&(n.indent=0),n.type==="flow-collection"&&yl(n),i.type){case"document":i.value=n;break;case"block-scalar":i.props.push(n);break;case"block-map":{let r=i.items[i.items.length-1];if(r.value){i.items.push({start:[],key:n,sep:[]}),this.onKeyLine=!0;return}else if(r.sep)r.value=n;else{Object.assign(r,{key:n,sep:[]}),this.onKeyLine=!r.explicitKey;return}break}case"block-seq":{let r=i.items[i.items.length-1];r.value?i.items.push({start:[],value:n}):r.value=n;break}case"flow-collection":{let r=i.items[i.items.length-1];!r||r.value?i.items.push({start:[],key:n,sep:[]}):r.sep?r.value=n:Object.assign(r,{key:n,sep:[]});return}default:yield*this.pop(),yield*this.pop(n)}if((i.type==="document"||i.type==="block-map"||i.type==="block-seq")&&(n.type==="block-map"||n.type==="block-seq")){let r=n.items[n.items.length-1];r&&!r.sep&&!r.value&&r.start.length>0&&wl(r.start)===-1&&(n.indent===0||r.start.every(s=>s.type!=="comment"||s.indent<n.indent))&&(i.type==="document"?i.end=r.start:i.items.push({start:r.start}),n.items.splice(-1,1))}}}*stream(){switch(this.type){case"directive-line":yield{type:"directive",offset:this.offset,source:this.source};return;case"byte-order-mark":case"space":case"comment":case"newline":yield this.sourceToken;return;case"doc-mode":case"doc-start":{let e={type:"document",offset:this.offset,start:[]};this.type==="doc-start"&&e.start.push(this.sourceToken),this.stack.push(e);return}}yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(e){if(e.value)return yield*this.lineEnd(e);switch(this.type){case"doc-start":{wl(e.start)!==-1?(yield*this.pop(),yield*this.step()):e.start.push(this.sourceToken);return}case"anchor":case"tag":case"space":case"comment":case"newline":e.start.push(this.sourceToken);return}let n=this.startBlockValue(e);n?this.stack.push(n):yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(e){if(this.type==="map-value-ind"){let n=Ri(this.peek(2)),i=kt(n),r;e.end?(r=e.end,r.push(this.sourceToken),delete e.end):r=[this.sourceToken];let s={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:i,key:e,sep:r}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=s}else yield*this.lineEnd(e)}*blockScalar(e){switch(this.type){case"space":case"comment":case"newline":e.props.push(this.sourceToken);return;case"scalar":if(e.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let n=this.source.indexOf(`
139
139
  `)+1;for(;n!==0;)this.onNewLine(this.offset+n),n=this.source.indexOf(`
140
140
  `,n)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let n=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,n.value){let i="end"in n.value?n.value.end:void 0;(Array.isArray(i)?i[i.length-1]:void 0)?.type==="comment"?i?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)e.items.push({start:[this.sourceToken]});else if(n.sep)n.sep.push(this.sourceToken);else{if(this.atIndentedComment(n.start,e.indent)){let r=e.items[e.items.length-2]?.value?.end;if(Array.isArray(r)){Ni(r,n.start),r.push(this.sourceToken),e.items.pop();return}}n.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let i=!this.onKeyLine&&this.indent===e.indent,r=i&&(n.sep||n.explicitKey)&&this.type!=="seq-item-ind",s=[];if(r&&n.sep&&!n.value){let o=[];for(let a=0;a<n.sep.length;++a){let c=n.sep[a];switch(c.type){case"newline":o.push(a);break;case"space":break;case"comment":c.indent>e.indent&&(o.length=0);break;default:o.length=0}}o.length>=2&&(s=n.sep.splice(o[1]))}switch(this.type){case"anchor":case"tag":r||n.value?(s.push(this.sourceToken),e.items.push({start:s}),this.onKeyLine=!0):n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"explicit-key-ind":!n.sep&&!n.explicitKey?(n.start.push(this.sourceToken),n.explicitKey=!0):r||n.value?(s.push(this.sourceToken),e.items.push({start:s,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(n.explicitKey)if(n.sep)if(n.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(je(n.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:null,sep:[this.sourceToken]}]});else if(vl(n.key)&&!je(n.sep,"newline")){let o=kt(n.start),a=n.key,c=n.sep;c.push(this.sourceToken),delete n.key,delete n.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:a,sep:c}]})}else s.length>0?n.sep=n.sep.concat(s,this.sourceToken):n.sep.push(this.sourceToken);else if(je(n.start,"newline"))Object.assign(n,{key:null,sep:[this.sourceToken]});else{let o=kt(n.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]})}else n.sep?n.value||r?e.items.push({start:s,key:null,sep:[this.sourceToken]}):je(n.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):n.sep.push(this.sourceToken):Object.assign(n,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let o=this.flowScalar(this.type);r||n.value?(e.items.push({start:s,key:o,sep:[]}),this.onKeyLine=!0):n.sep?this.stack.push(o):(Object.assign(n,{key:o,sep:[]}),this.onKeyLine=!0);return}default:{let o=this.startBlockValue(e);if(o){if(o.type==="block-seq"){if(!n.explicitKey&&n.sep&&!je(n.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else i&&e.items.push({start:s});this.stack.push(o);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let n=e.items[e.items.length-1];switch(this.type){case"newline":if(n.value){let i="end"in n.value?n.value.end:void 0;(Array.isArray(i)?i[i.length-1]:void 0)?.type==="comment"?i?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(n.start,e.indent)){let r=e.items[e.items.length-2]?.value?.end;if(Array.isArray(r)){Ni(r,n.start),r.push(this.sourceToken),e.items.pop();return}}n.start.push(this.sourceToken)}return;case"anchor":case"tag":if(n.value||this.indent<=e.indent)break;n.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;n.value||je(n.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return}if(this.indent>e.indent){let i=this.startBlockValue(e);if(i){this.stack.push(i);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let n=e.items[e.items.length-1];if(this.type==="flow-error-end"){let i;do yield*this.pop(),i=this.peek(1);while(i?.type==="flow-collection")}else if(e.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!n||n.sep?e.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return;case"map-value-ind":!n||n.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):n.sep?n.sep.push(this.sourceToken):Object.assign(n,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!n||n.value?e.items.push({start:[this.sourceToken]}):n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let r=this.flowScalar(this.type);!n||n.value?e.items.push({start:[],key:r,sep:[]}):n.sep?this.stack.push(r):Object.assign(n,{key:r,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}let i=this.startBlockValue(e);i?this.stack.push(i):(yield*this.pop(),yield*this.step())}else{let i=this.peek(2);if(i.type==="block-map"&&(this.type==="map-value-ind"&&i.indent===e.indent||this.type==="newline"&&!i.items[i.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&i.type!=="flow-collection"){let r=Ri(i),s=kt(r);yl(e);let o=e.end.splice(1,e.end.length);o.push(this.sourceToken);let a={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:s,key:e,sep:o}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=a}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let n=this.source.indexOf(`
141
141
  `)+1;for(;n!==0;)this.onNewLine(this.offset+n),n=this.source.indexOf(`
142
- `,n)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let n=Ri(e),i=kt(n);return i.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let n=Ri(e),i=kt(n);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,n){return this.type!=="comment"||this.indent<=n?!1:e.every(i=>i.type==="newline"||i.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};bl.Parser=Js});var xl=v(on=>{"use strict";var kl=Is(),_h=zt(),sn=Zt(),Ph=jr(),Rh=N(),Nh=Vs(),Sl=Hs();function Cl(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new Nh.LineCounter||null,prettyErrors:e}}function Oh(t,e={}){let{lineCounter:n,prettyErrors:i}=Cl(e),r=new Sl.Parser(n?.addNewLine),s=new kl.Composer(e),o=Array.from(s.compose(r.parse(t)));if(i&&n)for(let a of o)a.errors.forEach(sn.prettifyError(t,n)),a.warnings.forEach(sn.prettifyError(t,n));return o.length>0?o:Object.assign([],{empty:!0},s.streamInfo())}function El(t,e={}){let{lineCounter:n,prettyErrors:i}=Cl(e),r=new Sl.Parser(n?.addNewLine),s=new kl.Composer(e),o=null;for(let a of s.compose(r.parse(t),!0,t.length))if(!o)o=a;else if(o.options.logLevel!=="silent"){o.errors.push(new sn.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return i&&n&&(o.errors.forEach(sn.prettifyError(t,n)),o.warnings.forEach(sn.prettifyError(t,n))),o}function Ah(t,e,n){let i;typeof e=="function"?i=e:n===void 0&&e&&typeof e=="object"&&(n=e);let r=El(t,n);if(!r)return null;if(r.warnings.forEach(s=>Ph.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 jh(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 Rh.isDocument(t)&&!i?t.toString(n):new _h.Document(t,i,n).toString(n)}on.parse=Ah;on.parseAllDocuments=Oh;on.parseDocument=El;on.stringify=jh});var Ie=v(O=>{"use strict";var Th=Is(),Ih=zt(),$h=ms(),Gs=Zt(),qh=It(),Te=N(),Lh=Re(),Dh=q(),Fh=Oe(),Mh=Ae(),Wh=_i(),Bh=Ys(),Kh=Vs(),Yh=Hs(),Oi=xl(),_l=Ot();O.Composer=Th.Composer;O.Document=Ih.Document;O.Schema=$h.Schema;O.YAMLError=Gs.YAMLError;O.YAMLParseError=Gs.YAMLParseError;O.YAMLWarning=Gs.YAMLWarning;O.Alias=qh.Alias;O.isAlias=Te.isAlias;O.isCollection=Te.isCollection;O.isDocument=Te.isDocument;O.isMap=Te.isMap;O.isNode=Te.isNode;O.isPair=Te.isPair;O.isScalar=Te.isScalar;O.isSeq=Te.isSeq;O.Pair=Lh.Pair;O.Scalar=Dh.Scalar;O.YAMLMap=Fh.YAMLMap;O.YAMLSeq=Mh.YAMLSeq;O.CST=Wh;O.Lexer=Bh.Lexer;O.LineCounter=Kh.LineCounter;O.Parser=Yh.Parser;O.parse=Oi.parse;O.parseAllDocuments=Oi.parseAllDocuments;O.parseDocument=Oi.parseDocument;O.stringify=Oi.stringify;O.visit=_l.visit;O.visitAsync=_l.visitAsync});var Ai=G(()=>{"use strict"});function $e(t){return t!==0&&t!==0n&&t!=="0"}function ji(t,e){return $e(t.dev)&&$e(e.dev)&&$e(t.ino)&&$e(e.ino)}function ye(t,e){let n=$e(t.dev)&&$e(e.dev);if(n&&t.dev!==e.dev)return!1;let i=$e(t.ino)&&$e(e.ino);return i&&t.ino!==e.ino?!1:n&&i?!0:t.birthtime===e.birthtime}var Ti=G(()=>{"use strict"});import{randomUUID as Uh}from"crypto";import{constants as Vh,promises as L}from"fs";import V from"path";async function zs(t,e){try{return await L.link(t,e),{linked:!0}}catch(n){let i=n.code;if(i!=="ENOTSUP"&&i!=="EOPNOTSUPP")throw n}return await L.copyFile(t,e,Vh.COPYFILE_EXCL),{linked:!1}}function St(t,e){let n=V.relative(t,e);return n===""||!V.isAbsolute(n)&&n!==".."&&!n.startsWith(`..${V.sep}`)}function $i(t){return{dev:t.dev,ino:t.ino,birthtime:t.birthtimeMs}}function Jh(t,e){return ye(t,$i(e))}function Ii(t,e){let n=$i(t),i=$i(e);return ji(n,i)?ye(n,i):ye(n,i)&&t.birthtimeMs===e.birthtimeMs&&t.ctimeMs===e.ctimeMs&&t.size===e.size}async function qi(t){let e=await L.lstat(t);if(!e.isDirectory()||e.isSymbolicLink())throw new Error(`Contained atomic write parent must be a real directory: ${t}`);return{path:t,realPath:await L.realpath(t),...$i(e)}}async function qe(t){for(let e of t){let n=await L.lstat(e.path);if(!n.isDirectory()||n.isSymbolicLink()||!Jh(e,n)||await L.realpath(e.path)!==e.realPath)throw new Error(`Contained atomic write parent changed before commit: ${e.path}`)}}async function Hh(t,e){let n=V.resolve(t),i=V.resolve(e);if(!St(n,i))throw new Error(`Contained atomic write parent is outside its managed root: ${e}`);let r=[await qi(n)],s=V.relative(n,i).split(V.sep).filter(Boolean),o=n;for(let a of s){await qe(r),o=V.join(o,a);try{await L.mkdir(o)}catch(l){if(l.code!=="EEXIST")throw l}let c=await qi(o);if(!St(r[0].realPath,c.realPath))throw new Error(`Contained atomic write parent resolves outside its managed root: ${o}`);r.push(c)}return await qe(r),r}async function Gh(t,e){let n=V.resolve(t),i=V.resolve(e);if(!St(n,i))throw new Error(`Contained file parent is outside its managed root: ${e}`);let r=[await qi(n)],s=V.relative(n,i).split(V.sep).filter(Boolean),o=n;for(let a of s){o=V.join(o,a);try{let c=await qi(o);if(!St(r[0].realPath,c.realPath))throw new Error(`Contained file parent resolves outside its managed root: ${o}`);r.push(c)}catch(c){if(c.code==="ENOENT")return null;throw c}}return await qe(r),r}async function Pl(t){let e;try{e=await L.open(t,"r"),await e.sync()}catch(n){let i=n.code;if(!["EACCES","EBADF","EINVAL","EISDIR","ENOTSUP","EPERM"].includes(i??""))throw n}finally{await e?.close()}}async function zh(t,e,n){let i=V.dirname(t),r=await Hh(n.containedRoot,i),s=V.join(i,`.${V.basename(t)}.${Uh()}.tmp`),o,a;try{await n.beforeTemporaryOpen?.(),o=await L.open(s,"wx"),a=await o.stat();let[c,l]=await Promise.all([L.lstat(s),L.realpath(s)]);if(await qe(r),!c.isFile()||c.isSymbolicLink()||!Ii(a,c)||!St(r[0].realPath,l))throw new Error("Contained atomic write temporary file opened outside its managed parent");if(typeof e=="string"?await o.writeFile(e,"utf8"):await o.writeFile(e),await o.sync(),!Ii(a,await o.stat()))throw new Error("Contained atomic write temporary file changed while writing");await o.close(),o=void 0,await n.beforeCommit?.(),await qe(r);let f=await L.lstat(s);if(!f.isFile()||f.isSymbolicLink()||!Ii(f,a))throw new Error("Contained atomic write temporary file changed before commit");n.exclusive?(await zs(s,t),await L.unlink(s)):await L.rename(s,t),await Pl(i)}catch(c){await o?.close();try{await qe(r),await L.rm(s,{force:!0})}catch{}throw c}}async function me(t,e,n){await zh(t,e,n)}async function Qs(t,e){let n=V.dirname(t),i=await Gh(e.containedRoot,n);if(!i)return!1;let r,s;try{r=await L.lstat(t),s=await L.realpath(t)}catch(c){if(c.code==="ENOENT")return!1;throw c}if(!r.isFile()||r.isSymbolicLink()||!St(i[0].realPath,s))throw new Error("Contained file removal target must be a regular file inside its managed root");await e.beforeRemove?.(),await qe(i);let[o,a]=await Promise.all([L.lstat(t),L.realpath(t)]);if(!o.isFile()||o.isSymbolicLink()||!Ii(r,o)||a!==s)throw new Error("Contained file removal target changed before removal");return await L.unlink(t),await qe(i),await Pl(n),!0}var Ze=G(()=>{"use strict";Ti()});var Rl=G(()=>{"use strict"});var Xs=G(()=>{"use strict";Ai()});var Nl=G(()=>{"use strict";Ai();Xs()});import Li from"path";function ig(t,e){if(typeof t!="string")throw new Error(`${e} must be a string`);let n=t.trim();if(n.length===0||Li.posix.isAbsolute(n)||Li.win32.isAbsolute(n)||/^(?:~|[\\/])/u.test(n))throw new Error(`${e} must be a project-relative path`);if(n===".")return[];let i=n.replaceAll("\\","/").split("/");if(i.some(r=>r===".."))throw new Error(`${e} must stay inside the project root`);if(i.some(r=>r===""||r==="."))throw new Error(`${e} must not contain empty or dot path segments`);return i}function an(t){let e=ig(t,"native.artifact_root");return e.length===0?".":e.join("/")}function jl(t,e="docs"){let n=t??e;if(n!=="legacy"&&n!=="docs")throw new Error("classic.artifact_layout must be legacy or docs");return n}function et(t,e,n=!1){if(typeof t!="string")throw new Error(`${e} must be a string`);let i=t.trim().replaceAll("\\","/");if(i.length===0||Li.posix.isAbsolute(i)||Li.win32.isAbsolute(i)||/^(?:~|[\\/])/u.test(i))throw new Error(`${e} must be relative to its declared path base`);let r=i.split("/");if(r.some(s=>s===".."))throw new Error(`${e} must stay inside its declared path base`);if(r.some(s=>s===""||s==="."))throw new Error(`${e} must not contain empty or dot path segments`);if(!n&&/[*?]/u.test(i))throw new Error(`${e} cannot contain wildcards`);return r.join("/")}function cn(t,e){if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`${e} must be a mapping`);return t}function Tl(t,e,n){let i=t??e;if(i!=="en"&&i!=="zh-CN")throw new Error(`${n} must be en or zh-CN`);return i}function Il(t,e){if(typeof t!="string"||t.length===0||t.includes("\\")||t.includes("\0")||t.startsWith("/")||t.split("/").includes(".."))throw new Error(`${e} contains an unsafe pattern`);if(t.length>eo)throw new Error(`${e} exceeds ${eo} 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>to)throw new Error(`${e} contains more than ${to} wildcard tokens`);return t}function Ol(t,e,n){if(t===void 0)return[...n];if(!Array.isArray(t))throw new Error(`${e} contains an unsafe pattern`);return[...new Set(t.map(i=>Il(i,e)))].sort((i,r)=>i.localeCompare(r,"en"))}function Zs(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 rg(t){if(t===void 0)return{...se,include:[...se.include],exclude:[...se.exclude]};let e=cn(t,"native.snapshot");return{include:Ol(e.include,"native.snapshot.include",se.include),exclude:Ol(e.exclude,"native.snapshot.exclude",se.exclude),max_files:Zs(e.max_files,se.max_files,"native.snapshot.max_files"),max_total_bytes:Zs(e.max_total_bytes,se.max_total_bytes,"native.snapshot.max_total_bytes"),max_duration_ms:Zs(e.max_duration_ms,se.max_duration_ms,"native.snapshot.max_duration_ms")}}function sg(t){if(t===void 0)return;let e=cn(t,"native.pending_root_move"),n=e.id,i=e.from_artifact_root,r=e.to_artifact_root,s=e.stage;if(typeof n!="string"||!/^[a-f0-9-]{8,}$/u.test(n))throw new Error("native.pending_root_move.id is invalid");if(typeof i!="string"||typeof r!="string")throw new Error("native.pending_root_move roots must be strings");if(s!=="copying"&&s!=="ready"&&s!=="switched")throw new Error("native.pending_root_move.stage is invalid");let o;if(e.cleanup!==void 0){let a=cn(e.cleanup,"native.pending_root_move.cleanup"),c=a.kind,l=a.state,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:an(i),toArtifactRoot:an(r),stage:s,...o?{cleanup:o}:{}}}function og(t,e={}){let n=cn(t,"native"),i=n.artifact_root??(e.allowMissingArtifactRoot?"docs":void 0);if(typeof i!="string")throw new Error("native.artifact_root must be a string");let r=n.clarification_mode??"sequential";if(r!=="sequential"&&r!=="batch")throw new Error("native.clarification_mode must be sequential or batch");let s=n.archive_confirmation??"automatic";if(s!=="automatic"&&s!=="required")throw new Error("native.archive_confirmation must be automatic or required");let o=n.max_verify_failures??Al;if(!Number.isSafeInteger(o)||o<1)throw new Error("native.max_verify_failures must be a positive integer");let a=sg(n.pending_root_move);return{artifact_root:an(i),language:Tl(n.language,"en","native.language"),clarification_mode:r,archive_confirmation:s,max_verify_failures:o,snapshot:rg(n.snapshot),...a?{pending_root_move:a}:{}}}function ag(t){let e=cn(t,"classic"),n=e.context_compression??"off";if(n!=="off"&&n!=="beta")throw new Error("classic.context_compression must be off or beta");let i=e.review_mode??"standard";if(i!=="off"&&i!=="standard"&&i!=="thorough")throw new Error("classic.review_mode must be off, standard, or thorough");let r=e.auto_transition??!0;if(typeof r!="boolean")throw new Error("classic.auto_transition must be true or false");return{artifact_layout:jl(e.artifact_layout),language:Tl(e.language,"zh-CN","classic.language"),context_compression:n,review_mode:i,auto_transition:r}}function cg(t){let e=t??!0;if(typeof e!="boolean")throw new Error("ambient_resume must be true or false");return e}function lg(t,e,n,i,r){let s=t.schema!==void 0;if(!(s||t.default_workflow!==void 0||t.workflows!==void 0||!r.allowPartialProject&&t.native!==void 0)||r.allowPartialProject&&!s)return null;if(t.schema!=="comet.project.v1")throw new Error("Unsupported Comet project schema");if(t.default_workflow!=="native"&&t.default_workflow!=="classic")throw new Error("default_workflow must be native or classic");let a=t.workflows??[t.default_workflow];if(!Array.isArray(a)||a.length===0||a.some(l=>l!=="native"&&l!=="classic"))throw new Error("workflows must contain native and/or classic");let c=[...new Set(a)];if(!c.includes(t.default_workflow))throw new Error("workflows must include default_workflow");if(c.includes("native")&&!e)throw new Error("native must be a mapping");return{schema:"comet.project.v1",default_workflow:t.default_workflow,workflows:c,ambient_resume:i,...e?{native:e}:{},...n?{classic:n}:{}}}function Le(t,e={}){let n=(0,no.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=cg(r.ambient_resume),o=r.native===void 0?void 0:og(r.native,{allowMissingArtifactRoot:e.allowMissingNativeFields}),a=r.classic===void 0?void 0:ag(r.classic),c=lg(r,o,a,s,{allowPartialProject:e.allowPartialProject??!1});return{value:r,config:c,ambient_resume:s,...o?{native:o}:{},...a?{classic:a}:{}}}function io(t="docs",e="en"){return{schema:"comet.project.v1",default_workflow:"native",ambient_resume:!0,native:{artifact_root:an(t),language:e,clarification_mode:"sequential",archive_confirmation:"automatic",max_verify_failures:Al,snapshot:{...se,include:[...se.include],exclude:[...se.exclude]}}}}var no,Ct,eo,to,Al,ng,se,ve=G(()=>{"use strict";no=Ve(Ie(),1),Ct=64*1024,eo=1024,to=64,Al=5,ng=[".agents/skills/**",".amazonq/skills/**",".augment/skills/**",".bob/skills/**",".claude/skills/**",".cline/skills/**",".codebuddy/skills/**",".continue/skills/**",".cospec/skills/**",".crush/skills/**",".cursor/skills/**",".factory/skills/**",".forge/skills/**",".gemini/skills/**",".github/skills/**",".iflow/skills/**",".junie/skills/**",".kilocode/skills/**",".kimi-code/skills/**",".kiro/skills/**",".lingma/skills/**",".mimocode/skills/**",".opencode/skills/**",".pi/skills/**",".qoder/skills/**",".qwen/skills/**",".roo/skills/**",".trae-cn/skills/**",".trae/skills/**",".windsurf/skills/**",".zcode/skills/**"],se={include:["**/*"],exclude:[...ng],max_files:1e4,max_total_bytes:256*1024*1024,max_duration_ms:6e4}});import{constants as Di,promises as tt}from"fs";function ro(t){return"birthtimeNs"in t&&typeof t.birthtimeNs=="bigint"?t.birthtimeNs:t.birthtimeMs}function $l(t){return"ctimeNs"in t&&typeof t.ctimeNs=="bigint"?t.ctimeNs:t.ctimeMs}function ln(t){return{dev:t.dev,ino:t.ino,birthtime:ro(t)}}function Fi(t,e){let n=ln(t),i=ln(e);return ji(n,i)?ye(n,i):ye(n,i)&&ro(t)===ro(e)&&$l(t)===$l(e)&&t.size===e.size}async function ql(t,e,n={}){if(!Number.isSafeInteger(e)||e<1)throw new Error("race-safe read byte limit must be a positive integer");let i=n.label??"file",r=n.bigint===!0,s=await 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"?Di.O_RDONLY:Di.O_RDONLY|Di.O_NOFOLLOW|Di.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||!Fi(s,l)||!Fi(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=[],h=0,w=Buffer.allocUnsafe(Math.min(64*1024,e+1));for(;;){let y=e+1-h,{bytesRead:k}=await c.read(w,0,Math.min(w.length,y),null);if(k===0)break;if(h+=k,h>e)throw new De("too-large",`${i} exceeds ${e} bytes`);d.push(Buffer.from(w.subarray(0,k)))}await n.hooks?.beforeFinalCheck?.();let[p,m,g]=await Promise.all([c.stat({bigint:r}),tt.lstat(t,{bigint:r}),tt.realpath(t)]);if(!m.isFile()||m.isSymbolicLink()||g!==o||!Fi(s,p)||!Fi(s,m))throw new De("changed",`${i} changed while reading`);return await n.verify?.("post-read",{realPath:g,identity:ln(p)}),{bytes:Buffer.concat(d,h),stat:p,realPath:g}}finally{await c.close()}}var De,Ll=G(()=>{"use strict";Ti();De=class extends Error{reason;constructor(e,n,i){super(n,i),this.name="RaceSafeReadError",this.reason=e}}});import{promises as Mi}from"fs";import Fe from"path";function ug(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}function so(t,e){let n=Fe.relative(t,e);return n===""||!Fe.isAbsolute(n)&&n!==".."&&!n.startsWith(`..${Fe.sep}`)}async function Dl(t,e){let n=Fe.resolve(t),i=await Mi.lstat(n);if(!i.isDirectory()||i.isSymbolicLink())throw new Error(`${e} project root must be a real directory`);return Mi.realpath(n)}async function Fl(t,e,n,i){let r=t;for(let s=0;s<n.length;s++){r=Fe.join(r,n[s]);let o;try{o=await Mi.lstat(r)}catch(f){if(ug(f))return{exists:!1,kind:"missing"};throw f}let a=Fe.relative(t,r).replaceAll("\\","/");if(o.isSymbolicLink())throw new Error(`${i.label} crosses a symbolic link or junction at ${a}`);let c=s===n.length-1;if(!c&&!o.isDirectory())throw new Error(`${i.label} ancestor ${a} must be a real directory`);if(c&&(i.expected==="file"&&!o.isFile()||i.expected==="directory"&&!o.isDirectory()||i.expected==="any"&&!o.isFile()&&!o.isDirectory()))throw new Error(`${i.label} must be a real ${i.expected}`);let l=await Mi.realpath(r);if(!so(e,l))throw new Error(`${i.label} resolves outside the project root`);if(c)return{exists:!0,kind:o.isFile()?"file":o.isDirectory()?"directory":"missing"}}return{exists:!0,kind:"directory"}}async function D(t,e,n){let i=et(e,n.label),r=Fe.resolve(t),s=await Dl(r,n.label),o=i.split("/"),a=Fe.resolve(r,...o);if(!so(r,a))throw new Error(`${n.label} must stay inside the project root`);let c=await Fl(r,s,o,n);return{projectRoot:r,target:a,relative:i,exists:c.exists,kind:c.kind}}async function Wi(t,e,n){return(await D(t,e,{...n,expected:"file"})).exists}async function J(t,e,n,i){let r=await D(t,e,{label:i.label,expected:"file"});if(!r.exists){let o=new Error(`${i.label} does not exist`);throw o.code="ENOENT",o}let s=await Dl(r.projectRoot,i.label);return ql(r.target,n,{...i,verify:async(o,a)=>{if(!so(s,a.realPath))throw new Error(`${i.label} resolves outside the project root`);await Fl(r.projectRoot,s,r.relative.split("/"),{label:i.label,expected:"file"})}})}var le=G(()=>{"use strict";Ll();ve()});function fg(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}function dg(t){let e=(0,Wl.parseDocument)(t,{uniqueKeys:!0});if(e.errors.length>0)throw new Error(`Invalid global Comet config: ${e.errors[0].message}`);let n=e.toJS();if(n==null)return{};if(typeof n!="object"||Array.isArray(n))throw new Error("Invalid global Comet config: root must be a mapping");return n}function Kl(t){if(t.native?.pending_root_move)throw new Error("Global Comet config cannot contain native.pending_root_move");let e=t.native?(({pending_root_move:n,...i})=>i)(t.native):void 0;return{...t,schema:"comet.global.v1",...e?{native:e}:{}}}function pg(t){let e=Le(JSON.stringify({...t,schema:"comet.project.v1"})).config;if(!e)throw new Error("Invalid global Comet config: workflow template is incomplete");return Kl(e)}function mg(t){let e=Le(t,{allowPartialProject:!0,allowMissingNativeFields:!0});if(!e.native&&!e.classic)return null;let n=e.native?"native":"classic",i=e.native?.language??e.classic?.language??"en",r=io(e.native?.artifact_root??"docs",i);return{schema:"comet.global.v1",default_workflow:n,workflows:[n],ambient_resume:e.ambient_resume,...e.native?{native:{...r.native,...e.native}}:{},...e.classic?{classic:e.classic}:{}}}function Yl(t){let e=dg(t);if(Object.keys(e).length===0)return null;if(e.schema===void 0)return mg(t);if(e.schema!=="comet.global.v1")throw new Error("Unsupported Comet global schema");return pg(e)}async function ao(t){try{let e=await J(t,Bl,Ct,{label:"global Comet config"});return Yl(e.bytes.toString("utf8"))}catch(e){if(fg(e))return null;throw e}}var Wl,Bl,co=G(()=>{"use strict";Wl=Ve(Ie(),1);Ze();ve();le();Bl=".comet/config.yaml"});import{createHash as hg}from"crypto";function gg(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}async function Me(t,e={}){return(await Bi(t,e)).document}async function wg(t){try{return(await J(t,un,Ct,{label:un})).bytes}catch(e){if(gg(e))return null;throw e}}function yg(t){return t?{exists:!0,sha256:hg("sha256").update(t).digest("hex")}:{exists:!1,sha256:null}}async function Bi(t,e={}){let n=await wg(t);return{document:n?Le(n.toString("utf8"),e):null,identity:yg(n)}}var un,nt=G(()=>{"use strict";ve();le();un=".comet/config.yaml"});var Nk,lo=G(()=>{"use strict";Ze();nt();le();Nk=16*1024});var uo=G(()=>{"use strict";Ze();ve();nt();le();lo()});var Vl=G(()=>{"use strict";Ai();Ze();Rl();Nl();ve();co();le();nt();uo();lo();Xs()});import{TextDecoder as Eg}from"util";function Jl(t){return{dev:t.dev,ino:t.ino,birthtime:t.birthtimeMs}}function xg(t,e){try{return new Eg("utf-8",{fatal:!0}).decode(t.bytes)}catch(n){throw new Error(`${e} is not valid UTF-8`,{cause:n})}}async function fo(t,e,n,i,r={}){try{let s=await J(t,e,n,{label:i,hooks:r.hooks});return{result:s,text:xg(s,i)}}catch(s){let o=s.code;if(o==="ENOENT"||o==="ENOTDIR")return null;throw s}}async function fn(t,e,n,i,r={}){return(await fo(t,e,n,i,r))?.text??null}async function it(t,e,n,i,r,s={}){if(Buffer.byteLength(n,"utf8")>i)throw new Error(`${r} exceeds ${i} bytes`);let o=await fo(t,e,i,r),a=await D(t,e,{label:r,expected:"file"});await me(a.target,n,{containedRoot:a.projectRoot,beforeCommit:async()=>{await s.beforeCommit?.();let c=await fo(t,e,i,r);if(!(!o&&!c)){if(!o||!c)throw new Error(`${r} changed before commit`);if(o.result.realPath!==c.result.realPath||!ye(Jl(o.result.stat),Jl(c.result.stat))||o.text!==c.text)throw new Error(`${r} changed before commit`)}}})}async function Ki(t,e,n,i,r,s={}){let o=await fn(t,e,i,r);await it(t,e,`${o??""}${n}`,i,r,s)}async function po(t,e,n,i={}){let r=await D(t,e,{label:n,expected:"file"});return r.exists?Qs(r.target,{containedRoot:r.projectRoot,beforeRemove:i.beforeRemove}):!1}var Yi=G(()=>{"use strict";Vl();Ti()});var au={};gf(au,{RUN_STATE_FILE:()=>Zi,applyRunStateToDocument:()=>yo,readRunState:()=>vo,removeRunState:()=>bo,runStateFromDocument:()=>Xi,writeRunState:()=>er});import Zg from"path";function En(t,e){let n=t[e];if(typeof n!="string"||n.length===0)throw new Error(`Invalid Run state: ${e} must be a non-empty string`);return n}function Cn(t,e){let n=En(t,e);if(Zg.isAbsolute(n)||/^(?:[A-Za-z]:|[\\/]|~)/u.test(n)||n.split(/[\\/]/u).includes(".."))throw new Error(`Invalid Run state: ${e} must stay inside the change directory`);return n}function ew(t){let e=t.run_retries??"{}",n;try{n=typeof e=="string"?JSON.parse(e):e}catch(i){throw new Error("Invalid Run state: run_retries must be a JSON object",{cause:i})}if(!n||typeof n!="object"||Array.isArray(n))throw new Error("Invalid Run state: run_retries must be a JSON object");for(let i of Object.values(n))if(!Number.isInteger(i)||Number(i)<0)throw new Error("Invalid Run state: retry counts must be non-negative integers");return n}function Xi(t){if(!t.run_id)return null;let e=En(t,"run_id"),n=En(t,"skill"),i=En(t,"skill_version"),r=En(t,"skill_hash"),s=Cn(t,"pending_ref"),o=Cn(t,"trajectory_ref"),a=Cn(t,"context_ref"),c=Cn(t,"artifacts_ref"),l=Cn(t,"checkpoint_ref"),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:su(t,"current_step"),iteration:f,pending:su(t,"pending"),pendingRef:s,trajectoryRef:o,contextRef:a,artifactsRef:c,checkpointRef:l,status:t.run_status,retries:ew(t)}}function yo(t,e){e?t.run_id=e.runId:delete t.run_id}function tw(t){return{runId:t.runId,skill:t.skill,skillVersion:t.skillVersion,skillHash:t.skillHash,orchestration:t.orchestration,currentStep:t.currentStep,iteration:t.iteration,pending:t.pending,pendingRef:t.pendingRef,trajectoryRef:t.trajectoryRef,contextRef:t.contextRef,artifactsRef:t.artifactsRef,checkpointRef:t.checkpointRef,status:t.status,retries:t.retries}}function nw(t){let e={run_id:t.runId,skill:t.skill,skill_version:t.skillVersion,skill_hash:t.skillHash,orchestration:t.orchestration,current_step:t.currentStep,iteration:t.iteration,pending:t.pending,pending_ref:t.pendingRef,trajectory_ref:t.trajectoryRef,context_ref:t.contextRef,artifacts_ref:t.artifactsRef,checkpoint_ref:t.checkpointRef,run_status:t.status,run_retries:JSON.stringify(t.retries)};return Xi(e)}async function vo(t,e={}){let n=await fn(t,Zi,ou,"Run state",e);if(n===null)return null;let i=JSON.parse(n);return nw(i)}async function er(t,e,n={}){await it(t,Zi,JSON.stringify(tw(e),null,2),ou,"Run state",n)}async function bo(t,e={}){await po(t,Zi,"Run state",e)}var su,Zi,ou,tr=G(()=>{"use strict";Yi();su=(t,e)=>{let n=t[e];return n==null?null:String(n)};Zi=".comet/run-state.json",ou=256*1024});var sf=Ve(Ie(),1);import{spawnSync as $y}from"child_process";import{createHash as rf}from"crypto";import{promises as qy}from"fs";import T from"path";import Ji from"path";Yi();import Ui from"path";var dn={trajectory:8*1024*1024,artifacts:1024*1024,context:1024*1024,pendingAction:256*1024,checkpoint:256*1024};function pn(t,e){if(Ui.isAbsolute(e))throw new Error("Run path must stay inside the change directory");let n=Ui.resolve(t),i=Ui.resolve(n,e);if(i!==n&&!i.startsWith(n+Ui.sep))throw new Error("Run path must stay inside the change directory")}async function mn(t,e,n,i={}){pn(t,e),await Ki(t,e,`${JSON.stringify(n)}
143
- `,dn.trajectory,"Run trajectory",i)}async function Vi(t,e,n={}){pn(t,e);let i=await fn(t,e,dn.trajectory,"Run trajectory",n);return i===null?[]:i.split(/\r?\n/).map((r,s)=>({line:r,number:s+1})).filter(({line:r})=>r.length>0).map(({line:r,number:s})=>{try{return JSON.parse(r)}catch(o){throw new Error(`Invalid Trajectory event at line ${s}`,{cause:o})}})}async function Hl(t,e,n,i={}){pn(t,e),await it(t,e,JSON.stringify(n,null,2)+`
144
- `,dn.artifacts,"Run artifacts",i)}async function Gl(t,e,n,i={}){pn(t,e),await it(t,e,n,dn.context,"Run context",i)}async function zl(t,e,n,i={}){pn(t,e),await it(t,e,JSON.stringify(n,null,2)+`
145
- `,dn.checkpoint,"Run checkpoint",i)}function _g(t){if(t!=="build"&&t!=="verify")throw new Error(`Invalid command check scope: '${String(t)}'`)}function Pg(t,e="."){if(e.trim().length===0)throw new Error("Command check cwd cannot be blank");let n=Ji.resolve(t),i=Ji.resolve(n,e);if(i!==n&&!i.startsWith(n+Ji.sep))throw new Error(`Command check cwd must resolve within the project root: '${e}'`);return Ji.relative(n,i).replaceAll("\\","/")||"."}function Rg(t,e){if(e.type!=="command_check_recorded")return null;let n=e.data;if(typeof n!="object"||n===null||Array.isArray(n))return null;let{scope:i,command:r,exitCode:s,cwd:o}=n;if(i!=="build"&&i!=="verify"||typeof r!="string"||r.trim().length===0||!Number.isInteger(s)||typeof o!="string")return null;let a;try{a=Pg(t,o)}catch{return null}return{sequence:e.sequence,timestamp:e.timestamp,runId:e.runId,scope:i,command:r,exitCode:s,cwd:a}}async function Ql(t,e,n,i){_g(i);let r=await Vi(e,n.trajectoryRef);for(let s=r.length-1;s>=0;s-=1){let o=r[s];if(o.runId!==n.runId)continue;let a=Rg(t,o);if(a?.scope===i)return a}return null}import{promises as Kg}from"fs";import be from"path";import{promises as Ag}from"fs";import $ from"path";import{promises as Ng}from"fs";async function hn(t){try{return await Ng.access(t),!0}catch(e){if(Og(e))return!1;throw e}}function Og(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}ve();nt();uo();le();var gn=class extends Error{code="classic-layout-unavailable";constructor(e="Classic artifact layout is unavailable from .comet/config.yaml"){super(e),this.name="ClassicLayoutUnavailableError"}},mo=class extends Error{constructor(n,i,r){let s=z(r,n),o=z(r,i);super(`Classic layout conflict: both ${s}/ and ${o}/ exist; run comet doctor and resolve the conflict before writing`);this.configuredRoot=n;this.alternateRoot=i;this.name="ClassicLayoutConflictError"}configuredRoot;alternateRoot;code="classic-layout-conflict"},Xl=".comet/config.yaml";function jg(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}async function Zl(t){await D(t,Xl,{label:Xl,expected:"file"})}function eu(t,e){let n=$.resolve(t),i=e==="docs"?$.join(n,"docs"):n,r=$.join(i,"openspec"),s=$.join(n,"docs","superpowers");return{projectRoot:n,artifactLayout:e,openSpecBase:i,openSpecRoot:r,changesDir:$.join(r,"changes"),archiveDir:$.join(r,"changes","archive"),specsDir:$.join(r,"specs"),superpowersRoot:s,superpowersSpecsDir:$.join(s,"specs"),superpowersPlansDir:$.join(s,"plans"),superpowersReportsDir:$.join(s,"reports")}}async function Tg(t){await Zl(t);let e=await Me(t,{allowPartialProject:!0,allowMissingNativeFields:!0});if(!e?.config)throw new gn;if(!(e.config.workflows??[e.config.default_workflow]).includes("classic"))throw new gn("Classic artifact layout is unavailable because Classic is not enabled");return e.classic?.artifact_layout??"legacy"}async function Ig(t,e){return eu(t,e??await Tg(t))}async function $g(t,e){let n=await Ig(t,e),i=n.artifactLayout==="legacy"?"docs":"legacy",r=eu(t,i).openSpecRoot,[s,o]=await Promise.all([D(n.projectRoot,z(n.projectRoot,n.openSpecRoot),{label:"Configured Classic OpenSpec root",expected:"directory"}),D(n.projectRoot,z(n.projectRoot,r),{label:"Alternate Classic OpenSpec root",expected:"directory"})]),a=s.exists,c=o.exists;return{paths:n,configuredRootExists:a,alternateRoot:r,alternateRootExists:c,dualRoots:a&&c}}async function qg(t,e){let n=[t.openSpecRoot,t.changesDir,t.archiveDir,t.specsDir,e,t.superpowersRoot,t.superpowersSpecsDir,t.superpowersPlansDir,t.superpowersReportsDir];for(let i of n){let r=z(t.projectRoot,i);await D(t.projectRoot,r,{label:`Classic managed physical path ${r}`,expected:"directory"})}}async function rt(t,e,n={}){let i=await $g(t,e);if(await qg(i.paths,i.alternateRoot),i.dualRoots&&!n.allowAlternateRoot)throw new mo(i.paths.openSpecRoot,i.alternateRoot,i.paths.projectRoot);if(!i.configuredRootExists){let r=z(i.paths.projectRoot,i.paths.openSpecRoot),s=z(i.paths.projectRoot,i.alternateRoot);throw new gn(`Configured Classic OpenSpec root is missing: ${r} (alternate ${s} is ${i.alternateRootExists?"present":"missing"})`)}return i.paths}async function ho(t,e,n={}){let i=$.join($.resolve(t),".comet","classic-root-move.json");if(await hn(i))throw new Error("Classic root move transaction is incomplete; inspect it with comet doctor and recover it explicitly before writing");let r=await rt(t,e,n);if(!await hn(r.openSpecRoot))throw new Error(`Configured Classic OpenSpec root is missing: ${z(r.projectRoot,r.openSpecRoot)}`);return r}async function st(t){let e=$.resolve(t),n=null;try{(await Ag.lstat(e)).isDirectory()||(e=$.dirname(e))}catch(i){if(!jg(i))throw i}for(;;){$.basename(e)==="openspec"&&(n=$.dirname(e));let i=$.join(e,".comet","config.yaml"),r=!1;if(await hn(i))try{await Zl(e);let o=(await Me(e))?.value;r=!!o&&typeof o=="object"&&!Array.isArray(o)&&(o.schema==="comet.project.v1"||o.default_workflow!==void 0||o.native!==void 0)}catch{}if(r||await hn($.join(e,".git")))return e;let s=$.dirname(e);if(s===e)return n??$.resolve(t);e=s}}function z(t,e){return $.relative($.resolve(t),e).replaceAll("\\","/")}le();ve();import bn from"path";import{promises as Dg}from"fs";import Gi from"path";Ze();ve();le();import wn from"path";var Lg=2*1024*1024;function tu(t,e,n){let i=wn.resolve(t),r=wn.isAbsolute(e)?wn.resolve(e):wn.resolve(i,e),s=wn.relative(i,r).replaceAll("\\","/");return{root:i,relative:et(s,n),target:r}}async function We(t,e,n){let i=tu(t,e,n.label);return D(i.root,i.relative,n)}async function yn(t,e,n){return(await We(t,e,{label:n.label,expected:n.expected??"any"})).exists}async function nu(t,e,n,i){return await yn(t,e,{label:n,expected:"file"})?(await Hi(t,e,{label:n,hooks:i})).byteLength>0:!1}async function te(t,e,n){return(await Hi(t,e,n)).toString("utf8")}async function Hi(t,e,n){let i=tu(t,e,n.label);return(await J(i.root,i.relative,n.maxBytes??Lg,{label:n.label,hooks:n.hooks})).bytes}function vn(t){return t?/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u.test(t)?t.includes("..")?"Change name cannot contain '..' (path traversal not allowed)":null:`Invalid change name: '${t}'
146
- Valid format: lowercase kebab-case (a-z, 0-9, single hyphens)`:"Change name cannot be empty"}function wo(t){let e=vn(t);if(e)throw new Error(e)}function Fg(t,e){return{label:z(t,e),directory:e}}async function go(t,e,n){let i=Fg(t,e);if(!(await We(t,e,{label:n,expected:"directory"})).exists)return{change:i,exists:!1,stateExists:!1};let s=await We(t,Gi.join(e,".comet.yaml"),{label:`${n} state`,expected:"file"});return{change:i,exists:!0,stateExists:s.exists}}function Mg(t,e){let n=e.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&");return new RegExp(`^\\d{4}-\\d{2}-\\d{2}-${n}$`,"u").test(t)}async function Wg(t,e,n,i={}){if(!i.skipExactCompatibility){let o=await go(t,Gi.join(e,n),`Classic archived change ${n}`);if(o.exists)return o.change}if(!(await We(t,e,{label:"Classic archive directory",expected:"directory"})).exists)return null;let s=[];for(let o of await Dg.readdir(e,{withFileTypes:!0})){if(!Mg(o.name,n))continue;let a=await go(t,Gi.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 zi(t,e=process.cwd()){wo(t);let n=await rt(e),i=await go(n.projectRoot,Gi.join(n.changesDir,t),`Classic active change ${t}`);if(i.exists)return i.change;let r=await Wg(n.projectRoot,n.archiveDir,t);return r||i.change}function Bg(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}async function iu(t,e,n,i){let r=et(n,"Classic handoff artifact pointer");if((await D(t,r,{label:"Classic handoff artifact",expected:"file"})).exists)return null;let o=await rt(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];wo(u);let d=f.slice(2),h=bn.resolve(e);if(bn.dirname(h)!==bn.resolve(o.archiveDir))return null;let w=bn.basename(h),p=/^\d{4}-\d{2}-\d{2}-(.+)$/u.exec(w);if(w!==u&&p?.[1]!==u)return null;await D(t,z(t,h),{label:"Classic archived change directory",expected:"directory"});let m=bn.join(h,".comet",...d),g=z(t,m);try{return await J(t,g,i,{label:"Historical Classic archived handoff artifact"}),g}catch(y){if(Bg(y))return null;throw y}}le();var ru=2*1024*1024;function kn(t,e){return be.relative(t,e).split(be.sep).join("/")}async function Sn(t,e,n){if(!n)return{code:e,satisfied:!1};let i=n.replaceAll("\\","/");try{let r=await Wi(t,i,{label:`${e} artifact`});return{code:e,satisfied:r,source:i,...r?{resolvedSource:i}:{}}}catch(r){return{code:e,satisfied:!1,source:i,detail:`unsafe artifact pointer outside the project or through a special path: ${r instanceof Error?r.message:String(r)}`}}}async function Yg(t,e,n){try{await rt(t)}catch(r){return{code:"design.handoff",satisfied:!1,...n?{source:n.replaceAll("\\","/")}:{},detail:`Classic layout is unsafe or unavailable for handoff evidence: ${r instanceof Error?r.message:String(r)}`}}let i=await Sn(t,"design.handoff",n);if(!n||i.satisfied||i.detail)return i;try{let r=await iu(t,e,n,ru);return r?{...i,satisfied:!0,resolvedSource:r,detail:`resolved historical legacy pointer from archived change: ${r}`}:i}catch(r){return{...i,satisfied:!1,detail:`unsafe archived handoff fallback: ${r instanceof Error?r.message:String(r)}`}}}async function Qi(t,e,n){return Sn(t,e,kn(t,n))}async function Ug(t,e){let n=be.join(e,"specs"),i;try{let o=kn(t,n);if(!(await D(t,o,{label:"OpenSpec delta-spec directory",expected:"directory"})).exists)return{code:"openspec.delta-spec",satisfied:!1};i=await Kg.readdir(n)}catch(o){return o.code==="ENOENT"?{code:"openspec.delta-spec",satisfied:!1}:{code:"openspec.delta-spec",satisfied:!1,detail:`unsafe delta-spec path: ${o instanceof Error?o.message:String(o)}`}}let r=i.map(o=>be.join(n,o,"spec.md")),s=(await Promise.all(r.map(async o=>{try{return await Wi(t,kn(t,o),{label:"OpenSpec delta spec"})?o:null}catch{return null}}))).filter(o=>o!==null);return{code:"openspec.delta-spec",satisfied:s.length>0,source:s[0]?kn(t,s[0]):void 0,detail:`${s.length} delta spec${s.length===1?"":"s"}`}}async function Vg(t,e){let n,i=kn(t,e);try{n=(await J(t,i,ru,{label:"Classic tasks artifact"})).bytes.toString("utf8")}catch(o){return o.code==="ENOENT"?{code:"build.tasks-complete",satisfied:!1}:{code:"build.tasks-complete",satisfied:!1,source:i,detail:`unsafe tasks artifact: ${o instanceof Error?o.message:String(o)}`}}let r=[...n.matchAll(/^\s*[-*]\s+\[([ xX])\]\s+/gmu)],s=r.filter(o=>o[1].toLowerCase()==="x").length;return{code:"build.tasks-complete",satisfied:r.length>0&&s===r.length,source:i,detail:`${s} of ${r.length} tasks complete`}}function ot(t,e){return t.some(n=>n.code===e&&n.satisfied)}async function Be(t,e){let n=await st(t),i=e.classic,r=be.join(t,"proposal.md"),s=be.join(t,"design.md"),o=be.join(t,"tasks.md"),a=e.run?be.resolve(t,e.run.checkpointRef):be.join(t,".comet","checkpoint.json"),c=await Promise.all([Qi(n,"openspec.proposal",r),Qi(n,"openspec.design",s),Qi(n,"openspec.tasks",o),Ug(n,t),Sn(n,"design.document",i?.designDoc??null),Sn(n,"build.plan",i?.plan??null),Vg(n,o),Sn(n,"verification.report",i?.verificationReport??null),Yg(n,t,i?.handoffContext??null),Qi(n,"run.checkpoint",a)]),l=c.find(f=>f.code==="design.handoff");return l&&!i?.handoffHash&&(l.satisfied=!1,l.detail="handoff hash is missing"),c.push({code:"archive.confirmed",satisfied:i?.archiveConfirmation==="confirmed"}),c}import{promises as qu}from"fs";import ie from"path";import{fileURLToPath as Lu}from"url";import{createHash as Hw,randomUUID as Gw}from"crypto";import{promises as Ro}from"fs";import ke from"path";function Jg(t){return t.classicProfile??t.workflow}function Hg(t){return!t.buildMode||!t.tddMode||!t.isolation||!t.verifyMode?!1:t.buildMode==="subagent-driven-development"?t.subagentDispatch==="confirmed":t.buildMode==="direct"?t.directOverride===!0:!0}function Gg(t){return t.buildMode==="direct"&&t.tddMode==="direct"&&t.isolation!==null&&t.verifyMode==="light"}function zg(t,e,n){if(e.verifyResult==="fail")return t==="full"?"full.build.fix":`${t}.build.execute`;if(t==="full"){if(!ot(n,"build.plan"))return"full.build.plan";if(e.buildPause==="plan-ready")return"full.build.plan-ready";if(!Hg(e))return"full.build.configure"}else if(!Gg(e))throw new Error(`${t} build configuration is incomplete`);return ot(n,"build.tasks-complete")?`${t}.build.complete`:`${t}.build.execute`}function Qg(t,e,n){return e.verifyResult!=="pass"||!ot(n,"verification.report")?`${t}.verify.run`:`${t}.verify.branch`}function Xg(t,e){if(e.verifyResult!=="pass")throw new Error("archive requires verify_result=pass");return e.archiveConfirmation==="confirmed"?`${t}.archive.execute`:`${t}.archive.confirm`}function Et(t,e){let n=Jg(t);if(t.archived&&t.phase!=="archive")throw new Error("archived=true requires phase=archive");if(t.archived)return"completed";if(n!=="full"&&t.phase==="design")throw new Error(`${n} workflow cannot enter design`);switch(t.phase){case"open":return`${n}.open`;case"design":return ot(e,"design.handoff")?"full.design.document":"full.design.handoff";case"build":return zg(n,t,e);case"verify":return Qg(n,t,e);case"archive":return Xg(n,t)}}var rr=Ve(Ie(),1);Ze();le();import ir from"path";tr();var cu=["full","hotfix","tweak"],at=1,iw=["open","design","build","verify","archive"],rw=["en","zh-CN"],sw=["off","beta"],ow=["subagent-driven-development","executing-plans","direct"],aw=["plan-ready"],cw=["confirmed"],lw=["tdd","direct"],uw=["off","standard","thorough"],fw=["current","branch","worktree"],dw=["light","full"],pw=["pending","pass","fail"],mw=["pending","handled"],hw=["pending","confirmed"],_t=["workflow","language","phase","context_compression","build_mode","build_pause","subagent_dispatch","tdd_mode","review_mode","isolation","bound_branch","verify_mode","auto_transition","base_ref","design_doc","plan","verify_result","verify_failures","verification_report","branch_status","created_at","verified_at","archive_confirmation","archived","direct_override","handoff_context","handoff_hash","classic_profile","classic_migration"],So=["run_id"],gw=new Set([..._t,...So]),ww=["workflow","phase","design_doc","plan","build_mode","isolation","verify_mode","verify_result","verified_at","archived"];function lu(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function xt(t,e){let n=t[e];if(n==null||n==="")return null;if(typeof n!="string")throw new Error(`Invalid Classic state: ${e} must be a string or null`);return n}function Q(t,e,n,i=!0){let r=t[e];if(r==null||r===""){if(i)return null;throw new Error(`Invalid Classic state: ${e} is required`)}if(typeof r!="string"||!n.includes(r))throw new Error(`Invalid Classic state: ${e} must be one of ${n.join(", ")}${i?" or null":""}`);return r}function ko(t,e,n=!0){let i=t[e];if(i==null||i===""){if(n)return null;throw new Error(`Invalid Classic state: ${e} is required`)}if(typeof i!="boolean")throw new Error(`Invalid Classic state: ${e} must be true or false`);return i}function yw(t,e,n=0){let i=t[e];if(i==null||i==="")return n;if(typeof i!="number"||!Number.isInteger(i)||i<0)throw new Error(`Invalid Classic state: ${e} must be a non-negative integer`);return i}function nr(t,e){let n=xt(t,e);if(n===null)return null;if(/^(?:[A-Za-z]:|[\\/]|~)/u.test(n)||n.split(/[\\/]/u).includes(".."))throw new Error(`Invalid Classic state: ${e} must be a relative repository path`);return n}function vw(t,e){let n=xt(t,e);if(n!==null&&!/^[a-f0-9]{64}$/u.test(n))throw new Error(`Invalid Classic state: ${e} must be a sha256 hex digest`);return n}function bw(t){let e=t.classic_migration;if(e==null||e==="")return null;if(e!==at)throw new Error(`Invalid Classic state: classic_migration must be ${at}`);return e}function kw(t){if(!_t.some(n=>lu(t,n)))return null;for(let n of ww)if(!lu(t,n))return null;return{workflow:Q(t,"workflow",cu,!1),language:Q(t,"language",rw),phase:Q(t,"phase",iw,!1),contextCompression:Q(t,"context_compression",sw),buildMode:Q(t,"build_mode",ow),buildPause:Q(t,"build_pause",aw),subagentDispatch:Q(t,"subagent_dispatch",cw),tddMode:Q(t,"tdd_mode",lw),reviewMode:Q(t,"review_mode",uw),isolation:Q(t,"isolation",fw),boundBranch:xt(t,"bound_branch"),verifyMode:Q(t,"verify_mode",dw),autoTransition:ko(t,"auto_transition"),baseRef:xt(t,"base_ref"),designDoc:nr(t,"design_doc"),plan:nr(t,"plan"),verifyResult:Q(t,"verify_result",pw,!1),verifyFailures:yw(t,"verify_failures"),verificationReport:nr(t,"verification_report"),branchStatus:Q(t,"branch_status",mw),createdAt:xt(t,"created_at"),verifiedAt:xt(t,"verified_at"),archiveConfirmation:Q(t,"archive_confirmation",hw),archived:ko(t,"archived",!1),directOverride:ko(t,"direct_override"),handoffContext:nr(t,"handoff_context"),handoffHash:vw(t,"handoff_hash"),classicProfile:Q(t,"classic_profile",cu),classicMigration:bw(t)}}function Co(t,e){let n=e??null;if(n===null&&e===void 0&&t.run_id&&t.skill)try{n=Xi(t)}catch(i){let r=i instanceof Error?i.message:String(i);throw new Error(r.replace(/^Invalid Run state:/u,"Invalid Classic state:"),{cause:i})}return{classic:kw(t),run:n,unknownKeys:Object.keys(t).filter(i=>!gw.has(i))}}function uu(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}}tr();var Sw=2*1024*1024;function xn(t){let e=t.toJS();if(e===null)return{};if(typeof e!="object"||Array.isArray(e))throw new Error("Invalid Classic state document: root must be a mapping");return e}function fu(t,e,n){t.get(e)!==n&&t.set(e,n)}function Cw(t,e){if(e.classic)for(let[n,i]of Object.entries(uu(e.classic)))fu(t,n,i);else for(let n of _t)t.delete(n);yo(t.toJS(),e.run),e.run?fu(t,"run_id",e.run.runId):t.delete("run_id")}function Ew(t){let e=["skill","skill_version","skill_hash","orchestration","current_step","iteration","pending","pending_ref","trajectory_ref","context_ref","artifacts_ref","checkpoint_ref","run_status","run_retries"];for(let n of e)t.delete(n)}function xw(t){let e=!1;for(let n of["build_command","verify_command"])t.has(n)&&(t.delete(n),e=!0);return e}async function du(t){let e;try{e=(await J(ir.dirname(t),ir.basename(t),Sw,{label:"Classic state document"})).bytes.toString("utf8")}catch(i){if(i.code!=="ENOENT")throw i;return new rr.Document({})}let n=(0,rr.parseDocument)(e);if(n.errors.length>0)throw new Error(`Invalid Classic state document: ${n.errors[0].message}`);return xn(n),n}async function Ke(t,e={}){let n=e.migrate!==!1,i=ir.join(t,".comet.yaml"),r=await du(i),s=xn(r),o=xw(r);o&&(s=xn(r));let a=await vo(t);if(!a&&s.run_id&&s.skill){let{runStateFromDocument:c}=await Promise.resolve().then(()=>(tr(),au));a=c(s),a&&n&&(await er(t,a),Ew(r),o=!0)}return o&&n&&await me(i,r.toString(),{containedRoot:t}),Co(xn(r),a)}async function sr(t,e,n={}){let i=ir.join(t,".comet.yaml"),r=await du(i);Cw(r,{...e,unknownKeys:e.unknownKeys??[]}),Co(xn(r),e.run??null),await me(i,r.toString(),{containedRoot:t,beforeCommit:n.beforeCommit}),e.run?await er(t,e.run):await bo(t)}function pu(t,e,n){return{runId:e,skill:t.definition.metadata.name,skillVersion:t.definition.metadata.version,skillHash:n,orchestration:t.definition.orchestration.mode,currentStep:t.definition.orchestration.entry??null,iteration:0,pending:null,pendingRef:".comet/pending-action.json",trajectoryRef:".comet/trajectory.jsonl",contextRef:".comet/context.md",artifactsRef:".comet/artifacts.json",checkpointRef:".comet/checkpoint.json",status:"running",retries:{}}}import{createHash as Pu,randomUUID as Kw}from"crypto";import{promises as K}from"fs";import F from"path";var gu=Ve(Ie(),1);import{promises as Eo}from"fs";import oe from"path";var _w=["invoke_skill","call_tool","handoff","ask_user","checkpoint"],Pw=["deterministic","adaptive"],Rw=["function","mcp","script","agent"],Nw=["none","read","write","external"],Ow=["progress","step","completion"],Aw=["artifact_exists","state_equals"];function ct(t,e,n){return new Error(`${t}: ${e} ${n}`)}function ne(t,e,n="document"){if(t===null||typeof t!="object"||Array.isArray(t))throw ct(e,n,"must be an object")}function Ye(t,e,n){if(!Array.isArray(t))throw ct(e,n,"must be an array")}function X(t,e,n){if(typeof t!="string")throw ct(e,n,"must be a string")}function ue(t,e,n,i){e in t&&X(t[e],n,`${i}.${e}`)}function wu(t,e,n,i){if(e in t&&typeof t[e]!="boolean")throw ct(n,`${i}.${e}`,"must be a boolean")}function Ue(t,e,n,i){if(typeof t!="string"||!e.includes(t))throw ct(n,i,`must be one of ${e.join(", ")}`)}function or(t,e,n){Ye(t,e,n),t.forEach((i,r)=>{X(i,e,`${n}[${r}]`)})}function mu(t,e,n){ne(t,e,n),X(t.name,e,`${n}.name`),X(t.description,e,`${n}.description`),wu(t,"required",e,n)}function jw(t,e,n){ne(t,e,n),X(t.id,e,`${n}.id`),ue(t,"source",e,n),ue(t,"version",e,n)}function Tw(t,e,n){ne(t,e,n),X(t.id,e,`${n}.id`),X(t.role,e,`${n}.role`),ue(t,"instructions",e,n)}function Iw(t,e,n){ne(t,e,n),X(t.id,e,`${n}.id`),Ue(t.kind,Rw,e,`${n}.kind`),X(t.source,e,`${n}.source`),Ue(t.sideEffect,Nw,e,`${n}.sideEffect`),wu(t,"requiresConfirmation",e,n)}function $w(t,e,n){ne(t,e,n),Ue(t.type,_w,e,`${n}.type`),ue(t,"ref",e,n),ue(t,"prompt",e,n),ue(t,"question",e,n),"options"in t&&or(t.options,e,`${n}.options`)}function qw(t,e,n){ne(t,e,n),X(t.id,e,`${n}.id`),$w(t.action,e,`${n}.action`),ue(t,"next",e,n),"completionEvals"in t&&or(t.completionEvals,e,`${n}.completionEvals`)}function Lw(t,e){let n="goal";ne(t,e,n),X(t.statement,e,`${n}.statement`),Ye(t.inputs,e,`${n}.inputs`),t.inputs.forEach((i,r)=>{mu(i,e,`${n}.inputs[${r}]`)}),Ye(t.outputs,e,`${n}.outputs`),t.outputs.forEach((i,r)=>{mu(i,e,`${n}.outputs[${r}]`)}),or(t.success,e,`${n}.success`)}function Dw(t,e){let n="orchestration";ne(t,e,n),Ue(t.mode,Pw,e,`${n}.mode`),ue(t,"entry",e,n),"steps"in t&&(Ye(t.steps,e,`${n}.steps`),t.steps.forEach((i,r)=>{qw(i,e,`${n}.steps[${r}]`)}))}function yu(t,e){return ne(t,e),Ue(t.apiVersion,["comet/v1alpha1"],e,"apiVersion"),Ue(t.kind,["Skill"],e,"kind"),ne(t.metadata,e,"metadata"),X(t.metadata.name,e,"metadata.name"),X(t.metadata.version,e,"metadata.version"),X(t.metadata.description,e,"metadata.description"),Lw(t.goal,e),Dw(t.orchestration,e),Ye(t.skills,e,"skills"),t.skills.forEach((n,i)=>{jw(n,e,`skills[${i}]`)}),Ye(t.agents,e,"agents"),t.agents.forEach((n,i)=>{Tw(n,e,`agents[${i}]`)}),Ye(t.tools,e,"tools"),t.tools.forEach((n,i)=>{Iw(n,e,`tools[${i}]`)}),t}function vu(t,e){ne(t,e);for(let n of["allowedSkills","allowedAgents","allowedTools","confirmationRequiredFor"])n in t&&or(t[n],e,n);for(let n of["maxIterations","maxRetriesPerAction"])if(n in t&&(typeof t[n]!="number"||!Number.isFinite(t[n])))throw ct(e,n,"must be a finite number");return t}function Fw(t,e){return ne(t,e),"runtime"in t&&bu(t.runtime,e,"runtime"),t}function bu(t,e,n){return Ye(t,e,n),t.forEach((i,r)=>{let s=`${n}[${r}]`;ne(i,e,s),X(i.id,e,`${s}.id`),Ue(i.scope,Ow,e,`${s}.scope`),Ue(i.type,Aw,e,`${s}.type`),ue(i,"artifact",e,s),ue(i,"field",e,s),ue(i,"equals",e,s)}),t}async function xo(t){let e=await Eo.readFile(t,"utf8");try{return(0,gu.parse)(e)}catch(n){let i=n instanceof Error?n.message:String(n);throw ct(t,"document",i)}}async function Mw(t){try{return await xo(t)}catch(e){if(e.code==="ENOENT")return null;throw e}}async function hu(t){try{return await Eo.access(t),!0}catch(e){if(e.code==="ENOENT")return!1;throw e}}async function Ww(t){let e=oe.join(t,"checks.yaml"),n=oe.join(t,"evals.yaml"),[i,r]=await Promise.all([hu(e),hu(n)]);if(r)throw new Error(`${n}: evals.yaml is no longer supported; use checks.yaml`);return i?{document:Fw(await xo(e),e)}:{document:null}}async function ku(t){let e=oe.resolve(t.root),n=oe.resolve(t.controlRoot);t.requireSkillMarkdown&&await Eo.access(oe.join(e,"SKILL.md"));let i=oe.join(n,"skill.yaml"),r=oe.join(n,"guardrails.yaml"),s=yu(await xo(i),i),o=await Mw(r),a=o===null?null:vu(o,r),c=await Ww(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 Su(t){let e=oe.resolve(t);return ku({root:e,controlRoot:oe.join(e,"comet"),packageKind:"skill",requireSkillMarkdown:!0})}async function Cu(t){let e=oe.resolve(t);return ku({root:e,controlRoot:e,packageKind:"runtime",requireSkillMarkdown:!1})}function Eu(t,e,n=oe.join(e,"package.json")){ne(t,n);let i=t.packageKind==="runtime"?"runtime":void 0,r=yu(t.definition,n),s=vu(t.guardrails,n),o=bu(t.evals,n,"evals"),a={allowedSkills:r.skills.map(c=>c.id),allowedAgents:r.agents.map(c=>c.id),allowedTools:r.tools.map(c=>c.id),maxIterations:50,maxRetriesPerAction:3,confirmationRequiredFor:r.tools.filter(c=>c.requiresConfirmation).map(c=>c.id)};return{root:oe.resolve(e),packageKind:i,definition:r,guardrails:{...a,...s},evals:o}}import xu from"path";function Bw(t,e,n,i){t.type==="invoke_skill"&&!e.definition.skills.some(r=>r.id===t.ref)&&n.push(`step ${i} references undeclared skill: ${t.ref??"(missing)"}`),t.type==="call_tool"&&!e.definition.tools.some(r=>r.id===t.ref)&&n.push(`step ${i} references undeclared tool: ${t.ref??"(missing)"}`),t.type==="handoff"&&!e.definition.agents.some(r=>r.id===t.ref)&&n.push(`step ${i} references undeclared agent: ${t.ref??"(missing)"}`),t.type==="ask_user"&&!t.question&&n.push(`step ${i} ask_user action requires question`)}function _u(t){let e=[],{definition:n,guardrails:i,evals:r}=t;n.apiVersion!=="comet/v1alpha1"&&e.push("unsupported apiVersion"),n.kind!=="Skill"&&e.push("kind must be Skill"),n.metadata.name||e.push("metadata.name is required"),n.goal.statement||e.push("goal.statement is required"),i.maxIterations<1&&e.push("maxIterations must be at least 1"),i.maxRetriesPerAction<0&&e.push("maxRetriesPerAction must not be negative");let s=n.orchestration.steps??[];if(n.orchestration.mode==="adaptive")(n.orchestration.entry||s.length>0)&&e.push("adaptive orchestration must not define entry or steps");else{let o=new Set;for(let a of s)o.has(a.id)&&e.push(`duplicate step id: ${a.id}`),o.add(a.id),Bw(a.action,t,e,a.id);(!n.orchestration.entry||!o.has(n.orchestration.entry))&&e.push(`orchestration.entry references unknown step: ${n.orchestration.entry??"(missing)"}`);for(let a of s){a.next&&!o.has(a.next)&&e.push(`step ${a.id} has unknown next step: ${a.next}`);for(let c of a.completionEvals??[])r.some(l=>l.id===c)||e.push(`step ${a.id} references unknown eval: ${c}`)}}for(let o of n.tools){if(o.kind!=="script")continue;let a=xu.posix.normalize(o.source.replaceAll("\\","/"));(xu.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 ar(t){return Array.isArray(t)?t.map(ar):t&&typeof t=="object"?Object.fromEntries(Object.entries(t).sort(([e],[n])=>e.localeCompare(n)).map(([e,n])=>[e,ar(n)])):t}function Yw(t){return ar({...t.packageKind==="runtime"?{packageKind:"runtime"}:{},definition:t.definition,guardrails:t.guardrails,evals:t.evals})}function Uw(t){return F.posix.normalize(t.replaceAll("\\","/"))}function Pt(t,e,n){let i=F.relative(t,e);if(!(i===""||!F.isAbsolute(i)&&!i.startsWith(`..${F.sep}`)))throw new Error(`${n} resolves outside the Skill package`)}async function Ru(t,e,n){let i=Uw(e);if(F.posix.isAbsolute(i)||i===".."||i.startsWith("../"))throw new Error(`${n} resolves outside the Skill package`);let r=F.resolve(t,...i.split("/"));Pt(t,r,n);let s;try{s=await K.realpath(r)}catch(o){throw o.code==="ENOENT"?new Error(`${n} does not exist: ${e}`,{cause:o}):o}if(Pt(t,s,n),!(await K.stat(s)).isFile())throw new Error(`${n} is not a file: ${e}`);return{path:i,content:await K.readFile(s)}}async function Vw(t){let e=await K.realpath(t.root),n=t.packageKind==="runtime"?[]:[await Ru(e,"SKILL.md","SKILL.md")];for(let i of t.definition.tools)i.kind==="script"&&n.push(await Ru(e,i.source,`Script tool ${i.id}`));return n.sort((i,r)=>i.path.localeCompare(r.path))}function Jw(t,e){let n=e.map(i=>({path:i.path,sha256:Pu("sha256").update(i.content).digest("hex")}));return Pu("sha256").update(JSON.stringify(ar({package:t,files:n}))).digest("hex")}function Au(t){return JSON.stringify(t,null,2)+`
147
- `}async function ju(t){let e=Yw(t),n=await Vw(t);return{document:e,files:n,hash:Jw(e,n)}}async function cr(t){return(await ju(t)).hash}async function Nu(t){try{return await K.access(t),!0}catch(e){if(e.code==="ENOENT")return!1;throw e}}async function Ou(t,e){try{if((await K.readFile(F.join(t,"sha256"),"utf8")).trim()!==e.hash)throw new Error("hash mismatch");if(await K.readFile(F.join(t,"package.json"),"utf8")!==Au(e.document))throw new Error("package mismatch");for(let r of e.files)if(!(await K.readFile(F.join(t,...r.path.split("/")))).equals(r.content))throw new Error(`file mismatch: ${r.path}`)}catch(n){throw new Error(`Existing Skill snapshot is invalid: ${e.hash}`,{cause:n})}}async function _o(t,e){let n=await ju(t),i=F.resolve(e,".comet","skill-snapshots"),r=F.join(i,n.hash);if(await K.mkdir(i,{recursive:!0}),await Nu(r))return await Ou(r,n),{hash:n.hash,snapshotDir:r};let s=F.join(i,`.tmp-${Kw()}`);Pt(i,s,"Temporary snapshot"),Pt(i,r,"Published snapshot");try{await K.mkdir(s);for(let o of n.files){let a=F.join(s,...o.path.split("/"));Pt(s,a,`Snapshot file ${o.path}`),await K.mkdir(F.dirname(a),{recursive:!0}),await K.writeFile(a,o.content)}await K.writeFile(F.join(s,"package.json"),Au(n.document)),await K.writeFile(F.join(s,"sha256"),n.hash+`
148
- `),await K.rename(s,r)}catch(o){if(await Nu(r)){try{await Ou(r,n)}finally{await K.rm(s,{recursive:!0,force:!0})}return{hash:n.hash,snapshotDir:r}}throw await K.rm(s,{recursive:!0,force:!0}),o}return{hash:n.hash,snapshotDir:r}}async function Po(t,e){if(!/^[a-f0-9]{64}$/u.test(e))throw new Error(`Invalid Skill snapshot hash: ${e}`);let n=F.resolve(t,".comet","skill-snapshots"),i=F.join(n,e);Pt(n,i,"Skill snapshot");try{let r=(await K.readFile(F.join(i,"sha256"),"utf8")).trim();if(r!==e)throw new Error(`stored hash is ${r||"(empty)"}`);let s=F.join(i,"package.json"),o=JSON.parse(await K.readFile(s,"utf8")),a=Eu(o,i,s),c=_u(a);if(c.length>0)throw new Error(c.map(f=>` - ${f}`).join(`
149
- `));let l=await cr(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 Tu(t){try{return await Ro.access(t),!0}catch(e){if(e.code==="ENOENT")return!1;throw e}}function Iu(t){return Hw("sha256").update(t).digest("hex")}function zw(t){return Iu(JSON.stringify(Object.fromEntries(Object.entries(t).sort(([e],[n])=>e.localeCompare(n)))))}function Qw(t){return t.replaceAll(".","_").replaceAll("-","_")}async function Xw(t,e){let n=await st(t),i=Object.fromEntries(e.filter(o=>o.satisfied&&o.source).map(o=>[Qw(o.code),o.source])),r=ke.join(t,"subagent-progress.md");await Tu(r)&&(i.subagent_progress=ke.relative(n,r).split(ke.sep).join("/"));let s=e.find(o=>o.code==="design.handoff"&&o.satisfied);return s?.source&&(i.handoff_context=s.source),i}function Zw(t,e,n){return[{sequence:1,timestamp:n,type:"run_started",runId:t.runId,data:{skill:t.skill,skillVersion:t.skillVersion,skillHash:t.skillHash}},{sequence:2,timestamp:n,type:"state_migrated",runId:t.runId,data:{kind:"classic",migrationVersion:at,profile:e,source:"pre-migration"}}]}async function ey(t){await Promise.all(t.map(e=>Ro.rm(e,{recursive:!0,force:!0})))}async function $u(t,e){let n=await Ke(t);if(!n.classic)throw new Error("Classic migration requires a legacy state projection");let i=n.classic,r=i.classicProfile??i.workflow;if(n.run){if(i.classicMigration!==at)throw new Error("Classic Run exists without a supported classic_migration marker");if(n.run.skill!==e.skillPackage.definition.metadata.name)throw new Error(`Classic Run skill mismatch: expected ${e.skillPackage.definition.metadata.name}, got ${n.run.skill}`);if(await cr(e.skillPackage)!==n.run.skillHash)return await Po(t,n.run.skillHash),{classic:i,run:n.run,evidence:await Be(t,n),migrated:!1,snapshotDir:ke.join(t,".comet","skill-snapshots",n.run.skillHash)};let d=await _o(e.skillPackage,t);return{classic:i,run:n.run,evidence:await Be(t,n),migrated:!1,snapshotDir:d.snapshotDir}}let s=await Be(t,n),o=Et(i,s);if(!e.skillPackage.definition.orchestration.steps?.some(u=>u.id===o))throw new Error(`Classic Skill package does not define resolved step: ${o}`);let a=await cr(e.skillPackage),c=ke.join(t,".comet","skill-snapshots",a),l=await Tu(c),f=[];try{let u=await _o(e.skillPackage,t),d=pu(e.skillPackage,e.runId?.()??Gw(),u.hash);d.currentStep=o,o==="completed"&&(d.status="completed");let h={...i,classicProfile:r,classicMigration:at},w=await Xw(t,s),p=await st(t),m=s.find(C=>C.code==="design.handoff"&&C.satisfied),g=null;m?.source&&(g=await te(p,m.resolvedSource??m.source,{label:"Classic migration handoff context",hooks:e.handoffReadHooks}),await Gl(t,d.contextRef,g),f.push(ke.resolve(t,d.contextRef))),await Hl(t,d.artifactsRef,w),f.push(ke.resolve(t,d.artifactsRef));let y=(e.now?.()??new Date).toISOString(),k={runId:d.runId,stateVersion:1,trajectoryOffset:2,contextHash:g===null?null:Iu(g),artifactsHash:zw(w),createdAt:y};await zl(t,d.checkpointRef,k),f.push(ke.resolve(t,d.checkpointRef)),f.push(ke.resolve(t,d.trajectoryRef));for(let C of Zw(d,r,y))await mn(t,d.trajectoryRef,C);return await sr(t,{classic:h,run:d,unknownKeys:n.unknownKeys}),{classic:h,run:d,evidence:s,migrated:!0,snapshotDir:u.snapshotDir}}catch(u){throw await ey(f),l||await Ro.rm(c,{recursive:!0,force:!0}),u}}async function ty(t){try{return(await qu.stat(t)).isDirectory()}catch(e){if(e.code==="ENOENT")return!1;throw e}}async function lr(t){try{return(await qu.stat(t)).isFile()}catch(e){if(e.code==="ENOENT")return!1;throw e}}async function ny(t){return await ty(t)?await lr(ie.join(t,"skill.yaml"))?!0:await lr(ie.join(t,"SKILL.md"))&&await lr(ie.join(t,"comet","skill.yaml")):!1}function iy(t){return{root:t,packageKind:"runtime",definition:{apiVersion:"comet/v1alpha1",kind:"Skill",metadata:{name:"comet-classic",version:"1",description:"Internal compatibility orchestration for classic Comet full, hotfix, and tweak workflows"},goal:{statement:"Advance or restore a classic Comet Run without changing the user command surface",inputs:[{name:"classic-state",description:"Validated ClassicState consistent with the Run projection",required:!0},{name:"evidence",description:"Structured evidence produced by the Classic Evidence collector",required:!0}],outputs:[{name:"run-state",description:"Atomically synchronized Classic and Run state",required:!0}],success:["Legacy fields and Run fields remain consistent","Every step invokes only a declared public Comet Skill","The completed state passes its completion eval"]},orchestration:{mode:"deterministic",entry:"full.open",steps:[{id:"full.open",action:{type:"invoke_skill",ref:"comet-open"},next:"full.design.handoff"},{id:"full.design.handoff",action:{type:"invoke_skill",ref:"comet-design"},next:"full.design.document"},{id:"full.design.document",action:{type:"invoke_skill",ref:"comet-design"},next:"full.build.plan"},{id:"full.build.plan",action:{type:"invoke_skill",ref:"comet-build"},next:"full.build.plan-ready"},{id:"full.build.plan-ready",action:{type:"invoke_skill",ref:"comet-build"},next:"full.build.configure"},{id:"full.build.configure",action:{type:"invoke_skill",ref:"comet-build"},next:"full.build.execute"},{id:"full.build.execute",action:{type:"invoke_skill",ref:"comet-build"},next:"full.build.complete"},{id:"full.build.complete",action:{type:"invoke_skill",ref:"comet-build"},next:"full.verify.run"},{id:"full.build.fix",action:{type:"invoke_skill",ref:"comet-build"},next:"full.build.execute"},{id:"full.verify.run",action:{type:"invoke_skill",ref:"comet-verify"},next:"full.verify.branch"},{id:"full.verify.branch",action:{type:"invoke_skill",ref:"comet-verify"},next:"full.archive.confirm"},{id:"full.archive.confirm",action:{type:"invoke_skill",ref:"comet-archive"},next:"full.archive.execute"},{id:"full.archive.execute",action:{type:"invoke_skill",ref:"comet-archive"},next:"completed"},{id:"hotfix.open",action:{type:"invoke_skill",ref:"comet-hotfix"},next:"hotfix.build.execute"},{id:"hotfix.build.execute",action:{type:"invoke_skill",ref:"comet-build"},next:"hotfix.build.complete"},{id:"hotfix.build.complete",action:{type:"invoke_skill",ref:"comet-build"},next:"hotfix.verify.run"},{id:"hotfix.verify.run",action:{type:"invoke_skill",ref:"comet-verify"},next:"hotfix.verify.branch"},{id:"hotfix.verify.branch",action:{type:"invoke_skill",ref:"comet-verify"},next:"hotfix.archive.confirm"},{id:"hotfix.archive.confirm",action:{type:"invoke_skill",ref:"comet-archive"},next:"hotfix.archive.execute"},{id:"hotfix.archive.execute",action:{type:"invoke_skill",ref:"comet-archive"},next:"completed"},{id:"tweak.open",action:{type:"invoke_skill",ref:"comet-tweak"},next:"tweak.build.execute"},{id:"tweak.build.execute",action:{type:"invoke_skill",ref:"comet-build"},next:"tweak.build.complete"},{id:"tweak.build.complete",action:{type:"invoke_skill",ref:"comet-build"},next:"tweak.verify.run"},{id:"tweak.verify.run",action:{type:"invoke_skill",ref:"comet-verify"},next:"tweak.verify.branch"},{id:"tweak.verify.branch",action:{type:"invoke_skill",ref:"comet-verify"},next:"tweak.archive.confirm"},{id:"tweak.archive.confirm",action:{type:"invoke_skill",ref:"comet-archive"},next:"tweak.archive.execute"},{id:"tweak.archive.execute",action:{type:"invoke_skill",ref:"comet-archive"},next:"completed"},{id:"completed",action:{type:"checkpoint"},completionEvals:["classic-completed"]}]},skills:[{id:"comet-open"},{id:"comet-design"},{id:"comet-build"},{id:"comet-verify"},{id:"comet-archive"},{id:"comet-hotfix"},{id:"comet-tweak"}],agents:[],tools:[]},guardrails:{allowedSkills:["comet-open","comet-design","comet-build","comet-verify","comet-archive","comet-hotfix","comet-tweak"],allowedAgents:[],allowedTools:[],maxIterations:500,maxRetriesPerAction:3,confirmationRequiredFor:[]},evals:[{id:"classic-completed",scope:"completion",type:"state_equals",field:"status",equals:"completed"}]}}async function ry(){let t=ie.dirname(Lu(import.meta.url)),e=[process.env.COMET_RUNTIME_CLASSIC_ROOT,ie.resolve(t,"..","runtime","classic"),ie.resolve(t,"..","..","comet","runtime","classic"),ie.resolve(t,"..","..","assets","skills","comet","runtime","classic"),ie.resolve("assets","skills","comet","runtime","classic"),process.env.COMET_CLASSIC_SKILL_ROOT,ie.resolve(t,"..","..","comet-classic"),ie.resolve(t,"..","..","assets","skills","comet-classic"),ie.resolve("assets","skills","comet-classic")].filter(n=>!!n);for(let n of e)if(await ny(n))return n;return null}async function sy(t){return await lr(ie.join(t,"skill.yaml"))?Cu(t):Su(t)}async function ur(t){let e=await ry();return $u(t,{skillPackage:e?await sy(e):iy(ie.dirname(Lu(import.meta.url)))})}async function Du(t){let e=await Ke(t),n=Array.from(new Set(e.unknownKeys)).sort();if(n.length>0)throw new Error(`Invalid Classic state: unknown field(s): ${n.join(", ")}`);return ur(t)}async function Fu(t,e,n,i){let r=await Ke(t);if(!r.classic||!r.run)throw new Error("Classic transition requires synchronized Classic and Run projections");let s=await Be(t,{classic:e,run:n,unknownKeys:r.unknownKeys}),o=Et(e,s),a={...n,currentStep:o,iteration:n.iteration+1,status:o==="completed"?"completed":"running"};await sr(t,{classic:e,run:a,unknownKeys:r.unknownKeys});let c=await Vi(t,a.trajectoryRef);return await mn(t,a.trajectoryRef,{sequence:c.length+1,timestamp:new Date().toISOString(),type:"state_transitioned",runId:a.runId,data:{kind:"classic",fromStep:n.currentStep,toStep:o,...i}}),a}var Mu={"full.open":["openspec.proposal","openspec.tasks"],"full.design.handoff":["openspec.proposal","openspec.design","openspec.tasks"],"full.design.document":["design.handoff"],"full.build.plan":["openspec.tasks"],"full.build.plan-ready":["build.plan"],"full.build.configure":["build.plan"],"full.build.execute":["build.plan"],"full.build.complete":["build.tasks-complete"],"full.verify.run":["build.tasks-complete"],"full.verify.branch":["verification.report"],"full.archive.confirm":["verification.report"],"full.archive.execute":["archive.confirmed"]};function oy(t){return Mu[t]?Mu[t]:t.endsWith(".open")?["openspec.proposal","openspec.tasks"]:t.endsWith(".build.execute")?[]:t.endsWith(".build.complete")?["build.tasks-complete"]:t.endsWith(".verify.run")?["build.tasks-complete"]:t.endsWith(".verify.branch")?["verification.report"]:t.endsWith(".archive.confirm")?["verification.report"]:t.endsWith(".archive.execute")?["archive.confirmed"]:[]}function Wu(t,e){let n=oy(t),i=n.filter(r=>!ot(e,r));return{stepId:t,passed:i.length===0,requiredEvidence:n,missingEvidence:i}}function ay(t){switch(t){case"open":return"/comet-open";case"design":return"/comet-design";case"build":return"/comet-build";case"verify":return"/comet-verify";case"archive":return"/comet-archive";default:return null}}async function Bu(t,e){try{let n=await Du(t),i=await Be(t,{classic:n.classic,run:n.run,unknownKeys:[]}),r=Et(n.classic,i);return{name:e,valid:!0,workflow:n.classic.workflow,phase:n.classic.phase,currentStep:r,nextCommand:ay(n.classic.phase),runtimeMode:"engine-projection",runtimeEval:Wu(r,i),evidence:i}}catch(n){return{name:e,valid:!1,workflow:"unknown",phase:"invalid",currentStep:null,nextCommand:null,runtimeMode:"invalid",runtimeEval:null,evidence:[],error:n instanceof Error?n.message:String(n)}}}Yi();import cy from"path";var ly=cy.join(".comet","state-events.jsonl"),uy=8*1024*1024;async function Ku(t,e){let n={schemaVersion:1,timestamp:new Date().toISOString(),...e};return await Ki(t,ly,`${JSON.stringify(n)}
150
- `,uy,"Classic state event log"),n}var fy={"open-complete":{event:"open-complete",from:"open",guardRefs:["open-artifacts-present"]},"design-complete":{event:"design-complete",from:"design",guardRefs:["design-evidence-present"]},"build-complete":{event:"build-complete",from:"build",guardRefs:["build-decisions-selected"]},"verify-pass":{event:"verify-pass",from:"verify",guardRefs:["verification-report-present"]},"verify-fail":{event:"verify-fail",from:"verify",guardRefs:["verification-failed"]},"archive-confirm":{event:"archive-confirm",from:"archive",guardRefs:["archive-final-confirmation"]},"archive-reopen":{event:"archive-reopen",from:"archive",guardRefs:["archive-not-finalized"]},archived:{event:"archived",from:"archive",guardRefs:["verify-result-pass","archive-confirmed"]},"preset-escalate":{event:"preset-escalate",from:"build",guardRefs:["preset-workflow"]}},Yu={open:"open-complete",design:"design-complete",build:"build-complete",verify:"verify-pass"};function dy(t){return t.toISOString().slice(0,10)}function R(t,e,n,i){let r=t[n];t[n]=i,r!==i&&e.push({field:n,from:r,to:i})}function Uu(t,e,n={}){let i=fy[e];if(t.phase!==i.from)throw new Error(`Cannot apply ${e}: phase is '${t.phase}', expected '${i.from}'`);let r={...t},s=[],o=n.now??new Date;if(e==="open-complete")R(r,s,"phase",r.workflow==="full"?"design":"build");else if(e==="design-complete")R(r,s,"phase","build");else if(e==="build-complete"){let a=r.verifyResult==="fail";R(r,s,"phase","verify"),R(r,s,"verifyResult","pending"),R(r,s,"branchStatus","pending"),a||R(r,s,"verificationReport",null)}else if(e==="verify-pass")R(r,s,"verifyResult","pass"),R(r,s,"verifyFailures",0),R(r,s,"phase","archive"),R(r,s,"verifiedAt",dy(o)),R(r,s,"archiveConfirmation","pending"),R(r,s,"branchStatus","pending");else if(e==="verify-fail")R(r,s,"verifyResult","fail"),R(r,s,"verifyFailures",r.verifyFailures+1),R(r,s,"phase","build"),R(r,s,"branchStatus","pending");else if(e==="preset-escalate"){if(r.workflow!=="hotfix"&&r.workflow!=="tweak")throw new Error(`Cannot apply ${e}: workflow must be hotfix or tweak, got '${r.workflow}'`);R(r,s,"workflow","full"),R(r,s,"classicProfile","full"),R(r,s,"phase","design"),R(r,s,"designDoc",null),R(r,s,"buildPause",null),R(r,s,"buildMode",null),R(r,s,"subagentDispatch",null),R(r,s,"tddMode",null),R(r,s,"reviewMode",null),R(r,s,"isolation",null),R(r,s,"boundBranch",null),R(r,s,"verifyMode",null),R(r,s,"directOverride",null)}else if(e==="archive-confirm"){if(r.verifyResult!=="pass")throw new Error(`Cannot apply ${e}: verifyResult must be pass`);if(r.archived)throw new Error(`Cannot apply ${e}: already archived`);R(r,s,"archiveConfirmation","confirmed")}else if(e==="archive-reopen"){if(r.archived)throw new Error(`Cannot apply ${e}: already archived`);R(r,s,"verifyResult","pending"),R(r,s,"verifyFailures",0),R(r,s,"phase","verify"),R(r,s,"verifiedAt",null),R(r,s,"archiveConfirmation",null),R(r,s,"branchStatus","pending")}else{if(r.verifyResult!=="pass")throw new Error(`Cannot apply ${e}: verifyResult must be pass`);if(r.archiveConfirmation!=="confirmed")throw new Error(`Cannot apply ${e}: archiveConfirmation must be confirmed`);R(r,s,"archived",!0)}return{classic:r,effects:s,definition:i}}var Nn=Ve(Ie(),1);import Ju from"path";import{AsyncLocalStorage as py}from"async_hooks";import{promises as Vu}from"fs";import _n from"path";var fr=new py;function my(t,e){let n=_n.relative(t,e);return n===""||!_n.isAbsolute(n)&&n!==".."&&!n.startsWith(`..${_n.sep}`)}async function hy(t){let e=_n.resolve(t.invocationCwd??process.cwd()),n=_n.resolve(t.projectRoot??await st(e)),[i,r]=await Promise.all([Vu.realpath(e),Vu.realpath(n)]);if(!my(r,i))throw new Error(`Classic command invocation cwd is outside the discovered project: ${e}`);return{invocationCwd:e,projectRoot:n}}async function dr(t,e){let n=fr.getStore();if(n)return e(n);let i=await hy(t);return fr.run(i,()=>e(i))}function I(){let t=fr.getStore();if(!t)throw new Error("Classic command project context is unavailable");return t.projectRoot}function pr(){let t=fr.getStore();if(!t)throw new Error("Classic command invocation context is unavailable");return t.invocationCwd}var gy="\x1B[32m",Pn="\x1B[31m",wy="\x1B[33m",yy="\x1B[0m",vy=["workflow","phase","design_doc","plan","build_mode","isolation","verify_mode","verify_result","verified_at","archived"],by={workflow:["full","hotfix","tweak"],language:["en","zh-CN"],phase:["open","design","build","verify","archive"],context_compression:["off","beta"],build_mode:["subagent-driven-development","executing-plans","direct"],build_pause:["plan-ready"],subagent_dispatch:["confirmed"],tdd_mode:["tdd","direct"],review_mode:["off","standard","thorough"],isolation:["current","branch","worktree"],verify_mode:["light","full"],auto_transition:["true","false"],verify_result:["pending","pass","fail"],branch_status:["pending","handled"],archive_confirmation:["pending","confirmed"],archived:["true","false"],direct_override:["true","false"],classic_profile:["full","hotfix","tweak"],classic_migration:["1"]},ky=new Set([..._t,...So,"classic_profile","classic_migration"]);function lt(t,e){return`${t}${e}${yy}`}function Rn(t){return t==null?"":typeof t=="object"?JSON.stringify(t):String(t)}var Hu=async(t,e)=>dr(e,async()=>{let n=t[0],i=vn(n);if(i)return{exitCode:1,stderr:lt(Pn,`ERROR: ${i}`)};let r=I(),{directory:s,label:o}=await zi(n,r),a=Ju.join(s,".comet.yaml"),c=[`[VALIDATE] ${o}/.comet.yaml`],l=0,f=0,u=m=>{l+=1,c.push(lt(Pn,` FAIL: ${m}`))},d=m=>{f+=1,c.push(lt(wy,` WARN: ${m}`))},h;try{h=await te(r,a,{label:`Classic state ${o}/.comet.yaml`})}catch(m){if(m.code==="ENOENT")return u(".comet.yaml does not exist"),c.push("",lt(Pn,`${l} error(s), ${f} warning(s) — validation FAILED`)),{exitCode:1,stderr:c.join(`
151
- `)};throw m}let w=(0,Nn.parseDocument)(h);if(w.errors.length>0||!(0,Nn.isMap)(w.contents)){for(let m of w.errors)u(m.message);return(0,Nn.isMap)(w.contents)||u("document root must be a mapping"),c.push("",lt(Pn,`${l} error(s), ${f} warning(s) — validation FAILED`)),{exitCode:1,stderr:c.join(`
152
- `)}}let p=w.toJS();for(let m of vy)Object.prototype.hasOwnProperty.call(p,m)||u(`missing required field '${m}'`);for(let[m,g]of Object.entries(by)){if(!Object.prototype.hasOwnProperty.call(p,m))continue;let y=Rn(p[m]);if(!y){m==="auto_transition"&&u(`${m}='' is not valid. Expected: ${g.join(" ")}`);continue}g.includes(y)||u(`${m}='${y}' is not valid. Expected: ${g.join(" ")}`)}if(Object.prototype.hasOwnProperty.call(p,"bound_branch")){let m=p.bound_branch;m!==null&&typeof m!="string"&&u(`bound_branch='${Rn(m)}' is not a string or null`)}if(Object.prototype.hasOwnProperty.call(p,"verify_failures")){let m=p.verify_failures;(typeof m!="number"||!Number.isInteger(m)||m<0)&&u(`verify_failures='${Rn(m)}' is not a non-negative integer`)}for(let m of["design_doc","plan","handoff_context","verification_report"]){let g=Rn(p[m]);if(g){if(/^(?:[A-Za-z]:|[\\/]|~)/u.test(g)||g.split(/[\\/]/u).includes("..")){u(`${m}='${g}' must be a relative repository path`);continue}try{await yn(r,Ju.resolve(r,g),{label:`${m} artifact pointer`,expected:"file"})||u(`${m}='${g}' does not exist on disk`)}catch(y){u(`${m}='${g}' is unsafe: ${y instanceof Error?y.message:String(y)}`)}}}for(let m of["handoff_hash"]){let g=Rn(p[m]);g&&!/^[a-f0-9]{64}$/u.test(g)&&u(`${m}='${g}' is not a sha256 hex digest`)}for(let m of Object.keys(p))ky.has(m)||d(`unknown field '${m}' found`);return c.push(""),l>0?(c.push(lt(Pn,`${l} error(s), ${f} warning(s) — validation FAILED`)),{exitCode:1,stderr:c.join(`
153
- `)}):(c.push(lt(gy,`0 errors, ${f} warning(s) — validation PASSED`)),{exitCode:0,stderr:c.join(`
154
- `)})});co();nt();import Sy from"os";import mr from"path";function Cy(t={}){let e=t.cwd??process.cwd(),n=t.homeDir??Sy.homedir(),i=[{file:mr.resolve(e,".comet","config.yaml"),source:".comet/config.yaml",scope:"project"},{file:mr.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 Gu(t,e={}){for(let n of Cy(e)){let i=mr.dirname(mr.dirname(n.file)),r=n.scope==="global"?(await ao(i))?.classic:(await Me(i,{allowPartialProject:!0}))?.value.classic;if(!r||typeof r!="object"||Array.isArray(r))continue;let s=r[t];if(s!=null)return{value:String(s),source:n.source}}return null}nt();var Oo=Ve(Ie(),1);import{execFileSync as zu}from"child_process";import{randomUUID as _y}from"crypto";import{promises as On}from"fs";import Qu from"path";var Ey=null;function xy(t,e){let n=t;for(let i of e)n+="\0"+(typeof i=="string"?i:JSON.stringify(i));return n}function No(t,e){return(...n)=>{let i=Ey;if(i===null)return e(...n);let r=xy(`sync:${t}`,n),s=i.entries.get(r);if(s)return s.value;let o=e(...n);return i.entries.set(r,{value:o}),o}}function Py(t){try{let e=zu("git",["rev-parse","--abbrev-ref","HEAD"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();return e&&e!=="HEAD"?e:null}catch{return null}}var Ry=No("liveGitBranch",t=>Py(t));function Ny(t){try{return zu("git",["rev-parse","--is-inside-work-tree"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()==="true"}catch{return!1}}var Oy=No("isGitWorkTree",t=>Ny(t)),Ay=["current","branch","worktree"];function Xu(t){return Ay.includes(t)}function jy(t){return Xu(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 Zu(t,e){let n=Qu.join(t,".comet.yaml"),i=(0,Oo.parseDocument)(await On.readFile(n,"utf8"),{uniqueKeys:!1});if(i.errors.length>0)throw new Error(`Invalid .comet.yaml: ${i.errors[0].message}`);let r=i.toJS()??{},s=typeof r.isolation=="string"?r.isolation:null,o=typeof r.bound_branch=="string"&&r.bound_branch!==""?r.bound_branch:null,a=Xu(s),c=Ry(e.cwd),l=a&&o===null&&c===null?Oy(e.cwd):!0,f=jy({isolation:s,boundBranch:o,currentBranch:c,gitWorkTree:l});return f.status==="needs-heal"&&e.heal?(await Ty(t,f.branch),{status:"healed",branch:f.branch,bindingRequired:a,currentBranch:c}):{...f,bindingRequired:a,currentBranch:c}}async function Ty(t,e){let n=Qu.join(t,".comet.yaml"),i=(0,Oo.parseDocument)(await On.readFile(n,"utf8"),{uniqueKeys:!1});i.set("bound_branch",e);let r=`${n}.${_y()}.tmp`;try{await On.writeFile(r,i.toString(),"utf8"),await On.rename(r,n)}catch(s){throw await On.rm(r,{force:!0}),s}}function Iy(t){return t??"detached HEAD"}function ef(t,e,n){return`change '${t}' is bound to branch '${e}', but current branch is '${Iy(n)}'.
155
- Next: ask the user to confirm — switch back to '${e}', or run \`comet state rebind ${t}\` after explicit confirmation.`}function tf(t){return`change '${t}' uses a branch-bound workspace mode but has no bound branch and HEAD is detached; checkout a branch first before continuing.`}var Ly="\x1B[32m",Dy="\x1B[31m",Fy="\x1B[33m",Io="\x1B[0m",My=["open","design","build","verify","archive"],Wy={open:"=== Guard: open → next ===",design:"=== Guard: design → build ===",build:"=== Guard: build → verify ===",verify:"=== Guard: verify → archive ===",archive:"=== Guard: archive completeness ==="},By={open:" [APPLY] .comet.yaml updated: phase=PLACEHOLDER",design:" [APPLY] .comet.yaml updated: phase=build",build:" [APPLY] .comet.yaml updated: phase=verify, verify_result=pending",verify:" [APPLY] .comet.yaml updated: phase=archive, verify_result=pass"},Ky={branchStatus:"branch_status",phase:"phase",verificationReport:"verification_report",verifiedAt:"verified_at",verifyResult:"verify_result"};function Rt(t){return`${Ly}${t}${Io}`}function Se(t){return`${Dy}${t}${Io}`}function Yy(t){return`${Fy}${t}${Io}`}function Uy(t){return Ky[t]??String(t)}function Vy(t){return t===null?"null":t===void 0?"":typeof t=="object"?JSON.stringify(t):String(t)}var fe=class extends Error{constructor(n,i=1){super(n);this.exitCode=i}exitCode},To=class{stderr=[];diagnostics;toResult(e=0){return{exitCode:e,...this.diagnostics?{stdout:JSON.stringify({diagnostics:this.diagnostics})+`
142
+ `,n)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let n=Ri(e),i=kt(n);return i.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let n=Ri(e),i=kt(n);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,n){return this.type!=="comment"||this.indent<=n?!1:e.every(i=>i.type==="newline"||i.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};bl.Parser=Hs});var xl=v(on=>{"use strict";var kl=$s(),Rh=zt(),sn=Zt(),Nh=Tr(),Ah=N(),Oh=Js(),Sl=Gs();function Cl(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new Oh.LineCounter||null,prettyErrors:e}}function jh(t,e={}){let{lineCounter:n,prettyErrors:i}=Cl(e),r=new Sl.Parser(n?.addNewLine),s=new kl.Composer(e),o=Array.from(s.compose(r.parse(t)));if(i&&n)for(let a of o)a.errors.forEach(sn.prettifyError(t,n)),a.warnings.forEach(sn.prettifyError(t,n));return o.length>0?o:Object.assign([],{empty:!0},s.streamInfo())}function El(t,e={}){let{lineCounter:n,prettyErrors:i}=Cl(e),r=new Sl.Parser(n?.addNewLine),s=new kl.Composer(e),o=null;for(let a of s.compose(r.parse(t),!0,t.length))if(!o)o=a;else if(o.options.logLevel!=="silent"){o.errors.push(new sn.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return i&&n&&(o.errors.forEach(sn.prettifyError(t,n)),o.warnings.forEach(sn.prettifyError(t,n))),o}function Th(t,e,n){let i;typeof e=="function"?i=e:n===void 0&&e&&typeof e=="object"&&(n=e);let r=El(t,n);if(!r)return null;if(r.warnings.forEach(s=>Nh.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 Ih(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 Ah.isDocument(t)&&!i?t.toString(n):new Rh.Document(t,i,n).toString(n)}on.parse=Th;on.parseAllDocuments=jh;on.parseDocument=El;on.stringify=Ih});var Ie=v(A=>{"use strict";var $h=$s(),qh=zt(),Lh=hs(),zs=Zt(),Dh=It(),Te=N(),Fh=Re(),Mh=L(),Wh=Ae(),Bh=Oe(),Kh=_i(),Yh=Us(),Uh=Js(),Vh=Gs(),Ai=xl(),_l=At();A.Composer=$h.Composer;A.Document=qh.Document;A.Schema=Lh.Schema;A.YAMLError=zs.YAMLError;A.YAMLParseError=zs.YAMLParseError;A.YAMLWarning=zs.YAMLWarning;A.Alias=Dh.Alias;A.isAlias=Te.isAlias;A.isCollection=Te.isCollection;A.isDocument=Te.isDocument;A.isMap=Te.isMap;A.isNode=Te.isNode;A.isPair=Te.isPair;A.isScalar=Te.isScalar;A.isSeq=Te.isSeq;A.Pair=Fh.Pair;A.Scalar=Mh.Scalar;A.YAMLMap=Wh.YAMLMap;A.YAMLSeq=Bh.YAMLSeq;A.CST=Kh;A.Lexer=Yh.Lexer;A.LineCounter=Uh.LineCounter;A.Parser=Vh.Parser;A.parse=Ai.parse;A.parseAllDocuments=Ai.parseAllDocuments;A.parseDocument=Ai.parseDocument;A.stringify=Ai.stringify;A.visit=_l.visit;A.visitAsync=_l.visitAsync});var Oi=V(()=>{"use strict"});function $e(t){return t!==0&&t!==0n&&t!=="0"}function ji(t,e){return $e(t.dev)&&$e(e.dev)&&$e(t.ino)&&$e(e.ino)}function ye(t,e){let n=$e(t.dev)&&$e(e.dev);if(n&&t.dev!==e.dev)return!1;let i=$e(t.ino)&&$e(e.ino);return i&&t.ino!==e.ino?!1:n&&i?!0:t.birthtime===e.birthtime}var Ti=V(()=>{"use strict"});import{randomUUID as Jh}from"crypto";import{constants as Hh,promises as D}from"fs";import H from"path";async function Qs(t,e){try{return await D.link(t,e),{linked:!0}}catch(n){let i=n.code;if(i!=="ENOTSUP"&&i!=="EOPNOTSUPP")throw n}return await D.copyFile(t,e,Hh.COPYFILE_EXCL),{linked:!1}}function St(t,e){let n=H.relative(t,e);return n===""||!H.isAbsolute(n)&&n!==".."&&!n.startsWith(`..${H.sep}`)}function $i(t){return{dev:t.dev,ino:t.ino,birthtime:t.birthtimeMs}}function Gh(t,e){return ye(t,$i(e))}function Ii(t,e){let n=$i(t),i=$i(e);return ji(n,i)?ye(n,i):ye(n,i)&&t.birthtimeMs===e.birthtimeMs&&t.ctimeMs===e.ctimeMs&&t.size===e.size}async function qi(t){let e=await D.lstat(t);if(!e.isDirectory()||e.isSymbolicLink())throw new Error(`Contained atomic write parent must be a real directory: ${t}`);return{path:t,realPath:await D.realpath(t),...$i(e)}}async function qe(t){for(let e of t){let n=await D.lstat(e.path);if(!n.isDirectory()||n.isSymbolicLink()||!Gh(e,n)||await D.realpath(e.path)!==e.realPath)throw new Error(`Contained atomic write parent changed before commit: ${e.path}`)}}async function zh(t,e){let n=H.resolve(t),i=H.resolve(e);if(!St(n,i))throw new Error(`Contained atomic write parent is outside its managed root: ${e}`);let r=[await qi(n)],s=H.relative(n,i).split(H.sep).filter(Boolean),o=n;for(let a of s){await qe(r),o=H.join(o,a);try{await D.mkdir(o)}catch(l){if(l.code!=="EEXIST")throw l}let c=await qi(o);if(!St(r[0].realPath,c.realPath))throw new Error(`Contained atomic write parent resolves outside its managed root: ${o}`);r.push(c)}return await qe(r),r}async function Qh(t,e){let n=H.resolve(t),i=H.resolve(e);if(!St(n,i))throw new Error(`Contained file parent is outside its managed root: ${e}`);let r=[await qi(n)],s=H.relative(n,i).split(H.sep).filter(Boolean),o=n;for(let a of s){o=H.join(o,a);try{let c=await qi(o);if(!St(r[0].realPath,c.realPath))throw new Error(`Contained file parent resolves outside its managed root: ${o}`);r.push(c)}catch(c){if(c.code==="ENOENT")return null;throw c}}return await qe(r),r}async function Pl(t){let e;try{e=await D.open(t,"r"),await e.sync()}catch(n){let i=n.code;if(!["EACCES","EBADF","EINVAL","EISDIR","ENOTSUP","EPERM"].includes(i??""))throw n}finally{await e?.close()}}async function Xh(t,e,n){let i=H.dirname(t),r=await zh(n.containedRoot,i),s=H.join(i,`.${H.basename(t)}.${Jh()}.tmp`),o,a;try{await n.beforeTemporaryOpen?.(),o=await D.open(s,"wx"),a=await o.stat();let[c,l]=await Promise.all([D.lstat(s),D.realpath(s)]);if(await qe(r),!c.isFile()||c.isSymbolicLink()||!Ii(a,c)||!St(r[0].realPath,l))throw new Error("Contained atomic write temporary file opened outside its managed parent");if(typeof e=="string"?await o.writeFile(e,"utf8"):await o.writeFile(e),await o.sync(),!Ii(a,await o.stat()))throw new Error("Contained atomic write temporary file changed while writing");await o.close(),o=void 0,await n.beforeCommit?.(),await qe(r);let d=await D.lstat(s);if(!d.isFile()||d.isSymbolicLink()||!Ii(d,a))throw new Error("Contained atomic write temporary file changed before commit");n.exclusive?(await Qs(s,t),await D.unlink(s)):await D.rename(s,t),await Pl(i)}catch(c){await o?.close();try{await qe(r),await D.rm(s,{force:!0})}catch{}throw c}}async function ue(t,e,n){await Xh(t,e,n)}async function Xs(t,e){let n=H.dirname(t),i=await Qh(e.containedRoot,n);if(!i)return!1;let r,s;try{r=await D.lstat(t),s=await D.realpath(t)}catch(c){if(c.code==="ENOENT")return!1;throw c}if(!r.isFile()||r.isSymbolicLink()||!St(i[0].realPath,s))throw new Error("Contained file removal target must be a regular file inside its managed root");await e.beforeRemove?.(),await qe(i);let[o,a]=await Promise.all([D.lstat(t),D.realpath(t)]);if(!o.isFile()||o.isSymbolicLink()||!Ii(r,o)||a!==s)throw new Error("Contained file removal target changed before removal");return await D.unlink(t),await qe(i),await Pl(n),!0}var Le=V(()=>{"use strict";Ti()});var Rl=V(()=>{"use strict"});var Zs=V(()=>{"use strict";Oi()});var Nl=V(()=>{"use strict";Oi();Zs()});import Li from"path";function ag(t,e){if(typeof t!="string")throw new Error(`${e} must be a string`);let n=t.trim();if(n.length===0||Li.posix.isAbsolute(n)||Li.win32.isAbsolute(n)||/^(?:~|[\\/])/u.test(n))throw new Error(`${e} must be a project-relative path`);if(n===".")return[];let i=n.replaceAll("\\","/").split("/");if(i.some(r=>r===".."))throw new Error(`${e} must stay inside the project root`);if(i.some(r=>r===""||r==="."))throw new Error(`${e} must not contain empty or dot path segments`);return i}function an(t){let e=ag(t,"native.artifact_root");return e.length===0?".":e.join("/")}function jl(t,e="docs"){let n=t??e;if(n!=="legacy"&&n!=="docs")throw new Error("classic.artifact_layout must be legacy or docs");return n}function tt(t,e,n=!1){if(typeof t!="string")throw new Error(`${e} must be a string`);let i=t.trim().replaceAll("\\","/");if(i.length===0||Li.posix.isAbsolute(i)||Li.win32.isAbsolute(i)||/^(?:~|[\\/])/u.test(i))throw new Error(`${e} must be relative to its declared path base`);let r=i.split("/");if(r.some(s=>s===".."))throw new Error(`${e} must stay inside its declared path base`);if(r.some(s=>s===""||s==="."))throw new Error(`${e} must not contain empty or dot path segments`);if(!n&&/[*?]/u.test(i))throw new Error(`${e} cannot contain wildcards`);return r.join("/")}function cn(t,e){if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`${e} must be a mapping`);return t}function Tl(t,e,n){let i=t??e;if(i!=="en"&&i!=="zh-CN")throw new Error(`${n} must be en or zh-CN`);return i}function Il(t,e){if(typeof t!="string"||t.length===0||t.includes("\\")||t.includes("\0")||t.startsWith("/")||t.split("/").includes(".."))throw new Error(`${e} contains an unsafe pattern`);if(t.length>to)throw new Error(`${e} exceeds ${to} characters`);let n=0;for(let i=0;i<t.length;i+=1)t[i]==="?"?n+=1:t[i]==="*"&&(n+=1,t[i+1]==="*"&&(i+=1));if(n>no)throw new Error(`${e} contains more than ${no} wildcard tokens`);return t}function Al(t,e,n){if(t===void 0)return[...n];if(!Array.isArray(t))throw new Error(`${e} contains an unsafe pattern`);return[...new Set(t.map(i=>Il(i,e)))].sort((i,r)=>i.localeCompare(r,"en"))}function eo(t,e,n){let i=t??e;if(!Number.isSafeInteger(i)||i<1)throw new Error(`${n} must be a positive integer`);return i}function cg(t){if(t===void 0)return{...se,include:[...se.include],exclude:[...se.exclude]};let e=cn(t,"native.snapshot");return{include:Al(e.include,"native.snapshot.include",se.include),exclude:Al(e.exclude,"native.snapshot.exclude",se.exclude),max_files:eo(e.max_files,se.max_files,"native.snapshot.max_files"),max_total_bytes:eo(e.max_total_bytes,se.max_total_bytes,"native.snapshot.max_total_bytes"),max_duration_ms:eo(e.max_duration_ms,se.max_duration_ms,"native.snapshot.max_duration_ms")}}function lg(t){if(t===void 0)return;let e=cn(t,"native.pending_root_move"),n=e.id,i=e.from_artifact_root,r=e.to_artifact_root,s=e.stage;if(typeof n!="string"||!/^[a-f0-9-]{8,}$/u.test(n))throw new Error("native.pending_root_move.id is invalid");if(typeof i!="string"||typeof r!="string")throw new Error("native.pending_root_move roots must be strings");if(s!=="copying"&&s!=="ready"&&s!=="switched")throw new Error("native.pending_root_move.stage is invalid");let o;if(e.cleanup!==void 0){let a=cn(e.cleanup,"native.pending_root_move.cleanup"),c=a.kind,l=a.state,d=a.manifest_hash;if(c!=="forward-source"&&c!=="restart-staging"&&c!=="rollback-destination"&&c!=="rollback-staging")throw new Error("native.pending_root_move.cleanup.kind is invalid");if(l!=="prepared"&&l!=="quarantined"&&l!=="deleting")throw new Error("native.pending_root_move.cleanup.state is invalid");if(typeof d!="string"||!/^[a-f0-9]{64}$/u.test(d))throw new Error("native.pending_root_move.cleanup.manifest_hash is invalid");o={kind:c,state:l,manifestHash:d}}return{id:n,fromArtifactRoot:an(i),toArtifactRoot:an(r),stage:s,...o?{cleanup:o}:{}}}function ug(t,e={}){let n=cn(t,"native"),i=n.artifact_root??(e.allowMissingArtifactRoot?"docs":void 0);if(typeof i!="string")throw new Error("native.artifact_root must be a string");let r=n.clarification_mode??"batch";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??Ol;if(!Number.isSafeInteger(o)||o<1)throw new Error("native.max_verify_failures must be a positive integer");let a=lg(n.pending_root_move);return{artifact_root:an(i),language:Tl(n.language,"en","native.language"),clarification_mode:r,archive_confirmation:s,max_verify_failures:o,snapshot:cg(n.snapshot),...a?{pending_root_move:a}:{}}}function fg(t){let e=cn(t,"classic"),n=e.context_compression??"off";if(n!=="off"&&n!=="beta")throw new Error("classic.context_compression must be off or beta");let i=e.review_mode??"standard";if(i!=="off"&&i!=="standard"&&i!=="thorough")throw new Error("classic.review_mode must be off, standard, or thorough");let r=e.auto_transition??!0;if(typeof r!="boolean")throw new Error("classic.auto_transition must be true or false");return{artifact_layout:jl(e.artifact_layout),language:Tl(e.language,"zh-CN","classic.language"),context_compression:n,review_mode:i,auto_transition:r}}function dg(t){let e=t??!0;if(typeof e!="boolean")throw new Error("ambient_resume must be true or false");return e}function mg(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 De(t,e={}){let n=(0,io.parseDocument)(t,{uniqueKeys:!0});if(n.errors.length>0)throw new Error(`Invalid .comet/config.yaml: ${n.errors[0].message}`);let i=n.toJS();if(i==null)return{value:{},config:null,ambient_resume:!0};if(typeof i!="object"||Array.isArray(i))throw new Error("Invalid .comet/config.yaml: root must be a mapping");let r=i,s=dg(r.ambient_resume),o=r.native===void 0?void 0:ug(r.native,{allowMissingArtifactRoot:e.allowMissingNativeFields}),a=r.classic===void 0?void 0:fg(r.classic),c=mg(r,o,a,s,{allowPartialProject:e.allowPartialProject??!1});return{value:r,config:c,ambient_resume:s,...o?{native:o}:{},...a?{classic:a}:{}}}function ro(t="docs",e="en"){return{schema:"comet.project.v1",default_workflow:"native",ambient_resume:!0,native:{artifact_root:an(t),language:e,clarification_mode:"batch",archive_confirmation:"automatic",max_verify_failures:Ol,snapshot:{...se,include:[...se.include],exclude:[...se.exclude]}}}}var io,Ct,to,no,Ol,rg,sg,og,se,ve=V(()=>{"use strict";io=He(Ie(),1),Ct=64*1024,to=1024,no=64,Ol=5,rg=[".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/**"],sg=["**/.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"],og=[...rg,...sg].sort((t,e)=>t.localeCompare(e,"en")),se={include:["**/*"],exclude:[...og],max_files:1e4,max_total_bytes:256*1024*1024,max_duration_ms:6e4}});import{constants as Di,promises as nt}from"fs";function so(t){return"birthtimeNs"in t&&typeof t.birthtimeNs=="bigint"?t.birthtimeNs:t.birthtimeMs}function $l(t){return"ctimeNs"in t&&typeof t.ctimeNs=="bigint"?t.ctimeNs:t.ctimeMs}function ln(t){return{dev:t.dev,ino:t.ino,birthtime:so(t)}}function Fi(t,e){let n=ln(t),i=ln(e);return ji(n,i)?ye(n,i):ye(n,i)&&so(t)===so(e)&&$l(t)===$l(e)&&t.size===e.size}async function ql(t,e,n={}){if(!Number.isSafeInteger(e)||e<1)throw new Error("race-safe read byte limit must be a positive integer");let i=n.label??"file",r=n.bigint===!0,s=await nt.lstat(t,{bigint:r});if(!s.isFile()||s.isSymbolicLink())throw new Fe("not-regular-file",`${i} must be a regular file`);if(BigInt(s.size)>BigInt(e))throw new Fe("too-large",`${i} exceeds ${e} bytes`);let o=await nt.realpath(t);await n.verify?.("pre-open",{realPath:o,identity:ln(s)});let a=process.platform==="win32"?Di.O_RDONLY:Di.O_RDONLY|Di.O_NOFOLLOW|Di.O_NONBLOCK,c;try{c=await nt.open(t,a)}catch(l){throw l.code==="ELOOP"?new Fe("not-regular-file",`${i} must be a regular file`,{cause:l}):l}try{let[l,d,u]=await Promise.all([c.stat({bigint:r}),nt.lstat(t,{bigint:r}),nt.realpath(t)]);if(!l.isFile()||!d.isFile()||d.isSymbolicLink()||u!==o||!Fi(s,l)||!Fi(s,d))throw new Fe("changed",`${i} changed while opening`);await n.verify?.("post-open",{realPath:u,identity:ln(l)}),await n.hooks?.afterOpen?.();let f=[],h=0,w=Buffer.allocUnsafe(Math.min(64*1024,e+1));for(;;){let y=e+1-h,{bytesRead:k}=await c.read(w,0,Math.min(w.length,y),null);if(k===0)break;if(h+=k,h>e)throw new Fe("too-large",`${i} exceeds ${e} bytes`);f.push(Buffer.from(w.subarray(0,k)))}await n.hooks?.beforeFinalCheck?.();let[m,p,g]=await Promise.all([c.stat({bigint:r}),nt.lstat(t,{bigint:r}),nt.realpath(t)]);if(!p.isFile()||p.isSymbolicLink()||g!==o||!Fi(s,m)||!Fi(s,p))throw new Fe("changed",`${i} changed while reading`);return await n.verify?.("post-read",{realPath:g,identity:ln(m)}),{bytes:Buffer.concat(f,h),stat:m,realPath:g}}finally{await c.close()}}var Fe,Ll=V(()=>{"use strict";Ti();Fe=class extends Error{reason;constructor(e,n,i){super(n,i),this.name="RaceSafeReadError",this.reason=e}}});import{promises as Mi}from"fs";import Me from"path";function pg(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}function oo(t,e){let n=Me.relative(t,e);return n===""||!Me.isAbsolute(n)&&n!==".."&&!n.startsWith(`..${Me.sep}`)}async function Dl(t,e){let n=Me.resolve(t),i=await Mi.lstat(n);if(!i.isDirectory()||i.isSymbolicLink())throw new Error(`${e} project root must be a real directory`);return Mi.realpath(n)}async function Fl(t,e,n,i){let r=t;for(let s=0;s<n.length;s++){r=Me.join(r,n[s]);let o;try{o=await Mi.lstat(r)}catch(d){if(pg(d))return{exists:!1,kind:"missing"};throw d}let a=Me.relative(t,r).replaceAll("\\","/");if(o.isSymbolicLink())throw new Error(`${i.label} crosses a symbolic link or junction at ${a}`);let c=s===n.length-1;if(!c&&!o.isDirectory())throw new Error(`${i.label} ancestor ${a} must be a real directory`);if(c&&(i.expected==="file"&&!o.isFile()||i.expected==="directory"&&!o.isDirectory()||i.expected==="any"&&!o.isFile()&&!o.isDirectory()))throw new Error(`${i.label} must be a real ${i.expected}`);let l=await Mi.realpath(r);if(!oo(e,l))throw new Error(`${i.label} resolves outside the project root`);if(c)return{exists:!0,kind:o.isFile()?"file":o.isDirectory()?"directory":"missing"}}return{exists:!0,kind:"directory"}}async function q(t,e,n){let i=tt(e,n.label),r=Me.resolve(t),s=await Dl(r,n.label),o=i.split("/"),a=Me.resolve(r,...o);if(!oo(r,a))throw new Error(`${n.label} must stay inside the project root`);let c=await Fl(r,s,o,n);return{projectRoot:r,target:a,relative:i,exists:c.exists,kind:c.kind}}async function Wi(t,e,n){return(await q(t,e,{...n,expected:"file"})).exists}async function U(t,e,n,i){let r=await q(t,e,{label:i.label,expected:"file"});if(!r.exists){let o=new Error(`${i.label} does not exist`);throw o.code="ENOENT",o}let s=await Dl(r.projectRoot,i.label);return ql(r.target,n,{...i,verify:async(o,a)=>{if(!oo(s,a.realPath))throw new Error(`${i.label} resolves outside the project root`);await Fl(r.projectRoot,s,r.relative.split("/"),{label:i.label,expected:"file"})}})}var oe=V(()=>{"use strict";Ll();ve()});function hg(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}function gg(t){let e=(0,Wl.parseDocument)(t,{uniqueKeys:!0});if(e.errors.length>0)throw new Error(`Invalid global Comet config: ${e.errors[0].message}`);let n=e.toJS();if(n==null)return{};if(typeof n!="object"||Array.isArray(n))throw new Error("Invalid global Comet config: root must be a mapping");return n}function Kl(t){if(t.native?.pending_root_move)throw new Error("Global Comet config cannot contain native.pending_root_move");let e=t.native?(({pending_root_move:n,...i})=>i)(t.native):void 0;return{...t,schema:"comet.global.v1",...e?{native:e}:{}}}function wg(t){let e=De(JSON.stringify({...t,schema:"comet.project.v1"})).config;if(!e)throw new Error("Invalid global Comet config: workflow template is incomplete");return Kl(e)}function yg(t){let e=De(t,{allowPartialProject:!0,allowMissingNativeFields:!0});if(!e.native&&!e.classic)return null;let n=e.native?"native":"classic",i=e.native?.language??e.classic?.language??"en",r=ro(e.native?.artifact_root??"docs",i);return{schema:"comet.global.v1",default_workflow:n,workflows:[n],ambient_resume:e.ambient_resume,...e.native?{native:{...r.native,...e.native}}:{},...e.classic?{classic:e.classic}:{}}}function Yl(t){let e=gg(t);if(Object.keys(e).length===0)return null;if(e.schema===void 0)return yg(t);if(e.schema!=="comet.global.v1")throw new Error("Unsupported Comet global schema");return wg(e)}async function co(t){try{let e=await U(t,Bl,Ct,{label:"global Comet config"});return Yl(e.bytes.toString("utf8"))}catch(e){if(hg(e))return null;throw e}}var Wl,Bl,lo=V(()=>{"use strict";Wl=He(Ie(),1);Le();ve();oe();Bl=".comet/config.yaml"});import{createHash as vg}from"crypto";function bg(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}async function We(t,e={}){return(await Bi(t,e)).document}async function kg(t){try{return(await U(t,un,Ct,{label:un})).bytes}catch(e){if(bg(e))return null;throw e}}function Sg(t){return t?{exists:!0,sha256:vg("sha256").update(t).digest("hex")}:{exists:!1,sha256:null}}async function Bi(t,e={}){let n=await kg(t);return{document:n?De(n.toString("utf8"),e):null,identity:Sg(n)}}var un,it=V(()=>{"use strict";ve();oe();un=".comet/config.yaml"});var jk,uo=V(()=>{"use strict";Le();it();oe();jk=16*1024});var fo=V(()=>{"use strict";Le();ve();it();oe();uo()});var Kk,Vl=V(()=>{"use strict";Le();oe();Kk=4*1024*1024});var Jl=V(()=>{"use strict";Oi();Le();Rl();Nl();ve();lo();oe();it();fo();Vl();uo();Zs()});import{TextDecoder as Rg}from"util";function Hl(t){return{dev:t.dev,ino:t.ino,birthtime:t.birthtimeMs}}function Ng(t,e){try{return new Rg("utf-8",{fatal:!0}).decode(t.bytes)}catch(n){throw new Error(`${e} is not valid UTF-8`,{cause:n})}}async function mo(t,e,n,i,r={}){try{let s=await U(t,e,n,{label:i,hooks:r.hooks});return{result:s,text:Ng(s,i)}}catch(s){let o=s.code;if(o==="ENOENT"||o==="ENOTDIR")return null;throw s}}async function fn(t,e,n,i,r={}){return(await mo(t,e,n,i,r))?.text??null}async function rt(t,e,n,i,r,s={}){if(Buffer.byteLength(n,"utf8")>i)throw new Error(`${r} exceeds ${i} bytes`);let o=await mo(t,e,i,r),a=await q(t,e,{label:r,expected:"file"});await ue(a.target,n,{containedRoot:a.projectRoot,beforeCommit:async()=>{await s.beforeCommit?.();let c=await mo(t,e,i,r);if(!(!o&&!c)){if(!o||!c)throw new Error(`${r} changed before commit`);if(o.result.realPath!==c.result.realPath||!ye(Hl(o.result.stat),Hl(c.result.stat))||o.text!==c.text)throw new Error(`${r} changed before commit`)}}})}async function Ki(t,e,n,i,r,s={}){let o=await fn(t,e,i,r);await rt(t,e,`${o??""}${n}`,i,r,s)}async function po(t,e,n,i={}){let r=await q(t,e,{label:n,expected:"file"});return r.exists?Xs(r.target,{containedRoot:r.projectRoot,beforeRemove:i.beforeRemove}):!1}var Yi=V(()=>{"use strict";Jl();Ti()});var lu={};yf(lu,{RUN_STATE_FILE:()=>er,applyRunStateToDocument:()=>yo,readRunState:()=>vo,removeRunState:()=>bo,runStateFromDocument:()=>Zi,writeRunState:()=>tr});import nw from"path";function En(t,e){let n=t[e];if(typeof n!="string"||n.length===0)throw new Error(`Invalid Run state: ${e} must be a non-empty string`);return n}function Cn(t,e){let n=En(t,e);if(nw.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 iw(t){let e=t.run_retries??"{}",n;try{n=typeof e=="string"?JSON.parse(e):e}catch(i){throw new Error("Invalid Run state: run_retries must be a JSON object",{cause:i})}if(!n||typeof n!="object"||Array.isArray(n))throw new Error("Invalid Run state: run_retries must be a JSON object");for(let i of Object.values(n))if(!Number.isInteger(i)||Number(i)<0)throw new Error("Invalid Run state: retry counts must be non-negative integers");return n}function Zi(t){if(!t.run_id)return null;let e=En(t,"run_id"),n=En(t,"skill"),i=En(t,"skill_version"),r=En(t,"skill_hash"),s=Cn(t,"pending_ref"),o=Cn(t,"trajectory_ref"),a=Cn(t,"context_ref"),c=Cn(t,"artifacts_ref"),l=Cn(t,"checkpoint_ref"),d=Number(t.iteration);if(!Number.isInteger(d)||d<0)throw new Error("Invalid Run state: iteration must be a non-negative integer");if(t.orchestration!=="deterministic"&&t.orchestration!=="adaptive")throw new Error("Invalid Run state: orchestration must be deterministic or adaptive");if(t.run_status!=="running"&&t.run_status!=="waiting"&&t.run_status!=="completed"&&t.run_status!=="failed")throw new Error("Invalid Run state: run_status is invalid");return{runId:e,skill:n,skillVersion:i,skillHash:r,orchestration:t.orchestration,currentStep:au(t,"current_step"),iteration:d,pending:au(t,"pending"),pendingRef:s,trajectoryRef:o,contextRef:a,artifactsRef:c,checkpointRef:l,status:t.run_status,retries:iw(t)}}function yo(t,e){e?t.run_id=e.runId:delete t.run_id}function rw(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 sw(t){let e={run_id:t.runId,skill:t.skill,skill_version:t.skillVersion,skill_hash:t.skillHash,orchestration:t.orchestration,current_step:t.currentStep,iteration:t.iteration,pending:t.pending,pending_ref:t.pendingRef,trajectory_ref:t.trajectoryRef,context_ref:t.contextRef,artifacts_ref:t.artifactsRef,checkpoint_ref:t.checkpointRef,run_status:t.status,run_retries:JSON.stringify(t.retries)};return Zi(e)}async function vo(t,e={}){let n=await fn(t,er,cu,"Run state",e);if(n===null)return null;let i=JSON.parse(n);return sw(i)}async function tr(t,e,n={}){await rt(t,er,JSON.stringify(rw(e),null,2),cu,"Run state",n)}async function bo(t,e={}){await po(t,er,"Run state",e)}var au,er,cu,nr=V(()=>{"use strict";Yi();au=(t,e)=>{let n=t[e];return n==null?null:String(n)};er=".comet/run-state.json",cu=256*1024});var af=He(Ie(),1);import{spawnSync as Dy}from"child_process";import{createHash as of}from"crypto";import{promises as Fy}from"fs";import T from"path";import Ji from"path";Yi();import Ui from"path";var dn={trajectory:8*1024*1024,artifacts:1024*1024,context:1024*1024,pendingAction:256*1024,checkpoint:256*1024};function mn(t,e){if(Ui.isAbsolute(e))throw new Error("Run path must stay inside the change directory");let n=Ui.resolve(t),i=Ui.resolve(n,e);if(i!==n&&!i.startsWith(n+Ui.sep))throw new Error("Run path must stay inside the change directory")}async function pn(t,e,n,i={}){mn(t,e),await Ki(t,e,`${JSON.stringify(n)}
143
+ `,dn.trajectory,"Run trajectory",i)}async function Vi(t,e,n={}){mn(t,e);let i=await fn(t,e,dn.trajectory,"Run trajectory",n);return i===null?[]:i.split(/\r?\n/).map((r,s)=>({line:r,number:s+1})).filter(({line:r})=>r.length>0).map(({line:r,number:s})=>{try{return JSON.parse(r)}catch(o){throw new Error(`Invalid Trajectory event at line ${s}`,{cause:o})}})}async function Gl(t,e,n,i={}){mn(t,e),await rt(t,e,JSON.stringify(n,null,2)+`
144
+ `,dn.artifacts,"Run artifacts",i)}async function zl(t,e,n,i={}){mn(t,e),await rt(t,e,n,dn.context,"Run context",i)}async function Ql(t,e,n,i={}){mn(t,e),await rt(t,e,JSON.stringify(n,null,2)+`
145
+ `,dn.checkpoint,"Run checkpoint",i)}function Ag(t){if(t!=="build"&&t!=="verify")throw new Error(`Invalid command check scope: '${String(t)}'`)}function Og(t,e="."){if(e.trim().length===0)throw new Error("Command check cwd cannot be blank");let n=Ji.resolve(t),i=Ji.resolve(n,e);if(i!==n&&!i.startsWith(n+Ji.sep))throw new Error(`Command check cwd must resolve within the project root: '${e}'`);return Ji.relative(n,i).replaceAll("\\","/")||"."}function jg(t,e){if(e.type!=="command_check_recorded")return null;let n=e.data;if(typeof n!="object"||n===null||Array.isArray(n))return null;let{scope:i,command:r,exitCode:s,cwd:o}=n;if(i!=="build"&&i!=="verify"||typeof r!="string"||r.trim().length===0||!Number.isInteger(s)||typeof o!="string")return null;let a;try{a=Og(t,o)}catch{return null}return{sequence:e.sequence,timestamp:e.timestamp,runId:e.runId,scope:i,command:r,exitCode:s,cwd:a}}async function Xl(t,e,n,i){Ag(i);let r=await Vi(e,n.trajectoryRef);for(let s=r.length-1;s>=0;s-=1){let o=r[s];if(o.runId!==n.runId)continue;let a=jg(t,o);if(a?.scope===i)return a}return null}import{promises as Vg}from"fs";import be from"path";import{promises as eu}from"fs";import $ from"path";import{promises as Tg}from"fs";async function hn(t){try{return await Tg.access(t),!0}catch(e){if(Ig(e))return!1;throw e}}function Ig(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}ve();it();fo();oe();var gn=class extends Error{code="classic-layout-unavailable";constructor(e="Classic artifact layout is unavailable from .comet/config.yaml"){super(e),this.name="ClassicLayoutUnavailableError"}},Zl=".comet/config.yaml";function tu(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}async function nu(t){await q(t,Zl,{label:Zl,expected:"file"})}function Hi(t,e){let n=$.resolve(t),i=e==="docs"?$.join(n,"docs"):n,r=$.join(i,"openspec"),s=$.join(n,"docs","superpowers");return{projectRoot:n,artifactLayout:e,openSpecBase:i,openSpecRoot:r,changesDir:$.join(r,"changes"),archiveDir:$.join(r,"changes","archive"),specsDir:$.join(r,"specs"),superpowersRoot:s,superpowersSpecsDir:$.join(s,"specs"),superpowersPlansDir:$.join(s,"plans"),superpowersReportsDir:$.join(s,"reports")}}async function $g(t){await nu(t);let e=await We(t,{allowPartialProject:!0,allowMissingNativeFields:!0});if(!e?.config)throw new gn;if(!(e.config.workflows??[e.config.default_workflow]).includes("classic"))throw new gn("Classic artifact layout is unavailable because Classic is not enabled");return e.classic?.artifact_layout??"legacy"}async function qg(t,e){return Hi(t,e??await $g(t))}async function Lg(t){try{return await eu.lstat(t),!0}catch(e){if(tu(e))return!1;throw e}}async function Dg(t,e){let n=await qg(t,e),i=n.artifactLayout==="legacy"?"docs":"legacy",r=Hi(t,i).openSpecRoot,[s,o]=await Promise.all([q(n.projectRoot,z(n.projectRoot,n.openSpecRoot),{label:"Configured Classic OpenSpec root",expected:"directory"}),Lg(r)]),a=s.exists;return{paths:n,configuredRootExists:a,alternateRoot:r,alternateRootExists:o,dualRoots:a&&o}}async function Fg(t){let e=[t.openSpecRoot,t.changesDir,t.archiveDir,t.specsDir,t.superpowersRoot,t.superpowersSpecsDir,t.superpowersPlansDir,t.superpowersReportsDir];for(let n of e){let i=z(t.projectRoot,n);await q(t.projectRoot,i,{label:`Classic managed physical path ${i}`,expected:"directory"})}}async function Be(t,e){let n=await Dg(t,e);if(await Fg(n.paths),!n.configuredRootExists){let i=z(n.paths.projectRoot,n.paths.openSpecRoot),r=z(n.paths.projectRoot,n.alternateRoot);throw new gn(`Configured Classic OpenSpec root is missing: ${i} (alternate ${r} is ${n.alternateRootExists?"present":"missing"})`)}return n.paths}async function ho(t,e){let n=$.join($.resolve(t),".comet","classic-root-move.json");if(await hn(n))throw new Error("Classic root move transaction is incomplete; inspect it with comet doctor and recover it explicitly before writing");let i=await Be(t,e);if(!await hn(i.openSpecRoot))throw new Error(`Configured Classic OpenSpec root is missing: ${z(i.projectRoot,i.openSpecRoot)}`);return i}async function st(t){let e=$.resolve(t),n=null;try{(await eu.lstat(e)).isDirectory()||(e=$.dirname(e))}catch(i){if(!tu(i))throw i}for(;;){$.basename(e)==="openspec"&&(n=$.dirname(e));let i=$.join(e,".comet","config.yaml"),r=!1;if(await hn(i))try{await nu(e);let o=(await We(e))?.value;r=!!o&&typeof o=="object"&&!Array.isArray(o)&&(o.schema==="comet.project.v1"||o.default_workflow!==void 0||o.native!==void 0)}catch{}if(r||await hn($.join(e,".git")))return e;let s=$.dirname(e);if(s===e)return n??$.resolve(t);e=s}}function z(t,e){return $.relative($.resolve(t),e).replaceAll("\\","/")}oe();ve();import bn from"path";import{promises as Wg}from"fs";import zi from"path";Le();ve();oe();import wn from"path";var Mg=2*1024*1024;function iu(t,e,n){let i=wn.resolve(t),r=wn.isAbsolute(e)?wn.resolve(e):wn.resolve(i,e),s=wn.relative(i,r).replaceAll("\\","/");return{root:i,relative:tt(s,n),target:r}}async function Ke(t,e,n){let i=iu(t,e,n.label);return q(i.root,i.relative,n)}async function yn(t,e,n){return(await Ke(t,e,{label:n.label,expected:n.expected??"any"})).exists}async function ru(t,e,n,i){return await yn(t,e,{label:n,expected:"file"})?(await Gi(t,e,{label:n,hooks:i})).byteLength>0:!1}async function te(t,e,n){return(await Gi(t,e,n)).toString("utf8")}async function Gi(t,e,n){let i=iu(t,e,n.label);return(await U(i.root,i.relative,n.maxBytes??Mg,{label:n.label,hooks:n.hooks})).bytes}function vn(t){return t?/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u.test(t)?t.includes("..")?"Change name cannot contain '..' (path traversal not allowed)":null:`Invalid change name: '${t}'
146
+ Valid format: lowercase kebab-case (a-z, 0-9, single hyphens)`:"Change name cannot be empty"}function wo(t){let e=vn(t);if(e)throw new Error(e)}function Bg(t,e){return{label:z(t,e),directory:e}}async function go(t,e,n){let i=Bg(t,e);if(!(await Ke(t,e,{label:n,expected:"directory"})).exists)return{change:i,exists:!1,stateExists:!1};let s=await Ke(t,zi.join(e,".comet.yaml"),{label:`${n} state`,expected:"file"});return{change:i,exists:!0,stateExists:s.exists}}function Kg(t,e){let n=e.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&");return new RegExp(`^\\d{4}-\\d{2}-\\d{2}-${n}$`,"u").test(t)}async function Yg(t,e,n,i={}){if(!i.skipExactCompatibility){let o=await go(t,zi.join(e,n),`Classic archived change ${n}`);if(o.exists)return o.change}if(!(await Ke(t,e,{label:"Classic archive directory",expected:"directory"})).exists)return null;let s=[];for(let o of await Wg.readdir(e,{withFileTypes:!0})){if(!Kg(o.name,n))continue;let a=await go(t,zi.join(e,o.name),`Classic archived change ${o.name}`);a.exists&&a.stateExists&&s.push(a.change)}return s.sort((o,a)=>a.directory.localeCompare(o.directory))[0]??null}async function Qi(t,e=process.cwd()){wo(t);let n=await Be(e),i=await go(n.projectRoot,zi.join(n.changesDir,t),`Classic active change ${t}`);if(i.exists)return i.change;let r=await Yg(n.projectRoot,n.archiveDir,t);return r||i.change}function Ug(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}async function su(t,e,n,i){let r=tt(n,"Classic handoff artifact pointer");if((await q(t,r,{label:"Classic handoff artifact",expected:"file"})).exists)return null;let o=await Be(t),a=`${z(t,o.changesDir)}/`,l=(o.artifactLayout==="docs"?[a,"openspec/changes/"]:[a]).find(y=>r.startsWith(y));if(!l)return null;let d=r.slice(l.length).split("/");if(d.length<4||d[1]!==".comet"||d.slice(2).some(y=>y.length===0))return null;let u=d[0];wo(u);let f=d.slice(2),h=bn.resolve(e);if(bn.dirname(h)!==bn.resolve(o.archiveDir))return null;let w=bn.basename(h),m=/^\d{4}-\d{2}-\d{2}-(.+)$/u.exec(w);if(w!==u&&m?.[1]!==u)return null;await q(t,z(t,h),{label:"Classic archived change directory",expected:"directory"});let p=bn.join(h,".comet",...f),g=z(t,p);try{return await U(t,g,i,{label:"Historical Classic archived handoff artifact"}),g}catch(y){if(Ug(y))return null;throw y}}oe();var ou=2*1024*1024;function kn(t,e){return be.relative(t,e).split(be.sep).join("/")}async function Sn(t,e,n,i,r){if(!n)return{code:e,satisfied:!1};let s=n.replaceAll("\\","/");if(r)return{code:e,satisfied:!1,source:s,detail:`Classic layout is unsafe or unavailable: ${r instanceof Error?r.message:String(r)}`};try{if(i){let a=i.artifactLayout==="legacy"?"docs":"legacy",c=z(t,Hi(t,a).openSpecRoot);if((s===c||s.startsWith(`${c}/`))&&(await q(t,s,{label:`${e} artifact`,expected:"file"})).exists)return{code:e,satisfied:!1,source:s,detail:"standalone OpenSpec root is not a Comet artifact root"}}let o=await Wi(t,s,{label:`${e} artifact`});return{code:e,satisfied:o,source:s,...o?{resolvedSource:s}:{}}}catch(o){return{code:e,satisfied:!1,source:s,detail:`unsafe artifact pointer outside the project or through a special path: ${o instanceof Error?o.message:String(o)}`}}}async function Jg(t,e,n,i){try{i??=await Be(t)}catch(s){return{code:"design.handoff",satisfied:!1,...n?{source:n.replaceAll("\\","/")}:{},detail:`Classic layout is unsafe or unavailable for handoff evidence: ${s instanceof Error?s.message:String(s)}`}}let r=await Sn(t,"design.handoff",n,i);if(!n||r.satisfied||r.detail)return r;try{let s=await su(t,e,n,ou);return s?{...r,satisfied:!0,resolvedSource:s,detail:`resolved historical legacy pointer from archived change: ${s}`}:r}catch(s){return{...r,satisfied:!1,detail:`unsafe archived handoff fallback: ${s instanceof Error?s.message:String(s)}`}}}async function Xi(t,e,n){return Sn(t,e,kn(t,n))}async function Hg(t,e){let n=be.join(e,"specs"),i;try{let o=kn(t,n);if(!(await q(t,o,{label:"OpenSpec delta-spec directory",expected:"directory"})).exists)return{code:"openspec.delta-spec",satisfied:!1};i=await Vg.readdir(n)}catch(o){return o.code==="ENOENT"?{code:"openspec.delta-spec",satisfied:!1}:{code:"openspec.delta-spec",satisfied:!1,detail:`unsafe delta-spec path: ${o instanceof Error?o.message:String(o)}`}}let r=i.map(o=>be.join(n,o,"spec.md")),s=(await Promise.all(r.map(async o=>{try{return await Wi(t,kn(t,o),{label:"OpenSpec delta spec"})?o:null}catch{return null}}))).filter(o=>o!==null);return{code:"openspec.delta-spec",satisfied:s.length>0,source:s[0]?kn(t,s[0]):void 0,detail:`${s.length} delta spec${s.length===1?"":"s"}`}}async function Gg(t,e){let n,i=kn(t,e);try{n=(await U(t,i,ou,{label:"Classic tasks artifact"})).bytes.toString("utf8")}catch(o){return o.code==="ENOENT"?{code:"build.tasks-complete",satisfied:!1}:{code:"build.tasks-complete",satisfied:!1,source:i,detail:`unsafe tasks artifact: ${o instanceof Error?o.message:String(o)}`}}let r=[...n.matchAll(/^\s*[-*]\s+\[([ xX])\]\s+/gmu)],s=r.filter(o=>o[1].toLowerCase()==="x").length;return{code:"build.tasks-complete",satisfied:r.length>0&&s===r.length,source:i,detail:`${s} of ${r.length} tasks complete`}}function ot(t,e){return t.some(n=>n.code===e&&n.satisfied)}async function Ye(t,e){let n=await st(t),i=e.classic,r=be.join(t,"proposal.md"),s=be.join(t,"design.md"),o=be.join(t,"tasks.md"),a=e.run?be.resolve(t,e.run.checkpointRef):be.join(t,".comet","checkpoint.json"),c,l;try{c=await Be(n)}catch(f){l=f}let d=await Promise.all([Xi(n,"openspec.proposal",r),Xi(n,"openspec.design",s),Xi(n,"openspec.tasks",o),Hg(n,t),Sn(n,"design.document",i?.designDoc??null,c,l),Sn(n,"build.plan",i?.plan??null,c,l),Gg(n,o),Sn(n,"verification.report",i?.verificationReport??null,c,l),Jg(n,t,i?.handoffContext??null,c),Xi(n,"run.checkpoint",a)]),u=d.find(f=>f.code==="design.handoff");return u&&!i?.handoffHash&&(u.satisfied=!1,u.detail="handoff hash is missing"),d.push({code:"archive.confirmed",satisfied:i?.archiveConfirmation==="confirmed"}),d}import{promises as Du}from"fs";import ie from"path";import{fileURLToPath as Fu}from"url";import{createHash as Qw,randomUUID as Xw}from"crypto";import{promises as Ro}from"fs";import ke from"path";function zg(t){return t.classicProfile??t.workflow}function Qg(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 Xg(t){return t.buildMode==="direct"&&t.tddMode==="direct"&&t.isolation!==null&&t.verifyMode==="light"}function Zg(t,e,n){if(e.verifyResult==="fail")return t==="full"?"full.build.fix":`${t}.build.execute`;if(t==="full"){if(!ot(n,"build.plan"))return"full.build.plan";if(e.buildPause==="plan-ready")return"full.build.plan-ready";if(!Qg(e))return"full.build.configure"}else if(!Xg(e))throw new Error(`${t} build configuration is incomplete`);return ot(n,"build.tasks-complete")?`${t}.build.complete`:`${t}.build.execute`}function ew(t,e,n){return e.verifyResult!=="pass"||!ot(n,"verification.report")?`${t}.verify.run`:`${t}.verify.branch`}function tw(t,e){if(e.verifyResult!=="pass")throw new Error("archive requires verify_result=pass");return e.archiveConfirmation==="confirmed"?`${t}.archive.execute`:`${t}.archive.confirm`}function Et(t,e){let n=zg(t);if(t.archived&&t.phase!=="archive")throw new Error("archived=true requires phase=archive");if(t.archived)return"completed";if(n!=="full"&&t.phase==="design")throw new Error(`${n} workflow cannot enter design`);switch(t.phase){case"open":return`${n}.open`;case"design":return ot(e,"design.handoff")?"full.design.document":"full.design.handoff";case"build":return Zg(n,t,e);case"verify":return ew(n,t,e);case"archive":return tw(n,t)}}var sr=He(Ie(),1);Le();oe();import rr from"path";nr();var uu=["full","hotfix","tweak"],at=1,ow=["open","design","build","verify","archive"],aw=["en","zh-CN"],cw=["off","beta"],lw=["subagent-driven-development","executing-plans","direct"],uw=["plan-ready"],fw=["confirmed"],dw=["tdd","direct"],mw=["off","standard","thorough"],pw=["current","branch","worktree"],hw=["light","full"],gw=["pending","pass","fail"],ww=["pending","handled"],yw=["pending","confirmed"],_t=["workflow","language","phase","context_compression","build_mode","build_pause","subagent_dispatch","tdd_mode","review_mode","isolation","bound_branch","verify_mode","auto_transition","base_ref","design_doc","plan","verify_result","verify_failures","verification_report","branch_status","created_at","verified_at","archive_confirmation","archived","direct_override","handoff_context","handoff_hash","classic_profile","classic_migration"],So=["run_id"],vw=new Set([..._t,...So]),bw=["workflow","phase","design_doc","plan","build_mode","isolation","verify_mode","verify_result","verified_at","archived"];function fu(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function xt(t,e){let n=t[e];if(n==null||n==="")return null;if(typeof n!="string")throw new Error(`Invalid Classic state: ${e} must be a string or null`);return n}function Q(t,e,n,i=!0){let r=t[e];if(r==null||r===""){if(i)return null;throw new Error(`Invalid Classic state: ${e} is required`)}if(typeof r!="string"||!n.includes(r))throw new Error(`Invalid Classic state: ${e} must be one of ${n.join(", ")}${i?" or null":""}`);return r}function ko(t,e,n=!0){let i=t[e];if(i==null||i===""){if(n)return null;throw new Error(`Invalid Classic state: ${e} is required`)}if(typeof i!="boolean")throw new Error(`Invalid Classic state: ${e} must be true or false`);return i}function kw(t,e,n=0){let i=t[e];if(i==null||i==="")return n;if(typeof i!="number"||!Number.isInteger(i)||i<0)throw new Error(`Invalid Classic state: ${e} must be a non-negative integer`);return i}function ir(t,e){let n=xt(t,e);if(n===null)return null;if(/^(?:[A-Za-z]:|[\\/]|~)/u.test(n)||n.split(/[\\/]/u).includes(".."))throw new Error(`Invalid Classic state: ${e} must be a relative repository path`);return n}function Sw(t,e){let n=xt(t,e);if(n!==null&&!/^[a-f0-9]{64}$/u.test(n))throw new Error(`Invalid Classic state: ${e} must be a sha256 hex digest`);return n}function Cw(t){let e=t.classic_migration;if(e==null||e==="")return null;if(e!==at)throw new Error(`Invalid Classic state: classic_migration must be ${at}`);return e}function Ew(t){if(!_t.some(n=>fu(t,n)))return null;for(let n of bw)if(!fu(t,n))return null;return{workflow:Q(t,"workflow",uu,!1),language:Q(t,"language",aw),phase:Q(t,"phase",ow,!1),contextCompression:Q(t,"context_compression",cw),buildMode:Q(t,"build_mode",lw),buildPause:Q(t,"build_pause",uw),subagentDispatch:Q(t,"subagent_dispatch",fw),tddMode:Q(t,"tdd_mode",dw),reviewMode:Q(t,"review_mode",mw),isolation:Q(t,"isolation",pw),boundBranch:xt(t,"bound_branch"),verifyMode:Q(t,"verify_mode",hw),autoTransition:ko(t,"auto_transition"),baseRef:xt(t,"base_ref"),designDoc:ir(t,"design_doc"),plan:ir(t,"plan"),verifyResult:Q(t,"verify_result",gw,!1),verifyFailures:kw(t,"verify_failures"),verificationReport:ir(t,"verification_report"),branchStatus:Q(t,"branch_status",ww),createdAt:xt(t,"created_at"),verifiedAt:xt(t,"verified_at"),archiveConfirmation:Q(t,"archive_confirmation",yw),archived:ko(t,"archived",!1),directOverride:ko(t,"direct_override"),handoffContext:ir(t,"handoff_context"),handoffHash:Sw(t,"handoff_hash"),classicProfile:Q(t,"classic_profile",uu),classicMigration:Cw(t)}}function Co(t,e){let n=e??null;if(n===null&&e===void 0&&t.run_id&&t.skill)try{n=Zi(t)}catch(i){let r=i instanceof Error?i.message:String(i);throw new Error(r.replace(/^Invalid Run state:/u,"Invalid Classic state:"),{cause:i})}return{classic:Ew(t),run:n,unknownKeys:Object.keys(t).filter(i=>!vw.has(i))}}function du(t){return{workflow:t.workflow,language:t.language,phase:t.phase,context_compression:t.contextCompression,build_mode:t.buildMode,build_pause:t.buildPause,subagent_dispatch:t.subagentDispatch,tdd_mode:t.tddMode,review_mode:t.reviewMode,isolation:t.isolation,bound_branch:t.boundBranch,verify_mode:t.verifyMode,auto_transition:t.autoTransition,base_ref:t.baseRef,design_doc:t.designDoc,plan:t.plan,verify_result:t.verifyResult,verify_failures:t.verifyFailures,verification_report:t.verificationReport,branch_status:t.branchStatus,created_at:t.createdAt,verified_at:t.verifiedAt,archive_confirmation:t.archiveConfirmation,archived:t.archived,direct_override:t.directOverride,handoff_context:t.handoffContext,handoff_hash:t.handoffHash,classic_profile:t.classicProfile,classic_migration:t.classicMigration}}nr();var xw=2*1024*1024;function xn(t){let e=t.toJS();if(e===null)return{};if(typeof e!="object"||Array.isArray(e))throw new Error("Invalid Classic state document: root must be a mapping");return e}function mu(t,e,n){t.get(e)!==n&&t.set(e,n)}function _w(t,e){if(e.classic)for(let[n,i]of Object.entries(du(e.classic)))mu(t,n,i);else for(let n of _t)t.delete(n);yo(t.toJS(),e.run),e.run?mu(t,"run_id",e.run.runId):t.delete("run_id")}function Pw(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 Rw(t){let e=!1;for(let n of["build_command","verify_command"])t.has(n)&&(t.delete(n),e=!0);return e}async function pu(t){let e;try{e=(await U(rr.dirname(t),rr.basename(t),xw,{label:"Classic state document"})).bytes.toString("utf8")}catch(i){if(i.code!=="ENOENT")throw i;return new sr.Document({})}let n=(0,sr.parseDocument)(e);if(n.errors.length>0)throw new Error(`Invalid Classic state document: ${n.errors[0].message}`);return xn(n),n}async function Ue(t,e={}){let n=e.migrate!==!1,i=rr.join(t,".comet.yaml"),r=await pu(i),s=xn(r),o=Rw(r);o&&(s=xn(r));let a=await vo(t);if(!a&&s.run_id&&s.skill){let{runStateFromDocument:c}=await Promise.resolve().then(()=>(nr(),lu));a=c(s),a&&n&&(await tr(t,a),Pw(r),o=!0)}return o&&n&&await ue(i,r.toString(),{containedRoot:t}),Co(xn(r),a)}async function or(t,e,n={}){let i=rr.join(t,".comet.yaml"),r=await pu(i);_w(r,{...e,unknownKeys:e.unknownKeys??[]}),Co(xn(r),e.run??null),await ue(i,r.toString(),{containedRoot:t,beforeCommit:n.beforeCommit}),e.run?await tr(t,e.run):await bo(t)}function hu(t,e,n){return{runId:e,skill:t.definition.metadata.name,skillVersion:t.definition.metadata.version,skillHash:n,orchestration:t.definition.orchestration.mode,currentStep:t.definition.orchestration.entry??null,iteration:0,pending:null,pendingRef:".comet/pending-action.json",trajectoryRef:".comet/trajectory.jsonl",contextRef:".comet/context.md",artifactsRef:".comet/artifacts.json",checkpointRef:".comet/checkpoint.json",status:"running",retries:{}}}import{createHash as Nu,randomUUID as Vw}from"crypto";import{promises as K}from"fs";import F from"path";var yu=He(Ie(),1);import{promises as Eo}from"fs";import ae from"path";var Nw=["invoke_skill","call_tool","handoff","ask_user","checkpoint"],Aw=["deterministic","adaptive"],Ow=["function","mcp","script","agent"],jw=["none","read","write","external"],Tw=["progress","step","completion"],Iw=["artifact_exists","state_equals"];function ct(t,e,n){return new Error(`${t}: ${e} ${n}`)}function ne(t,e,n="document"){if(t===null||typeof t!="object"||Array.isArray(t))throw ct(e,n,"must be an object")}function Ve(t,e,n){if(!Array.isArray(t))throw ct(e,n,"must be an array")}function X(t,e,n){if(typeof t!="string")throw ct(e,n,"must be a string")}function fe(t,e,n,i){e in t&&X(t[e],n,`${i}.${e}`)}function vu(t,e,n,i){if(e in t&&typeof t[e]!="boolean")throw ct(n,`${i}.${e}`,"must be a boolean")}function Je(t,e,n,i){if(typeof t!="string"||!e.includes(t))throw ct(n,i,`must be one of ${e.join(", ")}`)}function ar(t,e,n){Ve(t,e,n),t.forEach((i,r)=>{X(i,e,`${n}[${r}]`)})}function gu(t,e,n){ne(t,e,n),X(t.name,e,`${n}.name`),X(t.description,e,`${n}.description`),vu(t,"required",e,n)}function $w(t,e,n){ne(t,e,n),X(t.id,e,`${n}.id`),fe(t,"source",e,n),fe(t,"version",e,n)}function qw(t,e,n){ne(t,e,n),X(t.id,e,`${n}.id`),X(t.role,e,`${n}.role`),fe(t,"instructions",e,n)}function Lw(t,e,n){ne(t,e,n),X(t.id,e,`${n}.id`),Je(t.kind,Ow,e,`${n}.kind`),X(t.source,e,`${n}.source`),Je(t.sideEffect,jw,e,`${n}.sideEffect`),vu(t,"requiresConfirmation",e,n)}function Dw(t,e,n){ne(t,e,n),Je(t.type,Nw,e,`${n}.type`),fe(t,"ref",e,n),fe(t,"prompt",e,n),fe(t,"question",e,n),"options"in t&&ar(t.options,e,`${n}.options`)}function Fw(t,e,n){ne(t,e,n),X(t.id,e,`${n}.id`),Dw(t.action,e,`${n}.action`),fe(t,"next",e,n),"completionEvals"in t&&ar(t.completionEvals,e,`${n}.completionEvals`)}function Mw(t,e){let n="goal";ne(t,e,n),X(t.statement,e,`${n}.statement`),Ve(t.inputs,e,`${n}.inputs`),t.inputs.forEach((i,r)=>{gu(i,e,`${n}.inputs[${r}]`)}),Ve(t.outputs,e,`${n}.outputs`),t.outputs.forEach((i,r)=>{gu(i,e,`${n}.outputs[${r}]`)}),ar(t.success,e,`${n}.success`)}function Ww(t,e){let n="orchestration";ne(t,e,n),Je(t.mode,Aw,e,`${n}.mode`),fe(t,"entry",e,n),"steps"in t&&(Ve(t.steps,e,`${n}.steps`),t.steps.forEach((i,r)=>{Fw(i,e,`${n}.steps[${r}]`)}))}function bu(t,e){return ne(t,e),Je(t.apiVersion,["comet/v1alpha1"],e,"apiVersion"),Je(t.kind,["Skill"],e,"kind"),ne(t.metadata,e,"metadata"),X(t.metadata.name,e,"metadata.name"),X(t.metadata.version,e,"metadata.version"),X(t.metadata.description,e,"metadata.description"),Mw(t.goal,e),Ww(t.orchestration,e),Ve(t.skills,e,"skills"),t.skills.forEach((n,i)=>{$w(n,e,`skills[${i}]`)}),Ve(t.agents,e,"agents"),t.agents.forEach((n,i)=>{qw(n,e,`agents[${i}]`)}),Ve(t.tools,e,"tools"),t.tools.forEach((n,i)=>{Lw(n,e,`tools[${i}]`)}),t}function ku(t,e){ne(t,e);for(let n of["allowedSkills","allowedAgents","allowedTools","confirmationRequiredFor"])n in t&&ar(t[n],e,n);for(let n of["maxIterations","maxRetriesPerAction"])if(n in t&&(typeof t[n]!="number"||!Number.isFinite(t[n])))throw ct(e,n,"must be a finite number");return t}function Bw(t,e){return ne(t,e),"runtime"in t&&Su(t.runtime,e,"runtime"),t}function Su(t,e,n){return Ve(t,e,n),t.forEach((i,r)=>{let s=`${n}[${r}]`;ne(i,e,s),X(i.id,e,`${s}.id`),Je(i.scope,Tw,e,`${s}.scope`),Je(i.type,Iw,e,`${s}.type`),fe(i,"artifact",e,s),fe(i,"field",e,s),fe(i,"equals",e,s)}),t}async function xo(t){let e=await Eo.readFile(t,"utf8");try{return(0,yu.parse)(e)}catch(n){let i=n instanceof Error?n.message:String(n);throw ct(t,"document",i)}}async function Kw(t){try{return await xo(t)}catch(e){if(e.code==="ENOENT")return null;throw e}}async function wu(t){try{return await Eo.access(t),!0}catch(e){if(e.code==="ENOENT")return!1;throw e}}async function Yw(t){let e=ae.join(t,"checks.yaml"),n=ae.join(t,"evals.yaml"),[i,r]=await Promise.all([wu(e),wu(n)]);if(r)throw new Error(`${n}: evals.yaml is no longer supported; use checks.yaml`);return i?{document:Bw(await xo(e),e)}:{document:null}}async function Cu(t){let e=ae.resolve(t.root),n=ae.resolve(t.controlRoot);t.requireSkillMarkdown&&await Eo.access(ae.join(e,"SKILL.md"));let i=ae.join(n,"skill.yaml"),r=ae.join(n,"guardrails.yaml"),s=bu(await xo(i),i),o=await Kw(r),a=o===null?null:ku(o,r),c=await Yw(n),l={allowedSkills:s.skills.map(d=>d.id),allowedAgents:s.agents.map(d=>d.id),allowedTools:s.tools.map(d=>d.id),maxIterations:50,maxRetriesPerAction:3,confirmationRequiredFor:s.tools.filter(d=>d.requiresConfirmation).map(d=>d.id)};return{root:e,packageKind:t.packageKind==="runtime"?"runtime":void 0,definition:s,guardrails:{...l,...a},evals:c.document?.runtime??[]}}async function Eu(t){let e=ae.resolve(t);return Cu({root:e,controlRoot:ae.join(e,"comet"),packageKind:"skill",requireSkillMarkdown:!0})}async function xu(t){let e=ae.resolve(t);return Cu({root:e,controlRoot:e,packageKind:"runtime",requireSkillMarkdown:!1})}function _u(t,e,n=ae.join(e,"package.json")){ne(t,n);let i=t.packageKind==="runtime"?"runtime":void 0,r=bu(t.definition,n),s=ku(t.guardrails,n),o=Su(t.evals,n,"evals"),a={allowedSkills:r.skills.map(c=>c.id),allowedAgents:r.agents.map(c=>c.id),allowedTools:r.tools.map(c=>c.id),maxIterations:50,maxRetriesPerAction:3,confirmationRequiredFor:r.tools.filter(c=>c.requiresConfirmation).map(c=>c.id)};return{root:ae.resolve(e),packageKind:i,definition:r,guardrails:{...a,...s},evals:o}}import Pu from"path";function Uw(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 Ru(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),Uw(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=Pu.posix.normalize(o.source.replaceAll("\\","/"));(Pu.isAbsolute(o.source)||a===".."||a.startsWith("../"))&&e.push(`script tool ${o.id} must reference a relative path inside the Skill package`)}for(let o of i.allowedSkills)n.skills.some(a=>a.id===o)||e.push(`guardrails allow undeclared skill: ${o}`);for(let o of i.allowedAgents)n.agents.some(a=>a.id===o)||e.push(`guardrails allow undeclared agent: ${o}`);for(let o of i.allowedTools)n.tools.some(a=>a.id===o)||e.push(`guardrails allow undeclared tool: ${o}`);return e}function cr(t){return Array.isArray(t)?t.map(cr):t&&typeof t=="object"?Object.fromEntries(Object.entries(t).sort(([e],[n])=>e.localeCompare(n)).map(([e,n])=>[e,cr(n)])):t}function Jw(t){return cr({...t.packageKind==="runtime"?{packageKind:"runtime"}:{},definition:t.definition,guardrails:t.guardrails,evals:t.evals})}function Hw(t){return F.posix.normalize(t.replaceAll("\\","/"))}function Pt(t,e,n){let i=F.relative(t,e);if(!(i===""||!F.isAbsolute(i)&&!i.startsWith(`..${F.sep}`)))throw new Error(`${n} resolves outside the Skill package`)}async function Au(t,e,n){let i=Hw(e);if(F.posix.isAbsolute(i)||i===".."||i.startsWith("../"))throw new Error(`${n} resolves outside the Skill package`);let r=F.resolve(t,...i.split("/"));Pt(t,r,n);let s;try{s=await K.realpath(r)}catch(o){throw o.code==="ENOENT"?new Error(`${n} does not exist: ${e}`,{cause:o}):o}if(Pt(t,s,n),!(await K.stat(s)).isFile())throw new Error(`${n} is not a file: ${e}`);return{path:i,content:await K.readFile(s)}}async function Gw(t){let e=await K.realpath(t.root),n=t.packageKind==="runtime"?[]:[await Au(e,"SKILL.md","SKILL.md")];for(let i of t.definition.tools)i.kind==="script"&&n.push(await Au(e,i.source,`Script tool ${i.id}`));return n.sort((i,r)=>i.path.localeCompare(r.path))}function zw(t,e){let n=e.map(i=>({path:i.path,sha256:Nu("sha256").update(i.content).digest("hex")}));return Nu("sha256").update(JSON.stringify(cr({package:t,files:n}))).digest("hex")}function Tu(t){return JSON.stringify(t,null,2)+`
147
+ `}async function Iu(t){let e=Jw(t),n=await Gw(t);return{document:e,files:n,hash:zw(e,n)}}async function lr(t){return(await Iu(t)).hash}async function Ou(t){try{return await K.access(t),!0}catch(e){if(e.code==="ENOENT")return!1;throw e}}async function ju(t,e){try{if((await K.readFile(F.join(t,"sha256"),"utf8")).trim()!==e.hash)throw new Error("hash mismatch");if(await K.readFile(F.join(t,"package.json"),"utf8")!==Tu(e.document))throw new Error("package mismatch");for(let r of e.files)if(!(await K.readFile(F.join(t,...r.path.split("/")))).equals(r.content))throw new Error(`file mismatch: ${r.path}`)}catch(n){throw new Error(`Existing Skill snapshot is invalid: ${e.hash}`,{cause:n})}}async function _o(t,e){let n=await Iu(t),i=F.resolve(e,".comet","skill-snapshots"),r=F.join(i,n.hash);if(await K.mkdir(i,{recursive:!0}),await Ou(r))return await ju(r,n),{hash:n.hash,snapshotDir:r};let s=F.join(i,`.tmp-${Vw()}`);Pt(i,s,"Temporary snapshot"),Pt(i,r,"Published snapshot");try{await K.mkdir(s);for(let o of n.files){let a=F.join(s,...o.path.split("/"));Pt(s,a,`Snapshot file ${o.path}`),await K.mkdir(F.dirname(a),{recursive:!0}),await K.writeFile(a,o.content)}await K.writeFile(F.join(s,"package.json"),Tu(n.document)),await K.writeFile(F.join(s,"sha256"),n.hash+`
148
+ `),await K.rename(s,r)}catch(o){if(await Ou(r)){try{await ju(r,n)}finally{await K.rm(s,{recursive:!0,force:!0})}return{hash:n.hash,snapshotDir:r}}throw await K.rm(s,{recursive:!0,force:!0}),o}return{hash:n.hash,snapshotDir:r}}async function Po(t,e){if(!/^[a-f0-9]{64}$/u.test(e))throw new Error(`Invalid Skill snapshot hash: ${e}`);let n=F.resolve(t,".comet","skill-snapshots"),i=F.join(n,e);Pt(n,i,"Skill snapshot");try{let r=(await K.readFile(F.join(i,"sha256"),"utf8")).trim();if(r!==e)throw new Error(`stored hash is ${r||"(empty)"}`);let s=F.join(i,"package.json"),o=JSON.parse(await K.readFile(s,"utf8")),a=_u(o,i,s),c=Ru(a);if(c.length>0)throw new Error(c.map(d=>` - ${d}`).join(`
149
+ `));let l=await lr(a);if(l!==e)throw new Error(`calculated hash is ${l}`);return a}catch(r){throw new Error(`Skill snapshot is invalid or missing: ${e}`,{cause:r})}}async function $u(t){try{return await Ro.access(t),!0}catch(e){if(e.code==="ENOENT")return!1;throw e}}function qu(t){return Qw("sha256").update(t).digest("hex")}function Zw(t){return qu(JSON.stringify(Object.fromEntries(Object.entries(t).sort(([e],[n])=>e.localeCompare(n)))))}function ey(t){return t.replaceAll(".","_").replaceAll("-","_")}async function ty(t,e){let n=await st(t),i=Object.fromEntries(e.filter(o=>o.satisfied&&o.source).map(o=>[ey(o.code),o.source])),r=ke.join(t,"subagent-progress.md");await $u(r)&&(i.subagent_progress=ke.relative(n,r).split(ke.sep).join("/"));let s=e.find(o=>o.code==="design.handoff"&&o.satisfied);return s?.source&&(i.handoff_context=s.source),i}function ny(t,e,n){return[{sequence:1,timestamp:n,type:"run_started",runId:t.runId,data:{skill:t.skill,skillVersion:t.skillVersion,skillHash:t.skillHash}},{sequence:2,timestamp:n,type:"state_migrated",runId:t.runId,data:{kind:"classic",migrationVersion:at,profile:e,source:"pre-migration"}}]}async function iy(t){await Promise.all(t.map(e=>Ro.rm(e,{recursive:!0,force:!0})))}async function Lu(t,e){let n=await Ue(t);if(!n.classic)throw new Error("Classic migration requires a legacy state projection");let i=n.classic,r=i.classicProfile??i.workflow;if(n.run){if(i.classicMigration!==at)throw new Error("Classic Run exists without a supported classic_migration marker");if(n.run.skill!==e.skillPackage.definition.metadata.name)throw new Error(`Classic Run skill mismatch: expected ${e.skillPackage.definition.metadata.name}, got ${n.run.skill}`);if(await lr(e.skillPackage)!==n.run.skillHash)return await Po(t,n.run.skillHash),{classic:i,run:n.run,evidence:await Ye(t,n),migrated:!1,snapshotDir:ke.join(t,".comet","skill-snapshots",n.run.skillHash)};let f=await _o(e.skillPackage,t);return{classic:i,run:n.run,evidence:await Ye(t,n),migrated:!1,snapshotDir:f.snapshotDir}}let s=await Ye(t,n),o=Et(i,s);if(!e.skillPackage.definition.orchestration.steps?.some(u=>u.id===o))throw new Error(`Classic Skill package does not define resolved step: ${o}`);let a=await lr(e.skillPackage),c=ke.join(t,".comet","skill-snapshots",a),l=await $u(c),d=[];try{let u=await _o(e.skillPackage,t),f=hu(e.skillPackage,e.runId?.()??Xw(),u.hash);f.currentStep=o,o==="completed"&&(f.status="completed");let h={...i,classicProfile:r,classicMigration:at},w=await ty(t,s),m=await st(t),p=s.find(C=>C.code==="design.handoff"&&C.satisfied),g=null;p?.source&&(g=await te(m,p.resolvedSource??p.source,{label:"Classic migration handoff context",hooks:e.handoffReadHooks}),await zl(t,f.contextRef,g),d.push(ke.resolve(t,f.contextRef))),await Gl(t,f.artifactsRef,w),d.push(ke.resolve(t,f.artifactsRef));let y=(e.now?.()??new Date).toISOString(),k={runId:f.runId,stateVersion:1,trajectoryOffset:2,contextHash:g===null?null:qu(g),artifactsHash:Zw(w),createdAt:y};await Ql(t,f.checkpointRef,k),d.push(ke.resolve(t,f.checkpointRef)),d.push(ke.resolve(t,f.trajectoryRef));for(let C of ny(f,r,y))await pn(t,f.trajectoryRef,C);return await or(t,{classic:h,run:f,unknownKeys:n.unknownKeys}),{classic:h,run:f,evidence:s,migrated:!0,snapshotDir:u.snapshotDir}}catch(u){throw await iy(d),l||await Ro.rm(c,{recursive:!0,force:!0}),u}}async function ry(t){try{return(await Du.stat(t)).isDirectory()}catch(e){if(e.code==="ENOENT")return!1;throw e}}async function ur(t){try{return(await Du.stat(t)).isFile()}catch(e){if(e.code==="ENOENT")return!1;throw e}}async function sy(t){return await ry(t)?await ur(ie.join(t,"skill.yaml"))?!0:await ur(ie.join(t,"SKILL.md"))&&await ur(ie.join(t,"comet","skill.yaml")):!1}function oy(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 ay(){let t=ie.dirname(Fu(import.meta.url)),e=[process.env.COMET_RUNTIME_CLASSIC_ROOT,ie.resolve(t,"..","runtime","classic"),ie.resolve(t,"..","..","comet","runtime","classic"),ie.resolve(t,"..","..","assets","skills","comet","runtime","classic"),ie.resolve("assets","skills","comet","runtime","classic"),process.env.COMET_CLASSIC_SKILL_ROOT,ie.resolve(t,"..","..","comet-classic"),ie.resolve(t,"..","..","assets","skills","comet-classic"),ie.resolve("assets","skills","comet-classic")].filter(n=>!!n);for(let n of e)if(await sy(n))return n;return null}async function cy(t){return await ur(ie.join(t,"skill.yaml"))?xu(t):Eu(t)}async function fr(t){let e=await ay();return Lu(t,{skillPackage:e?await cy(e):oy(ie.dirname(Fu(import.meta.url)))})}async function Mu(t){let e=await Ue(t),n=Array.from(new Set(e.unknownKeys)).sort();if(n.length>0)throw new Error(`Invalid Classic state: unknown field(s): ${n.join(", ")}`);return fr(t)}async function Wu(t,e,n,i){let r=await Ue(t);if(!r.classic||!r.run)throw new Error("Classic transition requires synchronized Classic and Run projections");let s=await Ye(t,{classic:e,run:n,unknownKeys:r.unknownKeys}),o=Et(e,s),a={...n,currentStep:o,iteration:n.iteration+1,status:o==="completed"?"completed":"running"};await or(t,{classic:e,run:a,unknownKeys:r.unknownKeys});let c=await Vi(t,a.trajectoryRef);return await pn(t,a.trajectoryRef,{sequence:c.length+1,timestamp:new Date().toISOString(),type:"state_transitioned",runId:a.runId,data:{kind:"classic",fromStep:n.currentStep,toStep:o,...i}}),a}var Bu={"full.open":["openspec.proposal","openspec.tasks"],"full.design.handoff":["openspec.proposal","openspec.design","openspec.tasks"],"full.design.document":["design.handoff"],"full.build.plan":["openspec.tasks"],"full.build.plan-ready":["build.plan"],"full.build.configure":["build.plan"],"full.build.execute":["build.plan"],"full.build.complete":["build.tasks-complete"],"full.verify.run":["build.tasks-complete"],"full.verify.branch":["verification.report"],"full.archive.confirm":["verification.report"],"full.archive.execute":["archive.confirmed"]};function ly(t){return Bu[t]?Bu[t]:t.endsWith(".open")?["openspec.proposal","openspec.tasks"]:t.endsWith(".build.execute")?[]:t.endsWith(".build.complete")?["build.tasks-complete"]:t.endsWith(".verify.run")?["build.tasks-complete"]:t.endsWith(".verify.branch")?["verification.report"]:t.endsWith(".archive.confirm")?["verification.report"]:t.endsWith(".archive.execute")?["archive.confirmed"]:[]}function Ku(t,e){let n=ly(t),i=n.filter(r=>!ot(e,r));return{stepId:t,passed:i.length===0,requiredEvidence:n,missingEvidence:i}}function uy(t){switch(t){case"open":return"/comet-open";case"design":return"/comet-design";case"build":return"/comet-build";case"verify":return"/comet-verify";case"archive":return"/comet-archive";default:return null}}async function Yu(t,e){try{let n=await Mu(t),i=await Ye(t,{classic:n.classic,run:n.run,unknownKeys:[]}),r=Et(n.classic,i);return{name:e,valid:!0,workflow:n.classic.workflow,phase:n.classic.phase,currentStep:r,nextCommand:uy(n.classic.phase),runtimeMode:"engine-projection",runtimeEval:Ku(r,i),evidence:i}}catch(n){return{name:e,valid:!1,workflow:"unknown",phase:"invalid",currentStep:null,nextCommand:null,runtimeMode:"invalid",runtimeEval:null,evidence:[],error:n instanceof Error?n.message:String(n)}}}Yi();import fy from"path";var dy=fy.join(".comet","state-events.jsonl"),my=8*1024*1024;async function Uu(t,e){let n={schemaVersion:1,timestamp:new Date().toISOString(),...e};return await Ki(t,dy,`${JSON.stringify(n)}
150
+ `,my,"Classic state event log"),n}var 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"]}},Vu={open:"open-complete",design:"design-complete",build:"build-complete",verify:"verify-pass"};function hy(t){return t.toISOString().slice(0,10)}function R(t,e,n,i){let r=t[n];t[n]=i,r!==i&&e.push({field:n,from:r,to:i})}function Ju(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")R(r,s,"phase",r.workflow==="full"?"design":"build");else if(e==="design-complete")R(r,s,"phase","build");else if(e==="build-complete"){let a=r.verifyResult==="fail";R(r,s,"phase","verify"),R(r,s,"verifyResult","pending"),R(r,s,"branchStatus","pending"),a||R(r,s,"verificationReport",null)}else if(e==="verify-pass")R(r,s,"verifyResult","pass"),R(r,s,"verifyFailures",0),R(r,s,"phase","archive"),R(r,s,"verifiedAt",hy(o)),R(r,s,"archiveConfirmation","pending"),R(r,s,"branchStatus","pending");else if(e==="verify-fail")R(r,s,"verifyResult","fail"),R(r,s,"verifyFailures",r.verifyFailures+1),R(r,s,"phase","build"),R(r,s,"branchStatus","pending");else if(e==="preset-escalate"){if(r.workflow!=="hotfix"&&r.workflow!=="tweak")throw new Error(`Cannot apply ${e}: workflow must be hotfix or tweak, got '${r.workflow}'`);R(r,s,"workflow","full"),R(r,s,"classicProfile","full"),R(r,s,"phase","design"),R(r,s,"designDoc",null),R(r,s,"buildPause",null),R(r,s,"buildMode",null),R(r,s,"subagentDispatch",null),R(r,s,"tddMode",null),R(r,s,"reviewMode",null),R(r,s,"isolation",null),R(r,s,"boundBranch",null),R(r,s,"verifyMode",null),R(r,s,"directOverride",null)}else if(e==="archive-confirm"){if(r.verifyResult!=="pass")throw new Error(`Cannot apply ${e}: verifyResult must be pass`);if(r.archived)throw new Error(`Cannot apply ${e}: already archived`);R(r,s,"archiveConfirmation","confirmed")}else if(e==="archive-reopen"){if(r.archived)throw new Error(`Cannot apply ${e}: already archived`);R(r,s,"verifyResult","pending"),R(r,s,"verifyFailures",0),R(r,s,"phase","verify"),R(r,s,"verifiedAt",null),R(r,s,"archiveConfirmation",null),R(r,s,"branchStatus","pending")}else{if(r.verifyResult!=="pass")throw new Error(`Cannot apply ${e}: verifyResult must be pass`);if(r.archiveConfirmation!=="confirmed")throw new Error(`Cannot apply ${e}: archiveConfirmation must be confirmed`);R(r,s,"archived",!0)}return{classic:r,effects:s,definition:i}}var Nn=He(Ie(),1);import Gu from"path";import{AsyncLocalStorage as gy}from"async_hooks";import{promises as Hu}from"fs";import _n from"path";var dr=new gy;function wy(t,e){let n=_n.relative(t,e);return n===""||!_n.isAbsolute(n)&&n!==".."&&!n.startsWith(`..${_n.sep}`)}async function yy(t){let e=_n.resolve(t.invocationCwd??process.cwd()),n=_n.resolve(t.projectRoot??await st(e)),[i,r]=await Promise.all([Hu.realpath(e),Hu.realpath(n)]);if(!wy(r,i))throw new Error(`Classic command invocation cwd is outside the discovered project: ${e}`);return{invocationCwd:e,projectRoot:n}}async function mr(t,e){let n=dr.getStore();if(n)return e(n);let i=await yy(t);return dr.run(i,()=>e(i))}function I(){let t=dr.getStore();if(!t)throw new Error("Classic command project context is unavailable");return t.projectRoot}function pr(){let t=dr.getStore();if(!t)throw new Error("Classic command invocation context is unavailable");return t.invocationCwd}var vy="\x1B[32m",Pn="\x1B[31m",by="\x1B[33m",ky="\x1B[0m",Sy=["workflow","phase","design_doc","plan","build_mode","isolation","verify_mode","verify_result","verified_at","archived"],Cy={workflow:["full","hotfix","tweak"],language:["en","zh-CN"],phase:["open","design","build","verify","archive"],context_compression:["off","beta"],build_mode:["subagent-driven-development","executing-plans","direct"],build_pause:["plan-ready"],subagent_dispatch:["confirmed"],tdd_mode:["tdd","direct"],review_mode:["off","standard","thorough"],isolation:["current","branch","worktree"],verify_mode:["light","full"],auto_transition:["true","false"],verify_result:["pending","pass","fail"],branch_status:["pending","handled"],archive_confirmation:["pending","confirmed"],archived:["true","false"],direct_override:["true","false"],classic_profile:["full","hotfix","tweak"],classic_migration:["1"]},Ey=new Set([..._t,...So,"classic_profile","classic_migration"]);function lt(t,e){return`${t}${e}${ky}`}function Rn(t){return t==null?"":typeof t=="object"?JSON.stringify(t):String(t)}var zu=async(t,e)=>mr(e,async()=>{let n=t[0],i=vn(n);if(i)return{exitCode:1,stderr:lt(Pn,`ERROR: ${i}`)};let r=I(),{directory:s,label:o}=await Qi(n,r),a=Gu.join(s,".comet.yaml"),c=[`[VALIDATE] ${o}/.comet.yaml`],l=0,d=0,u=p=>{l+=1,c.push(lt(Pn,` FAIL: ${p}`))},f=p=>{d+=1,c.push(lt(by,` WARN: ${p}`))},h;try{h=await te(r,a,{label:`Classic state ${o}/.comet.yaml`})}catch(p){if(p.code==="ENOENT")return u(".comet.yaml does not exist"),c.push("",lt(Pn,`${l} error(s), ${d} warning(s) — validation FAILED`)),{exitCode:1,stderr:c.join(`
151
+ `)};throw p}let w=(0,Nn.parseDocument)(h);if(w.errors.length>0||!(0,Nn.isMap)(w.contents)){for(let p of w.errors)u(p.message);return(0,Nn.isMap)(w.contents)||u("document root must be a mapping"),c.push("",lt(Pn,`${l} error(s), ${d} warning(s) — validation FAILED`)),{exitCode:1,stderr:c.join(`
152
+ `)}}let m=w.toJS();for(let p of Sy)Object.prototype.hasOwnProperty.call(m,p)||u(`missing required field '${p}'`);for(let[p,g]of Object.entries(Cy)){if(!Object.prototype.hasOwnProperty.call(m,p))continue;let y=Rn(m[p]);if(!y){p==="auto_transition"&&u(`${p}='' is not valid. Expected: ${g.join(" ")}`);continue}g.includes(y)||u(`${p}='${y}' is not valid. Expected: ${g.join(" ")}`)}if(Object.prototype.hasOwnProperty.call(m,"bound_branch")){let p=m.bound_branch;p!==null&&typeof p!="string"&&u(`bound_branch='${Rn(p)}' is not a string or null`)}if(Object.prototype.hasOwnProperty.call(m,"verify_failures")){let p=m.verify_failures;(typeof p!="number"||!Number.isInteger(p)||p<0)&&u(`verify_failures='${Rn(p)}' is not a non-negative integer`)}for(let p of["design_doc","plan","handoff_context","verification_report"]){let g=Rn(m[p]);if(g){if(/^(?:[A-Za-z]:|[\\/]|~)/u.test(g)||g.split(/[\\/]/u).includes("..")){u(`${p}='${g}' must be a relative repository path`);continue}try{await yn(r,Gu.resolve(r,g),{label:`${p} artifact pointer`,expected:"file"})||u(`${p}='${g}' does not exist on disk`)}catch(y){u(`${p}='${g}' is unsafe: ${y instanceof Error?y.message:String(y)}`)}}}for(let p of["handoff_hash"]){let g=Rn(m[p]);g&&!/^[a-f0-9]{64}$/u.test(g)&&u(`${p}='${g}' is not a sha256 hex digest`)}for(let p of Object.keys(m))Ey.has(p)||f(`unknown field '${p}' found`);return c.push(""),l>0?(c.push(lt(Pn,`${l} error(s), ${d} warning(s) — validation FAILED`)),{exitCode:1,stderr:c.join(`
153
+ `)}):(c.push(lt(vy,`0 errors, ${d} warning(s) — validation PASSED`)),{exitCode:0,stderr:c.join(`
154
+ `)})});lo();it();import xy from"os";import hr from"path";function _y(t={}){let e=t.cwd??process.cwd(),n=t.homeDir??xy.homedir(),i=[{file:hr.resolve(e,".comet","config.yaml"),source:".comet/config.yaml",scope:"project"},{file:hr.resolve(n,".comet","config.yaml"),source:"~/.comet/config.yaml",scope:"global"}];return i.filter((r,s)=>i.findIndex(o=>o.file===r.file)===s)}async function Qu(t,e={}){for(let n of _y(e)){let i=hr.dirname(hr.dirname(n.file)),r=n.scope==="global"?(await co(i))?.classic:(await We(i,{allowPartialProject:!0}))?.value.classic;if(!r||typeof r!="object"||Array.isArray(r))continue;let s=r[t];if(s!=null)return{value:String(s),source:n.source}}return null}it();var Ao=He(Ie(),1);import{execFileSync as Xu}from"child_process";import{randomUUID as Ny}from"crypto";import{promises as An}from"fs";import Zu from"path";var Py=null;function Ry(t,e){let n=t;for(let i of e)n+="\0"+(typeof i=="string"?i:JSON.stringify(i));return n}function No(t,e){return(...n)=>{let i=Py;if(i===null)return e(...n);let r=Ry(`sync:${t}`,n),s=i.entries.get(r);if(s)return s.value;let o=e(...n);return i.entries.set(r,{value:o}),o}}function Ay(t){try{let e=Xu("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 Oy=No("liveGitBranch",t=>Ay(t));function jy(t){try{return Xu("git",["rev-parse","--is-inside-work-tree"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()==="true"}catch{return!1}}var Ty=No("isGitWorkTree",t=>jy(t)),Iy=["current","branch","worktree"];function ef(t){return Iy.includes(t)}function $y(t){return ef(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 tf(t,e){let n=Zu.join(t,".comet.yaml"),i=(0,Ao.parseDocument)(await An.readFile(n,"utf8"),{uniqueKeys:!1});if(i.errors.length>0)throw new Error(`Invalid .comet.yaml: ${i.errors[0].message}`);let r=i.toJS()??{},s=typeof r.isolation=="string"?r.isolation:null,o=typeof r.bound_branch=="string"&&r.bound_branch!==""?r.bound_branch:null,a=ef(s),c=Oy(e.cwd),l=a&&o===null&&c===null?Ty(e.cwd):!0,d=$y({isolation:s,boundBranch:o,currentBranch:c,gitWorkTree:l});return d.status==="needs-heal"&&e.heal?(await qy(t,d.branch),{status:"healed",branch:d.branch,bindingRequired:a,currentBranch:c}):{...d,bindingRequired:a,currentBranch:c}}async function qy(t,e){let n=Zu.join(t,".comet.yaml"),i=(0,Ao.parseDocument)(await An.readFile(n,"utf8"),{uniqueKeys:!1});i.set("bound_branch",e);let r=`${n}.${Ny()}.tmp`;try{await An.writeFile(r,i.toString(),"utf8"),await An.rename(r,n)}catch(s){throw await An.rm(r,{force:!0}),s}}function Ly(t){return t??"detached HEAD"}function nf(t,e,n){return`change '${t}' is bound to branch '${e}', but current branch is '${Ly(n)}'.
155
+ Next: ask the user to confirm — switch back to '${e}', or run \`comet state rebind ${t}\` after explicit confirmation.`}function rf(t){return`change '${t}' uses a branch-bound workspace mode but has no bound branch and HEAD is detached; checkout a branch first before continuing.`}var My="\x1B[32m",Wy="\x1B[31m",By="\x1B[33m",Io="\x1B[0m",Ky=["open","design","build","verify","archive"],Yy={open:"=== Guard: open → next ===",design:"=== Guard: design → build ===",build:"=== Guard: build → verify ===",verify:"=== Guard: verify → archive ===",archive:"=== Guard: archive completeness ==="},Uy={open:" [APPLY] .comet.yaml updated: phase=PLACEHOLDER",design:" [APPLY] .comet.yaml updated: phase=build",build:" [APPLY] .comet.yaml updated: phase=verify, verify_result=pending",verify:" [APPLY] .comet.yaml updated: phase=archive, verify_result=pass"},Vy={branchStatus:"branch_status",phase:"phase",verificationReport:"verification_report",verifiedAt:"verified_at",verifyResult:"verify_result"};function Rt(t){return`${My}${t}${Io}`}function Se(t){return`${Wy}${t}${Io}`}function Jy(t){return`${By}${t}${Io}`}function Hy(t){return Vy[t]??String(t)}function Gy(t){return t===null?"null":t===void 0?"":typeof t=="object"?JSON.stringify(t):String(t)}var de=class extends Error{constructor(n,i=1){super(n);this.exitCode=i}exitCode},To=class{stderr=[];diagnostics;toResult(e=0){return{exitCode:e,...this.diagnostics?{stdout:JSON.stringify({diagnostics:this.diagnostics})+`
156
156
  `}:{},...this.stderr.length>0?{stderr:this.stderr.join(`
157
157
  `)+`
158
- `}:{}}}};async function Y(t){let e=I();return yn(e,t,{label:`Classic guard path ${T.relative(e,T.resolve(e,t)).replaceAll("\\","/")}`})}async function H(t){let e=I();return nu(e,t,`Classic guard file ${T.relative(e,T.resolve(e,t)).replaceAll("\\","/")}`)}function Jy(t){let e=vn(t);if(e)throw new fe(Se(`ERROR: ${e}`))}async function Hy(t){return(await zi(t,I())).directory}async function A(t,e){let n=T.join(t,".comet.yaml"),i=(0,sf.parseDocument)(await te(I(),n,{label:`Classic state ${t}/.comet.yaml`}),{uniqueKeys:!1});if(i.errors.length>0)throw new fe(`ERROR: Invalid .comet.yaml: ${i.errors[0].message}`);let s=i.toJS()[e];return s==null?"":typeof s=="object"?JSON.stringify(s):String(s)}async function Gy(t,e){let n=await A(e,t);return n&&n!=="null"?n:(await Gu(t,{cwd:I()}))?.value??""}async function zy(t){let e=await Gy("language",t);if(!e)return"en";if(e==="en"||e==="zh-CN")return e;throw new Error(`configured language '${e}' is invalid; expected en or zh-CN.`)}function Qy(t){let e=[],n=!1;for(let i of t.split(/\r?\n/u)){if(/^\s*```/u.test(i)){n=!n;continue}n||e.push(i)}return e.join(`
159
- `)}function Xy(t){return t.match(/[\u4e00-\u9fff]/gu)?.length??0}function Zy(t){return t.match(/[A-Za-z][A-Za-z0-9_-]{2,}/gu)?.length??0}async function he(t,e){let n=await zy(t),i=Qy(await te(I(),e,{label:`Classic language-check artifact ${e}`})),r=Xy(i),s=Zy(i);return n==="zh-CN"&&r<20&&s>=20?S(`configured language is zh-CN, but ${e} appears to be English-dominant (cjk_chars=${r}, english_words=${s}).
158
+ `}:{}}}};async function Y(t){let e=I();return yn(e,t,{label:`Classic guard path ${T.relative(e,T.resolve(e,t)).replaceAll("\\","/")}`})}async function G(t){let e=I();return ru(e,t,`Classic guard file ${T.relative(e,T.resolve(e,t)).replaceAll("\\","/")}`)}function zy(t){let e=vn(t);if(e)throw new de(Se(`ERROR: ${e}`))}async function Qy(t){return(await Qi(t,I())).directory}async function O(t,e){let n=T.join(t,".comet.yaml"),i=(0,af.parseDocument)(await te(I(),n,{label:`Classic state ${t}/.comet.yaml`}),{uniqueKeys:!1});if(i.errors.length>0)throw new de(`ERROR: Invalid .comet.yaml: ${i.errors[0].message}`);let s=i.toJS()[e];return s==null?"":typeof s=="object"?JSON.stringify(s):String(s)}async function Xy(t,e){let n=await O(e,t);return n&&n!=="null"?n:(await Qu(t,{cwd:I()}))?.value??""}async function Zy(t){let e=await Xy("language",t);if(!e)return"en";if(e==="en"||e==="zh-CN")return e;throw new Error(`configured language '${e}' is invalid; expected en or zh-CN.`)}function ev(t){let e=[],n=!1;for(let i of t.split(/\r?\n/u)){if(/^\s*```/u.test(i)){n=!n;continue}n||e.push(i)}return e.join(`
159
+ `)}function tv(t){return t.match(/[\u4e00-\u9fff]/gu)?.length??0}function nv(t){return t.match(/[A-Za-z][A-Za-z0-9_-]{2,}/gu)?.length??0}async function he(t,e){let n=await Zy(t),i=ev(await te(I(),e,{label:`Classic language-check artifact ${e}`})),r=tv(i),s=nv(i);return n==="zh-CN"&&r<20&&s>=20?S(`configured language is zh-CN, but ${e} appears to be English-dominant (cjk_chars=${r}, english_words=${s}).
160
160
  Next: regenerate or rewrite this artifact in Chinese while preserving necessary technical terms.`):n==="en"&&r>20&&r>s?S(`configured language is en, but ${e} appears to be Chinese-dominant (cjk_chars=${r}, english_words=${s}).
161
- Next: regenerate or rewrite this artifact in English while preserving necessary technical terms.`):_()}async function of(t){return rf("sha256").update(await Hi(I(),t,{label:`Classic handoff source ${t}`})).digest("hex")}async function $o(t){let e=z(I(),t),n=[`${e}/proposal.md`,`${e}/design.md`,`${e}/tasks.md`],i=`${e}/specs`;if(await Y(i)){await We(I(),i,{label:`Classic delta-spec directory ${i}`,expected:"directory"});for(let r of(await qy.readdir(i)).sort()){let s=`${i}/${r}/spec.md`;await Y(s)&&n.push(s)}}return n}async function ev(t){let e=[];for(let n of await $o(t))await Y(n)&&e.push(`path:${n}`,`sha256:${await of(n)}`);return rf("sha256").update(e.join(`
162
- `)).digest("hex")}async function tv(t,e){if(!await Y(t))throw new fe(Se(`FATAL: change directory not found: ${t}`));if(!await Y(T.join(t,".comet.yaml")))throw new fe(Se(`FATAL: .comet.yaml not found in ${t}`));await We(I(),T.join(t,".comet"),{label:`Classic runtime directory for ${e}`,expected:"directory"});let n=await Hu([e],{json:!1});if(n.exitCode!==0)throw n.stderr&&process.stderr.write(n.stderr.endsWith(`
161
+ Next: regenerate or rewrite this artifact in English while preserving necessary technical terms.`):_()}async function cf(t){return of("sha256").update(await Gi(I(),t,{label:`Classic handoff source ${t}`})).digest("hex")}async function $o(t){let e=z(I(),t),n=[`${e}/proposal.md`,`${e}/design.md`,`${e}/tasks.md`],i=`${e}/specs`;if(await Y(i)){await Ke(I(),i,{label:`Classic delta-spec directory ${i}`,expected:"directory"});for(let r of(await Fy.readdir(i)).sort()){let s=`${i}/${r}/spec.md`;await Y(s)&&n.push(s)}}return n}async function iv(t){let e=[];for(let n of await $o(t))await Y(n)&&e.push(`path:${n}`,`sha256:${await cf(n)}`);return of("sha256").update(e.join(`
162
+ `)).digest("hex")}async function rv(t,e){if(!await Y(t))throw new de(Se(`FATAL: change directory not found: ${t}`));if(!await Y(T.join(t,".comet.yaml")))throw new de(Se(`FATAL: .comet.yaml not found in ${t}`));await Ke(I(),T.join(t,".comet"),{label:`Classic runtime directory for ${e}`,expected:"directory"});let n=await zu([e],{json:!1});if(n.exitCode!==0)throw n.stderr&&process.stderr.write(n.stderr.endsWith(`
163
163
  `)?n.stderr:`${n.stderr}
164
- `),new fe(Se("FATAL: .comet.yaml schema validation failed"));let i=await Ke(t),r=Array.from(new Set(i.unknownKeys)).sort();if(r.length>0)throw new fe(Se(`FATAL: .comet.yaml has unknown field(s): ${r.join(", ")}`))}function nv(t,e){if(e.passed){if(t.stderr.push(Rt(` [PASS] ${e.description}`)),e.detail)for(let n of e.detail.split(`
164
+ `),new de(Se("FATAL: .comet.yaml schema validation failed"));let i=await Ue(t),r=Array.from(new Set(i.unknownKeys)).sort();if(r.length>0)throw new de(Se(`FATAL: .comet.yaml has unknown field(s): ${r.join(", ")}`))}function sv(t,e){if(e.passed){if(t.stderr.push(Rt(` [PASS] ${e.description}`)),e.detail)for(let n of e.detail.split(`
165
165
  `))t.stderr.push(Rt(` ${n}`))}else if(t.stderr.push(Se(` [FAIL] ${e.description}`)),e.detail)for(let n of e.detail.split(`
166
- `))t.stderr.push(Se(` ${n}`))}function E(t,e){return async()=>{try{let n=await e();return{description:t,passed:n.passed,detail:("detail"in n?n.detail:"")??""}}catch(n){return{description:t,passed:!1,detail:n instanceof Error?n.message:String(n)}}}}function _(t){return{passed:!0,...t?{detail:t}:{}}}function S(t){return{passed:!1,detail:t}}async function Nt(t,e){let n=!1;for(let i of e){let r=await i();nv(t,r),r.passed||(n=!0)}return n}var iv=["package.json with a build script","pom.xml","Cargo.toml"];async function rv(t){try{let e=await Me(I(),{allowPartialProject:!0});return e?Object.prototype.hasOwnProperty.call(e.value,t):!1}catch(e){throw new Error(`.comet/config.yaml is invalid YAML (${e instanceof Error?e.message:String(e)}); cannot check for removed "${t}" field. Fix the config and retry.`,{cause:e})}}function sv(t){return{status:1,output:`${t} has been removed from .comet/config.yaml. Delete this field and run any required ${t==="build_command"?"build":"verification"} command manually before retrying.`}}function ov(t){let e=$y(t,{shell:!0,cwd:pr(),encoding:"utf8",timeout:3e5});return{status:e.status??1,output:`${e.stdout??""}${e.stderr??""}`.replace(/\n+$/u,"")}}function An(t){return T.resolve(pr(),t)}async function av(){let t=An("package.json");return await Y(t)&&typeof JSON.parse(await te(I(),t,{label:"package.json"})).scripts?.build=="string"?"npm run build":await Y(An("pom.xml"))?process.platform==="win32"?await Y(An("mvnw.cmd"))?"mvnw.cmd compile -q":"mvn.cmd compile -q":await Y(An("mvnw"))?"./mvnw compile -q":"mvn compile -q":await Y(An("Cargo.toml"))?"cargo build":null}function nf(t){return`Evidence: recorded command-check at ${t.timestamp}; command: ${t.command}; cwd: ${t.cwd}`}function Ao(t,e,n){return`comet state record-check ${t} ${e} --command "${n}" --exit-code 0`}async function af(t,e,n,i){if(process.env.COMET_SKIP_BUILD==="1")return{status:0,output:"SKIPPED via COMET_SKIP_BUILD=1"};let r=i==="build"?["build_command"]:["verify_command","build_command"];for(let a of r)if(await rv(a))return sv(a);let s=i==="build"?await av():null;if(s)return ov(s);let o=await Ql(I(),t,n,i);return o?o.exitCode!==0?{status:o.exitCode,output:`Latest recorded ${i} check failed with exit code ${o.exitCode}.
167
- ${nf(o)}
166
+ `))t.stderr.push(Se(` ${n}`))}function E(t,e){return async()=>{try{let n=await e();return{description:t,passed:n.passed,detail:("detail"in n?n.detail:"")??""}}catch(n){return{description:t,passed:!1,detail:n instanceof Error?n.message:String(n)}}}}function _(t){return{passed:!0,...t?{detail:t}:{}}}function S(t){return{passed:!1,detail:t}}async function Nt(t,e){let n=!1;for(let i of e){let r=await i();sv(t,r),r.passed||(n=!0)}return n}var ov=["package.json with a build script","pom.xml","Cargo.toml"];async function av(t){try{let e=await We(I(),{allowPartialProject:!0});return e?Object.prototype.hasOwnProperty.call(e.value,t):!1}catch(e){throw new Error(`.comet/config.yaml is invalid YAML (${e instanceof Error?e.message:String(e)}); cannot check for removed "${t}" field. Fix the config and retry.`,{cause:e})}}function cv(t){return{status:1,output:`${t} has been removed from .comet/config.yaml. Delete this field and run any required ${t==="build_command"?"build":"verification"} command manually before retrying.`}}function lv(t){let e=Dy(t,{shell:!0,cwd:pr(),encoding:"utf8",timeout:3e5});return{status:e.status??1,output:`${e.stdout??""}${e.stderr??""}`.replace(/\n+$/u,"")}}function On(t){return T.resolve(pr(),t)}async function uv(){let t=On("package.json");return await Y(t)&&typeof JSON.parse(await te(I(),t,{label:"package.json"})).scripts?.build=="string"?"npm run build":await Y(On("pom.xml"))?process.platform==="win32"?await Y(On("mvnw.cmd"))?"mvnw.cmd compile -q":"mvn.cmd compile -q":await Y(On("mvnw"))?"./mvnw compile -q":"mvn compile -q":await Y(On("Cargo.toml"))?"cargo build":null}function sf(t){return`Evidence: recorded command-check at ${t.timestamp}; command: ${t.command}; cwd: ${t.cwd}`}function Oo(t,e,n){return`comet state record-check ${t} ${e} --command "${n}" --exit-code 0`}async function lf(t,e,n,i){if(process.env.COMET_SKIP_BUILD==="1")return{status:0,output:"SKIPPED via COMET_SKIP_BUILD=1"};let r=i==="build"?["build_command"]:["verify_command","build_command"];for(let a of r)if(await av(a))return cv(a);let s=i==="build"?await uv():null;if(s)return lv(s);let o=await Xl(I(),t,n,i);return o?o.exitCode!==0?{status:o.exitCode,output:`Latest recorded ${i} check failed with exit code ${o.exitCode}.
167
+ ${sf(o)}
168
168
  Next: rerun the command successfully, then record it with:
169
- ${Ao(e,i,o.command)}`}:{status:0,output:nf(o)}:{status:1,output:i==="build"?`No inferred build command or recorded build check. Detection searched: ${iv.join(", ")}.
169
+ ${Oo(e,i,o.command)}`}:{status:0,output:sf(o)}:{status:1,output:i==="build"?`No inferred build command or recorded build check. Detection searched: ${ov.join(", ")}.
170
170
  Next: run the required command, then record it with:
171
- ${Ao(e,i,"<command>")}`:`No recorded verify check.
171
+ ${Oo(e,i,"<command>")}`:`No recorded verify check.
172
172
  Next: run the required verification command, then record it with:
173
- ${Ao(e,i,"<command>")}`}}async function qo(t){let e=T.join(t,"tasks.md");if(!await Y(e))return S(`tasks.md is missing at ${e}
173
+ ${Oo(e,i,"<command>")}`}}async function qo(t){let e=T.join(t,"tasks.md");if(!await Y(e))return S(`tasks.md is missing at ${e}
174
174
  Next: restore or create tasks.md for this change before leaving build.`);let n=await te(I(),e,{label:`Classic tasks ${e}`});if(!/- \[x\]/u.test(n))return S(`tasks.md has no completed tasks.
175
175
  Next: complete implementation tasks and mark them with '- [x]'.`);let i=n.split(/\r?\n/u).map((r,s)=>({line:r,number:s+1})).filter(r=>/^- \[ \]/u.test(r.line));return i.length>0?S(`Unfinished tasks:
176
176
  ${i.map(r=>`${r.number}:${r.line}`).join(`
177
177
  `)}
178
- Next: complete or explicitly remove unfinished tasks, then mark tasks.md with '- [x]'.`):_()}async function cv(t){let e=T.join(t,"tasks.md");return await Y(e)?/- \[/u.test(await te(I(),e,{label:`Classic tasks ${e}`})):!1}async function lv(t){let e=await A(t,"plan");if(!e||e==="null")return _();if(!await Y(e))return S(`plan file is missing at ${e}
178
+ Next: complete or explicitly remove unfinished tasks, then mark tasks.md with '- [x]'.`):_()}async function fv(t){let e=T.join(t,"tasks.md");return await Y(e)?/- \[/u.test(await te(I(),e,{label:`Classic tasks ${e}`})):!1}async function dv(t){let e=await O(t,"plan");if(!e||e==="null")return _();if(!await Y(e))return S(`plan file is missing at ${e}
179
179
  Next: restore the Superpowers plan file or update .comet.yaml plan before leaving build.`);let i=(await te(I(),e,{label:`Classic plan ${e}`})).split(/\r?\n/u).map((r,s)=>({line:r,number:s+1})).filter(r=>/^\s*- \[ \]/u.test(r.line));return i.length>0?S(`Unfinished Superpowers plan tasks:
180
180
  ${i.map(r=>`${r.number}:${r.line}`).join(`
181
181
  `)}
182
- Next: check off corresponding completed plan tasks, then commit the plan update.`):_()}async function Lo(t,e){let n;try{n=await Zu(t,{heal:!0,cwd:pr()})}catch(i){throw new fe(`ERROR: ${i instanceof Error?i.message:String(i)}`)}switch(n.status){case"drift":return S(ef(e,n.boundBranch,n.currentBranch));case"unbound-detached":return S(tf(e));case"healed":return _(`bound_branch lazily set to ${n.branch}`);case"needs-heal":case"ok":case"not-applicable":return _();default:{let i=n;throw new Error(`unhandled branch binding status: ${JSON.stringify(i)}`)}}}async function uv(t,e){let n=await A(t,"isolation");return n==="current"||n==="branch"||n==="worktree"?_():S(`isolation must be current, branch, or worktree, got '${n||"null"}'
182
+ Next: check off corresponding completed plan tasks, then commit the plan update.`):_()}async function Lo(t,e){let n;try{n=await tf(t,{heal:!0,cwd:pr()})}catch(i){throw new de(`ERROR: ${i instanceof Error?i.message:String(i)}`)}switch(n.status){case"drift":return S(nf(e,n.boundBranch,n.currentBranch));case"unbound-detached":return S(rf(e));case"healed":return _(`bound_branch lazily set to ${n.branch}`);case"needs-heal":case"ok":case"not-applicable":return _();default:{let i=n;throw new Error(`unhandled branch binding status: ${JSON.stringify(i)}`)}}}async function mv(t,e){let n=await O(t,"isolation");return n==="current"||n==="branch"||n==="worktree"?_():S(`isolation must be current, branch, or worktree, got '${n||"null"}'
183
183
  Next: choose a valid workspace mode, prepare it when needed, then run:
184
- comet state set ${e} isolation <current|branch|worktree>`)}async function fv(t,e){let n=await A(t,"build_mode");return["subagent-driven-development","executing-plans","direct"].includes(n)?_():S(`build_mode must be selected before leaving build, got '${n||"null"}'
184
+ comet state set ${e} isolation <current|branch|worktree>`)}async function pv(t,e){let n=await O(t,"build_mode");return["subagent-driven-development","executing-plans","direct"].includes(n)?_():S(`build_mode must be selected before leaving build, got '${n||"null"}'
185
185
  Next: ask the user to choose an execution mode, then run:
186
- comet state set ${e} build_mode <subagent-driven-development|executing-plans>`)}async function dv(t){let e=await A(t,"workflow"),n=await A(t,"build_mode"),i=await A(t,"direct_override");return n!=="direct"||e==="hotfix"||e==="tweak"||i==="true"?_():S(`build_mode=direct is only allowed for hotfix/tweak unless direct_override: true is recorded
187
- Next: choose executing-plans or subagent-driven-development, or stop and ask the user for an explicit direct override.`)}async function pv(t,e){let n=await A(t,"build_mode"),i=await A(t,"subagent_dispatch");return n!=="subagent-driven-development"||i==="confirmed"?_():S(`subagent_dispatch must be confirmed before using build_mode=subagent-driven-development
186
+ comet state set ${e} build_mode <subagent-driven-development|executing-plans>`)}async function hv(t){let e=await O(t,"workflow"),n=await O(t,"build_mode"),i=await O(t,"direct_override");return n!=="direct"||e==="hotfix"||e==="tweak"||i==="true"?_():S(`build_mode=direct is only allowed for hotfix/tweak unless direct_override: true is recorded
187
+ Next: choose executing-plans or subagent-driven-development, or stop and ask the user for an explicit direct override.`)}async function gv(t,e){let n=await O(t,"build_mode"),i=await O(t,"subagent_dispatch");return n!=="subagent-driven-development"||i==="confirmed"?_():S(`subagent_dispatch must be confirmed before using build_mode=subagent-driven-development
188
188
  Next: record the selected subagent-driven execution, then run:
189
- comet state set ${e} subagent_dispatch confirmed`)}async function mv(t,e){let n=await A(t,"workflow");if(n==="hotfix"||n==="tweak")return _();let i=await A(t,"tdd_mode");return i==="tdd"||i==="direct"?_():S(`tdd_mode must be tdd or direct for full workflow, got '${i||"null"}'
189
+ comet state set ${e} subagent_dispatch confirmed`)}async function wv(t,e){let n=await O(t,"workflow");if(n==="hotfix"||n==="tweak")return _();let i=await O(t,"tdd_mode");return i==="tdd"||i==="direct"?_():S(`tdd_mode must be tdd or direct for full workflow, got '${i||"null"}'
190
190
  Next: ask the user to choose TDD enforcement level, then run:
191
- comet state set ${e} tdd_mode <tdd|direct>`)}async function hv(t,e){let n=await A(t,"workflow");if(n==="hotfix"||n==="tweak")return _();let i=await A(t,"review_mode");return i==="off"||i==="standard"||i==="thorough"?_():S(`review_mode must be off, standard, or thorough before leaving build, got '${i||"null"}'
191
+ comet state set ${e} tdd_mode <tdd|direct>`)}async function yv(t,e){let n=await O(t,"workflow");if(n==="hotfix"||n==="tweak")return _();let i=await O(t,"review_mode");return i==="off"||i==="standard"||i==="thorough"?_():S(`review_mode must be off, standard, or thorough before leaving build, got '${i||"null"}'
192
192
  Next: ask the user to choose review strength, then run:
193
- comet state set ${e} review_mode <off|standard|thorough>`)}async function gv(t){let e=await A(t,"verification_report");return!!e&&e!=="null"&&await Y(e)}async function wv(t){return await A(t,"branch_status")==="handled"}async function yv(t){return await A(t,"archived")==="true"}async function jo(t,e,n){let i=(await te(I(),t,{label:`Classic Design Doc ${t}`})).replace(/^\uFEFF/u,""),r=!1;for(let s of i.split(/\r?\n/u)){if(!r){s==="---"&&(r=!0);continue}if(s==="---")break;if(new RegExp(`^${e}: ['"]?${n}['"]?\\s*$`,"u").test(s))return!0}return!1}async function vv(t,e){let n=await A(t,"design_doc");return n&&n!=="null"&&await Y(n)?_():S(`design_doc must point to an existing Superpowers Design Doc for full workflow before leaving design.
194
- Next: create the Design Doc and run: comet state set ${e} design_doc <path>`)}async function bv(t,e){let n=await A(t,"handoff_context"),i=await A(t,"handoff_hash");if(!n||n==="null")return S(`handoff_context is missing from .comet.yaml
195
- Next: run node "$COMET_HANDOFF" ${e} design --write before invoking Superpowers.`);if(!await H(n))return S(`handoff_context does not point to a non-empty file: ${n}
193
+ comet state set ${e} review_mode <off|standard|thorough>`)}async function vv(t){let e=await O(t,"verification_report");return!!e&&e!=="null"&&await Y(e)}async function bv(t){return await O(t,"branch_status")==="handled"}async function kv(t){return await O(t,"archived")==="true"}async function jo(t,e,n){let i=(await te(I(),t,{label:`Classic Design Doc ${t}`})).replace(/^\uFEFF/u,""),r=!1;for(let s of i.split(/\r?\n/u)){if(!r){s==="---"&&(r=!0);continue}if(s==="---")break;if(new RegExp(`^${e}: ['"]?${n}['"]?\\s*$`,"u").test(s))return!0}return!1}async function Sv(t,e){let n=await O(t,"design_doc");return n&&n!=="null"&&await Y(n)?_():S(`design_doc must point to an existing Superpowers Design Doc for full workflow before leaving design.
194
+ Next: create the Design Doc and run: comet state set ${e} design_doc <path>`)}async function Cv(t,e){let n=await O(t,"handoff_context"),i=await O(t,"handoff_hash");if(!n||n==="null")return S(`handoff_context is missing from .comet.yaml
195
+ Next: run node "$COMET_HANDOFF" ${e} design --write before invoking Superpowers.`);if(!await G(n))return S(`handoff_context does not point to a non-empty file: ${n}
196
196
  Next: regenerate the design handoff with comet handoff ${e} design --write.`);if(!/^[a-f0-9]{64}$/u.test(i))return S(`handoff_hash is missing or invalid: ${i||"null"}
197
- Next: regenerate the design handoff with comet handoff ${e} design --write.`);let r=await ev(t);if(r!==i)return S(`OpenSpec artifacts changed after handoff was generated.
197
+ Next: regenerate the design handoff with comet handoff ${e} design --write.`);let r=await iv(t);if(r!==i)return S(`OpenSpec artifacts changed after handoff was generated.
198
198
  Expected handoff_hash: ${i}
199
199
  Actual handoff_hash: ${r}
200
- Next: run comet handoff ${e} design --write so Superpowers receives the current OpenSpec context.`);let s=`${n.replace(/\.json$/u,"")}.md`;return await H(s)?_():S(`design handoff markdown is missing or empty: ${s}
201
- Next: regenerate the design handoff with comet handoff ${e} design --write.`)}async function kv(t){let e=await A(t,"handoff_context");if(!e||e==="null")return S("handoff_context is missing from .comet.yaml");let n=`${e.replace(/\.json$/u,"")}.md`;if(!await H(n))return S(`design handoff markdown is missing or empty: ${n}`);let i=await te(I(),n,{label:`Classic handoff markdown ${n}`}),r=new Set(i.split(/\r?\n/u)),s=[];/^Generated-by: comet-handoff\.sh$/mu.test(i)||s.push("handoff markdown is missing Generated-by marker"),/^- Mode: (compact|full|beta)$/mu.test(i)||s.push("handoff markdown is missing Mode marker");for(let o of await $o(t))await Y(o)&&(r.has(`- Source: ${o}`)||s.push(`handoff markdown is missing source reference: ${o}`),r.has(`- SHA256: ${await of(o)}`)||s.push(`handoff markdown is missing current sha256 for: ${o}`));return s.length===0?_():S(s.join(`
202
- `))}async function cf(t){return await A(t,"context_compression")||"off"}async function Sv(t){if(await cf(t)!=="beta")return _();let e=await A(t,"handoff_context");if(!e||e==="null")return S("handoff_context is missing from .comet.yaml");if(!await H(e))return S(`spec-context.json is missing or empty: ${e}`);let n=await te(I(),e,{label:`Classic handoff context ${e}`}),i=[],r;try{r=JSON.parse(n)}catch(a){return S(`spec-context.json invalid JSON: ${a instanceof Error?a.message:String(a)}`)}if(!r||typeof r!="object"||Array.isArray(r))return S("spec-context.json root must be an object");let s=r;typeof s.change!="string"&&i.push("spec-context.json missing 'change' field"),typeof s.phase!="string"&&i.push("spec-context.json missing 'phase' field"),s.mode!=="beta"&&i.push("spec-context.json mode is not beta"),typeof s.context_hash!="string"&&i.push("spec-context.json missing 'context_hash' field"),Array.isArray(s.files)||i.push("spec-context.json missing 'files' field");let o=Array.isArray(s.files)?s.files.filter(a=>!!a&&typeof a=="object"&&!Array.isArray(a)):[];for(let a of await $o(t))await Y(a)&&(o.some(c=>c.path===a&&typeof c.sha256=="string")||i.push(`spec-context.json missing source file reference: ${a}`));return i.length===0?_():S(i.join(`
203
- `))}async function Cv(t,e){let n=await A(e,"workflow"),i=[E("proposal.md exists and non-empty",async()=>await H(T.join(e,"proposal.md"))?_():S("")),E("proposal.md matches configured language",()=>he(e,T.join(e,"proposal.md"))),E("tasks.md exists and non-empty",async()=>await H(T.join(e,"tasks.md"))?_():S("")),E("tasks.md matches configured language",()=>he(e,T.join(e,"tasks.md"))),E("tasks.md has at least one task",async()=>await cv(e)?_():S(""))];return n==="full"&&i.splice(1,0,E("design.md exists and non-empty",async()=>await H(T.join(e,"design.md"))?_():S("")),E("design.md matches configured language",()=>he(e,T.join(e,"design.md")))),Nt(t,i)}async function Ev(t,e,n){let i=await A(e,"design_doc"),r=await A(e,"workflow"),s=[E("proposal.md exists",async()=>await H(T.join(e,"proposal.md"))?_():S("")),E("proposal.md matches configured language",()=>he(e,T.join(e,"proposal.md"))),E("design.md exists",async()=>await H(T.join(e,"design.md"))?_():S("")),E("design.md matches configured language",()=>he(e,T.join(e,"design.md"))),E("tasks.md exists",async()=>await H(T.join(e,"tasks.md"))?_():S("")),E("tasks.md matches configured language",()=>he(e,T.join(e,"tasks.md"))),E("design handoff context exists",()=>bv(e,n)),E("design handoff markdown is traceable",()=>kv(e))];await cf(e)==="beta"&&s.push(E("beta spec-context.json is structurally valid",()=>Sv(e))),r==="full"&&s.push(E("design_doc is recorded for full workflow",()=>vv(e,n)));let o=await Nt(t,s);return i&&i!=="null"?o=await Nt(t,[E(`Design Doc (${i}) exists`,async()=>await H(i)?_():S("")),E("Design Doc matches configured language",()=>he(e,i)),E("Design Doc frontmatter links current change",async()=>await H(i)&&await jo(i,"comet_change",n)?_():S("")),E("Design Doc declares technical design role",async()=>await H(i)&&await jo(i,"role","technical-design")?_():S("")),E("Design Doc declares OpenSpec as canonical spec",async()=>await H(i)&&await jo(i,"canonical_spec","openspec")?_():S(""))])||o:r!=="full"&&t.stderr.push(Yy(" [WARN] No design_doc recorded in .comet.yaml (optional for hotfix/tweak)")),o}async function xv(t,e,n,i){return Nt(t,[E("bound branch matches workspace mode",()=>Lo(e,n)),E("isolation selected",()=>uv(e,n)),E("build_mode selected",()=>fv(e,n)),E("build_mode allowed for workflow",()=>dv(e)),E("subagent dispatch confirmed",()=>pv(e,n)),E("tdd_mode selected",()=>mv(e,n)),E("review_mode selected",()=>hv(e,n)),E("tasks.md all tasks checked",()=>qo(e)),E("Superpowers plan all tasks checked",()=>lv(e)),E("proposal.md exists",async()=>await H(T.join(e,"proposal.md"))?_():S("")),E("proposal.md matches configured language",()=>he(e,T.join(e,"proposal.md"))),E("Superpowers plan matches configured language",async()=>{let r=await A(e,"plan");return!r||r==="null"||!await Y(r)?_():he(e,r)}),E("Build passes",async()=>{let r=await af(e,n,i,"build");return r.status===0?_(r.output):S(r.output)})])}async function _v(t,e,n,i){return Nt(t,[E("bound branch matches workspace mode",()=>Lo(e,n)),E("tasks.md all tasks checked",()=>qo(e)),E("Verification passes",async()=>{let r=await af(e,n,i,"verify");return r.status===0?_(r.output):S(r.output)}),E("verification_report exists",async()=>await gv(e)?_():S("")),E("verification_report matches configured language",async()=>{let r=await A(e,"verification_report");return!r||r==="null"||!await Y(r)?_():he(e,r)})])}async function Pv(t,e,n){return Nt(t,[E("bound branch matches workspace mode",()=>Lo(e,n)),E("archived is true",async()=>await yv(e)?_():S("")),E("proposal.md exists",async()=>await H(T.join(e,"proposal.md"))?_():S("")),E("design.md exists",async()=>await H(T.join(e,"design.md"))?_():S("")),E("tasks.md all tasks checked",()=>qo(e)),E("branch_status=handled",async()=>await wv(e)?_():S(""))])}async function Rv(t,e,n,i){let r=Yu[i];if(!r)return;let s=await ur(n),o=Uu(s.classic,r);await Fu(n,o.classic,s.run,{event:r,phase:i,source:"comet-guard"}),await Ku(n,{change:e,event:r,source:"comet-guard",from:s.classic,to:o.classic,effects:o.effects});for(let l of o.effects)t.stderr.push(Rt(`[SET] ${Uy(l.field)}=${Vy(l.to)}`));t.stderr.push(Rt(`[TRANSITION] ${r}`));let a=By[i],c=i==="open"?a.replace("PLACEHOLDER",o.classic.phase):a;t.stderr.push(Rt(c))}var lf=async(t,e)=>dr(e,async()=>{let n=new To,[i,r,s]=t;try{if(Jy(i),!r||!My.includes(r))throw new fe(`${Se(`Unknown phase: ${r??""}`)}
204
- Valid phases: open, design, build, verify, archive`);await ho(I());let o=await Hy(i);await tv(o,i);let a=await ur(o),c=await Bu(o,i);e.json&&(n.diagnostics={change:i,phase:r,currentStep:c.currentStep,runtimeEval:c.runtimeEval}),n.stderr.push(Wy[r]);let l;return r==="open"?l=await Cv(n,o):r==="design"?l=await Ev(n,o,i):r==="build"?l=await xv(n,o,i,a.run):r==="verify"?l=await _v(n,o,i,a.run):l=await Pv(n,o,i),l?(n.stderr.push(""),n.stderr.push(Se("BLOCKED — fix failing checks before proceeding to next phase")),n.toResult(1)):(n.stderr.push(""),n.stderr.push(Rt("ALL CHECKS PASSED — ready for next phase")),s==="--apply"&&await Rv(n,i,o,r),n.toResult(0))}catch(o){if(o instanceof fe){for(let a of o.message.split(`
205
- `))n.stderr.push(a);return n.toResult(o.exitCode)}throw o}});function Nv(t,e){return{exitCode:e.exitCode,stdout:JSON.stringify({command:t,exitCode:e.exitCode,...e.stdout===void 0?{}:{stdout:e.stdout},...e.stderr===void 0?{}:{stderr:e.stderr}})+`
206
- `}}async function uf(t,e,n=process.argv.slice(2)){let i=n.includes("--json"),r=n.filter(a=>a!=="--json"),s;try{s=await e(r,{json:i})}catch(a){s={exitCode:70,stderr:a instanceof Error?a.message:String(a)}}let o=i?Nv(t,s):s;return o.stdout&&process.stdout.write(o.stdout),o.stderr&&process.stderr.write(o.stderr+(o.stderr.endsWith(`
200
+ Next: run comet handoff ${e} design --write so Superpowers receives the current OpenSpec context.`);let s=`${n.replace(/\.json$/u,"")}.md`;return await G(s)?_():S(`design handoff markdown is missing or empty: ${s}
201
+ Next: regenerate the design handoff with comet handoff ${e} design --write.`)}async function Ev(t){let e=await O(t,"handoff_context");if(!e||e==="null")return S("handoff_context is missing from .comet.yaml");let n=`${e.replace(/\.json$/u,"")}.md`;if(!await G(n))return S(`design handoff markdown is missing or empty: ${n}`);let i=await te(I(),n,{label:`Classic handoff markdown ${n}`}),r=new Set(i.split(/\r?\n/u)),s=[];/^Generated-by: comet-handoff\.sh$/mu.test(i)||s.push("handoff markdown is missing Generated-by marker"),/^- Mode: (compact|full|beta)$/mu.test(i)||s.push("handoff markdown is missing Mode marker");for(let o of await $o(t))await Y(o)&&(r.has(`- Source: ${o}`)||s.push(`handoff markdown is missing source reference: ${o}`),r.has(`- SHA256: ${await cf(o)}`)||s.push(`handoff markdown is missing current sha256 for: ${o}`));return s.length===0?_():S(s.join(`
202
+ `))}async function uf(t){return await O(t,"context_compression")||"off"}async function xv(t){if(await uf(t)!=="beta")return _();let e=await O(t,"handoff_context");if(!e||e==="null")return S("handoff_context is missing from .comet.yaml");if(!await G(e))return S(`spec-context.json is missing or empty: ${e}`);let n=await te(I(),e,{label:`Classic handoff context ${e}`}),i=[],r;try{r=JSON.parse(n)}catch(a){return S(`spec-context.json invalid JSON: ${a instanceof Error?a.message:String(a)}`)}if(!r||typeof r!="object"||Array.isArray(r))return S("spec-context.json root must be an object");let s=r;typeof s.change!="string"&&i.push("spec-context.json missing 'change' field"),typeof s.phase!="string"&&i.push("spec-context.json missing 'phase' field"),s.mode!=="beta"&&i.push("spec-context.json mode is not beta"),typeof s.context_hash!="string"&&i.push("spec-context.json missing 'context_hash' field"),Array.isArray(s.files)||i.push("spec-context.json missing 'files' field");let o=Array.isArray(s.files)?s.files.filter(a=>!!a&&typeof a=="object"&&!Array.isArray(a)):[];for(let a of await $o(t))await Y(a)&&(o.some(c=>c.path===a&&typeof c.sha256=="string")||i.push(`spec-context.json missing source file reference: ${a}`));return i.length===0?_():S(i.join(`
203
+ `))}async function _v(t,e){let n=await O(e,"workflow"),i=[E("proposal.md exists and non-empty",async()=>await G(T.join(e,"proposal.md"))?_():S("")),E("proposal.md matches configured language",()=>he(e,T.join(e,"proposal.md"))),E("tasks.md exists and non-empty",async()=>await G(T.join(e,"tasks.md"))?_():S("")),E("tasks.md matches configured language",()=>he(e,T.join(e,"tasks.md"))),E("tasks.md has at least one task",async()=>await fv(e)?_():S(""))];return n==="full"&&i.splice(1,0,E("design.md exists and non-empty",async()=>await G(T.join(e,"design.md"))?_():S("")),E("design.md matches configured language",()=>he(e,T.join(e,"design.md")))),Nt(t,i)}async function Pv(t,e,n){let i=await O(e,"design_doc"),r=await O(e,"workflow"),s=[E("proposal.md exists",async()=>await G(T.join(e,"proposal.md"))?_():S("")),E("proposal.md matches configured language",()=>he(e,T.join(e,"proposal.md"))),E("design.md exists",async()=>await G(T.join(e,"design.md"))?_():S("")),E("design.md matches configured language",()=>he(e,T.join(e,"design.md"))),E("tasks.md exists",async()=>await G(T.join(e,"tasks.md"))?_():S("")),E("tasks.md matches configured language",()=>he(e,T.join(e,"tasks.md"))),E("design handoff context exists",()=>Cv(e,n)),E("design handoff markdown is traceable",()=>Ev(e))];await uf(e)==="beta"&&s.push(E("beta spec-context.json is structurally valid",()=>xv(e))),r==="full"&&s.push(E("design_doc is recorded for full workflow",()=>Sv(e,n)));let o=await Nt(t,s);return i&&i!=="null"?o=await Nt(t,[E(`Design Doc (${i}) exists`,async()=>await G(i)?_():S("")),E("Design Doc matches configured language",()=>he(e,i)),E("Design Doc frontmatter links current change",async()=>await G(i)&&await jo(i,"comet_change",n)?_():S("")),E("Design Doc declares technical design role",async()=>await G(i)&&await jo(i,"role","technical-design")?_():S("")),E("Design Doc declares OpenSpec as canonical spec",async()=>await G(i)&&await jo(i,"canonical_spec","openspec")?_():S(""))])||o:r!=="full"&&t.stderr.push(Jy(" [WARN] No design_doc recorded in .comet.yaml (optional for hotfix/tweak)")),o}async function Rv(t,e,n,i){return Nt(t,[E("bound branch matches workspace mode",()=>Lo(e,n)),E("isolation selected",()=>mv(e,n)),E("build_mode selected",()=>pv(e,n)),E("build_mode allowed for workflow",()=>hv(e)),E("subagent dispatch confirmed",()=>gv(e,n)),E("tdd_mode selected",()=>wv(e,n)),E("review_mode selected",()=>yv(e,n)),E("tasks.md all tasks checked",()=>qo(e)),E("Superpowers plan all tasks checked",()=>dv(e)),E("proposal.md exists",async()=>await G(T.join(e,"proposal.md"))?_():S("")),E("proposal.md matches configured language",()=>he(e,T.join(e,"proposal.md"))),E("Superpowers plan matches configured language",async()=>{let r=await O(e,"plan");return!r||r==="null"||!await Y(r)?_():he(e,r)}),E("Build passes",async()=>{let r=await lf(e,n,i,"build");return r.status===0?_(r.output):S(r.output)})])}async function Nv(t,e,n,i){return Nt(t,[E("bound branch matches workspace mode",()=>Lo(e,n)),E("tasks.md all tasks checked",()=>qo(e)),E("Verification passes",async()=>{let r=await lf(e,n,i,"verify");return r.status===0?_(r.output):S(r.output)}),E("verification_report exists",async()=>await vv(e)?_():S("")),E("verification_report matches configured language",async()=>{let r=await O(e,"verification_report");return!r||r==="null"||!await Y(r)?_():he(e,r)})])}async function Av(t,e,n){return Nt(t,[E("bound branch matches workspace mode",()=>Lo(e,n)),E("archived is true",async()=>await kv(e)?_():S("")),E("proposal.md exists",async()=>await G(T.join(e,"proposal.md"))?_():S("")),E("design.md exists",async()=>await G(T.join(e,"design.md"))?_():S("")),E("tasks.md all tasks checked",()=>qo(e)),E("branch_status=handled",async()=>await bv(e)?_():S(""))])}async function Ov(t,e,n,i){let r=Vu[i];if(!r)return;let s=await fr(n),o=Ju(s.classic,r);await Wu(n,o.classic,s.run,{event:r,phase:i,source:"comet-guard"}),await Uu(n,{change:e,event:r,source:"comet-guard",from:s.classic,to:o.classic,effects:o.effects});for(let l of o.effects)t.stderr.push(Rt(`[SET] ${Hy(l.field)}=${Gy(l.to)}`));t.stderr.push(Rt(`[TRANSITION] ${r}`));let a=Uy[i],c=i==="open"?a.replace("PLACEHOLDER",o.classic.phase):a;t.stderr.push(Rt(c))}var ff=async(t,e)=>mr(e,async()=>{let n=new To,[i,r,s]=t;try{if(zy(i),!r||!Ky.includes(r))throw new de(`${Se(`Unknown phase: ${r??""}`)}
204
+ Valid phases: open, design, build, verify, archive`);await ho(I());let o=await Qy(i);await rv(o,i);let a=await fr(o),c=await Yu(o,i);e.json&&(n.diagnostics={change:i,phase:r,currentStep:c.currentStep,runtimeEval:c.runtimeEval}),n.stderr.push(Yy[r]);let l;return r==="open"?l=await _v(n,o):r==="design"?l=await Pv(n,o,i):r==="build"?l=await Rv(n,o,i,a.run):r==="verify"?l=await Nv(n,o,i,a.run):l=await Av(n,o,i),l?(n.stderr.push(""),n.stderr.push(Se("BLOCKED — fix failing checks before proceeding to next phase")),n.toResult(1)):(n.stderr.push(""),n.stderr.push(Rt("ALL CHECKS PASSED — ready for next phase")),s==="--apply"&&await Ov(n,i,o,r),n.toResult(0))}catch(o){if(o instanceof de){for(let a of o.message.split(`
205
+ `))n.stderr.push(a);return n.toResult(o.exitCode)}throw o}});function jv(t,e){return{exitCode:e.exitCode,stdout:JSON.stringify({command:t,exitCode:e.exitCode,...e.stdout===void 0?{}:{stdout:e.stdout},...e.stderr===void 0?{}:{stderr:e.stderr}})+`
206
+ `}}async function df(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?jv(t,s):s;return o.stdout&&process.stdout.write(o.stdout),o.stderr&&process.stderr.write(o.stderr+(o.stderr.endsWith(`
207
207
  `)?"":`
208
- `)),o.exitCode}process.exitCode=await uf("guard",lf);
208
+ `)),o.exitCode}process.exitCode=await df("guard",ff);