@generacy-ai/generacy-plugin-copilot 0.0.0-preview-20260304013206
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +191 -0
- package/README.md +140 -0
- package/dist/errors.d.ts +70 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +116 -0
- package/dist/errors.js.map +1 -0
- package/dist/github/client.d.ts +46 -0
- package/dist/github/client.d.ts.map +1 -0
- package/dist/github/client.js +165 -0
- package/dist/github/client.js.map +1 -0
- package/dist/github/types.d.ts +91 -0
- package/dist/github/types.d.ts.map +1 -0
- package/dist/github/types.js +7 -0
- package/dist/github/types.js.map +1 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +22 -0
- package/dist/index.js.map +1 -0
- package/dist/plugin/copilot-plugin.d.ts +90 -0
- package/dist/plugin/copilot-plugin.d.ts.map +1 -0
- package/dist/plugin/copilot-plugin.js +289 -0
- package/dist/plugin/copilot-plugin.js.map +1 -0
- package/dist/polling/status-poller.d.ts +36 -0
- package/dist/polling/status-poller.d.ts.map +1 -0
- package/dist/polling/status-poller.js +142 -0
- package/dist/polling/status-poller.js.map +1 -0
- package/dist/polling/types.d.ts +62 -0
- package/dist/polling/types.d.ts.map +1 -0
- package/dist/polling/types.js +16 -0
- package/dist/polling/types.js.map +1 -0
- package/dist/schemas.d.ts +341 -0
- package/dist/schemas.d.ts.map +1 -0
- package/dist/schemas.js +176 -0
- package/dist/schemas.js.map +1 -0
- package/dist/types.d.ts +161 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +21 -0
- package/dist/types.js.map +1 -0
- package/dist/workspace/types.d.ts +61 -0
- package/dist/workspace/types.d.ts.map +1 -0
- package/dist/workspace/types.js +7 -0
- package/dist/workspace/types.js.map +1 -0
- package/dist/workspace/workspace-manager.d.ts +65 -0
- package/dist/workspace/workspace-manager.d.ts.map +1 -0
- package/dist/workspace/workspace-manager.js +294 -0
- package/dist/workspace/workspace-manager.js.map +1 -0
- package/package.json +58 -0
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @generacy-ai/generacy-plugin-copilot
|
|
3
|
+
*
|
|
4
|
+
* GitHub API client wrapper using Octokit.
|
|
5
|
+
*/
|
|
6
|
+
import { Octokit } from '@octokit/rest';
|
|
7
|
+
import { GitHubAPIError } from '../errors.js';
|
|
8
|
+
const GITHUB_ISSUE_URL_REGEX = /^https:\/\/github\.com\/([^/]+)\/([^/]+)\/issues\/(\d+)$/;
|
|
9
|
+
/**
|
|
10
|
+
* Parse a GitHub issue URL into its components.
|
|
11
|
+
*/
|
|
12
|
+
export function parseIssueUrl(url) {
|
|
13
|
+
const match = url.match(GITHUB_ISSUE_URL_REGEX);
|
|
14
|
+
if (!match) {
|
|
15
|
+
throw new GitHubAPIError(`Invalid GitHub issue URL format: ${url}`);
|
|
16
|
+
}
|
|
17
|
+
return {
|
|
18
|
+
owner: match[1],
|
|
19
|
+
repo: match[2],
|
|
20
|
+
issueNumber: parseInt(match[3], 10),
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* GitHub API client for issue and PR operations.
|
|
25
|
+
*/
|
|
26
|
+
export class GitHubClient {
|
|
27
|
+
octokit;
|
|
28
|
+
constructor(config) {
|
|
29
|
+
this.octokit = new Octokit({
|
|
30
|
+
auth: config.token,
|
|
31
|
+
baseUrl: config.baseUrl,
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Get an issue by owner/repo/number.
|
|
36
|
+
*/
|
|
37
|
+
async getIssue(owner, repo, issueNumber) {
|
|
38
|
+
try {
|
|
39
|
+
const response = await this.octokit.issues.get({
|
|
40
|
+
owner,
|
|
41
|
+
repo,
|
|
42
|
+
issue_number: issueNumber,
|
|
43
|
+
});
|
|
44
|
+
return response.data;
|
|
45
|
+
}
|
|
46
|
+
catch (error) {
|
|
47
|
+
throw this.wrapOctokitError(error, `GET /repos/${owner}/${repo}/issues/${issueNumber}`);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* List pull requests linked to an issue.
|
|
52
|
+
*/
|
|
53
|
+
async listLinkedPullRequests(owner, repo, issueNumber) {
|
|
54
|
+
try {
|
|
55
|
+
// Search for PRs that mention this issue
|
|
56
|
+
const searchQuery = `repo:${owner}/${repo} is:pr ${issueNumber}`;
|
|
57
|
+
const response = await this.octokit.search.issuesAndPullRequests({
|
|
58
|
+
q: searchQuery,
|
|
59
|
+
per_page: 10,
|
|
60
|
+
});
|
|
61
|
+
// Filter to PRs that explicitly link to this issue
|
|
62
|
+
const linkedPRs = [];
|
|
63
|
+
for (const item of response.data.items) {
|
|
64
|
+
if (item.pull_request) {
|
|
65
|
+
const pr = await this.getPullRequest(owner, repo, item.number);
|
|
66
|
+
// Check if PR body references the issue
|
|
67
|
+
if (pr.body?.includes(`#${issueNumber}`) ||
|
|
68
|
+
pr.body?.includes(`issues/${issueNumber}`)) {
|
|
69
|
+
linkedPRs.push(pr);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return linkedPRs;
|
|
74
|
+
}
|
|
75
|
+
catch (error) {
|
|
76
|
+
throw this.wrapOctokitError(error, `search PRs for issue ${issueNumber}`);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Get a pull request by owner/repo/number.
|
|
81
|
+
*/
|
|
82
|
+
async getPullRequest(owner, repo, prNumber) {
|
|
83
|
+
try {
|
|
84
|
+
const response = await this.octokit.pulls.get({
|
|
85
|
+
owner,
|
|
86
|
+
repo,
|
|
87
|
+
pull_number: prNumber,
|
|
88
|
+
});
|
|
89
|
+
return response.data;
|
|
90
|
+
}
|
|
91
|
+
catch (error) {
|
|
92
|
+
throw this.wrapOctokitError(error, `GET /repos/${owner}/${repo}/pulls/${prNumber}`);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Get files changed in a pull request.
|
|
97
|
+
*/
|
|
98
|
+
async getPullRequestFiles(owner, repo, prNumber) {
|
|
99
|
+
try {
|
|
100
|
+
const response = await this.octokit.pulls.listFiles({
|
|
101
|
+
owner,
|
|
102
|
+
repo,
|
|
103
|
+
pull_number: prNumber,
|
|
104
|
+
per_page: 100,
|
|
105
|
+
});
|
|
106
|
+
return response.data;
|
|
107
|
+
}
|
|
108
|
+
catch (error) {
|
|
109
|
+
throw this.wrapOctokitError(error, `GET /repos/${owner}/${repo}/pulls/${prNumber}/files`);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Get reviews for a pull request.
|
|
114
|
+
*/
|
|
115
|
+
async getPullRequestReviews(owner, repo, prNumber) {
|
|
116
|
+
try {
|
|
117
|
+
const response = await this.octokit.pulls.listReviews({
|
|
118
|
+
owner,
|
|
119
|
+
repo,
|
|
120
|
+
pull_number: prNumber,
|
|
121
|
+
per_page: 100,
|
|
122
|
+
});
|
|
123
|
+
return response.data;
|
|
124
|
+
}
|
|
125
|
+
catch (error) {
|
|
126
|
+
throw this.wrapOctokitError(error, `GET /repos/${owner}/${repo}/pulls/${prNumber}/reviews`);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Get file content from a repository.
|
|
131
|
+
*/
|
|
132
|
+
async getFileContent(owner, repo, path, ref) {
|
|
133
|
+
try {
|
|
134
|
+
const response = await this.octokit.repos.getContent({
|
|
135
|
+
owner,
|
|
136
|
+
repo,
|
|
137
|
+
path,
|
|
138
|
+
ref,
|
|
139
|
+
});
|
|
140
|
+
const data = response.data;
|
|
141
|
+
if ('content' in data && data.encoding === 'base64') {
|
|
142
|
+
return Buffer.from(data.content, 'base64').toString('utf-8');
|
|
143
|
+
}
|
|
144
|
+
throw new GitHubAPIError(`Unexpected response format for file content: ${path}`);
|
|
145
|
+
}
|
|
146
|
+
catch (error) {
|
|
147
|
+
if (error instanceof GitHubAPIError)
|
|
148
|
+
throw error;
|
|
149
|
+
throw this.wrapOctokitError(error, `GET /repos/${owner}/${repo}/contents/${path}`);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Convert Octokit errors to GitHubAPIError.
|
|
154
|
+
*/
|
|
155
|
+
wrapOctokitError(error, endpoint) {
|
|
156
|
+
if (error instanceof GitHubAPIError) {
|
|
157
|
+
return error;
|
|
158
|
+
}
|
|
159
|
+
const octokitError = error;
|
|
160
|
+
const statusCode = octokitError.status;
|
|
161
|
+
const message = octokitError.message ?? 'Unknown GitHub API error';
|
|
162
|
+
return new GitHubAPIError(message, statusCode, endpoint);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/github/client.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAU9C,MAAM,sBAAsB,GAAG,0DAA0D,CAAC;AAE1F;;GAEG;AACH,MAAM,UAAU,aAAa,CAAC,GAAW;IACvC,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,sBAAsB,CAAC,CAAC;IAChD,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,IAAI,cAAc,CAAC,oCAAoC,GAAG,EAAE,CAAC,CAAC;IACtE,CAAC;IACD,OAAO;QACL,KAAK,EAAE,KAAK,CAAC,CAAC,CAAE;QAChB,IAAI,EAAE,KAAK,CAAC,CAAC,CAAE;QACf,WAAW,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAE,EAAE,EAAE,CAAC;KACrC,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,OAAO,YAAY;IACN,OAAO,CAAU;IAElC,YAAY,MAA0B;QAC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jD,MAAM,IAAI,CAAC,gBAAgB,CAAC,KAAK,EAAE,cAAc,KAAK,IAAI,IAAI,aAAa,IAAI,EAAE,CAAC,CAAC;QACrF,CAAC;IACH,CAAC;IAED;;OAEG;IACK,gBAAgB,CAAC,KAAc,EAAE,QAAgB;QACvD,IAAI,KAAK,YAAY,cAAc,EAAE,CAAC;YACpC,OAAO,KAAK,CAAC;QACf,CAAC;QAED,MAAM,YAAY,GAAG,KAA8C,CAAC;QACpE,MAAM,UAAU,GAAG,YAAY,CAAC,MAAM,CAAC;QACvC,MAAM,OAAO,GAAG,YAAY,CAAC,OAAO,IAAI,0BAA0B,CAAC;QAEnE,OAAO,IAAI,cAAc,CAAC,OAAO,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC;IAC3D,CAAC;CACF"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @generacy-ai/generacy-plugin-copilot
|
|
3
|
+
*
|
|
4
|
+
* GitHub-specific type definitions.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* GitHub issue data from API.
|
|
8
|
+
*/
|
|
9
|
+
export interface GitHubIssue {
|
|
10
|
+
id: number;
|
|
11
|
+
number: number;
|
|
12
|
+
title: string;
|
|
13
|
+
body: string | null;
|
|
14
|
+
state: 'open' | 'closed';
|
|
15
|
+
html_url: string;
|
|
16
|
+
labels: Array<{
|
|
17
|
+
name: string;
|
|
18
|
+
}>;
|
|
19
|
+
created_at: string;
|
|
20
|
+
updated_at: string;
|
|
21
|
+
closed_at: string | null;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* GitHub pull request data from API.
|
|
25
|
+
*/
|
|
26
|
+
export interface GitHubPullRequest {
|
|
27
|
+
id: number;
|
|
28
|
+
number: number;
|
|
29
|
+
title: string;
|
|
30
|
+
body: string | null;
|
|
31
|
+
state: 'open' | 'closed';
|
|
32
|
+
html_url: string;
|
|
33
|
+
head: {
|
|
34
|
+
ref: string;
|
|
35
|
+
sha: string;
|
|
36
|
+
};
|
|
37
|
+
base: {
|
|
38
|
+
ref: string;
|
|
39
|
+
sha: string;
|
|
40
|
+
};
|
|
41
|
+
merged: boolean;
|
|
42
|
+
mergeable: boolean | null;
|
|
43
|
+
mergeable_state: string;
|
|
44
|
+
additions: number;
|
|
45
|
+
deletions: number;
|
|
46
|
+
changed_files: number;
|
|
47
|
+
created_at: string;
|
|
48
|
+
updated_at: string;
|
|
49
|
+
merged_at: string | null;
|
|
50
|
+
closed_at: string | null;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* GitHub file change from PR.
|
|
54
|
+
*/
|
|
55
|
+
export interface GitHubPRFile {
|
|
56
|
+
filename: string;
|
|
57
|
+
status: 'added' | 'removed' | 'modified' | 'renamed' | 'copied' | 'changed' | 'unchanged';
|
|
58
|
+
previous_filename?: string;
|
|
59
|
+
additions: number;
|
|
60
|
+
deletions: number;
|
|
61
|
+
changes: number;
|
|
62
|
+
patch?: string;
|
|
63
|
+
contents_url: string;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* GitHub review data.
|
|
67
|
+
*/
|
|
68
|
+
export interface GitHubReview {
|
|
69
|
+
id: number;
|
|
70
|
+
user: {
|
|
71
|
+
login: string;
|
|
72
|
+
};
|
|
73
|
+
state: 'PENDING' | 'APPROVED' | 'CHANGES_REQUESTED' | 'COMMENTED' | 'DISMISSED';
|
|
74
|
+
submitted_at: string;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Parsed issue URL components.
|
|
78
|
+
*/
|
|
79
|
+
export interface ParsedIssueUrl {
|
|
80
|
+
owner: string;
|
|
81
|
+
repo: string;
|
|
82
|
+
issueNumber: number;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* GitHub client configuration.
|
|
86
|
+
*/
|
|
87
|
+
export interface GitHubClientConfig {
|
|
88
|
+
token: string;
|
|
89
|
+
baseUrl?: string;
|
|
90
|
+
}
|
|
91
|
+
//# sourceM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ACnB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,OAAO,GAAG,SAAS,GAAG,UAAU,GAAG,SAAS,GAAG,QAAQ,GAAG,SAAS,GAAG,WAAW,CAAC;IAC1F,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IACxB,KAAK,EAAE,SAAS,GAAG,UAAU,GAAG,mBAAmB,GAAG,WAAW,GAAG,WAAW,CAAC;IAChF,YAAY,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/github/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @generacy-ai/generacy-plugin-copilot
|
|
3
|
+
*
|
|
4
|
+
* GitHub Copilot Workspace agent platform plugin for Generacy.
|
|
5
|
+
* Provides tracking and monitoring of Copilot Workspace sessions.
|
|
6
|
+
*/
|
|
7
|
+
export type { Workspace, WorkspaceStatus, WorkspaceStatusEvent, CreateWorkspaceParams, WorkspaceOptions, FileChange, PullRequest, PollingConfig, CopilotPluginOptions, ErrorCode, PluginErrorData, CopilotPluginInterface, } from './types.js';
|
|
8
|
+
export { isTerminalStatus, isActiveStatus } from './types.js';
|
|
9
|
+
export { WorkspaceStatusSchema, FileChangeTypeSchema, PullRequestStateSchema, ReviewStatusSchema, WorkspaceOptionsSchema, CreateWorkspaceParamsSchema, PollingConfigSchema, GitHubTokenSchema, CopilotPluginOptionsSchema, FileChangeSchema, PullRequestSchema, WorkspaceSchema, WorkspaceStatusEventSchema, } from './schemas.js';
|
|
10
|
+
export { PluginError, WorkspaceNotFoundError, WorkspaceInvalidStateError, GitHubAPIError, PollingTimeoutError, NotImplementedError, isPluginError, wrapError, } from './errors.js';
|
|
11
|
+
export { CopilotPlugin } from './plugin/copilot-plugin.js';
|
|
12
|
+
export { GitHubClient, parseIssueUrl } from './github/client.js';
|
|
13
|
+
export type { GitHubClientConfig, GitHubIssue, GitHubPullRequest, GitHubPRFile, GitHubReview, ParsedIssueUrl, } from './github/types.js';
|
|
14
|
+
export { StatusPoller, createStatusPoller } from './polling/status-poller.js';
|
|
15
|
+
export { DEFAULT_POLLING_CONFIG } from './polling/types.js';
|
|
16
|
+
export type { PollState, PollResult, StatusChecker, StatusCallback } from './polling/types.js';
|
|
17
|
+
export { WorkspaceManager } from './workspace/workspace-manager.js';
|
|
18
|
+
export type { InternalWorkspace, StatusInference, WorkspaceStore, } from './workspace/types.js';
|
|
19
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,YAAY,EAEV,SAAS,EACT,eAAe,EACf,oBAAoB,EAEpB,qBAAqB,EACrB,gBAAgB,E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copilot Workspace agent platform plugin for Generacy.
|
|
5
|
+
* Provides tracking and monitoring of Copilot Workspace sessions.
|
|
6
|
+
*/
|
|
7
|
+
// Type guards
|
|
8
|
+
export { isTerminalStatus, isActiveStatus } from './types.js';
|
|
9
|
+
// Validation schemas
|
|
10
|
+
export { WorkspaceStatusSchema, FileChangeTypeSchema, PullRequestStateSchema, ReviewStatusSchema, WorkspaceOptionsSchema, CreateWorkspaceParamsSchema, PollingConfigSchema, GitHubTokenSchema, CopilotPluginOptionsSchema, FileChangeSchema, PullRequestSchema, WorkspaceSchema, WorkspaceStatusEventSchema, } from './schemas.js';
|
|
11
|
+
// Error classes
|
|
12
|
+
export { PluginError, WorkspaceNotFoundError, WorkspaceInvalidStateError, GitHubAPIError, PollingTimeoutError, NotImplementedError, isPluginError, wrapError, } from './errors.js';
|
|
13
|
+
// Main plugin class
|
|
14
|
+
export { CopilotPlugin } from './plugin/copilot-plugin.js';
|
|
15
|
+
// GitHub utilities
|
|
16
|
+
export { GitHubClient, parseIssueUrl } from './github/client.js';
|
|
17
|
+
// Polling utilities
|
|
18
|
+
export { StatusPoller, createStatusPoller } from './polling/status-poller.js';
|
|
19
|
+
export { DEFAULT_POLLING_CONFIG } from './polling/types.js';
|
|
20
|
+
// Workspace utilities
|
|
21
|
+
export { WorkspaceManager } from './workspace/workspace-manager.js';
|
|
22
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAwBH,cAAc;AACd,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE9D,qBAAqB;AACrB,OAAO,EACL,qBAAqB,EACrB,oBAAoB,EACpB,sBAAsB,EACtB,kBAAkB,EAClB,sBAAsB,EACtB,2BAA2B,EAC3B,mBAAmB,EACnB,iBAAiB,EACjB,0BAA0B,EAC1B,gBAAgB,EAChB,iBAAiB,EACjB,eAAe,EACf,0BAA0B,GAC3B,MAAM,cAAc,CAAC;AAEtB,gBAAgB;AAChB,OAAO,EACL,WAAW,EACX,sBAAsB,EACtB,0BAA0B,EAC1B,cAAc,EACd,mBAAmB,EACnB,mBAAmB,EACnB,aAAa,EACb,SAAS,GACV,MAAM,aAAa,CAAC;AAErB,oBAAoB;AACpB,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAE3D,mBAAmB;AACnB,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAUjE,oBAAoB;AACpB,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAC9E,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAG5D,sBAAsB;AACtB,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @generacy-ai/generacy-plugin-copilot
|
|
3
|
+
*
|
|
4
|
+
* Main plugin class extending AbstractDevAgentPlugin and implementing CopilotPluginInterface.
|
|
5
|
+
*/
|
|
6
|
+
import type { AgentResult, AgentCapabilities, StreamChunk } from '@generacy-ai/latency';
|
|
7
|
+
import { AbstractDevAgentPlugin, type InternalInvokeOptions } from '@generacy-ai/latency-plugin-dev-agent';
|
|
8
|
+
import type { CopilotPluginInterface, CopilotPluginOptions, CreateWorkspaceParams, FileChange, PullRequest, Workspace, WorkspaceStatus, WorkspaceStatusEvent } from '../types.js';
|
|
9
|
+
/**
|
|
10
|
+
* GitHub Copilot Workspace plugin for Generacy.
|
|
11
|
+
*
|
|
12
|
+
* Extends AbstractDevAgentPlugin to provide the standard DevAgent interface
|
|
13
|
+
* while also exposing Copilot Workspace-specific functionality.
|
|
14
|
+
*
|
|
15
|
+
* Note: Due to the lack of a public Copilot Workspace API, this plugin
|
|
16
|
+
* operates in a tracking/monitoring mode, inferring workspace status
|
|
17
|
+
* from GitHub Issues and Pull Requests. The DevAgent interface methods
|
|
18
|
+
* (`invoke`, `invokeStream`) create workspaces and monitor them to completion.
|
|
19
|
+
*/
|
|
20
|
+
export declare class CopilotPlugin extends AbstractDevAgentPlugin implements CopilotPluginInterface {
|
|
21
|
+
private readonly githubClient;
|
|
22
|
+
private readonly workspaceManager;
|
|
23
|
+
private readonly logger;
|
|
24
|
+
private readonly pollingConfig;
|
|
25
|
+
private isDisposed;
|
|
26
|
+
constructor(options: CopilotPluginOptions);
|
|
27
|
+
/**
|
|
28
|
+
* Invoke Copilot Workspace with a prompt (implements abstract method).
|
|
29
|
+
*
|
|
30
|
+
* Creates a workspace for the given prompt and waits for completion.
|
|
31
|
+
* Since there's no public API for Copilot Workspace, this monitors
|
|
32
|
+
* the workspace status via GitHub until completion or timeout.
|
|
33
|
+
*/
|
|
34
|
+
protected doInvoke(prompt: string, options: InternalInvokeOptions): Promise<AgentResult>;
|
|
35
|
+
/**
|
|
36
|
+
* Stream Copilot Workspace status updates (implements abstract method).
|
|
37
|
+
*
|
|
38
|
+
* Creates a workspace and yields status updates as stream chunks.
|
|
39
|
+
*/
|
|
40
|
+
protected doInvokeStream(prompt: string, options: InternalInvokeOptions): AsyncIterableIterator<StreamChunk>;
|
|
41
|
+
/**
|
|
42
|
+
* Return Copilot Workspace capabilities (implements abstract method).
|
|
43
|
+
*/
|
|
44
|
+
protected doGetCapabilities(): Promise<AgentCapabilities>;
|
|
45
|
+
/**
|
|
46
|
+
* Create a new workspace for tracking.
|
|
47
|
+
*
|
|
48
|
+
* Note: This does not create an actual Copilot Workspace (no public API).
|
|
49
|
+
* It sets up tracking for when a workspace is manually created via GitHub.
|
|
50
|
+
*/
|
|
51
|
+
createWorkspace(params: CreateWorkspaceParams): Promise<Workspace>;
|
|
52
|
+
/**
|
|
53
|
+
* Get an existing workspace by ID.
|
|
54
|
+
*/
|
|
55
|
+
getWorkspace(workspaceId: string): Promise<Workspace | null>;
|
|
56
|
+
/**
|
|
57
|
+
* Poll the current status of a workspace.
|
|
58
|
+
*
|
|
59
|
+
* Status is inferred from GitHub PR state since there's no direct
|
|
60
|
+
* Copilot Workspace API to query.
|
|
61
|
+
*/
|
|
62
|
+
pollWorkspaceStatus(workspaceId: string): Promise<WorkspaceStatus>;
|
|
63
|
+
/**
|
|
64
|
+
* Get file changes from a completed workspace.
|
|
65
|
+
*
|
|
66
|
+
* Returns changes from the associated pull request.
|
|
67
|
+
*/
|
|
68
|
+
getChanges(workspaceId: string): Promise<FileChange[]>;
|
|
69
|
+
/**
|
|
70
|
+
* Get the pull request associated with the workspace.
|
|
71
|
+
*/
|
|
72
|
+
getPullRequest(workspaceId: string): Promise<PullRequest | null>;
|
|
73
|
+
/**
|
|
74
|
+
* Stream status updates from a workspace.
|
|
75
|
+
*
|
|
76
|
+
* Polls GitHub at configured intervals and yields events
|
|
77
|
+
* when status changes are detected.
|
|
78
|
+
*/
|
|
79
|
+
streamStatus(workspaceId: string): AsyncIterable<WorkspaceStatusEvent>;
|
|
80
|
+
/**
|
|
81
|
+
* Dispose of the plugin and cleanup resources.
|
|
82
|
+
*/
|
|
83
|
+
dispose(): Promise<void>;
|
|
84
|
+
private ensureNotDisposed;
|
|
85
|
+
/**
|
|
86
|
+
* Extract issue URL from prompt text or metadata.
|
|
87
|
+
*/
|
|
88
|
+
private extractIssueUrl;
|
|
89
|
+
}
|
|
90
|
+
//# sourceMappingURL=copilot-plugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"copilot-plugin.d.ts","sourceRoot":"","sources":["../../src/plugin/copilot-plugin.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EACV,WAAW,EACX,iBAAiB,EACjB,WAAW,EACZ,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACL,sBAAsB,EACtB,KAAK,qBAAqB,EAC3B,MAAM,uCAAuC,CAAC;AAI/C,OAAO,KAAK,EACV,sBAAsB,EACtB,oBAAoB,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