@sideboard-ai/core 0.1.152 → 0.1.155

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 (61) hide show
  1. package/dist/{abletime-223A3LY6.js → abletime-H7LPGIP2.js} +3 -3
  2. package/dist/{abletime-CLC5UJC2.js → abletime-JSTJLXAW.js} +3 -3
  3. package/dist/agents/cursor-runner.js +2 -2
  4. package/dist/{agents-CUKWIM34.js → agents-V24DYZI4.js} +8 -9
  5. package/dist/{agents-VHXCBBBD.js → agents-YVW75KBO.js} +8 -9
  6. package/dist/{app-settings-3CHCNIMD.js → app-settings-H3INSR67.js} +38 -4
  7. package/dist/{app-settings-J3JBCUOT.js → app-settings-VRQI3FIE.js} +38 -4
  8. package/dist/{caffeinate-hold-NBRUWYXO.js → caffeinate-hold-DBKMRZZO.js} +2 -2
  9. package/dist/{caffeinate-hold-X3JNPR42.js → caffeinate-hold-SK2QISPE.js} +2 -2
  10. package/dist/chunk-2F63IMCL.js +959 -0
  11. package/dist/{chunk-4XNSGDXE.js → chunk-3BWVOUQG.js} +244 -1
  12. package/dist/{chunk-7BQNSUR2.js → chunk-46ZTBUVJ.js} +364 -200
  13. package/dist/{chunk-EY6QXPPO.js → chunk-4THE3EY7.js} +6 -6
  14. package/dist/{chunk-TUGKX5BD.js → chunk-7UURXPKD.js} +1 -1
  15. package/dist/{chunk-DCOZABNT.js → chunk-AO35MGOE.js} +1 -1
  16. package/dist/{chunk-3JBMACYX.js → chunk-CJQLPPEJ.js} +387 -15
  17. package/dist/{chunk-CZD4NRDZ.js → chunk-D7EGJ3EI.js} +244 -1
  18. package/dist/{chunk-QZQEXME2.js → chunk-EFVFB2AH.js} +1 -1
  19. package/dist/{chunk-B7XK37WZ.js → chunk-FDCFXMDG.js} +1 -1
  20. package/dist/{chunk-6X7Z34XE.js → chunk-J2OKVOBM.js} +410 -188
  21. package/dist/{chunk-WLV7TRMR.js → chunk-JOK4XWBG.js} +1 -1
  22. package/dist/{chunk-BD2ICC4D.js → chunk-JTJHOYCU.js} +1 -1
  23. package/dist/{chunk-GE7M3QTE.js → chunk-LQMFCS54.js} +387 -15
  24. package/dist/{chunk-G7SIQFBQ.js → chunk-LZ6QMEQC.js} +1 -1
  25. package/dist/{chunk-EUXOHTUK.js → chunk-LZQULFIT.js} +1 -1
  26. package/dist/{chunk-KLBOWJ74.js → chunk-OCQPTUR7.js} +1 -1
  27. package/dist/{chunk-GFQ57XAX.js → chunk-QZEZXYVV.js} +13 -13
  28. package/dist/chunk-RNC3GR6L.js +905 -0
  29. package/dist/{chunk-VHX673DI.js → chunk-WLPXZFRE.js} +1 -1
  30. package/dist/{chunk-7F4XE6UG.js → chunk-XD2BAANL.js} +5 -5
  31. package/dist/{connected-teams-XO766HB4.js → connected-teams-DBWAMP7G.js} +2 -2
  32. package/dist/{connected-teams-I2WZZZFA.js → connected-teams-WGONUQOF.js} +2 -2
  33. package/dist/{coordinator-prompt-WGFRYCHE.js → coordinator-prompt-7FHKCWXB.js} +5 -5
  34. package/dist/{coordinator-prompt-TBX4MOFM.js → coordinator-prompt-KX2FVVYT.js} +5 -5
  35. package/dist/{cursor-recover-NOQYOFRF.js → cursor-recover-L5MD6MBO.js} +1 -1
  36. package/dist/{cursor-recover-QSLWEZNA.js → cursor-recover-NDMLLNYX.js} +2 -2
  37. package/dist/{global-workspace-IY5QAV5C.js → global-workspace-2BRRKSDN.js} +5 -6
  38. package/dist/{global-workspace-BHLUJ46D.js → global-workspace-4LHCZ2DC.js} +5 -6
  39. package/dist/index.cjs +1889 -777
  40. package/dist/index.d.cts +222 -12
  41. package/dist/index.d.ts +222 -12
  42. package/dist/index.js +304 -108
  43. package/dist/mcp/run-stdio.cjs +1747 -1240
  44. package/dist/mcp/run-stdio.js +232 -80
  45. package/dist/{orchestrator-256DFPSX.js → orchestrator-3FWEKDAQ.js} +9 -11
  46. package/dist/{orchestrator-NUA6SEV7.js → orchestrator-HC7XVGJB.js} +10 -12
  47. package/dist/{paths-UMEDHOS5.js → paths-53TLA7VQ.js} +1 -1
  48. package/dist/{paths-QCI3MTO5.js → paths-RRCLNSJB.js} +1 -1
  49. package/dist/{thread-store-WGASXXXR.js → thread-store-KBFBHT5G.js} +2 -2
  50. package/dist/{thread-store-57ZLHR3A.js → thread-store-MVQU6HPJ.js} +2 -2
  51. package/dist/{workspaces-4FSXVIZM.js → workspaces-5UNDTN4G.js} +5 -7
  52. package/dist/{workspaces-NECIQTAO.js → workspaces-MQYNZXUK.js} +5 -7
  53. package/dist/{worktree-HTUM35NT.js → worktree-PEWDAX5O.js} +4 -4
  54. package/dist/{worktree-DPIREDFR.js → worktree-T4SWFSTT.js} +4 -4
  55. package/package.json +1 -1
  56. package/dist/chunk-2U6QF3PT.js +0 -211
  57. package/dist/chunk-67TIJ7S5.js +0 -122
  58. package/dist/chunk-7TIUOYBK.js +0 -213
  59. package/dist/chunk-G4MTYUWS.js +0 -592
  60. package/dist/chunk-K2ANSHUO.js +0 -120
  61. package/dist/chunk-SN6CMKF6.js +0 -538
