ft-scout 9.5.5 → 9.5.7

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 (99) hide show
  1. package/README.md +1 -1
  2. package/bin/src/engine/agent/computerUseLoop.d.ts +107 -0
  3. package/bin/src/engine/agent/computerUseLoop.js +413 -0
  4. package/bin/src/engine/agent/index.d.ts +2 -0
  5. package/bin/src/engine/agent/index.js +2 -0
  6. package/bin/src/engine/agent/recovery/index.d.ts +4 -0
  7. package/bin/src/engine/agent/recovery/index.js +4 -0
  8. package/bin/src/engine/agent/recovery/loopDetector.d.ts +26 -0
  9. package/bin/src/engine/agent/recovery/loopDetector.js +126 -0
  10. package/bin/src/engine/agent/recovery/recoveryManager.d.ts +43 -0
  11. package/bin/src/engine/agent/recovery/recoveryManager.js +271 -0
  12. package/bin/src/engine/agent/recovery/types.d.ts +48 -0
  13. package/bin/src/engine/agent/recovery/types.js +4 -0
  14. package/bin/src/engine/agent/verification/index.d.ts +3 -0
  15. package/bin/src/engine/agent/verification/index.js +3 -0
  16. package/bin/src/engine/agent/verification/stateChangeVerifier.d.ts +22 -0
  17. package/bin/src/engine/agent/verification/stateChangeVerifier.js +282 -0
  18. package/bin/src/engine/agent/verification/types.d.ts +28 -0
  19. package/bin/src/engine/agent/verification/types.js +4 -0
  20. package/bin/src/engine/agentEngine.d.ts +3 -1
  21. package/bin/src/engine/agentEngine.js +370 -56
  22. package/bin/src/engine/agentState.d.ts +41 -1
  23. package/bin/src/engine/agentState.js +45 -0
  24. package/bin/src/engine/browser/actions/actionEngine.d.ts +41 -0
  25. package/bin/src/engine/browser/actions/actionEngine.js +707 -0
  26. package/bin/src/engine/browser/actions/index.d.ts +4 -0
  27. package/bin/src/engine/browser/actions/index.js +4 -0
  28. package/bin/src/engine/browser/actions/reliability.d.ts +41 -0
  29. package/bin/src/engine/browser/actions/reliability.js +170 -0
  30. package/bin/src/engine/browser/actions/types.d.ts +50 -0
  31. package/bin/src/engine/browser/actions/types.js +2 -0
  32. package/bin/src/engine/browser/browserController.d.ts +18 -0
  33. package/bin/src/engine/browser/browserController.js +44 -12
  34. package/bin/src/engine/browser/index.d.ts +2 -0
  35. package/bin/src/engine/browser/index.js +2 -0
  36. package/bin/src/engine/browser/observer/accessibilityTree.d.ts +14 -0
  37. package/bin/src/engine/browser/observer/accessibilityTree.js +214 -0
  38. package/bin/src/engine/browser/observer/browserObserver.d.ts +29 -0
  39. package/bin/src/engine/browser/observer/browserObserver.js +204 -0
  40. package/bin/src/engine/browser/observer/domExtractor.d.ts +30 -0
  41. package/bin/src/engine/browser/observer/domExtractor.js +407 -0
  42. package/bin/src/engine/browser/observer/index.d.ts +5 -0
  43. package/bin/src/engine/browser/observer/index.js +5 -0
  44. package/bin/src/engine/browser/observer/types.d.ts +163 -0
  45. package/bin/src/engine/browser/observer/types.js +8 -0
  46. package/bin/src/engine/computer/computerController.d.ts +45 -2
  47. package/bin/src/engine/computer/computerController.js +178 -38
  48. package/bin/src/engine/computer/mockComputer.d.ts +7 -2
  49. package/bin/src/engine/computer/mockComputer.js +59 -1
  50. package/bin/src/engine/computer/scoutDriver.cs +310 -63
  51. package/bin/src/engine/llm.js +35 -15
  52. package/bin/src/engine/models/harpProvider.d.ts +32 -0
  53. package/bin/src/engine/models/harpProvider.js +172 -0
  54. package/bin/src/engine/models/index.d.ts +6 -0
  55. package/bin/src/engine/models/index.js +6 -0
  56. package/bin/src/engine/models/localModelProvider.d.ts +11 -0
  57. package/bin/src/engine/models/localModelProvider.js +48 -0
  58. package/bin/src/engine/models/openaiProvider.d.ts +11 -0
  59. package/bin/src/engine/models/openaiProvider.js +50 -0
  60. package/bin/src/engine/models/reasoningOrchestrator.d.ts +17 -0
  61. package/bin/src/engine/models/reasoningOrchestrator.js +75 -0
  62. package/bin/src/engine/models/types.d.ts +63 -0
  63. package/bin/src/engine/models/types.js +2 -0
  64. package/bin/src/engine/production/index.d.ts +3 -0
  65. package/bin/src/engine/production/index.js +3 -0
  66. package/bin/src/engine/production/taskReplay.d.ts +37 -0
  67. package/bin/src/engine/production/taskReplay.js +81 -0
  68. package/bin/src/engine/production/telemetry.d.ts +43 -0
  69. package/bin/src/engine/production/telemetry.js +68 -0
  70. package/bin/src/engine/runtime/agentRuntime.d.ts +1 -1
  71. package/bin/src/engine/runtime/agentRuntime.js +33 -7
  72. package/bin/src/engine/safety/index.d.ts +3 -0
  73. package/bin/src/engine/safety/index.js +3 -0
  74. package/bin/src/engine/safety/policyEngine.d.ts +40 -0
  75. package/bin/src/engine/safety/policyEngine.js +282 -0
  76. package/bin/src/engine/safety/types.d.ts +24 -0
  77. package/bin/src/engine/safety/types.js +2 -0
  78. package/bin/src/engine/safety.d.ts +1 -0
  79. package/bin/src/engine/safety.js +1 -0
  80. package/bin/src/engine/toolRegistry.d.ts +4 -0
  81. package/bin/src/engine/toolRegistry.js +9 -0
  82. package/bin/src/engine/tools/domainHandlers.d.ts +61 -0
  83. package/bin/src/engine/tools/domainHandlers.js +495 -0
  84. package/bin/src/engine/tools/index.d.ts +4 -0
  85. package/bin/src/engine/tools/index.js +4 -0
  86. package/bin/src/engine/tools/types.d.ts +56 -0
  87. package/bin/src/engine/tools/types.js +2 -0
  88. package/bin/src/engine/tools/unifiedRouter.d.ts +29 -0
  89. package/bin/src/engine/tools/unifiedRouter.js +426 -0
  90. package/bin/src/engine/workspace/agentWorkspace.js +4 -2
  91. package/bin/src/index.js +4 -4
  92. package/bin/src/mcp/client.js +1 -1
  93. package/bin/src/server/server.js +57 -18
  94. package/bin/src/utils/branding.js +1 -1
  95. package/bin/src/utils/claudeUI.d.ts +10 -1
  96. package/bin/src/utils/claudeUI.js +136 -6
  97. package/bin/src/utils/qrBridge.js +1 -1
  98. package/bin/src/utils/support.js +1 -1
  99. package/package.json +2 -2
