@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.
Files changed (47) hide show
  1. package/LICENSE +191 -0
  2. package/README.md +140 -0
  3. package/dist/errors.d.ts +70 -0
  4. package/dist/errors.d.ts.map +1 -0
  5. package/dist/errors.js +116 -0
  6. package/dist/errors.js.map +1 -0
  7. package/dist/github/client.d.ts +46 -0
  8. package/dist/github/client.d.ts.map +1 -0
  9. package/dist/github/client.js +165 -0
  10. package/dist/github/client.js.map +1 -0
  11. package/dist/github/types.d.ts +91 -0
  12. package/dist/github/types.d.ts.map +1 -0
  13. package/dist/github/types.js +7 -0
  14. package/dist/github/types.js.map +1 -0
  15. package/dist/index.d.ts +19 -0
  16. package/dist/index.d.ts.map +1 -0
  17. package/dist/index.js +22 -0
  18. package/dist/index.js.map +1 -0
  19. package/dist/plugin/copilot-plugin.d.ts +90 -0
  20. package/dist/plugin/copilot-plugin.d.ts.map +1 -0
  21. package/dist/plugin/copilot-plugin.js +289 -0
  22. package/dist/plugin/copilot-plugin.js.map +1 -0
  23. package/dist/polling/status-poller.d.ts +36 -0
  24. package/dist/polling/status-poller.d.ts.map +1 -0
  25. package/dist/polling/status-poller.js +142 -0
  26. package/dist/polling/status-poller.js.map +1 -0
  27. package/dist/polling/types.d.ts +62 -0
  28. package/dist/polling/types.d.ts.map +1 -0
  29. package/dist/polling/types.js +16 -0
  30. package/dist/polling/types.js.map +1 -0
  31. package/dist/schemas.d.ts +341 -0
  32. package/dist/schemas.d.ts.map +1 -0
  33. package/dist/schemas.js +176 -0
  34. package/dist/schemas.js.map +1 -0
  35. package/dist/types.d.ts +161 -0
  36. package/dist/types.d.ts.map +1 -0
  37. package/dist/types.js +21 -0
  38. package/dist/types.js.map +1 -0
  39. package/dist/workspace/types.d.ts +61 -0
  40. package/dist/workspace/types.d.ts.map +1 -0
  41. package/dist/workspace/types.js +7 -0
  42. package/dist/workspace/types.js.map +1 -0
  43. package/dist/workspace/workspace-manager.d.ts +65 -0
  44. package/dist/workspace/workspace-manager.d.ts.map +1 -0
  45. package/dist/workspace/workspace-manager.js +294 -0
  46. package/dist/workspace/workspace-manager.js.map +1 -0
  47. package/package.json +58 -0
