@rpamis/comet 0.4.0-beta.16 → 0.4.0-beta.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/README.md +37 -33
- package/assets/eval-reports/comet-native-vs-beta16-beta17-20260810/native-benchmark-report.html +8 -0
- package/assets/eval-reports/comet-native-vs-beta16-beta17-20260810/native-benchmark-report.json +286 -0
- package/assets/manifest.json +25 -17
- package/assets/skills/comet/SKILL.md +1 -1
- package/assets/skills/comet/agents/openai.yaml +3 -0
- package/assets/skills/comet/rules/comet-phase-guard.en.md +1 -1
- package/assets/skills/comet/rules/comet-phase-guard.md +1 -1
- package/assets/skills/comet/rules/comet-workflow-guard.en.md +2 -2
- package/assets/skills/comet/rules/comet-workflow-guard.md +2 -2
- package/assets/skills/comet/scripts/comet-archive.mjs +65 -65
- package/assets/skills/comet/scripts/comet-entry-runtime.mjs +47 -47
- package/assets/skills/comet/scripts/comet-guard.mjs +105 -105
- package/assets/skills/comet/scripts/comet-handoff.mjs +74 -74
- package/assets/skills/comet/scripts/comet-hook-guard.mjs +75 -75
- package/assets/skills/comet/scripts/comet-hook-router.mjs +142 -140
- package/assets/skills/comet/scripts/comet-resume-probe.mjs +87 -87
- package/assets/skills/comet/scripts/comet-runtime.mjs +145 -145
- package/assets/skills/comet/scripts/comet-state.mjs +69 -69
- package/assets/skills/comet/scripts/comet-yaml-validate.mjs +89 -89
- package/assets/skills/comet-any/SKILL.md +2 -1
- package/assets/skills/comet-any/agents/openai.yaml +5 -0
- package/assets/skills/comet-archive/SKILL.md +7 -6
- package/assets/skills/comet-archive/agents/openai.yaml +5 -0
- package/assets/skills/comet-build/SKILL.md +14 -13
- package/assets/skills/comet-build/agents/openai.yaml +5 -0
- package/assets/skills/comet-classic/SKILL.md +14 -14
- package/assets/skills/comet-classic/agents/openai.yaml +3 -0
- package/assets/skills/{comet → comet-classic}/reference/auto-transition.md +1 -1
- package/assets/skills/{comet → comet-classic}/reference/comet-yaml-fields.md +2 -2
- package/assets/skills/{comet → comet-classic}/reference/context-recovery.md +5 -5
- package/assets/skills/{comet → comet-classic}/reference/debug-gate.md +2 -2
- package/assets/skills/{comet → comet-classic}/reference/decision-point.md +1 -1
- package/assets/skills/{comet → comet-classic}/reference/dirty-worktree.md +1 -1
- package/assets/skills/{comet → comet-classic}/reference/file-structure.md +1 -1
- package/assets/skills/{comet → comet-classic}/reference/intent-frame.md +1 -1
- package/assets/skills/{comet → comet-classic}/reference/scripts.md +1 -1
- package/assets/skills/{comet → comet-classic}/reference/subagent-dispatch.md +1 -1
- package/assets/skills/comet-design/SKILL.md +7 -6
- package/assets/skills/comet-design/agents/openai.yaml +5 -0
- package/assets/skills/comet-hotfix/SKILL.md +10 -9
- package/assets/skills/comet-hotfix/agents/openai.yaml +5 -0
- package/assets/skills/comet-native/SKILL.md +54 -168
- package/assets/skills/comet-native/agents/openai.yaml +3 -0
- package/assets/skills/comet-native/reference/artifacts.md +23 -89
- package/assets/skills/comet-native/reference/clarification.md +54 -29
- package/assets/skills/comet-native/reference/commands.md +30 -173
- package/assets/skills/comet-native/reference/recovery.md +38 -88
- package/assets/skills/comet-native/reference/workspace.md +23 -0
- package/assets/skills/comet-native/scripts/comet-native-archive.mjs +184 -152
- package/assets/skills/comet-native/scripts/comet-native-doctor.mjs +219 -163
- package/assets/skills/comet-native/scripts/comet-native-hook-guard.mjs +126 -117
- package/assets/skills/comet-native/scripts/comet-native-init.mjs +134 -124
- package/assets/skills/comet-native/scripts/comet-native-new.mjs +170 -163
- package/assets/skills/comet-native/scripts/comet-native-next.mjs +179 -148
- package/assets/skills/comet-native/scripts/comet-native-root.mjs +152 -147
- package/assets/skills/comet-native/scripts/comet-native-runtime.mjs +247 -202
- package/assets/skills/comet-native/scripts/comet-native-select.mjs +153 -146
- package/assets/skills/comet-native/scripts/comet-native-show.mjs +117 -110
- package/assets/skills/comet-native/scripts/comet-native-spec.mjs +133 -151
- package/assets/skills/comet-native/scripts/comet-native-status.mjs +146 -139
- package/assets/skills/comet-open/SKILL.md +7 -6
- package/assets/skills/comet-open/agents/openai.yaml +5 -0
- package/assets/skills/comet-tweak/SKILL.md +11 -10
- package/assets/skills/comet-tweak/agents/openai.yaml +5 -0
- package/assets/skills/comet-verify/SKILL.md +9 -8
- package/assets/skills/comet-verify/agents/openai.yaml +5 -0
- package/assets/skills-zh/comet/SKILL.md +1 -1
- package/assets/skills-zh/comet/agents/openai.yaml +3 -0
- package/assets/skills-zh/comet-any/SKILL.md +2 -1
- package/assets/skills-zh/comet-any/agents/openai.yaml +5 -0
- package/assets/skills-zh/comet-archive/SKILL.md +7 -6
- package/assets/skills-zh/comet-archive/agents/openai.yaml +5 -0
- package/assets/skills-zh/comet-build/SKILL.md +14 -13
- package/assets/skills-zh/comet-build/agents/openai.yaml +5 -0
- package/assets/skills-zh/comet-classic/SKILL.md +15 -15
- package/assets/skills-zh/comet-classic/agents/openai.yaml +3 -0
- package/assets/skills-zh/{comet → comet-classic}/reference/auto-transition.md +1 -1
- package/assets/skills-zh/{comet → comet-classic}/reference/comet-yaml-fields.md +2 -2
- package/assets/skills-zh/{comet → comet-classic}/reference/context-recovery.md +5 -5
- package/assets/skills-zh/{comet → comet-classic}/reference/debug-gate.md +2 -2
- package/assets/skills-zh/{comet → comet-classic}/reference/decision-point.md +1 -1
- package/assets/skills-zh/{comet → comet-classic}/reference/dirty-worktree.md +1 -1
- package/assets/skills-zh/{comet → comet-classic}/reference/file-structure.md +1 -1
- package/assets/skills-zh/{comet → comet-classic}/reference/intent-frame.md +1 -1
- package/assets/skills-zh/{comet → comet-classic}/reference/scripts.md +1 -1
- package/assets/skills-zh/{comet → comet-classic}/reference/subagent-dispatch.md +1 -1
- package/assets/skills-zh/comet-design/SKILL.md +7 -6
- package/assets/skills-zh/comet-design/agents/openai.yaml +5 -0
- package/assets/skills-zh/comet-hotfix/SKILL.md +10 -9
- package/assets/skills-zh/comet-hotfix/agents/openai.yaml +5 -0
- package/assets/skills-zh/comet-native/SKILL.md +54 -168
- package/assets/skills-zh/comet-native/agents/openai.yaml +3 -0
- package/assets/skills-zh/comet-native/reference/artifacts.md +23 -89
- package/assets/skills-zh/comet-native/reference/clarification.md +40 -15
- package/assets/skills-zh/comet-native/reference/commands.md +30 -173
- package/assets/skills-zh/comet-native/reference/recovery.md +36 -86
- package/assets/skills-zh/comet-native/reference/workspace.md +23 -0
- package/assets/skills-zh/comet-open/SKILL.md +7 -6
- package/assets/skills-zh/comet-open/agents/openai.yaml +5 -0
- package/assets/skills-zh/comet-tweak/SKILL.md +11 -10
- package/assets/skills-zh/comet-tweak/agents/openai.yaml +5 -0
- package/assets/skills-zh/comet-verify/SKILL.md +9 -8
- package/assets/skills-zh/comet-verify/agents/openai.yaml +5 -0
- package/bin/fast-runtime-router.js +0 -4
- package/dist/app/commands/doctor.d.ts.map +1 -1
- package/dist/app/commands/doctor.js +8 -0
- package/dist/app/commands/doctor.js.map +1 -1
- package/dist/app/commands/init.d.ts.map +1 -1
- package/dist/app/commands/init.js +9 -1
- package/dist/app/commands/init.js.map +1 -1
- package/dist/app/commands/update.d.ts.map +1 -1
- package/dist/app/commands/update.js +9 -2
- package/dist/app/commands/update.js.map +1 -1
- package/dist/config/repository-layout.json +0 -8
- package/dist/domains/bundle/bundle-platform.d.ts.map +1 -1
- package/dist/domains/bundle/bundle-platform.js +8 -0
- package/dist/domains/bundle/bundle-platform.js.map +1 -1
- package/dist/domains/bundle/types.d.ts +1 -1
- package/dist/domains/bundle/types.d.ts.map +1 -1
- package/dist/domains/comet-entry/hook-adapter.d.ts.map +1 -1
- package/dist/domains/comet-entry/hook-adapter.js +2 -0
- package/dist/domains/comet-entry/hook-adapter.js.map +1 -1
- package/dist/domains/comet-entry/hook-router-entry.d.ts.map +1 -1
- package/dist/domains/comet-entry/hook-router-entry.js +11 -2
- package/dist/domains/comet-entry/hook-router-entry.js.map +1 -1
- package/dist/domains/comet-entry/project-activation.d.ts.map +1 -1
- package/dist/domains/comet-entry/project-activation.js +2 -1
- package/dist/domains/comet-entry/project-activation.js.map +1 -1
- package/dist/domains/comet-entry/resume-probe.d.ts.map +1 -1
- package/dist/domains/comet-entry/resume-probe.js +48 -4
- package/dist/domains/comet-entry/resume-probe.js.map +1 -1
- package/dist/domains/comet-native/native-acceptance.d.ts +4 -3
- package/dist/domains/comet-native/native-acceptance.d.ts.map +1 -1
- package/dist/domains/comet-native/native-acceptance.js +23 -18
- 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 +204 -61
- package/dist/domains/comet-native/native-archive-command.js.map +1 -1
- package/dist/domains/comet-native/native-archive-transaction.d.ts.map +1 -1
- package/dist/domains/comet-native/native-archive-transaction.js +28 -23
- package/dist/domains/comet-native/native-archive-transaction.js.map +1 -1
- package/dist/domains/comet-native/native-archive.d.ts +1 -0
- package/dist/domains/comet-native/native-archive.d.ts.map +1 -1
- package/dist/domains/comet-native/native-archive.js +56 -12
- package/dist/domains/comet-native/native-archive.js.map +1 -1
- package/dist/domains/comet-native/native-bounded-file.d.ts +32 -2
- package/dist/domains/comet-native/native-bounded-file.d.ts.map +1 -1
- package/dist/domains/comet-native/native-bounded-file.js +87 -6
- package/dist/domains/comet-native/native-bounded-file.js.map +1 -1
- package/dist/domains/comet-native/native-build-evidence.d.ts.map +1 -1
- package/dist/domains/comet-native/native-build-evidence.js +23 -1
- package/dist/domains/comet-native/native-build-evidence.js.map +1 -1
- package/dist/domains/comet-native/native-change.d.ts +1 -0
- package/dist/domains/comet-native/native-change.d.ts.map +1 -1
- package/dist/domains/comet-native/native-change.js +96 -8
- package/dist/domains/comet-native/native-change.js.map +1 -1
- package/dist/domains/comet-native/native-check-executor.d.ts +36 -0
- package/dist/domains/comet-native/native-check-executor.d.ts.map +1 -0
- package/dist/domains/comet-native/native-check-executor.js +132 -0
- package/dist/domains/comet-native/native-check-executor.js.map +1 -0
- package/dist/domains/comet-native/native-check-receipt-model.d.ts +9 -0
- package/dist/domains/comet-native/native-check-receipt-model.d.ts.map +1 -1
- package/dist/domains/comet-native/native-check-receipt-model.js +70 -8
- package/dist/domains/comet-native/native-check-receipt-model.js.map +1 -1
- package/dist/domains/comet-native/native-check-receipt-storage.d.ts.map +1 -1
- package/dist/domains/comet-native/native-check-receipt-storage.js +9 -8
- package/dist/domains/comet-native/native-check-receipt-storage.js.map +1 -1
- package/dist/domains/comet-native/native-check-receipt.d.ts.map +1 -1
- package/dist/domains/comet-native/native-check-receipt.js +123 -60
- package/dist/domains/comet-native/native-check-receipt.js.map +1 -1
- package/dist/domains/comet-native/native-checkpoint-command.d.ts.map +1 -1
- package/dist/domains/comet-native/native-checkpoint-command.js +0 -6
- package/dist/domains/comet-native/native-checkpoint-command.js.map +1 -1
- package/dist/domains/comet-native/native-checkpoint-storage.d.ts.map +1 -1
- package/dist/domains/comet-native/native-checkpoint-storage.js +27 -19
- package/dist/domains/comet-native/native-checkpoint-storage.js.map +1 -1
- package/dist/domains/comet-native/native-cli-help.d.ts +6 -0
- package/dist/domains/comet-native/native-cli-help.d.ts.map +1 -0
- package/dist/domains/comet-native/native-cli-help.js +192 -0
- package/dist/domains/comet-native/native-cli-help.js.map +1 -0
- package/dist/domains/comet-native/native-cli-shared.d.ts +2 -2
- package/dist/domains/comet-native/native-cli-shared.d.ts.map +1 -1
- package/dist/domains/comet-native/native-cli-shared.js +46 -24
- package/dist/domains/comet-native/native-cli-shared.js.map +1 -1
- package/dist/domains/comet-native/native-cli.d.ts.map +1 -1
- package/dist/domains/comet-native/native-cli.js +18 -11
- package/dist/domains/comet-native/native-cli.js.map +1 -1
- package/dist/domains/comet-native/native-config.d.ts +2 -1
- package/dist/domains/comet-native/native-config.d.ts.map +1 -1
- package/dist/domains/comet-native/native-config.js +2 -1
- package/dist/domains/comet-native/native-config.js.map +1 -1
- package/dist/domains/comet-native/native-continuation.d.ts.map +1 -1
- package/dist/domains/comet-native/native-continuation.js +175 -147
- package/dist/domains/comet-native/native-continuation.js.map +1 -1
- package/dist/domains/comet-native/native-diagnostics.d.ts.map +1 -1
- package/dist/domains/comet-native/native-diagnostics.js +96 -13
- package/dist/domains/comet-native/native-diagnostics.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 +327 -0
- package/dist/domains/comet-native/native-doctor-command.js.map +1 -1
- package/dist/domains/comet-native/native-doctor.d.ts +1 -0
- package/dist/domains/comet-native/native-doctor.d.ts.map +1 -1
- package/dist/domains/comet-native/native-doctor.js +116 -22
- package/dist/domains/comet-native/native-doctor.js.map +1 -1
- package/dist/domains/comet-native/native-evidence-projection.d.ts +50 -0
- package/dist/domains/comet-native/native-evidence-projection.d.ts.map +1 -0
- package/dist/domains/comet-native/native-evidence-projection.js +284 -0
- package/dist/domains/comet-native/native-evidence-projection.js.map +1 -0
- package/dist/domains/comet-native/native-evidence-retention.d.ts.map +1 -1
- package/dist/domains/comet-native/native-evidence-retention.js +14 -12
- package/dist/domains/comet-native/native-evidence-retention.js.map +1 -1
- package/dist/domains/comet-native/native-evidence-storage.d.ts.map +1 -1
- package/dist/domains/comet-native/native-evidence-storage.js +14 -11
- package/dist/domains/comet-native/native-evidence-storage.js.map +1 -1
- package/dist/domains/comet-native/native-findings.d.ts.map +1 -1
- package/dist/domains/comet-native/native-findings.js +18 -0
- package/dist/domains/comet-native/native-findings.js.map +1 -1
- package/dist/domains/comet-native/native-git-provenance.d.ts +16 -0
- package/dist/domains/comet-native/native-git-provenance.d.ts.map +1 -0
- package/dist/domains/comet-native/native-git-provenance.js +171 -0
- package/dist/domains/comet-native/native-git-provenance.js.map +1 -0
- package/dist/domains/comet-native/native-hook-guard.d.ts.map +1 -1
- package/dist/domains/comet-native/native-hook-guard.js +159 -18
- package/dist/domains/comet-native/native-hook-guard.js.map +1 -1
- package/dist/domains/comet-native/native-init-command.d.ts.map +1 -1
- package/dist/domains/comet-native/native-init-command.js +14 -2
- package/dist/domains/comet-native/native-init-command.js.map +1 -1
- package/dist/domains/comet-native/native-local-execution.d.ts +25 -0
- package/dist/domains/comet-native/native-local-execution.d.ts.map +1 -0
- package/dist/domains/comet-native/native-local-execution.js +241 -0
- package/dist/domains/comet-native/native-local-execution.js.map +1 -0
- package/dist/domains/comet-native/native-lock.d.ts +1 -1
- package/dist/domains/comet-native/native-lock.d.ts.map +1 -1
- package/dist/domains/comet-native/native-lock.js +9 -9
- package/dist/domains/comet-native/native-lock.js.map +1 -1
- package/dist/domains/comet-native/native-loop-runtime.d.ts +63 -0
- package/dist/domains/comet-native/native-loop-runtime.d.ts.map +1 -0
- package/dist/domains/comet-native/native-loop-runtime.js +580 -0
- package/dist/domains/comet-native/native-loop-runtime.js.map +1 -0
- package/dist/domains/comet-native/native-mutation-lock.d.ts +2 -0
- package/dist/domains/comet-native/native-mutation-lock.d.ts.map +1 -1
- package/dist/domains/comet-native/native-mutation-lock.js +23 -2
- package/dist/domains/comet-native/native-mutation-lock.js.map +1 -1
- package/dist/domains/comet-native/native-new-command.d.ts.map +1 -1
- package/dist/domains/comet-native/native-new-command.js +27 -20
- package/dist/domains/comet-native/native-new-command.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 +114 -63
- package/dist/domains/comet-native/native-next-command.js.map +1 -1
- package/dist/domains/comet-native/native-paths.d.ts +18 -0
- package/dist/domains/comet-native/native-paths.d.ts.map +1 -1
- package/dist/domains/comet-native/native-paths.js +125 -13
- package/dist/domains/comet-native/native-paths.js.map +1 -1
- package/dist/domains/comet-native/native-portable-acceptance.d.ts +28 -0
- package/dist/domains/comet-native/native-portable-acceptance.d.ts.map +1 -0
- package/dist/domains/comet-native/native-portable-acceptance.js +73 -0
- package/dist/domains/comet-native/native-portable-acceptance.js.map +1 -0
- package/dist/domains/comet-native/native-portable-archive.d.ts +37 -0
- package/dist/domains/comet-native/native-portable-archive.d.ts.map +1 -0
- package/dist/domains/comet-native/native-portable-archive.js +492 -0
- package/dist/domains/comet-native/native-portable-archive.js.map +1 -0
- package/dist/domains/comet-native/native-portable-continuation.d.ts +29 -0
- package/dist/domains/comet-native/native-portable-continuation.d.ts.map +1 -0
- package/dist/domains/comet-native/native-portable-continuation.js +341 -0
- package/dist/domains/comet-native/native-portable-continuation.js.map +1 -0
- package/dist/domains/comet-native/native-portable-migration-runtime.d.ts +9 -0
- package/dist/domains/comet-native/native-portable-migration-runtime.d.ts.map +1 -0
- package/dist/domains/comet-native/native-portable-migration-runtime.js +213 -0
- package/dist/domains/comet-native/native-portable-migration-runtime.js.map +1 -0
- package/dist/domains/comet-native/native-portable-migration.d.ts +42 -0
- package/dist/domains/comet-native/native-portable-migration.d.ts.map +1 -0
- package/dist/domains/comet-native/native-portable-migration.js +212 -0
- package/dist/domains/comet-native/native-portable-migration.js.map +1 -0
- package/dist/domains/comet-native/native-portable-recovery.d.ts +15 -0
- package/dist/domains/comet-native/native-portable-recovery.d.ts.map +1 -0
- package/dist/domains/comet-native/native-portable-recovery.js +203 -0
- package/dist/domains/comet-native/native-portable-recovery.js.map +1 -0
- package/dist/domains/comet-native/native-portable-runtime.d.ts +150 -0
- package/dist/domains/comet-native/native-portable-runtime.d.ts.map +1 -0
- package/dist/domains/comet-native/native-portable-runtime.js +1444 -0
- package/dist/domains/comet-native/native-portable-runtime.js.map +1 -0
- package/dist/domains/comet-native/native-portable-state.d.ts +30 -0
- package/dist/domains/comet-native/native-portable-state.d.ts.map +1 -0
- package/dist/domains/comet-native/native-portable-state.js +688 -0
- package/dist/domains/comet-native/native-portable-state.js.map +1 -0
- package/dist/domains/comet-native/native-portable-status.d.ts +62 -0
- package/dist/domains/comet-native/native-portable-status.d.ts.map +1 -0
- package/dist/domains/comet-native/native-portable-status.js +125 -0
- package/dist/domains/comet-native/native-portable-status.js.map +1 -0
- package/dist/domains/comet-native/native-portable-text.d.ts +8 -0
- package/dist/domains/comet-native/native-portable-text.d.ts.map +1 -0
- package/dist/domains/comet-native/native-portable-text.js +28 -0
- package/dist/domains/comet-native/native-portable-text.js.map +1 -0
- package/dist/domains/comet-native/native-portable-transactions.d.ts +41 -0
- package/dist/domains/comet-native/native-portable-transactions.d.ts.map +1 -0
- package/dist/domains/comet-native/native-portable-transactions.js +204 -0
- package/dist/domains/comet-native/native-portable-transactions.js.map +1 -0
- package/dist/domains/comet-native/native-portable-types.d.ts +165 -0
- package/dist/domains/comet-native/native-portable-types.d.ts.map +1 -0
- package/dist/domains/comet-native/native-portable-types.js +18 -0
- package/dist/domains/comet-native/native-portable-types.js.map +1 -0
- package/dist/domains/comet-native/native-repair-integration.js +5 -5
- package/dist/domains/comet-native/native-repair-integration.js.map +1 -1
- package/dist/domains/comet-native/native-resume-view.d.ts.map +1 -1
- package/dist/domains/comet-native/native-resume-view.js +1 -5
- package/dist/domains/comet-native/native-resume-view.js.map +1 -1
- package/dist/domains/comet-native/native-root-move.d.ts.map +1 -1
- package/dist/domains/comet-native/native-root-move.js +4 -20
- package/dist/domains/comet-native/native-root-move.js.map +1 -1
- package/dist/domains/comet-native/native-run-consistency.d.ts.map +1 -1
- package/dist/domains/comet-native/native-run-consistency.js +8 -12
- package/dist/domains/comet-native/native-run-consistency.js.map +1 -1
- package/dist/domains/comet-native/native-run-store.js +4 -4
- package/dist/domains/comet-native/native-run-store.js.map +1 -1
- package/dist/domains/comet-native/native-runner-input.d.ts +160 -0
- package/dist/domains/comet-native/native-runner-input.d.ts.map +1 -0
- package/dist/domains/comet-native/native-runner-input.js +347 -0
- package/dist/domains/comet-native/native-runner-input.js.map +1 -0
- package/dist/domains/comet-native/native-runner-protocol.d.ts +40 -0
- package/dist/domains/comet-native/native-runner-protocol.d.ts.map +1 -0
- package/dist/domains/comet-native/native-runner-protocol.js +55 -0
- package/dist/domains/comet-native/native-runner-protocol.js.map +1 -0
- package/dist/domains/comet-native/native-runtime-package.d.ts +3 -0
- package/dist/domains/comet-native/native-runtime-package.d.ts.map +1 -1
- package/dist/domains/comet-native/native-runtime-package.js +5 -1
- package/dist/domains/comet-native/native-runtime-package.js.map +1 -1
- package/dist/domains/comet-native/native-schema-migration.d.ts.map +1 -1
- package/dist/domains/comet-native/native-schema-migration.js +30 -27
- package/dist/domains/comet-native/native-schema-migration.js.map +1 -1
- package/dist/domains/comet-native/native-select-command.d.ts.map +1 -1
- package/dist/domains/comet-native/native-select-command.js +8 -4
- package/dist/domains/comet-native/native-select-command.js.map +1 -1
- package/dist/domains/comet-native/native-selection.d.ts.map +1 -1
- package/dist/domains/comet-native/native-selection.js +11 -2
- package/dist/domains/comet-native/native-selection.js.map +1 -1
- package/dist/domains/comet-native/native-show-command.d.ts.map +1 -1
- package/dist/domains/comet-native/native-show-command.js +36 -0
- package/dist/domains/comet-native/native-show-command.js.map +1 -1
- package/dist/domains/comet-native/native-snapshot.d.ts.map +1 -1
- package/dist/domains/comet-native/native-snapshot.js +13 -10
- package/dist/domains/comet-native/native-snapshot.js.map +1 -1
- package/dist/domains/comet-native/native-spec-command.d.ts.map +1 -1
- package/dist/domains/comet-native/native-spec-command.js +14 -28
- package/dist/domains/comet-native/native-spec-command.js.map +1 -1
- package/dist/domains/comet-native/native-specs.js +3 -3
- package/dist/domains/comet-native/native-specs.js.map +1 -1
- package/dist/domains/comet-native/native-status-command.d.ts.map +1 -1
- package/dist/domains/comet-native/native-status-command.js +7 -17
- package/dist/domains/comet-native/native-status-command.js.map +1 -1
- package/dist/domains/comet-native/native-status-discovery.d.ts +51 -0
- package/dist/domains/comet-native/native-status-discovery.d.ts.map +1 -0
- package/dist/domains/comet-native/native-status-discovery.js +299 -0
- package/dist/domains/comet-native/native-status-discovery.js.map +1 -0
- package/dist/domains/comet-native/native-trajectory-recovery.d.ts.map +1 -1
- package/dist/domains/comet-native/native-trajectory-recovery.js +6 -9
- package/dist/domains/comet-native/native-trajectory-recovery.js.map +1 -1
- package/dist/domains/comet-native/native-transaction.d.ts.map +1 -1
- package/dist/domains/comet-native/native-transaction.js +31 -20
- package/dist/domains/comet-native/native-transaction.js.map +1 -1
- package/dist/domains/comet-native/native-transition-evidence.d.ts.map +1 -1
- package/dist/domains/comet-native/native-transition-evidence.js +1 -0
- package/dist/domains/comet-native/native-transition-evidence.js.map +1 -1
- package/dist/domains/comet-native/native-transition-journal.d.ts.map +1 -1
- package/dist/domains/comet-native/native-transition-journal.js +71 -22
- package/dist/domains/comet-native/native-transition-journal.js.map +1 -1
- package/dist/domains/comet-native/native-transitions.d.ts.map +1 -1
- package/dist/domains/comet-native/native-transitions.js +167 -15
- package/dist/domains/comet-native/native-transitions.js.map +1 -1
- package/dist/domains/comet-native/native-types.d.ts +36 -1
- package/dist/domains/comet-native/native-types.d.ts.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 +18 -100
- package/dist/domains/comet-native/native-verification-receipt-runtime.js.map +1 -1
- package/dist/domains/comet-native/native-verification-report-v2.d.ts +12 -0
- package/dist/domains/comet-native/native-verification-report-v2.d.ts.map +1 -0
- package/dist/domains/comet-native/native-verification-report-v2.js +141 -0
- package/dist/domains/comet-native/native-verification-report-v2.js.map +1 -0
- package/dist/domains/comet-native/native-verification-runtime.d.ts.map +1 -1
- package/dist/domains/comet-native/native-verification-runtime.js +7 -2
- package/dist/domains/comet-native/native-verification-runtime.js.map +1 -1
- package/dist/domains/comet-native/native-verification-scope.d.ts +23 -0
- package/dist/domains/comet-native/native-verification-scope.d.ts.map +1 -1
- package/dist/domains/comet-native/native-verification-scope.js +106 -19
- package/dist/domains/comet-native/native-verification-scope.js.map +1 -1
- package/dist/domains/comet-native/native-verifier-protocol.d.ts +49 -0
- package/dist/domains/comet-native/native-verifier-protocol.d.ts.map +1 -0
- package/dist/domains/comet-native/native-verifier-protocol.js +157 -0
- package/dist/domains/comet-native/native-verifier-protocol.js.map +1 -0
- package/dist/domains/comet-native/native-workspace-finish.d.ts +61 -0
- package/dist/domains/comet-native/native-workspace-finish.d.ts.map +1 -0
- package/dist/domains/comet-native/native-workspace-finish.js +332 -0
- package/dist/domains/comet-native/native-workspace-finish.js.map +1 -0
- package/dist/domains/comet-native/native-workspace-preparation.d.ts +32 -0
- package/dist/domains/comet-native/native-workspace-preparation.d.ts.map +1 -0
- package/dist/domains/comet-native/native-workspace-preparation.js +265 -0
- package/dist/domains/comet-native/native-workspace-preparation.js.map +1 -0
- package/dist/domains/comet-native/native-workspace.d.ts +9 -1
- package/dist/domains/comet-native/native-workspace.d.ts.map +1 -1
- package/dist/domains/comet-native/native-workspace.js +109 -11
- package/dist/domains/comet-native/native-workspace.js.map +1 -1
- package/dist/domains/dashboard/native-adapter.d.ts +136 -127
- package/dist/domains/dashboard/native-adapter.d.ts.map +1 -1
- package/dist/domains/dashboard/native-adapter.js +157 -271
- package/dist/domains/dashboard/native-adapter.js.map +1 -1
- package/dist/domains/dashboard/native-collector.d.ts +4 -4
- package/dist/domains/dashboard/native-collector.d.ts.map +1 -1
- package/dist/domains/dashboard/native-collector.js +230 -412
- package/dist/domains/dashboard/native-collector.js.map +1 -1
- package/dist/domains/dashboard/native-legacy-adapter.d.ts +30 -0
- package/dist/domains/dashboard/native-legacy-adapter.d.ts.map +1 -0
- package/dist/domains/dashboard/native-legacy-adapter.js +115 -0
- package/dist/domains/dashboard/native-legacy-adapter.js.map +1 -0
- package/dist/domains/dashboard/web/assets/{arc-ClrSujVb.js → arc-CkuYweSh.js} +1 -1
- package/dist/domains/dashboard/web/assets/{architectureDiagram-3BPJPVTR-B4A_t84A.js → architectureDiagram-3BPJPVTR--tTGrKam.js} +1 -1
- package/dist/domains/dashboard/web/assets/{blockDiagram-GPEHLZMM-D72u2953.js → blockDiagram-GPEHLZMM-DLKYOixs.js} +1 -1
- package/dist/domains/dashboard/web/assets/{c4Diagram-AAUBKEIU-Ca5zba3N.js → c4Diagram-AAUBKEIU-BL17BIb8.js} +1 -1
- package/dist/domains/dashboard/web/assets/channel-Cg__FSMr.js +1 -0
- package/dist/domains/dashboard/web/assets/{chunk-2J33WTMH-CCVPBm0J.js → chunk-2J33WTMH-B_DDS2IK.js} +1 -1
- package/dist/domains/dashboard/web/assets/{chunk-4BX2VUAB-JYluRsP-.js → chunk-4BX2VUAB-vQyyh3eG.js} +1 -1
- package/dist/domains/dashboard/web/assets/{chunk-55IACEB6-DfYm7pN7.js → chunk-55IACEB6-Cug8J1Qa.js} +1 -1
- package/dist/domains/dashboard/web/assets/{chunk-727SXJPM-CwghIMO9.js → chunk-727SXJPM-pMreYMW7.js} +1 -1
- package/dist/domains/dashboard/web/assets/{chunk-AQP2D5EJ-BA_zgMXZ.js → chunk-AQP2D5EJ-BUkV_rb7.js} +1 -1
- package/dist/domains/dashboard/web/assets/{chunk-FMBD7UC4-BAJLB5V6.js → chunk-FMBD7UC4-CQXqBSqQ.js} +1 -1
- package/dist/domains/dashboard/web/assets/{chunk-ND2GUHAM-Bj6HWRwi.js → chunk-ND2GUHAM-XWLMOyd4.js} +1 -1
- package/dist/domains/dashboard/web/assets/{chunk-QZHKN3VN-B1kXfg5N.js → chunk-QZHKN3VN-4drjXzHQ.js} +1 -1
- package/dist/domains/dashboard/web/assets/classDiagram-4FO5ZUOK-CsC-pvu9.js +1 -0
- package/dist/domains/dashboard/web/assets/classDiagram-v2-Q7XG4LA2-CsC-pvu9.js +1 -0
- package/dist/domains/dashboard/web/assets/{cose-bilkent-S5V4N54A-BBrkuiAU.js → cose-bilkent-S5V4N54A-IQKP-hgj.js} +1 -1
- package/dist/domains/dashboard/web/assets/{cynefin-VYW2F7L2-DlFhgQHt.js → cynefin-VYW2F7L2-CvvRO4J2.js} +1 -1
- package/dist/domains/dashboard/web/assets/{dagre-BM42HDAG-B0Bk5oiP.js → dagre-BM42HDAG-DeOQo7bP.js} +1 -1
- package/dist/domains/dashboard/web/assets/demo-CeIDHUFJ.js +24 -0
- package/dist/domains/dashboard/web/assets/{diagram-2AECGRRQ-tvTUiBA2.js → diagram-2AECGRRQ-IQd_jQwB.js} +1 -1
- package/dist/domains/dashboard/web/assets/{diagram-5GNKFQAL-BZfcK29q.js → diagram-5GNKFQAL-Dllkdt0m.js} +1 -1
- package/dist/domains/dashboard/web/assets/{diagram-KO2AKTUF-BQahyP-C.js → diagram-KO2AKTUF-CN_LYqvT.js} +1 -1
- package/dist/domains/dashboard/web/assets/{diagram-LMA3HP47-D5bJnW2C.js → diagram-LMA3HP47-DK36WkNN.js} +1 -1
- package/dist/domains/dashboard/web/assets/{diagram-OG6HWLK6-DTwWdzWJ.js → diagram-OG6HWLK6-iqUnMYEh.js} +1 -1
- package/dist/domains/dashboard/web/assets/{erDiagram-TEJ5UH35-BbvrdCp9.js → erDiagram-TEJ5UH35-Bc64lzy8.js} +1 -1
- package/dist/domains/dashboard/web/assets/{flowDiagram-I6XJVG4X-DgbR7Tcc.js → flowDiagram-I6XJVG4X-UfOqef9j.js} +1 -1
- package/dist/domains/dashboard/web/assets/{ganttDiagram-6RSMTGT7-wWMOA7F4.js → ganttDiagram-6RSMTGT7-D-u6Aauc.js} +1 -1
- package/dist/domains/dashboard/web/assets/{gitGraphDiagram-PVQCEYII-DCxvMAUJ.js → gitGraphDiagram-PVQCEYII-CaWEk3PM.js} +1 -1
- package/dist/domains/dashboard/web/assets/index-BFwKBVTJ.css +1 -0
- package/dist/domains/dashboard/web/assets/{index-Blit0P5Z.js → index-BNyOfAhu.js} +1 -1
- package/dist/domains/dashboard/web/assets/index-COZ_03uK.js +257 -0
- package/dist/domains/dashboard/web/assets/{infoDiagram-5YYISTIA-9qXEkzDe.js → infoDiagram-5YYISTIA-BK07mNG0.js} +1 -1
- package/dist/domains/dashboard/web/assets/{ishikawaDiagram-YF4QCWOH-Dkf5othW.js → ishikawaDiagram-YF4QCWOH-mWnmaWfZ.js} +1 -1
- package/dist/domains/dashboard/web/assets/{journeyDiagram-JHISSGLW-C2_IkO4s.js → journeyDiagram-JHISSGLW-BPy-P7xx.js} +1 -1
- package/dist/domains/dashboard/web/assets/{kanban-definition-UN3LZRKU-BxWgu4DL.js → kanban-definition-UN3LZRKU-3Jq9c_lo.js} +1 -1
- package/dist/domains/dashboard/web/assets/{linear-Dkr6p-Ro.js → linear-kQyEW-4G.js} +1 -1
- package/dist/domains/dashboard/web/assets/{mermaid.core-DZUcsoG4.js → mermaid.core-COBBjtVH.js} +4 -4
- package/dist/domains/dashboard/web/assets/{mindmap-definition-RKZ34NQL-C9xyxGfa.js → mindmap-definition-RKZ34NQL-CyyurUpv.js} +1 -1
- package/dist/domains/dashboard/web/assets/{pieDiagram-4H26LBE5-Dn67tdOF.js → pieDiagram-4H26LBE5-CJro_XKk.js} +1 -1
- package/dist/domains/dashboard/web/assets/{quadrantDiagram-W4KKPZXB-Cy6iOcxc.js → quadrantDiagram-W4KKPZXB-CpayUMjH.js} +1 -1
- package/dist/domains/dashboard/web/assets/{requirementDiagram-4Y6WPE33-B_gZONhx.js → requirementDiagram-4Y6WPE33-Bi8YpfnA.js} +1 -1
- package/dist/domains/dashboard/web/assets/{sankeyDiagram-5OEKKPKP-C3u-4dOk.js → sankeyDiagram-5OEKKPKP-Wx60WwHe.js} +1 -1
- package/dist/domains/dashboard/web/assets/{sequenceDiagram-3UESZ5HK-Xd3ByTVF.js → sequenceDiagram-3UESZ5HK-BiMsRFbc.js} +1 -1
- package/dist/domains/dashboard/web/assets/{stateDiagram-AJRCARHV-CJGHL7Up.js → stateDiagram-AJRCARHV-BrURMY0R.js} +1 -1
- package/dist/domains/dashboard/web/assets/stateDiagram-v2-BHNVJYJU-BpEE-yEg.js +1 -0
- package/dist/domains/dashboard/web/assets/{timeline-definition-PNZ67QCA-DvONX2YQ.js → timeline-definition-PNZ67QCA-aHrrtV-b.js} +1 -1
- package/dist/domains/dashboard/web/assets/{vennDiagram-CIIHVFJN-B-L4qWy4.js → vennDiagram-CIIHVFJN-DGB16bvR.js} +1 -1
- package/dist/domains/dashboard/web/assets/{wardleyDiagram-YWT4CUSO-cf39WX2o.js → wardleyDiagram-YWT4CUSO-RVQbcySh.js} +1 -1
- package/dist/domains/dashboard/web/assets/{xychartDiagram-2RQKCTM6-Dk1vcm3u.js → xychartDiagram-2RQKCTM6-DMzzwDVX.js} +1 -1
- package/dist/domains/dashboard/web/index.html +16 -16
- package/dist/domains/skill/platform-inspect.d.ts.map +1 -1
- package/dist/domains/skill/platform-inspect.js +11 -3
- package/dist/domains/skill/platform-inspect.js.map +1 -1
- package/dist/domains/skill/platform-install.d.ts +7 -1
- package/dist/domains/skill/platform-install.d.ts.map +1 -1
- package/dist/domains/skill/platform-install.js +114 -33
- package/dist/domains/skill/platform-install.js.map +1 -1
- package/dist/domains/skill/uninstall.d.ts.map +1 -1
- package/dist/domains/skill/uninstall.js +69 -15
- package/dist/domains/skill/uninstall.js.map +1 -1
- package/dist/domains/workflow-contract/index.d.ts +1 -0
- package/dist/domains/workflow-contract/index.d.ts.map +1 -1
- package/dist/domains/workflow-contract/index.js +1 -0
- package/dist/domains/workflow-contract/index.js.map +1 -1
- package/dist/domains/workflow-contract/project-config.d.ts +2 -0
- package/dist/domains/workflow-contract/project-config.d.ts.map +1 -1
- package/dist/domains/workflow-contract/project-config.js +77 -17
- package/dist/domains/workflow-contract/project-config.js.map +1 -1
- package/dist/domains/workflow-contract/project-gitignore.d.ts +9 -0
- package/dist/domains/workflow-contract/project-gitignore.d.ts.map +1 -0
- package/dist/domains/workflow-contract/project-gitignore.js +108 -0
- package/dist/domains/workflow-contract/project-gitignore.js.map +1 -0
- package/dist/platform/install/platforms.d.ts +3 -1
- package/dist/platform/install/platforms.d.ts.map +1 -1
- package/dist/platform/install/platforms.js +9 -0
- package/dist/platform/install/platforms.js.map +1 -1
- package/dist/platform/paths/git-worktree.d.ts +2 -1
- package/dist/platform/paths/git-worktree.d.ts.map +1 -1
- package/dist/platform/paths/git-worktree.js +14 -1
- package/dist/platform/paths/git-worktree.js.map +1 -1
- package/dist/platform/process/external-command.d.ts +13 -0
- package/dist/platform/process/external-command.d.ts.map +1 -0
- package/dist/platform/process/external-command.js +45 -0
- package/dist/platform/process/external-command.js.map +1 -0
- package/dist/platform/process/git.d.ts +12 -0
- package/dist/platform/process/git.d.ts.map +1 -0
- package/dist/platform/process/git.js +86 -0
- package/dist/platform/process/git.js.map +1 -0
- package/dist/platform/process/spawn-command.d.ts +8 -0
- package/dist/platform/process/spawn-command.d.ts.map +1 -0
- package/dist/platform/process/spawn-command.js +113 -0
- package/dist/platform/process/spawn-command.js.map +1 -0
- package/eval/local/tasks/comet-native-clarification/validation/test_native_clarification.py +9 -21
- package/eval/local/tasks/comet-native-clarification-depth/validation/test_native_clarification_depth.py +4 -7
- package/eval/local/tasks/comet-native-clarification-modes/validation/test_native_clarification_modes.py +4 -10
- package/eval/local/tasks/comet-native-interrupted-transition/instruction.md +1 -1
- package/eval/local/tasks/comet-native-interrupted-transition/validation/test_native_interrupted_transition.py +15 -16
- package/eval/local/tasks/comet-native-repository-fact/instruction.md +2 -2
- package/eval/local/tasks/comet-native-repository-fact/validation/test_native_repository_fact.py +8 -2
- package/eval/local/tasks/comet-native-wave-b-decision-resume/instruction.md +8 -4
- package/eval/local/tasks/comet-native-wave-b-decision-resume/task.toml +6 -6
- package/eval/local/tasks/comet-native-wave-b-decision-resume/validation/test_native_wave_b_decision_resume.py +126 -135
- package/eval/local/tasks/comet-native-wave-c-verification-integrity/instruction.md +6 -6
- package/eval/local/tasks/comet-native-wave-c-verification-integrity/task.toml +8 -8
- package/eval/local/tasks/comet-native-wave-c-verification-integrity/validation/test_native_wave_c_verification_integrity.py +97 -317
- package/eval/local/tasks/comet-native-wave-d-stagnation-stop/instruction.md +7 -7
- package/eval/local/tasks/comet-native-wave-d-stagnation-stop/task.toml +4 -4
- package/eval/local/tasks/comet-native-wave-d-stagnation-stop/validation/test_native_wave_d_stagnation_stop.py +130 -199
- package/eval/local/tasks/comet-native-wave-e-parallel-safety/instruction.md +5 -5
- package/eval/local/tasks/comet-native-wave-e-parallel-safety/task.toml +8 -8
- package/eval/local/tasks/comet-native-wave-e-parallel-safety/validation/test_native_wave_e_parallel_safety.py +135 -239
- package/eval/local/tasks/comet-native-wave-f-dashboard-readonly/instruction.md +3 -3
- package/eval/local/tasks/comet-native-wave-f-dashboard-readonly/task.toml +6 -6
- package/eval/local/tasks/comet-native-wave-f-dashboard-readonly/validation/test_native_wave_f_dashboard_readonly.py +81 -439
- package/eval/local/tasks/comet-native-workflow/instruction.md +5 -4
- package/eval/local/tasks/comet-native-workflow/validation/test_native_workflow.py +145 -502
- package/eval/local/tasks/index.yaml +5 -5
- package/eval/local/tests/scaffold/test_native_aligned_eval.py +146 -35
- package/eval/local/tests/scaffold/test_native_wave_evaluations.py +75 -2054
- package/eval/local/tests/scaffold/test_tasks.py +38 -52
- package/eval/local/tests/tasks/test_tasks.py +3 -3
- package/eval/local/treatments/comet/comet_native_phase1.yaml +7 -4
- package/eval/pyproject.toml +4 -4
- package/eval/scaffold/python/native_eval.py +10 -5
- package/eval/scaffold/python/validation/native_v4.py +249 -0
- package/eval/scaffold/python/validation/native_wave.py +4 -5
- package/eval/scaffold/python/validation/native_workflow.py +193 -97
- package/eval/scaffold/python/validation/rubric.py +114 -1
- package/package.json +2 -1
- package/assets/skills/comet-native/scripts/comet-native-check.mjs +0 -179
- package/assets/skills/comet-native/scripts/comet-native-checkpoint.mjs +0 -179
- package/assets/skills/comet-native/scripts/comet-native-evidence.mjs +0 -151
- package/assets/skills/comet-native/scripts/comet-native-receipt.mjs +0 -187
- package/dist/domains/comet-native/native-check-entry.d.ts +0 -2
- package/dist/domains/comet-native/native-check-entry.d.ts.map +0 -1
- package/dist/domains/comet-native/native-check-entry.js +0 -4
- package/dist/domains/comet-native/native-check-entry.js.map +0 -1
- package/dist/domains/comet-native/native-checkpoint-entry.d.ts +0 -2
- package/dist/domains/comet-native/native-checkpoint-entry.d.ts.map +0 -1
- package/dist/domains/comet-native/native-checkpoint-entry.js +0 -4
- package/dist/domains/comet-native/native-checkpoint-entry.js.map +0 -1
- package/dist/domains/comet-native/native-evidence-entry.d.ts +0 -2
- package/dist/domains/comet-native/native-evidence-entry.d.ts.map +0 -1
- package/dist/domains/comet-native/native-evidence-entry.js +0 -4
- package/dist/domains/comet-native/native-evidence-entry.js.map +0 -1
- package/dist/domains/comet-native/native-receipt-entry.d.ts +0 -2
- package/dist/domains/comet-native/native-receipt-entry.d.ts.map +0 -1
- package/dist/domains/comet-native/native-receipt-entry.js +0 -4
- package/dist/domains/comet-native/native-receipt-entry.js.map +0 -1
- package/dist/domains/dashboard/web/assets/channel-B_u-_i2t.js +0 -1
- package/dist/domains/dashboard/web/assets/classDiagram-4FO5ZUOK-BpA7BPgX.js +0 -1
- package/dist/domains/dashboard/web/assets/classDiagram-v2-Q7XG4LA2-BpA7BPgX.js +0 -1
- package/dist/domains/dashboard/web/assets/demo-DZYPLZpF.js +0 -25
- package/dist/domains/dashboard/web/assets/index-Bk1o-4VO.css +0 -1
- package/dist/domains/dashboard/web/assets/index-g8vyW0R_.js +0 -257
- package/dist/domains/dashboard/web/assets/stateDiagram-v2-BHNVJYJU-rKvBgr6I.js +0 -1
- /package/assets/skills/{comet → comet-classic}/reference/classic-layout.md +0 -0
- /package/assets/skills-zh/{comet → comet-classic}/reference/classic-layout.md +0 -0
|
@@ -1,151 +1,158 @@
|
|
|
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 Nu=Object.create;var po=Object.defineProperty;var bu=Object.getOwnPropertyDescriptor;var ku=Object.getOwnPropertyNames;var Su=Object.getPrototypeOf,Eu=Object.prototype.hasOwnProperty;var pi=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,i)=>(typeof require<"u"?require:e)[i]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var w=(t,e)=>()=>{try{return e||t((e={exports:{}}).exports,e),e.exports}catch(i){throw e=0,i}};var Pu=(t,e,i,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of ku(e))!Eu.call(t,n)&&n!==i&&po(t,n,{get:()=>e[n],enumerable:!(r=bu(e,n))||r.enumerable});return t};var mi=(t,e,i)=>(i=t!=null?Nu(Su(t)):{},Pu(e||!t||!t.__esModule?po(i,"default",{value:t,enumerable:!0}):i,t));var P=w(H=>{"use strict";var Ur=Symbol.for("yaml.alias"),mo=Symbol.for("yaml.document"),vi=Symbol.for("yaml.map"),vo=Symbol.for("yaml.pair"),Kr=Symbol.for("yaml.scalar"),gi=Symbol.for("yaml.seq"),me=Symbol.for("yaml.node.type"),xu=t=>!!t&&typeof t=="object"&&t[me]===Ur,Cu=t=>!!t&&typeof t=="object"&&t[me]===mo,Ru=t=>!!t&&typeof t=="object"&&t[me]===vi,Au=t=>!!t&&typeof t=="object"&&t[me]===vo,go=t=>!!t&&typeof t=="object"&&t[me]===Kr,_u=t=>!!t&&typeof t=="object"&&t[me]===gi;function wo(t){if(t&&typeof t=="object")switch(t[me]){case vi:case gi:return!0}return!1}function Tu(t){if(t&&typeof t=="object")switch(t[me]){case Ur:case vi:case Kr:case gi:return!0}return!1}var Iu=t=>(go(t)||wo(t))&&!!t.anchor;H.ALIAS=Ur;H.DOC=mo;H.MAP=vi;H.NODE_TYPE=me;H.PAIR=vo;H.SCALAR=Kr;H.SEQ=gi;H.hasAnchor=Iu;H.isAlias=xu;H.isCollection=wo;H.isDocument=Cu;H.isMap=Ru;H.isNode=Tu;H.isPair=Au;H.isScalar=go;H.isSeq=_u});var St=w(Yr=>{"use strict";var $=P(),F=Symbol("break visit"),yo=Symbol("skip children"),le=Symbol("remove node");function wi(t,e){let i=No(e);$.isDocument(t)?it(null,t.contents,i,Object.freeze([t]))===le&&(t.contents=null):it(null,t,i,Object.freeze([]))}wi.BREAK=F;wi.SKIP=yo;wi.REMOVE=le;function it(t,e,i,r){let n=bo(t,e,i,r);if($.isNode(n)||$.isPair(n))return ko(t,r,n),it(t,n,i,r);if(typeof n!="symbol"){if($.isCollection(e)){r=Object.freeze(r.concat(e));for(let a=0;a<e.items.length;++a){let o=it(a,e.items[a],i,r);if(typeof o=="number")a=o-1;else{if(o===F)return F;o===le&&(e.items.splice(a,1),a-=1)}}}else if($.isPair(e)){r=Object.freeze(r.concat(e));let a=it("key",e.key,i,r);if(a===F)return F;a===le&&(e.key=null);let o=it("value",e.value,i,r);if(o===F)return F;o===le&&(e.value=null)}}return n}async function yi(t,e){let i=No(e);$.isDocument(t)?await rt(null,t.contents,i,Object.freeze([t]))===le&&(t.contents=null):await rt(null,t,i,Object.freeze([]))}yi.BREAK=F;yi.SKIP=yo;yi.REMOVE=le;async function rt(t,e,i,r){let n=await bo(t,e,i,r);if($.isNode(n)||$.isPair(n))return ko(t,r,n),rt(t,n,i,r);if(typeof n!="symbol"){if($.isCollection(e)){r=Object.freeze(r.concat(e));for(let a=0;a<e.items.length;++a){let o=await rt(a,e.items[a],i,r);if(typeof o=="number")a=o-1;else{if(o===F)return F;o===le&&(e.items.splice(a,1),a-=1)}}}else if($.isPair(e)){r=Object.freeze(r.concat(e));let a=await rt("key",e.key,i,r);if(a===F)return F;a===le&&(e.key=null);let o=await rt("value",e.value,i,r);if(o===F)return F;o===le&&(e.value=null)}}return n}function No(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 bo(t,e,i,r){if(typeof i=="function")return i(t,e,r);if($.isMap(e))return i.Map?.(t,e,r);if($.isSeq(e))return i.Seq?.(t,e,r);if($.isPair(e))return i.Pair?.(t,e,r);if($.isScalar(e))return i.Scalar?.(t,e,r);if($.isAlias(e))return i.Alias?.(t,e,r)}function ko(t,e,i){let r=e[e.length-1];if($.isCollection(r))r.items[t]=i;else if($.isPair(r))t==="key"?r.key=i:r.value=i;else if($.isDocument(r))r.contents=i;else{let n=$.isAlias(r)?"alias":"scalar";throw new Error(`Cannot replace node with ${n} parent`)}}Yr.visit=wi;Yr.visitAsync=yi});var Xr=w(Eo=>{"use strict";var So=P(),ju=St(),$u={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},Ou=t=>t.replace(/[!,[\]{}]/g,e=>$u[e]),Et=class t{constructor(e,i){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},t.defaultYaml,e),this.tags=Object.assign({},t.defaultTags,i)}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,i){this.atNextDocument&&(this.yaml={explicit:t.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},t.defaultTags),this.atNextDocument=!1);let r=e.trim().split(/[ \t]+/),n=r.shift();switch(n){case"%TAG":{if(r.length!==2&&(i(0,"%TAG directive should contain exactly two parts"),r.length<2))return!1;let[a,o]=r;return this.tags[a]=o,!0}case"%YAML":{if(this.yaml.explicit=!0,r.length!==1)return i(0,"%YAML directive should contain exactly one part"),!1;let[a]=r;if(a==="1.1"||a==="1.2")return this.yaml.version=a,!0;{let o=/^\d+\.\d+$/.test(a);return i(6,`Unsupported YAML version ${a}`,o),!1}}default:return i(0,`Unknown directive ${n}`,!0),!1}}tagName(e,i){if(e==="!")return"!";if(e[0]!=="!")return i(`Not a valid tag: ${e}`),null;if(e[1]==="<"){let o=e.slice(2,-1);return o==="!"||o==="!!"?(i(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&i("Verbatim tags must end with a >"),o)}let[,r,n]=e.match(/^(.*!)([^!]*)$/s);n||i(`The ${e} tag has no suffix`);let a=this.tags[r];if(a)try{return a+decodeURIComponent(n)}catch(o){return i(String(o)),null}return r==="!"?e:(i(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[i,r]of Object.entries(this.tags))if(e.startsWith(r))return i+Ou(e.substring(r.length));return e[0]==="!"?e:`!<${e}>`}toString(e){let i=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],r=Object.entries(this.tags),n;if(e&&r.length>0&&So.isNode(e.contents)){let a={};ju.visit(e.contents,(o,s)=>{So.isNode(s)&&s.tag&&(a[s.tag]=!0)}),n=Object.keys(a)}else n=[];for(let[a,o]of r)a==="!!"&&o==="tag:yaml.org,2002:"||(!e||n.some(s=>s.startsWith(o)))&&i.push(`%TAG ${a} ${o}`);return i.join(`
|
|
5
|
+
`)}};Et.defaultYaml={explicit:!1,version:"1.2"};Et.defaultTags={"!!":"tag:yaml.org,2002:"};Eo.Directives=Et});var Ni=w(Pt=>{"use strict";var Po=P(),Hu=St();function Du(t){if(/[\x00-\x19\s,[\]{}]/.test(t)){let i=`Anchor must not contain whitespace or control characters: ${JSON.stringify(t)}`;throw new Error(i)}return!0}function xo(t){let e=new Set;return Hu.visit(t,{Value(i,r){r.anchor&&e.add(r.anchor)}}),e}function Co(t,e){for(let i=1;;++i){let r=`${t}${i}`;if(!e.has(r))return r}}function Bu(t,e){let i=[],r=new Map,n=null;return{onAnchor:a=>{i.push(a),n??(n=xo(t));let o=Co(e,n);return n.add(o),o},setAnchors:()=>{for(let a of i){let o=r.get(a);if(typeof o=="object"&&o.anchor&&(Po.isScalar(o.node)||Po.isCollection(o.node)))o.node.anchor=o.anchor;else{let s=new Error("Failed to resolve repeated object (this should not happen)");throw s.source=a,s}}},sourceObjects:r}}Pt.anchorIsValid=Du;Pt.anchorNames=xo;Pt.createNodeAnchors=Bu;Pt.findNewAnchor=Co});var Qr=w(Ro=>{"use strict";function xt(t,e,i,r){if(r&&typeof r=="object")if(Array.isArray(r))for(let n=0,a=r.length;n<a;++n){let o=r[n],s=xt(t,r,String(n),o);s===void 0?delete r[n]:s!==o&&(r[n]=s)}else if(r instanceof Map)for(let n of Array.from(r.keys())){let a=r.get(n),o=xt(t,r,n,a);o===void 0?r.delete(n):o!==a&&r.set(n,o)}else if(r instanceof Set)for(let n of Array.from(r)){let a=xt(t,r,n,n);a===void 0?r.delete(n):a!==n&&(r.delete(n),r.add(a))}else for(let[n,a]of Object.entries(r)){let o=xt(t,r,n,a);o===void 0?delete r[n]:o!==a&&(r[n]=o)}return t.call(e,i,r)}Ro.applyReviver=xt});var we=w(_o=>{"use strict";var Lu=P();function Ao(t,e,i){if(Array.isArray(t))return t.map((r,n)=>Ao(r,String(n),i));if(t&&typeof t.toJSON=="function"){if(!i||!Lu.hasAnchor(t))return t.toJSON(e,i);let r={aliasCount:0,count:1,res:void 0};i.anchors.set(t,r),i.onCreate=a=>{r.res=a,delete i.onCreate};let n=t.toJSON(e,i);return i.onCreate&&i.onCreate(n),n}return typeof t=="bigint"&&!i?.keep?Number(t):t}_o.toJS=Ao});var bi=w(Io=>{"use strict";var Mu=Qr(),To=P(),Fu=we(),Zr=class{constructor(e){Object.defineProperty(this,To.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:i,maxAliasCount:r,onAnchor:n,reviver:a}={}){if(!To.isDocument(e))throw new TypeError("A document argument is required");let o={anchors:new Map,doc:e,keep:!0,mapAsMap:i===!0,mapKeyWarned:!1,maxAliasCount:typeof r=="number"?r:100},s=Fu.toJS(this,"",o);if(typeof n=="function")for(let{count:c,res:l}of o.anchors.values())n(l,c);return typeof a=="function"?Mu.applyReviver(a,{"":s},"",s):s}};Io.NodeBase=Zr});var Ct=w(jo=>{"use strict";var Vu=Ni(),qu=St(),nt=P(),Wu=bi(),zu=we(),en=class extends Wu.NodeBase{constructor(e){super(nt.ALIAS),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e,i){if(i?.maxAliasCount===0)throw new ReferenceError("Alias resolution is disabled");let r;i?.aliasResolveCache?r=i.aliasResolveCache:(r=[],qu.visit(e,{Node:(a,o)=>{(nt.isAlias(o)||nt.hasAnchor(o))&&r.push(o)}}),i&&(i.aliasResolveCache=r));let n;for(let a of r){if(a===this)break;a.anchor===this.source&&(n=a)}return n}toJSON(e,i){if(!i)return{source:this.source};let{anchors:r,doc:n,maxAliasCount:a}=i,o=this.resolve(n,i);if(!o){let c=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(c)}let s=r.get(o);if(s||(zu.toJS(o,null,i),s=r.get(o)),s?.res===void 0){let c="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(c)}if(a>=0&&(s.count+=1,s.aliasCount===0&&(s.aliasCount=ki(n,o,r)),s.count*s.aliasCount>a)){let c="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(c)}return s.res}toString(e,i,r){let n=`*${this.source}`;if(e){if(Vu.anchorIsValid(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let a=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(a)}if(e.implicitKey)return`${n} `}return n}};function ki(t,e,i){if(nt.isAlias(e)){let r=e.resolve(t),n=i&&r&&i.get(r);return n?n.count*n.aliasCount:0}else if(nt.isCollection(e)){let r=0;for(let n of e.items){let a=ki(t,n,i);a>r&&(r=a)}return r}else if(nt.isPair(e)){let r=ki(t,e.key,i),n=ki(t,e.value,i);return Math.max(r,n)}return 1}jo.Alias=en});var T=w(tn=>{"use strict";var Ju=P(),Gu=bi(),Uu=we(),Ku=t=>!t||typeof t!="function"&&typeof t!="object",ye=class extends Gu.NodeBase{constructor(e){super(Ju.SCALAR),this.value=e}toJSON(e,i){return i?.keep?this.value:Uu.toJS(this.value,e,i)}toString(){return String(this.value)}};ye.BLOCK_FOLDED="BLOCK_FOLDED";ye.BLOCK_LITERAL="BLOCK_LITERAL";ye.PLAIN="PLAIN";ye.QUOTE_DOUBLE="QUOTE_DOUBLE";ye.QUOTE_SINGLE="QUOTE_SINGLE";tn.Scalar=ye;tn.isScalarValue=Ku});var Rt=w(Oo=>{"use strict";var Yu=Ct(),Le=P(),$o=T(),Xu="tag:yaml.org,2002:";function Qu(t,e,i){if(e){let r=i.filter(a=>a.tag===e),n=r.find(a=>!a.format)??r[0];if(!n)throw new Error(`Tag ${e} not found`);return n}return i.find(r=>r.identify?.(t)&&!r.format)}function Zu(t,e,i){if(Le.isDocument(t)&&(t=t.contents),Le.isNode(t))return t;if(Le.isPair(t)){let u=i.schema[Le.MAP].createNode?.(i.schema,null,i);return u.items.push(t),u}(t instanceof String||t instanceof Number||t instanceof Boolean||typeof BigInt<"u"&&t instanceof BigInt)&&(t=t.valueOf());let{aliasDuplicateObjects:r,onAnchor:n,onTagObj:a,schema:o,sourceObjects:s}=i,c;if(r&&t&&typeof t=="object"){if(c=s.get(t),c)return c.anchor??(c.anchor=n(t)),new Yu.Alias(c.anchor);c={anchor:null,node:null},s.set(t,c)}e?.startsWith("!!")&&(e=Xu+e.slice(2));let l=Qu(t,e,o.tags);if(!l){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let u=new $o.Scalar(t);return c&&(c.node=u),u}l=t instanceof Map?o[Le.MAP]:Symbol.iterator in Object(t)?o[Le.SEQ]:o[Le.MAP]}a&&(a(l),delete i.onTagObj);let d=l?.createNode?l.createNode(i.schema,t,i):typeof l?.nodeClass?.from=="function"?l.nodeClass.from(i.schema,t,i):new $o.Scalar(t);return e?d.tag=e:l.default||(d.tag=l.tag),c&&(c.node=d),d}Oo.createNode=Zu});var Ei=w(Si=>{"use strict";var ed=Rt(),ue=P(),td=bi();function rn(t,e,i){let r=i;for(let n=e.length-1;n>=0;--n){let a=e[n];if(typeof a=="number"&&Number.isInteger(a)&&a>=0){let o=[];o[a]=r,r=o}else r=new Map([[a,r]])}return ed.createNode(r,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:t,sourceObjects:new Map})}var Ho=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,nn=class extends td.NodeBase{constructor(e,i){super(e),Object.defineProperty(this,"schema",{value:i,configurable:!0,enumerable:!1,writable:!0})}clone(e){let i=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(i.schema=e),i.items=i.items.map(r=>ue.isNode(r)||ue.isPair(r)?r.clone(e):r),this.range&&(i.range=this.range.slice()),i}addIn(e,i){if(Ho(e))this.add(i);else{let[r,...n]=e,a=this.get(r,!0);if(ue.isCollection(a))a.addIn(n,i);else if(a===void 0&&this.schema)this.set(r,rn(this.schema,n,i));else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${n}`)}}deleteIn(e){let[i,...r]=e;if(r.length===0)return this.delete(i);let n=this.get(i,!0);if(ue.isCollection(n))return n.deleteIn(r);throw new Error(`Expected YAML collection at ${i}. Remaining path: ${r}`)}getIn(e,i){let[r,...n]=e,a=this.get(r,!0);return n.length===0?!i&&ue.isScalar(a)?a.value:a:ue.isCollection(a)?a.getIn(n,i):void 0}hasAllNullValues(e){return this.items.every(i=>{if(!ue.isPair(i))return!1;let r=i.value;return r==null||e&&ue.isScalar(r)&&r.value==null&&!r.commentBefore&&!r.comment&&!r.tag})}hasIn(e){let[i,...r]=e;if(r.length===0)return this.has(i);let n=this.get(i,!0);return ue.isCollection(n)?n.hasIn(r):!1}setIn(e,i){let[r,...n]=e;if(n.length===0)this.set(r,i);else{let a=this.get(r,!0);if(ue.isCollection(a))a.setIn(n,i);else if(a===void 0&&this.schema)this.set(r,rn(this.schema,n,i));else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${n}`)}}};Si.Collection=nn;Si.collectionFromPath=rn;Si.isEmptyPath=Ho});var At=w(Pi=>{"use strict";var id=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function an(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var rd=(t,e,i)=>t.endsWith(`
|
|
6
|
+
`)?an(i,e):i.includes(`
|
|
7
7
|
`)?`
|
|
8
|
-
`+
|
|
9
|
-
`)i===
|
|
10
|
-
`&&
|
|
11
|
-
`&&S!==" "&&(f=h)}if(h>=u)if(f)l.push(f),u=f+c,f=void 0;else if(i===
|
|
12
|
-
${e}${t.slice(0,E)}`:(i===
|
|
13
|
-
${e}${t.slice(S+1,E)}`)}return N}function
|
|
14
|
-
`);
|
|
15
|
-
`){if(a-o>
|
|
8
|
+
`+an(i,e):(t.endsWith(" ")?"":" ")+i;Pi.indentComment=an;Pi.lineComment=rd;Pi.stringifyComment=id});var Bo=w(_t=>{"use strict";var nd="flow",on="block",xi="quoted";function ad(t,e,i="flow",{indentAtStart:r,lineWidth:n=80,minContentWidth:a=20,onFold:o,onOverflow:s}={}){if(!n||n<0)return t;n<a&&(a=0);let c=Math.max(1+a,1+n-e.length);if(t.length<=c)return t;let l=[],d={},u=n-e.length;typeof r=="number"&&(r>n-Math.max(2,a)?l.push(0):u=n-r);let f,p,g=!1,h=-1,m=-1,y=-1;i===on&&(h=Do(t,h,e.length),h!==-1&&(u=h+c));for(let k;k=t[h+=1];){if(i===xi&&k==="\\"){switch(m=h,t[h+1]){case"x":h+=3;break;case"u":h+=5;break;case"U":h+=9;break;default:h+=1}y=h}if(k===`
|
|
9
|
+
`)i===on&&(h=Do(t,h,e.length)),u=h+e.length+c,f=void 0;else{if(k===" "&&p&&p!==" "&&p!==`
|
|
10
|
+
`&&p!==" "){let S=t[h+1];S&&S!==" "&&S!==`
|
|
11
|
+
`&&S!==" "&&(f=h)}if(h>=u)if(f)l.push(f),u=f+c,f=void 0;else if(i===xi){for(;p===" "||p===" ";)p=k,k=t[h+=1],g=!0;let S=h>y+1?h-2:m-1;if(d[S])return t;l.push(S),d[S]=!0,u=S+c,f=void 0}else g=!0}p=k}if(g&&s&&s(),l.length===0)return t;o&&o();let N=t.slice(0,l[0]);for(let k=0;k<l.length;++k){let S=l[k],E=l[k+1]||t.length;S===0?N=`
|
|
12
|
+
${e}${t.slice(0,E)}`:(i===xi&&d[S]&&(N+=`${t[S]}\\`),N+=`
|
|
13
|
+
${e}${t.slice(S+1,E)}`)}return N}function Do(t,e,i){let r=e,n=e+1,a=t[n];for(;a===" "||a===" ";)if(e<n+i)a=t[++e];else{do a=t[++e];while(a&&a!==`
|
|
14
|
+
`);r=e,n=e+1,a=t[n]}return r}_t.FOLD_BLOCK=on;_t.FOLD_FLOW=nd;_t.FOLD_QUOTED=xi;_t.foldFlowLines=ad});var It=w(Lo=>{"use strict";var ee=T(),Ne=Bo(),Ri=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),Ai=t=>/^(%|---|\.\.\.)/m.test(t);function od(t,e,i){if(!e||e<0)return!1;let r=e-i,n=t.length;if(n<=r)return!1;for(let a=0,o=0;a<n;++a)if(t[a]===`
|
|
15
|
+
`){if(a-o>r)return!0;if(o=a+1,n-o<=r)return!1}return!0}function Tt(t,e){let i=JSON.stringify(t);if(e.options.doubleQuotedAsJSON)return i;let{implicitKey:r}=e,n=e.options.doubleQuotedMinMultiLineLength,a=e.indent||(Ai(t)?" ":""),o="",s=0;for(let c=0,l=i[c];l;l=i[++c])if(l===" "&&i[c+1]==="\\"&&i[c+2]==="n"&&(o+=i.slice(s,c)+"\\ ",c+=1,s=c,l="\\"),l==="\\")switch(i[c+1]){case"u":{o+=i.slice(s,c);let d=i.substr(c+2,4);switch(d){case"0000":o+="\\0";break;case"0007":o+="\\a";break;case"000b":o+="\\v";break;case"001b":o+="\\e";break;case"0085":o+="\\N";break;case"00a0":o+="\\_";break;case"2028":o+="\\L";break;case"2029":o+="\\P";break;default:d.substr(0,2)==="00"?o+="\\x"+d.substr(2):o+=i.substr(c,6)}c+=5,s=c+1}break;case"n":if(r||i[c+2]==='"'||i.length<n)c+=1;else{for(o+=i.slice(s,c)+`
|
|
16
16
|
|
|
17
17
|
`;i[c+2]==="\\"&&i[c+3]==="n"&&i[c+4]!=='"';)o+=`
|
|
18
|
-
`,c+=2;o+=a,i[c+2]===" "&&(o+="\\"),c+=1,s=c+1}break;default:c+=1}return o=s?o+i.slice(s):i,
|
|
19
|
-
`)||/[ \t]\n|\n[ \t]/.test(t))return
|
|
20
|
-
${i}`)+"'";return e.implicitKey?
|
|
18
|
+
`,c+=2;o+=a,i[c+2]===" "&&(o+="\\"),c+=1,s=c+1}break;default:c+=1}return o=s?o+i.slice(s):i,r?o:Ne.foldFlowLines(o,a,Ne.FOLD_QUOTED,Ri(e,!1))}function sn(t,e){if(e.options.singleQuote===!1||e.implicitKey&&t.includes(`
|
|
19
|
+
`)||/[ \t]\n|\n[ \t]/.test(t))return Tt(t,e);let i=e.indent||(Ai(t)?" ":""),r="'"+t.replace(/'/g,"''").replace(/\n+/g,`$&
|
|
20
|
+
${i}`)+"'";return e.implicitKey?r:Ne.foldFlowLines(r,i,Ne.FOLD_FLOW,Ri(e,!1))}function at(t,e){let{singleQuote:i}=e.options,r;if(i===!1)r=Tt;else{let n=t.includes('"'),a=t.includes("'");n&&!a?r=sn:a&&!n?r=Tt:r=i?sn:Tt}return r(t,e)}var cn;try{cn=new RegExp(`(^|(?<!
|
|
21
21
|
))
|
|
22
22
|
+(?!
|
|
23
|
-
|$)`,"g")}catch{
|
|
23
|
+
|$)`,"g")}catch{cn=/\n+(?!\n|$)/g}function Ci({comment:t,type:e,value:i},r,n,a){let{blockQuote:o,commentString:s,lineWidth:c}=r.options;if(!o||/\n[\t ]+$/.test(i))return at(i,r);let l=r.indent||(r.forceBlockIndent||Ai(i)?" ":""),d=o==="literal"?!0:o==="folded"||e===ee.Scalar.BLOCK_FOLDED?!1:e===ee.Scalar.BLOCK_LITERAL?!0:!od(i,c,l.length);if(!i)return d?`|
|
|
24
24
|
`:`>
|
|
25
25
|
`;let u,f;for(f=i.length;f>0;--f){let E=i[f-1];if(E!==`
|
|
26
|
-
`&&E!==" "&&E!==" ")break}let
|
|
27
|
-
`);g===-1?u="-":i===
|
|
28
|
-
`&&(
|
|
29
|
-
`)y=
|
|
30
|
-
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${l}`),v=!1,
|
|
26
|
+
`&&E!==" "&&E!==" ")break}let p=i.substring(f),g=p.indexOf(`
|
|
27
|
+
`);g===-1?u="-":i===p||g!==p.length-1?(u="+",a&&a()):u="",p&&(i=i.slice(0,-p.length),p[p.length-1]===`
|
|
28
|
+
`&&(p=p.slice(0,-1)),p=p.replace(cn,`$&${l}`));let h=!1,m,y=-1;for(m=0;m<i.length;++m){let E=i[m];if(E===" ")h=!0;else if(E===`
|
|
29
|
+
`)y=m;else break}let N=i.substring(0,y<m?y+1:m);N&&(i=i.substring(N.length),N=N.replace(/\n+/g,`$&${l}`));let S=(h?l?"2":"1":"")+u;if(t&&(S+=" "+s(t.replace(/ ?[\r\n]+/g," ")),n&&n()),!d){let E=i.replace(/\n+/g,`
|
|
30
|
+
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${l}`),v=!1,x=Ri(r,!0);o!=="folded"&&e!==ee.Scalar.BLOCK_FOLDED&&(x.onOverflow=()=>{v=!0});let b=Ne.foldFlowLines(`${N}${E}${p}`,l,Ne.FOLD_BLOCK,x);if(!v)return`>${S}
|
|
31
31
|
${l}${b}`}return i=i.replace(/\n+/g,`$&${l}`),`|${S}
|
|
32
|
-
${l}${N}${i}${
|
|
33
|
-
`)||d&&/[[\]{},]/.test(a))return
|
|
34
|
-
`)?
|
|
35
|
-
`))return
|
|
36
|
-
${c}`);if(o){let f=h=>h.default&&h.tag!=="tag:yaml.org,2002:str"&&h.test?.test(u),{compat:
|
|
37
|
-
${e.indent}${s}`:s}
|
|
38
|
-
${s}:`):(
|
|
39
|
-
`:"",N){let
|
|
40
|
-
${
|
|
32
|
+
${l}${N}${i}${p}`}function sd(t,e,i,r){let{type:n,value:a}=t,{actualString:o,implicitKey:s,indent:c,indentStep:l,inFlow:d}=e;if(s&&a.includes(`
|
|
33
|
+
`)||d&&/[[\]{},]/.test(a))return at(a,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(a))return s||d||!a.includes(`
|
|
34
|
+
`)?at(a,e):Ci(t,e,i,r);if(!s&&!d&&n!==ee.Scalar.PLAIN&&a.includes(`
|
|
35
|
+
`))return Ci(t,e,i,r);if(Ai(a)){if(c==="")return e.forceBlockIndent=!0,Ci(t,e,i,r);if(s&&c===l)return at(a,e)}let u=a.replace(/\n+/g,`$&
|
|
36
|
+
${c}`);if(o){let f=h=>h.default&&h.tag!=="tag:yaml.org,2002:str"&&h.test?.test(u),{compat:p,tags:g}=e.doc.schema;if(g.some(f)||p?.some(f))return at(a,e)}return s?u:Ne.foldFlowLines(u,c,Ne.FOLD_FLOW,Ri(e,!1))}function cd(t,e,i,r){let{implicitKey:n,inFlow:a}=e,o=typeof t.value=="string"?t:Object.assign({},t,{value:String(t.value)}),{type:s}=t;s!==ee.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(s=ee.Scalar.QUOTE_DOUBLE);let c=d=>{switch(d){case ee.Scalar.BLOCK_FOLDED:case ee.Scalar.BLOCK_LITERAL:return n||a?at(o.value,e):Ci(o,e,i,r);case ee.Scalar.QUOTE_DOUBLE:return Tt(o.value,e);case ee.Scalar.QUOTE_SINGLE:return sn(o.value,e);case ee.Scalar.PLAIN:return sd(o,e,i,r);default:return null}},l=c(s);if(l===null){let{defaultKeyType:d,defaultStringType:u}=e.options,f=n&&d||u;if(l=c(f),l===null)throw new Error(`Unsupported default string type ${f}`)}return l}Lo.stringifyString=cd});var jt=w(ln=>{"use strict";var ld=Ni(),be=P(),ud=At(),dd=It();function fd(t,e){let i=Object.assign({blockQuote:!0,commentString:ud.stringifyComment,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:"true",verifyAliasOrder:!0},t.schema.toStringOptions,e),r;switch(i.collectionStyle){case"block":r=!1;break;case"flow":r=!0;break;default:r=null}return{anchors:new Set,doc:t,flowCollectionPadding:i.flowCollectionPadding?" ":"",indent:"",indentStep:typeof i.indent=="number"?" ".repeat(i.indent):" ",inFlow:r,options:i}}function hd(t,e){if(e.tag){let n=t.filter(a=>a.tag===e.tag);if(n.length>0)return n.find(a=>a.format===e.format)??n[0]}let i,r;if(be.isScalar(e)){r=e.value;let n=t.filter(a=>a.identify?.(r));if(n.length>1){let a=n.filter(o=>o.test);a.length>0&&(n=a)}i=n.find(a=>a.format===e.format)??n.find(a=>!a.format)}else r=e,i=t.find(n=>n.nodeClass&&r instanceof n.nodeClass);if(!i){let n=r?.constructor?.name??(r===null?"null":typeof r);throw new Error(`Tag not resolved for ${n} value`)}return i}function pd(t,e,{anchors:i,doc:r}){if(!r.directives)return"";let n=[],a=(be.isScalar(t)||be.isCollection(t))&&t.anchor;a&&ld.anchorIsValid(a)&&(i.add(a),n.push(`&${a}`));let o=t.tag??(e.default?null:e.tag);return o&&n.push(r.directives.tagString(o)),n.join(" ")}function md(t,e,i,r){if(be.isPair(t))return t.toString(e,i,r);if(be.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 n,a=be.isNode(t)?t:e.doc.createNode(t,{onTagObj:c=>n=c});n??(n=hd(e.doc.schema.tags,a));let o=pd(a,n,e);o.length>0&&(e.indentAtStart=(e.indentAtStart??0)+o.length+1);let s=typeof n.stringify=="function"?n.stringify(a,e,i,r):be.isScalar(a)?dd.stringifyString(a,e,i,r):a.toString(e,i,r);return o?be.isScalar(a)||s[0]==="{"||s[0]==="["?`${o} ${s}`:`${o}
|
|
37
|
+
${e.indent}${s}`:s}ln.createStringifyContext=fd;ln.stringify=md});var qo=w(Vo=>{"use strict";var ve=P(),Mo=T(),Fo=jt(),$t=At();function vd({key:t,value:e},i,r,n){let{allNullValues:a,doc:o,indent:s,indentStep:c,options:{commentString:l,indentSeq:d,simpleKeys:u}}=i,f=ve.isNode(t)&&t.comment||null;if(u){if(f)throw new Error("With simple keys, key nodes cannot have comments");if(ve.isCollection(t)||!ve.isNode(t)&&typeof t=="object"){let x="With simple keys, collection cannot be used as a key value";throw new Error(x)}}let p=!u&&(!t||f&&e==null&&!i.inFlow||ve.isCollection(t)||(ve.isScalar(t)?t.type===Mo.Scalar.BLOCK_FOLDED||t.type===Mo.Scalar.BLOCK_LITERAL:typeof t=="object"));i=Object.assign({},i,{allNullValues:!1,implicitKey:!p&&(u||!a),indent:s+c});let g=!1,h=!1,m=Fo.stringify(t,i,()=>g=!0,()=>h=!0);if(!p&&!i.inFlow&&m.length>1024){if(u)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");p=!0}if(i.inFlow){if(a||e==null)return g&&r&&r(),m===""?"?":p?`? ${m}`:m}else if(a&&!u||e==null&&p)return m=`? ${m}`,f&&!g?m+=$t.lineComment(m,i.indent,l(f)):h&&n&&n(),m;g&&(f=null),p?(f&&(m+=$t.lineComment(m,i.indent,l(f))),m=`? ${m}
|
|
38
|
+
${s}:`):(m=`${m}:`,f&&(m+=$t.lineComment(m,i.indent,l(f))));let y,N,k;ve.isNode(e)?(y=!!e.spaceBefore,N=e.commentBefore,k=e.comment):(y=!1,N=null,k=null,e&&typeof e=="object"&&(e=o.createNode(e))),i.implicitKey=!1,!p&&!f&&ve.isScalar(e)&&(i.indentAtStart=m.length+1),h=!1,!d&&c.length>=2&&!i.inFlow&&!p&&ve.isSeq(e)&&!e.flow&&!e.tag&&!e.anchor&&(i.indent=i.indent.substring(2));let S=!1,E=Fo.stringify(e,i,()=>S=!0,()=>h=!0),v=" ";if(f||y||N){if(v=y?`
|
|
39
|
+
`:"",N){let x=l(N);v+=`
|
|
40
|
+
${$t.indentComment(x,i.indent)}`}E===""&&!i.inFlow?v===`
|
|
41
41
|
`&&k&&(v=`
|
|
42
42
|
|
|
43
43
|
`):v+=`
|
|
44
|
-
${i.indent}`}else if(!
|
|
45
|
-
`),
|
|
44
|
+
${i.indent}`}else if(!p&&ve.isCollection(e)){let x=E[0],b=E.indexOf(`
|
|
45
|
+
`),A=b!==-1,J=i.inFlow??e.flow??e.items.length===0;if(A||!J){let tt=!1;if(A&&(x==="&"||x==="!")){let j=E.indexOf(" ");x==="&"&&j!==-1&&j<b&&E[j+1]==="!"&&(j=E.indexOf(" ",j+1)),(j===-1||b<j)&&(tt=!0)}tt||(v=`
|
|
46
46
|
${i.indent}`)}}else(E===""||E[0]===`
|
|
47
|
-
`)&&(v="");return
|
|
47
|
+
`)&&(v="");return m+=v+E,i.inFlow?S&&r&&r():k&&!S?m+=$t.lineComment(m,i.indent,l(k)):h&&n&&n(),m}Vo.stringifyPair=vd});var dn=w(un=>{"use strict";var Wo=pi("process");function gd(t,...e){t==="debug"&&console.log(...e)}function wd(t,e){(t==="debug"||t==="warn")&&(typeof Wo.emitWarning=="function"?Wo.emitWarning(e):console.warn(e))}un.debug=gd;un.warn=wd});var $i=w(ji=>{"use strict";var Ii=P(),zo=T(),_i="<<",Ti={identify:t=>t===_i||typeof t=="symbol"&&t.description===_i,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new zo.Scalar(Symbol(_i)),{addToJSMap:Jo}),stringify:()=>_i},yd=(t,e)=>(Ti.identify(e)||Ii.isScalar(e)&&(!e.type||e.type===zo.Scalar.PLAIN)&&Ti.identify(e.value))&&t?.doc.schema.tags.some(i=>i.tag===Ti.tag&&i.default);function Jo(t,e,i){let r=Go(t,i);if(Ii.isSeq(r))for(let n of r.items)fn(t,e,n);else if(Array.isArray(r))for(let n of r)fn(t,e,n);else fn(t,e,r)}function fn(t,e,i){let r=Go(t,i);if(!Ii.isMap(r))throw new Error("Merge sources must be maps or map aliases");let n=r.toJSON(null,t,Map);for(let[a,o]of n)e instanceof Map?e.has(a)||e.set(a,o):e instanceof Set?e.add(a):Object.prototype.hasOwnProperty.call(e,a)||Object.defineProperty(e,a,{value:o,writable:!0,enumerable:!0,configurable:!0});return e}function Go(t,e){return t&&Ii.isAlias(e)?e.resolve(t.doc,t):e}ji.addMergeToJSMap=Jo;ji.isMergeKey=yd;ji.merge=Ti});var pn=w(Yo=>{"use strict";var Nd=dn(),Uo=$i(),bd=jt(),Ko=P(),hn=we();function kd(t,e,{key:i,value:r}){if(Ko.isNode(i)&&i.addToJSMap)i.addToJSMap(t,e,r);else if(Uo.isMergeKey(t,i))Uo.addMergeToJSMap(t,e,r);else{let n=hn.toJS(i,"",t);if(e instanceof Map)e.set(n,hn.toJS(r,n,t));else if(e instanceof Set)e.add(n);else{let a=Sd(i,n,t),o=hn.toJS(r,a,t);a in e?Object.defineProperty(e,a,{value:o,writable:!0,enumerable:!0,configurable:!0}):e[a]=o}}return e}function Sd(t,e,i){if(e===null)return"";if(typeof e!="object")return String(e);if(Ko.isNode(t)&&i?.doc){let r=bd.createStringifyContext(i.doc,{});r.anchors=new Set;for(let a of i.anchors.keys())r.anchors.add(a.anchor);r.inFlow=!0,r.inStringifyKey=!0;let n=t.toString(r);if(!i.mapKeyWarned){let a=JSON.stringify(n);a.length>40&&(a=a.substring(0,36)+'..."'),Nd.warn(i.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${a}. Set mapAsMap: true to use object keys.`),i.mapKeyWarned=!0}return n}return JSON.stringify(e)}Yo.addPairToJSMap=kd});var ke=w(mn=>{"use strict";var Xo=Rt(),Ed=qo(),Pd=pn(),Oi=P();function xd(t,e,i){let r=Xo.createNode(t,void 0,i),n=Xo.createNode(e,void 0,i);return new Hi(r,n)}var Hi=class t{constructor(e,i=null){Object.defineProperty(this,Oi.NODE_TYPE,{value:Oi.PAIR}),this.key=e,this.value=i}clone(e){let{key:i,value:r}=this;return Oi.isNode(i)&&(i=i.clone(e)),Oi.isNode(r)&&(r=r.clone(e)),new t(i,r)}toJSON(e,i){let r=i?.mapAsMap?new Map:{};return Pd.addPairToJSMap(i,r,this)}toString(e,i,r){return e?.doc?Ed.stringifyPair(this,e,i,r):JSON.stringify(this)}};mn.Pair=Hi;mn.createPair=xd});var vn=w(Zo=>{"use strict";var Me=P(),Qo=jt(),Di=At();function Cd(t,e,i){return(e.inFlow??t.flow?Ad:Rd)(t,e,i)}function Rd({comment:t,items:e},i,{blockItemPrefix:r,flowChars:n,itemIndent:a,onChompKeep:o,onComment:s}){let{indent:c,options:{commentString:l}}=i,d=Object.assign({},i,{indent:a,type:null}),u=!1,f=[];for(let g=0;g<e.length;++g){let h=e[g],m=null;if(Me.isNode(h))!u&&h.spaceBefore&&f.push(""),Bi(i,f,h.commentBefore,u),h.comment&&(m=h.comment);else if(Me.isPair(h)){let N=Me.isNode(h.key)?h.key:null;N&&(!u&&N.spaceBefore&&f.push(""),Bi(i,f,N.commentBefore,u))}u=!1;let y=Qo.stringify(h,d,()=>m=null,()=>u=!0);m&&(y+=Di.lineComment(y,a,l(m))),u&&m&&(u=!1),f.push(r+y)}let p;if(f.length===0)p=n.start+n.end;else{p=f[0];for(let g=1;g<f.length;++g){let h=f[g];p+=h?`
|
|
48
48
|
${c}${h}`:`
|
|
49
|
-
`}}return t?(
|
|
50
|
-
`+
|
|
51
|
-
`)),g<t.length-1?y+=",":e.options.trailingComma&&(e.options.lineWidth>0&&(l||(l=u.reduce((N,k)=>N+k.length+2,2)+(y.length+2)>e.options.lineWidth)),l&&(y+=",")),
|
|
52
|
-
${a}${
|
|
49
|
+
`}}return t?(p+=`
|
|
50
|
+
`+Di.indentComment(l(t),c),s&&s()):u&&o&&o(),p}function Ad({items:t},e,{flowChars:i,itemIndent:r}){let{indent:n,indentStep:a,flowCollectionPadding:o,options:{commentString:s}}=e;r+=a;let c=Object.assign({},e,{indent:r,inFlow:!0,type:null}),l=!1,d=0,u=[];for(let g=0;g<t.length;++g){let h=t[g],m=null;if(Me.isNode(h))h.spaceBefore&&u.push(""),Bi(e,u,h.commentBefore,!1),h.comment&&(m=h.comment);else if(Me.isPair(h)){let N=Me.isNode(h.key)?h.key:null;N&&(N.spaceBefore&&u.push(""),Bi(e,u,N.commentBefore,!1),N.comment&&(l=!0));let k=Me.isNode(h.value)?h.value:null;k?(k.comment&&(m=k.comment),k.commentBefore&&(l=!0)):h.value==null&&N?.comment&&(m=N.comment)}m&&(l=!0);let y=Qo.stringify(h,c,()=>m=null);l||(l=u.length>d||y.includes(`
|
|
51
|
+
`)),g<t.length-1?y+=",":e.options.trailingComma&&(e.options.lineWidth>0&&(l||(l=u.reduce((N,k)=>N+k.length+2,2)+(y.length+2)>e.options.lineWidth)),l&&(y+=",")),m&&(y+=Di.lineComment(y,r,s(m))),u.push(y),d=u.length}let{start:f,end:p}=i;if(u.length===0)return f+p;if(!l){let g=u.reduce((h,m)=>h+m.length+2,2);l=e.options.lineWidth>0&&g>e.options.lineWidth}if(l){let g=f;for(let h of u)g+=h?`
|
|
52
|
+
${a}${n}${h}`:`
|
|
53
53
|
`;return`${g}
|
|
54
|
-
${
|
|
55
|
-
`:" ")}return
|
|
56
|
-
${
|
|
57
|
-
${a.comment}`:n.comment}n=r}t.items[i]=Ai.isPair(n)?n:new or.Pair(n)}}else e("Expected a sequence for this tag");return t}function zo(t,e,i){let{replacer:n}=i,r=new Af.YAMLSeq(t);r.tag="tag:yaml.org,2002:pairs";let a=0;if(e&&Symbol.iterator in Object(e))for(let o of e){typeof n=="function"&&(o=n.call(e,String(a++),o));let s,c;if(Array.isArray(o))if(o.length===2)s=o[0],c=o[1];else throw new TypeError(`Expected [key, value] tuple: ${o}`);else if(o&&o instanceof Object){let l=Object.keys(o);if(l.length===1)s=l[0],c=o[s];else throw new TypeError(`Expected tuple with one key, not ${l.length} keys`)}else s=o;r.items.push(or.createPair(s,c,i))}return r}var xf={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:Wo,createNode:zo};xi.createPairs=zo;xi.pairs=xf;xi.resolvePairs=Wo});var lr=w(cr=>{"use strict";var Jo=C(),sr=ce(),yt=pe(),Tf=me(),Go=Ti(),Pe=class t extends Tf.YAMLSeq{constructor(){super(),this.add=yt.YAMLMap.prototype.add.bind(this),this.delete=yt.YAMLMap.prototype.delete.bind(this),this.get=yt.YAMLMap.prototype.get.bind(this),this.has=yt.YAMLMap.prototype.has.bind(this),this.set=yt.YAMLMap.prototype.set.bind(this),this.tag=t.tag}toJSON(e,i){if(!i)return super.toJSON(e);let n=new Map;i?.onCreate&&i.onCreate(n);for(let r of this.items){let a,o;if(Jo.isPair(r)?(a=sr.toJS(r.key,"",i),o=sr.toJS(r.value,a,i)):a=sr.toJS(r,"",i),n.has(a))throw new Error("Ordered maps must not include duplicate keys");n.set(a,o)}return n}static from(e,i,n){let r=Go.createPairs(e,i,n),a=new this;return a.items=r.items,a}};Pe.tag="tag:yaml.org,2002:omap";var If={collection:"seq",identify:t=>t instanceof Map,nodeClass:Pe,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let i=Go.resolvePairs(t,e),n=[];for(let{key:r}of i.items)Jo.isScalar(r)&&(n.includes(r.value)?e(`Ordered maps must not include duplicate keys: ${r.value}`):n.push(r.value));return Object.assign(new Pe,i)},createNode:(t,e,i)=>Pe.from(t,e,i)};cr.YAMLOMap=Pe;cr.omap=If});var Qo=w(ur=>{"use strict";var Ko=T();function Uo({value:t,source:e},i){return e&&(t?Yo:Xo).test.test(e)?e:t?i.options.trueStr:i.options.falseStr}var Yo={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 Ko.Scalar(!0),stringify:Uo},Xo={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 Ko.Scalar(!1),stringify:Uo};ur.falseTag=Xo;ur.trueTag=Yo});var Zo=w(Ii=>{"use strict";var _f=T(),fr=Ke(),Of={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:fr.stringifyNumber},jf={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():fr.stringifyNumber(t)}},$f={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 _f.Scalar(parseFloat(t.replace(/_/g,""))),i=t.indexOf(".");if(i!==-1){let n=t.substring(i+1).replace(/_/g,"");n[n.length-1]==="0"&&(e.minFractionDigits=n.length)}return e},stringify:fr.stringifyNumber};Ii.float=$f;Ii.floatExp=jf;Ii.floatNaN=Of});var ts=w(bt=>{"use strict";var es=Ke(),Nt=t=>typeof t=="bigint"||Number.isInteger(t);function _i(t,e,i,{intAsBigInt:n}){let r=t[0];if((r==="-"||r==="+")&&(e+=1),t=t.substring(e).replace(/_/g,""),n){switch(i){case 2:t=`0b${t}`;break;case 8:t=`0o${t}`;break;case 16:t=`0x${t}`;break}let o=BigInt(t);return r==="-"?BigInt(-1)*o:o}let a=parseInt(t,i);return r==="-"?-1*a:a}function dr(t,e,i){let{value:n}=t;if(Nt(n)){let r=n.toString(e);return n<0?"-"+i+r.substr(1):i+r}return es.stringifyNumber(t)}var Hf={identify:Nt,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,i)=>_i(t,2,2,i),stringify:t=>dr(t,2,"0b")},Lf={identify:Nt,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,i)=>_i(t,1,8,i),stringify:t=>dr(t,8,"0")},Ff={identify:Nt,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,i)=>_i(t,0,10,i),stringify:es.stringifyNumber},Mf={identify:Nt,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,i)=>_i(t,2,16,i),stringify:t=>dr(t,16,"0x")};bt.int=Ff;bt.intBin=Hf;bt.intHex=Mf;bt.intOct=Lf});var pr=w(hr=>{"use strict";var $i=C(),Oi=de(),ji=pe(),Ae=class t extends ji.YAMLMap{constructor(e){super(e),this.tag=t.tag}add(e){let i;$i.isPair(e)?i=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?i=new Oi.Pair(e.key,null):i=new Oi.Pair(e,null),ji.findPair(this.items,i.key)||this.items.push(i)}get(e,i){let n=ji.findPair(this.items,e);return!i&&$i.isPair(n)?$i.isScalar(n.key)?n.key.value:n.key:n}set(e,i){if(typeof i!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof i}`);let n=ji.findPair(this.items,e);n&&!i?this.items.splice(this.items.indexOf(n),1):!n&&i&&this.items.push(new Oi.Pair(e))}toJSON(e,i){return super.toJSON(e,i,Set)}toString(e,i,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),i,n);throw new Error("Set items must all have null values")}static from(e,i,n){let{replacer:r}=n,a=new this(e);if(i&&Symbol.iterator in Object(i))for(let o of i)typeof r=="function"&&(o=r.call(i,o,o)),a.items.push(Oi.createPair(o,null,n));return a}};Ae.tag="tag:yaml.org,2002:set";var Bf={collection:"map",identify:t=>t instanceof Set,nodeClass:Ae,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,i)=>Ae.from(t,e,i),resolve(t,e){if($i.isMap(t)){if(t.hasAllNullValues(!0))return Object.assign(new Ae,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}};hr.YAMLSet=Ae;hr.set=Bf});var vr=w(Hi=>{"use strict";var Df=Ke();function mr(t,e){let i=t[0],n=i==="-"||i==="+"?t.substring(1):t,r=o=>e?BigInt(o):Number(o),a=n.replace(/_/g,"").split(":").reduce((o,s)=>o*r(60)+r(s),r(0));return i==="-"?r(-1)*a:a}function is(t){let{value:e}=t,i=o=>o;if(typeof e=="bigint")i=o=>BigInt(o);else if(isNaN(e)||!isFinite(e))return Df.stringifyNumber(t);let n="";e<0&&(n="-",e*=i(-1));let r=i(60),a=[e%r];return e<60?a.unshift(0):(e=(e-a[0])/r,a.unshift(e%r),e>=60&&(e=(e-a[0])/r,a.unshift(e))),n+a.map(o=>String(o).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var qf={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:i})=>mr(t,i),stringify:is},Vf={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=>mr(t,!1),stringify:is},ns={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(ns.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,i,n,r,a,o,s]=e.map(Number),c=e[7]?Number((e[7]+"00").substr(1,3)):0,l=Date.UTC(i,n-1,r,a||0,o||0,s||0,c),d=e[8];if(d&&d!=="Z"){let u=mr(d,!1);Math.abs(u)<30&&(u*=60),l-=6e4*u}return new Date(l)},stringify:({value:t})=>t?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};Hi.floatTime=Vf;Hi.intTime=qf;Hi.timestamp=ns});var os=w(as=>{"use strict";var Wf=Je(),zf=Si(),Jf=Ge(),Gf=gt(),Kf=ar(),rs=Qo(),gr=Zo(),Li=ts(),Uf=mi(),Yf=lr(),Xf=Ti(),Qf=pr(),wr=vr(),Zf=[Wf.map,Jf.seq,Gf.string,zf.nullTag,rs.trueTag,rs.falseTag,Li.intBin,Li.intOct,Li.int,Li.intHex,gr.floatNaN,gr.floatExp,gr.float,Kf.binary,Uf.merge,Yf.omap,Xf.pairs,Qf.set,wr.intTime,wr.floatTime,wr.timestamp];as.schema=Zf});var vs=w(br=>{"use strict";var us=Je(),ed=Si(),fs=Ge(),td=gt(),id=Xn(),yr=Zn(),Nr=tr(),nd=Mo(),rd=qo(),ds=ar(),kt=mi(),hs=lr(),ps=Ti(),ss=os(),ms=pr(),Fi=vr(),cs=new Map([["core",nd.schema],["failsafe",[us.map,fs.seq,td.string]],["json",rd.schema],["yaml11",ss.schema],["yaml-1.1",ss.schema]]),ls={binary:ds.binary,bool:id.boolTag,float:yr.float,floatExp:yr.floatExp,floatNaN:yr.floatNaN,floatTime:Fi.floatTime,int:Nr.int,intHex:Nr.intHex,intOct:Nr.intOct,intTime:Fi.intTime,map:us.map,merge:kt.merge,null:ed.nullTag,omap:hs.omap,pairs:ps.pairs,seq:fs.seq,set:ms.set,timestamp:Fi.timestamp},ad={"tag:yaml.org,2002:binary":ds.binary,"tag:yaml.org,2002:merge":kt.merge,"tag:yaml.org,2002:omap":hs.omap,"tag:yaml.org,2002:pairs":ps.pairs,"tag:yaml.org,2002:set":ms.set,"tag:yaml.org,2002:timestamp":Fi.timestamp};function od(t,e,i){let n=cs.get(e);if(n&&!t)return i&&!n.includes(kt.merge)?n.concat(kt.merge):n.slice();let r=n;if(!r)if(Array.isArray(t))r=[];else{let a=Array.from(cs.keys()).filter(o=>o!=="yaml11").map(o=>JSON.stringify(o)).join(", ");throw new Error(`Unknown schema "${e}"; use one of ${a} or define customTags array`)}if(Array.isArray(t))for(let a of t)r=r.concat(a);else typeof t=="function"&&(r=t(r.slice()));return i&&(r=r.concat(kt.merge)),r.reduce((a,o)=>{let s=typeof o=="string"?ls[o]:o;if(!s){let c=JSON.stringify(o),l=Object.keys(ls).map(d=>JSON.stringify(d)).join(", ");throw new Error(`Unknown custom tag ${c}; use one of ${l}`)}return a.includes(s)||a.push(s),a},[])}br.coreKnownTags=ad;br.getTags=od});var Er=w(gs=>{"use strict";var kr=C(),sd=Je(),cd=Ge(),ld=gt(),Mi=vs(),ud=(t,e)=>t.key<e.key?-1:t.key>e.key?1:0,Sr=class t{constructor({compat:e,customTags:i,merge:n,resolveKnownTags:r,schema:a,sortMapEntries:o,toStringDefaults:s}){this.compat=Array.isArray(e)?Mi.getTags(e,"compat"):e?Mi.getTags(null,e):null,this.name=typeof a=="string"&&a||"core",this.knownTags=r?Mi.coreKnownTags:{},this.tags=Mi.getTags(i,this.name,n),this.toStringOptions=s??null,Object.defineProperty(this,kr.MAP,{value:sd.map}),Object.defineProperty(this,kr.SCALAR,{value:ld.string}),Object.defineProperty(this,kr.SEQ,{value:cd.seq}),this.sortMapEntries=typeof o=="function"?o:o===!0?ud:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};gs.Schema=Sr});var ys=w(ws=>{"use strict";var fd=C(),Cr=pt(),St=ut();function dd(t,e){let i=[],n=e.directives===!0;if(e.directives!==!1&&t.directives){let c=t.directives.toString(t);c?(i.push(c),n=!0):t.directives.docStart&&(n=!0)}n&&i.push("---");let r=Cr.createStringifyContext(t,e),{commentString:a}=r.options;if(t.commentBefore){i.length!==1&&i.unshift("");let c=a(t.commentBefore);i.unshift(St.indentComment(c,""))}let o=!1,s=null;if(t.contents){if(fd.isNode(t.contents)){if(t.contents.spaceBefore&&n&&i.push(""),t.contents.commentBefore){let d=a(t.contents.commentBefore);i.push(St.indentComment(d,""))}r.forceBlockIndent=!!t.comment,s=t.contents.comment}let c=s?void 0:()=>o=!0,l=Cr.stringify(t.contents,r,()=>s=null,c);s&&(l+=St.lineComment(l,"",a(s))),(l[0]==="|"||l[0]===">")&&i[i.length-1]==="---"?i[i.length-1]=`--- ${l}`:i.push(l)}else i.push(Cr.stringify(t.contents,r));if(t.directives?.docEnd)if(t.comment){let c=a(t.comment);c.includes(`
|
|
58
|
-
`)?(i.push("..."),i.push(
|
|
54
|
+
${n}${p}`}else return`${f}${o}${u.join(" ")}${o}${p}`}function Bi({indent:t,options:{commentString:e}},i,r,n){if(r&&n&&(r=r.replace(/^\n+/,"")),r){let a=Di.indentComment(e(r),t);i.push(a.trimStart())}}Zo.stringifyCollection=Cd});var Ee=w(wn=>{"use strict";var _d=vn(),Td=pn(),Id=Ei(),Se=P(),Li=ke(),jd=T();function Ot(t,e){let i=Se.isScalar(e)?e.value:e;for(let r of t)if(Se.isPair(r)&&(r.key===e||r.key===i||Se.isScalar(r.key)&&r.key.value===i))return r}var gn=class extends Id.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(Se.MAP,e),this.items=[]}static from(e,i,r){let{keepUndefined:n,replacer:a}=r,o=new this(e),s=(c,l)=>{if(typeof a=="function")l=a.call(i,c,l);else if(Array.isArray(a)&&!a.includes(c))return;(l!==void 0||n)&&o.items.push(Li.createPair(c,l,r))};if(i instanceof Map)for(let[c,l]of i)s(c,l);else if(i&&typeof i=="object")for(let c of Object.keys(i))s(c,i[c]);return typeof e.sortMapEntries=="function"&&o.items.sort(e.sortMapEntries),o}add(e,i){let r;Se.isPair(e)?r=e:!e||typeof e!="object"||!("key"in e)?r=new Li.Pair(e,e?.value):r=new Li.Pair(e.key,e.value);let n=Ot(this.items,r.key),a=this.schema?.sortMapEntries;if(n){if(!i)throw new Error(`Key ${r.key} already set`);Se.isScalar(n.value)&&jd.isScalarValue(r.value)?n.value.value=r.value:n.value=r.value}else if(a){let o=this.items.findIndex(s=>a(r,s)<0);o===-1?this.items.push(r):this.items.splice(o,0,r)}else this.items.push(r)}delete(e){let i=Ot(this.items,e);return i?this.items.splice(this.items.indexOf(i),1).length>0:!1}get(e,i){let n=Ot(this.items,e)?.value;return(!i&&Se.isScalar(n)?n.value:n)??void 0}has(e){return!!Ot(this.items,e)}set(e,i){this.add(new Li.Pair(e,i),!0)}toJSON(e,i,r){let n=r?new r:i?.mapAsMap?new Map:{};i?.onCreate&&i.onCreate(n);for(let a of this.items)Td.addPairToJSMap(i,n,a);return n}toString(e,i,r){if(!e)return JSON.stringify(this);for(let n of this.items)if(!Se.isPair(n))throw new Error(`Map items must all be pairs; found ${JSON.stringify(n)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),_d.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:r,onComment:i})}};wn.YAMLMap=gn;wn.findPair=Ot});var ot=w(ts=>{"use strict";var $d=P(),es=Ee(),Od={collection:"map",default:!0,nodeClass:es.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(t,e){return $d.isMap(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,i)=>es.YAMLMap.from(t,e,i)};ts.map=Od});var Pe=w(is=>{"use strict";var Hd=Rt(),Dd=vn(),Bd=Ei(),Fi=P(),Ld=T(),Md=we(),yn=class extends Bd.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(Fi.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let i=Mi(e);return typeof i!="number"?!1:this.items.splice(i,1).length>0}get(e,i){let r=Mi(e);if(typeof r!="number")return;let n=this.items[r];return!i&&Fi.isScalar(n)?n.value:n}has(e){let i=Mi(e);return typeof i=="number"&&i<this.items.length}set(e,i){let r=Mi(e);if(typeof r!="number")throw new Error(`Expected a valid index, not ${e}.`);let n=this.items[r];Fi.isScalar(n)&&Ld.isScalarValue(i)?n.value=i:this.items[r]=i}toJSON(e,i){let r=[];i?.onCreate&&i.onCreate(r);let n=0;for(let a of this.items)r.push(Md.toJS(a,String(n++),i));return r}toString(e,i,r){return e?Dd.stringifyCollection(this,e,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(e.indent||"")+" ",onChompKeep:r,onComment:i}):JSON.stringify(this)}static from(e,i,r){let{replacer:n}=r,a=new this(e);if(i&&Symbol.iterator in Object(i)){let o=0;for(let s of i){if(typeof n=="function"){let c=i instanceof Set?s:String(o++);s=n.call(i,c,s)}a.items.push(Hd.createNode(s,void 0,r))}}return a}};function Mi(t){let e=Fi.isScalar(t)?t.value:t;return e&&typeof e=="string"&&(e=Number(e)),typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}is.YAMLSeq=yn});var st=w(ns=>{"use strict";var Fd=P(),rs=Pe(),Vd={collection:"seq",default:!0,nodeClass:rs.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(t,e){return Fd.isSeq(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,i)=>rs.YAMLSeq.from(t,e,i)};ns.seq=Vd});var Ht=w(as=>{"use strict";var qd=It(),Wd={identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify(t,e,i,r){return e=Object.assign({actualString:!0},e),qd.stringifyString(t,e,i,r)}};as.string=Wd});var Vi=w(cs=>{"use strict";var os=T(),ss={identify:t=>t==null,createNode:()=>new os.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new os.Scalar(null),stringify:({source:t},e)=>typeof t=="string"&&ss.test.test(t)?t:e.options.nullStr};cs.nullTag=ss});var Nn=w(us=>{"use strict";var zd=T(),ls={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new zd.Scalar(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},i){if(t&&ls.test.test(t)){let r=t[0]==="t"||t[0]==="T";if(e===r)return t}return e?i.options.trueStr:i.options.falseStr}};us.boolTag=ls});var ct=w(ds=>{"use strict";function Jd({format:t,minFractionDigits:e,tag:i,value:r}){if(typeof r=="bigint")return String(r);let n=typeof r=="number"?r:Number(r);if(!isFinite(n))return isNaN(n)?".nan":n<0?"-.inf":".inf";let a=Object.is(r,-0)?"-0":JSON.stringify(r);if(!t&&e&&(!i||i==="tag:yaml.org,2002:float")&&/^-?\d/.test(a)&&!a.includes("e")){let o=a.indexOf(".");o<0&&(o=a.length,a+=".");let s=e-(a.length-o-1);for(;s-- >0;)a+="0"}return a}ds.stringifyNumber=Jd});var kn=w(qi=>{"use strict";var Gd=T(),bn=ct(),Ud={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:bn.stringifyNumber},Kd={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:t=>parseFloat(t),stringify(t){let e=Number(t.value);return isFinite(e)?e.toExponential():bn.stringifyNumber(t)}},Yd={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(t){let e=new Gd.Scalar(parseFloat(t)),i=t.indexOf(".");return i!==-1&&t[t.length-1]==="0"&&(e.minFractionDigits=t.length-i-1),e},stringify:bn.stringifyNumber};qi.float=Yd;qi.floatExp=Kd;qi.floatNaN=Ud});var En=w(zi=>{"use strict";var fs=ct(),Wi=t=>typeof t=="bigint"||Number.isInteger(t),Sn=(t,e,i,{intAsBigInt:r})=>r?BigInt(t):parseInt(t.substring(e),i);function hs(t,e,i){let{value:r}=t;return Wi(r)&&r>=0?i+r.toString(e):fs.stringifyNumber(t)}var Xd={identify:t=>Wi(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(t,e,i)=>Sn(t,2,8,i),stringify:t=>hs(t,8,"0o")},Qd={identify:Wi,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,i)=>Sn(t,0,10,i),stringify:fs.stringifyNumber},Zd={identify:t=>Wi(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(t,e,i)=>Sn(t,2,16,i),stringify:t=>hs(t,16,"0x")};zi.int=Qd;zi.intHex=Zd;zi.intOct=Xd});var ms=w(ps=>{"use strict";var ef=ot(),tf=Vi(),rf=st(),nf=Ht(),af=Nn(),Pn=kn(),xn=En(),of=[ef.map,rf.seq,nf.string,tf.nullTag,af.boolTag,xn.intOct,xn.int,xn.intHex,Pn.floatNaN,Pn.floatExp,Pn.float];ps.schema=of});var ws=w(gs=>{"use strict";var sf=T(),cf=ot(),lf=st();function vs(t){return typeof t=="bigint"||Number.isInteger(t)}var Ji=({value:t})=>JSON.stringify(t),uf=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:Ji},{identify:t=>t==null,createNode:()=>new sf.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:Ji},{identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:t=>t==="true",stringify:Ji},{identify:vs,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(t,e,{intAsBigInt:i})=>i?BigInt(t):parseInt(t,10),stringify:({value:t})=>vs(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:Ji}],df={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},ff=[cf.map,lf.seq].concat(uf,df);gs.schema=ff});var Rn=w(ys=>{"use strict";var Dt=pi("buffer"),Cn=T(),hf=It(),pf={identify:t=>t instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(t,e){if(typeof Dt.Buffer=="function")return Dt.Buffer.from(t,"base64");if(typeof atob=="function"){let i=atob(t.replace(/[\n\r]/g,"")),r=new Uint8Array(i.length);for(let n=0;n<i.length;++n)r[n]=i.charCodeAt(n);return r}else return e("This environment does not support reading binary tags; either Buffer or atob is required"),t},stringify({comment:t,type:e,value:i},r,n,a){if(!i)return"";let o=i,s;if(typeof Dt.Buffer=="function")s=o instanceof Dt.Buffer?o.toString("base64"):Dt.Buffer.from(o.buffer).toString("base64");else if(typeof btoa=="function"){let c="";for(let l=0;l<o.length;++l)c+=String.fromCharCode(o[l]);s=btoa(c)}else throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(e??(e=Cn.Scalar.BLOCK_LITERAL),e!==Cn.Scalar.QUOTE_DOUBLE){let c=Math.max(r.options.lineWidth-r.indent.length,r.options.minContentWidth),l=Math.ceil(s.length/c),d=new Array(l);for(let u=0,f=0;u<l;++u,f+=c)d[u]=s.substr(f,c);s=d.join(e===Cn.Scalar.BLOCK_LITERAL?`
|
|
55
|
+
`:" ")}return hf.stringifyString({comment:t,type:e,value:s},r,n,a)}};ys.binary=pf});var Ki=w(Ui=>{"use strict";var Gi=P(),An=ke(),mf=T(),vf=Pe();function Ns(t,e){if(Gi.isSeq(t))for(let i=0;i<t.items.length;++i){let r=t.items[i];if(!Gi.isPair(r)){if(Gi.isMap(r)){r.items.length>1&&e("Each pair must have its own sequence indicator");let n=r.items[0]||new An.Pair(new mf.Scalar(null));if(r.commentBefore&&(n.key.commentBefore=n.key.commentBefore?`${r.commentBefore}
|
|
56
|
+
${n.key.commentBefore}`:r.commentBefore),r.comment){let a=n.value??n.key;a.comment=a.comment?`${r.comment}
|
|
57
|
+
${a.comment}`:r.comment}r=n}t.items[i]=Gi.isPair(r)?r:new An.Pair(r)}}else e("Expected a sequence for this tag");return t}function bs(t,e,i){let{replacer:r}=i,n=new vf.YAMLSeq(t);n.tag="tag:yaml.org,2002:pairs";let a=0;if(e&&Symbol.iterator in Object(e))for(let o of e){typeof r=="function"&&(o=r.call(e,String(a++),o));let s,c;if(Array.isArray(o))if(o.length===2)s=o[0],c=o[1];else throw new TypeError(`Expected [key, value] tuple: ${o}`);else if(o&&o instanceof Object){let l=Object.keys(o);if(l.length===1)s=l[0],c=o[s];else throw new TypeError(`Expected tuple with one key, not ${l.length} keys`)}else s=o;n.items.push(An.createPair(s,c,i))}return n}var gf={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:Ns,createNode:bs};Ui.createPairs=bs;Ui.pairs=gf;Ui.resolvePairs=Ns});var In=w(Tn=>{"use strict";var ks=P(),_n=we(),Bt=Ee(),wf=Pe(),Ss=Ki(),Fe=class t extends wf.YAMLSeq{constructor(){super(),this.add=Bt.YAMLMap.prototype.add.bind(this),this.delete=Bt.YAMLMap.prototype.delete.bind(this),this.get=Bt.YAMLMap.prototype.get.bind(this),this.has=Bt.YAMLMap.prototype.has.bind(this),this.set=Bt.YAMLMap.prototype.set.bind(this),this.tag=t.tag}toJSON(e,i){if(!i)return super.toJSON(e);let r=new Map;i?.onCreate&&i.onCreate(r);for(let n of this.items){let a,o;if(ks.isPair(n)?(a=_n.toJS(n.key,"",i),o=_n.toJS(n.value,a,i)):a=_n.toJS(n,"",i),r.has(a))throw new Error("Ordered maps must not include duplicate keys");r.set(a,o)}return r}static from(e,i,r){let n=Ss.createPairs(e,i,r),a=new this;return a.items=n.items,a}};Fe.tag="tag:yaml.org,2002:omap";var yf={collection:"seq",identify:t=>t instanceof Map,nodeClass:Fe,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let i=Ss.resolvePairs(t,e),r=[];for(let{key:n}of i.items)ks.isScalar(n)&&(r.includes(n.value)?e(`Ordered maps must not include duplicate keys: ${n.value}`):r.push(n.value));return Object.assign(new Fe,i)},createNode:(t,e,i)=>Fe.from(t,e,i)};Tn.YAMLOMap=Fe;Tn.omap=yf});var Rs=w(jn=>{"use strict";var Es=T();function Ps({value:t,source:e},i){return e&&(t?xs:Cs).test.test(e)?e:t?i.options.trueStr:i.options.falseStr}var xs={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 Es.Scalar(!0),stringify:Ps},Cs={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 Es.Scalar(!1),stringify:Ps};jn.falseTag=Cs;jn.trueTag=xs});var As=w(Yi=>{"use strict";var Nf=T(),$n=ct(),bf={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:$n.stringifyNumber},kf={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():$n.stringifyNumber(t)}},Sf={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 Nf.Scalar(parseFloat(t.replace(/_/g,""))),i=t.indexOf(".");if(i!==-1){let r=t.substring(i+1).replace(/_/g,"");r[r.length-1]==="0"&&(e.minFractionDigits=r.length)}return e},stringify:$n.stringifyNumber};Yi.float=Sf;Yi.floatExp=kf;Yi.floatNaN=bf});var Ts=w(Mt=>{"use strict";var _s=ct(),Lt=t=>typeof t=="bigint"||Number.isInteger(t);function Xi(t,e,i,{intAsBigInt:r}){let n=t[0];if((n==="-"||n==="+")&&(e+=1),t=t.substring(e).replace(/_/g,""),r){switch(i){case 2:t=`0b${t}`;break;case 8:t=`0o${t}`;break;case 16:t=`0x${t}`;break}let o=BigInt(t);return n==="-"?BigInt(-1)*o:o}let a=parseInt(t,i);return n==="-"?-1*a:a}function On(t,e,i){let{value:r}=t;if(Lt(r)){let n=r.toString(e);return r<0?"-"+i+n.substr(1):i+n}return _s.stringifyNumber(t)}var Ef={identify:Lt,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,i)=>Xi(t,2,2,i),stringify:t=>On(t,2,"0b")},Pf={identify:Lt,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,i)=>Xi(t,1,8,i),stringify:t=>On(t,8,"0")},xf={identify:Lt,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,i)=>Xi(t,0,10,i),stringify:_s.stringifyNumber},Cf={identify:Lt,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,i)=>Xi(t,2,16,i),stringify:t=>On(t,16,"0x")};Mt.int=xf;Mt.intBin=Ef;Mt.intHex=Cf;Mt.intOct=Pf});var Dn=w(Hn=>{"use strict";var er=P(),Qi=ke(),Zi=Ee(),Ve=class t extends Zi.YAMLMap{constructor(e){super(e),this.tag=t.tag}add(e){let i;er.isPair(e)?i=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?i=new Qi.Pair(e.key,null):i=new Qi.Pair(e,null),Zi.findPair(this.items,i.key)||this.items.push(i)}get(e,i){let r=Zi.findPair(this.items,e);return!i&&er.isPair(r)?er.isScalar(r.key)?r.key.value:r.key:r}set(e,i){if(typeof i!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof i}`);let r=Zi.findPair(this.items,e);r&&!i?this.items.splice(this.items.indexOf(r),1):!r&&i&&this.items.push(new Qi.Pair(e))}toJSON(e,i){return super.toJSON(e,i,Set)}toString(e,i,r){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),i,r);throw new Error("Set items must all have null values")}static from(e,i,r){let{replacer:n}=r,a=new this(e);if(i&&Symbol.iterator in Object(i))for(let o of i)typeof n=="function"&&(o=n.call(i,o,o)),a.items.push(Qi.createPair(o,null,r));return a}};Ve.tag="tag:yaml.org,2002:set";var Rf={collection:"map",identify:t=>t instanceof Set,nodeClass:Ve,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,i)=>Ve.from(t,e,i),resolve(t,e){if(er.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}};Hn.YAMLSet=Ve;Hn.set=Rf});var Ln=w(tr=>{"use strict";var Af=ct();function Bn(t,e){let i=t[0],r=i==="-"||i==="+"?t.substring(1):t,n=o=>e?BigInt(o):Number(o),a=r.replace(/_/g,"").split(":").reduce((o,s)=>o*n(60)+n(s),n(0));return i==="-"?n(-1)*a:a}function Is(t){let{value:e}=t,i=o=>o;if(typeof e=="bigint")i=o=>BigInt(o);else if(isNaN(e)||!isFinite(e))return Af.stringifyNumber(t);let r="";e<0&&(r="-",e*=i(-1));let n=i(60),a=[e%n];return e<60?a.unshift(0):(e=(e-a[0])/n,a.unshift(e%n),e>=60&&(e=(e-a[0])/n,a.unshift(e))),r+a.map(o=>String(o).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var _f={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:i})=>Bn(t,i),stringify:Is},Tf={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=>Bn(t,!1),stringify:Is},js={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(js.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,i,r,n,a,o,s]=e.map(Number),c=e[7]?Number((e[7]+"00").substr(1,3)):0,l=Date.UTC(i,r-1,n,a||0,o||0,s||0,c),d=e[8];if(d&&d!=="Z"){let u=Bn(d,!1);Math.abs(u)<30&&(u*=60),l-=6e4*u}return new Date(l)},stringify:({value:t})=>t?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};tr.floatTime=Tf;tr.intTime=_f;tr.timestamp=js});var Hs=w(Os=>{"use strict";var If=ot(),jf=Vi(),$f=st(),Of=Ht(),Hf=Rn(),$s=Rs(),Mn=As(),ir=Ts(),Df=$i(),Bf=In(),Lf=Ki(),Mf=Dn(),Fn=Ln(),Ff=[If.map,$f.seq,Of.string,jf.nullTag,$s.trueTag,$s.falseTag,ir.intBin,ir.intOct,ir.int,ir.intHex,Mn.floatNaN,Mn.floatExp,Mn.float,Hf.binary,Df.merge,Bf.omap,Lf.pairs,Mf.set,Fn.intTime,Fn.floatTime,Fn.timestamp];Os.schema=Ff});var Js=w(Wn=>{"use strict";var Ms=ot(),Vf=Vi(),Fs=st(),qf=Ht(),Wf=Nn(),Vn=kn(),qn=En(),zf=ms(),Jf=ws(),Vs=Rn(),Ft=$i(),qs=In(),Ws=Ki(),Ds=Hs(),zs=Dn(),rr=Ln(),Bs=new Map([["core",zf.schema],["failsafe",[Ms.map,Fs.seq,qf.string]],["json",Jf.schema],["yaml11",Ds.schema],["yaml-1.1",Ds.schema]]),Ls={binary:Vs.binary,bool:Wf.boolTag,float:Vn.float,floatExp:Vn.floatExp,floatNaN:Vn.floatNaN,floatTime:rr.floatTime,int:qn.int,intHex:qn.intHex,intOct:qn.intOct,intTime:rr.intTime,map:Ms.map,merge:Ft.merge,null:Vf.nullTag,omap:qs.omap,pairs:Ws.pairs,seq:Fs.seq,set:zs.set,timestamp:rr.timestamp},Gf={"tag:yaml.org,2002:binary":Vs.binary,"tag:yaml.org,2002:merge":Ft.merge,"tag:yaml.org,2002:omap":qs.omap,"tag:yaml.org,2002:pairs":Ws.pairs,"tag:yaml.org,2002:set":zs.set,"tag:yaml.org,2002:timestamp":rr.timestamp};function Uf(t,e,i){let r=Bs.get(e);if(r&&!t)return i&&!r.includes(Ft.merge)?r.concat(Ft.merge):r.slice();let n=r;if(!n)if(Array.isArray(t))n=[];else{let a=Array.from(Bs.keys()).filter(o=>o!=="yaml11").map(o=>JSON.stringify(o)).join(", ");throw new Error(`Unknown schema "${e}"; use one of ${a} or define customTags array`)}if(Array.isArray(t))for(let a of t)n=n.concat(a);else typeof t=="function"&&(n=t(n.slice()));return i&&(n=n.concat(Ft.merge)),n.reduce((a,o)=>{let s=typeof o=="string"?Ls[o]:o;if(!s){let c=JSON.stringify(o),l=Object.keys(Ls).map(d=>JSON.stringify(d)).join(", ");throw new Error(`Unknown custom tag ${c}; use one of ${l}`)}return a.includes(s)||a.push(s),a},[])}Wn.coreKnownTags=Gf;Wn.getTags=Uf});var Gn=w(Gs=>{"use strict";var zn=P(),Kf=ot(),Yf=st(),Xf=Ht(),nr=Js(),Qf=(t,e)=>t.key<e.key?-1:t.key>e.key?1:0,Jn=class t{constructor({compat:e,customTags:i,merge:r,resolveKnownTags:n,schema:a,sortMapEntries:o,toStringDefaults:s}){this.compat=Array.isArray(e)?nr.getTags(e,"compat"):e?nr.getTags(null,e):null,this.name=typeof a=="string"&&a||"core",this.knownTags=n?nr.coreKnownTags:{},this.tags=nr.getTags(i,this.name,r),this.toStringOptions=s??null,Object.defineProperty(this,zn.MAP,{value:Kf.map}),Object.defineProperty(this,zn.SCALAR,{value:Xf.string}),Object.defineProperty(this,zn.SEQ,{value:Yf.seq}),this.sortMapEntries=typeof o=="function"?o:o===!0?Qf:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};Gs.Schema=Jn});var Ks=w(Us=>{"use strict";var Zf=P(),Un=jt(),Vt=At();function eh(t,e){let i=[],r=e.directives===!0;if(e.directives!==!1&&t.directives){let c=t.directives.toString(t);c?(i.push(c),r=!0):t.directives.docStart&&(r=!0)}r&&i.push("---");let n=Un.createStringifyContext(t,e),{commentString:a}=n.options;if(t.commentBefore){i.length!==1&&i.unshift("");let c=a(t.commentBefore);i.unshift(Vt.indentComment(c,""))}let o=!1,s=null;if(t.contents){if(Zf.isNode(t.contents)){if(t.contents.spaceBefore&&r&&i.push(""),t.contents.commentBefore){let d=a(t.contents.commentBefore);i.push(Vt.indentComment(d,""))}n.forceBlockIndent=!!t.comment,s=t.contents.comment}let c=s?void 0:()=>o=!0,l=Un.stringify(t.contents,n,()=>s=null,c);s&&(l+=Vt.lineComment(l,"",a(s))),(l[0]==="|"||l[0]===">")&&i[i.length-1]==="---"?i[i.length-1]=`--- ${l}`:i.push(l)}else i.push(Un.stringify(t.contents,n));if(t.directives?.docEnd)if(t.comment){let c=a(t.comment);c.includes(`
|
|
58
|
+
`)?(i.push("..."),i.push(Vt.indentComment(c,""))):i.push(`... ${c}`)}else i.push("...");else{let c=t.comment;c&&o&&(c=c.replace(/^\n+/,"")),c&&((!o||s)&&i[i.length-1]!==""&&i.push(""),i.push(Vt.indentComment(a(c),"")))}return i.join(`
|
|
59
59
|
`)+`
|
|
60
|
-
`}
|
|
61
|
-
`),o=s+o}if(/[^ ]/.test(o)){let s=1,c=i.linePos[1];c?.line===
|
|
60
|
+
`}Us.stringifyDocument=eh});var qt=w(Ys=>{"use strict";var th=Ct(),lt=Ei(),U=P(),ih=ke(),rh=we(),nh=Gn(),ah=Ks(),Kn=Ni(),oh=Qr(),sh=Rt(),Yn=Xr(),Xn=class t{constructor(e,i,r){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,U.NODE_TYPE,{value:U.DOC});let n=null;typeof i=="function"||Array.isArray(i)?n=i:r===void 0&&i&&(r=i,i=void 0);let a=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},r);this.options=a;let{version:o}=a;r?._directives?(this.directives=r._directives.atDocument(),this.directives.yaml.explicit&&(o=this.directives.yaml.version)):this.directives=new Yn.Directives({version:o}),this.setSchema(o,r),this.contents=e===void 0?null:this.createNode(e,n,r)}clone(){let e=Object.create(t.prototype,{[U.NODE_TYPE]:{value:U.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=U.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){ut(this.contents)&&this.contents.add(e)}addIn(e,i){ut(this.contents)&&this.contents.addIn(e,i)}createAlias(e,i){if(!e.anchor){let r=Kn.anchorNames(this);e.anchor=!i||r.has(i)?Kn.findNewAnchor(i||"a",r):i}return new th.Alias(e.anchor)}createNode(e,i,r){let n;if(typeof i=="function")e=i.call({"":e},"",e),n=i;else if(Array.isArray(i)){let m=N=>typeof N=="number"||N instanceof String||N instanceof Number,y=i.filter(m).map(String);y.length>0&&(i=i.concat(y)),n=i}else r===void 0&&i&&(r=i,i=void 0);let{aliasDuplicateObjects:a,anchorPrefix:o,flow:s,keepUndefined:c,onTagObj:l,tag:d}=r??{},{onAnchor:u,setAnchors:f,sourceObjects:p}=Kn.createNodeAnchors(this,o||"a"),g={aliasDuplicateObjects:a??!0,keepUndefined:c??!1,onAnchor:u,onTagObj:l,replacer:n,schema:this.schema,sourceObjects:p},h=sh.createNode(e,d,g);return s&&U.isCollection(h)&&(h.flow=!0),f(),h}createPair(e,i,r={}){let n=this.createNode(e,null,r),a=this.createNode(i,null,r);return new ih.Pair(n,a)}delete(e){return ut(this.contents)?this.contents.delete(e):!1}deleteIn(e){return lt.isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):ut(this.contents)?this.contents.deleteIn(e):!1}get(e,i){return U.isCollection(this.contents)?this.contents.get(e,i):void 0}getIn(e,i){return lt.isEmptyPath(e)?!i&&U.isScalar(this.contents)?this.contents.value:this.contents:U.isCollection(this.contents)?this.contents.getIn(e,i):void 0}has(e){return U.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return lt.isEmptyPath(e)?this.contents!==void 0:U.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,i){this.contents==null?this.contents=lt.collectionFromPath(this.schema,[e],i):ut(this.contents)&&this.contents.set(e,i)}setIn(e,i){lt.isEmptyPath(e)?this.contents=i:this.contents==null?this.contents=lt.collectionFromPath(this.schema,Array.from(e),i):ut(this.contents)&&this.contents.setIn(e,i)}setSchema(e,i={}){typeof e=="number"&&(e=String(e));let r;switch(e){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new Yn.Directives({version:"1.1"}),r={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=e:this.directives=new Yn.Directives({version:e}),r={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,r=null;break;default:{let n=JSON.stringify(e);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${n}`)}}if(i.schema instanceof Object)this.schema=i.schema;else if(r)this.schema=new nh.Schema(Object.assign(r,i));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:e,jsonArg:i,mapAsMap:r,maxAliasCount:n,onAnchor:a,reviver:o}={}){let s={anchors:new Map,doc:this,keep:!e,mapAsMap:r===!0,mapKeyWarned:!1,maxAliasCount:typeof n=="number"?n:100},c=rh.toJS(this.contents,i??"",s);if(typeof a=="function")for(let{count:l,res:d}of s.anchors.values())a(d,l);return typeof o=="function"?oh.applyReviver(o,{"":c},"",c):c}toJSON(e,i){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:i})}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 i=JSON.stringify(e.indent);throw new Error(`"indent" option must be a positive integer, not ${i}`)}return ah.stringifyDocument(this,e)}};function ut(t){if(U.isCollection(t))return!0;throw new Error("Expected a YAML collection as document contents")}Ys.Document=Xn});var Jt=w(zt=>{"use strict";var Wt=class extends Error{constructor(e,i,r,n){super(),this.name=e,this.code=r,this.message=n,this.pos=i}},Qn=class extends Wt{constructor(e,i,r){super("YAMLParseError",e,i,r)}},Zn=class extends Wt{constructor(e,i,r){super("YAMLWarning",e,i,r)}},ch=(t,e)=>i=>{if(i.pos[0]===-1)return;i.linePos=i.pos.map(s=>e.linePos(s));let{line:r,col:n}=i.linePos[0];i.message+=` at line ${r}, column ${n}`;let a=n-1,o=t.substring(e.lineStarts[r-1],e.lineStarts[r]).replace(/[\n\r]+$/,"");if(a>=60&&o.length>80){let s=Math.min(a-39,o.length-79);o="…"+o.substring(s),a-=s-1}if(o.length>80&&(o=o.substring(0,79)+"…"),r>1&&/^ *$/.test(o.substring(0,a))){let s=t.substring(e.lineStarts[r-2],e.lineStarts[r-1]);s.length>80&&(s=s.substring(0,79)+`…
|
|
61
|
+
`),o=s+o}if(/[^ ]/.test(o)){let s=1,c=i.linePos[1];c?.line===r&&c.col>n&&(s=Math.max(1,Math.min(c.col-n,80-a)));let l=" ".repeat(a)+"^".repeat(s);i.message+=`:
|
|
62
62
|
|
|
63
63
|
${o}
|
|
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 i of e.start)if(i.type==="newline")return!0;if(e.sep){for(let i of e.sep)if(i.type==="newline")return!0}if(
|
|
67
|
-
`+h.comment:s.comment=h.comment);continue}(h.newlineAfterProp||
|
|
68
|
-
`+k.comment:N.comment=k.comment);let S=new
|
|
69
|
-
`+v.comment:l.comment=v.comment),u=v.end;continue}!o&&i.options.strict&&
|
|
70
|
-
`+
|
|
71
|
-
`+
|
|
72
|
-
`+
|
|
73
|
-
`.repeat(Math.max(1,o.length-1)):"",
|
|
74
|
-
`;for(let h=d;h<s;++h){let[
|
|
75
|
-
`):
|
|
76
|
-
`:!
|
|
65
|
+
`}};zt.YAMLError=Wt;zt.YAMLParseError=Qn;zt.YAMLWarning=Zn;zt.prettifyError=ch});var Gt=w(Xs=>{"use strict";function lh(t,{flow:e,indicator:i,next:r,offset:n,onError:a,parentIndent:o,startOnNewline:s}){let c=!1,l=s,d=s,u="",f="",p=!1,g=!1,h=null,m=null,y=null,N=null,k=null,S=null,E=null;for(let b of t)switch(g&&(b.type!=="space"&&b.type!=="newline"&&b.type!=="comma"&&a(b.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),g=!1),h&&(l&&b.type!=="comment"&&b.type!=="newline"&&a(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),h=null),b.type){case"space":!e&&(i!=="doc-start"||r?.type!=="flow-collection")&&b.source.includes(" ")&&(h=b),d=!0;break;case"comment":{d||a(b,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let A=b.source.substring(1)||" ";u?u+=f+A:u=A,f="",l=!1;break}case"newline":l?u?u+=b.source:(!S||i!=="seq-item-ind")&&(c=!0):f+=b.source,l=!0,p=!0,(m||y)&&(N=b),d=!0;break;case"anchor":m&&a(b,"MULTIPLE_ANCHORS","A node can have at most one anchor"),b.source.endsWith(":")&&a(b.offset+b.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),m=b,E??(E=b.offset),l=!1,d=!1,g=!0;break;case"tag":{y&&a(b,"MULTIPLE_TAGS","A node can have at most one tag"),y=b,E??(E=b.offset),l=!1,d=!1,g=!0;break}case i:(m||y)&&a(b,"BAD_PROP_ORDER",`Anchors and tags must be after the ${b.source} indicator`),S&&a(b,"UNEXPECTED_TOKEN",`Unexpected ${b.source} in ${e??"collection"}`),S=b,l=i==="seq-item-ind"||i==="explicit-key-ind",d=!1;break;case"comma":if(e){k&&a(b,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),k=b,l=!1,d=!1;break}default:a(b,"UNEXPECTED_TOKEN",`Unexpected ${b.type} token`),l=!1,d=!1}let v=t[t.length-1],x=v?v.offset+v.source.length:n;return g&&r&&r.type!=="space"&&r.type!=="newline"&&r.type!=="comma"&&(r.type!=="scalar"||r.source!=="")&&a(r.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),h&&(l&&h.indent<=o||r?.type==="block-map"||r?.type==="block-seq")&&a(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:k,found:S,spaceBefore:c,comment:u,hasNewline:p,anchor:m,tag:y,newlineAfterProp:N,end:x,start:E??x}}Xs.resolveProps=lh});var ar=w(Qs=>{"use strict";function ea(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 i of e.start)if(i.type==="newline")return!0;if(e.sep){for(let i of e.sep)if(i.type==="newline")return!0}if(ea(e.key)||ea(e.value))return!0}return!1;default:return!0}}Qs.containsNewline=ea});var ta=w(Zs=>{"use strict";var uh=ar();function dh(t,e,i){if(e?.type==="flow-collection"){let r=e.end[0];r.indent===t&&(r.source==="]"||r.source==="}")&&uh.containsNewline(e)&&i(r,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}Zs.flowIndentCheck=dh});var ia=w(tc=>{"use strict";var ec=P();function fh(t,e,i){let{uniqueKeys:r}=t.options;if(r===!1)return!1;let n=typeof r=="function"?r:(a,o)=>a===o||ec.isScalar(a)&&ec.isScalar(o)&&a.value===o.value;return e.some(a=>n(a.key,i))}tc.mapIncludes=fh});var sc=w(oc=>{"use strict";var ic=ke(),hh=Ee(),rc=Gt(),ph=ar(),nc=ta(),mh=ia(),ac="All mapping items must start at the same column";function vh({composeNode:t,composeEmptyNode:e},i,r,n,a){let o=a?.nodeClass??hh.YAMLMap,s=new o(i.schema);i.atRoot&&(i.atRoot=!1);let c=r.offset,l=null;for(let d of r.items){let{start:u,key:f,sep:p,value:g}=d,h=rc.resolveProps(u,{indicator:"explicit-key-ind",next:f??p?.[0],offset:c,onError:n,parentIndent:r.indent,startOnNewline:!0}),m=!h.found;if(m){if(f&&(f.type==="block-seq"?n(c,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in f&&f.indent!==r.indent&&n(c,"BAD_INDENT",ac)),!h.anchor&&!h.tag&&!p){l=h.end,h.comment&&(s.comment?s.comment+=`
|
|
67
|
+
`+h.comment:s.comment=h.comment);continue}(h.newlineAfterProp||ph.containsNewline(f))&&n(f??u[u.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else h.found?.indent!==r.indent&&n(c,"BAD_INDENT",ac);i.atKey=!0;let y=h.end,N=f?t(i,f,h,n):e(i,y,u,null,h,n);i.schema.compat&&nc.flowIndentCheck(r.indent,f,n),i.atKey=!1,mh.mapIncludes(i,s.items,N)&&n(y,"DUPLICATE_KEY","Map keys must be unique");let k=rc.resolveProps(p??[],{indicator:"map-value-ind",next:g,offset:N.range[2],onError:n,parentIndent:r.indent,startOnNewline:!f||f.type==="block-scalar"});if(c=k.end,k.found){m&&(g?.type==="block-map"&&!k.hasNewline&&n(c,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),i.options.strict&&h.start<k.found.offset-1024&&n(N.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));let S=g?t(i,g,k,n):e(i,c,p,null,k,n);i.schema.compat&&nc.flowIndentCheck(r.indent,g,n),c=S.range[2];let E=new ic.Pair(N,S);i.options.keepSourceTokens&&(E.srcToken=d),s.items.push(E)}else{m&&n(N.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),k.comment&&(N.comment?N.comment+=`
|
|
68
|
+
`+k.comment:N.comment=k.comment);let S=new ic.Pair(N);i.options.keepSourceTokens&&(S.srcToken=d),s.items.push(S)}}return l&&l<c&&n(l,"IMPOSSIBLE","Map comment with trailing content"),s.range=[r.offset,c,l??c],s}oc.resolveBlockMap=vh});var lc=w(cc=>{"use strict";var gh=Pe(),wh=Gt(),yh=ta();function Nh({composeNode:t,composeEmptyNode:e},i,r,n,a){let o=a?.nodeClass??gh.YAMLSeq,s=new o(i.schema);i.atRoot&&(i.atRoot=!1),i.atKey&&(i.atKey=!1);let c=r.offset,l=null;for(let{start:d,value:u}of r.items){let f=wh.resolveProps(d,{indicator:"seq-item-ind",next:u,offset:c,onError:n,parentIndent:r.indent,startOnNewline:!0});if(!f.found)if(f.anchor||f.tag||u)u?.type==="block-seq"?n(f.end,"BAD_INDENT","All sequence items must start at the same column"):n(c,"MISSING_CHAR","Sequence item without - indicator");else{l=f.end,f.comment&&(s.comment=f.comment);continue}let p=u?t(i,u,f,n):e(i,f.end,d,null,f,n);i.schema.compat&&yh.flowIndentCheck(r.indent,u,n),c=p.range[2],s.items.push(p)}return s.range=[r.offset,c,l??c],s}cc.resolveBlockSeq=Nh});var dt=w(uc=>{"use strict";function bh(t,e,i,r){let n="";if(t){let a=!1,o="";for(let s of t){let{source:c,type:l}=s;switch(l){case"space":a=!0;break;case"comment":{i&&!a&&r(s,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let d=c.substring(1)||" ";n?n+=o+d:n=d,o="";break}case"newline":n&&(o+=c),a=!0;break;default:r(s,"UNEXPECTED_TOKEN",`Unexpected ${l} at node end`)}e+=c.length}}return{comment:n,offset:e}}uc.resolveEnd=bh});var pc=w(hc=>{"use strict";var kh=P(),Sh=ke(),dc=Ee(),Eh=Pe(),Ph=dt(),fc=Gt(),xh=ar(),Ch=ia(),ra="Block collections are not allowed within flow collections",na=t=>t&&(t.type==="block-map"||t.type==="block-seq");function Rh({composeNode:t,composeEmptyNode:e},i,r,n,a){let o=r.start.source==="{",s=o?"flow map":"flow sequence",c=a?.nodeClass??(o?dc.YAMLMap:Eh.YAMLSeq),l=new c(i.schema);l.flow=!0;let d=i.atRoot;d&&(i.atRoot=!1),i.atKey&&(i.atKey=!1);let u=r.offset+r.start.source.length;for(let m=0;m<r.items.length;++m){let y=r.items[m],{start:N,key:k,sep:S,value:E}=y,v=fc.resolveProps(N,{flow:s,indicator:"explicit-key-ind",next:k??S?.[0],offset:u,onError:n,parentIndent:r.indent,startOnNewline:!1});if(!v.found){if(!v.anchor&&!v.tag&&!S&&!E){m===0&&v.comma?n(v.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${s}`):m<r.items.length-1&&n(v.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${s}`),v.comment&&(l.comment?l.comment+=`
|
|
69
|
+
`+v.comment:l.comment=v.comment),u=v.end;continue}!o&&i.options.strict&&xh.containsNewline(k)&&n(k,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(m===0)v.comma&&n(v.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${s}`);else if(v.comma||n(v.start,"MISSING_CHAR",`Missing , between ${s} items`),v.comment){let x="";e:for(let b of N)switch(b.type){case"comma":case"space":break;case"comment":x=b.source.substring(1);break e;default:break e}if(x){let b=l.items[l.items.length-1];kh.isPair(b)&&(b=b.value??b.key),b.comment?b.comment+=`
|
|
70
|
+
`+x:b.comment=x,v.comment=v.comment.substring(x.length+1)}}if(!o&&!S&&!v.found){let x=E?t(i,E,v,n):e(i,v.end,S,null,v,n);l.items.push(x),u=x.range[2],na(E)&&n(x.range,"BLOCK_IN_FLOW",ra)}else{i.atKey=!0;let x=v.end,b=k?t(i,k,v,n):e(i,x,N,null,v,n);na(k)&&n(b.range,"BLOCK_IN_FLOW",ra),i.atKey=!1;let A=fc.resolveProps(S??[],{flow:s,indicator:"map-value-ind",next:E,offset:b.range[2],onError:n,parentIndent:r.indent,startOnNewline:!1});if(A.found){if(!o&&!v.found&&i.options.strict){if(S)for(let j of S){if(j===A.found)break;if(j.type==="newline"){n(j,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}v.start<A.found.offset-1024&&n(A.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else E&&("source"in E&&E.source?.[0]===":"?n(E,"MISSING_CHAR",`Missing space after : in ${s}`):n(A.start,"MISSING_CHAR",`Missing , or : between ${s} items`));let J=E?t(i,E,A,n):A.found?e(i,A.end,S,null,A,n):null;J?na(E)&&n(J.range,"BLOCK_IN_FLOW",ra):A.comment&&(b.comment?b.comment+=`
|
|
71
|
+
`+A.comment:b.comment=A.comment);let tt=new Sh.Pair(b,J);if(i.options.keepSourceTokens&&(tt.srcToken=y),o){let j=l;Ch.mapIncludes(i,j.items,b)&&n(x,"DUPLICATE_KEY","Map keys must be unique"),j.items.push(tt)}else{let j=new dc.YAMLMap(i.schema);j.flow=!0,j.items.push(tt);let ho=(J??b).range;j.range=[b.range[0],ho[1],ho[2]],l.items.push(j)}u=J?J.range[2]:A.end}}let f=o?"}":"]",[p,...g]=r.end,h=u;if(p?.source===f)h=p.offset+p.source.length;else{let m=s[0].toUpperCase()+s.substring(1),y=d?`${m} must end with a ${f}`:`${m} in block collection must be sufficiently indented and end with a ${f}`;n(u,d?"MISSING_CHAR":"BAD_INDENT",y),p&&p.source.length!==1&&g.unshift(p)}if(g.length>0){let m=Ph.resolveEnd(g,h,i.options.strict,n);m.comment&&(l.comment?l.comment+=`
|
|
72
|
+
`+m.comment:l.comment=m.comment),l.range=[r.offset,h,m.offset]}else l.range=[r.offset,h,h];return l}hc.resolveFlowCollection=Rh});var vc=w(mc=>{"use strict";var Ah=P(),_h=T(),Th=Ee(),Ih=Pe(),jh=sc(),$h=lc(),Oh=pc();function aa(t,e,i,r,n,a){let o=i.type==="block-map"?jh.resolveBlockMap(t,e,i,r,a):i.type==="block-seq"?$h.resolveBlockSeq(t,e,i,r,a):Oh.resolveFlowCollection(t,e,i,r,a),s=o.constructor;return n==="!"||n===s.tagName?(o.tag=s.tagName,o):(n&&(o.tag=n),o)}function Hh(t,e,i,r,n){let a=r.tag,o=a?e.directives.tagName(a.source,f=>n(a,"TAG_RESOLVE_FAILED",f)):null;if(i.type==="block-seq"){let{anchor:f,newlineAfterProp:p}=r,g=f&&a?f.offset>a.offset?f:a:f??a;g&&(!p||p.offset<g.offset)&&n(g,"MISSING_CHAR","Missing newline after block sequence props")}let s=i.type==="block-map"?"map":i.type==="block-seq"?"seq":i.start.source==="{"?"map":"seq";if(!a||!o||o==="!"||o===Th.YAMLMap.tagName&&s==="map"||o===Ih.YAMLSeq.tagName&&s==="seq")return aa(t,e,i,n,o);let c=e.schema.tags.find(f=>f.tag===o&&f.collection===s);if(!c){let f=e.schema.knownTags[o];if(f?.collection===s)e.schema.tags.push(Object.assign({},f,{default:!1})),c=f;else return f?n(a,"BAD_COLLECTION_TYPE",`${f.tag} used for ${s} collection, but expects ${f.collection??"scalar"}`,!0):n(a,"TAG_RESOLVE_FAILED",`Unresolved tag: ${o}`,!0),aa(t,e,i,n,o)}let l=aa(t,e,i,n,o,c),d=c.resolve?.(l,f=>n(a,"TAG_RESOLVE_FAILED",f),e.options)??l,u=Ah.isNode(d)?d:new _h.Scalar(d);return u.range=l.range,u.tag=o,c?.format&&(u.format=c.format),u}mc.composeCollection=Hh});var sa=w(gc=>{"use strict";var oa=T();function Dh(t,e,i){let r=e.offset,n=Bh(e,t.options.strict,i);if(!n)return{value:"",type:null,comment:"",range:[r,r,r]};let a=n.mode===">"?oa.Scalar.BLOCK_FOLDED:oa.Scalar.BLOCK_LITERAL,o=e.source?Lh(e.source):[],s=o.length;for(let h=o.length-1;h>=0;--h){let m=o[h][1];if(m===""||m==="\r")s=h;else break}if(s===0){let h=n.chomp==="+"&&o.length>0?`
|
|
73
|
+
`.repeat(Math.max(1,o.length-1)):"",m=r+n.length;return e.source&&(m+=e.source.length),{value:h,type:a,comment:n.comment,range:[r,m,m]}}let c=e.indent+n.indent,l=e.offset+n.length,d=0;for(let h=0;h<s;++h){let[m,y]=o[h];if(y===""||y==="\r")n.indent===0&&m.length>c&&(c=m.length);else{m.length<c&&i(l+m.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator"),n.indent===0&&(c=m.length),d=h,c===0&&!t.atRoot&&i(l,"BAD_INDENT","Block scalar values in collections must be indented");break}l+=m.length+y.length+1}for(let h=o.length-1;h>=s;--h)o[h][0].length>c&&(s=h+1);let u="",f="",p=!1;for(let h=0;h<d;++h)u+=o[h][0].slice(c)+`
|
|
74
|
+
`;for(let h=d;h<s;++h){let[m,y]=o[h];l+=m.length+y.length+1;let N=y[y.length-1]==="\r";if(N&&(y=y.slice(0,-1)),y&&m.length<c){let S=`Block scalar lines must not be less indented than their ${n.indent?"explicit indentation indicator":"first line"}`;i(l-y.length-(N?2:1),"BAD_INDENT",S),m=""}a===oa.Scalar.BLOCK_LITERAL?(u+=f+m.slice(c)+y,f=`
|
|
75
|
+
`):m.length>c||y[0]===" "?(f===" "?f=`
|
|
76
|
+
`:!p&&f===`
|
|
77
77
|
`&&(f=`
|
|
78
78
|
|
|
79
|
-
`),u+=f+
|
|
80
|
-
`,
|
|
79
|
+
`),u+=f+m.slice(c)+y,f=`
|
|
80
|
+
`,p=!0):y===""?f===`
|
|
81
81
|
`?u+=`
|
|
82
82
|
`:f=`
|
|
83
|
-
`:(u+=f+y,f=" ",
|
|
83
|
+
`:(u+=f+y,f=" ",p=!1)}switch(n.chomp){case"-":break;case"+":for(let h=s;h<o.length;++h)u+=`
|
|
84
84
|
`+o[h][0].slice(c);u[u.length-1]!==`
|
|
85
85
|
`&&(u+=`
|
|
86
86
|
`);break;default:u+=`
|
|
87
|
-
`}let g=n
|
|
87
|
+
`}let g=r+n.length+e.source.length;return{value:u,type:a,comment:n.comment,range:[r,g,g]}}function Bh({offset:t,props:e},i,r){if(e[0].type!=="block-scalar-header")return r(e[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:n}=e[0],a=n[0],o=0,s="",c=-1;for(let f=1;f<n.length;++f){let p=n[f];if(!s&&(p==="-"||p==="+"))s=p;else{let g=Number(p);!o&&g?o=g:c===-1&&(c=t+f)}}c!==-1&&r(c,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${n}`);let l=!1,d="",u=n.length;for(let f=1;f<e.length;++f){let p=e[f];switch(p.type){case"space":l=!0;case"newline":u+=p.source.length;break;case"comment":i&&!l&&r(p,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),u+=p.source.length,d=p.source.substring(1);break;case"error":r(p,"UNEXPECTED_TOKEN",p.message),u+=p.source.length;break;default:{let g=`Unexpected token in block scalar header: ${p.type}`;r(p,"UNEXPECTED_TOKEN",g);let h=p.source;h&&typeof h=="string"&&(u+=h.length)}}}return{mode:a,indent:o,chomp:s,comment:d,length:u}}function Lh(t){let e=t.split(/\n( *)/),i=e[0],r=i.match(/^( *)/),a=[r?.[1]?[r[1],i.slice(r[1].length)]:["",i]];for(let o=1;o<e.length;o+=2)a.push([e[o],e[o+1]]);return a}gc.resolveBlockScalar=Dh});var la=w(yc=>{"use strict";var ca=T(),Mh=dt();function Fh(t,e,i){let{offset:r,type:n,source:a,end:o}=t,s,c,l=(f,p,g)=>i(r+f,p,g);switch(n){case"scalar":s=ca.Scalar.PLAIN,c=Vh(a,l);break;case"single-quoted-scalar":s=ca.Scalar.QUOTE_SINGLE,c=qh(a,l);break;case"double-quoted-scalar":s=ca.Scalar.QUOTE_DOUBLE,c=Wh(a,l);break;default:return i(t,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${n}`),{value:"",type:null,comment:"",range:[r,r+a.length,r+a.length]}}let d=r+a.length,u=Mh.resolveEnd(o,d,e,i);return{value:c,type:s,comment:u.comment,range:[r,d,u.offset]}}function Vh(t,e){let i="";switch(t[0]){case" ":i="a tab character";break;case",":i="flow indicator character ,";break;case"%":i="directive indicator character %";break;case"|":case">":{i=`block scalar indicator ${t[0]}`;break}case"@":case"`":{i=`reserved character ${t[0]}`;break}}return i&&e(0,"BAD_SCALAR_START",`Plain value cannot start with ${i}`),wc(t)}function qh(t,e){return(t[t.length-1]!=="'"||t.length===1)&&e(t.length,"MISSING_CHAR","Missing closing 'quote"),wc(t.slice(1,-1)).replace(/''/g,"'")}function wc(t){let e,i;try{e=new RegExp(`(.*?)(?<![ ])[ ]*\r?
|
|
88
88
|
`,"sy"),i=new RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
|
|
89
|
-
`,"sy")}catch{e=/(.*?)[ \t]*\r?\n/sy,i=/[ \t]*(.*?)[ \t]*\r?\n/sy}let
|
|
90
|
-
`?
|
|
91
|
-
`:(
|
|
92
|
-
`))if(
|
|
93
|
-
`){let{fold:a,offset:o}=
|
|
94
|
-
`)for(a=t[
|
|
95
|
-
`)for(a=t[++
|
|
96
|
-
`&&!(o==="\r"&&t[
|
|
97
|
-
`)&&(i+=
|
|
98
|
-
`||
|
|
99
|
-
`);)
|
|
89
|
+
`,"sy")}catch{e=/(.*?)[ \t]*\r?\n/sy,i=/[ \t]*(.*?)[ \t]*\r?\n/sy}let r=e.exec(t);if(!r)return t;let n=r[1],a=" ",o=e.lastIndex;for(i.lastIndex=o;r=i.exec(t);)r[1]===""?a===`
|
|
90
|
+
`?n+=a:a=`
|
|
91
|
+
`:(n+=a+r[1],a=" "),o=i.lastIndex;let s=/[ \t]*(.*)/sy;return s.lastIndex=o,r=s.exec(t),n+a+(r?.[1]??"")}function Wh(t,e){let i="";for(let r=1;r<t.length-1;++r){let n=t[r];if(!(n==="\r"&&t[r+1]===`
|
|
92
|
+
`))if(n===`
|
|
93
|
+
`){let{fold:a,offset:o}=zh(t,r);i+=a,r=o}else if(n==="\\"){let a=t[++r],o=Jh[a];if(o)i+=o;else if(a===`
|
|
94
|
+
`)for(a=t[r+1];a===" "||a===" ";)a=t[++r+1];else if(a==="\r"&&t[r+1]===`
|
|
95
|
+
`)for(a=t[++r+1];a===" "||a===" ";)a=t[++r+1];else if(a==="x"||a==="u"||a==="U"){let s=a==="x"?2:a==="u"?4:8;i+=Gh(t,r+1,s,e),r+=s}else{let s=t.substr(r-1,2);e(r-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${s}`),i+=s}}else if(n===" "||n===" "){let a=r,o=t[r+1];for(;o===" "||o===" ";)o=t[++r+1];o!==`
|
|
96
|
+
`&&!(o==="\r"&&t[r+2]===`
|
|
97
|
+
`)&&(i+=r>a?t.slice(a,r+1):n)}else i+=n}return(t[t.length-1]!=='"'||t.length===1)&&e(t.length,"MISSING_CHAR",'Missing closing "quote'),i}function zh(t,e){let i="",r=t[e+1];for(;(r===" "||r===" "||r===`
|
|
98
|
+
`||r==="\r")&&!(r==="\r"&&t[e+2]!==`
|
|
99
|
+
`);)r===`
|
|
100
100
|
`&&(i+=`
|
|
101
|
-
`),e+=1,
|
|
102
|
-
`,r:"\r",t:" ",v:"\v",N:"
",_:" ",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function
|
|
101
|
+
`),e+=1,r=t[e+1];return i||(i=" "),{fold:i,offset:e}}var Jh={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
|
|
102
|
+
`,r:"\r",t:" ",v:"\v",N:"
",_:" ",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function Gh(t,e,i,r){let n=t.substr(e,i),o=n.length===i&&/^[0-9a-fA-F]+$/.test(n)?parseInt(n,16):NaN;try{return String.fromCodePoint(o)}catch{let s=t.substr(e-2,i+2);return r(e-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${s}`),s}}yc.resolveFlowScalar=Fh});var kc=w(bc=>{"use strict";var qe=P(),Nc=T(),Uh=sa(),Kh=la();function Yh(t,e,i,r){let{value:n,type:a,comment:o,range:s}=e.type==="block-scalar"?Uh.resolveBlockScalar(t,e,r):Kh.resolveFlowScalar(e,t.options.strict,r),c=i?t.directives.tagName(i.source,u=>r(i,"TAG_RESOLVE_FAILED",u)):null,l;t.options.stringKeys&&t.atKey?l=t.schema[qe.SCALAR]:c?l=Xh(t.schema,n,c,i,r):e.type==="scalar"?l=Qh(t,n,e,r):l=t.schema[qe.SCALAR];let d;try{let u=l.resolve(n,f=>r(i??e,"TAG_RESOLVE_FAILED",f),t.options);d=qe.isScalar(u)?u:new Nc.Scalar(u)}catch(u){let f=u instanceof Error?u.message:String(u);r(i??e,"TAG_RESOLVE_FAILED",f),d=new Nc.Scalar(n)}return d.range=s,d.source=n,a&&(d.type=a),c&&(d.tag=c),l.format&&(d.format=l.format),o&&(d.comment=o),d}function Xh(t,e,i,r,n){if(i==="!")return t[qe.SCALAR];let a=[];for(let s of t.tags)if(!s.collection&&s.tag===i)if(s.default&&s.test)a.push(s);else return s;for(let s of a)if(s.test?.test(e))return s;let o=t.knownTags[i];return o&&!o.collection?(t.tags.push(Object.assign({},o,{default:!1,test:void 0})),o):(n(r,"TAG_RESOLVE_FAILED",`Unresolved tag: ${i}`,i!=="tag:yaml.org,2002:str"),t[qe.SCALAR])}function Qh({atKey:t,directives:e,schema:i},r,n,a){let o=i.tags.find(s=>(s.default===!0||t&&s.default==="key")&&s.test?.test(r))||i[qe.SCALAR];if(i.compat){let s=i.compat.find(c=>c.default&&c.test?.test(r))??i[qe.SCALAR];if(o.tag!==s.tag){let c=e.tagString(o.tag),l=e.tagString(s.tag),d=`Value may be parsed as either ${c} or ${l}`;a(n,"TAG_RESOLVE_FAILED",d,!0)}}return o}bc.composeScalar=Yh});var Ec=w(Sc=>{"use strict";function Zh(t,e,i){if(e){i??(i=e.length);for(let r=i-1;r>=0;--r){let n=e[r];switch(n.type){case"space":case"comment":case"newline":t-=n.source.length;continue}for(n=e[++r];n?.type==="space";)t+=n.source.length,n=e[++r];break}}return t}Sc.emptyScalarPosition=Zh});var Cc=w(da=>{"use strict";var ep=Ct(),tp=P(),ip=vc(),Pc=kc(),rp=dt(),np=Ec(),ap={composeNode:xc,composeEmptyNode:ua};function xc(t,e,i,r){let n=t.atKey,{spaceBefore:a,comment:o,anchor:s,tag:c}=i,l,d=!0;switch(e.type){case"alias":l=op(t,e,r),(s||c)&&r(e,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":l=Pc.composeScalar(t,e,c,r),s&&(l.anchor=s.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{l=ip.composeCollection(ap,t,e,i,r),s&&(l.anchor=s.source.substring(1))}catch(u){let f=u instanceof Error?u.message:String(u);r(e,"RESOURCE_EXHAUSTION",f)}break;default:{let u=e.type==="error"?e.message:`Unsupported token (type: ${e.type})`;r(e,"UNEXPECTED_TOKEN",u),d=!1}}return l??(l=ua(t,e.offset,void 0,null,i,r)),s&&l.anchor===""&&r(s,"BAD_ALIAS","Anchor cannot be an empty string"),n&&t.options.stringKeys&&(!tp.isScalar(l)||typeof l.value!="string"||l.tag&&l.tag!=="tag:yaml.org,2002:str")&&r(c??e,"NON_STRING_KEY","With stringKeys, all keys must be strings"),a&&(l.spaceBefore=!0),o&&(e.type==="scalar"&&e.source===""?l.comment=o:l.commentBefore=o),t.options.keepSourceTokens&&d&&(l.srcToken=e),l}function ua(t,e,i,r,{spaceBefore:n,comment:a,anchor:o,tag:s,end:c},l){let d={type:"scalar",offset:np.emptyScalarPosition(e,i,r),indent:-1,source:""},u=Pc.composeScalar(t,d,s,l);return o&&(u.anchor=o.source.substring(1),u.anchor===""&&l(o,"BAD_ALIAS","Anchor cannot be an empty string")),n&&(u.spaceBefore=!0),a&&(u.comment=a,u.range[2]=c),u}function op({options:t},{offset:e,source:i,end:r},n){let a=new ep.Alias(i.substring(1));a.source===""&&n(e,"BAD_ALIAS","Alias cannot be an empty string"),a.source.endsWith(":")&&n(e+i.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let o=e+i.length,s=rp.resolveEnd(r,o,t.strict,n);return a.range=[e,o,s.offset],s.comment&&(a.comment=s.comment),a}da.composeEmptyNode=ua;da.composeNode=xc});var _c=w(Ac=>{"use strict";var sp=qt(),Rc=Cc(),cp=dt(),lp=Gt();function up(t,e,{offset:i,start:r,value:n,end:a},o){let s=Object.assign({_directives:e},t),c=new sp.Document(void 0,s),l={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},d=lp.resolveProps(r,{indicator:"doc-start",next:n??a?.[0],offset:i,onError:o,parentIndent:0,startOnNewline:!0});d.found&&(c.directives.docStart=!0,n&&(n.type==="block-map"||n.type==="block-seq")&&!d.hasNewline&&o(d.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),c.contents=n?Rc.composeNode(l,n,d,o):Rc.composeEmptyNode(l,d.end,r,null,d,o);let u=c.contents.range[2],f=cp.resolveEnd(a,u,!1,o);return f.comment&&(c.comment=f.comment),c.range=[i,u,f.offset],c}Ac.composeDoc=up});var ha=w(jc=>{"use strict";var dp=pi("process"),fp=Xr(),hp=qt(),Ut=Jt(),Tc=P(),pp=_c(),mp=dt();function Kt(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:i}=t;return[e,e+(typeof i=="string"?i.length:1)]}function Ic(t){let e="",i=!1,r=!1;for(let n=0;n<t.length;++n){let a=t[n];switch(a[0]){case"#":e+=(e===""?"":r?`
|
|
103
103
|
|
|
104
104
|
`:`
|
|
105
|
-
`)+(a.substring(1)||" "),i=!0,
|
|
106
|
-
${
|
|
107
|
-
${s}`:
|
|
108
|
-
${o}`:
|
|
109
|
-
${i.comment}`:i.comment}this.doc.range[2]=i.offset;break}default:this.errors.push(new
|
|
105
|
+
`)+(a.substring(1)||" "),i=!0,r=!1;break;case"%":t[n+1]?.[0]!=="#"&&(n+=1),i=!1;break;default:i||(r=!0),i=!1}}return{comment:e,afterEmptyLine:r}}var fa=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(i,r,n,a)=>{let o=Kt(i);a?this.warnings.push(new Ut.YAMLWarning(o,r,n)):this.errors.push(new Ut.YAMLParseError(o,r,n))},this.directives=new fp.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,i){let{comment:r,afterEmptyLine:n}=Ic(this.prelude);if(r){let a=e.contents;if(i)e.comment=e.comment?`${e.comment}
|
|
106
|
+
${r}`:r;else if(n||e.directives.docStart||!a)e.commentBefore=r;else if(Tc.isCollection(a)&&!a.flow&&a.items.length>0){let o=a.items[0];Tc.isPair(o)&&(o=o.key);let s=o.commentBefore;o.commentBefore=s?`${r}
|
|
107
|
+
${s}`:r}else{let o=a.commentBefore;a.commentBefore=o?`${r}
|
|
108
|
+
${o}`:r}}if(i){for(let a=0;a<this.errors.length;++a)e.errors.push(this.errors[a]);for(let a=0;a<this.warnings.length;++a)e.warnings.push(this.warnings[a])}else e.errors=this.errors,e.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:Ic(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,i=!1,r=-1){for(let n of e)yield*this.next(n);yield*this.end(i,r)}*next(e){switch(dp.env.LOG_STREAM&&console.dir(e,{depth:null}),e.type){case"directive":this.directives.add(e.source,(i,r,n)=>{let a=Kt(e);a[0]+=i,this.onError(a,"BAD_DIRECTIVE",r,n)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let i=pp.composeDoc(this.options,this.directives,e,this.onError);this.atDirectives&&!i.directives.docStart&&this.onError(e,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(i,!1),this.doc&&(yield this.doc),this.doc=i,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(e.source);break;case"error":{let i=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,r=new Ut.YAMLParseError(Kt(e),"UNEXPECTED_TOKEN",i);this.atDirectives||!this.doc?this.errors.push(r):this.doc.errors.push(r);break}case"doc-end":{if(!this.doc){let r="Unexpected doc-end without preceding document";this.errors.push(new Ut.YAMLParseError(Kt(e),"UNEXPECTED_TOKEN",r));break}this.doc.directives.docEnd=!0;let i=mp.resolveEnd(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),i.comment){let r=this.doc.comment;this.doc.comment=r?`${r}
|
|
109
|
+
${i.comment}`:i.comment}this.doc.range[2]=i.offset;break}default:this.errors.push(new Ut.YAMLParseError(Kt(e),"UNEXPECTED_TOKEN",`Unsupported token ${e.type}`))}}*end(e=!1,i=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let r=Object.assign({_directives:this.directives},this.options),n=new hp.Document(void 0,r);this.atDirectives&&this.onError(i,"MISSING_CHAR","Missing directives-end indicator line"),n.range=[0,i,i],this.decorate(n,!1),yield n}}};jc.Composer=fa});var Hc=w(or=>{"use strict";var vp=sa(),gp=la(),wp=Jt(),$c=It();function yp(t,e=!0,i){if(t){let r=(n,a,o)=>{let s=typeof n=="number"?n:Array.isArray(n)?n[0]:n.offset;if(i)i(s,a,o);else throw new wp.YAMLParseError([s,s+1],a,o)};switch(t.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return gp.resolveFlowScalar(t,e,r);case"block-scalar":return vp.resolveBlockScalar({options:{strict:e}},t,r)}}return null}function Np(t,e){let{implicitKey:i=!1,indent:r,inFlow:n=!1,offset:a=-1,type:o="PLAIN"}=e,s=$c.stringifyString({type:o,value:t},{implicitKey:i,indent:r>0?" ".repeat(r):"",inFlow:n,options:{blockQuote:!0,lineWidth:-1}}),c=e.end??[{type:"newline",offset:-1,indent:r,source:`
|
|
110
110
|
`}];switch(s[0]){case"|":case">":{let l=s.indexOf(`
|
|
111
111
|
`),d=s.substring(0,l),u=s.substring(l+1)+`
|
|
112
|
-
`,f=[{type:"block-scalar-header",offset:a,indent:
|
|
113
|
-
`}),{type:"block-scalar",offset:a,indent:
|
|
114
|
-
`),
|
|
115
|
-
`;if(t.type==="block-scalar"){let a=t.props[0];if(a.type!=="block-scalar-header")throw new Error("Invalid block scalar header");a.source=
|
|
116
|
-
`});for(let c of Object.keys(t))c!=="type"&&c!=="offset"&&delete t[c];Object.assign(t,{type:"block-scalar",indent:o,props:s,source:
|
|
117
|
-
`};delete t.items,Object.assign(t,{type:i,source:e,end:[
|
|
112
|
+
`,f=[{type:"block-scalar-header",offset:a,indent:r,source:d}];return Oc(f,c)||f.push({type:"newline",offset:-1,indent:r,source:`
|
|
113
|
+
`}),{type:"block-scalar",offset:a,indent:r,props:f,source:u}}case'"':return{type:"double-quoted-scalar",offset:a,indent:r,source:s,end:c};case"'":return{type:"single-quoted-scalar",offset:a,indent:r,source:s,end:c};default:return{type:"scalar",offset:a,indent:r,source:s,end:c}}}function bp(t,e,i={}){let{afterKey:r=!1,implicitKey:n=!1,inFlow:a=!1,type:o}=i,s="indent"in t?t.indent:null;if(r&&typeof s=="number"&&(s+=2),!o)switch(t.type){case"single-quoted-scalar":o="QUOTE_SINGLE";break;case"double-quoted-scalar":o="QUOTE_DOUBLE";break;case"block-scalar":{let l=t.props[0];if(l.type!=="block-scalar-header")throw new Error("Invalid block scalar header");o=l.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:o="PLAIN"}let c=$c.stringifyString({type:o,value:e},{implicitKey:n||s===null,indent:s!==null&&s>0?" ".repeat(s):"",inFlow:a,options:{blockQuote:!0,lineWidth:-1}});switch(c[0]){case"|":case">":kp(t,c);break;case'"':pa(t,c,"double-quoted-scalar");break;case"'":pa(t,c,"single-quoted-scalar");break;default:pa(t,c,"scalar")}}function kp(t,e){let i=e.indexOf(`
|
|
114
|
+
`),r=e.substring(0,i),n=e.substring(i+1)+`
|
|
115
|
+
`;if(t.type==="block-scalar"){let a=t.props[0];if(a.type!=="block-scalar-header")throw new Error("Invalid block scalar header");a.source=r,t.source=n}else{let{offset:a}=t,o="indent"in t?t.indent:-1,s=[{type:"block-scalar-header",offset:a,indent:o,source:r}];Oc(s,"end"in t?t.end:void 0)||s.push({type:"newline",offset:-1,indent:o,source:`
|
|
116
|
+
`});for(let c of Object.keys(t))c!=="type"&&c!=="offset"&&delete t[c];Object.assign(t,{type:"block-scalar",indent:o,props:s,source:n})}}function Oc(t,e){if(e)for(let i of e)switch(i.type){case"space":case"comment":t.push(i);break;case"newline":return t.push(i),!0}return!1}function pa(t,e,i){switch(t.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":t.type=i,t.source=e;break;case"block-scalar":{let r=t.props.slice(1),n=e.length;t.props[0].type==="block-scalar-header"&&(n-=t.props[0].source.length);for(let a of r)a.offset+=n;delete t.props,Object.assign(t,{type:i,source:e,end:r});break}case"block-map":case"block-seq":{let n={type:"newline",offset:t.offset+e.length,indent:t.indent,source:`
|
|
117
|
+
`};delete t.items,Object.assign(t,{type:i,source:e,end:[n]});break}default:{let r="indent"in t?t.indent:-1,n="end"in t&&Array.isArray(t.end)?t.end.filter(a=>a.type==="space"||a.type==="comment"||a.type==="newline"):[];for(let a of Object.keys(t))a!=="type"&&a!=="offset"&&delete t[a];Object.assign(t,{type:i,indent:r,source:e,end:n})}}}or.createScalarToken=Np;or.resolveAsScalar=yp;or.setScalarValue=bp});var Bc=w(Dc=>{"use strict";var Sp=t=>"type"in t?cr(t):sr(t);function cr(t){switch(t.type){case"block-scalar":{let e="";for(let i of t.props)e+=cr(i);return e+t.source}case"block-map":case"block-seq":{let e="";for(let i of t.items)e+=sr(i);return e}case"flow-collection":{let e=t.start.source;for(let i of t.items)e+=sr(i);for(let i of t.end)e+=i.source;return e}case"document":{let e=sr(t);if(t.end)for(let i of t.end)e+=i.source;return e}default:{let e=t.source;if("end"in t&&t.end)for(let i of t.end)e+=i.source;return e}}}function sr({start:t,key:e,sep:i,value:r}){let n="";for(let a of t)n+=a.source;if(e&&(n+=cr(e)),i)for(let a of i)n+=a.source;return r&&(n+=cr(r)),n}Dc.stringify=Sp});var Vc=w(Fc=>{"use strict";var ma=Symbol("break visit"),Ep=Symbol("skip children"),Lc=Symbol("remove item");function We(t,e){"type"in t&&t.type==="document"&&(t={start:t.start,value:t.value}),Mc(Object.freeze([]),t,e)}We.BREAK=ma;We.SKIP=Ep;We.REMOVE=Lc;We.itemAtPath=(t,e)=>{let i=t;for(let[r,n]of e){let a=i?.[r];if(a&&"items"in a)i=a.items[n];else return}return i};We.parentCollection=(t,e)=>{let i=We.itemAtPath(t,e.slice(0,-1)),r=e[e.length-1][0],n=i?.[r];if(n&&"items"in n)return n;throw new Error("Parent collection not found")};function Mc(t,e,i){let r=i(e,t);if(typeof r=="symbol")return r;for(let n of["key","value"]){let a=e[n];if(a&&"items"in a){for(let o=0;o<a.items.length;++o){let s=Mc(Object.freeze(t.concat([[n,o]])),a.items[o],i);if(typeof s=="number")o=s-1;else{if(s===ma)return ma;s===Lc&&(a.items.splice(o,1),o-=1)}}typeof r=="function"&&n==="key"&&(r=r(e,t))}}return typeof r=="function"?r(e,t):r}Fc.visit=We});var lr=w(V=>{"use strict";var va=Hc(),Pp=Bc(),xp=Vc(),ga="\uFEFF",wa="",ya="",Na="",Cp=t=>!!t&&"items"in t,Rp=t=>!!t&&(t.type==="scalar"||t.type==="single-quoted-scalar"||t.type==="double-quoted-scalar"||t.type==="block-scalar");function Ap(t){switch(t){case ga:return"<BOM>";case wa:return"<DOC>";case ya:return"<FLOW_END>";case Na:return"<SCALAR>";default:return JSON.stringify(t)}}function _p(t){switch(t){case ga:return"byte-order-mark";case wa:return"doc-mode";case ya:return"flow-error-end";case Na: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}V.createScalarToken=va.createScalarToken;V.resolveAsScalar=va.resolveAsScalar;V.setScalarValue=va.setScalarValue;V.stringify=Pp.stringify;V.visit=xp.visit;V.BOM=ga;V.DOCUMENT=wa;V.FLOW_END=ya;V.SCALAR=Na;V.isCollection=Cp;V.isScalar=Rp;V.prettyToken=Ap;V.tokenType=_p});var Sa=w(Wc=>{"use strict";var Yt=lr();function te(t){switch(t){case void 0:case" ":case`
|
|
120
|
+
`:case"\r":case" ":return!0;default:return!1}}var qc=new Set("0123456789ABCDEFabcdef"),Tp=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),ur=new Set(",[]{}"),Ip=new Set(` ,[]{}
|
|
121
|
+
\r `),ba=t=>!t||Ip.has(t),ka=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,i=!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=!i;let r=this.next??"stream";for(;r&&(i||this.hasChars(1));)r=yield*this.parseNext(r)}atLineEnd(){let e=this.pos,i=this.buffer[e];for(;i===" "||i===" ";)i=this.buffer[++e];return!i||i==="#"||i===`
|
|
122
122
|
`?!0:i==="\r"?this.buffer[e+1]===`
|
|
123
|
-
`:!1}charAt(e){return this.buffer[this.pos+e]}continueScalar(e){let i=this.buffer[e];if(this.indentNext>0){let
|
|
124
|
-
`||!
|
|
125
|
-
`||
|
|
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]===
|
|
127
|
-
`,this.pos);if(
|
|
128
|
-
`,a)}
|
|
123
|
+
`:!1}charAt(e){return this.buffer[this.pos+e]}continueScalar(e){let i=this.buffer[e];if(this.indentNext>0){let r=0;for(;i===" ";)i=this.buffer[++r+e];if(i==="\r"){let n=this.buffer[r+e+1];if(n===`
|
|
124
|
+
`||!n&&!this.atEnd)return e+r+1}return i===`
|
|
125
|
+
`||r>=this.indentNext||!i&&!this.atEnd?e+r:-1}if(i==="-"||i==="."){let r=this.buffer.substr(e,3);if((r==="---"||r==="...")&&te(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]===Yt.BOM&&(yield*this.pushCount(1),e=e.substring(1)),e[0]==="%"){let i=e.length,r=e.indexOf("#");for(;r!==-1;){let a=e[r-1];if(a===" "||a===" "){i=r-1;break}else r=e.indexOf("#",r+1)}for(;;){let a=e[i-1];if(a===" "||a===" ")i-=1;else break}let n=(yield*this.pushCount(i))+(yield*this.pushSpaces(!0));return yield*this.pushCount(e.length-n),this.pushNewline(),"stream"}if(this.atLineEnd()){let i=yield*this.pushSpaces(!0);return yield*this.pushCount(e.length-i),yield*this.pushNewline(),"stream"}return yield Yt.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 i=this.peek(3);if((i==="---"||i==="...")&&te(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,i==="---"?"doc":"stream"}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!te(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[e,i]=this.peek(2);if(!i&&!this.atEnd)return this.setNext("block-start");if((e==="-"||e==="?"||e===":")&&te(i)){let r=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=r,"block-start"}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let e=this.getLine();if(e===null)return this.setNext("doc");let i=yield*this.pushIndicators();switch(e[i]){case"#":yield*this.pushCount(e.length-i);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(ba),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return i+=yield*this.parseBlockScalarHeader(),i+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-i),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,i,r=-1;do e=yield*this.pushNewline(),e>0?(i=yield*this.pushSpaces(!1),this.indentValue=r=i):i=0,i+=yield*this.pushSpaces(!0);while(e+i>0);let n=this.getLine();if(n===null)return this.setNext("flow");if((r!==-1&&r<this.indentNext&&n[0]!=="#"||r===0&&(n.startsWith("---")||n.startsWith("..."))&&te(n[3]))&&!(r===this.indentNext-1&&this.flowLevel===1&&(n[0]==="]"||n[0]==="}")))return this.flowLevel=0,yield Yt.FLOW_END,yield*this.parseLineStart();let a=0;for(;n[a]===",";)a+=yield*this.pushCount(1),a+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(a+=yield*this.pushIndicators(),n[a]){case void 0:return"flow";case"#":return yield*this.pushCount(n.length-a),"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(ba),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let o=this.charAt(1);if(this.flowKey||te(o)||o===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let e=this.charAt(0),i=this.buffer.indexOf(e,this.pos+1);if(e==="'")for(;i!==-1&&this.buffer[i+1]==="'";)i=this.buffer.indexOf("'",i+2);else for(;i!==-1;){let a=0;for(;this.buffer[i-1-a]==="\\";)a+=1;if(a%2===0)break;i=this.buffer.indexOf('"',i+1)}let r=this.buffer.substring(0,i),n=r.indexOf(`
|
|
127
|
+
`,this.pos);if(n!==-1){for(;n!==-1;){let a=this.continueScalar(n+1);if(a===-1)break;n=r.indexOf(`
|
|
128
|
+
`,a)}n!==-1&&(i=n-(r[n-1]==="\r"?2:1))}if(i===-1){if(!this.atEnd)return this.setNext("quoted-scalar");i=this.buffer.length}return yield*this.pushToIndex(i+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let e=this.pos;for(;;){let i=this.buffer[++e];if(i==="+")this.blockScalarKeep=!0;else if(i>"0"&&i<="9")this.blockScalarIndent=Number(i)-1;else if(i!=="-")break}return yield*this.pushUntil(i=>te(i)||i==="#")}*parseBlockScalar(){let e=this.pos-1,i=0,r;e:for(let a=this.pos;r=this.buffer[a];++a)switch(r){case" ":i+=1;break;case`
|
|
129
129
|
`:e=a,i=0;break;case"\r":{let o=this.buffer[a+1];if(!o&&!this.atEnd)return this.setNext("block-scalar");if(o===`
|
|
130
|
-
`)break}default:break e}if(!
|
|
131
|
-
`,a)}while(e!==-1);if(e===-1){if(!this.atEnd)return this.setNext("block-scalar");e=this.buffer.length}}let
|
|
132
|
-
`;)
|
|
133
|
-
`&&a>=this.pos&&a+1+i>s)e=a;else break}while(!0);return yield
|
|
134
|
-
`?(
|
|
135
|
-
`,a=this.buffer[
|
|
136
|
-
`){let o=this.continueScalar(
|
|
130
|
+
`)break}default:break e}if(!r&&!this.atEnd)return this.setNext("block-scalar");if(i>=this.indentNext){this.blockScalarIndent===-1?this.indentNext=i:this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{let a=this.continueScalar(e+1);if(a===-1)break;e=this.buffer.indexOf(`
|
|
131
|
+
`,a)}while(e!==-1);if(e===-1){if(!this.atEnd)return this.setNext("block-scalar");e=this.buffer.length}}let n=e+1;for(r=this.buffer[n];r===" ";)r=this.buffer[++n];if(r===" "){for(;r===" "||r===" "||r==="\r"||r===`
|
|
132
|
+
`;)r=this.buffer[++n];e=n-1}else if(!this.blockScalarKeep)do{let a=e-1,o=this.buffer[a];o==="\r"&&(o=this.buffer[--a]);let s=a;for(;o===" ";)o=this.buffer[--a];if(o===`
|
|
133
|
+
`&&a>=this.pos&&a+1+i>s)e=a;else break}while(!0);return yield Yt.SCALAR,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,i=this.pos-1,r=this.pos-1,n;for(;n=this.buffer[++r];)if(n===":"){let a=this.buffer[r+1];if(te(a)||e&&ur.has(a))break;i=r}else if(te(n)){let a=this.buffer[r+1];if(n==="\r"&&(a===`
|
|
134
|
+
`?(r+=1,n=`
|
|
135
|
+
`,a=this.buffer[r+1]):i=r),a==="#"||e&&ur.has(a))break;if(n===`
|
|
136
|
+
`){let o=this.continueScalar(r+1);if(o===-1)break;r=Math.max(r,o-2)}}else{if(e&&ur.has(n))break;i=r}return!n&&!this.atEnd?this.setNext("plain-scalar"):(yield Yt.SCALAR,yield*this.pushToIndex(i+1,!0),e?"flow":"doc")}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,i){let r=this.buffer.slice(this.pos,e);return r?(yield r,this.pos+=r.length,r.length):(i&&(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(ba),e+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let i=this.flowLevel>0,r=this.charAt(1);if(te(r)||i&&ur.has(r)){i?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,i=this.buffer[e];for(;!te(i)&&i!==">";)i=this.buffer[++e];return yield*this.pushToIndex(i===">"?e+1:e,!1)}else{let e=this.pos+1,i=this.buffer[e];for(;i;)if(Tp.has(i))i=this.buffer[++e];else if(i==="%"&&qc.has(this.buffer[e+1])&&qc.has(this.buffer[e+2]))i=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 i=this.pos-1,
|
|
138
|
+
`?yield*this.pushCount(2):0}*pushSpaces(e){let i=this.pos-1,r;do r=this.buffer[++i];while(r===" "||e&&r===" ");let n=i-this.pos;return n>0&&(yield this.buffer.substr(this.pos,n),this.pos=i),n}*pushUntil(e){let i=this.pos,r=this.buffer[i];for(;!e(r);)r=this.buffer[++i];return yield*this.pushToIndex(i,!1)}};Wc.Lexer=ka});var Pa=w(zc=>{"use strict";var Ea=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let i=0,r=this.lineStarts.length;for(;i<r;){let a=i+r>>1;this.lineStarts[a]<e?i=a+1:r=a}if(this.lineStarts[i]===e)return{line:i+1,col:1};if(i===0)return{line:0,col:e};let n=this.lineStarts[i-1];return{line:i,col:e-n+1}}}};zc.LineCounter=Ea});var Ca=w(Yc=>{"use strict";var jp=pi("process"),Jc=lr(),$p=Sa();function xe(t,e){for(let i=0;i<t.length;++i)if(t[i].type===e)return!0;return!1}function Gc(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 Kc(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 dr(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 ft(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 fr(t,e){if(e.length<1e5)Array.prototype.push.apply(t,e);else for(let i=0;i<e.length;++i)t.push(e[i])}function Uc(t){if(t.start.type==="flow-seq-start")for(let e of t.items)e.sep&&!e.value&&!xe(e.start,"explicit-key-ind")&&!xe(e.sep,"map-value-ind")&&(e.key&&(e.value=e.key),delete e.key,Kc(e.value)?e.value.end?fr(e.value.end,e.sep):e.value.end=e.sep:fr(e.start,e.sep),delete e.sep)}var xa=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 $p.Lexer,this.onNewLine=e}*parse(e,i=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let r of this.lexer.lex(e,i))yield*this.next(r);i||(yield*this.end())}*next(e){if(this.source=e,jp.env.LOG_TOKENS&&console.log("|",Jc.prettyToken(e)),this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}let i=Jc.tokenType(e);if(i)if(i==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=i,yield*this.step(),i){case"newline":this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+e.length);break;case"space":this.atNewLine&&e[0]===" "&&(this.indent+=e.length);break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":this.atNewLine&&(this.indent+=e.length);break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=e.length}else{let r=`Not a YAML token: ${e}`;yield*this.pop({type:"error",offset:this.offset,message:r,source:e}),this.offset+=e.length}}*end(){for(;this.stack.length>0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let e=this.peek(1);if(this.type==="doc-end"&&e?.type!=="doc-end"){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!e)return yield*this.stream();switch(e.type){case"document":return yield*this.document(e);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(e);case"block-scalar":return yield*this.blockScalar(e);case"block-map":return yield*this.blockMap(e);case"block-seq":return yield*this.blockSequence(e);case"flow-collection":return yield*this.flowCollection(e);case"doc-end":return yield*this.documentEnd(e)}yield*this.pop()}peek(e){return this.stack[this.stack.length-e]}*pop(e){let i=e??this.stack.pop();if(!i)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield i;else{let r=this.peek(1);switch(i.type==="block-scalar"?i.indent="indent"in r?r.indent:0:i.type==="flow-collection"&&r.type==="document"&&(i.indent=0),i.type==="flow-collection"&&Uc(i),r.type){case"document":r.value=i;break;case"block-scalar":r.props.push(i);break;case"block-map":{let n=r.items[r.items.length-1];if(n.value){r.items.push({start:[],key:i,sep:[]}),this.onKeyLine=!0;return}else if(n.sep)n.value=i;else{Object.assign(n,{key:i,sep:[]}),this.onKeyLine=!n.explicitKey;return}break}case"block-seq":{let n=r.items[r.items.length-1];n.value?r.items.push({start:[],value:i}):n.value=i;break}case"flow-collection":{let n=r.items[r.items.length-1];!n||n.value?r.items.push({start:[],key:i,sep:[]}):n.sep?n.value=i:Object.assign(n,{key:i,sep:[]});return}default:yield*this.pop(),yield*this.pop(i)}if((r.type==="document"||r.type==="block-map"||r.type==="block-seq")&&(i.type==="block-map"||i.type==="block-seq")){let n=i.items[i.items.length-1];n&&!n.sep&&!n.value&&n.start.length>0&&Gc(n.start)===-1&&(i.indent===0||n.start.every(a=>a.type!=="comment"||a.indent<i.indent))&&(r.type==="document"?r.end=n.start:r.items.push({start:n.start}),i.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":{Gc(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 i=this.startBlockValue(e);i?this.stack.push(i):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 i=dr(this.peek(2)),r=ft(i),n;e.end?(n=e.end,n.push(this.sourceToken),delete e.end):n=[this.sourceToken];let a={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:r,key:e,sep:n}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=a}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 i=this.source.indexOf(`
|
|
139
139
|
`)+1;for(;i!==0;)this.onNewLine(this.offset+i),i=this.source.indexOf(`
|
|
140
|
-
`,i)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let i=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,i.value){let
|
|
140
|
+
`,i)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let i=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,i.value){let r="end"in i.value?i.value.end:void 0;(Array.isArray(r)?r[r.length-1]:void 0)?.type==="comment"?r?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else i.sep?i.sep.push(this.sourceToken):i.start.push(this.sourceToken);return;case"space":case"comment":if(i.value)e.items.push({start:[this.sourceToken]});else if(i.sep)i.sep.push(this.sourceToken);else{if(this.atIndentedComment(i.start,e.indent)){let n=e.items[e.items.length-2]?.value?.end;if(Array.isArray(n)){fr(n,i.start),n.push(this.sourceToken),e.items.pop();return}}i.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let r=!this.onKeyLine&&this.indent===e.indent,n=r&&(i.sep||i.explicitKey)&&this.type!=="seq-item-ind",a=[];if(n&&i.sep&&!i.value){let o=[];for(let s=0;s<i.sep.length;++s){let c=i.sep[s];switch(c.type){case"newline":o.push(s);break;case"space":break;case"comment":c.indent>e.indent&&(o.length=0);break;default:o.length=0}}o.length>=2&&(a=i.sep.splice(o[1]))}switch(this.type){case"anchor":case"tag":n||i.value?(a.push(this.sourceToken),e.items.push({start:a}),this.onKeyLine=!0):i.sep?i.sep.push(this.sourceToken):i.start.push(this.sourceToken);return;case"explicit-key-ind":!i.sep&&!i.explicitKey?(i.start.push(this.sourceToken),i.explicitKey=!0):n||i.value?(a.push(this.sourceToken),e.items.push({start:a,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(i.explicitKey)if(i.sep)if(i.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(xe(i.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:a,key:null,sep:[this.sourceToken]}]});else if(Kc(i.key)&&!xe(i.sep,"newline")){let o=ft(i.start),s=i.key,c=i.sep;c.push(this.sourceToken),delete i.key,delete i.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:s,sep:c}]})}else a.length>0?i.sep=i.sep.concat(a,this.sourceToken):i.sep.push(this.sourceToken);else if(xe(i.start,"newline"))Object.assign(i,{key:null,sep:[this.sourceToken]});else{let o=ft(i.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]})}else i.sep?i.value||n?e.items.push({start:a,key:null,sep:[this.sourceToken]}):xe(i.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):i.sep.push(this.sourceToken):Object.assign(i,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let o=this.flowScalar(this.type);n||i.value?(e.items.push({start:a,key:o,sep:[]}),this.onKeyLine=!0):i.sep?this.stack.push(o):(Object.assign(i,{key:o,sep:[]}),this.onKeyLine=!0);return}default:{let o=this.startBlockValue(e);if(o){if(o.type==="block-seq"){if(!i.explicitKey&&i.sep&&!xe(i.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else r&&e.items.push({start:a});this.stack.push(o);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let i=e.items[e.items.length-1];switch(this.type){case"newline":if(i.value){let r="end"in i.value?i.value.end:void 0;(Array.isArray(r)?r[r.length-1]:void 0)?.type==="comment"?r?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else i.start.push(this.sourceToken);return;case"space":case"comment":if(i.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(i.start,e.indent)){let n=e.items[e.items.length-2]?.value?.end;if(Array.isArray(n)){fr(n,i.start),n.push(this.sourceToken),e.items.pop();return}}i.start.push(this.sourceToken)}return;case"anchor":case"tag":if(i.value||this.indent<=e.indent)break;i.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;i.value||xe(i.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):i.start.push(this.sourceToken);return}if(this.indent>e.indent){let r=this.startBlockValue(e);if(r){this.stack.push(r);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let i=e.items[e.items.length-1];if(this.type==="flow-error-end"){let r;do yield*this.pop(),r=this.peek(1);while(r?.type==="flow-collection")}else if(e.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!i||i.sep?e.items.push({start:[this.sourceToken]}):i.start.push(this.sourceToken);return;case"map-value-ind":!i||i.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):i.sep?i.sep.push(this.sourceToken):Object.assign(i,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!i||i.value?e.items.push({start:[this.sourceToken]}):i.sep?i.sep.push(this.sourceToken):i.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let n=this.flowScalar(this.type);!i||i.value?e.items.push({start:[],key:n,sep:[]}):i.sep?this.stack.push(n):Object.assign(i,{key:n,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}let r=this.startBlockValue(e);r?this.stack.push(r):(yield*this.pop(),yield*this.step())}else{let r=this.peek(2);if(r.type==="block-map"&&(this.type==="map-value-ind"&&r.indent===e.indent||this.type==="newline"&&!r.items[r.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&r.type!=="flow-collection"){let n=dr(r),a=ft(n);Uc(e);let o=e.end.splice(1,e.end.length);o.push(this.sourceToken);let s={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:a,key:e,sep:o}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=s}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let i=this.source.indexOf(`
|
|
141
141
|
`)+1;for(;i!==0;)this.onNewLine(this.offset+i),i=this.source.indexOf(`
|
|
142
|
-
`,i)+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 i=Ji(e),n=Qe(i);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 i=Ji(e),n=Qe(i);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,i){return this.type!=="comment"||this.indent<=i?!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())}}};Nc.Parser=na});var Cc=w(Ot=>{"use strict";var bc=Wr(),Gh=Et(),_t=Pt(),Kh=qn(),Uh=C(),Yh=ia(),kc=ra();function Sc(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new Yh.LineCounter||null,prettyErrors:e}}function Xh(t,e={}){let{lineCounter:i,prettyErrors:n}=Sc(e),r=new kc.Parser(i?.addNewLine),a=new bc.Composer(e),o=Array.from(a.compose(r.parse(t)));if(n&&i)for(let s of o)s.errors.forEach(_t.prettifyError(t,i)),s.warnings.forEach(_t.prettifyError(t,i));return o.length>0?o:Object.assign([],{empty:!0},a.streamInfo())}function Ec(t,e={}){let{lineCounter:i,prettyErrors:n}=Sc(e),r=new kc.Parser(i?.addNewLine),a=new bc.Composer(e),o=null;for(let s of a.compose(r.parse(t),!0,t.length))if(!o)o=s;else if(o.options.logLevel!=="silent"){o.errors.push(new _t.YAMLParseError(s.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return n&&i&&(o.errors.forEach(_t.prettifyError(t,i)),o.warnings.forEach(_t.prettifyError(t,i))),o}function Qh(t,e,i){let n;typeof e=="function"?n=e:i===void 0&&e&&typeof e=="object"&&(i=e);let r=Ec(t,i);if(!r)return null;if(r.warnings.forEach(a=>Kh.warn(r.options.logLevel,a)),r.errors.length>0){if(r.options.logLevel!=="silent")throw r.errors[0];r.errors=[]}return r.toJS(Object.assign({reviver:n},i))}function Zh(t,e,i){let n=null;if(typeof e=="function"||Array.isArray(e)?n=e:i===void 0&&e&&(i=e),typeof i=="string"&&(i=i.length),typeof i=="number"){let r=Math.round(i);i=r<1?void 0:r>8?{indent:8}:{indent:r}}if(t===void 0){let{keepUndefined:r}=i??e??{};if(!r)return}return Uh.isDocument(t)&&!n?t.toString(i):new Gh.Document(t,n,i).toString(i)}Ot.parse=Qh;Ot.parseAllDocuments=Xh;Ot.parseDocument=Ec;Ot.stringify=Zh});var Ui=w(P=>{"use strict";var ep=Wr(),tp=Et(),ip=Er(),aa=Pt(),np=ct(),ge=C(),rp=de(),ap=T(),op=pe(),sp=me(),cp=Wi(),lp=ea(),up=ia(),fp=ra(),Ki=Cc(),Rc=rt();P.Composer=ep.Composer;P.Document=tp.Document;P.Schema=ip.Schema;P.YAMLError=aa.YAMLError;P.YAMLParseError=aa.YAMLParseError;P.YAMLWarning=aa.YAMLWarning;P.Alias=np.Alias;P.isAlias=ge.isAlias;P.isCollection=ge.isCollection;P.isDocument=ge.isDocument;P.isMap=ge.isMap;P.isNode=ge.isNode;P.isPair=ge.isPair;P.isScalar=ge.isScalar;P.isSeq=ge.isSeq;P.Pair=rp.Pair;P.Scalar=ap.Scalar;P.YAMLMap=op.YAMLMap;P.YAMLSeq=sp.YAMLSeq;P.CST=cp;P.Lexer=lp.Lexer;P.LineCounter=up.LineCounter;P.Parser=fp.Parser;P.parse=Ki.parse;P.parseAllDocuments=Ki.parseAllDocuments;P.parseDocument=Ki.parseDocument;P.stringify=Ki.stringify;P.visit=Rc.visit;P.visitAsync=Rc.visitAsync});var Ra=Cn(Ui(),1);import{promises as Fm}from"fs";import Fe from"path";import{createHash as mp}from"node:crypto";import{promises as U}from"node:fs";import V from"node:path";import{TextDecoder as vp}from"node:util";var dp=new Set([".cache",".git",".gradle",".gnupg",".mypy_cache",".next",".npm",".pnpm-store",".pytest_cache",".ssh",".turbo",".venv",".yarn","__pycache__","node_modules","venv"]),hp=new Set([".git-credentials",".netrc",".npmrc",".pypirc","auth.json","credentials.json"]);function pp(t){return t.toLowerCase().startsWith(".env")}function jt(t){let i=t.replaceAll("\\","/").split("/").filter(Boolean).map(n=>n.toLowerCase());return i.some(n=>pp(n))?"environment-file":i.some(n=>hp.has(n))?"credential-config":i.includes(".git")?"git-metadata":i.some(n=>dp.has(n))?"dependency-or-cache":i.join("/")===".comet/config.yaml"?"comet-config":i.join("/")===".comet/current-change.json"?"comet-selection":null}function we(t){return t!==0&&t!==0n&&t!=="0"}function K(t,e){return we(t.dev)&&we(e.dev)&&we(t.ino)&&we(e.ino)}function I(t,e){let i=we(t.dev)&&we(e.dev);if(i&&t.dev!==e.dev)return!1;let n=we(t.ino)&&we(e.ino);return n&&t.ino!==e.ino?!1:i&&n?!0:t.birthtime===e.birthtime}var Xi=1024*1024;function oa(t,e){let i=V.relative(t,e);return i===""||!V.isAbsolute(i)&&i!==".."&&!i.startsWith(`..${V.sep}`)}function gp(t){let e=V.posix.normalize(t);if(t.length===0||t!==t.trim()||t.includes("\\")||Array.from(t).some(r=>{let a=r.codePointAt(0)??0;return a<=31||a===127})||V.posix.isAbsolute(e)||/^(?:[A-Za-z]:|~)/u.test(t)||t.split("/").includes("..")||e!==t||e==="."||t.endsWith("/"))throw new Error(`Native artifact ref must be normalized and relative: ${t}`);let i=t.toLowerCase(),n=jt(t);if(n||i==="runtime"||i.startsWith("runtime/"))throw new Error(`Native artifact ref is excluded as sensitive (${n??"native-runtime"}): ${t}`);return t}function wp(t){if(!Number.isSafeInteger(t)||t<1)throw new Error("Native artifact byte limit must be a positive integer");return t}function yp(t,e){return I({...t,birthtime:t.birthtimeMs},{...e,birthtime:e.birthtimeMs})}function Yi(t,e){let i={...t,birthtime:t.birthtimeMs},n={...e,birthtime:e.birthtimeMs};return K(i,n)?I(i,n):I(i,n)&&t.birthtimeMs===e.birthtimeMs&&t.ctimeMs===e.ctimeMs&&t.size===e.size}async function Pc(t){let e=await U.lstat(t);if(!e.isDirectory()||e.isSymbolicLink())throw new Error(`Native artifact parent must be a real directory: ${t}`);return{path:t,realPath:await U.realpath(t),dev:e.dev,ino:e.ino,birthtimeMs:e.birthtimeMs}}async function Np(t,e){let i=V.resolve(t),n=V.resolve(e);if(!oa(i,n))throw new Error("Native artifact path is outside its root");let r=[await Pc(i)],a=i;for(let o of V.relative(i,n).split(V.sep).filter(Boolean)){a=V.join(a,o);let s=await Pc(a);if(!oa(r[0].realPath,s.realPath))throw new Error(`Native artifact parent resolves outside its root: ${a}`);r.push(s)}return r}async function Ac(t){for(let e of t){let i=await U.lstat(e.path);if(!i.isDirectory()||i.isSymbolicLink()||!yp(e,i)||await U.realpath(e.path)!==e.realPath)throw new Error(`Native artifact parent changed while reading: ${e.path}`)}}async function Y(t){let e=gp(t.ref),i=wp(t.maxBytes??Xi),n=V.resolve(t.root,...e.split("/")),r=await Np(t.root,V.dirname(n));await t.hooks?.afterParentChainCaptured?.();let a=await U.lstat(n);if(!a.isFile()||a.isSymbolicLink())throw new Error(`Native artifact must be a regular file: ${e}`);if(a.size>i)throw new Error(`Native artifact exceeds ${i} bytes: ${e}`);let o=await U.realpath(n);if(!oa(r[0].realPath,o))throw new Error(`Native artifact resolves outside its root: ${e}`);let s=await U.open(n,"r");try{let[c,l,d]=await Promise.all([s.stat(),U.lstat(n),U.realpath(n)]);if(await Ac(r),!c.isFile()||!l.isFile()||l.isSymbolicLink()||d!==o||!Yi(a,c)||!Yi(c,l))throw new Error(`Native artifact changed while opening: ${e}`);await t.hooks?.afterOpen?.();let u=[],f=0,m=Buffer.allocUnsafe(Math.min(64*1024,i+1));for(;;){let k=i+1-f,S=await s.read(m,0,Math.min(m.length,k),null);if(S.bytesRead===0)break;if(f+=S.bytesRead,f>i)throw new Error(`Native artifact exceeds ${i} bytes: ${e}`);u.push(Buffer.from(m.subarray(0,S.bytesRead)))}await t.hooks?.beforeFinalCheck?.();let[g,h,p]=await Promise.all([s.stat(),U.lstat(n),U.realpath(n)]);if(await Ac(r),!h.isFile()||h.isSymbolicLink()||p!==o||!Yi(c,g)||!Yi(c,h))throw new Error(`Native artifact changed while reading: ${e}`);let y=Buffer.concat(u,f),N;try{N=new vp("utf-8",{fatal:!0}).decode(y)}catch(k){throw new Error(`Native artifact is not valid UTF-8: ${e}`,{cause:k})}return{ref:e,size:f,hash:mp("sha256").update(y).digest("hex"),text:N}}finally{await s.close()}}var ca=Cn(Ui(),1);import Qi from"path";var Ht=64*1024,Zi=1024,en=64,la=5,bp=[".agents/skills/**",".amazonq/skills/**",".augment/skills/**",".bob/skills/**",".claude/skills/**",".cline/skills/**",".codebuddy/skills/**",".continue/skills/**",".cospec/skills/**",".crush/skills/**",".cursor/skills/**",".factory/skills/**",".forge/skills/**",".gemini/skills/**",".github/skills/**",".iflow/skills/**",".junie/skills/**",".kilocode/skills/**",".kimi-code/skills/**",".kiro/skills/**",".lingma/skills/**",".mimocode/skills/**",".opencode/skills/**",".pi/skills/**",".qoder/skills/**",".qwen/skills/**",".roo/skills/**",".trae-cn/skills/**",".trae/skills/**",".windsurf/skills/**",".zcode/skills/**"],B={include:["**/*"],exclude:[...bp],max_files:1e4,max_total_bytes:256*1024*1024,max_duration_ms:6e4};function kp(t,e){if(typeof t!="string")throw new Error(`${e} must be a string`);let i=t.trim();if(i.length===0||Qi.posix.isAbsolute(i)||Qi.win32.isAbsolute(i)||/^(?:~|[\\/])/u.test(i))throw new Error(`${e} must be a project-relative path`);if(i===".")return[];let n=i.replaceAll("\\","/").split("/");if(n.some(r=>r===".."))throw new Error(`${e} must stay inside the project root`);if(n.some(r=>r===""||r==="."))throw new Error(`${e} must not contain empty or dot path segments`);return n}function Ie(t){let e=kp(t,"native.artifact_root");return e.length===0?".":e.join("/")}function Tc(t,e="docs"){let i=t??e;if(i!=="legacy"&&i!=="docs")throw new Error("classic.artifact_layout must be legacy or docs");return i}function ua(t,e,i=!1){if(typeof t!="string")throw new Error(`${e} must be a string`);let n=t.trim().replaceAll("\\","/");if(n.length===0||Qi.posix.isAbsolute(n)||Qi.win32.isAbsolute(n)||/^(?:~|[\\/])/u.test(n))throw new Error(`${e} must be relative to its declared path base`);let r=n.split("/");if(r.some(a=>a===".."))throw new Error(`${e} must stay inside its declared path base`);if(r.some(a=>a===""||a==="."))throw new Error(`${e} must not contain empty or dot path segments`);if(!i&&/[*?]/u.test(n))throw new Error(`${e} cannot contain wildcards`);return r.join("/")}function $t(t,e){if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`${e} must be a mapping`);return t}function Ic(t,e,i){let n=t??e;if(n!=="en"&&n!=="zh-CN")throw new Error(`${i} must be en or zh-CN`);return n}function tn(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>Zi)throw new Error(`${e} exceeds ${Zi} characters`);let i=0;for(let n=0;n<t.length;n+=1)t[n]==="?"?i+=1:t[n]==="*"&&(i+=1,t[n+1]==="*"&&(n+=1));if(i>en)throw new Error(`${e} contains more than ${en} wildcard tokens`);return t}function xc(t,e,i){if(t===void 0)return[...i];if(!Array.isArray(t))throw new Error(`${e} contains an unsafe pattern`);return[...new Set(t.map(n=>tn(n,e)))].sort((n,r)=>n.localeCompare(r,"en"))}function sa(t,e,i){let n=t??e;if(!Number.isSafeInteger(n)||n<1)throw new Error(`${i} must be a positive integer`);return n}function Sp(t){if(t===void 0)return{...B,include:[...B.include],exclude:[...B.exclude]};let e=$t(t,"native.snapshot");return{include:xc(e.include,"native.snapshot.include",B.include),exclude:xc(e.exclude,"native.snapshot.exclude",B.exclude),max_files:sa(e.max_files,B.max_files,"native.snapshot.max_files"),max_total_bytes:sa(e.max_total_bytes,B.max_total_bytes,"native.snapshot.max_total_bytes"),max_duration_ms:sa(e.max_duration_ms,B.max_duration_ms,"native.snapshot.max_duration_ms")}}function Ep(t){if(t===void 0)return;let e=$t(t,"native.pending_root_move"),i=e.id,n=e.from_artifact_root,r=e.to_artifact_root,a=e.stage;if(typeof i!="string"||!/^[a-f0-9-]{8,}$/u.test(i))throw new Error("native.pending_root_move.id is invalid");if(typeof n!="string"||typeof r!="string")throw new Error("native.pending_root_move roots must be strings");if(a!=="copying"&&a!=="ready"&&a!=="switched")throw new Error("native.pending_root_move.stage is invalid");let o;if(e.cleanup!==void 0){let s=$t(e.cleanup,"native.pending_root_move.cleanup"),c=s.kind,l=s.state,d=s.manifest_hash;if(c!=="forward-source"&&c!=="restart-staging"&&c!=="rollback-destination"&&c!=="rollback-staging")throw new Error("native.pending_root_move.cleanup.kind is invalid");if(l!=="prepared"&&l!=="quarantined"&&l!=="deleting")throw new Error("native.pending_root_move.cleanup.state is invalid");if(typeof d!="string"||!/^[a-f0-9]{64}$/u.test(d))throw new Error("native.pending_root_move.cleanup.manifest_hash is invalid");o={kind:c,state:l,manifestHash:d}}return{id:i,fromArtifactRoot:Ie(n),toArtifactRoot:Ie(r),stage:a,...o?{cleanup:o}:{}}}function Cp(t,e={}){let i=$t(t,"native"),n=i.artifact_root??(e.allowMissingArtifactRoot?"docs":void 0);if(typeof n!="string")throw new Error("native.artifact_root must be a string");let r=i.clarification_mode??"sequential";if(r!=="sequential"&&r!=="batch")throw new Error("native.clarification_mode must be sequential or batch");let a=i.archive_confirmation??"automatic";if(a!=="automatic"&&a!=="required")throw new Error("native.archive_confirmation must be automatic or required");let o=i.max_verify_failures??la;if(!Number.isSafeInteger(o)||o<1)throw new Error("native.max_verify_failures must be a positive integer");let s=Ep(i.pending_root_move);return{artifact_root:Ie(n),language:Ic(i.language,"en","native.language"),clarification_mode:r,archive_confirmation:a,max_verify_failures:o,snapshot:Sp(i.snapshot),...s?{pending_root_move:s}:{}}}function Rp(t){let e=$t(t,"classic"),i=e.context_compression??"off";if(i!=="off"&&i!=="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 r=e.auto_transition??!0;if(typeof r!="boolean")throw new Error("classic.auto_transition must be true or false");return{artifact_layout:Tc(e.artifact_layout),language:Ic(e.language,"zh-CN","classic.language"),context_compression:i,review_mode:n,auto_transition:r}}function Pp(t){let e=t??!0;if(typeof e!="boolean")throw new Error("ambient_resume must be true or false");return e}function Ap(t,e,i,n,r){let a=t.schema!==void 0;if(!(a||t.default_workflow!==void 0||t.workflows!==void 0||!r.allowPartialProject&&t.native!==void 0)||r.allowPartialProject&&!a)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 s=t.workflows??[t.default_workflow];if(!Array.isArray(s)||s.length===0||s.some(l=>l!=="native"&&l!=="classic"))throw new Error("workflows must contain native and/or classic");let c=[...new Set(s)];if(!c.includes(t.default_workflow))throw new Error("workflows must include default_workflow");if(c.includes("native")&&!e)throw new Error("native must be a mapping");return{schema:"comet.project.v1",default_workflow:t.default_workflow,workflows:c,ambient_resume:n,...e?{native:e}:{},...i?{classic:i}:{}}}function Lt(t,e={}){let i=(0,ca.parseDocument)(t,{uniqueKeys:!0});if(i.errors.length>0)throw new Error(`Invalid .comet/config.yaml: ${i.errors[0].message}`);let n=i.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 r=n,a=Pp(r.ambient_resume),o=r.native===void 0?void 0:Cp(r.native,{allowMissingArtifactRoot:e.allowMissingNativeFields}),s=r.classic===void 0?void 0:Rp(r.classic),c=Ap(r,o,s,a,{allowPartialProject:e.allowPartialProject??!1});return{value:r,config:c,ambient_resume:a,...o?{native:o}:{},...s?{classic:s}:{}}}function nn(t="docs",e="en"){return{schema:"comet.project.v1",default_workflow:"native",ambient_resume:!0,native:{artifact_root:Ie(t),language:e,clarification_mode:"sequential",archive_confirmation:"automatic",max_verify_failures:la,snapshot:{...B,include:[...B.include],exclude:[...B.exclude]}}}}import{createHash as Tp}from"crypto";import{promises as on}from"fs";import ye from"path";import{constants as rn,promises as _e}from"fs";var ne=class extends Error{reason;constructor(e,i,n){super(i,n),this.name="RaceSafeReadError",this.reason=e}};function fa(t){return"birthtimeNs"in t&&typeof t.birthtimeNs=="bigint"?t.birthtimeNs:t.birthtimeMs}function _c(t){return"ctimeNs"in t&&typeof t.ctimeNs=="bigint"?t.ctimeNs:t.ctimeMs}function Ft(t){return{dev:t.dev,ino:t.ino,birthtime:fa(t)}}function an(t,e){let i=Ft(t),n=Ft(e);return K(i,n)?I(i,n):I(i,n)&&fa(t)===fa(e)&&_c(t)===_c(e)&&t.size===e.size}async function Mt(t,e,i={}){if(!Number.isSafeInteger(e)||e<1)throw new Error("race-safe read byte limit must be a positive integer");let n=i.label??"file",r=i.bigint===!0,a=await _e.lstat(t,{bigint:r});if(!a.isFile()||a.isSymbolicLink())throw new ne("not-regular-file",`${n} must be a regular file`);if(BigInt(a.size)>BigInt(e))throw new ne("too-large",`${n} exceeds ${e} bytes`);let o=await _e.realpath(t);await i.verify?.("pre-open",{realPath:o,identity:Ft(a)});let s=process.platform==="win32"?rn.O_RDONLY:rn.O_RDONLY|rn.O_NOFOLLOW|rn.O_NONBLOCK,c;try{c=await _e.open(t,s)}catch(l){throw l.code==="ELOOP"?new ne("not-regular-file",`${n} must be a regular file`,{cause:l}):l}try{let[l,d,u]=await Promise.all([c.stat({bigint:r}),_e.lstat(t,{bigint:r}),_e.realpath(t)]);if(!l.isFile()||!d.isFile()||d.isSymbolicLink()||u!==o||!an(a,l)||!an(a,d))throw new ne("changed",`${n} changed while opening`);await i.verify?.("post-open",{realPath:u,identity:Ft(l)}),await i.hooks?.afterOpen?.();let f=[],m=0,g=Buffer.allocUnsafe(Math.min(64*1024,e+1));for(;;){let N=e+1-m,{bytesRead:k}=await c.read(g,0,Math.min(g.length,N),null);if(k===0)break;if(m+=k,m>e)throw new ne("too-large",`${n} exceeds ${e} bytes`);f.push(Buffer.from(g.subarray(0,k)))}await i.hooks?.beforeFinalCheck?.();let[h,p,y]=await Promise.all([c.stat({bigint:r}),_e.lstat(t,{bigint:r}),_e.realpath(t)]);if(!p.isFile()||p.isSymbolicLink()||y!==o||!an(a,h)||!an(a,p))throw new ne("changed",`${n} changed while reading`);return await i.verify?.("post-read",{realPath:y,identity:Ft(h)}),{bytes:Buffer.concat(f,m),stat:h,realPath:y}}finally{await c.close()}}function xp(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}function da(t,e){let i=ye.relative(t,e);return i===""||!ye.isAbsolute(i)&&i!==".."&&!i.startsWith(`..${ye.sep}`)}async function Oc(t,e){let i=ye.resolve(t),n=await on.lstat(i);if(!n.isDirectory()||n.isSymbolicLink())throw new Error(`${e} project root must be a real directory`);return on.realpath(i)}async function jc(t,e,i,n){let r=t;for(let a=0;a<i.length;a++){r=ye.join(r,i[a]);let o;try{o=await on.lstat(r)}catch(d){if(xp(d))return{exists:!1,kind:"missing"};throw d}let s=ye.relative(t,r).replaceAll("\\","/");if(o.isSymbolicLink())throw new Error(`${n.label} crosses a symbolic link or junction at ${s}`);let c=a===i.length-1;if(!c&&!o.isDirectory())throw new Error(`${n.label} ancestor ${s} must be a real directory`);if(c&&(n.expected==="file"&&!o.isFile()||n.expected==="directory"&&!o.isDirectory()||n.expected==="any"&&!o.isFile()&&!o.isDirectory()))throw new Error(`${n.label} must be a real ${n.expected}`);let l=await on.realpath(r);if(!da(e,l))throw new Error(`${n.label} resolves outside the project root`);if(c)return{exists:!0,kind:o.isFile()?"file":o.isDirectory()?"directory":"missing"}}return{exists:!0,kind:"directory"}}async function Bt(t,e,i){let n=ua(e,i.label),r=ye.resolve(t),a=await Oc(r,i.label),o=n.split("/"),s=ye.resolve(r,...o);if(!da(r,s))throw new Error(`${i.label} must stay inside the project root`);let c=await jc(r,a,o,i);return{projectRoot:r,target:s,relative:n,exists:c.exists,kind:c.kind}}async function Oe(t,e,i,n){let r=await Bt(t,e,{label:n.label,expected:"file"});if(!r.exists){let o=new Error(`${n.label} does not exist`);throw o.code="ENOENT",o}let a=await Oc(r.projectRoot,n.label);return Mt(r.target,i,{...n,verify:async(o,s)=>{if(!da(a,s.realPath))throw new Error(`${n.label} resolves outside the project root`);await jc(r.projectRoot,a,r.relative.split("/"),{label:n.label,expected:"file"})}})}var Dt=".comet/config.yaml";function Ip(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}async function ha(t,e={}){return(await sn(t,e)).document}async function _p(t){try{return(await Oe(t,Dt,Ht,{label:Dt})).bytes}catch(e){if(Ip(e))return null;throw e}}function Op(t){return t?{exists:!0,sha256:Tp("sha256").update(t).digest("hex")}:{exists:!1,sha256:null}}async function sn(t,e={}){let i=await _p(t);return{document:i?Lt(i.toString("utf8"),e):null,identity:Op(i)}}var Iw=16*1024;import{promises as Ze}from"fs";import A from"path";import Fp from"os";var ln=".comet/config.yaml";async function va(t){try{return await Ze.lstat(t),!0}catch(e){if(e.code==="ENOENT")return!1;throw e}}async function Mp(t){try{let e=await Ze.readFile(t,"utf8");return/^schema:\s*comet\.project\.v1\s*$/mu.test(e)}catch(e){if(e.code==="ENOENT")return!1;throw e}}function qt(t,e){let i=A.relative(t,e);return i===""||!A.isAbsolute(i)&&i!==".."&&!i.startsWith(`..${A.sep}`)}async function Vt(t){let e=[],i=t;for(;!await va(i);){let r=A.dirname(i);if(r===i)break;e.push(A.basename(i)),i=r}let n=await Ze.realpath(i);return A.resolve(n,...e.reverse())}async function Hc(t){try{return(await Ze.lstat(t)).isSymbolicLink()}catch(e){if(e.code==="ENOENT")return!1;throw e}}async function un(t){let e=A.resolve(t);try{(await Ze.stat(e)).isDirectory()||(e=A.dirname(e))}catch(r){if(r.code!=="ENOENT")throw r}let i=e,n=A.resolve(Fp.homedir());for(;;){if(!(e===n&&i!==n)){let o=A.join(e,...ln.split("/")),s=e===i||await Mp(o);if(await va(o)&&s)return e}if(await va(A.join(e,".git")))return e;let a=A.dirname(e);if(a===e)return i;e=a}}function fn(t){return Ie(t)}async function Bp(t,e){let i=fn(e),n=A.resolve(t,...i.split("/")),r=await Ze.realpath(t),a=await Vt(n);if(!qt(r,a))throw new Error("native.artifact_root resolves outside the project root");return n}async function ga(t,e){let i=fn(e),n=await Bp(t,i),r=A.join(n,"comet");if(await Hc(r))throw new Error("The configured Native comet root must not be a symbolic link");let[a,o]=await Promise.all([Vt(n),Vt(r)]);if(!qt(a,o))throw new Error("The configured Native comet root resolves outside its artifact root");return{projectRoot:A.resolve(t),configFile:A.join(t,...ln.split("/")),artifactRoot:n,artifactRootRef:i,nativeRoot:r,specsDir:A.join(r,"specs"),changesDir:A.join(r,"changes"),archiveDir:A.join(r,"archive"),runtimeDir:A.join(r,"runtime"),locksDir:A.join(r,"runtime","locks"),transactionsDir:A.join(r,"runtime","transactions")}}function re(t,e){return qt(A.resolve(t),A.resolve(e))}async function j(t,e){let i=A.resolve(t),n=A.resolve(e);if(!qt(i,n))throw new Error(`Path is outside the Native root: ${e}`);if(await Hc(i))throw new Error(`Native root must not be a symbolic link: ${t}`);let[r,a]=await Promise.all([Vt(i),Vt(n)]);if(!qt(r,a))throw new Error(`Path resolves outside the Native root: ${e}`);return n}var dn=tn;function qp(t="docs",e="en"){return nn(t,e)}async function Wt(t){let e=(await ha(t))?.config??null;return e?.native?e:null}async function Lc(t){let e=await un(t.startPath),i=await Wt(e);if(!i&&t.allowMissingConfig===!1)throw new Error(`${ln} was not found`);if(i?.native.pending_root_move)throw new Error(`Native root move ${i.native.pending_root_move.id} is incomplete; use comet native doctor --repair`);let n=t.explicitArtifactRoot?fn(t.explicitArtifactRoot):void 0;if(i&&n&&n!==i.native.artifact_root)throw new Error(`Configured Native artifact root is ${i.native.artifact_root}; refusing conflicting root ${n}`);let r=i??qp(n??"docs"),a=await ga(e,r.native.artifact_root);return{config:r,paths:a,configured:i!==null}}import{AsyncLocalStorage as Vp}from"async_hooks";var ty=16*1024;var iy=new Vp;import{TextDecoder as Xp}from"util";import{createHash as Wp}from"node:crypto";import{constants as hn,promises as X}from"node:fs";import Q from"node:path";import{TextDecoder as zp}from"node:util";function mn(t,e){let i=Q.relative(t,e);return i===""||!Q.isAbsolute(i)&&i!==".."&&!i.startsWith(`..${Q.sep}`)}function Jp(t){if(!Number.isSafeInteger(t)||t<1)throw new Error("Native protected file byte limit must be a positive integer");return t}function Gp(t,e){return I({...t,birthtime:t.birthtimeMs},{...e,birthtime:e.birthtimeMs})}function Kp(t){return{dev:t.dev,ino:t.ino,birthtimeMs:t.birthtimeMs,ctimeMs:t.ctimeMs,mtimeMs:t.mtimeMs,size:t.size}}function pn(t,e){return I({...t,birthtime:t.birthtimeMs},{...e,birthtime:e.birthtimeMs})&&t.birthtimeMs===e.birthtimeMs&&t.ctimeMs===e.ctimeMs&&t.mtimeMs===e.mtimeMs&&t.size===e.size}async function ya(t,e){let i=await X.lstat(t);if(!i.isDirectory()||i.isSymbolicLink())throw new Error(`${e} parent must be a real directory: ${t}`);return{path:t,realPath:await X.realpath(t),dev:i.dev,ino:i.ino,birthtimeMs:i.birthtimeMs}}async function Fc(t,e,i){let n=Q.resolve(t),r=Q.resolve(e);if(!mn(n,r))throw new Error(`${i} is outside its managed root`);let a=[await ya(n,i)],o=n;for(let s of Q.relative(n,r).split(Q.sep).filter(Boolean)){await Ne(a,i),o=Q.join(o,s);let c=await ya(o,i);if(!mn(a[0].realPath,c.realPath))throw new Error(`${i} parent resolves outside its managed root: ${o}`);a.push(c)}return await Ne(a,i),a}async function Ne(t,e){for(let i of t){let n=await X.lstat(i.path);if(!n.isDirectory()||n.isSymbolicLink()||!Gp(i,n)||await X.realpath(i.path)!==i.realPath)throw new Error(`${e} parent changed during I/O: ${i.path}`)}}async function Up(t,e,i){let n=[],r=0,a=Buffer.allocUnsafe(Math.min(64*1024,e+1));for(;;){let o=e+1-r,{bytesRead:s}=await t.read(a,0,Math.min(a.length,o),null);if(s===0)break;if(r+=s,r>e)throw new Error(`${i} exceeds ${e} bytes`);n.push(Buffer.from(a.subarray(0,s)))}return Buffer.concat(n,r)}async function et(t){let e=Jp(t.maxBytes),i=Q.resolve(t.file),n=await Fc(t.root,Q.dirname(i),t.label),r=await Promise.all((t.forbiddenRoots??[]).map(d=>ya(Q.resolve(d),t.label)));await t.hooks?.afterParentChainCaptured?.(),await Ne(n,t.label);let a=await X.lstat(i);if(!a.isFile()||a.isSymbolicLink())throw new Error(`${t.label} must be a regular file`);if(a.size>e)throw new Error(`${t.label} exceeds ${e} bytes`);let o=Kp(a),s=await X.realpath(i);if(!mn(n[0].realPath,s))throw new Error(`${t.label} resolves outside its managed root`);if(r.some(d=>mn(d.realPath,s)))throw new Error(`${t.label} resolves inside an excluded root`);let c=process.platform==="win32"?hn.O_RDONLY:hn.O_RDONLY|hn.O_NOFOLLOW|hn.O_NONBLOCK,l=await X.open(i,c);try{let d=await l.stat();await t.hooks?.afterOpen?.();let[u,f]=await Promise.all([X.lstat(i),X.realpath(i)]);if(await Ne(n,t.label),await Ne(r,t.label),!d.isFile()||!u.isFile()||u.isSymbolicLink()||f!==s||!pn(o,d)||!pn(o,u))throw new Error(`${t.label} changed while opening`);await t.hooks?.beforeRead?.();let m=await Up(l,e,t.label);await t.hooks?.beforeFinalCheck?.();let[g,h,p]=await Promise.all([l.stat(),X.lstat(i),X.realpath(i)]);if(await Ne(n,t.label),await Ne(r,t.label),!h.isFile()||h.isSymbolicLink()||p!==s||!pn(o,g)||!pn(o,h))throw new Error(`${t.label} changed while reading`);return{bytes:m,hash:Wp("sha256").update(m).digest("hex"),size:m.length}}finally{await l.close()}}async function Mc(t){let e=await et(t),i;try{i=new zp("utf-8",{fatal:!0}).decode(e.bytes)}catch(n){throw new Error(`${t.label} is not valid UTF-8`,{cause:n})}return{...e,text:i}}async function Na(t){let e=await Fc(t.root,t.directory,t.label);return{verify:()=>Ne(e,t.label)}}var wy=256*1024,yy=1024*1024,Ny=16*1024;var by=64*1024*1024;var ky=new Xp("utf-8",{fatal:!0});import gn from"path";import{createHash as Zp}from"crypto";function D(t){return Zp("sha256").update(t).digest("hex")}var By={maxFiles:1e4,maxFileBytes:5*1024*1024,maxTotalBytes:64*1024*1024,maxManifestBytes:1024*1024},tm=1e3,im=8*1024*1024,nm=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u,rm=new Set(["schema","origin","capture","createdAt","complete","limits","entries","omitted","omittedCount","omissionOverflow","policy"]),am=new Set(["maxFiles","maxFileBytes","maxTotalBytes","maxManifestBytes","maxDurationMs"]),om=new Set(["schema","include","exclude","hash"]),sm=new Set(["provider","gitSelection","physicalSelection","projection"]),cm=new Set(["provider","selection"]),lm=new Set(["schema","status","stageBefore","combined","stageAfter","finalStageBefore","finalCombined","finalStageAfter"]),um=new Set(["hash","recordCount","storedRecordCount","stdoutBytes","overflow"]),fm=new Set(["schema","status","before","after"]),dm=new Set(["hash","visitedNodeCount","recordCount","storedRecordCount","encodedBytes","overflow","unstable"]),hm=new Set(["path","hash","size","type","gitObjectId"]),pm=new Set(["path","size","type","reason"]),mm=new Set(["ref","hash","count"]),vm=new Set(["change-created","legacy-migration","explicit"]),gm=new Set(["file","directory","other"]),wm=new Set(["file-size","file-count","total-size","manifest-size","changed-during-read","unreadable","gitlink-unavailable","gitlink-dirty","gitlink-changed","legacy-gitlink-boundary","git-enumeration-limit","git-selection-changed","physical-enumeration-limit","physical-selection-changed"]),wn=/^[a-f0-9]{64}$/u,ym=/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/u;var Dy=64*1024,qy=64*1024;var Vy={maxRecords:2e4,maxBytes:8*1024*1024,maxRecordBytes:64*1024},Wy={maxNodes:2e4,maxBytes:8*1024*1024,maxPathBytes:64*1024};function vn(t,e){return t.hash===e.hash&&t.recordCount===e.recordCount&&t.storedRecordCount===e.storedRecordCount&&t.stdoutBytes===e.stdoutBytes&&t.overflow===e.overflow}var zy=(1n<<256n)-1n;function Nm(t,e){return t.hash===e.hash&&t.visitedNodeCount===e.visitedNodeCount&&t.recordCount===e.recordCount&&t.storedRecordCount===e.storedRecordCount&&t.encodedBytes===e.encodedBytes&&t.overflow===e.overflow&&t.unstable===e.unstable}function bm(t){return Buffer.byteLength(JSON.stringify(t,null,2)+`
|
|
143
|
-
`)}function km(t,e){return D(`comet.native.snapshot-policy.v1
|
|
144
|
-
${JSON.stringify({include:t,exclude:e,hash:"sha256"})}`)}function ka(t,e,i){let n=new Set(e),r=[...e];for(;r.length>0;){if(i&&!i())return null;let a=r.pop(),o=t[a];o&&(o.kind==="star"||o.kind==="globstar"||o.kind==="globstar-slash")&&!n.has(a+1)&&(n.add(a+1),r.push(a+1))}return n}function Sm(t){let e=0;return()=>e>0?(e-=1,!0):t()?(e=63,!0):!1}function Wc(t){let e=dn(t,"Native snapshot pattern"),i=[];for(let n=0;n<e.length;n+=1){let r=e[n];r==="*"&&e[n+1]==="*"?(n+=1,e[n+1]==="/"?(n+=1,i.push({kind:"globstar-slash"})):i.push({kind:"globstar"})):r==="*"?i.push({kind:"star"}):r==="?"?i.push({kind:"question"}):i.push({kind:"literal",value:r})}return(n,r)=>{let a=r?Sm(r):void 0;if(a&&!a())return!1;let o=ka(i,new Set([0]),a);if(o===null)return!1;for(let s of n){if(a&&!a())return!1;let c=new Set;for(let l of o){if(a&&!a())return!1;let d=i[l];d&&(d.kind==="literal"&&d.value===s||d.kind==="question"&&s!=="/"?c.add(l+1):d.kind==="star"&&s!=="/"||d.kind==="globstar"?c.add(l):d.kind==="globstar-slash"&&(c.add(l),s==="/"&&c.add(l+1)))}if(o=ka(i,c,a),o===null||o.size===0)return!1}return ka(i,o,a)?.has(i.length)??!1}}function Em(t){if(t===void 0)return;let e=[...new Set(t.include.map(r=>dn(r,"include")))].sort((r,a)=>r.localeCompare(a,"en")),i=[...new Set(t.exclude.map(r=>dn(r,"exclude")))].sort((r,a)=>r.localeCompare(a,"en"));if(e.length===0)throw new Error("Native snapshot policy include must not be empty");let n=km(e,i);if("hash"in t&&t.hash!==n)throw new Error("Native snapshot policy hash is invalid");return{manifest:{schema:"comet.native.snapshot-policy.v1",include:e,exclude:i,hash:n},includeMatchers:e.map(Wc),excludeMatchers:i.map(Wc),excludedDirectoryPrefixes:i.flatMap(r=>{if(!r.endsWith("/**"))return[];let a=r.slice(0,-3);return/[*?]/u.test(a)?[]:[a]}).sort((r,a)=>r.localeCompare(a,"en"))}}function W(t,e){if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`${e} must be an object`);return t}function z(t,e,i){let n=Object.keys(t).find(r=>!e.has(r));if(n)throw new Error(`${i} contains unknown field: ${n}`)}function it(t,e){if(!Number.isSafeInteger(t)||t<1)throw new Error(`${e} must be a positive integer`);return t}function ae(t,e){if(!Number.isSafeInteger(t)||t<0)throw new Error(`${e} must be a non-negative integer`);return t}function Gc(t,e){if(typeof t!="string"||t.length===0||t.includes("\\")||t.includes("\0"))throw new Error(`${e} must be a normalized project-relative path`);let i=gn.posix.normalize(t);if(i!==t||gn.posix.isAbsolute(t)||i===".."||i.startsWith("../"))throw new Error(`${e} must stay inside the project root`);return t}function Cm(t,e){let i=W(t,`Native snapshot entry ${e}`);z(i,hm,`Native snapshot entry ${e}`);let n=Gc(i.path,`Native snapshot entry ${e} path`);if(typeof i.hash!="string"||!wn.test(i.hash))throw new Error(`Native snapshot entry ${e} hash is invalid`);if(i.type!=="file")throw new Error(`Native snapshot entry ${e} type is invalid`);let r={path:n,hash:i.hash,size:ae(i.size,`Native snapshot entry ${e} size`),type:"file"};if(i.gitObjectId!==void 0){if(typeof i.gitObjectId!="string"||!ym.test(i.gitObjectId))throw new Error(`Native snapshot entry ${e} gitObjectId is invalid`);r.gitObjectId=i.gitObjectId}return r}function Rm(t,e){let i=W(t,`Native snapshot omission ${e}`);if(z(i,pm,`Native snapshot omission ${e}`),!gm.has(i.type))throw new Error(`Native snapshot omission ${e} type is invalid`);if(!wm.has(i.reason))throw new Error(`Native snapshot omission ${e} reason is invalid`);return{path:Gc(i.path,`Native snapshot omission ${e} path`),size:i.size===null?null:ae(i.size,`Native snapshot omission ${e} size`),type:i.type,reason:i.reason}}function Pm(t){let e=W(t,"Native snapshot omission overflow");if(z(e,mm,"Native snapshot omission overflow"),typeof e.hash!="string"||!wn.test(e.hash))throw new Error("Native snapshot omission overflow hash is invalid");let i=`native-snapshot://omitted-overflow/${e.hash}`;if(e.ref!==i)throw new Error("Native snapshot omission overflow ref is invalid");return{ref:i,hash:e.hash,count:it(e.count,"Native snapshot omission overflow count")}}function tt(t,e){let i=W(t,e);if(z(i,um,e),typeof i.hash!="string"||!wn.test(i.hash))throw new Error(`${e} hash is invalid`);if(typeof i.overflow!="boolean")throw new Error(`${e} overflow flag is invalid`);let n=ae(i.recordCount,`${e} recordCount`),r=ae(i.storedRecordCount,`${e} storedRecordCount`),a=ae(i.stdoutBytes,`${e} stdoutBytes`);if(r>n||!i.overflow&&r!==n)throw new Error(`${e} stored record count is inconsistent`);return{hash:i.hash,recordCount:n,storedRecordCount:r,stdoutBytes:a,overflow:i.overflow}}function zc(t){let e=W(t,"Native Git selection evidence");if(z(e,lm,"Native Git selection evidence"),e.schema!=="comet.native.git-selection.v1")throw new Error("Native Git selection evidence schema is invalid");if(e.status!=="overflow"&&e.status!=="changed"&&e.status!=="overflow-and-changed")throw new Error("Native Git selection evidence status is invalid");let i=tt(e.stageBefore,"Native Git selection stageBefore"),n=tt(e.combined,"Native Git selection combined"),r=tt(e.stageAfter,"Native Git selection stageAfter"),a=tt(e.finalStageBefore,"Native Git selection finalStageBefore"),o=tt(e.finalCombined,"Native Git selection finalCombined"),s=tt(e.finalStageAfter,"Native Git selection finalStageAfter"),c=[i,n,r,a,o,s].some(u=>u.overflow),l=!vn(i,r)||!vn(r,a)||!vn(n,o)||!vn(a,s),d=c&&l?"overflow-and-changed":c?"overflow":"changed";if(!c&&!l)throw new Error("Native Git selection evidence must describe an exceptional selection");if(e.status!==d)throw new Error("Native Git selection evidence status is inconsistent");return{schema:"comet.native.git-selection.v1",status:d,stageBefore:i,combined:n,stageAfter:r,finalStageBefore:a,finalCombined:o,finalStageAfter:s}}function Jc(t,e){let i=W(t,e);if(z(i,dm,e),typeof i.hash!="string"||!wn.test(i.hash))throw new Error(`${e} hash is invalid`);if(typeof i.overflow!="boolean"||typeof i.unstable!="boolean")throw new Error(`${e} flags are invalid`);let n=ae(i.visitedNodeCount,`${e} visitedNodeCount`),r=ae(i.recordCount,`${e} recordCount`),a=ae(i.storedRecordCount,`${e} storedRecordCount`),o=ae(i.encodedBytes,`${e} encodedBytes`);if(a>r||!i.overflow&&a!==r)throw new Error(`${e} stored record count is inconsistent`);return{hash:i.hash,visitedNodeCount:n,recordCount:r,storedRecordCount:a,encodedBytes:o,overflow:i.overflow,unstable:i.unstable}}function Am(t){let e=W(t,"Native physical selection evidence");if(z(e,fm,"Native physical selection evidence"),e.schema!=="comet.native.physical-selection.v1")throw new Error("Native physical selection evidence schema is invalid");if(e.status!=="overflow"&&e.status!=="changed"&&e.status!=="overflow-and-changed")throw new Error("Native physical selection evidence status is invalid");let i=Jc(e.before,"Native physical selection before"),n=Jc(e.after,"Native physical selection after"),r=i.overflow||n.overflow,a=i.unstable||n.unstable||!Nm(i,n);if(!r&&!a)throw new Error("Native physical selection evidence must describe an exceptional selection");let o=r&&a?"overflow-and-changed":r?"overflow":"changed";if(e.status!==o)throw new Error("Native physical selection evidence status is inconsistent");return{schema:"comet.native.physical-selection.v1",status:o,before:i,after:n}}function Kc(t){let e=W(t,"Native content snapshot manifest");if(z(e,rm,"Native content snapshot manifest"),e.schema!=="comet.native.content-snapshot.v1")throw new Error("Unsupported Native content snapshot schema");if(!vm.has(e.origin))throw new Error("Native content snapshot origin is invalid");let i;if(e.capture!==void 0){let v=W(e.capture,"Native content snapshot capture");if(z(v,sm,"Native content snapshot capture"),v.provider!=="git"&&v.provider!=="physical-tree")throw new Error("Native content snapshot capture provider is invalid");let R=v.gitSelection===void 0?void 0:zc(v.gitSelection),b=v.physicalSelection===void 0?void 0:Am(v.physicalSelection),x=null;if(v.projection!==void 0){let M=W(v.projection,"Native content snapshot projection");if(z(M,cm,"Native content snapshot projection"),M.provider!=="git")throw new Error("Native content snapshot projection provider is invalid");x={provider:"git",...M.selection===void 0?{}:{selection:zc(M.selection)}}}if(v.provider==="git"){if(b||x)throw new Error("Native Git capture cannot include physical or projection evidence");i={provider:"git",...R?{gitSelection:R}:{}}}else{if(R)throw new Error("Native physical-tree capture cannot include direct Git evidence");if(b&&x)throw new Error("Native physical-tree capture cannot combine selection and projection");i=x?{provider:"physical-tree",projection:x}:{provider:"physical-tree",...b?{physicalSelection:b}:{}}}}if(typeof e.createdAt!="string"||Number.isNaN(Date.parse(e.createdAt)))throw new Error("Native content snapshot timestamp is invalid");if(typeof e.complete!="boolean")throw new Error("Native content snapshot complete flag is invalid");let n=W(e.limits,"Native content snapshot limits");z(n,am,"Native content snapshot limits");let r={maxFiles:it(n.maxFiles,"Native snapshot maxFiles"),maxFileBytes:it(n.maxFileBytes,"Native snapshot maxFileBytes"),maxTotalBytes:it(n.maxTotalBytes,"Native snapshot maxTotalBytes"),maxManifestBytes:it(n.maxManifestBytes,"Native snapshot maxManifestBytes"),...n.maxDurationMs===void 0?{}:{maxDurationMs:it(n.maxDurationMs,"Native snapshot maxDurationMs")}},a;if(e.policy!==void 0){let v=W(e.policy,"Native snapshot policy");if(z(v,om,"Native snapshot policy"),v.schema!=="comet.native.snapshot-policy.v1")throw new Error("Native snapshot policy schema is invalid");if(!Array.isArray(v.include)||!Array.isArray(v.exclude))throw new Error("Native snapshot policy patterns must be arrays");a=Em({include:v.include,exclude:v.exclude,hash:v.hash,schema:"comet.native.snapshot-policy.v1"}).manifest}if(!Array.isArray(e.entries)||!Array.isArray(e.omitted))throw new Error("Native content snapshot entries and omissions must be arrays");let o=e.entries.map(Cm),s=e.omitted.map(Rm),c=ae(e.omittedCount,"Native content snapshot omittedCount"),l=e.omissionOverflow===void 0?void 0:Pm(e.omissionOverflow);if(o.length>r.maxFiles)throw new Error("Native content snapshot exceeds its file-count limit");if(o.some(v=>v.size>r.maxFileBytes)||o.reduce((v,R)=>v+R.size,0)>r.maxTotalBytes)throw new Error("Native content snapshot exceeds its byte limits");if(new Set(o.map(v=>v.path)).size!==o.length)throw new Error("Native content snapshot contains duplicate paths");if(s.length>tm||c<s.length)throw new Error("Native content snapshot omission count is invalid");let d=c-s.length;if(d===0&&l||d>0&&l?.count!==d)throw new Error("Native content snapshot omission overflow is inconsistent");if(e.complete!==(c===0))throw new Error("Native content snapshot completeness is inconsistent");let u=s.filter(v=>v.reason==="git-enumeration-limit"),f=s.filter(v=>v.reason==="git-selection-changed");for(let v of[...u,...f])if(v.path!=="."||v.size!==null||v.type!=="directory")throw new Error("Native Git selection omission must use the project-root sentinel");if(u.length>1||f.length>1)throw new Error("Native Git selection omissions must not be duplicated");let m=i?.provider==="git"?i.gitSelection:i?.projection?.selection,g=m?.status==="overflow"||m?.status==="overflow-and-changed",h=m?.status==="changed"||m?.status==="overflow-and-changed";if(g!==(u.length===1))throw new Error("Native Git enumeration omission and selection evidence are inconsistent");if(h!==(f.length===1))throw new Error("Native Git selection-change omission and selection evidence are inconsistent");let p=s.filter(v=>v.reason==="physical-enumeration-limit"),y=s.filter(v=>v.reason==="physical-selection-changed");for(let v of[...p,...y])if(v.path!=="."||v.size!==null||v.type!=="directory")throw new Error("Native physical selection omission must use the project-root sentinel");if(p.length>1||y.length>1)throw new Error("Native physical selection omissions must not be duplicated");let N=i?.physicalSelection,k=N?.status==="overflow"||N?.status==="overflow-and-changed",S=N?.status==="changed"||N?.status==="overflow-and-changed";if(k!==(p.length===1))throw new Error("Native physical enumeration omission and evidence are inconsistent");if(S!==(y.length===1))throw new Error("Native physical selection-change omission and evidence are inconsistent");let E={schema:"comet.native.content-snapshot.v1",origin:e.origin,...i?{capture:i}:{},createdAt:e.createdAt,complete:e.complete,limits:r,...a?{policy:a}:{},entries:o,omitted:s,omittedCount:c,...l?{omissionOverflow:l}:{}};if(bm(E)>r.maxManifestBytes)throw new Error("Native content snapshot exceeds its manifest byte limit");return E}function xm(t,e){if(!nm.test(e))throw new Error(`Invalid Native change name: ${e}`);let i=gn.join(t.changesDir,e);if(!re(t.changesDir,i))throw new Error("Native change path escaped");return gn.join(i,"runtime","baseline-manifest.json")}async function Uc(t,e){let i=xm(t,e);await j(t.nativeRoot,i);try{let n=await Mc({root:t.nativeRoot,file:i,maxBytes:im,label:"Native baseline snapshot manifest"});return Kc(JSON.parse(n.text))}catch(n){if(n.code==="ENOENT")return null;throw n}}var $m=Cn(Ui(),1);var KN=256*1024;var sb={runStateBytes:256*1024,trajectoryBytes:8*1024*1024,trajectoryEvents:4096,trajectoryEventBytes:256*1024,checkpointBytes:256*1024,pendingActionBytes:256*1024,contextBytes:1024*1024,artifactsBytes:1024*1024};var Eb=16*1024,Cb=process.platform;var $e="comet.native.v3",He="comet.native.v2",Le="comet.native.v1";var Qc=["schema","name","language","phase","brief","approval","spec_changes","verification_result","verification_report","archived","created_at","run_id"],Mm=new Set(Qc),Zc=new Set([...Qc,"minimum_runtime_version","revision"]),Bm=new Set([...Zc,"approved_contract_hash","implementation_scope","verification_evidence","partial_allowance","verification_protocol"]),Dm=new Set(["capability","operation","source","base_hash"]),qm=new Set(["shape","build","verify","archive"]),Vm=new Set(["implicit","confirmed"]),Wm=new Set(["pending","pass","fail"]),Me="comet-state.yaml",Ea=/^[a-f0-9]{64}$/u,el=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u,zm=/^runtime\/evidence\/(scopes|allowances|verifications)\/([a-f0-9]{64})\.json$/u,Ca=class extends Error{constructor(i,n){super(`Native change ${i} uses ${n}; run comet native doctor ${i} --repair before mutating it`);this.change=i;this.schema=n;this.name="NativeSchemaMigrationRequiredError"}change;schema;code="native-schema-migration-required"},Se=class extends Error{constructor(i,n){super(i!==$e||n===null?`Unsupported Native change schema ${i} for runtime protocol ${3}`:`Native change ${i} requires runtime protocol ${n}; current protocol is ${3}`);this.schema=i;this.minimumRuntimeVersion=n;this.name="NativeRuntimeCompatibilityError"}schema;minimumRuntimeVersion;code="native-runtime-incompatible"},yn=class extends Error{constructor(i,n,r){super(`Native change ${i} revision conflict: expected ${n}, actual ${r}`);this.change=i;this.expectedRevision=n;this.actualRevision=r;this.name="NativeChangeRevisionConflictError"}change;expectedRevision;actualRevision;code="native-change-revision-conflict"},Nn=class extends Error{constructor(i,n){super(`Native working directory already contains active change${n.length===1?"":"s"} ${n.join(", ")}; create the new change in a separate worktree`);this.requestedIsolation=i;this.activeChanges=n;this.name="NativeWorkspaceIsolationRequiredError"}requestedIsolation;activeChanges;code="native-workspace-isolation-required"},bn=class extends Error{constructor(i,n,r,a,o,s=null,c=null){super(`Native change ${i} baseline is incomplete (${n} omitted entr${n===1?"y":"ies"}). Adjust native.snapshot scope or resource budgets in .comet/config.yaml, then retry.`);this.change=i;this.omittedCount=n;this.omittedByReason=r;this.samplePaths=a;this.sampleTruncated=o;this.effectiveLimits=s;this.policyHash=c;this.name="NativeBaselineIncompleteError"}change;omittedCount;omittedByReason;samplePaths;sampleTruncated;effectiveLimits;policyHash;code="native-baseline-incomplete"},Xb=["# Outcome","","# Scope","","# Non-goals","","# Acceptance examples","","# Constraints and invariants","","# Decisions","","# Open questions","","# Verification expectations",""].join(`
|
|
145
|
-
`);function Jt(t,e){if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`${e} must be a mapping`);return t}function tl(t,e,i){let n=Object.keys(t).filter(r=>!e.has(r));if(n.length>0)throw new Error(`${i} has unknown field(s): ${n.join(", ")}`)}function Gt(t){if(!el.test(t))throw new Error(`Invalid Native change name: ${t}`)}function Jm(t){if(!el.test(t))throw new Error(`Invalid Native capability id: ${t}`)}function il(t,e){if(t.length===0||Fe.isAbsolute(t)||/^(?:[A-Za-z]:|~|[\\/])/u.test(t)||t.split(/[\\/]/u).includes(".."))throw new Error(`${e} must stay inside the Native change`)}function Gm(t,e){let i=Jt(t,`spec_changes[${e}]`);if(tl(i,Dm,`spec_changes[${e}]`),typeof i.capability!="string")throw new Error("spec change capability is required");if(Jm(i.capability),i.operation!=="create"&&i.operation!=="replace"&&i.operation!=="remove")throw new Error(`Invalid spec operation for ${i.capability}`);let n=i.source,r=i.base_hash;if(n!==void 0&&typeof n!="string")throw new Error(`Spec source for ${i.capability} must be a string`);if(typeof n=="string"&&il(n,`Spec source for ${i.capability}`),i.operation==="create"){if(!n)throw new Error(`Create spec ${i.capability} requires source`);if(r!==null)throw new Error(`Create spec ${i.capability} requires null base_hash`)}else if(i.operation==="replace"){if(!n)throw new Error(`Replace spec ${i.capability} requires source`);if(typeof r!="string"||!Ea.test(r))throw new Error(`Replace spec ${i.capability} requires a SHA-256 base_hash`)}else{if(n!==void 0)throw new Error(`Remove spec ${i.capability} forbids source`);if(typeof r!="string"||!Ea.test(r))throw new Error(`Remove spec ${i.capability} requires a SHA-256 base_hash`)}return{capability:i.capability,operation:i.operation,...typeof n=="string"?{source:n}:{},base_hash:r}}function Km(t){return/^\d{4}-\d{2}-\d{2}$/u.test(t)?new Date(`${t}T00:00:00.000Z`).toISOString().slice(0,10)===t:!1}function Pa(t,e){if(tl(t,e,Me),typeof t.name!="string")throw new Error("Native change name is required");if(Gt(t.name),t.language!=="en"&&t.language!=="zh-CN")throw new Error("Native change language must be en or zh-CN");if(typeof t.phase!="string"||!qm.has(t.phase))throw new Error("Native change phase is invalid");if(t.brief!=="brief.md")throw new Error("Native change brief must be brief.md");if(t.approval!==null&&!Vm.has(t.approval))throw new Error("Native change approval is invalid");if(!Array.isArray(t.spec_changes))throw new Error("Native spec_changes must be an array");let i=t.spec_changes.map(Gm),n=i.map(r=>r.capability).filter((r,a,o)=>o.indexOf(r)!==a);if(n.length>0)throw new Error(`Duplicate Native capability operation: ${[...new Set(n)].join(", ")}`);if(typeof t.verification_result!="string"||!Wm.has(t.verification_result))throw new Error("Native verification_result is invalid");if(t.verification_report!==null&&typeof t.verification_report!="string")throw new Error("Native verification_report must be a string or null");if(typeof t.verification_report=="string"&&il(t.verification_report,"Native verification_report"),typeof t.archived!="boolean")throw new Error("Native archived must be boolean");if(typeof t.created_at!="string"||!Km(t.created_at))throw new Error("Native created_at must be a valid YYYY-MM-DD date");if(t.run_id!==null&&(typeof t.run_id!="string"||t.run_id.length===0))throw new Error("Native run_id must be a non-empty string or null");return{name:t.name,language:t.language,phase:t.phase,brief:"brief.md",approval:t.approval,spec_changes:i,verification_result:t.verification_result,verification_report:t.verification_report,archived:t.archived,created_at:t.created_at,run_id:t.run_id}}function Aa(t){let e=Jt(t,Me);if(e.schema!==Le)throw new Error(`Expected ${Le}`);return{schema:Le,...Pa(e,Mm)}}function zt(t,e){if(!Number.isSafeInteger(t)||t<1)throw new Error(`${e} must be a positive integer`);return t}function Sa(t,e,i){if(t===null)return null;let n=typeof t=="string"?zm.exec(t):null;if(!n||n[1]!==i)throw new Error(`${e} must be null or runtime/evidence/${i}/<sha256>.json relative to the Native change`);return t}function Um(t){if(t==null)return null;if(typeof t!="string"||!Ea.test(t))throw new Error("Native approved_contract_hash must be null or a SHA-256 hash");return t}function Ym(t){if(t===void 0)return"legacy-v1";if(t!=="legacy-v1")throw new Error("Native verification_protocol must be legacy-v1");return t}function xa(t){let e=Jt(t,Me);if(e.schema!==He)throw new Error(`Expected ${He}`);if(zt(e.minimum_runtime_version,"Native v2 minimum_runtime_version")!==2)throw new Error(`Native ${He} minimum_runtime_version must be 2`);return{schema:He,minimum_runtime_version:2,revision:zt(e.revision,"Native v2 revision"),...Pa(e,Zc)}}function Ta(t){let e=Jt(t,Me);if(e.schema!==$e){if(e.schema===Le||e.schema===He){let o=e.schema===Le?Aa(e):xa(e);throw new Ca(o.name,o.schema)}throw new Se(typeof e.schema=="string"?e.schema:"(missing)",typeof e.minimum_runtime_version=="number"?e.minimum_runtime_version:null)}let i=zt(e.minimum_runtime_version,"Native minimum_runtime_version");if(i>3)throw new Se(e.schema,i);if(i!==3)throw new Error(`Native ${e.schema} minimum_runtime_version must be ${3}`);let n=zt(e.revision,"Native revision"),r=Pa(e,Bm),a=Um(e.approved_contract_hash);if(r.approval===null&&a!==null)throw new Error("Native approved_contract_hash requires an approval");return{schema:$e,minimum_runtime_version:3,revision:n,verification_protocol:Ym(e.verification_protocol),...r,approved_contract_hash:a,implementation_scope:Sa(e.implementation_scope,"Native implementation_scope","scopes"),verification_evidence:Sa(e.verification_evidence,"Native verification_evidence","verifications"),partial_allowance:Sa(e.partial_allowance,"Native partial_allowance","allowances")}}function Xm(t){let e=Jt(t,Me);if(e.schema===Le){let r=Aa(e);return{status:"migration-required",schema:r.schema,minimumRuntimeVersion:1,state:r,message:`Native change ${r.name} requires migration to ${$e}`}}if(e.schema===He){let r=xa(e);return{status:"migration-required",schema:r.schema,minimumRuntimeVersion:r.minimum_runtime_version,state:r,message:`Native change ${r.name} requires migration to ${$e}`}}if(e.schema!==$e){let r=typeof e.minimum_runtime_version=="number"&&Number.isSafeInteger(e.minimum_runtime_version)?e.minimum_runtime_version:null;return{status:"runtime-incompatible",schema:typeof e.schema=="string"?e.schema:"(missing)",minimumRuntimeVersion:r,state:null,message:new Se(typeof e.schema=="string"?e.schema:"(missing)",r).message}}let i=zt(e.minimum_runtime_version,"Native minimum_runtime_version");if(i>3)return{status:"runtime-incompatible",schema:e.schema,minimumRuntimeVersion:i,state:null,message:new Se(e.schema,i).message};let n=Ta(e);return{status:"current",schema:n.schema,minimumRuntimeVersion:n.minimum_runtime_version,state:n}}function H(t,e){Gt(e);let i=Fe.join(t.changesDir,e);if(!re(t.changesDir,i))throw new Error("Native change path escaped");return i}async function Ia(t,e){let i=Fe.join(H(t,e),"runtime","schema-migration.json");await j(t.nativeRoot,i);try{return await Fm.lstat(i),!0}catch(n){if(n.code==="ENOENT")return!1;throw n}}var Qm=256*1024;async function Zm(t,e=Fe.dirname(t)){let i=Fe.relative(e,t).split(Fe.sep).join("/"),n=await Y({root:e,ref:i,maxBytes:Qm}),r=(0,Ra.parseDocument)(n.text,{uniqueKeys:!0});if(r.errors.length>0)throw new Error(`Invalid Native change file ${t}: ${r.errors[0].message}`);return r.toJS()}async function nl(t,e){let i=Fe.join(H(t,e),Me);await j(t.nativeRoot,i);let n=Xm(await Zm(i,t.nativeRoot));if(n.state&&n.state.name!==e)throw new Error(`Native change directory/name mismatch: ${e}`);return await Ia(t,e)?{status:"migration-required",schema:n.schema,minimumRuntimeVersion:n.minimumRuntimeVersion,state:n.state,message:`Native schema migration is incomplete for ${e}; run doctor --repair`}:(n.status==="current"&&n.state&&await ev(t,n.state),n)}async function ev(t,e){if(await Uc(t,e.name)!==null&&e.verification_protocol!=="legacy-v1")throw new Error(`Native verification protocol is unsupported: ${e.verification_protocol}`)}import{createHash as tv}from"crypto";function Z(t){throw new TypeError(`Value is not valid canonical JSON: ${t}`)}function iv(t,e){e.has(t)&&Z("cyclic structures are not supported"),e.add(t);try{let i=Object.keys(t);for(let n=0;n<t.length;n+=1)Object.prototype.hasOwnProperty.call(t,n)||Z("sparse arrays are not supported");return(i.length!==t.length||i.some((n,r)=>n!==String(r)))&&Z("arrays must not have named enumerable properties"),Object.getOwnPropertySymbols(t).length>0&&Z("symbol properties are not supported"),`[${t.map(n=>_a(n,e)).join(",")}]`}finally{e.delete(t)}}function nv(t,e){let i=Object.getPrototypeOf(t);i!==Object.prototype&&i!==null&&Z("only plain objects are supported"),e.has(t)&&Z("cyclic structures are not supported"),Object.getOwnPropertySymbols(t).length>0&&Z("symbol properties are not supported"),e.add(t);try{let n=Object.getOwnPropertyDescriptors(t);return`{${Object.keys(t).sort().map(o=>{let s=n[o];return(!s||!("value"in s))&&Z("accessor properties are not supported"),`${JSON.stringify(o)}:${_a(s.value,e)}`}).join(",")}}`}finally{e.delete(t)}}function _a(t,e){if(t===null)return"null";switch(typeof t){case"boolean":return t?"true":"false";case"string":return JSON.stringify(t);case"number":return Number.isFinite(t)||Z("numbers must be finite"),JSON.stringify(Object.is(t,-0)?0:t);case"object":return Array.isArray(t)?iv(t,e):nv(t,e);case"bigint":case"function":case"symbol":case"undefined":return Z(`${typeof t} values are not supported`)}return Z("unsupported value type")}function Oa(t){return _a(t,new Set)}function ee(t,e){if(t.length===0)throw new TypeError("Canonical hash tag must be non-empty");if(/[\r\n]/u.test(t))throw new TypeError("Canonical hash tag must not contain a line break");return tv("sha256").update(`${t}
|
|
146
|
-
${Oa(e)}`).digest("hex")}var ik=Object.freeze({maxItems:16,maxTextBytes:512,maxContextItems:4,maxContextItemBytes:256,maxFailedCheckIds:16,maxSerializedBytes:32*1024}),rl=Object.freeze({maxCriteria:1024});var lk={maxAcceptanceCriteria:rl.maxCriteria};var Be={maxSpecs:64,maxFileBytes:Xi,maxTotalBytes:4*1024*1024};import{promises as pl}from"fs";import ml from"path";var rv=["Outcome","Scope","Non-goals","Acceptance examples"],yk=[...rv,"Constraints and invariants","Decisions","Open questions","Verification expectations"];var Tk={maxArtifacts:128,maxFileBytes:16*1024*1024,maxTotalBytes:64*1024*1024,maxDocumentBytes:256*1024};var ol=1024*1024;var cl={root:"/comet/native-runtime",packageKind:"runtime",definition:{apiVersion:"comet/v1alpha1",kind:"Skill",metadata:{name:"comet-native-runtime",version:"3",description:"Comet-owned state runtime for the Native workflow."},goal:{statement:"Advance a Native change only after its current guard passes.",inputs:[],outputs:[],success:["The Native change and Run state agree on the next phase."]},orchestration:{mode:"deterministic",entry:"shape",steps:[{id:"shape",action:{type:"checkpoint"},next:"build"},{id:"build",action:{type:"checkpoint"},next:"verify"},{id:"verify",action:{type:"checkpoint"},next:"archive"},{id:"archive",action:{type:"checkpoint"}}]},skills:[],agents:[],tools:[]},guardrails:{allowedSkills:[],allowedAgents:[],allowedTools:[],maxIterations:Number.MAX_SAFE_INTEGER,maxRetriesPerAction:2,confirmationRequiredFor:[]},evals:[]},ov=D("comet-native-runtime:v3:semantic-repair-budget"),rS=[{skillVersion:"2",skillHash:D("comet-native-runtime:v2:max-iterations-32")},{skillVersion:"1",skillHash:D("comet-native-runtime:v1")}];var dl=["schema","id","change","evidenceHash","createdAt","previousState","nextState","previousRun","nextRun","eventData"],LS=new Set(dl),fv=new Set([...dl,"minimum_runtime_version","revision"]),FS=new Set([...fv,"operation"]),MS=512*1024,dv=new Set(["previousPhase","nextPhase","evidenceHash","summary","artifacts","noCodeReason","verificationResult"]),BS=new Set([...dv,"implementationScopeHash","repairScopeHash","repairStagnation"]);var vl=Be.maxSpecs*4;async function hv(t,e){let i=ml.join(H(t,e),"specs"),n;try{n=await Na({root:t.nativeRoot,directory:i,label:"Native proposed specs directory"})}catch(s){if(s.code==="ENOENT")return[];throw s}let r=[],a=0,o=await pl.opendir(i);try{for await(let s of o){if(a+=1,a>vl)throw new Error(`Native proposed specs directory exceeds ${vl} entries`);if(s.isSymbolicLink())throw new Error(`Proposed spec capability must not be a symbolic link: ${s.name}`);if(!s.isDirectory())continue;Gt(s.name);let c=ml.join(i,s.name,"spec.md");await j(t.nativeRoot,c);let l;try{l=await pl.lstat(c)}catch(d){if(d.code==="ENOENT")continue;throw d}if(l.isSymbolicLink()||!l.isFile())throw new Error(`Proposed spec must be a regular file: ${s.name}`);if(r.push(s.name),r.length>Be.maxSpecs)throw new Error("Native proposed specs exceed the spec-count budget")}}finally{await o.close().catch(s=>{if(s.code!=="ERR_DIR_CLOSED")throw s})}return await n.verify(),r.sort()}async function yl(t,e){let i=H(t,e),n={},r=0;for(let a of await hv(t,e)){let o=await Y({root:i,ref:`specs/${a}/spec.md`,maxBytes:Be.maxFileBytes});if(r+=o.size,r>Be.maxTotalBytes)throw new Error("Native proposed specs exceed the total byte budget");n[a]=o.text}return n}import _v from"path";var pv=Object.freeze({maxChanges:32,maxSpecsPerChange:64,maxArtifactsPerChange:128,maxTotalSpecs:512,maxTotalArtifacts:1024,maxSignalsPerRelationship:8,maxRelationships:256,maxSerializedBytes:64*1024,maxNameBytes:128,maxCapabilityBytes:128,maxArtifactPathBytes:512});var Nl="scoped-text-safety",mv=1,vv=Object.freeze({maxFiles:256,maxFileBytes:2*1024*1024,maxTotalBytes:8*1024*1024,maxIssues:128});var gv="comet.native.checker-policy.v1";var OE=ee(gv,{policy:Nl,version:mv,limits:vv,checks:["conflict-marker","space-before-tab","trailing-whitespace"],binaryHandling:"skip-and-count"});var wv=["contract-before-does-not-match-scope","implementation-before-does-not-match-scope","contract-changed-during-check","implementation-changed-during-check","contract-after-does-not-match-scope","implementation-after-does-not-match-scope"],jE=new Set(wv);var yv=ol,QE=3*yv;import{execFile as Rv,spawn as EC}from"node:child_process";import{promisify as Pv}from"node:util";var mC=512*1024;var Ut=class extends Error{recovery;constructor(e,i){super(e),this.name="NativeReceiptScopeStaleError",this.recovery=i}};var MC=64*1024;var BC=3600*1e3;var DC=Pv(Rv);var qC=["$ProgressPreference = 'SilentlyContinue'","$encoded = $env:COMET_NATIVE_COMMAND_PAYLOAD","Remove-Item Env:COMET_NATIVE_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("; ");var kn=class extends Error{details;constructor(e){let i=e.length===0?"Native verification receipt binding is invalid":`Native verification receipt binding is invalid (${e.length} receipt(s)): ${e.map(n=>`${n.ref}${n.acceptanceId?`[${n.acceptanceId}]`:""} -> ${n.mismatches.join("; ")}`).join(" | ")}`;super(i),this.name="NativeVerificationReceiptBindingError",this.details=e}};var AR={maxDepth:128,maxEntries:2e4,maxFileBytes:64*1024*1024,maxTotalBytes:256*1024*1024,maxManifestBytes:16*1024*1024,maxRefBytes:4*1024};var MR=16*1024*1024,BR=256*1024,DR=16*1024;var WR=16*1024;var tP=16*1024;var qP=16*1024*1024,Sn=class extends Error{constructor(i,n,r,a){super(`Canonical spec conflict for ${i}: expected ${n??"(missing)"}, actual ${r??"(missing)"}`);this.capability=i;this.expectedHash=n;this.actualHash=r;this.canonicalPath=a;this.name="NativeSpecConflictError"}capability;expectedHash;actualHash;canonicalPath;code="native-spec-conflict"},En=class extends Error{constructor(i,n=i.ready?"Native Archive preflight no longer matches the expected hash":`Native Archive preflight is blocked: ${i.findingCodes.join(", ")}`){super(n);this.preflight=i;this.name="NativeArchivePreflightError"}preflight;code="native-archive-preflight"};var bl=10*1024*1024,Ee=class extends Error{};function kl(t,e){let i=t.flatMap((n,r)=>n===e?[r]:[]);if(i.length>1)throw new Ee(`${e} may only be provided once`);return i.length===0?!1:(t.splice(i[0],1),!0)}function Sl(t,e){let i=t.flatMap((a,o)=>a===e?[o]:[]);if(i.length>1)throw new Ee(`${e} may only be provided once`);if(i.length===0)return;let n=i[0],r=t[n+1];if(r===void 0||r.startsWith("--"))throw new Ee(`${e} requires a value`);return t.splice(n,2),r}function El(t){if(t.length>0)throw new Ee(`Unexpected argument: ${t[0]}`)}function Cl(t,e){let i=t.shift();if(!i||i.startsWith("--"))throw new Ee(`${e} is required`);return i}async function Rl(t){return t?_v.resolve(t):un(process.cwd())}async function Pl(t){let e=await Lc({startPath:t,allowMissingConfig:!1});return{config:e.config,paths:e.paths}}function $a(t,e,i){return{command:t,exitCode:0,data:e,text:i??JSON.stringify(e,null,2)+`
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
142
|
+
`,i)+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 i=dr(e),r=ft(i);return r.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let i=dr(e),r=ft(i);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,i){return this.type!=="comment"||this.indent<=i?!1:e.every(r=>r.type==="newline"||r.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};Yc.Parser=xa});var tl=w(Qt=>{"use strict";var Xc=ha(),Op=qt(),Xt=Jt(),Hp=dn(),Dp=P(),Bp=Pa(),Qc=Ca();function Zc(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new Bp.LineCounter||null,prettyErrors:e}}function Lp(t,e={}){let{lineCounter:i,prettyErrors:r}=Zc(e),n=new Qc.Parser(i?.addNewLine),a=new Xc.Composer(e),o=Array.from(a.compose(n.parse(t)));if(r&&i)for(let s of o)s.errors.forEach(Xt.prettifyError(t,i)),s.warnings.forEach(Xt.prettifyError(t,i));return o.length>0?o:Object.assign([],{empty:!0},a.streamInfo())}function el(t,e={}){let{lineCounter:i,prettyErrors:r}=Zc(e),n=new Qc.Parser(i?.addNewLine),a=new Xc.Composer(e),o=null;for(let s of a.compose(n.parse(t),!0,t.length))if(!o)o=s;else if(o.options.logLevel!=="silent"){o.errors.push(new Xt.YAMLParseError(s.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return r&&i&&(o.errors.forEach(Xt.prettifyError(t,i)),o.warnings.forEach(Xt.prettifyError(t,i))),o}function Mp(t,e,i){let r;typeof e=="function"?r=e:i===void 0&&e&&typeof e=="object"&&(i=e);let n=el(t,i);if(!n)return null;if(n.warnings.forEach(a=>Hp.warn(n.options.logLevel,a)),n.errors.length>0){if(n.options.logLevel!=="silent")throw n.errors[0];n.errors=[]}return n.toJS(Object.assign({reviver:r},i))}function Fp(t,e,i){let r=null;if(typeof e=="function"||Array.isArray(e)?r=e:i===void 0&&e&&(i=e),typeof i=="string"&&(i=i.length),typeof i=="number"){let n=Math.round(i);i=n<1?void 0:n>8?{indent:8}:{indent:n}}if(t===void 0){let{keepUndefined:n}=i??e??{};if(!n)return}return Dp.isDocument(t)&&!r?t.toString(i):new Op.Document(t,r,i).toString(i)}Qt.parse=Mp;Qt.parseAllDocuments=Lp;Qt.parseDocument=el;Qt.stringify=Fp});var Zt=w(C=>{"use strict";var Vp=ha(),qp=qt(),Wp=Gn(),Ra=Jt(),zp=Ct(),Ce=P(),Jp=ke(),Gp=T(),Up=Ee(),Kp=Pe(),Yp=lr(),Xp=Sa(),Qp=Pa(),Zp=Ca(),hr=tl(),il=St();C.Composer=Vp.Composer;C.Document=qp.Document;C.Schema=Wp.Schema;C.YAMLError=Ra.YAMLError;C.YAMLParseError=Ra.YAMLParseError;C.YAMLWarning=Ra.YAMLWarning;C.Alias=zp.Alias;C.isAlias=Ce.isAlias;C.isCollection=Ce.isCollection;C.isDocument=Ce.isDocument;C.isMap=Ce.isMap;C.isNode=Ce.isNode;C.isPair=Ce.isPair;C.isScalar=Ce.isScalar;C.isSeq=Ce.isSeq;C.Pair=Jp.Pair;C.Scalar=Gp.Scalar;C.YAMLMap=Up.YAMLMap;C.YAMLSeq=Kp.YAMLSeq;C.CST=Yp;C.Lexer=Xp.Lexer;C.LineCounter=Qp.LineCounter;C.Parser=Zp.Parser;C.parse=hr.parse;C.parseAllDocuments=hr.parseAllDocuments;C.parseDocument=hr.parseDocument;C.stringify=hr.stringify;C.visit=il.visit;C.visitAsync=il.visitAsync});var io=mi(Zt(),1);import{promises as cg}from"fs";import Xe from"path";import{execFileSync as em}from"child_process";import pr from"path";function Aa(t,e){return em("git",["-C",t,...e],{encoding:"utf8",stdio:["ignore","pipe","ignore"],timeout:1e4,windowsHide:!0}).trim()}function tm(t,e){let i=pr.normalize(t),r=pr.normalize(e);return process.platform==="win32"?i.toLowerCase()===r.toLowerCase():i===r}function ht(t){try{let e=pr.resolve(Aa(t,["rev-parse","--show-toplevel"])),r=Aa(t,["worktree","list","--porcelain","-z"]).split("\0").find(o=>o.startsWith("worktree ")),n=r?pr.resolve(r.slice(9)):e,a=null;try{a=Aa(t,["symbolic-ref","--quiet","--short","HEAD"])||null}catch{}return{isGitWorktree:!0,isSecondaryWorktree:!tm(e,n),currentWorktreeRoot:e,primaryWorktreeRoot:n,currentBranch:a}}catch{return{isGitWorktree:!1,isSecondaryWorktree:!1,currentWorktreeRoot:null,primaryWorktreeRoot:null,currentBranch:null}}}import{createHash as am}from"node:crypto";import{promises as re}from"node:fs";import K from"node:path";import{TextDecoder as om}from"node:util";var im=new Set([".cache",".git",".gradle",".gnupg",".mypy_cache",".next",".npm",".pnpm-store",".pytest_cache",".ssh",".turbo",".venv",".yarn","__pycache__","node_modules","venv"]),rm=new Set([".git-credentials",".netrc",".npmrc",".pypirc","auth.json","credentials.json"]);function nm(t){return t.toLowerCase().startsWith(".env")}function ei(t){let i=t.replaceAll("\\","/").split("/").filter(Boolean).map(r=>r.toLowerCase());return i.some(r=>nm(r))?"environment-file":i.some(r=>rm.has(r))?"credential-config":i.includes(".git")?"git-metadata":i.some(r=>im.has(r))?"dependency-or-cache":i.join("/")===".comet/config.yaml"?"comet-config":i.join("/")===".comet/current-change.json"?"comet-selection":null}function Re(t){return t!==0&&t!==0n&&t!=="0"}function ie(t,e){return Re(t.dev)&&Re(e.dev)&&Re(t.ino)&&Re(e.ino)}function I(t,e){let i=Re(t.dev)&&Re(e.dev);if(i&&t.dev!==e.dev)return!1;let r=Re(t.ino)&&Re(e.ino);return r&&t.ino!==e.ino?!1:i&&r?!0:t.birthtime===e.birthtime}var vr=1024*1024;function _a(t,e){let i=K.relative(t,e);return i===""||!K.isAbsolute(i)&&i!==".."&&!i.startsWith(`..${K.sep}`)}function sm(t){let e=K.posix.normalize(t);if(t.length===0||t!==t.trim()||t.includes("\\")||Array.from(t).some(n=>{let a=n.codePointAt(0)??0;return a<=31||a===127})||K.posix.isAbsolute(e)||/^(?:[A-Za-z]:|~)/u.test(t)||t.split("/").includes("..")||e!==t||e==="."||t.endsWith("/"))throw new Error(`Native artifact ref must be normalized and relative: ${t}`);let i=t.toLowerCase(),r=ei(t);if(r||i==="runtime"||i.startsWith("runtime/"))throw new Error(`Native artifact ref is excluded as sensitive (${r??"native-runtime"}): ${t}`);return t}function cm(t){if(!Number.isSafeInteger(t)||t<1)throw new Error("Native artifact byte limit must be a positive integer");return t}function lm(t,e){return I({...t,birthtime:t.birthtimeMs},{...e,birthtime:e.birthtimeMs})}function mr(t,e){let i={...t,birthtime:t.birthtimeMs},r={...e,birthtime:e.birthtimeMs};return ie(i,r)?I(i,r):I(i,r)&&t.birthtimeMs===e.birthtimeMs&&t.ctimeMs===e.ctimeMs&&t.size===e.size}async function rl(t){let e=await re.lstat(t);if(!e.isDirectory()||e.isSymbolicLink())throw new Error(`Native artifact parent must be a real directory: ${t}`);return{path:t,realPath:await re.realpath(t),dev:e.dev,ino:e.ino,birthtimeMs:e.birthtimeMs}}async function um(t,e){let i=K.resolve(t),r=K.resolve(e);if(!_a(i,r))throw new Error("Native artifact path is outside its root");let n=[await rl(i)],a=i;for(let o of K.relative(i,r).split(K.sep).filter(Boolean)){a=K.join(a,o);let s=await rl(a);if(!_a(n[0].realPath,s.realPath))throw new Error(`Native artifact parent resolves outside its root: ${a}`);n.push(s)}return n}async function nl(t){for(let e of t){let i=await re.lstat(e.path);if(!i.isDirectory()||i.isSymbolicLink()||!lm(e,i)||await re.realpath(e.path)!==e.realPath)throw new Error(`Native artifact parent changed while reading: ${e.path}`)}}async function M(t){let e=sm(t.ref),i=t.maxBytes===null?null:cm(t.maxBytes??vr),r=K.resolve(t.root,...e.split("/")),n=await um(t.root,K.dirname(r));await t.hooks?.afterParentChainCaptured?.();let a=await re.lstat(r);if(!a.isFile()||a.isSymbolicLink())throw new Error(`Native artifact must be a regular file: ${e}`);if(i!==null&&a.size>i)throw new Error(`Native artifact exceeds ${i} bytes: ${e}`);let o=await re.realpath(r);if(!_a(n[0].realPath,o))throw new Error(`Native artifact resolves outside its root: ${e}`);let s=await re.open(r,"r");try{let[c,l,d]=await Promise.all([s.stat(),re.lstat(r),re.realpath(r)]);if(await nl(n),!c.isFile()||!l.isFile()||l.isSymbolicLink()||d!==o||!mr(a,c)||!mr(c,l))throw new Error(`Native artifact changed while opening: ${e}`);await t.hooks?.afterOpen?.();let u=[],f=0,p=Buffer.allocUnsafe(i===null?64*1024:Math.min(64*1024,i+1));for(;;){let k=i===null?p.length:i+1-f,S=await s.read(p,0,Math.min(p.length,k),null);if(S.bytesRead===0)break;if(f+=S.bytesRead,i!==null&&f>i)throw new Error(`Native artifact exceeds ${i} bytes: ${e}`);u.push(Buffer.from(p.subarray(0,S.bytesRead)))}await t.hooks?.beforeFinalCheck?.();let[g,h,m]=await Promise.all([s.stat(),re.lstat(r),re.realpath(r)]);if(await nl(n),!h.isFile()||h.isSymbolicLink()||m!==o||!mr(c,g)||!mr(c,h))throw new Error(`Native artifact changed while reading: ${e}`);let y=Buffer.concat(u,f),N;try{N=new om("utf-8",{fatal:!0}).decode(y)}catch(k){throw new Error(`Native artifact is not valid UTF-8: ${e}`,{cause:k})}return{ref:e,size:f,hash:t.includeHash===!1?null:am("sha256").update(y).digest("hex"),text:N}}finally{await s.close()}}var Ia=mi(Zt(),1);import gr from"path";var ii=64*1024,wr=1024,yr=64,ja=5,dm=[".agents/skills/**",".amazonq/skills/**",".augment/skills/**",".bob/skills/**",".claude/skills/**",".cline/skills/**",".codebuddy/skills/**",".continue/skills/**",".cospec/skills/**",".crush/skills/**",".cursor/skills/**",".factory/skills/**",".forge/skills/**",".gemini/skills/**",".github/skills/**",".iflow/skills/**",".junie/skills/**",".kilocode/skills/**",".kimi-code/skills/**",".kiro/skills/**",".lingma/skills/**",".mimocode/skills/**",".opencode/skills/**",".pi/skills/**",".qoder/skills/**",".qwen/skills/**",".roo/skills/**",".trae-cn/skills/**",".trae/skills/**",".windsurf/skills/**",".zcode/skills/**"],fm=["**/.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"],hm=[...dm,...fm].sort((t,e)=>t.localeCompare(e,"en"));var G={include:["**/*"],exclude:[...hm],max_files:1e4,max_total_bytes:256*1024*1024,max_duration_ms:6e4};function pm(t,e){if(typeof t!="string")throw new Error(`${e} must be a string`);let i=t.trim();if(i.length===0||gr.posix.isAbsolute(i)||gr.win32.isAbsolute(i)||/^(?:~|[\\/])/u.test(i))throw new Error(`${e} must be a project-relative path`);if(i===".")return[];let r=i.replaceAll("\\","/").split("/");if(r.some(n=>n===".."))throw new Error(`${e} must stay inside the project root`);if(r.some(n=>n===""||n==="."))throw new Error(`${e} must not contain empty or dot path segments`);return r}function ze(t){let e=pm(t,"native.artifact_root");return e.length===0?".":e.join("/")}function ol(t,e="docs"){let i=t??e;if(i!=="legacy"&&i!=="docs")throw new Error("classic.artifact_layout must be legacy or docs");return i}function $a(t,e,i=!1){if(typeof t!="string")throw new Error(`${e} must be a string`);let r=t.trim().replaceAll("\\","/");if(r.length===0||gr.posix.isAbsolute(r)||gr.win32.isAbsolute(r)||/^(?:~|[\\/])/u.test(r))throw new Error(`${e} must be relative to its declared path base`);let n=r.split("/");if(n.some(a=>a===".."))throw new Error(`${e} must stay inside its declared path base`);if(n.some(a=>a===""||a==="."))throw new Error(`${e} must not contain empty or dot path segments`);if(!i&&/[*?]/u.test(r))throw new Error(`${e} cannot contain wildcards`);return n.join("/")}function ti(t,e){if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`${e} must be a mapping`);return t}function sl(t,e,i){let r=t??e;if(r!=="en"&&r!=="zh-CN")throw new Error(`${i} must be en or zh-CN`);return r}function Nr(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>wr)throw new Error(`${e} exceeds ${wr} characters`);let i=0;for(let r=0;r<t.length;r+=1)t[r]==="?"?i+=1:t[r]==="*"&&(i+=1,t[r+1]==="*"&&(r+=1));if(i>yr)throw new Error(`${e} contains more than ${yr} wildcard tokens`);return t}function al(t,e,i){if(t===void 0)return[...i];if(!Array.isArray(t))throw new Error(`${e} contains an unsafe pattern`);return[...new Set(t.map(r=>Nr(r,e)))].sort((r,n)=>r.localeCompare(n,"en"))}function Ta(t,e,i){let r=t??e;if(!Number.isSafeInteger(r)||r<1)throw new Error(`${i} must be a positive integer`);return r}function mm(t){if(t===void 0)return{...G,include:[...G.include],exclude:[...G.exclude]};let e=ti(t,"native.snapshot");return{include:al(e.include,"native.snapshot.include",G.include),exclude:al(e.exclude,"native.snapshot.exclude",G.exclude),max_files:Ta(e.max_files,G.max_files,"native.snapshot.max_files"),max_total_bytes:Ta(e.max_total_bytes,G.max_total_bytes,"native.snapshot.max_total_bytes"),max_duration_ms:Ta(e.max_duration_ms,G.max_duration_ms,"native.snapshot.max_duration_ms")}}function vm(t){if(t===void 0)return;let e=ti(t,"native.pending_root_move"),i=e.id,r=e.from_artifact_root,n=e.to_artifact_root,a=e.stage;if(typeof i!="string"||!/^[a-f0-9-]{8,}$/u.test(i))throw new Error("native.pending_root_move.id is invalid");if(typeof r!="string"||typeof n!="string")throw new Error("native.pending_root_move roots must be strings");if(a!=="copying"&&a!=="ready"&&a!=="switched")throw new Error("native.pending_root_move.stage is invalid");let o;if(e.cleanup!==void 0){let s=ti(e.cleanup,"native.pending_root_move.cleanup"),c=s.kind,l=s.state,d=s.manifest_hash;if(c!=="forward-source"&&c!=="restart-staging"&&c!=="rollback-destination"&&c!=="rollback-staging")throw new Error("native.pending_root_move.cleanup.kind is invalid");if(l!=="prepared"&&l!=="quarantined"&&l!=="deleting")throw new Error("native.pending_root_move.cleanup.state is invalid");if(typeof d!="string"||!/^[a-f0-9]{64}$/u.test(d))throw new Error("native.pending_root_move.cleanup.manifest_hash is invalid");o={kind:c,state:l,manifestHash:d}}return{id:i,fromArtifactRoot:ze(r),toArtifactRoot:ze(n),stage:a,...o?{cleanup:o}:{}}}function gm(t,e={}){let i=ti(t,"native"),r=i.artifact_root??(e.allowMissingArtifactRoot?"docs":void 0);if(typeof r!="string")throw new Error("native.artifact_root must be a string");let n=i.clarification_mode??"batch";if(n!=="sequential"&&n!=="batch")throw new Error("native.clarification_mode must be sequential or batch");let a=i.archive_confirmation??"automatic";if(a!=="automatic"&&a!=="required")throw new Error("native.archive_confirmation must be automatic or required");let o=i.max_verify_failures??ja;if(!Number.isSafeInteger(o)||o<1)throw new Error("native.max_verify_failures must be a positive integer");let s=vm(i.pending_root_move);return{artifact_root:ze(r),language:sl(i.language,"en","native.language"),clarification_mode:n,archive_confirmation:a,max_verify_failures:o,snapshot:mm(i.snapshot),...s?{pending_root_move:s}:{}}}function wm(t){let e=ti(t,"classic"),i=e.context_compression??"off";if(i!=="off"&&i!=="beta")throw new Error("classic.context_compression must be off or beta");let r=e.review_mode??"standard";if(r!=="off"&&r!=="standard"&&r!=="thorough")throw new Error("classic.review_mode must be off, standard, or thorough");let n=e.auto_transition??!0;if(typeof n!="boolean")throw new Error("classic.auto_transition must be true or false");return{artifact_layout:ol(e.artifact_layout),language:sl(e.language,"zh-CN","classic.language"),context_compression:i,review_mode:r,auto_transition:n}}function ym(t){let e=t??!0;if(typeof e!="boolean")throw new Error("ambient_resume must be true or false");return e}function Nm(t,e,i,r,n){let a=t.schema!==void 0;if(!(a||t.default_workflow!==void 0||t.workflows!==void 0||!n.allowPartialProject&&t.native!==void 0)||n.allowPartialProject&&!a)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 s=t.workflows??[t.default_workflow];if(!Array.isArray(s)||s.length===0||s.some(l=>l!=="native"&&l!=="classic"))throw new Error("workflows must contain native and/or classic");let c=[...new Set(s)];if(!c.includes(t.default_workflow))throw new Error("workflows must include default_workflow");if(c.includes("native")&&!e)throw new Error("native must be a mapping");return{schema:"comet.project.v1",default_workflow:t.default_workflow,workflows:c,ambient_resume:r,...e?{native:e}:{},...i?{classic:i}:{}}}function ri(t,e={}){let i=(0,Ia.parseDocument)(t,{uniqueKeys:!0});if(i.errors.length>0)throw new Error(`Invalid .comet/config.yaml: ${i.errors[0].message}`);let r=i.toJS();if(r==null)return{value:{},config:null,ambient_resume:!0};if(typeof r!="object"||Array.isArray(r))throw new Error("Invalid .comet/config.yaml: root must be a mapping");let n=r,a=ym(n.ambient_resume),o=n.native===void 0?void 0:gm(n.native,{allowMissingArtifactRoot:e.allowMissingNativeFields}),s=n.classic===void 0?void 0:wm(n.classic),c=Nm(n,o,s,a,{allowPartialProject:e.allowPartialProject??!1});return{value:n,config:c,ambient_resume:a,...o?{native:o}:{},...s?{classic:s}:{}}}function br(t="docs",e="en"){return{schema:"comet.project.v1",default_workflow:"native",ambient_resume:!0,native:{artifact_root:ze(t),language:e,clarification_mode:"batch",archive_confirmation:"automatic",max_verify_failures:ja,snapshot:{...G,include:[...G.include],exclude:[...G.exclude]}}}}import{createHash as km}from"crypto";import{promises as Er}from"fs";import Ae from"path";import{constants as kr,promises as Je}from"fs";var de=class extends Error{reason;constructor(e,i,r){super(i,r),this.name="RaceSafeReadError",this.reason=e}};function Oa(t){return"birthtimeNs"in t&&typeof t.birthtimeNs=="bigint"?t.birthtimeNs:t.birthtimeMs}function cl(t){return"ctimeNs"in t&&typeof t.ctimeNs=="bigint"?t.ctimeNs:t.ctimeMs}function ni(t){return{dev:t.dev,ino:t.ino,birthtime:Oa(t)}}function Sr(t,e){let i=ni(t),r=ni(e);return ie(i,r)?I(i,r):I(i,r)&&Oa(t)===Oa(e)&&cl(t)===cl(e)&&t.size===e.size}async function ai(t,e,i={}){if(!Number.isSafeInteger(e)||e<1)throw new Error("race-safe read byte limit must be a positive integer");let r=i.label??"file",n=i.bigint===!0,a=await Je.lstat(t,{bigint:n});if(!a.isFile()||a.isSymbolicLink())throw new de("not-regular-file",`${r} must be a regular file`);if(BigInt(a.size)>BigInt(e))throw new de("too-large",`${r} exceeds ${e} bytes`);let o=await Je.realpath(t);await i.verify?.("pre-open",{realPath:o,identity:ni(a)});let s=process.platform==="win32"?kr.O_RDONLY:kr.O_RDONLY|kr.O_NOFOLLOW|kr.O_NONBLOCK,c;try{c=await Je.open(t,s)}catch(l){throw l.code==="ELOOP"?new de("not-regular-file",`${r} must be a regular file`,{cause:l}):l}try{let[l,d,u]=await Promise.all([c.stat({bigint:n}),Je.lstat(t,{bigint:n}),Je.realpath(t)]);if(!l.isFile()||!d.isFile()||d.isSymbolicLink()||u!==o||!Sr(a,l)||!Sr(a,d))throw new de("changed",`${r} changed while opening`);await i.verify?.("post-open",{realPath:u,identity:ni(l)}),await i.hooks?.afterOpen?.();let f=[],p=0,g=Buffer.allocUnsafe(Math.min(64*1024,e+1));for(;;){let N=e+1-p,{bytesRead:k}=await c.read(g,0,Math.min(g.length,N),null);if(k===0)break;if(p+=k,p>e)throw new de("too-large",`${r} exceeds ${e} bytes`);f.push(Buffer.from(g.subarray(0,k)))}await i.hooks?.beforeFinalCheck?.();let[h,m,y]=await Promise.all([c.stat({bigint:n}),Je.lstat(t,{bigint:n}),Je.realpath(t)]);if(!m.isFile()||m.isSymbolicLink()||y!==o||!Sr(a,h)||!Sr(a,m))throw new de("changed",`${r} changed while reading`);return await i.verify?.("post-read",{realPath:y,identity:ni(h)}),{bytes:Buffer.concat(f,p),stat:h,realPath:y}}finally{await c.close()}}function bm(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}function Ha(t,e){let i=Ae.relative(t,e);return i===""||!Ae.isAbsolute(i)&&i!==".."&&!i.startsWith(`..${Ae.sep}`)}async function ll(t,e){let i=Ae.resolve(t),r=await Er.lstat(i);if(!r.isDirectory()||r.isSymbolicLink())throw new Error(`${e} project root must be a real directory`);return Er.realpath(i)}async function ul(t,e,i,r){let n=t;for(let a=0;a<i.length;a++){n=Ae.join(n,i[a]);let o;try{o=await Er.lstat(n)}catch(d){if(bm(d))return{exists:!1,kind:"missing"};throw d}let s=Ae.relative(t,n).replaceAll("\\","/");if(o.isSymbolicLink())throw new Error(`${r.label} crosses a symbolic link or junction at ${s}`);let c=a===i.length-1;if(!c&&!o.isDirectory())throw new Error(`${r.label} ancestor ${s} must be a real directory`);if(c&&(r.expected==="file"&&!o.isFile()||r.expected==="directory"&&!o.isDirectory()||r.expected==="any"&&!o.isFile()&&!o.isDirectory()))throw new Error(`${r.label} must be a real ${r.expected}`);let l=await Er.realpath(n);if(!Ha(e,l))throw new Error(`${r.label} resolves outside the project root`);if(c)return{exists:!0,kind:o.isFile()?"file":o.isDirectory()?"directory":"missing"}}return{exists:!0,kind:"directory"}}async function pt(t,e,i){let r=$a(e,i.label),n=Ae.resolve(t),a=await ll(n,i.label),o=r.split("/"),s=Ae.resolve(n,...o);if(!Ha(n,s))throw new Error(`${i.label} must stay inside the project root`);let c=await ul(n,a,o,i);return{projectRoot:n,target:s,relative:r,exists:c.exists,kind:c.kind}}async function _e(t,e,i,r){let n=await pt(t,e,{label:r.label,expected:"file"});if(!n.exists){let o=new Error(`${r.label} does not exist`);throw o.code="ENOENT",o}let a=await ll(n.projectRoot,r.label);return ai(n.target,i,{...r,verify:async(o,s)=>{if(!Ha(a,s.realPath))throw new Error(`${r.label} resolves outside the project root`);await ul(n.projectRoot,a,n.relative.split("/"),{label:r.label,expected:"file"})}})}var oi=".comet/config.yaml";function Sm(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}async function Da(t,e={}){return(await Pr(t,e)).document}async function Em(t){try{return(await _e(t,oi,ii,{label:oi})).bytes}catch(e){if(Sm(e))return null;throw e}}function Pm(t){return t?{exists:!0,sha256:km("sha256").update(t).digest("hex")}:{exists:!1,sha256:null}}async function Pr(t,e={}){let i=await Em(t);return{document:i?ri(i.toString("utf8"),e):null,identity:Pm(i)}}var mN=16*1024;import{existsSync as fl,promises as Ge}from"fs";import R from"path";import _m from"os";var xr=".comet/config.yaml",Tm=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u;async function Ma(t){try{return await Ge.lstat(t),!0}catch(e){if(e.code==="ENOENT")return!1;throw e}}async function Im(t){try{let e=await Ge.readFile(t,"utf8");return/^schema:\s*comet\.project\.v1\s*$/mu.test(e)}catch(e){if(e.code==="ENOENT")return!1;throw e}}function vt(t,e){let i=R.relative(t,e);return i===""||!R.isAbsolute(i)&&i!==".."&&!i.startsWith(`..${R.sep}`)}async function mt(t){let e=[],i=t;for(;!await Ma(i);){let n=R.dirname(i);if(n===i)break;e.push(R.basename(i)),i=n}let r=await Ge.realpath(i);return R.resolve(r,...e.reverse())}async function Fa(t){try{return(await Ge.lstat(t)).isSymbolicLink()}catch(e){if(e.code==="ENOENT")return!1;throw e}}async function Cr(t){let e=R.resolve(t);try{(await Ge.stat(e)).isDirectory()||(e=R.dirname(e))}catch(n){if(n.code!=="ENOENT")throw n}let i=e,r=R.resolve(_m.homedir());for(;;){if(!(e===r&&i!==r)){let o=R.join(e,...xr.split("/")),s=e===i||await Im(o);if(await Ma(o)&&s)return e}if(await Ma(R.join(e,".git")))return e;let a=R.dirname(e);if(a===e)return i;e=a}}function Rr(t){return ze(t)}async function jm(t,e){let i=Rr(e),r=R.resolve(t,...i.split("/")),n=await Ge.realpath(t),a=await mt(r);if(!vt(n,a))throw new Error("native.artifact_root resolves outside the project root");return r}async function Ar(t,e){let i=Rr(e),r=await jm(t,i),n=R.join(r,"comet");if(await Fa(n))throw new Error("The configured Native comet root must not be a symbolic link");let[a,o]=await Promise.all([mt(r),mt(n)]);if(!vt(a,o))throw new Error("The configured Native comet root resolves outside its artifact root");let s=R.resolve(t),c=R.join(s,".comet","runtime","native");if(await Fa(c))throw new Error("The Native Runtime root must not be a symbolic link");let[l,d]=await Promise.all([Ge.realpath(s),mt(c)]);if(!vt(l,d))throw new Error("The Native Runtime root resolves outside the project root");return{projectRoot:s,configFile:R.join(t,...xr.split("/")),artifactRoot:r,artifactRootRef:i,nativeRoot:n,specsDir:R.join(n,"specs"),changesDir:R.join(n,"changes"),archiveDir:R.join(n,"archive"),runtimeDir:c,changesRuntimeDir:R.join(c,"changes"),locksDir:R.join(c,"locks"),transactionsDir:R.join(c,"transactions")}}function hl(t){if(!Tm.test(t))throw new Error(`Invalid Native change name: ${t}`)}function _r(t,e){hl(e);let i=R.join(t.changesRuntimeDir,e);if(!B(t.changesRuntimeDir,i))throw new Error("Native change Runtime path escaped");return i}function $m(t,e){hl(e);let i=R.join(t.changesDir,e,"runtime");if(!B(t.changesDir,i))throw new Error("Legacy Native change Runtime path escaped");return i}function Y(t,e){let i=_r(t,e);if(fl(i))return i;let r=$m(t,e);return fl(r)?r:i}function fe(t,e){let i=R.resolve(e);if(B(t.runtimeDir,i))return t.runtimeDir;if(B(t.nativeRoot,i))return t.nativeRoot;throw new Error(`Path is outside Native document and Runtime roots: ${e}`)}function B(t,e){return vt(R.resolve(t),R.resolve(e))}async function O(t,e){let i=R.resolve(t),r=R.resolve(e);if(!vt(i,r))throw new Error(`Path is outside the Native root: ${e}`);if(await Fa(i))throw new Error(`Native root must not be a symbolic link: ${t}`);let[n,a]=await Promise.all([mt(i),mt(r)]);if(!vt(n,a))throw new Error(`Path resolves outside the Native root: ${e}`);return r}var Tr=Nr;function Hm(t="docs",e="en"){return br(t,e)}async function Ke(t){let e=(await Da(t))?.config??null;return e?.native?e:null}async function pl(t){let e=await Cr(t.startPath),i=await Ke(e);if(!i&&t.allowMissingConfig===!1)throw new Error(`${xr} was not found`);if(i?.native.pending_root_move)throw new Error(`Native root move ${i.native.pending_root_move.id} is incomplete; use comet native doctor --repair`);let r=t.explicitArtifactRoot?Rr(t.explicitArtifactRoot):void 0;if(i&&r&&r!==i.native.artifact_root)throw new Error(`Configured Native artifact root is ${i.native.artifact_root}; refusing conflicting root ${r}`);let n=i??Hm(r??"docs"),a=await Ar(e,n.native.artifact_root);return{config:n,paths:a,configured:i!==null}}import{AsyncLocalStorage as Dm}from"async_hooks";var MN=16*1024;var FN=new Dm;import{createHash as Bm}from"crypto";function ne(t){throw new TypeError(`Value is not valid canonical JSON: ${t}`)}function Lm(t,e){e.has(t)&&ne("cyclic structures are not supported"),e.add(t);try{let i=Object.keys(t);for(let r=0;r<t.length;r+=1)Object.prototype.hasOwnProperty.call(t,r)||ne("sparse arrays are not supported");return(i.length!==t.length||i.some((r,n)=>r!==String(n)))&&ne("arrays must not have named enumerable properties"),Object.getOwnPropertySymbols(t).length>0&&ne("symbol properties are not supported"),`[${t.map(r=>Va(r,e)).join(",")}]`}finally{e.delete(t)}}function Mm(t,e){let i=Object.getPrototypeOf(t);i!==Object.prototype&&i!==null&&ne("only plain objects are supported"),e.has(t)&&ne("cyclic structures are not supported"),Object.getOwnPropertySymbols(t).length>0&&ne("symbol properties are not supported"),e.add(t);try{let r=Object.getOwnPropertyDescriptors(t);return`{${Object.keys(t).sort().map(o=>{let s=r[o];return(!s||!("value"in s))&&ne("accessor properties are not supported"),`${JSON.stringify(o)}:${Va(s.value,e)}`}).join(",")}}`}finally{e.delete(t)}}function Va(t,e){if(t===null)return"null";switch(typeof t){case"boolean":return t?"true":"false";case"string":return JSON.stringify(t);case"number":return Number.isFinite(t)||ne("numbers must be finite"),JSON.stringify(Object.is(t,-0)?0:t);case"object":return Array.isArray(t)?Lm(t,e):Mm(t,e);case"bigint":case"function":case"symbol":case"undefined":return ne(`${typeof t} values are not supported`)}return ne("unsupported value type")}function qa(t){return Va(t,new Set)}function ae(t,e){if(t.length===0)throw new TypeError("Canonical hash tag must be non-empty");if(/[\r\n]/u.test(t))throw new TypeError("Canonical hash tag must not contain a line break");return Bm("sha256").update(`${t}
|
|
143
|
+
${qa(e)}`).digest("hex")}var JN=Object.freeze({maxItems:16,maxTextBytes:512,maxContextItems:4,maxContextItemBytes:256,maxFailedCheckIds:16,maxSerializedBytes:32*1024}),ml=Object.freeze({maxCriteria:1024});var za=mi(Zt(),1);import{promises as zm}from"node:fs";var ci="comet.native.v4";var Jm=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u,Gm=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u,Um=/^A[1-9][0-9]*$/u,Km=new Set(["schema","name","language","phase","status","state_version","brief","spec_changes","workspace","loop","acceptance","builder_handoff","blockers","verification","history","history_overflow","verification_result","verification_report","archived","created_at"]);function q(t,e){if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`${e} must be an object`);return t}function W(t,e,i){let r=Object.keys(t).filter(n=>!e.has(n));if(r.length>0)throw new Error(`${i} has unknown field(s): ${r.join(", ")}`)}function L(t,e,i){if(typeof t!="string"||!i?.empty&&t.length===0)throw new Error(`${e} must be ${i?.empty?"a string":"a non-empty string"}`);return t}function Wa(t,e){return t===null?null:L(t,e)}function gt(t,e){if(typeof t!="boolean")throw new Error(`${e} must be a boolean`);return t}function _(t,e,i=0){if(!Number.isSafeInteger(t)||t<i)throw new Error(`${e} must be a safe integer greater than or equal to ${i}`);return t}function Ym(t,e){return t===null?null:_(t,e,Number.MIN_SAFE_INTEGER)}function D(t,e,i){if(typeof t!="string"||!e.includes(t))throw new Error(`${i} must be one of: ${e.join(", ")}`);return t}function he(t,e,i){if(!Array.isArray(t))throw new Error(`${e} must be an array`);return t.map((r,n)=>i(r,n))}function Ir(t,e){return he(t,e,(i,r)=>L(i,`${e}[${r}]`))}function Ye(t,e){if(new Set(t).size!==t.length)throw new Error(`${e} must be unique`)}function wt(t,e){let i=L(t,e);if(Number.isNaN(Date.parse(i)))throw new Error(`${e} must be an ISO date or timestamp`);return i}function Ja(t,e,i=!1){let r=L(t,e);if(r.includes("\\")||r.startsWith("/")||/^[A-Za-z]:/u.test(r)||r.split("/").includes("..")||!i&&(r==="."||r.split("/").includes(".")))throw new Error(`${e} must be a portable relative path`);return r}function oe(t,e){let i=q(t,e);return W(i,new Set(["text","truncated"]),e),{text:L(i.text,`${e}.text`,{empty:!0}),truncated:gt(i.truncated,`${e}.truncated`)}}function Xm(t,e){let i=`Native spec_changes[${e}]`,r=q(t,i);W(r,new Set(["capability","operation","source"]),i);let n=L(r.capability,`${i}.capability`);if(!Gm.test(n))throw new Error(`${i}.capability is invalid`);let a=D(r.operation,["create","modify","remove"],`${i}.operation`),o=r.source===null?null:Ja(r.source,`${i}.source`);if(a==="remove"&&o!==null)throw new Error(`${i} remove requires source null`);if(a!=="remove"&&o===null)throw new Error(`${i} ${a} requires a source`);return{capability:n,operation:a,source:o}}function Qm(t){let e="Native workspace",i=q(t,e);W(i,new Set(["isolation","change_branch","target_branch","finish"]),e);let r=D(i.isolation,["current","branch","worktree"],`${e}.isolation`),n=Wa(i.change_branch,`${e}.change_branch`),a=Wa(i.target_branch,`${e}.target_branch`),o=i.finish===null?null:D(i.finish,["merge","push","pull-request","keep"],`${e}.finish`);if(r==="current"&&o!==null)throw new Error("Native current workspace cannot contain a finish action");if(r==="current"&&n===null!=(a===null))throw new Error("Native workspace branch bindings must both be present or both be null");if(r!=="current"&&(n===null||a===null))throw new Error("Native isolated workspace requires change_branch and target_branch");return{isolation:r,change_branch:n,target_branch:a,finish:o}}function Zm(t){let e="Native loop",i=q(t,e);W(i,new Set(["stage","goal_cycle","iteration","attempt","retry_epoch","failed_iteration_count","no_progress_count","execution_failure_count","previous_unresolved_ids","next_action"]),e);let r=Ir(i.previous_unresolved_ids,`${e}.previous_unresolved_ids`);return Ye(r,`${e}.previous_unresolved_ids`),{stage:D(i.stage,["shape","building","verify-ready","repairing","archive-ready","await-user","blocked","done"],`${e}.stage`),goal_cycle:_(i.goal_cycle,`${e}.goal_cycle`,1),iteration:_(i.iteration,`${e}.iteration`),attempt:_(i.attempt,`${e}.attempt`),retry_epoch:_(i.retry_epoch,`${e}.retry_epoch`),failed_iteration_count:_(i.failed_iteration_count,`${e}.failed_iteration_count`),no_progress_count:_(i.no_progress_count,`${e}.no_progress_count`),execution_failure_count:_(i.execution_failure_count,`${e}.execution_failure_count`),previous_unresolved_ids:r,next_action:Wa(i.next_action,`${e}.next_action`)}}function ev(t,e){let i=`Native acceptance[${e}]`,r=q(t,i);W(r,new Set(["id","source","text","result","reason"]),i);let n=L(r.id,`${i}.id`);if(!Um.test(n))throw new Error(`${i}.id must use A1, A2, ...`);return{id:n,source:Ja(r.source,`${i}.source`),text:L(r.text,`${i}.text`),result:D(r.result,["pending","passed","failed","blocked"],`${i}.result`),reason:r.reason===null?null:oe(r.reason,`${i}.reason`)}}function tv(t,e){let i=`Native builder_handoff.checks[${e}]`,r=q(t,i);return W(r,new Set(["name","result","note"]),i),{name:oe(r.name,`${i}.name`),result:D(r.result,["passed","failed","not-run"],`${i}.result`),note:r.note===null?null:oe(r.note,`${i}.note`)}}function iv(t){let e="Native builder_handoff",i=q(t,e);W(i,new Set(["candidate_id","identity_provider","builder_execution_ref","iteration","summary","addressed_acceptance_ids","checks","checks_truncated","known_limits","known_limits_truncated","submitted_at"]),e);let r=Ir(i.addressed_acceptance_ids,`${e}.addressed_acceptance_ids`);return Ye(r,`${e}.addressed_acceptance_ids`),{candidate_id:L(i.candidate_id,`${e}.candidate_id`),identity_provider:L(i.identity_provider,`${e}.identity_provider`),builder_execution_ref:L(i.builder_execution_ref,`${e}.builder_execution_ref`),iteration:_(i.iteration,`${e}.iteration`,1),summary:oe(i.summary,`${e}.summary`),addressed_acceptance_ids:r,checks:he(i.checks,`${e}.checks`,tv),checks_truncated:gt(i.checks_truncated,`${e}.checks_truncated`),known_limits:he(i.known_limits,`${e}.known_limits`,(n,a)=>oe(n,`${e}.known_limits[${a}]`)),known_limits_truncated:gt(i.known_limits_truncated,`${e}.known_limits_truncated`),submitted_at:wt(i.submitted_at,`${e}.submitted_at`)}}function rv(t,e){let i=`Native blockers[${e}]`,r=q(t,i);W(r,new Set(["owner","reason","acceptance_ids","resolution_action"]),i);let n=Ir(r.acceptance_ids,`${i}.acceptance_ids`);return Ye(n,`${i}.acceptance_ids`),{owner:D(r.owner,["builder","runtime","verifier","user","external"],`${i}.owner`),reason:oe(r.reason,`${i}.reason`),acceptance_ids:n,resolution_action:D(r.resolution_action,["return-build","retry-verifier","resolve-verifier-blocker","confirm-verifier-unavailable","await-user","wait-external"],`${i}.resolution_action`)}}function nv(t,e){let i=`Native verification.checks[${e}]`,r=q(t,i);return W(r,new Set(["id","name","argv_display","argv_truncated","cwd_ref","status","exit_code","duration_ms"]),i),{id:L(r.id,`${i}.id`),name:oe(r.name,`${i}.name`),argv_display:he(r.argv_display,`${i}.argv_display`,(n,a)=>oe(n,`${i}.argv_display[${a}]`)),argv_truncated:gt(r.argv_truncated,`${i}.argv_truncated`),cwd_ref:Ja(r.cwd_ref,`${i}.cwd_ref`,!0),status:D(r.status,["passed","failed","interrupted"],`${i}.status`),exit_code:Ym(r.exit_code,`${i}.exit_code`),duration_ms:_(r.duration_ms,`${i}.duration_ms`)}}function av(t){let e="Native verification",i=q(t,e);W(i,new Set(["candidate_id","identity_provider","verifier_execution_ref","iteration","attempt","assurance","verdict","checks","summary","risks","risks_truncated","completed_at"]),e);let r=he(i.checks,`${e}.checks`,nv);Ye(r.map(a=>a.id),`${e}.checks IDs`);let n=L(i.identity_provider,`${e}.identity_provider`);return{candidate_id:L(i.candidate_id,`${e}.candidate_id`),identity_provider:n,verifier_execution_ref:L(i.verifier_execution_ref,`${e}.verifier_execution_ref`),iteration:_(i.iteration,`${e}.iteration`,1),attempt:_(i.attempt,`${e}.attempt`,1),assurance:i.assurance===void 0?n==="skill-coordinated"?"skill-coordinated":"host-attested":D(i.assurance,["host-attested","skill-coordinated","semantic-verification-unavailable","user-confirmed-degraded"],`${e}.assurance`),verdict:D(i.verdict,["pass","fail","blocked"],`${e}.verdict`),checks:r,summary:oe(i.summary,`${e}.summary`),risks:he(i.risks,`${e}.risks`,(a,o)=>oe(a,`${e}.risks[${o}]`)),risks_truncated:gt(i.risks_truncated,`${e}.risks_truncated`),completed_at:wt(i.completed_at,`${e}.completed_at`)}}function ov(t,e){let i=`Native history[${e}]`,r=q(t,i);W(r,new Set(["goal_cycle","iteration","attempt","outcome","unresolved_ids","summary","completed_at"]),i);let n=Ir(r.unresolved_ids,`${i}.unresolved_ids`);return Ye(n,`${i}.unresolved_ids`),{goal_cycle:_(r.goal_cycle,`${i}.goal_cycle`,1),iteration:_(r.iteration,`${i}.iteration`),attempt:_(r.attempt,`${i}.attempt`),outcome:D(r.outcome,["pass","fail","blocked","execution-error","recovery"],`${i}.outcome`),unresolved_ids:n,summary:oe(r.summary,`${i}.summary`),completed_at:wt(r.completed_at,`${i}.completed_at`)}}function sv(t){let e="Native history_overflow.outcome_counts",i=q(t,e),r=["pass","fail","blocked","execution-error","recovery"];return W(i,new Set(r),e),{pass:_(i.pass,`${e}.pass`),fail:_(i.fail,`${e}.fail`),blocked:_(i.blocked,`${e}.blocked`),"execution-error":_(i["execution-error"],`${e}.execution-error`),recovery:_(i.recovery,`${e}.recovery`)}}function cv(t){let e="Native history_overflow",i=q(t,e);W(i,new Set(["dropped_entries","first_dropped_at","last_dropped_at","outcome_counts"]),e);let r=_(i.dropped_entries,`${e}.dropped_entries`),n=i.first_dropped_at===null?null:wt(i.first_dropped_at,`${e}.first_dropped_at`),a=i.last_dropped_at===null?null:wt(i.last_dropped_at,`${e}.last_dropped_at`);if(r===0&&(n!==null||a!==null))throw new Error("Native empty history overflow cannot contain dropped timestamps");if(r>0&&(n===null||a===null))throw new Error("Native non-empty history overflow requires dropped timestamps");let o=sv(i.outcome_counts);if(Object.values(o).reduce((c,l)=>c+l,0)!==r)throw new Error("Native history overflow outcome count must equal dropped_entries");return{dropped_entries:r,first_dropped_at:n,last_dropped_at:a,outcome_counts:o}}function lv(t){let e=new Set(t.acceptance.map(i=>i.id));for(let i of t.loop.previous_unresolved_ids)if(!e.has(i))throw new Error(`Native loop references unknown acceptance ID ${i}`);for(let i of t.builder_handoff?.addressed_acceptance_ids??[])if(!e.has(i))throw new Error(`Native builder handoff references unknown ID ${i}`);for(let i of t.blockers)for(let r of i.acceptance_ids)if(!e.has(r))throw new Error(`Native blocker references unknown ID ${r}`);if(t.builder_handoff&&!(t.builder_handoff.iteration===t.loop.iteration||t.phase==="build"&&t.loop.stage==="repairing"&&t.builder_handoff.iteration===t.loop.iteration-1))throw new Error("Native builder handoff iteration is not current or the prior repair result");if(t.verification){if(!t.builder_handoff)throw new Error("Native verification requires a builder handoff");if(t.verification.candidate_id!==t.builder_handoff.candidate_id)throw new Error("Native verification candidate must match the builder handoff");if(t.verification.identity_provider!==t.builder_handoff.identity_provider)throw new Error("Native Builder and Verifier identity providers must match");if(["skill-coordinated","semantic-verification-unavailable","user-confirmed-degraded"].includes(t.verification.assurance)!==(t.verification.identity_provider==="skill-coordinated"))throw new Error("Native verification assurance does not match its identity provider");if(t.verification.assurance==="semantic-verification-unavailable"&&t.verification.verdict!=="blocked")throw new Error("Native unavailable semantic verification must remain blocked");if(t.verification.assurance==="user-confirmed-degraded"&&t.verification.verdict!=="pass")throw new Error("Native user-confirmed degraded verification must be passing");if(t.verification.verifier_execution_ref===t.builder_handoff.builder_execution_ref)throw new Error("Native Builder and Verifier execution refs must differ");let r=t.verification.iteration===t.loop.iteration&&t.verification.attempt===t.loop.attempt,n=t.phase==="build"&&t.loop.stage==="repairing"&&t.verification.iteration===t.loop.iteration-1&&t.verification.iteration===t.builder_handoff.iteration;if(!r&&!n)throw new Error("Native verification iteration and attempt do not match a stable loop result")}}function uv(t){if(!{shape:new Set(["shape","await-user","blocked"]),build:new Set(["building","repairing","await-user","blocked"]),verify:new Set(["verify-ready","await-user","blocked"]),archive:new Set(["archive-ready","await-user","blocked","done"])}[t.phase].has(t.loop.stage))throw new Error(`Native loop stage ${t.loop.stage} is invalid for phase ${t.phase}`);let i=t.status==="await-user"?"await-user":t.status==="blocked"?"blocked":t.status==="done"?"done":null;if(i!==null&&t.loop.stage!==i)throw new Error(`Native status ${t.status} requires loop stage ${i}`);if(t.status==="active"&&["await-user","blocked","done"].includes(t.loop.stage))throw new Error(`Native active status cannot use loop stage ${t.loop.stage}`);if(t.archived!==(t.status==="done"))throw new Error("Native archived must be true exactly when status is done");if(t.archived&&t.phase!=="archive")throw new Error("Native archived state must be in Archive");if(t.verification_result==="pass"){if(t.verification?.verdict!=="pass")throw new Error("Native pass requires a persisted passing verification");if(t.acceptance.some(r=>r.result!=="passed"))throw new Error("Native pass requires every acceptance item to pass");if(t.verification.checks.some(r=>r.status!=="passed"))throw new Error("Native pass requires every persisted check to pass")}if(t.verification?.assurance==="semantic-verification-unavailable"&&(t.phase!=="verify"||t.status!=="await-user"||t.verification_result!=="blocked"||t.loop.next_action!=="confirm-verifier-unavailable"))throw new Error("Native unavailable semantic verification must await explicit user confirmation");if(t.verification_report!==null&&t.verification===null)throw new Error("Native verification report requires persisted verification")}function Ga(t){let e=q(t,"Native portable state");if(W(e,Km,"Native portable state"),e.schema!==ci)throw new Error(`Native portable state schema must be ${ci}`);let i=L(e.name,"Native state name");if(!Jm.test(i))throw new Error("Native state name is invalid");if(e.brief!=="brief.md")throw new Error("Native state brief must be brief.md");let r=he(e.spec_changes,"Native spec_changes",Xm);Ye(r.map(s=>s.capability),"Native spec change capabilities");let n=he(e.acceptance,"Native acceptance",ev);Ye(n.map(s=>s.id),"Native acceptance IDs");let a=he(e.history,"Native history",ov);if(a.length>50)throw new Error(`Native history cannot exceed ${50} entries`);let o={schema:ci,name:i,language:D(e.language,["en","zh-CN"],"Native state language"),phase:D(e.phase,["shape","build","verify","archive"],"Native state phase"),status:D(e.status,["active","await-user","blocked","done"],"Native state status"),state_version:_(e.state_version,"Native state_version",1),brief:"brief.md",spec_changes:r,workspace:Qm(e.workspace),loop:Zm(e.loop),acceptance:n,builder_handoff:e.builder_handoff===null?null:iv(e.builder_handoff),blockers:he(e.blockers,"Native blockers",rv),verification:e.verification===null?null:av(e.verification),history:a,history_overflow:cv(e.history_overflow),verification_result:D(e.verification_result,["pending","pass","fail","blocked"],"Native verification_result"),verification_report:e.verification_report===null?null:D(e.verification_report,["verification.md"],"Native verification_report"),archived:gt(e.archived,"Native archived"),created_at:wt(e.created_at,"Native created_at")};return lv(o),uv(o),o}function dv(t,e){let i=(0,za.parseDocument)(t,{uniqueKeys:!0});if(i.errors.length>0)throw new Error(`${e} is invalid YAML: ${i.errors[0].message}`);return i.toJS({mapAsMap:!1})}async function gl(t){let e=await zm.readFile(t,"utf8");return Ga(dv(e,"Native portable state"))}var Te="comet.native.v3",Ie="comet.native.v2",je="comet.native.v1";var yl="[a-z][a-z0-9]*(?:-[a-z0-9]+)*",mb=new RegExp(`^portable-archive-(${yl})\\.json$`,"u"),vb=new RegExp(`^portable-migration-(${yl})\\.json$`,"u");import{TextDecoder as yv}from"util";import{createHash as fv}from"node:crypto";import{constants as Hr,promises as se}from"node:fs";import ce from"node:path";import{TextDecoder as hv}from"node:util";function Br(t,e){let i=ce.relative(t,e);return i===""||!ce.isAbsolute(i)&&i!==".."&&!i.startsWith(`..${ce.sep}`)}function pv(t){if(!Number.isSafeInteger(t)||t<1)throw new Error("Native protected file byte limit must be a positive integer");return t}function mv(t,e){return I({...t,birthtime:t.birthtimeMs},{...e,birthtime:e.birthtimeMs})}function vv(t){return{dev:t.dev,ino:t.ino,birthtimeMs:t.birthtimeMs,ctimeMs:t.ctimeMs,mtimeMs:t.mtimeMs,size:t.size}}function Dr(t,e){return I({...t,birthtime:t.birthtimeMs},{...e,birthtime:e.birthtimeMs})&&t.birthtimeMs===e.birthtimeMs&&t.ctimeMs===e.ctimeMs&&t.mtimeMs===e.mtimeMs&&t.size===e.size}async function Ua(t,e){let i=await se.lstat(t);if(!i.isDirectory()||i.isSymbolicLink())throw new Error(`${e} parent must be a real directory: ${t}`);return{path:t,realPath:await se.realpath(t),dev:i.dev,ino:i.ino,birthtimeMs:i.birthtimeMs}}async function Nl(t,e,i){let r=ce.resolve(t),n=ce.resolve(e);if(!Br(r,n))throw new Error(`${i} is outside its managed root`);let a=[await Ua(r,i)],o=r;for(let s of ce.relative(r,n).split(ce.sep).filter(Boolean)){await $e(a,i),o=ce.join(o,s);let c=await Ua(o,i);if(!Br(a[0].realPath,c.realPath))throw new Error(`${i} parent resolves outside its managed root: ${o}`);a.push(c)}return await $e(a,i),a}async function $e(t,e){for(let i of t){let r=await se.lstat(i.path);if(!r.isDirectory()||r.isSymbolicLink()||!mv(i,r)||await se.realpath(i.path)!==i.realPath)throw new Error(`${e} parent changed during I/O: ${i.path}`)}}async function gv(t,e,i){let r=[],n=0,a=Buffer.allocUnsafe(Math.min(64*1024,e+1));for(;;){let o=e+1-n,{bytesRead:s}=await t.read(a,0,Math.min(a.length,o),null);if(s===0)break;if(n+=s,n>e)throw new Error(`${i} exceeds ${e} bytes`);r.push(Buffer.from(a.subarray(0,s)))}return Buffer.concat(r,n)}async function yt(t){let e=pv(t.maxBytes),i=ce.resolve(t.file),r=await Nl(t.root,ce.dirname(i),t.label),n=await Promise.all((t.forbiddenRoots??[]).map(d=>Ua(ce.resolve(d),t.label)));await t.hooks?.afterParentChainCaptured?.(),await $e(r,t.label);let a=await se.lstat(i);if(!a.isFile()||a.isSymbolicLink())throw new Error(`${t.label} must be a regular file`);if(a.size>e)throw new Error(`${t.label} exceeds ${e} bytes`);let o=vv(a),s=await se.realpath(i);if(!Br(r[0].realPath,s))throw new Error(`${t.label} resolves outside its managed root`);if(n.some(d=>Br(d.realPath,s)))throw new Error(`${t.label} resolves inside an excluded root`);let c=process.platform==="win32"?Hr.O_RDONLY:Hr.O_RDONLY|Hr.O_NOFOLLOW|Hr.O_NONBLOCK,l=await se.open(i,c);try{let d=await l.stat();await t.hooks?.afterOpen?.();let[u,f]=await Promise.all([se.lstat(i),se.realpath(i)]);if(await $e(r,t.label),await $e(n,t.label),!d.isFile()||!u.isFile()||u.isSymbolicLink()||f!==s||!Dr(o,d)||!Dr(o,u))throw new Error(`${t.label} changed while opening`);await t.hooks?.beforeRead?.();let p=await gv(l,e,t.label);await t.hooks?.beforeFinalCheck?.();let[g,h,m]=await Promise.all([l.stat(),se.lstat(i),se.realpath(i)]);if(await $e(r,t.label),await $e(n,t.label),!h.isFile()||h.isSymbolicLink()||m!==s||!Dr(o,g)||!Dr(o,h))throw new Error(`${t.label} changed while reading`);return{bytes:p,hash:fv("sha256").update(p).digest("hex"),size:p.length}}finally{await l.close()}}async function bl(t){let e=await yt(t),i;try{i=new hv("utf-8",{fatal:!0}).decode(e.bytes)}catch(r){throw new Error(`${t.label} is not valid UTF-8`,{cause:r})}return{...e,text:i}}async function Ka(t){let e=await Nl(t.root,t.directory,t.label);return{verify:()=>$e(e,t.label)}}var Ib=256*1024,jb=1024*1024,$b=16*1024;var Ob=64*1024*1024;var Hb=new yv("utf-8",{fatal:!0});import Qa from"path";import{createHash as bv}from"crypto";function z(t){return bv("sha256").update(t).digest("hex")}var nk={maxFiles:1e4,maxFileBytes:5*1024*1024,maxTotalBytes:64*1024*1024,maxManifestBytes:1024*1024},Sv=1e3,Ev=8*1024*1024,Pv=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u,xv=new Set(["schema","origin","capture","createdAt","complete","limits","entries","omitted","omittedCount","omissionOverflow","policy"]),Cv=new Set(["maxFiles","maxFileBytes","maxTotalBytes","maxManifestBytes","maxDurationMs"]),Rv=new Set(["schema","include","exclude","hash"]),Av=new Set(["provider","gitSelection","physicalSelection","projection"]),_v=new Set(["provider","selection"]),Tv=new Set(["schema","status","stageBefore","combined","stageAfter","finalStageBefore","finalCombined","finalStageAfter"]),Iv=new Set(["hash","recordCount","storedRecordCount","stdoutBytes","overflow"]),jv=new Set(["schema","status","before","after"]),$v=new Set(["hash","visitedNodeCount","recordCount","storedRecordCount","encodedBytes","overflow","unstable"]),Ov=new Set(["path","hash","size","type","gitObjectId"]),Hv=new Set(["path","size","type","reason"]),Dv=new Set(["ref","hash","count"]),Bv=new Set(["change-created","legacy-migration","explicit"]),Lv=new Set(["file","directory","other"]),Mv=new Set(["file-size","file-count","total-size","manifest-size","changed-during-read","unreadable","gitlink-unavailable","gitlink-dirty","gitlink-changed","legacy-gitlink-boundary","git-enumeration-limit","git-selection-changed","physical-enumeration-limit","physical-selection-changed"]),Mr=/^[a-f0-9]{64}$/u,Fv=/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/u;var ak=64*1024,ok=64*1024;var sk={maxRecords:2e4,maxBytes:8*1024*1024,maxRecordBytes:64*1024},ck={maxNodes:2e4,maxBytes:8*1024*1024,maxPathBytes:64*1024};function Lr(t,e){return t.hash===e.hash&&t.recordCount===e.recordCount&&t.storedRecordCount===e.storedRecordCount&&t.stdoutBytes===e.stdoutBytes&&t.overflow===e.overflow}var lk=(1n<<256n)-1n;function Vv(t,e){return t.hash===e.hash&&t.visitedNodeCount===e.visitedNodeCount&&t.recordCount===e.recordCount&&t.storedRecordCount===e.storedRecordCount&&t.encodedBytes===e.encodedBytes&&t.overflow===e.overflow&&t.unstable===e.unstable}function qv(t){return Buffer.byteLength(JSON.stringify(t,null,2)+`
|
|
144
|
+
`)}function Wv(t,e){return z(`comet.native.snapshot-policy.v1
|
|
145
|
+
${JSON.stringify({include:t,exclude:e,hash:"sha256"})}`)}function Xa(t,e,i){let r=new Set(e),n=[...e];for(;n.length>0;){if(i&&!i())return null;let a=n.pop(),o=t[a];o&&(o.kind==="star"||o.kind==="globstar"||o.kind==="globstar-slash")&&!r.has(a+1)&&(r.add(a+1),n.push(a+1))}return r}function zv(t){let e=0;return()=>e>0?(e-=1,!0):t()?(e=63,!0):!1}function xl(t){let e=Tr(t,"Native snapshot pattern"),i=[];for(let r=0;r<e.length;r+=1){let n=e[r];n==="*"&&e[r+1]==="*"?(r+=1,e[r+1]==="/"?(r+=1,i.push({kind:"globstar-slash"})):i.push({kind:"globstar"})):n==="*"?i.push({kind:"star"}):n==="?"?i.push({kind:"question"}):i.push({kind:"literal",value:n})}return(r,n)=>{let a=n?zv(n):void 0;if(a&&!a())return!1;let o=Xa(i,new Set([0]),a);if(o===null)return!1;for(let s of r){if(a&&!a())return!1;let c=new Set;for(let l of o){if(a&&!a())return!1;let d=i[l];d&&(d.kind==="literal"&&d.value===s||d.kind==="question"&&s!=="/"?c.add(l+1):d.kind==="star"&&s!=="/"||d.kind==="globstar"?c.add(l):d.kind==="globstar-slash"&&(c.add(l),s==="/"&&c.add(l+1)))}if(o=Xa(i,c,a),o===null||o.size===0)return!1}return Xa(i,o,a)?.has(i.length)??!1}}function Jv(t){if(t===void 0)return;let e=[...new Set(t.include.map(n=>Tr(n,"include")))].sort((n,a)=>n.localeCompare(a,"en")),i=[...new Set(t.exclude.map(n=>Tr(n,"exclude")))].sort((n,a)=>n.localeCompare(a,"en"));if(e.length===0)throw new Error("Native snapshot policy include must not be empty");let r=Wv(e,i);if("hash"in t&&t.hash!==r)throw new Error("Native snapshot policy hash is invalid");return{manifest:{schema:"comet.native.snapshot-policy.v1",include:e,exclude:i,hash:r},includeMatchers:e.map(xl),excludeMatchers:i.map(xl),excludedDirectoryPrefixes:i.flatMap(n=>{if(!n.endsWith("/**"))return[];let a=n.slice(0,-3);return/[*?]/u.test(a)?[]:[a]}).sort((n,a)=>n.localeCompare(a,"en"))}}function X(t,e){if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`${e} must be an object`);return t}function Q(t,e,i){let r=Object.keys(t).find(n=>!e.has(n));if(r)throw new Error(`${i} contains unknown field: ${r}`)}function bt(t,e){if(!Number.isSafeInteger(t)||t<1)throw new Error(`${e} must be a positive integer`);return t}function pe(t,e){if(!Number.isSafeInteger(t)||t<0)throw new Error(`${e} must be a non-negative integer`);return t}function Al(t,e){if(typeof t!="string"||t.length===0||t.includes("\\")||t.includes("\0"))throw new Error(`${e} must be a normalized project-relative path`);let i=Qa.posix.normalize(t);if(i!==t||Qa.posix.isAbsolute(t)||i===".."||i.startsWith("../"))throw new Error(`${e} must stay inside the project root`);return t}function Gv(t,e){let i=X(t,`Native snapshot entry ${e}`);Q(i,Ov,`Native snapshot entry ${e}`);let r=Al(i.path,`Native snapshot entry ${e} path`);if(typeof i.hash!="string"||!Mr.test(i.hash))throw new Error(`Native snapshot entry ${e} hash is invalid`);if(i.type!=="file")throw new Error(`Native snapshot entry ${e} type is invalid`);let n={path:r,hash:i.hash,size:pe(i.size,`Native snapshot entry ${e} size`),type:"file"};if(i.gitObjectId!==void 0){if(typeof i.gitObjectId!="string"||!Fv.test(i.gitObjectId))throw new Error(`Native snapshot entry ${e} gitObjectId is invalid`);n.gitObjectId=i.gitObjectId}return n}function Uv(t,e){let i=X(t,`Native snapshot omission ${e}`);if(Q(i,Hv,`Native snapshot omission ${e}`),!Lv.has(i.type))throw new Error(`Native snapshot omission ${e} type is invalid`);if(!Mv.has(i.reason))throw new Error(`Native snapshot omission ${e} reason is invalid`);return{path:Al(i.path,`Native snapshot omission ${e} path`),size:i.size===null?null:pe(i.size,`Native snapshot omission ${e} size`),type:i.type,reason:i.reason}}function Kv(t){let e=X(t,"Native snapshot omission overflow");if(Q(e,Dv,"Native snapshot omission overflow"),typeof e.hash!="string"||!Mr.test(e.hash))throw new Error("Native snapshot omission overflow hash is invalid");let i=`native-snapshot://omitted-overflow/${e.hash}`;if(e.ref!==i)throw new Error("Native snapshot omission overflow ref is invalid");return{ref:i,hash:e.hash,count:bt(e.count,"Native snapshot omission overflow count")}}function Nt(t,e){let i=X(t,e);if(Q(i,Iv,e),typeof i.hash!="string"||!Mr.test(i.hash))throw new Error(`${e} hash is invalid`);if(typeof i.overflow!="boolean")throw new Error(`${e} overflow flag is invalid`);let r=pe(i.recordCount,`${e} recordCount`),n=pe(i.storedRecordCount,`${e} storedRecordCount`),a=pe(i.stdoutBytes,`${e} stdoutBytes`);if(n>r||!i.overflow&&n!==r)throw new Error(`${e} stored record count is inconsistent`);return{hash:i.hash,recordCount:r,storedRecordCount:n,stdoutBytes:a,overflow:i.overflow}}function Cl(t){let e=X(t,"Native Git selection evidence");if(Q(e,Tv,"Native Git selection evidence"),e.schema!=="comet.native.git-selection.v1")throw new Error("Native Git selection evidence schema is invalid");if(e.status!=="overflow"&&e.status!=="changed"&&e.status!=="overflow-and-changed")throw new Error("Native Git selection evidence status is invalid");let i=Nt(e.stageBefore,"Native Git selection stageBefore"),r=Nt(e.combined,"Native Git selection combined"),n=Nt(e.stageAfter,"Native Git selection stageAfter"),a=Nt(e.finalStageBefore,"Native Git selection finalStageBefore"),o=Nt(e.finalCombined,"Native Git selection finalCombined"),s=Nt(e.finalStageAfter,"Native Git selection finalStageAfter"),c=[i,r,n,a,o,s].some(u=>u.overflow),l=!Lr(i,n)||!Lr(n,a)||!Lr(r,o)||!Lr(a,s),d=c&&l?"overflow-and-changed":c?"overflow":"changed";if(!c&&!l)throw new Error("Native Git selection evidence must describe an exceptional selection");if(e.status!==d)throw new Error("Native Git selection evidence status is inconsistent");return{schema:"comet.native.git-selection.v1",status:d,stageBefore:i,combined:r,stageAfter:n,finalStageBefore:a,finalCombined:o,finalStageAfter:s}}function Rl(t,e){let i=X(t,e);if(Q(i,$v,e),typeof i.hash!="string"||!Mr.test(i.hash))throw new Error(`${e} hash is invalid`);if(typeof i.overflow!="boolean"||typeof i.unstable!="boolean")throw new Error(`${e} flags are invalid`);let r=pe(i.visitedNodeCount,`${e} visitedNodeCount`),n=pe(i.recordCount,`${e} recordCount`),a=pe(i.storedRecordCount,`${e} storedRecordCount`),o=pe(i.encodedBytes,`${e} encodedBytes`);if(a>n||!i.overflow&&a!==n)throw new Error(`${e} stored record count is inconsistent`);return{hash:i.hash,visitedNodeCount:r,recordCount:n,storedRecordCount:a,encodedBytes:o,overflow:i.overflow,unstable:i.unstable}}function Yv(t){let e=X(t,"Native physical selection evidence");if(Q(e,jv,"Native physical selection evidence"),e.schema!=="comet.native.physical-selection.v1")throw new Error("Native physical selection evidence schema is invalid");if(e.status!=="overflow"&&e.status!=="changed"&&e.status!=="overflow-and-changed")throw new Error("Native physical selection evidence status is invalid");let i=Rl(e.before,"Native physical selection before"),r=Rl(e.after,"Native physical selection after"),n=i.overflow||r.overflow,a=i.unstable||r.unstable||!Vv(i,r);if(!n&&!a)throw new Error("Native physical selection evidence must describe an exceptional selection");let o=n&&a?"overflow-and-changed":n?"overflow":"changed";if(e.status!==o)throw new Error("Native physical selection evidence status is inconsistent");return{schema:"comet.native.physical-selection.v1",status:o,before:i,after:r}}function _l(t){let e=X(t,"Native content snapshot manifest");if(Q(e,xv,"Native content snapshot manifest"),e.schema!=="comet.native.content-snapshot.v1")throw new Error("Unsupported Native content snapshot schema");if(!Bv.has(e.origin))throw new Error("Native content snapshot origin is invalid");let i;if(e.capture!==void 0){let v=X(e.capture,"Native content snapshot capture");if(Q(v,Av,"Native content snapshot capture"),v.provider!=="git"&&v.provider!=="physical-tree")throw new Error("Native content snapshot capture provider is invalid");let x=v.gitSelection===void 0?void 0:Cl(v.gitSelection),b=v.physicalSelection===void 0?void 0:Yv(v.physicalSelection),A=null;if(v.projection!==void 0){let J=X(v.projection,"Native content snapshot projection");if(Q(J,_v,"Native content snapshot projection"),J.provider!=="git")throw new Error("Native content snapshot projection provider is invalid");A={provider:"git",...J.selection===void 0?{}:{selection:Cl(J.selection)}}}if(v.provider==="git"){if(b||A)throw new Error("Native Git capture cannot include physical or projection evidence");i={provider:"git",...x?{gitSelection:x}:{}}}else{if(x)throw new Error("Native physical-tree capture cannot include direct Git evidence");if(b&&A)throw new Error("Native physical-tree capture cannot combine selection and projection");i=A?{provider:"physical-tree",projection:A}:{provider:"physical-tree",...b?{physicalSelection:b}:{}}}}if(typeof e.createdAt!="string"||Number.isNaN(Date.parse(e.createdAt)))throw new Error("Native content snapshot timestamp is invalid");if(typeof e.complete!="boolean")throw new Error("Native content snapshot complete flag is invalid");let r=X(e.limits,"Native content snapshot limits");Q(r,Cv,"Native content snapshot limits");let n={maxFiles:bt(r.maxFiles,"Native snapshot maxFiles"),maxFileBytes:bt(r.maxFileBytes,"Native snapshot maxFileBytes"),maxTotalBytes:bt(r.maxTotalBytes,"Native snapshot maxTotalBytes"),maxManifestBytes:bt(r.maxManifestBytes,"Native snapshot maxManifestBytes"),...r.maxDurationMs===void 0?{}:{maxDurationMs:bt(r.maxDurationMs,"Native snapshot maxDurationMs")}},a;if(e.policy!==void 0){let v=X(e.policy,"Native snapshot policy");if(Q(v,Rv,"Native snapshot policy"),v.schema!=="comet.native.snapshot-policy.v1")throw new Error("Native snapshot policy schema is invalid");if(!Array.isArray(v.include)||!Array.isArray(v.exclude))throw new Error("Native snapshot policy patterns must be arrays");a=Jv({include:v.include,exclude:v.exclude,hash:v.hash,schema:"comet.native.snapshot-policy.v1"}).manifest}if(!Array.isArray(e.entries)||!Array.isArray(e.omitted))throw new Error("Native content snapshot entries and omissions must be arrays");let o=e.entries.map(Gv),s=e.omitted.map(Uv),c=pe(e.omittedCount,"Native content snapshot omittedCount"),l=e.omissionOverflow===void 0?void 0:Kv(e.omissionOverflow);if(o.length>n.maxFiles)throw new Error("Native content snapshot exceeds its file-count limit");if(o.some(v=>v.size>n.maxFileBytes)||o.reduce((v,x)=>v+x.size,0)>n.maxTotalBytes)throw new Error("Native content snapshot exceeds its byte limits");if(new Set(o.map(v=>v.path)).size!==o.length)throw new Error("Native content snapshot contains duplicate paths");if(s.length>Sv||c<s.length)throw new Error("Native content snapshot omission count is invalid");let d=c-s.length;if(d===0&&l||d>0&&l?.count!==d)throw new Error("Native content snapshot omission overflow is inconsistent");if(e.complete!==(c===0))throw new Error("Native content snapshot completeness is inconsistent");let u=s.filter(v=>v.reason==="git-enumeration-limit"),f=s.filter(v=>v.reason==="git-selection-changed");for(let v of[...u,...f])if(v.path!=="."||v.size!==null||v.type!=="directory")throw new Error("Native Git selection omission must use the project-root sentinel");if(u.length>1||f.length>1)throw new Error("Native Git selection omissions must not be duplicated");let p=i?.provider==="git"?i.gitSelection:i?.projection?.selection,g=p?.status==="overflow"||p?.status==="overflow-and-changed",h=p?.status==="changed"||p?.status==="overflow-and-changed";if(g!==(u.length===1))throw new Error("Native Git enumeration omission and selection evidence are inconsistent");if(h!==(f.length===1))throw new Error("Native Git selection-change omission and selection evidence are inconsistent");let m=s.filter(v=>v.reason==="physical-enumeration-limit"),y=s.filter(v=>v.reason==="physical-selection-changed");for(let v of[...m,...y])if(v.path!=="."||v.size!==null||v.type!=="directory")throw new Error("Native physical selection omission must use the project-root sentinel");if(m.length>1||y.length>1)throw new Error("Native physical selection omissions must not be duplicated");let N=i?.physicalSelection,k=N?.status==="overflow"||N?.status==="overflow-and-changed",S=N?.status==="changed"||N?.status==="overflow-and-changed";if(k!==(m.length===1))throw new Error("Native physical enumeration omission and evidence are inconsistent");if(S!==(y.length===1))throw new Error("Native physical selection-change omission and evidence are inconsistent");let E={schema:"comet.native.content-snapshot.v1",origin:e.origin,...i?{capture:i}:{},createdAt:e.createdAt,complete:e.complete,limits:n,...a?{policy:a}:{},entries:o,omitted:s,omittedCount:c,...l?{omissionOverflow:l}:{}};if(qv(E)>n.maxManifestBytes)throw new Error("Native content snapshot exceeds its manifest byte limit");return E}function Xv(t,e){if(!Pv.test(e))throw new Error(`Invalid Native change name: ${e}`);return Qa.join(Y(t,e),"baseline-manifest.json")}async function Tl(t,e){let i=Xv(t,e),r=fe(t,i);await O(r,i);try{let n=await bl({root:r,file:i,maxBytes:Ev,label:"Native baseline snapshot manifest"});return _l(JSON.parse(n.text))}catch(n){if(n.code==="ENOENT")return null;throw n}}var rg=mi(Zt(),1);var Pk=4*1024*1024;var yS=256*1024;var IS={runStateBytes:256*1024,trajectoryBytes:8*1024*1024,trajectoryEvents:4096,trajectoryEventBytes:256*1024,checkpointBytes:256*1024,pendingActionBytes:256*1024,contextBytes:1024*1024,artifactsBytes:1024*1024};var GS=16*1024,US=process.platform;var Ol=["schema","name","language","phase","brief","approval","spec_changes","verification_result","verification_report","archived","created_at","run_id"],lg=new Set(Ol),Hl=new Set([...Ol,"minimum_runtime_version","revision"]),ug=new Set([...Hl,"approved_contract_hash","implementation_scope","verification_evidence","partial_allowance","verification_protocol"]),dg=new Set(["capability","operation","source","base_hash"]),fg=new Set(["shape","build","verify","archive"]),hg=new Set(["implicit","confirmed"]),pg=new Set(["pending","pass","fail"]),Qe="comet-state.yaml",eo=/^[a-f0-9]{64}$/u,Dl=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u,mg=/^runtime\/evidence\/(scopes|allowances|verifications)\/([a-f0-9]{64})\.json$/u,to=class extends Error{constructor(i,r){super(`Native change ${i} uses ${r}; run comet native doctor ${i} --repair before mutating it`);this.change=i;this.schema=r;this.name="NativeSchemaMigrationRequiredError"}change;schema;code="native-schema-migration-required"},De=class extends Error{constructor(i,r){super(i!==Te||r===null?`Unsupported Native change schema ${i} for runtime protocol ${3}`:`Native change ${i} requires runtime protocol ${r}; current protocol is ${3}`);this.schema=i;this.minimumRuntimeVersion=r;this.name="NativeRuntimeCompatibilityError"}schema;minimumRuntimeVersion;code="native-runtime-incompatible"},Fr=class extends Error{constructor(i,r,n){super(`Native change ${i} revision conflict: expected ${r}, actual ${n}`);this.change=i;this.expectedRevision=r;this.actualRevision=n;this.name="NativeChangeRevisionConflictError"}change;expectedRevision;actualRevision;code="native-change-revision-conflict"},li=class extends Error{constructor(i,r){super(`Native working directory already contains active change${r.length===1?"":"s"} ${r.join(", ")}; create the new change in a separate worktree`);this.requestedIsolation=i;this.activeChanges=r;this.name="NativeWorkspaceIsolationRequiredError"}requestedIsolation;activeChanges;code="native-workspace-isolation-required"},Vr=class extends Error{constructor(i,r,n,a,o,s=null,c=null){super(`Native change ${i} baseline is incomplete (${r} omitted entr${r===1?"y":"ies"}). Adjust native.snapshot scope or resource budgets in .comet/config.yaml, then retry.`);this.change=i;this.omittedCount=r;this.omittedByReason=n;this.samplePaths=a;this.sampleTruncated=o;this.effectiveLimits=s;this.policyHash=c;this.name="NativeBaselineIncompleteError"}change;omittedCount;omittedByReason;samplePaths;sampleTruncated;effectiveLimits;policyHash;code="native-baseline-incomplete"},yE=["# Outcome","","# Scope","","# Non-goals","","# Acceptance examples","","# Constraints and invariants","","# Decisions","","# Open questions","","# Verification expectations",""].join(`
|
|
146
|
+
`);function di(t,e){if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`${e} must be a mapping`);return t}function Bl(t,e,i){let r=Object.keys(t).filter(n=>!e.has(n));if(r.length>0)throw new Error(`${i} has unknown field(s): ${r.join(", ")}`)}function fi(t){if(!Dl.test(t))throw new Error(`Invalid Native change name: ${t}`)}function vg(t){if(!Dl.test(t))throw new Error(`Invalid Native capability id: ${t}`)}function Ll(t,e){if(t.length===0||Xe.isAbsolute(t)||/^(?:[A-Za-z]:|~|[\\/])/u.test(t)||t.split(/[\\/]/u).includes(".."))throw new Error(`${e} must stay inside the Native change`)}function gg(t,e){let i=di(t,`spec_changes[${e}]`);if(Bl(i,dg,`spec_changes[${e}]`),typeof i.capability!="string")throw new Error("spec change capability is required");if(vg(i.capability),i.operation!=="create"&&i.operation!=="replace"&&i.operation!=="remove")throw new Error(`Invalid spec operation for ${i.capability}`);let r=i.source,n=i.base_hash;if(r!==void 0&&typeof r!="string")throw new Error(`Spec source for ${i.capability} must be a string`);if(typeof r=="string"&&Ll(r,`Spec source for ${i.capability}`),i.operation==="create"){if(!r)throw new Error(`Create spec ${i.capability} requires source`);if(n!==null)throw new Error(`Create spec ${i.capability} requires null base_hash`)}else if(i.operation==="replace"){if(!r)throw new Error(`Replace spec ${i.capability} requires source`);if(typeof n!="string"||!eo.test(n))throw new Error(`Replace spec ${i.capability} requires a SHA-256 base_hash`)}else{if(r!==void 0)throw new Error(`Remove spec ${i.capability} forbids source`);if(typeof n!="string"||!eo.test(n))throw new Error(`Remove spec ${i.capability} requires a SHA-256 base_hash`)}return{capability:i.capability,operation:i.operation,...typeof r=="string"?{source:r}:{},base_hash:n}}function wg(t){return/^\d{4}-\d{2}-\d{2}$/u.test(t)?new Date(`${t}T00:00:00.000Z`).toISOString().slice(0,10)===t:!1}function ro(t,e){if(Bl(t,e,Qe),typeof t.name!="string")throw new Error("Native change name is required");if(fi(t.name),t.language!=="en"&&t.language!=="zh-CN")throw new Error("Native change language must be en or zh-CN");if(typeof t.phase!="string"||!fg.has(t.phase))throw new Error("Native change phase is invalid");if(t.brief!=="brief.md")throw new Error("Native change brief must be brief.md");if(t.approval!==null&&!hg.has(t.approval))throw new Error("Native change approval is invalid");if(!Array.isArray(t.spec_changes))throw new Error("Native spec_changes must be an array");let i=t.spec_changes.map(gg),r=i.map(n=>n.capability).filter((n,a,o)=>o.indexOf(n)!==a);if(r.length>0)throw new Error(`Duplicate Native capability operation: ${[...new Set(r)].join(", ")}`);if(typeof t.verification_result!="string"||!pg.has(t.verification_result))throw new Error("Native verification_result is invalid");if(t.verification_report!==null&&typeof t.verification_report!="string")throw new Error("Native verification_report must be a string or null");if(typeof t.verification_report=="string"&&Ll(t.verification_report,"Native verification_report"),typeof t.archived!="boolean")throw new Error("Native archived must be boolean");if(typeof t.created_at!="string"||!wg(t.created_at))throw new Error("Native created_at must be a valid YYYY-MM-DD date");if(t.run_id!==null&&(typeof t.run_id!="string"||t.run_id.length===0))throw new Error("Native run_id must be a non-empty string or null");return{name:t.name,language:t.language,phase:t.phase,brief:"brief.md",approval:t.approval,spec_changes:i,verification_result:t.verification_result,verification_report:t.verification_report,archived:t.archived,created_at:t.created_at,run_id:t.run_id}}function jr(t){let e=di(t,Qe);if(e.schema!==je)throw new Error(`Expected ${je}`);return{schema:je,...ro(e,lg)}}function ui(t,e){if(!Number.isSafeInteger(t)||t<1)throw new Error(`${e} must be a positive integer`);return t}function Za(t,e,i){if(t===null)return null;let r=typeof t=="string"?mg.exec(t):null;if(!r||r[1]!==i)throw new Error(`${e} must be null or runtime/evidence/${i}/<sha256>.json relative to the Native change`);return t}function yg(t){if(t==null)return null;if(typeof t!="string"||!eo.test(t))throw new Error("Native approved_contract_hash must be null or a SHA-256 hash");return t}function Ng(t){if(t===void 0)return"legacy-v1";if(t!=="legacy-v1")throw new Error("Native verification_protocol must be legacy-v1");return t}function $r(t){let e=di(t,Qe);if(e.schema!==Ie)throw new Error(`Expected ${Ie}`);if(ui(e.minimum_runtime_version,"Native v2 minimum_runtime_version")!==2)throw new Error(`Native ${Ie} minimum_runtime_version must be 2`);return{schema:Ie,minimum_runtime_version:2,revision:ui(e.revision,"Native v2 revision"),...ro(e,Hl)}}function Or(t){let e=di(t,Qe);if(e.schema!==Te){if(e.schema===je||e.schema===Ie){let o=e.schema===je?jr(e):$r(e);throw new to(o.name,o.schema)}throw new De(typeof e.schema=="string"?e.schema:"(missing)",typeof e.minimum_runtime_version=="number"?e.minimum_runtime_version:null)}let i=ui(e.minimum_runtime_version,"Native minimum_runtime_version");if(i>3)throw new De(e.schema,i);if(i!==3)throw new Error(`Native ${e.schema} minimum_runtime_version must be ${3}`);let r=ui(e.revision,"Native revision"),n=ro(e,ug),a=yg(e.approved_contract_hash);if(n.approval===null&&a!==null)throw new Error("Native approved_contract_hash requires an approval");return{schema:Te,minimum_runtime_version:3,revision:r,verification_protocol:Ng(e.verification_protocol),...n,approved_contract_hash:a,implementation_scope:Za(e.implementation_scope,"Native implementation_scope","scopes"),verification_evidence:Za(e.verification_evidence,"Native verification_evidence","verifications"),partial_allowance:Za(e.partial_allowance,"Native partial_allowance","allowances")}}function bg(t){let e=di(t,Qe);if(e.schema===je){let n=jr(e);return{status:"migration-required",schema:n.schema,minimumRuntimeVersion:1,state:n,message:`Native change ${n.name} requires migration to ${Te}`}}if(e.schema===Ie){let n=$r(e);return{status:"migration-required",schema:n.schema,minimumRuntimeVersion:n.minimum_runtime_version,state:n,message:`Native change ${n.name} requires migration to ${Te}`}}if(e.schema!==Te){let n=typeof e.minimum_runtime_version=="number"&&Number.isSafeInteger(e.minimum_runtime_version)?e.minimum_runtime_version:null;return{status:"runtime-incompatible",schema:typeof e.schema=="string"?e.schema:"(missing)",minimumRuntimeVersion:n,state:null,message:new De(typeof e.schema=="string"?e.schema:"(missing)",n).message}}let i=ui(e.minimum_runtime_version,"Native minimum_runtime_version");if(i>3)return{status:"runtime-incompatible",schema:e.schema,minimumRuntimeVersion:i,state:null,message:new De(e.schema,i).message};let r=Or(e);return{status:"current",schema:r.schema,minimumRuntimeVersion:r.minimum_runtime_version,state:r}}function Z(t,e){fi(e);let i=Xe.join(t.changesDir,e);if(!B(t.changesDir,i))throw new Error("Native change path escaped");return i}async function no(t,e){let i=Y(t,e),r=Xe.join(i,"schema-migration.json");await O(B(t.runtimeDir,r)?t.runtimeDir:t.nativeRoot,r);try{return await cg.lstat(r),!0}catch(n){if(n.code==="ENOENT")return!1;throw n}}var kg=256*1024;async function Sg(t,e=Xe.dirname(t)){let i=Xe.relative(e,t).split(Xe.sep).join("/"),r=await M({root:e,ref:i,maxBytes:kg}),n=(0,io.parseDocument)(r.text,{uniqueKeys:!0});if(n.errors.length>0)throw new Error(`Invalid Native change file ${t}: ${n.errors[0].message}`);return n.toJS()}async function Ml(t,e){let i=Xe.join(Z(t,e),Qe);await O(t.nativeRoot,i);let r=bg(await Sg(i,t.nativeRoot));if(r.state&&r.state.name!==e)throw new Error(`Native change directory/name mismatch: ${e}`);return await no(t,e)?{status:"migration-required",schema:r.schema,minimumRuntimeVersion:r.minimumRuntimeVersion,state:r.state,message:`Native schema migration is incomplete for ${e}; run doctor --repair`}:(r.status==="current"&&r.state&&await Eg(t,r.state),r)}async function Eg(t,e){if(await Tl(t,e.name)!==null&&e.verification_protocol!=="legacy-v1")throw new Error(`Native verification protocol is unsupported: ${e.verification_protocol}`)}var SE={maxAcceptanceCriteria:ml.maxCriteria};var Ze={maxSpecs:64,maxFileBytes:vr,maxTotalBytes:4*1024*1024};import{promises as Yl}from"fs";import Xl from"path";var Pg=["Outcome","Scope","Non-goals","Acceptance examples"],jE=[...Pg,"Constraints and invariants","Decisions","Open questions","Verification expectations"];var WE={maxArtifacts:128,maxFileBytes:16*1024*1024,maxTotalBytes:64*1024*1024,maxDocumentBytes:256*1024};var Vl=1024*1024;var Wl={root:"/comet/native-runtime",packageKind:"runtime",definition:{apiVersion:"comet/v1alpha1",kind:"Skill",metadata:{name:"comet-native-runtime",version:"3",description:"Comet-owned state runtime for the Native workflow."},goal:{statement:"Advance a Native change only after its current guard passes.",inputs:[],outputs:[],success:["The Native change and Run state agree on the next phase."]},orchestration:{mode:"deterministic",entry:"shape",steps:[{id:"shape",action:{type:"checkpoint"},next:"build"},{id:"build",action:{type:"checkpoint"},next:"verify"},{id:"verify",action:{type:"checkpoint"},next:"archive"},{id:"archive",action:{type:"checkpoint"}}]},skills:[],agents:[],tools:[]},guardrails:{allowedSkills:[],allowedAgents:[],allowedTools:[],maxIterations:Number.MAX_SAFE_INTEGER,maxRetriesPerAction:2,confirmationRequiredFor:[]},evals:[]},Cg=z("comet-native-runtime:v3:scope-reopen"),wP=[{skillVersion:"3",skillHash:z("comet-native-runtime:v3:semantic-repair-budget")},{skillVersion:"2",skillHash:z("comet-native-runtime:v2:max-iterations-32")},{skillVersion:"1",skillHash:z("comet-native-runtime:v1")}];var Ul=["schema","id","change","evidenceHash","createdAt","previousState","nextState","previousRun","nextRun","eventData"],XP=new Set(Ul),Ig=new Set([...Ul,"minimum_runtime_version","revision"]),QP=new Set([...Ig,"operation"]),ZP=512*1024,jg=new Set(["previousPhase","nextPhase","evidenceHash","summary","artifacts","noCodeReason","verificationResult"]),ex=new Set([...jg,"implementationScopeHash","repairScopeHash","repairStagnation","returnToBuild"]);var Ql=Ze.maxSpecs*4;async function $g(t,e){let i=Xl.join(Z(t,e),"specs"),r;try{r=await Ka({root:t.nativeRoot,directory:i,label:"Native proposed specs directory"})}catch(s){if(s.code==="ENOENT")return[];throw s}let n=[],a=0,o=await Yl.opendir(i);try{for await(let s of o){if(a+=1,a>Ql)throw new Error(`Native proposed specs directory exceeds ${Ql} entries`);if(s.isSymbolicLink())throw new Error(`Proposed spec capability must not be a symbolic link: ${s.name}`);if(!s.isDirectory())continue;fi(s.name);let c=Xl.join(i,s.name,"spec.md");await O(t.nativeRoot,c);let l;try{l=await Yl.lstat(c)}catch(d){if(d.code==="ENOENT")continue;throw d}if(l.isSymbolicLink()||!l.isFile())throw new Error(`Proposed spec must be a regular file: ${s.name}`);if(n.push(s.name),n.length>Ze.maxSpecs)throw new Error("Native proposed specs exceed the spec-count budget")}}finally{await o.close().catch(s=>{if(s.code!=="ERR_DIR_CLOSED")throw s})}return await r.verify(),n.sort()}async function tu(t,e){let i=Z(t,e),r={},n=0;for(let a of await $g(t,e)){let o=await M({root:i,ref:`specs/${a}/spec.md`,maxBytes:Ze.maxFileBytes});if(n+=o.size,n>Ze.maxTotalBytes)throw new Error("Native proposed specs exceed the total byte budget");r[a]=o.text}return r}function iu(t){let e={schema:"comet.native.continuation.v2",skill:"comet-native",change:t.name,phase:t.phase,status:t.status,stateVersion:t.state_version,inputOptions:[]},i=r=>({kind:r,candidateId:t.builder_handoff?.candidate_id??null,iteration:t.loop.iteration,attempt:t.loop.attempt});if(t.status==="done")return{...e,disposition:"done",action:"none",commandArgs:null,requiredInputs:[],runnerAction:i("none")};if(t.status==="await-user")return t.phase==="verify"&&t.verification_result==="pass"&&t.loop.next_action==="confirm-skill-coordinated-pass"?{...e,disposition:"await-user",action:"confirm-skill-coordinated-pass",commandArgs:["comet","native","next",t.name,"--summary","<summary>","--confirmed"],requiredInputs:["summary","user-confirmation"],inputOptions:[{name:"summary",flag:"--summary",valueKind:"text",required:!0,template:null},{name:"confirmed",flag:"--confirmed",valueKind:"confirmation",required:!0,template:null}],runnerAction:i("none")}:t.phase==="verify"&&t.verification?.assurance==="semantic-verification-unavailable"&&t.loop.next_action==="confirm-verifier-unavailable"?{...e,disposition:"await-user",action:"confirm-verifier-unavailable",commandArgs:["comet","native","next",t.name,"--summary","<summary>","--confirmed"],requiredInputs:["summary","user-confirmation"],inputOptions:[{name:"summary",flag:"--summary",valueKind:"text",required:!0,template:null},{name:"confirmed",flag:"--confirmed",valueKind:"confirmation",required:!0,template:null}],runnerAction:i("none")}:t.phase==="verify"&&t.loop.next_action==="resolve-verifier-blocker"?{...e,disposition:"await-user",action:"resolve-verifier-blocker",commandArgs:["comet","native","next",t.name,"--summary","<summary>","--resolve-verifier-blocker"],requiredInputs:["summary","user-resolution"],inputOptions:[{name:"summary",flag:"--summary",valueKind:"text",required:!0,template:null}],runnerAction:i("none")}:t.phase==="verify"&&t.loop.next_action==="await-user"?{...e,disposition:"await-user",action:"resolve-loop-stop",commandArgs:["comet","native","next",t.name,"--return-to-build","--summary","<summary>"],requiredInputs:["summary","user-decision"],inputOptions:[{name:"summary",flag:"--summary",valueKind:"text",required:!0,template:null}],runnerAction:i("none")}:{...e,disposition:"await-user",action:"none",commandArgs:null,requiredInputs:["resolve-blocker"],runnerAction:i("none")};if(t.status==="blocked"){let r=t.blockers.some(({resolution_action:n})=>n==="retry-verifier");return{...e,disposition:"blocked",action:r?"retry-verifier":"none",commandArgs:r?["comet","native","next",t.name,"--retry-verifier","--summary","<summary>"]:null,requiredInputs:r?["summary"]:["repair-runtime"],inputOptions:r?[{name:"summary",flag:"--summary",valueKind:"text",required:!0,template:null}]:[],runnerAction:i(r?"retry-verifier":"none")}}if(t.phase==="shape")return{...e,disposition:"continue",action:"confirm-shape",commandArgs:["comet","native","next",t.name,"--summary","<summary>","--confirmed"],requiredInputs:["summary","shared-understanding-confirmation"],inputOptions:[{name:"summary",flag:"--summary",valueKind:"text",required:!0,template:null},{name:"confirmed",flag:"--confirmed",valueKind:"confirmation",required:!0,template:null}],runnerAction:i("none")};if(t.phase==="build")return{...e,disposition:"continue",action:t.loop.stage==="repairing"?"repair":"builder-handoff",commandArgs:["comet","native","next",t.name,"--runner-input","<temporary-json-file>"],requiredInputs:["builder-handoff-json-file"],inputOptions:[{name:"runner-input",flag:"--runner-input",valueKind:"json-file",required:!0,template:{kind:"builder-handoff",summary:"<summary>",addressed_acceptance_ids:["<acceptance-id>"],checks:[{name:"<check-name>",result:"not-run",note:null}],known_limits:[]}}],runnerAction:i("builder-handoff")};if(t.phase==="verify"){let r=t.loop.next_action==="await-verifier-result";return{...e,disposition:"continue",action:r?"await-verifier":"dispatch-verifier",commandArgs:["comet","native","next",t.name,"--runner-input","<temporary-json-file>"],requiredInputs:[r?"verifier-response-or-error-json-file":"resolved-check-plan-json-file"],inputOptions:[{name:"runner-input",flag:"--runner-input",valueKind:"json-file",required:!0,template:r?[{kind:"verifier-response",response:{kind:"request-checks",iteration:t.loop.iteration,attempt:t.loop.attempt,checks:[{id:"<check-id>",name:"<check-name>",executable:"<executable>",argv:[],cwdRef:".",timeoutMs:12e4,repeatable:!0}]}},{kind:"verifier-response",response:{kind:"final-result",result:{iteration:t.loop.iteration,attempt:t.loop.attempt,verdict:"<pass|fail|blocked>",acceptance:[{id:"<acceptance-id>",result:"<passed|failed|blocked>",reason:"<reason>"}],risks:[],summary:"<summary>"}}},{kind:"verifier-execution-error",summary:"<summary>",stateVersion:t.state_version,iteration:t.loop.iteration,attempt:t.loop.attempt,verifierExecutionRef:"<from verifierDispatch>"},{kind:"verifier-unavailable",summary:"<why no independent semantic execution is available>",stateVersion:t.state_version,iteration:t.loop.iteration,attempt:t.loop.attempt,verifierExecutionRef:"<from verifierDispatch>"}]:{kind:"dispatch-verifier",checks:[]}}],runnerAction:i(r?"await-verifier":"dispatch-verifier")}}return{...e,disposition:"continue",action:"archive",commandArgs:["comet","native","archive",t.name,"--confirmed"],requiredInputs:[],runnerAction:i("none")}}import{promises as Mg}from"node:fs";import ru from"node:path";var $x=["$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("; ");var Fg=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u,Vg="comet-state.yaml";function oo(t,e){if(!Fg.test(e))throw new Error(`Invalid Native change name: ${e}`);let i=ru.join(t.changesDir,e);if(!B(t.changesDir,i))throw new Error("Native change path escaped");return i}function nu(t,e){return ru.join(oo(t,e),Vg)}async function so(t,e){try{let i=await Mg.readFile(nu(t,e),"utf8");return/^schema:\s*comet\.native\.v4\s*$/mu.test(i)}catch(i){if(i.code==="ENOENT")return!1;throw i}}async function co(t,e){return gl(nu(t,e))}import fo from"path";var qg=Object.freeze({maxChanges:32,maxSpecsPerChange:64,maxArtifactsPerChange:128,maxTotalSpecs:512,maxTotalArtifacts:1024,maxSignalsPerRelationship:8,maxRelationships:256,maxSerializedBytes:64*1024,maxNameBytes:128,maxCapabilityBytes:128,maxArtifactPathBytes:512});var au="scoped-text-safety",Wg=1,zg=Object.freeze({maxFiles:256,maxFileBytes:2*1024*1024,maxTotalBytes:8*1024*1024,maxIssues:128});var Jg="comet.native.checker-policy.v1";var pR=ae(Jg,{policy:au,version:Wg,limits:zg,checks:["conflict-marker","space-before-tab","trailing-whitespace"],binaryHandling:"skip-and-count"});var Gg=["contract-before-does-not-match-scope","implementation-before-does-not-match-scope","contract-changed-during-check","implementation-changed-during-check","contract-after-does-not-match-scope","implementation-after-does-not-match-scope"],mR=new Set(Gg);var Kg=Vl,IR=3*Kg;import{execFile as rw}from"node:child_process";import{promisify as nw}from"node:util";var JR=512*1024;var hi=class extends Error{recovery;constructor(e,i){super(e),this.name="NativeReceiptScopeStaleError",this.recovery=i}};var mA=64*1024;var vA=3600*1e3;var gA=nw(rw);var qr=class extends Error{details;constructor(e){let i=e.length===0?"Native verification receipt binding is invalid":`Native verification receipt binding is invalid (${e.length} receipt(s)): ${e.map(r=>`${r.ref}${r.acceptanceId?`[${r.acceptanceId}]`:""} -> ${r.mismatches.join("; ")}`).join(" | ")}`;super(i),this.name="NativeVerificationReceiptBindingError",this.details=e}};var i_={maxDepth:128,maxEntries:2e4,maxFileBytes:64*1024*1024,maxTotalBytes:256*1024*1024,maxManifestBytes:16*1024*1024,maxRefBytes:4*1024};var h_=16*1024*1024,p_=256*1024,m_=16*1024;var N_=Object.freeze({maxScopeChanges:128,maxAcceptanceEntries:64,maxUnresolvedReasons:32,maxReceipts:32});var S_=16*1024;var O_=16*1024;var PT=16*1024*1024,Wr=class extends Error{constructor(i,r,n,a){super(`Canonical spec conflict for ${i}: expected ${r??"(missing)"}, actual ${n??"(missing)"}`);this.capability=i;this.expectedHash=r;this.actualHash=n;this.canonicalPath=a;this.name="NativeSpecConflictError"}capability;expectedHash;actualHash;canonicalPath;code="native-spec-conflict"},zr=class extends Error{constructor(i,r=i.ready?"Native Archive preflight no longer matches the expected hash":`Native Archive preflight is blocked: ${i.findingCodes.join(", ")}`){super(r);this.preflight=i;this.name="NativeArchivePreflightError"}preflight;code="native-archive-preflight"};var CT=8*1024*1024;var Jr=class extends Error{constructor(i,r,n){super(i,n);this.preparation=r;this.name="NativeWorkspacePreparationError"}preparation};var su=["--project-root <path> Resolve the Native project from this working directory.","--json Emit the stable JSON command envelope.","--help Show help without requiring an initialized project."],uo=Object.freeze({"":{usage:"comet native <command> [options]",purpose:"Create, inspect, recover, and archive portable Native changes through Runtime-enforced, skill-coordinated steps.",subcommands:["init Initialize Native project configuration.","root show Inspect the configured artifact root.","root move <artifact-root> Move the configured artifact root.","new <change-name> Create a change and prepare its workspace.","spec remove Record a complete capability removal intent.","show <change-name> Read formal artifacts and portable state.","status [<change-name>] Discover stable boundaries and Runner actions.","select <change-name> Select a change in its bound workspace.","next <change-name> Confirm or recover a stable workflow boundary.","archive <change-name> Preview and execute Archive plus workspace finish.","doctor [<change-name>] Diagnose, migrate, or rebuild local execution state."],options:su,output:"Human-readable text by default; use --json for a structured command envelope.",examples:["comet native status --json","comet native status my-change --details --json","comet native next --help"]},init:{usage:"comet native init [--root <artifact-root>] [--language en|zh-CN]",purpose:"Create or normalize .comet/config.yaml and the configured Native directories.",options:["--root <artifact-root> Project-relative artifact root; defaults to docs.","--language en|zh-CN Language for newly generated Native artifacts."],output:"The resolved project configuration and Native paths.",examples:["comet native init --root docs --language zh-CN"]},root:{usage:"comet native root <show|move> [arguments]",purpose:"Inspect or transactionally move the configured Native artifact root.",subcommands:["show Print the configured artifact root and resolved paths.","move <artifact-root> Move Native artifacts and update project configuration."],output:"The current root projection or the completed move result.",examples:["comet native root show","comet native root move artifacts/native"]},"root show":{usage:"comet native root show",purpose:"Print the configured Native artifact root and resolved paths.",output:"The configured artifact root and resolved Native paths."},"root move":{usage:"comet native root move <artifact-root>",purpose:"Transactionally move Native artifacts and update project configuration.",output:"The source, destination, and committed root-move transaction result.",examples:["comet native root move artifacts/native"]},new:{usage:"comet native new <change-name> [--language en|zh-CN] [--isolation current|branch|worktree] [--change-branch <branch>] [--target-branch <branch>] [--worktree-path <path>]",purpose:"Create a portable Native change and prepare the requested branch or linked worktree.",options:["--language en|zh-CN Artifact language; defaults to project configuration.","--isolation <kind> current, branch, or worktree; defaults to current.","--change-branch <branch> Change branch; defaults to comet/<change-name>.","--target-branch <branch> Local base branch; defaults to the current branch.","--worktree-path <path> Worktree directory; defaults to .worktrees/<change-name>."],output:"The portable state, workspace preparation result, and continuation with the next Runner action.",examples:["comet native new session-timeout --language zh-CN","comet native new session-timeout --isolation branch --target-branch main","comet native new session-timeout --isolation worktree --target-branch main"]},spec:{usage:"comet native spec remove <change-name> <capability>",purpose:"Record a capability removal; create and modify intents use complete proposed Spec files.",subcommands:["remove <change-name> <capability> Record a capability removal."],output:"The updated portable state and continuation."},"spec remove":{usage:"comet native spec remove <change-name> <capability>",purpose:"Record removal of a capability in the complete target specification.",output:"The updated portable state and continuation with the next Runner action."},show:{usage:"comet native show <change-name>",purpose:"Read formal artifacts and portable state for one Native change.",output:"The portable state, brief, complete proposed Specs, and continuation; legacy state is reported as migration-required."},status:{usage:"comet native status [<change-name>] [--cursor <token>] [--details]",purpose:"Discover portable stable boundaries or inspect the exact next Runner action.",options:["--cursor <token> Continue a status-list page.","--details Include acceptance, Spec, workspace, and report details."],output:"A v2 status page or one portable Loop projection with local execution availability and continuation.runnerAction.",examples:["comet native status --json","comet native status session-timeout --details --json"]},select:{usage:"comet native select <change-name>",purpose:"Select one Native change after validating its workspace binding.",output:"The selected change record."},next:{usage:`comet native next <change-name> --summary <text> [--confirmed|--return-to-build|--retry-verifier|--resolve-verifier-blocker]
|
|
147
|
+
comet native next <change-name> --runner-input <json-file>`,purpose:"Confirm or recover an Agent boundary, or use one skill-coordinated JSON bridge for Builder handoff, check-plan dispatch, and Verifier response/error.",options:["--summary <text> Required transition or recovery summary.","--confirmed Confirm Shape, a completed skill-coordinated pass, or an explicitly degraded verifier-unavailable fallback before Archive.","--return-to-build Return Verify or Archive to Build after invalidation or user choice.","--retry-verifier Retry a blocked Verifier execution when the continuation allows it.","--resolve-verifier-blocker Resolve a semantic Verifier blocker without changing the candidate, then dispatch a new attempt.","--runner-input <file> Skill-coordinated JSON: builder-handoff, dispatch-verifier, verifier-response, verifier-execution-error, or verifier-unavailable. Identity/provider/execution/candidate fields are rejected."," builder-handoff fields: kind, summary, addressed_acceptance_ids, checks, known_limits."," dispatch-verifier fields: kind, checks (an explicitly resolved plan; [] is allowed)."," verifier-response fields: kind, response (request-checks or final-result)."," verifier-execution-error fields: kind, summary, stateVersion, iteration, attempt, verifierExecutionRef copied from verifierDispatch."," verifier-unavailable fields: kind, summary, stateVersion, iteration, attempt, verifierExecutionRef copied from verifierDispatch; accepted only after the explicit Runtime check plan completed and passed."],output:"The portable state, explicit skill-coordinated label, Runtime-owned check results, complete verifierDispatch, bounded request-check response, continuation.runnerAction, and machine-readable continuation.inputOptions. This generic bridge is not trusted identity attestation: a passing result waits for explicit user confirmation before Archive.",examples:['comet native next session-timeout --summary "Shape confirmed" --confirmed','comet native next session-timeout --summary "Implementation changed" --return-to-build','comet native next session-timeout --summary "Retry verifier infrastructure" --retry-verifier','comet native next session-timeout --summary "Retry semantic verification" --resolve-verifier-blocker',"comet native next session-timeout --runner-input <temporary-json-file>"]},archive:{usage:`comet native archive <change-name> --dry-run [--finish merge|push|pull-request|keep]
|
|
148
|
+
comet native archive <change-name> [--confirmed] [--serial-first <current-change>]`,purpose:"Preview or execute deterministic Archive after the portable state reaches archive-ready.",options:["--dry-run Inspect readiness without rerunning verification.","--finish <action> Persist merge, push, pull-request, or keep for an isolated workspace.","--serial-first <current-change> During execution only, confirm that this change archives before detected capability peers; the value must equal <change-name>.","--confirmed Confirm Archive when project policy requires it."],output:"Readiness plus continuation, or the completed Archive transaction and workspace finish result; Archive does not repeat verification."},doctor:{usage:"comet native doctor [<change-name>] [--repair]",purpose:"Inspect portable state, migrate a legacy active change, or rebuild its local execution overlay.",options:["--repair Apply deterministic migration or rebuild from the portable stable boundary."],output:"Health, migration or recovery details, and the continuation with the next Runner action."}});function lo(t,e){return`${t}:
|
|
149
|
+
${e.map(i=>` ${i}`).join(`
|
|
150
|
+
`)}`}function uw(t){let e=t.filter(r=>r!=="--help");if(e.length===0)return"";let i=e.slice(0,2).join(" ");return uo[i]||e.length>1&&uo[e[0]]?.subcommands?i:e[0]}function dw(t=[]){let e=uw(t),i=uo[e];if(!i)throw new Error(`Unknown Native help topic: ${e}`);let r=[`Usage: ${i.usage}`,"",i.purpose];i.subcommands&&r.push("",lo("Commands",i.subcommands));let n=e===""?i.options:[...i.options??[],...su];return n&&n.length>0&&r.push("",lo("Options",n)),r.push("",`Output:
|
|
151
|
+
${i.output}`),i.examples&&r.push("",lo("Examples",i.examples)),e===""&&r.push("","Run `comet native <command> --help` for command-specific details."),{topic:e,usage:`${r.join(`
|
|
152
|
+
`)}
|
|
153
|
+
`}}var fw=dw().usage;var lu=10*1024*1024,Be=class extends Error{};function uu(t,e){let i=t.flatMap((r,n)=>r===e?[n]:[]);if(i.length>1)throw new Be(`${e} may only be provided once`);return i.length===0?!1:(t.splice(i[0],1),!0)}function du(t,e){let i=t.flatMap((a,o)=>a===e?[o]:[]);if(i.length>1)throw new Be(`${e} may only be provided once`);if(i.length===0)return;let r=i[0],n=t[r+1];if(n===void 0||n.startsWith("--"))throw new Be(`${e} requires a value`);return t.splice(r,2),n}function fu(t){if(t.length>0)throw new Be(`Unexpected argument: ${t[0]}`)}function hu(t,e){let i=t.shift();if(!i||i.startsWith("--"))throw new Be(`${e} is required`);return i}function cu(t,e){let i=fo.normalize(t),r=fo.normalize(e);return process.platform==="win32"?i.toLowerCase()===r.toLowerCase():i===r}function hw(t){let e=fo.resolve(t),i=ht(process.cwd());if(!i.isSecondaryWorktree||i.currentWorktreeRoot===null||i.primaryWorktreeRoot===null)return e;let r=ht(e);return!r.isGitWorktree||r.currentWorktreeRoot===null||r.primaryWorktreeRoot===null||!cu(i.primaryWorktreeRoot,r.primaryWorktreeRoot)||cu(i.currentWorktreeRoot,r.currentWorktreeRoot)?e:i.currentWorktreeRoot}async function pu(t){return t?hw(t):Cr(process.cwd())}async function mu(t){let e=await pl({startPath:t,allowMissingConfig:!1});return{config:e.config,paths:e.paths}}function Gr(t,e,i){return{command:t,exitCode:0,data:e,text:i??JSON.stringify(e,null,2)+`
|
|
154
|
+
`}}function vu(t,e){if(e instanceof Be)return{command:t,exitCode:64,error:{code:"usage",message:e.message}};if(e instanceof Wr)return{command:t,exitCode:73,data:{capability:e.capability,expectedHash:e.expectedHash,actualHash:e.actualHash,canonicalPath:e.canonicalPath},error:{code:"conflict",message:e.message}};if(e instanceof zr)return{command:t,exitCode:73,data:e.preflight,error:{code:"conflict",message:e.message}};if(e instanceof Fr)return{command:t,exitCode:73,data:{change:e.change,expectedRevision:e.expectedRevision,actualRevision:e.actualRevision,outcome:"revision-conflict"},error:{code:"conflict",message:e.message}};if(e instanceof li)return{command:t,exitCode:73,data:{requestedIsolation:e.requestedIsolation,activeChanges:e.activeChanges,requiredAction:"create-native-worktree"},error:{code:"workspace-isolation-required",message:e.message}};if(e instanceof Jr)return{command:t,exitCode:73,data:{preparation:e.preparation},error:{code:"workspace-preparation-incomplete",message:e.message}};if(e instanceof Vr)return{command:t,exitCode:65,data:{change:e.change,complete:!1,omittedCount:e.omittedCount,omittedByReason:e.omittedByReason,samplePaths:e.samplePaths,sampleTruncated:e.sampleTruncated,effectiveLimits:e.effectiveLimits,policyHash:e.policyHash,configPath:".comet/config.yaml",supportedFixes:["increase native.snapshot.max_files, native.snapshot.max_total_bytes, or native.snapshot.max_duration_ms","add an explicit native.snapshot.exclude pattern for data outside implementation scope"],requiredAction:"resolve-native-baseline"},error:{code:"baseline-incomplete",message:e.message}};if(e instanceof qr)return{command:t,exitCode:65,data:{receiptBindingFailures:e.details},error:{code:"invalid-data",message:e.message}};if(e instanceof hi)return{command:t,exitCode:65,data:e.recovery,error:{code:"implementation-scope-stale",message:e.message}};if(e instanceof Error){let i=e.code;if(i&&new Set(["EACCES","EPERM","EIO","EMFILE","ENFILE","ENOSPC","EROFS"]).has(i))return{command:t,exitCode:70,error:{code:"internal",message:e.message}};let r=/\b(lock|transaction|conflict|occupied|incomplete|recovery)\b/iu.test(e.message);return{command:t,exitCode:r?73:65,error:{code:r?"conflict":"invalid-data",message:e.message}}}return{command:t,exitCode:70,error:{code:"internal",message:String(e)}}}function gu(t,e){return e?{exitCode:t.exitCode,stdout:JSON.stringify({command:t.command,exitCode:t.exitCode,...t.data===void 0?{}:{data:t.data},...t.error===void 0?{}:{error:t.error}})+`
|
|
155
|
+
`}:t.error?{exitCode:t.exitCode,stderr:t.error.message}:{exitCode:t.exitCode,stdout:t.text}}async function wu(t,e){let i=hu(t,"change name");fu(t);let{paths:r}=await mu(e);if(await so(r,i)){let d=await co(r,i),u=oo(r,i),f=await M({root:u,ref:d.brief,maxBytes:null,includeHash:!1}),p=[];for(let h of d.spec_changes){if(h.source===null)continue;let m=await M({root:u,ref:h.source,maxBytes:null,includeHash:!1});p.push({capability:h.capability,operation:h.operation,source:h.source,content:m.text})}let g={state:d,brief:f.text,proposedSpecs:p,continuation:iu(d)};return Gr("show",g)}let n=await Ml(r,i);if(n.status==="migration-required")return Gr("show",{name:i,schema:n.schema,minimumRuntimeVersion:n.minimumRuntimeVersion,migrationRequired:!0,message:n.message});if(n.status!=="current"||!n.state)throw new De(n.schema,n.minimumRuntimeVersion);let a=n.state,o=Z(r,i),s=await tu(r,i),c=await M({root:o,ref:a.brief,maxBytes:Ze.maxFileBytes}),l={state:a,brief:c.text,proposedSpecs:s};if(Buffer.byteLength(JSON.stringify(l),"utf8")>lu)throw new Error("Native show output exceeds its serialized byte budget");return Gr("show",l)}function pw(t){return{exitCode:t.exitCode,stdout:JSON.stringify({command:t.command,exitCode:t.exitCode,...t.data===void 0?{}:{data:t.data},...t.error===void 0?{}:{error:t.error}})+`
|
|
156
|
+
`}}async function yu(t,e,i=process.argv.slice(2)){let r=i.indexOf("--"),n=r<0?[...i]:i.slice(0,r),a=r<0?[]:i.slice(r),o=n.includes("--json"),s,c;try{uu(n,"--json"),s=du(n,"--project-root");let d=[...n,...a],u=await pu(s);c=await e(d,u)}catch(d){c=vu(t,d)}let l=o?pw(c):gu(c,!1);return l.stdout&&process.stdout.write(l.stdout),l.stderr&&process.stderr.write(l.stderr+(l.stderr.endsWith(`
|
|
150
157
|
`)?"":`
|
|
151
|
-
`)),l.exitCode}process.exitCode=await
|
|
158
|
+
`)),l.exitCode}process.exitCode=await yu("show",wu);
|