opalacoder 0.1.25__tar.gz → 0.1.26__tar.gz

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 (146) hide show
  1. {opalacoder-0.1.25 → opalacoder-0.1.26}/PKG-INFO +2 -2
  2. {opalacoder-0.1.25 → opalacoder-0.1.26}/README.md +1 -1
  3. {opalacoder-0.1.25 → opalacoder-0.1.26}/gui_src/src/App.jsx +1 -1
  4. {opalacoder-0.1.25 → opalacoder-0.1.26}/opalacoder/__init__.py +1 -1
  5. opalacoder-0.1.25/opalacoder/gui/assets/index-BQg8XLlL.js → opalacoder-0.1.26/opalacoder/gui/assets/index-Bp5KKCcR.js +1 -1
  6. {opalacoder-0.1.25 → opalacoder-0.1.26}/opalacoder/gui/index.html +1 -1
  7. {opalacoder-0.1.25 → opalacoder-0.1.26}/opalacoder/project.py +4 -4
  8. {opalacoder-0.1.25 → opalacoder-0.1.26}/opalacoder/tools.py +20 -1
  9. {opalacoder-0.1.25 → opalacoder-0.1.26}/pyproject.toml +1 -1
  10. {opalacoder-0.1.25 → opalacoder-0.1.26}/tests/test_project_store.py +34 -0
  11. {opalacoder-0.1.25 → opalacoder-0.1.26}/.claude/rules/RULES.md +0 -0
  12. {opalacoder-0.1.25 → opalacoder-0.1.26}/.claude/settings.json +0 -0
  13. {opalacoder-0.1.25 → opalacoder-0.1.26}/.github/workflows/publish.yml +0 -0
  14. {opalacoder-0.1.25 → opalacoder-0.1.26}/.gitignore +0 -0
  15. {opalacoder-0.1.25 → opalacoder-0.1.26}/AGENTS.md +0 -0
  16. {opalacoder-0.1.25 → opalacoder-0.1.26}/AppIcons/Assets.xcassets/AppIcon.appiconset/100.png +0 -0
  17. {opalacoder-0.1.25 → opalacoder-0.1.26}/AppIcons/Assets.xcassets/AppIcon.appiconset/102.png +0 -0
  18. {opalacoder-0.1.25 → opalacoder-0.1.26}/AppIcons/Assets.xcassets/AppIcon.appiconset/1024.png +0 -0
  19. {opalacoder-0.1.25 → opalacoder-0.1.26}/AppIcons/Assets.xcassets/AppIcon.appiconset/108.png +0 -0
  20. {opalacoder-0.1.25 → opalacoder-0.1.26}/AppIcons/Assets.xcassets/AppIcon.appiconset/114.png +0 -0
  21. {opalacoder-0.1.25 → opalacoder-0.1.26}/AppIcons/Assets.xcassets/AppIcon.appiconset/120.png +0 -0
  22. {opalacoder-0.1.25 → opalacoder-0.1.26}/AppIcons/Assets.xcassets/AppIcon.appiconset/128.png +0 -0
  23. {opalacoder-0.1.25 → opalacoder-0.1.26}/AppIcons/Assets.xcassets/AppIcon.appiconset/144.png +0 -0
  24. {opalacoder-0.1.25 → opalacoder-0.1.26}/AppIcons/Assets.xcassets/AppIcon.appiconset/152.png +0 -0
  25. {opalacoder-0.1.25 → opalacoder-0.1.26}/AppIcons/Assets.xcassets/AppIcon.appiconset/16.png +0 -0
  26. {opalacoder-0.1.25 → opalacoder-0.1.26}/AppIcons/Assets.xcassets/AppIcon.appiconset/167.png +0 -0
  27. {opalacoder-0.1.25 → opalacoder-0.1.26}/AppIcons/Assets.xcassets/AppIcon.appiconset/172.png +0 -0
  28. {opalacoder-0.1.25 → opalacoder-0.1.26}/AppIcons/Assets.xcassets/AppIcon.appiconset/180.png +0 -0
  29. {opalacoder-0.1.25 → opalacoder-0.1.26}/AppIcons/Assets.xcassets/AppIcon.appiconset/196.png +0 -0
  30. {opalacoder-0.1.25 → opalacoder-0.1.26}/AppIcons/Assets.xcassets/AppIcon.appiconset/20.png +0 -0
  31. {opalacoder-0.1.25 → opalacoder-0.1.26}/AppIcons/Assets.xcassets/AppIcon.appiconset/216.png +0 -0
  32. {opalacoder-0.1.25 → opalacoder-0.1.26}/AppIcons/Assets.xcassets/AppIcon.appiconset/234.png +0 -0
  33. {opalacoder-0.1.25 → opalacoder-0.1.26}/AppIcons/Assets.xcassets/AppIcon.appiconset/256.png +0 -0
  34. {opalacoder-0.1.25 → opalacoder-0.1.26}/AppIcons/Assets.xcassets/AppIcon.appiconset/258.png +0 -0
  35. {opalacoder-0.1.25 → opalacoder-0.1.26}/AppIcons/Assets.xcassets/AppIcon.appiconset/29.png +0 -0
  36. {opalacoder-0.1.25 → opalacoder-0.1.26}/AppIcons/Assets.xcassets/AppIcon.appiconset/32.png +0 -0
  37. {opalacoder-0.1.25 → opalacoder-0.1.26}/AppIcons/Assets.xcassets/AppIcon.appiconset/40.png +0 -0
  38. {opalacoder-0.1.25 → opalacoder-0.1.26}/AppIcons/Assets.xcassets/AppIcon.appiconset/48.png +0 -0
  39. {opalacoder-0.1.25 → opalacoder-0.1.26}/AppIcons/Assets.xcassets/AppIcon.appiconset/50.png +0 -0
  40. {opalacoder-0.1.25 → opalacoder-0.1.26}/AppIcons/Assets.xcassets/AppIcon.appiconset/512.png +0 -0
  41. {opalacoder-0.1.25 → opalacoder-0.1.26}/AppIcons/Assets.xcassets/AppIcon.appiconset/55.png +0 -0
  42. {opalacoder-0.1.25 → opalacoder-0.1.26}/AppIcons/Assets.xcassets/AppIcon.appiconset/57.png +0 -0
  43. {opalacoder-0.1.25 → opalacoder-0.1.26}/AppIcons/Assets.xcassets/AppIcon.appiconset/58.png +0 -0
  44. {opalacoder-0.1.25 → opalacoder-0.1.26}/AppIcons/Assets.xcassets/AppIcon.appiconset/60.png +0 -0
  45. {opalacoder-0.1.25 → opalacoder-0.1.26}/AppIcons/Assets.xcassets/AppIcon.appiconset/64.png +0 -0
  46. {opalacoder-0.1.25 → opalacoder-0.1.26}/AppIcons/Assets.xcassets/AppIcon.appiconset/66.png +0 -0
  47. {opalacoder-0.1.25 → opalacoder-0.1.26}/AppIcons/Assets.xcassets/AppIcon.appiconset/72.png +0 -0
  48. {opalacoder-0.1.25 → opalacoder-0.1.26}/AppIcons/Assets.xcassets/AppIcon.appiconset/76.png +0 -0
  49. {opalacoder-0.1.25 → opalacoder-0.1.26}/AppIcons/Assets.xcassets/AppIcon.appiconset/80.png +0 -0
  50. {opalacoder-0.1.25 → opalacoder-0.1.26}/AppIcons/Assets.xcassets/AppIcon.appiconset/87.png +0 -0
  51. {opalacoder-0.1.25 → opalacoder-0.1.26}/AppIcons/Assets.xcassets/AppIcon.appiconset/88.png +0 -0
  52. {opalacoder-0.1.25 → opalacoder-0.1.26}/AppIcons/Assets.xcassets/AppIcon.appiconset/92.png +0 -0
  53. {opalacoder-0.1.25 → opalacoder-0.1.26}/AppIcons/Assets.xcassets/AppIcon.appiconset/Contents.json +0 -0
  54. {opalacoder-0.1.25 → opalacoder-0.1.26}/AppIcons/android/mipmap-hdpi/ic_launcher.png +0 -0
  55. {opalacoder-0.1.25 → opalacoder-0.1.26}/AppIcons/android/mipmap-mdpi/ic_launcher.png +0 -0
  56. {opalacoder-0.1.25 → opalacoder-0.1.26}/AppIcons/android/mipmap-xhdpi/ic_launcher.png +0 -0
  57. {opalacoder-0.1.25 → opalacoder-0.1.26}/AppIcons/android/mipmap-xxhdpi/ic_launcher.png +0 -0
  58. {opalacoder-0.1.25 → opalacoder-0.1.26}/AppIcons/android/mipmap-xxxhdpi/ic_launcher.png +0 -0
  59. {opalacoder-0.1.25 → opalacoder-0.1.26}/AppIcons/appstore.png +0 -0
  60. {opalacoder-0.1.25 → opalacoder-0.1.26}/AppIcons/playstore.png +0 -0
  61. {opalacoder-0.1.25 → opalacoder-0.1.26}/CLAUDE.md +0 -0
  62. {opalacoder-0.1.25 → opalacoder-0.1.26}/GEMINI.md +0 -0
  63. {opalacoder-0.1.25 → opalacoder-0.1.26}/agents.yaml +0 -0
  64. {opalacoder-0.1.25 → opalacoder-0.1.26}/config.yaml +0 -0
  65. {opalacoder-0.1.25 → opalacoder-0.1.26}/debug/scratch_tail.py +0 -0
  66. {opalacoder-0.1.25 → opalacoder-0.1.26}/docs/guide/analysis_results.md +0 -0
  67. {opalacoder-0.1.25 → opalacoder-0.1.26}/docs/guide/figs/logotipo.png +0 -0
  68. {opalacoder-0.1.25 → opalacoder-0.1.26}/docs/guide/paper_memplan.md +0 -0
  69. {opalacoder-0.1.25 → opalacoder-0.1.26}/docs/guide/skills-plugin-system.md +0 -0
  70. {opalacoder-0.1.25 → opalacoder-0.1.26}/docs/specs/01-arquitetura.md +0 -0
  71. {opalacoder-0.1.25 → opalacoder-0.1.26}/docs/specs/02-memgpt-orquestrador.md +0 -0
  72. {opalacoder-0.1.25 → opalacoder-0.1.26}/docs/specs/03-skill-implement-feature.md +0 -0
  73. {opalacoder-0.1.25 → opalacoder-0.1.26}/docs/specs/04-memoria.md +0 -0
  74. {opalacoder-0.1.25 → opalacoder-0.1.26}/docs/specs/05-vcs-sombra.md +0 -0
  75. {opalacoder-0.1.25 → opalacoder-0.1.26}/docs/specs/06-skills-e-plugins.md +0 -0
  76. {opalacoder-0.1.25 → opalacoder-0.1.26}/docs/specs/07-configuracao.md +0 -0
  77. {opalacoder-0.1.25 → opalacoder-0.1.26}/docs/specs/08-ide.md +0 -0
  78. {opalacoder-0.1.25 → opalacoder-0.1.26}/docs/specs/09-ide-projectcreationinterface.md +0 -0
  79. {opalacoder-0.1.25 → opalacoder-0.1.26}/docs/specs/README.md +0 -0
  80. {opalacoder-0.1.25 → opalacoder-0.1.26}/docs/specs/backlog_register.md +0 -0
  81. {opalacoder-0.1.25 → opalacoder-0.1.26}/gui_src/index.html +0 -0
  82. {opalacoder-0.1.25 → opalacoder-0.1.26}/gui_src/package-lock.json +0 -0
  83. {opalacoder-0.1.25 → opalacoder-0.1.26}/gui_src/package.json +0 -0
  84. {opalacoder-0.1.25 → opalacoder-0.1.26}/gui_src/src/index.css +0 -0
  85. {opalacoder-0.1.25 → opalacoder-0.1.26}/gui_src/src/main.jsx +0 -0
  86. {opalacoder-0.1.25 → opalacoder-0.1.26}/gui_src/vite.config.js +0 -0
  87. {opalacoder-0.1.25 → opalacoder-0.1.26}/main.py +0 -0
  88. {opalacoder-0.1.25 → opalacoder-0.1.26}/opalacoder/agent_stdin.py +0 -0
  89. {opalacoder-0.1.25 → opalacoder-0.1.26}/opalacoder/agents.py +0 -0
  90. {opalacoder-0.1.25 → opalacoder-0.1.26}/opalacoder/api_keys.py +0 -0
  91. {opalacoder-0.1.25 → opalacoder-0.1.26}/opalacoder/archival.py +0 -0
  92. {opalacoder-0.1.25 → opalacoder-0.1.26}/opalacoder/cli.py +0 -0
  93. {opalacoder-0.1.25 → opalacoder-0.1.26}/opalacoder/cli_commands.py +0 -0
  94. {opalacoder-0.1.25 → opalacoder-0.1.26}/opalacoder/code_index.py +0 -0
  95. {opalacoder-0.1.25 → opalacoder-0.1.26}/opalacoder/config.py +0 -0
  96. {opalacoder-0.1.25 → opalacoder-0.1.26}/opalacoder/copy_gui.py +0 -0
  97. {opalacoder-0.1.25 → opalacoder-0.1.26}/opalacoder/embeddings.py +0 -0
  98. {opalacoder-0.1.25 → opalacoder-0.1.26}/opalacoder/gui/assets/index-_ON06SYj.css +0 -0
  99. {opalacoder-0.1.25 → opalacoder-0.1.26}/opalacoder/i18n.py +0 -0
  100. {opalacoder-0.1.25 → opalacoder-0.1.26}/opalacoder/icon.png +0 -0
  101. {opalacoder-0.1.25 → opalacoder-0.1.26}/opalacoder/ide_server.py +0 -0
  102. {opalacoder-0.1.25 → opalacoder-0.1.26}/opalacoder/memgpt_runtime.py +0 -0
  103. {opalacoder-0.1.25 → opalacoder-0.1.26}/opalacoder/orchestrator.py +0 -0
  104. {opalacoder-0.1.25 → opalacoder-0.1.26}/opalacoder/planner.py +0 -0
  105. {opalacoder-0.1.25 → opalacoder-0.1.26}/opalacoder/plugins/__init__.py +0 -0
  106. {opalacoder-0.1.25 → opalacoder-0.1.26}/opalacoder/plugins/html_css_js_tools.py +0 -0
  107. {opalacoder-0.1.25 → opalacoder-0.1.26}/opalacoder/session.py +0 -0
  108. {opalacoder-0.1.25 → opalacoder-0.1.26}/opalacoder/skills.py +0 -0
  109. {opalacoder-0.1.25 → opalacoder-0.1.26}/opalacoder/structured.py +0 -0
  110. {opalacoder-0.1.25 → opalacoder-0.1.26}/opalacoder/terminal.py +0 -0
  111. {opalacoder-0.1.25 → opalacoder-0.1.26}/opalacoder/terminal_manager.py +0 -0
  112. {opalacoder-0.1.25 → opalacoder-0.1.26}/opalacoder/vcs.py +0 -0
  113. {opalacoder-0.1.25 → opalacoder-0.1.26}/opalacoder/vector_index.py +0 -0
  114. {opalacoder-0.1.25 → opalacoder-0.1.26}/opalacoder/workflow_orchestrator.py +0 -0
  115. {opalacoder-0.1.25 → opalacoder-0.1.26}/opalacoder/workflow_tools.py +0 -0
  116. {opalacoder-0.1.25 → opalacoder-0.1.26}/pytest.ini +0 -0
  117. {opalacoder-0.1.25 → opalacoder-0.1.26}/requirements.txt +0 -0
  118. {opalacoder-0.1.25 → opalacoder-0.1.26}/skills/chat-orchestrator/SKILL.md +0 -0
  119. {opalacoder-0.1.25 → opalacoder-0.1.26}/skills/command-line/SKILL.md +0 -0
  120. {opalacoder-0.1.25 → opalacoder-0.1.26}/skills/command-line/scripts/command_executor.py +0 -0
  121. {opalacoder-0.1.25 → opalacoder-0.1.26}/skills/skills_store/html-css-js/SKILL.md +0 -0
  122. {opalacoder-0.1.25 → opalacoder-0.1.26}/skills/skills_store/html-css-js/scripts/check_contracts.py +0 -0
  123. {opalacoder-0.1.25 → opalacoder-0.1.26}/skills/skills_store/implement-feature/SKILL.md +0 -0
  124. {opalacoder-0.1.25 → opalacoder-0.1.26}/skills/skills_store/implement-feature/scripts/run_workflow.py +0 -0
  125. {opalacoder-0.1.25 → opalacoder-0.1.26}/skills/view-editor/SKILL.md +0 -0
  126. {opalacoder-0.1.25 → opalacoder-0.1.26}/skills/view-editor/scripts/run_view_editor.py +0 -0
  127. {opalacoder-0.1.25 → opalacoder-0.1.26}/tests/test_agent_config.py +0 -0
  128. {opalacoder-0.1.25 → opalacoder-0.1.26}/tests/test_agent_stdin.py +0 -0
  129. {opalacoder-0.1.25 → opalacoder-0.1.26}/tests/test_code_index_integration.py +0 -0
  130. {opalacoder-0.1.25 → opalacoder-0.1.26}/tests/test_command_line_skill.py +0 -0
  131. {opalacoder-0.1.25 → opalacoder-0.1.26}/tests/test_complexity_evaluator.py +0 -0
  132. {opalacoder-0.1.25 → opalacoder-0.1.26}/tests/test_context_guard.py +0 -0
  133. {opalacoder-0.1.25 → opalacoder-0.1.26}/tests/test_file_delete.py +0 -0
  134. {opalacoder-0.1.25 → opalacoder-0.1.26}/tests/test_i18n_coverage.py +0 -0
  135. {opalacoder-0.1.25 → opalacoder-0.1.26}/tests/test_implement_feature_script.py +0 -0
  136. {opalacoder-0.1.25 → opalacoder-0.1.26}/tests/test_memgpt_runtime.py +0 -0
  137. {opalacoder-0.1.25 → opalacoder-0.1.26}/tests/test_model_commands.py +0 -0
  138. {opalacoder-0.1.25 → opalacoder-0.1.26}/tests/test_planner_oracle_live.py +0 -0
  139. {opalacoder-0.1.25 → opalacoder-0.1.26}/tests/test_planner_output.py +0 -0
  140. {opalacoder-0.1.25 → opalacoder-0.1.26}/tests/test_refinement_loop.py +0 -0
  141. {opalacoder-0.1.25 → opalacoder-0.1.26}/tests/test_search_bugs.py +0 -0
  142. {opalacoder-0.1.25 → opalacoder-0.1.26}/tests/test_skills_directory_loader.py +0 -0
  143. {opalacoder-0.1.25 → opalacoder-0.1.26}/tests/test_unhashable_dict_bug.py +0 -0
  144. {opalacoder-0.1.25 → opalacoder-0.1.26}/tests/test_verification_strategies.py +0 -0
  145. {opalacoder-0.1.25 → opalacoder-0.1.26}/tests/test_view_editor_skill.py +0 -0
  146. {opalacoder-0.1.25 → opalacoder-0.1.26}/tests/test_workflow_pipeline.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: opalacoder
