Skip to content

Commit 59f1aad

Browse files
committed
refactor: rename agentId param to chatId
Avoids confusion with the workspace agent param that the /open deep link already accepts.
1 parent 444bf4d commit 59f1aad

File tree

4 files changed

+22
-23
lines changed

4 files changed

+22
-23
lines changed

src/core/mementoManager.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -59,26 +59,26 @@ export class MementoManager {
5959
}
6060

6161
/**
62-
* Store a chat agent ID to open after a window reload.
62+
* Store a chat ID to open after a window reload.
6363
* Used by the /open deep link handler: it must call
6464
* commands.open() which triggers a remote-authority
65-
* reload, wiping in-memory state. The agent ID is
65+
* reload, wiping in-memory state. The chat ID is
6666
* persisted here so the extension can pick it up on
6767
* the other side of the reload.
6868
*/
69-
public async setPendingChatAgentId(agentId: string): Promise<void> {
70-
await this.memento.update("pendingChatAgentId", agentId);
69+
public async setPendingChatId(chatId: string): Promise<void> {
70+
await this.memento.update("pendingChatId", chatId);
7171
}
7272

7373
/**
74-
* Read and clear the pending chat agent ID. Returns
74+
* Read and clear the pending chat ID. Returns
7575
* undefined if none was stored.
7676
*/
77-
public async getAndClearPendingChatAgentId(): Promise<string | undefined> {
78-
const agentId = this.memento.get<string>("pendingChatAgentId");
79-
if (agentId !== undefined) {
80-
await this.memento.update("pendingChatAgentId", undefined);
77+
public async getAndClearPendingChatId(): Promise<string | undefined> {
78+
const chatId = this.memento.get<string>("pendingChatId");
79+
if (chatId !== undefined) {
80+
await this.memento.update("pendingChatId", undefined);
8181
}
82-
return agentId;
82+
return chatId;
8383
}
8484
}

src/extension.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -331,10 +331,9 @@ export async function activate(ctx: vscode.ExtensionContext): Promise<void> {
331331
// If a deep link stored a chat agent ID before the
332332
// remote-authority reload, open it now that the
333333
// deployment is configured.
334-
const pendingAgentId =
335-
await mementoManager.getAndClearPendingChatAgentId();
336-
if (pendingAgentId) {
337-
chatPanelProvider.openChat(pendingAgentId);
334+
const pendingChatId = await mementoManager.getAndClearPendingChatId();
335+
if (pendingChatId) {
336+
chatPanelProvider.openChat(pendingChatId);
338337
}
339338
}
340339
} catch (ex) {

src/uri/uriHandler.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,13 +89,13 @@ async function handleOpen(ctx: UriRouteContext): Promise<void> {
8989
params.has("openRecent") &&
9090
(!params.get("openRecent") || params.get("openRecent") === "true");
9191

92-
// Persist the chat agent ID before commands.open() triggers
92+
// Persist the chat ID before commands.open() triggers
9393
// a remote-authority reload that wipes in-memory state.
9494
// The extension picks this up after the reload in activate().
95-
const agentId = params.get("agentId");
96-
if (agentId) {
95+
const chatId = params.get("chatId");
96+
if (chatId) {
9797
const mementoManager = serviceContainer.getMementoManager();
98-
await mementoManager.setPendingChatAgentId(agentId);
98+
await mementoManager.setPendingChatId(chatId);
9999
}
100100

101101
await setupDeployment(params, serviceContainer, deploymentManager);

src/webviews/chat/chatPanelProvider.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export class ChatPanelProvider
2525

2626
private view?: vscode.WebviewView;
2727
private disposables: vscode.Disposable[] = [];
28-
private agentId: string | undefined;
28+
private chatId: string | undefined;
2929

3030
constructor(
3131
private readonly client: CoderApi,
@@ -35,8 +35,8 @@ export class ChatPanelProvider
3535
/**
3636
* Called by the `/openChat` URI handler.
3737
*/
38-
public openChat(agentId: string): void {
39-
this.agentId = agentId;
38+
public openChat(chatId: string): void {
39+
this.chatId = chatId;
4040
this.refresh();
4141
void vscode.commands.executeCommand("coder.chatPanel.focus");
4242
}
@@ -70,7 +70,7 @@ export class ChatPanelProvider
7070
}
7171
const webview = this.view.webview;
7272

73-
if (!this.agentId) {
73+
if (!this.chatId) {
7474
webview.html = this.getNoAgentHtml();
7575
return;
7676
}
@@ -81,7 +81,7 @@ export class ChatPanelProvider
8181
return;
8282
}
8383

84-
const embedUrl = `${coderUrl}/agents/${this.agentId}/embed`;
84+
const embedUrl = `${coderUrl}/agents/${this.chatId}/embed`;
8585
webview.html = this.getIframeHtml(embedUrl, coderUrl);
8686
}
8787

0 commit comments

Comments
 (0)