auto-coder-web 0.1.60__py3-none-any.whl → 0.1.62__py3-none-any.whl

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 (111) hide show
  1. auto_coder_web/common_router/auto_coder_conf_router.py +3 -3
  2. auto_coder_web/common_router/completions_router.py +15 -8
  3. auto_coder_web/common_router/file_router.py +39 -14
  4. auto_coder_web/expert_routers/history_router.py +1 -1
  5. auto_coder_web/file_manager.py +178 -3
  6. auto_coder_web/proxy.py +3 -1
  7. auto_coder_web/routers/auto_router.py +1 -1
  8. auto_coder_web/routers/chat_router.py +2 -2
  9. auto_coder_web/routers/coding_router.py +3 -3
  10. auto_coder_web/routers/commit_router.py +1 -1
  11. auto_coder_web/routers/config_router.py +9 -4
  12. auto_coder_web/routers/editable_preview_router.py +202 -0
  13. auto_coder_web/routers/mcp_router.py +287 -62
  14. auto_coder_web/version.py +1 -1
  15. auto_coder_web/web/HistoryPanel-WXEMtQ1V.js +1 -0
  16. auto_coder_web/web/bridge.js +189 -0
  17. auto_coder_web/web/{assets/cssMode-C28WkqEl.js → cssMode-CQYz0o1d.js} +1 -1
  18. auto_coder_web/web/{assets/freemarker2-ZqPV3OAn.js → freemarker2-BJU3cSen.js} +1 -1
  19. auto_coder_web/web/{assets/handlebars-BeVH6MoZ.js → handlebars-VxUdciXQ.js} +1 -1
  20. auto_coder_web/web/{assets/html-CbnuufYM.js → html-DEgskwXL.js} +1 -1
  21. auto_coder_web/web/{assets/htmlMode-CpsZVLwy.js → htmlMode-58cXxJlI.js} +1 -1
  22. auto_coder_web/web/index.html +2 -2
  23. auto_coder_web/web/{assets/javascript-CUA7SFHC.js → javascript-DbZlm-ig.js} +1 -1
  24. auto_coder_web/web/{assets/jsonMode-BzAAFwlN.js → jsonMode-C2HKgmE0.js} +1 -1
  25. auto_coder_web/web/{assets/liquid-B1UkAnrE.js → liquid-BFft-XkQ.js} +1 -1
  26. auto_coder_web/web/main-DxnFm18B.css +32 -0
  27. auto_coder_web/web/{assets/index-U694gZ5i.js → main.js} +372 -359
  28. auto_coder_web/web/{assets/mdx-2eOqd4a8.js → mdx-DZdDhrJW.js} +1 -1
  29. auto_coder_web/web/{assets/python-DadwP7sa.js → python-DOHUGzLU.js} +1 -1
  30. auto_coder_web/web/{assets/razor-CCybM3Rs.js → razor-Dh5mSHi2.js} +1 -1
  31. auto_coder_web/web/{assets/tsMode-Bk47zhhf.js → tsMode-tyI6CeIR.js} +1 -1
  32. auto_coder_web/web/{assets/typescript-vvCv9Db5.js → typescript-DZzM_VgT.js} +1 -1
  33. auto_coder_web/web/{assets/xml-CLM5-Fko.js → xml-Dl6413Na.js} +1 -1
  34. auto_coder_web/web/{assets/yaml-BF217FNY.js → yaml-DML583wh.js} +1 -1
  35. {auto_coder_web-0.1.60.dist-info → auto_coder_web-0.1.62.dist-info}/METADATA +2 -2
  36. {auto_coder_web-0.1.60.dist-info → auto_coder_web-0.1.62.dist-info}/RECORD +110 -107
  37. auto_coder_web/web/assets/index-Bnnll9cx.css +0 -32
  38. /auto_coder_web/web/{assets/abap-BrgZPUOV.js → abap-BrgZPUOV.js} +0 -0
  39. /auto_coder_web/web/{assets/apex-DyP6w7ZV.js → apex-DyP6w7ZV.js} +0 -0
  40. /auto_coder_web/web/{assets/azcli-BaLxmfj-.js → azcli-BaLxmfj-.js} +0 -0
  41. /auto_coder_web/web/{assets/bat-CFOPXBzS.js → bat-CFOPXBzS.js} +0 -0
  42. /auto_coder_web/web/{assets/bicep-BfEKNvv3.js → bicep-BfEKNvv3.js} +0 -0
  43. /auto_coder_web/web/{assets/cameligo-BFG1Mk7z.js → cameligo-BFG1Mk7z.js} +0 -0
  44. /auto_coder_web/web/{assets/clojure-DTECt2xU.js → clojure-DTECt2xU.js} +0 -0
  45. /auto_coder_web/web/{assets/codicon-DCmgc-ay.ttf → codicon-DCmgc-ay.ttf} +0 -0
  46. /auto_coder_web/web/{assets/coffee-CDGzqUPQ.js → coffee-CDGzqUPQ.js} +0 -0
  47. /auto_coder_web/web/{assets/cpp-CLLBncYj.js → cpp-CLLBncYj.js} +0 -0
  48. /auto_coder_web/web/{assets/csharp-dUCx_-0o.js → csharp-dUCx_-0o.js} +0 -0
  49. /auto_coder_web/web/{assets/csp-5Rap-vPy.js → csp-5Rap-vPy.js} +0 -0
  50. /auto_coder_web/web/{assets/css-D3h14YRZ.js → css-D3h14YRZ.js} +0 -0
  51. /auto_coder_web/web/{assets/cypher-DrQuvNYM.js → cypher-DrQuvNYM.js} +0 -0
  52. /auto_coder_web/web/{assets/dart-CFKIUWau.js → dart-CFKIUWau.js} +0 -0
  53. /auto_coder_web/web/{assets/dockerfile-Zznr-cwX.js → dockerfile-Zznr-cwX.js} +0 -0
  54. /auto_coder_web/web/{assets/ecl-Ce3n6wWz.js → ecl-Ce3n6wWz.js} +0 -0
  55. /auto_coder_web/web/{assets/elixir-deUWdS0T.js → elixir-deUWdS0T.js} +0 -0
  56. /auto_coder_web/web/{assets/flow9-i9-g7ZhI.js → flow9-i9-g7ZhI.js} +0 -0
  57. /auto_coder_web/web/{assets/fsharp-CzKuDChf.js → fsharp-CzKuDChf.js} +0 -0
  58. /auto_coder_web/web/{assets/go-Cphgjts3.js → go-Cphgjts3.js} +0 -0
  59. /auto_coder_web/web/{assets/graphql-Cg7bfA9N.js → graphql-Cg7bfA9N.js} +0 -0
  60. /auto_coder_web/web/{assets/hcl-0cvrggvQ.js → hcl-0cvrggvQ.js} +0 -0
  61. /auto_coder_web/web/{assets/ini-Drc7WvVn.js → ini-Drc7WvVn.js} +0 -0
  62. /auto_coder_web/web/{assets/java-B_fMsGYe.js → java-B_fMsGYe.js} +0 -0
  63. /auto_coder_web/web/{assets/julia-Bqgm2twL.js → julia-Bqgm2twL.js} +0 -0
  64. /auto_coder_web/web/{assets/kotlin-BSkB5QuD.js → kotlin-BSkB5QuD.js} +0 -0
  65. /auto_coder_web/web/{assets/less-BsTHnhdd.js → less-BsTHnhdd.js} +0 -0
  66. /auto_coder_web/web/{assets/lexon-YWi4-JPR.js → lexon-YWi4-JPR.js} +0 -0
  67. /auto_coder_web/web/{assets/lua-nf6ki56Z.js → lua-nf6ki56Z.js} +0 -0
  68. /auto_coder_web/web/{assets/m3-Cpb6xl2v.js → m3-Cpb6xl2v.js} +0 -0
  69. /auto_coder_web/web/{assets/markdown-DSZPf7rp.js → markdown-DSZPf7rp.js} +0 -0
  70. /auto_coder_web/web/{assets/mips-B_c3zf-v.js → mips-B_c3zf-v.js} +0 -0
  71. /auto_coder_web/web/{assets/msdax-rUNN04Wq.js → msdax-rUNN04Wq.js} +0 -0
  72. /auto_coder_web/web/{assets/mysql-DDwshQtU.js → mysql-DDwshQtU.js} +0 -0
  73. /auto_coder_web/web/{assets/objective-c-B5zXfXm9.js → objective-c-B5zXfXm9.js} +0 -0
  74. /auto_coder_web/web/{assets/pascal-CXOwvkN_.js → pascal-CXOwvkN_.js} +0 -0
  75. /auto_coder_web/web/{assets/pascaligo-Bc-ZgV77.js → pascaligo-Bc-ZgV77.js} +0 -0
  76. /auto_coder_web/web/{assets/perl-CwNk8-XU.js → perl-CwNk8-XU.js} +0 -0
  77. /auto_coder_web/web/{assets/pgsql-tGk8EFnU.js → pgsql-tGk8EFnU.js} +0 -0
  78. /auto_coder_web/web/{assets/php-CpIb_Oan.js → php-CpIb_Oan.js} +0 -0
  79. /auto_coder_web/web/{assets/pla-B03wrqEc.js → pla-B03wrqEc.js} +0 -0
  80. /auto_coder_web/web/{assets/postiats-BKlk5iyT.js → postiats-BKlk5iyT.js} +0 -0
  81. /auto_coder_web/web/{assets/powerquery-Bhzvs7bI.js → powerquery-Bhzvs7bI.js} +0 -0
  82. /auto_coder_web/web/{assets/powershell-Dd3NCNK9.js → powershell-Dd3NCNK9.js} +0 -0
  83. /auto_coder_web/web/{assets/protobuf-COyEY5Pt.js → protobuf-COyEY5Pt.js} +0 -0
  84. /auto_coder_web/web/{assets/pug-BaJupSGV.js → pug-BaJupSGV.js} +0 -0
  85. /auto_coder_web/web/{assets/qsharp-DXyYeYxl.js → qsharp-DXyYeYxl.js} +0 -0
  86. /auto_coder_web/web/{assets/r-CdQndTaG.js → r-CdQndTaG.js} +0 -0
  87. /auto_coder_web/web/{assets/redis-CVwtpugi.js → redis-CVwtpugi.js} +0 -0
  88. /auto_coder_web/web/{assets/redshift-25W9uPmb.js → redshift-25W9uPmb.js} +0 -0
  89. /auto_coder_web/web/{assets/restructuredtext-DfzH4Xui.js → restructuredtext-DfzH4Xui.js} +0 -0
  90. /auto_coder_web/web/{assets/ruby-Cp1zYvxS.js → ruby-Cp1zYvxS.js} +0 -0
  91. /auto_coder_web/web/{assets/rust-D5C2fndG.js → rust-D5C2fndG.js} +0 -0
  92. /auto_coder_web/web/{assets/sb-CDntyWJ8.js → sb-CDntyWJ8.js} +0 -0
  93. /auto_coder_web/web/{assets/scala-BoFRg7Ot.js → scala-BoFRg7Ot.js} +0 -0
  94. /auto_coder_web/web/{assets/scheme-Bio4gycK.js → scheme-Bio4gycK.js} +0 -0
  95. /auto_coder_web/web/{assets/scss-4Ik7cdeQ.js → scss-4Ik7cdeQ.js} +0 -0
  96. /auto_coder_web/web/{assets/shell-CX-rkNHf.js → shell-CX-rkNHf.js} +0 -0
  97. /auto_coder_web/web/{assets/solidity-Tw7wswEv.js → solidity-Tw7wswEv.js} +0 -0
  98. /auto_coder_web/web/{assets/sophia-C5WLch3f.js → sophia-C5WLch3f.js} +0 -0
  99. /auto_coder_web/web/{assets/sparql-DHaeiCBh.js → sparql-DHaeiCBh.js} +0 -0
  100. /auto_coder_web/web/{assets/sql-CCSDG5nI.js → sql-CCSDG5nI.js} +0 -0
  101. /auto_coder_web/web/{assets/st-pnP8ivHi.js → st-pnP8ivHi.js} +0 -0
  102. /auto_coder_web/web/{assets/swift-DwJ7jVG9.js → swift-DwJ7jVG9.js} +0 -0
  103. /auto_coder_web/web/{assets/systemverilog-B9Xyijhd.js → systemverilog-B9Xyijhd.js} +0 -0
  104. /auto_coder_web/web/{assets/tcl-DnHyzjbg.js → tcl-DnHyzjbg.js} +0 -0
  105. /auto_coder_web/web/{assets/twig-CPajHgWi.js → twig-CPajHgWi.js} +0 -0
  106. /auto_coder_web/web/{assets/typespec-D-MeaMDU.js → typespec-D-MeaMDU.js} +0 -0
  107. /auto_coder_web/web/{assets/vb-DgyLZaXg.js → vb-DgyLZaXg.js} +0 -0
  108. /auto_coder_web/web/{assets/wgsl-BIv9DU6q.js → wgsl-BIv9DU6q.js} +0 -0
  109. {auto_coder_web-0.1.60.dist-info → auto_coder_web-0.1.62.dist-info}/WHEEL +0 -0
  110. {auto_coder_web-0.1.60.dist-info → auto_coder_web-0.1.62.dist-info}/entry_points.txt +0 -0
  111. {auto_coder_web-0.1.60.dist-info → auto_coder_web-0.1.62.dist-info}/top_level.txt +0 -0