3
- Version: 0.1.25
3
+ Version: 0.1.26
4
4
  Summary: Autonomous coding agent with interactive planning and modular execution
5
5
  Project-URL: Homepage, https://github.com/gilzamir/OpalaCoder
6
6
  Project-URL: Bug Tracker, https://github.com/gilzamir/OpalaCoder/issues
@@ -60,7 +60,7 @@ OpalaCoder features an integrated desktop GUI built using React, Vite, and `pywe
60
60
  - **Integrated Terminal**: Includes a real-time xterm.js terminal with shell/PTY integration for running and inspecting commands natively.
61
61
  - **Git Source Control Sidebar**: A dedicated panel that tracks file modifications (color-coded as Modified/Untracked/Deleted) and provides a commit interface.
62
62
  - **Global Settings Panel**: Customize the editor font size, tab size, and word wrapping, with dynamic toggle support for Light and Dark themes.
63
- - **About Tab**: Version tracking (currently `0.1.25 alfa`), licensing, and developer details in the settings panel.
63
+ - **About Tab**: Version tracking (currently `0.1.26 alfa`), licensing, and developer details in the settings panel.
64
64
 
65
65
  ### 6. Persistent Projects and CLI Commands
66
66
 
@@ -30,7 +30,7 @@ OpalaCoder features an integrated desktop GUI built using React, Vite, and `pywe
30
30
  - **Integrated Terminal**: Includes a real-time xterm.js terminal with shell/PTY integration for running and inspecting commands natively.
31
31
  - **Git Source Control Sidebar**: A dedicated panel that tracks file modifications (color-coded as Modified/Untracked/Deleted) and provides a commit interface.
32
32
  - **Global Settings Panel**: Customize the editor font size, tab size, and word wrapping, with dynamic toggle support for Light and Dark themes.
33
- - **About Tab**: Version tracking (currently `0.1.25 alfa`), licensing, and developer details in the settings panel.
33
+ - **About Tab**: Version tracking (currently `0.1.26 alfa`), licensing, and developer details in the settings panel.
34
34
 
35
35
  ### 6. Persistent Projects and CLI Commands
36
36
 
