ft-scout 9.5.2 โ 9.5.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -1
- package/bin/src/commands/agent.d.ts +5 -0
- package/bin/src/commands/agent.js +198 -20
- package/bin/src/commands/benchmark.d.ts +19 -1
- package/bin/src/commands/benchmark.js +120 -97
- package/bin/src/commands/support.d.ts +9 -0
- package/bin/src/commands/support.js +227 -0
- package/bin/src/engine/agentEngine.js +103 -15
- package/bin/src/engine/computer/computerController.d.ts +6 -0
- package/bin/src/engine/computer/computerController.js +138 -104
- package/bin/src/engine/computer/scoutDriver.cs +84 -2
- package/bin/src/engine/llm.js +16 -0
- package/bin/src/engine/planner.js +64 -34
- package/bin/src/engine/runtime/agentRuntime.js +102 -6
- package/bin/src/engine/subagents/subagentManager.d.ts +78 -1
- package/bin/src/engine/subagents/subagentManager.js +275 -3
- package/bin/src/index.js +27 -7
- package/bin/src/mcp/client.js +1 -1
- package/bin/src/server/server.js +136 -0
- package/bin/src/utils/branding.js +1 -1
- package/bin/src/utils/claudeUI.d.ts +31 -1
- package/bin/src/utils/claudeUI.js +138 -4
- package/bin/src/utils/pricing.js +0 -1
- package/bin/src/utils/qrBridge.js +1 -1
- package/bin/src/utils/session.d.ts +5 -1
- package/bin/src/utils/session.js +36 -3
- package/bin/src/utils/support.d.ts +63 -0
- package/bin/src/utils/support.js +182 -0
- package/package.json +4 -4
|
@@ -221,6 +221,74 @@ Action Rules:
|
|
|
221
221
|
status: 'completed',
|
|
222
222
|
};
|
|
223
223
|
}
|
|
224
|
+
const simpleAppCheck = checkSimpleAppAction(userGoal);
|
|
225
|
+
if (simpleAppCheck.isSimple && simpleAppCheck.appName) {
|
|
226
|
+
const app = simpleAppCheck.appName;
|
|
227
|
+
const action = simpleAppCheck.action || 'open';
|
|
228
|
+
this.workspace.startStep(1);
|
|
229
|
+
let res;
|
|
230
|
+
const toolName = action === 'close' ? 'computer_close_app' : (action === 'switch' ? 'computer_switch_window' : 'computer_open_app');
|
|
231
|
+
const toolArgs = action === 'switch' ? { windowTitleOrApp: app } : { appName: app };
|
|
232
|
+
renderStepHeader({
|
|
233
|
+
step: 1,
|
|
234
|
+
maxSteps: this.maxSteps,
|
|
235
|
+
startTimeMs: this.startTime,
|
|
236
|
+
tokensConsumed: 0,
|
|
237
|
+
userTier: this.userTier,
|
|
238
|
+
});
|
|
239
|
+
renderToolCall({
|
|
240
|
+
name: toolName,
|
|
241
|
+
args: toolArgs,
|
|
242
|
+
step: 1,
|
|
243
|
+
});
|
|
244
|
+
const actionStartTime = Date.now();
|
|
245
|
+
if (action === 'close') {
|
|
246
|
+
res = await this.computerController.closeApplication(app);
|
|
247
|
+
}
|
|
248
|
+
else if (action === 'switch') {
|
|
249
|
+
res = await this.computerController.switchWindow(app);
|
|
250
|
+
}
|
|
251
|
+
else {
|
|
252
|
+
res = await this.computerController.openApplication(app);
|
|
253
|
+
}
|
|
254
|
+
renderToolResult({
|
|
255
|
+
name: toolName,
|
|
256
|
+
args: toolArgs,
|
|
257
|
+
result: JSON.stringify(res, null, 2),
|
|
258
|
+
durationMs: Date.now() - actionStartTime,
|
|
259
|
+
success: res && res.success !== false,
|
|
260
|
+
});
|
|
261
|
+
const actionVerb = action === 'close' ? 'closed' : (action === 'switch' ? 'focused' : 'launched');
|
|
262
|
+
const summary = res && res.success !== false
|
|
263
|
+
? `I've ${actionVerb} ${app} for you. It's ready on your screen!`
|
|
264
|
+
: `Attempted to ${action} ${app}: ${res?.output || res?.error || 'Failed to execute application action'}`;
|
|
265
|
+
this.workspace.completeStep(1, summary);
|
|
266
|
+
this.workspace.setStatus(res && res.success !== false ? 'completed' : 'failed');
|
|
267
|
+
renderTaskCompletedCard({
|
|
268
|
+
objective: userGoal,
|
|
269
|
+
summary,
|
|
270
|
+
modifiedFiles: [],
|
|
271
|
+
steps: 1,
|
|
272
|
+
maxSteps: this.maxSteps,
|
|
273
|
+
totalTokens: 0,
|
|
274
|
+
totalToolCalls: 1,
|
|
275
|
+
elapsedSecs: Math.max(0.1, (Date.now() - this.startTime) / 1000),
|
|
276
|
+
userTier: this.userTier,
|
|
277
|
+
});
|
|
278
|
+
saveAgentSession({
|
|
279
|
+
goal: userGoal,
|
|
280
|
+
summary,
|
|
281
|
+
modifiedFiles: [],
|
|
282
|
+
});
|
|
283
|
+
return {
|
|
284
|
+
success: res && res.success !== false,
|
|
285
|
+
summary,
|
|
286
|
+
taskId,
|
|
287
|
+
stepsTaken: 1,
|
|
288
|
+
modifiedFiles: [],
|
|
289
|
+
status: res && res.success !== false ? 'completed' : 'failed',
|
|
290
|
+
};
|
|
291
|
+
}
|
|
224
292
|
this.historyMessages.push({ role: 'system', content: this.buildSystemPrompt() });
|
|
225
293
|
// Memory persistence
|
|
226
294
|
const recentMemory = getRecentSessionsSummary(1);
|
|
@@ -296,10 +364,7 @@ Action Rules:
|
|
|
296
364
|
userTier: this.userTier,
|
|
297
365
|
});
|
|
298
366
|
const stepSpinner = spinner();
|
|
299
|
-
|
|
300
|
-
? `Scout Operating (Step ${step})`
|
|
301
|
-
: `Scout Operating (Step ${step}/${this.maxSteps})`;
|
|
302
|
-
stepSpinner.start(chalk.cyan(stepText));
|
|
367
|
+
stepSpinner.start(chalk.cyan(`Scout Operating (Step ${step})`));
|
|
303
368
|
try {
|
|
304
369
|
let response;
|
|
305
370
|
const mcpRouting = getMCPManager().routeTools(userGoal);
|
|
@@ -315,9 +380,40 @@ Action Rules:
|
|
|
315
380
|
goalLower.includes('calc') ||
|
|
316
381
|
goalLower.includes('paint') ||
|
|
317
382
|
goalLower.includes('type') ||
|
|
383
|
+
goalLower.includes('chrome') ||
|
|
384
|
+
goalLower.includes('browser') ||
|
|
385
|
+
goalLower.includes('vscode') ||
|
|
386
|
+
goalLower.includes('vs code') ||
|
|
387
|
+
goalLower.includes('code') ||
|
|
388
|
+
goalLower.includes('terminal') ||
|
|
389
|
+
goalLower.includes('powershell') ||
|
|
390
|
+
goalLower.includes('cmd') ||
|
|
391
|
+
goalLower.includes('explorer') ||
|
|
392
|
+
goalLower.includes('spotify') ||
|
|
393
|
+
goalLower.includes('slack') ||
|
|
394
|
+
goalLower.includes('discord') ||
|
|
395
|
+
goalLower.includes('edge') ||
|
|
396
|
+
goalLower.includes('firefox') ||
|
|
397
|
+
goalLower.includes('excel') ||
|
|
398
|
+
goalLower.includes('word') ||
|
|
399
|
+
goalLower.includes('blender') ||
|
|
400
|
+
goalLower.includes('open') ||
|
|
401
|
+
goalLower.includes('launch') ||
|
|
402
|
+
goalLower.includes('window') ||
|
|
403
|
+
simpleAppCheck.isSimple ||
|
|
318
404
|
this.workspace?.getExecutionIntent()?.requiredInteraction === 'computer' ||
|
|
319
405
|
((this.workspace?.getExecutionIntent()?.requiredApplications?.length ?? 0) > 0);
|
|
320
406
|
let baseTools = this.toolRegistry.getToolsForTier(this.userTier);
|
|
407
|
+
if (needsComputer) {
|
|
408
|
+
const computerTools = this.toolRegistry.getAllTools().filter((t) => t.name.startsWith('computer_'));
|
|
409
|
+
const existingNames = new Set(baseTools.map((t) => t.name));
|
|
410
|
+
for (const ct of computerTools) {
|
|
411
|
+
if (!existingNames.has(ct.name)) {
|
|
412
|
+
baseTools.push(ct);
|
|
413
|
+
existingNames.add(ct.name);
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
}
|
|
321
417
|
if (mcpRouting.tools.length > 0 && !needsBrowser && !needsComputer) {
|
|
322
418
|
const ESSENTIAL_BASE_TOOLS = new Set(['read_file', 'write_file', 'edit_file', 'run_command', 'list_dir', 'grep_search', 'task_completed', 'ask_user', 'speak_text', 'scratchpad', 'computer_open_app']);
|
|
323
419
|
baseTools = baseTools.filter((t) => ESSENTIAL_BASE_TOOLS.has(t.name));
|
|
@@ -569,8 +665,8 @@ Action Rules:
|
|
|
569
665
|
return {
|
|
570
666
|
success: false,
|
|
571
667
|
summary: Number.isFinite(this.maxSteps)
|
|
572
|
-
? `Reached
|
|
573
|
-
: `Task ended after ${step}
|
|
668
|
+
? `Reached step limit (${this.maxSteps}). Modified files: ${Array.from(this.modifiedFiles).join(', ')}`
|
|
669
|
+
: `Task ended after ${step} steps. Modified files: ${Array.from(this.modifiedFiles).join(', ')}`,
|
|
574
670
|
taskId,
|
|
575
671
|
stepsTaken: step,
|
|
576
672
|
modifiedFiles: Array.from(this.modifiedFiles),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type SubagentRole = 'architect' | 'coder' | 'tester' | 'reviewer' | 'general';
|
|
1
|
+
export type SubagentRole = 'architect' | 'coder' | 'tester' | 'reviewer' | 'operator' | 'researcher' | 'crossapp' | 'general';
|
|
2
2
|
export interface SubagentTaskRequest {
|
|
3
3
|
role: SubagentRole;
|
|
4
4
|
task: string;
|
|
@@ -16,6 +16,65 @@ export interface SubagentTaskResult {
|
|
|
16
16
|
stepsUsed: number;
|
|
17
17
|
error?: string;
|
|
18
18
|
}
|
|
19
|
+
export interface TeamSwarmResult {
|
|
20
|
+
success: boolean;
|
|
21
|
+
summary: string;
|
|
22
|
+
architectOutput?: string;
|
|
23
|
+
coderOutput?: string;
|
|
24
|
+
testerOutput?: string;
|
|
25
|
+
modifiedFiles: string[];
|
|
26
|
+
totalStepsUsed: number;
|
|
27
|
+
error?: string;
|
|
28
|
+
}
|
|
29
|
+
export interface CrossAppSwarmResult {
|
|
30
|
+
success: boolean;
|
|
31
|
+
summary: string;
|
|
32
|
+
sourceApp?: string;
|
|
33
|
+
targetApp?: string;
|
|
34
|
+
researcherOutput?: string;
|
|
35
|
+
operatorOutput?: string;
|
|
36
|
+
verifierOutput?: string;
|
|
37
|
+
modifiedFiles: string[];
|
|
38
|
+
totalStepsUsed: number;
|
|
39
|
+
error?: string;
|
|
40
|
+
}
|
|
41
|
+
export interface ParsedMention {
|
|
42
|
+
role: SubagentRole | 'team' | 'crossapp' | null;
|
|
43
|
+
task: string;
|
|
44
|
+
isMention: boolean;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Extracts candidate source and target apps from a cross-app task string.
|
|
48
|
+
*/
|
|
49
|
+
export declare function extractAppPair(task: string): {
|
|
50
|
+
source: string;
|
|
51
|
+
target: string;
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* Heuristically detects if a prompt requests cross-app automation
|
|
55
|
+
* e.g., "from chrome to vscode", "scrape web and update app", "between figma and code"
|
|
56
|
+
*/
|
|
57
|
+
export declare function isCrossAppIntent(input: string): boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Global mutex for desktop input focus.
|
|
60
|
+
* Ensures concurrent subagents do not collide on physical mouse/keyboard focus
|
|
61
|
+
* when interacting with native desktop applications.
|
|
62
|
+
*/
|
|
63
|
+
export declare class AppFocusMutex {
|
|
64
|
+
private static instance;
|
|
65
|
+
private currentLockHolder;
|
|
66
|
+
private queue;
|
|
67
|
+
static getInstance(): AppFocusMutex;
|
|
68
|
+
acquire(holderId: string): Promise<() => void>;
|
|
69
|
+
release(holderId: string): void;
|
|
70
|
+
isLocked(): boolean;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Parses Grok & Strawberry-style @mentions from user prompts
|
|
74
|
+
* e.g. "@architect review schema", "@coder fix auth", "@tester run tests", "@team build snake game",
|
|
75
|
+
* "@operator open notepad", "@researcher scrape docs", "@crossapp from chrome to vscode"
|
|
76
|
+
*/
|
|
77
|
+
export declare function parseMentionedRole(input: string): ParsedMention;
|
|
19
78
|
export declare class SubagentManager {
|
|
20
79
|
private static instance;
|
|
21
80
|
private activeDelegations;
|
|
@@ -25,5 +84,23 @@ export declare class SubagentManager {
|
|
|
25
84
|
*/
|
|
26
85
|
delegate(req: SubagentTaskRequest): Promise<SubagentTaskResult>;
|
|
27
86
|
getActiveDelegationsCount(): number;
|
|
87
|
+
/**
|
|
88
|
+
* Run a coordinated multi-agent team swarm relay (Architect -> Coder -> Tester)
|
|
89
|
+
* Inspired by Grok bot multi-perspective collaboration in one session.
|
|
90
|
+
*/
|
|
91
|
+
runTeamSwarm(task: string, options?: {
|
|
92
|
+
tier?: string;
|
|
93
|
+
context?: string;
|
|
94
|
+
}): Promise<TeamSwarmResult>;
|
|
95
|
+
/**
|
|
96
|
+
* Run a coordinated Cross-App & Multi-Window Swarm Relay (Strawberry-style)
|
|
97
|
+
* e.g., Researcher Agent (Browser/Web DOM extraction) -> Operator Agent (Desktop App/Editor injection) -> Verifier Agent
|
|
98
|
+
*/
|
|
99
|
+
runCrossAppSwarm(task: string, options?: {
|
|
100
|
+
tier?: string;
|
|
101
|
+
context?: string;
|
|
102
|
+
sourceApp?: string;
|
|
103
|
+
targetApp?: string;
|
|
104
|
+
}): Promise<CrossAppSwarmResult>;
|
|
28
105
|
}
|
|
29
106
|
//# sourceMappingURL=subagentManager.d.ts.map
|
|
@@ -1,11 +1,152 @@
|
|
|
1
1
|
import chalk from 'chalk';
|
|
2
2
|
import path from 'path';
|
|
3
3
|
import { AgentExecutionLoop } from '../agentEngine.js';
|
|
4
|
+
/**
|
|
5
|
+
* Extracts candidate source and target apps from a cross-app task string.
|
|
6
|
+
*/
|
|
7
|
+
export function extractAppPair(task) {
|
|
8
|
+
const lower = task.toLowerCase();
|
|
9
|
+
let source = 'Browser';
|
|
10
|
+
let target = 'VS Code / Codebase';
|
|
11
|
+
if (lower.includes('chrome'))
|
|
12
|
+
source = 'Chrome';
|
|
13
|
+
else if (lower.includes('figma'))
|
|
14
|
+
source = 'Figma';
|
|
15
|
+
else if (lower.includes('github'))
|
|
16
|
+
source = 'GitHub';
|
|
17
|
+
else if (lower.includes('edge'))
|
|
18
|
+
source = 'Edge';
|
|
19
|
+
else if (lower.includes('docs') || lower.includes('website'))
|
|
20
|
+
source = 'Web Docs';
|
|
21
|
+
if (lower.includes('vscode') || lower.includes('vs code'))
|
|
22
|
+
target = 'VS Code';
|
|
23
|
+
else if (lower.includes('notepad'))
|
|
24
|
+
target = 'Notepad';
|
|
25
|
+
else if (lower.includes('slack'))
|
|
26
|
+
target = 'Slack';
|
|
27
|
+
else if (lower.includes('discord'))
|
|
28
|
+
target = 'Discord';
|
|
29
|
+
else if (lower.includes('terminal'))
|
|
30
|
+
target = 'Terminal';
|
|
31
|
+
else if (lower.includes('excel'))
|
|
32
|
+
target = 'Excel';
|
|
33
|
+
return { source, target };
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Heuristically detects if a prompt requests cross-app automation
|
|
37
|
+
* e.g., "from chrome to vscode", "scrape web and update app", "between figma and code"
|
|
38
|
+
*/
|
|
39
|
+
export function isCrossAppIntent(input) {
|
|
40
|
+
const lower = input.toLowerCase();
|
|
41
|
+
const appKeywords = [
|
|
42
|
+
'browser', 'chrome', 'edge', 'firefox', 'web', 'website', 'url', 'figma',
|
|
43
|
+
'vscode', 'vs code', 'notepad', 'slack', 'discord', 'terminal', 'excel',
|
|
44
|
+
'calc', 'calculator', 'desktop', 'window', 'app', 'application'
|
|
45
|
+
];
|
|
46
|
+
const bridgeKeywords = [
|
|
47
|
+
'from', 'to', 'between', 'copy from', 'paste to', 'paste into',
|
|
48
|
+
'extract from', 'transfer', 'scrape and update', 'switch to', 'open and copy',
|
|
49
|
+
'across apps', 'multiple apps'
|
|
50
|
+
];
|
|
51
|
+
let appCount = 0;
|
|
52
|
+
for (const app of appKeywords) {
|
|
53
|
+
if (lower.includes(app)) {
|
|
54
|
+
appCount++;
|
|
55
|
+
if (appCount >= 2)
|
|
56
|
+
break;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
const hasBridge = bridgeKeywords.some(b => lower.includes(b));
|
|
60
|
+
return appCount >= 2 && hasBridge;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Global mutex for desktop input focus.
|
|
64
|
+
* Ensures concurrent subagents do not collide on physical mouse/keyboard focus
|
|
65
|
+
* when interacting with native desktop applications.
|
|
66
|
+
*/
|
|
67
|
+
export class AppFocusMutex {
|
|
68
|
+
static instance = null;
|
|
69
|
+
currentLockHolder = null;
|
|
70
|
+
queue = [];
|
|
71
|
+
static getInstance() {
|
|
72
|
+
if (!AppFocusMutex.instance) {
|
|
73
|
+
AppFocusMutex.instance = new AppFocusMutex();
|
|
74
|
+
}
|
|
75
|
+
return AppFocusMutex.instance;
|
|
76
|
+
}
|
|
77
|
+
async acquire(holderId) {
|
|
78
|
+
if (!this.currentLockHolder) {
|
|
79
|
+
this.currentLockHolder = holderId;
|
|
80
|
+
return () => this.release(holderId);
|
|
81
|
+
}
|
|
82
|
+
await new Promise((resolve) => {
|
|
83
|
+
this.queue.push({ id: holderId, resolve });
|
|
84
|
+
});
|
|
85
|
+
this.currentLockHolder = holderId;
|
|
86
|
+
return () => this.release(holderId);
|
|
87
|
+
}
|
|
88
|
+
release(holderId) {
|
|
89
|
+
if (this.currentLockHolder === holderId) {
|
|
90
|
+
this.currentLockHolder = null;
|
|
91
|
+
const next = this.queue.shift();
|
|
92
|
+
if (next) {
|
|
93
|
+
this.currentLockHolder = next.id;
|
|
94
|
+
next.resolve();
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
isLocked() {
|
|
99
|
+
return this.currentLockHolder !== null;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Parses Grok & Strawberry-style @mentions from user prompts
|
|
104
|
+
* e.g. "@architect review schema", "@coder fix auth", "@tester run tests", "@team build snake game",
|
|
105
|
+
* "@operator open notepad", "@researcher scrape docs", "@crossapp from chrome to vscode"
|
|
106
|
+
*/
|
|
107
|
+
export function parseMentionedRole(input) {
|
|
108
|
+
const trimmed = input.trim();
|
|
109
|
+
const mentionMatch = trimmed.match(/^@([a-zA-Z0-9_\-]+)\b\s*(.*)$/s);
|
|
110
|
+
if (!mentionMatch) {
|
|
111
|
+
return { role: null, task: input, isMention: false };
|
|
112
|
+
}
|
|
113
|
+
const tag = mentionMatch[1]?.toLowerCase() || '';
|
|
114
|
+
const task = (mentionMatch[2] || '').trim();
|
|
115
|
+
if (tag === 'team' || tag === 'swarm' || tag === 'all') {
|
|
116
|
+
return { role: 'team', task, isMention: true };
|
|
117
|
+
}
|
|
118
|
+
if (tag === 'crossapp' || tag === 'bridge' || tag === 'multi' || tag === 'strawberry') {
|
|
119
|
+
return { role: 'crossapp', task, isMention: true };
|
|
120
|
+
}
|
|
121
|
+
if (tag === 'desktop') {
|
|
122
|
+
return { role: 'operator', task, isMention: true };
|
|
123
|
+
}
|
|
124
|
+
if (tag === 'browser' || tag === 'web') {
|
|
125
|
+
return { role: 'researcher', task, isMention: true };
|
|
126
|
+
}
|
|
127
|
+
const validRoles = [
|
|
128
|
+
'architect',
|
|
129
|
+
'coder',
|
|
130
|
+
'tester',
|
|
131
|
+
'reviewer',
|
|
132
|
+
'operator',
|
|
133
|
+
'researcher',
|
|
134
|
+
'crossapp',
|
|
135
|
+
'general',
|
|
136
|
+
];
|
|
137
|
+
if (validRoles.includes(tag)) {
|
|
138
|
+
return { role: tag, task, isMention: true };
|
|
139
|
+
}
|
|
140
|
+
return { role: null, task: input, isMention: false };
|
|
141
|
+
}
|
|
4
142
|
const ROLE_PROMPTS = {
|
|
5
143
|
architect: 'You are Scout Subagent ARCHITECT. Your specialty is high-level software architecture, system decomposition, modular design, component hierarchy, API contract design, and technical feasibility analysis. Analyze code structure, identify architectural bottlenecks, and construct robust system designs.',
|
|
6
144
|
coder: 'You are Scout Subagent CODER. Your specialty is surgical code implementation, bug fixing, refactoring, and adding new features. Write clean, idiomatic, fully-typed code adhering to the project conventions.',
|
|
7
145
|
tester: 'You are Scout Subagent TESTER. Your specialty is test engineering, writing comprehensive unit and integration tests, diagnosing test failures, and covering edge cases.',
|
|
8
146
|
reviewer: 'You are Scout Subagent REVIEWER. Your specialty is code review, security audits, diff verification, performance analysis, and identifying regressions or anti-patterns in the codebase.',
|
|
147
|
+
operator: 'You are Scout Subagent OPERATOR. Your specialty is native desktop application control, window management, GUI inspection, and operating local software (VS Code, Notepad, Figma, Terminal, Slack, etc.). Use switchWindow, openApplication, inspectUI, and desktop automation tools safely with precise focus management.',
|
|
148
|
+
researcher: 'You are Scout Subagent RESEARCHER. Your specialty is autonomous web navigation, browser automation, documentation scraping, and extracting data from web pages, local assets (HTML/CSS), and APIs using browser and workspace inspection tools (read_file, browser_navigate, browser_click, extract_content). Extract structured insights for downstream agents autonomously without asking the user.',
|
|
149
|
+
crossapp: 'You are Scout Subagent CROSSAPP. Your specialty is orchestrating multi-application workflows, bridging data between web browsers, local desktop applications, and codebase editors with safe window switching.',
|
|
9
150
|
general: 'You are Scout Subagent GENERAL. Execute the assigned task efficiently and autonomously.',
|
|
10
151
|
};
|
|
11
152
|
export class SubagentManager {
|
|
@@ -34,7 +175,6 @@ export class SubagentManager {
|
|
|
34
175
|
}
|
|
35
176
|
const role = req.role in ROLE_PROMPTS ? req.role : 'general';
|
|
36
177
|
const roleDirective = ROLE_PROMPTS[role];
|
|
37
|
-
const maxSteps = Math.min(req.maxSteps || 10, 20);
|
|
38
178
|
console.log(chalk.magenta.bold(`\n๐ค [Subagent Swarm โ ${role.toUpperCase()}]: ${chalk.white(req.task)}`));
|
|
39
179
|
if (req.context) {
|
|
40
180
|
console.log(chalk.dim(` Context: ${req.context.slice(0, 120)}${req.context.length > 120 ? '...' : ''}`));
|
|
@@ -43,7 +183,7 @@ export class SubagentManager {
|
|
|
43
183
|
try {
|
|
44
184
|
const options = {
|
|
45
185
|
autoApprove: true,
|
|
46
|
-
maxSteps,
|
|
186
|
+
maxSteps: req.maxSteps,
|
|
47
187
|
tier: req.tier || 'pro',
|
|
48
188
|
};
|
|
49
189
|
const subAgent = new AgentExecutionLoop(options);
|
|
@@ -59,7 +199,9 @@ ${req.context ? `[ADDITIONAL CONTEXT]\n${req.context}\n` : ''}
|
|
|
59
199
|
[EXECUTION INSTRUCTIONS]
|
|
60
200
|
1. Focus strictly on your assigned role and goal.
|
|
61
201
|
2. Complete the necessary tool calls (reading, writing, editing, searching, testing) directly.
|
|
62
|
-
3.
|
|
202
|
+
3. You have full access to workspace files and directories. Inspect local files using read_file or list_dir.
|
|
203
|
+
4. If you need user input, guidance, or clarification to proceed, call ask_user to ask the user directly.
|
|
204
|
+
5. Call task_completed with a concise, professional summary of what you did and your key findings.
|
|
63
205
|
`.trim();
|
|
64
206
|
const execResult = await subAgent.executeGoal(scopedGoal);
|
|
65
207
|
const modifiedFiles = subAgent.getModifiedFiles();
|
|
@@ -92,5 +234,135 @@ ${req.context ? `[ADDITIONAL CONTEXT]\n${req.context}\n` : ''}
|
|
|
92
234
|
getActiveDelegationsCount() {
|
|
93
235
|
return this.activeDelegations;
|
|
94
236
|
}
|
|
237
|
+
/**
|
|
238
|
+
* Run a coordinated multi-agent team swarm relay (Architect -> Coder -> Tester)
|
|
239
|
+
* Inspired by Grok bot multi-perspective collaboration in one session.
|
|
240
|
+
*/
|
|
241
|
+
async runTeamSwarm(task, options) {
|
|
242
|
+
console.log(chalk.bold.magenta('\nโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ'));
|
|
243
|
+
console.log(chalk.bold.magenta('โ ๐ MULTI-AGENT SWARM SESSION: TEAM COLLABORATION โ'));
|
|
244
|
+
console.log(chalk.bold.magenta('โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ\n'));
|
|
245
|
+
const tier = options?.tier || 'pro';
|
|
246
|
+
const allModifiedFiles = new Set();
|
|
247
|
+
let totalSteps = 0;
|
|
248
|
+
// Stage 1: Architect Plan
|
|
249
|
+
console.log(chalk.cyan.bold('\n๐๏ธ [@ARCHITECT Phase: Blueprint & System Design]'));
|
|
250
|
+
const architectRes = await this.delegate({
|
|
251
|
+
role: 'architect',
|
|
252
|
+
task: `Analyze the repository and create an actionable architectural design blueprint for this goal: "${task}". Specify modules to touch and engineering approach.`,
|
|
253
|
+
context: options?.context,
|
|
254
|
+
tier,
|
|
255
|
+
});
|
|
256
|
+
totalSteps += architectRes.stepsUsed;
|
|
257
|
+
architectRes.modifiedFiles.forEach((f) => allModifiedFiles.add(f));
|
|
258
|
+
// Stage 2: Coder Implementation
|
|
259
|
+
console.log(chalk.green.bold('\n๐ป [@CODER Phase: Surgical Code Implementation]'));
|
|
260
|
+
const coderRes = await this.delegate({
|
|
261
|
+
role: 'coder',
|
|
262
|
+
task: `Execute and implement the necessary code changes based on this goal: "${task}". Follow the Architect blueprint.`,
|
|
263
|
+
context: `Architect Blueprint:\n${architectRes.summary}\n\nOriginal Task Context:\n${options?.context || ''}`,
|
|
264
|
+
tier,
|
|
265
|
+
});
|
|
266
|
+
totalSteps += coderRes.stepsUsed;
|
|
267
|
+
coderRes.modifiedFiles.forEach((f) => allModifiedFiles.add(f));
|
|
268
|
+
// Stage 3: Tester Verification
|
|
269
|
+
console.log(chalk.yellow.bold('\n๐งช [@TESTER Phase: Verification & Quality Assurance]'));
|
|
270
|
+
const testerRes = await this.delegate({
|
|
271
|
+
role: 'tester',
|
|
272
|
+
task: `Verify the changes made for "${task}". Run tests/build if available, verify syntax, and report edge cases.`,
|
|
273
|
+
context: `Modified files: ${Array.from(allModifiedFiles).join(', ')}\nCoder implementation notes:\n${coderRes.summary}`,
|
|
274
|
+
tier,
|
|
275
|
+
});
|
|
276
|
+
totalSteps += testerRes.stepsUsed;
|
|
277
|
+
testerRes.modifiedFiles.forEach((f) => allModifiedFiles.add(f));
|
|
278
|
+
const overallSuccess = coderRes.success || architectRes.success;
|
|
279
|
+
const summary = [
|
|
280
|
+
`### ๐๏ธ Architect Blueprint`,
|
|
281
|
+
architectRes.summary,
|
|
282
|
+
`### ๐ป Coder Implementation`,
|
|
283
|
+
coderRes.summary,
|
|
284
|
+
`### ๐งช Tester Verification`,
|
|
285
|
+
testerRes.summary,
|
|
286
|
+
].join('\n\n');
|
|
287
|
+
return {
|
|
288
|
+
success: overallSuccess,
|
|
289
|
+
summary,
|
|
290
|
+
architectOutput: architectRes.summary,
|
|
291
|
+
coderOutput: coderRes.summary,
|
|
292
|
+
testerOutput: testerRes.summary,
|
|
293
|
+
modifiedFiles: Array.from(allModifiedFiles),
|
|
294
|
+
totalStepsUsed: totalSteps,
|
|
295
|
+
};
|
|
296
|
+
}
|
|
297
|
+
/**
|
|
298
|
+
* Run a coordinated Cross-App & Multi-Window Swarm Relay (Strawberry-style)
|
|
299
|
+
* e.g., Researcher Agent (Browser/Web DOM extraction) -> Operator Agent (Desktop App/Editor injection) -> Verifier Agent
|
|
300
|
+
*/
|
|
301
|
+
async runCrossAppSwarm(task, options) {
|
|
302
|
+
console.log(chalk.bold.cyan('\nโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ'));
|
|
303
|
+
console.log(chalk.bold.cyan('โ ๐ MULTI-AGENT SWARM SESSION: CROSS-APP STRAWBERRY RELAY โ'));
|
|
304
|
+
console.log(chalk.bold.cyan('โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ\n'));
|
|
305
|
+
const tier = options?.tier || 'pro';
|
|
306
|
+
const allModifiedFiles = new Set();
|
|
307
|
+
let totalSteps = 0;
|
|
308
|
+
// Auto-detect source & target applications if not provided
|
|
309
|
+
let sourceApp = options?.sourceApp;
|
|
310
|
+
let targetApp = options?.targetApp;
|
|
311
|
+
if (!sourceApp || !targetApp) {
|
|
312
|
+
const detected = extractAppPair(task);
|
|
313
|
+
sourceApp = sourceApp || detected.source;
|
|
314
|
+
targetApp = targetApp || detected.target;
|
|
315
|
+
}
|
|
316
|
+
// Stage 1: Researcher Agent (Browser / Source App Data Extraction)
|
|
317
|
+
console.log(chalk.blue.bold(`\n๐ [@RESEARCHER Phase: Source Data Extraction from ${sourceApp}]`));
|
|
318
|
+
const researcherRes = await this.delegate({
|
|
319
|
+
role: 'researcher',
|
|
320
|
+
task: `Extract, scrape, or investigate data, documentation, or design tokens for this goal: "${task}". Extract clean, structured findings.`,
|
|
321
|
+
context: options?.context,
|
|
322
|
+
tier,
|
|
323
|
+
});
|
|
324
|
+
totalSteps += researcherRes.stepsUsed;
|
|
325
|
+
researcherRes.modifiedFiles.forEach((f) => allModifiedFiles.add(f));
|
|
326
|
+
// Stage 2: Operator / Coder Agent (Target App / Editor Implementation)
|
|
327
|
+
console.log(chalk.green.bold(`\n๐ป [@OPERATOR Phase: Desktop Application & Code Injection into ${targetApp}]`));
|
|
328
|
+
const operatorRes = await this.delegate({
|
|
329
|
+
role: 'operator',
|
|
330
|
+
task: `Apply, input, or integrate the extracted data into ${targetApp} for goal: "${task}".`,
|
|
331
|
+
context: `Extracted Data from Source (${sourceApp}):\n${researcherRes.summary}\n\nTask Context:\n${options?.context || ''}`,
|
|
332
|
+
tier,
|
|
333
|
+
});
|
|
334
|
+
totalSteps += operatorRes.stepsUsed;
|
|
335
|
+
operatorRes.modifiedFiles.forEach((f) => allModifiedFiles.add(f));
|
|
336
|
+
// Stage 3: Verifier Phase
|
|
337
|
+
console.log(chalk.yellow.bold('\n๐งช [@TESTER Phase: Cross-App State & Syntax Verification]'));
|
|
338
|
+
const verifierRes = await this.delegate({
|
|
339
|
+
role: 'tester',
|
|
340
|
+
task: `Verify the cross-application workflow results for: "${task}". Check syntax, build integrity, and confirm state.`,
|
|
341
|
+
context: `Modified files: ${Array.from(allModifiedFiles).join(', ')}\nOperator summary:\n${operatorRes.summary}`,
|
|
342
|
+
tier,
|
|
343
|
+
});
|
|
344
|
+
totalSteps += verifierRes.stepsUsed;
|
|
345
|
+
verifierRes.modifiedFiles.forEach((f) => allModifiedFiles.add(f));
|
|
346
|
+
const overallSuccess = operatorRes.success || researcherRes.success;
|
|
347
|
+
const summary = [
|
|
348
|
+
`### ๐ Researcher (Source: ${sourceApp})`,
|
|
349
|
+
researcherRes.summary,
|
|
350
|
+
`### ๐ป Operator (Target: ${targetApp})`,
|
|
351
|
+
operatorRes.summary,
|
|
352
|
+
`### ๐งช Verifier`,
|
|
353
|
+
verifierRes.summary,
|
|
354
|
+
].join('\n\n');
|
|
355
|
+
return {
|
|
356
|
+
success: overallSuccess,
|
|
357
|
+
summary,
|
|
358
|
+
sourceApp,
|
|
359
|
+
targetApp,
|
|
360
|
+
researcherOutput: researcherRes.summary,
|
|
361
|
+
operatorOutput: operatorRes.summary,
|
|
362
|
+
verifierOutput: verifierRes.summary,
|
|
363
|
+
modifiedFiles: Array.from(allModifiedFiles),
|
|
364
|
+
totalStepsUsed: totalSteps,
|
|
365
|
+
};
|
|
366
|
+
}
|
|
95
367
|
}
|
|
96
368
|
//# sourceMappingURL=subagentManager.js.map
|
package/bin/src/index.js
CHANGED
|
@@ -22,6 +22,7 @@ import { handleLogout } from './commands/logout.js';
|
|
|
22
22
|
import { handleSwitch, handleAccounts } from './commands/switchCommand.js';
|
|
23
23
|
import { handleAuthStatus } from './commands/authCommand.js';
|
|
24
24
|
import { handleDashboard } from './commands/dashboard.js';
|
|
25
|
+
import { handleSupport } from './commands/support.js';
|
|
25
26
|
import { handleQuota } from './commands/quota.js';
|
|
26
27
|
import { handlePlanCommand } from './commands/plan.js';
|
|
27
28
|
import { handleMcpList, handleMcpAdd, handleMcpRemove, handleMcpConnect, handleMcpDisconnect, handleMcpInspect, handleMcpTools, handleMcpHealth } from './commands/mcp.js';
|
|
@@ -38,16 +39,16 @@ program
|
|
|
38
39
|
.name('scout')
|
|
39
40
|
.alias('ft')
|
|
40
41
|
.description('FrontTerrain The Onboarding Co-Pilot for New Codebases')
|
|
41
|
-
.version('9.5.
|
|
42
|
+
.version('9.5.5');
|
|
42
43
|
// Header UI on execution with FrontTerrain proprietary logo & version auto-checker
|
|
43
44
|
program.hook('preAction', async (_thisCommand, actionCommand) => {
|
|
44
|
-
intro(renderBranding('9.5.
|
|
45
|
+
intro(renderBranding('9.5.5'));
|
|
45
46
|
const cmdName = actionCommand ? actionCommand.name() : '';
|
|
46
47
|
if (cmdName !== 'upgrade') {
|
|
47
|
-
await checkForUpdates('9.5.
|
|
48
|
+
await checkForUpdates('9.5.5');
|
|
48
49
|
}
|
|
49
|
-
// Auth Guard: enforce authentication for all commands except login, signup, upgrade, help, dashboard, auth, status, plan, mcp, switch, accounts
|
|
50
|
-
const EXEMPT_COMMANDS = ['login', 'signin', 'signup', 'register', 'upgrade', 'help', 'dashboard', 'web-ui', 'gui', 'auth', 'status', 'quota', 'usage', 'credits', 'plan', 'pricing', 'subscribe', 'mcp', 'switch', 'accounts', 'account'];
|
|
50
|
+
// Auth Guard: enforce authentication for all commands except login, signup, upgrade, help, dashboard, auth, status, plan, mcp, switch, accounts, support
|
|
51
|
+
const EXEMPT_COMMANDS = ['login', 'signin', 'signup', 'register', 'upgrade', 'help', 'dashboard', 'web-ui', 'gui', 'auth', 'status', 'quota', 'usage', 'credits', 'plan', 'pricing', 'subscribe', 'mcp', 'switch', 'accounts', 'account', 'support', 'ticket', 'helpdesk'];
|
|
51
52
|
if (!EXEMPT_COMMANDS.includes(cmdName)) {
|
|
52
53
|
const authCfg = loadAuthConfig();
|
|
53
54
|
const hasEnvApiKey = Boolean(process.env.OPENAI_API_KEY ||
|
|
@@ -185,7 +186,7 @@ program
|
|
|
185
186
|
.option('-a, --add <idea>', 'Evaluate feasibility & generate step-by-step roadmap for a feature idea')
|
|
186
187
|
.option('-v, --verify <cmd>', 'Custom verification command (e.g. "npm test" or "npm run build")')
|
|
187
188
|
.option('-m, --max-retries <number>', 'Maximum self-healing attempt iterations (default 3)')
|
|
188
|
-
.option('--steps <number>', 'Maximum autonomous execution steps (
|
|
189
|
+
.option('--steps <number>', 'Maximum autonomous execution steps (optional limit)')
|
|
189
190
|
.option('-y, --yes', 'Automatically retain changes without prompting for review')
|
|
190
191
|
.option('-l, --lang <language>', 'Language for AI teardowns, explanations, and summaries')
|
|
191
192
|
.option('--resume <taskId>', 'Resume an existing autonomous task by ID from .ft/tasks/')
|
|
@@ -265,7 +266,7 @@ program
|
|
|
265
266
|
.command('upgrade')
|
|
266
267
|
.description('Check for updates and auto-upgrade Scout to the latest version')
|
|
267
268
|
.action(async () => {
|
|
268
|
-
await checkForUpdates('9.5.
|
|
269
|
+
await checkForUpdates('9.5.5', true);
|
|
269
270
|
outro(chalk.cyan('Upgrade check complete.'));
|
|
270
271
|
});
|
|
271
272
|
program
|
|
@@ -355,6 +356,25 @@ program
|
|
|
355
356
|
await handlePlanCommand();
|
|
356
357
|
outro(chalk.cyan('Subscription workflow complete.'));
|
|
357
358
|
});
|
|
359
|
+
program
|
|
360
|
+
.command('support')
|
|
361
|
+
.alias('ticket')
|
|
362
|
+
.alias('helpdesk')
|
|
363
|
+
.description('Help & Support center: submit tickets, view status, browse FAQs & diagnostics')
|
|
364
|
+
.option('-n, --new', 'Raise a new support ticket interactively')
|
|
365
|
+
.option('-l, --list', 'List all open support tickets')
|
|
366
|
+
.option('-o, --open', 'Open the Web Help & Support Dashboard in your browser')
|
|
367
|
+
.option('--faq', 'View instant knowledge base FAQs')
|
|
368
|
+
.option('--diagnostics', 'View sanitized system and agent diagnostics')
|
|
369
|
+
.action(async (options) => {
|
|
370
|
+
await handleSupport({
|
|
371
|
+
new: !!options.new,
|
|
372
|
+
list: !!options.list,
|
|
373
|
+
open: !!options.open,
|
|
374
|
+
faq: !!options.faq,
|
|
375
|
+
diagnostics: !!options.diagnostics,
|
|
376
|
+
});
|
|
377
|
+
});
|
|
358
378
|
const mcp = program
|
|
359
379
|
.command('mcp')
|
|
360
380
|
.description('Manage Model Context Protocol (MCP) server connections, tools, and health');
|