@andorra-labs/code 0.1.16 → 0.1.17
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/src/acp-agent.d.ts +6 -0
- package/dist/src/acp-agent.js +15 -4
- package/dist/src/agent-execution.js +11 -8
- package/dist/src/agent-mcp-catalog.js +1 -0
- package/dist/src/agent-mcp.d.ts +3 -0
- package/dist/src/agent-mcp.js +33 -1
- package/dist/src/andorra/entry.d.ts +10 -0
- package/dist/src/andorra/entry.js +18 -4
- package/dist/src/andorra/hosted.d.ts +2 -1
- package/dist/src/andorra/hosted.js +2 -1
- package/dist/src/andorra/notices.d.ts +5 -0
- package/dist/src/andorra/notices.js +7 -0
- package/dist/src/andorra/state.d.ts +3 -2
- package/dist/src/andorra/state.js +4 -4
- package/dist/src/andorra/terminal.js +7 -2
- package/dist/src/anthropic-credentials.js +2 -0
- package/dist/src/app-server/error.d.ts +5 -0
- package/dist/src/app-server/error.js +7 -0
- package/dist/src/app-server/protocol.d.ts +19 -44
- package/dist/src/app-server/protocol.js +5 -1
- package/dist/src/app-server/workspace.d.ts +89 -0
- package/dist/src/app-server/workspace.js +457 -11
- package/dist/src/app-server.d.ts +358 -32
- package/dist/src/app-server.js +2429 -509
- package/dist/src/bridge/cloud.d.ts +27 -0
- package/dist/src/bridge/cloud.js +187 -0
- package/dist/src/bridge/command.d.ts +30 -0
- package/dist/src/bridge/command.js +347 -0
- package/dist/src/bridge/control.d.ts +68 -0
- package/dist/src/bridge/control.js +233 -0
- package/dist/src/bridge/engines.d.ts +90 -0
- package/dist/src/bridge/engines.js +601 -0
- package/dist/src/bridge/host-ops.d.ts +9 -0
- package/dist/src/bridge/host-ops.js +129 -0
- package/dist/src/bridge/host.d.ts +47 -0
- package/dist/src/bridge/host.js +540 -0
- package/dist/src/bridge/link.d.ts +38 -0
- package/dist/src/bridge/link.js +508 -0
- package/dist/src/bridge/login-link.d.ts +29 -0
- package/dist/src/bridge/login-link.js +54 -0
- package/dist/src/bridge/protocol.d.ts +136 -0
- package/dist/src/bridge/protocol.js +11 -0
- package/dist/src/bridge/store.d.ts +12 -0
- package/dist/src/bridge/store.js +61 -0
- package/dist/src/bridge/wording.d.ts +6 -0
- package/dist/src/bridge/wording.js +10 -0
- package/dist/src/browser-server.js +7 -1
- package/dist/src/browser-ui/tokens.css +1 -1
- package/dist/src/change-authors.d.ts +41 -0
- package/dist/src/change-authors.js +146 -0
- package/dist/src/cli.js +182 -32
- package/dist/src/coding-tools.js +15 -15
- package/dist/src/command-screens.d.ts +6 -0
- package/dist/src/command-screens.js +14 -11
- package/dist/src/commands.d.ts +14 -2
- package/dist/src/compaction-phrases.js +1 -1
- package/dist/src/completion.js +82 -5
- package/dist/src/config.d.ts +71 -3
- package/dist/src/config.js +202 -77
- package/dist/src/deadline.js +13 -1
- package/dist/src/decision/checks.js +1 -1
- package/dist/src/decision/requestPhrases.js +0 -1
- package/dist/src/default-graph.js +1 -1
- package/dist/src/file-diff.d.ts +4 -0
- package/dist/src/file-diff.js +2 -1
- package/dist/src/github-app/agent-writes.d.ts +102 -0
- package/dist/src/github-app/agent-writes.js +320 -0
- package/dist/src/github-app/client.d.ts +349 -0
- package/dist/src/github-app/client.js +810 -0
- package/dist/src/github-app/event-source.d.ts +208 -0
- package/dist/src/github-app/event-source.js +684 -0
- package/dist/src/github-app/metrics.d.ts +32 -0
- package/dist/src/github-app/metrics.js +49 -0
- package/dist/src/github-app/review-loop.d.ts +274 -0
- package/dist/src/github-app/review-loop.js +1177 -0
- package/dist/src/github-app/review-node.d.ts +81 -0
- package/dist/src/github-app/review-node.js +205 -0
- package/dist/src/github-app/review-post.d.ts +73 -0
- package/dist/src/github-app/review-post.js +139 -0
- package/dist/src/github-app/review-text.d.ts +107 -0
- package/dist/src/github-app/review-text.js +1133 -0
- package/dist/src/github-app/review-threads.d.ts +47 -0
- package/dist/src/github-app/review-threads.js +107 -0
- package/dist/src/github-app/reviewer.d.ts +121 -0
- package/dist/src/github-app/reviewer.js +598 -0
- package/dist/src/github-app/store.d.ts +59 -0
- package/dist/src/github-app/store.js +148 -0
- package/dist/src/github-app/triggers.d.ts +141 -0
- package/dist/src/github-app/triggers.js +441 -0
- package/dist/src/github-names.d.ts +8 -0
- package/dist/src/github-names.js +8 -0
- package/dist/src/glob-search.d.ts +61 -0
- package/dist/src/glob-search.js +180 -0
- package/dist/src/graph-health.js +6 -1
- package/dist/src/graph-manager-chat.js +1 -1
- package/dist/src/graph-preview.d.ts +46 -0
- package/dist/src/graph-preview.js +55 -0
- package/dist/src/graph-provider-portability.js +2 -1
- package/dist/src/graph-runner.js +64 -3
- package/dist/src/graph-server.js +3 -3
- package/dist/src/graph-sync.js +3 -3
- package/dist/src/graph-ui/app.js +91 -7
- package/dist/src/graph-ui/icons.js +2 -1
- package/dist/src/graph-ui/studio.js +15 -1
- package/dist/src/graph-ui/tokens.css +1 -1
- package/dist/src/graphs.d.ts +34 -1
- package/dist/src/graphs.js +158 -14
- package/dist/src/image-input.d.ts +16 -0
- package/dist/src/image-input.js +41 -0
- package/dist/src/membership.d.ts +10 -0
- package/dist/src/membership.js +19 -4
- package/dist/src/model-health-cache.js +1 -1
- package/dist/src/model-metadata.d.ts +6 -0
- package/dist/src/model-metadata.js +35 -15
- package/dist/src/model-relay/local.d.ts +116 -0
- package/dist/src/model-relay/local.js +468 -0
- package/dist/src/model-relay/remote.d.ts +129 -0
- package/dist/src/model-relay/remote.js +252 -0
- package/dist/src/model-relay/runs.d.ts +34 -0
- package/dist/src/model-relay/runs.js +146 -0
- package/dist/src/model-relay/wire.d.ts +5 -0
- package/dist/src/model-relay/wire.js +5 -0
- package/dist/src/project-registry.d.ts +21 -0
- package/dist/src/project-registry.js +74 -0
- package/dist/src/provider-import.d.ts +0 -12
- package/dist/src/provider-import.js +7 -195
- package/dist/src/providers.d.ts +23 -2
- package/dist/src/providers.js +25 -4
- package/dist/src/pull-request-logs.d.ts +12 -1
- package/dist/src/pull-request-logs.js +14 -3
- package/dist/src/pull-requests.d.ts +327 -7
- package/dist/src/pull-requests.js +429 -51
- package/dist/src/react-runtime.js +1 -1
- package/dist/src/remote/engine-pool.d.ts +88 -4
- package/dist/src/remote/engine-pool.js +366 -89
- package/dist/src/remote/roots.d.ts +19 -0
- package/dist/src/remote/roots.js +45 -7
- package/dist/src/remote/types.d.ts +0 -44
- package/dist/src/run-control.d.ts +7 -0
- package/dist/src/run-control.js +23 -0
- package/dist/src/run-records.d.ts +7 -2
- package/dist/src/run-records.js +71 -6
- package/dist/src/runtime.d.ts +5 -1
- package/dist/src/runtime.js +10 -2
- package/dist/src/session-changes.d.ts +35 -0
- package/dist/src/session-changes.js +194 -6
- package/dist/src/session-monitor.js +2 -1
- package/dist/src/session-reaper.d.ts +1 -1
- package/dist/src/session-reaper.js +6 -1
- package/dist/src/session-summary.d.ts +2 -1
- package/dist/src/session-summary.js +2 -1
- package/dist/src/sessions.d.ts +11 -1
- package/dist/src/sessions.js +17 -4
- package/dist/src/skills/bundled/diagram/SKILL.md +5 -3
- package/dist/src/skills/bundled/graph-manager/SKILL.md +7 -4
- package/dist/src/skills/bundled/provenance.json +2 -2
- package/dist/src/skills/runtime-skills.js +1 -1
- package/dist/src/telemetry/emitter.d.ts +15 -0
- package/dist/src/telemetry/emitter.js +35 -1
- package/dist/src/telemetry/schema.d.ts +25 -2
- package/dist/src/telemetry/schema.js +52 -4
- package/dist/src/telemetry/surface.d.ts +2 -1
- package/dist/src/telemetry/surface.js +4 -1
- package/dist/src/terminal-ui.d.ts +1 -0
- package/dist/src/terminal-ui.js +10 -3
- package/dist/src/test-edit-guard.d.ts +7 -0
- package/dist/src/test-edit-guard.js +49 -1
- package/dist/src/timers.d.ts +2 -0
- package/dist/src/tools.js +59 -9
- package/package.json +6 -1
- package/dist/src/remote/cert.d.ts +0 -11
- package/dist/src/remote/cert.js +0 -87
- package/dist/src/remote/client.d.ts +0 -119
- package/dist/src/remote/client.js +0 -544
- package/dist/src/remote/command.d.ts +0 -4
- package/dist/src/remote/command.js +0 -194
- package/dist/src/remote/errors.d.ts +0 -11
- package/dist/src/remote/errors.js +0 -14
- package/dist/src/remote/network.d.ts +0 -22
- package/dist/src/remote/network.js +0 -102
- package/dist/src/remote/pairing.d.ts +0 -63
- package/dist/src/remote/pairing.js +0 -299
- package/dist/src/remote/pem.d.ts +0 -2
- package/dist/src/remote/pem.js +0 -7
- package/dist/src/remote/serve.d.ts +0 -68
- package/dist/src/remote/serve.js +0 -244
- package/dist/src/remote/server.d.ts +0 -21
- package/dist/src/remote/server.js +0 -406
|
@@ -1,6 +1,127 @@
|
|
|
1
1
|
import { type PullRequestChecksRollup } from './pull-request-checks.js';
|
|
2
|
-
import { type FailedCheck } from './pull-request-logs.js';
|
|
2
|
+
import { botMention, noSelfMention, type FailedCheck } from './pull-request-logs.js';
|
|
3
3
|
import type { WakeCarry, WakeOrigin } from './timers.js';
|
|
4
|
+
import type { ReviewLoopEnd } from './github-app/review-post.js';
|
|
5
|
+
/**
|
|
6
|
+
* The Andorra review loop on a task's PR (design/specs/andorra-review-loop.md, "Loop state"). It lives on the PR record and
|
|
7
|
+
* changes under `withPullRequest`, so it survives restarts and every engine process on the home sees one state.
|
|
8
|
+
*/
|
|
9
|
+
export type ReviewLoopPhase = 'waiting' | 'reviewing' | 'posting' | 'fixing' | 'ended';
|
|
10
|
+
export declare const REVIEW_LOOP_ENDS: readonly ReviewLoopEnd[];
|
|
11
|
+
/** One P1 or P2 finding of a posted round. Its title, path and line stay on this machine, for the next round's rounds.json. */
|
|
12
|
+
export interface ReviewedFinding {
|
|
13
|
+
priority: 'P1' | 'P2';
|
|
14
|
+
where: 'inline' | 'summary';
|
|
15
|
+
threadId?: string;
|
|
16
|
+
title: string;
|
|
17
|
+
path: string;
|
|
18
|
+
line: number;
|
|
19
|
+
}
|
|
20
|
+
export interface ReviewedRound {
|
|
21
|
+
round: number;
|
|
22
|
+
head: string;
|
|
23
|
+
reviewId: string;
|
|
24
|
+
url: string;
|
|
25
|
+
findings: ReviewedFinding[];
|
|
26
|
+
nits: number;
|
|
27
|
+
reviewerRun?: string;
|
|
28
|
+
at: string;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* One line of the loop's history in the task's transcript (design/specs/andorra-review-loop.md, L3): a loop switched on, a
|
|
32
|
+
* round posted, a loop ended. It is kept across loops, newest last, at most `REVIEW_LOG_MAX` lines. `afterTurns` is how
|
|
33
|
+
* many turns the task's history held then, a turn still running included, so the desktop shows the line after that turn.
|
|
34
|
+
*/
|
|
35
|
+
export interface ReviewLogEntry {
|
|
36
|
+
at: string;
|
|
37
|
+
loop: string;
|
|
38
|
+
kind: 'started' | 'posted' | 'ended';
|
|
39
|
+
round: number;
|
|
40
|
+
rounds: number;
|
|
41
|
+
afterTurns?: number;
|
|
42
|
+
/** A posted round: the head it reviewed, the review's URL, its P1 and P2 findings, its nits and the reviewer's run. */
|
|
43
|
+
head?: string;
|
|
44
|
+
url?: string;
|
|
45
|
+
findings?: number;
|
|
46
|
+
nits?: number;
|
|
47
|
+
reviewerRun?: string;
|
|
48
|
+
/** An end: why, and the sentence that says so. */
|
|
49
|
+
reason?: ReviewLoopEnd;
|
|
50
|
+
detail?: string;
|
|
51
|
+
}
|
|
52
|
+
export declare const REVIEW_LOG_MAX = 60;
|
|
53
|
+
export interface ReviewLoopState {
|
|
54
|
+
/** False again once a loop ends. */
|
|
55
|
+
on: boolean;
|
|
56
|
+
rounds: number;
|
|
57
|
+
model?: {
|
|
58
|
+
provider: string;
|
|
59
|
+
model: string;
|
|
60
|
+
};
|
|
61
|
+
instruction?: string;
|
|
62
|
+
driver?: {
|
|
63
|
+
kind: 'chat';
|
|
64
|
+
} | {
|
|
65
|
+
kind: 'graph';
|
|
66
|
+
runId: string;
|
|
67
|
+
nodeId?: string;
|
|
68
|
+
};
|
|
69
|
+
/** The current loop's ULID; the service binds it to one Andorra account. */
|
|
70
|
+
loop?: string;
|
|
71
|
+
/** Reviews posted in this loop. */
|
|
72
|
+
round: number;
|
|
73
|
+
phase: ReviewLoopPhase;
|
|
74
|
+
startedAt?: string;
|
|
75
|
+
/** When the round in progress began: the marker check reads GitHub's reviews back to it. */
|
|
76
|
+
roundStartedAt?: string;
|
|
77
|
+
/** The head the round in progress reviews. */
|
|
78
|
+
head?: string;
|
|
79
|
+
/** This round's `stale_head` answers, whether its 422 was already retried, and its reviewer failures. */
|
|
80
|
+
staleHeads?: number;
|
|
81
|
+
retried422?: boolean;
|
|
82
|
+
reviewerFailures?: number;
|
|
83
|
+
/** Rounds that failed in a row (a gh read, the worktree, a marker check that threw); three end the loop `unavailable`. */
|
|
84
|
+
roundCrashes?: number;
|
|
85
|
+
/** When the PR was first seen without coverage (`pending`, `unavailable`); a round waits an hour from it. */
|
|
86
|
+
coverageLostAt?: string;
|
|
87
|
+
/** Whether the record's gh account can push to the PR's head repository, once asked (R10). */
|
|
88
|
+
pushable?: boolean;
|
|
89
|
+
/** The `review` request in flight, so an engine that stops mid-post resumes with the marker check. */
|
|
90
|
+
attempt?: {
|
|
91
|
+
requestId: string;
|
|
92
|
+
firstAt: string;
|
|
93
|
+
head: string;
|
|
94
|
+
};
|
|
95
|
+
/**
|
|
96
|
+
* The fixer's wake, beside Auto-fix's `pendingFix`. `runId` is the turn that took it once it was delivered; `held` says
|
|
97
|
+
* it went straight into a run waiting in await_review rather than starting a turn; `retried` that it was armed again
|
|
98
|
+
* once because the turn that took it was interrupted.
|
|
99
|
+
*/
|
|
100
|
+
pendingReview?: {
|
|
101
|
+
wakeId: string;
|
|
102
|
+
round: number;
|
|
103
|
+
prompt: string;
|
|
104
|
+
runId?: string;
|
|
105
|
+
deliveredAt?: string;
|
|
106
|
+
held?: boolean;
|
|
107
|
+
retried?: boolean;
|
|
108
|
+
};
|
|
109
|
+
/** A run of this session waiting in await_review now: it counts as held for the round conditions. */
|
|
110
|
+
waiting?: {
|
|
111
|
+
runId: string;
|
|
112
|
+
since: string;
|
|
113
|
+
};
|
|
114
|
+
reviewed: ReviewedRound[];
|
|
115
|
+
ended?: {
|
|
116
|
+
reason: ReviewLoopEnd;
|
|
117
|
+
at: string;
|
|
118
|
+
detail?: string;
|
|
119
|
+
};
|
|
120
|
+
/** The transcript's lines for this PR's loops, this one and the ones before it. */
|
|
121
|
+
log?: ReviewLogEntry[];
|
|
122
|
+
}
|
|
123
|
+
/** The loop state with one more transcript line, the oldest dropped past `REVIEW_LOG_MAX`. */
|
|
124
|
+
export declare function withReviewLog(review: ReviewLoopState, entry: ReviewLogEntry): ReviewLoopState;
|
|
4
125
|
export interface SessionPullRequest {
|
|
5
126
|
url: string;
|
|
6
127
|
owner: string;
|
|
@@ -24,12 +145,16 @@ export interface SessionPullRequest {
|
|
|
24
145
|
};
|
|
25
146
|
/** The head commit whose failed checks Auto-fix last handed to the agent; it is not woken for them again. */
|
|
26
147
|
checksHandled?: string;
|
|
148
|
+
/** The head commit a review wait last asked Codex to review with an "@codex review" comment; it is not asked for that head again. */
|
|
149
|
+
reviewBumped?: string;
|
|
27
150
|
carry?: WakeCarry;
|
|
28
151
|
origin?: WakeOrigin;
|
|
29
152
|
ghUser?: string;
|
|
30
153
|
watchError?: string;
|
|
31
154
|
/** The head commit's checks, rolled up, as the watcher last saw them; absent when there are none. */
|
|
32
155
|
checks?: PullRequestChecksRollup;
|
|
156
|
+
/** The Andorra review loop: its settings, and the loop in progress or how the last one ended. */
|
|
157
|
+
review?: ReviewLoopState;
|
|
33
158
|
updatedAt: string;
|
|
34
159
|
}
|
|
35
160
|
export type PullRequestState = 'open' | 'draft' | 'merged' | 'closed';
|
|
@@ -48,6 +173,12 @@ export interface PullRequestRef {
|
|
|
48
173
|
}
|
|
49
174
|
export declare function parsePullRequestUrl(text: string): PullRequestRef | undefined;
|
|
50
175
|
export declare const pullRequestsDirectory: (home: string) => string;
|
|
176
|
+
/** The loop state as this engine writes it; anything else is read as no loop. */
|
|
177
|
+
export declare function validReviewLoop(value: unknown): value is ReviewLoopState;
|
|
178
|
+
/** A loop is running: switched on, not ended, with an id. */
|
|
179
|
+
export declare const reviewLoopActive: (pullRequest: Pick<SessionPullRequest, "review"> | undefined) => boolean;
|
|
180
|
+
/** A running loop that chat drives; a graph run's loop (L4) is never started or woken by the chat controller. */
|
|
181
|
+
export declare const chatReviewLoopActive: (pullRequest: Pick<SessionPullRequest, "review"> | undefined) => boolean;
|
|
51
182
|
/** The record with the checks rollup `seen` reports, or without one when there are no checks. */
|
|
52
183
|
export declare function withChecks(pullRequest: SessionPullRequest, checks: PullRequestChecksRollup | undefined): SessionPullRequest;
|
|
53
184
|
export declare function readPullRequest(home: string, sessionId: string): Promise<SessionPullRequest | undefined>;
|
|
@@ -72,6 +203,15 @@ export type GhExec = (args: readonly string[], env: NodeJS.ProcessEnv, options?:
|
|
|
72
203
|
maxBuffer?: number;
|
|
73
204
|
input?: string;
|
|
74
205
|
}) => Promise<string>;
|
|
206
|
+
/**
|
|
207
|
+
* Runs gh (`command`, `gh` on PATH by default) and stops it after `timeoutMs` (30 s by default). A failure carries
|
|
208
|
+
* gh's stdout (GitHub's answer, for a refused or partly failed call) and, when the timeout or a signal stopped it,
|
|
209
|
+
* `killed: true`. Exported so tests can run the real process path against a fake gh.
|
|
210
|
+
*/
|
|
211
|
+
export declare function ghExec(settings?: {
|
|
212
|
+
command?: string;
|
|
213
|
+
timeoutMs?: number;
|
|
214
|
+
}): GhExec;
|
|
75
215
|
export declare function createGhRunner(exec?: GhExec): GhRunner;
|
|
76
216
|
export declare const runGh: GhRunner;
|
|
77
217
|
export interface PullRequestView {
|
|
@@ -105,6 +245,24 @@ export declare function applyPullRequestSettingsAsReadableAccount(gh: GhRunner,
|
|
|
105
245
|
export type ReviewWait = {
|
|
106
246
|
kind: 'comments';
|
|
107
247
|
prompt: string;
|
|
248
|
+
}
|
|
249
|
+
/** Codex signed off on the head commit: its thumbs-up on the PR, or a review of that commit with no findings. */
|
|
250
|
+
| {
|
|
251
|
+
kind: 'approved';
|
|
252
|
+
pullRequest: SessionPullRequest;
|
|
253
|
+
headSha?: string;
|
|
254
|
+
}
|
|
255
|
+
/** The Andorra review loop posted its next round: the fixer's wake text. */
|
|
256
|
+
| {
|
|
257
|
+
kind: 'review';
|
|
258
|
+
prompt: string;
|
|
259
|
+
}
|
|
260
|
+
/** The Andorra review loop the wait watched ended (a clean round ends it too). */
|
|
261
|
+
| {
|
|
262
|
+
kind: 'review-ended';
|
|
263
|
+
pullRequest: SessionPullRequest;
|
|
264
|
+
reason: ReviewLoopEnd;
|
|
265
|
+
detail?: string;
|
|
108
266
|
} | {
|
|
109
267
|
kind: 'finished';
|
|
110
268
|
pullRequest: SessionPullRequest;
|
|
@@ -122,12 +280,48 @@ export type ReviewWait = {
|
|
|
122
280
|
};
|
|
123
281
|
export interface PullRequestControl {
|
|
124
282
|
status(): Promise<SessionPullRequest | undefined>;
|
|
125
|
-
attach(url: string, settings: PullRequestSettings, origin?: WakeOrigin): Promise<SessionPullRequest>;
|
|
126
|
-
update(settings: PullRequestSettings, origin?: WakeOrigin): Promise<SessionPullRequest>;
|
|
127
|
-
|
|
283
|
+
attach(url: string, settings: PullRequestSettings & ReviewLoopSettings, origin?: WakeOrigin): Promise<SessionPullRequest>;
|
|
284
|
+
update(settings: PullRequestSettings & ReviewLoopSettings, origin?: WakeOrigin): Promise<SessionPullRequest>;
|
|
285
|
+
/**
|
|
286
|
+
* `approveBump` is asked before the wait posts "@codex review" for a head Codex has not picked up; without it,
|
|
287
|
+
* or when it rejects, the wait posts nothing.
|
|
288
|
+
*/
|
|
289
|
+
awaitReview?(signal: AbortSignal, timeoutMs: number, origin?: WakeOrigin, options?: {
|
|
290
|
+
approveBump?(detail: string): Promise<void>;
|
|
291
|
+
}): Promise<ReviewWait>;
|
|
128
292
|
dismiss(): Promise<void>;
|
|
293
|
+
/**
|
|
294
|
+
* A reply, resolve or PR comment on the tracked PR: as the GitHub App's bot where the PR is covered and agent
|
|
295
|
+
* writes are `bot`, otherwise through gh as the record's account. `approve` is asked once the route is
|
|
296
|
+
* known and the write passes that route's checks, before anything is sent. Answers the tool result, which
|
|
297
|
+
* says who posted and why.
|
|
298
|
+
*/
|
|
299
|
+
write?(write: import('./github-app/agent-writes.js').AgentPullRequestWrite, options: {
|
|
300
|
+
approve(detail: string): Promise<void>;
|
|
301
|
+
signal?: AbortSignal;
|
|
302
|
+
}): Promise<string>;
|
|
129
303
|
}
|
|
130
304
|
export declare function pullRequestSettings(source: Record<string, unknown>): PullRequestSettings;
|
|
305
|
+
/**
|
|
306
|
+
* The Andorra review loop's settings, kept apart from the gh-backed ones above: nothing here changes the PR on GitHub.
|
|
307
|
+
* `reviewInstruction` and `reviewModel` take an empty string to clear them.
|
|
308
|
+
*/
|
|
309
|
+
export interface ReviewLoopSettings {
|
|
310
|
+
review?: boolean;
|
|
311
|
+
reviewRounds?: number;
|
|
312
|
+
reviewInstruction?: string;
|
|
313
|
+
reviewModel?: string;
|
|
314
|
+
}
|
|
315
|
+
export declare const REVIEW_ROUNDS_DEFAULT = 3;
|
|
316
|
+
export declare const REVIEW_ROUNDS_MAX = 10;
|
|
317
|
+
export declare const REVIEW_INSTRUCTION_BYTES = 2048;
|
|
318
|
+
export declare const REVIEW_SETTING_KEYS: readonly ["review", "reviewRounds", "reviewInstruction", "reviewModel"];
|
|
319
|
+
/** `provider/model`, split at the first slash (a model id may hold slashes of its own). */
|
|
320
|
+
export declare function parseReviewModel(value: string): {
|
|
321
|
+
provider: string;
|
|
322
|
+
model: string;
|
|
323
|
+
} | undefined;
|
|
324
|
+
export declare function reviewLoopSettings(source: Record<string, unknown>): ReviewLoopSettings;
|
|
131
325
|
export declare class PullRequestCreateDetector {
|
|
132
326
|
private readonly pending;
|
|
133
327
|
observe(event: {
|
|
@@ -136,12 +330,65 @@ export declare class PullRequestCreateDetector {
|
|
|
136
330
|
}): PullRequestRef | undefined;
|
|
137
331
|
}
|
|
138
332
|
export declare const CODE_REVIEWER_LOGINS: readonly string[];
|
|
139
|
-
|
|
333
|
+
/**
|
|
334
|
+
* One more reviewer login for the GitHub App's real run, read only in test mode (`ANDORRA_TEST_MODE=1`), so
|
|
335
|
+
* review comments posted by a person's own account can stand in for a review bot's. Never read otherwise.
|
|
336
|
+
*/
|
|
337
|
+
export declare function testCodeReviewer(env?: NodeJS.ProcessEnv): string | undefined;
|
|
338
|
+
/**
|
|
339
|
+
* The Andorra Code GitHub App's own bots (production and the staging dev App), as REST and webhooks name them
|
|
340
|
+
* without `[bot]` and as GraphQL names them. What the agent posts as the bot is never a review to wake Auto-fix
|
|
341
|
+
* for, not even when the test-mode reviewer names one of them.
|
|
342
|
+
*/
|
|
343
|
+
export declare const ANDORRA_BOT_LOGINS: readonly string[];
|
|
344
|
+
export declare function isCodeReviewer(login: string | undefined, env?: NodeJS.ProcessEnv): boolean;
|
|
140
345
|
export declare function newReviewComments(gh: GhRunner, pullRequest: SessionPullRequest): Promise<{
|
|
141
346
|
threads: number;
|
|
142
347
|
comments: number;
|
|
143
348
|
newest?: string;
|
|
144
349
|
}>;
|
|
350
|
+
/** Codex's login, as GraphQL names it on comments and reviews; on a reaction it carries `[bot]`. */
|
|
351
|
+
export declare const CODEX_REVIEWER_LOGIN = "chatgpt-codex-connector";
|
|
352
|
+
/** The PR comment that asks Codex for a review of the current head. */
|
|
353
|
+
export declare const REVIEW_BUMP_COMMENT = "@codex review";
|
|
354
|
+
/** How long a review wait sees no sign of Codex on a head before it asks for a review. */
|
|
355
|
+
export declare const REVIEW_BUMP_DELAY_MS = 30000;
|
|
356
|
+
/** How often a review wait reads Codex's reactions: GitHub sends no notice for a reaction. */
|
|
357
|
+
export declare const REVIEW_SIGNAL_INTERVAL_MS = 60000;
|
|
358
|
+
/** What Codex shows on a PR's head commit, as a review wait reads it. */
|
|
359
|
+
export interface ReviewSignals {
|
|
360
|
+
headSha?: string;
|
|
361
|
+
/** Open and not a draft: Codex reviews nothing else. */
|
|
362
|
+
open: boolean;
|
|
363
|
+
/** Codex signed off on this head: a thumbs-up on the PR newer than the head commit, or a review of it with no findings. */
|
|
364
|
+
approved: boolean;
|
|
365
|
+
/** Codex's eyes are on the PR, or its summary says it is reviewing this head. */
|
|
366
|
+
reviewing: boolean;
|
|
367
|
+
/** Codex posted a review for this head: a review of that commit, a review comment newer than it, or a verdict. Its other comments (a setup notice, an answer to a mention) are not one. */
|
|
368
|
+
reviewed: boolean;
|
|
369
|
+
/** Someone already asked with an "@codex review" comment since the head commit. */
|
|
370
|
+
asked: boolean;
|
|
371
|
+
/** Codex has reacted, reviewed or commented on this PR at some point. */
|
|
372
|
+
codexSeen: boolean;
|
|
373
|
+
}
|
|
374
|
+
/**
|
|
375
|
+
* Reads Codex's reactions on the PR's main post, its reviews and its comments, and says what they mean for the
|
|
376
|
+
* head commit. A reaction names no commit, so a thumbs-up counts only when it is newer than the head commit
|
|
377
|
+
* and Codex's summary, where there is one, names that commit too: the thumbs-up of an earlier head stays on
|
|
378
|
+
* the PR until Codex picks the new head up.
|
|
379
|
+
*/
|
|
380
|
+
export declare function readReviewSignals(gh: GhRunner, pullRequest: SessionPullRequest, env?: NodeJS.ProcessEnv): Promise<ReviewSignals>;
|
|
381
|
+
/** Whether Codex has shown up on any of the repository's 20 newest pull requests: where it never has, nobody asks it for a review. */
|
|
382
|
+
export declare function codexReviewsRepository(gh: GhRunner, pullRequest: SessionPullRequest, env?: NodeJS.ProcessEnv): Promise<boolean>;
|
|
383
|
+
/**
|
|
384
|
+
* Who the agent's replies and resolves post as, for the Auto-fix prompt: `botWrites` when the PR is covered by
|
|
385
|
+
* the GitHub App and agent writes are set to the bot; `bot` is the bot's login from `GET /v1/github`.
|
|
386
|
+
*/
|
|
387
|
+
export interface AutoFixWrites {
|
|
388
|
+
botWrites: boolean;
|
|
389
|
+
bot?: string;
|
|
390
|
+
}
|
|
391
|
+
export { botMention, noSelfMention };
|
|
145
392
|
export declare function autoFixPrompt(pullRequest: SessionPullRequest, found: {
|
|
146
393
|
threads: number;
|
|
147
394
|
comments: number;
|
|
@@ -149,7 +396,7 @@ export declare function autoFixPrompt(pullRequest: SessionPullRequest, found: {
|
|
|
149
396
|
checks: readonly FailedCheck[];
|
|
150
397
|
headSha: string;
|
|
151
398
|
branch?: string;
|
|
152
|
-
}): string;
|
|
399
|
+
}, writes?: AutoFixWrites): string;
|
|
153
400
|
/**
|
|
154
401
|
* The head commit's failed checks that Auto-fix hands to the agent: the failed **required** checks, or,
|
|
155
402
|
* where the base branch requires none, every failed check (otherwise Auto-fix would never act on a
|
|
@@ -163,6 +410,8 @@ export declare function failedChecksToFix(gh: GhRunner, pullRequest: SessionPull
|
|
|
163
410
|
export declare class WatcherLease {
|
|
164
411
|
private readonly home;
|
|
165
412
|
private release?;
|
|
413
|
+
/** The acquisition in flight: concurrent claims in one process share it instead of racing their own lock. */
|
|
414
|
+
private claiming?;
|
|
166
415
|
constructor(home: string);
|
|
167
416
|
claim(): Promise<boolean>;
|
|
168
417
|
drop(): Promise<void>;
|
|
@@ -176,19 +425,90 @@ export interface PullRequestWatcherOptions {
|
|
|
176
425
|
wakePending: (id: string) => boolean;
|
|
177
426
|
log?: (level: 'info' | 'warn', detail: string) => void;
|
|
178
427
|
claim?: () => Promise<boolean>;
|
|
428
|
+
/**
|
|
429
|
+
* Whether GitHub App notices reach this session's PR. A covered PR is read when a notice asks
|
|
430
|
+
* (`checkNow`) and, as a safety net, once every 10 minutes; every other PR on every pass, as before.
|
|
431
|
+
*/
|
|
432
|
+
covered?: (sessionId: string) => boolean;
|
|
433
|
+
/** Each gh call a check makes for a session, for the GitHub App's measures. */
|
|
434
|
+
onGhCall?: (sessionId: string) => void;
|
|
435
|
+
now?: () => number;
|
|
436
|
+
/** How long `checkNow` waits, so a burst of notices for one PR costs one read. */
|
|
437
|
+
checkNowDelayMs?: number;
|
|
438
|
+
/** Who the agent's replies post as on this session's PR, for the Auto-fix prompt; without it, the gh form. */
|
|
439
|
+
agentWrites?: (sessionId: string) => Promise<AutoFixWrites>;
|
|
440
|
+
/** Each read that refreshed a session's record, for the Andorra review loop's round conditions. Must not throw. */
|
|
441
|
+
onRead?: (sessionId: string, pullRequest: SessionPullRequest) => void;
|
|
179
442
|
}
|
|
443
|
+
/** How often a PR that GitHub App notices reach is still read: the safety net. */
|
|
444
|
+
export declare const COVERED_CHECK_MS: number;
|
|
445
|
+
export declare const CHECK_NOW_DELAY_MS = 2000;
|
|
180
446
|
export declare function pullRequestNeedsWatch(pullRequest: SessionPullRequest): boolean;
|
|
181
447
|
export declare class PullRequestWatcher {
|
|
182
448
|
private readonly options;
|
|
183
449
|
private timer?;
|
|
184
450
|
private running?;
|
|
451
|
+
private forceAfter;
|
|
452
|
+
private runningGated;
|
|
185
453
|
private stopped;
|
|
454
|
+
private leaseHeld;
|
|
186
455
|
private readonly lease;
|
|
456
|
+
private readonly now;
|
|
457
|
+
/** When each session's PR was last read, for the covered PRs' 10-minute gate. */
|
|
458
|
+
private readonly lastChecked;
|
|
459
|
+
/** The head commit each session's PR had when it was last read, sent with the GitHub App subscriptions. */
|
|
460
|
+
private readonly heads;
|
|
461
|
+
private readonly soon;
|
|
462
|
+
private readonly inFlight;
|
|
463
|
+
/** `readNow` reads still claiming the lease, before their read is in `inFlight`. */
|
|
464
|
+
private readonly reading;
|
|
187
465
|
constructor(options: PullRequestWatcherOptions);
|
|
188
466
|
start(): void;
|
|
189
467
|
stop(): Promise<void>;
|
|
190
|
-
|
|
468
|
+
/** Claims the `.watcher` lease: only the process that holds it reads PRs, wakes Auto-fix and pulls GitHub App notices. */
|
|
469
|
+
claim(): Promise<boolean>;
|
|
470
|
+
holdsLease(): boolean;
|
|
471
|
+
headSha(sessionId: string): string | undefined;
|
|
472
|
+
/**
|
|
473
|
+
* Reads every watched PR now, covered or not: the full pass after a notice gap or a breaker's recovery.
|
|
474
|
+
* A caller that wants one PR read (an attach, a settings change, a review wait) uses `readNow`.
|
|
475
|
+
* With `force`, a pass already running is followed by one more, since it may have started before the gap.
|
|
476
|
+
*/
|
|
477
|
+
poll(options?: {
|
|
478
|
+
force?: boolean;
|
|
479
|
+
}): Promise<void>;
|
|
480
|
+
/**
|
|
481
|
+
* The interval timer's pass: a covered PR read within the last 10 minutes is skipped, because GitHub App
|
|
482
|
+
* notices read it when it changes. Every other PR is read, as before the App.
|
|
483
|
+
*/
|
|
484
|
+
scheduledPass(): Promise<void>;
|
|
485
|
+
/**
|
|
486
|
+
* Reads one session's PR now, without `checkNow`'s debounce and whether or not it is covered: for a caller
|
|
487
|
+
* that changed or attached that PR, or waits on it. The other watched PRs are left to their own schedule.
|
|
488
|
+
*/
|
|
489
|
+
readNow(sessionId: string): Promise<void>;
|
|
490
|
+
private run;
|
|
491
|
+
/**
|
|
492
|
+
* Reads one session's PR soon: after `checkNowDelayMs` (2 s), so a burst of notices for one PR costs one
|
|
493
|
+
* read. It reads whether or not the PR is covered: the 10-minute gate holds only for the interval's passes.
|
|
494
|
+
* `force` is accepted for the same read. Only the lease holder reads. The timer does not keep the process
|
|
495
|
+
* alive.
|
|
496
|
+
*/
|
|
497
|
+
checkNow(sessionId: string, _options?: {
|
|
498
|
+
force?: boolean;
|
|
499
|
+
}): Promise<void>;
|
|
500
|
+
/** Whether a read `checkNow` scheduled for a session keeps the process alive (it should not). */
|
|
501
|
+
checkNowKeepsAlive(sessionId: string): boolean | undefined;
|
|
502
|
+
/** Every pass and every read `checkNow` or `readNow` started, finished (for tests). */
|
|
503
|
+
settled(): Promise<void>;
|
|
504
|
+
private checkSoon;
|
|
505
|
+
/** A covered PR read within the last 10 minutes is left to its notices; every other PR is read on every pass. */
|
|
506
|
+
private due;
|
|
507
|
+
/** One read of a session's PR at a time: a notice's read waits for a pass's read of the same PR. */
|
|
508
|
+
private checkOnce;
|
|
191
509
|
private pass;
|
|
510
|
+
/** The gh one session's check runs: counted for that session when the GitHub App's measures are on. */
|
|
511
|
+
private countedGh;
|
|
192
512
|
private read;
|
|
193
513
|
private check;
|
|
194
514
|
}
|