@rainmanhhh/pi-web 0.16.6 → 0.16.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (94) hide show
  1. package/dist/server.mjs +1 -1
  2. package/dist/static/assets/CodeMirrorEditor-PgqPU9fJ.js +39 -0
  3. package/dist/static/assets/{abnfDiagram-VCTEODGH-BGmWm0lz.js → abnfDiagram-VCTEODGH-DFw_kl9c.js} +1 -1
  4. package/dist/static/assets/architecture-7GRP2DOG-DcoUA-Kg.js +1 -0
  5. package/dist/static/assets/{architectureDiagram-5GKGNRK7-Cnch84ss.js → architectureDiagram-5GKGNRK7-3UPTOVxd.js} +1 -1
  6. package/dist/static/assets/{blockDiagram-I7D4REHJ-BJzuomMa.js → blockDiagram-I7D4REHJ-B6Wu3S0E.js} +1 -1
  7. package/dist/static/assets/{c4Diagram-7LVT6UL2-BPv1wrWr.js → c4Diagram-7LVT6UL2-BY_vvio7.js} +1 -1
  8. package/dist/static/assets/channel-CtrV21Si.js +1 -0
  9. package/dist/static/assets/{chunk-4HAMMTFA-Cs5XliUb.js → chunk-4HAMMTFA-D_sG5o6u.js} +1 -1
  10. package/dist/static/assets/{chunk-75Z2AOVW-Cd6nlpvZ.js → chunk-75Z2AOVW-DsJxH41U.js} +1 -1
  11. package/dist/static/assets/{chunk-DU6HZSFF-BnvO4zOZ.js → chunk-DU6HZSFF-DxnpJ8a5.js} +3 -3
  12. package/dist/static/assets/{chunk-F27PBJKO-CMB1IElo.js → chunk-F27PBJKO-LGjxvf3X.js} +1 -1
  13. package/dist/static/assets/{chunk-GMAD6QVW-CNieSTaM.js → chunk-GMAD6QVW-DClaM1FJ.js} +1 -1
  14. package/dist/static/assets/{chunk-GVQU2GXP-qb0hJ02Q.js → chunk-GVQU2GXP-CKzRk8D0.js} +1 -1
  15. package/dist/static/assets/{chunk-IMKFNOWR-BPSCydYr.js → chunk-IMKFNOWR-alpb_Q1s.js} +1 -1
  16. package/dist/static/assets/{chunk-L3NEJ4N5-B76BZJne.js → chunk-L3NEJ4N5-URTB4ZP9.js} +1 -1
  17. package/dist/static/assets/{chunk-OSK3NFVY-Dybol93i.js → chunk-OSK3NFVY-6FK72keK.js} +1 -1
  18. package/dist/static/assets/{chunk-P2QGCYS3-Bqr50LPc.js → chunk-P2QGCYS3-CYoAORR8.js} +1 -1
  19. package/dist/static/assets/{chunk-POPQ4Y6H-RIZVwKUO.js → chunk-POPQ4Y6H-BFMpc1qG.js} +1 -1
  20. package/dist/static/assets/{chunk-PWAF6VOD-DCWU0SNy.js → chunk-PWAF6VOD-BOGxr7jI.js} +1 -1
  21. package/dist/static/assets/{chunk-SHT3W25Y-DLf6wq7V.js → chunk-SHT3W25Y-F1p19y4E.js} +1 -1
  22. package/dist/static/assets/{chunk-SVP7TREG-BOMRcDWa.js → chunk-SVP7TREG-BRt3xPQC.js} +1 -1
  23. package/dist/static/assets/{chunk-TICWLB2K-DMg-3kqt.js → chunk-TICWLB2K-CZyzj0nm.js} +1 -1
  24. package/dist/static/assets/classDiagram-ZZMXUADV-Cs4jMnMD.js +1 -0
  25. package/dist/static/assets/classDiagram-v2-VYDZK3BY-Cs4jMnMD.js +1 -0
  26. package/dist/static/assets/{cynefin-OW5HDTMX-e85Ocirl.js → cynefin-OW5HDTMX-C4pgg6lA.js} +1 -1
  27. package/dist/static/assets/{cynefinDiagram-5FMLGOSQ-Dlu1oDhp.js → cynefinDiagram-5FMLGOSQ-C1k2ho5Y.js} +1 -1
  28. package/dist/static/assets/{dagre-GXQ25YYZ-UH9F2Av_.js → dagre-GXQ25YYZ-1fK0Epwi.js} +1 -1
  29. package/dist/static/assets/{diagram-S7CK7UJ4-C3jINFSi.js → diagram-S7CK7UJ4-CgxZCXGu.js} +1 -1
  30. package/dist/static/assets/{diagram-UQ7AKVKN-8sGYrbWv.js → diagram-UQ7AKVKN-Tn8pCHjR.js} +1 -1
  31. package/dist/static/assets/{diagram-VSXAHHWV-7iMhjtwF.js → diagram-VSXAHHWV-mb1GnJfz.js} +1 -1
  32. package/dist/static/assets/{diagram-VX7I27RA-BzSVTwmK.js → diagram-VX7I27RA-D1B_dCE4.js} +1 -1
  33. package/dist/static/assets/{diagram-Z3DM3KII-CfsvlUXn.js → diagram-Z3DM3KII-CmRj8vT8.js} +1 -1
  34. package/dist/static/assets/{ebnfDiagram-PWID7BFC-DGen2ygJ.js → ebnfDiagram-PWID7BFC-gq-7KvVE.js} +1 -1
  35. package/dist/static/assets/{erDiagram-RLTQ6QDP-m_6Tsfl4.js → erDiagram-RLTQ6QDP-BXvGsBgG.js} +1 -1
  36. package/dist/static/assets/eventmodeling-NTZA5JFV-CB8XK548.js +1 -0
  37. package/dist/static/assets/flowDiagram-HODETNUW-Cxyddxm3.js +1 -0
  38. package/dist/static/assets/{ganttDiagram-EL5Y4UJY-CSrI73T-.js → ganttDiagram-EL5Y4UJY-BgEGCu52.js} +1 -1
  39. package/dist/static/assets/{gitGraph-4MIJSDKK-C3Q7NSLj.js → gitGraph-4MIJSDKK-DaOCmY-8.js} +1 -1
  40. package/dist/static/assets/{gitGraphDiagram-WWUBYQGX-D3-lD4or.js → gitGraphDiagram-WWUBYQGX-DpKZ3tJT.js} +1 -1
  41. package/dist/static/assets/highlighted-body-KPVGNVTW-DbIXEzyu.js +1 -0
  42. package/dist/static/assets/{index-CLozUzUG.js → index-D5pOAykZ.js} +119 -119
  43. package/dist/static/assets/{index-BvJCeagV.css → index-DA36kK3l.css} +1 -1
  44. package/dist/static/assets/{info-A6RAGUB7-BLfaAWNN.js → info-A6RAGUB7-yZlvERnl.js} +1 -1
  45. package/dist/static/assets/{infoDiagram-27XIBGKW-wuaO5JdT.js → infoDiagram-27XIBGKW-CWRaJA6n.js} +1 -1
  46. package/dist/static/assets/{ishikawaDiagram-5VMMS53U-BSwadanv.js → ishikawaDiagram-5VMMS53U-Cs7N8ZV8.js} +1 -1
  47. package/dist/static/assets/{journeyDiagram-3NMN7TZE-DIawGboo.js → journeyDiagram-3NMN7TZE-DnK6mEUH.js} +1 -1
  48. package/dist/static/assets/{kanban-definition-UXKFOSKX-alQnVmfA.js → kanban-definition-UXKFOSKX-D5XTpG6A.js} +1 -1
  49. package/dist/static/assets/{line-CoEZ7pY8.js → line-C4LgyyoW.js} +1 -1
  50. package/dist/static/assets/mermaid-HWGCJPDP-BGL20-Xw.js +1 -0
  51. package/dist/static/assets/{mermaid-parser.core-DwaeEsxW.js → mermaid-parser.core-B8ilv4YC.js} +3 -3
  52. package/dist/static/assets/{mermaid.core-Dx2f364g.js → mermaid.core-Ctq84vu7.js} +4 -4
  53. package/dist/static/assets/{mindmap-definition-YA3MSWOX-Bqt-vhip.js → mindmap-definition-YA3MSWOX-Bjru-mnm.js} +1 -1
  54. package/dist/static/assets/{packet-AYTQ26CC-CGoF7lCn.js → packet-AYTQ26CC-CoaIWQqL.js} +1 -1
  55. package/dist/static/assets/{pegDiagram-XKGWAZYB-B45v6iJb.js → pegDiagram-XKGWAZYB-CT_V8Nyh.js} +1 -1
  56. package/dist/static/assets/{pie-WAS4IAKB-DQnKhSZt.js → pie-WAS4IAKB-73ICoYV-.js} +1 -1
  57. package/dist/static/assets/{pieDiagram-E7YTZNPT-ZtK_uFuK.js → pieDiagram-E7YTZNPT-BlLBrUxu.js} +1 -1
  58. package/dist/static/assets/{quadrantDiagram-AXDQQJYC-D9dCbmjm.js → quadrantDiagram-AXDQQJYC-i4McPoCf.js} +1 -1
  59. package/dist/static/assets/{radar-RG4KPBEZ-DnWNQrsD.js → radar-RG4KPBEZ-DiFQPx_A.js} +1 -1
  60. package/dist/static/assets/{railroad-74A4TZTK-D6A_uC4M.js → railroad-74A4TZTK-BdTjSbGy.js} +1 -1
  61. package/dist/static/assets/railroad-abnf-HS5TGJTU-kAMSpMUO.js +1 -0
  62. package/dist/static/assets/railroad-ebnf-LZEXJU2U-RcIgwq8-.js +1 -0
  63. package/dist/static/assets/railroad-peg-WCYAUIDC-Bc81vlRu.js +1 -0
  64. package/dist/static/assets/{railroadDiagram-O6MQD6OU-CWrFUTnj.js → railroadDiagram-O6MQD6OU-CmyDyEHp.js} +1 -1
  65. package/dist/static/assets/{requirementDiagram-BXWQKSXE-DWQpTjGQ.js → requirementDiagram-BXWQKSXE-Duf9AdNL.js} +1 -1
  66. package/dist/static/assets/{sankeyDiagram-P5KCCOFB-CyNv93aq.js → sankeyDiagram-P5KCCOFB-NzKEvjXe.js} +1 -1
  67. package/dist/static/assets/{sequenceDiagram-WJ2MYXX4-1kmQigWc.js → sequenceDiagram-WJ2MYXX4-Bq8Vf3FJ.js} +1 -1
  68. package/dist/static/assets/{stateDiagram-D77RDMKH-D9DNolnb.js → stateDiagram-D77RDMKH-DjP1cLwa.js} +1 -1
  69. package/dist/static/assets/stateDiagram-v2-MP3YSRHH-DrcnJVUt.js +1 -0
  70. package/dist/static/assets/{swimlanes-42K2YHIH-6QP5XfBD.js → swimlanes-42K2YHIH-CfxPRqMs.js} +1 -1
  71. package/dist/static/assets/swimlanesDiagram-VR7AAH4N-C4h_-o8z.js +8 -0
  72. package/dist/static/assets/{timeline-definition-24CTP7MA-asnbuK8l.js → timeline-definition-24CTP7MA-BTQ7pOTo.js} +1 -1
  73. package/dist/static/assets/{treeView-Q6P3EWNA-HxICuOs3.js → treeView-Q6P3EWNA-CFH0wEng.js} +1 -1
  74. package/dist/static/assets/{treemap-WGGIJYW6-B_Fdu5uO.js → treemap-WGGIJYW6-ZJs3LatT.js} +1 -1
  75. package/dist/static/assets/{vennDiagram-4TSXK5OY-wjUSLInk.js → vennDiagram-4TSXK5OY-ZZuhKbAY.js} +1 -1
  76. package/dist/static/assets/{wardley-WFR3VGLG-Cz17G6FG.js → wardley-WFR3VGLG-BnWrIzJm.js} +1 -1
  77. package/dist/static/assets/{wardleyDiagram-VM6X3IG4-D9j3fyuh.js → wardleyDiagram-VM6X3IG4-CyG-33Ly.js} +1 -1
  78. package/dist/static/assets/{xychartDiagram-S5SC5T6Z-C_LNMcXz.js → xychartDiagram-S5SC5T6Z-8N1XDalf.js} +1 -1
  79. package/dist/static/index.html +2 -2
  80. package/package.json +1 -1
  81. package/dist/static/assets/CodeMirrorEditor-B8IxFO-y.js +0 -39
  82. package/dist/static/assets/architecture-7GRP2DOG-DC96HK0W.js +0 -1
  83. package/dist/static/assets/channel-D1XUlRp1.js +0 -1
  84. package/dist/static/assets/classDiagram-ZZMXUADV-Dn7Eb_UU.js +0 -1
  85. package/dist/static/assets/classDiagram-v2-VYDZK3BY-Dn7Eb_UU.js +0 -1
  86. package/dist/static/assets/eventmodeling-NTZA5JFV-yhPWdBzI.js +0 -1
  87. package/dist/static/assets/flowDiagram-HODETNUW-D0kXhFOs.js +0 -1
  88. package/dist/static/assets/highlighted-body-KPVGNVTW-BU5h6vcT.js +0 -1
  89. package/dist/static/assets/mermaid-HWGCJPDP-D5wI2wqs.js +0 -1
  90. package/dist/static/assets/railroad-abnf-HS5TGJTU-C95Y8VCi.js +0 -1
  91. package/dist/static/assets/railroad-ebnf-LZEXJU2U-PYig8XtM.js +0 -1
  92. package/dist/static/assets/railroad-peg-WCYAUIDC-sUoCa4KH.js +0 -1
  93. package/dist/static/assets/stateDiagram-v2-MP3YSRHH-CwAFpDqs.js +0 -1
  94. package/dist/static/assets/swimlanesDiagram-VR7AAH4N-TR6blIpH.js +0 -8
