@octo-cyber/ai 0.5.5 → 0.5.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/shared/IClaudeCodeSessionManager.d.ts +151 -0
- package/dist/shared/IClaudeCodeSessionManager.d.ts.map +1 -0
- package/dist/shared/IClaudeCodeSessionManager.js +6 -0
- package/dist/shared/IClaudeCodeSessionManager.js.map +1 -0
- package/dist/src/BranchDecisionEngine.d.ts +73 -0
- package/dist/src/BranchDecisionEngine.d.ts.map +1 -0
- package/dist/src/BranchDecisionEngine.js +195 -0
- package/dist/src/BranchDecisionEngine.js.map +1 -0
- package/dist/src/agent/agent-approval.controller.d.ts +20 -0
- package/dist/src/agent/agent-approval.controller.d.ts.map +1 -0
- package/dist/src/agent/agent-approval.controller.js +101 -0
- package/dist/src/agent/agent-approval.controller.js.map +1 -0
- package/dist/src/agent/agent-approval.entity.d.ts +15 -0
- package/dist/src/agent/agent-approval.entity.d.ts.map +1 -0
- package/dist/src/agent/agent-approval.entity.js +63 -0
- package/dist/src/agent/agent-approval.entity.js.map +1 -0
- package/dist/src/agent/agent-approval.service.d.ts +35 -0
- package/dist/src/agent/agent-approval.service.d.ts.map +1 -0
- package/dist/src/agent/agent-approval.service.js +109 -0
- package/dist/src/agent/agent-approval.service.js.map +1 -0
- package/dist/src/agent/agent-gateway.controller.d.ts +30 -0
- package/dist/src/agent/agent-gateway.controller.d.ts.map +1 -0
- package/dist/src/agent/agent-gateway.controller.js +112 -0
- package/dist/src/agent/agent-gateway.controller.js.map +1 -0
- package/dist/src/agent/agent-gateway.service.d.ts +33 -0
- package/dist/src/agent/agent-gateway.service.d.ts.map +1 -0
- package/dist/src/agent/agent-gateway.service.js +84 -0
- package/dist/src/agent/agent-gateway.service.js.map +1 -0
- package/dist/src/agent/agent-registry.service.d.ts +30 -0
- package/dist/src/agent/agent-registry.service.d.ts.map +1 -0
- package/dist/src/agent/agent-registry.service.js +45 -0
- package/dist/src/agent/agent-registry.service.js.map +1 -0
- package/dist/src/agent/agent-run.controller.d.ts +42 -0
- package/dist/src/agent/agent-run.controller.d.ts.map +1 -0
- package/dist/src/agent/agent-run.controller.js +195 -0
- package/dist/src/agent/agent-run.controller.js.map +1 -0
- package/dist/src/agent/agent-run.entity.d.ts +35 -0
- package/dist/src/agent/agent-run.entity.d.ts.map +1 -0
- package/dist/src/agent/agent-run.entity.js +98 -0
- package/dist/src/agent/agent-run.entity.js.map +1 -0
- package/dist/src/agent/agent-run.service.d.ts +48 -0
- package/dist/src/agent/agent-run.service.d.ts.map +1 -0
- package/dist/src/agent/agent-run.service.js +155 -0
- package/dist/src/agent/agent-run.service.js.map +1 -0
- package/dist/src/agent/agent-session.controller.d.ts +20 -0
- package/dist/src/agent/agent-session.controller.d.ts.map +1 -0
- package/dist/src/agent/agent-session.controller.js +97 -0
- package/dist/src/agent/agent-session.controller.js.map +1 -0
- package/dist/src/agent/agent-session.entity.d.ts +13 -0
- package/dist/src/agent/agent-session.entity.d.ts.map +1 -0
- package/dist/src/agent/agent-session.entity.js +57 -0
- package/dist/src/agent/agent-session.entity.js.map +1 -0
- package/dist/src/agent/agent-session.service.d.ts +38 -0
- package/dist/src/agent/agent-session.service.d.ts.map +1 -0
- package/dist/src/agent/agent-session.service.js +112 -0
- package/dist/src/agent/agent-session.service.js.map +1 -0
- package/dist/src/agent/coding-tools.d.ts +7 -0
- package/dist/src/agent/coding-tools.d.ts.map +1 -0
- package/dist/src/agent/coding-tools.js +181 -0
- package/dist/src/agent/coding-tools.js.map +1 -0
- package/dist/src/agent/computer-use-tools.d.ts +15 -0
- package/dist/src/agent/computer-use-tools.d.ts.map +1 -0
- package/dist/src/agent/computer-use-tools.js +256 -0
- package/dist/src/agent/computer-use-tools.js.map +1 -0
- package/dist/src/agent/external-agent.controller.d.ts +41 -0
- package/dist/src/agent/external-agent.controller.d.ts.map +1 -0
- package/dist/src/agent/external-agent.controller.js +129 -0
- package/dist/src/agent/external-agent.controller.js.map +1 -0
- package/dist/src/agent/external-agent.entity.d.ts +22 -0
- package/dist/src/agent/external-agent.entity.d.ts.map +1 -0
- package/dist/src/agent/external-agent.entity.js +75 -0
- package/dist/src/agent/external-agent.entity.js.map +1 -0
- package/dist/src/agent/external-agent.service.d.ts +60 -0
- package/dist/src/agent/external-agent.service.d.ts.map +1 -0
- package/dist/src/agent/external-agent.service.js +143 -0
- package/dist/src/agent/external-agent.service.js.map +1 -0
- package/dist/src/ai.module.d.ts +22 -0
- package/dist/src/ai.module.d.ts.map +1 -0
- package/dist/src/ai.module.js +178 -0
- package/dist/src/ai.module.js.map +1 -0
- package/dist/{cli → src/cli}/adapters/antigravity.adapter.d.ts +2 -0
- package/dist/src/cli/adapters/antigravity.adapter.d.ts.map +1 -0
- package/dist/{cli → src/cli}/adapters/antigravity.adapter.js +78 -0
- package/dist/src/cli/adapters/antigravity.adapter.js.map +1 -0
- package/dist/src/cli/adapters/claude-cli.adapter.d.ts.map +1 -0
- package/dist/{cli → src/cli}/adapters/claude-cli.adapter.js +2 -0
- package/dist/src/cli/adapters/claude-cli.adapter.js.map +1 -0
- package/dist/src/cli/adapters/cli-proxy-api.adapter.d.ts +32 -0
- package/dist/src/cli/adapters/cli-proxy-api.adapter.d.ts.map +1 -0
- package/dist/src/cli/adapters/cli-proxy-api.adapter.js +239 -0
- package/dist/src/cli/adapters/cli-proxy-api.adapter.js.map +1 -0
- package/dist/src/cli/adapters/codex-cli.adapter.d.ts.map +1 -0
- package/dist/src/cli/adapters/codex-cli.adapter.js.map +1 -0
- package/dist/src/cli/adapters/detect-cli.d.ts.map +1 -0
- package/dist/src/cli/adapters/detect-cli.js.map +1 -0
- package/dist/src/cli/adapters/gemini-cli.adapter.d.ts.map +1 -0
- package/dist/src/cli/adapters/gemini-cli.adapter.js.map +1 -0
- package/dist/src/cli/adapters/index.d.ts.map +1 -0
- package/dist/src/cli/adapters/index.js.map +1 -0
- package/dist/{cli → src/cli}/cli-executor.service.d.ts +2 -0
- package/dist/src/cli/cli-executor.service.d.ts.map +1 -0
- package/dist/{cli → src/cli}/cli-executor.service.js +21 -1
- package/dist/src/cli/cli-executor.service.js.map +1 -0
- package/dist/src/cli/cli-registry.service.d.ts.map +1 -0
- package/dist/{cli → src/cli}/cli-registry.service.js +3 -1
- package/dist/src/cli/cli-registry.service.js.map +1 -0
- package/dist/{cli → src/cli}/controllers/ai-cli.controller.d.ts +4 -0
- package/dist/src/cli/controllers/ai-cli.controller.d.ts.map +1 -0
- package/dist/{cli → src/cli}/controllers/ai-cli.controller.js +33 -4
- package/dist/src/cli/controllers/ai-cli.controller.js.map +1 -0
- package/dist/{cli → src/cli}/index.d.ts +1 -1
- package/dist/src/cli/index.d.ts.map +1 -0
- package/dist/src/cli/index.js.map +1 -0
- package/dist/{cli → src/cli}/types.d.ts +23 -1
- package/dist/src/cli/types.d.ts.map +1 -0
- package/dist/{skill → src/cli}/types.js.map +1 -1
- package/dist/{cli → src/cli}/workspace.service.d.ts +11 -3
- package/dist/src/cli/workspace.service.d.ts.map +1 -0
- package/dist/{cli → src/cli}/workspace.service.js +61 -6
- package/dist/src/cli/workspace.service.js.map +1 -0
- package/dist/src/computer-use/computer-use.controller.d.ts +23 -0
- package/dist/src/computer-use/computer-use.controller.d.ts.map +1 -0
- package/dist/src/computer-use/computer-use.controller.js +87 -0
- package/dist/src/computer-use/computer-use.controller.js.map +1 -0
- package/dist/src/index.d.ts +12 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +51 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/orchestrator/orchestrator-plan.entity.d.ts +31 -0
- package/dist/src/orchestrator/orchestrator-plan.entity.d.ts.map +1 -0
- package/dist/src/orchestrator/orchestrator-plan.entity.js +69 -0
- package/dist/src/orchestrator/orchestrator-plan.entity.js.map +1 -0
- package/dist/src/orchestrator/orchestrator-plan.service.d.ts +27 -0
- package/dist/src/orchestrator/orchestrator-plan.service.d.ts.map +1 -0
- package/dist/src/orchestrator/orchestrator-plan.service.js +201 -0
- package/dist/src/orchestrator/orchestrator-plan.service.js.map +1 -0
- package/dist/src/orchestrator/orchestrator.controller.d.ts +29 -0
- package/dist/src/orchestrator/orchestrator.controller.d.ts.map +1 -0
- package/dist/src/orchestrator/orchestrator.controller.js +144 -0
- package/dist/src/orchestrator/orchestrator.controller.js.map +1 -0
- package/dist/src/orchestrator/workflow-feedback.entity.d.ts +12 -0
- package/dist/src/orchestrator/workflow-feedback.entity.d.ts.map +1 -0
- package/dist/src/orchestrator/workflow-feedback.entity.js +49 -0
- package/dist/src/orchestrator/workflow-feedback.entity.js.map +1 -0
- package/dist/src/orchestrator/workflow-feedback.service.d.ts +14 -0
- package/dist/src/orchestrator/workflow-feedback.service.d.ts.map +1 -0
- package/dist/src/orchestrator/workflow-feedback.service.js +51 -0
- package/dist/src/orchestrator/workflow-feedback.service.js.map +1 -0
- package/dist/src/session/claude-code-session-manager.service.d.ts +28 -0
- package/dist/src/session/claude-code-session-manager.service.d.ts.map +1 -0
- package/dist/src/session/claude-code-session-manager.service.js +177 -0
- package/dist/src/session/claude-code-session-manager.service.js.map +1 -0
- package/dist/src/skill/controllers/skill-market.controller.d.ts +18 -0
- package/dist/src/skill/controllers/skill-market.controller.d.ts.map +1 -0
- package/dist/src/skill/controllers/skill-market.controller.js +128 -0
- package/dist/src/skill/controllers/skill-market.controller.js.map +1 -0
- package/dist/{skill → src/skill}/controllers/skill.controller.d.ts +4 -0
- package/dist/src/skill/controllers/skill.controller.d.ts.map +1 -0
- package/dist/{skill → src/skill}/controllers/skill.controller.js +31 -0
- package/dist/src/skill/controllers/skill.controller.js.map +1 -0
- package/dist/src/skill/entities/octo-skill.entity.d.ts.map +1 -0
- package/dist/src/skill/entities/octo-skill.entity.js.map +1 -0
- package/dist/{skill → src/skill}/index.d.ts +3 -1
- package/dist/src/skill/index.d.ts.map +1 -0
- package/dist/{skill → src/skill}/index.js +5 -1
- package/dist/src/skill/index.js.map +1 -0
- package/dist/src/skill/services/skill-generator.service.d.ts.map +1 -0
- package/dist/src/skill/services/skill-generator.service.js.map +1 -0
- package/dist/{skill → src/skill}/services/skill-installer.service.d.ts +27 -0
- package/dist/src/skill/services/skill-installer.service.d.ts.map +1 -0
- package/dist/{skill → src/skill}/services/skill-installer.service.js +108 -0
- package/dist/src/skill/services/skill-installer.service.js.map +1 -0
- package/dist/src/skill/services/skill-market-helpers.d.ts +25 -0
- package/dist/src/skill/services/skill-market-helpers.d.ts.map +1 -0
- package/dist/src/skill/services/skill-market-helpers.js +22 -0
- package/dist/src/skill/services/skill-market-helpers.js.map +1 -0
- package/dist/src/skill/services/skill-market.service.d.ts +60 -0
- package/dist/src/skill/services/skill-market.service.d.ts.map +1 -0
- package/dist/src/skill/services/skill-market.service.js +228 -0
- package/dist/src/skill/services/skill-market.service.js.map +1 -0
- package/dist/src/skill/services/skill-registry.service.d.ts.map +1 -0
- package/dist/{skill → src/skill}/services/skill-registry.service.js +4 -4
- package/dist/src/skill/services/skill-registry.service.js.map +1 -0
- package/dist/{skill → src/skill}/types.d.ts +32 -1
- package/dist/src/skill/types.d.ts.map +1 -0
- package/dist/{cli → src/skill}/types.js.map +1 -1
- package/dist/src/workflow-design/DocumentExtractorAgent.d.ts +47 -0
- package/dist/src/workflow-design/DocumentExtractorAgent.d.ts.map +1 -0
- package/dist/src/workflow-design/DocumentExtractorAgent.js +118 -0
- package/dist/src/workflow-design/DocumentExtractorAgent.js.map +1 -0
- package/dist/src/workflow-design/N8nNodeKnowledgeBase.d.ts +26 -0
- package/dist/src/workflow-design/N8nNodeKnowledgeBase.d.ts.map +1 -0
- package/dist/src/workflow-design/N8nNodeKnowledgeBase.js +362 -0
- package/dist/src/workflow-design/N8nNodeKnowledgeBase.js.map +1 -0
- package/dist/src/workflow-design/OctoAgentClient.d.ts +42 -0
- package/dist/src/workflow-design/OctoAgentClient.d.ts.map +1 -0
- package/dist/src/workflow-design/OctoAgentClient.js +191 -0
- package/dist/src/workflow-design/OctoAgentClient.js.map +1 -0
- package/dist/src/workflow-design/WorkflowDesignOrchestrator.d.ts +45 -0
- package/dist/src/workflow-design/WorkflowDesignOrchestrator.d.ts.map +1 -0
- package/dist/src/workflow-design/WorkflowDesignOrchestrator.js +265 -0
- package/dist/src/workflow-design/WorkflowDesignOrchestrator.js.map +1 -0
- package/dist/src/workflow-design/agents/ActionChainAgent.d.ts +9 -0
- package/dist/src/workflow-design/agents/ActionChainAgent.d.ts.map +1 -0
- package/dist/src/workflow-design/agents/ActionChainAgent.js +79 -0
- package/dist/src/workflow-design/agents/ActionChainAgent.js.map +1 -0
- package/dist/src/workflow-design/agents/CodeScriptAgent.d.ts +15 -0
- package/dist/src/workflow-design/agents/CodeScriptAgent.d.ts.map +1 -0
- package/dist/src/workflow-design/agents/CodeScriptAgent.js +96 -0
- package/dist/src/workflow-design/agents/CodeScriptAgent.js.map +1 -0
- package/dist/src/workflow-design/agents/LogicFlowAgent.d.ts +9 -0
- package/dist/src/workflow-design/agents/LogicFlowAgent.d.ts.map +1 -0
- package/dist/src/workflow-design/agents/LogicFlowAgent.js +78 -0
- package/dist/src/workflow-design/agents/LogicFlowAgent.js.map +1 -0
- package/dist/src/workflow-design/agents/TriggerAnalystAgent.d.ts +9 -0
- package/dist/src/workflow-design/agents/TriggerAnalystAgent.d.ts.map +1 -0
- package/dist/src/workflow-design/agents/TriggerAnalystAgent.js +65 -0
- package/dist/src/workflow-design/agents/TriggerAnalystAgent.js.map +1 -0
- package/dist/src/workflow-design/agents/WorkflowValidatorAgent.d.ts +9 -0
- package/dist/src/workflow-design/agents/WorkflowValidatorAgent.d.ts.map +1 -0
- package/dist/src/workflow-design/agents/WorkflowValidatorAgent.js +117 -0
- package/dist/src/workflow-design/agents/WorkflowValidatorAgent.js.map +1 -0
- package/dist/src/workflow-design/index.d.ts +12 -0
- package/dist/src/workflow-design/index.d.ts.map +1 -0
- package/dist/src/workflow-design/index.js +23 -0
- package/dist/src/workflow-design/index.js.map +1 -0
- package/dist/src/workflow-design/types.d.ts +155 -0
- package/dist/src/workflow-design/types.d.ts.map +1 -0
- package/dist/src/workflow-design/types.js +6 -0
- package/dist/src/workflow-design/types.js.map +1 -0
- package/package.json +20 -14
- package/web/components/CreateWorkspaceDialog.tsx +157 -0
- package/web/components/DirBrowser.tsx +85 -0
- package/web/components/GithubTokenDialog.tsx +152 -0
- package/web/components/LocalPathSection.tsx +91 -0
- package/web/components/MarketInstallDialog.tsx +196 -0
- package/web/components/MarketSkillCard.tsx +74 -0
- package/web/components/RepoList.tsx +97 -0
- package/web/components/SearchResultsGrid.tsx +55 -0
- package/web/components/SkillCard.tsx +4 -1
- package/web/components/ToolCard.tsx +88 -0
- package/web/components/WorkspaceCard.tsx +146 -0
- package/web/components/WorkspaceItem.tsx +65 -0
- package/web/components/WorkspaceSelect.tsx +94 -0
- package/web/index.ts +18 -1
- package/web/manifest.ts +7 -0
- package/web/messages/en-US.json +231 -7
- package/web/messages/zh-CN.json +234 -7
- package/web/pages/AgentMarketPage.tsx +318 -0
- package/web/pages/AgentRunsPage.tsx +162 -0
- package/web/pages/AgentsPage.tsx +239 -0
- package/web/pages/AiCliToolsPage.tsx +17 -128
- package/web/pages/ApprovalsPage.tsx +260 -0
- package/web/pages/OrchestratorPage.tsx +384 -0
- package/web/pages/SessionsPage.tsx +248 -0
- package/web/pages/SkillMarketPage.tsx +25 -0
- package/web/pages/WorkspaceSection.tsx +13 -113
- package/web/pages/WorkspacesPage.tsx +29 -254
- package/web/services/agent-approval.service.ts +35 -0
- package/web/services/agent-gateway.service.ts +41 -0
- package/web/services/agent-run.service.ts +48 -0
- package/web/services/agent-session.service.ts +30 -0
- package/web/services/ai-cli-service.ts +33 -0
- package/web/services/external-agent.service.ts +38 -0
- package/web/services/orchestrator.service.ts +52 -0
- package/web/services/skill-market-service.ts +88 -0
- package/web/services/skill-service.ts +12 -0
- package/dist/ai.module.d.ts +0 -4
- package/dist/ai.module.d.ts.map +0 -1
- package/dist/ai.module.js +0 -59
- package/dist/ai.module.js.map +0 -1
- package/dist/cli/adapters/antigravity.adapter.d.ts.map +0 -1
- package/dist/cli/adapters/antigravity.adapter.js.map +0 -1
- package/dist/cli/adapters/claude-cli.adapter.d.ts.map +0 -1
- package/dist/cli/adapters/claude-cli.adapter.js.map +0 -1
- package/dist/cli/adapters/codex-cli.adapter.d.ts.map +0 -1
- package/dist/cli/adapters/codex-cli.adapter.js.map +0 -1
- package/dist/cli/adapters/detect-cli.d.ts.map +0 -1
- package/dist/cli/adapters/detect-cli.js.map +0 -1
- package/dist/cli/adapters/gemini-cli.adapter.d.ts.map +0 -1
- package/dist/cli/adapters/gemini-cli.adapter.js.map +0 -1
- package/dist/cli/adapters/index.d.ts.map +0 -1
- package/dist/cli/adapters/index.js.map +0 -1
- package/dist/cli/cli-executor.service.d.ts.map +0 -1
- package/dist/cli/cli-executor.service.js.map +0 -1
- package/dist/cli/cli-registry.service.d.ts.map +0 -1
- package/dist/cli/cli-registry.service.js.map +0 -1
- package/dist/cli/controllers/ai-cli.controller.d.ts.map +0 -1
- package/dist/cli/controllers/ai-cli.controller.js.map +0 -1
- package/dist/cli/index.d.ts.map +0 -1
- package/dist/cli/index.js.map +0 -1
- package/dist/cli/types.d.ts.map +0 -1
- package/dist/cli/workspace.service.d.ts.map +0 -1
- package/dist/cli/workspace.service.js.map +0 -1
- package/dist/index.d.ts +0 -5
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -23
- package/dist/index.js.map +0 -1
- package/dist/skill/controllers/skill.controller.d.ts.map +0 -1
- package/dist/skill/controllers/skill.controller.js.map +0 -1
- package/dist/skill/entities/octo-skill.entity.d.ts.map +0 -1
- package/dist/skill/entities/octo-skill.entity.js.map +0 -1
- package/dist/skill/index.d.ts.map +0 -1
- package/dist/skill/index.js.map +0 -1
- package/dist/skill/services/skill-generator.service.d.ts.map +0 -1
- package/dist/skill/services/skill-generator.service.js.map +0 -1
- package/dist/skill/services/skill-installer.service.d.ts.map +0 -1
- package/dist/skill/services/skill-installer.service.js.map +0 -1
- package/dist/skill/services/skill-registry.service.d.ts.map +0 -1
- package/dist/skill/services/skill-registry.service.js.map +0 -1
- package/dist/skill/types.d.ts.map +0 -1
- /package/dist/{cli → src/cli}/adapters/claude-cli.adapter.d.ts +0 -0
- /package/dist/{cli → src/cli}/adapters/codex-cli.adapter.d.ts +0 -0
- /package/dist/{cli → src/cli}/adapters/codex-cli.adapter.js +0 -0
- /package/dist/{cli → src/cli}/adapters/detect-cli.d.ts +0 -0
- /package/dist/{cli → src/cli}/adapters/detect-cli.js +0 -0
- /package/dist/{cli → src/cli}/adapters/gemini-cli.adapter.d.ts +0 -0
- /package/dist/{cli → src/cli}/adapters/gemini-cli.adapter.js +0 -0
- /package/dist/{cli → src/cli}/adapters/index.d.ts +0 -0
- /package/dist/{cli → src/cli}/adapters/index.js +0 -0
- /package/dist/{cli → src/cli}/cli-registry.service.d.ts +0 -0
- /package/dist/{cli → src/cli}/index.js +0 -0
- /package/dist/{cli → src/cli}/types.js +0 -0
- /package/dist/{skill → src/skill}/entities/octo-skill.entity.d.ts +0 -0
- /package/dist/{skill → src/skill}/entities/octo-skill.entity.js +0 -0
- /package/dist/{skill → src/skill}/services/skill-generator.service.d.ts +0 -0
- /package/dist/{skill → src/skill}/services/skill-generator.service.js +0 -0
- /package/dist/{skill → src/skill}/services/skill-registry.service.d.ts +0 -0
- /package/dist/{skill → src/skill}/types.js +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/workflow-design/types.ts"],"names":[],"mappings":";AAAA,+DAA+D;AAC/D,uBAAuB;AACvB,+DAA+D"}
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@octo-cyber/ai",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.6",
|
|
4
4
|
"description": "Octo AI module — Agent + Capability + SyncBridge + client registration",
|
|
5
|
-
"main": "dist/index.js",
|
|
6
|
-
"types": "dist/index.d.ts",
|
|
5
|
+
"main": "dist/src/index.js",
|
|
6
|
+
"types": "dist/src/index.d.ts",
|
|
7
7
|
"exports": {
|
|
8
8
|
".": {
|
|
9
|
-
"types": "./dist/index.d.ts",
|
|
10
|
-
"import": "./dist/index.js",
|
|
11
|
-
"default": "./dist/index.js"
|
|
9
|
+
"types": "./dist/src/index.d.ts",
|
|
10
|
+
"import": "./dist/src/index.js",
|
|
11
|
+
"default": "./dist/src/index.js"
|
|
12
12
|
},
|
|
13
13
|
"./web": {
|
|
14
14
|
"types": "./web/index.ts",
|
|
@@ -22,22 +22,27 @@
|
|
|
22
22
|
}
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@
|
|
25
|
+
"@anthropic-ai/sdk": "^0.80.0",
|
|
26
|
+
"node-screenshots": "^0.2.8",
|
|
26
27
|
"@octo-cyber/auth": "^0.5.6",
|
|
28
|
+
"@octo-cyber/core": "^0.5.4",
|
|
27
29
|
"@octo-cyber/task": "^0.5.3"
|
|
28
30
|
},
|
|
31
|
+
"optionalDependencies": {
|
|
32
|
+
"@nut-tree/nut-js": "^4.2.0"
|
|
33
|
+
},
|
|
29
34
|
"peerDependencies": {
|
|
30
|
-
"
|
|
31
|
-
"react-
|
|
35
|
+
"@hookform/resolvers": "^5.0.0",
|
|
36
|
+
"@tanstack/react-table": "^8.0.0",
|
|
37
|
+
"lucide-react": ">=0.400.0",
|
|
32
38
|
"next": "^16.0.0",
|
|
33
39
|
"next-intl": "^4.0.0",
|
|
34
|
-
"
|
|
40
|
+
"react": "^19.0.0",
|
|
41
|
+
"react-dom": "^19.0.0",
|
|
35
42
|
"react-hook-form": "^7.0.0",
|
|
36
|
-
"@hookform/resolvers": "^5.0.0",
|
|
37
|
-
"@tanstack/react-table": "^8.0.0",
|
|
38
|
-
"zod": "^3.0.0",
|
|
39
43
|
"sonner": "^2.0.0",
|
|
40
|
-
"
|
|
44
|
+
"zod": "^3.0.0",
|
|
45
|
+
"@octo-cyber/ui": "^0.5.3"
|
|
41
46
|
},
|
|
42
47
|
"peerDependenciesMeta": {
|
|
43
48
|
"@octo-cyber/ui": {
|
|
@@ -75,6 +80,7 @@
|
|
|
75
80
|
}
|
|
76
81
|
},
|
|
77
82
|
"devDependencies": {
|
|
83
|
+
"@types/node": "^22.0.0",
|
|
78
84
|
"@types/react": "^19",
|
|
79
85
|
"@types/react-dom": "^19",
|
|
80
86
|
"typescript": "^5.8.0",
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import { useState } from 'react'
|
|
4
|
+
import { useTranslations } from 'next-intl'
|
|
5
|
+
import { toast } from 'sonner'
|
|
6
|
+
import { FolderOpen, Github, Loader2 } from 'lucide-react'
|
|
7
|
+
|
|
8
|
+
import { Button } from '@octo-cyber/ui/components/ui/button'
|
|
9
|
+
import { Input } from '@octo-cyber/ui/components/ui/input'
|
|
10
|
+
import { Label } from '@octo-cyber/ui/components/ui/label'
|
|
11
|
+
import { Textarea } from '@octo-cyber/ui/components/ui/textarea'
|
|
12
|
+
import {
|
|
13
|
+
Dialog, DialogContent, DialogHeader, DialogTitle, DialogDescription, DialogFooter,
|
|
14
|
+
} from '@octo-cyber/ui/components/ui/dialog'
|
|
15
|
+
import { Tabs, TabsList, TabsTrigger } from '@octo-cyber/ui/components/ui/tabs'
|
|
16
|
+
import { aiCliService } from '../services/ai-cli-service'
|
|
17
|
+
import type { DetectedGitInfo } from '../services/ai-cli-service'
|
|
18
|
+
import { LocalPathSection } from './LocalPathSection'
|
|
19
|
+
|
|
20
|
+
type WorkspaceType = 'local' | 'github'
|
|
21
|
+
|
|
22
|
+
export function CreateWorkspaceDialog({
|
|
23
|
+
open,
|
|
24
|
+
onOpenChange,
|
|
25
|
+
onCreated,
|
|
26
|
+
}: {
|
|
27
|
+
open: boolean
|
|
28
|
+
onOpenChange: (open: boolean) => void
|
|
29
|
+
onCreated: () => void
|
|
30
|
+
}) {
|
|
31
|
+
const t = useTranslations('aiCli.workspaces')
|
|
32
|
+
const tc = useTranslations('common')
|
|
33
|
+
|
|
34
|
+
const [createType, setCreateType] = useState<WorkspaceType>('local')
|
|
35
|
+
const [createName, setCreateName] = useState('')
|
|
36
|
+
const [createDescription, setCreateDescription] = useState('')
|
|
37
|
+
const [createLocalPath, setCreateLocalPath] = useState('')
|
|
38
|
+
const [createRepoUrl, setCreateRepoUrl] = useState('')
|
|
39
|
+
const [createBranch, setCreateBranch] = useState('')
|
|
40
|
+
const [detectedGitInfo, setDetectedGitInfo] = useState<DetectedGitInfo | null>(null)
|
|
41
|
+
const [isCreating, setIsCreating] = useState(false)
|
|
42
|
+
|
|
43
|
+
const resetForm = () => {
|
|
44
|
+
setCreateType('local')
|
|
45
|
+
setCreateName('')
|
|
46
|
+
setCreateDescription('')
|
|
47
|
+
setCreateLocalPath('')
|
|
48
|
+
setCreateRepoUrl('')
|
|
49
|
+
setCreateBranch('')
|
|
50
|
+
setDetectedGitInfo(null)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const handleDirSelected = (path: string, suggestedName: string, gitInfo: DetectedGitInfo | null) => {
|
|
54
|
+
if (!createName.trim()) setCreateName(suggestedName)
|
|
55
|
+
setDetectedGitInfo(gitInfo)
|
|
56
|
+
if (gitInfo?.isGitRepo && gitInfo.remoteUrl) setCreateRepoUrl(gitInfo.remoteUrl)
|
|
57
|
+
if (gitInfo?.isGitRepo && gitInfo.branch) setCreateBranch(gitInfo.branch)
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const handleCreate = async () => {
|
|
61
|
+
if (!createName.trim()) return
|
|
62
|
+
setIsCreating(true)
|
|
63
|
+
try {
|
|
64
|
+
if (createType === 'local') {
|
|
65
|
+
if (!createLocalPath.trim()) return
|
|
66
|
+
await aiCliService.createWorkspace({
|
|
67
|
+
type: 'local', name: createName.trim(),
|
|
68
|
+
description: createDescription.trim() || undefined,
|
|
69
|
+
localPath: createLocalPath.trim(),
|
|
70
|
+
repoUrl: detectedGitInfo?.remoteUrl || undefined,
|
|
71
|
+
branch: detectedGitInfo?.branch || undefined,
|
|
72
|
+
})
|
|
73
|
+
} else {
|
|
74
|
+
if (!createRepoUrl.trim() || !createBranch.trim()) return
|
|
75
|
+
await aiCliService.createWorkspace({
|
|
76
|
+
type: 'github', name: createName.trim(),
|
|
77
|
+
description: createDescription.trim() || undefined,
|
|
78
|
+
repoUrl: createRepoUrl.trim(),
|
|
79
|
+
branch: createBranch.trim(),
|
|
80
|
+
})
|
|
81
|
+
}
|
|
82
|
+
onOpenChange(false)
|
|
83
|
+
resetForm()
|
|
84
|
+
onCreated()
|
|
85
|
+
} catch {
|
|
86
|
+
toast.error(t('toast.createFailed'))
|
|
87
|
+
} finally {
|
|
88
|
+
setIsCreating(false)
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
const isValid = createName.trim() !== '' && (
|
|
93
|
+
createType === 'local'
|
|
94
|
+
? createLocalPath.trim() !== ''
|
|
95
|
+
: createRepoUrl.trim() !== '' && createBranch.trim() !== ''
|
|
96
|
+
)
|
|
97
|
+
|
|
98
|
+
const handleOpenChange = (nextOpen: boolean) => {
|
|
99
|
+
if (!nextOpen) resetForm()
|
|
100
|
+
onOpenChange(nextOpen)
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
return (
|
|
104
|
+
<Dialog open={open} onOpenChange={handleOpenChange}>
|
|
105
|
+
<DialogContent className="sm:max-w-lg">
|
|
106
|
+
<DialogHeader>
|
|
107
|
+
<DialogTitle>{t('createDialog.title')}</DialogTitle>
|
|
108
|
+
<DialogDescription>{t('createDialog.description')}</DialogDescription>
|
|
109
|
+
</DialogHeader>
|
|
110
|
+
<div className="space-y-4">
|
|
111
|
+
<Tabs value={createType} onValueChange={(v) => setCreateType(v as WorkspaceType)}>
|
|
112
|
+
<TabsList className="grid w-full grid-cols-2">
|
|
113
|
+
<TabsTrigger value="local"><FolderOpen className="mr-1 h-3 w-3" />{t('createDialog.typeLocal')}</TabsTrigger>
|
|
114
|
+
<TabsTrigger value="github"><Github className="mr-1 h-3 w-3" />{t('createDialog.typeGithub')}</TabsTrigger>
|
|
115
|
+
</TabsList>
|
|
116
|
+
</Tabs>
|
|
117
|
+
|
|
118
|
+
{createType === 'local' ? (
|
|
119
|
+
<LocalPathSection
|
|
120
|
+
localPath={createLocalPath}
|
|
121
|
+
onLocalPathChange={setCreateLocalPath}
|
|
122
|
+
onDirSelected={handleDirSelected}
|
|
123
|
+
t={t}
|
|
124
|
+
/>
|
|
125
|
+
) : (
|
|
126
|
+
<>
|
|
127
|
+
<div className="space-y-2">
|
|
128
|
+
<Label>{t('createDialog.repoUrlLabel')}</Label>
|
|
129
|
+
<Input placeholder={t('createDialog.repoUrlPlaceholder')} value={createRepoUrl} onChange={(e) => setCreateRepoUrl(e.target.value)} />
|
|
130
|
+
</div>
|
|
131
|
+
<div className="space-y-2">
|
|
132
|
+
<Label>{t('createDialog.branchLabel')}</Label>
|
|
133
|
+
<Input placeholder={t('createDialog.branchPlaceholder')} value={createBranch} onChange={(e) => setCreateBranch(e.target.value)} />
|
|
134
|
+
</div>
|
|
135
|
+
</>
|
|
136
|
+
)}
|
|
137
|
+
|
|
138
|
+
<div className="space-y-2">
|
|
139
|
+
<Label>{t('createDialog.nameLabel')}</Label>
|
|
140
|
+
<Input placeholder={t('createDialog.namePlaceholder')} value={createName} onChange={(e) => setCreateName(e.target.value)} />
|
|
141
|
+
</div>
|
|
142
|
+
<div className="space-y-2">
|
|
143
|
+
<Label>{t('createDialog.descriptionLabel')}</Label>
|
|
144
|
+
<Textarea placeholder={t('createDialog.descriptionPlaceholder')} value={createDescription} onChange={(e) => setCreateDescription(e.target.value)} rows={2} />
|
|
145
|
+
</div>
|
|
146
|
+
</div>
|
|
147
|
+
<DialogFooter>
|
|
148
|
+
<Button variant="outline" onClick={() => handleOpenChange(false)}>{tc('cancel')}</Button>
|
|
149
|
+
<Button onClick={handleCreate} disabled={isCreating || !isValid}>
|
|
150
|
+
{isCreating && <Loader2 className="mr-1 h-3 w-3 animate-spin" />}
|
|
151
|
+
{tc('create')}
|
|
152
|
+
</Button>
|
|
153
|
+
</DialogFooter>
|
|
154
|
+
</DialogContent>
|
|
155
|
+
</Dialog>
|
|
156
|
+
)
|
|
157
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import { useState, useEffect, useCallback } from 'react'
|
|
4
|
+
import { useTranslations } from 'next-intl'
|
|
5
|
+
import { FolderOpen, ChevronUp, Check, Loader2 } from 'lucide-react'
|
|
6
|
+
|
|
7
|
+
import { Button } from '@octo-cyber/ui/components/ui/button'
|
|
8
|
+
import { aiCliService } from '../services/ai-cli-service'
|
|
9
|
+
import type { DirEntry } from '../services/ai-cli-service'
|
|
10
|
+
|
|
11
|
+
export function DirBrowser({
|
|
12
|
+
onSelect,
|
|
13
|
+
initialPath = '/',
|
|
14
|
+
}: {
|
|
15
|
+
onSelect: (path: string) => void
|
|
16
|
+
initialPath?: string
|
|
17
|
+
}) {
|
|
18
|
+
const t = useTranslations('aiCli.workspaces.createDialog')
|
|
19
|
+
const [currentPath, setCurrentPath] = useState(initialPath)
|
|
20
|
+
const [entries, setEntries] = useState<DirEntry[]>([])
|
|
21
|
+
const [loading, setLoading] = useState(false)
|
|
22
|
+
|
|
23
|
+
const loadDir = useCallback(async (dirPath: string) => {
|
|
24
|
+
setLoading(true)
|
|
25
|
+
try {
|
|
26
|
+
const data = await aiCliService.browseDir(dirPath)
|
|
27
|
+
setEntries(data)
|
|
28
|
+
setCurrentPath(dirPath)
|
|
29
|
+
} catch {
|
|
30
|
+
setEntries([])
|
|
31
|
+
} finally {
|
|
32
|
+
setLoading(false)
|
|
33
|
+
}
|
|
34
|
+
}, [])
|
|
35
|
+
|
|
36
|
+
useEffect(() => {
|
|
37
|
+
loadDir(initialPath)
|
|
38
|
+
}, [initialPath, loadDir])
|
|
39
|
+
|
|
40
|
+
const goUp = () => {
|
|
41
|
+
const parent = currentPath.replace(/\/[^/]+\/?$/, '') || '/'
|
|
42
|
+
loadDir(parent)
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return (
|
|
46
|
+
<div className="border rounded-md">
|
|
47
|
+
<div className="flex items-center gap-1 p-2 border-b bg-muted/50">
|
|
48
|
+
<Button variant="ghost" size="sm" className="h-7 px-2" onClick={goUp}>
|
|
49
|
+
<ChevronUp className="h-3 w-3 mr-1" />
|
|
50
|
+
{t('parentDir')}
|
|
51
|
+
</Button>
|
|
52
|
+
<span className="text-xs text-muted-foreground truncate flex-1" title={currentPath}>
|
|
53
|
+
{currentPath}
|
|
54
|
+
</span>
|
|
55
|
+
<Button size="sm" className="h-7" onClick={() => onSelect(currentPath)}>
|
|
56
|
+
<Check className="h-3 w-3 mr-1" />
|
|
57
|
+
{t('selectThisDir')}
|
|
58
|
+
</Button>
|
|
59
|
+
</div>
|
|
60
|
+
<div className="max-h-48 overflow-y-auto">
|
|
61
|
+
{loading ? (
|
|
62
|
+
<div className="flex items-center justify-center py-6">
|
|
63
|
+
<Loader2 className="h-4 w-4 animate-spin text-muted-foreground" />
|
|
64
|
+
</div>
|
|
65
|
+
) : entries.length === 0 ? (
|
|
66
|
+
<div className="flex items-center justify-center py-6">
|
|
67
|
+
<p className="text-xs text-muted-foreground">{t('emptyDir')}</p>
|
|
68
|
+
</div>
|
|
69
|
+
) : (
|
|
70
|
+
entries.map((entry) => (
|
|
71
|
+
<button
|
|
72
|
+
key={entry.path}
|
|
73
|
+
type="button"
|
|
74
|
+
className="flex items-center gap-2 w-full px-3 py-1.5 text-left text-sm hover:bg-accent transition-colors"
|
|
75
|
+
onClick={() => loadDir(entry.path)}
|
|
76
|
+
>
|
|
77
|
+
<FolderOpen className="h-3.5 w-3.5 text-muted-foreground shrink-0" />
|
|
78
|
+
<span className="truncate">{entry.name}</span>
|
|
79
|
+
</button>
|
|
80
|
+
))
|
|
81
|
+
)}
|
|
82
|
+
</div>
|
|
83
|
+
</div>
|
|
84
|
+
)
|
|
85
|
+
}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import { useState, useEffect } from 'react'
|
|
4
|
+
import { useTranslations } from 'next-intl'
|
|
5
|
+
import { toast } from 'sonner'
|
|
6
|
+
import { Loader2, AlertTriangle, CheckCircle2 } from 'lucide-react'
|
|
7
|
+
|
|
8
|
+
import { Button } from '@octo-cyber/ui/components/ui/button'
|
|
9
|
+
import { Input } from '@octo-cyber/ui/components/ui/input'
|
|
10
|
+
import { Label } from '@octo-cyber/ui/components/ui/label'
|
|
11
|
+
import { Badge } from '@octo-cyber/ui/components/ui/badge'
|
|
12
|
+
import {
|
|
13
|
+
Dialog,
|
|
14
|
+
DialogContent,
|
|
15
|
+
DialogHeader,
|
|
16
|
+
DialogTitle,
|
|
17
|
+
DialogDescription,
|
|
18
|
+
DialogFooter,
|
|
19
|
+
} from '@octo-cyber/ui/components/ui/dialog'
|
|
20
|
+
import { skillMarketService } from '../services/skill-market-service'
|
|
21
|
+
import type { GithubTokenStatus } from '../services/skill-market-service'
|
|
22
|
+
|
|
23
|
+
export function GithubTokenDialog({
|
|
24
|
+
open,
|
|
25
|
+
onOpenChange,
|
|
26
|
+
}: {
|
|
27
|
+
open: boolean
|
|
28
|
+
onOpenChange: (open: boolean) => void
|
|
29
|
+
}) {
|
|
30
|
+
const t = useTranslations('aiSkillMarket.tokenConfig')
|
|
31
|
+
const tc = useTranslations('common')
|
|
32
|
+
|
|
33
|
+
const [status, setStatus] = useState<GithubTokenStatus | null>(null)
|
|
34
|
+
const [tokenInput, setTokenInput] = useState('')
|
|
35
|
+
const [loading, setLoading] = useState(false)
|
|
36
|
+
const [saving, setSaving] = useState(false)
|
|
37
|
+
|
|
38
|
+
useEffect(() => {
|
|
39
|
+
if (!open) return
|
|
40
|
+
setLoading(true)
|
|
41
|
+
skillMarketService.getTokenStatus()
|
|
42
|
+
.then(setStatus)
|
|
43
|
+
.catch(() => setStatus(null))
|
|
44
|
+
.finally(() => setLoading(false))
|
|
45
|
+
}, [open])
|
|
46
|
+
|
|
47
|
+
const handleSave = async () => {
|
|
48
|
+
if (!tokenInput.trim()) return
|
|
49
|
+
setSaving(true)
|
|
50
|
+
try {
|
|
51
|
+
const newStatus = await skillMarketService.setToken(tokenInput.trim())
|
|
52
|
+
setStatus(newStatus)
|
|
53
|
+
setTokenInput('')
|
|
54
|
+
toast.success(t('saved'))
|
|
55
|
+
} catch {
|
|
56
|
+
toast.error(t('saveFailed'))
|
|
57
|
+
} finally {
|
|
58
|
+
setSaving(false)
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const handleClear = async () => {
|
|
63
|
+
setSaving(true)
|
|
64
|
+
try {
|
|
65
|
+
const newStatus = await skillMarketService.clearToken()
|
|
66
|
+
setStatus(newStatus)
|
|
67
|
+
setTokenInput('')
|
|
68
|
+
toast.success(t('cleared'))
|
|
69
|
+
} catch {
|
|
70
|
+
toast.error(t('saveFailed'))
|
|
71
|
+
} finally {
|
|
72
|
+
setSaving(false)
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return (
|
|
77
|
+
<Dialog open={open} onOpenChange={onOpenChange}>
|
|
78
|
+
<DialogContent className="sm:max-w-md">
|
|
79
|
+
<DialogHeader>
|
|
80
|
+
<DialogTitle>{t('title')}</DialogTitle>
|
|
81
|
+
<DialogDescription>{t('description')}</DialogDescription>
|
|
82
|
+
</DialogHeader>
|
|
83
|
+
|
|
84
|
+
{loading ? (
|
|
85
|
+
<div className="flex items-center justify-center py-6">
|
|
86
|
+
<Loader2 className="h-5 w-5 animate-spin text-muted-foreground" />
|
|
87
|
+
</div>
|
|
88
|
+
) : (
|
|
89
|
+
<div className="space-y-4">
|
|
90
|
+
{/* Current status */}
|
|
91
|
+
{status?.hasToken ? (
|
|
92
|
+
<div className="flex items-center gap-2 rounded-md border p-3 bg-muted/30">
|
|
93
|
+
<CheckCircle2 className="h-4 w-4 text-green-500 shrink-0" />
|
|
94
|
+
<div className="flex-1 min-w-0">
|
|
95
|
+
<p className="text-sm font-medium">{t('currentToken')}</p>
|
|
96
|
+
<p className="text-xs text-muted-foreground font-mono truncate">
|
|
97
|
+
{status.maskedToken}
|
|
98
|
+
</p>
|
|
99
|
+
</div>
|
|
100
|
+
<Badge variant="outline" className="text-xs shrink-0">
|
|
101
|
+
{status.source === 'env' ? t('sourceEnv') : t('sourceConfig')}
|
|
102
|
+
</Badge>
|
|
103
|
+
</div>
|
|
104
|
+
) : (
|
|
105
|
+
<div className="flex items-start gap-2 rounded-md border border-yellow-500/30 p-3 bg-yellow-500/5">
|
|
106
|
+
<AlertTriangle className="h-4 w-4 text-yellow-500 shrink-0 mt-0.5" />
|
|
107
|
+
<div>
|
|
108
|
+
<p className="text-sm font-medium">{t('noToken')}</p>
|
|
109
|
+
<p className="text-xs text-muted-foreground">{t('noTokenHint')}</p>
|
|
110
|
+
</div>
|
|
111
|
+
</div>
|
|
112
|
+
)}
|
|
113
|
+
|
|
114
|
+
{/* Token input */}
|
|
115
|
+
<div className="space-y-2">
|
|
116
|
+
<Label>{t('inputLabel')}</Label>
|
|
117
|
+
<Input
|
|
118
|
+
type="password"
|
|
119
|
+
placeholder={t('inputPlaceholder')}
|
|
120
|
+
value={tokenInput}
|
|
121
|
+
onChange={(e) => setTokenInput(e.target.value)}
|
|
122
|
+
/>
|
|
123
|
+
</div>
|
|
124
|
+
</div>
|
|
125
|
+
)}
|
|
126
|
+
|
|
127
|
+
<DialogFooter className="gap-2">
|
|
128
|
+
{status?.hasToken && status.source === 'config' && (
|
|
129
|
+
<Button
|
|
130
|
+
variant="outline"
|
|
131
|
+
onClick={handleClear}
|
|
132
|
+
disabled={saving}
|
|
133
|
+
className="text-destructive hover:text-destructive"
|
|
134
|
+
>
|
|
135
|
+
{t('clear')}
|
|
136
|
+
</Button>
|
|
137
|
+
)}
|
|
138
|
+
<Button variant="outline" onClick={() => onOpenChange(false)}>
|
|
139
|
+
{tc('cancel')}
|
|
140
|
+
</Button>
|
|
141
|
+
<Button
|
|
142
|
+
onClick={handleSave}
|
|
143
|
+
disabled={saving || !tokenInput.trim()}
|
|
144
|
+
>
|
|
145
|
+
{saving && <Loader2 className="mr-1 h-3 w-3 animate-spin" />}
|
|
146
|
+
{t('save')}
|
|
147
|
+
</Button>
|
|
148
|
+
</DialogFooter>
|
|
149
|
+
</DialogContent>
|
|
150
|
+
</Dialog>
|
|
151
|
+
)
|
|
152
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import { useState } from 'react'
|
|
4
|
+
import { Search, Loader2, GitBranch } from 'lucide-react'
|
|
5
|
+
import { useTranslations } from 'next-intl'
|
|
6
|
+
import { Button } from '@octo-cyber/ui/components/ui/button'
|
|
7
|
+
import { Badge } from '@octo-cyber/ui/components/ui/badge'
|
|
8
|
+
import { Input } from '@octo-cyber/ui/components/ui/input'
|
|
9
|
+
import { Label } from '@octo-cyber/ui/components/ui/label'
|
|
10
|
+
import { aiCliService } from '../services/ai-cli-service'
|
|
11
|
+
import type { DetectedGitInfo } from '../services/ai-cli-service'
|
|
12
|
+
import { DirBrowser } from './DirBrowser'
|
|
13
|
+
|
|
14
|
+
interface LocalPathSectionProps {
|
|
15
|
+
localPath: string
|
|
16
|
+
onLocalPathChange: (path: string) => void
|
|
17
|
+
onDirSelected: (path: string, suggestedName: string, gitInfo: DetectedGitInfo | null) => void
|
|
18
|
+
t: ReturnType<typeof useTranslations>
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function LocalPathSection({ localPath, onLocalPathChange, onDirSelected, t }: LocalPathSectionProps) {
|
|
22
|
+
const [showBrowser, setShowBrowser] = useState(false)
|
|
23
|
+
const [gitInfo, setGitInfo] = useState<DetectedGitInfo | null>(null)
|
|
24
|
+
const [isDetectingGit, setIsDetectingGit] = useState(false)
|
|
25
|
+
|
|
26
|
+
const handleDirSelect = async (dirPath: string) => {
|
|
27
|
+
onLocalPathChange(dirPath)
|
|
28
|
+
setShowBrowser(false)
|
|
29
|
+
const suggestedName = dirPath.split('/').filter(Boolean).pop() || ''
|
|
30
|
+
setIsDetectingGit(true)
|
|
31
|
+
setGitInfo(null)
|
|
32
|
+
let detected: DetectedGitInfo | null = null
|
|
33
|
+
try {
|
|
34
|
+
detected = await aiCliService.detectGit(dirPath)
|
|
35
|
+
setGitInfo(detected)
|
|
36
|
+
} catch {
|
|
37
|
+
detected = null
|
|
38
|
+
} finally {
|
|
39
|
+
setIsDetectingGit(false)
|
|
40
|
+
}
|
|
41
|
+
onDirSelected(dirPath, suggestedName, detected)
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return (
|
|
45
|
+
<>
|
|
46
|
+
<div className="space-y-2">
|
|
47
|
+
<Label>{t('createDialog.localPathLabel')}</Label>
|
|
48
|
+
<div className="flex gap-2">
|
|
49
|
+
<Input
|
|
50
|
+
className="flex-1"
|
|
51
|
+
placeholder={t('createDialog.localPathPlaceholder')}
|
|
52
|
+
value={localPath}
|
|
53
|
+
onChange={(e) => onLocalPathChange(e.target.value)}
|
|
54
|
+
/>
|
|
55
|
+
<Button type="button" variant="outline" size="sm" onClick={() => setShowBrowser(!showBrowser)}>
|
|
56
|
+
<Search className="h-3 w-3 mr-1" />
|
|
57
|
+
{t('createDialog.browse')}
|
|
58
|
+
</Button>
|
|
59
|
+
</div>
|
|
60
|
+
{showBrowser && (
|
|
61
|
+
<DirBrowser initialPath={localPath || '/'} onSelect={handleDirSelect} />
|
|
62
|
+
)}
|
|
63
|
+
</div>
|
|
64
|
+
{(isDetectingGit || gitInfo) && (
|
|
65
|
+
<div className="flex items-center gap-2 text-xs">
|
|
66
|
+
{isDetectingGit ? (
|
|
67
|
+
<>
|
|
68
|
+
<Loader2 className="h-3 w-3 animate-spin text-muted-foreground" />
|
|
69
|
+
<span className="text-muted-foreground">{t('createDialog.detecting')}</span>
|
|
70
|
+
</>
|
|
71
|
+
) : gitInfo?.isGitRepo ? (
|
|
72
|
+
<>
|
|
73
|
+
<GitBranch className="h-3 w-3 text-green-500" />
|
|
74
|
+
<span className="text-green-600 dark:text-green-400">{t('createDialog.gitDetected')}</span>
|
|
75
|
+
{gitInfo.remoteUrl && (
|
|
76
|
+
<span className="text-muted-foreground truncate" title={gitInfo.remoteUrl}>
|
|
77
|
+
{gitInfo.remoteUrl}
|
|
78
|
+
</span>
|
|
79
|
+
)}
|
|
80
|
+
{gitInfo.branch && (
|
|
81
|
+
<Badge variant="outline" className="text-xs">{gitInfo.branch}</Badge>
|
|
82
|
+
)}
|
|
83
|
+
</>
|
|
84
|
+
) : (
|
|
85
|
+
<span className="text-muted-foreground">{t('createDialog.gitNotDetected')}</span>
|
|
86
|
+
)}
|
|
87
|
+
</div>
|
|
88
|
+
)}
|
|
89
|
+
</>
|
|
90
|
+
)
|
|
91
|
+
}
|