@oss-autopilot/core 3.33.1 → 3.34.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-registry.js +38 -1
- package/dist/cli.bundle.cjs +133 -123
- package/dist/commands/daily.js +5 -1
- package/dist/commands/dashboard-data.js +3 -1
- package/dist/commands/eval.d.ts +11 -0
- package/dist/commands/eval.js +11 -0
- package/dist/commands/index.d.ts +1 -0
- package/dist/commands/index.js +1 -0
- package/dist/commands/ledger-backfill.d.ts +40 -0
- package/dist/commands/ledger-backfill.js +216 -0
- package/dist/commands/vet-list.js +16 -6
- package/dist/commands/vet.js +4 -2
- package/dist/core/close-reason.d.ts +25 -0
- package/dist/core/close-reason.js +28 -0
- package/dist/core/daily-logic.d.ts +12 -0
- package/dist/core/daily-logic.js +10 -0
- package/dist/core/eval-report.d.ts +55 -0
- package/dist/core/eval-report.js +211 -0
- package/dist/core/github-stats.d.ts +9 -0
- package/dist/core/github-stats.js +26 -0
- package/dist/core/index.d.ts +2 -1
- package/dist/core/index.js +2 -1
- package/dist/core/pick-snapshot.d.ts +23 -0
- package/dist/core/pick-snapshot.js +51 -0
- package/dist/core/state-schema.d.ts +117 -0
- package/dist/core/state-schema.js +48 -0
- package/dist/core/state.d.ts +22 -1
- package/dist/core/state.js +63 -10
- package/dist/core/types.d.ts +1 -1
- package/dist/formatters/json.d.ts +8 -0
- package/package.json +1 -1
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
* Unknown keys are stripped by default (Zod 4 behavior).
|
|
10
10
|
*/
|
|
11
11
|
import { z } from 'zod';
|
|
12
|
+
import { CLOSE_REASONS } from './close-reason.js';
|
|
12
13
|
// ── 1. Enum / union schemas ───────────────────────────────────────────
|
|
13
14
|
export const IssueStatusSchema = z.enum(['candidate', 'claimed', 'in_progress', 'pr_submitted']);
|
|
14
15
|
export const FetchedPRStatusSchema = z.enum(['needs_addressing', 'waiting_on_maintainer']);
|
|
@@ -40,6 +41,39 @@ export const RepoScoreSchema = z.object({
|
|
|
40
41
|
stargazersCount: z.number().optional(),
|
|
41
42
|
language: z.string().nullable().optional(),
|
|
42
43
|
});
|
|
44
|
+
/**
|
|
45
|
+
* What the tool predicted about an issue when it was vetted (#1824). Recorded
|
|
46
|
+
* by `vet` / `vet-list` keyed by issue URL, then copied onto the outcome
|
|
47
|
+
* ledger entry of the PR that closes that issue, so outcomes can be compared
|
|
48
|
+
* against the prediction that picked them (calibration).
|
|
49
|
+
*/
|
|
50
|
+
export const PickSnapshotSchema = z.object({
|
|
51
|
+
issueUrl: z.string(),
|
|
52
|
+
/** Success-likelihood grade (1-10) from issue-grading. */
|
|
53
|
+
grade: z.number(),
|
|
54
|
+
recommendation: z.string(),
|
|
55
|
+
stargazersCount: z.number().optional(),
|
|
56
|
+
/** `list`: the curated list's `**Tier (N/10)**` score, imported by ledger-backfill. */
|
|
57
|
+
source: z.enum(['vet', 'vet-list', 'list']),
|
|
58
|
+
/** When the vet ran. Absent for `list` picks: the list does not record vet dates reliably. */
|
|
59
|
+
capturedAt: z.string().optional(),
|
|
60
|
+
});
|
|
61
|
+
/**
|
|
62
|
+
* Outcome-ledger fields added by #1824, shared by merged and closed entries.
|
|
63
|
+
* All optional: entries written before #1824 have none of them.
|
|
64
|
+
*/
|
|
65
|
+
const LedgerPredictionFields = {
|
|
66
|
+
/** Issue the PR closes, parsed from a closing keyword in the PR body. */
|
|
67
|
+
issueUrl: z.string().optional(),
|
|
68
|
+
/** The vet-time prediction for `issueUrl`, when one was recorded. */
|
|
69
|
+
pick: PickSnapshotSchema.optional(),
|
|
70
|
+
/** Review decision from the last digest that saw the PR open. */
|
|
71
|
+
lastReviewDecision: z.string().optional(),
|
|
72
|
+
/** CI status from the last digest that saw the PR open. */
|
|
73
|
+
lastCiStatus: z.string().optional(),
|
|
74
|
+
/** When ledger-backfill got GitHub's answer for this PR; later runs skip it. */
|
|
75
|
+
backfilledAt: z.string().optional(),
|
|
76
|
+
};
|
|
43
77
|
export const StoredMergedPRSchema = z.object({
|
|
44
78
|
url: z.string(),
|
|
45
79
|
title: z.string(),
|
|
@@ -64,6 +98,7 @@ export const StoredMergedPRSchema = z.object({
|
|
|
64
98
|
commentsFetchedAt: z.string().datetime().optional(),
|
|
65
99
|
/** When the host last ran LLM extraction over this PR's comment bundle (#867). */
|
|
66
100
|
learningsExtractedAt: z.string().datetime().optional(),
|
|
101
|
+
...LedgerPredictionFields,
|
|
67
102
|
});
|
|
68
103
|
export const StoredClosedPRSchema = z.object({
|
|
69
104
|
url: z.string(),
|
|
@@ -82,6 +117,9 @@ export const StoredClosedPRSchema = z.object({
|
|
|
82
117
|
commentsFetchedAt: z.string().datetime().optional(),
|
|
83
118
|
/** When the host last ran LLM extraction over this PR's comment bundle (#867). */
|
|
84
119
|
learningsExtractedAt: z.string().datetime().optional(),
|
|
120
|
+
...LedgerPredictionFields,
|
|
121
|
+
/** Why it closed unmerged (#1824), set by ledger-backfill. */
|
|
122
|
+
closeReason: z.enum(CLOSE_REASONS).optional(),
|
|
85
123
|
});
|
|
86
124
|
export const AnalyzedIssueConversationSchema = z.object({
|
|
87
125
|
url: z.string(),
|
|
@@ -310,6 +348,8 @@ export const ClosedPRSchema = z.object({
|
|
|
310
348
|
* Optional: digests persisted by older producers don't have it.
|
|
311
349
|
*/
|
|
312
350
|
openedAt: z.string().optional(),
|
|
351
|
+
/** Issue the PR closes, parsed from the PR body (#1824). */
|
|
352
|
+
issueUrl: z.string().optional(),
|
|
313
353
|
});
|
|
314
354
|
export const MergedPRSchema = z.object({
|
|
315
355
|
url: z.string(),
|
|
@@ -323,6 +363,8 @@ export const MergedPRSchema = z.object({
|
|
|
323
363
|
* Optional: digests persisted by older producers don't have it.
|
|
324
364
|
*/
|
|
325
365
|
openedAt: z.string().optional(),
|
|
366
|
+
/** Issue the PR closes, parsed from the PR body (#1824). */
|
|
367
|
+
issueUrl: z.string().optional(),
|
|
326
368
|
});
|
|
327
369
|
export const DailyDigestSummarySchema = z.object({
|
|
328
370
|
totalActivePRs: z.number(),
|
|
@@ -509,6 +551,12 @@ export const AgentStateSchema = z.object({
|
|
|
509
551
|
* it cannot grow without bound.
|
|
510
552
|
*/
|
|
511
553
|
searchSeen: z.array(SearchSeenEntrySchema).default([]),
|
|
554
|
+
/**
|
|
555
|
+
* Vet-time predictions keyed by issue URL (#1824), newest last. Joined onto
|
|
556
|
+
* outcome-ledger entries at merge/close detection. Capped at
|
|
557
|
+
* MAX_PICK_SNAPSHOTS so it cannot grow without bound.
|
|
558
|
+
*/
|
|
559
|
+
pickSnapshots: z.array(PickSnapshotSchema).default([]),
|
|
512
560
|
/** Latest overnight run (#1574). Absent until the first `overnight`. */
|
|
513
561
|
lastOvernight: OvernightRecordSchema.optional(),
|
|
514
562
|
/**
|
package/dist/core/state.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
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, LocalRepoCache, StatusOverride, FetchedPRStatus, StoredMergedPR, StoredClosedPR, SearchSeenEntry, OvernightRecord, SearchRotation } from './types.js';
|
|
6
|
+
import { AgentState, TrackedIssue, RepoScore, RepoScoreUpdate, DailyDigest, LocalRepoCache, StatusOverride, FetchedPRStatus, StoredMergedPR, StoredClosedPR, SearchSeenEntry, PickSnapshot, OvernightRecord, SearchRotation } from './types.js';
|
|
7
7
|
import { type LoadRecoveryInfo } from './state-persistence.js';
|
|
8
8
|
import type { Stats } from './repo-score-manager.js';
|
|
9
9
|
import { GistStateStore } from './gist-state-store.js';
|
|
@@ -13,6 +13,8 @@ import { type GistHealth } from './gist-health.js';
|
|
|
13
13
|
export { acquireLock, releaseLock, atomicWriteFileSync } from './state-persistence.js';
|
|
14
14
|
export type { LoadRecoveryInfo } from './state-persistence.js';
|
|
15
15
|
export type { Stats } from './repo-score-manager.js';
|
|
16
|
+
/** Cap on `state.pickSnapshots` (#1824): ~180 bytes each, so ~55 KB at the cap. */
|
|
17
|
+
export declare const MAX_PICK_SNAPSHOTS = 300;
|
|
16
18
|
/**
|
|
17
19
|
* Push state to the backing Gist when Gist mode is active. Best-effort:
|
|
18
20
|
* network/auth failures are logged via `warn()` but never propagated —
|
|
@@ -257,6 +259,12 @@ export declare class StateManager {
|
|
|
257
259
|
added: number;
|
|
258
260
|
dropped: number;
|
|
259
261
|
};
|
|
262
|
+
/**
|
|
263
|
+
* Copy the vet-time prediction for the PR's closing issue onto a ledger
|
|
264
|
+
* entry (#1824). Returns the entry unchanged when it has no issueUrl, already
|
|
265
|
+
* carries a pick, or no snapshot was recorded for that issue.
|
|
266
|
+
*/
|
|
267
|
+
private withPick;
|
|
260
268
|
/** Returns the most recent merge date, used as a watermark for incremental fetching. */
|
|
261
269
|
getMergedPRWatermark(): string | undefined;
|
|
262
270
|
/** Returns all stored closed-without-merge PRs (sorted by close date descending via addClosedPRs). */
|
|
@@ -362,6 +370,19 @@ export declare class StateManager {
|
|
|
362
370
|
* @param status - The overridden status
|
|
363
371
|
* @param lastActivityAt - ISO timestamp of PR's last activity when override was set
|
|
364
372
|
*/
|
|
373
|
+
/** Vet-time predictions awaiting a ledger join (#1824), oldest first. */
|
|
374
|
+
getPickSnapshots(): PickSnapshot[];
|
|
375
|
+
/**
|
|
376
|
+
* Record vet-time predictions (#1824). The first prediction for an issue
|
|
377
|
+
* wins: a later re-vet (often after the user's own PR exists) must not
|
|
378
|
+
* replace the one that picked it. The oldest entries are dropped past
|
|
379
|
+
* {@link MAX_PICK_SNAPSHOTS}.
|
|
380
|
+
*
|
|
381
|
+
* ponytail: never refreshed, so an issue vetted months before it is picked
|
|
382
|
+
* keeps its old grade. Replace snapshots older than N days if that skews
|
|
383
|
+
* calibration.
|
|
384
|
+
*/
|
|
385
|
+
recordPickSnapshots(snapshots: PickSnapshot[]): void;
|
|
365
386
|
/**
|
|
366
387
|
* The durable search seen-set (#1528) — issue URLs surfaced by recent
|
|
367
388
|
* searches, fed into oss-scout for result rotation. Returns `[]` when none
|
package/dist/core/state.js
CHANGED
|
@@ -37,8 +37,19 @@ function filterValidUrlEntries(entries, kind) {
|
|
|
37
37
|
}
|
|
38
38
|
return { valid, dropped };
|
|
39
39
|
}
|
|
40
|
+
/** Optional outcome-ledger fields (#1461, #1824) that a re-seen entry may fill in. */
|
|
41
|
+
const LEDGER_FIELDS = [
|
|
42
|
+
'openedAt',
|
|
43
|
+
'firstMaintainerResponseAt',
|
|
44
|
+
'issueUrl',
|
|
45
|
+
'pick',
|
|
46
|
+
'lastReviewDecision',
|
|
47
|
+
'lastCiStatus',
|
|
48
|
+
'backfilledAt',
|
|
49
|
+
'closeReason',
|
|
50
|
+
];
|
|
40
51
|
/**
|
|
41
|
-
* Fill outcome-ledger
|
|
52
|
+
* Fill outcome-ledger fields (#1461, #1824) missing on an existing stored PR
|
|
42
53
|
* from a richer re-seen entry. Only fills absent fields — never overwrites —
|
|
43
54
|
* so an earlier enriched write (and stamps like commentsFetchedAt that live
|
|
44
55
|
* solely on the stored entry) cannot be clobbered by a later minimal one.
|
|
@@ -46,16 +57,16 @@ function filterValidUrlEntries(entries, kind) {
|
|
|
46
57
|
*/
|
|
47
58
|
function upgradeLedgerFields(existing, incoming) {
|
|
48
59
|
let changed = false;
|
|
49
|
-
|
|
50
|
-
existing
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
existing.firstMaintainerResponseAt = incoming.firstMaintainerResponseAt;
|
|
55
|
-
changed = true;
|
|
60
|
+
for (const key of LEDGER_FIELDS) {
|
|
61
|
+
if (incoming[key] !== undefined && existing[key] === undefined) {
|
|
62
|
+
existing[key] = incoming[key];
|
|
63
|
+
changed = true;
|
|
64
|
+
}
|
|
56
65
|
}
|
|
57
66
|
return changed;
|
|
58
67
|
}
|
|
68
|
+
/** Cap on `state.pickSnapshots` (#1824): ~180 bytes each, so ~55 KB at the cap. */
|
|
69
|
+
export const MAX_PICK_SNAPSHOTS = 300;
|
|
59
70
|
/**
|
|
60
71
|
* Push state to the backing Gist when Gist mode is active. Best-effort:
|
|
61
72
|
* network/auth failures are logged via `warn()` but never propagated —
|
|
@@ -590,7 +601,8 @@ export class StateManager {
|
|
|
590
601
|
addMergedPRs(prs) {
|
|
591
602
|
if (prs.length === 0)
|
|
592
603
|
return { added: 0, dropped: 0 };
|
|
593
|
-
const { valid, dropped } = filterValidUrlEntries(prs, 'merged');
|
|
604
|
+
const { valid: unpicked, dropped } = filterValidUrlEntries(prs, 'merged');
|
|
605
|
+
const valid = unpicked.map((pr) => this.withPick(pr));
|
|
594
606
|
if (valid.length === 0)
|
|
595
607
|
return { added: 0, dropped };
|
|
596
608
|
if (!this.state.mergedPRs)
|
|
@@ -616,6 +628,18 @@ export class StateManager {
|
|
|
616
628
|
this.autoSave();
|
|
617
629
|
return { added: newPRs.length, dropped };
|
|
618
630
|
}
|
|
631
|
+
/**
|
|
632
|
+
* Copy the vet-time prediction for the PR's closing issue onto a ledger
|
|
633
|
+
* entry (#1824). Returns the entry unchanged when it has no issueUrl, already
|
|
634
|
+
* carries a pick, or no snapshot was recorded for that issue.
|
|
635
|
+
*/
|
|
636
|
+
withPick(pr) {
|
|
637
|
+
if (!pr.issueUrl || pr.pick)
|
|
638
|
+
return pr;
|
|
639
|
+
const key = pr.issueUrl.toLowerCase();
|
|
640
|
+
const pick = this.getPickSnapshots().find((p) => p.issueUrl.toLowerCase() === key);
|
|
641
|
+
return pick ? { ...pr, pick } : pr;
|
|
642
|
+
}
|
|
619
643
|
/** Returns the most recent merge date, used as a watermark for incremental fetching. */
|
|
620
644
|
getMergedPRWatermark() {
|
|
621
645
|
return this.state.mergedPRs?.[0]?.mergedAt || undefined;
|
|
@@ -640,7 +664,8 @@ export class StateManager {
|
|
|
640
664
|
addClosedPRs(prs) {
|
|
641
665
|
if (prs.length === 0)
|
|
642
666
|
return { added: 0, dropped: 0 };
|
|
643
|
-
const { valid, dropped } = filterValidUrlEntries(prs, 'closed');
|
|
667
|
+
const { valid: unpicked, dropped } = filterValidUrlEntries(prs, 'closed');
|
|
668
|
+
const valid = unpicked.map((pr) => this.withPick(pr));
|
|
644
669
|
if (valid.length === 0)
|
|
645
670
|
return { added: 0, dropped };
|
|
646
671
|
if (!this.state.closedPRs)
|
|
@@ -876,6 +901,34 @@ export class StateManager {
|
|
|
876
901
|
* @param status - The overridden status
|
|
877
902
|
* @param lastActivityAt - ISO timestamp of PR's last activity when override was set
|
|
878
903
|
*/
|
|
904
|
+
/** Vet-time predictions awaiting a ledger join (#1824), oldest first. */
|
|
905
|
+
getPickSnapshots() {
|
|
906
|
+
return this.state.pickSnapshots ?? [];
|
|
907
|
+
}
|
|
908
|
+
/**
|
|
909
|
+
* Record vet-time predictions (#1824). The first prediction for an issue
|
|
910
|
+
* wins: a later re-vet (often after the user's own PR exists) must not
|
|
911
|
+
* replace the one that picked it. The oldest entries are dropped past
|
|
912
|
+
* {@link MAX_PICK_SNAPSHOTS}.
|
|
913
|
+
*
|
|
914
|
+
* ponytail: never refreshed, so an issue vetted months before it is picked
|
|
915
|
+
* keeps its old grade. Replace snapshots older than N days if that skews
|
|
916
|
+
* calibration.
|
|
917
|
+
*/
|
|
918
|
+
recordPickSnapshots(snapshots) {
|
|
919
|
+
const known = new Set(this.getPickSnapshots().map((p) => p.issueUrl.toLowerCase()));
|
|
920
|
+
const fresh = snapshots.filter((p) => {
|
|
921
|
+
const key = p.issueUrl.toLowerCase();
|
|
922
|
+
if (known.has(key))
|
|
923
|
+
return false;
|
|
924
|
+
known.add(key);
|
|
925
|
+
return true;
|
|
926
|
+
});
|
|
927
|
+
if (fresh.length === 0)
|
|
928
|
+
return;
|
|
929
|
+
this.state.pickSnapshots = [...this.getPickSnapshots(), ...fresh].slice(-MAX_PICK_SNAPSHOTS);
|
|
930
|
+
this.autoSave();
|
|
931
|
+
}
|
|
879
932
|
/**
|
|
880
933
|
* The durable search seen-set (#1528) — issue URLs surfaced by recent
|
|
881
934
|
* searches, fed into oss-scout for result rotation. Returns `[]` when none
|
package/dist/core/types.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Core types for the Open Source Contribution Agent
|
|
3
3
|
*/
|
|
4
4
|
import type { FetchedPRStatus, RepoSignals, TrackedIssue, IssueVettingResult, IssueScope, DiffTool, AgentConfig, AgentState } from './state-schema.js';
|
|
5
|
-
export type { IssueStatus, FetchedPRStatus, ProjectCategory, IssueScope, DiffTool, RepoSignals, RepoScore, StoredMergedPR, StoredClosedPR, AnalyzedIssueConversation, ContributionGuidelines, IssueVettingResult, TrackedIssue, ShelvedPRRef, StatusOverride, AgentConfig, LocalRepoCache, ClosedPR, MergedPR, DailyDigest, AgentState, SearchSeenEntry, OvernightPrepared, OvernightRecord, OvernightImplementAttempt, SearchRotation, } from './state-schema.js';
|
|
5
|
+
export type { IssueStatus, FetchedPRStatus, ProjectCategory, IssueScope, DiffTool, RepoSignals, RepoScore, StoredMergedPR, StoredClosedPR, AnalyzedIssueConversation, ContributionGuidelines, IssueVettingResult, TrackedIssue, ShelvedPRRef, StatusOverride, AgentConfig, LocalRepoCache, ClosedPR, MergedPR, DailyDigest, AgentState, SearchSeenEntry, PickSnapshot, OvernightPrepared, OvernightRecord, OvernightImplementAttempt, SearchRotation, } from './state-schema.js';
|
|
6
6
|
/** CI pipeline status for a PR's latest commit. */
|
|
7
7
|
export type CIStatus = 'passing' | 'failing' | 'pending' | 'unknown';
|
|
8
8
|
/**
|
|
@@ -1575,6 +1575,10 @@ export interface VetListOutput {
|
|
|
1575
1575
|
*/
|
|
1576
1576
|
error?: string;
|
|
1577
1577
|
};
|
|
1578
|
+
/** Set when the vet-time predictions (#1824) could not be saved locally. */
|
|
1579
|
+
pickRecordError?: string;
|
|
1580
|
+
/** Set when the saved predictions could not be pushed to the Gist. */
|
|
1581
|
+
gistSyncWarning?: string;
|
|
1578
1582
|
}
|
|
1579
1583
|
/** Output of the vet command */
|
|
1580
1584
|
export interface VetOutput {
|
|
@@ -1629,6 +1633,10 @@ export interface VetOutput {
|
|
|
1629
1633
|
score: number;
|
|
1630
1634
|
reason: string;
|
|
1631
1635
|
};
|
|
1636
|
+
/** Set when the vet-time prediction (#1824) could not be saved locally. */
|
|
1637
|
+
pickRecordError?: string;
|
|
1638
|
+
/** Set when the saved prediction could not be pushed to the Gist. */
|
|
1639
|
+
gistSyncWarning?: string;
|
|
1632
1640
|
}
|
|
1633
1641
|
/** Output of the comments command */
|
|
1634
1642
|
export interface CommentsOutput {
|