@akiojin/gwt 4.8.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 +19 -35
- 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/BranchListScreen.d.ts.map +1 -1
- package/dist/cli/ui/components/screens/BranchListScreen.js +3 -1
- package/dist/cli/ui/components/screens/BranchListScreen.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/index.d.ts.map +1 -1
- package/dist/config/index.js +3 -7
- package/dist/config/index.js.map +1 -1
- package/dist/config/profiles.d.ts +2 -2
- package/dist/config/profiles.d.ts.map +1 -1
- package/dist/config/profiles.js +4 -7
- package/dist/config/profiles.js.map +1 -1
- package/dist/config/tools.d.ts +17 -17
- package/dist/config/tools.d.ts.map +1 -1
- package/dist/config/tools.js +84 -121
- 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/utils/command.d.ts +11 -0
- package/dist/utils/command.d.ts.map +1 -1
- package/dist/utils/command.js +33 -0
- package/dist/utils/command.js.map +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 +44 -40
- 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/BranchListScreen.tsx +4 -2
- 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/index.ts +3 -7
- package/src/config/profiles.ts +4 -7
- package/src/config/tools.ts +107 -148
- 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/utils/command.ts +37 -0
- 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 +57 -51
- 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/index.ts.backup +0 -1543
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import { useQuery, useMutation, useQueryClient } from "@tanstack/react-query";
|
|
6
6
|
import { sessionApi } from "../lib/api";
|
|
7
7
|
import type {
|
|
8
|
-
|
|
8
|
+
CodingAgentSession,
|
|
9
9
|
StartSessionRequest,
|
|
10
10
|
} from "../../../../types/api.js";
|
|
11
11
|
|
|
@@ -13,7 +13,7 @@ import type {
|
|
|
13
13
|
* セッション一覧を取得
|
|
14
14
|
*/
|
|
15
15
|
export function useSessions() {
|
|
16
|
-
return useQuery<
|
|
16
|
+
return useQuery<CodingAgentSession[]>({
|
|
17
17
|
queryKey: ["sessions"],
|
|
18
18
|
queryFn: sessionApi.list,
|
|
19
19
|
});
|
|
@@ -23,7 +23,7 @@ export function useSessions() {
|
|
|
23
23
|
* 特定のセッション情報を取得
|
|
24
24
|
*/
|
|
25
25
|
export function useSession(sessionId: string) {
|
|
26
|
-
return useQuery<
|
|
26
|
+
return useQuery<CodingAgentSession>({
|
|
27
27
|
queryKey: ["sessions", sessionId],
|
|
28
28
|
queryFn: () => sessionApi.get(sessionId),
|
|
29
29
|
enabled: !!sessionId,
|
|
@@ -38,8 +38,8 @@ export function useStartSession() {
|
|
|
38
38
|
|
|
39
39
|
return useMutation({
|
|
40
40
|
mutationFn: (request: StartSessionRequest) => sessionApi.start(request),
|
|
41
|
-
onSuccess: (session:
|
|
42
|
-
queryClient.setQueryData<
|
|
41
|
+
onSuccess: (session: CodingAgentSession) => {
|
|
42
|
+
queryClient.setQueryData<CodingAgentSession[] | undefined>(
|
|
43
43
|
["sessions"],
|
|
44
44
|
(existing) => {
|
|
45
45
|
const next =
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
import type {
|
|
9
9
|
Branch,
|
|
10
10
|
Worktree,
|
|
11
|
-
|
|
11
|
+
CodingAgentSession,
|
|
12
12
|
HealthResponse,
|
|
13
13
|
CreateWorktreeRequest,
|
|
14
14
|
StartSessionRequest,
|
|
@@ -137,15 +137,15 @@ export const sessionApi = {
|
|
|
137
137
|
/**
|
|
138
138
|
* すべてのセッション一覧を取得
|
|
139
139
|
*/
|
|
140
|
-
list: async (): Promise<
|
|
141
|
-
return apiFetch<
|
|
140
|
+
list: async (): Promise<CodingAgentSession[]> => {
|
|
141
|
+
return apiFetch<CodingAgentSession[]>(`${API_BASE}/sessions`);
|
|
142
142
|
},
|
|
143
143
|
|
|
144
144
|
/**
|
|
145
145
|
* 新しいセッションを開始
|
|
146
146
|
*/
|
|
147
|
-
start: async (request: StartSessionRequest): Promise<
|
|
148
|
-
return apiFetch<
|
|
147
|
+
start: async (request: StartSessionRequest): Promise<CodingAgentSession> => {
|
|
148
|
+
return apiFetch<CodingAgentSession>(`${API_BASE}/sessions`, {
|
|
149
149
|
method: "POST",
|
|
150
150
|
body: JSON.stringify(request),
|
|
151
151
|
});
|
|
@@ -154,8 +154,8 @@ export const sessionApi = {
|
|
|
154
154
|
/**
|
|
155
155
|
* 特定のセッション情報を取得
|
|
156
156
|
*/
|
|
157
|
-
get: async (sessionId: string): Promise<
|
|
158
|
-
return apiFetch<
|
|
157
|
+
get: async (sessionId: string): Promise<CodingAgentSession> => {
|
|
158
|
+
return apiFetch<CodingAgentSession>(`${API_BASE}/sessions/${sessionId}`);
|
|
159
159
|
},
|
|
160
160
|
|
|
161
161
|
/**
|
|
@@ -173,7 +173,7 @@ export const sessionApi = {
|
|
|
173
173
|
*/
|
|
174
174
|
export const configApi = {
|
|
175
175
|
/**
|
|
176
|
-
* カスタム
|
|
176
|
+
* カスタム Coding Agent 設定を取得
|
|
177
177
|
*/
|
|
178
178
|
get: async (): Promise<ConfigPayload> => apiFetch(`${API_BASE}/config`),
|
|
179
179
|
update: async (request: ConfigPayload): Promise<ConfigPayload> =>
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
} from "@/components/branch-detail";
|
|
23
23
|
import type {
|
|
24
24
|
Branch,
|
|
25
|
-
|
|
25
|
+
ApiCodingAgent,
|
|
26
26
|
LastToolUsage,
|
|
27
27
|
} from "../../../../types/api.js";
|
|
28
28
|
|
|
@@ -88,22 +88,22 @@ export function BranchDetailPage() {
|
|
|
88
88
|
};
|
|
89
89
|
}, [isTerminalFullscreen]);
|
|
90
90
|
|
|
91
|
-
// Available
|
|
92
|
-
const
|
|
91
|
+
// Available coding agents - must be before conditional returns
|
|
92
|
+
const customAgents: ApiCodingAgent[] = config?.codingAgents ?? [];
|
|
93
93
|
const availableTools: SelectableTool[] = useMemo(
|
|
94
94
|
() => [
|
|
95
95
|
{ id: "claude-code", label: "Claude Code", target: "claude" },
|
|
96
96
|
{ id: "codex-cli", label: "Codex CLI", target: "codex" },
|
|
97
|
-
...
|
|
98
|
-
(
|
|
99
|
-
id:
|
|
100
|
-
label:
|
|
97
|
+
...customAgents.map(
|
|
98
|
+
(agent): SelectableTool => ({
|
|
99
|
+
id: agent.id,
|
|
100
|
+
label: agent.displayName,
|
|
101
101
|
target: "custom" as const,
|
|
102
|
-
definition:
|
|
102
|
+
definition: agent,
|
|
103
103
|
}),
|
|
104
104
|
),
|
|
105
105
|
],
|
|
106
|
-
[
|
|
106
|
+
[customAgents],
|
|
107
107
|
);
|
|
108
108
|
|
|
109
109
|
// Ensure selected tool is valid - must be before conditional returns
|
|
@@ -135,13 +135,13 @@ export function BranchDetailPage() {
|
|
|
135
135
|
branch: branch.name,
|
|
136
136
|
worktreePath: branch.worktreePath ?? null,
|
|
137
137
|
toolId:
|
|
138
|
-
first.
|
|
139
|
-
? (first.
|
|
140
|
-
: (first.
|
|
138
|
+
first.agentType === "custom"
|
|
139
|
+
? (first.agentName ?? "custom")
|
|
140
|
+
: (first.agentType as LastToolUsage["toolId"]),
|
|
141
141
|
toolLabel:
|
|
142
|
-
first.
|
|
143
|
-
? (first.
|
|
144
|
-
:
|
|
142
|
+
first.agentType === "custom"
|
|
143
|
+
? (first.agentName ?? "Custom")
|
|
144
|
+
: agentLabel(first.agentType),
|
|
145
145
|
mode: first.mode ?? "normal",
|
|
146
146
|
model: null,
|
|
147
147
|
timestamp: first.startedAt ? Date.parse(first.startedAt) : Date.now(),
|
|
@@ -257,7 +257,7 @@ export function BranchDetailPage() {
|
|
|
257
257
|
if (!selectedTool) {
|
|
258
258
|
setBanner({
|
|
259
259
|
type: "error",
|
|
260
|
-
message: "起動する
|
|
260
|
+
message: "起動する Coding Agent を選択してください",
|
|
261
261
|
});
|
|
262
262
|
return;
|
|
263
263
|
}
|
|
@@ -265,7 +265,7 @@ export function BranchDetailPage() {
|
|
|
265
265
|
if (needsRemoteSync) {
|
|
266
266
|
setBanner({
|
|
267
267
|
type: "error",
|
|
268
|
-
message: "リモートの更新を取り込むまで
|
|
268
|
+
message: "リモートの更新を取り込むまで Coding Agent は起動できません。",
|
|
269
269
|
});
|
|
270
270
|
return;
|
|
271
271
|
}
|
|
@@ -287,7 +287,7 @@ export function BranchDetailPage() {
|
|
|
287
287
|
|
|
288
288
|
setIsStartingSession(true);
|
|
289
289
|
try {
|
|
290
|
-
const
|
|
290
|
+
const agentType: ToolType =
|
|
291
291
|
selectedTool.target === "codex"
|
|
292
292
|
? "codex-cli"
|
|
293
293
|
: selectedTool.target === "custom"
|
|
@@ -298,10 +298,10 @@ export function BranchDetailPage() {
|
|
|
298
298
|
.map((c) => c.trim())
|
|
299
299
|
.filter(Boolean);
|
|
300
300
|
const sessionRequest = {
|
|
301
|
-
|
|
302
|
-
|
|
301
|
+
agentType,
|
|
302
|
+
agentName: selectedTool.target === "custom" ? selectedTool.id : null,
|
|
303
303
|
...(selectedTool.target === "custom"
|
|
304
|
-
? {
|
|
304
|
+
? { customAgentId: selectedTool.id }
|
|
305
305
|
: {}),
|
|
306
306
|
mode: selectedMode,
|
|
307
307
|
worktreePath: branch.worktreePath,
|
|
@@ -317,7 +317,7 @@ export function BranchDetailPage() {
|
|
|
317
317
|
setIsTerminalFullscreen(false);
|
|
318
318
|
setBanner({
|
|
319
319
|
type: "info",
|
|
320
|
-
message: `${
|
|
320
|
+
message: `${agentLabel(agentType, selectedTool)} を起動しました。`,
|
|
321
321
|
});
|
|
322
322
|
} catch (err) {
|
|
323
323
|
setBanner({
|
|
@@ -438,7 +438,7 @@ export function BranchDetailPage() {
|
|
|
438
438
|
</Button>
|
|
439
439
|
) : (
|
|
440
440
|
<Button variant="secondary" asChild>
|
|
441
|
-
<Link to="/config"
|
|
441
|
+
<Link to="/config">Custom Coding Agent</Link>
|
|
442
442
|
</Button>
|
|
443
443
|
)}
|
|
444
444
|
</div>
|
|
@@ -547,9 +547,9 @@ function formatError(error: unknown, fallback: string): string {
|
|
|
547
547
|
return fallback;
|
|
548
548
|
}
|
|
549
549
|
|
|
550
|
-
function
|
|
551
|
-
if (
|
|
550
|
+
function agentLabel(agentType: string, selectedTool?: SelectableTool): string {
|
|
551
|
+
if (agentType === "custom" && selectedTool?.target === "custom")
|
|
552
552
|
return selectedTool.label;
|
|
553
|
-
if (
|
|
553
|
+
if (agentType === "codex-cli") return "Codex CLI";
|
|
554
554
|
return "Claude Code";
|
|
555
555
|
}
|
|
@@ -2,7 +2,7 @@ import React, { useEffect, useMemo, useState } from "react";
|
|
|
2
2
|
import { Link } from "react-router-dom";
|
|
3
3
|
import type {
|
|
4
4
|
ConfigPayload,
|
|
5
|
-
|
|
5
|
+
ApiCodingAgent,
|
|
6
6
|
EnvironmentVariable,
|
|
7
7
|
} from "../../../../types/api.js";
|
|
8
8
|
import { useConfig, useUpdateConfig } from "../hooks/useConfig";
|
|
@@ -39,15 +39,17 @@ function buildPayload(
|
|
|
39
39
|
sharedEnv: EnvRow[],
|
|
40
40
|
toolState: ToolEnvState,
|
|
41
41
|
): ConfigPayload {
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
42
|
+
const codingAgents: ApiCodingAgent[] = (base?.codingAgents ?? []).map(
|
|
43
|
+
(agent) => ({
|
|
44
|
+
...agent,
|
|
45
|
+
env: serializeRows(toolState[agent.id] ?? []),
|
|
46
|
+
}),
|
|
47
|
+
);
|
|
46
48
|
|
|
47
49
|
return {
|
|
48
50
|
version: base?.version ?? "1.0.0",
|
|
49
51
|
env: serializeRows(sharedEnv),
|
|
50
|
-
|
|
52
|
+
codingAgents,
|
|
51
53
|
};
|
|
52
54
|
}
|
|
53
55
|
|
|
@@ -65,8 +67,8 @@ export function ConfigManagementPage() {
|
|
|
65
67
|
if (!data) return;
|
|
66
68
|
setSharedEnv(rowsFromVariables(data.env));
|
|
67
69
|
const toolState: ToolEnvState = {};
|
|
68
|
-
data.
|
|
69
|
-
toolState[
|
|
70
|
+
data.codingAgents?.forEach((agent) => {
|
|
71
|
+
toolState[agent.id] = rowsFromVariables(agent.env);
|
|
70
72
|
});
|
|
71
73
|
setToolEnv(toolState);
|
|
72
74
|
}, [data]);
|
|
@@ -102,8 +104,11 @@ export function ConfigManagementPage() {
|
|
|
102
104
|
if (serializedOriginalShared !== serializedCurrentShared) return true;
|
|
103
105
|
if (!data) return false;
|
|
104
106
|
const currentTool =
|
|
105
|
-
data.
|
|
106
|
-
|
|
107
|
+
data.codingAgents?.map((agent) =>
|
|
108
|
+
serializeRows(toolEnv[agent.id] ?? []),
|
|
109
|
+
) ?? [];
|
|
110
|
+
const originalTool =
|
|
111
|
+
data.codingAgents?.map((agent) => agent.env ?? []) ?? [];
|
|
107
112
|
return JSON.stringify(currentTool) !== JSON.stringify(originalTool);
|
|
108
113
|
}, [data, serializedOriginalShared, serializedCurrentShared, toolEnv]);
|
|
109
114
|
|
|
@@ -195,41 +200,44 @@ export function ConfigManagementPage() {
|
|
|
195
200
|
<CardContent className="pt-6">
|
|
196
201
|
<EnvEditor
|
|
197
202
|
title="共通環境変数"
|
|
198
|
-
description="全ての
|
|
203
|
+
description="全ての Coding Agent で共有される値。PAT やプロキシ設定などはこちらに入力してください。"
|
|
199
204
|
rows={sharedEnv}
|
|
200
205
|
onChange={setSharedEnv}
|
|
201
206
|
/>
|
|
202
207
|
</CardContent>
|
|
203
208
|
</Card>
|
|
204
209
|
|
|
205
|
-
{/*
|
|
210
|
+
{/* Agent-specific Environment Variables */}
|
|
206
211
|
<Card>
|
|
207
212
|
<CardHeader className="pb-3">
|
|
208
213
|
<p className="text-xs font-medium uppercase tracking-wider text-muted-foreground">
|
|
209
|
-
|
|
214
|
+
Agent-specific
|
|
210
215
|
</p>
|
|
211
|
-
<h3 className="mt-1 text-lg font-semibold"
|
|
216
|
+
<h3 className="mt-1 text-lg font-semibold">
|
|
217
|
+
Coding Agent 固有の環境変数
|
|
218
|
+
</h3>
|
|
212
219
|
<p className="mt-2 text-sm text-muted-foreground">
|
|
213
|
-
|
|
214
|
-
|
|
220
|
+
各 Coding Agent
|
|
221
|
+
固有に上書きしたい値がある場合はこちらから設定します。
|
|
222
|
+
共通設定との競合がある場合はエージェント設定が優先されます。
|
|
215
223
|
</p>
|
|
216
224
|
</CardHeader>
|
|
217
225
|
<CardContent className="space-y-6">
|
|
218
|
-
{data?.
|
|
219
|
-
<div key={
|
|
226
|
+
{data?.codingAgents?.map((agent) => (
|
|
227
|
+
<div key={agent.id} className="rounded-lg border p-4">
|
|
220
228
|
<EnvEditor
|
|
221
|
-
title={
|
|
222
|
-
description={`${
|
|
223
|
-
rows={toolEnv[
|
|
229
|
+
title={agent.displayName}
|
|
230
|
+
description={`${agent.executionType} / ${agent.command}`}
|
|
231
|
+
rows={toolEnv[agent.id] ?? []}
|
|
224
232
|
onChange={(rows) =>
|
|
225
|
-
setToolEnv((prev) => ({ ...prev, [
|
|
233
|
+
setToolEnv((prev) => ({ ...prev, [agent.id]: rows }))
|
|
226
234
|
}
|
|
227
235
|
/>
|
|
228
236
|
</div>
|
|
229
237
|
))}
|
|
230
|
-
{!data?.
|
|
238
|
+
{!data?.codingAgents?.length && (
|
|
231
239
|
<p className="py-4 text-center text-sm text-muted-foreground">
|
|
232
|
-
|
|
240
|
+
登録されている Coding Agent がありません。
|
|
233
241
|
</p>
|
|
234
242
|
)}
|
|
235
243
|
</CardContent>
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import React, { useEffect, useMemo, useState } from "react";
|
|
2
2
|
import { Link } from "react-router-dom";
|
|
3
3
|
import type {
|
|
4
|
-
|
|
4
|
+
ApiCodingAgent,
|
|
5
5
|
EnvironmentVariable,
|
|
6
6
|
} from "../../../../types/api.js";
|
|
7
7
|
import { useConfig, useUpdateConfig } from "../hooks/useConfig";
|
|
8
|
-
import {
|
|
8
|
+
import { CustomCodingAgentList } from "../components/CustomCodingAgentList";
|
|
9
9
|
import {
|
|
10
|
-
|
|
11
|
-
type
|
|
12
|
-
} from "../components/
|
|
10
|
+
CustomCodingAgentForm,
|
|
11
|
+
type CustomCodingAgentFormValue,
|
|
12
|
+
} from "../components/CustomCodingAgentForm";
|
|
13
13
|
import {
|
|
14
14
|
EnvironmentEditor,
|
|
15
15
|
type EnvEntry,
|
|
@@ -31,8 +31,8 @@ const ENV_VALUE_MAX = 500;
|
|
|
31
31
|
export function ConfigPage() {
|
|
32
32
|
const { data, isLoading, error } = useConfig();
|
|
33
33
|
const updateConfig = useUpdateConfig();
|
|
34
|
-
const [
|
|
35
|
-
const [
|
|
34
|
+
const [agents, setAgents] = useState<ApiCodingAgent[]>([]);
|
|
35
|
+
const [editingAgent, setEditingAgent] = useState<ApiCodingAgent | undefined>(
|
|
36
36
|
undefined,
|
|
37
37
|
);
|
|
38
38
|
const [banner, setBanner] = useState<BannerState | null>(null);
|
|
@@ -40,36 +40,36 @@ export function ConfigPage() {
|
|
|
40
40
|
const [envEntries, setEnvEntries] = useState<EnvEntry[]>([]);
|
|
41
41
|
|
|
42
42
|
useEffect(() => {
|
|
43
|
-
if (data?.
|
|
43
|
+
if (data?.codingAgents) setAgents(data.codingAgents);
|
|
44
44
|
if (data) setEnvEntries(entriesFromVariables(data.env));
|
|
45
45
|
}, [data]);
|
|
46
46
|
|
|
47
|
-
const
|
|
48
|
-
return [...
|
|
47
|
+
const sortedAgents = useMemo(() => {
|
|
48
|
+
return [...agents].sort((a, b) =>
|
|
49
49
|
a.displayName.localeCompare(b.displayName, "ja"),
|
|
50
50
|
);
|
|
51
|
-
}, [
|
|
51
|
+
}, [agents]);
|
|
52
52
|
|
|
53
|
-
const handleEdit = (
|
|
54
|
-
|
|
53
|
+
const handleEdit = (agent: ApiCodingAgent) => {
|
|
54
|
+
setEditingAgent(agent);
|
|
55
55
|
setIsCreating(false);
|
|
56
56
|
};
|
|
57
57
|
|
|
58
|
-
const handleDelete = (
|
|
59
|
-
if (!window.confirm(`${
|
|
60
|
-
const next =
|
|
61
|
-
persistConfig(next, envEntries, `${
|
|
58
|
+
const handleDelete = (agent: ApiCodingAgent) => {
|
|
59
|
+
if (!window.confirm(`${agent.displayName} を削除しますか?`)) return;
|
|
60
|
+
const next = agents.filter((a) => a.id !== agent.id);
|
|
61
|
+
persistConfig(next, envEntries, `${agent.displayName} を削除しました。`);
|
|
62
62
|
};
|
|
63
63
|
|
|
64
64
|
const handleCreate = () => {
|
|
65
|
-
|
|
65
|
+
setEditingAgent(undefined);
|
|
66
66
|
setIsCreating(true);
|
|
67
67
|
};
|
|
68
68
|
|
|
69
|
-
const handleFormSubmit = (value:
|
|
69
|
+
const handleFormSubmit = (value: CustomCodingAgentFormValue) => {
|
|
70
70
|
const now = new Date().toISOString();
|
|
71
|
-
const existing =
|
|
72
|
-
const
|
|
71
|
+
const existing = agents.find((agent) => agent.id === value.id);
|
|
72
|
+
const nextAgent: ApiCodingAgent = {
|
|
73
73
|
id: value.id,
|
|
74
74
|
displayName: value.displayName,
|
|
75
75
|
icon: value.icon ?? null,
|
|
@@ -89,21 +89,21 @@ export function ConfigPage() {
|
|
|
89
89
|
};
|
|
90
90
|
|
|
91
91
|
const nextList = existing
|
|
92
|
-
?
|
|
93
|
-
: [...
|
|
92
|
+
? agents.map((agent) => (agent.id === nextAgent.id ? nextAgent : agent))
|
|
93
|
+
: [...agents, nextAgent];
|
|
94
94
|
|
|
95
95
|
persistConfig(
|
|
96
96
|
nextList,
|
|
97
97
|
envEntries,
|
|
98
|
-
`${
|
|
98
|
+
`${nextAgent.displayName} を保存しました。`,
|
|
99
99
|
);
|
|
100
100
|
};
|
|
101
101
|
|
|
102
102
|
const persistConfig = (
|
|
103
|
-
|
|
103
|
+
nextAgents: ApiCodingAgent[],
|
|
104
104
|
nextEnvEntries: EnvEntry[],
|
|
105
105
|
successMessage: string,
|
|
106
|
-
options?: {
|
|
106
|
+
options?: { resetForm?: boolean },
|
|
107
107
|
) => {
|
|
108
108
|
let envPayload: EnvironmentVariable[];
|
|
109
109
|
try {
|
|
@@ -116,13 +116,17 @@ export function ConfigPage() {
|
|
|
116
116
|
|
|
117
117
|
const nextVersion = data?.version ?? "1.0.0";
|
|
118
118
|
updateConfig
|
|
119
|
-
.mutateAsync({
|
|
119
|
+
.mutateAsync({
|
|
120
|
+
version: nextVersion,
|
|
121
|
+
codingAgents: nextAgents,
|
|
122
|
+
env: envPayload,
|
|
123
|
+
})
|
|
120
124
|
.then((response) => {
|
|
121
|
-
|
|
125
|
+
setAgents(response.codingAgents);
|
|
122
126
|
setEnvEntries(entriesFromVariables(response.env));
|
|
123
127
|
setBanner({ type: "success", message: successMessage });
|
|
124
|
-
if (options?.
|
|
125
|
-
|
|
128
|
+
if (options?.resetForm ?? true) {
|
|
129
|
+
setEditingAgent(undefined);
|
|
126
130
|
setIsCreating(false);
|
|
127
131
|
}
|
|
128
132
|
})
|
|
@@ -154,15 +158,15 @@ export function ConfigPage() {
|
|
|
154
158
|
const handleEnvRemove = (id: string) =>
|
|
155
159
|
setEnvEntries((prev) => prev.filter((e) => e.id !== id));
|
|
156
160
|
const handleEnvSave = () =>
|
|
157
|
-
persistConfig(
|
|
158
|
-
|
|
161
|
+
persistConfig(agents, envEntries, "環境変数を保存しました。", {
|
|
162
|
+
resetForm: false,
|
|
159
163
|
});
|
|
160
164
|
const handleCancel = () => {
|
|
161
|
-
|
|
165
|
+
setEditingAgent(undefined);
|
|
162
166
|
setIsCreating(false);
|
|
163
167
|
};
|
|
164
168
|
|
|
165
|
-
const
|
|
169
|
+
const activeFormAgent = isCreating ? undefined : editingAgent;
|
|
166
170
|
|
|
167
171
|
// Loading state
|
|
168
172
|
if (isLoading) {
|
|
@@ -170,7 +174,7 @@ export function ConfigPage() {
|
|
|
170
174
|
<div className="min-h-screen bg-background">
|
|
171
175
|
<PageHeader
|
|
172
176
|
eyebrow="CONFIGURATION"
|
|
173
|
-
title="
|
|
177
|
+
title="Custom Coding Agent"
|
|
174
178
|
subtitle="読み込み中..."
|
|
175
179
|
/>
|
|
176
180
|
<main className="mx-auto max-w-7xl px-6 py-8">
|
|
@@ -207,15 +211,15 @@ export function ConfigPage() {
|
|
|
207
211
|
<div className="min-h-screen bg-background">
|
|
208
212
|
<PageHeader
|
|
209
213
|
eyebrow="CONFIGURATION"
|
|
210
|
-
title="
|
|
211
|
-
subtitle="tools.json を編集して、独自の
|
|
214
|
+
title="Custom Coding Agent"
|
|
215
|
+
subtitle="tools.json を編集して、独自の Coding Agent を CLI / Web UI 両方から利用できます。"
|
|
212
216
|
>
|
|
213
217
|
<div className="mt-4 flex flex-wrap gap-2">
|
|
214
218
|
<Button variant="ghost" size="sm" asChild>
|
|
215
219
|
<Link to="/">← ブランチ一覧</Link>
|
|
216
220
|
</Button>
|
|
217
221
|
<Button variant="secondary" onClick={handleCreate}>
|
|
218
|
-
|
|
222
|
+
Coding Agent を追加
|
|
219
223
|
</Button>
|
|
220
224
|
</div>
|
|
221
225
|
</PageHeader>
|
|
@@ -251,8 +255,8 @@ export function ConfigPage() {
|
|
|
251
255
|
</p>
|
|
252
256
|
<h3 className="mt-1 text-lg font-semibold">共有環境変数</h3>
|
|
253
257
|
<p className="mt-2 text-sm text-muted-foreground">
|
|
254
|
-
Web UI で起動する
|
|
255
|
-
|
|
258
|
+
Web UI で起動する Coding Agent
|
|
259
|
+
はここに定義された環境変数を自動的に引き継ぎます。
|
|
256
260
|
</p>
|
|
257
261
|
</CardHeader>
|
|
258
262
|
<CardContent>
|
|
@@ -267,33 +271,35 @@ export function ConfigPage() {
|
|
|
267
271
|
</CardContent>
|
|
268
272
|
</Card>
|
|
269
273
|
|
|
270
|
-
{/*
|
|
274
|
+
{/* Coding Agent List */}
|
|
271
275
|
<Card>
|
|
272
276
|
<CardHeader className="pb-3">
|
|
273
277
|
<p className="text-xs font-medium uppercase tracking-wider text-muted-foreground">
|
|
274
|
-
Registered
|
|
278
|
+
Registered Coding Agents
|
|
275
279
|
</p>
|
|
276
|
-
<h3 className="mt-1 text-lg font-semibold"
|
|
280
|
+
<h3 className="mt-1 text-lg font-semibold">
|
|
281
|
+
登録済み Coding Agent
|
|
282
|
+
</h3>
|
|
277
283
|
<p className="mt-2 text-sm text-muted-foreground">
|
|
278
|
-
CLI と Web UI は同じ設定を参照します。更新すると
|
|
279
|
-
|
|
284
|
+
CLI と Web UI は同じ設定を参照します。更新すると ~/.gwt/tools.json
|
|
285
|
+
に保存されます。
|
|
280
286
|
</p>
|
|
281
287
|
</CardHeader>
|
|
282
288
|
<CardContent>
|
|
283
|
-
<
|
|
284
|
-
|
|
289
|
+
<CustomCodingAgentList
|
|
290
|
+
agents={sortedAgents}
|
|
285
291
|
onEdit={handleEdit}
|
|
286
292
|
onDelete={handleDelete}
|
|
287
293
|
/>
|
|
288
294
|
</CardContent>
|
|
289
295
|
</Card>
|
|
290
296
|
|
|
291
|
-
{/*
|
|
292
|
-
{(isCreating ||
|
|
297
|
+
{/* Coding Agent Form */}
|
|
298
|
+
{(isCreating || editingAgent) && (
|
|
293
299
|
<Card>
|
|
294
300
|
<CardContent className="pt-6">
|
|
295
|
-
<
|
|
296
|
-
{...(
|
|
301
|
+
<CustomCodingAgentForm
|
|
302
|
+
{...(activeFormAgent ? { initialValue: activeFormAgent } : {})}
|
|
297
303
|
onSubmit={handleFormSubmit}
|
|
298
304
|
onCancel={handleCancel}
|
|
299
305
|
isSaving={updateConfig.isPending}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
loadCodingAgentsConfig,
|
|
3
|
+
saveCodingAgentsConfig,
|
|
4
|
+
} from "../../../config/tools.js";
|
|
2
5
|
import { recordEnvHistory } from "../../../config/env-history.js";
|
|
3
6
|
import type { EnvironmentHistoryEntry } from "../../../types/api.js";
|
|
4
7
|
import { createLogger } from "../../../logging/logger.js";
|
|
@@ -18,7 +21,7 @@ const IMPORTABLE_KEYS = [
|
|
|
18
21
|
const importedKeySet = new Set<string>();
|
|
19
22
|
|
|
20
23
|
export async function importOsEnvIntoSharedConfig(): Promise<string[]> {
|
|
21
|
-
const config = await
|
|
24
|
+
const config = await loadCodingAgentsConfig();
|
|
22
25
|
const sharedEnv = { ...(config.env ?? {}) };
|
|
23
26
|
const importedKeys: string[] = [];
|
|
24
27
|
|
|
@@ -36,7 +39,7 @@ export async function importOsEnvIntoSharedConfig(): Promise<string[]> {
|
|
|
36
39
|
return [];
|
|
37
40
|
}
|
|
38
41
|
|
|
39
|
-
await
|
|
42
|
+
await saveCodingAgentsConfig({
|
|
40
43
|
...config,
|
|
41
44
|
env: sharedEnv,
|
|
42
45
|
});
|