@oss-autopilot/core 3.23.0 → 3.24.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.
@@ -8,7 +8,7 @@
8
8
  */
9
9
  import { type AttentionSummary, type DailyDigest, type CommentedIssue, type PRCheckFailure, type RepoGroup } from '../core/index.js';
10
10
  import { type StrategyResult } from '../core/strategy.js';
11
- import { type DailyOutput, type DailyWarning, type CapacityAssessment, type ActionableIssue, type ActionMenu, type MergedPRListUpdate } from '../formatters/json.js';
11
+ import { type DailyOutput, type DailyWarning, type CapacityAssessment, type ActionableIssue, type ActionMenu, type MergedPRListUpdate, type PendingLearnings } from '../formatters/json.js';
12
12
  export { applyStatusOverrides, computeRepoSignals, groupPRsByRepo, assessCapacity, collectActionableIssues, computeActionMenu, toShelvedPRRef, formatBriefSummary, formatSummary, printDigest, CRITICAL_STATUSES, } from '../core/index.js';
13
13
  import { buildStarFilter } from '../core/daily-logic.js';
14
14
  export { buildStarFilter };
@@ -44,6 +44,13 @@ export interface DailyCheckResult {
44
44
  * omit it so serialized output (and contract goldens) stay unchanged.
45
45
  */
46
46
  listUpdates?: MergedPRListUpdate[];
47
+ /**
48
+ * Recently merged PRs whose learnings the host should extract now, without
49
+ * asking (#1696). Set only when `config.autoExtractLearnings` is on, Gist
50
+ * persistence is available, and at least one such PR exists; otherwise
51
+ * absent, so goldens and merge-free runs are unchanged.
52
+ */
53
+ pendingLearnings?: PendingLearnings;
47
54
  }
48
55
  /**
49
56
  * Convert a full DailyCheckResult to the compact DailyOutput for JSON serialization (#287).
@@ -6,7 +6,7 @@
6
6
  * Domain logic lives in src/core/daily-logic.ts; this file is a thin
7
7
  * orchestration layer that wires up the phases and handles I/O.
8
8
  */
9
- import { getStateManager, PRMonitor, IssueConversationMonitor, requireGitHubToken, renderGistWarning, CRITICAL_STATUSES, applyStatusOverrides, computeRepoSignals, groupPRsByRepo, assessCapacity, collectActionableIssues, computeActionMenu, toShelvedPRRef, formatBriefSummary, formatSummary, summarizeAttentionBuckets, } from '../core/index.js';
9
+ import { getStateManager, parseGitHubUrl, PRMonitor, IssueConversationMonitor, requireGitHubToken, renderGistWarning, CRITICAL_STATUSES, applyStatusOverrides, computeRepoSignals, groupPRsByRepo, assessCapacity, collectActionableIssues, computeActionMenu, toShelvedPRRef, formatBriefSummary, formatSummary, summarizeAttentionBuckets, } from '../core/index.js';
10
10
  import { errorMessage, isRateLimitOrAuthError } from '../core/errors.js';
11
11
  import { wrapUntrustedContent } from '../core/untrusted-content.js';
12
12
  import { computeStrategy, shouldComputeStrategy } from '../core/strategy.js';
@@ -550,6 +550,7 @@ export function toDailyOutput(result) {
550
550
  // Conditional spread (not a plain assignment) so merge-free runs carry
551
551
  // no `listUpdates` key at all — serialized output and goldens unchanged.
552
552
  ...(result.listUpdates ? { listUpdates: result.listUpdates } : {}),
553
+ ...(result.pendingLearnings ? { pendingLearnings: result.pendingLearnings } : {}),
553
554
  };
554
555
  }
555
556
  /**
@@ -667,10 +668,36 @@ async function executeDailyCheckInternal(token) {
667
668
  // nudge: it stays up for the whole recently-merged window (7 days) until
668
669
  // the user runs the extraction, then self-clears.
669
670
  let unextractedMergeCount = 0;
671
+ let pendingLearnings;
670
672
  try {
671
- const ledger = getStateManager().getState().mergedPRs ?? [];
673
+ const sm = getStateManager();
674
+ const ledger = sm.getState().mergedPRs ?? [];
672
675
  const recentUrls = new Set(recentlyMergedPRs.map((pr) => pr.url));
673
- unextractedMergeCount = ledger.filter((pr) => recentUrls.has(pr.url) && !pr.learningsExtractedAt).length;
676
+ const unextracted = ledger.filter((pr) => recentUrls.has(pr.url) && !pr.learningsExtractedAt);
677
+ unextractedMergeCount = unextracted.length;
678
+ // Auto mode (#1696): hand the repos to the host for a background
679
+ // extraction instead of a menu item. Guidelines live in the Gist, so
680
+ // local-only persistence gets one warning per run and no menu item —
681
+ // the manual path would only tell the user the same thing.
682
+ if (unextractedMergeCount > 0 && sm.getState().config.autoExtractLearnings) {
683
+ unextractedMergeCount = 0;
684
+ if (sm.isGistMode()) {
685
+ const repos = new Set();
686
+ for (const pr of unextracted) {
687
+ const parsed = parseGitHubUrl(pr.url);
688
+ if (parsed)
689
+ repos.add(`${parsed.owner}/${parsed.repo}`);
690
+ }
691
+ pendingLearnings = { repos: [...repos].sort(), prCount: unextracted.length };
692
+ }
693
+ else {
694
+ warnings.push({
695
+ phase: 'merge-loop',
696
+ operation: 'auto-extract learnings',
697
+ message: `${unextracted.length} recently merged PR(s) have unextracted learnings; per-repo guidelines need Gist persistence (run setup to enable Gist sync, or set autoExtractLearnings=false to hide this)`,
698
+ });
699
+ }
700
+ }
674
701
  }
675
702
  catch (error) {
676
703
  recordWarning(warnings, 'merge-loop', 'count unextracted merged PRs', error);
@@ -693,6 +720,9 @@ async function executeDailyCheckInternal(token) {
693
720
  if (listUpdates) {
694
721
  result.listUpdates = listUpdates;
695
722
  }
723
+ if (pendingLearnings) {
724
+ result.pendingLearnings = pendingLearnings;
725
+ }
696
726
  // Checkpoint: push state to Gist if in Gist mode.
697
727
  // If getStateManagerAsync was not called before this command ran,
698
728
  // isGistMode() will be false and checkpoint is correctly skipped.
@@ -14,7 +14,7 @@
14
14
  */
15
15
  import { buildCandidateLinkedPR, createAutopilotScout } from './scout-bridge.js';
16
16
  import { getStateManager } from '../core/index.js';
17
- import { gradeFromCandidate } from '../core/issue-grading.js';
17
+ import { gradeFromCandidate, reconcileRecommendation } from '../core/issue-grading.js';
18
18
  import { warn } from '../core/logger.js';
19
19
  const MODULE = 'features';
20
20
  /**
@@ -43,19 +43,13 @@ function sanitizeViabilityScore(raw) {
43
43
  */
44
44
  function toFeaturesCandidate(scoutCandidate, getState) {
45
45
  const repoScoreRecord = getState.getRepoScore(scoutCandidate.issue.repo);
46
- // Same `checkFailed: true` sentinel `runSearch` uses — scout's `features`
47
- // pipeline reuses the same vetting code that does emit projectHealth on
48
- // `vetIssue`, but on this surface scout returns the multi-issue list view
49
- // which today does not propagate per-candidate health into IssueCandidate.
50
- // Treating health as unknown grades from the autopilot-tracked repoScore
51
- // alone, falling to 'F' for unfamiliar repos — an honest "we haven't seen
52
- // this repo" rather than a fabricated score.
46
+ // Grade from the health scout fetched while vetting (#332); see runSearch.
53
47
  const grade = gradeFromCandidate({
54
48
  repo: scoutCandidate.issue.repo,
55
- projectHealth: {
49
+ projectHealth: scoutCandidate.projectHealth ?? {
56
50
  repo: scoutCandidate.issue.repo,
57
51
  checkFailed: true,
58
- failureReason: 'health not fetched on the multi-issue feature surface',
52
+ failureReason: 'health not supplied by the caller',
59
53
  },
60
54
  getRepoScore: (repo) => {
61
55
  const score = getState.getRepoScore(repo);
@@ -78,7 +72,7 @@ function toFeaturesCandidate(scoutCandidate, getState) {
78
72
  url: scoutCandidate.issue.url,
79
73
  labels: scoutCandidate.issue.labels,
80
74
  },
81
- recommendation: scoutCandidate.recommendation,
75
+ recommendation: reconcileRecommendation(scoutCandidate.recommendation, grade),
82
76
  reasonsToApprove: scoutCandidate.reasonsToApprove,
83
77
  reasonsToSkip: scoutCandidate.reasonsToSkip,
84
78
  searchPriority: scoutCandidate.searchPriority,
@@ -24,6 +24,13 @@ export interface GuidelinesStoreOutput {
24
24
  /** Set when the post-mutation Gist checkpoint failed; the local mutation succeeded (#1370). */
25
25
  gistSyncWarning?: string;
26
26
  }
27
+ export interface MarkExtractedOutput {
28
+ repo: string;
29
+ /** PRs stamped `learningsExtractedAt` this call. */
30
+ marked: number;
31
+ /** Set when the post-mutation Gist checkpoint failed; the local mutation succeeded (#1370). */
32
+ gistSyncWarning?: string;
33
+ }
27
34
  export interface GuidelinesResetOutput {
28
35
  repo: string;
29
36
  /** True when an existing file was tombstoned, false when no file existed. */
@@ -83,6 +90,14 @@ export declare function runGuidelinesList(): Promise<GuidelinesListOutput>;
83
90
  * outputJson error envelope to surface that to the host cleanly.
84
91
  */
85
92
  export declare function runGuidelinesStore(options: StoreOptions): Promise<GuidelinesStoreOutput>;
93
+ /**
94
+ * Stamp `learningsExtractedAt` on every merged/closed PR of `repo` whose
95
+ * comment bundle was fetched (`commentsFetchedAt` set) but not yet marked
96
+ * extracted (#1696). The host calls this after storing guidelines, or after
97
+ * deciding a corpus carried no signal, so `daily` stops reporting those PRs
98
+ * as unextracted. Idempotent: already-stamped PRs are left alone.
99
+ */
100
+ export declare function runMarkExtracted(options: RepoOption): Promise<MarkExtractedOutput>;
86
101
  /** Tombstone the guidelines file for `repo`. */
87
102
  export declare function runGuidelinesReset(options: RepoOption): Promise<GuidelinesResetOutput>;
88
103
  /**
@@ -80,6 +80,28 @@ export async function runGuidelinesStore(options) {
80
80
  ...(gistSyncWarning ? { gistSyncWarning } : {}),
81
81
  };
82
82
  }
83
+ /**
84
+ * Stamp `learningsExtractedAt` on every merged/closed PR of `repo` whose
85
+ * comment bundle was fetched (`commentsFetchedAt` set) but not yet marked
86
+ * extracted (#1696). The host calls this after storing guidelines, or after
87
+ * deciding a corpus carried no signal, so `daily` stops reporting those PRs
88
+ * as unextracted. Idempotent: already-stamped PRs are left alone.
89
+ */
90
+ export async function runMarkExtracted(options) {
91
+ validateRepo(options.repo);
92
+ const sm = getStateManager();
93
+ const repoUrlPrefix = `https://github.com/${options.repo}/`;
94
+ const now = new Date().toISOString();
95
+ let marked = 0;
96
+ for (const pr of [...(sm.getMergedPRs() ?? []), ...(sm.getClosedPRs() ?? [])]) {
97
+ if (!pr.url.startsWith(repoUrlPrefix) || !pr.commentsFetchedAt || pr.learningsExtractedAt)
98
+ continue;
99
+ sm.markPRLearningsExtracted(pr.url, now);
100
+ marked++;
101
+ }
102
+ const gistSyncWarning = marked > 0 ? await maybeCheckpoint(sm, MODULE) : null;
103
+ return { repo: options.repo, marked, ...(gistSyncWarning ? { gistSyncWarning } : {}) };
104
+ }
83
105
  /** Tombstone the guidelines file for `repo`. */
84
106
  export async function runGuidelinesReset(options) {
85
107
  validateRepo(options.repo);
@@ -20,7 +20,7 @@
20
20
  */
21
21
  import type { PRCheckFailure } from '../core/pr-monitor.js';
22
22
  import type { ActionableIssueType, OvernightPrepared } from '../core/types.js';
23
- import type { DailyOutput, DailyWarning } from '../formatters/json.js';
23
+ import type { DailyOutput, DailyWarning, PendingLearnings } from '../formatters/json.js';
24
24
  import type { AttentionSummary } from '../core/pr-attention.js';
25
25
  /** One item in either bucket; which bucket is the array it lives in. */
26
26
  export interface OvernightItem {
@@ -44,6 +44,8 @@ export interface OvernightOutput {
44
44
  carriedPrepared: number;
45
45
  /** Set when the run could not be pushed to the Gist; the local cache has it. */
46
46
  gistSyncWarning?: string;
47
+ /** Repos whose merged-PR learnings the overnight run should extract (#1696); absent when none. */
48
+ pendingLearnings?: PendingLearnings;
47
49
  }
48
50
  type ReportBody = Pick<OvernightOutput, 'runAt' | 'prepare' | 'judgment' | 'attention' | 'failures' | 'warnings'>;
49
51
  /** Freshness block `startup` surfaces (#1574). */
@@ -158,7 +158,13 @@ export async function runOvernight() {
158
158
  // executeDailyCheck already checkpointed the Gist; this write came after it,
159
159
  // and in Gist mode setLastOvernight only reaches the local cache (#1629 class).
160
160
  const gistSyncWarning = await maybeCheckpoint(sm, MODULE);
161
- return { ...body, reportPath, carriedPrepared: carried.length, ...(gistSyncWarning ? { gistSyncWarning } : {}) };
161
+ return {
162
+ ...body,
163
+ reportPath,
164
+ carriedPrepared: carried.length,
165
+ ...(gistSyncWarning ? { gistSyncWarning } : {}),
166
+ ...(daily.pendingLearnings ? { pendingLearnings: daily.pendingLearnings } : {}),
167
+ };
162
168
  }
163
169
  /** Append one prepared branch to state and to the report of the latest run. */
164
170
  export async function runOvernightRecord(options) {
@@ -5,7 +5,7 @@
5
5
  import { adaptScoutLinkedPR, buildCandidateLinkedPR, createAutopilotScout, SEARCH_DIVERSITY_RATIO, } from './scout-bridge.js';
6
6
  import { SearchStrategySchema } from '@oss-scout/core';
7
7
  import { classifyLinkedPR, getStateManager, maybeCheckpoint } from '../core/index.js';
8
- import { gradeFromCandidate } from '../core/issue-grading.js';
8
+ import { gradeFromCandidate, reconcileRecommendation } from '../core/issue-grading.js';
9
9
  import { computeStrategy } from '../core/strategy.js';
10
10
  import { refreshStarredReposIfStale } from '../core/starred-repos.js';
11
11
  import { debug, warn } from '../core/logger.js';
@@ -210,23 +210,19 @@ export async function runSearch(options) {
210
210
  const searchOutput = {
211
211
  candidates: visibleCandidates.map((c) => {
212
212
  const repoScoreRecord = stateManager.getRepoScore(c.issue.repo);
213
- // Scout's `search` does not emit per-candidate projectHealth (only
214
- // `vetIssue` does). Pass a sentinel `checkFailed: true` so the grader
215
- // correctly treats scout-side signals as unknown and grades purely from
216
- // the autopilot-tracked repoScore. Candidates without a repoScore
217
- // receive 'F' — that's an honest signal for "we haven't seen this repo
218
- // before" rather than a fabricated score.
219
- //
220
- // Note (#1465): repoScore here is the cached HISTORY score (the user's
221
- // own merge outcomes — docs/repo-scores.md §History score), so this
222
- // grade reflects history only; `vet` later re-grades the same issue
223
- // with freshly fetched repo health and can legitimately disagree.
213
+ // Grade from the health scout fetched while vetting this candidate
214
+ // (#332). Search used to pass a `checkFailed` sentinel and grade from
215
+ // the user's own history alone, so every repo without a merged PR of
216
+ // ours scored the bottom band regardless of how healthy it was, and a
217
+ // grade-1 "approve" looked like a contradiction. `repoScore` is still
218
+ // the cached HISTORY score (#1465); `vet` re-grades with fresh health.
219
+ // Scout always supplies health; the fallback only serves bare fixtures.
224
220
  const grade = gradeFromCandidate({
225
221
  repo: c.issue.repo,
226
- projectHealth: {
222
+ projectHealth: c.projectHealth ?? {
227
223
  repo: c.issue.repo,
228
224
  checkFailed: true,
229
- failureReason: 'health not fetched on the multi-issue search surface',
225
+ failureReason: 'health not supplied by the caller',
230
226
  },
231
227
  getRepoScore: (repo) => {
232
228
  const score = stateManager.getRepoScore(repo);
@@ -249,7 +245,7 @@ export async function runSearch(options) {
249
245
  url: c.issue.url,
250
246
  labels: c.issue.labels,
251
247
  },
252
- recommendation: c.recommendation,
248
+ recommendation: reconcileRecommendation(c.recommendation, grade),
253
249
  reasonsToApprove: c.reasonsToApprove,
254
250
  reasonsToSkip: c.reasonsToSkip,
255
251
  searchPriority: c.searchPriority,
@@ -133,6 +133,15 @@ export async function runSetup(options) {
133
133
  results[key] = value || '(cleared)';
134
134
  break;
135
135
  }
136
+ case 'autoExtractLearnings': {
137
+ if (value !== 'true' && value !== 'false') {
138
+ throw new ValidationError(`Invalid value for autoExtractLearnings: "${value}". Must be "true" or "false".`);
139
+ }
140
+ const enabled = value === 'true';
141
+ stateManager.updateConfig({ autoExtractLearnings: enabled });
142
+ results[key] = String(enabled);
143
+ break;
144
+ }
136
145
  case 'autoFormatBeforePush': {
137
146
  if (value !== 'true' && value !== 'false') {
138
147
  throw new ValidationError(`Invalid value for autoFormatBeforePush: "${value}". Must be "true" or "false".`);
@@ -227,6 +227,12 @@ export const CONFIG_KEY_REGISTRY = [
227
227
  settableVia: 'setup',
228
228
  valueHint: 'one of: local,gist',
229
229
  },
230
+ {
231
+ key: 'autoExtractLearnings',
232
+ description: 'Extract per-repo learnings from freshly merged PRs automatically at /oss startup and overnight (#1696). false restores the extract_learnings action-menu item.',
233
+ settableVia: 'setup',
234
+ valueHint: 'true|false',
235
+ },
230
236
  {
231
237
  key: 'autoFormatBeforePush',
232
238
  description: 'No effect. The hook that used this setting was removed in #1642; the key is kept in the schema for state-file compatibility.',
@@ -41,11 +41,11 @@ export declare const KEEP_GRADE_THRESHOLD = 4;
41
41
  * sees can't flatly contradict. Any non-approve recommendation is returned
42
42
  * unchanged.
43
43
  *
44
- * Apply this ONLY where the grade is high-fidelity — i.e. computed from freshly
45
- * fetched health (the `vet` / `vet-list` surfaces). The `search` and `features`
46
- * surfaces pass a `checkFailed` health sentinel and grade from history alone, so
47
- * any repo we lack history with scores the bottom band for missing data, not for
48
- * being bad; reconciling there would wrongly downgrade well-vetted candidates.
44
+ * Every surface grades from the health scout fetched while vetting (`search`
45
+ * and `features` included since #332), so the grade is high-fidelity
46
+ * everywhere and this applies everywhere. A `checkFailed` health (transient API
47
+ * error) still grades the bottom band for missing data; that downgrade to
48
+ * "needs_review" is the honest answer for an unverified repo.
49
49
  */
50
50
  export declare function reconcileRecommendation(recommendation: IssueRecommendation, grade: GradeResult): IssueRecommendation;
51
51
  /**
@@ -94,11 +94,9 @@ export declare function deriveGradeSignals(params: {
94
94
  * Which "repo score" this grades from (#1465): the `getRepoScore` input is
95
95
  * the cached HISTORY record (the user's own merge outcomes, see
96
96
  * docs/repo-scores.md §History score) — NOT `repo-vet`'s fresh health
97
- * rubric. The fresh side only enters through `projectHealth`, and only when
98
- * scout actually fetched it: the `search` surface passes a `checkFailed`
99
- * sentinel (health not fetched per candidate), so search grades purely from
100
- * history-side signals, while `vet` re-grades with fresh health. Same 1-10
101
- * scale, different inputs — the two surfaces can legitimately disagree.
97
+ * rubric. The fresh side enters through `projectHealth`, which scout fetches
98
+ * per candidate on every surface (#332); `vet` re-fetches it later, so the
99
+ * two surfaces can still disagree when the repo changed in between.
102
100
  */
103
101
  export declare function gradeFromCandidate(params: {
104
102
  repo: string;
@@ -24,11 +24,11 @@ export const KEEP_GRADE_THRESHOLD = 4;
24
24
  * sees can't flatly contradict. Any non-approve recommendation is returned
25
25
  * unchanged.
26
26
  *
27
- * Apply this ONLY where the grade is high-fidelity — i.e. computed from freshly
28
- * fetched health (the `vet` / `vet-list` surfaces). The `search` and `features`
29
- * surfaces pass a `checkFailed` health sentinel and grade from history alone, so
30
- * any repo we lack history with scores the bottom band for missing data, not for
31
- * being bad; reconciling there would wrongly downgrade well-vetted candidates.
27
+ * Every surface grades from the health scout fetched while vetting (`search`
28
+ * and `features` included since #332), so the grade is high-fidelity
29
+ * everywhere and this applies everywhere. A `checkFailed` health (transient API
30
+ * error) still grades the bottom band for missing data; that downgrade to
31
+ * "needs_review" is the honest answer for an unverified repo.
32
32
  */
33
33
  export function reconcileRecommendation(recommendation, grade) {
34
34
  return recommendation === 'approve' && grade.score < KEEP_GRADE_THRESHOLD ? 'needs_review' : recommendation;
@@ -135,11 +135,9 @@ export function deriveGradeSignals(params) {
135
135
  * Which "repo score" this grades from (#1465): the `getRepoScore` input is
136
136
  * the cached HISTORY record (the user's own merge outcomes, see
137
137
  * docs/repo-scores.md §History score) — NOT `repo-vet`'s fresh health
138
- * rubric. The fresh side only enters through `projectHealth`, and only when
139
- * scout actually fetched it: the `search` surface passes a `checkFailed`
140
- * sentinel (health not fetched per candidate), so search grades purely from
141
- * history-side signals, while `vet` re-grades with fresh health. Same 1-10
142
- * scale, different inputs — the two surfaces can legitimately disagree.
138
+ * rubric. The fresh side enters through `projectHealth`, which scout fetches
139
+ * per candidate on every surface (#332); `vet` re-fetches it later, so the
140
+ * two surfaces can still disagree when the repo changed in between.
143
141
  */
144
142
  export function gradeFromCandidate(params) {
145
143
  const repoScore = params.getRepoScore(params.repo);
@@ -297,6 +297,7 @@ export declare const AgentConfigSchema: z.ZodObject<{
297
297
  vscode: "vscode";
298
298
  }>>;
299
299
  diffToolCustomCommand: z.ZodOptional<z.ZodString>;
300
+ autoExtractLearnings: z.ZodDefault<z.ZodBoolean>;
300
301
  autoFormatBeforePush: z.ZodDefault<z.ZodBoolean>;
301
302
  trustOwnRepoWrites: z.ZodDefault<z.ZodBoolean>;
302
303
  healthCheckFreshnessMinutes: z.ZodDefault<z.ZodNumber>;
@@ -548,6 +549,7 @@ export declare const AgentStateSchema: z.ZodObject<{
548
549
  vscode: "vscode";
549
550
  }>>;
550
551
  diffToolCustomCommand: z.ZodOptional<z.ZodString>;
552
+ autoExtractLearnings: z.ZodDefault<z.ZodBoolean>;
551
553
  autoFormatBeforePush: z.ZodDefault<z.ZodBoolean>;
552
554
  trustOwnRepoWrites: z.ZodDefault<z.ZodBoolean>;
553
555
  healthCheckFreshnessMinutes: z.ZodDefault<z.ZodNumber>;
@@ -235,6 +235,12 @@ export const AgentConfigSchema = z.object({
235
235
  preferredOrgs: z.array(z.string()).default([]),
236
236
  diffTool: DiffToolSchema.default('inline'),
237
237
  diffToolCustomCommand: z.string().optional(),
238
+ /**
239
+ * Extract per-repo learnings from freshly merged PRs automatically at
240
+ * `/oss` startup and in `/oss-overnight` (#1696). When false, `daily`
241
+ * offers the extraction as an `extract_learnings` action-menu item instead.
242
+ */
243
+ autoExtractLearnings: z.boolean().default(true),
238
244
  /**
239
245
  * No effect since the hook was removed in #1642; kept for state-file
240
246
  * compatibility.
@@ -147,6 +147,19 @@ export interface DailyOutput {
147
147
  * omit the field entirely so existing consumers and goldens see no change.
148
148
  */
149
149
  listUpdates?: MergedPRListUpdate[];
150
+ /**
151
+ * Recently merged PRs whose learnings the host extracts in the background
152
+ * at startup (#1696). Present only in auto mode with Gist persistence and
153
+ * at least one unextracted merge; see {@link PendingLearnings}.
154
+ */
155
+ pendingLearnings?: PendingLearnings;
156
+ }
157
+ /** Work order for the host's background learnings extraction (#1696). */
158
+ export interface PendingLearnings {
159
+ /** `owner/repo` slugs with at least one unextracted recent merge, sorted. */
160
+ repos: string[];
161
+ /** Total unextracted recently merged PRs across those repos. */
162
+ prCount: number;
150
163
  }
151
164
  /**
152
165
  * Compact version of DailyOutput for reduced JSON payload size (#763).
@@ -178,6 +191,8 @@ export interface CompactDailyOutput {
178
191
  strategySummary?: import('../core/strategy.js').StrategyResult | null;
179
192
  /** Curated-list entries auto-marked done this run (#1463). See {@link DailyOutput.listUpdates}. */
180
193
  listUpdates?: MergedPRListUpdate[];
194
+ /** Background extraction work order (#1696). See {@link DailyOutput.pendingLearnings}. */
195
+ pendingLearnings?: PendingLearnings;
181
196
  }
182
197
  /**
183
198
  * Strip a full DailyOutput down to the compact subset (#763).
@@ -497,6 +512,10 @@ export declare const DailyOutputSchema: z.ZodObject<{
497
512
  listPath: z.ZodString;
498
513
  repoHeadingStruck: z.ZodBoolean;
499
514
  }, z.core.$strip>>>;
515
+ pendingLearnings: z.ZodOptional<z.ZodObject<{
516
+ repos: z.ZodArray<z.ZodString>;
517
+ prCount: z.ZodNumber;
518
+ }, z.core.$strip>>;
500
519
  }, z.core.$strip>;
501
520
  export declare const CompactDailyOutputSchema: z.ZodObject<{
502
521
  digest: z.ZodObject<{
@@ -651,6 +670,10 @@ export declare const CompactDailyOutputSchema: z.ZodObject<{
651
670
  listPath: z.ZodString;
652
671
  repoHeadingStruck: z.ZodBoolean;
653
672
  }, z.core.$strip>>>;
673
+ pendingLearnings: z.ZodOptional<z.ZodObject<{
674
+ repos: z.ZodArray<z.ZodString>;
675
+ prCount: z.ZodNumber;
676
+ }, z.core.$strip>>;
654
677
  }, z.core.$strip>;
655
678
  export declare const SearchOutputSchema: z.ZodObject<{
656
679
  candidates: z.ZodArray<z.ZodObject<{
@@ -43,6 +43,7 @@ export function toCompactDailyOutput(output) {
43
43
  warnings: output.warnings,
44
44
  strategySummary: output.strategySummary,
45
45
  listUpdates: output.listUpdates,
46
+ pendingLearnings: output.pendingLearnings,
46
47
  };
47
48
  }
48
49
  /**
@@ -294,6 +295,10 @@ export const AttentionSummarySchema = z.object({
294
295
  waiting: z.number().int().nonnegative(),
295
296
  });
296
297
  /** Mirrors {@link MergedPRListUpdate} (#1463). */
298
+ const PendingLearningsSchema = z.object({
299
+ repos: z.array(z.string()),
300
+ prCount: z.number().int().nonnegative(),
301
+ });
297
302
  const MergedPRListUpdateSchema = z.object({
298
303
  prUrl: z.string(),
299
304
  issueUrl: z.string(),
@@ -314,6 +319,7 @@ export const DailyOutputSchema = z.object({
314
319
  warnings: z.array(DailyWarningSchema),
315
320
  strategySummary: StrategyResultSchema.nullable().optional(),
316
321
  listUpdates: z.array(MergedPRListUpdateSchema).optional(),
322
+ pendingLearnings: PendingLearningsSchema.optional(),
317
323
  });
318
324
  export const CompactDailyOutputSchema = z.object({
319
325
  digest: DailyDigestCompactSchema,
@@ -327,6 +333,7 @@ export const CompactDailyOutputSchema = z.object({
327
333
  warnings: z.array(DailyWarningSchema),
328
334
  strategySummary: StrategyResultSchema.nullable().optional(),
329
335
  listUpdates: z.array(MergedPRListUpdateSchema).optional(),
336
+ pendingLearnings: PendingLearningsSchema.optional(),
330
337
  });
331
338
  // ── Search output schema (#1147) ─────────────────────────────────────
332
339
  const SearchPrioritySchema = z.enum(['merged_pr', 'preferred_org', 'starred', 'normal']);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oss-autopilot/core",
3
- "version": "3.23.0",
3
+ "version": "3.24.0",
4
4
  "description": "CLI and core library for managing open source contributions",
5
5
  "type": "module",
6
6
  "bin": {