@youdie006/prodex 0.2.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/LICENSE +21 -0
- package/README.md +418 -0
- package/dist/banner.d.ts +5 -0
- package/dist/banner.js +47 -0
- package/dist/banner.js.map +1 -0
- package/dist/bundle.d.ts +15 -0
- package/dist/bundle.js +30 -0
- package/dist/bundle.js.map +1 -0
- package/dist/chatgpt-browser.d.ts +119 -0
- package/dist/chatgpt-browser.js +857 -0
- package/dist/chatgpt-browser.js.map +1 -0
- package/dist/cli.d.ts +8 -0
- package/dist/cli.js +3502 -0
- package/dist/cli.js.map +1 -0
- package/dist/config.d.ts +58 -0
- package/dist/config.js +277 -0
- package/dist/config.js.map +1 -0
- package/dist/http-mcp.d.ts +20 -0
- package/dist/http-mcp.js +236 -0
- package/dist/http-mcp.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp-tools.d.ts +395 -0
- package/dist/mcp-tools.js +167 -0
- package/dist/mcp-tools.js.map +1 -0
- package/dist/mcp.d.ts +37 -0
- package/dist/mcp.js +229 -0
- package/dist/mcp.js.map +1 -0
- package/dist/repo-write.d.ts +47 -0
- package/dist/repo-write.js +427 -0
- package/dist/repo-write.js.map +1 -0
- package/dist/repo.d.ts +27 -0
- package/dist/repo.js +386 -0
- package/dist/repo.js.map +1 -0
- package/dist/safe-file.d.ts +25 -0
- package/dist/safe-file.js +295 -0
- package/dist/safe-file.js.map +1 -0
- package/dist/schema.d.ts +402 -0
- package/dist/schema.js +109 -0
- package/dist/schema.js.map +1 -0
- package/dist/store.d.ts +157 -0
- package/dist/store.js +1402 -0
- package/dist/store.js.map +1 -0
- package/docs/claude.md +130 -0
- package/docs/clients.md +75 -0
- package/docs/http-mcp.md +223 -0
- package/package.json +67 -0
- package/scripts/release-check.mjs +436 -0
- package/scripts/release-pack.mjs +481 -0
|
@@ -0,0 +1,395 @@
|
|
|
1
|
+
import { type ListReceiptsInput } from "./store.js";
|
|
2
|
+
import type { BridgeFile, SourceSchema } from "./schema.js";
|
|
3
|
+
import type { z } from "zod";
|
|
4
|
+
type BridgeSource = z.infer<typeof SourceSchema>;
|
|
5
|
+
type McpBridgeFileInput = {
|
|
6
|
+
path: string;
|
|
7
|
+
role?: BridgeFile["role"];
|
|
8
|
+
bytes?: number;
|
|
9
|
+
};
|
|
10
|
+
export declare const MAX_MCP_BRIDGE_TEXT_BYTES = 100000;
|
|
11
|
+
export declare const MAX_MCP_SHORT_TEXT_BYTES = 10000;
|
|
12
|
+
export interface McpToolContext {
|
|
13
|
+
cwd: string;
|
|
14
|
+
source?: BridgeSource;
|
|
15
|
+
claimedBy?: string;
|
|
16
|
+
}
|
|
17
|
+
export declare function createMcpToolHandlers(context: McpToolContext): {
|
|
18
|
+
bridge_create_task(input: {
|
|
19
|
+
title: string;
|
|
20
|
+
prompt: string;
|
|
21
|
+
repo_id?: string;
|
|
22
|
+
files?: McpBridgeFileInput[];
|
|
23
|
+
}): Promise<{
|
|
24
|
+
task: {
|
|
25
|
+
status: "new" | "claimed" | "done" | "blocked";
|
|
26
|
+
schema_version: 1;
|
|
27
|
+
id: string;
|
|
28
|
+
source: "manual" | "chatgpt_project" | "codex" | "claude";
|
|
29
|
+
title: string;
|
|
30
|
+
prompt: string;
|
|
31
|
+
repo_id: string;
|
|
32
|
+
files: {
|
|
33
|
+
path: string;
|
|
34
|
+
role: "context" | "artifact" | "result";
|
|
35
|
+
bytes?: number | undefined;
|
|
36
|
+
sha256?: string | undefined;
|
|
37
|
+
}[];
|
|
38
|
+
provenance: {
|
|
39
|
+
adapter: "cli" | "mcp" | "manual" | "oracle" | "chatgpt-control";
|
|
40
|
+
warnings: string[];
|
|
41
|
+
session_id?: string | undefined;
|
|
42
|
+
thread?: string | undefined;
|
|
43
|
+
project?: string | undefined;
|
|
44
|
+
};
|
|
45
|
+
created_at: string;
|
|
46
|
+
updated_at: string;
|
|
47
|
+
claimed_by?: string | undefined;
|
|
48
|
+
claimed_at?: string | undefined;
|
|
49
|
+
blocker?: {
|
|
50
|
+
code: string;
|
|
51
|
+
message: string;
|
|
52
|
+
retryable: boolean;
|
|
53
|
+
next_step?: string | undefined;
|
|
54
|
+
} | undefined;
|
|
55
|
+
result_path?: string | undefined;
|
|
56
|
+
manifest_path?: string | undefined;
|
|
57
|
+
};
|
|
58
|
+
}>;
|
|
59
|
+
bridge_list_tasks(input: {
|
|
60
|
+
status?: "new" | "claimed" | "done" | "blocked";
|
|
61
|
+
}): Promise<{
|
|
62
|
+
tasks: {
|
|
63
|
+
status: "new" | "claimed" | "done" | "blocked";
|
|
64
|
+
schema_version: 1;
|
|
65
|
+
id: string;
|
|
66
|
+
source: "manual" | "chatgpt_project" | "codex" | "claude";
|
|
67
|
+
title: string;
|
|
68
|
+
prompt: string;
|
|
69
|
+
repo_id: string;
|
|
70
|
+
files: {
|
|
71
|
+
path: string;
|
|
72
|
+
role: "context" | "artifact" | "result";
|
|
73
|
+
bytes?: number | undefined;
|
|
74
|
+
sha256?: string | undefined;
|
|
75
|
+
}[];
|
|
76
|
+
provenance: {
|
|
77
|
+
adapter: "cli" | "mcp" | "manual" | "oracle" | "chatgpt-control";
|
|
78
|
+
warnings: string[];
|
|
79
|
+
session_id?: string | undefined;
|
|
80
|
+
thread?: string | undefined;
|
|
81
|
+
project?: string | undefined;
|
|
82
|
+
};
|
|
83
|
+
created_at: string;
|
|
84
|
+
updated_at: string;
|
|
85
|
+
claimed_by?: string | undefined;
|
|
86
|
+
claimed_at?: string | undefined;
|
|
87
|
+
blocker?: {
|
|
88
|
+
code: string;
|
|
89
|
+
message: string;
|
|
90
|
+
retryable: boolean;
|
|
91
|
+
next_step?: string | undefined;
|
|
92
|
+
} | undefined;
|
|
93
|
+
result_path?: string | undefined;
|
|
94
|
+
manifest_path?: string | undefined;
|
|
95
|
+
}[];
|
|
96
|
+
}>;
|
|
97
|
+
bridge_get_task(input: {
|
|
98
|
+
task_id: string;
|
|
99
|
+
}): Promise<{
|
|
100
|
+
task: {
|
|
101
|
+
status: "new" | "claimed" | "done" | "blocked";
|
|
102
|
+
schema_version: 1;
|
|
103
|
+
id: string;
|
|
104
|
+
source: "manual" | "chatgpt_project" | "codex" | "claude";
|
|
105
|
+
title: string;
|
|
106
|
+
prompt: string;
|
|
107
|
+
repo_id: string;
|
|
108
|
+
files: {
|
|
109
|
+
path: string;
|
|
110
|
+
role: "context" | "artifact" | "result";
|
|
111
|
+
bytes?: number | undefined;
|
|
112
|
+
sha256?: string | undefined;
|
|
113
|
+
}[];
|
|
114
|
+
provenance: {
|
|
115
|
+
adapter: "cli" | "mcp" | "manual" | "oracle" | "chatgpt-control";
|
|
116
|
+
warnings: string[];
|
|
117
|
+
session_id?: string | undefined;
|
|
118
|
+
thread?: string | undefined;
|
|
119
|
+
project?: string | undefined;
|
|
120
|
+
};
|
|
121
|
+
created_at: string;
|
|
122
|
+
updated_at: string;
|
|
123
|
+
claimed_by?: string | undefined;
|
|
124
|
+
claimed_at?: string | undefined;
|
|
125
|
+
blocker?: {
|
|
126
|
+
code: string;
|
|
127
|
+
message: string;
|
|
128
|
+
retryable: boolean;
|
|
129
|
+
next_step?: string | undefined;
|
|
130
|
+
} | undefined;
|
|
131
|
+
result_path?: string | undefined;
|
|
132
|
+
manifest_path?: string | undefined;
|
|
133
|
+
};
|
|
134
|
+
}>;
|
|
135
|
+
bridge_claim_task(input: {
|
|
136
|
+
task_id: string;
|
|
137
|
+
claimed_by?: string;
|
|
138
|
+
}): Promise<{
|
|
139
|
+
task: {
|
|
140
|
+
status: "new" | "claimed" | "done" | "blocked";
|
|
141
|
+
schema_version: 1;
|
|
142
|
+
id: string;
|
|
143
|
+
source: "manual" | "chatgpt_project" | "codex" | "claude";
|
|
144
|
+
title: string;
|
|
145
|
+
prompt: string;
|
|
146
|
+
repo_id: string;
|
|
147
|
+
files: {
|
|
148
|
+
path: string;
|
|
149
|
+
role: "context" | "artifact" | "result";
|
|
150
|
+
bytes?: number | undefined;
|
|
151
|
+
sha256?: string | undefined;
|
|
152
|
+
}[];
|
|
153
|
+
provenance: {
|
|
154
|
+
adapter: "cli" | "mcp" | "manual" | "oracle" | "chatgpt-control";
|
|
155
|
+
warnings: string[];
|
|
156
|
+
session_id?: string | undefined;
|
|
157
|
+
thread?: string | undefined;
|
|
158
|
+
project?: string | undefined;
|
|
159
|
+
};
|
|
160
|
+
created_at: string;
|
|
161
|
+
updated_at: string;
|
|
162
|
+
claimed_by?: string | undefined;
|
|
163
|
+
claimed_at?: string | undefined;
|
|
164
|
+
blocker?: {
|
|
165
|
+
code: string;
|
|
166
|
+
message: string;
|
|
167
|
+
retryable: boolean;
|
|
168
|
+
next_step?: string | undefined;
|
|
169
|
+
} | undefined;
|
|
170
|
+
result_path?: string | undefined;
|
|
171
|
+
manifest_path?: string | undefined;
|
|
172
|
+
};
|
|
173
|
+
}>;
|
|
174
|
+
bridge_complete_task(input: {
|
|
175
|
+
task_id: string;
|
|
176
|
+
summary: string;
|
|
177
|
+
artifacts?: McpBridgeFileInput[];
|
|
178
|
+
commands?: string[];
|
|
179
|
+
warnings?: string[];
|
|
180
|
+
}): Promise<{
|
|
181
|
+
result: {
|
|
182
|
+
status: "done" | "blocked";
|
|
183
|
+
warnings: string[];
|
|
184
|
+
schema_version: 1;
|
|
185
|
+
created_at: string;
|
|
186
|
+
task_id: string;
|
|
187
|
+
summary: string;
|
|
188
|
+
artifacts: {
|
|
189
|
+
path: string;
|
|
190
|
+
role: "context" | "artifact" | "result";
|
|
191
|
+
bytes?: number | undefined;
|
|
192
|
+
sha256?: string | undefined;
|
|
193
|
+
}[];
|
|
194
|
+
commands: string[];
|
|
195
|
+
blocker?: {
|
|
196
|
+
code: string;
|
|
197
|
+
message: string;
|
|
198
|
+
retryable: boolean;
|
|
199
|
+
next_step?: string | undefined;
|
|
200
|
+
} | undefined;
|
|
201
|
+
};
|
|
202
|
+
}>;
|
|
203
|
+
bridge_block_task(input: {
|
|
204
|
+
task_id: string;
|
|
205
|
+
summary: string;
|
|
206
|
+
code?: string;
|
|
207
|
+
next_step?: string;
|
|
208
|
+
retryable?: boolean;
|
|
209
|
+
artifacts?: McpBridgeFileInput[];
|
|
210
|
+
commands?: string[];
|
|
211
|
+
warnings?: string[];
|
|
212
|
+
}): Promise<{
|
|
213
|
+
result: {
|
|
214
|
+
status: "done" | "blocked";
|
|
215
|
+
warnings: string[];
|
|
216
|
+
schema_version: 1;
|
|
217
|
+
created_at: string;
|
|
218
|
+
task_id: string;
|
|
219
|
+
summary: string;
|
|
220
|
+
artifacts: {
|
|
221
|
+
path: string;
|
|
222
|
+
role: "context" | "artifact" | "result";
|
|
223
|
+
bytes?: number | undefined;
|
|
224
|
+
sha256?: string | undefined;
|
|
225
|
+
}[];
|
|
226
|
+
commands: string[];
|
|
227
|
+
blocker?: {
|
|
228
|
+
code: string;
|
|
229
|
+
message: string;
|
|
230
|
+
retryable: boolean;
|
|
231
|
+
next_step?: string | undefined;
|
|
232
|
+
} | undefined;
|
|
233
|
+
};
|
|
234
|
+
}>;
|
|
235
|
+
bridge_list_results(): Promise<{
|
|
236
|
+
results: {
|
|
237
|
+
status: "done" | "blocked";
|
|
238
|
+
warnings: string[];
|
|
239
|
+
schema_version: 1;
|
|
240
|
+
created_at: string;
|
|
241
|
+
task_id: string;
|
|
242
|
+
summary: string;
|
|
243
|
+
artifacts: {
|
|
244
|
+
path: string;
|
|
245
|
+
role: "context" | "artifact" | "result";
|
|
246
|
+
bytes?: number | undefined;
|
|
247
|
+
sha256?: string | undefined;
|
|
248
|
+
}[];
|
|
249
|
+
commands: string[];
|
|
250
|
+
blocker?: {
|
|
251
|
+
code: string;
|
|
252
|
+
message: string;
|
|
253
|
+
retryable: boolean;
|
|
254
|
+
next_step?: string | undefined;
|
|
255
|
+
} | undefined;
|
|
256
|
+
}[];
|
|
257
|
+
}>;
|
|
258
|
+
bridge_fetch_result(input: {
|
|
259
|
+
task_id: string;
|
|
260
|
+
}): Promise<{
|
|
261
|
+
result: {
|
|
262
|
+
status: "done" | "blocked";
|
|
263
|
+
warnings: string[];
|
|
264
|
+
schema_version: 1;
|
|
265
|
+
created_at: string;
|
|
266
|
+
task_id: string;
|
|
267
|
+
summary: string;
|
|
268
|
+
artifacts: {
|
|
269
|
+
path: string;
|
|
270
|
+
role: "context" | "artifact" | "result";
|
|
271
|
+
bytes?: number | undefined;
|
|
272
|
+
sha256?: string | undefined;
|
|
273
|
+
}[];
|
|
274
|
+
commands: string[];
|
|
275
|
+
blocker?: {
|
|
276
|
+
code: string;
|
|
277
|
+
message: string;
|
|
278
|
+
retryable: boolean;
|
|
279
|
+
next_step?: string | undefined;
|
|
280
|
+
} | undefined;
|
|
281
|
+
};
|
|
282
|
+
}>;
|
|
283
|
+
bridge_fetch_result_artifact(input: {
|
|
284
|
+
task_id: string;
|
|
285
|
+
path?: string;
|
|
286
|
+
}): Promise<{
|
|
287
|
+
artifact: BridgeFile;
|
|
288
|
+
content: string;
|
|
289
|
+
}>;
|
|
290
|
+
bridge_list_receipts(input: ListReceiptsInput): Promise<{
|
|
291
|
+
receipts: {
|
|
292
|
+
schema_version: 1;
|
|
293
|
+
id: string;
|
|
294
|
+
created_at: string;
|
|
295
|
+
summary: string;
|
|
296
|
+
kind: "task_created" | "task_claimed" | "task_completed" | "consult_preview" | "consult_answer_saved" | "repo_write_dry_run" | "repo_write_applied" | "repo_stage_reviewed_paths";
|
|
297
|
+
metadata: Record<string, unknown>;
|
|
298
|
+
session_id?: string | undefined;
|
|
299
|
+
task_id?: string | undefined;
|
|
300
|
+
integrity?: {
|
|
301
|
+
algorithm: "hmac-sha256";
|
|
302
|
+
digest: string;
|
|
303
|
+
} | undefined;
|
|
304
|
+
}[];
|
|
305
|
+
}>;
|
|
306
|
+
bridge_get_receipt(input: {
|
|
307
|
+
receipt_id: string;
|
|
308
|
+
}): Promise<{
|
|
309
|
+
receipt: {
|
|
310
|
+
schema_version: 1;
|
|
311
|
+
id: string;
|
|
312
|
+
created_at: string;
|
|
313
|
+
summary: string;
|
|
314
|
+
kind: "task_created" | "task_claimed" | "task_completed" | "consult_preview" | "consult_answer_saved" | "repo_write_dry_run" | "repo_write_applied" | "repo_stage_reviewed_paths";
|
|
315
|
+
metadata: Record<string, unknown>;
|
|
316
|
+
session_id?: string | undefined;
|
|
317
|
+
task_id?: string | undefined;
|
|
318
|
+
integrity?: {
|
|
319
|
+
algorithm: "hmac-sha256";
|
|
320
|
+
digest: string;
|
|
321
|
+
} | undefined;
|
|
322
|
+
};
|
|
323
|
+
}>;
|
|
324
|
+
bridge_list_sessions(input: {
|
|
325
|
+
status?: "preview" | "running" | "done" | "blocked";
|
|
326
|
+
}): Promise<{
|
|
327
|
+
sessions: {
|
|
328
|
+
status: "done" | "blocked" | "preview" | "running";
|
|
329
|
+
warnings: string[];
|
|
330
|
+
schema_version: 1;
|
|
331
|
+
id: string;
|
|
332
|
+
created_at: string;
|
|
333
|
+
direction: "codex_to_chatgpt" | "chatgpt_to_codex" | "claude_to_codex";
|
|
334
|
+
backend: "cli" | "mcp" | "manual" | "oracle" | "chatgpt-control";
|
|
335
|
+
last_used_at: string;
|
|
336
|
+
thread?: string | undefined;
|
|
337
|
+
project?: string | undefined;
|
|
338
|
+
blocker?: {
|
|
339
|
+
code: string;
|
|
340
|
+
message: string;
|
|
341
|
+
retryable: boolean;
|
|
342
|
+
next_step?: string | undefined;
|
|
343
|
+
} | undefined;
|
|
344
|
+
task_id?: string | undefined;
|
|
345
|
+
}[];
|
|
346
|
+
}>;
|
|
347
|
+
bridge_get_session(input: {
|
|
348
|
+
session_id: string;
|
|
349
|
+
}): Promise<{
|
|
350
|
+
session: {
|
|
351
|
+
status: "done" | "blocked" | "preview" | "running";
|
|
352
|
+
warnings: string[];
|
|
353
|
+
schema_version: 1;
|
|
354
|
+
id: string;
|
|
355
|
+
created_at: string;
|
|
356
|
+
direction: "codex_to_chatgpt" | "chatgpt_to_codex" | "claude_to_codex";
|
|
357
|
+
backend: "cli" | "mcp" | "manual" | "oracle" | "chatgpt-control";
|
|
358
|
+
last_used_at: string;
|
|
359
|
+
thread?: string | undefined;
|
|
360
|
+
project?: string | undefined;
|
|
361
|
+
blocker?: {
|
|
362
|
+
code: string;
|
|
363
|
+
message: string;
|
|
364
|
+
retryable: boolean;
|
|
365
|
+
next_step?: string | undefined;
|
|
366
|
+
} | undefined;
|
|
367
|
+
task_id?: string | undefined;
|
|
368
|
+
};
|
|
369
|
+
}>;
|
|
370
|
+
repo_read_file(input: {
|
|
371
|
+
path: string;
|
|
372
|
+
start_line?: number;
|
|
373
|
+
max_lines?: number;
|
|
374
|
+
}): Promise<import("./repo.js").ReadRepoFileResult>;
|
|
375
|
+
repo_search(input: {
|
|
376
|
+
query: string;
|
|
377
|
+
glob?: string;
|
|
378
|
+
}): Promise<import("./repo.js").SearchRepoResult>;
|
|
379
|
+
repo_write_file_dry_run(input: {
|
|
380
|
+
path: string;
|
|
381
|
+
content: string;
|
|
382
|
+
expected_head: string;
|
|
383
|
+
}): Promise<import("./repo-write.js").RepoWriteDryRunResult>;
|
|
384
|
+
repo_write_file_apply(input: {
|
|
385
|
+
receipt_id: string;
|
|
386
|
+
expected_head: string;
|
|
387
|
+
preimage_sha256: string;
|
|
388
|
+
}): Promise<import("./repo-write.js").RepoWriteApplyResult>;
|
|
389
|
+
repo_stage_reviewed_paths(input: {
|
|
390
|
+
receipt_ids: string[];
|
|
391
|
+
expected_head: string;
|
|
392
|
+
}): Promise<import("./repo-write.js").RepoStageReviewedPathsResult>;
|
|
393
|
+
};
|
|
394
|
+
export type McpToolHandlers = ReturnType<typeof createMcpToolHandlers>;
|
|
395
|
+
export {};
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import { BridgeStore, MAX_FETCHABLE_RESULT_ARTIFACT_BYTES } from "./store.js";
|
|
2
|
+
import { readRepoFile, searchRepoWithMetadata } from "./repo.js";
|
|
3
|
+
import { applyRepoWriteDryRun, createRepoWriteDryRun, stageReviewedPaths } from "./repo-write.js";
|
|
4
|
+
export const MAX_MCP_BRIDGE_TEXT_BYTES = MAX_FETCHABLE_RESULT_ARTIFACT_BYTES;
|
|
5
|
+
export const MAX_MCP_SHORT_TEXT_BYTES = 10_000;
|
|
6
|
+
const MAX_MCP_LIST_ITEMS = 100;
|
|
7
|
+
export function createMcpToolHandlers(context) {
|
|
8
|
+
const store = new BridgeStore(context.cwd);
|
|
9
|
+
const source = context.source ?? "claude";
|
|
10
|
+
const claimedBy = context.claimedBy ?? source;
|
|
11
|
+
return {
|
|
12
|
+
async bridge_create_task(input) {
|
|
13
|
+
assertMcpTextField(input.title, "title", MAX_MCP_SHORT_TEXT_BYTES);
|
|
14
|
+
assertMcpTextField(input.prompt, "prompt");
|
|
15
|
+
assertMcpTextField(input.repo_id, "repo_id", MAX_MCP_SHORT_TEXT_BYTES);
|
|
16
|
+
assertMcpFiles(input.files);
|
|
17
|
+
const task = await store.createTask({
|
|
18
|
+
source,
|
|
19
|
+
title: input.title,
|
|
20
|
+
prompt: input.prompt,
|
|
21
|
+
repo_id: input.repo_id ?? "default",
|
|
22
|
+
files: (input.files ?? []).map((file) => ({ ...file, role: file.role ?? "context" })),
|
|
23
|
+
provenance: { adapter: "mcp", warnings: [] }
|
|
24
|
+
});
|
|
25
|
+
return { task };
|
|
26
|
+
},
|
|
27
|
+
async bridge_list_tasks(input) {
|
|
28
|
+
return { tasks: await store.listTasksReadOnly(input.status) };
|
|
29
|
+
},
|
|
30
|
+
async bridge_get_task(input) {
|
|
31
|
+
assertMcpTextField(input.task_id, "task_id", MAX_MCP_SHORT_TEXT_BYTES);
|
|
32
|
+
return { task: await store.getTaskReadOnly(input.task_id) };
|
|
33
|
+
},
|
|
34
|
+
async bridge_claim_task(input) {
|
|
35
|
+
assertMcpTextField(input.task_id, "task_id", MAX_MCP_SHORT_TEXT_BYTES);
|
|
36
|
+
assertMcpTextField(input.claimed_by, "claimed_by", MAX_MCP_SHORT_TEXT_BYTES);
|
|
37
|
+
return { task: await store.claimTask(input.task_id, input.claimed_by ?? claimedBy) };
|
|
38
|
+
},
|
|
39
|
+
async bridge_complete_task(input) {
|
|
40
|
+
assertMcpTextField(input.task_id, "task_id", MAX_MCP_SHORT_TEXT_BYTES);
|
|
41
|
+
assertMcpTextField(input.summary, "summary");
|
|
42
|
+
assertMcpFiles(input.artifacts);
|
|
43
|
+
assertMcpStringList(input.commands, "commands");
|
|
44
|
+
assertMcpStringList(input.warnings, "warnings");
|
|
45
|
+
const result = await store.completeTask(input.task_id, {
|
|
46
|
+
status: "done",
|
|
47
|
+
summary: input.summary,
|
|
48
|
+
artifacts: normalizeResultArtifacts(input.artifacts),
|
|
49
|
+
commands: input.commands,
|
|
50
|
+
warnings: input.warnings,
|
|
51
|
+
provenance: { adapter: "mcp" }
|
|
52
|
+
});
|
|
53
|
+
return { result };
|
|
54
|
+
},
|
|
55
|
+
async bridge_block_task(input) {
|
|
56
|
+
assertMcpTextField(input.task_id, "task_id", MAX_MCP_SHORT_TEXT_BYTES);
|
|
57
|
+
assertMcpTextField(input.summary, "summary");
|
|
58
|
+
assertMcpTextField(input.code, "code", MAX_MCP_SHORT_TEXT_BYTES);
|
|
59
|
+
assertMcpTextField(input.next_step, "next_step");
|
|
60
|
+
assertMcpFiles(input.artifacts);
|
|
61
|
+
assertMcpStringList(input.commands, "commands");
|
|
62
|
+
assertMcpStringList(input.warnings, "warnings");
|
|
63
|
+
const result = await store.completeTask(input.task_id, {
|
|
64
|
+
status: "blocked",
|
|
65
|
+
summary: input.summary,
|
|
66
|
+
artifacts: normalizeResultArtifacts(input.artifacts),
|
|
67
|
+
commands: input.commands,
|
|
68
|
+
warnings: input.warnings,
|
|
69
|
+
blocker: {
|
|
70
|
+
code: input.code ?? "manual_blocker",
|
|
71
|
+
message: input.summary,
|
|
72
|
+
retryable: input.retryable === true,
|
|
73
|
+
next_step: input.next_step
|
|
74
|
+
},
|
|
75
|
+
provenance: { adapter: "mcp" }
|
|
76
|
+
});
|
|
77
|
+
return { result };
|
|
78
|
+
},
|
|
79
|
+
async bridge_list_results() {
|
|
80
|
+
return { results: await store.listFinalizedResultsReadOnly() };
|
|
81
|
+
},
|
|
82
|
+
async bridge_fetch_result(input) {
|
|
83
|
+
assertMcpTextField(input.task_id, "task_id", MAX_MCP_SHORT_TEXT_BYTES);
|
|
84
|
+
return { result: await store.getFinalizedResultReadOnly(input.task_id) };
|
|
85
|
+
},
|
|
86
|
+
async bridge_fetch_result_artifact(input) {
|
|
87
|
+
assertMcpTextField(input.task_id, "task_id", MAX_MCP_SHORT_TEXT_BYTES);
|
|
88
|
+
assertMcpTextField(input.path, "path", MAX_MCP_SHORT_TEXT_BYTES);
|
|
89
|
+
return store.readFinalizedResultArtifactText(input.task_id, input.path, { maxBytes: MAX_MCP_BRIDGE_TEXT_BYTES });
|
|
90
|
+
},
|
|
91
|
+
async bridge_list_receipts(input) {
|
|
92
|
+
assertMcpTextField(input.task_id, "task_id", MAX_MCP_SHORT_TEXT_BYTES);
|
|
93
|
+
return { receipts: await store.listReceiptsReadOnly(input) };
|
|
94
|
+
},
|
|
95
|
+
async bridge_get_receipt(input) {
|
|
96
|
+
assertMcpTextField(input.receipt_id, "receipt_id", MAX_MCP_SHORT_TEXT_BYTES);
|
|
97
|
+
return { receipt: await store.getReceiptForDisplayReadOnly(input.receipt_id) };
|
|
98
|
+
},
|
|
99
|
+
async bridge_list_sessions(input) {
|
|
100
|
+
return { sessions: await store.listSessionsReadOnly(input.status) };
|
|
101
|
+
},
|
|
102
|
+
async bridge_get_session(input) {
|
|
103
|
+
assertMcpTextField(input.session_id, "session_id", MAX_MCP_SHORT_TEXT_BYTES);
|
|
104
|
+
return { session: await store.getSessionReadOnly(input.session_id) };
|
|
105
|
+
},
|
|
106
|
+
async repo_read_file(input) {
|
|
107
|
+
assertMcpTextField(input.path, "path", MAX_MCP_SHORT_TEXT_BYTES);
|
|
108
|
+
return readRepoFile(context.cwd, input.path, {
|
|
109
|
+
startLine: input.start_line,
|
|
110
|
+
maxLines: input.max_lines
|
|
111
|
+
});
|
|
112
|
+
},
|
|
113
|
+
async repo_search(input) {
|
|
114
|
+
assertMcpTextField(input.query, "query");
|
|
115
|
+
assertMcpTextField(input.glob, "glob", MAX_MCP_SHORT_TEXT_BYTES);
|
|
116
|
+
return searchRepoWithMetadata(context.cwd, input.query, input.glob);
|
|
117
|
+
},
|
|
118
|
+
async repo_write_file_dry_run(input) {
|
|
119
|
+
assertMcpTextField(input.path, "path", MAX_MCP_SHORT_TEXT_BYTES);
|
|
120
|
+
assertMcpTextField(input.expected_head, "expected_head", MAX_MCP_SHORT_TEXT_BYTES);
|
|
121
|
+
return createRepoWriteDryRun(context.cwd, store, input);
|
|
122
|
+
},
|
|
123
|
+
async repo_write_file_apply(input) {
|
|
124
|
+
assertMcpTextField(input.receipt_id, "receipt_id", MAX_MCP_SHORT_TEXT_BYTES);
|
|
125
|
+
assertMcpTextField(input.expected_head, "expected_head", MAX_MCP_SHORT_TEXT_BYTES);
|
|
126
|
+
assertMcpTextField(input.preimage_sha256, "preimage_sha256", MAX_MCP_SHORT_TEXT_BYTES);
|
|
127
|
+
return applyRepoWriteDryRun(context.cwd, store, input);
|
|
128
|
+
},
|
|
129
|
+
async repo_stage_reviewed_paths(input) {
|
|
130
|
+
assertMcpStringList(input.receipt_ids, "receipt_ids", MAX_MCP_SHORT_TEXT_BYTES);
|
|
131
|
+
assertMcpTextField(input.expected_head, "expected_head", MAX_MCP_SHORT_TEXT_BYTES);
|
|
132
|
+
return stageReviewedPaths(context.cwd, store, input);
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
function normalizeResultArtifacts(files) {
|
|
137
|
+
return files?.map((file) => ({ ...file, role: "result" }));
|
|
138
|
+
}
|
|
139
|
+
function assertMcpTextField(value, label, maxBytes = MAX_MCP_BRIDGE_TEXT_BYTES) {
|
|
140
|
+
if (value === undefined)
|
|
141
|
+
return;
|
|
142
|
+
const bytes = Buffer.byteLength(value, "utf8");
|
|
143
|
+
if (bytes > maxBytes) {
|
|
144
|
+
throw new Error(`MCP ${label} is too large (${bytes} bytes > ${maxBytes} bytes)`);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
function assertMcpStringList(values, label, maxBytes = MAX_MCP_BRIDGE_TEXT_BYTES) {
|
|
148
|
+
if (values === undefined)
|
|
149
|
+
return;
|
|
150
|
+
if (values.length > MAX_MCP_LIST_ITEMS) {
|
|
151
|
+
throw new Error(`MCP ${label} has too many items (${values.length} > ${MAX_MCP_LIST_ITEMS})`);
|
|
152
|
+
}
|
|
153
|
+
for (const [index, value] of values.entries()) {
|
|
154
|
+
assertMcpTextField(value, `${label}[${index}]`, maxBytes);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
function assertMcpFiles(files) {
|
|
158
|
+
if (files === undefined)
|
|
159
|
+
return;
|
|
160
|
+
if (files.length > MAX_MCP_LIST_ITEMS) {
|
|
161
|
+
throw new Error(`MCP files has too many items (${files.length} > ${MAX_MCP_LIST_ITEMS})`);
|
|
162
|
+
}
|
|
163
|
+
for (const [index, file] of files.entries()) {
|
|
164
|
+
assertMcpTextField(file.path, `files[${index}].path`, MAX_MCP_SHORT_TEXT_BYTES);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
//# sourceMappingURL=mcp-tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-tools.js","sourceRoot":"","sources":["../src/mcp-tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,mCAAmC,EAA0B,MAAM,YAAY,CAAC;AACtG,OAAO,EAAE,YAAY,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC;AACjE,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAOlG,MAAM,CAAC,MAAM,yBAAyB,GAAG,mCAAmC,CAAC;AAC7E,MAAM,CAAC,MAAM,wBAAwB,GAAG,MAAM,CAAC;AAC/C,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GAAG,kBAAkB,EAAE,CAAC;QACvC,MAAM,IAAI,KAAK,CAAC,OAAO,KAAK,wBAAwB,MAAM,CAAC,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC;IAChG,CAAC;IACD,KAAK,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,EAAE,EAAE,CAAC;QAC9C,kBAAkB,CAAC,KAAK,EAAE,GAAG,KAAK,IAAI,KAAK,GAAG,EAAE,QAAQ,CAAC,CAAC;IAC5D,CAAC;AACH,CAAC;AAED,SAAS,cAAc,CAAC,KAAuC;IAC7D,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO;IAChC,IAAI,KAAK,CAAC,MAAM,GAAG,kBAAkB,EAAE,CAAC;QACtC,MAAM,IAAI,KAAK,CAAC,iCAAiC,KAAK,CAAC,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC;IAC5F,CAAC;IACD,KAAK,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,KAAK,CAAC,OAAO,EAAE,EAAE,CAAC;QAC5C,kBAAkB,CAAC,IAAI,CAAC,IAAI,EAAE,SAAS,KAAK,QAAQ,EAAE,wBAAwB,CAAC,CAAC;IAClF,CAAC;AACH,CAAC"}
|
package/dist/mcp.d.ts
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
+
import type { Readable, Writable } from "node:stream";
|
|
3
|
+
import type { Transport } from "@modelcontextprotocol/sdk/shared/transport.js";
|
|
4
|
+
import { type JSONRPCMessage } from "@modelcontextprotocol/sdk/types.js";
|
|
5
|
+
import { type SourceSchema } from "./schema.js";
|
|
6
|
+
import type { z as zod } from "zod";
|
|
7
|
+
type BridgeSource = zod.infer<typeof SourceSchema>;
|
|
8
|
+
export declare const DEFAULT_STDIO_MESSAGE_LIMIT_BYTES = 1048576;
|
|
9
|
+
export interface CreateMcpServerOptions {
|
|
10
|
+
source?: BridgeSource;
|
|
11
|
+
claimedBy?: string;
|
|
12
|
+
}
|
|
13
|
+
export declare function createServer(cwd?: string, options?: CreateMcpServerOptions): McpServer;
|
|
14
|
+
export declare function runMcpServer(cwd?: string): Promise<void>;
|
|
15
|
+
export declare class LimitedStdioServerTransport implements Transport {
|
|
16
|
+
private readonly stdin;
|
|
17
|
+
private readonly stdout;
|
|
18
|
+
onclose?: Transport["onclose"];
|
|
19
|
+
onerror?: Transport["onerror"];
|
|
20
|
+
onmessage?: Transport["onmessage"];
|
|
21
|
+
sessionId?: string;
|
|
22
|
+
setProtocolVersion?: Transport["setProtocolVersion"];
|
|
23
|
+
private buffer;
|
|
24
|
+
private started;
|
|
25
|
+
private closed;
|
|
26
|
+
private readonly maxMessageBytes;
|
|
27
|
+
constructor(stdin?: Readable, stdout?: Writable, options?: {
|
|
28
|
+
maxMessageBytes?: number;
|
|
29
|
+
});
|
|
30
|
+
start(): Promise<void>;
|
|
31
|
+
close(): Promise<void>;
|
|
32
|
+
send(message: JSONRPCMessage): Promise<void>;
|
|
33
|
+
private readonly onData;
|
|
34
|
+
private readonly onInputError;
|
|
35
|
+
private processBuffer;
|
|
36
|
+
}
|
|
37
|
+
export {};
|