@mingchuno/agent-workflows 0.1.0

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 (62) hide show
  1. package/LICENCE +21 -0
  2. package/README.md +74 -0
  3. package/dist/drizzle/0000_initial.sql +45 -0
  4. package/dist/drizzle/meta/0000_snapshot.json +264 -0
  5. package/dist/drizzle/meta/_journal.json +13 -0
  6. package/dist/src/adapters/agent-worker.d.ts +1 -0
  7. package/dist/src/adapters/agent-worker.js +16 -0
  8. package/dist/src/adapters/agents.d.ts +24 -0
  9. package/dist/src/adapters/agents.js +142 -0
  10. package/dist/src/adapters/hosting.d.ts +33 -0
  11. package/dist/src/adapters/hosting.js +275 -0
  12. package/dist/src/adapters/sdk-protocol.d.ts +43 -0
  13. package/dist/src/adapters/sdk-protocol.js +64 -0
  14. package/dist/src/cli.d.ts +2 -0
  15. package/dist/src/cli.js +175 -0
  16. package/dist/src/config.d.ts +224 -0
  17. package/dist/src/config.js +82 -0
  18. package/dist/src/db/locks.d.ts +4 -0
  19. package/dist/src/db/locks.js +14 -0
  20. package/dist/src/db/migrate.d.ts +1 -0
  21. package/dist/src/db/migrate.js +12 -0
  22. package/dist/src/db/migrations.d.ts +2 -0
  23. package/dist/src/db/migrations.js +22 -0
  24. package/dist/src/db/schema.d.ts +486 -0
  25. package/dist/src/db/schema.js +46 -0
  26. package/dist/src/domain.d.ts +133 -0
  27. package/dist/src/domain.js +24 -0
  28. package/dist/src/index.d.ts +8 -0
  29. package/dist/src/index.js +8 -0
  30. package/dist/src/operations.d.ts +35 -0
  31. package/dist/src/operations.js +378 -0
  32. package/dist/src/run-record.d.ts +7 -0
  33. package/dist/src/run-record.js +19 -0
  34. package/dist/src/runner.d.ts +47 -0
  35. package/dist/src/runner.js +370 -0
  36. package/dist/src/runtime/ownership.d.ts +8 -0
  37. package/dist/src/runtime/ownership.js +84 -0
  38. package/dist/src/runtime/process.d.ts +18 -0
  39. package/dist/src/runtime/process.js +98 -0
  40. package/dist/src/runtime/redaction.d.ts +8 -0
  41. package/dist/src/runtime/redaction.js +33 -0
  42. package/dist/src/store.d.ts +87 -0
  43. package/dist/src/store.js +355 -0
  44. package/dist/src/tui-data.d.ts +25 -0
  45. package/dist/src/tui-data.js +89 -0
  46. package/dist/src/tui.d.ts +5 -0
  47. package/dist/src/tui.js +69 -0
  48. package/dist/src/workspace.d.ts +16 -0
  49. package/dist/src/workspace.js +186 -0
  50. package/docs/acceptance.md +35 -0
  51. package/docs/api.md +64 -0
  52. package/docs/architecture.md +24 -0
  53. package/docs/configuration.md +41 -0
  54. package/docs/database.md +28 -0
  55. package/docs/operations.md +46 -0
  56. package/docs/providers.md +49 -0
  57. package/docs/releases.md +89 -0
  58. package/examples/config.ts +57 -0
  59. package/examples/custom-workflow.ts +32 -0
  60. package/examples/observe.ts +18 -0
  61. package/examples/run.ts +31 -0
  62. package/package.json +78 -0
