@rpamis/comet 0.4.0-rc.2 → 0.4.0-rc.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/README.md +2 -1
- package/assets/manifest.json +1 -1
- package/assets/skills/comet/scripts/comet-archive.mjs +55 -55
- package/assets/skills/comet/scripts/comet-entry-runtime.mjs +56 -56
- package/assets/skills/comet/scripts/comet-guard.mjs +80 -80
- package/assets/skills/comet/scripts/comet-handoff.mjs +69 -69
- package/assets/skills/comet/scripts/comet-hook-guard.mjs +47 -47
- package/assets/skills/comet/scripts/comet-hook-router.mjs +140 -137
- package/assets/skills/comet/scripts/comet-resume-probe.mjs +57 -57
- package/assets/skills/comet/scripts/comet-runtime.mjs +133 -133
- package/assets/skills/comet/scripts/comet-state.mjs +73 -73
- package/assets/skills/comet/scripts/comet-yaml-validate.mjs +25 -25
- package/assets/skills/comet-native/SKILL.md +8 -9
- package/assets/skills/comet-native/reference/artifacts.md +1 -2
- package/assets/skills/comet-native/reference/clarification.md +6 -6
- package/assets/skills/comet-native/reference/commands.md +5 -2
- package/assets/skills/comet-native/scripts/comet-native-archive.mjs +120 -119
- package/assets/skills/comet-native/scripts/comet-native-doctor.mjs +136 -135
- package/assets/skills/comet-native/scripts/comet-native-hook-guard.mjs +77 -76
- package/assets/skills/comet-native/scripts/comet-native-init.mjs +61 -60
- package/assets/skills/comet-native/scripts/comet-native-new.mjs +128 -127
- package/assets/skills/comet-native/scripts/comet-native-next.mjs +133 -132
- package/assets/skills/comet-native/scripts/comet-native-root.mjs +70 -69
- package/assets/skills/comet-native/scripts/comet-native-runtime.mjs +170 -169
- package/assets/skills/comet-native/scripts/comet-native-select.mjs +112 -111
- package/assets/skills/comet-native/scripts/comet-native-show.mjs +102 -101
- package/assets/skills/comet-native/scripts/comet-native-spec.mjs +110 -109
- package/assets/skills/comet-native/scripts/comet-native-status.mjs +108 -107
- package/assets/skills-zh/comet-native/SKILL.md +8 -9
- package/assets/skills-zh/comet-native/reference/artifacts.md +1 -2
- package/assets/skills-zh/comet-native/reference/clarification.md +6 -6
- package/assets/skills-zh/comet-native/reference/commands.md +5 -2
- package/dist/app/commands/bundle.d.ts.map +1 -1
- package/dist/app/commands/bundle.js.map +1 -1
- package/dist/app/commands/dashboard.d.ts +1 -1
- package/dist/app/commands/dashboard.js +1 -1
- package/dist/app/commands/doctor.d.ts.map +1 -1
- package/dist/app/commands/doctor.js +1 -1
- package/dist/app/commands/doctor.js.map +1 -1
- package/dist/app/commands/init.js +2 -2
- package/dist/app/commands/init.js.map +1 -1
- package/dist/app/commands/platform-select-prompt.d.ts.map +1 -1
- package/dist/app/commands/platform-select-prompt.js +1 -0
- package/dist/app/commands/platform-select-prompt.js.map +1 -1
- package/dist/app/commands/update.d.ts.map +1 -1
- package/dist/app/commands/update.js +12 -5
- package/dist/app/commands/update.js.map +1 -1
- package/dist/domains/agent-learning/policy-compiler.d.ts.map +1 -1
- package/dist/domains/agent-learning/policy-compiler.js.map +1 -1
- package/dist/domains/agent-learning/types.d.ts.map +1 -1
- package/dist/domains/agent-learning/types.js.map +1 -1
- package/dist/domains/bundle/authoring.d.ts.map +1 -1
- package/dist/domains/bundle/authoring.js.map +1 -1
- package/dist/domains/bundle/next-action.d.ts.map +1 -1
- package/dist/domains/bundle/next-action.js.map +1 -1
- package/dist/domains/bundle/readiness-user-summary.d.ts.map +1 -1
- package/dist/domains/bundle/readiness-user-summary.js.map +1 -1
- package/dist/domains/bundle/types.d.ts.map +1 -1
- package/dist/domains/comet-classic/classic-layout-initialization.d.ts.map +1 -1
- package/dist/domains/comet-classic/classic-layout-initialization.js.map +1 -1
- package/dist/domains/comet-entry/current-selection.d.ts.map +1 -1
- package/dist/domains/comet-entry/current-selection.js.map +1 -1
- package/dist/domains/comet-entry/init-workflow.d.ts.map +1 -1
- package/dist/domains/comet-entry/init-workflow.js.map +1 -1
- package/dist/domains/comet-entry/types.d.ts.map +1 -1
- package/dist/domains/comet-memory/personal-memory.d.ts.map +1 -1
- package/dist/domains/comet-memory/personal-memory.js +41 -0
- package/dist/domains/comet-memory/personal-memory.js.map +1 -1
- package/dist/domains/comet-memory/types.d.ts +7 -0
- package/dist/domains/comet-memory/types.d.ts.map +1 -1
- package/dist/domains/comet-memory/types.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 +114 -19
- package/dist/domains/comet-native/native-archive-command.js.map +1 -1
- package/dist/domains/comet-native/native-artifacts.d.ts +1 -0
- package/dist/domains/comet-native/native-artifacts.d.ts.map +1 -1
- package/dist/domains/comet-native/native-artifacts.js +53 -2
- package/dist/domains/comet-native/native-artifacts.js.map +1 -1
- package/dist/domains/comet-native/native-atomic-file.d.ts +1 -0
- package/dist/domains/comet-native/native-atomic-file.d.ts.map +1 -1
- package/dist/domains/comet-native/native-atomic-file.js +19 -0
- package/dist/domains/comet-native/native-atomic-file.js.map +1 -1
- package/dist/domains/comet-native/native-children.d.ts +2 -0
- package/dist/domains/comet-native/native-children.d.ts.map +1 -1
- package/dist/domains/comet-native/native-children.js +16 -4
- package/dist/domains/comet-native/native-children.js.map +1 -1
- package/dist/domains/comet-native/native-cli-help.js +7 -7
- package/dist/domains/comet-native/native-cli-help.js.map +1 -1
- package/dist/domains/comet-native/native-cli-shared.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 +41 -1
- package/dist/domains/comet-native/native-doctor-command.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.map +1 -1
- package/dist/domains/comet-native/native-lock.d.ts.map +1 -1
- package/dist/domains/comet-native/native-lock.js +10 -1
- package/dist/domains/comet-native/native-lock.js.map +1 -1
- package/dist/domains/comet-native/native-loop-runtime.d.ts +4 -0
- package/dist/domains/comet-native/native-loop-runtime.d.ts.map +1 -1
- package/dist/domains/comet-native/native-loop-runtime.js +50 -5
- package/dist/domains/comet-native/native-loop-runtime.js.map +1 -1
- package/dist/domains/comet-native/native-next-command.d.ts.map +1 -1
- package/dist/domains/comet-native/native-next-command.js +64 -7
- package/dist/domains/comet-native/native-next-command.js.map +1 -1
- package/dist/domains/comet-native/native-output-language.d.ts.map +1 -1
- package/dist/domains/comet-native/native-output-language.js.map +1 -1
- package/dist/domains/comet-native/native-portable-archive.d.ts.map +1 -1
- package/dist/domains/comet-native/native-portable-archive.js +17 -1
- package/dist/domains/comet-native/native-portable-archive.js.map +1 -1
- package/dist/domains/comet-native/native-portable-continuation.d.ts +11 -4
- package/dist/domains/comet-native/native-portable-continuation.d.ts.map +1 -1
- package/dist/domains/comet-native/native-portable-continuation.js +201 -44
- package/dist/domains/comet-native/native-portable-continuation.js.map +1 -1
- package/dist/domains/comet-native/native-portable-migration.d.ts.map +1 -1
- package/dist/domains/comet-native/native-portable-migration.js.map +1 -1
- package/dist/domains/comet-native/native-portable-recovery.d.ts +2 -1
- package/dist/domains/comet-native/native-portable-recovery.d.ts.map +1 -1
- package/dist/domains/comet-native/native-portable-recovery.js +28 -3
- package/dist/domains/comet-native/native-portable-recovery.js.map +1 -1
- package/dist/domains/comet-native/native-portable-runtime.d.ts +28 -1
- package/dist/domains/comet-native/native-portable-runtime.d.ts.map +1 -1
- package/dist/domains/comet-native/native-portable-runtime.js +276 -14
- package/dist/domains/comet-native/native-portable-runtime.js.map +1 -1
- package/dist/domains/comet-native/native-portable-state.d.ts.map +1 -1
- package/dist/domains/comet-native/native-portable-state.js +6 -0
- package/dist/domains/comet-native/native-portable-state.js.map +1 -1
- package/dist/domains/comet-native/native-portable-status.d.ts +5 -0
- package/dist/domains/comet-native/native-portable-status.d.ts.map +1 -1
- package/dist/domains/comet-native/native-portable-status.js +21 -1
- package/dist/domains/comet-native/native-portable-status.js.map +1 -1
- package/dist/domains/comet-native/native-portable-types.d.ts +1 -0
- package/dist/domains/comet-native/native-portable-types.d.ts.map +1 -1
- package/dist/domains/comet-native/native-portable-types.js.map +1 -1
- package/dist/domains/comet-native/native-runner-input.d.ts.map +1 -1
- package/dist/domains/comet-native/native-runner-input.js +26 -31
- package/dist/domains/comet-native/native-runner-input.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.map +1 -1
- package/dist/domains/comet-native/native-supervisor-overlay.d.ts +30 -0
- package/dist/domains/comet-native/native-supervisor-overlay.d.ts.map +1 -0
- package/dist/domains/comet-native/native-supervisor-overlay.js +202 -0
- package/dist/domains/comet-native/native-supervisor-overlay.js.map +1 -0
- package/dist/domains/comet-native/native-supervisor.d.ts +11 -1
- package/dist/domains/comet-native/native-supervisor.d.ts.map +1 -1
- package/dist/domains/comet-native/native-supervisor.js +68 -3
- package/dist/domains/comet-native/native-supervisor.js.map +1 -1
- package/dist/domains/comet-native/native-types.d.ts +1 -0
- package/dist/domains/comet-native/native-types.d.ts.map +1 -1
- package/dist/domains/comet-native/native-verification-receipt.d.ts.map +1 -1
- package/dist/domains/comet-native/native-verification-receipt.js.map +1 -1
- package/dist/domains/comet-native/native-workspace-finish.d.ts +12 -1
- package/dist/domains/comet-native/native-workspace-finish.d.ts.map +1 -1
- package/dist/domains/comet-native/native-workspace-finish.js +77 -22
- package/dist/domains/comet-native/native-workspace-finish.js.map +1 -1
- package/dist/domains/comet-native/native-workspace.d.ts.map +1 -1
- package/dist/domains/comet-native/native-workspace.js.map +1 -1
- package/dist/domains/comet-plugin/integration.d.ts +2 -0
- package/dist/domains/comet-plugin/integration.d.ts.map +1 -1
- package/dist/domains/comet-plugin/integration.js +10 -6
- package/dist/domains/comet-plugin/integration.js.map +1 -1
- package/dist/domains/dashboard/collector.js +1 -1
- package/dist/domains/dashboard/default-plugin-host.d.ts +3 -0
- package/dist/domains/dashboard/default-plugin-host.d.ts.map +1 -1
- package/dist/domains/dashboard/default-plugin-host.js +38 -4
- package/dist/domains/dashboard/default-plugin-host.js.map +1 -1
- package/dist/domains/dashboard/native-adapter.d.ts.map +1 -1
- package/dist/domains/dashboard/native-adapter.js.map +1 -1
- package/dist/domains/dashboard/web/assets/abnfDiagram-VCTEODGH-Bql0JkFh.js +1 -0
- package/dist/domains/dashboard/web/assets/arc-CCUY9L8x.js +1 -0
- package/dist/domains/dashboard/web/assets/architecture-7GRP2DOG-F2w5dggy.js +1 -0
- package/dist/domains/dashboard/web/assets/architectureDiagram-5GKGNRK7-iYP_D3CC.js +36 -0
- package/dist/domains/dashboard/web/assets/array-BifhSqXX.js +1 -0
- package/dist/domains/dashboard/web/assets/blockDiagram-I7D4REHJ-DyW07-ad.js +129 -0
- package/dist/domains/dashboard/web/assets/browser-CgwPGwaV.js +107 -0
- package/dist/domains/dashboard/web/assets/c4Diagram-7LVT6UL2-DDD_Y9Gj.js +38 -0
- package/dist/domains/dashboard/web/assets/channel-DLABCQMO.js +1 -0
- package/dist/domains/dashboard/web/assets/chunk-2Q5K7J3B-C1jixKkw.js +1 -0
- package/dist/domains/dashboard/web/assets/chunk-4HAMMTFA-cZryt4d4.js +62 -0
- package/dist/domains/dashboard/web/assets/{chunk-5VM5RSS4-CopXcnFA.js → chunk-5VM5RSS4-ZNzvKenW.js} +2 -2
- package/dist/domains/dashboard/web/assets/chunk-75Z2AOVW-Ciqzt_fM.js +2 -0
- package/dist/domains/dashboard/web/assets/chunk-DU6HZSFF-0EtIdyLT.js +125 -0
- package/dist/domains/dashboard/web/assets/chunk-F27PBJKO-B09yMHfO.js +1 -0
- package/dist/domains/dashboard/web/assets/chunk-FOHPRMQF-DHwB1DNv.js +161 -0
- package/dist/domains/dashboard/web/assets/chunk-GMAD6QVW-D_hJqXpD.js +72 -0
- package/dist/domains/dashboard/web/assets/chunk-GVQU2GXP-DIvLb3as.js +1 -0
- package/dist/domains/dashboard/web/assets/chunk-IMKFNOWR-B_oII0H5.js +231 -0
- package/dist/domains/dashboard/web/assets/chunk-JWPE2WC7-DVXcaiue.js +1 -0
- package/dist/domains/dashboard/web/assets/chunk-L3NEJ4N5-BALKwnUb.js +1 -0
- package/dist/domains/dashboard/web/assets/chunk-OSK3NFVY-zA0G74ff.js +10 -0
- package/dist/domains/dashboard/web/assets/chunk-P2QGCYS3-B9FFBdWw.js +1 -0
- package/dist/domains/dashboard/web/assets/chunk-POPQ4Y6H-Fwh05sRj.js +1 -0
- package/dist/domains/dashboard/web/assets/chunk-PWAF6VOD-cCaczJjE.js +1 -0
- package/dist/domains/dashboard/web/assets/chunk-SHT3W25Y-ffjS5Q53.js +168 -0
- package/dist/domains/dashboard/web/assets/chunk-SVP7TREG-IDmA7lw7.js +88 -0
- package/dist/domains/dashboard/web/assets/chunk-TICWLB2K-8Gmmm4In.js +206 -0
- package/dist/domains/dashboard/web/assets/chunk-XXDRQBXY-DS9V6N2-.js +1 -0
- package/dist/domains/dashboard/web/assets/chunk-Y2CYZVJY-DsF7k-Jl.js +1 -0
- package/dist/domains/dashboard/web/assets/classDiagram-ZZMXUADV-DJ9Y8TBe.js +1 -0
- package/dist/domains/dashboard/web/assets/classDiagram-v2-VYDZK3BY-DJ9Y8TBe.js +1 -0
- package/dist/domains/dashboard/web/assets/cose-bilkent-JH36ORCC-DTBreOtW.js +1 -0
- package/dist/domains/dashboard/web/assets/cynefin-OW5HDTMX-DQuEyCa9.js +1 -0
- package/dist/domains/dashboard/web/assets/cynefinDiagram-5FMLGOSQ-Bb0YxnR5.js +62 -0
- package/dist/domains/dashboard/web/assets/cytoscape.esm-CGd-uY3x.js +321 -0
- package/dist/domains/dashboard/web/assets/dagre-GXQ25YYZ-DCdqnZ1z.js +4 -0
- package/dist/domains/dashboard/web/assets/dagre-PrKaheQc.js +1 -0
- package/dist/domains/dashboard/web/assets/defaultLocale-BFoDCU3G.js +1 -0
- package/dist/domains/dashboard/web/assets/demo-DrJ2uuUL.js +456 -0
- package/dist/domains/dashboard/web/assets/diagram-S7CK7UJ4-CBO5Oebq.js +30 -0
- package/dist/domains/dashboard/web/assets/diagram-UQ7AKVKN-Do5KGiae.js +41 -0
- package/dist/domains/dashboard/web/assets/diagram-VSXAHHWV-4Xskky28.js +3 -0
- package/dist/domains/dashboard/web/assets/diagram-VX7I27RA-DHaxCMg1.js +24 -0
- package/dist/domains/dashboard/web/assets/diagram-Z3DM3KII-_b0C8RCs.js +24 -0
- package/dist/domains/dashboard/web/assets/dist-D_v6faRz.js +1 -0
- package/dist/domains/dashboard/web/assets/ebnfDiagram-PWID7BFC-BlWWQsBx.js +1 -0
- package/dist/domains/dashboard/web/assets/erDiagram-RLTQ6QDP-CaZks0yu.js +99 -0
- package/dist/domains/dashboard/web/assets/es-DMM6Y5Bv.js +10 -0
- package/dist/domains/dashboard/web/assets/eventmodeling-NTZA5JFV-LE_eXkBk.js +1 -0
- package/dist/domains/dashboard/web/assets/flowDiagram-HODETNUW-Dhg9N1uf.js +1 -0
- package/dist/domains/dashboard/web/assets/ganttDiagram-EL5Y4UJY-BSjOQ_Cg.js +292 -0
- package/dist/domains/dashboard/web/assets/gitGraph-4MIJSDKK-DYwq3-1L.js +1 -0
- package/dist/domains/dashboard/web/assets/gitGraphDiagram-WWUBYQGX-oVngpACZ.js +106 -0
- package/dist/domains/dashboard/web/assets/graphlib-DS17s2tU.js +1 -0
- package/dist/domains/dashboard/web/assets/index-7epoYLF6.js +261 -0
- package/dist/domains/dashboard/web/assets/index-C5iz4lns.css +1 -0
- package/dist/domains/dashboard/web/assets/info-A6RAGUB7-CLoje88f.js +1 -0
- package/dist/domains/dashboard/web/assets/infoDiagram-27XIBGKW-sS6zp9EL.js +2 -0
- package/dist/domains/dashboard/web/assets/init-C-OQMol4.js +1 -0
- package/dist/domains/dashboard/web/assets/ishikawaDiagram-5VMMS53U-kETJqqgb.js +70 -0
- package/dist/domains/dashboard/web/assets/journeyDiagram-3NMN7TZE-ByJPB5Tw.js +139 -0
- package/dist/domains/dashboard/web/assets/kanban-definition-UXKFOSKX-JKqPn1FZ.js +89 -0
- package/dist/domains/dashboard/web/assets/katex-CXMH3UgJ.js +257 -0
- package/dist/domains/dashboard/web/assets/line-CnHo6lWD.js +1 -0
- package/dist/domains/dashboard/web/assets/linear-B2pLEjo4.js +1 -0
- package/dist/domains/dashboard/web/assets/marked.esm-BtJme7Pf.js +65 -0
- package/dist/domains/dashboard/web/assets/mermaid-parser.core-OtNk5rQN.js +7 -0
- package/dist/domains/dashboard/web/assets/mermaid.core-D1ElL3aM.js +44 -0
- package/dist/domains/dashboard/web/assets/mindmap-definition-YA3MSWOX-BxJqN_qn.js +96 -0
- package/dist/domains/dashboard/web/assets/ordinal-BDEzSJ7C.js +1 -0
- package/dist/domains/dashboard/web/assets/packet-AYTQ26CC-DM9DL0wE.js +1 -0
- package/dist/domains/dashboard/web/assets/path-fybaL0A-.js +1 -0
- package/dist/domains/dashboard/web/assets/pegDiagram-XKGWAZYB-BDe-x6aH.js +1 -0
- package/dist/domains/dashboard/web/assets/pie-WAS4IAKB-ClmkkApZ.js +1 -0
- package/dist/domains/dashboard/web/assets/pieDiagram-E7YTZNPT-DSFQ6yQn.js +39 -0
- package/dist/domains/dashboard/web/assets/purify.es-ChwZkWde.js +3 -0
- package/dist/domains/dashboard/web/assets/quadrantDiagram-AXDQQJYC-CV2lLCpu.js +7 -0
- package/dist/domains/dashboard/web/assets/radar-RG4KPBEZ-BduOvwgQ.js +1 -0
- package/dist/domains/dashboard/web/assets/railroad-74A4TZTK-BYnUo_HE.js +1 -0
- package/dist/domains/dashboard/web/assets/railroad-abnf-HS5TGJTU-CPiOAGi2.js +1 -0
- package/dist/domains/dashboard/web/assets/railroad-ebnf-LZEXJU2U-DOuNY-jw.js +1 -0
- package/dist/domains/dashboard/web/assets/railroad-peg-WCYAUIDC-DjNccNww.js +1 -0
- package/dist/domains/dashboard/web/assets/railroadDiagram-O6MQD6OU-Y0OnScVm.js +1 -0
- package/dist/domains/dashboard/web/assets/requirementDiagram-BXWQKSXE-Dqs0b-_F.js +84 -0
- package/dist/domains/dashboard/web/assets/rough.esm-Dy-Kn_BL.js +1 -0
- package/dist/domains/dashboard/web/assets/sankeyDiagram-P5KCCOFB-DafYyCgJ.js +40 -0
- package/dist/domains/dashboard/web/assets/sequenceDiagram-WJ2MYXX4-DEu4sb48.js +162 -0
- package/dist/domains/dashboard/web/assets/sizeCapture-INFHLROL-B0uUizjq.js +1 -0
- package/dist/domains/dashboard/web/assets/src-je_XM8Ul.js +1 -0
- package/dist/domains/dashboard/web/assets/stateDiagram-D77RDMKH-vHbZoYCK.js +1 -0
- package/dist/domains/dashboard/web/assets/stateDiagram-v2-MP3YSRHH-C4dywNHK.js +1 -0
- package/dist/domains/dashboard/web/assets/swimlanes-42K2YHIH-DxEqhoUX.js +1 -0
- package/dist/domains/dashboard/web/assets/swimlanesDiagram-VR7AAH4N-CHhHUVep.js +8 -0
- package/dist/domains/dashboard/web/assets/timeline-definition-24CTP7MA-B4XpTytf.js +120 -0
- package/dist/domains/dashboard/web/assets/treeView-Q6P3EWNA-CrismRW3.js +1 -0
- package/dist/domains/dashboard/web/assets/treemap-WGGIJYW6-BGFmknIY.js +1 -0
- package/dist/domains/dashboard/web/assets/vennDiagram-4TSXK5OY-DphMzj7N.js +34 -0
- package/dist/domains/dashboard/web/assets/wardley-WFR3VGLG-DmeLufag.js +1 -0
- package/dist/domains/dashboard/web/assets/wardleyDiagram-VM6X3IG4-BUDxONKk.js +78 -0
- package/dist/domains/dashboard/web/assets/xychartDiagram-S5SC5T6Z-BjqVHkW2.js +7 -0
- package/dist/domains/dashboard/web/index.html +16 -16
- package/dist/domains/factory/artifacts.d.ts.map +1 -1
- package/dist/domains/factory/artifacts.js.map +1 -1
- package/dist/domains/factory/types.d.ts.map +1 -1
- package/dist/domains/integrations/codegraph.d.ts.map +1 -1
- package/dist/domains/integrations/codegraph.js.map +1 -1
- package/dist/domains/project-knowledge/deterministic-extractors.d.ts.map +1 -1
- package/dist/domains/project-knowledge/deterministic-extractors.js +7 -6
- package/dist/domains/project-knowledge/deterministic-extractors.js.map +1 -1
- package/dist/domains/project-knowledge/index-store.d.ts +1 -1
- package/dist/domains/project-knowledge/index-store.d.ts.map +1 -1
- package/dist/domains/project-knowledge/index-store.js +19 -10
- package/dist/domains/project-knowledge/index-store.js.map +1 -1
- package/dist/domains/project-knowledge/learning.d.ts +1 -0
- package/dist/domains/project-knowledge/learning.d.ts.map +1 -1
- package/dist/domains/project-knowledge/learning.js +27 -8
- package/dist/domains/project-knowledge/learning.js.map +1 -1
- package/dist/domains/project-knowledge/local-provider.d.ts +1 -0
- package/dist/domains/project-knowledge/local-provider.d.ts.map +1 -1
- package/dist/domains/project-knowledge/local-provider.js +26 -1
- package/dist/domains/project-knowledge/local-provider.js.map +1 -1
- package/dist/domains/project-knowledge/local-store.d.ts +23 -1
- package/dist/domains/project-knowledge/local-store.d.ts.map +1 -1
- package/dist/domains/project-knowledge/local-store.js +179 -22
- package/dist/domains/project-knowledge/local-store.js.map +1 -1
- package/dist/domains/project-knowledge/plugin.d.ts.map +1 -1
- package/dist/domains/project-knowledge/plugin.js +55 -8
- package/dist/domains/project-knowledge/plugin.js.map +1 -1
- package/dist/domains/project-knowledge/records.d.ts +2 -0
- package/dist/domains/project-knowledge/records.d.ts.map +1 -1
- package/dist/domains/project-knowledge/records.js +8 -0
- package/dist/domains/project-knowledge/records.js.map +1 -1
- package/dist/domains/project-knowledge/types.d.ts +16 -0
- package/dist/domains/project-knowledge/types.d.ts.map +1 -1
- package/dist/domains/skill/platform-inspect.d.ts +1 -1
- package/dist/domains/skill/platform-inspect.d.ts.map +1 -1
- package/dist/domains/skill/platform-inspect.js +50 -10
- package/dist/domains/skill/platform-inspect.js.map +1 -1
- package/dist/domains/skill/platform-install.d.ts +10 -5
- package/dist/domains/skill/platform-install.d.ts.map +1 -1
- package/dist/domains/skill/platform-install.js +107 -17
- 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 +38 -61
- package/dist/domains/skill/uninstall.js.map +1 -1
- package/dist/domains/workflow-contract/contained-atomic-write.d.ts +1 -0
- package/dist/domains/workflow-contract/contained-atomic-write.d.ts.map +1 -1
- package/dist/domains/workflow-contract/contained-atomic-write.js +19 -0
- package/dist/domains/workflow-contract/contained-atomic-write.js.map +1 -1
- package/dist/domains/workflow-contract/global-config.d.ts +8 -0
- package/dist/domains/workflow-contract/global-config.d.ts.map +1 -1
- package/dist/domains/workflow-contract/global-config.js +25 -0
- package/dist/domains/workflow-contract/global-config.js.map +1 -1
- package/dist/domains/workflow-contract/index.d.ts +1 -1
- package/dist/domains/workflow-contract/index.d.ts.map +1 -1
- package/dist/domains/workflow-contract/index.js +1 -1
- package/dist/domains/workflow-contract/index.js.map +1 -1
- package/dist/domains/workflow-contract/project-config.d.ts +1 -1
- package/dist/domains/workflow-contract/project-config.d.ts.map +1 -1
- package/dist/domains/workflow-contract/project-config.js +1 -0
- package/dist/domains/workflow-contract/project-config.js.map +1 -1
- package/dist/domains/workflow-contract/protected-project-path.d.ts +4 -1
- package/dist/domains/workflow-contract/protected-project-path.d.ts.map +1 -1
- package/dist/domains/workflow-contract/protected-project-path.js +25 -1
- package/dist/domains/workflow-contract/protected-project-path.js.map +1 -1
- package/dist/domains/workflow-contract/types.d.ts.map +1 -1
- package/dist/platform/fs/race-safe-read.d.ts +14 -0
- package/dist/platform/fs/race-safe-read.d.ts.map +1 -1
- package/dist/platform/fs/race-safe-read.js +81 -0
- package/dist/platform/fs/race-safe-read.js.map +1 -1
- package/dist/platform/install/platforms.d.ts +4 -0
- package/dist/platform/install/platforms.d.ts.map +1 -1
- package/dist/platform/install/platforms.js +15 -3
- package/dist/platform/install/platforms.js.map +1 -1
- package/dist/platform/paths/project-knowledge-storage.d.ts +1 -1
- package/dist/platform/paths/project-knowledge-storage.d.ts.map +1 -1
- package/dist/platform/paths/project-knowledge-storage.js +9 -4
- package/dist/platform/paths/project-knowledge-storage.js.map +1 -1
- package/eval/local/tasks/comet-classic-layout-lifecycle/environment/current-comet-package.json +13 -13
- package/eval/local/tasks/comet-native-wave-f-dashboard-readonly/environment/current-comet-package.json +13 -13
- package/package.json +24 -24
- package/dist/domains/dashboard/web/assets/abnfDiagram-N423BO3Z-BkUJc7LK.js +0 -1
- package/dist/domains/dashboard/web/assets/arc-DY4Y9tSO.js +0 -1
- package/dist/domains/dashboard/web/assets/architectureDiagram-T3A2C74G-7wC9YZS-.js +0 -36
- package/dist/domains/dashboard/web/assets/blockDiagram-VBNYF7ZC-Biqe-SaL.js +0 -132
- package/dist/domains/dashboard/web/assets/c4Diagram-5PPSVZJV-CccUFD1S.js +0 -10
- package/dist/domains/dashboard/web/assets/channel-DnRvSkOm.js +0 -1
- package/dist/domains/dashboard/web/assets/chunk-2GRJ4B5K-BUL4dDxo.js +0 -1
- package/dist/domains/dashboard/web/assets/chunk-2Q5K7J3B-BnKtDH9O.js +0 -1
- package/dist/domains/dashboard/web/assets/chunk-5RXB4S5H-C9pHQ1n3.js +0 -231
- package/dist/domains/dashboard/web/assets/chunk-6Q2QTUOP-CxrbngCi.js +0 -88
- package/dist/domains/dashboard/web/assets/chunk-GF5L2VYU-01mzgCUh.js +0 -206
- package/dist/domains/dashboard/web/assets/chunk-JWPE2WC7-wTiZVDvw.js +0 -1
- package/dist/domains/dashboard/web/assets/chunk-KBJHAD2P-Bxdv5bl-.js +0 -1
- package/dist/domains/dashboard/web/assets/chunk-RYQCIY6F-B5vF9l9A.js +0 -1
- package/dist/domains/dashboard/web/assets/chunk-XXDRQBXY-Dra3NnDp.js +0 -1
- package/dist/domains/dashboard/web/assets/classDiagram-JCYQIIEL-D3E-rgaQ.js +0 -1
- package/dist/domains/dashboard/web/assets/classDiagram-v2-OCEON4UE-D3E-rgaQ.js +0 -1
- package/dist/domains/dashboard/web/assets/cose-bilkent-JH36ORCC-DC96ge-n.js +0 -1
- package/dist/domains/dashboard/web/assets/cynefin-VYW2F7L2-Tt_NiopT.js +0 -166
- package/dist/domains/dashboard/web/assets/cynefinDiagram-MW4NZA55-BQ5__1hv.js +0 -62
- package/dist/domains/dashboard/web/assets/cytoscape.esm-D3_iZ_3b.js +0 -321
- package/dist/domains/dashboard/web/assets/dagre-VZM6K2ZE-Cr2zq3ro.js +0 -4
- package/dist/domains/dashboard/web/assets/defaultLocale-DX6XiGOO.js +0 -1
- package/dist/domains/dashboard/web/assets/demo-lxXhgJ9-.js +0 -456
- package/dist/domains/dashboard/web/assets/diagram-7IWD3JNH-BRpYDwPl.js +0 -30
- package/dist/domains/dashboard/web/assets/diagram-B4RE2ZJO-D7u-VBxW.js +0 -3
- package/dist/domains/dashboard/web/assets/diagram-LBJQPF4R-CHYuv2JD.js +0 -24
- package/dist/domains/dashboard/web/assets/diagram-Q27KOJAE-CV3ZE8Q3.js +0 -24
- package/dist/domains/dashboard/web/assets/diagram-UB23O5K3-co_OsTiQ.js +0 -41
- package/dist/domains/dashboard/web/assets/ebnfDiagram-BXEA7PRR-CETcWswS.js +0 -1
- package/dist/domains/dashboard/web/assets/erDiagram-JOGREHBK-edkItb7Z.js +0 -85
- package/dist/domains/dashboard/web/assets/flowDiagram-UKHOOZJN-D_oFJtSf.js +0 -156
- package/dist/domains/dashboard/web/assets/ganttDiagram-PKOTCBZU-CFjLVoA1.js +0 -292
- package/dist/domains/dashboard/web/assets/gitGraphDiagram-DS77QQ5N-BfD0tiKH.js +0 -106
- package/dist/domains/dashboard/web/assets/graph-DOmOIIwC.js +0 -1
- package/dist/domains/dashboard/web/assets/index-BzyqCfMb.css +0 -1
- package/dist/domains/dashboard/web/assets/index-CCKHH_A9.js +0 -10
- package/dist/domains/dashboard/web/assets/index-D8dxsTJY.js +0 -271
- package/dist/domains/dashboard/web/assets/index-DlSYK56b.js +0 -139
- package/dist/domains/dashboard/web/assets/infoDiagram-6WML65LV-Cx6xa9DS.js +0 -2
- package/dist/domains/dashboard/web/assets/init-Gi6I4Gst.js +0 -1
- package/dist/domains/dashboard/web/assets/ishikawaDiagram-WSZJBQD7-BjNLyyv_.js +0 -70
- package/dist/domains/dashboard/web/assets/journeyDiagram-NVQOT4AX-D2n9vrhx.js +0 -139
- package/dist/domains/dashboard/web/assets/kanban-definition-27J2QSJJ-kJL7v018.js +0 -89
- package/dist/domains/dashboard/web/assets/katex-HP8lGamR.js +0 -257
- package/dist/domains/dashboard/web/assets/layout-D-LzfAck.js +0 -1
- package/dist/domains/dashboard/web/assets/linear-CeHtd5-l.js +0 -1
- package/dist/domains/dashboard/web/assets/map-DxJ2ADlA.js +0 -1
- package/dist/domains/dashboard/web/assets/marked.esm-DECB3bxB.js +0 -64
- package/dist/domains/dashboard/web/assets/mermaid.core-B0EPSHs2.js +0 -306
- package/dist/domains/dashboard/web/assets/mindmap-definition-FAOFIHXS-bQQWINF4.js +0 -96
- package/dist/domains/dashboard/web/assets/ordinal-Cboi1Yqb.js +0 -1
- package/dist/domains/dashboard/web/assets/pegDiagram-VL7TDLO6-LxLY1W7W.js +0 -1
- package/dist/domains/dashboard/web/assets/pieDiagram-7S7Q4E2Y-BMDQqvuT.js +0 -39
- package/dist/domains/dashboard/web/assets/purify.es-Cz4mVeUR.js +0 -3
- package/dist/domains/dashboard/web/assets/quadrantDiagram-CIZ2JOQS-XWYjcuZN.js +0 -7
- package/dist/domains/dashboard/web/assets/railroadDiagram-AXF67PYL-p-OlQTa7.js +0 -1
- package/dist/domains/dashboard/web/assets/requirementDiagram-LRYGKXZP-BL4N8Vsl.js +0 -84
- package/dist/domains/dashboard/web/assets/sankeyDiagram-W5VNT64P-Btu-o6LN.js +0 -40
- package/dist/domains/dashboard/web/assets/sequenceDiagram-SI44F4Z6-9HpdQQ47.js +0 -162
- package/dist/domains/dashboard/web/assets/sizeCapture-X5ZJPWSS-5AnBiBHD.js +0 -1
- package/dist/domains/dashboard/web/assets/stateDiagram-OKZ733FA-Dv8IDsai.js +0 -1
- package/dist/domains/dashboard/web/assets/stateDiagram-v2-UEYNNEHI-DxOMyFOm.js +0 -1
- package/dist/domains/dashboard/web/assets/swimlanes-SLNWSIFB-BfJcN7dK.js +0 -2
- package/dist/domains/dashboard/web/assets/swimlanesDiagram-ULZ7WXOC-BnHRSbDk.js +0 -8
- package/dist/domains/dashboard/web/assets/timeline-definition-Z64GVDOM-DEOuEHi5.js +0 -120
- package/dist/domains/dashboard/web/assets/vennDiagram-T6HMQDX7-BqsGpwgo.js +0 -34
- package/dist/domains/dashboard/web/assets/wardleyDiagram-T6FBY63Y-CXlOp9so.js +0 -78
- package/dist/domains/dashboard/web/assets/xychartDiagram-ELKLHX3M-DyqqtC9X.js +0 -7
|
@@ -1,40 +1,40 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __cometCreateRequire } from 'module';
|
|
3
3
|
const require = __cometCreateRequire(import.meta.url);
|
|
4
|
-
var Nf=Object.create;var
|
|
5
|
-
`)}};Tt.defaultYaml={explicit:!1,version:"1.2"};Tt.defaultTags={"!!":"tag:yaml.org,2002:"};ea.Directives=Tt});var Wn=y($t=>{"use strict";var ta=
|
|
6
|
-
`)?
|
|
4
|
+
var Nf=Object.create;var yi=Object.defineProperty;var jf=Object.getOwnPropertyDescriptor;var Tf=Object.getOwnPropertyNames;var $f=Object.getPrototypeOf,If=Object.prototype.hasOwnProperty;var Tn=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,n)=>(typeof require<"u"?require:e)[n]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var B=(t,e,n)=>()=>{if(n)throw n[0];try{return t&&(e=t(t=0)),e}catch(r){throw n=[r],r}};var y=(t,e)=>()=>{try{return e||t((e={exports:{}}).exports,e),e.exports}catch(n){throw e=0,n}},Lf=(t,e)=>{for(var n in e)yi(t,n,{get:e[n],enumerable:!0})},qf=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Tf(e))!If.call(t,i)&&i!==n&&yi(t,i,{get:()=>e[i],enumerable:!(r=jf(e,i))||r.enumerable});return t};var Xe=(t,e,n)=>(n=t!=null?Nf($f(t)):{},qf(e||!t||!t.__esModule?yi(n,"default",{value:t,enumerable:!0}):n,t));var O=y(V=>{"use strict";var vi=Symbol.for("yaml.alias"),Hs=Symbol.for("yaml.document"),$n=Symbol.for("yaml.map"),Ys=Symbol.for("yaml.pair"),ki=Symbol.for("yaml.scalar"),In=Symbol.for("yaml.seq"),ge=Symbol.for("yaml.node.type"),Wf=t=>!!t&&typeof t=="object"&&t[ge]===vi,Ff=t=>!!t&&typeof t=="object"&&t[ge]===Hs,Df=t=>!!t&&typeof t=="object"&&t[ge]===$n,Mf=t=>!!t&&typeof t=="object"&&t[ge]===Ys,Vs=t=>!!t&&typeof t=="object"&&t[ge]===ki,Bf=t=>!!t&&typeof t=="object"&&t[ge]===In;function Js(t){if(t&&typeof t=="object")switch(t[ge]){case $n:case In:return!0}return!1}function Kf(t){if(t&&typeof t=="object")switch(t[ge]){case vi:case $n:case ki:case In:return!0}return!1}var Uf=t=>(Vs(t)||Js(t))&&!!t.anchor;V.ALIAS=vi;V.DOC=Hs;V.MAP=$n;V.NODE_TYPE=ge;V.PAIR=Ys;V.SCALAR=ki;V.SEQ=In;V.hasAnchor=Uf;V.isAlias=Wf;V.isCollection=Js;V.isDocument=Ff;V.isMap=Df;V.isNode=Kf;V.isPair=Mf;V.isScalar=Vs;V.isSeq=Bf});var jt=y(bi=>{"use strict";var K=O(),Z=Symbol("break visit"),Gs=Symbol("skip children"),me=Symbol("remove node");function Ln(t,e){let n=zs(e);K.isDocument(t)?pt(null,t.contents,n,Object.freeze([t]))===me&&(t.contents=null):pt(null,t,n,Object.freeze([]))}Ln.BREAK=Z;Ln.SKIP=Gs;Ln.REMOVE=me;function pt(t,e,n,r){let i=Qs(t,e,n,r);if(K.isNode(i)||K.isPair(i))return Xs(t,r,i),pt(t,i,n,r);if(typeof i!="symbol"){if(K.isCollection(e)){r=Object.freeze(r.concat(e));for(let o=0;o<e.items.length;++o){let s=pt(o,e.items[o],n,r);if(typeof s=="number")o=s-1;else{if(s===Z)return Z;s===me&&(e.items.splice(o,1),o-=1)}}}else if(K.isPair(e)){r=Object.freeze(r.concat(e));let o=pt("key",e.key,n,r);if(o===Z)return Z;o===me&&(e.key=null);let s=pt("value",e.value,n,r);if(s===Z)return Z;s===me&&(e.value=null)}}return i}async function qn(t,e){let n=zs(e);K.isDocument(t)?await ht(null,t.contents,n,Object.freeze([t]))===me&&(t.contents=null):await ht(null,t,n,Object.freeze([]))}qn.BREAK=Z;qn.SKIP=Gs;qn.REMOVE=me;async function ht(t,e,n,r){let i=await Qs(t,e,n,r);if(K.isNode(i)||K.isPair(i))return Xs(t,r,i),ht(t,i,n,r);if(typeof i!="symbol"){if(K.isCollection(e)){r=Object.freeze(r.concat(e));for(let o=0;o<e.items.length;++o){let s=await ht(o,e.items[o],n,r);if(typeof s=="number")o=s-1;else{if(s===Z)return Z;s===me&&(e.items.splice(o,1),o-=1)}}}else if(K.isPair(e)){r=Object.freeze(r.concat(e));let o=await ht("key",e.key,n,r);if(o===Z)return Z;o===me&&(e.key=null);let s=await ht("value",e.value,n,r);if(s===Z)return Z;s===me&&(e.value=null)}}return i}function zs(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 Qs(t,e,n,r){if(typeof n=="function")return n(t,e,r);if(K.isMap(e))return n.Map?.(t,e,r);if(K.isSeq(e))return n.Seq?.(t,e,r);if(K.isPair(e))return n.Pair?.(t,e,r);if(K.isScalar(e))return n.Scalar?.(t,e,r);if(K.isAlias(e))return n.Alias?.(t,e,r)}function Xs(t,e,n){let r=e[e.length-1];if(K.isCollection(r))r.items[t]=n;else if(K.isPair(r))t==="key"?r.key=n:r.value=n;else if(K.isDocument(r))r.contents=n;else{let i=K.isAlias(r)?"alias":"scalar";throw new Error(`Cannot replace node with ${i} parent`)}}bi.visit=Ln;bi.visitAsync=qn});var Si=y(ea=>{"use strict";var Zs=O(),Hf=jt(),Yf={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},Vf=t=>t.replace(/[!,[\]{}]/g,e=>Yf[e]),Tt=class t{constructor(e,n){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},t.defaultYaml,e),this.tags=Object.assign({},t.defaultTags,n)}clone(){let e=new t(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){let e=new t(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:t.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},t.defaultTags);break}return e}add(e,n){this.atNextDocument&&(this.yaml={explicit:t.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},t.defaultTags),this.atNextDocument=!1);let r=e.trim().split(/[ \t]+/),i=r.shift();switch(i){case"%TAG":{if(r.length!==2&&(n(0,"%TAG directive should contain exactly two parts"),r.length<2))return!1;let[o,s]=r;return this.tags[o]=s,!0}case"%YAML":{if(this.yaml.explicit=!0,r.length!==1)return n(0,"%YAML directive should contain exactly one part"),!1;let[o]=r;if(o==="1.1"||o==="1.2")return this.yaml.version=o,!0;{let s=/^\d+\.\d+$/.test(o);return n(6,`Unsupported YAML version ${o}`,s),!1}}default:return n(0,`Unknown directive ${i}`,!0),!1}}tagName(e,n){if(e==="!")return"!";if(e[0]!=="!")return n(`Not a valid tag: ${e}`),null;if(e[1]==="<"){let s=e.slice(2,-1);return s==="!"||s==="!!"?(n(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&n("Verbatim tags must end with a >"),s)}let[,r,i]=e.match(/^(.*!)([^!]*)$/s);i||n(`The ${e} tag has no suffix`);let o=this.tags[r];if(o)try{return o+decodeURIComponent(i)}catch(s){return n(String(s)),null}return r==="!"?e:(n(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[n,r]of Object.entries(this.tags))if(e.startsWith(r))return n+Vf(e.substring(r.length));return e[0]==="!"?e:`!<${e}>`}toString(e){let n=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],r=Object.entries(this.tags),i;if(e&&r.length>0&&Zs.isNode(e.contents)){let o={};Hf.visit(e.contents,(s,a)=>{Zs.isNode(a)&&a.tag&&(o[a.tag]=!0)}),i=Object.keys(o)}else i=[];for(let[o,s]of r)o==="!!"&&s==="tag:yaml.org,2002:"||(!e||i.some(a=>a.startsWith(s)))&&n.push(`%TAG ${o} ${s}`);return n.join(`
|
|
5
|
+
`)}};Tt.defaultYaml={explicit:!1,version:"1.2"};Tt.defaultTags={"!!":"tag:yaml.org,2002:"};ea.Directives=Tt});var Wn=y($t=>{"use strict";var ta=O(),Jf=jt();function Gf(t){if(/[\x00-\x19\s,[\]{}]/.test(t)){let n=`Anchor must not contain whitespace or control characters: ${JSON.stringify(t)}`;throw new Error(n)}return!0}function na(t){let e=new Set;return Jf.visit(t,{Value(n,r){r.anchor&&e.add(r.anchor)}}),e}function ra(t,e){for(let n=1;;++n){let r=`${t}${n}`;if(!e.has(r))return r}}function zf(t,e){let n=[],r=new Map,i=null;return{onAnchor:o=>{n.push(o),i??(i=na(t));let s=ra(e,i);return i.add(s),s},setAnchors:()=>{for(let o of n){let s=r.get(o);if(typeof s=="object"&&s.anchor&&(ta.isScalar(s.node)||ta.isCollection(s.node)))s.node.anchor=s.anchor;else{let a=new Error("Failed to resolve repeated object (this should not happen)");throw a.source=o,a}}},sourceObjects:r}}$t.anchorIsValid=Gf;$t.anchorNames=na;$t.createNodeAnchors=zf;$t.findNewAnchor=ra});var Ci=y(ia=>{"use strict";function It(t,e,n,r){if(r&&typeof r=="object")if(Array.isArray(r))for(let i=0,o=r.length;i<o;++i){let s=r[i],a=It(t,r,String(i),s);a===void 0?delete r[i]:a!==s&&(r[i]=a)}else if(r instanceof Map)for(let i of Array.from(r.keys())){let o=r.get(i),s=It(t,r,i,o);s===void 0?r.delete(i):s!==o&&r.set(i,s)}else if(r instanceof Set)for(let i of Array.from(r)){let o=It(t,r,i,i);o===void 0?r.delete(i):o!==i&&(r.delete(i),r.add(o))}else for(let[i,o]of Object.entries(r)){let s=It(t,r,i,o);s===void 0?delete r[i]:s!==o&&(r[i]=s)}return t.call(e,n,r)}ia.applyReviver=It});var xe=y(sa=>{"use strict";var Qf=O();function oa(t,e,n){if(Array.isArray(t))return t.map((r,i)=>oa(r,String(i),n));if(t&&typeof t.toJSON=="function"){if(!n||!Qf.hasAnchor(t))return t.toJSON(e,n);let r={aliasCount:0,count:1,res:void 0};n.anchors.set(t,r),n.onCreate=o=>{r.res=o,delete n.onCreate};let i=t.toJSON(e,n);return n.onCreate&&n.onCreate(i),i}return typeof t=="bigint"&&!n?.keep?Number(t):t}sa.toJS=oa});var Fn=y(ca=>{"use strict";var Xf=Ci(),aa=O(),Zf=xe(),Ei=class{constructor(e){Object.defineProperty(this,aa.NODE_TYPE,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:n,maxAliasCount:r,onAnchor:i,reviver:o}={}){if(!aa.isDocument(e))throw new TypeError("A document argument is required");let s={anchors:new Map,doc:e,keep:!0,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof r=="number"?r:100},a=Zf.toJS(this,"",s);if(typeof i=="function")for(let{count:c,res:l}of s.anchors.values())i(l,c);return typeof o=="function"?Xf.applyReviver(o,{"":a},"",a):a}};ca.NodeBase=Ei});var Lt=y(la=>{"use strict";var ed=Wn(),td=jt(),gt=O(),nd=Fn(),rd=xe(),_i=class extends nd.NodeBase{constructor(e){super(gt.ALIAS),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e,n){if(n?.maxAliasCount===0)throw new ReferenceError("Alias resolution is disabled");let r;n?.aliasResolveCache?r=n.aliasResolveCache:(r=[],td.visit(e,{Node:(o,s)=>{(gt.isAlias(s)||gt.hasAnchor(s))&&r.push(s)}}),n&&(n.aliasResolveCache=r));let i;for(let o of r){if(o===this)break;o.anchor===this.source&&(i=o)}return i}toJSON(e,n){if(!n)return{source:this.source};let{anchors:r,doc:i,maxAliasCount:o}=n,s=this.resolve(i,n);if(!s){let c=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(c)}let a=r.get(s);if(a||(rd.toJS(s,null,n),a=r.get(s)),a?.res===void 0){let c="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(c)}if(o>=0&&(a.count+=1,a.aliasCount===0&&(a.aliasCount=Dn(i,s,r)),a.count*a.aliasCount>o)){let c="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(c)}return a.res}toString(e,n,r){let i=`*${this.source}`;if(e){if(ed.anchorIsValid(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let o=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(o)}if(e.implicitKey)return`${i} `}return i}};function Dn(t,e,n){if(gt.isAlias(e)){let r=e.resolve(t),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}else if(gt.isCollection(e)){let r=0;for(let i of e.items){let o=Dn(t,i,n);o>r&&(r=o)}return r}else if(gt.isPair(e)){let r=Dn(t,e.key,n),i=Dn(t,e.value,n);return Math.max(r,i)}return 1}la.Alias=_i});var W=y(xi=>{"use strict";var id=O(),od=Fn(),sd=xe(),ad=t=>!t||typeof t!="function"&&typeof t!="object",Pe=class extends od.NodeBase{constructor(e){super(id.SCALAR),this.value=e}toJSON(e,n){return n?.keep?this.value:sd.toJS(this.value,e,n)}toString(){return String(this.value)}};Pe.BLOCK_FOLDED="BLOCK_FOLDED";Pe.BLOCK_LITERAL="BLOCK_LITERAL";Pe.PLAIN="PLAIN";Pe.QUOTE_DOUBLE="QUOTE_DOUBLE";Pe.QUOTE_SINGLE="QUOTE_SINGLE";xi.Scalar=Pe;xi.isScalarValue=ad});var qt=y(fa=>{"use strict";var cd=Lt(),Ze=O(),ua=W(),ld="tag:yaml.org,2002:";function ud(t,e,n){if(e){let r=n.filter(o=>o.tag===e),i=r.find(o=>!o.format)??r[0];if(!i)throw new Error(`Tag ${e} not found`);return i}return n.find(r=>r.identify?.(t)&&!r.format)}function fd(t,e,n){if(Ze.isDocument(t)&&(t=t.contents),Ze.isNode(t))return t;if(Ze.isPair(t)){let d=n.schema[Ze.MAP].createNode?.(n.schema,null,n);return d.items.push(t),d}(t instanceof String||t instanceof Number||t instanceof Boolean||typeof BigInt<"u"&&t instanceof BigInt)&&(t=t.valueOf());let{aliasDuplicateObjects:r,onAnchor:i,onTagObj:o,schema:s,sourceObjects:a}=n,c;if(r&&t&&typeof t=="object"){if(c=a.get(t),c)return c.anchor??(c.anchor=i(t)),new cd.Alias(c.anchor);c={anchor:null,node:null},a.set(t,c)}e?.startsWith("!!")&&(e=ld+e.slice(2));let l=ud(t,e,s.tags);if(!l){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let d=new ua.Scalar(t);return c&&(c.node=d),d}l=t instanceof Map?s[Ze.MAP]:Symbol.iterator in Object(t)?s[Ze.SEQ]:s[Ze.MAP]}o&&(o(l),delete n.onTagObj);let u=l?.createNode?l.createNode(n.schema,t,n):typeof l?.nodeClass?.from=="function"?l.nodeClass.from(n.schema,t,n):new ua.Scalar(t);return e?u.tag=e:l.default||(u.tag=l.tag),c&&(c.node=u),u}fa.createNode=fd});var Bn=y(Mn=>{"use strict";var dd=qt(),pe=O(),md=Fn();function Pi(t,e,n){let r=n;for(let i=e.length-1;i>=0;--i){let o=e[i];if(typeof o=="number"&&Number.isInteger(o)&&o>=0){let s=[];s[o]=r,r=s}else r=new Map([[o,r]])}return dd.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 da=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,Ri=class extends md.NodeBase{constructor(e,n){super(e),Object.defineProperty(this,"schema",{value:n,configurable:!0,enumerable:!1,writable:!0})}clone(e){let n=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(n.schema=e),n.items=n.items.map(r=>pe.isNode(r)||pe.isPair(r)?r.clone(e):r),this.range&&(n.range=this.range.slice()),n}addIn(e,n){if(da(e))this.add(n);else{let[r,...i]=e,o=this.get(r,!0);if(pe.isCollection(o))o.addIn(i,n);else if(o===void 0&&this.schema)this.set(r,Pi(this.schema,i,n));else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${i}`)}}deleteIn(e){let[n,...r]=e;if(r.length===0)return this.delete(n);let i=this.get(n,!0);if(pe.isCollection(i))return i.deleteIn(r);throw new Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}getIn(e,n){let[r,...i]=e,o=this.get(r,!0);return i.length===0?!n&&pe.isScalar(o)?o.value:o:pe.isCollection(o)?o.getIn(i,n):void 0}hasAllNullValues(e){return this.items.every(n=>{if(!pe.isPair(n))return!1;let r=n.value;return r==null||e&&pe.isScalar(r)&&r.value==null&&!r.commentBefore&&!r.comment&&!r.tag})}hasIn(e){let[n,...r]=e;if(r.length===0)return this.has(n);let i=this.get(n,!0);return pe.isCollection(i)?i.hasIn(r):!1}setIn(e,n){let[r,...i]=e;if(i.length===0)this.set(r,n);else{let o=this.get(r,!0);if(pe.isCollection(o))o.setIn(i,n);else if(o===void 0&&this.schema)this.set(r,Pi(this.schema,i,n));else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${i}`)}}};Mn.Collection=Ri;Mn.collectionFromPath=Pi;Mn.isEmptyPath=da});var Wt=y(Kn=>{"use strict";var pd=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function Oi(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var hd=(t,e,n)=>t.endsWith(`
|
|
6
|
+
`)?Oi(n,e):n.includes(`
|
|
7
7
|
`)?`
|
|
8
|
-
`+
|
|
8
|
+
`+Oi(n,e):(t.endsWith(" ")?"":" ")+n;Kn.indentComment=Oi;Kn.lineComment=hd;Kn.stringifyComment=pd});var pa=y(Ft=>{"use strict";var gd="flow",Ai="block",Un="quoted";function wd(t,e,n="flow",{indentAtStart:r,lineWidth:i=80,minContentWidth:o=20,onFold:s,onOverflow:a}={}){if(!i||i<0)return t;i<o&&(o=0);let c=Math.max(1+o,1+i-e.length);if(t.length<=c)return t;let l=[],u={},d=i-e.length;typeof r=="number"&&(r>i-Math.max(2,o)?l.push(0):d=i-r);let m,h,g=!1,f=-1,p=-1,w=-1;n===Ai&&(f=ma(t,f,e.length),f!==-1&&(d=f+c));for(let b;b=t[f+=1];){if(n===Un&&b==="\\"){switch(p=f,t[f+1]){case"x":f+=3;break;case"u":f+=5;break;case"U":f+=9;break;default:f+=1}w=f}if(b===`
|
|
9
9
|
`)n===Ai&&(f=ma(t,f,e.length)),d=f+e.length+c,m=void 0;else{if(b===" "&&h&&h!==" "&&h!==`
|
|
10
10
|
`&&h!==" "){let C=t[f+1];C&&C!==" "&&C!==`
|
|
11
11
|
`&&C!==" "&&(m=f)}if(f>=d)if(m)l.push(m),d=m+c,m=void 0;else if(n===Un){for(;h===" "||h===" ";)h=b,b=t[f+=1],g=!0;let C=f>w+1?f-2:p-1;if(u[C])return t;l.push(C),u[C]=!0,d=C+c,m=void 0}else g=!0}h=b}if(g&&a&&a(),l.length===0)return t;s&&s();let v=t.slice(0,l[0]);for(let b=0;b<l.length;++b){let C=l[b],_=l[b+1]||t.length;C===0?v=`
|
|
12
12
|
${e}${t.slice(0,_)}`:(n===Un&&u[C]&&(v+=`${t[C]}\\`),v+=`
|
|
13
13
|
${e}${t.slice(C+1,_)}`)}return v}function ma(t,e,n){let r=e,i=e+1,o=t[i];for(;o===" "||o===" ";)if(e<i+n)o=t[++e];else{do o=t[++e];while(o&&o!==`
|
|
14
|
-
`);r=e,i=e+1,o=t[i]}return r}
|
|
14
|
+
`);r=e,i=e+1,o=t[i]}return r}Ft.FOLD_BLOCK=Ai;Ft.FOLD_FLOW=gd;Ft.FOLD_QUOTED=Un;Ft.foldFlowLines=wd});var Mt=y(ha=>{"use strict";var ce=W(),Re=pa(),Yn=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),Vn=t=>/^(%|---|\.\.\.)/m.test(t);function yd(t,e,n){if(!e||e<0)return!1;let r=e-n,i=t.length;if(i<=r)return!1;for(let o=0,s=0;o<i;++o)if(t[o]===`
|
|
15
15
|
`){if(o-s>r)return!0;if(s=o+1,i-s<=r)return!1}return!0}function Dt(t,e){let n=JSON.stringify(t);if(e.options.doubleQuotedAsJSON)return n;let{implicitKey:r}=e,i=e.options.doubleQuotedMinMultiLineLength,o=e.indent||(Vn(t)?" ":""),s="",a=0;for(let c=0,l=n[c];l;l=n[++c])if(l===" "&&n[c+1]==="\\"&&n[c+2]==="n"&&(s+=n.slice(a,c)+"\\ ",c+=1,a=c,l="\\"),l==="\\")switch(n[c+1]){case"u":{s+=n.slice(a,c);let u=n.substr(c+2,4);switch(u){case"0000":s+="\\0";break;case"0007":s+="\\a";break;case"000b":s+="\\v";break;case"001b":s+="\\e";break;case"0085":s+="\\N";break;case"00a0":s+="\\_";break;case"2028":s+="\\L";break;case"2029":s+="\\P";break;default:u.substr(0,2)==="00"?s+="\\x"+u.substr(2):s+=n.substr(c,6)}c+=5,a=c+1}break;case"n":if(r||n[c+2]==='"'||n.length<i)c+=1;else{for(s+=n.slice(a,c)+`
|
|
16
16
|
|
|
17
17
|
`;n[c+2]==="\\"&&n[c+3]==="n"&&n[c+4]!=='"';)s+=`
|
|
18
|
-
`,c+=2;s+=o,n[c+2]===" "&&(s+="\\"),c+=1,a=c+1}break;default:c+=1}return s=a?s+n.slice(a):n,r?s:
|
|
18
|
+
`,c+=2;s+=o,n[c+2]===" "&&(s+="\\"),c+=1,a=c+1}break;default:c+=1}return s=a?s+n.slice(a):n,r?s:Re.foldFlowLines(s,o,Re.FOLD_QUOTED,Yn(e,!1))}function Ni(t,e){if(e.options.singleQuote===!1||e.implicitKey&&t.includes(`
|
|
19
19
|
`)||/[ \t]\n|\n[ \t]/.test(t))return Dt(t,e);let n=e.indent||(Vn(t)?" ":""),r="'"+t.replace(/'/g,"''").replace(/\n+/g,`$&
|
|
20
|
-
${n}`)+"'";return e.implicitKey?r:
|
|
20
|
+
${n}`)+"'";return e.implicitKey?r:Re.foldFlowLines(r,n,Re.FOLD_FLOW,Yn(e,!1))}function wt(t,e){let{singleQuote:n}=e.options,r;if(n===!1)r=Dt;else{let i=t.includes('"'),o=t.includes("'");i&&!o?r=Ni:o&&!i?r=Dt:r=n?Ni:Dt}return r(t,e)}var ji;try{ji=new RegExp(`(^|(?<!
|
|
21
21
|
))
|
|
22
22
|
+(?!
|
|
23
|
-
|$)`,"g")}catch{
|
|
23
|
+
|$)`,"g")}catch{ji=/\n+(?!\n|$)/g}function Hn({comment:t,type:e,value:n},r,i,o){let{blockQuote:s,commentString:a,lineWidth:c}=r.options;if(!s||/\n[\t ]+$/.test(n))return wt(n,r);let l=r.indent||(r.forceBlockIndent||Vn(n)?" ":""),u=s==="literal"?!0:s==="folded"||e===ce.Scalar.BLOCK_FOLDED?!1:e===ce.Scalar.BLOCK_LITERAL?!0:!yd(n,c,l.length);if(!n)return u?`|
|
|
24
24
|
`:`>
|
|
25
25
|
`;let d,m;for(m=n.length;m>0;--m){let _=n[m-1];if(_!==`
|
|
26
26
|
`&&_!==" "&&_!==" ")break}let h=n.substring(m),g=h.indexOf(`
|
|
27
27
|
`);g===-1?d="-":n===h||g!==h.length-1?(d="+",o&&o()):d="",h&&(n=n.slice(0,-h.length),h[h.length-1]===`
|
|
28
|
-
`&&(h=h.slice(0,-1)),h=h.replace(
|
|
28
|
+
`&&(h=h.slice(0,-1)),h=h.replace(ji,`$&${l}`));let f=!1,p,w=-1;for(p=0;p<n.length;++p){let _=n[p];if(_===" ")f=!0;else if(_===`
|
|
29
29
|
`)w=p;else break}let v=n.substring(0,w<p?w+1:p);v&&(n=n.substring(v.length),v=v.replace(/\n+/g,`$&${l}`));let C=(f?l?"2":"1":"")+d;if(t&&(C+=" "+a(t.replace(/ ?[\r\n]+/g," ")),i&&i()),!u){let _=n.replace(/\n+/g,`
|
|
30
|
-
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${l}`),P=!1,j=Yn(r,!0);s!=="folded"&&e!==ce.Scalar.BLOCK_FOLDED&&(j.onOverflow=()=>{P=!0});let k=
|
|
30
|
+
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${l}`),P=!1,j=Yn(r,!0);s!=="folded"&&e!==ce.Scalar.BLOCK_FOLDED&&(j.onOverflow=()=>{P=!0});let k=Re.foldFlowLines(`${v}${_}${h}`,l,Re.FOLD_BLOCK,j);if(!P)return`>${C}
|
|
31
31
|
${l}${k}`}return n=n.replace(/\n+/g,`$&${l}`),`|${C}
|
|
32
32
|
${l}${v}${n}${h}`}function vd(t,e,n,r){let{type:i,value:o}=t,{actualString:s,implicitKey:a,indent:c,indentStep:l,inFlow:u}=e;if(a&&o.includes(`
|
|
33
|
-
`)||u&&/[[\]{},]/.test(o))return
|
|
34
|
-
`)?
|
|
35
|
-
`))return Hn(t,e,n,r);if(Vn(o)){if(c==="")return e.forceBlockIndent=!0,Hn(t,e,n,r);if(a&&c===l)return
|
|
36
|
-
${c}`);if(s){let m=f=>f.default&&f.tag!=="tag:yaml.org,2002:str"&&f.test?.test(d),{compat:h,tags:g}=e.doc.schema;if(g.some(m)||h?.some(m))return
|
|
37
|
-
${e.indent}${a}`:a}
|
|
33
|
+
`)||u&&/[[\]{},]/.test(o))return wt(o,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(o))return a||u||!o.includes(`
|
|
34
|
+
`)?wt(o,e):Hn(t,e,n,r);if(!a&&!u&&i!==ce.Scalar.PLAIN&&o.includes(`
|
|
35
|
+
`))return Hn(t,e,n,r);if(Vn(o)){if(c==="")return e.forceBlockIndent=!0,Hn(t,e,n,r);if(a&&c===l)return wt(o,e)}let d=o.replace(/\n+/g,`$&
|
|
36
|
+
${c}`);if(s){let m=f=>f.default&&f.tag!=="tag:yaml.org,2002:str"&&f.test?.test(d),{compat:h,tags:g}=e.doc.schema;if(g.some(m)||h?.some(m))return wt(o,e)}return a?d:Re.foldFlowLines(d,c,Re.FOLD_FLOW,Yn(e,!1))}function kd(t,e,n,r){let{implicitKey:i,inFlow:o}=e,s=typeof t.value=="string"?t:Object.assign({},t,{value:String(t.value)}),{type:a}=t;a!==ce.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(s.value)&&(a=ce.Scalar.QUOTE_DOUBLE);let c=u=>{switch(u){case ce.Scalar.BLOCK_FOLDED:case ce.Scalar.BLOCK_LITERAL:return i||o?wt(s.value,e):Hn(s,e,n,r);case ce.Scalar.QUOTE_DOUBLE:return Dt(s.value,e);case ce.Scalar.QUOTE_SINGLE:return Ni(s.value,e);case ce.Scalar.PLAIN:return vd(s,e,n,r);default:return null}},l=c(a);if(l===null){let{defaultKeyType:u,defaultStringType:d}=e.options,m=i&&u||d;if(l=c(m),l===null)throw new Error(`Unsupported default string type ${m}`)}return l}ha.stringifyString=kd});var Bt=y(Ti=>{"use strict";var bd=Wn(),Oe=O(),Sd=Wt(),Cd=Mt();function Ed(t,e){let n=Object.assign({blockQuote:!0,commentString:Sd.stringifyComment,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:"true",verifyAliasOrder:!0},t.schema.toStringOptions,e),r;switch(n.collectionStyle){case"block":r=!1;break;case"flow":r=!0;break;default:r=null}return{anchors:new Set,doc:t,flowCollectionPadding:n.flowCollectionPadding?" ":"",indent:"",indentStep:typeof n.indent=="number"?" ".repeat(n.indent):" ",inFlow:r,options:n}}function _d(t,e){if(e.tag){let i=t.filter(o=>o.tag===e.tag);if(i.length>0)return i.find(o=>o.format===e.format)??i[0]}let n,r;if(Oe.isScalar(e)){r=e.value;let i=t.filter(o=>o.identify?.(r));if(i.length>1){let o=i.filter(s=>s.test);o.length>0&&(i=o)}n=i.find(o=>o.format===e.format)??i.find(o=>!o.format)}else r=e,n=t.find(i=>i.nodeClass&&r instanceof i.nodeClass);if(!n){let i=r?.constructor?.name??(r===null?"null":typeof r);throw new Error(`Tag not resolved for ${i} value`)}return n}function xd(t,e,{anchors:n,doc:r}){if(!r.directives)return"";let i=[],o=(Oe.isScalar(t)||Oe.isCollection(t))&&t.anchor;o&&bd.anchorIsValid(o)&&(n.add(o),i.push(`&${o}`));let s=t.tag??(e.default?null:e.tag);return s&&i.push(r.directives.tagString(s)),i.join(" ")}function Pd(t,e,n,r){if(Oe.isPair(t))return t.toString(e,n,r);if(Oe.isAlias(t)){if(e.doc.directives)return t.toString(e);if(e.resolvedAliases?.has(t))throw new TypeError("Cannot stringify circular structure without alias nodes");e.resolvedAliases?e.resolvedAliases.add(t):e.resolvedAliases=new Set([t]),t=t.resolve(e.doc)}let i,o=Oe.isNode(t)?t:e.doc.createNode(t,{onTagObj:c=>i=c});i??(i=_d(e.doc.schema.tags,o));let s=xd(o,i,e);s.length>0&&(e.indentAtStart=(e.indentAtStart??0)+s.length+1);let a=typeof i.stringify=="function"?i.stringify(o,e,n,r):Oe.isScalar(o)?Cd.stringifyString(o,e,n,r):o.toString(e,n,r);return s?Oe.isScalar(o)||a[0]==="{"||a[0]==="["?`${s} ${a}`:`${s}
|
|
37
|
+
${e.indent}${a}`:a}Ti.createStringifyContext=Ed;Ti.stringify=Pd});var va=y(ya=>{"use strict";var we=O(),ga=W(),wa=Bt(),Kt=Wt();function Rd({key:t,value:e},n,r,i){let{allNullValues:o,doc:s,indent:a,indentStep:c,options:{commentString:l,indentSeq:u,simpleKeys:d}}=n,m=we.isNode(t)&&t.comment||null;if(d){if(m)throw new Error("With simple keys, key nodes cannot have comments");if(we.isCollection(t)||!we.isNode(t)&&typeof t=="object"){let j="With simple keys, collection cannot be used as a key value";throw new Error(j)}}let h=!d&&(!t||m&&e==null&&!n.inFlow||we.isCollection(t)||(we.isScalar(t)?t.type===ga.Scalar.BLOCK_FOLDED||t.type===ga.Scalar.BLOCK_LITERAL:typeof t=="object"));n=Object.assign({},n,{allNullValues:!1,implicitKey:!h&&(d||!o),indent:a+c});let g=!1,f=!1,p=wa.stringify(t,n,()=>g=!0,()=>f=!0);if(!h&&!n.inFlow&&p.length>1024){if(d)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");h=!0}if(n.inFlow){if(o||e==null)return g&&r&&r(),p===""?"?":h?`? ${p}`:p}else if(o&&!d||e==null&&h)return p=`? ${p}`,m&&!g?p+=Kt.lineComment(p,n.indent,l(m)):f&&i&&i(),p;g&&(m=null),h?(m&&(p+=Kt.lineComment(p,n.indent,l(m))),p=`? ${p}
|
|
38
38
|
${a}:`):(p=`${p}:`,m&&(p+=Kt.lineComment(p,n.indent,l(m))));let w,v,b;we.isNode(e)?(w=!!e.spaceBefore,v=e.commentBefore,b=e.comment):(w=!1,v=null,b=null,e&&typeof e=="object"&&(e=s.createNode(e))),n.implicitKey=!1,!h&&!m&&we.isScalar(e)&&(n.indentAtStart=p.length+1),f=!1,!u&&c.length>=2&&!n.inFlow&&!h&&we.isSeq(e)&&!e.flow&&!e.tag&&!e.anchor&&(n.indent=n.indent.substring(2));let C=!1,_=wa.stringify(e,n,()=>C=!0,()=>f=!0),P=" ";if(m||w||v){if(P=w?`
|
|
39
39
|
`:"",v){let j=l(v);P+=`
|
|
40
40
|
${Kt.indentComment(j,n.indent)}`}_===""&&!n.inFlow?P===`
|
|
@@ -42,36 +42,36 @@ ${Kt.indentComment(j,n.indent)}`}_===""&&!n.inFlow?P===`
|
|
|
42
42
|
|
|
43
43
|
`):P+=`
|
|
44
44
|
${n.indent}`}else if(!h&&we.isCollection(e)){let j=_[0],k=_.indexOf(`
|
|
45
|
-
`),D=k!==-1,
|
|
45
|
+
`),D=k!==-1,_e=n.inFlow??e.flow??e.items.length===0;if(D||!_e){let mt=!1;if(D&&(j==="&"||j==="!")){let M=_.indexOf(" ");j==="&"&&M!==-1&&M<k&&_[M+1]==="!"&&(M=_.indexOf(" ",M+1)),(M===-1||k<M)&&(mt=!0)}mt||(P=`
|
|
46
46
|
${n.indent}`)}}else(_===""||_[0]===`
|
|
47
|
-
`)&&(P="");return p+=P+_,n.inFlow?C&&r&&r():b&&!C?p+=Kt.lineComment(p,n.indent,l(b)):f&&i&&i(),p}ya.stringifyPair=Rd});var
|
|
47
|
+
`)&&(P="");return p+=P+_,n.inFlow?C&&r&&r():b&&!C?p+=Kt.lineComment(p,n.indent,l(b)):f&&i&&i(),p}ya.stringifyPair=Rd});var Ii=y($i=>{"use strict";var ka=Tn("process");function Od(t,...e){t==="debug"&&console.log(...e)}function Ad(t,e){(t==="debug"||t==="warn")&&(typeof ka.emitWarning=="function"?ka.emitWarning(e):console.warn(e))}$i.debug=Od;$i.warn=Ad});var Xn=y(Qn=>{"use strict";var zn=O(),ba=W(),Jn="<<",Gn={identify:t=>t===Jn||typeof t=="symbol"&&t.description===Jn,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new ba.Scalar(Symbol(Jn)),{addToJSMap:Sa}),stringify:()=>Jn},Nd=(t,e)=>(Gn.identify(e)||zn.isScalar(e)&&(!e.type||e.type===ba.Scalar.PLAIN)&&Gn.identify(e.value))&&t?.doc.schema.tags.some(n=>n.tag===Gn.tag&&n.default);function Sa(t,e,n){let r=Ca(t,n);if(zn.isSeq(r))for(let i of r.items)Li(t,e,i);else if(Array.isArray(r))for(let i of r)Li(t,e,i);else Li(t,e,r)}function Li(t,e,n){let r=Ca(t,n);if(!zn.isMap(r))throw new Error("Merge sources must be maps or map aliases");let i=r.toJSON(null,t,Map);for(let[o,s]of i)e instanceof Map?e.has(o)||e.set(o,s):e instanceof Set?e.add(o):Object.prototype.hasOwnProperty.call(e,o)||Object.defineProperty(e,o,{value:s,writable:!0,enumerable:!0,configurable:!0});return e}function Ca(t,e){return t&&zn.isAlias(e)?e.resolve(t.doc,t):e}Qn.addMergeToJSMap=Sa;Qn.isMergeKey=Nd;Qn.merge=Gn});var Wi=y(xa=>{"use strict";var jd=Ii(),Ea=Xn(),Td=Bt(),_a=O(),qi=xe();function $d(t,e,{key:n,value:r}){if(_a.isNode(n)&&n.addToJSMap)n.addToJSMap(t,e,r);else if(Ea.isMergeKey(t,n))Ea.addMergeToJSMap(t,e,r);else{let i=qi.toJS(n,"",t);if(e instanceof Map)e.set(i,qi.toJS(r,i,t));else if(e instanceof Set)e.add(i);else{let o=Id(n,i,t),s=qi.toJS(r,o,t);o in e?Object.defineProperty(e,o,{value:s,writable:!0,enumerable:!0,configurable:!0}):e[o]=s}}return e}function Id(t,e,n){if(e===null)return"";if(typeof e!="object")return String(e);if(_a.isNode(t)&&n?.doc){let r=Td.createStringifyContext(n.doc,{});r.anchors=new Set;for(let o of n.anchors.keys())r.anchors.add(o.anchor);r.inFlow=!0,r.inStringifyKey=!0;let i=t.toString(r);if(!n.mapKeyWarned){let o=JSON.stringify(i);o.length>40&&(o=o.substring(0,36)+'..."'),jd.warn(n.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${o}. Set mapAsMap: true to use object keys.`),n.mapKeyWarned=!0}return i}return JSON.stringify(e)}xa.addPairToJSMap=$d});var Ae=y(Fi=>{"use strict";var Pa=qt(),Ld=va(),qd=Wi(),Zn=O();function Wd(t,e,n){let r=Pa.createNode(t,void 0,n),i=Pa.createNode(e,void 0,n);return new er(r,i)}var er=class t{constructor(e,n=null){Object.defineProperty(this,Zn.NODE_TYPE,{value:Zn.PAIR}),this.key=e,this.value=n}clone(e){let{key:n,value:r}=this;return Zn.isNode(n)&&(n=n.clone(e)),Zn.isNode(r)&&(r=r.clone(e)),new t(n,r)}toJSON(e,n){let r=n?.mapAsMap?new Map:{};return qd.addPairToJSMap(n,r,this)}toString(e,n,r){return e?.doc?Ld.stringifyPair(this,e,n,r):JSON.stringify(this)}};Fi.Pair=er;Fi.createPair=Wd});var Di=y(Oa=>{"use strict";var et=O(),Ra=Bt(),tr=Wt();function Fd(t,e,n){return(e.inFlow??t.flow?Md:Dd)(t,e,n)}function Dd({comment:t,items:e},n,{blockItemPrefix:r,flowChars:i,itemIndent:o,onChompKeep:s,onComment:a}){let{indent:c,options:{commentString:l}}=n,u=Object.assign({},n,{indent:o,type:null}),d=!1,m=[];for(let g=0;g<e.length;++g){let f=e[g],p=null;if(et.isNode(f))!d&&f.spaceBefore&&m.push(""),nr(n,m,f.commentBefore,d),f.comment&&(p=f.comment);else if(et.isPair(f)){let v=et.isNode(f.key)?f.key:null;v&&(!d&&v.spaceBefore&&m.push(""),nr(n,m,v.commentBefore,d))}d=!1;let w=Ra.stringify(f,u,()=>p=null,()=>d=!0);p&&(w+=tr.lineComment(w,o,l(p))),d&&p&&(d=!1),m.push(r+w)}let h;if(m.length===0)h=i.start+i.end;else{h=m[0];for(let g=1;g<m.length;++g){let f=m[g];h+=f?`
|
|
48
48
|
${c}${f}`:`
|
|
49
49
|
`}}return t?(h+=`
|
|
50
|
-
`+tr.indentComment(l(t),c),a&&a()):d&&s&&s(),h}function
|
|
50
|
+
`+tr.indentComment(l(t),c),a&&a()):d&&s&&s(),h}function Md({items:t},e,{flowChars:n,itemIndent:r}){let{indent:i,indentStep:o,flowCollectionPadding:s,options:{commentString:a}}=e;r+=o;let c=Object.assign({},e,{indent:r,inFlow:!0,type:null}),l=!1,u=0,d=[];for(let g=0;g<t.length;++g){let f=t[g],p=null;if(et.isNode(f))f.spaceBefore&&d.push(""),nr(e,d,f.commentBefore,!1),f.comment&&(p=f.comment);else if(et.isPair(f)){let v=et.isNode(f.key)?f.key:null;v&&(v.spaceBefore&&d.push(""),nr(e,d,v.commentBefore,!1),v.comment&&(l=!0));let b=et.isNode(f.value)?f.value:null;b?(b.comment&&(p=b.comment),b.commentBefore&&(l=!0)):f.value==null&&v?.comment&&(p=v.comment)}p&&(l=!0);let w=Ra.stringify(f,c,()=>p=null);l||(l=d.length>u||w.includes(`
|
|
51
51
|
`)),g<t.length-1?w+=",":e.options.trailingComma&&(e.options.lineWidth>0&&(l||(l=d.reduce((v,b)=>v+b.length+2,2)+(w.length+2)>e.options.lineWidth)),l&&(w+=",")),p&&(w+=tr.lineComment(w,r,a(p))),d.push(w),u=d.length}let{start:m,end:h}=n;if(d.length===0)return m+h;if(!l){let g=d.reduce((f,p)=>f+p.length+2,2);l=e.options.lineWidth>0&&g>e.options.lineWidth}if(l){let g=m;for(let f of d)g+=f?`
|
|
52
52
|
${o}${i}${f}`:`
|
|
53
53
|
`;return`${g}
|
|
54
|
-
${i}${h}`}else return`${m}${s}${d.join(" ")}${s}${h}`}function nr({indent:t,options:{commentString:e}},n,r,i){if(r&&i&&(r=r.replace(/^\n+/,"")),r){let o=tr.indentComment(e(r),t);n.push(o.trimStart())}}
|
|
55
|
-
`:" ")}return Em.stringifyString({comment:t,type:e,value:a},r,i,o)}};Ga.binary=_m});var mr=y(dr=>{"use strict";var fr=
|
|
54
|
+
${i}${h}`}else return`${m}${s}${d.join(" ")}${s}${h}`}function nr({indent:t,options:{commentString:e}},n,r,i){if(r&&i&&(r=r.replace(/^\n+/,"")),r){let o=tr.indentComment(e(r),t);n.push(o.trimStart())}}Oa.stringifyCollection=Fd});var je=y(Bi=>{"use strict";var Bd=Di(),Kd=Wi(),Ud=Bn(),Ne=O(),rr=Ae(),Hd=W();function Ut(t,e){let n=Ne.isScalar(e)?e.value:e;for(let r of t)if(Ne.isPair(r)&&(r.key===e||r.key===n||Ne.isScalar(r.key)&&r.key.value===n))return r}var Mi=class extends Ud.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(Ne.MAP,e),this.items=[]}static from(e,n,r){let{keepUndefined:i,replacer:o}=r,s=new this(e),a=(c,l)=>{if(typeof o=="function")l=o.call(n,c,l);else if(Array.isArray(o)&&!o.includes(c))return;(l!==void 0||i)&&s.items.push(rr.createPair(c,l,r))};if(n instanceof Map)for(let[c,l]of n)a(c,l);else if(n&&typeof n=="object")for(let c of Object.keys(n))a(c,n[c]);return typeof e.sortMapEntries=="function"&&s.items.sort(e.sortMapEntries),s}add(e,n){let r;Ne.isPair(e)?r=e:!e||typeof e!="object"||!("key"in e)?r=new rr.Pair(e,e?.value):r=new rr.Pair(e.key,e.value);let i=Ut(this.items,r.key),o=this.schema?.sortMapEntries;if(i){if(!n)throw new Error(`Key ${r.key} already set`);Ne.isScalar(i.value)&&Hd.isScalarValue(r.value)?i.value.value=r.value:i.value=r.value}else if(o){let s=this.items.findIndex(a=>o(r,a)<0);s===-1?this.items.push(r):this.items.splice(s,0,r)}else this.items.push(r)}delete(e){let n=Ut(this.items,e);return n?this.items.splice(this.items.indexOf(n),1).length>0:!1}get(e,n){let i=Ut(this.items,e)?.value;return(!n&&Ne.isScalar(i)?i.value:i)??void 0}has(e){return!!Ut(this.items,e)}set(e,n){this.add(new rr.Pair(e,n),!0)}toJSON(e,n,r){let i=r?new r:n?.mapAsMap?new Map:{};n?.onCreate&&n.onCreate(i);for(let o of this.items)Kd.addPairToJSMap(n,i,o);return i}toString(e,n,r){if(!e)return JSON.stringify(this);for(let i of this.items)if(!Ne.isPair(i))throw new Error(`Map items must all be pairs; found ${JSON.stringify(i)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),Bd.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:r,onComment:n})}};Bi.YAMLMap=Mi;Bi.findPair=Ut});var yt=y(Na=>{"use strict";var Yd=O(),Aa=je(),Vd={collection:"map",default:!0,nodeClass:Aa.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(t,e){return Yd.isMap(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,n)=>Aa.YAMLMap.from(t,e,n)};Na.map=Vd});var Te=y(ja=>{"use strict";var Jd=qt(),Gd=Di(),zd=Bn(),or=O(),Qd=W(),Xd=xe(),Ki=class extends zd.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(or.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let n=ir(e);return typeof n!="number"?!1:this.items.splice(n,1).length>0}get(e,n){let r=ir(e);if(typeof r!="number")return;let i=this.items[r];return!n&&or.isScalar(i)?i.value:i}has(e){let n=ir(e);return typeof n=="number"&&n<this.items.length}set(e,n){let r=ir(e);if(typeof r!="number")throw new Error(`Expected a valid index, not ${e}.`);let i=this.items[r];or.isScalar(i)&&Qd.isScalarValue(n)?i.value=n:this.items[r]=n}toJSON(e,n){let r=[];n?.onCreate&&n.onCreate(r);let i=0;for(let o of this.items)r.push(Xd.toJS(o,String(i++),n));return r}toString(e,n,r){return e?Gd.stringifyCollection(this,e,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(e.indent||"")+" ",onChompKeep:r,onComment:n}):JSON.stringify(this)}static from(e,n,r){let{replacer:i}=r,o=new this(e);if(n&&Symbol.iterator in Object(n)){let s=0;for(let a of n){if(typeof i=="function"){let c=n instanceof Set?a:String(s++);a=i.call(n,c,a)}o.items.push(Jd.createNode(a,void 0,r))}}return o}};function ir(t){let e=or.isScalar(t)?t.value:t;return e&&typeof e=="string"&&(e=Number(e)),typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}ja.YAMLSeq=Ki});var vt=y($a=>{"use strict";var Zd=O(),Ta=Te(),em={collection:"seq",default:!0,nodeClass:Ta.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(t,e){return Zd.isSeq(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,n)=>Ta.YAMLSeq.from(t,e,n)};$a.seq=em});var Ht=y(Ia=>{"use strict";var tm=Mt(),nm={identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify(t,e,n,r){return e=Object.assign({actualString:!0},e),tm.stringifyString(t,e,n,r)}};Ia.string=nm});var sr=y(Wa=>{"use strict";var La=W(),qa={identify:t=>t==null,createNode:()=>new La.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new La.Scalar(null),stringify:({source:t},e)=>typeof t=="string"&&qa.test.test(t)?t:e.options.nullStr};Wa.nullTag=qa});var Ui=y(Da=>{"use strict";var rm=W(),Fa={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new rm.Scalar(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},n){if(t&&Fa.test.test(t)){let r=t[0]==="t"||t[0]==="T";if(e===r)return t}return e?n.options.trueStr:n.options.falseStr}};Da.boolTag=Fa});var kt=y(Ma=>{"use strict";function im({format:t,minFractionDigits:e,tag:n,value:r}){if(typeof r=="bigint")return String(r);let i=typeof r=="number"?r:Number(r);if(!isFinite(i))return isNaN(i)?".nan":i<0?"-.inf":".inf";let o=Object.is(r,-0)?"-0":JSON.stringify(r);if(!t&&e&&(!n||n==="tag:yaml.org,2002:float")&&/^-?\d/.test(o)&&!o.includes("e")){let s=o.indexOf(".");s<0&&(s=o.length,o+=".");let a=e-(o.length-s-1);for(;a-- >0;)o+="0"}return o}Ma.stringifyNumber=im});var Yi=y(ar=>{"use strict";var om=W(),Hi=kt(),sm={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:Hi.stringifyNumber},am={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():Hi.stringifyNumber(t)}},cm={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 om.Scalar(parseFloat(t)),n=t.indexOf(".");return n!==-1&&t[t.length-1]==="0"&&(e.minFractionDigits=t.length-n-1),e},stringify:Hi.stringifyNumber};ar.float=cm;ar.floatExp=am;ar.floatNaN=sm});var Ji=y(lr=>{"use strict";var Ba=kt(),cr=t=>typeof t=="bigint"||Number.isInteger(t),Vi=(t,e,n,{intAsBigInt:r})=>r?BigInt(t):parseInt(t.substring(e),n);function Ka(t,e,n){let{value:r}=t;return cr(r)&&r>=0?n+r.toString(e):Ba.stringifyNumber(t)}var lm={identify:t=>cr(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(t,e,n)=>Vi(t,2,8,n),stringify:t=>Ka(t,8,"0o")},um={identify:cr,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,n)=>Vi(t,0,10,n),stringify:Ba.stringifyNumber},fm={identify:t=>cr(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(t,e,n)=>Vi(t,2,16,n),stringify:t=>Ka(t,16,"0x")};lr.int=um;lr.intHex=fm;lr.intOct=lm});var Ha=y(Ua=>{"use strict";var dm=yt(),mm=sr(),pm=vt(),hm=Ht(),gm=Ui(),Gi=Yi(),zi=Ji(),wm=[dm.map,pm.seq,hm.string,mm.nullTag,gm.boolTag,zi.intOct,zi.int,zi.intHex,Gi.floatNaN,Gi.floatExp,Gi.float];Ua.schema=wm});var Ja=y(Va=>{"use strict";var ym=W(),vm=yt(),km=vt();function Ya(t){return typeof t=="bigint"||Number.isInteger(t)}var ur=({value:t})=>JSON.stringify(t),bm=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:ur},{identify:t=>t==null,createNode:()=>new ym.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:ur},{identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:t=>t==="true",stringify:ur},{identify:Ya,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(t,e,{intAsBigInt:n})=>n?BigInt(t):parseInt(t,10),stringify:({value:t})=>Ya(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:ur}],Sm={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},Cm=[vm.map,km.seq].concat(bm,Sm);Va.schema=Cm});var Xi=y(Ga=>{"use strict";var Yt=Tn("buffer"),Qi=W(),Em=Mt(),_m={identify:t=>t instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(t,e){if(typeof Yt.Buffer=="function")return Yt.Buffer.from(t,"base64");if(typeof atob=="function"){let n=atob(t.replace(/[\n\r]/g,"")),r=new Uint8Array(n.length);for(let i=0;i<n.length;++i)r[i]=n.charCodeAt(i);return r}else return e("This environment does not support reading binary tags; either Buffer or atob is required"),t},stringify({comment:t,type:e,value:n},r,i,o){if(!n)return"";let s=n,a;if(typeof Yt.Buffer=="function")a=s instanceof Yt.Buffer?s.toString("base64"):Yt.Buffer.from(s.buffer).toString("base64");else if(typeof btoa=="function"){let c="";for(let l=0;l<s.length;++l)c+=String.fromCharCode(s[l]);a=btoa(c)}else throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(e??(e=Qi.Scalar.BLOCK_LITERAL),e!==Qi.Scalar.QUOTE_DOUBLE){let c=Math.max(r.options.lineWidth-r.indent.length,r.options.minContentWidth),l=Math.ceil(a.length/c),u=new Array(l);for(let d=0,m=0;d<l;++d,m+=c)u[d]=a.substr(m,c);a=u.join(e===Qi.Scalar.BLOCK_LITERAL?`
|
|
55
|
+
`:" ")}return Em.stringifyString({comment:t,type:e,value:a},r,i,o)}};Ga.binary=_m});var mr=y(dr=>{"use strict";var fr=O(),Zi=Ae(),xm=W(),Pm=Te();function za(t,e){if(fr.isSeq(t))for(let n=0;n<t.items.length;++n){let r=t.items[n];if(!fr.isPair(r)){if(fr.isMap(r)){r.items.length>1&&e("Each pair must have its own sequence indicator");let i=r.items[0]||new Zi.Pair(new xm.Scalar(null));if(r.commentBefore&&(i.key.commentBefore=i.key.commentBefore?`${r.commentBefore}
|
|
56
56
|
${i.key.commentBefore}`:r.commentBefore),r.comment){let o=i.value??i.key;o.comment=o.comment?`${r.comment}
|
|
57
|
-
${o.comment}`:r.comment}r=i}t.items[n]=fr.isPair(r)?r:new Xi.Pair(r)}}else e("Expected a sequence for this tag");return t}function Qa(t,e,n){let{replacer:r}=n,i=new Pm.YAMLSeq(t);i.tag="tag:yaml.org,2002:pairs";let o=0;if(e&&Symbol.iterator in Object(e))for(let s of e){typeof r=="function"&&(s=r.call(e,String(o++),s));let a,c;if(Array.isArray(s))if(s.length===2)a=s[0],c=s[1];else throw new TypeError(`Expected [key, value] tuple: ${s}`);else if(s&&s instanceof Object){let l=Object.keys(s);if(l.length===1)a=l[0],c=s[a];else throw new TypeError(`Expected tuple with one key, not ${l.length} keys`)}else a=s;i.items.push(Xi.createPair(a,c,n))}return i}var Rm={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:za,createNode:Qa};dr.createPairs=Qa;dr.pairs=Rm;dr.resolvePairs=za});var to=y(eo=>{"use strict";var Xa=A(),Zi=_e(),Vt=Ne(),Am=je(),Za=mr(),tt=class t extends Am.YAMLSeq{constructor(){super(),this.add=Vt.YAMLMap.prototype.add.bind(this),this.delete=Vt.YAMLMap.prototype.delete.bind(this),this.get=Vt.YAMLMap.prototype.get.bind(this),this.has=Vt.YAMLMap.prototype.has.bind(this),this.set=Vt.YAMLMap.prototype.set.bind(this),this.tag=t.tag}toJSON(e,n){if(!n)return super.toJSON(e);let r=new Map;n?.onCreate&&n.onCreate(r);for(let i of this.items){let o,s;if(Xa.isPair(i)?(o=Zi.toJS(i.key,"",n),s=Zi.toJS(i.value,o,n)):o=Zi.toJS(i,"",n),r.has(o))throw new Error("Ordered maps must not include duplicate keys");r.set(o,s)}return r}static from(e,n,r){let i=Za.createPairs(e,n,r),o=new this;return o.items=i.items,o}};tt.tag="tag:yaml.org,2002:omap";var Om={collection:"seq",identify:t=>t instanceof Map,nodeClass:tt,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let n=Za.resolvePairs(t,e),r=[];for(let{key:i}of n.items)Xa.isScalar(i)&&(r.includes(i.value)?e(`Ordered maps must not include duplicate keys: ${i.value}`):r.push(i.value));return Object.assign(new tt,n)},createNode:(t,e,n)=>tt.from(t,e,n)};eo.YAMLOMap=tt;eo.omap=Om});var ic=y(no=>{"use strict";var ec=q();function tc({value:t,source:e},n){return e&&(t?nc:rc).test.test(e)?e:t?n.options.trueStr:n.options.falseStr}var nc={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 ec.Scalar(!0),stringify:tc},rc={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 ec.Scalar(!1),stringify:tc};no.falseTag=rc;no.trueTag=nc});var oc=y(pr=>{"use strict";var Nm=q(),ro=vt(),jm={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:ro.stringifyNumber},Tm={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():ro.stringifyNumber(t)}},$m={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 Nm.Scalar(parseFloat(t.replace(/_/g,""))),n=t.indexOf(".");if(n!==-1){let r=t.substring(n+1).replace(/_/g,"");r[r.length-1]==="0"&&(e.minFractionDigits=r.length)}return e},stringify:ro.stringifyNumber};pr.float=$m;pr.floatExp=Tm;pr.floatNaN=jm});var ac=y(Gt=>{"use strict";var sc=vt(),Jt=t=>typeof t=="bigint"||Number.isInteger(t);function hr(t,e,n,{intAsBigInt:r}){let i=t[0];if((i==="-"||i==="+")&&(e+=1),t=t.substring(e).replace(/_/g,""),r){switch(n){case 2:t=`0b${t}`;break;case 8:t=`0o${t}`;break;case 16:t=`0x${t}`;break}let s=BigInt(t);return i==="-"?BigInt(-1)*s:s}let o=parseInt(t,n);return i==="-"?-1*o:o}function io(t,e,n){let{value:r}=t;if(Jt(r)){let i=r.toString(e);return r<0?"-"+n+i.substr(1):n+i}return sc.stringifyNumber(t)}var Im={identify:Jt,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,n)=>hr(t,2,2,n),stringify:t=>io(t,2,"0b")},Lm={identify:Jt,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,n)=>hr(t,1,8,n),stringify:t=>io(t,8,"0")},qm={identify:Jt,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,n)=>hr(t,0,10,n),stringify:sc.stringifyNumber},Wm={identify:Jt,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,n)=>hr(t,2,16,n),stringify:t=>io(t,16,"0x")};Gt.int=qm;Gt.intBin=Im;Gt.intHex=Wm;Gt.intOct=Lm});var so=y(oo=>{"use strict";var yr=A(),gr=Ae(),wr=Ne(),nt=class t extends wr.YAMLMap{constructor(e){super(e),this.tag=t.tag}add(e){let n;yr.isPair(e)?n=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?n=new gr.Pair(e.key,null):n=new gr.Pair(e,null),wr.findPair(this.items,n.key)||this.items.push(n)}get(e,n){let r=wr.findPair(this.items,e);return!n&&yr.isPair(r)?yr.isScalar(r.key)?r.key.value:r.key:r}set(e,n){if(typeof n!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof n}`);let r=wr.findPair(this.items,e);r&&!n?this.items.splice(this.items.indexOf(r),1):!r&&n&&this.items.push(new gr.Pair(e))}toJSON(e,n){return super.toJSON(e,n,Set)}toString(e,n,r){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),n,r);throw new Error("Set items must all have null values")}static from(e,n,r){let{replacer:i}=r,o=new this(e);if(n&&Symbol.iterator in Object(n))for(let s of n)typeof i=="function"&&(s=i.call(n,s,s)),o.items.push(gr.createPair(s,null,r));return o}};nt.tag="tag:yaml.org,2002:set";var Mm={collection:"map",identify:t=>t instanceof Set,nodeClass:nt,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,n)=>nt.from(t,e,n),resolve(t,e){if(yr.isMap(t)){if(t.hasAllNullValues(!0))return Object.assign(new nt,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}};oo.YAMLSet=nt;oo.set=Mm});var co=y(vr=>{"use strict";var Dm=vt();function ao(t,e){let n=t[0],r=n==="-"||n==="+"?t.substring(1):t,i=s=>e?BigInt(s):Number(s),o=r.replace(/_/g,"").split(":").reduce((s,a)=>s*i(60)+i(a),i(0));return n==="-"?i(-1)*o:o}function cc(t){let{value:e}=t,n=s=>s;if(typeof e=="bigint")n=s=>BigInt(s);else if(isNaN(e)||!isFinite(e))return Dm.stringifyNumber(t);let r="";e<0&&(r="-",e*=n(-1));let i=n(60),o=[e%i];return e<60?o.unshift(0):(e=(e-o[0])/i,o.unshift(e%i),e>=60&&(e=(e-o[0])/i,o.unshift(e))),r+o.map(s=>String(s).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var Fm={identify:t=>typeof t=="bigint"||Number.isInteger(t),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(t,e,{intAsBigInt:n})=>ao(t,n),stringify:cc},Bm={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=>ao(t,!1),stringify:cc},lc={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(lc.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,n,r,i,o,s,a]=e.map(Number),c=e[7]?Number((e[7]+"00").substr(1,3)):0,l=Date.UTC(n,r-1,i,o||0,s||0,a||0,c),u=e[8];if(u&&u!=="Z"){let d=ao(u,!1);Math.abs(d)<30&&(d*=60),l-=6e4*d}return new Date(l)},stringify:({value:t})=>t?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};vr.floatTime=Bm;vr.intTime=Fm;vr.timestamp=lc});var dc=y(fc=>{"use strict";var Km=wt(),Um=sr(),Hm=yt(),Ym=Ht(),Vm=Qi(),uc=ic(),lo=oc(),kr=ac(),Jm=Xn(),Gm=to(),zm=mr(),Qm=so(),uo=co(),Xm=[Km.map,Hm.seq,Ym.string,Um.nullTag,uc.trueTag,uc.falseTag,kr.intBin,kr.intOct,kr.int,kr.intHex,lo.floatNaN,lo.floatExp,lo.float,Vm.binary,Jm.merge,Gm.omap,zm.pairs,Qm.set,uo.intTime,uo.floatTime,uo.timestamp];fc.schema=Xm});var Sc=y(po=>{"use strict";var gc=wt(),Zm=sr(),wc=yt(),ep=Ht(),tp=Ki(),fo=Hi(),mo=Vi(),np=Ha(),rp=Ja(),yc=Qi(),zt=Xn(),vc=to(),kc=mr(),mc=dc(),bc=so(),br=co(),pc=new Map([["core",np.schema],["failsafe",[gc.map,wc.seq,ep.string]],["json",rp.schema],["yaml11",mc.schema],["yaml-1.1",mc.schema]]),hc={binary:yc.binary,bool:tp.boolTag,float:fo.float,floatExp:fo.floatExp,floatNaN:fo.floatNaN,floatTime:br.floatTime,int:mo.int,intHex:mo.intHex,intOct:mo.intOct,intTime:br.intTime,map:gc.map,merge:zt.merge,null:Zm.nullTag,omap:vc.omap,pairs:kc.pairs,seq:wc.seq,set:bc.set,timestamp:br.timestamp},ip={"tag:yaml.org,2002:binary":yc.binary,"tag:yaml.org,2002:merge":zt.merge,"tag:yaml.org,2002:omap":vc.omap,"tag:yaml.org,2002:pairs":kc.pairs,"tag:yaml.org,2002:set":bc.set,"tag:yaml.org,2002:timestamp":br.timestamp};function op(t,e,n){let r=pc.get(e);if(r&&!t)return n&&!r.includes(zt.merge)?r.concat(zt.merge):r.slice();let i=r;if(!i)if(Array.isArray(t))i=[];else{let o=Array.from(pc.keys()).filter(s=>s!=="yaml11").map(s=>JSON.stringify(s)).join(", ");throw new Error(`Unknown schema "${e}"; use one of ${o} or define customTags array`)}if(Array.isArray(t))for(let o of t)i=i.concat(o);else typeof t=="function"&&(i=t(i.slice()));return n&&(i=i.concat(zt.merge)),i.reduce((o,s)=>{let a=typeof s=="string"?hc[s]:s;if(!a){let c=JSON.stringify(s),l=Object.keys(hc).map(u=>JSON.stringify(u)).join(", ");throw new Error(`Unknown custom tag ${c}; use one of ${l}`)}return o.includes(a)||o.push(a),o},[])}po.coreKnownTags=ip;po.getTags=op});var wo=y(Cc=>{"use strict";var ho=A(),sp=wt(),ap=yt(),cp=Ht(),Sr=Sc(),lp=(t,e)=>t.key<e.key?-1:t.key>e.key?1:0,go=class t{constructor({compat:e,customTags:n,merge:r,resolveKnownTags:i,schema:o,sortMapEntries:s,toStringDefaults:a}){this.compat=Array.isArray(e)?Sr.getTags(e,"compat"):e?Sr.getTags(null,e):null,this.name=typeof o=="string"&&o||"core",this.knownTags=i?Sr.coreKnownTags:{},this.tags=Sr.getTags(n,this.name,r),this.toStringOptions=a??null,Object.defineProperty(this,ho.MAP,{value:sp.map}),Object.defineProperty(this,ho.SCALAR,{value:cp.string}),Object.defineProperty(this,ho.SEQ,{value:ap.seq}),this.sortMapEntries=typeof s=="function"?s:s===!0?lp:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};Cc.Schema=go});var _c=y(Ec=>{"use strict";var up=A(),yo=Bt(),Qt=Wt();function fp(t,e){let n=[],r=e.directives===!0;if(e.directives!==!1&&t.directives){let c=t.directives.toString(t);c?(n.push(c),r=!0):t.directives.docStart&&(r=!0)}r&&n.push("---");let i=yo.createStringifyContext(t,e),{commentString:o}=i.options;if(t.commentBefore){n.length!==1&&n.unshift("");let c=o(t.commentBefore);n.unshift(Qt.indentComment(c,""))}let s=!1,a=null;if(t.contents){if(up.isNode(t.contents)){if(t.contents.spaceBefore&&r&&n.push(""),t.contents.commentBefore){let u=o(t.contents.commentBefore);n.push(Qt.indentComment(u,""))}i.forceBlockIndent=!!t.comment,a=t.contents.comment}let c=a?void 0:()=>s=!0,l=yo.stringify(t.contents,i,()=>a=null,c);a&&(l+=Qt.lineComment(l,"",o(a))),(l[0]==="|"||l[0]===">")&&n[n.length-1]==="---"?n[n.length-1]=`--- ${l}`:n.push(l)}else n.push(yo.stringify(t.contents,i));if(t.directives?.docEnd)if(t.comment){let c=o(t.comment);c.includes(`
|
|
57
|
+
${o.comment}`:r.comment}r=i}t.items[n]=fr.isPair(r)?r:new Zi.Pair(r)}}else e("Expected a sequence for this tag");return t}function Qa(t,e,n){let{replacer:r}=n,i=new Pm.YAMLSeq(t);i.tag="tag:yaml.org,2002:pairs";let o=0;if(e&&Symbol.iterator in Object(e))for(let s of e){typeof r=="function"&&(s=r.call(e,String(o++),s));let a,c;if(Array.isArray(s))if(s.length===2)a=s[0],c=s[1];else throw new TypeError(`Expected [key, value] tuple: ${s}`);else if(s&&s instanceof Object){let l=Object.keys(s);if(l.length===1)a=l[0],c=s[a];else throw new TypeError(`Expected tuple with one key, not ${l.length} keys`)}else a=s;i.items.push(Zi.createPair(a,c,n))}return i}var Rm={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:za,createNode:Qa};dr.createPairs=Qa;dr.pairs=Rm;dr.resolvePairs=za});var no=y(to=>{"use strict";var Xa=O(),eo=xe(),Vt=je(),Om=Te(),Za=mr(),tt=class t extends Om.YAMLSeq{constructor(){super(),this.add=Vt.YAMLMap.prototype.add.bind(this),this.delete=Vt.YAMLMap.prototype.delete.bind(this),this.get=Vt.YAMLMap.prototype.get.bind(this),this.has=Vt.YAMLMap.prototype.has.bind(this),this.set=Vt.YAMLMap.prototype.set.bind(this),this.tag=t.tag}toJSON(e,n){if(!n)return super.toJSON(e);let r=new Map;n?.onCreate&&n.onCreate(r);for(let i of this.items){let o,s;if(Xa.isPair(i)?(o=eo.toJS(i.key,"",n),s=eo.toJS(i.value,o,n)):o=eo.toJS(i,"",n),r.has(o))throw new Error("Ordered maps must not include duplicate keys");r.set(o,s)}return r}static from(e,n,r){let i=Za.createPairs(e,n,r),o=new this;return o.items=i.items,o}};tt.tag="tag:yaml.org,2002:omap";var Am={collection:"seq",identify:t=>t instanceof Map,nodeClass:tt,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let n=Za.resolvePairs(t,e),r=[];for(let{key:i}of n.items)Xa.isScalar(i)&&(r.includes(i.value)?e(`Ordered maps must not include duplicate keys: ${i.value}`):r.push(i.value));return Object.assign(new tt,n)},createNode:(t,e,n)=>tt.from(t,e,n)};to.YAMLOMap=tt;to.omap=Am});var ic=y(ro=>{"use strict";var ec=W();function tc({value:t,source:e},n){return e&&(t?nc:rc).test.test(e)?e:t?n.options.trueStr:n.options.falseStr}var nc={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 ec.Scalar(!0),stringify:tc},rc={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 ec.Scalar(!1),stringify:tc};ro.falseTag=rc;ro.trueTag=nc});var oc=y(pr=>{"use strict";var Nm=W(),io=kt(),jm={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:io.stringifyNumber},Tm={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():io.stringifyNumber(t)}},$m={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 Nm.Scalar(parseFloat(t.replace(/_/g,""))),n=t.indexOf(".");if(n!==-1){let r=t.substring(n+1).replace(/_/g,"");r[r.length-1]==="0"&&(e.minFractionDigits=r.length)}return e},stringify:io.stringifyNumber};pr.float=$m;pr.floatExp=Tm;pr.floatNaN=jm});var ac=y(Gt=>{"use strict";var sc=kt(),Jt=t=>typeof t=="bigint"||Number.isInteger(t);function hr(t,e,n,{intAsBigInt:r}){let i=t[0];if((i==="-"||i==="+")&&(e+=1),t=t.substring(e).replace(/_/g,""),r){switch(n){case 2:t=`0b${t}`;break;case 8:t=`0o${t}`;break;case 16:t=`0x${t}`;break}let s=BigInt(t);return i==="-"?BigInt(-1)*s:s}let o=parseInt(t,n);return i==="-"?-1*o:o}function oo(t,e,n){let{value:r}=t;if(Jt(r)){let i=r.toString(e);return r<0?"-"+n+i.substr(1):n+i}return sc.stringifyNumber(t)}var Im={identify:Jt,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,n)=>hr(t,2,2,n),stringify:t=>oo(t,2,"0b")},Lm={identify:Jt,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,n)=>hr(t,1,8,n),stringify:t=>oo(t,8,"0")},qm={identify:Jt,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,n)=>hr(t,0,10,n),stringify:sc.stringifyNumber},Wm={identify:Jt,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,n)=>hr(t,2,16,n),stringify:t=>oo(t,16,"0x")};Gt.int=qm;Gt.intBin=Im;Gt.intHex=Wm;Gt.intOct=Lm});var ao=y(so=>{"use strict";var yr=O(),gr=Ae(),wr=je(),nt=class t extends wr.YAMLMap{constructor(e){super(e),this.tag=t.tag}add(e){let n;yr.isPair(e)?n=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?n=new gr.Pair(e.key,null):n=new gr.Pair(e,null),wr.findPair(this.items,n.key)||this.items.push(n)}get(e,n){let r=wr.findPair(this.items,e);return!n&&yr.isPair(r)?yr.isScalar(r.key)?r.key.value:r.key:r}set(e,n){if(typeof n!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof n}`);let r=wr.findPair(this.items,e);r&&!n?this.items.splice(this.items.indexOf(r),1):!r&&n&&this.items.push(new gr.Pair(e))}toJSON(e,n){return super.toJSON(e,n,Set)}toString(e,n,r){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),n,r);throw new Error("Set items must all have null values")}static from(e,n,r){let{replacer:i}=r,o=new this(e);if(n&&Symbol.iterator in Object(n))for(let s of n)typeof i=="function"&&(s=i.call(n,s,s)),o.items.push(gr.createPair(s,null,r));return o}};nt.tag="tag:yaml.org,2002:set";var Fm={collection:"map",identify:t=>t instanceof Set,nodeClass:nt,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,n)=>nt.from(t,e,n),resolve(t,e){if(yr.isMap(t)){if(t.hasAllNullValues(!0))return Object.assign(new nt,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}};so.YAMLSet=nt;so.set=Fm});var lo=y(vr=>{"use strict";var Dm=kt();function co(t,e){let n=t[0],r=n==="-"||n==="+"?t.substring(1):t,i=s=>e?BigInt(s):Number(s),o=r.replace(/_/g,"").split(":").reduce((s,a)=>s*i(60)+i(a),i(0));return n==="-"?i(-1)*o:o}function cc(t){let{value:e}=t,n=s=>s;if(typeof e=="bigint")n=s=>BigInt(s);else if(isNaN(e)||!isFinite(e))return Dm.stringifyNumber(t);let r="";e<0&&(r="-",e*=n(-1));let i=n(60),o=[e%i];return e<60?o.unshift(0):(e=(e-o[0])/i,o.unshift(e%i),e>=60&&(e=(e-o[0])/i,o.unshift(e))),r+o.map(s=>String(s).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var Mm={identify:t=>typeof t=="bigint"||Number.isInteger(t),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(t,e,{intAsBigInt:n})=>co(t,n),stringify:cc},Bm={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=>co(t,!1),stringify:cc},lc={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(lc.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,n,r,i,o,s,a]=e.map(Number),c=e[7]?Number((e[7]+"00").substr(1,3)):0,l=Date.UTC(n,r-1,i,o||0,s||0,a||0,c),u=e[8];if(u&&u!=="Z"){let d=co(u,!1);Math.abs(d)<30&&(d*=60),l-=6e4*d}return new Date(l)},stringify:({value:t})=>t?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};vr.floatTime=Bm;vr.intTime=Mm;vr.timestamp=lc});var dc=y(fc=>{"use strict";var Km=yt(),Um=sr(),Hm=vt(),Ym=Ht(),Vm=Xi(),uc=ic(),uo=oc(),kr=ac(),Jm=Xn(),Gm=no(),zm=mr(),Qm=ao(),fo=lo(),Xm=[Km.map,Hm.seq,Ym.string,Um.nullTag,uc.trueTag,uc.falseTag,kr.intBin,kr.intOct,kr.int,kr.intHex,uo.floatNaN,uo.floatExp,uo.float,Vm.binary,Jm.merge,Gm.omap,zm.pairs,Qm.set,fo.intTime,fo.floatTime,fo.timestamp];fc.schema=Xm});var Sc=y(ho=>{"use strict";var gc=yt(),Zm=sr(),wc=vt(),ep=Ht(),tp=Ui(),mo=Yi(),po=Ji(),np=Ha(),rp=Ja(),yc=Xi(),zt=Xn(),vc=no(),kc=mr(),mc=dc(),bc=ao(),br=lo(),pc=new Map([["core",np.schema],["failsafe",[gc.map,wc.seq,ep.string]],["json",rp.schema],["yaml11",mc.schema],["yaml-1.1",mc.schema]]),hc={binary:yc.binary,bool:tp.boolTag,float:mo.float,floatExp:mo.floatExp,floatNaN:mo.floatNaN,floatTime:br.floatTime,int:po.int,intHex:po.intHex,intOct:po.intOct,intTime:br.intTime,map:gc.map,merge:zt.merge,null:Zm.nullTag,omap:vc.omap,pairs:kc.pairs,seq:wc.seq,set:bc.set,timestamp:br.timestamp},ip={"tag:yaml.org,2002:binary":yc.binary,"tag:yaml.org,2002:merge":zt.merge,"tag:yaml.org,2002:omap":vc.omap,"tag:yaml.org,2002:pairs":kc.pairs,"tag:yaml.org,2002:set":bc.set,"tag:yaml.org,2002:timestamp":br.timestamp};function op(t,e,n){let r=pc.get(e);if(r&&!t)return n&&!r.includes(zt.merge)?r.concat(zt.merge):r.slice();let i=r;if(!i)if(Array.isArray(t))i=[];else{let o=Array.from(pc.keys()).filter(s=>s!=="yaml11").map(s=>JSON.stringify(s)).join(", ");throw new Error(`Unknown schema "${e}"; use one of ${o} or define customTags array`)}if(Array.isArray(t))for(let o of t)i=i.concat(o);else typeof t=="function"&&(i=t(i.slice()));return n&&(i=i.concat(zt.merge)),i.reduce((o,s)=>{let a=typeof s=="string"?hc[s]:s;if(!a){let c=JSON.stringify(s),l=Object.keys(hc).map(u=>JSON.stringify(u)).join(", ");throw new Error(`Unknown custom tag ${c}; use one of ${l}`)}return o.includes(a)||o.push(a),o},[])}ho.coreKnownTags=ip;ho.getTags=op});var yo=y(Cc=>{"use strict";var go=O(),sp=yt(),ap=vt(),cp=Ht(),Sr=Sc(),lp=(t,e)=>t.key<e.key?-1:t.key>e.key?1:0,wo=class t{constructor({compat:e,customTags:n,merge:r,resolveKnownTags:i,schema:o,sortMapEntries:s,toStringDefaults:a}){this.compat=Array.isArray(e)?Sr.getTags(e,"compat"):e?Sr.getTags(null,e):null,this.name=typeof o=="string"&&o||"core",this.knownTags=i?Sr.coreKnownTags:{},this.tags=Sr.getTags(n,this.name,r),this.toStringOptions=a??null,Object.defineProperty(this,go.MAP,{value:sp.map}),Object.defineProperty(this,go.SCALAR,{value:cp.string}),Object.defineProperty(this,go.SEQ,{value:ap.seq}),this.sortMapEntries=typeof s=="function"?s:s===!0?lp:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};Cc.Schema=wo});var _c=y(Ec=>{"use strict";var up=O(),vo=Bt(),Qt=Wt();function fp(t,e){let n=[],r=e.directives===!0;if(e.directives!==!1&&t.directives){let c=t.directives.toString(t);c?(n.push(c),r=!0):t.directives.docStart&&(r=!0)}r&&n.push("---");let i=vo.createStringifyContext(t,e),{commentString:o}=i.options;if(t.commentBefore){n.length!==1&&n.unshift("");let c=o(t.commentBefore);n.unshift(Qt.indentComment(c,""))}let s=!1,a=null;if(t.contents){if(up.isNode(t.contents)){if(t.contents.spaceBefore&&r&&n.push(""),t.contents.commentBefore){let u=o(t.contents.commentBefore);n.push(Qt.indentComment(u,""))}i.forceBlockIndent=!!t.comment,a=t.contents.comment}let c=a?void 0:()=>s=!0,l=vo.stringify(t.contents,i,()=>a=null,c);a&&(l+=Qt.lineComment(l,"",o(a))),(l[0]==="|"||l[0]===">")&&n[n.length-1]==="---"?n[n.length-1]=`--- ${l}`:n.push(l)}else n.push(vo.stringify(t.contents,i));if(t.directives?.docEnd)if(t.comment){let c=o(t.comment);c.includes(`
|
|
58
58
|
`)?(n.push("..."),n.push(Qt.indentComment(c,""))):n.push(`... ${c}`)}else n.push("...");else{let c=t.comment;c&&s&&(c=c.replace(/^\n+/,"")),c&&((!s||a)&&n[n.length-1]!==""&&n.push(""),n.push(Qt.indentComment(o(c),"")))}return n.join(`
|
|
59
59
|
`)+`
|
|
60
|
-
`}Ec.stringifyDocument=fp});var Xt=y(xc=>{"use strict";var dp=Lt(),
|
|
60
|
+
`}Ec.stringifyDocument=fp});var Xt=y(xc=>{"use strict";var dp=Lt(),bt=Bn(),ie=O(),mp=Ae(),pp=xe(),hp=yo(),gp=_c(),ko=Wn(),wp=Ci(),yp=qt(),bo=Si(),So=class t{constructor(e,n,r){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,ie.NODE_TYPE,{value:ie.DOC});let i=null;typeof n=="function"||Array.isArray(n)?i=n:r===void 0&&n&&(r=n,n=void 0);let o=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},r);this.options=o;let{version:s}=o;r?._directives?(this.directives=r._directives.atDocument(),this.directives.yaml.explicit&&(s=this.directives.yaml.version)):this.directives=new bo.Directives({version:s}),this.setSchema(s,r),this.contents=e===void 0?null:this.createNode(e,i,r)}clone(){let e=Object.create(t.prototype,{[ie.NODE_TYPE]:{value:ie.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=ie.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){St(this.contents)&&this.contents.add(e)}addIn(e,n){St(this.contents)&&this.contents.addIn(e,n)}createAlias(e,n){if(!e.anchor){let r=ko.anchorNames(this);e.anchor=!n||r.has(n)?ko.findNewAnchor(n||"a",r):n}return new dp.Alias(e.anchor)}createNode(e,n,r){let i;if(typeof n=="function")e=n.call({"":e},"",e),i=n;else if(Array.isArray(n)){let p=v=>typeof v=="number"||v instanceof String||v instanceof Number,w=n.filter(p).map(String);w.length>0&&(n=n.concat(w)),i=n}else r===void 0&&n&&(r=n,n=void 0);let{aliasDuplicateObjects:o,anchorPrefix:s,flow:a,keepUndefined:c,onTagObj:l,tag:u}=r??{},{onAnchor:d,setAnchors:m,sourceObjects:h}=ko.createNodeAnchors(this,s||"a"),g={aliasDuplicateObjects:o??!0,keepUndefined:c??!1,onAnchor:d,onTagObj:l,replacer:i,schema:this.schema,sourceObjects:h},f=yp.createNode(e,u,g);return a&&ie.isCollection(f)&&(f.flow=!0),m(),f}createPair(e,n,r={}){let i=this.createNode(e,null,r),o=this.createNode(n,null,r);return new mp.Pair(i,o)}delete(e){return St(this.contents)?this.contents.delete(e):!1}deleteIn(e){return bt.isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):St(this.contents)?this.contents.deleteIn(e):!1}get(e,n){return ie.isCollection(this.contents)?this.contents.get(e,n):void 0}getIn(e,n){return bt.isEmptyPath(e)?!n&&ie.isScalar(this.contents)?this.contents.value:this.contents:ie.isCollection(this.contents)?this.contents.getIn(e,n):void 0}has(e){return ie.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return bt.isEmptyPath(e)?this.contents!==void 0:ie.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,n){this.contents==null?this.contents=bt.collectionFromPath(this.schema,[e],n):St(this.contents)&&this.contents.set(e,n)}setIn(e,n){bt.isEmptyPath(e)?this.contents=n:this.contents==null?this.contents=bt.collectionFromPath(this.schema,Array.from(e),n):St(this.contents)&&this.contents.setIn(e,n)}setSchema(e,n={}){typeof e=="number"&&(e=String(e));let r;switch(e){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new bo.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 bo.Directives({version:e}),r={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,r=null;break;default:{let i=JSON.stringify(e);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${i}`)}}if(n.schema instanceof Object)this.schema=n.schema;else if(r)this.schema=new hp.Schema(Object.assign(r,n));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:e,jsonArg:n,mapAsMap:r,maxAliasCount:i,onAnchor:o,reviver:s}={}){let a={anchors:new Map,doc:this,keep:!e,mapAsMap:r===!0,mapKeyWarned:!1,maxAliasCount:typeof i=="number"?i:100},c=pp.toJS(this.contents,n??"",a);if(typeof o=="function")for(let{count:l,res:u}of a.anchors.values())o(u,l);return typeof s=="function"?wp.applyReviver(s,{"":c},"",c):c}toJSON(e,n){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:n})}toString(e={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in e&&(!Number.isInteger(e.indent)||Number(e.indent)<=0)){let n=JSON.stringify(e.indent);throw new Error(`"indent" option must be a positive integer, not ${n}`)}return gp.stringifyDocument(this,e)}};function St(t){if(ie.isCollection(t))return!0;throw new Error("Expected a YAML collection as document contents")}xc.Document=So});var tn=y(en=>{"use strict";var Zt=class extends Error{constructor(e,n,r,i){super(),this.name=e,this.code=r,this.message=i,this.pos=n}},Co=class extends Zt{constructor(e,n,r){super("YAMLParseError",e,n,r)}},Eo=class extends Zt{constructor(e,n,r){super("YAMLWarning",e,n,r)}},vp=(t,e)=>n=>{if(n.pos[0]===-1)return;n.linePos=n.pos.map(a=>e.linePos(a));let{line:r,col:i}=n.linePos[0];n.message+=` at line ${r}, column ${i}`;let o=i-1,s=t.substring(e.lineStarts[r-1],e.lineStarts[r]).replace(/[\n\r]+$/,"");if(o>=60&&s.length>80){let a=Math.min(o-39,s.length-79);s="…"+s.substring(a),o-=a-1}if(s.length>80&&(s=s.substring(0,79)+"…"),r>1&&/^ *$/.test(s.substring(0,o))){let a=t.substring(e.lineStarts[r-2],e.lineStarts[r-1]);a.length>80&&(a=a.substring(0,79)+`…
|
|
61
61
|
`),s=a+s}if(/[^ ]/.test(s)){let a=1,c=n.linePos[1];c?.line===r&&c.col>i&&(a=Math.max(1,Math.min(c.col-i,80-o)));let l=" ".repeat(o)+"^".repeat(a);n.message+=`:
|
|
62
62
|
|
|
63
63
|
${s}
|
|
64
64
|
${l}
|
|
65
|
-
`}};en.YAMLError=Zt;en.YAMLParseError=
|
|
66
|
-
`))return!0;if(t.end){for(let e of t.end)if(e.type==="newline")return!0}return!1;case"flow-collection":for(let e of t.items){for(let n of e.start)if(n.type==="newline")return!0;if(e.sep){for(let n of e.sep)if(n.type==="newline")return!0}if(
|
|
65
|
+
`}};en.YAMLError=Zt;en.YAMLParseError=Co;en.YAMLWarning=Eo;en.prettifyError=vp});var nn=y(Pc=>{"use strict";function kp(t,{flow:e,indicator:n,next:r,offset:i,onError:o,parentIndent:s,startOnNewline:a}){let c=!1,l=a,u=a,d="",m="",h=!1,g=!1,f=null,p=null,w=null,v=null,b=null,C=null,_=null;for(let k of t)switch(g&&(k.type!=="space"&&k.type!=="newline"&&k.type!=="comma"&&o(k.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),g=!1),f&&(l&&k.type!=="comment"&&k.type!=="newline"&&o(f,"TAB_AS_INDENT","Tabs are not allowed as indentation"),f=null),k.type){case"space":!e&&(n!=="doc-start"||r?.type!=="flow-collection")&&k.source.includes(" ")&&(f=k),u=!0;break;case"comment":{u||o(k,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let D=k.source.substring(1)||" ";d?d+=m+D:d=D,m="",l=!1;break}case"newline":l?d?d+=k.source:(!C||n!=="seq-item-ind")&&(c=!0):m+=k.source,l=!0,h=!0,(p||w)&&(v=k),u=!0;break;case"anchor":p&&o(k,"MULTIPLE_ANCHORS","A node can have at most one anchor"),k.source.endsWith(":")&&o(k.offset+k.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),p=k,_??(_=k.offset),l=!1,u=!1,g=!0;break;case"tag":{w&&o(k,"MULTIPLE_TAGS","A node can have at most one tag"),w=k,_??(_=k.offset),l=!1,u=!1,g=!0;break}case n:(p||w)&&o(k,"BAD_PROP_ORDER",`Anchors and tags must be after the ${k.source} indicator`),C&&o(k,"UNEXPECTED_TOKEN",`Unexpected ${k.source} in ${e??"collection"}`),C=k,l=n==="seq-item-ind"||n==="explicit-key-ind",u=!1;break;case"comma":if(e){b&&o(k,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),b=k,l=!1,u=!1;break}default:o(k,"UNEXPECTED_TOKEN",`Unexpected ${k.type} token`),l=!1,u=!1}let P=t[t.length-1],j=P?P.offset+P.source.length:i;return g&&r&&r.type!=="space"&&r.type!=="newline"&&r.type!=="comma"&&(r.type!=="scalar"||r.source!=="")&&o(r.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),f&&(l&&f.indent<=s||r?.type==="block-map"||r?.type==="block-seq")&&o(f,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:b,found:C,spaceBefore:c,comment:d,hasNewline:h,anchor:p,tag:w,newlineAfterProp:v,end:j,start:_??j}}Pc.resolveProps=kp});var Cr=y(Rc=>{"use strict";function _o(t){if(!t)return null;switch(t.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(t.source.includes(`
|
|
66
|
+
`))return!0;if(t.end){for(let e of t.end)if(e.type==="newline")return!0}return!1;case"flow-collection":for(let e of t.items){for(let n of e.start)if(n.type==="newline")return!0;if(e.sep){for(let n of e.sep)if(n.type==="newline")return!0}if(_o(e.key)||_o(e.value))return!0}return!1;default:return!0}}Rc.containsNewline=_o});var xo=y(Oc=>{"use strict";var bp=Cr();function Sp(t,e,n){if(e?.type==="flow-collection"){let r=e.end[0];r.indent===t&&(r.source==="]"||r.source==="}")&&bp.containsNewline(e)&&n(r,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}Oc.flowIndentCheck=Sp});var Po=y(Nc=>{"use strict";var Ac=O();function Cp(t,e,n){let{uniqueKeys:r}=t.options;if(r===!1)return!1;let i=typeof r=="function"?r:(o,s)=>o===s||Ac.isScalar(o)&&Ac.isScalar(s)&&o.value===s.value;return e.some(o=>i(o.key,n))}Nc.mapIncludes=Cp});var qc=y(Lc=>{"use strict";var jc=Ae(),Ep=je(),Tc=nn(),_p=Cr(),$c=xo(),xp=Po(),Ic="All mapping items must start at the same column";function Pp({composeNode:t,composeEmptyNode:e},n,r,i,o){let s=o?.nodeClass??Ep.YAMLMap,a=new s(n.schema);n.atRoot&&(n.atRoot=!1);let c=r.offset,l=null;for(let u of r.items){let{start:d,key:m,sep:h,value:g}=u,f=Tc.resolveProps(d,{indicator:"explicit-key-ind",next:m??h?.[0],offset:c,onError:i,parentIndent:r.indent,startOnNewline:!0}),p=!f.found;if(p){if(m&&(m.type==="block-seq"?i(c,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in m&&m.indent!==r.indent&&i(c,"BAD_INDENT",Ic)),!f.anchor&&!f.tag&&!h){l=f.end,f.comment&&(a.comment?a.comment+=`
|
|
67
67
|
`+f.comment:a.comment=f.comment);continue}(f.newlineAfterProp||_p.containsNewline(m))&&i(m??d[d.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else f.found?.indent!==r.indent&&i(c,"BAD_INDENT",Ic);n.atKey=!0;let w=f.end,v=m?t(n,m,f,i):e(n,w,d,null,f,i);n.schema.compat&&$c.flowIndentCheck(r.indent,m,i),n.atKey=!1,xp.mapIncludes(n,a.items,v)&&i(w,"DUPLICATE_KEY","Map keys must be unique");let b=Tc.resolveProps(h??[],{indicator:"map-value-ind",next:g,offset:v.range[2],onError:i,parentIndent:r.indent,startOnNewline:!m||m.type==="block-scalar"});if(c=b.end,b.found){p&&(g?.type==="block-map"&&!b.hasNewline&&i(c,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),n.options.strict&&f.start<b.found.offset-1024&&i(v.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));let C=g?t(n,g,b,i):e(n,c,h,null,b,i);n.schema.compat&&$c.flowIndentCheck(r.indent,g,i),c=C.range[2];let _=new jc.Pair(v,C);n.options.keepSourceTokens&&(_.srcToken=u),a.items.push(_)}else{p&&i(v.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),b.comment&&(v.comment?v.comment+=`
|
|
68
|
-
`+b.comment:v.comment=b.comment);let C=new jc.Pair(v);n.options.keepSourceTokens&&(C.srcToken=u),a.items.push(C)}}return l&&l<c&&i(l,"IMPOSSIBLE","Map comment with trailing content"),a.range=[r.offset,c,l??c],a}Lc.resolveBlockMap=Pp});var
|
|
68
|
+
`+b.comment:v.comment=b.comment);let C=new jc.Pair(v);n.options.keepSourceTokens&&(C.srcToken=u),a.items.push(C)}}return l&&l<c&&i(l,"IMPOSSIBLE","Map comment with trailing content"),a.range=[r.offset,c,l??c],a}Lc.resolveBlockMap=Pp});var Fc=y(Wc=>{"use strict";var Rp=Te(),Op=nn(),Ap=xo();function Np({composeNode:t,composeEmptyNode:e},n,r,i,o){let s=o?.nodeClass??Rp.YAMLSeq,a=new s(n.schema);n.atRoot&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let c=r.offset,l=null;for(let{start:u,value:d}of r.items){let m=Op.resolveProps(u,{indicator:"seq-item-ind",next:d,offset:c,onError:i,parentIndent:r.indent,startOnNewline:!0});if(!m.found)if(m.anchor||m.tag||d)d?.type==="block-seq"?i(m.end,"BAD_INDENT","All sequence items must start at the same column"):i(c,"MISSING_CHAR","Sequence item without - indicator");else{l=m.end,m.comment&&(a.comment=m.comment);continue}let h=d?t(n,d,m,i):e(n,m.end,u,null,m,i);n.schema.compat&&Ap.flowIndentCheck(r.indent,d,i),c=h.range[2],a.items.push(h)}return a.range=[r.offset,c,l??c],a}Wc.resolveBlockSeq=Np});var Ct=y(Dc=>{"use strict";function jp(t,e,n,r){let i="";if(t){let o=!1,s="";for(let a of t){let{source:c,type:l}=a;switch(l){case"space":o=!0;break;case"comment":{n&&!o&&r(a,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let u=c.substring(1)||" ";i?i+=s+u:i=u,s="";break}case"newline":i&&(s+=c),o=!0;break;default:r(a,"UNEXPECTED_TOKEN",`Unexpected ${l} at node end`)}e+=c.length}}return{comment:i,offset:e}}Dc.resolveEnd=jp});var Uc=y(Kc=>{"use strict";var Tp=O(),$p=Ae(),Mc=je(),Ip=Te(),Lp=Ct(),Bc=nn(),qp=Cr(),Wp=Po(),Ro="Block collections are not allowed within flow collections",Oo=t=>t&&(t.type==="block-map"||t.type==="block-seq");function Fp({composeNode:t,composeEmptyNode:e},n,r,i,o){let s=r.start.source==="{",a=s?"flow map":"flow sequence",c=o?.nodeClass??(s?Mc.YAMLMap:Ip.YAMLSeq),l=new c(n.schema);l.flow=!0;let u=n.atRoot;u&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let d=r.offset+r.start.source.length;for(let p=0;p<r.items.length;++p){let w=r.items[p],{start:v,key:b,sep:C,value:_}=w,P=Bc.resolveProps(v,{flow:a,indicator:"explicit-key-ind",next:b??C?.[0],offset:d,onError:i,parentIndent:r.indent,startOnNewline:!1});if(!P.found){if(!P.anchor&&!P.tag&&!C&&!_){p===0&&P.comma?i(P.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`):p<r.items.length-1&&i(P.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${a}`),P.comment&&(l.comment?l.comment+=`
|
|
69
69
|
`+P.comment:l.comment=P.comment),d=P.end;continue}!s&&n.options.strict&&qp.containsNewline(b)&&i(b,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(p===0)P.comma&&i(P.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`);else if(P.comma||i(P.start,"MISSING_CHAR",`Missing , between ${a} items`),P.comment){let j="";e:for(let k of v)switch(k.type){case"comma":case"space":break;case"comment":j=k.source.substring(1);break e;default:break e}if(j){let k=l.items[l.items.length-1];Tp.isPair(k)&&(k=k.value??k.key),k.comment?k.comment+=`
|
|
70
|
-
`+j:k.comment=j,P.comment=P.comment.substring(j.length+1)}}if(!s&&!C&&!P.found){let j=_?t(n,_,P,i):e(n,P.end,C,null,P,i);l.items.push(j),d=j.range[2],
|
|
71
|
-
`+D.comment:k.comment=D.comment);let
|
|
72
|
-
`+p.comment:l.comment=p.comment),l.range=[r.offset,f,p.offset]}else l.range=[r.offset,f,f];return l}Kc.resolveFlowCollection=
|
|
70
|
+
`+j:k.comment=j,P.comment=P.comment.substring(j.length+1)}}if(!s&&!C&&!P.found){let j=_?t(n,_,P,i):e(n,P.end,C,null,P,i);l.items.push(j),d=j.range[2],Oo(_)&&i(j.range,"BLOCK_IN_FLOW",Ro)}else{n.atKey=!0;let j=P.end,k=b?t(n,b,P,i):e(n,j,v,null,P,i);Oo(b)&&i(k.range,"BLOCK_IN_FLOW",Ro),n.atKey=!1;let D=Bc.resolveProps(C??[],{flow:a,indicator:"map-value-ind",next:_,offset:k.range[2],onError:i,parentIndent:r.indent,startOnNewline:!1});if(D.found){if(!s&&!P.found&&n.options.strict){if(C)for(let M of C){if(M===D.found)break;if(M.type==="newline"){i(M,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}P.start<D.found.offset-1024&&i(D.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else _&&("source"in _&&_.source?.[0]===":"?i(_,"MISSING_CHAR",`Missing space after : in ${a}`):i(D.start,"MISSING_CHAR",`Missing , or : between ${a} items`));let _e=_?t(n,_,D,i):D.found?e(n,D.end,C,null,D,i):null;_e?Oo(_)&&i(_e.range,"BLOCK_IN_FLOW",Ro):D.comment&&(k.comment?k.comment+=`
|
|
71
|
+
`+D.comment:k.comment=D.comment);let mt=new $p.Pair(k,_e);if(n.options.keepSourceTokens&&(mt.srcToken=w),s){let M=l;Wp.mapIncludes(n,M.items,k)&&i(j,"DUPLICATE_KEY","Map keys must be unique"),M.items.push(mt)}else{let M=new Mc.YAMLMap(n.schema);M.flow=!0,M.items.push(mt);let Us=(_e??k).range;M.range=[k.range[0],Us[1],Us[2]],l.items.push(M)}d=_e?_e.range[2]:D.end}}let m=s?"}":"]",[h,...g]=r.end,f=d;if(h?.source===m)f=h.offset+h.source.length;else{let p=a[0].toUpperCase()+a.substring(1),w=u?`${p} must end with a ${m}`:`${p} in block collection must be sufficiently indented and end with a ${m}`;i(d,u?"MISSING_CHAR":"BAD_INDENT",w),h&&h.source.length!==1&&g.unshift(h)}if(g.length>0){let p=Lp.resolveEnd(g,f,n.options.strict,i);p.comment&&(l.comment?l.comment+=`
|
|
72
|
+
`+p.comment:l.comment=p.comment),l.range=[r.offset,f,p.offset]}else l.range=[r.offset,f,f];return l}Kc.resolveFlowCollection=Fp});var Yc=y(Hc=>{"use strict";var Dp=O(),Mp=W(),Bp=je(),Kp=Te(),Up=qc(),Hp=Fc(),Yp=Uc();function Ao(t,e,n,r,i,o){let s=n.type==="block-map"?Up.resolveBlockMap(t,e,n,r,o):n.type==="block-seq"?Hp.resolveBlockSeq(t,e,n,r,o):Yp.resolveFlowCollection(t,e,n,r,o),a=s.constructor;return i==="!"||i===a.tagName?(s.tag=a.tagName,s):(i&&(s.tag=i),s)}function Vp(t,e,n,r,i){let o=r.tag,s=o?e.directives.tagName(o.source,m=>i(o,"TAG_RESOLVE_FAILED",m)):null;if(n.type==="block-seq"){let{anchor:m,newlineAfterProp:h}=r,g=m&&o?m.offset>o.offset?m:o:m??o;g&&(!h||h.offset<g.offset)&&i(g,"MISSING_CHAR","Missing newline after block sequence props")}let a=n.type==="block-map"?"map":n.type==="block-seq"?"seq":n.start.source==="{"?"map":"seq";if(!o||!s||s==="!"||s===Bp.YAMLMap.tagName&&a==="map"||s===Kp.YAMLSeq.tagName&&a==="seq")return Ao(t,e,n,i,s);let c=e.schema.tags.find(m=>m.tag===s&&m.collection===a);if(!c){let m=e.schema.knownTags[s];if(m?.collection===a)e.schema.tags.push(Object.assign({},m,{default:!1})),c=m;else return m?i(o,"BAD_COLLECTION_TYPE",`${m.tag} used for ${a} collection, but expects ${m.collection??"scalar"}`,!0):i(o,"TAG_RESOLVE_FAILED",`Unresolved tag: ${s}`,!0),Ao(t,e,n,i,s)}let l=Ao(t,e,n,i,s,c),u=c.resolve?.(l,m=>i(o,"TAG_RESOLVE_FAILED",m),e.options)??l,d=Dp.isNode(u)?u:new Mp.Scalar(u);return d.range=l.range,d.tag=s,c?.format&&(d.format=c.format),d}Hc.composeCollection=Vp});var jo=y(Vc=>{"use strict";var No=W();function Jp(t,e,n){let r=e.offset,i=Gp(e,t.options.strict,n);if(!i)return{value:"",type:null,comment:"",range:[r,r,r]};let o=i.mode===">"?No.Scalar.BLOCK_FOLDED:No.Scalar.BLOCK_LITERAL,s=e.source?zp(e.source):[],a=s.length;for(let f=s.length-1;f>=0;--f){let p=s[f][1];if(p===""||p==="\r")a=f;else break}if(a===0){let f=i.chomp==="+"&&s.length>0?`
|
|
73
73
|
`.repeat(Math.max(1,s.length-1)):"",p=r+i.length;return e.source&&(p+=e.source.length),{value:f,type:o,comment:i.comment,range:[r,p,p]}}let c=e.indent+i.indent,l=e.offset+i.length,u=0;for(let f=0;f<a;++f){let[p,w]=s[f];if(w===""||w==="\r")i.indent===0&&p.length>c&&(c=p.length);else{p.length<c&&n(l+p.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator"),i.indent===0&&(c=p.length),u=f,c===0&&!t.atRoot&&n(l,"BAD_INDENT","Block scalar values in collections must be indented");break}l+=p.length+w.length+1}for(let f=s.length-1;f>=a;--f)s[f][0].length>c&&(a=f+1);let d="",m="",h=!1;for(let f=0;f<u;++f)d+=s[f][0].slice(c)+`
|
|
74
|
-
`;for(let f=u;f<a;++f){let[p,w]=s[f];l+=p.length+w.length+1;let v=w[w.length-1]==="\r";if(v&&(w=w.slice(0,-1)),w&&p.length<c){let C=`Block scalar lines must not be less indented than their ${i.indent?"explicit indentation indicator":"first line"}`;n(l-w.length-(v?2:1),"BAD_INDENT",C),p=""}o===
|
|
74
|
+
`;for(let f=u;f<a;++f){let[p,w]=s[f];l+=p.length+w.length+1;let v=w[w.length-1]==="\r";if(v&&(w=w.slice(0,-1)),w&&p.length<c){let C=`Block scalar lines must not be less indented than their ${i.indent?"explicit indentation indicator":"first line"}`;n(l-w.length-(v?2:1),"BAD_INDENT",C),p=""}o===No.Scalar.BLOCK_LITERAL?(d+=m+p.slice(c)+w,m=`
|
|
75
75
|
`):p.length>c||w[0]===" "?(m===" "?m=`
|
|
76
76
|
`:!h&&m===`
|
|
77
77
|
`&&(m=`
|
|
@@ -84,7 +84,7 @@ ${l}
|
|
|
84
84
|
`+s[f][0].slice(c);d[d.length-1]!==`
|
|
85
85
|
`&&(d+=`
|
|
86
86
|
`);break;default:d+=`
|
|
87
|
-
`}let g=r+i.length+e.source.length;return{value:d,type:o,comment:i.comment,range:[r,g,g]}}function Gp({offset:t,props:e},n,r){if(e[0].type!=="block-scalar-header")return r(e[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:i}=e[0],o=i[0],s=0,a="",c=-1;for(let m=1;m<i.length;++m){let h=i[m];if(!a&&(h==="-"||h==="+"))a=h;else{let g=Number(h);!s&&g?s=g:c===-1&&(c=t+m)}}c!==-1&&r(c,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${i}`);let l=!1,u="",d=i.length;for(let m=1;m<e.length;++m){let h=e[m];switch(h.type){case"space":l=!0;case"newline":d+=h.source.length;break;case"comment":n&&!l&&r(h,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),d+=h.source.length,u=h.source.substring(1);break;case"error":r(h,"UNEXPECTED_TOKEN",h.message),d+=h.source.length;break;default:{let g=`Unexpected token in block scalar header: ${h.type}`;r(h,"UNEXPECTED_TOKEN",g);let f=h.source;f&&typeof f=="string"&&(d+=f.length)}}}return{mode:o,indent:s,chomp:a,comment:u,length:d}}function zp(t){let e=t.split(/\n( *)/),n=e[0],r=n.match(/^( *)/),o=[r?.[1]?[r[1],n.slice(r[1].length)]:["",n]];for(let s=1;s<e.length;s+=2)o.push([e[s],e[s+1]]);return o}Vc.resolveBlockScalar=Jp});var
|
|
87
|
+
`}let g=r+i.length+e.source.length;return{value:d,type:o,comment:i.comment,range:[r,g,g]}}function Gp({offset:t,props:e},n,r){if(e[0].type!=="block-scalar-header")return r(e[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:i}=e[0],o=i[0],s=0,a="",c=-1;for(let m=1;m<i.length;++m){let h=i[m];if(!a&&(h==="-"||h==="+"))a=h;else{let g=Number(h);!s&&g?s=g:c===-1&&(c=t+m)}}c!==-1&&r(c,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${i}`);let l=!1,u="",d=i.length;for(let m=1;m<e.length;++m){let h=e[m];switch(h.type){case"space":l=!0;case"newline":d+=h.source.length;break;case"comment":n&&!l&&r(h,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),d+=h.source.length,u=h.source.substring(1);break;case"error":r(h,"UNEXPECTED_TOKEN",h.message),d+=h.source.length;break;default:{let g=`Unexpected token in block scalar header: ${h.type}`;r(h,"UNEXPECTED_TOKEN",g);let f=h.source;f&&typeof f=="string"&&(d+=f.length)}}}return{mode:o,indent:s,chomp:a,comment:u,length:d}}function zp(t){let e=t.split(/\n( *)/),n=e[0],r=n.match(/^( *)/),o=[r?.[1]?[r[1],n.slice(r[1].length)]:["",n]];for(let s=1;s<e.length;s+=2)o.push([e[s],e[s+1]]);return o}Vc.resolveBlockScalar=Jp});var $o=y(Gc=>{"use strict";var To=W(),Qp=Ct();function Xp(t,e,n){let{offset:r,type:i,source:o,end:s}=t,a,c,l=(m,h,g)=>n(r+m,h,g);switch(i){case"scalar":a=To.Scalar.PLAIN,c=Zp(o,l);break;case"single-quoted-scalar":a=To.Scalar.QUOTE_SINGLE,c=eh(o,l);break;case"double-quoted-scalar":a=To.Scalar.QUOTE_DOUBLE,c=th(o,l);break;default:return n(t,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${i}`),{value:"",type:null,comment:"",range:[r,r+o.length,r+o.length]}}let u=r+o.length,d=Qp.resolveEnd(s,u,e,n);return{value:c,type:a,comment:d.comment,range:[r,u,d.offset]}}function Zp(t,e){let n="";switch(t[0]){case" ":n="a tab character";break;case",":n="flow indicator character ,";break;case"%":n="directive indicator character %";break;case"|":case">":{n=`block scalar indicator ${t[0]}`;break}case"@":case"`":{n=`reserved character ${t[0]}`;break}}return n&&e(0,"BAD_SCALAR_START",`Plain value cannot start with ${n}`),Jc(t)}function eh(t,e){return(t[t.length-1]!=="'"||t.length===1)&&e(t.length,"MISSING_CHAR","Missing closing 'quote"),Jc(t.slice(1,-1)).replace(/''/g,"'")}function Jc(t){let e,n;try{e=new RegExp(`(.*?)(?<![ ])[ ]*\r?
|
|
88
88
|
`,"sy"),n=new RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
|
|
89
89
|
`,"sy")}catch{e=/(.*?)[ \t]*\r?\n/sy,n=/[ \t]*(.*?)[ \t]*\r?\n/sy}let r=e.exec(t);if(!r)return t;let i=r[1],o=" ",s=e.lastIndex;for(n.lastIndex=s;r=n.exec(t);)r[1]===""?o===`
|
|
90
90
|
`?i+=o:o=`
|
|
@@ -99,31 +99,31 @@ ${l}
|
|
|
99
99
|
`);)r===`
|
|
100
100
|
`&&(n+=`
|
|
101
101
|
`),e+=1,r=t[e+1];return n||(n=" "),{fold:n,offset:e}}var rh={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
|
|
102
|
-
`,r:"\r",t:" ",v:"\v",N:"
",_:" ",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function ih(t,e,n,r){let i=t.substr(e,n),s=i.length===n&&/^[0-9a-fA-F]+$/.test(i)?parseInt(i,16):NaN;try{return String.fromCodePoint(s)}catch{let a=t.substr(e-2,n+2);return r(e-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),a}}Gc.resolveFlowScalar=Xp});var Xc=y(Qc=>{"use strict";var rt=
|
|
102
|
+
`,r:"\r",t:" ",v:"\v",N:"
",_:" ",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function ih(t,e,n,r){let i=t.substr(e,n),s=i.length===n&&/^[0-9a-fA-F]+$/.test(i)?parseInt(i,16):NaN;try{return String.fromCodePoint(s)}catch{let a=t.substr(e-2,n+2);return r(e-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),a}}Gc.resolveFlowScalar=Xp});var Xc=y(Qc=>{"use strict";var rt=O(),zc=W(),oh=jo(),sh=$o();function ah(t,e,n,r){let{value:i,type:o,comment:s,range:a}=e.type==="block-scalar"?oh.resolveBlockScalar(t,e,r):sh.resolveFlowScalar(e,t.options.strict,r),c=n?t.directives.tagName(n.source,d=>r(n,"TAG_RESOLVE_FAILED",d)):null,l;t.options.stringKeys&&t.atKey?l=t.schema[rt.SCALAR]:c?l=ch(t.schema,i,c,n,r):e.type==="scalar"?l=lh(t,i,e,r):l=t.schema[rt.SCALAR];let u;try{let d=l.resolve(i,m=>r(n??e,"TAG_RESOLVE_FAILED",m),t.options);u=rt.isScalar(d)?d:new zc.Scalar(d)}catch(d){let m=d instanceof Error?d.message:String(d);r(n??e,"TAG_RESOLVE_FAILED",m),u=new zc.Scalar(i)}return u.range=a,u.source=i,o&&(u.type=o),c&&(u.tag=c),l.format&&(u.format=l.format),s&&(u.comment=s),u}function ch(t,e,n,r,i){if(n==="!")return t[rt.SCALAR];let o=[];for(let a of t.tags)if(!a.collection&&a.tag===n)if(a.default&&a.test)o.push(a);else return a;for(let a of o)if(a.test?.test(e))return a;let s=t.knownTags[n];return s&&!s.collection?(t.tags.push(Object.assign({},s,{default:!1,test:void 0})),s):(i(r,"TAG_RESOLVE_FAILED",`Unresolved tag: ${n}`,n!=="tag:yaml.org,2002:str"),t[rt.SCALAR])}function lh({atKey:t,directives:e,schema:n},r,i,o){let s=n.tags.find(a=>(a.default===!0||t&&a.default==="key")&&a.test?.test(r))||n[rt.SCALAR];if(n.compat){let a=n.compat.find(c=>c.default&&c.test?.test(r))??n[rt.SCALAR];if(s.tag!==a.tag){let c=e.tagString(s.tag),l=e.tagString(a.tag),u=`Value may be parsed as either ${c} or ${l}`;o(i,"TAG_RESOLVE_FAILED",u,!0)}}return s}Qc.composeScalar=ah});var el=y(Zc=>{"use strict";function uh(t,e,n){if(e){n??(n=e.length);for(let r=n-1;r>=0;--r){let i=e[r];switch(i.type){case"space":case"comment":case"newline":t-=i.source.length;continue}for(i=e[++r];i?.type==="space";)t+=i.source.length,i=e[++r];break}}return t}Zc.emptyScalarPosition=uh});var rl=y(Lo=>{"use strict";var fh=Lt(),dh=O(),mh=Yc(),tl=Xc(),ph=Ct(),hh=el(),gh={composeNode:nl,composeEmptyNode:Io};function nl(t,e,n,r){let i=t.atKey,{spaceBefore:o,comment:s,anchor:a,tag:c}=n,l,u=!0;switch(e.type){case"alias":l=wh(t,e,r),(a||c)&&r(e,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":l=tl.composeScalar(t,e,c,r),a&&(l.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{l=mh.composeCollection(gh,t,e,n,r),a&&(l.anchor=a.source.substring(1))}catch(d){let m=d instanceof Error?d.message:String(d);r(e,"RESOURCE_EXHAUSTION",m)}break;default:{let d=e.type==="error"?e.message:`Unsupported token (type: ${e.type})`;r(e,"UNEXPECTED_TOKEN",d),u=!1}}return l??(l=Io(t,e.offset,void 0,null,n,r)),a&&l.anchor===""&&r(a,"BAD_ALIAS","Anchor cannot be an empty string"),i&&t.options.stringKeys&&(!dh.isScalar(l)||typeof l.value!="string"||l.tag&&l.tag!=="tag:yaml.org,2002:str")&&r(c??e,"NON_STRING_KEY","With stringKeys, all keys must be strings"),o&&(l.spaceBefore=!0),s&&(e.type==="scalar"&&e.source===""?l.comment=s:l.commentBefore=s),t.options.keepSourceTokens&&u&&(l.srcToken=e),l}function Io(t,e,n,r,{spaceBefore:i,comment:o,anchor:s,tag:a,end:c},l){let u={type:"scalar",offset:hh.emptyScalarPosition(e,n,r),indent:-1,source:""},d=tl.composeScalar(t,u,a,l);return s&&(d.anchor=s.source.substring(1),d.anchor===""&&l(s,"BAD_ALIAS","Anchor cannot be an empty string")),i&&(d.spaceBefore=!0),o&&(d.comment=o,d.range[2]=c),d}function wh({options:t},{offset:e,source:n,end:r},i){let o=new fh.Alias(n.substring(1));o.source===""&&i(e,"BAD_ALIAS","Alias cannot be an empty string"),o.source.endsWith(":")&&i(e+n.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let s=e+n.length,a=ph.resolveEnd(r,s,t.strict,i);return o.range=[e,s,a.offset],a.comment&&(o.comment=a.comment),o}Lo.composeEmptyNode=Io;Lo.composeNode=nl});var sl=y(ol=>{"use strict";var yh=Xt(),il=rl(),vh=Ct(),kh=nn();function bh(t,e,{offset:n,start:r,value:i,end:o},s){let a=Object.assign({_directives:e},t),c=new yh.Document(void 0,a),l={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},u=kh.resolveProps(r,{indicator:"doc-start",next:i??o?.[0],offset:n,onError:s,parentIndent:0,startOnNewline:!0});u.found&&(c.directives.docStart=!0,i&&(i.type==="block-map"||i.type==="block-seq")&&!u.hasNewline&&s(u.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),c.contents=i?il.composeNode(l,i,u,s):il.composeEmptyNode(l,u.end,r,null,u,s);let d=c.contents.range[2],m=vh.resolveEnd(o,d,!1,s);return m.comment&&(c.comment=m.comment),c.range=[n,d,m.offset],c}ol.composeDoc=bh});var Wo=y(ll=>{"use strict";var Sh=Tn("process"),Ch=Si(),Eh=Xt(),rn=tn(),al=O(),_h=sl(),xh=Ct();function on(t){if(typeof t=="number")return[t,t+1];if(Array.isArray(t))return t.length===2?t:[t[0],t[1]];let{offset:e,source:n}=t;return[e,e+(typeof n=="string"?n.length:1)]}function cl(t){let e="",n=!1,r=!1;for(let i=0;i<t.length;++i){let o=t[i];switch(o[0]){case"#":e+=(e===""?"":r?`
|
|
103
103
|
|
|
104
104
|
`:`
|
|
105
|
-
`)+(o.substring(1)||" "),n=!0,r=!1;break;case"%":t[i+1]?.[0]!=="#"&&(i+=1),n=!1;break;default:n||(r=!0),n=!1}}return{comment:e,afterEmptyLine:r}}var
|
|
105
|
+
`)+(o.substring(1)||" "),n=!0,r=!1;break;case"%":t[i+1]?.[0]!=="#"&&(i+=1),n=!1;break;default:n||(r=!0),n=!1}}return{comment:e,afterEmptyLine:r}}var qo=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(n,r,i,o)=>{let s=on(n);o?this.warnings.push(new rn.YAMLWarning(s,r,i)):this.errors.push(new rn.YAMLParseError(s,r,i))},this.directives=new Ch.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,n){let{comment:r,afterEmptyLine:i}=cl(this.prelude);if(r){let o=e.contents;if(n)e.comment=e.comment?`${e.comment}
|
|
106
106
|
${r}`:r;else if(i||e.directives.docStart||!o)e.commentBefore=r;else if(al.isCollection(o)&&!o.flow&&o.items.length>0){let s=o.items[0];al.isPair(s)&&(s=s.key);let a=s.commentBefore;s.commentBefore=a?`${r}
|
|
107
107
|
${a}`:r}else{let s=o.commentBefore;o.commentBefore=s?`${r}
|
|
108
108
|
${s}`:r}}if(n){for(let o=0;o<this.errors.length;++o)e.errors.push(this.errors[o]);for(let o=0;o<this.warnings.length;++o)e.warnings.push(this.warnings[o])}else e.errors=this.errors,e.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:cl(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,n=!1,r=-1){for(let i of e)yield*this.next(i);yield*this.end(n,r)}*next(e){switch(Sh.env.LOG_STREAM&&console.dir(e,{depth:null}),e.type){case"directive":this.directives.add(e.source,(n,r,i)=>{let o=on(e);o[0]+=n,this.onError(o,"BAD_DIRECTIVE",r,i)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let n=_h.composeDoc(this.options,this.directives,e,this.onError);this.atDirectives&&!n.directives.docStart&&this.onError(e,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(n,!1),this.doc&&(yield this.doc),this.doc=n,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(e.source);break;case"error":{let n=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,r=new rn.YAMLParseError(on(e),"UNEXPECTED_TOKEN",n);this.atDirectives||!this.doc?this.errors.push(r):this.doc.errors.push(r);break}case"doc-end":{if(!this.doc){let r="Unexpected doc-end without preceding document";this.errors.push(new rn.YAMLParseError(on(e),"UNEXPECTED_TOKEN",r));break}this.doc.directives.docEnd=!0;let n=xh.resolveEnd(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),n.comment){let r=this.doc.comment;this.doc.comment=r?`${r}
|
|
109
|
-
${n.comment}`:n.comment}this.doc.range[2]=n.offset;break}default:this.errors.push(new rn.YAMLParseError(on(e),"UNEXPECTED_TOKEN",`Unsupported token ${e.type}`))}}*end(e=!1,n=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let r=Object.assign({_directives:this.directives},this.options),i=new Eh.Document(void 0,r);this.atDirectives&&this.onError(n,"MISSING_CHAR","Missing directives-end indicator line"),i.range=[0,n,n],this.decorate(i,!1),yield i}}};ll.Composer=
|
|
109
|
+
${n.comment}`:n.comment}this.doc.range[2]=n.offset;break}default:this.errors.push(new rn.YAMLParseError(on(e),"UNEXPECTED_TOKEN",`Unsupported token ${e.type}`))}}*end(e=!1,n=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let r=Object.assign({_directives:this.directives},this.options),i=new Eh.Document(void 0,r);this.atDirectives&&this.onError(n,"MISSING_CHAR","Missing directives-end indicator line"),i.range=[0,n,n],this.decorate(i,!1),yield i}}};ll.Composer=qo});var dl=y(Er=>{"use strict";var Ph=jo(),Rh=$o(),Oh=tn(),ul=Mt();function Ah(t,e=!0,n){if(t){let r=(i,o,s)=>{let a=typeof i=="number"?i:Array.isArray(i)?i[0]:i.offset;if(n)n(a,o,s);else throw new Oh.YAMLParseError([a,a+1],o,s)};switch(t.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return Rh.resolveFlowScalar(t,e,r);case"block-scalar":return Ph.resolveBlockScalar({options:{strict:e}},t,r)}}return null}function Nh(t,e){let{implicitKey:n=!1,indent:r,inFlow:i=!1,offset:o=-1,type:s="PLAIN"}=e,a=ul.stringifyString({type:s,value:t},{implicitKey:n,indent:r>0?" ".repeat(r):"",inFlow:i,options:{blockQuote:!0,lineWidth:-1}}),c=e.end??[{type:"newline",offset:-1,indent:r,source:`
|
|
110
110
|
`}];switch(a[0]){case"|":case">":{let l=a.indexOf(`
|
|
111
111
|
`),u=a.substring(0,l),d=a.substring(l+1)+`
|
|
112
112
|
`,m=[{type:"block-scalar-header",offset:o,indent:r,source:u}];return fl(m,c)||m.push({type:"newline",offset:-1,indent:r,source:`
|
|
113
|
-
`}),{type:"block-scalar",offset:o,indent:r,props:m,source:d}}case'"':return{type:"double-quoted-scalar",offset:o,indent:r,source:a,end:c};case"'":return{type:"single-quoted-scalar",offset:o,indent:r,source:a,end:c};default:return{type:"scalar",offset:o,indent:r,source:a,end:c}}}function jh(t,e,n={}){let{afterKey:r=!1,implicitKey:i=!1,inFlow:o=!1,type:s}=n,a="indent"in t?t.indent:null;if(r&&typeof a=="number"&&(a+=2),!s)switch(t.type){case"single-quoted-scalar":s="QUOTE_SINGLE";break;case"double-quoted-scalar":s="QUOTE_DOUBLE";break;case"block-scalar":{let l=t.props[0];if(l.type!=="block-scalar-header")throw new Error("Invalid block scalar header");s=l.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:s="PLAIN"}let c=ul.stringifyString({type:s,value:e},{implicitKey:i||a===null,indent:a!==null&&a>0?" ".repeat(a):"",inFlow:o,options:{blockQuote:!0,lineWidth:-1}});switch(c[0]){case"|":case">":Th(t,c);break;case'"':
|
|
113
|
+
`}),{type:"block-scalar",offset:o,indent:r,props:m,source:d}}case'"':return{type:"double-quoted-scalar",offset:o,indent:r,source:a,end:c};case"'":return{type:"single-quoted-scalar",offset:o,indent:r,source:a,end:c};default:return{type:"scalar",offset:o,indent:r,source:a,end:c}}}function jh(t,e,n={}){let{afterKey:r=!1,implicitKey:i=!1,inFlow:o=!1,type:s}=n,a="indent"in t?t.indent:null;if(r&&typeof a=="number"&&(a+=2),!s)switch(t.type){case"single-quoted-scalar":s="QUOTE_SINGLE";break;case"double-quoted-scalar":s="QUOTE_DOUBLE";break;case"block-scalar":{let l=t.props[0];if(l.type!=="block-scalar-header")throw new Error("Invalid block scalar header");s=l.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:s="PLAIN"}let c=ul.stringifyString({type:s,value:e},{implicitKey:i||a===null,indent:a!==null&&a>0?" ".repeat(a):"",inFlow:o,options:{blockQuote:!0,lineWidth:-1}});switch(c[0]){case"|":case">":Th(t,c);break;case'"':Fo(t,c,"double-quoted-scalar");break;case"'":Fo(t,c,"single-quoted-scalar");break;default:Fo(t,c,"scalar")}}function Th(t,e){let n=e.indexOf(`
|
|
114
114
|
`),r=e.substring(0,n),i=e.substring(n+1)+`
|
|
115
115
|
`;if(t.type==="block-scalar"){let o=t.props[0];if(o.type!=="block-scalar-header")throw new Error("Invalid block scalar header");o.source=r,t.source=i}else{let{offset:o}=t,s="indent"in t?t.indent:-1,a=[{type:"block-scalar-header",offset:o,indent:s,source:r}];fl(a,"end"in t?t.end:void 0)||a.push({type:"newline",offset:-1,indent:s,source:`
|
|
116
|
-
`});for(let c of Object.keys(t))c!=="type"&&c!=="offset"&&delete t[c];Object.assign(t,{type:"block-scalar",indent:s,props:a,source:i})}}function fl(t,e){if(e)for(let n of e)switch(n.type){case"space":case"comment":t.push(n);break;case"newline":return t.push(n),!0}return!1}function
|
|
117
|
-
`};delete t.items,Object.assign(t,{type:n,source:e,end:[i]});break}default:{let r="indent"in t?t.indent:-1,i="end"in t&&Array.isArray(t.end)?t.end.filter(o=>o.type==="space"||o.type==="comment"||o.type==="newline"):[];for(let o of Object.keys(t))o!=="type"&&o!=="offset"&&delete t[o];Object.assign(t,{type:n,indent:r,source:e,end:i})}}}Er.createScalarToken=Nh;Er.resolveAsScalar=
|
|
116
|
+
`});for(let c of Object.keys(t))c!=="type"&&c!=="offset"&&delete t[c];Object.assign(t,{type:"block-scalar",indent:s,props:a,source:i})}}function fl(t,e){if(e)for(let n of e)switch(n.type){case"space":case"comment":t.push(n);break;case"newline":return t.push(n),!0}return!1}function Fo(t,e,n){switch(t.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":t.type=n,t.source=e;break;case"block-scalar":{let r=t.props.slice(1),i=e.length;t.props[0].type==="block-scalar-header"&&(i-=t.props[0].source.length);for(let o of r)o.offset+=i;delete t.props,Object.assign(t,{type:n,source:e,end:r});break}case"block-map":case"block-seq":{let i={type:"newline",offset:t.offset+e.length,indent:t.indent,source:`
|
|
117
|
+
`};delete t.items,Object.assign(t,{type:n,source:e,end:[i]});break}default:{let r="indent"in t?t.indent:-1,i="end"in t&&Array.isArray(t.end)?t.end.filter(o=>o.type==="space"||o.type==="comment"||o.type==="newline"):[];for(let o of Object.keys(t))o!=="type"&&o!=="offset"&&delete t[o];Object.assign(t,{type:n,indent:r,source:e,end:i})}}}Er.createScalarToken=Nh;Er.resolveAsScalar=Ah;Er.setScalarValue=jh});var pl=y(ml=>{"use strict";var $h=t=>"type"in t?xr(t):_r(t);function xr(t){switch(t.type){case"block-scalar":{let e="";for(let n of t.props)e+=xr(n);return e+t.source}case"block-map":case"block-seq":{let e="";for(let n of t.items)e+=_r(n);return e}case"flow-collection":{let e=t.start.source;for(let n of t.items)e+=_r(n);for(let n of t.end)e+=n.source;return e}case"document":{let e=_r(t);if(t.end)for(let n of t.end)e+=n.source;return e}default:{let e=t.source;if("end"in t&&t.end)for(let n of t.end)e+=n.source;return e}}}function _r({start:t,key:e,sep:n,value:r}){let i="";for(let o of t)i+=o.source;if(e&&(i+=xr(e)),n)for(let o of n)i+=o.source;return r&&(i+=xr(r)),i}ml.stringify=$h});var yl=y(wl=>{"use strict";var Do=Symbol("break visit"),Ih=Symbol("skip children"),hl=Symbol("remove item");function it(t,e){"type"in t&&t.type==="document"&&(t={start:t.start,value:t.value}),gl(Object.freeze([]),t,e)}it.BREAK=Do;it.SKIP=Ih;it.REMOVE=hl;it.itemAtPath=(t,e)=>{let n=t;for(let[r,i]of e){let o=n?.[r];if(o&&"items"in o)n=o.items[i];else return}return n};it.parentCollection=(t,e)=>{let n=it.itemAtPath(t,e.slice(0,-1)),r=e[e.length-1][0],i=n?.[r];if(i&&"items"in i)return i;throw new Error("Parent collection not found")};function gl(t,e,n){let r=n(e,t);if(typeof r=="symbol")return r;for(let i of["key","value"]){let o=e[i];if(o&&"items"in o){for(let s=0;s<o.items.length;++s){let a=gl(Object.freeze(t.concat([[i,s]])),o.items[s],n);if(typeof a=="number")s=a-1;else{if(a===Do)return Do;a===hl&&(o.items.splice(s,1),s-=1)}}typeof r=="function"&&i==="key"&&(r=r(e,t))}}return typeof r=="function"?r(e,t):r}wl.visit=it});var Pr=y(ee=>{"use strict";var Mo=dl(),Lh=pl(),qh=yl(),Bo="\uFEFF",Ko="",Uo="",Ho="",Wh=t=>!!t&&"items"in t,Fh=t=>!!t&&(t.type==="scalar"||t.type==="single-quoted-scalar"||t.type==="double-quoted-scalar"||t.type==="block-scalar");function Dh(t){switch(t){case Bo:return"<BOM>";case Ko:return"<DOC>";case Uo:return"<FLOW_END>";case Ho:return"<SCALAR>";default:return JSON.stringify(t)}}function Mh(t){switch(t){case Bo:return"byte-order-mark";case Ko:return"doc-mode";case Uo:return"flow-error-end";case Ho:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
|
|
118
118
|
`:case`\r
|
|
119
|
-
`:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(t[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}ee.createScalarToken=
|
|
119
|
+
`:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(t[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}ee.createScalarToken=Mo.createScalarToken;ee.resolveAsScalar=Mo.resolveAsScalar;ee.setScalarValue=Mo.setScalarValue;ee.stringify=Lh.stringify;ee.visit=qh.visit;ee.BOM=Bo;ee.DOCUMENT=Ko;ee.FLOW_END=Uo;ee.SCALAR=Ho;ee.isCollection=Wh;ee.isScalar=Fh;ee.prettyToken=Dh;ee.tokenType=Mh});var Jo=y(kl=>{"use strict";var sn=Pr();function le(t){switch(t){case void 0:case" ":case`
|
|
120
120
|
`:case"\r":case" ":return!0;default:return!1}}var vl=new Set("0123456789ABCDEFabcdef"),Bh=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),Rr=new Set(",[]{}"),Kh=new Set(` ,[]{}
|
|
121
|
-
\r `),
|
|
121
|
+
\r `),Yo=t=>!t||Kh.has(t),Vo=class{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(e,n=!1){if(e){if(typeof e!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+e:e,this.lineEndPos=null}this.atEnd=!n;let r=this.next??"stream";for(;r&&(n||this.hasChars(1));)r=yield*this.parseNext(r)}atLineEnd(){let e=this.pos,n=this.buffer[e];for(;n===" "||n===" ";)n=this.buffer[++e];return!n||n==="#"||n===`
|
|
122
122
|
`?!0:n==="\r"?this.buffer[e+1]===`
|
|
123
123
|
`:!1}charAt(e){return this.buffer[this.pos+e]}continueScalar(e){let n=this.buffer[e];if(this.indentNext>0){let r=0;for(;n===" ";)n=this.buffer[++r+e];if(n==="\r"){let i=this.buffer[r+e+1];if(i===`
|
|
124
124
|
`||!i&&!this.atEnd)return e+r+1}return n===`
|
|
125
125
|
`||r>=this.indentNext||!n&&!this.atEnd?e+r:-1}if(n==="-"||n==="."){let r=this.buffer.substr(e,3);if((r==="---"||r==="...")&&le(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;return(typeof e!="number"||e!==-1&&e<this.pos)&&(e=this.buffer.indexOf(`
|
|
126
|
-
`,this.pos),this.lineEndPos=e),e===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[e-1]==="\r"&&(e-=1),this.buffer.substring(this.pos,e))}hasChars(e){return this.pos+e<=this.buffer.length}setNext(e){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=e,null}peek(e){return this.buffer.substr(this.pos,e)}*parseNext(e){switch(e){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let e=this.getLine();if(e===null)return this.setNext("stream");if(e[0]===sn.BOM&&(yield*this.pushCount(1),e=e.substring(1)),e[0]==="%"){let n=e.length,r=e.indexOf("#");for(;r!==-1;){let o=e[r-1];if(o===" "||o===" "){n=r-1;break}else r=e.indexOf("#",r+1)}for(;;){let o=e[n-1];if(o===" "||o===" ")n-=1;else break}let i=(yield*this.pushCount(n))+(yield*this.pushSpaces(!0));return yield*this.pushCount(e.length-i),this.pushNewline(),"stream"}if(this.atLineEnd()){let n=yield*this.pushSpaces(!0);return yield*this.pushCount(e.length-n),yield*this.pushNewline(),"stream"}return yield sn.DOCUMENT,yield*this.parseLineStart()}*parseLineStart(){let e=this.charAt(0);if(!e&&!this.atEnd)return this.setNext("line-start");if(e==="-"||e==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");let n=this.peek(3);if((n==="---"||n==="...")&&le(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,n==="---"?"doc":"stream"}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!le(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[e,n]=this.peek(2);if(!n&&!this.atEnd)return this.setNext("block-start");if((e==="-"||e==="?"||e===":")&&le(n)){let r=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=r,"block-start"}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let e=this.getLine();if(e===null)return this.setNext("doc");let n=yield*this.pushIndicators();switch(e[n]){case"#":yield*this.pushCount(e.length-n);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(
|
|
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]===sn.BOM&&(yield*this.pushCount(1),e=e.substring(1)),e[0]==="%"){let n=e.length,r=e.indexOf("#");for(;r!==-1;){let o=e[r-1];if(o===" "||o===" "){n=r-1;break}else r=e.indexOf("#",r+1)}for(;;){let o=e[n-1];if(o===" "||o===" ")n-=1;else break}let i=(yield*this.pushCount(n))+(yield*this.pushSpaces(!0));return yield*this.pushCount(e.length-i),this.pushNewline(),"stream"}if(this.atLineEnd()){let n=yield*this.pushSpaces(!0);return yield*this.pushCount(e.length-n),yield*this.pushNewline(),"stream"}return yield sn.DOCUMENT,yield*this.parseLineStart()}*parseLineStart(){let e=this.charAt(0);if(!e&&!this.atEnd)return this.setNext("line-start");if(e==="-"||e==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");let n=this.peek(3);if((n==="---"||n==="...")&&le(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,n==="---"?"doc":"stream"}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!le(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[e,n]=this.peek(2);if(!n&&!this.atEnd)return this.setNext("block-start");if((e==="-"||e==="?"||e===":")&&le(n)){let r=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=r,"block-start"}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let e=this.getLine();if(e===null)return this.setNext("doc");let n=yield*this.pushIndicators();switch(e[n]){case"#":yield*this.pushCount(e.length-n);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(Yo),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return n+=yield*this.parseBlockScalarHeader(),n+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-n),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,n,r=-1;do e=yield*this.pushNewline(),e>0?(n=yield*this.pushSpaces(!1),this.indentValue=r=n):n=0,n+=yield*this.pushSpaces(!0);while(e+n>0);let i=this.getLine();if(i===null)return this.setNext("flow");if((r!==-1&&r<this.indentNext&&i[0]!=="#"||r===0&&(i.startsWith("---")||i.startsWith("..."))&&le(i[3]))&&!(r===this.indentNext-1&&this.flowLevel===1&&(i[0]==="]"||i[0]==="}")))return this.flowLevel=0,yield sn.FLOW_END,yield*this.parseLineStart();let o=0;for(;i[o]===",";)o+=yield*this.pushCount(1),o+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(o+=yield*this.pushIndicators(),i[o]){case void 0:return"flow";case"#":return yield*this.pushCount(i.length-o),"flow";case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel+=1,"flow";case"}":case"]":return yield*this.pushCount(1),this.flowKey=!0,this.flowLevel-=1,this.flowLevel?"flow":"doc";case"*":return yield*this.pushUntil(Yo),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let s=this.charAt(1);if(this.flowKey||le(s)||s===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let e=this.charAt(0),n=this.buffer.indexOf(e,this.pos+1);if(e==="'")for(;n!==-1&&this.buffer[n+1]==="'";)n=this.buffer.indexOf("'",n+2);else for(;n!==-1;){let o=0;for(;this.buffer[n-1-o]==="\\";)o+=1;if(o%2===0)break;n=this.buffer.indexOf('"',n+1)}let r=this.buffer.substring(0,n),i=r.indexOf(`
|
|
127
127
|
`,this.pos);if(i!==-1){for(;i!==-1;){let o=this.continueScalar(i+1);if(o===-1)break;i=r.indexOf(`
|
|
128
128
|
`,o)}i!==-1&&(n=i-(r[i-1]==="\r"?2:1))}if(n===-1){if(!this.atEnd)return this.setNext("quoted-scalar");n=this.buffer.length}return yield*this.pushToIndex(n+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let e=this.pos;for(;;){let n=this.buffer[++e];if(n==="+")this.blockScalarKeep=!0;else if(n>"0"&&n<="9")this.blockScalarIndent=Number(n)-1;else if(n!=="-")break}return yield*this.pushUntil(n=>le(n)||n==="#")}*parseBlockScalar(){let e=this.pos-1,n=0,r;e:for(let o=this.pos;r=this.buffer[o];++o)switch(r){case" ":n+=1;break;case`
|
|
129
129
|
`:e=o,n=0;break;case"\r":{let s=this.buffer[o+1];if(!s&&!this.atEnd)return this.setNext("block-scalar");if(s===`
|
|
@@ -133,40 +133,40 @@ ${n.comment}`:n.comment}this.doc.range[2]=n.offset;break}default:this.errors.pus
|
|
|
133
133
|
`&&o>=this.pos&&o+1+n>a)e=o;else break}while(!0);return yield sn.SCALAR,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,n=this.pos-1,r=this.pos-1,i;for(;i=this.buffer[++r];)if(i===":"){let o=this.buffer[r+1];if(le(o)||e&&Rr.has(o))break;n=r}else if(le(i)){let o=this.buffer[r+1];if(i==="\r"&&(o===`
|
|
134
134
|
`?(r+=1,i=`
|
|
135
135
|
`,o=this.buffer[r+1]):n=r),o==="#"||e&&Rr.has(o))break;if(i===`
|
|
136
|
-
`){let s=this.continueScalar(r+1);if(s===-1)break;r=Math.max(r,s-2)}}else{if(e&&Rr.has(i))break;n=r}return!i&&!this.atEnd?this.setNext("plain-scalar"):(yield sn.SCALAR,yield*this.pushToIndex(n+1,!0),e?"flow":"doc")}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,n){let r=this.buffer.slice(this.pos,e);return r?(yield r,this.pos+=r.length,r.length):(n&&(yield""),0)}*pushIndicators(){let e=0;e:for(;;){switch(this.charAt(0)){case"!":e+=yield*this.pushTag(),e+=yield*this.pushSpaces(!0);continue e;case"&":e+=yield*this.pushUntil(
|
|
136
|
+
`){let s=this.continueScalar(r+1);if(s===-1)break;r=Math.max(r,s-2)}}else{if(e&&Rr.has(i))break;n=r}return!i&&!this.atEnd?this.setNext("plain-scalar"):(yield sn.SCALAR,yield*this.pushToIndex(n+1,!0),e?"flow":"doc")}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,n){let r=this.buffer.slice(this.pos,e);return r?(yield r,this.pos+=r.length,r.length):(n&&(yield""),0)}*pushIndicators(){let e=0;e:for(;;){switch(this.charAt(0)){case"!":e+=yield*this.pushTag(),e+=yield*this.pushSpaces(!0);continue e;case"&":e+=yield*this.pushUntil(Yo),e+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let n=this.flowLevel>0,r=this.charAt(1);if(le(r)||n&&Rr.has(r)){n?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,e+=yield*this.pushCount(1),e+=yield*this.pushSpaces(!0);continue e}}}break e}return e}*pushTag(){if(this.charAt(1)==="<"){let e=this.pos+2,n=this.buffer[e];for(;!le(n)&&n!==">";)n=this.buffer[++e];return yield*this.pushToIndex(n===">"?e+1:e,!1)}else{let e=this.pos+1,n=this.buffer[e];for(;n;)if(Bh.has(n))n=this.buffer[++e];else if(n==="%"&&vl.has(this.buffer[e+1])&&vl.has(this.buffer[e+2]))n=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){let e=this.buffer[this.pos];return e===`
|
|
137
137
|
`?yield*this.pushCount(1):e==="\r"&&this.charAt(1)===`
|
|
138
|
-
`?yield*this.pushCount(2):0}*pushSpaces(e){let n=this.pos-1,r;do r=this.buffer[++n];while(r===" "||e&&r===" ");let i=n-this.pos;return i>0&&(yield this.buffer.substr(this.pos,i),this.pos=n),i}*pushUntil(e){let n=this.pos,r=this.buffer[n];for(;!e(r);)r=this.buffer[++n];return yield*this.pushToIndex(n,!1)}};kl.Lexer=
|
|
138
|
+
`?yield*this.pushCount(2):0}*pushSpaces(e){let n=this.pos-1,r;do r=this.buffer[++n];while(r===" "||e&&r===" ");let i=n-this.pos;return i>0&&(yield this.buffer.substr(this.pos,i),this.pos=n),i}*pushUntil(e){let n=this.pos,r=this.buffer[n];for(;!e(r);)r=this.buffer[++n];return yield*this.pushToIndex(n,!1)}};kl.Lexer=Vo});var zo=y(bl=>{"use strict";var Go=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let n=0,r=this.lineStarts.length;for(;n<r;){let o=n+r>>1;this.lineStarts[o]<e?n=o+1:r=o}if(this.lineStarts[n]===e)return{line:n+1,col:1};if(n===0)return{line:0,col:e};let i=this.lineStarts[n-1];return{line:n,col:e-i+1}}}};bl.LineCounter=Go});var Xo=y(xl=>{"use strict";var Uh=Tn("process"),Sl=Pr(),Hh=Jo();function $e(t,e){for(let n=0;n<t.length;++n)if(t[n].type===e)return!0;return!1}function Cl(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 _l(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 Or(t){switch(t.type){case"document":return t.start;case"block-map":{let e=t.items[t.items.length-1];return e.sep??e.start}case"block-seq":return t.items[t.items.length-1].start;default:return[]}}function Et(t){if(t.length===0)return[];let e=t.length;e:for(;--e>=0;)switch(t[e].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;t[++e]?.type==="space";);return t.splice(e,t.length)}function Ar(t,e){if(e.length<1e5)Array.prototype.push.apply(t,e);else for(let n=0;n<e.length;++n)t.push(e[n])}function El(t){if(t.start.type==="flow-seq-start")for(let e of t.items)e.sep&&!e.value&&!$e(e.start,"explicit-key-ind")&&!$e(e.sep,"map-value-ind")&&(e.key&&(e.value=e.key),delete e.key,_l(e.value)?e.value.end?Ar(e.value.end,e.sep):e.value.end=e.sep:Ar(e.start,e.sep),delete e.sep)}var Qo=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 Hh.Lexer,this.onNewLine=e}*parse(e,n=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let r of this.lexer.lex(e,n))yield*this.next(r);n||(yield*this.end())}*next(e){if(this.source=e,Uh.env.LOG_TOKENS&&console.log("|",Sl.prettyToken(e)),this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}let n=Sl.tokenType(e);if(n)if(n==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=n,yield*this.step(),n){case"newline":this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+e.length);break;case"space":this.atNewLine&&e[0]===" "&&(this.indent+=e.length);break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":this.atNewLine&&(this.indent+=e.length);break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=e.length}else{let r=`Not a YAML token: ${e}`;yield*this.pop({type:"error",offset:this.offset,message:r,source:e}),this.offset+=e.length}}*end(){for(;this.stack.length>0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let e=this.peek(1);if(this.type==="doc-end"&&e?.type!=="doc-end"){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!e)return yield*this.stream();switch(e.type){case"document":return yield*this.document(e);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(e);case"block-scalar":return yield*this.blockScalar(e);case"block-map":return yield*this.blockMap(e);case"block-seq":return yield*this.blockSequence(e);case"flow-collection":return yield*this.flowCollection(e);case"doc-end":return yield*this.documentEnd(e)}yield*this.pop()}peek(e){return this.stack[this.stack.length-e]}*pop(e){let n=e??this.stack.pop();if(!n)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield n;else{let r=this.peek(1);switch(n.type==="block-scalar"?n.indent="indent"in r?r.indent:0:n.type==="flow-collection"&&r.type==="document"&&(n.indent=0),n.type==="flow-collection"&&El(n),r.type){case"document":r.value=n;break;case"block-scalar":r.props.push(n);break;case"block-map":{let i=r.items[r.items.length-1];if(i.value){r.items.push({start:[],key:n,sep:[]}),this.onKeyLine=!0;return}else if(i.sep)i.value=n;else{Object.assign(i,{key:n,sep:[]}),this.onKeyLine=!i.explicitKey;return}break}case"block-seq":{let i=r.items[r.items.length-1];i.value?r.items.push({start:[],value:n}):i.value=n;break}case"flow-collection":{let i=r.items[r.items.length-1];!i||i.value?r.items.push({start:[],key:n,sep:[]}):i.sep?i.value=n:Object.assign(i,{key:n,sep:[]});return}default:yield*this.pop(),yield*this.pop(n)}if((r.type==="document"||r.type==="block-map"||r.type==="block-seq")&&(n.type==="block-map"||n.type==="block-seq")){let i=n.items[n.items.length-1];i&&!i.sep&&!i.value&&i.start.length>0&&Cl(i.start)===-1&&(n.indent===0||i.start.every(o=>o.type!=="comment"||o.indent<n.indent))&&(r.type==="document"?r.end=i.start:r.items.push({start:i.start}),n.items.splice(-1,1))}}}*stream(){switch(this.type){case"directive-line":yield{type:"directive",offset:this.offset,source:this.source};return;case"byte-order-mark":case"space":case"comment":case"newline":yield this.sourceToken;return;case"doc-mode":case"doc-start":{let e={type:"document",offset:this.offset,start:[]};this.type==="doc-start"&&e.start.push(this.sourceToken),this.stack.push(e);return}}yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(e){if(e.value)return yield*this.lineEnd(e);switch(this.type){case"doc-start":{Cl(e.start)!==-1?(yield*this.pop(),yield*this.step()):e.start.push(this.sourceToken);return}case"anchor":case"tag":case"space":case"comment":case"newline":e.start.push(this.sourceToken);return}let n=this.startBlockValue(e);n?this.stack.push(n):yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(e){if(this.type==="map-value-ind"){let n=Or(this.peek(2)),r=Et(n),i;e.end?(i=e.end,i.push(this.sourceToken),delete e.end):i=[this.sourceToken];let o={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:r,key:e,sep:i}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=o}else yield*this.lineEnd(e)}*blockScalar(e){switch(this.type){case"space":case"comment":case"newline":e.props.push(this.sourceToken);return;case"scalar":if(e.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let n=this.source.indexOf(`
|
|
139
139
|
`)+1;for(;n!==0;)this.onNewLine(this.offset+n),n=this.source.indexOf(`
|
|
140
|
-
`,n)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let n=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,n.value){let r="end"in n.value?n.value.end:void 0;(Array.isArray(r)?r[r.length-1]:void 0)?.type==="comment"?r?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)e.items.push({start:[this.sourceToken]});else if(n.sep)n.sep.push(this.sourceToken);else{if(this.atIndentedComment(n.start,e.indent)){let i=e.items[e.items.length-2]?.value?.end;if(Array.isArray(i)){
|
|
140
|
+
`,n)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let n=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,n.value){let r="end"in n.value?n.value.end:void 0;(Array.isArray(r)?r[r.length-1]:void 0)?.type==="comment"?r?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)e.items.push({start:[this.sourceToken]});else if(n.sep)n.sep.push(this.sourceToken);else{if(this.atIndentedComment(n.start,e.indent)){let i=e.items[e.items.length-2]?.value?.end;if(Array.isArray(i)){Ar(i,n.start),i.push(this.sourceToken),e.items.pop();return}}n.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let r=!this.onKeyLine&&this.indent===e.indent,i=r&&(n.sep||n.explicitKey)&&this.type!=="seq-item-ind",o=[];if(i&&n.sep&&!n.value){let s=[];for(let a=0;a<n.sep.length;++a){let c=n.sep[a];switch(c.type){case"newline":s.push(a);break;case"space":break;case"comment":c.indent>e.indent&&(s.length=0);break;default:s.length=0}}s.length>=2&&(o=n.sep.splice(s[1]))}switch(this.type){case"anchor":case"tag":i||n.value?(o.push(this.sourceToken),e.items.push({start:o}),this.onKeyLine=!0):n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"explicit-key-ind":!n.sep&&!n.explicitKey?(n.start.push(this.sourceToken),n.explicitKey=!0):i||n.value?(o.push(this.sourceToken),e.items.push({start:o,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(n.explicitKey)if(n.sep)if(n.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if($e(n.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]});else if(_l(n.key)&&!$e(n.sep,"newline")){let s=Et(n.start),a=n.key,c=n.sep;c.push(this.sourceToken),delete n.key,delete n.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:a,sep:c}]})}else o.length>0?n.sep=n.sep.concat(o,this.sourceToken):n.sep.push(this.sourceToken);else if($e(n.start,"newline"))Object.assign(n,{key:null,sep:[this.sourceToken]});else{let s=Et(n.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:null,sep:[this.sourceToken]}]})}else n.sep?n.value||i?e.items.push({start:o,key:null,sep:[this.sourceToken]}):$e(n.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):n.sep.push(this.sourceToken):Object.assign(n,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let s=this.flowScalar(this.type);i||n.value?(e.items.push({start:o,key:s,sep:[]}),this.onKeyLine=!0):n.sep?this.stack.push(s):(Object.assign(n,{key:s,sep:[]}),this.onKeyLine=!0);return}default:{let s=this.startBlockValue(e);if(s){if(s.type==="block-seq"){if(!n.explicitKey&&n.sep&&!$e(n.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else r&&e.items.push({start:o});this.stack.push(s);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let n=e.items[e.items.length-1];switch(this.type){case"newline":if(n.value){let r="end"in n.value?n.value.end:void 0;(Array.isArray(r)?r[r.length-1]:void 0)?.type==="comment"?r?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(n.start,e.indent)){let i=e.items[e.items.length-2]?.value?.end;if(Array.isArray(i)){Ar(i,n.start),i.push(this.sourceToken),e.items.pop();return}}n.start.push(this.sourceToken)}return;case"anchor":case"tag":if(n.value||this.indent<=e.indent)break;n.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;n.value||$e(n.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return}if(this.indent>e.indent){let r=this.startBlockValue(e);if(r){this.stack.push(r);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let n=e.items[e.items.length-1];if(this.type==="flow-error-end"){let r;do yield*this.pop(),r=this.peek(1);while(r?.type==="flow-collection")}else if(e.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!n||n.sep?e.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return;case"map-value-ind":!n||n.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):n.sep?n.sep.push(this.sourceToken):Object.assign(n,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!n||n.value?e.items.push({start:[this.sourceToken]}):n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let i=this.flowScalar(this.type);!n||n.value?e.items.push({start:[],key:i,sep:[]}):n.sep?this.stack.push(i):Object.assign(n,{key:i,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}let r=this.startBlockValue(e);r?this.stack.push(r):(yield*this.pop(),yield*this.step())}else{let r=this.peek(2);if(r.type==="block-map"&&(this.type==="map-value-ind"&&r.indent===e.indent||this.type==="newline"&&!r.items[r.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&r.type!=="flow-collection"){let i=Or(r),o=Et(i);El(e);let s=e.end.splice(1,e.end.length);s.push(this.sourceToken);let a={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:o,key:e,sep:s}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=a}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let n=this.source.indexOf(`
|
|
141
141
|
`)+1;for(;n!==0;)this.onNewLine(this.offset+n),n=this.source.indexOf(`
|
|
142
|
-
`,n)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let n=Ar(e),r=Ct(n);return r.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let n=Ar(e),r=Ct(n);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,n){return this.type!=="comment"||this.indent<=n?!1:e.every(r=>r.type==="newline"||r.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};xl.Parser=zo});var Nl=y(cn=>{"use strict";var Pl=qo(),Yh=Xt(),an=tn(),Vh=$i(),Jh=A(),Gh=Go(),Rl=Qo();function Al(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new Gh.LineCounter||null,prettyErrors:e}}function zh(t,e={}){let{lineCounter:n,prettyErrors:r}=Al(e),i=new Rl.Parser(n?.addNewLine),o=new Pl.Composer(e),s=Array.from(o.compose(i.parse(t)));if(r&&n)for(let a of s)a.errors.forEach(an.prettifyError(t,n)),a.warnings.forEach(an.prettifyError(t,n));return s.length>0?s:Object.assign([],{empty:!0},o.streamInfo())}function Ol(t,e={}){let{lineCounter:n,prettyErrors:r}=Al(e),i=new Rl.Parser(n?.addNewLine),o=new Pl.Composer(e),s=null;for(let a of o.compose(i.parse(t),!0,t.length))if(!s)s=a;else if(s.options.logLevel!=="silent"){s.errors.push(new an.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return r&&n&&(s.errors.forEach(an.prettifyError(t,n)),s.warnings.forEach(an.prettifyError(t,n))),s}function Qh(t,e,n){let r;typeof e=="function"?r=e:n===void 0&&e&&typeof e=="object"&&(n=e);let i=Ol(t,n);if(!i)return null;if(i.warnings.forEach(o=>Vh.warn(i.options.logLevel,o)),i.errors.length>0){if(i.options.logLevel!=="silent")throw i.errors[0];i.errors=[]}return i.toJS(Object.assign({reviver:r},n))}function Xh(t,e,n){let r=null;if(typeof e=="function"||Array.isArray(e)?r=e:n===void 0&&e&&(n=e),typeof n=="string"&&(n=n.length),typeof n=="number"){let i=Math.round(n);n=i<1?void 0:i>8?{indent:8}:{indent:i}}if(t===void 0){let{keepUndefined:i}=n??e??{};if(!i)return}return Jh.isDocument(t)&&!r?t.toString(n):new Yh.Document(t,r,n).toString(n)}cn.parse=Qh;cn.parseAllDocuments=zh;cn.parseDocument=Ol;cn.stringify=Xh});var Ie=y(O=>{"use strict";var Zh=qo(),eg=Xt(),tg=wo(),Xo=tn(),ng=Lt(),$e=A(),rg=Ae(),ig=q(),og=Ne(),sg=je(),ag=Pr(),cg=Vo(),lg=Go(),ug=Qo(),Nr=Nl(),jl=jt();O.Composer=Zh.Composer;O.Document=eg.Document;O.Schema=tg.Schema;O.YAMLError=Xo.YAMLError;O.YAMLParseError=Xo.YAMLParseError;O.YAMLWarning=Xo.YAMLWarning;O.Alias=ng.Alias;O.isAlias=$e.isAlias;O.isCollection=$e.isCollection;O.isDocument=$e.isDocument;O.isMap=$e.isMap;O.isNode=$e.isNode;O.isPair=$e.isPair;O.isScalar=$e.isScalar;O.isSeq=$e.isSeq;O.Pair=rg.Pair;O.Scalar=ig.Scalar;O.YAMLMap=og.YAMLMap;O.YAMLSeq=sg.YAMLSeq;O.CST=ag;O.Lexer=cg.Lexer;O.LineCounter=lg.LineCounter;O.Parser=ug.Parser;O.parse=Nr.parse;O.parseAllDocuments=Nr.parseAllDocuments;O.parseDocument=Nr.parseDocument;O.stringify=Nr.stringify;O.visit=jl.visit;O.visitAsync=jl.visitAsync});var $r=B(()=>{"use strict"});function Le(t){return t!==0&&t!==0n&&t!=="0"}function Il(t,e){return Le(t.dev)&&Le(e.dev)&&Le(t.ino)&&Le(e.ino)}function qe(t,e){let n=Le(t.dev)&&Le(e.dev);if(n&&t.dev!==e.dev)return!1;let r=Le(t.ino)&&Le(e.ino);return r&&t.ino!==e.ino?!1:n&&r?!0:t.birthtime===e.birthtime}var Ir=B(()=>{"use strict"});import{randomUUID as fg}from"crypto";import{constants as dg,promises as W}from"fs";import J from"path";async function ts(t,e){try{return await W.link(t,e),{linked:!0}}catch(n){let r=n.code;if(r!=="ENOTSUP"&&r!=="EOPNOTSUPP")throw n}return await W.copyFile(t,e,dg.COPYFILE_EXCL),{linked:!1}}function Et(t,e){let n=J.relative(t,e);return n===""||!J.isAbsolute(n)&&n!==".."&&!n.startsWith(`..${J.sep}`)}function Lr(t){return{dev:t.dev,ino:t.ino,birthtime:t.birthtimeMs}}function mg(t,e){return qe(t,Lr(e))}function es(t,e){return qe(Lr(t),Lr(e))}function Ll(t,e){return es(t,e)&&t.birthtimeMs===e.birthtimeMs&&t.ctimeMs===e.ctimeMs&&t.mtimeMs===e.mtimeMs&&t.size===e.size}async function qr(t){let e=await W.lstat(t);if(!e.isDirectory()||e.isSymbolicLink())throw new Error(`Contained atomic write parent must be a real directory: ${t}`);return{path:t,realPath:await W.realpath(t),...Lr(e)}}async function We(t){for(let e of t){let n=await W.lstat(e.path);if(!n.isDirectory()||n.isSymbolicLink()||!mg(e,n)||await W.realpath(e.path)!==e.realPath)throw new Error(`Contained atomic write parent changed before commit: ${e.path}`)}}async function pg(t,e){let n=J.resolve(t),r=J.resolve(e);if(!Et(n,r))throw new Error(`Contained atomic write parent is outside its managed root: ${e}`);let i=[await qr(n)],o=J.relative(n,r).split(J.sep).filter(Boolean),s=n;for(let a of o){await We(i),s=J.join(s,a);try{await W.mkdir(s)}catch(l){if(l.code!=="EEXIST")throw l}let c=await qr(s);if(!Et(i[0].realPath,c.realPath))throw new Error(`Contained atomic write parent resolves outside its managed root: ${s}`);i.push(c)}return await We(i),i}async function hg(t,e){let n=J.resolve(t),r=J.resolve(e);if(!Et(n,r))throw new Error(`Contained file parent is outside its managed root: ${e}`);let i=[await qr(n)],o=J.relative(n,r).split(J.sep).filter(Boolean),s=n;for(let a of o){s=J.join(s,a);try{let c=await qr(s);if(!Et(i[0].realPath,c.realPath))throw new Error(`Contained file parent resolves outside its managed root: ${s}`);i.push(c)}catch(c){if(c.code==="ENOENT")return null;throw c}}return await We(i),i}async function ql(t){let e;try{e=await W.open(t,"r"),await e.sync()}catch(n){let r=n.code;if(!["EACCES","EBADF","EINVAL","EISDIR","ENOTSUP","EPERM"].includes(r??""))throw n}finally{await e?.close()}}async function gg(t,e,n){let r=J.dirname(t),i=await pg(n.containedRoot,r),o=J.join(r,`.${J.basename(t)}.${fg()}.tmp`),s,a,c;try{await n.beforeTemporaryOpen?.(),s=await W.open(o,"wx"),a=await s.stat();let[l,u]=await Promise.all([W.lstat(o),W.realpath(o)]);if(await We(i),!l.isFile()||l.isSymbolicLink()||!es(a,l)||!Et(i[0].realPath,u))throw new Error("Contained atomic write temporary file opened outside its managed parent");if(typeof e=="string"?await s.writeFile(e,"utf8"):await s.writeFile(e),await s.sync(),c=await s.stat(),!es(a,c))throw new Error("Contained atomic write temporary file changed while writing");await s.close(),s=void 0,await n.beforeCommit?.(),await We(i);let d=await W.lstat(o);if(!d.isFile()||d.isSymbolicLink()||!c||!Ll(d,c))throw new Error("Contained atomic write temporary file changed before commit");n.exclusive?(await ts(o,t),await W.unlink(o)):await W.rename(o,t),await ql(r)}catch(l){await s?.close();try{await We(i),await W.rm(o,{force:!0})}catch{}throw l}}async function ue(t,e,n){await gg(t,e,n)}async function ns(t,e){let n=J.dirname(t),r=await hg(e.containedRoot,n);if(!r)return!1;let i,o;try{i=await W.lstat(t),o=await W.realpath(t)}catch(c){if(c.code==="ENOENT")return!1;throw c}if(!i.isFile()||i.isSymbolicLink()||!Et(r[0].realPath,o))throw new Error("Contained file removal target must be a regular file inside its managed root");await e.beforeRemove?.(),await We(r);let[s,a]=await Promise.all([W.lstat(t),W.realpath(t)]);if(!s.isFile()||s.isSymbolicLink()||!Ll(i,s)||a!==o)throw new Error("Contained file removal target changed before removal");return await W.unlink(t),await We(r),await ql(n),!0}var Me=B(()=>{"use strict";Ir()});var Wl=B(()=>{"use strict"});var rs=B(()=>{"use strict";$r()});var Ml=B(()=>{"use strict";$r();rs()});import De from"path";function xg(t,e){if(typeof t!="string")throw new Error(`${e} must be a string`);let n=t.trim();if(n.length===0||De.posix.isAbsolute(n)||De.win32.isAbsolute(n)||/^(?:~|[\\/])/u.test(n))throw new Error(`${e} must be a project-relative path`);if(n===".")return[];let r=n.replaceAll("\\","/").split("/");if(r.some(i=>i===".."))throw new Error(`${e} must stay inside the project root`);if(r.some(i=>i===""||i==="."))throw new Error(`${e} must not contain empty or dot path segments`);return r}function ln(t){let e=xg(t,"native.artifact_root");return e.length===0?".":e.join("/")}function Yl(t,e="docs"){let n=t??e;if(n!=="legacy"&&n!=="docs")throw new Error("classic.artifact_layout must be legacy or docs");return n}function Fe(t,e,n=!1){if(typeof t!="string")throw new Error(`${e} must be a string`);let r=t.trim().replaceAll("\\","/");if(r.length===0||De.posix.isAbsolute(r)||De.win32.isAbsolute(r)||/^(?:~|[\\/])/u.test(r))throw new Error(`${e} must be relative to its declared path base`);let i=r.split("/");if(i.some(o=>o===".."))throw new Error(`${e} must stay inside its declared path base`);if(i.some(o=>o===""||o==="."))throw new Error(`${e} must not contain empty or dot path segments`);if(!n&&/[*?]/u.test(r))throw new Error(`${e} cannot contain wildcards`);return i.join("/")}function ye(t,e){if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`${e} must be a mapping`);return t}function Vl(t,e,n){let r=t??e;if(r!=="en"&&r!=="zh-CN")throw new Error(`${n} must be en or zh-CN`);return r}function Jl(t,e){if(typeof t!="string"||t.length===0||t.includes("\\")||t.includes("\0")||t.startsWith("/")||t.split("/").includes(".."))throw new Error(`${e} contains an unsafe pattern`);if(t.length>os)throw new Error(`${e} exceeds ${os} characters`);let n=0;for(let r=0;r<t.length;r+=1)t[r]==="?"?n+=1:t[r]==="*"&&(n+=1,t[r+1]==="*"&&(r+=1));if(n>ss)throw new Error(`${e} contains more than ${ss} wildcard tokens`);return t}function Kl(t,e,n){if(t===void 0)return[...n];if(!Array.isArray(t))throw new Error(`${e} contains an unsafe pattern`);return[...new Set(t.map(r=>Jl(r,e)))].sort((r,i)=>r.localeCompare(i,"en"))}function is(t,e,n){let r=t??e;if(!Number.isSafeInteger(r)||r<1)throw new Error(`${n} must be a positive integer`);return r}function Pg(t){if(t===void 0)return{...oe,include:[...oe.include],exclude:[...oe.exclude]};let e=ye(t,"native.snapshot");return{include:Kl(e.include,"native.snapshot.include",oe.include),exclude:Kl(e.exclude,"native.snapshot.exclude",oe.exclude),max_files:is(e.max_files,oe.max_files,"native.snapshot.max_files"),max_total_bytes:is(e.max_total_bytes,oe.max_total_bytes,"native.snapshot.max_total_bytes"),max_duration_ms:is(e.max_duration_ms,oe.max_duration_ms,"native.snapshot.max_duration_ms")}}function Rg(t){if(t===void 0)return;let e=ye(t,"native.pending_root_move"),n=e.id,r=e.from_artifact_root,i=e.to_artifact_root,o=e.stage;if(typeof n!="string"||!/^[a-f0-9-]{8,}$/u.test(n))throw new Error("native.pending_root_move.id is invalid");if(typeof r!="string"||typeof i!="string")throw new Error("native.pending_root_move roots must be strings");if(o!=="copying"&&o!=="ready"&&o!=="switched")throw new Error("native.pending_root_move.stage is invalid");let s;if(e.cleanup!==void 0){let a=ye(e.cleanup,"native.pending_root_move.cleanup"),c=a.kind,l=a.state,u=a.manifest_hash;if(c!=="forward-source"&&c!=="restart-staging"&&c!=="rollback-destination"&&c!=="rollback-staging")throw new Error("native.pending_root_move.cleanup.kind is invalid");if(l!=="prepared"&&l!=="quarantined"&&l!=="deleting")throw new Error("native.pending_root_move.cleanup.state is invalid");if(typeof u!="string"||!/^[a-f0-9]{64}$/u.test(u))throw new Error("native.pending_root_move.cleanup.manifest_hash is invalid");s={kind:c,state:l,manifestHash:u}}return{id:n,fromArtifactRoot:ln(r),toArtifactRoot:ln(i),stage:o,...s?{cleanup:s}:{}}}function Ag(t){if(t===void 0)return;let e=ye(t,"native.finish");if(e.pull_request===void 0)return{};let n=ye(e.pull_request,"native.finish.pull_request");if(n.provider!=="repository-command")throw new Error("native.finish.pull_request.provider must be repository-command");if(!Array.isArray(n.command)||n.command.length===0)throw new Error("native.finish.pull_request.command must be a non-empty array");if(n.command.length>64)throw new Error("native.finish.pull_request.command must contain at most 64 arguments");let r=n.command.map((o,s)=>{if(typeof o!="string"||o.trim().length===0||o.length>4096||/[\0\r\n]/u.test(o))throw new Error(`native.finish.pull_request.command[${s}] must be a non-empty single-line string of at most 4096 characters`);return o});if(De.posix.isAbsolute(r[0])||De.win32.isAbsolute(r[0]))throw new Error("native.finish.pull_request.command[0] must be a bare executable name or a project-relative path");let i=n.timeout_ms??Sg;if(!Number.isSafeInteger(i)||i<1||i>Bl)throw new Error(`native.finish.pull_request.timeout_ms must be an integer between 1 and ${Bl}`);return{pull_request:{provider:"repository-command",command:r,timeout_ms:i}}}function Og(t,e={}){let n=ye(t,"native"),r=n.artifact_root??(e.allowMissingArtifactRoot?"docs":void 0);if(typeof r!="string")throw new Error("native.artifact_root must be a string");let i=n.clarification_mode??"batch";if(i!=="sequential"&&i!=="batch")throw new Error("native.clarification_mode must be sequential or batch");let o=n.archive_confirmation??"automatic";if(o!=="automatic"&&o!=="required")throw new Error("native.archive_confirmation must be automatic or required");let s=n.max_verify_failures??Ul;if(!Number.isSafeInteger(s)||s<1)throw new Error("native.max_verify_failures must be a positive integer");let a=Rg(n.pending_root_move),c=Ag(n.finish);return{artifact_root:ln(r),language:Vl(n.language,"en","native.language"),clarification_mode:i,archive_confirmation:o,max_verify_failures:s,snapshot:Pg(n.snapshot),...c?{finish:c}:{},...a?{pending_root_move:a}:{}}}function Ng(t){let e=ye(t,"classic"),n=e.context_compression??"off";if(n!=="off"&&n!=="beta")throw new Error("classic.context_compression must be off or beta");let r=e.review_mode??"standard";if(r!=="off"&&r!=="standard"&&r!=="thorough")throw new Error("classic.review_mode must be off, standard, or thorough");let i=e.auto_transition??!0;if(typeof i!="boolean")throw new Error("classic.auto_transition must be true or false");return{artifact_layout:Yl(e.artifact_layout),language:Vl(e.language,"zh-CN","classic.language"),context_compression:n,review_mode:r,auto_transition:i}}function jg(t){let n=ye(t,"hook").allow_paths??[];if(!Array.isArray(n))throw new Error("hook.allow_paths must be an array");return{allow_paths:[...new Set(n.map((r,i)=>Fe(r,`hook.allow_paths[${i}]`)))]}}function Tg(t){if(t===void 0)return{...Wr};let e=ye(t,"memory"),n=e.learning??Wr.learning,r=e.retrieval??Wr.retrieval;if(typeof n!="boolean")throw new Error("memory.learning must be true or false");if(typeof r!="boolean")throw new Error("memory.retrieval must be true or false");return{learning:n,retrieval:r}}function cs(t,e){if(t===null||typeof t!="object"||Array.isArray(t))throw new Error(`${e} must be a mapping`);return t}function $g(t,e){if(typeof t!="string")throw new Error(`${e} must be a string`);let n=t.trim();if(n.length===0||n.includes("\\")||n.includes("\0")||De.posix.isAbsolute(n)||De.win32.isAbsolute(n)||n.startsWith("~")||n.split("/").some(i=>i===""||i==="."||i===".."))throw new Error(`${e} must be a safe project-relative glob`);if(!n.toLowerCase().endsWith(".md"))throw new Error(`${e} must target a Markdown file ending in .md`);if(n.length>Dl)throw new Error(`${e} exceeds ${Dl} characters`);let r=0;for(let i=0;i<n.length;i+=1)n[i]==="?"?r+=1:n[i]==="*"&&(r+=1,n[i+1]==="*"&&(i+=1));if(r>Fl)throw new Error(`${e} contains more than ${Fl} wildcard tokens`);return n}function Ig(t){let n=cs(t,"knowledge.local").include??[];if(!Array.isArray(n))throw new Error("knowledge.local.include must be an array");return{include:[...new Set(n.map((r,i)=>$g(r,`knowledge.local.include[${i}]`)))]}}function Lg(t){if(typeof t!="string"||t.trim().length===0)throw new Error("knowledge.remote.endpoint must be a non-empty URL");let e;try{e=new URL(t)}catch{throw new Error("knowledge.remote.endpoint must be a valid URL")}let n=e.hostname.toLowerCase().replace(/^\[|\]$/gu,""),r=n==="localhost"||n==="127.0.0.1"||n==="::1";if(e.protocol!=="https:"&&!(e.protocol==="http:"&&r))throw new Error("knowledge.remote.endpoint must use HTTPS (HTTP is allowed for loopback)");return e.toString()}function qg(t){let e=cs(t,"knowledge.remote"),n=Lg(e.endpoint),r=e.token_env;if(r!==void 0&&(typeof r!="string"||!/^[A-Za-z_][A-Za-z0-9_]*$/u.test(r)))throw new Error("knowledge.remote.token_env must be an environment variable name");let i=e.scope;if(i!==void 0&&(typeof i!="string"||i.length>512))throw new Error("knowledge.remote.scope must be a string of at most 512 characters");let o=e.timeout_ms??5e3;if(typeof o!="number"||!Number.isSafeInteger(o)||o<100||o>3e4)throw new Error("knowledge.remote.timeout_ms must be an integer between 100 and 30000");return{endpoint:n,...r===void 0?{}:{token_env:r},...i===void 0?{}:{scope:i},timeout_ms:o}}function Wg(t){if(t===void 0)return{...Hl};let e=cs(t,"knowledge"),n=e.provider??"local";if(n!=="local"&&n!=="remote")throw new Error("knowledge.provider must be local or remote");let r=e.local===void 0?void 0:Ig(e.local);if(n==="local")return{provider:n,...r?{local:r}:{}};let i=e.remote===void 0?void 0:qg(e.remote);if(i===void 0)throw new Error("knowledge.remote must be configured when knowledge.provider is remote");return{provider:n,...r?{local:r}:{},remote:i}}function Mg(t){let e=t??!0;if(typeof e!="boolean")throw new Error("ambient_resume must be true or false");return e}function Dg(t,e,n,r,i,o,s,a){let c=t.schema!==void 0;if(!(c||t.default_workflow!==void 0||t.workflows!==void 0||!a.allowPartialProject&&t.native!==void 0)||a.allowPartialProject&&!c)return null;if(t.schema!=="comet.project.v1")throw new Error("Unsupported Comet project schema");if(t.default_workflow!=="native"&&t.default_workflow!=="classic")throw new Error("default_workflow must be native or classic");let u=t.workflows??[t.default_workflow];if(!Array.isArray(u)||u.length===0||u.some(m=>m!=="native"&&m!=="classic"))throw new Error("workflows must contain native and/or classic");let d=[...new Set(u)];if(!d.includes(t.default_workflow))throw new Error("workflows must include default_workflow");if(d.includes("native")&&!i)throw new Error("native must be a mapping");return{schema:"comet.project.v1",default_workflow:t.default_workflow,workflows:d,ambient_resume:s,...e?{hook:e}:{},memory:n,knowledge:r,...i?{native:i}:{},...o?{classic:o}:{}}}function Be(t,e={}){let n=(0,as.parseDocument)(t,{uniqueKeys:!0});if(n.errors.length>0)throw new Error(`Invalid .comet/config.yaml: ${n.errors[0].message}`);let r=n.toJS();if(r==null)return{value:{},config:null,ambient_resume:!0};if(typeof r!="object"||Array.isArray(r))throw new Error("Invalid .comet/config.yaml: root must be a mapping");let i=r,o=Mg(i.ambient_resume),s=i.hook===void 0?void 0:jg(i.hook),a=Tg(i.memory),c=Wg(i.knowledge),l=i.native===void 0?void 0:Og(i.native,{allowMissingArtifactRoot:e.allowMissingNativeFields}),u=i.classic===void 0?void 0:Ng(i.classic),d=Dg(i,s,a,c,l,u,o,{allowPartialProject:e.allowPartialProject??!1});return{value:i,config:d,ambient_resume:o,memory:a,knowledge:c,...s?{hook:s}:{},...l?{native:l}:{},...u?{classic:u}:{}}}function ls(t="docs",e="en"){return{schema:"comet.project.v1",default_workflow:"native",ambient_resume:!0,memory:{...Wr},knowledge:{...Hl},native:{artifact_root:ln(t),language:e,clarification_mode:"batch",archive_confirmation:"automatic",max_verify_failures:Ul,snapshot:{...oe,include:[...oe.include],exclude:[...oe.exclude]}}}}var as,_t,os,ss,Dl,Fl,Ul,Wr,Hl,Sg,Bl,Cg,Eg,_g,oe,ve=B(()=>{"use strict";as=Xe(Ie(),1),_t=64*1024,os=1024,ss=64,Dl=1024,Fl=64,Ul=5,Wr={learning:!0,retrieval:!0},Hl={provider:"local"},Sg=12e4,Bl=6e5,Cg=[".agents/skills/**",".amazonq/skills/**",".augment/skills/**",".bob/skills/**",".claude/skills/**",".cline/skills/**",".codebuddy/skills/**",".workbuddy/skills/**",".continue/skills/**",".cospec/skills/**",".crush/skills/**",".cursor/skills/**",".dsh/skills/**",".factory/skills/**",".forge/skills/**",".gemini/skills/**",".github/skills/**",".grok/skills/**",".iflow/skills/**",".junie/skills/**",".kilocode/skills/**",".kimi-code/skills/**",".kiro/skills/**",".lingma/skills/**",".mimocode/skills/**",".opencode/skills/**",".omp/skills/**",".pi/skills/**",".qoder/skills/**",".qwen/skills/**",".roo/skills/**",".trae-cn/skills/**",".trae/skills/**",".windsurf/skills/**",".zcode/skills/**"],Eg=["**/.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"],_g=[...Cg,...Eg].sort((t,e)=>t.localeCompare(e,"en")),oe={include:["**/*"],exclude:[..._g],max_files:1e4,max_total_bytes:256*1024*1024,max_duration_ms:6e4}});import{constants as Mr,promises as ot}from"fs";function us(t){return"birthtimeNs"in t&&typeof t.birthtimeNs=="bigint"?t.birthtimeNs:t.birthtimeMs}function Gl(t){return"ctimeNs"in t&&typeof t.ctimeNs=="bigint"?t.ctimeNs:t.ctimeMs}function un(t){return{dev:t.dev,ino:t.ino,birthtime:us(t)}}function Dr(t,e){let n=un(t),r=un(e);return Il(n,r)?qe(n,r):qe(n,r)&&us(t)===us(e)&&Gl(t)===Gl(e)&&t.size===e.size}async function zl(t,e,n={}){if(!Number.isSafeInteger(e)||e<1)throw new Error("race-safe read byte limit must be a positive integer");let r=n.label??"file",i=n.bigint===!0,o=await ot.lstat(t,{bigint:i});if(!o.isFile()||o.isSymbolicLink())throw new Ke("not-regular-file",`${r} must be a regular file`);if(BigInt(o.size)>BigInt(e))throw new Ke("too-large",`${r} exceeds ${e} bytes`);let s=await ot.realpath(t);await n.verify?.("pre-open",{realPath:s,identity:un(o)});let a=process.platform==="win32"?Mr.O_RDONLY:Mr.O_RDONLY|Mr.O_NOFOLLOW|Mr.O_NONBLOCK,c;try{c=await ot.open(t,a)}catch(l){throw l.code==="ELOOP"?new Ke("not-regular-file",`${r} must be a regular file`,{cause:l}):l}try{let[l,u,d]=await Promise.all([c.stat({bigint:i}),ot.lstat(t,{bigint:i}),ot.realpath(t)]);if(!l.isFile()||!u.isFile()||u.isSymbolicLink()||d!==s||!Dr(o,l)||!Dr(o,u))throw new Ke("changed",`${r} changed while opening`);await n.verify?.("post-open",{realPath:d,identity:un(l)}),await n.hooks?.afterOpen?.();let m=[],h=0,g=Buffer.allocUnsafe(Math.min(64*1024,e+1));for(;;){let v=e+1-h,{bytesRead:b}=await c.read(g,0,Math.min(g.length,v),null);if(b===0)break;if(h+=b,h>e)throw new Ke("too-large",`${r} exceeds ${e} bytes`);m.push(Buffer.from(g.subarray(0,b)))}await n.hooks?.beforeFinalCheck?.();let[f,p,w]=await Promise.all([c.stat({bigint:i}),ot.lstat(t,{bigint:i}),ot.realpath(t)]);if(!p.isFile()||p.isSymbolicLink()||w!==s||!Dr(o,f)||!Dr(o,p))throw new Ke("changed",`${r} changed while reading`);return await n.verify?.("post-read",{realPath:w,identity:un(f)}),{bytes:Buffer.concat(m,h),stat:f,realPath:w}}finally{await c.close()}}var Ke,Ql=B(()=>{"use strict";Ir();Ke=class extends Error{reason;constructor(e,n,r){super(n,r),this.name="RaceSafeReadError",this.reason=e}}});import{promises as Fr}from"fs";import Ue from"path";function Fg(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}function fs(t,e){let n=Ue.relative(t,e);return n===""||!Ue.isAbsolute(n)&&n!==".."&&!n.startsWith(`..${Ue.sep}`)}async function Xl(t,e){let n=Ue.resolve(t),r=await Fr.lstat(n);if(!r.isDirectory()||r.isSymbolicLink())throw new Error(`${e} project root must be a real directory`);return Fr.realpath(n)}async function Zl(t,e,n,r){let i=t;for(let o=0;o<n.length;o++){i=Ue.join(i,n[o]);let s;try{s=await Fr.lstat(i)}catch(u){if(Fg(u))return{exists:!1,kind:"missing"};throw u}let a=Ue.relative(t,i).replaceAll("\\","/");if(s.isSymbolicLink())throw new Error(`${r.label} crosses a symbolic link or junction at ${a}`);let c=o===n.length-1;if(!c&&!s.isDirectory())throw new Error(`${r.label} ancestor ${a} must be a real directory`);if(c&&(r.expected==="file"&&!s.isFile()||r.expected==="directory"&&!s.isDirectory()||r.expected==="any"&&!s.isFile()&&!s.isDirectory()))throw new Error(`${r.label} must be a real ${r.expected}`);let l=await Fr.realpath(i);if(!fs(e,l))throw new Error(`${r.label} resolves outside the project root`);if(c)return{exists:!0,kind:s.isFile()?"file":s.isDirectory()?"directory":"missing"}}return{exists:!0,kind:"directory"}}async function L(t,e,n){let r=Fe(e,n.label),i=Ue.resolve(t),o=await Xl(i,n.label),s=r.split("/"),a=Ue.resolve(i,...s);if(!fs(i,a))throw new Error(`${n.label} must stay inside the project root`);let c=await Zl(i,o,s,n);return{projectRoot:i,target:a,relative:r,exists:c.exists,kind:c.kind}}async function Br(t,e,n){return(await L(t,e,{...n,expected:"file"})).exists}async function Y(t,e,n,r){let i=await L(t,e,{label:r.label,expected:"file"});if(!i.exists){let s=new Error(`${r.label} does not exist`);throw s.code="ENOENT",s}let o=await Xl(i.projectRoot,r.label);return zl(i.target,n,{...r,verify:async(s,a)=>{if(!fs(o,a.realPath))throw new Error(`${r.label} resolves outside the project root`);await Zl(i.projectRoot,o,i.relative.split("/"),{label:r.label,expected:"file"})}})}var se=B(()=>{"use strict";Ql();ve()});function Bg(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}function Kg(t){let e=(0,tu.parseDocument)(t,{uniqueKeys:!0});if(e.errors.length>0)throw new Error(`Invalid global Comet config: ${e.errors[0].message}`);let n=e.toJS();if(n==null)return{};if(typeof n!="object"||Array.isArray(n))throw new Error("Invalid global Comet config: root must be a mapping");return n}function ru(t){if(t.native?.pending_root_move)throw new Error("Global Comet config cannot contain native.pending_root_move");let e=t.native?(({pending_root_move:n,...r})=>r)(t.native):void 0;return{...t,schema:"comet.global.v1",...e?{native:e}:{}}}function Ug(t){let e=Be(JSON.stringify({...t,schema:"comet.project.v1"})).config;if(!e)throw new Error("Invalid global Comet config: workflow template is incomplete");return ru(e)}function Hg(t){let e=Be(t,{allowPartialProject:!0,allowMissingNativeFields:!0});if(!e.native&&!e.classic)return null;let n=e.native?"native":"classic",r=e.native?.language??e.classic?.language??"en",i=ls(e.native?.artifact_root??"docs",r);return{schema:"comet.global.v1",default_workflow:n,workflows:[n],ambient_resume:e.ambient_resume,...e.native?{native:{...i.native,...e.native}}:{},...e.classic?{classic:e.classic}:{}}}function iu(t){let e=Kg(t);if(Object.keys(e).length===0)return null;if(e.schema===void 0)return Hg(t);if(e.schema!=="comet.global.v1")throw new Error("Unsupported Comet global schema");return Ug(e)}async function ms(t){try{let e=await Y(t,nu,_t,{label:"global Comet config"});return iu(e.bytes.toString("utf8"))}catch(e){if(Bg(e))return null;throw e}}var tu,nu,ps=B(()=>{"use strict";tu=Xe(Ie(),1);Me();ve();se();nu=".comet/config.yaml"});import{createHash as Yg}from"crypto";function Vg(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}async function ke(t,e={}){return(await Kr(t,e)).document}async function Jg(t){try{return(await Y(t,fn,_t,{label:fn})).bytes}catch(e){if(Vg(e))return null;throw e}}function Gg(t){return t?{exists:!0,sha256:Yg("sha256").update(t).digest("hex")}:{exists:!1,sha256:null}}async function Kr(t,e={}){let n=await Jg(t);return{document:n?Be(n.toString("utf8"),e):null,identity:Gg(n)}}async function hs(t){return(await ke(t))?.config??null}var fn,He=B(()=>{"use strict";ve();se();fn=".comet/config.yaml"});var oS,gs=B(()=>{"use strict";Me();He();se();oS=16*1024});var ws=B(()=>{"use strict";Me();ve();He();se();gs()});var gS,su=B(()=>{"use strict";Me();se();gS=4*1024*1024});function cu(t,e){let n=t;for(let r of e)n+="\0"+(typeof r=="string"?r:JSON.stringify(r));return n}function lu(t,e){return(...n)=>{let r=au;if(r===null)return e(...n);let i=cu(`async:${t}`,n),o=r.entries.get(i);if(o)return o.value;let s=e(...n).catch(a=>{throw r.entries.delete(i),a});return r.entries.set(i,{value:s}),s}}function ys(t,e){return(...n)=>{let r=au;if(r===null)return e(...n);let i=cu(`sync:${t}`,n),o=r.entries.get(i);if(o)return o.value;let s=e(...n);return r.entries.set(i,{value:s}),s}}var au,vs=B(()=>{"use strict";au=null});var bS,uu=B(()=>{"use strict";vs();He();bS=lu("hookWritePolicy",async t=>(await hs(t))?.hook??{allow_paths:[]})});var fu=B(()=>{"use strict";$r();Me();Wl();Ml();ve();ps();se();He();ws();su();uu();gs();rs()});import{TextDecoder as tw}from"util";function du(t){return{dev:t.dev,ino:t.ino,birthtime:t.birthtimeMs}}function nw(t,e){try{return new tw("utf-8",{fatal:!0}).decode(t.bytes)}catch(n){throw new Error(`${e} is not valid UTF-8`,{cause:n})}}async function ks(t,e,n,r,i={}){try{let o=await Y(t,e,n,{label:r,hooks:i.hooks});return{result:o,text:nw(o,r)}}catch(o){let s=o.code;if(s==="ENOENT"||s==="ENOTDIR")return null;throw o}}async function dn(t,e,n,r,i={}){return(await ks(t,e,n,r,i))?.text??null}async function st(t,e,n,r,i,o={}){if(Buffer.byteLength(n,"utf8")>r)throw new Error(`${i} exceeds ${r} bytes`);let s=await ks(t,e,r,i),a=await L(t,e,{label:i,expected:"file"});await ue(a.target,n,{containedRoot:a.projectRoot,beforeCommit:async()=>{await o.beforeCommit?.();let c=await ks(t,e,r,i);if(!(!s&&!c)){if(!s||!c)throw new Error(`${i} changed before commit`);if(s.result.realPath!==c.result.realPath||!qe(du(s.result.stat),du(c.result.stat))||s.text!==c.text)throw new Error(`${i} changed before commit`)}}})}async function Ur(t,e,n,r,i,o={}){let s=await dn(t,e,r,i);await st(t,e,`${s??""}${n}`,r,i,o)}async function bs(t,e,n,r={}){let i=await L(t,e,{label:n,expected:"file"});return i.exists?ns(i.target,{containedRoot:i.projectRoot,beforeRemove:r.beforeRemove}):!1}var Hr=B(()=>{"use strict";fu();Ir()});var Pu={};Lf(Pu,{RUN_STATE_FILE:()=>ti,applyRunStateToDocument:()=>_s,readRunState:()=>xs,removeRunState:()=>Ps,runStateFromDocument:()=>ei,writeRunState:()=>ni});import Aw from"path";function _n(t,e){let n=t[e];if(typeof n!="string"||n.length===0)throw new Error(`Invalid Run state: ${e} must be a non-empty string`);return n}function En(t,e){let n=_n(t,e);if(Aw.isAbsolute(n)||/^(?:[A-Za-z]:|[\\/]|~)/u.test(n)||n.split(/[\\/]/u).includes(".."))throw new Error(`Invalid Run state: ${e} must stay inside the change directory`);return n}function Ow(t){let e=t.run_retries??"{}",n;try{n=typeof e=="string"?JSON.parse(e):e}catch(r){throw new Error("Invalid Run state: run_retries must be a JSON object",{cause:r})}if(!n||typeof n!="object"||Array.isArray(n))throw new Error("Invalid Run state: run_retries must be a JSON object");for(let r of Object.values(n))if(!Number.isInteger(r)||Number(r)<0)throw new Error("Invalid Run state: retry counts must be non-negative integers");return n}function ei(t){if(!t.run_id)return null;let e=_n(t,"run_id"),n=_n(t,"skill"),r=_n(t,"skill_version"),i=_n(t,"skill_hash"),o=En(t,"pending_ref"),s=En(t,"trajectory_ref"),a=En(t,"context_ref"),c=En(t,"artifacts_ref"),l=En(t,"checkpoint_ref"),u=Number(t.iteration);if(!Number.isInteger(u)||u<0)throw new Error("Invalid Run state: iteration must be a non-negative integer");if(t.orchestration!=="deterministic"&&t.orchestration!=="adaptive")throw new Error("Invalid Run state: orchestration must be deterministic or adaptive");if(t.run_status!=="running"&&t.run_status!=="waiting"&&t.run_status!=="completed"&&t.run_status!=="failed")throw new Error("Invalid Run state: run_status is invalid");return{runId:e,skill:n,skillVersion:r,skillHash:i,orchestration:t.orchestration,currentStep:_u(t,"current_step"),iteration:u,pending:_u(t,"pending"),pendingRef:o,trajectoryRef:s,contextRef:a,artifactsRef:c,checkpointRef:l,status:t.run_status,retries:Ow(t)}}function _s(t,e){e?t.run_id=e.runId:delete t.run_id}function Nw(t){return{runId:t.runId,skill:t.skill,skillVersion:t.skillVersion,skillHash:t.skillHash,orchestration:t.orchestration,currentStep:t.currentStep,iteration:t.iteration,pending:t.pending,pendingRef:t.pendingRef,trajectoryRef:t.trajectoryRef,contextRef:t.contextRef,artifactsRef:t.artifactsRef,checkpointRef:t.checkpointRef,status:t.status,retries:t.retries}}function jw(t){let e={run_id:t.runId,skill:t.skill,skill_version:t.skillVersion,skill_hash:t.skillHash,orchestration:t.orchestration,current_step:t.currentStep,iteration:t.iteration,pending:t.pending,pending_ref:t.pendingRef,trajectory_ref:t.trajectoryRef,context_ref:t.contextRef,artifacts_ref:t.artifactsRef,checkpoint_ref:t.checkpointRef,run_status:t.status,run_retries:JSON.stringify(t.retries)};return ei(e)}async function xs(t,e={}){let n=await dn(t,ti,xu,"Run state",e);if(n===null)return null;let r=JSON.parse(n);return jw(r)}async function ni(t,e,n={}){await st(t,ti,JSON.stringify(Nw(e),null,2),xu,"Run state",n)}async function Ps(t,e={}){await bs(t,ti,"Run state",e)}var _u,ti,xu,ri=B(()=>{"use strict";Hr();_u=(t,e)=>{let n=t[e];return n==null?null:String(n)};ti=".comet/run-state.json",xu=256*1024});var _f=Xe(Ie(),1);import{spawnSync as uv}from"child_process";import{createHash as Ef}from"crypto";import{promises as fv}from"fs";import T from"path";function Tl(t){return t==="zh-CN"?"zh-CN":"en"}function Tr(t,e,n){return t==="zh-CN"?n:e}var Zo={open:{en:"open (clarifying the request)",zh:"open(需求澄清)"},design:{en:"design",zh:"design(方案设计)"},build:{en:"build",zh:"build(实现)"},verify:{en:"verify",zh:"verify(验证)"},archive:{en:"archive",zh:"archive(归档)"}};function jr(t,e){return Zo[t]?Tr(e,Zo[t].en,Zo[t].zh):t}function $l(t){let{name:e,phase:n,failed:r,total:i,locale:o}=t;return r===0?{summary:Tr(o,`Change ${e} passed every check for leaving the ${jr(n,o)} stage (${i} total) and is ready to proceed.`,`需求 ${e} 通过了离开 ${jr(n,o)}阶段的全部 ${i} 项检查,可以继续推进。`)}:{summary:Tr(o,`Change ${e} is not ready to leave the ${jr(n,o)} stage yet: ${r} of ${i} checks failed. The failing items below are the Agent's checklist, not user actions.`,`需求 ${e} 暂时还不能离开 ${jr(n,o)}阶段:${r}/${i} 项检查未通过。下方的失败项是给 Agent 的检查清单,不需要用户处理。`),user_message:Tr(o,"A few preparation items are still missing before this change can move to the next stage; the Agent is filling them in and will continue afterwards.","这条需求要进入下一阶段还差几项准备工作;Agent 正在补齐,之后会自动继续。")}}import Jr from"path";Hr();import Yr from"path";var mn={trajectory:8*1024*1024,artifacts:1024*1024,context:1024*1024,pendingAction:256*1024,checkpoint:256*1024};function pn(t,e){if(Yr.isAbsolute(e))throw new Error("Run path must stay inside the change directory");let n=Yr.resolve(t),r=Yr.resolve(n,e);if(r!==n&&!r.startsWith(n+Yr.sep))throw new Error("Run path must stay inside the change directory")}async function hn(t,e,n,r={}){pn(t,e),await Ur(t,e,`${JSON.stringify(n)}
|
|
143
|
-
`,mn.trajectory,"Run trajectory",r)}async function
|
|
144
|
-
`,mn.artifacts,"Run artifacts",r)}async function pu(t,e,n,r={}){pn(t,e),await
|
|
145
|
-
`,mn.checkpoint,"Run checkpoint",r)}function
|
|
146
|
-
Valid format: lowercase kebab-case (a-z, 0-9, single hyphens)`:"Change name cannot be empty"}function Es(t){let e=kn(t);if(e)throw new Error(e)}function hw(t,e){return{label:z(t,e),directory:e}}async function Cs(t,e,n){let r=hw(t,e);if(!(await Ve(t,e,{label:n,expected:"directory"})).exists)return{change:r,exists:!1,stateExists:!1};let o=await Ve(t,Qr.join(e,".comet.yaml"),{label:`${n} state`,expected:"file"});return{change:r,exists:!0,stateExists:o.exists}}function gw(t,e){let n=e.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&");return new RegExp(`^\\d{4}-\\d{2}-\\d{2}-${n}$`,"u").test(t)}async function ww(t,e,n,r={}){if(!r.skipExactCompatibility){let s=await Cs(t,Qr.join(e,n),`Classic archived change ${n}`);if(s.exists)return s.change}if(!(await Ve(t,e,{label:"Classic archive directory",expected:"directory"})).exists)return null;let o=[];for(let s of await pw.readdir(e,{withFileTypes:!0})){if(!gw(s.name,n))continue;let a=await Cs(t,Qr.join(e,s.name),`Classic archived change ${s.name}`);a.exists&&a.stateExists&&o.push(a.change)}return o.sort((s,a)=>a.directory.localeCompare(s.directory))[0]??null}async function Xr(t,e=process.cwd()){Es(t);let n=await Ye(e),r=await Cs(n.projectRoot,Qr.join(n.changesDir,t),`Classic active change ${t}`);if(r.exists)return r.change;let i=await ww(n.projectRoot,n.archiveDir,t);return i||r.change}function yw(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}async function Cu(t,e,n,r){let i=Fe(n,"Classic handoff artifact pointer");if((await L(t,i,{label:"Classic handoff artifact",expected:"file"})).exists)return null;let s=await Ye(t),a=`${z(t,s.changesDir)}/`,l=(s.artifactLayout==="docs"?[a,"openspec/changes/"]:[a]).find(v=>i.startsWith(v));if(!l)return null;let u=i.slice(l.length).split("/");if(u.length<4||u[1]!==".comet"||u.slice(2).some(v=>v.length===0))return null;let d=u[0];Es(d);let m=u.slice(2),h=bn.resolve(e);if(bn.dirname(h)!==bn.resolve(s.archiveDir))return null;let g=bn.basename(h),f=/^\d{4}-\d{2}-\d{2}-(.+)$/u.exec(g);if(g!==d&&f?.[1]!==d)return null;await L(t,z(t,h),{label:"Classic archived change directory",expected:"directory"});let p=bn.join(h,".comet",...m),w=z(t,p);try{return await Y(t,w,r,{label:"Historical Classic archived handoff artifact"}),w}catch(v){if(yw(v))return null;throw v}}se();var Eu=2*1024*1024;function Sn(t,e){return be.relative(t,e).split(be.sep).join("/")}async function Cn(t,e,n,r,i){if(!n)return{code:e,satisfied:!1};let o=n.replaceAll("\\","/");if(i)return{code:e,satisfied:!1,source:o,detail:`Classic layout is unsafe or unavailable: ${i instanceof Error?i.message:String(i)}`};try{if(r){let a=r.artifactLayout==="legacy"?"docs":"legacy",c=z(t,Gr(t,a).openSpecRoot);if((o===c||o.startsWith(`${c}/`))&&(await L(t,o,{label:`${e} artifact`,expected:"file"})).exists)return{code:e,satisfied:!1,source:o,detail:"standalone OpenSpec root is not a Comet artifact root"}}let s=await Br(t,o,{label:`${e} artifact`});return{code:e,satisfied:s,source:o,...s?{resolvedSource:o}:{}}}catch(s){return{code:e,satisfied:!1,source:o,detail:`unsafe artifact pointer outside the project or through a special path: ${s instanceof Error?s.message:String(s)}`}}}async function kw(t,e,n,r){try{r??=await Ye(t)}catch(o){return{code:"design.handoff",satisfied:!1,...n?{source:n.replaceAll("\\","/")}:{},detail:`Classic layout is unsafe or unavailable for handoff evidence: ${o instanceof Error?o.message:String(o)}`}}let i=await Cn(t,"design.handoff",n,r);if(!n||i.satisfied||i.detail)return i;try{let o=await Cu(t,e,n,Eu);return o?{...i,satisfied:!0,resolvedSource:o,detail:`resolved historical legacy pointer from archived change: ${o}`}:i}catch(o){return{...i,satisfied:!1,detail:`unsafe archived handoff fallback: ${o instanceof Error?o.message:String(o)}`}}}async function Zr(t,e,n){return Cn(t,e,Sn(t,n))}async function bw(t,e){let n=be.join(e,"specs"),r;try{let s=Sn(t,n);if(!(await L(t,s,{label:"OpenSpec delta-spec directory",expected:"directory"})).exists)return{code:"openspec.delta-spec",satisfied:!1};r=await vw.readdir(n)}catch(s){return s.code==="ENOENT"?{code:"openspec.delta-spec",satisfied:!1}:{code:"openspec.delta-spec",satisfied:!1,detail:`unsafe delta-spec path: ${s instanceof Error?s.message:String(s)}`}}let i=r.map(s=>be.join(n,s,"spec.md")),o=(await Promise.all(i.map(async s=>{try{return await Br(t,Sn(t,s),{label:"OpenSpec delta spec"})?s:null}catch{return null}}))).filter(s=>s!==null);return{code:"openspec.delta-spec",satisfied:o.length>0,source:o[0]?Sn(t,o[0]):void 0,detail:`${o.length} delta spec${o.length===1?"":"s"}`}}async function Sw(t,e){let n,r=Sn(t,e);try{n=(await Y(t,r,Eu,{label:"Classic tasks artifact"})).bytes.toString("utf8")}catch(s){return s.code==="ENOENT"?{code:"build.tasks-complete",satisfied:!1}:{code:"build.tasks-complete",satisfied:!1,source:r,detail:`unsafe tasks artifact: ${s instanceof Error?s.message:String(s)}`}}let i=[...n.matchAll(/^\s*[-*]\s+\[([ xX])\]\s+/gmu)],o=i.filter(s=>s[1].toLowerCase()==="x").length;return{code:"build.tasks-complete",satisfied:i.length>0&&o===i.length,source:r,detail:`${o} of ${i.length} tasks complete`}}function ct(t,e){return t.some(n=>n.code===e&&n.satisfied)}async function Je(t,e){let n=await at(t),r=e.classic,i=be.join(t,"proposal.md"),o=be.join(t,"design.md"),s=be.join(t,"tasks.md"),a=e.run?be.resolve(t,e.run.checkpointRef):be.join(t,".comet","checkpoint.json"),c,l;try{c=await Ye(n)}catch(m){l=m}let u=await Promise.all([Zr(n,"openspec.proposal",i),Zr(n,"openspec.design",o),Zr(n,"openspec.tasks",s),bw(n,t),Cn(n,"design.document",r?.designDoc??null,c,l),Cn(n,"build.plan",r?.plan??null,c,l),Sw(n,s),Cn(n,"verification.report",r?.verificationReport??null,c,l),kw(n,t,r?.handoffContext??null,c),Zr(n,"run.checkpoint",a)]),d=u.find(m=>m.code==="design.handoff");return d&&!r?.handoffHash&&(d.satisfied=!1,d.detail="handoff hash is missing"),u.push({code:"archive.confirmed",satisfied:r?.archiveConfirmation==="confirmed"}),u}import{promises as nf}from"fs";import re from"path";import{fileURLToPath as rf}from"url";import{createHash as Ey,randomUUID as _y}from"crypto";import{promises as Is}from"fs";import Se from"path";function Cw(t){return t.classicProfile??t.workflow}function Ew(t){return!t.buildMode||!t.tddMode||!t.isolation||!t.verifyMode?!1:t.buildMode==="subagent-driven-development"?t.subagentDispatch==="confirmed":t.buildMode==="direct"?t.directOverride===!0:!0}function _w(t){return t.buildMode==="direct"&&t.tddMode==="direct"&&t.isolation!==null&&t.verifyMode==="light"}function xw(t,e,n){if(e.verifyResult==="fail")return t==="full"?"full.build.fix":`${t}.build.execute`;if(t==="full"){if(!ct(n,"build.plan"))return"full.build.plan";if(e.buildPause==="plan-ready")return"full.build.plan-ready";if(!Ew(e))return"full.build.configure"}else if(!_w(e))throw new Error(`${t} build configuration is incomplete`);return ct(n,"build.tasks-complete")?`${t}.build.complete`:`${t}.build.execute`}function Pw(t,e,n){return e.verifyResult!=="pass"||!ct(n,"verification.report")?`${t}.verify.run`:`${t}.verify.branch`}function Rw(t,e){if(e.verifyResult!=="pass")throw new Error("archive requires verify_result=pass");return e.archiveConfirmation==="confirmed"?`${t}.archive.execute`:`${t}.archive.confirm`}function xt(t,e){let n=Cw(t);if(t.archived&&t.phase!=="archive")throw new Error("archived=true requires phase=archive");if(t.archived)return"completed";if(n!=="full"&&t.phase==="design")throw new Error(`${n} workflow cannot enter design`);switch(t.phase){case"open":return`${n}.open`;case"design":return ct(e,"design.handoff")?"full.design.document":"full.design.handoff";case"build":return xw(n,t,e);case"verify":return Pw(n,t,e);case"archive":return Rw(n,t)}}var si=Xe(Ie(),1);Me();se();import oi from"path";ri();var Ru=["full","hotfix","tweak"],lt=1,Tw=["open","design","build","verify","archive"],$w=["en","zh-CN"],Iw=["off","beta"],Lw=["subagent-driven-development","executing-plans","direct"],qw=["plan-ready"],Ww=["confirmed"],Mw=["tdd","direct"],Dw=["off","standard","thorough"],Fw=["current","branch","worktree"],Bw=["light","full"],Kw=["pending","pass","fail"],Uw=["pending","handled"],Hw=["pending","confirmed"],Rt=["workflow","language","phase","context_compression","build_mode","build_pause","subagent_dispatch","tdd_mode","review_mode","isolation","bound_branch","verify_mode","auto_transition","base_ref","design_doc","plan","verify_result","verify_failures","verification_report","branch_status","created_at","verified_at","archive_confirmation","archived","direct_override","handoff_context","handoff_hash","classic_profile","classic_migration"],As=["run_id"],Yw=new Set([...Rt,...As]),Vw=["workflow","phase","design_doc","plan","build_mode","isolation","verify_mode","verify_result","verified_at","archived"];function Au(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function Pt(t,e){let n=t[e];if(n==null||n==="")return null;if(typeof n!="string")throw new Error(`Invalid Classic state: ${e} must be a string or null`);return n}function Q(t,e,n,r=!0){let i=t[e];if(i==null||i===""){if(r)return null;throw new Error(`Invalid Classic state: ${e} is required`)}if(typeof i!="string"||!n.includes(i))throw new Error(`Invalid Classic state: ${e} must be one of ${n.join(", ")}${r?" or null":""}`);return i}function Rs(t,e,n=!0){let r=t[e];if(r==null||r===""){if(n)return null;throw new Error(`Invalid Classic state: ${e} is required`)}if(typeof r!="boolean")throw new Error(`Invalid Classic state: ${e} must be true or false`);return r}function Jw(t,e,n=0){let r=t[e];if(r==null||r==="")return n;if(typeof r!="number"||!Number.isInteger(r)||r<0)throw new Error(`Invalid Classic state: ${e} must be a non-negative integer`);return r}function ii(t,e){let n=Pt(t,e);if(n===null)return null;if(/^(?:[A-Za-z]:|[\\/]|~)/u.test(n)||n.split(/[\\/]/u).includes(".."))throw new Error(`Invalid Classic state: ${e} must be a relative repository path`);return n}function Gw(t,e){let n=Pt(t,e);if(n!==null&&!/^[a-f0-9]{64}$/u.test(n))throw new Error(`Invalid Classic state: ${e} must be a sha256 hex digest`);return n}function zw(t){let e=t.classic_migration;if(e==null||e==="")return null;if(e!==lt)throw new Error(`Invalid Classic state: classic_migration must be ${lt}`);return e}function Qw(t){if(!Rt.some(n=>Au(t,n)))return null;for(let n of Vw)if(!Au(t,n))return null;return{workflow:Q(t,"workflow",Ru,!1),language:Q(t,"language",$w),phase:Q(t,"phase",Tw,!1),contextCompression:Q(t,"context_compression",Iw),buildMode:Q(t,"build_mode",Lw),buildPause:Q(t,"build_pause",qw),subagentDispatch:Q(t,"subagent_dispatch",Ww),tddMode:Q(t,"tdd_mode",Mw),reviewMode:Q(t,"review_mode",Dw),isolation:Q(t,"isolation",Fw),boundBranch:Pt(t,"bound_branch"),verifyMode:Q(t,"verify_mode",Bw),autoTransition:Rs(t,"auto_transition"),baseRef:Pt(t,"base_ref"),designDoc:ii(t,"design_doc"),plan:ii(t,"plan"),verifyResult:Q(t,"verify_result",Kw,!1),verifyFailures:Jw(t,"verify_failures"),verificationReport:ii(t,"verification_report"),branchStatus:Q(t,"branch_status",Uw),createdAt:Pt(t,"created_at"),verifiedAt:Pt(t,"verified_at"),archiveConfirmation:Q(t,"archive_confirmation",Hw),archived:Rs(t,"archived",!1),directOverride:Rs(t,"direct_override"),handoffContext:ii(t,"handoff_context"),handoffHash:Gw(t,"handoff_hash"),classicProfile:Q(t,"classic_profile",Ru),classicMigration:zw(t)}}function Os(t,e){let n=e??null;if(n===null&&e===void 0&&t.run_id&&t.skill)try{n=ei(t)}catch(r){let i=r instanceof Error?r.message:String(r);throw new Error(i.replace(/^Invalid Run state:/u,"Invalid Classic state:"),{cause:r})}return{classic:Qw(t),run:n,unknownKeys:Object.keys(t).filter(r=>!Yw.has(r))}}function Ou(t){return{workflow:t.workflow,language:t.language,phase:t.phase,context_compression:t.contextCompression,build_mode:t.buildMode,build_pause:t.buildPause,subagent_dispatch:t.subagentDispatch,tdd_mode:t.tddMode,review_mode:t.reviewMode,isolation:t.isolation,bound_branch:t.boundBranch,verify_mode:t.verifyMode,auto_transition:t.autoTransition,base_ref:t.baseRef,design_doc:t.designDoc,plan:t.plan,verify_result:t.verifyResult,verify_failures:t.verifyFailures,verification_report:t.verificationReport,branch_status:t.branchStatus,created_at:t.createdAt,verified_at:t.verifiedAt,archive_confirmation:t.archiveConfirmation,archived:t.archived,direct_override:t.directOverride,handoff_context:t.handoffContext,handoff_hash:t.handoffHash,classic_profile:t.classicProfile,classic_migration:t.classicMigration}}ri();var Xw=2*1024*1024;function xn(t){let e=t.toJS();if(e===null)return{};if(typeof e!="object"||Array.isArray(e))throw new Error("Invalid Classic state document: root must be a mapping");return e}function Nu(t,e,n){t.get(e)!==n&&t.set(e,n)}function Zw(t,e){if(e.classic)for(let[n,r]of Object.entries(Ou(e.classic)))Nu(t,n,r);else for(let n of Rt)t.delete(n);_s(t.toJS(),e.run),e.run?Nu(t,"run_id",e.run.runId):t.delete("run_id")}function ey(t){let e=["skill","skill_version","skill_hash","orchestration","current_step","iteration","pending","pending_ref","trajectory_ref","context_ref","artifacts_ref","checkpoint_ref","run_status","run_retries"];for(let n of e)t.delete(n)}function ty(t){let e=!1;for(let n of["build_command","verify_command"])t.has(n)&&(t.delete(n),e=!0);return e}async function ju(t){let e;try{e=(await Y(oi.dirname(t),oi.basename(t),Xw,{label:"Classic state document"})).bytes.toString("utf8")}catch(r){if(r.code!=="ENOENT")throw r;return new si.Document({})}let n=(0,si.parseDocument)(e);if(n.errors.length>0)throw new Error(`Invalid Classic state document: ${n.errors[0].message}`);return xn(n),n}async function Ge(t,e={}){let n=e.migrate!==!1,r=oi.join(t,".comet.yaml"),i=await ju(r),o=xn(i),s=ty(i);s&&(o=xn(i));let a=await xs(t);if(!a&&o.run_id&&o.skill){let{runStateFromDocument:c}=await Promise.resolve().then(()=>(ri(),Pu));a=c(o),a&&n&&(await ni(t,a),ey(i),s=!0)}return s&&n&&await ue(r,i.toString(),{containedRoot:t}),Os(xn(i),a)}async function ai(t,e,n={}){let r=oi.join(t,".comet.yaml"),i=await ju(r);Zw(i,{...e,unknownKeys:e.unknownKeys??[]}),Os(xn(i),e.run??null),await ue(r,i.toString(),{containedRoot:t,beforeCommit:n.beforeCommit}),e.run?await ni(t,e.run):await Ps(t)}function Tu(t,e,n){return{runId:e,skill:t.definition.metadata.name,skillVersion:t.definition.metadata.version,skillHash:n,orchestration:t.definition.orchestration.mode,currentStep:t.definition.orchestration.entry??null,iteration:0,pending:null,pendingRef:".comet/pending-action.json",trajectoryRef:".comet/trajectory.jsonl",contextRef:".comet/context.md",artifactsRef:".comet/artifacts.json",checkpointRef:".comet/checkpoint.json",status:"running",retries:{}}}import{createHash as Vu,randomUUID as vy}from"crypto";import{promises as U}from"fs";import M from"path";var Lu=Xe(Ie(),1);import{promises as Ns}from"fs";import ae from"path";var ny=["invoke_skill","call_tool","handoff","ask_user","checkpoint"],ry=["deterministic","adaptive"],iy=["function","mcp","script","agent"],oy=["none","read","write","external"],sy=["progress","step","completion"],ay=["artifact_exists","state_equals"];function ut(t,e,n){return new Error(`${t}: ${e} ${n}`)}function ne(t,e,n="document"){if(t===null||typeof t!="object"||Array.isArray(t))throw ut(e,n,"must be an object")}function ze(t,e,n){if(!Array.isArray(t))throw ut(e,n,"must be an array")}function X(t,e,n){if(typeof t!="string")throw ut(e,n,"must be a string")}function fe(t,e,n,r){e in t&&X(t[e],n,`${r}.${e}`)}function qu(t,e,n,r){if(e in t&&typeof t[e]!="boolean")throw ut(n,`${r}.${e}`,"must be a boolean")}function Qe(t,e,n,r){if(typeof t!="string"||!e.includes(t))throw ut(n,r,`must be one of ${e.join(", ")}`)}function ci(t,e,n){ze(t,e,n),t.forEach((r,i)=>{X(r,e,`${n}[${i}]`)})}function $u(t,e,n){ne(t,e,n),X(t.name,e,`${n}.name`),X(t.description,e,`${n}.description`),qu(t,"required",e,n)}function cy(t,e,n){ne(t,e,n),X(t.id,e,`${n}.id`),fe(t,"source",e,n),fe(t,"version",e,n)}function ly(t,e,n){ne(t,e,n),X(t.id,e,`${n}.id`),X(t.role,e,`${n}.role`),fe(t,"instructions",e,n)}function uy(t,e,n){ne(t,e,n),X(t.id,e,`${n}.id`),Qe(t.kind,iy,e,`${n}.kind`),X(t.source,e,`${n}.source`),Qe(t.sideEffect,oy,e,`${n}.sideEffect`),qu(t,"requiresConfirmation",e,n)}function fy(t,e,n){ne(t,e,n),Qe(t.type,ny,e,`${n}.type`),fe(t,"ref",e,n),fe(t,"prompt",e,n),fe(t,"question",e,n),"options"in t&&ci(t.options,e,`${n}.options`)}function dy(t,e,n){ne(t,e,n),X(t.id,e,`${n}.id`),fy(t.action,e,`${n}.action`),fe(t,"next",e,n),"completionEvals"in t&&ci(t.completionEvals,e,`${n}.completionEvals`)}function my(t,e){let n="goal";ne(t,e,n),X(t.statement,e,`${n}.statement`),ze(t.inputs,e,`${n}.inputs`),t.inputs.forEach((r,i)=>{$u(r,e,`${n}.inputs[${i}]`)}),ze(t.outputs,e,`${n}.outputs`),t.outputs.forEach((r,i)=>{$u(r,e,`${n}.outputs[${i}]`)}),ci(t.success,e,`${n}.success`)}function py(t,e){let n="orchestration";ne(t,e,n),Qe(t.mode,ry,e,`${n}.mode`),fe(t,"entry",e,n),"steps"in t&&(ze(t.steps,e,`${n}.steps`),t.steps.forEach((r,i)=>{dy(r,e,`${n}.steps[${i}]`)}))}function Wu(t,e){return ne(t,e),Qe(t.apiVersion,["comet/v1alpha1"],e,"apiVersion"),Qe(t.kind,["Skill"],e,"kind"),ne(t.metadata,e,"metadata"),X(t.metadata.name,e,"metadata.name"),X(t.metadata.version,e,"metadata.version"),X(t.metadata.description,e,"metadata.description"),my(t.goal,e),py(t.orchestration,e),ze(t.skills,e,"skills"),t.skills.forEach((n,r)=>{cy(n,e,`skills[${r}]`)}),ze(t.agents,e,"agents"),t.agents.forEach((n,r)=>{ly(n,e,`agents[${r}]`)}),ze(t.tools,e,"tools"),t.tools.forEach((n,r)=>{uy(n,e,`tools[${r}]`)}),t}function Mu(t,e){ne(t,e);for(let n of["allowedSkills","allowedAgents","allowedTools","confirmationRequiredFor"])n in t&&ci(t[n],e,n);for(let n of["maxIterations","maxRetriesPerAction"])if(n in t&&(typeof t[n]!="number"||!Number.isFinite(t[n])))throw ut(e,n,"must be a finite number");return t}function hy(t,e){return ne(t,e),"runtime"in t&&Du(t.runtime,e,"runtime"),t}function Du(t,e,n){return ze(t,e,n),t.forEach((r,i)=>{let o=`${n}[${i}]`;ne(r,e,o),X(r.id,e,`${o}.id`),Qe(r.scope,sy,e,`${o}.scope`),Qe(r.type,ay,e,`${o}.type`),fe(r,"artifact",e,o),fe(r,"field",e,o),fe(r,"equals",e,o)}),t}async function js(t){let e=await Ns.readFile(t,"utf8");try{return(0,Lu.parse)(e)}catch(n){let r=n instanceof Error?n.message:String(n);throw ut(t,"document",r)}}async function gy(t){try{return await js(t)}catch(e){if(e.code==="ENOENT")return null;throw e}}async function Iu(t){try{return await Ns.access(t),!0}catch(e){if(e.code==="ENOENT")return!1;throw e}}async function wy(t){let e=ae.join(t,"checks.yaml"),n=ae.join(t,"evals.yaml"),[r,i]=await Promise.all([Iu(e),Iu(n)]);if(i)throw new Error(`${n}: evals.yaml is no longer supported; use checks.yaml`);return r?{document:hy(await js(e),e)}:{document:null}}async function Fu(t){let e=ae.resolve(t.root),n=ae.resolve(t.controlRoot);t.requireSkillMarkdown&&await Ns.access(ae.join(e,"SKILL.md"));let r=ae.join(n,"skill.yaml"),i=ae.join(n,"guardrails.yaml"),o=Wu(await js(r),r),s=await gy(i),a=s===null?null:Mu(s,i),c=await wy(n),l={allowedSkills:o.skills.map(u=>u.id),allowedAgents:o.agents.map(u=>u.id),allowedTools:o.tools.map(u=>u.id),maxIterations:50,maxRetriesPerAction:3,confirmationRequiredFor:o.tools.filter(u=>u.requiresConfirmation).map(u=>u.id)};return{root:e,packageKind:t.packageKind==="runtime"?"runtime":void 0,definition:o,guardrails:{...l,...a},evals:c.document?.runtime??[]}}async function Bu(t){let e=ae.resolve(t);return Fu({root:e,controlRoot:ae.join(e,"comet"),packageKind:"skill",requireSkillMarkdown:!0})}async function Ku(t){let e=ae.resolve(t);return Fu({root:e,controlRoot:e,packageKind:"runtime",requireSkillMarkdown:!1})}function Uu(t,e,n=ae.join(e,"package.json")){ne(t,n);let r=t.packageKind==="runtime"?"runtime":void 0,i=Wu(t.definition,n),o=Mu(t.guardrails,n),s=Du(t.evals,n,"evals"),a={allowedSkills:i.skills.map(c=>c.id),allowedAgents:i.agents.map(c=>c.id),allowedTools:i.tools.map(c=>c.id),maxIterations:50,maxRetriesPerAction:3,confirmationRequiredFor:i.tools.filter(c=>c.requiresConfirmation).map(c=>c.id)};return{root:ae.resolve(e),packageKind:r,definition:i,guardrails:{...a,...o},evals:s}}import Hu from"path";function yy(t,e,n,r){t.type==="invoke_skill"&&!e.definition.skills.some(i=>i.id===t.ref)&&n.push(`step ${r} references undeclared skill: ${t.ref??"(missing)"}`),t.type==="call_tool"&&!e.definition.tools.some(i=>i.id===t.ref)&&n.push(`step ${r} references undeclared tool: ${t.ref??"(missing)"}`),t.type==="handoff"&&!e.definition.agents.some(i=>i.id===t.ref)&&n.push(`step ${r} references undeclared agent: ${t.ref??"(missing)"}`),t.type==="ask_user"&&!t.question&&n.push(`step ${r} ask_user action requires question`)}function Yu(t){let e=[],{definition:n,guardrails:r,evals:i}=t;n.apiVersion!=="comet/v1alpha1"&&e.push("unsupported apiVersion"),n.kind!=="Skill"&&e.push("kind must be Skill"),n.metadata.name||e.push("metadata.name is required"),n.goal.statement||e.push("goal.statement is required"),r.maxIterations<1&&e.push("maxIterations must be at least 1"),r.maxRetriesPerAction<0&&e.push("maxRetriesPerAction must not be negative");let o=n.orchestration.steps??[];if(n.orchestration.mode==="adaptive")(n.orchestration.entry||o.length>0)&&e.push("adaptive orchestration must not define entry or steps");else{let s=new Set;for(let a of o)s.has(a.id)&&e.push(`duplicate step id: ${a.id}`),s.add(a.id),yy(a.action,t,e,a.id);(!n.orchestration.entry||!s.has(n.orchestration.entry))&&e.push(`orchestration.entry references unknown step: ${n.orchestration.entry??"(missing)"}`);for(let a of o){a.next&&!s.has(a.next)&&e.push(`step ${a.id} has unknown next step: ${a.next}`);for(let c of a.completionEvals??[])i.some(l=>l.id===c)||e.push(`step ${a.id} references unknown eval: ${c}`)}}for(let s of n.tools){if(s.kind!=="script")continue;let a=Hu.posix.normalize(s.source.replaceAll("\\","/"));(Hu.isAbsolute(s.source)||a===".."||a.startsWith("../"))&&e.push(`script tool ${s.id} must reference a relative path inside the Skill package`)}for(let s of r.allowedSkills)n.skills.some(a=>a.id===s)||e.push(`guardrails allow undeclared skill: ${s}`);for(let s of r.allowedAgents)n.agents.some(a=>a.id===s)||e.push(`guardrails allow undeclared agent: ${s}`);for(let s of r.allowedTools)n.tools.some(a=>a.id===s)||e.push(`guardrails allow undeclared tool: ${s}`);return e}function li(t){return Array.isArray(t)?t.map(li):t&&typeof t=="object"?Object.fromEntries(Object.entries(t).sort(([e],[n])=>e.localeCompare(n)).map(([e,n])=>[e,li(n)])):t}function ky(t){return li({...t.packageKind==="runtime"?{packageKind:"runtime"}:{},definition:t.definition,guardrails:t.guardrails,evals:t.evals})}function by(t){return M.posix.normalize(t.replaceAll("\\","/"))}function At(t,e,n){let r=M.relative(t,e);if(!(r===""||!M.isAbsolute(r)&&!r.startsWith(`..${M.sep}`)))throw new Error(`${n} resolves outside the Skill package`)}async function Ju(t,e,n){let r=by(e);if(M.posix.isAbsolute(r)||r===".."||r.startsWith("../"))throw new Error(`${n} resolves outside the Skill package`);let i=M.resolve(t,...r.split("/"));At(t,i,n);let o;try{o=await U.realpath(i)}catch(s){throw s.code==="ENOENT"?new Error(`${n} does not exist: ${e}`,{cause:s}):s}if(At(t,o,n),!(await U.stat(o)).isFile())throw new Error(`${n} is not a file: ${e}`);return{path:r,content:await U.readFile(o)}}async function Sy(t){let e=await U.realpath(t.root),n=t.packageKind==="runtime"?[]:[await Ju(e,"SKILL.md","SKILL.md")];for(let r of t.definition.tools)r.kind==="script"&&n.push(await Ju(e,r.source,`Script tool ${r.id}`));return n.sort((r,i)=>r.path.localeCompare(i.path))}function Cy(t,e){let n=e.map(r=>({path:r.path,sha256:Vu("sha256").update(r.content).digest("hex")}));return Vu("sha256").update(JSON.stringify(li({package:t,files:n}))).digest("hex")}function Qu(t){return JSON.stringify(t,null,2)+`
|
|
147
|
-
`}async function Xu(t){let e=
|
|
148
|
-
`),await U.rename(o,i)}catch(s){if(await Gu(i)){try{await zu(i,n)}finally{await U.rm(o,{recursive:!0,force:!0})}return{hash:n.hash,snapshotDir:i}}throw await U.rm(o,{recursive:!0,force:!0}),s}return{hash:n.hash,snapshotDir:i}}async function $s(t,e){if(!/^[a-f0-9]{64}$/u.test(e))throw new Error(`Invalid Skill snapshot hash: ${e}`);let n=
|
|
149
|
-
`));let l=await ui(a);if(l!==e)throw new Error(`calculated hash is ${l}`);return a}catch(i){throw new Error(`Skill snapshot is invalid or missing: ${e}`,{cause:i})}}async function Zu(t){try{return await Is.access(t),!0}catch(e){if(e.code==="ENOENT")return!1;throw e}}function ef(t){return Ey("sha256").update(t).digest("hex")}function xy(t){return ef(JSON.stringify(Object.fromEntries(Object.entries(t).sort(([e],[n])=>e.localeCompare(n)))))}function Py(t){return t.replaceAll(".","_").replaceAll("-","_")}async function Ry(t,e){let n=await at(t),r=Object.fromEntries(e.filter(s=>s.satisfied&&s.source).map(s=>[Py(s.code),s.source])),i=Se.join(t,"subagent-progress.md");await Zu(i)&&(r.subagent_progress=Se.relative(n,i).split(Se.sep).join("/"));let o=e.find(s=>s.code==="design.handoff"&&s.satisfied);return o?.source&&(r.handoff_context=o.source),r}function Ay(t,e,n){return[{sequence:1,timestamp:n,type:"run_started",runId:t.runId,data:{skill:t.skill,skillVersion:t.skillVersion,skillHash:t.skillHash}},{sequence:2,timestamp:n,type:"state_migrated",runId:t.runId,data:{kind:"classic",migrationVersion:lt,profile:e,source:"pre-migration"}}]}async function Oy(t){await Promise.all(t.map(e=>Is.rm(e,{recursive:!0,force:!0})))}async function tf(t,e){let n=await Ge(t);if(!n.classic)throw new Error("Classic migration requires a legacy state projection");let r=n.classic,i=r.classicProfile??r.workflow;if(n.run){if(r.classicMigration!==lt)throw new Error("Classic Run exists without a supported classic_migration marker");if(n.run.skill!==e.skillPackage.definition.metadata.name)throw new Error(`Classic Run skill mismatch: expected ${e.skillPackage.definition.metadata.name}, got ${n.run.skill}`);if(await ui(e.skillPackage)!==n.run.skillHash)return await $s(t,n.run.skillHash),{classic:r,run:n.run,evidence:await Je(t,n),migrated:!1,snapshotDir:Se.join(t,".comet","skill-snapshots",n.run.skillHash)};let m=await Ts(e.skillPackage,t);return{classic:r,run:n.run,evidence:await Je(t,n),migrated:!1,snapshotDir:m.snapshotDir}}let o=await Je(t,n),s=xt(r,o);if(!e.skillPackage.definition.orchestration.steps?.some(d=>d.id===s))throw new Error(`Classic Skill package does not define resolved step: ${s}`);let a=await ui(e.skillPackage),c=Se.join(t,".comet","skill-snapshots",a),l=await Zu(c),u=[];try{let d=await Ts(e.skillPackage,t),m=Tu(e.skillPackage,e.runId?.()??_y(),d.hash);m.currentStep=s,s==="completed"&&(m.status="completed");let h={...r,classicProfile:i,classicMigration:lt},g=await Ry(t,o),f=await at(t),p=o.find(C=>C.code==="design.handoff"&&C.satisfied),w=null;p?.source&&(w=await te(f,p.resolvedSource??p.source,{label:"Classic migration handoff context",hooks:e.handoffReadHooks}),await pu(t,m.contextRef,w),u.push(Se.resolve(t,m.contextRef))),await mu(t,m.artifactsRef,g),u.push(Se.resolve(t,m.artifactsRef));let v=(e.now?.()??new Date).toISOString(),b={runId:m.runId,stateVersion:1,trajectoryOffset:2,contextHash:w===null?null:ef(w),artifactsHash:xy(g),createdAt:v};await hu(t,m.checkpointRef,b),u.push(Se.resolve(t,m.checkpointRef)),u.push(Se.resolve(t,m.trajectoryRef));for(let C of Ay(m,i,v))await hn(t,m.trajectoryRef,C);return await ai(t,{classic:h,run:m,unknownKeys:n.unknownKeys}),{classic:h,run:m,evidence:o,migrated:!0,snapshotDir:d.snapshotDir}}catch(d){throw await Oy(u),l||await Is.rm(c,{recursive:!0,force:!0}),d}}async function Ny(t){try{return(await nf.stat(t)).isDirectory()}catch(e){if(e.code==="ENOENT")return!1;throw e}}async function fi(t){try{return(await nf.stat(t)).isFile()}catch(e){if(e.code==="ENOENT")return!1;throw e}}async function jy(t){return await Ny(t)?await fi(re.join(t,"skill.yaml"))?!0:await fi(re.join(t,"SKILL.md"))&&await fi(re.join(t,"comet","skill.yaml")):!1}function Ty(t){return{root:t,packageKind:"runtime",definition:{apiVersion:"comet/v1alpha1",kind:"Skill",metadata:{name:"comet-classic",version:"1",description:"Internal compatibility orchestration for classic Comet full, hotfix, and tweak workflows"},goal:{statement:"Advance or restore a classic Comet Run without changing the user command surface",inputs:[{name:"classic-state",description:"Validated ClassicState consistent with the Run projection",required:!0},{name:"evidence",description:"Structured evidence produced by the Classic Evidence collector",required:!0}],outputs:[{name:"run-state",description:"Atomically synchronized Classic and Run state",required:!0}],success:["Legacy fields and Run fields remain consistent","Every step invokes only a declared public Comet Skill","The completed state passes its completion eval"]},orchestration:{mode:"deterministic",entry:"full.open",steps:[{id:"full.open",action:{type:"invoke_skill",ref:"comet-open"},next:"full.design.handoff"},{id:"full.design.handoff",action:{type:"invoke_skill",ref:"comet-design"},next:"full.design.document"},{id:"full.design.document",action:{type:"invoke_skill",ref:"comet-design"},next:"full.build.plan"},{id:"full.build.plan",action:{type:"invoke_skill",ref:"comet-build"},next:"full.build.plan-ready"},{id:"full.build.plan-ready",action:{type:"invoke_skill",ref:"comet-build"},next:"full.build.configure"},{id:"full.build.configure",action:{type:"invoke_skill",ref:"comet-build"},next:"full.build.execute"},{id:"full.build.execute",action:{type:"invoke_skill",ref:"comet-build"},next:"full.build.complete"},{id:"full.build.complete",action:{type:"invoke_skill",ref:"comet-build"},next:"full.verify.run"},{id:"full.build.fix",action:{type:"invoke_skill",ref:"comet-build"},next:"full.build.execute"},{id:"full.verify.run",action:{type:"invoke_skill",ref:"comet-verify"},next:"full.verify.branch"},{id:"full.verify.branch",action:{type:"invoke_skill",ref:"comet-verify"},next:"full.archive.confirm"},{id:"full.archive.confirm",action:{type:"invoke_skill",ref:"comet-archive"},next:"full.archive.execute"},{id:"full.archive.execute",action:{type:"invoke_skill",ref:"comet-archive"},next:"completed"},{id:"hotfix.open",action:{type:"invoke_skill",ref:"comet-hotfix"},next:"hotfix.build.execute"},{id:"hotfix.build.execute",action:{type:"invoke_skill",ref:"comet-build"},next:"hotfix.build.complete"},{id:"hotfix.build.complete",action:{type:"invoke_skill",ref:"comet-build"},next:"hotfix.verify.run"},{id:"hotfix.verify.run",action:{type:"invoke_skill",ref:"comet-verify"},next:"hotfix.verify.branch"},{id:"hotfix.verify.branch",action:{type:"invoke_skill",ref:"comet-verify"},next:"hotfix.archive.confirm"},{id:"hotfix.archive.confirm",action:{type:"invoke_skill",ref:"comet-archive"},next:"hotfix.archive.execute"},{id:"hotfix.archive.execute",action:{type:"invoke_skill",ref:"comet-archive"},next:"completed"},{id:"tweak.open",action:{type:"invoke_skill",ref:"comet-tweak"},next:"tweak.build.execute"},{id:"tweak.build.execute",action:{type:"invoke_skill",ref:"comet-build"},next:"tweak.build.complete"},{id:"tweak.build.complete",action:{type:"invoke_skill",ref:"comet-build"},next:"tweak.verify.run"},{id:"tweak.verify.run",action:{type:"invoke_skill",ref:"comet-verify"},next:"tweak.verify.branch"},{id:"tweak.verify.branch",action:{type:"invoke_skill",ref:"comet-verify"},next:"tweak.archive.confirm"},{id:"tweak.archive.confirm",action:{type:"invoke_skill",ref:"comet-archive"},next:"tweak.archive.execute"},{id:"tweak.archive.execute",action:{type:"invoke_skill",ref:"comet-archive"},next:"completed"},{id:"completed",action:{type:"checkpoint"},completionEvals:["classic-completed"]}]},skills:[{id:"comet-open"},{id:"comet-design"},{id:"comet-build"},{id:"comet-verify"},{id:"comet-archive"},{id:"comet-hotfix"},{id:"comet-tweak"}],agents:[],tools:[]},guardrails:{allowedSkills:["comet-open","comet-design","comet-build","comet-verify","comet-archive","comet-hotfix","comet-tweak"],allowedAgents:[],allowedTools:[],maxIterations:500,maxRetriesPerAction:3,confirmationRequiredFor:[]},evals:[{id:"classic-completed",scope:"completion",type:"state_equals",field:"status",equals:"completed"}]}}async function $y(){let t=re.dirname(rf(import.meta.url)),e=[process.env.COMET_RUNTIME_CLASSIC_ROOT,re.resolve(t,"..","runtime","classic"),re.resolve(t,"..","..","comet","runtime","classic"),re.resolve(t,"..","..","assets","skills","comet","runtime","classic"),re.resolve("assets","skills","comet","runtime","classic"),process.env.COMET_CLASSIC_SKILL_ROOT,re.resolve(t,"..","..","comet-classic"),re.resolve(t,"..","..","assets","skills","comet-classic"),re.resolve("assets","skills","comet-classic")].filter(n=>!!n);for(let n of e)if(await jy(n))return n;return null}async function Iy(t){return await fi(re.join(t,"skill.yaml"))?Ku(t):Bu(t)}async function di(t){let e=await $y();return tf(t,{skillPackage:e?await Iy(e):Ty(re.dirname(rf(import.meta.url)))})}async function of(t){let e=await Ge(t),n=Array.from(new Set(e.unknownKeys)).sort();if(n.length>0)throw new Error(`Invalid Classic state: unknown field(s): ${n.join(", ")}`);return di(t)}async function sf(t,e,n,r){let i=await Ge(t);if(!i.classic||!i.run)throw new Error("Classic transition requires synchronized Classic and Run projections");let o=await Je(t,{classic:e,run:n,unknownKeys:i.unknownKeys}),s=xt(e,o),a={...n,currentStep:s,iteration:n.iteration+1,status:s==="completed"?"completed":"running"};await ai(t,{classic:e,run:a,unknownKeys:i.unknownKeys});let c=await Vr(t,a.trajectoryRef);return await hn(t,a.trajectoryRef,{sequence:c.length+1,timestamp:new Date().toISOString(),type:"state_transitioned",runId:a.runId,data:{kind:"classic",fromStep:n.currentStep,toStep:s,...r}}),a}var af={"full.open":["openspec.proposal","openspec.tasks"],"full.design.handoff":["openspec.proposal","openspec.design","openspec.tasks"],"full.design.document":["design.handoff"],"full.build.plan":["openspec.tasks"],"full.build.plan-ready":["build.plan"],"full.build.configure":["build.plan"],"full.build.execute":["build.plan"],"full.build.complete":["build.tasks-complete"],"full.verify.run":["build.tasks-complete"],"full.verify.branch":["verification.report"],"full.archive.confirm":["verification.report"],"full.archive.execute":["archive.confirmed"]};function Ly(t){return af[t]?af[t]:t.endsWith(".open")?["openspec.proposal","openspec.tasks"]:t.endsWith(".build.execute")?[]:t.endsWith(".build.complete")?["build.tasks-complete"]:t.endsWith(".verify.run")?["build.tasks-complete"]:t.endsWith(".verify.branch")?["verification.report"]:t.endsWith(".archive.confirm")?["verification.report"]:t.endsWith(".archive.execute")?["archive.confirmed"]:[]}function cf(t,e){let n=Ly(t),r=n.filter(i=>!ct(e,i));return{stepId:t,passed:r.length===0,requiredEvidence:n,missingEvidence:r}}function qy(t){switch(t){case"open":return"/comet-open";case"design":return"/comet-design";case"build":return"/comet-build";case"verify":return"/comet-verify";case"archive":return"/comet-archive";default:return null}}async function lf(t,e){try{let n=await of(t),r=await Je(t,{classic:n.classic,run:n.run,unknownKeys:[]}),i=xt(n.classic,r);return{name:e,valid:!0,workflow:n.classic.workflow,phase:n.classic.phase,currentStep:i,nextCommand:qy(n.classic.phase),runtimeMode:"engine-projection",runtimeEval:cf(i,r),evidence:r}}catch(n){return{name:e,valid:!1,workflow:"unknown",phase:"invalid",currentStep:null,nextCommand:null,runtimeMode:"invalid",runtimeEval:null,evidence:[],error:n instanceof Error?n.message:String(n)}}}Hr();import Wy from"path";var My=Wy.join(".comet","state-events.jsonl"),Dy=8*1024*1024;async function uf(t,e){let n={schemaVersion:1,timestamp:new Date().toISOString(),...e};return await Ur(t,My,`${JSON.stringify(n)}
|
|
150
|
-
`,
|
|
151
|
-
`)};throw f}let h=(0,
|
|
152
|
-
`)}}let g=h.toJS();for(let f of
|
|
153
|
-
`)}):(a.push(
|
|
154
|
-
`)})});ps();He();import
|
|
155
|
-
Next: ask the user to confirm — switch back to '${e}', or run \`comet state rebind ${t}\` after explicit confirmation.`}function Sf(t){return`change '${t}' uses a branch-bound workspace mode but has no bound branch and HEAD is detached; checkout a branch first before continuing.`}var
|
|
142
|
+
`,n)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let n=Or(e),r=Et(n);return r.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let n=Or(e),r=Et(n);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,n){return this.type!=="comment"||this.indent<=n?!1:e.every(r=>r.type==="newline"||r.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};xl.Parser=Qo});var Nl=y(cn=>{"use strict";var Pl=Wo(),Yh=Xt(),an=tn(),Vh=Ii(),Jh=O(),Gh=zo(),Rl=Xo();function Ol(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new Gh.LineCounter||null,prettyErrors:e}}function zh(t,e={}){let{lineCounter:n,prettyErrors:r}=Ol(e),i=new Rl.Parser(n?.addNewLine),o=new Pl.Composer(e),s=Array.from(o.compose(i.parse(t)));if(r&&n)for(let a of s)a.errors.forEach(an.prettifyError(t,n)),a.warnings.forEach(an.prettifyError(t,n));return s.length>0?s:Object.assign([],{empty:!0},o.streamInfo())}function Al(t,e={}){let{lineCounter:n,prettyErrors:r}=Ol(e),i=new Rl.Parser(n?.addNewLine),o=new Pl.Composer(e),s=null;for(let a of o.compose(i.parse(t),!0,t.length))if(!s)s=a;else if(s.options.logLevel!=="silent"){s.errors.push(new an.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return r&&n&&(s.errors.forEach(an.prettifyError(t,n)),s.warnings.forEach(an.prettifyError(t,n))),s}function Qh(t,e,n){let r;typeof e=="function"?r=e:n===void 0&&e&&typeof e=="object"&&(n=e);let i=Al(t,n);if(!i)return null;if(i.warnings.forEach(o=>Vh.warn(i.options.logLevel,o)),i.errors.length>0){if(i.options.logLevel!=="silent")throw i.errors[0];i.errors=[]}return i.toJS(Object.assign({reviver:r},n))}function Xh(t,e,n){let r=null;if(typeof e=="function"||Array.isArray(e)?r=e:n===void 0&&e&&(n=e),typeof n=="string"&&(n=n.length),typeof n=="number"){let i=Math.round(n);n=i<1?void 0:i>8?{indent:8}:{indent:i}}if(t===void 0){let{keepUndefined:i}=n??e??{};if(!i)return}return Jh.isDocument(t)&&!r?t.toString(n):new Yh.Document(t,r,n).toString(n)}cn.parse=Qh;cn.parseAllDocuments=zh;cn.parseDocument=Al;cn.stringify=Xh});var Le=y(A=>{"use strict";var Zh=Wo(),eg=Xt(),tg=yo(),Zo=tn(),ng=Lt(),Ie=O(),rg=Ae(),ig=W(),og=je(),sg=Te(),ag=Pr(),cg=Jo(),lg=zo(),ug=Xo(),Nr=Nl(),jl=jt();A.Composer=Zh.Composer;A.Document=eg.Document;A.Schema=tg.Schema;A.YAMLError=Zo.YAMLError;A.YAMLParseError=Zo.YAMLParseError;A.YAMLWarning=Zo.YAMLWarning;A.Alias=ng.Alias;A.isAlias=Ie.isAlias;A.isCollection=Ie.isCollection;A.isDocument=Ie.isDocument;A.isMap=Ie.isMap;A.isNode=Ie.isNode;A.isPair=Ie.isPair;A.isScalar=Ie.isScalar;A.isSeq=Ie.isSeq;A.Pair=rg.Pair;A.Scalar=ig.Scalar;A.YAMLMap=og.YAMLMap;A.YAMLSeq=sg.YAMLSeq;A.CST=ag;A.Lexer=cg.Lexer;A.LineCounter=lg.LineCounter;A.Parser=ug.Parser;A.parse=Nr.parse;A.parseAllDocuments=Nr.parseAllDocuments;A.parseDocument=Nr.parseDocument;A.stringify=Nr.stringify;A.visit=jl.visit;A.visitAsync=jl.visitAsync});var $r=B(()=>{"use strict"});function qe(t){return t!==0&&t!==0n&&t!=="0"}function Il(t,e){return qe(t.dev)&&qe(e.dev)&&qe(t.ino)&&qe(e.ino)}function We(t,e){let n=qe(t.dev)&&qe(e.dev);if(n&&t.dev!==e.dev)return!1;let r=qe(t.ino)&&qe(e.ino);return r&&t.ino!==e.ino?!1:n&&r?!0:t.birthtime===e.birthtime}var Ir=B(()=>{"use strict"});import{randomUUID as fg}from"crypto";import{constants as dg,promises as I}from"fs";import J from"path";async function ts(t,e){try{return await I.link(t,e),{linked:!0}}catch(n){let r=n.code;if(r!=="ENOTSUP"&&r!=="EOPNOTSUPP")throw n}return await I.copyFile(t,e,dg.COPYFILE_EXCL),{linked:!1}}function ot(t,e){let n=J.relative(t,e);return n===""||!J.isAbsolute(n)&&n!==".."&&!n.startsWith(`..${J.sep}`)}function Lr(t){return{dev:t.dev,ino:t.ino,birthtime:t.birthtimeMs}}function mg(t,e){return We(t,Lr(e))}function qr(t,e){return We(Lr(t),Lr(e))}function Ll(t,e){return qr(t,e)&&t.birthtimeMs===e.birthtimeMs&&t.ctimeMs===e.ctimeMs&&t.mtimeMs===e.mtimeMs&&t.size===e.size}async function Wr(t){let e=await I.lstat(t);if(!e.isDirectory()||e.isSymbolicLink())throw new Error(`Contained atomic write parent must be a real directory: ${t}`);return{path:t,realPath:await I.realpath(t),...Lr(e)}}async function ye(t){for(let e of t){let n=await I.lstat(e.path);if(!n.isDirectory()||n.isSymbolicLink()||!mg(e,n)||await I.realpath(e.path)!==e.realPath)throw new Error(`Contained atomic write parent changed before commit: ${e.path}`)}}async function pg(t,e,n){let[r,i]=await Promise.all([I.lstat(t),I.realpath(t),ye(n)]);if(!r.isFile()||r.isSymbolicLink()||!qr(r,e)||!ot(n[0].realPath,i))throw new Error("Contained atomic write temporary file changed after close");return r}async function hg(t,e){let n=J.resolve(t),r=J.resolve(e);if(!ot(n,r))throw new Error(`Contained atomic write parent is outside its managed root: ${e}`);let i=[await Wr(n)],o=J.relative(n,r).split(J.sep).filter(Boolean),s=n;for(let a of o){await ye(i),s=J.join(s,a);try{await I.mkdir(s)}catch(l){if(l.code!=="EEXIST")throw l}let c=await Wr(s);if(!ot(i[0].realPath,c.realPath))throw new Error(`Contained atomic write parent resolves outside its managed root: ${s}`);i.push(c)}return await ye(i),i}async function gg(t,e){let n=J.resolve(t),r=J.resolve(e);if(!ot(n,r))throw new Error(`Contained file parent is outside its managed root: ${e}`);let i=[await Wr(n)],o=J.relative(n,r).split(J.sep).filter(Boolean),s=n;for(let a of o){s=J.join(s,a);try{let c=await Wr(s);if(!ot(i[0].realPath,c.realPath))throw new Error(`Contained file parent resolves outside its managed root: ${s}`);i.push(c)}catch(c){if(c.code==="ENOENT")return null;throw c}}return await ye(i),i}async function ql(t){let e;try{e=await I.open(t,"r"),await e.sync()}catch(n){let r=n.code;if(!["EACCES","EBADF","EINVAL","EISDIR","ENOTSUP","EPERM"].includes(r??""))throw n}finally{await e?.close()}}async function wg(t,e,n){let r=J.dirname(t),i=await hg(n.containedRoot,r),o=J.join(r,`.${J.basename(t)}.${fg()}.tmp`),s,a,c;try{await n.beforeTemporaryOpen?.(),s=await I.open(o,"wx"),a=await s.stat();let[l,u]=await Promise.all([I.lstat(o),I.realpath(o)]);if(await ye(i),!l.isFile()||l.isSymbolicLink()||!qr(a,l)||!ot(i[0].realPath,u))throw new Error("Contained atomic write temporary file opened outside its managed parent");if(typeof e=="string"?await s.writeFile(e,"utf8"):await s.writeFile(e),await s.sync(),c=await s.stat(),!qr(a,c))throw new Error("Contained atomic write temporary file changed while writing");if(await s.close(),s=void 0,await n.afterTemporaryClose?.(),!c)throw new Error("Contained atomic write temporary file was not written");c=await pg(o,c,i),await n.beforeCommit?.(),await ye(i);let d=await I.lstat(o);if(!d.isFile()||d.isSymbolicLink()||!c||!Ll(d,c))throw new Error("Contained atomic write temporary file changed before commit");n.exclusive?(await ts(o,t),await I.unlink(o)):await I.rename(o,t),await ql(r)}catch(l){await s?.close();try{await ye(i),await I.rm(o,{force:!0})}catch{}throw l}}async function ue(t,e,n){await wg(t,e,n)}async function ns(t,e){let n=J.dirname(t),r=await gg(e.containedRoot,n);if(!r)return!1;let i,o;try{i=await I.lstat(t),o=await I.realpath(t)}catch(c){if(c.code==="ENOENT")return!1;throw c}if(!i.isFile()||i.isSymbolicLink()||!ot(r[0].realPath,o))throw new Error("Contained file removal target must be a regular file inside its managed root");await e.beforeRemove?.(),await ye(r);let[s,a]=await Promise.all([I.lstat(t),I.realpath(t)]);if(!s.isFile()||s.isSymbolicLink()||!Ll(i,s)||a!==o)throw new Error("Contained file removal target changed before removal");return await I.unlink(t),await ye(r),await ql(n),!0}var Fe=B(()=>{"use strict";Ir()});var Wl=B(()=>{"use strict"});var rs=B(()=>{"use strict";$r()});var Fl=B(()=>{"use strict";$r();rs()});import De from"path";function Pg(t,e){if(typeof t!="string")throw new Error(`${e} must be a string`);let n=t.trim();if(n.length===0||De.posix.isAbsolute(n)||De.win32.isAbsolute(n)||/^(?:~|[\\/])/u.test(n))throw new Error(`${e} must be a project-relative path`);if(n===".")return[];let r=n.replaceAll("\\","/").split("/");if(r.some(i=>i===".."))throw new Error(`${e} must stay inside the project root`);if(r.some(i=>i===""||i==="."))throw new Error(`${e} must not contain empty or dot path segments`);return r}function ln(t){let e=Pg(t,"native.artifact_root");return e.length===0?".":e.join("/")}function Yl(t,e="docs"){let n=t??e;if(n!=="legacy"&&n!=="docs")throw new Error("classic.artifact_layout must be legacy or docs");return n}function Me(t,e,n=!1){if(typeof t!="string")throw new Error(`${e} must be a string`);let r=t.trim().replaceAll("\\","/");if(r.length===0||De.posix.isAbsolute(r)||De.win32.isAbsolute(r)||/^(?:~|[\\/])/u.test(r))throw new Error(`${e} must be relative to its declared path base`);let i=r.split("/");if(i.some(o=>o===".."))throw new Error(`${e} must stay inside its declared path base`);if(i.some(o=>o===""||o==="."))throw new Error(`${e} must not contain empty or dot path segments`);if(!n&&/[*?]/u.test(r))throw new Error(`${e} cannot contain wildcards`);return i.join("/")}function ve(t,e){if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`${e} must be a mapping`);return t}function Vl(t,e,n){let r=t??e;if(r!=="en"&&r!=="zh-CN")throw new Error(`${n} must be en or zh-CN`);return r}function Jl(t,e){if(typeof t!="string"||t.length===0||t.includes("\\")||t.includes("\0")||t.startsWith("/")||t.split("/").includes(".."))throw new Error(`${e} contains an unsafe pattern`);if(t.length>os)throw new Error(`${e} exceeds ${os} characters`);let n=0;for(let r=0;r<t.length;r+=1)t[r]==="?"?n+=1:t[r]==="*"&&(n+=1,t[r+1]==="*"&&(r+=1));if(n>ss)throw new Error(`${e} contains more than ${ss} wildcard tokens`);return t}function Kl(t,e,n){if(t===void 0)return[...n];if(!Array.isArray(t))throw new Error(`${e} contains an unsafe pattern`);return[...new Set(t.map(r=>Jl(r,e)))].sort((r,i)=>r.localeCompare(i,"en"))}function is(t,e,n){let r=t??e;if(!Number.isSafeInteger(r)||r<1)throw new Error(`${n} must be a positive integer`);return r}function Rg(t){if(t===void 0)return{...oe,include:[...oe.include],exclude:[...oe.exclude]};let e=ve(t,"native.snapshot");return{include:Kl(e.include,"native.snapshot.include",oe.include),exclude:Kl(e.exclude,"native.snapshot.exclude",oe.exclude),max_files:is(e.max_files,oe.max_files,"native.snapshot.max_files"),max_total_bytes:is(e.max_total_bytes,oe.max_total_bytes,"native.snapshot.max_total_bytes"),max_duration_ms:is(e.max_duration_ms,oe.max_duration_ms,"native.snapshot.max_duration_ms")}}function Og(t){if(t===void 0)return;let e=ve(t,"native.pending_root_move"),n=e.id,r=e.from_artifact_root,i=e.to_artifact_root,o=e.stage;if(typeof n!="string"||!/^[a-f0-9-]{8,}$/u.test(n))throw new Error("native.pending_root_move.id is invalid");if(typeof r!="string"||typeof i!="string")throw new Error("native.pending_root_move roots must be strings");if(o!=="copying"&&o!=="ready"&&o!=="switched")throw new Error("native.pending_root_move.stage is invalid");let s;if(e.cleanup!==void 0){let a=ve(e.cleanup,"native.pending_root_move.cleanup"),c=a.kind,l=a.state,u=a.manifest_hash;if(c!=="forward-source"&&c!=="restart-staging"&&c!=="rollback-destination"&&c!=="rollback-staging")throw new Error("native.pending_root_move.cleanup.kind is invalid");if(l!=="prepared"&&l!=="quarantined"&&l!=="deleting")throw new Error("native.pending_root_move.cleanup.state is invalid");if(typeof u!="string"||!/^[a-f0-9]{64}$/u.test(u))throw new Error("native.pending_root_move.cleanup.manifest_hash is invalid");s={kind:c,state:l,manifestHash:u}}return{id:n,fromArtifactRoot:ln(r),toArtifactRoot:ln(i),stage:o,...s?{cleanup:s}:{}}}function Ag(t){if(t===void 0)return;let e=ve(t,"native.finish");if(e.pull_request===void 0)return{};let n=ve(e.pull_request,"native.finish.pull_request");if(n.provider!=="repository-command")throw new Error("native.finish.pull_request.provider must be repository-command");if(!Array.isArray(n.command)||n.command.length===0)throw new Error("native.finish.pull_request.command must be a non-empty array");if(n.command.length>64)throw new Error("native.finish.pull_request.command must contain at most 64 arguments");let r=n.command.map((o,s)=>{if(typeof o!="string"||o.trim().length===0||o.length>4096||/[\0\r\n]/u.test(o))throw new Error(`native.finish.pull_request.command[${s}] must be a non-empty single-line string of at most 4096 characters`);return o});if(De.posix.isAbsolute(r[0])||De.win32.isAbsolute(r[0]))throw new Error("native.finish.pull_request.command[0] must be a bare executable name or a project-relative path");let i=n.timeout_ms??Cg;if(!Number.isSafeInteger(i)||i<1||i>Bl)throw new Error(`native.finish.pull_request.timeout_ms must be an integer between 1 and ${Bl}`);return{pull_request:{provider:"repository-command",command:r,timeout_ms:i}}}function Ng(t,e={}){let n=ve(t,"native"),r=n.artifact_root??(e.allowMissingArtifactRoot?"docs":void 0);if(typeof r!="string")throw new Error("native.artifact_root must be a string");let i=n.clarification_mode??"batch";if(i!=="sequential"&&i!=="batch")throw new Error("native.clarification_mode must be sequential or batch");let o=n.archive_confirmation??"automatic";if(o!=="automatic"&&o!=="required")throw new Error("native.archive_confirmation must be automatic or required");let s=n.max_verify_failures??Ul;if(!Number.isSafeInteger(s)||s<1)throw new Error("native.max_verify_failures must be a positive integer");let a=Og(n.pending_root_move),c=Ag(n.finish);return{artifact_root:ln(r),language:Vl(n.language,"en","native.language"),clarification_mode:i,archive_confirmation:o,max_verify_failures:s,snapshot:Rg(n.snapshot),...c?{finish:c}:{},...a?{pending_root_move:a}:{}}}function jg(t){let e=ve(t,"classic"),n=e.context_compression??"off";if(n!=="off"&&n!=="beta")throw new Error("classic.context_compression must be off or beta");let r=e.review_mode??"standard";if(r!=="off"&&r!=="standard"&&r!=="thorough")throw new Error("classic.review_mode must be off, standard, or thorough");let i=e.auto_transition??!0;if(typeof i!="boolean")throw new Error("classic.auto_transition must be true or false");return{artifact_layout:Yl(e.artifact_layout),language:Vl(e.language,"zh-CN","classic.language"),context_compression:n,review_mode:r,auto_transition:i}}function Tg(t){let n=ve(t,"hook").allow_paths??[];if(!Array.isArray(n))throw new Error("hook.allow_paths must be an array");return{allow_paths:[...new Set(n.map((r,i)=>Me(r,`hook.allow_paths[${i}]`)))]}}function $g(t){if(t===void 0)return{...Fr};let e=ve(t,"memory"),n=e.learning??Fr.learning,r=e.retrieval??Fr.retrieval;if(typeof n!="boolean")throw new Error("memory.learning must be true or false");if(typeof r!="boolean")throw new Error("memory.retrieval must be true or false");return{learning:n,retrieval:r}}function cs(t,e){if(t===null||typeof t!="object"||Array.isArray(t))throw new Error(`${e} must be a mapping`);return t}function Ig(t,e){if(typeof t!="string")throw new Error(`${e} must be a string`);let n=t.trim();if(n.length===0||n.includes("\\")||n.includes("\0")||De.posix.isAbsolute(n)||De.win32.isAbsolute(n)||n.startsWith("~")||n.split("/").some(i=>i===""||i==="."||i===".."))throw new Error(`${e} must be a safe project-relative glob`);if(!n.toLowerCase().endsWith(".md"))throw new Error(`${e} must target a Markdown file ending in .md`);if(n.length>Dl)throw new Error(`${e} exceeds ${Dl} characters`);let r=0;for(let i=0;i<n.length;i+=1)n[i]==="?"?r+=1:n[i]==="*"&&(r+=1,n[i+1]==="*"&&(i+=1));if(r>Ml)throw new Error(`${e} contains more than ${Ml} wildcard tokens`);return n}function Lg(t){let n=cs(t,"knowledge.local").include??[];if(!Array.isArray(n))throw new Error("knowledge.local.include must be an array");return{include:[...new Set(n.map((r,i)=>Ig(r,`knowledge.local.include[${i}]`)))]}}function qg(t){if(typeof t!="string"||t.trim().length===0)throw new Error("knowledge.remote.endpoint must be a non-empty URL");let e;try{e=new URL(t)}catch{throw new Error("knowledge.remote.endpoint must be a valid URL")}let n=e.hostname.toLowerCase().replace(/^\[|\]$/gu,""),r=n==="localhost"||n==="127.0.0.1"||n==="::1";if(e.protocol!=="https:"&&!(e.protocol==="http:"&&r))throw new Error("knowledge.remote.endpoint must use HTTPS (HTTP is allowed for loopback)");return e.toString()}function Wg(t){let e=cs(t,"knowledge.remote"),n=qg(e.endpoint),r=e.token_env;if(r!==void 0&&(typeof r!="string"||!/^[A-Za-z_][A-Za-z0-9_]*$/u.test(r)))throw new Error("knowledge.remote.token_env must be an environment variable name");let i=e.scope;if(i!==void 0&&(typeof i!="string"||i.length>512))throw new Error("knowledge.remote.scope must be a string of at most 512 characters");let o=e.timeout_ms??5e3;if(typeof o!="number"||!Number.isSafeInteger(o)||o<100||o>3e4)throw new Error("knowledge.remote.timeout_ms must be an integer between 100 and 30000");return{endpoint:n,...r===void 0?{}:{token_env:r},...i===void 0?{}:{scope:i},timeout_ms:o}}function Fg(t){if(t===void 0)return{...Hl};let e=cs(t,"knowledge"),n=e.provider??"local";if(n!=="local"&&n!=="remote")throw new Error("knowledge.provider must be local or remote");let r=e.local===void 0?void 0:Lg(e.local);if(n==="local")return{provider:n,...r?{local:r}:{}};let i=e.remote===void 0?void 0:Wg(e.remote);if(i===void 0)throw new Error("knowledge.remote must be configured when knowledge.provider is remote");return{provider:n,...r?{local:r}:{},remote:i}}function Dg(t){let e=t??!0;if(typeof e!="boolean")throw new Error("ambient_resume must be true or false");return e}function Mg(t,e,n,r,i,o,s,a){let c=t.schema!==void 0;if(!(c||t.default_workflow!==void 0||t.workflows!==void 0||!a.allowPartialProject&&t.native!==void 0)||a.allowPartialProject&&!c)return null;if(t.schema!=="comet.project.v1")throw new Error("Unsupported Comet project schema");if(t.default_workflow!=="native"&&t.default_workflow!=="classic")throw new Error("default_workflow must be native or classic");let u=t.workflows??[t.default_workflow];if(!Array.isArray(u)||u.length===0||u.some(m=>m!=="native"&&m!=="classic"))throw new Error("workflows must contain native and/or classic");let d=[...new Set(u)];if(!d.includes(t.default_workflow))throw new Error("workflows must include default_workflow");if(d.includes("native")&&!i)throw new Error("native must be a mapping");return{schema:"comet.project.v1",default_workflow:t.default_workflow,workflows:d,ambient_resume:s,...e?{hook:e}:{},memory:n,knowledge:r,...i?{native:i}:{},...o?{classic:o}:{}}}function Be(t,e={}){let n=(0,as.parseDocument)(t,{uniqueKeys:!0});if(n.errors.length>0)throw new Error(`Invalid .comet/config.yaml: ${n.errors[0].message}`);let r=n.toJS();if(r==null)return{value:{},config:null,ambient_resume:!0};if(typeof r!="object"||Array.isArray(r))throw new Error("Invalid .comet/config.yaml: root must be a mapping");let i=r,o=Dg(i.ambient_resume),s=i.hook===void 0?void 0:Tg(i.hook),a=$g(i.memory),c=Fg(i.knowledge),l=i.native===void 0?void 0:Ng(i.native,{allowMissingArtifactRoot:e.allowMissingNativeFields}),u=i.classic===void 0?void 0:jg(i.classic),d=Mg(i,s,a,c,l,u,o,{allowPartialProject:e.allowPartialProject??!1});return{value:i,config:d,ambient_resume:o,memory:a,knowledge:c,...s?{hook:s}:{},...l?{native:l}:{},...u?{classic:u}:{}}}function ls(t="docs",e="en"){return{schema:"comet.project.v1",default_workflow:"native",ambient_resume:!0,memory:{...Fr},knowledge:{...Hl},native:{artifact_root:ln(t),language:e,clarification_mode:"batch",archive_confirmation:"automatic",max_verify_failures:Ul,snapshot:{...oe,include:[...oe.include],exclude:[...oe.exclude]}}}}var as,_t,os,ss,Dl,Ml,Ul,Fr,Hl,Cg,Bl,Eg,_g,xg,oe,ke=B(()=>{"use strict";as=Xe(Le(),1),_t=64*1024,os=1024,ss=64,Dl=1024,Ml=64,Ul=5,Fr={learning:!0,retrieval:!0},Hl={provider:"local"},Cg=12e4,Bl=6e5,Eg=[".agents/skills/**",".amazonq/skills/**",".augment/skills/**",".bob/skills/**",".claude/skills/**",".cline/skills/**",".codebuddy/skills/**",".workbuddy/skills/**",".continue/skills/**",".cospec/skills/**",".crush/skills/**",".cursor/skills/**",".devin/skills/**",".dsh/skills/**",".factory/skills/**",".forge/skills/**",".gemini/skills/**",".github/skills/**",".grok/skills/**",".iflow/skills/**",".junie/skills/**",".kilocode/skills/**",".kimi-code/skills/**",".kiro/skills/**",".lingma/skills/**",".mimocode/skills/**",".opencode/skills/**",".omp/skills/**",".pi/skills/**",".qoder/skills/**",".qwen/skills/**",".roo/skills/**",".trae-cn/skills/**",".trae/skills/**",".windsurf/skills/**",".zcode/skills/**"],_g=["**/.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"],xg=[...Eg,..._g].sort((t,e)=>t.localeCompare(e,"en")),oe={include:["**/*"],exclude:[...xg],max_files:1e4,max_total_bytes:256*1024*1024,max_duration_ms:6e4}});import{constants as Dr,promises as st}from"fs";function us(t){return"birthtimeNs"in t&&typeof t.birthtimeNs=="bigint"?t.birthtimeNs:t.birthtimeMs}function Gl(t){return"ctimeNs"in t&&typeof t.ctimeNs=="bigint"?t.ctimeNs:t.ctimeMs}function un(t){return{dev:t.dev,ino:t.ino,birthtime:us(t)}}function Mr(t,e){let n=un(t),r=un(e);return Il(n,r)?We(n,r):We(n,r)&&us(t)===us(e)&&Gl(t)===Gl(e)&&t.size===e.size}async function zl(t,e,n={}){if(!Number.isSafeInteger(e)||e<1)throw new Error("race-safe read byte limit must be a positive integer");let r=n.label??"file",i=n.bigint===!0,o=await st.lstat(t,{bigint:i});if(!o.isFile()||o.isSymbolicLink())throw new Ke("not-regular-file",`${r} must be a regular file`);if(BigInt(o.size)>BigInt(e))throw new Ke("too-large",`${r} exceeds ${e} bytes`);let s=await st.realpath(t);await n.verify?.("pre-open",{realPath:s,identity:un(o)});let a=process.platform==="win32"?Dr.O_RDONLY:Dr.O_RDONLY|Dr.O_NOFOLLOW|Dr.O_NONBLOCK,c;try{c=await st.open(t,a)}catch(l){throw l.code==="ELOOP"?new Ke("not-regular-file",`${r} must be a regular file`,{cause:l}):l}try{let[l,u,d]=await Promise.all([c.stat({bigint:i}),st.lstat(t,{bigint:i}),st.realpath(t)]);if(!l.isFile()||!u.isFile()||u.isSymbolicLink()||d!==s||!Mr(o,l)||!Mr(o,u))throw new Ke("changed",`${r} changed while opening`);await n.verify?.("post-open",{realPath:d,identity:un(l)}),await n.hooks?.afterOpen?.();let m=[],h=0,g=Buffer.allocUnsafe(Math.min(64*1024,e+1));for(;;){let v=e+1-h,{bytesRead:b}=await c.read(g,0,Math.min(g.length,v),null);if(b===0)break;if(h+=b,h>e)throw new Ke("too-large",`${r} exceeds ${e} bytes`);m.push(Buffer.from(g.subarray(0,b)))}await n.hooks?.beforeFinalCheck?.();let[f,p,w]=await Promise.all([c.stat({bigint:i}),st.lstat(t,{bigint:i}),st.realpath(t)]);if(!p.isFile()||p.isSymbolicLink()||w!==s||!Mr(o,f)||!Mr(o,p))throw new Ke("changed",`${r} changed while reading`);return await n.verify?.("post-read",{realPath:w,identity:un(f)}),{bytes:Buffer.concat(m,h),stat:f,realPath:w}}finally{await c.close()}}var Ke,Ql=B(()=>{"use strict";Ir();Ke=class extends Error{reason;constructor(e,n,r){super(n,r),this.name="RaceSafeReadError",this.reason=e}}});import{promises as Br}from"fs";import Ue from"path";function Bg(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}function fs(t,e){let n=Ue.relative(t,e);return n===""||!Ue.isAbsolute(n)&&n!==".."&&!n.startsWith(`..${Ue.sep}`)}async function Xl(t,e){let n=Ue.resolve(t),r=await Br.lstat(n);if(!r.isDirectory()||r.isSymbolicLink())throw new Error(`${e} project root must be a real directory`);return Br.realpath(n)}async function Zl(t,e,n,r){let i=t;for(let o=0;o<n.length;o++){i=Ue.join(i,n[o]);let s;try{s=await Br.lstat(i)}catch(u){if(Bg(u))return{exists:!1,kind:"missing"};throw u}let a=Ue.relative(t,i).replaceAll("\\","/");if(s.isSymbolicLink())throw new Error(`${r.label} crosses a symbolic link or junction at ${a}`);let c=o===n.length-1;if(!c&&!s.isDirectory())throw new Error(`${r.label} ancestor ${a} must be a real directory`);if(c&&(r.expected==="file"&&!s.isFile()||r.expected==="directory"&&!s.isDirectory()||r.expected==="any"&&!s.isFile()&&!s.isDirectory()))throw new Error(`${r.label} must be a real ${r.expected}`);let l=await Br.realpath(i);if(!fs(e,l))throw new Error(`${r.label} resolves outside the project root`);if(c)return{exists:!0,kind:s.isFile()?"file":s.isDirectory()?"directory":"missing"}}return{exists:!0,kind:"directory"}}async function q(t,e,n){let r=Me(e,n.label),i=Ue.resolve(t),o=await Xl(i,n.label),s=r.split("/"),a=Ue.resolve(i,...s);if(!fs(i,a))throw new Error(`${n.label} must stay inside the project root`);let c=await Zl(i,o,s,n);return{projectRoot:i,target:a,relative:r,exists:c.exists,kind:c.kind}}async function Kr(t,e,n){return(await q(t,e,{...n,expected:"file"})).exists}async function Y(t,e,n,r){let i=await q(t,e,{label:r.label,expected:"file"});if(!i.exists){let s=new Error(`${r.label} does not exist`);throw s.code="ENOENT",s}let o=await Xl(i.projectRoot,r.label);return zl(i.target,n,{...r,verify:async(s,a)=>{if(!fs(o,a.realPath))throw new Error(`${r.label} resolves outside the project root`);await Zl(i.projectRoot,o,i.relative.split("/"),{label:r.label,expected:"file"})}})}var se=B(()=>{"use strict";Ql();ke()});function Kg(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}function Ug(t){let e=(0,tu.parseDocument)(t,{uniqueKeys:!0});if(e.errors.length>0)throw new Error(`Invalid global Comet config: ${e.errors[0].message}`);let n=e.toJS();if(n==null)return{};if(typeof n!="object"||Array.isArray(n))throw new Error("Invalid global Comet config: root must be a mapping");return n}function ru(t){if(t.native?.pending_root_move)throw new Error("Global Comet config cannot contain native.pending_root_move");let e=t.native?(({pending_root_move:n,...r})=>r)(t.native):void 0;return{...t,schema:"comet.global.v1",...e?{native:e}:{}}}function Hg(t){let e=Be(JSON.stringify({...t,schema:"comet.project.v1"})).config;if(!e)throw new Error("Invalid global Comet config: workflow template is incomplete");return ru(e)}function Yg(t){let e=Be(t,{allowPartialProject:!0,allowMissingNativeFields:!0});if(!e.native&&!e.classic)return null;let n=e.native?"native":"classic",r=e.native?.language??e.classic?.language??"en",i=ls(e.native?.artifact_root??"docs",r);return{schema:"comet.global.v1",default_workflow:n,workflows:[n],ambient_resume:e.ambient_resume,...e.native?{native:{...i.native,...e.native}}:{},...e.classic?{classic:e.classic}:{}}}function iu(t){let e=Ug(t);if(Object.keys(e).length===0)return null;if(e.schema===void 0)return Yg(t);if(e.schema!=="comet.global.v1")throw new Error("Unsupported Comet global schema");return Hg(e)}async function ms(t){try{let e=await Y(t,nu,_t,{label:"global Comet config"});return iu(e.bytes.toString("utf8"))}catch(e){if(Kg(e))return null;throw e}}var tu,nu,ps=B(()=>{"use strict";tu=Xe(Le(),1);Fe();ke();se();nu=".comet/config.yaml"});import{createHash as Vg}from"crypto";function Jg(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}async function be(t,e={}){return(await Ur(t,e)).document}async function Gg(t){try{return(await Y(t,fn,_t,{label:fn})).bytes}catch(e){if(Jg(e))return null;throw e}}function zg(t){return t?{exists:!0,sha256:Vg("sha256").update(t).digest("hex")}:{exists:!1,sha256:null}}async function Ur(t,e={}){let n=await Gg(t);return{document:n?Be(n.toString("utf8"),e):null,identity:zg(n)}}async function hs(t){return(await be(t))?.config??null}var fn,He=B(()=>{"use strict";ke();se();fn=".comet/config.yaml"});var aS,gs=B(()=>{"use strict";Fe();He();se();aS=16*1024});var ws=B(()=>{"use strict";Fe();ke();He();se();gs()});var yS,su=B(()=>{"use strict";Fe();se();yS=4*1024*1024});function cu(t,e){let n=t;for(let r of e)n+="\0"+(typeof r=="string"?r:JSON.stringify(r));return n}function lu(t,e){return(...n)=>{let r=au;if(r===null)return e(...n);let i=cu(`async:${t}`,n),o=r.entries.get(i);if(o)return o.value;let s=e(...n).catch(a=>{throw r.entries.delete(i),a});return r.entries.set(i,{value:s}),s}}function ys(t,e){return(...n)=>{let r=au;if(r===null)return e(...n);let i=cu(`sync:${t}`,n),o=r.entries.get(i);if(o)return o.value;let s=e(...n);return r.entries.set(i,{value:s}),s}}var au,vs=B(()=>{"use strict";au=null});var CS,uu=B(()=>{"use strict";vs();He();CS=lu("hookWritePolicy",async t=>(await hs(t))?.hook??{allow_paths:[]})});var fu=B(()=>{"use strict";$r();Fe();Wl();Fl();ke();ps();se();He();ws();su();uu();gs();rs()});import{TextDecoder as nw}from"util";function du(t){return{dev:t.dev,ino:t.ino,birthtime:t.birthtimeMs}}function rw(t,e){try{return new nw("utf-8",{fatal:!0}).decode(t.bytes)}catch(n){throw new Error(`${e} is not valid UTF-8`,{cause:n})}}async function ks(t,e,n,r,i={}){try{let o=await Y(t,e,n,{label:r,hooks:i.hooks});return{result:o,text:rw(o,r)}}catch(o){let s=o.code;if(s==="ENOENT"||s==="ENOTDIR")return null;throw o}}async function dn(t,e,n,r,i={}){return(await ks(t,e,n,r,i))?.text??null}async function at(t,e,n,r,i,o={}){if(Buffer.byteLength(n,"utf8")>r)throw new Error(`${i} exceeds ${r} bytes`);let s=await ks(t,e,r,i),a=await q(t,e,{label:i,expected:"file"});await ue(a.target,n,{containedRoot:a.projectRoot,beforeCommit:async()=>{await o.beforeCommit?.();let c=await ks(t,e,r,i);if(!(!s&&!c)){if(!s||!c)throw new Error(`${i} changed before commit`);if(s.result.realPath!==c.result.realPath||!We(du(s.result.stat),du(c.result.stat))||s.text!==c.text)throw new Error(`${i} changed before commit`)}}})}async function Hr(t,e,n,r,i,o={}){let s=await dn(t,e,r,i);await at(t,e,`${s??""}${n}`,r,i,o)}async function bs(t,e,n,r={}){let i=await q(t,e,{label:n,expected:"file"});return i.exists?ns(i.target,{containedRoot:i.projectRoot,beforeRemove:r.beforeRemove}):!1}var Yr=B(()=>{"use strict";fu();Ir()});var Pu={};Lf(Pu,{RUN_STATE_FILE:()=>ni,applyRunStateToDocument:()=>_s,readRunState:()=>xs,removeRunState:()=>Ps,runStateFromDocument:()=>ti,writeRunState:()=>ri});import Aw from"path";function _n(t,e){let n=t[e];if(typeof n!="string"||n.length===0)throw new Error(`Invalid Run state: ${e} must be a non-empty string`);return n}function En(t,e){let n=_n(t,e);if(Aw.isAbsolute(n)||/^(?:[A-Za-z]:|[\\/]|~)/u.test(n)||n.split(/[\\/]/u).includes(".."))throw new Error(`Invalid Run state: ${e} must stay inside the change directory`);return n}function Nw(t){let e=t.run_retries??"{}",n;try{n=typeof e=="string"?JSON.parse(e):e}catch(r){throw new Error("Invalid Run state: run_retries must be a JSON object",{cause:r})}if(!n||typeof n!="object"||Array.isArray(n))throw new Error("Invalid Run state: run_retries must be a JSON object");for(let r of Object.values(n))if(!Number.isInteger(r)||Number(r)<0)throw new Error("Invalid Run state: retry counts must be non-negative integers");return n}function ti(t){if(!t.run_id)return null;let e=_n(t,"run_id"),n=_n(t,"skill"),r=_n(t,"skill_version"),i=_n(t,"skill_hash"),o=En(t,"pending_ref"),s=En(t,"trajectory_ref"),a=En(t,"context_ref"),c=En(t,"artifacts_ref"),l=En(t,"checkpoint_ref"),u=Number(t.iteration);if(!Number.isInteger(u)||u<0)throw new Error("Invalid Run state: iteration must be a non-negative integer");if(t.orchestration!=="deterministic"&&t.orchestration!=="adaptive")throw new Error("Invalid Run state: orchestration must be deterministic or adaptive");if(t.run_status!=="running"&&t.run_status!=="waiting"&&t.run_status!=="completed"&&t.run_status!=="failed")throw new Error("Invalid Run state: run_status is invalid");return{runId:e,skill:n,skillVersion:r,skillHash:i,orchestration:t.orchestration,currentStep:_u(t,"current_step"),iteration:u,pending:_u(t,"pending"),pendingRef:o,trajectoryRef:s,contextRef:a,artifactsRef:c,checkpointRef:l,status:t.run_status,retries:Nw(t)}}function _s(t,e){e?t.run_id=e.runId:delete t.run_id}function jw(t){return{runId:t.runId,skill:t.skill,skillVersion:t.skillVersion,skillHash:t.skillHash,orchestration:t.orchestration,currentStep:t.currentStep,iteration:t.iteration,pending:t.pending,pendingRef:t.pendingRef,trajectoryRef:t.trajectoryRef,contextRef:t.contextRef,artifactsRef:t.artifactsRef,checkpointRef:t.checkpointRef,status:t.status,retries:t.retries}}function Tw(t){let e={run_id:t.runId,skill:t.skill,skill_version:t.skillVersion,skill_hash:t.skillHash,orchestration:t.orchestration,current_step:t.currentStep,iteration:t.iteration,pending:t.pending,pending_ref:t.pendingRef,trajectory_ref:t.trajectoryRef,context_ref:t.contextRef,artifacts_ref:t.artifactsRef,checkpoint_ref:t.checkpointRef,run_status:t.status,run_retries:JSON.stringify(t.retries)};return ti(e)}async function xs(t,e={}){let n=await dn(t,ni,xu,"Run state",e);if(n===null)return null;let r=JSON.parse(n);return Tw(r)}async function ri(t,e,n={}){await at(t,ni,JSON.stringify(jw(e),null,2),xu,"Run state",n)}async function Ps(t,e={}){await bs(t,ni,"Run state",e)}var _u,ni,xu,ii=B(()=>{"use strict";Yr();_u=(t,e)=>{let n=t[e];return n==null?null:String(n)};ni=".comet/run-state.json",xu=256*1024});var _f=Xe(Le(),1);import{spawnSync as fv}from"child_process";import{createHash as Ef}from"crypto";import{promises as dv}from"fs";import T from"path";function Tl(t){return t==="zh-CN"?"zh-CN":"en"}function Tr(t,e,n){return t==="zh-CN"?n:e}var es={open:{en:"open (clarifying the request)",zh:"open(需求澄清)"},design:{en:"design",zh:"design(方案设计)"},build:{en:"build",zh:"build(实现)"},verify:{en:"verify",zh:"verify(验证)"},archive:{en:"archive",zh:"archive(归档)"}};function jr(t,e){return es[t]?Tr(e,es[t].en,es[t].zh):t}function $l(t){let{name:e,phase:n,failed:r,total:i,locale:o}=t;return r===0?{summary:Tr(o,`Change ${e} passed every check for leaving the ${jr(n,o)} stage (${i} total) and is ready to proceed.`,`需求 ${e} 通过了离开 ${jr(n,o)}阶段的全部 ${i} 项检查,可以继续推进。`)}:{summary:Tr(o,`Change ${e} is not ready to leave the ${jr(n,o)} stage yet: ${r} of ${i} checks failed. The failing items below are the Agent's checklist, not user actions.`,`需求 ${e} 暂时还不能离开 ${jr(n,o)}阶段:${r}/${i} 项检查未通过。下方的失败项是给 Agent 的检查清单,不需要用户处理。`),user_message:Tr(o,"A few preparation items are still missing before this change can move to the next stage; the Agent is filling them in and will continue afterwards.","这条需求要进入下一阶段还差几项准备工作;Agent 正在补齐,之后会自动继续。")}}import Gr from"path";Yr();import Vr from"path";var mn={trajectory:8*1024*1024,artifacts:1024*1024,context:1024*1024,pendingAction:256*1024,checkpoint:256*1024};function pn(t,e){if(Vr.isAbsolute(e))throw new Error("Run path must stay inside the change directory");let n=Vr.resolve(t),r=Vr.resolve(n,e);if(r!==n&&!r.startsWith(n+Vr.sep))throw new Error("Run path must stay inside the change directory")}async function hn(t,e,n,r={}){pn(t,e),await Hr(t,e,`${JSON.stringify(n)}
|
|
143
|
+
`,mn.trajectory,"Run trajectory",r)}async function Jr(t,e,n={}){pn(t,e);let r=await dn(t,e,mn.trajectory,"Run trajectory",n);return r===null?[]:r.split(/\r?\n/).map((i,o)=>({line:i,number:o+1})).filter(({line:i})=>i.length>0).map(({line:i,number:o})=>{try{return JSON.parse(i)}catch(s){throw new Error(`Invalid Trajectory event at line ${o}`,{cause:s})}})}async function mu(t,e,n,r={}){pn(t,e),await at(t,e,JSON.stringify(n,null,2)+`
|
|
144
|
+
`,mn.artifacts,"Run artifacts",r)}async function pu(t,e,n,r={}){pn(t,e),await at(t,e,n,mn.context,"Run context",r)}async function hu(t,e,n,r={}){pn(t,e),await at(t,e,JSON.stringify(n,null,2)+`
|
|
145
|
+
`,mn.checkpoint,"Run checkpoint",r)}function iw(t){if(t!=="build"&&t!=="verify")throw new Error(`Invalid command check scope: '${String(t)}'`)}function ow(t,e="."){if(e.trim().length===0)throw new Error("Command check cwd cannot be blank");let n=Gr.resolve(t),r=Gr.resolve(n,e);if(r!==n&&!r.startsWith(n+Gr.sep))throw new Error(`Command check cwd must resolve within the project root: '${e}'`);return Gr.relative(n,r).replaceAll("\\","/")||"."}function sw(t,e){if(e.type!=="command_check_recorded")return null;let n=e.data;if(typeof n!="object"||n===null||Array.isArray(n))return null;let{scope:r,command:i,exitCode:o,cwd:s}=n;if(r!=="build"&&r!=="verify"||typeof i!="string"||i.trim().length===0||!Number.isInteger(o)||typeof s!="string")return null;let a;try{a=ow(t,s)}catch{return null}return{sequence:e.sequence,timestamp:e.timestamp,runId:e.runId,scope:r,command:i,exitCode:o,cwd:a}}async function gu(t,e,n,r){iw(r);let i=await Jr(e,n.trajectoryRef);for(let o=i.length-1;o>=0;o-=1){let s=i[o];if(s.runId!==n.runId)continue;let a=sw(t,s);if(a?.scope===r)return a}return null}import{promises as kw}from"fs";import Se from"path";import{promises as yu}from"fs";import L from"path";import{promises as aw}from"fs";async function gn(t){try{return await aw.access(t),!0}catch(e){if(cw(e))return!1;throw e}}function cw(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}ke();He();ws();se();var wn=class extends Error{code="classic-layout-unavailable";constructor(e="Classic artifact layout is unavailable from .comet/config.yaml"){super(e),this.name="ClassicLayoutUnavailableError"}},wu=".comet/config.yaml";function vu(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}async function ku(t){await q(t,wu,{label:wu,expected:"file"})}function zr(t,e){let n=L.resolve(t),r=e==="docs"?L.join(n,"docs"):n,i=L.join(r,"openspec"),o=L.join(n,"docs","superpowers");return{projectRoot:n,artifactLayout:e,openSpecBase:r,openSpecRoot:i,changesDir:L.join(i,"changes"),archiveDir:L.join(i,"changes","archive"),specsDir:L.join(i,"specs"),superpowersRoot:o,superpowersSpecsDir:L.join(o,"specs"),superpowersPlansDir:L.join(o,"plans"),superpowersReportsDir:L.join(o,"reports")}}async function lw(t){await ku(t);let e=await be(t,{allowPartialProject:!0,allowMissingNativeFields:!0});if(!e?.config)throw new wn;if(!(e.config.workflows??[e.config.default_workflow]).includes("classic"))throw new wn("Classic artifact layout is unavailable because Classic is not enabled");return e.classic?.artifact_layout??"legacy"}async function uw(t,e){return zr(t,e??await lw(t))}async function fw(t){try{return await yu.lstat(t),!0}catch(e){if(vu(e))return!1;throw e}}async function dw(t,e){let n=await uw(t,e),r=n.artifactLayout==="legacy"?"docs":"legacy",i=zr(t,r).openSpecRoot,[o,s]=await Promise.all([q(n.projectRoot,z(n.projectRoot,n.openSpecRoot),{label:"Configured Classic OpenSpec root",expected:"directory"}),fw(i)]),a=o.exists;return{paths:n,configuredRootExists:a,alternateRoot:i,alternateRootExists:s,dualRoots:a&&s}}async function mw(t){let e=[t.openSpecRoot,t.changesDir,t.archiveDir,t.specsDir,t.superpowersRoot,t.superpowersSpecsDir,t.superpowersPlansDir,t.superpowersReportsDir];for(let n of e){let r=z(t.projectRoot,n);await q(t.projectRoot,r,{label:`Classic managed physical path ${r}`,expected:"directory"})}}async function Ye(t,e){let n=await dw(t,e);if(await mw(n.paths),!n.configuredRootExists){let r=z(n.paths.projectRoot,n.paths.openSpecRoot),i=z(n.paths.projectRoot,n.alternateRoot);throw new wn(`Configured Classic OpenSpec root is missing: ${r} (alternate ${i} is ${n.alternateRootExists?"present":"missing"})`)}return n.paths}async function Ss(t,e){let n=L.join(L.resolve(t),".comet","classic-root-move.json");if(await gn(n))throw new Error("Classic root move transaction is incomplete; inspect it with comet doctor and recover it explicitly before writing");let r=await Ye(t,e);if(!await gn(r.openSpecRoot))throw new Error(`Configured Classic OpenSpec root is missing: ${z(r.projectRoot,r.openSpecRoot)}`);return r}async function ct(t){let e=L.resolve(t),n=null;try{(await yu.lstat(e)).isDirectory()||(e=L.dirname(e))}catch(r){if(!vu(r))throw r}for(;;){L.basename(e)==="openspec"&&(n=L.dirname(e));let r=L.join(e,".comet","config.yaml"),i=!1;if(await gn(r))try{await ku(e);let s=(await be(e))?.value;i=!!s&&typeof s=="object"&&!Array.isArray(s)&&(s.schema==="comet.project.v1"||s.default_workflow!==void 0||s.native!==void 0)}catch{}if(i||await gn(L.join(e,".git")))return e;let o=L.dirname(e);if(o===e)return n??L.resolve(t);e=o}}function z(t,e){return L.relative(L.resolve(t),e).replaceAll("\\","/")}se();ke();import bn from"path";import{promises as hw}from"fs";import Xr from"path";Fe();ke();se();import yn from"path";var pw=2*1024*1024;function bu(t,e,n){let r=yn.resolve(t),i=yn.isAbsolute(e)?yn.resolve(e):yn.resolve(r,e),o=yn.relative(r,i).replaceAll("\\","/");return{root:r,relative:Me(o,n),target:i}}async function Ve(t,e,n){let r=bu(t,e,n.label);return q(r.root,r.relative,n)}async function vn(t,e,n){return(await Ve(t,e,{label:n.label,expected:n.expected??"any"})).exists}async function Su(t,e,n,r){return await vn(t,e,{label:n,expected:"file"})?(await Qr(t,e,{label:n,hooks:r})).byteLength>0:!1}async function te(t,e,n){return(await Qr(t,e,n)).toString("utf8")}async function Qr(t,e,n){let r=bu(t,e,n.label);return(await Y(r.root,r.relative,n.maxBytes??pw,{label:n.label,hooks:n.hooks})).bytes}function kn(t){return t?/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u.test(t)?t.includes("..")?"Change name cannot contain '..' (path traversal not allowed)":null:`Invalid change name: '${t}'
|
|
146
|
+
Valid format: lowercase kebab-case (a-z, 0-9, single hyphens)`:"Change name cannot be empty"}function Es(t){let e=kn(t);if(e)throw new Error(e)}function gw(t,e){return{label:z(t,e),directory:e}}async function Cs(t,e,n){let r=gw(t,e);if(!(await Ve(t,e,{label:n,expected:"directory"})).exists)return{change:r,exists:!1,stateExists:!1};let o=await Ve(t,Xr.join(e,".comet.yaml"),{label:`${n} state`,expected:"file"});return{change:r,exists:!0,stateExists:o.exists}}function ww(t,e){let n=e.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&");return new RegExp(`^\\d{4}-\\d{2}-\\d{2}-${n}$`,"u").test(t)}async function yw(t,e,n,r={}){if(!r.skipExactCompatibility){let s=await Cs(t,Xr.join(e,n),`Classic archived change ${n}`);if(s.exists)return s.change}if(!(await Ve(t,e,{label:"Classic archive directory",expected:"directory"})).exists)return null;let o=[];for(let s of await hw.readdir(e,{withFileTypes:!0})){if(!ww(s.name,n))continue;let a=await Cs(t,Xr.join(e,s.name),`Classic archived change ${s.name}`);a.exists&&a.stateExists&&o.push(a.change)}return o.sort((s,a)=>a.directory.localeCompare(s.directory))[0]??null}async function Zr(t,e=process.cwd()){Es(t);let n=await Ye(e),r=await Cs(n.projectRoot,Xr.join(n.changesDir,t),`Classic active change ${t}`);if(r.exists)return r.change;let i=await yw(n.projectRoot,n.archiveDir,t);return i||r.change}function vw(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}async function Cu(t,e,n,r){let i=Me(n,"Classic handoff artifact pointer");if((await q(t,i,{label:"Classic handoff artifact",expected:"file"})).exists)return null;let s=await Ye(t),a=`${z(t,s.changesDir)}/`,l=(s.artifactLayout==="docs"?[a,"openspec/changes/"]:[a]).find(v=>i.startsWith(v));if(!l)return null;let u=i.slice(l.length).split("/");if(u.length<4||u[1]!==".comet"||u.slice(2).some(v=>v.length===0))return null;let d=u[0];Es(d);let m=u.slice(2),h=bn.resolve(e);if(bn.dirname(h)!==bn.resolve(s.archiveDir))return null;let g=bn.basename(h),f=/^\d{4}-\d{2}-\d{2}-(.+)$/u.exec(g);if(g!==d&&f?.[1]!==d)return null;await q(t,z(t,h),{label:"Classic archived change directory",expected:"directory"});let p=bn.join(h,".comet",...m),w=z(t,p);try{return await Y(t,w,r,{label:"Historical Classic archived handoff artifact"}),w}catch(v){if(vw(v))return null;throw v}}se();var Eu=2*1024*1024;function Sn(t,e){return Se.relative(t,e).split(Se.sep).join("/")}async function Cn(t,e,n,r,i){if(!n)return{code:e,satisfied:!1};let o=n.replaceAll("\\","/");if(i)return{code:e,satisfied:!1,source:o,detail:`Classic layout is unsafe or unavailable: ${i instanceof Error?i.message:String(i)}`};try{if(r){let a=r.artifactLayout==="legacy"?"docs":"legacy",c=z(t,zr(t,a).openSpecRoot);if((o===c||o.startsWith(`${c}/`))&&(await q(t,o,{label:`${e} artifact`,expected:"file"})).exists)return{code:e,satisfied:!1,source:o,detail:"standalone OpenSpec root is not a Comet artifact root"}}let s=await Kr(t,o,{label:`${e} artifact`});return{code:e,satisfied:s,source:o,...s?{resolvedSource:o}:{}}}catch(s){return{code:e,satisfied:!1,source:o,detail:`unsafe artifact pointer outside the project or through a special path: ${s instanceof Error?s.message:String(s)}`}}}async function bw(t,e,n,r){try{r??=await Ye(t)}catch(o){return{code:"design.handoff",satisfied:!1,...n?{source:n.replaceAll("\\","/")}:{},detail:`Classic layout is unsafe or unavailable for handoff evidence: ${o instanceof Error?o.message:String(o)}`}}let i=await Cn(t,"design.handoff",n,r);if(!n||i.satisfied||i.detail)return i;try{let o=await Cu(t,e,n,Eu);return o?{...i,satisfied:!0,resolvedSource:o,detail:`resolved historical legacy pointer from archived change: ${o}`}:i}catch(o){return{...i,satisfied:!1,detail:`unsafe archived handoff fallback: ${o instanceof Error?o.message:String(o)}`}}}async function ei(t,e,n){return Cn(t,e,Sn(t,n))}async function Sw(t,e){let n=Se.join(e,"specs"),r;try{let s=Sn(t,n);if(!(await q(t,s,{label:"OpenSpec delta-spec directory",expected:"directory"})).exists)return{code:"openspec.delta-spec",satisfied:!1};r=await kw.readdir(n)}catch(s){return s.code==="ENOENT"?{code:"openspec.delta-spec",satisfied:!1}:{code:"openspec.delta-spec",satisfied:!1,detail:`unsafe delta-spec path: ${s instanceof Error?s.message:String(s)}`}}let i=r.map(s=>Se.join(n,s,"spec.md")),o=(await Promise.all(i.map(async s=>{try{return await Kr(t,Sn(t,s),{label:"OpenSpec delta spec"})?s:null}catch{return null}}))).filter(s=>s!==null);return{code:"openspec.delta-spec",satisfied:o.length>0,source:o[0]?Sn(t,o[0]):void 0,detail:`${o.length} delta spec${o.length===1?"":"s"}`}}async function Cw(t,e){let n,r=Sn(t,e);try{n=(await Y(t,r,Eu,{label:"Classic tasks artifact"})).bytes.toString("utf8")}catch(s){return s.code==="ENOENT"?{code:"build.tasks-complete",satisfied:!1}:{code:"build.tasks-complete",satisfied:!1,source:r,detail:`unsafe tasks artifact: ${s instanceof Error?s.message:String(s)}`}}let i=[...n.matchAll(/^\s*[-*]\s+\[([ xX])\]\s+/gmu)],o=i.filter(s=>s[1].toLowerCase()==="x").length;return{code:"build.tasks-complete",satisfied:i.length>0&&o===i.length,source:r,detail:`${o} of ${i.length} tasks complete`}}function lt(t,e){return t.some(n=>n.code===e&&n.satisfied)}async function Je(t,e){let n=await ct(t),r=e.classic,i=Se.join(t,"proposal.md"),o=Se.join(t,"design.md"),s=Se.join(t,"tasks.md"),a=e.run?Se.resolve(t,e.run.checkpointRef):Se.join(t,".comet","checkpoint.json"),c,l;try{c=await Ye(n)}catch(m){l=m}let u=await Promise.all([ei(n,"openspec.proposal",i),ei(n,"openspec.design",o),ei(n,"openspec.tasks",s),Sw(n,t),Cn(n,"design.document",r?.designDoc??null,c,l),Cn(n,"build.plan",r?.plan??null,c,l),Cw(n,s),Cn(n,"verification.report",r?.verificationReport??null,c,l),bw(n,t,r?.handoffContext??null,c),ei(n,"run.checkpoint",a)]),d=u.find(m=>m.code==="design.handoff");return d&&!r?.handoffHash&&(d.satisfied=!1,d.detail="handoff hash is missing"),u.push({code:"archive.confirmed",satisfied:r?.archiveConfirmation==="confirmed"}),u}import{promises as nf}from"fs";import re from"path";import{fileURLToPath as rf}from"url";import{createHash as _y,randomUUID as xy}from"crypto";import{promises as Is}from"fs";import Ce from"path";function Ew(t){return t.classicProfile??t.workflow}function _w(t){return!t.buildMode||!t.tddMode||!t.isolation||!t.verifyMode?!1:t.buildMode==="subagent-driven-development"?t.subagentDispatch==="confirmed":t.buildMode==="direct"?t.directOverride===!0:!0}function xw(t){return t.buildMode==="direct"&&t.tddMode==="direct"&&t.isolation!==null&&t.verifyMode==="light"}function Pw(t,e,n){if(e.verifyResult==="fail")return t==="full"?"full.build.fix":`${t}.build.execute`;if(t==="full"){if(!lt(n,"build.plan"))return"full.build.plan";if(e.buildPause==="plan-ready")return"full.build.plan-ready";if(!_w(e))return"full.build.configure"}else if(!xw(e))throw new Error(`${t} build configuration is incomplete`);return lt(n,"build.tasks-complete")?`${t}.build.complete`:`${t}.build.execute`}function Rw(t,e,n){return e.verifyResult!=="pass"||!lt(n,"verification.report")?`${t}.verify.run`:`${t}.verify.branch`}function Ow(t,e){if(e.verifyResult!=="pass")throw new Error("archive requires verify_result=pass");return e.archiveConfirmation==="confirmed"?`${t}.archive.execute`:`${t}.archive.confirm`}function xt(t,e){let n=Ew(t);if(t.archived&&t.phase!=="archive")throw new Error("archived=true requires phase=archive");if(t.archived)return"completed";if(n!=="full"&&t.phase==="design")throw new Error(`${n} workflow cannot enter design`);switch(t.phase){case"open":return`${n}.open`;case"design":return lt(e,"design.handoff")?"full.design.document":"full.design.handoff";case"build":return Pw(n,t,e);case"verify":return Rw(n,t,e);case"archive":return Ow(n,t)}}var ai=Xe(Le(),1);Fe();se();import si from"path";ii();var Ru=["full","hotfix","tweak"],ut=1,$w=["open","design","build","verify","archive"],Iw=["en","zh-CN"],Lw=["off","beta"],qw=["subagent-driven-development","executing-plans","direct"],Ww=["plan-ready"],Fw=["confirmed"],Dw=["tdd","direct"],Mw=["off","standard","thorough"],Bw=["current","branch","worktree"],Kw=["light","full"],Uw=["pending","pass","fail"],Hw=["pending","handled"],Yw=["pending","confirmed"],Rt=["workflow","language","phase","context_compression","build_mode","build_pause","subagent_dispatch","tdd_mode","review_mode","isolation","bound_branch","verify_mode","auto_transition","base_ref","design_doc","plan","verify_result","verify_failures","verification_report","branch_status","created_at","verified_at","archive_confirmation","archived","direct_override","handoff_context","handoff_hash","classic_profile","classic_migration"],Os=["run_id"],Vw=new Set([...Rt,...Os]),Jw=["workflow","phase","design_doc","plan","build_mode","isolation","verify_mode","verify_result","verified_at","archived"];function Ou(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function Pt(t,e){let n=t[e];if(n==null||n==="")return null;if(typeof n!="string")throw new Error(`Invalid Classic state: ${e} must be a string or null`);return n}function Q(t,e,n,r=!0){let i=t[e];if(i==null||i===""){if(r)return null;throw new Error(`Invalid Classic state: ${e} is required`)}if(typeof i!="string"||!n.includes(i))throw new Error(`Invalid Classic state: ${e} must be one of ${n.join(", ")}${r?" or null":""}`);return i}function Rs(t,e,n=!0){let r=t[e];if(r==null||r===""){if(n)return null;throw new Error(`Invalid Classic state: ${e} is required`)}if(typeof r!="boolean")throw new Error(`Invalid Classic state: ${e} must be true or false`);return r}function Gw(t,e,n=0){let r=t[e];if(r==null||r==="")return n;if(typeof r!="number"||!Number.isInteger(r)||r<0)throw new Error(`Invalid Classic state: ${e} must be a non-negative integer`);return r}function oi(t,e){let n=Pt(t,e);if(n===null)return null;if(/^(?:[A-Za-z]:|[\\/]|~)/u.test(n)||n.split(/[\\/]/u).includes(".."))throw new Error(`Invalid Classic state: ${e} must be a relative repository path`);return n}function zw(t,e){let n=Pt(t,e);if(n!==null&&!/^[a-f0-9]{64}$/u.test(n))throw new Error(`Invalid Classic state: ${e} must be a sha256 hex digest`);return n}function Qw(t){let e=t.classic_migration;if(e==null||e==="")return null;if(e!==ut)throw new Error(`Invalid Classic state: classic_migration must be ${ut}`);return e}function Xw(t){if(!Rt.some(n=>Ou(t,n)))return null;for(let n of Jw)if(!Ou(t,n))return null;return{workflow:Q(t,"workflow",Ru,!1),language:Q(t,"language",Iw),phase:Q(t,"phase",$w,!1),contextCompression:Q(t,"context_compression",Lw),buildMode:Q(t,"build_mode",qw),buildPause:Q(t,"build_pause",Ww),subagentDispatch:Q(t,"subagent_dispatch",Fw),tddMode:Q(t,"tdd_mode",Dw),reviewMode:Q(t,"review_mode",Mw),isolation:Q(t,"isolation",Bw),boundBranch:Pt(t,"bound_branch"),verifyMode:Q(t,"verify_mode",Kw),autoTransition:Rs(t,"auto_transition"),baseRef:Pt(t,"base_ref"),designDoc:oi(t,"design_doc"),plan:oi(t,"plan"),verifyResult:Q(t,"verify_result",Uw,!1),verifyFailures:Gw(t,"verify_failures"),verificationReport:oi(t,"verification_report"),branchStatus:Q(t,"branch_status",Hw),createdAt:Pt(t,"created_at"),verifiedAt:Pt(t,"verified_at"),archiveConfirmation:Q(t,"archive_confirmation",Yw),archived:Rs(t,"archived",!1),directOverride:Rs(t,"direct_override"),handoffContext:oi(t,"handoff_context"),handoffHash:zw(t,"handoff_hash"),classicProfile:Q(t,"classic_profile",Ru),classicMigration:Qw(t)}}function As(t,e){let n=e??null;if(n===null&&e===void 0&&t.run_id&&t.skill)try{n=ti(t)}catch(r){let i=r instanceof Error?r.message:String(r);throw new Error(i.replace(/^Invalid Run state:/u,"Invalid Classic state:"),{cause:r})}return{classic:Xw(t),run:n,unknownKeys:Object.keys(t).filter(r=>!Vw.has(r))}}function Au(t){return{workflow:t.workflow,language:t.language,phase:t.phase,context_compression:t.contextCompression,build_mode:t.buildMode,build_pause:t.buildPause,subagent_dispatch:t.subagentDispatch,tdd_mode:t.tddMode,review_mode:t.reviewMode,isolation:t.isolation,bound_branch:t.boundBranch,verify_mode:t.verifyMode,auto_transition:t.autoTransition,base_ref:t.baseRef,design_doc:t.designDoc,plan:t.plan,verify_result:t.verifyResult,verify_failures:t.verifyFailures,verification_report:t.verificationReport,branch_status:t.branchStatus,created_at:t.createdAt,verified_at:t.verifiedAt,archive_confirmation:t.archiveConfirmation,archived:t.archived,direct_override:t.directOverride,handoff_context:t.handoffContext,handoff_hash:t.handoffHash,classic_profile:t.classicProfile,classic_migration:t.classicMigration}}ii();var Zw=2*1024*1024;function xn(t){let e=t.toJS();if(e===null)return{};if(typeof e!="object"||Array.isArray(e))throw new Error("Invalid Classic state document: root must be a mapping");return e}function Nu(t,e,n){t.get(e)!==n&&t.set(e,n)}function ey(t,e){if(e.classic)for(let[n,r]of Object.entries(Au(e.classic)))Nu(t,n,r);else for(let n of Rt)t.delete(n);_s(t.toJS(),e.run),e.run?Nu(t,"run_id",e.run.runId):t.delete("run_id")}function ty(t){let e=["skill","skill_version","skill_hash","orchestration","current_step","iteration","pending","pending_ref","trajectory_ref","context_ref","artifacts_ref","checkpoint_ref","run_status","run_retries"];for(let n of e)t.delete(n)}function ny(t){let e=!1;for(let n of["build_command","verify_command"])t.has(n)&&(t.delete(n),e=!0);return e}async function ju(t){let e;try{e=(await Y(si.dirname(t),si.basename(t),Zw,{label:"Classic state document"})).bytes.toString("utf8")}catch(r){if(r.code!=="ENOENT")throw r;return new ai.Document({})}let n=(0,ai.parseDocument)(e);if(n.errors.length>0)throw new Error(`Invalid Classic state document: ${n.errors[0].message}`);return xn(n),n}async function Ge(t,e={}){let n=e.migrate!==!1,r=si.join(t,".comet.yaml"),i=await ju(r),o=xn(i),s=ny(i);s&&(o=xn(i));let a=await xs(t);if(!a&&o.run_id&&o.skill){let{runStateFromDocument:c}=await Promise.resolve().then(()=>(ii(),Pu));a=c(o),a&&n&&(await ri(t,a),ty(i),s=!0)}return s&&n&&await ue(r,i.toString(),{containedRoot:t}),As(xn(i),a)}async function ci(t,e,n={}){let r=si.join(t,".comet.yaml"),i=await ju(r);ey(i,{...e,unknownKeys:e.unknownKeys??[]}),As(xn(i),e.run??null),await ue(r,i.toString(),{containedRoot:t,beforeCommit:n.beforeCommit}),e.run?await ri(t,e.run):await Ps(t)}function Tu(t,e,n){return{runId:e,skill:t.definition.metadata.name,skillVersion:t.definition.metadata.version,skillHash:n,orchestration:t.definition.orchestration.mode,currentStep:t.definition.orchestration.entry??null,iteration:0,pending:null,pendingRef:".comet/pending-action.json",trajectoryRef:".comet/trajectory.jsonl",contextRef:".comet/context.md",artifactsRef:".comet/artifacts.json",checkpointRef:".comet/checkpoint.json",status:"running",retries:{}}}import{createHash as Vu,randomUUID as ky}from"crypto";import{promises as U}from"fs";import F from"path";var Lu=Xe(Le(),1);import{promises as Ns}from"fs";import ae from"path";var ry=["invoke_skill","call_tool","handoff","ask_user","checkpoint"],iy=["deterministic","adaptive"],oy=["function","mcp","script","agent"],sy=["none","read","write","external"],ay=["progress","step","completion"],cy=["artifact_exists","state_equals"];function ft(t,e,n){return new Error(`${t}: ${e} ${n}`)}function ne(t,e,n="document"){if(t===null||typeof t!="object"||Array.isArray(t))throw ft(e,n,"must be an object")}function ze(t,e,n){if(!Array.isArray(t))throw ft(e,n,"must be an array")}function X(t,e,n){if(typeof t!="string")throw ft(e,n,"must be a string")}function fe(t,e,n,r){e in t&&X(t[e],n,`${r}.${e}`)}function qu(t,e,n,r){if(e in t&&typeof t[e]!="boolean")throw ft(n,`${r}.${e}`,"must be a boolean")}function Qe(t,e,n,r){if(typeof t!="string"||!e.includes(t))throw ft(n,r,`must be one of ${e.join(", ")}`)}function li(t,e,n){ze(t,e,n),t.forEach((r,i)=>{X(r,e,`${n}[${i}]`)})}function $u(t,e,n){ne(t,e,n),X(t.name,e,`${n}.name`),X(t.description,e,`${n}.description`),qu(t,"required",e,n)}function ly(t,e,n){ne(t,e,n),X(t.id,e,`${n}.id`),fe(t,"source",e,n),fe(t,"version",e,n)}function uy(t,e,n){ne(t,e,n),X(t.id,e,`${n}.id`),X(t.role,e,`${n}.role`),fe(t,"instructions",e,n)}function fy(t,e,n){ne(t,e,n),X(t.id,e,`${n}.id`),Qe(t.kind,oy,e,`${n}.kind`),X(t.source,e,`${n}.source`),Qe(t.sideEffect,sy,e,`${n}.sideEffect`),qu(t,"requiresConfirmation",e,n)}function dy(t,e,n){ne(t,e,n),Qe(t.type,ry,e,`${n}.type`),fe(t,"ref",e,n),fe(t,"prompt",e,n),fe(t,"question",e,n),"options"in t&&li(t.options,e,`${n}.options`)}function my(t,e,n){ne(t,e,n),X(t.id,e,`${n}.id`),dy(t.action,e,`${n}.action`),fe(t,"next",e,n),"completionEvals"in t&&li(t.completionEvals,e,`${n}.completionEvals`)}function py(t,e){let n="goal";ne(t,e,n),X(t.statement,e,`${n}.statement`),ze(t.inputs,e,`${n}.inputs`),t.inputs.forEach((r,i)=>{$u(r,e,`${n}.inputs[${i}]`)}),ze(t.outputs,e,`${n}.outputs`),t.outputs.forEach((r,i)=>{$u(r,e,`${n}.outputs[${i}]`)}),li(t.success,e,`${n}.success`)}function hy(t,e){let n="orchestration";ne(t,e,n),Qe(t.mode,iy,e,`${n}.mode`),fe(t,"entry",e,n),"steps"in t&&(ze(t.steps,e,`${n}.steps`),t.steps.forEach((r,i)=>{my(r,e,`${n}.steps[${i}]`)}))}function Wu(t,e){return ne(t,e),Qe(t.apiVersion,["comet/v1alpha1"],e,"apiVersion"),Qe(t.kind,["Skill"],e,"kind"),ne(t.metadata,e,"metadata"),X(t.metadata.name,e,"metadata.name"),X(t.metadata.version,e,"metadata.version"),X(t.metadata.description,e,"metadata.description"),py(t.goal,e),hy(t.orchestration,e),ze(t.skills,e,"skills"),t.skills.forEach((n,r)=>{ly(n,e,`skills[${r}]`)}),ze(t.agents,e,"agents"),t.agents.forEach((n,r)=>{uy(n,e,`agents[${r}]`)}),ze(t.tools,e,"tools"),t.tools.forEach((n,r)=>{fy(n,e,`tools[${r}]`)}),t}function Fu(t,e){ne(t,e);for(let n of["allowedSkills","allowedAgents","allowedTools","confirmationRequiredFor"])n in t&&li(t[n],e,n);for(let n of["maxIterations","maxRetriesPerAction"])if(n in t&&(typeof t[n]!="number"||!Number.isFinite(t[n])))throw ft(e,n,"must be a finite number");return t}function gy(t,e){return ne(t,e),"runtime"in t&&Du(t.runtime,e,"runtime"),t}function Du(t,e,n){return ze(t,e,n),t.forEach((r,i)=>{let o=`${n}[${i}]`;ne(r,e,o),X(r.id,e,`${o}.id`),Qe(r.scope,ay,e,`${o}.scope`),Qe(r.type,cy,e,`${o}.type`),fe(r,"artifact",e,o),fe(r,"field",e,o),fe(r,"equals",e,o)}),t}async function js(t){let e=await Ns.readFile(t,"utf8");try{return(0,Lu.parse)(e)}catch(n){let r=n instanceof Error?n.message:String(n);throw ft(t,"document",r)}}async function wy(t){try{return await js(t)}catch(e){if(e.code==="ENOENT")return null;throw e}}async function Iu(t){try{return await Ns.access(t),!0}catch(e){if(e.code==="ENOENT")return!1;throw e}}async function yy(t){let e=ae.join(t,"checks.yaml"),n=ae.join(t,"evals.yaml"),[r,i]=await Promise.all([Iu(e),Iu(n)]);if(i)throw new Error(`${n}: evals.yaml is no longer supported; use checks.yaml`);return r?{document:gy(await js(e),e)}:{document:null}}async function Mu(t){let e=ae.resolve(t.root),n=ae.resolve(t.controlRoot);t.requireSkillMarkdown&&await Ns.access(ae.join(e,"SKILL.md"));let r=ae.join(n,"skill.yaml"),i=ae.join(n,"guardrails.yaml"),o=Wu(await js(r),r),s=await wy(i),a=s===null?null:Fu(s,i),c=await yy(n),l={allowedSkills:o.skills.map(u=>u.id),allowedAgents:o.agents.map(u=>u.id),allowedTools:o.tools.map(u=>u.id),maxIterations:50,maxRetriesPerAction:3,confirmationRequiredFor:o.tools.filter(u=>u.requiresConfirmation).map(u=>u.id)};return{root:e,packageKind:t.packageKind==="runtime"?"runtime":void 0,definition:o,guardrails:{...l,...a},evals:c.document?.runtime??[]}}async function Bu(t){let e=ae.resolve(t);return Mu({root:e,controlRoot:ae.join(e,"comet"),packageKind:"skill",requireSkillMarkdown:!0})}async function Ku(t){let e=ae.resolve(t);return Mu({root:e,controlRoot:e,packageKind:"runtime",requireSkillMarkdown:!1})}function Uu(t,e,n=ae.join(e,"package.json")){ne(t,n);let r=t.packageKind==="runtime"?"runtime":void 0,i=Wu(t.definition,n),o=Fu(t.guardrails,n),s=Du(t.evals,n,"evals"),a={allowedSkills:i.skills.map(c=>c.id),allowedAgents:i.agents.map(c=>c.id),allowedTools:i.tools.map(c=>c.id),maxIterations:50,maxRetriesPerAction:3,confirmationRequiredFor:i.tools.filter(c=>c.requiresConfirmation).map(c=>c.id)};return{root:ae.resolve(e),packageKind:r,definition:i,guardrails:{...a,...o},evals:s}}import Hu from"path";function vy(t,e,n,r){t.type==="invoke_skill"&&!e.definition.skills.some(i=>i.id===t.ref)&&n.push(`step ${r} references undeclared skill: ${t.ref??"(missing)"}`),t.type==="call_tool"&&!e.definition.tools.some(i=>i.id===t.ref)&&n.push(`step ${r} references undeclared tool: ${t.ref??"(missing)"}`),t.type==="handoff"&&!e.definition.agents.some(i=>i.id===t.ref)&&n.push(`step ${r} references undeclared agent: ${t.ref??"(missing)"}`),t.type==="ask_user"&&!t.question&&n.push(`step ${r} ask_user action requires question`)}function Yu(t){let e=[],{definition:n,guardrails:r,evals:i}=t;n.apiVersion!=="comet/v1alpha1"&&e.push("unsupported apiVersion"),n.kind!=="Skill"&&e.push("kind must be Skill"),n.metadata.name||e.push("metadata.name is required"),n.goal.statement||e.push("goal.statement is required"),r.maxIterations<1&&e.push("maxIterations must be at least 1"),r.maxRetriesPerAction<0&&e.push("maxRetriesPerAction must not be negative");let o=n.orchestration.steps??[];if(n.orchestration.mode==="adaptive")(n.orchestration.entry||o.length>0)&&e.push("adaptive orchestration must not define entry or steps");else{let s=new Set;for(let a of o)s.has(a.id)&&e.push(`duplicate step id: ${a.id}`),s.add(a.id),vy(a.action,t,e,a.id);(!n.orchestration.entry||!s.has(n.orchestration.entry))&&e.push(`orchestration.entry references unknown step: ${n.orchestration.entry??"(missing)"}`);for(let a of o){a.next&&!s.has(a.next)&&e.push(`step ${a.id} has unknown next step: ${a.next}`);for(let c of a.completionEvals??[])i.some(l=>l.id===c)||e.push(`step ${a.id} references unknown eval: ${c}`)}}for(let s of n.tools){if(s.kind!=="script")continue;let a=Hu.posix.normalize(s.source.replaceAll("\\","/"));(Hu.isAbsolute(s.source)||a===".."||a.startsWith("../"))&&e.push(`script tool ${s.id} must reference a relative path inside the Skill package`)}for(let s of r.allowedSkills)n.skills.some(a=>a.id===s)||e.push(`guardrails allow undeclared skill: ${s}`);for(let s of r.allowedAgents)n.agents.some(a=>a.id===s)||e.push(`guardrails allow undeclared agent: ${s}`);for(let s of r.allowedTools)n.tools.some(a=>a.id===s)||e.push(`guardrails allow undeclared tool: ${s}`);return e}function ui(t){return Array.isArray(t)?t.map(ui):t&&typeof t=="object"?Object.fromEntries(Object.entries(t).sort(([e],[n])=>e.localeCompare(n)).map(([e,n])=>[e,ui(n)])):t}function by(t){return ui({...t.packageKind==="runtime"?{packageKind:"runtime"}:{},definition:t.definition,guardrails:t.guardrails,evals:t.evals})}function Sy(t){return F.posix.normalize(t.replaceAll("\\","/"))}function Ot(t,e,n){let r=F.relative(t,e);if(!(r===""||!F.isAbsolute(r)&&!r.startsWith(`..${F.sep}`)))throw new Error(`${n} resolves outside the Skill package`)}async function Ju(t,e,n){let r=Sy(e);if(F.posix.isAbsolute(r)||r===".."||r.startsWith("../"))throw new Error(`${n} resolves outside the Skill package`);let i=F.resolve(t,...r.split("/"));Ot(t,i,n);let o;try{o=await U.realpath(i)}catch(s){throw s.code==="ENOENT"?new Error(`${n} does not exist: ${e}`,{cause:s}):s}if(Ot(t,o,n),!(await U.stat(o)).isFile())throw new Error(`${n} is not a file: ${e}`);return{path:r,content:await U.readFile(o)}}async function Cy(t){let e=await U.realpath(t.root),n=t.packageKind==="runtime"?[]:[await Ju(e,"SKILL.md","SKILL.md")];for(let r of t.definition.tools)r.kind==="script"&&n.push(await Ju(e,r.source,`Script tool ${r.id}`));return n.sort((r,i)=>r.path.localeCompare(i.path))}function Ey(t,e){let n=e.map(r=>({path:r.path,sha256:Vu("sha256").update(r.content).digest("hex")}));return Vu("sha256").update(JSON.stringify(ui({package:t,files:n}))).digest("hex")}function Qu(t){return JSON.stringify(t,null,2)+`
|
|
147
|
+
`}async function Xu(t){let e=by(t),n=await Cy(t);return{document:e,files:n,hash:Ey(e,n)}}async function fi(t){return(await Xu(t)).hash}async function Gu(t){try{return await U.access(t),!0}catch(e){if(e.code==="ENOENT")return!1;throw e}}async function zu(t,e){try{if((await U.readFile(F.join(t,"sha256"),"utf8")).trim()!==e.hash)throw new Error("hash mismatch");if(await U.readFile(F.join(t,"package.json"),"utf8")!==Qu(e.document))throw new Error("package mismatch");for(let i of e.files)if(!(await U.readFile(F.join(t,...i.path.split("/")))).equals(i.content))throw new Error(`file mismatch: ${i.path}`)}catch(n){throw new Error(`Existing Skill snapshot is invalid: ${e.hash}`,{cause:n})}}async function Ts(t,e){let n=await Xu(t),r=F.resolve(e,".comet","skill-snapshots"),i=F.join(r,n.hash);if(await U.mkdir(r,{recursive:!0}),await Gu(i))return await zu(i,n),{hash:n.hash,snapshotDir:i};let o=F.join(r,`.tmp-${ky()}`);Ot(r,o,"Temporary snapshot"),Ot(r,i,"Published snapshot");try{await U.mkdir(o);for(let s of n.files){let a=F.join(o,...s.path.split("/"));Ot(o,a,`Snapshot file ${s.path}`),await U.mkdir(F.dirname(a),{recursive:!0}),await U.writeFile(a,s.content)}await U.writeFile(F.join(o,"package.json"),Qu(n.document)),await U.writeFile(F.join(o,"sha256"),n.hash+`
|
|
148
|
+
`),await U.rename(o,i)}catch(s){if(await Gu(i)){try{await zu(i,n)}finally{await U.rm(o,{recursive:!0,force:!0})}return{hash:n.hash,snapshotDir:i}}throw await U.rm(o,{recursive:!0,force:!0}),s}return{hash:n.hash,snapshotDir:i}}async function $s(t,e){if(!/^[a-f0-9]{64}$/u.test(e))throw new Error(`Invalid Skill snapshot hash: ${e}`);let n=F.resolve(t,".comet","skill-snapshots"),r=F.join(n,e);Ot(n,r,"Skill snapshot");try{let i=(await U.readFile(F.join(r,"sha256"),"utf8")).trim();if(i!==e)throw new Error(`stored hash is ${i||"(empty)"}`);let o=F.join(r,"package.json"),s=JSON.parse(await U.readFile(o,"utf8")),a=Uu(s,r,o),c=Yu(a);if(c.length>0)throw new Error(c.map(u=>` - ${u}`).join(`
|
|
149
|
+
`));let l=await fi(a);if(l!==e)throw new Error(`calculated hash is ${l}`);return a}catch(i){throw new Error(`Skill snapshot is invalid or missing: ${e}`,{cause:i})}}async function Zu(t){try{return await Is.access(t),!0}catch(e){if(e.code==="ENOENT")return!1;throw e}}function ef(t){return _y("sha256").update(t).digest("hex")}function Py(t){return ef(JSON.stringify(Object.fromEntries(Object.entries(t).sort(([e],[n])=>e.localeCompare(n)))))}function Ry(t){return t.replaceAll(".","_").replaceAll("-","_")}async function Oy(t,e){let n=await ct(t),r=Object.fromEntries(e.filter(s=>s.satisfied&&s.source).map(s=>[Ry(s.code),s.source])),i=Ce.join(t,"subagent-progress.md");await Zu(i)&&(r.subagent_progress=Ce.relative(n,i).split(Ce.sep).join("/"));let o=e.find(s=>s.code==="design.handoff"&&s.satisfied);return o?.source&&(r.handoff_context=o.source),r}function Ay(t,e,n){return[{sequence:1,timestamp:n,type:"run_started",runId:t.runId,data:{skill:t.skill,skillVersion:t.skillVersion,skillHash:t.skillHash}},{sequence:2,timestamp:n,type:"state_migrated",runId:t.runId,data:{kind:"classic",migrationVersion:ut,profile:e,source:"pre-migration"}}]}async function Ny(t){await Promise.all(t.map(e=>Is.rm(e,{recursive:!0,force:!0})))}async function tf(t,e){let n=await Ge(t);if(!n.classic)throw new Error("Classic migration requires a legacy state projection");let r=n.classic,i=r.classicProfile??r.workflow;if(n.run){if(r.classicMigration!==ut)throw new Error("Classic Run exists without a supported classic_migration marker");if(n.run.skill!==e.skillPackage.definition.metadata.name)throw new Error(`Classic Run skill mismatch: expected ${e.skillPackage.definition.metadata.name}, got ${n.run.skill}`);if(await fi(e.skillPackage)!==n.run.skillHash)return await $s(t,n.run.skillHash),{classic:r,run:n.run,evidence:await Je(t,n),migrated:!1,snapshotDir:Ce.join(t,".comet","skill-snapshots",n.run.skillHash)};let m=await Ts(e.skillPackage,t);return{classic:r,run:n.run,evidence:await Je(t,n),migrated:!1,snapshotDir:m.snapshotDir}}let o=await Je(t,n),s=xt(r,o);if(!e.skillPackage.definition.orchestration.steps?.some(d=>d.id===s))throw new Error(`Classic Skill package does not define resolved step: ${s}`);let a=await fi(e.skillPackage),c=Ce.join(t,".comet","skill-snapshots",a),l=await Zu(c),u=[];try{let d=await Ts(e.skillPackage,t),m=Tu(e.skillPackage,e.runId?.()??xy(),d.hash);m.currentStep=s,s==="completed"&&(m.status="completed");let h={...r,classicProfile:i,classicMigration:ut},g=await Oy(t,o),f=await ct(t),p=o.find(C=>C.code==="design.handoff"&&C.satisfied),w=null;p?.source&&(w=await te(f,p.resolvedSource??p.source,{label:"Classic migration handoff context",hooks:e.handoffReadHooks}),await pu(t,m.contextRef,w),u.push(Ce.resolve(t,m.contextRef))),await mu(t,m.artifactsRef,g),u.push(Ce.resolve(t,m.artifactsRef));let v=(e.now?.()??new Date).toISOString(),b={runId:m.runId,stateVersion:1,trajectoryOffset:2,contextHash:w===null?null:ef(w),artifactsHash:Py(g),createdAt:v};await hu(t,m.checkpointRef,b),u.push(Ce.resolve(t,m.checkpointRef)),u.push(Ce.resolve(t,m.trajectoryRef));for(let C of Ay(m,i,v))await hn(t,m.trajectoryRef,C);return await ci(t,{classic:h,run:m,unknownKeys:n.unknownKeys}),{classic:h,run:m,evidence:o,migrated:!0,snapshotDir:d.snapshotDir}}catch(d){throw await Ny(u),l||await Is.rm(c,{recursive:!0,force:!0}),d}}async function jy(t){try{return(await nf.stat(t)).isDirectory()}catch(e){if(e.code==="ENOENT")return!1;throw e}}async function di(t){try{return(await nf.stat(t)).isFile()}catch(e){if(e.code==="ENOENT")return!1;throw e}}async function Ty(t){return await jy(t)?await di(re.join(t,"skill.yaml"))?!0:await di(re.join(t,"SKILL.md"))&&await di(re.join(t,"comet","skill.yaml")):!1}function $y(t){return{root:t,packageKind:"runtime",definition:{apiVersion:"comet/v1alpha1",kind:"Skill",metadata:{name:"comet-classic",version:"1",description:"Internal compatibility orchestration for classic Comet full, hotfix, and tweak workflows"},goal:{statement:"Advance or restore a classic Comet Run without changing the user command surface",inputs:[{name:"classic-state",description:"Validated ClassicState consistent with the Run projection",required:!0},{name:"evidence",description:"Structured evidence produced by the Classic Evidence collector",required:!0}],outputs:[{name:"run-state",description:"Atomically synchronized Classic and Run state",required:!0}],success:["Legacy fields and Run fields remain consistent","Every step invokes only a declared public Comet Skill","The completed state passes its completion eval"]},orchestration:{mode:"deterministic",entry:"full.open",steps:[{id:"full.open",action:{type:"invoke_skill",ref:"comet-open"},next:"full.design.handoff"},{id:"full.design.handoff",action:{type:"invoke_skill",ref:"comet-design"},next:"full.design.document"},{id:"full.design.document",action:{type:"invoke_skill",ref:"comet-design"},next:"full.build.plan"},{id:"full.build.plan",action:{type:"invoke_skill",ref:"comet-build"},next:"full.build.plan-ready"},{id:"full.build.plan-ready",action:{type:"invoke_skill",ref:"comet-build"},next:"full.build.configure"},{id:"full.build.configure",action:{type:"invoke_skill",ref:"comet-build"},next:"full.build.execute"},{id:"full.build.execute",action:{type:"invoke_skill",ref:"comet-build"},next:"full.build.complete"},{id:"full.build.complete",action:{type:"invoke_skill",ref:"comet-build"},next:"full.verify.run"},{id:"full.build.fix",action:{type:"invoke_skill",ref:"comet-build"},next:"full.build.execute"},{id:"full.verify.run",action:{type:"invoke_skill",ref:"comet-verify"},next:"full.verify.branch"},{id:"full.verify.branch",action:{type:"invoke_skill",ref:"comet-verify"},next:"full.archive.confirm"},{id:"full.archive.confirm",action:{type:"invoke_skill",ref:"comet-archive"},next:"full.archive.execute"},{id:"full.archive.execute",action:{type:"invoke_skill",ref:"comet-archive"},next:"completed"},{id:"hotfix.open",action:{type:"invoke_skill",ref:"comet-hotfix"},next:"hotfix.build.execute"},{id:"hotfix.build.execute",action:{type:"invoke_skill",ref:"comet-build"},next:"hotfix.build.complete"},{id:"hotfix.build.complete",action:{type:"invoke_skill",ref:"comet-build"},next:"hotfix.verify.run"},{id:"hotfix.verify.run",action:{type:"invoke_skill",ref:"comet-verify"},next:"hotfix.verify.branch"},{id:"hotfix.verify.branch",action:{type:"invoke_skill",ref:"comet-verify"},next:"hotfix.archive.confirm"},{id:"hotfix.archive.confirm",action:{type:"invoke_skill",ref:"comet-archive"},next:"hotfix.archive.execute"},{id:"hotfix.archive.execute",action:{type:"invoke_skill",ref:"comet-archive"},next:"completed"},{id:"tweak.open",action:{type:"invoke_skill",ref:"comet-tweak"},next:"tweak.build.execute"},{id:"tweak.build.execute",action:{type:"invoke_skill",ref:"comet-build"},next:"tweak.build.complete"},{id:"tweak.build.complete",action:{type:"invoke_skill",ref:"comet-build"},next:"tweak.verify.run"},{id:"tweak.verify.run",action:{type:"invoke_skill",ref:"comet-verify"},next:"tweak.verify.branch"},{id:"tweak.verify.branch",action:{type:"invoke_skill",ref:"comet-verify"},next:"tweak.archive.confirm"},{id:"tweak.archive.confirm",action:{type:"invoke_skill",ref:"comet-archive"},next:"tweak.archive.execute"},{id:"tweak.archive.execute",action:{type:"invoke_skill",ref:"comet-archive"},next:"completed"},{id:"completed",action:{type:"checkpoint"},completionEvals:["classic-completed"]}]},skills:[{id:"comet-open"},{id:"comet-design"},{id:"comet-build"},{id:"comet-verify"},{id:"comet-archive"},{id:"comet-hotfix"},{id:"comet-tweak"}],agents:[],tools:[]},guardrails:{allowedSkills:["comet-open","comet-design","comet-build","comet-verify","comet-archive","comet-hotfix","comet-tweak"],allowedAgents:[],allowedTools:[],maxIterations:500,maxRetriesPerAction:3,confirmationRequiredFor:[]},evals:[{id:"classic-completed",scope:"completion",type:"state_equals",field:"status",equals:"completed"}]}}async function Iy(){let t=re.dirname(rf(import.meta.url)),e=[process.env.COMET_RUNTIME_CLASSIC_ROOT,re.resolve(t,"..","runtime","classic"),re.resolve(t,"..","..","comet","runtime","classic"),re.resolve(t,"..","..","assets","skills","comet","runtime","classic"),re.resolve("assets","skills","comet","runtime","classic"),process.env.COMET_CLASSIC_SKILL_ROOT,re.resolve(t,"..","..","comet-classic"),re.resolve(t,"..","..","assets","skills","comet-classic"),re.resolve("assets","skills","comet-classic")].filter(n=>!!n);for(let n of e)if(await Ty(n))return n;return null}async function Ly(t){return await di(re.join(t,"skill.yaml"))?Ku(t):Bu(t)}async function mi(t){let e=await Iy();return tf(t,{skillPackage:e?await Ly(e):$y(re.dirname(rf(import.meta.url)))})}async function of(t){let e=await Ge(t),n=Array.from(new Set(e.unknownKeys)).sort();if(n.length>0)throw new Error(`Invalid Classic state: unknown field(s): ${n.join(", ")}`);return mi(t)}async function sf(t,e,n,r){let i=await Ge(t);if(!i.classic||!i.run)throw new Error("Classic transition requires synchronized Classic and Run projections");let o=await Je(t,{classic:e,run:n,unknownKeys:i.unknownKeys}),s=xt(e,o),a={...n,currentStep:s,iteration:n.iteration+1,status:s==="completed"?"completed":"running"};await ci(t,{classic:e,run:a,unknownKeys:i.unknownKeys});let c=await Jr(t,a.trajectoryRef);return await hn(t,a.trajectoryRef,{sequence:c.length+1,timestamp:new Date().toISOString(),type:"state_transitioned",runId:a.runId,data:{kind:"classic",fromStep:n.currentStep,toStep:s,...r}}),a}var af={"full.open":["openspec.proposal","openspec.tasks"],"full.design.handoff":["openspec.proposal","openspec.design","openspec.tasks"],"full.design.document":["design.handoff"],"full.build.plan":["openspec.tasks"],"full.build.plan-ready":["build.plan"],"full.build.configure":["build.plan"],"full.build.execute":["build.plan"],"full.build.complete":["build.tasks-complete"],"full.verify.run":["build.tasks-complete"],"full.verify.branch":["verification.report"],"full.archive.confirm":["verification.report"],"full.archive.execute":["archive.confirmed"]};function qy(t){return af[t]?af[t]:t.endsWith(".open")?["openspec.proposal","openspec.tasks"]:t.endsWith(".build.execute")?[]:t.endsWith(".build.complete")?["build.tasks-complete"]:t.endsWith(".verify.run")?["build.tasks-complete"]:t.endsWith(".verify.branch")?["verification.report"]:t.endsWith(".archive.confirm")?["verification.report"]:t.endsWith(".archive.execute")?["archive.confirmed"]:[]}function cf(t,e){let n=qy(t),r=n.filter(i=>!lt(e,i));return{stepId:t,passed:r.length===0,requiredEvidence:n,missingEvidence:r}}function Wy(t){switch(t){case"open":return"/comet-open";case"design":return"/comet-design";case"build":return"/comet-build";case"verify":return"/comet-verify";case"archive":return"/comet-archive";default:return null}}async function lf(t,e){try{let n=await of(t),r=await Je(t,{classic:n.classic,run:n.run,unknownKeys:[]}),i=xt(n.classic,r);return{name:e,valid:!0,workflow:n.classic.workflow,phase:n.classic.phase,currentStep:i,nextCommand:Wy(n.classic.phase),runtimeMode:"engine-projection",runtimeEval:cf(i,r),evidence:r}}catch(n){return{name:e,valid:!1,workflow:"unknown",phase:"invalid",currentStep:null,nextCommand:null,runtimeMode:"invalid",runtimeEval:null,evidence:[],error:n instanceof Error?n.message:String(n)}}}Yr();import Fy from"path";var Dy=Fy.join(".comet","state-events.jsonl"),My=8*1024*1024;async function uf(t,e){let n={schemaVersion:1,timestamp:new Date().toISOString(),...e};return await Hr(t,Dy,`${JSON.stringify(n)}
|
|
150
|
+
`,My,"Classic state event log"),n}var By={"open-complete":{event:"open-complete",from:"open",guardRefs:["open-artifacts-present"]},"design-complete":{event:"design-complete",from:"design",guardRefs:["design-evidence-present"]},"build-complete":{event:"build-complete",from:"build",guardRefs:["build-decisions-selected"]},"verify-pass":{event:"verify-pass",from:"verify",guardRefs:["verification-report-present"]},"verify-fail":{event:"verify-fail",from:"verify",guardRefs:["verification-failed"]},"archive-confirm":{event:"archive-confirm",from:"archive",guardRefs:["archive-final-confirmation"]},"archive-reopen":{event:"archive-reopen",from:"archive",guardRefs:["archive-not-finalized"]},archived:{event:"archived",from:"archive",guardRefs:["verify-result-pass","archive-confirmed"]},"preset-escalate":{event:"preset-escalate",from:"build",guardRefs:["preset-workflow"]}},ff={open:"open-complete",design:"design-complete",build:"build-complete",verify:"verify-pass"};function Ky(t){return t.toISOString().slice(0,10)}function R(t,e,n,r){let i=t[n];t[n]=r,i!==r&&e.push({field:n,from:i,to:r})}function df(t,e,n={}){let r=By[e];if(t.phase!==r.from)throw new Error(`Cannot apply ${e}: phase is '${t.phase}', expected '${r.from}'`);let i={...t},o=[],s=n.now??new Date;if(e==="open-complete")R(i,o,"phase",i.workflow==="full"?"design":"build");else if(e==="design-complete")R(i,o,"phase","build");else if(e==="build-complete"){let a=i.verifyResult==="fail";R(i,o,"phase","verify"),R(i,o,"verifyResult","pending"),R(i,o,"branchStatus","pending"),a||R(i,o,"verificationReport",null)}else if(e==="verify-pass")R(i,o,"verifyResult","pass"),R(i,o,"verifyFailures",0),R(i,o,"phase","archive"),R(i,o,"verifiedAt",Ky(s)),R(i,o,"archiveConfirmation","pending"),R(i,o,"branchStatus","pending");else if(e==="verify-fail")R(i,o,"verifyResult","fail"),R(i,o,"verifyFailures",i.verifyFailures+1),R(i,o,"phase","build"),R(i,o,"branchStatus","pending");else if(e==="preset-escalate"){if(i.workflow!=="hotfix"&&i.workflow!=="tweak")throw new Error(`Cannot apply ${e}: workflow must be hotfix or tweak, got '${i.workflow}'`);R(i,o,"workflow","full"),R(i,o,"classicProfile","full"),R(i,o,"phase","design"),R(i,o,"designDoc",null),R(i,o,"buildPause",null),R(i,o,"buildMode",null),R(i,o,"subagentDispatch",null),R(i,o,"tddMode",null),R(i,o,"reviewMode",null),R(i,o,"isolation",null),R(i,o,"boundBranch",null),R(i,o,"verifyMode",null),R(i,o,"directOverride",null)}else if(e==="archive-confirm"){if(i.verifyResult!=="pass")throw new Error(`Cannot apply ${e}: verifyResult must be pass`);if(i.archived)throw new Error(`Cannot apply ${e}: already archived`);R(i,o,"archiveConfirmation","confirmed")}else if(e==="archive-reopen"){if(i.archived)throw new Error(`Cannot apply ${e}: already archived`);R(i,o,"verifyResult","pending"),R(i,o,"verifyFailures",0),R(i,o,"phase","verify"),R(i,o,"verifiedAt",null),R(i,o,"archiveConfirmation",null),R(i,o,"branchStatus","pending")}else{if(i.verifyResult!=="pass")throw new Error(`Cannot apply ${e}: verifyResult must be pass`);if(i.archiveConfirmation!=="confirmed")throw new Error(`Cannot apply ${e}: archiveConfirmation must be confirmed`);R(i,o,"archived",!0)}return{classic:i,effects:o,definition:r}}var An=Xe(Le(),1);import pf from"path";import{AsyncLocalStorage as Uy}from"async_hooks";import{promises as mf}from"fs";import Pn from"path";var pi=new Uy;function Hy(t,e){let n=Pn.relative(t,e);return n===""||!Pn.isAbsolute(n)&&n!==".."&&!n.startsWith(`..${Pn.sep}`)}async function Yy(t){let e=Pn.resolve(t.invocationCwd??process.cwd()),n=Pn.resolve(t.projectRoot??await ct(e)),[r,i]=await Promise.all([mf.realpath(e),mf.realpath(n)]);if(!Hy(i,r))throw new Error(`Classic command invocation cwd is outside the discovered project: ${e}`);return{invocationCwd:e,projectRoot:n}}async function Vy(t,e){let n=pi.getStore();if(n)return e(n);let r=await Yy(t);return pi.run(r,()=>e(r))}function $(){let t=pi.getStore();if(!t)throw new Error("Classic command project context is unavailable");return t.projectRoot}function hi(){let t=pi.getStore();if(!t)throw new Error("Classic command invocation context is unavailable");return t.invocationCwd}function gi(t){return(e,n)=>Vy(n,()=>t(e,n))}var Jy="\x1B[32m",Rn="\x1B[31m",Gy="\x1B[33m",zy="\x1B[0m",Qy=["workflow","phase","design_doc","plan","build_mode","isolation","verify_mode","verify_result","verified_at","archived"],Xy={workflow:["full","hotfix","tweak"],language:["en","zh-CN"],phase:["open","design","build","verify","archive"],context_compression:["off","beta"],build_mode:["subagent-driven-development","executing-plans","direct"],build_pause:["plan-ready"],subagent_dispatch:["confirmed"],tdd_mode:["tdd","direct"],review_mode:["off","standard","thorough"],isolation:["current","branch","worktree"],verify_mode:["light","full"],auto_transition:["true","false"],verify_result:["pending","pass","fail"],branch_status:["pending","handled"],archive_confirmation:["pending","confirmed"],archived:["true","false"],direct_override:["true","false"],classic_profile:["full","hotfix","tweak"],classic_migration:["1"]},Zy=new Set([...Rt,...Os,"classic_profile","classic_migration"]);function dt(t,e){return`${t}${e}${zy}`}function On(t){return t==null?"":typeof t=="object"?JSON.stringify(t):String(t)}var hf=gi(async t=>{let e=t[0],n=kn(e);if(n)return{exitCode:1,stderr:dt(Rn,`ERROR: ${n}`)};let r=$(),{directory:i,label:o}=await Zr(e,r),s=pf.join(i,".comet.yaml"),a=[`[VALIDATE] ${o}/.comet.yaml`],c=0,l=0,u=f=>{c+=1,a.push(dt(Rn,` FAIL: ${f}`))},d=f=>{l+=1,a.push(dt(Gy,` WARN: ${f}`))},m;try{m=await te(r,s,{label:`Classic state ${o}/.comet.yaml`})}catch(f){if(f.code==="ENOENT")return u(".comet.yaml does not exist"),a.push("",dt(Rn,`${c} error(s), ${l} warning(s) — validation FAILED`)),{exitCode:1,stderr:a.join(`
|
|
151
|
+
`)};throw f}let h=(0,An.parseDocument)(m);if(h.errors.length>0||!(0,An.isMap)(h.contents)){for(let f of h.errors)u(f.message);return(0,An.isMap)(h.contents)||u("document root must be a mapping"),a.push("",dt(Rn,`${c} error(s), ${l} warning(s) — validation FAILED`)),{exitCode:1,stderr:a.join(`
|
|
152
|
+
`)}}let g=h.toJS();for(let f of Qy)Object.prototype.hasOwnProperty.call(g,f)||u(`missing required field '${f}'`);for(let[f,p]of Object.entries(Xy)){if(!Object.prototype.hasOwnProperty.call(g,f))continue;let w=On(g[f]);if(!w){f==="auto_transition"&&u(`${f}='' is not valid. Expected: ${p.join(" ")}`);continue}p.includes(w)||u(`${f}='${w}' is not valid. Expected: ${p.join(" ")}`)}if(Object.prototype.hasOwnProperty.call(g,"bound_branch")){let f=g.bound_branch;f!==null&&typeof f!="string"&&u(`bound_branch='${On(f)}' is not a string or null`)}if(Object.prototype.hasOwnProperty.call(g,"verify_failures")){let f=g.verify_failures;(typeof f!="number"||!Number.isInteger(f)||f<0)&&u(`verify_failures='${On(f)}' is not a non-negative integer`)}for(let f of["design_doc","plan","handoff_context","verification_report"]){let p=On(g[f]);if(p){if(/^(?:[A-Za-z]:|[\\/]|~)/u.test(p)||p.split(/[\\/]/u).includes("..")){u(`${f}='${p}' must be a relative repository path`);continue}try{await vn(r,pf.resolve(r,p),{label:`${f} artifact pointer`,expected:"file"})||u(`${f}='${p}' does not exist on disk`)}catch(w){u(`${f}='${p}' is unsafe: ${w instanceof Error?w.message:String(w)}`)}}}for(let f of["handoff_hash"]){let p=On(g[f]);p&&!/^[a-f0-9]{64}$/u.test(p)&&u(`${f}='${p}' is not a sha256 hex digest`)}for(let f of Object.keys(g))Zy.has(f)||d(`unknown field '${f}' found`);return a.push(""),c>0?(a.push(dt(Rn,`${c} error(s), ${l} warning(s) — validation FAILED`)),{exitCode:1,stderr:a.join(`
|
|
153
|
+
`)}):(a.push(dt(Jy,`0 errors, ${l} warning(s) — validation PASSED`)),{exitCode:0,stderr:a.join(`
|
|
154
|
+
`)})});ps();He();import ev from"os";import wi from"path";function tv(t={}){let e=t.cwd??process.cwd(),n=t.homeDir??ev.homedir(),r=[{file:wi.resolve(e,".comet","config.yaml"),source:".comet/config.yaml",scope:"project"},{file:wi.resolve(n,".comet","config.yaml"),source:"~/.comet/config.yaml",scope:"global"}];return r.filter((i,o)=>r.findIndex(s=>s.file===i.file)===o)}async function gf(t,e={}){for(let n of tv(e)){let r=wi.dirname(wi.dirname(n.file)),i=n.scope==="global"?(await ms(r))?.classic:(await be(r,{allowPartialProject:!0}))?.value.classic;if(!i||typeof i!="object"||Array.isArray(i))continue;let o=i[t];if(o!=null)return{value:String(o),source:n.source}}return null}He();var Ls=Xe(Le(),1);vs();import{execFileSync as wf}from"child_process";import{randomUUID as nv}from"crypto";import{promises as Nn}from"fs";import yf from"path";function rv(t){try{let e=wf("git",["rev-parse","--abbrev-ref","HEAD"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"],windowsHide:!0}).trim();return e&&e!=="HEAD"?e:null}catch{return null}}var iv=ys("liveGitBranch",t=>rv(t));function ov(t){try{return wf("git",["rev-parse","--is-inside-work-tree"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"],windowsHide:!0}).trim()==="true"}catch{return!1}}var sv=ys("isGitWorkTree",t=>ov(t)),av=["current","branch","worktree"];function vf(t){return av.includes(t)}function cv(t){return vf(t.isolation)?t.boundBranch===null&&t.currentBranch===null&&t.gitWorkTree===!1?{status:"not-applicable"}:t.boundBranch===null?t.currentBranch===null?{status:"unbound-detached"}:{status:"needs-heal",branch:t.currentBranch}:t.currentBranch===t.boundBranch?{status:"ok"}:{status:"drift",boundBranch:t.boundBranch,currentBranch:t.currentBranch}:{status:"not-applicable"}}async function kf(t,e){let n=yf.join(t,".comet.yaml"),r=(0,Ls.parseDocument)(await Nn.readFile(n,"utf8"),{uniqueKeys:!1});if(r.errors.length>0)throw new Error(`Invalid .comet.yaml: ${r.errors[0].message}`);let i=r.toJS()??{},o=typeof i.isolation=="string"?i.isolation:null,s=typeof i.bound_branch=="string"&&i.bound_branch!==""?i.bound_branch:null,a=vf(o),c=iv(e.cwd),l=a&&s===null&&c===null?sv(e.cwd):!0,u=cv({isolation:o,boundBranch:s,currentBranch:c,gitWorkTree:l});return u.status==="needs-heal"&&e.heal?(await lv(t,u.branch),{status:"healed",branch:u.branch,bindingRequired:a,currentBranch:c}):{...u,bindingRequired:a,currentBranch:c}}async function lv(t,e){let n=yf.join(t,".comet.yaml"),r=(0,Ls.parseDocument)(await Nn.readFile(n,"utf8"),{uniqueKeys:!1});r.set("bound_branch",e);let i=`${n}.${nv()}.tmp`;try{await Nn.writeFile(i,r.toString(),"utf8"),await Nn.rename(i,n)}catch(o){throw await Nn.rm(i,{force:!0}),o}}function uv(t){return t??"detached HEAD"}function bf(t,e,n){return`change '${t}' is bound to branch '${e}', but current branch is '${uv(n)}'.
|
|
155
|
+
Next: ask the user to confirm — switch back to '${e}', or run \`comet state rebind ${t}\` after explicit confirmation.`}function Sf(t){return`change '${t}' uses a branch-bound workspace mode but has no bound branch and HEAD is detached; checkout a branch first before continuing.`}var mv="\x1B[32m",pv="\x1B[31m",hv="\x1B[33m",Ds="\x1B[0m",gv=["open","design","build","verify","archive"],wv={open:"=== Guard: open → next ===",design:"=== Guard: design → build ===",build:"=== Guard: build → verify ===",verify:"=== Guard: verify → archive ===",archive:"=== Guard: archive completeness ==="},yv={open:" [APPLY] .comet.yaml updated: phase=PLACEHOLDER",design:" [APPLY] .comet.yaml updated: phase=build",build:" [APPLY] .comet.yaml updated: phase=verify, verify_result=pending",verify:" [APPLY] .comet.yaml updated: phase=archive, verify_result=pass"},vv={branchStatus:"branch_status",phase:"phase",verificationReport:"verification_report",verifiedAt:"verified_at",verifyResult:"verify_result"};function At(t){return`${mv}${t}${Ds}`}function Ee(t){return`${pv}${t}${Ds}`}function kv(t){return`${hv}${t}${Ds}`}function bv(t){return vv[t]??String(t)}function Sv(t){return t===null?"null":t===void 0?"":typeof t=="object"?JSON.stringify(t):String(t)}var de=class extends Error{constructor(n,r=1){super(n);this.exitCode=r}exitCode},Fs=class{stderr=[];diagnostics;envelope;checksPassed=0;checksFailed=0;toResult(e=0){return{exitCode:e,...this.diagnostics?{stdout:JSON.stringify({diagnostics:this.diagnostics})+`
|
|
156
156
|
`}:{},...this.stderr.length>0?{stderr:this.stderr.join(`
|
|
157
157
|
`)+`
|
|
158
|
-
`}:{},...this.envelope===void 0?{}:{envelope:this.envelope}}}};async function H(t){let e=$();return vn(e,t,{label:`Classic guard path ${T.relative(e,T.resolve(e,t)).replaceAll("\\","/")}`})}async function G(t){let e=$();return Su(e,t,`Classic guard file ${T.relative(e,T.resolve(e,t)).replaceAll("\\","/")}`)}function
|
|
159
|
-
`)}function
|
|
158
|
+
`}:{},...this.envelope===void 0?{}:{envelope:this.envelope}}}};async function H(t){let e=$();return vn(e,t,{label:`Classic guard path ${T.relative(e,T.resolve(e,t)).replaceAll("\\","/")}`})}async function G(t){let e=$();return Su(e,t,`Classic guard file ${T.relative(e,T.resolve(e,t)).replaceAll("\\","/")}`)}function Cv(t){let e=kn(t);if(e)throw new de(Ee(`ERROR: ${e}`))}async function Ev(t){return(await Zr(t,$())).directory}async function N(t,e){let n=T.join(t,".comet.yaml"),r=(0,_f.parseDocument)(await te($(),n,{label:`Classic state ${t}/.comet.yaml`}),{uniqueKeys:!1});if(r.errors.length>0)throw new de(`ERROR: Invalid .comet.yaml: ${r.errors[0].message}`);let o=r.toJS()[e];return o==null?"":typeof o=="object"?JSON.stringify(o):String(o)}async function _v(t,e){let n=await N(e,t);return n&&n!=="null"?n:(await gf(t,{cwd:$()}))?.value??""}async function xv(t){let e=await _v("language",t);if(!e)return"en";if(e==="en"||e==="zh-CN")return e;throw new Error(`configured language '${e}' is invalid; expected en or zh-CN.`)}function Pv(t){let e=[],n=!1;for(let r of t.split(/\r?\n/u)){if(/^\s*```/u.test(r)){n=!n;continue}n||e.push(r)}return e.join(`
|
|
159
|
+
`)}function Rv(t){return t.match(/[\u4e00-\u9fff]/gu)?.length??0}function Ov(t){return t.match(/[A-Za-z][A-Za-z0-9_-]{2,}/gu)?.length??0}async function he(t,e){let n=await xv(t),r=Pv(await te($(),e,{label:`Classic language-check artifact ${e}`})),i=Rv(r),o=Ov(r);return n==="zh-CN"&&i<20&&o>=20?S(`configured language is zh-CN, but ${e} appears to be English-dominant (cjk_chars=${i}, english_words=${o}).
|
|
160
160
|
Next: regenerate or rewrite this artifact in Chinese while preserving necessary technical terms.`):n==="en"&&i>20&&i>o?S(`configured language is en, but ${e} appears to be Chinese-dominant (cjk_chars=${i}, english_words=${o}).
|
|
161
|
-
Next: regenerate or rewrite this artifact in English while preserving necessary technical terms.`):x()}async function xf(t){return Ef("sha256").update(await
|
|
162
|
-
`)).digest("hex")}async function
|
|
161
|
+
Next: regenerate or rewrite this artifact in English while preserving necessary technical terms.`):x()}async function xf(t){return Ef("sha256").update(await Qr($(),t,{label:`Classic handoff source ${t}`})).digest("hex")}async function Ms(t){let e=z($(),t),n=[`${e}/proposal.md`,`${e}/design.md`,`${e}/tasks.md`],r=`${e}/specs`;if(await H(r)){let i=await Ve($(),r,{label:`Classic delta-spec directory ${r}`,expected:"directory"});for(let o of(await dv.readdir(i.target)).sort()){let s=`${r}/${o}/spec.md`;await H(s)&&n.push(s)}}return n}async function Av(t){let e=[];for(let n of await Ms(t))await H(n)&&e.push(`path:${n}`,`sha256:${await xf(n)}`);return Ef("sha256").update(e.join(`
|
|
162
|
+
`)).digest("hex")}async function Nv(t,e){if(!await H(t))throw new de(Ee(`FATAL: change directory not found: ${t}`));if(!await H(T.join(t,".comet.yaml")))throw new de(Ee(`FATAL: .comet.yaml not found in ${t}`));await Ve($(),T.join(t,".comet"),{label:`Classic runtime directory for ${e}`,expected:"directory"});let n=await hf([e],{json:!1});if(n.exitCode!==0)throw n.stderr&&process.stderr.write(n.stderr.endsWith(`
|
|
163
163
|
`)?n.stderr:`${n.stderr}
|
|
164
|
-
`),new de(
|
|
165
|
-
`))t.stderr.push(
|
|
166
|
-
`))t.stderr.push(
|
|
164
|
+
`),new de(Ee("FATAL: .comet.yaml schema validation failed"));let r=await Ge(t),i=Array.from(new Set(r.unknownKeys)).sort();if(i.length>0)throw new de(Ee(`FATAL: .comet.yaml has unknown field(s): ${i.join(", ")}`))}function jv(t,e){if(e.passed){if(t.checksPassed+=1,t.stderr.push(At(` [PASS] ${e.description}`)),e.detail)for(let n of e.detail.split(`
|
|
165
|
+
`))t.stderr.push(At(` ${n}`))}else if(t.checksFailed+=1,t.stderr.push(Ee(` [FAIL] ${e.description}`)),e.detail)for(let n of e.detail.split(`
|
|
166
|
+
`))t.stderr.push(Ee(` ${n}`))}function E(t,e){return async()=>{try{let n=await e();return{description:t,passed:n.passed,detail:("detail"in n?n.detail:"")??""}}catch(n){return{description:t,passed:!1,detail:n instanceof Error?n.message:String(n)}}}}function x(t){return{passed:!0,...t?{detail:t}:{}}}function S(t){return{passed:!1,detail:t}}async function Nt(t,e){let n=!1;for(let r of e){let i=await r();jv(t,i),i.passed||(n=!0)}return n}var Tv=["package.json with a build script","pom.xml","Cargo.toml"];async function $v(t){try{let e=await be($(),{allowPartialProject:!0});return e?Object.prototype.hasOwnProperty.call(e.value,t):!1}catch(e){throw new Error(`.comet/config.yaml is invalid YAML (${e instanceof Error?e.message:String(e)}); cannot check for removed "${t}" field. Fix the config and retry.`,{cause:e})}}function Iv(t){return{status:1,output:`${t} has been removed from .comet/config.yaml. Delete this field and run any required ${t==="build_command"?"build":"verification"} command manually before retrying.`}}function Lv(t){let e=fv(t,{shell:!0,cwd:hi(),encoding:"utf8",timeout:3e5});return{status:e.status??1,output:`${e.stdout??""}${e.stderr??""}`.replace(/\n+$/u,"")}}function jn(t){return T.resolve(hi(),t)}async function qv(){let t=jn("package.json");return await H(t)&&typeof JSON.parse(await te($(),t,{label:"package.json"})).scripts?.build=="string"?"npm run build":await H(jn("pom.xml"))?process.platform==="win32"?await H(jn("mvnw.cmd"))?"mvnw.cmd compile -q":"mvn.cmd compile -q":await H(jn("mvnw"))?"./mvnw compile -q":"mvn compile -q":await H(jn("Cargo.toml"))?"cargo build":null}function Cf(t){return`Evidence: recorded command-check at ${t.timestamp}; command: ${t.command}; cwd: ${t.cwd}`}function qs(t,e,n){return`comet state record-check ${t} ${e} --command "${n}" --exit-code 0`}async function Pf(t,e,n,r){if(process.env.COMET_SKIP_BUILD==="1")return{status:0,output:"SKIPPED via COMET_SKIP_BUILD=1"};let i=r==="build"?["build_command"]:["verify_command","build_command"];for(let a of i)if(await $v(a))return Iv(a);let o=r==="build"?await qv():null;if(o)return Lv(o);let s=await gu($(),t,n,r);return s?s.exitCode!==0?{status:s.exitCode,output:`Latest recorded ${r} check failed with exit code ${s.exitCode}.
|
|
167
167
|
${Cf(s)}
|
|
168
168
|
Next: rerun the command successfully, then record it with:
|
|
169
|
-
${qs(e,r,s.command)}`}:{status:0,output:Cf(s)}:{status:1,output:r==="build"?`No inferred build command or recorded build check. Detection searched: ${
|
|
169
|
+
${qs(e,r,s.command)}`}:{status:0,output:Cf(s)}:{status:1,output:r==="build"?`No inferred build command or recorded build check. Detection searched: ${Tv.join(", ")}.
|
|
170
170
|
Next: run the required command, then record it with:
|
|
171
171
|
${qs(e,r,"<command>")}`:`No recorded verify check.
|
|
172
172
|
Next: run the required verification command, then record it with:
|
|
@@ -175,33 +175,33 @@ Next: restore or create tasks.md for this change before leaving build.`);let n=a
|
|
|
175
175
|
Next: complete implementation tasks and mark them with '- [x]'.`);let r=n.split(/\r?\n/u).map((i,o)=>({line:i,number:o+1})).filter(i=>/^- \[ \]/u.test(i.line));return r.length>0?S(`Unfinished tasks:
|
|
176
176
|
${r.map(i=>`${i.number}:${i.line}`).join(`
|
|
177
177
|
`)}
|
|
178
|
-
Next: complete or explicitly remove unfinished tasks, then mark tasks.md with '- [x]'.`):x()}async function
|
|
178
|
+
Next: complete or explicitly remove unfinished tasks, then mark tasks.md with '- [x]'.`):x()}async function Wv(t){let e=T.join(t,"tasks.md");return await H(e)?/- \[/u.test(await te($(),e,{label:`Classic tasks ${e}`})):!1}async function Fv(t){let e=await N(t,"plan");if(!e||e==="null")return x();if(!await H(e))return S(`plan file is missing at ${e}
|
|
179
179
|
Next: restore the Superpowers plan file or update .comet.yaml plan before leaving build.`);let r=(await te($(),e,{label:`Classic plan ${e}`})).split(/\r?\n/u).map((i,o)=>({line:i,number:o+1})).filter(i=>/^\s*- \[ \]/u.test(i.line));return r.length>0?S(`Unfinished Superpowers plan tasks:
|
|
180
180
|
${r.map(i=>`${i.number}:${i.line}`).join(`
|
|
181
181
|
`)}
|
|
182
|
-
Next: check off corresponding completed plan tasks, then commit the plan update.`):x()}async function Ks(t,e){let n;try{n=await kf(t,{heal:!0,cwd:
|
|
182
|
+
Next: check off corresponding completed plan tasks, then commit the plan update.`):x()}async function Ks(t,e){let n;try{n=await kf(t,{heal:!0,cwd:hi()})}catch(r){throw new de(`ERROR: ${r instanceof Error?r.message:String(r)}`)}switch(n.status){case"drift":return S(bf(e,n.boundBranch,n.currentBranch));case"unbound-detached":return S(Sf(e));case"healed":return x(`bound_branch lazily set to ${n.branch}`);case"needs-heal":case"ok":case"not-applicable":return x();default:{let r=n;throw new Error(`unhandled branch binding status: ${JSON.stringify(r)}`)}}}async function Dv(t,e){let n=await N(t,"isolation");return n==="current"||n==="branch"||n==="worktree"?x():S(`isolation must be current, branch, or worktree, got '${n||"null"}'
|
|
183
183
|
Next: choose a valid workspace mode, prepare it when needed, then run:
|
|
184
|
-
comet state set ${e} isolation <current|branch|worktree>`)}async function
|
|
184
|
+
comet state set ${e} isolation <current|branch|worktree>`)}async function Mv(t,e){let n=await N(t,"build_mode");return["subagent-driven-development","executing-plans","direct"].includes(n)?x():S(`build_mode must be selected before leaving build, got '${n||"null"}'
|
|
185
185
|
Next: ask the user to choose an execution mode, then run:
|
|
186
|
-
comet state set ${e} build_mode <subagent-driven-development|executing-plans>`)}async function
|
|
187
|
-
Next: choose executing-plans or subagent-driven-development, or stop and ask the user for an explicit direct override.`)}async function
|
|
188
|
-
Next: resume /comet-build and use the single joint decision to confirm the supported execution configuration for ${e}`)}async function
|
|
186
|
+
comet state set ${e} build_mode <subagent-driven-development|executing-plans>`)}async function Bv(t){let e=await N(t,"workflow"),n=await N(t,"build_mode"),r=await N(t,"direct_override");return n!=="direct"||e==="hotfix"||e==="tweak"||r==="true"?x():S(`build_mode=direct is only allowed for hotfix/tweak unless direct_override: true is recorded
|
|
187
|
+
Next: choose executing-plans or subagent-driven-development, or stop and ask the user for an explicit direct override.`)}async function Kv(t,e){let n=await N(t,"build_mode"),r=await N(t,"subagent_dispatch");return n!=="subagent-driven-development"||r==="confirmed"?x():S(`subagent_dispatch must be confirmed after the user selects subagent-driven-development
|
|
188
|
+
Next: resume /comet-build and use the single joint decision to confirm the supported execution configuration for ${e}`)}async function Uv(t,e){let n=await N(t,"workflow");if(n==="hotfix"||n==="tweak")return x();let r=await N(t,"tdd_mode");return r==="tdd"||r==="direct"?x():S(`tdd_mode must be tdd or direct for full workflow, got '${r||"null"}'
|
|
189
189
|
Next: ask the user to choose TDD enforcement level, then run:
|
|
190
|
-
comet state set ${e} tdd_mode <tdd|direct>`)}async function
|
|
190
|
+
comet state set ${e} tdd_mode <tdd|direct>`)}async function Hv(t,e){let n=await N(t,"workflow");if(n==="hotfix"||n==="tweak")return x();let r=await N(t,"review_mode");return r==="off"||r==="standard"||r==="thorough"?x():S(`review_mode must be off, standard, or thorough before leaving build, got '${r||"null"}'
|
|
191
191
|
Next: ask the user to choose review strength, then run:
|
|
192
|
-
comet state set ${e} review_mode <off|standard|thorough>`)}async function
|
|
193
|
-
Next: create the Design Doc and run: comet state set ${e} design_doc <path>`)}async function
|
|
192
|
+
comet state set ${e} review_mode <off|standard|thorough>`)}async function Yv(t){let e=await N(t,"verification_report");return!!e&&e!=="null"&&await H(e)}async function Vv(t){return await N(t,"branch_status")==="handled"}async function Jv(t){return await N(t,"archived")==="true"}async function Ws(t,e,n){let r=(await te($(),t,{label:`Classic Design Doc ${t}`})).replace(/^\uFEFF/u,""),i=!1;for(let o of r.split(/\r?\n/u)){if(!i){o==="---"&&(i=!0);continue}if(o==="---")break;if(new RegExp(`^${e}: ['"]?${n}['"]?\\s*$`,"u").test(o))return!0}return!1}async function Gv(t,e){let n=await N(t,"design_doc");return n&&n!=="null"&&await H(n)?x():S(`design_doc must point to an existing Superpowers Design Doc for full workflow before leaving design.
|
|
193
|
+
Next: create the Design Doc and run: comet state set ${e} design_doc <path>`)}async function zv(t,e){let n=await N(t,"handoff_context"),r=await N(t,"handoff_hash");if(!n||n==="null")return S(`handoff_context is missing from .comet.yaml
|
|
194
194
|
Next: run node "$COMET_HANDOFF" ${e} design --write before invoking Superpowers.`);if(!await G(n))return S(`handoff_context does not point to a non-empty file: ${n}
|
|
195
195
|
Next: regenerate the design handoff with comet handoff ${e} design --write.`);if(!/^[a-f0-9]{64}$/u.test(r))return S(`handoff_hash is missing or invalid: ${r||"null"}
|
|
196
196
|
Next: regenerate the design handoff with comet handoff ${e} design --write.`);let i=await Av(t);if(i!==r)return S(`OpenSpec artifacts changed after handoff was generated.
|
|
197
197
|
Expected handoff_hash: ${r}
|
|
198
198
|
Actual handoff_hash: ${i}
|
|
199
199
|
Next: run comet handoff ${e} design --write so Superpowers receives the current OpenSpec context.`);let o=`${n.replace(/\.json$/u,"")}.md`;return await G(o)?x():S(`design handoff markdown is missing or empty: ${o}
|
|
200
|
-
Next: regenerate the design handoff with comet handoff ${e} design --write.`)}async function
|
|
201
|
-
`))}async function Rf(t){return await N(t,"context_compression")||"off"}async function
|
|
202
|
-
`))}async function
|
|
203
|
-
Valid phases: open, design, build, verify, archive`);await Ss($());let s=await
|
|
204
|
-
`))n.stderr.push(a);return n.toResult(s.exitCode)}throw s}});function
|
|
205
|
-
`,...e.envelope===void 0?{}:{envelope:e.envelope}}}async function
|
|
200
|
+
Next: regenerate the design handoff with comet handoff ${e} design --write.`)}async function Qv(t){let e=await N(t,"handoff_context");if(!e||e==="null")return S("handoff_context is missing from .comet.yaml");let n=`${e.replace(/\.json$/u,"")}.md`;if(!await G(n))return S(`design handoff markdown is missing or empty: ${n}`);let r=await te($(),n,{label:`Classic handoff markdown ${n}`}),i=new Set(r.split(/\r?\n/u)),o=[];/^Generated-by: comet-handoff\.sh$/mu.test(r)||o.push("handoff markdown is missing Generated-by marker"),/^- Mode: (compact|full|beta)$/mu.test(r)||o.push("handoff markdown is missing Mode marker");for(let s of await Ms(t))await H(s)&&(i.has(`- Source: ${s}`)||o.push(`handoff markdown is missing source reference: ${s}`),i.has(`- SHA256: ${await xf(s)}`)||o.push(`handoff markdown is missing current sha256 for: ${s}`));return o.length===0?x():S(o.join(`
|
|
201
|
+
`))}async function Rf(t){return await N(t,"context_compression")||"off"}async function Xv(t){if(await Rf(t)!=="beta")return x();let e=await N(t,"handoff_context");if(!e||e==="null")return S("handoff_context is missing from .comet.yaml");if(!await G(e))return S(`spec-context.json is missing or empty: ${e}`);let n=await te($(),e,{label:`Classic handoff context ${e}`}),r=[],i;try{i=JSON.parse(n)}catch(a){return S(`spec-context.json invalid JSON: ${a instanceof Error?a.message:String(a)}`)}if(!i||typeof i!="object"||Array.isArray(i))return S("spec-context.json root must be an object");let o=i;typeof o.change!="string"&&r.push("spec-context.json missing 'change' field"),typeof o.phase!="string"&&r.push("spec-context.json missing 'phase' field"),o.mode!=="beta"&&r.push("spec-context.json mode is not beta"),typeof o.context_hash!="string"&&r.push("spec-context.json missing 'context_hash' field"),Array.isArray(o.files)||r.push("spec-context.json missing 'files' field");let s=Array.isArray(o.files)?o.files.filter(a=>!!a&&typeof a=="object"&&!Array.isArray(a)):[];for(let a of await Ms(t))await H(a)&&(s.some(c=>c.path===a&&typeof c.sha256=="string")||r.push(`spec-context.json missing source file reference: ${a}`));return r.length===0?x():S(r.join(`
|
|
202
|
+
`))}async function Zv(t,e){let n=await N(e,"workflow"),r=[E("proposal.md exists and non-empty",async()=>await G(T.join(e,"proposal.md"))?x():S("")),E("proposal.md matches configured language",()=>he(e,T.join(e,"proposal.md"))),E("tasks.md exists and non-empty",async()=>await G(T.join(e,"tasks.md"))?x():S("")),E("tasks.md matches configured language",()=>he(e,T.join(e,"tasks.md"))),E("tasks.md has at least one task",async()=>await Wv(e)?x():S(""))];return n==="full"&&r.splice(1,0,E("design.md exists and non-empty",async()=>await G(T.join(e,"design.md"))?x():S("")),E("design.md matches configured language",()=>he(e,T.join(e,"design.md")))),Nt(t,r)}async function ek(t,e,n){let r=await N(e,"design_doc"),i=await N(e,"workflow"),o=[E("proposal.md exists",async()=>await G(T.join(e,"proposal.md"))?x():S("")),E("proposal.md matches configured language",()=>he(e,T.join(e,"proposal.md"))),E("design.md exists",async()=>await G(T.join(e,"design.md"))?x():S("")),E("design.md matches configured language",()=>he(e,T.join(e,"design.md"))),E("tasks.md exists",async()=>await G(T.join(e,"tasks.md"))?x():S("")),E("tasks.md matches configured language",()=>he(e,T.join(e,"tasks.md"))),E("design handoff context exists",()=>zv(e,n)),E("design handoff markdown is traceable",()=>Qv(e))];await Rf(e)==="beta"&&o.push(E("beta spec-context.json is structurally valid",()=>Xv(e))),i==="full"&&o.push(E("design_doc is recorded for full workflow",()=>Gv(e,n)));let s=await Nt(t,o);return r&&r!=="null"?s=await Nt(t,[E(`Design Doc (${r}) exists`,async()=>await G(r)?x():S("")),E("Design Doc matches configured language",()=>he(e,r)),E("Design Doc frontmatter links current change",async()=>await G(r)&&await Ws(r,"comet_change",n)?x():S("")),E("Design Doc declares technical design role",async()=>await G(r)&&await Ws(r,"role","technical-design")?x():S("")),E("Design Doc declares OpenSpec as canonical spec",async()=>await G(r)&&await Ws(r,"canonical_spec","openspec")?x():S(""))])||s:i!=="full"&&t.stderr.push(kv(" [WARN] No design_doc recorded in .comet.yaml (optional for hotfix/tweak)")),s}async function tk(t,e,n,r){return Nt(t,[E("bound branch matches workspace mode",()=>Ks(e,n)),E("isolation selected",()=>Dv(e,n)),E("build_mode selected",()=>Mv(e,n)),E("build_mode allowed for workflow",()=>Bv(e)),E("subagent dispatch confirmed",()=>Kv(e,n)),E("tdd_mode selected",()=>Uv(e,n)),E("review_mode selected",()=>Hv(e,n)),E("tasks.md all tasks checked",()=>Bs(e)),E("Superpowers plan all tasks checked",()=>Fv(e)),E("proposal.md exists",async()=>await G(T.join(e,"proposal.md"))?x():S("")),E("proposal.md matches configured language",()=>he(e,T.join(e,"proposal.md"))),E("Superpowers plan matches configured language",async()=>{let i=await N(e,"plan");return!i||i==="null"||!await H(i)?x():he(e,i)}),E("Build passes",async()=>{let i=await Pf(e,n,r,"build");return i.status===0?x(i.output):S(i.output)})])}async function nk(t,e,n,r){return Nt(t,[E("bound branch matches workspace mode",()=>Ks(e,n)),E("tasks.md all tasks checked",()=>Bs(e)),E("Verification passes",async()=>{let i=await Pf(e,n,r,"verify");return i.status===0?x(i.output):S(i.output)}),E("verification_report exists",async()=>await Yv(e)?x():S("")),E("verification_report matches configured language",async()=>{let i=await N(e,"verification_report");return!i||i==="null"||!await H(i)?x():he(e,i)})])}async function rk(t,e,n){return Nt(t,[E("bound branch matches workspace mode",()=>Ks(e,n)),E("archived is true",async()=>await Jv(e)?x():S("")),E("proposal.md exists",async()=>await G(T.join(e,"proposal.md"))?x():S("")),E("design.md exists",async()=>await G(T.join(e,"design.md"))?x():S("")),E("tasks.md all tasks checked",()=>Bs(e)),E("branch_status=handled",async()=>await Vv(e)?x():S(""))])}async function ik(t,e,n,r){let i=ff[r];if(!i)return;let o=await mi(n),s=df(o.classic,i);await sf(n,s.classic,o.run,{event:i,phase:r,source:"comet-guard"}),await uf(n,{change:e,event:i,source:"comet-guard",from:o.classic,to:s.classic,effects:s.effects});for(let l of s.effects)t.stderr.push(At(`[SET] ${bv(l.field)}=${Sv(l.to)}`));t.stderr.push(At(`[TRANSITION] ${i}`));let a=yv[r],c=r==="open"?a.replace("PLACEHOLDER",s.classic.phase):a;t.stderr.push(At(c))}var Of=gi(async(t,e)=>{let n=new Fs,[r,i,o]=t;try{if(Cv(r),!i||!gv.includes(i))throw new de(`${Ee(`Unknown phase: ${i??""}`)}
|
|
203
|
+
Valid phases: open, design, build, verify, archive`);await Ss($());let s=await Ev(r);await Nv(s,r);let a=await mi(s),c=await lf(s,r);e.json&&(n.diagnostics={change:r,phase:i,currentStep:c.currentStep,runtimeEval:c.runtimeEval}),n.stderr.push(wv[i]);let l;i==="open"?l=await Zv(n,s):i==="design"?l=await ek(n,s,r):i==="build"?l=await tk(n,s,r,a.run):i==="verify"?l=await nk(n,s,r,a.run):l=await rk(n,s,r);let u=$l({name:r,phase:i,failed:n.checksFailed,total:n.checksPassed+n.checksFailed,locale:Tl(a.classic.language)});return n.envelope=u,l?(n.stderr.push(""),n.stderr.push(u.summary),u.user_message&&n.stderr.push(`RELAY TO USER: ${u.user_message}`),n.stderr.push(""),n.stderr.push(Ee("BLOCKED — fix failing checks before proceeding to next phase")),n.toResult(1)):(n.stderr.push(""),n.stderr.push(u.summary),n.stderr.push(At("ALL CHECKS PASSED — ready for next phase")),o==="--apply"&&await ik(n,r,s,i),n.toResult(0))}catch(s){if(s instanceof de){for(let a of s.message.split(`
|
|
204
|
+
`))n.stderr.push(a);return n.toResult(s.exitCode)}throw s}});function ok(t,e){return{exitCode:e.exitCode,stdout:JSON.stringify({command:t,exitCode:e.exitCode,...e.envelope===void 0?{}:{summary:e.envelope.summary,...e.envelope.next===void 0?{}:{next:e.envelope.next},...e.envelope.user_message===void 0?{}:{user_message:e.envelope.user_message}},...e.stdout===void 0?{}:{stdout:e.stdout},...e.stderr===void 0?{}:{stderr:e.stderr}})+`
|
|
205
|
+
`,...e.envelope===void 0?{}:{envelope:e.envelope}}}async function Af(t,e,n=process.argv.slice(2)){let r=n.includes("--json"),i=n.filter(a=>a!=="--json"),o;try{o=await e(i,{json:r})}catch(a){o={exitCode:70,stderr:a instanceof Error?a.message:String(a)}}let s=r?ok(t,o):o;return s.stdout&&process.stdout.write(s.stdout),s.stderr&&process.stderr.write(s.stderr+(s.stderr.endsWith(`
|
|
206
206
|
`)?"":`
|
|
207
|
-
`)),s.exitCode}process.exitCode=await
|
|
207
|
+
`)),s.exitCode}process.exitCode=await Af("guard",Of);
|