mcp-codex-subagent 1.0.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.md +121 -0
- package/dist/errors.d.ts +16 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +35 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +19 -0
- package/dist/index.js.map +1 -0
- package/dist/server.d.ts +10 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +90 -0
- package/dist/server.js.map +1 -0
- package/dist/session/storage.d.ts +44 -0
- package/dist/session/storage.d.ts.map +1 -0
- package/dist/session/storage.js +113 -0
- package/dist/session/storage.js.map +1 -0
- package/dist/templates/index.d.ts +22 -0
- package/dist/templates/index.d.ts.map +1 -0
- package/dist/templates/index.js +147 -0
- package/dist/templates/index.js.map +1 -0
- package/dist/templates/overlays/coder-csharp.mdx +58 -0
- package/dist/templates/overlays/coder-go.mdx +53 -0
- package/dist/templates/overlays/coder-java.mdx +54 -0
- package/dist/templates/overlays/coder-kotlin.mdx +56 -0
- package/dist/templates/overlays/coder-nextjs.mdx +65 -0
- package/dist/templates/overlays/coder-python.mdx +53 -0
- package/dist/templates/overlays/coder-react.mdx +55 -0
- package/dist/templates/overlays/coder-ruby.mdx +59 -0
- package/dist/templates/overlays/coder-rust.mdx +48 -0
- package/dist/templates/overlays/coder-supabase.mdx +268 -0
- package/dist/templates/overlays/coder-supastarter.mdx +313 -0
- package/dist/templates/overlays/coder-swift.mdx +56 -0
- package/dist/templates/overlays/coder-tauri.mdx +566 -0
- package/dist/templates/overlays/coder-triggerdev.mdx +296 -0
- package/dist/templates/overlays/coder-typescript.mdx +45 -0
- package/dist/templates/overlays/coder-vue.mdx +62 -0
- package/dist/templates/overlays/planner-architecture.mdx +78 -0
- package/dist/templates/overlays/planner-bugfix.mdx +36 -0
- package/dist/templates/overlays/planner-feature.mdx +38 -0
- package/dist/templates/overlays/planner-migration.mdx +50 -0
- package/dist/templates/overlays/planner-refactor.mdx +57 -0
- package/dist/templates/overlays/researcher-library.mdx +59 -0
- package/dist/templates/overlays/researcher-performance.mdx +68 -0
- package/dist/templates/overlays/researcher-security.mdx +86 -0
- package/dist/templates/overlays/tester-graphql.mdx +191 -0
- package/dist/templates/overlays/tester-playwright.mdx +621 -0
- package/dist/templates/overlays/tester-rest.mdx +101 -0
- package/dist/templates/overlays/tester-suite.mdx +177 -0
- package/dist/templates/super-coder.mdx +529 -0
- package/dist/templates/super-planner.mdx +568 -0
- package/dist/templates/super-researcher.mdx +406 -0
- package/dist/templates/super-tester.mdx +243 -0
- package/dist/tools/definitions.d.ts +3 -0
- package/dist/tools/definitions.d.ts.map +1 -0
- package/dist/tools/definitions.js +186 -0
- package/dist/tools/definitions.js.map +1 -0
- package/dist/tools/handlers.d.ts +30 -0
- package/dist/tools/handlers.d.ts.map +1 -0
- package/dist/tools/handlers.js +370 -0
- package/dist/tools/handlers.js.map +1 -0
- package/dist/types.d.ts +118 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +65 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/command.d.ts +19 -0
- package/dist/utils/command.d.ts.map +1 -0
- package/dist/utils/command.js +171 -0
- package/dist/utils/command.js.map +1 -0
- package/package.json +70 -0
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import { TOOLS } from '../types.js';
|
|
2
|
+
export const toolDefinitions = [
|
|
3
|
+
{
|
|
4
|
+
name: TOOLS.CODEX,
|
|
5
|
+
description: 'Execute Codex CLI in non-interactive mode for AI assistance. Model is pinned to gpt-5.3-codex. Use reasoning effort as the primary tuning knob.',
|
|
6
|
+
inputSchema: {
|
|
7
|
+
type: 'object',
|
|
8
|
+
properties: {
|
|
9
|
+
prompt: {
|
|
10
|
+
type: 'string',
|
|
11
|
+
description: 'The coding task, question, or analysis request',
|
|
12
|
+
},
|
|
13
|
+
role: {
|
|
14
|
+
type: 'string',
|
|
15
|
+
enum: ['coder', 'planner', 'tester', 'researcher'],
|
|
16
|
+
description: 'Agent role — applies a structured system prompt template. coder: implementation tasks, planner: architecture/planning, tester: QA/testing, researcher: investigation/research',
|
|
17
|
+
},
|
|
18
|
+
specialization: {
|
|
19
|
+
type: 'string',
|
|
20
|
+
description: 'Specialization overlay for the role. Coder: typescript, python, rust, go, java, kotlin, ruby, csharp, swift, react, vue, nextjs, tauri, triggerdev, supabase, supastarter. Planner: feature, bugfix, refactor, architecture, migration. Researcher: security, performance, library. Tester: playwright, rest, graphql, suite',
|
|
21
|
+
},
|
|
22
|
+
context_files: {
|
|
23
|
+
type: 'array',
|
|
24
|
+
description: 'Files to read and prepend to the prompt as context (max 20)',
|
|
25
|
+
items: {
|
|
26
|
+
type: 'object',
|
|
27
|
+
properties: {
|
|
28
|
+
path: {
|
|
29
|
+
type: 'string',
|
|
30
|
+
description: 'Absolute file path to read',
|
|
31
|
+
},
|
|
32
|
+
description: {
|
|
33
|
+
type: 'string',
|
|
34
|
+
description: 'What this file is and why it matters',
|
|
35
|
+
},
|
|
36
|
+
start_line: {
|
|
37
|
+
type: 'integer',
|
|
38
|
+
description: 'Start line (1-indexed, optional)',
|
|
39
|
+
},
|
|
40
|
+
end_line: {
|
|
41
|
+
type: 'integer',
|
|
42
|
+
description: 'End line (1-indexed, optional)',
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
required: ['path'],
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
sessionId: {
|
|
49
|
+
type: 'string',
|
|
50
|
+
description: 'Optional session ID for conversational context. Note: when resuming a session, sandbox/workingDirectory parameters are not applied (CLI limitation)',
|
|
51
|
+
},
|
|
52
|
+
resetSession: {
|
|
53
|
+
type: 'boolean',
|
|
54
|
+
description: 'Reset the session history before processing this request',
|
|
55
|
+
},
|
|
56
|
+
reasoningEffort: {
|
|
57
|
+
type: 'string',
|
|
58
|
+
enum: ['low', 'medium', 'high', 'xhigh'],
|
|
59
|
+
description: 'Control reasoning depth (low < medium < high < xhigh). This is the primary tuning knob. Defaults to xhigh.',
|
|
60
|
+
},
|
|
61
|
+
sandbox: {
|
|
62
|
+
type: 'string',
|
|
63
|
+
enum: ['read-only', 'workspace-write', 'danger-full-access'],
|
|
64
|
+
description: 'Sandbox policy for shell command execution. Defaults to danger-full-access.',
|
|
65
|
+
},
|
|
66
|
+
workingDirectory: {
|
|
67
|
+
type: 'string',
|
|
68
|
+
description: 'Working directory for the agent to use as its root (passed via -C flag)',
|
|
69
|
+
},
|
|
70
|
+
callbackUri: {
|
|
71
|
+
type: 'string',
|
|
72
|
+
description: 'Static MCP callback URI to pass to Codex via environment (if provided)',
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
required: ['prompt'],
|
|
76
|
+
},
|
|
77
|
+
outputSchema: {
|
|
78
|
+
type: 'object',
|
|
79
|
+
properties: {
|
|
80
|
+
threadId: { type: 'string' },
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
annotations: {
|
|
84
|
+
title: 'Execute Codex CLI',
|
|
85
|
+
readOnlyHint: false,
|
|
86
|
+
destructiveHint: true,
|
|
87
|
+
idempotentHint: false,
|
|
88
|
+
openWorldHint: true,
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
name: TOOLS.REVIEW,
|
|
93
|
+
description: 'Run a code review against the current repository using Codex CLI',
|
|
94
|
+
inputSchema: {
|
|
95
|
+
type: 'object',
|
|
96
|
+
properties: {
|
|
97
|
+
prompt: {
|
|
98
|
+
type: 'string',
|
|
99
|
+
description: 'Custom review instructions or focus areas (cannot be used with uncommitted=true; use base/commit review instead)',
|
|
100
|
+
},
|
|
101
|
+
uncommitted: {
|
|
102
|
+
type: 'boolean',
|
|
103
|
+
description: 'Review staged, unstaged, and untracked changes (working tree) - cannot be combined with custom prompt',
|
|
104
|
+
},
|
|
105
|
+
base: {
|
|
106
|
+
type: 'string',
|
|
107
|
+
description: 'Review changes against a specific base branch (e.g., "main", "develop")',
|
|
108
|
+
},
|
|
109
|
+
commit: {
|
|
110
|
+
type: 'string',
|
|
111
|
+
description: 'Review the changes introduced by a specific commit SHA',
|
|
112
|
+
},
|
|
113
|
+
title: {
|
|
114
|
+
type: 'string',
|
|
115
|
+
description: 'Optional title to display in the review summary',
|
|
116
|
+
},
|
|
117
|
+
workingDirectory: {
|
|
118
|
+
type: 'string',
|
|
119
|
+
description: 'Working directory to run the review in (passed via -C as a global Codex option)',
|
|
120
|
+
},
|
|
121
|
+
},
|
|
122
|
+
required: [],
|
|
123
|
+
},
|
|
124
|
+
annotations: {
|
|
125
|
+
title: 'Code Review',
|
|
126
|
+
readOnlyHint: true,
|
|
127
|
+
destructiveHint: false,
|
|
128
|
+
idempotentHint: true,
|
|
129
|
+
openWorldHint: true,
|
|
130
|
+
},
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
name: TOOLS.PING,
|
|
134
|
+
description: 'Test MCP server connection',
|
|
135
|
+
inputSchema: {
|
|
136
|
+
type: 'object',
|
|
137
|
+
properties: {
|
|
138
|
+
message: {
|
|
139
|
+
type: 'string',
|
|
140
|
+
description: 'Message to echo back',
|
|
141
|
+
},
|
|
142
|
+
},
|
|
143
|
+
required: [],
|
|
144
|
+
},
|
|
145
|
+
annotations: {
|
|
146
|
+
title: 'Ping Server',
|
|
147
|
+
readOnlyHint: true,
|
|
148
|
+
destructiveHint: false,
|
|
149
|
+
idempotentHint: true,
|
|
150
|
+
openWorldHint: false,
|
|
151
|
+
},
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
name: TOOLS.HELP,
|
|
155
|
+
description: 'Get Codex CLI help information',
|
|
156
|
+
inputSchema: {
|
|
157
|
+
type: 'object',
|
|
158
|
+
properties: {},
|
|
159
|
+
required: [],
|
|
160
|
+
},
|
|
161
|
+
annotations: {
|
|
162
|
+
title: 'Get Help',
|
|
163
|
+
readOnlyHint: true,
|
|
164
|
+
destructiveHint: false,
|
|
165
|
+
idempotentHint: true,
|
|
166
|
+
openWorldHint: false,
|
|
167
|
+
},
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
name: TOOLS.LIST_SESSIONS,
|
|
171
|
+
description: 'List all active conversation sessions with metadata',
|
|
172
|
+
inputSchema: {
|
|
173
|
+
type: 'object',
|
|
174
|
+
properties: {},
|
|
175
|
+
required: [],
|
|
176
|
+
},
|
|
177
|
+
annotations: {
|
|
178
|
+
title: 'List Sessions',
|
|
179
|
+
readOnlyHint: true,
|
|
180
|
+
destructiveHint: false,
|
|
181
|
+
idempotentHint: true,
|
|
182
|
+
openWorldHint: false,
|
|
183
|
+
},
|
|
184
|
+
},
|
|
185
|
+
];
|
|
186
|
+
//# sourceMappingURL=definitions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/tools/definitions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAuB,MAAM,aAAa,CAAC;AAEzD,MAAM,CAAC,MAAM,eAAe,GAAqB;IAC/C;QACE,IAAI,EAAE,KAAK,CAAC,KAAK;QACjB,WAAW,EAAE,iJAAiJ;QAC9J,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,MAAM,EAAE;oBACN,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,gDAAgD;iBAC9D;gBACD,IAAI,EAAE;oBACJ,IAAI,EAAE,QAAQ;oBACd,IAAI,EAAE,CAAC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,YAAY,CAAC;oBAClD,WAAW,EACT,+KAA+K;iBAClL;gBACD,cAAc,EAAE;oBACd,IAAI,EAAE,QAAQ;oBACd,WAAW,EACT,8TAA8T;iBACjU;gBACD,aAAa,EAAE;oBACb,IAAI,EAAE,OAAO;oBACb,WAAW,EAAE,6DAA6D;oBAC1E,KAAK,EAAE;wBACL,IAAI,EAAE,QAAQ;wBACd,UAAU,EAAE;4BACV,IAAI,EAAE;gCAC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QAChB,WAAW,EAAE,gCAAgC;QAC7C,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE,EAAE;YACd,QAAQ,EAAE,EAAE;SACb;QACD,WAAW,EAAE;YACX,KAAK,EAAE,UAAU;YACjB,YAAY,EAAE,IAAI;YAClB,eAAe,EAAE,KAAK;YACtB,cAAc,EAAE,IAAI;YACpB,aAAa,EAAE,KAAK;SACrB;KACF;IACD;QACE,IAAI,EAAE,KAAK,CAAC,aAAa;QACzB,WAAW,EAAE,qDAAqD;QAClE,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE,EAAE;YACd,QAAQ,EAAE,EAAE;SACb;QACD,WAAW,EAAE;YACX,KAAK,EAAE,eAAe;YACtB,YAAY,EAAE,IAAI;YAClB,eAAe,EAAE,KAAK;YACtB,cAAc,EAAE,IAAI;YACpB,aAAa,EAAE,KAAK;SACrB;KACF;CACF,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { type ToolResult, type ToolHandlerContext } from '../types.js';
|
|
2
|
+
import { type SessionStorage } from '../session/storage.js';
|
|
3
|
+
export declare class CodexToolHandler {
|
|
4
|
+
private sessionStorage;
|
|
5
|
+
constructor(sessionStorage: SessionStorage);
|
|
6
|
+
execute(args: unknown, context?: ToolHandlerContext): Promise<ToolResult>;
|
|
7
|
+
private buildEnhancedPrompt;
|
|
8
|
+
}
|
|
9
|
+
export declare class PingToolHandler {
|
|
10
|
+
execute(args: unknown, _context?: ToolHandlerContext): Promise<ToolResult>;
|
|
11
|
+
}
|
|
12
|
+
export declare class HelpToolHandler {
|
|
13
|
+
execute(args: unknown, _context?: ToolHandlerContext): Promise<ToolResult>;
|
|
14
|
+
}
|
|
15
|
+
export declare class ListSessionsToolHandler {
|
|
16
|
+
private sessionStorage;
|
|
17
|
+
constructor(sessionStorage: SessionStorage);
|
|
18
|
+
execute(args: unknown, _context?: ToolHandlerContext): Promise<ToolResult>;
|
|
19
|
+
}
|
|
20
|
+
export declare class ReviewToolHandler {
|
|
21
|
+
execute(args: unknown, context?: ToolHandlerContext): Promise<ToolResult>;
|
|
22
|
+
}
|
|
23
|
+
export declare const toolHandlers: {
|
|
24
|
+
readonly codex: CodexToolHandler;
|
|
25
|
+
readonly review: ReviewToolHandler;
|
|
26
|
+
readonly ping: PingToolHandler;
|
|
27
|
+
readonly help: HelpToolHandler;
|
|
28
|
+
readonly listSessions: ListSessionsToolHandler;
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=handlers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handlers.d.ts","sourceRoot":"","sources":["../../src/tools/handlers.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,UAAU,EACf,KAAK,kBAAkB,EAUxB,MAAM,aAAa,CAAC;AACrB,OAAO,EAEL,KAAK,cAAc,EAEpB,MAAM,uBAAuB,CAAC;AA2C/B,qBAAa,gBAAgB;IACf,OAAO,CAAC,cAAc;gBAAd,cAAc,EAAE,cAAc;IAE5C,OAAO,CACX,IAAI,EAAE,OAAO,EACb,OAAO,GAAE,kBAAmC,GAC3C,OAAO,CAAC,UAAU,CAAC;IAqMtB,OAAO,CAAC,mBAAmB;CAwB5B;AAED,qBAAa,eAAe;IACpB,OAAO,CACX,IAAI,EAAE,OAAO,EACb,QAAQ,GAAE,kBAAmC,GAC5C,OAAO,CAAC,UAAU,CAAC;CAuBvB;AAED,qBAAa,eAAe;IACpB,OAAO,CACX,IAAI,EAAE,OAAO,EACb,QAAQ,GAAE,kBAAmC,GAC5C,OAAO,CAAC,UAAU,CAAC;CAyBvB;AAED,qBAAa,uBAAuB;IACtB,OAAO,CAAC,cAAc;gBAAd,cAAc,EAAE,cAAc;IAE5C,OAAO,CACX,IAAI,EAAE,OAAO,EACb,QAAQ,GAAE,kBAAmC,GAC5C,OAAO,CAAC,UAAU,CAAC;CAkCvB;AAED,qBAAa,iBAAiB;IACtB,OAAO,CACX,IAAI,EAAE,OAAO,EACb,OAAO,GAAE,kBAAmC,GAC3C,OAAO,CAAC,UAAU,CAAC;CAuGvB;AAKD,eAAO,MAAM,YAAY;;;;;;CAMf,CAAC"}
|
|
@@ -0,0 +1,370 @@
|
|
|
1
|
+
import { TOOLS, PINNED_CODEX_MODEL, ROLE_TO_TASK_TYPE, CodexToolSchema, ReviewToolSchema, PingToolSchema, HelpToolSchema, ListSessionsToolSchema, } from '../types.js';
|
|
2
|
+
import { InMemorySessionStorage, } from '../session/storage.js';
|
|
3
|
+
import { ToolExecutionError, ValidationError } from '../errors.js';
|
|
4
|
+
import { executeCommand, executeCommandStreaming } from '../utils/command.js';
|
|
5
|
+
import { ZodError } from 'zod';
|
|
6
|
+
import { applyTemplate, isValidTaskType } from '../templates/index.js';
|
|
7
|
+
import { readFileSync } from 'fs';
|
|
8
|
+
// Default no-op context for handlers that don't need progress
|
|
9
|
+
const defaultContext = {
|
|
10
|
+
sendProgress: async () => { },
|
|
11
|
+
};
|
|
12
|
+
const isStructuredContentEnabled = () => {
|
|
13
|
+
const raw = process.env.STRUCTURED_CONTENT_ENABLED;
|
|
14
|
+
if (!raw)
|
|
15
|
+
return false;
|
|
16
|
+
return ['1', 'true', 'yes', 'on'].includes(raw.toLowerCase());
|
|
17
|
+
};
|
|
18
|
+
function assemblePromptWithContext(prompt, contextFiles) {
|
|
19
|
+
if (!contextFiles || contextFiles.length === 0)
|
|
20
|
+
return prompt;
|
|
21
|
+
const sections = [];
|
|
22
|
+
for (const file of contextFiles) {
|
|
23
|
+
try {
|
|
24
|
+
const content = readFileSync(file.path, 'utf8');
|
|
25
|
+
const lines = content.split('\n');
|
|
26
|
+
const start = (file.start_line ?? 1) - 1;
|
|
27
|
+
const end = file.end_line ?? lines.length;
|
|
28
|
+
const slice = lines.slice(start, end).join('\n');
|
|
29
|
+
sections.push([
|
|
30
|
+
`--- FILE: ${file.path}${file.description ? ` (${file.description})` : ''} ---`,
|
|
31
|
+
slice,
|
|
32
|
+
'--- END FILE ---',
|
|
33
|
+
].join('\n'));
|
|
34
|
+
}
|
|
35
|
+
catch {
|
|
36
|
+
sections.push(`--- FILE: ${file.path} [UNREADABLE] ---`);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return `${sections.join('\n\n')}\n\n---\n\n${prompt}`;
|
|
40
|
+
}
|
|
41
|
+
export class CodexToolHandler {
|
|
42
|
+
sessionStorage;
|
|
43
|
+
constructor(sessionStorage) {
|
|
44
|
+
this.sessionStorage = sessionStorage;
|
|
45
|
+
}
|
|
46
|
+
async execute(args, context = defaultContext) {
|
|
47
|
+
try {
|
|
48
|
+
const { prompt, role, specialization, context_files, sessionId, resetSession, reasoningEffort, sandbox, workingDirectory, callbackUri, } = CodexToolSchema.parse(args);
|
|
49
|
+
let activeSessionId = sessionId;
|
|
50
|
+
// Assemble context files into prompt
|
|
51
|
+
let enrichedPrompt = assemblePromptWithContext(prompt, context_files);
|
|
52
|
+
// Only work with sessions if explicitly requested
|
|
53
|
+
let useResume = false;
|
|
54
|
+
let codexConversationId;
|
|
55
|
+
if (sessionId) {
|
|
56
|
+
this.sessionStorage.ensureSession(sessionId);
|
|
57
|
+
if (resetSession) {
|
|
58
|
+
this.sessionStorage.resetSession(sessionId);
|
|
59
|
+
}
|
|
60
|
+
codexConversationId =
|
|
61
|
+
this.sessionStorage.getCodexConversationId(sessionId);
|
|
62
|
+
if (codexConversationId) {
|
|
63
|
+
useResume = true;
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
// Fallback to manual context building if no codex conversation ID
|
|
67
|
+
const session = this.sessionStorage.getSession(sessionId);
|
|
68
|
+
if (session &&
|
|
69
|
+
Array.isArray(session.turns) &&
|
|
70
|
+
session.turns.length > 0) {
|
|
71
|
+
enrichedPrompt = this.buildEnhancedPrompt(session.turns, enrichedPrompt);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
// Apply template if role specified
|
|
76
|
+
if (role) {
|
|
77
|
+
const taskType = ROLE_TO_TASK_TYPE[role];
|
|
78
|
+
if (isValidTaskType(taskType)) {
|
|
79
|
+
enrichedPrompt = applyTemplate(taskType, enrichedPrompt, specialization);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
// Pinned model — always gpt-5.3-codex
|
|
83
|
+
const selectedModel = PINNED_CODEX_MODEL;
|
|
84
|
+
// Default reasoning effort to xhigh
|
|
85
|
+
const effort = reasoningEffort ?? 'xhigh';
|
|
86
|
+
const effectiveCallbackUri = callbackUri || process.env.CODEX_MCP_CALLBACK_URI;
|
|
87
|
+
let cmdArgs;
|
|
88
|
+
if (useResume && codexConversationId) {
|
|
89
|
+
// Resume mode: codex exec resume has limited flags
|
|
90
|
+
// All exec options (--skip-git-repo-check, -c) must come BEFORE 'resume' subcommand
|
|
91
|
+
cmdArgs = ['exec', '--skip-git-repo-check'];
|
|
92
|
+
// Model must be set via -c config in resume mode (before subcommand)
|
|
93
|
+
cmdArgs.push('-c', `model="${selectedModel}"`);
|
|
94
|
+
// Reasoning effort via config (before subcommand)
|
|
95
|
+
cmdArgs.push('-c', `model_reasoning_effort="${effort}"`);
|
|
96
|
+
// Add resume subcommand with conversation ID and prompt
|
|
97
|
+
cmdArgs.push('resume', codexConversationId, enrichedPrompt);
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
// Exec mode: hardcode optimal defaults
|
|
101
|
+
cmdArgs = ['exec'];
|
|
102
|
+
// Add model parameter
|
|
103
|
+
cmdArgs.push('--model', selectedModel);
|
|
104
|
+
// Add reasoning effort
|
|
105
|
+
cmdArgs.push('-c', `model_reasoning_effort="${effort}"`);
|
|
106
|
+
// Sandbox mode (defaults to danger-full-access)
|
|
107
|
+
cmdArgs.push('--sandbox', sandbox ?? 'danger-full-access');
|
|
108
|
+
// Bypass all approval prompts and sandbox restrictions
|
|
109
|
+
cmdArgs.push('--dangerously-bypass-approvals-and-sandbox');
|
|
110
|
+
// Working directory
|
|
111
|
+
cmdArgs.push('-C', workingDirectory || process.cwd());
|
|
112
|
+
// Skip git repo check for v0.50.0+
|
|
113
|
+
cmdArgs.push('--skip-git-repo-check');
|
|
114
|
+
cmdArgs.push(enrichedPrompt);
|
|
115
|
+
}
|
|
116
|
+
// Send initial progress notification
|
|
117
|
+
await context.sendProgress('Starting Codex execution...', 0);
|
|
118
|
+
// Use streaming execution if progress is enabled
|
|
119
|
+
const useStreaming = !!context.progressToken;
|
|
120
|
+
const envOverride = effectiveCallbackUri
|
|
121
|
+
? { CODEX_MCP_CALLBACK_URI: effectiveCallbackUri }
|
|
122
|
+
: undefined;
|
|
123
|
+
const result = useStreaming
|
|
124
|
+
? await executeCommandStreaming('codex', cmdArgs, {
|
|
125
|
+
onProgress: (message) => {
|
|
126
|
+
// Send progress notification for each chunk of output
|
|
127
|
+
context.sendProgress(message);
|
|
128
|
+
},
|
|
129
|
+
envOverride,
|
|
130
|
+
})
|
|
131
|
+
: envOverride
|
|
132
|
+
? await executeCommand('codex', cmdArgs, envOverride)
|
|
133
|
+
: await executeCommand('codex', cmdArgs);
|
|
134
|
+
// Codex CLI may output to stderr, so check both
|
|
135
|
+
const response = result.stdout || result.stderr || 'No output from Codex';
|
|
136
|
+
// Extract conversation/session ID from new conversations for future resume
|
|
137
|
+
// Codex CLI outputs have varied between "session id" and "conversation id"
|
|
138
|
+
if (activeSessionId && !useResume) {
|
|
139
|
+
const conversationIdMatch = result.stderr?.match(/(conversation|session)\s*id\s*:\s*([a-zA-Z0-9-]+)/i);
|
|
140
|
+
if (conversationIdMatch) {
|
|
141
|
+
this.sessionStorage.setCodexConversationId(activeSessionId, conversationIdMatch[2]);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
const combinedOutput = `${result.stderr || ''}
|
|
145
|
+
${result.stdout || ''}`.trim();
|
|
146
|
+
const threadIdMatch = combinedOutput.match(/thread\s*id\s*:\s*([a-zA-Z0-9_-]+)/i);
|
|
147
|
+
const threadId = threadIdMatch ? threadIdMatch[1] : undefined;
|
|
148
|
+
// Save turn only if using a session
|
|
149
|
+
if (activeSessionId) {
|
|
150
|
+
const turn = {
|
|
151
|
+
prompt,
|
|
152
|
+
response,
|
|
153
|
+
timestamp: new Date(),
|
|
154
|
+
};
|
|
155
|
+
this.sessionStorage.addTurn(activeSessionId, turn);
|
|
156
|
+
}
|
|
157
|
+
// Prepare metadata for dual approach:
|
|
158
|
+
// - content[0]._meta: For Claude Code compatibility (avoids structuredContent bug)
|
|
159
|
+
// - structuredContent: For other MCP clients that properly support it
|
|
160
|
+
const metadata = {
|
|
161
|
+
...(threadId && { threadId }),
|
|
162
|
+
...(selectedModel && { model: selectedModel }),
|
|
163
|
+
...(activeSessionId && { sessionId: activeSessionId }),
|
|
164
|
+
...(effectiveCallbackUri && { callbackUri: effectiveCallbackUri }),
|
|
165
|
+
};
|
|
166
|
+
return {
|
|
167
|
+
content: [
|
|
168
|
+
{
|
|
169
|
+
type: 'text',
|
|
170
|
+
text: response,
|
|
171
|
+
_meta: metadata,
|
|
172
|
+
},
|
|
173
|
+
],
|
|
174
|
+
structuredContent: isStructuredContentEnabled() && Object.keys(metadata).length > 0
|
|
175
|
+
? metadata
|
|
176
|
+
: undefined,
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
catch (error) {
|
|
180
|
+
if (error instanceof ValidationError) {
|
|
181
|
+
throw error;
|
|
182
|
+
}
|
|
183
|
+
if (error instanceof ZodError) {
|
|
184
|
+
throw new ValidationError(TOOLS.CODEX, error.message);
|
|
185
|
+
}
|
|
186
|
+
throw new ToolExecutionError(TOOLS.CODEX, 'Failed to execute codex command', error);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
buildEnhancedPrompt(turns, newPrompt) {
|
|
190
|
+
if (turns.length === 0)
|
|
191
|
+
return newPrompt;
|
|
192
|
+
// Get relevant context from recent turns
|
|
193
|
+
const recentTurns = turns.slice(-2);
|
|
194
|
+
const contextualInfo = recentTurns
|
|
195
|
+
.map((turn) => {
|
|
196
|
+
// Extract key information without conversational format
|
|
197
|
+
if (turn.response.includes('function') ||
|
|
198
|
+
turn.response.includes('def ')) {
|
|
199
|
+
return `Previous code context: ${turn.response.slice(0, 200)}...`;
|
|
200
|
+
}
|
|
201
|
+
return `Context: ${turn.prompt} -> ${turn.response.slice(0, 100)}...`;
|
|
202
|
+
})
|
|
203
|
+
.join('\n');
|
|
204
|
+
// Build enhanced prompt that provides context without conversation format
|
|
205
|
+
return `${contextualInfo}\n\nTask: ${newPrompt}`;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
export class PingToolHandler {
|
|
209
|
+
async execute(args, _context = defaultContext) {
|
|
210
|
+
try {
|
|
211
|
+
const { message = 'pong' } = PingToolSchema.parse(args);
|
|
212
|
+
return {
|
|
213
|
+
content: [
|
|
214
|
+
{
|
|
215
|
+
type: 'text',
|
|
216
|
+
text: message,
|
|
217
|
+
},
|
|
218
|
+
],
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
catch (error) {
|
|
222
|
+
if (error instanceof ZodError) {
|
|
223
|
+
throw new ValidationError(TOOLS.PING, error.message);
|
|
224
|
+
}
|
|
225
|
+
throw new ToolExecutionError(TOOLS.PING, 'Failed to execute ping command', error);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
export class HelpToolHandler {
|
|
230
|
+
async execute(args, _context = defaultContext) {
|
|
231
|
+
try {
|
|
232
|
+
HelpToolSchema.parse(args);
|
|
233
|
+
const result = await executeCommand('codex', ['--help']);
|
|
234
|
+
return {
|
|
235
|
+
content: [
|
|
236
|
+
{
|
|
237
|
+
type: 'text',
|
|
238
|
+
text: result.stdout || 'No help information available',
|
|
239
|
+
},
|
|
240
|
+
],
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
catch (error) {
|
|
244
|
+
if (error instanceof ZodError) {
|
|
245
|
+
throw new ValidationError(TOOLS.HELP, error.message);
|
|
246
|
+
}
|
|
247
|
+
throw new ToolExecutionError(TOOLS.HELP, 'Failed to execute help command', error);
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
export class ListSessionsToolHandler {
|
|
252
|
+
sessionStorage;
|
|
253
|
+
constructor(sessionStorage) {
|
|
254
|
+
this.sessionStorage = sessionStorage;
|
|
255
|
+
}
|
|
256
|
+
async execute(args, _context = defaultContext) {
|
|
257
|
+
try {
|
|
258
|
+
ListSessionsToolSchema.parse(args);
|
|
259
|
+
const sessions = this.sessionStorage.listSessions();
|
|
260
|
+
const sessionInfo = sessions.map((session) => ({
|
|
261
|
+
id: session.id,
|
|
262
|
+
createdAt: session.createdAt.toISOString(),
|
|
263
|
+
lastAccessedAt: session.lastAccessedAt.toISOString(),
|
|
264
|
+
turnCount: session.turns.length,
|
|
265
|
+
}));
|
|
266
|
+
return {
|
|
267
|
+
content: [
|
|
268
|
+
{
|
|
269
|
+
type: 'text',
|
|
270
|
+
text: sessionInfo.length > 0
|
|
271
|
+
? JSON.stringify(sessionInfo, null, 2)
|
|
272
|
+
: 'No active sessions',
|
|
273
|
+
},
|
|
274
|
+
],
|
|
275
|
+
};
|
|
276
|
+
}
|
|
277
|
+
catch (error) {
|
|
278
|
+
if (error instanceof ZodError) {
|
|
279
|
+
throw new ValidationError(TOOLS.LIST_SESSIONS, error.message);
|
|
280
|
+
}
|
|
281
|
+
throw new ToolExecutionError(TOOLS.LIST_SESSIONS, 'Failed to list sessions', error);
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
export class ReviewToolHandler {
|
|
286
|
+
async execute(args, context = defaultContext) {
|
|
287
|
+
try {
|
|
288
|
+
const { prompt, uncommitted, base, commit, title, workingDirectory, } = ReviewToolSchema.parse(args);
|
|
289
|
+
if (prompt && uncommitted) {
|
|
290
|
+
throw new ValidationError(TOOLS.REVIEW, 'The review prompt cannot be combined with uncommitted=true. Use a base/commit review or omit the prompt.');
|
|
291
|
+
}
|
|
292
|
+
// Build command arguments for codex review
|
|
293
|
+
const cmdArgs = [];
|
|
294
|
+
if (workingDirectory) {
|
|
295
|
+
cmdArgs.push('-C', workingDirectory);
|
|
296
|
+
}
|
|
297
|
+
// Pinned model
|
|
298
|
+
const selectedModel = PINNED_CODEX_MODEL;
|
|
299
|
+
cmdArgs.push('-c', `model="${selectedModel}"`);
|
|
300
|
+
cmdArgs.push('review');
|
|
301
|
+
// Add review-specific flags
|
|
302
|
+
if (uncommitted) {
|
|
303
|
+
cmdArgs.push('--uncommitted');
|
|
304
|
+
}
|
|
305
|
+
if (base) {
|
|
306
|
+
cmdArgs.push('--base', base);
|
|
307
|
+
}
|
|
308
|
+
if (commit) {
|
|
309
|
+
cmdArgs.push('--commit', commit);
|
|
310
|
+
}
|
|
311
|
+
if (title) {
|
|
312
|
+
cmdArgs.push('--title', title);
|
|
313
|
+
}
|
|
314
|
+
// Add custom review instructions if provided
|
|
315
|
+
if (prompt) {
|
|
316
|
+
cmdArgs.push(prompt);
|
|
317
|
+
}
|
|
318
|
+
// Send initial progress notification
|
|
319
|
+
await context.sendProgress('Starting code review...', 0);
|
|
320
|
+
// Use streaming execution if progress is enabled
|
|
321
|
+
const useStreaming = !!context.progressToken;
|
|
322
|
+
const result = useStreaming
|
|
323
|
+
? await executeCommandStreaming('codex', cmdArgs, {
|
|
324
|
+
onProgress: (message) => {
|
|
325
|
+
context.sendProgress(message);
|
|
326
|
+
},
|
|
327
|
+
})
|
|
328
|
+
: await executeCommand('codex', cmdArgs);
|
|
329
|
+
// Codex CLI outputs to stderr, so check both stdout and stderr
|
|
330
|
+
const response = result.stdout || result.stderr || 'No review output from Codex';
|
|
331
|
+
// Prepare metadata for dual approach:
|
|
332
|
+
// - content[0]._meta: For Claude Code compatibility (avoids structuredContent bug)
|
|
333
|
+
// - structuredContent: For other MCP clients that properly support it
|
|
334
|
+
const metadata = {
|
|
335
|
+
model: selectedModel,
|
|
336
|
+
...(base && { base }),
|
|
337
|
+
...(commit && { commit }),
|
|
338
|
+
};
|
|
339
|
+
return {
|
|
340
|
+
content: [
|
|
341
|
+
{
|
|
342
|
+
type: 'text',
|
|
343
|
+
text: response,
|
|
344
|
+
_meta: metadata,
|
|
345
|
+
},
|
|
346
|
+
],
|
|
347
|
+
structuredContent: isStructuredContentEnabled() ? metadata : undefined,
|
|
348
|
+
};
|
|
349
|
+
}
|
|
350
|
+
catch (error) {
|
|
351
|
+
if (error instanceof ZodError) {
|
|
352
|
+
throw new ValidationError(TOOLS.REVIEW, error.message);
|
|
353
|
+
}
|
|
354
|
+
if (error instanceof ValidationError) {
|
|
355
|
+
throw error;
|
|
356
|
+
}
|
|
357
|
+
throw new ToolExecutionError(TOOLS.REVIEW, 'Failed to execute code review', error);
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
// Tool handler registry
|
|
362
|
+
const sessionStorage = new InMemorySessionStorage();
|
|
363
|
+
export const toolHandlers = {
|
|
364
|
+
[TOOLS.CODEX]: new CodexToolHandler(sessionStorage),
|
|
365
|
+
[TOOLS.REVIEW]: new ReviewToolHandler(),
|
|
366
|
+
[TOOLS.PING]: new PingToolHandler(),
|
|
367
|
+
[TOOLS.HELP]: new HelpToolHandler(),
|
|
368
|
+
[TOOLS.LIST_SESSIONS]: new ListSessionsToolHandler(sessionStorage),
|
|
369
|
+
};
|
|
370
|
+
//# sourceMappingURL=handlers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handlers.js","sourceRoot":"","sources":["../../src/tools/handlers.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EACL,kBAAkB,EAClB,iBAAiB,EAOjB,eAAe,EACf,gBAAgB,EAChB,cAAc,EACd,cAAc,EACd,sBAAsB,GACvB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,sBAAsB,GAGvB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,uBAAuB,EAAE,MAAM,qBA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