@@ -6,7 +6,7 @@ import {
6
6
  getAbleTimeHost,
7
7
  isAbleTimeConnected,
8
8
  saveAbleTimeConnection
9
- } from "./chunk-4XNSGDXE.js";
9
+ } from "./chunk-3BWVOUQG.js";
10
10
 
11
11
  // src/integrations/abletime-mcp.ts
12
12
  var DEFAULT_ABLETIME_HOST = "https://track.abletime.com";
@@ -284,7 +284,7 @@ function loadWorkspaceSettings(worktreePath, repoPath) {
284
284
  const repoFamily = repoPath && normPath2(repoPath) !== normPath2(worktreePath) ? detectFamily(repoPath) : null;
285
285
  const wtToml = wtFamily ? loadCommittedToml(worktreePath, wtFamily) : null;
286
286
  const repoToml = repoPath && repoFamily ? loadCommittedToml(repoPath, repoFamily) : null;
287
- let merged = wtToml ?? repoToml;
287
+ let merged = mergeSettings(repoToml, wtToml);
288
288
  if (repoPath && normPath2(repoPath) !== normPath2(worktreePath)) {
289
289
  merged = mergeSettings(merged, loadAnyLocal(repoPath));
290
290
  }
@@ -3,14 +3,17 @@ import {
3
3
  } from "./chunk-JRH62XC4.js";
4
4
  import {
5
5
  getGithubGitAuthMode,
6
- getGithubPat
7
- } from "./chunk-4XNSGDXE.js";
6
+ getGithubPat,
7
+ preferTeamsForRole,
8
+ resolveViewerProfile,
9
+ resolveViewerProfileForRepo
10
+ } from "./chunk-3BWVOUQG.js";
8
11
  import {
9
12
  listThreads
10
- } from "./chunk-TUGKX5BD.js";
13
+ } from "./chunk-7UURXPKD.js";
11
14
  import {
12
15
  worktreesRoot
13
- } from "./chunk-QZQEXME2.js";
16
+ } from "./chunk-EFVFB2AH.js";
14
17
  import {
15
18
  ensureWorktreeSideboardIgnored
16
19
  } from "./chunk-QQKDGPUI.js";
