gemini-helper-friend 2.0.0 → 2.0.2
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/config/templates/manual.mdx +499 -0
- package/dist/config/yaml/subagents.yaml +737 -33
- package/dist/index.js +83 -7
- package/dist/index.js.map +1 -1
- package/dist/tools/cleanup.d.ts +13 -0
- package/dist/tools/cleanup.d.ts.map +1 -0
- package/dist/tools/cleanup.js +55 -0
- package/dist/tools/cleanup.js.map +1 -0
- package/dist/tools/constants.d.ts +46 -0
- package/dist/tools/constants.d.ts.map +1 -0
- package/dist/tools/constants.js +73 -0
- package/dist/tools/constants.js.map +1 -0
- package/dist/tools/index.d.ts +3 -1
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +1 -0
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/subagent.tool.d.ts +6 -26
- package/dist/tools/subagent.tool.d.ts.map +1 -1
- package/dist/tools/subagent.tool.js +295 -110
- package/dist/tools/subagent.tool.js.map +1 -1
- package/dist/tools/task-store.d.ts +49 -0
- package/dist/tools/task-store.d.ts.map +1 -0
- package/dist/tools/task-store.js +191 -0
- package/dist/tools/task-store.js.map +1 -0
- package/package.json +3 -1
- package/src/config/templates/manual.mdx +499 -0
- package/src/config/yaml/subagents.yaml +737 -33
package/dist/index.js
CHANGED
|
@@ -5,9 +5,10 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
7
7
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
8
|
-
import { CallToolRequestSchema, ListToolsRequestSchema, ListResourcesRequestSchema, ReadResourceRequestSchema, } from "@modelcontextprotocol/sdk/types.js";
|
|
8
|
+
import { CallToolRequestSchema, ListToolsRequestSchema, ListResourcesRequestSchema, ReadResourceRequestSchema, SubscribeRequestSchema, UnsubscribeRequestSchema, } from "@modelcontextprotocol/sdk/types.js";
|
|
9
9
|
import { generateMcpTools, getMetadata } from "./config/index.js";
|
|
10
10
|
import { executeSubagent, executeSubagentAsync, getTaskStatusResponse, getCompletedTasksAsResources, getTaskResourceContent, } from "./tools/index.js";
|
|
11
|
+
import { KEEPALIVE_INTERVAL_MS, VALID_TASK_TYPES, MIN_PROMPT_LENGTH, isValidTaskType } from "./tools/constants.js";
|
|
11
12
|
const metadata = getMetadata();
|
|
12
13
|
const server = new Server({
|
|
13
14
|
name: metadata.name,
|
|
@@ -23,9 +24,12 @@ const server = new Server({
|
|
|
23
24
|
},
|
|
24
25
|
},
|
|
25
26
|
});
|
|
26
|
-
const KEEPALIVE_INTERVAL = 25000;
|
|
27
27
|
let isProcessing = false;
|
|
28
28
|
let latestOutput = "";
|
|
29
|
+
// ============================================================================
|
|
30
|
+
// SUBSCRIPTION TRACKING - Track which clients subscribed to which task URIs
|
|
31
|
+
// ============================================================================
|
|
32
|
+
const subscriptions = new Set();
|
|
29
33
|
async function sendProgressNotification(progressToken, progress, message) {
|
|
30
34
|
if (!progressToken)
|
|
31
35
|
return;
|
|
@@ -64,7 +68,7 @@ function startProgressUpdates(progressToken) {
|
|
|
64
68
|
else {
|
|
65
69
|
clearInterval(interval);
|
|
66
70
|
}
|
|
67
|
-
},
|
|
71
|
+
}, KEEPALIVE_INTERVAL_MS);
|
|
68
72
|
return { interval, progressToken };
|
|
69
73
|
}
|
|
70
74
|
function stopProgressUpdates(data, success) {
|
|
@@ -88,11 +92,22 @@ async function sendResourceListChangedNotification() {
|
|
|
88
92
|
}
|
|
89
93
|
}
|
|
90
94
|
async function sendTaskCompletionNotification(taskId) {
|
|
95
|
+
const uri = `task://${taskId}`;
|
|
91
96
|
try {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
97
|
+
// Smart notification: use resources/updated if subscribed, list_changed otherwise
|
|
98
|
+
if (subscriptions.has(uri)) {
|
|
99
|
+
// Client subscribed to this specific task - send targeted notification
|
|
100
|
+
await server.notification({
|
|
101
|
+
method: "notifications/resources/updated",
|
|
102
|
+
params: { uri },
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
// No subscription - send general list change notification
|
|
107
|
+
await server.notification({
|
|
108
|
+
method: "notifications/resources/list_changed",
|
|
109
|
+
});
|
|
110
|
+
}
|
|
96
111
|
}
|
|
97
112
|
catch {
|
|
98
113
|
// Ignore notification errors
|
|
@@ -106,6 +121,20 @@ server.setRequestHandler(ListResourcesRequestSchema, async (_request) => {
|
|
|
106
121
|
const completedTasks = getCompletedTasksAsResources();
|
|
107
122
|
return { resources: completedTasks };
|
|
108
123
|
});
|
|
124
|
+
// resources/subscribe - Track client subscriptions to specific task URIs
|
|
125
|
+
server.setRequestHandler(SubscribeRequestSchema, async (request) => {
|
|
126
|
+
const uri = request.params.uri;
|
|
127
|
+
subscriptions.add(uri);
|
|
128
|
+
console.error(`[MCP] Client subscribed to ${uri}`);
|
|
129
|
+
return {}; // Empty response indicates success
|
|
130
|
+
});
|
|
131
|
+
// resources/unsubscribe - Remove client subscriptions
|
|
132
|
+
server.setRequestHandler(UnsubscribeRequestSchema, async (request) => {
|
|
133
|
+
const uri = request.params.uri;
|
|
134
|
+
subscriptions.delete(uri);
|
|
135
|
+
console.error(`[MCP] Client unsubscribed from ${uri}`);
|
|
136
|
+
return {}; // Empty response indicates success
|
|
137
|
+
});
|
|
109
138
|
// resources/read - Read a specific task result
|
|
110
139
|
server.setRequestHandler(ReadResourceRequestSchema, async (request) => {
|
|
111
140
|
const uri = request.params.uri;
|
|
@@ -165,6 +194,53 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
165
194
|
throw new Error(`Unknown tool: ${toolName}`);
|
|
166
195
|
}
|
|
167
196
|
const args = (request.params.arguments || {});
|
|
197
|
+
// ========================================================================
|
|
198
|
+
// SERVER-SIDE VALIDATION - Reject invalid requests immediately
|
|
199
|
+
// ========================================================================
|
|
200
|
+
if (!args.task_type || !isValidTaskType(args.task_type)) {
|
|
201
|
+
return {
|
|
202
|
+
content: [{
|
|
203
|
+
type: "text",
|
|
204
|
+
text: `## ❌ Invalid task_type
|
|
205
|
+
|
|
206
|
+
**Provided:** \`${args.task_type || '(missing)'}\`
|
|
207
|
+
|
|
208
|
+
**Valid values:**
|
|
209
|
+
${VALID_TASK_TYPES.map(t => `- \`${t}\``).join('\n')}
|
|
210
|
+
|
|
211
|
+
Please provide exactly one of these task_type values.`,
|
|
212
|
+
}],
|
|
213
|
+
isError: true,
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
if (!args.prompt || typeof args.prompt !== 'string') {
|
|
217
|
+
return {
|
|
218
|
+
content: [{
|
|
219
|
+
type: "text",
|
|
220
|
+
text: `## ❌ Missing required parameter: prompt
|
|
221
|
+
|
|
222
|
+
The \`prompt\` parameter is required and must be a string.
|
|
223
|
+
|
|
224
|
+
**For ${args.task_type}, provide:**
|
|
225
|
+
${args.task_type === 'completion-inspector' ? '- Original task requirements\n- Acceptance criteria\n- Implementation summary\n- Files changed' : ''}${args.task_type === 'helper-friend' ? '- Ultimate goal and success criteria\n- Current situation\n- What you\'ve tried\n- Current blocker/question' : ''}${args.task_type === 'manual-tester' ? '- Frontend URL (MANDATORY!)\n- Feature description\n- Expected behaviors\n- Test data' : ''}`,
|
|
226
|
+
}],
|
|
227
|
+
isError: true,
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
if (args.prompt.length < MIN_PROMPT_LENGTH) {
|
|
231
|
+
return {
|
|
232
|
+
content: [{
|
|
233
|
+
type: "text",
|
|
234
|
+
text: `## ❌ Prompt too short
|
|
235
|
+
|
|
236
|
+
**Provided length:** ${args.prompt.length} characters
|
|
237
|
+
**Minimum required:** ${MIN_PROMPT_LENGTH} characters
|
|
238
|
+
|
|
239
|
+
Please provide a more detailed prompt describing your task. Short prompts lack context for effective execution.`,
|
|
240
|
+
}],
|
|
241
|
+
isError: true,
|
|
242
|
+
};
|
|
243
|
+
}
|
|
168
244
|
// Default async=true; explicit false for sync/blocking mode
|
|
169
245
|
const isAsync = args.async !== false;
|
|
170
246
|
// ========================================================================
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EACL,qBAAqB,EACrB,sBAAsB,EACtB,0BAA0B,EAC1B,yBAAyB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EACL,qBAAqB,EACrB,sBAAsB,EACtB,0BAA0B,EAC1B,yBAAyB,EACzB,sBAAsB,EACtB,wBAAwB,GAUzB,MAAM,oCAAoC,CAAC;AAE5C,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAClE,OAAO,EACL,eAAe,EACf,oBAAoB,EACpB,qBAAqB,EACrB,4BAA4B,EAC5B,sBAAsB,GAEvB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEnH,MAAM,QAAQ,GAAG,WAAW,EAAE,CAAC;AAE/B,MAAM,MAAM,GAAG,IAAI,MAAM,CACvB;IACE,IAAI,EAAE,QAAQ,CAAC,IAAI;IACnB,OAAO,EAAE,OAAO;CACjB,EACD;IACE,YAAY,EAAE;QACZ,KAAK,EAAE;YACL,WAAW,EAAE,IAAI,EAAG,yCAAyC;SAC9D;QACD,SAAS,EAAE;YACT,SAAS,EAAE,IAAI,EAAK,iCAA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AS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAChC,OAAO,CAAC,KAAK,CAAC,IAAI,QAAQ,CAAC,WAAW,kBAAkB,CAAC,CAAC;AAC5D,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACrB,OAAO,CAAC,KAAK,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC;IACrC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cleanup utilities for orphaned temp files and processes
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Clean up orphaned temp files from crashed monitors or tasks
|
|
6
|
+
* Should be called on server startup
|
|
7
|
+
*/
|
|
8
|
+
export declare function cleanupOrphanedTempFiles(): number;
|
|
9
|
+
/**
|
|
10
|
+
* Validate PID is a positive integer
|
|
11
|
+
*/
|
|
12
|
+
export declare function isValidPid(pid: number | undefined): pid is number;
|
|
13
|
+
//# sourceMappingURL=cleanup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cleanup.d.ts","sourceRoot":"","sources":["../../src/tools/cleanup.ts"],"names":[],"mappings":"AAAA;;GAEG;AAOH;;;GAGG;AACH,wBAAgB,wBAAwB,IAAI,MAAM,CAsCjD;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,GAAG,IAAI,MAAM,CAEjE"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cleanup utilities for orphaned temp files and processes
|
|
3
|
+
*/
|
|
4
|
+
import { readdirSync, unlinkSync } from 'fs';
|
|
5
|
+
import { tmpdir } from 'os';
|
|
6
|
+
import { join } from 'path';
|
|
7
|
+
import { STDOUT_FILE_PREFIX, MONITOR_FILE_PREFIX } from './constants.js';
|
|
8
|
+
/**
|
|
9
|
+
* Clean up orphaned temp files from crashed monitors or tasks
|
|
10
|
+
* Should be called on server startup
|
|
11
|
+
*/
|
|
12
|
+
export function cleanupOrphanedTempFiles() {
|
|
13
|
+
let cleaned = 0;
|
|
14
|
+
try {
|
|
15
|
+
const tempDir = tmpdir();
|
|
16
|
+
const files = readdirSync(tempDir);
|
|
17
|
+
for (const file of files) {
|
|
18
|
+
// Clean up task output files
|
|
19
|
+
if (file.startsWith(STDOUT_FILE_PREFIX) &&
|
|
20
|
+
(file.endsWith('-stdout.txt') || file.endsWith('-stderr.txt'))) {
|
|
21
|
+
try {
|
|
22
|
+
unlinkSync(join(tempDir, file));
|
|
23
|
+
cleaned++;
|
|
24
|
+
}
|
|
25
|
+
catch (e) {
|
|
26
|
+
// File may be in use or already deleted
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
// Clean up monitor scripts
|
|
30
|
+
if (file.startsWith(MONITOR_FILE_PREFIX) && file.endsWith('.js')) {
|
|
31
|
+
try {
|
|
32
|
+
unlinkSync(join(tempDir, file));
|
|
33
|
+
cleaned++;
|
|
34
|
+
}
|
|
35
|
+
catch (e) {
|
|
36
|
+
// File may be in use or already deleted
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
if (cleaned > 0) {
|
|
41
|
+
console.error(`[Cleanup] Removed ${cleaned} orphaned temp files`);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
catch (error) {
|
|
45
|
+
console.error('[Cleanup] Error during temp file cleanup:', error);
|
|
46
|
+
}
|
|
47
|
+
return cleaned;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Validate PID is a positive integer
|
|
51
|
+
*/
|
|
52
|
+
export function isValidPid(pid) {
|
|
53
|
+
return typeof pid === 'number' && pid > 0 && Number.isInteger(pid);
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=cle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AAE,CAAC;oBACX,wCAAwC;gBAC1C,CAAC;YACH,CAAC;QACH,CAAC;QAED,IAAI,OAAO,GAAG,CAAC,EAAE,CAAC;YAChB,OAAO,CAAC,KAAK,CAAC,qBAAqB,OAAO,sBAAsB,CAAC,CAAC;QACpE,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,2CAA2C,EAAE,KAAK,CAAC,CAAC;IACpE,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,UAAU,CAAC,GAAuB;IAChD,OAAO,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,GAAG,CAAC,IAAI,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;AACrE,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared constants for the Gemini MCP Tool
|
|
3
|
+
* Centralizes magic numbers, timing values, and configuration defaults
|
|
4
|
+
*/
|
|
5
|
+
/** Minimum task ID (5-digit IDs start here) */
|
|
6
|
+
export declare const TASK_ID_MIN = 10000;
|
|
7
|
+
/** Maximum task ID before wrapping around */
|
|
8
|
+
export declare const TASK_ID_MAX = 99999;
|
|
9
|
+
/** How often to send keepalive/progress notifications (25 seconds) */
|
|
10
|
+
export declare const KEEPALIVE_INTERVAL_MS = 25000;
|
|
11
|
+
/** How often the monitor polls for process completion (3 seconds) */
|
|
12
|
+
export declare const MONITOR_POLL_INTERVAL_MS = 3000;
|
|
13
|
+
/** Task expiry time - tasks older than this are cleaned up (1 hour) */
|
|
14
|
+
export declare const TASK_EXPIRY_MS: number;
|
|
15
|
+
/** Maximum time to wait for a task before timeout (30 minutes) */
|
|
16
|
+
export declare const TASK_TIMEOUT_MS: number;
|
|
17
|
+
/** Interval for periodic cleanup of expired tasks (10 minutes) */
|
|
18
|
+
export declare const CLEANUP_INTERVAL_MS: number;
|
|
19
|
+
/** Valid task type values - single source of truth */
|
|
20
|
+
export declare const VALID_TASK_TYPES: readonly ["completion-inspector", "helper-friend", "manual-tester", "manual"];
|
|
21
|
+
/** Type derived from the valid task types array */
|
|
22
|
+
export type TaskType = typeof VALID_TASK_TYPES[number];
|
|
23
|
+
/** Check if a string is a valid task type */
|
|
24
|
+
export declare function isValidTaskType(value: unknown): value is TaskType;
|
|
25
|
+
/**
|
|
26
|
+
* Model fallback chain - tries in order until one succeeds
|
|
27
|
+
* gemini-2.5-flash is proven fast and reliable
|
|
28
|
+
*/
|
|
29
|
+
export declare const MODEL_FALLBACK_CHAIN: readonly ["gemini-2.5-flash", "gemini-2.5-pro", "gemini-2.0-flash"];
|
|
30
|
+
/** Prefix for stdout temp files */
|
|
31
|
+
export declare const STDOUT_FILE_PREFIX = "mcp-task-";
|
|
32
|
+
/** Prefix for monitor script temp files */
|
|
33
|
+
export declare const MONITOR_FILE_PREFIX = "mcp-monitor-";
|
|
34
|
+
/** Database directory name (relative to project root) */
|
|
35
|
+
export declare const DATA_DIR_NAME = ".mcp-data";
|
|
36
|
+
/** Database file name */
|
|
37
|
+
export declare const DB_FILE_NAME = "tasks.db";
|
|
38
|
+
/** Minimum prompt length to accept */
|
|
39
|
+
export declare const MIN_PROMPT_LENGTH = 20;
|
|
40
|
+
/** Maximum result length to store in database (prevent bloat) */
|
|
41
|
+
export declare const MAX_RESULT_LENGTH = 100000;
|
|
42
|
+
/** Maximum error message length to store */
|
|
43
|
+
export declare const MAX_ERROR_LENGTH = 500;
|
|
44
|
+
/** Maximum length for truncated error details in formatted errors */
|
|
45
|
+
export declare const MAX_ERROR_DETAIL_LENGTH = 500;
|
|
46
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/tools/constants.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,+CAA+C;AAC/C,eAAO,MAAM,WAAW,QAAQ,CAAC;AAEjC,6CAA6C;AAC7C,eAAO,MAAM,WAAW,QAAQ,CAAC;AAMjC,sEAAsE;AACtE,eAAO,MAAM,qBAAqB,QAAQ,CAAC;AAE3C,qEAAqE;AACrE,eAAO,MAAM,wBAAwB,OAAO,CAAC;AAE7C,uEAAuE;AACvE,eAAO,MAAM,cAAc,QAAiB,CAAC;AAE7C,kEAAkE;AAClE,eAAO,MAAM,eAAe,QAAiB,CAAC;AAE9C,kEAAkE;AAClE,eAAO,MAAM,mBAAmB,QAAiB,CAAC;AAMlD,sDAAsD;AACtD,eAAO,MAAM,gBAAgB,+EAKnB,CAAC;AAEX,mDAAmD;AACnD,MAAM,MAAM,QAAQ,GAAG,OAAO,gBAAgB,CAAC,MAAM,CAAC,CAAC;AAEvD,6CAA6C;AAC7C,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,QAAQ,CAEjE;AAMD;;;GAGG;AACH,eAAO,MAAM,oBAAoB,qEAIvB,CAAC;AAMX,mCAAmC;AACnC,eAAO,MAAM,kBAAkB,cAAc,CAAC;AAE9C,2CAA2C;AAC3C,eAAO,MAAM,mBAAmB,iBAAiB,CAAC;AAElD,yDAAyD;AACzD,eAAO,MAAM,aAAa,cAAc,CAAC;AAEzC,yBAAyB;AACzB,eAAO,MAAM,YAAY,aAAa,CAAC;AAMvC,sCAAsC;AACtC,eAAO,MAAM,iBAAiB,KAAK,CAAC;AAEpC,iEAAiE;AACjE,eAAO,MAAM,iBAAiB,SAAS,CAAC;AAExC,4CAA4C;AAC5C,eAAO,MAAM,gBAAgB,MAAM,CAAC;AAEpC,qEAAqE;AACrE,eAAO,MAAM,uBAAuB,MAAM,CAAC"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared constants for the Gemini MCP Tool
|
|
3
|
+
* Centralizes magic numbers, timing values, and configuration defaults
|
|
4
|
+
*/
|
|
5
|
+
// =============================================================================
|
|
6
|
+
// TASK ID CONFIGURATION
|
|
7
|
+
// =============================================================================
|
|
8
|
+
/** Minimum task ID (5-digit IDs start here) */
|
|
9
|
+
export const TASK_ID_MIN = 10000;
|
|
10
|
+
/** Maximum task ID before wrapping around */
|
|
11
|
+
export const TASK_ID_MAX = 99999;
|
|
12
|
+
// =============================================================================
|
|
13
|
+
// TIMING CONSTANTS (in milliseconds)
|
|
14
|
+
// =============================================================================
|
|
15
|
+
/** How often to send keepalive/progress notifications (25 seconds) */
|
|
16
|
+
export const KEEPALIVE_INTERVAL_MS = 25000;
|
|
17
|
+
/** How often the monitor polls for process completion (3 seconds) */
|
|
18
|
+
export const MONITOR_POLL_INTERVAL_MS = 3000;
|
|
19
|
+
/** Task expiry time - tasks older than this are cleaned up (1 hour) */
|
|
20
|
+
export const TASK_EXPIRY_MS = 60 * 60 * 1000;
|
|
21
|
+
/** Maximum time to wait for a task before timeout (30 minutes) */
|
|
22
|
+
export const TASK_TIMEOUT_MS = 30 * 60 * 1000;
|
|
23
|
+
/** Interval for periodic cleanup of expired tasks (10 minutes) */
|
|
24
|
+
export const CLEANUP_INTERVAL_MS = 10 * 60 * 1000;
|
|
25
|
+
// =============================================================================
|
|
26
|
+
// TASK TYPES
|
|
27
|
+
// =============================================================================
|
|
28
|
+
/** Valid task type values - single source of truth */
|
|
29
|
+
export const VALID_TASK_TYPES = [
|
|
30
|
+
'completion-inspector',
|
|
31
|
+
'helper-friend',
|
|
32
|
+
'manual-tester',
|
|
33
|
+
'manual',
|
|
34
|
+
];
|
|
35
|
+
/** Check if a string is a valid task type */
|
|
36
|
+
export function isValidTaskType(value) {
|
|
37
|
+
return typeof value === 'string' && VALID_TASK_TYPES.includes(value);
|
|
38
|
+
}
|
|
39
|
+
// =============================================================================
|
|
40
|
+
// MODEL CONFIGURATION
|
|
41
|
+
// =============================================================================
|
|
42
|
+
/**
|
|
43
|
+
* Model fallback chain - tries in order until one succeeds
|
|
44
|
+
* gemini-2.5-flash is proven fast and reliable
|
|
45
|
+
*/
|
|
46
|
+
export const MODEL_FALLBACK_CHAIN = [
|
|
47
|
+
'gemini-2.5-flash', // Primary: fast, reliable, tested
|
|
48
|
+
'gemini-2.5-pro', // Fallback: more capable
|
|
49
|
+
'gemini-2.0-flash', // Fallback: older but stable
|
|
50
|
+
];
|
|
51
|
+
// =============================================================================
|
|
52
|
+
// FILE PATTERNS
|
|
53
|
+
// =============================================================================
|
|
54
|
+
/** Prefix for stdout temp files */
|
|
55
|
+
export const STDOUT_FILE_PREFIX = 'mcp-task-';
|
|
56
|
+
/** Prefix for monitor script temp files */
|
|
57
|
+
export const MONITOR_FILE_PREFIX = 'mcp-monitor-';
|
|
58
|
+
/** Database directory name (relative to project root) */
|
|
59
|
+
export const DATA_DIR_NAME = '.mcp-data';
|
|
60
|
+
/** Database file name */
|
|
61
|
+
export const DB_FILE_NAME = 'tasks.db';
|
|
62
|
+
// =============================================================================
|
|
63
|
+
// VALIDATION LIMITS
|
|
64
|
+
// =============================================================================
|
|
65
|
+
/** Minimum prompt length to accept */
|
|
66
|
+
export const MIN_PROMPT_LENGTH = 20;
|
|
67
|
+
/** Maximum result length to store in database (prevent bloat) */
|
|
68
|
+
export const MAX_RESULT_LENGTH = 100000;
|
|
69
|
+
/** Maximum error message length to store */
|
|
70
|
+
export const MAX_ERROR_LENGTH = 500;
|
|
71
|
+
/** Maximum length for truncated error details in formatted errors */
|
|
72
|
+
export const MAX_ERROR_DETAIL_LENGTH = 500;
|
|
73
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/tools/constants.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,gFAAgF;AAChF,wBAAwB;AACxB,gFAAgF;AAEhF,+CAA+C;AAC/C,MAAM,CAAC,MAAM,WAAW,GAAG,KAAK,CAAC;AAEjC,6CAA6C;AAC7C,MAAM,CAAC,MAAM,WAAW,GAAG,KAAK,CAAC;AAEjC,gFAAgF;AAChF,qCAAqC;AACrC,gFAAgF;A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AoB;AACpB,gFAAgF;AAEhF,sCAAsC;AACtC,MAAM,CAAC,MAAM,iBAAiB,GAAG,EAAE,CAAC;AAEpC,iEAAiE;AACjE,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC;AAExC,4CAA4C;AAC5C,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAG,CAAC;AAEpC,qEAAqE;AACrE,MAAM,CAAC,MAAM,uBAAuB,GAAG,GAAG,CAAC"}
|
package/dist/tools/index.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Tools module - exports subagent tools and task management
|
|
3
3
|
*/
|
|
4
|
-
export { executeSubagent, executeSubagentAsync, getTaskStatusResponse, getCompletedTasksAsResources, getTaskResourceContent, type SubagentArgs,
|
|
4
|
+
export { executeSubagent, executeSubagentAsync, getTaskStatusResponse, getCompletedTasksAsResources, getTaskResourceContent, type SubagentArgs, } from './subagent.tool.js';
|
|
5
|
+
export { cleanupOrphanedTempFiles, isValidPid } from './cleanup.js';
|
|
6
|
+
export { type TaskState, type TaskStatus } from './subagent.tool.js';
|
|
5
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACL,eAAe,EACf,oBAAoB,EACpB,qBAAqB,EACrB,4BAA4B,EAC5B,sBAAsB,EACtB,KAAK,YAAY,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACL,eAAe,EACf,oBAAoB,EACpB,qBAAqB,EACrB,4BAA4B,EAC5B,sBAAsB,EACtB,KAAK,YAAY,GAClB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,wBAAwB,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAEpE,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC"}
|
package/dist/tools/index.js
CHANGED
|
@@ -2,4 +2,5 @@
|
|
|
2
2
|
* Tools module - exports subagent tools and task management
|
|
3
3
|
*/
|
|
4
4
|
export { executeSubagent, executeSubagentAsync, getTaskStatusResponse, getCompletedTasksAsResources, getTaskResourceContent, } from './subagent.tool.js';
|
|
5
|
+
export { cleanupOrphanedTempFiles, isValidPid } from './cleanup.js';
|
|
5
6
|
//# sourceMappingURL=index.js.map
|
package/dist/tools/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACL,eAAe,EACf,oBAAoB,EACpB,qBAAqB,EACrB,4BAA4B,EAC5B,sBAAsB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACL,eAAe,EACf,oBAAoB,EACpB,qBAAqB,EACrB,4BAA4B,EAC5B,sBAAsB,GAEvB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,wBAAwB,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -2,8 +2,10 @@
|
|
|
2
2
|
* Gemini Subagent Tool - Single consolidated tool with task type enum
|
|
3
3
|
* Loads task-specific instructions from YAML and merges with user prompt
|
|
4
4
|
*/
|
|
5
|
+
import { type TaskState, type TaskStatus } from './task-store.js';
|
|
6
|
+
import { type TaskType } from './constants.js';
|
|
5
7
|
export interface SubagentArgs {
|
|
6
|
-
task_type:
|
|
8
|
+
task_type: TaskType;
|
|
7
9
|
prompt: string;
|
|
8
10
|
model?: string;
|
|
9
11
|
sandbox?: boolean;
|
|
@@ -12,30 +14,7 @@ export interface SubagentArgs {
|
|
|
12
14
|
include_instructions?: boolean;
|
|
13
15
|
async?: boolean;
|
|
14
16
|
}
|
|
15
|
-
export type
|
|
16
|
-
export interface TaskState {
|
|
17
|
-
id: number;
|
|
18
|
-
status: TaskStatus;
|
|
19
|
-
task_type: string;
|
|
20
|
-
progress: number;
|
|
21
|
-
result?: string;
|
|
22
|
-
error?: string;
|
|
23
|
-
started_at: string;
|
|
24
|
-
completed_at?: string;
|
|
25
|
-
updated_at: string;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Create a new task in pending state
|
|
29
|
-
*/
|
|
30
|
-
export declare function createTask(taskType: string): TaskState;
|
|
31
|
-
/**
|
|
32
|
-
* Update task status
|
|
33
|
-
*/
|
|
34
|
-
export declare function updateTask(id: number, updates: Partial<TaskState>): TaskState | null;
|
|
35
|
-
/**
|
|
36
|
-
* Get task by ID
|
|
37
|
-
*/
|
|
38
|
-
export declare function getTask(id: number): TaskState | null;
|
|
17
|
+
export type { TaskState, TaskStatus };
|
|
39
18
|
/**
|
|
40
19
|
* Get task status response for check_subagent_task tool
|
|
41
20
|
*/
|
|
@@ -66,10 +45,11 @@ export declare function executeSubagentAsync(args: SubagentArgs, onTaskProgress?
|
|
|
66
45
|
task_id: number;
|
|
67
46
|
status: string;
|
|
68
47
|
message: string;
|
|
48
|
+
pid?: number;
|
|
69
49
|
};
|
|
70
50
|
/**
|
|
71
51
|
* Execute Gemini CLI with subagent task (blocking mode)
|
|
72
52
|
* Uses model fallback chain: tries models in sequence until one succeeds
|
|
73
53
|
*/
|
|
74
|
-
export declare function executeSubagent(args: SubagentArgs, onProgress?: (output: string) => void): Promise<string>;
|
|
54
|
+
export declare function executeSubagent(args: SubagentArgs, onProgress?: (output: string) => void, onProcessSpawn?: (pid: number) => void): Promise<string>;
|
|
75
55
|
//# sourceMappingURL=subagent.tool.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subagent.tool.d.ts","sourceRoot":"","sources":["../../src/tools/subagent.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
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