@akiojin/gwt 4.9.0 → 4.10.0
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 +27 -9
- package/dist/cli/ui/components/App.js.map +1 -1
- package/dist/cli/ui/components/screens/BranchQuickStartScreen.d.ts +1 -1
- package/dist/cli/ui/components/screens/BranchQuickStartScreen.d.ts.map +1 -1
- package/dist/cli/ui/components/screens/BranchQuickStartScreen.js +4 -1
- package/dist/cli/ui/components/screens/BranchQuickStartScreen.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 +27 -0
- package/dist/config/builtin-coding-agents.d.ts.map +1 -0
- package/dist/config/{builtin-tools.js → builtin-coding-agents.js} +21 -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 +92 -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/utils/command.d.ts.map +1 -1
- package/dist/utils/command.js +9 -0
- package/dist/utils/command.js.map +1 -1
- package/dist/utils/session/index.d.ts +5 -3
- package/dist/utils/session/index.d.ts.map +1 -1
- package/dist/utils/session/index.js +5 -2
- package/dist/utils/session/index.js.map +1 -1
- package/dist/utils/session/parsers/index.d.ts +1 -0
- package/dist/utils/session/parsers/index.d.ts.map +1 -1
- package/dist/utils/session/parsers/index.js +2 -0
- package/dist/utils/session/parsers/index.js.map +1 -1
- package/dist/utils/session/parsers/opencode.d.ts +23 -0
- package/dist/utils/session/parsers/opencode.d.ts.map +1 -0
- package/dist/utils/session/parsers/opencode.js +89 -0
- package/dist/utils/session/parsers/opencode.js.map +1 -0
- package/dist/utils/session/types.d.ts +4 -0
- package/dist/utils/session/types.d.ts.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 +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 +44 -20
- package/src/cli/ui/components/screens/BranchQuickStartScreen.tsx +6 -3
- 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} +25 -9
- package/src/config/tools.ts +120 -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/utils/command.ts +9 -0
- package/src/utils/session/index.ts +10 -2
- package/src/utils/session/parsers/index.ts +6 -0
- package/src/utils/session/parsers/opencode.ts +110 -0
- package/src/utils/session/types.ts +5 -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 +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/dist/client/index.html
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<title>gwt - Web UI</title>
|
|
7
|
-
<script type="module" crossorigin src="/assets/index-
|
|
7
|
+
<script type="module" crossorigin src="/assets/index-LNPtOrn3.js"></script>
|
|
8
8
|
<link rel="stylesheet" crossorigin href="/assets/index-ChHC-Puh.css">
|
|
9
9
|
</head>
|
|
10
10
|
<body>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ビルトインコーディングエージェント定義
|
|
3
|
+
*
|
|
4
|
+
* Claude Code、Codex、Gemini の CodingAgent 形式定義
|
|
5
|
+
*/
|
|
6
|
+
import type { CodingAgent } from "../types/tools.js";
|
|
7
|
+
/**
|
|
8
|
+
* Claude Code のビルトイン定義
|
|
9
|
+
*/
|
|
10
|
+
export declare const CLAUDE_CODE_TOOL: CodingAgent;
|
|
11
|
+
/**
|
|
12
|
+
* Codex のビルトイン定義
|
|
13
|
+
*/
|
|
14
|
+
export declare const CODEX_CLI_TOOL: CodingAgent;
|
|
15
|
+
/**
|
|
16
|
+
* Gemini のビルトイン定義
|
|
17
|
+
*/
|
|
18
|
+
export declare const GEMINI_CLI_TOOL: CodingAgent;
|
|
19
|
+
/**
|
|
20
|
+
* OpenCode のビルトイン定義
|
|
21
|
+
*/
|
|
22
|
+
export declare const OPENCODE_TOOL: CodingAgent;
|
|
23
|
+
/**
|
|
24
|
+
* すべてのビルトインコーディングエージェント
|
|
25
|
+
*/
|
|
26
|
+
export declare const BUILTIN_CODING_AGENTS: CodingAgent[];
|
|
27
|
+
//# sourceMappingURL=builtin-coding-agents.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"builtin-coding-agents.d.ts","sourceRoot":"","sources":["../../src/config/builtin-coding-agents.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAMrD;;GAEG;AACH,eAAO,MAAM,gBAAgB,EAAE,WAc9B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,WAW5B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,WAW7B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,aAAa,EAAE,WAU3B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,qBAAqB,EAAE,WAAW,EAK9C,CAAC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* ビルトインコーディングエージェント定義
|
|
3
3
|
*
|
|
4
|
-
* Claude Code、Codex、Gemini の
|
|
4
|
+
* Claude Code、Codex、Gemini の CodingAgent 形式定義
|
|
5
5
|
*/
|
|
6
|
-
import { CLAUDE_PERMISSION_SKIP_ARGS, CODEX_DEFAULT_ARGS, } from "../shared/
|
|
6
|
+
import { CLAUDE_PERMISSION_SKIP_ARGS, CODEX_DEFAULT_ARGS, } from "../shared/codingAgentConstants.js";
|
|
7
7
|
/**
|
|
8
8
|
* Claude Code のビルトイン定義
|
|
9
9
|
*/
|
|
@@ -53,11 +53,26 @@ export const GEMINI_CLI_TOOL = {
|
|
|
53
53
|
permissionSkipArgs: ["-y"],
|
|
54
54
|
};
|
|
55
55
|
/**
|
|
56
|
-
*
|
|
56
|
+
* OpenCode のビルトイン定義
|
|
57
57
|
*/
|
|
58
|
-
export const
|
|
58
|
+
export const OPENCODE_TOOL = {
|
|
59
|
+
id: "opencode",
|
|
60
|
+
displayName: "OpenCode",
|
|
61
|
+
type: "bunx",
|
|
62
|
+
command: "opencode-ai@latest",
|
|
63
|
+
modeArgs: {
|
|
64
|
+
normal: [],
|
|
65
|
+
continue: ["-c"],
|
|
66
|
+
resume: ["-s"],
|
|
67
|
+
},
|
|
68
|
+
};
|
|
69
|
+
/**
|
|
70
|
+
* すべてのビルトインコーディングエージェント
|
|
71
|
+
*/
|
|
72
|
+
export const BUILTIN_CODING_AGENTS = [
|
|
59
73
|
CLAUDE_CODE_TOOL,
|
|
60
74
|
CODEX_CLI_TOOL,
|
|
61
75
|
GEMINI_CLI_TOOL,
|
|
76
|
+
OPENCODE_TOOL,
|
|
62
77
|
];
|
|
63
|
-
//# sourceMappingURL=builtin-
|
|
78
|
+
//# sourceMappingURL=builtin-coding-agents.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"builtin-coding-agents.js","sourceRoot":"","sources":["../../src/config/builtin-coding-agents.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EACL,2BAA2B,EAC3B,kBAAkB,GACnB,MAAM,mCAAmC,CAAC;AAE3C;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAgB;IAC3C,EAAE,EAAE,aAAa;IACjB,WAAW,EAAE,aAAa;IAC1B,IAAI,EAAE,MAAM;IACZ,OAAO,EAAE,kCAAkC;IAC3C,QAAQ,EAAE;QACR,MAAM,EAAE,EAAE;QACV,QAAQ,EAAE,CAAC,IAAI,CAAC;QAChB,MAAM,EAAE,CAAC,IAAI,CAAC;KACf;IACD,kBAAkB,EAAE,KAAK,CAAC,IAAI,CAAC,2BAA2B,CAAC;IA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|
|
2
|
+
* コーディングエージェント設定管理
|
|
3
3
|
*
|
|
4
4
|
* ~/.gwt/tools.jsonから設定を読み込み、
|
|
5
|
-
*
|
|
5
|
+
* ビルトインエージェントと統合して管理します。
|
|
6
6
|
*/
|
|
7
|
-
import type {
|
|
7
|
+
import type { CodingAgentsConfig, CodingAgent, CodingAgentConfig } from "../types/tools.js";
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
9
|
+
* コーディングエージェント設定ファイルのパス
|
|
10
10
|
* 環境変数 GWT_HOME が設定されている場合はそれを使用、それ以外はホームディレクトリ
|
|
11
11
|
*/
|
|
12
12
|
export declare const WORKTREE_HOME: string;
|
|
13
13
|
export declare const CONFIG_DIR: string;
|
|
14
14
|
export declare const TOOLS_CONFIG_PATH: string;
|
|
15
15
|
/**
|
|
16
|
-
*
|
|
16
|
+
* コーディングエージェント設定を読み込む
|
|
17
17
|
*
|
|
18
18
|
* ~/.gwt/tools.jsonから設定を読み込みます。
|
|
19
19
|
* ファイルが存在しない場合は空配列を返します。
|
|
20
20
|
*
|
|
21
|
-
* @returns
|
|
21
|
+
* @returns CodingAgentsConfig
|
|
22
22
|
* @throws JSON構文エラー時
|
|
23
23
|
*/
|
|
24
|
-
export declare function
|
|
25
|
-
export declare function
|
|
24
|
+
export declare function loadCodingAgentsConfig(): Promise<CodingAgentsConfig>;
|
|
25
|
+
export declare function saveCodingAgentsConfig(config: CodingAgentsConfig): Promise<void>;
|
|
26
26
|
/**
|
|
27
27
|
* 共有環境変数を取得
|
|
28
28
|
*
|
|
29
|
-
*
|
|
29
|
+
* コーディングエージェント起動時に適用される環境変数を返します。
|
|
30
30
|
* マージ優先順位(後勝ち):
|
|
31
31
|
* 1. tools.json の env フィールド
|
|
32
32
|
* 2. profiles.yaml のアクティブプロファイル
|
|
@@ -35,16 +35,16 @@ export declare function saveToolsConfig(config: ToolsConfig): Promise<void>;
|
|
|
35
35
|
*/
|
|
36
36
|
export declare function getSharedEnvironment(): Promise<Record<string, string>>;
|
|
37
37
|
/**
|
|
38
|
-
* ID
|
|
38
|
+
* IDでコーディングエージェントを検索
|
|
39
39
|
*
|
|
40
|
-
* @param id -
|
|
41
|
-
* @returns
|
|
40
|
+
* @param id - エージェントID
|
|
41
|
+
* @returns エージェント設定(見つからない場合はundefined)
|
|
42
42
|
*/
|
|
43
|
-
export declare function
|
|
43
|
+
export declare function getCodingAgentById(id: string): Promise<CodingAgent | undefined>;
|
|
44
44
|
/**
|
|
45
|
-
*
|
|
45
|
+
* すべてのコーディングエージェント(ビルトイン+カスタム)を取得
|
|
46
46
|
*
|
|
47
|
-
* @returns
|
|
47
|
+
* @returns CodingAgentConfigの配列
|
|
48
48
|
*/
|
|
49
|
-
export declare function
|
|
49
|
+
export declare function getAllCodingAgents(): Promise<CodingAgentConfig[]>;
|
|
50
50
|
//# sourceMappingURL=tools.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../src/config/tools.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,KAAK,EACV,WAAW,EACX,
|
|
1
|
+
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../src/config/tools.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,KAAK,EACV,kBAAkB,EAClB,WAAW,EACX,iBAAiB,EAClB,MAAM,mBAAmB,CAAC;AAO3B;;;GAGG;AACH,eAAO,MAAM,aAAa,QAGX,CAAC;AAEhB,eAAO,MAAM,UAAU,QAAmC,CAAC;AAC3D,eAAO,MAAM,iBAAiB,QAAsC,CAAC;AASrE;;;;;;;;GAQG;AACH,wBAAsB,sBAAsB,IAAI,OAAO,CAAC,kBAAkB,CAAC,CA6D1E;AA2DD,wBAAsB,sBAAsB,CAC1C,MAAM,EAAE,kBAAkB,GACzB,OAAO,CAAC,IAAI,CAAC,CAcf;AAED;;;;;;;;;GASG;AACH,wBAAsB,oBAAoB,IAAI,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAU5E;AAsDD;;;;;GAKG;AACH,wBAAsB,kBAAkB,CACtC,EAAE,EAAE,MAAM,GACT,OAAO,CAAC,WAAW,GAAG,SAAS,CAAC,CAgBlC;AAED;;;;GAIG;AACH,wBAAsB,kBAAkB,IAAI,OAAO,CAAC,iBAAiB,EAAE,CAAC,CA0BvE"}
|
package/dist/config/tools.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* コーディングエージェント設定管理
|
|
3
3
|
*
|
|
4
4
|
* ~/.gwt/tools.jsonから設定を読み込み、
|
|
5
|
-
*
|
|
5
|
+
* ビルトインエージェントと統合して管理します。
|
|
6
6
|
*/
|
|
7
7
|
import { homedir } from "node:os";
|
|
8
8
|
import path from "node:path";
|
|
9
9
|
import { readFile, writeFile, mkdir, rename } from "node:fs/promises";
|
|
10
|
-
import {
|
|
10
|
+
import { BUILTIN_CODING_AGENTS } from "./builtin-coding-agents.js";
|
|
11
11
|
import { createLogger } from "../logging/logger.js";
|
|
12
12
|
import { resolveProfileEnv } from "./profiles.js";
|
|
13
13
|
const logger = createLogger({ category: "config" });
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
15
|
+
* コーディングエージェント設定ファイルのパス
|
|
16
16
|
* 環境変数 GWT_HOME が設定されている場合はそれを使用、それ以外はホームディレクトリ
|
|
17
17
|
*/
|
|
18
18
|
export const WORKTREE_HOME = process.env.GWT_HOME && process.env.GWT_HOME.trim().length > 0
|
|
@@ -24,24 +24,38 @@ const TEMP_CONFIG_PATH = `${TOOLS_CONFIG_PATH}.tmp`;
|
|
|
24
24
|
const DEFAULT_CONFIG = {
|
|
25
25
|
version: "1.0.0",
|
|
26
26
|
env: {},
|
|
27
|
-
|
|
27
|
+
customCodingAgents: [],
|
|
28
28
|
};
|
|
29
29
|
/**
|
|
30
|
-
*
|
|
30
|
+
* コーディングエージェント設定を読み込む
|
|
31
31
|
*
|
|
32
32
|
* ~/.gwt/tools.jsonから設定を読み込みます。
|
|
33
33
|
* ファイルが存在しない場合は空配列を返します。
|
|
34
34
|
*
|
|
35
|
-
* @returns
|
|
35
|
+
* @returns CodingAgentsConfig
|
|
36
36
|
* @throws JSON構文エラー時
|
|
37
37
|
*/
|
|
38
|
-
export async function
|
|
38
|
+
export async function loadCodingAgentsConfig() {
|
|
39
39
|
try {
|
|
40
40
|
const content = await readFile(TOOLS_CONFIG_PATH, "utf-8");
|
|
41
41
|
const config = JSON.parse(content);
|
|
42
|
+
// マイグレーション: customTools → customCodingAgents (後方互換性)
|
|
43
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
44
|
+
const legacyConfig = config;
|
|
45
|
+
if (!config.customCodingAgents && legacyConfig.customTools) {
|
|
46
|
+
config.customCodingAgents = legacyConfig.customTools;
|
|
47
|
+
logger.warn({ path: TOOLS_CONFIG_PATH }, "Migrating deprecated 'customTools' to 'customCodingAgents'");
|
|
48
|
+
}
|
|
49
|
+
// フォールバック: undefined/null → 空配列
|
|
50
|
+
if (!config.customCodingAgents) {
|
|
51
|
+
config.customCodingAgents = [];
|
|
52
|
+
}
|
|
42
53
|
// 検証
|
|
43
|
-
|
|
44
|
-
logger.debug({
|
|
54
|
+
validateCodingAgentsConfig(config);
|
|
55
|
+
logger.debug({
|
|
56
|
+
path: TOOLS_CONFIG_PATH,
|
|
57
|
+
agentCount: config.customCodingAgents.length,
|
|
58
|
+
}, "Coding agents config loaded");
|
|
45
59
|
return {
|
|
46
60
|
...config,
|
|
47
61
|
env: config.env ?? {},
|
|
@@ -50,12 +64,12 @@ export async function loadToolsConfig() {
|
|
|
50
64
|
catch (error) {
|
|
51
65
|
// ファイルが存在しない場合は空配列を返す
|
|
52
66
|
if (error instanceof Error && "code" in error && error.code === "ENOENT") {
|
|
53
|
-
logger.debug({ path: TOOLS_CONFIG_PATH }, "
|
|
67
|
+
logger.debug({ path: TOOLS_CONFIG_PATH }, "Coding agents config not found, using defaults");
|
|
54
68
|
return { ...DEFAULT_CONFIG };
|
|
55
69
|
}
|
|
56
70
|
// JSON構文エラーの場合
|
|
57
71
|
if (error instanceof SyntaxError) {
|
|
58
|
-
logger.error({ path: TOOLS_CONFIG_PATH, error: error.message }, "
|
|
72
|
+
logger.error({ path: TOOLS_CONFIG_PATH, error: error.message }, "Coding agents config parse error");
|
|
59
73
|
throw new Error(`Failed to parse tools.json: ${error.message}\n` +
|
|
60
74
|
`Please check the JSON syntax in ${TOOLS_CONFIG_PATH}`);
|
|
61
75
|
}
|
|
@@ -64,19 +78,19 @@ export async function loadToolsConfig() {
|
|
|
64
78
|
}
|
|
65
79
|
}
|
|
66
80
|
/**
|
|
67
|
-
*
|
|
81
|
+
* CodingAgentsConfig全体を検証
|
|
68
82
|
*
|
|
69
83
|
* @param config - 検証対象の設定
|
|
70
84
|
* @throws 検証エラー時
|
|
71
85
|
*/
|
|
72
|
-
function
|
|
86
|
+
function validateCodingAgentsConfig(config) {
|
|
73
87
|
// versionフィールドの検証
|
|
74
88
|
if (!config.version || typeof config.version !== "string") {
|
|
75
89
|
throw new Error("version field is required and must be a string");
|
|
76
90
|
}
|
|
77
|
-
//
|
|
78
|
-
if (!Array.isArray(config.
|
|
79
|
-
throw new Error("
|
|
91
|
+
// customCodingAgentsフィールドの検証
|
|
92
|
+
if (!Array.isArray(config.customCodingAgents)) {
|
|
93
|
+
throw new Error("customCodingAgents field must be an array");
|
|
80
94
|
}
|
|
81
95
|
if (config.env && typeof config.env !== "object") {
|
|
82
96
|
throw new Error("env field must be an object map of key/value pairs");
|
|
@@ -91,32 +105,32 @@ function validateToolsConfig(config) {
|
|
|
91
105
|
}
|
|
92
106
|
}
|
|
93
107
|
}
|
|
94
|
-
//
|
|
108
|
+
// 各エージェントの検証
|
|
95
109
|
const seenIds = new Set();
|
|
96
|
-
for (const
|
|
97
|
-
|
|
110
|
+
for (const agent of config.customCodingAgents) {
|
|
111
|
+
validateCodingAgent(agent);
|
|
98
112
|
// ID重複チェック
|
|
99
|
-
if (seenIds.has(
|
|
100
|
-
throw new Error(`Duplicate
|
|
101
|
-
`Each
|
|
113
|
+
if (seenIds.has(agent.id)) {
|
|
114
|
+
throw new Error(`Duplicate agent ID found: "${agent.id}"\n` +
|
|
115
|
+
`Each agent must have a unique ID in ${TOOLS_CONFIG_PATH}`);
|
|
102
116
|
}
|
|
103
|
-
seenIds.add(
|
|
104
|
-
//
|
|
105
|
-
const builtinIds =
|
|
106
|
-
if (builtinIds.includes(
|
|
107
|
-
throw new Error(`
|
|
108
|
-
`Builtin
|
|
117
|
+
seenIds.add(agent.id);
|
|
118
|
+
// ビルトインエージェントとのID重複チェック
|
|
119
|
+
const builtinIds = BUILTIN_CODING_AGENTS.map((t) => t.id);
|
|
120
|
+
if (builtinIds.includes(agent.id)) {
|
|
121
|
+
throw new Error(`Agent ID "${agent.id}" conflicts with builtin agent\n` +
|
|
122
|
+
`Builtin agent IDs: ${builtinIds.join(", ")}`);
|
|
109
123
|
}
|
|
110
124
|
}
|
|
111
125
|
}
|
|
112
|
-
export async function
|
|
126
|
+
export async function saveCodingAgentsConfig(config) {
|
|
113
127
|
const normalized = {
|
|
114
128
|
version: config.version,
|
|
115
129
|
updatedAt: config.updatedAt ?? new Date().toISOString(),
|
|
116
130
|
env: config.env ?? {},
|
|
117
|
-
|
|
131
|
+
customCodingAgents: config.customCodingAgents,
|
|
118
132
|
};
|
|
119
|
-
|
|
133
|
+
validateCodingAgentsConfig(normalized);
|
|
120
134
|
await mkdir(CONFIG_DIR, { recursive: true });
|
|
121
135
|
const payload = JSON.stringify(normalized, null, 2);
|
|
122
136
|
await writeFile(TEMP_CONFIG_PATH, payload, { mode: 0o600 });
|
|
@@ -125,7 +139,7 @@ export async function saveToolsConfig(config) {
|
|
|
125
139
|
/**
|
|
126
140
|
* 共有環境変数を取得
|
|
127
141
|
*
|
|
128
|
-
*
|
|
142
|
+
* コーディングエージェント起動時に適用される環境変数を返します。
|
|
129
143
|
* マージ優先順位(後勝ち):
|
|
130
144
|
* 1. tools.json の env フィールド
|
|
131
145
|
* 2. profiles.yaml のアクティブプロファイル
|
|
@@ -134,7 +148,7 @@ export async function saveToolsConfig(config) {
|
|
|
134
148
|
*/
|
|
135
149
|
export async function getSharedEnvironment() {
|
|
136
150
|
const [config, profileEnv] = await Promise.all([
|
|
137
|
-
|
|
151
|
+
loadCodingAgentsConfig(),
|
|
138
152
|
resolveProfileEnv(),
|
|
139
153
|
]);
|
|
140
154
|
return {
|
|
@@ -143,81 +157,81 @@ export async function getSharedEnvironment() {
|
|
|
143
157
|
};
|
|
144
158
|
}
|
|
145
159
|
/**
|
|
146
|
-
*
|
|
160
|
+
* CodingAgent単体を検証
|
|
147
161
|
*
|
|
148
|
-
* @param
|
|
162
|
+
* @param agent - 検証対象のエージェント
|
|
149
163
|
* @throws 検証エラー時
|
|
150
164
|
*/
|
|
151
|
-
function
|
|
165
|
+
function validateCodingAgent(agent) {
|
|
152
166
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
153
|
-
const
|
|
167
|
+
const a = agent;
|
|
154
168
|
// 必須フィールドの存在チェック
|
|
155
169
|
const requiredFields = ["id", "displayName", "type", "command", "modeArgs"];
|
|
156
170
|
for (const field of requiredFields) {
|
|
157
|
-
if (!
|
|
158
|
-
throw new Error(`Required field "${field}" is missing in
|
|
171
|
+
if (!a[field]) {
|
|
172
|
+
throw new Error(`Required field "${field}" is missing in agent configuration`);
|
|
159
173
|
}
|
|
160
174
|
}
|
|
161
175
|
// id形式の検証(小文字英数字とハイフンのみ)
|
|
162
|
-
if (!/^[a-z0-9-]+$/.test(
|
|
163
|
-
throw new Error(`Invalid
|
|
164
|
-
`
|
|
176
|
+
if (!/^[a-z0-9-]+$/.test(a.id)) {
|
|
177
|
+
throw new Error(`Invalid agent ID format: "${a.id}"\n` +
|
|
178
|
+
`Agent ID must contain only lowercase letters, numbers, and hyphens (pattern: ^[a-z0-9-]+$)`);
|
|
165
179
|
}
|
|
166
180
|
// typeフィールドの値検証
|
|
167
181
|
const validTypes = ["path", "bunx", "command"];
|
|
168
|
-
if (!validTypes.includes(
|
|
169
|
-
throw new Error(`Invalid type: "${
|
|
182
|
+
if (!validTypes.includes(a.type)) {
|
|
183
|
+
throw new Error(`Invalid type: "${a.type}"\n` +
|
|
170
184
|
`Type must be one of: ${validTypes.join(", ")}`);
|
|
171
185
|
}
|
|
172
186
|
// type='path'の場合、commandが絶対パスであることを確認
|
|
173
|
-
if (
|
|
174
|
-
throw new Error(`For type="path", command must be an absolute path: "${
|
|
187
|
+
if (a.type === "path" && !path.isAbsolute(a.command)) {
|
|
188
|
+
throw new Error(`For type="path", command must be an absolute path: "${a.command}"`);
|
|
175
189
|
}
|
|
176
190
|
// modeArgsの検証(少なくとも1つのモードが定義されている)
|
|
177
|
-
if (!
|
|
178
|
-
throw new Error(`modeArgs must define at least one mode (normal, continue, or resume) for
|
|
191
|
+
if (!a.modeArgs.normal && !a.modeArgs.continue && !a.modeArgs.resume) {
|
|
192
|
+
throw new Error(`modeArgs must define at least one mode (normal, continue, or resume) for agent "${a.id}"`);
|
|
179
193
|
}
|
|
180
194
|
}
|
|
181
195
|
/**
|
|
182
|
-
* ID
|
|
196
|
+
* IDでコーディングエージェントを検索
|
|
183
197
|
*
|
|
184
|
-
* @param id -
|
|
185
|
-
* @returns
|
|
198
|
+
* @param id - エージェントID
|
|
199
|
+
* @returns エージェント設定(見つからない場合はundefined)
|
|
186
200
|
*/
|
|
187
|
-
export async function
|
|
188
|
-
//
|
|
189
|
-
const
|
|
190
|
-
if (
|
|
191
|
-
logger.debug({ id, found: true, isBuiltin: true }, "
|
|
192
|
-
return
|
|
201
|
+
export async function getCodingAgentById(id) {
|
|
202
|
+
// ビルトインエージェントから検索
|
|
203
|
+
const builtinAgent = BUILTIN_CODING_AGENTS.find((a) => a.id === id);
|
|
204
|
+
if (builtinAgent) {
|
|
205
|
+
logger.debug({ id, found: true, isBuiltin: true }, "Coding agent lookup");
|
|
206
|
+
return builtinAgent;
|
|
193
207
|
}
|
|
194
|
-
//
|
|
195
|
-
const config = await
|
|
196
|
-
const
|
|
197
|
-
logger.debug({ id, found: !!
|
|
198
|
-
return
|
|
208
|
+
// カスタムエージェントから検索
|
|
209
|
+
const config = await loadCodingAgentsConfig();
|
|
210
|
+
const customAgent = config.customCodingAgents.find((a) => a.id === id);
|
|
211
|
+
logger.debug({ id, found: !!customAgent, isBuiltin: false }, "Coding agent lookup");
|
|
212
|
+
return customAgent;
|
|
199
213
|
}
|
|
200
214
|
/**
|
|
201
|
-
*
|
|
215
|
+
* すべてのコーディングエージェント(ビルトイン+カスタム)を取得
|
|
202
216
|
*
|
|
203
|
-
* @returns
|
|
217
|
+
* @returns CodingAgentConfigの配列
|
|
204
218
|
*/
|
|
205
|
-
export async function
|
|
206
|
-
const config = await
|
|
207
|
-
//
|
|
208
|
-
const builtinConfigs =
|
|
209
|
-
id:
|
|
210
|
-
displayName:
|
|
211
|
-
...(
|
|
219
|
+
export async function getAllCodingAgents() {
|
|
220
|
+
const config = await loadCodingAgentsConfig();
|
|
221
|
+
// ビルトインエージェントをCodingAgentConfig形式に変換
|
|
222
|
+
const builtinConfigs = BUILTIN_CODING_AGENTS.map((agent) => ({
|
|
223
|
+
id: agent.id,
|
|
224
|
+
displayName: agent.displayName,
|
|
225
|
+
...(agent.icon ? { icon: agent.icon } : {}),
|
|
212
226
|
isBuiltin: true,
|
|
213
227
|
}));
|
|
214
|
-
//
|
|
215
|
-
const customConfigs = config.
|
|
216
|
-
id:
|
|
217
|
-
displayName:
|
|
218
|
-
...(
|
|
228
|
+
// カスタムエージェントをCodingAgentConfig形式に変換
|
|
229
|
+
const customConfigs = config.customCodingAgents.map((agent) => ({
|
|
230
|
+
id: agent.id,
|
|
231
|
+
displayName: agent.displayName,
|
|
232
|
+
...(agent.icon ? { icon: agent.icon } : {}),
|
|
219
233
|
isBuiltin: false,
|
|
220
|
-
customConfig:
|
|
234
|
+
customConfig: agent,
|
|
221
235
|
}));
|
|
222
236
|
// ビルトイン + カスタム の順で統合
|
|
223
237
|
return [...builtinConfigs, ...customConfigs];
|
package/dist/config/tools.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tools.js","sourceRoot":"","sources":["../../src/config/tools.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAMtE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"tools.js","sourceRoot":"","sources":["../../src/config/tools.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAMtE,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAElD,MAAM,MAAM,GAAG,YAAY,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC,CAAC;AAEpD;;;GAGG;AACH,MAAM,CAAC,MAAM,aAAa,GACxB,OAAO,CAAC,GAAG,CAAC,QAAQ,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC;IAC5D,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ;IACtB,CAAC,CAAC,OAAO,EAAE,CAAC;AAEhB,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;A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,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC3C,SAAS,EAAE,KAAK;QAChB,YAAY,EAAE,KAAK;KACpB,CAAC,CACH,CAAC;IAEF,qBAAqB;IACrB,OAAO,CAAC,GAAG,cAAc,EAAE,GAAG,aAAa,CAAC,CAAC;AAC/C,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -10,8 +10,8 @@ import chalk from "chalk";
|
|
|
10
10
|
import { isProtectedBranchName, switchToProtectedBranch, WorktreeError, resolveWorktreePathForBranch, } from "./worktree.js";
|
|
11
11
|
import { getTerminalStreams, waitForUserAcknowledgement, } from "./utils/terminal.js";
|
|
12
12
|
import { createLogger } from "./logging/logger.js";
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
13
|
+
import { getCodingAgentById, getSharedEnvironment } from "./config/tools.js";
|
|
14
|
+
import { launchCodingAgent } from "./launcher.js";
|
|
15
15
|
import { saveSession, loadSession } from "./config/index.js";
|
|
16
16
|
import { findLatestCodexSession, findLatestClaudeSession, findLatestGeminiSession, } from "./utils/session.js";
|
|
17
17
|
import { getPackageVersion } from "./utils.js";
|
|
@@ -373,22 +373,22 @@ export async function handleAIToolWorkflow(selectionResult) {
|
|
|
373
373
|
else if (fastForwardError) {
|
|
374
374
|
printWarning(`Fast-forward pull could not complete (${fastForwardError.message}). Continuing without blocking.`);
|
|
375
375
|
}
|
|
376
|
-
// Get
|
|
377
|
-
const [
|
|
378
|
-
|
|
376
|
+
// Get coding agent definition and shared environment overrides
|
|
377
|
+
const [agentConfig, sharedEnv] = await Promise.all([
|
|
378
|
+
getCodingAgentById(tool),
|
|
379
379
|
getSharedEnvironment(),
|
|
380
380
|
]);
|
|
381
|
-
if (!
|
|
382
|
-
throw new Error(`
|
|
381
|
+
if (!agentConfig) {
|
|
382
|
+
throw new Error(`Coding agent not found: ${tool}`);
|
|
383
383
|
}
|
|
384
|
-
// Save selection immediately (including history) so "last
|
|
385
|
-
// even if the
|
|
386
|
-
// FR-042: Record timestamp to session history immediately on
|
|
384
|
+
// Save selection immediately (including history) so "last agent" is reflected
|
|
385
|
+
// even if the agent is interrupted or killed mid-run (e.g., Ctrl+C).
|
|
386
|
+
// FR-042: Record timestamp to session history immediately on agent start.
|
|
387
387
|
await saveSession({
|
|
388
388
|
lastWorktreePath: worktreePath,
|
|
389
389
|
lastBranch: branch,
|
|
390
390
|
lastUsedTool: tool,
|
|
391
|
-
toolLabel:
|
|
391
|
+
toolLabel: agentConfig.displayName ?? tool,
|
|
392
392
|
mode,
|
|
393
393
|
model: normalizedModel ?? null,
|
|
394
394
|
reasoningLevel: inferenceLevel ?? null,
|
|
@@ -426,7 +426,7 @@ export async function handleAIToolWorkflow(selectionResult) {
|
|
|
426
426
|
lastWorktreePath: worktreePath,
|
|
427
427
|
lastBranch: branch,
|
|
428
428
|
lastUsedTool: tool,
|
|
429
|
-
toolLabel:
|
|
429
|
+
toolLabel: agentConfig.displayName ?? tool,
|
|
430
430
|
mode,
|
|
431
431
|
model: normalizedModel ?? null,
|
|
432
432
|
reasoningLevel: inferenceLevel ?? null,
|
|
@@ -439,9 +439,9 @@ export async function handleAIToolWorkflow(selectionResult) {
|
|
|
439
439
|
// Ignore errors during periodic update
|
|
440
440
|
}
|
|
441
441
|
}, SESSION_UPDATE_INTERVAL_MS);
|
|
442
|
-
// Launch selected
|
|
443
|
-
// Builtin
|
|
444
|
-
// Custom
|
|
442
|
+
// Launch selected coding agent
|
|
443
|
+
// Builtin agents use their dedicated launch functions
|
|
444
|
+
// Custom agents use the generic launchCodingAgent function
|
|
445
445
|
let launchResult;
|
|
446
446
|
try {
|
|
447
447
|
if (tool === "claude-code") {
|
|
@@ -498,9 +498,9 @@ export async function handleAIToolWorkflow(selectionResult) {
|
|
|
498
498
|
launchResult = await launchGeminiCLI(worktreePath, launchOptions);
|
|
499
499
|
}
|
|
500
500
|
else {
|
|
501
|
-
// Custom
|
|
502
|
-
printInfo(`Launching custom
|
|
503
|
-
launchResult = await
|
|
501
|
+
// Custom coding agent
|
|
502
|
+
printInfo(`Launching custom agent: ${agentConfig.displayName}`);
|
|
503
|
+
launchResult = await launchCodingAgent(agentConfig, {
|
|
504
504
|
mode: mode === "resume"
|
|
505
505
|
? "resume"
|
|
506
506
|
: mode === "continue"
|
|
@@ -584,7 +584,7 @@ export async function handleAIToolWorkflow(selectionResult) {
|
|
|
584
584
|
lastWorktreePath: worktreePath,
|
|
585
585
|
lastBranch: branch,
|
|
586
586
|
lastUsedTool: tool,
|
|
587
|
-
toolLabel:
|
|
587
|
+
toolLabel: agentConfig.displayName ?? tool,
|
|
588
588
|
mode,
|
|
589
589
|
model: normalizedModel ?? null,
|
|
590
590
|
reasoningLevel: inferenceLevel ?? null,
|