@@ -1150,6 +1153,361 @@ function formatGitAuthModeDirective(mode) {
1150
1153
  }
1151
1154
  }
1152
1155
 
1156
+ // src/git/list-prs.ts
1157
+ var PR_LIST_JSON_FIELDS = [
1158
+ "number",
1159
+ "title",
1160
+ "headRefName",
1161
+ "url",
1162
+ "isCrossRepository",
1163
+ "author",
1164
+ "labels",
1165
+ "reviewRequests",
1166
+ "reviewDecision",
1167
+ "state",
1168
+ "isDraft",
1169
+ "assignees"
1170
+ ].join(",");
1171
+ var BOT_REVIEWER_LOGINS = /* @__PURE__ */ new Set([
1172
+ "copilot",
1173
+ "copilot-pull-request-reviewer",
1174
+ "github-actions",
1175
+ "github-advanced-security",
1176
+ "dependabot",
1177
+ "renovate",
1178
+ "greptile",
1179
+ "greptile-apps",
1180
+ "coderabbit",
1181
+ "coderabbitai",
1182
+ "cursor",
1183
+ "cursor-agent"
1184
+ ]);
1185
+ function normalizePrListState(state) {
1186
+ const key = (state ?? "").trim().toLowerCase();
1187
+ if (key === "closed") return "closed";
1188
+ if (key === "merged") return "merged";
1189
+ if (key === "all" || key === "*") return "all";
1190
+ return "open";
1191
+ }
1192
+ function normalizePrListQueue(queue, state) {
1193
+ const q = (queue ?? "").trim().toLowerCase();
1194
+ if (q === "review" || q === "unclaimed" || q === "inbox") return "review";
1195
+ if (q === "mine" || q === "assigned") return "mine";
1196
+ if (q === "approved" || q === "eng-approved") return "approved";
1197
+ if (q === "changes" || q === "eng-requested-changes" || q === "requested-changes") {
1198
+ return "changes";
1199
+ }
1200
+ const s = (state ?? "").trim().toLowerCase();
1201
+ if (s === "review" || s === "view" || s === "in-review" || s === "in_review") {
1202
+ return "review";
1203
+ }
1204
+ return void 0;
1205
+ }
1206
+ var QUEUE_DEFAULTS = {
1207
+ review: {
1208
+ state: "open",
1209
+ labels: ["eng-review"],
1210
+ reviewer: "unassigned",
1211
+ draft: false
1212
+ },
1213
+ mine: {
1214
+ state: "open",
1215
+ labels: ["eng-review"],
1216
+ reviewer: "me",
1217
+ draft: false
1218
+ },
1219
+ approved: { state: "open", labels: ["eng-approved"] },
1220
+ changes: { state: "open", labels: ["eng-requested-changes"] }
1221
+ };
1222
+ var TICKET_IN_TITLE_RE = /\b[A-Z]{2,8}-\d{1,6}\b|(?:^|[^\w/])#(\d+)\b/g;
1223
+ function ticketRefsFromPrTitle(title) {
1224
+ const out = [];
1225
+ const seen = /* @__PURE__ */ new Set();
1226
+ for (const match of title.matchAll(TICKET_IN_TITLE_RE)) {
1227
+ const id = match[1] ? `#${match[1]}` : match[0];
1228
+ const key = id.toLowerCase();
1229
+ if (seen.has(key)) continue;
1230
+ seen.add(key);
1231
+ out.push(id);
1232
+ }
1233
+ return out;
1234
+ }
1235
+ function resolveListPrsOptions(opts) {
1236
+ const queue = normalizePrListQueue(opts?.queue, opts?.state);
1237
+ const defaults = queue ? QUEUE_DEFAULTS[queue] : void 0;
1238
+ const stateIsQueueAlias = Boolean(normalizePrListQueue(void 0, opts?.state));
1239
+ const labels = normalizePrLabels(opts?.labels);
1240
+ return {
1241
+ ...queue ? { queue } : {},
1242
+ state: normalizePrListState(stateIsQueueAlias ? defaults?.state : opts?.state ?? defaults?.state),
1243
+ labels: labels.length ? labels : defaults?.labels ?? [],
1244
+ ...opts?.reviewer?.trim() ? { reviewer: opts.reviewer.trim() } : defaults?.reviewer ? { reviewer: defaults.reviewer } : {},
1245
+ ...opts?.query?.trim() ? { query: opts.query.trim() } : {},
1246
+ ...opts?.draft !== void 0 ? { draft: opts.draft } : defaults?.draft !== void 0 ? { draft: defaults.draft } : {},
1247
+ ...opts?.viewerTeams?.length ? { viewerTeams: opts.viewerTeams } : {},
1248
+ ...opts?.limit != null ? { limit: opts.limit } : {}
1249
+ };
1250
+ }
1251
+ function normalizePrLabels(labels) {
1252
+ const raw = (Array.isArray(labels) ? labels : [labels ?? ""]).flatMap((part) => String(part).split(",")).map((part) => part.trim()).filter(Boolean);
1253
+ const seen = /* @__PURE__ */ new Set();
1254
+ const out = [];
1255
+ for (const label of raw) {
1256
+ const name = label.trim();
1257
+ if (!name) continue;
1258
+ const key = name.toLowerCase();
1259
+ if (seen.has(key)) continue;
1260
+ seen.add(key);
1261
+ out.push(name);
1262
+ }
1263
+ return out;
1264
+ }
1265
+ function normalizePrReviewer(reviewer) {
1266
+ return (reviewer ?? "").trim().toLowerCase();
1267
+ }
1268
+ function isBotReviewerLogin(login) {
1269
+ const raw = login.trim();
1270
+ if (!raw) return true;
1271
+ if (/\[[^\]]*bot[^\]]*\]/i.test(raw)) return true;
1272
+ const n = raw.toLowerCase().replace(/\[bot\]$/i, "");
1273
+ if (n.endsWith("-bot") || n.endsWith("_bot")) return true;
1274
+ return BOT_REVIEWER_LOGINS.has(n);
1275
+ }
1276
+ function looksLikeTeamSlug(id) {
1277
+ const n = id.trim().toLowerCase().replace(/\[bot\]$/i, "");
1278
+ if (!n) return false;
1279
+ if (n.includes("/")) return true;
1280
+ return /(^|-)team(-|$)/.test(n) || n.endsWith("-squad");
1281
+ }
1282
+ function parseReviewRequest(raw) {
1283
+ if (typeof raw === "string") {
1284
+ const id2 = raw.trim();
1285
+ if (!id2) return null;
1286
+ if (isBotReviewerLogin(id2)) return { id: id2, kind: "bot" };
1287
+ if (looksLikeTeamSlug(id2)) return { id: id2, kind: "team" };
1288
+ return { id: id2, kind: "user" };
1289
+ }
1290
+ if (!raw || typeof raw !== "object") return null;
1291
+ const row = raw;
1292
+ const typename = String(row.__typename ?? row.type ?? "");
1293
+ const slug = typeof row.slug === "string" ? row.slug.trim() : "";
1294
+ const login = typeof row.login === "string" ? row.login.trim() : "";
1295
+ const name = typeof row.name === "string" ? row.name.trim() : "";
1296
+ const id = login || slug || name;
1297
+ if (!id) return null;
1298
+ if (/team/i.test(typename) || slug && !login || looksLikeTeamSlug(id)) {
1299
+ return { id: slug || name || login, kind: "team" };
1300
+ }
1301
+ if (isBotReviewerLogin(id) || /bot/i.test(typename)) return { id, kind: "bot" };
1302
+ return { id, kind: "user" };
1303
+ }
1304
+ function collectReviewRequests(raw) {
1305
+ if (!Array.isArray(raw)) return { ids: [], users: [], teams: [] };
1306
+ const ids = [];
1307
+ const users = [];
1308
+ const teams = [];
1309
+ const seen = /* @__PURE__ */ new Set();
1310
+ const take = (list, id) => {
1311
+ const key = id.toLowerCase();
1312
+ if (seen.has(`${list === teams ? "t" : list === users ? "u" : "i"}:${key}`)) return;
1313
+ seen.add(`${list === teams ? "t" : list === users ? "u" : "i"}:${key}`);
1314
+ list.push(id);
1315
+ };
1316
+ for (const item of raw) {
1317
+ const parsed = parseReviewRequest(item);
1318
+ if (!parsed) continue;
1319
+ take(ids, parsed.id);
1320
+ if (parsed.kind === "user") take(users, parsed.id);
1321
+ if (parsed.kind === "team") take(teams, parsed.id);
1322
+ }
1323
+ return { ids, users, teams };
1324
+ }
1325
+ function reviewerIdentities(raw) {
1326
+ return collectReviewRequests(raw).ids;
1327
+ }
1328
+ function humanReviewerLogins(raw) {
1329
+ return collectReviewRequests(raw).users;
1330
+ }
1331
+ function teamReviewerSlugs(raw) {
1332
+ return collectReviewRequests(raw).teams;
1333
+ }
1334
+ function labelNames(raw) {
1335
+ if (!Array.isArray(raw)) return [];
1336
+ const out = [];
1337
+ const seen = /* @__PURE__ */ new Set();
1338
+ for (const item of raw) {
1339
+ const name = typeof item === "string" ? item.trim() : item && typeof item === "object" && typeof item.name === "string" ? item.name.trim() : "";
1340
+ if (!name) continue;
1341
+ const key = name.toLowerCase();
1342
+ if (seen.has(key)) continue;
1343
+ seen.add(key);
1344
+ out.push(name);
1345
+ }
1346
+ return out;
1347
+ }
1348
+ function searchLabelToken(label) {
1349
+ return /[\s:]/.test(label) ? `label:"${label.replace(/"/g, "")}"` : `label:${label}`;
1350
+ }
1351
+ function searchStateTokens(state) {
1352
+ if (state === "open") return ["is:open"];
1353
+ if (state === "closed") return ["is:closed", "-is:merged"];
1354
+ if (state === "merged") return ["is:merged"];
1355
+ return [];
1356
+ }
1357
+ function isUnassignedReviewer(reviewer) {
1358
+ const key = normalizePrReviewer(reviewer);
1359
+ return key === "unassigned" || key === "none" || key === "null";
1360
+ }
1361
+ function prListFetchLimit(limit, reviewer) {
1362
+ const n = Math.max(1, Math.min(250, Math.floor(limit)));
1363
+ if (isUnassignedReviewer(reviewer)) {
1364
+ return Math.min(250, Math.max(n * 4, 80));
1365
+ }
1366
+ return n;
1367
+ }
1368
+ function buildGhPrListArgs(opts) {
1369
+ const state = normalizePrListState(opts.state);
1370
+ const labels = normalizePrLabels(opts.labels);
1371
+ const reviewer = normalizePrReviewer(opts.reviewer);
1372
+ const query = opts.query?.trim() ?? "";
1373
+ const namedReviewer = reviewer && reviewer !== "all" && reviewer !== "*" && !isUnassignedReviewer(reviewer) ? reviewer === "me" || reviewer === "@me" ? "@me" : (opts.reviewer ?? "").trim().replace(/^@/, "") : "";
1374
+ const useSearch = Boolean(query || namedReviewer || opts.draft === true || opts.draft === false);
1375
+ const args = [
1376
+ "pr",
1377
+ "list",
1378
+ "--json",
1379
+ PR_LIST_JSON_FIELDS,
1380
+ "--limit",
1381
+ String(Math.max(1, Math.min(250, Math.floor(opts.limit))))
1382
+ ];
1383
+ if (useSearch) {
1384
+ const parts = [...searchStateTokens(state)];
1385
+ for (const label of labels) parts.push(searchLabelToken(label));
1386
+ if (namedReviewer) parts.push(`review-requested:${namedReviewer}`);
1387
+ if (opts.draft === true) parts.push("draft:true");
1388
+ if (opts.draft === false) parts.push("draft:false");
1389
+ if (query) parts.push(query);
1390
+ args.push("--search", parts.join(" "));
1391
+ } else {
1392
+ args.push("--state", state);
1393
+ for (const label of labels) args.push("--label", label);
1394
+ }
1395
+ if (opts.slug) args.push("--repo", opts.slug);
1396
+ return args;
1397
+ }
1398
+ function parseGhPrList(stdout) {
1399
+ let parsed;
1400
+ try {
1401
+ parsed = JSON.parse(stdout);
1402
+ } catch {
1403
+ return [];
1404
+ }
1405
+ if (!Array.isArray(parsed)) return [];
1406
+ const out = [];
1407
+ for (const raw of parsed) {
1408
+ if (!raw || typeof raw !== "object") continue;
1409
+ const item = raw;
1410
+ const number = Number(item.number);
1411
+ if (!Number.isFinite(number) || number <= 0) continue;
1412
+ const requested = collectReviewRequests(item.reviewRequests);
1413
+ const reviewRequests = requested.ids;
1414
+ const reviewers = requested.users;
1415
+ const teams = requested.teams;
1416
+ const labels = labelNames(item.labels);
1417
+ const assignees = reviewerIdentities(item.assignees);
1418
+ const authorLogin = item.author?.login?.trim();
1419
+ const title = typeof item.title === "string" ? item.title : "";
1420
+ const tickets = ticketRefsFromPrTitle(title);
1421
+ out.push({
1422
+ number,
1423
+ title,
1424
+ headRefName: typeof item.headRefName === "string" ? item.headRefName : "",
1425
+ url: typeof item.url === "string" ? item.url : "",
1426
+ isCrossRepository: item.isCrossRepository === true,
1427
+ ...authorLogin ? { author: { login: authorLogin } } : {},
1428
+ ...item.isDraft === true ? { isDraft: true } : {},
1429
+ ...typeof item.state === "string" && item.state ? { state: item.state } : {},
1430
+ ...labels.length ? { labels } : {},
1431
+ ...reviewRequests.length ? { reviewRequests } : {},
1432
+ ...reviewers.length ? { reviewers } : {},
1433
+ ...teams.length ? { teams } : {},
1434
+ ...typeof item.reviewDecision === "string" && item.reviewDecision ? { reviewDecision: item.reviewDecision } : {},
1435
+ ...assignees.length ? { assignees } : {},
1436
+ ...tickets.length ? { tickets } : {}
1437
+ });
1438
+ }
1439
+ return out;
1440
+ }
1441
+ function individualReviewers(pr) {
1442
+ if (pr.reviewers?.length) return pr.reviewers;
1443
+ return humanReviewerLogins(pr.reviewRequests);
1444
+ }
1445
+ function teamSlugsOnPr(pr) {
1446
+ if (pr.teams?.length) return pr.teams;
1447
+ return teamReviewerSlugs(pr.reviewRequests);
1448
+ }
1449
+ function requestedOfViewerTeam(pr, viewerTeams) {
1450
+ if (!viewerTeams?.length) return true;
1451
+ const mine = new Set(viewerTeams.map((slug) => slug.trim().toLowerCase()).filter(Boolean));
1452
+ if (mine.size === 0) return true;
1453
+ const teams = teamSlugsOnPr(pr);
1454
+ if (teams.length === 0) return true;
1455
+ return teams.some((slug) => mine.has(slug.toLowerCase()));
1456
+ }
1457
+ function prMatchesReviewer(pr, reviewer, viewerTeams) {
1458
+ const key = normalizePrReviewer(reviewer);
1459
+ if (!key || key === "all" || key === "*") return true;
1460
+ const humans = individualReviewers(pr);
1461
+ if (key === "unassigned" || key === "none" || key === "null") {
1462
+ return humans.length === 0 && requestedOfViewerTeam(pr, viewerTeams);
1463
+ }
1464
+ if (key === "me" || key === "@me") return true;
1465
+ return humans.some((login) => login.toLowerCase() === key);
1466
+ }
1467
+ function filterPrsByReviewer(prs, reviewer, viewerTeams) {
1468
+ return prs.filter((pr) => prMatchesReviewer(pr, reviewer, viewerTeams));
1469
+ }
1470
+ function filterListedPrs(prs, opts) {
1471
+ let out = filterPrsByReviewer(prs, opts?.reviewer, opts?.viewerTeams);
1472
+ if (opts?.draft === false) out = out.filter((pr) => !pr.isDraft);
1473
+ if (opts?.draft === true) out = out.filter((pr) => pr.isDraft);
1474
+ return out;
1475
+ }
1476
+ function applyPrListResponse(stdout, opts) {
1477
+ const resolved = resolveListPrsOptions(opts);
1478
+ const listed = filterListedPrs(parseGhPrList(stdout), resolved);
1479
+ if (resolved.limit == null) return listed;
1480
+ const n = Math.max(1, Math.min(250, Math.floor(resolved.limit)));
1481
+ return listed.slice(0, n);
1482
+ }
1483
+ async function listGithubViewerTeamSlugs(repoPath) {
1484
+ const { stdout, exitCode } = await gh(
1485
+ ["api", "user/teams", "--paginate"],
1486
+ repoPath,
1487
+ { reject: false }
1488
+ );
1489
+ if (exitCode !== 0 || !stdout.trim()) return [];
1490
+ let parsed;
1491
+ try {
1492
+ parsed = JSON.parse(stdout);
1493
+ } catch {
1494
+ return [];
1495
+ }
1496
+ const rows = Array.isArray(parsed) ? parsed : [];
1497
+ const slugs = [];
1498
+ const seen = /* @__PURE__ */ new Set();
1499
+ for (const row of rows) {
1500
+ if (!row || typeof row !== "object") continue;
1501
+ const slug = row.slug;
1502
+ if (typeof slug !== "string" || !slug.trim()) continue;
1503
+ const key = slug.trim().toLowerCase();
1504
+ if (seen.has(key)) continue;
1505
+ seen.add(key);
1506
+ slugs.push(slug.trim());
1507
+ }
1508
+ return slugs;
1509
+ }
1510
+
1153
1511
  // src/util/enqueue-by-key.ts
