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
@@ -0,0 +1,282 @@
1
+ import {} from './types.js';
2
+ export class ActionPolicyEngine {
3
+ mode;
4
+ autoApproveLevel1;
5
+ approvalTimeoutMs;
6
+ destructivePatterns = [
7
+ /\brm\s+-rf\b/i,
8
+ /\bformat\b/i,
9
+ /\bdrop\s+table\b/i,
10
+ /\bdrop\s+database\b/i,
11
+ /\btruncate\b/i,
12
+ /\bdel\s+\/f\s+\/s\s+\/q\b/i,
13
+ /\bRemove-Item\s+.*-Recurse\s+-Force\b/i,
14
+ /\bgit\s+reset\s+--hard\b/i,
15
+ /\bgit\s+clean\s+-fdx\b/i,
16
+ ];
17
+ financialOrAuthKeywords = [
18
+ 'password', 'secret', 'token', 'apikey', 'credential',
19
+ 'credit_card', 'card_number', 'cvv', 'pay', 'purchase',
20
+ 'checkout', 'transfer', 'wire', 'invoice_pay', 'buy',
21
+ 'delete account', 'confirm purchase', 'pay now', 'buy now'
22
+ ];
23
+ constructor(config) {
24
+ this.mode = config?.mode ?? 'balanced';
25
+ this.autoApproveLevel1 = config?.autoApproveLevel1 ?? (this.mode === 'permissive' || this.mode === 'balanced');
26
+ this.approvalTimeoutMs = config?.approvalTimeoutMs ?? 30000;
27
+ }
28
+ setMode(mode) {
29
+ this.mode = mode;
30
+ if (mode === 'permissive') {
31
+ this.autoApproveLevel1 = true;
32
+ }
33
+ else if (mode === 'strict' || mode === 'readonly') {
34
+ this.autoApproveLevel1 = false;
35
+ }
36
+ }
37
+ getMode() {
38
+ return this.mode;
39
+ }
40
+ setAutoApproveLevel1(enabled) {
41
+ this.autoApproveLevel1 = enabled;
42
+ }
43
+ /**
44
+ * Evaluates a tool action and determines its risk level, allowance, and approval requirements.
45
+ */
46
+ evaluate(tool, args = {}, context) {
47
+ const toolLower = (tool || '').toLowerCase().trim();
48
+ // ---------------------------------------------------------------------
49
+ // 1. LEVEL 3: High-Impact Operations
50
+ // Purchases, financial actions, account/security changes, irreversible deletion
51
+ // ---------------------------------------------------------------------
52
+ // Irreversible deletion commands
53
+ if (toolLower === 'run_command') {
54
+ const cmd = String(args.command || args.cmd || '');
55
+ for (const pattern of this.destructivePatterns) {
56
+ if (pattern.test(cmd)) {
57
+ return this.createDecision(3, 'LEVEL_3_HIGH_IMPACT', false, true, `Destructive command with potential irreversible data loss: "${cmd}"`, {
58
+ actionTitle: 'Execute Destructive Command',
59
+ actionDescription: cmd,
60
+ target: args.cwd || 'workspace disk',
61
+ });
62
+ }
63
+ }
64
+ }
65
+ // Credential and secret file modifications
66
+ if (toolLower === 'write_file' || toolLower === 'edit_file' || toolLower === 'multi_edit_file') {
67
+ const p = String(args.path || args.filePath || '').toLowerCase();
68
+ if (p.includes('.env') || p.includes('id_rsa') || p.includes('credentials') || p.includes('secret') || p.includes('auth.json')) {
69
+ return this.createDecision(3, 'LEVEL_3_HIGH_IMPACT', false, true, `Modification of sensitive credential or security file: "${args.path}"`, {
70
+ actionTitle: 'Modify Security File',
71
+ actionDescription: `Writing changes to ${args.path}`,
72
+ target: args.path,
73
+ payloadPreview: typeof args.content === 'string' ? args.content.slice(0, 100) : undefined,
74
+ });
75
+ }
76
+ }
77
+ // Financial or account deletion actions via browser or desktop
78
+ if (toolLower === 'browser_click' || toolLower === 'computer_click' || toolLower === 'computer') {
79
+ const targetDesc = String(args.selectorOrText || args.target || args.ref || args.element || '').toLowerCase();
80
+ for (const kw of this.financialOrAuthKeywords) {
81
+ if (targetDesc.includes(kw)) {
82
+ return this.createDecision(3, 'LEVEL_3_HIGH_IMPACT', false, true, `Financial or account action involving: "${targetDesc}"`, {
83
+ actionTitle: 'Authorize High-Impact Action',
84
+ actionDescription: `Clicking sensitive control "${targetDesc}"`,
85
+ target: context?.activeUrl || context?.activeWindow || 'Desktop UI',
86
+ });
87
+ }
88
+ }
89
+ }
90
+ // Sensitive typing (passwords, tokens, financial inputs)
91
+ if (toolLower === 'browser_type' || toolLower === 'computer_type' || (toolLower === 'computer' && args.action === 'type')) {
92
+ const typedText = String(args.text || '').toLowerCase();
93
+ for (const kw of this.financialOrAuthKeywords) {
94
+ if (typedText.includes(kw)) {
95
+ return this.createDecision(3, 'LEVEL_3_HIGH_IMPACT', false, true, `Typing sensitive credentials or payment token`, {
96
+ actionTitle: 'Input Sensitive Data',
97
+ actionDescription: 'Typing sensitive credentials or payment tokens into UI input',
98
+ target: args.selectorOrText || context?.activeWindow || 'active window',
99
+ });
100
+ }
101
+ }
102
+ }
103
+ // ---------------------------------------------------------------------
104
+ // 2. LEVEL 2: External Side Effects
105
+ // Sending messages, submitting forms, publishing, deleting non-critical data, launching apps
106
+ // ---------------------------------------------------------------------
107
+ if (toolLower === 'run_command') {
108
+ const cmd = String(args.command || args.cmd || '');
109
+ if (/\bgit\s+push\b/i.test(cmd) || /\bnpm\s+publish\b/i.test(cmd) || /\bdeploy\b/i.test(cmd) || /\bcurl\s+-X\s+(POST|DELETE|PUT)\b/i.test(cmd)) {
110
+ return this.createDecision(2, 'LEVEL_2_SIDE_EFFECTS', false, true, `External publication or remote repository push: "${cmd}"`, {
111
+ actionTitle: 'Push or Publish to Remote',
112
+ actionDescription: cmd,
113
+ target: 'remote server / repository',
114
+ });
115
+ }
116
+ }
117
+ if (toolLower === 'git_pr') {
118
+ return this.createDecision(2, 'LEVEL_2_SIDE_EFFECTS', false, true, `Creating external pull request on remote repository`, {
119
+ actionTitle: 'Create Pull Request',
120
+ actionDescription: `Create PR: "${args.title || 'Automated PR'}"`,
121
+ target: 'remote Git origin',
122
+ });
123
+ }
124
+ if (toolLower === 'browser_click') {
125
+ const targetDesc = String(args.selectorOrText || args.target || '').toLowerCase();
126
+ if (targetDesc.includes('submit') || targetDesc.includes('send') || targetDesc.includes('publish') || targetDesc.includes('post') || targetDesc.includes('order')) {
127
+ return this.createDecision(2, 'LEVEL_2_SIDE_EFFECTS', false, true, `External web side effect: clicking "${targetDesc}"`, {
128
+ actionTitle: 'Submit Web Form / Send Message',
129
+ actionDescription: `Clicking button: "${args.selectorOrText || args.target}"`,
130
+ target: context?.activeUrl || 'active web page',
131
+ });
132
+ }
133
+ }
134
+ if (toolLower === 'browser_upload') {
135
+ return this.createDecision(2, 'LEVEL_2_SIDE_EFFECTS', false, true, `Uploading local file to external web service: "${args.filePath}"`, {
136
+ actionTitle: 'Upload Local File',
137
+ actionDescription: `Upload file ${args.filePath}`,
138
+ target: context?.activeUrl || 'external server',
139
+ });
140
+ }
141
+ if (toolLower === 'computer_open_app' || toolLower === 'computer_close_app' || (toolLower === 'computer' && (args.action === 'open_app' || args.action === 'close_app'))) {
142
+ const app = args.appName || args.app || args.windowTitleOrApp || 'desktop application';
143
+ return this.createDecision(2, 'LEVEL_2_SIDE_EFFECTS', false, true, `Desktop process control: ${args.action || toolLower} for "${app}"`, {
144
+ actionTitle: 'Launch or Terminate Desktop Application',
145
+ actionDescription: `${toolLower === 'computer_close_app' || args.action === 'close_app' ? 'Closing' : 'Launching'} ${app}`,
146
+ target: String(app),
147
+ });
148
+ }
149
+ // ---------------------------------------------------------------------
150
+ // 3. LEVEL 1: Reversible Modifications
151
+ // Editing workspace files, changing code, installing dev dependencies, git commit/branch
152
+ // ---------------------------------------------------------------------
153
+ if (toolLower === 'write_file' || toolLower === 'edit_file' || toolLower === 'multi_edit_file') {
154
+ const allows = this.mode !== 'readonly' && this.autoApproveLevel1;
155
+ return this.createDecision(1, 'LEVEL_1_REVERSIBLE', allows, !allows, `Reversible workspace file modification: "${args.path}"`, {
156
+ actionTitle: 'Edit Workspace File',
157
+ actionDescription: `Updating ${args.path}`,
158
+ target: args.path,
159
+ });
160
+ }
161
+ if (toolLower === 'git_commit' || toolLower === 'git_branch') {
162
+ const allows = this.mode !== 'readonly' && this.autoApproveLevel1;
163
+ return this.createDecision(1, 'LEVEL_1_REVERSIBLE', allows, !allows, `Local git change: ${toolLower}`, {
164
+ actionTitle: 'Local Git Commit or Branch',
165
+ actionDescription: `Executing ${toolLower}`,
166
+ target: 'local git workspace',
167
+ });
168
+ }
169
+ if (toolLower === 'run_command') {
170
+ const cmd = String(args.command || args.cmd || '');
171
+ const allows = this.mode !== 'readonly' && (this.autoApproveLevel1 || /\b(?:npm\s+test|vitest|jest|mocha|echo|pwd|dir|ls)\b/i.test(cmd));
172
+ return this.createDecision(1, 'LEVEL_1_REVERSIBLE', allows, !allows, `Executing local shell command: "${cmd.slice(0, 50)}"`, {
173
+ actionTitle: 'Run Shell Command',
174
+ actionDescription: cmd,
175
+ target: args.cwd || 'local terminal',
176
+ });
177
+ }
178
+ if (toolLower === 'computer_click' ||
179
+ toolLower === 'computer_type' ||
180
+ toolLower === 'computer_key_press' ||
181
+ toolLower === 'computer_hotkey' ||
182
+ toolLower === 'computer_drag' ||
183
+ toolLower === 'computer_switch_window' ||
184
+ toolLower === 'computer_switch_to_app' ||
185
+ (toolLower === 'computer' && ['click', 'type', 'key_press', 'hotkey', 'drag', 'switch_window'].includes(args.action))) {
186
+ const allows = this.mode !== 'readonly' && this.autoApproveLevel1;
187
+ return this.createDecision(1, 'LEVEL_1_REVERSIBLE', allows, !allows, `Operating desktop application UI controls`, {
188
+ actionTitle: 'Desktop UI Interaction',
189
+ actionDescription: `Executing ${toolLower} with action ${args.action || 'input'}`,
190
+ target: context?.activeWindow || 'desktop',
191
+ });
192
+ }
193
+ if (toolLower === 'browser_type' || toolLower === 'browser_click' || toolLower === 'browser_select' || toolLower === 'browser_scroll' || toolLower === 'browser_hover') {
194
+ const allows = this.mode !== 'readonly' && this.autoApproveLevel1;
195
+ return this.createDecision(1, 'LEVEL_1_REVERSIBLE', allows, !allows, `Standard web interaction: ${toolLower}`, {
196
+ actionTitle: 'Web Interaction',
197
+ actionDescription: `Interacting with web element`,
198
+ target: context?.activeUrl || 'browser',
199
+ });
200
+ }
201
+ // ---------------------------------------------------------------------
202
+ // 4. LEVEL 0: Read-Only Operations
203
+ // Browsing, searching, inspecting code, reading logs, screenshots
204
+ // Automatically allowed across all modes except if completely blocked
205
+ // ---------------------------------------------------------------------
206
+ return this.createDecision(0, 'LEVEL_0_READ_ONLY', true, false, `Read-only inspection operation: ${toolLower}`, {
207
+ actionTitle: 'Read-Only Inspection',
208
+ actionDescription: `Inspecting ${toolLower}`,
209
+ target: args.path || args.url || context?.activeUrl || 'workspace',
210
+ });
211
+ }
212
+ /**
213
+ * Formats the exact Just-In-Time UX prompt required by Phase 7:
214
+ *
215
+ * Scout wants to:
216
+ *
217
+ * [Action Description]
218
+ * "...."
219
+ *
220
+ * To:
221
+ * [Target]
222
+ *
223
+ * [Approve] [Reject]
224
+ */
225
+ renderJitPrompt(decision, tool, args) {
226
+ const details = decision.promptDetails;
227
+ const actionDesc = details?.actionDescription || `Execute ${tool}`;
228
+ const target = details?.target || 'target system';
229
+ const payload = details?.payloadPreview ? `\n"${details.payloadPreview}"\n` : '';
230
+ return [
231
+ `Scout wants to:`,
232
+ ``,
233
+ `${actionDesc}${payload ? '\n' + payload : ''}`,
234
+ ``,
235
+ `To:`,
236
+ `${target}`,
237
+ ``,
238
+ `[Approve] [Reject]`,
239
+ ].join('\n');
240
+ }
241
+ /**
242
+ * Authorizes an action immediately prior to execution (Just-in-Time).
243
+ */
244
+ async authorizeAction(tool, args = {}, context, userApprover) {
245
+ const decision = this.evaluate(tool, args, context);
246
+ // Level 0: Auto-approved
247
+ if (decision.riskLevel === 0) {
248
+ return { authorized: true, riskLevel: 0, reason: decision.reason };
249
+ }
250
+ // Level 1: Approved if autoApproveLevel1 is enabled
251
+ if (decision.riskLevel === 1 && decision.allowed && !decision.requiresApproval) {
252
+ return { authorized: true, riskLevel: 1, reason: decision.reason };
253
+ }
254
+ // Level 2 & 3 (or Level 1 in strict mode): Require immediate Just-in-Time approval
255
+ const promptText = this.renderJitPrompt(decision, tool, args);
256
+ if (userApprover) {
257
+ const approved = await userApprover(promptText);
258
+ return {
259
+ authorized: approved,
260
+ riskLevel: decision.riskLevel,
261
+ reason: approved ? 'Authorized by user decision.' : 'Denied by user.',
262
+ };
263
+ }
264
+ // In headless or test environments where no approver is injected
265
+ return {
266
+ authorized: false,
267
+ riskLevel: decision.riskLevel,
268
+ reason: `Action requires user confirmation (Risk Level ${decision.riskLevel}). No interactive approver provided.`,
269
+ };
270
+ }
271
+ createDecision(riskLevel, riskName, allowed, requiresApproval, reason, promptDetails) {
272
+ return {
273
+ allowed,
274
+ requiresApproval,
275
+ riskLevel,
276
+ riskName,
277
+ reason,
278
+ promptDetails,
279
+ };
280
+ }
281
+ }
282
+ //# sourceMappingURL=policyEngine.js.map
@@ -0,0 +1,24 @@
1
+ export type PolicyRiskLevel = 0 | 1 | 2 | 3;
2
+ export type RiskLevelName = 'LEVEL_0_READ_ONLY' | 'LEVEL_1_REVERSIBLE' | 'LEVEL_2_SIDE_EFFECTS' | 'LEVEL_3_HIGH_IMPACT';
3
+ export type PolicyMode = 'permissive' | 'balanced' | 'strict' | 'readonly';
4
+ export interface ActionPromptDetails {
5
+ actionTitle: string;
6
+ actionDescription: string;
7
+ target?: string | undefined;
8
+ payloadPreview?: string | undefined;
9
+ }
10
+ export interface PolicyDecision {
11
+ allowed: boolean;
12
+ requiresApproval: boolean;
13
+ riskLevel: PolicyRiskLevel;
14
+ riskName: RiskLevelName;
15
+ reason: string;
16
+ promptDetails?: ActionPromptDetails | undefined;
17
+ }
18
+ export interface ActionPolicyConfig {
19
+ mode?: PolicyMode | undefined;
20
+ autoApproveLevel1?: boolean | undefined;
21
+ allowedDomains?: string[] | undefined;
22
+ approvalTimeoutMs?: number | undefined;
23
+ }
24
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -52,4 +52,5 @@ export declare class ApprovalManager {
52
52
  resolveRequest(requestId: string, approved: boolean, reason?: string): boolean;
53
53
  getPendingRequests(): ApprovalRequest[];
54
54
  }