@@ -0,0 +1,341 @@
1
+ /**
2
+ * @generacy-ai/generacy-plugin-copilot
3
+ *
4
+ * Zod validation schemas for runtime validation.
5
+ */
6
+ import { z } from 'zod';
7
+ /**
8
+ * Schema for workspace status values.
9
+ */
10
+ export declare const WorkspaceStatusSchema: z.ZodEnum<["pending", "planning", "implementing", "review_ready", "merged", "failed", "not_available"]>;
11
+ /**
12
+ * Schema for file change types.
13
+ */
14
+ export declare const FileChangeTypeSchema: z.ZodEnum<["added", "modified", "deleted", "renamed"]>;
15
+ /**
16
+ * Schema for PR state.
17
+ */
18
+ export declare const PullRequestStateSchema: z.ZodEnum<["open", "closed", "merged"]>;
19
+ /**
20
+ * Schema for review status.
21
+ */
22
+ export declare const ReviewStatusSchema: z.ZodEnum<["pending", "approved", "changes_requested", "dismissed"]>;
23
+ /**
24
+ * Schema for workspace options.
25
+ */
26
+ export declare const WorkspaceOptionsSchema: z.ZodObject<{
27
+ autoMerge: z.ZodOptional<z.ZodBoolean>;
28
+ reviewRequired: z.ZodOptional<z.ZodBoolean>;
29
+ timeoutMs: z.ZodOptional<z.ZodNumber>;
30
+ prLabels: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
31
+ }, "strip", z.ZodTypeAny, {
32
+ timeoutMs?: number | undefined;
33
+ autoMerge?: boolean | undefined;
34
+ reviewRequired?: boolean | undefined;
35
+ prLabels?: string[] | undefined;
36
+ }, {
37
+ timeoutMs?: number | undefined;
38
+ autoMerge?: boolean | undefined;
39
+ reviewRequired?: boolean | undefined;
40
+ prLabels?: string[] | undefined;
41
+ }>;
42
+ /**
43
+ * Schema for create workspace parameters.
44
+ */
45
+ export declare const CreateWorkspaceParamsSchema: z.ZodObject<{
46
+ issueUrl: z.ZodString;
47
+ options: z.ZodOptional<z.ZodObject<{
48
+ autoMerge: z.ZodOptional<z.ZodBoolean>;
49
+ reviewRequired: z.ZodOptional<z.ZodBoolean>;
50
+ timeoutMs: z.ZodOptional<z.ZodNumber>;
51
+ prLabels: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
52
+ }, "strip", z.ZodTypeAny, {
53
+ timeoutMs?: number | undefined;
54
+ autoMerge?: boolean | undefined;
55
+ reviewRequired?: boolean | undefined;
56
+ prLabels?: string[] | undefined;
57
+ }, {
58
+ timeoutMs?: number | undefined;
59
+ autoMerge?: boolean | undefined;
60
+ reviewRequired?: boolean | undefined;
61
+ prLabels?: string[] | undefined;
62
+ }>>;
63
+ }, "strip", z.ZodTypeAny, {
64
+ issueUrl: string;
65
+ options?: {
66
+ timeoutMs?: number | undefined;
67
+ autoMerge?: boolean | undefined;
68
+ reviewRequired?: boolean | undefined;
69
+ prLabels?: string[] | undefined;
70
+ } | undefined;
71
+ }, {
72
+ issueUrl: string;
73
+ options?: {
74
+ timeoutMs?: number | undefined;
75
+ autoMerge?: boolean | undefined;
76
+ reviewRequired?: boolean | undefined;
77
+ prLabels?: string[] | undefined;
78
+ } | undefined;
79
+ }>;
80
+ /**
81
+ * Schema for polling configuration.
82
+ */
83
+ export declare const PollingConfigSchema: z.ZodObject<{
84
+ initialIntervalMs: z.ZodDefault<z.ZodNumber>;
85
+ maxIntervalMs: z.ZodDefault<z.ZodNumber>;
86
+ backoffMultiplier: z.ZodDefault<z.ZodNumber>;
87
+ maxRetries: z.ZodDefault<z.ZodNumber>;
88
+ timeoutMs: z.ZodOptional<z.ZodNumber>;
89
+ }, "strip", z.ZodTypeAny, {
90
+ initialIntervalMs: number;
91
+ maxIntervalMs: number;
92
+ backoffMultiplier: number;
93
+ maxRetries: number;
94
+ timeoutMs?: number | undefined;
95
+ }, {
96
+ timeoutMs?: number | undefined;
97
+ initialIntervalMs?: number | undefined;
98
+ maxIntervalMs?: number | undefined;
99
+ backoffMultiplier?: number | undefined;
100
+ maxRetries?: number | undefined;
101
+ }>;
102
+ /**
103
+ * Schema for GitHub token validation.
104
+ */
105
+ export declare const GitHubTokenSchema: z.ZodEffects<z.ZodString, string, string>;
106
+ /**
107
+ * Schema for plugin options.
108
+ */
109
+ export declare const CopilotPluginOptionsSchema: z.ZodObject<{
110
+ githubToken: z.ZodEffects<z.ZodString, string, string>;
111
+ apiBaseUrl: z.ZodOptional<z.ZodString>;
112
+ logger: z.ZodOptional<z.ZodAny>;
113
+ polling: z.ZodOptional<z.ZodObject<{
114
+ initialIntervalMs: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
115
+ maxIntervalMs: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
116
+ backoffMultiplier: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
117
+ maxRetries: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
118
+ timeoutMs: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
119
+ }, "strip", z.ZodTypeAny, {
120
+ timeoutMs?: number | undefined;
121
+ initialIntervalMs?: number | undefined;
122
+ maxIntervalMs?: number | undefined;
123
+ backoffMultiplier?: number | undefined;
124
+ maxRetries?: number | undefined;
125
+ }, {
126
+ timeoutMs?: number | undefined;
127
+ initialIntervalMs?: number | undefined;
128
+ maxIntervalMs?: number | undefined;
129
+ backoffMultiplier?: number | undefined;
130
+ maxRetries?: number | undefined;
131
+ }>>;
132
+ workspaceDefaults: z.ZodOptional<z.ZodObject<{
133
+ autoMerge: z.ZodOptional<z.ZodBoolean>;
134
+ reviewRequired: z.ZodOptional<z.ZodBoolean>;
135
+ timeoutMs: z.ZodOptional<z.ZodNumber>;
136
+ prLabels: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
137
+ }, "strip", z.ZodTypeAny, {
138
+ timeoutMs?: number | undefined;
139
+ autoMerge?: boolean | undefined;
140
+ reviewRequired?: boolean | undefined;
141
+ prLabels?: string[] | undefined;
142
+ }, {
143
+ timeoutMs?: number | undefined;
144
+ autoMerge?: boolean | undefined;
145
+ reviewRequired?: boolean | undefined;
146
+ prLabels?: string[] | undefined;
147
+ }>>;
148
+ }, "strip", z.ZodTypeAny, {
149
+ githubToken: string;
150
+ apiBaseUrl?: string | undefined;
151
+ logger?: any;
152
+ polling?: {
153
+ timeoutMs?: number | undefined;
154
+ initialIntervalMs?: number | undefined;
155
+ maxIntervalMs?: number | undefined;
156
+ backoffMultiplier?: number | undefined;
157
+ maxRetries?: number | undefined;
158
+ } | undefined;
159
+ workspaceDefaults?: {
160
+ timeoutMs?: number | undefined;
161
+ autoMerge?: boolean | undefined;
162
+ reviewRequired?: boolean | undefined;
163
+ prLabels?: string[] | undefined;
164
+ } | undefined;
165
+ }, {
166
+ githubToken: string;
167
+ apiBaseUrl?: string | undefined;
168
+ logger?: any;
169
+ polling?: {
170
+ timeoutMs?: number | undefined;
171
+ initialIntervalMs?: number | undefined;
172
+ maxIntervalMs?: number | undefined;
173
+ backoffMultiplier?: number | undefined;
174
+ maxRetries?: number | undefined;
175
+ } | undefined;
176
+ workspaceDefaults?: {
177
+ timeoutMs?: number | undefined;
178
+ autoMerge?: boolean | undefined;
179
+ reviewRequired?: boolean | undefined;
180
+ prLabels?: string[] | undefined;
181
+ } | undefined;
182
+ }>;
183
+ /**
184
+ * Schema for file change.
185
+ */
186
+ export declare const FileChangeSchema: z.ZodObject<{
187
+ path: z.ZodString;
188
+ type: z.ZodEnum<["added", "modified", "deleted", "renamed"]>;
189
+ previousPath: z.ZodOptional<z.ZodString>;
190
+ additions: z.ZodNumber;
191
+ deletions: z.ZodNumber;
192
+ content: z.ZodOptional<z.ZodString>;
193
+ patch: z.ZodOptional<z.ZodString>;
194
+ }, "strip", z.ZodTypeAny, {
195
+ path: string;
196
+ type: "added" | "modified" | "deleted" | "renamed";
197
+ additions: number;
198
+ deletions: number;
199
+ previousPath?: string | undefined;
200
+ content?: string | undefined;
201
+ patch?: string | undefined;
202
+ }, {
203
+ path: string;
204
+ type: "added" | "modified" | "deleted" | "renamed";
205
+ additions: number;
206
+ deletions: number;
207
+ previousPath?: string | undefined;
208
+ content?: string | undefined;
209
+ patch?: string | undefined;
210
+ }>;
211
+ /**
212
+ * Schema for pull request.
213
+ */
214
+ export declare const PullRequestSchema: z.ZodObject<{
215
+ number: z.ZodNumber;
216
+ url: z.ZodString;
217
+ title: z.ZodString;
218
+ body: z.ZodString;
219
+ state: z.ZodEnum<["open", "closed", "merged"]>;
220
+ head: z.ZodString;
221
+ base: z.ZodString;
222
+ mergeable: z.ZodOptional<z.ZodBoolean>;
223
+ linkedIssues: z.ZodArray<z.ZodNumber, "many">;
224
+ reviewStatus: z.ZodEnum<["pending", "approved", "changes_requested", "dismissed"]>;
225
+ changedFiles: z.ZodNumber;
226
+ additions: z.ZodNumber;
227
+ deletions: z.ZodNumber;
228
+ }, "strip", z.ZodTypeAny, {
229
+ number: number;
230
+ additions: number;
231
+ deletions: number;
232
+ url: string;
233
+ title: string;
234
+ body: string;
235
+ state: "merged" | "open" | "closed";
236
+ head: string;
237
+ base: string;
238
+ linkedIssues: number[];
239
+ reviewStatus: "pending" | "approved" | "changes_requested" | "dismissed";
240
+ changedFiles: number;
241
+ mergeable?: boolean | undefined;
242
+ }, {
243
+ number: number;
244
+ additions: number;
245
+ deletions: number;
246
+ url: string;
247
+ title: string;
248
+ body: string;
249
+ state: "merged" | "open" | "closed";
250
+ head: string;
251
+ base: string;
252
+ linkedIssues: number[];
253
+ reviewStatus: "pending" | "approved" | "changes_requested" | "dismissed";
254
+ changedFiles: number;
255
+ mergeable?: boolean | undefined;
256
+ }>;
257
+ /**
258
+ * Schema for workspace.
259
+ */
260
+ export declare const WorkspaceSchema: z.ZodObject<{
261
+ id: z.ZodString;
262
+ issueUrl: z.ZodString;
263
+ status: z.ZodEnum<["pending", "planning", "implementing", "review_ready", "merged", "failed", "not_available"]>;
264
+ createdAt: z.ZodDate;
265
+ updatedAt: z.ZodDate;
266
+ pullRequestUrl: z.ZodOptional<z.ZodString>;
267
+ owner: z.ZodString;
268
+ repo: z.ZodString;
269
+ issueNumber: z.ZodNumber;
270
+ }, "strip", z.ZodTypeAny, {
271
+ status: "pending" | "planning" | "implementing" | "review_ready" | "merged" | "failed" | "not_available";
272
+ issueUrl: string;
273
+ id: string;
274
+ createdAt: Date;
275
+ updatedAt: Date;
276
+ owner: string;
277
+ repo: string;
278
+ issueNumber: number;
279
+ pullRequestUrl?: string | undefined;
280
+ }, {
281
+ status: "pending" | "planning" | "implementing" | "review_ready" | "merged" | "failed" | "not_available";
282
+ issueUrl: string;
283
+ id: string;
284
+ createdAt: Date;
285
+ updatedAt: Date;
286
+ owner: string;
287
+ repo: string;
288
+ issueNumber: number;
289
+ pullRequestUrl?: string | undefined;
290
+ }>;
291
+ /**
292
+ * Schema for workspace status event.
293
+ */
294
+ export declare const WorkspaceStatusEventSchema: z.ZodObject<{
295
+ workspaceId: z.ZodString;
296
+ previousStatus: z.ZodEnum<["pending", "planning", "implementing", "review_ready", "merged", "failed", "not_available"]>;
297
+ status: z.ZodEnum<["pending", "planning", "implementing", "review_ready", "merged", "failed", "not_available"]>;
298
+ timestamp: z.ZodDate;
299
+ details: z.ZodOptional<z.ZodObject<{
300
+ pullRequestUrl: z.ZodOptional<z.ZodString>;
301
+ failureReason: z.ZodOptional<z.ZodString>;
302
+ progress: z.ZodOptional<z.ZodNumber>;
303
+ }, "strip", z.ZodTypeAny, {
304
+ pullRequestUrl?: string | undefined;
305
+ failureReason?: string | undefined;
306
+ progress?: number | undefined;
307
+ }, {
308
+ pullRequestUrl?: string | undefined;
309
+ failureReason?: string | undefined;
310
+ progress?: number | undefined;
311
+ }>>;
312
+ }, "strip", z.ZodTypeAny, {
313
+ workspaceId: string;
314
+ status: "pending" | "planning" | "implementing" | "review_ready" | "merged" | "failed" | "not_available";
315
+ previousStatus: "pending" | "planning" | "implementing" | "review_ready" | "merged" | "failed" | "not_available";
316
+ timestamp: Date;
317
+ details?: {
318
+ pullRequestUrl?: string | undefined;
319
+ failureReason?: string | undefined;
320
+ progress?: number | undefined;
321
+ } | undefined;
322
+ }, {
323
+ workspaceId: string;
324
+ status: "pending" | "planning" | "implementing" | "review_ready" | "merged" | "failed" | "not_available";
325
+ previousStatus: "pending" | "planning" | "implementing" | "review_ready" | "merged" | "failed" | "not_available";
326
+ timestamp: Date;
327
+ details?: {
328
+ pullRequestUrl?: string | undefined;
329
+ failureReason?: string | undefined;
330
+ progress?: number | undefined;
331
+ } | undefined;
332
+ }>;
333
+ export type WorkspaceOptionsInput = z.input<typeof WorkspaceOptionsSchema>;
334
+ export type WorkspaceOptionsOutput = z.output<typeof WorkspaceOptionsSchema>;
335
+ export type CreateWorkspaceParamsInput = z.input<typeof CreateWorkspaceParamsSchema>;
336
+ export type CreateWorkspaceParamsOutput = z.output<typeof CreateWorkspaceParamsSchema>;
337
+ export type PollingConfigInput = z.input<typeof PollingConfigSchema>;
338
+ export type PollingConfigOutput = z.output<typeof PollingConfigSchema>;
339
+ export type CopilotPluginOptionsInput = z.input<typeof CopilotPluginOptionsSchema>;
340
+ export type CopilotPluginOptionsOutput = z.output<typeof CopilotPluginOptionsSchema>;
341
+ //# sourceMappingURL=schemas.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB;;GAEG;AACH,eAAO,MAAM,qBAAqB,yGAQhC,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,oBAAoB,wDAAsD,CAAC;AAExF;;GAEG;AACH,eAAO,MAAM,sBAAsB,yCAAuC,CAAC;AAE3E;;GAEG;AACH,eAAO,MAAM,kBAAkB,sEAK7B,CAAC;AAMH;;GAEG;AACH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;EAKjC,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;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B,CAAC,CAAC;AACnF,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,0BAA0B,CAAC,CAAC"}
@@ -0,0 +1,176 @@
1
+ /**
2
+ * @generacy-ai/generacy-plugin-copilot
3
+ *
4
+ * Zod validation schemas for runtime validation.
5
+ */
6
+ import { z } from 'zod';
7
+ // =============================================================================
8
+ // Workspace Schemas
9
+ // =============================================================================
10
+ /**
11
+ * Schema for workspace status values.
12
+ */
13
+ export const WorkspaceStatusSchema = z.enum([
14
+ 'pending',
15
+ 'planning',
16
+ 'implementing',
17
+ 'review_ready',
18
+ 'merged',
19
+ 'failed',
20
+ 'not_available',
21
+ ]);
22
+ /**
23
+ * Schema for file change types.
24
+ */
25
+ export const FileChangeTypeSchema = z.enum(['added', 'modified', 'deleted', 'renamed']);
26
+ /**
27
+ * Schema for PR state.
28
+ */
29
+ export const PullRequestStateSchema = z.enum(['open', 'closed', 'merged']);
30
+ /**
31
+ * Schema for review status.
32
+ */
33
+ export const ReviewStatusSchema = z.enum([
34
+ 'pending',
35
+ 'approved',
36
+ 'changes_requested',
37
+ 'dismissed',
38
+ ]);
39
+ // =============================================================================
40
+ // Input Schemas
41
+ // =============================================================================
42
+ /**
43
+ * Schema for workspace options.
44
+ */
45
+ export const WorkspaceOptionsSchema = z.object({
46
+ autoMerge: z.boolean().optional(),
47
+ reviewRequired: z.boolean().optional(),
48
+ timeoutMs: z.number().positive('Timeout must be positive').optional(),
49
+ prLabels: z.array(z.string()).optional(),
50
+ });
51
+ /**
52
+ * Schema for create workspace parameters.
53
+ */
54
+ export const CreateWorkspaceParamsSchema = z.object({
55
+ issueUrl: z
56
+ .string()
57
+ .url('Issue URL must be a valid URL')
58
+ .regex(/^https:\/\/github\.com\/[^/]+\/[^/]+\/issues\/\d+$/, 'Issue URL must be a valid GitHub issue URL'),
59
+ options: WorkspaceOptionsSchema.optional(),
60
+ });
61
+ // =============================================================================
62
+ // Configuration Schemas
63
+ // =============================================================================
64
+ /**
65
+ * Schema for polling configuration.
66
+ */
67
+ export const PollingConfigSchema = z.object({
68
+ initialIntervalMs: z
69
+ .number()
70
+ .int('Initial interval must be an integer')
71
+ .positive('Initial interval must be positive')
72
+ .default(5000),
73
+ maxIntervalMs: z
74
+ .number()
75
+ .int('Max interval must be an integer')
76
+ .positive('Max interval must be positive')
77
+ .default(60000),
78
+ backoffMultiplier: z
79
+ .number()
80
+ .positive('Backoff multiplier must be positive')
81
+ .default(1.5),
82
+ maxRetries: z
83
+ .number()
84
+ .int('Max retries must be an integer')
85
+ .nonnegative('Max retries cannot be negative')
86
+ .default(100),
87
+ timeoutMs: z
88
+ .number()
89
+ .int('Timeout must be an integer')
90
+ .positive('Timeout must be positive')
91
+ .optional(),
92
+ });
93
+ /**
94
+ * Schema for GitHub token validation.
95
+ */
96
+ export const GitHubTokenSchema = z
97
+ .string()
98
+ .min(1, 'GitHub token is required')
99
+ .refine((token) => {
100
+ const validPrefixes = ['ghp_', 'gho_', 'ghu_', 'ghs_', 'ghr_'];
101
+ return validPrefixes.some((prefix) => token.startsWith(prefix)) || token.length === 40;
102
+ }, { message: 'Invalid GitHub token format' });
103
+ /**
104
+ * Schema for plugin options.
105
+ */
106
+ export const CopilotPluginOptionsSchema = z.object({
107
+ githubToken: GitHubTokenSchema,
108
+ apiBaseUrl: z.string().url('API base URL must be a valid URL').optional(),
109
+ logger: z.any().optional(),
110
+ polling: PollingConfigSchema.partial().optional(),
111
+ workspaceDefaults: WorkspaceOptionsSchema.optional(),
112
+ });
113
+ // =============================================================================
114
+ // Output Schemas
115
+ // =============================================================================
116
+ /**
117
+ * Schema for file change.
118
+ */
119
+ export const FileChangeSchema = z.object({
120
+ path: z.string().min(1, 'File path is required'),
121
+ type: FileChangeTypeSchema,
122
+ previousPath: z.string().optional(),
123
+ additions: z.number().int().nonnegative(),
124
+ deletions: z.number().int().nonnegative(),
125
+ content: z.string().optional(),
126
+ patch: z.string().optional(),
127
+ });
128
+ /**
129
+ * Schema for pull request.
130
+ */
131
+ export const PullRequestSchema = z.object({
132
+ number: z.number().int().positive(),
133
+ url: z.string().url(),
134
+ title: z.string(),
135
+ body: z.string(),
136
+ state: PullRequestStateSchema,
137
+ head: z.string(),
138
+ base: z.string(),
139
+ mergeable: z.boolean().optional(),
140
+ linkedIssues: z.array(z.number().int().positive()),
141
+ reviewStatus: ReviewStatusSchema,
142
+ changedFiles: z.number().int().nonnegative(),
143
+ additions: z.number().int().nonnegative(),
144
+ deletions: z.number().int().nonnegative(),
145
+ });
146
+ /**
147
+ * Schema for workspace.
148
+ */
149
+ export const WorkspaceSchema = z.object({
150
+ id: z.string().min(1),
151
+ issueUrl: z.string().url(),
152
+ status: WorkspaceStatusSchema,
153
+ createdAt: z.date(),
154
+ updatedAt: z.date(),
155
+ pullRequestUrl: z.string().url().optional(),
156
+ owner: z.string().min(1),
157
+ repo: z.string().min(1),
158
+ issueNumber: z.number().int().positive(),
159
+ });
160
+ /**
161
+ * Schema for workspace status event.
162
+ */
163
+ export const WorkspaceStatusEventSchema = z.object({
164
+ workspaceId: z.string().min(1),
165
+ previousStatus: WorkspaceStatusSchema,
166
+ status: WorkspaceStatusSchema,
167
+ timestamp: z.date(),
168
+ details: z
169
+ .object({
170
+ pullRequestUrl: z.string().url().optional(),
171
+ failureReason: z.string().optional(),
172
+ progress: z.number().min(0).max(100).optional(),
173
+ })
174
+ .optional(),
175
+ });
176
+ //# sourceMappingURL=schemas.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schemas.js","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,gFAAgF;AAChF,oBAAoB;AACpB,gFAAgF;AAEhF;;GAEG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,IAAI,CAAC;IAC1C,SAAS;IACT,UAAU;IACV,cAAc;IACd,cAAc;IACd,QAAQ;IACR,QAAQ;IACR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0B,GAAG,CAAC,CAAC,MAAM,CAAC;IACjD,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC9B,cAAc,EAAE,qBAAqB;IACrC,MAAM,EAAE,qBAAqB;IAC7B,SAAS,EAAE,CAAC,CAAC,IAAI,EAAE;IACnB,OAAO,EAAE,CAAC;SACP,MAAM,CAAC;QACN,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;QAC3C,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;QACpC,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE;KAChD,CAAC;SACD,QAAQ,EAAE;CACd,CAAC,CAAC"}
@@ -0,0 +1,161 @@
1
+ /**
2
+ * @generacy-ai/generacy-plugin-copilot
3
+ *
4
+ * Core type definitions for Copilot Workspace integration.
5
+ */
6
+ import type { Logger } from 'pino';
7
+ /**
8
+ * Workspace lifecycle states.
9
+ */
10
+ export type WorkspaceStatus = 'pending' | 'planning' | 'implementing' | 'review_ready' | 'merged' | 'failed' | 'not_available';
11
+ /**
12
+ * Represents a Copilot Workspace instance.
13
+ */
14
+ export interface Workspace {
15
+ readonly id: string;
16
+ readonly issueUrl: string;
17
+ readonly status: WorkspaceStatus;
18
+ readonly createdAt: Date;
19
+ readonly updatedAt: Date;
20
+ readonly pullRequestUrl?: string;
21
+ readonly owner: string;
22
+ readonly repo: string;
23
+ readonly issueNumber: number;
24
+ }
25
+ /**
26
+ * Status update event for streaming.
27
+ */
28
+ export interface WorkspaceStatusEvent {
29
+ workspaceId: string;
30
+ previousStatus: WorkspaceStatus;
31
+ status: WorkspaceStatus;
32
+ timestamp: Date;
33
+ details?: {
34
+ pullRequestUrl?: string;
35
+ failureReason?: string;
36
+ progress?: number;
37
+ };
38
+ }
39
+ /**
40
+ * Parameters for workspace creation.
41
+ */
42
+ export interface CreateWorkspaceParams {
43
+ issueUrl: string;
44
+ options?: WorkspaceOptions;
45
+ }
46
+ /**
47
+ * Options for workspace behavior.
48
+ */
49
+ export interface WorkspaceOptions {
50
+ autoMerge?: boolean;
51
+ reviewRequired?: boolean;
52
+ timeoutMs?: number;
53
+ prLabels?: string[];
54
+ }
55
+ /**
56
+ * A file change produced by Copilot Workspace.
57
+ */
58
+ export interface FileChange {
59
+ path: string;
60
+ type: 'added' | 'modified' | 'deleted' | 'renamed';
61
+ previousPath?: string;
62
+ additions: number;
63
+ deletions: number;
64
+ content?: string;
65
+ patch?: string;
66
+ }
67
+ /**
68
+ * Pull request created by Copilot Workspace.
69
+ */
70
+ export interface PullRequest {
71
+ number: number;
72
+ url: string;
73
+ title: string;
74
+ body: string;
75
+ state: 'open' | 'closed' | 'merged';
76
+ head: string;
77
+ base: string;
78
+ mergeable?: boolean;
79
+ linkedIssues: number[];
80
+ reviewStatus: 'pending' | 'approved' | 'changes_requested' | 'dismissed';
81
+ changedFiles: number;
82
+ additions: number;
83
+ deletions: number;
84
+ }
85
+ /**
86
+ * Polling behavior configuration.
87
+ */
88
+ export interface PollingConfig {
89
+ initialIntervalMs: number;
90
+ maxIntervalMs: number;
91
+ backoffMultiplier: number;
92
+ maxRetries: number;
93
+ timeoutMs?: number;
94
+ }
95
+ /**
96
+ * Configuration options for CopilotPlugin.
97
+ */
98
+ export interface CopilotPluginOptions {
99
+ githubToken: string;
100
+ apiBaseUrl?: string;
101
+ logger?: Logger;
102
+ polling?: Partial<PollingConfig>;
103
+ workspaceDefaults?: WorkspaceOptions;
104
+ /** Default timeout for DevAgent invoke operations (in milliseconds) */
105
+ defaultTimeoutMs?: number;
106
+ }
107
+ /**
108
+ * Error classification codes.
109
+ */
110
+ export type ErrorCode = 'WORKSPACE_NOT_FOUND' | 'WORKSPACE_INVALID_STATE' | 'GITHUB_API_ERROR' | 'RATE_LIMITED' | 'AUTH_FAILED' | 'POLLING_TIMEOUT' | 'NOT_IMPLEMENTED' | 'UNKNOWN';
111
+ /**
112
+ * Error data structure for plugin errors.
113
+ */
114
+ export interface PluginErrorData {
115
+ code: ErrorCode;
116
+ isTransient: boolean;
117
+ message: string;
118
+ context?: Record<string, unknown>;
119
+ }
120
+ /**
121
+ * Main plugin interface for Copilot Workspace integration.
122
+ */
123
+ export interface CopilotPluginInterface {
124
+ /**
125
+ * Create a new workspace for tracking.
126
+ */
127
+ createWorkspace(params: CreateWorkspaceParams): Promise<Workspace>;
128
+ /**
129
+ * Get an existing workspace by ID.
130
+ */
131
+ getWorkspace(workspaceId: string): Promise<Workspace | null>;
132
+ /**
133
+ * Poll the current status of a workspace.
134
+ */
135
+ pollWorkspaceStatus(workspaceId: string): Promise<WorkspaceStatus>;
136
+ /**
137
+ * Get file changes from a completed workspace.
138
+ */
139
+ getChanges(workspaceId: string): Promise<FileChange[]>;
140
+ /**
141
+ * Get the pull request associated with the workspace.
142
+ */
143
+ getPullRequest(workspaceId: string): Promise<PullRequest | null>;
144
+ /**
145
+ * Stream status updates from a workspace.
146
+ */
147
+ streamStatus(workspaceId: string): AsyncIterable<WorkspaceStatusEvent>;
148
+ /**
149
+ * Dispose of the plugin and cleanup resources.
150
+ */
151
+ dispose(): Promise<void>;
152
+ }
153
+ /**
154
+ * Type guard for terminal workspace statuses.
155
+ */
156
+ export declare function isTerminalStatus(status: WorkspaceStatus): boolean;
157
+ /**
158
+ * Type guard for active workspace statuses.
159
+ */
160
+ export declare function isActiveStatus(status: WorkspaceStatus): boolean;
161
+ //# sourceMappingURL=types.d.ts.map