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
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# scout (FrontTerrain CLI v9.5.
|
|
1
|
+
# scout (FrontTerrain CLI v9.5.5)
|
|
2
2
|
|
|
3
3
|
**FrontTerrain (`scout`)** The Autonomous AI Principal Software Engineer & Codebase Co-Pilot in your terminal.
|
|
4
4
|
|
|
@@ -482,6 +482,30 @@ Inside an active `scout agent` interactive session, type any slash command to tr
|
|
|
482
482
|
|
|
483
483
|
---
|
|
484
484
|
|
|
485
|
+
## š„ Grok-Style Multi-Agent Personas & Team Swarm (@mentions)
|
|
486
|
+
|
|
487
|
+
Seamlessly collaborate with specialized autonomous subagent personas inside any interactive session or direct CLI goal using simple `@mentions`:
|
|
488
|
+
|
|
489
|
+
```bash
|
|
490
|
+
# Direct specialist personas:
|
|
491
|
+
scout agent "@architect Design a modular caching layer with Redis and memory fallback"
|
|
492
|
+
scout agent "@coder Implement JWT verification middleware in src/auth.ts"
|
|
493
|
+
scout agent "@tester Write unit tests for payment webhook handling and verify edge cases"
|
|
494
|
+
scout agent "@reviewer Audit uncommitted git diff for security vulnerabilities"
|
|
495
|
+
|
|
496
|
+
# Collaborative Grok-Style Team Swarm Relay:
|
|
497
|
+
scout agent "@team Refactor user onboarding flow and verify with automated tests"
|
|
498
|
+
```
|
|
499
|
+
|
|
500
|
+
Inside an active interactive `scout agent` session:
|
|
501
|
+
- `@architect <task>`: Decomposes systems, defines data models, schema, and API contracts.
|
|
502
|
+
- `@coder <task>`: Executes surgical code implementations, bug fixes, and refactoring.
|
|
503
|
+
- `@tester <task>`: Writes and executes test suites, diagnoses failures, and guards regressions.
|
|
504
|
+
- `@reviewer <task>`: Audits code quality, diffs, security boundaries, and anti-patterns.
|
|
505
|
+
- `@team <task>` or `@swarm <task>`: Launches a 3-stage collaborative relay (**Architect** blueprint ā **Coder** implementation ā **Tester** validation) concluded with a consolidated Claude Code-style team completion card.
|
|
506
|
+
|
|
507
|
+
---
|
|
508
|
+
|
|
485
509
|
## ā” Supercharged Engineering Capabilities
|
|
486
510
|
|
|
487
511
|
### 1. šÆ Live Visual Operator HUD
|
|
@@ -35,6 +35,11 @@ export interface ParsedUserIntent {
|
|
|
35
35
|
targetFiles?: string[] | undefined;
|
|
36
36
|
}
|
|
37
37
|
export declare function parseUserPromptIntent(rawGoal: string, filesList: string[]): ParsedUserIntent;
|
|
38
|
+
/**
|
|
39
|
+
* Detects if user prompt is requesting to redo/repeat the previous task
|
|
40
|
+
* e.g. "redo", "/redo", "redo the task", "retry", "repeat last task", "do it again"
|
|
41
|
+
*/
|
|
42
|
+
export declare function isRedoIntent(input: string): boolean;
|
|
38
43
|
export declare function findTargetFilesFromPrompt(userPrompt: string, specifiedFile: string | undefined, filesList: string[]): string[];
|
|
39
44
|
export declare function getAgentGoalInput(placeholderStr: string): Promise<string | symbol>;
|
|
40
45
|
export declare function handleAgent(goalInput?: string, options?: AgentOptions): Promise<void>;
|
|
@@ -6,6 +6,7 @@ import chalk from 'chalk';
|
|
|
6
6
|
import { simpleGit } from 'simple-git';
|
|
7
7
|
import { generateMultiCodeFix, identifyTargetFiles, analyzeCommandError, generateCodeScanReport, generateFeaturePlan, generateCodeFile, askRepoQuestion, getActiveModelInfo, } from '../engine/llm.js';
|
|
8
8
|
import { loadContext, recordHistoryAction, saveAgentSession, getDirectoryFiles } from '../utils/config.js';
|
|
9
|
+
import { getLastUserGoal } from '../utils/session.js';
|
|
9
10
|
import { renderMarkdown, safeNote } from '../utils/markdown.js';
|
|
10
11
|
import { normalizeLanguage } from '../utils/language.js';
|
|
11
12
|
import { createPullRequest } from '../engine/git.js';
|
|
@@ -13,10 +14,12 @@ import { consumeCredit, checkTierAccess, loadAuthConfig, isProOrHigher } from '.
|
|
|
13
14
|
import { handleUndo } from './undo.js';
|
|
14
15
|
import { handleCheckpoint, handleRollback, handleListCheckpoints } from './checkpoint.js';
|
|
15
16
|
import { OperatorHud } from '../engine/computer/operatorHud.js';
|
|
16
|
-
import { SubagentManager } from '../engine/subagents/subagentManager.js';
|
|
17
|
+
import { SubagentManager, parseMentionedRole, isCrossAppIntent } from '../engine/subagents/subagentManager.js';
|
|
17
18
|
import { AgentExecutionLoop, buildDirectoryTree, AGENT_TOOLS } from '../engine/agentEngine.js';
|
|
19
|
+
import { renderTeamSwarmCard, renderCrossAppSwarmCard } from '../utils/claudeUI.js';
|
|
18
20
|
import { verifyAndSelfHealFiles, executeSmartCommand, runProjectVerification } from '../engine/verifier.js';
|
|
19
21
|
import { speakText, listenSpeechToText, cleanTextForSpeech } from '../engine/voiceEngine.js';
|
|
22
|
+
import { handleSupport } from './support.js';
|
|
20
23
|
import { exec } from 'child_process';
|
|
21
24
|
import { promisify } from 'util';
|
|
22
25
|
const execAsync = promisify(exec);
|
|
@@ -192,6 +195,14 @@ export function parseUserPromptIntent(rawGoal, filesList) {
|
|
|
192
195
|
}
|
|
193
196
|
return { cleanGoal: cleaned, intentType: 'question', targetFile, targetFiles };
|
|
194
197
|
}
|
|
198
|
+
/**
|
|
199
|
+
* Detects if user prompt is requesting to redo/repeat the previous task
|
|
200
|
+
* e.g. "redo", "/redo", "redo the task", "retry", "repeat last task", "do it again"
|
|
201
|
+
*/
|
|
202
|
+
export function isRedoIntent(input) {
|
|
203
|
+
const clean = (input || '').trim().toLowerCase().replace(/[.!?]/g, '');
|
|
204
|
+
return /^((\/redo|redo|retry|repeat)(\s+(the|last|previous)?\s*(task|goal|action|command|one)?)?|do\s+it\s+again|run\s+again|try\s+again)$/i.test(clean);
|
|
205
|
+
}
|
|
195
206
|
export function findTargetFilesFromPrompt(userPrompt, specifiedFile, filesList) {
|
|
196
207
|
const norm = (p) => p.replace(/\\/g, '/').toLowerCase().trim();
|
|
197
208
|
if (specifiedFile && specifiedFile.trim()) {
|
|
@@ -388,8 +399,8 @@ ${chalk.cyan('/exit')} - Exit session
|
|
|
388
399
|
const KNOWN_SLASH_COMMANDS = [
|
|
389
400
|
'/help', '/tree', '/status', '/stats', '/test', '/explain',
|
|
390
401
|
'/export', '/save-session', '/diff', '/clear', '/compact',
|
|
391
|
-
'/undo', '/history', '/scan', '/plan', '/tasks', '/resume', '/voice', '/speak',
|
|
392
|
-
'/checkpoint', '/rollback', '/checkpoints', '/hud', '/delegate',
|
|
402
|
+
'/undo', '/redo', '/history', '/scan', '/plan', '/tasks', '/resume', '/voice', '/speak',
|
|
403
|
+
'/checkpoint', '/rollback', '/checkpoints', '/hud', '/delegate', '/support',
|
|
393
404
|
'/exit', '/quit'
|
|
394
405
|
];
|
|
395
406
|
if (trimmedInput.startsWith('/')) {
|
|
@@ -398,6 +409,7 @@ ${chalk.cyan('/exit')} - Exit session
|
|
|
398
409
|
const filterStr = trimmedInput.toLowerCase();
|
|
399
410
|
let availableOptions = [
|
|
400
411
|
{ value: '/help', label: '/help', hint: 'Show agent tools & commands guide' },
|
|
412
|
+
{ value: '/support', label: '/support', hint: 'Submit support tickets, view FAQs & diagnostics' },
|
|
401
413
|
{ value: '/checkpoint', label: '/checkpoint', hint: 'Create snapshot checkpoint of workspace' },
|
|
402
414
|
{ value: '/rollback', label: '/rollback', hint: 'Rewind files to a previous checkpoint' },
|
|
403
415
|
{ value: '/checkpoints', label: '/checkpoints', hint: 'List available time-machine checkpoints' },
|
|
@@ -405,6 +417,7 @@ ${chalk.cyan('/exit')} - Exit session
|
|
|
405
417
|
{ value: '/delegate', label: '/delegate', hint: 'Delegate task to specialist subagent swarm' },
|
|
406
418
|
{ value: '/tasks', label: '/tasks', hint: 'List saved autonomous tasks in .ft/tasks/' },
|
|
407
419
|
{ value: '/resume', label: '/resume', hint: 'Resume saved autonomous task by task ID' },
|
|
420
|
+
{ value: '/redo', label: '/redo', hint: 'Redo the most recent completed user task' },
|
|
408
421
|
{ value: '/voice', label: '/voice', hint: 'Activate microphone STT speech input' },
|
|
409
422
|
{ value: '/speak', label: '/speak', hint: 'Speak text out loud via TTS' },
|
|
410
423
|
{ value: '/tree', label: '/tree', hint: 'Display workspace directory tree' },
|
|
@@ -492,7 +505,7 @@ ${chalk.cyan('/exit')} - Exit session
|
|
|
492
505
|
- **grep_search**: String/regex pattern search across codebase.
|
|
493
506
|
- **glob_search**: Filter workspace files by file pattern.
|
|
494
507
|
- **git_diff**: Retrieve uncommitted workspace git diff.
|
|
495
|
-
- **ask_user**:
|
|
508
|
+
- **ask_user**: Prompt user for input, decisions, preferences, or clarifications.
|
|
496
509
|
- **task_completed**: Conclude task execution with teardown summary.
|
|
497
510
|
|
|
498
511
|
### ā” Pro & Enterprise Exclusive Features
|
|
@@ -503,6 +516,7 @@ ${chalk.cyan('/exit')} - Exit session
|
|
|
503
516
|
|
|
504
517
|
### š Interactive Slash Commands
|
|
505
518
|
- \`/help\`: Show this tools & commands guide.
|
|
519
|
+
- \`/support\`: Open Help & Support Center, raise tickets, view FAQs & diagnostics.
|
|
506
520
|
- \`/checkpoint [label]\`: Create an instant snapshot checkpoint of workspace files.
|
|
507
521
|
- \`/rollback [id]\`: Rewind workspace files to a previous checkpoint.
|
|
508
522
|
- \`/checkpoints\`: List all available time-machine checkpoints.
|
|
@@ -518,29 +532,28 @@ ${chalk.cyan('/exit')} - Exit session
|
|
|
518
532
|
- \`/undo\`: Revert last file modifications.
|
|
519
533
|
- \`/history\`: View recent Scout action logs.
|
|
520
534
|
- \`/plan\`: Generate implementation roadmap.
|
|
521
|
-
- \`/voice\`: Speak goal into microphone (STT).
|
|
522
|
-
- \`/speak <text>\`: Speak text out loud (TTS).
|
|
523
535
|
- \`/exit\`: End Scout Agent session.
|
|
536
|
+
|
|
537
|
+
### š„ Multi-Agent Personas & Grok-Style @Mentions
|
|
538
|
+
- \`@architect <task>\`: System decomposition, modular design, schema & API contracts.
|
|
539
|
+
- \`@coder <task>\`: Surgical implementation, bug fixing, refactoring, and feature builds.
|
|
540
|
+
- \`@tester <task>\`: Test engineering, writing tests, diagnosing failures, regression checks.
|
|
541
|
+
- \`@reviewer <task>\`: Code review, security audits, diff inspection, and anti-patterns.
|
|
542
|
+
- \`@team <task>\` or \`@swarm <task>\`: Coordinated multi-agent relay (Architect ā Coder ā Tester).
|
|
524
543
|
`.trim();
|
|
525
544
|
safeNote(renderMarkdown(helpText), ' Scout Slash Commands & Tools');
|
|
526
545
|
continue;
|
|
527
546
|
}
|
|
528
|
-
if (trimmedInput.toLowerCase().startsWith('/
|
|
529
|
-
|
|
547
|
+
if (trimmedInput.toLowerCase().startsWith('/support')) {
|
|
548
|
+
const parts = trimmedInput.split(/\s+/).slice(1);
|
|
549
|
+
const sub = parts[0]?.toLowerCase();
|
|
550
|
+
await handleSupport({
|
|
551
|
+
new: sub === 'new' || sub === 'create',
|
|
552
|
+
list: sub === 'list',
|
|
553
|
+
open: sub === 'open' || sub === 'web',
|
|
554
|
+
});
|
|
530
555
|
continue;
|
|
531
556
|
}
|
|
532
|
-
if (trimmedInput.toLowerCase() === '/voice') {
|
|
533
|
-
safeNote(chalk.cyan(' Listening to your microphone via browser Web Speech API... Speak your goal clearly!'), ' Scout Voice STT');
|
|
534
|
-
const transcript = await listenSpeechToText();
|
|
535
|
-
if (transcript && transcript.trim()) {
|
|
536
|
-
safeNote(` Voice Received: "${chalk.bold.green(transcript.trim())}"`, ' Scout STT Transcript');
|
|
537
|
-
trimmedInput = transcript.trim();
|
|
538
|
-
}
|
|
539
|
-
else {
|
|
540
|
-
safeNote(chalk.yellow('No speech transcript detected or listener timed out.'), ' Scout Voice STT');
|
|
541
|
-
continue;
|
|
542
|
-
}
|
|
543
|
-
}
|
|
544
557
|
if (trimmedInput.toLowerCase() === '/tasks') {
|
|
545
558
|
const tasks = agentLoop.getStateManager().listSavedTasks();
|
|
546
559
|
if (tasks.length === 0) {
|
|
@@ -552,6 +565,15 @@ ${chalk.cyan('/exit')} - Exit session
|
|
|
552
565
|
}
|
|
553
566
|
continue;
|
|
554
567
|
}
|
|
568
|
+
if (isRedoIntent(trimmedInput)) {
|
|
569
|
+
const lastGoal = getLastUserGoal();
|
|
570
|
+
if (!lastGoal) {
|
|
571
|
+
safeNote(chalk.yellow('No previous user task found in session history to redo.'), ' Redo Task');
|
|
572
|
+
continue;
|
|
573
|
+
}
|
|
574
|
+
safeNote(chalk.bold.cyan(`š Redoing last user task:\n${chalk.white(`"${lastGoal}"`)}`), ' Redo Task');
|
|
575
|
+
trimmedInput = lastGoal;
|
|
576
|
+
}
|
|
555
577
|
if (trimmedInput.toLowerCase().startsWith('/resume')) {
|
|
556
578
|
const parts = trimmedInput.split(/\s+/).slice(1);
|
|
557
579
|
const targetId = parts[0]?.trim();
|
|
@@ -798,6 +820,85 @@ ${history.slice(0, 15).map(h => `- [${h.timestamp}] ${h.command}: ${h.descriptio
|
|
|
798
820
|
`\n*Steps Used: ${res.stepsUsed}*`, res.success ? ' Subagent Swarm Completed' : 'ļø Subagent Error');
|
|
799
821
|
continue;
|
|
800
822
|
}
|
|
823
|
+
// Grok & Strawberry-style @mentions parser (@architect, @coder, @tester, @reviewer, @operator, @researcher, @crossapp, @team)
|
|
824
|
+
const mention = parseMentionedRole(trimmedInput);
|
|
825
|
+
if (mention.isMention && mention.role) {
|
|
826
|
+
const subagentMgr = SubagentManager.getInstance();
|
|
827
|
+
if (mention.role === 'team') {
|
|
828
|
+
if (!mention.task) {
|
|
829
|
+
safeNote(chalk.yellow('Usage: @team <complex task description to execute in swarm relay>'), ' Team Swarm');
|
|
830
|
+
continue;
|
|
831
|
+
}
|
|
832
|
+
const startTime = Date.now();
|
|
833
|
+
const swarmRes = await subagentMgr.runTeamSwarm(mention.task, { tier: userTier });
|
|
834
|
+
const elapsed = Date.now() - startTime;
|
|
835
|
+
renderTeamSwarmCard({
|
|
836
|
+
objective: mention.task,
|
|
837
|
+
architectSummary: swarmRes.architectOutput,
|
|
838
|
+
coderSummary: swarmRes.coderOutput,
|
|
839
|
+
testerSummary: swarmRes.testerOutput,
|
|
840
|
+
modifiedFiles: swarmRes.modifiedFiles,
|
|
841
|
+
totalSteps: swarmRes.totalStepsUsed,
|
|
842
|
+
durationMs: elapsed,
|
|
843
|
+
tier: userTier,
|
|
844
|
+
});
|
|
845
|
+
continue;
|
|
846
|
+
}
|
|
847
|
+
else if (mention.role === 'crossapp') {
|
|
848
|
+
if (!mention.task) {
|
|
849
|
+
safeNote(chalk.yellow('Usage: @crossapp <cross-app task, e.g. from Chrome to VS Code>'), ' Cross-App Swarm');
|
|
850
|
+
continue;
|
|
851
|
+
}
|
|
852
|
+
const startTime = Date.now();
|
|
853
|
+
const crossRes = await subagentMgr.runCrossAppSwarm(mention.task, { tier: userTier });
|
|
854
|
+
const elapsed = Date.now() - startTime;
|
|
855
|
+
renderCrossAppSwarmCard({
|
|
856
|
+
objective: mention.task,
|
|
857
|
+
sourceApp: crossRes.sourceApp,
|
|
858
|
+
targetApp: crossRes.targetApp,
|
|
859
|
+
researcherSummary: crossRes.researcherOutput,
|
|
860
|
+
operatorSummary: crossRes.operatorOutput,
|
|
861
|
+
verifierSummary: crossRes.verifierOutput,
|
|
862
|
+
modifiedFiles: crossRes.modifiedFiles,
|
|
863
|
+
totalSteps: crossRes.totalStepsUsed,
|
|
864
|
+
durationMs: elapsed,
|
|
865
|
+
tier: userTier,
|
|
866
|
+
});
|
|
867
|
+
continue;
|
|
868
|
+
}
|
|
869
|
+
else {
|
|
870
|
+
if (!mention.task) {
|
|
871
|
+
safeNote(chalk.yellow(`Usage: @${mention.role} <task description>`), ` Specialist @${mention.role}`);
|
|
872
|
+
continue;
|
|
873
|
+
}
|
|
874
|
+
const res = await subagentMgr.delegate({ role: mention.role, task: mention.task, tier: userTier });
|
|
875
|
+
safeNote(`### Specialist [@${res.role.toUpperCase()}] Result\n${res.summary}\n\n` +
|
|
876
|
+
(res.modifiedFiles.length > 0 ? `### Modified Files\n${res.modifiedFiles.map(f => ` ⢠\`${f}\``).join('\n')}\n` : '') +
|
|
877
|
+
`\n*Steps Used: ${res.stepsUsed}*`, res.success ? ` Specialist [@${res.role.toUpperCase()}] Completed` : 'ļø Subagent Error');
|
|
878
|
+
continue;
|
|
879
|
+
}
|
|
880
|
+
}
|
|
881
|
+
// Auto-detect natural cross-app goals in interactive session
|
|
882
|
+
if (!mention.isMention && isCrossAppIntent(trimmedInput)) {
|
|
883
|
+
console.log(chalk.cyan.bold('\nš [Auto-Detected Cross-App Workflow]: Launching Strawberry-style Multi-Agent Relay across apps...'));
|
|
884
|
+
const subagentMgr = SubagentManager.getInstance();
|
|
885
|
+
const startTime = Date.now();
|
|
886
|
+
const crossRes = await subagentMgr.runCrossAppSwarm(trimmedInput, { tier: userTier });
|
|
887
|
+
const elapsed = Date.now() - startTime;
|
|
888
|
+
renderCrossAppSwarmCard({
|
|
889
|
+
objective: trimmedInput,
|
|
890
|
+
sourceApp: crossRes.sourceApp,
|
|
891
|
+
targetApp: crossRes.targetApp,
|
|
892
|
+
researcherSummary: crossRes.researcherOutput,
|
|
893
|
+
operatorSummary: crossRes.operatorOutput,
|
|
894
|
+
verifierSummary: crossRes.verifierOutput,
|
|
895
|
+
modifiedFiles: crossRes.modifiedFiles,
|
|
896
|
+
totalSteps: crossRes.totalStepsUsed,
|
|
897
|
+
durationMs: elapsed,
|
|
898
|
+
tier: userTier,
|
|
899
|
+
});
|
|
900
|
+
continue;
|
|
901
|
+
}
|
|
801
902
|
rawGoal = trimmedInput;
|
|
802
903
|
}
|
|
803
904
|
if (!rawGoal || !rawGoal.trim()) {
|
|
@@ -1126,6 +1227,83 @@ ${filePreviews}
|
|
|
1126
1227
|
}
|
|
1127
1228
|
}
|
|
1128
1229
|
}
|
|
1230
|
+
// Check if user requested to redo/retry last task
|
|
1231
|
+
if (isRedoIntent(finalGoal)) {
|
|
1232
|
+
const lastGoal = getLastUserGoal();
|
|
1233
|
+
if (!lastGoal) {
|
|
1234
|
+
safeNote(chalk.yellow('No previous user task found in session history to redo.'), ' Redo Task');
|
|
1235
|
+
return;
|
|
1236
|
+
}
|
|
1237
|
+
safeNote(chalk.bold.cyan(`š Redoing last user task:\n${chalk.white(`"${lastGoal}"`)}`), ' Redo Task');
|
|
1238
|
+
finalGoal = lastGoal;
|
|
1239
|
+
}
|
|
1240
|
+
// Grok & Strawberry-style @mentions direct execution from CLI argument
|
|
1241
|
+
const directMention = parseMentionedRole(finalGoal);
|
|
1242
|
+
if (directMention.isMention && directMention.role) {
|
|
1243
|
+
const subagentMgr = SubagentManager.getInstance();
|
|
1244
|
+
if (directMention.role === 'team') {
|
|
1245
|
+
const startTime = Date.now();
|
|
1246
|
+
const swarmRes = await subagentMgr.runTeamSwarm(directMention.task, { tier: userTier });
|
|
1247
|
+
const elapsed = Date.now() - startTime;
|
|
1248
|
+
renderTeamSwarmCard({
|
|
1249
|
+
objective: directMention.task,
|
|
1250
|
+
architectSummary: swarmRes.architectOutput,
|
|
1251
|
+
coderSummary: swarmRes.coderOutput,
|
|
1252
|
+
testerSummary: swarmRes.testerOutput,
|
|
1253
|
+
modifiedFiles: swarmRes.modifiedFiles,
|
|
1254
|
+
totalSteps: swarmRes.totalStepsUsed,
|
|
1255
|
+
durationMs: elapsed,
|
|
1256
|
+
tier: userTier,
|
|
1257
|
+
});
|
|
1258
|
+
return;
|
|
1259
|
+
}
|
|
1260
|
+
else if (directMention.role === 'crossapp') {
|
|
1261
|
+
const startTime = Date.now();
|
|
1262
|
+
const crossRes = await subagentMgr.runCrossAppSwarm(directMention.task, { tier: userTier });
|
|
1263
|
+
const elapsed = Date.now() - startTime;
|
|
1264
|
+
renderCrossAppSwarmCard({
|
|
1265
|
+
objective: directMention.task,
|
|
1266
|
+
sourceApp: crossRes.sourceApp,
|
|
1267
|
+
targetApp: crossRes.targetApp,
|
|
1268
|
+
researcherSummary: crossRes.researcherOutput,
|
|
1269
|
+
operatorSummary: crossRes.operatorOutput,
|
|
1270
|
+
verifierSummary: crossRes.verifierOutput,
|
|
1271
|
+
modifiedFiles: crossRes.modifiedFiles,
|
|
1272
|
+
totalSteps: crossRes.totalStepsUsed,
|
|
1273
|
+
durationMs: elapsed,
|
|
1274
|
+
tier: userTier,
|
|
1275
|
+
});
|
|
1276
|
+
return;
|
|
1277
|
+
}
|
|
1278
|
+
else {
|
|
1279
|
+
const res = await subagentMgr.delegate({ role: directMention.role, task: directMention.task, tier: userTier });
|
|
1280
|
+
safeNote(`### Specialist [@${res.role.toUpperCase()}] Result\n${res.summary}\n\n` +
|
|
1281
|
+
(res.modifiedFiles.length > 0 ? `### Modified Files\n${res.modifiedFiles.map(f => ` ⢠\`${f}\``).join('\n')}\n` : '') +
|
|
1282
|
+
`\n*Steps Used: ${res.stepsUsed}*`, res.success ? ` Specialist [@${res.role.toUpperCase()}] Completed` : 'ļø Subagent Error');
|
|
1283
|
+
return;
|
|
1284
|
+
}
|
|
1285
|
+
}
|
|
1286
|
+
// Auto-detect natural cross-app goals in CLI argument
|
|
1287
|
+
if (!directMention.isMention && isCrossAppIntent(finalGoal)) {
|
|
1288
|
+
console.log(chalk.cyan.bold('\nš [Auto-Detected Cross-App Workflow]: Launching Strawberry-style Multi-Agent Relay across apps...'));
|
|
1289
|
+
const subagentMgr = SubagentManager.getInstance();
|
|
1290
|
+
const startTime = Date.now();
|
|
1291
|
+
const crossRes = await subagentMgr.runCrossAppSwarm(finalGoal, { tier: userTier });
|
|
1292
|
+
const elapsed = Date.now() - startTime;
|
|
1293
|
+
renderCrossAppSwarmCard({
|
|
1294
|
+
objective: finalGoal,
|
|
1295
|
+
sourceApp: crossRes.sourceApp,
|
|
1296
|
+
targetApp: crossRes.targetApp,
|
|
1297
|
+
researcherSummary: crossRes.researcherOutput,
|
|
1298
|
+
operatorSummary: crossRes.operatorOutput,
|
|
1299
|
+
verifierSummary: crossRes.verifierOutput,
|
|
1300
|
+
modifiedFiles: crossRes.modifiedFiles,
|
|
1301
|
+
totalSteps: crossRes.totalStepsUsed,
|
|
1302
|
+
durationMs: elapsed,
|
|
1303
|
+
tier: userTier,
|
|
1304
|
+
});
|
|
1305
|
+
return;
|
|
1306
|
+
}
|
|
1129
1307
|
// Standard Agent Goal Execution: Pre-scan & identify target files ONLY if goal is a code modification task
|
|
1130
1308
|
const hasModificationIntent = /\b(fix|edit|modify|update|refactor|patch|change|debug|error|bug|issue|solve|repair)\b/i.test(finalGoal) &&
|
|
1131
1309
|
!/\b(lookup|look\s*up|who|what|why|where|how|explain|describe|tell|status|check|github|mcp|open|launch)\b/i.test(finalGoal);
|
|
@@ -1,2 +1,20 @@
|
|
|
1
|
-
export
|
|
1
|
+
export interface BenchmarkTarget {
|
|
2
|
+
id: string;
|
|
3
|
+
label: string;
|
|
4
|
+
provider: 'NVIDIA' | 'Google' | 'OpenAI' | 'BYOK';
|
|
5
|
+
apiKeyEnv: string;
|
|
6
|
+
}
|
|
7
|
+
export declare const BENCHMARK_MODELS: BenchmarkTarget[];
|
|
8
|
+
export interface BenchmarkResult {
|
|
9
|
+
model: string;
|
|
10
|
+
label: string;
|
|
11
|
+
provider: string;
|
|
12
|
+
configured: boolean;
|
|
13
|
+
latencyMs: number;
|
|
14
|
+
tokens: number;
|
|
15
|
+
tokensPerSec: number;
|
|
16
|
+
status: '200_OK' | 'skipped_no_key' | 'error';
|
|
17
|
+
error?: string;
|
|
18
|
+
}
|
|
19
|
+
export declare function handleBenchmark(): Promise<BenchmarkResult[]>;
|
|
2
20
|
//# sourceMappingURL=benchmark.d.ts.map
|
|
@@ -2,129 +2,152 @@ import fs from 'fs';
|
|
|
2
2
|
import path from 'path';
|
|
3
3
|
import chalk from 'chalk';
|
|
4
4
|
import { spinner } from '@clack/prompts';
|
|
5
|
+
import { getClientForModel } from '../engine/llm.js';
|
|
5
6
|
import { loadAuthConfig } from '../utils/auth.js';
|
|
6
|
-
import { loadContext } from '../utils/config.js';
|
|
7
|
-
import OpenAI from 'openai';
|
|
8
7
|
const FT_DIR = path.join(process.cwd(), '.ft', 'scout');
|
|
9
8
|
const BENCHMARK_DIR = path.join(FT_DIR);
|
|
10
9
|
const BENCHMARK_FILE = path.join(BENCHMARK_DIR, 'benchmark.json');
|
|
11
|
-
const
|
|
12
|
-
{
|
|
13
|
-
{
|
|
14
|
-
{
|
|
15
|
-
{
|
|
10
|
+
export const BENCHMARK_MODELS = [
|
|
11
|
+
{ id: 'nvidia/nemotron-3.5-bolt-e4b', label: 'Nemotron 3.5 Bolt (Primary)', provider: 'NVIDIA', apiKeyEnv: 'NVIDIA_API_KEY' },
|
|
12
|
+
{ id: 'nvidia/nemotron-3.5-lightning-30b-a3b', label: 'Nemotron 3.5 Lightning 30B', provider: 'NVIDIA', apiKeyEnv: 'NVIDIA_API_KEY' },
|
|
13
|
+
{ id: 'nvidia/nemotron-3-ultra-550b-a55b', label: 'Nemotron 3 Ultra 550B', provider: 'NVIDIA', apiKeyEnv: 'NVIDIA_API_KEY' },
|
|
14
|
+
{ id: 'gemini-2.5-flash', label: 'Gemini 2.5 Flash', provider: 'Google', apiKeyEnv: 'GEMINI_API_KEY' },
|
|
15
|
+
{ id: 'gpt-4o-mini', label: 'GPT-4o Mini', provider: 'OpenAI', apiKeyEnv: 'OPENAI_API_KEY' },
|
|
16
16
|
];
|
|
17
|
-
async function
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
async function measureLatency(modelName, apiKey) {
|
|
34
|
-
if (!apiKey) {
|
|
35
|
-
return { tokens: 0, latencyMs: 0 };
|
|
17
|
+
async function measureModelPerformance(target) {
|
|
18
|
+
const auth = loadAuthConfig();
|
|
19
|
+
const hasKey = Boolean(process.env[target.apiKeyEnv] ||
|
|
20
|
+
process.env.NVCF_API_KEY ||
|
|
21
|
+
(auth.byokEnabled && auth.customApiKey));
|
|
22
|
+
if (!hasKey) {
|
|
23
|
+
return {
|
|
24
|
+
model: target.id,
|
|
25
|
+
label: target.label,
|
|
26
|
+
provider: target.provider,
|
|
27
|
+
configured: false,
|
|
28
|
+
latencyMs: 0,
|
|
29
|
+
tokens: 0,
|
|
30
|
+
tokensPerSec: 0,
|
|
31
|
+
status: 'skipped_no_key',
|
|
32
|
+
};
|
|
36
33
|
}
|
|
37
34
|
const startTime = Date.now();
|
|
38
35
|
try {
|
|
39
|
-
const client =
|
|
40
|
-
// Send a minimal completion request to measure latency
|
|
36
|
+
const client = getClientForModel(target.id);
|
|
41
37
|
const completion = await client.chat.completions.create({
|
|
42
|
-
model:
|
|
43
|
-
messages: [{ role: 'user', content: '
|
|
44
|
-
max_tokens:
|
|
45
|
-
temperature: 0,
|
|
38
|
+
model: target.id,
|
|
39
|
+
messages: [{ role: 'user', content: 'Explain recursion in one concise sentence.' }],
|
|
40
|
+
max_tokens: 35,
|
|
41
|
+
temperature: 0.2,
|
|
46
42
|
});
|
|
47
43
|
const latencyMs = Date.now() - startTime;
|
|
48
|
-
|
|
49
|
-
const
|
|
50
|
-
|
|
44
|
+
const msg = completion.choices?.[0]?.message;
|
|
45
|
+
const content = msg?.content || msg?.reasoning_content || '';
|
|
46
|
+
const tokens = completion.usage?.completion_tokens || Math.max(1, Math.round(content.split(/\s+/).length * 1.3));
|
|
47
|
+
const tokensPerSec = latencyMs > 0 ? Math.round(tokens / (latencyMs / 1000)) : 0;
|
|
48
|
+
return {
|
|
49
|
+
model: target.id,
|
|
50
|
+
label: target.label,
|
|
51
|
+
provider: target.provider,
|
|
52
|
+
configured: true,
|
|
53
|
+
latencyMs,
|
|
54
|
+
tokens,
|
|
55
|
+
tokensPerSec,
|
|
56
|
+
status: '200_OK',
|
|
57
|
+
};
|
|
51
58
|
}
|
|
52
|
-
catch (
|
|
53
|
-
|
|
54
|
-
return {
|
|
59
|
+
catch (err) {
|
|
60
|
+
const latencyMs = Date.now() - startTime;
|
|
61
|
+
return {
|
|
62
|
+
model: target.id,
|
|
63
|
+
label: target.label,
|
|
64
|
+
provider: target.provider,
|
|
65
|
+
configured: true,
|
|
66
|
+
latencyMs,
|
|
67
|
+
tokens: 0,
|
|
68
|
+
tokensPerSec: 0,
|
|
69
|
+
status: 'error',
|
|
70
|
+
error: err.message?.slice(0, 80) || 'Unknown error',
|
|
71
|
+
};
|
|
55
72
|
}
|
|
56
73
|
}
|
|
57
74
|
export async function handleBenchmark() {
|
|
58
|
-
const context = loadContext();
|
|
59
|
-
const authConfig = loadAuthConfig();
|
|
60
|
-
// Ensure .ft/scout directory exists
|
|
61
75
|
if (!fs.existsSync(BENCHMARK_DIR)) {
|
|
62
76
|
fs.mkdirSync(BENCHMARK_DIR, { recursive: true });
|
|
63
77
|
}
|
|
64
|
-
|
|
65
|
-
|
|
78
|
+
console.log(chalk.bold.cyan('\nāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā'));
|
|
79
|
+
console.log(chalk.bold.cyan('ā ā” FRONTTERRAIN SCOUT: LLM PERFORMANCE BENCHMARK ā'));
|
|
80
|
+
console.log(chalk.bold.cyan('āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā\n'));
|
|
81
|
+
const bSpinner = spinner();
|
|
82
|
+
bSpinner.start('Benchmarking latency and token throughput across model hierarchy...');
|
|
66
83
|
const results = [];
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
const
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
84
|
+
for (const target of BENCHMARK_MODELS) {
|
|
85
|
+
bSpinner.message(`Pinging ${target.label} [${target.provider}]...`);
|
|
86
|
+
const res = await measureModelPerformance(target);
|
|
87
|
+
results.push(res);
|
|
88
|
+
}
|
|
89
|
+
bSpinner.stop('Benchmark measurements completed.');
|
|
90
|
+
// Render Claude Code-style Rich Table
|
|
91
|
+
console.log();
|
|
92
|
+
const width = 84;
|
|
93
|
+
console.log(chalk.cyan('ā' + 'ā'.repeat(width) + 'ā®'));
|
|
94
|
+
console.log(`${chalk.cyan('ā')} ${chalk.bold.white('MODEL / PROVIDER'.padEnd(32))} ` +
|
|
95
|
+
`${chalk.bold.cyan('LATENCY'.padEnd(12))} ` +
|
|
96
|
+
`${chalk.bold.yellow('SPEED'.padEnd(14))} ` +
|
|
97
|
+
`${chalk.bold.green('STATUS'.padEnd(18))} ${chalk.cyan('ā')}`);
|
|
98
|
+
console.log(chalk.cyan('ā' + 'ā'.repeat(width) + 'ā¤'));
|
|
99
|
+
for (const r of results) {
|
|
100
|
+
const nameCol = chalk.bold(r.label.slice(0, 31).padEnd(32));
|
|
101
|
+
const latencyCol = r.status === '200_OK'
|
|
102
|
+
? chalk.cyan(`${r.latencyMs}ms`.padEnd(12))
|
|
103
|
+
: chalk.dim('ā'.padEnd(12));
|
|
104
|
+
const speedCol = r.status === '200_OK'
|
|
105
|
+
? chalk.yellow(`${r.tokensPerSec} tok/s`.padEnd(14))
|
|
106
|
+
: chalk.dim('ā'.padEnd(14));
|
|
107
|
+
let statusCol = '';
|
|
108
|
+
if (r.status === '200_OK') {
|
|
109
|
+
statusCol = chalk.bold.green('ā 200 OK'.padEnd(18));
|
|
80
110
|
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
latencyMs,
|
|
89
|
-
tokensPerSec,
|
|
90
|
-
status: 'completed',
|
|
91
|
-
});
|
|
111
|
+
else if (r.status === 'skipped_no_key') {
|
|
112
|
+
statusCol = chalk.dim('ā No API Key'.padEnd(18));
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
statusCol = chalk.bold.red('ā Quota/Error'.padEnd(18));
|
|
116
|
+
}
|
|
117
|
+
console.log(`${chalk.cyan('ā')} ${nameCol} ${latencyCol} ${speedCol} ${statusCol} ${chalk.cyan('ā')}`);
|
|
92
118
|
}
|
|
93
|
-
|
|
94
|
-
const
|
|
95
|
-
const
|
|
96
|
-
? Math.round(
|
|
119
|
+
console.log(chalk.cyan('ā' + 'ā'.repeat(width) + 'ā¤'));
|
|
120
|
+
const activeModels = results.filter(r => r.status === '200_OK');
|
|
121
|
+
const avgLatency = activeModels.length > 0
|
|
122
|
+
? Math.round(activeModels.reduce((acc, r) => acc + r.latencyMs, 0) / activeModels.length)
|
|
123
|
+
: 0;
|
|
124
|
+
const avgSpeed = activeModels.length > 0
|
|
125
|
+
? Math.round(activeModels.reduce((acc, r) => acc + r.tokensPerSec, 0) / activeModels.length)
|
|
97
126
|
: 0;
|
|
98
|
-
|
|
99
|
-
const
|
|
100
|
-
chalk.
|
|
101
|
-
''
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
`Status: ${statusColor(r.status)}`,
|
|
110
|
-
'',
|
|
111
|
-
].join(' | ');
|
|
112
|
-
}),
|
|
113
|
-
'',
|
|
114
|
-
chalk.bold.green(`Average Tokens/sec: ${avgTokensPerSec}`),
|
|
115
|
-
'',
|
|
116
|
-
];
|
|
117
|
-
benchmarkSpinner.stop('Benchmark complete.');
|
|
118
|
-
// Output formatted table to terminal
|
|
119
|
-
console.log(tableLines.join('\n'));
|
|
127
|
+
const bestModel = [...activeModels].sort((a, b) => a.latencyMs - b.latencyMs)[0];
|
|
128
|
+
const summaryLine = `┠Active: ${chalk.green(activeModels.length + '/' + results.length)} ⢠` +
|
|
129
|
+
`Avg Latency: ${chalk.cyan(avgLatency + 'ms')} ⢠` +
|
|
130
|
+
`Avg Speed: ${chalk.yellow(avgSpeed + ' tok/s')} ⢠` +
|
|
131
|
+
`Fastest: ${chalk.bold.green(bestModel ? bestModel.label.split(' ')[0] : 'N/A')}`;
|
|
132
|
+
const stripAnsi = (str) => str.replace(/\u001B\[\d+m/g, '');
|
|
133
|
+
const visibleLen = stripAnsi(summaryLine).length;
|
|
134
|
+
const padSpaces = Math.max(0, width - 4 - visibleLen);
|
|
135
|
+
console.log(`${chalk.cyan('ā')} ${summaryLine}${' '.repeat(padSpaces)} ${chalk.cyan('ā')}`);
|
|
136
|
+
console.log(chalk.cyan('ā°' + 'ā'.repeat(width) + 'āÆ'));
|
|
137
|
+
console.log();
|
|
120
138
|
// Save JSON benchmark results
|
|
121
139
|
const benchmarkData = {
|
|
122
140
|
timestamp: new Date().toISOString(),
|
|
123
141
|
models: results,
|
|
124
|
-
|
|
142
|
+
summary: {
|
|
143
|
+
activeCount: activeModels.length,
|
|
144
|
+
averageLatencyMs: avgLatency,
|
|
145
|
+
averageTokensPerSec: avgSpeed,
|
|
146
|
+
fastestModel: bestModel?.model || null,
|
|
147
|
+
},
|
|
125
148
|
};
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
149
|
+
fs.writeFileSync(BENCHMARK_FILE, JSON.stringify(benchmarkData, null, 2), 'utf-8');
|
|
150
|
+
console.log(chalk.dim(`Telemetry benchmark saved to ${BENCHMARK_FILE}`));
|
|
151
|
+
return results;
|
|
129
152
|
}
|
|
130
153
|
//# sourceMappingURL=benchmark.js.map
|