@akiojin/gwt 4.9.0 → 4.9.1
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/README.ja.md +58 -34
- package/README.md +18 -34
- package/dist/cli/ui/components/App.d.ts +2 -2
- package/dist/cli/ui/components/App.d.ts.map +1 -1
- package/dist/cli/ui/components/App.js +8 -8
- package/dist/cli/ui/components/App.js.map +1 -1
- package/dist/cli/ui/components/screens/CodingAgentSelectorScreen.d.ts +27 -0
- package/dist/cli/ui/components/screens/CodingAgentSelectorScreen.d.ts.map +1 -0
- package/dist/cli/ui/components/screens/{AIToolSelectorScreen.js → CodingAgentSelectorScreen.js} +35 -35
- package/dist/cli/ui/components/screens/CodingAgentSelectorScreen.js.map +1 -0
- package/dist/cli/ui/components/screens/ModelSelectorScreen.d.ts +2 -2
- package/dist/cli/ui/components/screens/ModelSelectorScreen.d.ts.map +1 -1
- package/dist/cli/ui/components/screens/ModelSelectorScreen.js.map +1 -1
- package/dist/cli/ui/types.d.ts +2 -2
- package/dist/cli/ui/types.d.ts.map +1 -1
- package/dist/cli/ui/utils/modelOptions.d.ts +4 -4
- package/dist/cli/ui/utils/modelOptions.d.ts.map +1 -1
- package/dist/cli/ui/utils/modelOptions.js.map +1 -1
- package/dist/client/assets/{index-PqK9jkug.js → index-LNPtOrn3.js} +17 -17
- package/dist/client/index.html +1 -1
- package/dist/config/builtin-coding-agents.d.ts +23 -0
- package/dist/config/builtin-coding-agents.d.ts.map +1 -0
- package/dist/config/{builtin-tools.js → builtin-coding-agents.js} +6 -6
- package/dist/config/builtin-coding-agents.js.map +1 -0
- package/dist/config/tools.d.ts +16 -16
- package/dist/config/tools.d.ts.map +1 -1
- package/dist/config/tools.js +81 -78
- package/dist/config/tools.js.map +1 -1
- package/dist/index.js +19 -19
- package/dist/index.js.map +1 -1
- package/dist/launcher.d.ts +8 -8
- package/dist/launcher.d.ts.map +1 -1
- package/dist/launcher.js +32 -28
- package/dist/launcher.js.map +1 -1
- package/dist/services/codingAgentCommandResolver.d.ts +10 -0
- package/dist/services/codingAgentCommandResolver.d.ts.map +1 -0
- package/dist/services/{customToolResolver.js → codingAgentCommandResolver.js} +25 -20
- package/dist/services/codingAgentCommandResolver.js.map +1 -0
- package/dist/services/{aiToolResolver.d.ts → codingAgentResolver.d.ts} +6 -6
- package/dist/services/codingAgentResolver.d.ts.map +1 -0
- package/dist/services/{aiToolResolver.js → codingAgentResolver.js} +23 -23
- package/dist/services/codingAgentResolver.js.map +1 -0
- package/dist/shared/{aiToolConstants.d.ts → codingAgentConstants.d.ts} +2 -2
- package/dist/shared/codingAgentConstants.d.ts.map +1 -0
- package/dist/shared/{aiToolConstants.js → codingAgentConstants.js} +2 -2
- package/dist/shared/codingAgentConstants.js.map +1 -0
- package/dist/types/api.d.ts +12 -12
- package/dist/types/api.d.ts.map +1 -1
- package/dist/types/tools.d.ts +30 -30
- package/dist/types/tools.d.ts.map +1 -1
- package/dist/types/tools.js +1 -1
- package/dist/web/client/src/components/CodingAgentLaunchModal.d.ts +9 -0
- package/dist/web/client/src/components/CodingAgentLaunchModal.d.ts.map +1 -0
- package/dist/web/client/src/components/{AIToolLaunchModal.js → CodingAgentLaunchModal.js} +58 -58
- package/dist/web/client/src/components/CodingAgentLaunchModal.js.map +1 -0
- package/dist/web/client/src/components/CustomCodingAgentForm.d.ts +23 -0
- package/dist/web/client/src/components/CustomCodingAgentForm.d.ts.map +1 -0
- package/dist/web/client/src/components/{CustomToolForm.js → CustomCodingAgentForm.js} +5 -5
- package/dist/web/client/src/components/CustomCodingAgentForm.js.map +1 -0
- package/dist/web/client/src/components/CustomCodingAgentList.d.ts +10 -0
- package/dist/web/client/src/components/CustomCodingAgentList.d.ts.map +1 -0
- package/dist/web/client/src/components/{CustomToolList.js → CustomCodingAgentList.js} +17 -17
- package/dist/web/client/src/components/CustomCodingAgentList.js.map +1 -0
- package/dist/web/client/src/components/branch-detail/SessionHistoryTable.d.ts +2 -2
- package/dist/web/client/src/components/branch-detail/SessionHistoryTable.d.ts.map +1 -1
- package/dist/web/client/src/components/branch-detail/SessionHistoryTable.js +6 -6
- package/dist/web/client/src/components/branch-detail/SessionHistoryTable.js.map +1 -1
- package/dist/web/client/src/components/branch-detail/ToolLauncher.d.ts +2 -2
- package/dist/web/client/src/components/branch-detail/ToolLauncher.d.ts.map +1 -1
- package/dist/web/client/src/components/branch-detail/ToolLauncher.js +5 -5
- package/dist/web/client/src/components/branch-detail/ToolLauncher.js.map +1 -1
- package/dist/web/client/src/hooks/useSessions.d.ts +4 -4
- package/dist/web/client/src/hooks/useSessions.d.ts.map +1 -1
- package/dist/web/client/src/hooks/useSessions.js.map +1 -1
- package/dist/web/client/src/lib/api.d.ts +5 -5
- package/dist/web/client/src/lib/api.d.ts.map +1 -1
- package/dist/web/client/src/lib/api.js +1 -1
- package/dist/web/client/src/lib/api.js.map +1 -1
- package/dist/web/client/src/pages/BranchDetailPage.js +24 -24
- package/dist/web/client/src/pages/BranchDetailPage.js.map +1 -1
- package/dist/web/client/src/pages/ConfigManagementPage.d.ts.map +1 -1
- package/dist/web/client/src/pages/ConfigManagementPage.js +15 -15
- package/dist/web/client/src/pages/ConfigManagementPage.js.map +1 -1
- package/dist/web/client/src/pages/ConfigPage.d.ts.map +1 -1
- package/dist/web/client/src/pages/ConfigPage.js +43 -39
- package/dist/web/client/src/pages/ConfigPage.js.map +1 -1
- package/dist/web/server/env/importer.d.ts.map +1 -1
- package/dist/web/server/env/importer.js +3 -3
- package/dist/web/server/env/importer.js.map +1 -1
- package/dist/web/server/pty/manager.d.ts +6 -6
- package/dist/web/server/pty/manager.d.ts.map +1 -1
- package/dist/web/server/pty/manager.js +11 -11
- package/dist/web/server/pty/manager.js.map +1 -1
- package/dist/web/server/routes/config.d.ts.map +1 -1
- package/dist/web/server/routes/config.js +34 -34
- package/dist/web/server/routes/config.js.map +1 -1
- package/dist/web/server/routes/sessions.d.ts +1 -1
- package/dist/web/server/routes/sessions.d.ts.map +1 -1
- package/dist/web/server/routes/sessions.js +20 -20
- package/dist/web/server/routes/sessions.js.map +1 -1
- package/package.json +2 -2
- package/src/cli/ui/__tests__/components/screens/{AIToolSelectorScreen.test.tsx → CodingAgentSelectorScreen.test.tsx} +38 -38
- package/src/cli/ui/components/App.tsx +22 -20
- package/src/cli/ui/components/screens/CodingAgentSelectorScreen.tsx +159 -0
- package/src/cli/ui/components/screens/ModelSelectorScreen.tsx +6 -2
- package/src/cli/ui/types.ts +2 -2
- package/src/cli/ui/utils/modelOptions.ts +6 -4
- package/src/config/{builtin-tools.ts → builtin-coding-agents.ts} +9 -9
- package/src/config/tools.ts +104 -92
- package/src/index.ts +19 -19
- package/src/launcher.ts +38 -31
- package/src/services/{customToolResolver.ts → codingAgentCommandResolver.ts} +33 -28
- package/src/services/{aiToolResolver.ts → codingAgentResolver.ts} +28 -28
- package/src/shared/{aiToolConstants.ts → codingAgentConstants.ts} +1 -1
- package/src/types/api.ts +12 -12
- package/src/types/tools.ts +30 -30
- package/src/web/client/src/components/{AIToolLaunchModal.tsx → CodingAgentLaunchModal.tsx} +74 -70
- package/src/web/client/src/components/{CustomToolForm.tsx → CustomCodingAgentForm.tsx} +14 -14
- package/src/web/client/src/components/{CustomToolList.tsx → CustomCodingAgentList.tsx} +26 -26
- package/src/web/client/src/components/branch-detail/SessionHistoryTable.tsx +7 -7
- package/src/web/client/src/components/branch-detail/ToolLauncher.tsx +9 -9
- package/src/web/client/src/hooks/useSessions.ts +5 -5
- package/src/web/client/src/lib/api.ts +8 -8
- package/src/web/client/src/pages/BranchDetailPage.tsx +26 -26
- package/src/web/client/src/pages/ConfigManagementPage.tsx +32 -24
- package/src/web/client/src/pages/ConfigPage.tsx +55 -49
- package/src/web/server/env/importer.ts +6 -3
- package/src/web/server/pty/manager.ts +20 -20
- package/src/web/server/routes/config.ts +45 -39
- package/src/web/server/routes/sessions.ts +29 -26
- package/dist/cli/ui/components/screens/AIToolSelectorScreen.d.ts +0 -27
- package/dist/cli/ui/components/screens/AIToolSelectorScreen.d.ts.map +0 -1
- package/dist/cli/ui/components/screens/AIToolSelectorScreen.js.map +0 -1
- package/dist/config/builtin-tools.d.ts +0 -23
- package/dist/config/builtin-tools.d.ts.map +0 -1
- package/dist/config/builtin-tools.js.map +0 -1
- package/dist/services/aiToolResolver.d.ts.map +0 -1
- package/dist/services/aiToolResolver.js.map +0 -1
- package/dist/services/customToolResolver.d.ts +0 -10
- package/dist/services/customToolResolver.d.ts.map +0 -1
- package/dist/services/customToolResolver.js.map +0 -1
- package/dist/shared/aiToolConstants.d.ts.map +0 -1
- package/dist/shared/aiToolConstants.js.map +0 -1
- package/dist/web/client/src/components/AIToolLaunchModal.d.ts +0 -9
- package/dist/web/client/src/components/AIToolLaunchModal.d.ts.map +0 -1
- package/dist/web/client/src/components/AIToolLaunchModal.js.map +0 -1
- package/dist/web/client/src/components/CustomToolForm.d.ts +0 -23
- package/dist/web/client/src/components/CustomToolForm.d.ts.map +0 -1
- package/dist/web/client/src/components/CustomToolForm.js.map +0 -1
- package/dist/web/client/src/components/CustomToolList.d.ts +0 -10
- package/dist/web/client/src/components/CustomToolList.d.ts.map +0 -1
- package/dist/web/client/src/components/CustomToolList.js.map +0 -1
- package/src/cli/ui/components/screens/AIToolSelectorScreen.tsx +0 -153
package/src/types/tools.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* コーディングエージェント対応機能の型定義
|
|
3
3
|
*
|
|
4
4
|
* この型定義ファイルは、設定ファイル(tools.json)のスキーマと
|
|
5
5
|
* 内部で使用するデータ構造を定義します。
|
|
@@ -42,30 +42,30 @@ export interface ModeArgs {
|
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
/**
|
|
45
|
-
*
|
|
45
|
+
* コーディングエージェント定義
|
|
46
46
|
*
|
|
47
|
-
* tools.json
|
|
47
|
+
* tools.jsonファイルで定義される個別のエージェント設定。
|
|
48
48
|
*/
|
|
49
|
-
export interface
|
|
49
|
+
export interface CodingAgent {
|
|
50
50
|
/**
|
|
51
|
-
*
|
|
51
|
+
* エージェントの一意識別子
|
|
52
52
|
*
|
|
53
53
|
* 小文字英数字とハイフンのみ使用可能(パターン: ^[a-z0-9-]+$)
|
|
54
|
-
*
|
|
54
|
+
* ビルトインエージェント(claude-code, codex-cli)との重複は不可。
|
|
55
55
|
*/
|
|
56
56
|
id: string;
|
|
57
57
|
|
|
58
58
|
/**
|
|
59
59
|
* UI表示名
|
|
60
60
|
*
|
|
61
|
-
*
|
|
61
|
+
* エージェント選択画面で表示される名前。日本語も使用可能。
|
|
62
62
|
*/
|
|
63
63
|
displayName: string;
|
|
64
64
|
|
|
65
65
|
/**
|
|
66
66
|
* アイコン文字(オプション)
|
|
67
67
|
*
|
|
68
|
-
*
|
|
68
|
+
* エージェント選択画面で表示されるUnicode文字。
|
|
69
69
|
*/
|
|
70
70
|
icon?: string;
|
|
71
71
|
|
|
@@ -96,7 +96,7 @@ export interface CustomAITool {
|
|
|
96
96
|
/**
|
|
97
97
|
* デフォルト引数(オプション)
|
|
98
98
|
*
|
|
99
|
-
*
|
|
99
|
+
* エージェント実行時に常に付与される引数。
|
|
100
100
|
* 最終的な引数は: defaultArgs + modeArgs[mode] + permissionSkipArgs + extraArgs
|
|
101
101
|
*/
|
|
102
102
|
defaultArgs?: string[];
|
|
@@ -119,7 +119,7 @@ export interface CustomAITool {
|
|
|
119
119
|
/**
|
|
120
120
|
* 環境変数(オプション)
|
|
121
121
|
*
|
|
122
|
-
*
|
|
122
|
+
* エージェント起動時に設定される環境変数。
|
|
123
123
|
* APIキーや設定ファイルパスなどを指定。
|
|
124
124
|
*/
|
|
125
125
|
env?: Record<string, string>;
|
|
@@ -136,11 +136,11 @@ export interface CustomAITool {
|
|
|
136
136
|
}
|
|
137
137
|
|
|
138
138
|
/**
|
|
139
|
-
*
|
|
139
|
+
* コーディングエージェント設定ファイル全体
|
|
140
140
|
*
|
|
141
141
|
* ~/.gwt/tools.json のスキーマ。
|
|
142
142
|
*/
|
|
143
|
-
export interface
|
|
143
|
+
export interface CodingAgentsConfig {
|
|
144
144
|
/**
|
|
145
145
|
* 設定フォーマットのバージョン
|
|
146
146
|
*
|
|
@@ -154,16 +154,16 @@ export interface ToolsConfig {
|
|
|
154
154
|
updatedAt?: string;
|
|
155
155
|
|
|
156
156
|
/**
|
|
157
|
-
*
|
|
157
|
+
* すべてのエージェントで共有する環境変数
|
|
158
158
|
*/
|
|
159
159
|
env?: Record<string, string>;
|
|
160
160
|
|
|
161
161
|
/**
|
|
162
|
-
*
|
|
162
|
+
* カスタムコーディングエージェント定義の配列
|
|
163
163
|
*
|
|
164
|
-
*
|
|
164
|
+
* 空配列も許可(ビルトインエージェントのみ使用)。
|
|
165
165
|
*/
|
|
166
|
-
|
|
166
|
+
customCodingAgents: CodingAgent[];
|
|
167
167
|
}
|
|
168
168
|
|
|
169
169
|
// ============================================================================
|
|
@@ -171,17 +171,17 @@ export interface ToolsConfig {
|
|
|
171
171
|
// ============================================================================
|
|
172
172
|
|
|
173
173
|
/**
|
|
174
|
-
*
|
|
174
|
+
* 統合コーディングエージェント設定
|
|
175
175
|
*
|
|
176
|
-
*
|
|
177
|
-
*
|
|
176
|
+
* ビルトインエージェントとカスタムエージェントを統合して扱うための内部型。
|
|
177
|
+
* getAllCodingAgents() 関数がこの型の配列を返します。
|
|
178
178
|
*/
|
|
179
|
-
export interface
|
|
179
|
+
export interface CodingAgentConfig {
|
|
180
180
|
/**
|
|
181
|
-
*
|
|
181
|
+
* エージェントID
|
|
182
182
|
*
|
|
183
183
|
* ビルトイン: "claude-code" | "codex-cli"
|
|
184
|
-
* カスタム:
|
|
184
|
+
* カスタム: CodingAgent.id
|
|
185
185
|
*/
|
|
186
186
|
id: string;
|
|
187
187
|
|
|
@@ -196,27 +196,27 @@ export interface AIToolConfig {
|
|
|
196
196
|
icon?: string;
|
|
197
197
|
|
|
198
198
|
/**
|
|
199
|
-
*
|
|
199
|
+
* ビルトインエージェントかどうか
|
|
200
200
|
*
|
|
201
201
|
* true: Claude Code または Codex CLI
|
|
202
|
-
* false:
|
|
202
|
+
* false: カスタムエージェント
|
|
203
203
|
*/
|
|
204
204
|
isBuiltin: boolean;
|
|
205
205
|
|
|
206
206
|
/**
|
|
207
|
-
*
|
|
207
|
+
* カスタムエージェントの場合、元の設定
|
|
208
208
|
*
|
|
209
209
|
* isBuiltin=false の場合のみ存在。
|
|
210
210
|
*/
|
|
211
|
-
customConfig?:
|
|
211
|
+
customConfig?: CodingAgent;
|
|
212
212
|
}
|
|
213
213
|
|
|
214
214
|
/**
|
|
215
|
-
*
|
|
215
|
+
* コーディングエージェント起動オプション
|
|
216
216
|
*
|
|
217
|
-
*
|
|
217
|
+
* launchCodingAgent() 関数の引数として使用。
|
|
218
218
|
*/
|
|
219
|
-
export interface
|
|
219
|
+
export interface CodingAgentLaunchOptions {
|
|
220
220
|
/**
|
|
221
221
|
* 実行モード
|
|
222
222
|
*/
|
|
@@ -239,7 +239,7 @@ export interface LaunchOptions {
|
|
|
239
239
|
/**
|
|
240
240
|
* 作業ディレクトリ(ワークツリーパス)
|
|
241
241
|
*
|
|
242
|
-
*
|
|
242
|
+
* エージェント起動時のcwdとして使用されます。
|
|
243
243
|
*/
|
|
244
244
|
cwd?: string;
|
|
245
245
|
|
|
@@ -11,18 +11,18 @@ import {
|
|
|
11
11
|
SelectTrigger,
|
|
12
12
|
SelectValue,
|
|
13
13
|
} from "@/components/ui/select";
|
|
14
|
-
import type { Branch,
|
|
14
|
+
import type { Branch, ApiCodingAgent } from "../../../../types/api.js";
|
|
15
15
|
import {
|
|
16
16
|
CLAUDE_PERMISSION_SKIP_ARGS,
|
|
17
17
|
CODEX_DEFAULT_ARGS,
|
|
18
|
-
} from "../../../../shared/
|
|
18
|
+
} from "../../../../shared/codingAgentConstants.js";
|
|
19
19
|
import { useConfig } from "../hooks/useConfig";
|
|
20
20
|
import { useStartSession } from "../hooks/useSessions";
|
|
21
21
|
import { useCreateWorktree } from "../hooks/useWorktrees";
|
|
22
22
|
import { useSyncBranch } from "../hooks/useBranches";
|
|
23
23
|
import { ApiError } from "../lib/api";
|
|
24
24
|
|
|
25
|
-
const
|
|
25
|
+
const BUILTIN_AGENT_SUMMARIES: Record<string, AgentSummary> = {
|
|
26
26
|
"claude-code": {
|
|
27
27
|
command: "claude",
|
|
28
28
|
defaultArgs: [],
|
|
@@ -44,7 +44,7 @@ const BUILTIN_TOOL_SUMMARIES: Record<string, ToolSummary> = {
|
|
|
44
44
|
},
|
|
45
45
|
};
|
|
46
46
|
|
|
47
|
-
interface
|
|
47
|
+
interface AgentSummary {
|
|
48
48
|
command: string;
|
|
49
49
|
defaultArgs?: string[] | null;
|
|
50
50
|
modeArgs?: {
|
|
@@ -55,19 +55,22 @@ interface ToolSummary {
|
|
|
55
55
|
permissionSkipArgs?: string[] | null;
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
interface
|
|
58
|
+
interface CodingAgentLaunchModalProps {
|
|
59
59
|
branch: Branch;
|
|
60
60
|
onClose: () => void;
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
type
|
|
63
|
+
type AgentMode = "normal" | "continue" | "resume";
|
|
64
64
|
|
|
65
|
-
type
|
|
65
|
+
type SelectableAgent =
|
|
66
66
|
| { id: "claude-code"; label: string; target: "claude" }
|
|
67
67
|
| { id: "codex-cli"; label: string; target: "codex" }
|
|
68
|
-
| { id: string; label: string; target: "custom"; definition:
|
|
68
|
+
| { id: string; label: string; target: "custom"; definition: ApiCodingAgent };
|
|
69
69
|
|
|
70
|
-
export function
|
|
70
|
+
export function CodingAgentLaunchModal({
|
|
71
|
+
branch,
|
|
72
|
+
onClose,
|
|
73
|
+
}: CodingAgentLaunchModalProps) {
|
|
71
74
|
const {
|
|
72
75
|
data: config,
|
|
73
76
|
isLoading: isConfigLoading,
|
|
@@ -78,8 +81,8 @@ export function AIToolLaunchModal({ branch, onClose }: AIToolLaunchModalProps) {
|
|
|
78
81
|
const syncBranch = useSyncBranch(branch.name);
|
|
79
82
|
const navigate = useNavigate();
|
|
80
83
|
|
|
81
|
-
const [
|
|
82
|
-
const [selectedMode, setSelectedMode] = useState<
|
|
84
|
+
const [selectedAgentId, setSelectedAgentId] = useState<string>("claude-code");
|
|
85
|
+
const [selectedMode, setSelectedMode] = useState<AgentMode>("normal");
|
|
83
86
|
const [skipPermissions, setSkipPermissions] = useState(false);
|
|
84
87
|
const [extraArgsText, setExtraArgsText] = useState("");
|
|
85
88
|
const [banner, setBanner] = useState<{
|
|
@@ -89,74 +92,74 @@ export function AIToolLaunchModal({ branch, onClose }: AIToolLaunchModalProps) {
|
|
|
89
92
|
const [isStartingSession, setIsStartingSession] = useState(false);
|
|
90
93
|
const [isCreatingWorktree, setIsCreatingWorktree] = useState(false);
|
|
91
94
|
|
|
92
|
-
const
|
|
93
|
-
const
|
|
95
|
+
const customAgents = config?.codingAgents ?? [];
|
|
96
|
+
const availableAgents: SelectableAgent[] = useMemo(
|
|
94
97
|
() => [
|
|
95
98
|
{ id: "claude-code", label: "Claude Code", target: "claude" },
|
|
96
99
|
{ id: "codex-cli", label: "Codex CLI", target: "codex" },
|
|
97
|
-
...
|
|
98
|
-
id:
|
|
99
|
-
label:
|
|
100
|
+
...customAgents.map((agent) => ({
|
|
101
|
+
id: agent.id,
|
|
102
|
+
label: agent.displayName,
|
|
100
103
|
target: "custom" as const,
|
|
101
|
-
definition:
|
|
104
|
+
definition: agent,
|
|
102
105
|
})),
|
|
103
106
|
],
|
|
104
|
-
[
|
|
107
|
+
[customAgents],
|
|
105
108
|
);
|
|
106
109
|
|
|
107
110
|
useEffect(() => {
|
|
108
|
-
if (!
|
|
109
|
-
|
|
111
|
+
if (!availableAgents.length) {
|
|
112
|
+
setSelectedAgentId("claude-code");
|
|
110
113
|
return;
|
|
111
114
|
}
|
|
112
|
-
if (!
|
|
113
|
-
const first =
|
|
115
|
+
if (!availableAgents.find((agent) => agent.id === selectedAgentId)) {
|
|
116
|
+
const first = availableAgents[0];
|
|
114
117
|
if (first) {
|
|
115
|
-
|
|
118
|
+
setSelectedAgentId(first.id);
|
|
116
119
|
}
|
|
117
120
|
}
|
|
118
|
-
}, [
|
|
121
|
+
}, [availableAgents, selectedAgentId]);
|
|
119
122
|
|
|
120
|
-
const
|
|
121
|
-
(
|
|
123
|
+
const selectedAgent = availableAgents.find(
|
|
124
|
+
(agent) => agent.id === selectedAgentId,
|
|
122
125
|
);
|
|
123
126
|
|
|
124
|
-
const
|
|
125
|
-
if (!
|
|
127
|
+
const selectedAgentSummary: AgentSummary | null = useMemo(() => {
|
|
128
|
+
if (!selectedAgent) {
|
|
126
129
|
return null;
|
|
127
130
|
}
|
|
128
|
-
if (
|
|
131
|
+
if (selectedAgent.target === "custom") {
|
|
129
132
|
return {
|
|
130
|
-
command:
|
|
131
|
-
defaultArgs:
|
|
132
|
-
modeArgs:
|
|
133
|
-
permissionSkipArgs:
|
|
133
|
+
command: selectedAgent.definition.command,
|
|
134
|
+
defaultArgs: selectedAgent.definition.defaultArgs ?? null,
|
|
135
|
+
modeArgs: selectedAgent.definition.modeArgs,
|
|
136
|
+
permissionSkipArgs: selectedAgent.definition.permissionSkipArgs ?? null,
|
|
134
137
|
};
|
|
135
138
|
}
|
|
136
|
-
return
|
|
137
|
-
}, [
|
|
139
|
+
return BUILTIN_AGENT_SUMMARIES[selectedAgent.id] ?? null;
|
|
140
|
+
}, [selectedAgent]);
|
|
138
141
|
|
|
139
142
|
const argsPreview = useMemo(() => {
|
|
140
|
-
if (!
|
|
143
|
+
if (!selectedAgentSummary) {
|
|
141
144
|
return null;
|
|
142
145
|
}
|
|
143
146
|
const args: string[] = [];
|
|
144
|
-
if (
|
|
145
|
-
args.push(...
|
|
147
|
+
if (selectedAgentSummary.defaultArgs?.length) {
|
|
148
|
+
args.push(...selectedAgentSummary.defaultArgs);
|
|
146
149
|
}
|
|
147
|
-
const mode =
|
|
150
|
+
const mode = selectedAgentSummary.modeArgs?.[selectedMode];
|
|
148
151
|
if (mode?.length) {
|
|
149
152
|
args.push(...mode);
|
|
150
153
|
}
|
|
151
|
-
if (skipPermissions &&
|
|
152
|
-
args.push(...
|
|
154
|
+
if (skipPermissions && selectedAgentSummary.permissionSkipArgs?.length) {
|
|
155
|
+
args.push(...selectedAgentSummary.permissionSkipArgs);
|
|
153
156
|
}
|
|
154
157
|
const extraArgs = parseExtraArgs(extraArgsText);
|
|
155
158
|
if (extraArgs.length) {
|
|
156
159
|
args.push(...extraArgs);
|
|
157
160
|
}
|
|
158
|
-
return { command:
|
|
159
|
-
}, [
|
|
161
|
+
return { command: selectedAgentSummary.command, args };
|
|
162
|
+
}, [selectedAgentSummary, selectedMode, skipPermissions, extraArgsText]);
|
|
160
163
|
|
|
161
164
|
const PROTECTED_BRANCHES = ["main", "master", "develop"];
|
|
162
165
|
const isProtectedBranch = PROTECTED_BRANCHES.includes(
|
|
@@ -256,8 +259,8 @@ export function AIToolLaunchModal({ branch, onClose }: AIToolLaunchModalProps) {
|
|
|
256
259
|
});
|
|
257
260
|
return;
|
|
258
261
|
}
|
|
259
|
-
if (!
|
|
260
|
-
setBanner({ type: "error", message: "Select
|
|
262
|
+
if (!selectedAgent) {
|
|
263
|
+
setBanner({ type: "error", message: "Select a coding agent to launch." });
|
|
261
264
|
return;
|
|
262
265
|
}
|
|
263
266
|
if (needsRemoteSync) {
|
|
@@ -285,23 +288,23 @@ export function AIToolLaunchModal({ branch, onClose }: AIToolLaunchModalProps) {
|
|
|
285
288
|
|
|
286
289
|
setIsStartingSession(true);
|
|
287
290
|
try {
|
|
288
|
-
const
|
|
289
|
-
|
|
291
|
+
const agentType =
|
|
292
|
+
selectedAgent.target === "codex"
|
|
290
293
|
? "codex-cli"
|
|
291
|
-
:
|
|
294
|
+
: selectedAgent.target === "custom"
|
|
292
295
|
? "custom"
|
|
293
296
|
: "claude-code";
|
|
294
297
|
const extraArgs = parseExtraArgs(extraArgsText);
|
|
295
298
|
const sessionRequest = {
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
...(
|
|
299
|
-
? {
|
|
299
|
+
agentType,
|
|
300
|
+
agentName: selectedAgent.target === "custom" ? selectedAgent.id : null,
|
|
301
|
+
...(selectedAgent.target === "custom"
|
|
302
|
+
? { customAgentId: selectedAgent.id }
|
|
300
303
|
: {}),
|
|
301
304
|
mode: selectedMode,
|
|
302
305
|
worktreePath: branch.worktreePath,
|
|
303
306
|
skipPermissions,
|
|
304
|
-
...(
|
|
307
|
+
...(selectedAgent.target === "codex"
|
|
305
308
|
? { bypassApprovals: skipPermissions }
|
|
306
309
|
: {}),
|
|
307
310
|
...(extraArgs.length ? { extraArgs } : {}),
|
|
@@ -333,7 +336,7 @@ export function AIToolLaunchModal({ branch, onClose }: AIToolLaunchModalProps) {
|
|
|
333
336
|
<div className="flex items-start justify-between gap-4">
|
|
334
337
|
<div>
|
|
335
338
|
<p className="text-xs font-medium uppercase tracking-wider text-muted-foreground">
|
|
336
|
-
Launch
|
|
339
|
+
Launch Coding Agent
|
|
337
340
|
</p>
|
|
338
341
|
<h2 className="mt-1 text-lg font-semibold">{branch.name}</h2>
|
|
339
342
|
</div>
|
|
@@ -379,7 +382,8 @@ export function AIToolLaunchModal({ branch, onClose }: AIToolLaunchModalProps) {
|
|
|
379
382
|
) : (
|
|
380
383
|
<>
|
|
381
384
|
<p>
|
|
382
|
-
Worktree is missing. Create it before launching
|
|
385
|
+
Worktree is missing. Create it before launching coding
|
|
386
|
+
agents.
|
|
383
387
|
</p>
|
|
384
388
|
<Button
|
|
385
389
|
variant="secondary"
|
|
@@ -415,19 +419,19 @@ export function AIToolLaunchModal({ branch, onClose }: AIToolLaunchModalProps) {
|
|
|
415
419
|
|
|
416
420
|
<div className="grid gap-4 sm:grid-cols-3">
|
|
417
421
|
<div className="space-y-2">
|
|
418
|
-
<label className="text-sm font-medium">
|
|
422
|
+
<label className="text-sm font-medium">Coding agent</label>
|
|
419
423
|
<Select
|
|
420
|
-
value={
|
|
421
|
-
onValueChange={
|
|
424
|
+
value={selectedAgentId}
|
|
425
|
+
onValueChange={setSelectedAgentId}
|
|
422
426
|
disabled={isConfigLoading ?? false}
|
|
423
427
|
>
|
|
424
428
|
<SelectTrigger>
|
|
425
429
|
<SelectValue />
|
|
426
430
|
</SelectTrigger>
|
|
427
431
|
<SelectContent>
|
|
428
|
-
{
|
|
429
|
-
<SelectItem key={
|
|
430
|
-
{
|
|
432
|
+
{availableAgents.map((agent) => (
|
|
433
|
+
<SelectItem key={agent.id} value={agent.id}>
|
|
434
|
+
{agent.label}
|
|
431
435
|
</SelectItem>
|
|
432
436
|
))}
|
|
433
437
|
</SelectContent>
|
|
@@ -438,7 +442,7 @@ export function AIToolLaunchModal({ branch, onClose }: AIToolLaunchModalProps) {
|
|
|
438
442
|
<label className="text-sm font-medium">Launch mode</label>
|
|
439
443
|
<Select
|
|
440
444
|
value={selectedMode}
|
|
441
|
-
onValueChange={(value) => setSelectedMode(value as
|
|
445
|
+
onValueChange={(value) => setSelectedMode(value as AgentMode)}
|
|
442
446
|
>
|
|
443
447
|
<SelectTrigger>
|
|
444
448
|
<SelectValue />
|
|
@@ -477,12 +481,12 @@ export function AIToolLaunchModal({ branch, onClose }: AIToolLaunchModalProps) {
|
|
|
477
481
|
onClick={handleStartSession}
|
|
478
482
|
disabled={
|
|
479
483
|
isStartingSession ||
|
|
480
|
-
!
|
|
484
|
+
!selectedAgent ||
|
|
481
485
|
hasBlockingDivergence ||
|
|
482
486
|
needsRemoteSync
|
|
483
487
|
}
|
|
484
488
|
>
|
|
485
|
-
{isStartingSession ? "Launching..." : "Launch
|
|
489
|
+
{isStartingSession ? "Launching..." : "Launch coding agent"}
|
|
486
490
|
</Button>
|
|
487
491
|
<Button
|
|
488
492
|
variant="secondary"
|
|
@@ -496,25 +500,25 @@ export function AIToolLaunchModal({ branch, onClose }: AIToolLaunchModalProps) {
|
|
|
496
500
|
</Button>
|
|
497
501
|
</div>
|
|
498
502
|
|
|
499
|
-
{
|
|
503
|
+
{selectedAgentSummary && (
|
|
500
504
|
<div className="space-y-2 rounded-lg border bg-muted/30 p-4 text-sm">
|
|
501
505
|
<div className="grid gap-2 sm:grid-cols-3">
|
|
502
506
|
<div>
|
|
503
507
|
<span className="text-muted-foreground">Command:</span>{" "}
|
|
504
508
|
<code className="rounded bg-muted px-1.5 py-0.5 font-mono">
|
|
505
|
-
{
|
|
509
|
+
{selectedAgentSummary.command}
|
|
506
510
|
</code>
|
|
507
511
|
</div>
|
|
508
512
|
<div>
|
|
509
513
|
<span className="text-muted-foreground">defaultArgs:</span>{" "}
|
|
510
514
|
<span
|
|
511
515
|
className={
|
|
512
|
-
!
|
|
516
|
+
!selectedAgentSummary.defaultArgs?.length
|
|
513
517
|
? "text-muted-foreground/50"
|
|
514
518
|
: ""
|
|
515
519
|
}
|
|
516
520
|
>
|
|
517
|
-
{renderArgs(
|
|
521
|
+
{renderArgs(selectedAgentSummary.defaultArgs)}
|
|
518
522
|
</span>
|
|
519
523
|
</div>
|
|
520
524
|
<div>
|
|
@@ -523,12 +527,12 @@ export function AIToolLaunchModal({ branch, onClose }: AIToolLaunchModalProps) {
|
|
|
523
527
|
</span>{" "}
|
|
524
528
|
<span
|
|
525
529
|
className={
|
|
526
|
-
!
|
|
530
|
+
!selectedAgentSummary.permissionSkipArgs?.length
|
|
527
531
|
? "text-muted-foreground/50"
|
|
528
532
|
: ""
|
|
529
533
|
}
|
|
530
534
|
>
|
|
531
|
-
{renderArgs(
|
|
535
|
+
{renderArgs(selectedAgentSummary.permissionSkipArgs)}
|
|
532
536
|
</span>
|
|
533
537
|
</div>
|
|
534
538
|
</div>
|
|
@@ -9,26 +9,26 @@ import {
|
|
|
9
9
|
SelectValue,
|
|
10
10
|
} from "@/components/ui/select";
|
|
11
11
|
import type {
|
|
12
|
-
|
|
12
|
+
ApiCodingAgent,
|
|
13
13
|
EnvironmentVariable,
|
|
14
14
|
} from "../../../../types/api.js";
|
|
15
15
|
|
|
16
|
-
export interface
|
|
16
|
+
export interface CustomCodingAgentFormValue {
|
|
17
17
|
id: string;
|
|
18
18
|
displayName: string;
|
|
19
19
|
icon?: string | null;
|
|
20
20
|
description?: string | null;
|
|
21
|
-
executionType:
|
|
21
|
+
executionType: ApiCodingAgent["executionType"];
|
|
22
22
|
command: string;
|
|
23
23
|
defaultArgs?: string[] | null;
|
|
24
|
-
modeArgs:
|
|
24
|
+
modeArgs: ApiCodingAgent["modeArgs"];
|
|
25
25
|
permissionSkipArgs?: string[] | null;
|
|
26
26
|
env?: EnvironmentVariable[] | null;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
interface
|
|
30
|
-
initialValue?:
|
|
31
|
-
onSubmit: (value:
|
|
29
|
+
interface CustomCodingAgentFormProps {
|
|
30
|
+
initialValue?: ApiCodingAgent;
|
|
31
|
+
onSubmit: (value: CustomCodingAgentFormValue) => void;
|
|
32
32
|
onCancel: () => void;
|
|
33
33
|
isSaving?: boolean;
|
|
34
34
|
}
|
|
@@ -40,18 +40,18 @@ interface FormErrors {
|
|
|
40
40
|
env?: string;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
export function
|
|
43
|
+
export function CustomCodingAgentForm({
|
|
44
44
|
initialValue,
|
|
45
45
|
onSubmit,
|
|
46
46
|
onCancel,
|
|
47
47
|
isSaving,
|
|
48
|
-
}:
|
|
48
|
+
}: CustomCodingAgentFormProps) {
|
|
49
49
|
const [formState, setFormState] = useState(() =>
|
|
50
50
|
createInitialState(initialValue),
|
|
51
51
|
);
|
|
52
52
|
const [errors, setErrors] = useState<FormErrors>({});
|
|
53
53
|
|
|
54
|
-
const title = initialValue ? "
|
|
54
|
+
const title = initialValue ? "Coding Agent を編集" : "新規 Coding Agent";
|
|
55
55
|
|
|
56
56
|
const handleChange =
|
|
57
57
|
(field: keyof typeof formState) =>
|
|
@@ -120,7 +120,7 @@ export function CustomToolForm({
|
|
|
120
120
|
{title}
|
|
121
121
|
</p>
|
|
122
122
|
<h3 className="mt-1 text-lg font-semibold">
|
|
123
|
-
{formState.displayName || "
|
|
123
|
+
{formState.displayName || "Custom Coding Agent"}
|
|
124
124
|
</h3>
|
|
125
125
|
</div>
|
|
126
126
|
<div className="flex gap-2">
|
|
@@ -140,7 +140,7 @@ export function CustomToolForm({
|
|
|
140
140
|
|
|
141
141
|
<div className="grid gap-4 sm:grid-cols-2">
|
|
142
142
|
<div className="space-y-2">
|
|
143
|
-
<label className="text-sm font-medium"
|
|
143
|
+
<label className="text-sm font-medium">Agent ID *</label>
|
|
144
144
|
<Input
|
|
145
145
|
type="text"
|
|
146
146
|
value={formState.id}
|
|
@@ -286,14 +286,14 @@ export function CustomToolForm({
|
|
|
286
286
|
);
|
|
287
287
|
}
|
|
288
288
|
|
|
289
|
-
function createInitialState(initialValue?:
|
|
289
|
+
function createInitialState(initialValue?: ApiCodingAgent) {
|
|
290
290
|
if (!initialValue) {
|
|
291
291
|
return {
|
|
292
292
|
id: "",
|
|
293
293
|
displayName: "",
|
|
294
294
|
icon: "",
|
|
295
295
|
description: "",
|
|
296
|
-
executionType: "bunx" as
|
|
296
|
+
executionType: "bunx" as ApiCodingAgent["executionType"],
|
|
297
297
|
command: "",
|
|
298
298
|
defaultArgs: "",
|
|
299
299
|
modeNormal: "",
|