Compare commits

...
Author SHA1 Message Date
Sarah Fortune 45d2411cc0 foo 2025-09-15 21:09:48 -07:00
Sarah Fortune 6b0bc377cc test 2025-09-15 20:33:19 -07:00
5 changed files with 35 additions and 30 deletions
+5 -1
View File
@@ -318,6 +318,10 @@ export abstract class WebviewProvider {
* @returns A URI pointing to the file/resource
*/
private getExtensionUri(...pathList: string[]): Uri {
return this.getWebviewUri(Uri.joinPath(this.context.extensionUri, ...pathList))
const uri = Uri.joinPath(this.context.extensionUri, ...pathList)
const res = this.getWebviewUri(uri)
console.log("sjfsjfsjf uri", uri.toString())
console.log("sjfsjfsjf res", res.toString())
return res
}
}
+5
View File
@@ -47,4 +47,9 @@ export const ExtensionRegistryInfo = {
publisher,
commands: ClineCommands,
views: ClineViewIds,
extensionLocation: "",
}
export function initializeExtensionRegistryInfo(extensionLocation: string) {
ExtensionRegistryInfo.extensionLocation = extensionLocation
}
+5 -8
View File
@@ -8,21 +8,18 @@ import { WebviewProvider } from "@/core/webview"
import { AuthHandler } from "@/hosts/external/AuthHandler"
import { HostProvider } from "@/hosts/host-provider"
import { DiffViewProvider } from "@/integrations/editor/DiffViewProvider"
import { initializeExtensionRegistryInfo } from "@/registry"
import { waitForHostBridgeReady } from "./hostbridge-client"
import { startProtobusService } from "./protobus-service"
import { log } from "./utils"
import { extensionContext } from "./vscode-context"
import { EXTENSION_DIR, extensionContext } from "./vscode-context"
async function main() {
log("\n\n\nStarting cline-core service...\n\n\n")
try {
await waitForHostBridgeReady()
log("HostBridge is serving; continuing startup")
} catch (err) {
log(`ERROR: HostBridge error: ${String(err)}`)
process.exit(1)
}
await waitForHostBridgeReady()
initializeExtensionRegistryInfo(EXTENSION_DIR)
setupHostProvider()
+19 -20
View File
@@ -5,36 +5,35 @@ import { log } from "./utils"
export const HOSTBRIDGE_PORT = 26041
export async function waitForHostBridgeReady(timeoutMs = 60000, intervalMs = 500, address?: string): Promise<void> {
const client = createHealthClient(address)
export async function waitForHostBridgeReady(timeoutMs = 60000, intervalMs = 500): Promise<void> {
const client = createHealthClient()
const deadline = Date.now() + timeoutMs
while (Date.now() < deadline) {
// eslint-disable-next-line no-await-in-loop
const ok = await checkHealthOnce(client)
if (ok) {
try {
client.close?.()
} catch {}
return
}
log("Waiting for hostbridge to be ready...")
// eslint-disable-next-line no-await-in-loop
await new Promise((r) => setTimeout(r, intervalMs))
}
try {
while (Date.now() < deadline) {
// eslint-disable-next-line no-await-in-loop
const ok = await checkHealthOnce(client)
if (ok) {
return
}
log("Waiting for hostbridge to be ready...")
// eslint-disable-next-line no-await-in-loop
await new Promise((r) => setTimeout(r, intervalMs))
}
} finally {
client.close?.()
} catch {}
throw new Error("HostBridge health check timed out")
}
console.error("HostBridge health check timed out")
process.exit(1)
}
// Client-side health check for the hostbridge service (kept at bottom for clarity)
const SERVING_STATUS = 1
function createHealthClient(address?: string) {
function createHealthClient() {
const healthDef = protoLoader.loadSync(health.protoPath)
const grpcObj = grpc.loadPackageDefinition(healthDef) as unknown as any
const Health = grpcObj.grpc.health.v1.Health
const target = address || process.env.HOST_BRIDGE_ADDRESS || `localhost:${HOSTBRIDGE_PORT}`
return new Health(target, grpc.credentials.createInsecure())
const address = process.env.HOST_BRIDGE_ADDRESS || `localhost:${HOSTBRIDGE_PORT}`
return new Health(address, grpc.credentials.createInsecure())
}
async function checkHealthOnce(client: any): Promise<boolean> {
+1 -1
View File
@@ -17,7 +17,7 @@ const INSTALL_DIR = process.env.INSTALL_DIR || __dirname
mkdirSync(DATA_DIR, { recursive: true })
log("Using settings dir:", DATA_DIR)
const EXTENSION_DIR = path.join(INSTALL_DIR, "extension")
export const EXTENSION_DIR = path.join(INSTALL_DIR, "extension")
const EXTENSION_MODE = process.env.IS_DEV === "true" ? ExtensionMode.Development : ExtensionMode.Production
const extension: Extension<void> = {