Skip to content

Commit ca86c7b

Browse files
committed
More progress
1 parent 71b210c commit ca86c7b

File tree

3 files changed

+19
-7
lines changed

3 files changed

+19
-7
lines changed

packages/cloud/src/bridge/BaseChannel.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import type { Socket } from "socket.io-client"
22
import * as vscode from "vscode"
33

4-
import { StaticAppProperties } from "@roo-code/types"
4+
import type { StaticAppProperties, GitProperties } from "@roo-code/types"
55

66
export interface BaseChannelOptions {
77
instanceId: string
88
appProperties: StaticAppProperties
9+
gitProperties?: GitProperties
910
}
1011

1112
/**
@@ -20,10 +21,12 @@ export abstract class BaseChannel<TCommand = unknown, TEventName extends string
2021
protected socket: Socket | null = null
2122
protected readonly instanceId: string
2223
protected readonly appProperties: StaticAppProperties
24+
protected readonly gitProperties?: GitProperties
2325

2426
constructor(options: BaseChannelOptions) {
2527
this.instanceId = options.instanceId
2628
this.appProperties = options.appProperties
29+
this.gitProperties = options.gitProperties
2730
}
2831

2932
/**

packages/cloud/src/bridge/BridgeOrchestrator.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
type ExtensionBridgeCommand,
99
type TaskBridgeCommand,
1010
type StaticAppProperties,
11+
type GitProperties,
1112
ConnectionState,
1213
ExtensionSocketEvents,
1314
TaskSocketEvents,
@@ -42,6 +43,7 @@ export class BridgeOrchestrator {
4243
private readonly provider: TaskProviderLike
4344
private readonly instanceId: string
4445
private readonly appProperties: StaticAppProperties
46+
private readonly gitProperties?: GitProperties
4547

4648
// Components
4749
private socketTransport: SocketTransport
@@ -79,6 +81,9 @@ export class BridgeOrchestrator {
7981
if (!instance) {
8082
try {
8183
console.log(`[BridgeOrchestrator#connectOrDisconnect] Connecting...`)
84+
// Populate telemetry properties before registering the instance.
85+
await options.provider.getTelemetryProperties()
86+
8287
BridgeOrchestrator.instance = new BridgeOrchestrator(options)
8388
await BridgeOrchestrator.instance.connect()
8489
} catch (error) {
@@ -153,6 +158,7 @@ export class BridgeOrchestrator {
153158
this.provider = options.provider
154159
this.instanceId = options.sessionId || crypto.randomUUID()
155160
this.appProperties = { ...options.provider.appProperties, hostname: os.hostname() }
161+
this.gitProperties = options.provider.gitProperties
156162

157163
this.socketTransport = new SocketTransport({
158164
url: this.socketBridgeUrl,
@@ -176,13 +182,15 @@ export class BridgeOrchestrator {
176182
this.extensionChannel = new ExtensionChannel({
177183
instanceId: this.instanceId,
178184
appProperties: this.appProperties,
185+
gitProperties: this.gitProperties,
179186
userId: this.userId,
180187
provider: this.provider,
181188
})
182189

183190
this.taskChannel = new TaskChannel({
184191
instanceId: this.instanceId,
185192
appProperties: this.appProperties,
193+
gitProperties: this.gitProperties,
186194
})
187195
}
188196

@@ -304,9 +312,6 @@ export class BridgeOrchestrator {
304312
}
305313

306314
private async connect(): Promise<void> {
307-
// Populate the app and git properties before registering the instance.
308-
await this.provider.getTelemetryProperties()
309-
310315
await this.socketTransport.connect()
311316
this.setupSocketListeners()
312317
}

packages/cloud/src/bridge/ExtensionChannel.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,11 @@ export class ExtensionChannel extends BaseChannel<
3737
private eventListeners: Map<RooCodeEventName, (...args: unknown[]) => void> = new Map()
3838

3939
constructor(options: ExtensionChannelOptions) {
40-
super({ instanceId: options.instanceId, appProperties: options.appProperties })
40+
super({
41+
instanceId: options.instanceId,
42+
appProperties: options.appProperties,
43+
gitProperties: options.gitProperties,
44+
})
4145

4246
this.userId = options.userId
4347
this.provider = options.provider
@@ -46,8 +50,8 @@ export class ExtensionChannel extends BaseChannel<
4650
instanceId: this.instanceId,
4751
userId: this.userId,
4852
workspacePath: this.provider.cwd,
49-
appProperties: this.provider.appProperties,
50-
gitProperties: this.provider.gitProperties,
53+
appProperties: this.appProperties,
54+
gitProperties: this.gitProperties,
5155
lastHeartbeat: Date.now(),
5256
task: { taskId: "", taskStatus: TaskStatus.None },
5357
taskHistory: [],

0 commit comments

Comments
 (0)