mirror of
https://github.com/cline/cline.git
synced 2026-09-12 00:50:27 +08:00
test
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,4 +47,9 @@ export const ExtensionRegistryInfo = {
|
||||
publisher,
|
||||
commands: ClineCommands,
|
||||
views: ClineViewIds,
|
||||
extensionLocation: "",
|
||||
}
|
||||
|
||||
export function initializeExtensionRegistryInfo(extensionLocation: string) {
|
||||
ExtensionRegistryInfo.extensionLocation = extensionLocation
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ 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"
|
||||
@@ -16,13 +17,9 @@ import { 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()
|
||||
|
||||
setupHostProvider()
|
||||
|
||||
|
||||
@@ -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> {
|
||||
|
||||
Reference in New Issue
Block a user