1154
1512
  var tails = /* @__PURE__ */ new Map();
1155
1513
  function enqueueByKey(key, fn) {
@@ -1696,20 +2054,33 @@ async function listBranches(repoPath, opts) {
1696
2054
  }
1697
2055
  return sorted.filter((b) => keep.has(b.name));
1698
2056
  }
1699
- async function listPrs(repoPath) {
2057
+ async function listPrs(repoPath, opts) {
1700
2058
  const slug = await resolveGithubRepoSlug(repoPath);
1701
- const args = [
1702
- "pr",
1703
- "list",
1704
- "--json",
1705
- "number,title,headRefName,url,isCrossRepository,author",
1706
- "--limit",
1707
- "200"
1708
- ];
1709
- if (slug) args.push("--repo", slug);
2059
+ const resolved = resolveListPrsOptions(opts);
2060
+ const limit = resolved.limit ?? 200;
2061
+ const reviewerKey = (resolved.reviewer ?? "").trim().toLowerCase();
2062
+ const needsUnclaimed = reviewerKey === "unassigned" || reviewerKey === "none" || reviewerKey === "null";
2063
+ let profile;
2064
+ try {
2065
+ profile = resolveViewerProfileForRepo(repoPath);
2066
+ } catch {
2067
+ profile = resolveViewerProfile();
2068
+ }
2069
+ const fetchedTeams = needsUnclaimed ? await listGithubViewerTeamSlugs(repoPath).catch(() => []) : [];
2070
+ const viewerTeams = resolved.viewerTeams ?? (needsUnclaimed ? preferTeamsForRole(fetchedTeams, profile.reviewTeamHints) : void 0);
2071
+ const fetchLimit = prListFetchLimit(limit, resolved.reviewer);
2072
+ const args = buildGhPrListArgs({
2073
+ slug,
2074
+ state: resolved.state,
2075
+ labels: resolved.labels,
2076
+ reviewer: resolved.reviewer,
2077
+ query: resolved.query,
2078
+ draft: resolved.draft,
2079
+ limit: fetchLimit
2080
+ });
1710
2081
  const { stdout, exitCode } = await gh(args, repoPath, { reject: false });
1711
2082
  if (exitCode !== 0 || !stdout.trim()) return [];
1712
- return JSON.parse(stdout);
2083
+ return applyPrListResponse(stdout, { ...resolved, limit, viewerTeams });
1713
2084
  }
1714
2085
  async function getPr(repoPath, number) {
1715
2086
  const slug = await resolveGithubRepoSlug(repoPath);
@@ -2863,6 +3234,7 @@ export {
2863
3234
  codexSandboxWritableRootsArgs,
2864
3235
  codexUnattendedGitConfigArgs,
2865
3236
  formatGitAuthModeDirective,
3237
+ resolveListPrsOptions,
2866
3238
  enqueueByKey,
2867
3239
  withRepoGitLock,
2868
3240
  detectGhStack,
@@ -12,7 +12,7 @@ import {
12
12
  } from "./chunk-FNQNJOHY.js";
13
13
  import {
14
14
  appDataDir
15
- } from "./chunk-BD2ICC4D.js";
15
+ } from "./chunk-JTJHOYCU.js";
16
16
 
17
17
  // src/brightsy/connected-teams.ts
18
18
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
@@ -7,7 +7,7 @@ import {
7
7
  threadFilePath,
8
8
  threadLockPath,
9
9
  threadsDir
10
- } from "./chunk-BD2ICC4D.js";
10
+ } from "./chunk-JTJHOYCU.js";
11
11
 
12
12
  // src/store/thread-store.ts
13
13
  import { randomUUID } from "crypto";
@@ -5,7 +5,7 @@ import {
5
5
  } from "./chunk-NSTQ6QKD.js";
6
6
  import {
7
7
  appDataDir
8
- } from "./chunk-BD2ICC4D.js";
8
+ } from "./chunk-JTJHOYCU.js";
9
9
 