55
+ export * from './safety/index.js';
55
56
  //# sourceMappingURL=safety.d.ts.map
@@ -313,4 +313,5 @@ export class ApprovalManager {
313
313
  return Array.from(this.pendingRequests.values());
314
314
  }
315
315
  }
316
+ export * from './safety/index.js';
316
317
  //# sourceMappingURL=safety.js.map
@@ -199,8 +199,8 @@ ${req.context ? `[ADDITIONAL CONTEXT]\n${req.context}\n` : ''}
199
199
  [EXECUTION INSTRUCTIONS]
200
200
  1. Focus strictly on your assigned role and goal.
201
201
  2. Complete the necessary tool calls (reading, writing, editing, searching, testing) directly.
202
- 3. You have full access to workspace files and directories. Inspect local files using read_file or list_dir instead of asking the user.
203
- 4. Do NOT call ask_user — execute autonomously.
202
+ 3. You have full access to workspace files and directories. Inspect local files using read_file or list_dir.
203
+ 4. If you need user input, guidance, or clarification to proceed, call ask_user to ask the user directly.
204
204
  5. Call task_completed with a concise, professional summary of what you did and your key findings.
205
205
  `.trim();
206
206
  const execResult = await subAgent.executeGoal(scopedGoal);
@@ -1,4 +1,5 @@
1
1
  import { type ToolDefinition } from './agentEngine.js';
2
+ import { UnifiedToolRouter, type RouteIntent, type ToolRouterContext } from './tools/index.js';
2
3
  export interface ToolSelectionStrategyResult {
3
4
  selectedTool: string;
4
5
  level: 'api' | 'dom' | 'computer';
@@ -9,6 +10,7 @@ export declare const COMPUTER_USE_TOOLS: ToolDefinition[];
9
10
  export declare const SCRATCHPAD_TOOLS: ToolDefinition[];
10
11
  export declare class UnifiedToolRegistry {
11
12
  private toolsMap;
13
+ private router;
12
14
  constructor();
13
15
  getTool(name: string): ToolDefinition | undefined;
14
16
  getAllTools(): ToolDefinition[];
@@ -34,5 +36,7 @@ export declare class UnifiedToolRegistry {
34
36
  hasDesktopApp?: boolean;
35
37
  [key: string]: any;
36
38
  }): string;
39
+ getRouter(): UnifiedToolRouter;
40
+ routeIntent(goal: string, context?: ToolRouterContext): RouteIntent;
37
41
  }
38
42
  //# sourceMappingURL=toolRegistry.d.ts.map
@@ -1,4 +1,5 @@
1
1
  import { AGENT_TOOLS } from './agentEngine.js';
2
+ import { UnifiedToolRouter } from './tools/index.js';
2
3
  export const BROWSER_AUTOMATION_TOOLS = [
3
4
  {
4
5
  name: 'browser_navigate',
@@ -390,7 +391,9 @@ export const SCRATCHPAD_TOOLS = [
390
391
  ];
391
392
  export class UnifiedToolRegistry {
392
393
  toolsMap = new Map();
394
+ router;
393
395
  constructor() {
396
+ this.router = new UnifiedToolRouter();
394
397
  // Register all baseline tools (15 tools)
395
398
  for (const tool of AGENT_TOOLS) {
396
399
  this.toolsMap.set(tool.name, tool);
@@ -518,5 +521,11 @@ export class UnifiedToolRegistry {
518
521
  }
519
522
  return 'run_command';
520
523
  }
524
+ getRouter() {
525
+ return this.router;
526
+ }
527
+ routeIntent(goal, context) {
528
+ return this.router.route(goal, context);
529
+ }
521
530
  }
522
531
  //# sourceMappingURL=toolRegistry.js.map
@@ -0,0 +1,61 @@
1
+ import { type IToolHandler, type ToolDomain, type ToolRouterContext } from './types.js';
2
+ import { type IBrowserActionEngine } from '../browser/actions/types.js';
3
+ import { type BrowserObserver } from '../browser/observer/browserObserver.js';
4
+ import { type IComputerController } from '../computer/computerController.js';
5
+ export declare class BrowserHandler implements IToolHandler {
6
+ readonly domain: ToolDomain;
7
+ readonly supportedTools: string[];
8
+ private actionEngine?;
9
+ private observer?;
10
+ constructor(actionEngine?: IBrowserActionEngine | undefined, observer?: BrowserObserver | undefined);
11
+ canHandle(toolName: string): boolean;
12
+ execute(toolName: string, args: Record<string, any>, context?: ToolRouterContext | undefined): Promise<any>;
13
+ }
14
+ export declare class ComputerHandler implements IToolHandler {
15
+ readonly domain: ToolDomain;
16
+ readonly supportedTools: string[];
17
+ private computerController?;
18
+ constructor(computerController?: IComputerController | undefined);
19
+ canHandle(toolName: string): boolean;
20
+ execute(toolName: string, args: Record<string, any>, context?: ToolRouterContext | undefined): Promise<any>;
21
+ }
22
+ export type CommandExecutor = (command: string, cwd?: string | undefined) => Promise<{
23
+ stdout: string;
24
+ stderr: string;
25
+ exitCode: number;
26
+ }>;
27
+ export declare class TerminalHandler implements IToolHandler {
28
+ readonly domain: ToolDomain;
29
+ readonly supportedTools: string[];
30
+ private customExecutor?;
31
+ constructor(customExecutor?: CommandExecutor | undefined);
32
+ canHandle(toolName: string): boolean;
33
+ execute(toolName: string, args: Record<string, any>, context?: ToolRouterContext | undefined): Promise<any>;
34
+ }
35
+ export declare class FilesystemHandler implements IToolHandler {
36
+ readonly domain: ToolDomain;
37
+ readonly supportedTools: string[];
38
+ canHandle(toolName: string): boolean;
39
+ execute(toolName: string, args: Record<string, any>, context?: ToolRouterContext | undefined): Promise<any>;
40
+ }
41
+ export declare class GitHandler implements IToolHandler {
42
+ readonly domain: ToolDomain;
43
+ readonly supportedTools: string[];
44
+ private customGitRunner?;
45
+ constructor(customGitRunner?: ((cmd: string, args?: string[]) => Promise<any>) | undefined);
46
+ canHandle(toolName: string): boolean;
47
+ execute(toolName: string, args: Record<string, any>, context?: ToolRouterContext | undefined): Promise<any>;
48
+ }
49
+ export declare class SearchHandler implements IToolHandler {
50
+ readonly domain: ToolDomain;
51
+ readonly supportedTools: string[];
52
+ canHandle(toolName: string): boolean;
53
+ execute(toolName: string, args: Record<string, any>, context?: ToolRouterContext | undefined): Promise<any>;
54
+ }
55
+ export declare class ApiHandler implements IToolHandler {
56
+ readonly domain: ToolDomain;
57
+ readonly supportedTools: string[];
58
+ canHandle(toolName: string): boolean;
59
+ execute(toolName: string, args: Record<string, any>, context?: ToolRouterContext | undefined): Promise<any>;
60
+ }
61
+ //# sourceMappingURL=domainHandlers.d.ts.map