ft-scout 9.5.2 → 9.5.4
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.js +155 -19
- package/bin/src/commands/benchmark.d.ts +19 -1
- package/bin/src/commands/benchmark.js +120 -97
- package/bin/src/engine/agentEngine.js +12 -14
- package/bin/src/engine/runtime/agentRuntime.js +3 -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 +5 -5
- package/bin/src/mcp/client.js +1 -1
- 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/package.json +4 -4
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# scout (FrontTerrain CLI v9.5.
|
|
1
|
+
# scout (FrontTerrain CLI v9.5.4)
|
|
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
|
|
@@ -13,8 +13,9 @@ import { consumeCredit, checkTierAccess, loadAuthConfig, isProOrHigher } from '.
|
|
|
13
13
|
import { handleUndo } from './undo.js';
|
|
14
14
|
import { handleCheckpoint, handleRollback, handleListCheckpoints } from './checkpoint.js';
|
|
15
15
|
import { OperatorHud } from '../engine/computer/operatorHud.js';
|
|
16
|
-
import { SubagentManager } from '../engine/subagents/subagentManager.js';
|
|
16
|
+
import { SubagentManager, parseMentionedRole, isCrossAppIntent } from '../engine/subagents/subagentManager.js';
|
|
17
17
|
import { AgentExecutionLoop, buildDirectoryTree, AGENT_TOOLS } from '../engine/agentEngine.js';
|
|
18
|
+
import { renderTeamSwarmCard, renderCrossAppSwarmCard } from '../utils/claudeUI.js';
|
|
18
19
|
import { verifyAndSelfHealFiles, executeSmartCommand, runProjectVerification } from '../engine/verifier.js';
|
|
19
20
|
import { speakText, listenSpeechToText, cleanTextForSpeech } from '../engine/voiceEngine.js';
|
|
20
21
|
import { exec } from 'child_process';
|
|
@@ -518,29 +519,18 @@ ${chalk.cyan('/exit')} - Exit session
|
|
|
518
519
|
- \`/undo\`: Revert last file modifications.
|
|
519
520
|
- \`/history\`: View recent Scout action logs.
|
|
520
521
|
- \`/plan\`: Generate implementation roadmap.
|
|
521
|
-
- \`/voice\`: Speak goal into microphone (STT).
|
|
522
|
-
- \`/speak <text>\`: Speak text out loud (TTS).
|
|
523
522
|
- \`/exit\`: End Scout Agent session.
|
|
523
|
+
|
|
524
|
+
### 👥 Multi-Agent Personas & Grok-Style @Mentions
|
|
525
|
+
- \`@architect <task>\`: System decomposition, modular design, schema & API contracts.
|
|
526
|
+
- \`@coder <task>\`: Surgical implementation, bug fixing, refactoring, and feature builds.
|
|
527
|
+
- \`@tester <task>\`: Test engineering, writing tests, diagnosing failures, regression checks.
|
|
528
|
+
- \`@reviewer <task>\`: Code review, security audits, diff inspection, and anti-patterns.
|
|
529
|
+
- \`@team <task>\` or \`@swarm <task>\`: Coordinated multi-agent relay (Architect ➔ Coder ➔ Tester).
|
|
524
530
|
`.trim();
|
|
525
531
|
safeNote(renderMarkdown(helpText), ' Scout Slash Commands & Tools');
|
|
526
532
|
continue;
|
|
527
533
|
}
|
|
528
|
-
if (trimmedInput.toLowerCase().startsWith('/speak')) {
|
|
529
|
-
safeNote(chalk.yellow('TTS audio speech synthesis has been removed from Scout. Text output is displayed directly in the terminal.'), ' Scout Voice TTS');
|
|
530
|
-
continue;
|
|
531
|
-
}
|
|
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
534
|
if (trimmedInput.toLowerCase() === '/tasks') {
|
|
545
535
|
const tasks = agentLoop.getStateManager().listSavedTasks();
|
|
546
536
|
if (tasks.length === 0) {
|
|
@@ -798,6 +788,85 @@ ${history.slice(0, 15).map(h => `- [${h.timestamp}] ${h.command}: ${h.descriptio
|
|
|
798
788
|
`\n*Steps Used: ${res.stepsUsed}*`, res.success ? ' Subagent Swarm Completed' : '️ Subagent Error');
|
|
799
789
|
continue;
|
|
800
790
|
}
|
|
791
|
+
// Grok & Strawberry-style @mentions parser (@architect, @coder, @tester, @reviewer, @operator, @researcher, @crossapp, @team)
|
|
792
|
+
const mention = parseMentionedRole(trimmedInput);
|
|
793
|
+
if (mention.isMention && mention.role) {
|
|
794
|
+
const subagentMgr = SubagentManager.getInstance();
|
|
795
|
+
if (mention.role === 'team') {
|
|
796
|
+
if (!mention.task) {
|
|
797
|
+
safeNote(chalk.yellow('Usage: @team <complex task description to execute in swarm relay>'), ' Team Swarm');
|
|
798
|
+
continue;
|
|
799
|
+
}
|
|
800
|
+
const startTime = Date.now();
|
|
801
|
+
const swarmRes = await subagentMgr.runTeamSwarm(mention.task, { tier: userTier });
|
|
802
|
+
const elapsed = Date.now() - startTime;
|
|
803
|
+
renderTeamSwarmCard({
|
|
804
|
+
objective: mention.task,
|
|
805
|
+
architectSummary: swarmRes.architectOutput,
|
|
806
|
+
coderSummary: swarmRes.coderOutput,
|
|
807
|
+
testerSummary: swarmRes.testerOutput,
|
|
808
|
+
modifiedFiles: swarmRes.modifiedFiles,
|
|
809
|
+
totalSteps: swarmRes.totalStepsUsed,
|
|
810
|
+
durationMs: elapsed,
|
|
811
|
+
tier: userTier,
|
|
812
|
+
});
|
|
813
|
+
continue;
|
|
814
|
+
}
|
|
815
|
+
else if (mention.role === 'crossapp') {
|
|
816
|
+
if (!mention.task) {
|
|
817
|
+
safeNote(chalk.yellow('Usage: @crossapp <cross-app task, e.g. from Chrome to VS Code>'), ' Cross-App Swarm');
|
|
818
|
+
continue;
|
|
819
|
+
}
|
|
820
|
+
const startTime = Date.now();
|
|
821
|
+
const crossRes = await subagentMgr.runCrossAppSwarm(mention.task, { tier: userTier });
|
|
822
|
+
const elapsed = Date.now() - startTime;
|
|
823
|
+
renderCrossAppSwarmCard({
|
|
824
|
+
objective: mention.task,
|
|
825
|
+
sourceApp: crossRes.sourceApp,
|
|
826
|
+
targetApp: crossRes.targetApp,
|
|
827
|
+
researcherSummary: crossRes.researcherOutput,
|
|
828
|
+
operatorSummary: crossRes.operatorOutput,
|
|
829
|
+
verifierSummary: crossRes.verifierOutput,
|
|
830
|
+
modifiedFiles: crossRes.modifiedFiles,
|
|
831
|
+
totalSteps: crossRes.totalStepsUsed,
|
|
832
|
+
durationMs: elapsed,
|
|
833
|
+
tier: userTier,
|
|
834
|
+
});
|
|
835
|
+
continue;
|
|
836
|
+
}
|
|
837
|
+
else {
|
|
838
|
+
if (!mention.task) {
|
|
839
|
+
safeNote(chalk.yellow(`Usage: @${mention.role} <task description>`), ` Specialist @${mention.role}`);
|
|
840
|
+
continue;
|
|
841
|
+
}
|
|
842
|
+
const res = await subagentMgr.delegate({ role: mention.role, task: mention.task, tier: userTier });
|
|
843
|
+
safeNote(`### Specialist [@${res.role.toUpperCase()}] Result\n${res.summary}\n\n` +
|
|
844
|
+
(res.modifiedFiles.length > 0 ? `### Modified Files\n${res.modifiedFiles.map(f => ` • \`${f}\``).join('\n')}\n` : '') +
|
|
845
|
+
`\n*Steps Used: ${res.stepsUsed}*`, res.success ? ` Specialist [@${res.role.toUpperCase()}] Completed` : '️ Subagent Error');
|
|
846
|
+
continue;
|
|
847
|
+
}
|
|
848
|
+
}
|
|
849
|
+
// Auto-detect natural cross-app goals in interactive session
|
|
850
|
+
if (!mention.isMention && isCrossAppIntent(trimmedInput)) {
|
|
851
|
+
console.log(chalk.cyan.bold('\n🌐 [Auto-Detected Cross-App Workflow]: Launching Strawberry-style Multi-Agent Relay across apps...'));
|
|
852
|
+
const subagentMgr = SubagentManager.getInstance();
|
|
853
|
+
const startTime = Date.now();
|
|
854
|
+
const crossRes = await subagentMgr.runCrossAppSwarm(trimmedInput, { tier: userTier });
|
|
855
|
+
const elapsed = Date.now() - startTime;
|
|
856
|
+
renderCrossAppSwarmCard({
|
|
857
|
+
objective: trimmedInput,
|
|
858
|
+
sourceApp: crossRes.sourceApp,
|
|
859
|
+
targetApp: crossRes.targetApp,
|
|
860
|
+
researcherSummary: crossRes.researcherOutput,
|
|
861
|
+
operatorSummary: crossRes.operatorOutput,
|
|
862
|
+
verifierSummary: crossRes.verifierOutput,
|
|
863
|
+
modifiedFiles: crossRes.modifiedFiles,
|
|
864
|
+
totalSteps: crossRes.totalStepsUsed,
|
|
865
|
+
durationMs: elapsed,
|
|
866
|
+
tier: userTier,
|
|
867
|
+
});
|
|
868
|
+
continue;
|
|
869
|
+
}
|
|
801
870
|
rawGoal = trimmedInput;
|
|
802
871
|
}
|
|
803
872
|
if (!rawGoal || !rawGoal.trim()) {
|
|
@@ -1126,6 +1195,73 @@ ${filePreviews}
|
|
|
1126
1195
|
}
|
|
1127
1196
|
}
|
|
1128
1197
|
}
|
|
1198
|
+
// Grok & Strawberry-style @mentions direct execution from CLI argument
|
|
1199
|
+
const directMention = parseMentionedRole(finalGoal);
|
|
1200
|
+
if (directMention.isMention && directMention.role) {
|
|
1201
|
+
const subagentMgr = SubagentManager.getInstance();
|
|
1202
|
+
if (directMention.role === 'team') {
|
|
1203
|
+
const startTime = Date.now();
|
|
1204
|
+
const swarmRes = await subagentMgr.runTeamSwarm(directMention.task, { tier: userTier });
|
|
1205
|
+
const elapsed = Date.now() - startTime;
|
|
1206
|
+
renderTeamSwarmCard({
|
|
1207
|
+
objective: directMention.task,
|
|
1208
|
+
architectSummary: swarmRes.architectOutput,
|
|
1209
|
+
coderSummary: swarmRes.coderOutput,
|
|
1210
|
+
testerSummary: swarmRes.testerOutput,
|
|
1211
|
+
modifiedFiles: swarmRes.modifiedFiles,
|
|
1212
|
+
totalSteps: swarmRes.totalStepsUsed,
|
|
1213
|
+
durationMs: elapsed,
|
|
1214
|
+
tier: userTier,
|
|
1215
|
+
});
|
|
1216
|
+
return;
|
|
1217
|
+
}
|
|
1218
|
+
else if (directMention.role === 'crossapp') {
|
|
1219
|
+
const startTime = Date.now();
|
|
1220
|
+
const crossRes = await subagentMgr.runCrossAppSwarm(directMention.task, { tier: userTier });
|
|
1221
|
+
const elapsed = Date.now() - startTime;
|
|
1222
|
+
renderCrossAppSwarmCard({
|
|
1223
|
+
objective: directMention.task,
|
|
1224
|
+
sourceApp: crossRes.sourceApp,
|
|
1225
|
+
targetApp: crossRes.targetApp,
|
|
1226
|
+
researcherSummary: crossRes.researcherOutput,
|
|
1227
|
+
operatorSummary: crossRes.operatorOutput,
|
|
1228
|
+
verifierSummary: crossRes.verifierOutput,
|
|
1229
|
+
modifiedFiles: crossRes.modifiedFiles,
|
|
1230
|
+
totalSteps: crossRes.totalStepsUsed,
|
|
1231
|
+
durationMs: elapsed,
|
|
1232
|
+
tier: userTier,
|
|
1233
|
+
});
|
|
1234
|
+
return;
|
|
1235
|
+
}
|
|
1236
|
+
else {
|
|
1237
|
+
const res = await subagentMgr.delegate({ role: directMention.role, task: directMention.task, tier: userTier });
|
|
1238
|
+
safeNote(`### Specialist [@${res.role.toUpperCase()}] Result\n${res.summary}\n\n` +
|
|
1239
|
+
(res.modifiedFiles.length > 0 ? `### Modified Files\n${res.modifiedFiles.map(f => ` • \`${f}\``).join('\n')}\n` : '') +
|
|
1240
|
+
`\n*Steps Used: ${res.stepsUsed}*`, res.success ? ` Specialist [@${res.role.toUpperCase()}] Completed` : '️ Subagent Error');
|
|
1241
|
+
return;
|
|
1242
|
+
}
|
|
1243
|
+
}
|
|
1244
|
+
// Auto-detect natural cross-app goals in CLI argument
|
|
1245
|
+
if (!directMention.isMention && isCrossAppIntent(finalGoal)) {
|
|
1246
|
+
console.log(chalk.cyan.bold('\n🌐 [Auto-Detected Cross-App Workflow]: Launching Strawberry-style Multi-Agent Relay across apps...'));
|
|
1247
|
+
const subagentMgr = SubagentManager.getInstance();
|
|
1248
|
+
const startTime = Date.now();
|
|
1249
|
+
const crossRes = await subagentMgr.runCrossAppSwarm(finalGoal, { tier: userTier });
|
|
1250
|
+
const elapsed = Date.now() - startTime;
|
|
1251
|
+
renderCrossAppSwarmCard({
|
|
1252
|
+
objective: finalGoal,
|
|
1253
|
+
sourceApp: crossRes.sourceApp,
|
|
1254
|
+
targetApp: crossRes.targetApp,
|
|
1255
|
+
researcherSummary: crossRes.researcherOutput,
|
|
1256
|
+
operatorSummary: crossRes.operatorOutput,
|
|
1257
|
+
verifierSummary: crossRes.verifierOutput,
|
|
1258
|
+
modifiedFiles: crossRes.modifiedFiles,
|
|
1259
|
+
totalSteps: crossRes.totalStepsUsed,
|
|
1260
|
+
durationMs: elapsed,
|
|
1261
|
+
tier: userTier,
|
|
1262
|
+
});
|
|
1263
|
+
return;
|
|
1264
|
+
}
|
|
1129
1265
|
// Standard Agent Goal Execution: Pre-scan & identify target files ONLY if goal is a code modification task
|
|
1130
1266
|
const hasModificationIntent = /\b(fix|edit|modify|update|refactor|patch|change|debug|error|bug|issue|solve|repair)\b/i.test(finalGoal) &&
|
|
1131
1267
|
!/\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
|
|
@@ -299,14 +299,14 @@ export const AGENT_TOOLS = [
|
|
|
299
299
|
},
|
|
300
300
|
{
|
|
301
301
|
name: 'delegate_subtask',
|
|
302
|
-
description: 'Delegate a specialized subtask to an autonomous specialist subagent (architect, coder, tester, reviewer, general). Useful for delegating code reviews, test generation, architectural breakdowns, or isolated module implementations to an autonomous worker agent.',
|
|
302
|
+
description: 'Delegate a specialized subtask to an autonomous specialist subagent (architect, coder, tester, reviewer, operator, researcher, general). Useful for delegating web research, desktop app automation, code reviews, test generation, architectural breakdowns, or isolated module implementations to an autonomous worker agent.',
|
|
303
303
|
parameters: {
|
|
304
304
|
type: 'object',
|
|
305
305
|
properties: {
|
|
306
306
|
role: {
|
|
307
307
|
type: 'string',
|
|
308
|
-
enum: ['architect', 'coder', 'tester', 'reviewer', 'general'],
|
|
309
|
-
description: 'Specialist role for the subagent (architect, coder, tester, reviewer, general)',
|
|
308
|
+
enum: ['architect', 'coder', 'tester', 'reviewer', 'operator', 'researcher', 'general'],
|
|
309
|
+
description: 'Specialist role for the subagent (architect, coder, tester, reviewer, operator, researcher, general)',
|
|
310
310
|
},
|
|
311
311
|
task: {
|
|
312
312
|
type: 'string',
|
|
@@ -625,12 +625,10 @@ Task Execution Intent & Constraints:
|
|
|
625
625
|
const isPaid = this.isPaidTier();
|
|
626
626
|
const tierDirective = isPaid ? `
|
|
627
627
|
PLAN TIER & CAPABILITIES: ${this.userTier.toUpperCase()} (FULL ACCESS UNLOCKED)
|
|
628
|
-
• Unlimited autonomous multi-step loops with no step limits.
|
|
629
628
|
• Autonomous Computer-Use, Browser Automation, and AI Scratchpad Reasoning are fully ENABLED.
|
|
630
629
|
• Use the 'scratchpad' tool to organize multi-step reasoning, break down complex goals, draft hypotheses, and track working memory across turns.
|
|
631
630
|
` : `
|
|
632
|
-
PLAN TIER & CAPABILITIES: DEVELOPER FREE (
|
|
633
|
-
• Unlimited execution steps: Take as many iterative steps as needed to solve, test, and verify the task thoroughly.
|
|
631
|
+
PLAN TIER & CAPABILITIES: DEVELOPER FREE (CORE CODING & WORKSPACE OPS)
|
|
634
632
|
• Developer operations enabled: Code editing, file/directory creation, running terminal commands/tests, syntax verification, reading, and exploration.
|
|
635
633
|
• Work systematically: Inspect the code, run relevant builds/tests, verify syntax, and ensure high code quality before completing.
|
|
636
634
|
`;
|
|
@@ -926,12 +924,7 @@ When returning tool calls, use standard OpenAI function calling format or JSON t
|
|
|
926
924
|
userTier: this.userTier,
|
|
927
925
|
});
|
|
928
926
|
const stepSpinner = spinner();
|
|
929
|
-
|
|
930
|
-
stepSpinner.start(chalk.cyan(`Scout is Working (Step ${step})`));
|
|
931
|
-
}
|
|
932
|
-
else {
|
|
933
|
-
stepSpinner.start(chalk.cyan(`Scout is Working (Step ${step}/${this.maxSteps})`));
|
|
934
|
-
}
|
|
927
|
+
stepSpinner.start(chalk.cyan(`Scout is Working (Step ${step})`));
|
|
935
928
|
try {
|
|
936
929
|
let response;
|
|
937
930
|
const mcpRouting = getMCPManager().routeTools(userGoal);
|
|
@@ -1303,8 +1296,8 @@ You MUST output exactly ONE JSON code block per tool call. Do NOT describe what
|
|
|
1303
1296
|
return {
|
|
1304
1297
|
success: false,
|
|
1305
1298
|
summary: Number.isFinite(this.maxSteps)
|
|
1306
|
-
? `Reached
|
|
1307
|
-
: `Task ended after ${step}
|
|
1299
|
+
? `Reached step limit (${this.maxSteps}). Modified files: ${Array.from(this.modifiedFiles).join(', ')}`
|
|
1300
|
+
: `Task ended after ${step} steps. Modified files: ${Array.from(this.modifiedFiles).join(', ')}`,
|
|
1308
1301
|
};
|
|
1309
1302
|
}
|
|
1310
1303
|
finally {
|
|
@@ -1983,6 +1976,11 @@ You MUST output exactly ONE JSON code block per tool call. Do NOT describe what
|
|
|
1983
1976
|
}
|
|
1984
1977
|
case 'ask_user': {
|
|
1985
1978
|
const questionText = String(args.question || args.prompt || 'Please provide input:').trim();
|
|
1979
|
+
if (this.autoApprove) {
|
|
1980
|
+
return {
|
|
1981
|
+
result: `[Auto-Approved Mode Active]: User prompt bypassed ("${questionText}"). Inspect local workspace files (read_file, glob_search, list_dir) and proceed autonomously.`
|
|
1982
|
+
};
|
|
1983
|
+
}
|
|
1986
1984
|
const askSpin = spinner();
|
|
1987
1985
|
askSpin.stop();
|
|
1988
1986
|
safeNote(questionText, ' Scout Agent Question for User');
|
|
@@ -296,10 +296,7 @@ Action Rules:
|
|
|
296
296
|
userTier: this.userTier,
|
|
297
297
|
});
|
|
298
298
|
const stepSpinner = spinner();
|
|
299
|
-
|
|
300
|
-
? `Scout Operating (Step ${step})`
|
|
301
|
-
: `Scout Operating (Step ${step}/${this.maxSteps})`;
|
|
302
|
-
stepSpinner.start(chalk.cyan(stepText));
|
|
299
|
+
stepSpinner.start(chalk.cyan(`Scout Operating (Step ${step})`));
|
|
303
300
|
try {
|
|
304
301
|
let response;
|
|
305
302
|
const mcpRouting = getMCPManager().routeTools(userGoal);
|
|
@@ -569,8 +566,8 @@ Action Rules:
|
|
|
569
566
|
return {
|
|
570
567
|
success: false,
|
|
571
568
|
summary: Number.isFinite(this.maxSteps)
|
|
572
|
-
? `Reached
|
|
573
|
-
: `Task ended after ${step}
|
|
569
|
+
? `Reached step limit (${this.maxSteps}). Modified files: ${Array.from(this.modifiedFiles).join(', ')}`
|
|
570
|
+
: `Task ended after ${step} steps. Modified files: ${Array.from(this.modifiedFiles).join(', ')}`,
|
|
574
571
|
taskId,
|
|
575
572
|
stepsTaken: step,
|
|
576
573
|
modifiedFiles: Array.from(this.modifiedFiles),
|