@oss-autopilot/core 3.34.0 → 3.36.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.
Files changed (44) hide show
  1. package/dist/cli-registry.js +24 -1
  2. package/dist/cli.bundle.cjs +136 -125
  3. package/dist/commands/daily.js +5 -2
  4. package/dist/commands/ledger-backfill.js +15 -9
  5. package/dist/commands/repo-cap.d.ts +10 -0
  6. package/dist/commands/repo-cap.js +23 -0
  7. package/dist/commands/scout-bridge.js +8 -2
  8. package/dist/commands/search.js +7 -1
  9. package/dist/commands/setup.js +6 -4
  10. package/dist/commands/vet-list.js +2 -0
  11. package/dist/commands/vet.js +2 -0
  12. package/dist/core/ci-analysis.js +14 -1
  13. package/dist/core/close-reason.d.ts +11 -0
  14. package/dist/core/close-reason.js +29 -1
  15. package/dist/core/comment-utils.d.ts +5 -2
  16. package/dist/core/comment-utils.js +11 -3
  17. package/dist/core/config-registry.js +12 -0
  18. package/dist/core/daily-logic.d.ts +3 -1
  19. package/dist/core/daily-logic.js +11 -3
  20. package/dist/core/eval-report.js +3 -1
  21. package/dist/core/gist-state-store.js +4 -1
  22. package/dist/core/index.d.ts +1 -1
  23. package/dist/core/index.js +1 -1
  24. package/dist/core/pr-assembly.d.ts +11 -1
  25. package/dist/core/pr-assembly.js +21 -4
  26. package/dist/core/pr-attention.d.ts +14 -0
  27. package/dist/core/pr-attention.js +18 -0
  28. package/dist/core/pr-graphql.d.ts +31 -1
  29. package/dist/core/pr-graphql.js +49 -5
  30. package/dist/core/pr-monitor.d.ts +37 -0
  31. package/dist/core/pr-monitor.js +42 -0
  32. package/dist/core/repo-cap.d.ts +46 -0
  33. package/dist/core/repo-cap.js +102 -0
  34. package/dist/core/review-analysis.d.ts +64 -0
  35. package/dist/core/review-analysis.js +92 -1
  36. package/dist/core/state-persistence.js +6 -2
  37. package/dist/core/state-schema.d.ts +285 -87
  38. package/dist/core/state-schema.js +91 -27
  39. package/dist/core/state.js +1 -0
  40. package/dist/core/status-determination.js +11 -11
  41. package/dist/core/types.d.ts +32 -2
  42. package/dist/formatters/json.d.ts +25 -0
  43. package/dist/formatters/json.js +13 -0
  44. package/package.json +1 -1
@@ -6,10 +6,19 @@
6
6
  * re-exported through types.ts.
7
7
  *
8
8
  * Schemas are defined bottom-up (leaf types first, composites last).
