Skip to content

Commit 247e050

Browse files
author
Eric Oliver
committed
cleanup
1 parent d860855 commit 247e050

File tree

4 files changed

+32
-21
lines changed

4 files changed

+32
-21
lines changed

src/api/providers/human-relay.ts

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -139,28 +139,33 @@ async function showHumanRelayDialog(promptText: string): Promise<string | undefi
139139
}
140140

141141
// VSCode mode - use command-based dialog
142-
return new Promise<string | undefined>(async (resolve) => {
142+
return new Promise<string | undefined>((resolve) => {
143143
// Create a unique request ID.
144144
const requestId = Date.now().toString()
145145

146-
try {
147-
const platformServices = await getPlatformServices()
148-
149-
// Register a global callback function.
150-
await platformServices.commandExecutor.executeCommand(
151-
getCommand("registerHumanRelayCallback"),
152-
requestId,
153-
(response: string | undefined) => resolve(response),
154-
)
155-
156-
// Open the dialog box directly using the current panel.
157-
await platformServices.commandExecutor.executeCommand(getCommand("showHumanRelayDialog"), {
158-
requestId,
159-
promptText,
160-
})
161-
} catch (error) {
162-
console.error("Failed to show human relay dialog:", error)
163-
resolve(undefined)
146+
const setupPromise = async () => {
147+
try {
148+
const platformServices = await getPlatformServices()
149+
150+
// Register a global callback function.
151+
await platformServices.commandExecutor.executeCommand(
152+
getCommand("registerHumanRelayCallback"),
153+
requestId,
154+
(response: string | undefined) => resolve(response),
155+
)
156+
157+
// Open the dialog box directly using the current panel.
158+
await platformServices.commandExecutor.executeCommand(getCommand("showHumanRelayDialog"), {
159+
requestId,
160+
promptText,
161+
})
162+
} catch (error) {
163+
console.error("Failed to show human relay dialog:", error)
164+
resolve(undefined)
165+
}
164166
}
167+
168+
// Call the async setup function
169+
setupPromise()
165170
})
166171
}

src/cli/__mocks__/@roo-code/telemetry.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-env node */
12
// Mock telemetry module for CLI context
23

34
class BaseTelemetryClient {
@@ -20,6 +21,7 @@ class MockTelemetryService {
2021
captureSchemaValidationError() {}
2122
}
2223

24+
// eslint-disable-next-line no-undef
2325
module.exports = {
2426
BaseTelemetryClient,
2527
TelemetryService: MockTelemetryService,

src/cli/__mocks__/vscode.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1+
/* eslint-env node */
12
// Mock VSCode module for CLI context
3+
// eslint-disable-next-line no-undef
24
module.exports = {
35
workspace: {
46
getConfiguration: () => ({

src/core/adapters/PlatformServiceFactory.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,16 @@ export class PlatformServiceFactory {
2121
this.context = context
2222

2323
switch (context) {
24-
case PlatformContext.VSCode:
24+
case PlatformContext.VSCode: {
2525
const { VsCodePlatformServices } = await import("./vscode/VsCodePlatformServices")
2626
this.instance = new VsCodePlatformServices(extensionName)
2727
break
28-
case PlatformContext.CLI:
28+
}
29+
case PlatformContext.CLI: {
2930
const { CliPlatformServices } = await import("./cli/CliPlatformServices")
3031
this.instance = new CliPlatformServices(extensionName, configPath)
3132
break
33+
}
3234
default:
3335
throw new Error(`Unsupported platform context: ${context}`)
3436
}

0 commit comments

Comments
 (0)