@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
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { execa } from "execa";
|
|
2
|
-
import type {
|
|
2
|
+
import type { CodingAgent, CodingAgentLaunchOptions } from "../types/tools.js";
|
|
3
3
|
import { createLogger } from "../logging/logger.js";
|
|
4
4
|
|
|
5
|
-
const logger = createLogger({ category: "
|
|
5
|
+
const logger = createLogger({ category: "agent-resolver" });
|
|
6
6
|
|
|
7
|
-
export interface
|
|
7
|
+
export interface CodingAgentExecutionPlan {
|
|
8
8
|
command: string;
|
|
9
9
|
args: string[];
|
|
10
10
|
env?: NodeJS.ProcessEnv;
|
|
@@ -35,24 +35,24 @@ export async function resolveCommandPath(commandName: string): Promise<string> {
|
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
export function
|
|
39
|
-
|
|
40
|
-
options:
|
|
38
|
+
export function buildCodingAgentArgs(
|
|
39
|
+
agent: CodingAgent,
|
|
40
|
+
options: CodingAgentLaunchOptions = {},
|
|
41
41
|
): string[] {
|
|
42
42
|
const args: string[] = [];
|
|
43
43
|
|
|
44
|
-
if (
|
|
45
|
-
args.push(...
|
|
44
|
+
if (agent.defaultArgs?.length) {
|
|
45
|
+
args.push(...agent.defaultArgs);
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
const mode = options.mode ?? "normal";
|
|
49
|
-
const modeArgs =
|
|
49
|
+
const modeArgs = agent.modeArgs?.[mode];
|
|
50
50
|
if (modeArgs?.length) {
|
|
51
51
|
args.push(...modeArgs);
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
if (options.skipPermissions &&
|
|
55
|
-
args.push(...
|
|
54
|
+
if (options.skipPermissions && agent.permissionSkipArgs?.length) {
|
|
55
|
+
args.push(...agent.permissionSkipArgs);
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
if (options.extraArgs?.length) {
|
|
@@ -60,49 +60,54 @@ export function buildCustomToolArgs(
|
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
logger.debug(
|
|
63
|
-
{
|
|
64
|
-
"
|
|
63
|
+
{ agentId: agent.id, argsCount: args.length },
|
|
64
|
+
"Coding agent args built",
|
|
65
65
|
);
|
|
66
66
|
return args;
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
export async function
|
|
70
|
-
|
|
71
|
-
options:
|
|
72
|
-
): Promise<
|
|
73
|
-
const baseArgs =
|
|
74
|
-
const envOverrides: NodeJS.ProcessEnv | undefined =
|
|
75
|
-
? ({ ...
|
|
69
|
+
export async function prepareCodingAgentExecution(
|
|
70
|
+
agent: CodingAgent,
|
|
71
|
+
options: CodingAgentLaunchOptions = {},
|
|
72
|
+
): Promise<CodingAgentExecutionPlan> {
|
|
73
|
+
const baseArgs = buildCodingAgentArgs(agent, options);
|
|
74
|
+
const envOverrides: NodeJS.ProcessEnv | undefined = agent.env
|
|
75
|
+
? ({ ...agent.env } as NodeJS.ProcessEnv)
|
|
76
76
|
: undefined;
|
|
77
77
|
|
|
78
78
|
let command: string;
|
|
79
79
|
let args: string[];
|
|
80
80
|
|
|
81
|
-
switch (
|
|
81
|
+
switch (agent.type) {
|
|
82
82
|
case "path": {
|
|
83
|
-
command =
|
|
83
|
+
command = agent.command;
|
|
84
84
|
args = baseArgs;
|
|
85
85
|
break;
|
|
86
86
|
}
|
|
87
87
|
case "bunx": {
|
|
88
88
|
command = "bunx";
|
|
89
|
-
args = [
|
|
89
|
+
args = [agent.command, ...baseArgs];
|
|
90
90
|
break;
|
|
91
91
|
}
|
|
92
92
|
case "command": {
|
|
93
|
-
command = await resolveCommandPath(
|
|
93
|
+
command = await resolveCommandPath(agent.command);
|
|
94
94
|
args = baseArgs;
|
|
95
95
|
break;
|
|
96
96
|
}
|
|
97
97
|
default: {
|
|
98
|
-
const exhaustive: never =
|
|
99
|
-
throw new Error(`Unknown
|
|
98
|
+
const exhaustive: never = agent.type;
|
|
99
|
+
throw new Error(`Unknown coding agent type: ${exhaustive as string}`);
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
102
|
|
|
103
103
|
logger.debug(
|
|
104
|
-
{
|
|
105
|
-
|
|
104
|
+
{
|
|
105
|
+
agentId: agent.id,
|
|
106
|
+
agentType: agent.type,
|
|
107
|
+
command,
|
|
108
|
+
hasEnv: !!envOverrides,
|
|
109
|
+
},
|
|
110
|
+
"Coding agent execution prepared",
|
|
106
111
|
);
|
|
107
112
|
|
|
108
113
|
return {
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { execa } from "execa";
|
|
2
2
|
import { platform } from "os";
|
|
3
|
-
import {
|
|
4
|
-
import { CLAUDE_CODE_TOOL } from "../config/builtin-
|
|
3
|
+
import { getCodingAgentById } from "../config/tools.js";
|
|
4
|
+
import { CLAUDE_CODE_TOOL } from "../config/builtin-coding-agents.js";
|
|
5
5
|
import {
|
|
6
6
|
CODEX_DEFAULT_ARGS,
|
|
7
7
|
CLAUDE_PERMISSION_SKIP_ARGS,
|
|
8
|
-
} from "../shared/
|
|
9
|
-
import {
|
|
10
|
-
import type {
|
|
8
|
+
} from "../shared/codingAgentConstants.js";
|
|
9
|
+
import { prepareCodingAgentExecution } from "./codingAgentCommandResolver.js";
|
|
10
|
+
import type { CodingAgentLaunchOptions } from "../types/tools.js";
|
|
11
11
|
import { createLogger } from "../logging/logger.js";
|
|
12
12
|
|
|
13
13
|
const logger = createLogger({ category: "resolver" });
|
|
@@ -31,14 +31,14 @@ export interface ResolvedCommand {
|
|
|
31
31
|
env?: NodeJS.ProcessEnv;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
export class
|
|
34
|
+
export class CodingAgentResolutionError extends Error {
|
|
35
35
|
constructor(
|
|
36
36
|
public code: ResolverErrorCode,
|
|
37
37
|
message: string,
|
|
38
38
|
public hints?: string[],
|
|
39
39
|
) {
|
|
40
40
|
super(message);
|
|
41
|
-
this.name = "
|
|
41
|
+
this.name = "CodingAgentResolutionError";
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
|
|
@@ -78,7 +78,7 @@ async function ensureBunxAvailable(): Promise<void> {
|
|
|
78
78
|
bunxCheckPromise = (async () => {
|
|
79
79
|
const bunxExists = await commandExists("bunx");
|
|
80
80
|
if (!bunxExists) {
|
|
81
|
-
throw new
|
|
81
|
+
throw new CodingAgentResolutionError(
|
|
82
82
|
"BUNX_NOT_FOUND",
|
|
83
83
|
"bunx command not found. Install Bun 1.0+ so bunx is available on PATH.",
|
|
84
84
|
[
|
|
@@ -94,7 +94,7 @@ async function ensureBunxAvailable(): Promise<void> {
|
|
|
94
94
|
logger.debug({ bunVersion: version }, "Bun version detected");
|
|
95
95
|
const major = parseInt(version.split(".")[0] ?? "0", 10);
|
|
96
96
|
if (!Number.isFinite(major) || major < MIN_BUN_MAJOR) {
|
|
97
|
-
throw new
|
|
97
|
+
throw new CodingAgentResolutionError(
|
|
98
98
|
"BUN_TOO_OLD",
|
|
99
99
|
`Detected Bun ${version}. Bun ${MIN_BUN_MAJOR}.0+ is required for bunx fallback execution.`,
|
|
100
100
|
[
|
|
@@ -104,12 +104,12 @@ async function ensureBunxAvailable(): Promise<void> {
|
|
|
104
104
|
);
|
|
105
105
|
}
|
|
106
106
|
} catch (error: unknown) {
|
|
107
|
-
if (error instanceof
|
|
107
|
+
if (error instanceof CodingAgentResolutionError) {
|
|
108
108
|
throw error;
|
|
109
109
|
}
|
|
110
110
|
const err = error as NodeJS.ErrnoException;
|
|
111
111
|
if (err?.code === "ENOENT") {
|
|
112
|
-
throw new
|
|
112
|
+
throw new CodingAgentResolutionError(
|
|
113
113
|
"BUNX_NOT_FOUND",
|
|
114
114
|
"bun command not found while verifying bunx. Install Bun 1.0+ and ensure it is on PATH.",
|
|
115
115
|
[
|
|
@@ -118,7 +118,7 @@ async function ensureBunxAvailable(): Promise<void> {
|
|
|
118
118
|
],
|
|
119
119
|
);
|
|
120
120
|
}
|
|
121
|
-
throw new
|
|
121
|
+
throw new CodingAgentResolutionError(
|
|
122
122
|
"BUN_TOO_OLD",
|
|
123
123
|
`Failed to verify Bun version: ${err?.message ?? "unknown error"}`,
|
|
124
124
|
);
|
|
@@ -274,37 +274,37 @@ export async function resolveCodexCommand(
|
|
|
274
274
|
};
|
|
275
275
|
}
|
|
276
276
|
|
|
277
|
-
export interface
|
|
278
|
-
|
|
277
|
+
export interface CodingAgentCommandOptions extends CodingAgentLaunchOptions {
|
|
278
|
+
agentId: string;
|
|
279
279
|
}
|
|
280
280
|
|
|
281
|
-
export async function
|
|
282
|
-
options:
|
|
281
|
+
export async function resolveCodingAgentCommand(
|
|
282
|
+
options: CodingAgentCommandOptions,
|
|
283
283
|
): Promise<ResolvedCommand> {
|
|
284
|
-
const
|
|
285
|
-
if (!
|
|
286
|
-
logger.error({
|
|
287
|
-
throw new
|
|
284
|
+
const agent = await getCodingAgentById(options.agentId);
|
|
285
|
+
if (!agent) {
|
|
286
|
+
logger.error({ agentId: options.agentId }, "Coding agent not found");
|
|
287
|
+
throw new CodingAgentResolutionError(
|
|
288
288
|
"CUSTOM_TOOL_NOT_FOUND",
|
|
289
|
-
`
|
|
289
|
+
`Coding agent not found: ${options.agentId}`,
|
|
290
290
|
[
|
|
291
291
|
"Update ~/.gwt/tools.json to include this ID",
|
|
292
|
-
"Reload the Web UI after editing the
|
|
292
|
+
"Reload the Web UI after editing the agents list",
|
|
293
293
|
],
|
|
294
294
|
);
|
|
295
295
|
}
|
|
296
296
|
|
|
297
|
-
const execution = await
|
|
297
|
+
const execution = await prepareCodingAgentExecution(agent, options);
|
|
298
298
|
|
|
299
299
|
logger.info(
|
|
300
|
-
{
|
|
301
|
-
"
|
|
300
|
+
{ agentId: options.agentId, command: execution.command },
|
|
301
|
+
"Coding agent command resolved",
|
|
302
302
|
);
|
|
303
303
|
|
|
304
304
|
return {
|
|
305
305
|
command: execution.command,
|
|
306
306
|
args: execution.args,
|
|
307
|
-
usesFallback:
|
|
307
|
+
usesFallback: agent.type === "bunx",
|
|
308
308
|
...(execution.env ? { env: execution.env } : {}),
|
|
309
309
|
};
|
|
310
310
|
}
|
|
@@ -314,7 +314,7 @@ export async function isClaudeCodeAvailable(): Promise<boolean> {
|
|
|
314
314
|
await resolveClaudeCommand();
|
|
315
315
|
return true;
|
|
316
316
|
} catch (error) {
|
|
317
|
-
if (error instanceof
|
|
317
|
+
if (error instanceof CodingAgentResolutionError) {
|
|
318
318
|
return false;
|
|
319
319
|
}
|
|
320
320
|
return false;
|
|
@@ -326,7 +326,7 @@ export async function isCodexAvailable(): Promise<boolean> {
|
|
|
326
326
|
await resolveCodexCommand();
|
|
327
327
|
return true;
|
|
328
328
|
} catch (error) {
|
|
329
|
-
if (error instanceof
|
|
329
|
+
if (error instanceof CodingAgentResolutionError) {
|
|
330
330
|
return false;
|
|
331
331
|
}
|
|
332
332
|
return false;
|
package/src/types/api.ts
CHANGED
|
@@ -51,12 +51,12 @@ export interface Worktree {
|
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
/**
|
|
54
|
-
*
|
|
54
|
+
* CodingAgentSession - Coding Agent実行セッション
|
|
55
55
|
*/
|
|
56
|
-
export interface
|
|
56
|
+
export interface CodingAgentSession {
|
|
57
57
|
sessionId: string; // UUID v4
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
agentType: "claude-code" | "codex-cli" | "custom";
|
|
59
|
+
agentName?: string | null;
|
|
60
60
|
mode: "normal" | "continue" | "resume";
|
|
61
61
|
worktreePath: string;
|
|
62
62
|
ptyPid?: number | null;
|
|
@@ -69,7 +69,7 @@ export interface AIToolSession {
|
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
/**
|
|
72
|
-
*
|
|
72
|
+
* CodingAgent - カスタム Coding Agent 設定
|
|
73
73
|
*/
|
|
74
74
|
export interface EnvironmentVariable {
|
|
75
75
|
key: string;
|
|
@@ -85,7 +85,7 @@ export interface EnvironmentHistoryEntry {
|
|
|
85
85
|
source: "ui" | "os" | "cli";
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
-
export interface
|
|
88
|
+
export interface ApiCodingAgent {
|
|
89
89
|
id: string; // UUID v4 or slug
|
|
90
90
|
displayName: string;
|
|
91
91
|
icon?: string | null;
|
|
@@ -144,14 +144,14 @@ export type BranchResponse = SuccessResponse<Branch>;
|
|
|
144
144
|
export type BranchSyncResponse = SuccessResponse<BranchSyncResult>;
|
|
145
145
|
export type WorktreeListResponse = SuccessResponse<Worktree[]>;
|
|
146
146
|
export type WorktreeResponse = SuccessResponse<Worktree>;
|
|
147
|
-
export type SessionListResponse = SuccessResponse<
|
|
148
|
-
export type SessionResponse = SuccessResponse<
|
|
147
|
+
export type SessionListResponse = SuccessResponse<CodingAgentSession[]>;
|
|
148
|
+
export type SessionResponse = SuccessResponse<CodingAgentSession>;
|
|
149
149
|
export interface ConfigPayload {
|
|
150
150
|
version: string;
|
|
151
151
|
updatedAt?: string | null;
|
|
152
152
|
env?: EnvironmentVariable[] | null;
|
|
153
153
|
history?: EnvironmentHistoryEntry[] | null;
|
|
154
|
-
|
|
154
|
+
codingAgents: ApiCodingAgent[];
|
|
155
155
|
}
|
|
156
156
|
|
|
157
157
|
export type ConfigResponse = SuccessResponse<ConfigPayload>;
|
|
@@ -169,14 +169,14 @@ export interface BranchSyncRequest {
|
|
|
169
169
|
}
|
|
170
170
|
|
|
171
171
|
export interface StartSessionRequest {
|
|
172
|
-
|
|
173
|
-
|
|
172
|
+
agentType: "claude-code" | "codex-cli" | "custom";
|
|
173
|
+
agentName?: string | null;
|
|
174
174
|
mode: "normal" | "continue" | "resume";
|
|
175
175
|
worktreePath: string;
|
|
176
176
|
skipPermissions?: boolean;
|
|
177
177
|
bypassApprovals?: boolean;
|
|
178
178
|
extraArgs?: string[];
|
|
179
|
-
|
|
179
|
+
customAgentId?: string | null;
|
|
180
180
|
}
|
|
181
181
|
|
|
182
182
|
export type UpdateConfigRequest = ConfigPayload;
|
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
|
|
package/src/utils/command.ts
CHANGED
|
@@ -59,6 +59,7 @@ export interface CommandLookupResult {
|
|
|
59
59
|
available: boolean;
|
|
60
60
|
path: string | null;
|
|
61
61
|
source: "installed" | "bunx";
|
|
62
|
+
version?: string | null;
|
|
62
63
|
}
|
|
63
64
|
|
|
64
65
|
/**
|
|
@@ -69,6 +70,7 @@ export interface ToolStatus {
|
|
|
69
70
|
name: string;
|
|
70
71
|
status: "installed" | "bunx";
|
|
71
72
|
path: string | null;
|
|
73
|
+
version?: string | null;
|
|
72
74
|
}
|
|
73
75
|
|
|
74
76
|
/**
|
|
@@ -85,6 +87,33 @@ export function clearCommandLookupCache(): void {
|
|
|
85
87
|
commandLookupCache.clear();
|
|
86
88
|
}
|
|
87
89
|
|
|
90
|
+
/**
|
|
91
|
+
* Gets the version of a command by running it with --version.
|
|
92
|
+
* FR-022: Returns version in "v{version}" format, null on failure.
|
|
93
|
+
* FR-023: Times out after 3 seconds to minimize startup delay.
|
|
94
|
+
*
|
|
95
|
+
* @param commandPath - Full path to the command
|
|
96
|
+
* @returns Version string (e.g., "v1.0.3") or null on failure
|
|
97
|
+
*/
|
|
98
|
+
export async function getCommandVersion(
|
|
99
|
+
commandPath: string,
|
|
100
|
+
): Promise<string | null> {
|
|
101
|
+
try {
|
|
102
|
+
const result = await execa(commandPath, ["--version"], {
|
|
103
|
+
timeout: 3000,
|
|
104
|
+
stdin: "ignore",
|
|
105
|
+
stdout: "pipe",
|
|
106
|
+
stderr: "ignore",
|
|
107
|
+
});
|
|
108
|
+
// Extract version number from output
|
|
109
|
+
// Examples: "claude 1.0.3", "codex 0.77.0", "gemini 0.1.0"
|
|
110
|
+
const match = result.stdout.match(/(\d+\.\d+(?:\.\d+)?(?:-[\w.]+)?)/);
|
|
111
|
+
return match ? `v${match[1]}` : null;
|
|
112
|
+
} catch {
|
|
113
|
+
return null;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
88
117
|
/**
|
|
89
118
|
* Finds a command by checking PATH first, then fallback paths.
|
|
90
119
|
* Results are cached for the lifetime of the process (FR-020).
|
|
@@ -141,6 +170,13 @@ export async function findCommand(
|
|
|
141
170
|
lookupResult = { available: true, path: null, source: "bunx" };
|
|
142
171
|
}
|
|
143
172
|
|
|
173
|
+
// Step 4: Get version for installed commands (FR-022)
|
|
174
|
+
if (lookupResult.source === "installed" && lookupResult.path) {
|
|
175
|
+
lookupResult.version = await getCommandVersion(lookupResult.path);
|
|
176
|
+
} else {
|
|
177
|
+
lookupResult.version = null;
|
|
178
|
+
}
|
|
179
|
+
|
|
144
180
|
// Cache the result (FR-020)
|
|
145
181
|
commandLookupCache.set(commandName, lookupResult);
|
|
146
182
|
|
|
@@ -181,6 +217,7 @@ export async function detectAllToolStatuses(): Promise<ToolStatus[]> {
|
|
|
181
217
|
name: tool.displayName,
|
|
182
218
|
status: result.source,
|
|
183
219
|
path: result.path,
|
|
220
|
+
version: result.version ?? null,
|
|
184
221
|
};
|
|
185
222
|
}),
|
|
186
223
|
);
|