@@ -31,24 +31,154 @@ export function renderStepHeader(telemetry) {
31
31
  console.log();
32
32
  console.log(chalk.cyan(leftPart) + chalk.cyan('─'.repeat(fillLen)) + chalk.cyan(rightPart));
33
33
  }
34
+ /**
35
+ * Human-friendly action descriptions for synthesized reasoning and fallback thought completion.
36
+ */
37
+ export function getActionFriendlyDescription(fnName, args = {}) {
38
+ switch (fnName) {
39
+ case 'computer_open_app':
40
+ return `Opening ${args?.appName || args?.app || 'the application'} to prepare for the requested actions.`;
41
+ case 'computer_type':
42
+ return `Typing the requested text into ${args?.targetApp || args?.app || 'the active window'}.`;
43
+ case 'computer_close_app':
44
+ return `Closing ${args?.appName || args?.app || 'the application'} as requested.`;
45
+ case 'computer_switch_window':
46
+ return `Switching focus to ${args?.windowTitleOrApp || args?.appName || 'the target window'}.`;
47
+ case 'computer_click':
48
+ return `Clicking screen coordinates (${args?.x ?? 0}, ${args?.y ?? 0}) to interact with the target element.`;
49
+ case 'computer_double_click':
50
+ return `Double clicking at (${args?.x ?? 0}, ${args?.y ?? 0}) to activate the target element.`;
51
+ case 'computer_right_click':
52
+ return `Right clicking at (${args?.x ?? 0}, ${args?.y ?? 0}) to open the context menu.`;
53
+ case 'computer_screenshot':
54
+ return `Observing the computer screen to inspect the current visual state.`;
55
+ case 'computer_inspect_ui':
56
+ return `Inspecting active desktop windows and interactive UI elements.`;
57
+ case 'browser_navigate':
58
+ return `Navigating to ${args?.url || 'the requested web page'}.`;
59
+ case 'browser_click':
60
+ return `Clicking element "${args?.selectorOrText || 'target'}" in the browser.`;
61
+ case 'browser_type':
62
+ return `Entering text into "${args?.selectorOrText || 'input field'}" in the browser.`;
63
+ case 'browser_content':
64
+ return `Extracting structured text and content from the current web page.`;
65
+ case 'browser_screenshot':
66
+ return `Capturing a visual screenshot of the current browser page.`;
67
+ case 'read_file':
68
+ return `Reading ${args?.path || 'the file'} to inspect its contents.`;
69
+ case 'write_file':
70
+ return `Writing contents to ${args?.path || 'the target file'}.`;
71
+ case 'edit_file':
72
+ return `Applying modifications to ${args?.path || 'the target file'}.`;
73
+ case 'run_command':
74
+ return `Running command: "${args?.command || args?.cmd || ''}".`;
75
+ case 'list_dir':
76
+ return `Listing files in ${args?.path || '.'} to understand workspace structure.`;
77
+ case 'grep_search':
78
+ return `Searching for "${args?.query || args?.pattern || ''}" across workspace files.`;
79
+ case 'task_completed':
80
+ return `Finalizing the task and preparing the completion summary.`;
81
+ default:
82
+ return `Executing ${fnName.replace(/_/g, ' ')} to proceed with the objective.`;
83
+ }
84
+ }
85
+ /**
86
+ * Validates and completes fragmented or truncated reasoning sentences
87
+ * so Scout always outputs complete, grammatically sound thoughts in the terminal.
88
+ */
89
+ export function ensureCompleteSentence(text, fallbackDesc) {
90
+ if (!text || !text.trim())
91
+ return fallbackDesc || '';
92
+ let cleaned = text.trim();
93
+ // Strip unclosed <think> or <think>...</think>
94
+ cleaned = cleaned.replace(/<think>[\s\S]*?<\/think>/gi, '');
95
+ cleaned = cleaned.replace(/<think>[\s\S]*$/gi, '');
96
+ cleaned = cleaned.replace(/<\/think>/gi, '');
97
+ cleaned = cleaned.replace(/```json[\s\S]*?```/gi, '');
98
+ cleaned = cleaned.replace(/```[\s\S]*?```/gi, '');
99
+ cleaned = cleaned.replace(/<function=[^>]+>[\s\S]*?<\/function>/gi, '');
100
+ cleaned = cleaned.replace(/<[a-zA-Z0-9_]+>[\s\S]*?<\/[a-zA-Z0-9_]+>/gi, '');
101
+ cleaned = cleaned.replace(/\{[\s\S]*"tool"\s*:[\s\S]*\}/gi, '');
102
+ cleaned = cleaned.replace(/[\u0600-\u06FF\u0750-\u077F\uAC00-\uD7AF\u3040-\u30FF\u4E00-\u9FFF\u0D80-\u0DFF]+/g, '');
103
+ cleaned = cleaned.trim();
104
+ if (!cleaned)
105
+ return fallbackDesc || '';
106
+ // Indicators of incomplete ending: colons, dashes, prepositions, conjunctions, or action verbs
107
+ const incompleteEndingRegex = /(?:[:;,–—\\]|\.{2,}|\b(?:to|and|by|using|with|for|in|a|the|so\s+that|because|as|into|from|of|that|which|if|or|about|then|while|when|after|before|write|type|open|launch|click|press|close|read|edit|create|run|check|see|view|focus|switch|start|navigate))\s*$/i;
108
+ const isFragment = cleaned.length < 15 ||
109
+ /^(?:i\s+will|i'll|let\s+me|i\s+need\s+to|i\s+am\s+going\s+to|starting\s+by|first\s+step\s+is\s+to|to\s+do\s+this\s+i\s+will|in\s+order\s+to)\s*$/i.test(cleaned) ||
110
+ incompleteEndingRegex.test(cleaned) ||
111
+ (!/[.!?]$/.test(cleaned) && cleaned.split(/\s+/).length <= 4);
112
+ if (isFragment) {
113
+ if (fallbackDesc) {
114
+ const strippedLead = cleaned.replace(/[:;,–—\.]+\s*$/, '').trim();
115
+ if (strippedLead.length >= 15 && !incompleteEndingRegex.test(strippedLead)) {
116
+ cleaned = `${strippedLead}. ${fallbackDesc}`;
117
+ }
118
+ else {
119
+ cleaned = fallbackDesc;
120
+ }
121
+ }
122
+ else {
123
+ cleaned = cleaned.replace(/[:;,–—\.]+\s*$/, '').trim();
124
+ if (!/[.!?]$/.test(cleaned)) {
125
+ cleaned += '.';
126
+ }
127
+ }
128
+ }
129
+ else {
130
+ cleaned = cleaned.replace(/[:;,–—]+\s*$/, '').trim();
131
+ if (!/[.!?]$/.test(cleaned)) {
132
+ cleaned += '.';
133
+ }
134
+ }
135
+ return cleaned;
136
+ }
34
137
  /**
35
138
  * Renders Claude Code-style Collapsible / Styled Thought Reasoning Box:
36
139
  * ╭── 💭 Scout Reasoning ──────────────────────────────────────────────────
37
140
  * │ Analyzing workspace files to identify the missing dependency...
38
141
  * ╰────────────────────────────────────────────────────────────────────────
39
142
  */
40
- export function renderThoughtBox(thought, step) {
41
- if (!thought || !thought.trim())
143
+ export function renderThoughtBox(thought, step, fallbackDesc) {
144
+ const completeThought = ensureCompleteSentence(thought, fallbackDesc);
145
+ if (!completeThought || !completeThought.trim())
42
146
  return;
43
147
  const width = getTerminalWidth();
44
148
  const stepLabel = step ? ` (Step ${step})` : '';
45
149
  const headerTitle = `💭 Scout Reasoning${stepLabel}`;
46
150
  const header = `╭── ${chalk.bold.yellow(headerTitle)} ${'─'.repeat(Math.max(4, width - headerTitle.length - 8))}`;
47
151
  console.log(chalk.yellow(header));
48
- const lines = thought.trim().split('\n');
49
- for (const l of lines) {
50
- // Subtle indent with yellow border
51
- console.log(`${chalk.yellow('│')} ${chalk.dim(l)}`);
152
+ const rawLines = completeThought.trim().split('\n');
153
+ const maxContentWidth = Math.max(20, width - 6);
154
+ for (const line of rawLines) {
155
+ const trimmed = line.trimEnd();
156
+ if (!trimmed) {
157
+ console.log(chalk.yellow('│'));
158
+ continue;
159
+ }
160
+ if (trimmed.length <= maxContentWidth) {
161
+ console.log(`${chalk.yellow('│')} ${chalk.dim(trimmed)}`);
162
+ }
163
+ else {
164
+ // Word wrap long sentences cleanly inside the thought box border
165
+ const words = trimmed.split(/\s+/);
166
+ let currentLine = '';
167
+ for (const word of words) {
168
+ if ((currentLine + ' ' + word).trim().length > maxContentWidth) {
169
+ if (currentLine) {
170
+ console.log(`${chalk.yellow('│')} ${chalk.dim(currentLine.trim())}`);
171
+ }
172
+ currentLine = word;
173
+ }
174
+ else {
175
+ currentLine = currentLine ? `${currentLine} ${word}` : word;
176
+ }
177
+ }
178
+ if (currentLine) {
179
+ console.log(`${chalk.yellow('│')} ${chalk.dim(currentLine.trim())}`);
180
+ }
181
+ }
52
182
  }
53
183
  console.log(chalk.yellow(`╰${'─'.repeat(width)}`));
54
184
  }
@@ -105,7 +105,7 @@ export async function startQrPairingSession() {
105
105
  const pairingCode = `SCT-${rawNum}`;
106
106
  const sessionId = `sct_sess_${Date.now().toString(36)}_${crypto.randomBytes(3).toString('hex')}`;
107
107
  const hostName = os.hostname() || 'workstation.local';
108
- const version = '9.5.5';
108
+ const version = '9.5.7';
109
109
  let localIp = '127.0.0.1';
110
110
  try {
111
111
  const nets = os.networkInterfaces();
@@ -52,7 +52,7 @@ export function collectSanitizedDiagnostics() {
52
52
  catch { }
53
53
  }
54
54
  return {
55
- scoutVersion: '9.5.5',
55
+ scoutVersion: '9.5.7',
56
56
  nodeVersion: process.version,
57
57
  platform: process.platform,
58
58
  osRelease: os.release(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ft-scout",
3
- "version": "9.5.5",
3
+ "version": "9.5.7",
4
4
  "type": "module",
5
5
  "description": "FrontTerrain — The Onboarding Co-Pilot for New Codebases",
6
6
  "main": "bin/src/index.js",
@@ -17,7 +17,7 @@
17
17
  "AUTONOMOUS_FEATURES.md"
18
18
  ],
19
19
  "scripts": {
20
- "test": "tsx test/agent.test.ts",
20
+ "test": "tsx test/agent.test.ts && tsx test/browserObserver.test.ts && tsx test/browserActionEngine.test.ts && tsx test/computerUseLoop.test.ts && tsx test/verificationRecovery.test.ts && tsx test/computerDesktop.test.ts && tsx test/unifiedToolRouter.test.ts && tsx test/safetyPolicy.test.ts && tsx test/harpProduction.test.ts",
21
21
  "build": "tsc",
22
22
  "prepublishOnly": "npm run build"
23
23
  },