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.
Files changed (105) hide show
  1. package/README.md +1 -1
  2. package/bin/src/commands/agent.d.ts +5 -0
  3. package/bin/src/commands/agent.js +45 -3
  4. package/bin/src/commands/support.d.ts +9 -0
  5. package/bin/src/commands/support.js +227 -0
  6. package/bin/src/engine/agent/computerUseLoop.d.ts +107 -0
  7. package/bin/src/engine/agent/computerUseLoop.js +413 -0
  8. package/bin/src/engine/agent/index.d.ts +2 -0
  9. package/bin/src/engine/agent/index.js +2 -0
  10. package/bin/src/engine/agent/recovery/index.d.ts +4 -0
  11. package/bin/src/engine/agent/recovery/index.js +4 -0
  12. package/bin/src/engine/agent/recovery/loopDetector.d.ts +26 -0
  13. package/bin/src/engine/agent/recovery/loopDetector.js +126 -0
  14. package/bin/src/engine/agent/recovery/recoveryManager.d.ts +43 -0
  15. package/bin/src/engine/agent/recovery/recoveryManager.js +271 -0
  16. package/bin/src/engine/agent/recovery/types.d.ts +48 -0
  17. package/bin/src/engine/agent/recovery/types.js +4 -0
  18. package/bin/src/engine/agent/verification/index.d.ts +3 -0
  19. package/bin/src/engine/agent/verification/index.js +3 -0
  20. package/bin/src/engine/agent/verification/stateChangeVerifier.d.ts +22 -0
  21. package/bin/src/engine/agent/verification/stateChangeVerifier.js +282 -0
  22. package/bin/src/engine/agent/verification/types.d.ts +28 -0
  23. package/bin/src/engine/agent/verification/types.js +4 -0
  24. package/bin/src/engine/agentEngine.d.ts +2 -1
  25. package/bin/src/engine/agentEngine.js +98 -7
  26. package/bin/src/engine/agentState.d.ts +41 -1
  27. package/bin/src/engine/agentState.js +45 -0
  28. package/bin/src/engine/browser/actions/actionEngine.d.ts +41 -0
  29. package/bin/src/engine/browser/actions/actionEngine.js +707 -0
  30. package/bin/src/engine/browser/actions/index.d.ts +4 -0
  31. package/bin/src/engine/browser/actions/index.js +4 -0
  32. package/bin/src/engine/browser/actions/reliability.d.ts +41 -0
  33. package/bin/src/engine/browser/actions/reliability.js +170 -0
  34. package/bin/src/engine/browser/actions/types.d.ts +50 -0
  35. package/bin/src/engine/browser/actions/types.js +2 -0
  36. package/bin/src/engine/browser/browserController.d.ts +18 -0
  37. package/bin/src/engine/browser/browserController.js +44 -12
  38. package/bin/src/engine/browser/index.d.ts +2 -0
  39. package/bin/src/engine/browser/index.js +2 -0
  40. package/bin/src/engine/browser/observer/accessibilityTree.d.ts +14 -0
  41. package/bin/src/engine/browser/observer/accessibilityTree.js +214 -0
  42. package/bin/src/engine/browser/observer/browserObserver.d.ts +29 -0
  43. package/bin/src/engine/browser/observer/browserObserver.js +204 -0
  44. package/bin/src/engine/browser/observer/domExtractor.d.ts +30 -0
  45. package/bin/src/engine/browser/observer/domExtractor.js +407 -0
  46. package/bin/src/engine/browser/observer/index.d.ts +5 -0
  47. package/bin/src/engine/browser/observer/index.js +5 -0
  48. package/bin/src/engine/browser/observer/types.d.ts +163 -0
  49. package/bin/src/engine/browser/observer/types.js +8 -0
  50. package/bin/src/engine/computer/computerController.d.ts +49 -0
  51. package/bin/src/engine/computer/computerController.js +249 -104
  52. package/bin/src/engine/computer/mockComputer.d.ts +6 -1
  53. package/bin/src/engine/computer/mockComputer.js +58 -0
  54. package/bin/src/engine/computer/scoutDriver.cs +84 -2
  55. package/bin/src/engine/llm.js +16 -0
  56. package/bin/src/engine/models/harpProvider.d.ts +32 -0
  57. package/bin/src/engine/models/harpProvider.js +124 -0
  58. package/bin/src/engine/models/index.d.ts +6 -0
  59. package/bin/src/engine/models/index.js +6 -0
  60. package/bin/src/engine/models/localModelProvider.d.ts +11 -0
  61. package/bin/src/engine/models/localModelProvider.js +48 -0
  62. package/bin/src/engine/models/openaiProvider.d.ts +11 -0
  63. package/bin/src/engine/models/openaiProvider.js +50 -0
  64. package/bin/src/engine/models/reasoningOrchestrator.d.ts +17 -0
  65. package/bin/src/engine/models/reasoningOrchestrator.js +75 -0
  66. package/bin/src/engine/models/types.d.ts +63 -0
  67. package/bin/src/engine/models/types.js +2 -0
  68. package/bin/src/engine/planner.js +64 -34
  69. package/bin/src/engine/production/index.d.ts +3 -0
  70. package/bin/src/engine/production/index.js +3 -0
  71. package/bin/src/engine/production/taskReplay.d.ts +37 -0
  72. package/bin/src/engine/production/taskReplay.js +81 -0
  73. package/bin/src/engine/production/telemetry.d.ts +43 -0
  74. package/bin/src/engine/production/telemetry.js +68 -0
  75. package/bin/src/engine/runtime/agentRuntime.d.ts +1 -1
  76. package/bin/src/engine/runtime/agentRuntime.js +99 -0
  77. package/bin/src/engine/safety/index.d.ts +3 -0
  78. package/bin/src/engine/safety/index.js +3 -0
  79. package/bin/src/engine/safety/policyEngine.d.ts +40 -0
  80. package/bin/src/engine/safety/policyEngine.js +282 -0
  81. package/bin/src/engine/safety/types.d.ts +24 -0
  82. package/bin/src/engine/safety/types.js +2 -0
  83. package/bin/src/engine/safety.d.ts +1 -0
  84. package/bin/src/engine/safety.js +1 -0
  85. package/bin/src/engine/subagents/subagentManager.js +2 -2
  86. package/bin/src/engine/toolRegistry.d.ts +4 -0
  87. package/bin/src/engine/toolRegistry.js +9 -0
  88. package/bin/src/engine/tools/domainHandlers.d.ts +61 -0
  89. package/bin/src/engine/tools/domainHandlers.js +458 -0
  90. package/bin/src/engine/tools/index.d.ts +4 -0
  91. package/bin/src/engine/tools/index.js +4 -0
  92. package/bin/src/engine/tools/types.d.ts +56 -0
  93. package/bin/src/engine/tools/types.js +2 -0
  94. package/bin/src/engine/tools/unifiedRouter.d.ts +29 -0
  95. package/bin/src/engine/tools/unifiedRouter.js +426 -0
  96. package/bin/src/index.js +26 -6
  97. package/bin/src/mcp/client.js +1 -1
  98. package/bin/src/server/server.js +136 -0
  99. package/bin/src/utils/branding.js +1 -1
  100. package/bin/src/utils/qrBridge.js +1 -1
  101. package/bin/src/utils/session.d.ts +5 -1
  102. package/bin/src/utils/session.js +36 -3
  103. package/bin/src/utils/support.d.ts +63 -0
  104. package/bin/src/utils/support.js +182 -0
  105. package/package.json +2 -2