@@ -0,0 +1 @@
1
+ import{r,I as K,_ as P,j as e,S as Q,T as q,R as ee,a as I,h as se,v as te,b as U,s as b,d as O,l as J,c as re,e as ae,E as ne,B as M,L as z,C as le,f as W,g as oe,i as ie,M as ce}from"./main.js";var de={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M839.6 433.8L749 150.5a9.24 9.24 0 00-8.9-6.5h-77.4c-4.1 0-7.6 2.6-8.9 6.5l-91.3 283.3c-.3.9-.5 1.9-.5 2.9 0 5.1 4.2 9.3 9.3 9.3h56.4c4.2 0 7.8-2.8 9-6.8l17.5-61.6h89l17.3 61.5c1.1 4 4.8 6.8 9 6.8h61.2c1 0 1.9-.1 2.8-.4 2.4-.8 4.3-2.4 5.5-4.6 1.1-2.2 1.3-4.7.6-7.1zM663.3 325.5l32.8-116.9h6.3l32.1 116.9h-71.2zm143.5 492.9H677.2v-.4l132.6-188.9c1.1-1.6 1.7-3.4 1.7-5.4v-36.4c0-5.1-4.2-9.3-9.3-9.3h-204c-5.1 0-9.3 4.2-9.3 9.3v43c0 5.1 4.2 9.3 9.3 9.3h122.6v.4L587.7 828.9a9.35 9.35 0 00-1.7 5.4v36.4c0 5.1 4.2 9.3 9.3 9.3h211.4c5.1 0 9.3-4.2 9.3-9.3v-43a9.2 9.2 0 00-9.2-9.3zM416 702h-76V172c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v530h-76c-6.7 0-10.5 7.8-6.3 13l112 141.9a8 8 0 0012.6 0l112-141.9c4.1-5.2.4-13-6.3-13z"}}]},name:"sort-ascending",theme:"outlined"},he=function(i,l){return r.createElement(K,P({},i,{ref:l,icon:de}))},fe=r.forwardRef(he),ue={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M839.6 433.8L749 150.5a9.24 9.24 0 00-8.9-6.5h-77.4c-4.1 0-7.6 2.6-8.9 6.5l-91.3 283.3c-.3.9-.5 1.9-.5 2.9 0 5.1 4.2 9.3 9.3 9.3h56.4c4.2 0 7.8-2.8 9-6.8l17.5-61.6h89l17.3 61.5c1.1 4 4.8 6.8 9 6.8h61.2c1 0 1.9-.1 2.8-.4 2.4-.8 4.3-2.4 5.5-4.6 1.1-2.2 1.3-4.7.6-7.1zM663.3 325.5l32.8-116.9h6.3l32.1 116.9h-71.2zm143.5 492.9H677.2v-.4l132.6-188.9c1.1-1.6 1.7-3.4 1.7-5.4v-36.4c0-5.1-4.2-9.3-9.3-9.3h-204c-5.1 0-9.3 4.2-9.3 9.3v43c0 5.1 4.2 9.3 9.3 9.3h122.6v.4L587.7 828.9a9.35 9.35 0 00-1.7 5.4v36.4c0 5.1 4.2 9.3 9.3 9.3h211.4c5.1 0 9.3-4.2 9.3-9.3v-43a9.2 9.2 0 00-9.2-9.3zM310.3 167.1a8 8 0 00-12.6 0L185.7 309c-4.2 5.3-.4 13 6.3 13h76v530c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V322h76c6.7 0 10.5-7.8 6.3-13l-112-141.9z"}}]},name:"sort-descending",theme:"outlined"},xe=function(i,l){return r.createElement(K,P({},i,{ref:l,icon:ue}))},me=r.forwardRef(xe),ge={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M511.4 124C290.5 124.3 112 303 112 523.9c0 128 60.2 242 153.8 315.2l-37.5 48c-4.1 5.3-.3 13 6.3 12.9l167-.8c5.2 0 9-4.9 7.7-9.9L369.8 727a8 8 0 00-14.1-3L315 776.1c-10.2-8-20-16.7-29.3-26a318.64 318.64 0 01-68.6-101.7C200.4 609 192 567.1 192 523.9s8.4-85.1 25.1-124.5c16.1-38.1 39.2-72.3 68.6-101.7 29.4-29.4 63.6-52.5 101.7-68.6C426.9 212.4 468.8 204 512 204s85.1 8.4 124.5 25.1c38.1 16.1 72.3 39.2 101.7 68.6 29.4 29.4 52.5 63.6 68.6 101.7 16.7 39.4 25.1 81.3 25.1 124.5s-8.4 85.1-25.1 124.5a318.64 318.64 0 01-68.6 101.7c-7.5 7.5-15.3 14.5-23.4 21.2a7.93 7.93 0 00-1.2 11.1l39.4 50.5c2.8 3.5 7.9 4.1 11.4 1.3C854.5 760.8 912 649.1 912 523.9c0-221.1-179.4-400.2-400.6-399.9z"}}]},name:"undo",theme:"outlined"},pe=function(i,l){return r.createElement(K,P({},i,{ref:l,icon:ge}))},be=r.forwardRef(pe);J.config({paths:{vs:"/monaco-editor/min/vs"},"vs/nls":{availableLanguages:{"*":"zh-cn"}}});const{TabPane:G}=q,ve=({commitId:n,onClose:i})=>{const[l,B]=r.useState({diff:""}),[o,k]=r.useState(null),[c,v]=r.useState(null),[S,R]=r.useState(!1),[f,E]=r.useState("split"),[u,L]=r.useState(null),[m,y]=r.useState(!1),[g,$]=r.useState("1"),j=r.useRef(null),p=r.useRef(null),w=r.useRef(null),N=r.useRef(null),D=async()=>{if(n){y(!0);try{const t=encodeURIComponent(n),a=await U.get(`/api/history/commit-diff/${t}`);a.data.success?B({diff:a.data.diff,file_changes:a.data.file_changes}):b.error(a.data.message||"获取diff失败")}catch(t){console.error("Error fetching diff:",t),b.error("获取diff失败")}finally{y(!1)}}},C=async t=>{if(n)try{R(!0),v(null),j.current=null,p.current=null,w.current=null;const a=encodeURIComponent(n),x=await U.get(`/api/history/file-diff/${a}?file_path=${encodeURIComponent(t)}`);x.data.success?v(x.data.file_diff):b.error(x.data.message||"获取文件差异失败")}catch(a){console.error("Error fetching file diff:",a),b.error("获取文件差异失败")}finally{R(!1)}},F=t=>{o===t?(k(null),v(null),j.current=null,p.current=null,w.current=null,L(null)):(k(t),C(t),L(null))},A=r.useCallback(t=>{j.current=t},[]),T=r.useCallback(t=>{p.current=t},[]),s=r.useCallback(t=>{w.current=t},[]),d=t=>{var _;const a=(_=t.split(".").pop())==null?void 0:_.toLowerCase();return{js:"javascript",jsx:"javascript",ts:"typescript",tsx:"typescript",py:"python",java:"java",c:"c",cpp:"cpp",cs:"csharp",go:"go",rs:"rust",rb:"ruby",php:"php",html:"html",css:"css",scss:"scss",json:"json",md:"markdown",yml:"yaml",yaml:"yaml",xml:"xml",sh:"shell",bash:"shell",txt:"plaintext"}[a||""]||"plaintext"},h=({viewType:t})=>{const a=u===t;return e.jsx("button",{className:"ml-2 text-gray-400 hover:text-white transition-colors",onClick:x=>{x.stopPropagation(),L(a?null:t)},title:a?"恢复正常视图":"最大化视图",children:a?e.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5v-4m0 4h-4m4 0l-5-5"})}):e.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5v-4m0 4h-4m4 0l-5-5"})})})},X=()=>{if(!o||!c)return null;const t=d(o),a=`diff-${n}-${o}-${f}`,x=`before-${n}-${o}`,_=`after-${n}-${o}`,V={readOnly:!0,scrollBeyondLastLine:!1,minimap:{enabled:!1},lineNumbers:"on",wordWrap:"on",automaticLayout:!0,scrollbar:{vertical:"visible",horizontal:"visible",verticalScrollbarSize:14,horizontalScrollbarSize:14}};return f==="unified"?e.jsxs("div",{ref:N,className:"bg-gray-900 rounded-lg border border-gray-700",style:{height:"500px",width:"100%",overflow:"hidden"},children:[e.jsxs("div",{className:"py-1 px-3 bg-gray-800 border-b border-gray-700 text-xs font-medium text-white flex justify-between items-center",children:[e.jsx("span",{children:"差异视图"}),e.jsx(h,{viewType:"diff"})]}),e.jsx(O,{height:"calc(100% - 26px)",width:"100%",defaultLanguage:"diff",value:c.diff_content||"",theme:"vs-dark",onMount:s,options:V,loading:e.jsx("div",{className:"flex items-center justify-center h-full text-white",children:"加载中..."})},a)]}):e.jsxs("div",{ref:N,className:"grid grid-cols-2 gap-2",style:{height:"500px",width:"100%"},children:[(u===null||u==="before")&&e.jsxs("div",{className:`bg-gray-900 rounded-lg border border-gray-700 ${u==="before"?"col-span-2":""}`,style:{overflow:"hidden"},children:[e.jsxs("div",{className:"py-1 px-3 bg-gray-800 border-b border-gray-700 text-xs font-medium text-white flex justify-between items-center",children:[e.jsxs("span",{children:["修改前 (",c.file_status==="added"?"新文件":o,")"]}),e.jsx(h,{viewType:"before"})]}),e.jsx(O,{height:"calc(100% - 26px)",width:"100%",defaultLanguage:t,value:c.before_content||"",theme:"vs-dark",onMount:A,options:V,loading:e.jsx("div",{className:"flex items-center justify-center h-full text-white",children:"加载中..."})},x)]}),(u===null||u==="after")&&e.jsxs("div",{className:`bg-gray-900 rounded-lg border border-gray-700 ${u==="after"?"col-span-2":""}`,style:{overflow:"hidden"},children:[e.jsxs("div",{className:"py-1 px-3 bg-gray-800 border-b border-gray-700 text-xs font-medium text-white flex justify-between items-center",children:[e.jsxs("span",{children:["修改后 (",c.file_status==="deleted"?"文件已删除":o,")"]}),e.jsx(h,{viewType:"after"})]}),e.jsx(O,{height:"calc(100% - 26px)",width:"100%",defaultLanguage:t,value:c.after_content||"",theme:"vs-dark",onMount:T,options:V,loading:e.jsx("div",{className:"flex items-center justify-center h-full text-white",children:"加载中..."})},_)]})]})};r.useEffect(()=>{n&&D()},[n]);const Y={background:"#1F2937",borderBottom:"1px solid #374151",margin:0,padding:"0 16px"},Z=(t,a)=>e.jsx(a,{...t,style:Y,className:"custom-tabs-bar"});return e.jsxs("div",{className:"flex flex-col h-full bg-[#111827] overflow-hidden",children:[e.jsxs("div",{className:"flex justify-between items-center p-4 bg-[#1F2937] border-b border-[#374151]",children:[e.jsx("h2",{className:"text-lg font-semibold text-white",children:"代码变更详情"}),e.jsx(Q,{children:i&&e.jsx("button",{className:"px-3 py-1.5 bg-gray-700 hover:bg-gray-600 text-white rounded text-sm",onClick:i,children:"关闭"})})]}),e.jsx("div",{className:"flex-1 overflow-y-auto",children:e.jsxs(q,{activeKey:g,onChange:$,type:"card",className:"diff-viewer-tabs",renderTabBar:Z,style:{background:"#111827"},children:[e.jsx(G,{tab:e.jsx("div",{className:`py-2 px-4 ${g==="1"?"text-white font-medium":"text-gray-400"}`,children:"文件列表"}),children:e.jsxs("div",{className:"p-4",children:[e.jsx("div",{className:"space-y-2 mb-4",children:m?e.jsx("div",{className:"flex items-center justify-center py-10",children:e.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-white"})}):l.file_changes&&l.file_changes.length>0?l.file_changes.map((t,a)=>e.jsx("div",{className:`text-sm py-2 px-3 rounded cursor-pointer ${o===t.path?"bg-gray-700 border-l-2 border-indigo-500":"hover:bg-gray-750 bg-gray-800"}`,onClick:()=>F(t.path),children:e.jsxs("div",{className:"flex items-center",children:[e.jsx("span",{className:`w-1.5 h-1.5 rounded-full mr-2 ${t.change_type==="added"?"bg-green-500":t.change_type==="modified"?"bg-yellow-500":t.change_type==="deleted"?"bg-red-500":"bg-blue-500"}`}),e.jsx("span",{className:`font-mono ${t.change_type==="deleted"?"line-through text-gray-500":"text-white"}`,children:t.path}),e.jsx(ee,{className:"ml-2 text-gray-400"})]})},a)):e.jsx("div",{className:"text-center text-white py-8",children:e.jsx("p",{children:"没有文件变更信息"})})}),S&&e.jsx("div",{className:"flex items-center justify-center py-10",children:e.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-white"})}),o&&c&&!S&&e.jsx("div",{className:"flex justify-end mb-3",children:e.jsxs(I.Group,{value:f,onChange:t=>E(t.target.value),buttonStyle:"solid",children:[e.jsx(I.Button,{value:"split",style:{color:f==="split"?"#fff":"#1f2937"},children:"分割视图"}),e.jsx(I.Button,{value:"unified",style:{color:f==="unified"?"#fff":"#1f2937"},children:"统一视图"})]})}),o&&c&&!S&&X()]})},"1"),e.jsx(G,{tab:e.jsx("div",{className:`py-2 px-4 ${g==="2"?"text-white font-medium":"text-gray-400"}`,children:"原始差异"}),children:e.jsx("div",{className:"p-4",children:m?e.jsx("div",{className:"flex items-center justify-center py-10",children:e.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-white"})}):e.jsx(se,{language:"diff",style:te,customStyle:{padding:"12px",borderRadius:"4px",overflow:"auto",maxHeight:"600px"},children:l.diff||""})})},"2")]})})]})};J.config({paths:{vs:"/monaco-editor/min/vs"},"vs/nls":{availableLanguages:{"*":"zh-cn"}}});const{Text:H}=oe,{TabPane:je}=q,we=()=>{const[n,i]=r.useState([]),[l,B]=r.useState(!1),[o,k]=r.useState(!1),[c,v]=r.useState(!1),[S,R]=r.useState([]),[f,E]=r.useState(null),[u,L]=r.useState(!1),[m,y]=r.useState({show:!1,commitHash:"",commitMessage:""}),[g,$]=r.useState(!1),[j,p]=r.useState(null),[w,N]=r.useState(null),D=s=>{if(!s){b.info("该消息没有关联的代码变更");return}E(s)},C=async()=>{k(!0);try{const s=await U.get("/api/history/validate-and-load");s.data.success?i(s.data.queries):b.error(s.data.message||"加载历史记录失败")}catch(s){console.error("Error loading queries:",s),b.error("加载失败")}finally{k(!1)}};re.useEffect(()=>{C();const s=ae.subscribe(ne.CODING.TASK_COMPLETE,d=>{console.log("Coding task completed, reloading queries",d),C()});return()=>{s()}},[]);const F=(s,d,h)=>{s.stopPropagation(),y({show:!0,commitHash:d,commitMessage:h})},A=async()=>{try{$(!0),p(null),N(null);const s=await fetch(`/api/commits/${m.commitHash}/revert`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!s.ok){const h=await s.json();throw new Error(h.detail||"撤销提交失败")}const d=await s.json();N(`成功撤销提交。新的撤销提交: ${d.new_commit_hash.substring(0,7)}`),y(h=>({...h,show:!1})),C(),setTimeout(()=>{N(null)},5e3)}catch(s){p(s instanceof Error?s.message:"撤销提交失败"),console.error("Failed to revert commit:",s)}finally{$(!1)}},T=()=>{y({show:!1,commitHash:"",commitMessage:""}),p(null)};return f?e.jsx(ve,{commitId:f,onClose:()=>E(null)}):e.jsxs("div",{className:"flex flex-col bg-[#111827] overflow-hidden",style:{height:"650px"},children:[e.jsx("div",{className:"flex justify-between items-center p-4 bg-[#1F2937] border-b border-[#374151] sticky top-0 z-10 shadow-md",children:e.jsxs(Q,{children:[e.jsx(M,{icon:l?e.jsx(fe,{}):e.jsx(me,{}),onClick:()=>{B(!l),i([...n].reverse())},children:l?"升序":"降序"}),e.jsx(M,{type:"primary",onClick:C,loading:o,children:"刷新"})]})}),m.show&&e.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 p-4",children:e.jsxs("div",{className:"bg-gray-800 rounded-lg shadow-xl max-w-md w-full p-6 border border-gray-700",children:[e.jsx("h3",{className:"text-xl font-semibold text-white mb-4",children:"确认撤销提交"}),e.jsx("p",{className:"text-gray-300 mb-6",children:"您确定要撤销此提交吗?这将创建一个新的提交来撤销更改。"}),e.jsxs("div",{className:"bg-gray-900 p-3 rounded mb-6 border border-gray-700",children:[e.jsx("p",{className:"text-sm text-gray-400 mb-1",children:"提交信息:"}),e.jsx("p",{className:"text-white",children:m.commitMessage}),e.jsxs("p",{className:"text-xs text-gray-500 mt-2",children:["Commit: ",m.commitHash.substring(0,7)]})]}),j&&e.jsx("div",{className:"bg-red-900 bg-opacity-25 text-red-400 p-3 rounded mb-4",children:j}),e.jsxs("div",{className:"flex justify-end space-x-3",children:[e.jsx("button",{className:"px-4 py-2 bg-gray-700 hover:bg-gray-600 text-gray-300 rounded transition-colors",onClick:T,disabled:g,children:"取消"}),e.jsx("button",{className:"px-4 py-2 bg-red-600 hover:bg-red-700 text-white rounded transition-colors flex items-center",onClick:A,disabled:g,children:g?e.jsxs(e.Fragment,{children:[e.jsxs("svg",{className:"animate-spin -ml-1 mr-2 h-4 w-4 text-white",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[e.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),e.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),"处理中..."]}):e.jsx(e.Fragment,{children:"确认撤销"})})]})]})}),w&&e.jsx("div",{className:"fixed top-4 right-4 bg-green-800 text-green-100 p-4 rounded-lg shadow-lg z-50 animate-fade-in-out",children:e.jsxs("div",{className:"flex items-center",children:[e.jsx("svg",{className:"w-5 h-5 mr-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M5 13l4 4L19 7"})}),e.jsx("span",{children:w})]})}),e.jsxs("div",{className:"flex-1 overflow-y-auto p-4",children:[e.jsx(z,{dataSource:n,renderItem:s=>e.jsx(z.Item,{className:"border-b border-[#374151] last:border-b-0",children:e.jsx(le,{className:"w-full bg-[#1F2937] border-[#374151] hover:bg-[#2D3748] transition-colors duration-200",title:e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[e.jsxs("div",{children:[e.jsx(W,{style:{marginRight:"8px",color:"#9CA3AF"}}),e.jsx(H,{style:{color:"#E5E7EB"},children:`${s.file_number}_chat_action.yml`}),s.timestamp&&e.jsx(H,{style:{marginLeft:"10px",fontSize:"12px",color:"#9CA3AF"},children:s.timestamp})]}),e.jsxs("div",{className:"flex space-x-2",children:[s.urls&&s.urls.length>0&&e.jsx(M,{icon:e.jsx(W,{}),type:"link",style:{color:"#60A5FA"},onClick:()=>{R(s.urls||[]),v(!0)},children:"查看上下文"}),s.response&&!s.is_reverted&&e.jsx(M,{icon:e.jsx(be,{}),type:"link",style:{color:"#F87171"},onClick:d=>F(d,s.response,s.query),children:"撤销"}),e.jsx(M,{icon:e.jsx(ie,{}),type:"link",style:{color:s.response?"#60A5FA":"#9CA3AF"},onClick:()=>D(s.response),disabled:!s.response,children:"查看变更"})]})]}),children:e.jsxs("div",{className:`${s.is_reverted?"border border-red-500 rounded-lg p-2 relative":""}`,children:[s.is_reverted&&e.jsx("div",{className:"absolute -top-2 -right-2 bg-red-500 text-white text-xs px-2 py-0.5 rounded-full",children:"已撤销"}),e.jsx("div",{style:{backgroundColor:"#111827",padding:"12px",borderRadius:"4px",color:"#E5E7EB",border:"1px solid #374151",maxWidth:"100%",fontSize:"14px",lineHeight:"1.6",whiteSpace:"normal",wordBreak:"break-word"},children:s.query})]})})})}),e.jsx(ce,{title:"上下文文件列表",open:c,onCancel:()=>v(!1),width:600,footer:null,className:"dark-theme-modal",styles:{content:{backgroundColor:"#1f2937",padding:"20px"},header:{backgroundColor:"#1f2937",borderBottom:"1px solid #374151",color:"#ffffff"},body:{backgroundColor:"#1f2937",color:"#ffffff"},mask:{backgroundColor:"rgba(0, 0, 0, 0.6)"}},children:e.jsx(z,{dataSource:S,className:"dark-theme-list max-h-96 overflow-y-auto",renderItem:s=>e.jsx(z.Item,{className:"text-gray-200 border-gray-700",children:e.jsx("div",{className:"flex items-center w-full",children:e.jsx(H,{style:{color:"#E5E7EB"},children:s})})})})})]})]})};export{we as default};
@@ -0,0 +1,189 @@
1
+ /**
2
+ * Bridge script injected into the proxied iframe to enable communication
3
+ * with the parent window (EditablePreviewPanel).
4
+ */
5
+ (function() {
6
+ console.log("Bridge script loaded into iframe.");
7
+
8
+ // --- Configuration ---
9
+ // IMPORTANT: Set this to the origin of your React app for security
10
+ const ALLOWED_PARENT_ORIGIN = window.location.origin; // Or a more specific origin like 'http://localhost:3000' in dev
11
+ // --- End Configuration ---
12
+
13
+ let isEditingEnabled = false;
14
+ let originalBodyOverflow = ''; // Store original overflow style
15
+
16
+ // Function to safely send messages to the parent
17
+ function sendMessageToParent(message) {
18
+ if (window.parent && window.parent !== window) {
19
+ // Always specify the target origin for security
20
+ window.parent.postMessage(message, ALLOWED_PARENT_ORIGIN);
21
+ console.log("Bridge: Sent message to parent:", message);
22
+ } else {
23
+ console.warn("Bridge: Cannot send message, no parent window detected or same window.");
24
+ }
25
+ }
26
+
27
+ // Function to enable/disable editing
28
+ function setEditingMode(enable) {
29
+ try {
30
+ if (enable) {
31
+ // Option 1: designMode (simpler, makes whole document editable)
32
+ // document.designMode = 'on';
33
+
34
+ // Option 2: contentEditable on body (more common)
35
+ if (document.body) {
36
+ document.body.contentEditable = 'true';
37
+ // Make it visually clear editing is on
38
+ document.body.style.outline = '2px solid blue';
39
+ // Prevent accidental navigation while editing
40
+ originalBodyOverflow = document.body.style.overflow;
41
+ document.body.style.overflow = 'hidden'; // Or handle links differently
42
+ isEditingEnabled = true;
43
+ console.log("Bridge: Editing enabled.");
44
+ } else {
45
+ console.error("Bridge: Cannot enable editing, document.body not found.");
46
+ return false; // Indicate failure
47
+ }
48
+
49
+ } else {
50
+ // document.designMode = 'off';
51
+ if (document.body) {
52
+ document.body.contentEditable = 'false';
53
+ document.body.style.outline = 'none';
54
+ document.body.style.overflow = originalBodyOverflow; // Restore original overflow
55
+ isEditingEnabled = false;
56
+ console.log("Bridge: Editing disabled.");
57
+ } else {
58
+ console.error("Bridge: Cannot disable editing, document.body not found.");
59
+ return false; // Indicate failure
60
+ }
61
+ }
62
+ return true; // Indicate success
63
+ } catch (error) {
64
+ console.error("Bridge: Error setting editing mode:", error);
65
+ sendMessageToParent({ type: 'error', message: 'Failed to set editing mode: ' + error.message });
66
+ return false; // Indicate failure
67
+ }
68
+ }
69
+
70
+ // Function to get the current full HTML of the document
71
+ function getCurrentDOM() {
72
+ try {
73
+ // Ensure scripts (like this bridge) are not included in the saved DOM if desired
74
+ // Temporarily remove the bridge script before getting HTML? (More complex)
75
+ // Or the parent can strip it after receiving.
76
+
77
+ // Get the full HTML structure
78
+ const html = document.documentElement.outerHTML;
79
+ return html;
80
+ } catch (error) {
81
+ console.error("Bridge: Error getting current DOM:", error);
82
+ sendMessageToParent({ type: 'error', message: 'Failed to get DOM: ' + error.message });
83
+ return null;
84
+ }
85
+ }
86
+
87
+ // Listen for messages from the parent window
88
+ window.addEventListener('message', (event) => {
89
+ // --- Security Check ---
90
+ // IMPORTANT: Always verify the origin of the message
91
+ if (event.origin !== ALLOWED_PARENT_ORIGIN) {
92
+ console.warn(`Bridge: Ignored message from unexpected origin: ${event.origin}. Expected: ${ALLOWED_PARENT_ORIGIN}`);
93
+ return;
94
+ }
95
+ // --- End Security Check ---
96
+
97
+ const message = event.data;
98
+ console.log("Bridge: Received message from parent:", message);
99
+
100
+ if (message && typeof message === 'object') {
101
+ switch (message.type) {
102
+ case 'command':
103
+ handleCommand(message.command, message.payload);
104
+ break;
105
+ // Handle other message types if needed
106
+ default:
107
+ console.log("Bridge: Unknown message type received:", message.type);
108
+ }
109
+ }
110
+ });
111
+
112
+ // Handle commands from the parent
113
+ function handleCommand(command, payload) {
114
+ console.log(`Bridge: Handling command: ${command}`, payload);
115
+ switch (command) {
116
+ case 'enableEditing':
117
+ const enabled = setEditingMode(true);
118
+ sendMessageToParent({ type: 'commandResponse', command: command, success: enabled });
119
+ break;
120
+ case 'disableEditing':
121
+ const disabled = setEditingMode(false);
122
+ sendMessageToParent({ type: 'commandResponse', command: command, success: disabled });
123
+ break;
124
+ case 'getDOM':
125
+ const dom = getCurrentDOM();
126
+ if (dom !== null) {
127
+ sendMessageToParent({ type: 'domContent', content: dom });
128
+ } else {
129
+ sendMessageToParent({ type: 'commandResponse', command: command, success: false, error: 'Failed to retrieve DOM' });
130
+ }
131
+ break;
132
+ // Add more commands as needed (e.g., highlight element, apply style)
133
+ default:
134
+ console.warn(`Bridge: Unknown command received: ${command}`);
135
+ sendMessageToParent({ type: 'error', message: `Unknown command: ${command}` });
136
+ }
137
+ }
138
+
139
+ // Optional: Inform the parent when the iframe content (including this script) is ready
140
+ // Using DOMContentLoaded or window.onload
141
+ window.addEventListener('DOMContentLoaded', () => {
142
+ console.log("Bridge: DOMContentLoaded fired.");
143
+ sendMessageToParent({ type: 'status', status: 'ready' });
144
+ });
145
+
146
+ // Fallback if DOMContentLoaded is too early for some complex pages
147
+ window.addEventListener('load', () => {
148
+ console.log("Bridge: window.load fired.");
149
+ // Avoid sending 'ready' twice if DOMContentLoaded already fired
150
+ // This might need a flag or smarter logic if both events are important
151
+ // sendMessageToParent({ type: 'status', status: 'fullyLoaded' });
152
+ });
153
+
154
+
155
+ // --- Optional: MutationObserver to notify parent of changes ---
156
+ /*
157
+ const observer = new MutationObserver((mutationsList) => {
158
+ // Debounce or throttle this to avoid flooding the parent
159
+ console.log("Bridge: DOM mutations detected.");
160
+ // Example: Send a simple notification
161
+ // sendMessageToParent({ type: 'domChanged' });
162
+
163
+ // More advanced: Send specific changes (can be complex and verbose)
164
+ // const changes = mutationsList.map(m => ({ type: m.type, target: m.target.nodeName }));
165
+ // sendMessageToParent({ type: 'domChanges', changes: changes });
166
+ });
167
+
168
+ // Start observing the body for changes in subtree and attributes
169
+ // Make sure body exists before observing
170
+ const startObserving = () => {
171
+ if(document.body){
172
+ observer.observe(document.body, {
173
+ attributes: true,
174
+ childList: true,
175
+ subtree: true,
176
+ characterData: true // Observe text changes
177
+ });
178
+ console.log("Bridge: MutationObserver started.");
179
+ } else {
180
+ // If body is not ready yet, try again shortly
181
+ setTimeout(startObserving, 100);
182
+ }
183
+ }
184
+ // Start observing after the initial load
185
+ window.addEventListener('load', startObserving);
186
+ */
187
+ // --- End Optional MutationObserver ---
188
+
189
+ })();
@@ -1,4 +1,4 @@
1
- import{m as et}from"./index-U694gZ5i.js";/*!-----------------------------------------------------------------------------
1
+ import{m as et}from"./main.js";/*!-----------------------------------------------------------------------------
2
2
  * Copyright (c) Microsoft Corporation. All rights reserved.
3
3
  * Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1)
4
4
  * Released under the MIT license
@@ -1,4 +1,4 @@
1
- import{m as f}from"./index-U694gZ5i.js";/*!-----------------------------------------------------------------------------
1
+ import{m as f}from"./main.js";/*!-----------------------------------------------------------------------------
2
2
  * Copyright (c) Microsoft Corporation. All rights reserved.
3
3
  * Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1)
4
4
  * Released under the MIT license
@@ -1,4 +1,4 @@
1
- import{m as l}from"./index-U694gZ5i.js";/*!-----------------------------------------------------------------------------
1
+ import{m as l}from"./main.js";/*!-----------------------------------------------------------------------------
2
2
  * Copyright (c) Microsoft Corporation. All rights reserved.
3
3
  * Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1)
4
4
  * Released under the MIT license
@@ -1,4 +1,4 @@
1
- import{m as s}from"./index-U694gZ5i.js";/*!-----------------------------------------------------------------------------
1
+ import{m as s}from"./main.js";/*!-----------------------------------------------------------------------------
2
2
  * Copyright (c) Microsoft Corporation. All rights reserved.
3
3
  * Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1)
4
4
  * Released under the MIT license
@@ -1,4 +1,4 @@
1
- import{m as lt}from"./index-U694gZ5i.js";/*!-----------------------------------------------------------------------------
1
+ import{m as lt}from"./main.js";/*!-----------------------------------------------------------------------------
2
2
  * Copyright (c) Microsoft Corporation. All rights reserved.
3
3
  * Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1)
4
4
  * Released under the MIT license
@@ -5,8 +5,8 @@
5
5
  <link rel="icon" href="/favicon.ico" />
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
7
  <title>Vite React App</title>
8
- <script type="module" crossorigin src="/assets/index-U694gZ5i.js"></script>
9
- <link rel="stylesheet" crossorigin href="/assets/index-Bnnll9cx.css">
8
+ <script type="module" crossorigin src="/main.js"></script>
9
+ <link rel="stylesheet" crossorigin href="/main-DxnFm18B.css">
10
10
  </head>
11
11
  <body>
12
12
  <div id="root"></div>
@@ -1,4 +1,4 @@
1
- import{conf as t,language as e}from"./typescript-vvCv9Db5.js";import"./index-U694gZ5i.js";/*!-----------------------------------------------------------------------------
1
+ import{conf as t,language as e}from"./typescript-DZzM_VgT.js";import"./main.js";/*!-----------------------------------------------------------------------------
2
2
  * Copyright (c) Microsoft Corporation. All rights reserved.
3
3
  * Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1)
4
4
  * Released under the MIT license
@@ -1,4 +1,4 @@
1
- import{m as Et}from"./index-U694gZ5i.js";/*!-----------------------------------------------------------------------------
1
+ import{m as Et}from"./main.js";/*!-----------------------------------------------------------------------------
2
2
  * Copyright (c) Microsoft Corporation. All rights reserved.
3
3
  * Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1)
4
4
  * Released under the MIT license
@@ -1,4 +1,4 @@
1
- import{m as l}from"./index-U694gZ5i.js";/*!-----------------------------------------------------------------------------
1
+ import{m as l}from"./main.js";/*!-----------------------------------------------------------------------------
2
2
  * Copyright (c) Microsoft Corporation. All rights reserved.
3
3
  * Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1)
4
4
  * Released under the MIT license