@@ -0,0 +1,486 @@
1
+ import type { RunRecord } from "../domain.js";
2
+ import type { InvocationRecord } from "../store.js";
3
+ export declare const application: import("drizzle-orm/pg-core").PgSchema<"agent_workflows">;
4
+ export declare const projects: import("drizzle-orm/pg-core").PgTableWithColumns<{
5
+ name: "projects";
6
+ schema: "agent_workflows";
7
+ columns: {
8
+ scope: import("drizzle-orm/pg-core").PgColumn<{
9
+ name: "scope";
10
+ tableName: "projects";
11
+ dataType: "string";
12
+ columnType: "PgText";
13
+ data: string;
14
+ driverParam: string;
15
+ notNull: true;
16
+ hasDefault: false;
17
+ isPrimaryKey: false;
18
+ isAutoincrement: false;
19
+ hasRuntimeDefault: false;
20
+ enumValues: [string, ...string[]];
21
+ baseColumn: never;
22
+ identity: undefined;
23
+ generated: undefined;
24
+ }, {}, {}>;
25
+ id: import("drizzle-orm/pg-core").PgColumn<{
26
+ name: "id";
27
+ tableName: "projects";
28
+ dataType: "string";
29
+ columnType: "PgText";
30
+ data: string;
31
+ driverParam: string;
32
+ notNull: true;
33
+ hasDefault: false;
34
+ isPrimaryKey: false;
35
+ isAutoincrement: false;
36
+ hasRuntimeDefault: false;
37
+ enumValues: [string, ...string[]];
38
+ baseColumn: never;
39
+ identity: undefined;
40
+ generated: undefined;
41
+ }, {}, {}>;
42
+ paused: import("drizzle-orm/pg-core").PgColumn<{
43
+ name: "paused";
44
+ tableName: "projects";
45
+ dataType: "boolean";
46
+ columnType: "PgBoolean";
47
+ data: boolean;
48
+ driverParam: boolean;
49
+ notNull: true;
50
+ hasDefault: true;
51
+ isPrimaryKey: false;
52
+ isAutoincrement: false;
53
+ hasRuntimeDefault: false;
54
+ enumValues: undefined;
55
+ baseColumn: never;
56
+ identity: undefined;
57
+ generated: undefined;
58
+ }, {}, {}>;
59
+ blocked: import("drizzle-orm/pg-core").PgColumn<{
60
+ name: "blocked";
61
+ tableName: "projects";
62
+ dataType: "string";
63
+ columnType: "PgText";
64
+ data: string;
65
+ driverParam: string;
66
+ notNull: false;
67
+ hasDefault: false;
68
+ isPrimaryKey: false;
69
+ isAutoincrement: false;
70
+ hasRuntimeDefault: false;
71
+ enumValues: [string, ...string[]];
72
+ baseColumn: never;
73
+ identity: undefined;
74
+ generated: undefined;
75
+ }, {}, {}>;
76
+ };
77
+ dialect: 'pg';
78
+ }>;
79
+ export declare const runs: import("drizzle-orm/pg-core").PgTableWithColumns<{
80
+ name: "runs";
81
+ schema: "agent_workflows";
82
+ columns: {
83
+ scope: import("drizzle-orm/pg-core").PgColumn<{
84
+ name: "scope";
85
+ tableName: "runs";
86
+ dataType: "string";
87
+ columnType: "PgText";
88
+ data: string;
89
+ driverParam: string;
90
+ notNull: true;
91
+ hasDefault: false;
92
+ isPrimaryKey: false;
93
+ isAutoincrement: false;
94
+ hasRuntimeDefault: false;
95
+ enumValues: [string, ...string[]];
96
+ baseColumn: never;
97
+ identity: undefined;
98
+ generated: undefined;
99
+ }, {}, {}>;
100
+ id: import("drizzle-orm/pg-core").PgColumn<{
101
+ name: "id";
102
+ tableName: "runs";
103
+ dataType: "string";
104
+ columnType: "PgText";
105
+ data: string;
106
+ driverParam: string;
107
+ notNull: true;
108
+ hasDefault: false;
109
+ isPrimaryKey: true;
110
+ isAutoincrement: false;
111
+ hasRuntimeDefault: false;
112
+ enumValues: [string, ...string[]];
113
+ baseColumn: never;
114
+ identity: undefined;
115
+ generated: undefined;
116
+ }, {}, {}>;
117
+ taskKey: import("drizzle-orm/pg-core").PgColumn<{
118
+ name: "task_key";
119
+ tableName: "runs";
120
+ dataType: "string";
121
+ columnType: "PgText";
122
+ data: string;
123
+ driverParam: string;
124
+ notNull: true;
125
+ hasDefault: false;
126
+ isPrimaryKey: false;
127
+ isAutoincrement: false;
128
+ hasRuntimeDefault: false;
129
+ enumValues: [string, ...string[]];
130
+ baseColumn: never;
131
+ identity: undefined;
132
+ generated: undefined;
133
+ }, {}, {}>;
134
+ attempt: import("drizzle-orm/pg-core").PgColumn<{
135
+ name: "attempt";
136
+ tableName: "runs";
137
+ dataType: "number";
138
+ columnType: "PgInteger";
139
+ data: number;
140
+ driverParam: string | number;
141
+ notNull: true;
142
+ hasDefault: false;
143
+ isPrimaryKey: false;
144
+ isAutoincrement: false;
145
+ hasRuntimeDefault: false;
146
+ enumValues: undefined;
147
+ baseColumn: never;
148
+ identity: undefined;
149
+ generated: undefined;
150
+ }, {}, {}>;
151
+ record: import("drizzle-orm/pg-core").PgColumn<{
152
+ name: "record";
153
+ tableName: "runs";
154
+ dataType: "json";
155
+ columnType: "PgJsonb";
156
+ data: RunRecord;
157
+ driverParam: unknown;
158
+ notNull: true;
159
+ hasDefault: false;
160
+ isPrimaryKey: false;
161
+ isAutoincrement: false;
162
+ hasRuntimeDefault: false;
163
+ enumValues: undefined;
164
+ baseColumn: never;
165
+ identity: undefined;
166
+ generated: undefined;
167
+ }, {}, {
168
+ $type: RunRecord;
169
+ }>;
170
+ };
171
+ dialect: 'pg';
172
+ }>;
173
+ export declare const events: import("drizzle-orm/pg-core").PgTableWithColumns<{
174
+ name: "events";
175
+ schema: "agent_workflows";
176
+ columns: {
177
+ sequence: import("drizzle-orm/pg-core").PgColumn<{
178
+ name: "sequence";
179
+ tableName: "events";
180
+ dataType: "number";
181
+ columnType: "PgBigSerial53";
182
+ data: number;
183
+ driverParam: number;
184
+ notNull: true;
185
+ hasDefault: true;
186
+ isPrimaryKey: true;
187
+ isAutoincrement: false;
188
+ hasRuntimeDefault: false;
189
+ enumValues: undefined;
190
+ baseColumn: never;
191
+ identity: undefined;
192
+ generated: undefined;
193
+ }, {}, {}>;
194
+ scope: import("drizzle-orm/pg-core").PgColumn<{
195
+ name: "scope";
196
+ tableName: "events";
197
+ dataType: "string";
198
+ columnType: "PgText";
199
+ data: string;
200
+ driverParam: string;
201
+ notNull: true;
202
+ hasDefault: false;
203
+ isPrimaryKey: false;
204
+ isAutoincrement: false;
205
+ hasRuntimeDefault: false;
206
+ enumValues: [string, ...string[]];
207
+ baseColumn: never;
208
+ identity: undefined;
209
+ generated: undefined;
210
+ }, {}, {}>;
211
+ runId: import("drizzle-orm/pg-core").PgColumn<{
212
+ name: "run_id";
213
+ tableName: "events";
214
+ dataType: "string";
215
+ columnType: "PgText";
216
+ data: string;
217
+ driverParam: string;
218
+ notNull: false;
219
+ hasDefault: false;
220
+ isPrimaryKey: false;
221
+ isAutoincrement: false;
222
+ hasRuntimeDefault: false;
223
+ enumValues: [string, ...string[]];
224
+ baseColumn: never;
225
+ identity: undefined;
226
+ generated: undefined;
227
+ }, {}, {}>;
228
+ kind: import("drizzle-orm/pg-core").PgColumn<{
229
+ name: "kind";
230
+ tableName: "events";
231
+ dataType: "string";
232
+ columnType: "PgText";
233
+ data: string;
234
+ driverParam: string;
235
+ notNull: true;
236
+ hasDefault: false;
237
+ isPrimaryKey: false;
238
+ isAutoincrement: false;
239
+ hasRuntimeDefault: false;
240
+ enumValues: [string, ...string[]];
241
+ baseColumn: never;
242
+ identity: undefined;
243
+ generated: undefined;
244
+ }, {}, {}>;
245
+ payload: import("drizzle-orm/pg-core").PgColumn<{
246
+ name: "payload";
247
+ tableName: "events";
248
+ dataType: "json";
249
+ columnType: "PgJsonb";
250
+ data: unknown;
251
+ driverParam: unknown;
252
+ notNull: true;
253
+ hasDefault: false;
254
+ isPrimaryKey: false;
255
+ isAutoincrement: false;
256
+ hasRuntimeDefault: false;
257
+ enumValues: undefined;
258
+ baseColumn: never;
259
+ identity: undefined;
260
+ generated: undefined;
261
+ }, {}, {
262
+ $type: unknown;
263
+ }>;
264
+ createdAt: import("drizzle-orm/pg-core").PgColumn<{
265
+ name: "created_at";
266
+ tableName: "events";
267
+ dataType: "date";
268
+ columnType: "PgTimestamp";
269
+ data: Date;
270
+ driverParam: string;
271
+ notNull: true;
272
+ hasDefault: true;
273
+ isPrimaryKey: false;
274
+ isAutoincrement: false;
275
+ hasRuntimeDefault: false;
276
+ enumValues: undefined;
277
+ baseColumn: never;
278
+ identity: undefined;
279
+ generated: undefined;
280
+ }, {}, {}>;
281
+ };
282
+ dialect: 'pg';
283
+ }>;
284
+ export declare const invocations: import("drizzle-orm/pg-core").PgTableWithColumns<{
285
+ name: "invocations";
286
+ schema: "agent_workflows";
287
+ columns: {
288
+ scope: import("drizzle-orm/pg-core").PgColumn<{
289
+ name: "scope";
290
+ tableName: "invocations";
291
+ dataType: "string";
292
+ columnType: "PgText";
293
+ data: string;
294
+ driverParam: string;
295
+ notNull: true;
296
+ hasDefault: false;
297
+ isPrimaryKey: false;
298
+ isAutoincrement: false;
299
+ hasRuntimeDefault: false;
300
+ enumValues: [string, ...string[]];
301
+ baseColumn: never;
302
+ identity: undefined;
303
+ generated: undefined;
304
+ }, {}, {}>;
305
+ id: import("drizzle-orm/pg-core").PgColumn<{
306
+ name: "id";
307
+ tableName: "invocations";
308
+ dataType: "string";
309
+ columnType: "PgText";
310
+ data: string;
311
+ driverParam: string;
312
+ notNull: true;
313
+ hasDefault: false;
314
+ isPrimaryKey: true;
315
+ isAutoincrement: false;
316
+ hasRuntimeDefault: false;
317
+ enumValues: [string, ...string[]];
318
+ baseColumn: never;
319
+ identity: undefined;
320
+ generated: undefined;
321
+ }, {}, {}>;
322
+ runId: import("drizzle-orm/pg-core").PgColumn<{
323
+ name: "run_id";
324
+ tableName: "invocations";
325
+ dataType: "string";
326
+ columnType: "PgText";
327
+ data: string;
328
+ driverParam: string;
329
+ notNull: true;
330
+ hasDefault: false;
331
+ isPrimaryKey: false;
332
+ isAutoincrement: false;
333
+ hasRuntimeDefault: false;
334
+ enumValues: [string, ...string[]];
335
+ baseColumn: never;
336
+ identity: undefined;
337
+ generated: undefined;
338
+ }, {}, {}>;
339
+ record: import("drizzle-orm/pg-core").PgColumn<{
340
+ name: "record";
341
+ tableName: "invocations";
342
+ dataType: "json";
343
+ columnType: "PgJsonb";
344
+ data: InvocationRecord;
345
+ driverParam: unknown;
346
+ notNull: true;
347
+ hasDefault: false;
348
+ isPrimaryKey: false;
349
+ isAutoincrement: false;
350
+ hasRuntimeDefault: false;
351
+ enumValues: undefined;
352
+ baseColumn: never;
353
+ identity: undefined;
354
+ generated: undefined;
355
+ }, {}, {
356
+ $type: InvocationRecord;
357
+ }>;
358
+ };
359
+ dialect: 'pg';
360
+ }>;
361
+ export declare const commands: import("drizzle-orm/pg-core").PgTableWithColumns<{
362
+ name: "commands";
363
+ schema: "agent_workflows";
364
+ columns: {
365
+ id: import("drizzle-orm/pg-core").PgColumn<{
366
+ name: "id";
367
+ tableName: "commands";
368
+ dataType: "string";
369
+ columnType: "PgText";
370
+ data: string;
371
+ driverParam: string;
372
+ notNull: true;
373
+ hasDefault: false;
374
+ isPrimaryKey: true;
375
+ isAutoincrement: false;
376
+ hasRuntimeDefault: false;
377
+ enumValues: [string, ...string[]];
378
+ baseColumn: never;
379
+ identity: undefined;
380
+ generated: undefined;
381
+ }, {}, {}>;
382
+ scope: import("drizzle-orm/pg-core").PgColumn<{
383
+ name: "scope";
384
+ tableName: "commands";
385
+ dataType: "string";
386
+ columnType: "PgText";
387
+ data: string;
388
+ driverParam: string;
389
+ notNull: true;
390
+ hasDefault: false;
391
+ isPrimaryKey: false;
392
+ isAutoincrement: false;
393
+ hasRuntimeDefault: false;
394
+ enumValues: [string, ...string[]];
395
+ baseColumn: never;
396
+ identity: undefined;
397
+ generated: undefined;
398
+ }, {}, {}>;
399
+ kind: import("drizzle-orm/pg-core").PgColumn<{
400
+ name: "kind";
401
+ tableName: "commands";
402
+ dataType: "string";
403
+ columnType: "PgText";
404
+ data: string;
405
+ driverParam: string;
406
+ notNull: true;
407
+ hasDefault: false;
408
+ isPrimaryKey: false;
409
+ isAutoincrement: false;
410
+ hasRuntimeDefault: false;
411
+ enumValues: [string, ...string[]];
412
+ baseColumn: never;
413
+ identity: undefined;
414
+ generated: undefined;
415
+ }, {}, {}>;
416
+ target: import("drizzle-orm/pg-core").PgColumn<{
417
+ name: "target";
418
+ tableName: "commands";
419
+ dataType: "string";
420
+ columnType: "PgText";
421
+ data: string;
422
+ driverParam: string;
423
+ notNull: true;
424
+ hasDefault: false;
425
+ isPrimaryKey: false;
426
+ isAutoincrement: false;
427
+ hasRuntimeDefault: false;
428
+ enumValues: [string, ...string[]];
429
+ baseColumn: never;
430
+ identity: undefined;
431
+ generated: undefined;
432
+ }, {}, {}>;
433
+ status: import("drizzle-orm/pg-core").PgColumn<{
434
+ name: "status";
435
+ tableName: "commands";
436
+ dataType: "string";
437
+ columnType: "PgText";
438
+ data: string;
439
+ driverParam: string;
440
+ notNull: true;
441
+ hasDefault: true;
442
+ isPrimaryKey: false;
443
+ isAutoincrement: false;
444
+ hasRuntimeDefault: false;
445
+ enumValues: [string, ...string[]];
446
+ baseColumn: never;
447
+ identity: undefined;
448
+ generated: undefined;
449
+ }, {}, {}>;
450
+ error: import("drizzle-orm/pg-core").PgColumn<{
451
+ name: "error";
452
+ tableName: "commands";
453
+ dataType: "string";
454
+ columnType: "PgText";
455
+ data: string;
456
+ driverParam: string;
457
+ notNull: false;
458
+ hasDefault: false;
459
+ isPrimaryKey: false;
460
+ isAutoincrement: false;
461
+ hasRuntimeDefault: false;
462
+ enumValues: [string, ...string[]];
463
+ baseColumn: never;
464
+ identity: undefined;
465
+ generated: undefined;
466
+ }, {}, {}>;
467
+ createdAt: import("drizzle-orm/pg-core").PgColumn<{
468
+ name: "created_at";
469
+ tableName: "commands";
470
+ dataType: "date";
471
+ columnType: "PgTimestamp";
472
+ data: Date;
473
+ driverParam: string;
474
+ notNull: true;
475
+ hasDefault: true;
476
+ isPrimaryKey: false;
477
+ isAutoincrement: false;
478
+ hasRuntimeDefault: false;
479
+ enumValues: undefined;
480
+ baseColumn: never;
481
+ identity: undefined;
482
+ generated: undefined;
483
+ }, {}, {}>;
484
+ };
485
+ dialect: 'pg';
486
+ }>;
@@ -0,0 +1,46 @@
1
+ import { bigserial, boolean, integer, jsonb, pgSchema, primaryKey, text, timestamp, unique, } from "drizzle-orm/pg-core";
2
+ export const application = pgSchema("agent_workflows");
3
+ export const projects = application.table("projects", {
4
+ scope: text().notNull(),
5
+ id: text().notNull(),
6
+ paused: boolean().notNull().default(false),
7
+ blocked: text(),
8
+ }, (table) => [
9
+ primaryKey({ name: "projects_pkey", columns: [table.scope, table.id] }),
10
+ ]);
11
+ export const runs = application.table("runs", {
12
+ scope: text().notNull(),
13
+ id: text().primaryKey(),
14
+ taskKey: text("task_key").notNull(),
15
+ attempt: integer().notNull(),
16
+ record: jsonb().$type().notNull(),
17
+ }, (table) => [
18
+ unique("runs_scope_task_key_attempt_key").on(table.scope, table.taskKey, table.attempt),
19
+ ]);
20
+ export const events = application.table("events", {
21
+ sequence: bigserial({ mode: "number" }).primaryKey(),
22
+ scope: text().notNull(),
23
+ runId: text("run_id"),
24
+ kind: text().notNull(),
25
+ payload: jsonb().$type().notNull(),
26
+ createdAt: timestamp("created_at", { withTimezone: true })
27
+ .notNull()
28
+ .defaultNow(),
29
+ });
30
+ export const invocations = application.table("invocations", {
31
+ scope: text().notNull(),
32
+ id: text().primaryKey(),
33
+ runId: text("run_id").notNull(),
34
+ record: jsonb().$type().notNull(),
35
+ });
36
+ export const commands = application.table("commands", {
37
+ id: text().primaryKey(),
38
+ scope: text().notNull(),
39
+ kind: text().notNull(),
40
+ target: text().notNull(),
41
+ status: text().notNull().default("pending"),
42
+ error: text(),
43
+ createdAt: timestamp("created_at", { withTimezone: true })
44
+ .notNull()
45
+ .defaultNow(),
46
+ });
@@ -0,0 +1,133 @@
1
+ import { z } from "zod";
2
+ import type { AgentProfile, Project } from "./config.js";
3
+ export interface Issue {
4
+ id: string;
5
+ number: number;
6
+ title: string;
7
+ body: string;
8
+ url: string;
9
+ labels: string[];
10
+ open: boolean;
11
+ }
12
+ export interface ChangeRequest {
13
+ id: number;
14
+ url: string;
15
+ head: string;
16
+ }
17
+ export declare const publicationSchema: z.ZodObject<{
18
+ commitMessage: z.ZodString;
19
+ title: z.ZodString;
20
+ description: z.ZodString;
21
+ }, z.core.$strict>;
22
+ export type Publication = z.infer<typeof publicationSchema>;
23
+ export declare const reviewSchema: z.ZodObject<{
24
+ summary: z.ZodString;
25
+ findings: z.ZodArray<z.ZodObject<{
26
+ body: z.ZodString;
27
+ path: z.ZodOptional<z.ZodString>;
28
+ line: z.ZodOptional<z.ZodNumber>;
29
+ }, z.core.$strict>>;
30
+ }, z.core.$strict>;
31
+ export type Review = z.infer<typeof reviewSchema>;
32
+ export interface ValidationResult {
33
+ command: string;
34
+ args: string[];
35
+ exitCode: number;
36
+ log: string;
37
+ startedAt: string;
38
+ finishedAt: string;
39
+ }
40
+ export interface Snapshot {
41
+ branch: string;
42
+ head: string;
43
+ fingerprint: string;
44
+ diff: string;
45
+ paths: string[];
46
+ files: Record<string, string | null>;
47
+ }
48
+ export interface Workspace {
49
+ check(project: Project): Promise<void>;
50
+ prepare(project: Project, branch: string, signal?: AbortSignal): Promise<Snapshot>;
51
+ inspect(project: Project): Promise<Snapshot>;
52
+ verify(project: Project, expected: Snapshot): Promise<void>;
53
+ commit(project: Project, expected: Snapshot, publication: Publication, runId: string, signal?: AbortSignal): Promise<string>;
54
+ push(project: Project, branch: string, head: string, signal?: AbortSignal): Promise<void>;
55
+ release(project: Project): Promise<void>;
56
+ }
57
+ export interface HostingAdapter {
58
+ identity: string;
59
+ preflight?(): Promise<void>;
60
+ listIssues(labels: string[]): Promise<Issue[]>;
61
+ getIssue(number: number): Promise<Issue>;
62
+ findChange(branch: string): Promise<ChangeRequest | undefined>;
63
+ createChange(input: {
64
+ branch: string;
65
+ base: string;
66
+ head: string;
67
+ issue: Issue;
68
+ publication: Publication;
69
+ runId: string;
70
+ }): Promise<ChangeRequest>;
71
+ head(change: ChangeRequest): Promise<string>;
72
+ publishReview(input: {
73
+ change: ChangeRequest;
74
+ head: string;
75
+ review: Review;
76
+ runId: string;
77
+ diff: string;
78
+ }): Promise<void>;
79
+ }
80
+ export interface AgentInvocation {
81
+ id: string;
82
+ runId: string;
83
+ step: string;
84
+ cwd: string;
85
+ prompt: string;
86
+ profile: AgentProfile;
87
+ skills: string[];
88
+ processFile?: string;
89
+ readOnly: boolean;
90
+ signal: AbortSignal;
91
+ timeoutMs?: number;
92
+ session: (id: string) => Promise<void>;
93
+ event: (event: unknown) => Promise<void>;
94
+ }
95
+ export interface EffectiveProfile {
96
+ provider: string;
97
+ model: string;
98
+ reasoningEffort: string;
99
+ context: AgentProfile["context"] | "unknown";
100
+ contextWindowTokens: number | "unknown";
101
+ }
102
+ export interface AgentAdapter {
103
+ validate(profile: AgentProfile, signal?: AbortSignal): Promise<EffectiveProfile>;
104
+ invoke(invocation: AgentInvocation): Promise<string>;
105
+ }
106
+ export type Outcome = "queued" | "running" | "completed" | "failed" | "blocked" | "cancelled" | "no-change" | "ineligible";
107
+ export interface RunRecord {
108
+ id: string;
109
+ projectId: string;
110
+ checkout: string;
111
+ taskKey: string;
112
+ attempt: number;
113
+ retryOf?: string;
114
+ issue: Issue;
115
+ outcome: Outcome;
116
+ phase: string;
117
+ createdAt: string;
118
+ updatedAt: string;
119
+ branch: string;
120
+ base?: string;
121
+ head?: string;
122
+ snapshot?: Snapshot;
123
+ validation?: ValidationResult[];
124
+ publication?: Publication;
125
+ change?: ChangeRequest;
126
+ review?: Review;
127
+ reviewHead?: string;
128
+ error?: string;
129
+ }
130
+ export declare class BlockedError extends Error {
131
+ constructor(message: string);
132
+ }
133
+ export declare function isBlockedError(error: unknown): error is BlockedError;
@@ -0,0 +1,24 @@
1
+ import { z } from "zod";
2
+ export const publicationSchema = z.strictObject({
3
+ commitMessage: z.string().trim().min(1).max(10000),
4
+ title: z.string().trim().min(1).max(240),
5
+ description: z.string().trim().min(1).max(60000),
6
+ });
7
+ export const reviewSchema = z.strictObject({
8
+ summary: z.string().min(1),
9
+ findings: z.array(z.strictObject({
10
+ body: z.string().min(1),
11
+ path: z.string().optional(),
12
+ line: z.number().int().positive().optional(),
13
+ })),
14
+ });
15
+ export class BlockedError extends Error {
16
+ constructor(message) {
17
+ super(message);
18
+ this.name = "BlockedError";
19
+ }
20
+ }
21
+ export function isBlockedError(error) {
22
+ return (error instanceof BlockedError ||
23
+ (error instanceof Error && error.name === "BlockedError"));
24
+ }
@@ -0,0 +1,8 @@
1
+ export * from "./adapters/agents.js";
2
+ export * from "./adapters/hosting.js";
3
+ export * from "./config.js";
4
+ export * from "./domain.js";
5
+ export * from "./operations.js";
6
+ export * from "./runner.js";
7
+ export * from "./store.js";
8
+ export * from "./workspace.js";