package/dist/server.mjs CHANGED
@@ -256,7 +256,7 @@ Expecting one of '${n.join("', '")}'`);if(this._lifeCycleHooks[e])this._lifeCycl
256
256
  `),this.outputHelp({error:!0});let n=t||{},r=n.exitCode||1,i=n.code||"commander.error";this._exit(r,i,e)}_parseOptionsEnv(){this.options.forEach((e)=>{if(e.envVar&&e.envVar in ge.env){let t=e.attributeName();if(this.getOptionValue(t)===void 0||["default","config","env"].includes(this.getOptionValueSource(t)))if(e.required||e.optional)this.emit(`optionEnv:${e.name()}`,ge.env[e.envVar]);else this.emit(`optionEnv:${e.name()}`)}})}_parseOptionsImplied(){let e=new Mh(this.options),t=(n)=>this.getOptionValue(n)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(n));this.options.filter((n)=>n.implied!==void 0&&t(n.attributeName())&&e.valueFromOption(this.getOptionValue(n.attributeName()),n)).forEach((n)=>{Object.keys(n.implied).filter((r)=>!t(r)).forEach((r)=>{this.setOptionValueWithSource(r,n.implied[r],"implied")})})}missingArgument(e){let t=`error: missing required argument '${e}'`;this.error(t,{code:"commander.missingArgument"})}optionMissingArgument(e){let t=`error: option '${e.flags}' argument missing`;this.error(t,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(e){let t=`error: required option '${e.flags}' not specified`;this.error(t,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(e,t){let n=(o)=>{let s=o.attributeName(),a=this.getOptionValue(s),c=this.options.find((u)=>u.negate&&s===u.attributeName()),d=this.options.find((u)=>!u.negate&&s===u.attributeName());if(c&&(c.presetArg===void 0&&a===!1||c.presetArg!==void 0&&a===c.presetArg))return c;return d||o},r=(o)=>{let s=n(o),a=s.attributeName();if(this.getOptionValueSource(a)==="env")return`environment variable '${s.envVar}'`;return`option '${s.flags}'`},i=`error: ${r(e)} cannot be used with ${r(t)}`;this.error(i,{code:"commander.conflictingOption"})}unknownOption(e){if(this._allowUnknownOption)return;let t="";if(e.startsWith("--")&&this._showSuggestionAfterError){let r=[],i=this;do{let o=i.createHelp().visibleOptions(i).filter((s)=>s.long).map((s)=>s.long);r=r.concat(o),i=i.parent}while(i&&!i._enablePositionalOptions);t=Bh(e,r)}let n=`error: unknown option '${e}'${t}`;this.error(n,{code:"commander.unknownOption"})}_excessArguments(e){if(this._allowExcessArguments)return;let t=this.registeredArguments.length,n=t===1?"":"s",r=e.length,i=this.parent?` for '${this.name()}'`:"",o=e.join(", "),s=`error: too many arguments${i}. Expected ${t} argument${n} but got ${r}: ${o}.`;this.error(s,{code:"commander.excessArguments"})}unknownCommand(){let e=this.args[0],t="";if(this._showSuggestionAfterError){let r=[];this.createHelp().visibleCommands(this).forEach((i)=>{if(r.push(i.name()),i.alias())r.push(i.alias())}),t=Bh(e,r)}let n=`error: unknown command '${e}'${t}`;this.error(n,{code:"commander.unknownCommand"})}version(e,t,n){if(e===void 0)return this._version;this._version=e,t=t||"-V, --version",n=n||"output the version number";let r=this.createOption(t,n);return this._versionOptionName=r.attributeName(),this._registerOption(r),this.on("option:"+r.name(),()=>{this._outputConfiguration.writeOut(`${e}
257
257
  `),this._exit(0,"commander.version",e)}),this}description(e,t){if(e===void 0&&t===void 0)return this._description;if(this._description=e,t)this._argsDescription=t;return this}summary(e){if(e===void 0)return this._summary;return this._summary=e,this}alias(e){if(e===void 0)return this._aliases[0];let t=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler)t=this.commands[this.commands.length-1];if(e===t._name)throw Error("Command alias can't be the same as its name");let n=this.parent?._findCommand(e);if(n){let r=[n.name()].concat(n.aliases()).join("|");throw Error(`cannot add alias '${e}' to command '${this.name()}' as already have command '${r}'`)}return t._aliases.push(e),this}aliases(e){if(e===void 0)return this._aliases;return e.forEach((t)=>this.alias(t)),this}usage(e){if(e===void 0){if(this._usage)return this._usage;let t=this.registeredArguments.map((n)=>gu(n));return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?t:[]).join(" ")}return this._usage=e,this}name(e){if(e===void 0)return this._name;return this._name=e,this}helpGroup(e){if(e===void 0)return this._helpGroupHeading??"";return this._helpGroupHeading=e,this}commandsGroup(e){if(e===void 0)return this._defaultCommandGroup??"";return this._defaultCommandGroup=e,this}optionsGroup(e){if(e===void 0)return this._defaultOptionGroup??"";return this._defaultOptionGroup=e,this}_initOptionGroup(e){if(this._defaultOptionGroup&&!e.helpGroupHeading)e.helpGroup(this._defaultOptionGroup)}_initCommandGroup(e){if(this._defaultCommandGroup&&!e.helpGroup())e.helpGroup(this._defaultCommandGroup)}nameFromFilename(e){return this._name=$n.basename(e,$n.extname(e)),this}executableDir(e){if(e===void 0)return this._executableDir;return this._executableDir=e,this}helpInformation(e){let t=this.createHelp(),n=this._getOutputContext(e);t.prepareContext({error:n.error,helpWidth:n.helpWidth,outputHasColors:n.hasColors});let r=t.formatHelp(this,t);if(n.hasColors)return r;return this._outputConfiguration.stripColor(r)}_getOutputContext(e){e=e||{};let t=!!e.error,n,r,i;if(t)n=(s)=>this._outputConfiguration.writeErr(s),r=this._outputConfiguration.getErrHasColors(),i=this._outputConfiguration.getErrHelpWidth();else n=(s)=>this._outputConfiguration.writeOut(s),r=this._outputConfiguration.getOutHasColors(),i=this._outputConfiguration.getOutHelpWidth();return{error:t,write:(s)=>{if(!r)s=this._outputConfiguration.stripColor(s);return n(s)},hasColors:r,helpWidth:i}}outputHelp(e){let t;if(typeof e==="function")t=e,e=void 0;let n=this._getOutputContext(e),r={error:n.error,write:n.write,command:this};this._getCommandAndAncestors().reverse().forEach((o)=>o.emit("beforeAllHelp",r)),this.emit("beforeHelp",r);let i=this.helpInformation({error:n.error});if(t){if(i=t(i),typeof i!=="string"&&!Buffer.isBuffer(i))throw Error("outputHelp callback must return a string or a Buffer")}if(n.write(i),this._getHelpOption()?.long)this.emit(this._getHelpOption().long);this.emit("afterHelp",r),this._getCommandAndAncestors().forEach((o)=>o.emit("afterAllHelp",r))}helpOption(e,t){if(typeof e==="boolean"){if(e){if(this._helpOption===null)this._helpOption=void 0;if(this._defaultOptionGroup)this._initOptionGroup(this._getHelpOption())}else this._helpOption=null;return this}if(this._helpOption=this.createOption(e??"-h, --help",t??"display help for command"),e||t)this._initOptionGroup(this._helpOption);return this}_getHelpOption(){if(this._helpOption===void 0)this.helpOption(void 0,void 0);return this._helpOption}addHelpOption(e){return this._helpOption=e,this._initOptionGroup(e),this}help(e){this.outputHelp(e);let t=Number(ge.exitCode??0);if(t===0&&e&&typeof e!=="function"&&e.error)t=1;this._exit(t,"commander.help","(outputHelp)")}addHelpText(e,t){let n=["beforeAll","before","after","afterAll"];if(!n.includes(e))throw Error(`Unexpected value for position to addHelpText.
258
258
  Expecting one of '${n.join("', '")}'`);let r=`${e}Help`;return this.on(r,(i)=>{let o;if(typeof t==="function")o=t({error:i.error,command:i.command});else o=t;if(o)i.write(`${o}
259
- `)}),this}_outputHelpIfRequested(e){let t=this._getHelpOption();if(t&&e.find((r)=>t.is(r)))this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)")}}function U2(e){return e.map((t)=>{if(!t.startsWith("--inspect"))return t;let n,r="127.0.0.1",i="9229",o;if((o=t.match(/^(--inspect(-brk)?)$/))!==null)n=o[1];else if((o=t.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null)if(n=o[1],/^\d+$/.test(o[3]))i=o[3];else r=o[3];else if((o=t.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null)n=o[1],r=o[3],i=o[4];if(n&&i!=="0")return`${n}=${r}:${parseInt(i)+1}`;return t})}function k2(){if(ge.env.NO_COLOR||ge.env.FORCE_COLOR==="0"||ge.env.FORCE_COLOR==="false")return!1;if(ge.env.FORCE_COLOR||ge.env.CLICOLOR_FORCE!==void 0)return!0;return}var Dhe=new io;var Xs={name:"@rainmanhhh/pi-web",version:"0.16.6",description:"Web UI for the pi coding agent (fork of @agegr/pi-web)",homepage:"https://gitee.com/dsxbygzzl/pi-web#readme",repository:{type:"git",url:"git+https://gitee.com/dsxbygzzl/pi-web.git"},bugs:{url:"https://gitee.com/dsxbygzzl/pi-web/issues"},author:"rainmanhhh",license:"MIT",publishConfig:{access:"public",registry:"https://registry.npmjs.org"},engines:{node:">=24.0.0"},files:["dist","public","extensions","package.json"],bin:{"pi-web":"dist/server.mjs"},scripts:{dev:"vite","dev:lan":"vite --host 0.0.0.0",mb:"bun run --env-file=.env.manual api",mf:"bun run --env-file=.env.manual dev -- --port 3001",api:"bun run server/main.ts","api:node":"bun run build:server && node dist/server.mjs","build:server":'bun build server/main.ts --target node --outfile dist/server.mjs --minify --external "@earendil-works/*" --define "process.env.PI_WEB_PACKAGED=1"',"e2e:stop":"bun run scripts/e2e-stop.mjs","e2e:prepare":"bun run scripts/e2e-prepare.mjs",build:"vite build && bun run scripts/prune-fonts.mjs","build:analyze":"vite build --config scripts/analyze-bundle.config.ts && bun run scripts/prune-fonts.mjs",lint:"oxlint --fix",fta:"bun scripts/fta-gate.mjs . --output-limit 15",jscpd:"jscpd --config .jscpd.json",check:"tsc --noEmit",format:"biome check --write .",prepublishOnly:"bun run check && bun run build && bun run build:server","test:e2e":"cross-env CODEBUDDY_SAFE_DELETE_ENABLED=0 bun run e2e:stop && playwright test","test:unit":"vitest run","test:unit:bun":"bun --bun run test:unit",prepare:"husky || true"},dependencies:{"@codemirror/commands":"^6.11.0","@codemirror/lang-css":"^6.3.1","@codemirror/lang-html":"^6.4.12","@codemirror/lang-javascript":"^6.2.5","@codemirror/lang-json":"^6.0.2","@codemirror/lang-markdown":"^6.5.2","@codemirror/lang-yaml":"^6.1.3","@codemirror/language":"^6.12.4","@codemirror/state":"^6.7.1","@codemirror/theme-one-dark":"^6.1.3","@codemirror/view":"^6.43.9","@earendil-works/pi-agent-core":"0.87.0","@earendil-works/pi-ai":"0.87.0","@earendil-works/pi-coding-agent":"0.87.0","@earendil-works/pi-tui":"0.87.0","@hono/node-server":"^2.1.1","class-variance-authority":"^0.7.1",clsx:"^2.1.1",codemirror:"^6.0.2",hono:"^4.13.5","lucide-react":"^1.37.0","p-defer":"^4.0.1",pointrix:"^1.1.0","proper-lockfile":"4.1.2","radix-ui":"^1.6.7",react:"^19.2.8","react-dom":"^19.2.8",shadcn:"^4.19.0",streamdown:"2.6.0","tailwind-merge":"^3.6.0","tw-animate-css":"^1.4.0",virtua:"^0.50.6",ws:"^8.21.3"},devDependencies:{"@biomejs/biome":"^2.5.13","@lobehub/icons":"^5.16.0","@playwright/test":"^1.62.1","@tailwindcss/postcss":"^4.3.3","@testing-library/dom":"^10.4.1","@testing-library/react":"^16.3.3","@types/node":"^25.9.5","@types/proper-lockfile":"4.1.4","@types/react":"^19.2.18","@types/react-dom":"^19.2.5","@types/react-resizable":"^4.0.0","@types/react-syntax-highlighter":"^15.5.13","@types/ws":"^8.18.1","@vitejs/plugin-react":"^6.1.1",commander:"^15.0.0","cross-env":"^10.1.0","fta-cli":"^3.0.1",husky:"^9.1.7",jiti:"^2.7.0",jscpd:"^5.1.0",jsdom:"^30.0.1",katex:"^0.18.4","lint-staged":"^17.4.1",mammoth:"^1.12.2",mermaid:"^11.17.2",oxlint:"^1.80.0",postcss:"^8.5.26","react-markdown":"^10.1.0","react-syntax-highlighter":"^16.1.1","rehype-katex":"^7.0.1","rehype-raw":"^7.0.0","rehype-sanitize":"^6.0.0","remark-gfm":"^4.0.1","remark-math":"^6.0.0",tailwindcss:"^4.3.3",typescript:"^7.0.2",vite:"^8.2.2","vite-plugin-remove-console":"^2.2.0","vite-plugin-svgr":"^5.2.0",vitest:"^4.1.11"},type:"module",overrides:{katex:"^0.18.4"}};var Lh=!1,R2=performance.now();function F2(e){if(Lh=e,R2=performance.now(),Lh)Nt("boot","debug log enabled")}function Tt(e){return(t,n)=>Nt(e,t,n)}function Nt(e,t,n){if(!Lh)return;let r=performance.now()-R2,i=new Date,o=(a,c=2)=>String(a).padStart(c,"0"),s=`${o(i.getHours())}:${o(i.getMinutes())}:${o(i.getSeconds())}.${o(i.getMilliseconds(),3)}`;console.debug(`[debug][${e}][${s}][+${r.toFixed(1)}ms] ${t}${n?` — ${n}`:""}`)}import{existsSync as u5,mkdirSync as l5,readFileSync as z2,writeFileSync as d5}from"node:fs";import{dirname as f5,join as V2}from"node:path";import{getAgentDir as X2}from"@earendil-works/pi-coding-agent";var I2=[{label:{en:"Explore project","zh-CN":"阅读项目"},message:{en:"Explore the current project and summarize the overall directory structure and responsibilities of core modules.","zh-CN":"阅读当前项目,总结整体目录结构与核心模块的职责。"}},{label:{en:"Review workspace changes","zh-CN":"审查工作区改动"},message:{en:"Review all changes in the current workspace, point out potential issues and improvements.","zh-CN":"审查当前工作区的所有改动,指出潜在问题与改进点。"}},{label:{en:"Find and fix bugs","zh-CN":"寻找并修复bug"},message:{en:"Inspect the current codebase, find and fix existing bugs.","zh-CN":"检查当前代码,寻找并修复其中存在的 bug。"}}];var M2=I2;import{readFileSync as L2,writeFileSync as s5}from"node:fs";import{join as a5}from"node:path";import{getAgentDir as c5}from"@earendil-works/pi-coding-agent";var bu=["off","minimal","low","medium","high","xhigh","max"];function vu(e){return e==="en"||e==="zh-CN"?e:void 0}function qh(e){return e==="dark"||e==="light"?e:void 0}function xu(e){return typeof e==="string"&&bu.includes(e)?e:void 0}function $h(e){if(typeof e!=="object"||e===null)return;let t=e;if(typeof t.enabled!=="boolean")return;if(typeof t.reserveTokens!=="number"||!Number.isInteger(t.reserveTokens)||t.reserveTokens<=0)return;if(typeof t.keepRecentTokens!=="number"||!Number.isInteger(t.keepRecentTokens)||t.keepRecentTokens<=0)return;return{enabled:t.enabled,reserveTokens:t.reserveTokens,keepRecentTokens:t.keepRecentTokens}}function o5(e){if(typeof e!=="object"||e===null)return;let t=e,n={};if(typeof t.timeoutMs==="number"&&Number.isInteger(t.timeoutMs)&&t.timeoutMs>0)n.timeoutMs=t.timeoutMs;if(typeof t.maxRetries==="number"&&Number.isInteger(t.maxRetries)&&t.maxRetries>0)n.maxRetries=t.maxRetries;if(typeof t.maxRetryDelayMs==="number"&&Number.isInteger(t.maxRetryDelayMs)&&t.maxRetryDelayMs>0)n.maxRetryDelayMs=t.maxRetryDelayMs;return Object.keys(n).length>0?n:void 0}function Hh(e){if(typeof e!=="object"||e===null)return;let t=e;if(typeof t.maxRetries!=="number"||!Number.isInteger(t.maxRetries)||t.maxRetries<=0)return;if(typeof t.baseDelayMs!=="number"||!Number.isInteger(t.baseDelayMs)||t.baseDelayMs<=0)return;let n={maxRetries:t.maxRetries,baseDelayMs:t.baseDelayMs};if(typeof t.enabled==="boolean")n.enabled=t.enabled;let r=o5(t.provider);if(r!==void 0)n.provider=r;return n}function wu(e){if(e==="ask"||e==="always"||e==="never")return e;if(e==="trust")return"always";if(e==="deny")return"never";return}function _u(e){if(typeof e!=="object"||e===null)return;let t=e,n={};if(typeof t.defaultModel==="string"&&t.defaultModel.trim()!=="")n.defaultModel=t.defaultModel;let r=xu(t.defaultThinking);if(r!==void 0)n.defaultThinking=r;return Object.keys(n).length>0?n:void 0}function Du(e){return typeof e==="number"&&Number.isFinite(e)&&e>=0.85&&e<=1.3?e:void 0}var Ks=(e)=>typeof e==="boolean"?e:void 0,jh=(e)=>typeof e==="number"&&Number.isInteger(e)&&e>0?e:void 0,B2=(e)=>typeof e==="string"&&e.trim()!==""?e:void 0;function N2(e,t){if(typeof e!=="object"||e===null)return;let n=e,r={};for(let[i,o]of Object.entries(t)){let s=o(n[i]);if(s!==void 0)r[i]=s}return Object.keys(r).length>0?r:void 0}var Gh=[{key:"httpProxy",validate:B2},{key:"httpIdleTimeoutMs",validate:jh},{key:"websocketConnectTimeoutMs",validate:jh},{key:"enableAnalytics",validate:Ks},{key:"enableInstallTelemetry",validate:Ks},{key:"trackingId",validate:B2},{key:"branchSummary",validate:(e)=>N2(e,{reserveTokens:jh,skipPrompt:Ks})},{key:"images",validate:(e)=>N2(e,{autoResize:Ks,blockImages:Ks})}];function zh(e){return $h(oo("compaction",e))}function W2(e,t){let n=$h(e);if(!n)return zh(t);return Zs("compaction",n,t),n}function Vh(e){return Hh(oo("retry",e))}function j2(e,t){let n=Hh(e);if(!n)return Vh(t);return Zs("retry",n,t),n}function Xh(e){return _u(oo("subagents",e))}function q2(e,t){let n=_u(e);if(n===void 0)return;let r=oo("subagents",t),i=typeof r==="object"&&r!==null?{...r}:{};if(n.defaultModel!==void 0)i.defaultModel=n.defaultModel;else delete i.defaultModel;if(n.defaultThinking!==void 0)i.defaultThinking=n.defaultThinking;else delete i.defaultThinking;return Zs("subagents",i,t),_u(i)}function oo(e,t){try{return JSON.parse(L2($2(t),"utf8"))[e]}catch{return}}function Zs(e,t,n){try{let r=$2(n),i={};try{i=JSON.parse(L2(r,"utf8"))}catch{i={}}i[e]=t,s5(r,JSON.stringify(i,null,2),"utf8")}catch{}}function so(e,t){let n=oo(e,t);return typeof n==="string"?n:void 0}function Eu(e,t,n){if(t===void 0)return so(e,n);return Zs(e,t,n),t}function $2(e){return a5(e??c5(),"settings.json")}function Ys(e){return qh(so("theme",e))??"light"}function H2(e,t){let n=qh(e);if(!n)return Ys(t);return Eu("theme",n,t),n}function Su(e){let t={};for(let{key:n,validate:r}of Gh){let i=r(oo(n,e));if(i!==void 0)t[n]=i}return Object.keys(t).length>0?t:void 0}function G2(e,t){for(let{key:n,validate:r}of Gh){if(!(n in e))continue;let i=r(e[n]);if(i===void 0)continue;Zs(n,i,t)}return Su(t)}var Tu=new Map;function Kh(e){return V2(e??X2(),"pi-web","config.json")}function h5(e){return V2(e??X2(),"pi-web-preferences.json")}function Zh(e){try{if(u5(Kh(e)))return;let t=JSON.parse(z2(h5(e),"utf8"));Yh({firstPaint:{locale:vu(t.firstPaint?.locale),fontScale:Du(t.firstPaint?.fontScale)},preferences:t.preferences??{}},e)}catch{}}function p5(e){let t=xu(so("defaultThinkingLevel",e)),n=zh(e),r=Vh(e),i=wu(so("defaultProjectTrust",e)),o=Xh(e),s=Su(e);return{theme:Ys(e),...t!==void 0?{defaultThinkingLevel:t}:{},...n!==void 0?{compaction:n}:{},...r!==void 0?{retry:r}:{},...i!==void 0?{defaultProjectTrust:i}:{},...o!==void 0?{subagents:o}:{},...s!==void 0?{piSettings:s}:{}}}function Hn(e){let t=e===void 0,n=e??"",r=t?Tu.get(n):void 0;if(!t||r===void 0||r===null)try{let i=z2(Kh(e),"utf8"),o=JSON.parse(i);r={firstPaint:{locale:vu(o.firstPaint?.locale),fontScale:Du(o.firstPaint?.fontScale)},preferences:o.preferences??{},theme:Ys(e)},Tu.set(n,r)}catch{if(r={firstPaint:{},preferences:{},theme:Ys(e)},t)Tu.set(n,r)}return{...r,...p5(e)}}function Yh(e,t){try{let n=Kh(t);l5(f5(n),{recursive:!0});let r={firstPaint:e.firstPaint,preferences:e.preferences};if(d5(n,JSON.stringify(r,null,2),"utf8"),t===void 0)Tu.set("",e)}catch{}}function g5(e,t){return{...e,...t.locale!==void 0?{locale:vu(t.locale)??e.locale}:{},...t.fontScale!==void 0?{fontScale:Du(t.fontScale)??e.fontScale}:{}}}function m5(e,t){if(e===void 0)return wu(so("defaultProjectTrust",t));let n=wu(e);if(n===void 0)return;return Eu("defaultProjectTrust",n,t),n}function Jh(e,t){let n=Hn(t),r=g5(n.firstPaint,e),i=n.theme;if(e.theme!==void 0)i=H2(e.theme,t);let o=Eu("defaultThinkingLevel",xu(e.defaultThinkingLevel),t),s=W2(e.compaction,t),a=j2(e.retry,t),c=m5(e.defaultProjectTrust,t),d=e.subagents===void 0?Xh(t):q2(e.subagents,t),u=e.piSettings===void 0?Su(t):G2(e.piSettings,t),f={firstPaint:r,preferences:n.preferences,theme:i,defaultThinkingLevel:o,...s!==void 0?{compaction:s}:{},...a!==void 0?{retry:a}:{},...c!==void 0?{defaultProjectTrust:c}:{},...d!==void 0?{subagents:d}:{},...u!==void 0?{piSettings:u}:{}};return Yh(f,t),f}function Cu(e,t){let n=Hn(t),r={firstPaint:n.firstPaint,preferences:{...n.preferences,...e},theme:n.theme};return Yh(r,t),r}function Qh(e){let{preferences:t}=Hn(e);if(t.startScreenMessages!==void 0)return;Cu({startScreenMessages:M2},e)}import{DefaultResourceLoader as k5,getAgentDir as t1}from"@earendil-works/pi-coding-agent";import{hasTrustRequiringProjectResources as y5,ProjectTrustStore as ep}from"@earendil-works/pi-coding-agent";function ct(e,t){if(!(Boolean(e)&&y5(e)))return{requiresTrust:!1,trusted:!0};return{requiresTrust:!0,trusted:new ep(t).get(e)===!0}}function K2(e,t){let n=ct(e,t);if(!n.requiresTrust)return n;return new ep(t).set(e,!0),{requiresTrust:!0,trusted:!0}}function ao(e,t){if(!ct(e,t).requiresTrust)return;let r=new ep(t);return{resolveProjectTrust:async()=>r.get(e)===!0}}import{existsSync as b5,readFileSync as v5}from"node:fs";import{homedir as x5}from"node:os";import{isAbsolute as w5,join as Js,relative as _5,resolve as Z2,sep as D5}from"node:path";function E5({homeDir:e=x5(),xdgStateHome:t=process.env.XDG_STATE_HOME}={}){return t?Js(t,"skills",".skill-lock.json"):Js(e,".agents",".skill-lock.json")}function Y2(e){try{let t=JSON.parse(v5(e,"utf8"));return t.skills&&typeof t.skills==="object"?t.skills:{}}catch{return{}}}function J2(e,t){let n=_5(Z2(t),Z2(e));return n!==""&&n!==".."&&!n.startsWith(`..${D5}`)&&!w5(n)}function S5(e,t){if(e[t])return e[t];let n=t.toLowerCase(),r=Object.keys(e).find((i)=>i.toLowerCase()===n);return r?e[r]:void 0}function T5(e,t){if(t!=="github")return e.replace(/\/$/,"");return e.replace(/^git\+/,"").replace(/^https?:\/\/github\.com\//,"").replace(/^git@github\.com:/,"").replace(/\.git$/,"").replace(/\/$/,"")}function C5(e,t){if(!e||e.includes("://")||e.startsWith("git@"))return;let n=e.split("/").filter(Boolean).map(encodeURIComponent).join("/");if(!n)return;return`https://skills.sh/${n}/${encodeURIComponent(t)}`}function A5(e,t){let n=typeof e.sourceType==="string"?e.sourceType:void 0,r=T5(e.source.trim(),n),i=typeof e.skillPath==="string"?e.skillPath:void 0,o=typeof e.ref==="string"?e.ref:void 0,s=t==="global"?e.skillFolderHash:e.computedHash;return{sourceType:n,source:r,skillPath:i,ref:o,versionHash:typeof s==="string"&&s?s:void 0}}function U5(e,t){let{sourceType:n,source:r,skillPath:i,versionHash:o,ref:s}=e,a=n==="github"&&/^[\w.-]+\/[\w.-]+$/.test(r);return Boolean(a&&i&&o&&(t==="global"||!s))}function Q2(e,t,n){let r=S5(e,t);if(!r||typeof r.source!=="string"||!r.source.trim())return;let{sourceType:i,source:o,skillPath:s,ref:a,versionHash:c}=A5(r,n);if(!o)return;return{package:`${o}@${t}`,scope:n,source:o,sourceType:i,skillsShUrl:i==="local"?void 0:C5(o,t),...s&&{skillPath:s},...a&&{ref:a},...c&&{versionHash:c},canCheckForUpdates:U5({sourceType:i,source:o,skillPath:s,versionHash:c,ref:a},n)}}function e1(e,{cwd:t,agentDir:n,globalLockPath:r=E5(),projectLockPath:i=Js(t,"skills-lock.json")}){let o=Y2(r),s=Y2(i),a=Js(n,"skills"),c=Js(t,".pi","skills");return e.map((d)=>{if(!b5(d.filePath))return d;let u=J2(d.filePath,a)?Q2(o,d.name,"global"):J2(d.filePath,c)?Q2(s,d.name,"project"):void 0;return u?{...d,install:u}:d})}var R5=32,di=new Map,tp=new Map;async function sn(e,t){let n=t?.forceFresh??!1,r=e===""?t1():e;if(!n){let s=di.get(e);if(s)return{skills:[...s.skills.values()],diagnostics:s.diagnostics,projectResourcesLoaded:s.projectResourcesLoaded}}let i=tp.get(e);if(i)return i;let o=F5(r,e);tp.set(e,o);try{return await o}finally{tp.delete(e)}}async function F5(e,t){let n=t1(),r=new k5({cwd:e,agentDir:n});await r.reload(ao(e,n));let{skills:i,diagnostics:o}=r.getSkills(),s={skills:e1(i,{cwd:e,agentDir:n}),diagnostics:o,projectResourcesLoaded:ct(e,n).trusted},a=new Map;for(let c of s.skills)a.set(c.filePath,c);return di.set(t,{skills:a,diagnostics:s.diagnostics,projectResourcesLoaded:s.projectResourcesLoaded,loadedAt:Date.now()}),P5(),s}function P5(){while(di.size>R5){let e=null,t=1/0;for(let[n,r]of di){if(n==="")continue;if(r.loadedAt<t)t=r.loadedAt,e=n}if(e===null)break;di.delete(e)}}function n1(e,t,n){let r=di.get(e);if(!r)return;let i=r.skills.get(t);if(!i){di.delete(e);return}if(n.disableModelInvocation!==void 0)i.disableModelInvocation=n.disableModelInvocation}var Au=null;function r1(e){if(Au)return;let t=(async()=>{for(let n of e)await Promise.allSettled([n()])})();Au=t,t.then(()=>{Au=null})}function vn(){return Au??Promise.resolve()}var i1={port:31415};import{getAgentDir as Ple}from"@earendil-works/pi-coding-agent";var np=(e,t,n)=>(r,i)=>{let o=-1;return s(0);async function s(a){if(a<=o)throw Error("next() called multiple times");o=a;let c,d=!1,u;if(e[a])u=e[a][0][0],r.req.routeIndex=a;else u=a===e.length&&i||void 0;if(u)try{c=await u(r,()=>s(a+1))}catch(f){if(f instanceof Error&&t)r.error=f,c=await t(f,r),d=!0;else throw f}else if(r.finalized===!1&&n)c=await n(r);if(c&&(r.finalized===!1||d))r.res=c;return r}};var o1=Symbol();var s1=(e,t)=>new Response(e,{headers:{"Content-Type":t.replace(/^[^;]+/,(r)=>r.toLowerCase())}}).formData();var a1=32,O5=1e4,Uu=(e)=>("headers"in e),l1=async(e,t=Object.create(null))=>{let{all:n=!1,dot:r=!1}=t,s=(Uu(e)?e.headers:e.raw.headers).get("Content-Type")?.split(";")[0].trim().toLowerCase();if(s==="multipart/form-data"||s==="application/x-www-form-urlencoded")return I5(e,{all:n,dot:r});return{}};async function I5(e,t){if(!Uu(e)&&e.bodyCache.formData)return c1(await e.bodyCache.formData,t);let n=Uu(e)?e.headers:e.raw.headers,r=await e.arrayBuffer(),i=s1(r,n.get("Content-Type")||"");if(!Uu(e))e.bodyCache.formData=i;let o=await i;if(o)return c1(o,t);return{}}function c1(e,t){let n=Object.create(null),r={count:0};if(e.forEach((i,o)=>{if(!(t.all||o.endsWith("[]")))n[o]=i;else M5(n,o,i)}),t.dot)Object.entries(n).forEach(([i,o])=>{if(i.includes("."))B5(n,i,o,r),delete n[i]});return n}var M5=(e,t,n)=>{if(e[t]!==void 0)if(Array.isArray(e[t]))e[t].push(n);else e[t]=[e[t],n];else if(!t.endsWith("[]"))e[t]=n;else e[t]=[n]},B5=(e,t,n,r)=>{if(/(?:^|\.)__proto__\./.test(t))return;let i=e,o=t.split(".",a1+2);if(o.length>a1+1)u1();o.forEach((s,a)=>{if(a===o.length-1)i[s]=n;else{if(!i[s]||typeof i[s]!=="object"||Array.isArray(i[s])||i[s]instanceof File){if(r.count++>=O5)u1();i[s]=Object.create(null)}i=i[s]}})},u1=()=>{throw Error("Nesting limit exceeded")};fi();var b1=class{raw;#e;#t;routeIndex=0;path;bodyCache={};constructor(e,t="/",n=[[]]){this.raw=e,this.path=t,this.#t=n}param(e){return e?this.#n(e):this.#o()}#n(e){let t=this.#t[0][this.routeIndex]?.[1][e],n=this.#i(t);return n&&Fu(n)}#o(){let e={},t=Object.keys(this.#t[0][this.routeIndex]?.[1]??{});for(let n of t){let r=this.#i(this.#t[0][this.routeIndex][1][n]);if(r!==void 0)e[n]=Fu(r)}return e}#i(e){return this.#t[1]?this.#t[1][e]:e}query(e){return m1(this.url,e)}queries(e){return y1(this.url,e)}header(e){if(e)return this.raw.headers.get(e)??void 0;let t=Object.create(null);return this.raw.headers.forEach((n,r)=>{t[r]=n}),t}async parseBody(e){return l1(this,e)}#r=(e)=>{let{bodyCache:t,raw:n}=this,r=t[e];if(r)return r;for(let i in t)return t[i].then((o)=>{if(i==="json")o=JSON.stringify(o);return new Response(o)[e]()});return t[e]=n[e]()};json(){return this.#r("text").then((e)=>JSON.parse(e))}text(){return this.#r("text")}arrayBuffer(){return this.#r("arrayBuffer")}bytes(){return this.#r("arrayBuffer").then((e)=>new Uint8Array(e))}blob(){return this.#r("blob")}formData(){return this.#r("formData")}addValidatedData(e,t){(this.#e??={})[e]=t}valid(e){return this.#e?.[e]}get url(){return this.raw.url}get method(){return this.raw.method}get[o1](){return this.#t}get matchedRoutes(){return this.#t[0].map(([[,e]])=>e)}get routePath(){return this.#t[0].map(([[,e]])=>e)[this.routeIndex].path}};cp();var j5="text/plain; charset=UTF-8",up=(e,t)=>({"Content-Type":e,...t}),Qs=(e,t)=>new Response(e,t),lp=class{#e;#t;env={};#n;finalized=!1;error;#o;#i;#r;#c;#s;#a;#l;#d;#f;constructor(e,t){if(this.#e=e,t)this.#i=t.executionCtx,this.env=t.env,this.#a=t.notFoundHandler,this.#f=t.path,this.#d=t.matchResult}get req(){return this.#t??=new b1(this.#e,this.#f,this.#d),this.#t}get event(){if(this.#i&&"respondWith"in this.#i)return this.#i;else throw Error("This context has no FetchEvent")}get executionCtx(){if(this.#i)return this.#i;else throw Error("This context has no ExecutionContext")}get res(){return this.#r||=Qs(null,{headers:this.#l??=new Headers})}set res(e){if(this.#r&&e){e=Qs(e.body,e);for(let[t,n]of this.#r.headers.entries()){if(t==="content-type")continue;if(t==="set-cookie"){let r=this.#r.headers.getSetCookie();e.headers.delete("set-cookie");for(let i of r)e.headers.append("set-cookie",i)}else e.headers.set(t,n)}}this.#r=e,this.finalized=!0}render=(...e)=>(this.#s??=(t)=>this.html(t),this.#s(...e));setLayout=(e)=>this.#c=e;getLayout=()=>this.#c;setRenderer=(e)=>{this.#s=e};header=(e,t,n)=>{if(this.finalized)this.#r=Qs(this.#r.body,this.#r);let r=this.#r?this.#r.headers:this.#l??=new Headers;if(t===void 0)r.delete(e);else if(n?.append)r.append(e,t);else r.set(e,t)};status=(e)=>{this.#o=e};set=(e,t)=>{this.#n??=new Map,this.#n.set(e,t)};get=(e)=>this.#n?this.#n.get(e):void 0;get var(){if(!this.#n)return{};return Object.fromEntries(this.#n)}#u(e,t,n){let r=this.#r?new Headers(this.#r.headers):this.#l;if(typeof t==="object"&&t.headers){r??=new Headers;for(let[o,s]of new Headers(t.headers))if(o==="set-cookie")r.append(o,s);else r.set(o,s)}if(n){if(!r){let o=0;for(let s in n)if(++o>1||typeof n[s]!=="string"){r=new Headers;break}}if(r)for(let o in n){let s=n[o];if(typeof s==="string")r.set(o,s);else{r.delete(o);for(let a of s)r.append(o,a)}}}let i=typeof t==="number"?t:t?.status??this.#o;return Qs(e,{status:i,headers:r??n})}newResponse=(...e)=>this.#u(...e);body=(e,t,n)=>this.#u(e,t,n);text=(e,t,n)=>!this.#l&&!this.#o&&!t&&!n&&!this.finalized?new Response(e):this.#u(e,t,up(j5,n));json=(e,t,n)=>this.#u(JSON.stringify(e),t,up("application/json",n));html=(e,t,n)=>{let r=(i)=>this.#u(i,t,up("text/html; charset=UTF-8",n));return typeof e==="object"?ap(e,v1.Stringify,!1,{}).then(r):r(e)};redirect=(e,t)=>{let n=String(e);return this.header("Location",!/[^\x00-\xFF]/.test(n)?n:encodeURI(n)),this.newResponse(null,t??302)};notFound=()=>(this.#a??=()=>Qs(),this.#a(this))};wr();dp();fi();var q5=(e)=>e.text("404 Not Found",404),D1=(e,t)=>{if("getResponse"in e){let n=e.getResponse();return t.newResponse(n.body,n)}return console.error(e),t.text("Internal Server Error",500)},E1=class e{get;post;put;delete;options;patch;query;all;on;use;router;getPath;_basePath="/";#e="/";routes=[];constructor(t={}){[..._1,w1].forEach((o)=>{this[o]=(s,...a)=>{if(typeof s==="string")this.#e=s;else this.#o(o,this.#e,s);return a.forEach((c)=>{this.#o(o,this.#e,c)}),this}}),this.on=(o,s,...a)=>{for(let c of[s].flat()){this.#e=c;for(let d of[o].flat())a.map((u)=>{this.#o(d.toUpperCase(),this.#e,u)})}return this},this.use=(o,...s)=>{if(typeof o==="string")this.#e=o;else this.#e="*",s.unshift(o);return s.forEach((a)=>{this.#o($e,this.#e,a)}),this};let{strict:r,...i}=t;Object.assign(this,i),this.getPath=r??!0?t.getPath??sp:p1}#t(){let t=new e({router:this.router,getPath:this.getPath});return t.errorHandler=this.errorHandler,t.#n=this.#n,t.routes=this.routes,t}#n=q5;errorHandler=D1;route(t,n){let r=this.basePath(t);return n.routes.map((i)=>{let o;if(n.errorHandler===D1)o=i.handler;else o=async(s,a)=>(await np([],n.errorHandler)(s,()=>i.handler(s,a))).res,o[ea]=i.handler;r.#o(i.method,i.path,o,i.basePath)}),this}basePath(t){let n=this.#t();return n._basePath=xr(this._basePath,t),n}onError=(t)=>(this.errorHandler=t,this);notFound=(t)=>(this.#n=t,this);mount(t,n,r){let i,o;if(r)if(typeof r==="function")o=r;else if(o=r.optionHandler,r.replaceRequest===!1)i=(c)=>c;else i=r.replaceRequest;let s=o?(c)=>{let d=o(c);return Array.isArray(d)?d:[d]}:(c)=>{let d=void 0;try{d=c.executionCtx}catch{}return[c.env,d]};i||=(()=>{let c=xr(this._basePath,t),d=c==="/"?0:c.length;return(u)=>{let f=new URL(u.url);return f.pathname=this.getPath(u).slice(d)||"/",new Request(f,u)}})();let a=async(c,d)=>{let u=await n(i(c.req.raw),...s(c));if(u)return u;await d()};return this.#o($e,xr(t,"*"),a),this}#o(t,n,r,i){t=t.toUpperCase(),n=xr(this._basePath,n);let o={basePath:i!==void 0?xr(this._basePath,i):this._basePath,path:n,method:t,handler:r};this.router.add(t,n,[r,o]),this.routes.push(o)}#i(t,n){if(t instanceof Error)return this.errorHandler(t,n);throw t}#r(t,n,r,i){if(i==="HEAD")return(async()=>new Response(null,await this.#r(t,n,r,"GET")))();let o=this.getPath(t,{env:r}),s=this.router.match(i,o),a=new lp(t,{path:o,matchResult:s,env:r,executionCtx:n,notFoundHandler:this.#n});if(s[0].length===1){let d;try{d=s[0][0][0][0](a,async()=>{a.res=await this.#n(a)})}catch(u){return this.#i(u,a)}return d instanceof Promise?d.then((u)=>u||(a.finalized?a.res:this.#n(a))).catch((u)=>this.#i(u,a)):d??this.#n(a)}let c=np(s[0],this.errorHandler,this.#n);return(async()=>{try{let d=await c(a);if(!d.finalized)throw Error("Context is not finalized. Did you forget to return a Response object or `await next()`?");return d.res}catch(d){return this.#i(d,a)}})()}fetch=(t,...n)=>this.#r(t,n[1],n[0],t.method);request=(t,n,r,i)=>{if(t instanceof Request)return this.fetch(n?new Request(t,n):t,r,i);return t=t.toString(),this.fetch(new Request(/^https?:\/\//.test(t)?t:`http://localhost${xr("/",t)}`,n),r,i)};fire=()=>{addEventListener("fetch",(t)=>{t.respondWith(this.#r(t.request,t,void 0,t.request.method))})}};wr();fi();var Xe=()=>Object.create(null);wr();var Iu=[];function fp(e,t){let n=this.buildAllMatchers(),r=(i,o)=>{let s=n[i]||n[$e],a=s[2][o];if(a)return a;let c=o.match(s[0]);if(!c)return[[],Iu];let d=c.indexOf("",1);return[s[1][d],c]};return this.match=r,r(e,t)}var co="[^/]+",Dr=".*",Gn="(?:|/.*)",_r=Symbol(),S1=new Set(".\\+*[^]$()");function $5(e,t){if(e.length===1)return t.length===1?e<t?-1:1:-1;if(t.length===1)return 1;if(e===Dr||e===Gn)return t===Gn?-1:1;else if(t===Dr||t===Gn)return-1;if(e===co)return 1;else if(t===co)return-1;return e.length===t.length?e<t?-1:1:t.length-e.length}var T1=class e{#e;#t;#n=Xe();insert(t,n,r,i,o){let s=this;for(let a=0,c=t.length;a<c;a++){let d=t[a],u=d.length===1?d==="*"?a===c-1?["","",Dr]:["","",co]:null:d==="/*"?["","",Gn]:d.match(/^\:([^\{\}]+)(?:\{(.+)\})?$/),f;if(u){let h=u[1],p=u[2]||co;if(h&&u[2]){if(p===".*")throw _r;if(p=p.replace(/^\((?!\?:)(?=[^)]+\)$)/,"(?:"),/\((?!\?:)/.test(p))throw _r;if(p.length===1&&S1.has(p))throw _r}if(f=s.#n[p],!f){if(p!==Dr&&p!==Gn){for(let g in s.#n)if((p.length>1||g.length>1)&&g!==Dr&&g!==Gn)throw _r}f=s.#n[p]=new e}if(h!=="")f.#t??=i.varIndex++,r.push([h,f.#t])}else if(f=s.#n[d],!f){for(let h in s.#n)if(h.length>1&&h!==Dr&&h!==Gn)throw _r;f=s.#n[d]=new e}s=f}if(s.#e!==void 0)throw _r;s.#e=o?-1:n}buildRegExpStr(){let n=Object.keys(this.#n).sort($5).map((r)=>{let i=this.#n[r],o=i.buildRegExpStr();return o===""?"":(typeof i.#t==="number"?`(${r})@${i.#t}`:S1.has(r)?`\\${r}`:r)+o}).filter(Boolean);if(typeof this.#e==="number"&&this.#e!==-1)n.unshift(`#${this.#e}`);if(n.length===0)return"";if(n.length===1)return n[0];return"(?:"+n.join("|")+")"}};var hp=class{#e={varIndex:0};#t=new T1;#n=0;paths=Xe();insert(e,t){if(t){this.#t.insert(e.split(""),0,[],this.#e,!0);return}let n=[],r=[],i=e;for(let s=0;;){let a=!1;if(i=i.replace(/\{[^}]+\}/g,(c)=>{let d=`@\\${s}`;return r[s]=[d,c],s++,a=!0,d}),!a)break}let o=i.match(/(?::[^\/]+)|(?:\/\*$)|./g)||[];for(let s=r.length-1;s>=0;s--){let[a]=r[s];for(let c=o.length-1;c>=0;c--)if(o[c].indexOf(a)!==-1){o[c]=o[c].replace(a,r[s][1]);break}}this.#t.insert(o,this.#n,n,this.#e,!1),this.paths[e]=[this.#n++,n]}buildRegExp(){let e=this.#t.buildRegExpStr();if(e==="")return[/^$/,[],[]];let t=0,n=[],r=[];return e=e.replace(/#(\d+)|@(\d+)|\.\*\$/g,(i,o,s)=>{if(o!==void 0)return n[++t]=Number(o),"$()";if(s!==void 0)return r[Number(s)]=++t,"";return""}),[new RegExp(`^${e}`),n,r]}};var C1=Xe();function A1(e){return C1[e]??=new RegExp(`^${e.replace(/\/:[^/{}]+(?:\{\[\^\/]\+})?(?=[/{]|$)|\/?\*$|([.\\+*[^\]$()?{}|])/g,(t,n)=>n?`\\${n}`:t==="/*"?Gn:t==="*"?Dr:`/:${co}`)}$`)}function Mu(e,t){for(let n of Object.keys(e).sort((r,i)=>i.length-r.length))if(A1(n).test(t))return[...e[n]];return}var Bu=class{name="RegExpRouter";#e;#t;#n;constructor(){this.#e={[$e]:Xe()},this.#t={[$e]:Xe()},this.#n={[$e]:new hp}}#o(e,t){try{this.#n[e].insert(t,!/\*|\/:/.test(t))}catch(n){throw n===_r?new Ou(t):n}}add(e,t,n){let r=this.#e,i=this.#t;if(!r)throw Error(Pu);if(!r[e]){this.#n[e]=new hp;for(let a of[r,i]){a[e]=Xe();for(let c in a[$e])a[e][c]=[...a[$e][c]],this.#o(e,c)}}if(t==="/*")t="*";let o=e===$e?Object.keys(r):[e];if(/\*$/.test(t)){let a=A1(t);for(let c of o)if(!r[c][t])this.#o(c,t),r[c][t]=Mu(r[c],t)||Mu(r[$e],t)||[];for(let c of[r,i])for(let d of o)for(let u in c[d])a.test(u)&&c[d][u].push([n,t]);return}let s=Ru(t)||[t];for(let a of s)for(let c of o){if(!i[c][a])this.#o(c,a),i[c][a]=Mu(r[c],a)||Mu(r[$e],a)||[];i[c][a].push([n,a])}}match=fp;buildAllMatchers(){let e=Xe();for(let t of Object.keys(this.#t))e[t]=this.#i(t);return this.#e=this.#t=this.#n=void 0,C1=Xe(),e}#i(e){let t=this.#e[e],n=this.#t[e],r=this.#n[e],i=Xe(),o=[],[s,a,c]=r.buildRegExp();for(let d of[t,n])for(let u in d){let f=d[u],h=r.paths[u];if(!h){i[u]=[f.map(([p])=>[p,Xe()]),Iu];continue}o[h[0]]=f.map(([p,g])=>[p,r.paths[g][1].reduceRight((b,[v],y)=>(b[v]=c[h[1][y][1]],b),Xe())])}return[s,a.map((d)=>o[d]),i]}};wr();wr();var pp=class{name="SmartRouter";#e=[];#t=[];constructor(e){this.#e=e.routers}add(e,t,n){if(!this.#t)throw Error(Pu);this.#t.push([e,t,n])}match(e,t){if(!this.#t)throw Error("Fatal error");let n=this.#e,r=this.#t,i=n.length,o=0,s;for(;o<i;o++){let a=n[o];try{for(let c=0,d=r.length;c<d;c++)a.add(...r[c]);s=a.match(e,t)}catch(c){if(c instanceof Ou)continue;throw c}this.match=a.match.bind(a),this.#e=[a],this.#t=void 0;break}if(o===i)throw Error("Fatal error");return this.name=`SmartRouter + ${this.activeRouter.name}`,s}get activeRouter(){if(this.#t||this.#e.length!==1)throw Error("No active router has been determined yet.");return this.#e[0]}};fi();wr();fi();var gp=Xe(),H5=0,U1=class e{#e=[];#t=Xe();#n=[];#o;#i=gp;insert(t,n,r){let i=this,o=d1(n),s=new Set,a=0;for(let c of o){let d=o[++a],u=f1(c,d)||(d===void 0&&c&&c.indexOf("*")===c.length-1?c:null),f=Array.isArray(u),h=f?u[0]:u||c,p=i.#t[h]||=new e;if(u&&!p.#o)p.#o=u,i.#n.push(p);if(i=p,f)s.add(u[1])}i.#e.push({[t]:{handler:r,possibleKeys:[...s],score:++H5}})}#r(t,n,r,i,o){for(let s=0,a=n.#e.length;s<a;s++){let c=n.#e[s],d=c[r]||c[$e];if(d){d.params=Xe(),t.push(d);for(let u=0,f=d.possibleKeys.length;u<f;u++){let h=d.possibleKeys[u];d.params[h]=o?.[h]&&!u?o[h]:i[h]??o?.[h]}}}}search(t,n){let r=[];this.#i=gp;let o=[this],s=ip(n),a=[],c=s.length,d=null;for(let u=0;u<c;u++){let f=s[u],h=u===c-1,p=[];for(let b=0,v=o.length;b<v;b++){let y=o[b],x=y.#t[f];if(x)if(x.#i=y.#i,h){if(x.#t["*"])this.#r(r,x.#t["*"],t,y.#i);this.#r(r,x,t,y.#i)}else p.push(x);for(let m of y.#n){let w=m.#o,D=y.#i===gp?{}:{...y.#i};if(typeof w==="string"){if(w==="*"||f.startsWith(w.slice(0,-1))){if(this.#r(r,m,t,y.#i),w==="*")m.#i=D,p.push(m)}continue}let[,C,_]=w;if(!f&&_===!0)continue;if(_!==!0){if(!d){d=[];let B=n[0]==="/"?1:0;for(let F=0;F<c;F++)d[F]=B,B+=s[F].length+1}let A=n.slice(d[u]),S=_.exec(A);if(S){if(D[C]=S[0],this.#r(r,m,t,y.#i,D),S[0].length===A.length&&m.#t["*"])this.#r(r,m.#t["*"],t,y.#i,D);for(let B in m.#t){m.#i=D;let F=S[0].match(/\//g)?.length??0;(a[F]||=[]).push(m);break}continue}}if(_===!0||_.test(f))if(D[C]=f,h){if(this.#r(r,m,t,D,y.#i),m.#t["*"])this.#r(r,m.#t["*"],t,D,y.#i)}else m.#i=D,p.push(m)}}let g=a.shift();o=g?p.concat(g):p}if(r[1])r.sort((u,f)=>u.score-f.score);return[r.map(({handler:u,params:f})=>[u,f])]}};var mp=class{name="TrieRouter";#e=new U1;add(e,t,n){for(let r of Ru(t)||[t])this.#e.insert(e,r,n)}match(e,t){return this.#e.search(e,t)}};var yp=class extends E1{constructor(e={}){super(e);this.router=e.router??new pp({routers:[new Bu,new mp]})}};function bp(){let e={};return e.promise=new Promise((t,n)=>{e.resolve=t,e.reject=n}),e}import{execFile as G5}from"node:child_process";import uo from"node:path";import{promisify as z5}from"node:util";var ta=z5(G5),Nu=1e4,k1=120000,na=8388608;async function bt(e,t,n=na,r=Nu){let{stdout:i}=await ta("git",["-C",e,...t],{timeout:r,maxBuffer:n,env:{...process.env,LC_ALL:"C"}});return i}async function Ct(e){try{return(await bt(e,["rev-parse","--show-toplevel"])).trim()||null}catch{return null}}function hi(e,t){let n=uo.relative(uo.resolve(e),uo.resolve(t));return n===""||!n.startsWith(`..${uo.sep}`)&&n!==".."&&!uo.isAbsolute(n)}function Er(e){return e.split(uo.sep).join("/")}function Lu(e){return e.includes(0)}import{lstat as nB,readFile as rB}from"node:fs/promises";import M1 from"node:path";var pi=262144,R1=10485760,F1=10485760,V5={png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",webp:"image/webp",svg:"image/svg+xml",bmp:"image/bmp",ico:"image/x-icon",avif:"image/avif"},X5={mp3:"audio/mpeg",wav:"audio/wav",ogg:"audio/ogg",oga:"audio/ogg",opus:"audio/ogg",m4a:"audio/mp4",aac:"audio/aac",flac:"audio/flac",weba:"audio/webm",webm:"audio/webm"},K5={pdf:"application/pdf",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"};function Z5(e){return e.replace(/\\/g,"/").split("/").pop()??""}function lo(e){return Z5(e).toLowerCase().split(".").pop()??""}function Wu(e){return V5[lo(e)]??null}function ju(e){return X5[lo(e)]??null}function qu(e){return K5[lo(e)]??null}function P1(e){let t=lo(e);if(t==="pdf"||t==="docx")return t;return null}function Y5(e,t){return e==="R"||e==="C"||t==="R"||t==="C"}function O1(e){let t=e.split("\x00"),n=[];for(let r=0;r<t.length;r++){let i=t[r];if(!i||i.length<4||i[2]!==" ")continue;let o=i[0],s=i[1],a={path:i.slice(3),indexStatus:o,worktreeStatus:s};if(Y5(o,s))a.originalPath=t[++r]||void 0;n.push(a)}return n}var J5=new Set(["DD","AU","UD","UA","DU","AA","UU"]);function $u(e){let t=`${e.indexStatus}${e.worktreeStatus}`;if(t==="??")return{status:"untracked",code:"U"};if(J5.has(t)||t.includes("U"))return{status:"conflict",code:"C"};if(t.includes("D"))return{status:"deleted",code:"D"};if(t.includes("R")||t.includes("C"))return{status:"renamed",code:"R"};if(t.includes("A"))return{status:"added",code:"A"};return{status:"modified",code:"M"}}import{lstat as Q5,readFile as eB}from"node:fs/promises";import vp from"node:path";async function xp(e){let t=await bt(e,["status","--porcelain=v1","-z","--untracked-files=all"]);return O1(t)}async function I1(e,t,n){let i=Er(vp.relative(e,t))||".";try{let o=await bt(e,["diff","--no-color","--no-ext-diff","--numstat",...n,"--",i]),s=new Map;for(let a of o.split(/\r?\n/)){if(!a)continue;let[c,d,...u]=a.split("\t");if(u.length===0)continue;let f=Number(c),h=Number(d);if(!Number.isInteger(f)||!Number.isInteger(h))continue;let p=u.join("\t"),g=p.indexOf(" => ");if(g!==-1)p=p.slice(g+4);s.set(Er(p.trim()),{additions:f,deletions:h})}return s}catch{return new Map}}async function tB(e){try{let t=await Q5(e);if(!t.isFile()||t.size>pi)return 0;let n=await eB(e);if(Lu(n)||n.length===0)return 0;let r=n.toString("utf8");return r.endsWith(`
259
+ `)}),this}_outputHelpIfRequested(e){let t=this._getHelpOption();if(t&&e.find((r)=>t.is(r)))this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)")}}function U2(e){return e.map((t)=>{if(!t.startsWith("--inspect"))return t;let n,r="127.0.0.1",i="9229",o;if((o=t.match(/^(--inspect(-brk)?)$/))!==null)n=o[1];else if((o=t.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null)if(n=o[1],/^\d+$/.test(o[3]))i=o[3];else r=o[3];else if((o=t.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null)n=o[1],r=o[3],i=o[4];if(n&&i!=="0")return`${n}=${r}:${parseInt(i)+1}`;return t})}function k2(){if(ge.env.NO_COLOR||ge.env.FORCE_COLOR==="0"||ge.env.FORCE_COLOR==="false")return!1;if(ge.env.FORCE_COLOR||ge.env.CLICOLOR_FORCE!==void 0)return!0;return}var Dhe=new io;var Xs={name:"@rainmanhhh/pi-web",version:"0.16.7",description:"Web UI for the pi coding agent (fork of @agegr/pi-web)",homepage:"https://gitee.com/dsxbygzzl/pi-web#readme",repository:{type:"git",url:"git+https://gitee.com/dsxbygzzl/pi-web.git"},bugs:{url:"https://gitee.com/dsxbygzzl/pi-web/issues"},author:"rainmanhhh",license:"MIT",publishConfig:{access:"public",registry:"https://registry.npmjs.org"},engines:{node:">=24.0.0"},files:["dist","public","extensions","package.json"],bin:{"pi-web":"dist/server.mjs"},scripts:{dev:"vite","dev:lan":"vite --host 0.0.0.0",mb:"bun run --env-file=.env.manual api",mf:"bun run --env-file=.env.manual dev -- --port 3001",api:"bun run server/main.ts","api:node":"bun run build:server && node dist/server.mjs","build:server":'bun build server/main.ts --target node --outfile dist/server.mjs --minify --external "@earendil-works/*" --define "process.env.PI_WEB_PACKAGED=1"',"e2e:stop":"bun run scripts/e2e-stop.mjs","e2e:prepare":"bun run scripts/e2e-prepare.mjs",build:"vite build && bun run scripts/prune-fonts.mjs","build:analyze":"vite build --config scripts/analyze-bundle.config.ts && bun run scripts/prune-fonts.mjs",lint:"oxlint --fix",fta:"bun scripts/fta-gate.mjs . --output-limit 15",jscpd:"jscpd --config .jscpd.json",check:"tsc --noEmit",format:"biome check --write .",prepublishOnly:"bun run check && bun run build && bun run build:server","test:e2e":"cross-env CODEBUDDY_SAFE_DELETE_ENABLED=0 bun run e2e:stop && playwright test","test:unit":"vitest run","test:unit:bun":"bun --bun run test:unit",prepare:"husky || true"},dependencies:{"@codemirror/commands":"^6.11.0","@codemirror/lang-css":"^6.3.1","@codemirror/lang-html":"^6.4.12","@codemirror/lang-javascript":"^6.2.5","@codemirror/lang-json":"^6.0.2","@codemirror/lang-markdown":"^6.5.2","@codemirror/lang-yaml":"^6.1.3","@codemirror/language":"^6.12.4","@codemirror/state":"^6.7.1","@codemirror/theme-one-dark":"^6.1.3","@codemirror/view":"^6.43.9","@earendil-works/pi-agent-core":"0.87.0","@earendil-works/pi-ai":"0.87.0","@earendil-works/pi-coding-agent":"0.87.0","@earendil-works/pi-tui":"0.87.0","@hono/node-server":"^2.1.1","class-variance-authority":"^0.7.1",clsx:"^2.1.1",codemirror:"^6.0.2",hono:"^4.13.5","lucide-react":"^1.37.0","p-defer":"^4.0.1",pointrix:"^1.1.0","proper-lockfile":"4.1.2","radix-ui":"^1.6.7",react:"^19.2.8","react-dom":"^19.2.8",shadcn:"^4.19.0",streamdown:"2.6.0","tailwind-merge":"^3.6.0","tw-animate-css":"^1.4.0",virtua:"^0.50.6",ws:"^8.21.3"},devDependencies:{"@biomejs/biome":"^2.5.13","@lobehub/icons":"^5.16.0","@playwright/test":"^1.62.1","@tailwindcss/postcss":"^4.3.3","@testing-library/dom":"^10.4.1","@testing-library/react":"^16.3.3","@types/node":"^25.9.5","@types/proper-lockfile":"4.1.4","@types/react":"^19.2.18","@types/react-dom":"^19.2.5","@types/react-resizable":"^4.0.0","@types/react-syntax-highlighter":"^15.5.13","@types/ws":"^8.18.1","@vitejs/plugin-react":"^6.1.1",commander:"^15.0.0","cross-env":"^10.1.0","fta-cli":"^3.0.1",husky:"^9.1.7",jiti:"^2.7.0",jscpd:"^5.1.0",jsdom:"^30.0.1",katex:"^0.18.4","lint-staged":"^17.4.1",mammoth:"^1.12.2",mermaid:"^11.17.2",oxlint:"^1.80.0",postcss:"^8.5.26","react-markdown":"^10.1.0","react-syntax-highlighter":"^16.1.1","rehype-katex":"^7.0.1","rehype-raw":"^7.0.0","rehype-sanitize":"^6.0.0","remark-gfm":"^4.0.1","remark-math":"^6.0.0",tailwindcss:"^4.3.3",typescript:"^7.0.2",vite:"^8.2.2","vite-plugin-remove-console":"^2.2.0","vite-plugin-svgr":"^5.2.0",vitest:"^4.1.11"},type:"module",overrides:{katex:"^0.18.4"}};var Lh=!1,R2=performance.now();function F2(e){if(Lh=e,R2=performance.now(),Lh)Nt("boot","debug log enabled")}function Tt(e){return(t,n)=>Nt(e,t,n)}function Nt(e,t,n){if(!Lh)return;let r=performance.now()-R2,i=new Date,o=(a,c=2)=>String(a).padStart(c,"0"),s=`${o(i.getHours())}:${o(i.getMinutes())}:${o(i.getSeconds())}.${o(i.getMilliseconds(),3)}`;console.debug(`[debug][${e}][${s}][+${r.toFixed(1)}ms] ${t}${n?` — ${n}`:""}`)}import{existsSync as u5,mkdirSync as l5,readFileSync as z2,writeFileSync as d5}from"node:fs";import{dirname as f5,join as V2}from"node:path";import{getAgentDir as X2}from"@earendil-works/pi-coding-agent";var I2=[{label:{en:"Explore project","zh-CN":"阅读项目"},message:{en:"Explore the current project and summarize the overall directory structure and responsibilities of core modules.","zh-CN":"阅读当前项目,总结整体目录结构与核心模块的职责。"}},{label:{en:"Review workspace changes","zh-CN":"审查工作区改动"},message:{en:"Review all changes in the current workspace, point out potential issues and improvements.","zh-CN":"审查当前工作区的所有改动,指出潜在问题与改进点。"}},{label:{en:"Find and fix bugs","zh-CN":"寻找并修复bug"},message:{en:"Inspect the current codebase, find and fix existing bugs.","zh-CN":"检查当前代码,寻找并修复其中存在的 bug。"}}];var M2=I2;import{readFileSync as L2,writeFileSync as s5}from"node:fs";import{join as a5}from"node:path";import{getAgentDir as c5}from"@earendil-works/pi-coding-agent";var bu=["off","minimal","low","medium","high","xhigh","max"];function vu(e){return e==="en"||e==="zh-CN"?e:void 0}function qh(e){return e==="dark"||e==="light"?e:void 0}function xu(e){return typeof e==="string"&&bu.includes(e)?e:void 0}function $h(e){if(typeof e!=="object"||e===null)return;let t=e;if(typeof t.enabled!=="boolean")return;if(typeof t.reserveTokens!=="number"||!Number.isInteger(t.reserveTokens)||t.reserveTokens<=0)return;if(typeof t.keepRecentTokens!=="number"||!Number.isInteger(t.keepRecentTokens)||t.keepRecentTokens<=0)return;return{enabled:t.enabled,reserveTokens:t.reserveTokens,keepRecentTokens:t.keepRecentTokens}}function o5(e){if(typeof e!=="object"||e===null)return;let t=e,n={};if(typeof t.timeoutMs==="number"&&Number.isInteger(t.timeoutMs)&&t.timeoutMs>0)n.timeoutMs=t.timeoutMs;if(typeof t.maxRetries==="number"&&Number.isInteger(t.maxRetries)&&t.maxRetries>0)n.maxRetries=t.maxRetries;if(typeof t.maxRetryDelayMs==="number"&&Number.isInteger(t.maxRetryDelayMs)&&t.maxRetryDelayMs>0)n.maxRetryDelayMs=t.maxRetryDelayMs;return Object.keys(n).length>0?n:void 0}function Hh(e){if(typeof e!=="object"||e===null)return;let t=e;if(typeof t.maxRetries!=="number"||!Number.isInteger(t.maxRetries)||t.maxRetries<=0)return;if(typeof t.baseDelayMs!=="number"||!Number.isInteger(t.baseDelayMs)||t.baseDelayMs<=0)return;let n={maxRetries:t.maxRetries,baseDelayMs:t.baseDelayMs};if(typeof t.enabled==="boolean")n.enabled=t.enabled;let r=o5(t.provider);if(r!==void 0)n.provider=r;return n}function wu(e){if(e==="ask"||e==="always"||e==="never")return e;if(e==="trust")return"always";if(e==="deny")return"never";return}function _u(e){if(typeof e!=="object"||e===null)return;let t=e,n={};if(typeof t.defaultModel==="string"&&t.defaultModel.trim()!=="")n.defaultModel=t.defaultModel;let r=xu(t.defaultThinking);if(r!==void 0)n.defaultThinking=r;return Object.keys(n).length>0?n:void 0}function Du(e){return typeof e==="number"&&Number.isFinite(e)&&e>=0.85&&e<=1.3?e:void 0}var Ks=(e)=>typeof e==="boolean"?e:void 0,jh=(e)=>typeof e==="number"&&Number.isInteger(e)&&e>0?e:void 0,B2=(e)=>typeof e==="string"&&e.trim()!==""?e:void 0;function N2(e,t){if(typeof e!=="object"||e===null)return;let n=e,r={};for(let[i,o]of Object.entries(t)){let s=o(n[i]);if(s!==void 0)r[i]=s}return Object.keys(r).length>0?r:void 0}var Gh=[{key:"httpProxy",validate:B2},{key:"httpIdleTimeoutMs",validate:jh},{key:"websocketConnectTimeoutMs",validate:jh},{key:"enableAnalytics",validate:Ks},{key:"enableInstallTelemetry",validate:Ks},{key:"trackingId",validate:B2},{key:"branchSummary",validate:(e)=>N2(e,{reserveTokens:jh,skipPrompt:Ks})},{key:"images",validate:(e)=>N2(e,{autoResize:Ks,blockImages:Ks})}];function zh(e){return $h(oo("compaction",e))}function W2(e,t){let n=$h(e);if(!n)return zh(t);return Zs("compaction",n,t),n}function Vh(e){return Hh(oo("retry",e))}function j2(e,t){let n=Hh(e);if(!n)return Vh(t);return Zs("retry",n,t),n}function Xh(e){return _u(oo("subagents",e))}function q2(e,t){let n=_u(e);if(n===void 0)return;let r=oo("subagents",t),i=typeof r==="object"&&r!==null?{...r}:{};if(n.defaultModel!==void 0)i.defaultModel=n.defaultModel;else delete i.defaultModel;if(n.defaultThinking!==void 0)i.defaultThinking=n.defaultThinking;else delete i.defaultThinking;return Zs("subagents",i,t),_u(i)}function oo(e,t){try{return JSON.parse(L2($2(t),"utf8"))[e]}catch{return}}function Zs(e,t,n){try{let r=$2(n),i={};try{i=JSON.parse(L2(r,"utf8"))}catch{i={}}i[e]=t,s5(r,JSON.stringify(i,null,2),"utf8")}catch{}}function so(e,t){let n=oo(e,t);return typeof n==="string"?n:void 0}function Eu(e,t,n){if(t===void 0)return so(e,n);return Zs(e,t,n),t}function $2(e){return a5(e??c5(),"settings.json")}function Ys(e){return qh(so("theme",e))??"light"}function H2(e,t){let n=qh(e);if(!n)return Ys(t);return Eu("theme",n,t),n}function Su(e){let t={};for(let{key:n,validate:r}of Gh){let i=r(oo(n,e));if(i!==void 0)t[n]=i}return Object.keys(t).length>0?t:void 0}function G2(e,t){for(let{key:n,validate:r}of Gh){if(!(n in e))continue;let i=r(e[n]);if(i===void 0)continue;Zs(n,i,t)}return Su(t)}var Tu=new Map;function Kh(e){return V2(e??X2(),"pi-web","config.json")}function h5(e){return V2(e??X2(),"pi-web-preferences.json")}function Zh(e){try{if(u5(Kh(e)))return;let t=JSON.parse(z2(h5(e),"utf8"));Yh({firstPaint:{locale:vu(t.firstPaint?.locale),fontScale:Du(t.firstPaint?.fontScale)},preferences:t.preferences??{}},e)}catch{}}function p5(e){let t=xu(so("defaultThinkingLevel",e)),n=zh(e),r=Vh(e),i=wu(so("defaultProjectTrust",e)),o=Xh(e),s=Su(e);return{theme:Ys(e),...t!==void 0?{defaultThinkingLevel:t}:{},...n!==void 0?{compaction:n}:{},...r!==void 0?{retry:r}:{},...i!==void 0?{defaultProjectTrust:i}:{},...o!==void 0?{subagents:o}:{},...s!==void 0?{piSettings:s}:{}}}function Hn(e){let t=e===void 0,n=e??"",r=t?Tu.get(n):void 0;if(!t||r===void 0||r===null)try{let i=z2(Kh(e),"utf8"),o=JSON.parse(i);r={firstPaint:{locale:vu(o.firstPaint?.locale),fontScale:Du(o.firstPaint?.fontScale)},preferences:o.preferences??{},theme:Ys(e)},Tu.set(n,r)}catch{if(r={firstPaint:{},preferences:{},theme:Ys(e)},t)Tu.set(n,r)}return{...r,...p5(e)}}function Yh(e,t){try{let n=Kh(t);l5(f5(n),{recursive:!0});let r={firstPaint:e.firstPaint,preferences:e.preferences};if(d5(n,JSON.stringify(r,null,2),"utf8"),t===void 0)Tu.set("",e)}catch{}}function g5(e,t){return{...e,...t.locale!==void 0?{locale:vu(t.locale)??e.locale}:{},...t.fontScale!==void 0?{fontScale:Du(t.fontScale)??e.fontScale}:{}}}function m5(e,t){if(e===void 0)return wu(so("defaultProjectTrust",t));let n=wu(e);if(n===void 0)return;return Eu("defaultProjectTrust",n,t),n}function Jh(e,t){let n=Hn(t),r=g5(n.firstPaint,e),i=n.theme;if(e.theme!==void 0)i=H2(e.theme,t);let o=Eu("defaultThinkingLevel",xu(e.defaultThinkingLevel),t),s=W2(e.compaction,t),a=j2(e.retry,t),c=m5(e.defaultProjectTrust,t),d=e.subagents===void 0?Xh(t):q2(e.subagents,t),u=e.piSettings===void 0?Su(t):G2(e.piSettings,t),f={firstPaint:r,preferences:n.preferences,theme:i,defaultThinkingLevel:o,...s!==void 0?{compaction:s}:{},...a!==void 0?{retry:a}:{},...c!==void 0?{defaultProjectTrust:c}:{},...d!==void 0?{subagents:d}:{},...u!==void 0?{piSettings:u}:{}};return Yh(f,t),f}function Cu(e,t){let n=Hn(t),r={firstPaint:n.firstPaint,preferences:{...n.preferences,...e},theme:n.theme};return Yh(r,t),r}function Qh(e){let{preferences:t}=Hn(e);if(t.startScreenMessages!==void 0)return;Cu({startScreenMessages:M2},e)}import{DefaultResourceLoader as k5,getAgentDir as t1}from"@earendil-works/pi-coding-agent";import{hasTrustRequiringProjectResources as y5,ProjectTrustStore as ep}from"@earendil-works/pi-coding-agent";function ct(e,t){if(!(Boolean(e)&&y5(e)))return{requiresTrust:!1,trusted:!0};return{requiresTrust:!0,trusted:new ep(t).get(e)===!0}}function K2(e,t){let n=ct(e,t);if(!n.requiresTrust)return n;return new ep(t).set(e,!0),{requiresTrust:!0,trusted:!0}}function ao(e,t){if(!ct(e,t).requiresTrust)return;let r=new ep(t);return{resolveProjectTrust:async()=>r.get(e)===!0}}import{existsSync as b5,readFileSync as v5}from"node:fs";import{homedir as x5}from"node:os";import{isAbsolute as w5,join as Js,relative as _5,resolve as Z2,sep as D5}from"node:path";function E5({homeDir:e=x5(),xdgStateHome:t=process.env.XDG_STATE_HOME}={}){return t?Js(t,"skills",".skill-lock.json"):Js(e,".agents",".skill-lock.json")}function Y2(e){try{let t=JSON.parse(v5(e,"utf8"));return t.skills&&typeof t.skills==="object"?t.skills:{}}catch{return{}}}function J2(e,t){let n=_5(Z2(t),Z2(e));return n!==""&&n!==".."&&!n.startsWith(`..${D5}`)&&!w5(n)}function S5(e,t){if(e[t])return e[t];let n=t.toLowerCase(),r=Object.keys(e).find((i)=>i.toLowerCase()===n);return r?e[r]:void 0}function T5(e,t){if(t!=="github")return e.replace(/\/$/,"");return e.replace(/^git\+/,"").replace(/^https?:\/\/github\.com\//,"").replace(/^git@github\.com:/,"").replace(/\.git$/,"").replace(/\/$/,"")}function C5(e,t){if(!e||e.includes("://")||e.startsWith("git@"))return;let n=e.split("/").filter(Boolean).map(encodeURIComponent).join("/");if(!n)return;return`https://skills.sh/${n}/${encodeURIComponent(t)}`}function A5(e,t){let n=typeof e.sourceType==="string"?e.sourceType:void 0,r=T5(e.source.trim(),n),i=typeof e.skillPath==="string"?e.skillPath:void 0,o=typeof e.ref==="string"?e.ref:void 0,s=t==="global"?e.skillFolderHash:e.computedHash;return{sourceType:n,source:r,skillPath:i,ref:o,versionHash:typeof s==="string"&&s?s:void 0}}function U5(e,t){let{sourceType:n,source:r,skillPath:i,versionHash:o,ref:s}=e,a=n==="github"&&/^[\w.-]+\/[\w.-]+$/.test(r);return Boolean(a&&i&&o&&(t==="global"||!s))}function Q2(e,t,n){let r=S5(e,t);if(!r||typeof r.source!=="string"||!r.source.trim())return;let{sourceType:i,source:o,skillPath:s,ref:a,versionHash:c}=A5(r,n);if(!o)return;return{package:`${o}@${t}`,scope:n,source:o,sourceType:i,skillsShUrl:i==="local"?void 0:C5(o,t),...s&&{skillPath:s},...a&&{ref:a},...c&&{versionHash:c},canCheckForUpdates:U5({sourceType:i,source:o,skillPath:s,versionHash:c,ref:a},n)}}function e1(e,{cwd:t,agentDir:n,globalLockPath:r=E5(),projectLockPath:i=Js(t,"skills-lock.json")}){let o=Y2(r),s=Y2(i),a=Js(n,"skills"),c=Js(t,".pi","skills");return e.map((d)=>{if(!b5(d.filePath))return d;let u=J2(d.filePath,a)?Q2(o,d.name,"global"):J2(d.filePath,c)?Q2(s,d.name,"project"):void 0;return u?{...d,install:u}:d})}var R5=32,di=new Map,tp=new Map;async function sn(e,t){let n=t?.forceFresh??!1,r=e===""?t1():e;if(!n){let s=di.get(e);if(s)return{skills:[...s.skills.values()],diagnostics:s.diagnostics,projectResourcesLoaded:s.projectResourcesLoaded}}let i=tp.get(e);if(i)return i;let o=F5(r,e);tp.set(e,o);try{return await o}finally{tp.delete(e)}}async function F5(e,t){let n=t1(),r=new k5({cwd:e,agentDir:n});await r.reload(ao(e,n));let{skills:i,diagnostics:o}=r.getSkills(),s={skills:e1(i,{cwd:e,agentDir:n}),diagnostics:o,projectResourcesLoaded:ct(e,n).trusted},a=new Map;for(let c of s.skills)a.set(c.filePath,c);return di.set(t,{skills:a,diagnostics:s.diagnostics,projectResourcesLoaded:s.projectResourcesLoaded,loadedAt:Date.now()}),P5(),s}function P5(){while(di.size>R5){let e=null,t=1/0;for(let[n,r]of di){if(n==="")continue;if(r.loadedAt<t)t=r.loadedAt,e=n}if(e===null)break;di.delete(e)}}function n1(e,t,n){let r=di.get(e);if(!r)return;let i=r.skills.get(t);if(!i){di.delete(e);return}if(n.disableModelInvocation!==void 0)i.disableModelInvocation=n.disableModelInvocation}var Au=null;function r1(e){if(Au)return;let t=(async()=>{for(let n of e)await Promise.allSettled([n()])})();Au=t,t.then(()=>{Au=null})}function vn(){return Au??Promise.resolve()}var i1={port:31415};import{getAgentDir as Ple}from"@earendil-works/pi-coding-agent";var np=(e,t,n)=>(r,i)=>{let o=-1;return s(0);async function s(a){if(a<=o)throw Error("next() called multiple times");o=a;let c,d=!1,u;if(e[a])u=e[a][0][0],r.req.routeIndex=a;else u=a===e.length&&i||void 0;if(u)try{c=await u(r,()=>s(a+1))}catch(f){if(f instanceof Error&&t)r.error=f,c=await t(f,r),d=!0;else throw f}else if(r.finalized===!1&&n)c=await n(r);if(c&&(r.finalized===!1||d))r.res=c;return r}};var o1=Symbol();var s1=(e,t)=>new Response(e,{headers:{"Content-Type":t.replace(/^[^;]+/,(r)=>r.toLowerCase())}}).formData();var a1=32,O5=1e4,Uu=(e)=>("headers"in e),l1=async(e,t=Object.create(null))=>{let{all:n=!1,dot:r=!1}=t,s=(Uu(e)?e.headers:e.raw.headers).get("Content-Type")?.split(";")[0].trim().toLowerCase();if(s==="multipart/form-data"||s==="application/x-www-form-urlencoded")return I5(e,{all:n,dot:r});return{}};async function I5(e,t){if(!Uu(e)&&e.bodyCache.formData)return c1(await e.bodyCache.formData,t);let n=Uu(e)?e.headers:e.raw.headers,r=await e.arrayBuffer(),i=s1(r,n.get("Content-Type")||"");if(!Uu(e))e.bodyCache.formData=i;let o=await i;if(o)return c1(o,t);return{}}function c1(e,t){let n=Object.create(null),r={count:0};if(e.forEach((i,o)=>{if(!(t.all||o.endsWith("[]")))n[o]=i;else M5(n,o,i)}),t.dot)Object.entries(n).forEach(([i,o])=>{if(i.includes("."))B5(n,i,o,r),delete n[i]});return n}var M5=(e,t,n)=>{if(e[t]!==void 0)if(Array.isArray(e[t]))e[t].push(n);else e[t]=[e[t],n];else if(!t.endsWith("[]"))e[t]=n;else e[t]=[n]},B5=(e,t,n,r)=>{if(/(?:^|\.)__proto__\./.test(t))return;let i=e,o=t.split(".",a1+2);if(o.length>a1+1)u1();o.forEach((s,a)=>{if(a===o.length-1)i[s]=n;else{if(!i[s]||typeof i[s]!=="object"||Array.isArray(i[s])||i[s]instanceof File){if(r.count++>=O5)u1();i[s]=Object.create(null)}i=i[s]}})},u1=()=>{throw Error("Nesting limit exceeded")};fi();var b1=class{raw;#e;#t;routeIndex=0;path;bodyCache={};constructor(e,t="/",n=[[]]){this.raw=e,this.path=t,this.#t=n}param(e){return e?this.#n(e):this.#o()}#n(e){let t=this.#t[0][this.routeIndex]?.[1][e],n=this.#i(t);return n&&Fu(n)}#o(){let e={},t=Object.keys(this.#t[0][this.routeIndex]?.[1]??{});for(let n of t){let r=this.#i(this.#t[0][this.routeIndex][1][n]);if(r!==void 0)e[n]=Fu(r)}return e}#i(e){return this.#t[1]?this.#t[1][e]:e}query(e){return m1(this.url,e)}queries(e){return y1(this.url,e)}header(e){if(e)return this.raw.headers.get(e)??void 0;let t=Object.create(null);return this.raw.headers.forEach((n,r)=>{t[r]=n}),t}async parseBody(e){return l1(this,e)}#r=(e)=>{let{bodyCache:t,raw:n}=this,r=t[e];if(r)return r;for(let i in t)return t[i].then((o)=>{if(i==="json")o=JSON.stringify(o);return new Response(o)[e]()});return t[e]=n[e]()};json(){return this.#r("text").then((e)=>JSON.parse(e))}text(){return this.#r("text")}arrayBuffer(){return this.#r("arrayBuffer")}bytes(){return this.#r("arrayBuffer").then((e)=>new Uint8Array(e))}blob(){return this.#r("blob")}formData(){return this.#r("formData")}addValidatedData(e,t){(this.#e??={})[e]=t}valid(e){return this.#e?.[e]}get url(){return this.raw.url}get method(){return this.raw.method}get[o1](){return this.#t}get matchedRoutes(){return this.#t[0].map(([[,e]])=>e)}get routePath(){return this.#t[0].map(([[,e]])=>e)[this.routeIndex].path}};cp();var j5="text/plain; charset=UTF-8",up=(e,t)=>({"Content-Type":e,...t}),Qs=(e,t)=>new Response(e,t),lp=class{#e;#t;env={};#n;finalized=!1;error;#o;#i;#r;#c;#s;#a;#l;#d;#f;constructor(e,t){if(this.#e=e,t)this.#i=t.executionCtx,this.env=t.env,this.#a=t.notFoundHandler,this.#f=t.path,this.#d=t.matchResult}get req(){return this.#t??=new b1(this.#e,this.#f,this.#d),this.#t}get event(){if(this.#i&&"respondWith"in this.#i)return this.#i;else throw Error("This context has no FetchEvent")}get executionCtx(){if(this.#i)return this.#i;else throw Error("This context has no ExecutionContext")}get res(){return this.#r||=Qs(null,{headers:this.#l??=new Headers})}set res(e){if(this.#r&&e){e=Qs(e.body,e);for(let[t,n]of this.#r.headers.entries()){if(t==="content-type")continue;if(t==="set-cookie"){let r=this.#r.headers.getSetCookie();e.headers.delete("set-cookie");for(let i of r)e.headers.append("set-cookie",i)}else e.headers.set(t,n)}}this.#r=e,this.finalized=!0}render=(...e)=>(this.#s??=(t)=>this.html(t),this.#s(...e));setLayout=(e)=>this.#c=e;getLayout=()=>this.#c;setRenderer=(e)=>{this.#s=e};header=(e,t,n)=>{if(this.finalized)this.#r=Qs(this.#r.body,this.#r);let r=this.#r?this.#r.headers:this.#l??=new Headers;if(t===void 0)r.delete(e);else if(n?.append)r.append(e,t);else r.set(e,t)};status=(e)=>{this.#o=e};set=(e,t)=>{this.#n??=new Map,this.#n.set(e,t)};get=(e)=>this.#n?this.#n.get(e):void 0;get var(){if(!this.#n)return{};return Object.fromEntries(this.#n)}#u(e,t,n){let r=this.#r?new Headers(this.#r.headers):this.#l;if(typeof t==="object"&&t.headers){r??=new Headers;for(let[o,s]of new Headers(t.headers))if(o==="set-cookie")r.append(o,s);else r.set(o,s)}if(n){if(!r){let o=0;for(let s in n)if(++o>1||typeof n[s]!=="string"){r=new Headers;break}}if(r)for(let o in n){let s=n[o];if(typeof s==="string")r.set(o,s);else{r.delete(o);for(let a of s)r.append(o,a)}}}let i=typeof t==="number"?t:t?.status??this.#o;return Qs(e,{status:i,headers:r??n})}newResponse=(...e)=>this.#u(...e);body=(e,t,n)=>this.#u(e,t,n);text=(e,t,n)=>!this.#l&&!this.#o&&!t&&!n&&!this.finalized?new Response(e):this.#u(e,t,up(j5,n));json=(e,t,n)=>this.#u(JSON.stringify(e),t,up("application/json",n));html=(e,t,n)=>{let r=(i)=>this.#u(i,t,up("text/html; charset=UTF-8",n));return typeof e==="object"?ap(e,v1.Stringify,!1,{}).then(r):r(e)};redirect=(e,t)=>{let n=String(e);return this.header("Location",!/[^\x00-\xFF]/.test(n)?n:encodeURI(n)),this.newResponse(null,t??302)};notFound=()=>(this.#a??=()=>Qs(),this.#a(this))};wr();dp();fi();var q5=(e)=>e.text("404 Not Found",404),D1=(e,t)=>{if("getResponse"in e){let n=e.getResponse();return t.newResponse(n.body,n)}return console.error(e),t.text("Internal Server Error",500)},E1=class e{get;post;put;delete;options;patch;query;all;on;use;router;getPath;_basePath="/";#e="/";routes=[];constructor(t={}){[..._1,w1].forEach((o)=>{this[o]=(s,...a)=>{if(typeof s==="string")this.#e=s;else this.#o(o,this.#e,s);return a.forEach((c)=>{this.#o(o,this.#e,c)}),this}}),this.on=(o,s,...a)=>{for(let c of[s].flat()){this.#e=c;for(let d of[o].flat())a.map((u)=>{this.#o(d.toUpperCase(),this.#e,u)})}return this},this.use=(o,...s)=>{if(typeof o==="string")this.#e=o;else this.#e="*",s.unshift(o);return s.forEach((a)=>{this.#o($e,this.#e,a)}),this};let{strict:r,...i}=t;Object.assign(this,i),this.getPath=r??!0?t.getPath??sp:p1}#t(){let t=new e({router:this.router,getPath:this.getPath});return t.errorHandler=this.errorHandler,t.#n=this.#n,t.routes=this.routes,t}#n=q5;errorHandler=D1;route(t,n){let r=this.basePath(t);return n.routes.map((i)=>{let o;if(n.errorHandler===D1)o=i.handler;else o=async(s,a)=>(await np([],n.errorHandler)(s,()=>i.handler(s,a))).res,o[ea]=i.handler;r.#o(i.method,i.path,o,i.basePath)}),this}basePath(t){let n=this.#t();return n._basePath=xr(this._basePath,t),n}onError=(t)=>(this.errorHandler=t,this);notFound=(t)=>(this.#n=t,this);mount(t,n,r){let i,o;if(r)if(typeof r==="function")o=r;else if(o=r.optionHandler,r.replaceRequest===!1)i=(c)=>c;else i=r.replaceRequest;let s=o?(c)=>{let d=o(c);return Array.isArray(d)?d:[d]}:(c)=>{let d=void 0;try{d=c.executionCtx}catch{}return[c.env,d]};i||=(()=>{let c=xr(this._basePath,t),d=c==="/"?0:c.length;return(u)=>{let f=new URL(u.url);return f.pathname=this.getPath(u).slice(d)||"/",new Request(f,u)}})();let a=async(c,d)=>{let u=await n(i(c.req.raw),...s(c));if(u)return u;await d()};return this.#o($e,xr(t,"*"),a),this}#o(t,n,r,i){t=t.toUpperCase(),n=xr(this._basePath,n);let o={basePath:i!==void 0?xr(this._basePath,i):this._basePath,path:n,method:t,handler:r};this.router.add(t,n,[r,o]),this.routes.push(o)}#i(t,n){if(t instanceof Error)return this.errorHandler(t,n);throw t}#r(t,n,r,i){if(i==="HEAD")return(async()=>new Response(null,await this.#r(t,n,r,"GET")))();let o=this.getPath(t,{env:r}),s=this.router.match(i,o),a=new lp(t,{path:o,matchResult:s,env:r,executionCtx:n,notFoundHandler:this.#n});if(s[0].length===1){let d;try{d=s[0][0][0][0](a,async()=>{a.res=await this.#n(a)})}catch(u){return this.#i(u,a)}return d instanceof Promise?d.then((u)=>u||(a.finalized?a.res:this.#n(a))).catch((u)=>this.#i(u,a)):d??this.#n(a)}let c=np(s[0],this.errorHandler,this.#n);return(async()=>{try{let d=await c(a);if(!d.finalized)throw Error("Context is not finalized. Did you forget to return a Response object or `await next()`?");return d.res}catch(d){return this.#i(d,a)}})()}fetch=(t,...n)=>this.#r(t,n[1],n[0],t.method);request=(t,n,r,i)=>{if(t instanceof Request)return this.fetch(n?new Request(t,n):t,r,i);return t=t.toString(),this.fetch(new Request(/^https?:\/\//.test(t)?t:`http://localhost${xr("/",t)}`,n),r,i)};fire=()=>{addEventListener("fetch",(t)=>{t.respondWith(this.#r(t.request,t,void 0,t.request.method))})}};wr();fi();var Xe=()=>Object.create(null);wr();var Iu=[];function fp(e,t){let n=this.buildAllMatchers(),r=(i,o)=>{let s=n[i]||n[$e],a=s[2][o];if(a)return a;let c=o.match(s[0]);if(!c)return[[],Iu];let d=c.indexOf("",1);return[s[1][d],c]};return this.match=r,r(e,t)}var co="[^/]+",Dr=".*",Gn="(?:|/.*)",_r=Symbol(),S1=new Set(".\\+*[^]$()");function $5(e,t){if(e.length===1)return t.length===1?e<t?-1:1:-1;if(t.length===1)return 1;if(e===Dr||e===Gn)return t===Gn?-1:1;else if(t===Dr||t===Gn)return-1;if(e===co)return 1;else if(t===co)return-1;return e.length===t.length?e<t?-1:1:t.length-e.length}var T1=class e{#e;#t;#n=Xe();insert(t,n,r,i,o){let s=this;for(let a=0,c=t.length;a<c;a++){let d=t[a],u=d.length===1?d==="*"?a===c-1?["","",Dr]:["","",co]:null:d==="/*"?["","",Gn]:d.match(/^\:([^\{\}]+)(?:\{(.+)\})?$/),f;if(u){let h=u[1],p=u[2]||co;if(h&&u[2]){if(p===".*")throw _r;if(p=p.replace(/^\((?!\?:)(?=[^)]+\)$)/,"(?:"),/\((?!\?:)/.test(p))throw _r;if(p.length===1&&S1.has(p))throw _r}if(f=s.#n[p],!f){if(p!==Dr&&p!==Gn){for(let g in s.#n)if((p.length>1||g.length>1)&&g!==Dr&&g!==Gn)throw _r}f=s.#n[p]=new e}if(h!=="")f.#t??=i.varIndex++,r.push([h,f.#t])}else if(f=s.#n[d],!f){for(let h in s.#n)if(h.length>1&&h!==Dr&&h!==Gn)throw _r;f=s.#n[d]=new e}s=f}if(s.#e!==void 0)throw _r;s.#e=o?-1:n}buildRegExpStr(){let n=Object.keys(this.#n).sort($5).map((r)=>{let i=this.#n[r],o=i.buildRegExpStr();return o===""?"":(typeof i.#t==="number"?`(${r})@${i.#t}`:S1.has(r)?`\\${r}`:r)+o}).filter(Boolean);if(typeof this.#e==="number"&&this.#e!==-1)n.unshift(`#${this.#e}`);if(n.length===0)return"";if(n.length===1)return n[0];return"(?:"+n.join("|")+")"}};var hp=class{#e={varIndex:0};#t=new T1;#n=0;paths=Xe();insert(e,t){if(t){this.#t.insert(e.split(""),0,[],this.#e,!0);return}let n=[],r=[],i=e;for(let s=0;;){let a=!1;if(i=i.replace(/\{[^}]+\}/g,(c)=>{let d=`@\\${s}`;return r[s]=[d,c],s++,a=!0,d}),!a)break}let o=i.match(/(?::[^\/]+)|(?:\/\*$)|./g)||[];for(let s=r.length-1;s>=0;s--){let[a]=r[s];for(let c=o.length-1;c>=0;c--)if(o[c].indexOf(a)!==-1){o[c]=o[c].replace(a,r[s][1]);break}}this.#t.insert(o,this.#n,n,this.#e,!1),this.paths[e]=[this.#n++,n]}buildRegExp(){let e=this.#t.buildRegExpStr();if(e==="")return[/^$/,[],[]];let t=0,n=[],r=[];return e=e.replace(/#(\d+)|@(\d+)|\.\*\$/g,(i,o,s)=>{if(o!==void 0)return n[++t]=Number(o),"$()";if(s!==void 0)return r[Number(s)]=++t,"";return""}),[new RegExp(`^${e}`),n,r]}};var C1=Xe();function A1(e){return C1[e]??=new RegExp(`^${e.replace(/\/:[^/{}]+(?:\{\[\^\/]\+})?(?=[/{]|$)|\/?\*$|([.\\+*[^\]$()?{}|])/g,(t,n)=>n?`\\${n}`:t==="/*"?Gn:t==="*"?Dr:`/:${co}`)}$`)}function Mu(e,t){for(let n of Object.keys(e).sort((r,i)=>i.length-r.length))if(A1(n).test(t))return[...e[n]];return}var Bu=class{name="RegExpRouter";#e;#t;#n;constructor(){this.#e={[$e]:Xe()},this.#t={[$e]:Xe()},this.#n={[$e]:new hp}}#o(e,t){try{this.#n[e].insert(t,!/\*|\/:/.test(t))}catch(n){throw n===_r?new Ou(t):n}}add(e,t,n){let r=this.#e,i=this.#t;if(!r)throw Error(Pu);if(!r[e]){this.#n[e]=new hp;for(let a of[r,i]){a[e]=Xe();for(let c in a[$e])a[e][c]=[...a[$e][c]],this.#o(e,c)}}if(t==="/*")t="*";let o=e===$e?Object.keys(r):[e];if(/\*$/.test(t)){let a=A1(t);for(let c of o)if(!r[c][t])this.#o(c,t),r[c][t]=Mu(r[c],t)||Mu(r[$e],t)||[];for(let c of[r,i])for(let d of o)for(let u in c[d])a.test(u)&&c[d][u].push([n,t]);return}let s=Ru(t)||[t];for(let a of s)for(let c of o){if(!i[c][a])this.#o(c,a),i[c][a]=Mu(r[c],a)||Mu(r[$e],a)||[];i[c][a].push([n,a])}}match=fp;buildAllMatchers(){let e=Xe();for(let t of Object.keys(this.#t))e[t]=this.#i(t);return this.#e=this.#t=this.#n=void 0,C1=Xe(),e}#i(e){let t=this.#e[e],n=this.#t[e],r=this.#n[e],i=Xe(),o=[],[s,a,c]=r.buildRegExp();for(let d of[t,n])for(let u in d){let f=d[u],h=r.paths[u];if(!h){i[u]=[f.map(([p])=>[p,Xe()]),Iu];continue}o[h[0]]=f.map(([p,g])=>[p,r.paths[g][1].reduceRight((b,[v],y)=>(b[v]=c[h[1][y][1]],b),Xe())])}return[s,a.map((d)=>o[d]),i]}};wr();wr();var pp=class{name="SmartRouter";#e=[];#t=[];constructor(e){this.#e=e.routers}add(e,t,n){if(!this.#t)throw Error(Pu);this.#t.push([e,t,n])}match(e,t){if(!this.#t)throw Error("Fatal error");let n=this.#e,r=this.#t,i=n.length,o=0,s;for(;o<i;o++){let a=n[o];try{for(let c=0,d=r.length;c<d;c++)a.add(...r[c]);s=a.match(e,t)}catch(c){if(c instanceof Ou)continue;throw c}this.match=a.match.bind(a),this.#e=[a],this.#t=void 0;break}if(o===i)throw Error("Fatal error");return this.name=`SmartRouter + ${this.activeRouter.name}`,s}get activeRouter(){if(this.#t||this.#e.length!==1)throw Error("No active router has been determined yet.");return this.#e[0]}};fi();wr();fi();var gp=Xe(),H5=0,U1=class e{#e=[];#t=Xe();#n=[];#o;#i=gp;insert(t,n,r){let i=this,o=d1(n),s=new Set,a=0;for(let c of o){let d=o[++a],u=f1(c,d)||(d===void 0&&c&&c.indexOf("*")===c.length-1?c:null),f=Array.isArray(u),h=f?u[0]:u||c,p=i.#t[h]||=new e;if(u&&!p.#o)p.#o=u,i.#n.push(p);if(i=p,f)s.add(u[1])}i.#e.push({[t]:{handler:r,possibleKeys:[...s],score:++H5}})}#r(t,n,r,i,o){for(let s=0,a=n.#e.length;s<a;s++){let c=n.#e[s],d=c[r]||c[$e];if(d){d.params=Xe(),t.push(d);for(let u=0,f=d.possibleKeys.length;u<f;u++){let h=d.possibleKeys[u];d.params[h]=o?.[h]&&!u?o[h]:i[h]??o?.[h]}}}}search(t,n){let r=[];this.#i=gp;let o=[this],s=ip(n),a=[],c=s.length,d=null;for(let u=0;u<c;u++){let f=s[u],h=u===c-1,p=[];for(let b=0,v=o.length;b<v;b++){let y=o[b],x=y.#t[f];if(x)if(x.#i=y.#i,h){if(x.#t["*"])this.#r(r,x.#t["*"],t,y.#i);this.#r(r,x,t,y.#i)}else p.push(x);for(let m of y.#n){let w=m.#o,D=y.#i===gp?{}:{...y.#i};if(typeof w==="string"){if(w==="*"||f.startsWith(w.slice(0,-1))){if(this.#r(r,m,t,y.#i),w==="*")m.#i=D,p.push(m)}continue}let[,C,_]=w;if(!f&&_===!0)continue;if(_!==!0){if(!d){d=[];let B=n[0]==="/"?1:0;for(let F=0;F<c;F++)d[F]=B,B+=s[F].length+1}let A=n.slice(d[u]),S=_.exec(A);if(S){if(D[C]=S[0],this.#r(r,m,t,y.#i,D),S[0].length===A.length&&m.#t["*"])this.#r(r,m.#t["*"],t,y.#i,D);for(let B in m.#t){m.#i=D;let F=S[0].match(/\//g)?.length??0;(a[F]||=[]).push(m);break}continue}}if(_===!0||_.test(f))if(D[C]=f,h){if(this.#r(r,m,t,D,y.#i),m.#t["*"])this.#r(r,m.#t["*"],t,D,y.#i)}else m.#i=D,p.push(m)}}let g=a.shift();o=g?p.concat(g):p}if(r[1])r.sort((u,f)=>u.score-f.score);return[r.map(({handler:u,params:f})=>[u,f])]}};var mp=class{name="TrieRouter";#e=new U1;add(e,t,n){for(let r of Ru(t)||[t])this.#e.insert(e,r,n)}match(e,t){return this.#e.search(e,t)}};var yp=class extends E1{constructor(e={}){super(e);this.router=e.router??new pp({routers:[new Bu,new mp]})}};function bp(){let e={};return e.promise=new Promise((t,n)=>{e.resolve=t,e.reject=n}),e}import{execFile as G5}from"node:child_process";import uo from"node:path";import{promisify as z5}from"node:util";var ta=z5(G5),Nu=1e4,k1=120000,na=8388608;async function bt(e,t,n=na,r=Nu){let{stdout:i}=await ta("git",["-C",e,...t],{timeout:r,maxBuffer:n,env:{...process.env,LC_ALL:"C"}});return i}async function Ct(e){try{return(await bt(e,["rev-parse","--show-toplevel"])).trim()||null}catch{return null}}function hi(e,t){let n=uo.relative(uo.resolve(e),uo.resolve(t));return n===""||!n.startsWith(`..${uo.sep}`)&&n!==".."&&!uo.isAbsolute(n)}function Er(e){return e.split(uo.sep).join("/")}function Lu(e){return e.includes(0)}import{lstat as nB,readFile as rB}from"node:fs/promises";import M1 from"node:path";var pi=262144,R1=10485760,F1=10485760,V5={png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",webp:"image/webp",svg:"image/svg+xml",bmp:"image/bmp",ico:"image/x-icon",avif:"image/avif"},X5={mp3:"audio/mpeg",wav:"audio/wav",ogg:"audio/ogg",oga:"audio/ogg",opus:"audio/ogg",m4a:"audio/mp4",aac:"audio/aac",flac:"audio/flac",weba:"audio/webm",webm:"audio/webm"},K5={pdf:"application/pdf",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"};function Z5(e){return e.replace(/\\/g,"/").split("/").pop()??""}function lo(e){return Z5(e).toLowerCase().split(".").pop()??""}function Wu(e){return V5[lo(e)]??null}function ju(e){return X5[lo(e)]??null}function qu(e){return K5[lo(e)]??null}function P1(e){let t=lo(e);if(t==="pdf"||t==="docx")return t;return null}function Y5(e,t){return e==="R"||e==="C"||t==="R"||t==="C"}function O1(e){let t=e.split("\x00"),n=[];for(let r=0;r<t.length;r++){let i=t[r];if(!i||i.length<4||i[2]!==" ")continue;let o=i[0],s=i[1],a={path:i.slice(3),indexStatus:o,worktreeStatus:s};if(Y5(o,s))a.originalPath=t[++r]||void 0;n.push(a)}return n}var J5=new Set(["DD","AU","UD","UA","DU","AA","UU"]);function $u(e){let t=`${e.indexStatus}${e.worktreeStatus}`;if(t==="??")return{status:"untracked",code:"U"};if(J5.has(t)||t.includes("U"))return{status:"conflict",code:"C"};if(t.includes("D"))return{status:"deleted",code:"D"};if(t.includes("R")||t.includes("C"))return{status:"renamed",code:"R"};if(t.includes("A"))return{status:"added",code:"A"};return{status:"modified",code:"M"}}import{lstat as Q5,readFile as eB}from"node:fs/promises";import vp from"node:path";async function xp(e){let t=await bt(e,["status","--porcelain=v1","-z","--untracked-files=all"]);return O1(t)}async function I1(e,t,n){let i=Er(vp.relative(e,t))||".";try{let o=await bt(e,["diff","--no-color","--no-ext-diff","--numstat",...n,"--",i]),s=new Map;for(let a of o.split(/\r?\n/)){if(!a)continue;let[c,d,...u]=a.split("\t");if(u.length===0)continue;let f=Number(c),h=Number(d);if(!Number.isInteger(f)||!Number.isInteger(h))continue;let p=u.join("\t"),g=p.indexOf(" => ");if(g!==-1)p=p.slice(g+4);s.set(Er(p.trim()),{additions:f,deletions:h})}return s}catch{return new Map}}async function tB(e){try{let t=await Q5(e);if(!t.isFile()||t.size>pi)return 0;let n=await eB(e);if(Lu(n)||n.length===0)return 0;let r=n.toString("utf8");return r.endsWith(`
260
260
  `)?r.split(`
261
261
  `).length-1:r.split(`
262
262
  `).length}catch{return 0}}async function Hu(e){try{let n=(await bt(e,["rev-parse","--abbrev-ref","HEAD"])).trim()||null;if(!n||n==="HEAD")return{branch:n,upstream:null,ahead:0,behind:0,hasUpstream:!1};let r=null,i=!1;try{r=(await bt(e,["rev-parse","--abbrev-ref","--symbolic-full-name","@{u}"])).trim()||null,i=!!r}catch{return{branch:n,upstream:null,ahead:0,behind:0,hasUpstream:!1}}if(!i||!r)return{branch:n,upstream:null,ahead:0,behind:0,hasUpstream:!1};try{let s=(await bt(e,["rev-list","--left-right","--count","HEAD...@{u}"])).trim().split(/\s+/).map((d)=>Number(d)),a=Number.isInteger(s[0])?s[0]:0,c=Number.isInteger(s[1])?s[1]:0;return{branch:n,upstream:r,ahead:a,behind:c,hasUpstream:!0}}catch{return{branch:n,upstream:r,ahead:0,behind:0,hasUpstream:!0}}}catch{return{branch:null,upstream:null,ahead:0,behind:0,hasUpstream:!1}}}async function wp(e){let t=await Ct(e);if(!t)return{isGitRepository:!1,repositoryRoot:null,files:[],additions:0,deletions:0,stagedFiles:[],stagedAdditions:0,stagedDeletions:0,branch:null,upstream:null,ahead:0,behind:0,hasUpstream:!1};let[n,r,i,o]=await Promise.all([xp(t),I1(t,e,[]),I1(t,e,["--cached"]),Hu(t)]),s=[],a=[];for(let g of n){let b=vp.resolve(t,g.path);if(!hi(e,b))continue;let v=$u(g),y={filePath:b,...v,indexStatus:g.indexStatus,worktreeStatus:g.worktreeStatus},x=g.indexStatus!==" "&&g.indexStatus!=="?",m=g.worktreeStatus!==" ";if(x)a.push({...y,lineStats:i.get(g.path)});if(m)s.push({...y,lineStats:r.get(g.path)})}let c=await Promise.all(s.map(async(g)=>g.status==="untracked"?{filePath:g.filePath,additions:await tB(g.filePath)}:{filePath:g.filePath,additions:0})),d=new Map(c.map((g)=>[g.filePath,g.additions])),u=[...d.values()].reduce((g,b)=>g+b,0);for(let g of s){if(g.status!=="untracked")continue;let b=d.get(g.filePath)??0;if(b>0)g.lineStats={additions:b,deletions:0}}let f=(g)=>{let b=0,v=0;for(let y of g.values())b+=y.additions,v+=y.deletions;return{additions:b,deletions:v}},h=f(r),p=f(i);return{isGitRepository:!0,repositoryRoot:t,files:s,additions:h.additions+u,deletions:h.deletions,stagedFiles:a,stagedAdditions:p.additions,stagedDeletions:p.deletions,...o}}function B1(e,t){let n=t.endsWith(`