9
- * Unknown keys are stripped by default (Zod 4 behavior).
9
+ * Unknown keys are stripped by default (Zod 4 behavior), EXCEPT on the schemas
10
+ * marked `.passthrough()` (#1831): see the note above AgentStateSchema.
10
11
  */
11
12
  import { z } from 'zod';
12
- import { CLOSE_REASONS } from './close-reason.js';
13
+ import { CLOSE_REASONS, SELF_CLOSE_REASONS } from './close-reason.js';
14
+ /**
15
+ * An enum that also accepts values it does not know (#1831): a newer release
16
+ * may add a value, and a strict enum would make this release reject the whole
17
+ * state. Known values keep editor completion; read sites must handle others.
18
+ */
19
+ function openEnum(_values) {
20
+ return z.custom((v) => typeof v === 'string');
21
+ }
13
22
  // ── 1. Enum / union schemas ───────────────────────────────────────────
14
23
  export const IssueStatusSchema = z.enum(['candidate', 'claimed', 'in_progress', 'pr_submitted']);
15
24
  export const FetchedPRStatusSchema = z.enum(['needs_addressing', 'waiting_on_maintainer']);
@@ -29,7 +38,8 @@ export const RepoSignalsSchema = z.object({
29
38
  isResponsive: z.boolean(),
30
39
  hasHostileComments: z.boolean(),
31
40
  });
32
- export const RepoScoreSchema = z.object({
41
+ export const RepoScoreSchema = z
42
+ .object({
33
43
  repo: z.string(),
34
44
  score: z.number(),
35
45
  mergedPRCount: z.number(),
@@ -40,24 +50,27 @@ export const RepoScoreSchema = z.object({
40
50
  signals: RepoSignalsSchema,
41
51
  stargazersCount: z.number().optional(),
42
52
  language: z.string().nullable().optional(),
43
- });
53
+ })
54
+ .passthrough();
44
55
  /**
45
56
  * What the tool predicted about an issue when it was vetted (#1824). Recorded
46
57
  * by `vet` / `vet-list` keyed by issue URL, then copied onto the outcome
47
58
  * ledger entry of the PR that closes that issue, so outcomes can be compared
48
59
  * against the prediction that picked them (calibration).
49
60
  */
50
- export const PickSnapshotSchema = z.object({
61
+ export const PickSnapshotSchema = z
62
+ .object({
51
63
  issueUrl: z.string(),
52
64
  /** Success-likelihood grade (1-10) from issue-grading. */
53
65
  grade: z.number(),
54
66
  recommendation: z.string(),
55
67
  stargazersCount: z.number().optional(),
56
68
  /** `list`: the curated list's `**Tier (N/10)**` score, imported by ledger-backfill. */
57
- source: z.enum(['vet', 'vet-list', 'list']),
69
+ source: openEnum(['vet', 'vet-list', 'list']),
58
70
  /** When the vet ran. Absent for `list` picks: the list does not record vet dates reliably. */
59
71
  capturedAt: z.string().optional(),
60
- });
72
+ })
73
+ .passthrough();
61
74
  /**
62
75
  * Outcome-ledger fields added by #1824, shared by merged and closed entries.
63
76
  * All optional: entries written before #1824 have none of them.
@@ -74,7 +87,8 @@ const LedgerPredictionFields = {
74
87
  /** When ledger-backfill got GitHub's answer for this PR; later runs skip it. */
75
88
  backfilledAt: z.string().optional(),
76
89
  };
77
- export const StoredMergedPRSchema = z.object({
90
+ export const StoredMergedPRSchema = z
91
+ .object({
78
92
  url: z.string(),
79
93
  title: z.string(),
80
94
  mergedAt: z.string(),
@@ -99,8 +113,10 @@ export const StoredMergedPRSchema = z.object({
99
113
  /** When the host last ran LLM extraction over this PR's comment bundle (#867). */
100
114
  learningsExtractedAt: z.string().datetime().optional(),
101
115
  ...LedgerPredictionFields,
102
- });
103
- export const StoredClosedPRSchema = z.object({
116
+ })
117
+ .passthrough();
118
+ export const StoredClosedPRSchema = z
119
+ .object({
104
120
  url: z.string(),
105
121
  title: z.string(),
106
122
  closedAt: z.string(),
@@ -119,8 +135,11 @@ export const StoredClosedPRSchema = z.object({
119
135
  learningsExtractedAt: z.string().datetime().optional(),
120
136
  ...LedgerPredictionFields,
121
137
  /** Why it closed unmerged (#1824), set by ledger-backfill. */
122
- closeReason: z.enum(CLOSE_REASONS).optional(),
123
- });
138
+ closeReason: openEnum(CLOSE_REASONS).optional(),
139
+ /** For `self-closed`: superseded, no traction, after feedback, or no response (#1824). */
140
+ selfCloseReason: openEnum(SELF_CLOSE_REASONS).optional(),
141
+ })
142
+ .passthrough();
124
143
  export const AnalyzedIssueConversationSchema = z.object({
125
144
  url: z.string(),
126
145
  repo: z.string(),
@@ -222,11 +241,21 @@ export const StatusOverrideSchema = z.object({
222
241
  lastActivityAt: z.string(),
223
242
  });
224
243
  // ── 5. Config schema ─────────────────────────────────────────────────
225
- export const AgentConfigSchema = z.object({
244
+ export const AgentConfigSchema = z
245
+ .object({
226
246
  setupComplete: z.boolean().default(false),
227
247
  setupCompletedAt: z.string().optional(),
228
248
  persistence: z.enum(['local', 'gist']).default('local'),
229
249
  maxActivePRs: z.number().default(10),
250
+ /**
251
+ * Per-repo open-PR caps (core/repo-cap.ts). Discovery leaves out a repo
252
+ * once the user has this many open PRs there; the cold cap applies while
253
+ * none of their PRs in the repo have merged (first PRs merge less often).
254
+ * The warm cap is off by default so it never blocks repos that merge.
255
+ * 0 disables either.
256
+ */
257
+ maxOpenPRsPerRepo: z.number().int().min(0).default(0),
258
+ maxOpenPRsColdRepo: z.number().int().min(0).default(1),
230
259
  dormantThresholdDays: z.number().default(30),
231
260
  approachingDormantDays: z.number().default(25),
232
261
  maxIssueAgeDays: z.number().default(90),
@@ -323,7 +352,11 @@ export const AgentConfigSchema = z.object({
323
352
  * local network.
324
353
  */
325
354
  slmTriageHost: z.string().default(''),
326
- });
355
+ })
356
+ // Passthrough (#1831): a newer release's config fields survive this
357
+ // version's load/save. Retired fields must be dropped explicitly instead.
358
+ .passthrough()
359
+ .transform(({ snoozedPRs: _retired, ...config }) => config);
327
360
  // ── 6. Cache schemas ─────────────────────────────────────────────────
328
361
  export const LocalRepoCacheSchema = z.object({
329
362
  repos: z.record(z.string(), z.object({
@@ -450,7 +483,8 @@ export const SearchSeenEntrySchema = z.object({
450
483
  * run; `overnight push-prep` (#1698) may later stage it under `prep/*` on the
451
484
  * user's fork and fills in `pushedRef`, `pushedAt` and `compareUrl`.
452
485
  */
453
- export const OvernightPreparedSchema = z.object({
486
+ export const OvernightPreparedSchema = z
487
+ .object({
454
488
  url: z.string(),
455
489
  branch: z.string(),
456
490
  worktree: z.string().optional(),
@@ -463,20 +497,24 @@ export const OvernightPreparedSchema = z.object({
463
497
  compareUrl: z.string().optional(),
464
498
  /** Why the last `overnight push-prep` did not push this branch; cleared once it is pushed. */
465
499
  pushProblem: z.string().optional(),
466
- });
500
+ })
501
+ .passthrough();
467
502
  /** The latest overnight run (#1574); `startup` surfaces its freshness. */
468
503
  /**
469
504
  * One list issue the overnight run tried to implement (#1715). Kept across
470
505
  * runs so a blocked issue is not retried every night; cleared when the
471
506
  * issue leaves the list.
472
507
  */
473
- export const OvernightImplementAttemptSchema = z.object({
508
+ export const OvernightImplementAttemptSchema = z
509
+ .object({
474
510
  url: z.string(),
475
511
  attemptedAt: z.string(),
476
512
  outcome: z.enum(['prepared', 'blocked']),
477
513
  note: z.string().optional(),
478
- });
479
- export const OvernightRecordSchema = z.object({
514
+ })
515
+ .passthrough();
516
+ export const OvernightRecordSchema = z
517
+ .object({
480
518
  runAt: z.string(),
481
519
  reportPath: z.string(),
482
520
  prepareCount: z.number().int().nonnegative(),
@@ -485,23 +523,38 @@ export const OvernightRecordSchema = z.object({
485
523
  /** The one curated-list issue picked for implementation this run, if any (#1715). */
486
524
  implementUrl: z.string().optional(),
487
525
  implementAttempts: z.array(OvernightImplementAttemptSchema).optional(),
488
- });
526
+ })
527
+ .passthrough();
489
528
  /**
490
529
  * Mirrors oss-scout's `searchRotation`: the broad-phase language cursor, the
491
530
  * repo-window cursors of the capped phases, and the round-robin strategy
492
- * cursor (oss-scout 1.7.0). Every field must be listed: z.object strips
493
- * unknown keys, so a cursor missing here would be dropped on every load and
494
- * scout's rotation would restart from 0 each search.
531
+ * cursor (oss-scout 1.7.0). List every cursor so it gets its default;
532
+ * passthrough (#1831) keeps a cursor added by a newer bundled scout instead of
533
+ * resetting it to 0 on this release's next save.
495
534
  */
496
- export const SearchRotationSchema = z.object({
535
+ export const SearchRotationSchema = z
536
+ .object({
497
537
  languageOffset: z.number().int().nonnegative().default(0),
498
538
  phase0Offset: z.number().int().nonnegative().default(0),
499
539
  starredOffset: z.number().int().nonnegative().default(0),
500
540
  maintainedOffset: z.number().int().nonnegative().default(0),
501
541
  strategyOffset: z.number().int().nonnegative().default(0),
502
542
  lastRotatedAt: z.string().optional(),
503
- });
504
- export const AgentStateSchema = z.object({
543
+ })
544
+ .passthrough();
545
+ /**
546
+ * Forward compatibility (#1831). The state Gist is shared by clients on
547
+ * different releases, and a strict parse let an older client drop a newer
548
+ * release's fields on its next save. Schemas for data that is written once and
549
+ * kept (root, config, repoScores, the outcome ledger and pick snapshots,
550
+ * lastOvernight, searchRotation) are `.passthrough()`; schemas regenerated on
551
+ * every run (lastDigest) or rarely extended still strip. Persisted enums that
552
+ * grow (closeReason, pick source) accept unknown strings via {@link openEnum}.
553
+ * Inferred types drop the passthrough index signature ({@link KnownKeys}) so a
554
+ * misspelled key still fails to compile.
555
+ */
556
+ export const AgentStateSchema = z
557
+ .object({
505
558
  version: z.literal(4),
506
559
  gistId: z.string().optional(),
507
560
  repoScores: z.record(z.string(), RepoScoreSchema).default({}),
@@ -566,4 +619,15 @@ export const AgentStateSchema = z.object({
566
619
  * here and fed into the next scout state. Absent until the first search.
567
620
  */
568
621
  searchRotation: SearchRotationSchema.optional(),
569
- });
622
+ })
623
+ .passthrough();
624
+ /** Top-level state keys this release does not know, i.e. written by another (usually newer) release (#1831). */
625
+ export function unknownStateKeys(raw) {
626
+ if (!raw || typeof raw !== 'object')
627
+ return [];
628
+ const known = new Set(Object.keys(AgentStateSchema.shape));
629
+ return Object.keys(raw).filter((k) => !known.has(k));
630
+ }
631
+ /** Warning tail for state written by a newer release (#1831), shared by the Gist and local loaders. */
632
+ export const NEWER_WRITER_HINT = 'was written by a different oss-autopilot release (usually a newer one); this version keeps those fields ' +
633
+ 'but cannot use them. If you are not on the latest release, update with `claude plugin update oss-autopilot@oss-autopilot` and restart Claude Code.';
@@ -47,6 +47,7 @@ const LEDGER_FIELDS = [
47
47
  'lastCiStatus',
48
48
  'backfilledAt',
49
49
  'closeReason',
50
+ 'selfCloseReason',
50
51
  ];
51
52
  /**
52
53
  * Fill outcome-ledger fields (#1461, #1824) missing on an existing stored PR
@@ -108,9 +108,14 @@ function isChangesAddressedByCommit(commitDate, changesRequestedDate) {
108
108
  /**
109
109
  * Collect all applicable action reasons independently, without short-circuiting (#675).
110
110
  * Used alongside the priority-based decision tree to surface secondary issues.
111
+ *
112
+ * `hasIncompleteChecklist` is deliberately NOT an action reason: the
113
+ * draft-first workflow tells the agent to leave template boxes unchecked, and
114
+ * many boxes are N/A or honor-system, so it is shown as a note on the PR's
115
+ * display description instead of counting as needs_addressing.
111
116
  */
112
117
  function collectAllActionReasons(input) {
113
- const { ciStatus, hasMergeConflict, hasUnrespondedComment, hasIncompleteChecklist, reviewDecision, lastMaintainerCommentDate, latestChangesRequestedDate, hasActionableCIFailure = true, } = input;
118
+ const { ciStatus, hasMergeConflict, hasUnrespondedComment, reviewDecision, lastMaintainerCommentDate, latestChangesRequestedDate, hasActionableCIFailure = true, } = input;
114
119
  const commitDate = resolveContributorCommitDate(input);
115
120
  const reasons = [];
116
121
  // An unresponded maintainer comment on an already-approved, passing/unknown
@@ -133,9 +138,6 @@ function collectAllActionReasons(input) {
133
138
  if (hasMergeConflict) {
134
139
  reasons.push('merge_conflict');
135
140
  }
136
- if (hasIncompleteChecklist) {
137
- reasons.push('incomplete_checklist');
138
- }
139
141
  return reasons.length > 0 ? reasons : undefined;
140
142
  }
141
143
  /**
@@ -164,12 +166,13 @@ export function determineStatus(input) {
164
166
  * this with the full `actionReasons` array.
165
167
  */
166
168
  function determinePrimaryStatus(input) {
167
- const { ciStatus, hasMergeConflict, hasUnrespondedComment, hasIncompleteChecklist, reviewDecision, daysSinceActivity, dormantThreshold, approachingThreshold, lastMaintainerCommentDate, latestChangesRequestedDate, hasActionableCIFailure = true, } = input;
168
- // Compute staleness tier (independent of status)
169
+ const { ciStatus, hasMergeConflict, hasUnrespondedComment, reviewDecision, daysSinceActivity, daysSinceMaintainerActivity = daysSinceActivity, dormantThreshold, approachingThreshold, lastMaintainerCommentDate, latestChangesRequestedDate, hasActionableCIFailure = true, } = input;
170
+ // Compute staleness tier (independent of status) from the maintainer-side
171
+ // clock, so the contributor's own pings don't keep an ignored PR active.
169
172
  let stalenessTier = 'active';
170
- if (daysSinceActivity >= dormantThreshold)
173
+ if (daysSinceMaintainerActivity >= dormantThreshold)
171
174
  stalenessTier = 'dormant';
172
- else if (daysSinceActivity >= approachingThreshold)
175
+ else if (daysSinceMaintainerActivity >= approachingThreshold)
173
176
  stalenessTier = 'approaching_dormant';
174
177
  const commitDate = resolveContributorCommitDate(input);
175
178
  // Priority order: needs_addressing (response/changes/ci/conflict/checklist) > waiting_on_maintainer (review/merge/addressed/ci_blocked)
@@ -214,9 +217,6 @@ function determinePrimaryStatus(input) {
214
217
  if (hasMergeConflict) {
215
218
  return { status: 'needs_addressing', actionReason: 'merge_conflict', stalenessTier };
216
219
  }
217
- if (hasIncompleteChecklist) {
218
- return { status: 'needs_addressing', actionReason: 'incomplete_checklist', stalenessTier };
219
- }
220
220
  // Approved and CI passing/unknown = waiting on maintainer to merge
221
221
  if (reviewDecision === 'approved' && (ciStatus === 'passing' || ciStatus === 'unknown')) {
222
222
  return { status: 'waiting_on_maintainer', waitReason: 'pending_merge', stalenessTier };
@@ -83,6 +83,12 @@ export interface DetermineStatusInput {
83
83
  hasIncompleteChecklist: boolean;
84
84
  reviewDecision: ReviewDecision;
85
85
  daysSinceActivity: number;
86
+ /**
87
+ * Days since the last activity by someone other than the contributor and
88
+ * not a bot (or since PR creation). Drives `stalenessTier`. Falls back to
89
+ * `daysSinceActivity` when omitted.
90
+ */
91
+ daysSinceMaintainerActivity?: number;
86
92
  dormantThreshold: number;
87
93
  approachingThreshold: number;
88
94
  latestCommitDate?: string;
@@ -142,7 +148,7 @@ export interface FetchedPR {
142
148
  waitReason?: WaitReason;
143
149
  /** All applicable action reasons, ordered by priority. Primary reason is first. */
144
150
  actionReasons?: ActionReason[];
145
- /** How stale the PR is based on activity age. Independent of status — a PR can be both needs_addressing and dormant. */
151
+ /** How stale the PR is, from `daysSinceMaintainerActivity` (not the contributor's own activity). Independent of status — a PR can be both needs_addressing and dormant. */
146
152
  stalenessTier: StalenessTier;
147
153
  /** Unified attention bucket (#1352), computed by `classifyAttentionBucket()`
148
154
  * from status/ciStatus/reviewDecision/daysSinceActivity. Stamped by the
@@ -163,8 +169,32 @@ export interface FetchedPR {
163
169
  * open set. Undefined when no maintainer has responded yet.
164
170
  */
165
171
  firstMaintainerResponseAt?: string;
166
- /** Calendar days since the most recent activity (comment, commit, review). */
172
+ /**
173
+ * Calendar days since the most recent activity of any kind (`updatedAt`),
174
+ * including the contributor's own comments, pushes and rebases. Used for
175
+ * follow-up timing (don't nudge right after a ping) and stale-CI demotion.
176
+ * NOT used for `stalenessTier`; see `daysSinceMaintainerActivity`.
177
+ */
167
178
  daysSinceActivity: number;
179
+ /**
180
+ * Timestamp of the latest maintainer activity, or `createdAt` when there is
181
+ * none (see `getLastMaintainerActivity`). Maintainer activity is: an issue
182
+ * comment by an OWNER / MEMBER / COLLABORATOR (any non-contributor non-bot
183
+ * author when the association is unknown); a review or inline review
184
+ * comment by any non-contributor non-bot user; a commit or force-push by
185
+ * someone else, including a maintainer's GitHub App but not auto-fixer or
186
+ * dependency bots; a review request or label by a non-contributor non-bot.
187
+ * Optional: absent on payloads from older producers.
188
+ */
189
+ lastMaintainerActivityAt?: string;
190
+ /**
191
+ * Calendar days since `lastMaintainerActivityAt`. This is the dormancy
192
+ * clock: `stalenessTier` is computed from it, so the contributor's own
193
+ * pings and rebases no longer keep an ignored PR "active".
194
+ */
195
+ daysSinceMaintainerActivity?: number;
196
+ /** Contributor issue comments posted after `lastMaintainerActivityAt` (unanswered pings). */
197
+ authorPingsSinceMaintainerActivity?: number;
168
198
  ciStatus: CIStatus;
169
199
  /** Names of failing CI checks. Useful for distinguishing real CI failures from validation bots. */
170
200
  failingCheckNames: string[];
@@ -6,6 +6,7 @@ import { z, type ZodType } from 'zod';
6
6
  import type { AttentionSummary } from '../core/pr-attention.js';
7
7
  import type { FetchedPR, DailyDigest, AgentState, RepoGroup, CommentedIssue, ShelvedPRRef, SearchPriority, CapacityAssessment, ActionableIssue, CompactActionableIssue, ActionMenu } from '../core/types.js';
8
8
  import type { ContributionStats } from '../core/stats.js';
9
+ import type { RepoCapStatus } from '../core/repo-cap.js';
9
10
  import type { PRCheckFailure } from '../core/pr-monitor.js';
10
11
  import type { CIFormatterDiagnosis, FormatterDetectionResult } from '../core/formatter-detection.js';
11
12
  import type { IssueAvailabilityVerdict, IssueVerification, VerifiedLinkedPR } from '../core/issue-verification.js';
@@ -674,6 +675,21 @@ export declare const CompactDailyOutputSchema: z.ZodObject<{
674
675
  prCount: z.ZodNumber;
675
676
  }, z.core.$strip>>;
676
677
  }, z.core.$strip>;
678
+ /** Per-repo open-PR cap status (core/repo-cap.ts). */
679
+ export declare const RepoCapStatusSchema: z.ZodObject<{
680
+ repo: z.ZodString;
681
+ openPRCount: z.ZodNumber;
682
+ countSource: z.ZodEnum<{
683
+ digest: "digest";
684
+ github: "github";
685
+ }>;
686
+ mergedPRCount: z.ZodNumber;
687
+ cold: z.ZodBoolean;
688
+ cap: z.ZodNumber;
689
+ atCap: z.ZodBoolean;
690
+ excluded: z.ZodBoolean;
691
+ reason: z.ZodOptional<z.ZodString>;
692
+ }, z.core.$strip>;
677
693
  export declare const SearchOutputSchema: z.ZodObject<{
678
694
  candidates: z.ZodArray<z.ZodObject<{
679
695
  issue: z.ZodObject<{
@@ -727,6 +743,7 @@ export declare const SearchOutputSchema: z.ZodObject<{
727
743
  excludedRepos: z.ZodArray<z.ZodString>;
728
744
  aiPolicyBlocklist: z.ZodArray<z.ZodString>;
729
745
  hiddenOwnPRCount: z.ZodNumber;
746
+ reposAtCap: z.ZodArray<z.ZodString>;
730
747
  rateLimitWarning: z.ZodOptional<z.ZodString>;
731
748
  skipListUnavailable: z.ZodOptional<z.ZodBoolean>;
732
749
  }, z.core.$strip>;
@@ -1355,6 +1372,9 @@ export interface SearchOutput {
1355
1372
  /** Candidates dropped because the authenticated user already has an open PR
1356
1373
  * linked to the issue (#1354). Surfaced as a count so the filter is visible. */
1357
1374
  hiddenOwnPRCount: number;
1375
+ /** Repos left out of discovery because they are at the per-repo open-PR
1376
+ * cap (`maxOpenPRsColdRepo` / `maxOpenPRsPerRepo`); empty when none. */
1377
+ reposAtCap: string[];
1358
1378
  /** Set when the seen-set write could not be pushed to the Gist (#1629);
1359
1379
  * the local cache has it but the next startup's Gist refetch will drop it. */
1360
1380
  gistSyncWarning?: string;
@@ -1633,6 +1653,11 @@ export interface VetOutput {
1633
1653
  score: number;
1634
1654
  reason: string;
1635
1655
  };
1656
+ /**
1657
+ * Present only when the issue's repo is at the per-repo open-PR cap or is
1658
+ * in `excludeRepos`; `reason` says which.
1659
+ */
1660
+ repoCap?: RepoCapStatus;
1636
1661
  /** Set when the vet-time prediction (#1824) could not be saved locally. */
1637
1662
  pickRecordError?: string;
1638
1663
  /** Set when the saved prediction could not be pushed to the Gist. */
@@ -388,11 +388,24 @@ const SearchCandidateSchema = z.object({
388
388
  * the user can see the counterweight working, not just its absence. */
389
389
  diversitySlot: z.boolean().optional(),
390
390
  });
391
+ /** Per-repo open-PR cap status (core/repo-cap.ts). */
392
+ export const RepoCapStatusSchema = z.object({
393
+ repo: z.string(),
394
+ openPRCount: z.number().int().nonnegative(),
395
+ countSource: z.enum(['digest', 'github']),
396
+ mergedPRCount: z.number().int().nonnegative(),
397
+ cold: z.boolean(),
398
+ cap: z.number().int().nonnegative(),
399
+ atCap: z.boolean(),
400
+ excluded: z.boolean(),
401
+ reason: z.string().optional(),
402
+ });
391
403
  export const SearchOutputSchema = z.object({
392
404
  candidates: z.array(SearchCandidateSchema),
393
405
  excludedRepos: z.array(z.string()),
394
406
  aiPolicyBlocklist: z.array(z.string()),
395
407
  hiddenOwnPRCount: z.number().int().nonnegative(),
408
+ reposAtCap: z.array(z.string()),
396
409
  rateLimitWarning: z.string().optional(),
397
410
  // Skip file unreadable — search ran with an empty skip list (#1448).
398
411
  // Optional: absent on clean runs.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oss-autopilot/core",
3
- "version": "3.34.0",
3
+ "version": "3.36.0",
4
4
  "description": "CLI and core library for managing open source contributions",
5
5
  "type": "module",
6
6
  "bin": {