@meetquinn/animactl 0.1.29 → 0.1.30-canary.659.1.751bf80
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/dist/server/providers/codex-app-server.d.ts.map +1 -1
- package/dist/server/providers/codex-app-server.js +12 -2
- package/dist/server/providers/provider-failure.d.ts +4 -0
- package/dist/server/providers/provider-failure.d.ts.map +1 -1
- package/dist/server/providers/provider-failure.js +7 -0
- package/dist/server/providers/provider-retry.d.ts.map +1 -1
- package/dist/server/providers/provider-retry.js +4 -2
- package/dist/server/runtime/failure-notice.d.ts +1 -2
- package/dist/server/runtime/failure-notice.d.ts.map +1 -1
- package/dist/server/runtime/failure-notice.js +5 -3
- package/dist/server/tests/agent-runtime-codex.test.js +54 -0
- package/dist/server/tests/failure-notice.test.js +11 -0
- package/dist/server/tests/helpers/codex-terminal.d.ts +3 -0
- package/dist/server/tests/helpers/codex-terminal.d.ts.map +1 -0
- package/dist/server/tests/helpers/codex-terminal.js +43 -0
- package/dist/server/tests/provider-retry.test.js +11 -0
- package/dist/server/tests/runtime-worker-failures.test.js +63 -1
- package/dist/web/assets/{FileViewer-mplux3c7.js → FileViewer-BE7ZbYC2.js} +3 -3
- package/dist/web/assets/{OwnerPickerForm-D3CppxIo.js → OwnerPickerForm-BgdNoozq.js} +1 -1
- package/dist/web/assets/{SlackTimeline-B7ReHImC.js → SlackTimeline-9pIsb7oq.js} +1 -1
- package/dist/web/assets/{UsageHeatmap-Dm11Gebc.js → UsageHeatmap-DBQp1aZ6.js} +1 -1
- package/dist/web/assets/{activity-DWNn0mmK.js → activity-BSkXCkpu.js} +1 -1
- package/dist/web/assets/{arc-zuuXhVKT.js → arc-D-CtHZKj.js} +1 -1
- package/dist/web/assets/architecture-7EHR7CIX-DpjboYKJ.js +1 -0
- package/dist/web/assets/{architectureDiagram-3BPJPVTR-BW8_2Ian.js → architectureDiagram-3BPJPVTR-Dorn3IJv.js} +1 -1
- package/dist/web/assets/arrow-right-DeZ0i6I5.js +1 -0
- package/dist/web/assets/{blockDiagram-GPEHLZMM-CDaTkyKI.js → blockDiagram-GPEHLZMM-C0KuqDUn.js} +1 -1
- package/dist/web/assets/{c4Diagram-AAUBKEIU-C1cmLvLV.js → c4Diagram-AAUBKEIU-DGzmlEsm.js} +1 -1
- package/dist/web/assets/channel-BXKAB9-g.js +1 -0
- package/dist/web/assets/{channels-DNXnO29I.js → channels-DSO-EF4z.js} +1 -1
- package/dist/web/assets/{chunk-2J33WTMH-CiqjRz2t.js → chunk-2J33WTMH-0Lf66dvk.js} +1 -1
- package/dist/web/assets/{chunk-3OPIFGDE-4YRS3E_0.js → chunk-3OPIFGDE-uxQb2Nkf.js} +1 -1
- package/dist/web/assets/{chunk-4BX2VUAB-CbLx6qzf.js → chunk-4BX2VUAB-6yXLCjrv.js} +1 -1
- package/dist/web/assets/{chunk-55IACEB6-Bgq2b87K.js → chunk-55IACEB6-6gNE1J0G.js} +1 -1
- package/dist/web/assets/{chunk-5ZQYHXKU-T_9OQG40.js → chunk-5ZQYHXKU-DtBCzupz.js} +1 -1
- package/dist/web/assets/{chunk-727SXJPM-C-E343ga.js → chunk-727SXJPM-COnaWyCt.js} +1 -1
- package/dist/web/assets/{chunk-AQP2D5EJ-BN8dyuW0.js → chunk-AQP2D5EJ-DyLydJD9.js} +1 -1
- package/dist/web/assets/{chunk-BSJP7CBP-BBnQLVIN.js → chunk-BSJP7CBP-DyRITwu0.js} +1 -1
- package/dist/web/assets/{chunk-CSCIHK7Q-Bd77GAxB.js → chunk-CSCIHK7Q-Cn4r2bzv.js} +3 -3
- package/dist/web/assets/{chunk-FMBD7UC4-CMn7Swt8.js → chunk-FMBD7UC4-SAiyBD1e.js} +1 -1
- package/dist/web/assets/{chunk-KSCS5N6A-C9o8GPjw.js → chunk-KSCS5N6A-Cpm1w6F1.js} +1 -1
- package/dist/web/assets/{chunk-L5ZTLDWV-BzMFLfdp.js → chunk-L5ZTLDWV-DDJHTPqx.js} +1 -1
- package/dist/web/assets/{chunk-LZXEDZCA-Dbtxv-E_.js → chunk-LZXEDZCA-RGqKWRFm.js} +2 -2
- package/dist/web/assets/{chunk-ND2GUHAM-CABS61mz.js → chunk-ND2GUHAM-grRF04Fw.js} +1 -1
- package/dist/web/assets/{chunk-NZK2D7GU-DdX3ykYF.js → chunk-NZK2D7GU-DvxYOnAF.js} +1 -1
- package/dist/web/assets/{chunk-O5CBEL6O-DHZojc-l.js → chunk-O5CBEL6O-CC3LEe-H.js} +1 -1
- package/dist/web/assets/chunk-QZHKN3VN-I_ujsRgs.js +1 -0
- package/dist/web/assets/chunk-WU5MYG2G-AKmH_Uhx.js +1 -0
- package/dist/web/assets/{chunk-XPW4576I-Diox9iR7.js → chunk-XPW4576I-CLi_UqUg.js} +1 -1
- package/dist/web/assets/classDiagram-4FO5ZUOK-DymBTEus.js +1 -0
- package/dist/web/assets/classDiagram-v2-Q7XG4LA2-DymBTEus.js +1 -0
- package/dist/web/assets/{copy-D3weV6Zt.js → copy-BlDDZTIe.js} +1 -1
- package/dist/web/assets/{cose-bilkent-S5V4N54A-Dke-0aSM.js → cose-bilkent-S5V4N54A-BNcJ2jTH.js} +1 -1
- package/dist/web/assets/{dagre-BM42HDAG-Dk212SCz.js → dagre-BM42HDAG-Dn4xciB4.js} +1 -1
- package/dist/web/assets/{diagram-2AECGRRQ-C_1Fsn5m.js → diagram-2AECGRRQ-CVo5v2L9.js} +1 -1
- package/dist/web/assets/{diagram-5GNKFQAL-BXwDuhQz.js → diagram-5GNKFQAL-B72Pydsz.js} +1 -1
- package/dist/web/assets/{diagram-KO2AKTUF-CNS9fRNt.js → diagram-KO2AKTUF-DxsC6MX9.js} +1 -1
- package/dist/web/assets/{diagram-LMA3HP47-DHitN7GO.js → diagram-LMA3HP47-DulAGprm.js} +1 -1
- package/dist/web/assets/{diagram-OG6HWLK6-BXI3ZNNk.js → diagram-OG6HWLK6-D0NjYrYd.js} +1 -1
- package/dist/web/assets/{dist-CAuTSykB.js → dist-D0UlfIR-.js} +1 -1
- package/dist/web/assets/{erDiagram-TEJ5UH35-c8BSSS1p.js → erDiagram-TEJ5UH35-C9lX42Xe.js} +1 -1
- package/dist/web/assets/eventmodeling-FCH6USID-DndRl21l.js +1 -0
- package/dist/web/assets/{files-BWOOA1ux.js → files-BwS9fNHc.js} +1 -1
- package/dist/web/assets/{flowDiagram-I6XJVG4X-yXheh5UG.js → flowDiagram-I6XJVG4X-CKj-euC4.js} +1 -1
- package/dist/web/assets/{ganttDiagram-6RSMTGT7-CIsG0y0g.js → ganttDiagram-6RSMTGT7-CzDUhkGD.js} +1 -1
- package/dist/web/assets/gitGraph-WXDBUCRP-B0TcYNTU.js +1 -0
- package/dist/web/assets/{gitGraphDiagram-PVQCEYII-CFMmpa-l.js → gitGraphDiagram-PVQCEYII-DJcGLASX.js} +1 -1
- package/dist/web/assets/index-DIncpmwE.css +2 -0
- package/dist/web/assets/{index-DC1JShUA.js → index-kDv99MPW.js} +2 -2
- package/dist/web/assets/info-J43DQDTF-BskncCTl.js +1 -0
- package/dist/web/assets/{infoDiagram-5YYISTIA-CIf4-OTY.js → infoDiagram-5YYISTIA-Cep1I2UG.js} +1 -1
- package/dist/web/assets/{ishikawaDiagram-YF4QCWOH-CngaXDTZ.js → ishikawaDiagram-YF4QCWOH-frWojGGC.js} +1 -1
- package/dist/web/assets/{journeyDiagram-JHISSGLW-CbeAtjk2.js → journeyDiagram-JHISSGLW-Doolx6RW.js} +1 -1
- package/dist/web/assets/{kanban-definition-UN3LZRKU-RAZTDewZ.js → kanban-definition-UN3LZRKU-DqR_CH6S.js} +1 -1
- package/dist/web/assets/{kb-DypFFd0U.js → kb-CNANeE9V.js} +1 -1
- package/dist/web/assets/{lightbulb-DSr3D1kH.js → lightbulb-DxN3hBy3.js} +1 -1
- package/dist/web/assets/{line-Bho5WXXr.js → line-Bkro79BZ.js} +1 -1
- package/dist/web/assets/{linear--aaHXDEb.js → linear-96ENRi6V.js} +1 -1
- package/dist/web/assets/{login-DiC9sre4.js → login-COG3LrWg.js} +1 -1
- package/dist/web/assets/{mermaid-parser.core-CoWLsAeO.js → mermaid-parser.core-wGsHw9nz.js} +2 -2
- package/dist/web/assets/{mermaid.core-d2YYcY2v.js → mermaid.core-kFGsR4Cp.js} +3 -3
- package/dist/web/assets/{mindmap-definition-RKZ34NQL-CaLOPkTp.js → mindmap-definition-RKZ34NQL-FB0wMlLX.js} +1 -1
- package/dist/web/assets/{onboarding-COyr_ARb.js → onboarding-DRWlCq-6.js} +1 -1
- package/dist/web/assets/packet-YPE3B663-DLTEWJ0G.js +1 -0
- package/dist/web/assets/pie-LRSECV5Y-D7UHmLz8.js +1 -0
- package/dist/web/assets/{pieDiagram-4H26LBE5-R_R4-bRb.js → pieDiagram-4H26LBE5-dV6RlYp8.js} +1 -1
- package/dist/web/assets/{profile-D0miqc_D.js → profile-ChM4Tp02.js} +1 -1
- package/dist/web/assets/{quadrantDiagram-W4KKPZXB-BeBsJ532.js → quadrantDiagram-W4KKPZXB-6UA3hR5k.js} +1 -1
- package/dist/web/assets/radar-GUYGQ44K-XbI5knCI.js +1 -0
- package/dist/web/assets/{reminders-CeoDEN9U.js → reminders-Cwxgyn6U.js} +1 -1
- package/dist/web/assets/{requirementDiagram-4Y6WPE33-C4bNAzf4.js → requirementDiagram-4Y6WPE33-C0onkx6B.js} +1 -1
- package/dist/web/assets/{sankeyDiagram-5OEKKPKP-CxA99fTK.js → sankeyDiagram-5OEKKPKP-CJzNWzNe.js} +1 -1
- package/dist/web/assets/search-BUI5DQcN.js +1 -0
- package/dist/web/assets/{sequenceDiagram-3UESZ5HK-DzZQxej0.js → sequenceDiagram-3UESZ5HK-DWrgNc9O.js} +1 -1
- package/dist/web/assets/{settings-C8-_RW8n.js → settings-D5xAcNnm.js} +1 -1
- package/dist/web/assets/{src-CjxDklmL.js → src-Br-T91UW.js} +1 -1
- package/dist/web/assets/{stateDiagram-AJRCARHV-BbivrNRl.js → stateDiagram-AJRCARHV-B_2sZ3ZK.js} +1 -1
- package/dist/web/assets/stateDiagram-v2-BHNVJYJU-CPuyBHKv.js +1 -0
- package/dist/web/assets/{timeline-definition-PNZ67QCA-CBssphoj.js → timeline-definition-PNZ67QCA-kcC_hxEM.js} +1 -1
- package/dist/web/assets/treeView-BLDUP644-Chr2chAT.js +1 -0
- package/dist/web/assets/treemap-LRROVOQU-DlFT9jUS.js +1 -0
- package/dist/web/assets/{useInfiniteQuery-Coml0oEh.js → useInfiniteQuery-hOF7_6Fr.js} +1 -1
- package/dist/web/assets/{useNow-fH4CiFQb.js → useNow-gyD-mImi.js} +1 -1
- package/dist/web/assets/{vennDiagram-CIIHVFJN-DNDlDqER.js → vennDiagram-CIIHVFJN-Bur264ZU.js} +1 -1
- package/dist/web/assets/wardley-L42UT6IY-Dv7cNR-Z.js +1 -0
- package/dist/web/assets/{wardleyDiagram-YWT4CUSO-BhYBX976.js → wardleyDiagram-YWT4CUSO-GBT8PyrS.js} +1 -1
- package/dist/web/assets/{xychartDiagram-2RQKCTM6-hdr2Dn1k.js → xychartDiagram-2RQKCTM6-Dq2z46s5.js} +1 -1
- package/dist/web/index.html +2 -2
- package/package.json +1 -1
- package/dist/web/assets/architecture-7EHR7CIX-dvxyIMD3.js +0 -1
- package/dist/web/assets/arrow-right-lLhwM36X.js +0 -1
- package/dist/web/assets/channel-BGKJRQtk.js +0 -1
- package/dist/web/assets/chunk-QZHKN3VN-obYJNMcC.js +0 -1
- package/dist/web/assets/chunk-WU5MYG2G-B3gceYfr.js +0 -1
- package/dist/web/assets/classDiagram-4FO5ZUOK-CRscGdJI.js +0 -1
- package/dist/web/assets/classDiagram-v2-Q7XG4LA2-CRscGdJI.js +0 -1
- package/dist/web/assets/eventmodeling-FCH6USID-XYllBxDi.js +0 -1
- package/dist/web/assets/gitGraph-WXDBUCRP-Df1K14Ut.js +0 -1
- package/dist/web/assets/index-B5Jh701h.css +0 -2
- package/dist/web/assets/info-J43DQDTF-DvRzxclG.js +0 -1
- package/dist/web/assets/packet-YPE3B663-CsXVjxzt.js +0 -1
- package/dist/web/assets/pie-LRSECV5Y-DNqaWVJh.js +0 -1
- package/dist/web/assets/radar-GUYGQ44K-A60Pn0Gc.js +0 -1
- package/dist/web/assets/search-BaIhlulB.js +0 -1
- package/dist/web/assets/stateDiagram-v2-BHNVJYJU-BStfQkE2.js +0 -1
- package/dist/web/assets/treeView-BLDUP644-B15d4pQx.js +0 -1
- package/dist/web/assets/treemap-LRROVOQU-CPIjKEU-.js +0 -1
- package/dist/web/assets/wardley-L42UT6IY-M2STgxwB.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codex-app-server.d.ts","sourceRoot":"","sources":["../../../server/providers/codex-app-server.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAkB9D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAEvD,OAAO,KAAK,EAAE,2BAA2B,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAGlG,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"codex-app-server.d.ts","sourceRoot":"","sources":["../../../server/providers/codex-app-server.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAkB9D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAEvD,OAAO,KAAK,EAAE,2BAA2B,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAGlG,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,yBAAyB,CAAC;AAI/E,UAAU,WAAW;IACnB,EAAE,EAAE,MAAM,CAAC;CACZ;AA+BD,qBAAa,wBAAwB;IA+BjC,OAAO,CAAC,QAAQ,CAAC,KAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,WAAW;IAC5B,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAC;IACjC,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAC;IAjCvC,OAAO,CAAC,WAAW,CAAC,CAAoB;IACxC,OAAO,CAAC,uBAAuB,CAAK;IACpC,OAAO,CAAC,+BAA+B,CAAQ;IAC/C,OAAO,CAAC,sBAAsB,CAAC,CAAiB;IAChD,OAAO,CAAC,yBAAyB,CAAC,CAAgB;IAClD,OAAO,CAAC,+BAA+B,CAAS;IAChD,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAoB;IAChD,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,MAAM,CAAK;IACnB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA0C;IAClE,OAAO,CAAC,QAAQ,CAAC,cAAc,CAA0D;IACzF,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAsC;IACvE,OAAO,CAAC,QAAQ,CAAC,UAAU,CAA6B;IACxD,OAAO,CAAC,QAAQ,CAAC,WAAW,CAA8C;IAC1E,OAAO,CAAC,QAAQ,CAAC,qBAAqB,CAAqB;IAC3D,OAAO,CAAC,QAAQ,CAAC,qBAAqB,CAAgD;IACtF,OAAO,CAAC,QAAQ,CAAC,wBAAwB,CAAqB;IAC9D,OAAO,CAAC,QAAQ,CAAC,uBAAuB,CAAqB;IAC7D,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAA8C;IAChF,OAAO,CAAC,QAAQ,CAAC,wBAAwB,CAAqB;IAC9D,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAA4B;IAC7D,OAAO,CAAC,WAAW,CAAC,CAAkB;IACtC,OAAO,CAAC,yBAAyB,CAAS;IAC1C,OAAO,CAAC,UAAU,CAAM;IACxB,OAAO,CAAC,eAAe,CAAC,CAAS;IACjC,QAAQ,SAAM;IACd,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;gBAG9C,KAAK,EAAE,mBAAmB,EAC1B,WAAW,EAAE,MAAM,EACnB,eAAe,CAAC,EAAE,MAAM,YAAA,EACxB,mBAAmB,CAAC,GAAE,CAAC,MAAM,EAAE,+BAA+B,KAAK,IAAI,aAAA;IAkBpF,YAAY,CAAC,KAAK,EAAE,iBAAiB,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,WAAW,CAAC;IAUnG,SAAS,CAAC,KAAK,EAAE,iBAAiB,GAAG,IAAI;IAMzC,SAAS,CAAC,KAAK,EAAE,iBAAiB,GAAG,IAAI;IAInC,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAoB3B,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,WAAW,CAAC;IAKlE,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,WAAW,CAAC;IAKrF,SAAS,CACb,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,KAAK,EAAE,iBAAiB,EACxB,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,GACtC,OAAO,CAAC,MAAM,CAAC;IA+ClB,YAAY,IAAI,OAAO,CAAC,MAAM,CAAC,GAAG,SAAS;IAK3C,gBAAgB,CAAC,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IAIrD,WAAW,IAAI,OAAO;IAOtB,YAAY,IAAI,oBAAoB,GAAG,SAAS;IAQhD,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,GAAG,OAAO,CAAC,OAAO,CAAC;IAStF,IAAI,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,OAAO,GAAG,IAAI;IAInC,QAAQ,IAAI,2BAA2B;IAIvC,OAAO,CAAC,MAAM;IAId,OAAO,CAAC,iBAAiB;IAOnB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAI/C,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;YAevC,UAAU;YA+BV,kBAAkB;IAiHhC,OAAO,CAAC,8BAA8B;IAItC,OAAO,CAAC,sBAAsB;IAI9B,OAAO,CAAC,0BAA0B;YAsCpB,uBAAuB;IAmBrC,OAAO,CAAC,8BAA8B;IAStC,OAAO,CAAC,+BAA+B;IAQvC,OAAO,CAAC,uBAAuB;YAyBjB,oBAAoB;YAOpB,qBAAqB;YAoBrB,wBAAwB;YAiBxB,wBAAwB;YAcxB,qBAAqB;YA0BrB,0BAA0B;CAUzC"}
|
|
@@ -7,6 +7,7 @@ import { truncateForActivity } from '../activities/format.js';
|
|
|
7
7
|
import { LineBuffer } from './line-buffer.js';
|
|
8
8
|
import { QuiescentWaiterSet } from './quiescent-waiters.js';
|
|
9
9
|
import { providerUsageFromStats } from './provider-usage.js';
|
|
10
|
+
import { ProviderTurnFailedError } from './provider-failure.js';
|
|
10
11
|
export class CodexAppServerController {
|
|
11
12
|
child;
|
|
12
13
|
runtimeKind;
|
|
@@ -23,7 +24,7 @@ export class CodexAppServerController {
|
|
|
23
24
|
initialized = false;
|
|
24
25
|
nextId = 1;
|
|
25
26
|
pending = new Map();
|
|
26
|
-
completedTurns = new
|
|
27
|
+
completedTurns = new Map();
|
|
27
28
|
linkedTextByItem = new Map();
|
|
28
29
|
textByTurn = new Map();
|
|
29
30
|
usageByTurn = new Map();
|
|
@@ -122,6 +123,9 @@ export class CodexAppServerController {
|
|
|
122
123
|
if (!this.completedTurns.has(turnId)) {
|
|
123
124
|
await turn.completed.promise;
|
|
124
125
|
}
|
|
126
|
+
const failure = this.completedTurns.get(turnId);
|
|
127
|
+
if (failure)
|
|
128
|
+
throw failure;
|
|
125
129
|
const text = this.textByTurn.get(turnId) ?? '';
|
|
126
130
|
if (text.trim())
|
|
127
131
|
await onText(text.trim());
|
|
@@ -354,7 +358,13 @@ export class CodexAppServerController {
|
|
|
354
358
|
}
|
|
355
359
|
this.usageByTurn.delete(turnId);
|
|
356
360
|
this.refreshBackgroundTerminals();
|
|
357
|
-
|
|
361
|
+
// Store the outcome before waking the waiter. Completion can arrive before
|
|
362
|
+
// turn/start responds; rejecting a not-yet-awaited promise loses that race.
|
|
363
|
+
const failure = stringParam(turn, 'status') === 'failed'
|
|
364
|
+
? new ProviderTurnFailedError(stringParam(recordParam(turn, 'error'), 'message')?.trim()
|
|
365
|
+
|| 'Codex turn failed without an error message')
|
|
366
|
+
: undefined;
|
|
367
|
+
this.completedTurns.set(turnId, failure);
|
|
358
368
|
if (this.currentTurn?.turnId === turnId)
|
|
359
369
|
this.currentTurn.completed.resolve();
|
|
360
370
|
}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import type { AgentHealthReason } from '../../shared/snapshot.js';
|
|
2
|
+
/** A started turn failed; actions may have run, so replay needs a human decision. */
|
|
3
|
+
export declare class ProviderTurnFailedError extends Error {
|
|
4
|
+
constructor(message: string);
|
|
5
|
+
}
|
|
2
6
|
export type ProviderFailureReason = 'provider_auth_failed' | 'provider_error' | 'provider_quota_exhausted' | 'provider_rate_limited' | 'process_crash' | (string & {});
|
|
3
7
|
export declare function classifyProviderFailureReason(input: {
|
|
4
8
|
message?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider-failure.d.ts","sourceRoot":"","sources":["../../../server/providers/provider-failure.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAGlE,MAAM,MAAM,qBAAqB,GAC7B,sBAAsB,GACtB,gBAAgB,GAChB,0BAA0B,GAC1B,uBAAuB,GACvB,eAAe,GACf,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;AAElB,wBAAgB,6BAA6B,CAAC,KAAK,EAAE;IACnD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,GAAG,qBAAqB,CAWxB;AAED,wBAAgB,8BAA8B,CAAC,KAAK,EAAE,OAAO,GAAG,qBAAqB,CAUpF;AAED,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,qBAAqB,GAAG,iBAAiB,GAAG,SAAS,CAMxG"}
|
|
1
|
+
{"version":3,"file":"provider-failure.d.ts","sourceRoot":"","sources":["../../../server/providers/provider-failure.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAGlE,qFAAqF;AACrF,qBAAa,uBAAwB,SAAQ,KAAK;gBACpC,OAAO,EAAE,MAAM;CAI5B;AAED,MAAM,MAAM,qBAAqB,GAC7B,sBAAsB,GACtB,gBAAgB,GAChB,0BAA0B,GAC1B,uBAAuB,GACvB,eAAe,GACf,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;AAElB,wBAAgB,6BAA6B,CAAC,KAAK,EAAE;IACnD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,GAAG,qBAAqB,CAWxB;AAED,wBAAgB,8BAA8B,CAAC,KAAK,EAAE,OAAO,GAAG,qBAAqB,CAUpF;AAED,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,qBAAqB,GAAG,iBAAiB,GAAG,SAAS,CAMxG"}
|
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
import { errorMessage } from '../ids.js';
|
|
2
|
+
/** A started turn failed; actions may have run, so replay needs a human decision. */
|
|
3
|
+
export class ProviderTurnFailedError extends Error {
|
|
4
|
+
constructor(message) {
|
|
5
|
+
super(message);
|
|
6
|
+
this.name = 'ProviderTurnFailedError';
|
|
7
|
+
}
|
|
8
|
+
}
|
|
2
9
|
export function classifyProviderFailureReason(input) {
|
|
3
10
|
const text = [input.message, input.subtype].filter(Boolean).join(' ');
|
|
4
11
|
const status = statusCode(input.status);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider-retry.d.ts","sourceRoot":"","sources":["../../../server/providers/provider-retry.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,kBAAkB,GAAG,OAAO,GAAG,WAAW,GAAG,cAAc,GAAG,UAAU,CAAC;AA2BrF,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAE5D;AAED,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,GAAG,kBAAkB,
|
|
1
|
+
{"version":3,"file":"provider-retry.d.ts","sourceRoot":"","sources":["../../../server/providers/provider-retry.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,kBAAkB,GAAG,OAAO,GAAG,WAAW,GAAG,cAAc,GAAG,UAAU,CAAC;AA2BrF,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAE5D;AAED,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,GAAG,kBAAkB,CASxE;AAMD;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,IAAI,GAAG,IAAI,CAKzE"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { errorMessage } from '../ids.js';
|
|
2
|
-
import { providerFailureReasonFromError } from './provider-failure.js';
|
|
2
|
+
import { ProviderTurnFailedError, providerFailureReasonFromError } from './provider-failure.js';
|
|
3
3
|
const CRASH_PATTERN = /runtime exited before completing|runtime terminated by|runtime exited with code|stdin is closed/i;
|
|
4
4
|
const TRANSIENT_PATTERN = new RegExp([
|
|
5
5
|
String.raw `\b(?:5\d\d|408)\b`,
|
|
@@ -24,9 +24,11 @@ const TRANSIENT_PATTERN = new RegExp([
|
|
|
24
24
|
String.raw `\bE(?:CONN\w+|AI_AGAIN|PIPE|HOSTUNREACH|NETUNREACH)\b`,
|
|
25
25
|
].join('|'), 'i');
|
|
26
26
|
export function isProviderCrashError(error) {
|
|
27
|
-
return CRASH_PATTERN.test(errorMessage(error));
|
|
27
|
+
return !(error instanceof ProviderTurnFailedError) && CRASH_PATTERN.test(errorMessage(error));
|
|
28
28
|
}
|
|
29
29
|
export function classifyProviderRetry(error) {
|
|
30
|
+
if (error instanceof ProviderTurnFailedError)
|
|
31
|
+
return 'terminal';
|
|
30
32
|
if (isProviderCrashError(error))
|
|
31
33
|
return 'crash';
|
|
32
34
|
const reason = providerFailureReasonFromError(error);
|
|
@@ -18,8 +18,7 @@ export interface SlackFailureNoticePost {
|
|
|
18
18
|
}
|
|
19
19
|
/**
|
|
20
20
|
* Short, requester-facing explanation. Deliberately plain: the person who
|
|
21
|
-
* asked needs
|
|
22
|
-
* not the provider's full diagnostic.
|
|
21
|
+
* asked needs the failure and a safe next step, not the provider's full diagnostic.
|
|
23
22
|
*/
|
|
24
23
|
export declare function failureNoticeText(failure: RuntimeItemFailure): string;
|
|
25
24
|
export declare function failureReasonSummary(failure: RuntimeItemFailure): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"failure-notice.d.ts","sourceRoot":"","sources":["../../../server/runtime/failure-notice.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAGhD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAChE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAKzE,sFAAsF;AACtF,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,OAAO,CAAC;IACf,qFAAqF;IACrF,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,kBAAkB,GAAG,gCAAgC,GAAG,SAAS,CAAC;CAC/E;AAED,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,KAAK,CAAC;IACpB,YAAY,EAAE,KAAK,CAAC;CACrB;AAID
|
|
1
|
+
{"version":3,"file":"failure-notice.d.ts","sourceRoot":"","sources":["../../../server/runtime/failure-notice.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAGhD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAChE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAKzE,sFAAsF;AACtF,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,OAAO,CAAC;IACf,qFAAqF;IACrF,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,kBAAkB,GAAG,gCAAgC,GAAG,SAAS,CAAC;CAC/E;AAED,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,KAAK,CAAC;IACpB,YAAY,EAAE,KAAK,CAAC;CACrB;AAID;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,kBAAkB,GAAG,MAAM,CAKrE;AAED,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,kBAAkB,GAAG,MAAM,CAYxE;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,SAAS,GAAG,OAAO,CAM9D;AAED,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,kBAAkB,GAAG,sBAAsB,GAAG,SAAS,CAUvH;AAED,wBAAsB,wBAAwB,CAAC,KAAK,EAAE;IACpD,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,kBAAkB,CAAC;IAC5B,YAAY,CAAC,EAAE,IAAI,CAAC,mBAAmB,EAAE,WAAW,CAAC,CAAC;IACtD,IAAI,EAAE,SAAS,CAAC;IAChB,MAAM,CAAC,EAAE,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAChC,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;CACvC,GAAG,OAAO,CAAC,OAAO,CAAC,CAmCnB"}
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import { errorMessage } from '../ids.js';
|
|
2
|
-
import { providerFailureReasonFromError } from '../providers/provider-failure.js';
|
|
2
|
+
import { ProviderTurnFailedError, providerFailureReasonFromError } from '../providers/provider-failure.js';
|
|
3
3
|
import { recordRuntimeEvent } from './activity.js';
|
|
4
4
|
import { SLACK_NO_UNFURL } from '../tools/slack-message-format.js';
|
|
5
5
|
const MAX_REASON_CHARS = 160;
|
|
6
6
|
/**
|
|
7
7
|
* Short, requester-facing explanation. Deliberately plain: the person who
|
|
8
|
-
* asked needs
|
|
9
|
-
* not the provider's full diagnostic.
|
|
8
|
+
* asked needs the failure and a safe next step, not the provider's full diagnostic.
|
|
10
9
|
*/
|
|
11
10
|
export function failureNoticeText(failure) {
|
|
11
|
+
if (failure.error instanceof ProviderTurnFailedError) {
|
|
12
|
+
return `⚠️ This turn failed (${failureReasonSummary(failure)}). Some actions may already have run. I haven't automatically retried; please check progress before asking me to continue.`;
|
|
13
|
+
}
|
|
12
14
|
return `⚠️ I couldn't process this message (${failureReasonSummary(failure)}). Please send it again.`;
|
|
13
15
|
}
|
|
14
16
|
export function failureReasonSummary(failure) {
|
|
@@ -5,6 +5,8 @@ import { join } from 'node:path';
|
|
|
5
5
|
import test from 'node:test';
|
|
6
6
|
import assert from 'node:assert/strict';
|
|
7
7
|
import { createAgentRuntime } from '../providers/factory.js';
|
|
8
|
+
import { writeTerminalCodex } from './helpers/codex-terminal.js';
|
|
9
|
+
import { classifyProviderRetry } from '../providers/provider-retry.js';
|
|
8
10
|
import { CODEX_AUTO_COMPACT_TOKEN_LIMIT_ENV, CODEX_AUTO_COMPACT_TOKEN_LIMIT_SCOPE, CODEX_FAST_MODE_CONFIG, codexAppServerArgs, codexAutoCompactTokenLimitFor, codexFastModeArgs, codexToolEnvIncludeList, } from '../providers/codex.js';
|
|
9
11
|
import { makeSlackEvent } from './helpers/slack.js';
|
|
10
12
|
import { ingestEvent } from './helpers/inbox.js';
|
|
@@ -16,6 +18,58 @@ import { agentTokenUsageServiceForAgent } from '../usage/agent-token-usage.servi
|
|
|
16
18
|
import { runtimeInput, runtimeFollowupInput, assertFollowupPrompt, providerSessionStartedPayload, runtimeTestEnv } from './helpers/agent-runtime.js';
|
|
17
19
|
import { runtimeSessionServiceForAgent } from '../runtime/runtime-session.service.js';
|
|
18
20
|
import { isProviderSessionCorruptionError, } from '../providers/session-corruption.js';
|
|
21
|
+
for (const scenario of [
|
|
22
|
+
{ status: 'failed', early: false, message: 'stream closed before response.completed' },
|
|
23
|
+
{ status: 'failed', early: true, message: 'server_is_overloaded / 502' },
|
|
24
|
+
{ status: 'failed', early: false, message: '' },
|
|
25
|
+
{ status: 'completed', early: true, message: '' },
|
|
26
|
+
{ status: 'interrupted', early: false, message: '' },
|
|
27
|
+
]) {
|
|
28
|
+
test(`codex-cli terminal status ${scenario.status}, early=${scenario.early}, error=${Boolean(scenario.message)}`, async () => {
|
|
29
|
+
const stateDir = await mkdtemp(join(tmpdir(), 'anima-codex-terminal-'));
|
|
30
|
+
let runtime;
|
|
31
|
+
try {
|
|
32
|
+
await withAnimaHome(stateDir, async () => {
|
|
33
|
+
const command = await writeTerminalCodex(stateDir);
|
|
34
|
+
runtime = createAgentRuntime({
|
|
35
|
+
kind: 'codex-cli',
|
|
36
|
+
env: runtimeTestEnv(stateDir, {
|
|
37
|
+
CODEX_HOME: join(stateDir, 'codex-home'),
|
|
38
|
+
TERMINAL_STATUS: scenario.status,
|
|
39
|
+
EARLY_COMPLETION: String(scenario.early),
|
|
40
|
+
TURN_ERROR: scenario.message,
|
|
41
|
+
}),
|
|
42
|
+
}, { command });
|
|
43
|
+
const ctx = await ingestEvent(makeSlackEvent({
|
|
44
|
+
channelId: 'D-test', teamId: 'T-test', text: 'test terminal status', userId: 'U-test',
|
|
45
|
+
}), { agentId: 'anima', stateDir });
|
|
46
|
+
const input = await runtimeInput(runtime, ctx);
|
|
47
|
+
const run = runtime.run(input);
|
|
48
|
+
if (scenario.status === 'failed') {
|
|
49
|
+
await assert.rejects(run, (error) => {
|
|
50
|
+
assert.ok(error instanceof Error);
|
|
51
|
+
assert.equal(error.message, scenario.message || 'Codex turn failed without an error message');
|
|
52
|
+
assert.equal(classifyProviderRetry(error), 'terminal', 'do not replay a failed turn');
|
|
53
|
+
return true;
|
|
54
|
+
});
|
|
55
|
+
const activities = allActivities(await loadState());
|
|
56
|
+
assert.ok(activities.some((row) => row.type === 'runtime.failed'));
|
|
57
|
+
assert.equal(activities.some((row) => row.type === 'runtime.completed'), false);
|
|
58
|
+
assert.ok(activities.some((row) => row.payload?.['terminalReason'] === 'failed'));
|
|
59
|
+
// A failed terminal must not poison a subsequent turn on this controller.
|
|
60
|
+
assert.equal((await runtime.run(await runtimeInput(runtime, ctx))).text, 'partial or complete text');
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
assert.equal((await run).text, 'partial or complete text');
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
finally {
|
|
68
|
+
await runtime?.close?.();
|
|
69
|
+
await rm(stateDir, { recursive: true, force: true });
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
}
|
|
19
73
|
test('codex-cli app-server launch allows managed provider env into tool shells', () => {
|
|
20
74
|
const include = codexToolEnvIncludeList({
|
|
21
75
|
ANIMA_HOME: '/tmp/anima-home',
|
|
@@ -2,7 +2,18 @@ import test from 'node:test';
|
|
|
2
2
|
import assert from 'node:assert/strict';
|
|
3
3
|
import { makeSlackEvent } from './helpers/slack.js';
|
|
4
4
|
import { failureNoticeText, postRuntimeFailureNotice, shouldNotifyRequester, slackFailureNoticePost, } from '../runtime/failure-notice.js';
|
|
5
|
+
import { ProviderTurnFailedError } from '../providers/provider-failure.js';
|
|
5
6
|
const base = { teamId: 'T-demo', text: 'hello', userId: 'U1' };
|
|
7
|
+
test('failed-turn notice preserves the error and warns about previously executed actions', () => {
|
|
8
|
+
const notice = failureNoticeText({
|
|
9
|
+
error: new ProviderTurnFailedError('stream closed before response.completed'),
|
|
10
|
+
retryAttempts: 0, retryClass: 'terminal',
|
|
11
|
+
});
|
|
12
|
+
assert.match(notice, /stream closed before response.completed/);
|
|
13
|
+
assert.match(notice, /Some actions may already have run/);
|
|
14
|
+
assert.match(notice, /haven't automatically retried/);
|
|
15
|
+
assert.doesNotMatch(notice, /Please send it again/);
|
|
16
|
+
});
|
|
6
17
|
test('failure notice only targets messages that addressed the agent', () => {
|
|
7
18
|
const dm = makeSlackEvent({ ...base, channelId: 'D-user', wakeReason: 'dm' });
|
|
8
19
|
const mention = makeSlackEvent({ ...base, channelId: 'C-room', wakeReason: 'mention', ts: '1770000010.000001' });
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codex-terminal.d.ts","sourceRoot":"","sources":["../../../../server/tests/helpers/codex-terminal.ts"],"names":[],"mappings":"AAGA,+EAA+E;AAC/E,wBAAsB,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAuC3E"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { chmod, writeFile } from 'node:fs/promises';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
/** A local protocol fixture: never launches Codex or makes a model request. */
|
|
4
|
+
export async function writeTerminalCodex(directory) {
|
|
5
|
+
const path = join(directory, 'codex-terminal');
|
|
6
|
+
await writeFile(path, `#!/usr/bin/env node
|
|
7
|
+
import { appendFileSync } from 'node:fs';
|
|
8
|
+
import readline from 'node:readline';
|
|
9
|
+
const send = (message) => process.stdout.write(JSON.stringify(message) + '\\n');
|
|
10
|
+
let count = 0;
|
|
11
|
+
readline.createInterface({ input: process.stdin }).on('line', (line) => {
|
|
12
|
+
const msg = JSON.parse(line);
|
|
13
|
+
if (msg.method === 'initialize') send({ id: msg.id, result: { userAgent: 'fake-codex/0.145.0' } });
|
|
14
|
+
if (msg.method === 'thread/start' || msg.method === 'thread/resume') {
|
|
15
|
+
send({ id: msg.id, result: { thread: { id: 'test-thread' } } });
|
|
16
|
+
}
|
|
17
|
+
if (msg.method !== 'turn/start') return;
|
|
18
|
+
count += 1;
|
|
19
|
+
if (process.env.CALLS_PATH) appendFileSync(process.env.CALLS_PATH, 'turn/start\\n');
|
|
20
|
+
const turnId = 'test-turn-' + count;
|
|
21
|
+
const status = count === 1 ? process.env.TERMINAL_STATUS : 'completed';
|
|
22
|
+
const complete = () => {
|
|
23
|
+
send({ method: 'item/agentMessage/delta', params: {
|
|
24
|
+
threadId: 'test-thread', turnId, itemId: 'message-' + count, delta: 'partial or complete text',
|
|
25
|
+
} });
|
|
26
|
+
send({ method: 'turn/completed', params: { threadId: 'test-thread', turn: {
|
|
27
|
+
id: turnId, status, error: process.env.TURN_ERROR ? { message: process.env.TURN_ERROR } : null,
|
|
28
|
+
usage: { inputTokens: 10, outputTokens: 2, totalTokens: 12 },
|
|
29
|
+
} } });
|
|
30
|
+
};
|
|
31
|
+
const respond = () => send({ id: msg.id, result: { turn: { id: turnId, status: 'inProgress' } } });
|
|
32
|
+
if (process.env.EARLY_COMPLETION === 'true') {
|
|
33
|
+
complete();
|
|
34
|
+
setTimeout(respond, 100);
|
|
35
|
+
} else {
|
|
36
|
+
respond();
|
|
37
|
+
setTimeout(complete, 10);
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
`, 'utf8');
|
|
41
|
+
await chmod(path, 0o755);
|
|
42
|
+
return path;
|
|
43
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import test from 'node:test';
|
|
2
2
|
import assert from 'node:assert/strict';
|
|
3
|
+
import { ProviderTurnFailedError } from '../providers/provider-failure.js';
|
|
3
4
|
import { classifyProviderRetry, isProviderCrashError, providerRateLimitResumeAt, } from '../providers/provider-retry.js';
|
|
4
5
|
class TaggedError extends Error {
|
|
5
6
|
extra;
|
|
@@ -9,6 +10,16 @@ class TaggedError extends Error {
|
|
|
9
10
|
Object.assign(this, extra);
|
|
10
11
|
}
|
|
11
12
|
}
|
|
13
|
+
test('started-turn failures are never replayed by crash, transient, or quota rules', () => {
|
|
14
|
+
for (const message of [
|
|
15
|
+
'stream closed before response.completed', 'server_is_overloaded / 502',
|
|
16
|
+
'runtime exited before completing', 'too many requests', 'usage limit reached',
|
|
17
|
+
]) {
|
|
18
|
+
const error = new ProviderTurnFailedError(message);
|
|
19
|
+
assert.equal(classifyProviderRetry(error), 'terminal');
|
|
20
|
+
assert.equal(isProviderCrashError(error), false, 'a failed turn does not mean its process exited');
|
|
21
|
+
}
|
|
22
|
+
});
|
|
12
23
|
test('provider retry classifier separates crash, transient, rate-limited, and terminal failures', () => {
|
|
13
24
|
assert.equal(classifyProviderRetry(new Error('Codex app-server runtime exited before completing active requests')), 'crash');
|
|
14
25
|
assert.equal(isProviderCrashError(new Error('Claude Code runtime terminated by SIGKILL')), true);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import test from 'node:test';
|
|
2
2
|
import assert from 'node:assert/strict';
|
|
3
|
-
import { mkdtemp, rm, writeFile } from 'node:fs/promises';
|
|
3
|
+
import { mkdtemp, readFile, rm, writeFile } from 'node:fs/promises';
|
|
4
4
|
import { tmpdir } from 'node:os';
|
|
5
5
|
import { join } from 'node:path';
|
|
6
6
|
import { withAnimaHome } from './anima-home.js';
|
|
@@ -8,12 +8,74 @@ import { makeSlackEvent } from './helpers/slack.js';
|
|
|
8
8
|
import { waitFor } from './helpers/harness.js';
|
|
9
9
|
import { allActivities, loadState } from './helpers/state.js';
|
|
10
10
|
import { AgentRuntimeWorker, MAX_RATE_LIMIT_DEFERRALS } from '../runtime/runtime-worker.js';
|
|
11
|
+
import { postRuntimeFailureNotice } from '../runtime/failure-notice.js';
|
|
12
|
+
import { createAgentRuntime } from '../providers/factory.js';
|
|
13
|
+
import { runtimeTestEnv } from './helpers/agent-runtime.js';
|
|
14
|
+
import { writeTerminalCodex } from './helpers/codex-terminal.js';
|
|
11
15
|
import { AgentHealthService } from '../runtime/agent-health.service.js';
|
|
12
16
|
import { AgentHealthStore } from '../runtime/agent-health.store.js';
|
|
13
17
|
import { activitiesForInboxItemWindow } from '../runtime/item-activities.js';
|
|
14
18
|
import { runtimeSessionServiceForAgent } from '../runtime/runtime-session.service.js';
|
|
15
19
|
import { ProviderSessionCorruptionError } from '../providers/session-corruption.js';
|
|
16
20
|
import { AbortableRuntime, ActivityBeforeFinishRuntime, ControlledRuntime, CrashThenSuccessRuntime, FatalProviderRuntime, TransientThenSuccessRuntime, enqueueInbox, queueFor, silentLogger, waitForInboxItemAppendedTo, waitForInboxItemRemoved, } from './helpers/runtime-worker.js';
|
|
21
|
+
test('runtime worker exposes a failed Codex turn to the requester without replaying it', async () => {
|
|
22
|
+
const stateDir = await mkdtemp(join(tmpdir(), 'anima-worker-codex-failed-'));
|
|
23
|
+
let worker;
|
|
24
|
+
try {
|
|
25
|
+
await withAnimaHome(stateDir, async () => {
|
|
26
|
+
const callsPath = join(stateDir, 'calls');
|
|
27
|
+
const runtime = createAgentRuntime({
|
|
28
|
+
kind: 'codex-cli',
|
|
29
|
+
env: runtimeTestEnv(stateDir, {
|
|
30
|
+
CODEX_HOME: join(stateDir, 'codex-home'), CALLS_PATH: callsPath,
|
|
31
|
+
TERMINAL_STATUS: 'failed', TURN_ERROR: 'stream closed before response.completed',
|
|
32
|
+
}),
|
|
33
|
+
}, { command: await writeTerminalCodex(stateDir) });
|
|
34
|
+
const posts = [];
|
|
35
|
+
worker = new AgentRuntimeWorker({
|
|
36
|
+
agentId: 'scout', agentRuntime: runtime, homePath: stateDir, stateDir,
|
|
37
|
+
queue: queueFor('scout'), workerId: 'test-worker',
|
|
38
|
+
providerRetry: { transientBackoffMs: [1, 1, 1] },
|
|
39
|
+
onItemFailed: async (context, failure) => {
|
|
40
|
+
await postRuntimeFailureNotice({
|
|
41
|
+
agentId: 'scout', item: context.item, failure, runtimeKind: runtime.kind,
|
|
42
|
+
slackClient: { chat: { postMessage: async (post) => {
|
|
43
|
+
posts.push(post);
|
|
44
|
+
return { ok: true };
|
|
45
|
+
} } },
|
|
46
|
+
});
|
|
47
|
+
},
|
|
48
|
+
}, silentLogger);
|
|
49
|
+
const decision = await enqueueInbox(makeSlackEvent({
|
|
50
|
+
channelId: 'D-user', eventId: 'evt-codex-failed', teamId: 'T-demo',
|
|
51
|
+
text: 'perform a task', ts: '1770000010.000001', userId: 'U1',
|
|
52
|
+
}), { agentId: 'scout', stateDir });
|
|
53
|
+
assert.equal(await worker.drainOnce(), 1);
|
|
54
|
+
assert.match(posts[0]?.text ?? '', /stream closed before response.completed/, JSON.stringify(posts));
|
|
55
|
+
assert.equal(await readFile(callsPath, 'utf8'), 'turn/start\n', 'one turn, no automatic retry');
|
|
56
|
+
assert.equal(await queueFor('scout').find(decision.ctx.item.id), undefined);
|
|
57
|
+
const rows = allActivities(await loadState());
|
|
58
|
+
const failures = rows.filter((row) => row.type === 'runtime.failed');
|
|
59
|
+
assert.equal(failures.length, 1);
|
|
60
|
+
assert.equal(failures[0]?.payload?.['retryAttempts'], 0);
|
|
61
|
+
assert.equal(failures[0]?.payload?.['retryClass'], 'terminal');
|
|
62
|
+
assert.equal(rows.some((row) => row.type === 'runtime.completed'), false);
|
|
63
|
+
assert.equal(rows.some((row) => row.payload?.['eventType'] === 'provider.transient.retry'), false);
|
|
64
|
+
const health = await new AgentHealthStore({ animaHome: stateDir }).get('scout');
|
|
65
|
+
assert.equal(health?.state, 'unhealthy');
|
|
66
|
+
assert.equal(health?.reason, 'provider_error');
|
|
67
|
+
assert.equal(posts.length, 1);
|
|
68
|
+
assert.equal(posts[0]?.channel, 'D-user');
|
|
69
|
+
assert.match(posts[0]?.text ?? '', /stream closed before response.completed/);
|
|
70
|
+
assert.match(posts[0]?.text ?? '', /may already have run/);
|
|
71
|
+
assert.doesNotMatch(posts[0]?.text ?? '', /Please send it again/);
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
finally {
|
|
75
|
+
await worker?.close();
|
|
76
|
+
await rm(stateDir, { recursive: true, force: true });
|
|
77
|
+
}
|
|
78
|
+
});
|
|
17
79
|
class ProgressThenWaitRuntime {
|
|
18
80
|
kind = 'progress-then-wait';
|
|
19
81
|
calls = [];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mermaid.core-
|
|
2
|
-
import{t as e}from"./copy-D3weV6Zt.js";import{t}from"./lightbulb-DSr3D1kH.js";import{$t as n,Cn as r,Dr as i,Er as a,F as o,Ht as s,Or as c,Qt as l,Ut as u,Zt as d,an as f,en as p,fr as m,kr as h,r as g,sn as _,tn as v,un as y,wn as b,wr as x,xr as S,zt as C}from"./index-DC1JShUA.js";import{c as ee,o as te}from"./useNow-fH4CiFQb.js";var ne=y(`code-xml`,[[`path`,{d:`m18 16 4-4-4-4`,key:`1inbqp`}],[`path`,{d:`m6 8-4 4 4 4`,key:`15zrgr`}],[`path`,{d:`m14.5 4-5 16`,key:`e7oirm`}]]),re=y(`eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),ie=y(`file-braces`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1`,key:`1oajmo`}],[`path`,{d:`M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1`,key:`mpwhp6`}]]),w=y(`file-code`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 12.5 8 15l2 2.5`,key:`1tg20x`}],[`path`,{d:`m14 12.5 2 2.5-2 2.5`,key:`yinavb`}]]),ae=y(`file`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}]]),oe=y(`globe`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]),se=y(`image`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]),ce=y(`info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),le=y(`link-2`,[[`path`,{d:`M9 17H7A5 5 0 0 1 7 7h2`,key:`8i5ue5`}],[`path`,{d:`M15 7h2a5 5 0 1 1 0 10h-2`,key:`1b9ql8`}],[`line`,{x1:`8`,x2:`16`,y1:`12`,y2:`12`,key:`1jonct`}]]),ue=y(`list`,[[`path`,{d:`M3 5h.01`,key:`18ugdj`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M3 19h.01`,key:`noohij`}],[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M8 12h13`,key:`1za7za`}],[`path`,{d:`M8 19h13`,key:`m83p4d`}]]),de=y(`megaphone`,[[`path`,{d:`M11 6a13 13 0 0 0 8.4-2.8A1 1 0 0 1 21 4v12a1 1 0 0 1-1.6.8A13 13 0 0 0 11 14H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2z`,key:`q8bfy3`}],[`path`,{d:`M6 14a12 12 0 0 0 2.4 7.2 2 2 0 0 0 3.2-2.4A8 8 0 0 1 10 14`,key:`1853fq`}],[`path`,{d:`M8 6v8`,key:`15ugcq`}]]),fe=y(`octagon-alert`,[[`path`,{d:`M12 16h.01`,key:`1drbdi`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M15.312 2a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586l-4.688-4.688A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2z`,key:`1fd625`}]]),pe=y(`text-wrap`,[[`path`,{d:`m16 16-3 3 3 3`,key:`117b85`}],[`path`,{d:`M3 12h14.5a1 1 0 0 1 0 7H13`,key:`18xa6z`}],[`path`,{d:`M3 19h6`,key:`1ygdsz`}],[`path`,{d:`M3 5h18`,key:`1u36vt`}]]),T=h(a(),1),E=m(),me=c({ParseError:()=>D,SETTINGS_SCHEMA:()=>we,__defineFunction:()=>B,__defineMacro:()=>H,__defineSymbol:()=>A,__domTree:()=>Do,__parse:()=>So,__renderToDomTree:()=>wo,__renderToHTMLTree:()=>To,__setFontMetrics:()=>Pt,default:()=>Oo,render:()=>bo,renderToString:()=>xo,version:()=>Eo}),D=class e extends Error{constructor(t,n){var r=`KaTeX parse error: `+t,i,a,o=n&&n.loc;if(o&&o.start<=o.end){var s=o.lexer.input;i=o.start,a=o.end,i===s.length?r+=` at end of input: `:r+=` at position `+(i+1)+`: `;var c=s.slice(i,a).replace(/[^]/g,`$&̲`),l=i>15?`…`+s.slice(i-15,i):s.slice(0,i),u=a+15<s.length?s.slice(a,a+15)+`…`:s.slice(a);r+=l+c+u}super(r),this.name=`ParseError`,this.position=void 0,this.length=void 0,this.rawMessage=void 0,Object.setPrototypeOf(this,e.prototype),this.position=i,i!=null&&a!=null&&(this.length=a-i),this.rawMessage=t}},he=/([A-Z])/g,ge=e=>e.replace(he,`-$1`).toLowerCase(),_e={"&":`&`,">":`>`,"<":`<`,'"':`"`,"'":`'`},ve=/[&><"']/g,ye=e=>String(e).replace(ve,e=>_e[e]),be=e=>e.type===`ordgroup`||e.type===`color`?e.body.length===1?be(e.body[0]):e:e.type===`font`?be(e.body):e,xe=new Set([`mathord`,`textord`,`atom`]),Se=e=>xe.has(be(e).type),Ce=e=>{var t=/^[\x00-\x20]*([^\\/#?]*?)(:|�*58|�*3a|&colon)/i.exec(e);return t?t[2]!==`:`||!/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(t[1])?null:t[1].toLowerCase():`_relative`},we={displayMode:{type:`boolean`,description:`Render math in display mode, which puts the math in display style (so \\int and \\sum are large, for example), and centers the math on the page on its own line.`,cli:`-d, --display-mode`},output:{type:{enum:[`htmlAndMathml`,`html`,`mathml`]},description:`Determines the markup language of the output.`,cli:`-F, --format <type>`},leqno:{type:`boolean`,description:`Render display math in leqno style (left-justified tags).`},fleqn:{type:`boolean`,description:`Render display math flush left.`},throwOnError:{type:`boolean`,default:!0,cli:`-t, --no-throw-on-error`,cliDescription:`Render errors (in the color given by --error-color) instead of throwing a ParseError exception when encountering an error.`},errorColor:{type:`string`,default:`#cc0000`,cli:`-c, --error-color <color>`,cliDescription:`A color string given in the format 'rgb' or 'rrggbb' (no #). This option determines the color of errors rendered by the -t option.`,cliProcessor:e=>`#`+e},macros:{type:`object`,cli:`-m, --macro <def>`,cliDescription:`Define custom macro of the form '\\foo:expansion' (use multiple -m arguments for multiple macros).`,cliDefault:[],cliProcessor:(e,t)=>(t.push(e),t)},minRuleThickness:{type:`number`,description:"Specifies a minimum thickness, in ems, for fraction lines, `\\sqrt` top lines, `{array}` vertical lines, `\\hline`, `\\hdashline`, `\\underline`, `\\overline`, and the borders of `\\fbox`, `\\boxed`, and `\\fcolorbox`.",processor:e=>Math.max(0,e),cli:`--min-rule-thickness <size>`,cliProcessor:parseFloat},colorIsTextColor:{type:`boolean`,description:`Makes \\color behave like LaTeX's 2-argument \\textcolor, instead of LaTeX's one-argument \\color mode change.`,cli:`-b, --color-is-text-color`},strict:{type:[{enum:[`warn`,`ignore`,`error`]},`boolean`,`function`],description:`Turn on strict / LaTeX faithfulness mode, which throws an error if the input uses features that are not supported by LaTeX.`,cli:`-S, --strict`,cliDefault:!1},trust:{type:[`boolean`,`function`],description:`Trust the input, enabling all HTML features such as \\url.`,cli:`-T, --trust`},maxSize:{type:`number`,default:1/0,description:`If non-zero, all user-specified sizes, e.g. in \\rule{500em}{500em}, will be capped to maxSize ems. Otherwise, elements and spaces can be arbitrarily large`,processor:e=>Math.max(0,e),cli:`-s, --max-size <n>`,cliProcessor:parseInt},maxExpand:{type:`number`,default:1e3,description:`Limit the number of macro expansions to the specified number, to prevent e.g. infinite macro loops. If set to Infinity, the macro expander will try to fully expand as in LaTeX.`,processor:e=>Math.max(0,e),cli:`-e, --max-expand <n>`,cliProcessor:e=>e===`Infinity`?1/0:parseInt(e)},globalGroup:{type:`boolean`,cli:!1}};function Te(e){if(typeof e!=`string`)return e.enum[0];switch(e){case`boolean`:return!1;case`string`:return``;case`number`:return 0;case`object`:return{};default:throw Error(`Unexpected schema type; settings must declare an explicit default.`)}}function Ee(e){return e.default===void 0?Te(Array.isArray(e.type)?e.type[0]:e.type):e.default}function De(e,t,n,r){var i=n[t];e[t]=i===void 0?Ee(r):r.processor?r.processor(i):i}var Oe=class{constructor(e){e===void 0&&(e={}),this.displayMode=void 0,this.output=void 0,this.leqno=void 0,this.fleqn=void 0,this.throwOnError=void 0,this.errorColor=void 0,this.macros=void 0,this.minRuleThickness=void 0,this.colorIsTextColor=void 0,this.strict=void 0,this.trust=void 0,this.maxSize=void 0,this.maxExpand=void 0,this.globalGroup=void 0,e||={};for(var t of Object.keys(we)){var n=we[t];n&&De(this,t,e,n)}}reportNonstrict(e,t,n){var r=this.strict;if(typeof r==`function`&&(r=r(e,t,n)),!(!r||r===`ignore`)){if(r===!0||r===`error`)throw new D(`LaTeX-incompatible input and strict mode is set to 'error': `+(t+` [`+e+`]`),n);r===`warn`?typeof console<`u`&&console.warn(`LaTeX-incompatible input and strict mode is set to 'warn': `+(t+` [`+e+`]`)):typeof console<`u`&&console.warn(`LaTeX-incompatible input and strict mode is set to `+(`unrecognized '`+r+`': `+t+` [`+e+`]`))}}useStrictBehavior(e,t,n){var r=this.strict;if(typeof r==`function`)try{r=r(e,t,n)}catch{r=`error`}return!r||r===`ignore`?!1:r===!0||r===`error`?!0:r===`warn`?(typeof console<`u`&&console.warn(`LaTeX-incompatible input and strict mode is set to 'warn': `+(t+` [`+e+`]`)),!1):(typeof console<`u`&&console.warn(`LaTeX-incompatible input and strict mode is set to `+(`unrecognized '`+r+`': `+t+` [`+e+`]`)),!1)}isTrusted(e){if(`url`in e&&e.url&&!e.protocol){var t=Ce(e.url);if(t==null)return!1;e.protocol=t}return!!(typeof this.trust==`function`?this.trust(e):this.trust)}},ke=class{constructor(e,t,n){this.id=void 0,this.size=void 0,this.cramped=void 0,this.id=e,this.size=t,this.cramped=n}sup(){return Re[ze[this.id]]}sub(){return Re[Be[this.id]]}fracNum(){return Re[Ve[this.id]]}fracDen(){return Re[He[this.id]]}cramp(){return Re[Ue[this.id]]}text(){return Re[We[this.id]]}isTight(){return this.size>=2}},Ae=0,je=1,Me=2,Ne=3,Pe=4,Fe=5,Ie=6,Le=7,Re=[new ke(Ae,0,!1),new ke(je,0,!0),new ke(Me,1,!1),new ke(Ne,1,!0),new ke(Pe,2,!1),new ke(Fe,2,!0),new ke(Ie,3,!1),new ke(Le,3,!0)],ze=[Pe,Fe,Pe,Fe,Ie,Le,Ie,Le],Be=[Fe,Fe,Fe,Fe,Le,Le,Le,Le],Ve=[Me,Ne,Pe,Fe,Ie,Le,Ie,Le],He=[Ne,Ne,Fe,Fe,Le,Le,Le,Le],Ue=[je,je,Ne,Ne,Fe,Fe,Le,Le],We=[Ae,je,Me,Ne,Me,Ne,Me,Ne],O={DISPLAY:Re[Ae],TEXT:Re[Me],SCRIPT:Re[Pe],SCRIPTSCRIPT:Re[Ie]},Ge=[{name:`latin`,blocks:[[256,591],[768,879]]},{name:`cyrillic`,blocks:[[1024,1279]]},{name:`armenian`,blocks:[[1328,1423]]},{name:`brahmic`,blocks:[[2304,4255]]},{name:`georgian`,blocks:[[4256,4351]]},{name:`cjk`,blocks:[[12288,12543],[19968,40879],[65280,65376]]},{name:`hangul`,blocks:[[44032,55215]]}];function Ke(e){for(var t=0;t<Ge.length;t++)for(var n=Ge[t],r=0;r<n.blocks.length;r++){var i=n.blocks[r];if(e>=i[0]&&e<=i[1])return n.name}return null}var qe=[];Ge.forEach(e=>e.blocks.forEach(e=>qe.push(...e)));function Je(e){for(var t=0;t<qe.length;t+=2)if(e>=qe[t]&&e<=qe[t+1])return!0;return!1}var Ye=e=>e+` `+e,Xe=80,Ze=function(e,t){return`M95,`+(622+e+t)+`
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mermaid.core-kFGsR4Cp.js","assets/index-kDv99MPW.js","assets/index-DIncpmwE.css","assets/chunk-O5CBEL6O-CC3LEe-H.js","assets/src-Br-T91UW.js","assets/chunk-5ZQYHXKU-DtBCzupz.js","assets/dist-D0UlfIR-.js","assets/chunk-CSCIHK7Q-Cn4r2bzv.js","assets/chunk-3OPIFGDE-uxQb2Nkf.js","assets/chunk-L5ZTLDWV-DDJHTPqx.js","assets/chunk-NZK2D7GU-DvxYOnAF.js","assets/rough.esm-CSKSodPl.js","assets/chunk-BSJP7CBP-DyRITwu0.js","assets/chunk-KSCS5N6A-Cpm1w6F1.js","assets/line-Bkro79BZ.js","assets/path-BWPyau1x.js","assets/array-BifhSqXX.js","assets/chunk-LZXEDZCA-RGqKWRFm.js","assets/chunk-WU5MYG2G-AKmH_Uhx.js","assets/chunk-XPW4576I-CLi_UqUg.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{t as e}from"./copy-BlDDZTIe.js";import{t}from"./lightbulb-DxN3hBy3.js";import{$t as n,Cn as r,Dr as i,Er as a,F as o,Ht as s,Or as c,Qt as l,Ut as u,Zt as d,an as f,en as p,fr as m,kr as h,r as g,sn as _,tn as v,un as y,wn as b,wr as x,xr as S,zt as C}from"./index-kDv99MPW.js";import{c as ee,o as te}from"./useNow-gyD-mImi.js";var ne=y(`code-xml`,[[`path`,{d:`m18 16 4-4-4-4`,key:`1inbqp`}],[`path`,{d:`m6 8-4 4 4 4`,key:`15zrgr`}],[`path`,{d:`m14.5 4-5 16`,key:`e7oirm`}]]),re=y(`eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),ie=y(`file-braces`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1`,key:`1oajmo`}],[`path`,{d:`M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1`,key:`mpwhp6`}]]),w=y(`file-code`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 12.5 8 15l2 2.5`,key:`1tg20x`}],[`path`,{d:`m14 12.5 2 2.5-2 2.5`,key:`yinavb`}]]),ae=y(`file`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}]]),oe=y(`globe`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]),se=y(`image`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]),ce=y(`info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),le=y(`link-2`,[[`path`,{d:`M9 17H7A5 5 0 0 1 7 7h2`,key:`8i5ue5`}],[`path`,{d:`M15 7h2a5 5 0 1 1 0 10h-2`,key:`1b9ql8`}],[`line`,{x1:`8`,x2:`16`,y1:`12`,y2:`12`,key:`1jonct`}]]),ue=y(`list`,[[`path`,{d:`M3 5h.01`,key:`18ugdj`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M3 19h.01`,key:`noohij`}],[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M8 12h13`,key:`1za7za`}],[`path`,{d:`M8 19h13`,key:`m83p4d`}]]),de=y(`megaphone`,[[`path`,{d:`M11 6a13 13 0 0 0 8.4-2.8A1 1 0 0 1 21 4v12a1 1 0 0 1-1.6.8A13 13 0 0 0 11 14H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2z`,key:`q8bfy3`}],[`path`,{d:`M6 14a12 12 0 0 0 2.4 7.2 2 2 0 0 0 3.2-2.4A8 8 0 0 1 10 14`,key:`1853fq`}],[`path`,{d:`M8 6v8`,key:`15ugcq`}]]),fe=y(`octagon-alert`,[[`path`,{d:`M12 16h.01`,key:`1drbdi`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M15.312 2a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586l-4.688-4.688A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2z`,key:`1fd625`}]]),pe=y(`text-wrap`,[[`path`,{d:`m16 16-3 3 3 3`,key:`117b85`}],[`path`,{d:`M3 12h14.5a1 1 0 0 1 0 7H13`,key:`18xa6z`}],[`path`,{d:`M3 19h6`,key:`1ygdsz`}],[`path`,{d:`M3 5h18`,key:`1u36vt`}]]),T=h(a(),1),E=m(),me=c({ParseError:()=>D,SETTINGS_SCHEMA:()=>we,__defineFunction:()=>B,__defineMacro:()=>H,__defineSymbol:()=>A,__domTree:()=>Do,__parse:()=>So,__renderToDomTree:()=>wo,__renderToHTMLTree:()=>To,__setFontMetrics:()=>Pt,default:()=>Oo,render:()=>bo,renderToString:()=>xo,version:()=>Eo}),D=class e extends Error{constructor(t,n){var r=`KaTeX parse error: `+t,i,a,o=n&&n.loc;if(o&&o.start<=o.end){var s=o.lexer.input;i=o.start,a=o.end,i===s.length?r+=` at end of input: `:r+=` at position `+(i+1)+`: `;var c=s.slice(i,a).replace(/[^]/g,`$&̲`),l=i>15?`…`+s.slice(i-15,i):s.slice(0,i),u=a+15<s.length?s.slice(a,a+15)+`…`:s.slice(a);r+=l+c+u}super(r),this.name=`ParseError`,this.position=void 0,this.length=void 0,this.rawMessage=void 0,Object.setPrototypeOf(this,e.prototype),this.position=i,i!=null&&a!=null&&(this.length=a-i),this.rawMessage=t}},he=/([A-Z])/g,ge=e=>e.replace(he,`-$1`).toLowerCase(),_e={"&":`&`,">":`>`,"<":`<`,'"':`"`,"'":`'`},ve=/[&><"']/g,ye=e=>String(e).replace(ve,e=>_e[e]),be=e=>e.type===`ordgroup`||e.type===`color`?e.body.length===1?be(e.body[0]):e:e.type===`font`?be(e.body):e,xe=new Set([`mathord`,`textord`,`atom`]),Se=e=>xe.has(be(e).type),Ce=e=>{var t=/^[\x00-\x20]*([^\\/#?]*?)(:|�*58|�*3a|&colon)/i.exec(e);return t?t[2]!==`:`||!/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(t[1])?null:t[1].toLowerCase():`_relative`},we={displayMode:{type:`boolean`,description:`Render math in display mode, which puts the math in display style (so \\int and \\sum are large, for example), and centers the math on the page on its own line.`,cli:`-d, --display-mode`},output:{type:{enum:[`htmlAndMathml`,`html`,`mathml`]},description:`Determines the markup language of the output.`,cli:`-F, --format <type>`},leqno:{type:`boolean`,description:`Render display math in leqno style (left-justified tags).`},fleqn:{type:`boolean`,description:`Render display math flush left.`},throwOnError:{type:`boolean`,default:!0,cli:`-t, --no-throw-on-error`,cliDescription:`Render errors (in the color given by --error-color) instead of throwing a ParseError exception when encountering an error.`},errorColor:{type:`string`,default:`#cc0000`,cli:`-c, --error-color <color>`,cliDescription:`A color string given in the format 'rgb' or 'rrggbb' (no #). This option determines the color of errors rendered by the -t option.`,cliProcessor:e=>`#`+e},macros:{type:`object`,cli:`-m, --macro <def>`,cliDescription:`Define custom macro of the form '\\foo:expansion' (use multiple -m arguments for multiple macros).`,cliDefault:[],cliProcessor:(e,t)=>(t.push(e),t)},minRuleThickness:{type:`number`,description:"Specifies a minimum thickness, in ems, for fraction lines, `\\sqrt` top lines, `{array}` vertical lines, `\\hline`, `\\hdashline`, `\\underline`, `\\overline`, and the borders of `\\fbox`, `\\boxed`, and `\\fcolorbox`.",processor:e=>Math.max(0,e),cli:`--min-rule-thickness <size>`,cliProcessor:parseFloat},colorIsTextColor:{type:`boolean`,description:`Makes \\color behave like LaTeX's 2-argument \\textcolor, instead of LaTeX's one-argument \\color mode change.`,cli:`-b, --color-is-text-color`},strict:{type:[{enum:[`warn`,`ignore`,`error`]},`boolean`,`function`],description:`Turn on strict / LaTeX faithfulness mode, which throws an error if the input uses features that are not supported by LaTeX.`,cli:`-S, --strict`,cliDefault:!1},trust:{type:[`boolean`,`function`],description:`Trust the input, enabling all HTML features such as \\url.`,cli:`-T, --trust`},maxSize:{type:`number`,default:1/0,description:`If non-zero, all user-specified sizes, e.g. in \\rule{500em}{500em}, will be capped to maxSize ems. Otherwise, elements and spaces can be arbitrarily large`,processor:e=>Math.max(0,e),cli:`-s, --max-size <n>`,cliProcessor:parseInt},maxExpand:{type:`number`,default:1e3,description:`Limit the number of macro expansions to the specified number, to prevent e.g. infinite macro loops. If set to Infinity, the macro expander will try to fully expand as in LaTeX.`,processor:e=>Math.max(0,e),cli:`-e, --max-expand <n>`,cliProcessor:e=>e===`Infinity`?1/0:parseInt(e)},globalGroup:{type:`boolean`,cli:!1}};function Te(e){if(typeof e!=`string`)return e.enum[0];switch(e){case`boolean`:return!1;case`string`:return``;case`number`:return 0;case`object`:return{};default:throw Error(`Unexpected schema type; settings must declare an explicit default.`)}}function Ee(e){return e.default===void 0?Te(Array.isArray(e.type)?e.type[0]:e.type):e.default}function De(e,t,n,r){var i=n[t];e[t]=i===void 0?Ee(r):r.processor?r.processor(i):i}var Oe=class{constructor(e){e===void 0&&(e={}),this.displayMode=void 0,this.output=void 0,this.leqno=void 0,this.fleqn=void 0,this.throwOnError=void 0,this.errorColor=void 0,this.macros=void 0,this.minRuleThickness=void 0,this.colorIsTextColor=void 0,this.strict=void 0,this.trust=void 0,this.maxSize=void 0,this.maxExpand=void 0,this.globalGroup=void 0,e||={};for(var t of Object.keys(we)){var n=we[t];n&&De(this,t,e,n)}}reportNonstrict(e,t,n){var r=this.strict;if(typeof r==`function`&&(r=r(e,t,n)),!(!r||r===`ignore`)){if(r===!0||r===`error`)throw new D(`LaTeX-incompatible input and strict mode is set to 'error': `+(t+` [`+e+`]`),n);r===`warn`?typeof console<`u`&&console.warn(`LaTeX-incompatible input and strict mode is set to 'warn': `+(t+` [`+e+`]`)):typeof console<`u`&&console.warn(`LaTeX-incompatible input and strict mode is set to `+(`unrecognized '`+r+`': `+t+` [`+e+`]`))}}useStrictBehavior(e,t,n){var r=this.strict;if(typeof r==`function`)try{r=r(e,t,n)}catch{r=`error`}return!r||r===`ignore`?!1:r===!0||r===`error`?!0:r===`warn`?(typeof console<`u`&&console.warn(`LaTeX-incompatible input and strict mode is set to 'warn': `+(t+` [`+e+`]`)),!1):(typeof console<`u`&&console.warn(`LaTeX-incompatible input and strict mode is set to `+(`unrecognized '`+r+`': `+t+` [`+e+`]`)),!1)}isTrusted(e){if(`url`in e&&e.url&&!e.protocol){var t=Ce(e.url);if(t==null)return!1;e.protocol=t}return!!(typeof this.trust==`function`?this.trust(e):this.trust)}},ke=class{constructor(e,t,n){this.id=void 0,this.size=void 0,this.cramped=void 0,this.id=e,this.size=t,this.cramped=n}sup(){return Re[ze[this.id]]}sub(){return Re[Be[this.id]]}fracNum(){return Re[Ve[this.id]]}fracDen(){return Re[He[this.id]]}cramp(){return Re[Ue[this.id]]}text(){return Re[We[this.id]]}isTight(){return this.size>=2}},Ae=0,je=1,Me=2,Ne=3,Pe=4,Fe=5,Ie=6,Le=7,Re=[new ke(Ae,0,!1),new ke(je,0,!0),new ke(Me,1,!1),new ke(Ne,1,!0),new ke(Pe,2,!1),new ke(Fe,2,!0),new ke(Ie,3,!1),new ke(Le,3,!0)],ze=[Pe,Fe,Pe,Fe,Ie,Le,Ie,Le],Be=[Fe,Fe,Fe,Fe,Le,Le,Le,Le],Ve=[Me,Ne,Pe,Fe,Ie,Le,Ie,Le],He=[Ne,Ne,Fe,Fe,Le,Le,Le,Le],Ue=[je,je,Ne,Ne,Fe,Fe,Le,Le],We=[Ae,je,Me,Ne,Me,Ne,Me,Ne],O={DISPLAY:Re[Ae],TEXT:Re[Me],SCRIPT:Re[Pe],SCRIPTSCRIPT:Re[Ie]},Ge=[{name:`latin`,blocks:[[256,591],[768,879]]},{name:`cyrillic`,blocks:[[1024,1279]]},{name:`armenian`,blocks:[[1328,1423]]},{name:`brahmic`,blocks:[[2304,4255]]},{name:`georgian`,blocks:[[4256,4351]]},{name:`cjk`,blocks:[[12288,12543],[19968,40879],[65280,65376]]},{name:`hangul`,blocks:[[44032,55215]]}];function Ke(e){for(var t=0;t<Ge.length;t++)for(var n=Ge[t],r=0;r<n.blocks.length;r++){var i=n.blocks[r];if(e>=i[0]&&e<=i[1])return n.name}return null}var qe=[];Ge.forEach(e=>e.blocks.forEach(e=>qe.push(...e)));function Je(e){for(var t=0;t<qe.length;t+=2)if(e>=qe[t]&&e<=qe[t+1])return!0;return!1}var Ye=e=>e+` `+e,Xe=80,Ze=function(e,t){return`M95,`+(622+e+t)+`
|
|
3
3
|
c-2.7,0,-7.17,-2.7,-13.5,-8c-5.8,-5.3,-9.5,-10,-9.5,-14
|
|
4
4
|
c0,-2,0.3,-3.3,1,-4c1.3,-2.7,23.83,-20.7,67.5,-54
|
|
5
5
|
c44.2,-33.3,65.8,-50.3,66.5,-51c1.3,-1.3,3,-2,5,-2c4.7,0,8.7,3.3,12,10
|
|
@@ -299,4 +299,4 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
299
299
|
`),n=!1;return t.map(e=>{if(/^(`{3,}|~{3,})/.test(e))return n=!n,e;if(n)return e;let t=e.match(/^(#{1,6}\s+)(.+)$/);if(!t)return e;let{text:r,explicitId:i}=CT(t[2]);return i?`${t[1]}${r}`:e}).join(`
|
|
300
300
|
`)}function AT(e){let{origin:t,pathname:n,search:r}=window.location;return`${t}${n}${r}#${e}`}function jT(e){let t=/^#L(\d+)$/.exec(e);if(!t)return null;let n=Number(t[1]);return Number.isInteger(n)&&n>0?n:null}function MT({text:t,variant:n=`floating`}){let[r,i]=(0,T.useState)(!1),a=(0,T.useRef)(null),o=(0,T.useCallback)(()=>{g(t).then(()=>{i(!0),a.current&&clearTimeout(a.current),a.current=setTimeout(()=>i(!1),2e3)}).catch(()=>{})},[t]);return(0,T.useEffect)(()=>()=>{a.current&&clearTimeout(a.current)},[]),(0,E.jsxs)(`button`,{onClick:o,title:r?`Copied!`:`Copy`,"aria-label":r?`Copied`:`Copy code`,className:n===`floating`?`chrome absolute right-2 top-2 flex h-7 items-center gap-1 rounded-sm bg-surface-elevated/80 px-2 text-[11px] text-text-subtle opacity-0 transition-opacity hover:bg-surface-elevated hover:text-text focus-visible:opacity-100 group-hover:opacity-100 group-focus-within:opacity-100 [@media(hover:none)]:opacity-100`:`chrome flex h-7 items-center gap-1 rounded-sm px-2 text-[11px] text-text-subtle transition-colors hover:bg-surface-hover hover:text-text focus-visible:bg-surface-hover focus-visible:text-text`,children:[(0,E.jsx)(e,{className:`h-3 w-3`}),r&&(0,E.jsx)(`span`,{children:`Copied!`})]})}function NT({id:e}){let[t,n]=(0,T.useState)(!1),r=(0,T.useRef)(null),i=(0,T.useCallback)(t=>{t.stopPropagation(),t.preventDefault(),DT(e),g(AT(e)).then(()=>{n(!0),r.current&&clearTimeout(r.current),r.current=setTimeout(()=>n(!1),1500)}).catch(()=>{})},[e]);return(0,T.useEffect)(()=>()=>{r.current&&clearTimeout(r.current)},[]),(0,E.jsx)(`a`,{href:`#${e}`,onClick:i,"aria-label":t?`Link copied`:`Copy link to this section`,title:t?`Link copied!`:`Copy link to this section`,contentEditable:!1,className:`absolute right-full top-[0.1em] mr-1 inline-flex items-center px-1 text-text-subtle no-underline opacity-0 transition-opacity duration-100 hover:text-accent focus-visible:opacity-100 group-hover:opacity-100 [@media(hover:none)]:static [@media(hover:none)]:ml-1 [@media(hover:none)]:mr-0 [@media(hover:none)]:px-1.5 [@media(hover:none)]:opacity-60`,children:(0,E.jsx)(le,{className:`h-[0.7em] w-[0.7em]`,strokeWidth:2.5,"aria-hidden":`true`})})}function PT({filePath:e}){let t=e.split(`/`).filter(Boolean),n=t[t.length-1]??e,r=t.slice(0,-1),i=r[r.length-1],a=r.length>1;return(0,E.jsxs)(`div`,{title:e,className:`flex min-w-0 items-center gap-1 font-sans text-[12px] text-text-subtle`,children:[i&&(0,E.jsxs)(E.Fragment,{children:[a&&(0,E.jsx)(`span`,{className:`shrink-0 text-text-subtle/70`,children:`…`}),a&&(0,E.jsx)(f,{className:`h-3 w-3 shrink-0 text-text-subtle/50`}),(0,E.jsx)(`span`,{className:`max-w-[12rem] shrink truncate`,children:i}),(0,E.jsx)(f,{className:`h-3 w-3 shrink-0 text-text-subtle/50`})]}),(0,E.jsx)(`span`,{className:`min-w-0 shrink truncate font-medium text-text-muted`,children:n})]})}function FT({id:t,filePath:r,size:i,rawUrl:a,downloadUrl:o}){let[s,c]=(0,T.useState)(!1),[l,u]=(0,T.useState)(!1),d=(0,T.useRef)(null),f=(0,T.useRef)(null);(0,T.useEffect)(()=>{if(!s)return;function e(e){d.current&&!d.current.contains(e.target)&&c(!1)}return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[s]),(0,T.useEffect)(()=>()=>{f.current&&clearTimeout(f.current)},[]);let m=a??b(t,r),h=o===void 0?C(t,r):o,_=(0,T.useCallback)(()=>{g(r).then(()=>{u(!0),f.current&&clearTimeout(f.current),f.current=setTimeout(()=>u(!1),2e3)}).catch(()=>{})},[r]),y=`flex w-full items-center gap-2 px-3 py-2 text-left font-sans text-[12px] text-text-muted transition-colors hover:bg-surface-elevated`;return(0,E.jsxs)(`div`,{ref:d,className:`relative`,children:[(0,E.jsx)(`button`,{onClick:()=>c(e=>!e),title:`More actions`,"aria-label":`More actions`,"aria-haspopup":`menu`,"aria-expanded":s,className:[`chrome flex min-h-[44px] shrink-0 items-center justify-center rounded-sm px-2 transition-colors`,s?`text-text`:`text-text-subtle hover:bg-surface-elevated hover:text-text-muted`].join(` `),children:(0,E.jsx)(p,{className:`h-3.5 w-3.5`})}),s&&(0,E.jsxs)(`div`,{role:`menu`,className:`absolute right-0 top-full z-20 mt-1 w-44 overflow-hidden rounded-sm border border-border-soft bg-surface shadow-deep`,children:[i!==void 0&&(0,E.jsx)(`div`,{className:`border-b border-border-soft px-3 py-1.5 font-sans text-[11px] text-text-subtle`,children:te(i)}),(0,E.jsxs)(`button`,{role:`menuitem`,onClick:_,className:y,children:[(0,E.jsx)(e,{className:`h-3.5 w-3.5 shrink-0`}),l?`Path copied`:`Copy path`]}),(0,E.jsxs)(`a`,{role:`menuitem`,href:m,target:`_blank`,rel:`noreferrer`,onClick:()=>c(!1),className:y,children:[(0,E.jsx)(n,{className:`h-3.5 w-3.5 shrink-0`}),`Open raw`]}),h&&(0,E.jsxs)(`a`,{role:`menuitem`,href:h,download:!0,onClick:()=>c(!1),className:y,children:[(0,E.jsx)(v,{className:`h-3.5 w-3.5 shrink-0`}),`Download`]})]})]})}function IT({entries:e}){let[t,n]=(0,T.useState)(!1),r=(0,T.useRef)(null);return(0,T.useEffect)(()=>{if(!t)return;function e(e){r.current&&!r.current.contains(e.target)&&n(!1)}return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[t]),e.length===0?null:(0,E.jsxs)(`div`,{ref:r,className:`relative`,children:[(0,E.jsx)(`button`,{onClick:()=>n(e=>!e),title:`Table of contents`,className:[`chrome flex min-h-[44px] shrink-0 items-center justify-center rounded-sm px-2 transition-colors`,t?`text-text`:`text-text-subtle hover:bg-surface-elevated hover:text-text-muted`].join(` `),children:(0,E.jsx)(ue,{className:`h-3.5 w-3.5`})}),t&&(0,E.jsx)(`div`,{className:`absolute right-0 top-full z-20 mt-1 w-72 max-h-[480px] overflow-y-auto rounded-sm border border-border-soft bg-surface shadow-deep`,children:(0,E.jsx)(`nav`,{className:`py-1`,children:e.map((e,t)=>(0,E.jsx)(`a`,{href:`#${e.id}`,onClick:t=>{t.preventDefault(),n(!1),window.history.replaceState(null,``,`#${e.id}`),document.getElementById(e.id)?.scrollIntoView({behavior:`smooth`})},className:`flex min-h-[44px] md:min-h-[40px] items-center font-sans text-[13px] text-text-muted transition-colors hover:bg-surface-elevated/60 hover:text-text`,style:{paddingLeft:`${.75+(e.depth-1)*.75}rem`,paddingRight:`0.75rem`},children:e.text},t))})})]})}var LT=[{value:`preview`,label:`Preview`,Icon:re},{value:`code`,label:`Code`,Icon:ne}];function RT({mode:e,onChange:t}){return(0,E.jsx)(`div`,{role:`tablist`,"aria-label":`File view mode`,className:`chrome inline-flex shrink-0 items-center gap-0.5 rounded-md border border-border-soft bg-surface-raised/40 p-0.5`,children:LT.map(({value:n,label:r,Icon:i})=>{let a=e===n;return(0,E.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":a,title:r,onClick:()=>t(n),className:[`flex min-h-[44px] md:min-h-[28px] items-center gap-1.5 rounded-[5px] px-2 text-[11px] font-medium transition-colors`,a?`bg-surface text-text shadow-sm`:`text-text-subtle hover:text-text-muted`].join(` `),children:[(0,E.jsx)(i,{className:`h-3.5 w-3.5`,strokeWidth:2}),r]},n)})})}var zT=`kb-file-view-mode`;function BT(){try{return window.sessionStorage.getItem(`kb-file-view-mode`)===`code`?`code`:`preview`}catch{return`preview`}}function VT(e){try{window.sessionStorage.setItem(zT,e)}catch{}}var HT=`kb-code-wrap`;function UT(){try{return window.sessionStorage.getItem(HT)!==`off`}catch{return!0}}function WT(e){try{window.sessionStorage.setItem(HT,e?`on`:`off`)}catch{}}function GT({body:e,language:t}){let n=(0,T.useRef)(null),[r,i]=(0,T.useState)(()=>jT(window.location.hash)),[a,o]=(0,T.useState)(UT),s=(0,T.useCallback)(()=>{o(e=>{let t=!e;return WT(t),t})},[]);(0,T.useEffect)(()=>{function e(){i(jT(window.location.hash))}return window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},[]),(0,T.useEffect)(()=>{let e=jT(window.location.hash);if(e===null)return;let t=n.current?.querySelector(`#L${e}`);if(!t)return;let r=setTimeout(()=>t.scrollIntoView({behavior:`smooth`,block:`center`}),80);return()=>clearTimeout(r)},[]);function c(e){let t=r===e?null:e;i(t);let n=t===null?window.location.pathname+window.location.search:`#L${t}`;window.history.replaceState(null,``,n)}return(0,E.jsx)(`div`,{ref:n,className:`min-h-0 flex-1 overflow-auto`,children:(0,E.jsxs)(`div`,{className:`relative group min-h-0 flex-1 overflow-auto`,children:[(0,E.jsx)(`button`,{type:`button`,onClick:s,"aria-pressed":a,title:a?`Disable soft wrap`:`Enable soft wrap`,className:[`chrome absolute right-12 top-2 z-10 flex h-7 items-center gap-1 rounded-sm px-2 text-[11px] transition-opacity`,`opacity-0 focus-visible:opacity-100 group-hover:opacity-100 group-focus-within:opacity-100 [@media(hover:none)]:opacity-100`,a?`bg-accent/10 text-accent hover:bg-accent/15`:`bg-surface-elevated/80 text-text-subtle hover:bg-surface-elevated hover:text-text`].join(` `),children:(0,E.jsx)(pe,{className:`h-3 w-3`})}),(0,E.jsx)(MT,{text:e}),(0,E.jsx)(bT,{code:e.replace(/\n$/,``),language:t,theme:Uw.github,children:({className:e,style:t,tokens:n,getLineProps:i,getTokenProps:o})=>(0,E.jsx)(`pre`,{className:`${e} min-h-full font-mono text-[12.5px] leading-relaxed ${a?``:`w-max`}`,style:{...t,background:`transparent`,padding:0,whiteSpace:a?`pre-wrap`:`pre`,wordBreak:a?`break-word`:`normal`},children:(0,E.jsx)(`div`,{className:`py-4`,children:n.map((e,t)=>{let n=t+1,{className:s,...l}=i({line:e}),u=r===n;return(0,E.jsxs)(`div`,{...l,id:`L${n}`,className:[s??``,`flex px-5`,a?``:`min-w-full`,u?`bg-accent/10`:``].join(` `).trim(),children:[(0,E.jsx)(`a`,{href:`#L${n}`,onClick:e=>{e.preventDefault(),c(n)},title:`Link to line ${n}`,className:[`mr-4 inline-block w-8 shrink-0 select-none text-right tabular-nums transition-colors`,u?`text-accent`:`text-text-subtle/50 hover:text-text-muted`].join(` `),children:n}),(0,E.jsx)(`span`,{className:a?`min-w-0 flex-1`:`shrink-0`,children:e.map((e,t)=>(0,E.jsx)(`span`,{...o({token:e})},t))})]},t)})})})})]})})}function KT(e){if(e.length>=2){let t=e[0],n=e[e.length-1];if(t===`"`&&n===`"`||t===`'`&&n===`'`)return e.slice(1,-1)}return e}function qT(e){let t=e.split(`
|
|
301
301
|
`),n=[],r=0;for(;r<t.length;){let e=t[r];if(e.trim()===``||e.trimStart().startsWith(`#`)){r++;continue}let i=/^([A-Za-z0-9_][\w .-]*):(?:[ \t]+(.*))?$/.exec(e);if(!i||/^\s/.test(e)){r++;continue}let a=i[1],o=(i[2]??``).trim();if(o!==``){n.push({key:a,value:KT(o),block:null}),r++;continue}let s=[];for(r++;r<t.length;){let e=t[r];if(e.trim()===``){r++;continue}if(/^\s/.test(e)||/^-[ \t]/.test(e)){s.push(e),r++;continue}break}n.push({key:a,value:null,block:s.length>0?s:null})}return n}function JT(e){let t=/^---\r?\n([\s\S]*?)\r?\n---[ \t]*(?:\r?\n|$)/.exec(e);if(!t)return{entries:null,body:e};let n=qT(t[1]);return n.length===0?{entries:null,body:e}:{entries:n,body:e.slice(t[0].length)}}function YT(e){let t=e.filter(e=>e.trim()!==``).map(e=>/^[ \t]*/.exec(e)?.[0].length??0),n=t.length>0?Math.min(...t):0;return e.map(e=>e.slice(n))}function XT({block:e}){let t=YT(e),n=t.filter(e=>e.trim()!==``);return n.length>0&&n.every(e=>/^-[ \t]+/.test(e))?(0,E.jsx)(`ul`,{className:`m-0 list-disc space-y-0.5 pl-4`,children:n.map((e,t)=>(0,E.jsx)(`li`,{className:`font-mono text-[12px] text-text`,children:KT(e.replace(/^-[ \t]+/,``).trim())},t))}):(0,E.jsx)(`pre`,{className:`m-0 whitespace-pre-wrap break-words font-mono text-[12px] leading-relaxed text-text`,children:t.join(`
|
|
302
|
-
`).trimEnd()})}function ZT({entries:e}){return(0,E.jsx)(`div`,{className:`mb-5 overflow-hidden rounded-sm border border-border-soft bg-surface-raised/30`,children:(0,E.jsx)(`table`,{className:`m-0 w-full border-collapse text-left align-top`,children:(0,E.jsx)(`tbody`,{children:e.map((e,t)=>(0,E.jsxs)(`tr`,{className:t>0?`border-t border-border-soft/70`:void 0,children:[(0,E.jsx)(`th`,{scope:`row`,className:`w-px whitespace-nowrap border-r border-border-soft/70 bg-surface-raised/40 px-3 py-2 align-top font-sans text-[11px] font-semibold uppercase tracking-wide text-text-subtle`,children:e.key}),(0,E.jsx)(`td`,{className:`px-3 py-2 align-top font-mono text-[12px] text-text`,children:e.block?(0,E.jsx)(XT,{block:e.block}):(0,E.jsx)(`span`,{className:`break-words`,children:e.value})})]},e.key+t))})})})}function QT({src:e,alt:t}){let[n,r]=(0,T.useState)(!1),i=(0,T.useRef)(null),a=(0,T.useRef)(null),o=(0,T.useCallback)(()=>{a.current=document.activeElement instanceof HTMLElement?document.activeElement:null,r(!0)},[]),c=(0,T.useCallback)(()=>{r(!1)},[]);return(0,T.useEffect)(()=>{if(!n)return;function e(e){e.key===`Escape`?c():e.key===`Tab`&&(e.preventDefault(),i.current?.focus())}return i.current?.focus(),document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`keydown`,e),a.current?.focus()}},[c,n]),(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`img`,{src:e,alt:t,onClick:o,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),o())},role:`button`,tabIndex:0,"aria-label":t?`Open image: ${t}`:`Open image`,className:`max-w-full cursor-zoom-in rounded`}),n&&(0,E.jsxs)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-label":t?`Image preview: ${t}`:`Image preview`,className:`fixed inset-0 z-50 flex items-center justify-center bg-black/80 p-4`,onClick:c,children:[(0,E.jsx)(`button`,{ref:i,onClick:e=>{e.stopPropagation(),c()},"aria-label":`Close image preview`,title:`Close`,className:`chrome absolute right-4 top-4 flex min-h-[44px] min-w-[44px] items-center justify-center rounded-sm bg-black/40 text-white transition-colors hover:bg-black/60 focus-visible:bg-black/60`,children:(0,E.jsx)(s,{className:`h-4 w-4`})}),(0,E.jsx)(`img`,{src:e,alt:t,className:`max-h-full max-w-full object-contain`,onClick:e=>e.stopPropagation()}),t&&(0,E.jsx)(`div`,{className:`chrome absolute bottom-4 left-4 right-4 rounded-sm bg-black/45 px-3 py-2 text-center text-[12px] text-white/85`,children:t})]})]})}var $T=null;function eE(){return $T||=x(async()=>{let{default:e}=await import(`./mermaid.core-d2YYcY2v.js`);return{default:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19])).then(({default:e})=>(e.initialize({startOnLoad:!1,securityLevel:`strict`,theme:`neutral`,htmlLabels:!1,flowchart:{htmlLabels:!1}}),e)),$T}function tE(e){return Ks.sanitize(e,{USE_PROFILES:{svg:!0,svgFilters:!0},FORBID_TAGS:[`foreignObject`,`img`,`image`,`script`,`iframe`,`object`,`embed`,`a`,`audio`,`video`,`source`,`link`,`base`],FORBID_ATTR:[`href`,`xlink:href`,`src`,`onerror`,`onload`,`onclick`]})}function nE({code:e}){let t=(0,T.useId)(),[n,r]=(0,T.useState)({svg:null,failed:!1});(0,T.useEffect)(()=>{let n=!1,i=`mermaid-${t.replace(/[^a-zA-Z0-9_-]/g,``)}`;return eE().then(t=>t.render(i,e)).then(({svg:e})=>{n||r({svg:e,failed:!1})}).catch(()=>{n||r({svg:null,failed:!0})}),()=>{n=!0}},[e,t]);let{svg:i,failed:a}=n;return a?(0,E.jsx)(`pre`,{className:`font-mono text-[0.82em] leading-[1.55] text-text-muted`,style:{background:`transparent`,margin:0},children:e}):i===null?(0,E.jsx)(`div`,{className:`px-3 py-4 text-[0.82em] text-text-subtle`,children:`Rendering diagram…`}):(0,E.jsx)(`div`,{className:`flex justify-center overflow-x-auto px-3 py-3 [&_svg]:max-w-full [&_svg]:h-auto`,dangerouslySetInnerHTML:{__html:tE(i)}})}var rE={note:{label:`Note`,Icon:ce},tip:{label:`Tip`,Icon:t},important:{label:`Important`,Icon:de},warning:{label:`Warning`,Icon:u},caution:{label:`Caution`,Icon:fe}},iE=/^\[!(NOTE|TIP|IMPORTANT|WARNING|CAUTION)\]/i;function aE(e){let t=Array.isArray(e)?e:typeof e==`string`?e.split(/\s+/):[];if(!t.includes(`markdown-alert`))return null;for(let e of Object.keys(rE))if(t.includes(`markdown-alert-${e}`))return e;return null}function oE(){function e(e){let t=e.children?.find(e=>e.type===`element`&&e.tagName===`p`),n=t?.children?.[0];if(!t||!n||n.type!==`text`||typeof n.value!=`string`)return;let r=iE.exec(n.value);if(!r)return;let i=r[1].toLowerCase(),a=n.value.slice(r[0].length).replace(/^[^\S\n]*\n?/,``);if(a)n.value=a;else{t.children.shift();let n=t.children[0];(n&&n.type===`text`&&typeof n.value==`string`&&/^\s+$/.test(n.value)||n&&n.type===`element`&&n.tagName===`br`)&&t.children.shift(),t.children.length===0&&(e.children=e.children.filter(e=>e!==t))}e.properties=e.properties??{},e.properties.className=[`markdown-alert`,`markdown-alert-${i}`]}function t(n){if(n.children)for(let r of n.children)r.type===`element`&&r.tagName===`blockquote`&&e(r),t(r)}return e=>t(e)}function sE(e,t){if(!e||e.startsWith(`#`)||/^[a-z][a-z\d+\-.]*:/i.test(e))return null;try{let n=new URL(e,`http://x/${t}`);if(n.host!==`x`)return null;let r=n.pathname.slice(1);return r?{path:r,hash:n.hash}:null}catch{return null}}function cE(e,t,n){if(!e||/^[a-z][a-z\d+\-.]*:/i.test(e)||e.startsWith(`#`)||e.startsWith(`/`))return e;let r=sE(e,n);return r?t(r.path):e}function lE(e){if(typeof e!=`string`||e.trim()===``)return!0;if(/prefers-color-scheme:\s*dark/i.test(e))return!1;if(/prefers-color-scheme:\s*light/i.test(e))return!0;if(typeof window<`u`&&typeof window.matchMedia==`function`)try{return window.matchMedia(e).matches}catch{return!0}return!0}function uE(e,t,n){let r=Array.isArray(e)?e.join(`, `):typeof e==`string`?e:``;if(r)return r.split(`,`).map(e=>e.trim()).filter(Boolean).map(e=>{let[r,...i]=e.split(/\s+/);return[cE(r,t,n),...i].join(` `).trim()}).join(`, `)}function dE(e){return T.Children.toArray(e).map(e=>typeof e==`string`?e:(0,T.isValidElement)(e)?dE(e.props.children):``).join(``)}function fE(e,t){return function({children:n,node:r,className:i,...a}){let o=r?.position?.start?.line,s=(typeof o==`number`?t.get(o):void 0)??xT(dE(n));return(0,E.jsxs)(e,{...a,id:s,onClick:()=>{DT(s)},className:[`group relative cursor-pointer`,i].filter(Boolean).join(` `),children:[(0,E.jsx)(NT,{id:s}),n]})}}function pE(e){return{h1:fE(`h1`,e),h2:fE(`h2`,e),h3:fE(`h3`,e),h4:fE(`h4`,e),h5:fE(`h5`,e),h6:fE(`h6`,e)}}var mE=[`div`,`p`,`span`,`h1`,`h2`,`h3`,`h4`,`h5`,`h6`,`td`,`th`],hE={...cw,tagNames:[...cw.tagNames??[],`picture`,`source`,`details`,`summary`],attributes:{...cw.attributes,source:[`srcSet`,`srcset`,`media`,`type`,`sizes`,`width`,`height`],img:[...cw.attributes?.img??[],`align`,`width`,`height`,`loading`],details:[...cw.attributes?.details??[],`open`],blockquote:[...cw.attributes?.blockquote??[],[`className`,`markdown-alert`,`markdown-alert-note`,`markdown-alert-tip`,`markdown-alert-important`,`markdown-alert-warning`,`markdown-alert-caution`]],...Object.fromEntries(mE.map(e=>[e,[...cw.attributes?.[e]??[],`align`]]))}};function gE(e,t,n){return function({href:r,children:i,...a}){let o=S();if(!r||r.startsWith(`#`))return(0,E.jsx)(`a`,{href:r,...a,onClick:e=>{!r||r===`#`||(e.preventDefault(),n.current?.scrollToHash(r.slice(1)))},children:i});if(/^[a-z][a-z\d+\-.]*:/i.test(r))return(0,E.jsx)(`a`,{href:r,target:`_blank`,rel:`noreferrer`,...a,children:i});let s=sE(r,t);if(!s)return(0,E.jsx)(`a`,{href:r,target:`_blank`,rel:`noreferrer`,...a,children:i});let c=e.browsePath(s.path)+s.hash;return(0,E.jsx)(`a`,{href:c,onClick:e=>{e.preventDefault(),o(c)},...a,children:i})}}function _E({id:e,filePath:t,file:i,loading:a,error:o,links:s,mode:c,onModeChange:l}){let u=(0,T.useMemo)(()=>s??{rawPath:t=>b(e,t),browsePath:t=>r({id:e,filePath:t})},[s,e]),d=u.rawPath(t),f=(0,T.useRef)(null),p=(0,T.useRef)(null),{entries:m,body:h}=(0,T.useMemo)(()=>i?.kind!==`markdown`||!i.content?{entries:null,body:``}:JT(i.content),[i]),g=(0,T.useMemo)(()=>i?.kind!==`markdown`||!h?[]:OT(h),[i,h]),_=(0,T.useMemo)(()=>h?kT(h):``,[h]),v=(0,T.useMemo)(()=>new Map(g.map(e=>[e.line,e.id])),[g]),y=(0,T.useMemo)(()=>g.map(e=>e.id),[g]),[x,S]=(0,T.useState)(null),C=g.length>=3,ee=g.length?Math.min(...g.map(e=>e.depth)):1,[ne,re]=(0,T.useState)(()=>jT(window.location.hash)?`code`:BT()),ie=c!==void 0&&l!==void 0,w=ie?c:ne,ae=(0,T.useCallback)(e=>{ie&&l?l(e):(re(e),VT(e))},[ie,l]),oe=i?.kind===`markdown`&&w===`code`,se=(0,T.useRef)(null),ce=(0,T.useCallback)(e=>{se.current={id:e,until:Date.now()+2e3}},[]),le=(0,T.useCallback)(e=>{let t=ET(e,y)??e,n=document.getElementById(t);return n?.id?(ce(n.id),n.scrollIntoView({behavior:`smooth`}),DT(n.id),S(n.id),!0):!1},[ce,y]);(0,T.useEffect)(()=>{p.current={scrollToHash:le}},[le]),(0,T.useEffect)(()=>{if(i?.kind!==`markdown`||w!==`preview`)return;let e=window.location.hash.slice(1);if(!e)return;let t=ET(e,y)??e,n=document.getElementById(t);if(n){ce(n.id);let e=setTimeout(()=>{g.some(e=>e.id===n.id)&&S(n.id),n.scrollIntoView({behavior:`smooth`}),DT(n.id)},100);return()=>clearTimeout(e)}},[i,w,g,y,ce]),(0,T.useEffect)(()=>{if(i?.kind!==`markdown`||w!==`preview`)return;let e=f.current;if(!e)return;let t=e,n=()=>Array.from(t.querySelectorAll(`h1[id], h2[id], h3[id], h4[id], h5[id], h6[id]`)),r=0;function a(e){r=0;let i=n();if(i.length===0)return;let a=t.getBoundingClientRect().top+24,o=i[0];for(let e of i)if(e.getBoundingClientRect().top<=a)o=e;else break;if(!o?.id)return;let s=se.current;if(s&&Date.now()<s.until){if(o.id!==s.id)return;se.current=null}else se.current=null;e&&DT(o.id),S(o.id)}function o(){r||=window.requestAnimationFrame(()=>a(!0))}let s=window.location.hash.slice(1);return s&&(ET(s,y)??(n().some(e=>e.id===s)?s:null))||(r=window.requestAnimationFrame(()=>a(!1))),t.addEventListener(`scroll`,o,{passive:!0}),()=>{t.removeEventListener(`scroll`,o),r&&window.cancelAnimationFrame(r)}},[i,w,y]);let ue=(0,T.useMemo)(()=>({a:gE(u,t,p),...pE(v),img:({src:e,alt:n})=>{let r=e??``;if(r&&!/^[a-z][a-z\d+\-.]*:/i.test(r)&&!r.startsWith(`#`)){let e=sE(r,t);e&&(r=u.rawPath(e.path))}return(0,E.jsx)(QT,{src:r,alt:n??``})},picture:({node:e})=>{let n=null,r=null;for(let i of e?.children??[]){if(i.type!==`element`)continue;let e=i.properties??{};if(i.tagName===`source`&&!n&&lE(e.media)){let r=uE(e.srcSet??e.srcset,u.rawPath,t),i=r?r.split(`,`)[0]?.trim().split(/\s+/)[0]:``;i&&(n=i)}else i.tagName===`img`&&!r&&(r={src:cE(typeof e.src==`string`?e.src:``,u.rawPath,t),alt:typeof e.alt==`string`?e.alt:``,width:e.width==null?void 0:String(e.width)})}let i=n??r?.src;return i?(0,E.jsx)(`img`,{src:i,alt:r?.alt??``,width:r?.width,className:`inline-block h-auto max-w-full`}):null},blockquote:({node:e,children:t,...n})=>{let r=aE(e?.properties?.className);if(!r)return(0,E.jsx)(`blockquote`,{...n,children:t});let{label:i,Icon:a}=rE[r];return(0,E.jsxs)(`blockquote`,{className:`markdown-alert markdown-alert-${r}`,children:[(0,E.jsxs)(`p`,{className:`markdown-alert-title`,children:[(0,E.jsx)(a,{className:`h-4 w-4 shrink-0`,strokeWidth:2,"aria-hidden":`true`}),i]}),t]})},table:({children:e,...t})=>(0,E.jsx)(`div`,{className:`overflow-x-auto`,children:(0,E.jsx)(`table`,{...t,children:e})}),pre:({children:e})=>{let t=dE(e),n=``,r=T.Children.toArray(e)[0];if((0,T.isValidElement)(r)){let e=(r.props.className??``).match(/language-(\S+)/);e&&(n=e[1])}return n===`mermaid`?(0,E.jsxs)(`div`,{className:`kb-markdown-code-block group`,children:[(0,E.jsxs)(`div`,{className:`chrome flex min-h-9 items-center justify-between gap-2 border-b border-border-soft/70 bg-surface-raised/45 px-2 py-1`,children:[(0,E.jsx)(`span`,{className:`rounded-sm px-1.5 py-0.5 text-[10px] uppercase tracking-wider text-text-subtle`,children:`mermaid`}),(0,E.jsx)(MT,{text:t,variant:`inline`})]}),(0,E.jsx)(nE,{code:t.replace(/\n$/,``)})]}):(0,E.jsxs)(`div`,{className:`kb-markdown-code-block group`,children:[(0,E.jsxs)(`div`,{className:`chrome flex min-h-9 items-center justify-between gap-2 border-b border-border-soft/70 bg-surface-raised/45 px-2 py-1`,children:[n?(0,E.jsx)(`span`,{className:`rounded-sm px-1.5 py-0.5 text-[10px] uppercase tracking-wider text-text-subtle`,children:n}):(0,E.jsx)(`span`,{"aria-hidden":`true`}),(0,E.jsx)(MT,{text:t,variant:`inline`})]}),(0,E.jsx)(bT,{code:t.replace(/\n$/,``),language:n||`text`,theme:Uw.github,children:({className:e,style:t,tokens:n,getLineProps:r,getTokenProps:i})=>(0,E.jsx)(`pre`,{className:`${e} font-mono text-[0.82em] leading-[1.55]`,style:{...t,background:`transparent`,margin:0},children:n.map((e,t)=>(0,E.jsx)(`div`,{...r({line:e}),children:e.map((e,t)=>(0,E.jsx)(`span`,{...i({token:e})},t))},t))})})]})}}),[v,u,t]);if(o)return(0,E.jsxs)(`div`,{className:`p-6 font-sans text-[13px] text-health-error`,children:[`Could not open `,(0,E.jsx)(`span`,{className:`font-mono`,children:t}),`: `,o.message]});if(a||!i)return(0,E.jsx)(`div`,{className:`p-6 font-sans text-[13px] text-text-subtle`,children:`Loading…`});if(i.kind===`html`)return(0,E.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,E.jsx)(`div`,{className:`flex h-8 shrink-0 items-center justify-end border-b border-border-soft px-3`,children:(0,E.jsxs)(`a`,{href:d,target:`_blank`,rel:`noreferrer`,title:`Open the full-width report in a new tab`,className:`chrome flex items-center gap-1 rounded-sm px-2 py-0.5 text-[10px] uppercase tracking-[0.08em] text-text-subtle transition-colors hover:bg-surface-elevated hover:text-text-muted`,children:[(0,E.jsx)(n,{className:`h-3 w-3`}),`Open full page`]})}),(0,E.jsx)(`iframe`,{title:i.name,src:d,sandbox:`allow-scripts`,className:`min-h-0 w-full flex-1 border-0 bg-white`})]});if(i.kind===`image`)return(0,E.jsx)(`div`,{className:`flex h-full flex-col`,children:(0,E.jsx)(`div`,{className:`flex flex-1 items-center justify-center overflow-auto bg-surface-elevated/30 p-6`,children:(0,E.jsx)(QT,{src:d,alt:i.name})})});if(i.kind===`pdf`)return(0,E.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,E.jsx)(`div`,{className:`flex h-8 shrink-0 items-center justify-end border-b border-border-soft px-3`,children:(0,E.jsxs)(`a`,{href:d,target:`_blank`,rel:`noreferrer`,title:`Open the PDF in a new tab`,className:`chrome flex items-center gap-1 rounded-sm px-2 py-0.5 text-[10px] uppercase tracking-[0.08em] text-text-subtle transition-colors hover:bg-surface-elevated hover:text-text-muted`,children:[(0,E.jsx)(n,{className:`h-3 w-3`}),`Open full page`]})}),(0,E.jsx)(`iframe`,{title:i.name,src:d,className:`min-h-0 w-full flex-1 border-0 bg-surface-elevated/30`})]});if(i.truncated)return(0,E.jsxs)(`div`,{className:`p-6 font-sans text-[13px] text-text-muted`,children:[`This file is too large to inline (`,te(i.size),`).`,` `,(0,E.jsx)(`a`,{href:d,target:`_blank`,rel:`noreferrer`,className:`text-accent underline underline-offset-2`,children:`Open raw`})]});if(i.kind===`binary`||i.content===void 0)return(0,E.jsxs)(`div`,{className:`p-6 font-sans text-[13px] text-text-muted`,children:[`Binary file (`,te(i.size),`).`,` `,(0,E.jsx)(`a`,{href:d,target:`_blank`,rel:`noreferrer`,className:`text-accent underline underline-offset-2`,children:`Open raw`})]});if(i.kind===`markdown`)return(0,E.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[!ie&&(0,E.jsx)(`div`,{className:`flex h-9 shrink-0 items-center justify-end border-b border-border-soft px-3`,children:(0,E.jsx)(RT,{mode:w,onChange:ae})}),oe?(0,E.jsx)(GT,{body:i.content,language:`markdown`}):(0,E.jsx)(`div`,{ref:f,className:`@container min-h-0 flex-1 overflow-y-auto px-6 py-6 md:px-10 md:py-10`,children:(0,E.jsxs)(`div`,{className:[`mx-auto flex w-full max-w-[1024px] gap-12`,C?`@min-[1372px]:max-w-[1292px]`:``].join(` `),children:[(0,E.jsxs)(`div`,{className:`w-full min-w-0 max-w-[1024px] flex-1`,children:[m&&(0,E.jsx)(ZT,{entries:m}),(0,E.jsx)(`div`,{className:`md-prose`,children:(0,E.jsx)(Hm,{remarkPlugins:[J_,ov,lv],rehypePlugins:[bC,oE,[Tw,hE],ow],components:ue,children:_})})]}),C&&(0,E.jsxs)(`nav`,{"aria-label":`On this page`,className:`sticky top-2 hidden w-[220px] shrink-0 self-start @min-[1372px]:block`,children:[(0,E.jsx)(`div`,{className:`chrome mb-3 text-[11px] uppercase tracking-[0.14em] text-text-muted`,children:`On this page`}),(0,E.jsx)(`ul`,{className:`space-y-2 border-l border-border-soft pl-3`,children:g.map(e=>(0,E.jsx)(`li`,{children:(0,E.jsx)(`a`,{href:`#${e.id}`,onClick:t=>{t.preventDefault(),ce(e.id),document.getElementById(e.id)?.scrollIntoView({behavior:`smooth`}),DT(e.id),S(e.id)},className:[`block truncate font-sans text-[14px] leading-snug transition-colors`,x===e.id?`text-accent`:`text-text-muted hover:text-text`].join(` `),style:{paddingLeft:`${(e.depth-ee)*12}px`},children:e.text})},`${e.id}-${e.line}`))})]})]})})]});let de=i.kind===`json`?`json`:i.language??`text`,fe=i.content;if(i.kind===`json`)try{fe=JSON.stringify(JSON.parse(i.content),null,2)}catch{}return(0,E.jsx)(GT,{body:fe,language:de})}export{FT as a,OT as c,ic as d,Qs as f,PT as i,jT as l,me as m,BT as n,IT as o,Ks as p,VT as r,RT as s,_E as t,rc as u};
|
|
302
|
+
`).trimEnd()})}function ZT({entries:e}){return(0,E.jsx)(`div`,{className:`mb-5 overflow-hidden rounded-sm border border-border-soft bg-surface-raised/30`,children:(0,E.jsx)(`table`,{className:`m-0 w-full border-collapse text-left align-top`,children:(0,E.jsx)(`tbody`,{children:e.map((e,t)=>(0,E.jsxs)(`tr`,{className:t>0?`border-t border-border-soft/70`:void 0,children:[(0,E.jsx)(`th`,{scope:`row`,className:`w-px whitespace-nowrap border-r border-border-soft/70 bg-surface-raised/40 px-3 py-2 align-top font-sans text-[11px] font-semibold uppercase tracking-wide text-text-subtle`,children:e.key}),(0,E.jsx)(`td`,{className:`px-3 py-2 align-top font-mono text-[12px] text-text`,children:e.block?(0,E.jsx)(XT,{block:e.block}):(0,E.jsx)(`span`,{className:`break-words`,children:e.value})})]},e.key+t))})})})}function QT({src:e,alt:t}){let[n,r]=(0,T.useState)(!1),i=(0,T.useRef)(null),a=(0,T.useRef)(null),o=(0,T.useCallback)(()=>{a.current=document.activeElement instanceof HTMLElement?document.activeElement:null,r(!0)},[]),c=(0,T.useCallback)(()=>{r(!1)},[]);return(0,T.useEffect)(()=>{if(!n)return;function e(e){e.key===`Escape`?c():e.key===`Tab`&&(e.preventDefault(),i.current?.focus())}return i.current?.focus(),document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`keydown`,e),a.current?.focus()}},[c,n]),(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`img`,{src:e,alt:t,onClick:o,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),o())},role:`button`,tabIndex:0,"aria-label":t?`Open image: ${t}`:`Open image`,className:`max-w-full cursor-zoom-in rounded`}),n&&(0,E.jsxs)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-label":t?`Image preview: ${t}`:`Image preview`,className:`fixed inset-0 z-50 flex items-center justify-center bg-black/80 p-4`,onClick:c,children:[(0,E.jsx)(`button`,{ref:i,onClick:e=>{e.stopPropagation(),c()},"aria-label":`Close image preview`,title:`Close`,className:`chrome absolute right-4 top-4 flex min-h-[44px] min-w-[44px] items-center justify-center rounded-sm bg-black/40 text-white transition-colors hover:bg-black/60 focus-visible:bg-black/60`,children:(0,E.jsx)(s,{className:`h-4 w-4`})}),(0,E.jsx)(`img`,{src:e,alt:t,className:`max-h-full max-w-full object-contain`,onClick:e=>e.stopPropagation()}),t&&(0,E.jsx)(`div`,{className:`chrome absolute bottom-4 left-4 right-4 rounded-sm bg-black/45 px-3 py-2 text-center text-[12px] text-white/85`,children:t})]})]})}var $T=null;function eE(){return $T||=x(async()=>{let{default:e}=await import(`./mermaid.core-kFGsR4Cp.js`);return{default:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19])).then(({default:e})=>(e.initialize({startOnLoad:!1,securityLevel:`strict`,theme:`neutral`,htmlLabels:!1,flowchart:{htmlLabels:!1}}),e)),$T}function tE(e){return Ks.sanitize(e,{USE_PROFILES:{svg:!0,svgFilters:!0},FORBID_TAGS:[`foreignObject`,`img`,`image`,`script`,`iframe`,`object`,`embed`,`a`,`audio`,`video`,`source`,`link`,`base`],FORBID_ATTR:[`href`,`xlink:href`,`src`,`onerror`,`onload`,`onclick`]})}function nE({code:e}){let t=(0,T.useId)(),[n,r]=(0,T.useState)({svg:null,failed:!1});(0,T.useEffect)(()=>{let n=!1,i=`mermaid-${t.replace(/[^a-zA-Z0-9_-]/g,``)}`;return eE().then(t=>t.render(i,e)).then(({svg:e})=>{n||r({svg:e,failed:!1})}).catch(()=>{n||r({svg:null,failed:!0})}),()=>{n=!0}},[e,t]);let{svg:i,failed:a}=n;return a?(0,E.jsx)(`pre`,{className:`font-mono text-[0.82em] leading-[1.55] text-text-muted`,style:{background:`transparent`,margin:0},children:e}):i===null?(0,E.jsx)(`div`,{className:`px-3 py-4 text-[0.82em] text-text-subtle`,children:`Rendering diagram…`}):(0,E.jsx)(`div`,{className:`flex justify-center overflow-x-auto px-3 py-3 [&_svg]:max-w-full [&_svg]:h-auto`,dangerouslySetInnerHTML:{__html:tE(i)}})}var rE={note:{label:`Note`,Icon:ce},tip:{label:`Tip`,Icon:t},important:{label:`Important`,Icon:de},warning:{label:`Warning`,Icon:u},caution:{label:`Caution`,Icon:fe}},iE=/^\[!(NOTE|TIP|IMPORTANT|WARNING|CAUTION)\]/i;function aE(e){let t=Array.isArray(e)?e:typeof e==`string`?e.split(/\s+/):[];if(!t.includes(`markdown-alert`))return null;for(let e of Object.keys(rE))if(t.includes(`markdown-alert-${e}`))return e;return null}function oE(){function e(e){let t=e.children?.find(e=>e.type===`element`&&e.tagName===`p`),n=t?.children?.[0];if(!t||!n||n.type!==`text`||typeof n.value!=`string`)return;let r=iE.exec(n.value);if(!r)return;let i=r[1].toLowerCase(),a=n.value.slice(r[0].length).replace(/^[^\S\n]*\n?/,``);if(a)n.value=a;else{t.children.shift();let n=t.children[0];(n&&n.type===`text`&&typeof n.value==`string`&&/^\s+$/.test(n.value)||n&&n.type===`element`&&n.tagName===`br`)&&t.children.shift(),t.children.length===0&&(e.children=e.children.filter(e=>e!==t))}e.properties=e.properties??{},e.properties.className=[`markdown-alert`,`markdown-alert-${i}`]}function t(n){if(n.children)for(let r of n.children)r.type===`element`&&r.tagName===`blockquote`&&e(r),t(r)}return e=>t(e)}function sE(e,t){if(!e||e.startsWith(`#`)||/^[a-z][a-z\d+\-.]*:/i.test(e))return null;try{let n=new URL(e,`http://x/${t}`);if(n.host!==`x`)return null;let r=n.pathname.slice(1);return r?{path:r,hash:n.hash}:null}catch{return null}}function cE(e,t,n){if(!e||/^[a-z][a-z\d+\-.]*:/i.test(e)||e.startsWith(`#`)||e.startsWith(`/`))return e;let r=sE(e,n);return r?t(r.path):e}function lE(e){if(typeof e!=`string`||e.trim()===``)return!0;if(/prefers-color-scheme:\s*dark/i.test(e))return!1;if(/prefers-color-scheme:\s*light/i.test(e))return!0;if(typeof window<`u`&&typeof window.matchMedia==`function`)try{return window.matchMedia(e).matches}catch{return!0}return!0}function uE(e,t,n){let r=Array.isArray(e)?e.join(`, `):typeof e==`string`?e:``;if(r)return r.split(`,`).map(e=>e.trim()).filter(Boolean).map(e=>{let[r,...i]=e.split(/\s+/);return[cE(r,t,n),...i].join(` `).trim()}).join(`, `)}function dE(e){return T.Children.toArray(e).map(e=>typeof e==`string`?e:(0,T.isValidElement)(e)?dE(e.props.children):``).join(``)}function fE(e,t){return function({children:n,node:r,className:i,...a}){let o=r?.position?.start?.line,s=(typeof o==`number`?t.get(o):void 0)??xT(dE(n));return(0,E.jsxs)(e,{...a,id:s,onClick:()=>{DT(s)},className:[`group relative cursor-pointer`,i].filter(Boolean).join(` `),children:[(0,E.jsx)(NT,{id:s}),n]})}}function pE(e){return{h1:fE(`h1`,e),h2:fE(`h2`,e),h3:fE(`h3`,e),h4:fE(`h4`,e),h5:fE(`h5`,e),h6:fE(`h6`,e)}}var mE=[`div`,`p`,`span`,`h1`,`h2`,`h3`,`h4`,`h5`,`h6`,`td`,`th`],hE={...cw,tagNames:[...cw.tagNames??[],`picture`,`source`,`details`,`summary`],attributes:{...cw.attributes,source:[`srcSet`,`srcset`,`media`,`type`,`sizes`,`width`,`height`],img:[...cw.attributes?.img??[],`align`,`width`,`height`,`loading`],details:[...cw.attributes?.details??[],`open`],blockquote:[...cw.attributes?.blockquote??[],[`className`,`markdown-alert`,`markdown-alert-note`,`markdown-alert-tip`,`markdown-alert-important`,`markdown-alert-warning`,`markdown-alert-caution`]],...Object.fromEntries(mE.map(e=>[e,[...cw.attributes?.[e]??[],`align`]]))}};function gE(e,t,n){return function({href:r,children:i,...a}){let o=S();if(!r||r.startsWith(`#`))return(0,E.jsx)(`a`,{href:r,...a,onClick:e=>{!r||r===`#`||(e.preventDefault(),n.current?.scrollToHash(r.slice(1)))},children:i});if(/^[a-z][a-z\d+\-.]*:/i.test(r))return(0,E.jsx)(`a`,{href:r,target:`_blank`,rel:`noreferrer`,...a,children:i});let s=sE(r,t);if(!s)return(0,E.jsx)(`a`,{href:r,target:`_blank`,rel:`noreferrer`,...a,children:i});let c=e.browsePath(s.path)+s.hash;return(0,E.jsx)(`a`,{href:c,onClick:e=>{e.preventDefault(),o(c)},...a,children:i})}}function _E({id:e,filePath:t,file:i,loading:a,error:o,links:s,mode:c,onModeChange:l}){let u=(0,T.useMemo)(()=>s??{rawPath:t=>b(e,t),browsePath:t=>r({id:e,filePath:t})},[s,e]),d=u.rawPath(t),f=(0,T.useRef)(null),p=(0,T.useRef)(null),{entries:m,body:h}=(0,T.useMemo)(()=>i?.kind!==`markdown`||!i.content?{entries:null,body:``}:JT(i.content),[i]),g=(0,T.useMemo)(()=>i?.kind!==`markdown`||!h?[]:OT(h),[i,h]),_=(0,T.useMemo)(()=>h?kT(h):``,[h]),v=(0,T.useMemo)(()=>new Map(g.map(e=>[e.line,e.id])),[g]),y=(0,T.useMemo)(()=>g.map(e=>e.id),[g]),[x,S]=(0,T.useState)(null),C=g.length>=3,ee=g.length?Math.min(...g.map(e=>e.depth)):1,[ne,re]=(0,T.useState)(()=>jT(window.location.hash)?`code`:BT()),ie=c!==void 0&&l!==void 0,w=ie?c:ne,ae=(0,T.useCallback)(e=>{ie&&l?l(e):(re(e),VT(e))},[ie,l]),oe=i?.kind===`markdown`&&w===`code`,se=(0,T.useRef)(null),ce=(0,T.useCallback)(e=>{se.current={id:e,until:Date.now()+2e3}},[]),le=(0,T.useCallback)(e=>{let t=ET(e,y)??e,n=document.getElementById(t);return n?.id?(ce(n.id),n.scrollIntoView({behavior:`smooth`}),DT(n.id),S(n.id),!0):!1},[ce,y]);(0,T.useEffect)(()=>{p.current={scrollToHash:le}},[le]),(0,T.useEffect)(()=>{if(i?.kind!==`markdown`||w!==`preview`)return;let e=window.location.hash.slice(1);if(!e)return;let t=ET(e,y)??e,n=document.getElementById(t);if(n){ce(n.id);let e=setTimeout(()=>{g.some(e=>e.id===n.id)&&S(n.id),n.scrollIntoView({behavior:`smooth`}),DT(n.id)},100);return()=>clearTimeout(e)}},[i,w,g,y,ce]),(0,T.useEffect)(()=>{if(i?.kind!==`markdown`||w!==`preview`)return;let e=f.current;if(!e)return;let t=e,n=()=>Array.from(t.querySelectorAll(`h1[id], h2[id], h3[id], h4[id], h5[id], h6[id]`)),r=0;function a(e){r=0;let i=n();if(i.length===0)return;let a=t.getBoundingClientRect().top+24,o=i[0];for(let e of i)if(e.getBoundingClientRect().top<=a)o=e;else break;if(!o?.id)return;let s=se.current;if(s&&Date.now()<s.until){if(o.id!==s.id)return;se.current=null}else se.current=null;e&&DT(o.id),S(o.id)}function o(){r||=window.requestAnimationFrame(()=>a(!0))}let s=window.location.hash.slice(1);return s&&(ET(s,y)??(n().some(e=>e.id===s)?s:null))||(r=window.requestAnimationFrame(()=>a(!1))),t.addEventListener(`scroll`,o,{passive:!0}),()=>{t.removeEventListener(`scroll`,o),r&&window.cancelAnimationFrame(r)}},[i,w,y]);let ue=(0,T.useMemo)(()=>({a:gE(u,t,p),...pE(v),img:({src:e,alt:n})=>{let r=e??``;if(r&&!/^[a-z][a-z\d+\-.]*:/i.test(r)&&!r.startsWith(`#`)){let e=sE(r,t);e&&(r=u.rawPath(e.path))}return(0,E.jsx)(QT,{src:r,alt:n??``})},picture:({node:e})=>{let n=null,r=null;for(let i of e?.children??[]){if(i.type!==`element`)continue;let e=i.properties??{};if(i.tagName===`source`&&!n&&lE(e.media)){let r=uE(e.srcSet??e.srcset,u.rawPath,t),i=r?r.split(`,`)[0]?.trim().split(/\s+/)[0]:``;i&&(n=i)}else i.tagName===`img`&&!r&&(r={src:cE(typeof e.src==`string`?e.src:``,u.rawPath,t),alt:typeof e.alt==`string`?e.alt:``,width:e.width==null?void 0:String(e.width)})}let i=n??r?.src;return i?(0,E.jsx)(`img`,{src:i,alt:r?.alt??``,width:r?.width,className:`inline-block h-auto max-w-full`}):null},blockquote:({node:e,children:t,...n})=>{let r=aE(e?.properties?.className);if(!r)return(0,E.jsx)(`blockquote`,{...n,children:t});let{label:i,Icon:a}=rE[r];return(0,E.jsxs)(`blockquote`,{className:`markdown-alert markdown-alert-${r}`,children:[(0,E.jsxs)(`p`,{className:`markdown-alert-title`,children:[(0,E.jsx)(a,{className:`h-4 w-4 shrink-0`,strokeWidth:2,"aria-hidden":`true`}),i]}),t]})},table:({children:e,...t})=>(0,E.jsx)(`div`,{className:`overflow-x-auto`,children:(0,E.jsx)(`table`,{...t,children:e})}),pre:({children:e})=>{let t=dE(e),n=``,r=T.Children.toArray(e)[0];if((0,T.isValidElement)(r)){let e=(r.props.className??``).match(/language-(\S+)/);e&&(n=e[1])}return n===`mermaid`?(0,E.jsxs)(`div`,{className:`kb-markdown-code-block group`,children:[(0,E.jsxs)(`div`,{className:`chrome flex min-h-9 items-center justify-between gap-2 border-b border-border-soft/70 bg-surface-raised/45 px-2 py-1`,children:[(0,E.jsx)(`span`,{className:`rounded-sm px-1.5 py-0.5 text-[10px] uppercase tracking-wider text-text-subtle`,children:`mermaid`}),(0,E.jsx)(MT,{text:t,variant:`inline`})]}),(0,E.jsx)(nE,{code:t.replace(/\n$/,``)})]}):(0,E.jsxs)(`div`,{className:`kb-markdown-code-block group`,children:[(0,E.jsxs)(`div`,{className:`chrome flex min-h-9 items-center justify-between gap-2 border-b border-border-soft/70 bg-surface-raised/45 px-2 py-1`,children:[n?(0,E.jsx)(`span`,{className:`rounded-sm px-1.5 py-0.5 text-[10px] uppercase tracking-wider text-text-subtle`,children:n}):(0,E.jsx)(`span`,{"aria-hidden":`true`}),(0,E.jsx)(MT,{text:t,variant:`inline`})]}),(0,E.jsx)(bT,{code:t.replace(/\n$/,``),language:n||`text`,theme:Uw.github,children:({className:e,style:t,tokens:n,getLineProps:r,getTokenProps:i})=>(0,E.jsx)(`pre`,{className:`${e} font-mono text-[0.82em] leading-[1.55]`,style:{...t,background:`transparent`,margin:0},children:n.map((e,t)=>(0,E.jsx)(`div`,{...r({line:e}),children:e.map((e,t)=>(0,E.jsx)(`span`,{...i({token:e})},t))},t))})})]})}}),[v,u,t]);if(o)return(0,E.jsxs)(`div`,{className:`p-6 font-sans text-[13px] text-health-error`,children:[`Could not open `,(0,E.jsx)(`span`,{className:`font-mono`,children:t}),`: `,o.message]});if(a||!i)return(0,E.jsx)(`div`,{className:`p-6 font-sans text-[13px] text-text-subtle`,children:`Loading…`});if(i.kind===`html`)return(0,E.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,E.jsx)(`div`,{className:`flex h-8 shrink-0 items-center justify-end border-b border-border-soft px-3`,children:(0,E.jsxs)(`a`,{href:d,target:`_blank`,rel:`noreferrer`,title:`Open the full-width report in a new tab`,className:`chrome flex items-center gap-1 rounded-sm px-2 py-0.5 text-[10px] uppercase tracking-[0.08em] text-text-subtle transition-colors hover:bg-surface-elevated hover:text-text-muted`,children:[(0,E.jsx)(n,{className:`h-3 w-3`}),`Open full page`]})}),(0,E.jsx)(`iframe`,{title:i.name,src:d,sandbox:`allow-scripts`,className:`min-h-0 w-full flex-1 border-0 bg-white`})]});if(i.kind===`image`)return(0,E.jsx)(`div`,{className:`flex h-full flex-col`,children:(0,E.jsx)(`div`,{className:`flex flex-1 items-center justify-center overflow-auto bg-surface-elevated/30 p-6`,children:(0,E.jsx)(QT,{src:d,alt:i.name})})});if(i.kind===`pdf`)return(0,E.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,E.jsx)(`div`,{className:`flex h-8 shrink-0 items-center justify-end border-b border-border-soft px-3`,children:(0,E.jsxs)(`a`,{href:d,target:`_blank`,rel:`noreferrer`,title:`Open the PDF in a new tab`,className:`chrome flex items-center gap-1 rounded-sm px-2 py-0.5 text-[10px] uppercase tracking-[0.08em] text-text-subtle transition-colors hover:bg-surface-elevated hover:text-text-muted`,children:[(0,E.jsx)(n,{className:`h-3 w-3`}),`Open full page`]})}),(0,E.jsx)(`iframe`,{title:i.name,src:d,className:`min-h-0 w-full flex-1 border-0 bg-surface-elevated/30`})]});if(i.truncated)return(0,E.jsxs)(`div`,{className:`p-6 font-sans text-[13px] text-text-muted`,children:[`This file is too large to inline (`,te(i.size),`).`,` `,(0,E.jsx)(`a`,{href:d,target:`_blank`,rel:`noreferrer`,className:`text-accent underline underline-offset-2`,children:`Open raw`})]});if(i.kind===`binary`||i.content===void 0)return(0,E.jsxs)(`div`,{className:`p-6 font-sans text-[13px] text-text-muted`,children:[`Binary file (`,te(i.size),`).`,` `,(0,E.jsx)(`a`,{href:d,target:`_blank`,rel:`noreferrer`,className:`text-accent underline underline-offset-2`,children:`Open raw`})]});if(i.kind===`markdown`)return(0,E.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[!ie&&(0,E.jsx)(`div`,{className:`flex h-9 shrink-0 items-center justify-end border-b border-border-soft px-3`,children:(0,E.jsx)(RT,{mode:w,onChange:ae})}),oe?(0,E.jsx)(GT,{body:i.content,language:`markdown`}):(0,E.jsx)(`div`,{ref:f,className:`@container min-h-0 flex-1 overflow-y-auto px-6 py-6 md:px-10 md:py-10`,children:(0,E.jsxs)(`div`,{className:[`mx-auto flex w-full max-w-[1024px] gap-12`,C?`@min-[1372px]:max-w-[1292px]`:``].join(` `),children:[(0,E.jsxs)(`div`,{className:`w-full min-w-0 max-w-[1024px] flex-1`,children:[m&&(0,E.jsx)(ZT,{entries:m}),(0,E.jsx)(`div`,{className:`md-prose`,children:(0,E.jsx)(Hm,{remarkPlugins:[J_,ov,lv],rehypePlugins:[bC,oE,[Tw,hE],ow],components:ue,children:_})})]}),C&&(0,E.jsxs)(`nav`,{"aria-label":`On this page`,className:`sticky top-2 hidden w-[220px] shrink-0 self-start @min-[1372px]:block`,children:[(0,E.jsx)(`div`,{className:`chrome mb-3 text-[11px] uppercase tracking-[0.14em] text-text-muted`,children:`On this page`}),(0,E.jsx)(`ul`,{className:`space-y-2 border-l border-border-soft pl-3`,children:g.map(e=>(0,E.jsx)(`li`,{children:(0,E.jsx)(`a`,{href:`#${e.id}`,onClick:t=>{t.preventDefault(),ce(e.id),document.getElementById(e.id)?.scrollIntoView({behavior:`smooth`}),DT(e.id),S(e.id)},className:[`block truncate font-sans text-[14px] leading-snug transition-colors`,x===e.id?`text-accent`:`text-text-muted hover:text-text`].join(` `),style:{paddingLeft:`${(e.depth-ee)*12}px`},children:e.text})},`${e.id}-${e.line}`))})]})]})})]});let de=i.kind===`json`?`json`:i.language??`text`,fe=i.content;if(i.kind===`json`)try{fe=JSON.stringify(JSON.parse(i.content),null,2)}catch{}return(0,E.jsx)(GT,{body:fe,language:de})}export{FT as a,OT as c,ic as d,Qs as f,PT as i,jT as l,me as m,BT as n,IT as o,Ks as p,VT as r,RT as s,_E as t,rc as u};
|