super-subagents 1.3.12 → 1.3.13
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/package.json +1 -1
- package/build/services/session-handoff.d.ts +0 -44
- package/build/services/session-handoff.d.ts.map +0 -1
- package/build/services/session-handoff.js +0 -212
- package/build/services/session-handoff.js.map +0 -1
- package/build/tools/batch-spawn.d.ts +0 -70
- package/build/tools/batch-spawn.d.ts.map +0 -1
- package/build/tools/batch-spawn.js +0 -155
- package/build/tools/batch-spawn.js.map +0 -1
- package/build/tools/clear-tasks.d.ts +0 -21
- package/build/tools/clear-tasks.d.ts.map +0 -1
- package/build/tools/clear-tasks.js +0 -43
- package/build/tools/clear-tasks.js.map +0 -1
- package/build/tools/get-status.d.ts +0 -31
- package/build/tools/get-status.d.ts.map +0 -1
- package/build/tools/get-status.js +0 -513
- package/build/tools/get-status.js.map +0 -1
- package/build/tools/get-task-session-detail.d.ts +0 -33
- package/build/tools/get-task-session-detail.d.ts.map +0 -1
- package/build/tools/get-task-session-detail.js +0 -222
- package/build/tools/get-task-session-detail.js.map +0 -1
- package/build/tools/handoff-task.d.ts +0 -39
- package/build/tools/handoff-task.d.ts.map +0 -1
- package/build/tools/handoff-task.js +0 -110
- package/build/tools/handoff-task.js.map +0 -1
- package/build/tools/list-tasks.d.ts +0 -26
- package/build/tools/list-tasks.d.ts.map +0 -1
- package/build/tools/list-tasks.js +0 -99
- package/build/tools/list-tasks.js.map +0 -1
- package/build/tools/stream-output.d.ts +0 -29
- package/build/tools/stream-output.d.ts.map +0 -1
- package/build/tools/stream-output.js +0 -96
- package/build/tools/stream-output.js.map +0 -1
- package/playwright-cli/.claude-plugin/marketplace.json +0 -13
- package/playwright-cli/.claude-plugin/plugin.json +0 -8
- package/playwright-cli/.github/workflows/roll-cli-readme.yml +0 -100
- package/playwright-cli/CONTRIBUTING.md +0 -45
- package/playwright-cli/LICENSE +0 -201
- package/playwright-cli/README.md +0 -474
- package/playwright-cli/SECURITY.md +0 -14
- package/playwright-cli/package-lock.json +0 -87
- package/playwright-cli/package.json +0 -5
- package/playwright-cli/scripts/update.js +0 -61
- package/playwright-cli/skills/playwright-cli/SKILL.md +0 -240
- package/playwright-cli/skills/playwright-cli/references/request-mocking.md +0 -87
- package/playwright-cli/skills/playwright-cli/references/running-code.md +0 -232
- package/playwright-cli/skills/playwright-cli/references/session-management.md +0 -163
- package/playwright-cli/skills/playwright-cli/references/storage-state.md +0 -275
- package/playwright-cli/skills/playwright-cli/references/test-generation.md +0 -88
- package/playwright-cli/skills/playwright-cli/references/tracing.md +0 -139
- package/playwright-cli/skills/playwright-cli/references/video-recording.md +0 -43
package/package.json
CHANGED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Session Handoff Service - Enables cross-account continuation of sessions.
|
|
3
|
-
*
|
|
4
|
-
* Uses SDK's session.getMessages() to export session history and create
|
|
5
|
-
* a summarized handoff to continue on a different account when quota is exhausted.
|
|
6
|
-
*
|
|
7
|
-
* Based on SDK recommendation:
|
|
8
|
-
* > "Continue with another account" is usually a handoff, not a resume
|
|
9
|
-
*/
|
|
10
|
-
import type { TaskState } from '../types.js';
|
|
11
|
-
interface HandoffResult {
|
|
12
|
-
success: boolean;
|
|
13
|
-
newTaskId?: string;
|
|
14
|
-
newSessionId?: string;
|
|
15
|
-
error?: string;
|
|
16
|
-
historyTurns?: number;
|
|
17
|
-
targetAccountIndex?: number;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Perform a session handoff to a different account.
|
|
21
|
-
*
|
|
22
|
-
* This exports the session history, rotates to a new account,
|
|
23
|
-
* creates a new session with the summarized context, and continues.
|
|
24
|
-
*/
|
|
25
|
-
export declare function performHandoff(taskId: string, options?: {
|
|
26
|
-
targetAccountIndex?: number;
|
|
27
|
-
includeHistoryTurns?: number;
|
|
28
|
-
additionalPrompt?: string;
|
|
29
|
-
}): Promise<HandoffResult>;
|
|
30
|
-
/**
|
|
31
|
-
* Check if a handoff is recommended for a task.
|
|
32
|
-
* Returns true if the task is rate-limited or has low quota.
|
|
33
|
-
*/
|
|
34
|
-
export declare function isHandoffRecommended(task: TaskState): boolean;
|
|
35
|
-
/**
|
|
36
|
-
* Get handoff recommendation details for a task.
|
|
37
|
-
*/
|
|
38
|
-
export declare function getHandoffRecommendation(task: TaskState): {
|
|
39
|
-
recommended: boolean;
|
|
40
|
-
reason?: string;
|
|
41
|
-
availableAccounts: number;
|
|
42
|
-
};
|
|
43
|
-
export {};
|
|
44
|
-
//# sourceMappingURL=session-handoff.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"session-handoff.d.ts","sourceRoot":"","sources":["../../src/services/session-handoff.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAOH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAI7C,UAAU,aAAa;IACrB,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAqFD;;;;;GAKG;AACH,wBAAsB,cAAc,CAClC,MAAM,EAAE,MAAM,EACd,OAAO,GAAE;IACP,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,gBAAgB,CAAC,EAAE,MAAM,CAAC;CACtB,GACL,OAAO,CAAC,aAAa,CAAC,CA0FxB;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,SAAS,GAAG,OAAO,CAmB7D;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,SAAS,GAAG;IACzD,WAAW,EAAE,OAAO,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,iBAAiB,EAAE,MAAM,CAAC;CAC3B,CAoBA"}
|
|
@@ -1,212 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Session Handoff Service - Enables cross-account continuation of sessions.
|
|
3
|
-
*
|
|
4
|
-
* Uses SDK's session.getMessages() to export session history and create
|
|
5
|
-
* a summarized handoff to continue on a different account when quota is exhausted.
|
|
6
|
-
*
|
|
7
|
-
* Based on SDK recommendation:
|
|
8
|
-
* > "Continue with another account" is usually a handoff, not a resume
|
|
9
|
-
*/
|
|
10
|
-
import { sdkClientManager } from './sdk-client-manager.js';
|
|
11
|
-
import { accountManager } from './account-manager.js';
|
|
12
|
-
import { taskManager } from './task-manager.js';
|
|
13
|
-
import { spawnCopilotTask } from './sdk-spawner.js';
|
|
14
|
-
const DEFAULT_HISTORY_TURNS = 10;
|
|
15
|
-
/**
|
|
16
|
-
* Extract messages from session events for handoff summary.
|
|
17
|
-
*/
|
|
18
|
-
function extractMessages(events) {
|
|
19
|
-
const messages = [];
|
|
20
|
-
for (const event of events) {
|
|
21
|
-
if (event.type === 'user.message') {
|
|
22
|
-
messages.push({
|
|
23
|
-
role: 'user',
|
|
24
|
-
content: event.data.content,
|
|
25
|
-
timestamp: event.timestamp,
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
else if (event.type === 'assistant.message') {
|
|
29
|
-
messages.push({
|
|
30
|
-
role: 'assistant',
|
|
31
|
-
content: event.data.content,
|
|
32
|
-
timestamp: event.timestamp,
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
return messages;
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Build a handoff summary from message history.
|
|
40
|
-
* Keeps the last N turns and summarizes the context.
|
|
41
|
-
*/
|
|
42
|
-
function buildHandoffSummary(messages, maxTurns, originalPrompt) {
|
|
43
|
-
// Get the last N messages (user + assistant pairs count as 1 turn)
|
|
44
|
-
const recentMessages = messages.slice(-maxTurns * 2);
|
|
45
|
-
const lines = [
|
|
46
|
-
'## Session Continuation Context',
|
|
47
|
-
'',
|
|
48
|
-
'This is a continuation of a previous session. Here is the relevant context:',
|
|
49
|
-
'',
|
|
50
|
-
];
|
|
51
|
-
// Include original prompt if available
|
|
52
|
-
if (originalPrompt) {
|
|
53
|
-
lines.push('### Original Task');
|
|
54
|
-
lines.push('```');
|
|
55
|
-
lines.push(originalPrompt.slice(0, 500) + (originalPrompt.length > 500 ? '...' : ''));
|
|
56
|
-
lines.push('```');
|
|
57
|
-
lines.push('');
|
|
58
|
-
}
|
|
59
|
-
// Include recent conversation
|
|
60
|
-
if (recentMessages.length > 0) {
|
|
61
|
-
lines.push('### Recent Conversation');
|
|
62
|
-
lines.push('');
|
|
63
|
-
for (const msg of recentMessages) {
|
|
64
|
-
const role = msg.role === 'user' ? 'User' : 'Assistant';
|
|
65
|
-
// Truncate long messages
|
|
66
|
-
const content = msg.content.length > 300
|
|
67
|
-
? msg.content.slice(0, 300) + '...'
|
|
68
|
-
: msg.content;
|
|
69
|
-
lines.push(`**${role}:** ${content}`);
|
|
70
|
-
lines.push('');
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
lines.push('### Instructions');
|
|
74
|
-
lines.push('');
|
|
75
|
-
lines.push('Please continue from where the previous session left off. ');
|
|
76
|
-
lines.push('Complete the original task based on the context above.');
|
|
77
|
-
return lines.join('\n');
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* Perform a session handoff to a different account.
|
|
81
|
-
*
|
|
82
|
-
* This exports the session history, rotates to a new account,
|
|
83
|
-
* creates a new session with the summarized context, and continues.
|
|
84
|
-
*/
|
|
85
|
-
export async function performHandoff(taskId, options = {}) {
|
|
86
|
-
const task = taskManager.getTask(taskId);
|
|
87
|
-
if (!task) {
|
|
88
|
-
return { success: false, error: 'Task not found' };
|
|
89
|
-
}
|
|
90
|
-
const historyTurns = options.includeHistoryTurns ?? DEFAULT_HISTORY_TURNS;
|
|
91
|
-
try {
|
|
92
|
-
// Step 1: Export session history
|
|
93
|
-
let messages = [];
|
|
94
|
-
if (task.sessionId) {
|
|
95
|
-
try {
|
|
96
|
-
const session = await sdkClientManager.resumeSession(task.cwd || process.cwd(), task.sessionId);
|
|
97
|
-
const events = await session.getMessages();
|
|
98
|
-
messages = extractMessages(events);
|
|
99
|
-
// Destroy the old session after extracting history
|
|
100
|
-
await session.destroy();
|
|
101
|
-
}
|
|
102
|
-
catch (err) {
|
|
103
|
-
console.error(`[session-handoff] Failed to export session history:`, err);
|
|
104
|
-
// Continue without history - we can still handoff with the original prompt
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
// Step 2: Rotate to new account
|
|
108
|
-
let targetAccountIndex;
|
|
109
|
-
if (options.targetAccountIndex !== undefined) {
|
|
110
|
-
// Use specific account if requested
|
|
111
|
-
const tokenCount = accountManager.getTokenCount();
|
|
112
|
-
if (options.targetAccountIndex >= tokenCount) {
|
|
113
|
-
return {
|
|
114
|
-
success: false,
|
|
115
|
-
error: `Invalid account index ${options.targetAccountIndex}. Available: 0-${tokenCount - 1}`
|
|
116
|
-
};
|
|
117
|
-
}
|
|
118
|
-
// Force rotation to specific index
|
|
119
|
-
for (let i = 0; i < options.targetAccountIndex + 1; i++) {
|
|
120
|
-
accountManager.rotateToNext('handoff_target');
|
|
121
|
-
}
|
|
122
|
-
targetAccountIndex = options.targetAccountIndex;
|
|
123
|
-
}
|
|
124
|
-
else {
|
|
125
|
-
// Rotate to next available account
|
|
126
|
-
const rotationResult = accountManager.rotateToNext('handoff');
|
|
127
|
-
if (!rotationResult.success) {
|
|
128
|
-
return {
|
|
129
|
-
success: false,
|
|
130
|
-
error: rotationResult.allExhausted
|
|
131
|
-
? 'All accounts exhausted'
|
|
132
|
-
: rotationResult.error
|
|
133
|
-
};
|
|
134
|
-
}
|
|
135
|
-
targetAccountIndex = rotationResult.tokenIndex;
|
|
136
|
-
}
|
|
137
|
-
// Step 3: Build handoff prompt
|
|
138
|
-
const handoffSummary = buildHandoffSummary(messages, historyTurns, task.prompt);
|
|
139
|
-
const fullPrompt = options.additionalPrompt
|
|
140
|
-
? `${handoffSummary}\n\n## Additional Instructions\n\n${options.additionalPrompt}`
|
|
141
|
-
: handoffSummary;
|
|
142
|
-
// Step 4: Create new task with handoff context
|
|
143
|
-
const newTaskId = await spawnCopilotTask({
|
|
144
|
-
prompt: fullPrompt,
|
|
145
|
-
cwd: task.cwd,
|
|
146
|
-
model: task.model,
|
|
147
|
-
timeout: task.timeout,
|
|
148
|
-
autonomous: task.autonomous,
|
|
149
|
-
labels: [...(task.labels || []), 'handoff', `from:${taskId}`],
|
|
150
|
-
});
|
|
151
|
-
console.error(`[session-handoff] Handoff complete: ${taskId} -> ${newTaskId} (account #${targetAccountIndex + 1})`);
|
|
152
|
-
// Update original task with handoff info
|
|
153
|
-
taskManager.appendOutput(taskId, `[handoff] Session handed off to task ${newTaskId} on account #${targetAccountIndex + 1}`);
|
|
154
|
-
return {
|
|
155
|
-
success: true,
|
|
156
|
-
newTaskId,
|
|
157
|
-
historyTurns: messages.length > 0 ? Math.min(historyTurns, Math.ceil(messages.length / 2)) : 0,
|
|
158
|
-
targetAccountIndex,
|
|
159
|
-
};
|
|
160
|
-
}
|
|
161
|
-
catch (err) {
|
|
162
|
-
const error = err instanceof Error ? err.message : String(err);
|
|
163
|
-
console.error(`[session-handoff] Handoff failed:`, err);
|
|
164
|
-
return { success: false, error };
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
/**
|
|
168
|
-
* Check if a handoff is recommended for a task.
|
|
169
|
-
* Returns true if the task is rate-limited or has low quota.
|
|
170
|
-
*/
|
|
171
|
-
export function isHandoffRecommended(task) {
|
|
172
|
-
// Check if rate-limited with exhausted retries
|
|
173
|
-
if (task.status === 'rate_limited') {
|
|
174
|
-
if (task.retryInfo && task.retryInfo.retryCount >= task.retryInfo.maxRetries) {
|
|
175
|
-
return true;
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
// Check if quota is critically low
|
|
179
|
-
if (task.quotaInfo && task.quotaInfo.remainingPercentage < 1) {
|
|
180
|
-
return true;
|
|
181
|
-
}
|
|
182
|
-
// Check if failure context indicates quota exhaustion
|
|
183
|
-
if (task.failureContext?.statusCode === 429) {
|
|
184
|
-
return true;
|
|
185
|
-
}
|
|
186
|
-
return false;
|
|
187
|
-
}
|
|
188
|
-
/**
|
|
189
|
-
* Get handoff recommendation details for a task.
|
|
190
|
-
*/
|
|
191
|
-
export function getHandoffRecommendation(task) {
|
|
192
|
-
const availableAccounts = accountManager.getTokenCount() - 1; // Excluding current
|
|
193
|
-
const recommended = isHandoffRecommended(task);
|
|
194
|
-
let reason;
|
|
195
|
-
if (recommended) {
|
|
196
|
-
if (task.quotaInfo?.remainingPercentage !== undefined && task.quotaInfo.remainingPercentage < 1) {
|
|
197
|
-
reason = `Quota critically low (${task.quotaInfo.remainingPercentage}% remaining)`;
|
|
198
|
-
}
|
|
199
|
-
else if (task.failureContext?.statusCode === 429) {
|
|
200
|
-
reason = 'Rate limited (429)';
|
|
201
|
-
}
|
|
202
|
-
else if (task.retryInfo && task.retryInfo.retryCount >= task.retryInfo.maxRetries) {
|
|
203
|
-
reason = `Max retries exhausted (${task.retryInfo.retryCount}/${task.retryInfo.maxRetries})`;
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
return {
|
|
207
|
-
recommended,
|
|
208
|
-
reason,
|
|
209
|
-
availableAccounts: Math.max(0, availableAccounts),
|
|
210
|
-
};
|
|
211
|
-
}
|
|
212
|
-
//# sourceMappingURL=session-handoff.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"session-handoff.js","sourceRoot":"","sources":["../../src/services/session-handoff.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,m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ACtD,IAAI,IAAI,CAAC,cAAc,EAAE,UAAU,KAAK,GAAG,EAAE,CAAC;QAC5C,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,wBAAwB,CAAC,IAAe;IAKtD,MAAM,iBAAiB,GAAG,cAAc,CAAC,aAAa,EAAE,GAAG,CAAC,CAAC,CAAC,oBAAoB;IAClF,MAAM,WAAW,GAAG,oBAAoB,CAAC,IAAI,CAAC,CAAC;IAE/C,IAAI,MAA0B,CAAC;IAC/B,IAAI,WAAW,EAAE,CAAC;QAChB,IAAI,IAAI,CAAC,SAAS,EAAE,mBAAmB,KAAK,SAAS,IAAI,IAAI,CAAC,SAAS,CAAC,mBAAmB,GAAG,CAAC,EAAE,CAAC;YAChG,MAAM,GAAG,yBAAyB,IAAI,CAAC,SAAS,CAAC,mBAAmB,cAAc,CAAC;QACrF,CAAC;aAAM,IAAI,IAAI,CAAC,cAAc,EAAE,UAAU,KAAK,GAAG,EAAE,CAAC;YACnD,MAAM,GAAG,oBAAoB,CAAC;QAChC,CAAC;aAAM,IAAI,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,SAAS,CAAC,UAAU,IAAI,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,CAAC;YACpF,MAAM,GAAG,0BAA0B,IAAI,CAAC,SAAS,CAAC,UAAU,IAAI,IAAI,CAAC,SAAS,CAAC,UAAU,GAAG,CAAC;QAC/F,CAAC;IACH,CAAC;IAED,OAAO;QACL,WAAW;QACX,MAAM;QACN,iBAAiB,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,iBAAiB,CAAC;KAClD,CAAC;AACJ,CAAC"}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import type { ToolContext } from '../types.js';
|
|
2
|
-
export declare const batchSpawnTool: {
|
|
3
|
-
name: string;
|
|
4
|
-
description: string;
|
|
5
|
-
inputSchema: {
|
|
6
|
-
type: "object";
|
|
7
|
-
properties: {
|
|
8
|
-
tasks: {
|
|
9
|
-
type: string;
|
|
10
|
-
items: {
|
|
11
|
-
type: string;
|
|
12
|
-
properties: {
|
|
13
|
-
id: {
|
|
14
|
-
type: string;
|
|
15
|
-
description: string;
|
|
16
|
-
};
|
|
17
|
-
prompt: {
|
|
18
|
-
type: string;
|
|
19
|
-
description: string;
|
|
20
|
-
};
|
|
21
|
-
task_type: {
|
|
22
|
-
type: string;
|
|
23
|
-
enum: ("super-coder" | "super-planner" | "super-researcher" | "super-tester")[];
|
|
24
|
-
description: string;
|
|
25
|
-
};
|
|
26
|
-
model: {
|
|
27
|
-
type: string;
|
|
28
|
-
enum: ("claude-sonnet-4.5" | "claude-opus-4.5" | "claude-haiku-4.5")[];
|
|
29
|
-
description: string;
|
|
30
|
-
};
|
|
31
|
-
depends_on: {
|
|
32
|
-
type: string;
|
|
33
|
-
items: {
|
|
34
|
-
type: string;
|
|
35
|
-
};
|
|
36
|
-
description: string;
|
|
37
|
-
};
|
|
38
|
-
labels: {
|
|
39
|
-
type: string;
|
|
40
|
-
items: {
|
|
41
|
-
type: string;
|
|
42
|
-
};
|
|
43
|
-
description: string;
|
|
44
|
-
};
|
|
45
|
-
};
|
|
46
|
-
required: string[];
|
|
47
|
-
};
|
|
48
|
-
description: string;
|
|
49
|
-
minItems: number;
|
|
50
|
-
maxItems: number;
|
|
51
|
-
};
|
|
52
|
-
cwd: {
|
|
53
|
-
type: string;
|
|
54
|
-
description: string;
|
|
55
|
-
};
|
|
56
|
-
autonomous: {
|
|
57
|
-
type: string;
|
|
58
|
-
description: string;
|
|
59
|
-
};
|
|
60
|
-
};
|
|
61
|
-
required: string[];
|
|
62
|
-
};
|
|
63
|
-
};
|
|
64
|
-
export declare function handleBatchSpawn(args: unknown, ctx?: ToolContext): Promise<{
|
|
65
|
-
content: Array<{
|
|
66
|
-
type: string;
|
|
67
|
-
text: string;
|
|
68
|
-
}>;
|
|
69
|
-
}>;
|
|
70
|
-
//# sourceMappingURL=batch-spawn.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"batch-spawn.d.ts","sourceRoot":"","sources":["../../src/tools/batch-spawn.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAkB/C,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6C1B,CAAC;AASF,wBAAsB,gBAAgB,CAAC,IAAI,EAAE,OAAO,EAAE,GAAG,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC;IAAE,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAAE,CAAC,CA6GpI"}
|
|
@@ -1,155 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { spawnCopilotTask } from '../services/sdk-spawner.js';
|
|
3
|
-
import { taskManager } from '../services/task-manager.js';
|
|
4
|
-
import { MODEL_IDS } from '../models.js';
|
|
5
|
-
import { TASK_TYPE_IDS, applyTemplate, isValidTaskType } from '../templates/index.js';
|
|
6
|
-
import { progressRegistry } from '../services/progress-registry.js';
|
|
7
|
-
import { mcpText, formatError, formatTable, join } from '../utils/format.js';
|
|
8
|
-
const TaskDefinitionSchema = z.object({
|
|
9
|
-
id: z.string().min(1).describe('Local reference ID for this task (used in depends_on)'),
|
|
10
|
-
prompt: z.string().min(1).max(50000),
|
|
11
|
-
task_type: z.enum(TASK_TYPE_IDS).optional(),
|
|
12
|
-
model: z.enum(MODEL_IDS).optional(),
|
|
13
|
-
depends_on: z.array(z.string()).optional().describe('Array of local IDs from this batch'),
|
|
14
|
-
labels: z.array(z.string().min(1).max(50)).max(10).optional().describe('Optional labels for filtering'),
|
|
15
|
-
});
|
|
16
|
-
const BatchSpawnSchema = z.object({
|
|
17
|
-
tasks: z.array(TaskDefinitionSchema).min(1).max(20),
|
|
18
|
-
cwd: z.string().optional(),
|
|
19
|
-
autonomous: z.boolean().optional().default(true),
|
|
20
|
-
});
|
|
21
|
-
export const batchSpawnTool = {
|
|
22
|
-
name: 'batch_spawn',
|
|
23
|
-
description: `Create multiple tasks with dependency chains in ONE atomic call.
|
|
24
|
-
|
|
25
|
-
WHEN TO USE: Only when you have 2+ small, well-defined tasks that have explicit cross-dependencies and must be set up together (e.g. "build step" -> "test step" -> "deploy step"). This is for DAG-style pipelines where task B literally cannot start until task A completes.
|
|
26
|
-
|
|
27
|
-
WHEN NOT TO USE (prefer spawn_task instead):
|
|
28
|
-
- For independent tasks with no dependencies -- just call spawn_task multiple times
|
|
29
|
-
- For complex tasks that need detailed, unique prompts -- spawn_task lets you craft each prompt individually
|
|
30
|
-
- For most work -- individual spawn_task calls give you better control and produce better results
|
|
31
|
-
- When tasks are large or nuanced -- batch prompts tend to be rushed and vague
|
|
32
|
-
|
|
33
|
-
Each task in the batch still runs as an isolated agent with NO shared context. Every prompt must be fully self-contained with all file paths, context, and instructions -- just like spawn_task.`,
|
|
34
|
-
inputSchema: {
|
|
35
|
-
type: 'object',
|
|
36
|
-
properties: {
|
|
37
|
-
tasks: {
|
|
38
|
-
type: 'array',
|
|
39
|
-
items: {
|
|
40
|
-
type: 'object',
|
|
41
|
-
properties: {
|
|
42
|
-
id: { type: 'string', description: 'Local ID used to reference this task in depends_on of other tasks within this batch.' },
|
|
43
|
-
prompt: {
|
|
44
|
-
type: 'string',
|
|
45
|
-
description: `Complete, self-contained instructions for this agent. Same rules as spawn_task: the agent has NO conversation history or shared context. Include all file paths (absolute), full context, and success criteria. Do NOT write vague one-liners -- each task needs a detailed brief.`,
|
|
46
|
-
},
|
|
47
|
-
task_type: { type: 'string', enum: TASK_TYPE_IDS, description: 'Agent template: super-coder, super-planner, super-researcher, or super-tester.' },
|
|
48
|
-
model: { type: 'string', enum: MODEL_IDS, description: 'Model override for this specific task.' },
|
|
49
|
-
depends_on: { type: 'array', items: { type: 'string' }, description: 'Local IDs (from this batch) or existing task IDs that must complete first. Dependencies must appear earlier in the array.' },
|
|
50
|
-
labels: { type: 'array', items: { type: 'string' }, description: 'Labels for filtering (max 10).' },
|
|
51
|
-
},
|
|
52
|
-
required: ['id', 'prompt'],
|
|
53
|
-
},
|
|
54
|
-
description: 'Task definitions in dependency order (max 20). Tasks listed first can be depended on by tasks listed later.',
|
|
55
|
-
minItems: 1,
|
|
56
|
-
maxItems: 20,
|
|
57
|
-
},
|
|
58
|
-
cwd: {
|
|
59
|
-
type: 'string',
|
|
60
|
-
description: `Shared working directory for ALL tasks in this batch. Pass the absolute path to your current working directory. For git worktrees, pass the actual worktree path, not the main repo root.`,
|
|
61
|
-
},
|
|
62
|
-
autonomous: { type: 'boolean', description: 'Run without prompts. Default: true.' },
|
|
63
|
-
},
|
|
64
|
-
required: ['tasks'],
|
|
65
|
-
},
|
|
66
|
-
};
|
|
67
|
-
export async function handleBatchSpawn(args, ctx) {
|
|
68
|
-
try {
|
|
69
|
-
const parsed = BatchSpawnSchema.parse(args);
|
|
70
|
-
// Validate no duplicate local IDs
|
|
71
|
-
const localIds = parsed.tasks.map(t => t.id);
|
|
72
|
-
const duplicates = localIds.filter((id, i) => localIds.indexOf(id) !== i);
|
|
73
|
-
if (duplicates.length > 0) {
|
|
74
|
-
return mcpText(formatError(`Duplicate local IDs: ${[...new Set(duplicates)].join(', ')}`, 'Each task must have a unique local ID.'));
|
|
75
|
-
}
|
|
76
|
-
// Validate dependency references (must be earlier in array or existing task)
|
|
77
|
-
for (let i = 0; i < parsed.tasks.length; i++) {
|
|
78
|
-
const task = parsed.tasks[i];
|
|
79
|
-
if (task.depends_on) {
|
|
80
|
-
for (const depId of task.depends_on) {
|
|
81
|
-
const depIndex = localIds.indexOf(depId);
|
|
82
|
-
// Must be either an earlier task in batch OR an existing task
|
|
83
|
-
if (depIndex === -1) {
|
|
84
|
-
// Check if it's an existing task
|
|
85
|
-
const existingTask = taskManager.getTask(depId);
|
|
86
|
-
if (!existingTask) {
|
|
87
|
-
return mcpText(formatError(`Task '${task.id}' depends on unknown '${depId}'`, 'Dependencies must reference earlier tasks in batch or existing task IDs.'));
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
else if (depIndex >= i) {
|
|
91
|
-
return mcpText(formatError(`Task '${task.id}' depends on '${depId}' which comes later in the batch`, 'Reorder tasks so dependencies come before dependents.'));
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
// Create tasks in order, mapping local IDs to real task IDs
|
|
97
|
-
const idMap = new Map();
|
|
98
|
-
const createdTasks = [];
|
|
99
|
-
for (const taskDef of parsed.tasks) {
|
|
100
|
-
// Resolve depends_on from local IDs to real task IDs
|
|
101
|
-
let realDependsOn;
|
|
102
|
-
if (taskDef.depends_on && taskDef.depends_on.length > 0) {
|
|
103
|
-
realDependsOn = taskDef.depends_on.map(localId => {
|
|
104
|
-
// Check if it's a local ID we've created
|
|
105
|
-
const mappedId = idMap.get(localId);
|
|
106
|
-
if (mappedId)
|
|
107
|
-
return mappedId;
|
|
108
|
-
// Otherwise it must be an existing task ID
|
|
109
|
-
return localId;
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
// Apply template if specified
|
|
113
|
-
let finalPrompt = taskDef.prompt;
|
|
114
|
-
if (taskDef.task_type && isValidTaskType(taskDef.task_type)) {
|
|
115
|
-
finalPrompt = applyTemplate(taskDef.task_type, taskDef.prompt);
|
|
116
|
-
}
|
|
117
|
-
// Spawn the task
|
|
118
|
-
const labels = taskDef.labels?.filter(l => l.trim()) || [];
|
|
119
|
-
const taskId = await spawnCopilotTask({
|
|
120
|
-
prompt: finalPrompt,
|
|
121
|
-
cwd: parsed.cwd,
|
|
122
|
-
model: taskDef.model,
|
|
123
|
-
autonomous: parsed.autonomous,
|
|
124
|
-
dependsOn: realDependsOn,
|
|
125
|
-
labels: labels.length > 0 ? labels : undefined,
|
|
126
|
-
});
|
|
127
|
-
// Map local ID to real task ID
|
|
128
|
-
idMap.set(taskDef.id, taskId);
|
|
129
|
-
if (ctx?.progressToken != null) {
|
|
130
|
-
progressRegistry.register(taskId, ctx.progressToken, ctx.sendNotification);
|
|
131
|
-
progressRegistry.sendProgress(taskId, `Batch task ${createdTasks.length + 1}/${parsed.tasks.length}: ${taskDef.id} → ${taskId}`);
|
|
132
|
-
}
|
|
133
|
-
const task = taskManager.getTask(taskId);
|
|
134
|
-
createdTasks.push({
|
|
135
|
-
local_id: taskDef.id,
|
|
136
|
-
task_id: taskId,
|
|
137
|
-
status: task?.status || 'pending',
|
|
138
|
-
depends_on: realDependsOn,
|
|
139
|
-
});
|
|
140
|
-
}
|
|
141
|
-
const header = `## Batch Created (${createdTasks.length} tasks)`;
|
|
142
|
-
const rows = createdTasks.map(t => [
|
|
143
|
-
t.local_id,
|
|
144
|
-
`**${t.task_id}**`,
|
|
145
|
-
t.status,
|
|
146
|
-
t.depends_on?.join(', ') || '--',
|
|
147
|
-
]);
|
|
148
|
-
const table = formatTable(['Local ID', 'Task ID', 'Status', 'Depends On'], rows);
|
|
149
|
-
return mcpText(join(header, '', table, '', 'Check all with `get_status`.'));
|
|
150
|
-
}
|
|
151
|
-
catch (error) {
|
|
152
|
-
return mcpText(formatError(error instanceof Error ? error.message : 'Unknown error', 'Check tasks array format and dependencies.'));
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
//# sourceMappingURL=batch-spawn.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"batch-spawn.js","sourceRoot":"","sources":["../../src/tools/batch-spawn.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACz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AS,CAAC;QACjE,MAAM,IAAI,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;YACjC,CAAC,CAAC,QAAQ;YACV,KAAK,CAAC,CAAC,OAAO,IAAI;YAClB,CAAC,CAAC,MAAM;YACR,CAAC,CAAC,UAAU,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI;SACjC,CAAC,CAAC;QACH,MAAM,KAAK,GAAG,WAAW,CAAC,CAAC,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,YAAY,CAAC,EAAE,IAAI,CAAC,CAAC;QAEjF,OAAO,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,8BAA8B,CAAC,CAAC,CAAC;IAC9E,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,OAAO,CAAC,WAAW,CACxB,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,EACxD,4CAA4C,CAC7C,CAAC,CAAC;IACL,CAAC;AACH,CAAC"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
export declare const clearTasksTool: {
|
|
2
|
-
name: string;
|
|
3
|
-
description: string;
|
|
4
|
-
inputSchema: {
|
|
5
|
-
type: "object";
|
|
6
|
-
properties: {
|
|
7
|
-
confirm: {
|
|
8
|
-
type: string;
|
|
9
|
-
description: string;
|
|
10
|
-
};
|
|
11
|
-
};
|
|
12
|
-
required: string[];
|
|
13
|
-
};
|
|
14
|
-
};
|
|
15
|
-
export declare function handleClearTasks(args: unknown): Promise<{
|
|
16
|
-
content: Array<{
|
|
17
|
-
type: string;
|
|
18
|
-
text: string;
|
|
19
|
-
}>;
|
|
20
|
-
}>;
|
|
21
|
-
//# sourceMappingURL=clear-tasks.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"clear-tasks.d.ts","sourceRoot":"","sources":["../../src/tools/clear-tasks.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,cAAc;;;;;;;;;;;;;CAa1B,CAAC;AAEF,wBAAsB,gBAAgB,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC;IAAE,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAAE,CAAC,CA0BjH"}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { taskManager } from '../services/task-manager.js';
|
|
3
|
-
import { clientContext } from '../services/client-context.js';
|
|
4
|
-
import { deleteStorage } from '../services/task-persistence.js';
|
|
5
|
-
import { mcpText, formatError } from '../utils/format.js';
|
|
6
|
-
const ClearTasksSchema = z.object({
|
|
7
|
-
confirm: z.boolean().describe('Must be true to confirm deletion'),
|
|
8
|
-
});
|
|
9
|
-
export const clearTasksTool = {
|
|
10
|
-
name: 'clear_tasks',
|
|
11
|
-
description: `Delete all persisted tasks for current workspace. Requires confirm: true.`,
|
|
12
|
-
inputSchema: {
|
|
13
|
-
type: 'object',
|
|
14
|
-
properties: {
|
|
15
|
-
confirm: {
|
|
16
|
-
type: 'boolean',
|
|
17
|
-
description: 'Must be true to confirm deletion.',
|
|
18
|
-
},
|
|
19
|
-
},
|
|
20
|
-
required: ['confirm'],
|
|
21
|
-
},
|
|
22
|
-
};
|
|
23
|
-
export async function handleClearTasks(args) {
|
|
24
|
-
try {
|
|
25
|
-
const parsed = ClearTasksSchema.parse(args || {});
|
|
26
|
-
if (!parsed.confirm) {
|
|
27
|
-
return mcpText(formatError('Confirmation required', 'Call `clear_tasks` with `confirm: true` to proceed.'));
|
|
28
|
-
}
|
|
29
|
-
const cwd = clientContext.getDefaultCwd();
|
|
30
|
-
// Clear in-memory tasks first
|
|
31
|
-
const taskCount = taskManager.clearAllTasks();
|
|
32
|
-
// Delete storage file
|
|
33
|
-
const deleted = deleteStorage(cwd);
|
|
34
|
-
const msg = deleted
|
|
35
|
-
? `Cleared ${taskCount} tasks for workspace.`
|
|
36
|
-
: 'No tasks to clear (workspace already clean).';
|
|
37
|
-
return mcpText(msg);
|
|
38
|
-
}
|
|
39
|
-
catch (error) {
|
|
40
|
-
return mcpText(formatError(error instanceof Error ? error.message : 'Unknown error', 'Ensure `confirm` parameter is a boolean.'));
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
//# sourceMappingURL=clear-tasks.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"clear-tasks.js","sourceRoot":"","sources":["../../src/tools/clear-tasks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAE1D,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IAChC,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,CAAC,kCAAkC,CAAC;CAClE,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,IAAI,EAAE,aAAa;IACnB,WAAW,EAAE,2EAA2E;IACxF,WAAW,EAAE;QACX,IAAI,EAAE,QAAiB;QACvB,UAAU,EAAE;YACV,OAAO,EAAE;gBACP,IAAI,EAAE,SAAS;gBACf,WAAW,EAAE,mCAAmC;aACjD;SACF;QACD,QAAQ,EAAE,CAAC,SAAS,CAAC;KACtB;CACF,CAAC;AAEF,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,IAAa;IAClD,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,gBAAgB,CAAC,KAAK,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC;QAElD,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;YACpB,OAAO,OAAO,CAAC,WAAW,CAAC,uBAAuB,EAAE,qDAAqD,CAAC,CAAC,CAAC;QAC9G,CAAC;QAED,MAAM,GAAG,GAAG,aAAa,CAAC,aAAa,EAAE,CAAC;QAE1C,8BAA8B;QAC9B,MAAM,SAAS,GAAG,WAAW,CAAC,aAAa,EAAE,CAAC;QAE9C,sBAAsB;QACtB,MAAM,OAAO,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC;QAEnC,MAAM,GAAG,GAAG,OAAO;YACjB,CAAC,CAAC,WAAW,SAAS,uBAAuB;YAC7C,CAAC,CAAC,8CAA8C,CAAC;QACnD,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC;IACtB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,OAAO,CAAC,WAAW,CACxB,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,EACxD,0CAA0C,CAC3C,CAAC,CAAC;IACL,CAAC;AACH,CAAC"}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
export declare const getTaskStatusTool: {
|
|
2
|
-
name: string;
|
|
3
|
-
description: string;
|
|
4
|
-
inputSchema: {
|
|
5
|
-
type: "object";
|
|
6
|
-
properties: {
|
|
7
|
-
task_id: {
|
|
8
|
-
oneOf: ({
|
|
9
|
-
type: string;
|
|
10
|
-
description: string;
|
|
11
|
-
items?: undefined;
|
|
12
|
-
} | {
|
|
13
|
-
type: string;
|
|
14
|
-
items: {
|
|
15
|
-
type: string;
|
|
16
|
-
};
|
|
17
|
-
description: string;
|
|
18
|
-
})[];
|
|
19
|
-
description: string;
|
|
20
|
-
};
|
|
21
|
-
};
|
|
22
|
-
required: string[];
|
|
23
|
-
};
|
|
24
|
-
};
|
|
25
|
-
export declare function handleGetTaskStatus(args: unknown): Promise<{
|
|
26
|
-
content: Array<{
|
|
27
|
-
type: string;
|
|
28
|
-
text: string;
|
|
29
|
-
}>;
|
|
30
|
-
}>;
|
|
31
|
-
//# sourceMappingURL=get-status.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-status.d.ts","sourceRoot":"","sources":["../../src/tools/get-status.ts"],"names":[],"mappings":"AAyDA,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;CAoB7B,CAAC;AA0iBF,wBAAsB,mBAAmB,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC;IAAE,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAAE,CAAC,CA0BpH"}
|