@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
@@ -145,6 +145,7 @@ export function checkUnrespondedComments(comments, reviews, reviewComments, user
145
145
  const author = comment.user?.login || 'unknown';
146
146
  timeline.push({
147
147
  author,
148
+ userType: comment.user?.type,
148
149
  body: comment.body || '',
149
150
  createdAt: comment.created_at,
150
151
  isUser: author.toLowerCase() === usernameLower,
@@ -174,6 +175,7 @@ export function checkUnrespondedComments(comments, reviews, reviewComments, user
174
175
  : '(posted inline review comments)');
175
176
  timeline.push({
176
177
  author,
178
+ userType: review.user?.type,
177
179
  body: resolvedBody,
178
180
  createdAt: review.submitted_at,
179
181
  isUser: author.toLowerCase() === usernameLower,
@@ -197,7 +199,7 @@ export function checkUnrespondedComments(comments, reviews, reviewComments, user
197
199
  continue; // Skip user's own comments
198
200
  if (item.author === 'unknown')
199
201
  continue; // Skip deleted/null accounts
200
- if (isBotAuthor(item.author))
202
+ if (isBotAuthor(item.author, item.userType))
201
203
  continue; // Skip bots
202
204
  const itemTime = new Date(item.createdAt);
203
205
  if (!lastUserCommentTime || itemTime > lastUserCommentTime) {
@@ -221,3 +223,92 @@ export function checkUnrespondedComments(comments, reviews, reviewComments, user
221
223
  lastMaintainerComment,
222
224
  };
223
225
  }
226
+ /**
227
+ * Bots whose pushes are automation, not maintainer engagement. Compared
228
+ * case-insensitively with any `[bot]` suffix stripped.
229
+ */
230
+ const PUSH_BOT_DENYLIST = new Set([
231
+ 'pre-commit-ci',
232
+ 'autofix-ci',
233
+ 'prettier-ci',
234
+ 'github-actions',
235
+ 'dependabot',
236
+ 'renovate',
237
+ 'web-flow',
238
+ ]);
239
+ /** Author associations that mark a commenter as a repo maintainer. */
240
+ const MAINTAINER_ASSOCIATIONS = new Set(['OWNER', 'MEMBER', 'COLLABORATOR']);
241
+ /**
242
+ * Minimum gap since the previous activity (maintainer or contributor) for a
243
+ * contributor comment to count as a "ping". A same-day reply to a maintainer
244
+ * is conversation, not a nudge.
245
+ */
246
+ export const PING_MIN_GAP_DAYS = 7;
247
+ /**
248
+ * Latest maintainer activity on a PR, falling back to `createdAt` when no
249
+ * maintainer has engaged, plus the number of contributor pings since then.
250
+ *
251
+ * Maintainer activity is any of:
252
+ * - an issue comment by an OWNER / MEMBER / COLLABORATOR, so drive-by "+1"
253
+ * comments don't reset the clock (when the association is unknown, as on
254
+ * older data, any non-contributor non-bot author counts);
255
+ * - a review or inline review comment by any non-contributor non-bot user
256
+ * (codeowners often show as CONTRIBUTOR);
257
+ * - a commit authored or committed by someone else, or a force-push by
258
+ * someone else, including bots such as a maintainer's own GitHub App,
259
+ * except auto-fixer / dependency bots ({@link PUSH_BOT_DENYLIST});
260
+ * - a review request or label by a non-contributor non-bot actor.
261
+ *
262
+ * Staleness is measured from this timestamp rather than `updatedAt`, because
263
+ * `updatedAt` is bumped by the contributor's own follow-ups and rebases, so a
264
+ * PR the maintainers have ignored for months never looked dormant.
265
+ *
266
+ * A contributor comment counts as a ping only when it comes at least
267
+ * {@link PING_MIN_GAP_DAYS} after the previous activity (the maintainer
268
+ * activity or the contributor's own previous comment).
269
+ */
270
+ export function getLastMaintainerActivity(comments, reviews, reviewComments, events, username, createdAt) {
271
+ const usernameLower = username.toLowerCase();
272
+ let latest = createdAt;
273
+ let latestMs = Date.parse(createdAt);
274
+ const consider = (login, type, at, isPush = false) => {
275
+ if (!login || !at)
276
+ return;
277
+ const lower = login.toLowerCase();
278
+ if (lower === usernameLower)
279
+ return;
280
+ if (isPush ? PUSH_BOT_DENYLIST.has(lower.replace(/\[bot\]$/, '')) : isBotAuthor(login, type))
281
+ return;
282
+ const ms = Date.parse(at);
283
+ if (ms > latestMs) {
284
+ latest = at;
285
+ latestMs = ms;
286
+ }
287
+ };
288
+ for (const c of comments) {
289
+ const association = c.author_association;
290
+ if (association && !MAINTAINER_ASSOCIATIONS.has(association))
291
+ continue;
292
+ consider(c.user?.login, c.user?.type, c.created_at);
293
+ }
294
+ for (const r of reviews)
295
+ consider(r.user?.login, r.user?.type, r.submitted_at);
296
+ for (const c of reviewComments)
297
+ consider(c.user?.login, c.user?.type, c.created_at);
298
+ for (const e of events)
299
+ consider(e.login, e.type, e.at, e.isPush);
300
+ const authorCommentTimes = comments
301
+ .filter((c) => c.user?.login?.toLowerCase() === usernameLower)
302
+ .map((c) => Date.parse(c.created_at))
303
+ .filter((ms) => ms > latestMs);
304
+ authorCommentTimes.sort((a, b) => a - b);
305
+ const minGapMs = PING_MIN_GAP_DAYS * 86_400_000;
306
+ let previousMs = latestMs;
307
+ let authorPingsSinceMaintainerActivity = 0;
308
+ for (const ms of authorCommentTimes) {
309
+ if (ms - previousMs >= minGapMs)
310
+ authorPingsSinceMaintainerActivity++;
311
+ previousMs = ms;
312
+ }
313
+ return { lastMaintainerActivityAt: latest, authorPingsSinceMaintainerActivity };
314
+ }
@@ -5,7 +5,7 @@
5
5
  */
6
6
  import * as fs from 'node:fs';
7
7
  import * as path from 'node:path';
8
- import { AgentStateSchema } from './state-schema.js';
8
+ import { AgentStateSchema, NEWER_WRITER_HINT, unknownStateKeys } from './state-schema.js';
9
9
  import { serializeState } from './state-prune.js';
10
10
  import { getStatePath, getBackupDir, getDataDir, getLegacyStatePath, getLegacyBackupDir } from './paths.js';
11
11
  import { errorMessage, ConcurrencyError } from './errors.js';
@@ -378,7 +378,11 @@ export function loadState() {
378
378
  wasMigrated = true;
379
379
  }
380
380
  }
381
- // Validate through Zod schema (strips unknown keys in memory; stale keys persist on disk until next save)
381
+ // Validate through Zod schema. Unknown keys pass through (#1831): they
382
+ // come from a newer release and must survive this version's next save.
383
+ const newer = unknownStateKeys(raw);
384
+ if (newer.length > 0)
385
+ warn(MODULE, `State file (fields: ${newer.join(', ')}) ${NEWER_WRITER_HINT}`);
382
386
  const parsed = AgentStateSchema.safeParse(raw);
383
387
  if (!parsed.success) {
384
388
  const summary = parsed.error.issues.map((i) => `${i.path.join('.')}: ${i.message}`).join('; ');