@@ -8,7 +8,8 @@ import { UnifiedToolRegistry } from './toolRegistry.js';
8
8
  import { type IComputerController, SystemComputerController, MockComputerController } from './computer/index.js';
9
9
  import { AgentWorkspace, inferExecutionIntent, resolveDesktopPath, type ExecutionIntent } from './workspace/index.js';
10
10
  import { AgentRuntime } from './runtime/index.js';
11
- export { AgentRuntime, AgentWorkspace, inferExecutionIntent, resolveDesktopPath, type ExecutionIntent, type IComputerController, SystemComputerController, MockComputerController };
11
+ import { ComputerUseAgentLoop, type ComputerUseTaskResult } from './agent/index.js';
12
+ export { AgentRuntime, AgentWorkspace, inferExecutionIntent, resolveDesktopPath, type ExecutionIntent, type IComputerController, SystemComputerController, MockComputerController, ComputerUseAgentLoop, type ComputerUseTaskResult };
12
13
  export declare function robustSnippetReplace(origContent: string, target: string, replacement: string): {
13
14
  success: boolean;
14
15
  updatedContent: string;
@@ -27,7 +27,8 @@ import { CheckpointManager } from './checkpoints/checkpointManager.js';
27
27
  import { renderStepHeader, renderThoughtBox, renderToolCall, renderToolResult, renderTaskCompletedCard, } from '../utils/claudeUI.js';
28
28
  import { loadWorkspaceRules } from '../utils/rules.js';
29
29
  import { InterruptManager } from '../utils/interruptHandler.js';
30
- export { AgentRuntime, AgentWorkspace, inferExecutionIntent, resolveDesktopPath, SystemComputerController, MockComputerController };
30
+ import { ComputerUseAgentLoop } from './agent/index.js';
31
+ export { AgentRuntime, AgentWorkspace, inferExecutionIntent, resolveDesktopPath, SystemComputerController, MockComputerController, ComputerUseAgentLoop };
31
32
  const execAsync = promisify(exec);
32
33
  export function robustSnippetReplace(origContent, target, replacement) {
33
34
  if (!origContent || !target) {
@@ -277,7 +278,7 @@ export const AGENT_TOOLS = [
277
278
  },
278
279
  {
279
280
  name: 'ask_user',
280
- description: 'ONLY use for missing API keys or secret credentials. DO NOT use to ask the user what code to write or to re-confirm their prompttake immediate autonomous tool action instead.',
281
+ description: 'Prompt the user directly for input, decisions, preferences, confirmations, or clarifications. Use this whenever you need user guidance, choices between options, or additional details to proceed.',
281
282
  parameters: {
282
283
  type: 'object',
283
284
  properties: {
@@ -745,6 +746,70 @@ When returning tool calls, use standard OpenAI function calling format or JSON t
745
746
  }
746
747
  // Robust Target File Discovery: Only run file discovery if the goal has explicit code editing/modification intent
747
748
  const simpleAppCheck = checkSimpleAppAction(userGoal);
749
+ if (simpleAppCheck.isSimple && simpleAppCheck.appName) {
750
+ const app = simpleAppCheck.appName;
751
+ const action = simpleAppCheck.action || 'open';
752
+ this.taskStateManager.startStep(1);
753
+ let res;
754
+ const toolName = action === 'close' ? 'computer_close_app' : (action === 'switch' ? 'computer_switch_window' : 'computer_open_app');
755
+ const toolArgs = action === 'switch' ? { windowTitleOrApp: app } : { appName: app };
756
+ renderStepHeader({
757
+ step: 1,
758
+ maxSteps: this.maxSteps,
759
+ startTimeMs: this.startTime,
760
+ tokensConsumed: 0,
761
+ userTier: this.userTier,
762
+ });
763
+ renderToolCall({
764
+ name: toolName,
765
+ args: toolArgs,
766
+ step: 1,
767
+ });
768
+ const actionStartTime = Date.now();
769
+ if (action === 'close') {
770
+ res = await this.computerController.closeApplication(app);
771
+ }
772
+ else if (action === 'switch') {
773
+ res = await this.computerController.switchWindow(app);
774
+ }
775
+ else {
776
+ res = await this.computerController.openApplication(app);
777
+ }
778
+ renderToolResult({
779
+ name: toolName,
780
+ args: toolArgs,
781
+ result: JSON.stringify(res, null, 2),
782
+ durationMs: Date.now() - actionStartTime,
783
+ success: res && res.success !== false,
784
+ });
785
+ const actionVerb = action === 'close' ? 'closed' : (action === 'switch' ? 'focused' : 'launched');
786
+ const summary = res && res.success !== false
787
+ ? `I've ${actionVerb} ${app} for you. It's ready on your screen!`
788
+ : `Attempted to ${action} ${app}: ${res?.output || res?.error || 'Failed to execute application action'}`;
789
+ this.taskStateManager.completeStep(1, summary);
790
+ this.taskStateManager.setStatus(res && res.success !== false ? 'completed' : 'failed');
791
+ renderTaskCompletedCard({
792
+ objective: userGoal,
793
+ summary,
794
+ modifiedFiles: [],
795
+ steps: 1,
796
+ maxSteps: this.maxSteps,
797
+ totalTokens: 0,
798
+ totalToolCalls: 1,
799
+ elapsedSecs: Math.max(0.1, (Date.now() - this.startTime) / 1000),
800
+ userTier: this.userTier,
801
+ });
802
+ saveAgentSession({
803
+ goal: userGoal,
804
+ summary,
805
+ modifiedFiles: [],
806
+ });
807
+ this.syncTelemetry('idle', `scout: completed app action ${action} for ${app}`);
808
+ return {
809
+ success: res && res.success !== false,
810
+ summary,
811
+ };
812
+ }
748
813
  const lowerGoal = userGoal.toLowerCase().trim();
749
814
  const hasCodeEditIntent = /\b(edit|modify|fix|update|change|refactor|write|create|implement|patch|delete|remove|add\s+code|add\s+function|debug)\b/i.test(lowerGoal) &&
750
815
  !/\b(lookup|look\s*up|who|what|why|where|how|explain|describe|tell|status|check|github|mcp)\b/i.test(lowerGoal);
@@ -940,9 +1005,40 @@ When returning tool calls, use standard OpenAI function calling format or JSON t
940
1005
  goalLower.includes('calc') ||
941
1006
  goalLower.includes('paint') ||
942
1007
  goalLower.includes('type') ||
1008
+ goalLower.includes('chrome') ||
1009
+ goalLower.includes('browser') ||
1010
+ goalLower.includes('vscode') ||
1011
+ goalLower.includes('vs code') ||
1012
+ goalLower.includes('code') ||
1013
+ goalLower.includes('terminal') ||
1014
+ goalLower.includes('powershell') ||
1015
+ goalLower.includes('cmd') ||
1016
+ goalLower.includes('explorer') ||
1017
+ goalLower.includes('spotify') ||
1018
+ goalLower.includes('slack') ||
1019
+ goalLower.includes('discord') ||
1020
+ goalLower.includes('edge') ||
1021
+ goalLower.includes('firefox') ||
1022
+ goalLower.includes('excel') ||
1023
+ goalLower.includes('word') ||
1024
+ goalLower.includes('blender') ||
1025
+ goalLower.includes('open') ||
1026
+ goalLower.includes('launch') ||
1027
+ goalLower.includes('window') ||
1028
+ simpleAppCheck.isSimple ||
943
1029
  this.executionIntent?.requiredInteraction === 'computer' ||
944
1030
  (this.executionIntent?.requiredApplications && this.executionIntent.requiredApplications.length > 0);
945
1031
  let baseTools = this.toolRegistry.getToolsForTier(this.userTier);
1032
+ if (needsComputer) {
1033
+ const computerTools = this.toolRegistry.getAllTools().filter((t) => t.name.startsWith('computer_'));
1034
+ const existingNames = new Set(baseTools.map((t) => t.name));
1035
+ for (const ct of computerTools) {
1036
+ if (!existingNames.has(ct.name)) {
1037
+ baseTools.push(ct);
1038
+ existingNames.add(ct.name);
1039
+ }
1040
+ }
1041
+ }
946
1042
  if (mcpRouting.tools.length > 0 && !needsBrowser && !needsComputer) {
947
1043
  const ESSENTIAL_BASE_TOOLS = new Set(['read_file', 'write_file', 'edit_file', 'run_command', 'list_dir', 'grep_search', 'task_completed', 'ask_user', 'speak_text', 'scratchpad', 'computer_open_app']);
948
1044
  baseTools = baseTools.filter((t) => ESSENTIAL_BASE_TOOLS.has(t.name));
@@ -1976,11 +2072,6 @@ You MUST output exactly ONE JSON code block per tool call. Do NOT describe what
1976
2072
  }
1977
2073
  case 'ask_user': {
1978
2074
  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
- }
1984
2075
  const askSpin = spinner();
1985
2076
  askSpin.stop();
1986
2077
  safeNote(questionText, ' Scout Agent Question for User');
@@ -1,3 +1,4 @@
1
+ import { type BrowserState } from './browser/index.js';
1
2
  export interface TaskPlanStep {
2
3
  id: number;
3
4
  description: string;
@@ -52,6 +53,24 @@ export interface PendingAction {
52
53
  riskReason: string;
53
54
  requestedAt: string;
54
55
  }
56
+ export interface TaskState {
57
+ objective: string;
58
+ plan: TaskPlanStep[];
59
+ current_step: number;
60
+ completed_steps: number[];
61
+ browser_state?: BrowserState | undefined;
62
+ tool_history: Array<{
63
+ step: number;
64
+ tool: string;
65
+ args: Record<string, any>;
66
+ resultSummary?: string | undefined;
67
+ timestamp: string;
68
+ }>;
69
+ errors: TaskError[];
70
+ retries: number;
71
+ status: 'planning' | 'running' | 'executing' | 'waiting_approval' | 'recovering' | 'completed' | 'failed' | 'paused' | 'timeout';
72
+ structured_result?: Record<string, any> | undefined;
73
+ }
55
74
  export interface AutonomousTaskState {
56
75
  task_id: string;
57
76
  taskId: string;
@@ -70,11 +89,21 @@ export interface AutonomousTaskState {
70
89
  errors: TaskError[];
71
90
  pending_action: PendingAction | null;
72
91
  verification_status: 'pending' | 'verified' | 'failed' | null;
73
- status: 'planning' | 'running' | 'executing' | 'waiting_approval' | 'recovering' | 'completed' | 'failed' | 'paused';
92
+ status: 'planning' | 'running' | 'executing' | 'waiting_approval' | 'recovering' | 'completed' | 'failed' | 'paused' | 'timeout';
74
93
  created_at: string;
75
94
  updated_at: string;
76
95
  completed_at?: string | undefined;
77
96
  metadata?: Record<string, any> | undefined;
97
+ browser_state?: BrowserState | undefined;
98
+ tool_history?: Array<{
99
+ step: number;
100
+ tool: string;
101
+ args: Record<string, any>;
102
+ resultSummary?: string | undefined;
103
+ timestamp: string;
104
+ }> | undefined;
105
+ retries?: number | undefined;
106
+ structured_result?: Record<string, any> | undefined;
78
107
  }
79
108
  export declare class TaskStateManager {
80
109
  private state;
@@ -121,6 +150,17 @@ export declare class TaskStateManager {
121
150
  mimeType?: string | undefined;
122
151
  }): TaskArtifact;
123
152
  getArtifacts(): TaskArtifact[];
153
+ setBrowserState(browserState: BrowserState): void;
154
+ addToolHistory(entry: {
155
+ step: number;
156
+ tool: string;
157
+ args: Record<string, any>;
158
+ resultSummary?: string | undefined;
159
+ }): void;
160
+ incrementRetries(): number;
161
+ resetRetries(): void;
162
+ setStructuredResult(result: Record<string, any>): void;
163
+ getTaskState(): TaskState;
124
164
  setActiveApplication(appName: string | null): void;
125
165
  setActiveUrl(url: string | null): void;
126
166
  setActiveWindow(windowTitle: string | null): void;
@@ -1,5 +1,6 @@
1
1
  import fs from 'fs';
2
2
  import path from 'path';
3
+ import {} from './browser/index.js';
3
4
  export class TaskStateManager {
4
5
  state;
5
6
  workspaceDir;
@@ -245,6 +246,50 @@ export class TaskStateManager {
245
246
  getArtifacts() {
246
247
  return [...this.state.artifacts];
247
248
  }
249
+ setBrowserState(browserState) {
250
+ this.state.browser_state = browserState;
251
+ this.touch();
252
+ }
253
+ addToolHistory(entry) {
254
+ if (!this.state.tool_history) {
255
+ this.state.tool_history = [];
256
+ }
257
+ this.state.tool_history.push({
258
+ ...entry,
259
+ timestamp: new Date().toISOString(),
260
+ });
261
+ if (this.state.tool_history.length > 50) {
262
+ this.state.tool_history.shift();
263
+ }
264
+ this.touch();
265
+ }
266
+ incrementRetries() {
267
+ this.state.retries = (this.state.retries || 0) + 1;
268
+ this.touch();
269
+ return this.state.retries;
270
+ }
271
+ resetRetries() {
272
+ this.state.retries = 0;
273
+ this.touch();
274
+ }
275
+ setStructuredResult(result) {
276
+ this.state.structured_result = result;
277
+ this.touch();
278
+ }
279
+ getTaskState() {
280
+ return {
281
+ objective: this.state.objective || this.state.goal,
282
+ plan: this.state.plan,
283
+ current_step: this.state.current_step,
284
+ completed_steps: this.state.completed_steps,
285
+ browser_state: this.state.browser_state,
286
+ tool_history: this.state.tool_history || [],
287
+ errors: this.state.errors,
288
+ retries: this.state.retries || 0,
289
+ status: this.state.status,
290
+ structured_result: this.state.structured_result,
291
+ };
292
+ }
248
293
  setActiveApplication(appName) {
249
294
  this.state.active_application = appName;
250
295
  this.touch();
@@ -0,0 +1,41 @@
1
+ import { type ActionTarget, type ActionResult, type WaitCondition, type IBrowserActionEngine, type RetryPolicy } from './types.js';
2
+ import { BrowserObserver } from '../observer/browserObserver.js';
3
+ export interface InternalBrowserTab {
4
+ id: string;
5
+ url: string;
6
+ title: string;
7
+ html: string;
8
+ history: {
9
+ past: string[];
10
+ future: string[];
11
+ };
12
+ }
13
+ export declare class BrowserActionEngine implements IBrowserActionEngine {
14
+ private tabs;
15
+ private activeTabId;
16
+ private observer;
17
+ private workspaceDir;
18
+ private retryPolicy;
19
+ constructor(workspaceDir?: string, retryPolicy?: Partial<RetryPolicy>);
20
+ getObserver(): BrowserObserver;
21
+ getActiveTab(): InternalBrowserTab | null;
22
+ getTabs(): InternalBrowserTab[];
23
+ private captureCurrentState;
24
+ navigate(url: string, htmlContent?: string): Promise<ActionResult>;
25
+ click(target: ActionTarget | string): Promise<ActionResult>;
26
+ type(target: ActionTarget | string, text: string, options?: {
27
+ clear?: boolean;
28
+ delayMs?: number;
29
+ }): Promise<ActionResult>;
30
+ select(target: ActionTarget | string, value: string): Promise<ActionResult>;
31
+ scroll(direction: 'up' | 'down' | 'left' | 'right', amount?: number): Promise<ActionResult>;
32
+ hover(target: ActionTarget | string): Promise<ActionResult>;
33
+ press_key(key: string): Promise<ActionResult>;
34
+ open_tab(url?: string, htmlContent?: string): Promise<ActionResult>;
35
+ close_tab(tabId?: string): Promise<ActionResult>;
36
+ switch_tab(tabId: string): Promise<ActionResult>;
37
+ wait(condition: WaitCondition, param?: any): Promise<ActionResult>;
38
+ upload(target: ActionTarget | string, localFilePath: string): Promise<ActionResult>;
39
+ download(target: ActionTarget | string, destPath?: string): Promise<ActionResult>;
40
+ }
41
+ //# sourceMappingURL=actionEngine.d.ts.map