ft-scout 9.5.4 → 9.5.6
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 +1 -1
- package/bin/src/commands/agent.d.ts +5 -0
- package/bin/src/commands/agent.js +45 -3
- package/bin/src/commands/support.d.ts +9 -0
- package/bin/src/commands/support.js +227 -0
- package/bin/src/engine/agent/computerUseLoop.d.ts +107 -0
- package/bin/src/engine/agent/computerUseLoop.js +413 -0
- package/bin/src/engine/agent/index.d.ts +2 -0
- package/bin/src/engine/agent/index.js +2 -0
- package/bin/src/engine/agent/recovery/index.d.ts +4 -0
- package/bin/src/engine/agent/recovery/index.js +4 -0
- package/bin/src/engine/agent/recovery/loopDetector.d.ts +26 -0
- package/bin/src/engine/agent/recovery/loopDetector.js +126 -0
- package/bin/src/engine/agent/recovery/recoveryManager.d.ts +43 -0
- package/bin/src/engine/agent/recovery/recoveryManager.js +271 -0
- package/bin/src/engine/agent/recovery/types.d.ts +48 -0
- package/bin/src/engine/agent/recovery/types.js +4 -0
- package/bin/src/engine/agent/verification/index.d.ts +3 -0
- package/bin/src/engine/agent/verification/index.js +3 -0
- package/bin/src/engine/agent/verification/stateChangeVerifier.d.ts +22 -0
- package/bin/src/engine/agent/verification/stateChangeVerifier.js +282 -0
- package/bin/src/engine/agent/verification/types.d.ts +28 -0
- package/bin/src/engine/agent/verification/types.js +4 -0
- package/bin/src/engine/agentEngine.d.ts +2 -1
- package/bin/src/engine/agentEngine.js +98 -7
- package/bin/src/engine/agentState.d.ts +41 -1
- package/bin/src/engine/agentState.js +45 -0
- package/bin/src/engine/browser/actions/actionEngine.d.ts +41 -0
- package/bin/src/engine/browser/actions/actionEngine.js +707 -0
- package/bin/src/engine/browser/actions/index.d.ts +4 -0
- package/bin/src/engine/browser/actions/index.js +4 -0
- package/bin/src/engine/browser/actions/reliability.d.ts +41 -0
- package/bin/src/engine/browser/actions/reliability.js +170 -0
- package/bin/src/engine/browser/actions/types.d.ts +50 -0
- package/bin/src/engine/browser/actions/types.js +2 -0
- package/bin/src/engine/browser/browserController.d.ts +18 -0
- package/bin/src/engine/browser/browserController.js +44 -12
- package/bin/src/engine/browser/index.d.ts +2 -0
- package/bin/src/engine/browser/index.js +2 -0
- package/bin/src/engine/browser/observer/accessibilityTree.d.ts +14 -0
- package/bin/src/engine/browser/observer/accessibilityTree.js +214 -0
- package/bin/src/engine/browser/observer/browserObserver.d.ts +29 -0
- package/bin/src/engine/browser/observer/browserObserver.js +204 -0
- package/bin/src/engine/browser/observer/domExtractor.d.ts +30 -0
- package/bin/src/engine/browser/observer/domExtractor.js +407 -0
- package/bin/src/engine/browser/observer/index.d.ts +5 -0
- package/bin/src/engine/browser/observer/index.js +5 -0
- package/bin/src/engine/browser/observer/types.d.ts +163 -0
- package/bin/src/engine/browser/observer/types.js +8 -0
- package/bin/src/engine/computer/computerController.d.ts +49 -0
- package/bin/src/engine/computer/computerController.js +249 -104
- package/bin/src/engine/computer/mockComputer.d.ts +6 -1
- package/bin/src/engine/computer/mockComputer.js +58 -0
- package/bin/src/engine/computer/scoutDriver.cs +84 -2
- package/bin/src/engine/llm.js +16 -0
- package/bin/src/engine/models/harpProvider.d.ts +32 -0
- package/bin/src/engine/models/harpProvider.js +124 -0
- package/bin/src/engine/models/index.d.ts +6 -0
- package/bin/src/engine/models/index.js +6 -0
- package/bin/src/engine/models/localModelProvider.d.ts +11 -0
- package/bin/src/engine/models/localModelProvider.js +48 -0
- package/bin/src/engine/models/openaiProvider.d.ts +11 -0
- package/bin/src/engine/models/openaiProvider.js +50 -0
- package/bin/src/engine/models/reasoningOrchestrator.d.ts +17 -0
- package/bin/src/engine/models/reasoningOrchestrator.js +75 -0
- package/bin/src/engine/models/types.d.ts +63 -0
- package/bin/src/engine/models/types.js +2 -0
- package/bin/src/engine/planner.js +64 -34
- package/bin/src/engine/production/index.d.ts +3 -0
- package/bin/src/engine/production/index.js +3 -0
- package/bin/src/engine/production/taskReplay.d.ts +37 -0
- package/bin/src/engine/production/taskReplay.js +81 -0
- package/bin/src/engine/production/telemetry.d.ts +43 -0
- package/bin/src/engine/production/telemetry.js +68 -0
- package/bin/src/engine/runtime/agentRuntime.d.ts +1 -1
- package/bin/src/engine/runtime/agentRuntime.js +99 -0
- package/bin/src/engine/safety/index.d.ts +3 -0
- package/bin/src/engine/safety/index.js +3 -0
- package/bin/src/engine/safety/policyEngine.d.ts +40 -0
- package/bin/src/engine/safety/policyEngine.js +282 -0
- package/bin/src/engine/safety/types.d.ts +24 -0
- package/bin/src/engine/safety/types.js +2 -0
- package/bin/src/engine/safety.d.ts +1 -0
- package/bin/src/engine/safety.js +1 -0
- package/bin/src/engine/subagents/subagentManager.js +2 -2
- package/bin/src/engine/toolRegistry.d.ts +4 -0
- package/bin/src/engine/toolRegistry.js +9 -0
- package/bin/src/engine/tools/domainHandlers.d.ts +61 -0
- package/bin/src/engine/tools/domainHandlers.js +458 -0
- package/bin/src/engine/tools/index.d.ts +4 -0
- package/bin/src/engine/tools/index.js +4 -0
- package/bin/src/engine/tools/types.d.ts +56 -0
- package/bin/src/engine/tools/types.js +2 -0
- package/bin/src/engine/tools/unifiedRouter.d.ts +29 -0
- package/bin/src/engine/tools/unifiedRouter.js +426 -0
- package/bin/src/index.js +26 -6
- 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/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 +2 -2
package/README.md
CHANGED
|
@@ -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';
|
|
@@ -18,6 +19,7 @@ import { AgentExecutionLoop, buildDirectoryTree, AGENT_TOOLS } from '../engine/a
|
|
|
18
19
|
import { renderTeamSwarmCard, renderCrossAppSwarmCard } from '../utils/claudeUI.js';
|
|
19
20
|
import { verifyAndSelfHealFiles, executeSmartCommand, runProjectVerification } from '../engine/verifier.js';
|
|
20
21
|
import { speakText, listenSpeechToText, cleanTextForSpeech } from '../engine/voiceEngine.js';
|
|
22
|
+
import { handleSupport } from './support.js';
|
|
21
23
|
import { exec } from 'child_process';
|
|
22
24
|
import { promisify } from 'util';
|
|
23
25
|
const execAsync = promisify(exec);
|
|
@@ -193,6 +195,14 @@ export function parseUserPromptIntent(rawGoal, filesList) {
|
|
|
193
195
|
}
|
|
194
196
|
return { cleanGoal: cleaned, intentType: 'question', targetFile, targetFiles };
|
|
195
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
|
+
}
|
|
196
206
|
export function findTargetFilesFromPrompt(userPrompt, specifiedFile, filesList) {
|
|
197
207
|
const norm = (p) => p.replace(/\\/g, '/').toLowerCase().trim();
|
|
198
208
|
if (specifiedFile && specifiedFile.trim()) {
|
|
@@ -389,8 +399,8 @@ ${chalk.cyan('/exit')} - Exit session
|
|
|
389
399
|
const KNOWN_SLASH_COMMANDS = [
|
|
390
400
|
'/help', '/tree', '/status', '/stats', '/test', '/explain',
|
|
391
401
|
'/export', '/save-session', '/diff', '/clear', '/compact',
|
|
392
|
-
'/undo', '/history', '/scan', '/plan', '/tasks', '/resume', '/voice', '/speak',
|
|
393
|
-
'/checkpoint', '/rollback', '/checkpoints', '/hud', '/delegate',
|
|
402
|
+
'/undo', '/redo', '/history', '/scan', '/plan', '/tasks', '/resume', '/voice', '/speak',
|
|
403
|
+
'/checkpoint', '/rollback', '/checkpoints', '/hud', '/delegate', '/support',
|
|
394
404
|
'/exit', '/quit'
|
|
395
405
|
];
|
|
396
406
|
if (trimmedInput.startsWith('/')) {
|
|
@@ -399,6 +409,7 @@ ${chalk.cyan('/exit')} - Exit session
|
|
|
399
409
|
const filterStr = trimmedInput.toLowerCase();
|
|
400
410
|
let availableOptions = [
|
|
401
411
|
{ value: '/help', label: '/help', hint: 'Show agent tools & commands guide' },
|
|
412
|
+
{ value: '/support', label: '/support', hint: 'Submit support tickets, view FAQs & diagnostics' },
|
|
402
413
|
{ value: '/checkpoint', label: '/checkpoint', hint: 'Create snapshot checkpoint of workspace' },
|
|
403
414
|
{ value: '/rollback', label: '/rollback', hint: 'Rewind files to a previous checkpoint' },
|
|
404
415
|
{ value: '/checkpoints', label: '/checkpoints', hint: 'List available time-machine checkpoints' },
|
|
@@ -406,6 +417,7 @@ ${chalk.cyan('/exit')} - Exit session
|
|
|
406
417
|
{ value: '/delegate', label: '/delegate', hint: 'Delegate task to specialist subagent swarm' },
|
|
407
418
|
{ value: '/tasks', label: '/tasks', hint: 'List saved autonomous tasks in .ft/tasks/' },
|
|
408
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' },
|
|
409
421
|
{ value: '/voice', label: '/voice', hint: 'Activate microphone STT speech input' },
|
|
410
422
|
{ value: '/speak', label: '/speak', hint: 'Speak text out loud via TTS' },
|
|
411
423
|
{ value: '/tree', label: '/tree', hint: 'Display workspace directory tree' },
|
|
@@ -493,7 +505,7 @@ ${chalk.cyan('/exit')} - Exit session
|
|
|
493
505
|
- **grep_search**: String/regex pattern search across codebase.
|
|
494
506
|
- **glob_search**: Filter workspace files by file pattern.
|
|
495
507
|
- **git_diff**: Retrieve uncommitted workspace git diff.
|
|
496
|
-
- **ask_user**:
|
|
508
|
+
- **ask_user**: Prompt user for input, decisions, preferences, or clarifications.
|
|
497
509
|
- **task_completed**: Conclude task execution with teardown summary.
|
|
498
510
|
|
|
499
511
|
### ⚡ Pro & Enterprise Exclusive Features
|
|
@@ -504,6 +516,7 @@ ${chalk.cyan('/exit')} - Exit session
|
|
|
504
516
|
|
|
505
517
|
### 🚀 Interactive Slash Commands
|
|
506
518
|
- \`/help\`: Show this tools & commands guide.
|
|
519
|
+
- \`/support\`: Open Help & Support Center, raise tickets, view FAQs & diagnostics.
|
|
507
520
|
- \`/checkpoint [label]\`: Create an instant snapshot checkpoint of workspace files.
|
|
508
521
|
- \`/rollback [id]\`: Rewind workspace files to a previous checkpoint.
|
|
509
522
|
- \`/checkpoints\`: List all available time-machine checkpoints.
|
|
@@ -531,6 +544,16 @@ ${chalk.cyan('/exit')} - Exit session
|
|
|
531
544
|
safeNote(renderMarkdown(helpText), ' Scout Slash Commands & Tools');
|
|
532
545
|
continue;
|
|
533
546
|
}
|
|
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
|
+
});
|
|
555
|
+
continue;
|
|
556
|
+
}
|
|
534
557
|
if (trimmedInput.toLowerCase() === '/tasks') {
|
|
535
558
|
const tasks = agentLoop.getStateManager().listSavedTasks();
|
|
536
559
|
if (tasks.length === 0) {
|
|
@@ -542,6 +565,15 @@ ${chalk.cyan('/exit')} - Exit session
|
|
|
542
565
|
}
|
|
543
566
|
continue;
|
|
544
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
|
+
}
|
|
545
577
|
if (trimmedInput.toLowerCase().startsWith('/resume')) {
|
|
546
578
|
const parts = trimmedInput.split(/\s+/).slice(1);
|
|
547
579
|
const targetId = parts[0]?.trim();
|
|
@@ -1195,6 +1227,16 @@ ${filePreviews}
|
|
|
1195
1227
|
}
|
|
1196
1228
|
}
|
|
1197
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
|
+
}
|
|
1198
1240
|
// Grok & Strawberry-style @mentions direct execution from CLI argument
|
|
1199
1241
|
const directMention = parseMentionedRole(finalGoal);
|
|
1200
1242
|
if (directMention.isMention && directMention.role) {
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
import { intro, outro, text, select, confirm, isCancel, spinner } from '@clack/prompts';
|
|
3
|
+
import { exec } from 'child_process';
|
|
4
|
+
import { promisify } from 'util';
|
|
5
|
+
import { loadAuthConfig } from '../utils/auth.js';
|
|
6
|
+
import { safeNote, renderMarkdown } from '../utils/markdown.js';
|
|
7
|
+
import { loadSupportTickets, createSupportTicket, getPresetFaqs, collectSanitizedDiagnostics, } from '../utils/support.js';
|
|
8
|
+
import { startDashboardServer } from '../server/server.js';
|
|
9
|
+
const execAsync = promisify(exec);
|
|
10
|
+
export async function handleSupport(options) {
|
|
11
|
+
const authCfg = loadAuthConfig();
|
|
12
|
+
const defaultEmail = authCfg.user?.email || '';
|
|
13
|
+
// Direct flag: --open (Open Web Dashboard)
|
|
14
|
+
if (options?.open) {
|
|
15
|
+
await openSupportInBrowser();
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
// Direct flag: --list (List Tickets)
|
|
19
|
+
if (options?.list) {
|
|
20
|
+
displayTicketsList();
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
// Direct flag: --new (Raise New Ticket)
|
|
24
|
+
if (options?.new) {
|
|
25
|
+
await promptCreateTicket(defaultEmail);
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
// Direct flag: --faq (Show FAQs)
|
|
29
|
+
if (options?.faq) {
|
|
30
|
+
displayFaqs();
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
// Direct flag: --diagnostics (Show Diagnostics)
|
|
34
|
+
if (options?.diagnostics) {
|
|
35
|
+
displayDiagnostics();
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
// Interactive menu when no flags provided
|
|
39
|
+
intro(chalk.bold.cyan(' FrontTerrain Scout - Help & Support Center'));
|
|
40
|
+
const action = await select({
|
|
41
|
+
message: 'How can we assist you today?',
|
|
42
|
+
options: [
|
|
43
|
+
{ value: 'new', label: '🎫 Raise a New Support Ticket', hint: 'Submit bug, request feature, or ask for help' },
|
|
44
|
+
{ value: 'list', label: '📋 View My Open Tickets', hint: 'Check status and replies on raised tickets' },
|
|
45
|
+
{ value: 'web', label: '🌐 Open Web Support Dashboard', hint: 'Interactive tickets UI, FAQs & diagnostics in browser' },
|
|
46
|
+
{ value: 'faq', label: '💡 Browse Quick FAQs', hint: 'Common questions on quotas, desktop tools & MCP' },
|
|
47
|
+
{ value: 'diagnostics', label: '🔍 View System Diagnostics', hint: 'Check environment, model, tier & scout version' },
|
|
48
|
+
],
|
|
49
|
+
});
|
|
50
|
+
if (isCancel(action)) {
|
|
51
|
+
outro(chalk.yellow('Support session closed. Run `scout support` anytime!'));
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
switch (action) {
|
|
55
|
+
case 'new':
|
|
56
|
+
await promptCreateTicket(defaultEmail);
|
|
57
|
+
break;
|
|
58
|
+
case 'list':
|
|
59
|
+
displayTicketsList();
|
|
60
|
+
break;
|
|
61
|
+
case 'web':
|
|
62
|
+
await openSupportInBrowser();
|
|
63
|
+
break;
|
|
64
|
+
case 'faq':
|
|
65
|
+
displayFaqs();
|
|
66
|
+
break;
|
|
67
|
+
case 'diagnostics':
|
|
68
|
+
displayDiagnostics();
|
|
69
|
+
break;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
async function promptCreateTicket(defaultEmail) {
|
|
73
|
+
const subject = await text({
|
|
74
|
+
message: 'Ticket Subject / Summary:',
|
|
75
|
+
placeholder: 'e.g. Issue launching VS Code with computer tools',
|
|
76
|
+
validate: (val) => (!val || !val.trim() ? 'Subject is required.' : undefined),
|
|
77
|
+
});
|
|
78
|
+
if (isCancel(subject))
|
|
79
|
+
return;
|
|
80
|
+
const category = await select({
|
|
81
|
+
message: 'Select Category:',
|
|
82
|
+
options: [
|
|
83
|
+
{ value: 'agent_automation', label: '🤖 Agent & Computer Automation', hint: 'CLI steps, app launching, file edits' },
|
|
84
|
+
{ value: 'billing_quota', label: '💳 Billing, Credits & BYOK', hint: 'Subscription upgrades, PayPal/Razorpay, quotas' },
|
|
85
|
+
{ value: 'cli_crash', label: '⚡ CLI Error or Crash', hint: 'Terminal exceptions, command failures' },
|
|
86
|
+
{ value: 'mcp_integration', label: '🔌 MCP Tools & Servers', hint: 'Connecting servers, stdio/http tools' },
|
|
87
|
+
{ value: 'feature_request', label: '✨ Feature Suggestion', hint: 'Ideas to make Scout co-pilot better' },
|
|
88
|
+
{ value: 'other', label: '❓ General Question / Other' },
|
|
89
|
+
],
|
|
90
|
+
});
|
|
91
|
+
if (isCancel(category))
|
|
92
|
+
return;
|
|
93
|
+
const priority = await select({
|
|
94
|
+
message: 'Select Priority Level:',
|
|
95
|
+
options: [
|
|
96
|
+
{ value: 'low', label: '🟢 Low', hint: 'Minor inquiry or cosmetic suggestion' },
|
|
97
|
+
{ value: 'medium', label: '🟡 Medium', hint: 'Normal feature or non-blocking bug' },
|
|
98
|
+
{ value: 'high', label: '🟠 High', hint: 'Degraded capability or failing workflow' },
|
|
99
|
+
{ value: 'urgent', label: '🔴 Urgent / Blocker', hint: 'Critical blocker preventing work' },
|
|
100
|
+
],
|
|
101
|
+
});
|
|
102
|
+
if (isCancel(priority))
|
|
103
|
+
return;
|
|
104
|
+
const description = await text({
|
|
105
|
+
message: 'Detailed Description (what happened, steps to reproduce, or requirements):',
|
|
106
|
+
placeholder: 'Describe your issue or request in detail...',
|
|
107
|
+
validate: (val) => (!val || !val.trim() ? 'Description is required.' : undefined),
|
|
108
|
+
});
|
|
109
|
+
if (isCancel(description))
|
|
110
|
+
return;
|
|
111
|
+
const email = await text({
|
|
112
|
+
message: 'Your Contact Email (for status updates & response notifications):',
|
|
113
|
+
defaultValue: defaultEmail,
|
|
114
|
+
placeholder: 'developer@example.com',
|
|
115
|
+
validate: (val) => {
|
|
116
|
+
if (!val || !val.trim())
|
|
117
|
+
return 'Contact email is required.';
|
|
118
|
+
if (!val.includes('@') || !val.includes('.'))
|
|
119
|
+
return 'Please enter a valid email address.';
|
|
120
|
+
return undefined;
|
|
121
|
+
},
|
|
122
|
+
});
|
|
123
|
+
if (isCancel(email))
|
|
124
|
+
return;
|
|
125
|
+
const attachDiagnostics = await confirm({
|
|
126
|
+
message: 'Auto-attach sanitized system diagnostics (OS, Scout version, active tier, active model)?',
|
|
127
|
+
initialValue: true,
|
|
128
|
+
});
|
|
129
|
+
if (isCancel(attachDiagnostics))
|
|
130
|
+
return;
|
|
131
|
+
const spin = spinner();
|
|
132
|
+
spin.start('Submitting support ticket to FrontTerrain...');
|
|
133
|
+
const ticket = createSupportTicket({
|
|
134
|
+
subject: String(subject),
|
|
135
|
+
description: String(description),
|
|
136
|
+
userEmail: String(email),
|
|
137
|
+
category: category,
|
|
138
|
+
priority: priority,
|
|
139
|
+
attachDiagnostics: Boolean(attachDiagnostics),
|
|
140
|
+
});
|
|
141
|
+
spin.stop(chalk.green(`Ticket created successfully: ${chalk.bold(ticket.id)}`));
|
|
142
|
+
safeNote(`${chalk.bold.green('✔ Support Ticket Submitted Successfully')}\n\n` +
|
|
143
|
+
`• ${chalk.bold('Ticket ID:')} ${chalk.bold.cyan(ticket.id)}\n` +
|
|
144
|
+
`• ${chalk.bold('Subject:')} ${ticket.subject}\n` +
|
|
145
|
+
`• ${chalk.bold('Category:')} ${ticket.category.replace(/_/g, ' ').toUpperCase()}\n` +
|
|
146
|
+
`• ${chalk.bold('Priority:')} ${ticket.priority.toUpperCase()}\n` +
|
|
147
|
+
`• ${chalk.bold('Status:')} ${chalk.bold.yellow(ticket.status.toUpperCase())}\n` +
|
|
148
|
+
`• ${chalk.bold('Contact:')} ${ticket.userEmail}\n\n` +
|
|
149
|
+
`${chalk.dim('You can track this ticket anytime using:')}\n` +
|
|
150
|
+
` ${chalk.cyan('scout support --list')}\n` +
|
|
151
|
+
` ${chalk.cyan('scout support --open')} ${chalk.dim('(opens web dashboard)')}`, 'FrontTerrain Support Ticket');
|
|
152
|
+
}
|
|
153
|
+
function displayTicketsList() {
|
|
154
|
+
const tickets = loadSupportTickets();
|
|
155
|
+
if (tickets.length === 0) {
|
|
156
|
+
safeNote('No support tickets found on this device.\n\n' +
|
|
157
|
+
`To raise a ticket, run: ${chalk.cyan('scout support --new')}`, 'Support Tickets');
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
const lines = tickets.map((t) => {
|
|
161
|
+
let statusBadge = chalk.yellow(`[${t.status.toUpperCase()}]`);
|
|
162
|
+
if (t.status === 'resolved')
|
|
163
|
+
statusBadge = chalk.green(`[${t.status.toUpperCase()}]`);
|
|
164
|
+
if (t.status === 'in_progress')
|
|
165
|
+
statusBadge = chalk.cyan(`[${t.status.toUpperCase()}]`);
|
|
166
|
+
if (t.status === 'closed')
|
|
167
|
+
statusBadge = chalk.gray(`[${t.status.toUpperCase()}]`);
|
|
168
|
+
let priorityBadge = chalk.white(`[${t.priority.toUpperCase()}]`);
|
|
169
|
+
if (t.priority === 'urgent')
|
|
170
|
+
priorityBadge = chalk.bold.red(`[URGENT]`);
|
|
171
|
+
else if (t.priority === 'high')
|
|
172
|
+
priorityBadge = chalk.yellow(`[HIGH]`);
|
|
173
|
+
return (`${chalk.bold.cyan(t.id)} ${statusBadge} ${priorityBadge} ${chalk.bold(t.subject)}\n` +
|
|
174
|
+
` • Category: ${chalk.dim(t.category.replace(/_/g, ' '))} | Created: ${chalk.dim(new Date(t.createdAt).toLocaleString())}\n` +
|
|
175
|
+
` • Messages: ${t.messages.length} | Contact: ${chalk.dim(t.userEmail)}`);
|
|
176
|
+
});
|
|
177
|
+
safeNote(`Found ${tickets.length} support ticket(s):\n\n` +
|
|
178
|
+
lines.join('\n\n') +
|
|
179
|
+
`\n\n${chalk.dim('To manage tickets in browser, run:')} ${chalk.cyan('scout support --open')}`, `Support Tickets (${tickets.length})`);
|
|
180
|
+
}
|
|
181
|
+
function displayFaqs() {
|
|
182
|
+
const faqs = getPresetFaqs();
|
|
183
|
+
const formatted = faqs.map((f, i) => `### ${i + 1}. ${f.question}\n` +
|
|
184
|
+
`*Category: ${f.category}*\n\n` +
|
|
185
|
+
`${f.answer}\n`).join('\n---\n\n');
|
|
186
|
+
safeNote(renderMarkdown(formatted), 'FrontTerrain Scout Knowledge Base');
|
|
187
|
+
}
|
|
188
|
+
function displayDiagnostics() {
|
|
189
|
+
const diag = collectSanitizedDiagnostics();
|
|
190
|
+
const content = `• **Scout Version:** \`${diag.scoutVersion}\`\n` +
|
|
191
|
+
`• **Node.js:** \`${diag.nodeVersion}\`\n` +
|
|
192
|
+
`• **OS Platform:** \`${diag.platform} (${diag.osRelease}) [${diag.arch}]\`\n` +
|
|
193
|
+
`• **Subscription Tier:** \`${diag.currentTier}\`\n` +
|
|
194
|
+
`• **Active LLM Model:** \`${diag.activeModel}\`\n` +
|
|
195
|
+
`• **BYOK Mode:** \`${diag.byokEnabled ? 'Enabled' : 'Disabled'}\`\n` +
|
|
196
|
+
`• **Credit Quota:** \`${diag.usedCredits}/${diag.totalCredits} credits used\`\n` +
|
|
197
|
+
`• **Active Saved Tasks:** \`${diag.activeTaskCount}\`\n`;
|
|
198
|
+
safeNote(renderMarkdown(content), 'Scout System Diagnostics');
|
|
199
|
+
}
|
|
200
|
+
async function openSupportInBrowser() {
|
|
201
|
+
const s = spinner();
|
|
202
|
+
s.start('Connecting to Scout Web Support Dashboard...');
|
|
203
|
+
try {
|
|
204
|
+
const { url } = await startDashboardServer(9120);
|
|
205
|
+
const supportUrl = `${url}/support`;
|
|
206
|
+
s.stop(`Support server active at ${chalk.bold.cyan(supportUrl)}`);
|
|
207
|
+
const openCmd = process.platform === 'win32'
|
|
208
|
+
? `start "" "${supportUrl}"`
|
|
209
|
+
: process.platform === 'darwin'
|
|
210
|
+
? `open "${supportUrl}"`
|
|
211
|
+
: `xdg-open "${supportUrl}"`;
|
|
212
|
+
try {
|
|
213
|
+
await execAsync(openCmd);
|
|
214
|
+
}
|
|
215
|
+
catch { }
|
|
216
|
+
safeNote(`Web Support Dashboard: ${chalk.bold.underline.cyan(supportUrl)}\n\n` +
|
|
217
|
+
`• Submit & track tickets with live messaging\n` +
|
|
218
|
+
`• Searchable Knowledge Base & FAQs\n` +
|
|
219
|
+
`• Instant Diagnostic Report export\n\n` +
|
|
220
|
+
`${chalk.dim('Press Ctrl+C to stop local dashboard server.')}`, 'FrontTerrain Help & Support Dashboard');
|
|
221
|
+
}
|
|
222
|
+
catch (err) {
|
|
223
|
+
s.stop(chalk.red('Failed to start dashboard server.'));
|
|
224
|
+
console.error(chalk.red(`Error: ${err?.message || err}`));
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
//# sourceMappingURL=support.js.map
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { BrowserActionEngine, type ActionResult } from '../browser/actions/index.js';
|
|
2
|
+
import { type BrowserState } from '../browser/observer/types.js';
|
|
3
|
+
import { TaskStateManager, type TaskState } from '../agentState.js';
|
|
4
|
+
import { StateChangeVerifier } from './verification/stateChangeVerifier.js';
|
|
5
|
+
import { RecoveryManager } from './recovery/recoveryManager.js';
|
|
6
|
+
import { LoopDetector } from './recovery/loopDetector.js';
|
|
7
|
+
export interface ComputerUseTaskResult {
|
|
8
|
+
success: boolean;
|
|
9
|
+
objective: string;
|
|
10
|
+
status: 'completed' | 'failed' | 'timeout';
|
|
11
|
+
stepsExecuted: number;
|
|
12
|
+
completedSteps: number[];
|
|
13
|
+
taskState: TaskState;
|
|
14
|
+
summary: string;
|
|
15
|
+
structuredResult?: Record<string, any> | undefined;
|
|
16
|
+
durationMs: number;
|
|
17
|
+
toolHistory: Array<{
|
|
18
|
+
step: number;
|
|
19
|
+
tool: string;
|
|
20
|
+
args: Record<string, any>;
|
|
21
|
+
resultSummary?: string | undefined;
|
|
22
|
+
timestamp: string;
|
|
23
|
+
}>;
|
|
24
|
+
}
|
|
25
|
+
export interface UnderstandingInsight {
|
|
26
|
+
currentUrl: string;
|
|
27
|
+
pageTitle: string;
|
|
28
|
+
pageCategory: 'initial' | 'repo_index' | 'actions_dashboard' | 'workflow_run' | 'job_log' | 'form' | 'unknown';
|
|
29
|
+
failingWorkflows: Array<{
|
|
30
|
+
name: string;
|
|
31
|
+
target: string;
|
|
32
|
+
status: string;
|
|
33
|
+
}>;
|
|
34
|
+
logContent?: string | undefined;
|
|
35
|
+
hasBlockingModal: boolean;
|
|
36
|
+
isObjectiveMet: boolean;
|
|
37
|
+
conclusion?: string | undefined;
|
|
38
|
+
}
|
|
39
|
+
export interface PlannedAction {
|
|
40
|
+
stepId: number;
|
|
41
|
+
description: string;
|
|
42
|
+
actionType: 'navigate' | 'click' | 'type' | 'select' | 'read' | 'complete';
|
|
43
|
+
tool: string;
|
|
44
|
+
args: Record<string, any>;
|
|
45
|
+
expectedOutcome: string;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* ComputerUseAgentLoop: Connects perception (OBSERVE) and actions (ACT)
|
|
49
|
+
* to reasoning (UNDERSTAND -> PLAN -> VERIFY) around an explicit TaskState.
|
|
50
|
+
*
|
|
51
|
+
* Core Cycle:
|
|
52
|
+
* OBSERVE -> UNDERSTAND -> PLAN -> ACT -> VERIFY -> OBSERVE
|
|
53
|
+
*/
|
|
54
|
+
export declare class ComputerUseAgentLoop {
|
|
55
|
+
private actionEngine;
|
|
56
|
+
private stateManager;
|
|
57
|
+
private stateVerifier;
|
|
58
|
+
private recoveryManager;
|
|
59
|
+
private loopDetector;
|
|
60
|
+
private maxSteps;
|
|
61
|
+
private maxRetries;
|
|
62
|
+
private taskTimeoutMs;
|
|
63
|
+
private workspaceDir;
|
|
64
|
+
constructor(options?: {
|
|
65
|
+
actionEngine?: BrowserActionEngine | undefined;
|
|
66
|
+
stateManager?: TaskStateManager | undefined;
|
|
67
|
+
stateVerifier?: StateChangeVerifier | undefined;
|
|
68
|
+
recoveryManager?: RecoveryManager | undefined;
|
|
69
|
+
loopDetector?: LoopDetector | undefined;
|
|
70
|
+
maxSteps?: number | undefined;
|
|
71
|
+
maxRetries?: number | undefined;
|
|
72
|
+
taskTimeoutMs?: number | undefined;
|
|
73
|
+
workspaceDir?: string | undefined;
|
|
74
|
+
});
|
|
75
|
+
getActionEngine(): BrowserActionEngine;
|
|
76
|
+
getStateManager(): TaskStateManager;
|
|
77
|
+
getStateVerifier(): StateChangeVerifier;
|
|
78
|
+
getRecoveryManager(): RecoveryManager;
|
|
79
|
+
getLoopDetector(): LoopDetector;
|
|
80
|
+
getTaskState(): TaskState;
|
|
81
|
+
/**
|
|
82
|
+
* Executes an autonomous multi-step computer-use browser task.
|
|
83
|
+
*/
|
|
84
|
+
runGoal(objective: string): Promise<ComputerUseTaskResult>;
|
|
85
|
+
/**
|
|
86
|
+
* Stage 1: OBSERVE
|
|
87
|
+
*/
|
|
88
|
+
stage_observe(): Promise<BrowserState>;
|
|
89
|
+
/**
|
|
90
|
+
* Stage 2: UNDERSTAND
|
|
91
|
+
*/
|
|
92
|
+
stage_understand(state: BrowserState, objective: string): Promise<UnderstandingInsight>;
|
|
93
|
+
/**
|
|
94
|
+
* Stage 3: PLAN
|
|
95
|
+
*/
|
|
96
|
+
stage_plan(understanding: UnderstandingInsight, objective: string, step: number): Promise<PlannedAction>;
|
|
97
|
+
/**
|
|
98
|
+
* Stage 4: ACT
|
|
99
|
+
*/
|
|
100
|
+
stage_act(planned: PlannedAction): Promise<ActionResult>;
|
|
101
|
+
/**
|
|
102
|
+
* Stage 5: VERIFY
|
|
103
|
+
* Verifies that the expected state change occurred using the dedicated StateChangeVerifier.
|
|
104
|
+
*/
|
|
105
|
+
stage_verify(actionResult: ActionResult, planned: PlannedAction, beforeState?: BrowserState | undefined, afterState?: BrowserState | undefined): Promise<boolean>;
|
|
106
|
+
}
|
|
107
|
+
//# sourceMappingURL=computerUseLoop.d.ts.map
|