opencode-ship 1.1.5 → 1.1.8

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/dist/core.d.ts CHANGED
@@ -1 +1,601 @@
1
- export {};
1
+ /**
2
+ * Public type declarations for the opencode-ship package.
3
+ *
4
+ * The package ships plain JavaScript ESM sources; this declaration
5
+ * file gives TypeScript consumers the surface they need to typecheck
6
+ * `import` statements without falling back to `any`. Every public
7
+ * value export from `src/index.js` is declared here; the consumer
8
+ * fixture under `tests/fixtures/consumer.ts` enforces that.
9
+ */
10
+
11
+ // ---------------------------------------------------------------------------
12
+ // Primitives
13
+ // ---------------------------------------------------------------------------
14
+
15
+ export type Sha = string;
16
+ export type Branch = string;
17
+ export type RepoSlug = `${string}/${string}`;
18
+ export type IssueNumber = number;
19
+ export type PullRequestNumber = number;
20
+
21
+ export type ContractVersion = 1;
22
+
23
+ export interface AdapterLock {
24
+ contractVersion: ContractVersion;
25
+ adapterSha256: Sha;
26
+ writtenAt: string;
27
+ }
28
+
29
+ // ---------------------------------------------------------------------------
30
+ // Lifecycle
31
+ // ---------------------------------------------------------------------------
32
+
33
+ export type LifecycleState =
34
+ | "issue-linked"
35
+ | "worktree-created"
36
+ | "draft-open"
37
+ | "validating"
38
+ | "ready"
39
+ | "merged"
40
+ | "cleanup-pending"
41
+ | "cleaned"
42
+ | "failed"
43
+ | "aborted";
44
+
45
+ export interface LifecycleTransition {
46
+ from: LifecycleState;
47
+ to: LifecycleState;
48
+ at: number;
49
+ reason?: string;
50
+ }
51
+
52
+ export interface Manifest {
53
+ schemaVersion: 2;
54
+ taskId: string;
55
+ repoIdentity: RepoSlug;
56
+ issueNumber: IssueNumber | null;
57
+ prNumber: PullRequestNumber | null;
58
+ baseBranch: Branch;
59
+ baseSha: Sha;
60
+ branch: Branch;
61
+ worktreePath: string | null;
62
+ lastPrHeadSha: Sha | null;
63
+ lastReviewerSha: Sha | null;
64
+ lastVerifierSha: Sha | null;
65
+ workflowId: string | null;
66
+ owner: string;
67
+ state: LifecycleState;
68
+ transitionLog: LifecycleTransition[];
69
+ fatalReason?: string;
70
+ createdAt: string;
71
+ updatedAt: string;
72
+ }
73
+
74
+ export interface CreateManifestInput {
75
+ taskId: string;
76
+ repoIdentity: RepoSlug;
77
+ issueNumber: IssueNumber | null;
78
+ baseBranch: Branch;
79
+ baseSha: Sha;
80
+ branch: Branch;
81
+ owner: string;
82
+ prNumber?: PullRequestNumber | null;
83
+ lastPrHeadSha?: Sha | null;
84
+ workflowId?: string | null;
85
+ }
86
+
87
+ export interface IssueSummary {
88
+ number: IssueNumber;
89
+ url: string;
90
+ state: "OPEN" | "CLOSED";
91
+ pullRequest: PullRequestSummary | null;
92
+ }
93
+
94
+ export interface PullRequestSummary {
95
+ number: PullRequestNumber;
96
+ url: string;
97
+ baseRefName: Branch;
98
+ headRefName: Branch;
99
+ headSha: Sha;
100
+ draft: boolean;
101
+ mergeable: "MERGEABLE" | "CONFLICTING" | "UNKNOWN";
102
+ mergeStateStatus: string;
103
+ state: "OPEN" | "CLOSED" | "MERGED" | "UNKNOWN";
104
+ merged: boolean;
105
+ mergedAt: string | null;
106
+ }
107
+
108
+ export interface CheckSummary {
109
+ name: string;
110
+ state: "success" | "failure" | "pending" | "neutral" | "skipped" | "cancelled" | "timed_out" | "action_required" | "stale" | "queued" | "in_progress" | "requested";
111
+ bucket: "pass" | "fail" | "pending" | "skip" | "neutral";
112
+ }
113
+
114
+ export interface EnsureIssueResult {
115
+ summary: IssueSummary;
116
+ created: boolean;
117
+ }
118
+
119
+ export interface GithubDriver {
120
+ ensureIssue(args: { repo: RepoSlug; title: string; body: string; labels: readonly string[] }): Promise<EnsureIssueResult>;
121
+ openDraftPullRequest(args: { repo: RepoSlug; head: Branch; base: Branch; title: string; body: string; issueNumber: IssueNumber }): Promise<PullRequestSummary>;
122
+ updatePullRequestBody(args: { repo: RepoSlug; number: PullRequestNumber; body: string }): Promise<void>;
123
+ markReady(args: { repo: RepoSlug; number: PullRequestNumber }): Promise<void>;
124
+ mergePullRequest(args: { repo: RepoSlug; number: PullRequestNumber; subject: string }): Promise<PullRequestSummary>;
125
+ readPullRequest(args: { repo: RepoSlug; number: PullRequestNumber }): Promise<PullRequestSummary>;
126
+ readChecks(args: { repo: RepoSlug; sha?: Sha; number?: PullRequestNumber; branch?: Branch; required: readonly string[] }): Promise<CheckSummary[]>;
127
+ comment(args: { repo: RepoSlug; number: PullRequestNumber; body: string }): Promise<void>;
128
+ refreshHead(args: { repo: RepoSlug; number: PullRequestNumber }): Promise<Sha>;
129
+ }
130
+
131
+ export interface CreateGhDriverOptions {
132
+ runner?: (args: readonly string[]) => Promise<{ status: number; stdout: string; stderr: string }>;
133
+ cwd?: string;
134
+ env?: NodeJS.ProcessEnv;
135
+ }
136
+
137
+ export type GhRunner = (args: readonly string[]) => Promise<{ status: number; stdout: string; stderr: string }>;
138
+
139
+ export interface GhStubHandle {
140
+ driver: GithubDriver;
141
+ queue: Array<{ match: (args: readonly string[]) => boolean; status?: number; stdout?: string; stderr?: string }>;
142
+ }
143
+
144
+ export interface RepoRef {
145
+ owner: string;
146
+ name: string;
147
+ }
148
+
149
+ // ---------------------------------------------------------------------------
150
+ // Adapter
151
+ // ---------------------------------------------------------------------------
152
+
153
+ export interface Adapter {
154
+ contractVersion: 1;
155
+ repository: {
156
+ remote: string;
157
+ defaultBranch?: { discover?: boolean; name?: Branch };
158
+ };
159
+ forge?: {
160
+ driver: "github";
161
+ issueRequired?: boolean;
162
+ draftAfterFirstCommit?: boolean;
163
+ issueClosingSyntax?: boolean;
164
+ };
165
+ worktree?: {
166
+ root: string;
167
+ branchTemplate: string;
168
+ bootstrap?: readonly (readonly string[])[];
169
+ };
170
+ verification?: {
171
+ commands: readonly { id: string; argv: readonly string[]; timeoutMs?: number }[];
172
+ requireCleanDiffAfter?: boolean;
173
+ invalidateOnHeadChange?: boolean;
174
+ };
175
+ review?: {
176
+ agent: string;
177
+ required: boolean;
178
+ invalidateOnHeadChange: boolean;
179
+ };
180
+ ci?: {
181
+ driver: "github-status-checks";
182
+ requiredChecks: readonly string[];
183
+ wait: boolean;
184
+ flakyRetry: 0 | 1;
185
+ };
186
+ ready?: {
187
+ requires: readonly ("review" | "local-verification" | "remote-ci")[];
188
+ stopAfterReady: boolean;
189
+ };
190
+ merge?: {
191
+ strategy: "squash";
192
+ policy: "explicit-user-request-only";
193
+ requireFreshGates: boolean;
194
+ };
195
+ cleanup?: {
196
+ when: "next-task";
197
+ requires: readonly ("pr-merged" | "worktree-clean" | "no-unpublished-commits")[];
198
+ };
199
+ }
200
+
201
+ export type AdapterLoadResult =
202
+ | { ok: true; adapter: Adapter; path: string; sha256: Sha }
203
+ | { ok: false; error: { kind: "missing" | "parse" | "contract"; path: string; message?: string; issues?: readonly string[] } };
204
+
205
+ export interface DoctorCheck {
206
+ name: string;
207
+ ok: boolean;
208
+ detail: string;
209
+ }
210
+
211
+ export interface DoctorReport {
212
+ contractVersion: 1;
213
+ adapterPath: string | null;
214
+ adapterSha256: Sha | null;
215
+ lockPath: string | null;
216
+ lockSha256: Sha | null;
217
+ packageVersion: string | null;
218
+ nodeVersion: string;
219
+ ghVersion: string | null;
220
+ gitVersion: string | null;
221
+ checks: DoctorCheck[];
222
+ }
223
+
224
+ export type TransitionResult =
225
+ | { ok: true; from: LifecycleState; to: LifecycleState; at: number; reason?: string }
226
+ | { ok: false; from: LifecycleState; attempted: LifecycleState; reason: string };
227
+
228
+ export interface GateSnapshot {
229
+ prHead: Sha | null;
230
+ reviewerSha: Sha | null;
231
+ verifierSha: Sha | null;
232
+ checks: readonly CheckSummary[];
233
+ missingChecks: readonly string[];
234
+ failingChecks: readonly string[];
235
+ pendingChecks: readonly string[];
236
+ }
237
+
238
+ export interface GateCheck {
239
+ ok: boolean;
240
+ reason?: string;
241
+ snapshot: GateSnapshot;
242
+ }
243
+
244
+ export interface RecoveryReport {
245
+ total: number;
246
+ pendingCleanup: number;
247
+ orphanWorktrees: number;
248
+ cleaned: number;
249
+ notes: string[];
250
+ }
251
+
252
+ export interface WorktreeRecordShape {
253
+ path: string;
254
+ branch: string;
255
+ head: Sha;
256
+ }
257
+
258
+ export type RunCommandResult =
259
+ | { ok: true; status: number; stdout: string; stderr: string }
260
+ | { ok: false; error: Error };
261
+
262
+ // ---------------------------------------------------------------------------
263
+ // Tool factory deps shapes
264
+ // ---------------------------------------------------------------------------
265
+
266
+ export interface BaseToolDeps {
267
+ driver: GithubDriver;
268
+ repoRoot: string;
269
+ repoSlug: RepoSlug;
270
+ owner: string;
271
+ adapter: Adapter;
272
+ remote?: string;
273
+ packageVersion?: string;
274
+ }
275
+
276
+ export interface InspectToolDeps {
277
+ driver?: GithubDriver;
278
+ repoRoot: string;
279
+ repoSlug: RepoSlug;
280
+ owner?: string;
281
+ adapter?: Adapter | null;
282
+ packageVersion: string;
283
+ remote?: string;
284
+ }
285
+
286
+ export interface IssueToolInput {
287
+ taskId: string;
288
+ title: string;
289
+ body?: string;
290
+ baseBranch: string;
291
+ baseSha?: string;
292
+ branch: string;
293
+ labels?: readonly string[];
294
+ }
295
+
296
+ export interface WorktreeToolInput {
297
+ taskId: string;
298
+ branch: string;
299
+ worktreeRelativePath: string;
300
+ }
301
+
302
+ export interface VerifyToolInput {
303
+ taskId: string;
304
+ commandId?: string;
305
+ }
306
+
307
+ export interface ReviewToolInput {
308
+ taskId: string;
309
+ status: "pass" | "fail" | "blocked" | "partial";
310
+ headSha?: Sha;
311
+ findings?: unknown;
312
+ envelope?: unknown;
313
+ }
314
+
315
+ export interface PrToolInput {
316
+ taskId: string;
317
+ title: string;
318
+ body: string;
319
+ }
320
+
321
+ export interface ReadyToolInput {
322
+ taskId: string;
323
+ }
324
+
325
+ export interface MergeToolInput {
326
+ taskId: string;
327
+ subject: string;
328
+ }
329
+
330
+ export interface CleanupToolInput {
331
+ taskId: string;
332
+ }
333
+
334
+ export interface AbandonToolInput {
335
+ taskId: string;
336
+ subject: string;
337
+ operationId?: string;
338
+ }
339
+
340
+ export type Envelope<TKind extends string, TData> = { kind: TKind } & TData;
341
+
342
+ // ---------------------------------------------------------------------------
343
+ // Envelope shapes (mirror the runtime tool returns)
344
+ // ---------------------------------------------------------------------------
345
+
346
+ export type IssueEnvelope = Envelope<
347
+ "issue",
348
+ {
349
+ contractVersion: 1;
350
+ created: boolean;
351
+ issueNumber: IssueNumber;
352
+ issueUrl: string;
353
+ manifestPath: string;
354
+ }
355
+ >;
356
+
357
+ export type MissingManifestEnvelope = Envelope<"missing-manifest", { taskId: string }>;
358
+ export type ManifestStateEnvelope = Envelope<"manifest-state", { state: LifecycleState }>;
359
+ export type MissingWorktreePathEnvelope = Envelope<"missing-worktree-path", Record<string, never>>;
360
+ export type MissingPrEnvelope = Envelope<"missing-pr", Record<string, never>>;
361
+ export type WorktreeExistsEnvelope = Envelope<"worktree-exists", Record<string, never>>;
362
+ export type BranchExistsLocallyEnvelope = Envelope<"branch-exists-locally", { branch: Branch }>;
363
+ export type BranchExistsRemotelyEnvelope = Envelope<"branch-exists-remotely", { branch: Branch }>;
364
+ export type RemoteFetchEnvelope = Envelope<"remote-fetch", { stderr: string }>;
365
+ export type CreateFailedEnvelope = Envelope<"create-failed", { stderr: string }>;
366
+ export type HeadChangedAfterVerifierEnvelope = Envelope<"head-changed-after-verifier", { headSha: Sha; verifierSha: Sha }>;
367
+ export type HeadChangedAfterReviewEnvelope = Envelope<"head-changed-after-review", { headSha: Sha; reviewSha: Sha }>;
368
+ export type MissingGateEnvelope = Envelope<"missing-gate", { gate: "review" | "local-verification" | "remote-ci" }>;
369
+ export type CiFailingEnvelope = Envelope<"ci-failing", { failing: readonly string[] }>;
370
+ export type CiPendingEnvelope = Envelope<"ci-pending", { pending: readonly string[] }>;
371
+ export type NotReadyEnvelope = Envelope<"not-ready", { state: LifecycleState }>;
372
+ export type WrongBaseEnvelope = Envelope<"wrong-base", { base: Branch }>;
373
+ export type HeadChangedEnvelope = Envelope<"head-changed", { headSha: Sha; manifestSha: Sha }>;
374
+ export type NotMergeableEnvelope = Envelope<"not-mergeable", { reason: string }>;
375
+ export type DirtyWorktreeEnvelope = Envelope<"dirty-worktree", Record<string, never>>;
376
+ export type RebaseInProgressEnvelope = Envelope<"rebase-in-progress", Record<string, never>>;
377
+ export type HeadMismatchEnvelope = Envelope<"head-mismatch", { headSha: Sha; manifestSha: Sha }>;
378
+ export type CurrentCheckoutEnvelope = Envelope<"current-checkout", { worktreePath: string }>;
379
+ export type UnmergedEnvelope = Envelope<"unmerged", { headSha: Sha; manifestSha: Sha }>;
380
+ export type BaseMismatchEnvelope = Envelope<"base-mismatch", { manifestBase: Branch; prBase: Branch }>;
381
+ export type HasUnpublishedCommitsEnvelope = Envelope<"has-unpublished-commits", { ahead: number }>;
382
+ export type RemoveFailedEnvelope = Envelope<"remove-failed", { stderr: string }>;
383
+ export type UnsafeCleanupEnvelope = Envelope<"unsafe-cleanup", { signals: readonly string[] }>;
384
+ export type VerifyFailedEnvelope = Envelope<"verify-failed", { commandId: string; status: number; headSha: Sha | null }>;
385
+ export type PathEscapeEnvelope = Envelope<"path-escape", { resolvedPath: string }>;
386
+ export type BootstrapFailedEnvelope = Envelope<"bootstrap-failed", { stderr: string; argv: readonly string[] }>;
387
+
388
+ // ---------------------------------------------------------------------------
389
+ // Value export declarations. The runtime values live in plain JS modules;
390
+ // these declarations are the contract that consumers rely on.
391
+ // ---------------------------------------------------------------------------
392
+
393
+ export declare const ADAPTER_CONTRACT_VERSION: ContractVersion;
394
+ export declare const ADAPTER_FILENAME: string;
395
+ export declare const LOCK_FILENAME: string;
396
+ export declare const PACKAGE_VERSION: string;
397
+ export declare const STATES: readonly LifecycleState[];
398
+
399
+ export declare const WorktreeRecord: WorktreeRecordShape;
400
+
401
+ export declare function validateAdapter(value: unknown): {
402
+ ok: boolean;
403
+ issues?: readonly string[];
404
+ adapter?: Adapter;
405
+ };
406
+ export declare function loadAdapter(repoRoot: string): Promise<AdapterLoadResult>;
407
+ export declare function writeLock(repoRoot: string, adapterSha256: Sha): Promise<string>;
408
+ export declare function readLock(repoRoot: string): Promise<AdapterLock | null>;
409
+ export declare function findOpencodeDir(start: string): string | null;
410
+
411
+ export declare function createManifest(input: CreateManifestInput): Manifest;
412
+ export declare function transition(
413
+ manifest: Manifest,
414
+ to: LifecycleState,
415
+ opts?: { reason?: string; now?: () => Date },
416
+ ): TransitionResult;
417
+ export declare function canTransition(from: LifecycleState, to: LifecycleState): boolean;
418
+ export declare function isTerminal(state: LifecycleState): boolean;
419
+ export declare function mustRerunReview(previousSha: Sha | null, currentSha: Sha): boolean;
420
+ export declare function mustRerunVerifier(previousSha: Sha | null, currentSha: Sha): boolean;
421
+
422
+ export declare function writeManifest(repoRoot: string, manifest: Manifest): Promise<string>;
423
+ export declare function readManifest(repoRoot: string, taskId: string): Promise<Manifest | null>;
424
+ export declare function listManifests(repoRoot: string): Promise<Manifest[]>;
425
+ export declare function deleteManifest(repoRoot: string, taskId: string): Promise<void>;
426
+
427
+ export declare function isInsideWorktree(cwd: string): boolean;
428
+ export declare function isMainCheckout(cwd: string): boolean;
429
+ export declare function listWorktrees(cwd: string): WorktreeRecordShape[];
430
+ export declare function isWorktreeClean(cwd: string): boolean;
431
+ export declare function isRebaseInProgress(cwd: string): boolean;
432
+ export declare function currentBranch(cwd: string): Branch | null;
433
+ export declare function revParse(ref: string, cwd: string): Sha | null;
434
+ export declare function fetchBranch(remote: string, branch: Branch, cwd: string): { status: number; stderr: string };
435
+ export declare function remoteExists(remote: string, cwd: string): boolean;
436
+ export declare function createWorktree(opts: { cwd: string; branch: Branch; worktreePath: string; base: string }): { status: number; stderr: string };
437
+ export declare function createWorktreeFromLocal(opts: { cwd: string; branch: Branch; worktreePath: string; base: string }): { status: number; stderr: string };
438
+ export declare function worktreeExists(cwd: string, path: string): boolean;
439
+ export declare function branchExistsLocally(branch: Branch, cwd: string): boolean;
440
+ export declare function branchExistsRemotely(remote: string, branch: Branch, cwd: string): boolean;
441
+ export declare function mergeIntoFeature(branch: Branch, base: Branch, cwd: string): { status: number; stderr: string };
442
+ export declare function currentHead(cwd: string): Sha | null;
443
+ export declare function push(remote: string, branch: Branch, cwd: string): { status: number; stderr: string };
444
+ export declare function pushForceDisabled(remote: string, branch: Branch, cwd: string): { status: number; stderr: string };
445
+ export declare function defaultBranch(cwd: string): Branch | null;
446
+ export declare function mergeBaseRemoteHead(remote: string, branch: Branch, cwd: string): Sha | null;
447
+
448
+ export declare function createGhDriver(opts?: CreateGhDriverOptions): GithubDriver;
449
+ export declare function createGhStub(
450
+ responses: Array<{
451
+ match: (args: readonly string[]) => boolean;
452
+ status?: number;
453
+ stdout?: string;
454
+ stderr?: string;
455
+ }>,
456
+ ): GhStubHandle;
457
+ export declare function parseRepoSlug(slug: string): RepoRef | null;
458
+
459
+ export declare function scanRecovery(repoRoot: string): Promise<RecoveryReport>;
460
+ export declare function wouldCleanupBeSafe(args: {
461
+ prMerged: boolean;
462
+ worktreeClean: boolean;
463
+ rebaseInProgress: boolean;
464
+ headMatchesPr: boolean;
465
+ baseMatches: boolean;
466
+ }): boolean;
467
+ export declare function removeManifestIfSafe(repoRoot: string, taskId: string): Promise<boolean>;
468
+ export declare function recoverManifestAfterCrash(manifest: Manifest): Manifest;
469
+
470
+ export declare function doctor(repoRoot: string, packageVersion: string | null, adapter?: Adapter | null): Promise<DoctorReport>;
471
+
472
+ export declare function bucketFor(check: CheckSummary | undefined | null): "pass" | "fail" | "pending" | "skip" | "neutral";
473
+ export declare function gateSnapshot(args: {
474
+ manifest: { adapter?: Adapter | null; lastReviewerSha?: Sha | null; lastVerifierSha?: Sha | null };
475
+ prHead: Sha | null;
476
+ checks: readonly CheckSummary[];
477
+ }): GateSnapshot;
478
+ export declare function checkGates(args: {
479
+ manifest: { adapter?: Adapter | null; lastReviewerSha?: Sha | null; lastVerifierSha?: Sha | null };
480
+ prHead: Sha | null;
481
+ checks: readonly CheckSummary[];
482
+ requires: readonly ("review" | "local-verification" | "remote-ci")[];
483
+ }): GateCheck;
484
+ export declare function gateFailureEnvelope(result: { reason: string; snapshot: GateSnapshot }):
485
+ | MissingGateEnvelope
486
+ | HeadChangedAfterReviewEnvelope
487
+ | HeadChangedAfterVerifierEnvelope
488
+ | Envelope<"ci-missing", { missing: readonly string[] }>
489
+ | Envelope<"ci-failing", { failing: readonly string[] }>
490
+ | Envelope<"ci-pending", { pending: readonly string[] }>
491
+ | Envelope<"gate-failed", { reason: string }>;
492
+
493
+ export declare function createInspectTool(deps: InspectToolDeps): (input: { taskId: string }) => Promise<{
494
+ contractVersion: 1;
495
+ manifest: Manifest | null;
496
+ doctor: DoctorReport;
497
+ }>;
498
+
499
+ export declare function createIssueTool(deps: BaseToolDeps): (input: IssueToolInput) => Promise<IssueEnvelope | Envelope<"missing-input", { field: string }> | Envelope<"lifecycle", { reason: string }>>;
500
+
501
+ export declare function createWorktreeTool(deps: BaseToolDeps): (input: WorktreeToolInput) => Promise<
502
+ | Envelope<"worktree", { contractVersion: 1; branch: Branch; worktreePath: string; headSha: Sha; manifestPath: string }>
503
+ | MissingManifestEnvelope
504
+ | ManifestStateEnvelope
505
+ | Envelope<"missing-input", { field: string }>
506
+ | RemoteFetchEnvelope
507
+ | BranchExistsLocallyEnvelope
508
+ | BranchExistsRemotelyEnvelope
509
+ | WorktreeExistsEnvelope
510
+ | CreateFailedEnvelope
511
+ | Envelope<"missing-base-sha", Record<string, never>>
512
+ | Envelope<"bootstrap-invalid", { bootstrap: unknown }>
513
+ | BootstrapFailedEnvelope
514
+ | PathEscapeEnvelope
515
+ | Envelope<"lifecycle", { reason: string }>
516
+ >;
517
+
518
+ export declare function createVerifyTool(deps: BaseToolDeps): (input: VerifyToolInput) => Promise<
519
+ | Envelope<"verify", { contractVersion: 1; commandId: string; status: 0; stdoutTail: string; stderrTail: string; headSha: Sha; manifestPath: string }>
520
+ | MissingManifestEnvelope
521
+ | ManifestStateEnvelope
522
+ | Envelope<"no-commands", Record<string, never>>
523
+ | Envelope<"command-not-found", { commandId: string }>
524
+ | Envelope<"worktree-dirty", Record<string, never>>
525
+ | Envelope<"no-head", Record<string, never>>
526
+ | VerifyFailedEnvelope
527
+ | Envelope<"lifecycle", { reason: string }>
528
+ >;
529
+
530
+ export declare function createReviewTool(deps: BaseToolDeps): (input: ReviewToolInput) => Promise<
531
+ | Envelope<"review", { contractVersion: 1; pr: PullRequestNumber; reviewerSha: Sha; manifestPath: string }>
532
+ | MissingManifestEnvelope
533
+ | MissingPrEnvelope
534
+ | ManifestStateEnvelope
535
+ | Envelope<"review-not-pass", { status: string; headSha: Sha; recordedReviewerSha: Sha | null }>
536
+ | HeadMismatchEnvelope
537
+ >;
538
+
539
+ export declare function createPrTool(deps: BaseToolDeps): (input: PrToolInput) => Promise<
540
+ | Envelope<"pr", { contractVersion: 1; pr: PullRequestSummary; manifestPath: string }>
541
+ | MissingManifestEnvelope
542
+ | ManifestStateEnvelope
543
+ | Envelope<"lifecycle", { reason: string }>
544
+ >;
545
+
546
+ export declare function createReadyTool(deps: BaseToolDeps): (input: ReadyToolInput) => Promise<
547
+ | Envelope<"ready", { contractVersion: 1; manifestPath: string; pr: PullRequestNumber }>
548
+ | MissingManifestEnvelope
549
+ | MissingPrEnvelope
550
+ | MissingGateEnvelope
551
+ | HeadChangedAfterReviewEnvelope
552
+ | HeadChangedAfterVerifierEnvelope
553
+ | Envelope<"ci-missing", { missing: readonly string[] }>
554
+ | Envelope<"ci-failing", { failing: readonly string[] }>
555
+ | Envelope<"ci-pending", { pending: readonly string[] }>
556
+ >;
557
+
558
+ export declare function createMergeTool(deps: BaseToolDeps): (input: MergeToolInput) => Promise<
559
+ | Envelope<"merge", { contractVersion: 1; manifestPath: string; pr: PullRequestNumber }>
560
+ | MissingManifestEnvelope
561
+ | MissingPrEnvelope
562
+ | NotReadyEnvelope
563
+ | WrongBaseEnvelope
564
+ | HeadChangedEnvelope
565
+ | NotMergeableEnvelope
566
+ | MissingGateEnvelope
567
+ | HeadChangedAfterReviewEnvelope
568
+ | HeadChangedAfterVerifierEnvelope
569
+ | Envelope<"ci-missing", { missing: readonly string[] }>
570
+ | Envelope<"ci-failing", { failing: readonly string[] }>
571
+ | Envelope<"ci-pending", { pending: readonly string[] }>
572
+ >;
573
+
574
+ export declare function createCleanupTool(deps: BaseToolDeps): (input: CleanupToolInput) => Promise<
575
+ | Envelope<"cleanup", { contractVersion: 1; manifestPath: string | null; removedPath: string }>
576
+ | MissingManifestEnvelope
577
+ | ManifestStateEnvelope
578
+ | MissingWorktreePathEnvelope
579
+ | MissingPrEnvelope
580
+ | CurrentCheckoutEnvelope
581
+ | DirtyWorktreeEnvelope
582
+ | RebaseInProgressEnvelope
583
+ | HeadMismatchEnvelope
584
+ | UnmergedEnvelope
585
+ | BaseMismatchEnvelope
586
+ | HasUnpublishedCommitsEnvelope
587
+ | RemoveFailedEnvelope
588
+ | Envelope<"branch-delete-failed", { stderr: string }>
589
+ | Envelope<"unsafe-cleanup", { signals: readonly string[] }>
590
+ >;
591
+
592
+ export declare function createAbandonTool(deps: BaseToolDeps): (input: AbandonToolInput) => Promise<
593
+ | { contractVersion: 2; ok: true; kind: "abandon"; operationId: string; idempotent: boolean; data: {
594
+ taskId: string;
595
+ intentHash: string;
596
+ removedWorktree: boolean;
597
+ deletedBranch: boolean;
598
+ deletedManifest: boolean;
599
+ } }
600
+ | { contractVersion: 2; ok: false; kind: "abandon"; operationId: string; retryable: boolean; message: string; details: { kind: string } }
601
+ >;