@oss-autopilot/core 3.42.5 → 3.44.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/dist/cli-pre-action.js +8 -3
- package/dist/cli-registry.js +428 -27
- package/dist/cli.bundle.cjs +212 -156
- package/dist/commands/check-integration.js +5 -1
- package/dist/commands/cleanup.d.ts +80 -0
- package/dist/commands/cleanup.js +334 -0
- package/dist/commands/comments.d.ts +14 -1
- package/dist/commands/comments.js +17 -5
- package/dist/commands/config.d.ts +2 -0
- package/dist/commands/config.js +63 -6
- package/dist/commands/daily-dismiss-filter.d.ts +7 -0
- package/dist/commands/daily-dismiss-filter.js +17 -1
- package/dist/commands/daily-ledger.d.ts +150 -0
- package/dist/commands/daily-ledger.js +248 -0
- package/dist/commands/daily-recent-prs.d.ts +26 -0
- package/dist/commands/daily-recent-prs.js +55 -0
- package/dist/commands/daily-render.d.ts +2 -1
- package/dist/commands/daily-render.js +4 -1
- package/dist/commands/daily.d.ts +5 -1
- package/dist/commands/daily.js +83 -93
- package/dist/commands/dashboard-cache.d.ts +2 -0
- package/dist/commands/dashboard-cache.js +33 -8
- package/dist/commands/dashboard-data.js +113 -69
- package/dist/commands/dashboard-gist-sync.js +3 -1
- package/dist/commands/dashboard-lifecycle.d.ts +36 -8
- package/dist/commands/dashboard-lifecycle.js +132 -39
- package/dist/commands/dashboard-process.d.ts +49 -1
- package/dist/commands/dashboard-process.js +111 -12
- package/dist/commands/dashboard-server.js +89 -23
- package/dist/commands/detect-formatters.js +1 -0
- package/dist/commands/dismiss.js +11 -7
- package/dist/commands/doctor.d.ts +15 -1
- package/dist/commands/doctor.js +66 -5
- package/dist/commands/draft.d.ts +77 -0
- package/dist/commands/draft.js +218 -0
- package/dist/commands/eval.js +1 -0
- package/dist/commands/fork-prune.d.ts +58 -0
- package/dist/commands/fork-prune.js +247 -0
- package/dist/commands/guidelines.d.ts +69 -2
- package/dist/commands/guidelines.js +158 -14
- package/dist/commands/index.d.ts +29 -4
- package/dist/commands/index.js +20 -3
- package/dist/commands/issue-thread.d.ts +46 -0
- package/dist/commands/issue-thread.js +123 -0
- package/dist/commands/ledger-backfill.d.ts +9 -0
- package/dist/commands/ledger-backfill.js +44 -1
- package/dist/commands/list-mark-done.d.ts +2 -1
- package/dist/commands/list-mark-done.js +3 -1
- package/dist/commands/list-move-tier.d.ts +2 -1
- package/dist/commands/list-move-tier.js +3 -1
- package/dist/commands/local-repos.js +10 -5
- package/dist/commands/locate-issue-list.d.ts +40 -17
- package/dist/commands/locate-issue-list.js +148 -88
- package/dist/commands/move.js +7 -1
- package/dist/commands/overnight-handoff.d.ts +17 -7
- package/dist/commands/overnight-handoff.js +36 -14
- package/dist/commands/overnight-push-prep.d.ts +14 -8
- package/dist/commands/overnight-push-prep.js +107 -35
- package/dist/commands/overnight-tool-rules.d.ts +54 -0
- package/dist/commands/overnight-tool-rules.js +217 -0
- package/dist/commands/overnight.d.ts +5 -6
- package/dist/commands/overnight.js +61 -140
- package/dist/commands/parse-list.js +7 -1
- package/dist/commands/policy.d.ts +90 -0
- package/dist/commands/policy.js +276 -0
- package/dist/commands/pr-create.d.ts +48 -0
- package/dist/commands/pr-create.js +200 -0
- package/dist/commands/pr-preflight.d.ts +69 -0
- package/dist/commands/pr-preflight.js +348 -0
- package/dist/commands/repo-vet.d.ts +9 -0
- package/dist/commands/repo-vet.js +36 -11
- package/dist/commands/scout-bridge.js +18 -8
- package/dist/commands/search.js +7 -0
- package/dist/commands/setup.d.ts +3 -3
- package/dist/commands/setup.js +160 -48
- package/dist/commands/skip-add.js +10 -1
- package/dist/commands/startup.d.ts +12 -3
- package/dist/commands/startup.js +82 -49
- package/dist/commands/state-cmd.d.ts +2 -0
- package/dist/commands/state-cmd.js +5 -1
- package/dist/commands/stats.js +1 -0
- package/dist/commands/status.js +6 -0
- package/dist/commands/strategy.js +1 -0
- package/dist/commands/validation.d.ts +5 -0
- package/dist/commands/validation.js +5 -0
- package/dist/commands/vet-list.d.ts +6 -0
- package/dist/commands/vet-list.js +26 -1
- package/dist/commands/vet.d.ts +20 -0
- package/dist/commands/vet.js +133 -2
- package/dist/commands/work.d.ts +4 -0
- package/dist/commands/work.js +34 -11
- package/dist/core/__fixtures__/prompt-injection-payloads.js +31 -0
- package/dist/core/anti-llm-policy.d.ts +3 -0
- package/dist/core/anti-llm-policy.js +3 -0
- package/dist/core/auth.js +2 -0
- package/dist/core/ci-analysis.d.ts +7 -2
- package/dist/core/ci-analysis.js +76 -21
- package/dist/core/commit-date.d.ts +45 -0
- package/dist/core/commit-date.js +45 -0
- package/dist/core/compliance-score.d.ts +3 -0
- package/dist/core/compliance-score.js +13 -9
- package/dist/core/config-registry.d.ts +27 -2
- package/dist/core/config-registry.js +94 -7
- package/dist/core/contributing.d.ts +2 -3
- package/dist/core/contributing.js +2 -3
- package/dist/core/daily-logic.d.ts +30 -5
- package/dist/core/daily-logic.js +68 -19
- package/dist/core/errors.d.ts +37 -3
- package/dist/core/errors.js +54 -5
- package/dist/core/fork-prune.d.ts +149 -0
- package/dist/core/fork-prune.js +333 -0
- package/dist/core/gist-health.d.ts +15 -3
- package/dist/core/gist-health.js +8 -0
- package/dist/core/gist-state-store.d.ts +24 -4
- package/dist/core/gist-state-store.js +98 -51
- package/dist/core/github-stats.d.ts +110 -16
- package/dist/core/github-stats.js +295 -110
- package/dist/core/http-cache.d.ts +0 -10
- package/dist/core/http-cache.js +0 -19
- package/dist/core/index.d.ts +13 -6
- package/dist/core/index.js +16 -6
- package/dist/core/issue-conversation.d.ts +8 -2
- package/dist/core/issue-conversation.js +31 -12
- package/dist/core/local-config.d.ts +95 -0
- package/dist/core/local-config.js +270 -0
- package/dist/core/merged-pr-notes.d.ts +2 -2
- package/dist/core/pacing.d.ts +41 -0
- package/dist/core/pacing.js +115 -0
- package/dist/core/pagination.d.ts +55 -0
- package/dist/core/pagination.js +59 -0
- package/dist/core/paths.d.ts +7 -0
- package/dist/core/paths.js +9 -0
- package/dist/core/pr-assembly.d.ts +2 -0
- package/dist/core/pr-assembly.js +6 -2
- package/dist/core/pr-graphql.d.ts +53 -4
- package/dist/core/pr-graphql.js +87 -14
- package/dist/core/pr-monitor.d.ts +35 -12
- package/dist/core/pr-monitor.js +110 -26
- package/dist/core/pr-preflight.d.ts +154 -0
- package/dist/core/pr-preflight.js +753 -0
- package/dist/core/pr-quality-rubric.d.ts +0 -6
- package/dist/core/pr-quality-rubric.js +0 -8
- package/dist/core/pr-template.d.ts +2 -0
- package/dist/core/pr-template.js +5 -1
- package/dist/core/prose-script.d.ts +72 -0
- package/dist/core/prose-script.js +223 -0
- package/dist/core/repo-policy.d.ts +111 -0
- package/dist/core/repo-policy.js +428 -0
- package/dist/core/repo-score-manager.d.ts +66 -0
- package/dist/core/repo-score-manager.js +140 -1
- package/dist/core/review-analysis.d.ts +49 -21
- package/dist/core/review-analysis.js +89 -15
- package/dist/core/reviewed-prs-fetch.js +11 -29
- package/dist/core/reviewed-prs.js +8 -15
- package/dist/core/stale-data.d.ts +78 -0
- package/dist/core/stale-data.js +153 -0
- package/dist/core/state-persistence.d.ts +62 -27
- package/dist/core/state-persistence.js +338 -119
- package/dist/core/state-schema.d.ts +152 -210
- package/dist/core/state-schema.js +232 -80
- package/dist/core/state.d.ts +81 -8
- package/dist/core/state.js +239 -46
- package/dist/core/status-determination.js +32 -12
- package/dist/core/strategy.js +3 -1
- package/dist/core/types.d.ts +22 -1
- package/dist/core/types.js +1 -0
- package/dist/core/untrusted-content.d.ts +30 -11
- package/dist/core/untrusted-content.js +95 -42
- package/dist/core/urls.d.ts +33 -0
- package/dist/core/urls.js +94 -0
- package/dist/dashboard/assets/chart-panel-B-nLVgzQ.js +3 -0
- package/dist/dashboard/assets/index-5IvMGokL.js +55 -0
- package/dist/dashboard/index.html +1 -1
- package/dist/formatters/json.d.ts +432 -10
- package/dist/formatters/json.js +156 -1
- package/package.json +6 -6
- package/dist/core/ci-enforced-tools.d.ts +0 -35
- package/dist/core/ci-enforced-tools.js +0 -109
- package/dist/core/comment-decision.d.ts +0 -79
- package/dist/core/comment-decision.js +0 -82
- package/dist/core/extraction-categories.d.ts +0 -55
- package/dist/core/extraction-categories.js +0 -108
- package/dist/core/follow-up-history.d.ts +0 -40
- package/dist/core/follow-up-history.js +0 -71
- package/dist/core/issue-effort.d.ts +0 -29
- package/dist/core/issue-effort.js +0 -47
- package/dist/core/maintainer-hints.d.ts +0 -23
- package/dist/core/maintainer-hints.js +0 -36
- package/dist/core/workflow-state.d.ts +0 -56
- package/dist/core/workflow-state.js +0 -101
- package/dist/dashboard/assets/chart-panel-DPKNBUts.js +0 -3
- package/dist/dashboard/assets/index-B25bZOYX.js +0 -55
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
*/
|
|
12
12
|
import { z } from 'zod';
|
|
13
13
|
import { CLOSE_REASONS, SELF_CLOSE_REASONS } from './close-reason.js';
|
|
14
|
+
import { issueRefKey, parseGitHubUrl } from './urls.js';
|
|
14
15
|
/**
|
|
15
16
|
* An enum that also accepts values it does not know (#1831): a newer release
|
|
16
17
|
* may add a value, and a strict enum would make this release reject the whole
|
|
@@ -19,6 +20,10 @@ import { CLOSE_REASONS, SELF_CLOSE_REASONS } from './close-reason.js';
|
|
|
19
20
|
function openEnum(_values) {
|
|
20
21
|
return z.custom((v) => typeof v === 'string');
|
|
21
22
|
}
|
|
23
|
+
/** Narrows an {@link openEnum} value to the values this release knows (#2005). */
|
|
24
|
+
export function isKnownValue(values, value) {
|
|
25
|
+
return values.includes(value);
|
|
26
|
+
}
|
|
22
27
|
// ── 1. Enum / union schemas ───────────────────────────────────────────
|
|
23
28
|
export const IssueStatusSchema = z.enum(['candidate', 'claimed', 'in_progress', 'pr_submitted']);
|
|
24
29
|
export const FetchedPRStatusSchema = z.enum(['needs_addressing', 'waiting_on_maintainer']);
|
|
@@ -140,6 +145,14 @@ export const StoredMergedPRSchema = z
|
|
|
140
145
|
commentsFetchedAt: z.string().datetime().optional(),
|
|
141
146
|
/** When the host last ran LLM extraction over this PR's comment bundle (#867). */
|
|
142
147
|
learningsExtractedAt: z.string().datetime().optional(),
|
|
148
|
+
/**
|
|
149
|
+
* When a guideline proposal built from this PR was written for review
|
|
150
|
+
* (#2041). The proposal file is machine-local, so `learningsProposedOn`
|
|
151
|
+
* names the machine holding it; another machine does not re-extract.
|
|
152
|
+
*/
|
|
153
|
+
learningsProposedAt: z.iso.datetime().optional(),
|
|
154
|
+
/** Machine id (`~/.oss-autopilot/machine-id`) of the machine holding the proposal (#2041). */
|
|
155
|
+
learningsProposedOn: z.string().optional(),
|
|
143
156
|
...LedgerPredictionFields,
|
|
144
157
|
})
|
|
145
158
|
.passthrough();
|
|
@@ -161,6 +174,14 @@ export const StoredClosedPRSchema = z
|
|
|
161
174
|
commentsFetchedAt: z.string().datetime().optional(),
|
|
162
175
|
/** When the host last ran LLM extraction over this PR's comment bundle (#867). */
|
|
163
176
|
learningsExtractedAt: z.string().datetime().optional(),
|
|
177
|
+
/**
|
|
178
|
+
* When a guideline proposal built from this PR was written for review
|
|
179
|
+
* (#2041). The proposal file is machine-local, so `learningsProposedOn`
|
|
180
|
+
* names the machine holding it; another machine does not re-extract.
|
|
181
|
+
*/
|
|
182
|
+
learningsProposedAt: z.iso.datetime().optional(),
|
|
183
|
+
/** Machine id (`~/.oss-autopilot/machine-id`) of the machine holding the proposal (#2041). */
|
|
184
|
+
learningsProposedOn: z.string().optional(),
|
|
164
185
|
...LedgerPredictionFields,
|
|
165
186
|
/** Why it closed unmerged (#1824), set by ledger-backfill. */
|
|
166
187
|
closeReason: openEnum(CLOSE_REASONS).optional(),
|
|
@@ -168,50 +189,6 @@ export const StoredClosedPRSchema = z
|
|
|
168
189
|
selfCloseReason: openEnum(SELF_CLOSE_REASONS).optional(),
|
|
169
190
|
})
|
|
170
191
|
.passthrough();
|
|
171
|
-
export const AnalyzedIssueConversationSchema = z.object({
|
|
172
|
-
url: z.string(),
|
|
173
|
-
repo: z.string(),
|
|
174
|
-
analyzedAt: z.string(),
|
|
175
|
-
});
|
|
176
|
-
/**
|
|
177
|
-
* One entry in a PR's follow-up history (#1277). Tier matches the
|
|
178
|
-
* cadence labels in `skills/pr-etiquette/SKILL.md` (light_check_in
|
|
179
|
-
* for 7-13 days, direct_check_in for 14-29 days, final_check_in for
|
|
180
|
-
* 30+ days). The `draftPath` is optional so an entry recorded from a
|
|
181
|
-
* direct `gh pr comment` (no draft) still validates.
|
|
182
|
-
*/
|
|
183
|
-
export const FollowUpEntrySchema = z.object({
|
|
184
|
-
tier: z.enum(['light_check_in', 'direct_check_in', 'final_check_in']),
|
|
185
|
-
timestamp: z.string().datetime(),
|
|
186
|
-
draftPath: z.string().optional(),
|
|
187
|
-
});
|
|
188
|
-
/**
|
|
189
|
-
* Pause-point snapshot for resumable workflows (#1280). When the user
|
|
190
|
-
* picks "Done for now" inside `draft-first-workflow.md`,
|
|
191
|
-
* `work-through-issues.md`, or `pre-commit-review.md`, the workflow
|
|
192
|
-
* records its position here. The next `/oss` run consults this state
|
|
193
|
-
* and offers "Resume / Restart / Discard" instead of restarting from
|
|
194
|
-
* the beginning.
|
|
195
|
-
*
|
|
196
|
-
* `stepData` is intentionally typed as `Record<string, unknown>` so
|
|
197
|
-
* each workflow can persist whatever per-step context it needs to
|
|
198
|
-
* resume cleanly (compliance-gap skip list, last review pass count,
|
|
199
|
-
* etc.) without forcing a tagged-union schema in shared state.
|
|
200
|
-
*/
|
|
201
|
-
export const WorkflowStateSchema = z.object({
|
|
202
|
-
workflowName: z.enum(['draft-first', 'work-through-issues', 'pre-commit-review']),
|
|
203
|
-
currentStep: z.string(),
|
|
204
|
-
branchName: z.string().optional(),
|
|
205
|
-
issueContext: z
|
|
206
|
-
.object({
|
|
207
|
-
title: z.string(),
|
|
208
|
-
url: z.string(),
|
|
209
|
-
})
|
|
210
|
-
.optional(),
|
|
211
|
-
completedSteps: z.array(z.string()).default([]),
|
|
212
|
-
stepData: z.record(z.string(), z.unknown()).default({}),
|
|
213
|
-
lastUpdatedAt: z.string().datetime(),
|
|
214
|
-
});
|
|
215
192
|
// ── 3. Contribution schemas ──────────────────────────────────────────
|
|
216
193
|
export const ContributionGuidelinesSchema = z.object({
|
|
217
194
|
branchNamingConvention: z.string().optional(),
|
|
@@ -247,7 +224,7 @@ export const TrackedIssueSchema = z.object({
|
|
|
247
224
|
repo: z.string(),
|
|
248
225
|
number: z.number(),
|
|
249
226
|
title: z.string(),
|
|
250
|
-
status: IssueStatusSchema,
|
|
227
|
+
status: openEnum(IssueStatusSchema.options),
|
|
251
228
|
labels: z.array(z.string()),
|
|
252
229
|
createdAt: z.string(),
|
|
253
230
|
updatedAt: z.string(),
|
|
@@ -261,19 +238,21 @@ export const ShelvedPRRefSchema = z.object({
|
|
|
261
238
|
title: z.string(),
|
|
262
239
|
repo: z.string(),
|
|
263
240
|
daysSinceActivity: z.number(),
|
|
264
|
-
status: FetchedPRStatusSchema,
|
|
241
|
+
status: openEnum(FetchedPRStatusSchema.options),
|
|
265
242
|
});
|
|
266
243
|
export const StatusOverrideSchema = z.object({
|
|
267
|
-
status: FetchedPRStatusSchema,
|
|
244
|
+
status: openEnum(FetchedPRStatusSchema.options),
|
|
268
245
|
setAt: z.string(),
|
|
269
246
|
lastActivityAt: z.string(),
|
|
270
247
|
});
|
|
271
248
|
// ── 5. Config schema ─────────────────────────────────────────────────
|
|
249
|
+
/** What was true of a PR when it was shelved; see `config.shelvedPRInfo`. */
|
|
250
|
+
const ShelvedPRInfoSchema = z.object({ at: z.string(), reasons: z.array(z.string()).optional() });
|
|
272
251
|
export const AgentConfigSchema = z
|
|
273
252
|
.object({
|
|
274
253
|
setupComplete: z.boolean().default(false),
|
|
275
254
|
setupCompletedAt: z.string().optional(),
|
|
276
|
-
persistence:
|
|
255
|
+
persistence: openEnum(['local', 'gist']).default('local'),
|
|
277
256
|
maxActivePRs: z.number().default(10),
|
|
278
257
|
/**
|
|
279
258
|
* Per-repo open-PR caps (core/repo-cap.ts). Discovery leaves out a repo
|
|
@@ -291,6 +270,15 @@ export const AgentConfigSchema = z
|
|
|
291
270
|
* one-implementation-per-worktree rule still applies.
|
|
292
271
|
*/
|
|
293
272
|
maxConcurrentImplementations: z.number().int().min(0).default(2),
|
|
273
|
+
/**
|
|
274
|
+
* Optional pacing caps (#1911, core/pacing.ts): new PRs to repos the user
|
|
275
|
+
* does not own, and new forks, per rolling 24 hours. Unset (or 0) means
|
|
276
|
+
* no cap. Optional with no default, so a state without them parses
|
|
277
|
+
* unchanged; the config schema is passthrough, so an older client that
|
|
278
|
+
* does not know them keeps them on save.
|
|
279
|
+
*/
|
|
280
|
+
maxNewPrsPerDay: z.number().int().min(0).optional(),
|
|
281
|
+
maxNewForksPerDay: z.number().int().min(0).optional(),
|
|
294
282
|
dormantThresholdDays: z.number().default(30),
|
|
295
283
|
approachingDormantDays: z.number().default(25),
|
|
296
284
|
maxIssueAgeDays: z.number().default(90),
|
|
@@ -306,7 +294,7 @@ export const AgentConfigSchema = z
|
|
|
306
294
|
complexIssues: openEnum(['off', 'warm']).default('off'),
|
|
307
295
|
languages: z.array(z.string()).default(['typescript', 'javascript']),
|
|
308
296
|
labels: z.array(z.string()).default(['good first issue', 'help wanted']),
|
|
309
|
-
scope: z.array(IssueScopeSchema).optional(),
|
|
297
|
+
scope: z.array(openEnum(IssueScopeSchema.options)).optional(),
|
|
310
298
|
excludeRepos: z.array(z.string()).default([]),
|
|
311
299
|
excludeOrgs: z.array(z.string()).optional(),
|
|
312
300
|
/**
|
|
@@ -340,7 +328,27 @@ export const AgentConfigSchema = z
|
|
|
340
328
|
minStars: z.number().default(50),
|
|
341
329
|
includeDocIssues: z.boolean().default(true),
|
|
342
330
|
aiPolicyBlocklist: z.array(z.string()).default(['matplotlib/matplotlib']),
|
|
331
|
+
/**
|
|
332
|
+
* Forks (owner/repo, or the parent's owner/repo) `fork-prune` must never
|
|
333
|
+
* delete: forks the user develops in directly (#1912). Matched
|
|
334
|
+
* case-insensitively. A safeguard: MCP cannot set it and an unattended
|
|
335
|
+
* run cannot shrink it.
|
|
336
|
+
*/
|
|
337
|
+
keepForks: z.array(z.string()).default([]),
|
|
343
338
|
shelvedPRUrls: z.array(z.string()).default([]),
|
|
339
|
+
/**
|
|
340
|
+
* `issueRefKey` of a shelved PR -> what was true when it was shelved
|
|
341
|
+
* (#1922): `at` is the ISO shelve time, `reasons` every action reason the
|
|
342
|
+
* PR had then (`shelveReasonsOf`; empty when it needed nothing). The daily
|
|
343
|
+
* run auto-unshelves a shelved PR that needs addressing only for
|
|
344
|
+
* maintainer activity newer than `at` or a reason not in `reasons`, so
|
|
345
|
+
* shelving a PR that already needs addressing sticks. `reasons` is unset
|
|
346
|
+
* when the PR was not in the last digest at shelve time; the next daily
|
|
347
|
+
* run fills it in, and nothing changes it after that. Entries shelved
|
|
348
|
+
* before the key existed have no record and keep the old rule (unshelved
|
|
349
|
+
* as soon as they need addressing).
|
|
350
|
+
*/
|
|
351
|
+
shelvedPRInfo: z.record(z.string(), ShelvedPRInfoSchema).default({}),
|
|
344
352
|
dismissedIssues: z.record(z.string(), z.string()).default({}),
|
|
345
353
|
/**
|
|
346
354
|
* PR URL -> head SHA the PR had when its review follow-up was dismissed
|
|
@@ -354,9 +362,9 @@ export const AgentConfigSchema = z
|
|
|
354
362
|
statusOverrides: z.record(z.string(), StatusOverrideSchema).optional(),
|
|
355
363
|
issueListPath: z.string().optional(),
|
|
356
364
|
skippedIssuesPath: z.string().optional(),
|
|
357
|
-
projectCategories: z.array(ProjectCategorySchema).default([]),
|
|
365
|
+
projectCategories: z.array(openEnum(ProjectCategorySchema.options)).default([]),
|
|
358
366
|
preferredOrgs: z.array(z.string()).default([]),
|
|
359
|
-
diffTool: DiffToolSchema.default('inline'),
|
|
367
|
+
diffTool: openEnum(DiffToolSchema.options).default('inline'),
|
|
360
368
|
diffToolCustomCommand: z.string().optional(),
|
|
361
369
|
/**
|
|
362
370
|
* Extract per-repo learnings from freshly merged PRs automatically at
|
|
@@ -365,18 +373,18 @@ export const AgentConfigSchema = z
|
|
|
365
373
|
*/
|
|
366
374
|
autoExtractLearnings: z.boolean().default(true),
|
|
367
375
|
/**
|
|
368
|
-
*
|
|
369
|
-
* compatibility.
|
|
376
|
+
* @deprecated Not read since the hook was removed in #1642; kept for
|
|
377
|
+
* state-file compatibility. Will be removed in the next major version.
|
|
370
378
|
*/
|
|
371
379
|
autoFormatBeforePush: z.boolean().default(false),
|
|
372
380
|
/**
|
|
373
|
-
*
|
|
374
|
-
* compatibility.
|
|
381
|
+
* @deprecated Not read since the hook was removed in #1642; kept for
|
|
382
|
+
* state-file compatibility. Will be removed in the next major version.
|
|
375
383
|
*/
|
|
376
384
|
trustOwnRepoWrites: z.boolean().default(false),
|
|
377
385
|
/**
|
|
378
|
-
*
|
|
379
|
-
* compatibility.
|
|
386
|
+
* @deprecated Not read since the hook was removed in #1642; kept for
|
|
387
|
+
* state-file compatibility. Will be removed in the next major version.
|
|
380
388
|
*/
|
|
381
389
|
healthCheckFreshnessMinutes: z.number().int().positive().default(30),
|
|
382
390
|
/**
|
|
@@ -406,7 +414,73 @@ export const AgentConfigSchema = z
|
|
|
406
414
|
// Passthrough (#1831): a newer release's config fields survive this
|
|
407
415
|
// version's load/save. Retired fields must be dropped explicitly instead.
|
|
408
416
|
.passthrough()
|
|
409
|
-
.transform(({ snoozedPRs: _retired, ...config }) => config);
|
|
417
|
+
.transform(({ snoozedPRs: _retired, ...config }) => foldRefKeys(config));
|
|
418
|
+
/** ISO stamp to ms for ranking; an unparseable stamp ranks last. */
|
|
419
|
+
function stampRank(at) {
|
|
420
|
+
const ms = Date.parse(at);
|
|
421
|
+
return Number.isNaN(ms) ? -Infinity : ms;
|
|
422
|
+
}
|
|
423
|
+
/**
|
|
424
|
+
* Group the keys of a URL-keyed map that name the same issue or PR (#2001):
|
|
425
|
+
* owner/repo casing, `/issues/N` vs `/pull/N`. Each group keeps the value
|
|
426
|
+
* `rank` scores highest (the first on a tie) under the key an older client
|
|
427
|
+
* sharing the Gist most likely looks up by exact match: the `/pull/` form,
|
|
428
|
+
* which GitHub reports for a PR, else the first key.
|
|
429
|
+
*/
|
|
430
|
+
function groupByRef(map, rank) {
|
|
431
|
+
const groups = new Map();
|
|
432
|
+
for (const [key, value] of Object.entries(map)) {
|
|
433
|
+
const ref = issueRefKey(key) ?? key;
|
|
434
|
+
const group = groups.get(ref);
|
|
435
|
+
if (!group) {
|
|
436
|
+
groups.set(ref, { key, value, source: key });
|
|
437
|
+
continue;
|
|
438
|
+
}
|
|
439
|
+
if (parseGitHubUrl(group.key)?.type !== 'pull' && parseGitHubUrl(key)?.type === 'pull')
|
|
440
|
+
group.key = key;
|
|
441
|
+
if (rank(value) > rank(group.value)) {
|
|
442
|
+
group.source = key;
|
|
443
|
+
group.value = value;
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
return groups;
|
|
447
|
+
}
|
|
448
|
+
/** The map `groups` folds `map` into; `map` itself when nothing folded. */
|
|
449
|
+
function foldedMap(map, groups) {
|
|
450
|
+
if (groups.size === Object.keys(map).length)
|
|
451
|
+
return map;
|
|
452
|
+
return Object.fromEntries(Array.from(groups.values(), (group) => [group.key, group.value]));
|
|
453
|
+
}
|
|
454
|
+
/**
|
|
455
|
+
* Fold duplicate keys of `dismissedIssues`, `dismissedPRHeads` and
|
|
456
|
+
* `statusOverrides` on load (#2001), newest stamp kept. A dismissed PR keeps
|
|
457
|
+
* only the head recorded under the key its winning dismiss stamp came from:
|
|
458
|
+
* a newest dismiss without a head means the head was cleared.
|
|
459
|
+
*/
|
|
460
|
+
function foldRefKeys(config) {
|
|
461
|
+
const dismissGroups = groupByRef(config.dismissedIssues, stampRank);
|
|
462
|
+
const dismissedPRHeads = {};
|
|
463
|
+
const headGroups = groupByRef(config.dismissedPRHeads, () => 0);
|
|
464
|
+
for (const [ref, group] of headGroups) {
|
|
465
|
+
const dismiss = dismissGroups.get(ref);
|
|
466
|
+
if (!dismiss) {
|
|
467
|
+
dismissedPRHeads[group.key] = group.value;
|
|
468
|
+
continue;
|
|
469
|
+
}
|
|
470
|
+
if (Object.hasOwn(config.dismissedPRHeads, dismiss.source)) {
|
|
471
|
+
dismissedPRHeads[dismiss.key] = config.dismissedPRHeads[dismiss.source];
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
const overrides = config.statusOverrides;
|
|
475
|
+
return {
|
|
476
|
+
...config,
|
|
477
|
+
dismissedIssues: foldedMap(config.dismissedIssues, dismissGroups),
|
|
478
|
+
dismissedPRHeads,
|
|
479
|
+
...(overrides && {
|
|
480
|
+
statusOverrides: foldedMap(overrides, groupByRef(overrides, (override) => stampRank(override.setAt))),
|
|
481
|
+
}),
|
|
482
|
+
};
|
|
483
|
+
}
|
|
410
484
|
// ── 6. Cache schemas ─────────────────────────────────────────────────
|
|
411
485
|
export const LocalRepoCacheSchema = z.object({
|
|
412
486
|
repos: z.record(z.string(), z.object({
|
|
@@ -469,7 +543,7 @@ export const FetchedPRSchema = z
|
|
|
469
543
|
url: z.string(),
|
|
470
544
|
repo: z.string(),
|
|
471
545
|
number: z.number(),
|
|
472
|
-
status: FetchedPRStatusSchema,
|
|
546
|
+
status: openEnum(FetchedPRStatusSchema.options),
|
|
473
547
|
})
|
|
474
548
|
.passthrough();
|
|
475
549
|
/**
|
|
@@ -481,6 +555,10 @@ export const FetchedPRSchema = z
|
|
|
481
555
|
* core schema, and `.passthrough()` preserves the enrichment fields on parse
|
|
482
556
|
* output. This mirrors the pre-#1456 `z.array(z.any())` static contract
|
|
483
557
|
* while actually validating the fields the dashboard dereferences.
|
|
558
|
+
* One limit (#2005): `status` is an open enum here, so a persisted entry can
|
|
559
|
+
* carry a status a newer release added although `FetchedPR['status']` is
|
|
560
|
+
* closed. Readers of the persisted digest compare against known values and
|
|
561
|
+
* treat anything else as needing attention, so nothing is hidden.
|
|
484
562
|
*/
|
|
485
563
|
const FetchedPRArraySchema = z.array(FetchedPRSchema);
|
|
486
564
|
/**
|
|
@@ -495,7 +573,8 @@ function derivePartitions(raw) {
|
|
|
495
573
|
return raw;
|
|
496
574
|
return {
|
|
497
575
|
...raw,
|
|
498
|
-
|
|
576
|
+
// A status a newer release added counts as needing attention (#2005).
|
|
577
|
+
needsAddressingPRs: openPRs.filter((pr) => pr?.status !== 'waiting_on_maintainer'),
|
|
499
578
|
waitingOnMaintainerPRs: openPRs.filter((pr) => pr?.status === 'waiting_on_maintainer'),
|
|
500
579
|
};
|
|
501
580
|
}
|
|
@@ -559,7 +638,7 @@ export const OvernightImplementAttemptSchema = z
|
|
|
559
638
|
.object({
|
|
560
639
|
url: z.string(),
|
|
561
640
|
attemptedAt: z.string(),
|
|
562
|
-
outcome:
|
|
641
|
+
outcome: openEnum(['prepared', 'blocked']),
|
|
563
642
|
note: z.string().optional(),
|
|
564
643
|
})
|
|
565
644
|
.passthrough();
|
|
@@ -641,6 +720,23 @@ const WorkClaimListSchema = z
|
|
|
641
720
|
const parsed = WorkClaimSchema.safeParse(claim);
|
|
642
721
|
return parsed.success ? [parsed.data] : [];
|
|
643
722
|
}));
|
|
723
|
+
/** One PR the tool opened (#1911), recorded at creation for the pacing caps. */
|
|
724
|
+
export const RecentNewPRSchema = z.object({ url: z.string(), openedAt: z.string() }).loose();
|
|
725
|
+
/**
|
|
726
|
+
* `state.recentNewPRs`, parsed one entry at a time like `workClaims`: an
|
|
727
|
+
* entry this release cannot read is dropped instead of rejecting the state.
|
|
728
|
+
* Dropping only lowers a pacing count.
|
|
729
|
+
*/
|
|
730
|
+
const RecentNewPRListSchema = z
|
|
731
|
+
.unknown()
|
|
732
|
+
.optional()
|
|
733
|
+
// Not a list at all (null, a string, an object) reads as no records, never as a corrupt state.
|
|
734
|
+
.transform((entries) => Array.isArray(entries)
|
|
735
|
+
? entries.flatMap((entry) => {
|
|
736
|
+
const parsed = RecentNewPRSchema.safeParse(entry);
|
|
737
|
+
return parsed.success ? [parsed.data] : [];
|
|
738
|
+
})
|
|
739
|
+
: undefined);
|
|
644
740
|
/** How many entries of `raw.workClaims` the lenient parse dropped as malformed (#1856); 0 when none or no list. */
|
|
645
741
|
export function malformedWorkClaimCount(raw, parsed) {
|
|
646
742
|
const stored = raw !== null && typeof raw === 'object' ? raw.workClaims : undefined;
|
|
@@ -653,10 +749,54 @@ export function malformedWorkClaimCount(raw, parsed) {
|
|
|
653
749
|
* kept (root, config, repoScores, the outcome ledger and pick snapshots,
|
|
654
750
|
* lastOvernight, searchRotation) are `.passthrough()`; schemas regenerated on
|
|
655
751
|
* every run (lastDigest) or rarely extended still strip. Persisted enums that
|
|
656
|
-
* grow (closeReason, pick source) accept unknown strings via {@link openEnum}.
|
|
752
|
+
* grow (closeReason, pick source, statuses, config modes; #2005) accept unknown strings via {@link openEnum}.
|
|
657
753
|
* Inferred types drop the passthrough index signature ({@link KnownKeys}) so a
|
|
658
754
|
* misspelled key still fails to compile.
|
|
755
|
+
*
|
|
756
|
+
* Retired root fields are dropped from the schema, not stripped: passthrough
|
|
757
|
+
* keeps an older client's `analyzedIssueConversations`, `prFollowUpHistory`
|
|
758
|
+
* and `workflowState` verbatim (#1948), so that client still parses its own data.
|
|
759
|
+
*/
|
|
760
|
+
/** One user approval of a repo's stored guidelines text (#1929). */
|
|
761
|
+
export const GuidelinesReviewSchema = z.object({
|
|
762
|
+
reviewedAt: z.string(),
|
|
763
|
+
/** Hex SHA-256 of the guidelines markdown the user approved. */
|
|
764
|
+
sha256: z.string(),
|
|
765
|
+
});
|
|
766
|
+
/** Longest quoted source line or disclosure text a repo policy keeps (#1953): the text is from other people's repos. */
|
|
767
|
+
export const POLICY_QUOTE_MAX = 200;
|
|
768
|
+
/** Longest gate label a repo policy keeps; GitHub caps a label name at 50 characters. */
|
|
769
|
+
export const GATE_LABEL_MAX = 50;
|
|
770
|
+
/**
|
|
771
|
+
* Per-repo contribution policy (#1953). Only enumerated values plus short
|
|
772
|
+
* quoted source lines: policy text comes from files in other people's repos.
|
|
659
773
|
*/
|
|
774
|
+
const PolicyQuoteSchema = z.string().max(POLICY_QUOTE_MAX);
|
|
775
|
+
const PolicySourceSchema = z.object({ file: z.string().max(100), quotedLine: PolicyQuoteSchema });
|
|
776
|
+
const CommitRuleIdSchema = z.string().regex(/^[a-z0-9-]{1,40}$/);
|
|
777
|
+
export const RepoPolicySchema = z.object({
|
|
778
|
+
aiPolicy: z.enum(['allowed', 'disclosure-required', 'banned', 'unknown']),
|
|
779
|
+
/**
|
|
780
|
+
* The disclosure line the user recorded with `policy set --disclosure-text` (#2040); the repo's own rule
|
|
781
|
+
* stays in `source`. Older releases stored a doc excerpt here, which `storedPolicy` drops on read. Fence it.
|
|
782
|
+
*/
|
|
783
|
+
disclosureText: PolicyQuoteSchema.optional(),
|
|
784
|
+
cla: z.enum(['none', 'required', 'unknown']),
|
|
785
|
+
/** Short ids such as `conventional-commits`, `dco-signoff`, `no-closing-keyword-in-commit`. */
|
|
786
|
+
commitRules: z.array(CommitRuleIdSchema).max(10),
|
|
787
|
+
prGate: z.enum(['none', 'claim-first', 'maintainer-label', 'collaborators-only', 'unknown']),
|
|
788
|
+
/**
|
|
789
|
+
* The issue label a `maintainer-label` gate waits for, recorded by the user with `policy set --gate-label`
|
|
790
|
+
* (#2040). vet never sets it: which label is the gate is not read from repo text. Fence it.
|
|
791
|
+
*/
|
|
792
|
+
gateLabel: z.string().max(GATE_LABEL_MAX).optional(),
|
|
793
|
+
maxOpenAiPRs: z.number().int().positive().optional(),
|
|
794
|
+
/** Where each rule came from. `quotedLine` is untrusted. */
|
|
795
|
+
source: z.array(PolicySourceSchema).max(10),
|
|
796
|
+
/** True once the user set it with `policy set`; vet never overwrites such a record. */
|
|
797
|
+
reviewedByUser: z.boolean(),
|
|
798
|
+
updatedAt: z.string(),
|
|
799
|
+
});
|
|
660
800
|
export const AgentStateSchema = z
|
|
661
801
|
.object({
|
|
662
802
|
version: z.literal(4),
|
|
@@ -681,25 +821,7 @@ export const AgentStateSchema = z
|
|
|
681
821
|
localRepoCache: LocalRepoCacheSchema.optional(),
|
|
682
822
|
mergedPRs: z.array(StoredMergedPRSchema).optional(),
|
|
683
823
|
closedPRs: z.array(StoredClosedPRSchema).optional(),
|
|
684
|
-
analyzedIssueConversations: z.array(AnalyzedIssueConversationSchema).optional(),
|
|
685
824
|
activeIssues: z.array(TrackedIssueSchema).default([]),
|
|
686
|
-
/**
|
|
687
|
-
* Per-PR follow-up history (#1277). Keyed by PR URL. Each entry
|
|
688
|
-
* records a tier-bucketed follow-up that the user drafted (and
|
|
689
|
-
* presumably posted via `draft-review-post`). The dormant-pr
|
|
690
|
-
* workflow reads this before drafting to enforce the
|
|
691
|
-
* one-follow-up-per-timeframe rule documented in
|
|
692
|
-
* `skills/pr-etiquette/SKILL.md`.
|
|
693
|
-
*/
|
|
694
|
-
prFollowUpHistory: z.record(z.string(), z.array(FollowUpEntrySchema)).optional(),
|
|
695
|
-
/**
|
|
696
|
-
* Pause-point snapshot for resumable workflows (#1280). Set when
|
|
697
|
-
* the user picks "Done for now" mid-workflow; cleared when the
|
|
698
|
-
* workflow completes or the user explicitly discards. The router
|
|
699
|
-
* reads this on every `/oss` invocation and offers Resume /
|
|
700
|
-
* Restart / Discard when present.
|
|
701
|
-
*/
|
|
702
|
-
workflowState: WorkflowStateSchema.optional(),
|
|
703
825
|
/**
|
|
704
826
|
* Durable search seen-set for result rotation (#1528). Issue URLs surfaced
|
|
705
827
|
* by recent searches, with the timestamp they were last surfaced. Fed into
|
|
@@ -730,6 +852,36 @@ export const AgentStateSchema = z
|
|
|
730
852
|
* entries are ignored on read and pruned on write.
|
|
731
853
|
*/
|
|
732
854
|
workClaims: WorkClaimListSchema,
|
|
855
|
+
/**
|
|
856
|
+
* PRs the tool opened in the last 24 hours (#1911), recorded by
|
|
857
|
+
* `work release --pr <url>` right after `gh pr create`, so the pacing
|
|
858
|
+
* caps count a PR before the next `daily` picks it up. Pruned to the
|
|
859
|
+
* window on every write. Optional; the root schema is passthrough, so an
|
|
860
|
+
* older client keeps the list when it saves.
|
|
861
|
+
*/
|
|
862
|
+
recentNewPRs: RecentNewPRListSchema,
|
|
863
|
+
/**
|
|
864
|
+
* User review stamps for stored per-repo guidelines (#1929), keyed by
|
|
865
|
+
* `owner/repo`. Written only by `guidelines store`, which requires the
|
|
866
|
+
* caller to assert the user approved the exact text. The hash ties the
|
|
867
|
+
* stamp to that text: a guidelines file rewritten by a client that predates
|
|
868
|
+
* the review requirement no longer matches and reads as unreviewed.
|
|
869
|
+
* Optional so state written by older clients still parses. Entries are
|
|
870
|
+
* kept as written and validated one at a time on read
|
|
871
|
+
* (`StateManager.getGuidelinesReview`), so an entry this release cannot
|
|
872
|
+
* read counts as "not reviewed" for that repo only and is not dropped on
|
|
873
|
+
* the next save.
|
|
874
|
+
*/
|
|
875
|
+
guidelinesReviews: z.record(z.string(), z.unknown()).optional().catch(undefined),
|
|
876
|
+
/**
|
|
877
|
+
* Per-repo contribution policies (#1953), keyed by lowercase `owner/repo`.
|
|
878
|
+
* Written by `vet` (reviewedByUser: false) and `policy set` (true). Kept as
|
|
879
|
+
* written and validated per entry on read (`StateManager.getRepoPolicy`),
|
|
880
|
+
* like `guidelinesReviews`, so an entry a newer release wrote is not
|
|
881
|
+
* dropped here. `config.aiPolicyBlocklist` stays the older ban list and is
|
|
882
|
+
* read as `aiPolicy: 'banned'` on top of these (core/repo-policy.ts).
|
|
883
|
+
*/
|
|
884
|
+
repoPolicies: z.record(z.string(), z.unknown()).optional().catch(undefined),
|
|
733
885
|
})
|
|
734
886
|
.passthrough();
|
|
735
887
|
/** Top-level state keys this release does not know, i.e. written by another (usually newer) release (#1831). */
|
package/dist/core/state.d.ts
CHANGED
|
@@ -3,8 +3,10 @@
|
|
|
3
3
|
* Thin coordinator that delegates persistence to state-persistence.ts
|
|
4
4
|
* and scoring logic to repo-score-manager.ts.
|
|
5
5
|
*/
|
|
6
|
-
import { AgentState, TrackedIssue, RepoScore, RepoScoreUpdate, DailyDigest,
|
|
6
|
+
import { AgentState, TrackedIssue, RepoScore, RepoScoreUpdate, DailyDigest, StatusOverride, FetchedPRStatus, StoredMergedPR, StoredClosedPR, SearchSeenEntry, PickSnapshot, OvernightRecord, SearchRotation, WorkClaim } from './types.js';
|
|
7
|
+
import { type GuidelinesReview, type RepoPolicy } from './state-schema.js';
|
|
7
8
|
import { type LoadRecoveryInfo } from './state-persistence.js';
|
|
9
|
+
import * as repoScoring from './repo-score-manager.js';
|
|
8
10
|
import type { Stats } from './repo-score-manager.js';
|
|
9
11
|
import { GistStateStore } from './gist-state-store.js';
|
|
10
12
|
/** Gist file that carries the rendered overnight report across machines (#1698). */
|
|
@@ -71,7 +73,7 @@ export interface StalenessInfo {
|
|
|
71
73
|
export declare class StateManager {
|
|
72
74
|
protected state: AgentState;
|
|
73
75
|
protected inMemoryOnly: boolean;
|
|
74
|
-
private
|
|
76
|
+
private lastLoadedFileId;
|
|
75
77
|
private _batching;
|
|
76
78
|
private _batchDirty;
|
|
77
79
|
protected gistStore: GistStateStore | null;
|
|
@@ -163,6 +165,8 @@ export declare class StateManager {
|
|
|
163
165
|
* `isGistDegraded()` at each call site.
|
|
164
166
|
*
|
|
165
167
|
* Composes the same primitive fields those accessors expose:
|
|
168
|
+
* - no gist store + config names a mode this release does not know →
|
|
169
|
+
* `unknown-mode` (#2005)
|
|
166
170
|
* - no gist store + config asks for gist → `configured-but-local`
|
|
167
171
|
* - gist store attached but disarmed (#1443) → `bootstrap-degraded`
|
|
168
172
|
* (`since` comes from the staleness marker the degraded bootstrap seeds)
|
|
@@ -190,6 +194,12 @@ export declare class StateManager {
|
|
|
190
194
|
* Throws when not in Gist mode.
|
|
191
195
|
*/
|
|
192
196
|
deleteGuidelines(repo: string): void;
|
|
197
|
+
/** Record that the user approved the guidelines text hashing to `sha256` for `repo` (#1929). */
|
|
198
|
+
markGuidelinesReviewed(repo: string, sha256: string, reviewedAt: string): void;
|
|
199
|
+
/** The review stamp for `repo`, or undefined when none is recorded or the entry is unreadable (#1929). */
|
|
200
|
+
getGuidelinesReview(repo: string): GuidelinesReview | undefined;
|
|
201
|
+
/** Store `policy` for `repo` (#1953), or delete the record when `policy` is null. Keys are lowercase. */
|
|
202
|
+
setRepoPolicy(repo: string, policy: RepoPolicy | null): void;
|
|
193
203
|
/** List repos with non-empty guidelines stored in the Gist. */
|
|
194
204
|
listGuidelinesRepos(): string[];
|
|
195
205
|
/**
|
|
@@ -277,10 +287,10 @@ export declare class StateManager {
|
|
|
277
287
|
*/
|
|
278
288
|
setMonthlyOpenedCounts(counts: Record<string, number>): void;
|
|
279
289
|
/**
|
|
280
|
-
*
|
|
281
|
-
*
|
|
290
|
+
* Drop the synced copy of the local repository cache. The cache is
|
|
291
|
+
* per-machine and lives in `local-config.json` (#1950).
|
|
282
292
|
*/
|
|
283
|
-
|
|
293
|
+
clearSyncedLocalRepoCache(): void;
|
|
284
294
|
/** Returns all stored merged PRs (sorted by merge date descending via addMergedPRs). */
|
|
285
295
|
getMergedPRs(): StoredMergedPR[];
|
|
286
296
|
/**
|
|
@@ -320,7 +330,8 @@ export declare class StateManager {
|
|
|
320
330
|
* this prevents the bad data from reaching disk in the first place).
|
|
321
331
|
*
|
|
322
332
|
* Re-seen URLs upgrade the stored entry's missing ledger fields in place
|
|
323
|
-
* (#1461) — see {@link addMergedPRs} for the full semantics.
|
|
333
|
+
* (#1461) — see {@link addMergedPRs} for the full semantics. URLs already
|
|
334
|
+
* in the merged ledger are skipped (#1923).
|
|
324
335
|
*
|
|
325
336
|
* @param prs - Closed PRs to add (duplicates by URL upgrade in place)
|
|
326
337
|
* @returns count of entries added vs. dropped (invalid URL)
|
|
@@ -329,6 +340,20 @@ export declare class StateManager {
|
|
|
329
340
|
added: number;
|
|
330
341
|
dropped: number;
|
|
331
342
|
};
|
|
343
|
+
/**
|
|
344
|
+
* Remove closed-ledger entries that are open again (`openUrls`) or sit in
|
|
345
|
+
* the merged ledger, lowering the affected repos' closed counts with them
|
|
346
|
+
* (#1923). See repoScoring.evictClosedPRs.
|
|
347
|
+
* @returns the number of entries removed
|
|
348
|
+
*/
|
|
349
|
+
evictClosedPRs(openUrls: Iterable<string>): number;
|
|
350
|
+
/**
|
|
351
|
+
* Remove ledger rows and repoScores entries for repositories in
|
|
352
|
+
* `config.untrackedOrgs` and for `privateRepos`, which must hold only
|
|
353
|
+
* repositories GitHub reported private in this run (#1924). See
|
|
354
|
+
* repoScoring.evictExcludedRepos.
|
|
355
|
+
*/
|
|
356
|
+
evictExcludedRepos(privateRepos: Iterable<string>): repoScoring.EvictedRepos;
|
|
332
357
|
/** Returns the most recent close date, used as a watermark for incremental fetching. */
|
|
333
358
|
getClosedPRWatermark(): string | undefined;
|
|
334
359
|
/**
|
|
@@ -349,6 +374,12 @@ export declare class StateManager {
|
|
|
349
374
|
* No-op when no PR with that URL is stored.
|
|
350
375
|
*/
|
|
351
376
|
markPRLearningsExtracted(url: string, extractedAt: string): void;
|
|
377
|
+
/**
|
|
378
|
+
* Stamp a written guideline proposal on the merged or closed PR matching
|
|
379
|
+
* `url` (#2041). `machineId` is omitted when this machine has none.
|
|
380
|
+
* No-op when no PR with that URL is stored.
|
|
381
|
+
*/
|
|
382
|
+
markPRLearningsProposed(url: string, proposedAt: string, machineId: string | undefined): void;
|
|
352
383
|
/**
|
|
353
384
|
* Merge partial config updates into the current configuration.
|
|
354
385
|
* @param config - Partial config object to merge
|
|
@@ -417,15 +448,30 @@ export declare class StateManager {
|
|
|
417
448
|
/**
|
|
418
449
|
* Shelve a PR URL, hiding it from daily digest and capacity.
|
|
419
450
|
* @param url - The PR URL to shelve
|
|
451
|
+
* @param reasons - The PR's action reasons right now (`shelveReasonsOf`), when known
|
|
420
452
|
* @returns true if newly shelved, false if already shelved
|
|
421
453
|
*/
|
|
422
|
-
shelvePR(url: string): boolean;
|
|
454
|
+
shelvePR(url: string, reasons?: string[]): boolean;
|
|
455
|
+
/**
|
|
456
|
+
* Index of a PR in `shelvedPRUrls`, matched through {@link issueRefKey} so
|
|
457
|
+
* a URL typed in different casing or with a trailing slash still finds the
|
|
458
|
+
* entry (#1922). -1 when not shelved.
|
|
459
|
+
*/
|
|
460
|
+
private shelvedIndex;
|
|
423
461
|
/**
|
|
424
462
|
* Unshelve a PR URL, restoring it to daily digest.
|
|
425
463
|
* @param url - The PR URL to unshelve
|
|
426
464
|
* @returns true if removed from shelf, false if not shelved
|
|
427
465
|
*/
|
|
428
466
|
unshelvePR(url: string): boolean;
|
|
467
|
+
/**
|
|
468
|
+
* Fill in the action reasons of a shelve record that has none yet (#1922):
|
|
469
|
+
* the PR was not in the digest when it was shelved, so the first daily run
|
|
470
|
+
* that sees it records them. Never changes reasons already recorded: a
|
|
471
|
+
* reason that clears and comes back was there at shelve time and is not
|
|
472
|
+
* new. No-op for a PR without a shelve record.
|
|
473
|
+
*/
|
|
474
|
+
fillShelvedPRReasons(url: string, reasons: string[]): void;
|
|
429
475
|
/**
|
|
430
476
|
* Check if a PR is currently shelved.
|
|
431
477
|
* @param url - The PR URL to check
|
|
@@ -470,7 +516,10 @@ export declare class StateManager {
|
|
|
470
516
|
* @param url - The PR URL to check
|
|
471
517
|
*/
|
|
472
518
|
getDismissedPRHead(url: string): string | undefined;
|
|
473
|
-
/**
|
|
519
|
+
/**
|
|
520
|
+
* Record or (with `undefined`) drop the dismiss head for `url`, replacing
|
|
521
|
+
* any head stored under another form of the same PR's URL (#2001); no save.
|
|
522
|
+
*/
|
|
474
523
|
private setDismissedPRHead;
|
|
475
524
|
/**
|
|
476
525
|
* Set a manual status override for a PR. Auto-clears when the PR has new activity.
|
|
@@ -560,6 +609,13 @@ export declare class StateManager {
|
|
|
560
609
|
session?: string;
|
|
561
610
|
kind?: string;
|
|
562
611
|
}, nowMs?: number): string[];
|
|
612
|
+
/**
|
|
613
|
+
* Record a PR the tool just opened (#1911) so the pacing caps count it
|
|
614
|
+
* before the next `daily`. Idempotent per URL (the first open time is
|
|
615
|
+
* kept); entries older than the 24-hour window are pruned in the same write.
|
|
616
|
+
* @returns true when the PR was not recorded yet
|
|
617
|
+
*/
|
|
618
|
+
recordNewPR(url: string, nowMs?: number): boolean;
|
|
563
619
|
setStatusOverride(url: string, status: FetchedPRStatus, lastActivityAt: string): void;
|
|
564
620
|
/**
|
|
565
621
|
* Remove a manual status override for a PR.
|
|
@@ -586,6 +642,14 @@ export declare class StateManager {
|
|
|
586
642
|
* @param updates - Partial score fields to merge
|
|
587
643
|
*/
|
|
588
644
|
updateRepoScore(repo: string, updates: RepoScoreUpdate): void;
|
|
645
|
+
/** Record each repo's outcome evidence; see repoScoring.restoreUnchangedEvaluations. */
|
|
646
|
+
snapshotRepoOutcomes(): repoScoring.OutcomeSnapshot;
|
|
647
|
+
/**
|
|
648
|
+
* Put back `lastEvaluatedAt` for repos whose outcome evidence ends where
|
|
649
|
+
* `snapshot` found it, so a count written in several steps that nets to no
|
|
650
|
+
* change does not count as a re-evaluation (#2045).
|
|
651
|
+
*/
|
|
652
|
+
restoreUnchangedEvaluations(snapshot: repoScoring.OutcomeSnapshot): void;
|
|
589
653
|
/** Returns repository names that have at least one merged PR. */
|
|
590
654
|
getReposWithMergedPRs(): string[];
|
|
591
655
|
/** Returns repository names with open PRs but no merged PRs yet. */
|
|
@@ -674,6 +738,15 @@ export type GistPersistenceStatus =
|
|
|
674
738
|
* A later call may recover. */
|
|
675
739
|
| 'degraded';
|
|
676
740
|
export declare function ensureGistPersistence(token: string | null): Promise<GistPersistenceStatus>;
|
|
741
|
+
/**
|
|
742
|
+
* The warning for a persistence mode a newer release wrote (#2005), or null.
|
|
743
|
+
* {@link ensureGistPersistence} reads such a mode as `'local-mode'`, so entry
|
|
744
|
+
* points add this to their output: writes will not reach the Gist the newer
|
|
745
|
+
* client syncs through. Reads state.json, or the state cache when state.json
|
|
746
|
+
* is absent, as ensureGistPersistence does; any other read failure is that
|
|
747
|
+
* function's to report.
|
|
748
|
+
*/
|
|
749
|
+
export declare function unknownPersistenceModeWarning(): string | null;
|
|
677
750
|
/**
|
|
678
751
|
* Best-effort gist bootstrap for entry points WITHOUT the auth gate (#1431):
|
|
679
752
|
* the CLI's localOnly commands (shelve/move/dismiss/override/config/setup/...)
|