@@ -2707,7 +2707,7 @@ export default function App() {
2707
2707
  <div style={{ display: 'flex', flexDirection: 'column', gap: '14px', color: '#cccccc' }}>
2708
2708
  <div style={{ display: 'flex', flexDirection: 'column', gap: '4px' }}>
2709
2709
  <span className="vscode-sidebar-section-title" style={{ padding: 0 }}>Versão</span>
2710
- <span style={{ fontSize: '13px', fontWeight: 'bold', color: '#ffffff' }}>0.1.25 alfa</span>
2710
+ <span style={{ fontSize: '13px', fontWeight: 'bold', color: '#ffffff' }}>0.1.26 alfa</span>
2711
2711
  </div>
2712
2712
  <div style={{ display: 'flex', flexDirection: 'column', gap: '4px' }}>
2713
2713
  <span className="vscode-sidebar-section-title" style={{ padding: 0 }}>Autor</span>
@@ -1,2 +1,2 @@
1
1
  """OpalaCoder – AI coding agent with session management and modular execution."""
2
- __version__ = "0.1.25"
2
+ __version__ = "0.1.26"
@@ -221,5 +221,5 @@ WARNING: This link could potentially be dangerous`)){let r=window.open();if(r){t
221
221
  `);b=G.pop();for(const te of G)if(te.trim())try{const ce=JSON.parse(te.trim());ce.output&&Ll(ot=>ot+ce.output),ce.status==="success"?En("Instalado com Sucesso!"):ce.status==="error"&&En("Erro na Instalação")}catch{}}}catch(d){En("Falha ao conectar"),Ll(w=>w+`
222
222
  Erro: ${d.message}
223
223
  `)}finally{pu(!1)}}},Tu=d=>{i(d),q("info",`Projeto selecionado: ${d.project_name||d.name}`)},Qr=async()=>{if(r)try{const d=await fetch(`/api/files?projectPath=${encodeURIComponent(r.project_path)}`);if(d.ok){const w=await d.json();n(w.files||[])}else{const w=await d.json();q("error",`Falha ao listar arquivos: ${w.error}`)}}catch(d){q("error",`Erro na chamada de arquivos: ${d.message}`)}},Mg=d=>{r&&(d.preventDefault(),d.stopPropagation(),S(null),Bl({x:d.clientX,y:d.clientY}))},Rg=(d,w)=>{r&&(d.preventDefault(),d.stopPropagation(),S(w),Bl({x:d.clientX,y:d.clientY}))},Lg=async d=>{if(!r)return;const w=d?`${d}/`:"",k=window.prompt("Nome do novo arquivo (ex: src/utils.py):",w);if(k)try{const b=await fetch("/api/file/write",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectPath:r.project_path,filePath:k,content:""})});if(b.ok)q("info",`Arquivo criado: ${k}`),await Qr(),await $l(k);else{const I=await b.json();q("error",`Falha ao criar arquivo: ${I.error}`),alert(`Erro ao criar arquivo: ${I.error}`)}}catch(b){q("error",`Erro na chamada de criação de arquivo: ${b.message}`)}},Tg=async d=>{if(!r)return;const w=d?`${d}/`:"",k=window.prompt("Nome do novo diretório (ex: src/components):",w);if(k)try{const b=await fetch("/api/file/mkdir",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectPath:r.project_path,dirPath:k})});if(b.ok)q("info",`Diretório criado: ${k}`),await Qr();else{const I=await b.json();q("error",`Falha ao criar diretório: ${I.error}`),alert(`Erro ao criar diretório: ${I.error}`)}}catch(b){q("error",`Erro na chamada de criação de diretório: ${b.message}`)}},Ng=async d=>{if(!r||!d)return;const w=window.prompt(`Digite o novo caminho/nome para "${d.path}":`,d.path);if(!(!w||w===d.path))try{const k=await fetch("/api/file/rename",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectPath:r.project_path,oldPath:d.path,newPath:w})});if(k.ok){if(q("info",`${d.isDirectory?"Diretório":"Arquivo"} renomeado de ${d.path} para ${w}`),!d.isDirectory)u(b=>b.map(I=>I===d.path?w:I)),y(b=>{const I={...b},Z=I[d.path];return delete I[d.path],I[w]=Z,I}),o===d.path&&l(w);else{const b=`${d.path}/`;u(I=>I.map(Z=>Z.startsWith(b)?Z.replace(d.path,w):Z)),y(I=>{const Z={};for(const[G,te]of Object.entries(I))G.startsWith(b)?Z[G.replace(d.path,w)]=te:Z[G]=te;return Z}),o&&o.startsWith(b)&&l(I=>I.replace(d.path,w))}await Qr()}else{const b=await k.json();q("error",`Falha ao renomear: ${b.error}`),alert(`Erro ao renomear: ${b.error}`)}}catch(k){q("error",`Erro ao renomear: ${k.message}`)}},Nu=async(d,w,k)=>{if(!r)return;const b=d.split("/").pop(),I=w?`${w}/${b}`:b;if(d!==I){if(k&&(I===d||I.startsWith(`${d}/`))){q("error","Não é possível mover um diretório para dentro dele mesmo.");return}try{const Z=await fetch("/api/file/rename",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectPath:r.project_path,oldPath:d,newPath:I})});if(Z.ok){if(q("info",`${k?"Diretório":"Arquivo"} movido de ${d} para ${I}`),!k)u(G=>G.map(te=>te===d?I:te)),y(G=>{const te={...G},ce=te[d];return delete te[d],te[I]=ce,te}),o===d&&l(I);else{const G=`${d}/`;u(te=>te.map(ce=>ce.startsWith(G)?ce.replace(d,I):ce)),y(te=>{const ce={};for(const[ot,Xe]of Object.entries(te))ot.startsWith(G)?ce[ot.replace(d,I)]=Xe:ce[ot]=Xe;return ce}),o&&o.startsWith(G)&&l(te=>te.replace(d,I))}await Qr()}else{const G=await Z.json();q("error",`Falha ao mover: ${G.error}`)}}catch(Z){q("error",`Erro ao mover: ${Z.message}`)}}},Bg=async d=>{if(!r||!d)return;const w=`Tem certeza que deseja deletar o ${d.isDirectory?"diretório":"arquivo"} "${d.path}"?${d.isDirectory?" Todos os arquivos internos serão removidos!":""}`;if(window.confirm(w))try{const k=await fetch("/api/file/delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectPath:r.project_path,filePath:d.path})});if(k.ok){if(q("info",`${d.isDirectory?"Diretório":"Arquivo"} excluído: ${d.path}`),!d.isDirectory)u(b=>b.filter(I=>I!==d.path)),y(b=>{const I={...b};return delete I[d.path],I}),o===d.path&&l(b=>{const I=f.filter(Z=>Z!==d.path);if(I.length>0){const Z=I[I.length-1];return setTimeout(()=>{a(p[Z]||"")},0),Z}return a(""),null});else{const b=`${d.path}/`;u(I=>I.filter(Z=>!Z.startsWith(b))),y(I=>{const Z={};for(const[G,te]of Object.entries(I))G.startsWith(b)||(Z[G]=te);return Z}),o&&o.startsWith(b)&&l(I=>{const Z=f.filter(G=>!G.startsWith(b));if(Z.length>0){const G=Z[Z.length-1];return setTimeout(()=>{a(p[G]||"")},0),G}return a(""),null})}await Qr()}else{const b=await k.json();q("error",`Falha ao deletar: ${b.error}`),alert(`Erro ao deletar: ${b.error}`)}}catch(k){q("error",`Erro ao deletar: ${k.message}`)}},Og=(d,w)=>{w&&(w.stopPropagation(),w.preventDefault()),o===d&&y(k=>({...k,[d]:c})),u(k=>{const b=k.filter(I=>I!==d);if(o===d)if(b.length>0){const I=b[b.length-1];l(I),a(p[I]||"")}else l(null),a("");return b})},$l=async d=>{if(r){if(o&&y(w=>({...w,[o]:c})),u(w=>w.includes(d)?w:[...w,d]),l(d),p[d]!==void 0){a(p[d]);return}try{const w=await fetch(`/api/file/read?projectPath=${encodeURIComponent(r.project_path)}&filePath=${encodeURIComponent(d)}`);if(w.ok){const k=await w.json();a(k.content),y(b=>({...b,[d]:k.content}))}else q("error",`Erro ao ler arquivo: ${d}`)}catch(w){q("error",`Erro de leitura: ${w.message}`)}}},An=async()=>{if(!(!r||!o)){m(!0);try{(await fetch("/api/file/write",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectPath:r.project_path,filePath:o,content:c})})).ok?(q("info",`Arquivo salvo: ${o}`),y(w=>({...w,[o]:c})),On(),Ol()):q("error",`Erro ao salvar arquivo: ${o}`)}catch(d){q("error",`Erro de escrita: ${d.message}`)}finally{m(!1)}}};P.useEffect(()=>{zl.current=An},[An]);const Ag=async d=>{if(d.preventDefault(),!(!Tn||!Il)){fe("");try{const w=await fetch("/api/opalacoder/create-project",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project_name:Tn,project_path:Il,description:wu,model:Cu,mode:bu,api_key:ku,api_base:Pu})});if(w.ok)q("info",`Projeto '${Tn}' registrado.`),Ln(!1),yu(""),Su(""),xu(""),Eu(""),Du("http://localhost:11434/v1"),Bn();else{const k=await w.json();fe(k.error||"Erro ao criar projeto."),q("error",`Erro ao criar projeto: ${k.error}`)}}catch(w){fe(w.message||"Erro ao criar projeto."),q("error",`Erro ao criar: ${w.message}`)}}},jg=async d=>{if(confirm(`Remover projeto '${d}'?`))try{(await fetch("/api/opalacoder/delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project_name:d})})).ok&&(q("info",`Projeto removido: ${d}`),r&&r.name===d&&i(null),Bn())}catch(w){q("error",`Erro ao excluir: ${w.message}`)}},Ig=(d,w)=>{d.stopPropagation(),$e({name:w.name,project_name:w.project_name||w.name,project_path:w.project_path||"",model:w.model||"",alternative_model:w.alternative_model||"",mode:w.mode||"auto",description:w.description||"",model_params:w.model_params||{},api_key:w.api_key||"",api_base:w.api_base||""})},zg=async d=>{if(d.preventDefault(),!!oe)try{const w=await fetch("/api/opalacoder/update-project",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project_name:oe.name,display_name:oe.project_name,project_path:oe.project_path,model:oe.model,alternative_model:oe.alternative_model,mode:oe.mode,description:oe.description,model_params:oe.model_params,api_key:oe.api_key,api_base:oe.api_base})});if(w.ok){const k=await w.json();q("info",`Projeto '${k.project_name}' atualizado.`),$e(null),await Bn(),r&&r.name===k.name&&i(b=>({...b,...k}))}else{const k=await w.json();q("error",`Erro ao atualizar: ${k.error}`)}}catch(w){q("error",`Erro ao atualizar projeto: ${w.message}`)}},q=(d,w)=>{J(k=>[...k,{type:d,message:w,timestamp:new Date().toLocaleTimeString()}])},jn=d=>{Y(d),W&&ee(!1)},$g=async()=>{try{(await fetch("/api/opalacoder/interrupt",{method:"POST"})).ok?q("info","Sinal de interrupção enviado ao agente."):q("error","Falha ao enviar sinal de interrupção.")}catch(d){q("error",`Erro ao interromper: ${d.message}`)}},Fg=async d=>{if(d&&d.preventDefault(),!x.trim()||!r||R)return;const w=x;E(""),v(b=>[...b,{role:"user",content:w}]),B(!0),z([]),U([]),q("info",`Iniciando agente para prompt: "${w}"`);let k="";if(Nn.current)try{const b=Nn.current.getModel(),I=Nn.current.getSelection();b&&I&&(k=b.getValueInRange(I))}catch{}try{const b=await fetch("/api/opalacoder/run",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({command:"run",agent:"chat_orchestrator",prompt:w,project_name:r.name,project_path:r.project_path,model:r.model,current_file:o||"",editor_content:c||"",selected_text:k||""})});if(!b.body){q("error","ReadableStream não suportado pelo backend."),B(!1);return}const I=b.body.getReader(),Z=new TextDecoder;let G="";for(;;){const{done:te,value:ce}=await I.read();if(te)break;G+=Z.decode(ce,{stream:!0});const ot=G.split(`
224
- `);G=ot.pop();for(const Xe of ot)if(Xe.trim())try{const xr=JSON.parse(Xe);Bu(xr)}catch{q("stdout",Xe)}}if(G.trim())try{const te=JSON.parse(G);Bu(te)}catch{q("stdout",G)}}catch(b){q("error",`Falha na execução: ${b.message}`),v(I=>[...I,{role:"assistant",content:`🔴 Falha na execução: ${b.message}`}])}finally{B(!1),Qr(),Ol()}},Bu=d=>{const{event:w,...k}=d;switch(w){case"server_ready":q("info","Agente pronto.");break;case"agent_started":q("info",`Agente ${k.agent} iniciado.`);break;case"thought":q("thought",k.content),U(b=>[...b,{timestamp:new Date().toLocaleTimeString(),content:k.content}]);break;case"cancelled":q("warning",k.message||"Execução cancelada."),v(b=>[...b,{role:"assistant",content:`⚠️ Interrompido: ${k.message||"A execução do agente foi parada."}`}]);break;case"tool_call":q("tool_call",`Chamando: ${k.tool} (${JSON.stringify(k.arguments)})`);break;case"tool_result":q("tool_result",`Sucesso: ${k.tool}`);break;case"agent_response":q("info","Resposta recebida."),v(b=>{const I=b[b.length-1];return I&&I.role==="assistant"&&I.content===k.response?(q("info","Duplicate assistant message ignored."),b):[...b,{role:"assistant",content:k.response}]});break;case"agent_finished":q("info","Processamento concluído.");break;case"input_request":vu({id:k.id,prompt:k.prompt,options:k.options||["yes","no"],default:k.default||"yes"}),q("info",`🔔 Aguardando confirmação: ${k.prompt}`);break;case"error":q("error",k.message),v(b=>[...b,{role:"assistant",content:`🔴 Erro do Agente: ${k.message}`}]);break;case"problem":q("error",`[Problema em ${k.tool}]: ${k.message}`),z(b=>[...b,{id:Math.random().toString(),tool:k.tool,message:k.message,severity:k.severity||"error",timestamp:new Date().toLocaleTimeString()}]);break;default:q("info",`Evento: ${w}`)}},Ou=async d=>{if(!Rn)return;const{id:w,prompt:k}=Rn;vu(null),q("info",`✅ Confirmação: "${k}" → ${d}`);try{await fetch("/api/opalacoder/input_response",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:w,value:d})})}catch(b){q("error",`Erro ao enviar confirmação: ${b.message}`)}},Wg=d=>{if(!d)return"plaintext";const w=d.split(".").pop().toLowerCase();return{py:"python",js:"javascript",jsx:"javascript",ts:"typescript",tsx:"typescript",html:"html",css:"css",json:"json",md:"markdown",yml:"yaml",yaml:"yaml",sh:"shell"}[w]||"plaintext"};return h.jsxs("div",{className:"vscode-app",children:[h.jsxs("div",{className:"vscode-main",children:[h.jsxs("div",{className:"vscode-activitybar",children:[h.jsxs("div",{className:"vscode-activitybar-top",children:[h.jsx("button",{onClick:()=>D("explorer"),className:`vscode-activitybar-btn ${j==="explorer"?"active":""}`,title:"Explorer",children:h.jsx(sf,{size:22})}),h.jsxs("button",{onClick:()=>D("git"),className:`vscode-activitybar-btn ${j==="git"?"active":""}`,title:"Source Control",style:{position:"relative"},children:[h.jsx(OS,{size:22}),os.length>0&&h.jsx("span",{style:{position:"absolute",top:"4px",right:"4px",background:"#007acc",color:"#ffffff",borderRadius:"50%",width:"16px",height:"16px",fontSize:"9px",fontWeight:"bold",display:"flex",alignItems:"center",justifyContent:"center",boxShadow:"0 0 4px rgba(0,0,0,0.5)"},children:os.length})]}),h.jsx("button",{onClick:()=>L(!$),className:`vscode-activitybar-btn ${$?"active":""}`,title:"Opala Chat",children:h.jsx(nf,{size:22})})]}),h.jsx("div",{children:h.jsx("button",{onClick:()=>Ye(!0),className:"vscode-activitybar-btn",title:"Settings",children:h.jsx(io,{size:20})})})]}),h.jsx("aside",{className:"vscode-sidebar",style:{width:`${mu}px`},children:j==="explorer"?h.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[h.jsxs("div",{className:"vscode-sidebar-header",children:[h.jsx("span",{className:"vscode-sidebar-title",children:"EXPLORER: PROJECTS"}),h.jsx("button",{onClick:()=>Ln(!0),style:{background:"transparent",border:"none",cursor:"pointer",color:"#c5c5c5"},title:"Novo Projeto...",children:h.jsx(of,{size:14})})]}),h.jsxs("div",{className:"vscode-sidebar-section",children:[h.jsx("div",{className:"vscode-sidebar-section-title",children:"Selecione o Projeto"}),h.jsx("div",{className:"overflow-y-auto",style:{maxHeight:"140px"},children:e.map(d=>{const w=r&&r.name===d.name;return h.jsxs("div",{onClick:()=>Tu(d),className:`vscode-project-item ${w?"active":""}`,children:[h.jsxs("div",{className:"truncate flex-1",children:[h.jsx("div",{style:{fontSize:"13px",fontWeight:"500"},className:"truncate",children:d.project_name||d.name}),h.jsx("div",{style:{fontSize:"10px",color:"#808080"},className:"truncate",children:d.project_path})]}),h.jsx("button",{onClick:k=>Ig(k,d),style:{background:"transparent",border:"none",cursor:"pointer",color:"#a0a0a0",padding:"2px 4px"},title:"Configurar projeto",children:h.jsx(io,{size:12})}),h.jsx("button",{onClick:k=>{k.stopPropagation(),jg(d.name)},style:{background:"transparent",border:"none",cursor:"pointer",color:"#a0a0a0",padding:"2px 4px"},title:"Remover projeto",children:h.jsx(af,{size:12})})]},d.name)})})]}),h.jsxs("div",{className:"vscode-sidebar-content",onContextMenu:Mg,onDragOver:d=>{d.preventDefault(),as&&bn("__root__")},onDragLeave:d=>{d.preventDefault(),Ml==="__root__"&&bn(null)},onDrop:d=>{d.preventDefault(),bn(null),as&&Nu(as.path,"",as.isDirectory)},style:Ml==="__root__"?{border:"2px dashed #007acc",backgroundColor:"rgba(0, 122, 204, 0.05)"}:{},children:[h.jsx("div",{className:"vscode-sidebar-section-title",children:"Workspace Files"}),s.length===0?h.jsx("div",{style:{fontSize:"12px",color:"#808080",padding:"0 4px",fontStyle:"italic"},children:"Selecione um projeto para explorar."}):h.jsx("div",{children:s.map(d=>h.jsx(gg,{node:d,selectedFile:o,handleFileSelect:$l,handleNodeContextMenu:Rg,draggedNode:as,setDraggedNode:Sg,dragOverPath:Ml,setDragOverPath:bn,handleMoveNode:Nu},d.path))})]})]}):h.jsxs("div",{className:"vscode-sidebar-content",style:{padding:"12px",display:"flex",flexDirection:"column",height:"100%",gap:"16px"},children:[h.jsx("div",{className:"vscode-sidebar-title",children:"SOURCE CONTROL (GIT)"}),r?os.length===0?h.jsx("div",{style:{fontSize:"12px",color:"#808080",fontStyle:"italic"},children:"Sem alterações locais."}):h.jsxs("div",{className:"flex flex-col flex-1 overflow-hidden",style:{gap:"16px"},children:[h.jsxs("form",{onSubmit:Dg,className:"flex flex-col",style:{gap:"8px"},children:[h.jsx("input",{type:"text",placeholder:"Mensagem do Commit...",value:ls,onChange:d=>du(d.target.value),required:!0,style:{width:"100%",fontSize:"12px"}}),h.jsx("button",{type:"submit",className:"vscode-button",disabled:Dl||!ls.trim(),style:{width:"100%"},children:Dl?"Commit...":"Commit"})]}),h.jsxs("div",{className:"flex-1 overflow-y-auto",style:{borderTop:"1px solid var(--vscode-border)",paddingTop:"12px"},children:[h.jsxs("div",{className:"vscode-sidebar-section-title",style:{marginBottom:"8px",padding:0},children:["Modificações (",os.length,")"]}),h.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:os.map((d,w)=>{let k="#cccccc",b=d.status;return d.status==="M"?(k="#e2b52b",b="M"):d.status==="??"||d.status==="A"?(k="#73c991",b="U"):d.status==="D"&&(k="#f48771",b="D"),h.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",fontSize:"12px",padding:"4px 6px",borderRadius:"3px",background:"rgba(255,255,255,0.02)"},children:[h.jsx("span",{className:"truncate",title:d.path,style:{color:"#cccccc",flex:1,marginRight:"8px"},children:d.path}),h.jsx("span",{style:{fontWeight:"bold",color:k,fontSize:"11px",minWidth:"12px",textAlign:"center"},children:b})]},w)})})]})]}):h.jsx("div",{style:{fontSize:"12px",color:"#808080",fontStyle:"italic"},children:"Selecione um projeto para ver as alterações Git."})]})}),h.jsx("div",{className:"vscode-resizer-horizontal",onMouseDown:d=>Al(d,"left")}),h.jsxs("main",{className:"vscode-editor-panel",children:[o?h.jsxs("div",{className:"vscode-editor-panel",children:[h.jsxs("div",{className:"vscode-tabs",children:[h.jsx("div",{className:"flex h-full overflow-x-auto",style:{gap:"2px"},children:f.map(d=>{const w=d===o;return h.jsxs("div",{onClick:()=>$l(d),className:`vscode-tab ${w?"active":""}`,style:{cursor:"pointer",userSelect:"none"},children:[h.jsx("span",{style:{color:w?"#ffffff":"#a0a0a0"},children:d.split("/").pop()}),h.jsx("button",{onClick:k=>Og(d,k),className:"vscode-tab-close-btn",children:h.jsx(Zr,{size:12})})]},d)})}),h.jsx("div",{children:h.jsxs("button",{onClick:An,disabled:T,className:"vscode-button",children:[T?h.jsx(lf,{size:12,className:"animate-spin"}):h.jsx(ma,{size:12}),h.jsx("span",{children:T?"Salvando...":"Salvar (Ctrl+S)"})]})})]}),h.jsx("div",{className:"vscode-editor-container",children:h.jsx(bS,{height:"100%",path:o,language:Wg(o),theme:Gt==="light"?"light":"vs-dark",value:c,onChange:d=>a(d),onMount:Pg,options:{minimap:{enabled:!0},fontSize:Ft,lineNumbers:"on",tabSize:Ci,wordWrap:hu,automaticLayout:!0}})})]}):h.jsx("div",{className:"vscode-editor-container",style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"},children:h.jsxs("div",{style:{textAlign:"center"},children:[h.jsx(sf,{size:64,style:{color:"#3c3c3c",marginBottom:"16px"}}),h.jsx("h3",{style:{fontSize:"14px",fontWeight:"bold",color:"#b0b0b0",marginBottom:"4px"},children:"Nenhum Arquivo Aberto"}),h.jsx("p",{style:{fontSize:"12px",color:"#808080"},children:"Abra um arquivo na barra lateral esquerda."})]})}),!W&&h.jsx("div",{className:"vscode-resizer-vertical",onMouseDown:d=>Al(d,"bottom")}),h.jsxs("div",{className:"vscode-bottom-panel",style:{height:W?"30px":`${Tl}px`},children:[h.jsxs("div",{className:"vscode-bottom-tabs",children:[h.jsxs("div",{className:"vscode-bottom-tab-list",children:[h.jsx("span",{className:`vscode-bottom-tab ${N==="output"?"active":""}`,onClick:()=>jn("output"),children:"OUTPUT (OPALACODER)"}),h.jsxs("span",{className:`vscode-bottom-tab ${N==="problems"?"active":""}`,onClick:()=>jn("problems"),children:["PROBLEMS ",C.length>0&&h.jsx("span",{style:{marginLeft:"4px",background:"#f48771",color:"#1e1e1e",borderRadius:"10px",padding:"0 6px",fontSize:"10px",fontWeight:"bold"},children:C.length})]}),h.jsx("span",{className:`vscode-bottom-tab ${N==="thinking"?"active":""}`,onClick:()=>jn("thinking"),children:"THINKING"}),h.jsx("span",{className:`vscode-bottom-tab ${N==="terminal"?"active":""}`,onClick:()=>jn("terminal"),children:"TERMINAL"})]}),h.jsxs("div",{className:"flex items-center",style:{gap:"8px"},children:[(N==="output"||N==="problems"||N==="thinking")&&h.jsxs("button",{onClick:N==="output"?()=>J([]):N==="problems"?()=>z([]):()=>U([]),className:"vscode-bottom-panel-clear-btn",title:N==="output"?"Limpar Output":N==="problems"?"Limpar Problemas":"Limpar Pensamentos",children:[h.jsx($S,{size:12}),h.jsx("span",{children:"Clear"})]}),h.jsx("button",{onClick:()=>ee(!W),style:{background:"transparent",border:"none",cursor:"pointer",color:"#a0a0a0"},children:W?h.jsx(jS,{size:12}):h.jsx(IS,{size:12})})]})]}),!W&&h.jsxs("div",{style:{height:"calc(100% - 30px)",width:"100%"},children:[N==="output"&&h.jsxs("div",{className:"vscode-logs",style:{height:"100%"},children:[F.length===0?h.jsx("div",{style:{color:"#808080",fontStyle:"italic"},children:"Nenhum log gerado. Envie uma instrução no chat para iniciar..."}):F.map((d,w)=>{let k="text-[#cccccc]",b="SYSTEM";return d.type==="error"?(k="text-[#f48771] font-semibold",b="ERROR"):d.type==="info"?(k="text-[#75beff]",b="INFO"):d.type==="thought"?(k="text-[#da70d6] italic",b="THOUGHT"):d.type==="tool_call"?(k="text-[#d7ba7d]",b="TOOL"):d.type==="tool_result"&&(k="text-[#89d4a5]",b="RESULT"),h.jsxs("div",{className:k,style:{display:"flex",alignItems:"flex-start",gap:"6px",marginBottom:"3px"},children:[h.jsxs("span",{style:{color:"#5a5a5a"},children:["[",d.timestamp,"]"]}),h.jsxs("span",{style:{fontWeight:"bold"},children:["[",b,"]"]}),h.jsx("span",{style:{whiteSpace:"pre-wrap",flex:1},children:d.message})]},w)}),h.jsx("div",{ref:Ru})]}),N==="problems"&&h.jsx("div",{className:"vscode-problems-list",style:{padding:"8px",overflowY:"auto",height:"100%",color:"#cccccc",fontFamily:"Consolas, monospace",fontSize:"12px"},children:C.length===0?h.jsx("div",{style:{color:"#808080",fontStyle:"italic",padding:"8px"},children:"Nenhum problema detectado."}):C.map(d=>h.jsxs("div",{style:{display:"flex",gap:"8px",alignItems:"flex-start",borderBottom:"1px solid #2d2d2d",padding:"6px 0"},children:[h.jsx(LS,{size:14,className:"text-[#f48771]",style:{flexShrink:0,marginTop:"2px"}}),h.jsxs("div",{children:[h.jsxs("div",{style:{fontWeight:"bold",color:"#f48771",marginBottom:"2px"},children:["[",d.timestamp,"] Erro em ",d.tool,":"]}),h.jsx("pre",{style:{whiteSpace:"pre-wrap",margin:0,color:"#e0e0e0",fontSize:"12px",fontFamily:"inherit"},children:d.message})]})]},d.id))}),N==="thinking"&&h.jsx("div",{className:"vscode-logs",style:{height:"100%"},children:V.length===0?h.jsx("div",{style:{color:"#808080",fontStyle:"italic"},children:"Nenhum pensamento gerado ainda. Execute uma instrução para ver o raciocínio do agente..."}):V.map((d,w)=>h.jsxs("div",{className:"text-[#da70d6]",style:{display:"flex",alignItems:"flex-start",gap:"6px",marginBottom:"4px"},children:[h.jsxs("span",{style:{color:"#5a5a5a"},children:["[",d.timestamp,"]"]}),h.jsx("span",{style:{fontWeight:"bold"},children:"[THOUGHT]"}),h.jsx("span",{style:{whiteSpace:"pre-wrap",flex:1,fontFamily:"Consolas, monospace"},children:d.content})]},w))}),h.jsx("div",{style:{display:N==="terminal"?"block":"none",height:"100%",background:"#1e1e1e",overflow:"hidden"},children:r?h.jsx("div",{ref:cs,style:{width:"100%",height:"100%",padding:"4px"}}):h.jsx("div",{style:{color:"#808080",fontStyle:"italic",padding:"16px"},children:"Defina um projeto/workspace para habilitar o terminal."})})]})]})]}),$&&h.jsx("div",{className:"vscode-resizer-horizontal",onMouseDown:d=>Al(d,"right")}),$&&h.jsxs("aside",{className:"vscode-chat",style:{width:`${gu}px`},children:[h.jsxs("div",{className:"vscode-chat-header",children:[h.jsxs("span",{className:"vscode-sidebar-title",style:{display:"flex",alignItems:"center",gap:"6px"},children:[h.jsx(nf,{size:12,style:{color:"#007acc"}}),h.jsx("span",{children:"OPALA CHAT"})]}),h.jsx("button",{onClick:()=>L(!1),style:{background:"transparent",border:"none",cursor:"pointer",color:"#a0a0a0"},children:h.jsx(Zr,{size:14})})]}),h.jsxs("div",{className:"vscode-chat-toolbar",children:[h.jsxs("button",{onClick:()=>E("/undo"),className:"vscode-chat-tool-btn",children:[h.jsx(FS,{size:11}),h.jsx("span",{children:"/undo"})]}),h.jsxs("button",{onClick:()=>E("/clear"),className:"vscode-chat-tool-btn",children:[h.jsx(lf,{size:11}),h.jsx("span",{children:"/clear"})]}),h.jsxs("button",{onClick:()=>E("/commit"),className:"vscode-chat-tool-btn",children:[h.jsx(ma,{size:11}),h.jsx("span",{children:"/commit"})]})]}),h.jsxs("div",{className:"vscode-chat-history",children:[_.map((d,w)=>{const k=d.role==="user";return h.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[h.jsx("span",{className:"vscode-chat-msg-header",style:{color:k?"#75beff":"#da70d6"},children:k?"VOCÊ":"OPALACODER"}),h.jsx("div",{className:"vscode-chat-msg-content",children:tC(d.content)})]},w)}),R&&h.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[h.jsx("span",{className:"vscode-chat-msg-header",style:{color:"#da70d6"},children:"OPALACODER"}),h.jsx("div",{className:"vscode-chat-msg-content",children:h.jsxs("div",{className:"thinking-indicator",children:[h.jsx("span",{className:"dot"}),h.jsx("span",{className:"dot"}),h.jsx("span",{className:"dot"})]})})]}),h.jsx("div",{ref:Mu})]}),h.jsx("form",{onSubmit:Fg,className:"vscode-chat-form",children:h.jsxs("div",{className:"vscode-chat-input-row",children:[h.jsx("input",{type:"text",value:x,onChange:d=>E(d.target.value),disabled:!r||R,placeholder:r?R?"Pensando...":"Pergunte ao OpalaCoder...":"Defina um projeto...",style:{flex:1}}),R?h.jsx("button",{type:"button",onClick:$g,className:"vscode-button",style:{padding:"6px",backgroundColor:"#f48771",color:"#1e1e1e"},title:"Interromper agente",children:h.jsx(Zr,{size:14})}):h.jsx("button",{type:"submit",disabled:!r||!x.trim(),className:"vscode-button",style:{padding:"6px"},children:h.jsx(DS,{size:14})})]})})]})]}),h.jsxs("footer",{className:"vscode-statusbar",children:[h.jsxs("div",{className:"flex items-center",style:{gap:"16px"},children:[h.jsxs("div",{className:"flex items-center",style:{gap:"6px"},children:[h.jsx(AS,{size:11}),h.jsx("span",{style:{fontWeight:"bold"},children:r?`Workspace: ${r.project_name||r.name}`:"Sem Workspace"})]}),R&&h.jsxs("span",{className:"flex items-center",style:{gap:"6px"},children:[h.jsx("span",{style:{width:"6px",height:"6px",backgroundColor:"#ffffff",borderRadius:"50%",display:"inline-block"}}),h.jsx("span",{style:{fontWeight:"bold"},children:"OpalaCoder Ativo..."})]})]}),h.jsxs("div",{className:"flex items-center",style:{gap:"12px"},children:[h.jsx("span",{children:"UTF-8"}),h.jsx("span",{children:"LF"}),h.jsx("span",{children:"JSON IPC Bridge"})]})]}),wg&&h.jsx("div",{className:"vscode-modal-overlay",children:h.jsxs("div",{className:"vscode-modal",style:{maxWidth:"440px",width:"90%"},children:[h.jsxs("div",{className:"vscode-sidebar-header",style:{padding:"10px 16px"},children:[h.jsx("span",{className:"vscode-sidebar-title",style:{color:"#ffffff"},children:"MÓDULOS OPCIONAIS REQUERIDOS"}),h.jsx("button",{onClick:()=>Pn(!1),style:{background:"transparent",border:"none",cursor:"pointer",color:"#a0a0a0"},children:h.jsx(Zr,{size:14})})]}),h.jsxs("div",{className:"overflow-y-auto flex-1",style:{padding:"16px",color:"#cccccc",display:"flex",flexDirection:"column",gap:"12px"},children:[h.jsxs("p",{style:{fontSize:"13px",lineHeight:"1.5"},children:["Os módulos opcionais para embeddings offline (",h.jsx("code",{children:"sentence-transformers"}),") não foram encontrados no ambiente."]}),h.jsx("p",{style:{fontSize:"12px",color:"#888888",lineHeight:"1.4"},children:"Recomendamos a instalação para habilitar o processamento local de vetores e a indexação de código sem depender de APIs externas."}),h.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:"8px",marginTop:"8px",borderTop:"1px solid #3c3c3c",paddingTop:"12px"},children:[h.jsx("button",{onClick:()=>Pn(!1),className:"vscode-button",style:{backgroundColor:"#3c3c3c",color:"#ffffff"},children:"Ignorar"}),h.jsx("button",{onClick:()=>{Pn(!1),Ye(!0),Mt("preferences"),Lu()},className:"vscode-button",children:"Instalar Agora"})]})]})]})}),jl&&h.jsx("div",{className:"vscode-modal-overlay",children:h.jsxs("div",{className:"vscode-modal",children:[h.jsxs("div",{className:"vscode-sidebar-header",style:{padding:"10px 16px"},children:[h.jsx("span",{className:"vscode-sidebar-title",style:{color:"#ffffff"},children:"REGISTRAR NOVO PROJETO"}),h.jsx("button",{onClick:()=>Ln(!1),style:{background:"transparent",border:"none",cursor:"pointer",color:"#a0a0a0"},children:h.jsx(Zr,{size:14})})]}),h.jsxs("form",{onSubmit:Ag,className:"flex flex-col overflow-y-auto flex-1",style:{padding:"16px",gap:"12px"},children:[h.jsxs("div",{className:"flex flex-col",style:{gap:"4px"},children:[h.jsx("label",{className:"vscode-sidebar-section-title",style:{padding:0},children:"Nome do Projeto *"}),h.jsx("input",{type:"text",value:Tn,onChange:d=>yu(d.target.value),placeholder:"Ex: Meu Servidor Web",required:!0})]}),h.jsxs("div",{className:"flex flex-col",style:{gap:"4px"},children:[h.jsx("label",{className:"vscode-sidebar-section-title",style:{padding:0},children:"Caminho Absoluto *"}),h.jsx("input",{type:"text",value:Il,onChange:d=>Su(d.target.value),placeholder:"Ex: /home/gilzamir/projetos/meu-app",required:!0})]}),h.jsxs("div",{className:"flex flex-col",style:{gap:"4px"},children:[h.jsx("label",{className:"vscode-sidebar-section-title",style:{padding:0},children:"Descrição"}),h.jsx("textarea",{value:wu,onChange:d=>xu(d.target.value),placeholder:"Descritivo do projeto...",rows:2,style:{resize:"none"}})]}),h.jsxs("div",{style:{display:"flex",gap:"12px"},children:[h.jsxs("div",{className:"flex flex-col flex-1",style:{gap:"4px"},children:[h.jsx("label",{className:"vscode-sidebar-section-title",style:{padding:0},children:"Chave de API (Opcional)"}),h.jsx("input",{type:"password",value:ku,onChange:d=>Eu(d.target.value),placeholder:"Ex: sk-..."})]}),h.jsxs("div",{className:"flex flex-col flex-1",style:{gap:"4px"},children:[h.jsx("label",{className:"vscode-sidebar-section-title",style:{padding:0},children:"URL Base da API (Opcional)"}),h.jsx("input",{type:"text",value:Pu,onChange:d=>Du(d.target.value),placeholder:"Ex: http://localhost:11434/v1"})]})]}),h.jsxs("div",{style:{fontSize:"11px",color:"#808080",marginTop:"-6px",lineHeight:"1.4"},children:["Dica: Para usar o Ollama local com ",h.jsx("strong",{children:"ollama/ministral-3:14b"}),", informe a URL Base acima (ex: ",h.jsx("code",{children:"http://localhost:11434/v1"}),") e digite/selecione o modelo correspondente."]}),h.jsxs("div",{style:{display:"flex",gap:"12px"},children:[h.jsxs("div",{className:"flex flex-col flex-1",style:{gap:"4px"},children:[h.jsx("label",{className:"vscode-sidebar-section-title",style:{padding:0},children:"Modelo de IA"}),h.jsx("input",{type:"text",list:"default-models",value:Cu,onChange:d=>kg(d.target.value),placeholder:"Selecione ou digite o modelo (ex: ollama/ministral-3:14b)"}),h.jsxs("datalist",{id:"default-models",children:[h.jsx("option",{value:"gemini/gemini-2.5-flash"}),h.jsx("option",{value:"gemini/gemini-2.5-pro"}),h.jsx("option",{value:"openai/gpt-4o"}),h.jsx("option",{value:"ollama/ministral-3:14b"})]})]}),h.jsxs("div",{className:"flex flex-col flex-1",style:{gap:"4px"},children:[h.jsx("label",{className:"vscode-sidebar-section-title",style:{padding:0},children:"Modo de Execução"}),h.jsxs("select",{value:bu,onChange:d=>Eg(d.target.value),children:[h.jsx("option",{value:"auto",children:"Auto (Completo)"}),h.jsx("option",{value:"plan",children:"Plan (Planejar)"}),h.jsx("option",{value:"edit",children:"Edit (Editar)"})]})]})]}),he&&h.jsxs("div",{style:{color:"#f48771",fontSize:"11px",marginTop:"4px",whiteSpace:"pre-wrap"},children:["⚠️ ",he]}),h.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:"8px",paddingTop:"12px",borderTop:"1px solid #3c3c3c",marginTop:"4px"},children:[h.jsx("button",{type:"button",onClick:()=>Ln(!1),className:"vscode-button",style:{backgroundColor:"#3c3c3c",color:"#ffffff"},children:"Cancelar"}),h.jsx("button",{type:"submit",className:"vscode-button",children:"Registrar"})]})]})]})}),Nl&&h.jsxs("div",{className:"vscode-context-menu",style:{top:`${Nl.y}px`,left:`${Nl.x}px`},children:[h.jsxs("div",{className:"vscode-context-menu-item",onClick:()=>{const d=g?g.isDirectory?g.path:g.path.split("/").slice(0,-1).join("/"):"";Lg(d)},children:[h.jsx(of,{size:13,style:{color:"#007acc"}}),h.jsx("span",{children:"New File..."})]}),h.jsxs("div",{className:"vscode-context-menu-item",onClick:()=>{const d=g?g.isDirectory?g.path:g.path.split("/").slice(0,-1).join("/"):"";Tg(d)},children:[h.jsx(NS,{size:13,style:{color:"#007acc"}}),h.jsx("span",{children:"New Dir..."})]}),g&&h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"vscode-context-menu-item",onClick:()=>Ng(g),children:[h.jsx(zS,{size:13,style:{color:"#e2b52b"}}),h.jsx("span",{children:"Rename..."})]}),h.jsxs("div",{className:"vscode-context-menu-item",onClick:()=>Bg(g),children:[h.jsx(af,{size:13,style:{color:"#f48771"}}),h.jsx("span",{children:"Delete"})]})]})]}),oe&&h.jsx("div",{className:"vscode-modal-overlay",children:h.jsxs("div",{className:"vscode-modal",style:{maxWidth:"520px",width:"92%"},children:[h.jsxs("div",{className:"vscode-sidebar-header",style:{padding:"10px 16px"},children:[h.jsxs("span",{className:"vscode-sidebar-title",style:{color:"#ffffff",display:"flex",alignItems:"center",gap:"8px"},children:[h.jsx(io,{size:14,style:{color:"#007acc"}}),"CONFIGURAÇÕES DO PROJETO"]}),h.jsx("button",{onClick:()=>$e(null),style:{background:"transparent",border:"none",cursor:"pointer",color:"#a0a0a0"},children:h.jsx(Zr,{size:14})})]}),h.jsxs("form",{onSubmit:zg,className:"flex flex-col overflow-y-auto flex-1",style:{padding:"16px",gap:"14px"},children:[h.jsxs("div",{className:"flex flex-col",style:{gap:"4px"},children:[h.jsx("label",{className:"vscode-sidebar-section-title",style:{padding:0},children:"ID Interno (somente leitura)"}),h.jsx("input",{type:"text",value:oe.name,readOnly:!0,style:{opacity:.5,cursor:"not-allowed"}})]}),h.jsxs("div",{className:"flex flex-col",style:{gap:"4px"},children:[h.jsx("label",{className:"vscode-sidebar-section-title",style:{padding:0},children:"Nome de Exibição *"}),h.jsx("input",{type:"text",value:oe.project_name,onChange:d=>$e(w=>({...w,project_name:d.target.value})),required:!0,placeholder:"Nome do projeto"})]}),h.jsxs("div",{className:"flex flex-col",style:{gap:"4px"},children:[h.jsx("label",{className:"vscode-sidebar-section-title",style:{padding:0},children:"Caminho Absoluto"}),h.jsx("input",{type:"text",value:oe.project_path,onChange:d=>$e(w=>({...w,project_path:d.target.value})),placeholder:"/caminho/absoluto/do/projeto"})]}),h.jsxs("div",{style:{display:"flex",gap:"12px"},children:[h.jsxs("div",{className:"flex flex-col flex-1",style:{gap:"4px"},children:[h.jsx("label",{className:"vscode-sidebar-section-title",style:{padding:0},children:"Modelo Principal"}),h.jsx("input",{type:"text",list:"edit-models",value:oe.model,onChange:d=>$e(w=>({...w,model:d.target.value})),placeholder:"gemini/gemini-2.5-flash"}),h.jsxs("datalist",{id:"edit-models",children:[h.jsx("option",{value:"gemini/gemini-2.5-flash"}),h.jsx("option",{value:"gemini/gemini-2.5-pro"}),h.jsx("option",{value:"openai/gpt-4o"}),h.jsx("option",{value:"ollama/ministral-3:14b"})]})]}),h.jsxs("div",{className:"flex flex-col flex-1",style:{gap:"4px"},children:[h.jsx("label",{className:"vscode-sidebar-section-title",style:{padding:0},children:"Modo"}),h.jsxs("select",{value:oe.mode,onChange:d=>$e(w=>({...w,mode:d.target.value})),children:[h.jsx("option",{value:"auto",children:"Auto (Completo)"}),h.jsx("option",{value:"plan",children:"Plan (Planejar)"}),h.jsx("option",{value:"edit",children:"Edit (Editar)"})]})]})]}),h.jsxs("div",{className:"flex flex-col",style:{gap:"4px"},children:[h.jsx("label",{className:"vscode-sidebar-section-title",style:{padding:0},children:"Modelo Alternativo"}),h.jsx("input",{type:"text",list:"edit-alt-models",value:oe.alternative_model,onChange:d=>$e(w=>({...w,alternative_model:d.target.value})),placeholder:"(usa o padrão global se vazio)"}),h.jsxs("datalist",{id:"edit-alt-models",children:[h.jsx("option",{value:"gemini/gemini-2.5-flash"}),h.jsx("option",{value:"openai/gpt-4o-mini"}),h.jsx("option",{value:"ollama/gemma3:4b"})]})]}),h.jsxs("div",{style:{display:"flex",gap:"12px"},children:[h.jsxs("div",{className:"flex flex-col flex-1",style:{gap:"4px"},children:[h.jsx("label",{className:"vscode-sidebar-section-title",style:{padding:0},children:"Chave de API (Opcional)"}),h.jsx("input",{type:"password",value:oe.api_key,onChange:d=>$e(w=>({...w,api_key:d.target.value})),placeholder:"Ex: sk-..."})]}),h.jsxs("div",{className:"flex flex-col flex-1",style:{gap:"4px"},children:[h.jsx("label",{className:"vscode-sidebar-section-title",style:{padding:0},children:"URL Base da API (Opcional)"}),h.jsx("input",{type:"text",value:oe.api_base,onChange:d=>$e(w=>({...w,api_base:d.target.value})),placeholder:"Ex: http://localhost:11434/v1"})]})]}),h.jsxs("div",{className:"flex flex-col",style:{gap:"4px"},children:[h.jsx("label",{className:"vscode-sidebar-section-title",style:{padding:0},children:"Descrição"}),h.jsx("textarea",{value:oe.description,onChange:d=>$e(w=>({...w,description:d.target.value})),placeholder:"Descrição opcional do projeto...",rows:2,style:{resize:"none"}})]}),h.jsxs("div",{className:"flex flex-col",style:{marginTop:"4px"},children:[h.jsx("button",{type:"button",onClick:()=>le(!X),style:{background:"transparent",border:"none",color:"#007acc",cursor:"pointer",display:"flex",alignItems:"center",gap:"4px",padding:"4px 0",fontSize:"12px",fontWeight:"bold",textAlign:"left",width:"fit-content"},children:h.jsxs("span",{children:[X?"▼":"▶"," Parâmetros do Modelo (Avançado)"]})}),X&&h.jsxs("div",{style:{border:"1px solid #3c3c3c",borderRadius:"4px",padding:"12px",marginTop:"8px",backgroundColor:"#252526",display:"grid",gridTemplateColumns:"1fr 1fr",gap:"12px"},children:[h.jsxs("div",{className:"flex flex-col",style:{gap:"4px"},children:[h.jsx("label",{className:"vscode-sidebar-section-title",style:{padding:0},children:"Temperature"}),h.jsx("input",{type:"number",step:"0.1",min:"0",max:"2",placeholder:"Ex: 0.7",value:((Au=oe.model_params)==null?void 0:Au.temperature)!==void 0?oe.model_params.temperature:"",onChange:d=>{const w=d.target.value===""?void 0:parseFloat(d.target.value);$e(k=>{const b={...k.model_params};return w===void 0?delete b.temperature:b.temperature=w,{...k,model_params:b}})}})]}),h.jsxs("div",{className:"flex flex-col",style:{gap:"4px"},children:[h.jsx("label",{className:"vscode-sidebar-section-title",style:{padding:0},children:"Max Tokens"}),h.jsx("input",{type:"number",min:"1",placeholder:"Ex: 4096",value:((ju=oe.model_params)==null?void 0:ju.max_tokens)!==void 0?oe.model_params.max_tokens:"",onChange:d=>{const w=d.target.value===""?void 0:parseInt(d.target.value,10);$e(k=>{const b={...k.model_params};return w===void 0?delete b.max_tokens:b.max_tokens=w,{...k,model_params:b}})}})]}),h.jsxs("div",{className:"flex flex-col",style:{gap:"4px"},children:[h.jsx("label",{className:"vscode-sidebar-section-title",style:{padding:0},children:"Context Window (num_ctx)"}),h.jsx("input",{type:"number",min:"1",placeholder:"Ex: 8192",value:((Iu=oe.model_params)==null?void 0:Iu.num_ctx)!==void 0?oe.model_params.num_ctx:"",onChange:d=>{const w=d.target.value===""?void 0:parseInt(d.target.value,10);$e(k=>{const b={...k.model_params};return w===void 0?delete b.num_ctx:b.num_ctx=w,{...k,model_params:b}})}})]}),h.jsxs("div",{className:"flex flex-col",style:{gap:"4px"},children:[h.jsx("label",{className:"vscode-sidebar-section-title",style:{padding:0},children:"Top P"}),h.jsx("input",{type:"number",step:"0.05",min:"0",max:"1",placeholder:"Ex: 0.9",value:((zu=oe.model_params)==null?void 0:zu.top_p)!==void 0?oe.model_params.top_p:"",onChange:d=>{const w=d.target.value===""?void 0:parseFloat(d.target.value);$e(k=>{const b={...k.model_params};return w===void 0?delete b.top_p:b.top_p=w,{...k,model_params:b}})}})]}),h.jsxs("div",{className:"flex flex-col",style:{gap:"4px"},children:[h.jsx("label",{className:"vscode-sidebar-section-title",style:{padding:0},children:"Frequency Penalty"}),h.jsx("input",{type:"number",step:"0.1",min:"-2",max:"2",placeholder:"Ex: 0.0",value:(($u=oe.model_params)==null?void 0:$u.frequency_penalty)!==void 0?oe.model_params.frequency_penalty:"",onChange:d=>{const w=d.target.value===""?void 0:parseFloat(d.target.value);$e(k=>{const b={...k.model_params};return w===void 0?delete b.frequency_penalty:b.frequency_penalty=w,{...k,model_params:b}})}})]}),h.jsxs("div",{className:"flex flex-col",style:{gap:"4px"},children:[h.jsx("label",{className:"vscode-sidebar-section-title",style:{padding:0},children:"Presence Penalty"}),h.jsx("input",{type:"number",step:"0.1",min:"-2",max:"2",placeholder:"Ex: 0.0",value:((Fu=oe.model_params)==null?void 0:Fu.presence_penalty)!==void 0?oe.model_params.presence_penalty:"",onChange:d=>{const w=d.target.value===""?void 0:parseFloat(d.target.value);$e(k=>{const b={...k.model_params};return w===void 0?delete b.presence_penalty:b.presence_penalty=w,{...k,model_params:b}})}})]})]})]}),h.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:"8px",paddingTop:"12px",borderTop:"1px solid #3c3c3c",marginTop:"4px"},children:[h.jsx("button",{type:"button",onClick:()=>$e(null),className:"vscode-button",style:{backgroundColor:"#3c3c3c",color:"#ffffff"},children:"Cancelar"}),h.jsxs("button",{type:"submit",className:"vscode-button",children:[h.jsx(ma,{size:12}),"Salvar Alterações"]})]})]})]})}),Rn&&h.jsx("div",{style:{position:"fixed",inset:0,zIndex:1e3,display:"flex",alignItems:"center",justifyContent:"center",background:"rgba(0,0,0,0.55)",backdropFilter:"blur(4px)",animation:"fadeIn 0.15s ease"},children:h.jsxs("div",{style:{background:"linear-gradient(135deg, #1e1e2e 0%, #252537 100%)",border:"1px solid #3c3c5c",borderRadius:"12px",padding:"28px 32px",maxWidth:"420px",width:"90%",boxShadow:"0 24px 64px rgba(0,0,0,0.6)"},children:[h.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px",marginBottom:"16px"},children:[h.jsx("span",{style:{fontSize:"22px"},children:"🔔"}),h.jsx("span",{style:{fontSize:"12px",fontWeight:700,color:"#a0a0c0",letterSpacing:"0.1em",textTransform:"uppercase"},children:"Confirmação Necessária"})]}),h.jsx("p",{style:{fontSize:"14px",color:"#e0e0f0",lineHeight:1.6,marginBottom:"24px",margin:"0 0 24px 0"},children:Rn.prompt}),h.jsxs("div",{style:{display:"flex",gap:"12px",justifyContent:"flex-end"},children:[h.jsx("button",{id:"confirm-no-btn",onClick:()=>Ou("no"),style:{padding:"8px 20px",borderRadius:"8px",border:"1px solid #4c4c6c",background:"transparent",color:"#a0a0c0",cursor:"pointer",fontSize:"13px",fontWeight:600,transition:"all 0.15s"},onMouseEnter:d=>{d.target.style.background="#2c2c3c",d.target.style.color="#e0e0f0"},onMouseLeave:d=>{d.target.style.background="transparent",d.target.style.color="#a0a0c0"},children:"Não"}),h.jsx("button",{id:"confirm-yes-btn",onClick:()=>Ou("yes"),style:{padding:"8px 24px",borderRadius:"8px",border:"none",background:"linear-gradient(135deg, #007acc, #0062a3)",color:"#fff",cursor:"pointer",fontSize:"13px",fontWeight:700,boxShadow:"0 4px 16px rgba(0,122,204,0.35)",transition:"all 0.15s"},onMouseEnter:d=>{d.target.style.background="linear-gradient(135deg, #0090f0, #007acc)"},onMouseLeave:d=>{d.target.style.background="linear-gradient(135deg, #007acc, #0062a3)"},children:"Sim"})]})]})}),ke&&h.jsx("div",{className:"vscode-modal-overlay",children:h.jsxs("div",{className:"vscode-modal",style:{maxWidth:"440px",width:"90%"},children:[h.jsxs("div",{className:"vscode-sidebar-header",style:{padding:"10px 16px"},children:[h.jsxs("span",{className:"vscode-sidebar-title",style:{color:"#ffffff",display:"flex",alignItems:"center",gap:"8px"},children:[h.jsx(io,{size:14,style:{color:"#007acc"}}),"CONFIGURAÇÕES DA IDE"]}),h.jsx("button",{onClick:()=>Ye(!1),style:{background:"transparent",border:"none",cursor:"pointer",color:"#a0a0a0"},children:h.jsx(Zr,{size:14})})]}),h.jsxs("div",{style:{display:"flex",borderBottom:"1px solid var(--vscode-border)",backgroundColor:"var(--vscode-tab-inactive-bg)"},children:[h.jsx("button",{onClick:()=>Mt("preferences"),style:{flex:1,padding:"8px",background:$t==="preferences"?"var(--vscode-tab-active-bg)":"transparent",border:"none",borderBottom:$t==="preferences"?"2px solid var(--vscode-active-border)":"none",color:$t==="preferences"?"#ffffff":"#808080",fontWeight:"bold",fontSize:"11px",textTransform:"uppercase",cursor:"pointer"},children:"Preferências"}),h.jsx("button",{onClick:()=>Mt("about"),style:{flex:1,padding:"8px",background:$t==="about"?"var(--vscode-tab-active-bg)":"transparent",border:"none",borderBottom:$t==="about"?"2px solid var(--vscode-active-border)":"none",color:$t==="about"?"#ffffff":"#808080",fontWeight:"bold",fontSize:"11px",textTransform:"uppercase",cursor:"pointer"},children:"Sobre"})]}),h.jsx("div",{className:"flex flex-col overflow-y-auto flex-1",style:{padding:"16px",gap:"14px"},children:$t==="preferences"?h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"flex flex-col",style:{gap:"6px"},children:[h.jsx("label",{className:"vscode-sidebar-section-title",style:{padding:0},children:"Tema de Cor"}),h.jsxs("select",{value:Gt,onChange:d=>Jr(d.target.value),style:{width:"100%"},children:[h.jsx("option",{value:"dark",children:"Escuro (Dark Mode)"}),h.jsx("option",{value:"light",children:"Claro (Light Mode)"})]})]}),h.jsxs("div",{className:"flex flex-col",style:{gap:"6px"},children:[h.jsx("label",{className:"vscode-sidebar-section-title",style:{padding:0},children:"Tamanho da Fonte do Editor"}),h.jsx("input",{type:"number",min:"10",max:"30",value:Ft,onChange:d=>{const w=Number(d.target.value);ne(w),Pr("editorFontSize",w)},style:{width:"100%"}})]}),h.jsxs("div",{className:"flex flex-col",style:{gap:"6px"},children:[h.jsx("label",{className:"vscode-sidebar-section-title",style:{padding:0},children:"Tamanho do Tab (Espaços)"}),h.jsxs("select",{value:Ci,onChange:d=>{const w=Number(d.target.value);vg(w),Pr("editorTabSize",w)},style:{width:"100%"},children:[h.jsx("option",{value:2,children:"2 Espaços"}),h.jsx("option",{value:4,children:"4 Espaços"}),h.jsx("option",{value:8,children:"8 Espaços"})]})]}),h.jsxs("div",{className:"flex flex-col",style:{gap:"6px"},children:[h.jsx("label",{className:"vscode-sidebar-section-title",style:{padding:0},children:"Quebra Automática de Linha (Word Wrap)"}),h.jsxs("select",{value:hu,onChange:d=>{yg(d.target.value),Pr("editorWordWrap",d.target.value)},style:{width:"100%"},children:[h.jsx("option",{value:"on",children:"Ativado (On)"}),h.jsx("option",{value:"off",children:"Desativado (Off)"})]})]}),h.jsxs("div",{className:"flex flex-col",style:{gap:"6px",borderTop:"1px solid var(--vscode-border)",paddingTop:"12px",marginTop:"6px"},children:[h.jsx("label",{className:"vscode-sidebar-section-title",style:{padding:0},children:"Dependências Opcionais"}),h.jsx("span",{style:{fontSize:"11px",color:"#888888",lineHeight:"1.4"},children:"Instale recursos extras (Local Embeddings, PyTorch, CUDA, etc.) que otimizam o processamento off-line."}),h.jsx("button",{type:"button",className:"vscode-button",disabled:Rl,onClick:Lu,style:{width:"100%",marginTop:"6px"},children:Rl?"Instalando...":"Instalar Recursos Opcionais"}),kn&&h.jsxs("span",{style:{fontSize:"11px",fontWeight:"bold",color:kn.includes("Erro")||kn.includes("Falha")?"#f48771":"#73c991",marginTop:"4px"},children:["Status: ",kn]}),_u&&h.jsx("textarea",{readOnly:!0,value:_u,style:{width:"100%",height:"80px",marginTop:"8px",fontSize:"10px",fontFamily:"monospace",background:"#151515",color:"#89d4a5",border:"1px solid var(--vscode-border)",padding:"6px",resize:"none"}})]})]}):h.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"14px",color:"#cccccc"},children:[h.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[h.jsx("span",{className:"vscode-sidebar-section-title",style:{padding:0},children:"Versão"}),h.jsx("span",{style:{fontSize:"13px",fontWeight:"bold",color:"#ffffff"},children:"0.1.25 alfa"})]}),h.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[h.jsx("span",{className:"vscode-sidebar-section-title",style:{padding:0},children:"Autor"}),h.jsx("span",{style:{fontSize:"13px",color:"#ffffff"},children:"dev@opala.com"})]}),h.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[h.jsx("span",{className:"vscode-sidebar-section-title",style:{padding:0},children:"Licença"}),h.jsx("span",{style:{fontSize:"13px",color:"#ffffff"},children:"MIT"})]})]})}),h.jsx("div",{style:{display:"flex",justifyContent:"flex-end",padding:"12px 16px",gap:"8px",borderTop:"1px solid var(--vscode-border)",backgroundColor:"var(--vscode-sidebar-bg)"},children:h.jsx("button",{onClick:()=>Ye(!1),className:"vscode-button",children:"Fechar"})})]})})]})}function gg({node:e,selectedFile:t,handleFileSelect:r,handleNodeContextMenu:i,draggedNode:s,setDraggedNode:n,dragOverPath:o,setDragOverPath:l,handleMoveNode:c}){const a=e.isDirectory,[f,u]=P.useState(!1),p=v=>{v.stopPropagation(),n({path:e.path,isDirectory:e.isDirectory}),v.dataTransfer.setData("text/plain",e.path),v.dataTransfer.effectAllowed="move"},y=v=>{v.preventDefault(),v.stopPropagation(),a&&s&&s.path!==e.path&&(l(e.path),v.dataTransfer.dropEffect="move")},g=v=>{v.preventDefault(),v.stopPropagation(),o===e.path&&l(null)},S=v=>{v.preventDefault(),v.stopPropagation(),l(null),a&&s&&s.path!==e.path&&c(s.path,e.path,s.isDirectory)},m=o===e.path?{backgroundColor:"#2d2d2d",border:"1px dashed #007acc"}:{};if(a)return h.jsxs("div",{className:"select-none",draggable:"true",onDragStart:p,onDragOver:y,onDragLeave:g,onDrop:S,children:[h.jsxs("div",{onClick:()=>u(!f),className:"vscode-tree-node",style:m,onContextMenu:v=>i(v,e),children:[f?h.jsx(MS,{size:14}):h.jsx(RS,{size:14}),h.jsx(BS,{size:14,className:"text-white",style:{color:"#e8a838"}}),h.jsx("span",{className:"truncate",children:e.name})]}),f&&h.jsx("div",{style:{paddingLeft:"12px",borderLeft:"1px solid #3c3c3c",marginLeft:"14px"},children:e.children.map(v=>h.jsx(gg,{node:v,selectedFile:t,handleFileSelect:r,handleNodeContextMenu:i,draggedNode:s,setDraggedNode:n,dragOverPath:o,setDragOverPath:l,handleMoveNode:c},v.path))})]});const _=t===e.path;return h.jsxs("div",{onClick:()=>r(e.path),className:`vscode-tree-node ${_?"active":""}`,draggable:"true",onDragStart:p,onContextMenu:v=>i(v,e),children:[h.jsx(TS,{size:13,style:{color:"#a0a0a0"}}),h.jsx("span",{className:"truncate",children:e.name})]})}function tC(e){return e?e.split(`
224
+ `);G=ot.pop();for(const Xe of ot)if(Xe.trim())try{const xr=JSON.parse(Xe);Bu(xr)}catch{q("stdout",Xe)}}if(G.trim())try{const te=JSON.parse(G);Bu(te)}catch{q("stdout",G)}}catch(b){q("error",`Falha na execução: ${b.message}`),v(I=>[...I,{role:"assistant",content:`🔴 Falha na execução: ${b.message}`}])}finally{B(!1),Qr(),Ol()}},Bu=d=>{const{event:w,...k}=d;switch(w){case"server_ready":q("info","Agente pronto.");break;case"agent_started":q("info",`Agente ${k.agent} iniciado.`);break;case"thought":q("thought",k.content),U(b=>[...b,{timestamp:new Date().toLocaleTimeString(),content:k.content}]);break;case"cancelled":q("warning",k.message||"Execução cancelada."),v(b=>[...b,{role:"assistant",content:`⚠️ Interrompido: ${k.message||"A execução do agente foi parada."}`}]);break;case"tool_call":q("tool_call",`Chamando: ${k.tool} (${JSON.stringify(k.arguments)})`);break;case"tool_result":q("tool_result",`Sucesso: ${k.tool}`);break;case"agent_response":q("info","Resposta recebida."),v(b=>{const I=b[b.length-1];return I&&I.role==="assistant"&&I.content===k.response?(q("info","Duplicate assistant message ignored."),b):[...b,{role:"assistant",content:k.response}]});break;case"agent_finished":q("info","Processamento concluído.");break;case"input_request":vu({id:k.id,prompt:k.prompt,options:k.options||["yes","no"],default:k.default||"yes"}),q("info",`🔔 Aguardando confirmação: ${k.prompt}`);break;case"error":q("error",k.message),v(b=>[...b,{role:"assistant",content:`🔴 Erro do Agente: ${k.message}`}]);break;case"problem":q("error",`[Problema em ${k.tool}]: ${k.message}`),z(b=>[...b,{id:Math.random().toString(),tool:k.tool,message:k.message,severity:k.severity||"error",timestamp:new Date().toLocaleTimeString()}]);break;default:q("info",`Evento: ${w}`)}},Ou=async d=>{if(!Rn)return;const{id:w,prompt:k}=Rn;vu(null),q("info",`✅ Confirmação: "${k}" → ${d}`);try{await fetch("/api/opalacoder/input_response",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:w,value:d})})}catch(b){q("error",`Erro ao enviar confirmação: ${b.message}`)}},Wg=d=>{if(!d)return"plaintext";const w=d.split(".").pop().toLowerCase();return{py:"python",js:"javascript",jsx:"javascript",ts:"typescript",tsx:"typescript",html:"html",css:"css",json:"json",md:"markdown",yml:"yaml",yaml:"yaml",sh:"shell"}[w]||"plaintext"};return h.jsxs("div",{className:"vscode-app",children:[h.jsxs("div",{className:"vscode-main",children:[h.jsxs("div",{className:"vscode-activitybar",children:[h.jsxs("div",{className:"vscode-activitybar-top",children:[h.jsx("button",{onClick:()=>D("explorer"),className:`vscode-activitybar-btn ${j==="explorer"?"active":""}`,title:"Explorer",children:h.jsx(sf,{size:22})}),h.jsxs("button",{onClick:()=>D("git"),className:`vscode-activitybar-btn ${j==="git"?"active":""}`,title:"Source Control",style:{position:"relative"},children:[h.jsx(OS,{size:22}),os.length>0&&h.jsx("span",{style:{position:"absolute",top:"4px",right:"4px",background:"#007acc",color:"#ffffff",borderRadius:"50%",width:"16px",height:"16px",fontSize:"9px",fontWeight:"bold",display:"flex",alignItems:"center",justifyContent:"center",boxShadow:"0 0 4px rgba(0,0,0,0.5)"},children:os.length})]}),h.jsx("button",{onClick:()=>L(!$),className:`vscode-activitybar-btn ${$?"active":""}`,title:"Opala Chat",children:h.jsx(nf,{size:22})})]}),h.jsx("div",{children:h.jsx("button",{onClick:()=>Ye(!0),className:"vscode-activitybar-btn",title:"Settings",children:h.jsx(io,{size:20})})})]}),h.jsx("aside",{className:"vscode-sidebar",style:{width:`${mu}px`},children:j==="explorer"?h.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[h.jsxs("div",{className:"vscode-sidebar-header",children:[h.jsx("span",{className:"vscode-sidebar-title",children:"EXPLORER: PROJECTS"}),h.jsx("button",{onClick:()=>Ln(!0),style:{background:"transparent",border:"none",cursor:"pointer",color:"#c5c5c5"},title:"Novo Projeto...",children:h.jsx(of,{size:14})})]}),h.jsxs("div",{className:"vscode-sidebar-section",children:[h.jsx("div",{className:"vscode-sidebar-section-title",children:"Selecione o Projeto"}),h.jsx("div",{className:"overflow-y-auto",style:{maxHeight:"140px"},children:e.map(d=>{const w=r&&r.name===d.name;return h.jsxs("div",{onClick:()=>Tu(d),className:`vscode-project-item ${w?"active":""}`,children:[h.jsxs("div",{className:"truncate flex-1",children:[h.jsx("div",{style:{fontSize:"13px",fontWeight:"500"},className:"truncate",children:d.project_name||d.name}),h.jsx("div",{style:{fontSize:"10px",color:"#808080"},className:"truncate",children:d.project_path})]}),h.jsx("button",{onClick:k=>Ig(k,d),style:{background:"transparent",border:"none",cursor:"pointer",color:"#a0a0a0",padding:"2px 4px"},title:"Configurar projeto",children:h.jsx(io,{size:12})}),h.jsx("button",{onClick:k=>{k.stopPropagation(),jg(d.name)},style:{background:"transparent",border:"none",cursor:"pointer",color:"#a0a0a0",padding:"2px 4px"},title:"Remover projeto",children:h.jsx(af,{size:12})})]},d.name)})})]}),h.jsxs("div",{className:"vscode-sidebar-content",onContextMenu:Mg,onDragOver:d=>{d.preventDefault(),as&&bn("__root__")},onDragLeave:d=>{d.preventDefault(),Ml==="__root__"&&bn(null)},onDrop:d=>{d.preventDefault(),bn(null),as&&Nu(as.path,"",as.isDirectory)},style:Ml==="__root__"?{border:"2px dashed #007acc",backgroundColor:"rgba(0, 122, 204, 0.05)"}:{},children:[h.jsx("div",{className:"vscode-sidebar-section-title",children:"Workspace Files"}),s.length===0?h.jsx("div",{style:{fontSize:"12px",color:"#808080",padding:"0 4px",fontStyle:"italic"},children:"Selecione um projeto para explorar."}):h.jsx("div",{children:s.map(d=>h.jsx(gg,{node:d,selectedFile:o,handleFileSelect:$l,handleNodeContextMenu:Rg,draggedNode:as,setDraggedNode:Sg,dragOverPath:Ml,setDragOverPath:bn,handleMoveNode:Nu},d.path))})]})]}):h.jsxs("div",{className:"vscode-sidebar-content",style:{padding:"12px",display:"flex",flexDirection:"column",height:"100%",gap:"16px"},children:[h.jsx("div",{className:"vscode-sidebar-title",children:"SOURCE CONTROL (GIT)"}),r?os.length===0?h.jsx("div",{style:{fontSize:"12px",color:"#808080",fontStyle:"italic"},children:"Sem alterações locais."}):h.jsxs("div",{className:"flex flex-col flex-1 overflow-hidden",style:{gap:"16px"},children:[h.jsxs("form",{onSubmit:Dg,className:"flex flex-col",style:{gap:"8px"},children:[h.jsx("input",{type:"text",placeholder:"Mensagem do Commit...",value:ls,onChange:d=>du(d.target.value),required:!0,style:{width:"100%",fontSize:"12px"}}),h.jsx("button",{type:"submit",className:"vscode-button",disabled:Dl||!ls.trim(),style:{width:"100%"},children:Dl?"Commit...":"Commit"})]}),h.jsxs("div",{className:"flex-1 overflow-y-auto",style:{borderTop:"1px solid var(--vscode-border)",paddingTop:"12px"},children:[h.jsxs("div",{className:"vscode-sidebar-section-title",style:{marginBottom:"8px",padding:0},children:["Modificações (",os.length,")"]}),h.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:os.map((d,w)=>{let k="#cccccc",b=d.status;return d.status==="M"?(k="#e2b52b",b="M"):d.status==="??"||d.status==="A"?(k="#73c991",b="U"):d.status==="D"&&(k="#f48771",b="D"),h.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",fontSize:"12px",padding:"4px 6px",borderRadius:"3px",background:"rgba(255,255,255,0.02)"},children:[h.jsx("span",{className:"truncate",title:d.path,style:{color:"#cccccc",flex:1,marginRight:"8px"},children:d.path}),h.jsx("span",{style:{fontWeight:"bold",color:k,fontSize:"11px",minWidth:"12px",textAlign:"center"},children:b})]},w)})})]})]}):h.jsx("div",{style:{fontSize:"12px",color:"#808080",fontStyle:"italic"},children:"Selecione um projeto para ver as alterações Git."})]})}),h.jsx("div",{className:"vscode-resizer-horizontal",onMouseDown:d=>Al(d,"left")}),h.jsxs("main",{className:"vscode-editor-panel",children:[o?h.jsxs("div",{className:"vscode-editor-panel",children:[h.jsxs("div",{className:"vscode-tabs",children:[h.jsx("div",{className:"flex h-full overflow-x-auto",style:{gap:"2px"},children:f.map(d=>{const w=d===o;return h.jsxs("div",{onClick:()=>$l(d),className:`vscode-tab ${w?"active":""}`,style:{cursor:"pointer",userSelect:"none"},children:[h.jsx("span",{style:{color:w?"#ffffff":"#a0a0a0"},children:d.split("/").pop()}),h.jsx("button",{onClick:k=>Og(d,k),className:"vscode-tab-close-btn",children:h.jsx(Zr,{size:12})})]},d)})}),h.jsx("div",{children:h.jsxs("button",{onClick:An,disabled:T,className:"vscode-button",children:[T?h.jsx(lf,{size:12,className:"animate-spin"}):h.jsx(ma,{size:12}),h.jsx("span",{children:T?"Salvando...":"Salvar (Ctrl+S)"})]})})]}),h.jsx("div",{className:"vscode-editor-container",children:h.jsx(bS,{height:"100%",path:o,language:Wg(o),theme:Gt==="light"?"light":"vs-dark",value:c,onChange:d=>a(d),onMount:Pg,options:{minimap:{enabled:!0},fontSize:Ft,lineNumbers:"on",tabSize:Ci,wordWrap:hu,automaticLayout:!0}})})]}):h.jsx("div",{className:"vscode-editor-container",style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"},children:h.jsxs("div",{style:{textAlign:"center"},children:[h.jsx(sf,{size:64,style:{color:"#3c3c3c",marginBottom:"16px"}}),h.jsx("h3",{style:{fontSize:"14px",fontWeight:"bold",color:"#b0b0b0",marginBottom:"4px"},children:"Nenhum Arquivo Aberto"}),h.jsx("p",{style:{fontSize:"12px",color:"#808080"},children:"Abra um arquivo na barra lateral esquerda."})]})}),!W&&h.jsx("div",{className:"vscode-resizer-vertical",onMouseDown:d=>Al(d,"bottom")}),h.jsxs("div",{className:"vscode-bottom-panel",style:{height:W?"30px":`${Tl}px`},children:[h.jsxs("div",{className:"vscode-bottom-tabs",children:[h.jsxs("div",{className:"vscode-bottom-tab-list",children:[h.jsx("span",{className:`vscode-bottom-tab ${N==="output"?"active":""}`,onClick:()=>jn("output"),children:"OUTPUT (OPALACODER)"}),h.jsxs("span",{className:`vscode-bottom-tab ${N==="problems"?"active":""}`,onClick:()=>jn("problems"),children:["PROBLEMS ",C.length>0&&h.jsx("span",{style:{marginLeft:"4px",background:"#f48771",color:"#1e1e1e",borderRadius:"10px",padding:"0 6px",fontSize:"10px",fontWeight:"bold"},children:C.length})]}),h.jsx("span",{className:`vscode-bottom-tab ${N==="thinking"?"active":""}`,onClick:()=>jn("thinking"),children:"THINKING"}),h.jsx("span",{className:`vscode-bottom-tab ${N==="terminal"?"active":""}`,onClick:()=>jn("terminal"),children:"TERMINAL"})]}),h.jsxs("div",{className:"flex items-center",style:{gap:"8px"},children:[(N==="output"||N==="problems"||N==="thinking")&&h.jsxs("button",{onClick:N==="output"?()=>J([]):N==="problems"?()=>z([]):()=>U([]),className:"vscode-bottom-panel-clear-btn",title:N==="output"?"Limpar Output":N==="problems"?"Limpar Problemas":"Limpar Pensamentos",children:[h.jsx($S,{size:12}),h.jsx("span",{children:"Clear"})]}),h.jsx("button",{onClick:()=>ee(!W),style:{background:"transparent",border:"none",cursor:"pointer",color:"#a0a0a0"},children:W?h.jsx(jS,{size:12}):h.jsx(IS,{size:12})})]})]}),!W&&h.jsxs("div",{style:{height:"calc(100% - 30px)",width:"100%"},children:[N==="output"&&h.jsxs("div",{className:"vscode-logs",style:{height:"100%"},children:[F.length===0?h.jsx("div",{style:{color:"#808080",fontStyle:"italic"},children:"Nenhum log gerado. Envie uma instrução no chat para iniciar..."}):F.map((d,w)=>{let k="text-[#cccccc]",b="SYSTEM";return d.type==="error"?(k="text-[#f48771] font-semibold",b="ERROR"):d.type==="info"?(k="text-[#75beff]",b="INFO"):d.type==="thought"?(k="text-[#da70d6] italic",b="THOUGHT"):d.type==="tool_call"?(k="text-[#d7ba7d]",b="TOOL"):d.type==="tool_result"&&(k="text-[#89d4a5]",b="RESULT"),h.jsxs("div",{className:k,style:{display:"flex",alignItems:"flex-start",gap:"6px",marginBottom:"3px"},children:[h.jsxs("span",{style:{color:"#5a5a5a"},children:["[",d.timestamp,"]"]}),h.jsxs("span",{style:{fontWeight:"bold"},children:["[",b,"]"]}),h.jsx("span",{style:{whiteSpace:"pre-wrap",flex:1},children:d.message})]},w)}),h.jsx("div",{ref:Ru})]}),N==="problems"&&h.jsx("div",{className:"vscode-problems-list",style:{padding:"8px",overflowY:"auto",height:"100%",color:"#cccccc",fontFamily:"Consolas, monospace",fontSize:"12px"},children:C.length===0?h.jsx("div",{style:{color:"#808080",fontStyle:"italic",padding:"8px"},children:"Nenhum problema detectado."}):C.map(d=>h.jsxs("div",{style:{display:"flex",gap:"8px",alignItems:"flex-start",borderBottom:"1px solid #2d2d2d",padding:"6px 0"},children:[h.jsx(LS,{size:14,className:"text-[#f48771]",style:{flexShrink:0,marginTop:"2px"}}),h.jsxs("div",{children:[h.jsxs("div",{style:{fontWeight:"bold",color:"#f48771",marginBottom:"2px"},children:["[",d.timestamp,"] Erro em ",d.tool,":"]}),h.jsx("pre",{style:{whiteSpace:"pre-wrap",margin:0,color:"#e0e0e0",fontSize:"12px",fontFamily:"inherit"},children:d.message})]})]},d.id))}),N==="thinking"&&h.jsx("div",{className:"vscode-logs",style:{height:"100%"},children:V.length===0?h.jsx("div",{style:{color:"#808080",fontStyle:"italic"},children:"Nenhum pensamento gerado ainda. Execute uma instrução para ver o raciocínio do agente..."}):V.map((d,w)=>h.jsxs("div",{className:"text-[#da70d6]",style:{display:"flex",alignItems:"flex-start",gap:"6px",marginBottom:"4px"},children:[h.jsxs("span",{style:{color:"#5a5a5a"},children:["[",d.timestamp,"]"]}),h.jsx("span",{style:{fontWeight:"bold"},children:"[THOUGHT]"}),h.jsx("span",{style:{whiteSpace:"pre-wrap",flex:1,fontFamily:"Consolas, monospace"},children:d.content})]},w))}),h.jsx("div",{style:{display:N==="terminal"?"block":"none",height:"100%",background:"#1e1e1e",overflow:"hidden"},children:r?h.jsx("div",{ref:cs,style:{width:"100%",height:"100%",padding:"4px"}}):h.jsx("div",{style:{color:"#808080",fontStyle:"italic",padding:"16px"},children:"Defina um projeto/workspace para habilitar o terminal."})})]})]})]}),$&&h.jsx("div",{className:"vscode-resizer-horizontal",onMouseDown:d=>Al(d,"right")}),$&&h.jsxs("aside",{className:"vscode-chat",style:{width:`${gu}px`},children:[h.jsxs("div",{className:"vscode-chat-header",children:[h.jsxs("span",{className:"vscode-sidebar-title",style:{display:"flex",alignItems:"center",gap:"6px"},children:[h.jsx(nf,{size:12,style:{color:"#007acc"}}),h.jsx("span",{children:"OPALA CHAT"})]}),h.jsx("button",{onClick:()=>L(!1),style:{background:"transparent",border:"none",cursor:"pointer",color:"#a0a0a0"},children:h.jsx(Zr,{size:14})})]}),h.jsxs("div",{className:"vscode-chat-toolbar",children:[h.jsxs("button",{onClick:()=>E("/undo"),className:"vscode-chat-tool-btn",children:[h.jsx(FS,{size:11}),h.jsx("span",{children:"/undo"})]}),h.jsxs("button",{onClick:()=>E("/clear"),className:"vscode-chat-tool-btn",children:[h.jsx(lf,{size:11}),h.jsx("span",{children:"/clear"})]}),h.jsxs("button",{onClick:()=>E("/commit"),className:"vscode-chat-tool-btn",children:[h.jsx(ma,{size:11}),h.jsx("span",{children:"/commit"})]})]}),h.jsxs("div",{className:"vscode-chat-history",children:[_.map((d,w)=>{const k=d.role==="user";return h.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[h.jsx("span",{className:"vscode-chat-msg-header",style:{color:k?"#75beff":"#da70d6"},children:k?"VOCÊ":"OPALACODER"}),h.jsx("div",{className:"vscode-chat-msg-content",children:tC(d.content)})]},w)}),R&&h.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[h.jsx("span",{className:"vscode-chat-msg-header",style:{color:"#da70d6"},children:"OPALACODER"}),h.jsx("div",{className:"vscode-chat-msg-content",children:h.jsxs("div",{className:"thinking-indicator",children:[h.jsx("span",{className:"dot"}),h.jsx("span",{className:"dot"}),h.jsx("span",{className:"dot"})]})})]}),h.jsx("div",{ref:Mu})]}),h.jsx("form",{onSubmit:Fg,className:"vscode-chat-form",children:h.jsxs("div",{className:"vscode-chat-input-row",children:[h.jsx("input",{type:"text",value:x,onChange:d=>E(d.target.value),disabled:!r||R,placeholder:r?R?"Pensando...":"Pergunte ao OpalaCoder...":"Defina um projeto...",style:{flex:1}}),R?h.jsx("button",{type:"button",onClick:$g,className:"vscode-button",style:{padding:"6px",backgroundColor:"#f48771",color:"#1e1e1e"},title:"Interromper agente",children:h.jsx(Zr,{size:14})}):h.jsx("button",{type:"submit",disabled:!r||!x.trim(),className:"vscode-button",style:{padding:"6px"},children:h.jsx(DS,{size:14})})]})})]})]}),h.jsxs("footer",{className:"vscode-statusbar",children:[h.jsxs("div",{className:"flex items-center",style:{gap:"16px"},children:[h.jsxs("div",{className:"flex items-center",style:{gap:"6px"},children:[h.jsx(AS,{size:11}),h.jsx("span",{style:{fontWeight:"bold"},children:r?`Workspace: ${r.project_name||r.name}`:"Sem Workspace"})]}),R&&h.jsxs("span",{className:"flex items-center",style:{gap:"6px"},children:[h.jsx("span",{style:{width:"6px",height:"6px",backgroundColor:"#ffffff",borderRadius:"50%",display:"inline-block"}}),h.jsx("span",{style:{fontWeight:"bold"},children:"OpalaCoder Ativo..."})]})]}),h.jsxs("div",{className:"flex items-center",style:{gap:"12px"},children:[h.jsx("span",{children:"UTF-8"}),h.jsx("span",{children:"LF"}),h.jsx("span",{children:"JSON IPC Bridge"})]})]}),wg&&h.jsx("div",{className:"vscode-modal-overlay",children:h.jsxs("div",{className:"vscode-modal",style:{maxWidth:"440px",width:"90%"},children:[h.jsxs("div",{className:"vscode-sidebar-header",style:{padding:"10px 16px"},children:[h.jsx("span",{className:"vscode-sidebar-title",style:{color:"#ffffff"},children:"MÓDULOS OPCIONAIS REQUERIDOS"}),h.jsx("button",{onClick:()=>Pn(!1),style:{background:"transparent",border:"none",cursor:"pointer",color:"#a0a0a0"},children:h.jsx(Zr,{size:14})})]}),h.jsxs("div",{className:"overflow-y-auto flex-1",style:{padding:"16px",color:"#cccccc",display:"flex",flexDirection:"column",gap:"12px"},children:[h.jsxs("p",{style:{fontSize:"13px",lineHeight:"1.5"},children:["Os módulos opcionais para embeddings offline (",h.jsx("code",{children:"sentence-transformers"}),") não foram encontrados no ambiente."]}),h.jsx("p",{style:{fontSize:"12px",color:"#888888",lineHeight:"1.4"},children:"Recomendamos a instalação para habilitar o processamento local de vetores e a indexação de código sem depender de APIs externas."}),h.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:"8px",marginTop:"8px",borderTop:"1px solid #3c3c3c",paddingTop:"12px"},children:[h.jsx("button",{onClick:()=>Pn(!1),className:"vscode-button",style:{backgroundColor:"#3c3c3c",color:"#ffffff"},children:"Ignorar"}),h.jsx("button",{onClick:()=>{Pn(!1),Ye(!0),Mt("preferences"),Lu()},className:"vscode-button",children:"Instalar Agora"})]})]})]})}),jl&&h.jsx("div",{className:"vscode-modal-overlay",children:h.jsxs("div",{className:"vscode-modal",children:[h.jsxs("div",{className:"vscode-sidebar-header",style:{padding:"10px 16px"},children:[h.jsx("span",{className:"vscode-sidebar-title",style:{color:"#ffffff"},children:"REGISTRAR NOVO PROJETO"}),h.jsx("button",{onClick:()=>Ln(!1),style:{background:"transparent",border:"none",cursor:"pointer",color:"#a0a0a0"},children:h.jsx(Zr,{size:14})})]}),h.jsxs("form",{onSubmit:Ag,className:"flex flex-col overflow-y-auto flex-1",style:{padding:"16px",gap:"12px"},children:[h.jsxs("div",{className:"flex flex-col",style:{gap:"4px"},children:[h.jsx("label",{className:"vscode-sidebar-section-title",style:{padding:0},children:"Nome do Projeto *"}),h.jsx("input",{type:"text",value:Tn,onChange:d=>yu(d.target.value),placeholder:"Ex: Meu Servidor Web",required:!0})]}),h.jsxs("div",{className:"flex flex-col",style:{gap:"4px"},children:[h.jsx("label",{className:"vscode-sidebar-section-title",style:{padding:0},children:"Caminho Absoluto *"}),h.jsx("input",{type:"text",value:Il,onChange:d=>Su(d.target.value),placeholder:"Ex: /home/gilzamir/projetos/meu-app",required:!0})]}),h.jsxs("div",{className:"flex flex-col",style:{gap:"4px"},children:[h.jsx("label",{className:"vscode-sidebar-section-title",style:{padding:0},children:"Descrição"}),h.jsx("textarea",{value:wu,onChange:d=>xu(d.target.value),placeholder:"Descritivo do projeto...",rows:2,style:{resize:"none"}})]}),h.jsxs("div",{style:{display:"flex",gap:"12px"},children:[h.jsxs("div",{className:"flex flex-col flex-1",style:{gap:"4px"},children:[h.jsx("label",{className:"vscode-sidebar-section-title",style:{padding:0},children:"Chave de API (Opcional)"}),h.jsx("input",{type:"password",value:ku,onChange:d=>Eu(d.target.value),placeholder:"Ex: sk-..."})]}),h.jsxs("div",{className:"flex flex-col flex-1",style:{gap:"4px"},children:[h.jsx("label",{className:"vscode-sidebar-section-title",style:{padding:0},children:"URL Base da API (Opcional)"}),h.jsx("input",{type:"text",value:Pu,onChange:d=>Du(d.target.value),placeholder:"Ex: http://localhost:11434/v1"})]})]}),h.jsxs("div",{style:{fontSize:"11px",color:"#808080",marginTop:"-6px",lineHeight:"1.4"},children:["Dica: Para usar o Ollama local com ",h.jsx("strong",{children:"ollama/ministral-3:14b"}),", informe a URL Base acima (ex: ",h.jsx("code",{children:"http://localhost:11434/v1"}),") e digite/selecione o modelo correspondente."]}),h.jsxs("div",{style:{display:"flex",gap:"12px"},children:[h.jsxs("div",{className:"flex flex-col flex-1",style:{gap:"4px"},children:[h.jsx("label",{className:"vscode-sidebar-section-title",style:{padding:0},children:"Modelo de IA"}),h.jsx("input",{type:"text",list:"default-models",value:Cu,onChange:d=>kg(d.target.value),placeholder:"Selecione ou digite o modelo (ex: ollama/ministral-3:14b)"}),h.jsxs("datalist",{id:"default-models",children:[h.jsx("option",{value:"gemini/gemini-2.5-flash"}),h.jsx("option",{value:"gemini/gemini-2.5-pro"}),h.jsx("option",{value:"openai/gpt-4o"}),h.jsx("option",{value:"ollama/ministral-3:14b"})]})]}),h.jsxs("div",{className:"flex flex-col flex-1",style:{gap:"4px"},children:[h.jsx("label",{className:"vscode-sidebar-section-title",style:{padding:0},children:"Modo de Execução"}),h.jsxs("select",{value:bu,onChange:d=>Eg(d.target.value),children:[h.jsx("option",{value:"auto",children:"Auto (Completo)"}),h.jsx("option",{value:"plan",children:"Plan (Planejar)"}),h.jsx("option",{value:"edit",children:"Edit (Editar)"})]})]})]}),he&&h.jsxs("div",{style:{color:"#f48771",fontSize:"11px",marginTop:"4px",whiteSpace:"pre-wrap"},children:["⚠️ ",he]}),h.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:"8px",paddingTop:"12px",borderTop:"1px solid #3c3c3c",marginTop:"4px"},children:[h.jsx("button",{type:"button",onClick:()=>Ln(!1),className:"vscode-button",style:{backgroundColor:"#3c3c3c",color:"#ffffff"},children:"Cancelar"}),h.jsx("button",{type:"submit",className:"vscode-button",children:"Registrar"})]})]})]})}),Nl&&h.jsxs("div",{className:"vscode-context-menu",style:{top:`${Nl.y}px`,left:`${Nl.x}px`},children:[h.jsxs("div",{className:"vscode-context-menu-item",onClick:()=>{const d=g?g.isDirectory?g.path:g.path.split("/").slice(0,-1).join("/"):"";Lg(d)},children:[h.jsx(of,{size:13,style:{color:"#007acc"}}),h.jsx("span",{children:"New File..."})]}),h.jsxs("div",{className:"vscode-context-menu-item",onClick:()=>{const d=g?g.isDirectory?g.path:g.path.split("/").slice(0,-1).join("/"):"";Tg(d)},children:[h.jsx(NS,{size:13,style:{color:"#007acc"}}),h.jsx("span",{children:"New Dir..."})]}),g&&h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"vscode-context-menu-item",onClick:()=>Ng(g),children:[h.jsx(zS,{size:13,style:{color:"#e2b52b"}}),h.jsx("span",{children:"Rename..."})]}),h.jsxs("div",{className:"vscode-context-menu-item",onClick:()=>Bg(g),children:[h.jsx(af,{size:13,style:{color:"#f48771"}}),h.jsx("span",{children:"Delete"})]})]})]}),oe&&h.jsx("div",{className:"vscode-modal-overlay",children:h.jsxs("div",{className:"vscode-modal",style:{maxWidth:"520px",width:"92%"},children:[h.jsxs("div",{className:"vscode-sidebar-header",style:{padding:"10px 16px"},children:[h.jsxs("span",{className:"vscode-sidebar-title",style:{color:"#ffffff",display:"flex",alignItems:"center",gap:"8px"},children:[h.jsx(io,{size:14,style:{color:"#007acc"}}),"CONFIGURAÇÕES DO PROJETO"]}),h.jsx("button",{onClick:()=>$e(null),style:{background:"transparent",border:"none",cursor:"pointer",color:"#a0a0a0"},children:h.jsx(Zr,{size:14})})]}),h.jsxs("form",{onSubmit:zg,className:"flex flex-col overflow-y-auto flex-1",style:{padding:"16px",gap:"14px"},children:[h.jsxs("div",{className:"flex flex-col",style:{gap:"4px"},children:[h.jsx("label",{className:"vscode-sidebar-section-title",style:{padding:0},children:"ID Interno (somente leitura)"}),h.jsx("input",{type:"text",value:oe.name,readOnly:!0,style:{opacity:.5,cursor:"not-allowed"}})]}),h.jsxs("div",{className:"flex flex-col",style:{gap:"4px"},children:[h.jsx("label",{className:"vscode-sidebar-section-title",style:{padding:0},children:"Nome de Exibição *"}),h.jsx("input",{type:"text",value:oe.project_name,onChange:d=>$e(w=>({...w,project_name:d.target.value})),required:!0,placeholder:"Nome do projeto"})]}),h.jsxs("div",{className:"flex flex-col",style:{gap:"4px"},children:[h.jsx("label",{className:"vscode-sidebar-section-title",style:{padding:0},children:"Caminho Absoluto"}),h.jsx("input",{type:"text",value:oe.project_path,onChange:d=>$e(w=>({...w,project_path:d.target.value})),placeholder:"/caminho/absoluto/do/projeto"})]}),h.jsxs("div",{style:{display:"flex",gap:"12px"},children:[h.jsxs("div",{className:"flex flex-col flex-1",style:{gap:"4px"},children:[h.jsx("label",{className:"vscode-sidebar-section-title",style:{padding:0},children:"Modelo Principal"}),h.jsx("input",{type:"text",list:"edit-models",value:oe.model,onChange:d=>$e(w=>({...w,model:d.target.value})),placeholder:"gemini/gemini-2.5-flash"}),h.jsxs("datalist",{id:"edit-models",children:[h.jsx("option",{value:"gemini/gemini-2.5-flash"}),h.jsx("option",{value:"gemini/gemini-2.5-pro"}),h.jsx("option",{value:"openai/gpt-4o"}),h.jsx("option",{value:"ollama/ministral-3:14b"})]})]}),h.jsxs("div",{className:"flex flex-col flex-1",style:{gap:"4px"},children:[h.jsx("label",{className:"vscode-sidebar-section-title",style:{padding:0},children:"Modo"}),h.jsxs("select",{value:oe.mode,onChange:d=>$e(w=>({...w,mode:d.target.value})),children:[h.jsx("option",{value:"auto",children:"Auto (Completo)"}),h.jsx("option",{value:"plan",children:"Plan (Planejar)"}),h.jsx("option",{value:"edit",children:"Edit (Editar)"})]})]})]}),h.jsxs("div",{className:"flex flex-col",style:{gap:"4px"},children:[h.jsx("label",{className:"vscode-sidebar-section-title",style:{padding:0},children:"Modelo Alternativo"}),h.jsx("input",{type:"text",list:"edit-alt-models",value:oe.alternative_model,onChange:d=>$e(w=>({...w,alternative_model:d.target.value})),placeholder:"(usa o padrão global se vazio)"}),h.jsxs("datalist",{id:"edit-alt-models",children:[h.jsx("option",{value:"gemini/gemini-2.5-flash"}),h.jsx("option",{value:"openai/gpt-4o-mini"}),h.jsx("option",{value:"ollama/gemma3:4b"})]})]}),h.jsxs("div",{style:{display:"flex",gap:"12px"},children:[h.jsxs("div",{className:"flex flex-col flex-1",style:{gap:"4px"},children:[h.jsx("label",{className:"vscode-sidebar-section-title",style:{padding:0},children:"Chave de API (Opcional)"}),h.jsx("input",{type:"password",value:oe.api_key,onChange:d=>$e(w=>({...w,api_key:d.target.value})),placeholder:"Ex: sk-..."})]}),h.jsxs("div",{className:"flex flex-col flex-1",style:{gap:"4px"},children:[h.jsx("label",{className:"vscode-sidebar-section-title",style:{padding:0},children:"URL Base da API (Opcional)"}),h.jsx("input",{type:"text",value:oe.api_base,onChange:d=>$e(w=>({...w,api_base:d.target.value})),placeholder:"Ex: http://localhost:11434/v1"})]})]}),h.jsxs("div",{className:"flex flex-col",style:{gap:"4px"},children:[h.jsx("label",{className:"vscode-sidebar-section-title",style:{padding:0},children:"Descrição"}),h.jsx("textarea",{value:oe.description,onChange:d=>$e(w=>({...w,description:d.target.value})),placeholder:"Descrição opcional do projeto...",rows:2,style:{resize:"none"}})]}),h.jsxs("div",{className:"flex flex-col",style:{marginTop:"4px"},children:[h.jsx("button",{type:"button",onClick:()=>le(!X),style:{background:"transparent",border:"none",color:"#007acc",cursor:"pointer",display:"flex",alignItems:"center",gap:"4px",padding:"4px 0",fontSize:"12px",fontWeight:"bold",textAlign:"left",width:"fit-content"},children:h.jsxs("span",{children:[X?"▼":"▶"," Parâmetros do Modelo (Avançado)"]})}),X&&h.jsxs("div",{style:{border:"1px solid #3c3c3c",borderRadius:"4px",padding:"12px",marginTop:"8px",backgroundColor:"#252526",display:"grid",gridTemplateColumns:"1fr 1fr",gap:"12px"},children:[h.jsxs("div",{className:"flex flex-col",style:{gap:"4px"},children:[h.jsx("label",{className:"vscode-sidebar-section-title",style:{padding:0},children:"Temperature"}),h.jsx("input",{type:"number",step:"0.1",min:"0",max:"2",placeholder:"Ex: 0.7",value:((Au=oe.model_params)==null?void 0:Au.temperature)!==void 0?oe.model_params.temperature:"",onChange:d=>{const w=d.target.value===""?void 0:parseFloat(d.target.value);$e(k=>{const b={...k.model_params};return w===void 0?delete b.temperature:b.temperature=w,{...k,model_params:b}})}})]}),h.jsxs("div",{className:"flex flex-col",style:{gap:"4px"},children:[h.jsx("label",{className:"vscode-sidebar-section-title",style:{padding:0},children:"Max Tokens"}),h.jsx("input",{type:"number",min:"1",placeholder:"Ex: 4096",value:((ju=oe.model_params)==null?void 0:ju.max_tokens)!==void 0?oe.model_params.max_tokens:"",onChange:d=>{const w=d.target.value===""?void 0:parseInt(d.target.value,10);$e(k=>{const b={...k.model_params};return w===void 0?delete b.max_tokens:b.max_tokens=w,{...k,model_params:b}})}})]}),h.jsxs("div",{className:"flex flex-col",style:{gap:"4px"},children:[h.jsx("label",{className:"vscode-sidebar-section-title",style:{padding:0},children:"Context Window (num_ctx)"}),h.jsx("input",{type:"number",min:"1",placeholder:"Ex: 8192",value:((Iu=oe.model_params)==null?void 0:Iu.num_ctx)!==void 0?oe.model_params.num_ctx:"",onChange:d=>{const w=d.target.value===""?void 0:parseInt(d.target.value,10);$e(k=>{const b={...k.model_params};return w===void 0?delete b.num_ctx:b.num_ctx=w,{...k,model_params:b}})}})]}),h.jsxs("div",{className:"flex flex-col",style:{gap:"4px"},children:[h.jsx("label",{className:"vscode-sidebar-section-title",style:{padding:0},children:"Top P"}),h.jsx("input",{type:"number",step:"0.05",min:"0",max:"1",placeholder:"Ex: 0.9",value:((zu=oe.model_params)==null?void 0:zu.top_p)!==void 0?oe.model_params.top_p:"",onChange:d=>{const w=d.target.value===""?void 0:parseFloat(d.target.value);$e(k=>{const b={...k.model_params};return w===void 0?delete b.top_p:b.top_p=w,{...k,model_params:b}})}})]}),h.jsxs("div",{className:"flex flex-col",style:{gap:"4px"},children:[h.jsx("label",{className:"vscode-sidebar-section-title",style:{padding:0},children:"Frequency Penalty"}),h.jsx("input",{type:"number",step:"0.1",min:"-2",max:"2",placeholder:"Ex: 0.0",value:(($u=oe.model_params)==null?void 0:$u.frequency_penalty)!==void 0?oe.model_params.frequency_penalty:"",onChange:d=>{const w=d.target.value===""?void 0:parseFloat(d.target.value);$e(k=>{const b={...k.model_params};return w===void 0?delete b.frequency_penalty:b.frequency_penalty=w,{...k,model_params:b}})}})]}),h.jsxs("div",{className:"flex flex-col",style:{gap:"4px"},children:[h.jsx("label",{className:"vscode-sidebar-section-title",style:{padding:0},children:"Presence Penalty"}),h.jsx("input",{type:"number",step:"0.1",min:"-2",max:"2",placeholder:"Ex: 0.0",value:((Fu=oe.model_params)==null?void 0:Fu.presence_penalty)!==void 0?oe.model_params.presence_penalty:"",onChange:d=>{const w=d.target.value===""?void 0:parseFloat(d.target.value);$e(k=>{const b={...k.model_params};return w===void 0?delete b.presence_penalty:b.presence_penalty=w,{...k,model_params:b}})}})]})]})]}),h.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:"8px",paddingTop:"12px",borderTop:"1px solid #3c3c3c",marginTop:"4px"},children:[h.jsx("button",{type:"button",onClick:()=>$e(null),className:"vscode-button",style:{backgroundColor:"#3c3c3c",color:"#ffffff"},children:"Cancelar"}),h.jsxs("button",{type:"submit",className:"vscode-button",children:[h.jsx(ma,{size:12}),"Salvar Alterações"]})]})]})]})}),Rn&&h.jsx("div",{style:{position:"fixed",inset:0,zIndex:1e3,display:"flex",alignItems:"center",justifyContent:"center",background:"rgba(0,0,0,0.55)",backdropFilter:"blur(4px)",animation:"fadeIn 0.15s ease"},children:h.jsxs("div",{style:{background:"linear-gradient(135deg, #1e1e2e 0%, #252537 100%)",border:"1px solid #3c3c5c",borderRadius:"12px",padding:"28px 32px",maxWidth:"420px",width:"90%",boxShadow:"0 24px 64px rgba(0,0,0,0.6)"},children:[h.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px",marginBottom:"16px"},children:[h.jsx("span",{style:{fontSize:"22px"},children:"🔔"}),h.jsx("span",{style:{fontSize:"12px",fontWeight:700,color:"#a0a0c0",letterSpacing:"0.1em",textTransform:"uppercase"},children:"Confirmação Necessária"})]}),h.jsx("p",{style:{fontSize:"14px",color:"#e0e0f0",lineHeight:1.6,marginBottom:"24px",margin:"0 0 24px 0"},children:Rn.prompt}),h.jsxs("div",{style:{display:"flex",gap:"12px",justifyContent:"flex-end"},children:[h.jsx("button",{id:"confirm-no-btn",onClick:()=>Ou("no"),style:{padding:"8px 20px",borderRadius:"8px",border:"1px solid #4c4c6c",background:"transparent",color:"#a0a0c0",cursor:"pointer",fontSize:"13px",fontWeight:600,transition:"all 0.15s"},onMouseEnter:d=>{d.target.style.background="#2c2c3c",d.target.style.color="#e0e0f0"},onMouseLeave:d=>{d.target.style.background="transparent",d.target.style.color="#a0a0c0"},children:"Não"}),h.jsx("button",{id:"confirm-yes-btn",onClick:()=>Ou("yes"),style:{padding:"8px 24px",borderRadius:"8px",border:"none",background:"linear-gradient(135deg, #007acc, #0062a3)",color:"#fff",cursor:"pointer",fontSize:"13px",fontWeight:700,boxShadow:"0 4px 16px rgba(0,122,204,0.35)",transition:"all 0.15s"},onMouseEnter:d=>{d.target.style.background="linear-gradient(135deg, #0090f0, #007acc)"},onMouseLeave:d=>{d.target.style.background="linear-gradient(135deg, #007acc, #0062a3)"},children:"Sim"})]})]})}),ke&&h.jsx("div",{className:"vscode-modal-overlay",children:h.jsxs("div",{className:"vscode-modal",style:{maxWidth:"440px",width:"90%"},children:[h.jsxs("div",{className:"vscode-sidebar-header",style:{padding:"10px 16px"},children:[h.jsxs("span",{className:"vscode-sidebar-title",style:{color:"#ffffff",display:"flex",alignItems:"center",gap:"8px"},children:[h.jsx(io,{size:14,style:{color:"#007acc"}}),"CONFIGURAÇÕES DA IDE"]}),h.jsx("button",{onClick:()=>Ye(!1),style:{background:"transparent",border:"none",cursor:"pointer",color:"#a0a0a0"},children:h.jsx(Zr,{size:14})})]}),h.jsxs("div",{style:{display:"flex",borderBottom:"1px solid var(--vscode-border)",backgroundColor:"var(--vscode-tab-inactive-bg)"},children:[h.jsx("button",{onClick:()=>Mt("preferences"),style:{flex:1,padding:"8px",background:$t==="preferences"?"var(--vscode-tab-active-bg)":"transparent",border:"none",borderBottom:$t==="preferences"?"2px solid var(--vscode-active-border)":"none",color:$t==="preferences"?"#ffffff":"#808080",fontWeight:"bold",fontSize:"11px",textTransform:"uppercase",cursor:"pointer"},children:"Preferências"}),h.jsx("button",{onClick:()=>Mt("about"),style:{flex:1,padding:"8px",background:$t==="about"?"var(--vscode-tab-active-bg)":"transparent",border:"none",borderBottom:$t==="about"?"2px solid var(--vscode-active-border)":"none",color:$t==="about"?"#ffffff":"#808080",fontWeight:"bold",fontSize:"11px",textTransform:"uppercase",cursor:"pointer"},children:"Sobre"})]}),h.jsx("div",{className:"flex flex-col overflow-y-auto flex-1",style:{padding:"16px",gap:"14px"},children:$t==="preferences"?h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"flex flex-col",style:{gap:"6px"},children:[h.jsx("label",{className:"vscode-sidebar-section-title",style:{padding:0},children:"Tema de Cor"}),h.jsxs("select",{value:Gt,onChange:d=>Jr(d.target.value),style:{width:"100%"},children:[h.jsx("option",{value:"dark",children:"Escuro (Dark Mode)"}),h.jsx("option",{value:"light",children:"Claro (Light Mode)"})]})]}),h.jsxs("div",{className:"flex flex-col",style:{gap:"6px"},children:[h.jsx("label",{className:"vscode-sidebar-section-title",style:{padding:0},children:"Tamanho da Fonte do Editor"}),h.jsx("input",{type:"number",min:"10",max:"30",value:Ft,onChange:d=>{const w=Number(d.target.value);ne(w),Pr("editorFontSize",w)},style:{width:"100%"}})]}),h.jsxs("div",{className:"flex flex-col",style:{gap:"6px"},children:[h.jsx("label",{className:"vscode-sidebar-section-title",style:{padding:0},children:"Tamanho do Tab (Espaços)"}),h.jsxs("select",{value:Ci,onChange:d=>{const w=Number(d.target.value);vg(w),Pr("editorTabSize",w)},style:{width:"100%"},children:[h.jsx("option",{value:2,children:"2 Espaços"}),h.jsx("option",{value:4,children:"4 Espaços"}),h.jsx("option",{value:8,children:"8 Espaços"})]})]}),h.jsxs("div",{className:"flex flex-col",style:{gap:"6px"},children:[h.jsx("label",{className:"vscode-sidebar-section-title",style:{padding:0},children:"Quebra Automática de Linha (Word Wrap)"}),h.jsxs("select",{value:hu,onChange:d=>{yg(d.target.value),Pr("editorWordWrap",d.target.value)},style:{width:"100%"},children:[h.jsx("option",{value:"on",children:"Ativado (On)"}),h.jsx("option",{value:"off",children:"Desativado (Off)"})]})]}),h.jsxs("div",{className:"flex flex-col",style:{gap:"6px",borderTop:"1px solid var(--vscode-border)",paddingTop:"12px",marginTop:"6px"},children:[h.jsx("label",{className:"vscode-sidebar-section-title",style:{padding:0},children:"Dependências Opcionais"}),h.jsx("span",{style:{fontSize:"11px",color:"#888888",lineHeight:"1.4"},children:"Instale recursos extras (Local Embeddings, PyTorch, CUDA, etc.) que otimizam o processamento off-line."}),h.jsx("button",{type:"button",className:"vscode-button",disabled:Rl,onClick:Lu,style:{width:"100%",marginTop:"6px"},children:Rl?"Instalando...":"Instalar Recursos Opcionais"}),kn&&h.jsxs("span",{style:{fontSize:"11px",fontWeight:"bold",color:kn.includes("Erro")||kn.includes("Falha")?"#f48771":"#73c991",marginTop:"4px"},children:["Status: ",kn]}),_u&&h.jsx("textarea",{readOnly:!0,value:_u,style:{width:"100%",height:"80px",marginTop:"8px",fontSize:"10px",fontFamily:"monospace",background:"#151515",color:"#89d4a5",border:"1px solid var(--vscode-border)",padding:"6px",resize:"none"}})]})]}):h.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"14px",color:"#cccccc"},children:[h.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[h.jsx("span",{className:"vscode-sidebar-section-title",style:{padding:0},children:"Versão"}),h.jsx("span",{style:{fontSize:"13px",fontWeight:"bold",color:"#ffffff"},children:"0.1.26 alfa"})]}),h.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[h.jsx("span",{className:"vscode-sidebar-section-title",style:{padding:0},children:"Autor"}),h.jsx("span",{style:{fontSize:"13px",color:"#ffffff"},children:"dev@opala.com"})]}),h.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[h.jsx("span",{className:"vscode-sidebar-section-title",style:{padding:0},children:"Licença"}),h.jsx("span",{style:{fontSize:"13px",color:"#ffffff"},children:"MIT"})]})]})}),h.jsx("div",{style:{display:"flex",justifyContent:"flex-end",padding:"12px 16px",gap:"8px",borderTop:"1px solid var(--vscode-border)",backgroundColor:"var(--vscode-sidebar-bg)"},children:h.jsx("button",{onClick:()=>Ye(!1),className:"vscode-button",children:"Fechar"})})]})})]})}function gg({node:e,selectedFile:t,handleFileSelect:r,handleNodeContextMenu:i,draggedNode:s,setDraggedNode:n,dragOverPath:o,setDragOverPath:l,handleMoveNode:c}){const a=e.isDirectory,[f,u]=P.useState(!1),p=v=>{v.stopPropagation(),n({path:e.path,isDirectory:e.isDirectory}),v.dataTransfer.setData("text/plain",e.path),v.dataTransfer.effectAllowed="move"},y=v=>{v.preventDefault(),v.stopPropagation(),a&&s&&s.path!==e.path&&(l(e.path),v.dataTransfer.dropEffect="move")},g=v=>{v.preventDefault(),v.stopPropagation(),o===e.path&&l(null)},S=v=>{v.preventDefault(),v.stopPropagation(),l(null),a&&s&&s.path!==e.path&&c(s.path,e.path,s.isDirectory)},m=o===e.path?{backgroundColor:"#2d2d2d",border:"1px dashed #007acc"}:{};if(a)return h.jsxs("div",{className:"select-none",draggable:"true",onDragStart:p,onDragOver:y,onDragLeave:g,onDrop:S,children:[h.jsxs("div",{onClick:()=>u(!f),className:"vscode-tree-node",style:m,onContextMenu:v=>i(v,e),children:[f?h.jsx(MS,{size:14}):h.jsx(RS,{size:14}),h.jsx(BS,{size:14,className:"text-white",style:{color:"#e8a838"}}),h.jsx("span",{className:"truncate",children:e.name})]}),f&&h.jsx("div",{style:{paddingLeft:"12px",borderLeft:"1px solid #3c3c3c",marginLeft:"14px"},children:e.children.map(v=>h.jsx(gg,{node:v,selectedFile:t,handleFileSelect:r,handleNodeContextMenu:i,draggedNode:s,setDraggedNode:n,dragOverPath:o,setDragOverPath:l,handleMoveNode:c},v.path))})]});const _=t===e.path;return h.jsxs("div",{onClick:()=>r(e.path),className:`vscode-tree-node ${_?"active":""}`,draggable:"true",onDragStart:p,onContextMenu:v=>i(v,e),children:[h.jsx(TS,{size:13,style:{color:"#a0a0a0"}}),h.jsx("span",{className:"truncate",children:e.name})]})}function tC(e){return e?e.split(`
225
225
  `).map((r,i)=>{const s=r.trim();if(s.startsWith("### ")){const n=s.replace("### ","");return h.jsx("h4",{style:{margin:"14px 0 6px 0",fontWeight:"bold",color:"#ffffff",fontSize:"13px"},children:n},i)}if(s.startsWith("🔹 ")||s.startsWith("⭐ ")){const n=s.substring(0,2),l=s.substring(2).split("—");if(l.length>=2){const c=l[0].replace(/\*\*`|`\*\*/g,"").trim(),a=l.slice(1).join("—").trim();return h.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:"6px",margin:"4px 0",paddingLeft:"4px"},children:[h.jsx("span",{style:{fontSize:"12px",flexShrink:0},children:n}),h.jsxs("span",{style:{fontSize:"13px",lineHeight:"1.4"},children:[h.jsx("code",{style:{background:"#2d2d2d",padding:"2px 4px",borderRadius:"3px",color:"#f8f8f2",fontFamily:"monospace",fontSize:"11px",marginRight:"6px"},children:c}),h.jsx("span",{style:{color:"#cccccc"},children:a})]})]},i)}}if(s.startsWith("_(")&&s.endsWith(")_")){const n=s.substring(2,s.length-2);return h.jsx("p",{style:{margin:"8px 0",fontStyle:"italic",color:"#8a8a8a",fontSize:"11px"},children:n},i)}return h.jsx("div",{style:{minHeight:"1.2em",color:"#cccccc",fontSize:"13px",margin:"2px 0"},children:r},i)}):null}Ra.createRoot(document.getElementById("root")).render(h.jsx(ci.StrictMode,{children:h.jsx(eC,{})}));
@@ -9,7 +9,7 @@
9
9
  <link rel="preconnect" href="https://fonts.googleapis.com">
10
10
  <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
11
11
  <link href="https://fonts.googleapis.com/css2?family=Fira+Code:wght@300;400;500;600;700&family=Inter:wght@300;400;500;600;700&family=Outfit:wght@300;400;500;600;700;800&display=swap" rel="stylesheet">
12
- <script type="module" crossorigin src="/assets/index-BQg8XLlL.js"></script>
12
+ <script type="module" crossorigin src="/assets/index-Bp5KKCcR.js"></script>
13
13
  <link rel="stylesheet" crossorigin href="/assets/index-_ON06SYj.css">
14
14
  </head>
15
15
  <body>
@@ -149,9 +149,9 @@ class ProjectStore:
149
149
  for line in f:
150
150
  line = line.strip()
151
151
  if line.startswith("OPENAI_API_KEY="):
152
- d["api_key"] = line.split("=", 1)[1].strip()
152
+ d["api_key"] = line.split("=", 1)[1].strip().strip('"').strip("'")
153
153
  elif line.startswith("OPENAI_API_BASE="):
154
- d["api_base"] = line.split("=", 1)[1].strip()
154
+ d["api_base"] = line.split("=", 1)[1].strip().strip('"').strip("'")
155
155
  except Exception:
156
156
  pass
157
157
 
@@ -286,9 +286,9 @@ class ProjectStore:
286
286
  for line in f:
287
287
  line = line.strip()
288
288
  if line.startswith("OPENAI_API_KEY="):
289
- api_key = line.split("=", 1)[1].strip()
289
+ api_key = line.split("=", 1)[1].strip().strip('"').strip("'")
290
290
  elif line.startswith("OPENAI_API_BASE="):
291
- api_base = line.split("=", 1)[1].strip()
291
+ api_base = line.split("=", 1)[1].strip().strip('"').strip("'")
292
292
  except Exception:
293
293
  pass
294
294
 
@@ -81,7 +81,26 @@ def set_project_context(session, store=None) -> None:
81
81
  global _PROJECT_PATH, _PROJECT_SESSION, _PROJECT_STORE
82
82
  _PROJECT_SESSION = session
83
83
  _PROJECT_STORE = store
84
- _PROJECT_PATH = os.path.abspath(session.project_path) if getattr(session, "project_path", "") else os.getcwd()
84
+ if session:
85
+ _PROJECT_PATH = os.path.abspath(session.project_path) if getattr(session, "project_path", "") else os.getcwd()
86
+
87
+ # Load project-specific .env file if it exists
88
+ env_path = os.path.join(_PROJECT_PATH, ".env")
89
+ if os.path.isfile(env_path):
90
+ from dotenv import load_dotenv
91
+ try:
92
+ load_dotenv(dotenv_path=env_path, override=True)
93
+ except Exception:
94
+ pass
95
+
96
+ # Also explicitly propagate api_key and api_base from session if present
97
+ if getattr(session, "api_key", None):
98
+ os.environ["OPENAI_API_KEY"] = session.api_key
99
+ if getattr(session, "api_base", None):
100
+ os.environ["OPENAI_API_BASE"] = session.api_base
101
+ else:
102
+ _PROJECT_PATH = os.getcwd()
103
+
85
104
 
86
105
  def get_project_path() -> str:
87
106
  return _PROJECT_PATH or os.getcwd()
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "opalacoder"
7
- version = "0.1.25"
7
+ version = "0.1.26"
8
8
  description = "Autonomous coding agent with interactive planning and modular execution"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.11"
@@ -205,3 +205,37 @@ def test_create_initializes_shadow_git(store, tmp_path):
205
205
  assert git_dir.exists()
206
206
  assert git_dir.is_dir()
207
207
 
208
+
209
+ def test_set_project_context_loads_env_and_propagates_keys(tmp_path):
210
+ import os
211
+ from opalacoder.tools import set_project_context
212
+ from opalacoder.project import ProjectData
213
+
214
+ proj_dir = tmp_path / "my_env_project"
215
+ proj_dir.mkdir()
216
+ env_file = proj_dir / ".env"
217
+ env_file.write_text("CUSTOM_VAR=my_value\nOPENAI_API_KEY=file_key\nOPENAI_API_BASE=file_base\n")
218
+
219
+ # 1. Test loading from file
220
+ p = ProjectData(name="test", project_path=str(proj_dir))
221
+ set_project_context(p)
222
+
223
+ assert os.environ.get("CUSTOM_VAR") == "my_value"
224
+ assert os.environ.get("OPENAI_API_KEY") == "file_key"
225
+ assert os.environ.get("OPENAI_API_BASE") == "file_base"
226
+
227
+ # Clean up custom var
228
+ os.environ.pop("CUSTOM_VAR", None)
229
+
230
+ # 2. Test session properties overriding env
231
+ p_with_keys = ProjectData(
232
+ name="test",
233
+ project_path=str(proj_dir),
234
+ api_key="session_key",
235
+ api_base="session_base"
236
+ )
237
+ set_project_context(p_with_keys)
238
+ assert os.environ.get("OPENAI_API_KEY") == "session_key"
239
+ assert os.environ.get("OPENAI_API_BASE") == "session_base"
240
+
241
+
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes