@oss-autopilot/core 3.22.2 → 3.23.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 +32 -0
- package/dist/cli.bundle.cjs +110 -109
- package/dist/commands/index.d.ts +2 -0
- package/dist/commands/index.js +2 -0
- package/dist/commands/local-repos.js +48 -18
- package/dist/commands/overnight-push-prep.d.ts +91 -0
- package/dist/commands/overnight-push-prep.js +335 -0
- package/dist/commands/overnight.d.ts +13 -1
- package/dist/commands/overnight.js +35 -13
- package/dist/commands/scout-bridge.js +38 -8
- package/dist/commands/search.js +9 -11
- package/dist/core/state-schema.d.ts +32 -2
- package/dist/core/state-schema.js +23 -2
- package/dist/formatters/json.d.ts +27 -0
- package/dist/formatters/json.js +29 -0
- package/package.json +5 -5
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
* Maps state fields and creates scout instances for search/vet commands.
|
|
4
4
|
*/
|
|
5
5
|
import { createScout } from '@oss-scout/core';
|
|
6
|
-
import { getStateManager, isLinkedPRStalled, requireGitHubToken } from '../core/index.js';
|
|
6
|
+
import { getStateManager, isLinkedPRStalled, parseGitHubUrl, requireGitHubToken } from '../core/index.js';
|
|
7
|
+
import { SearchRotationSchema } from '../core/state-schema.js';
|
|
7
8
|
import { computeStrategy } from '../core/strategy.js';
|
|
8
9
|
import { loadSkippedIssuesDetailed } from './skip-file-parser.js';
|
|
9
10
|
/**
|
|
@@ -87,6 +88,27 @@ export function buildScoutState(diagnostics) {
|
|
|
87
88
|
if ((skippedIssuesLoad.readError !== undefined || skippedIssuesLoad.notFound) && diagnostics) {
|
|
88
89
|
diagnostics.skipListUnavailable = true;
|
|
89
90
|
}
|
|
91
|
+
// Dismissed issues (`/oss dismiss`, dashboard) count as skipped for scout too.
|
|
92
|
+
// Without this, scout's own recently-surfaced window (7 days) was the only
|
|
93
|
+
// thing keeping a dismissed issue out of `search`, so it came back once the
|
|
94
|
+
// window lapsed. `undismiss` deletes the map entry, so only current
|
|
95
|
+
// dismissals are merged. Scout filters by URL alone; repo/number are
|
|
96
|
+
// best-effort from the URL and title is unknown, same as the skip file.
|
|
97
|
+
const skippedIssues = [...skippedIssuesLoad.issues];
|
|
98
|
+
const skippedUrls = new Set(skippedIssues.map((s) => s.url));
|
|
99
|
+
for (const [url, dismissedAt] of Object.entries(config.dismissedIssues ?? {})) {
|
|
100
|
+
if (skippedUrls.has(url))
|
|
101
|
+
continue;
|
|
102
|
+
const parsed = parseGitHubUrl(url);
|
|
103
|
+
skippedIssues.push({
|
|
104
|
+
url,
|
|
105
|
+
repo: parsed ? `${parsed.owner}/${parsed.repo}` : '',
|
|
106
|
+
number: parsed?.number ?? 0,
|
|
107
|
+
title: '',
|
|
108
|
+
skippedAt: dismissedAt,
|
|
109
|
+
reason: 'dismissed',
|
|
110
|
+
});
|
|
111
|
+
}
|
|
90
112
|
// Strategy-derived personalization (#1464). `computeStrategy` returns null
|
|
91
113
|
// below the merged-PR floor — empty lists then read as "no bias" on scout's
|
|
92
114
|
// side. Baking the bias into the preferences (rather than only per-call
|
|
@@ -112,8 +134,15 @@ export function buildScoutState(diagnostics) {
|
|
|
112
134
|
maxIssueAgeDays: config.maxIssueAgeDays,
|
|
113
135
|
includeDocIssues: config.includeDocIssues,
|
|
114
136
|
minRepoScoreThreshold: config.minRepoScoreThreshold,
|
|
115
|
-
|
|
116
|
-
broadPhaseDelayMs
|
|
137
|
+
// No inter-phase or broad-phase cooldown. Scout's broad phase runs on
|
|
138
|
+
// GraphQL now (its schema default for broadPhaseDelayMs is 0), and the
|
|
139
|
+
// 30s/90s pins formerly here cost ~2 minutes per search. Both must be
|
|
140
|
+
// passed explicitly: scout does not schema-parse a provided initialState,
|
|
141
|
+
// so an omitted field falls through to its hard-coded 30s/90s fallbacks.
|
|
142
|
+
// OSS_AUTOPILOT_SCOUT_{INTER,BROAD}_PHASE_DELAY_MS (search.ts) override
|
|
143
|
+
// per call for hosts that need spacing.
|
|
144
|
+
interPhaseDelayMs: 0,
|
|
145
|
+
broadPhaseDelayMs: 0,
|
|
117
146
|
skipBroadWhenSufficientResults: config.skipBroadWhenSufficientResults,
|
|
118
147
|
persistence: config.persistence,
|
|
119
148
|
slmTriageModel: config.slmTriageModel,
|
|
@@ -196,14 +225,15 @@ export function buildScoutState(diagnostics) {
|
|
|
196
225
|
lastSeenAt: s.lastSeenAt,
|
|
197
226
|
lastScore: 0,
|
|
198
227
|
})),
|
|
199
|
-
skippedIssues
|
|
228
|
+
skippedIssues,
|
|
200
229
|
lastRunAt: state.lastRunAt,
|
|
201
|
-
//
|
|
202
|
-
//
|
|
230
|
+
// Scout's rotation cursors (#1630): the broad-phase language cursor, the
|
|
231
|
+
// capped phases' repo windows, and the round-robin strategy cursor. Scout
|
|
232
|
+
// advances them in its own state after a search; under
|
|
203
233
|
// persistence:'provided' that write is discarded with the process, so
|
|
204
234
|
// search.ts copies it back into AgentState and it is fed in from there.
|
|
205
|
-
//
|
|
206
|
-
searchRotation: state.searchRotation ?? {
|
|
235
|
+
// The schema defaults (all offsets 0) apply until the first search.
|
|
236
|
+
searchRotation: state.searchRotation ?? SearchRotationSchema.parse({}),
|
|
207
237
|
};
|
|
208
238
|
}
|
|
209
239
|
/**
|
package/dist/commands/search.js
CHANGED
|
@@ -92,17 +92,16 @@ function sanitizeViabilityScore(raw) {
|
|
|
92
92
|
/**
|
|
93
93
|
* Read a non-negative integer scout-delay override from an env var.
|
|
94
94
|
*
|
|
95
|
-
* Scout
|
|
96
|
-
* delay
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
* the live-API e2e suite (`search.e2e.test.ts`,
|
|
100
|
-
*
|
|
101
|
-
* collapse the delays so the test completes in a realistic CI window.
|
|
95
|
+
* Scout can space its multi-phase `/search/issues` calls with an inter-phase
|
|
96
|
+
* delay and a broad-phase delay to stay under GitHub's secondary rate limit.
|
|
97
|
+
* `buildScoutState` sets both to 0 (the broad phase runs on GraphQL now), so
|
|
98
|
+
* these env vars are the knob for hosts that still need spacing, including
|
|
99
|
+
* the live-API e2e suite (`search.e2e.test.ts`, nightly only, see #1452),
|
|
100
|
+
* which restores a modest gap on shared CI runner IPs.
|
|
102
101
|
*
|
|
103
102
|
* Returns `undefined` when the var is unset/empty or not a parseable
|
|
104
103
|
* non-negative integer, so scout falls back to its preference value and
|
|
105
|
-
* production behavior is unchanged.
|
|
104
|
+
* production behavior is unchanged.
|
|
106
105
|
*/
|
|
107
106
|
function readScoutDelayOverride(envVar) {
|
|
108
107
|
const raw = process.env[envVar];
|
|
@@ -170,9 +169,8 @@ export async function runSearch(options) {
|
|
|
170
169
|
if (preferLanguages?.length || preferRepos?.length) {
|
|
171
170
|
debug(MODULE, `Applying strategy bias to search: preferLanguages=${JSON.stringify(preferLanguages ?? [])}, preferRepos=${JSON.stringify(preferRepos ?? [])}`);
|
|
172
171
|
}
|
|
173
|
-
//
|
|
174
|
-
//
|
|
175
|
-
// use → undefined → scout falls back to the 30s/90s preference defaults.
|
|
172
|
+
// Per-call delay override (#1452). Unset in normal use → undefined → scout
|
|
173
|
+
// uses the bridge preferences (0/0, see buildScoutState).
|
|
176
174
|
const interPhaseDelayMs = readScoutDelayOverride('OSS_AUTOPILOT_SCOUT_INTER_PHASE_DELAY_MS');
|
|
177
175
|
const broadPhaseDelayMs = readScoutDelayOverride('OSS_AUTOPILOT_SCOUT_BROAD_PHASE_DELAY_MS');
|
|
178
176
|
const result = await scout.search({
|
|
@@ -419,13 +419,21 @@ export declare const SearchSeenEntrySchema: z.ZodObject<{
|
|
|
419
419
|
url: z.ZodString;
|
|
420
420
|
lastSeenAt: z.ZodString;
|
|
421
421
|
}, z.core.$strip>;
|
|
422
|
-
/**
|
|
422
|
+
/**
|
|
423
|
+
* One branch an overnight agent prepared locally (#1574). Never pushed by the
|
|
424
|
+
* run; `overnight push-prep` (#1698) may later stage it under `prep/*` on the
|
|
425
|
+
* user's fork and fills in `pushedRef`, `pushedAt` and `compareUrl`.
|
|
426
|
+
*/
|
|
423
427
|
export declare const OvernightPreparedSchema: z.ZodObject<{
|
|
424
428
|
url: z.ZodString;
|
|
425
429
|
branch: z.ZodString;
|
|
426
430
|
worktree: z.ZodOptional<z.ZodString>;
|
|
427
431
|
note: z.ZodOptional<z.ZodString>;
|
|
428
432
|
recordedAt: z.ZodString;
|
|
433
|
+
pushedRef: z.ZodOptional<z.ZodString>;
|
|
434
|
+
pushedAt: z.ZodOptional<z.ZodString>;
|
|
435
|
+
compareUrl: z.ZodOptional<z.ZodString>;
|
|
436
|
+
pushProblem: z.ZodOptional<z.ZodString>;
|
|
429
437
|
}, z.core.$strip>;
|
|
430
438
|
/** The latest overnight run (#1574); `startup` surfaces its freshness. */
|
|
431
439
|
export declare const OvernightRecordSchema: z.ZodObject<{
|
|
@@ -439,11 +447,25 @@ export declare const OvernightRecordSchema: z.ZodObject<{
|
|
|
439
447
|
worktree: z.ZodOptional<z.ZodString>;
|
|
440
448
|
note: z.ZodOptional<z.ZodString>;
|
|
441
449
|
recordedAt: z.ZodString;
|
|
450
|
+
pushedRef: z.ZodOptional<z.ZodString>;
|
|
451
|
+
pushedAt: z.ZodOptional<z.ZodString>;
|
|
452
|
+
compareUrl: z.ZodOptional<z.ZodString>;
|
|
453
|
+
pushProblem: z.ZodOptional<z.ZodString>;
|
|
442
454
|
}, z.core.$strip>>>;
|
|
443
455
|
}, z.core.$strip>;
|
|
444
|
-
/**
|
|
456
|
+
/**
|
|
457
|
+
* Mirrors oss-scout's `searchRotation`: the broad-phase language cursor, the
|
|
458
|
+
* repo-window cursors of the capped phases, and the round-robin strategy
|
|
459
|
+
* cursor (oss-scout 1.7.0). Every field must be listed: z.object strips
|
|
460
|
+
* unknown keys, so a cursor missing here would be dropped on every load and
|
|
461
|
+
* scout's rotation would restart from 0 each search.
|
|
462
|
+
*/
|
|
445
463
|
export declare const SearchRotationSchema: z.ZodObject<{
|
|
446
464
|
languageOffset: z.ZodDefault<z.ZodNumber>;
|
|
465
|
+
phase0Offset: z.ZodDefault<z.ZodNumber>;
|
|
466
|
+
starredOffset: z.ZodDefault<z.ZodNumber>;
|
|
467
|
+
maintainedOffset: z.ZodDefault<z.ZodNumber>;
|
|
468
|
+
strategyOffset: z.ZodDefault<z.ZodNumber>;
|
|
447
469
|
lastRotatedAt: z.ZodOptional<z.ZodString>;
|
|
448
470
|
}, z.core.$strip>;
|
|
449
471
|
export declare const AgentStateSchema: z.ZodObject<{
|
|
@@ -706,10 +728,18 @@ export declare const AgentStateSchema: z.ZodObject<{
|
|
|
706
728
|
worktree: z.ZodOptional<z.ZodString>;
|
|
707
729
|
note: z.ZodOptional<z.ZodString>;
|
|
708
730
|
recordedAt: z.ZodString;
|
|
731
|
+
pushedRef: z.ZodOptional<z.ZodString>;
|
|
732
|
+
pushedAt: z.ZodOptional<z.ZodString>;
|
|
733
|
+
compareUrl: z.ZodOptional<z.ZodString>;
|
|
734
|
+
pushProblem: z.ZodOptional<z.ZodString>;
|
|
709
735
|
}, z.core.$strip>>>;
|
|
710
736
|
}, z.core.$strip>>;
|
|
711
737
|
searchRotation: z.ZodOptional<z.ZodObject<{
|
|
712
738
|
languageOffset: z.ZodDefault<z.ZodNumber>;
|
|
739
|
+
phase0Offset: z.ZodDefault<z.ZodNumber>;
|
|
740
|
+
starredOffset: z.ZodDefault<z.ZodNumber>;
|
|
741
|
+
maintainedOffset: z.ZodDefault<z.ZodNumber>;
|
|
742
|
+
strategyOffset: z.ZodDefault<z.ZodNumber>;
|
|
713
743
|
lastRotatedAt: z.ZodOptional<z.ZodString>;
|
|
714
744
|
}, z.core.$strip>>;
|
|
715
745
|
}, z.core.$strip>;
|
|
@@ -374,13 +374,24 @@ export const SearchSeenEntrySchema = z.object({
|
|
|
374
374
|
url: z.string(),
|
|
375
375
|
lastSeenAt: z.string(),
|
|
376
376
|
});
|
|
377
|
-
/**
|
|
377
|
+
/**
|
|
378
|
+
* One branch an overnight agent prepared locally (#1574). Never pushed by the
|
|
379
|
+
* run; `overnight push-prep` (#1698) may later stage it under `prep/*` on the
|
|
380
|
+
* user's fork and fills in `pushedRef`, `pushedAt` and `compareUrl`.
|
|
381
|
+
*/
|
|
378
382
|
export const OvernightPreparedSchema = z.object({
|
|
379
383
|
url: z.string(),
|
|
380
384
|
branch: z.string(),
|
|
381
385
|
worktree: z.string().optional(),
|
|
382
386
|
note: z.string().optional(),
|
|
383
387
|
recordedAt: z.string(),
|
|
388
|
+
/** Branch name on the fork (`prep/<branch>`), set by `overnight push-prep`. */
|
|
389
|
+
pushedRef: z.string().optional(),
|
|
390
|
+
pushedAt: z.string().optional(),
|
|
391
|
+
/** `<fork>/compare/<pr-head>...prep/<branch>`; absent when the PR head could not be read. */
|
|
392
|
+
compareUrl: z.string().optional(),
|
|
393
|
+
/** Why the last `overnight push-prep` did not push this branch; cleared once it is pushed. */
|
|
394
|
+
pushProblem: z.string().optional(),
|
|
384
395
|
});
|
|
385
396
|
/** The latest overnight run (#1574); `startup` surfaces its freshness. */
|
|
386
397
|
export const OvernightRecordSchema = z.object({
|
|
@@ -390,9 +401,19 @@ export const OvernightRecordSchema = z.object({
|
|
|
390
401
|
judgmentCount: z.number().int().nonnegative(),
|
|
391
402
|
prepared: z.array(OvernightPreparedSchema).default([]),
|
|
392
403
|
});
|
|
393
|
-
/**
|
|
404
|
+
/**
|
|
405
|
+
* Mirrors oss-scout's `searchRotation`: the broad-phase language cursor, the
|
|
406
|
+
* repo-window cursors of the capped phases, and the round-robin strategy
|
|
407
|
+
* cursor (oss-scout 1.7.0). Every field must be listed: z.object strips
|
|
408
|
+
* unknown keys, so a cursor missing here would be dropped on every load and
|
|
409
|
+
* scout's rotation would restart from 0 each search.
|
|
410
|
+
*/
|
|
394
411
|
export const SearchRotationSchema = z.object({
|
|
395
412
|
languageOffset: z.number().int().nonnegative().default(0),
|
|
413
|
+
phase0Offset: z.number().int().nonnegative().default(0),
|
|
414
|
+
starredOffset: z.number().int().nonnegative().default(0),
|
|
415
|
+
maintainedOffset: z.number().int().nonnegative().default(0),
|
|
416
|
+
strategyOffset: z.number().int().nonnegative().default(0),
|
|
396
417
|
lastRotatedAt: z.string().optional(),
|
|
397
418
|
});
|
|
398
419
|
export const AgentStateSchema = z.object({
|
|
@@ -1205,6 +1205,33 @@ export declare const LocalReposOutputSchema: z.ZodObject<{
|
|
|
1205
1205
|
cachedAt: z.ZodString;
|
|
1206
1206
|
fromCache: z.ZodBoolean;
|
|
1207
1207
|
}, z.core.$strip>;
|
|
1208
|
+
export declare const OvernightPushPrepOutputSchema: z.ZodObject<{
|
|
1209
|
+
dryRun: z.ZodBoolean;
|
|
1210
|
+
login: z.ZodString;
|
|
1211
|
+
reportPath: z.ZodString;
|
|
1212
|
+
results: z.ZodArray<z.ZodObject<{
|
|
1213
|
+
url: z.ZodString;
|
|
1214
|
+
branch: z.ZodString;
|
|
1215
|
+
status: z.ZodEnum<{
|
|
1216
|
+
skipped: "skipped";
|
|
1217
|
+
failed: "failed";
|
|
1218
|
+
pushed: "pushed";
|
|
1219
|
+
planned: "planned";
|
|
1220
|
+
}>;
|
|
1221
|
+
remote: z.ZodOptional<z.ZodString>;
|
|
1222
|
+
repo: z.ZodOptional<z.ZodString>;
|
|
1223
|
+
ref: z.ZodOptional<z.ZodString>;
|
|
1224
|
+
compareUrl: z.ZodOptional<z.ZodString>;
|
|
1225
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
1226
|
+
}, z.core.$strip>>;
|
|
1227
|
+
pushed: z.ZodNumber;
|
|
1228
|
+
planned: z.ZodNumber;
|
|
1229
|
+
skipped: z.ZodNumber;
|
|
1230
|
+
failed: z.ZodNumber;
|
|
1231
|
+
reportRecreated: z.ZodOptional<z.ZodLiteral<true>>;
|
|
1232
|
+
reportWarning: z.ZodOptional<z.ZodString>;
|
|
1233
|
+
gistSyncWarning: z.ZodOptional<z.ZodString>;
|
|
1234
|
+
}, z.core.$strip>;
|
|
1208
1235
|
/**
|
|
1209
1236
|
* Compact summary of an issue's first linked PR, surfaced on candidate
|
|
1210
1237
|
* outputs (#97 / scout 0.9.0). `isStalled` is `true` when the PR is open
|
package/dist/formatters/json.js
CHANGED
|
@@ -753,6 +753,35 @@ export const LocalReposOutputSchema = z.object({
|
|
|
753
753
|
cachedAt: z.string(),
|
|
754
754
|
fromCache: z.boolean(),
|
|
755
755
|
});
|
|
756
|
+
/** One prepared branch as `overnight push-prep` (#1698) handled it. */
|
|
757
|
+
const PushPrepResultSchema = z.object({
|
|
758
|
+
url: z.string(),
|
|
759
|
+
branch: z.string(),
|
|
760
|
+
/** `skipped`: a gate said no (nothing to fix tonight). `failed`: the push itself broke. */
|
|
761
|
+
status: z.enum(['pushed', 'planned', 'skipped', 'failed']),
|
|
762
|
+
remote: z.string().optional(),
|
|
763
|
+
repo: z.string().optional(),
|
|
764
|
+
/** Always under `refs/heads/prep/`. */
|
|
765
|
+
ref: z.string().startsWith('refs/heads/prep/').optional(),
|
|
766
|
+
compareUrl: z.string().optional(),
|
|
767
|
+
reason: z.string().optional(),
|
|
768
|
+
});
|
|
769
|
+
export const OvernightPushPrepOutputSchema = z.object({
|
|
770
|
+
dryRun: z.boolean(),
|
|
771
|
+
login: z.string(),
|
|
772
|
+
reportPath: z.string(),
|
|
773
|
+
results: z.array(PushPrepResultSchema),
|
|
774
|
+
pushed: z.number().int().nonnegative(),
|
|
775
|
+
planned: z.number().int().nonnegative(),
|
|
776
|
+
skipped: z.number().int().nonnegative(),
|
|
777
|
+
/** Any failed push makes the CLI exit 1, so a scheduler sees it. */
|
|
778
|
+
failed: z.number().int().nonnegative(),
|
|
779
|
+
/** The report file was missing and has been recreated with only the prepared section. */
|
|
780
|
+
reportRecreated: z.literal(true).optional(),
|
|
781
|
+
/** The pushes and state are recorded, but the report file could not be rewritten. */
|
|
782
|
+
reportWarning: z.string().optional(),
|
|
783
|
+
gistSyncWarning: z.string().optional(),
|
|
784
|
+
});
|
|
756
785
|
/**
|
|
757
786
|
* Convert a full StartupOutput to the compact format (#763).
|
|
758
787
|
* Uses destructuring to auto-forward any new fields added to StartupOutput.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oss-autopilot/core",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.23.0",
|
|
4
4
|
"description": "CLI and core library for managing open source contributions",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -55,18 +55,18 @@
|
|
|
55
55
|
"@octokit/plugin-retry": "^8.1.1",
|
|
56
56
|
"@octokit/plugin-throttling": "^11.0.5",
|
|
57
57
|
"@octokit/rest": "^22.0.1",
|
|
58
|
-
"@oss-scout/core": "^1.
|
|
58
|
+
"@oss-scout/core": "^1.7.0",
|
|
59
59
|
"commander": "^15.0.0",
|
|
60
60
|
"zod": "^4.5.4"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
|
-
"@types/node": "^26.4.
|
|
64
|
-
"@vitest/coverage-v8": "^
|
|
63
|
+
"@types/node": "^26.4.1",
|
|
64
|
+
"@vitest/coverage-v8": "^5.0.0",
|
|
65
65
|
"esbuild": "^0.28.2",
|
|
66
66
|
"tsx": "^4.23.13",
|
|
67
67
|
"typedoc": "^0.28.20",
|
|
68
68
|
"typescript": "^6.0.3",
|
|
69
|
-
"vitest": "^
|
|
69
|
+
"vitest": "^5.0.0"
|
|
70
70
|
},
|
|
71
71
|
"scripts": {
|
|
72
72
|
"build": "tsc",
|