Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions src/@types/vscode.proposed.chatSessionsProvider.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,26 @@
*--------------------------------------------------------------------------------------------*/

declare module 'vscode' {
/**
* Represents the status of a chat session.
*/
export enum ChatSessionStatus {
/**
* The chat session failed to complete.
*/
Failed = 0,

/**
* The chat session completed successfully.
*/
Completed = 1,

/**
* The chat session is currently in progress.
*/
InProgress = 2
}

/**
* Provides a list of information about chat sessions.
*/
Expand Down Expand Up @@ -46,6 +66,21 @@ declare module 'vscode' {
* An icon for the participant shown in UI.
*/
iconPath?: IconPath;

/**
* An optional description that provides additional context about the chat session.
*/
description?: string | MarkdownString;

/**
* An optional status indicating the current state of the session.
*/
status?: ChatSessionStatus;

/**
* The tooltip text when you hover over this item.
*/
tooltip?: string | MarkdownString;
}

export interface ChatSession {
Expand Down
2 changes: 1 addition & 1 deletion src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ async function deferredActivate(context: vscode.ExtensionContext, showPRControll

Logger.debug('Creating tree view.', 'Activation');

const copilotRemoteAgentManager = new CopilotRemoteAgentManager(credentialStore, reposManager, telemetry);
const copilotRemoteAgentManager = new CopilotRemoteAgentManager(credentialStore, reposManager, telemetry, context);
context.subscriptions.push(copilotRemoteAgentManager);
if (vscode.chat?.registerChatSessionItemProvider) {
const provider = new class implements vscode.ChatSessionContentProvider, vscode.ChatSessionItemProvider {
Expand Down
9 changes: 7 additions & 2 deletions src/github/copilotRemoteAgent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { GitHubRemote } from '../common/remote';
import { CODING_AGENT, CODING_AGENT_AUTO_COMMIT_AND_PUSH } from '../common/settingKeys';
import { ITelemetry } from '../common/telemetry';
import { DataUri, toOpenPullRequestWebviewUri } from '../common/uri';
import { dateFromNow } from '../common/utils';
import { getIconForeground, getListErrorForeground, getListWarningForeground, getNotebookStatusSuccessIconForeground } from '../view/theme';
import { IAPISessionLogs, ICopilotRemoteAgentCommandArgs, ICopilotRemoteAgentCommandResponse, OctokitCommon, RemoteAgentResult, RepoInfo } from './common';
import { ChatSessionWithPR, CopilotApi, getCopilotApi, RemoteAgentJobPayload, SessionInfo, SessionSetupStep } from './copilotApi';
Expand All @@ -26,6 +27,7 @@ import { CredentialStore } from './credentials';
import { ReposManagerState } from './folderRepositoryManager';
import { GitHubRepository } from './githubRepository';
import { GithubItemStateEnum } from './interface';
import { issueMarkdown } from './markdownUtils';
import { PullRequestModel } from './pullRequestModel';
import { RepositoriesManager } from './repositoriesManager';

Expand Down Expand Up @@ -56,7 +58,7 @@ export class CopilotRemoteAgentManager extends Disposable {

private readonly gitOperationsManager: GitOperationsManager;

constructor(private credentialStore: CredentialStore, public repositoriesManager: RepositoriesManager, private telemetry: ITelemetry) {
constructor(private credentialStore: CredentialStore, public repositoriesManager: RepositoriesManager, private telemetry: ITelemetry, private context: vscode.ExtensionContext) {
super();
this.gitOperationsManager = new GitOperationsManager(CopilotRemoteAgentManager.ID);
this._register(this.credentialStore.onDidChangeSessions((e: vscode.AuthenticationSessionsChangeEvent) => {
Expand Down Expand Up @@ -658,11 +660,14 @@ export class CopilotRemoteAgentManager extends Disposable {
});
this._register(disposable);
}
const tooltip = await issueMarkdown(session, this.context, this.repositoriesManager);
return {
id: `${session.number}`,
label: session.title || `Session ${session.number}`,
iconPath: this.getIconForSession(status),
pullRequest: session
description: `${dateFromNow(session.createdAt)}`,
pullRequest: session,
tooltip,
};
}));
} catch (error) {
Expand Down
2 changes: 1 addition & 1 deletion src/test/github/copilotRemoteAgent.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ describe('CopilotRemoteAgentManager', function () {

mockRepo = new MockGitHubRepository(remote, credentialStore, telemetry, sinon);

manager = new CopilotRemoteAgentManager(credentialStore, reposManager, telemetry);
manager = new CopilotRemoteAgentManager(credentialStore, reposManager, telemetry, context);
Resource.initialize(context);
});

Expand Down
2 changes: 1 addition & 1 deletion src/test/view/prsTree.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ describe('GitHub Pull Requests view', function () {
telemetry,
);
credentialStore = new CredentialStore(telemetry, context);
copilotManager = new CopilotRemoteAgentManager(credentialStore, reposManager, telemetry);
copilotManager = new CopilotRemoteAgentManager(credentialStore, reposManager, telemetry, context);
provider = new PullRequestsTreeDataProvider(telemetry, context, reposManager, copilotManager);
createPrHelper = new CreatePullRequestHelper();

Expand Down
2 changes: 1 addition & 1 deletion src/test/view/reviewCommentController.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ describe('ReviewCommentController', function () {
repository = new MockRepository();
repository.addRemote('origin', 'git@github.com:aaa/bbb');
reposManager = new RepositoriesManager(credentialStore, telemetry);
copilotManager = new CopilotRemoteAgentManager(credentialStore, reposManager, telemetry);
copilotManager = new CopilotRemoteAgentManager(credentialStore, reposManager, telemetry, context);
provider = new PullRequestsTreeDataProvider(telemetry, context, reposManager, copilotManager);
const activePrViewCoordinator = new WebviewViewCoordinator(context);
const createPrHelper = new CreatePullRequestHelper();
Expand Down