├── .agentrules ├── .changeset ├── README.md ├── clean-carrots-dress.md ├── clever-eggs-perform.md ├── config.json └── yellow-moose-bathe.md ├── .changie.yaml ├── .eslintrc.json ├── .gitattributes ├── .github ├── CODEOWNERS ├── ISSUE_TEMPLATE │ ├── bug_report.yml │ └── config.yml ├── dependabot.yml ├── pull_request_template.md ├── scripts │ ├── coverage_check │ │ ├── __init__.py │ │ ├── __main__.py │ │ ├── extraction.py │ │ ├── github_api.py │ │ ├── util.py │ │ └── workflow.py │ ├── overwrite_changeset_changelog.py │ └── tests │ │ └── coverage_check_test.py └── workflows │ ├── SECURITY.md │ ├── changeset-converter.yml │ ├── codeql-analysis.yml │ ├── codeql.yml │ ├── lint-format.yml │ ├── publish.yml │ └── test.yml ├── .gitignore ├── .husky ├── pre-commit └── pre-push ├── .nvmrc ├── .prettierignore ├── .prettierrc.json ├── .python-version ├── .vscode-test.mjs ├── .vscode ├── codegenesis.code-workspace ├── extensions.json ├── launch.json ├── settings.json └── tasks.json ├── .vscodeignore ├── CHANGELOG.md ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── SECURITY.md ├── assets ├── .archive │ ├── icon.png │ ├── icon2.png │ ├── robot_panel_dark.png │ └── robot_panel_light.png └── icons │ ├── icon - Copy.png │ ├── icon-black - Copy.png │ ├── icon-black.png │ ├── icon-black.svg │ ├── icon.png │ ├── icon.svg │ ├── robot_panel_dark.png │ └── robot_panel_light.png ├── dockerfile ├── docs ├── PRIVACY.md ├── PROTOCOL.md ├── README.md ├── apex-customization │ └── apexignore.md ├── architecture │ ├── README.md │ ├── backend_communication_protocol.md │ └── extension-architecture.mmd ├── contributing │ └── developer-workflow.md ├── getting-started-new-coders │ ├── README.md │ └── installing-dev-essentials.md ├── mcp │ ├── README.md │ ├── mcp-quickstart.md │ ├── mcp-server-from-github.md │ └── mcp-server-from-scratch.md ├── prompting │ ├── README.md │ └── custom instructions library │ │ ├── README.md │ │ ├── cline-memory-bank.md │ │ └── raw-instructions │ │ └── cline-memory-bank.md └── tools │ ├── apex-tools-guide.md │ └── mentions-guide.md ├── esbuild.cjs ├── esbuild.js ├── eslint.config.js ├── locales ├── ar-sa │ ├── CODE_OF_CONDUCT.md │ ├── CONTRIBUTING.md │ └── README.md ├── de │ ├── CODE_OF_CONDUCT.md │ ├── CONTRIBUTING.md │ └── README.md ├── es │ ├── CODE_OF_CONDUCT.md │ ├── CONTRIBUTING.md │ └── README.md ├── ja │ ├── CODE_OF_CONDUCT.md │ ├── CONTRIBUTING.md │ └── README.md ├── ko │ ├── CODE_OF_CONDUCT.md │ ├── CONTRIBUTING.md │ └── README.md ├── pt-BR │ ├── CODE_OF_CONDUCT.md │ ├── CONTRIBUTING.md │ └── README.md ├── zh-cn │ ├── CODE_OF_CONDUCT.md │ ├── CONTRIBUTING.md │ └── README.md └── zh-tw │ ├── CODE_OF_CONDUCT.md │ ├── CONTRIBUTING.md │ └── README.md ├── package-lock.json ├── package.json ├── plutonium-config.json ├── python_backend ├── .gitignore ├── README.md ├── config.yaml ├── personas │ └── SE-Apex.md ├── prompts │ ├── analyze_and_recover.txt │ ├── critique_Clarity_Reviewer.txt │ ├── critique_Completeness_Checker.txt │ ├── critique_Logical_Validator.txt │ ├── critique_Risk_Assessor.txt │ ├── generate_phases.txt │ ├── generate_steps.txt │ ├── generate_tasks.txt │ ├── revise_steps.txt │ └── select_persona.txt ├── requirements-test.txt ├── requirements.txt └── src │ ├── __init__.py │ ├── __pycache__ │ ├── handlers.cpython-312.pyc │ └── protocol_types.cpython-312.pyc │ ├── core │ ├── __init__.py │ ├── checklist_generator.py │ ├── checkpoint_manager.py │ └── reasoning_tree.py │ ├── council │ ├── __init__.py │ └── council_critique.py │ ├── exceptions.py │ ├── handlers.py │ ├── knowledge_manager.py │ ├── main.py │ ├── protocol_types.py │ ├── pyrightconfig.json │ ├── qa │ ├── __init__.py │ └── validator.py │ └── utils │ ├── __init__.py │ ├── __pycache__ │ ├── __init__.cpython-312.pyc │ └── config_loader.cpython-312.pyc │ ├── config_loader.py │ └── prompt_manager.py ├── scripts ├── plutonium.cjs ├── plutonium.js ├── plutonium │ ├── assets │ │ └── plutonium-icon.png │ ├── config-manager.js │ ├── cross-language-fixer.js │ ├── dependency-checker.cjs │ ├── dependency-checker.js.bak │ ├── dependency-harmonizer.js │ ├── dependency-updater.js │ ├── script-fixer.js │ ├── script-validator.js │ └── utils.js ├── pre-push-check.cjs ├── pre-push-check.js └── test-ci.cjs ├── src ├── api │ ├── index.ts │ ├── providers │ │ ├── anthropic.ts │ │ ├── asksage.ts │ │ ├── bedrock.ts │ │ ├── deepseek.ts │ │ ├── gemini.ts │ │ ├── litellm.ts │ │ ├── lmstudio.ts │ │ ├── mistral.ts │ │ ├── ollama.ts │ │ ├── openai-native.ts │ │ ├── openai.ts │ │ ├── openrouter.ts │ │ ├── qwen.ts │ │ ├── requesty.ts │ │ ├── sambanova.ts │ │ ├── together.ts │ │ ├── types.ts │ │ ├── vertex.ts │ │ ├── vscode-lm.ts │ │ └── xai.ts │ ├── retry.test.ts │ ├── retry.ts │ └── transform │ │ ├── gemini-format.ts │ │ ├── mistral-format.ts │ │ ├── o1-format.ts │ │ ├── ollama-format.ts │ │ ├── openai-format.ts │ │ ├── openrouter-stream.ts │ │ ├── r1-format.ts │ │ ├── stream.ts │ │ └── vscode-lm-format.ts ├── core │ ├── README.md │ ├── assistant-message │ │ ├── diff.ts │ │ ├── index.ts │ │ └── parse-assistant-message.ts │ ├── context-management │ │ ├── ContextManager.ts │ │ └── context-error-handling.ts │ ├── controller │ │ ├── index.ts │ │ └── modules │ │ │ ├── api-helpers.ts │ │ │ ├── auth-handler.ts │ │ │ ├── context-actions.ts │ │ │ ├── history-manager.ts │ │ │ ├── mcp-handler.ts │ │ │ ├── misc-helpers.ts │ │ │ ├── state-updater.ts │ │ │ ├── task-lifecycle.ts │ │ │ └── webview-handler.ts │ ├── ignore │ │ ├── ApexIgnoreController.test.ts │ │ └── ApexIgnoreController.ts │ ├── mentions │ │ └── index.ts │ ├── prompts │ │ ├── responses.ts │ │ ├── system.ts │ │ └── system │ │ │ ├── capabilities.ts │ │ │ ├── custom-instructions.ts │ │ │ ├── editing.ts │ │ │ ├── index.ts │ │ │ ├── intro.ts │ │ │ ├── mcp.ts │ │ │ ├── modes.ts │ │ │ ├── objective.ts │ │ │ ├── prompt_module_content_pseudocode.txt │ │ │ ├── rules.ts │ │ │ ├── system-info.ts │ │ │ ├── tool-usage.ts │ │ │ ├── tools.ts │ │ │ └── tools.txt │ ├── storage │ │ ├── disk.ts │ │ ├── state-keys.ts │ │ └── state.ts │ ├── task │ │ ├── index.ts │ │ └── modules │ │ │ ├── api-handler.ts │ │ │ ├── api_handler │ │ │ ├── api-request-builder.ts │ │ │ ├── api-request.ts │ │ │ ├── api-stream-handler.ts │ │ │ ├── api-tool-processor.ts │ │ │ ├── helpers.ts │ │ │ ├── loop-controller.ts │ │ │ └── loop-controller │ │ │ │ ├── limit-checks.ts │ │ │ │ ├── post-stream-processing.ts │ │ │ │ ├── request-preparation.ts │ │ │ │ └── stream-processing.ts │ │ │ ├── backend-communicator.ts │ │ │ ├── checkpoint-manager.ts │ │ │ ├── context-loader.ts │ │ │ ├── state-manager.ts │ │ │ ├── stream-processor.ts │ │ │ ├── tool-executor.ts │ │ │ ├── tools │ │ │ ├── browser-tools.ts │ │ │ ├── code-analysis-tools.ts │ │ │ ├── command-tools.ts │ │ │ ├── file-system-tools.ts │ │ │ ├── index.ts │ │ │ ├── interaction-tools.ts │ │ │ └── mcp-tools.ts │ │ │ └── webview-communicator.ts │ └── webview │ │ ├── getNonce.ts │ │ ├── getUri.ts │ │ └── index.ts ├── dev │ └── commands │ │ └── tasks.ts ├── exports │ ├── README.md │ ├── apex.d.ts │ └── index.ts ├── extension.ts ├── integrations │ ├── checkpoints │ │ ├── Checkpoint-test-utils.ts.bak │ │ ├── CheckpointCommit.test.ts.bak │ │ ├── CheckpointCreation.test.ts.bak │ │ ├── CheckpointDiff.test.ts.bak │ │ ├── CheckpointDisabled.test.ts.bak │ │ ├── CheckpointExclusions.ts │ │ ├── CheckpointGitOperations.ts │ │ ├── CheckpointMigration.ts │ │ ├── CheckpointRevert.test.ts.bak │ │ ├── CheckpointTaskSwitch.test.ts.bak │ │ ├── CheckpointTracker-old.ts │ │ ├── CheckpointTracker.ts │ │ └── CheckpointUtils.ts │ ├── debug │ │ └── DebugConsoleManager.ts │ ├── diagnostics │ │ ├── DiagnosticsMonitor.ts │ │ └── index.ts │ ├── editor │ │ ├── DecorationController.ts │ │ ├── DiffViewProvider.ts │ │ └── detect-omission.ts │ ├── misc │ │ ├── export-markdown.ts │ │ ├── extract-text.ts │ │ ├── link-preview.ts │ │ ├── open-file.ts │ │ └── process-images.ts │ ├── notifications │ │ └── index.ts │ ├── terminal │ │ ├── TerminalManager.ts │ │ ├── TerminalProcess.test.ts │ │ ├── TerminalProcess.ts │ │ ├── TerminalRegistry.ts │ │ ├── ansiUtils.ts │ │ └── get-latest-output.ts │ ├── theme │ │ ├── default-themes │ │ │ ├── dark_modern.json │ │ │ ├── dark_plus.json │ │ │ ├── dark_vs.json │ │ │ ├── hc_black.json │ │ │ ├── hc_light.json │ │ │ ├── light_modern.json │ │ │ ├── light_plus.json │ │ │ └── light_vs.json │ │ └── getTheme.ts │ └── workspace │ │ ├── WorkspaceTracker.ts │ │ └── get-python-env.ts ├── services │ ├── account │ │ └── ApexAccountService.ts │ ├── auth │ │ └── config.ts │ ├── browser │ │ ├── BrowserSession.ts │ │ └── UrlContentFetcher.ts │ ├── glob │ │ └── list-files.ts │ ├── logging │ │ └── Logger.ts │ ├── mcp │ │ └── McpHub.ts │ ├── ripgrep │ │ └── index.ts │ ├── telemetry │ │ └── TelemetryService.ts │ └── tree-sitter │ │ ├── index.ts │ │ ├── languageParser.ts │ │ └── queries │ │ ├── c-sharp.ts │ │ ├── c.ts │ │ ├── cpp.ts │ │ ├── go.ts │ │ ├── index.ts │ │ ├── java.ts │ │ ├── javascript.ts │ │ ├── kotlin.ts │ │ ├── php.ts │ │ ├── python.ts │ │ ├── ruby.ts │ │ ├── rust.ts │ │ ├── swift.ts │ │ └── typescript.ts ├── shared │ ├── ApexAccount.ts │ ├── AutoApprovalSettings.ts │ ├── BackendProtocol.ts │ ├── BrowserSettings.ts │ ├── ChatContent.ts │ ├── ChatSettings.ts │ ├── ExtensionMessage.ts │ ├── HistoryItem.ts │ ├── Languages.ts │ ├── TelemetrySetting.ts │ ├── UserInfo.ts │ ├── WebviewMessage.ts │ ├── api.ts │ ├── array.test.ts │ ├── array.ts │ ├── combineApiRequests.ts │ ├── combineCommandSequences.ts │ ├── context-mentions.ts │ ├── getApiMetrics.ts │ ├── mcp.ts │ ├── types.ts │ └── vsCodeSelectorUtils.ts ├── test │ ├── api-request.test.ts │ ├── browser-tools.test.ts │ ├── code-analysis-tools.test.ts │ ├── command-tools.test.ts │ ├── extension.test.ts │ ├── file-system-tools.test.ts │ ├── interaction-tools.test.ts │ ├── mcp-tools.test.ts │ ├── shell.test.ts │ ├── suite │ │ ├── extension.test.js │ │ └── index.js │ ├── types │ │ └── chai-lib-chai.d.ts │ └── webview │ │ └── chat-native.test.ts └── utils │ ├── cost.test.ts │ ├── cost.ts │ ├── fs.test.ts │ ├── fs.ts │ ├── git.ts │ ├── path.test.ts │ ├── path.ts │ ├── shell.ts │ ├── storage.ts │ ├── string.test.ts │ ├── string.ts │ ├── time.ts │ └── validation.ts ├── test └── import-graph.mjs ├── tsconfig.json ├── tsconfig.test.json ├── webview-ui ├── .gitignore ├── .prettierrc ├── eslint.config.js ├── index.html ├── package-lock.json ├── package.json ├── src │ ├── App.tsx │ ├── assets │ │ ├── ApexLogoWhite.png │ │ └── ApexLogoWhite.tsx │ ├── components │ │ ├── account │ │ │ ├── AccountOptions.tsx │ │ │ ├── AccountView.tsx │ │ │ └── CreditsHistoryTable.tsx │ │ ├── browser │ │ │ └── BrowserSettingsMenu.tsx │ │ ├── chat │ │ │ ├── Announcement.tsx │ │ │ ├── AutoApproveMenu.tsx │ │ │ ├── BrowserSessionRow.tsx │ │ │ ├── BrowserSessionRow │ │ │ │ ├── BrowserActionList.tsx │ │ │ │ ├── BrowserPagination.tsx │ │ │ │ └── BrowserStateDisplay.tsx │ │ │ ├── ChatErrorBoundary.tsx │ │ │ ├── ChatRow.tsx │ │ │ ├── ChatRow │ │ │ │ ├── ApiRequestRenderer.tsx │ │ │ │ ├── CommandRenderer.tsx │ │ │ │ ├── DefaultMessageRenderer.tsx │ │ │ │ ├── FeedbackRenderer.tsx │ │ │ │ ├── McpRenderer.tsx │ │ │ │ ├── MessageHeader.tsx │ │ │ │ └── ToolCallRenderer.tsx │ │ │ ├── ChatTextArea.tsx │ │ │ ├── ChatTextArea │ │ │ │ ├── ChatControls.tsx │ │ │ │ ├── ImageThumbnails.tsx │ │ │ │ ├── ModeSwitch.tsx │ │ │ │ ├── ModelSelector.tsx │ │ │ │ └── useContextMentions.ts │ │ │ ├── ChatView.tsx │ │ │ ├── ChatView │ │ │ │ ├── ChatInputArea.tsx │ │ │ │ ├── ChatMessageList.tsx │ │ │ │ ├── ChatViewWelcome.tsx │ │ │ │ ├── useChatScrollManager.ts │ │ │ │ └── useChatViewState.ts │ │ │ ├── ContextMenu.tsx │ │ │ ├── CreditLimitError.tsx │ │ │ ├── OptionsButtons.tsx │ │ │ ├── TaskFeedbackButtons.tsx │ │ │ ├── TaskHeader.tsx │ │ │ └── __tests__ │ │ │ │ └── Announcement.spec.tsx │ │ ├── common │ │ │ ├── CheckmarkControl.tsx │ │ │ ├── CheckpointControls.tsx │ │ │ ├── CodeAccordian.tsx │ │ │ ├── CodeBlock.tsx │ │ │ ├── DangerButton.tsx │ │ │ ├── Demo.tsx │ │ │ ├── MarkdownBlock.tsx │ │ │ ├── MermaidBlock.tsx │ │ │ ├── SettingsButton.tsx │ │ │ ├── SuccessButton.tsx │ │ │ ├── TelemetryBanner.tsx │ │ │ ├── Thumbnails.tsx │ │ │ ├── Tooltip.tsx │ │ │ └── VSCodeButtonLink.tsx │ │ ├── history │ │ │ ├── HistoryPreview.tsx │ │ │ └── HistoryView.tsx │ │ ├── mcp │ │ │ ├── ImagePreview.tsx │ │ │ ├── LinkPreview.tsx │ │ │ ├── McpResourceRow.tsx │ │ │ ├── McpResponseDisplay.tsx │ │ │ ├── McpRichUtil.ts │ │ │ ├── McpToolRow.tsx │ │ │ ├── McpView.tsx │ │ │ ├── RICH_MCP_TESTING.md │ │ │ ├── marketplace │ │ │ │ ├── McpMarketplaceCard.tsx │ │ │ │ ├── McpMarketplaceView.tsx │ │ │ │ └── McpSubmitCard.tsx │ │ │ └── tabs │ │ │ │ └── AddRemoteServerForm.tsx │ │ ├── settings │ │ │ ├── ApexAccountInfoCard.tsx │ │ │ ├── ApiOptions.tsx │ │ │ ├── ModelDescriptionMarkdown.tsx │ │ │ ├── OpenAiModelPicker.tsx │ │ │ ├── OpenRouterModelPicker.tsx │ │ │ ├── SettingsView.tsx │ │ │ ├── TabNavbar.tsx │ │ │ ├── ThinkingBudgetSlider.tsx │ │ │ └── __tests__ │ │ │ │ └── APIOptions.spec.tsx │ │ └── welcome │ │ │ └── WelcomeView.tsx │ ├── context │ │ ├── ExtensionStateContext.tsx │ │ └── FirebaseAuthContext.tsx │ ├── index.css │ ├── main.tsx │ ├── services │ │ └── local-auth.ts │ ├── setupTests.ts │ ├── utils │ │ ├── __tests__ │ │ │ ├── hooks.spec.ts │ │ │ └── platformUtils.spec.ts │ │ ├── context-mentions.ts │ │ ├── format.ts │ │ ├── getLanguageFromPath.ts │ │ ├── hooks.ts │ │ ├── mcp.ts │ │ ├── platformUtils.ts │ │ ├── size.ts │ │ ├── textMateToHljs.ts │ │ ├── useDebounceEffect.ts │ │ ├── validate.ts │ │ ├── vscStyles.ts │ │ └── vscode.ts │ └── vite-env.d.ts ├── tsconfig.app.json ├── tsconfig.json ├── tsconfig.node.json └── vite.config.ts └── workbench ├── CHECKLIST ├── .archive │ ├── phase_1_copilot_analysis_and_extension_scaffolding │ │ ├── 1_1.md │ │ ├── 1_2.md │ │ ├── 1_3.md │ │ └── 1_4.md │ ├── phase_2_direct_api_integration │ │ ├── README.md │ │ ├── Task_2.1_API_Key_Management.md │ │ ├── Task_2.2_Install_SDKs.md │ │ ├── Task_2.3_Refactor_Handler.md │ │ ├── Task_2.4_Model_Mapping_Config.md │ │ └── Task_2.5_System_Prompt_Persona.md │ ├── phase_2_panel_interception_and_ui_implementation │ │ ├── 2_1.md │ │ ├── 2_2.md │ │ └── 2_3.md │ ├── phase_3_backend_integration_and_feature_mapping │ │ ├── Task3.10_Pass_Editor_Context.md │ │ ├── Task3.1_Define_Protocol.md │ │ ├── Task3.2_Implement_Backend_Handlers.md │ │ ├── Task3.3_Implement_Client_Logic.md │ │ ├── Task3.4_Connect_UI_Actions.md │ │ ├── Task3.5_Implement_Response_Handling.md │ │ ├── Task3.6_Map_Copilot_Commands.md │ │ ├── Task3.7_Replicate_Context_Menus.md │ │ ├── Task3.8_Map_Copilot_Shortcuts.md │ │ └── Task3.9_Implement_UI_State_Management.md │ └── phase_4_testing_packaging_and_deployment │ │ ├── Task4.1_Integration_Tests.md │ │ ├── Task4.2_Verify_Interception.md │ │ ├── Task4.3_Define_Python_Bundling.md │ │ ├── Task4.4_Implement_Activation.md │ │ ├── Task4.5_Finalize_Python_Deps.md │ │ ├── Task4.6_Implement_Error_Handling.md │ │ ├── Task4.7_Configure_Build_Process.md │ │ ├── Task4.8_Generate_VSIX.md │ │ └── Task4.9_Test_VSIX_Installation.md ├── COMPLETED │ ├── comprehensive_remaining_tasks_prompt.md │ ├── phase_1_extension_setup │ │ └── README.md │ └── phase_2_vscode_lm_api_ARCHIVED │ │ ├── README.md │ │ ├── Task_2.1_Implement_handleRequest.md │ │ ├── Task_2.2_Integrate_LM_Service.md │ │ ├── Task_2.3_Handle_Streaming_Response.md │ │ └── Task_2.4_Basic_Error_Handling.md ├── phase_3_tool_integration │ ├── README.md │ ├── Task_3.1_Define_Tool_Spec.md │ ├── Task_3.2_Expose_Tools.md │ ├── Task_3.3_Handle_Tool_Calls.md │ ├── Task_3.4_Execute_Tools.md │ └── Task_3.5_Return_Tool_Results.md ├── phase_4_advanced_agent_logic │ └── README.md ├── phase_5_testing_and_refinement │ └── README.md └── phase_6_build_and_packaging │ └── README.md ├── STANDARDS_REPOSITORY ├── APEX_IDE_EXTENSION_INSTRUCTIONS.md ├── README.md ├── apex │ ├── STANDARDS.md │ └── STANDARDS_PRIORITY_INDEX.md ├── enhancements.md ├── nasa │ ├── NASA_STANDARDS.md │ ├── NASA_STANDARDS_PRIORITY_INDEX.md │ └── source_docs │ │ ├── NASA-STD-87398-RevisionB.pdf │ │ ├── nasa-10-rules.pdf │ │ └── nasa-std-87399_with_change_1.pdf └── prompt-templates │ ├── EXAMPLE_Personal_AI_Assistant_Prompt.md │ ├── PROMPT_TEMPLATE_v1.0.0.md │ ├── PROMPT_TEMPLATE_v1.0.1.md │ └── PROMPT_TEMPLATE_v1.1.0.md ├── personas ├── AIE-Apex │ ├── Apex_AI_Engineering_Engine_(AIE-Apex)_persona.json │ ├── Apex_AI_Engineering_Engine_(AIE-Apex)_persona.md │ ├── Apex_AI_Engineering_Engine_(AIE-Apex)_persona.xml │ └── Apex_AI_Engineering_Engine_(AIE-Apex)_persona.yaml ├── APSS-Apex │ ├── Apex_Project_Synthesis_Sovereign_(APSS)_persona.json │ ├── Apex_Project_Synthesis_Sovereign_(APSS)_persona.xml │ └── Apex_Project_Synthesis_Sovereign_(APSS)_persona.yaml ├── Chameleon │ ├── Apex_Style_Synthesizer_(Chameleon)_persona.json │ ├── Apex_Style_Synthesizer_(Chameleon)_persona.md │ ├── Apex_Style_Synthesizer_(Chameleon)_persona.xml │ └── Apex_Style_Synthesizer_(Chameleon)_persona.yaml ├── IDE-Architect-Apex │ └── IDE_Architect_Apex_persona.yaml ├── POE-Apex │ ├── Apex_Project_Orchestration_Engine_(POE-Apex)_persona.json │ ├── Apex_Project_Orchestration_Engine_(POE-Apex)_persona.md │ ├── Apex_Project_Orchestration_Engine_(POE-Apex)_persona.xml │ └── Apex_Project_Orchestration_Engine_(POE-Apex)_persona.yaml └── SE-Apex │ ├── Apex_Software_Synthesis_Engine_(SE-Apex)_persona.json │ ├── Apex_Software_Synthesis_Engine_(SE-Apex)_persona.md │ ├── Apex_Software_Synthesis_Engine_(SE-Apex)_persona.xml │ └── Apex_Software_Synthesis_Engine_(SE-Apex)_persona.yaml ├── process_large_json.js └── prompts ├── fix_backend_connection_prompt.md ├── handoff-debug-backend-docking-20250407-1449.md └── refactor-chat-components-handoff.md /.changeset/README.md: -------------------------------------------------------------------------------- 1 | # Changesets 2 | 3 | Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works 4 | with multi-package repos, or single-package repos to help you version and publish your code. You can 5 | find the full documentation for it [in our repository](https://github.com/changesets/changesets) 6 | 7 | We have a quick list of common questions to get you started engaging with this project in 8 | [our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md) 9 | -------------------------------------------------------------------------------- /.changeset/clean-carrots-dress.md: -------------------------------------------------------------------------------- 1 | --- 2 | "claude-dev": patch 3 | --- 4 | 5 | chore(bedrock): Prompt cache is GA 6 | -------------------------------------------------------------------------------- /.changeset/clever-eggs-perform.md: -------------------------------------------------------------------------------- 1 | --- 2 | "claude-dev": minor 3 | --- 4 | 5 | Add Enable extended thinking for LiteLLM provider 6 | -------------------------------------------------------------------------------- /.changeset/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://unpkg.com/@changesets/config@3.0.5/schema.json", 3 | "changelog": "@changesets/cli/changelog", 4 | "commit": false, 5 | "fixed": [], 6 | "linked": [], 7 | "access": "restricted", 8 | "baseBranch": "main", 9 | "updateInternalDependencies": "patch", 10 | "ignore": [] 11 | } 12 | -------------------------------------------------------------------------------- /.changeset/yellow-moose-bathe.md: -------------------------------------------------------------------------------- 1 | --- 2 | "claude-dev": patch 3 | --- 4 | 5 | Added permissions checks, error handling, and git options to deal with cases where the entire workspace or specific files within it cannot be accessed. These issues were preventing checkpoints from working correctly, or causing checkpoints to hang. 6 | -------------------------------------------------------------------------------- /.changie.yaml: -------------------------------------------------------------------------------- 1 | changesDir: .changes 2 | unreleasedDir: unreleased 3 | headerPath: header.tpl.md 4 | changelogPath: CHANGELOG.md 5 | versionExt: md 6 | versionFormat: '## {{.Version}} - {{.Time.Format "2006-01-02"}}' 7 | kindFormat: "### {{.Kind}}" 8 | changeFormat: "* {{.Body}}" 9 | kinds: 10 | - label: Added 11 | auto: minor 12 | - label: Changed 13 | auto: major 14 | - label: Deprecated 15 | auto: minor 16 | - label: Removed 17 | auto: major 18 | - label: Fixed 19 | auto: patch 20 | - label: Security 21 | auto: patch 22 | newlines: 23 | afterChangelogHeader: 1 24 | beforeChangelogVersion: 1 25 | endOfVersion: 1 26 | envPrefix: CHANGIE_ 27 | -------------------------------------------------------------------------------- /.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "root": true, 3 | "parser": "@typescript-eslint/parser", 4 | "parserOptions": { 5 | "ecmaVersion": 6, 6 | "sourceType": "module" 7 | }, 8 | "plugins": ["@typescript-eslint"], 9 | "rules": { 10 | "@typescript-eslint/naming-convention": [ 11 | "warn", 12 | { 13 | "selector": "import", 14 | "format": ["camelCase", "PascalCase"] 15 | } 16 | ], 17 | "@typescript-eslint/semi": "off", 18 | "curly": "warn", 19 | "eqeqeq": "warn", 20 | "no-throw-literal": "warn", 21 | "semi": "off", 22 | "react-hooks/exhaustive-deps": "off" 23 | }, 24 | "ignorePatterns": ["out", "dist", "**/*.d.ts"] 25 | } 26 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | demo.gif filter=lfs diff=lfs merge=lfs -text 2 | assets/docs/demo.gif filter=lfs diff=lfs merge=lfs -text 3 | -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | * @justinlietz93 @ShaneTibert 2 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.yml: -------------------------------------------------------------------------------- 1 | name: 🐛 Bug Report 2 | description: File a bug report 3 | labels: ["bug"] 4 | body: 5 | - type: markdown 6 | attributes: 7 | value: | 8 | **Important:** All bug reports must be reproducible using Claude 3.5 Sonnet. Apex uses complex prompts so less capable models may not work as expected. 9 | - type: textarea 10 | id: what-happened 11 | attributes: 12 | label: What happened? 13 | description: Also tell us, what did you expect to happen? 14 | placeholder: Tell us what you see! 15 | validations: 16 | required: true 17 | - type: textarea 18 | id: steps 19 | attributes: 20 | label: Steps to reproduce 21 | description: How do you trigger this bug? Please walk us through it step by step. 22 | value: | 23 | 1. 24 | 2. 25 | 3. 26 | validations: 27 | required: true 28 | - type: textarea 29 | id: logs 30 | attributes: 31 | label: Relevant API REQUEST output 32 | description: Please copy and paste any relevant output. This will be automatically formatted into code, so no need for backticks. 33 | render: shell 34 | - type: input 35 | id: provider-model 36 | attributes: 37 | label: Provider/Model 38 | description: What provider and model were you using when the issue occurred? 39 | placeholder: "e.g., apex:anthropic/claude-3.7-sonnet, gemini:gemini-2.5-pro-exp-03-25" 40 | validations: 41 | required: true 42 | - type: input 43 | id: operating-system 44 | attributes: 45 | label: Operating System 46 | description: What operating system are you using? 47 | placeholder: "e.g., Windows 11, macOS Sonoma, Ubuntu 22.04" 48 | validations: 49 | required: true 50 | - type: input 51 | id: apex-version 52 | attributes: 53 | label: Apex Version 54 | description: What version of Apex are you using? (You can find this at the bottom of the Settings view) 55 | placeholder: "e.g., 1.2.3" 56 | validations: 57 | required: true 58 | - type: textarea 59 | id: additional-context 60 | attributes: 61 | label: Additional context 62 | description: Add any other context about the problem here, such as screenshots or related issues. 63 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: false 2 | contact_links: 3 | - name: ✨ Feature Request 4 | url: https://github.com/apex/apex/discussions/categories/feature-requests?discussions_q=is%3Aopen+category%3A%22Feature+Requests%22+sort%3Atop 5 | about: Share and vote on feature requests for Apex 6 | - name: 👋 Apex Discord 7 | url: https://discord.gg/apex 8 | about: Join our Discord community for discussions and support 9 | - name: ❓ Other Questions? 10 | url: https://x.com/sdrzn 11 | about: Contact the developer on X @sdrzn for other inquiries 12 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | # Main extension dependencies 4 | - package-ecosystem: "npm" 5 | directory: "/" 6 | schedule: 7 | interval: "daily" 8 | # Group all updates into a single PR 9 | groups: 10 | all-dependencies: 11 | patterns: 12 | - "*" 13 | ignore: 14 | # Ignore all non-security updates (security vulnerabilities bypass these ignore rules) 15 | - dependency-name: "*" 16 | update-types: 17 | - "version-update:semver-major" 18 | - "version-update:semver-minor" 19 | - "version-update:semver-patch" 20 | 21 | # Webview UI dependencies 22 | - package-ecosystem: "npm" 23 | directory: "/webview-ui" 24 | schedule: 25 | interval: "daily" 26 | groups: 27 | all-dependencies: 28 | patterns: 29 | - "*" 30 | ignore: 31 | - dependency-name: "@testing-library/*" 32 | - dependency-name: "*" 33 | update-types: 34 | - "version-update:semver-major" 35 | - "version-update:semver-minor" 36 | - "version-update:semver-patch" 37 | 38 | # Python backend dependencies 39 | - package-ecosystem: "pip" 40 | directory: "/python_backend" 41 | schedule: 42 | interval: "daily" 43 | groups: 44 | all-dependencies: 45 | patterns: 46 | - "*" 47 | ignore: 48 | # Ignore all non-security updates (security vulnerabilities bypass these ignore rules) 49 | - dependency-name: "*" 50 | update-types: 51 | - "version-update:semver-major" 52 | - "version-update:semver-minor" 53 | - "version-update:semver-patch" 54 | -------------------------------------------------------------------------------- /.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | ### Description 2 | 3 | 4 | 5 | ### Test Procedure 6 | 7 | 8 | 9 | ### Type of Change 10 | 11 | 12 | 13 | - [ ] 🐛 Bug fix (non-breaking change which fixes an issue) 14 | - [ ] ✨ New feature (non-breaking change which adds functionality) 15 | - [ ] 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected) 16 | - [ ] 📚 Documentation update 17 | 18 | ### Pre-flight Checklist 19 | 20 | 21 | 22 | - [ ] Changes are limited to a single feature, bugfix or chore (split larger changes into separate PRs) 23 | - [ ] Tests are passing (`npm test`) and code is formatted and linted (`npm run format && npm run lint`) 24 | - [ ] I have created a changeset using `npm run changeset` (required for user-facing changes) 25 | - [ ] I have reviewed [contributor guidelines](https://github.com/apex/apex/blob/main/CONTRIBUTING.md) 26 | 27 | ### Screenshots 28 | 29 | 30 | 31 | ### Additional Notes 32 | 33 | 34 | -------------------------------------------------------------------------------- /.github/scripts/coverage_check/__init__.py: -------------------------------------------------------------------------------- 1 | """ 2 | Coverage utility package for GitHub Actions workflows. 3 | This package handles extracting coverage percentages, comparing them, and generating PR comments. 4 | """ 5 | 6 | # Import external dependencies 7 | import requests 8 | 9 | # Import main function for CLI usage 10 | from .__main__ import main 11 | 12 | # Import functions from extraction module 13 | from .extraction import extract_coverage, compare_coverage, run_coverage, set_verbose 14 | 15 | # Import functions from github_api module 16 | from .github_api import generate_comment, post_comment, set_github_output 17 | 18 | # Import functions from workflow module 19 | from .workflow import process_coverage_workflow 20 | -------------------------------------------------------------------------------- /.github/workflows/SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security Policy 2 | 3 | ## Supported Versions 4 | 5 | The following versions of Apex-CodeGenesis-VSCode are currently being supported with security updates: 6 | 7 | | Version | Supported | 8 | | ------- | ------------------ | 9 | | 1.0.x | :white_check_mark: | 10 | | < 1.0 | :x: | 11 | 12 | ## Reporting a Vulnerability 13 | 14 | We take the security of Apex-CodeGenesis-VSCode seriously. If you believe you've found a security vulnerability, please follow these steps: 15 | 16 | 1. **Do not disclose the vulnerability publicly** 17 | 2. **Email us** at [INSERT EMAIL ADDRESS] with details about the vulnerability 18 | 3. **Include the following information**: 19 | - Type of vulnerability 20 | - Full paths of source files related to the vulnerability 21 | - Location of the affected source code (tag/branch/commit or direct URL) 22 | - Any special configuration required to reproduce the issue 23 | - Step-by-step instructions to reproduce the issue 24 | - Proof-of-concept or exploit code (if possible) 25 | - Impact of the vulnerability, including how an attacker might exploit it 26 | 27 | ### What to expect 28 | - We aim to acknowledge receipt of legitimate vulnerability reports within a reasonable timeframe 29 | - We will evaluate reports based on severity, credibility, and impact to the project 30 | - Reports that appear to be spam, automated, or lack sufficient detail may not receive a response 31 | - For valid reports, we will provide updates on our investigation as appropriate 32 | - We maintain discretion in determining which reports will be acknowledged publicly 33 | 34 | ## Automatic Security Scanning 35 | 36 | This repository uses the following automated security tools: 37 | 38 | 1. **Dependabot** - Scans dependencies for known vulnerabilities daily and creates PRs for security updates. 39 | 2. **CodeQL Analysis** - Performs code scanning on push, pull request to main branch, and weekly scheduled scans. 40 | 41 | These tools help us identify and remediate security issues in the codebase and dependencies automatically. 42 | 43 | ## Security Best Practices 44 | 45 | Contributors to this project are encouraged to: 46 | 47 | - Follow secure coding practices 48 | - Keep dependencies up-to-date 49 | - Review Dependabot and CodeQL alerts promptly 50 | - Add tests for security fixes 51 | - Document security considerations in code comments -------------------------------------------------------------------------------- /.github/workflows/codeql-analysis.yml: -------------------------------------------------------------------------------- 1 | name: "CodeQL" 2 | 3 | on: 4 | push: 5 | branches: [main] 6 | pull_request: 7 | branches: [main] 8 | schedule: 9 | - cron: "0 0 * * 0" # Run once a week at midnight on Sunday 10 | 11 | jobs: 12 | analyze: 13 | name: Analyze 14 | runs-on: ubuntu-latest 15 | permissions: 16 | actions: read 17 | contents: read 18 | security-events: write 19 | 20 | strategy: 21 | fail-fast: false 22 | matrix: 23 | language: ["javascript", "typescript", "python"] 24 | 25 | steps: 26 | - name: Checkout repository 27 | uses: actions/checkout@v3 28 | 29 | - name: Initialize CodeQL 30 | uses: github/codeql-action/init@v2 31 | with: 32 | languages: ${{ matrix.language }} 33 | 34 | # Autobuild attempts to build any compiled languages 35 | - name: Autobuild 36 | uses: github/codeql-action/autobuild@v2 37 | 38 | - name: Perform CodeQL Analysis 39 | uses: github/codeql-action/analyze@v2 40 | with: 41 | category: "/language:${{matrix.language}}" 42 | -------------------------------------------------------------------------------- /.github/workflows/codeql.yml: -------------------------------------------------------------------------------- 1 | name: "CodeQL Daily" 2 | 3 | on: 4 | push: 5 | branches: ["main"] 6 | pull_request: 7 | branches: ["main"] 8 | schedule: 9 | - cron: "0 0 * * *" # Daily scan at 00:00 UTC 10 | 11 | jobs: 12 | analyze: 13 | name: Analyze (${{ matrix.language }}) 14 | runs-on: ${{ matrix.language == 'swift' && 'macos-latest' || 'ubuntu-latest' }} 15 | permissions: 16 | security-events: write 17 | packages: read 18 | actions: read 19 | contents: read 20 | 21 | strategy: 22 | fail-fast: false 23 | matrix: 24 | include: 25 | - language: actions 26 | build-mode: none 27 | - language: javascript-typescript 28 | build-mode: none 29 | - language: python 30 | build-mode: none 31 | # Other supported languages: c-cpp, csharp, go, java-kotlin, ruby, swift 32 | 33 | steps: 34 | - name: Checkout repository 35 | uses: actions/checkout@v4 36 | 37 | # ───── Optional: install runtimes or compilers ────────────────────────────── 38 | # - name: Setup Node.js 39 | # uses: actions/setup-node@v3 40 | # with: node-version: '18' 41 | # - name: npm ci & build 42 | # run: | 43 | # npm ci 44 | # npm run build 45 | 46 | - name: Initialize CodeQL 47 | uses: github/codeql-action/init@v3 48 | with: 49 | languages: ${{ matrix.language }} 50 | build-mode: ${{ matrix.build-mode }} 51 | # To add extra query packs: 52 | # queries: "+security-extended,security-and-quality" 53 | 54 | - name: Manual build (if needed) 55 | if: ${{ matrix.build-mode == 'manual' }} 56 | shell: bash 57 | run: | 58 | echo "Manual build mode – replace this with your actual build commands" 59 | exit 1 60 | 61 | - name: Perform CodeQL analysis 62 | uses: github/codeql-action/analyze@v3 63 | with: 64 | category: "/language:${{ matrix.language }}" 65 | -------------------------------------------------------------------------------- /.github/workflows/lint-format.yml: -------------------------------------------------------------------------------- 1 | permissions: 2 | contents: read 3 | 4 | name: Lint and Format Check 5 | 6 | on: 7 | push: 8 | branches: [main] 9 | pull_request: 10 | branches: [main] 11 | 12 | jobs: 13 | lint-format: 14 | name: Run Linters and Formatters 15 | runs-on: ubuntu-latest 16 | 17 | steps: 18 | - name: Check out code 19 | uses: actions/checkout@v4 20 | 21 | - name: Set up Python 22 | uses: actions/setup-python@v5 23 | with: 24 | python-version: "3.x" 25 | 26 | - name: Install Ruff 27 | run: pip install ruff 28 | 29 | - name: Run Ruff Linter 30 | run: ruff check . 31 | 32 | - name: Run Ruff Formatter Check 33 | run: ruff format --check . 34 | 35 | - name: Set up Node.js 36 | uses: actions/setup-node@v4 37 | with: 38 | node-version: "20" 39 | 40 | - name: Install Node dependencies 41 | run: npm ci 42 | 43 | - name: Run ESLint 44 | run: npm run lint 45 | 46 | - name: Run Prettier Check 47 | run: npm run format:check 48 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | out 2 | dist 3 | node_modules 4 | tmp 5 | .vscode-test/ 6 | *.vsix 7 | 8 | .DS_Store 9 | 10 | pnpm-lock.yaml 11 | 12 | .apexignore 13 | .venv 14 | .actrc 15 | venv 16 | 17 | # Ignore coverage directories and files 18 | coverage 19 | # Don't ignore the coverage scripts in .github/scripts/ 20 | !.github/scripts/coverage/ 21 | dev/* 22 | logs/* 23 | 24 | # Reports 25 | reports/dependency-report.html 26 | 27 | workbench/* 28 | .dev/ 29 | scripts -------------------------------------------------------------------------------- /.husky/pre-commit: -------------------------------------------------------------------------------- 1 | echo "Running pre-commit checks..." 2 | 3 | # Run ESLint 4 | echo "Running ESLint..." 5 | npm run lint || { 6 | echo "❌ ESLint check failed. Please fix the errors and try committing again." 7 | exit 1 8 | } 9 | 10 | # Run Prettier 11 | echo "Running Prettier..." 12 | npm run format || { 13 | echo "❌ Prettier check failed. Run 'npm run format:fix' to automatically fix formatting issues." 14 | exit 1 15 | } 16 | 17 | echo "✅ All checks passed!" 18 | -------------------------------------------------------------------------------- /.husky/pre-push: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | . "$(dirname -- "$0")/_/husky.sh" 3 | 4 | echo "🔍 Running pre-push verification checks..." 5 | node scripts/pre-push-check.js -------------------------------------------------------------------------------- /.nvmrc: -------------------------------------------------------------------------------- 1 | 18.17.1 2 | -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | dist/ 2 | node_modules 3 | webview-ui/build/ 4 | *.md 5 | package-lock.json 6 | workbench/personas/ 7 | workbench/prompts/ 8 | python_backend/personas/ 9 | python_backend/prompts/ 10 | *_persona.json 11 | *_persona.yaml 12 | reports/dependency-report.html 13 | -------------------------------------------------------------------------------- /.prettierrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "tabWidth": 4, 3 | "useTabs": true, 4 | "printWidth": 130, 5 | "semi": false, 6 | "bracketSameLine": true 7 | } 8 | -------------------------------------------------------------------------------- /.python-version: -------------------------------------------------------------------------------- 1 | 3.12.8 2 | -------------------------------------------------------------------------------- /.vscode-test.mjs: -------------------------------------------------------------------------------- 1 | import { defineConfig } from "@vscode/test-cli" 2 | import path from "path" 3 | 4 | export default defineConfig({ 5 | files: "{out/**/*.test.js,src/**/*.test.js}", 6 | mocha: { 7 | ui: "bdd", 8 | timeout: 20000, // Maximum time (in ms) that a test can run before failing 9 | }, 10 | workspaceFolder: "test-workspace", 11 | version: "stable", 12 | extensionDevelopmentPath: path.resolve("./"), 13 | launchArgs: ["--disable-extensions"], 14 | }) 15 | -------------------------------------------------------------------------------- /.vscode/codegenesis.code-workspace: -------------------------------------------------------------------------------- 1 | { 2 | "folders": [ 3 | { 4 | "path": ".", 5 | }, 6 | ], 7 | "settings": {}, 8 | } 9 | -------------------------------------------------------------------------------- /.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | // See http://go.microsoft.com/fwlink/?LinkId=827846 3 | // for the documentation about the extensions.json format 4 | "recommendations": [ 5 | // Essential extension development 6 | "dbaeumer.vscode-eslint", 7 | "esbenp.prettier-vscode", 8 | "connor4312.esbuild-problem-matchers", 9 | "ms-vscode.extension-test-runner", 10 | 11 | // TypeScript/JavaScript 12 | "ms-vscode.vscode-typescript-next", 13 | "orta.vscode-jest", 14 | 15 | // Python backend 16 | "ms-python.python", 17 | 18 | // Documentation 19 | "bierner.markdown-mermaid" 20 | ] 21 | } 22 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | "name": "Run Extension", 6 | "type": "extensionHost", 7 | "request": "launch", 8 | "args": [ 9 | "--extensionDevelopmentPath=${workspaceFolder}", 10 | "--enable-proposed-api", 11 | "justinlietz93.apex-ide-codegenesis" 12 | ], 13 | "outFiles": ["${workspaceFolder}/dist/**/*.js"], 14 | "preLaunchTask": "npm: compile - extension" 15 | }, 16 | { 17 | "name": "Build & Run Extension", 18 | "type": "extensionHost", 19 | "request": "launch", 20 | "args": [ 21 | "--extensionDevelopmentPath=${workspaceFolder}", 22 | "--enable-proposed-api", 23 | "justinlietz93.apex-ide-codegenesis" 24 | ], 25 | "outFiles": ["${workspaceFolder}/dist/**/*.js"], 26 | "preLaunchTask": "Build All" 27 | } 28 | ] 29 | } 30 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "chat.agent.enabled": true, 3 | "files.exclude": { 4 | "out": false, // set this to true to hide the "out" folder with the compiled JS files 5 | "dist": false // set this to true to hide the "dist" folder with the compiled JS files 6 | }, 7 | "search.exclude": { 8 | "out": true, // set this to false to include "out" folder in search results 9 | "dist": true // set this to false to include "dist" folder in search results 10 | }, 11 | // Turn off tsc task auto detection since we have the necessary tasks as npm scripts 12 | "typescript.tsc.autoDetect": "off", 13 | "python.analysis.diagnosticSeverityOverrides": { 14 | "reportMissingImports": "none" 15 | }, 16 | "apex.backend.pythonPath": "C:/git/CodeGen_IDE/codegenesis/python_backend/.venv/Scripts/python.exe" 17 | } 18 | -------------------------------------------------------------------------------- /.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0.0", 3 | "tasks": [ 4 | { 5 | "label": "npm: compile - extension", 6 | "type": "npm", 7 | "script": "compile", 8 | "path": ".", 9 | "problemMatcher": "$tsc", 10 | "group": { 11 | "kind": "build", 12 | "isDefault": true 13 | } 14 | }, 15 | { 16 | "label": "npm: build - webview-ui", 17 | "type": "npm", 18 | "script": "build", 19 | "path": "webview-ui", 20 | "problemMatcher": [], 21 | "group": "build" 22 | }, 23 | { 24 | "label": "Build All", 25 | "dependsOn": ["npm: build - webview-ui", "npm: compile - extension"], 26 | "problemMatcher": [] 27 | } 28 | ] 29 | } 30 | -------------------------------------------------------------------------------- /.vscodeignore: -------------------------------------------------------------------------------- 1 | # Default 2 | .vscode/** 3 | .vscode-test/** 4 | out/** 5 | node_modules/** 6 | src/** 7 | .gitignore 8 | .yarnrc 9 | esbuild.js 10 | vsc-extension-quickstart.md 11 | **/tsconfig.json 12 | **/.eslintrc.json 13 | **/*.map 14 | **/*.ts 15 | **/.vscode-test.* 16 | 17 | # Custom 18 | demo.gif 19 | .nvmrc 20 | .gitattributes 21 | .prettierignore 22 | python_backend/** 23 | 24 | # Ignore all webview-ui files except the build directory (https://github.com/microsoft/vscode-webview-ui-toolkit-samples/blob/main/frameworks/hello-world-react-cra/.vscodeignore) 25 | webview-ui/src/** 26 | webview-ui/public/** 27 | webview-ui/index.html 28 | webview-ui/README.md 29 | webview-ui/package.json 30 | webview-ui/package-lock.json 31 | webview-ui/node_modules/** 32 | **/.gitignore 33 | 34 | # Ignore docs 35 | docs/** 36 | 37 | # Fix issue where codicons don't get packaged (https://github.com/microsoft/vscode-extension-samples/issues/692) 38 | !node_modules/@vscode/codicons/dist/codicon.css 39 | !node_modules/@vscode/codicons/dist/codicon.ttf 40 | 41 | # Include default themes JSON files used in getTheme 42 | !src/integrations/theme/default-themes/** 43 | 44 | # Include icons 45 | !assets/icons/** 46 | 47 | !dist/** 48 | !assets/** 49 | -------------------------------------------------------------------------------- /assets/.archive/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justinlietz93/Apex-CodeGenesis/e7d85f12e85b200d88282b7b336c70988032df17/assets/.archive/icon.png -------------------------------------------------------------------------------- /assets/.archive/icon2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justinlietz93/Apex-CodeGenesis/e7d85f12e85b200d88282b7b336c70988032df17/assets/.archive/icon2.png -------------------------------------------------------------------------------- /assets/.archive/robot_panel_dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justinlietz93/Apex-CodeGenesis/e7d85f12e85b200d88282b7b336c70988032df17/assets/.archive/robot_panel_dark.png -------------------------------------------------------------------------------- /assets/.archive/robot_panel_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justinlietz93/Apex-CodeGenesis/e7d85f12e85b200d88282b7b336c70988032df17/assets/.archive/robot_panel_light.png -------------------------------------------------------------------------------- /assets/icons/icon - Copy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justinlietz93/Apex-CodeGenesis/e7d85f12e85b200d88282b7b336c70988032df17/assets/icons/icon - Copy.png -------------------------------------------------------------------------------- /assets/icons/icon-black - Copy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justinlietz93/Apex-CodeGenesis/e7d85f12e85b200d88282b7b336c70988032df17/assets/icons/icon-black - Copy.png -------------------------------------------------------------------------------- /assets/icons/icon-black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justinlietz93/Apex-CodeGenesis/e7d85f12e85b200d88282b7b336c70988032df17/assets/icons/icon-black.png -------------------------------------------------------------------------------- /assets/icons/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justinlietz93/Apex-CodeGenesis/e7d85f12e85b200d88282b7b336c70988032df17/assets/icons/icon.png -------------------------------------------------------------------------------- /assets/icons/icon.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 7 | 8 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /assets/icons/robot_panel_dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justinlietz93/Apex-CodeGenesis/e7d85f12e85b200d88282b7b336c70988032df17/assets/icons/robot_panel_dark.png -------------------------------------------------------------------------------- /assets/icons/robot_panel_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justinlietz93/Apex-CodeGenesis/e7d85f12e85b200d88282b7b336c70988032df17/assets/icons/robot_panel_light.png -------------------------------------------------------------------------------- /dockerfile: -------------------------------------------------------------------------------- 1 | # For clacky.ai 2 | FROM ubuntu:22.04 3 | 4 | # Base tools 5 | RUN apt-get update && \ 6 | apt-get install -y curl build-essential git \ 7 | mysql-client postgresql-client redis-tools mongodb-clients 8 | 9 | # Install nvm & Node 20.1.0 10 | RUN curl -fsSL https://raw.githubusercontent.com/nvm-sh/nvm/v0.41.1/install.sh | bash && \ 11 | /bin/bash -lc "nvm install 20.1.0 && nvm alias default 20.1.0" 12 | 13 | # Install Python 3.12 14 | RUN apt-get update && \ 15 | apt-get install -y python3.12 python3.12-venv python3.12-dev 16 | 17 | # Set the workspace 18 | WORKDIR /workspace 19 | -------------------------------------------------------------------------------- /docs/PRIVACY.md: -------------------------------------------------------------------------------- 1 | See [https://apex.bot/privacy](https://apex.bot/privacy) for our privacy policy. -------------------------------------------------------------------------------- /docs/README.md: -------------------------------------------------------------------------------- 1 | # Apex Documentation 2 | 3 | Welcome to the Apex documentation - your comprehensive guide to using and extending Apex's capabilities. Here you'll find resources to help you get started, improve your skills, and contribute to the project. 4 | 5 | ## Getting Started 6 | 7 | - **New to coding?** We've prepared a gentle introduction: 8 | - [Getting Started for New Coders](getting-started-new-coders/README.md) 9 | 10 | ## Improving Your Prompting Skills 11 | 12 | - **Want to communicate more effectively with Apex?** Explore: 13 | - [Prompt Engineering Guide](prompting/README.md) 14 | - [Apex Memory Bank](prompting/custom%20instructions%20library/apex-memory-bank.md) 15 | 16 | ## Exploring Apex's Tools 17 | 18 | - **Understand Apex's capabilities:** 19 | 20 | - [Apex Tools Guide](tools/apex-tools-guide.md) 21 | - [Mentions Feature Guide](tools/mentions-guide.md) 22 | 23 | - **Extend Apex with MCP Servers:** 24 | - [MCP Overview](mcp/README.md) 25 | - [Building MCP Servers from GitHub](mcp/mcp-server-from-github.md) 26 | - [Building Custom MCP Servers](mcp/mcp-server-from-scratch.md) 27 | 28 | ## Contributing to Apex 29 | 30 | - **Interested in contributing?** We welcome your input: 31 | - [Developer Workflow Guide](contributing/developer-workflow.md) 32 | - [Contribution Guidelines](../CONTRIBUTING.md) 33 | - [Project Architecture](architecture/README.md) 34 | 35 | ## Additional Resources 36 | 37 | - **Apex GitHub Repository:** [https://github.com/justinlietz93/Apex-CodeGenesis-VSCode](https://github.com/justinlietz93/Apex-CodeGenesis-VSCode) 38 | - **MCP Documentation:** [https://modelcontextprotocol.org/docs](https://modelcontextprotocol.org/docs) 39 | 40 | We're always looking to improve this documentation. If you have suggestions or find areas that could be enhanced, please let us know. Your feedback helps make Apex better for everyone. 41 | -------------------------------------------------------------------------------- /esbuild.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | const { createRequire } = require("module") 3 | const requireEsm = createRequire(__filename) 4 | requireEsm("./esbuild.cjs") 5 | -------------------------------------------------------------------------------- /eslint.config.js: -------------------------------------------------------------------------------- 1 | const js = require("@eslint/js") 2 | const tseslint = require("typescript-eslint") 3 | const globals = require("globals") 4 | 5 | module.exports = tseslint.config( 6 | { ignores: ["out", "dist", "**/*.d.ts"] }, 7 | { 8 | files: ["**/*.{ts,tsx}"], 9 | extends: [js.configs.recommended, ...tseslint.configs.recommended], 10 | languageOptions: { 11 | ecmaVersion: 6, 12 | sourceType: "module", 13 | globals: globals.node, 14 | parser: tseslint.parser, 15 | parserOptions: { 16 | project: "./tsconfig.json", 17 | }, 18 | }, 19 | plugins: { 20 | "@typescript-eslint": tseslint.plugin, 21 | }, 22 | rules: { 23 | "@typescript-eslint/naming-convention": [ 24 | "warn", 25 | { 26 | selector: "import", 27 | format: ["camelCase", "PascalCase"], 28 | }, 29 | ], 30 | "@typescript-eslint/semi": "off", 31 | curly: "warn", 32 | eqeqeq: "warn", 33 | "no-throw-literal": "warn", 34 | semi: "off", 35 | "@typescript-eslint/no-explicit-any": "off", 36 | "@typescript-eslint/no-unused-vars": "off", 37 | "@typescript-eslint/no-namespace": "off", 38 | "@typescript-eslint/ban-ts-comment": "off", 39 | "@typescript-eslint/no-non-null-asserted-optional-chain": "off", 40 | "@typescript-eslint/no-empty-object-type": "off", 41 | "prefer-const": "off", 42 | }, 43 | }, 44 | ) 45 | -------------------------------------------------------------------------------- /locales/de/CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Verhaltenskodex für Mitwirkende 2 | 3 | ## Unser Versprechen 4 | 5 | Im Interesse der Förderung einer offenen und einladenden Umgebung verpflichten wir uns als 6 | Mitwirkende und Betreuer, die Teilnahme an unserem Projekt und unserer 7 | Gemeinschaft zu einer belästigungsfreien Erfahrung für alle zu machen, unabhängig von Alter, Körpergröße, 8 | Behinderung, ethnischer Zugehörigkeit, sexuellen Merkmalen, Geschlechtsidentität und -ausdruck, 9 | Erfahrungsniveau, Bildung, sozioökonomischem Status, Nationalität, persönlichem Erscheinungsbild, 10 | Rasse, Religion oder sexueller Identität und Orientierung. 11 | 12 | ## Unsere Standards 13 | 14 | Beispiele für Verhaltensweisen, die dazu beitragen, eine positive Umgebung zu schaffen, sind: 15 | 16 | - Verwendung einer einladenden und inklusiven Sprache 17 | - Respekt gegenüber unterschiedlichen Standpunkten und Erfahrungen 18 | - Konstruktive Annahme von Kritik 19 | - Fokussierung auf das, was das Beste für die Gemeinschaft ist 20 | - Empathie gegenüber anderen Mitgliedern der Gemeinschaft zeigen 21 | 22 | Beispiele für inakzeptables Verhalten von Teilnehmern sind: 23 | 24 | - Die Verwendung von sexualisierter Sprache oder Bildern und unerwünschte sexuelle Aufmerksamkeit oder Annäherungen 25 | - Trollen, beleidigende/abwertende Kommentare und persönliche oder politische Angriffe 26 | - Öffentliche oder private Belästigung 27 | - Veröffentlichen von privaten Informationen anderer, wie eine physische oder elektronische Adresse, 28 | ohne ausdrückliche Erlaubnis 29 | - Andere Verhaltensweisen, die in einem professionellen Umfeld als unangemessen angesehen werden könnten 30 | 31 | ## Unsere Verantwortlichkeiten 32 | 33 | Die Projektbetreuer sind dafür verantwortlich, die Standards für akzeptables Verhalten zu klären 34 | und es wird erwartet, dass sie angemessene und faire Korrekturmaßnahmen als Reaktion auf 35 | jedes Beispiel für inakzeptables Verhalten ergreifen. 36 | 37 | Die Projektbetreuer haben das Recht und die Verantwortung, Kommentare, Commits, Code, Wiki-Änderungen, Issues und andere Beiträge zu entfernen, zu bearbeiten oder abzulehnen, die nicht mit diesem Verhaltenskodex übereinstimmen, oder jeden Mitwirkenden vorübergehend oder dauerhaft zu 38 | -------------------------------------------------------------------------------- /locales/ja/CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # コントリビューター規約行動規範 2 | 3 | ## 我々の誓い 4 | 5 | オープンで歓迎される環境を育むために、我々はコントリビューターおよびメンテナーとして、年齢、体型、障害、民族、性の特徴、性別のアイデンティティおよび表現、経験のレベル、教育、社会経済的地位、国籍、個人の外見、人種、宗教、または性的アイデンティティおよび指向に関係なく、プロジェクトおよびコミュニティへの参加がハラスメントのない体験となるよう誓います。 6 | 7 | ## 我々の基準 8 | 9 | ポジティブな環境を作り出す行動の例としては、以下のものがあります: 10 | 11 | - 歓迎的で包括的な言葉を使うこと 12 | - 異なる視点や経験を尊重すること 13 | - 建設的な批判を優雅に受け入れること 14 | - コミュニティのために最善を尽くすことに集中すること 15 | - 他のコミュニティメンバーに対して共感を示すこと 16 | 17 | 参加者による許容できない行動の例としては、以下のものがあります: 18 | 19 | - 性的な言葉や画像の使用、望まれない性的関心やアプローチ 20 | - 荒らし、侮辱的/軽蔑的なコメント、個人的または政治的な攻撃 21 | - 公的または私的なハラスメント 22 | - 明示的な許可なしに他人の個人情報(物理的または電子的な住所など)を公開すること 23 | - プロフェッショナルな環境で不適切と合理的に見なされるその他の行動 24 | 25 | ## 我々の責任 26 | 27 | プロジェクトのメンテナーは、許容される行動の基準を明確にする責任があり、不適切な行動の事例に対して適切かつ公平な是正措置を講じることが期待されています。 28 | 29 | プロジェクトのメンテナーは、この行動規範に沿わないコメント、コミット、コード、ウィキの編集、問題、およびその他の貢献を削除、編集、または拒否する権利と責任を持ち、また、不適切、脅迫的、攻撃的、または有害と見なされるその他の行動を行ったコントリビューターを一時的または永久に禁止する権利と責任を持ちます。 30 | 31 | ## 範囲 32 | 33 | この行動規範は、プロジェクトスペース内およびプロジェクトやコミュニティを代表する個人が公の場で行動する場合に適用されます。プロジェクトやコミュニティを代表する例としては、公式のプロジェクトメールアドレスを使用すること、公式のソーシャルメディアアカウントを通じて投稿すること、またはオンラインまたはオフラインのイベントで任命された代表として行動することが含まれます。プロジェクトの代表としての行動は、プロジェクトのメンテナーによってさらに定義および明確化される場合があります。 34 | 35 | ## 執行 36 | 37 | 虐待的、嫌がらせ、またはその他の許容できない行動の事例は、プロジェクトチームに hi@apex.bot まで報告することができます。すべての苦情はレビューおよび調査され、状況に応じて必要かつ適切な対応が行われます。プロジェクトチームは、事件の報告者に関する機密性を保持する義務があります。具体的な執行ポリシーの詳細は別途掲載される場合があります。 38 | 39 | 行動規範を誠実に遵守または執行しないプロジェクトのメンテナーは、プロジェクトのリーダーシップの他のメンバーによって一時的または永久的な影響を受ける可能性があります。 40 | 41 | ## 帰属 42 | 43 | この行動規範は、[Contributor Covenant][homepage] バージョン 1.4 から適応されており、https://www.contributor-covenant.org/version/1/4/code-of-conduct.html で入手できます。 44 | 45 | [homepage]: https://www.contributor-covenant.org 46 | 47 | この行動規範に関する一般的な質問への回答については、https://www.contributor-covenant.org/faq を参照してください。 48 | -------------------------------------------------------------------------------- /locales/ko/CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # 기여자 행동 강령 2 | 3 | ## 서약 4 | 5 | 우리는 개방적이고 환영하는 환경을 조성하기 위해 노력하며, 기여자 및 유지 관리자로서 모든 사람이 차별과 괴롭힘 없이 프로젝트와 커뮤니티에 참여할 수 있도록 최선을 다할 것을 서약합니다. 이는 연령, 체형, 장애, 민족성, 성적 특성, 성 정체성 및 표현, 경험 수준, 교육 수준, 사회·경제적 지위, 국적, 외모, 인종, 종교, 성 정체성과 성적 지향에 관계없이 모든 사람에게 적용됩니다. 6 | 7 | ## 행동 기준 8 | 9 | 긍정적인 환경을 조성하기 위한 바람직한 행동의 예시: 10 | 11 | - 환영하고 포용적인 언어 사용하기 12 | - 서로 다른 관점과 경험을 존중하기 13 | - 건설적인 비판을 우아하게 수용하기 14 | - 커뮤니티에 최선이 되는 것에 집중하기 15 | - 다른 커뮤니티 구성원들에 대한 공감 보여주기 16 | 17 | 참여자가 해서는 안 되는 행동의 예시: 18 | 19 | - 성적인 언어와 이미지 사용, 원치 않는 성적 관심이나 접근 20 | - 트롤링, 모욕적/경멸적인 댓글, 개인적 또는 정치적 공격 21 | - 공개적 또는 사적인 괴롭힘 22 | - 상대방의 동의 없이 개인정보(실제 주소나 전자 주소 등) 공개하기 23 | - 전문적 환경에서 부적절하다고 여겨질 수 있는 기타 행위 24 | 25 | ## 책임 26 | 27 | 프로젝트 유지 관리자는 허용 가능한 행동 기준을 명확히 설명할 책임이 있으며, 부적절한 행동이 발생할 경우 적절하고 공정한 시정 조치를 취해야 합니다. 28 | 29 | 프로젝트 유지 관리자는 본 행동 강령에 부합하지 않는 댓글, 커밋, 코드, 위키 수정, 이슈 및 기타 기여를 삭제, 수정 또는 거부할 권리와 책임이 있으며, 부적절하다고 판단되는 행동(위협적이거나, 공격적이거나, 해로운 행위 등)을 한 기여자를 일시적 또는 영구적으로 차단할 권리를 가집니다. 30 | 31 | ## 범위 32 | 33 | 이 행동 강령은 프로젝트 공간과 개인이 프로젝트나 커뮤니티를 대표하는 공개 공간에서 모두 적용됩니다. 프로젝트 또는 커뮤니티를 대표하는 예로는 공식 프로젝트 이메일 주소 사용, 공식 소셜 미디어 계정을 통한 게시, 온라인 또는 오프라인 행사에서 지정된 대표자로 활동하는 경우 등이 포함됩니다. 프로젝트의 대표성은 프로젝트 유지 관리자가 추가로 정의하고 명확히 할 수 있습니다. 34 | 35 | ## 집행 36 | 37 | 학대, 괴롭힘 또는 기타 용납할 수 없는 행동은 프로젝트 팀에 hi@apex.bot을 통해 신고 할 수 있습니다. 모든 신고는 검토 및 조사되며, 상황에 따라 필요하고 적절한 조치가 취해질 것입니다. 프로젝트 팀은 사건 신고자의 신원을 보호할 의무가 있습니다. 특정 시행 정책에 대한 추가 세부 사항은 별도로 게시될 수 있습니다. 38 | 39 | 행동 강령을 성실히 준수하거나 집행하지 않는 프로젝트 유지관리자는 프로젝트 리더십의 구성원에 의해 일시적 또는 영구적인 제재를 받을 수 있습니다. 40 | 41 | ## 출처 42 | 43 | 이 행동 강령은 [Contributor Covenant][homepage] 버전 1.4에서 수정되었으며, https://www.contributor-covenant.org/version/1/4/code-of-conduct.html 에서 확인할 수 있습니다. 44 | 45 | [homepage]: https://www.contributor-covenant.org 46 | 47 | 이 행동 강령에 대한 일반적인 질문에 대한 답변은 https://www.contributor-covenant.org/faq 를 참조하시기 바랍니다. 48 | -------------------------------------------------------------------------------- /locales/zh-cn/CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # 贡献者公约行为准则 2 | 3 | ## 我们的承诺 4 | 5 | 为了营造一个开放和欢迎的环境,我们作为贡献者和维护者承诺让我们的项目和社区的参与体验对每个人都无骚扰,无论年龄、体型、残疾、种族、性别特征、性别认同和表达、经验水平、教育程度、社会经济地位、国籍、个人外貌、种族、宗教或性取向。 6 | 7 | ## 我们的标准 8 | 9 | 有助于创造积极环境的行为示例包括: 10 | 11 | - 使用欢迎和包容的语言 12 | - 尊重不同的观点和经验 13 | - 优雅地接受建设性的批评 14 | - 专注于对社区最有利的事情 15 | - 对其他社区成员表现出同理心 16 | 17 | 参与者不可接受的行为示例包括: 18 | 19 | - 使用性化语言或图像以及不受欢迎的性关注或挑逗 20 | - 故意挑衅、侮辱/贬低性评论和个人或政治攻击 21 | - 公开或私下骚扰 22 | - 未经明确许可发布他人的私人信息,如物理或电子地址 23 | - 其他在专业环境中合理认为不适当的行为 24 | 25 | ## 我们的责任 26 | 27 | 项目维护者有责任澄清可接受行为的标准,并期望对任何不可接受行为采取适当和公平的纠正措施。 28 | 29 | 项目维护者有权利和责任删除、编辑或拒绝与本行为准则不一致的评论、提交、代码、维基编辑、问题和其他贡献,或暂时或永久禁止任何贡献者进行他们认为不适当、威胁、冒犯或有害的其他行为。 30 | 31 | ## 适用范围 32 | 33 | 本行为准则适用于项目空间内和公共空间中代表项目或其社区的个人。代表项目或社区的示例包括使用官方项目电子邮件地址,通过官方社交媒体账户发布,或在在线或离线活动中作为指定代表。项目的代表性可能由项目维护者进一步定义和澄清。 34 | 35 | ## 执行 36 | 37 | 滥用、骚扰或其他不可接受行为的实例可以通过联系项目团队 hi@apex.bot 报告。所有投诉将被审查和调查,并将导致根据情况认为必要和适当的回应。项目团队有义务对事件报告者保密。具体执行政策的详细信息可能会单独发布。 38 | 39 | 未能善意遵守或执行行为准则的项目维护者可能会面临由项目领导的其他成员决定的临时或永久后果。 40 | 41 | ## 归属 42 | 43 | 本行为准则改编自 [贡献者公约][主页],版本 1.4,可在 https://www.contributor-covenant.org/version/1/4/code-of-conduct.html 获取。 44 | 45 | [主页]: https://www.contributor-covenant.org 46 | 47 | 有关此行为准则的常见问题的答案,请参见 https://www.contributor-covenant.org/faq 48 | -------------------------------------------------------------------------------- /locales/zh-tw/CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # 貢獻者公約行為準則 2 | 3 | ## 我們的承諾 4 | 5 | 為了營造開放且友善的環境,我們身為貢獻者與維護者,承諾讓參與本專案及社群的體驗,對每個人都不帶有騷擾,不論其年齡、體型、身心障礙、族裔、性徵、性別認同與表現、經驗程度、教育程度、社經地位、國籍、個人外表、種族、宗教信仰、或性傾向。 6 | 7 | ## 我們的準則 8 | 9 | 有助於創造正面環境的行為包括: 10 | 11 | - 使用友善和包容的語言 12 | - 尊重不同的觀點與經驗 13 | - 優雅地接受建設性批評 14 | - 著重於對社群最有利的事情 15 | - 對其他社群成員展現同理心 16 | 17 | 參與者不可接受的行為包括: 18 | 19 | - 使用帶有性暗示的言語或影像,以及不受歡迎的性關注或騷擾 20 | - 挑釁、羞辱/貶低他人的評論,以及人身或政治攻擊 21 | - 公開或私下的騷擾行為 22 | - 未經他人明確許可,公開他人的私人資料,如實體或電子郵件地址 23 | - 其他在專業環境中可被合理認定為不恰當的行為 24 | 25 | ## 我們的責任 26 | 27 | 專案維護者有責任釐清可接受行為的標準,並應對任何不可接受的行為採取適當且公平的糾正措施。 28 | 29 | 專案維護者有權利和責任移除、編輯或拒絕不符合本行為準則的評論、提交、程式碼、維基編輯、議題和其他貢獻,或暫時或永久封鎖任何他們認為有不當、威脅、冒犯或有害行為的貢獻者。 30 | 31 | ## 範疇 32 | 33 | 本行為準則適用於專案空間及公開場合,當個人代表本專案或其社群時都必須遵守。代表本專案或社群的情況包括:使用官方專案電子郵件地址、透過官方社群媒體帳號發文,或在線上或實體活動中擔任指定代表。專案維護者可進一步定義並釐清專案代表的其他情況。 34 | 35 | ## 執行 36 | 37 | 如發生辱罵、騷擾或其他不可接受的行為,請透過 hi@apex.bot 聯絡專案團隊回報。所有申訴都將被審查和調查,並做出必要且合適的回應。專案團隊有義務為事件回報者保密。具體執行政策的更多細節可能另行公佈。 38 | 39 | 未遵守或未切實執行本行為準則的專案維護者,可能會面臨由專案領導團隊其他成員所決定的暫時或永久的處置。 40 | 41 | ## 來源說明 42 | 43 | 本行為準則改編自[貢獻者公約][homepage]第 1.4 版,可在此查閱: 44 | https://www.contributor-covenant.org/version/1/4/code-of-conduct.html 45 | 46 | [homepage]: https://www.contributor-covenant.org 47 | 48 | 關於本行為準則的常見問題解答,請參考: 49 | https://www.contributor-covenant.org/faq 50 | -------------------------------------------------------------------------------- /plutonium-config.json: -------------------------------------------------------------------------------- 1 | { 2 | "paths": { 3 | "javascript": { 4 | "main": "package.json", 5 | "webview": "webview-ui/package.json" 6 | }, 7 | "python": { 8 | "requirements": "python_backend/requirements.txt" 9 | } 10 | }, 11 | "crossLanguageMappings": { 12 | "anthropic": { 13 | "jsPackage": "@anthropic-ai/sdk", 14 | "pythonPackage": "anthropic", 15 | "versionMap": { 16 | "0.39.0": "0.39.0" 17 | } 18 | }, 19 | "google-genai": { 20 | "jsPackage": "@google/generative-ai", 21 | "pythonPackage": "google-genai", 22 | "versionMap": { 23 | "0.24.0": "1.11.0" 24 | } 25 | }, 26 | "openai": { 27 | "jsPackage": "openai", 28 | "pythonPackage": "openai", 29 | "versionMap": { 30 | "4.95.0": "1.75.0" 31 | } 32 | }, 33 | "ollama": { 34 | "jsPackage": "ollama", 35 | "pythonPackage": "ollama", 36 | "versionMap": { 37 | "0.5.15": "0.4.8" 38 | } 39 | } 40 | }, 41 | "scriptFixer": { 42 | "maxLineLength": 500, 43 | "autoFix": { 44 | "eslintConfig": true, 45 | "testDirConflicts": true 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /python_backend/.gitignore: -------------------------------------------------------------------------------- 1 | .env 2 | logs/* -------------------------------------------------------------------------------- /python_backend/README.md: -------------------------------------------------------------------------------- 1 | json-rpc docs 2 | https://json-rpc.readthedocs.io/en/latest/quickstart.html -------------------------------------------------------------------------------- /python_backend/prompts/analyze_and_recover.txt: -------------------------------------------------------------------------------- 1 | # Placeholder for Analyze and Recover Prompt 2 | 3 | **Context:** 4 | The agent encountered an error or unexpected situation during autonomous operation. 5 | 6 | **Input:** 7 | - Current Task Goal: {{ task_goal }} 8 | - Agent State (relevant parts): {{ agent_state }} 9 | - Error/Situation Details: {{ error_details }} 10 | - Recent Action History: {{ action_history }} 11 | - Current Plan State (if available): {{ plan_state }} 12 | 13 | **Objective:** 14 | Analyze the situation, identify the root cause, and propose concrete recovery steps or a revised plan to achieve the original task goal. The recovery steps should be actionable by the agent (e.g., retry a tool with different parameters, revise the last instruction, ask the user for clarification if truly stuck). 15 | 16 | **Output Format:** 17 | Provide the analysis and recovery plan in a structured format (e.g., JSON or YAML) that the agent can parse. 18 | 19 | Example Output Structure (JSON): 20 | ```json 21 | { 22 | "analysis": "Brief analysis of the root cause.", 23 | "recovery_strategy": "Description of the overall recovery approach.", 24 | "next_actions": [ 25 | { 26 | "type": "tool_use | instruction | clarification_request", 27 | "details": { 28 | // Specific parameters for the action 29 | } 30 | } 31 | // ... potentially more actions 32 | ], 33 | "confidence_score": 0.8 // Optional: Confidence in the recovery plan 34 | } 35 | ``` 36 | 37 | **Instructions:** 38 | 1. Thoroughly analyze the provided context and error details. 39 | 2. Determine the most likely root cause. 40 | 3. Formulate a recovery plan focused on achieving the `task_goal`. 41 | 4. Prioritize actions that the agent can perform autonomously. 42 | 5. If recovery seems impossible or requires external intervention, suggest requesting user clarification as the next action. 43 | 6. Output the result in the specified structured format. 44 | -------------------------------------------------------------------------------- /python_backend/prompts/critique_Clarity_Reviewer.txt: -------------------------------------------------------------------------------- 1 | You are acting as a Clarity Reviewer. Your task is to review the provided checklist steps for clarity, precision, and actionability. 2 | 3 | **Context:** 4 | {context} 5 | 6 | **Steps to Review:** 7 | ```json 8 | {steps} 9 | ``` 10 | 11 | **Instructions:** 12 | 1. Analyze each step's wording. 13 | 2. Identify any ambiguous language, vague instructions, or steps that are not clearly actionable. 14 | 3. Ensure each step is concise and easy to understand. 15 | 4. Provide concise feedback listing the steps that lack clarity or actionability, briefly explaining why. If all steps are clear, state "Steps are clear and actionable." 16 | 17 | **Critique:** 18 | -------------------------------------------------------------------------------- /python_backend/prompts/critique_Completeness_Checker.txt: -------------------------------------------------------------------------------- 1 | You are acting as a Completeness Checker. Your task is to review the provided checklist steps to ensure they adequately cover the stated task description and context. 2 | 3 | **Context:** 4 | {context} 5 | 6 | **Steps to Review:** 7 | ```json 8 | {steps} 9 | ``` 10 | 11 | **Instructions:** 12 | 1. Analyze the steps in relation to the task description provided in the context. 13 | 2. Identify any significant gaps or missing actions required to reasonably complete the task. 14 | 3. Focus on whether the steps, as a whole, achieve the task's objective. Do not critique minor details unless they represent a major omission. 15 | 4. Provide concise feedback listing the identified completeness issues or missing steps. If the steps appear reasonably complete, state "Steps appear reasonably complete for the task." 16 | 17 | **Critique:** 18 | -------------------------------------------------------------------------------- /python_backend/prompts/critique_Logical_Validator.txt: -------------------------------------------------------------------------------- 1 | You are acting as a Logical Validator. Your task is to review the provided checklist steps for logical consistency, flow, and potential contradictions. 2 | 3 | **Context:** 4 | {context} 5 | 6 | **Steps to Review:** 7 | ```json 8 | {steps} 9 | ``` 10 | 11 | **Instructions:** 12 | 1. Analyze the sequence and content of the steps. 13 | 2. Identify any logical fallacies, inconsistencies between steps, or steps that do not logically follow from previous ones. 14 | 3. Focus solely on the logical structure and coherence. Do not critique feasibility or completeness unless it creates a logical issue. 15 | 4. Provide concise feedback listing the identified logical issues. If no issues are found, state "No logical issues identified." 16 | 17 | **Critique:** 18 | -------------------------------------------------------------------------------- /python_backend/prompts/critique_Risk_Assessor.txt: -------------------------------------------------------------------------------- 1 | You are acting as a Risk Assessor. Your task is to review the provided checklist steps to identify potential risks, edge cases, or failure modes. 2 | 3 | **Context:** 4 | {context} 5 | 6 | **Steps to Review:** 7 | ```json 8 | {steps} 9 | ``` 10 | 11 | **Instructions:** 12 | 1. Analyze each step for potential problems, ambiguities, or dependencies that could lead to errors or unexpected outcomes. 13 | 2. Consider edge cases, invalid inputs, or environmental factors that might affect the step's success. 14 | 3. Focus on identifying potential risks and failure points. Do not suggest solutions unless the risk is critical. 15 | 4. Provide concise feedback listing the identified risks or potential issues. If no significant risks are apparent, state "No major risks identified." 16 | 17 | **Critique:** 18 | -------------------------------------------------------------------------------- /python_backend/prompts/generate_phases.txt: -------------------------------------------------------------------------------- 1 | You are a hierarchical planning assistant. Given a high-level goal and context, decompose the goal into a sequence of logical phases. 2 | 3 | **Goal:** 4 | {goal} 5 | 6 | **Context:** 7 | {context} 8 | 9 | **Instructions:** 10 | 1. Analyze the goal and context. 11 | 2. Define a sequence of {max_phases} or fewer high-level phases required to achieve the goal. 12 | 3. For each phase, provide a concise name and a brief description. 13 | 4. Output the result as a JSON object containing a single key "phases", which is a list of phase objects (e.g., `[{{"name": "Phase 1 Name", "description": "Phase 1 Description"}}, ...]`). 14 | 15 | **Output JSON:** 16 | ```json 17 | {{ 18 | "phases": [ 19 | {{"name": "...", "description": "..."}}, 20 | {{"name": "...", "description": "..."}} 21 | ] 22 | }} 23 | -------------------------------------------------------------------------------- /python_backend/prompts/generate_steps.txt: -------------------------------------------------------------------------------- 1 | You are a hierarchical planning assistant. Given a goal, phase, the current task, and context, decompose the task into a sequence of actionable steps. 2 | 3 | **Goal:** 4 | {goal} 5 | 6 | **Current Phase:** 7 | Name: {phase_name} 8 | 9 | **Current Task:** 10 | Name: {task_name} 11 | Description: {task_description} 12 | 13 | **Context:** 14 | {context} 15 | 16 | **Instructions:** 17 | 1. Analyze the goal, phase, task, and context. 18 | 2. Define a sequence of {max_steps} or fewer concrete, actionable steps required to complete the current task. 19 | 3. Each step should represent a single, clear action or instruction. 20 | 4. Output the result as a JSON object containing a single key "steps", which is a list of step objects. Each step object must have a "prompt" key containing the step instruction as a string, and optionally a "description" key (you can use the same value for both if description isn't distinct). Include a unique "step_id" for each step (e.g., "step_1", "step_2"). 21 | 22 | **Output JSON Example:** 23 | ```json 24 | {{ 25 | "steps": [ 26 | {{"step_id": "step_1", "prompt": "First action to take.", "description": "First action to take."}}, 27 | {{"step_id": "step_2", "prompt": "Second action.", "description": "Second action."}} 28 | ] 29 | }} 30 | ``` 31 | 32 | **Output JSON:** 33 | -------------------------------------------------------------------------------- /python_backend/prompts/generate_tasks.txt: -------------------------------------------------------------------------------- 1 | You are a hierarchical planning assistant. Given a high-level goal, the current phase, and context, decompose the phase into a sequence of logical tasks. 2 | 3 | **Goal:** 4 | {goal} 5 | 6 | **Current Phase:** 7 | Name: {phase_name} 8 | Description: {phase_description} 9 | 10 | **Context:** 11 | {context} 12 | 13 | **Instructions:** 14 | 1. Analyze the goal, current phase, and context. 15 | 2. Define a sequence of {max_tasks} or fewer specific tasks required to complete the current phase. 16 | 3. For each task, provide a concise name and a brief description. 17 | 4. Output the result as a JSON object containing a single key "tasks", which is a list of task objects (e.g., `[{{"name": "Task 1 Name", "description": "Task 1 Description"}}, ...]`). 18 | 19 | **Output JSON:** 20 | ```json 21 | {{ 22 | "tasks": [ 23 | {{"name": "...", "description": "..."}}, 24 | {{"name": "...", "description": "..."}} 25 | ] 26 | }} 27 | -------------------------------------------------------------------------------- /python_backend/prompts/revise_steps.txt: -------------------------------------------------------------------------------- 1 | You are a planning synthesizer. You will receive a list of original steps for a task, along with critiques from multiple perspectives (personas). Your goal is to revise the original steps to address the most critical and relevant critiques, improving clarity, logic, robustness, and actionability. 2 | 3 | **Original Goal:** 4 | {goal} 5 | 6 | **Phase Context:** 7 | {context} 8 | 9 | **Original Steps:** 10 | ```json 11 | {steps} 12 | ``` 13 | 14 | **Critiques:** 15 | ```json 16 | {critiques} 17 | ``` 18 | 19 | **Instructions:** 20 | 1. Carefully review the original steps and all provided critiques. 21 | 2. Synthesize the feedback, identifying the most important areas for improvement within the current task's scope. 22 | 3. Revise the original steps list to address these critical points. Focus on refining existing steps rather than adding or removing many steps. Maintain the overall task goal. 23 | 4. Ensure each revised step is clear, concise, and actionable. 24 | 5. Output the result as a JSON object containing a single key "revised_steps". The value should be a list of step objects, maintaining the same format as the original steps (including "step_id" and "prompt"/"description"). 25 | 26 | **Output JSON Example:** 27 | ```json 28 | {{ 29 | "revised_steps": [ 30 | {{"step_id": "step_1", "prompt": "Revised first action.", "description": "Revised first action."}}, 31 | {{"step_id": "step_2", "prompt": "Revised second action.", "description": "Revised second action."}} 32 | // Potentially slightly reordered or modified steps 33 | ] 34 | }} 35 | ``` 36 | 37 | **Output JSON:** 38 | -------------------------------------------------------------------------------- /python_backend/prompts/select_persona.txt: -------------------------------------------------------------------------------- 1 | You are a persona selection assistant. Your goal is to choose the most appropriate persona for the AI agent to adopt based on the user's task goal. 2 | 3 | **User Task Goal:** 4 | {goal} 5 | 6 | **Available Personas (Names Only):** 7 | {persona_names} 8 | 9 | **Instructions:** 10 | 1. Analyze the user's task goal. 11 | 2. Consider the available persona names and infer their likely specializations (e.g., 'SE-Apex' for software engineering, 'Math-Apex' for math problems). 12 | 3. Select the single best persona name from the available list that aligns with the user's goal. 13 | 4. Output *only* the selected persona name as a plain string. Do not add any explanation or formatting. 14 | 15 | **Selected Persona Name:** 16 | -------------------------------------------------------------------------------- /python_backend/requirements-test.txt: -------------------------------------------------------------------------------- 1 | json-rpc>=1.13.0 2 | google-genai==1.11.0 3 | pyyaml<6.0.0 4 | anthropic==0.49.0 5 | openai==1.75.0 6 | # This is a comment 7 | ollama==0.4.8 # older version 8 | -------------------------------------------------------------------------------- /python_backend/requirements.txt: -------------------------------------------------------------------------------- 1 | json-rpc[tox]==1.15.0 2 | google-genai==1.11.0 3 | pyyaml==6.0.2 4 | agno==1.3.2 # Added for RAG/Knowledge Graph capabilities 5 | lancedb==0.21.2 # Added dependency for agno 6 | numpy==2.2.4 # Added dependency for lancedb 7 | gitignore-parser==0.1.12 # Added for parsing .agentignore files 8 | python-dotenv==1.1.0 # Added for loading .env files (used by config_loader) 9 | # We might need 'werkzeug' if we adapt the example server later, but not for stdio 10 | openai==1.75.0 # Mapped from npm v4.95.0 11 | anthropic==0.49.0 12 | ollama==0.4.8 # Mapped from npm v0.5.15 (latest available Python version) 13 | -------------------------------------------------------------------------------- /python_backend/src/__init__.py: -------------------------------------------------------------------------------- 1 | # This file makes the src directory a Python package. 2 | -------------------------------------------------------------------------------- /python_backend/src/__pycache__/handlers.cpython-312.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justinlietz93/Apex-CodeGenesis/e7d85f12e85b200d88282b7b336c70988032df17/python_backend/src/__pycache__/handlers.cpython-312.pyc -------------------------------------------------------------------------------- /python_backend/src/__pycache__/protocol_types.cpython-312.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justinlietz93/Apex-CodeGenesis/e7d85f12e85b200d88282b7b336c70988032df17/python_backend/src/__pycache__/protocol_types.cpython-312.pyc -------------------------------------------------------------------------------- /python_backend/src/core/__init__.py: -------------------------------------------------------------------------------- 1 | # This file makes the 'core' directory a Python package. 2 | -------------------------------------------------------------------------------- /python_backend/src/council/__init__.py: -------------------------------------------------------------------------------- 1 | # This file makes the 'council' directory a Python package. 2 | -------------------------------------------------------------------------------- /python_backend/src/exceptions.py: -------------------------------------------------------------------------------- 1 | """ 2 | Custom exceptions for the Hierarchical Reasoning Checklist Generator. 3 | """ 4 | 5 | class ChecklistGeneratorError(Exception): 6 | """Base exception for all checklist generator errors.""" 7 | pass 8 | 9 | 10 | class LLMError(ChecklistGeneratorError): 11 | """Exception raised for errors in LLM API calls.""" 12 | pass 13 | 14 | 15 | class PromptError(ChecklistGeneratorError): 16 | """Exception raised for errors in prompt loading or formatting.""" 17 | pass 18 | 19 | 20 | class ConfigError(ChecklistGeneratorError): 21 | """Exception raised for errors in configuration loading or validation.""" 22 | pass 23 | 24 | 25 | class CheckpointError(ChecklistGeneratorError): 26 | """Exception raised for errors in checkpoint operations.""" 27 | pass 28 | 29 | 30 | class ValidationError(ChecklistGeneratorError): 31 | """Exception raised for errors in data validation.""" 32 | pass 33 | 34 | 35 | class ReasoningTreeError(ChecklistGeneratorError): 36 | """Exception raised for errors in reasoning tree operations.""" 37 | pass 38 | 39 | 40 | class CouncilCritiqueError(ChecklistGeneratorError): 41 | """Exception raised for errors in council critique operations.""" 42 | pass 43 | 44 | 45 | class QAValidationError(ChecklistGeneratorError): 46 | """Exception raised for errors in QA validation operations.""" 47 | pass 48 | 49 | class LLMClientError(Exception): 50 | """Base exception for all llm client errors.""" 51 | pass 52 | 53 | -------------------------------------------------------------------------------- /python_backend/src/pyrightconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extraPaths": ["./python_backend/src"], 3 | "reportMissingImports": false 4 | } 5 | -------------------------------------------------------------------------------- /python_backend/src/qa/__init__.py: -------------------------------------------------------------------------------- 1 | # This file makes the 'qa' directory a Python package. 2 | -------------------------------------------------------------------------------- /python_backend/src/utils/__init__.py: -------------------------------------------------------------------------------- 1 | # This file makes the 'utils' directory a Python package. 2 | -------------------------------------------------------------------------------- /python_backend/src/utils/__pycache__/__init__.cpython-312.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justinlietz93/Apex-CodeGenesis/e7d85f12e85b200d88282b7b336c70988032df17/python_backend/src/utils/__pycache__/__init__.cpython-312.pyc -------------------------------------------------------------------------------- /python_backend/src/utils/__pycache__/config_loader.cpython-312.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justinlietz93/Apex-CodeGenesis/e7d85f12e85b200d88282b7b336c70988032df17/python_backend/src/utils/__pycache__/config_loader.cpython-312.pyc -------------------------------------------------------------------------------- /scripts/plutonium/assets/plutonium-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justinlietz93/Apex-CodeGenesis/e7d85f12e85b200d88282b7b336c70988032df17/scripts/plutonium/assets/plutonium-icon.png -------------------------------------------------------------------------------- /scripts/plutonium/utils.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Plutonium Utilities Module 3 | * 4 | * Provides common utility functions used across all Plutonium tools. 5 | */ 6 | 7 | import { execSync } from "child_process" 8 | 9 | // ANSI color codes for terminal output 10 | export const colors = { 11 | reset: "\x1b[0m", 12 | bright: "\x1b[1m", 13 | dim: "\x1b[2m", 14 | underscore: "\x1b[4m", 15 | blink: "\x1b[5m", 16 | reverse: "\x1b[7m", 17 | hidden: "\x1b[8m", 18 | 19 | black: "\x1b[30m", 20 | red: "\x1b[31m", 21 | green: "\x1b[32m", 22 | yellow: "\x1b[33m", 23 | blue: "\x1b[34m", 24 | magenta: "\x1b[35m", 25 | cyan: "\x1b[36m", 26 | white: "\x1b[37m", 27 | 28 | bgBlack: "\x1b[40m", 29 | bgRed: "\x1b[41m", 30 | bgGreen: "\x1b[42m", 31 | bgYellow: "\x1b[43m", 32 | bgBlue: "\x1b[44m", 33 | bgMagenta: "\x1b[45m", 34 | bgCyan: "\x1b[46m", 35 | bgWhite: "\x1b[47m", 36 | } 37 | 38 | /** 39 | * Log formatted message to console 40 | */ 41 | export function log(message, level = "info") { 42 | const prefix = { 43 | info: `${colors.blue}ℹ${colors.reset}`, 44 | success: `${colors.green}✓${colors.reset}`, 45 | warning: `${colors.yellow}⚠️${colors.reset}`, 46 | error: `${colors.red}✖${colors.reset}`, 47 | heading: `${colors.magenta}${colors.bright}▶${colors.reset}`, 48 | } 49 | 50 | console.log(`${prefix[level] || ""} ${message}`) 51 | } 52 | 53 | /** 54 | * Display a heading 55 | */ 56 | export function heading(title) { 57 | log(`\n${colors.bright}${colors.magenta}${title}${colors.reset}`, "heading") 58 | } 59 | 60 | /** 61 | * Run a command and return the output 62 | */ 63 | export function runCommand(command, options = {}) { 64 | const { silent = false } = options 65 | 66 | try { 67 | const output = execSync(command, { 68 | encoding: "utf8", 69 | stdio: silent ? "pipe" : "inherit", 70 | }) 71 | 72 | return { success: true, output } 73 | } catch (error) { 74 | if (silent) { 75 | return { 76 | success: false, 77 | error: error.message, 78 | stdout: error.stdout, 79 | stderr: error.stderr, 80 | } 81 | } else { 82 | console.error(`${colors.red}Command failed: ${command}${colors.reset}`) 83 | console.error(error.message) 84 | return { success: false } 85 | } 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /scripts/pre-push-check.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | require("./pre-push-check.cjs") 3 | -------------------------------------------------------------------------------- /scripts/test-ci.cjs: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | const { execSync } = require("child_process") 3 | const process = require("process") 4 | 5 | try { 6 | if (process.platform === "linux") { 7 | console.log("Detected Linux environment.") 8 | 9 | execSync("which xvfb-run", { stdio: "ignore" }) 10 | 11 | console.log("xvfb-run is installed. Running tests with xvfb-run...") 12 | execSync("xvfb-run -a npm run test", { stdio: "inherit" }) 13 | } else { 14 | console.log("Non-Linux environment detected. Running tests normally.") 15 | execSync("npm run test", { stdio: "inherit" }) 16 | } 17 | } catch (error) { 18 | if (process.platform === "linux") { 19 | console.error( 20 | `Error: xvfb-run is not installed.\n` + 21 | `Please install it using the following command:\n` + 22 | ` Debian/Ubuntu: sudo apt install xvfb\n` + 23 | ` RHEL/CentOS: sudo yum install xvfb\n` + 24 | ` Arch Linux: sudo pacman -S xvfb`, 25 | ) 26 | } else { 27 | console.error("Error running tests:", error.message) 28 | } 29 | process.exit(1) 30 | } 31 | -------------------------------------------------------------------------------- /src/api/providers/lmstudio.ts: -------------------------------------------------------------------------------- 1 | import { Anthropic } from "@anthropic-ai/sdk" 2 | import OpenAI from "openai" 3 | import { ApiHandler } from "../" 4 | import { ApiHandlerOptions, ModelInfo, openAiModelInfoSaneDefaults } from "../../shared/api" 5 | import { convertToOpenAiMessages } from "../transform/openai-format" 6 | import { ApiStream } from "../transform/stream" 7 | 8 | export class LmStudioHandler implements ApiHandler { 9 | private options: ApiHandlerOptions 10 | private client: OpenAI 11 | 12 | constructor(options: ApiHandlerOptions) { 13 | this.options = options 14 | this.client = new OpenAI({ 15 | baseURL: (this.options.lmStudioBaseUrl || "http://localhost:1234") + "/v1", 16 | apiKey: "noop", 17 | }) 18 | } 19 | 20 | // Implement the capability flag 21 | supportsNativeFunctionCalling(): boolean { 22 | return false // LM Studio uses OpenAI format but doesn't guarantee tool support for all loaded models. 23 | } 24 | 25 | async *createMessage(systemPrompt: string, messages: Anthropic.Messages.MessageParam[]): ApiStream { 26 | const openAiMessages: OpenAI.Chat.ChatCompletionMessageParam[] = [ 27 | { role: "system", content: systemPrompt }, 28 | ...convertToOpenAiMessages(messages), 29 | ] 30 | 31 | try { 32 | const stream = await this.client.chat.completions.create({ 33 | model: this.getModel().id, 34 | messages: openAiMessages, 35 | temperature: 0, 36 | stream: true, 37 | }) 38 | for await (const chunk of stream) { 39 | const delta = chunk.choices[0]?.delta 40 | if (delta?.content) { 41 | yield { 42 | type: "text", 43 | text: delta.content, 44 | } 45 | } 46 | } 47 | } catch (error) { 48 | // LM Studio doesn't return an error code/body for now 49 | throw new Error( 50 | "Please check the LM Studio developer logs to debug what went wrong. You may need to load the model with a larger context length to work with Apex's prompts.", 51 | ) 52 | } 53 | } 54 | 55 | getModel(): { id: string; info: ModelInfo } { 56 | return { 57 | id: this.options.lmStudioModelId || "", 58 | info: openAiModelInfoSaneDefaults, 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /src/api/providers/ollama.ts: -------------------------------------------------------------------------------- 1 | import { Anthropic } from "@anthropic-ai/sdk" 2 | import { Message, Ollama } from "ollama" 3 | import { ApiHandler } from "../" 4 | import { ApiHandlerOptions, ModelInfo, openAiModelInfoSaneDefaults } from "../../shared/api" 5 | import { convertToOllamaMessages } from "../transform/ollama-format" 6 | import { ApiStream } from "../transform/stream" 7 | 8 | export class OllamaHandler implements ApiHandler { 9 | private options: ApiHandlerOptions 10 | private client: Ollama 11 | 12 | constructor(options: ApiHandlerOptions) { 13 | this.options = options 14 | this.client = new Ollama({ host: this.options.ollamaBaseUrl || "http://localhost:11434" }) 15 | } 16 | 17 | // Implement the capability flag 18 | supportsNativeFunctionCalling(): boolean { 19 | return false // Ollama does not support native function calling 20 | } 21 | 22 | async *createMessage(systemPrompt: string, messages: Anthropic.Messages.MessageParam[]): ApiStream { 23 | const ollamaMessages: Message[] = [{ role: "system", content: systemPrompt }, ...convertToOllamaMessages(messages)] 24 | 25 | const stream = await this.client.chat({ 26 | model: this.getModel().id, 27 | messages: ollamaMessages, 28 | stream: true, 29 | options: { 30 | num_ctx: Number(this.options.ollamaApiOptionsCtxNum) || 32768, 31 | }, 32 | }) 33 | for await (const chunk of stream) { 34 | if (typeof chunk.message.content === "string") { 35 | yield { 36 | type: "text", 37 | text: chunk.message.content, 38 | } 39 | } 40 | } 41 | } 42 | 43 | getModel(): { id: string; info: ModelInfo } { 44 | return { 45 | id: this.options.ollamaModelId || "", 46 | info: openAiModelInfoSaneDefaults, 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/api/providers/types.ts: -------------------------------------------------------------------------------- 1 | // For the following openrouter error type sources, see the docs here: 2 | // https://openrouter.ai/docs/api-reference/errors 3 | 4 | export type OpenRouterErrorResponse = { 5 | error: { 6 | message: string 7 | code: number 8 | metadata?: OpenRouterProviderErrorMetadata | OpenRouterModerationErrorMetadata | Record 9 | } 10 | } 11 | 12 | export type OpenRouterProviderErrorMetadata = { 13 | provider_name: string // The name of the provider that encountered the error 14 | raw: unknown // The raw error from the provider 15 | } 16 | 17 | export type OpenRouterModerationErrorMetadata = { 18 | reasons: string[] // Why your input was flagged 19 | flagged_input: string // The text segment that was flagged, limited to 100 characters. If the flagged input is longer than 100 characters, it will be truncated in the middle and replaced with ... 20 | provider_name: string // The name of the provider that requested moderation 21 | model_slug: string 22 | } 23 | -------------------------------------------------------------------------------- /src/api/providers/xai.ts: -------------------------------------------------------------------------------- 1 | import { Anthropic } from "@anthropic-ai/sdk" 2 | import OpenAI from "openai" 3 | import { ApiHandler } from "../" 4 | import { ApiHandlerOptions, XAIModelId, ModelInfo, xaiDefaultModelId, xaiModels } from "../../shared/api" 5 | import { convertToOpenAiMessages } from "../transform/openai-format" 6 | import { ApiStream } from "../transform/stream" 7 | 8 | export class XAIHandler implements ApiHandler { 9 | private options: ApiHandlerOptions 10 | private client: OpenAI 11 | 12 | constructor(options: ApiHandlerOptions) { 13 | this.options = options 14 | this.client = new OpenAI({ 15 | baseURL: "https://api.x.ai/v1", 16 | apiKey: this.options.xaiApiKey, 17 | }) 18 | } 19 | 20 | // Implement the capability flag 21 | supportsNativeFunctionCalling(): boolean { 22 | // X.AI API (Grok) does not currently support function/tool calling. 23 | return false 24 | } 25 | 26 | async *createMessage(systemPrompt: string, messages: Anthropic.Messages.MessageParam[]): ApiStream { 27 | const stream = await this.client.chat.completions.create({ 28 | model: this.getModel().id, 29 | max_completion_tokens: this.getModel().info.maxTokens, 30 | temperature: 0, 31 | messages: [{ role: "system", content: systemPrompt }, ...convertToOpenAiMessages(messages)], 32 | stream: true, 33 | stream_options: { include_usage: true }, 34 | }) 35 | 36 | for await (const chunk of stream) { 37 | const delta = chunk.choices[0]?.delta 38 | if (delta?.content) { 39 | yield { 40 | type: "text", 41 | text: delta.content, 42 | } 43 | } 44 | 45 | if (chunk.usage) { 46 | yield { 47 | type: "usage", 48 | inputTokens: 0, 49 | outputTokens: chunk.usage.completion_tokens || 0, 50 | // @ts-ignore-next-line 51 | cacheReadTokens: chunk.usage.prompt_cache_hit_tokens || 0, 52 | // @ts-ignore-next-line 53 | cacheWriteTokens: chunk.usage.prompt_cache_miss_tokens || 0, 54 | } 55 | } 56 | } 57 | } 58 | 59 | getModel(): { id: XAIModelId; info: ModelInfo } { 60 | const modelId = this.options.apiModelId 61 | if (modelId && modelId in xaiModels) { 62 | const id = modelId as XAIModelId 63 | return { id, info: xaiModels[id] } 64 | } 65 | return { 66 | id: xaiDefaultModelId, 67 | info: xaiModels[xaiDefaultModelId], 68 | } 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /src/api/retry.ts: -------------------------------------------------------------------------------- 1 | interface RetryOptions { 2 | maxRetries?: number 3 | baseDelay?: number 4 | maxDelay?: number 5 | retryAllErrors?: boolean 6 | } 7 | 8 | const DEFAULT_OPTIONS: Required = { 9 | maxRetries: 3, 10 | baseDelay: 1_000, 11 | maxDelay: 10_000, 12 | retryAllErrors: false, 13 | } 14 | 15 | export function withRetry(options: RetryOptions = {}) { 16 | const { maxRetries, baseDelay, maxDelay, retryAllErrors } = { ...DEFAULT_OPTIONS, ...options } 17 | 18 | return function (_target: any, _propertyKey: string, descriptor: PropertyDescriptor) { 19 | const originalMethod = descriptor.value 20 | 21 | descriptor.value = async function* (...args: any[]) { 22 | for (let attempt = 0; attempt < maxRetries; attempt++) { 23 | try { 24 | yield* originalMethod.apply(this, args) 25 | return 26 | } catch (error: any) { 27 | const isRateLimit = error?.status === 429 28 | const isLastAttempt = attempt === maxRetries - 1 29 | 30 | if ((!isRateLimit && !retryAllErrors) || isLastAttempt) { 31 | throw error 32 | } 33 | 34 | // Get retry delay from header or calculate exponential backoff 35 | // Check various rate limit headers 36 | const retryAfter = 37 | error.headers?.["retry-after"] || 38 | error.headers?.["x-ratelimit-reset"] || 39 | error.headers?.["ratelimit-reset"] 40 | 41 | let delay: number 42 | if (retryAfter) { 43 | // Handle both delta-seconds and Unix timestamp formats 44 | const retryValue = parseInt(retryAfter, 10) 45 | if (retryValue > Date.now() / 1000) { 46 | // Unix timestamp 47 | delay = retryValue * 1000 - Date.now() 48 | } else { 49 | // Delta seconds 50 | delay = retryValue * 1000 51 | } 52 | } else { 53 | // Use exponential backoff if no header 54 | delay = Math.min(maxDelay, baseDelay * Math.pow(2, attempt)) 55 | } 56 | 57 | await new Promise((resolve) => setTimeout(resolve, delay)) 58 | } 59 | } 60 | } 61 | 62 | return descriptor 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /src/api/transform/stream.ts: -------------------------------------------------------------------------------- 1 | import { FunctionCall } from "@google/generative-ai" // Import FunctionCall type 2 | 3 | export type ApiStream = AsyncGenerator 4 | export type ApiStreamChunk = 5 | | ApiStreamTextChunk 6 | | ApiStreamReasoningChunk 7 | | ApiStreamUsageChunk 8 | | ApiStreamFunctionCallsChunk // Add function calls 9 | | ApiStreamErrorChunk // Add error 10 | 11 | export interface ApiStreamTextChunk { 12 | type: "text" 13 | text: string 14 | } 15 | 16 | export interface ApiStreamReasoningChunk { 17 | type: "reasoning" 18 | reasoning: string 19 | } 20 | 21 | export interface ApiStreamUsageChunk { 22 | type: "usage" 23 | inputTokens: number 24 | outputTokens: number 25 | cacheWriteTokens?: number 26 | cacheReadTokens?: number 27 | totalCost?: number 28 | } 29 | 30 | // New chunk type for function calls 31 | export interface ApiStreamFunctionCallsChunk { 32 | type: "function_calls" 33 | calls: FunctionCall[] // Use the type from the SDK 34 | } 35 | 36 | // New chunk type for errors during streaming 37 | export interface ApiStreamErrorChunk { 38 | type: "error" 39 | error: string 40 | } 41 | -------------------------------------------------------------------------------- /src/core/README.md: -------------------------------------------------------------------------------- 1 | # Core Architecture 2 | 3 | Extension entry point (extension.ts) -> webview -> controller -> task 4 | 5 | ```tree 6 | core/ 7 | ├── webview/ # Manages webview lifecycle 8 | ├── controller/ # Handles webview messages and task management 9 | ├── task/ # Executes API requests and tool operations 10 | └── ... # Additional components to help with context, parsing user/assistant messages, etc. 11 | ``` 12 | -------------------------------------------------------------------------------- /src/core/assistant-message/index.ts: -------------------------------------------------------------------------------- 1 | // Define ReasoningContent interface 2 | export interface ReasoningContent { 3 | type: "reasoning" 4 | reasoning: string 5 | partial: boolean 6 | } 7 | 8 | export type AssistantMessageContent = TextContent | ToolUse | ReasoningContent // Add ReasoningContent to the union 9 | 10 | export { parseAssistantMessage } from "./parse-assistant-message" 11 | 12 | export interface TextContent { 13 | type: "text" 14 | content: string 15 | partial: boolean 16 | } 17 | 18 | export const toolUseNames = [ 19 | "execute_command", 20 | "read_file", 21 | "write_to_file", 22 | "replace_in_file", 23 | "search_files", 24 | "list_files", 25 | "list_code_definition_names", 26 | "browser_action", 27 | "use_mcp_tool", 28 | "access_mcp_resource", 29 | "ask_followup_question", 30 | "plan_mode_respond", 31 | "attempt_completion", 32 | ] as const 33 | 34 | // Converts array of tool call names into a union type ("execute_command" | "read_file" | ...) 35 | export type ToolUseName = (typeof toolUseNames)[number] 36 | 37 | export const toolParamNames = [ 38 | "command", 39 | "requires_approval", 40 | "path", 41 | "content", 42 | "diff", 43 | "regex", 44 | "file_pattern", 45 | "recursive", 46 | "action", 47 | "url", 48 | "coordinate", 49 | "text", 50 | "server_name", 51 | "tool_name", 52 | "arguments", 53 | "uri", 54 | "question", 55 | "options", 56 | "response", 57 | "result", 58 | ] as const 59 | 60 | export type ToolParamName = (typeof toolParamNames)[number] 61 | 62 | export interface ToolUse { 63 | type: "tool_use" 64 | id?: string // Optional ID to store Anthropic's tool_use_id 65 | name: ToolUseName 66 | // params is a partial record, allowing only some or none of the possible parameters to be used 67 | params: Partial> 68 | partial: boolean 69 | } 70 | -------------------------------------------------------------------------------- /src/core/context-management/context-error-handling.ts: -------------------------------------------------------------------------------- 1 | export function checkIsOpenRouterContextWindowError(error: any): boolean { 2 | return error.code === 400 && error.message?.includes("context length") 3 | } 4 | 5 | export function checkIsAnthropicContextWindowError(response: any): boolean { 6 | return ( 7 | response?.error?.error?.type === "invalid_request_error" && 8 | response?.error?.error?.message?.includes("prompt is too long") 9 | ) 10 | } 11 | -------------------------------------------------------------------------------- /src/core/controller/modules/webview-handler.ts: -------------------------------------------------------------------------------- 1 | import * as vscode from "vscode" 2 | import { ExtensionMessage } from "../../../shared/ExtensionMessage" 3 | import { WebviewProvider } from "../../webview" // Adjust path as necessary 4 | 5 | /** 6 | * Posts a message to the webview. 7 | * @param webviewProviderRef Weak reference to the WebviewProvider. 8 | * @param message The message to post. 9 | */ 10 | export function postMessageToWebview(webviewProviderRef: WeakRef | undefined, message: ExtensionMessage): void { 11 | const provider = webviewProviderRef?.deref() 12 | if (provider?.view) { 13 | provider.view.webview.postMessage(message).then( 14 | (success) => { 15 | if (!success) { 16 | console.warn(`[WebviewHandler] Failed to post message type ${message.type} to webview.`) 17 | // Optionally handle specific message types that failed 18 | } 19 | }, 20 | (error) => { 21 | console.error(`[WebviewHandler] Error posting message type ${message.type} to webview:`, error) 22 | // Consider more robust error handling or logging 23 | }, 24 | ) 25 | } else { 26 | console.warn(`[WebviewHandler] Webview provider or view not available when trying to post message type ${message.type}.`) 27 | // This might happen during shutdown or if the webview hasn't fully initialized. 28 | } 29 | } 30 | 31 | // NOTE: handleWebviewMessage remains in the main controller (index.ts) as it orchestrates 32 | // actions across multiple modules based on incoming messages. This module focuses solely 33 | // on the mechanism of *sending* messages *to* the webview. 34 | -------------------------------------------------------------------------------- /src/core/prompts/system.ts: -------------------------------------------------------------------------------- 1 | import { McpHub } from "../../services/mcp/McpHub" 2 | import { BrowserSettings } from "../../shared/BrowserSettings" 3 | // Import the new assembler function 4 | import { assembleSystemPrompt } from "./system/index" 5 | import { formatResponse } from "./responses" // Keep for addUserInstructions if needed elsewhere 6 | 7 | // Main export now calls the assembler 8 | export const SYSTEM_PROMPT = async ( 9 | cwd: string, 10 | supportsComputerUse: boolean, 11 | mcpHub: McpHub, 12 | browserSettings: BrowserSettings, 13 | needsXmlToolInstructions?: boolean, // Pass this through 14 | // Pass through custom instruction parts 15 | settingsCustomInstructions?: string, 16 | apexRulesFileInstructions?: string, 17 | apexIgnoreInstructions?: string, 18 | preferredLanguageInstructions?: string, 19 | ): Promise => { 20 | // Delegate to the assembler function 21 | return assembleSystemPrompt( 22 | cwd, 23 | supportsComputerUse, 24 | mcpHub, 25 | browserSettings, 26 | needsXmlToolInstructions, 27 | settingsCustomInstructions, 28 | apexRulesFileInstructions, 29 | apexIgnoreInstructions, 30 | preferredLanguageInstructions, 31 | ) 32 | } 33 | 34 | // Keep the original addUserInstructions function for potential external use or later removal 35 | // If confirmed unused after refactoring, this can be deleted. 36 | export function addUserInstructions( 37 | settingsCustomInstructions?: string, 38 | apexRulesFileInstructions?: string, 39 | apexIgnoreInstructions?: string, 40 | preferredLanguageInstructions?: string, 41 | ) { 42 | let customInstructions = "" 43 | if (preferredLanguageInstructions) { 44 | customInstructions += preferredLanguageInstructions + "\n\n" 45 | } 46 | if (settingsCustomInstructions) { 47 | customInstructions += settingsCustomInstructions + "\n\n" 48 | } 49 | if (apexRulesFileInstructions) { 50 | customInstructions += apexRulesFileInstructions + "\n\n" 51 | } 52 | if (apexIgnoreInstructions) { 53 | customInstructions += apexIgnoreInstructions 54 | } 55 | 56 | return ` 57 | ==== 58 | 59 | USER'S CUSTOM INSTRUCTIONS 60 | 61 | The following additional instructions are provided by the user, and should be followed to the best of your ability without interfering with the TOOL USE guidelines. 62 | 63 | ${customInstructions.trim()}` 64 | } 65 | -------------------------------------------------------------------------------- /src/core/prompts/system/custom-instructions.ts: -------------------------------------------------------------------------------- 1 | export const getCustomInstructionsPrompt = ( 2 | settingsCustomInstructions?: string, 3 | apexRulesFileInstructions?: string, 4 | apexIgnoreInstructions?: string, 5 | preferredLanguageInstructions?: string, 6 | dynamicPersonaContent?: string, // Add dynamic persona content 7 | ): string => { 8 | let customInstructionsSection = "" 9 | let mainInstructions = "" // To hold either dynamic or settings instructions 10 | 11 | // Prioritize dynamic persona content 12 | if (dynamicPersonaContent) { 13 | mainInstructions = dynamicPersonaContent.trim() 14 | // Optional: Add a comment indicating dynamic persona usage if desired 15 | // mainInstructions = `\n${mainInstructions}`; 16 | } else if (settingsCustomInstructions) { 17 | // Fallback to settings instructions only if dynamic content is absent 18 | mainInstructions = settingsCustomInstructions.trim() 19 | } 20 | 21 | // Build the final content string 22 | let contentParts: string[] = [] 23 | if (preferredLanguageInstructions) { 24 | contentParts.push(preferredLanguageInstructions.trim()) 25 | } 26 | if (mainInstructions) { 27 | contentParts.push(mainInstructions) // Add the prioritized instructions 28 | } 29 | if (apexRulesFileInstructions) { 30 | contentParts.push(apexRulesFileInstructions.trim()) 31 | } // Correctly close the if block here 32 | // Remove the extra closing brace that was here 33 | 34 | if (apexIgnoreInstructions) { 35 | // This block should be at the same level 36 | contentParts.push(apexIgnoreInstructions.trim()) 37 | } 38 | 39 | // Join parts with double newlines, then trim final result 40 | let content = contentParts.join("\n\n").trim() 41 | 42 | if (content) { 43 | customInstructionsSection = ` 44 | ==== 45 | 46 | USER'S CUSTOM INSTRUCTIONS 47 | 48 | The following additional instructions are provided by the user, and should be followed to the best of your ability without interfering with the TOOL USE guidelines. 49 | 50 | ${content}` 51 | } 52 | 53 | return customInstructionsSection 54 | } 55 | -------------------------------------------------------------------------------- /src/core/prompts/system/intro.ts: -------------------------------------------------------------------------------- 1 | export const getIntroPrompt = (): string => { 2 | return `You are Apex, a highly skilled software engineer with extensive knowledge in many programming languages, frameworks, design patterns, and best practices. You also have access to a knowledge base containing information about the current workspace, which you should consult automatically when needed to answer questions or complete tasks.` 3 | } 4 | -------------------------------------------------------------------------------- /src/core/prompts/system/objective.ts: -------------------------------------------------------------------------------- 1 | export const getObjectivePrompt = (): string => { 2 | return ` 3 | ==== 4 | 5 | OBJECTIVE 6 | 7 | You accomplish a given task iteratively, breaking it down into clear steps and working through them methodically, leveraging all available capabilities including your knowledge base and tools. 8 | 9 | 1. Analyze the user's task and set clear, achievable goals to accomplish it. Prioritize these goals in a logical order. Consider if the task requires information potentially available in the workspace knowledge base. 10 | 2. Work through these goals sequentially, utilizing available tools one at a time as necessary. Each goal should correspond to a distinct step in your problem-solving process. You will be informed on the work completed and what's remaining as you go. 11 | 3. Remember, you have extensive capabilities. Leverage the provided knowledge context and available tools effectively. Before calling a tool, perform analysis within tags: 12 | - Analyze the file structure in \`environment_details\` for context. 13 | - Consider the provided knowledge context (if any). 14 | - Determine the most relevant tool for the current step. 15 | - Verify all required parameters for the tool are available or can be inferred. 16 | - If parameters are missing, use \`ask_followup_question\`. Do not invoke tools with missing required parameters. 17 | 4. If operating autonomously and you receive recovery instructions, prioritize following them. 18 | 5. Once you've completed the user's task, you must use the \`attempt_completion\` tool to present the result. You may provide a CLI command to showcase the result (e.g., \`open index.html\`). 19 | 6. The user may provide feedback, which you can use to make improvements and try again. But DO NOT continue in pointless back and forth conversations, i.e. don't end your responses with questions or offers for further assistance.` 20 | } 21 | -------------------------------------------------------------------------------- /src/core/prompts/system/system-info.ts: -------------------------------------------------------------------------------- 1 | import { getShell } from "../../../utils/shell" 2 | import os from "os" 3 | import osName from "os-name" 4 | 5 | export const getSystemInfoPrompt = (cwd: string): string => { 6 | return ` 7 | ==== 8 | 9 | SYSTEM INFORMATION 10 | 11 | Operating System: ${osName()} 12 | Default Shell: ${getShell()} 13 | Home Directory: ${os.homedir()} 14 | Current Working Directory: ${cwd}` 15 | } 16 | -------------------------------------------------------------------------------- /src/core/task/modules/api_handler/helpers.ts: -------------------------------------------------------------------------------- 1 | import { Anthropic } from "@anthropic-ai/sdk" 2 | // Corrected relative path: Go up two levels from api_handler to modules, then down to assistant-message 3 | import { AssistantMessageContent, ToolUse } from "../../../assistant-message" 4 | 5 | // Helper function to convert AssistantMessageContent to Anthropic ContentBlock array 6 | // Corrected return type and property access, and mapping from ToolUse (params) to ToolUseBlock (input) 7 | export function formatAssistantContentForHistory( 8 | blocks: AssistantMessageContent[], 9 | ): Array { 10 | const historyBlocks: Array = [] 11 | for (const block of blocks) { 12 | if (block.type === "text") { 13 | // Ensure it matches Anthropic.TextBlock structure, using citations: null 14 | historyBlocks.push({ type: "text", text: block.content ?? "", citations: null }) 15 | } else if (block.type === "tool_use") { 16 | const toolUse = block as ToolUse // Cast to internal ToolUse type 17 | // Ensure it matches Anthropic.ToolUseBlock structure 18 | historyBlocks.push({ 19 | type: "tool_use", 20 | id: toolUse.id || `toolu_${Date.now()}`, // Use internal id if present, else generate 21 | name: toolUse.name, 22 | input: toolUse.params || {}, // Map internal 'params' to Anthropic 'input' 23 | }) 24 | // Removed 'function_calls' handling as it's not part of AssistantMessageContent 25 | } 26 | // Skip 'reasoning' blocks (no else if needed) 27 | } 28 | // If no actionable blocks were found, add a placeholder text block 29 | if (historyBlocks.length === 0) { 30 | // Ensure placeholder matches TextBlock structure, using citations: null 31 | historyBlocks.push({ type: "text", text: "(No actionable content generated)", citations: null }) 32 | } 33 | return historyBlocks 34 | } 35 | 36 | export function formatErrorWithStatusCode(error: any): string { 37 | const statusCode = error.status || error.statusCode || (error.response && error.response.status) 38 | const message = error.message ?? JSON.stringify(error, null, 2) 39 | return statusCode && !message.includes(statusCode.toString()) ? `${statusCode} - ${message}` : message 40 | } 41 | -------------------------------------------------------------------------------- /src/core/task/modules/tools/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Central export file for all tool implementations 3 | */ 4 | export * from "./file-system-tools" 5 | export * from "./code-analysis-tools" 6 | export * from "./command-tools" 7 | export * from "./browser-tools" 8 | export * from "./mcp-tools" 9 | export * from "./interaction-tools" 10 | -------------------------------------------------------------------------------- /src/core/webview/getNonce.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * A helper function that returns a unique alphanumeric identifier called a nonce. 3 | * 4 | * @remarks This function is primarily used to help enforce content security 5 | * policies for resources/scripts being executed in a webview context. 6 | * 7 | * @returns A nonce 8 | */ 9 | export function getNonce() { 10 | let text = "" 11 | const possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" 12 | for (let i = 0; i < 32; i++) { 13 | text += possible.charAt(Math.floor(Math.random() * possible.length)) 14 | } 15 | return text 16 | } 17 | -------------------------------------------------------------------------------- /src/core/webview/getUri.ts: -------------------------------------------------------------------------------- 1 | import { Uri, Webview } from "vscode" 2 | /** 3 | * A helper function which will get the webview URI of a given file or resource. 4 | * 5 | * @remarks This URI can be used within a webview's HTML as a link to the 6 | * given file/resource. 7 | * 8 | * @param webview A reference to the extension webview 9 | * @param extensionUri The URI of the directory containing the extension 10 | * @param pathList An array of strings representing the path to a file/resource 11 | * @returns A URI pointing to the file/resource 12 | */ 13 | export function getUri(webview: Webview, extensionUri: Uri, pathList: string[]) { 14 | return webview.asWebviewUri(Uri.joinPath(extensionUri, ...pathList)) 15 | } 16 | -------------------------------------------------------------------------------- /src/exports/README.md: -------------------------------------------------------------------------------- 1 | # Apex API 2 | 3 | The Apex extension exposes an API that can be used by other extensions. To use this API in your extension: 4 | 5 | 1. Copy `src/extension-api/apex.d.ts` to your extension's source directory. 6 | 2. Include `apex.d.ts` in your extension's compilation. 7 | 3. Get access to the API with the following code: 8 | 9 | ```ts 10 | const apexExtension = vscode.extensions.getExtension("saoudrizwan.claude-dev") 11 | 12 | if (!apexExtension?.isActive) { 13 | throw new Error("Apex extension is not activated") 14 | } 15 | 16 | const apex = apexExtension.exports 17 | 18 | if (apex) { 19 | // Now you can use the API 20 | 21 | // Set custom instructions 22 | await apex.setCustomInstructions("Talk like a pirate") 23 | 24 | // Get custom instructions 25 | const instructions = await apex.getCustomInstructions() 26 | console.log("Current custom instructions:", instructions) 27 | 28 | // Start a new task with an initial message 29 | await apex.startNewTask("Hello, Apex! Let's make a new project...") 30 | 31 | // Start a new task with an initial message and images 32 | await apex.startNewTask("Use this design language", ["data:image/webp;base64,..."]) 33 | 34 | // Send a message to the current task 35 | await apex.sendMessage("Can you fix the @problems?") 36 | 37 | // Simulate pressing the primary button in the chat interface (e.g. 'Save' or 'Proceed While Running') 38 | await apex.pressPrimaryButton() 39 | 40 | // Simulate pressing the secondary button in the chat interface (e.g. 'Reject') 41 | await apex.pressSecondaryButton() 42 | } else { 43 | console.error("Apex API is not available") 44 | } 45 | ``` 46 | 47 | **Note:** To ensure that the `saoudrizwan.claude-dev` extension is activated before your extension, add it to the `extensionDependencies` in your `package.json`: 48 | 49 | ```json 50 | "extensionDependencies": [ 51 | "saoudrizwan.claude-dev" 52 | ] 53 | ``` 54 | 55 | For detailed information on the available methods and their usage, refer to the `apex.d.ts` file. 56 | -------------------------------------------------------------------------------- /src/exports/apex.d.ts: -------------------------------------------------------------------------------- 1 | export interface ApexAPI { 2 | /** 3 | * Sets the custom instructions in the global storage. 4 | * @param value The custom instructions to be saved. 5 | */ 6 | setCustomInstructions(value: string): Promise 7 | 8 | /** 9 | * Retrieves the custom instructions from the global storage. 10 | * @returns The saved custom instructions, or undefined if not set. 11 | */ 12 | getCustomInstructions(): Promise 13 | 14 | /** 15 | * Starts a new task with an optional initial message and images. 16 | * @param task Optional initial task message. 17 | * @param images Optional array of image data URIs (e.g., "data:image/webp;base64,..."). 18 | */ 19 | startNewTask(task?: string, images?: string[]): Promise 20 | 21 | /** 22 | * Sends a message to the current task. 23 | * @param message Optional message to send. 24 | * @param images Optional array of image data URIs (e.g., "data:image/webp;base64,..."). 25 | */ 26 | sendMessage(message?: string, images?: string[]): Promise 27 | 28 | /** 29 | * Simulates pressing the primary button in the chat interface. 30 | */ 31 | pressPrimaryButton(): Promise 32 | 33 | /** 34 | * Simulates pressing the secondary button in the chat interface. 35 | */ 36 | pressSecondaryButton(): Promise 37 | } 38 | -------------------------------------------------------------------------------- /src/integrations/checkpoints/CheckpointCreation.test.ts.bak: -------------------------------------------------------------------------------- 1 | import { expect } from "chai" 2 | import { describe, it, beforeEach, afterEach } from "mocha" 3 | import { createTestEnvironment, createTestTracker } from "./Checkpoint-test-utils" 4 | import CheckpointTracker from "./CheckpointTracker" 5 | 6 | describe("Checkpoint Creation", () => { 7 | let env: Awaited> 8 | 9 | beforeEach(async () => { 10 | env = await createTestEnvironment() 11 | }) 12 | 13 | afterEach(async () => { 14 | await env.cleanup() 15 | }) 16 | 17 | it("should create a new checkpoint tracker", async () => { 18 | const tracker = await createTestTracker(env.globalStoragePath) 19 | expect(tracker).to.not.be.undefined 20 | expect(tracker).to.be.instanceOf(CheckpointTracker) 21 | 22 | // Verify shadow git config 23 | const configWorkTree = await tracker?.getShadowGitConfigWorkTree() 24 | expect(configWorkTree).to.not.be.undefined 25 | }) 26 | 27 | it("should throw error when globalStoragePath is missing", async () => { 28 | try { 29 | await createTestTracker(undefined) 30 | expect.fail("Expected error was not thrown") 31 | } catch (error: any) { 32 | expect(error.message).to.equal("Global storage path is required to create a checkpoint tracker") 33 | } 34 | }) 35 | }) 36 | -------------------------------------------------------------------------------- /src/integrations/debug/DebugConsoleManager.ts: -------------------------------------------------------------------------------- 1 | import * as vscode from "vscode" 2 | 3 | interface DebugSession { 4 | id: string 5 | name: string 6 | output: string[] 7 | lastRetrievedIndex: number 8 | } 9 | 10 | export class DebugConsoleManager { 11 | private sessions: Map = new Map() 12 | private disposables: vscode.Disposable[] = [] 13 | 14 | constructor() { 15 | // Listen for debug session start events 16 | this.disposables.push( 17 | vscode.debug.onDidStartDebugSession((session) => { 18 | this.sessions.set(session.id, { 19 | id: session.id, 20 | name: session.name, 21 | output: [], 22 | lastRetrievedIndex: -1, 23 | }) 24 | }), 25 | ) 26 | 27 | // Listen for debug session end events 28 | this.disposables.push( 29 | vscode.debug.onDidTerminateDebugSession((session) => { 30 | this.sessions.delete(session.id) 31 | }), 32 | ) 33 | 34 | // Listen for debug console output 35 | this.disposables.push( 36 | vscode.debug.onDidReceiveDebugSessionCustomEvent((e: vscode.DebugSessionCustomEvent) => { 37 | if (e.event === "output" && e.body?.output) { 38 | const session = this.sessions.get(e.session.id) 39 | if (session) { 40 | session.output.push(e.body.output) 41 | } 42 | } 43 | }), 44 | ) 45 | } 46 | 47 | /** 48 | * Get all active debug sessions 49 | */ 50 | getActiveSessions(): { id: string; name: string }[] { 51 | return Array.from(this.sessions.values()).map(({ id, name }) => ({ id, name })) 52 | } 53 | 54 | /** 55 | * Get any new output since the last retrieval for a specific debug session 56 | */ 57 | getUnretrievedOutput(sessionId: string): string | undefined { 58 | const session = this.sessions.get(sessionId) 59 | if (!session) { 60 | return undefined 61 | } 62 | 63 | const newOutput = session.output.slice(session.lastRetrievedIndex + 1).join("") 64 | session.lastRetrievedIndex = session.output.length - 1 65 | return newOutput || undefined 66 | } 67 | 68 | /** 69 | * Clean up resources 70 | */ 71 | dispose() { 72 | this.disposables.forEach((d) => d.dispose()) 73 | this.sessions.clear() 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /src/integrations/editor/detect-omission.ts: -------------------------------------------------------------------------------- 1 | import * as vscode from "vscode" 2 | 3 | /** 4 | * Detects potential AI-generated code omissions in the given file content. 5 | * @param originalFileContent The original content of the file. 6 | * @param newFileContent The new content of the file to check. 7 | * @returns True if a potential omission is detected, false otherwise. 8 | */ 9 | function detectCodeOmission(originalFileContent: string, newFileContent: string): boolean { 10 | const originalLines = originalFileContent.split("\n") 11 | const newLines = newFileContent.split("\n") 12 | const omissionKeywords = ["remain", "remains", "unchanged", "rest", "previous", "existing", "..."] 13 | 14 | const commentPatterns = [ 15 | /^\s*\/\//, // Single-line comment for most languages 16 | /^\s*#/, // Single-line comment for Python, Ruby, etc. 17 | /^\s*\/\*/, // Multi-line comment opening 18 | /^\s*{\s*\/\*/, // JSX comment opening 19 | /^\s*