@rpamis/comet 0.4.2 → 0.4.4
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.
- package/LICENSE +21 -21
- package/assets/manifest.json +1 -1
- package/assets/skills/comet/scripts/comet-archive.mjs +109 -96
- package/assets/skills/comet/scripts/comet-check.mjs +117 -104
- package/assets/skills/comet/scripts/comet-entry-runtime.mjs +59 -59
- package/assets/skills/comet/scripts/comet-guard.mjs +173 -160
- package/assets/skills/comet/scripts/comet-handoff.mjs +110 -97
- package/assets/skills/comet/scripts/comet-hook-guard.mjs +110 -97
- package/assets/skills/comet/scripts/comet-hook-router.mjs +269 -159
- package/assets/skills/comet/scripts/comet-intent.mjs +31 -31
- package/assets/skills/comet/scripts/comet-resume-probe.mjs +104 -91
- package/assets/skills/comet/scripts/comet-runtime.mjs +272 -259
- package/assets/skills/comet/scripts/comet-state.mjs +204 -191
- package/assets/skills/comet/scripts/comet-yaml-validate.mjs +25 -25
- package/assets/skills/comet-archive/SKILL.md +4 -4
- package/assets/skills/comet-build/SKILL.md +4 -6
- package/assets/skills/comet-classic/SKILL.md +3 -1
- package/assets/skills/comet-classic/reference/scripts.md +17 -1
- package/assets/skills/comet-design/SKILL.md +0 -2
- package/assets/skills/comet-hotfix/SKILL.md +2 -3
- package/assets/skills/comet-native/SKILL.md +11 -8
- package/assets/skills/comet-native/reference/artifacts.md +7 -7
- package/assets/skills/comet-native/reference/clarification.md +4 -4
- package/assets/skills/comet-native/reference/commands.md +25 -13
- package/assets/skills/comet-native/reference/recovery.md +3 -3
- package/assets/skills/comet-native/reference/workspace.md +10 -4
- package/assets/skills/comet-native/scripts/comet-native-archive.mjs +230 -149
- package/assets/skills/comet-native/scripts/comet-native-doctor.mjs +239 -161
- package/assets/skills/comet-native/scripts/comet-native-hook-guard.mjs +232 -122
- package/assets/skills/comet-native/scripts/comet-native-init.mjs +184 -107
- package/assets/skills/comet-native/scripts/comet-native-new.mjs +219 -142
- package/assets/skills/comet-native/scripts/comet-native-next.mjs +239 -161
- package/assets/skills/comet-native/scripts/comet-native-root.mjs +205 -128
- package/assets/skills/comet-native/scripts/comet-native-runtime.mjs +276 -195
- package/assets/skills/comet-native/scripts/comet-native-select.mjs +204 -127
- package/assets/skills/comet-native/scripts/comet-native-show.mjs +202 -125
- package/assets/skills/comet-native/scripts/comet-native-spec.mjs +203 -125
- package/assets/skills/comet-native/scripts/comet-native-status.mjs +200 -123
- package/assets/skills/comet-open/SKILL.md +0 -2
- package/assets/skills/comet-tweak/SKILL.md +2 -1
- package/assets/skills/comet-verify/SKILL.md +0 -2
- package/assets/skills-zh/comet-archive/SKILL.md +4 -4
- package/assets/skills-zh/comet-build/SKILL.md +4 -6
- package/assets/skills-zh/comet-classic/SKILL.md +3 -1
- package/assets/skills-zh/comet-classic/reference/scripts.md +11 -1
- package/assets/skills-zh/comet-design/SKILL.md +0 -2
- package/assets/skills-zh/comet-hotfix/SKILL.md +2 -3
- package/assets/skills-zh/comet-native/SKILL.md +11 -8
- package/assets/skills-zh/comet-native/reference/artifacts.md +7 -7
- package/assets/skills-zh/comet-native/reference/clarification.md +4 -4
- package/assets/skills-zh/comet-native/reference/commands.md +26 -10
- package/assets/skills-zh/comet-native/reference/recovery.md +3 -3
- package/assets/skills-zh/comet-native/reference/workspace.md +10 -4
- package/assets/skills-zh/comet-open/SKILL.md +0 -2
- package/assets/skills-zh/comet-tweak/SKILL.md +2 -1
- package/assets/skills-zh/comet-verify/SKILL.md +0 -2
- package/bin/comet-daemon-router.js +57 -13
- package/bin/fast-runtime-router.js +1 -1
- package/dist/app/commands/daemon-server.d.ts.map +1 -1
- package/dist/app/commands/daemon-server.js +14 -2
- package/dist/app/commands/daemon-server.js.map +1 -1
- package/dist/app/commands/project-knowledge.d.ts.map +1 -1
- package/dist/app/commands/project-knowledge.js +0 -1
- package/dist/app/commands/project-knowledge.js.map +1 -1
- package/dist/domains/comet-classic/classic-archive-entry.d.ts +1 -1
- package/dist/domains/comet-classic/classic-archive-entry.d.ts.map +1 -1
- package/dist/domains/comet-classic/classic-archive-entry.js +5 -2
- package/dist/domains/comet-classic/classic-archive-entry.js.map +1 -1
- package/dist/domains/comet-classic/classic-branch-binding.d.ts.map +1 -1
- package/dist/domains/comet-classic/classic-branch-binding.js +5 -4
- package/dist/domains/comet-classic/classic-branch-binding.js.map +1 -1
- package/dist/domains/comet-classic/classic-check-entry.d.ts +1 -1
- package/dist/domains/comet-classic/classic-check-entry.d.ts.map +1 -1
- package/dist/domains/comet-classic/classic-check-entry.js +5 -2
- package/dist/domains/comet-classic/classic-check-entry.js.map +1 -1
- package/dist/domains/comet-classic/classic-check-snapshot.d.ts +2 -0
- package/dist/domains/comet-classic/classic-check-snapshot.d.ts.map +1 -1
- package/dist/domains/comet-classic/classic-check-snapshot.js +90 -27
- package/dist/domains/comet-classic/classic-check-snapshot.js.map +1 -1
- package/dist/domains/comet-classic/classic-guard-entry.d.ts +1 -1
- package/dist/domains/comet-classic/classic-guard-entry.d.ts.map +1 -1
- package/dist/domains/comet-classic/classic-guard-entry.js +5 -2
- package/dist/domains/comet-classic/classic-guard-entry.js.map +1 -1
- package/dist/domains/comet-classic/classic-handoff-entry.d.ts +1 -1
- package/dist/domains/comet-classic/classic-handoff-entry.d.ts.map +1 -1
- package/dist/domains/comet-classic/classic-handoff-entry.js +5 -2
- package/dist/domains/comet-classic/classic-handoff-entry.js.map +1 -1
- package/dist/domains/comet-classic/classic-resume-probe.d.ts.map +1 -1
- package/dist/domains/comet-classic/classic-resume-probe.js +3 -2
- package/dist/domains/comet-classic/classic-resume-probe.js.map +1 -1
- package/dist/domains/comet-classic/classic-script-entry.d.ts +3 -1
- package/dist/domains/comet-classic/classic-script-entry.d.ts.map +1 -1
- package/dist/domains/comet-classic/classic-script-entry.js +34 -3
- package/dist/domains/comet-classic/classic-script-entry.js.map +1 -1
- package/dist/domains/comet-classic/classic-state-command.d.ts.map +1 -1
- package/dist/domains/comet-classic/classic-state-command.js +3 -2
- package/dist/domains/comet-classic/classic-state-command.js.map +1 -1
- package/dist/domains/comet-classic/classic-state-entry.d.ts +1 -1
- package/dist/domains/comet-classic/classic-state-entry.d.ts.map +1 -1
- package/dist/domains/comet-classic/classic-state-entry.js +5 -2
- package/dist/domains/comet-classic/classic-state-entry.js.map +1 -1
- package/dist/domains/comet-classic/classic-store.d.ts.map +1 -1
- package/dist/domains/comet-classic/classic-store.js +67 -1
- package/dist/domains/comet-classic/classic-store.js.map +1 -1
- package/dist/domains/comet-entry/resume-probe.d.ts.map +1 -1
- package/dist/domains/comet-entry/resume-probe.js +3 -2
- package/dist/domains/comet-entry/resume-probe.js.map +1 -1
- package/dist/domains/comet-native/native-acceptance.d.ts +5 -1
- package/dist/domains/comet-native/native-acceptance.d.ts.map +1 -1
- package/dist/domains/comet-native/native-acceptance.js +13 -2
- package/dist/domains/comet-native/native-acceptance.js.map +1 -1
- package/dist/domains/comet-native/native-archive-command.d.ts.map +1 -1
- package/dist/domains/comet-native/native-archive-command.js +167 -37
- package/dist/domains/comet-native/native-archive-command.js.map +1 -1
- package/dist/domains/comet-native/native-artifact-language.d.ts +3 -1
- package/dist/domains/comet-native/native-artifact-language.d.ts.map +1 -1
- package/dist/domains/comet-native/native-artifact-language.js +4 -11
- package/dist/domains/comet-native/native-artifact-language.js.map +1 -1
- package/dist/domains/comet-native/native-artifacts.d.ts +8 -1
- package/dist/domains/comet-native/native-artifacts.d.ts.map +1 -1
- package/dist/domains/comet-native/native-artifacts.js +14 -2
- package/dist/domains/comet-native/native-artifacts.js.map +1 -1
- package/dist/domains/comet-native/native-builder-acceptance-review.d.ts +16 -0
- package/dist/domains/comet-native/native-builder-acceptance-review.d.ts.map +1 -0
- package/dist/domains/comet-native/native-builder-acceptance-review.js +65 -0
- package/dist/domains/comet-native/native-builder-acceptance-review.js.map +1 -0
- package/dist/domains/comet-native/native-cli-help.d.ts.map +1 -1
- package/dist/domains/comet-native/native-cli-help.js +8 -4
- package/dist/domains/comet-native/native-cli-help.js.map +1 -1
- package/dist/domains/comet-native/native-cli-shared.d.ts +4 -2
- package/dist/domains/comet-native/native-cli-shared.d.ts.map +1 -1
- package/dist/domains/comet-native/native-cli-shared.js +37 -9
- package/dist/domains/comet-native/native-cli-shared.js.map +1 -1
- package/dist/domains/comet-native/native-cli.d.ts +4 -1
- package/dist/domains/comet-native/native-cli.d.ts.map +1 -1
- package/dist/domains/comet-native/native-cli.js +9 -5
- package/dist/domains/comet-native/native-cli.js.map +1 -1
- package/dist/domains/comet-native/native-doctor-command.d.ts.map +1 -1
- package/dist/domains/comet-native/native-doctor-command.js +144 -3
- package/dist/domains/comet-native/native-doctor-command.js.map +1 -1
- package/dist/domains/comet-native/native-git-provenance.d.ts.map +1 -1
- package/dist/domains/comet-native/native-git-provenance.js +3 -2
- package/dist/domains/comet-native/native-git-provenance.js.map +1 -1
- package/dist/domains/comet-native/native-hook-guard.d.ts.map +1 -1
- package/dist/domains/comet-native/native-hook-guard.js +56 -26
- package/dist/domains/comet-native/native-hook-guard.js.map +1 -1
- package/dist/domains/comet-native/native-local-execution.d.ts +1 -0
- package/dist/domains/comet-native/native-local-execution.d.ts.map +1 -1
- package/dist/domains/comet-native/native-local-execution.js +7 -0
- package/dist/domains/comet-native/native-local-execution.js.map +1 -1
- package/dist/domains/comet-native/native-lock.d.ts.map +1 -1
- package/dist/domains/comet-native/native-lock.js +12 -0
- package/dist/domains/comet-native/native-lock.js.map +1 -1
- package/dist/domains/comet-native/native-loop-runtime.d.ts +2 -0
- package/dist/domains/comet-native/native-loop-runtime.d.ts.map +1 -1
- package/dist/domains/comet-native/native-loop-runtime.js +6 -0
- package/dist/domains/comet-native/native-loop-runtime.js.map +1 -1
- package/dist/domains/comet-native/native-next-command.d.ts.map +1 -1
- package/dist/domains/comet-native/native-next-command.js +57 -28
- package/dist/domains/comet-native/native-next-command.js.map +1 -1
- package/dist/domains/comet-native/native-output-language.d.ts.map +1 -1
- package/dist/domains/comet-native/native-output-language.js +7 -0
- package/dist/domains/comet-native/native-output-language.js.map +1 -1
- package/dist/domains/comet-native/native-portable-acceptance.d.ts +2 -0
- package/dist/domains/comet-native/native-portable-acceptance.d.ts.map +1 -1
- package/dist/domains/comet-native/native-portable-acceptance.js +11 -1
- package/dist/domains/comet-native/native-portable-acceptance.js.map +1 -1
- package/dist/domains/comet-native/native-portable-archive.d.ts +1 -0
- package/dist/domains/comet-native/native-portable-archive.d.ts.map +1 -1
- package/dist/domains/comet-native/native-portable-archive.js +3 -0
- package/dist/domains/comet-native/native-portable-archive.js.map +1 -1
- package/dist/domains/comet-native/native-portable-checks.d.ts +15 -4
- package/dist/domains/comet-native/native-portable-checks.d.ts.map +1 -1
- package/dist/domains/comet-native/native-portable-checks.js +167 -66
- package/dist/domains/comet-native/native-portable-checks.js.map +1 -1
- package/dist/domains/comet-native/native-portable-continuation.d.ts +2 -1
- package/dist/domains/comet-native/native-portable-continuation.d.ts.map +1 -1
- package/dist/domains/comet-native/native-portable-continuation.js +121 -39
- package/dist/domains/comet-native/native-portable-continuation.js.map +1 -1
- package/dist/domains/comet-native/native-portable-requirements.d.ts +1 -0
- package/dist/domains/comet-native/native-portable-requirements.d.ts.map +1 -1
- package/dist/domains/comet-native/native-portable-requirements.js +61 -18
- package/dist/domains/comet-native/native-portable-requirements.js.map +1 -1
- package/dist/domains/comet-native/native-portable-shape-coordination.d.ts.map +1 -1
- package/dist/domains/comet-native/native-portable-shape-coordination.js +18 -5
- package/dist/domains/comet-native/native-portable-shape-coordination.js.map +1 -1
- package/dist/domains/comet-native/native-portable-state.d.ts.map +1 -1
- package/dist/domains/comet-native/native-portable-state.js +10 -3
- package/dist/domains/comet-native/native-portable-state.js.map +1 -1
- package/dist/domains/comet-native/native-portable-status.d.ts.map +1 -1
- package/dist/domains/comet-native/native-portable-status.js +10 -4
- package/dist/domains/comet-native/native-portable-status.js.map +1 -1
- package/dist/domains/comet-native/native-portable-types.d.ts +2 -1
- package/dist/domains/comet-native/native-portable-types.d.ts.map +1 -1
- package/dist/domains/comet-native/native-portable-types.js.map +1 -1
- package/dist/domains/comet-native/native-portable-verification.d.ts +3 -0
- package/dist/domains/comet-native/native-portable-verification.d.ts.map +1 -1
- package/dist/domains/comet-native/native-portable-verification.js +28 -35
- package/dist/domains/comet-native/native-portable-verification.js.map +1 -1
- package/dist/domains/comet-native/native-portable-verifier-coordination.d.ts +2 -0
- package/dist/domains/comet-native/native-portable-verifier-coordination.d.ts.map +1 -1
- package/dist/domains/comet-native/native-portable-verifier-coordination.js +9 -0
- package/dist/domains/comet-native/native-portable-verifier-coordination.js.map +1 -1
- package/dist/domains/comet-native/native-runner-input-artifacts.d.ts +9 -0
- package/dist/domains/comet-native/native-runner-input-artifacts.d.ts.map +1 -0
- package/dist/domains/comet-native/native-runner-input-artifacts.js +102 -0
- package/dist/domains/comet-native/native-runner-input-artifacts.js.map +1 -0
- package/dist/domains/comet-native/native-runner-input.d.ts +90 -64
- package/dist/domains/comet-native/native-runner-input.d.ts.map +1 -1
- package/dist/domains/comet-native/native-runner-input.js +107 -22
- package/dist/domains/comet-native/native-runner-input.js.map +1 -1
- package/dist/domains/comet-native/native-script-entry.d.ts.map +1 -1
- package/dist/domains/comet-native/native-script-entry.js +9 -3
- package/dist/domains/comet-native/native-script-entry.js.map +1 -1
- package/dist/domains/comet-native/native-snapshot.d.ts.map +1 -1
- package/dist/domains/comet-native/native-snapshot.js +7 -2
- package/dist/domains/comet-native/native-snapshot.js.map +1 -1
- package/dist/domains/comet-native/native-verification-receipt-runtime.d.ts.map +1 -1
- package/dist/domains/comet-native/native-verification-receipt-runtime.js +5 -4
- package/dist/domains/comet-native/native-verification-receipt-runtime.js.map +1 -1
- package/dist/domains/comet-native/native-workspace-finish.d.ts +26 -0
- package/dist/domains/comet-native/native-workspace-finish.d.ts.map +1 -1
- package/dist/domains/comet-native/native-workspace-finish.js +520 -15
- package/dist/domains/comet-native/native-workspace-finish.js.map +1 -1
- package/dist/domains/dashboard/web/assets/{abnfDiagram-VCTEODGH-qlcciI25.js → abnfDiagram-VCTEODGH-CFEU4PQU.js} +1 -1
- package/dist/domains/dashboard/web/assets/{arc-KVm4k9kp.js → arc-BeYYJor9.js} +1 -1
- package/dist/domains/dashboard/web/assets/architecture-7GRP2DOG-YphM8Wtg.js +1 -0
- package/dist/domains/dashboard/web/assets/{architectureDiagram-5GKGNRK7-C366RdBK.js → architectureDiagram-5GKGNRK7-CqTy4fyH.js} +1 -1
- package/dist/domains/dashboard/web/assets/{blockDiagram-I7D4REHJ-DAuTc2OO.js → blockDiagram-I7D4REHJ-SR_5S4SA.js} +1 -1
- package/dist/domains/dashboard/web/assets/{c4Diagram-7LVT6UL2-CFB0RZmL.js → c4Diagram-7LVT6UL2-DzphG2XS.js} +1 -1
- package/dist/domains/dashboard/web/assets/channel-BkwcGbYR.js +1 -0
- package/dist/domains/dashboard/web/assets/{chunk-4HAMMTFA-DTV6lyGQ.js → chunk-4HAMMTFA-BpthUtIs.js} +1 -1
- package/dist/domains/dashboard/web/assets/{chunk-75Z2AOVW-DgJm4cEX.js → chunk-75Z2AOVW-CxAdhPhG.js} +1 -1
- package/dist/domains/dashboard/web/assets/{chunk-DU6HZSFF-NAtcgGZr.js → chunk-DU6HZSFF-5peVNfxp.js} +1 -1
- package/dist/domains/dashboard/web/assets/{chunk-F27PBJKO-BcFXHZMJ.js → chunk-F27PBJKO-CwG4xi2V.js} +1 -1
- package/dist/domains/dashboard/web/assets/{chunk-GMAD6QVW-wNemar9b.js → chunk-GMAD6QVW-BuFFY783.js} +1 -1
- package/dist/domains/dashboard/web/assets/{chunk-GVQU2GXP-BiVCDO9d.js → chunk-GVQU2GXP-OyUFmjE-.js} +1 -1
- package/dist/domains/dashboard/web/assets/{chunk-IMKFNOWR-D9GDj4b6.js → chunk-IMKFNOWR-DmTme45C.js} +1 -1
- package/dist/domains/dashboard/web/assets/{chunk-L3NEJ4N5-DkPl5vac.js → chunk-L3NEJ4N5-D6BHbKty.js} +1 -1
- package/dist/domains/dashboard/web/assets/{chunk-OSK3NFVY-RbbxGqtJ.js → chunk-OSK3NFVY-CCz1v1Nv.js} +1 -1
- package/dist/domains/dashboard/web/assets/{chunk-P2QGCYS3-B9_X57eT.js → chunk-P2QGCYS3-C1_7kDYS.js} +1 -1
- package/dist/domains/dashboard/web/assets/{chunk-POPQ4Y6H-DE4bOH0D.js → chunk-POPQ4Y6H-buFKlAdG.js} +1 -1
- package/dist/domains/dashboard/web/assets/{chunk-PWAF6VOD-Bo-W1iA1.js → chunk-PWAF6VOD-B_K6Jrsv.js} +1 -1
- package/dist/domains/dashboard/web/assets/{chunk-SHT3W25Y-BhLxs4rZ.js → chunk-SHT3W25Y-CRRLsXmS.js} +1 -1
- package/dist/domains/dashboard/web/assets/{chunk-SVP7TREG-BCXfn8uF.js → chunk-SVP7TREG-Q5zCQTul.js} +1 -1
- package/dist/domains/dashboard/web/assets/{chunk-TICWLB2K-DqSBgE5L.js → chunk-TICWLB2K-Zc5XaO5Z.js} +1 -1
- package/dist/domains/dashboard/web/assets/{chunk-XXDRQBXY-Dbkt1xEZ.js → chunk-XXDRQBXY-BAIB2h_r.js} +1 -1
- package/dist/domains/dashboard/web/assets/classDiagram-ZZMXUADV-DzpQhyL3.js +1 -0
- package/dist/domains/dashboard/web/assets/classDiagram-v2-VYDZK3BY-DzpQhyL3.js +1 -0
- package/dist/domains/dashboard/web/assets/{cose-bilkent-JH36ORCC-DrwNpMyX.js → cose-bilkent-JH36ORCC-C7jkFYhm.js} +1 -1
- package/dist/domains/dashboard/web/assets/{cynefin-OW5HDTMX-BbDlivxs.js → cynefin-OW5HDTMX-4yS-l7kx.js} +1 -1
- package/dist/domains/dashboard/web/assets/{cynefinDiagram-5FMLGOSQ-DmLmRN42.js → cynefinDiagram-5FMLGOSQ-DAkfQ8jW.js} +1 -1
- package/dist/domains/dashboard/web/assets/{dagre-GXQ25YYZ-Cgm5DNgI.js → dagre-GXQ25YYZ-D3b16ruz.js} +1 -1
- package/dist/domains/dashboard/web/assets/{diagram-S7CK7UJ4-Bnht1X2m.js → diagram-S7CK7UJ4-BXZHtdNz.js} +1 -1
- package/dist/domains/dashboard/web/assets/{diagram-UQ7AKVKN-LELTI4PR.js → diagram-UQ7AKVKN-B4nIzofw.js} +1 -1
- package/dist/domains/dashboard/web/assets/{diagram-VSXAHHWV-Do0fZuNG.js → diagram-VSXAHHWV-B6d7KNj1.js} +1 -1
- package/dist/domains/dashboard/web/assets/{diagram-VX7I27RA-B0rZTUwt.js → diagram-VX7I27RA-CHr0Rg8a.js} +1 -1
- package/dist/domains/dashboard/web/assets/{diagram-Z3DM3KII-wn8xCc_j.js → diagram-Z3DM3KII-BO2IxR9N.js} +1 -1
- package/dist/domains/dashboard/web/assets/{dist-CYwDKy2m.js → dist-0wyW4qbm.js} +1 -1
- package/dist/domains/dashboard/web/assets/{ebnfDiagram-PWID7BFC-CMDOpP2T.js → ebnfDiagram-PWID7BFC-CHRK8Hyg.js} +1 -1
- package/dist/domains/dashboard/web/assets/{erDiagram-RLTQ6QDP-C2d43bdq.js → erDiagram-RLTQ6QDP-_HFHzZlc.js} +1 -1
- package/dist/domains/dashboard/web/assets/{es-BzaOcXwu.js → es-kjndkyYX.js} +1 -1
- package/dist/domains/dashboard/web/assets/eventmodeling-NTZA5JFV-CG-cVTEg.js +1 -0
- package/dist/domains/dashboard/web/assets/flowDiagram-HODETNUW-C3RaJz-z.js +1 -0
- package/dist/domains/dashboard/web/assets/{ganttDiagram-EL5Y4UJY-hTH7TzhY.js → ganttDiagram-EL5Y4UJY-CxhSw1PI.js} +1 -1
- package/dist/domains/dashboard/web/assets/{gitGraph-4MIJSDKK-C3CCywb-.js → gitGraph-4MIJSDKK-Cbw-3Dnk.js} +1 -1
- package/dist/domains/dashboard/web/assets/{gitGraphDiagram-WWUBYQGX-DW6jDckj.js → gitGraphDiagram-WWUBYQGX-Cx93hwtL.js} +1 -1
- package/dist/domains/dashboard/web/assets/{index-CTZPz_mx.js → index-CQb8j5OE.js} +3 -3
- package/dist/domains/dashboard/web/assets/{index-CWNqBYyI.css → index-Gaxnq6Jd.css} +1 -1
- package/dist/domains/dashboard/web/assets/{info-A6RAGUB7-Bg3eKis8.js → info-A6RAGUB7--d4EMiIK.js} +1 -1
- package/dist/domains/dashboard/web/assets/{infoDiagram-27XIBGKW-7zk6ytVJ.js → infoDiagram-27XIBGKW-DMkRRNGB.js} +1 -1
- package/dist/domains/dashboard/web/assets/{ishikawaDiagram-5VMMS53U-CGDCTmCQ.js → ishikawaDiagram-5VMMS53U-CjKh_jHT.js} +1 -1
- package/dist/domains/dashboard/web/assets/{journeyDiagram-3NMN7TZE-C8_L_e8a.js → journeyDiagram-3NMN7TZE-CG735M_M.js} +1 -1
- package/dist/domains/dashboard/web/assets/{kanban-definition-UXKFOSKX-D5x6qTgM.js → kanban-definition-UXKFOSKX-CgXFmhFM.js} +1 -1
- package/dist/domains/dashboard/web/assets/{line-DC93oja4.js → line-Bhf8l3gG.js} +1 -1
- package/dist/domains/dashboard/web/assets/{linear-81TNubkB.js → linear-YWT9mnmu.js} +1 -1
- package/dist/domains/dashboard/web/assets/{mermaid-parser.core-D60d8uy9.js → mermaid-parser.core-COzQ1kq0.js} +3 -3
- package/dist/domains/dashboard/web/assets/{mermaid.core-l4Wgjz2Q.js → mermaid.core-Cc1lMpx-.js} +4 -4
- package/dist/domains/dashboard/web/assets/{mindmap-definition-YA3MSWOX-Dfqu1201.js → mindmap-definition-YA3MSWOX-B_VOgUSO.js} +1 -1
- package/dist/domains/dashboard/web/assets/{packet-AYTQ26CC-CsFZBhTs.js → packet-AYTQ26CC-CXbJLNC9.js} +1 -1
- package/dist/domains/dashboard/web/assets/{pegDiagram-XKGWAZYB-myFMaA7n.js → pegDiagram-XKGWAZYB-BuS0hioo.js} +1 -1
- package/dist/domains/dashboard/web/assets/{pie-WAS4IAKB-FMuCTNSk.js → pie-WAS4IAKB-BEaGwdWZ.js} +1 -1
- package/dist/domains/dashboard/web/assets/{pieDiagram-E7YTZNPT-CSR4B4Z1.js → pieDiagram-E7YTZNPT-DDzYv-_9.js} +1 -1
- package/dist/domains/dashboard/web/assets/purify.es-Bvo9QlJ8.js +3 -0
- package/dist/domains/dashboard/web/assets/{quadrantDiagram-AXDQQJYC-BiE4kEeP.js → quadrantDiagram-AXDQQJYC-DExT--Ut.js} +1 -1
- package/dist/domains/dashboard/web/assets/{radar-RG4KPBEZ-BZ-n7JtG.js → radar-RG4KPBEZ-C1JtzGr8.js} +1 -1
- package/dist/domains/dashboard/web/assets/{railroad-74A4TZTK-CWVtRfHu.js → railroad-74A4TZTK-CMpkXATR.js} +1 -1
- package/dist/domains/dashboard/web/assets/railroad-abnf-HS5TGJTU-BM35gYWg.js +1 -0
- package/dist/domains/dashboard/web/assets/railroad-ebnf-LZEXJU2U-CN60GGp0.js +1 -0
- package/dist/domains/dashboard/web/assets/railroad-peg-WCYAUIDC-DRUSW4g7.js +1 -0
- package/dist/domains/dashboard/web/assets/{railroadDiagram-O6MQD6OU-CBj7v1de.js → railroadDiagram-O6MQD6OU-BCE65sLR.js} +1 -1
- package/dist/domains/dashboard/web/assets/{requirementDiagram-BXWQKSXE-DSDgb54n.js → requirementDiagram-BXWQKSXE-CmyX3vGG.js} +1 -1
- package/dist/domains/dashboard/web/assets/{sankeyDiagram-P5KCCOFB-1-oXLUAP.js → sankeyDiagram-P5KCCOFB-BFKrX2dv.js} +1 -1
- package/dist/domains/dashboard/web/assets/{sequenceDiagram-WJ2MYXX4-DAF4nGs_.js → sequenceDiagram-WJ2MYXX4-DqodS9W-.js} +1 -1
- package/dist/domains/dashboard/web/assets/{src-CTWLVUqE.js → src-BVUP3QzK.js} +1 -1
- package/dist/domains/dashboard/web/assets/{stateDiagram-D77RDMKH-DzENBaJT.js → stateDiagram-D77RDMKH-nHai_EZh.js} +1 -1
- package/dist/domains/dashboard/web/assets/stateDiagram-v2-MP3YSRHH-BL6vE1m9.js +1 -0
- package/dist/domains/dashboard/web/assets/{swimlanes-42K2YHIH-CnxFUZJc.js → swimlanes-42K2YHIH-BODBARYN.js} +1 -1
- package/dist/domains/dashboard/web/assets/swimlanesDiagram-VR7AAH4N-XHK_nuTj.js +8 -0
- package/dist/domains/dashboard/web/assets/{timeline-definition-24CTP7MA-KtvPzpZM.js → timeline-definition-24CTP7MA-RVnG8rgK.js} +1 -1
- package/dist/domains/dashboard/web/assets/{treeView-Q6P3EWNA-Bdu3P9iY.js → treeView-Q6P3EWNA-B6lrg3KQ.js} +1 -1
- package/dist/domains/dashboard/web/assets/{treemap-WGGIJYW6-DFnn23JR.js → treemap-WGGIJYW6-CJfMKVf4.js} +1 -1
- package/dist/domains/dashboard/web/assets/{vennDiagram-4TSXK5OY-BjpviP26.js → vennDiagram-4TSXK5OY-CZMWJiN7.js} +1 -1
- package/dist/domains/dashboard/web/assets/{wardley-WFR3VGLG-CEo4a-j4.js → wardley-WFR3VGLG-BoUsbNlx.js} +1 -1
- package/dist/domains/dashboard/web/assets/{wardleyDiagram-VM6X3IG4-Bf54n6im.js → wardleyDiagram-VM6X3IG4-BwBCykVb.js} +1 -1
- package/dist/domains/dashboard/web/assets/{xychartDiagram-S5SC5T6Z-CU-hI0Cm.js → xychartDiagram-S5SC5T6Z-vutnbx57.js} +1 -1
- package/dist/domains/dashboard/web/index.html +2 -2
- package/dist/domains/project-knowledge/corpus.d.ts +5 -0
- package/dist/domains/project-knowledge/corpus.d.ts.map +1 -1
- package/dist/domains/project-knowledge/corpus.js +34 -9
- package/dist/domains/project-knowledge/corpus.js.map +1 -1
- package/dist/domains/project-knowledge/index-store.d.ts +5 -2
- package/dist/domains/project-knowledge/index-store.d.ts.map +1 -1
- package/dist/domains/project-knowledge/index-store.js +95 -52
- package/dist/domains/project-knowledge/index-store.js.map +1 -1
- package/dist/domains/project-knowledge/local-provider.d.ts.map +1 -1
- package/dist/domains/project-knowledge/local-provider.js +14 -3
- package/dist/domains/project-knowledge/local-provider.js.map +1 -1
- package/dist/domains/project-knowledge/local-store.d.ts +2 -2
- package/dist/domains/project-knowledge/local-store.d.ts.map +1 -1
- package/dist/domains/project-knowledge/local-store.js +2 -2
- package/dist/domains/project-knowledge/local-store.js.map +1 -1
- package/dist/domains/project-knowledge/plugin.d.ts.map +1 -1
- package/dist/domains/project-knowledge/plugin.js +5 -4
- package/dist/domains/project-knowledge/plugin.js.map +1 -1
- package/dist/domains/project-knowledge/provider-factory.d.ts.map +1 -1
- package/dist/domains/project-knowledge/provider-factory.js +7 -5
- package/dist/domains/project-knowledge/provider-factory.js.map +1 -1
- package/dist/domains/project-knowledge/types.d.ts +1 -0
- package/dist/domains/project-knowledge/types.d.ts.map +1 -1
- package/dist/domains/skill/platform-install.d.ts.map +1 -1
- package/dist/domains/skill/platform-install.js +31 -3
- package/dist/domains/skill/platform-install.js.map +1 -1
- package/dist/domains/workflow-contract/hook-target-scope.d.ts.map +1 -1
- package/dist/domains/workflow-contract/hook-target-scope.js +2 -1
- package/dist/domains/workflow-contract/hook-target-scope.js.map +1 -1
- package/dist/platform/paths/git-worktree-cache.d.ts +3 -0
- package/dist/platform/paths/git-worktree-cache.d.ts.map +1 -0
- package/dist/platform/paths/git-worktree-cache.js +109 -0
- package/dist/platform/paths/git-worktree-cache.js.map +1 -0
- package/dist/platform/paths/git-worktree.d.ts +6 -0
- package/dist/platform/paths/git-worktree.d.ts.map +1 -1
- package/dist/platform/paths/git-worktree.js +191 -30
- package/dist/platform/paths/git-worktree.js.map +1 -1
- package/dist/platform/process/comet-daemon.d.ts +3 -0
- package/dist/platform/process/comet-daemon.d.ts.map +1 -1
- package/dist/platform/process/comet-daemon.js +9 -6
- package/dist/platform/process/comet-daemon.js.map +1 -1
- package/dist/platform/process/external-command.d.ts +3 -0
- package/dist/platform/process/external-command.d.ts.map +1 -1
- package/dist/platform/process/external-command.js +69 -2
- package/dist/platform/process/external-command.js.map +1 -1
- package/dist/platform/process/git.d.ts.map +1 -1
- package/dist/platform/process/git.js +3 -4
- package/dist/platform/process/git.js.map +1 -1
- package/dist/platform/process/hook-adapter.d.ts +2 -0
- package/dist/platform/process/hook-adapter.d.ts.map +1 -1
- package/dist/platform/process/hook-adapter.js +32 -3
- package/dist/platform/process/hook-adapter.js.map +1 -1
- package/dist/platform/process/hook-read-cache.d.ts +2 -0
- package/dist/platform/process/hook-read-cache.d.ts.map +1 -1
- package/dist/platform/process/hook-read-cache.js +25 -13
- package/dist/platform/process/hook-read-cache.js.map +1 -1
- package/dist/platform/process/process-identity.d.ts.map +1 -1
- package/dist/platform/process/process-identity.js +18 -51
- package/dist/platform/process/process-identity.js.map +1 -1
- package/dist/platform/process/runtime-metrics.d.ts +10 -1
- package/dist/platform/process/runtime-metrics.d.ts.map +1 -1
- package/dist/platform/process/runtime-metrics.js +37 -2
- package/dist/platform/process/runtime-metrics.js.map +1 -1
- package/dist/platform/process/windows-process-broker.d.ts +13 -0
- package/dist/platform/process/windows-process-broker.d.ts.map +1 -0
- package/dist/platform/process/windows-process-broker.js +150 -0
- package/dist/platform/process/windows-process-broker.js.map +1 -0
- package/dist/platform/process/windows-process-identity.d.ts +6 -0
- package/dist/platform/process/windows-process-identity.d.ts.map +1 -0
- package/dist/platform/process/windows-process-identity.js +190 -0
- package/dist/platform/process/windows-process-identity.js.map +1 -0
- package/package.json +1 -1
- package/dist/domains/dashboard/web/assets/architecture-7GRP2DOG-QeljAKq2.js +0 -1
- package/dist/domains/dashboard/web/assets/channel-_AqwP0KA.js +0 -1
- package/dist/domains/dashboard/web/assets/classDiagram-ZZMXUADV-CRo4aB_7.js +0 -1
- package/dist/domains/dashboard/web/assets/classDiagram-v2-VYDZK3BY-CRo4aB_7.js +0 -1
- package/dist/domains/dashboard/web/assets/eventmodeling-NTZA5JFV-KYANo3DQ.js +0 -1
- package/dist/domains/dashboard/web/assets/flowDiagram-HODETNUW-CSROlLuj.js +0 -1
- package/dist/domains/dashboard/web/assets/purify.es-ChwZkWde.js +0 -3
- package/dist/domains/dashboard/web/assets/railroad-abnf-HS5TGJTU-CkHwwI2i.js +0 -1
- package/dist/domains/dashboard/web/assets/railroad-ebnf-LZEXJU2U-8xzEHL6v.js +0 -1
- package/dist/domains/dashboard/web/assets/railroad-peg-WCYAUIDC-nSHBw0tH.js +0 -1
- package/dist/domains/dashboard/web/assets/stateDiagram-v2-MP3YSRHH-CNw52Fkn.js +0 -1
- package/dist/domains/dashboard/web/assets/swimlanesDiagram-VR7AAH4N-6TRvbqqI.js +0 -8
|
@@ -1,166 +1,179 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __cometCreateRequire } from 'module';
|
|
3
3
|
const require = __cometCreateRequire(import.meta.url);
|
|
4
|
-
var
|
|
5
|
-
`)}};
|
|
6
|
-
`)?
|
|
4
|
+
var od=Object.create;var fi=Object.defineProperty;var sd=Object.getOwnPropertyDescriptor;var ad=Object.getOwnPropertyNames;var cd=Object.getPrototypeOf,ld=Object.prototype.hasOwnProperty;var Rr=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var A=(t,e,r)=>()=>{if(r)throw r[0];try{return t&&(e=t(t=0)),e}catch(n){throw r=[n],n}};var w=(t,e)=>()=>{try{return e||t((e={exports:{}}).exports,e),e.exports}catch(r){throw e=0,r}},ud=(t,e)=>{for(var r in e)fi(t,r,{get:e[r],enumerable:!0})},fd=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of ad(e))!ld.call(t,i)&&i!==r&&fi(t,i,{get:()=>e[i],enumerable:!(n=sd(e,i))||n.enumerable});return t};var He=(t,e,r)=>(r=t!=null?od(cd(t)):{},fd(e||!t||!t.__esModule?fi(r,"default",{value:t,enumerable:!0}):r,t));import{AsyncLocalStorage as dd}from"node:async_hooks";function ta(){let t=md.getStore();return t?.active?t:null}function ra(t,e){let r=t;for(let n of e)r+="\0"+(typeof n=="string"?n:JSON.stringify(n));return r}function Ce(t,e){return(...r)=>{let n=ta();if(n===null)return e(...r);let i=ra(`async:${t}`,r),o=n.entries.get(i);if(o)return o.value;let s=e(...r).catch(a=>{throw n.entries.get(i)?.value===s&&n.entries.delete(i),a});return n.entries.set(i,{value:s}),s}}function mi(t,e){return(...r)=>{let n=ta();if(n===null)return e(...r);let i=ra(`sync:${t}`,r),o=n.entries.get(i);if(o)return o.value;let s=e(...r);return n.entries.set(i,{value:s}),s}}var md,At=A(()=>{"use strict";md=new dd});var _=w(W=>{"use strict";var gi=Symbol.for("yaml.alias"),na=Symbol.for("yaml.document"),Or=Symbol.for("yaml.map"),ia=Symbol.for("yaml.pair"),wi=Symbol.for("yaml.scalar"),Ar=Symbol.for("yaml.seq"),pe=Symbol.for("yaml.node.type"),gd=t=>!!t&&typeof t=="object"&&t[pe]===gi,wd=t=>!!t&&typeof t=="object"&&t[pe]===na,yd=t=>!!t&&typeof t=="object"&&t[pe]===Or,vd=t=>!!t&&typeof t=="object"&&t[pe]===ia,oa=t=>!!t&&typeof t=="object"&&t[pe]===wi,bd=t=>!!t&&typeof t=="object"&&t[pe]===Ar;function sa(t){if(t&&typeof t=="object")switch(t[pe]){case Or:case Ar:return!0}return!1}function kd(t){if(t&&typeof t=="object")switch(t[pe]){case gi:case Or:case wi:case Ar:return!0}return!1}var Cd=t=>(oa(t)||sa(t))&&!!t.anchor;W.ALIAS=gi;W.DOC=na;W.MAP=Or;W.NODE_TYPE=pe;W.PAIR=ia;W.SCALAR=wi;W.SEQ=Ar;W.hasAnchor=Cd;W.isAlias=gd;W.isCollection=sa;W.isDocument=wd;W.isMap=yd;W.isNode=kd;W.isPair=vd;W.isScalar=oa;W.isSeq=bd});var Tt=w(yi=>{"use strict";var N=_(),G=Symbol("break visit"),aa=Symbol("skip children"),se=Symbol("remove node");function Tr(t,e){let r=ca(e);N.isDocument(t)?ut(null,t.contents,r,Object.freeze([t]))===se&&(t.contents=null):ut(null,t,r,Object.freeze([]))}Tr.BREAK=G;Tr.SKIP=aa;Tr.REMOVE=se;function ut(t,e,r,n){let i=la(t,e,r,n);if(N.isNode(i)||N.isPair(i))return ua(t,n,i),ut(t,i,r,n);if(typeof i!="symbol"){if(N.isCollection(e)){n=Object.freeze(n.concat(e));for(let o=0;o<e.items.length;++o){let s=ut(o,e.items[o],r,n);if(typeof s=="number")o=s-1;else{if(s===G)return G;s===se&&(e.items.splice(o,1),o-=1)}}}else if(N.isPair(e)){n=Object.freeze(n.concat(e));let o=ut("key",e.key,r,n);if(o===G)return G;o===se&&(e.key=null);let s=ut("value",e.value,r,n);if(s===G)return G;s===se&&(e.value=null)}}return i}async function Nr(t,e){let r=ca(e);N.isDocument(t)?await ft(null,t.contents,r,Object.freeze([t]))===se&&(t.contents=null):await ft(null,t,r,Object.freeze([]))}Nr.BREAK=G;Nr.SKIP=aa;Nr.REMOVE=se;async function ft(t,e,r,n){let i=await la(t,e,r,n);if(N.isNode(i)||N.isPair(i))return ua(t,n,i),ft(t,i,r,n);if(typeof i!="symbol"){if(N.isCollection(e)){n=Object.freeze(n.concat(e));for(let o=0;o<e.items.length;++o){let s=await ft(o,e.items[o],r,n);if(typeof s=="number")o=s-1;else{if(s===G)return G;s===se&&(e.items.splice(o,1),o-=1)}}}else if(N.isPair(e)){n=Object.freeze(n.concat(e));let o=await ft("key",e.key,r,n);if(o===G)return G;o===se&&(e.key=null);let s=await ft("value",e.value,r,n);if(s===G)return G;s===se&&(e.value=null)}}return i}function ca(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 la(t,e,r,n){if(typeof r=="function")return r(t,e,n);if(N.isMap(e))return r.Map?.(t,e,n);if(N.isSeq(e))return r.Seq?.(t,e,n);if(N.isPair(e))return r.Pair?.(t,e,n);if(N.isScalar(e))return r.Scalar?.(t,e,n);if(N.isAlias(e))return r.Alias?.(t,e,n)}function ua(t,e,r){let n=e[e.length-1];if(N.isCollection(n))n.items[t]=r;else if(N.isPair(n))t==="key"?n.key=r:n.value=r;else if(N.isDocument(n))n.contents=r;else{let i=N.isAlias(n)?"alias":"scalar";throw new Error(`Cannot replace node with ${i} parent`)}}yi.visit=Tr;yi.visitAsync=Nr});var vi=w(da=>{"use strict";var fa=_(),Sd=Tt(),Ed={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},_d=t=>t.replace(/[!,[\]{}]/g,e=>Ed[e]),Nt=class t{constructor(e,r){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},t.defaultYaml,e),this.tags=Object.assign({},t.defaultTags,r)}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,r){this.atNextDocument&&(this.yaml={explicit:t.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},t.defaultTags),this.atNextDocument=!1);let n=e.trim().split(/[ \t]+/),i=n.shift();switch(i){case"%TAG":{if(n.length!==2&&(r(0,"%TAG directive should contain exactly two parts"),n.length<2))return!1;let[o,s]=n;return this.tags[o]=s,!0}case"%YAML":{if(this.yaml.explicit=!0,n.length!==1)return r(0,"%YAML directive should contain exactly one part"),!1;let[o]=n;if(o==="1.1"||o==="1.2")return this.yaml.version=o,!0;{let s=/^\d+\.\d+$/.test(o);return r(6,`Unsupported YAML version ${o}`,s),!1}}default:return r(0,`Unknown directive ${i}`,!0),!1}}tagName(e,r){if(e==="!")return"!";if(e[0]!=="!")return r(`Not a valid tag: ${e}`),null;if(e[1]==="<"){let s=e.slice(2,-1);return s==="!"||s==="!!"?(r(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&r("Verbatim tags must end with a >"),s)}let[,n,i]=e.match(/^(.*!)([^!]*)$/s);i||r(`The ${e} tag has no suffix`);let o=this.tags[n];if(o)try{return o+decodeURIComponent(i)}catch(s){return r(String(s)),null}return n==="!"?e:(r(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[r,n]of Object.entries(this.tags))if(e.startsWith(n))return r+_d(e.substring(n.length));return e[0]==="!"?e:`!<${e}>`}toString(e){let r=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],n=Object.entries(this.tags),i;if(e&&n.length>0&&fa.isNode(e.contents)){let o={};Sd.visit(e.contents,(s,a)=>{fa.isNode(a)&&a.tag&&(o[a.tag]=!0)}),i=Object.keys(o)}else i=[];for(let[o,s]of n)o==="!!"&&s==="tag:yaml.org,2002:"||(!e||i.some(a=>a.startsWith(s)))&&r.push(`%TAG ${o} ${s}`);return r.join(`
|
|
5
|
+
`)}};Nt.defaultYaml={explicit:!1,version:"1.2"};Nt.defaultTags={"!!":"tag:yaml.org,2002:"};da.Directives=Nt});var Ir=w(It=>{"use strict";var ma=_(),xd=Tt();function Pd(t){if(/[\x00-\x19\s,[\]{}]/.test(t)){let r=`Anchor must not contain whitespace or control characters: ${JSON.stringify(t)}`;throw new Error(r)}return!0}function pa(t){let e=new Set;return xd.visit(t,{Value(r,n){n.anchor&&e.add(n.anchor)}}),e}function ha(t,e){for(let r=1;;++r){let n=`${t}${r}`;if(!e.has(n))return n}}function Rd(t,e){let r=[],n=new Map,i=null;return{onAnchor:o=>{r.push(o),i??(i=pa(t));let s=ha(e,i);return i.add(s),s},setAnchors:()=>{for(let o of r){let s=n.get(o);if(typeof s=="object"&&s.anchor&&(ma.isScalar(s.node)||ma.isCollection(s.node)))s.node.anchor=s.anchor;else{let a=new Error("Failed to resolve repeated object (this should not happen)");throw a.source=o,a}}},sourceObjects:n}}It.anchorIsValid=Pd;It.anchorNames=pa;It.createNodeAnchors=Rd;It.findNewAnchor=ha});var bi=w(ga=>{"use strict";function Lt(t,e,r,n){if(n&&typeof n=="object")if(Array.isArray(n))for(let i=0,o=n.length;i<o;++i){let s=n[i],a=Lt(t,n,String(i),s);a===void 0?delete n[i]:a!==s&&(n[i]=a)}else if(n instanceof Map)for(let i of Array.from(n.keys())){let o=n.get(i),s=Lt(t,n,i,o);s===void 0?n.delete(i):s!==o&&n.set(i,s)}else if(n instanceof Set)for(let i of Array.from(n)){let o=Lt(t,n,i,i);o===void 0?n.delete(i):o!==i&&(n.delete(i),n.add(o))}else for(let[i,o]of Object.entries(n)){let s=Lt(t,n,i,o);s===void 0?delete n[i]:s!==o&&(n[i]=s)}return t.call(e,r,n)}ga.applyReviver=Lt});var Se=w(ya=>{"use strict";var Od=_();function wa(t,e,r){if(Array.isArray(t))return t.map((n,i)=>wa(n,String(i),r));if(t&&typeof t.toJSON=="function"){if(!r||!Od.hasAnchor(t))return t.toJSON(e,r);let n={aliasCount:0,count:1,res:void 0};r.anchors.set(t,n),r.onCreate=o=>{n.res=o,delete r.onCreate};let i=t.toJSON(e,r);return r.onCreate&&r.onCreate(i),i}return typeof t=="bigint"&&!r?.keep?Number(t):t}ya.toJS=wa});var Lr=w(ba=>{"use strict";var Ad=bi(),va=_(),Td=Se(),ki=class{constructor(e){Object.defineProperty(this,va.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:r,maxAliasCount:n,onAnchor:i,reviver:o}={}){if(!va.isDocument(e))throw new TypeError("A document argument is required");let s={anchors:new Map,doc:e,keep:!0,mapAsMap:r===!0,mapKeyWarned:!1,maxAliasCount:typeof n=="number"?n:100},a=Td.toJS(this,"",s);if(typeof i=="function")for(let{count:c,res:l}of s.anchors.values())i(l,c);return typeof o=="function"?Ad.applyReviver(o,{"":a},"",a):a}};ba.NodeBase=ki});var $t=w(ka=>{"use strict";var Nd=Ir(),Id=Tt(),dt=_(),Ld=Lr(),$d=Se(),Ci=class extends Ld.NodeBase{constructor(e){super(dt.ALIAS),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e,r){if(r?.maxAliasCount===0)throw new ReferenceError("Alias resolution is disabled");let n;r?.aliasResolveCache?n=r.aliasResolveCache:(n=[],Id.visit(e,{Node:(o,s)=>{(dt.isAlias(s)||dt.hasAnchor(s))&&n.push(s)}}),r&&(r.aliasResolveCache=n));let i;for(let o of n){if(o===this)break;o.anchor===this.source&&(i=o)}return i}toJSON(e,r){if(!r)return{source:this.source};let{anchors:n,doc:i,maxAliasCount:o}=r,s=this.resolve(i,r);if(!s){let c=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(c)}let a=n.get(s);if(a||($d.toJS(s,null,r),a=n.get(s)),a?.res===void 0){let c="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(c)}if(o>=0&&(a.count+=1,a.aliasCount===0&&(a.aliasCount=$r(i,s,n)),a.count*a.aliasCount>o)){let c="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(c)}return a.res}toString(e,r,n){let i=`*${this.source}`;if(e){if(Nd.anchorIsValid(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let o=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(o)}if(e.implicitKey)return`${i} `}return i}};function $r(t,e,r){if(dt.isAlias(e)){let n=e.resolve(t),i=r&&n&&r.get(n);return i?i.count*i.aliasCount:0}else if(dt.isCollection(e)){let n=0;for(let i of e.items){let o=$r(t,i,r);o>n&&(n=o)}return n}else if(dt.isPair(e)){let n=$r(t,e.key,r),i=$r(t,e.value,r);return Math.max(n,i)}return 1}ka.Alias=Ci});var T=w(Si=>{"use strict";var jd=_(),Wd=Lr(),Dd=Se(),qd=t=>!t||typeof t!="function"&&typeof t!="object",Ee=class extends Wd.NodeBase{constructor(e){super(jd.SCALAR),this.value=e}toJSON(e,r){return r?.keep?this.value:Dd.toJS(this.value,e,r)}toString(){return String(this.value)}};Ee.BLOCK_FOLDED="BLOCK_FOLDED";Ee.BLOCK_LITERAL="BLOCK_LITERAL";Ee.PLAIN="PLAIN";Ee.QUOTE_DOUBLE="QUOTE_DOUBLE";Ee.QUOTE_SINGLE="QUOTE_SINGLE";Si.Scalar=Ee;Si.isScalarValue=qd});var jt=w(Sa=>{"use strict";var Md=$t(),ze=_(),Ca=T(),Fd="tag:yaml.org,2002:";function Bd(t,e,r){if(e){let n=r.filter(o=>o.tag===e),i=n.find(o=>!o.format)??n[0];if(!i)throw new Error(`Tag ${e} not found`);return i}return r.find(n=>n.identify?.(t)&&!n.format)}function Ud(t,e,r){if(ze.isDocument(t)&&(t=t.contents),ze.isNode(t))return t;if(ze.isPair(t)){let f=r.schema[ze.MAP].createNode?.(r.schema,null,r);return f.items.push(t),f}(t instanceof String||t instanceof Number||t instanceof Boolean||typeof BigInt<"u"&&t instanceof BigInt)&&(t=t.valueOf());let{aliasDuplicateObjects:n,onAnchor:i,onTagObj:o,schema:s,sourceObjects:a}=r,c;if(n&&t&&typeof t=="object"){if(c=a.get(t),c)return c.anchor??(c.anchor=i(t)),new Md.Alias(c.anchor);c={anchor:null,node:null},a.set(t,c)}e?.startsWith("!!")&&(e=Fd+e.slice(2));let l=Bd(t,e,s.tags);if(!l){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let f=new Ca.Scalar(t);return c&&(c.node=f),f}l=t instanceof Map?s[ze.MAP]:Symbol.iterator in Object(t)?s[ze.SEQ]:s[ze.MAP]}o&&(o(l),delete r.onTagObj);let u=l?.createNode?l.createNode(r.schema,t,r):typeof l?.nodeClass?.from=="function"?l.nodeClass.from(r.schema,t,r):new Ca.Scalar(t);return e?u.tag=e:l.default||(u.tag=l.tag),c&&(c.node=u),u}Sa.createNode=Ud});var Wr=w(jr=>{"use strict";var Gd=jt(),ae=_(),Kd=Lr();function Ei(t,e,r){let n=r;for(let i=e.length-1;i>=0;--i){let o=e[i];if(typeof o=="number"&&Number.isInteger(o)&&o>=0){let s=[];s[o]=n,n=s}else n=new Map([[o,n]])}return Gd.createNode(n,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:t,sourceObjects:new Map})}var Ea=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,_i=class extends Kd.NodeBase{constructor(e,r){super(e),Object.defineProperty(this,"schema",{value:r,configurable:!0,enumerable:!1,writable:!0})}clone(e){let r=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(r.schema=e),r.items=r.items.map(n=>ae.isNode(n)||ae.isPair(n)?n.clone(e):n),this.range&&(r.range=this.range.slice()),r}addIn(e,r){if(Ea(e))this.add(r);else{let[n,...i]=e,o=this.get(n,!0);if(ae.isCollection(o))o.addIn(i,r);else if(o===void 0&&this.schema)this.set(n,Ei(this.schema,i,r));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}deleteIn(e){let[r,...n]=e;if(n.length===0)return this.delete(r);let i=this.get(r,!0);if(ae.isCollection(i))return i.deleteIn(n);throw new Error(`Expected YAML collection at ${r}. Remaining path: ${n}`)}getIn(e,r){let[n,...i]=e,o=this.get(n,!0);return i.length===0?!r&&ae.isScalar(o)?o.value:o:ae.isCollection(o)?o.getIn(i,r):void 0}hasAllNullValues(e){return this.items.every(r=>{if(!ae.isPair(r))return!1;let n=r.value;return n==null||e&&ae.isScalar(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){let[r,...n]=e;if(n.length===0)return this.has(r);let i=this.get(r,!0);return ae.isCollection(i)?i.hasIn(n):!1}setIn(e,r){let[n,...i]=e;if(i.length===0)this.set(n,r);else{let o=this.get(n,!0);if(ae.isCollection(o))o.setIn(i,r);else if(o===void 0&&this.schema)this.set(n,Ei(this.schema,i,r));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}};jr.Collection=_i;jr.collectionFromPath=Ei;jr.isEmptyPath=Ea});var Wt=w(Dr=>{"use strict";var Hd=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function xi(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var zd=(t,e,r)=>t.endsWith(`
|
|
6
|
+
`)?xi(r,e):r.includes(`
|
|
7
7
|
`)?`
|
|
8
|
-
`+
|
|
9
|
-
`)r===
|
|
8
|
+
`+xi(r,e):(t.endsWith(" ")?"":" ")+r;Dr.indentComment=xi;Dr.lineComment=zd;Dr.stringifyComment=Hd});var xa=w(Dt=>{"use strict";var Jd="flow",Pi="block",qr="quoted";function Yd(t,e,r="flow",{indentAtStart:n,lineWidth:i=80,minContentWidth:o=20,onFold:s,onOverflow:a}={}){if(!i||i<0)return t;i<o&&(o=0);let c=Math.max(1+o,1+i-e.length);if(t.length<=c)return t;let l=[],u={},f=i-e.length;typeof n=="number"&&(n>i-Math.max(2,o)?l.push(0):f=i-n);let d,p,h=!1,m=-1,g=-1,y=-1;r===Pi&&(m=_a(t,m,e.length),m!==-1&&(f=m+c));for(let k;k=t[m+=1];){if(r===qr&&k==="\\"){switch(g=m,t[m+1]){case"x":m+=3;break;case"u":m+=5;break;case"U":m+=9;break;default:m+=1}y=m}if(k===`
|
|
9
|
+
`)r===Pi&&(m=_a(t,m,e.length)),f=m+e.length+c,d=void 0;else{if(k===" "&&p&&p!==" "&&p!==`
|
|
10
10
|
`&&p!==" "){let C=t[m+1];C&&C!==" "&&C!==`
|
|
11
|
-
`&&C!==" "&&(d=m)}if(m>=f)if(d)l.push(d),f=d+c,d=void 0;else if(r===
|
|
12
|
-
${e}${t.slice(0,S)}`:(r===
|
|
13
|
-
${e}${t.slice(C+1,S)}`)}return b}function
|
|
14
|
-
`);n=e,i=e+1,o=t[i]}return n}
|
|
15
|
-
`){if(o-s>n)return!0;if(s=o+1,i-s<=n)return!1}return!0}function
|
|
11
|
+
`&&C!==" "&&(d=m)}if(m>=f)if(d)l.push(d),f=d+c,d=void 0;else if(r===qr){for(;p===" "||p===" ";)p=k,k=t[m+=1],h=!0;let C=m>y+1?m-2:g-1;if(u[C])return t;l.push(C),u[C]=!0,f=C+c,d=void 0}else h=!0}p=k}if(h&&a&&a(),l.length===0)return t;s&&s();let b=t.slice(0,l[0]);for(let k=0;k<l.length;++k){let C=l[k],S=l[k+1]||t.length;C===0?b=`
|
|
12
|
+
${e}${t.slice(0,S)}`:(r===qr&&u[C]&&(b+=`${t[C]}\\`),b+=`
|
|
13
|
+
${e}${t.slice(C+1,S)}`)}return b}function _a(t,e,r){let n=e,i=e+1,o=t[i];for(;o===" "||o===" ";)if(e<i+r)o=t[++e];else{do o=t[++e];while(o&&o!==`
|
|
14
|
+
`);n=e,i=e+1,o=t[i]}return n}Dt.FOLD_BLOCK=Pi;Dt.FOLD_FLOW=Jd;Dt.FOLD_QUOTED=qr;Dt.foldFlowLines=Yd});var Mt=w(Pa=>{"use strict";var ie=T(),_e=xa(),Fr=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),Br=t=>/^(%|---|\.\.\.)/m.test(t);function Vd(t,e,r){if(!e||e<0)return!1;let n=e-r,i=t.length;if(i<=n)return!1;for(let o=0,s=0;o<i;++o)if(t[o]===`
|
|
15
|
+
`){if(o-s>n)return!0;if(s=o+1,i-s<=n)return!1}return!0}function qt(t,e){let r=JSON.stringify(t);if(e.options.doubleQuotedAsJSON)return r;let{implicitKey:n}=e,i=e.options.doubleQuotedMinMultiLineLength,o=e.indent||(Br(t)?" ":""),s="",a=0;for(let c=0,l=r[c];l;l=r[++c])if(l===" "&&r[c+1]==="\\"&&r[c+2]==="n"&&(s+=r.slice(a,c)+"\\ ",c+=1,a=c,l="\\"),l==="\\")switch(r[c+1]){case"u":{s+=r.slice(a,c);let u=r.substr(c+2,4);switch(u){case"0000":s+="\\0";break;case"0007":s+="\\a";break;case"000b":s+="\\v";break;case"001b":s+="\\e";break;case"0085":s+="\\N";break;case"00a0":s+="\\_";break;case"2028":s+="\\L";break;case"2029":s+="\\P";break;default:u.substr(0,2)==="00"?s+="\\x"+u.substr(2):s+=r.substr(c,6)}c+=5,a=c+1}break;case"n":if(n||r[c+2]==='"'||r.length<i)c+=1;else{for(s+=r.slice(a,c)+`
|
|
16
16
|
|
|
17
17
|
`;r[c+2]==="\\"&&r[c+3]==="n"&&r[c+4]!=='"';)s+=`
|
|
18
|
-
`,c+=2;s+=o,r[c+2]===" "&&(s+="\\"),c+=1,a=c+1}break;default:c+=1}return s=a?s+r.slice(a):r,n?s:
|
|
19
|
-
`)||/[ \t]\n|\n[ \t]/.test(t))return
|
|
20
|
-
${r}`)+"'";return e.implicitKey?n:
|
|
18
|
+
`,c+=2;s+=o,r[c+2]===" "&&(s+="\\"),c+=1,a=c+1}break;default:c+=1}return s=a?s+r.slice(a):r,n?s:_e.foldFlowLines(s,o,_e.FOLD_QUOTED,Fr(e,!1))}function Ri(t,e){if(e.options.singleQuote===!1||e.implicitKey&&t.includes(`
|
|
19
|
+
`)||/[ \t]\n|\n[ \t]/.test(t))return qt(t,e);let r=e.indent||(Br(t)?" ":""),n="'"+t.replace(/'/g,"''").replace(/\n+/g,`$&
|
|
20
|
+
${r}`)+"'";return e.implicitKey?n:_e.foldFlowLines(n,r,_e.FOLD_FLOW,Fr(e,!1))}function mt(t,e){let{singleQuote:r}=e.options,n;if(r===!1)n=qt;else{let i=t.includes('"'),o=t.includes("'");i&&!o?n=Ri:o&&!i?n=qt:n=r?Ri:qt}return n(t,e)}var Oi;try{Oi=new RegExp(`(^|(?<!
|
|
21
21
|
))
|
|
22
22
|
+(?!
|
|
23
|
-
|$)`,"g")}catch{
|
|
23
|
+
|$)`,"g")}catch{Oi=/\n+(?!\n|$)/g}function Mr({comment:t,type:e,value:r},n,i,o){let{blockQuote:s,commentString:a,lineWidth:c}=n.options;if(!s||/\n[\t ]+$/.test(r))return mt(r,n);let l=n.indent||(n.forceBlockIndent||Br(r)?" ":""),u=s==="literal"?!0:s==="folded"||e===ie.Scalar.BLOCK_FOLDED?!1:e===ie.Scalar.BLOCK_LITERAL?!0:!Vd(r,c,l.length);if(!r)return u?`|
|
|
24
24
|
`:`>
|
|
25
25
|
`;let f,d;for(d=r.length;d>0;--d){let S=r[d-1];if(S!==`
|
|
26
26
|
`&&S!==" "&&S!==" ")break}let p=r.substring(d),h=p.indexOf(`
|
|
27
27
|
`);h===-1?f="-":r===p||h!==p.length-1?(f="+",o&&o()):f="",p&&(r=r.slice(0,-p.length),p[p.length-1]===`
|
|
28
|
-
`&&(p=p.slice(0,-1)),p=p.replace(
|
|
29
|
-
`)
|
|
30
|
-
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${l}`),E=!1,P=
|
|
31
|
-
${l}${
|
|
32
|
-
${l}${b}${r}${p}`}function
|
|
33
|
-
`)||u&&/[[\]{},]/.test(o))return
|
|
34
|
-
`)?
|
|
35
|
-
`))return
|
|
36
|
-
${c}`);if(s){let d=m=>m.default&&m.tag!=="tag:yaml.org,2002:str"&&m.test?.test(f),{compat:p,tags:h}=e.doc.schema;if(h.some(d)||p?.some(d))return
|
|
37
|
-
${e.indent}${a}`:a}
|
|
38
|
-
${a}:`):(g=`${g}:`,d&&(g
|
|
28
|
+
`&&(p=p.slice(0,-1)),p=p.replace(Oi,`$&${l}`));let m=!1,g,y=-1;for(g=0;g<r.length;++g){let S=r[g];if(S===" ")m=!0;else if(S===`
|
|
29
|
+
`)y=g;else break}let b=r.substring(0,y<g?y+1:g);b&&(r=r.substring(b.length),b=b.replace(/\n+/g,`$&${l}`));let C=(m?l?"2":"1":"")+f;if(t&&(C+=" "+a(t.replace(/ ?[\r\n]+/g," ")),i&&i()),!u){let S=r.replace(/\n+/g,`
|
|
30
|
+
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${l}`),E=!1,P=Fr(n,!0);s!=="folded"&&e!==ie.Scalar.BLOCK_FOLDED&&(P.onOverflow=()=>{E=!0});let v=_e.foldFlowLines(`${b}${S}${p}`,l,_e.FOLD_BLOCK,P);if(!E)return`>${C}
|
|
31
|
+
${l}${v}`}return r=r.replace(/\n+/g,`$&${l}`),`|${C}
|
|
32
|
+
${l}${b}${r}${p}`}function Xd(t,e,r,n){let{type:i,value:o}=t,{actualString:s,implicitKey:a,indent:c,indentStep:l,inFlow:u}=e;if(a&&o.includes(`
|
|
33
|
+
`)||u&&/[[\]{},]/.test(o))return mt(o,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(o))return a||u||!o.includes(`
|
|
34
|
+
`)?mt(o,e):Mr(t,e,r,n);if(!a&&!u&&i!==ie.Scalar.PLAIN&&o.includes(`
|
|
35
|
+
`))return Mr(t,e,r,n);if(Br(o)){if(c==="")return e.forceBlockIndent=!0,Mr(t,e,r,n);if(a&&c===l)return mt(o,e)}let f=o.replace(/\n+/g,`$&
|
|
36
|
+
${c}`);if(s){let d=m=>m.default&&m.tag!=="tag:yaml.org,2002:str"&&m.test?.test(f),{compat:p,tags:h}=e.doc.schema;if(h.some(d)||p?.some(d))return mt(o,e)}return a?f:_e.foldFlowLines(f,c,_e.FOLD_FLOW,Fr(e,!1))}function Qd(t,e,r,n){let{implicitKey:i,inFlow:o}=e,s=typeof t.value=="string"?t:Object.assign({},t,{value:String(t.value)}),{type:a}=t;a!==ie.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(s.value)&&(a=ie.Scalar.QUOTE_DOUBLE);let c=u=>{switch(u){case ie.Scalar.BLOCK_FOLDED:case ie.Scalar.BLOCK_LITERAL:return i||o?mt(s.value,e):Mr(s,e,r,n);case ie.Scalar.QUOTE_DOUBLE:return qt(s.value,e);case ie.Scalar.QUOTE_SINGLE:return Ri(s.value,e);case ie.Scalar.PLAIN:return Xd(s,e,r,n);default:return null}},l=c(a);if(l===null){let{defaultKeyType:u,defaultStringType:f}=e.options,d=i&&u||f;if(l=c(d),l===null)throw new Error(`Unsupported default string type ${d}`)}return l}Pa.stringifyString=Qd});var Ft=w(Ai=>{"use strict";var Zd=Ir(),xe=_(),em=Wt(),tm=Mt();function rm(t,e){let r=Object.assign({blockQuote:!0,commentString:em.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),n;switch(r.collectionStyle){case"block":n=!1;break;case"flow":n=!0;break;default:n=null}return{anchors:new Set,doc:t,flowCollectionPadding:r.flowCollectionPadding?" ":"",indent:"",indentStep:typeof r.indent=="number"?" ".repeat(r.indent):" ",inFlow:n,options:r}}function nm(t,e){if(e.tag){let i=t.filter(o=>o.tag===e.tag);if(i.length>0)return i.find(o=>o.format===e.format)??i[0]}let r,n;if(xe.isScalar(e)){n=e.value;let i=t.filter(o=>o.identify?.(n));if(i.length>1){let o=i.filter(s=>s.test);o.length>0&&(i=o)}r=i.find(o=>o.format===e.format)??i.find(o=>!o.format)}else n=e,r=t.find(i=>i.nodeClass&&n instanceof i.nodeClass);if(!r){let i=n?.constructor?.name??(n===null?"null":typeof n);throw new Error(`Tag not resolved for ${i} value`)}return r}function im(t,e,{anchors:r,doc:n}){if(!n.directives)return"";let i=[],o=(xe.isScalar(t)||xe.isCollection(t))&&t.anchor;o&&Zd.anchorIsValid(o)&&(r.add(o),i.push(`&${o}`));let s=t.tag??(e.default?null:e.tag);return s&&i.push(n.directives.tagString(s)),i.join(" ")}function om(t,e,r,n){if(xe.isPair(t))return t.toString(e,r,n);if(xe.isAlias(t)){if(e.doc.directives)return t.toString(e);if(e.resolvedAliases?.has(t))throw new TypeError("Cannot stringify circular structure without alias nodes");e.resolvedAliases?e.resolvedAliases.add(t):e.resolvedAliases=new Set([t]),t=t.resolve(e.doc)}let i,o=xe.isNode(t)?t:e.doc.createNode(t,{onTagObj:c=>i=c});i??(i=nm(e.doc.schema.tags,o));let s=im(o,i,e);s.length>0&&(e.indentAtStart=(e.indentAtStart??0)+s.length+1);let a=typeof i.stringify=="function"?i.stringify(o,e,r,n):xe.isScalar(o)?tm.stringifyString(o,e,r,n):o.toString(e,r,n);return s?xe.isScalar(o)||a[0]==="{"||a[0]==="["?`${s} ${a}`:`${s}
|
|
37
|
+
${e.indent}${a}`:a}Ai.createStringifyContext=rm;Ai.stringify=om});var Ta=w(Aa=>{"use strict";var he=_(),Ra=T(),Oa=Ft(),Bt=Wt();function sm({key:t,value:e},r,n,i){let{allNullValues:o,doc:s,indent:a,indentStep:c,options:{commentString:l,indentSeq:u,simpleKeys:f}}=r,d=he.isNode(t)&&t.comment||null;if(f){if(d)throw new Error("With simple keys, key nodes cannot have comments");if(he.isCollection(t)||!he.isNode(t)&&typeof t=="object"){let P="With simple keys, collection cannot be used as a key value";throw new Error(P)}}let p=!f&&(!t||d&&e==null&&!r.inFlow||he.isCollection(t)||(he.isScalar(t)?t.type===Ra.Scalar.BLOCK_FOLDED||t.type===Ra.Scalar.BLOCK_LITERAL:typeof t=="object"));r=Object.assign({},r,{allNullValues:!1,implicitKey:!p&&(f||!o),indent:a+c});let h=!1,m=!1,g=Oa.stringify(t,r,()=>h=!0,()=>m=!0);if(!p&&!r.inFlow&&g.length>1024){if(f)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");p=!0}if(r.inFlow){if(o||e==null)return h&&n&&n(),g===""?"?":p?`? ${g}`:g}else if(o&&!f||e==null&&p)return g=`? ${g}`,d&&!h?g+=Bt.lineComment(g,r.indent,l(d)):m&&i&&i(),g;h&&(d=null),p?(d&&(g+=Bt.lineComment(g,r.indent,l(d))),g=`? ${g}
|
|
38
|
+
${a}:`):(g=`${g}:`,d&&(g+=Bt.lineComment(g,r.indent,l(d))));let y,b,k;he.isNode(e)?(y=!!e.spaceBefore,b=e.commentBefore,k=e.comment):(y=!1,b=null,k=null,e&&typeof e=="object"&&(e=s.createNode(e))),r.implicitKey=!1,!p&&!d&&he.isScalar(e)&&(r.indentAtStart=g.length+1),m=!1,!u&&c.length>=2&&!r.inFlow&&!p&&he.isSeq(e)&&!e.flow&&!e.tag&&!e.anchor&&(r.indent=r.indent.substring(2));let C=!1,S=Oa.stringify(e,r,()=>C=!0,()=>m=!0),E=" ";if(d||y||b){if(E=y?`
|
|
39
39
|
`:"",b){let P=l(b);E+=`
|
|
40
|
-
${
|
|
40
|
+
${Bt.indentComment(P,r.indent)}`}S===""&&!r.inFlow?E===`
|
|
41
41
|
`&&k&&(E=`
|
|
42
42
|
|
|
43
43
|
`):E+=`
|
|
44
|
-
${r.indent}`}else if(!p&&
|
|
45
|
-
`),O=
|
|
44
|
+
${r.indent}`}else if(!p&&he.isCollection(e)){let P=S[0],v=S.indexOf(`
|
|
45
|
+
`),O=v!==-1,ne=r.inFlow??e.flow??e.items.length===0;if(O||!ne){let fe=!1;if(O&&(P==="&"||P==="!")){let R=S.indexOf(" ");P==="&"&&R!==-1&&R<v&&S[R+1]==="!"&&(R=S.indexOf(" ",R+1)),(R===-1||v<R)&&(fe=!0)}fe||(E=`
|
|
46
46
|
${r.indent}`)}}else(S===""||S[0]===`
|
|
47
|
-
`)&&(E="");return g+=E+S,r.inFlow?C&&n&&n():k&&!C?g
|
|
47
|
+
`)&&(E="");return g+=E+S,r.inFlow?C&&n&&n():k&&!C?g+=Bt.lineComment(g,r.indent,l(k)):m&&i&&i(),g}Aa.stringifyPair=sm});var Ni=w(Ti=>{"use strict";var Na=Rr("process");function am(t,...e){t==="debug"&&console.log(...e)}function cm(t,e){(t==="debug"||t==="warn")&&(typeof Na.emitWarning=="function"?Na.emitWarning(e):console.warn(e))}Ti.debug=am;Ti.warn=cm});var zr=w(Hr=>{"use strict";var Kr=_(),Ia=T(),Ur="<<",Gr={identify:t=>t===Ur||typeof t=="symbol"&&t.description===Ur,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new Ia.Scalar(Symbol(Ur)),{addToJSMap:La}),stringify:()=>Ur},lm=(t,e)=>(Gr.identify(e)||Kr.isScalar(e)&&(!e.type||e.type===Ia.Scalar.PLAIN)&&Gr.identify(e.value))&&t?.doc.schema.tags.some(r=>r.tag===Gr.tag&&r.default);function La(t,e,r){let n=$a(t,r);if(Kr.isSeq(n))for(let i of n.items)Ii(t,e,i);else if(Array.isArray(n))for(let i of n)Ii(t,e,i);else Ii(t,e,n)}function Ii(t,e,r){let n=$a(t,r);if(!Kr.isMap(n))throw new Error("Merge sources must be maps or map aliases");let i=n.toJSON(null,t,Map);for(let[o,s]of i)e instanceof Map?e.has(o)||e.set(o,s):e instanceof Set?e.add(o):Object.prototype.hasOwnProperty.call(e,o)||Object.defineProperty(e,o,{value:s,writable:!0,enumerable:!0,configurable:!0});return e}function $a(t,e){return t&&Kr.isAlias(e)?e.resolve(t.doc,t):e}Hr.addMergeToJSMap=La;Hr.isMergeKey=lm;Hr.merge=Gr});var $i=w(Da=>{"use strict";var um=Ni(),ja=zr(),fm=Ft(),Wa=_(),Li=Se();function dm(t,e,{key:r,value:n}){if(Wa.isNode(r)&&r.addToJSMap)r.addToJSMap(t,e,n);else if(ja.isMergeKey(t,r))ja.addMergeToJSMap(t,e,n);else{let i=Li.toJS(r,"",t);if(e instanceof Map)e.set(i,Li.toJS(n,i,t));else if(e instanceof Set)e.add(i);else{let o=mm(r,i,t),s=Li.toJS(n,o,t);o in e?Object.defineProperty(e,o,{value:s,writable:!0,enumerable:!0,configurable:!0}):e[o]=s}}return e}function mm(t,e,r){if(e===null)return"";if(typeof e!="object")return String(e);if(Wa.isNode(t)&&r?.doc){let n=fm.createStringifyContext(r.doc,{});n.anchors=new Set;for(let o of r.anchors.keys())n.anchors.add(o.anchor);n.inFlow=!0,n.inStringifyKey=!0;let i=t.toString(n);if(!r.mapKeyWarned){let o=JSON.stringify(i);o.length>40&&(o=o.substring(0,36)+'..."'),um.warn(r.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${o}. Set mapAsMap: true to use object keys.`),r.mapKeyWarned=!0}return i}return JSON.stringify(e)}Da.addPairToJSMap=dm});var Pe=w(ji=>{"use strict";var qa=jt(),pm=Ta(),hm=$i(),Jr=_();function gm(t,e,r){let n=qa.createNode(t,void 0,r),i=qa.createNode(e,void 0,r);return new Yr(n,i)}var Yr=class t{constructor(e,r=null){Object.defineProperty(this,Jr.NODE_TYPE,{value:Jr.PAIR}),this.key=e,this.value=r}clone(e){let{key:r,value:n}=this;return Jr.isNode(r)&&(r=r.clone(e)),Jr.isNode(n)&&(n=n.clone(e)),new t(r,n)}toJSON(e,r){let n=r?.mapAsMap?new Map:{};return hm.addPairToJSMap(r,n,this)}toString(e,r,n){return e?.doc?pm.stringifyPair(this,e,r,n):JSON.stringify(this)}};ji.Pair=Yr;ji.createPair=gm});var Wi=w(Fa=>{"use strict";var Je=_(),Ma=Ft(),Vr=Wt();function wm(t,e,r){return(e.inFlow??t.flow?vm:ym)(t,e,r)}function ym({comment:t,items:e},r,{blockItemPrefix:n,flowChars:i,itemIndent:o,onChompKeep:s,onComment:a}){let{indent:c,options:{commentString:l}}=r,u=Object.assign({},r,{indent:o,type:null}),f=!1,d=[];for(let h=0;h<e.length;++h){let m=e[h],g=null;if(Je.isNode(m))!f&&m.spaceBefore&&d.push(""),Xr(r,d,m.commentBefore,f),m.comment&&(g=m.comment);else if(Je.isPair(m)){let b=Je.isNode(m.key)?m.key:null;b&&(!f&&b.spaceBefore&&d.push(""),Xr(r,d,b.commentBefore,f))}f=!1;let y=Ma.stringify(m,u,()=>g=null,()=>f=!0);g&&(y+=Vr.lineComment(y,o,l(g))),f&&g&&(f=!1),d.push(n+y)}let p;if(d.length===0)p=i.start+i.end;else{p=d[0];for(let h=1;h<d.length;++h){let m=d[h];p+=m?`
|
|
48
48
|
${c}${m}`:`
|
|
49
49
|
`}}return t?(p+=`
|
|
50
|
-
`+
|
|
51
|
-
`)),h<t.length-1?
|
|
50
|
+
`+Vr.indentComment(l(t),c),a&&a()):f&&s&&s(),p}function vm({items:t},e,{flowChars:r,itemIndent:n}){let{indent:i,indentStep:o,flowCollectionPadding:s,options:{commentString:a}}=e;n+=o;let c=Object.assign({},e,{indent:n,inFlow:!0,type:null}),l=!1,u=0,f=[];for(let h=0;h<t.length;++h){let m=t[h],g=null;if(Je.isNode(m))m.spaceBefore&&f.push(""),Xr(e,f,m.commentBefore,!1),m.comment&&(g=m.comment);else if(Je.isPair(m)){let b=Je.isNode(m.key)?m.key:null;b&&(b.spaceBefore&&f.push(""),Xr(e,f,b.commentBefore,!1),b.comment&&(l=!0));let k=Je.isNode(m.value)?m.value:null;k?(k.comment&&(g=k.comment),k.commentBefore&&(l=!0)):m.value==null&&b?.comment&&(g=b.comment)}g&&(l=!0);let y=Ma.stringify(m,c,()=>g=null);l||(l=f.length>u||y.includes(`
|
|
51
|
+
`)),h<t.length-1?y+=",":e.options.trailingComma&&(e.options.lineWidth>0&&(l||(l=f.reduce((b,k)=>b+k.length+2,2)+(y.length+2)>e.options.lineWidth)),l&&(y+=",")),g&&(y+=Vr.lineComment(y,n,a(g))),f.push(y),u=f.length}let{start:d,end:p}=r;if(f.length===0)return d+p;if(!l){let h=f.reduce((m,g)=>m+g.length+2,2);l=e.options.lineWidth>0&&h>e.options.lineWidth}if(l){let h=d;for(let m of f)h+=m?`
|
|
52
52
|
${o}${i}${m}`:`
|
|
53
53
|
`;return`${h}
|
|
54
|
-
${i}${p}`}else return`${d}${s}${f.join(" ")}${s}${p}`}function
|
|
55
|
-
`:" ")}return
|
|
54
|
+
${i}${p}`}else return`${d}${s}${f.join(" ")}${s}${p}`}function Xr({indent:t,options:{commentString:e}},r,n,i){if(n&&i&&(n=n.replace(/^\n+/,"")),n){let o=Vr.indentComment(e(n),t);r.push(o.trimStart())}}Fa.stringifyCollection=wm});var Oe=w(qi=>{"use strict";var bm=Wi(),km=$i(),Cm=Wr(),Re=_(),Qr=Pe(),Sm=T();function Ut(t,e){let r=Re.isScalar(e)?e.value:e;for(let n of t)if(Re.isPair(n)&&(n.key===e||n.key===r||Re.isScalar(n.key)&&n.key.value===r))return n}var Di=class extends Cm.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(Re.MAP,e),this.items=[]}static from(e,r,n){let{keepUndefined:i,replacer:o}=n,s=new this(e),a=(c,l)=>{if(typeof o=="function")l=o.call(r,c,l);else if(Array.isArray(o)&&!o.includes(c))return;(l!==void 0||i)&&s.items.push(Qr.createPair(c,l,n))};if(r instanceof Map)for(let[c,l]of r)a(c,l);else if(r&&typeof r=="object")for(let c of Object.keys(r))a(c,r[c]);return typeof e.sortMapEntries=="function"&&s.items.sort(e.sortMapEntries),s}add(e,r){let n;Re.isPair(e)?n=e:!e||typeof e!="object"||!("key"in e)?n=new Qr.Pair(e,e?.value):n=new Qr.Pair(e.key,e.value);let i=Ut(this.items,n.key),o=this.schema?.sortMapEntries;if(i){if(!r)throw new Error(`Key ${n.key} already set`);Re.isScalar(i.value)&&Sm.isScalarValue(n.value)?i.value.value=n.value:i.value=n.value}else if(o){let s=this.items.findIndex(a=>o(n,a)<0);s===-1?this.items.push(n):this.items.splice(s,0,n)}else this.items.push(n)}delete(e){let r=Ut(this.items,e);return r?this.items.splice(this.items.indexOf(r),1).length>0:!1}get(e,r){let i=Ut(this.items,e)?.value;return(!r&&Re.isScalar(i)?i.value:i)??void 0}has(e){return!!Ut(this.items,e)}set(e,r){this.add(new Qr.Pair(e,r),!0)}toJSON(e,r,n){let i=n?new n:r?.mapAsMap?new Map:{};r?.onCreate&&r.onCreate(i);for(let o of this.items)km.addPairToJSMap(r,i,o);return i}toString(e,r,n){if(!e)return JSON.stringify(this);for(let i of this.items)if(!Re.isPair(i))throw new Error(`Map items must all be pairs; found ${JSON.stringify(i)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),bm.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:n,onComment:r})}};qi.YAMLMap=Di;qi.findPair=Ut});var pt=w(Ua=>{"use strict";var Em=_(),Ba=Oe(),_m={collection:"map",default:!0,nodeClass:Ba.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(t,e){return Em.isMap(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,r)=>Ba.YAMLMap.from(t,e,r)};Ua.map=_m});var Ae=w(Ga=>{"use strict";var xm=jt(),Pm=Wi(),Rm=Wr(),en=_(),Om=T(),Am=Se(),Mi=class extends Rm.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(en.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let r=Zr(e);return typeof r!="number"?!1:this.items.splice(r,1).length>0}get(e,r){let n=Zr(e);if(typeof n!="number")return;let i=this.items[n];return!r&&en.isScalar(i)?i.value:i}has(e){let r=Zr(e);return typeof r=="number"&&r<this.items.length}set(e,r){let n=Zr(e);if(typeof n!="number")throw new Error(`Expected a valid index, not ${e}.`);let i=this.items[n];en.isScalar(i)&&Om.isScalarValue(r)?i.value=r:this.items[n]=r}toJSON(e,r){let n=[];r?.onCreate&&r.onCreate(n);let i=0;for(let o of this.items)n.push(Am.toJS(o,String(i++),r));return n}toString(e,r,n){return e?Pm.stringifyCollection(this,e,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(e.indent||"")+" ",onChompKeep:n,onComment:r}):JSON.stringify(this)}static from(e,r,n){let{replacer:i}=n,o=new this(e);if(r&&Symbol.iterator in Object(r)){let s=0;for(let a of r){if(typeof i=="function"){let c=r instanceof Set?a:String(s++);a=i.call(r,c,a)}o.items.push(xm.createNode(a,void 0,n))}}return o}};function Zr(t){let e=en.isScalar(t)?t.value:t;return e&&typeof e=="string"&&(e=Number(e)),typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}Ga.YAMLSeq=Mi});var ht=w(Ha=>{"use strict";var Tm=_(),Ka=Ae(),Nm={collection:"seq",default:!0,nodeClass:Ka.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(t,e){return Tm.isSeq(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,r)=>Ka.YAMLSeq.from(t,e,r)};Ha.seq=Nm});var Gt=w(za=>{"use strict";var Im=Mt(),Lm={identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify(t,e,r,n){return e=Object.assign({actualString:!0},e),Im.stringifyString(t,e,r,n)}};za.string=Lm});var tn=w(Va=>{"use strict";var Ja=T(),Ya={identify:t=>t==null,createNode:()=>new Ja.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new Ja.Scalar(null),stringify:({source:t},e)=>typeof t=="string"&&Ya.test.test(t)?t:e.options.nullStr};Va.nullTag=Ya});var Fi=w(Qa=>{"use strict";var $m=T(),Xa={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new $m.Scalar(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},r){if(t&&Xa.test.test(t)){let n=t[0]==="t"||t[0]==="T";if(e===n)return t}return e?r.options.trueStr:r.options.falseStr}};Qa.boolTag=Xa});var gt=w(Za=>{"use strict";function jm({format:t,minFractionDigits:e,tag:r,value:n}){if(typeof n=="bigint")return String(n);let i=typeof n=="number"?n:Number(n);if(!isFinite(i))return isNaN(i)?".nan":i<0?"-.inf":".inf";let o=Object.is(n,-0)?"-0":JSON.stringify(n);if(!t&&e&&(!r||r==="tag:yaml.org,2002:float")&&/^-?\d/.test(o)&&!o.includes("e")){let s=o.indexOf(".");s<0&&(s=o.length,o+=".");let a=e-(o.length-s-1);for(;a-- >0;)o+="0"}return o}Za.stringifyNumber=jm});var Ui=w(rn=>{"use strict";var Wm=T(),Bi=gt(),Dm={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:Bi.stringifyNumber},qm={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():Bi.stringifyNumber(t)}},Mm={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 Wm.Scalar(parseFloat(t)),r=t.indexOf(".");return r!==-1&&t[t.length-1]==="0"&&(e.minFractionDigits=t.length-r-1),e},stringify:Bi.stringifyNumber};rn.float=Mm;rn.floatExp=qm;rn.floatNaN=Dm});var Ki=w(on=>{"use strict";var ec=gt(),nn=t=>typeof t=="bigint"||Number.isInteger(t),Gi=(t,e,r,{intAsBigInt:n})=>n?BigInt(t):parseInt(t.substring(e),r);function tc(t,e,r){let{value:n}=t;return nn(n)&&n>=0?r+n.toString(e):ec.stringifyNumber(t)}var Fm={identify:t=>nn(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(t,e,r)=>Gi(t,2,8,r),stringify:t=>tc(t,8,"0o")},Bm={identify:nn,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,r)=>Gi(t,0,10,r),stringify:ec.stringifyNumber},Um={identify:t=>nn(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(t,e,r)=>Gi(t,2,16,r),stringify:t=>tc(t,16,"0x")};on.int=Bm;on.intHex=Um;on.intOct=Fm});var nc=w(rc=>{"use strict";var Gm=pt(),Km=tn(),Hm=ht(),zm=Gt(),Jm=Fi(),Hi=Ui(),zi=Ki(),Ym=[Gm.map,Hm.seq,zm.string,Km.nullTag,Jm.boolTag,zi.intOct,zi.int,zi.intHex,Hi.floatNaN,Hi.floatExp,Hi.float];rc.schema=Ym});var sc=w(oc=>{"use strict";var Vm=T(),Xm=pt(),Qm=ht();function ic(t){return typeof t=="bigint"||Number.isInteger(t)}var sn=({value:t})=>JSON.stringify(t),Zm=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:sn},{identify:t=>t==null,createNode:()=>new Vm.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:sn},{identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:t=>t==="true",stringify:sn},{identify:ic,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(t,e,{intAsBigInt:r})=>r?BigInt(t):parseInt(t,10),stringify:({value:t})=>ic(t)?t.toString():JSON.stringify(t)},{identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:t=>parseFloat(t),stringify:sn}],ep={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},tp=[Xm.map,Qm.seq].concat(Zm,ep);oc.schema=tp});var Yi=w(ac=>{"use strict";var Kt=Rr("buffer"),Ji=T(),rp=Mt(),np={identify:t=>t instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(t,e){if(typeof Kt.Buffer=="function")return Kt.Buffer.from(t,"base64");if(typeof atob=="function"){let r=atob(t.replace(/[\n\r]/g,"")),n=new Uint8Array(r.length);for(let i=0;i<r.length;++i)n[i]=r.charCodeAt(i);return n}else return e("This environment does not support reading binary tags; either Buffer or atob is required"),t},stringify({comment:t,type:e,value:r},n,i,o){if(!r)return"";let s=r,a;if(typeof Kt.Buffer=="function")a=s instanceof Kt.Buffer?s.toString("base64"):Kt.Buffer.from(s.buffer).toString("base64");else if(typeof btoa=="function"){let c="";for(let l=0;l<s.length;++l)c+=String.fromCharCode(s[l]);a=btoa(c)}else throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(e??(e=Ji.Scalar.BLOCK_LITERAL),e!==Ji.Scalar.QUOTE_DOUBLE){let c=Math.max(n.options.lineWidth-n.indent.length,n.options.minContentWidth),l=Math.ceil(a.length/c),u=new Array(l);for(let f=0,d=0;f<l;++f,d+=c)u[f]=a.substr(d,c);a=u.join(e===Ji.Scalar.BLOCK_LITERAL?`
|
|
55
|
+
`:" ")}return rp.stringifyString({comment:t,type:e,value:a},n,i,o)}};ac.binary=np});var ln=w(cn=>{"use strict";var an=_(),Vi=Pe(),ip=T(),op=Ae();function cc(t,e){if(an.isSeq(t))for(let r=0;r<t.items.length;++r){let n=t.items[r];if(!an.isPair(n)){if(an.isMap(n)){n.items.length>1&&e("Each pair must have its own sequence indicator");let i=n.items[0]||new Vi.Pair(new ip.Scalar(null));if(n.commentBefore&&(i.key.commentBefore=i.key.commentBefore?`${n.commentBefore}
|
|
56
56
|
${i.key.commentBefore}`:n.commentBefore),n.comment){let o=i.value??i.key;o.comment=o.comment?`${n.comment}
|
|
57
|
-
${o.comment}`:n.comment}n=i}t.items[r]=en.isPair(n)?n:new Di.Pair(n)}}else e("Expected a sequence for this tag");return t}function za(t,e,r){let{replacer:n}=r,i=new $m.YAMLSeq(t);i.tag="tag:yaml.org,2002:pairs";let o=0;if(e&&Symbol.iterator in Object(e))for(let s of e){typeof n=="function"&&(s=n.call(e,String(o++),s));let a,c;if(Array.isArray(s))if(s.length===2)a=s[0],c=s[1];else throw new TypeError(`Expected [key, value] tuple: ${s}`);else if(s&&s instanceof Object){let l=Object.keys(s);if(l.length===1)a=l[0],c=s[a];else throw new TypeError(`Expected tuple with one key, not ${l.length} keys`)}else a=s;i.items.push(Di.createPair(a,c,r))}return i}var Dm={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:Ha,createNode:za};tn.createPairs=za;tn.pairs=Dm;tn.resolvePairs=Ha});var Mi=w(qi=>{"use strict";var Ya=_(),Wi=ve(),Mt=_e(),Wm=xe(),Ja=rn(),Ke=class t extends Wm.YAMLSeq{constructor(){super(),this.add=Mt.YAMLMap.prototype.add.bind(this),this.delete=Mt.YAMLMap.prototype.delete.bind(this),this.get=Mt.YAMLMap.prototype.get.bind(this),this.has=Mt.YAMLMap.prototype.has.bind(this),this.set=Mt.YAMLMap.prototype.set.bind(this),this.tag=t.tag}toJSON(e,r){if(!r)return super.toJSON(e);let n=new Map;r?.onCreate&&r.onCreate(n);for(let i of this.items){let o,s;if(Ya.isPair(i)?(o=Wi.toJS(i.key,"",r),s=Wi.toJS(i.value,o,r)):o=Wi.toJS(i,"",r),n.has(o))throw new Error("Ordered maps must not include duplicate keys");n.set(o,s)}return n}static from(e,r,n){let i=Ja.createPairs(e,r,n),o=new this;return o.items=i.items,o}};Ke.tag="tag:yaml.org,2002:omap";var qm={collection:"seq",identify:t=>t instanceof Map,nodeClass:Ke,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let r=Ja.resolvePairs(t,e),n=[];for(let{key:i}of r.items)Ya.isScalar(i)&&(n.includes(i.value)?e(`Ordered maps must not include duplicate keys: ${i.value}`):n.push(i.value));return Object.assign(new Ke,r)},createNode:(t,e,r)=>Ke.from(t,e,r)};qi.YAMLOMap=Ke;qi.omap=qm});var ec=w(Fi=>{"use strict";var Va=T();function Xa({value:t,source:e},r){return e&&(t?Qa:Za).test.test(e)?e:t?r.options.trueStr:r.options.falseStr}var Qa={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 Va.Scalar(!0),stringify:Xa},Za={identify:t=>t===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new Va.Scalar(!1),stringify:Xa};Fi.falseTag=Za;Fi.trueTag=Qa});var tc=w(nn=>{"use strict";var Mm=T(),Bi=ft(),Fm={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:Bi.stringifyNumber},Bm={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():Bi.stringifyNumber(t)}},Um={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,""))),r=t.indexOf(".");if(r!==-1){let n=t.substring(r+1).replace(/_/g,"");n[n.length-1]==="0"&&(e.minFractionDigits=n.length)}return e},stringify:Bi.stringifyNumber};nn.float=Um;nn.floatExp=Bm;nn.floatNaN=Fm});var nc=w(Bt=>{"use strict";var rc=ft(),Ft=t=>typeof t=="bigint"||Number.isInteger(t);function on(t,e,r,{intAsBigInt:n}){let i=t[0];if((i==="-"||i==="+")&&(e+=1),t=t.substring(e).replace(/_/g,""),n){switch(r){case 2:t=`0b${t}`;break;case 8:t=`0o${t}`;break;case 16:t=`0x${t}`;break}let s=BigInt(t);return i==="-"?BigInt(-1)*s:s}let o=parseInt(t,r);return i==="-"?-1*o:o}function Ui(t,e,r){let{value:n}=t;if(Ft(n)){let i=n.toString(e);return n<0?"-"+r+i.substr(1):r+i}return rc.stringifyNumber(t)}var Km={identify:Ft,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,r)=>on(t,2,2,r),stringify:t=>Ui(t,2,"0b")},Gm={identify:Ft,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,r)=>on(t,1,8,r),stringify:t=>Ui(t,8,"0")},Hm={identify:Ft,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,r)=>on(t,0,10,r),stringify:rc.stringifyNumber},zm={identify:Ft,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,r)=>on(t,2,16,r),stringify:t=>Ui(t,16,"0x")};Bt.int=Hm;Bt.intBin=Km;Bt.intHex=zm;Bt.intOct=Gm});var Gi=w(Ki=>{"use strict";var cn=_(),sn=Se(),an=_e(),Ge=class t extends an.YAMLMap{constructor(e){super(e),this.tag=t.tag}add(e){let r;cn.isPair(e)?r=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?r=new sn.Pair(e.key,null):r=new sn.Pair(e,null),an.findPair(this.items,r.key)||this.items.push(r)}get(e,r){let n=an.findPair(this.items,e);return!r&&cn.isPair(n)?cn.isScalar(n.key)?n.key.value:n.key:n}set(e,r){if(typeof r!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof r}`);let n=an.findPair(this.items,e);n&&!r?this.items.splice(this.items.indexOf(n),1):!n&&r&&this.items.push(new sn.Pair(e))}toJSON(e,r){return super.toJSON(e,r,Set)}toString(e,r,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),r,n);throw new Error("Set items must all have null values")}static from(e,r,n){let{replacer:i}=n,o=new this(e);if(r&&Symbol.iterator in Object(r))for(let s of r)typeof i=="function"&&(s=i.call(r,s,s)),o.items.push(sn.createPair(s,null,n));return o}};Ge.tag="tag:yaml.org,2002:set";var Ym={collection:"map",identify:t=>t instanceof Set,nodeClass:Ge,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,r)=>Ge.from(t,e,r),resolve(t,e){if(cn.isMap(t)){if(t.hasAllNullValues(!0))return Object.assign(new Ge,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}};Ki.YAMLSet=Ge;Ki.set=Ym});var zi=w(ln=>{"use strict";var Jm=ft();function Hi(t,e){let r=t[0],n=r==="-"||r==="+"?t.substring(1):t,i=s=>e?BigInt(s):Number(s),o=n.replace(/_/g,"").split(":").reduce((s,a)=>s*i(60)+i(a),i(0));return r==="-"?i(-1)*o:o}function ic(t){let{value:e}=t,r=s=>s;if(typeof e=="bigint")r=s=>BigInt(s);else if(isNaN(e)||!isFinite(e))return Jm.stringifyNumber(t);let n="";e<0&&(n="-",e*=r(-1));let i=r(60),o=[e%i];return e<60?o.unshift(0):(e=(e-o[0])/i,o.unshift(e%i),e>=60&&(e=(e-o[0])/i,o.unshift(e))),n+o.map(s=>String(s).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var Vm={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:r})=>Hi(t,r),stringify:ic},Xm={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=>Hi(t,!1),stringify:ic},oc={identify:t=>t instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(t){let e=t.match(oc.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,r,n,i,o,s,a]=e.map(Number),c=e[7]?Number((e[7]+"00").substr(1,3)):0,l=Date.UTC(r,n-1,i,o||0,s||0,a||0,c),u=e[8];if(u&&u!=="Z"){let f=Hi(u,!1);Math.abs(f)<30&&(f*=60),l-=6e4*f}return new Date(l)},stringify:({value:t})=>t?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};ln.floatTime=Xm;ln.intTime=Vm;ln.timestamp=oc});var cc=w(ac=>{"use strict";var Qm=lt(),Zm=Jr(),ep=ut(),tp=Wt(),rp=$i(),sc=ec(),Yi=tc(),un=nc(),np=Fr(),ip=Mi(),op=rn(),sp=Gi(),Ji=zi(),ap=[Qm.map,ep.seq,tp.string,Zm.nullTag,sc.trueTag,sc.falseTag,un.intBin,un.intOct,un.int,un.intHex,Yi.floatNaN,Yi.floatExp,Yi.float,rp.binary,np.merge,ip.omap,op.pairs,sp.set,Ji.intTime,Ji.floatTime,Ji.timestamp];ac.schema=ap});var yc=w(Qi=>{"use strict";var dc=lt(),cp=Jr(),mc=ut(),lp=Wt(),up=Ri(),Vi=Ai(),Xi=Ni(),fp=Fa(),dp=Ka(),pc=$i(),Ut=Fr(),hc=Mi(),gc=rn(),lc=cc(),wc=Gi(),fn=zi(),uc=new Map([["core",fp.schema],["failsafe",[dc.map,mc.seq,lp.string]],["json",dp.schema],["yaml11",lc.schema],["yaml-1.1",lc.schema]]),fc={binary:pc.binary,bool:up.boolTag,float:Vi.float,floatExp:Vi.floatExp,floatNaN:Vi.floatNaN,floatTime:fn.floatTime,int:Xi.int,intHex:Xi.intHex,intOct:Xi.intOct,intTime:fn.intTime,map:dc.map,merge:Ut.merge,null:cp.nullTag,omap:hc.omap,pairs:gc.pairs,seq:mc.seq,set:wc.set,timestamp:fn.timestamp},mp={"tag:yaml.org,2002:binary":pc.binary,"tag:yaml.org,2002:merge":Ut.merge,"tag:yaml.org,2002:omap":hc.omap,"tag:yaml.org,2002:pairs":gc.pairs,"tag:yaml.org,2002:set":wc.set,"tag:yaml.org,2002:timestamp":fn.timestamp};function pp(t,e,r){let n=uc.get(e);if(n&&!t)return r&&!n.includes(Ut.merge)?n.concat(Ut.merge):n.slice();let i=n;if(!i)if(Array.isArray(t))i=[];else{let o=Array.from(uc.keys()).filter(s=>s!=="yaml11").map(s=>JSON.stringify(s)).join(", ");throw new Error(`Unknown schema "${e}"; use one of ${o} or define customTags array`)}if(Array.isArray(t))for(let o of t)i=i.concat(o);else typeof t=="function"&&(i=t(i.slice()));return r&&(i=i.concat(Ut.merge)),i.reduce((o,s)=>{let a=typeof s=="string"?fc[s]:s;if(!a){let c=JSON.stringify(s),l=Object.keys(fc).map(u=>JSON.stringify(u)).join(", ");throw new Error(`Unknown custom tag ${c}; use one of ${l}`)}return o.includes(a)||o.push(a),o},[])}Qi.coreKnownTags=mp;Qi.getTags=pp});var to=w(vc=>{"use strict";var Zi=_(),hp=lt(),gp=ut(),wp=Wt(),dn=yc(),yp=(t,e)=>t.key<e.key?-1:t.key>e.key?1:0,eo=class t{constructor({compat:e,customTags:r,merge:n,resolveKnownTags:i,schema:o,sortMapEntries:s,toStringDefaults:a}){this.compat=Array.isArray(e)?dn.getTags(e,"compat"):e?dn.getTags(null,e):null,this.name=typeof o=="string"&&o||"core",this.knownTags=i?dn.coreKnownTags:{},this.tags=dn.getTags(r,this.name,n),this.toStringOptions=a??null,Object.defineProperty(this,Zi.MAP,{value:hp.map}),Object.defineProperty(this,Zi.SCALAR,{value:wp.string}),Object.defineProperty(this,Zi.SEQ,{value:gp.seq}),this.sortMapEntries=typeof s=="function"?s:s===!0?yp:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};vc.Schema=eo});var kc=w(bc=>{"use strict";var vp=_(),ro=jt(),Kt=Tt();function bp(t,e){let r=[],n=e.directives===!0;if(e.directives!==!1&&t.directives){let c=t.directives.toString(t);c?(r.push(c),n=!0):t.directives.docStart&&(n=!0)}n&&r.push("---");let i=ro.createStringifyContext(t,e),{commentString:o}=i.options;if(t.commentBefore){r.length!==1&&r.unshift("");let c=o(t.commentBefore);r.unshift(Kt.indentComment(c,""))}let s=!1,a=null;if(t.contents){if(vp.isNode(t.contents)){if(t.contents.spaceBefore&&n&&r.push(""),t.contents.commentBefore){let u=o(t.contents.commentBefore);r.push(Kt.indentComment(u,""))}i.forceBlockIndent=!!t.comment,a=t.contents.comment}let c=a?void 0:()=>s=!0,l=ro.stringify(t.contents,i,()=>a=null,c);a&&(l+=Kt.lineComment(l,"",o(a))),(l[0]==="|"||l[0]===">")&&r[r.length-1]==="---"?r[r.length-1]=`--- ${l}`:r.push(l)}else r.push(ro.stringify(t.contents,i));if(t.directives?.docEnd)if(t.comment){let c=o(t.comment);c.includes(`
|
|
58
|
-
`)?(r.push("..."),r.push(
|
|
57
|
+
${o.comment}`:n.comment}n=i}t.items[r]=an.isPair(n)?n:new Vi.Pair(n)}}else e("Expected a sequence for this tag");return t}function lc(t,e,r){let{replacer:n}=r,i=new op.YAMLSeq(t);i.tag="tag:yaml.org,2002:pairs";let o=0;if(e&&Symbol.iterator in Object(e))for(let s of e){typeof n=="function"&&(s=n.call(e,String(o++),s));let a,c;if(Array.isArray(s))if(s.length===2)a=s[0],c=s[1];else throw new TypeError(`Expected [key, value] tuple: ${s}`);else if(s&&s instanceof Object){let l=Object.keys(s);if(l.length===1)a=l[0],c=s[a];else throw new TypeError(`Expected tuple with one key, not ${l.length} keys`)}else a=s;i.items.push(Vi.createPair(a,c,r))}return i}var sp={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:cc,createNode:lc};cn.createPairs=lc;cn.pairs=sp;cn.resolvePairs=cc});var Zi=w(Qi=>{"use strict";var uc=_(),Xi=Se(),Ht=Oe(),ap=Ae(),fc=ln(),Ye=class t extends ap.YAMLSeq{constructor(){super(),this.add=Ht.YAMLMap.prototype.add.bind(this),this.delete=Ht.YAMLMap.prototype.delete.bind(this),this.get=Ht.YAMLMap.prototype.get.bind(this),this.has=Ht.YAMLMap.prototype.has.bind(this),this.set=Ht.YAMLMap.prototype.set.bind(this),this.tag=t.tag}toJSON(e,r){if(!r)return super.toJSON(e);let n=new Map;r?.onCreate&&r.onCreate(n);for(let i of this.items){let o,s;if(uc.isPair(i)?(o=Xi.toJS(i.key,"",r),s=Xi.toJS(i.value,o,r)):o=Xi.toJS(i,"",r),n.has(o))throw new Error("Ordered maps must not include duplicate keys");n.set(o,s)}return n}static from(e,r,n){let i=fc.createPairs(e,r,n),o=new this;return o.items=i.items,o}};Ye.tag="tag:yaml.org,2002:omap";var cp={collection:"seq",identify:t=>t instanceof Map,nodeClass:Ye,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let r=fc.resolvePairs(t,e),n=[];for(let{key:i}of r.items)uc.isScalar(i)&&(n.includes(i.value)?e(`Ordered maps must not include duplicate keys: ${i.value}`):n.push(i.value));return Object.assign(new Ye,r)},createNode:(t,e,r)=>Ye.from(t,e,r)};Qi.YAMLOMap=Ye;Qi.omap=cp});var gc=w(eo=>{"use strict";var dc=T();function mc({value:t,source:e},r){return e&&(t?pc:hc).test.test(e)?e:t?r.options.trueStr:r.options.falseStr}var pc={identify:t=>t===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new dc.Scalar(!0),stringify:mc},hc={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 dc.Scalar(!1),stringify:mc};eo.falseTag=hc;eo.trueTag=pc});var wc=w(un=>{"use strict";var lp=T(),to=gt(),up={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:to.stringifyNumber},fp={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():to.stringifyNumber(t)}},dp={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 lp.Scalar(parseFloat(t.replace(/_/g,""))),r=t.indexOf(".");if(r!==-1){let n=t.substring(r+1).replace(/_/g,"");n[n.length-1]==="0"&&(e.minFractionDigits=n.length)}return e},stringify:to.stringifyNumber};un.float=dp;un.floatExp=fp;un.floatNaN=up});var vc=w(Jt=>{"use strict";var yc=gt(),zt=t=>typeof t=="bigint"||Number.isInteger(t);function fn(t,e,r,{intAsBigInt:n}){let i=t[0];if((i==="-"||i==="+")&&(e+=1),t=t.substring(e).replace(/_/g,""),n){switch(r){case 2:t=`0b${t}`;break;case 8:t=`0o${t}`;break;case 16:t=`0x${t}`;break}let s=BigInt(t);return i==="-"?BigInt(-1)*s:s}let o=parseInt(t,r);return i==="-"?-1*o:o}function ro(t,e,r){let{value:n}=t;if(zt(n)){let i=n.toString(e);return n<0?"-"+r+i.substr(1):r+i}return yc.stringifyNumber(t)}var mp={identify:zt,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,r)=>fn(t,2,2,r),stringify:t=>ro(t,2,"0b")},pp={identify:zt,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,r)=>fn(t,1,8,r),stringify:t=>ro(t,8,"0")},hp={identify:zt,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,r)=>fn(t,0,10,r),stringify:yc.stringifyNumber},gp={identify:zt,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,r)=>fn(t,2,16,r),stringify:t=>ro(t,16,"0x")};Jt.int=hp;Jt.intBin=mp;Jt.intHex=gp;Jt.intOct=pp});var io=w(no=>{"use strict";var pn=_(),dn=Pe(),mn=Oe(),Ve=class t extends mn.YAMLMap{constructor(e){super(e),this.tag=t.tag}add(e){let r;pn.isPair(e)?r=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?r=new dn.Pair(e.key,null):r=new dn.Pair(e,null),mn.findPair(this.items,r.key)||this.items.push(r)}get(e,r){let n=mn.findPair(this.items,e);return!r&&pn.isPair(n)?pn.isScalar(n.key)?n.key.value:n.key:n}set(e,r){if(typeof r!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof r}`);let n=mn.findPair(this.items,e);n&&!r?this.items.splice(this.items.indexOf(n),1):!n&&r&&this.items.push(new dn.Pair(e))}toJSON(e,r){return super.toJSON(e,r,Set)}toString(e,r,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),r,n);throw new Error("Set items must all have null values")}static from(e,r,n){let{replacer:i}=n,o=new this(e);if(r&&Symbol.iterator in Object(r))for(let s of r)typeof i=="function"&&(s=i.call(r,s,s)),o.items.push(dn.createPair(s,null,n));return o}};Ve.tag="tag:yaml.org,2002:set";var wp={collection:"map",identify:t=>t instanceof Set,nodeClass:Ve,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,r)=>Ve.from(t,e,r),resolve(t,e){if(pn.isMap(t)){if(t.hasAllNullValues(!0))return Object.assign(new Ve,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}};no.YAMLSet=Ve;no.set=wp});var so=w(hn=>{"use strict";var yp=gt();function oo(t,e){let r=t[0],n=r==="-"||r==="+"?t.substring(1):t,i=s=>e?BigInt(s):Number(s),o=n.replace(/_/g,"").split(":").reduce((s,a)=>s*i(60)+i(a),i(0));return r==="-"?i(-1)*o:o}function bc(t){let{value:e}=t,r=s=>s;if(typeof e=="bigint")r=s=>BigInt(s);else if(isNaN(e)||!isFinite(e))return yp.stringifyNumber(t);let n="";e<0&&(n="-",e*=r(-1));let i=r(60),o=[e%i];return e<60?o.unshift(0):(e=(e-o[0])/i,o.unshift(e%i),e>=60&&(e=(e-o[0])/i,o.unshift(e))),n+o.map(s=>String(s).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var vp={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:r})=>oo(t,r),stringify:bc},bp={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=>oo(t,!1),stringify:bc},kc={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(kc.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,r,n,i,o,s,a]=e.map(Number),c=e[7]?Number((e[7]+"00").substr(1,3)):0,l=Date.UTC(r,n-1,i,o||0,s||0,a||0,c),u=e[8];if(u&&u!=="Z"){let f=oo(u,!1);Math.abs(f)<30&&(f*=60),l-=6e4*f}return new Date(l)},stringify:({value:t})=>t?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};hn.floatTime=bp;hn.intTime=vp;hn.timestamp=kc});var Ec=w(Sc=>{"use strict";var kp=pt(),Cp=tn(),Sp=ht(),Ep=Gt(),_p=Yi(),Cc=gc(),ao=wc(),gn=vc(),xp=zr(),Pp=Zi(),Rp=ln(),Op=io(),co=so(),Ap=[kp.map,Sp.seq,Ep.string,Cp.nullTag,Cc.trueTag,Cc.falseTag,gn.intBin,gn.intOct,gn.int,gn.intHex,ao.floatNaN,ao.floatExp,ao.float,_p.binary,xp.merge,Pp.omap,Rp.pairs,Op.set,co.intTime,co.floatTime,co.timestamp];Sc.schema=Ap});var Lc=w(fo=>{"use strict";var Rc=pt(),Tp=tn(),Oc=ht(),Np=Gt(),Ip=Fi(),lo=Ui(),uo=Ki(),Lp=nc(),$p=sc(),Ac=Yi(),Yt=zr(),Tc=Zi(),Nc=ln(),_c=Ec(),Ic=io(),wn=so(),xc=new Map([["core",Lp.schema],["failsafe",[Rc.map,Oc.seq,Np.string]],["json",$p.schema],["yaml11",_c.schema],["yaml-1.1",_c.schema]]),Pc={binary:Ac.binary,bool:Ip.boolTag,float:lo.float,floatExp:lo.floatExp,floatNaN:lo.floatNaN,floatTime:wn.floatTime,int:uo.int,intHex:uo.intHex,intOct:uo.intOct,intTime:wn.intTime,map:Rc.map,merge:Yt.merge,null:Tp.nullTag,omap:Tc.omap,pairs:Nc.pairs,seq:Oc.seq,set:Ic.set,timestamp:wn.timestamp},jp={"tag:yaml.org,2002:binary":Ac.binary,"tag:yaml.org,2002:merge":Yt.merge,"tag:yaml.org,2002:omap":Tc.omap,"tag:yaml.org,2002:pairs":Nc.pairs,"tag:yaml.org,2002:set":Ic.set,"tag:yaml.org,2002:timestamp":wn.timestamp};function Wp(t,e,r){let n=xc.get(e);if(n&&!t)return r&&!n.includes(Yt.merge)?n.concat(Yt.merge):n.slice();let i=n;if(!i)if(Array.isArray(t))i=[];else{let o=Array.from(xc.keys()).filter(s=>s!=="yaml11").map(s=>JSON.stringify(s)).join(", ");throw new Error(`Unknown schema "${e}"; use one of ${o} or define customTags array`)}if(Array.isArray(t))for(let o of t)i=i.concat(o);else typeof t=="function"&&(i=t(i.slice()));return r&&(i=i.concat(Yt.merge)),i.reduce((o,s)=>{let a=typeof s=="string"?Pc[s]:s;if(!a){let c=JSON.stringify(s),l=Object.keys(Pc).map(u=>JSON.stringify(u)).join(", ");throw new Error(`Unknown custom tag ${c}; use one of ${l}`)}return o.includes(a)||o.push(a),o},[])}fo.coreKnownTags=jp;fo.getTags=Wp});var ho=w($c=>{"use strict";var mo=_(),Dp=pt(),qp=ht(),Mp=Gt(),yn=Lc(),Fp=(t,e)=>t.key<e.key?-1:t.key>e.key?1:0,po=class t{constructor({compat:e,customTags:r,merge:n,resolveKnownTags:i,schema:o,sortMapEntries:s,toStringDefaults:a}){this.compat=Array.isArray(e)?yn.getTags(e,"compat"):e?yn.getTags(null,e):null,this.name=typeof o=="string"&&o||"core",this.knownTags=i?yn.coreKnownTags:{},this.tags=yn.getTags(r,this.name,n),this.toStringOptions=a??null,Object.defineProperty(this,mo.MAP,{value:Dp.map}),Object.defineProperty(this,mo.SCALAR,{value:Mp.string}),Object.defineProperty(this,mo.SEQ,{value:qp.seq}),this.sortMapEntries=typeof s=="function"?s:s===!0?Fp:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};$c.Schema=po});var Wc=w(jc=>{"use strict";var Bp=_(),go=Ft(),Vt=Wt();function Up(t,e){let r=[],n=e.directives===!0;if(e.directives!==!1&&t.directives){let c=t.directives.toString(t);c?(r.push(c),n=!0):t.directives.docStart&&(n=!0)}n&&r.push("---");let i=go.createStringifyContext(t,e),{commentString:o}=i.options;if(t.commentBefore){r.length!==1&&r.unshift("");let c=o(t.commentBefore);r.unshift(Vt.indentComment(c,""))}let s=!1,a=null;if(t.contents){if(Bp.isNode(t.contents)){if(t.contents.spaceBefore&&n&&r.push(""),t.contents.commentBefore){let u=o(t.contents.commentBefore);r.push(Vt.indentComment(u,""))}i.forceBlockIndent=!!t.comment,a=t.contents.comment}let c=a?void 0:()=>s=!0,l=go.stringify(t.contents,i,()=>a=null,c);a&&(l+=Vt.lineComment(l,"",o(a))),(l[0]==="|"||l[0]===">")&&r[r.length-1]==="---"?r[r.length-1]=`--- ${l}`:r.push(l)}else r.push(go.stringify(t.contents,i));if(t.directives?.docEnd)if(t.comment){let c=o(t.comment);c.includes(`
|
|
58
|
+
`)?(r.push("..."),r.push(Vt.indentComment(c,""))):r.push(`... ${c}`)}else r.push("...");else{let c=t.comment;c&&s&&(c=c.replace(/^\n+/,"")),c&&((!s||a)&&r[r.length-1]!==""&&r.push(""),r.push(Vt.indentComment(o(c),"")))}return r.join(`
|
|
59
59
|
`)+`
|
|
60
|
-
`}
|
|
60
|
+
`}jc.stringifyDocument=Up});var Xt=w(Dc=>{"use strict";var Gp=$t(),wt=Wr(),te=_(),Kp=Pe(),Hp=Se(),zp=ho(),Jp=Wc(),wo=Ir(),Yp=bi(),Vp=jt(),yo=vi(),vo=class t{constructor(e,r,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,te.NODE_TYPE,{value:te.DOC});let i=null;typeof r=="function"||Array.isArray(r)?i=r:n===void 0&&r&&(n=r,r=void 0);let o=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},n);this.options=o;let{version:s}=o;n?._directives?(this.directives=n._directives.atDocument(),this.directives.yaml.explicit&&(s=this.directives.yaml.version)):this.directives=new yo.Directives({version:s}),this.setSchema(s,n),this.contents=e===void 0?null:this.createNode(e,i,n)}clone(){let e=Object.create(t.prototype,{[te.NODE_TYPE]:{value:te.DOC}});return e.commentBefore=this.commentBefore,e.comment=this.comment,e.errors=this.errors.slice(),e.warnings=this.warnings.slice(),e.options=Object.assign({},this.options),this.directives&&(e.directives=this.directives.clone()),e.schema=this.schema.clone(),e.contents=te.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){yt(this.contents)&&this.contents.add(e)}addIn(e,r){yt(this.contents)&&this.contents.addIn(e,r)}createAlias(e,r){if(!e.anchor){let n=wo.anchorNames(this);e.anchor=!r||n.has(r)?wo.findNewAnchor(r||"a",n):r}return new Gp.Alias(e.anchor)}createNode(e,r,n){let i;if(typeof r=="function")e=r.call({"":e},"",e),i=r;else if(Array.isArray(r)){let g=b=>typeof b=="number"||b instanceof String||b instanceof Number,y=r.filter(g).map(String);y.length>0&&(r=r.concat(y)),i=r}else n===void 0&&r&&(n=r,r=void 0);let{aliasDuplicateObjects:o,anchorPrefix:s,flow:a,keepUndefined:c,onTagObj:l,tag:u}=n??{},{onAnchor:f,setAnchors:d,sourceObjects:p}=wo.createNodeAnchors(this,s||"a"),h={aliasDuplicateObjects:o??!0,keepUndefined:c??!1,onAnchor:f,onTagObj:l,replacer:i,schema:this.schema,sourceObjects:p},m=Vp.createNode(e,u,h);return a&&te.isCollection(m)&&(m.flow=!0),d(),m}createPair(e,r,n={}){let i=this.createNode(e,null,n),o=this.createNode(r,null,n);return new Kp.Pair(i,o)}delete(e){return yt(this.contents)?this.contents.delete(e):!1}deleteIn(e){return wt.isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):yt(this.contents)?this.contents.deleteIn(e):!1}get(e,r){return te.isCollection(this.contents)?this.contents.get(e,r):void 0}getIn(e,r){return wt.isEmptyPath(e)?!r&&te.isScalar(this.contents)?this.contents.value:this.contents:te.isCollection(this.contents)?this.contents.getIn(e,r):void 0}has(e){return te.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return wt.isEmptyPath(e)?this.contents!==void 0:te.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,r){this.contents==null?this.contents=wt.collectionFromPath(this.schema,[e],r):yt(this.contents)&&this.contents.set(e,r)}setIn(e,r){wt.isEmptyPath(e)?this.contents=r:this.contents==null?this.contents=wt.collectionFromPath(this.schema,Array.from(e),r):yt(this.contents)&&this.contents.setIn(e,r)}setSchema(e,r={}){typeof e=="number"&&(e=String(e));let n;switch(e){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new yo.Directives({version:"1.1"}),n={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=e:this.directives=new yo.Directives({version:e}),n={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,n=null;break;default:{let i=JSON.stringify(e);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${i}`)}}if(r.schema instanceof Object)this.schema=r.schema;else if(n)this.schema=new zp.Schema(Object.assign(n,r));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:e,jsonArg:r,mapAsMap:n,maxAliasCount:i,onAnchor:o,reviver:s}={}){let a={anchors:new Map,doc:this,keep:!e,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof i=="number"?i:100},c=Hp.toJS(this.contents,r??"",a);if(typeof o=="function")for(let{count:l,res:u}of a.anchors.values())o(u,l);return typeof s=="function"?Yp.applyReviver(s,{"":c},"",c):c}toJSON(e,r){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:r})}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 r=JSON.stringify(e.indent);throw new Error(`"indent" option must be a positive integer, not ${r}`)}return Jp.stringifyDocument(this,e)}};function yt(t){if(te.isCollection(t))return!0;throw new Error("Expected a YAML collection as document contents")}Dc.Document=vo});var er=w(Zt=>{"use strict";var Qt=class extends Error{constructor(e,r,n,i){super(),this.name=e,this.code=n,this.message=i,this.pos=r}},bo=class extends Qt{constructor(e,r,n){super("YAMLParseError",e,r,n)}},ko=class extends Qt{constructor(e,r,n){super("YAMLWarning",e,r,n)}},Xp=(t,e)=>r=>{if(r.pos[0]===-1)return;r.linePos=r.pos.map(a=>e.linePos(a));let{line:n,col:i}=r.linePos[0];r.message+=` at line ${n}, column ${i}`;let o=i-1,s=t.substring(e.lineStarts[n-1],e.lineStarts[n]).replace(/[\n\r]+$/,"");if(o>=60&&s.length>80){let a=Math.min(o-39,s.length-79);s="…"+s.substring(a),o-=a-1}if(s.length>80&&(s=s.substring(0,79)+"…"),n>1&&/^ *$/.test(s.substring(0,o))){let a=t.substring(e.lineStarts[n-2],e.lineStarts[n-1]);a.length>80&&(a=a.substring(0,79)+`…
|
|
61
61
|
`),s=a+s}if(/[^ ]/.test(s)){let a=1,c=r.linePos[1];c?.line===n&&c.col>i&&(a=Math.max(1,Math.min(c.col-i,80-o)));let l=" ".repeat(o)+"^".repeat(a);r.message+=`:
|
|
62
62
|
|
|
63
63
|
${s}
|
|
64
64
|
${l}
|
|
65
|
-
`}};
|
|
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 r of e.start)if(r.type==="newline")return!0;if(e.sep){for(let r of e.sep)if(r.type==="newline")return!0}if(
|
|
67
|
-
`+m.comment:a.comment=m.comment);continue}(m.newlineAfterProp||
|
|
68
|
-
`+k.comment:b.comment=k.comment);let C=new
|
|
69
|
-
`+E.comment:l.comment=E.comment),f=E.end;continue}!s&&r.options.strict&&
|
|
70
|
-
`+P:
|
|
71
|
-
`+O.comment:
|
|
72
|
-
`+g.comment:l.comment=g.comment),l.range=[n.offset,m,g.offset]}else l.range=[n.offset,m,m];return l}
|
|
73
|
-
`.repeat(Math.max(1,s.length-1)):"",g=n+i.length;return e.source&&(g+=e.source.length),{value:m,type:o,comment:i.comment,range:[n,g,g]}}let c=e.indent+i.indent,l=e.offset+i.length,u=0;for(let m=0;m<a;++m){let[g,
|
|
74
|
-
`;for(let m=u;m<a;++m){let[g,
|
|
75
|
-
`):g.length>c||
|
|
65
|
+
`}};Zt.YAMLError=Qt;Zt.YAMLParseError=bo;Zt.YAMLWarning=ko;Zt.prettifyError=Xp});var tr=w(qc=>{"use strict";function Qp(t,{flow:e,indicator:r,next:n,offset:i,onError:o,parentIndent:s,startOnNewline:a}){let c=!1,l=a,u=a,f="",d="",p=!1,h=!1,m=null,g=null,y=null,b=null,k=null,C=null,S=null;for(let v of t)switch(h&&(v.type!=="space"&&v.type!=="newline"&&v.type!=="comma"&&o(v.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),h=!1),m&&(l&&v.type!=="comment"&&v.type!=="newline"&&o(m,"TAB_AS_INDENT","Tabs are not allowed as indentation"),m=null),v.type){case"space":!e&&(r!=="doc-start"||n?.type!=="flow-collection")&&v.source.includes(" ")&&(m=v),u=!0;break;case"comment":{u||o(v,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let O=v.source.substring(1)||" ";f?f+=d+O:f=O,d="",l=!1;break}case"newline":l?f?f+=v.source:(!C||r!=="seq-item-ind")&&(c=!0):d+=v.source,l=!0,p=!0,(g||y)&&(b=v),u=!0;break;case"anchor":g&&o(v,"MULTIPLE_ANCHORS","A node can have at most one anchor"),v.source.endsWith(":")&&o(v.offset+v.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),g=v,S??(S=v.offset),l=!1,u=!1,h=!0;break;case"tag":{y&&o(v,"MULTIPLE_TAGS","A node can have at most one tag"),y=v,S??(S=v.offset),l=!1,u=!1,h=!0;break}case r:(g||y)&&o(v,"BAD_PROP_ORDER",`Anchors and tags must be after the ${v.source} indicator`),C&&o(v,"UNEXPECTED_TOKEN",`Unexpected ${v.source} in ${e??"collection"}`),C=v,l=r==="seq-item-ind"||r==="explicit-key-ind",u=!1;break;case"comma":if(e){k&&o(v,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),k=v,l=!1,u=!1;break}default:o(v,"UNEXPECTED_TOKEN",`Unexpected ${v.type} token`),l=!1,u=!1}let E=t[t.length-1],P=E?E.offset+E.source.length:i;return h&&n&&n.type!=="space"&&n.type!=="newline"&&n.type!=="comma"&&(n.type!=="scalar"||n.source!=="")&&o(n.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),m&&(l&&m.indent<=s||n?.type==="block-map"||n?.type==="block-seq")&&o(m,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:k,found:C,spaceBefore:c,comment:f,hasNewline:p,anchor:g,tag:y,newlineAfterProp:b,end:P,start:S??P}}qc.resolveProps=Qp});var vn=w(Mc=>{"use strict";function Co(t){if(!t)return null;switch(t.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(t.source.includes(`
|
|
66
|
+
`))return!0;if(t.end){for(let e of t.end)if(e.type==="newline")return!0}return!1;case"flow-collection":for(let e of t.items){for(let r of e.start)if(r.type==="newline")return!0;if(e.sep){for(let r of e.sep)if(r.type==="newline")return!0}if(Co(e.key)||Co(e.value))return!0}return!1;default:return!0}}Mc.containsNewline=Co});var So=w(Fc=>{"use strict";var Zp=vn();function eh(t,e,r){if(e?.type==="flow-collection"){let n=e.end[0];n.indent===t&&(n.source==="]"||n.source==="}")&&Zp.containsNewline(e)&&r(n,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}Fc.flowIndentCheck=eh});var Eo=w(Uc=>{"use strict";var Bc=_();function th(t,e,r){let{uniqueKeys:n}=t.options;if(n===!1)return!1;let i=typeof n=="function"?n:(o,s)=>o===s||Bc.isScalar(o)&&Bc.isScalar(s)&&o.value===s.value;return e.some(o=>i(o.key,r))}Uc.mapIncludes=th});var Yc=w(Jc=>{"use strict";var Gc=Pe(),rh=Oe(),Kc=tr(),nh=vn(),Hc=So(),ih=Eo(),zc="All mapping items must start at the same column";function oh({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=o?.nodeClass??rh.YAMLMap,a=new s(r.schema);r.atRoot&&(r.atRoot=!1);let c=n.offset,l=null;for(let u of n.items){let{start:f,key:d,sep:p,value:h}=u,m=Kc.resolveProps(f,{indicator:"explicit-key-ind",next:d??p?.[0],offset:c,onError:i,parentIndent:n.indent,startOnNewline:!0}),g=!m.found;if(g){if(d&&(d.type==="block-seq"?i(c,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in d&&d.indent!==n.indent&&i(c,"BAD_INDENT",zc)),!m.anchor&&!m.tag&&!p){l=m.end,m.comment&&(a.comment?a.comment+=`
|
|
67
|
+
`+m.comment:a.comment=m.comment);continue}(m.newlineAfterProp||nh.containsNewline(d))&&i(d??f[f.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else m.found?.indent!==n.indent&&i(c,"BAD_INDENT",zc);r.atKey=!0;let y=m.end,b=d?t(r,d,m,i):e(r,y,f,null,m,i);r.schema.compat&&Hc.flowIndentCheck(n.indent,d,i),r.atKey=!1,ih.mapIncludes(r,a.items,b)&&i(y,"DUPLICATE_KEY","Map keys must be unique");let k=Kc.resolveProps(p??[],{indicator:"map-value-ind",next:h,offset:b.range[2],onError:i,parentIndent:n.indent,startOnNewline:!d||d.type==="block-scalar"});if(c=k.end,k.found){g&&(h?.type==="block-map"&&!k.hasNewline&&i(c,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),r.options.strict&&m.start<k.found.offset-1024&&i(b.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));let C=h?t(r,h,k,i):e(r,c,p,null,k,i);r.schema.compat&&Hc.flowIndentCheck(n.indent,h,i),c=C.range[2];let S=new Gc.Pair(b,C);r.options.keepSourceTokens&&(S.srcToken=u),a.items.push(S)}else{g&&i(b.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),k.comment&&(b.comment?b.comment+=`
|
|
68
|
+
`+k.comment:b.comment=k.comment);let C=new Gc.Pair(b);r.options.keepSourceTokens&&(C.srcToken=u),a.items.push(C)}}return l&&l<c&&i(l,"IMPOSSIBLE","Map comment with trailing content"),a.range=[n.offset,c,l??c],a}Jc.resolveBlockMap=oh});var Xc=w(Vc=>{"use strict";var sh=Ae(),ah=tr(),ch=So();function lh({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=o?.nodeClass??sh.YAMLSeq,a=new s(r.schema);r.atRoot&&(r.atRoot=!1),r.atKey&&(r.atKey=!1);let c=n.offset,l=null;for(let{start:u,value:f}of n.items){let d=ah.resolveProps(u,{indicator:"seq-item-ind",next:f,offset:c,onError:i,parentIndent:n.indent,startOnNewline:!0});if(!d.found)if(d.anchor||d.tag||f)f?.type==="block-seq"?i(d.end,"BAD_INDENT","All sequence items must start at the same column"):i(c,"MISSING_CHAR","Sequence item without - indicator");else{l=d.end,d.comment&&(a.comment=d.comment);continue}let p=f?t(r,f,d,i):e(r,d.end,u,null,d,i);r.schema.compat&&ch.flowIndentCheck(n.indent,f,i),c=p.range[2],a.items.push(p)}return a.range=[n.offset,c,l??c],a}Vc.resolveBlockSeq=lh});var vt=w(Qc=>{"use strict";function uh(t,e,r,n){let i="";if(t){let o=!1,s="";for(let a of t){let{source:c,type:l}=a;switch(l){case"space":o=!0;break;case"comment":{r&&!o&&n(a,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let u=c.substring(1)||" ";i?i+=s+u:i=u,s="";break}case"newline":i&&(s+=c),o=!0;break;default:n(a,"UNEXPECTED_TOKEN",`Unexpected ${l} at node end`)}e+=c.length}}return{comment:i,offset:e}}Qc.resolveEnd=uh});var rl=w(tl=>{"use strict";var fh=_(),dh=Pe(),Zc=Oe(),mh=Ae(),ph=vt(),el=tr(),hh=vn(),gh=Eo(),_o="Block collections are not allowed within flow collections",xo=t=>t&&(t.type==="block-map"||t.type==="block-seq");function wh({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=n.start.source==="{",a=s?"flow map":"flow sequence",c=o?.nodeClass??(s?Zc.YAMLMap:mh.YAMLSeq),l=new c(r.schema);l.flow=!0;let u=r.atRoot;u&&(r.atRoot=!1),r.atKey&&(r.atKey=!1);let f=n.offset+n.start.source.length;for(let g=0;g<n.items.length;++g){let y=n.items[g],{start:b,key:k,sep:C,value:S}=y,E=el.resolveProps(b,{flow:a,indicator:"explicit-key-ind",next:k??C?.[0],offset:f,onError:i,parentIndent:n.indent,startOnNewline:!1});if(!E.found){if(!E.anchor&&!E.tag&&!C&&!S){g===0&&E.comma?i(E.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`):g<n.items.length-1&&i(E.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${a}`),E.comment&&(l.comment?l.comment+=`
|
|
69
|
+
`+E.comment:l.comment=E.comment),f=E.end;continue}!s&&r.options.strict&&hh.containsNewline(k)&&i(k,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(g===0)E.comma&&i(E.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`);else if(E.comma||i(E.start,"MISSING_CHAR",`Missing , between ${a} items`),E.comment){let P="";e:for(let v of b)switch(v.type){case"comma":case"space":break;case"comment":P=v.source.substring(1);break e;default:break e}if(P){let v=l.items[l.items.length-1];fh.isPair(v)&&(v=v.value??v.key),v.comment?v.comment+=`
|
|
70
|
+
`+P:v.comment=P,E.comment=E.comment.substring(P.length+1)}}if(!s&&!C&&!E.found){let P=S?t(r,S,E,i):e(r,E.end,C,null,E,i);l.items.push(P),f=P.range[2],xo(S)&&i(P.range,"BLOCK_IN_FLOW",_o)}else{r.atKey=!0;let P=E.end,v=k?t(r,k,E,i):e(r,P,b,null,E,i);xo(k)&&i(v.range,"BLOCK_IN_FLOW",_o),r.atKey=!1;let O=el.resolveProps(C??[],{flow:a,indicator:"map-value-ind",next:S,offset:v.range[2],onError:i,parentIndent:n.indent,startOnNewline:!1});if(O.found){if(!s&&!E.found&&r.options.strict){if(C)for(let R of C){if(R===O.found)break;if(R.type==="newline"){i(R,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}E.start<O.found.offset-1024&&i(O.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else S&&("source"in S&&S.source?.[0]===":"?i(S,"MISSING_CHAR",`Missing space after : in ${a}`):i(O.start,"MISSING_CHAR",`Missing , or : between ${a} items`));let ne=S?t(r,S,O,i):O.found?e(r,O.end,C,null,O,i):null;ne?xo(S)&&i(ne.range,"BLOCK_IN_FLOW",_o):O.comment&&(v.comment?v.comment+=`
|
|
71
|
+
`+O.comment:v.comment=O.comment);let fe=new dh.Pair(v,ne);if(r.options.keepSourceTokens&&(fe.srcToken=y),s){let R=l;gh.mapIncludes(r,R.items,v)&&i(P,"DUPLICATE_KEY","Map keys must be unique"),R.items.push(fe)}else{let R=new Zc.YAMLMap(r.schema);R.flow=!0,R.items.push(fe);let M=(ne??v).range;R.range=[v.range[0],M[1],M[2]],l.items.push(R)}f=ne?ne.range[2]:O.end}}let d=s?"}":"]",[p,...h]=n.end,m=f;if(p?.source===d)m=p.offset+p.source.length;else{let g=a[0].toUpperCase()+a.substring(1),y=u?`${g} must end with a ${d}`:`${g} in block collection must be sufficiently indented and end with a ${d}`;i(f,u?"MISSING_CHAR":"BAD_INDENT",y),p&&p.source.length!==1&&h.unshift(p)}if(h.length>0){let g=ph.resolveEnd(h,m,r.options.strict,i);g.comment&&(l.comment?l.comment+=`
|
|
72
|
+
`+g.comment:l.comment=g.comment),l.range=[n.offset,m,g.offset]}else l.range=[n.offset,m,m];return l}tl.resolveFlowCollection=wh});var il=w(nl=>{"use strict";var yh=_(),vh=T(),bh=Oe(),kh=Ae(),Ch=Yc(),Sh=Xc(),Eh=rl();function Po(t,e,r,n,i,o){let s=r.type==="block-map"?Ch.resolveBlockMap(t,e,r,n,o):r.type==="block-seq"?Sh.resolveBlockSeq(t,e,r,n,o):Eh.resolveFlowCollection(t,e,r,n,o),a=s.constructor;return i==="!"||i===a.tagName?(s.tag=a.tagName,s):(i&&(s.tag=i),s)}function _h(t,e,r,n,i){let o=n.tag,s=o?e.directives.tagName(o.source,d=>i(o,"TAG_RESOLVE_FAILED",d)):null;if(r.type==="block-seq"){let{anchor:d,newlineAfterProp:p}=n,h=d&&o?d.offset>o.offset?d:o:d??o;h&&(!p||p.offset<h.offset)&&i(h,"MISSING_CHAR","Missing newline after block sequence props")}let a=r.type==="block-map"?"map":r.type==="block-seq"?"seq":r.start.source==="{"?"map":"seq";if(!o||!s||s==="!"||s===bh.YAMLMap.tagName&&a==="map"||s===kh.YAMLSeq.tagName&&a==="seq")return Po(t,e,r,i,s);let c=e.schema.tags.find(d=>d.tag===s&&d.collection===a);if(!c){let d=e.schema.knownTags[s];if(d?.collection===a)e.schema.tags.push(Object.assign({},d,{default:!1})),c=d;else return d?i(o,"BAD_COLLECTION_TYPE",`${d.tag} used for ${a} collection, but expects ${d.collection??"scalar"}`,!0):i(o,"TAG_RESOLVE_FAILED",`Unresolved tag: ${s}`,!0),Po(t,e,r,i,s)}let l=Po(t,e,r,i,s,c),u=c.resolve?.(l,d=>i(o,"TAG_RESOLVE_FAILED",d),e.options)??l,f=yh.isNode(u)?u:new vh.Scalar(u);return f.range=l.range,f.tag=s,c?.format&&(f.format=c.format),f}nl.composeCollection=_h});var Oo=w(ol=>{"use strict";var Ro=T();function xh(t,e,r){let n=e.offset,i=Ph(e,t.options.strict,r);if(!i)return{value:"",type:null,comment:"",range:[n,n,n]};let o=i.mode===">"?Ro.Scalar.BLOCK_FOLDED:Ro.Scalar.BLOCK_LITERAL,s=e.source?Rh(e.source):[],a=s.length;for(let m=s.length-1;m>=0;--m){let g=s[m][1];if(g===""||g==="\r")a=m;else break}if(a===0){let m=i.chomp==="+"&&s.length>0?`
|
|
73
|
+
`.repeat(Math.max(1,s.length-1)):"",g=n+i.length;return e.source&&(g+=e.source.length),{value:m,type:o,comment:i.comment,range:[n,g,g]}}let c=e.indent+i.indent,l=e.offset+i.length,u=0;for(let m=0;m<a;++m){let[g,y]=s[m];if(y===""||y==="\r")i.indent===0&&g.length>c&&(c=g.length);else{g.length<c&&r(l+g.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator"),i.indent===0&&(c=g.length),u=m,c===0&&!t.atRoot&&r(l,"BAD_INDENT","Block scalar values in collections must be indented");break}l+=g.length+y.length+1}for(let m=s.length-1;m>=a;--m)s[m][0].length>c&&(a=m+1);let f="",d="",p=!1;for(let m=0;m<u;++m)f+=s[m][0].slice(c)+`
|
|
74
|
+
`;for(let m=u;m<a;++m){let[g,y]=s[m];l+=g.length+y.length+1;let b=y[y.length-1]==="\r";if(b&&(y=y.slice(0,-1)),y&&g.length<c){let C=`Block scalar lines must not be less indented than their ${i.indent?"explicit indentation indicator":"first line"}`;r(l-y.length-(b?2:1),"BAD_INDENT",C),g=""}o===Ro.Scalar.BLOCK_LITERAL?(f+=d+g.slice(c)+y,d=`
|
|
75
|
+
`):g.length>c||y[0]===" "?(d===" "?d=`
|
|
76
76
|
`:!p&&d===`
|
|
77
77
|
`&&(d=`
|
|
78
78
|
|
|
79
|
-
`),f+=d+g.slice(c)+
|
|
80
|
-
`,p=!0):
|
|
79
|
+
`),f+=d+g.slice(c)+y,d=`
|
|
80
|
+
`,p=!0):y===""?d===`
|
|
81
81
|
`?f+=`
|
|
82
82
|
`:d=`
|
|
83
|
-
`:(f+=d+
|
|
83
|
+
`:(f+=d+y,d=" ",p=!1)}switch(i.chomp){case"-":break;case"+":for(let m=a;m<s.length;++m)f+=`
|
|
84
84
|
`+s[m][0].slice(c);f[f.length-1]!==`
|
|
85
85
|
`&&(f+=`
|
|
86
86
|
`);break;default:f+=`
|
|
87
|
-
`}let h=n+i.length+e.source.length;return{value:f,type:o,comment:i.comment,range:[n,h,h]}}function
|
|
87
|
+
`}let h=n+i.length+e.source.length;return{value:f,type:o,comment:i.comment,range:[n,h,h]}}function Ph({offset:t,props:e},r,n){if(e[0].type!=="block-scalar-header")return n(e[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:i}=e[0],o=i[0],s=0,a="",c=-1;for(let d=1;d<i.length;++d){let p=i[d];if(!a&&(p==="-"||p==="+"))a=p;else{let h=Number(p);!s&&h?s=h:c===-1&&(c=t+d)}}c!==-1&&n(c,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${i}`);let l=!1,u="",f=i.length;for(let d=1;d<e.length;++d){let p=e[d];switch(p.type){case"space":l=!0;case"newline":f+=p.source.length;break;case"comment":r&&!l&&n(p,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),f+=p.source.length,u=p.source.substring(1);break;case"error":n(p,"UNEXPECTED_TOKEN",p.message),f+=p.source.length;break;default:{let h=`Unexpected token in block scalar header: ${p.type}`;n(p,"UNEXPECTED_TOKEN",h);let m=p.source;m&&typeof m=="string"&&(f+=m.length)}}}return{mode:o,indent:s,chomp:a,comment:u,length:f}}function Rh(t){let e=t.split(/\n( *)/),r=e[0],n=r.match(/^( *)/),o=[n?.[1]?[n[1],r.slice(n[1].length)]:["",r]];for(let s=1;s<e.length;s+=2)o.push([e[s],e[s+1]]);return o}ol.resolveBlockScalar=xh});var To=w(al=>{"use strict";var Ao=T(),Oh=vt();function Ah(t,e,r){let{offset:n,type:i,source:o,end:s}=t,a,c,l=(d,p,h)=>r(n+d,p,h);switch(i){case"scalar":a=Ao.Scalar.PLAIN,c=Th(o,l);break;case"single-quoted-scalar":a=Ao.Scalar.QUOTE_SINGLE,c=Nh(o,l);break;case"double-quoted-scalar":a=Ao.Scalar.QUOTE_DOUBLE,c=Ih(o,l);break;default:return r(t,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${i}`),{value:"",type:null,comment:"",range:[n,n+o.length,n+o.length]}}let u=n+o.length,f=Oh.resolveEnd(s,u,e,r);return{value:c,type:a,comment:f.comment,range:[n,u,f.offset]}}function Th(t,e){let r="";switch(t[0]){case" ":r="a tab character";break;case",":r="flow indicator character ,";break;case"%":r="directive indicator character %";break;case"|":case">":{r=`block scalar indicator ${t[0]}`;break}case"@":case"`":{r=`reserved character ${t[0]}`;break}}return r&&e(0,"BAD_SCALAR_START",`Plain value cannot start with ${r}`),sl(t)}function Nh(t,e){return(t[t.length-1]!=="'"||t.length===1)&&e(t.length,"MISSING_CHAR","Missing closing 'quote"),sl(t.slice(1,-1)).replace(/''/g,"'")}function sl(t){let e,r;try{e=new RegExp(`(.*?)(?<![ ])[ ]*\r?
|
|
88
88
|
`,"sy"),r=new RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
|
|
89
89
|
`,"sy")}catch{e=/(.*?)[ \t]*\r?\n/sy,r=/[ \t]*(.*?)[ \t]*\r?\n/sy}let n=e.exec(t);if(!n)return t;let i=n[1],o=" ",s=e.lastIndex;for(r.lastIndex=s;n=r.exec(t);)n[1]===""?o===`
|
|
90
90
|
`?i+=o:o=`
|
|
91
|
-
`:(i+=o+n[1],o=" "),s=r.lastIndex;let a=/[ \t]*(.*)/sy;return a.lastIndex=s,n=a.exec(t),i+o+(n?.[1]??"")}function
|
|
91
|
+
`:(i+=o+n[1],o=" "),s=r.lastIndex;let a=/[ \t]*(.*)/sy;return a.lastIndex=s,n=a.exec(t),i+o+(n?.[1]??"")}function Ih(t,e){let r="";for(let n=1;n<t.length-1;++n){let i=t[n];if(!(i==="\r"&&t[n+1]===`
|
|
92
92
|
`))if(i===`
|
|
93
|
-
`){let{fold:o,offset:s}=
|
|
93
|
+
`){let{fold:o,offset:s}=Lh(t,n);r+=o,n=s}else if(i==="\\"){let o=t[++n],s=$h[o];if(s)r+=s;else if(o===`
|
|
94
94
|
`)for(o=t[n+1];o===" "||o===" ";)o=t[++n+1];else if(o==="\r"&&t[n+1]===`
|
|
95
|
-
`)for(o=t[++n+1];o===" "||o===" ";)o=t[++n+1];else if(o==="x"||o==="u"||o==="U"){let a=o==="x"?2:o==="u"?4:8;r+=
|
|
95
|
+
`)for(o=t[++n+1];o===" "||o===" ";)o=t[++n+1];else if(o==="x"||o==="u"||o==="U"){let a=o==="x"?2:o==="u"?4:8;r+=jh(t,n+1,a,e),n+=a}else{let a=t.substr(n-1,2);e(n-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),r+=a}}else if(i===" "||i===" "){let o=n,s=t[n+1];for(;s===" "||s===" ";)s=t[++n+1];s!==`
|
|
96
96
|
`&&!(s==="\r"&&t[n+2]===`
|
|
97
|
-
`)&&(r+=n>o?t.slice(o,n+1):i)}else r+=i}return(t[t.length-1]!=='"'||t.length===1)&&e(t.length,"MISSING_CHAR",'Missing closing "quote'),r}function
|
|
97
|
+
`)&&(r+=n>o?t.slice(o,n+1):i)}else r+=i}return(t[t.length-1]!=='"'||t.length===1)&&e(t.length,"MISSING_CHAR",'Missing closing "quote'),r}function Lh(t,e){let r="",n=t[e+1];for(;(n===" "||n===" "||n===`
|
|
98
98
|
`||n==="\r")&&!(n==="\r"&&t[e+2]!==`
|
|
99
99
|
`);)n===`
|
|
100
100
|
`&&(r+=`
|
|
101
|
-
`),e+=1,n=t[e+1];return r||(r=" "),{fold:r,offset:e}}var
|
|
102
|
-
`,r:"\r",t:" ",v:"\v",N:"
",_:" ",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function
|
|
101
|
+
`),e+=1,n=t[e+1];return r||(r=" "),{fold:r,offset:e}}var $h={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
|
|
102
|
+
`,r:"\r",t:" ",v:"\v",N:"
",_:" ",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function jh(t,e,r,n){let i=t.substr(e,r),s=i.length===r&&/^[0-9a-fA-F]+$/.test(i)?parseInt(i,16):NaN;try{return String.fromCodePoint(s)}catch{let a=t.substr(e-2,r+2);return n(e-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),a}}al.resolveFlowScalar=Ah});var ul=w(ll=>{"use strict";var Xe=_(),cl=T(),Wh=Oo(),Dh=To();function qh(t,e,r,n){let{value:i,type:o,comment:s,range:a}=e.type==="block-scalar"?Wh.resolveBlockScalar(t,e,n):Dh.resolveFlowScalar(e,t.options.strict,n),c=r?t.directives.tagName(r.source,f=>n(r,"TAG_RESOLVE_FAILED",f)):null,l;t.options.stringKeys&&t.atKey?l=t.schema[Xe.SCALAR]:c?l=Mh(t.schema,i,c,r,n):e.type==="scalar"?l=Fh(t,i,e,n):l=t.schema[Xe.SCALAR];let u;try{let f=l.resolve(i,d=>n(r??e,"TAG_RESOLVE_FAILED",d),t.options);u=Xe.isScalar(f)?f:new cl.Scalar(f)}catch(f){let d=f instanceof Error?f.message:String(f);n(r??e,"TAG_RESOLVE_FAILED",d),u=new cl.Scalar(i)}return u.range=a,u.source=i,o&&(u.type=o),c&&(u.tag=c),l.format&&(u.format=l.format),s&&(u.comment=s),u}function Mh(t,e,r,n,i){if(r==="!")return t[Xe.SCALAR];let o=[];for(let a of t.tags)if(!a.collection&&a.tag===r)if(a.default&&a.test)o.push(a);else return a;for(let a of o)if(a.test?.test(e))return a;let s=t.knownTags[r];return s&&!s.collection?(t.tags.push(Object.assign({},s,{default:!1,test:void 0})),s):(i(n,"TAG_RESOLVE_FAILED",`Unresolved tag: ${r}`,r!=="tag:yaml.org,2002:str"),t[Xe.SCALAR])}function Fh({atKey:t,directives:e,schema:r},n,i,o){let s=r.tags.find(a=>(a.default===!0||t&&a.default==="key")&&a.test?.test(n))||r[Xe.SCALAR];if(r.compat){let a=r.compat.find(c=>c.default&&c.test?.test(n))??r[Xe.SCALAR];if(s.tag!==a.tag){let c=e.tagString(s.tag),l=e.tagString(a.tag),u=`Value may be parsed as either ${c} or ${l}`;o(i,"TAG_RESOLVE_FAILED",u,!0)}}return s}ll.composeScalar=qh});var dl=w(fl=>{"use strict";function Bh(t,e,r){if(e){r??(r=e.length);for(let n=r-1;n>=0;--n){let i=e[n];switch(i.type){case"space":case"comment":case"newline":t-=i.source.length;continue}for(i=e[++n];i?.type==="space";)t+=i.source.length,i=e[++n];break}}return t}fl.emptyScalarPosition=Bh});var hl=w(Io=>{"use strict";var Uh=$t(),Gh=_(),Kh=il(),ml=ul(),Hh=vt(),zh=dl(),Jh={composeNode:pl,composeEmptyNode:No};function pl(t,e,r,n){let i=t.atKey,{spaceBefore:o,comment:s,anchor:a,tag:c}=r,l,u=!0;switch(e.type){case"alias":l=Yh(t,e,n),(a||c)&&n(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=ml.composeScalar(t,e,c,n),a&&(l.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{l=Kh.composeCollection(Jh,t,e,r,n),a&&(l.anchor=a.source.substring(1))}catch(f){let d=f instanceof Error?f.message:String(f);n(e,"RESOURCE_EXHAUSTION",d)}break;default:{let f=e.type==="error"?e.message:`Unsupported token (type: ${e.type})`;n(e,"UNEXPECTED_TOKEN",f),u=!1}}return l??(l=No(t,e.offset,void 0,null,r,n)),a&&l.anchor===""&&n(a,"BAD_ALIAS","Anchor cannot be an empty string"),i&&t.options.stringKeys&&(!Gh.isScalar(l)||typeof l.value!="string"||l.tag&&l.tag!=="tag:yaml.org,2002:str")&&n(c??e,"NON_STRING_KEY","With stringKeys, all keys must be strings"),o&&(l.spaceBefore=!0),s&&(e.type==="scalar"&&e.source===""?l.comment=s:l.commentBefore=s),t.options.keepSourceTokens&&u&&(l.srcToken=e),l}function No(t,e,r,n,{spaceBefore:i,comment:o,anchor:s,tag:a,end:c},l){let u={type:"scalar",offset:zh.emptyScalarPosition(e,r,n),indent:-1,source:""},f=ml.composeScalar(t,u,a,l);return s&&(f.anchor=s.source.substring(1),f.anchor===""&&l(s,"BAD_ALIAS","Anchor cannot be an empty string")),i&&(f.spaceBefore=!0),o&&(f.comment=o,f.range[2]=c),f}function Yh({options:t},{offset:e,source:r,end:n},i){let o=new Uh.Alias(r.substring(1));o.source===""&&i(e,"BAD_ALIAS","Alias cannot be an empty string"),o.source.endsWith(":")&&i(e+r.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let s=e+r.length,a=Hh.resolveEnd(n,s,t.strict,i);return o.range=[e,s,a.offset],a.comment&&(o.comment=a.comment),o}Io.composeEmptyNode=No;Io.composeNode=pl});var yl=w(wl=>{"use strict";var Vh=Xt(),gl=hl(),Xh=vt(),Qh=tr();function Zh(t,e,{offset:r,start:n,value:i,end:o},s){let a=Object.assign({_directives:e},t),c=new Vh.Document(void 0,a),l={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},u=Qh.resolveProps(n,{indicator:"doc-start",next:i??o?.[0],offset:r,onError:s,parentIndent:0,startOnNewline:!0});u.found&&(c.directives.docStart=!0,i&&(i.type==="block-map"||i.type==="block-seq")&&!u.hasNewline&&s(u.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),c.contents=i?gl.composeNode(l,i,u,s):gl.composeEmptyNode(l,u.end,n,null,u,s);let f=c.contents.range[2],d=Xh.resolveEnd(o,f,!1,s);return d.comment&&(c.comment=d.comment),c.range=[r,f,d.offset],c}wl.composeDoc=Zh});var $o=w(kl=>{"use strict";var eg=Rr("process"),tg=vi(),rg=Xt(),rr=er(),vl=_(),ng=yl(),ig=vt();function nr(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:r}=t;return[e,e+(typeof r=="string"?r.length:1)]}function bl(t){let e="",r=!1,n=!1;for(let i=0;i<t.length;++i){let o=t[i];switch(o[0]){case"#":e+=(e===""?"":n?`
|
|
103
103
|
|
|
104
104
|
`:`
|
|
105
|
-
`)+(o.substring(1)||" "),r=!0,n=!1;break;case"%":t[i+1]?.[0]!=="#"&&(i+=1),r=!1;break;default:r||(n=!0),r=!1}}return{comment:e,afterEmptyLine:n}}var
|
|
106
|
-
${n}`:n;else if(i||e.directives.docStart||!o)e.commentBefore=n;else if(
|
|
105
|
+
`)+(o.substring(1)||" "),r=!0,n=!1;break;case"%":t[i+1]?.[0]!=="#"&&(i+=1),r=!1;break;default:r||(n=!0),r=!1}}return{comment:e,afterEmptyLine:n}}var Lo=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(r,n,i,o)=>{let s=nr(r);o?this.warnings.push(new rr.YAMLWarning(s,n,i)):this.errors.push(new rr.YAMLParseError(s,n,i))},this.directives=new tg.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,r){let{comment:n,afterEmptyLine:i}=bl(this.prelude);if(n){let o=e.contents;if(r)e.comment=e.comment?`${e.comment}
|
|
106
|
+
${n}`:n;else if(i||e.directives.docStart||!o)e.commentBefore=n;else if(vl.isCollection(o)&&!o.flow&&o.items.length>0){let s=o.items[0];vl.isPair(s)&&(s=s.key);let a=s.commentBefore;s.commentBefore=a?`${n}
|
|
107
107
|
${a}`:n}else{let s=o.commentBefore;o.commentBefore=s?`${n}
|
|
108
|
-
${s}`:n}}if(r){for(let o=0;o<this.errors.length;++o)e.errors.push(this.errors[o]);for(let o=0;o<this.warnings.length;++o)e.warnings.push(this.warnings[o])}else e.errors=this.errors,e.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:
|
|
109
|
-
${r.comment}`:r.comment}this.doc.range[2]=r.offset;break}default:this.errors.push(new
|
|
108
|
+
${s}`:n}}if(r){for(let o=0;o<this.errors.length;++o)e.errors.push(this.errors[o]);for(let o=0;o<this.warnings.length;++o)e.warnings.push(this.warnings[o])}else e.errors=this.errors,e.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:bl(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,r=!1,n=-1){for(let i of e)yield*this.next(i);yield*this.end(r,n)}*next(e){switch(eg.env.LOG_STREAM&&console.dir(e,{depth:null}),e.type){case"directive":this.directives.add(e.source,(r,n,i)=>{let o=nr(e);o[0]+=r,this.onError(o,"BAD_DIRECTIVE",n,i)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let r=ng.composeDoc(this.options,this.directives,e,this.onError);this.atDirectives&&!r.directives.docStart&&this.onError(e,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(r,!1),this.doc&&(yield this.doc),this.doc=r,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(e.source);break;case"error":{let r=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,n=new rr.YAMLParseError(nr(e),"UNEXPECTED_TOKEN",r);this.atDirectives||!this.doc?this.errors.push(n):this.doc.errors.push(n);break}case"doc-end":{if(!this.doc){let n="Unexpected doc-end without preceding document";this.errors.push(new rr.YAMLParseError(nr(e),"UNEXPECTED_TOKEN",n));break}this.doc.directives.docEnd=!0;let r=ig.resolveEnd(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),r.comment){let n=this.doc.comment;this.doc.comment=n?`${n}
|
|
109
|
+
${r.comment}`:r.comment}this.doc.range[2]=r.offset;break}default:this.errors.push(new rr.YAMLParseError(nr(e),"UNEXPECTED_TOKEN",`Unsupported token ${e.type}`))}}*end(e=!1,r=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let n=Object.assign({_directives:this.directives},this.options),i=new rg.Document(void 0,n);this.atDirectives&&this.onError(r,"MISSING_CHAR","Missing directives-end indicator line"),i.range=[0,r,r],this.decorate(i,!1),yield i}}};kl.Composer=Lo});var El=w(bn=>{"use strict";var og=Oo(),sg=To(),ag=er(),Cl=Mt();function cg(t,e=!0,r){if(t){let n=(i,o,s)=>{let a=typeof i=="number"?i:Array.isArray(i)?i[0]:i.offset;if(r)r(a,o,s);else throw new ag.YAMLParseError([a,a+1],o,s)};switch(t.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return sg.resolveFlowScalar(t,e,n);case"block-scalar":return og.resolveBlockScalar({options:{strict:e}},t,n)}}return null}function lg(t,e){let{implicitKey:r=!1,indent:n,inFlow:i=!1,offset:o=-1,type:s="PLAIN"}=e,a=Cl.stringifyString({type:s,value:t},{implicitKey:r,indent:n>0?" ".repeat(n):"",inFlow:i,options:{blockQuote:!0,lineWidth:-1}}),c=e.end??[{type:"newline",offset:-1,indent:n,source:`
|
|
110
110
|
`}];switch(a[0]){case"|":case">":{let l=a.indexOf(`
|
|
111
111
|
`),u=a.substring(0,l),f=a.substring(l+1)+`
|
|
112
|
-
`,d=[{type:"block-scalar-header",offset:o,indent:n,source:u}];return
|
|
113
|
-
`}),{type:"block-scalar",offset:o,indent:n,props:d,source:f}}case'"':return{type:"double-quoted-scalar",offset:o,indent:n,source:a,end:c};case"'":return{type:"single-quoted-scalar",offset:o,indent:n,source:a,end:c};default:return{type:"scalar",offset:o,indent:n,source:a,end:c}}}function
|
|
112
|
+
`,d=[{type:"block-scalar-header",offset:o,indent:n,source:u}];return Sl(d,c)||d.push({type:"newline",offset:-1,indent:n,source:`
|
|
113
|
+
`}),{type:"block-scalar",offset:o,indent:n,props:d,source:f}}case'"':return{type:"double-quoted-scalar",offset:o,indent:n,source:a,end:c};case"'":return{type:"single-quoted-scalar",offset:o,indent:n,source:a,end:c};default:return{type:"scalar",offset:o,indent:n,source:a,end:c}}}function ug(t,e,r={}){let{afterKey:n=!1,implicitKey:i=!1,inFlow:o=!1,type:s}=r,a="indent"in t?t.indent:null;if(n&&typeof a=="number"&&(a+=2),!s)switch(t.type){case"single-quoted-scalar":s="QUOTE_SINGLE";break;case"double-quoted-scalar":s="QUOTE_DOUBLE";break;case"block-scalar":{let l=t.props[0];if(l.type!=="block-scalar-header")throw new Error("Invalid block scalar header");s=l.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:s="PLAIN"}let c=Cl.stringifyString({type:s,value:e},{implicitKey:i||a===null,indent:a!==null&&a>0?" ".repeat(a):"",inFlow:o,options:{blockQuote:!0,lineWidth:-1}});switch(c[0]){case"|":case">":fg(t,c);break;case'"':jo(t,c,"double-quoted-scalar");break;case"'":jo(t,c,"single-quoted-scalar");break;default:jo(t,c,"scalar")}}function fg(t,e){let r=e.indexOf(`
|
|
114
114
|
`),n=e.substring(0,r),i=e.substring(r+1)+`
|
|
115
|
-
`;if(t.type==="block-scalar"){let o=t.props[0];if(o.type!=="block-scalar-header")throw new Error("Invalid block scalar header");o.source=n,t.source=i}else{let{offset:o}=t,s="indent"in t?t.indent:-1,a=[{type:"block-scalar-header",offset:o,indent:s,source:n}];
|
|
116
|
-
`});for(let c of Object.keys(t))c!=="type"&&c!=="offset"&&delete t[c];Object.assign(t,{type:"block-scalar",indent:s,props:a,source:i})}}function
|
|
117
|
-
`};delete t.items,Object.assign(t,{type:r,source:e,end:[i]});break}default:{let n="indent"in t?t.indent:-1,i="end"in t&&Array.isArray(t.end)?t.end.filter(o=>o.type==="space"||o.type==="comment"||o.type==="newline"):[];for(let o of Object.keys(t))o!=="type"&&o!=="offset"&&delete t[o];Object.assign(t,{type:r,indent:n,source:e,end:i})}}}
|
|
115
|
+
`;if(t.type==="block-scalar"){let o=t.props[0];if(o.type!=="block-scalar-header")throw new Error("Invalid block scalar header");o.source=n,t.source=i}else{let{offset:o}=t,s="indent"in t?t.indent:-1,a=[{type:"block-scalar-header",offset:o,indent:s,source:n}];Sl(a,"end"in t?t.end:void 0)||a.push({type:"newline",offset:-1,indent:s,source:`
|
|
116
|
+
`});for(let c of Object.keys(t))c!=="type"&&c!=="offset"&&delete t[c];Object.assign(t,{type:"block-scalar",indent:s,props:a,source:i})}}function Sl(t,e){if(e)for(let r of e)switch(r.type){case"space":case"comment":t.push(r);break;case"newline":return t.push(r),!0}return!1}function jo(t,e,r){switch(t.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":t.type=r,t.source=e;break;case"block-scalar":{let n=t.props.slice(1),i=e.length;t.props[0].type==="block-scalar-header"&&(i-=t.props[0].source.length);for(let o of n)o.offset+=i;delete t.props,Object.assign(t,{type:r,source:e,end:n});break}case"block-map":case"block-seq":{let i={type:"newline",offset:t.offset+e.length,indent:t.indent,source:`
|
|
117
|
+
`};delete t.items,Object.assign(t,{type:r,source:e,end:[i]});break}default:{let n="indent"in t?t.indent:-1,i="end"in t&&Array.isArray(t.end)?t.end.filter(o=>o.type==="space"||o.type==="comment"||o.type==="newline"):[];for(let o of Object.keys(t))o!=="type"&&o!=="offset"&&delete t[o];Object.assign(t,{type:r,indent:n,source:e,end:i})}}}bn.createScalarToken=lg;bn.resolveAsScalar=cg;bn.setScalarValue=ug});var xl=w(_l=>{"use strict";var dg=t=>"type"in t?Cn(t):kn(t);function Cn(t){switch(t.type){case"block-scalar":{let e="";for(let r of t.props)e+=Cn(r);return e+t.source}case"block-map":case"block-seq":{let e="";for(let r of t.items)e+=kn(r);return e}case"flow-collection":{let e=t.start.source;for(let r of t.items)e+=kn(r);for(let r of t.end)e+=r.source;return e}case"document":{let e=kn(t);if(t.end)for(let r of t.end)e+=r.source;return e}default:{let e=t.source;if("end"in t&&t.end)for(let r of t.end)e+=r.source;return e}}}function kn({start:t,key:e,sep:r,value:n}){let i="";for(let o of t)i+=o.source;if(e&&(i+=Cn(e)),r)for(let o of r)i+=o.source;return n&&(i+=Cn(n)),i}_l.stringify=dg});var Al=w(Ol=>{"use strict";var Wo=Symbol("break visit"),mg=Symbol("skip children"),Pl=Symbol("remove item");function Qe(t,e){"type"in t&&t.type==="document"&&(t={start:t.start,value:t.value}),Rl(Object.freeze([]),t,e)}Qe.BREAK=Wo;Qe.SKIP=mg;Qe.REMOVE=Pl;Qe.itemAtPath=(t,e)=>{let r=t;for(let[n,i]of e){let o=r?.[n];if(o&&"items"in o)r=o.items[i];else return}return r};Qe.parentCollection=(t,e)=>{let r=Qe.itemAtPath(t,e.slice(0,-1)),n=e[e.length-1][0],i=r?.[n];if(i&&"items"in i)return i;throw new Error("Parent collection not found")};function Rl(t,e,r){let n=r(e,t);if(typeof n=="symbol")return n;for(let i of["key","value"]){let o=e[i];if(o&&"items"in o){for(let s=0;s<o.items.length;++s){let a=Rl(Object.freeze(t.concat([[i,s]])),o.items[s],r);if(typeof a=="number")s=a-1;else{if(a===Wo)return Wo;a===Pl&&(o.items.splice(s,1),s-=1)}}typeof n=="function"&&i==="key"&&(n=n(e,t))}}return typeof n=="function"?n(e,t):n}Ol.visit=Qe});var Sn=w(K=>{"use strict";var Do=El(),pg=xl(),hg=Al(),qo="\uFEFF",Mo="",Fo="",Bo="",gg=t=>!!t&&"items"in t,wg=t=>!!t&&(t.type==="scalar"||t.type==="single-quoted-scalar"||t.type==="double-quoted-scalar"||t.type==="block-scalar");function yg(t){switch(t){case qo:return"<BOM>";case Mo:return"<DOC>";case Fo:return"<FLOW_END>";case Bo:return"<SCALAR>";default:return JSON.stringify(t)}}function vg(t){switch(t){case qo:return"byte-order-mark";case Mo:return"doc-mode";case Fo:return"flow-error-end";case Bo: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}
|
|
120
|
-
`:case"\r":case" ":return!0;default:return!1}}var
|
|
121
|
-
\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}K.createScalarToken=Do.createScalarToken;K.resolveAsScalar=Do.resolveAsScalar;K.setScalarValue=Do.setScalarValue;K.stringify=pg.stringify;K.visit=hg.visit;K.BOM=qo;K.DOCUMENT=Mo;K.FLOW_END=Fo;K.SCALAR=Bo;K.isCollection=gg;K.isScalar=wg;K.prettyToken=yg;K.tokenType=vg});var Ko=w(Nl=>{"use strict";var ir=Sn();function oe(t){switch(t){case void 0:case" ":case`
|
|
120
|
+
`:case"\r":case" ":return!0;default:return!1}}var Tl=new Set("0123456789ABCDEFabcdef"),bg=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),En=new Set(",[]{}"),kg=new Set(` ,[]{}
|
|
121
|
+
\r `),Uo=t=>!t||kg.has(t),Go=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,r=!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=!r;let n=this.next??"stream";for(;n&&(r||this.hasChars(1));)n=yield*this.parseNext(n)}atLineEnd(){let e=this.pos,r=this.buffer[e];for(;r===" "||r===" ";)r=this.buffer[++e];return!r||r==="#"||r===`
|
|
122
122
|
`?!0:r==="\r"?this.buffer[e+1]===`
|
|
123
123
|
`:!1}charAt(e){return this.buffer[this.pos+e]}continueScalar(e){let r=this.buffer[e];if(this.indentNext>0){let n=0;for(;r===" ";)r=this.buffer[++n+e];if(r==="\r"){let i=this.buffer[n+e+1];if(i===`
|
|
124
124
|
`||!i&&!this.atEnd)return e+n+1}return r===`
|
|
125
|
-
`||n>=this.indentNext||!r&&!this.atEnd?e+n:-1}if(r==="-"||r==="."){let n=this.buffer.substr(e,3);if((n==="---"||n==="...")&&
|
|
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]===
|
|
125
|
+
`||n>=this.indentNext||!r&&!this.atEnd?e+n:-1}if(r==="-"||r==="."){let n=this.buffer.substr(e,3);if((n==="---"||n==="...")&&oe(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]===ir.BOM&&(yield*this.pushCount(1),e=e.substring(1)),e[0]==="%"){let r=e.length,n=e.indexOf("#");for(;n!==-1;){let o=e[n-1];if(o===" "||o===" "){r=n-1;break}else n=e.indexOf("#",n+1)}for(;;){let o=e[r-1];if(o===" "||o===" ")r-=1;else break}let i=(yield*this.pushCount(r))+(yield*this.pushSpaces(!0));return yield*this.pushCount(e.length-i),this.pushNewline(),"stream"}if(this.atLineEnd()){let r=yield*this.pushSpaces(!0);return yield*this.pushCount(e.length-r),yield*this.pushNewline(),"stream"}return yield ir.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 r=this.peek(3);if((r==="---"||r==="...")&&oe(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,r==="---"?"doc":"stream"}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!oe(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[e,r]=this.peek(2);if(!r&&!this.atEnd)return this.setNext("block-start");if((e==="-"||e==="?"||e===":")&&oe(r)){let n=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=n,"block-start"}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let e=this.getLine();if(e===null)return this.setNext("doc");let r=yield*this.pushIndicators();switch(e[r]){case"#":yield*this.pushCount(e.length-r);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(Uo),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return r+=yield*this.parseBlockScalarHeader(),r+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-r),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,r,n=-1;do e=yield*this.pushNewline(),e>0?(r=yield*this.pushSpaces(!1),this.indentValue=n=r):r=0,r+=yield*this.pushSpaces(!0);while(e+r>0);let i=this.getLine();if(i===null)return this.setNext("flow");if((n!==-1&&n<this.indentNext&&i[0]!=="#"||n===0&&(i.startsWith("---")||i.startsWith("..."))&&oe(i[3]))&&!(n===this.indentNext-1&&this.flowLevel===1&&(i[0]==="]"||i[0]==="}")))return this.flowLevel=0,yield ir.FLOW_END,yield*this.parseLineStart();let o=0;for(;i[o]===",";)o+=yield*this.pushCount(1),o+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(o+=yield*this.pushIndicators(),i[o]){case void 0:return"flow";case"#":return yield*this.pushCount(i.length-o),"flow";case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel+=1,"flow";case"}":case"]":return yield*this.pushCount(1),this.flowKey=!0,this.flowLevel-=1,this.flowLevel?"flow":"doc";case"*":return yield*this.pushUntil(Uo),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let s=this.charAt(1);if(this.flowKey||oe(s)||s===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let e=this.charAt(0),r=this.buffer.indexOf(e,this.pos+1);if(e==="'")for(;r!==-1&&this.buffer[r+1]==="'";)r=this.buffer.indexOf("'",r+2);else for(;r!==-1;){let o=0;for(;this.buffer[r-1-o]==="\\";)o+=1;if(o%2===0)break;r=this.buffer.indexOf('"',r+1)}let n=this.buffer.substring(0,r),i=n.indexOf(`
|
|
127
127
|
`,this.pos);if(i!==-1){for(;i!==-1;){let o=this.continueScalar(i+1);if(o===-1)break;i=n.indexOf(`
|
|
128
|
-
`,o)}i!==-1&&(r=i-(n[i-1]==="\r"?2:1))}if(r===-1){if(!this.atEnd)return this.setNext("quoted-scalar");r=this.buffer.length}return yield*this.pushToIndex(r+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let e=this.pos;for(;;){let r=this.buffer[++e];if(r==="+")this.blockScalarKeep=!0;else if(r>"0"&&r<="9")this.blockScalarIndent=Number(r)-1;else if(r!=="-")break}return yield*this.pushUntil(r=>
|
|
128
|
+
`,o)}i!==-1&&(r=i-(n[i-1]==="\r"?2:1))}if(r===-1){if(!this.atEnd)return this.setNext("quoted-scalar");r=this.buffer.length}return yield*this.pushToIndex(r+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let e=this.pos;for(;;){let r=this.buffer[++e];if(r==="+")this.blockScalarKeep=!0;else if(r>"0"&&r<="9")this.blockScalarIndent=Number(r)-1;else if(r!=="-")break}return yield*this.pushUntil(r=>oe(r)||r==="#")}*parseBlockScalar(){let e=this.pos-1,r=0,n;e:for(let o=this.pos;n=this.buffer[o];++o)switch(n){case" ":r+=1;break;case`
|
|
129
129
|
`:e=o,r=0;break;case"\r":{let s=this.buffer[o+1];if(!s&&!this.atEnd)return this.setNext("block-scalar");if(s===`
|
|
130
130
|
`)break}default:break e}if(!n&&!this.atEnd)return this.setNext("block-scalar");if(r>=this.indentNext){this.blockScalarIndent===-1?this.indentNext=r:this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{let o=this.continueScalar(e+1);if(o===-1)break;e=this.buffer.indexOf(`
|
|
131
131
|
`,o)}while(e!==-1);if(e===-1){if(!this.atEnd)return this.setNext("block-scalar");e=this.buffer.length}}let i=e+1;for(n=this.buffer[i];n===" ";)n=this.buffer[++i];if(n===" "){for(;n===" "||n===" "||n==="\r"||n===`
|
|
132
132
|
`;)n=this.buffer[++i];e=i-1}else if(!this.blockScalarKeep)do{let o=e-1,s=this.buffer[o];s==="\r"&&(s=this.buffer[--o]);let a=o;for(;s===" ";)s=this.buffer[--o];if(s===`
|
|
133
|
-
`&&o>=this.pos&&o+1+r>a)e=o;else break}while(!0);return yield
|
|
133
|
+
`&&o>=this.pos&&o+1+r>a)e=o;else break}while(!0);return yield ir.SCALAR,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,r=this.pos-1,n=this.pos-1,i;for(;i=this.buffer[++n];)if(i===":"){let o=this.buffer[n+1];if(oe(o)||e&&En.has(o))break;r=n}else if(oe(i)){let o=this.buffer[n+1];if(i==="\r"&&(o===`
|
|
134
134
|
`?(n+=1,i=`
|
|
135
|
-
`,o=this.buffer[n+1]):r=n),o==="#"||e&&
|
|
136
|
-
`){let s=this.continueScalar(n+1);if(s===-1)break;n=Math.max(n,s-2)}}else{if(e&&
|
|
135
|
+
`,o=this.buffer[n+1]):r=n),o==="#"||e&&En.has(o))break;if(i===`
|
|
136
|
+
`){let s=this.continueScalar(n+1);if(s===-1)break;n=Math.max(n,s-2)}}else{if(e&&En.has(i))break;r=n}return!i&&!this.atEnd?this.setNext("plain-scalar"):(yield ir.SCALAR,yield*this.pushToIndex(r+1,!0),e?"flow":"doc")}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,r){let n=this.buffer.slice(this.pos,e);return n?(yield n,this.pos+=n.length,n.length):(r&&(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(Uo),e+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let r=this.flowLevel>0,n=this.charAt(1);if(oe(n)||r&&En.has(n)){r?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,r=this.buffer[e];for(;!oe(r)&&r!==">";)r=this.buffer[++e];return yield*this.pushToIndex(r===">"?e+1:e,!1)}else{let e=this.pos+1,r=this.buffer[e];for(;r;)if(bg.has(r))r=this.buffer[++e];else if(r==="%"&&Tl.has(this.buffer[e+1])&&Tl.has(this.buffer[e+2]))r=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 r=this.pos-1,n;do n=this.buffer[++r];while(n===" "||e&&n===" ");let i=r-this.pos;return i>0&&(yield this.buffer.substr(this.pos,i),this.pos=r),i}*pushUntil(e){let r=this.pos,n=this.buffer[r];for(;!e(n);)n=this.buffer[++r];return yield*this.pushToIndex(r,!1)}};
|
|
138
|
+
`?yield*this.pushCount(2):0}*pushSpaces(e){let r=this.pos-1,n;do n=this.buffer[++r];while(n===" "||e&&n===" ");let i=r-this.pos;return i>0&&(yield this.buffer.substr(this.pos,i),this.pos=r),i}*pushUntil(e){let r=this.pos,n=this.buffer[r];for(;!e(n);)n=this.buffer[++r];return yield*this.pushToIndex(r,!1)}};Nl.Lexer=Go});var zo=w(Il=>{"use strict";var Ho=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let r=0,n=this.lineStarts.length;for(;r<n;){let o=r+n>>1;this.lineStarts[o]<e?r=o+1:n=o}if(this.lineStarts[r]===e)return{line:r+1,col:1};if(r===0)return{line:0,col:e};let i=this.lineStarts[r-1];return{line:r,col:e-i+1}}}};Il.LineCounter=Ho});var Yo=w(Dl=>{"use strict";var Cg=Rr("process"),Ll=Sn(),Sg=Ko();function Te(t,e){for(let r=0;r<t.length;++r)if(t[r].type===e)return!0;return!1}function $l(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 Wl(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 _n(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 bt(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 xn(t,e){if(e.length<1e5)Array.prototype.push.apply(t,e);else for(let r=0;r<e.length;++r)t.push(e[r])}function jl(t){if(t.start.type==="flow-seq-start")for(let e of t.items)e.sep&&!e.value&&!Te(e.start,"explicit-key-ind")&&!Te(e.sep,"map-value-ind")&&(e.key&&(e.value=e.key),delete e.key,Wl(e.value)?e.value.end?xn(e.value.end,e.sep):e.value.end=e.sep:xn(e.start,e.sep),delete e.sep)}var Jo=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 Sg.Lexer,this.onNewLine=e}*parse(e,r=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let n of this.lexer.lex(e,r))yield*this.next(n);r||(yield*this.end())}*next(e){if(this.source=e,Cg.env.LOG_TOKENS&&console.log("|",Ll.prettyToken(e)),this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}let r=Ll.tokenType(e);if(r)if(r==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=r,yield*this.step(),r){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 n=`Not a YAML token: ${e}`;yield*this.pop({type:"error",offset:this.offset,message:n,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 r=e??this.stack.pop();if(!r)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield r;else{let n=this.peek(1);switch(r.type==="block-scalar"?r.indent="indent"in n?n.indent:0:r.type==="flow-collection"&&n.type==="document"&&(r.indent=0),r.type==="flow-collection"&&jl(r),n.type){case"document":n.value=r;break;case"block-scalar":n.props.push(r);break;case"block-map":{let i=n.items[n.items.length-1];if(i.value){n.items.push({start:[],key:r,sep:[]}),this.onKeyLine=!0;return}else if(i.sep)i.value=r;else{Object.assign(i,{key:r,sep:[]}),this.onKeyLine=!i.explicitKey;return}break}case"block-seq":{let i=n.items[n.items.length-1];i.value?n.items.push({start:[],value:r}):i.value=r;break}case"flow-collection":{let i=n.items[n.items.length-1];!i||i.value?n.items.push({start:[],key:r,sep:[]}):i.sep?i.value=r:Object.assign(i,{key:r,sep:[]});return}default:yield*this.pop(),yield*this.pop(r)}if((n.type==="document"||n.type==="block-map"||n.type==="block-seq")&&(r.type==="block-map"||r.type==="block-seq")){let i=r.items[r.items.length-1];i&&!i.sep&&!i.value&&i.start.length>0&&$l(i.start)===-1&&(r.indent===0||i.start.every(o=>o.type!=="comment"||o.indent<r.indent))&&(n.type==="document"?n.end=i.start:n.items.push({start:i.start}),r.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":{$l(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 r=this.startBlockValue(e);r?this.stack.push(r):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 r=_n(this.peek(2)),n=bt(r),i;e.end?(i=e.end,i.push(this.sourceToken),delete e.end):i=[this.sourceToken];let o={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:n,key:e,sep:i}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=o}else yield*this.lineEnd(e)}*blockScalar(e){switch(this.type){case"space":case"comment":case"newline":e.props.push(this.sourceToken);return;case"scalar":if(e.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let r=this.source.indexOf(`
|
|
139
139
|
`)+1;for(;r!==0;)this.onNewLine(this.offset+r),r=this.source.indexOf(`
|
|
140
|
-
`,r)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let r=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,r.value){let n="end"in r.value?r.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type==="comment"?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else r.sep?r.sep.push(this.sourceToken):r.start.push(this.sourceToken);return;case"space":case"comment":if(r.value)e.items.push({start:[this.sourceToken]});else if(r.sep)r.sep.push(this.sourceToken);else{if(this.atIndentedComment(r.start,e.indent)){let i=e.items[e.items.length-2]?.value?.end;if(Array.isArray(i)){
|
|
140
|
+
`,r)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let r=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,r.value){let n="end"in r.value?r.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type==="comment"?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else r.sep?r.sep.push(this.sourceToken):r.start.push(this.sourceToken);return;case"space":case"comment":if(r.value)e.items.push({start:[this.sourceToken]});else if(r.sep)r.sep.push(this.sourceToken);else{if(this.atIndentedComment(r.start,e.indent)){let i=e.items[e.items.length-2]?.value?.end;if(Array.isArray(i)){xn(i,r.start),i.push(this.sourceToken),e.items.pop();return}}r.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let n=!this.onKeyLine&&this.indent===e.indent,i=n&&(r.sep||r.explicitKey)&&this.type!=="seq-item-ind",o=[];if(i&&r.sep&&!r.value){let s=[];for(let a=0;a<r.sep.length;++a){let c=r.sep[a];switch(c.type){case"newline":s.push(a);break;case"space":break;case"comment":c.indent>e.indent&&(s.length=0);break;default:s.length=0}}s.length>=2&&(o=r.sep.splice(s[1]))}switch(this.type){case"anchor":case"tag":i||r.value?(o.push(this.sourceToken),e.items.push({start:o}),this.onKeyLine=!0):r.sep?r.sep.push(this.sourceToken):r.start.push(this.sourceToken);return;case"explicit-key-ind":!r.sep&&!r.explicitKey?(r.start.push(this.sourceToken),r.explicitKey=!0):i||r.value?(o.push(this.sourceToken),e.items.push({start:o,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(r.explicitKey)if(r.sep)if(r.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(Te(r.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]});else if(Wl(r.key)&&!Te(r.sep,"newline")){let s=bt(r.start),a=r.key,c=r.sep;c.push(this.sourceToken),delete r.key,delete r.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:a,sep:c}]})}else o.length>0?r.sep=r.sep.concat(o,this.sourceToken):r.sep.push(this.sourceToken);else if(Te(r.start,"newline"))Object.assign(r,{key:null,sep:[this.sourceToken]});else{let s=bt(r.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:null,sep:[this.sourceToken]}]})}else r.sep?r.value||i?e.items.push({start:o,key:null,sep:[this.sourceToken]}):Te(r.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):r.sep.push(this.sourceToken):Object.assign(r,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let s=this.flowScalar(this.type);i||r.value?(e.items.push({start:o,key:s,sep:[]}),this.onKeyLine=!0):r.sep?this.stack.push(s):(Object.assign(r,{key:s,sep:[]}),this.onKeyLine=!0);return}default:{let s=this.startBlockValue(e);if(s){if(s.type==="block-seq"){if(!r.explicitKey&&r.sep&&!Te(r.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 n&&e.items.push({start:o});this.stack.push(s);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let r=e.items[e.items.length-1];switch(this.type){case"newline":if(r.value){let n="end"in r.value?r.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type==="comment"?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else r.start.push(this.sourceToken);return;case"space":case"comment":if(r.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(r.start,e.indent)){let i=e.items[e.items.length-2]?.value?.end;if(Array.isArray(i)){xn(i,r.start),i.push(this.sourceToken),e.items.pop();return}}r.start.push(this.sourceToken)}return;case"anchor":case"tag":if(r.value||this.indent<=e.indent)break;r.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;r.value||Te(r.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):r.start.push(this.sourceToken);return}if(this.indent>e.indent){let n=this.startBlockValue(e);if(n){this.stack.push(n);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let r=e.items[e.items.length-1];if(this.type==="flow-error-end"){let n;do yield*this.pop(),n=this.peek(1);while(n?.type==="flow-collection")}else if(e.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!r||r.sep?e.items.push({start:[this.sourceToken]}):r.start.push(this.sourceToken);return;case"map-value-ind":!r||r.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):r.sep?r.sep.push(this.sourceToken):Object.assign(r,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!r||r.value?e.items.push({start:[this.sourceToken]}):r.sep?r.sep.push(this.sourceToken):r.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let i=this.flowScalar(this.type);!r||r.value?e.items.push({start:[],key:i,sep:[]}):r.sep?this.stack.push(i):Object.assign(r,{key:i,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}let n=this.startBlockValue(e);n?this.stack.push(n):(yield*this.pop(),yield*this.step())}else{let n=this.peek(2);if(n.type==="block-map"&&(this.type==="map-value-ind"&&n.indent===e.indent||this.type==="newline"&&!n.items[n.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&n.type!=="flow-collection"){let i=_n(n),o=bt(i);jl(e);let s=e.end.splice(1,e.end.length);s.push(this.sourceToken);let a={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:o,key:e,sep:s}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=a}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let r=this.source.indexOf(`
|
|
141
141
|
`)+1;for(;r!==0;)this.onNewLine(this.offset+r),r=this.source.indexOf(`
|
|
142
|
-
`,r)+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 r=vn(e),n=ht(r);return n.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let r=vn(e),n=ht(r);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,r){return this.type!=="comment"||this.indent<=r?!1:e.every(n=>n.type==="newline"||n.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())}}};Cl.Parser=jo});var Pl=w(er=>{"use strict";var Sl=Co(),tg=Gt(),Zt=Yt(),rg=vi(),ng=_(),ig=Lo(),El=$o();function _l(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new ig.LineCounter||null,prettyErrors:e}}function og(t,e={}){let{lineCounter:r,prettyErrors:n}=_l(e),i=new El.Parser(r?.addNewLine),o=new Sl.Composer(e),s=Array.from(o.compose(i.parse(t)));if(n&&r)for(let a of s)a.errors.forEach(Zt.prettifyError(t,r)),a.warnings.forEach(Zt.prettifyError(t,r));return s.length>0?s:Object.assign([],{empty:!0},o.streamInfo())}function xl(t,e={}){let{lineCounter:r,prettyErrors:n}=_l(e),i=new El.Parser(r?.addNewLine),o=new Sl.Composer(e),s=null;for(let a of o.compose(i.parse(t),!0,t.length))if(!s)s=a;else if(s.options.logLevel!=="silent"){s.errors.push(new Zt.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return n&&r&&(s.errors.forEach(Zt.prettifyError(t,r)),s.warnings.forEach(Zt.prettifyError(t,r))),s}function sg(t,e,r){let n;typeof e=="function"?n=e:r===void 0&&e&&typeof e=="object"&&(r=e);let i=xl(t,r);if(!i)return null;if(i.warnings.forEach(o=>rg.warn(i.options.logLevel,o)),i.errors.length>0){if(i.options.logLevel!=="silent")throw i.errors[0];i.errors=[]}return i.toJS(Object.assign({reviver:n},r))}function ag(t,e,r){let n=null;if(typeof e=="function"||Array.isArray(e)?n=e:r===void 0&&e&&(r=e),typeof r=="string"&&(r=r.length),typeof r=="number"){let i=Math.round(r);r=i<1?void 0:i>8?{indent:8}:{indent:i}}if(t===void 0){let{keepUndefined:i}=r??e??{};if(!i)return}return ng.isDocument(t)&&!n?t.toString(r):new tg.Document(t,n,r).toString(r)}er.parse=sg;er.parseAllDocuments=og;er.parseDocument=xl;er.stringify=ag});var Oe=w(x=>{"use strict";var cg=Co(),lg=Gt(),ug=to(),Do=Yt(),fg=Ot(),Re=_(),dg=Se(),mg=T(),pg=_e(),hg=xe(),gg=wn(),wg=No(),yg=Lo(),vg=$o(),kn=Pl(),Rl=_t();x.Composer=cg.Composer;x.Document=lg.Document;x.Schema=ug.Schema;x.YAMLError=Do.YAMLError;x.YAMLParseError=Do.YAMLParseError;x.YAMLWarning=Do.YAMLWarning;x.Alias=fg.Alias;x.isAlias=Re.isAlias;x.isCollection=Re.isCollection;x.isDocument=Re.isDocument;x.isMap=Re.isMap;x.isNode=Re.isNode;x.isPair=Re.isPair;x.isScalar=Re.isScalar;x.isSeq=Re.isSeq;x.Pair=dg.Pair;x.Scalar=mg.Scalar;x.YAMLMap=pg.YAMLMap;x.YAMLSeq=hg.YAMLSeq;x.CST=gg;x.Lexer=wg.Lexer;x.LineCounter=yg.LineCounter;x.Parser=vg.Parser;x.parse=kn.parse;x.parseAllDocuments=kn.parseAllDocuments;x.parseDocument=kn.parseDocument;x.stringify=kn.stringify;x.visit=Rl.visit;x.visitAsync=Rl.visitAsync});import Ae from"path";function Eg(t,e){if(typeof t!="string")throw new Error(`${e} must be a string`);let r=t.trim();if(r.length===0||Ae.posix.isAbsolute(r)||Ae.win32.isAbsolute(r)||/^(?:~|[\\/])/u.test(r))throw new Error(`${e} must be a project-relative path`);if(r===".")return[];let n=r.replaceAll("\\","/").split("/");if(n.some(i=>i===".."))throw new Error(`${e} must stay inside the project root`);if(n.some(i=>i===""||i==="."))throw new Error(`${e} must not contain empty or dot path segments`);return n}function rr(t){let e=Eg(t,"native.artifact_root");return e.length===0?".":e.join("/")}function Dl(t,e="docs"){let r=t??e;if(r!=="legacy"&&r!=="docs")throw new Error("classic.artifact_layout must be legacy or docs");return r}function gt(t,e,r=!1){if(typeof t!="string")throw new Error(`${e} must be a string`);let n=t.trim().replaceAll("\\","/");if(n.length===0||Ae.posix.isAbsolute(n)||Ae.win32.isAbsolute(n)||/^(?:~|[\\/])/u.test(n))throw new Error(`${e} must be relative to its declared path base`);let i=n.split("/");if(i.some(o=>o===".."))throw new Error(`${e} must stay inside its declared path base`);if(i.some(o=>o===""||o==="."))throw new Error(`${e} must not contain empty or dot path segments`);if(!r&&/[*?]/u.test(n))throw new Error(`${e} cannot contain wildcards`);return i.join("/")}function pe(t,e){if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`${e} must be a mapping`);return t}function Wl(t,e,r){let n=t??e;if(n!=="en"&&n!=="zh-CN")throw new Error(`${r} must be en or zh-CN`);return n}function ql(t,e){if(typeof t!="string"||t.length===0||t.includes("\\")||t.includes("\0")||t.startsWith("/")||t.split("/").includes(".."))throw new Error(`${e} contains an unsafe pattern`);if(t.length>Wo)throw new Error(`${e} exceeds ${Wo} characters`);let r=0;for(let n=0;n<t.length;n+=1)t[n]==="?"?r+=1:t[n]==="*"&&(r+=1,t[n+1]==="*"&&(n+=1));if(r>qo)throw new Error(`${e} contains more than ${qo} wildcard tokens`);return t}function Il(t,e,r){if(t===void 0)return[...r];if(!Array.isArray(t))throw new Error(`${e} contains an unsafe pattern`);return[...new Set(t.map(n=>ql(n,e)))].sort((n,i)=>n.localeCompare(i,"en"))}function tr(t,e,r){let n=t??e;if(!Number.isSafeInteger(n)||n<1)throw new Error(`${r} must be a positive integer`);return n}function Ll(t,e,r){let n=tr(t,e,r);if(n>Math.floor(Number.MAX_SAFE_INTEGER/(1024*1024)))throw new Error(`${r} is too large to convert to bytes safely`);return n}function _g(t){if(t===void 0)return{...J,include:[...J.include],exclude:[...J.exclude]};let e=pe(t,"native.snapshot");return{include:Il(e.include,"native.snapshot.include",J.include),exclude:Il(e.exclude,"native.snapshot.exclude",J.exclude),max_files:tr(e.max_files,J.max_files,"native.snapshot.max_files"),max_total_bytes:tr(e.max_total_bytes,J.max_total_bytes,"native.snapshot.max_total_bytes"),max_duration_ms:tr(e.max_duration_ms,J.max_duration_ms,"native.snapshot.max_duration_ms"),max_selection_records:tr(e.max_selection_records,J.max_selection_records,"native.snapshot.max_selection_records")}}function xg(t){if(t===void 0)return;let e=pe(t,"native.pending_root_move"),r=e.id,n=e.from_artifact_root,i=e.to_artifact_root,o=e.stage;if(typeof r!="string"||!/^[a-f0-9-]{8,}$/u.test(r))throw new Error("native.pending_root_move.id is invalid");if(typeof n!="string"||typeof i!="string")throw new Error("native.pending_root_move roots must be strings");if(o!=="copying"&&o!=="ready"&&o!=="switched")throw new Error("native.pending_root_move.stage is invalid");let s;if(e.cleanup!==void 0){let a=pe(e.cleanup,"native.pending_root_move.cleanup"),c=a.kind,l=a.state,u=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 u!="string"||!/^[a-f0-9]{64}$/u.test(u))throw new Error("native.pending_root_move.cleanup.manifest_hash is invalid");s={kind:c,state:l,manifestHash:u}}return{id:r,fromArtifactRoot:rr(n),toArtifactRoot:rr(i),stage:o,...s?{cleanup:s}:{}}}function Pg(t){if(t===void 0)return;let e=pe(t,"native.finish");if(e.pull_request===void 0)return{};let r=pe(e.pull_request,"native.finish.pull_request");if(r.provider!=="repository-command")throw new Error("native.finish.pull_request.provider must be repository-command");if(!Array.isArray(r.command)||r.command.length===0)throw new Error("native.finish.pull_request.command must be a non-empty array");if(r.command.length>64)throw new Error("native.finish.pull_request.command must contain at most 64 arguments");let n=r.command.map((o,s)=>{if(typeof o!="string"||o.trim().length===0||o.length>4096||/[\0\r\n]/u.test(o))throw new Error(`native.finish.pull_request.command[${s}] must be a non-empty single-line string of at most 4096 characters`);return o});if(Ae.posix.isAbsolute(n[0])||Ae.win32.isAbsolute(n[0]))throw new Error("native.finish.pull_request.command[0] must be a bare executable name or a project-relative path");let i=r.timeout_ms??bg;if(!Number.isSafeInteger(i)||i<1||i>Nl)throw new Error(`native.finish.pull_request.timeout_ms must be an integer between 1 and ${Nl}`);return{pull_request:{provider:"repository-command",command:n,timeout_ms:i}}}function Rg(t,e={}){let r=pe(t,"native"),n=r.artifact_root??(e.allowMissingArtifactRoot?"docs":void 0);if(typeof n!="string")throw new Error("native.artifact_root must be a string");let i=r.clarification_mode??"batch";if(i!=="sequential"&&i!=="batch")throw new Error("native.clarification_mode must be sequential or batch");let o=r.archive_confirmation??"automatic";if(o!=="automatic"&&o!=="required")throw new Error("native.archive_confirmation must be automatic or required");let s=r.max_verify_failures??jl;if(!Number.isSafeInteger(s)||s<1)throw new Error("native.max_verify_failures must be a positive integer");let a=r.document_writes??"allow";if(a!=="allow"&&a!=="revert")throw new Error("native.document_writes must be allow or revert");let c=xg(r.pending_root_move),l=Pg(r.finish);return{artifact_root:rr(n),language:Wl(r.language,"en","native.language"),clarification_mode:i,archive_confirmation:o,max_verify_failures:s,...a==="revert"?{document_writes:a}:{},snapshot:_g(r.snapshot),...l?{finish:l}:{},...c?{pending_root_move:c}:{}}}function Og(t){let e=pe(t,"classic"),r=e.context_compression??"off";if(r!=="off"&&r!=="beta")throw new Error("classic.context_compression must be off or beta");let n=e.review_mode??"standard";if(n!=="off"&&n!=="standard"&&n!=="thorough")throw new Error("classic.review_mode must be off, standard, or thorough");let i=e.auto_transition??!0;if(typeof i!="boolean")throw new Error("classic.auto_transition must be true or false");let o=e.document_evidence??"neutral";if(o!=="neutral"&&o!=="strict")throw new Error("classic.document_evidence must be neutral or strict");return{artifact_layout:Dl(e.artifact_layout),language:Wl(e.language,"zh-CN","classic.language"),context_compression:r,review_mode:n,auto_transition:i,...o==="strict"?{document_evidence:o}:{}}}function Ag(t){let r=pe(t,"hook").allow_paths??[];if(!Array.isArray(r))throw new Error("hook.allow_paths must be an array");return{allow_paths:[...new Set(r.map((n,i)=>gt(n,`hook.allow_paths[${i}]`)))]}}function Tg(t){if(t===void 0)return{...Cn};let e=pe(t,"memory"),r=e.learning??Cn.learning,n=e.retrieval??Cn.retrieval;if(typeof r!="boolean")throw new Error("memory.learning must be true or false");if(typeof n!="boolean")throw new Error("memory.retrieval must be true or false");return{learning:r,retrieval:n}}function Fo(t,e){if(t===null||typeof t!="object"||Array.isArray(t))throw new Error(`${e} must be a mapping`);return t}function Ng(t,e){if(typeof t!="string")throw new Error(`${e} must be a string`);let r=t.trim();if(r.length===0||r.includes("\\")||r.includes("\0")||Ae.posix.isAbsolute(r)||Ae.win32.isAbsolute(r)||r.startsWith("~")||r.split("/").some(i=>i===""||i==="."||i===".."))throw new Error(`${e} must be a safe project-relative glob`);if(!r.toLowerCase().endsWith(".md"))throw new Error(`${e} must target a Markdown file ending in .md`);if(r.length>Ol)throw new Error(`${e} exceeds ${Ol} characters`);let n=0;for(let i=0;i<r.length;i+=1)r[i]==="?"?n+=1:r[i]==="*"&&(n+=1,r[i+1]==="*"&&(i+=1));if(n>Al)throw new Error(`${e} contains more than ${Al} wildcard tokens`);return r}function Ig(t){let e=Fo(t,"knowledge.local"),r=e.include??[];if(!Array.isArray(r))throw new Error("knowledge.local.include must be an array");let n={include:[...new Set(r.map((i,o)=>Ng(i,`knowledge.local.include[${o}]`)))],max_file_mb:Ll(e.max_file_mb,Tl.max_file_mb,"knowledge.local.max_file_mb"),max_total_mb:Ll(e.max_total_mb,Tl.max_total_mb,"knowledge.local.max_total_mb")};if(n.max_file_mb>n.max_total_mb)throw new Error("knowledge.local.max_file_mb must not exceed max_total_mb");return n}function Lg(t){if(typeof t!="string"||t.trim().length===0)throw new Error("knowledge.remote.endpoint must be a non-empty URL");let e;try{e=new URL(t)}catch{throw new Error("knowledge.remote.endpoint must be a valid URL")}let r=e.hostname.toLowerCase().replace(/^\[|\]$/gu,""),n=r==="localhost"||r==="127.0.0.1"||r==="::1";if(e.protocol!=="https:"&&!(e.protocol==="http:"&&n))throw new Error("knowledge.remote.endpoint must use HTTPS (HTTP is allowed for loopback)");return e.toString()}function jg(t){let e=Fo(t,"knowledge.remote"),r=Lg(e.endpoint),n=e.token_env;if(n!==void 0&&(typeof n!="string"||!/^[A-Za-z_][A-Za-z0-9_]*$/u.test(n)))throw new Error("knowledge.remote.token_env must be an environment variable name");let i=e.scope;if(i!==void 0&&(typeof i!="string"||i.length>512))throw new Error("knowledge.remote.scope must be a string of at most 512 characters");let o=e.timeout_ms??5e3;if(typeof o!="number"||!Number.isSafeInteger(o)||o<100||o>3e4)throw new Error("knowledge.remote.timeout_ms must be an integer between 100 and 30000");return{endpoint:r,...n===void 0?{}:{token_env:n},...i===void 0?{}:{scope:i},timeout_ms:o}}function $g(t){if(t===void 0)return{...$l};let e=Fo(t,"knowledge"),r=e.provider??"local";if(r!=="local"&&r!=="remote")throw new Error("knowledge.provider must be local or remote");let n=e.local===void 0?void 0:Ig(e.local);if(r==="local")return{provider:r,...n?{local:n}:{}};let i=e.remote===void 0?void 0:jg(e.remote);if(i===void 0)throw new Error("knowledge.remote must be configured when knowledge.provider is remote");return{provider:r,...n?{local:n}:{},remote:i}}function Dg(t){let e=t??!0;if(typeof e!="boolean")throw new Error("ambient_resume must be true or false");return e}function Wg(t,e,r,n,i,o,s,a){let c=t.schema!==void 0;if(!(c||t.default_workflow!==void 0||t.workflows!==void 0||!a.allowPartialProject&&t.native!==void 0)||a.allowPartialProject&&!c)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 u=t.workflows??[t.default_workflow];if(!Array.isArray(u)||u.length===0||u.some(d=>d!=="native"&&d!=="classic"))throw new Error("workflows must contain native and/or classic");let f=[...new Set(u)];if(!f.includes(t.default_workflow))throw new Error("workflows must include default_workflow");if(f.includes("native")&&!i)throw new Error("native must be a mapping");return{schema:"comet.project.v1",default_workflow:t.default_workflow,workflows:f,ambient_resume:s,...e?{hook:e}:{},memory:r,knowledge:n,...i?{native:i}:{},...o?{classic:o}:{}}}function Te(t,e={}){let r=(0,Mo.parseDocument)(t,{uniqueKeys:!0});if(r.errors.length>0)throw new Error(`Invalid .comet/config.yaml: ${r.errors[0].message}`);let n=r.toJS();if(n==null)return{value:{},config:null,ambient_resume:!0};if(typeof n!="object"||Array.isArray(n))throw new Error("Invalid .comet/config.yaml: root must be a mapping");let i=n,o=Dg(i.ambient_resume),s=i.hook===void 0?void 0:Ag(i.hook),a=Tg(i.memory),c=$g(i.knowledge),l=i.native===void 0?void 0:Rg(i.native,{allowMissingArtifactRoot:e.allowMissingNativeFields}),u=i.classic===void 0?void 0:Og(i.classic),f=Wg(i,s,a,c,l,u,o,{allowPartialProject:e.allowPartialProject??!1});return{value:i,config:f,ambient_resume:o,memory:a,knowledge:c,...s?{hook:s}:{},...l?{native:l}:{},...u?{classic:u}:{}}}function Bo(t="docs",e="en"){return{schema:"comet.project.v1",default_workflow:"native",ambient_resume:!0,memory:{...Cn},knowledge:{...$l},native:{artifact_root:rr(t),language:e,clarification_mode:"batch",archive_confirmation:"automatic",max_verify_failures:jl,snapshot:{...J,include:[...J.include],exclude:[...J.exclude]}}}}var Mo,Ye,Wo,qo,Ol,Al,jl,Cn,Tl,$l,bg,Nl,kg,Cg,Sg,J,he=A(()=>{"use strict";Mo=Fe(Oe(),1),Ye=Number.MAX_SAFE_INTEGER,Wo=1024,qo=64,Ol=1024,Al=64,jl=5,Cn={learning:!0,retrieval:!0},Tl={include:[],max_file_mb:1,max_total_mb:32},$l={provider:"local"},bg=12e4,Nl=6e5,kg=[".agents/skills/**",".amazonq/skills/**",".augment/skills/**",".bob/skills/**",".claude/skills/**",".cline/skills/**",".codebuddy/skills/**",".workbuddy/skills/**",".continue/skills/**",".cospec/skills/**",".crush/skills/**",".cursor/skills/**",".devin/skills/**",".dsh/skills/**",".factory/skills/**",".forge/skills/**",".gemini/skills/**",".github/skills/**",".grok/skills/**",".iflow/skills/**",".junie/skills/**",".kilocode/skills/**",".kimi-code/skills/**",".kiro/skills/**",".lingma/skills/**",".mimocode/skills/**",".opencode/skills/**",".omp/skills/**",".pi/skills/**",".qoder/skills/**",".qwen/skills/**",".roo/skills/**",".trae-cn/skills/**",".trae/skills/**",".windsurf/skills/**",".zcode/skills/**"],Cg=["**/.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"],Sg=[...kg,...Cg].sort((t,e)=>t.localeCompare(e,"en")),J={include:["**/*"],exclude:[...Sg],max_files:1e4,max_total_bytes:1024*1024*1024,max_duration_ms:6e4,max_selection_records:2e4}});function Ne(t){return t!==0&&t!==0n&&t!=="0"}function Ml(t,e){return Ne(t.dev)&&Ne(e.dev)&&Ne(t.ino)&&Ne(e.ino)}function Ie(t,e){let r=Ne(t.dev)&&Ne(e.dev);if(r&&t.dev!==e.dev)return!1;let n=Ne(t.ino)&&Ne(e.ino);return n&&t.ino!==e.ino?!1:r&&n?!0:t.birthtime===e.birthtime}var Sn=A(()=>{"use strict"});import{constants as En,promises as Je}from"fs";function Uo(t){return"birthtimeNs"in t&&typeof t.birthtimeNs=="bigint"?t.birthtimeNs:t.birthtimeMs}function Fl(t){return"ctimeNs"in t&&typeof t.ctimeNs=="bigint"?t.ctimeNs:t.ctimeMs}function nr(t){return{dev:t.dev,ino:t.ino,birthtime:Uo(t)}}function _n(t,e){let r=nr(t),n=nr(e);return Ml(r,n)?Ie(r,n):Ie(r,n)&&Uo(t)===Uo(e)&&Fl(t)===Fl(e)&&t.size===e.size}async function xn(t,e,r={}){if(!Number.isSafeInteger(e)||e<1)throw new Error("race-safe read byte limit must be a positive integer");let n=r.label??"file",i=r.bigint===!0,o=await Je.lstat(t,{bigint:i});if(!o.isFile()||o.isSymbolicLink())throw new Le("not-regular-file",`${n} must be a regular file`);if(BigInt(o.size)>BigInt(e))throw new Le("too-large",`${n} exceeds ${e} bytes`);let s=await Je.realpath(t);await r.verify?.("pre-open",{realPath:s,identity:nr(o)});let a=process.platform==="win32"?En.O_RDONLY:En.O_RDONLY|En.O_NOFOLLOW|En.O_NONBLOCK,c;try{c=await Je.open(t,a)}catch(l){throw l.code==="ELOOP"?new Le("not-regular-file",`${n} must be a regular file`,{cause:l}):l}try{let[l,u,f]=await Promise.all([c.stat({bigint:i}),Je.lstat(t,{bigint:i}),Je.realpath(t)]);if(!l.isFile()||!u.isFile()||u.isSymbolicLink()||f!==s||!_n(o,l)||!_n(o,u))throw new Le("changed",`${n} changed while opening`);await r.verify?.("post-open",{realPath:f,identity:nr(l)}),await r.hooks?.afterOpen?.();let d=[],p=0,h=Buffer.allocUnsafe(Math.min(64*1024,e+1));for(;;){let b=e+1-p,{bytesRead:k}=await c.read(h,0,Math.min(h.length,b),null);if(k===0)break;if(p+=k,p>e)throw new Le("too-large",`${n} exceeds ${e} bytes`);d.push(Buffer.from(h.subarray(0,k)))}await r.hooks?.beforeFinalCheck?.();let[m,g,v]=await Promise.all([c.stat({bigint:i}),Je.lstat(t,{bigint:i}),Je.realpath(t)]);if(!g.isFile()||g.isSymbolicLink()||v!==s||!_n(o,m)||!_n(o,g))throw new Le("changed",`${n} changed while reading`);return await r.verify?.("post-read",{realPath:v,identity:nr(m)}),{bytes:Buffer.concat(d,p),stat:m,realPath:v}}finally{await c.close()}}var Le,Ko=A(()=>{"use strict";Sn();Le=class extends Error{reason;constructor(e,r,n){super(r,n),this.name="RaceSafeReadError",this.reason=e}}});import{promises as Pn}from"fs";import je from"path";function qg(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}function Go(t,e){let r=je.relative(t,e);return r===""||!je.isAbsolute(r)&&r!==".."&&!r.startsWith(`..${je.sep}`)}async function Bl(t,e){let r=je.resolve(t),n=await Pn.lstat(r);if(!n.isDirectory()||n.isSymbolicLink())throw new Error(`${e} project root must be a real directory`);return Pn.realpath(r)}async function Ul(t,e,r,n){let i=t;for(let o=0;o<r.length;o++){i=je.join(i,r[o]);let s;try{s=await Pn.lstat(i)}catch(u){if(qg(u))return{exists:!1,kind:"missing"};throw u}let a=je.relative(t,i).replaceAll("\\","/");if(s.isSymbolicLink())throw new Error(`${n.label} crosses a symbolic link or junction at ${a}`);let c=o===r.length-1;if(!c&&!s.isDirectory())throw new Error(`${n.label} ancestor ${a} must be a real directory`);if(c&&(n.expected==="file"&&!s.isFile()||n.expected==="directory"&&!s.isDirectory()||n.expected==="any"&&!s.isFile()&&!s.isDirectory()))throw new Error(`${n.label} must be a real ${n.expected}`);let l=await Pn.realpath(i);if(!Go(e,l))throw new Error(`${n.label} resolves outside the project root`);if(c)return{exists:!0,kind:s.isFile()?"file":s.isDirectory()?"directory":"missing"}}return{exists:!0,kind:"directory"}}async function D(t,e,r){let n=gt(e,r.label),i=je.resolve(t),o=await Bl(i,r.label),s=n.split("/"),a=je.resolve(i,...s);if(!Go(i,a))throw new Error(`${r.label} must stay inside the project root`);let c=await Ul(i,o,s,r);return{projectRoot:i,target:a,relative:n,exists:c.exists,kind:c.kind}}async function j(t,e,r,n){let i=await D(t,e,{label:n.label,expected:"file"});if(!i.exists){let s=new Error(`${n.label} does not exist`);throw s.code="ENOENT",s}let o=await Bl(i.projectRoot,n.label);return xn(i.target,r,{...n,verify:async(s,a)=>{if(!Go(o,a.realPath))throw new Error(`${n.label} resolves outside the project root`);await Ul(i.projectRoot,o,i.relative.split("/"),{label:n.label,expected:"file"})}})}var V=A(()=>{"use strict";Ko();he()});import{createHash as Mg}from"crypto";function Fg(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}async function Ve(t,e={}){return(await Rn(t,e)).document}async function Bg(t){try{return(await j(t,ir,Ye,{label:ir})).bytes}catch(e){if(Fg(e))return null;throw e}}function Ug(t){return t?{exists:!0,sha256:Mg("sha256").update(t).digest("hex")}:{exists:!1,sha256:null}}async function Rn(t,e={}){let r=await Bg(t);return{document:r?Te(r.toString("utf8"),e):null,identity:Ug(r)}}async function Ho(t){return(await Ve(t))?.config??null}var ir,$e=A(()=>{"use strict";he();V();ir=".comet/config.yaml"});import{promises as Yo}from"node:fs";async function Jo(t,e){let r;for(let n=0;n<=zo.length;n+=1)try{return await t()}catch(i){r=i;let o=i.code;if(n===zo.length||!Kg.has(o??""))throw i;await new Promise(s=>setTimeout(s,zo[n]))}throw r}async function Kl(t,e){await Jo(()=>Yo.rename(t,e),`rename ${e}`)}async function On(t){await Jo(()=>Yo.unlink(t),`unlink ${t}`)}async function Gl(t,e){await Jo(()=>Yo.link(t,e),`link ${e}`)}var Kg,zo,Vo=A(()=>{"use strict";Kg=new Set(["EPERM","EACCES","EBUSY","ENOTEMPTY"]),zo=[50,100,200]});import{randomUUID as Gg}from"crypto";import{constants as Hg,promises as I}from"fs";import W from"path";async function Xo(t,e){try{return await Gl(t,e),{linked:!0}}catch(r){let n=r.code;if(n!=="ENOTSUP"&&n!=="EOPNOTSUPP")throw r}return await I.copyFile(t,e,Hg.COPYFILE_EXCL),{linked:!1}}function Xe(t,e){let r=W.relative(t,e);return r===""||!W.isAbsolute(r)&&r!==".."&&!r.startsWith(`..${W.sep}`)}function An(t){return{dev:t.dev,ino:t.ino,birthtime:t.birthtimeMs}}function zg(t,e){return Ie(t,An(e))}function Tn(t,e){return Ie(An(t),An(e))}function Hl(t,e){return Tn(t,e)&&t.birthtimeMs===e.birthtimeMs&&t.ctimeMs===e.ctimeMs&&t.mtimeMs===e.mtimeMs&&t.size===e.size}async function Nn(t){let e=await I.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 I.realpath(t),...An(e)}}async function ge(t){for(let e of t){let r=await I.lstat(e.path);if(!r.isDirectory()||r.isSymbolicLink()||!zg(e,r)||await I.realpath(e.path)!==e.realPath)throw new Error(`Contained atomic write parent changed before commit: ${e.path}`)}}async function Yg(t,e,r){let[n,i]=await Promise.all([I.lstat(t),I.realpath(t),ge(r)]);if(!n.isFile()||n.isSymbolicLink()||!Tn(n,e)||!Xe(r[0].realPath,i))throw new Error("Contained atomic write temporary file changed after close");return n}async function Jg(t,e){let r=W.resolve(t),n=W.resolve(e);if(!Xe(r,n))throw new Error(`Contained atomic write parent is outside its managed root: ${e}`);let i=[await Nn(r)],o=W.relative(r,n).split(W.sep).filter(Boolean),s=r;for(let a of o){await ge(i),s=W.join(s,a);try{await I.mkdir(s)}catch(l){if(l.code!=="EEXIST")throw l}let c=await Nn(s);if(!Xe(i[0].realPath,c.realPath))throw new Error(`Contained atomic write parent resolves outside its managed root: ${s}`);i.push(c)}return await ge(i),i}async function Vg(t,e){let r=W.resolve(t),n=W.resolve(e);if(!Xe(r,n))throw new Error(`Contained file parent is outside its managed root: ${e}`);let i=[await Nn(r)],o=W.relative(r,n).split(W.sep).filter(Boolean),s=r;for(let a of o){s=W.join(s,a);try{let c=await Nn(s);if(!Xe(i[0].realPath,c.realPath))throw new Error(`Contained file parent resolves outside its managed root: ${s}`);i.push(c)}catch(c){if(c.code==="ENOENT")return null;throw c}}return await ge(i),i}async function zl(t){let e;try{e=await I.open(t,"r"),await e.sync()}catch(r){let n=r.code;if(!["EACCES","EBADF","EINVAL","EISDIR","ENOTSUP","EPERM"].includes(n??""))throw r}finally{await e?.close()}}async function Xg(t,e,r){let n=W.dirname(t),i=await Jg(r.containedRoot,n),o=W.join(n,`.${W.basename(t)}.${Gg()}.tmp`),s,a,c;try{await r.beforeTemporaryOpen?.(),s=await I.open(o,"wx"),a=await s.stat();let[l,u]=await Promise.all([I.lstat(o),I.realpath(o)]);if(await ge(i),!l.isFile()||l.isSymbolicLink()||!Tn(a,l)||!Xe(i[0].realPath,u))throw new Error("Contained atomic write temporary file opened outside its managed parent");if(typeof e=="string"?await s.writeFile(e,"utf8"):await s.writeFile(e),await s.sync(),c=await s.stat(),!Tn(a,c))throw new Error("Contained atomic write temporary file changed while writing");if(await s.close(),s=void 0,await r.afterTemporaryClose?.(),!c)throw new Error("Contained atomic write temporary file was not written");c=await Yg(o,c,i),await r.beforeCommit?.(),await ge(i);let f=await I.lstat(o);if(!f.isFile()||f.isSymbolicLink()||!c||!Hl(f,c))throw new Error("Contained atomic write temporary file changed before commit");r.exclusive?(await Xo(o,t),await I.unlink(o)):await Kl(o,t),await zl(n)}catch(l){await s?.close();try{await ge(i),await I.rm(o,{force:!0})}catch{}throw l}}async function X(t,e,r){await Xg(t,e,r)}async function or(t,e){let r=W.dirname(t),n=await Vg(e.containedRoot,r);if(!n)return!1;let i,o;try{i=await I.lstat(t),o=await I.realpath(t)}catch(c){if(c.code==="ENOENT")return!1;throw c}if(!i.isFile()||i.isSymbolicLink()||!Xe(n[0].realPath,o))throw new Error("Contained file removal target must be a regular file inside its managed root");await e.beforeRemove?.(),await ge(n);let[s,a]=await Promise.all([I.lstat(t),I.realpath(t)]);if(!s.isFile()||s.isSymbolicLink()||!Hl(i,s)||a!==o)throw new Error("Contained file removal target changed before removal");return await On(t),await ge(n),await zl(r),!0}var se=A(()=>{"use strict";Vo();Sn()});var Ak,Qo=A(()=>{"use strict";se();$e();V();Ak=16*1024});var In=A(()=>{"use strict";se();he();$e();V();Qo()});import F from"path";function su(t,e){let r=F.relative(t,e);return r===""||!F.isAbsolute(r)&&r!==".."&&!r.startsWith(`..${F.sep}`)}function pw(t,e){let r=F.isAbsolute(e)?F.resolve(e):F.resolve(t,e),n=F.relative(F.resolve(t),r);return n===""||F.isAbsolute(n)||n===".."||n.startsWith(`..${F.sep}`)?null:n.replaceAll("\\","/")}function au(t){return process.platform==="win32"?t.toLowerCase():t}async function os(t,e,r=[]){let n=F.isAbsolute(e)?F.resolve(e):F.resolve(t,e),i=F.resolve(t);if(!su(i,n)||r.some(c=>su(F.resolve(c),n)))return null;let o=pw(t,e);if(!o)return null;let a=(await mw(t)).allow_paths.find(c=>{let l=au(o),u=au(c);return l===u||l.startsWith(`${u}/`)});return a?`${o} (configured Hook allow path: ${a})`:null}var mw,ss=A(()=>{"use strict";Et();$e();mw=ye("hookWritePolicy",async t=>(await Ho(t))?.hook??{allow_paths:[]})});var Dn=A(()=>{"use strict"});var bu=A(()=>{"use strict"});var us=A(()=>{"use strict";Dn()});var ku=A(()=>{"use strict";Dn();us()});function Fw(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}function Bw(t){let e=(0,Cu.parseDocument)(t,{uniqueKeys:!0});if(e.errors.length>0)throw new Error(`Invalid global Comet config: ${e.errors[0].message}`);let r=e.toJS();if(r==null)return{};if(typeof r!="object"||Array.isArray(r))throw new Error("Invalid global Comet config: root must be a mapping");return r}function Eu(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:r,...n})=>n)(t.native):void 0;return{...t,schema:"comet.global.v1",...e?{native:e}:{}}}function Uw(t){let e=Te(JSON.stringify({...t,schema:"comet.project.v1"})).config;if(!e)throw new Error("Invalid global Comet config: workflow template is incomplete");return Eu(e)}function Kw(t){let e=Te(t,{allowPartialProject:!0,allowMissingNativeFields:!0});if(!e.native&&!e.classic)return null;let r=e.native?"native":"classic",n=e.native?.language??e.classic?.language??"en",i=Bo(e.native?.artifact_root??"docs",n);return{schema:"comet.global.v1",default_workflow:r,workflows:[r],ambient_resume:e.ambient_resume,...e.native?{native:{...i.native,...e.native}}:{},...e.classic?{classic:e.classic}:{}}}function _u(t){let e=Bw(t);if(Object.keys(e).length===0)return null;if(e.schema===void 0)return Kw(t);if(e.schema!=="comet.global.v1")throw new Error("Unsupported Comet global schema");return Uw(e)}async function fs(t){try{let e=await j(t,Su,Ye,{label:"global Comet config"});return _u(e.bytes.toString("utf8"))}catch(e){if(Fw(e))return null;throw e}}var Cu,Su,ds=A(()=>{"use strict";Cu=Fe(Oe(),1);se();he();V();Su=".comet/config.yaml"});var BC,xu=A(()=>{"use strict";se();V();BC=4*1024*1024});import Gw from"node:path";function ms(t){return Gw.join(t,".comet","current-change.json")}function Hw(t){return!!t&&typeof t=="object"&&!Array.isArray(t)}function Pu(t){return t===null||typeof t=="string"}function zw(t){let e;try{e=JSON.parse(t)}catch(r){throw new Error(`current change selection contains invalid JSON: ${r instanceof Error?r.message:String(r)}`,{cause:r})}if(!Hw(e))throw new Error("current change selection must be a JSON object");if(e.version===1){if(typeof e.change!="string")throw new Error("legacy current change selection change must be a string");if(e.branch!==void 0&&!Pu(e.branch))throw new Error("legacy current change selection branch must be a string or null");return{selection:{schema:Wn,workflow:"classic",change:e.change,branch:e.branch??null},legacy:!0}}if(e.schema!==Wn)throw new Error(`current change selection schema must be ${Wn}`);if(e.workflow!=="native"&&e.workflow!=="classic")throw new Error("current change selection workflow must be native or classic");if(typeof e.change!="string")throw new Error("current change selection change must be a string");if(!Pu(e.branch))throw new Error("current change selection branch must be a string or null");if(e.workflow==="native"&&e.branch!==null)throw new Error("Native current change selection branch must be null");return{selection:e,legacy:!1}}async function ps(t){let e;try{let n=ms(t),{bytes:i}=await xn(n,Ru,{label:"current change selection"});e=i.toString("utf8")}catch(n){if(n.code==="ENOENT")return{status:"missing"};throw new Error(`cannot read current change selection: ${n instanceof Error?n.message:String(n)}`,{cause:n})}return{status:"selected",...zw(e)}}var Wn,Ru,hs=A(()=>{"use strict";Ko();Wn="comet.selection.v2",Ru=16*1024});var Ou=A(()=>{"use strict";Dn();se();bu();ku();he();ds();V();$e();In();xu();ss();hs();Qo();us()});import{TextDecoder as Xw}from"util";function Au(t){return{dev:t.dev,ino:t.ino,birthtime:t.birthtimeMs}}function Qw(t,e){try{return new Xw("utf-8",{fatal:!0}).decode(t.bytes)}catch(r){throw new Error(`${e} is not valid UTF-8`,{cause:r})}}async function gs(t,e,r,n,i={}){try{let o=await j(t,e,r,{label:n,hooks:i.hooks});return{result:o,text:Qw(o,n)}}catch(o){let s=o.code;if(s==="ENOENT"||s==="ENOTDIR")return null;throw o}}async function Tu(t,e,r,n,i={}){return(await gs(t,e,r,n,i))?.text??null}async function Nu(t,e,r,n,i,o={}){if(Buffer.byteLength(r,"utf8")>n)throw new Error(`${i} exceeds ${n} bytes`);let s=await gs(t,e,n,i),a=await D(t,e,{label:i,expected:"file"});await X(a.target,r,{containedRoot:a.projectRoot,beforeCommit:async()=>{await o.beforeCommit?.();let c=await gs(t,e,n,i);if(!(!s&&!c)){if(!s||!c)throw new Error(`${i} changed before commit`);if(s.result.realPath!==c.result.realPath||!Ie(Au(s.result.stat),Au(c.result.stat))||s.text!==c.text)throw new Error(`${i} changed before commit`)}}})}async function Iu(t,e,r,n={}){let i=await D(t,e,{label:r,expected:"file"});return i.exists?or(i.target,{containedRoot:i.projectRoot,beforeRemove:n.beforeRemove}):!1}var Lu=A(()=>{"use strict";Ou();Sn()});var Wu={};Uf(Wu,{RUN_STATE_FILE:()=>qn,applyRunStateToDocument:()=>$u,readRunState:()=>ws,removeRunState:()=>ys,runStateFromDocument:()=>bt,writeRunState:()=>Mn});import Zw from"path";function fr(t,e){let r=t[e];if(typeof r!="string"||r.length===0)throw new Error(`Invalid Run state: ${e} must be a non-empty string`);return r}function ur(t,e){let r=fr(t,e);if(Zw.isAbsolute(r)||/^(?:[A-Za-z]:|[\\/]|~)/u.test(r)||r.split(/[\\/]/u).includes(".."))throw new Error(`Invalid Run state: ${e} must stay inside the change directory`);return r}function ey(t){let e=t.run_retries??"{}",r;try{r=typeof e=="string"?JSON.parse(e):e}catch(n){throw new Error("Invalid Run state: run_retries must be a JSON object",{cause:n})}if(!r||typeof r!="object"||Array.isArray(r))throw new Error("Invalid Run state: run_retries must be a JSON object");for(let n of Object.values(r))if(!Number.isInteger(n)||Number(n)<0)throw new Error("Invalid Run state: retry counts must be non-negative integers");return r}function bt(t){if(!t.run_id)return null;let e=fr(t,"run_id"),r=fr(t,"skill"),n=fr(t,"skill_version"),i=fr(t,"skill_hash"),o=ur(t,"pending_ref"),s=ur(t,"trajectory_ref"),a=ur(t,"context_ref"),c=ur(t,"artifacts_ref"),l=ur(t,"checkpoint_ref"),u=Number(t.iteration);if(!Number.isInteger(u)||u<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:r,skillVersion:n,skillHash:i,orchestration:t.orchestration,currentStep:ju(t,"current_step"),iteration:u,pending:ju(t,"pending"),pendingRef:o,trajectoryRef:s,contextRef:a,artifactsRef:c,checkpointRef:l,status:t.run_status,retries:ey(t)}}function $u(t,e){e?t.run_id=e.runId:delete t.run_id}function ty(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 ry(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 bt(e)}async function ws(t,e={}){let r=await Tu(t,qn,Du,"Run state",e);if(r===null)return null;let n=JSON.parse(r);return ry(n)}async function Mn(t,e,r={}){await Nu(t,qn,JSON.stringify(ty(e),null,2),Du,"Run state",r)}async function ys(t,e={}){await Iu(t,qn,"Run state",e)}var ju,qn,Du,Fn=A(()=>{"use strict";Lu();ju=(t,e)=>{let r=t[e];return r==null?null:String(r)};qn=".comet/run-state.json",Du=Number.MAX_SAFE_INTEGER});import{promises as Jn}from"fs";import z from"path";function Ds(t){return t.charCodeAt(0)===65279?t.slice(1):t}Et();async function Ms(t=2e3){return process.stdin.isTTY?{text:""}:!Number.isFinite(t)||t<1?{text:null}:process.stdin.readableEnded?{text:""}:await new Promise(e=>{let r=!1,n=0,i=[],o=setTimeout(()=>s({text:null}),Math.ceil(t)),s=f=>{r||(r=!0,clearTimeout(o),process.stdin.removeListener("data",a),process.stdin.removeListener("end",c),process.stdin.removeListener("close",l),process.stdin.removeListener("error",u),process.stdin.pause(),e(f))},a=f=>{let d=Buffer.isBuffer(f)?f:Buffer.from(f),p=1048576-n;if(p<=0){s({text:null});return}let h=d.subarray(0,p);i.push(h),n+=h.length,d.length>h.length&&s({text:null})},c=()=>s({text:Buffer.concat(i,n).toString("utf8")}),l=()=>{process.stdin.readableEnded||s({text:null})},u=()=>s({text:null});process.stdin.on("data",a),process.stdin.once("end",c),process.stdin.once("close",l),process.stdin.once("error",u),o.unref(),process.stdin.resume()})}import{promises as tw}from"fs";import H from"path";import{promises as Gf}from"fs";async function ri(t){try{return await Gf.access(t),!0}catch(e){if(Hf(e))return!1;throw e}}function Hf(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}he();$e();In();V();var wt=class extends Error{code="classic-layout-unavailable";constructor(e="Classic artifact layout is unavailable from .comet/config.yaml"){super(e),this.name="ClassicLayoutUnavailableError"}},Vl=".comet/config.yaml";function rw(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}async function nw(t){await D(t,Vl,{label:Vl,expected:"file"})}function es(t,e){let r=H.resolve(t),n=e==="docs"?H.join(r,"docs"):r,i=H.join(n,"openspec"),o=H.join(r,"docs","superpowers");return{projectRoot:r,artifactLayout:e,openSpecBase:n,openSpecRoot:i,changesDir:H.join(i,"changes"),archiveDir:H.join(i,"changes","archive"),specsDir:H.join(i,"specs"),superpowersRoot:o,superpowersSpecsDir:H.join(o,"specs"),superpowersPlansDir:H.join(o,"plans"),superpowersReportsDir:H.join(o,"reports")}}async function Ql(t){await nw(t);let e=await Ve(t,{allowPartialProject:!0,allowMissingNativeFields:!0});if(!e?.config)throw new wt;if(!(e.config.workflows??[e.config.default_workflow]).includes("classic"))throw new wt("Classic artifact layout is unavailable because Classic is not enabled");return e.classic?.artifact_layout??"legacy"}async function Zl(t,e){return es(t,e??await Ql(t))}async function iw(t){try{return await tw.lstat(t),!0}catch(e){if(rw(e))return!1;throw e}}async function ow(t,e){let r=await Zl(t,e),n=r.artifactLayout==="legacy"?"docs":"legacy",i=es(t,n).openSpecRoot,[o,s]=await Promise.all([D(r.projectRoot,L(r.projectRoot,r.openSpecRoot),{label:"Configured Classic OpenSpec root",expected:"directory"}),iw(i)]),a=o.exists;return{paths:r,configuredRootExists:a,alternateRoot:i,alternateRootExists:s,dualRoots:a&&s}}async function sw(t){let e=[t.openSpecRoot,t.changesDir,t.archiveDir,t.specsDir,t.superpowersRoot,t.superpowersSpecsDir,t.superpowersPlansDir,t.superpowersReportsDir];for(let r of e){let n=L(t.projectRoot,r);await D(t.projectRoot,n,{label:`Classic managed physical path ${n}`,expected:"directory"})}}async function De(t,e){let r=await ow(t,e);if(await sw(r.paths),!r.configuredRootExists){let n=L(r.paths.projectRoot,r.paths.openSpecRoot),i=L(r.paths.projectRoot,r.alternateRoot);throw new wt(`Configured Classic OpenSpec root is missing: ${n} (alternate ${i} is ${r.alternateRootExists?"present":"missing"})`)}return r.paths}async function ts(t,e){let r=H.join(H.resolve(t),".comet","classic-root-move.json");if(await ri(r))throw new Error("Classic root move transaction is incomplete; inspect it with comet doctor and recover it explicitly before writing");let n=await De(t,e);if(!await ri(n.openSpecRoot))throw new Error(`Configured Classic OpenSpec root is missing: ${L(n.projectRoot,n.openSpecRoot)}`);return n}function L(t,e){return H.relative(H.resolve(t),e).replaceAll("\\","/")}import{promises as lw}from"fs";import ar from"path";se();he();V();import sr from"path";var rs=Number.MAX_SAFE_INTEGER;function eu(t,e,r){let n=sr.resolve(t),i=sr.isAbsolute(e)?sr.resolve(e):sr.resolve(n,e),o=sr.relative(n,i).replaceAll("\\","/");return{root:n,relative:gt(o,r),target:i}}async function We(t,e,r){let n=eu(t,e,r.label);return D(n.root,n.relative,r)}async function Qe(t,e,r){return(await We(t,e,{label:r.label,expected:r.expected??"any"})).exists}async function tu(t,e,r,n){return await Qe(t,e,{label:r,expected:"file"})?(await ru(t,e,{label:r,hooks:n})).byteLength>0:!1}async function qe(t,e,r){return(await ru(t,e,r)).toString("utf8")}async function ru(t,e,r){let n=eu(t,e,r.label);return(await j(n.root,n.relative,r.maxBytes??rs,{label:r.label,hooks:r.hooks})).bytes}function jn(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}'
|
|
143
|
-
Valid format: lowercase kebab-case (a-z, 0-9, single hyphens)`:"Change name cannot be empty"}function
|
|
144
|
-
`)}}function vu(t){try{let e=JSON.parse(t);return Number.isSafeInteger(e.pid)&&Number(e.pid)>0&&typeof e.nonce=="string"&&e.nonce.length>0&&typeof e.createdAt=="number"&&Number.isFinite(e.createdAt)&&(e.hostname===void 0||typeof e.hostname=="string"&&e.hostname.length>0)&&(e.processIdentity===void 0||typeof e.processIdentity=="string"&&e.processIdentity.length>0)?{pid:Number(e.pid),nonce:e.nonce,createdAt:e.createdAt,...e.hostname===void 0?{}:{hostname:e.hostname},...e.processIdentity===void 0?{}:{processIdentity:e.processIdentity}}:null}catch{return null}}V();var Un=Fe(Oe(),1);se();V();Fn();var ks=["full","hotfix","tweak"],qu=1,Fu=["open","design","build","verify","archive"],ny=["en","zh-CN"],iy=["off","beta"],oy=["subagent-driven-development","executing-plans","direct","autonomous"],sy=["plan-ready"],ay=["confirmed"],cy=["tdd","direct"],ly=["off","standard","thorough"],uy=["current","branch","worktree"],fy=["light","full"],dy=["pending","pass","fail"],my=["pending","handled"],py=["pending","confirmed"],tt=["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","check_epoch","verification_report","branch_status","created_at","verified_at","archive_confirmation","archived","direct_override","handoff_context","handoff_hash","classic_profile","classic_migration"],dr=["run_id"],Bu=new Set([...tt,...dr]),hy=["workflow","phase","design_doc","plan","build_mode","isolation","verify_mode","verify_result","verified_at","archived"];function vs(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function kt(t,e){let r=t[e];if(r==null||r==="")return null;if(typeof r!="string")throw new Error(`Invalid Classic state: ${e} must be a string or null`);return r}function B(t,e,r,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!="string"||!r.includes(i))throw new Error(`Invalid Classic state: ${e} must be one of ${r.join(", ")}${n?" or null":""}`);return i}function bs(t,e,r=!0){let n=t[e];if(n==null||n===""){if(r)return null;throw new Error(`Invalid Classic state: ${e} is required`)}if(typeof n!="boolean")throw new Error(`Invalid Classic state: ${e} must be true or false`);return n}function Mu(t,e,r=0){let n=t[e];if(n==null||n==="")return r;if(typeof n!="number"||!Number.isSafeInteger(n)||n<0)throw new Error(`Invalid Classic state: ${e} must be a non-negative integer`);return n}function Bn(t,e){let r=kt(t,e);if(r===null)return null;if(/^(?:[A-Za-z]:|[\\/]|~)/u.test(r)||r.split(/[\\/]/u).includes(".."))throw new Error(`Invalid Classic state: ${e} must be a relative repository path`);return r}function gy(t,e){let r=kt(t,e);if(r!==null&&!/^[a-f0-9]{64}$/u.test(r))throw new Error(`Invalid Classic state: ${e} must be a sha256 hex digest`);return r}function wy(t){let e=t.classic_migration;if(e==null||e==="")return null;if(e!==qu)throw new Error(`Invalid Classic state: classic_migration must be ${qu}`);return e}function yy(t){if(!tt.some(r=>vs(t,r)))return null;for(let r of hy)if(!vs(t,r))return null;return{workflow:B(t,"workflow",ks,!1),language:B(t,"language",ny),phase:B(t,"phase",Fu,!1),contextCompression:B(t,"context_compression",iy),buildMode:B(t,"build_mode",oy),buildPause:B(t,"build_pause",sy),subagentDispatch:B(t,"subagent_dispatch",ay),tddMode:B(t,"tdd_mode",cy),reviewMode:B(t,"review_mode",ly),isolation:B(t,"isolation",uy),boundBranch:kt(t,"bound_branch"),verifyMode:B(t,"verify_mode",fy),autoTransition:bs(t,"auto_transition"),baseRef:kt(t,"base_ref"),designDoc:Bn(t,"design_doc"),plan:Bn(t,"plan"),verifyResult:B(t,"verify_result",dy,!1),verifyFailures:Mu(t,"verify_failures"),...vs(t,"check_epoch")?{checkEpoch:Mu(t,"check_epoch")}:{},verificationReport:Bn(t,"verification_report"),branchStatus:B(t,"branch_status",my),createdAt:kt(t,"created_at"),verifiedAt:kt(t,"verified_at"),archiveConfirmation:B(t,"archive_confirmation",py),archived:bs(t,"archived",!1),directOverride:bs(t,"direct_override"),handoffContext:Bn(t,"handoff_context"),handoffHash:gy(t,"handoff_hash"),classicProfile:B(t,"classic_profile",ks),classicMigration:wy(t)}}function Uu(t,e){let r=e??null;if(r===null&&e===void 0&&t.run_id&&t.skill)try{r=bt(t)}catch(n){let i=n instanceof Error?n.message:String(n);throw new Error(i.replace(/^Invalid Run state:/u,"Invalid Classic state:"),{cause:n})}return{classic:yy(t),run:r,unknownKeys:Object.keys(t).filter(n=>!Bu.has(n))}}function Ku(t){let e=t.workflow,r=t.phase,n=t.archived,i=t.design_doc;return{workflow:typeof e=="string"&&ks.includes(e)?e:null,phase:typeof r=="string"&&Fu.includes(r)?r:null,archived:n===!0,designDoc:typeof i=="string"&&i!==""?i:null,unknownKeys:Object.keys(t).filter(o=>!Bu.has(o))}}Fn();var Gu=new vy,Hu=".comet-state-transaction.json";async function Kn(t,e){let r=rt.resolve(t);return Gu.getStore()===r?e():(await D(r,".comet-state.lock",{label:"Classic state lock",expected:"file"}),yu(rt.join(r,".comet-state.lock"),()=>Gu.run(r,async()=>(await ky(r),e()))))}async function zu(t,e){try{return(await j(t,e,Number.MAX_SAFE_INTEGER,{label:"Classic state transaction"})).bytes.toString("utf8")}catch(r){if(r.code==="ENOENT")return null;throw r}}function by(t){if(t===null)return null;if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Invalid Classic transaction Run");let e=t,r=bt({run_id:e.runId,skill:e.skill,skill_version:e.skillVersion,skill_hash:e.skillHash,orchestration:e.orchestration,current_step:e.currentStep,iteration:e.iteration,pending:e.pending,pending_ref:e.pendingRef,trajectory_ref:e.trajectoryRef,context_ref:e.contextRef,artifacts_ref:e.artifactsRef,checkpoint_ref:e.checkpointRef,run_status:e.status,run_retries:e.retries});if(!r)throw new Error("Invalid Classic transaction Run identity");return r}async function ky(t){let e=await zu(t,Hu);if(e===null)return;let r=JSON.parse(e);if(!r||r.schema!=="comet.classic.state-transaction.v1"||r.beforeYaml!==null&&typeof r.beforeYaml!="string"||typeof r.afterYaml!="string")throw new Error("Invalid Classic state transaction");let n=await zu(t,".comet.yaml");if(n!==r.beforeYaml&&n!==r.afterYaml)throw new Error("Classic state transaction conflicts with current YAML; preserve files for recovery");let i=by(n===r.afterYaml?r.afterRun:r.beforeRun);i?await Mn(t,i):await ys(t),await or(rt.join(t,Hu),{containedRoot:t})}function mr(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 Cy(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 r of e)t.delete(r)}function Sy(t){let e=!1;for(let r of["build_command","verify_command"])t.has(r)&&(t.delete(r),e=!0);return e}async function Yu(t){let e;try{e=(await j(rt.dirname(t),rt.basename(t),Number.MAX_SAFE_INTEGER,{label:"Classic state document"})).bytes.toString("utf8")}catch(n){if(n.code!=="ENOENT")throw n;return new Un.Document({})}let r=(0,Un.parseDocument)(e);if(r.errors.length>0)throw new Error(`Invalid Classic state document: ${r.errors[0].message}`);return mr(r),r}async function pr(t,e={}){return Kn(t,()=>Ey(t,e))}async function Ey(t,e){let r=e.migrate!==!1,n=rt.join(t,".comet.yaml"),i=await Yu(n),o=mr(i),s=Sy(i);s&&(o=mr(i));let a=await ws(t);if(!a&&o.run_id&&o.skill){let{runStateFromDocument:c}=await Promise.resolve().then(()=>(Fn(),Wu));a=c(o),a&&r&&(await Mn(t,a),Cy(i),s=!0)}return s&&r&&await X(n,i.toString(),{containedRoot:t}),Uu(mr(i),a)}async function Ju(t){let e=await Yu(rt.join(t,".comet.yaml"));return Ku(mr(e))}se();V();function xy(t){try{let e=Xu("git",["rev-parse","--abbrev-ref","HEAD"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"],timeout:1e4,windowsHide:!0}).trim();return e&&e!=="HEAD"?e:null}catch{return null}}var Py=ti("liveGitBranch",t=>xy(t));function Ry(t){try{return Xu("git",["rev-parse","--is-inside-work-tree"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"],timeout:1e4,windowsHide:!0}).trim()==="true"}catch{return!1}}var Oy=ti("isGitWorkTree",t=>Ry(t)),Ay=["current","branch","worktree"];function Zu(t){return Ay.includes(t)}function Ty(t){return Zu(t.isolation)?t.boundBranch===null&&t.currentBranch===null&&t.gitWorkTree===!1?{status:"not-applicable"}:t.boundBranch===null?t.currentBranch===null?{status:"unbound-detached"}:{status:"needs-heal",branch:t.currentBranch}:t.currentBranch===t.boundBranch?{status:"ok"}:{status:"drift",boundBranch:t.boundBranch,currentBranch:t.currentBranch}:{status:"not-applicable"}}async function hr(t,e){return e.heal?Kn(t,()=>Vu(t,e)):Vu(t,e)}async function Vu(t,e){let r=Qu.join(t,".comet.yaml"),n=(0,Cs.parseDocument)(await _y.readFile(r,"utf8"),{uniqueKeys:!1});if(n.errors.length>0)throw new Error(`Invalid .comet.yaml: ${n.errors[0].message}`);let i=n.toJS()??{},o=typeof i.isolation=="string"?i.isolation:null,s=typeof i.bound_branch=="string"&&i.bound_branch!==""?i.bound_branch:null,a=Zu(o),c=Py(e.cwd),l=a&&s===null&&c===null?Oy(e.cwd):!0,u=Ty({isolation:o,boundBranch:s,currentBranch:c,gitWorkTree:l});return u.status==="needs-heal"&&e.heal?(await Ny(t,u.branch),{status:"healed",branch:u.branch,bindingRequired:a,currentBranch:c}):{...u,bindingRequired:a,currentBranch:c}}async function Ny(t,e){return Kn(t,()=>Iy(t,e))}async function Iy(t,e){let r=Qu.join(t,".comet.yaml"),n=(await j(t,".comet.yaml",rs,{label:"Classic branch binding"})).bytes.toString("utf8"),i=(0,Cs.parseDocument)(n,{uniqueKeys:!1});if(i.errors.length)throw new Error(`Invalid .comet.yaml: ${i.errors[0].message}`);i.set("bound_branch",e),await X(r,i.toString(),{containedRoot:t})}function Ly(t){return t??"detached HEAD"}function gr(t,e,r){return`change '${t}' is bound to branch '${e}', but current branch is '${Ly(r)}'. Next: switch to branch '${e}' and rerun, or run comet state rebind ${t} after the user explicitly confirms this branch should take over the change`}function wr(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.`}hs();Et();var of=Fe(Oe(),1);import ce from"node:path";import{createHash as zn,randomUUID as fE}from"node:crypto";var jy=new Set(["GIT_DIR","GIT_WORK_TREE","GIT_COMMON_DIR","GIT_INDEX_FILE","GIT_OBJECT_DIRECTORY","GIT_ALTERNATE_OBJECT_DIRECTORIES","GIT_GRAFT_FILE","GIT_SHALLOW_FILE","GIT_PREFIX","GIT_IMPLICIT_WORK_TREE","GIT_NO_REPLACE_OBJECTS","GIT_REPLACE_REF_BASE","GIT_CONFIG","GIT_CONFIG_PARAMETERS","GIT_CONFIG_COUNT"]);function $y(t=process.env){return Object.fromEntries(Object.entries(t).filter(([e])=>{let r=e.toUpperCase();return!jy.has(r)&&!/^GIT_CONFIG_(KEY|VALUE)_\d+$/u.test(r)}))}function ef(t){return{...$y(t.environment),...t.authentication?{}:{GIT_CONFIG_GLOBAL:process.platform==="win32"?"NUL":"/dev/null",GIT_CONFIG_NOSYSTEM:"1"},GIT_TERMINAL_PROMPT:"0",GCM_INTERACTIVE:"never",SSH_ASKPASS_REQUIRE:"never",GIT_NO_REPLACE_OBJECTS:"1",GH_PROMPT_DISABLED:"1"}}function nt(t){if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Classic progress requires a JSON object");return t}function Es(t,e){let r=Object.keys(t).filter(n=>!e.includes(n));if(r.length)throw new Error(`Unknown Classic progress field(s): ${r.join(", ")}; allowed fields: ${e.join(", ")}`)}function ae(t,e){if(typeof t!="string"||!t.trim()||t.length>4096||[...t].some(r=>r.charCodeAt(0)<32||r.charCodeAt(0)===127))throw new Error(`Invalid Classic progress ${e}`);return t}async function Dy(t,e,r){let n=ce.join(e,".comet",r);if(await Qe(t,n,{label:"Classic progress",expected:"file"}))return JSON.parse(await qe(t,n,{label:"Classic progress"}))}function Wy(t,e){let r=zn("sha256").update(e).digest("hex");return ce.join(t,".comet","runtime","classic-delivery",`${r}.json`)}async function qy(t,e){let r=Wy(t,e);if(!await Qe(t,r,{label:"Classic delivery reauthorization",expected:"file"}))return null;let n=nt(JSON.parse(await qe(t,r,{label:"Classic delivery reauthorization"})));if(Es(n,["schemaVersion","changeIdentity","previousAuthorizationId","authorizationId","action","targetBranch","remote","authorizedRemoteUrl"]),n.schemaVersion!==1||n.changeIdentity!==e)throw new Error("Classic delivery reauthorization identity is invalid");let i=_s({action:n.action,targetBranch:n.targetBranch,...n.remote===void 0?{}:{remote:n.remote}},!0);if(i.commit!==void 0||i.prUrl!==void 0)throw new Error("Classic delivery reauthorization cannot change sealed commit or PR evidence");return{schemaVersion:1,changeIdentity:e,previousAuthorizationId:ae(n.previousAuthorizationId,"previousAuthorizationId"),authorizationId:ae(n.authorizationId,"authorizationId"),...i,...n.authorizedRemoteUrl===void 0?{}:{authorizedRemoteUrl:ae(n.authorizedRemoteUrl,"authorizedRemoteUrl")}}}function _s(t,e=!1){let r=nt(t);if(Es(r,["action","targetBranch","remote","commit","prUrl",...e?["schemaVersion","changeIdentity","authorizedRemoteUrl","authorizationId"]:[]]),!["local","push","pr"].includes(r.action))throw new Error(`Invalid Classic delivery action '${String(r.action)}'; actions: local|push|pr`);let n=ae(r.targetBranch,"targetBranch");if(n.startsWith("-")||/[~^:?*[\\\s]/u.test(n)||n.includes("..")||n.includes("@{"))throw new Error("Invalid Classic delivery targetBranch");let i={action:r.action,targetBranch:n};if(r.remote!==void 0){let o=ae(r.remote,"remote");if(!/^[a-zA-Z0-9][a-zA-Z0-9._-]{0,99}$/u.test(o))throw new Error("Classic delivery remote must be a name, not a URL");i.remote=o}if(r.commit!==void 0){let o=ae(r.commit,"commit");if(!/^(?:[a-fA-F0-9]{40}|[a-fA-F0-9]{64})$/u.test(o))throw new Error("Classic delivery commit must be a full object ID");i.commit=o.toLowerCase()}if(r.prUrl!==void 0){let o=ae(r.prUrl,"prUrl"),s=new URL(o);if(s.protocol!=="https:"||s.username||s.password)throw new Error("Invalid Classic delivery prUrl");i.prUrl=o}return i}function sf(t){let e=(0,of.parseDocument)(t,{uniqueKeys:!0});if(e.errors.length)throw new Error("Invalid Classic delivery change state");return nt(e.toJS())}function af(t,e){if(typeof t.run_id=="string"&&t.run_id)return`run:${t.run_id}`;let r=t.archived===!0?ce.basename(e).replace(/^\d{4}-\d{2}-\d{2}-/u,""):ce.basename(e);if(typeof t.created_at!="string"||typeof t.base_ref!="string")throw new Error("Classic delivery requires stable change identity");return`legacy:${zn("sha256").update(JSON.stringify([r,t.created_at,t.base_ref])).digest("hex")}`}async function My(t,e){return sf(await qe(t,ce.join(e,".comet.yaml"),{label:"Classic delivery state"}))}var Hn=class extends Error{constructor(e,r){super(`Classic delivery git command timed out: ${[e,...r].join(" ")}`)}};function Ss(t,e,r,n){return vt(e,r,{cwd:t,timeoutMs:5e3,env:ef({authentication:n})}).trim()}function br(t,e,r,n=!1){try{return Ss(t,e,r,n)}catch{return null}}function Fy(t,e,r,n=!1){try{return Ss(t,e,r,n)}catch(i){if(!(i instanceof yt)||!i.timedOut)return null;try{return Ss(t,e,r,n)}catch(o){if(o instanceof yt&&o.timedOut)throw new Hn(e,r);return null}}}function yr(t,e){return br(t,"git",["-C",t,...e])}function vr(t,e){return Fy(t,"git",["-C",t,...e])}function tf(t,e,r=!1){return br(t,"git",["-C",t,"remote","get-url",...r?["--push"]:[],e],!0)}function By(t,e){let r=ce.relative(t,e).replaceAll("\\","/");return[`:(literal)${r}`,...[".comet-state.lock",".comet-state-transaction.json"].map(n=>`:(exclude,literal)${r}/${n}`)]}function rf(t,e,r,n){let i=ce.relative(t,e).replaceAll("\\","/"),o=By(t,e),s=vr(t,["show",`${r}:${i}/.comet.yaml`]);if(!s)return!1;try{let a=sf(s);return a.archived===!0&&af(a,e)===n&&vr(t,["merge-base","--is-ancestor",r,"HEAD"])!==null&&vr(t,["diff","--quiet","--no-ext-diff","--no-textconv",r,"--",...o])!==null&&vr(t,["ls-files","--others","--exclude-standard","--",...o])===""}catch(a){if(a instanceof Hn)throw a;return!1}}function Uy(t,e){let r=`${zn("sha256").update(e).digest("hex")}.json`,n=vr(t,["rev-parse","--path-format=absolute","--git-common-dir"]);return[{root:t,file:ce.join(t,".comet","classic-deliveries",r)},...n?[{root:n,file:ce.join(n,"comet","classic-deliveries",r)}]:[]]}async function Ky(t,e){let r=null;for(let n of Uy(t,e)){if(!await Qe(n.root,n.file,{label:"Classic delivery receipt",expected:"file"}))continue;let i=nt(JSON.parse(await qe(n.root,n.file,{label:"Classic delivery receipt"})));if(Es(i,["schemaVersion","changeIdentity","authorizationId","invalidated","commit","prUrl"]),i.schemaVersion!==1||i.changeIdentity!==e)throw new Error("Invalid Classic delivery receipt schema or identity");if(i.invalidated!==void 0&&typeof i.invalidated!="boolean")throw new Error("Invalid Classic delivery receipt invalidation");let o=_s({action:"local",targetBranch:"main",...i.commit!==void 0?{commit:i.commit}:{},...i.prUrl!==void 0?{prUrl:i.prUrl}:{}}),s={schemaVersion:1,changeIdentity:e,authorizationId:ae(i.authorizationId,"authorizationId"),...i.invalidated===!0?{invalidated:!0}:{},...o.commit?{commit:o.commit}:{},...o.prUrl?{prUrl:o.prUrl}:{}};if(r&&JSON.stringify(r)!==JSON.stringify(s))throw new Error("Conflicting Classic delivery receipts");r=s}return r}function Gy(t){return t.authorizationId===void 0?`legacy:${zn("sha256").update(JSON.stringify(t)).digest("hex")}`:ae(t.authorizationId,"authorizationId")}function nf(t,e,r){return e===r||yr(t,["merge-base","--is-ancestor",e,r])!==null}function Hy(t){let e=/^git@([^:/]+):([^/]+\/[^/]+)$/u.exec(t);try{let r=new URL(e?`ssh://git@${e[1]}/${e[2]}`:t);if(!["https:","ssh:"].includes(r.protocol)||r.password||r.search||r.hash||r.port||r.protocol==="https:"&&r.username)return null;let n=r.pathname.replace(/\.git\/?$/u,"").replace(/\/$/u,"").split("/").filter(Boolean);return n.length!==2||n.some(i=>!/^[a-zA-Z0-9_.-]+$/u.test(i))?null:`${r.hostname}/${n.join("/")}`.toLowerCase()}catch{return null}}function Gn(t,e){try{let r=new URL(t);if(r.protocol!=="https:"||r.username||r.password||r.port||r.search||r.hash)return null;let n=/^\/([^/]+)\/([^/]+)\/pull\/([1-9]\d*)\/?$/u.exec(r.pathname);return n&&`${r.hostname}/${n[1]}/${n[2]}`.toLowerCase()===e?`https://${r.hostname}/${n[1]}/${n[2]}/pull/${n[3]}`:null}catch{return null}}async function xs(t,e,r={}){let n=await Dy(t,e,"delivery.json");if(n===void 0)return{delivery:null,verification:{status:"needsAuthorization"}};let i=nt(n);if(i.schemaVersion!==1)throw new Error("Unsupported Classic delivery schemaVersion");let o=_s(i,!0),s=await My(t,e),a=af(s,e);if(i.changeIdentity!==a)throw new Error("Classic delivery change identity mismatch");let c=Gy(i),l=await qy(t,a);if(l&&l.previousAuthorizationId!==c)throw new Error("Classic delivery reauthorization is stale for the sealed authorization");let u=l?{action:l.action,targetBranch:l.targetBranch,...l.remote===void 0?{}:{remote:l.remote}}:o,f=l?.authorizationId??c,d=await Ky(t,a),p=d?.authorizationId===f?d:null;if(p?.invalidated)return{delivery:null,verification:{status:"needsAuthorization",invalidated:!0}};for(let M of["commit","prUrl"]){if(M==="commit"&&p?.[M]&&u[M]&&p[M]!==u[M])throw new Error("Classic delivery receipt conflicts with authorization evidence");p?.[M]&&(u[M]=p[M])}let h=i.authorizedRemoteUrl===void 0?void 0:ae(i.authorizedRemoteUrl,"authorizedRemoteUrl"),m=l?.authorizedRemoteUrl??h,g={...u,schemaVersion:1,changeIdentity:a,authorizationId:f,...m?{authorizedRemoteUrl:m}:{}},v=yr(t,["symbolic-ref","--quiet","--short","HEAD"]),b=ce.relative(t,e).replaceAll("\\","/"),k=null;!u.commit&&s.archived===!0&&(k=yr(t,["log","-20","--format=%H","HEAD","--",`:(literal)${b}/.comet.yaml`])?.split(/\r?\n/u).find(we=>/^[a-f0-9]{40,64}$/u.test(we)&&rf(t,e,we,a))??null);let C=u.commit??k,S=!!C&&yr(t,["cat-file","-t",C])==="commit",E=s.archived===!0&&S&&rf(t,e,C,a),P=v===u.targetBranch&&(!s.bound_branch||l!==null||s.bound_branch===v)&&E,y=!1,O=!1,te=null,le=r.verifyRemote&&u.action!=="local"?"unavailable":"notChecked",R="notChecked";if(r.verifyRemote&&P&&u.action!=="local"&&u.remote&&m&&tf(t,u.remote)===m&&tf(t,u.remote,!0)===m){let M=`refs/heads/${u.targetBranch}`,we=br(t,"git",["-C",t,"-c","protocol.allow=never","-c","protocol.https.allow=always","-c","protocol.ssh.allow=always","-c","protocol.file.allow=always","ls-remote","--refs",u.remote,M],!0),Ls=we?.split(/\r?\n/u)??[],js=Ls.length===1?/^([a-f0-9]{40}|[a-f0-9]{64})\t(.+)$/u.exec(Ls[0]):null,St=js?.[2]===M?js[1]:null;y=!!C&&!!St&&nf(t,C,St),le=y?"verified":we===""?"missing":we===null||!St||yr(t,["cat-file","-t",St])!=="commit"?"unavailable":"missing";let ue=Hy(m),Vn=ue&&u.prUrl?Gn(u.prUrl,ue):null,Xn=y||we==="",$s=Y=>Y.headRefName===u.targetBranch&&typeof Y.headRefOid=="string"&&/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/u.test(Y.headRefOid)&&(y?Y.headRefOid===St&&["OPEN","MERGED"].includes(Y.state):we===""&&Y.state==="MERGED"&&!!C&&nf(t,C,Y.headRefOid));if(Xn&&u.action==="pr"&&(R="unavailable"),Xn&&u.action==="pr"&&Vn&&ue){let Y=br(t,"gh",["pr","view",Vn,"--repo",ue,"--json","url,headRefName,headRefOid,state"],!0);try{let fe=Y?nt(JSON.parse(Y)):null;O=!!fe&&typeof fe.url=="string"&&Gn(fe.url,ue)===Vn&&$s(fe),R=O?"verified":fe?"missing":"unavailable"}catch{O=!1,R="unavailable"}}else if(Xn&&u.action==="pr"&&!u.prUrl&&ue){let Y=br(t,"gh",["pr","list","--repo",ue,"--head",u.targetBranch,"--state","all","--json","url,headRefName,headRefOid,state","--limit","100"],!0);try{let fe=Y===null?null:JSON.parse(Y);if(!Array.isArray(fe)||fe.length>=100)throw new Error("Incomplete PR discovery");let Qn=fe.map(nt).filter(Zn=>typeof Zn.url=="string"&&Gn(Zn.url,ue)&&$s(Zn));Qn.length===1?(te=Gn(Qn[0].url,ue),O=!0,R="verified"):R=Qn.length===0?"missing":"unavailable"}catch{R="unavailable"}}}return{delivery:g,verification:{status:P&&(u.action==="local"||(u.action==="push"?y:O))?"complete":"needsVerification",currentBranch:v,commitExists:S,archiveCommitted:E,observedCommit:k,observedPrUrl:te,remoteVerified:y,prVerified:O,remoteStatus:le,prStatus:R}}}var zy=Fe(Oe(),1);var bE=8*1024*1024;$e();In();V();he();se();var Yy=ye("readCometCurrentSelection",t=>ps(t));async function Jy(t,e){cr(e);let r=await Ze(e,t);if(!r.stateExists)throw new Error(`Cannot select current change '${e}': active change state not found`);let n=await pr(r.directory,{migrate:!1});if(!n.classic)throw new Error(`Cannot select current change '${e}': Classic state is incomplete`);if(n.classic.archived)throw new Error(`Cannot select current change '${e}': change is archived`);return r.directory}async function cf(t){let e;try{e=await Yy(t)}catch(o){return{status:"stale",reason:o instanceof Error?o.message:String(o)}}if(e.status==="missing")return{status:"missing"};if(e.selection.workflow!=="classic")return{status:"stale",reason:`current change '${e.selection.change}' belongs to Native, not Classic`};let r=e.selection,n;try{n=await Jy(t,r.change)}catch(o){try{let s=await ns(r.change,t);if(!s)throw o;let a=await pr(s.directory,{migrate:!1}),c=await xs(t,s.directory);if(!a.classic?.archived||["complete","local-verified"].includes(c.verification.status))throw o;n=s.directory}catch(s){return{status:"stale",reason:s instanceof Error?s.message:String(s)}}}let i=await hr(n,{heal:!1,cwd:t});return i.status==="drift"?{status:"stale",reason:gr(r.change,i.boundBranch,i.currentBranch)}:i.status==="unbound-detached"?{status:"stale",reason:wr(r.change)}:i.status==="ok"?{status:"selected",selection:r}:r.branch!==null&&i.currentBranch!==r.branch?{status:"stale",reason:`current change '${r.change}' was selected on branch '${r.branch}', current branch is '${i.currentBranch??"detached HEAD"}'`}:{status:"selected",selection:r}}function Ps(t){return t==="zh-CN"?"zh-CN":"en"}function lf(t,e,r){return t==="zh-CN"?r:e}function uf(t,e){let n={open:{en:"Source code edits are paused while the request is still being clarified.",zh:"需求仍在澄清中,暂时不修改源代码。"},design:{en:"Source code edits are paused until the design is agreed and recorded.",zh:"方案确定并记录之前,暂不修改源代码。"},build:{en:"A required design or plan record is missing, so source edits stay paused.",zh:"缺少必需的设计或计划记录,源代码修改暂被搁置。"},verify:{en:"Implementation edits are paused during verification; only verification output is accepted.",zh:"验证期间暂停修改实现,仅接受验证产出。"},archive:{en:"Source code edits are paused while the change is being archived.",zh:"归档期间暂不修改源代码。"}}[t]??{en:"This write is paused by the current workflow stage.",zh:"当前工作流阶段暂不允许这次写入。"};return{summary:lf(e,"This write was blocked on purpose, not by an error.","这次写入是被有意拦下的,不是发生了错误。"),user_message:lf(e,n.en,n.zh)}}function ff(t){if(t.workflow!=="full")return{missingFields:[],invalidFields:[]};let e=[],r=[];return t.buildMode||e.push("build_mode"),t.tddMode||e.push("tdd_mode"),t.reviewMode||e.push("review_mode"),t.buildMode==="subagent-driven-development"&&t.subagentDispatch!=="confirmed"&&e.push("subagent_dispatch"),t.buildMode==="autonomous"&&t.reviewMode==="off"&&r.push({field:"review_mode",reason:"autonomous full build requires review_mode=standard or thorough"}),t.buildMode==="direct"&&t.directOverride!==!0&&r.push({field:"direct_override",reason:"full workflow direct execution requires direct_override=true"}),{missingFields:e,invalidFields:r}}var df=Fe(Oe(),1);import it from"node:path";async function Rs(t,e,r,n={}){if(r.workflow!=="full"||r.buildMode!=="autonomous")return[];let i=[];if(n.requirePlan!==!1){let o=ff(r);o.missingFields.includes("tdd_mode")&&i.push("tdd_mode must be selected for autonomous full build"),o.missingFields.includes("review_mode")&&i.push("review_mode must be selected for autonomous full build"),o.invalidFields.some(({field:s})=>s==="review_mode")&&i.push("review_mode must be standard or thorough for autonomous full build"),r.isolation||i.push("isolation must be selected for autonomous full build")}if(!r.designDoc||!await tu(t,r.designDoc,"Classic autonomous design"))i.push("design_doc must reference a nonempty technical design for autonomous full build");else{let s=(await qe(t,r.designDoc,{label:"Classic autonomous design"})).replace(/^\uFEFF/u,"").match(/^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/u),a=s?(0,df.parseDocument)(s[1]):null;(!a||a.errors.length||a.get("comet_change")!==e||a.get("role")!=="technical-design"||a.get("canonical_spec")!=="openspec")&&i.push("design_doc must link the current change and declare role: technical-design and canonical_spec: openspec")}return n.requirePlan!==!1&&(await Os(t,r.plan,{requireNonempty:!0})).status!=="ready"&&i.push("plan must reference a nonempty implementation plan in the configured plans directory"),i}async function Os(t,e,r={}){if(!e||e==="null")return{status:"missing",recordedPath:null};let n=await De(t),i=it.resolve(t,e),o=it.relative(n.superpowersPlansDir,i);return it.isAbsolute(e)||!o||o.startsWith(`..${it.sep}`)||it.isAbsolute(o)||o.includes(it.sep)||it.extname(o).toLowerCase()!==".md"?{status:"broken",recordedPath:e}:await Qe(t,e,{label:`Classic build plan ${e}`,expected:"file"})&&(!r.requireNonempty||(await qe(t,e,{label:`Classic build plan ${e}`})).trim().length>0)?{status:"ready",recordedPath:e}:{status:"broken",recordedPath:e}}var Vy=new Set([".md",".markdown"]),Xy=new Set([".md",".markdown",".rst",".txt"]),Qy=new Set(["docs","doc","documentation",".github"]),Zy=[/^LICENSE(?:[.-]|$)/u,/^NOTICE$/u,/^AUTHORS$/u];function mf(t){return t.replaceAll("\\","/").replace(/^\.\//u,"")}function ev(t,e){for(let r of e){let n=mf(r).replace(/\/+$/u,"");if(n&&(t===n||t.startsWith(`${n}/`)))return!0}return!1}function pf(t,e=[]){let r=mf(t);if(!r||r.endsWith("/")||ev(r,e))return!1;let n=r.split("/"),i=n[n.length-1],o=i.lastIndexOf("."),s=o===-1?"":i.slice(o).toLowerCase();return n.length===1?Vy.has(s)||Zy.some(a=>a.test(i)):Qy.has(n[0])&&Xy.has(s)}ds();$e();import tv from"os";import Yn from"path";function rv(t={}){let e=t.cwd??process.cwd(),r=t.homeDir??tv.homedir(),n=[{file:Yn.resolve(e,".comet","config.yaml"),source:".comet/config.yaml",scope:"project"},{file:Yn.resolve(r,".comet","config.yaml"),source:"~/.comet/config.yaml",scope:"global"}];return n.filter((i,o)=>n.findIndex(s=>s.file===i.file)===o)}async function hf(t,e={}){for(let r of rv(e)){let n=Yn.dirname(Yn.dirname(r.file)),i=r.scope==="global"?(await fs(n))?.classic:(await Ve(n,{allowPartialProject:!0}))?.value.classic;if(!i||typeof i!="object"||Array.isArray(i))continue;let o=i[t];if(o!=null)return{value:String(o),source:r.source}}return null}async function nv(t){let e=await hf("document_evidence",{cwd:t});if(!e)return"neutral";if(e.value==="neutral"||e.value==="strict")return e.value;throw new Error(`classic.document_evidence must be neutral or strict, got '${e.value}' (${e.source})`)}function iv(t,e){return[L(t,e.openSpecRoot),L(t,e.superpowersRoot)]}async function gf(t,e,r){return await nv(t)==="strict"?!1:pf(r,iv(t,e))}function q(t,e){return{exitCode:t,stderr:e+`
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
142
|
+
`,r)+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 r=_n(e),n=bt(r);return n.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let r=_n(e),n=bt(r);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,r){return this.type!=="comment"||this.indent<=r?!1:e.every(n=>n.type==="newline"||n.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())}}};Dl.Parser=Jo});var Ul=w(sr=>{"use strict";var ql=$o(),Eg=Xt(),or=er(),_g=Ni(),xg=_(),Pg=zo(),Ml=Yo();function Fl(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new Pg.LineCounter||null,prettyErrors:e}}function Rg(t,e={}){let{lineCounter:r,prettyErrors:n}=Fl(e),i=new Ml.Parser(r?.addNewLine),o=new ql.Composer(e),s=Array.from(o.compose(i.parse(t)));if(n&&r)for(let a of s)a.errors.forEach(or.prettifyError(t,r)),a.warnings.forEach(or.prettifyError(t,r));return s.length>0?s:Object.assign([],{empty:!0},o.streamInfo())}function Bl(t,e={}){let{lineCounter:r,prettyErrors:n}=Fl(e),i=new Ml.Parser(r?.addNewLine),o=new ql.Composer(e),s=null;for(let a of o.compose(i.parse(t),!0,t.length))if(!s)s=a;else if(s.options.logLevel!=="silent"){s.errors.push(new or.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return n&&r&&(s.errors.forEach(or.prettifyError(t,r)),s.warnings.forEach(or.prettifyError(t,r))),s}function Og(t,e,r){let n;typeof e=="function"?n=e:r===void 0&&e&&typeof e=="object"&&(r=e);let i=Bl(t,r);if(!i)return null;if(i.warnings.forEach(o=>_g.warn(i.options.logLevel,o)),i.errors.length>0){if(i.options.logLevel!=="silent")throw i.errors[0];i.errors=[]}return i.toJS(Object.assign({reviver:n},r))}function Ag(t,e,r){let n=null;if(typeof e=="function"||Array.isArray(e)?n=e:r===void 0&&e&&(r=e),typeof r=="string"&&(r=r.length),typeof r=="number"){let i=Math.round(r);r=i<1?void 0:i>8?{indent:8}:{indent:i}}if(t===void 0){let{keepUndefined:i}=r??e??{};if(!i)return}return xg.isDocument(t)&&!n?t.toString(r):new Eg.Document(t,n,r).toString(r)}sr.parse=Og;sr.parseAllDocuments=Rg;sr.parseDocument=Bl;sr.stringify=Ag});var Ie=w(x=>{"use strict";var Tg=$o(),Ng=Xt(),Ig=ho(),Vo=er(),Lg=$t(),Ne=_(),$g=Pe(),jg=T(),Wg=Oe(),Dg=Ae(),qg=Sn(),Mg=Ko(),Fg=zo(),Bg=Yo(),Pn=Ul(),Gl=Tt();x.Composer=Tg.Composer;x.Document=Ng.Document;x.Schema=Ig.Schema;x.YAMLError=Vo.YAMLError;x.YAMLParseError=Vo.YAMLParseError;x.YAMLWarning=Vo.YAMLWarning;x.Alias=Lg.Alias;x.isAlias=Ne.isAlias;x.isCollection=Ne.isCollection;x.isDocument=Ne.isDocument;x.isMap=Ne.isMap;x.isNode=Ne.isNode;x.isPair=Ne.isPair;x.isScalar=Ne.isScalar;x.isSeq=Ne.isSeq;x.Pair=$g.Pair;x.Scalar=jg.Scalar;x.YAMLMap=Wg.YAMLMap;x.YAMLSeq=Dg.YAMLSeq;x.CST=qg;x.Lexer=Mg.Lexer;x.LineCounter=Fg.LineCounter;x.Parser=Bg.Parser;x.parse=Pn.parse;x.parseAllDocuments=Pn.parseAllDocuments;x.parseDocument=Pn.parseDocument;x.stringify=Pn.stringify;x.visit=Gl.visit;x.visitAsync=Gl.visitAsync});import Le from"path";function zg(t,e){if(typeof t!="string")throw new Error(`${e} must be a string`);let r=t.trim();if(r.length===0||Le.posix.isAbsolute(r)||Le.win32.isAbsolute(r)||/^(?:~|[\\/])/u.test(r))throw new Error(`${e} must be a project-relative path`);if(r===".")return[];let n=r.replaceAll("\\","/").split("/");if(n.some(i=>i===".."))throw new Error(`${e} must stay inside the project root`);if(n.some(i=>i===""||i==="."))throw new Error(`${e} must not contain empty or dot path segments`);return n}function cr(t){let e=zg(t,"native.artifact_root");return e.length===0?".":e.join("/")}function Zl(t,e="docs"){let r=t??e;if(r!=="legacy"&&r!=="docs")throw new Error("classic.artifact_layout must be legacy or docs");return r}function kt(t,e,r=!1){if(typeof t!="string")throw new Error(`${e} must be a string`);let n=t.trim().replaceAll("\\","/");if(n.length===0||Le.posix.isAbsolute(n)||Le.win32.isAbsolute(n)||/^(?:~|[\\/])/u.test(n))throw new Error(`${e} must be relative to its declared path base`);let i=n.split("/");if(i.some(o=>o===".."))throw new Error(`${e} must stay inside its declared path base`);if(i.some(o=>o===""||o==="."))throw new Error(`${e} must not contain empty or dot path segments`);if(!r&&/[*?]/u.test(n))throw new Error(`${e} cannot contain wildcards`);return i.join("/")}function ge(t,e){if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`${e} must be a mapping`);return t}function eu(t,e,r){let n=t??e;if(n!=="en"&&n!=="zh-CN")throw new Error(`${r} must be en or zh-CN`);return n}function tu(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>Xo)throw new Error(`${e} exceeds ${Xo} characters`);let r=0;for(let n=0;n<t.length;n+=1)t[n]==="?"?r+=1:t[n]==="*"&&(r+=1,t[n+1]==="*"&&(n+=1));if(r>Qo)throw new Error(`${e} contains more than ${Qo} wildcard tokens`);return t}function Yl(t,e,r){if(t===void 0)return[...r];if(!Array.isArray(t))throw new Error(`${e} contains an unsafe pattern`);return[...new Set(t.map(n=>tu(n,e)))].sort((n,i)=>n.localeCompare(i,"en"))}function ar(t,e,r){let n=t??e;if(!Number.isSafeInteger(n)||n<1)throw new Error(`${r} must be a positive integer`);return n}function Vl(t,e,r){let n=ar(t,e,r);if(n>Math.floor(Number.MAX_SAFE_INTEGER/(1024*1024)))throw new Error(`${r} is too large to convert to bytes safely`);return n}function Jg(t){if(t===void 0)return{...V,include:[...V.include],exclude:[...V.exclude]};let e=ge(t,"native.snapshot");return{include:Yl(e.include,"native.snapshot.include",V.include),exclude:Yl(e.exclude,"native.snapshot.exclude",V.exclude),max_files:ar(e.max_files,V.max_files,"native.snapshot.max_files"),max_total_bytes:ar(e.max_total_bytes,V.max_total_bytes,"native.snapshot.max_total_bytes"),max_duration_ms:ar(e.max_duration_ms,V.max_duration_ms,"native.snapshot.max_duration_ms"),max_selection_records:ar(e.max_selection_records,V.max_selection_records,"native.snapshot.max_selection_records")}}function Yg(t){if(t===void 0)return;let e=ge(t,"native.pending_root_move"),r=e.id,n=e.from_artifact_root,i=e.to_artifact_root,o=e.stage;if(typeof r!="string"||!/^[a-f0-9-]{8,}$/u.test(r))throw new Error("native.pending_root_move.id is invalid");if(typeof n!="string"||typeof i!="string")throw new Error("native.pending_root_move roots must be strings");if(o!=="copying"&&o!=="ready"&&o!=="switched")throw new Error("native.pending_root_move.stage is invalid");let s;if(e.cleanup!==void 0){let a=ge(e.cleanup,"native.pending_root_move.cleanup"),c=a.kind,l=a.state,u=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 u!="string"||!/^[a-f0-9]{64}$/u.test(u))throw new Error("native.pending_root_move.cleanup.manifest_hash is invalid");s={kind:c,state:l,manifestHash:u}}return{id:r,fromArtifactRoot:cr(n),toArtifactRoot:cr(i),stage:o,...s?{cleanup:s}:{}}}function Vg(t){if(t===void 0)return;let e=ge(t,"native.finish");if(e.pull_request===void 0)return{};let r=ge(e.pull_request,"native.finish.pull_request");if(r.provider!=="repository-command")throw new Error("native.finish.pull_request.provider must be repository-command");if(!Array.isArray(r.command)||r.command.length===0)throw new Error("native.finish.pull_request.command must be a non-empty array");if(r.command.length>64)throw new Error("native.finish.pull_request.command must contain at most 64 arguments");let n=r.command.map((o,s)=>{if(typeof o!="string"||o.trim().length===0||o.length>4096||/[\0\r\n]/u.test(o))throw new Error(`native.finish.pull_request.command[${s}] must be a non-empty single-line string of at most 4096 characters`);return o});if(Le.posix.isAbsolute(n[0])||Le.win32.isAbsolute(n[0]))throw new Error("native.finish.pull_request.command[0] must be a bare executable name or a project-relative path");let i=r.timeout_ms??Ug;if(!Number.isSafeInteger(i)||i<1||i>Jl)throw new Error(`native.finish.pull_request.timeout_ms must be an integer between 1 and ${Jl}`);return{pull_request:{provider:"repository-command",command:n,timeout_ms:i}}}function Xg(t,e={}){let r=ge(t,"native"),n=r.artifact_root??(e.allowMissingArtifactRoot?"docs":void 0);if(typeof n!="string")throw new Error("native.artifact_root must be a string");let i=r.clarification_mode??"batch";if(i!=="sequential"&&i!=="batch")throw new Error("native.clarification_mode must be sequential or batch");let o=r.archive_confirmation??"automatic";if(o!=="automatic"&&o!=="required")throw new Error("native.archive_confirmation must be automatic or required");let s=r.max_verify_failures??Xl;if(!Number.isSafeInteger(s)||s<1)throw new Error("native.max_verify_failures must be a positive integer");let a=r.document_writes??"allow";if(a!=="allow"&&a!=="revert")throw new Error("native.document_writes must be allow or revert");let c=Yg(r.pending_root_move),l=Vg(r.finish);return{artifact_root:cr(n),language:eu(r.language,"en","native.language"),clarification_mode:i,archive_confirmation:o,max_verify_failures:s,...a==="revert"?{document_writes:a}:{},snapshot:Jg(r.snapshot),...l?{finish:l}:{},...c?{pending_root_move:c}:{}}}function Qg(t){let e=ge(t,"classic"),r=e.context_compression??"off";if(r!=="off"&&r!=="beta")throw new Error("classic.context_compression must be off or beta");let n=e.review_mode??"standard";if(n!=="off"&&n!=="standard"&&n!=="thorough")throw new Error("classic.review_mode must be off, standard, or thorough");let i=e.auto_transition??!0;if(typeof i!="boolean")throw new Error("classic.auto_transition must be true or false");let o=e.document_evidence??"neutral";if(o!=="neutral"&&o!=="strict")throw new Error("classic.document_evidence must be neutral or strict");return{artifact_layout:Zl(e.artifact_layout),language:eu(e.language,"zh-CN","classic.language"),context_compression:r,review_mode:n,auto_transition:i,...o==="strict"?{document_evidence:o}:{}}}function Zg(t){let r=ge(t,"hook").allow_paths??[];if(!Array.isArray(r))throw new Error("hook.allow_paths must be an array");return{allow_paths:[...new Set(r.map((n,i)=>kt(n,`hook.allow_paths[${i}]`)))]}}function ew(t){if(t===void 0)return{...Rn};let e=ge(t,"memory"),r=e.learning??Rn.learning,n=e.retrieval??Rn.retrieval;if(typeof r!="boolean")throw new Error("memory.learning must be true or false");if(typeof n!="boolean")throw new Error("memory.retrieval must be true or false");return{learning:r,retrieval:n}}function es(t,e){if(t===null||typeof t!="object"||Array.isArray(t))throw new Error(`${e} must be a mapping`);return t}function tw(t,e){if(typeof t!="string")throw new Error(`${e} must be a string`);let r=t.trim();if(r.length===0||r.includes("\\")||r.includes("\0")||Le.posix.isAbsolute(r)||Le.win32.isAbsolute(r)||r.startsWith("~")||r.split("/").some(i=>i===""||i==="."||i===".."))throw new Error(`${e} must be a safe project-relative glob`);if(!r.toLowerCase().endsWith(".md"))throw new Error(`${e} must target a Markdown file ending in .md`);if(r.length>Kl)throw new Error(`${e} exceeds ${Kl} characters`);let n=0;for(let i=0;i<r.length;i+=1)r[i]==="?"?n+=1:r[i]==="*"&&(n+=1,r[i+1]==="*"&&(i+=1));if(n>Hl)throw new Error(`${e} contains more than ${Hl} wildcard tokens`);return r}function rw(t){let e=es(t,"knowledge.local"),r=e.include??[];if(!Array.isArray(r))throw new Error("knowledge.local.include must be an array");let n={include:[...new Set(r.map((i,o)=>tw(i,`knowledge.local.include[${o}]`)))],max_file_mb:Vl(e.max_file_mb,zl.max_file_mb,"knowledge.local.max_file_mb"),max_total_mb:Vl(e.max_total_mb,zl.max_total_mb,"knowledge.local.max_total_mb")};if(n.max_file_mb>n.max_total_mb)throw new Error("knowledge.local.max_file_mb must not exceed max_total_mb");return n}function nw(t){if(typeof t!="string"||t.trim().length===0)throw new Error("knowledge.remote.endpoint must be a non-empty URL");let e;try{e=new URL(t)}catch{throw new Error("knowledge.remote.endpoint must be a valid URL")}let r=e.hostname.toLowerCase().replace(/^\[|\]$/gu,""),n=r==="localhost"||r==="127.0.0.1"||r==="::1";if(e.protocol!=="https:"&&!(e.protocol==="http:"&&n))throw new Error("knowledge.remote.endpoint must use HTTPS (HTTP is allowed for loopback)");return e.toString()}function iw(t){let e=es(t,"knowledge.remote"),r=nw(e.endpoint),n=e.token_env;if(n!==void 0&&(typeof n!="string"||!/^[A-Za-z_][A-Za-z0-9_]*$/u.test(n)))throw new Error("knowledge.remote.token_env must be an environment variable name");let i=e.scope;if(i!==void 0&&(typeof i!="string"||i.length>512))throw new Error("knowledge.remote.scope must be a string of at most 512 characters");let o=e.timeout_ms??5e3;if(typeof o!="number"||!Number.isSafeInteger(o)||o<100||o>3e4)throw new Error("knowledge.remote.timeout_ms must be an integer between 100 and 30000");return{endpoint:r,...n===void 0?{}:{token_env:n},...i===void 0?{}:{scope:i},timeout_ms:o}}function ow(t){if(t===void 0)return{...Ql};let e=es(t,"knowledge"),r=e.provider??"local";if(r!=="local"&&r!=="remote")throw new Error("knowledge.provider must be local or remote");let n=e.local===void 0?void 0:rw(e.local);if(r==="local")return{provider:r,...n?{local:n}:{}};let i=e.remote===void 0?void 0:iw(e.remote);if(i===void 0)throw new Error("knowledge.remote must be configured when knowledge.provider is remote");return{provider:r,...n?{local:n}:{},remote:i}}function sw(t){let e=t??!0;if(typeof e!="boolean")throw new Error("ambient_resume must be true or false");return e}function aw(t,e,r,n,i,o,s,a){let c=t.schema!==void 0;if(!(c||t.default_workflow!==void 0||t.workflows!==void 0||!a.allowPartialProject&&t.native!==void 0)||a.allowPartialProject&&!c)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 u=t.workflows??[t.default_workflow];if(!Array.isArray(u)||u.length===0||u.some(d=>d!=="native"&&d!=="classic"))throw new Error("workflows must contain native and/or classic");let f=[...new Set(u)];if(!f.includes(t.default_workflow))throw new Error("workflows must include default_workflow");if(f.includes("native")&&!i)throw new Error("native must be a mapping");return{schema:"comet.project.v1",default_workflow:t.default_workflow,workflows:f,ambient_resume:s,...e?{hook:e}:{},memory:r,knowledge:n,...i?{native:i}:{},...o?{classic:o}:{}}}function $e(t,e={}){let r=(0,Zo.parseDocument)(t,{uniqueKeys:!0});if(r.errors.length>0)throw new Error(`Invalid .comet/config.yaml: ${r.errors[0].message}`);let n=r.toJS();if(n==null)return{value:{},config:null,ambient_resume:!0};if(typeof n!="object"||Array.isArray(n))throw new Error("Invalid .comet/config.yaml: root must be a mapping");let i=n,o=sw(i.ambient_resume),s=i.hook===void 0?void 0:Zg(i.hook),a=ew(i.memory),c=ow(i.knowledge),l=i.native===void 0?void 0:Xg(i.native,{allowMissingArtifactRoot:e.allowMissingNativeFields}),u=i.classic===void 0?void 0:Qg(i.classic),f=aw(i,s,a,c,l,u,o,{allowPartialProject:e.allowPartialProject??!1});return{value:i,config:f,ambient_resume:o,memory:a,knowledge:c,...s?{hook:s}:{},...l?{native:l}:{},...u?{classic:u}:{}}}function ts(t="docs",e="en"){return{schema:"comet.project.v1",default_workflow:"native",ambient_resume:!0,memory:{...Rn},knowledge:{...Ql},native:{artifact_root:cr(t),language:e,clarification_mode:"batch",archive_confirmation:"automatic",max_verify_failures:Xl,snapshot:{...V,include:[...V.include],exclude:[...V.exclude]}}}}var Zo,Ze,Xo,Qo,Kl,Hl,Xl,Rn,zl,Ql,Ug,Jl,Gg,Kg,Hg,V,we=A(()=>{"use strict";Zo=He(Ie(),1),Ze=Number.MAX_SAFE_INTEGER,Xo=1024,Qo=64,Kl=1024,Hl=64,Xl=5,Rn={learning:!0,retrieval:!0},zl={include:[],max_file_mb:1,max_total_mb:32},Ql={provider:"local"},Ug=12e4,Jl=6e5,Gg=[".agents/skills/**",".amazonq/skills/**",".augment/skills/**",".bob/skills/**",".claude/skills/**",".cline/skills/**",".codebuddy/skills/**",".workbuddy/skills/**",".continue/skills/**",".cospec/skills/**",".crush/skills/**",".cursor/skills/**",".devin/skills/**",".dsh/skills/**",".factory/skills/**",".forge/skills/**",".gemini/skills/**",".github/skills/**",".grok/skills/**",".iflow/skills/**",".junie/skills/**",".kilocode/skills/**",".kimi-code/skills/**",".kiro/skills/**",".lingma/skills/**",".mimocode/skills/**",".opencode/skills/**",".omp/skills/**",".pi/skills/**",".qoder/skills/**",".qwen/skills/**",".roo/skills/**",".trae-cn/skills/**",".trae/skills/**",".windsurf/skills/**",".zcode/skills/**"],Kg=["**/.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"],Hg=[...Gg,...Kg].sort((t,e)=>t.localeCompare(e,"en")),V={include:["**/*"],exclude:[...Hg],max_files:1e4,max_total_bytes:1024*1024*1024,max_duration_ms:6e4,max_selection_records:2e4}});function je(t){return t!==0&&t!==0n&&t!=="0"}function ru(t,e){return je(t.dev)&&je(e.dev)&&je(t.ino)&&je(e.ino)}function We(t,e){let r=je(t.dev)&&je(e.dev);if(r&&t.dev!==e.dev)return!1;let n=je(t.ino)&&je(e.ino);return n&&t.ino!==e.ino?!1:r&&n?!0:t.birthtime===e.birthtime}var On=A(()=>{"use strict"});import{constants as An,promises as et}from"fs";function rs(t){return"birthtimeNs"in t&&typeof t.birthtimeNs=="bigint"?t.birthtimeNs:t.birthtimeMs}function nu(t){return"ctimeNs"in t&&typeof t.ctimeNs=="bigint"?t.ctimeNs:t.ctimeMs}function lr(t){return{dev:t.dev,ino:t.ino,birthtime:rs(t)}}function Tn(t,e){let r=lr(t),n=lr(e);return ru(r,n)?We(r,n):We(r,n)&&rs(t)===rs(e)&&nu(t)===nu(e)&&t.size===e.size}async function Nn(t,e,r={}){if(!Number.isSafeInteger(e)||e<1)throw new Error("race-safe read byte limit must be a positive integer");let n=r.label??"file",i=r.bigint===!0,o=await et.lstat(t,{bigint:i});if(!o.isFile()||o.isSymbolicLink())throw new De("not-regular-file",`${n} must be a regular file`);if(BigInt(o.size)>BigInt(e))throw new De("too-large",`${n} exceeds ${e} bytes`);let s=await et.realpath(t);await r.verify?.("pre-open",{realPath:s,identity:lr(o)});let a=process.platform==="win32"?An.O_RDONLY:An.O_RDONLY|An.O_NOFOLLOW|An.O_NONBLOCK,c;try{c=await et.open(t,a)}catch(l){throw l.code==="ELOOP"?new De("not-regular-file",`${n} must be a regular file`,{cause:l}):l}try{let[l,u,f]=await Promise.all([c.stat({bigint:i}),et.lstat(t,{bigint:i}),et.realpath(t)]);if(!l.isFile()||!u.isFile()||u.isSymbolicLink()||f!==s||!Tn(o,l)||!Tn(o,u))throw new De("changed",`${n} changed while opening`);await r.verify?.("post-open",{realPath:f,identity:lr(l)}),await r.hooks?.afterOpen?.();let d=[],p=0,h=Buffer.allocUnsafe(Math.min(64*1024,e+1));for(;;){let b=e+1-p,{bytesRead:k}=await c.read(h,0,Math.min(h.length,b),null);if(k===0)break;if(p+=k,p>e)throw new De("too-large",`${n} exceeds ${e} bytes`);d.push(Buffer.from(h.subarray(0,k)))}await r.hooks?.beforeFinalCheck?.();let[m,g,y]=await Promise.all([c.stat({bigint:i}),et.lstat(t,{bigint:i}),et.realpath(t)]);if(!g.isFile()||g.isSymbolicLink()||y!==s||!Tn(o,m)||!Tn(o,g))throw new De("changed",`${n} changed while reading`);return await r.verify?.("post-read",{realPath:y,identity:lr(m)}),{bytes:Buffer.concat(d,p),stat:m,realPath:y}}finally{await c.close()}}var De,ns=A(()=>{"use strict";On();De=class extends Error{reason;constructor(e,r,n){super(r,n),this.name="RaceSafeReadError",this.reason=e}}});import{promises as In}from"fs";import qe from"path";function cw(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}function is(t,e){let r=qe.relative(t,e);return r===""||!qe.isAbsolute(r)&&r!==".."&&!r.startsWith(`..${qe.sep}`)}async function iu(t,e){let r=qe.resolve(t),n=await In.lstat(r);if(!n.isDirectory()||n.isSymbolicLink())throw new Error(`${e} project root must be a real directory`);return In.realpath(r)}async function ou(t,e,r,n){let i=t;for(let o=0;o<r.length;o++){i=qe.join(i,r[o]);let s;try{s=await In.lstat(i)}catch(u){if(cw(u))return{exists:!1,kind:"missing"};throw u}let a=qe.relative(t,i).replaceAll("\\","/");if(s.isSymbolicLink())throw new Error(`${n.label} crosses a symbolic link or junction at ${a}`);let c=o===r.length-1;if(!c&&!s.isDirectory())throw new Error(`${n.label} ancestor ${a} must be a real directory`);if(c&&(n.expected==="file"&&!s.isFile()||n.expected==="directory"&&!s.isDirectory()||n.expected==="any"&&!s.isFile()&&!s.isDirectory()))throw new Error(`${n.label} must be a real ${n.expected}`);let l=await In.realpath(i);if(!is(e,l))throw new Error(`${n.label} resolves outside the project root`);if(c)return{exists:!0,kind:s.isFile()?"file":s.isDirectory()?"directory":"missing"}}return{exists:!0,kind:"directory"}}async function $(t,e,r){let n=kt(e,r.label),i=qe.resolve(t),o=await iu(i,r.label),s=n.split("/"),a=qe.resolve(i,...s);if(!is(i,a))throw new Error(`${r.label} must stay inside the project root`);let c=await ou(i,o,s,r);return{projectRoot:i,target:a,relative:n,exists:c.exists,kind:c.kind}}async function j(t,e,r,n){let i=await $(t,e,{label:n.label,expected:"file"});if(!i.exists){let s=new Error(`${n.label} does not exist`);throw s.code="ENOENT",s}let o=await iu(i.projectRoot,n.label);return Nn(i.target,r,{...n,verify:async(s,a)=>{if(!is(o,a.realPath))throw new Error(`${n.label} resolves outside the project root`);await ou(i.projectRoot,o,i.relative.split("/"),{label:n.label,expected:"file"})}})}var X=A(()=>{"use strict";ns();we()});import{createHash as lw}from"crypto";function uw(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}async function tt(t,e={}){return(await Ln(t,e)).document}async function fw(t){try{return(await j(t,ur,Ze,{label:ur})).bytes}catch(e){if(uw(e))return null;throw e}}function dw(t){return t?{exists:!0,sha256:lw("sha256").update(t).digest("hex")}:{exists:!1,sha256:null}}async function Ln(t,e={}){let r=await fw(t);return{document:r?$e(r.toString("utf8"),e):null,identity:dw(r)}}async function os(t){return(await tt(t))?.config??null}var ur,Me=A(()=>{"use strict";we();X();ur=".comet/config.yaml"});import{promises as as}from"node:fs";async function cs(t,e){let r;for(let n=0;n<=ss.length;n+=1)try{return await t()}catch(i){r=i;let o=i.code;if(n===ss.length||!mw.has(o??""))throw i;await new Promise(s=>setTimeout(s,ss[n]))}throw r}async function su(t,e){await cs(()=>as.rename(t,e),`rename ${e}`)}async function $n(t){await cs(()=>as.unlink(t),`unlink ${t}`)}async function au(t,e){await cs(()=>as.link(t,e),`link ${e}`)}var mw,ss,ls=A(()=>{"use strict";mw=new Set(["EPERM","EACCES","EBUSY","ENOTEMPTY"]),ss=[50,100,200]});import{randomUUID as pw}from"crypto";import{constants as hw,promises as I}from"fs";import D from"path";async function us(t,e){try{return await au(t,e),{linked:!0}}catch(r){let n=r.code;if(n!=="ENOTSUP"&&n!=="EOPNOTSUPP")throw r}return await I.copyFile(t,e,hw.COPYFILE_EXCL),{linked:!1}}function rt(t,e){let r=D.relative(t,e);return r===""||!D.isAbsolute(r)&&r!==".."&&!r.startsWith(`..${D.sep}`)}function jn(t){return{dev:t.dev,ino:t.ino,birthtime:t.birthtimeMs}}function gw(t,e){return We(t,jn(e))}function Wn(t,e){return We(jn(t),jn(e))}function cu(t,e){return Wn(t,e)&&t.birthtimeMs===e.birthtimeMs&&t.ctimeMs===e.ctimeMs&&t.mtimeMs===e.mtimeMs&&t.size===e.size}async function Dn(t){let e=await I.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 I.realpath(t),...jn(e)}}async function ye(t){for(let e of t){let r=await I.lstat(e.path);if(!r.isDirectory()||r.isSymbolicLink()||!gw(e,r)||await I.realpath(e.path)!==e.realPath)throw new Error(`Contained atomic write parent changed before commit: ${e.path}`)}}async function ww(t,e,r){let[n,i]=await Promise.all([I.lstat(t),I.realpath(t),ye(r)]);if(!n.isFile()||n.isSymbolicLink()||!Wn(n,e)||!rt(r[0].realPath,i))throw new Error("Contained atomic write temporary file changed after close");return n}async function yw(t,e){let r=D.resolve(t),n=D.resolve(e);if(!rt(r,n))throw new Error(`Contained atomic write parent is outside its managed root: ${e}`);let i=[await Dn(r)],o=D.relative(r,n).split(D.sep).filter(Boolean),s=r;for(let a of o){await ye(i),s=D.join(s,a);try{await I.mkdir(s)}catch(l){if(l.code!=="EEXIST")throw l}let c=await Dn(s);if(!rt(i[0].realPath,c.realPath))throw new Error(`Contained atomic write parent resolves outside its managed root: ${s}`);i.push(c)}return await ye(i),i}async function vw(t,e){let r=D.resolve(t),n=D.resolve(e);if(!rt(r,n))throw new Error(`Contained file parent is outside its managed root: ${e}`);let i=[await Dn(r)],o=D.relative(r,n).split(D.sep).filter(Boolean),s=r;for(let a of o){s=D.join(s,a);try{let c=await Dn(s);if(!rt(i[0].realPath,c.realPath))throw new Error(`Contained file parent resolves outside its managed root: ${s}`);i.push(c)}catch(c){if(c.code==="ENOENT")return null;throw c}}return await ye(i),i}async function lu(t){let e;try{e=await I.open(t,"r"),await e.sync()}catch(r){let n=r.code;if(!["EACCES","EBADF","EINVAL","EISDIR","ENOTSUP","EPERM"].includes(n??""))throw r}finally{await e?.close()}}async function bw(t,e,r){let n=D.dirname(t),i=await yw(r.containedRoot,n),o=D.join(n,`.${D.basename(t)}.${pw()}.tmp`),s,a,c;try{await r.beforeTemporaryOpen?.(),s=await I.open(o,"wx"),a=await s.stat();let[l,u]=await Promise.all([I.lstat(o),I.realpath(o)]);if(await ye(i),!l.isFile()||l.isSymbolicLink()||!Wn(a,l)||!rt(i[0].realPath,u))throw new Error("Contained atomic write temporary file opened outside its managed parent");if(typeof e=="string"?await s.writeFile(e,"utf8"):await s.writeFile(e),await s.sync(),c=await s.stat(),!Wn(a,c))throw new Error("Contained atomic write temporary file changed while writing");if(await s.close(),s=void 0,await r.afterTemporaryClose?.(),!c)throw new Error("Contained atomic write temporary file was not written");c=await ww(o,c,i),await r.beforeCommit?.(),await ye(i);let f=await I.lstat(o);if(!f.isFile()||f.isSymbolicLink()||!c||!cu(f,c))throw new Error("Contained atomic write temporary file changed before commit");r.exclusive?(await us(o,t),await I.unlink(o)):await su(o,t),await lu(n)}catch(l){await s?.close();try{await ye(i),await I.rm(o,{force:!0})}catch{}throw l}}async function Q(t,e,r){await bw(t,e,r)}async function fr(t,e){let r=D.dirname(t),n=await vw(e.containedRoot,r);if(!n)return!1;let i,o;try{i=await I.lstat(t),o=await I.realpath(t)}catch(c){if(c.code==="ENOENT")return!1;throw c}if(!i.isFile()||i.isSymbolicLink()||!rt(n[0].realPath,o))throw new Error("Contained file removal target must be a regular file inside its managed root");await e.beforeRemove?.(),await ye(n);let[s,a]=await Promise.all([I.lstat(t),I.realpath(t)]);if(!s.isFile()||s.isSymbolicLink()||!cu(i,s)||a!==o)throw new Error("Contained file removal target changed before removal");return await $n(t),await ye(n),await lu(r),!0}var ce=A(()=>{"use strict";ls();On()});var lC,fs=A(()=>{"use strict";ce();Me();X();lC=16*1024});var qn=A(()=>{"use strict";ce();we();Me();X();fs()});import F from"path";function Su(t,e){let r=F.relative(t,e);return r===""||!F.isAbsolute(r)&&r!==".."&&!r.startsWith(`..${F.sep}`)}function Dw(t,e){let r=F.isAbsolute(e)?F.resolve(e):F.resolve(t,e),n=F.relative(F.resolve(t),r);return n===""||F.isAbsolute(n)||n===".."||n.startsWith(`..${F.sep}`)?null:n.replaceAll("\\","/")}function Eu(t){return process.platform==="win32"?t.toLowerCase():t}async function ys(t,e,r=[]){let n=F.isAbsolute(e)?F.resolve(e):F.resolve(t,e),i=F.resolve(t);if(!Su(i,n)||r.some(c=>Su(F.resolve(c),n)))return null;let o=Dw(t,e);if(!o)return null;let a=(await Ww(t)).allow_paths.find(c=>{let l=Eu(o),u=Eu(c);return l===u||l.startsWith(`${u}/`)});return a?`${o} (configured Hook allow path: ${a})`:null}var Ww,vs=A(()=>{"use strict";At();Me();Ww=Ce("hookWritePolicy",async t=>(await os(t))?.hook??{allow_paths:[]})});var zn=A(()=>{"use strict"});var Uu=A(()=>{"use strict"});var xs=A(()=>{"use strict";zn()});var Gu=A(()=>{"use strict";zn();xs()});function gy(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}function wy(t){let e=(0,Ku.parseDocument)(t,{uniqueKeys:!0});if(e.errors.length>0)throw new Error(`Invalid global Comet config: ${e.errors[0].message}`);let r=e.toJS();if(r==null)return{};if(typeof r!="object"||Array.isArray(r))throw new Error("Invalid global Comet config: root must be a mapping");return r}function zu(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:r,...n})=>n)(t.native):void 0;return{...t,schema:"comet.global.v1",...e?{native:e}:{}}}function yy(t){let e=$e(JSON.stringify({...t,schema:"comet.project.v1"})).config;if(!e)throw new Error("Invalid global Comet config: workflow template is incomplete");return zu(e)}function vy(t){let e=$e(t,{allowPartialProject:!0,allowMissingNativeFields:!0});if(!e.native&&!e.classic)return null;let r=e.native?"native":"classic",n=e.native?.language??e.classic?.language??"en",i=ts(e.native?.artifact_root??"docs",n);return{schema:"comet.global.v1",default_workflow:r,workflows:[r],ambient_resume:e.ambient_resume,...e.native?{native:{...i.native,...e.native}}:{},...e.classic?{classic:e.classic}:{}}}function Ju(t){let e=wy(t);if(Object.keys(e).length===0)return null;if(e.schema===void 0)return vy(t);if(e.schema!=="comet.global.v1")throw new Error("Unsupported Comet global schema");return yy(e)}async function Ps(t){try{let e=await j(t,Hu,Ze,{label:"global Comet config"});return Ju(e.bytes.toString("utf8"))}catch(e){if(gy(e))return null;throw e}}var Ku,Hu,Rs=A(()=>{"use strict";Ku=He(Ie(),1);ce();we();X();Hu=".comet/config.yaml"});var jS,Yu=A(()=>{"use strict";ce();X();jS=4*1024*1024});import by from"node:path";function Os(t){return by.join(t,".comet","current-change.json")}function ky(t){return!!t&&typeof t=="object"&&!Array.isArray(t)}function Vu(t){return t===null||typeof t=="string"}function Cy(t){let e;try{e=JSON.parse(t)}catch(r){throw new Error(`current change selection contains invalid JSON: ${r instanceof Error?r.message:String(r)}`,{cause:r})}if(!ky(e))throw new Error("current change selection must be a JSON object");if(e.version===1){if(typeof e.change!="string")throw new Error("legacy current change selection change must be a string");if(e.branch!==void 0&&!Vu(e.branch))throw new Error("legacy current change selection branch must be a string or null");return{selection:{schema:Jn,workflow:"classic",change:e.change,branch:e.branch??null},legacy:!0}}if(e.schema!==Jn)throw new Error(`current change selection schema must be ${Jn}`);if(e.workflow!=="native"&&e.workflow!=="classic")throw new Error("current change selection workflow must be native or classic");if(typeof e.change!="string")throw new Error("current change selection change must be a string");if(!Vu(e.branch))throw new Error("current change selection branch must be a string or null");if(e.workflow==="native"&&e.branch!==null)throw new Error("Native current change selection branch must be null");return{selection:e,legacy:!1}}async function As(t){let e;try{let n=Os(t),{bytes:i}=await Nn(n,Xu,{label:"current change selection"});e=i.toString("utf8")}catch(n){if(n.code==="ENOENT")return{status:"missing"};throw new Error(`cannot read current change selection: ${n instanceof Error?n.message:String(n)}`,{cause:n})}return{status:"selected",...Cy(e)}}var Jn,Xu,Ts=A(()=>{"use strict";ns();Jn="comet.selection.v2",Xu=16*1024});var Qu=A(()=>{"use strict";zn();ce();Uu();Gu();we();Rs();X();Me();qn();Yu();vs();Ts();fs();xs()});import{TextDecoder as xy}from"util";function Zu(t){return{dev:t.dev,ino:t.ino,birthtime:t.birthtimeMs}}function Py(t,e){try{return new xy("utf-8",{fatal:!0}).decode(t.bytes)}catch(r){throw new Error(`${e} is not valid UTF-8`,{cause:r})}}async function Ns(t,e,r,n,i={}){try{let o=await j(t,e,r,{label:n,hooks:i.hooks});return{result:o,text:Py(o,n)}}catch(o){let s=o.code;if(s==="ENOENT"||s==="ENOTDIR")return null;throw o}}async function ef(t,e,r,n,i={}){return(await Ns(t,e,r,n,i))?.text??null}async function tf(t,e,r,n,i,o={}){if(Buffer.byteLength(r,"utf8")>n)throw new Error(`${i} exceeds ${n} bytes`);let s=await Ns(t,e,n,i),a=await $(t,e,{label:i,expected:"file"});await Q(a.target,r,{containedRoot:a.projectRoot,beforeCommit:async()=>{await o.beforeCommit?.();let c=await Ns(t,e,n,i);if(!(!s&&!c)){if(!s||!c)throw new Error(`${i} changed before commit`);if(s.result.realPath!==c.result.realPath||!We(Zu(s.result.stat),Zu(c.result.stat))||s.text!==c.text)throw new Error(`${i} changed before commit`)}}})}async function rf(t,e,r,n={}){let i=await $(t,e,{label:r,expected:"file"});return i.exists?fr(i.target,{containedRoot:i.projectRoot,beforeRemove:n.beforeRemove}):!1}var nf=A(()=>{"use strict";Qu();On()});var cf={};ud(cf,{RUN_STATE_FILE:()=>Et,applyRunStateToDocument:()=>sf,readRunState:()=>Yn,removeRunState:()=>Is,runStateFromDocument:()=>St,writeRunState:()=>Vn});import Ry from"path";function yr(t,e){let r=t[e];if(typeof r!="string"||r.length===0)throw new Error(`Invalid Run state: ${e} must be a non-empty string`);return r}function wr(t,e){let r=yr(t,e);if(Ry.isAbsolute(r)||/^(?:[A-Za-z]:|[\\/]|~)/u.test(r)||r.split(/[\\/]/u).includes(".."))throw new Error(`Invalid Run state: ${e} must stay inside the change directory`);return r}function Oy(t){let e=t.run_retries??"{}",r;try{r=typeof e=="string"?JSON.parse(e):e}catch(n){throw new Error("Invalid Run state: run_retries must be a JSON object",{cause:n})}if(!r||typeof r!="object"||Array.isArray(r))throw new Error("Invalid Run state: run_retries must be a JSON object");for(let n of Object.values(r))if(!Number.isInteger(n)||Number(n)<0)throw new Error("Invalid Run state: retry counts must be non-negative integers");return r}function St(t){if(!t.run_id)return null;let e=yr(t,"run_id"),r=yr(t,"skill"),n=yr(t,"skill_version"),i=yr(t,"skill_hash"),o=wr(t,"pending_ref"),s=wr(t,"trajectory_ref"),a=wr(t,"context_ref"),c=wr(t,"artifacts_ref"),l=wr(t,"checkpoint_ref"),u=Number(t.iteration);if(!Number.isInteger(u)||u<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:r,skillVersion:n,skillHash:i,orchestration:t.orchestration,currentStep:of(t,"current_step"),iteration:u,pending:of(t,"pending"),pendingRef:o,trajectoryRef:s,contextRef:a,artifactsRef:c,checkpointRef:l,status:t.run_status,retries:Oy(t)}}function sf(t,e){e?t.run_id=e.runId:delete t.run_id}function Ay(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 Ty(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 St(e)}async function Yn(t,e={}){let r=await ef(t,Et,af,"Run state",e);if(r===null)return null;let n=JSON.parse(r);return Ty(n)}async function Vn(t,e,r={}){await tf(t,Et,JSON.stringify(Ay(e),null,2),af,"Run state",r)}async function Is(t,e={}){await rf(t,Et,"Run state",e)}var of,Et,af,Xn=A(()=>{"use strict";nf();of=(t,e)=>{let r=t[e];return r==null?null:String(r)};Et=".comet/run-state.json",af=Number.MAX_SAFE_INTEGER});import{promises as si}from"fs";import J from"path";function di(t){return t.charCodeAt(0)===65279?t.slice(1):t}At();async function pi(t=2e3){return process.stdin.isTTY?{text:""}:!Number.isFinite(t)||t<1?{text:null}:process.stdin.readableEnded?{text:""}:await new Promise(e=>{let r=!1,n=0,i=[],o=setTimeout(()=>s({text:null}),Math.ceil(t)),s=f=>{r||(r=!0,clearTimeout(o),process.stdin.removeListener("data",a),process.stdin.removeListener("end",c),process.stdin.removeListener("close",l),process.stdin.removeListener("error",u),process.stdin.pause(),e(f))},a=f=>{let d=Buffer.isBuffer(f)?f:Buffer.from(f),p=1048576-n;if(p<=0){s({text:null});return}let h=d.subarray(0,p);i.push(h),n+=h.length,d.length>h.length&&s({text:null})},c=()=>s({text:Buffer.concat(i,n).toString("utf8")}),l=()=>{process.stdin.readableEnded||s({text:null})},u=()=>s({text:null});process.stdin.on("data",a),process.stdin.once("end",c),process.stdin.once("close",l),process.stdin.once("error",u),o.unref(),process.stdin.resume()})}import{promises as Ew}from"fs";import H from"path";import{promises as pd}from"fs";async function hi(t){try{return await pd.access(t),!0}catch(e){if(hd(e))return!1;throw e}}function hd(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}we();Me();qn();X();var Ct=class extends Error{code="classic-layout-unavailable";constructor(e="Classic artifact layout is unavailable from .comet/config.yaml"){super(e),this.name="ClassicLayoutUnavailableError"}},du=".comet/config.yaml";function _w(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}async function xw(t){await $(t,du,{label:du,expected:"file"})}function ms(t,e){let r=H.resolve(t),n=e==="docs"?H.join(r,"docs"):r,i=H.join(n,"openspec"),o=H.join(r,"docs","superpowers");return{projectRoot:r,artifactLayout:e,openSpecBase:n,openSpecRoot:i,changesDir:H.join(i,"changes"),archiveDir:H.join(i,"changes","archive"),specsDir:H.join(i,"specs"),superpowersRoot:o,superpowersSpecsDir:H.join(o,"specs"),superpowersPlansDir:H.join(o,"plans"),superpowersReportsDir:H.join(o,"reports")}}async function pu(t){await xw(t);let e=await tt(t,{allowPartialProject:!0,allowMissingNativeFields:!0});if(!e?.config)throw new Ct;if(!(e.config.workflows??[e.config.default_workflow]).includes("classic"))throw new Ct("Classic artifact layout is unavailable because Classic is not enabled");return e.classic?.artifact_layout??"legacy"}async function hu(t,e){return ms(t,e??await pu(t))}async function Pw(t){try{return await Ew.lstat(t),!0}catch(e){if(_w(e))return!1;throw e}}async function Rw(t,e){let r=await hu(t,e),n=r.artifactLayout==="legacy"?"docs":"legacy",i=ms(t,n).openSpecRoot,[o,s]=await Promise.all([$(r.projectRoot,L(r.projectRoot,r.openSpecRoot),{label:"Configured Classic OpenSpec root",expected:"directory"}),Pw(i)]),a=o.exists;return{paths:r,configuredRootExists:a,alternateRoot:i,alternateRootExists:s,dualRoots:a&&s}}async function Ow(t){let e=[t.openSpecRoot,t.changesDir,t.archiveDir,t.specsDir,t.superpowersRoot,t.superpowersSpecsDir,t.superpowersPlansDir,t.superpowersReportsDir];for(let r of e){let n=L(t.projectRoot,r);await $(t.projectRoot,n,{label:`Classic managed physical path ${n}`,expected:"directory"})}}async function Fe(t,e){let r=await Rw(t,e);if(await Ow(r.paths),!r.configuredRootExists){let n=L(r.paths.projectRoot,r.paths.openSpecRoot),i=L(r.paths.projectRoot,r.alternateRoot);throw new Ct(`Configured Classic OpenSpec root is missing: ${n} (alternate ${i} is ${r.alternateRootExists?"present":"missing"})`)}return r.paths}async function ps(t,e){let r=H.join(H.resolve(t),".comet","classic-root-move.json");if(await hi(r))throw new Error("Classic root move transaction is incomplete; inspect it with comet doctor and recover it explicitly before writing");let n=await Fe(t,e);if(!await hi(n.openSpecRoot))throw new Error(`Configured Classic OpenSpec root is missing: ${L(n.projectRoot,n.openSpecRoot)}`);return n}function L(t,e){return H.relative(H.resolve(t),e).replaceAll("\\","/")}import{promises as Nw}from"fs";import mr from"path";ce();we();X();import dr from"path";var hs=Number.MAX_SAFE_INTEGER;function gu(t,e,r){let n=dr.resolve(t),i=dr.isAbsolute(e)?dr.resolve(e):dr.resolve(n,e),o=dr.relative(n,i).replaceAll("\\","/");return{root:n,relative:kt(o,r),target:i}}async function Be(t,e,r){let n=gu(t,e,r.label);return $(n.root,n.relative,r)}async function nt(t,e,r){return(await Be(t,e,{label:r.label,expected:r.expected??"any"})).exists}async function wu(t,e,r,n){return await nt(t,e,{label:r,expected:"file"})?(await yu(t,e,{label:r,hooks:n})).byteLength>0:!1}async function Ue(t,e,r){return(await yu(t,e,r)).toString("utf8")}async function yu(t,e,r){let n=gu(t,e,r.label);return(await j(n.root,n.relative,r.maxBytes??hs,{label:r.label,hooks:r.hooks})).bytes}function Fn(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}'
|
|
143
|
+
Valid format: lowercase kebab-case (a-z, 0-9, single hyphens)`:"Change name cannot be empty"}function pr(t){let e=Fn(t);if(e)throw new Error(e)}function Iw(t,e){return{label:L(t,e),directory:e}}async function Mn(t,e,r){let n=Iw(t,e);if(!(await Be(t,e,{label:r,expected:"directory"})).exists)return{change:n,exists:!1,stateExists:!1};let o=await Be(t,mr.join(e,".comet.yaml"),{label:`${r} state`,expected:"file"});return{change:n,exists:!0,stateExists:o.exists}}function vu(t,e){let r=e.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&");return new RegExp(`^\\d{4}-\\d{2}-\\d{2}-${r}$`,"u").test(t)}async function Lw(t,e,r,n={}){if(!n.skipExactCompatibility){let s=await Mn(t,mr.join(e,r),`Classic archived change ${r}`);if(s.exists)return s.change}if(!(await Be(t,e,{label:"Classic archive directory",expected:"directory"})).exists)return null;let o=[];for(let s of await Nw.readdir(e,{withFileTypes:!0})){if(!vu(s.name,r))continue;let a=await Mn(t,mr.join(e,s.name),`Classic archived change ${s.name}`);a.exists&&a.stateExists&&o.push(a.change)}return o.sort((s,a)=>a.directory.localeCompare(s.directory))[0]??null}async function it(t,e=process.cwd()){pr(t);let r=await Fe(e),n=await Mn(r.projectRoot,mr.join(r.changesDir,t),`Classic active change ${t}`);return{...n.change,exists:n.exists,stateExists:n.stateExists}}async function gs(t,e=process.cwd(),r={}){pr(t);let n=await Fe(e);if(r.preferredArchiveName!==void 0){let i=r.preferredArchiveName;if(i!==t&&!vu(i,t))throw new Error(`Classic preferred archive name '${i}' does not belong to change '${t}'`);let o=await Mn(n.projectRoot,mr.join(n.archiveDir,i),`Classic preferred archived change ${i}`);return o.exists&&o.stateExists?o.change:null}return Lw(n.projectRoot,n.archiveDir,t,r)}import{promises as ws}from"fs";import Z from"path";import{fileURLToPath as $w}from"node:url";function bu(t){return[...new Set(t.flatMap(e=>{let r=e.trim();if(!r)return[];if(/^file:/iu.test(r))try{return[$w(r)]}catch{return[r]}return/^[A-Za-z]:/u.test(r)?[r]:/^[A-Za-z][A-Za-z0-9+.-]*:/u.test(r)?[]:[r]}))]}function ku(t,e){let r=Z.relative(t,e);return r===""||r!==".."&&!r.startsWith(`..${Z.sep}`)&&!Z.isAbsolute(r)}async function jw(t){let e=Z.resolve(t),r=Z.parse(e).root,n=[],i=e;for(;i&&i!==r;)try{let o=await ws.realpath(i);return Z.join(o,...n.reverse())}catch(o){let s=o.code;if(s!=="ENOENT"&&s!=="ENOTDIR")throw o;n.push(Z.basename(i)),i=Z.dirname(i)}try{let o=await ws.realpath(r);return Z.join(o,...n.reverse())}catch{return null}}async function Cu(t,e){let r=Z.resolve(t),n=await ws.realpath(r),i=[],o=[];for(let s of bu(e)){let a=Z.isAbsolute(s)?Z.resolve(s):Z.resolve(r,s),c=await jw(a);((c?ku(n,c):ku(r,a))?i:o).push(s)}return{projectTargets:i,externalTargets:o}}vs();import{AsyncLocalStorage as qw}from"node:async_hooks";import{performance as Bn}from"node:perf_hooks";var Mw=0,Fw=0,Bw=new qw;function _u(t=0){Mw+=1,Fw+=t;let e=Bw.getStore();e&&(e.gitCommands+=1,e.gitDurationMs+=t)}function ot(t){let e=Bn.now();try{return t()}finally{_u(Bn.now()-e)}}async function xu(t){let e=Bn.now();try{return await t()}finally{_u(Bn.now()-e)}}var Ms=He(Ie(),1);At();import{execFileSync as yf}from"child_process";import{promises as rv}from"fs";import vf from"path";import be from"path";import{promises as Jy}from"node:fs";import{AsyncLocalStorage as Yy}from"node:async_hooks";ls();import{randomUUID as iy}from"node:crypto";import{promises as st}from"node:fs";import Mu from"node:os";import qu from"node:path";import{promises as ju}from"node:fs";import{execFile as zw,execFileSync as Jw}from"node:child_process";import gr from"node:path";import{existsSync as Uw}from"node:fs";import hr from"node:path";var Gw=/[&|<>()^%"!\r\n]/u,ZC=["$ProgressPreference = 'SilentlyContinue'","$encoded = $env:COMET_COMMAND_PAYLOAD","Remove-Item Env:COMET_COMMAND_PAYLOAD -ErrorAction SilentlyContinue","$json = [Text.Encoding]::UTF8.GetString([Convert]::FromBase64String($encoded))","$payload = ConvertFrom-Json $json","$commandArgs = @($payload.arguments)","& $payload.command @commandArgs","if ($null -eq $LASTEXITCODE) { if ($?) { exit 0 } else { exit 1 } }","exit $LASTEXITCODE"].join("; ");function Pu(t,e){let r=e.toLowerCase();return Object.entries(t).find(([n,i])=>n.toLowerCase()===r&&i!==void 0)?.[1]}function Kw(t){let e=(Pu(t,"PATHEXT")??".COM;.EXE;.BAT;.CMD").split(";").map(r=>r.trim().toLowerCase()).filter(Boolean);return[...new Set([...e,".ps1"])]}function Hw(t,e,r){let i=hr.win32.isAbsolute(t)||/[\\/]/u.test(t)?[""]:(Pu(e,"PATH")??"").split(hr.delimiter).map(a=>a.trim().replace(/^"(.*)"$/u,"$1")).filter(Boolean),s=hr.win32.extname(t)?[t]:Kw(e).map(a=>`${t}${a}`);return i.flatMap(a=>s.map(c=>a?hr.join(a,c):hr.resolve(r,c)))}function Un(t,e,r){return Hw(t,e,r).find(n=>Uw(n))??t}function bs(t){if(t.some(e=>Gw.test(e)))throw new Error("Windows batch check arguments must not contain shell syntax")}var Ru=6e4,Ou=8*1024*1024;async function Ge(t,e,r={}){let n=r.timeoutMs??Ru,i=r.maxBufferBytes??Ou;if(!Number.isSafeInteger(n)||n<1||!Number.isSafeInteger(i)||i<1)throw new Error("External command limits must be positive integers");let o=gr.resolve(r.cwd??process.cwd()),s=r.env??process.env,a=process.platform==="win32"?Un(t,s,o):t,c=process.platform==="win32"&&/\.(?:bat|cmd)$/iu.test(a);c&&bs(e);let l=()=>new Promise((u,f)=>{let d=!1,p=zw(a,[...e],{cwd:o,env:s,encoding:"utf8",maxBuffer:i,windowsHide:!0,shell:c},(y,b,k)=>{d||(d=!0,clearTimeout(g),r.signal?.removeEventListener("abort",m),y?f(new ve(t,e,k.trim(),{cause:y,timedOut:Au(y)})):u(b))}),h=y=>{d||(d=!0,clearTimeout(g),r.signal?.removeEventListener("abort",m),p.kill("SIGKILL"),p.stdin?.destroy(),p.stdout?.destroy(),p.stderr?.destroy(),p.unref(),f(new ve(t,e,"",{timedOut:y})))},m=()=>h(!1),g=setTimeout(()=>h(!0),n);r.signal?.addEventListener("abort",m,{once:!0}),r.signal?.aborted&&m(),p.stdin?.end(r.input)});return/^(?:git|git\.exe)$/iu.test(gr.win32.basename(t))?xu(l):l()}var ve=class extends Error{constructor(r,n,i,o){super(`${r} ${n.join(" ")} failed${i?`: ${i}`:""}`,o);this.command=r;this.args=n;this.stderr=i;this.name="ExternalCommandError",this.timedOut=o?.timedOut===!0}command;args;stderr;timedOut};function Au(t){return t instanceof Error&&(t.code==="ETIMEDOUT"||t.killed===!0&&t.signal==="SIGTERM")}function Tu(t,e,r={}){let n=r.timeoutMs??Ru,i=r.maxBufferBytes??Ou;if(!Number.isSafeInteger(n)||n<1)throw new Error("External command timeout must be a positive integer");if(!Number.isSafeInteger(i)||i<1)throw new Error("External command max buffer must be a positive integer");let o=gr.resolve(r.cwd??process.cwd()),s=r.env??process.env,a=process.platform==="win32"?Un(t,s,o):t,c=gr.win32.extname(a).toLowerCase(),l=c===".bat"||c===".cmd";process.platform==="win32"&&l&&bs(e);try{let u=()=>Jw(a,[...e],{cwd:o,env:s,...r.input!==void 0?{input:r.input}:{},encoding:"utf8",stdio:[r.input===void 0?"ignore":"pipe","pipe","pipe"],timeout:n,maxBuffer:i,windowsHide:!0,shell:process.platform==="win32"&&l});return/^(?:git|git\.exe)$/iu.test(gr.win32.basename(t))?ot(u):u()}catch(u){let f=typeof u.stderr=="string"?u.stderr.trim():Buffer.isBuffer(u.stderr)?u.stderr.toString("utf8").trim():"";throw new ve(t,e,f,{cause:u,timedOut:Au(u)})}}import{createHash as Cs,randomUUID as Yw}from"node:crypto";import{promises as ee}from"node:fs";import Vw from"node:os";import z from"node:path";var Iu=`using System;
|
|
144
|
+
using System.Runtime.InteropServices;
|
|
145
|
+
class CometProcessIdentity {
|
|
146
|
+
[DllImport("kernel32.dll")] static extern IntPtr OpenProcess(uint access, bool inherit, int pid);
|
|
147
|
+
[DllImport("kernel32.dll")] static extern bool GetProcessTimes(IntPtr process, out long creation, out long exit, out long kernel, out long user);
|
|
148
|
+
[DllImport("kernel32.dll")] static extern bool CloseHandle(IntPtr handle);
|
|
149
|
+
static int Main(string[] args) {
|
|
150
|
+
int pid; if(args.Length != 1 || !int.TryParse(args[0], out pid) || pid <= 0) return 1;
|
|
151
|
+
IntPtr handle=OpenProcess(0x1000, false, pid); if(handle == IntPtr.Zero) return 1;
|
|
152
|
+
try { long creation, exit, kernel, user; if(!GetProcessTimes(handle,out creation,out exit,out kernel,out user)) return 1;
|
|
153
|
+
Console.WriteLine(DateTime.FromFileTimeUtc(creation).Ticks.ToString(System.Globalization.CultureInfo.InvariantCulture)); return 0;
|
|
154
|
+
} finally { CloseHandle(handle); }
|
|
155
|
+
}
|
|
156
|
+
}`,Xw=Cs("sha256").update(Iu).digest("hex"),Qw=1e4,Gn=new Map;async function ks(t,e){let r=await ee.lstat(t,{bigint:!0});if(!r.isFile()||r.isSymbolicLink()||r.size>BigInt(e))throw new Error("Invalid process probe cache");let n=await ee.readFile(t),i=await ee.lstat(t,{bigint:!0});if(r.ino!==i.ino||r.ctimeNs!==i.ctimeNs||r.size!==i.size)throw new Error("Process probe cache changed");return n}async function Lu(t){try{let e=JSON.parse((await ks(z.join(t,"probe.json"),4096)).toString("utf8"));if(!/^probe-[a-f0-9-]+\.exe$/u.test(e.file??""))return null;let r=z.join(t,e.file),n=await ks(r,65536);return Cs("sha256").update(n).digest("hex")===e.hash?r:null}catch{return null}}async function Zw(t,e){let r,n=Yw(),i=z.join(t,`probe-${n}.cs`),o=z.join(t,`probe-${n}.exe`),s=z.join(t,`probe-${n}.json`);try{if(await ee.mkdir(t,{recursive:!0,mode:448}),(await ee.lstat(t)).isSymbolicLink())return null;r=await ee.open(z.join(t,"prepare.lock"),"wx",384);let a=await Lu(t);if(a)return a;await ee.writeFile(i,Iu,{flag:"wx",mode:384});let c;for(let u of["Framework64","Framework"]){let f=z.join(e,"Microsoft.NET",u,"v4.0.30319","csc.exe");try{await ee.access(f),c=f;break}catch{}}if(!c)return null;await Ge(c,["/nologo","/target:exe","/platform:anycpu",`/out:${o}`,i],{timeoutMs:1500,maxBufferBytes:4096});let l=Cs("sha256").update(await ks(o,65536)).digest("hex");return await ee.writeFile(s,JSON.stringify({file:z.basename(o),hash:l}),{flag:"wx",mode:384}),await ee.rename(s,z.join(t,"probe.json")),o}catch{return null}finally{await ee.unlink(i).catch(()=>{}),await ee.unlink(s).catch(()=>{}),r&&(await r.close().catch(()=>{}),await ee.unlink(z.join(t,"prepare.lock")).catch(()=>{}))}}async function Nu(t,e,r){try{let n=await Ge(z.join(e,"System32","wbem","WMIC.exe"),["process","where",`processid=${t}`,"get","creationdate","/value"],{timeoutMs:300,maxBufferBytes:4096,signal:r}),i=/^CreationDate=(\S+)/mu.exec(n);if(i)return`win32-wmic:${i[1]}`}catch{}if(r.aborted)return null;try{let i=(await Ge(z.join(e,"System32","WindowsPowerShell","v1.0","powershell.exe"),["-NoLogo","-NoProfile","-NonInteractive","-Command",`(Get-Process -Id ${t} -ErrorAction Stop).StartTime.ToUniversalTime().Ticks.ToString()`],{timeoutMs:1e3,maxBufferBytes:4096,signal:r})).trim();return/^\d+$/u.test(i)?`win32-ps:${i}`:null}catch{return null}}function ey(t,e){let r=Gn.get(t);if(r&&performance.now()<r.retryAfter)return r.promise;let n={promise:Zw(t,e),retryAfter:1/0};return Gn.set(t,n),n.promise.then(i=>{Gn.get(t)===n&&(i?Gn.delete(t):n.retryAfter=performance.now()+Qw)}),n.promise}async function $u(t,e={}){if(!Number.isSafeInteger(t)||t<=0)return null;let r=e.systemRoot??process.env.SystemRoot??"C:\\Windows",n=z.join(e.cacheRoot??z.join(Vw.tmpdir(),"comet-process-identity"),Xw),i=async l=>{if(!l)return null;try{let f=(await Ge(l,[String(t)],{timeoutMs:1e3,maxBufferBytes:4096})).trim();return/^\d+$/u.test(f)?`win32-ps:${f}`:null}catch{return null}},o=await Lu(n);if(o){let l=await i(o);return l||Nu(t,r,new AbortController().signal)}let s=ey(n,r),a=new AbortController,c=l=>{if(!l)throw new Error("Probe unavailable");return l};try{return await Promise.any([s.then(i).then(c),Nu(t,r,a.signal).then(c)])}catch{return null}finally{a.abort()}}var Ss=null,ty=1e4,Es=new Map,Kn=new Map;function ry(t){let e=Es.get(t);if(e){if(Date.now()-e.at>ty){Es.delete(t);return}return e.value}}async function _s(t){if(t===process.pid&&Ss!==null)return Ss;let e=ry(t);if(e!==void 0)return e;let r=Kn.get(t);r||(r=ny(t),Kn.set(t,r));let n=await r;return Kn.get(t)===r&&Kn.delete(t),t===process.pid&&n!==null&&(Ss=n),n===null&&Es.set(t,{value:null,at:Date.now()}),n}async function ny(t){if(!Number.isSafeInteger(t)||t<=0)return null;try{if(process.platform==="linux"){let[e,r]=await Promise.all([ju.readFile(`/proc/${t}/stat`,"utf8"),ju.readFile("/proc/sys/kernel/random/boot_id","utf8")]),n=e.slice(e.lastIndexOf(")")+2).trim().split(/\s+/u)[19];return/^\d+$/u.test(n??"")?`linux:${r.trim()}:${n}`:null}if(process.platform==="win32")return await $u(t);if(process.platform==="darwin"){let e=(await Ge("/bin/ps",["-p",String(t),"-o","lstart="],{timeoutMs:5e3,maxBufferBytes:4096,env:{...process.env,LC_ALL:"C",TZ:"UTC0"}})).trim();return e?`darwin:${e}`:null}}catch{}return null}var Wu=new Set(["win32-wmic","win32-ps"]);function Hn(t){let e=t.indexOf(":");return e===-1?"":t.slice(0,e)}async function Du(t,e){if(!Number.isSafeInteger(t)||t<=0)return"alive";try{process.kill(t,0)}catch(n){if(n.code==="ESRCH")return"dead"}if(!e)return"unknown";let r=await _s(t);return r===e?"alive":r===null||Hn(r)!==Hn(e)&&Wu.has(Hn(r))&&Wu.has(Hn(e))?"unknown":"dead"}var oy=3e4,sy=20,ay=5*6e4,cy=1e4;async function Fu(t,e,r={}){let n=qu.resolve(t);await st.mkdir(qu.dirname(n),{recursive:!0});let i=Date.now(),o=r.timeoutMs??oy,s=r.retryMs??sy,a=r.malformedLockStaleMs??ay,c=await _s(process.pid),l={pid:process.pid,nonce:iy(),createdAt:Date.now(),hostname:Mu.hostname(),...c===null?{}:{processIdentity:c}},u=!1;for(;!u;){let f;try{f=await st.open(n,"wx"),await f.writeFile(JSON.stringify(l),"utf8"),u=!0}catch(d){if(d.code!=="EEXIST")throw d;if(await ly(n,a))continue;if(Date.now()-i>=o)throw new Error(`Timed out waiting for file lock: ${n}`,{cause:d});await new Promise(p=>setTimeout(p,s))}finally{await f?.close()}}try{return await e()}finally{await uy(n,l.nonce)}}async function ly(t,e){let r,n;try{[r,n]=await Promise.all([st.readFile(t,"utf8"),st.stat(t)])}catch(o){return o.code==="ENOENT"}let i=Bu(r);if(i!==null&&(i.hostname!==void 0&&i.hostname!==Mu.hostname()||await Du(i.pid,i.processIdentity)!=="dead"))return!1;if(i===null){let o=r.trim().length===0?cy:e;if(Date.now()-Number(n.mtimeMs)<o)return!1}try{return await st.readFile(t,"utf8")!==r?!1:(await st.rm(t),!0)}catch(o){return o.code==="ENOENT"}}async function uy(t,e){try{if(Bu(await st.readFile(t,"utf8"))?.nonce!==e)return;await $n(t)}catch(r){let n=r.code;if(n==="ENOENT")return;process.stderr.write(`[comet] warning: could not remove lock file ${t} (${n??r}); it will be recovered automatically
|
|
157
|
+
`)}}function Bu(t){try{let e=JSON.parse(t);return Number.isSafeInteger(e.pid)&&Number(e.pid)>0&&typeof e.nonce=="string"&&e.nonce.length>0&&typeof e.createdAt=="number"&&Number.isFinite(e.createdAt)&&(e.hostname===void 0||typeof e.hostname=="string"&&e.hostname.length>0)&&(e.processIdentity===void 0||typeof e.processIdentity=="string"&&e.processIdentity.length>0)?{pid:Number(e.pid),nonce:e.nonce,createdAt:e.createdAt,...e.hostname===void 0?{}:{hostname:e.hostname},...e.processIdentity===void 0?{}:{processIdentity:e.processIdentity}}:null}catch{return null}}X();var ei=He(Ie(),1);ce();X();Xn();var js=["full","hotfix","tweak"],lf=1,ff=["open","design","build","verify","archive"],Ny=["en","zh-CN"],Iy=["off","beta"],Ly=["subagent-driven-development","executing-plans","direct","autonomous"],$y=["plan-ready"],jy=["confirmed"],Wy=["tdd","direct"],Dy=["off","standard","thorough"],qy=["current","branch","worktree"],My=["light","full"],Fy=["pending","pass","fail"],By=["pending","handled"],Uy=["pending","confirmed"],at=["workflow","language","phase","context_compression","build_mode","build_pause","subagent_dispatch","tdd_mode","review_mode","isolation","bound_branch","verify_mode","auto_transition","base_ref","design_doc","plan","verify_result","verify_failures","check_epoch","verification_report","branch_status","created_at","verified_at","archive_confirmation","archived","direct_override","handoff_context","handoff_hash","classic_profile","classic_migration"],vr=["run_id"],df=new Set([...at,...vr]),Gy=["workflow","phase","design_doc","plan","build_mode","isolation","verify_mode","verify_result","verified_at","archived"];function Ls(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function _t(t,e){let r=t[e];if(r==null||r==="")return null;if(typeof r!="string")throw new Error(`Invalid Classic state: ${e} must be a string or null`);return r}function B(t,e,r,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!="string"||!r.includes(i))throw new Error(`Invalid Classic state: ${e} must be one of ${r.join(", ")}${n?" or null":""}`);return i}function $s(t,e,r=!0){let n=t[e];if(n==null||n===""){if(r)return null;throw new Error(`Invalid Classic state: ${e} is required`)}if(typeof n!="boolean")throw new Error(`Invalid Classic state: ${e} must be true or false`);return n}function uf(t,e,r=0){let n=t[e];if(n==null||n==="")return r;if(typeof n!="number"||!Number.isSafeInteger(n)||n<0)throw new Error(`Invalid Classic state: ${e} must be a non-negative integer`);return n}function Qn(t,e){let r=_t(t,e);if(r===null)return null;if(/^(?:[A-Za-z]:|[\\/]|~)/u.test(r)||r.split(/[\\/]/u).includes(".."))throw new Error(`Invalid Classic state: ${e} must be a relative repository path`);return r}function Ky(t,e){let r=_t(t,e);if(r!==null&&!/^[a-f0-9]{64}$/u.test(r))throw new Error(`Invalid Classic state: ${e} must be a sha256 hex digest`);return r}function Hy(t){let e=t.classic_migration;if(e==null||e==="")return null;if(e!==lf)throw new Error(`Invalid Classic state: classic_migration must be ${lf}`);return e}function zy(t){if(!at.some(r=>Ls(t,r)))return null;for(let r of Gy)if(!Ls(t,r))return null;return{workflow:B(t,"workflow",js,!1),language:B(t,"language",Ny),phase:B(t,"phase",ff,!1),contextCompression:B(t,"context_compression",Iy),buildMode:B(t,"build_mode",Ly),buildPause:B(t,"build_pause",$y),subagentDispatch:B(t,"subagent_dispatch",jy),tddMode:B(t,"tdd_mode",Wy),reviewMode:B(t,"review_mode",Dy),isolation:B(t,"isolation",qy),boundBranch:_t(t,"bound_branch"),verifyMode:B(t,"verify_mode",My),autoTransition:$s(t,"auto_transition"),baseRef:_t(t,"base_ref"),designDoc:Qn(t,"design_doc"),plan:Qn(t,"plan"),verifyResult:B(t,"verify_result",Fy,!1),verifyFailures:uf(t,"verify_failures"),...Ls(t,"check_epoch")?{checkEpoch:uf(t,"check_epoch")}:{},verificationReport:Qn(t,"verification_report"),branchStatus:B(t,"branch_status",By),createdAt:_t(t,"created_at"),verifiedAt:_t(t,"verified_at"),archiveConfirmation:B(t,"archive_confirmation",Uy),archived:$s(t,"archived",!1),directOverride:$s(t,"direct_override"),handoffContext:Qn(t,"handoff_context"),handoffHash:Ky(t,"handoff_hash"),classicProfile:B(t,"classic_profile",js),classicMigration:Hy(t)}}function Ws(t,e){let r=e??null;if(r===null&&e===void 0&&t.run_id&&t.skill)try{r=St(t)}catch(n){let i=n instanceof Error?n.message:String(n);throw new Error(i.replace(/^Invalid Run state:/u,"Invalid Classic state:"),{cause:n})}return{classic:zy(t),run:r,unknownKeys:Object.keys(t).filter(n=>!df.has(n))}}function mf(t){let e=t.workflow,r=t.phase,n=t.archived,i=t.design_doc;return{workflow:typeof e=="string"&&js.includes(e)?e:null,phase:typeof r=="string"&&ff.includes(r)?r:null,archived:n===!0,designDoc:typeof i=="string"&&i!==""?i:null,unknownKeys:Object.keys(t).filter(o=>!df.has(o))}}Xn();var Ds=new Yy,Zn=".comet-state-transaction.json";async function ti(t,e){let r=be.resolve(t);return Ds.getStore()===r?e():(await $(r,".comet-state.lock",{label:"Classic state lock",expected:"file"}),Fu(be.join(r,".comet-state.lock"),()=>Ds.run(r,async()=>(await Xy(r),e()))))}async function pf(t,e){try{return(await j(t,e,Number.MAX_SAFE_INTEGER,{label:"Classic state transaction"})).bytes.toString("utf8")}catch(r){if(r.code==="ENOENT")return null;throw r}}function Vy(t){if(t===null)return null;if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Invalid Classic transaction Run");let e=t,r=St({run_id:e.runId,skill:e.skill,skill_version:e.skillVersion,skill_hash:e.skillHash,orchestration:e.orchestration,current_step:e.currentStep,iteration:e.iteration,pending:e.pending,pending_ref:e.pendingRef,trajectory_ref:e.trajectoryRef,context_ref:e.contextRef,artifacts_ref:e.artifactsRef,checkpoint_ref:e.checkpointRef,run_status:e.status,run_retries:e.retries});if(!r)throw new Error("Invalid Classic transaction Run identity");return r}async function Xy(t){let e=await pf(t,Zn);if(e===null)return;let r=JSON.parse(e);if(!r||r.schema!=="comet.classic.state-transaction.v1"||r.beforeYaml!==null&&typeof r.beforeYaml!="string"||typeof r.afterYaml!="string")throw new Error("Invalid Classic state transaction");let n=await pf(t,".comet.yaml");if(n!==r.beforeYaml&&n!==r.afterYaml)throw new Error("Classic state transaction conflicts with current YAML; preserve files for recovery");let i=Vy(n===r.afterYaml?r.afterRun:r.beforeRun);i?await Vn(t,i):await Is(t),await fr(be.join(t,Zn),{containedRoot:t})}function Pt(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 Qy(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 r of e)t.delete(r)}function Zy(t){let e=!1;for(let r of["build_command","verify_command"])t.has(r)&&(t.delete(r),e=!0);return e}async function qs(t){let e;try{e=(await j(be.dirname(t),be.basename(t),Number.MAX_SAFE_INTEGER,{label:"Classic state document"})).bytes.toString("utf8")}catch(n){if(n.code!=="ENOENT")throw n;return new ei.Document({})}let r=(0,ei.parseDocument)(e);if(r.errors.length>0)throw new Error(`Invalid Classic state document: ${r.errors[0].message}`);return Pt(r),r}async function br(t,e={}){if(Ds.getStore()!==be.resolve(t)){let r=await ev(t);if(r!==null)return r}return ti(t,()=>tv(t,e))}async function xt(t,e){let r=await $(t,e,{label:"Classic state snapshot",expected:"file"});if(!r.exists)return{stamp:"missing",comparable:!0};let n=await Jy.lstat(r.target,{bigint:!0});if(!n.isFile()||n.isSymbolicLink())throw new Error("Classic state file changed");return{stamp:[n.dev,n.ino,n.birthtimeNs,n.ctimeNs,n.mtimeNs,n.size].join(":"),comparable:n.dev!==0n&&n.ino!==0n&&n.ctimeNs>0n}}async function hf(t){if((await xt(t,".comet-state.lock")).stamp!=="missing"||(await xt(t,Zn)).stamp!=="missing")return null;let n=await xt(t,".comet.yaml"),i=await xt(t,Et);return!n.comparable||!i.comparable?null:{yaml:n.stamp,run:i.stamp}}async function ev(t){try{let e=await hf(t);if(e===null)return null;let r=await qs(be.join(t,".comet.yaml")),n=Pt(r);if(r.has("build_command")||r.has("verify_command"))return null;let i=await Yn(t);if(!i&&n.run_id&&n.skill)return null;let o=Ws(n,i),s=await hf(t);return s===null||e.yaml!==s.yaml||e.run!==s.run||(await xt(t,Zn)).stamp!=="missing"||(await xt(t,".comet-state.lock")).stamp!=="missing"?null:o}catch{return null}}async function tv(t,e){let r=e.migrate!==!1,n=be.join(t,".comet.yaml"),i=await qs(n),o=Pt(i),s=Zy(i);s&&(o=Pt(i));let a=await Yn(t);if(!a&&o.run_id&&o.skill){let{runStateFromDocument:c}=await Promise.resolve().then(()=>(Xn(),cf));a=c(o),a&&r&&(await Vn(t,a),Qy(i),s=!0)}return s&&r&&await Q(n,i.toString(),{containedRoot:t}),Ws(Pt(i),a)}async function gf(t){let e=await qs(be.join(t,".comet.yaml"));return mf(Pt(e))}ce();X();function nv(t){try{let e=ot(()=>yf("git",["rev-parse","--abbrev-ref","HEAD"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"],timeout:1e4,windowsHide:!0}).trim());return e&&e!=="HEAD"?e:null}catch{return null}}var iv=mi("liveGitBranch",t=>nv(t));function ov(t){try{return ot(()=>yf("git",["rev-parse","--is-inside-work-tree"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"],timeout:1e4,windowsHide:!0}).trim())==="true"}catch{return!1}}var sv=mi("isGitWorkTree",t=>ov(t)),av=["current","branch","worktree"];function bf(t){return av.includes(t)}function cv(t){return bf(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 kr(t,e){return e.heal?ti(t,()=>wf(t,e)):wf(t,e)}async function wf(t,e){let r=vf.join(t,".comet.yaml"),n=(0,Ms.parseDocument)(await rv.readFile(r,"utf8"),{uniqueKeys:!1});if(n.errors.length>0)throw new Error(`Invalid .comet.yaml: ${n.errors[0].message}`);let i=n.toJS()??{},o=typeof i.isolation=="string"?i.isolation:null,s=typeof i.bound_branch=="string"&&i.bound_branch!==""?i.bound_branch:null,a=bf(o),c=iv(e.cwd),l=a&&s===null&&c===null?sv(e.cwd):!0,u=cv({isolation:o,boundBranch:s,currentBranch:c,gitWorkTree:l});return u.status==="needs-heal"&&e.heal?(await lv(t,u.branch),{status:"healed",branch:u.branch,bindingRequired:a,currentBranch:c}):{...u,bindingRequired:a,currentBranch:c}}async function lv(t,e){return ti(t,()=>uv(t,e))}async function uv(t,e){let r=vf.join(t,".comet.yaml"),n=(await j(t,".comet.yaml",hs,{label:"Classic branch binding"})).bytes.toString("utf8"),i=(0,Ms.parseDocument)(n,{uniqueKeys:!1});if(i.errors.length)throw new Error(`Invalid .comet.yaml: ${i.errors[0].message}`);i.set("bound_branch",e),await Q(r,i.toString(),{containedRoot:t})}function fv(t){return t??"detached HEAD"}function Cr(t,e,r){return`change '${t}' is bound to branch '${e}', but current branch is '${fv(r)}'. Next: switch to branch '${e}' and rerun, or run comet state rebind ${t} after the user explicitly confirms this branch should take over the change`}function Sr(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.`}Ts();At();var _f=He(Ie(),1);import ue from"node:path";import{createHash as ii,randomUUID as a_}from"node:crypto";var dv=new Set(["GIT_DIR","GIT_WORK_TREE","GIT_COMMON_DIR","GIT_INDEX_FILE","GIT_OBJECT_DIRECTORY","GIT_ALTERNATE_OBJECT_DIRECTORIES","GIT_GRAFT_FILE","GIT_SHALLOW_FILE","GIT_PREFIX","GIT_IMPLICIT_WORK_TREE","GIT_NO_REPLACE_OBJECTS","GIT_REPLACE_REF_BASE","GIT_CONFIG","GIT_CONFIG_PARAMETERS","GIT_CONFIG_COUNT"]);function mv(t=process.env){return Object.fromEntries(Object.entries(t).filter(([e])=>{let r=e.toUpperCase();return!dv.has(r)&&!/^GIT_CONFIG_(KEY|VALUE)_\d+$/u.test(r)}))}function kf(t){return{...mv(t.environment),...t.authentication?{}:{GIT_CONFIG_GLOBAL:process.platform==="win32"?"NUL":"/dev/null",GIT_CONFIG_NOSYSTEM:"1"},GIT_TERMINAL_PROMPT:"0",GCM_INTERACTIVE:"never",SSH_ASKPASS_REQUIRE:"never",GIT_NO_REPLACE_OBJECTS:"1",GH_PROMPT_DISABLED:"1"}}function ct(t){if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Classic progress requires a JSON object");return t}function Bs(t,e){let r=Object.keys(t).filter(n=>!e.includes(n));if(r.length)throw new Error(`Unknown Classic progress field(s): ${r.join(", ")}; allowed fields: ${e.join(", ")}`)}function le(t,e){if(typeof t!="string"||!t.trim()||t.length>4096||[...t].some(r=>r.charCodeAt(0)<32||r.charCodeAt(0)===127))throw new Error(`Invalid Classic progress ${e}`);return t}async function pv(t,e,r){let n=ue.join(e,".comet",r);if(await nt(t,n,{label:"Classic progress",expected:"file"}))return JSON.parse(await Ue(t,n,{label:"Classic progress"}))}function hv(t,e){let r=ii("sha256").update(e).digest("hex");return ue.join(t,".comet","runtime","classic-delivery",`${r}.json`)}async function gv(t,e){let r=hv(t,e);if(!await nt(t,r,{label:"Classic delivery reauthorization",expected:"file"}))return null;let n=ct(JSON.parse(await Ue(t,r,{label:"Classic delivery reauthorization"})));if(Bs(n,["schemaVersion","changeIdentity","previousAuthorizationId","authorizationId","action","targetBranch","remote","authorizedRemoteUrl"]),n.schemaVersion!==1||n.changeIdentity!==e)throw new Error("Classic delivery reauthorization identity is invalid");let i=Us({action:n.action,targetBranch:n.targetBranch,...n.remote===void 0?{}:{remote:n.remote}},!0);if(i.commit!==void 0||i.prUrl!==void 0)throw new Error("Classic delivery reauthorization cannot change sealed commit or PR evidence");return{schemaVersion:1,changeIdentity:e,previousAuthorizationId:le(n.previousAuthorizationId,"previousAuthorizationId"),authorizationId:le(n.authorizationId,"authorizationId"),...i,...n.authorizedRemoteUrl===void 0?{}:{authorizedRemoteUrl:le(n.authorizedRemoteUrl,"authorizedRemoteUrl")}}}function Us(t,e=!1){let r=ct(t);if(Bs(r,["action","targetBranch","remote","commit","prUrl",...e?["schemaVersion","changeIdentity","authorizedRemoteUrl","authorizationId"]:[]]),!["local","push","pr"].includes(r.action))throw new Error(`Invalid Classic delivery action '${String(r.action)}'; actions: local|push|pr`);let n=le(r.targetBranch,"targetBranch");if(n.startsWith("-")||/[~^:?*[\\\s]/u.test(n)||n.includes("..")||n.includes("@{"))throw new Error("Invalid Classic delivery targetBranch");let i={action:r.action,targetBranch:n};if(r.remote!==void 0){let o=le(r.remote,"remote");if(!/^[a-zA-Z0-9][a-zA-Z0-9._-]{0,99}$/u.test(o))throw new Error("Classic delivery remote must be a name, not a URL");i.remote=o}if(r.commit!==void 0){let o=le(r.commit,"commit");if(!/^(?:[a-fA-F0-9]{40}|[a-fA-F0-9]{64})$/u.test(o))throw new Error("Classic delivery commit must be a full object ID");i.commit=o.toLowerCase()}if(r.prUrl!==void 0){let o=le(r.prUrl,"prUrl"),s=new URL(o);if(s.protocol!=="https:"||s.username||s.password)throw new Error("Invalid Classic delivery prUrl");i.prUrl=o}return i}function xf(t){let e=(0,_f.parseDocument)(t,{uniqueKeys:!0});if(e.errors.length)throw new Error("Invalid Classic delivery change state");return ct(e.toJS())}function Pf(t,e){if(typeof t.run_id=="string"&&t.run_id)return`run:${t.run_id}`;let r=t.archived===!0?ue.basename(e).replace(/^\d{4}-\d{2}-\d{2}-/u,""):ue.basename(e);if(typeof t.created_at!="string"||typeof t.base_ref!="string")throw new Error("Classic delivery requires stable change identity");return`legacy:${ii("sha256").update(JSON.stringify([r,t.created_at,t.base_ref])).digest("hex")}`}async function wv(t,e){return xf(await Ue(t,ue.join(e,".comet.yaml"),{label:"Classic delivery state"}))}var ni=class extends Error{constructor(e,r){super(`Classic delivery git command timed out: ${[e,...r].join(" ")}`)}};function Fs(t,e,r,n){return Tu(e,r,{cwd:t,timeoutMs:5e3,env:kf({authentication:n})}).trim()}function xr(t,e,r,n=!1){try{return Fs(t,e,r,n)}catch{return null}}function yv(t,e,r,n=!1){try{return Fs(t,e,r,n)}catch(i){if(!(i instanceof ve)||!i.timedOut)return null;try{return Fs(t,e,r,n)}catch(o){if(o instanceof ve&&o.timedOut)throw new ni(e,r);return null}}}function Er(t,e){return xr(t,"git",["-C",t,...e])}function _r(t,e){return yv(t,"git",["-C",t,...e])}function Cf(t,e,r=!1){return xr(t,"git",["-C",t,"remote","get-url",...r?["--push"]:[],e],!0)}function vv(t,e){let r=ue.relative(t,e).replaceAll("\\","/");return[`:(literal)${r}`,...[".comet-state.lock",".comet-state-transaction.json"].map(n=>`:(exclude,literal)${r}/${n}`)]}function Sf(t,e,r,n){let i=ue.relative(t,e).replaceAll("\\","/"),o=vv(t,e),s=_r(t,["show",`${r}:${i}/.comet.yaml`]);if(!s)return!1;try{let a=xf(s);return a.archived===!0&&Pf(a,e)===n&&_r(t,["merge-base","--is-ancestor",r,"HEAD"])!==null&&_r(t,["diff","--quiet","--no-ext-diff","--no-textconv",r,"--",...o])!==null&&_r(t,["ls-files","--others","--exclude-standard","--",...o])===""}catch(a){if(a instanceof ni)throw a;return!1}}function bv(t,e){let r=`${ii("sha256").update(e).digest("hex")}.json`,n=_r(t,["rev-parse","--path-format=absolute","--git-common-dir"]);return[{root:t,file:ue.join(t,".comet","classic-deliveries",r)},...n?[{root:n,file:ue.join(n,"comet","classic-deliveries",r)}]:[]]}async function kv(t,e){let r=null;for(let n of bv(t,e)){if(!await nt(n.root,n.file,{label:"Classic delivery receipt",expected:"file"}))continue;let i=ct(JSON.parse(await Ue(n.root,n.file,{label:"Classic delivery receipt"})));if(Bs(i,["schemaVersion","changeIdentity","authorizationId","invalidated","commit","prUrl"]),i.schemaVersion!==1||i.changeIdentity!==e)throw new Error("Invalid Classic delivery receipt schema or identity");if(i.invalidated!==void 0&&typeof i.invalidated!="boolean")throw new Error("Invalid Classic delivery receipt invalidation");let o=Us({action:"local",targetBranch:"main",...i.commit!==void 0?{commit:i.commit}:{},...i.prUrl!==void 0?{prUrl:i.prUrl}:{}}),s={schemaVersion:1,changeIdentity:e,authorizationId:le(i.authorizationId,"authorizationId"),...i.invalidated===!0?{invalidated:!0}:{},...o.commit?{commit:o.commit}:{},...o.prUrl?{prUrl:o.prUrl}:{}};if(r&&JSON.stringify(r)!==JSON.stringify(s))throw new Error("Conflicting Classic delivery receipts");r=s}return r}function Cv(t){return t.authorizationId===void 0?`legacy:${ii("sha256").update(JSON.stringify(t)).digest("hex")}`:le(t.authorizationId,"authorizationId")}function Ef(t,e,r){return e===r||Er(t,["merge-base","--is-ancestor",e,r])!==null}function Sv(t){let e=/^git@([^:/]+):([^/]+\/[^/]+)$/u.exec(t);try{let r=new URL(e?`ssh://git@${e[1]}/${e[2]}`:t);if(!["https:","ssh:"].includes(r.protocol)||r.password||r.search||r.hash||r.port||r.protocol==="https:"&&r.username)return null;let n=r.pathname.replace(/\.git\/?$/u,"").replace(/\/$/u,"").split("/").filter(Boolean);return n.length!==2||n.some(i=>!/^[a-zA-Z0-9_.-]+$/u.test(i))?null:`${r.hostname}/${n.join("/")}`.toLowerCase()}catch{return null}}function ri(t,e){try{let r=new URL(t);if(r.protocol!=="https:"||r.username||r.password||r.port||r.search||r.hash)return null;let n=/^\/([^/]+)\/([^/]+)\/pull\/([1-9]\d*)\/?$/u.exec(r.pathname);return n&&`${r.hostname}/${n[1]}/${n[2]}`.toLowerCase()===e?`https://${r.hostname}/${n[1]}/${n[2]}/pull/${n[3]}`:null}catch{return null}}async function Gs(t,e,r={}){let n=await pv(t,e,"delivery.json");if(n===void 0)return{delivery:null,verification:{status:"needsAuthorization"}};let i=ct(n);if(i.schemaVersion!==1)throw new Error("Unsupported Classic delivery schemaVersion");let o=Us(i,!0),s=await wv(t,e),a=Pf(s,e);if(i.changeIdentity!==a)throw new Error("Classic delivery change identity mismatch");let c=Cv(i),l=await gv(t,a);if(l&&l.previousAuthorizationId!==c)throw new Error("Classic delivery reauthorization is stale for the sealed authorization");let u=l?{action:l.action,targetBranch:l.targetBranch,...l.remote===void 0?{}:{remote:l.remote}}:o,f=l?.authorizationId??c,d=await kv(t,a),p=d?.authorizationId===f?d:null;if(p?.invalidated)return{delivery:null,verification:{status:"needsAuthorization",invalidated:!0}};for(let M of["commit","prUrl"]){if(M==="commit"&&p?.[M]&&u[M]&&p[M]!==u[M])throw new Error("Classic delivery receipt conflicts with authorization evidence");p?.[M]&&(u[M]=p[M])}let h=i.authorizedRemoteUrl===void 0?void 0:le(i.authorizedRemoteUrl,"authorizedRemoteUrl"),m=l?.authorizedRemoteUrl??h,g={...u,schemaVersion:1,changeIdentity:a,authorizationId:f,...m?{authorizedRemoteUrl:m}:{}},y=Er(t,["symbolic-ref","--quiet","--short","HEAD"]),b=ue.relative(t,e).replaceAll("\\","/"),k=null;!u.commit&&s.archived===!0&&(k=Er(t,["log","-20","--format=%H","HEAD","--",`:(literal)${b}/.comet.yaml`])?.split(/\r?\n/u).find(ke=>/^[a-f0-9]{40,64}$/u.test(ke)&&Sf(t,e,ke,a))??null);let C=u.commit??k,S=!!C&&Er(t,["cat-file","-t",C])==="commit",E=s.archived===!0&&S&&Sf(t,e,C,a),P=y===u.targetBranch&&(!s.bound_branch||l!==null||s.bound_branch===y)&&E,v=!1,O=!1,ne=null,fe=r.verifyRemote&&u.action!=="local"?"unavailable":"notChecked",R="notChecked";if(r.verifyRemote&&P&&u.action!=="local"&&u.remote&&m&&Cf(t,u.remote)===m&&Cf(t,u.remote,!0)===m){let M=`refs/heads/${u.targetBranch}`,ke=xr(t,"git",["-C",t,"-c","protocol.allow=never","-c","protocol.https.allow=always","-c","protocol.ssh.allow=always","-c","protocol.file.allow=always","ls-remote","--refs",u.remote,M],!0),Qs=ke?.split(/\r?\n/u)??[],Zs=Qs.length===1?/^([a-f0-9]{40}|[a-f0-9]{64})\t(.+)$/u.exec(Qs[0]):null,Ot=Zs?.[2]===M?Zs[1]:null;v=!!C&&!!Ot&&Ef(t,C,Ot),fe=v?"verified":ke===""?"missing":ke===null||!Ot||Er(t,["cat-file","-t",Ot])!=="commit"?"unavailable":"missing";let de=Sv(m),ai=de&&u.prUrl?ri(u.prUrl,de):null,ci=v||ke==="",ea=Y=>Y.headRefName===u.targetBranch&&typeof Y.headRefOid=="string"&&/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/u.test(Y.headRefOid)&&(v?Y.headRefOid===Ot&&["OPEN","MERGED"].includes(Y.state):ke===""&&Y.state==="MERGED"&&!!C&&Ef(t,C,Y.headRefOid));if(ci&&u.action==="pr"&&(R="unavailable"),ci&&u.action==="pr"&&ai&&de){let Y=xr(t,"gh",["pr","view",ai,"--repo",de,"--json","url,headRefName,headRefOid,state"],!0);try{let me=Y?ct(JSON.parse(Y)):null;O=!!me&&typeof me.url=="string"&&ri(me.url,de)===ai&&ea(me),R=O?"verified":me?"missing":"unavailable"}catch{O=!1,R="unavailable"}}else if(ci&&u.action==="pr"&&!u.prUrl&&de){let Y=xr(t,"gh",["pr","list","--repo",de,"--head",u.targetBranch,"--state","all","--json","url,headRefName,headRefOid,state","--limit","100"],!0);try{let me=Y===null?null:JSON.parse(Y);if(!Array.isArray(me)||me.length>=100)throw new Error("Incomplete PR discovery");let li=me.map(ct).filter(ui=>typeof ui.url=="string"&&ri(ui.url,de)&&ea(ui));li.length===1?(ne=ri(li[0].url,de),O=!0,R="verified"):R=li.length===0?"missing":"unavailable"}catch{R="unavailable"}}}return{delivery:g,verification:{status:P&&(u.action==="local"||(u.action==="push"?v:O))?"complete":"needsVerification",currentBranch:y,commitExists:S,archiveCommitted:E,observedCommit:k,observedPrUrl:ne,remoteVerified:v,prVerified:O,remoteStatus:fe,prStatus:R}}}var Ev=He(Ie(),1);var p_=8*1024*1024;import{AsyncLocalStorage as Rf}from"node:async_hooks";var S_=new Rf,E_=new Rf;Me();qn();X();we();ce();var _v=Ce("readCometCurrentSelection",t=>As(t));async function xv(t,e){pr(e);let r=await it(e,t);if(!r.stateExists)throw new Error(`Cannot select current change '${e}': active change state not found`);let n=await br(r.directory,{migrate:!1});if(!n.classic)throw new Error(`Cannot select current change '${e}': Classic state is incomplete`);if(n.classic.archived)throw new Error(`Cannot select current change '${e}': change is archived`);return r.directory}async function Of(t){let e;try{e=await _v(t)}catch(o){return{status:"stale",reason:o instanceof Error?o.message:String(o)}}if(e.status==="missing")return{status:"missing"};if(e.selection.workflow!=="classic")return{status:"stale",reason:`current change '${e.selection.change}' belongs to Native, not Classic`};let r=e.selection,n;try{n=await xv(t,r.change)}catch(o){try{let s=await gs(r.change,t);if(!s)throw o;let a=await br(s.directory,{migrate:!1}),c=await Gs(t,s.directory);if(!a.classic?.archived||["complete","local-verified"].includes(c.verification.status))throw o;n=s.directory}catch(s){return{status:"stale",reason:s instanceof Error?s.message:String(s)}}}let i=await kr(n,{heal:!1,cwd:t});return i.status==="drift"?{status:"stale",reason:Cr(r.change,i.boundBranch,i.currentBranch)}:i.status==="unbound-detached"?{status:"stale",reason:Sr(r.change)}:i.status==="ok"?{status:"selected",selection:r}:r.branch!==null&&i.currentBranch!==r.branch?{status:"stale",reason:`current change '${r.change}' was selected on branch '${r.branch}', current branch is '${i.currentBranch??"detached HEAD"}'`}:{status:"selected",selection:r}}function Ks(t){return t==="zh-CN"?"zh-CN":"en"}function Af(t,e,r){return t==="zh-CN"?r:e}function Tf(t,e){let n={open:{en:"Source code edits are paused while the request is still being clarified.",zh:"需求仍在澄清中,暂时不修改源代码。"},design:{en:"Source code edits are paused until the design is agreed and recorded.",zh:"方案确定并记录之前,暂不修改源代码。"},build:{en:"A required design or plan record is missing, so source edits stay paused.",zh:"缺少必需的设计或计划记录,源代码修改暂被搁置。"},verify:{en:"Implementation edits are paused during verification; only verification output is accepted.",zh:"验证期间暂停修改实现,仅接受验证产出。"},archive:{en:"Source code edits are paused while the change is being archived.",zh:"归档期间暂不修改源代码。"}}[t]??{en:"This write is paused by the current workflow stage.",zh:"当前工作流阶段暂不允许这次写入。"};return{summary:Af(e,"This write was blocked on purpose, not by an error.","这次写入是被有意拦下的,不是发生了错误。"),user_message:Af(e,n.en,n.zh)}}function Nf(t){if(t.workflow!=="full")return{missingFields:[],invalidFields:[]};let e=[],r=[];return t.buildMode||e.push("build_mode"),t.tddMode||e.push("tdd_mode"),t.reviewMode||e.push("review_mode"),t.buildMode==="subagent-driven-development"&&t.subagentDispatch!=="confirmed"&&e.push("subagent_dispatch"),t.buildMode==="autonomous"&&t.reviewMode==="off"&&r.push({field:"review_mode",reason:"autonomous full build requires review_mode=standard or thorough"}),t.buildMode==="direct"&&t.directOverride!==!0&&r.push({field:"direct_override",reason:"full workflow direct execution requires direct_override=true"}),{missingFields:e,invalidFields:r}}var If=He(Ie(),1);import lt from"node:path";async function Hs(t,e,r,n={}){if(r.workflow!=="full"||r.buildMode!=="autonomous")return[];let i=[];if(n.requirePlan!==!1){let o=Nf(r);o.missingFields.includes("tdd_mode")&&i.push("tdd_mode must be selected for autonomous full build"),o.missingFields.includes("review_mode")&&i.push("review_mode must be selected for autonomous full build"),o.invalidFields.some(({field:s})=>s==="review_mode")&&i.push("review_mode must be standard or thorough for autonomous full build"),r.isolation||i.push("isolation must be selected for autonomous full build")}if(!r.designDoc||!await wu(t,r.designDoc,"Classic autonomous design"))i.push("design_doc must reference a nonempty technical design for autonomous full build");else{let s=(await Ue(t,r.designDoc,{label:"Classic autonomous design"})).replace(/^\uFEFF/u,"").match(/^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/u),a=s?(0,If.parseDocument)(s[1]):null;(!a||a.errors.length||a.get("comet_change")!==e||a.get("role")!=="technical-design"||a.get("canonical_spec")!=="openspec")&&i.push("design_doc must link the current change and declare role: technical-design and canonical_spec: openspec")}return n.requirePlan!==!1&&(await zs(t,r.plan,{requireNonempty:!0})).status!=="ready"&&i.push("plan must reference a nonempty implementation plan in the configured plans directory"),i}async function zs(t,e,r={}){if(!e||e==="null")return{status:"missing",recordedPath:null};let n=await Fe(t),i=lt.resolve(t,e),o=lt.relative(n.superpowersPlansDir,i);return lt.isAbsolute(e)||!o||o.startsWith(`..${lt.sep}`)||lt.isAbsolute(o)||o.includes(lt.sep)||lt.extname(o).toLowerCase()!==".md"?{status:"broken",recordedPath:e}:await nt(t,e,{label:`Classic build plan ${e}`,expected:"file"})&&(!r.requireNonempty||(await Ue(t,e,{label:`Classic build plan ${e}`})).trim().length>0)?{status:"ready",recordedPath:e}:{status:"broken",recordedPath:e}}var Pv=new Set([".md",".markdown"]),Rv=new Set([".md",".markdown",".rst",".txt"]),Ov=new Set(["docs","doc","documentation",".github"]),Av=[/^LICENSE(?:[.-]|$)/u,/^NOTICE$/u,/^AUTHORS$/u];function Lf(t){return t.replaceAll("\\","/").replace(/^\.\//u,"")}function Tv(t,e){for(let r of e){let n=Lf(r).replace(/\/+$/u,"");if(n&&(t===n||t.startsWith(`${n}/`)))return!0}return!1}function $f(t,e=[]){let r=Lf(t);if(!r||r.endsWith("/")||Tv(r,e))return!1;let n=r.split("/"),i=n[n.length-1],o=i.lastIndexOf("."),s=o===-1?"":i.slice(o).toLowerCase();return n.length===1?Pv.has(s)||Av.some(a=>a.test(i)):Ov.has(n[0])&&Rv.has(s)}Rs();Me();import Nv from"os";import oi from"path";function Iv(t={}){let e=t.cwd??process.cwd(),r=t.homeDir??Nv.homedir(),n=[{file:oi.resolve(e,".comet","config.yaml"),source:".comet/config.yaml",scope:"project"},{file:oi.resolve(r,".comet","config.yaml"),source:"~/.comet/config.yaml",scope:"global"}];return n.filter((i,o)=>n.findIndex(s=>s.file===i.file)===o)}async function jf(t,e={}){for(let r of Iv(e)){let n=oi.dirname(oi.dirname(r.file)),i=r.scope==="global"?(await Ps(n))?.classic:(await tt(n,{allowPartialProject:!0}))?.value.classic;if(!i||typeof i!="object"||Array.isArray(i))continue;let o=i[t];if(o!=null)return{value:String(o),source:r.source}}return null}async function Lv(t){let e=await jf("document_evidence",{cwd:t});if(!e)return"neutral";if(e.value==="neutral"||e.value==="strict")return e.value;throw new Error(`classic.document_evidence must be neutral or strict, got '${e.value}' (${e.source})`)}function $v(t,e){return[L(t,e.openSpecRoot),L(t,e.superpowersRoot)]}async function Wf(t,e,r){return await Lv(t)==="strict"?!1:$f(r,$v(t,e))}function q(t,e){return{exitCode:t,stderr:e+`
|
|
158
|
+
`}}function re(t){return q(0,`[COMET-HOOK] allowed: ${t}`)}async function jv(){if(process.env.FILE_PATH)return process.env.FILE_PATH;if(process.stdin.isTTY)return"";let t=await pi();t.text===null&&(process.stderr.write(`[COMET-HOOK] stdin timeout: the host did not provide hook input within the expected window
|
|
159
|
+
`),process.exit(1));let e=di(t.text);if(!e)return"";try{let r=JSON.parse(e);return typeof r.tool_input?.file_path=="string"?r.tool_input.file_path:""}catch{return""}}function Pr(t){return t.replaceAll("\\","/").replace(/\/+/gu,"/")}function U(t){let e=Pr(t);return process.platform==="win32"?e.toLowerCase():e}function Wv(t){let e=t.indexOf("--project-root"),r=e>=0?t[e+1]:void 0;return J.resolve(r&&!r.startsWith("--")?r:process.cwd())}function Df(t,e){let r=Pr(J.relative(e,t));return r===""?"":r.startsWith("../")||r===".."||J.isAbsolute(r)?null:r}async function Dv(t){let e=J.resolve(t),r=J.parse(e).root,n=[],i=e;for(;i&&i!==r;)try{let o=await si.realpath(i);return J.join(o,...n.reverse())}catch(o){let s=o.code;if(s!=="ENOENT"&&s!=="ENOTDIR")throw o;n.push(J.basename(i)),i=J.dirname(i)}try{let o=await si.realpath(r);return J.join(o,...n.reverse())}catch{return null}}async function qv(t,e){let r=J.isAbsolute(t)?t:J.resolve(e,t),n=Pr(r),i=Df(r,e);if(i!==null)return i;try{let o=await Dv(r),s=await si.realpath(e);if(o){let a=Df(o,s);if(a!==null)return a;n=Pr(o)}}catch{if(!J.isAbsolute(t))return Pr(t).replace(/^\.\//u,"")}return n.replace(/^\.\//u,"")}async function Js(t){try{let e=await br(t,{migrate:!1}),r=Array.from(new Set(e.unknownKeys)).sort();if(r.length>0)throw new Error(`Invalid Classic state: unknown field(s): ${r.join(", ")}`);if(!e.classic)throw new Error("Classic state projection is unavailable");return{changeDir:t,phase:e.classic.phase,classic:e.classic,archived:e.classic.archived}}catch(e){let r=await gf(t);return r.phase?{changeDir:t,phase:r.phase,classic:null,archived:r.archived,invalidState:e instanceof Error&&e.message.includes("unknown field")}:null}}async function Mv(t){let e=(await Fe(t)).changesDir,r=[];if(!(await Be(t,e,{label:"Classic changes directory",expected:"directory"})).exists)return r;for(let i of(await si.readdir(e,{withFileTypes:!0})).sort((o,s)=>o.name.localeCompare(s.name))){if(i.name==="archive"||Fn(i.name))continue;let o=await it(i.name,t);if(!o.exists||!o.stateExists)continue;let s=await Js(o.directory);!s||s.archived||r.push(s)}return r}var Ys=Ce("classicActiveChanges",t=>Mv(t)),Vs=Ce("classicActiveChange",async(t,e)=>{let r=await it(e,t);if(!r.exists||!r.stateExists)return null;let n=await Js(r.directory);return!n||n.archived?null:n}),Bf=Ce("classicPlanReadiness",zs);function Uf(t,e){return`${L(t,e.superpowersRoot)}/`}function Gf(t,e){return U(t).startsWith(U(e))}function Kf(t,e){return[{prefix:`${L(t,e.superpowersSpecsDir)}/`,field:"designDoc",wireField:"design_doc",phase:"design"},{prefix:`${L(t,e.superpowersPlansDir)}/`,field:"plan",wireField:"plan",phase:"build"},{prefix:`${L(t,e.superpowersReportsDir)}/`,field:"verificationReport",wireField:"verification_report",phase:"verify"}]}function Hf(t,e){let r=U(t),n=e.find(o=>r.startsWith(U(o.prefix)));if(!n)return null;let i=r.slice(U(n.prefix).length);return!i||i.includes("/")||!i.endsWith(".md")?null:n}function zf(t,e){return t.classic?.[e.field]??null}function Fv(t,e){return t.classic!==null&&t.phase===e.phase&&!zf(t,e)}async function qf(t,e,r){return Fv(e,r)?!0:r.field!=="plan"||e.phase!=="build"?!1:(await Bf(t,e.classic?.plan??null,{requireNonempty:e.classic?.buildMode==="autonomous"})).status==="broken"}function Jf(t){return t.phase==="design"||t.phase==="build"||t.phase==="verify"}function Ke(t){return t.changeDir?J.basename(t.changeDir):null}var Bv=new Set(["design","plan","verify","verification","verification-report","report"]);function Mf(t){return t.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&")}function Uv(t,e){return[e.classic?.designDoc,e.classic?.plan,e.classic?.verificationReport].some(n=>n&&U(n)===U(t))}function Gv(t,e){let n=(t.split("/").at(-1)??t).replace(/\.[^.]+$/u,"");if(n===e)return!0;let i=[...Bv].map(Mf).join("|");return new RegExp(`(^|[-_.])${Mf(e)}[-_.](${i})$`,"u").test(n)}async function Kv(t,e,r){let n=r?[await Vs(e,r)].filter(a=>a!==null):await Ys(e),i=n.find(a=>Uv(t,a));if(i)return{governing:i,match:"recorded"};let s=n.filter(Jf).filter(a=>{let c=Ke(a);return c!==null&&Gv(t,c)}).sort((a,c)=>(Ke(c)?.length??0)-(Ke(a)?.length??0))[0];return s?{governing:s,match:"named"}:null}async function Ff(t,e,r){if(r)return await Vs(t,r)??{blockedResult:Rt(e,`selected change '${r}' is no longer active`)};let n=await Ys(t);if(n.length===0)return null;let i=await Of(t);if(i.status==="stale")return{blockedResult:Rt(e,i.reason)};if(i.status==="selected"){let o=n.find(s=>Ke(s)===i.selection.change);return o||{blockedResult:Rt(e,`selected change '${i.selection.change}' is no longer active`)}}if(n.length===1){let o=n[0];if(o.changeDir!==null){let s=await kr(o.changeDir,{heal:!1,cwd:t}),a=Ke(o)??"unknown";if(s.status==="drift")return{blockedResult:Rt(e,Cr(a,s.boundBranch,s.currentBranch))};if(s.status==="unbound-detached")return{blockedResult:Rt(e,Sr(a))}}return o}return{blockedResult:rb(e,n.map(o=>Ke(o)).filter(Boolean))}}function Hv(t){let r=/^\d{4}-\d{2}-\d{2}-(.+)$/u.exec(t)?.[1]??t;return Fn(r)?null:r}function Yf(t,e,r){let n=`${L(e,r.changesDir)}/`;if(!U(t).startsWith(U(n)))return null;let i=t.slice(n.length).split("/").filter(Boolean),[o,s]=i;return o?U(o)===U("archive")?{kind:"archive",archiveName:s??null,changeName:s?Hv(s):null}:{kind:"active",changeName:o}:null}function Vf(t,e,r){return e?.kind==="archive"?ib(t,e.archiveName,e.changeName,r):e?.kind==="active"&&r&&U(e.changeName)!==U(r)?nb(t,e.changeName,r):null}async function zv(t,e,r,n){let i=Yf(t,e,r),o=Vf(t,i,n);if(o)return{blockedResult:o};if(i?.kind==="active"){let s=i.changeName,a=await it(s,e);if(a.stateExists){let c=await Js(a.directory);return c||{changeDir:a.directory,phase:"open",classic:null,archived:!1}}return{changeDir:a.directory,phase:"open",classic:null,archived:!1}}if(Gf(t,Uf(e,r))){let s=await Kv(t,e,n);if(s?.match==="recorded")return{...s.governing,superpowersArtifact:"matched"};let a=Hf(t,Kf(e,r));if(s)return a?{...s.governing,superpowersArtifact:await qf(e,s.governing,a)?"matched":"unmatched",superpowersSlot:a}:{...s.governing,superpowersArtifact:"matched"};if(a){let l=await Ff(e,t,n);return!l||"blockedResult"in l?l:{...l,superpowersArtifact:await qf(e,l,a)?"matched":"unmatched",superpowersSlot:a}}let c=n?await Vs(e,n):(await Ys(e))[0]??null;return c?{...c,superpowersArtifact:"unmatched"}:null}return Ff(e,t,n)}function Jv(t){return!t.includes("/")&&t.endsWith(".md")}function Yv(t){return t.startsWith(".comet/")||t.includes("/.comet/")}function Vv(t){return t===".superpowers"||t.startsWith(".superpowers/")}function Xv(t,e,r){let n=U(t);if(!n.startsWith(U(r)))return null;let i=n.endsWith("/.comet.yaml")||n.endsWith("/.openspec.yaml"),o=n.endsWith("/proposal.md")||n.endsWith("/design.md")||n.endsWith("/tasks.md"),s=n.includes("/.comet/"),a=n.includes("/specs/");return e==="open"&&(o||i||s||a)?`${t} (phase: open, openspec artifacts)`:e==="design"&&(o||i||s||a)?`${t} (phase: design, handoff/spec)`:e==="build"&&(n.endsWith("/tasks.md")||i||a)?`${t} (phase: build, spec/tasks)`:e==="verify"&&i?`${t} (phase: verify, state)`:e==="archive"&&i?`${t} (phase: archive, state)`:null}function Qv(t,e,r,n){let i=e==="open"?[" BLOCKED: source writes are not allowed during open"," This phase does not allow source writes"," ALLOWED: create proposal/design/tasks artifacts and run guard",` NEXT: finish clarification and artifacts, then run comet guard ${r} open --apply`]:e==="design"?[" BLOCKED: source writes are not allowed during design"," This phase does not allow source writes"," ALLOWED: run brainstorming, create the Design Doc, and run guard",` NEXT: finish the Design Doc, then run comet guard ${r} design --apply to enter build`]:e==="verify"?[" BLOCKED: implementation writes are not allowed during verify"," This phase allows verification reports and state updates only",` NEXT: run comet state transition ${r} verify-fail, then retry the implementation edit in Build`]:[" BLOCKED: source writes are not allowed during archive"," This phase does not allow source writes",` NEXT: run comet archive ${r} to complete Archive; use the reported recovery action if Archive is blocked`];return Xf(t,e,e,n,i)}function Xf(t,e,r,n,i){let o=Tf(r,n);return q(2,["","╔══════════════════════════════════════════╗","║ COMET PHASE GUARD — WRITE BLOCKED ║","╚══════════════════════════════════════════╝","",` Current phase: ${e}`,` Target file: ${t}`,"",` ${o.summary}`,` RELAY TO USER: ${o.user_message}`,"",...i,""].join(`
|
|
160
|
+
`))}function Zv(t,e,r){return Xf(t,"build (workflow: full), but design_doc is empty","build",r,[" BLOCKED: full workflow source writes require a recorded Design Doc"," This phase does not allow source writes until design_doc is recorded",` NEXT: create the Design Doc, run comet state complete-design ${e} --design-doc <repo-relative-ref>, then retry the original write`])}function eb(t,e,r,n,i){let o=Ke(e)??"<change-name>",s=r.status==="missing",a=s?"classic-build-plan-missing":"classic-build-plan-broken",c=s?"plan is not recorded":"the recorded plan path does not resolve to a file",l=s?[]:[`RECORDED_PLAN: ${r.recordedPath}`],u=e.changeDir?L(n,e.changeDir):"<classic-change-dir>",f=L(n,i.superpowersPlansDir),d=e.classic?.buildMode==="autonomous",p=s?`comet state set ${o} plan <repository-relative-plan-path>`:`comet state set ${o} plan <new-repository-relative-plan-path>`,h=s?[d?"2. Plan the implementation autonomously from the confirmed design and task IDs.":"2. Load the Superpowers writing-plans Skill.",`3. Read the Design Doc path from "comet state get ${o} design_doc" and read ${u}/tasks.md.`,`4. Create the implementation plan under ${f}/.`,"5. Record the plan path:",` ${p}`]:[d?`2. Restore the plan file at ${r.recordedPath}, or create a replacement autonomously under ${f}/.`:`2. Restore the plan file at ${r.recordedPath}, or load the Superpowers writing-plans Skill and create a replacement under ${f}/.`,"3. When creating a replacement, record its path:",` ${p}`];return q(2,["","╔══════════════════════════════════════════╗","║ COMET PHASE GUARD — WRITE BLOCKED ║","╚══════════════════════════════════════════╝","",`ERROR_CODE: ${a}`,`CHANGE: ${o}`,"WORKFLOW: full","PHASE: build",`TARGET: ${t}`,`STATE: ${c}`,...l,"",d?"BLOCKED: project source writes require a ready implementation plan.":"BLOCKED: project source writes require a ready Superpowers implementation plan.","","ALLOWED_RECOVERY_WRITES:",`- ${f}/<plan-file>.md`,"- Comet state updates performed by the comet CLI",`- ${u} artifacts allowed by the build phase`,"","RECOVERY:",`1. Invoke /comet-build for ${o} and resume Step 1.`,...h,`${s?"6":"4"}. Verify recovery:`,` comet state check ${o} build --recover`,"","SUCCESS: plan is reported as DONE and recovery advances beyond plan creation.",`RETRY: retry the original Write/Edit for ${t} only after SUCCESS.`,"PROHIBITED: do not treat tasks.md as the implementation plan or write project source before SUCCESS.",d?"Autonomous planning does not require an external Skill; all normal acceptance checks still apply.":"If writing-plans is unavailable, stop and report the missing Skill instead of bypassing this check.",""].join(`
|
|
161
|
+
`))}function tb(t,e){let r=e.superpowersSlot,n=r?zf(e,r):null,i=r?e.phase!==r.phase?[` BLOCKED: ${r.wireField} cannot be first-written in phase ${e.phase}`,` Expected phase: ${r.phase}`," NEXT: resume the matching Comet phase or use an already recorded artifact path"]:n?[` BLOCKED: ${r.wireField} is already recorded for this change`,` Recorded path: ${n}`," NEXT: write the recorded artifact or explicitly correct the state path"]:[" BLOCKED: standard Superpowers artifact state is incomplete"," NEXT: validate the active change state, then retry the matching phase"]:[" BLOCKED: unmatched Superpowers artifact"," This docs/superpowers/ path does not match any active change artifact"," NEXT: use a recorded artifact path or a standard phase artifact directory"];return q(2,["","╔══════════════════════════════════════════╗","║ COMET PHASE GUARD — WRITE BLOCKED ║","╚══════════════════════════════════════════╝","",` Current phase: ${e.phase}`,` Target file: ${t}`,"",...i,""].join(`
|
|
162
|
+
`))}function rb(t,e){return q(2,["","╔══════════════════════════════════════════╗","║ COMET PHASE GUARD — WRITE BLOCKED ║","╚══════════════════════════════════════════╝",""," BLOCKED: multiple active changes require a current change",` Target file: ${t}`,` Active changes: ${e.join(", ")}`,"",` NEXT: choose the intended change, run one of: ${e.map(r=>`comet state select ${r}`).join(" | ")}, then retry the source write`,""].join(`
|
|
163
|
+
`))}function Rt(t,e){return q(2,["","╔══════════════════════════════════════════╗","║ COMET PHASE GUARD — WRITE BLOCKED ║","╚══════════════════════════════════════════╝",""," BLOCKED: current change selection is stale or invalid",` Target file: ${t}`,` Reason: ${e}`,""," NEXT: run comet state current --json, follow its exact selection recovery action, then retry the source write",""].join(`
|
|
164
|
+
`))}function nb(t,e,r){return q(2,["","╔══════════════════════════════════════════╗","║ COMET PHASE GUARD — WRITE BLOCKED ║","╚══════════════════════════════════════════╝","",` BLOCKED: target belongs to Classic change '${e}', but the current selection is '${r}'`,` Target file: ${t}`,"",` NEXT: write the matching artifact for '${r}', or run comet state select ${e} before modifying this target`,""].join(`
|
|
165
|
+
`))}function ib(t,e,r,n){let i=r?`archived Classic change '${r}'`:e?`Classic archive entry '${e}'`:"the Classic archive",o=n?`, but the current selection is '${n}'`:"";return q(2,["","╔══════════════════════════════════════════╗","║ COMET PHASE GUARD — WRITE BLOCKED ║","╚══════════════════════════════════════════╝","",` BLOCKED: target belongs to ${i}${o}; archived artifacts are immutable`,` Target file: ${t}`,""," NEXT: modify the active change artifact instead; if follow-up work is required, create or select an active change and retry there",""].join(`
|
|
166
|
+
`))}async function ob(t,e,r,n=Cu){try{if((await n(t,[e])).projectTargets.length===0)return re(`${e} (outside guarded project)`)}catch(h){return q(2,[`[COMET-HOOK] blocked: scope could not be determined safely for ${e}.`,`REASON: ${h instanceof Error?h.message:String(h)}`,"NEXT: verify that the project root is accessible, then retry the write."].join(`
|
|
167
|
+
`))}let i=await qv(e,t),o;try{o=await ps(t)}catch(h){return q(2,`[COMET-HOOK] blocked: ${h instanceof Error?h.message:String(h)}`)}let s=Yf(i,t,o),a=Vf(i,s,r);if(a)return a;if(Yv(i))return re(`${i} (whitelist: comet config)`);if(Vv(i))return re(`${i} (whitelist: superpowers workspace)`);if(await Wf(t,o,i))return re(`${i} (whitelist: neutral document)`);if(i==="CLAUDE.md"||i==="CHANGELOG.md"||i==="README.md"||Jv(i))return re(`${i} (whitelist: root markdown)`);let c=await ys(t,e,[J.join(t,".comet"),o.openSpecRoot,o.superpowersRoot]);if(c)return re(c);let l;try{l=await zv(i,t,o,r)}catch(h){return q(2,`[COMET-HOOK] blocked: ${h instanceof Error?h.message:String(h)}`)}if(!l)return re("no active comet change");if("blockedResult"in l)return l.blockedResult;if(l.archived)return re(`${i} (own change archived)`);let u=l.phase,f=Ke(l)??r;if(!f)return Rt(i,"active Classic change name cannot be resolved");if(l.classic?.buildMode==="autonomous"&&l.changeDir)try{let h=await kr(l.changeDir,{heal:!1,cwd:t});if(h.status==="drift")return q(2,Cr(f,h.boundBranch,h.currentBranch));if(h.status==="unbound-detached")return q(2,Sr(f))}catch(h){return q(2,h instanceof Error?h.message:String(h))}let d=Hf(i,Kf(t,o));if(u==="build"&&l.classic?.buildMode==="autonomous"&&d?.field==="plan"){let h=await Hs(t,f,l.classic,{requirePlan:!1});if(h.length)return q(2,h.join(`
|
|
168
|
+
`))}let p=Xv(i,u,`${L(t,o.openSpecRoot)}/`);if(p)return re(p);if(Gf(i,Uf(t,o))){if(l.superpowersArtifact==="matched"&&Jf(l))return re(`${i} (phase: ${u}, superpowers)`);if(l.superpowersArtifact==="unmatched")return tb(i,l)}if(l.invalidState)return q(2,`[COMET-HOOK] blocked: active Classic state is invalid; run comet classic validate ${f}, repair only the reported fields, then run comet state next ${f} --json before retrying ${i}`);if(u==="build"&&l.classic?.workflow==="full"&&!l.classic.designDoc)return Zv(i,f,Ks(l.classic?.language));if(u==="build"&&l.classic?.workflow==="full"){let h=await Bf(t,l.classic.plan,{requireNonempty:l.classic.buildMode==="autonomous"});if(h.status!=="ready")return eb(i,l,h,t,o)}if(u==="build"){if(l.classic?.buildMode==="autonomous"){let h=await Hs(t,f,l.classic);if(h.length)return q(2,h.join(`
|
|
169
|
+
`))}return re(`${i} (phase: ${u})`)}return Qv(i,u,f,Ks(l.classic?.language))}var Qf=async t=>{let e=Wv(t),r=await jv();return r?ob(e,r):re("no file path in tool input")};var Zf=["open-complete","design-complete","build-complete","verify-pass","verify-fail","archive-confirm","archive-reopen","archived","preset-escalate"];var sb=new Set([...vr,"archive_confirmation","verify_failures","check_epoch","classic_profile","classic_migration","bound_branch"]),ed=new Set(at.filter(t=>!sb.has(t))),Xs={workflow:["full","hotfix","tweak"],phase:["open","design","build","verify","archive"],context_compression:["off","beta"],build_mode:["subagent-driven-development","executing-plans","direct","autonomous"],build_pause:["null","plan-ready"],subagent_dispatch:["null","confirmed"],tdd_mode:["tdd","direct"],review_mode:["off","standard","thorough"],isolation:["current","branch","worktree"],verify_mode:["light","full"],auto_transition:["true","false"],verify_result:["pending","pass","fail"],branch_status:["pending","handled"],archive_confirmation:["pending","confirmed"],archived:["true","false"],direct_override:["true","false"],classic_profile:["full","hotfix","tweak"],classic_migration:["1"]};var ab=`
|
|
157
170
|
Options: --json (machine-readable output), --help
|
|
158
171
|
JSON: one object with command and exitCode; data, stdout, stderr, summary and next are optional.
|
|
159
172
|
Use exitCode for success; do not parse human-readable stdout. Help text is in stdout in JSON mode.
|
|
160
|
-
`;function Lf(t,e){let r=e.indexOf("--"),n=r<0?e:e.slice(0,r);if(!n.includes("--help")&&!n.includes("-h"))return;let i={check:["comet check run <change> <build|verify> [--local] [--incremental] [--cwd <path>] [--timeout-ms <ms>] -- <program> [args...]","comet check rerun <change> <build|verify>","--local opts deterministic local checks into same-input reuse; other checks are single-use.","--incremental records phase-local evidence: guard previews accept it, --apply requires a full rerun.","Arguments after -- belong to the child. Windows batch arguments containing shell syntax are rejected.","","Executes a program for an active change and stores its log and input-bound evidence.","--local is not a location switch: all checks execute locally. It asserts deterministic inputs.","Use --local only when no network, external state or untracked ignored inputs affect the result.","Default evidence is single-use; reusable evidence requires matching inputs, environment and log.","--cwd: relative to the project root; default is the invocation directory; must stay inside the project.","Guard reuses evidence only when its cwd matches the guard invocation directory, or the command is declared with that cwd in a v2 check policy.","--timeout-ms: default 300000; integer range 1..3600000.","Place Comet options, including --json, before --. Child --help and --json after -- are forwarded.","","Result: data.scope, data.argv, data.cwd, data.exitCode, data.logRef, data.reusable; data.reused is optional.","Exit: 0 = success with stable inputs; child failures propagate; timeout = 124; invalid invocation/runtime error = 70.","A child exit of 0 with changed inputs returns exitCode 1. Use top-level exitCode, not data.exitCode.","On failure inspect data.logRef or stderr, fix the cause, then rerun. Recovery revalidates local evidence.","rerun repeats the latest Runtime-recorded argv, cwd, timeout and reuse tier without reconstructing shell syntax.","Optional .comet/check-policy.json binds declared deterministic commands by exact argv and cwd.",'A v1 single-command object stays valid; v2 {"commands":[...]} scopes each command separately.',"Editing one v2 command entry invalidates only that command's evidence; unmatched commands stay conservative.",'Default inputs are the working-tree files. Declare git: "all" for builds that read HEAD or the index,','env variable names whose values affect the result, and taskCheckboxes: "include" when completion marks matter.',"files accept literal paths and * ? ** globs; a new file matching a glob is checked without re-declaring.","Declare every real input; do not infer dependencies from the current diff.",'Policy example: {"version":2,"commands":[{"argv":["node","scripts/build.mjs"],"cwd":".","files":["src/**","package.json"],"git":"all"},{"argv":["node","--test"],"cwd":".","files":["src/**","test/**"],"taskCheckboxes":"ignore"}]}',"Build evidence does not substitute for verify evidence. A successful check does not advance the phase.","","Examples: (replace demo with your active change; these commands execute code)"," comet check run demo verify --json -- node --test"," comet check run demo build --local --cwd . -- npm run build"," comet check rerun demo build"],state:["comet state <command> [args]","init <change-name> <full|hotfix|tweak> [--isolation <current|branch|worktree>]","get <change-name> <field>","set <change-name> <field> <value> [<field> <value> ...]","complete-design <change-name> --design-doc <repo-relative-ref>","transition <change-name> <event>","check <change-name> <phase> [--recover] [--details]","scale <change-name>","artifacts <change-name>","record-check <change-name> <build|verify> --command <text> --exit-code <int> [--cwd <path>]","task-checkoff <file> <task-text>","tasks <change-name> [--assign-ids]","task-complete <change-name> <task-id> --expect <revision>","sync-plan <change-name>","checkpoint <change-name> [--file <json>]","delivery <change-name> [--file <json> | --verify]","select <change-name> | rebind <change-name> | next <change-name>","current | clear-selection","","Start with current or next <change-name> to inspect workflow guidance.","Advanced writes: init, set, transition, task-checkoff, select, rebind, clear-selection.","Use comet state <command> --help for details. --recover is for cold recovery, not normal progression.","After explicit design confirmation, complete-design registers the reference, refreshes handoff, and applies the guard; interrupted retries retain completed work.","Use data.artifactRefs for state references and task-authority markers; absolute paths are for file operations."],guard:["comet guard <change-name> <open|design|build|verify|archive> [--apply]","Validates phase requirements; --apply advances the phase after all checks pass.","Without --apply the phase stays unchanged, but this is NOT a read-only preview:","Build validation may execute a detected build and write evidence/logs.","Preview does not consume single-use evidence. Successful phase advancement consumes it atomically.","Failed or repeated previews preserve evidence; changed inputs still require a new check.","Do not poll guard for status. Use comet state next <change-name> for guidance.","On failure follow the reported next action; do not blindly retry side-effecting checks.","","Examples:"," comet guard demo build --apply --json"," comet state next demo --json"],handoff:["comet handoff <change-name> design --write [--full]","comet handoff <change-name> --hash-only"],archive:["comet archive <change-name> [--dry-run]"],validate:["comet classic validate <change-name>"],workspace:["comet classic workspace prepare <change-name> --isolation <current|branch|worktree> [--change-branch <branch>] [--target-branch <branch>] [--worktree-path <path>]","comet classic workspace resolve <change-name>"]},o={current:["comet state current","Reports the selected Classic change. Does not advance the phase."],next:["comet state next <change-name>","Reports the next workflow action. Does not execute build or verification checks."],select:["comet state select <change-name>","Writes the current change selection used by workflow routing."],rebind:["comet state rebind <change-name>","Updates the change branch binding to the current Git branch after validation."],"clear-selection":["comet state clear-selection","Clears the current change selection; does not delete change artifacts."],init:["comet state init <change-name> <full|hotfix|tweak> [--isolation <current|branch|worktree>]","Creates Classic workflow state. Follow the Open workflow for required user decisions."],scale:["comet state scale <change-name>","Reports a verification recommendation without changing verify_mode.","JSON: data.recommendation, data.selected and data.metrics. Scale is not a risk assessment.","Preserve an existing selection; record a new decision explicitly with state set when needed."],artifacts:["comet state artifacts <change-name>","Inspects the OpenSpec apply dependency closure, including dependencies of already-complete artifacts.","JSON: data.source, required, skipped, designRequired, files and problems. This does not execute implementation or verification.","Optional design is omitted only when the active schema excludes it from the required closure.","Skipped specs require explicit skip_specs: true, upstream support and no conflicting spec files.","Legacy changes without .openspec.yaml retain the existing Classic artifact requirements."],"task-checkoff":["comet state task-checkoff <file> <task-text>","Checks that exactly one matching task is already checked. Does not write the task file or execute the task."],tasks:["comet state tasks <change-name> [--assign-ids]","Reads tasks.md as the task completion authority. Fenced examples are excluded.","--assign-ids persists IDs for legacy/new tasks in Open, Design or Build; existing IDs remain unchanged.","Assign IDs before generating the design handoff and plan. ID assignment changes task requirements.","JSON: data.authority, data.revision, data.needsIds, data.tasks and data.progress.","Each task has id, text, completed and line. Never use line/order as task identity.","Example: comet state tasks demo --assign-ids --json"],"task-complete":["comet state task-complete <change-name> <task-id> --expect <revision>","Records accepted task completion during Build; does not execute or independently verify work.","Use the revision returned by state tasks. Changed requirements reject the write; refresh and reassess the task.","Writes tasks.md under the state lock and synchronizes explicitly ID-mapped legacy plan checkboxes. Retries repair interrupted projection writes.","Reconcile code, checks and review evidence before recording completion; unchecked does not mean unimplemented.","Unmapped legacy items are preserved and reported as mapping-required; never match tasks by position or wording."],"sync-plan":["comet state sync-plan <change-name>","Synchronizes legacy plan checkboxes from tasks.md by explicit comet-task IDs; does not execute or accept work.","Rejects missing or unknown plan IDs. Reconcile extra requirements into tasks.md before mapping.","New plans should reference task IDs without a second completion checklist."],checkpoint:["comet state checkpoint <change-name> [--file <json>]","Reads a structured coordination checkpoint, or records an explicitly bounded work package during Build.","Input: taskIds, revision, stage, sessionId, evidence, unresolved, reviewRounds.","Include schemaVersion: 1. JSON state is .comet/coordination.json, separate from the Engine checkpoint.","Stages: implementing|task-review|checkoff|done|blocked. Evidence is a coordination record, not automatic acceptance.","Runtime checks task IDs and revision and renders subagent-progress.md. Do not maintain its projection manually."],delivery:["comet state delivery <change-name> [--file <json> | --verify]","Reads delivery authorization and observed progress, or records the user-authorized local|push|pr action.","Input: action, targetBranch, optional remote, commit and prUrl. Recording never performs remote writes.","First authorization requires Archive with passing verification before archival. Missing legacy authorization is never inferred.","Resume only authorized unfinished steps; supplied commit or PR text alone does not prove delivery.","--verify performs bounded read-only remote/PR verification; normal entry never contacts the network."],get:["comet state get <change-name> <field>","Reads one stored field. The field value is returned in stdout, including in JSON mode.",`Fields: ${[...tt,...dr].join(", ")}`,"Example: comet state get demo phase --json"],set:["comet state set <change-name> <field> <value> [<field> <value> ...]","Advanced: validates all fields, then commits one atomic state update and reconciles Runtime state.","Invalid values or duplicate fields reject the whole update. Do not bypass workflow confirmations.","JSON: data.change and data.updated contain the committed field values.","Writable fields (enum values shown where applicable):",...[...If].map(c=>` ${c}${Is[c]?`: ${Is[c].join("|")}`:c==="language"?": en|zh-CN":""}`),"Other Runtime-owned fields cannot be set manually. Artifact paths must stay within the project.","Example: comet state set demo verify_mode full","Example: comet state set demo build_mode executing-plans tdd_mode direct review_mode standard --json"],check:["comet state check <change-name> <open|design|build|verify|archive> [--recover] [--details]","Checks phase entry requirements; this is not a build/test execution command.","--recover is for cold recovery after context loss, not normal phase progression.","Recovery revalidates reusable local evidence and invalidates stale, damaged or single-use evidence.","It preserves completed work; resume from the checkpoint and rerun required checks before progressing.","JSON entry data includes layout, configuration, configurationReadiness, nextAction, compact taskState, planMapping and checks.","--recover additionally revalidates evidence and includes checkpoint references; --details expands tasks and checkpoint content.","Reconcile existing implementation and acceptance before dispatching work; unchecked tasks are not proof of missing implementation.","Read fresh state after changing configuration or advancing phases; do not reuse an earlier entry snapshot.","","Examples:"," comet state check demo build --json"," comet state check demo build --recover --json"],"record-check":["comet state record-check <change> <build|verify> --command <text> --exit-code <int> [--cwd <path>]","Advanced: writes a manual attestation; does not execute the command.","A manual attestation cannot satisfy Runtime build/verify evidence requirements, even with exit code 0.","Use comet check run to execute a check and obtain evidence that guard can validate.","--cwd: relative to project root, defaults to .; must stay inside the project.","","Examples:",' comet state record-check demo verify --command "external test run" --exit-code 1'," comet check run demo verify --json -- node --test"],transition:["comet state transition <change-name> <event>",`Events: ${Nf.join(", ")}`,"Advanced: applies a state-machine event and writes workflow state. Required confirmations still apply.","This is not a substitute for the workflow Skill or phase guard. Use state next for the next action."]},s=n.find(c=>!c.startsWith("-")),a=t==="state"&&s&&o[s]||i[t];return a?`Usage: ${a.join(`
|
|
173
|
+
`;function td(t,e){let r=e.indexOf("--"),n=r<0?e:e.slice(0,r);if(!n.includes("--help")&&!n.includes("-h"))return;let i={check:["comet check run <change> <build|verify> [--local] [--incremental] [--cwd <path>] [--timeout-ms <ms>] -- <program> [args...]","comet check rerun <change> <build|verify>","--local opts deterministic local checks into same-input reuse; other checks are single-use.","--incremental records phase-local evidence: guard previews accept it, --apply requires a full rerun.","Arguments after -- belong to the child. Windows batch arguments containing shell syntax are rejected.","","Executes a program for an active change and stores its log and input-bound evidence.","--local is not a location switch: all checks execute locally. It asserts deterministic inputs.","Use --local only when no network, external state or untracked ignored inputs affect the result.","Default evidence is single-use; reusable evidence requires matching inputs, environment and log.","--cwd: relative to the project root; default is the invocation directory; must stay inside the project.","Guard reuses evidence only when its cwd matches the guard invocation directory, or the command is declared with that cwd in a v2 check policy.","--timeout-ms: default 300000; integer range 1..3600000.","Place Comet options, including --json, before --. Child --help and --json after -- are forwarded.","","Result: data.scope, data.argv, data.cwd, data.exitCode, data.logRef, data.reusable; data.reused is optional.","Exit: 0 = success with stable inputs; child failures propagate; timeout = 124; invalid invocation/runtime error = 70.","A child exit of 0 with changed inputs returns exitCode 1. Use top-level exitCode, not data.exitCode.","On failure inspect data.logRef or stderr, fix the cause, then rerun. Recovery revalidates local evidence.","rerun repeats the latest Runtime-recorded argv, cwd, timeout and reuse tier without reconstructing shell syntax.","Optional .comet/check-policy.json binds declared deterministic commands by exact argv and cwd.",'A v1 single-command object stays valid; v2 {"commands":[...]} scopes each command separately.',"Editing one v2 command entry invalidates only that command's evidence; unmatched commands stay conservative.",'Default inputs are the working-tree files. Declare git: "all" for builds that read HEAD or the index,','env variable names whose values affect the result, and taskCheckboxes: "include" when completion marks matter.',"files accept literal paths and * ? ** globs; a new file matching a glob is checked without re-declaring.","Declare every real input; do not infer dependencies from the current diff.",'Policy example: {"version":2,"commands":[{"argv":["node","scripts/build.mjs"],"cwd":".","files":["src/**","package.json"],"git":"all"},{"argv":["node","--test"],"cwd":".","files":["src/**","test/**"],"taskCheckboxes":"ignore"}]}',"Build evidence does not substitute for verify evidence. A successful check does not advance the phase.","","Examples: (replace demo with your active change; these commands execute code)"," comet check run demo verify --json -- node --test"," comet check run demo build --local --cwd . -- npm run build"," comet check rerun demo build"],state:["comet state <command> [args]","init <change-name> <full|hotfix|tweak> [--isolation <current|branch|worktree>]","get <change-name> <field>","set <change-name> <field> <value> [<field> <value> ...]","complete-design <change-name> --design-doc <repo-relative-ref>","transition <change-name> <event>","check <change-name> <phase> [--recover] [--details]","scale <change-name>","artifacts <change-name>","record-check <change-name> <build|verify> --command <text> --exit-code <int> [--cwd <path>]","task-checkoff <file> <task-text>","tasks <change-name> [--assign-ids]","task-complete <change-name> <task-id> --expect <revision>","sync-plan <change-name>","checkpoint <change-name> [--file <json>]","delivery <change-name> [--file <json> | --verify]","select <change-name> | rebind <change-name> | next <change-name>","current | clear-selection","","Start with current or next <change-name> to inspect workflow guidance.","Advanced writes: init, set, transition, task-checkoff, select, rebind, clear-selection.","Use comet state <command> --help for details. --recover is for cold recovery, not normal progression.","After explicit design confirmation, complete-design registers the reference, refreshes handoff, and applies the guard; interrupted retries retain completed work.","Use data.artifactRefs for state references and task-authority markers; absolute paths are for file operations."],guard:["comet guard <change-name> <open|design|build|verify|archive> [--apply]","Validates phase requirements; --apply advances the phase after all checks pass.","Without --apply the phase stays unchanged, but this is NOT a read-only preview:","Build validation may execute a detected build and write evidence/logs.","Preview does not consume single-use evidence. Successful phase advancement consumes it atomically.","Failed or repeated previews preserve evidence; changed inputs still require a new check.","Do not poll guard for status. Use comet state next <change-name> for guidance.","On failure follow the reported next action; do not blindly retry side-effecting checks.","","Examples:"," comet guard demo build --apply --json"," comet state next demo --json"],handoff:["comet handoff <change-name> design --write [--full]","comet handoff <change-name> --hash-only"],archive:["comet archive <change-name> [--dry-run]"],validate:["comet classic validate <change-name>"],workspace:["comet classic workspace prepare <change-name> --isolation <current|branch|worktree> [--change-branch <branch>] [--target-branch <branch>] [--worktree-path <path>]","comet classic workspace resolve <change-name>"]},o={current:["comet state current","Reports the selected Classic change. Does not advance the phase."],next:["comet state next <change-name>","Reports the next workflow action. Does not execute build or verification checks."],select:["comet state select <change-name>","Writes the current change selection used by workflow routing."],rebind:["comet state rebind <change-name>","Updates the change branch binding to the current Git branch after validation."],"clear-selection":["comet state clear-selection","Clears the current change selection; does not delete change artifacts."],init:["comet state init <change-name> <full|hotfix|tweak> [--isolation <current|branch|worktree>]","Creates Classic workflow state. Follow the Open workflow for required user decisions."],scale:["comet state scale <change-name>","Reports a verification recommendation without changing verify_mode.","JSON: data.recommendation, data.selected and data.metrics. Scale is not a risk assessment.","Preserve an existing selection; record a new decision explicitly with state set when needed."],artifacts:["comet state artifacts <change-name>","Inspects the OpenSpec apply dependency closure, including dependencies of already-complete artifacts.","JSON: data.source, required, skipped, designRequired, files and problems. This does not execute implementation or verification.","Optional design is omitted only when the active schema excludes it from the required closure.","Skipped specs require explicit skip_specs: true, upstream support and no conflicting spec files.","Legacy changes without .openspec.yaml retain the existing Classic artifact requirements."],"task-checkoff":["comet state task-checkoff <file> <task-text>","Checks that exactly one matching task is already checked. Does not write the task file or execute the task."],tasks:["comet state tasks <change-name> [--assign-ids]","Reads tasks.md as the task completion authority. Fenced examples are excluded.","--assign-ids persists IDs for legacy/new tasks in Open, Design or Build; existing IDs remain unchanged.","Assign IDs before generating the design handoff and plan. ID assignment changes task requirements.","JSON: data.authority, data.revision, data.needsIds, data.tasks and data.progress.","Each task has id, text, completed and line. Never use line/order as task identity.","Example: comet state tasks demo --assign-ids --json"],"task-complete":["comet state task-complete <change-name> <task-id> --expect <revision>","Records accepted task completion during Build; does not execute or independently verify work.","Use the revision returned by state tasks. Changed requirements reject the write; refresh and reassess the task.","Writes tasks.md under the state lock and synchronizes explicitly ID-mapped legacy plan checkboxes. Retries repair interrupted projection writes.","Reconcile code, checks and review evidence before recording completion; unchecked does not mean unimplemented.","Unmapped legacy items are preserved and reported as mapping-required; never match tasks by position or wording."],"sync-plan":["comet state sync-plan <change-name>","Synchronizes legacy plan checkboxes from tasks.md by explicit comet-task IDs; does not execute or accept work.","Rejects missing or unknown plan IDs. Reconcile extra requirements into tasks.md before mapping.","New plans should reference task IDs without a second completion checklist."],checkpoint:["comet state checkpoint <change-name> [--file <json>]","Reads a structured coordination checkpoint, or records an explicitly bounded work package during Build.","Input: taskIds, revision, stage, sessionId, evidence, unresolved, reviewRounds.","Include schemaVersion: 1. JSON state is .comet/coordination.json, separate from the Engine checkpoint.","Stages: implementing|task-review|checkoff|done|blocked. Evidence is a coordination record, not automatic acceptance.","Runtime checks task IDs and revision and renders subagent-progress.md. Do not maintain its projection manually."],delivery:["comet state delivery <change-name> [--file <json> | --verify]","Reads delivery authorization and observed progress, or records the user-authorized local|push|pr action.","Input: action, targetBranch, optional remote, commit and prUrl. Recording never performs remote writes.","First authorization requires Archive with passing verification before archival. Missing legacy authorization is never inferred.","Resume only authorized unfinished steps; supplied commit or PR text alone does not prove delivery.","--verify performs bounded read-only remote/PR verification; normal entry never contacts the network."],get:["comet state get <change-name> <field>","Reads one stored field. The field value is returned in stdout, including in JSON mode.",`Fields: ${[...at,...vr].join(", ")}`,"Example: comet state get demo phase --json"],set:["comet state set <change-name> <field> <value> [<field> <value> ...]","Advanced: validates all fields, then commits one atomic state update and reconciles Runtime state.","Invalid values or duplicate fields reject the whole update. Do not bypass workflow confirmations.","JSON: data.change and data.updated contain the committed field values.","Writable fields (enum values shown where applicable):",...[...ed].map(c=>` ${c}${Xs[c]?`: ${Xs[c].join("|")}`:c==="language"?": en|zh-CN":""}`),"Other Runtime-owned fields cannot be set manually. Artifact paths must stay within the project.","Example: comet state set demo verify_mode full","Example: comet state set demo build_mode executing-plans tdd_mode direct review_mode standard --json"],check:["comet state check <change-name> <open|design|build|verify|archive> [--recover] [--details]","Checks phase entry requirements; this is not a build/test execution command.","--recover is for cold recovery after context loss, not normal phase progression.","Recovery revalidates reusable local evidence and invalidates stale, damaged or single-use evidence.","It preserves completed work; resume from the checkpoint and rerun required checks before progressing.","JSON entry data includes layout, configuration, configurationReadiness, nextAction, compact taskState, planMapping and checks.","--recover additionally revalidates evidence and includes checkpoint references; --details expands tasks and checkpoint content.","Reconcile existing implementation and acceptance before dispatching work; unchecked tasks are not proof of missing implementation.","Read fresh state after changing configuration or advancing phases; do not reuse an earlier entry snapshot.","","Examples:"," comet state check demo build --json"," comet state check demo build --recover --json"],"record-check":["comet state record-check <change> <build|verify> --command <text> --exit-code <int> [--cwd <path>]","Advanced: writes a manual attestation; does not execute the command.","A manual attestation cannot satisfy Runtime build/verify evidence requirements, even with exit code 0.","Use comet check run to execute a check and obtain evidence that guard can validate.","--cwd: relative to project root, defaults to .; must stay inside the project.","","Examples:",' comet state record-check demo verify --command "external test run" --exit-code 1'," comet check run demo verify --json -- node --test"],transition:["comet state transition <change-name> <event>",`Events: ${Zf.join(", ")}`,"Advanced: applies a state-machine event and writes workflow state. Required confirmations still apply.","This is not a substitute for the workflow Skill or phase guard. Use state next for the next action."]},s=n.find(c=>!c.startsWith("-")),a=t==="state"&&s&&o[s]||i[t];return a?`Usage: ${a.join(`
|
|
161
174
|
`)}
|
|
162
|
-
${
|
|
163
|
-
`:void 0}function
|
|
164
|
-
`,...e.envelope===void 0?{}:{envelope:e.envelope}}}async function
|
|
175
|
+
${ab}Command placeholders must be replaced with actual values.
|
|
176
|
+
`:void 0}function rd(t,e){let r=u=>u!==null&&typeof u=="object"&&!Array.isArray(u)?u:{},n=r(t),i=r(n.entry),o=r(n.state??i.state??n),s=r(n.preparation??n.workspace??i.workspace),a=r(n.continuation??i.continuation),c=typeof s.projectRoot=="string"&&s.projectRoot!=="."?s.projectRoot:e??null,l=o.stateVersion??o.state_version;return{phase:typeof o.phase=="string"?o.phase:null,status:typeof o.status=="string"?o.status:null,stateVersion:typeof l=="number"?l:null,workspace:{cwd:c},continuation:Object.keys(a).length?{...a,cwd:c}:null}}import{stripVTControlCharacters as cb}from"node:util";function nd(t,e={}){return{code:"CLASSIC_COMMAND_FAILED",message:cb(t instanceof Error?t.message:String(t)),...e}}function lb(t,e){return{exitCode:e.exitCode,stdout:JSON.stringify({command:t,exitCode:e.exitCode,agent:rd(e.data),...e.data===void 0?{}:{data:e.data},...e.envelope===void 0?{}:{summary:e.envelope.summary,...e.envelope.next===void 0?{}:{next:e.envelope.next},...e.envelope.user_message===void 0?{}:{user_message:e.envelope.user_message}},...e.stdout===void 0?{}:{stdout:e.stdout},...e.stderr===void 0?{}:{stderr:e.stderr}})+`
|
|
177
|
+
`,...e.envelope===void 0?{}:{envelope:e.envelope}}}async function ub(t,e,r,n={}){let i=r.indexOf("--"),o=l=>i<0||l<i,s=r.some((l,u)=>o(u)&&l==="--json"),a=r.filter((l,u)=>!o(u)||l!=="--json"),c;try{let l=td(t,a);c=l?{exitCode:0,stdout:l}:await e(a,{json:s,invocationCwd:n.invocationCwd??process.cwd(),...n.projectRoot?{projectRoot:n.projectRoot}:{}})}catch(l){c={exitCode:70,stderr:l instanceof Error?l.message:String(l),data:{issues:[nd(l)]}}}return s?lb(t,c):c}async function id(t,e,r=process.argv.slice(2)){let n=await ub(t,e,r);return n.stdout&&process.stdout.write(n.stdout),n.stderr&&process.stderr.write(n.stderr+(n.stderr.endsWith(`
|
|
165
178
|
`)?"":`
|
|
166
|
-
`)),
|
|
179
|
+
`)),n.exitCode}process.exitCode=await id("hook-guard",Qf);
|