@snappedly-tools/shipyard 0.7.0 → 0.9.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.
- package/README.md +46 -43
- package/dist/{MountConfig-bZoCs4Dd.d.ts → MountConfig-K5ILnfht.d.ts} +1 -1
- package/dist/SandboxProvider-oUAwYlWm.d.ts +120 -0
- package/dist/{chunk-FDYOTN55.js → chunk-57EEKW3R.js} +361 -984
- package/dist/chunk-57EEKW3R.js.map +1 -0
- package/dist/{chunk-56TDSWFU.js → chunk-HXSZM52J.js} +3 -3
- package/dist/{chunk-56TDSWFU.js.map → chunk-HXSZM52J.js.map} +1 -1
- package/dist/{chunk-WAXEMZUV.js → chunk-JZUBT4WG.js} +241 -33
- package/dist/chunk-JZUBT4WG.js.map +1 -0
- package/dist/chunk-NQRFVKCU.js +1840 -0
- package/dist/chunk-NQRFVKCU.js.map +1 -0
- package/dist/chunk-Z5C4LHVP.js +137 -0
- package/dist/chunk-Z5C4LHVP.js.map +1 -0
- package/dist/createSandbox-DmbnWAZv.d.ts +739 -0
- package/dist/index.d.ts +99 -2606
- package/dist/index.js +412 -7487
- package/dist/index.js.map +1 -1
- package/dist/integrations/github.d.ts +52 -0
- package/dist/integrations/github.js +1049 -0
- package/dist/integrations/github.js.map +1 -0
- package/dist/integrations/releases.d.ts +136 -0
- package/dist/integrations/releases.js +500 -0
- package/dist/integrations/releases.js.map +1 -0
- package/dist/main.js +826 -472
- package/dist/main.js.map +1 -1
- package/dist/publication-BPoy_M9M.d.ts +1200 -0
- package/dist/sandboxes/docker.d.ts +2 -3
- package/dist/sandboxes/docker.js +2 -4
- package/dist/templates/parallel-planner/main.mts +78 -16
- package/dist/templates/parallel-planner/planner-branch.mts +151 -0
- package/dist/templates/parallel-planner/setup.sh +1 -0
- package/dist/templates/parallel-planner-with-review/main.mts +81 -19
- package/dist/templates/parallel-planner-with-review/planner-branch.mts +151 -0
- package/dist/templates/parallel-planner-with-review/setup.sh +1 -0
- package/dist/templates/sequential-reviewer/main.mts +59 -6
- package/dist/templates/sequential-reviewer/setup.sh +1 -0
- package/dist/templates/shared/setup.sh +1 -0
- package/dist/templates/simple-loop/main.mts +58 -5
- package/dist/templates/simple-loop/setup.sh +1 -0
- package/dist/workflow/coordinator/migrations/002_workflow_phase_records.sql +11 -0
- package/dist/workflow/coordinator/migrations/003_phase_record_schema_version.sql +6 -0
- package/dist/workflow.d.ts +472 -0
- package/dist/workflow.js +4345 -0
- package/dist/workflow.js.map +1 -0
- package/package.json +11 -15
- package/dist/SandboxProvider-XJQqEdSf.d.ts +0 -261
- package/dist/chunk-ACD46ZM4.js +0 -136
- package/dist/chunk-ACD46ZM4.js.map +0 -1
- package/dist/chunk-FDYOTN55.js.map +0 -1
- package/dist/chunk-KMGNFXKN.js +0 -38
- package/dist/chunk-KMGNFXKN.js.map +0 -1
- package/dist/chunk-SOJTAJTF.js +0 -78
- package/dist/chunk-SOJTAJTF.js.map +0 -1
- package/dist/chunk-WAXEMZUV.js.map +0 -1
- package/dist/sandboxes/no-sandbox.d.ts +0 -37
- package/dist/sandboxes/no-sandbox.js +0 -4
- package/dist/sandboxes/no-sandbox.js.map +0 -1
- package/dist/sandboxes/vercel.d.ts +0 -104
- package/dist/sandboxes/vercel.js +0 -166
- package/dist/sandboxes/vercel.js.map +0 -1
- package/dist/templates/blank/main.mts +0 -13
- package/dist/templates/blank/prompt.md +0 -12
- package/dist/templates/blank/template.json +0 -4
|
@@ -0,0 +1,472 @@
|
|
|
1
|
+
import { U as CoordinatorStorage, V as CoordinatorStorageTransaction, X as Assignment, W as WorkBrief, Y as RepositoryPolicy, Z as AgentSelection, _ as RevisionReference, $ as CheckEvidence, a0 as Finding, a1 as ReviewAxis, a2 as PhaseResult, a3 as FindingSeverity, a4 as ReviewEvidence, a5 as WorkflowCoordinator, I as GitHubPublication, a6 as WorkflowJob, a7 as DispatchResult, a8 as BranchLease, K as GitHubPublicationResult, O as GitHubPullRequestSnapshot, a9 as DispatchIntent, aa as WorkflowPhase, ab as RepositoryControl, D as GitHubIssueSnapshot, x as GitHubCommentSnapshot, ac as PostgresQueryClient } from './publication-BPoy_M9M.js';
|
|
2
|
+
export { ad as AcquireBranchLeaseInput, ae as AgentModelRoles, af as AgentRole, ag as Authorization, ah as BranchProtectionState, ai as CheckCommand, aj as CheckStatus, ak as ClarificationReply, al as CloseSourceIssueOptions, am as CompletionInput, an as CompletionResult, ao as ContractValidationError, ap as CoordinatorClock, aq as CreateAssignmentInput, ar as CreateRepositoryPolicyInput, as as CreateWorkBriefInput, at as DispatchBlockReason, au as DispatchRequest, av as DispatchStatus, aw as EffectExecution, ax as EffectIntent, ay as EffectOperationContext, az as EffectStatus, aA as EventIgnoreReason, aB as EventStatus, aC as FindingDisposition, aD as HandoffCandidate, aE as HandoffOutcome, aF as HandoffPacket, aG as HandoffReadinessInput, aH as HandoffReadinessResult, aI as HumanApproval, aJ as HumanHandoffPublisher, aK as HumanReviewDecision, H as HumanReviewDecisionInput, aL as HumanReviewRoundTripOptions, aM as HumanReviewRoundTripResult, aN as InMemoryTriageStore, aO as InfrastructureFailureInput, aP as InfrastructureRetryResult, aQ as IngestResult, aR as JobControl, aS as LeaseBusyError, aT as LeaseLostError, aU as LifecycleState, aV as MergeCandidateOptions, aW as MergeResult, aX as MergeTransport, aY as PhaseBudget, aZ as PhaseOutcome, a_ as PhaseResultSubmission, a$ as PostgresConnection, b0 as PostgresCoordinatorStorage, b1 as PostgresCoordinatorStorageOptions, b2 as PostgresQueryResult, b3 as PostgresTriageStore, b4 as PostgresTriageStoreOptions, b5 as PrepareHandoffOptions, b6 as PublishEffectInput, b7 as RepairBudgetUsage, b8 as RepairRequestResult, b9 as RiskLevel, ba as RunTriageOptions, bb as SchedulePhaseInput, bc as SchedulePhaseResult, bd as SourceIssueCloser, be as SourceIssueClosureResult, bf as SourceReference, bg as StoredEvent, bh as SubmitPhaseResultInput, bi as TransitionContext, bj as TriageAssessment, bk as TriageCategory, bl as TriageInvestigationRequest, bm as TriageInvestigator, bn as TriageOutcome, bo as TriageRecord, bp as TriageResult, bq as TriageSource, br as TriageSourceConflict, bs as TriageStore, bt as VerificationPlan, bu as WORKFLOW_CONTRACT_VERSION, bv as WorkIdentity, bw as WorkItemKind, bx as WorkKey, by as WorkRisk, bz as WorkScope, bA as WorkerPolicy, bB as WorkflowCoordinatorOptions, bC as WorkflowEventInput, bD as closeSourceIssue, bE as completeSourceIssue, bF as createAssignment, bG as createRepositoryPolicy, bH as createWorkBrief, bI as defaultTriageInvestigator, bJ as evaluateHandoffReadiness, bK as isAuthorizationAllowed, bL as mergeProtectedCandidate, bM as parseCheckEvidence, bN as parsePhaseResult, bO as parseRepositoryPolicy, bP as parseWorkBrief, bQ as prepareHumanHandoff, bR as processHumanReviewDecision, bS as requireTransition, bT as resolveAgentSelection, bU as resolveHumanReviewDecision, bV as runTriage } from './publication-BPoy_M9M.js';
|
|
3
|
+
import { l as OutputDefinition, A as AgentProvider, j as CreateSandboxOptions, a as Sandbox, p as RunOptions, q as RunResult } from './createSandbox-DmbnWAZv.js';
|
|
4
|
+
import { S as SandboxProvider } from './SandboxProvider-oUAwYlWm.js';
|
|
5
|
+
import '@standard-schema/spec';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Deterministic storage for coordinator tests. Each transaction runs against
|
|
9
|
+
* an isolated draft and commits atomically when the callback succeeds.
|
|
10
|
+
*/
|
|
11
|
+
declare class InMemoryCoordinatorStorage implements CoordinatorStorage {
|
|
12
|
+
private state;
|
|
13
|
+
private transactionTail;
|
|
14
|
+
transaction<T>(operation: (transaction: CoordinatorStorageTransaction) => Promise<T>): Promise<T>;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
interface TrustedPhaseInputs {
|
|
18
|
+
readonly brief: WorkBrief;
|
|
19
|
+
readonly policy: RepositoryPolicy;
|
|
20
|
+
readonly skill: {
|
|
21
|
+
readonly revision: string;
|
|
22
|
+
readonly content: string;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
interface UntrustedPhaseInputs {
|
|
26
|
+
readonly sourceText: string;
|
|
27
|
+
readonly repositoryContent: readonly string[];
|
|
28
|
+
}
|
|
29
|
+
interface PhaseControls {
|
|
30
|
+
readonly toolAllowlist: readonly string[];
|
|
31
|
+
readonly credentialAllowlist: readonly string[];
|
|
32
|
+
readonly timeoutSeconds: number;
|
|
33
|
+
readonly maxIterations: number;
|
|
34
|
+
}
|
|
35
|
+
interface CredentialResolver {
|
|
36
|
+
resolve(name: string): Promise<string | undefined>;
|
|
37
|
+
}
|
|
38
|
+
declare class CredentialNotAllowedError extends Error {
|
|
39
|
+
constructor(name: string);
|
|
40
|
+
}
|
|
41
|
+
declare class CredentialUnavailableError extends Error {
|
|
42
|
+
constructor(name: string);
|
|
43
|
+
}
|
|
44
|
+
interface PhaseCredentials {
|
|
45
|
+
get(name: string): Promise<string>;
|
|
46
|
+
}
|
|
47
|
+
interface PhaseCheckout {
|
|
48
|
+
readonly branch: string;
|
|
49
|
+
readonly candidate?: RevisionReference;
|
|
50
|
+
readonly immutable: boolean;
|
|
51
|
+
}
|
|
52
|
+
interface PhaseEngineRequest {
|
|
53
|
+
readonly assignment: Assignment;
|
|
54
|
+
readonly agentSelection: AgentSelection;
|
|
55
|
+
readonly trusted: TrustedPhaseInputs;
|
|
56
|
+
readonly untrusted: UntrustedPhaseInputs;
|
|
57
|
+
readonly controls: PhaseControls;
|
|
58
|
+
readonly credentials: PhaseCredentials;
|
|
59
|
+
readonly signal: AbortSignal;
|
|
60
|
+
readonly checkout: PhaseCheckout;
|
|
61
|
+
readonly output?: OutputDefinition;
|
|
62
|
+
}
|
|
63
|
+
interface PhaseArtifact {
|
|
64
|
+
readonly name: string;
|
|
65
|
+
readonly kind: "stdout" | "stderr" | "patch" | "log" | "worktree" | "other";
|
|
66
|
+
readonly content: string;
|
|
67
|
+
}
|
|
68
|
+
interface ArtifactStore {
|
|
69
|
+
save(artifact: PhaseArtifact): Promise<void>;
|
|
70
|
+
}
|
|
71
|
+
interface InMemoryArtifactStore extends ArtifactStore {
|
|
72
|
+
readonly artifacts: PhaseArtifact[];
|
|
73
|
+
}
|
|
74
|
+
declare const createInMemoryArtifactStore: () => InMemoryArtifactStore;
|
|
75
|
+
interface PhaseReport {
|
|
76
|
+
readonly summary: string;
|
|
77
|
+
readonly evidence: readonly string[];
|
|
78
|
+
readonly checks: readonly CheckEvidence[];
|
|
79
|
+
readonly commits: readonly string[];
|
|
80
|
+
readonly artifacts: readonly string[];
|
|
81
|
+
readonly questions: readonly string[];
|
|
82
|
+
readonly findings: readonly Finding[];
|
|
83
|
+
readonly reviewAxes?: readonly ReviewAxis[];
|
|
84
|
+
}
|
|
85
|
+
interface PhaseEngineResponse {
|
|
86
|
+
readonly stdout: string;
|
|
87
|
+
readonly stderr?: string;
|
|
88
|
+
readonly completionSignal?: string;
|
|
89
|
+
/** Kept for adapters that already validate output; executePhase revalidates stdout. */
|
|
90
|
+
readonly structuredOutput?: unknown;
|
|
91
|
+
readonly commits: readonly (string | {
|
|
92
|
+
readonly sha: string;
|
|
93
|
+
})[];
|
|
94
|
+
readonly branch: string;
|
|
95
|
+
readonly headSha: string;
|
|
96
|
+
readonly report: PhaseReport;
|
|
97
|
+
readonly artifacts?: readonly PhaseArtifact[];
|
|
98
|
+
readonly preservedWorktreePath?: string;
|
|
99
|
+
readonly outcome?: "completed" | "needs-info";
|
|
100
|
+
}
|
|
101
|
+
interface PhaseEngineAdapter {
|
|
102
|
+
/**
|
|
103
|
+
* Execute one phase. After `request.signal` aborts, this promise MUST settle
|
|
104
|
+
* only after the provider has stopped all work that can mutate the candidate.
|
|
105
|
+
*/
|
|
106
|
+
execute(request: PhaseEngineRequest): Promise<PhaseEngineResponse>;
|
|
107
|
+
}
|
|
108
|
+
interface FakePhaseEngineAdapterOptions {
|
|
109
|
+
readonly response?: PhaseEngineResponse;
|
|
110
|
+
readonly respond?: (request: PhaseEngineRequest) => Promise<PhaseEngineResponse>;
|
|
111
|
+
}
|
|
112
|
+
declare const createFakePhaseEngineAdapter: (options: FakePhaseEngineAdapterOptions) => PhaseEngineAdapter;
|
|
113
|
+
type PhaseExecutionStatus = "completed" | "needs-info" | "provider-failure" | "cancelled" | "timed-out" | "failed-verification";
|
|
114
|
+
interface PhaseFailure {
|
|
115
|
+
readonly kind: "provider" | "timeout" | "cancellation" | "validation";
|
|
116
|
+
readonly message: string;
|
|
117
|
+
}
|
|
118
|
+
interface PhaseExecutionResult {
|
|
119
|
+
readonly status: PhaseExecutionStatus;
|
|
120
|
+
readonly phaseResult: PhaseResult;
|
|
121
|
+
readonly output?: unknown;
|
|
122
|
+
readonly failure?: PhaseFailure;
|
|
123
|
+
}
|
|
124
|
+
interface ExecutePhaseOptions {
|
|
125
|
+
readonly assignment: Assignment;
|
|
126
|
+
/** Dedicated mutation branch for implementation and repair phases. */
|
|
127
|
+
readonly branch?: string;
|
|
128
|
+
readonly trusted: TrustedPhaseInputs;
|
|
129
|
+
readonly untrusted: UntrustedPhaseInputs;
|
|
130
|
+
readonly controls: PhaseControls;
|
|
131
|
+
readonly adapter: PhaseEngineAdapter;
|
|
132
|
+
readonly artifactStore: ArtifactStore;
|
|
133
|
+
readonly credentialResolver: CredentialResolver;
|
|
134
|
+
readonly output?: OutputDefinition;
|
|
135
|
+
readonly signal?: AbortSignal;
|
|
136
|
+
}
|
|
137
|
+
declare const executePhase: (options: ExecutePhaseOptions) => Promise<PhaseExecutionResult>;
|
|
138
|
+
type PhaseAgentResolver = {
|
|
139
|
+
/** Pre-resolved provider for legacy single-model policies. */
|
|
140
|
+
readonly agent: AgentProvider;
|
|
141
|
+
readonly resolveAgent?: never;
|
|
142
|
+
} | {
|
|
143
|
+
readonly agent?: never;
|
|
144
|
+
/** Creates the provider selected by the assignment's trusted policy. */
|
|
145
|
+
readonly resolveAgent: (selection: AgentSelection) => AgentProvider;
|
|
146
|
+
};
|
|
147
|
+
type RunPhaseEngineAdapterOptions = PhaseAgentResolver & {
|
|
148
|
+
readonly sandbox: SandboxProvider;
|
|
149
|
+
readonly cwd?: string;
|
|
150
|
+
readonly run: (options: RunOptions) => Promise<RunResult & {
|
|
151
|
+
output?: unknown;
|
|
152
|
+
}>;
|
|
153
|
+
};
|
|
154
|
+
declare const createRunPhaseEngineAdapter: (options: RunPhaseEngineAdapterOptions) => PhaseEngineAdapter;
|
|
155
|
+
type CreateSandboxPhaseEngineAdapterOptions = PhaseAgentResolver & {
|
|
156
|
+
readonly sandbox: SandboxProvider;
|
|
157
|
+
readonly cwd?: string;
|
|
158
|
+
readonly createSandbox: (options: CreateSandboxOptions) => Promise<Sandbox>;
|
|
159
|
+
};
|
|
160
|
+
declare const createCreateSandboxPhaseEngineAdapter: (options: CreateSandboxPhaseEngineAdapterOptions) => PhaseEngineAdapter;
|
|
161
|
+
|
|
162
|
+
type ReviewRunOutcome = "passed" | "actionable-findings" | "incomplete" | "blocked" | "failed";
|
|
163
|
+
interface ReviewCandidate {
|
|
164
|
+
readonly base: RevisionReference;
|
|
165
|
+
readonly head: RevisionReference;
|
|
166
|
+
readonly brief: WorkBrief;
|
|
167
|
+
readonly policy: RepositoryPolicy;
|
|
168
|
+
readonly requiredAxes?: readonly ReviewAxis[];
|
|
169
|
+
}
|
|
170
|
+
interface ReviewCheckout {
|
|
171
|
+
readonly base: RevisionReference;
|
|
172
|
+
readonly candidate: RevisionReference;
|
|
173
|
+
readonly immutable: true;
|
|
174
|
+
}
|
|
175
|
+
interface ReviewRequest {
|
|
176
|
+
readonly candidate: ReviewCandidate;
|
|
177
|
+
readonly checkout: ReviewCheckout;
|
|
178
|
+
readonly signal: AbortSignal;
|
|
179
|
+
}
|
|
180
|
+
interface ReviewFindingInput {
|
|
181
|
+
readonly id: string;
|
|
182
|
+
readonly severity: FindingSeverity;
|
|
183
|
+
readonly axis: ReviewAxis;
|
|
184
|
+
readonly title: string;
|
|
185
|
+
readonly evidence: string;
|
|
186
|
+
readonly location?: string;
|
|
187
|
+
readonly requirement?: string;
|
|
188
|
+
readonly verification?: string;
|
|
189
|
+
}
|
|
190
|
+
interface ReviewResponse {
|
|
191
|
+
readonly outcome?: ReviewRunOutcome;
|
|
192
|
+
readonly axes: readonly ReviewAxis[];
|
|
193
|
+
readonly findings: readonly ReviewFindingInput[];
|
|
194
|
+
readonly evidence: readonly string[];
|
|
195
|
+
readonly headSha: string;
|
|
196
|
+
readonly baseSha?: string;
|
|
197
|
+
readonly briefHash: string;
|
|
198
|
+
/** Any returned commit or changed file means the reviewer violated read-only review. */
|
|
199
|
+
readonly commits?: readonly string[];
|
|
200
|
+
readonly changedFiles?: readonly string[];
|
|
201
|
+
}
|
|
202
|
+
interface ReviewProvider {
|
|
203
|
+
review(request: ReviewRequest): Promise<ReviewResponse>;
|
|
204
|
+
}
|
|
205
|
+
interface CurrentCandidate {
|
|
206
|
+
readonly base: RevisionReference;
|
|
207
|
+
readonly head: RevisionReference;
|
|
208
|
+
readonly briefHash: string;
|
|
209
|
+
}
|
|
210
|
+
interface IndependentReviewOptions {
|
|
211
|
+
readonly candidate: ReviewCandidate;
|
|
212
|
+
readonly provider: ReviewProvider;
|
|
213
|
+
readonly readCurrent?: () => Promise<CurrentCandidate>;
|
|
214
|
+
readonly signal?: AbortSignal;
|
|
215
|
+
}
|
|
216
|
+
interface ReviewFailure {
|
|
217
|
+
readonly kind: "provider" | "malformed" | "stale-candidate" | "mutation";
|
|
218
|
+
readonly message: string;
|
|
219
|
+
}
|
|
220
|
+
interface IndependentReviewResult {
|
|
221
|
+
readonly outcome: ReviewRunOutcome;
|
|
222
|
+
readonly candidate: ReviewCandidate;
|
|
223
|
+
readonly reviewAxes: readonly ReviewAxis[];
|
|
224
|
+
readonly findings: readonly Finding[];
|
|
225
|
+
readonly evidence: readonly string[];
|
|
226
|
+
readonly reviewEvidence: ReviewEvidence;
|
|
227
|
+
readonly failure?: ReviewFailure;
|
|
228
|
+
}
|
|
229
|
+
/** Run a read-only, candidate-bound review and normalize its evidence. */
|
|
230
|
+
declare const runIndependentReview: (options: IndependentReviewOptions) => Promise<IndependentReviewResult>;
|
|
231
|
+
|
|
232
|
+
interface CurrentImplementationCandidate {
|
|
233
|
+
readonly base: RevisionReference;
|
|
234
|
+
readonly briefHash: string;
|
|
235
|
+
}
|
|
236
|
+
interface ImplementationExecutionTemplate extends Omit<ExecutePhaseOptions, "assignment" | "branch"> {
|
|
237
|
+
readonly branch?: string;
|
|
238
|
+
}
|
|
239
|
+
interface AuthorizedImplementationOptions {
|
|
240
|
+
readonly coordinator: WorkflowCoordinator;
|
|
241
|
+
readonly publication: GitHubPublication;
|
|
242
|
+
readonly brief: WorkBrief;
|
|
243
|
+
readonly policy: RepositoryPolicy;
|
|
244
|
+
readonly workerId: string;
|
|
245
|
+
readonly issueNumber?: number;
|
|
246
|
+
readonly branch?: string;
|
|
247
|
+
readonly execution?: ImplementationExecutionTemplate;
|
|
248
|
+
readonly readCurrent?: () => Promise<CurrentImplementationCandidate>;
|
|
249
|
+
readonly now?: () => string;
|
|
250
|
+
readonly leaseTtlMs?: number;
|
|
251
|
+
}
|
|
252
|
+
type ImplementationOutcome = "dispatched" | "completed" | "needs-info" | "blocked" | "failed";
|
|
253
|
+
interface ImplementationPublication {
|
|
254
|
+
readonly brief?: GitHubPublicationResult<unknown>;
|
|
255
|
+
readonly checks: readonly GitHubPublicationResult<unknown>[];
|
|
256
|
+
readonly branch?: GitHubPublicationResult<unknown>;
|
|
257
|
+
readonly pullRequest?: GitHubPublicationResult<GitHubPullRequestSnapshot>;
|
|
258
|
+
}
|
|
259
|
+
interface AuthorizedImplementationResult {
|
|
260
|
+
readonly outcome: ImplementationOutcome;
|
|
261
|
+
readonly reason?: string;
|
|
262
|
+
readonly job?: WorkflowJob;
|
|
263
|
+
readonly dispatch?: DispatchResult;
|
|
264
|
+
readonly assignment?: Assignment;
|
|
265
|
+
readonly lease?: BranchLease;
|
|
266
|
+
readonly phaseResult?: PhaseResult;
|
|
267
|
+
readonly execution?: PhaseExecutionResult;
|
|
268
|
+
readonly publication?: ImplementationPublication;
|
|
269
|
+
readonly pullRequest?: GitHubPullRequestSnapshot;
|
|
270
|
+
readonly nextPhase?: "review";
|
|
271
|
+
readonly nextDispatch?: DispatchIntent;
|
|
272
|
+
readonly readyForReview: boolean;
|
|
273
|
+
}
|
|
274
|
+
interface ReviewSchedulingInput {
|
|
275
|
+
readonly brief: WorkBrief;
|
|
276
|
+
readonly policy: RepositoryPolicy;
|
|
277
|
+
readonly base: RevisionReference;
|
|
278
|
+
readonly head: RevisionReference;
|
|
279
|
+
readonly checks: readonly CheckEvidence[];
|
|
280
|
+
readonly requiredAxes?: ReviewCandidate["requiredAxes"];
|
|
281
|
+
}
|
|
282
|
+
interface ReviewSchedulingResult {
|
|
283
|
+
readonly status: "ready" | "blocked";
|
|
284
|
+
readonly reasons: readonly string[];
|
|
285
|
+
readonly candidate?: ReviewCandidate;
|
|
286
|
+
}
|
|
287
|
+
/** Build a review candidate only after the current implementation checks pass. */
|
|
288
|
+
declare const prepareIndependentReview: (input: ReviewSchedulingInput) => ReviewSchedulingResult;
|
|
289
|
+
declare const runAuthorizedImplementation: (options: AuthorizedImplementationOptions) => Promise<AuthorizedImplementationResult>;
|
|
290
|
+
|
|
291
|
+
interface CostMeasurement {
|
|
292
|
+
readonly currency?: string;
|
|
293
|
+
readonly amount?: number;
|
|
294
|
+
readonly inputTokens?: number;
|
|
295
|
+
readonly outputTokens?: number;
|
|
296
|
+
readonly provider?: string;
|
|
297
|
+
readonly model?: string;
|
|
298
|
+
}
|
|
299
|
+
interface OperatorStatusOptions {
|
|
300
|
+
readonly cost?: CostMeasurement;
|
|
301
|
+
readonly now?: string;
|
|
302
|
+
}
|
|
303
|
+
interface OperatorCheckStatus {
|
|
304
|
+
readonly name: string;
|
|
305
|
+
readonly command: string;
|
|
306
|
+
readonly status: CheckEvidence["status"];
|
|
307
|
+
readonly summary: string;
|
|
308
|
+
readonly artifactRefs?: readonly string[];
|
|
309
|
+
}
|
|
310
|
+
interface OperatorStatus {
|
|
311
|
+
readonly jobId: string;
|
|
312
|
+
readonly repository: string;
|
|
313
|
+
readonly itemId: string;
|
|
314
|
+
readonly kind: string;
|
|
315
|
+
readonly state: WorkflowJob["state"];
|
|
316
|
+
readonly control: WorkflowJob["control"];
|
|
317
|
+
readonly phase: WorkflowPhase;
|
|
318
|
+
readonly waitingReason?: string;
|
|
319
|
+
readonly queueAgeSeconds: number;
|
|
320
|
+
readonly attempts: Readonly<Record<WorkflowPhase, number>>;
|
|
321
|
+
readonly activeAssignmentId?: string;
|
|
322
|
+
readonly latestObservedAt: string;
|
|
323
|
+
readonly checks: readonly OperatorCheckStatus[];
|
|
324
|
+
readonly artifacts: readonly string[];
|
|
325
|
+
readonly cost: {
|
|
326
|
+
readonly status: "unknown";
|
|
327
|
+
} | ({
|
|
328
|
+
readonly status: "measured";
|
|
329
|
+
} & CostMeasurement);
|
|
330
|
+
readonly interventions: readonly OperatorIntervention[];
|
|
331
|
+
readonly repositoryControl?: RepositoryControl;
|
|
332
|
+
}
|
|
333
|
+
interface OperatorIntervention {
|
|
334
|
+
readonly action: "pause" | "cancel" | "resume" | "stop-repository" | "resume-repository";
|
|
335
|
+
readonly reason?: string;
|
|
336
|
+
readonly at: string;
|
|
337
|
+
}
|
|
338
|
+
interface WorkflowOperatorOptions {
|
|
339
|
+
readonly coordinator: WorkflowCoordinator;
|
|
340
|
+
readonly now?: () => string;
|
|
341
|
+
}
|
|
342
|
+
declare const redact: (value: string) => string;
|
|
343
|
+
declare class WorkflowOperator {
|
|
344
|
+
private readonly coordinator;
|
|
345
|
+
private readonly now;
|
|
346
|
+
private readonly interventions;
|
|
347
|
+
constructor(options: WorkflowOperatorOptions);
|
|
348
|
+
status(jobId: string, options?: OperatorStatusOptions): Promise<OperatorStatus>;
|
|
349
|
+
pause(jobId: string, reason?: string): Promise<WorkflowJob>;
|
|
350
|
+
cancel(jobId: string, reason?: string): Promise<WorkflowJob>;
|
|
351
|
+
resume(jobId: string): Promise<WorkflowJob>;
|
|
352
|
+
stopRepository(repository: string, reason?: string): Promise<RepositoryControl>;
|
|
353
|
+
resumeRepository(repository: string): Promise<RepositoryControl>;
|
|
354
|
+
private record;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
interface RepairCandidate {
|
|
358
|
+
readonly base: RevisionReference;
|
|
359
|
+
readonly head: RevisionReference;
|
|
360
|
+
readonly briefHash: string;
|
|
361
|
+
}
|
|
362
|
+
interface RepairBatch {
|
|
363
|
+
readonly id: string;
|
|
364
|
+
readonly jobId: string;
|
|
365
|
+
readonly sourceIssueNumber?: number;
|
|
366
|
+
readonly pullRequestNumber?: number;
|
|
367
|
+
readonly candidate: RepairCandidate;
|
|
368
|
+
readonly brief: WorkBrief;
|
|
369
|
+
readonly findings: readonly Finding[];
|
|
370
|
+
readonly followUp: boolean;
|
|
371
|
+
readonly createdAt: string;
|
|
372
|
+
}
|
|
373
|
+
interface RepairBatchStore {
|
|
374
|
+
get(key: string): RepairBatchResult | undefined | Promise<RepairBatchResult | undefined>;
|
|
375
|
+
save(key: string, result: RepairBatchResult, updatedAt?: string): void | Promise<void>;
|
|
376
|
+
}
|
|
377
|
+
declare class InMemoryRepairBatchStore implements RepairBatchStore {
|
|
378
|
+
private readonly results;
|
|
379
|
+
get(key: string): RepairBatchResult | undefined;
|
|
380
|
+
save(key: string, result: RepairBatchResult): void;
|
|
381
|
+
}
|
|
382
|
+
interface PostgresRepairBatchStoreOptions {
|
|
383
|
+
readonly client: PostgresQueryClient;
|
|
384
|
+
}
|
|
385
|
+
/** Durable bounded-repair records backed by the coordinator's PostgreSQL database. */
|
|
386
|
+
declare class PostgresRepairBatchStore implements RepairBatchStore {
|
|
387
|
+
private readonly records;
|
|
388
|
+
constructor(options: PostgresRepairBatchStoreOptions);
|
|
389
|
+
get(key: string): Promise<RepairBatchResult | undefined>;
|
|
390
|
+
save(key: string, result: RepairBatchResult, updatedAt?: string): Promise<void>;
|
|
391
|
+
}
|
|
392
|
+
interface CurrentRepairCandidate {
|
|
393
|
+
readonly base: RevisionReference;
|
|
394
|
+
readonly head: RevisionReference;
|
|
395
|
+
readonly briefHash: string;
|
|
396
|
+
readonly pullRequest?: GitHubPullRequestSnapshot;
|
|
397
|
+
}
|
|
398
|
+
interface ScheduleRepairOptions {
|
|
399
|
+
readonly coordinator: WorkflowCoordinator;
|
|
400
|
+
readonly publication: GitHubPublication;
|
|
401
|
+
readonly store: RepairBatchStore;
|
|
402
|
+
readonly jobId: string;
|
|
403
|
+
readonly brief: WorkBrief;
|
|
404
|
+
readonly policy: RepositoryPolicy;
|
|
405
|
+
readonly candidate: RepairCandidate;
|
|
406
|
+
readonly workerId: string;
|
|
407
|
+
readonly sourceIssueNumber?: number;
|
|
408
|
+
readonly pullRequestNumber?: number;
|
|
409
|
+
readonly followUp?: boolean;
|
|
410
|
+
readonly pullRequestState?: "open" | "closed";
|
|
411
|
+
readonly readCurrent?: () => Promise<CurrentRepairCandidate>;
|
|
412
|
+
readonly now?: () => string;
|
|
413
|
+
readonly leaseTtlMs?: number;
|
|
414
|
+
}
|
|
415
|
+
type RepairScheduleOutcome = "scheduled" | "duplicate" | "blocked";
|
|
416
|
+
interface RepairBatchResult {
|
|
417
|
+
readonly outcome: RepairScheduleOutcome;
|
|
418
|
+
readonly reason?: string;
|
|
419
|
+
readonly batch: RepairBatch;
|
|
420
|
+
readonly job?: WorkflowJob;
|
|
421
|
+
readonly dispatch?: DispatchIntent;
|
|
422
|
+
/** Fresh dispatch ID to reclaim when its saved claim has expired. */
|
|
423
|
+
readonly resumeDispatchId?: string;
|
|
424
|
+
readonly lease?: BranchLease;
|
|
425
|
+
readonly repairIssue?: GitHubIssueSnapshot;
|
|
426
|
+
readonly issuePublication?: GitHubPublicationResult<GitHubIssueSnapshot>;
|
|
427
|
+
readonly linkPublication?: GitHubPublicationResult<GitHubCommentSnapshot>;
|
|
428
|
+
}
|
|
429
|
+
interface ScheduleRepairInput extends ScheduleRepairOptions {
|
|
430
|
+
readonly findings: readonly Finding[];
|
|
431
|
+
}
|
|
432
|
+
interface RepairExecutionTemplate extends Omit<ExecutePhaseOptions, "assignment" | "branch"> {
|
|
433
|
+
readonly branch?: string;
|
|
434
|
+
}
|
|
435
|
+
interface RunBoundedRepairOptions extends ScheduleRepairInput {
|
|
436
|
+
readonly execution: RepairExecutionTemplate;
|
|
437
|
+
}
|
|
438
|
+
interface BoundedRepairExecutionResult {
|
|
439
|
+
readonly outcome: "completed" | "needs-info" | "failed" | "blocked";
|
|
440
|
+
readonly reason?: string;
|
|
441
|
+
readonly repair: RepairBatchResult;
|
|
442
|
+
readonly assignment?: Assignment;
|
|
443
|
+
readonly dispatch?: DispatchResult;
|
|
444
|
+
readonly execution?: PhaseExecutionResult;
|
|
445
|
+
readonly phaseResult?: PhaseResult;
|
|
446
|
+
readonly nextPhase?: "checking" | "review";
|
|
447
|
+
readonly nextDispatch?: DispatchIntent;
|
|
448
|
+
}
|
|
449
|
+
declare const scheduleBoundedRepair: (input: ScheduleRepairInput) => Promise<RepairBatchResult>;
|
|
450
|
+
/** Execute a scheduled repair on the existing leased branch; review remains a separate phase. */
|
|
451
|
+
declare const runBoundedRepair: (input: RunBoundedRepairOptions) => Promise<BoundedRepairExecutionResult>;
|
|
452
|
+
|
|
453
|
+
type WorkflowPhaseRecordKind = "triage" | "repair-batch";
|
|
454
|
+
/** Persistence shared by workflow phases whose records do not belong in the coordinator ledger. */
|
|
455
|
+
interface WorkflowPhaseRecordStore {
|
|
456
|
+
get(kind: WorkflowPhaseRecordKind, key: string): Promise<unknown | undefined>;
|
|
457
|
+
save(kind: "repair-batch", key: string, record: unknown, updatedAt: string): Promise<void>;
|
|
458
|
+
compareAndSaveTriage(key: string, expectedRevision: number | undefined, record: unknown, updatedAt: string): Promise<boolean>;
|
|
459
|
+
}
|
|
460
|
+
interface PostgresWorkflowPhaseRecordStoreOptions {
|
|
461
|
+
readonly client: PostgresQueryClient;
|
|
462
|
+
}
|
|
463
|
+
/** Stores resumable triage and repair records in the coordinator database. */
|
|
464
|
+
declare class PostgresWorkflowPhaseRecordStore implements WorkflowPhaseRecordStore {
|
|
465
|
+
private readonly client;
|
|
466
|
+
constructor(options: PostgresWorkflowPhaseRecordStoreOptions);
|
|
467
|
+
get(kind: WorkflowPhaseRecordKind, key: string): Promise<unknown | undefined>;
|
|
468
|
+
save(kind: "repair-batch", key: string, record: unknown, updatedAt: string): Promise<void>;
|
|
469
|
+
compareAndSaveTriage(key: string, expectedRevision: number | undefined, record: unknown, updatedAt: string): Promise<boolean>;
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
export { AgentSelection, type ArtifactStore, Assignment, type AuthorizedImplementationOptions, type AuthorizedImplementationResult, type BoundedRepairExecutionResult, BranchLease, CheckEvidence, CoordinatorStorage, CoordinatorStorageTransaction, type CostMeasurement, type CreateSandboxPhaseEngineAdapterOptions, CredentialNotAllowedError, type CredentialResolver, CredentialUnavailableError, type CurrentCandidate, type CurrentImplementationCandidate, type CurrentRepairCandidate, DispatchIntent, DispatchResult, type ExecutePhaseOptions, type FakePhaseEngineAdapterOptions, Finding, FindingSeverity, type ImplementationExecutionTemplate, type ImplementationOutcome, type ImplementationPublication, type InMemoryArtifactStore, InMemoryCoordinatorStorage, InMemoryRepairBatchStore, type IndependentReviewOptions, type IndependentReviewResult, type OperatorCheckStatus, type OperatorIntervention, type OperatorStatus, type OperatorStatusOptions, type PhaseAgentResolver, type PhaseArtifact, type PhaseCheckout, type PhaseControls, type PhaseCredentials, type PhaseEngineAdapter, type PhaseEngineRequest, type PhaseEngineResponse, type PhaseExecutionResult, type PhaseExecutionStatus, type PhaseFailure, type PhaseReport, PhaseResult, PostgresQueryClient, PostgresRepairBatchStore, type PostgresRepairBatchStoreOptions, PostgresWorkflowPhaseRecordStore, type PostgresWorkflowPhaseRecordStoreOptions, type RepairBatch, type RepairBatchResult, type RepairBatchStore, type RepairCandidate, type RepairExecutionTemplate, type RepairScheduleOutcome, RepositoryControl, RepositoryPolicy, ReviewAxis, type ReviewCandidate, type ReviewCheckout, ReviewEvidence, type ReviewFailure, type ReviewFindingInput, type ReviewProvider, type ReviewRequest, type ReviewResponse, type ReviewRunOutcome, type ReviewSchedulingInput, type ReviewSchedulingResult, RevisionReference, type RunBoundedRepairOptions, type RunPhaseEngineAdapterOptions, type ScheduleRepairInput, type ScheduleRepairOptions, type TrustedPhaseInputs, type UntrustedPhaseInputs, WorkBrief, WorkflowCoordinator, WorkflowJob, WorkflowOperator, type WorkflowOperatorOptions, WorkflowPhase, type WorkflowPhaseRecordKind, type WorkflowPhaseRecordStore, createCreateSandboxPhaseEngineAdapter, createFakePhaseEngineAdapter, createInMemoryArtifactStore, createRunPhaseEngineAdapter, executePhase, prepareIndependentReview, redact as redactOperatorText, runAuthorizedImplementation, runBoundedRepair, runIndependentReview, scheduleBoundedRepair };
|