10
10
  // src/store/caffeinate-hold.ts
11
11
  import { spawn } from "child_process";
@@ -1,21 +1,21 @@
1
+ import {
2
+ isOrchestratorThread
3
+ } from "./chunk-2F63IMCL.js";
4
+ import {
5
+ codexUnattendedGitConfigArgs,
6
+ mergeAgentGitAuthEnv,
7
+ resolveAgentGitAuthEnv,
8
+ resolveCodexGitWritableRoots
9
+ } from "./chunk-LQMFCS54.js";
1
10
  import {
2
11
  applyConnectedTeamToCli,
3
12
  brightsyMcpServerName,
4
13
  ensureCliTeamTracked,
5
14
  ensureConnectedBrightsyTeamTokens
6
- } from "./chunk-7F4XE6UG.js";
15
+ } from "./chunk-XD2BAANL.js";
7
16
  import {
8
17
  loadBrightsyConfig
9
18
  } from "./chunk-M267JPEA.js";
10
- import {
11
- isOrchestratorThread
12
- } from "./chunk-G4MTYUWS.js";
13
- import {
14
- codexUnattendedGitConfigArgs,
15
- mergeAgentGitAuthEnv,
16
- resolveAgentGitAuthEnv,
17
- resolveCodexGitWritableRoots
18
- } from "./chunk-GE7M3QTE.js";
19
19
  import {
20
20
  applyAgentRunnerHeapEnv,
21
21
  applyNodeLaunch,
@@ -34,14 +34,14 @@ import {
34
34
  loadAppSettings,
35
35
  resolveAgentExecutable,
36
36
  resolveClaudeExecutable
37
- } from "./chunk-4XNSGDXE.js";
37
+ } from "./chunk-3BWVOUQG.js";
38
38
  import {
39
39
  isElectronLikeCommand,
40
40
  unwrapStrippedElectronLaunch
41
41
  } from "./chunk-4TR3HZFT.js";
42
42
  import {
43
43
  appDataDir
44
- } from "./chunk-QZQEXME2.js";
44
+ } from "./chunk-EFVFB2AH.js";
45
45
  import {
46
46
  enrichPathWithNpmGlobalBin,
47
47
  isConductorBundledCli,
@@ -1777,7 +1777,7 @@ var claudeAdapter = {
1777
1777
  );
1778
1778
  }
1779
1779
  const mode = permissionMode(thread);
1780
- const { isOrchestratorThread: isOrchestratorThread2 } = await import("./global-workspace-IY5QAV5C.js");
1780
+ const { isOrchestratorThread: isOrchestratorThread2 } = await import("./global-workspace-2BRRKSDN.js");
1781
1781
  const isOrchestrator = isOrchestratorThread2(thread);
1782
1782
  const injectedServers = await buildInjectedMcpServers({
1783
1783
  includeSideboard: true,