mcp-codex-worker 1.0.9 → 1.0.11
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/dist/src/app.d.ts +0 -9
- package/dist/src/app.js +54 -67
- package/dist/src/app.js.map +1 -1
- package/dist/src/execution/codex-adapter.js +7 -0
- package/dist/src/execution/codex-adapter.js.map +1 -1
- package/dist/src/index.js +7 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/mcp/next-action-guidance.d.ts +5 -0
- package/dist/src/mcp/next-action-guidance.js +15 -0
- package/dist/src/mcp/next-action-guidance.js.map +1 -1
- package/dist/src/mcp/tool-definitions.d.ts +7 -20
- package/dist/src/mcp/tool-definitions.js +70 -255
- package/dist/src/mcp/tool-definitions.js.map +1 -1
- package/package.json +1 -1
- package/src/app.ts +59 -95
- package/src/execution/codex-adapter.ts +7 -0
- package/src/index.ts +13 -0
- package/src/mcp/next-action-guidance.ts +23 -0
- package/src/mcp/tool-definitions.ts +92 -288
|
@@ -1,310 +1,125 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { REASONING_OPTIONS } from '../services/reasoning-options.js';
|
|
3
|
-
import { buildStatusBanner, buildRespondBanner } from '../services/tool-description-banner.js';
|
|
4
3
|
// ---------------------------------------------------------------------------
|
|
5
|
-
//
|
|
4
|
+
// Zod schemas — passed to McpServer.registerTool (SDK converts to JSON Schema)
|
|
6
5
|
// ---------------------------------------------------------------------------
|
|
7
6
|
const reasoningEnum = z.enum(REASONING_OPTIONS);
|
|
8
|
-
// ---------------------------------------------------------------------------
|
|
9
|
-
// Zod schemas — exported for registerTool (SDK validates input automatically)
|
|
10
|
-
// ---------------------------------------------------------------------------
|
|
11
7
|
export const spawnTaskSchema = z.object({
|
|
12
|
-
prompt: z.string().min(1),
|
|
13
|
-
task_type: z.enum(['coder', 'planner', 'tester', 'researcher', 'general']).default('coder'),
|
|
14
|
-
provider: z.enum(['codex', 'copilot', 'claude-cli']).optional(),
|
|
15
|
-
reasoning: reasoningEnum.optional(),
|
|
16
|
-
cwd: z.string().optional(),
|
|
17
|
-
timeout_ms: z.number().int().min(1000).max(3_600_000).optional(),
|
|
18
|
-
keep_alive: z.number().optional(),
|
|
19
|
-
labels: z.array(z.string()).optional(),
|
|
20
|
-
depends_on: z.array(z.string()).optional(),
|
|
21
|
-
developer_instructions: z.string().optional(),
|
|
8
|
+
prompt: z.string().min(1).describe('What the task should do. Be specific: include file paths, function or symbol names, the expected outcome, and any constraints.'),
|
|
9
|
+
task_type: z.enum(['coder', 'planner', 'tester', 'researcher', 'general']).default('coder').describe('Routing hint: coder for code, planner for decomposing work, tester for tests, researcher for investigation, general for anything else.'),
|
|
10
|
+
provider: z.enum(['codex', 'copilot', 'claude-cli']).optional().describe('Force a specific backend. Leave unset in almost all cases.'),
|
|
11
|
+
reasoning: reasoningEnum.optional().describe('Model + reasoning effort. gpt-5.4(medium) is the default workhorse; use high for multi-file reasoning, xhigh for deep research, low for trivial edits.'),
|
|
12
|
+
cwd: z.string().optional().describe('Absolute working directory. Defaults to server process cwd.'),
|
|
13
|
+
timeout_ms: z.number().int().min(1000).max(3_600_000).optional().describe('Hard time limit in ms. Task is marked timed_out if exceeded.'),
|
|
14
|
+
keep_alive: z.number().optional().describe('Retention window (ms) — how long the server keeps the completed result available.'),
|
|
15
|
+
labels: z.array(z.string()).optional().describe('Free-form tags for filtering and grouping.'),
|
|
16
|
+
depends_on: z.array(z.string()).optional().describe('Task IDs that must complete before this task starts.'),
|
|
17
|
+
developer_instructions: z.string().optional().describe('System-level instructions injected ahead of the user prompt.'),
|
|
22
18
|
context_files: z.array(z.object({
|
|
23
|
-
path: z.string(),
|
|
24
|
-
description: z.string().optional(),
|
|
25
|
-
})).optional(),
|
|
19
|
+
path: z.string().describe('Absolute path of a file to include as context.'),
|
|
20
|
+
description: z.string().optional().describe('Note explaining why this file is relevant.'),
|
|
21
|
+
})).optional().describe('Files to prepend as additional context. Use sparingly.'),
|
|
26
22
|
});
|
|
27
23
|
export const waitTaskSchema = z.object({
|
|
28
|
-
task_id: z.string().min(1),
|
|
29
|
-
timeout_ms: z.number().int().positive().max(300_000).default(30_000).optional(),
|
|
30
|
-
poll_interval_ms: z.number().int().min(250).max(30_000).default(1000).optional(),
|
|
24
|
+
task_id: z.string().min(1).describe('ID of the task to wait on, as returned by spawn-task.'),
|
|
25
|
+
timeout_ms: z.number().int().positive().max(300_000).default(30_000).optional().describe('Max time to block in ms. Returns early on terminal or input_required. Default 30s.'),
|
|
26
|
+
poll_interval_ms: z.number().int().min(250).max(30_000).default(1000).optional().describe('Internal poll interval in ms. Keep the default unless tuning.'),
|
|
31
27
|
});
|
|
32
28
|
export const respondTaskSchema = z.discriminatedUnion('type', [
|
|
33
29
|
z.object({
|
|
34
30
|
task_id: z.string().min(1),
|
|
35
31
|
type: z.literal('user_input'),
|
|
36
|
-
answers: z.record(z.string(), z.string()),
|
|
32
|
+
answers: z.record(z.string(), z.string()).describe('Map of question id → answer string.'),
|
|
37
33
|
}),
|
|
38
34
|
z.object({
|
|
39
35
|
task_id: z.string().min(1),
|
|
40
36
|
type: z.literal('command_approval'),
|
|
41
|
-
decision: z.enum(['accept', 'reject']),
|
|
37
|
+
decision: z.enum(['accept', 'reject']).describe('Whether the agent may run the proposed command.'),
|
|
42
38
|
}),
|
|
43
39
|
z.object({
|
|
44
40
|
task_id: z.string().min(1),
|
|
45
41
|
type: z.literal('file_approval'),
|
|
46
|
-
decision: z.enum(['accept', 'reject']),
|
|
42
|
+
decision: z.enum(['accept', 'reject']).describe('Whether the agent may apply the proposed file edit.'),
|
|
47
43
|
}),
|
|
48
44
|
z.object({
|
|
49
45
|
task_id: z.string().min(1),
|
|
50
46
|
type: z.literal('elicitation'),
|
|
51
|
-
action: z.enum(['accept', 'decline']),
|
|
52
|
-
content: z.record(z.string(), z.unknown()).optional(),
|
|
47
|
+
action: z.enum(['accept', 'decline']).describe('Accept or decline the MCP elicitation request.'),
|
|
48
|
+
content: z.record(z.string(), z.unknown()).optional().describe('Structured payload when accepting.'),
|
|
53
49
|
}),
|
|
54
50
|
z.object({
|
|
55
51
|
task_id: z.string().min(1),
|
|
56
52
|
type: z.literal('dynamic_tool'),
|
|
57
|
-
result: z.string().optional(),
|
|
58
|
-
error: z.string().optional(),
|
|
53
|
+
result: z.string().optional().describe('Tool call result string returned to the agent.'),
|
|
54
|
+
error: z.string().optional().describe('Error string if the tool call failed.'),
|
|
59
55
|
}),
|
|
60
56
|
]);
|
|
61
57
|
export const messageTaskSchema = z.object({
|
|
62
|
-
task_id: z.string().min(1),
|
|
63
|
-
message: z.string().min(1),
|
|
64
|
-
reasoning: reasoningEnum.optional(),
|
|
58
|
+
task_id: z.string().min(1).describe('ID of the task whose session should receive the follow-up.'),
|
|
59
|
+
message: z.string().min(1).describe('The follow-up instruction or question. Be as specific as the original prompt.'),
|
|
60
|
+
reasoning: reasoningEnum.optional().describe('Overrides reasoning for this follow-up turn only.'),
|
|
65
61
|
});
|
|
66
62
|
export const cancelTaskSchema = z.object({
|
|
67
|
-
task_id: z.union([z.string().min(1), z.array(z.string().min(1)).min(1)]),
|
|
63
|
+
task_id: z.union([z.string().min(1), z.array(z.string().min(1)).min(1)]).describe('Task ID or array of task IDs to cancel.'),
|
|
68
64
|
});
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
'Model + reasoning effort for this task. The value is a single literal — the server splits it into a model id and a reasoning-effort level and passes them to Codex separately.',
|
|
78
|
-
'',
|
|
79
|
-
'Picking the level:',
|
|
80
|
-
'- `gpt-5.4(medium)` — default workhorse. Use for most coding, refactors, and focused debugging.',
|
|
81
|
-
'- `gpt-5.4(high)` — harder tasks: multi-file reasoning, subtle bugs, non-trivial design decisions.',
|
|
82
|
-
'- `gpt-5.4(xhigh)` — reserved for exceptional deep research, novel architecture work, or problems where you have already tried `high` and it was not enough.',
|
|
83
|
-
'- `gpt-5.4(low)` — rare; only for trivial mechanical edits where latency matters more than quality.',
|
|
84
|
-
'',
|
|
85
|
-
'Omit to use the server default from config.',
|
|
86
|
-
].join('\n');
|
|
87
|
-
export function createToolDefinitions(serverVersion, taskManager) {
|
|
88
|
-
const versionTag = serverVersion ? ` (v${serverVersion})` : '';
|
|
89
|
-
// Compute banners once per tool-list request, sharing a single task snapshot
|
|
90
|
-
const allTasks = taskManager ? taskManager.getAllTasks() : [];
|
|
91
|
-
const statusBanner = allTasks.length > 0 ? buildStatusBanner(allTasks) : '';
|
|
92
|
-
const respondBanner = allTasks.length > 0 ? buildRespondBanner(allTasks) : '';
|
|
93
|
-
return [
|
|
94
|
-
{
|
|
95
|
-
name: 'spawn-task',
|
|
96
|
-
description: [
|
|
97
|
-
`Create and start a provider-agnostic task, returning a task_id you can track.${versionTag}`,
|
|
65
|
+
// ---------------------------------------------------------------------------
|
|
66
|
+
// Tool descriptions — keyed by name, used by index.ts registerTool
|
|
67
|
+
// ---------------------------------------------------------------------------
|
|
68
|
+
export function getToolDescriptions(serverVersion) {
|
|
69
|
+
const v = serverVersion ? ` (v${serverVersion})` : '';
|
|
70
|
+
return new Map([
|
|
71
|
+
['spawn-task', [
|
|
72
|
+
`Create and start a provider-agnostic task, returning a task_id you can track.${v}`,
|
|
98
73
|
'',
|
|
99
74
|
'Dispatches the prompt to the provider registered for the given `task_type` (Codex, Copilot, Claude CLI) and returns immediately with a task_id. Use `wait-task` to block until the task reaches a terminal state or needs input, `respond-task` to unblock it, and `message-task` to send follow-ups on the same session.',
|
|
100
75
|
'',
|
|
101
|
-
'PARALLEL EXECUTION: Spawn multiple tasks in the same message to fan out work — each task runs in its own isolated agent workspace and reports back independently.
|
|
76
|
+
'PARALLEL EXECUTION: Spawn multiple tasks in the same message to fan out work — each task runs in its own isolated agent workspace and reports back independently.',
|
|
102
77
|
'',
|
|
103
|
-
'AFTER SPAWNING: Always follow up with `wait-task`. The agent may pause almost immediately to request
|
|
78
|
+
'AFTER SPAWNING: Always follow up with `wait-task`. The agent may pause almost immediately to request input; the bridge window surfaces that pending question so you can answer it without polling.',
|
|
104
79
|
'',
|
|
105
|
-
'WRITING A GOOD PROMPT: Name the exact files, functions, or symbols involved, state the expected behavior
|
|
106
|
-
].join('\n'),
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
type: 'string',
|
|
110
|
-
minLength: 1,
|
|
111
|
-
description: 'What the task should do. Be specific: include file paths, function or symbol names, the expected outcome, and any constraints. The agent only sees this prompt — treat it as the full brief.',
|
|
112
|
-
},
|
|
113
|
-
task_type: {
|
|
114
|
-
type: 'string',
|
|
115
|
-
enum: ['coder', 'planner', 'tester', 'researcher', 'general'],
|
|
116
|
-
default: 'coder',
|
|
117
|
-
description: 'Routing hint that picks a provider and default prompt shape. `coder` for writing/editing code, `planner` for decomposing work, `tester` for writing or running tests, `researcher` for investigation, `general` for anything else. Defaults to `coder`.',
|
|
118
|
-
},
|
|
119
|
-
provider: {
|
|
120
|
-
type: 'string',
|
|
121
|
-
enum: ['codex', 'copilot', 'claude-cli'],
|
|
122
|
-
description: 'Force a specific backend instead of the one registered for the `task_type`. Leave unset in almost all cases — only override when you need a particular provider for capability reasons.',
|
|
123
|
-
},
|
|
124
|
-
reasoning: {
|
|
125
|
-
type: 'string',
|
|
126
|
-
enum: [...REASONING_OPTIONS],
|
|
127
|
-
description: REASONING_DESCRIPTION,
|
|
128
|
-
},
|
|
129
|
-
cwd: {
|
|
130
|
-
type: 'string',
|
|
131
|
-
description: 'Absolute working directory the task runs in. Defaults to the server process cwd; set this when the work is scoped to a specific repo or subfolder.',
|
|
132
|
-
},
|
|
133
|
-
timeout_ms: {
|
|
134
|
-
type: 'integer',
|
|
135
|
-
minimum: 1000,
|
|
136
|
-
maximum: 3600000,
|
|
137
|
-
description: 'Hard time limit for the task in milliseconds. The task is marked `timed_out` if it exceeds this. Defaults to the provider default when omitted.',
|
|
138
|
-
},
|
|
139
|
-
keep_alive: {
|
|
140
|
-
type: 'number',
|
|
141
|
-
description: 'SEP-1686 retention window (ms). How long the server keeps the completed task result available for follow-up queries after the task finishes.',
|
|
142
|
-
},
|
|
143
|
-
labels: {
|
|
144
|
-
type: 'array',
|
|
145
|
-
items: { type: 'string' },
|
|
146
|
-
description: 'Free-form tags for filtering and grouping in the task scoreboard. Purely organizational — they do not affect execution.',
|
|
147
|
-
},
|
|
148
|
-
depends_on: {
|
|
149
|
-
type: 'array',
|
|
150
|
-
items: { type: 'string' },
|
|
151
|
-
description: 'Task IDs that must reach a terminal state before this task is allowed to start. Use this to chain dependent work.',
|
|
152
|
-
},
|
|
153
|
-
developer_instructions: {
|
|
154
|
-
type: 'string',
|
|
155
|
-
description: 'System-level instructions injected ahead of the user prompt. Use this for hard constraints (coding style, allowed directories, forbidden actions) rather than folding them into the prompt.',
|
|
156
|
-
},
|
|
157
|
-
context_files: {
|
|
158
|
-
type: 'array',
|
|
159
|
-
items: {
|
|
160
|
-
type: 'object',
|
|
161
|
-
properties: {
|
|
162
|
-
path: { type: 'string', description: 'Absolute path of a file to include as context for the task.' },
|
|
163
|
-
description: { type: 'string', description: 'Optional note explaining why this file is relevant so the agent knows what to look at.' },
|
|
164
|
-
},
|
|
165
|
-
required: ['path'],
|
|
166
|
-
},
|
|
167
|
-
description: 'Files to prepend as additional context. Use sparingly — context is not free; prefer pointing at files from the prompt when the agent can open them itself.',
|
|
168
|
-
},
|
|
169
|
-
}, ['prompt']),
|
|
170
|
-
validate: (value) => spawnTaskSchema.parse(value),
|
|
171
|
-
},
|
|
172
|
-
{
|
|
173
|
-
name: 'wait-task',
|
|
174
|
-
description: [
|
|
175
|
-
'Block until a task settles or asks for input. This is how you synchronously track progress after `spawn-task` or `message-task`.',
|
|
80
|
+
'WRITING A GOOD PROMPT: Name the exact files, functions, or symbols involved, state the expected behavior, and mention anything the agent must NOT touch.',
|
|
81
|
+
].join('\n')],
|
|
82
|
+
['wait-task', [
|
|
83
|
+
'Block until a task settles or asks for input.',
|
|
176
84
|
'',
|
|
177
|
-
'Returns as soon as the task reaches a terminal state (`completed`, `failed`, `cancelled
|
|
85
|
+
'Returns as soon as the task reaches a terminal state (`completed`, `failed`, `cancelled`) or enters `input_required`. If `timeout_ms` elapses first, it returns the current status.',
|
|
178
86
|
'',
|
|
179
|
-
'PATTERN: loop `wait-task` → if `
|
|
180
|
-
].join('\n'),
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
timeout_ms: {
|
|
184
|
-
type: 'integer',
|
|
185
|
-
minimum: 1,
|
|
186
|
-
maximum: 300000,
|
|
187
|
-
default: 30000,
|
|
188
|
-
description: 'Maximum time to block in milliseconds. Returns early on terminal state or `waiting_answer`. Defaults to 30,000 (30 seconds).',
|
|
189
|
-
},
|
|
190
|
-
poll_interval_ms: {
|
|
191
|
-
type: 'integer',
|
|
192
|
-
minimum: 250,
|
|
193
|
-
maximum: 30000,
|
|
194
|
-
default: 1000,
|
|
195
|
-
description: 'Internal poll interval in milliseconds. Keep the default (1,000) unless you have a specific reason to tune it.',
|
|
196
|
-
},
|
|
197
|
-
}, ['task_id']),
|
|
198
|
-
validate: (value) => waitTaskSchema.parse(value),
|
|
199
|
-
},
|
|
200
|
-
{
|
|
201
|
-
name: 'respond-task',
|
|
202
|
-
description: [
|
|
203
|
-
'Unblock a task that is in `waiting_answer` because the agent requested input or an approval.',
|
|
87
|
+
'PATTERN: loop `wait-task` → if `input_required`, call `respond-task` → loop back. Give each call enough time to catch meaningful progress.',
|
|
88
|
+
].join('\n')],
|
|
89
|
+
['respond-task', [
|
|
90
|
+
'Unblock a task that is in `input_required` because the agent requested input or an approval.',
|
|
204
91
|
'',
|
|
205
|
-
'
|
|
206
|
-
'- `user_input` —
|
|
207
|
-
'- `command_approval` — `decision: "accept" | "reject"`
|
|
208
|
-
'- `file_approval` — `decision: "accept" | "reject"`
|
|
209
|
-
'- `elicitation` — `action: "accept" | "decline"`,
|
|
210
|
-
'- `dynamic_tool` —
|
|
92
|
+
'Payload shape is discriminated by `type` — must match the pending question from `wait-task`:',
|
|
93
|
+
'- `user_input` — `answers` map of question id → string',
|
|
94
|
+
'- `command_approval` — `decision: "accept" | "reject"`',
|
|
95
|
+
'- `file_approval` — `decision: "accept" | "reject"`',
|
|
96
|
+
'- `elicitation` — `action: "accept" | "decline"`, optional `content`',
|
|
97
|
+
'- `dynamic_tool` — `result` or `error`',
|
|
211
98
|
'',
|
|
212
|
-
'After responding the task resumes automatically. Follow up with `wait-task
|
|
213
|
-
].join('\n')
|
|
214
|
-
|
|
215
|
-
task_id: { type: 'string', minLength: 1, description: 'ID of the paused task. Must currently be in `waiting_answer`.' },
|
|
216
|
-
type: {
|
|
217
|
-
type: 'string',
|
|
218
|
-
enum: ['user_input', 'command_approval', 'file_approval', 'elicitation', 'dynamic_tool'],
|
|
219
|
-
description: 'Which pending-question variant you are answering. Must match the `type` of the question returned by `wait-task` exactly.',
|
|
220
|
-
},
|
|
221
|
-
answers: {
|
|
222
|
-
type: 'object',
|
|
223
|
-
description: 'For `user_input`: map of each question id (as returned in the pending question) to the user-facing answer string.',
|
|
224
|
-
},
|
|
225
|
-
decision: {
|
|
226
|
-
type: 'string',
|
|
227
|
-
enum: ['accept', 'reject'],
|
|
228
|
-
description: 'For `command_approval` or `file_approval`: whether the agent may run the proposed command / apply the proposed edit.',
|
|
229
|
-
},
|
|
230
|
-
action: {
|
|
231
|
-
type: 'string',
|
|
232
|
-
enum: ['accept', 'decline'],
|
|
233
|
-
description: 'For `elicitation`: accept the MCP server\'s elicitation request or decline it.',
|
|
234
|
-
},
|
|
235
|
-
content: {
|
|
236
|
-
type: 'object',
|
|
237
|
-
description: 'For `elicitation`: optional structured payload that satisfies the requested schema when accepting.',
|
|
238
|
-
},
|
|
239
|
-
result: {
|
|
240
|
-
type: 'string',
|
|
241
|
-
description: 'For `dynamic_tool`: the tool call result string returned to the agent.',
|
|
242
|
-
},
|
|
243
|
-
error: {
|
|
244
|
-
type: 'string',
|
|
245
|
-
description: 'For `dynamic_tool`: error string if the tool call failed. Sets `success=false` on the response.',
|
|
246
|
-
},
|
|
247
|
-
}, ['task_id', 'type']),
|
|
248
|
-
validate: (value) => respondTaskSchema.parse(value),
|
|
249
|
-
},
|
|
250
|
-
{
|
|
251
|
-
name: 'message-task',
|
|
252
|
-
description: [
|
|
99
|
+
'After responding the task resumes automatically. Follow up with `wait-task`.',
|
|
100
|
+
].join('\n')],
|
|
101
|
+
['message-task', [
|
|
253
102
|
'Send a follow-up message to an existing task on its original session.',
|
|
254
103
|
'',
|
|
255
|
-
'Use this to
|
|
104
|
+
'Use this to steer a running task, refine completed work, or add instructions after reviewing partial results.',
|
|
256
105
|
'',
|
|
257
106
|
'After calling, follow up with `wait-task` exactly like after `spawn-task`.',
|
|
258
|
-
].join('\n')
|
|
259
|
-
|
|
260
|
-
task_id: { type: 'string', minLength: 1, description: 'ID of the task whose session should receive the follow-up.' },
|
|
261
|
-
message: { type: 'string', minLength: 1, description: 'The follow-up instruction or question. Be as specific as the original prompt — reference files and expected behavior.' },
|
|
262
|
-
reasoning: {
|
|
263
|
-
type: 'string',
|
|
264
|
-
enum: [...REASONING_OPTIONS],
|
|
265
|
-
description: `${REASONING_DESCRIPTION}\n\nOverrides the reasoning used for this follow-up turn only.`,
|
|
266
|
-
},
|
|
267
|
-
}, ['task_id', 'message']),
|
|
268
|
-
validate: (value) => messageTaskSchema.parse(value),
|
|
269
|
-
},
|
|
270
|
-
{
|
|
271
|
-
name: 'cancel-task',
|
|
272
|
-
description: [
|
|
107
|
+
].join('\n')],
|
|
108
|
+
['cancel-task', [
|
|
273
109
|
'Cancel one or more running tasks.',
|
|
274
110
|
'',
|
|
275
|
-
'Accepts a single task_id or an array.
|
|
276
|
-
].join('\n')
|
|
277
|
-
|
|
278
|
-
task_id: {
|
|
279
|
-
oneOf: [
|
|
280
|
-
{ type: 'string', minLength: 1, description: 'Single task ID to cancel.' },
|
|
281
|
-
{ type: 'array', items: { type: 'string', minLength: 1 }, minItems: 1, description: 'Array of task IDs to cancel in one call.' },
|
|
282
|
-
],
|
|
283
|
-
description: 'Task ID or array of task IDs to cancel. Accepts both a single string and an array for convenience.',
|
|
284
|
-
},
|
|
285
|
-
}, ['task_id']),
|
|
286
|
-
validate: (value) => cancelTaskSchema.parse(value),
|
|
287
|
-
},
|
|
288
|
-
];
|
|
289
|
-
}
|
|
290
|
-
// ---------------------------------------------------------------------------
|
|
291
|
-
// getToolDescriptions — description strings keyed by tool name
|
|
292
|
-
// Used by index.ts McpServer.registerTool which takes description separately
|
|
293
|
-
// ---------------------------------------------------------------------------
|
|
294
|
-
export function getToolDescriptions(serverVersion) {
|
|
295
|
-
const tools = createToolDefinitions(serverVersion);
|
|
296
|
-
const map = new Map();
|
|
297
|
-
for (const tool of tools) {
|
|
298
|
-
map.set(tool.name, tool.description);
|
|
299
|
-
}
|
|
300
|
-
return map;
|
|
111
|
+
'Accepts a single task_id or an array. Running tasks are aborted and marked `cancelled`. Already-terminal tasks are listed under `already_terminal`; unknown IDs under `not_found`.',
|
|
112
|
+
].join('\n')],
|
|
113
|
+
]);
|
|
301
114
|
}
|
|
302
115
|
const ANNOTATIONS = new Map([
|
|
303
|
-
['spawn-task', {
|
|
304
|
-
['wait-task', {
|
|
305
|
-
['respond-task', {
|
|
306
|
-
['message-task', {
|
|
307
|
-
['cancel-task', {
|
|
116
|
+
['spawn-task', { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true }],
|
|
117
|
+
['wait-task', { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false }],
|
|
118
|
+
['respond-task', { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false }],
|
|
119
|
+
['message-task', { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true }],
|
|
120
|
+
['cancel-task', { readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false }],
|
|
308
121
|
]);
|
|
309
|
-
export function getToolAnnotation(name) {
|
|
122
|
+
export function getToolAnnotation(name) {
|
|
123
|
+
return ANNOTATIONS.get(name) ?? { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false };
|
|
124
|
+
}
|
|
310
125
|
//# sourceMappingURL=tool-definitions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-definitions.js","sourceRoot":"","sources":["../../../src/mcp/tool-definitions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAGrE,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAE/F,8EAA8E;AAC9E,gDAAgD;AAChD,8EAA8E;AAE9E,MAAM,aAAa,GAAG,CAAC,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;AAEhD,8EAA8E;AAC9E,8EAA8E;AAC9E,8EAA8E;AAE9E,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC;IACtC,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACzB,SAAS,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,YAAY,EAAE,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC;IAC3F,QAAQ,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,SAAS,EAAE,YAAY,CAAC,CAAC,CAAC,QAAQ,EAAE;IAC/D,SAAS,EAAE,aAAa,CAAC,QAAQ,EAAE;IACnC,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC1B,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,QAAQ,EAAE;IAChE,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC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AE,cAAc,EAAE,IAAI,EAAE,aAAa,EAAE,KAAK,EAAE,CAAC;IACzG,CAAC,cAAc,EAAE,EAAE,YAAY,EAAE,KAAK,EAAE,eAAe,EAAE,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,CAAC;IAC9G,CAAC,cAAc,EAAE,EAAE,YAAY,EAAE,KAAK,EAAE,eAAe,EAAE,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC;IAC7G,CAAC,aAAa,EAAE,EAAE,YAAY,EAAE,KAAK,EAAE,eAAe,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE,aAAa,EAAE,KAAK,EAAE,CAAC;CAC5G,CAAC,CAAC;AAEH,MAAM,UAAU,iBAAiB,CAAC,IAAY;IAC5C,OAAO,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,eAAe,EAAE,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,CAAC;AAC/H,CAAC"}
|
package/package.json
CHANGED
package/src/app.ts
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import { homedir } from 'node:os';
|
|
2
2
|
import { join } from 'node:path';
|
|
3
3
|
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
type MessageTaskInput,
|
|
11
|
-
type CancelTaskInput,
|
|
4
|
+
import type {
|
|
5
|
+
SpawnTaskInput,
|
|
6
|
+
WaitTaskInput,
|
|
7
|
+
RespondTaskInput,
|
|
8
|
+
MessageTaskInput,
|
|
9
|
+
CancelTaskInput,
|
|
12
10
|
} from './mcp/tool-definitions.js';
|
|
13
11
|
import { OPERATION_BRIDGE_TIMEOUT_MS, OPERATION_POLL_INTERVAL_MS } from './config/defaults.js';
|
|
14
12
|
import { CodexRuntime } from './services/codex-runtime.js';
|
|
@@ -34,17 +32,11 @@ import {
|
|
|
34
32
|
buildWaitGuidance,
|
|
35
33
|
buildRespondGuidance,
|
|
36
34
|
buildMessageGuidance,
|
|
35
|
+
buildMessageTerminalGuidance,
|
|
37
36
|
buildCancelGuidance,
|
|
38
37
|
} from './mcp/next-action-guidance.js';
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
export interface ResourceDefinition {
|
|
43
|
-
uri: string;
|
|
44
|
-
name: string;
|
|
45
|
-
description: string;
|
|
46
|
-
mimeType: string;
|
|
47
|
-
}
|
|
38
|
+
import { applyRecovery } from './task/task-persistence.js';
|
|
39
|
+
|
|
48
40
|
|
|
49
41
|
export class CodexWorkerApp {
|
|
50
42
|
private readonly runtime = new CodexRuntime();
|
|
@@ -91,70 +83,6 @@ export class CodexWorkerApp {
|
|
|
91
83
|
await this.runtime.shutdown();
|
|
92
84
|
}
|
|
93
85
|
|
|
94
|
-
async listTools(serverVersion?: string): Promise<ToolDefinition[]> {
|
|
95
|
-
return createToolDefinitions(serverVersion, this.taskManager);
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
listResources(): ResourceDefinition[] {
|
|
99
|
-
const base: ResourceDefinition[] = [];
|
|
100
|
-
|
|
101
|
-
// Task tracking resources
|
|
102
|
-
base.push(
|
|
103
|
-
{
|
|
104
|
-
uri: 'task:///all',
|
|
105
|
-
name: 'Task Scoreboard',
|
|
106
|
-
description: 'Compact overview of all tracked tasks with status badges',
|
|
107
|
-
mimeType: 'text/plain',
|
|
108
|
-
},
|
|
109
|
-
{
|
|
110
|
-
uri: 'task:///{id}',
|
|
111
|
-
name: 'Task Detail',
|
|
112
|
-
description: 'Full detail view for a specific task (template: replace {id})',
|
|
113
|
-
mimeType: 'text/markdown',
|
|
114
|
-
},
|
|
115
|
-
{
|
|
116
|
-
uri: 'task:///{id}/log',
|
|
117
|
-
name: 'Task Summary Log',
|
|
118
|
-
description: 'Last 20 output lines for a task (template: replace {id})',
|
|
119
|
-
mimeType: 'text/plain',
|
|
120
|
-
},
|
|
121
|
-
{
|
|
122
|
-
uri: 'task:///{id}/log.verbose',
|
|
123
|
-
name: 'Task Verbose Log',
|
|
124
|
-
description: 'Full output log for a task (template: replace {id})',
|
|
125
|
-
mimeType: 'text/plain',
|
|
126
|
-
},
|
|
127
|
-
{
|
|
128
|
-
uri: 'task:///{id}/events',
|
|
129
|
-
name: 'Task Event Stream',
|
|
130
|
-
description: 'Raw JSONL event trace for a task — every Codex notification with timestamp (template: replace {id})',
|
|
131
|
-
mimeType: 'application/jsonl',
|
|
132
|
-
},
|
|
133
|
-
);
|
|
134
|
-
|
|
135
|
-
// Dynamic task detail resources for known tasks
|
|
136
|
-
if (this.taskManager) {
|
|
137
|
-
for (const task of this.taskManager.getAllTasks()) {
|
|
138
|
-
base.push(
|
|
139
|
-
{
|
|
140
|
-
uri: `task:///${task.id}`,
|
|
141
|
-
name: `Task ${task.id}`,
|
|
142
|
-
description: `Task detail: ${task.prompt.slice(0, 50)}`,
|
|
143
|
-
mimeType: 'text/markdown',
|
|
144
|
-
},
|
|
145
|
-
{
|
|
146
|
-
uri: `task:///${task.id}/log`,
|
|
147
|
-
name: `Task ${task.id} log`,
|
|
148
|
-
description: 'Summary log for this task',
|
|
149
|
-
mimeType: 'text/plain',
|
|
150
|
-
},
|
|
151
|
-
);
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
return base;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
86
|
async readResource(uri: string): Promise<{ mimeType: string; text: string }> {
|
|
159
87
|
// ---- Task tracking resources ----
|
|
160
88
|
if (uri === 'task:///all') {
|
|
@@ -164,6 +92,30 @@ export class CodexWorkerApp {
|
|
|
164
92
|
};
|
|
165
93
|
}
|
|
166
94
|
|
|
95
|
+
// Filtered events — excludes high-frequency delta events (reasoning, message, command output)
|
|
96
|
+
const taskEventsSummaryMatch = /^task:\/\/\/([^/]+)\/events\/summary$/.exec(uri);
|
|
97
|
+
if (taskEventsSummaryMatch) {
|
|
98
|
+
const taskId = decodeURIComponent(taskEventsSummaryMatch[1]!);
|
|
99
|
+
const content = await this.fileWriter.readEventsLog(taskId);
|
|
100
|
+
if (content !== null) {
|
|
101
|
+
const DELTA_METHODS = new Set([
|
|
102
|
+
'item/reasoning/summaryTextDelta', 'item/reasoning/textDelta',
|
|
103
|
+
'item/agentMessage/delta', 'item/commandExecution/outputDelta',
|
|
104
|
+
'item/fileChange/outputDelta', 'item/plan/delta',
|
|
105
|
+
]);
|
|
106
|
+
const filtered = content.split('\n').filter(line => {
|
|
107
|
+
if (!line.trim()) return false;
|
|
108
|
+
try {
|
|
109
|
+
const event = JSON.parse(line) as Record<string, unknown>;
|
|
110
|
+
return !DELTA_METHODS.has(event.method as string);
|
|
111
|
+
} catch { return true; }
|
|
112
|
+
}).join('\n');
|
|
113
|
+
return { mimeType: 'application/jsonl', text: filtered };
|
|
114
|
+
}
|
|
115
|
+
return { mimeType: 'text/plain', text: `No events log for task: ${taskId}` };
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// Full events — all events unfiltered
|
|
167
119
|
const taskEventsMatch = /^task:\/\/\/([^/]+)\/events$/.exec(uri);
|
|
168
120
|
if (taskEventsMatch) {
|
|
169
121
|
const taskId = decodeURIComponent(taskEventsMatch[1]!);
|
|
@@ -229,25 +181,19 @@ export class CodexWorkerApp {
|
|
|
229
181
|
}
|
|
230
182
|
|
|
231
183
|
async callTool(name: string, args: unknown): Promise<string> {
|
|
232
|
-
//
|
|
233
|
-
//
|
|
234
|
-
const tools = createToolDefinitions();
|
|
235
|
-
const tool = tools.find((candidate) => candidate.name === name);
|
|
236
|
-
if (!tool) {
|
|
237
|
-
throw new Error(`Unknown tool: ${name}`);
|
|
238
|
-
}
|
|
239
|
-
const validated = tool.validate(args ?? {});
|
|
184
|
+
// The SDK already validated args via the Zod schema passed to registerTool.
|
|
185
|
+
// We just route to the correct handler — no need to re-validate.
|
|
240
186
|
switch (name) {
|
|
241
187
|
case 'spawn-task':
|
|
242
|
-
return this.handleSpawnTask(
|
|
188
|
+
return this.handleSpawnTask(args as SpawnTaskInput);
|
|
243
189
|
case 'wait-task':
|
|
244
|
-
return this.handleWaitTask(
|
|
190
|
+
return this.handleWaitTask(args as WaitTaskInput);
|
|
245
191
|
case 'respond-task':
|
|
246
|
-
return this.handleRespondTask(
|
|
192
|
+
return this.handleRespondTask(args as RespondTaskInput);
|
|
247
193
|
case 'message-task':
|
|
248
|
-
return this.handleMessageTask(
|
|
194
|
+
return this.handleMessageTask(args as MessageTaskInput);
|
|
249
195
|
case 'cancel-task':
|
|
250
|
-
return this.handleCancelTask(
|
|
196
|
+
return this.handleCancelTask(args as CancelTaskInput);
|
|
251
197
|
default:
|
|
252
198
|
throw new Error(`Unhandled tool: ${name}`);
|
|
253
199
|
}
|
|
@@ -587,7 +533,25 @@ export class CodexWorkerApp {
|
|
|
587
533
|
}
|
|
588
534
|
|
|
589
535
|
if (isTerminalStatus(task.status)) {
|
|
590
|
-
|
|
536
|
+
const wireStatus = mapToWireState(task.status);
|
|
537
|
+
const taskDir = join(this.persistenceRoot, taskId);
|
|
538
|
+
const result: Record<string, unknown> = {
|
|
539
|
+
task_id: taskId,
|
|
540
|
+
status: wireStatus,
|
|
541
|
+
error: task.error ?? `Task is in terminal status: ${task.status}`,
|
|
542
|
+
resources: {
|
|
543
|
+
scoreboard: 'task:///all',
|
|
544
|
+
detail: `task:///${taskId}`,
|
|
545
|
+
log: `task:///${taskId}/log`,
|
|
546
|
+
},
|
|
547
|
+
disk_paths: {
|
|
548
|
+
dir: taskDir,
|
|
549
|
+
events_log: join(taskDir, 'events.jsonl'),
|
|
550
|
+
meta: join(taskDir, 'meta.json'),
|
|
551
|
+
},
|
|
552
|
+
};
|
|
553
|
+
const guidance = buildMessageTerminalGuidance(task);
|
|
554
|
+
return JSON.stringify(result, null, 2) + '\n' + guidance.join('\n');
|
|
591
555
|
}
|
|
592
556
|
|
|
593
557
|
// Parse `gpt-5.4(effort)` → { model, effort } so the runtime can forward
|