@sideboard-ai/core 0.1.157 → 0.1.159

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 (38) hide show
  1. package/dist/{abletime-BEIDJG7W.js → abletime-HOQBDQC4.js} +2 -2
  2. package/dist/{abletime-GWZE6OYM.js → abletime-LK7GV556.js} +2 -2
  3. package/dist/{agents-LCDXN2B2.js → agents-5HY76BCR.js} +4 -4
  4. package/dist/{agents-C55LAEUR.js → agents-67ZBH5OE.js} +5 -5
  5. package/dist/{app-settings-VRQI3FIE.js → app-settings-BJ5GFAE5.js} +13 -17
  6. package/dist/{app-settings-H3INSR67.js → app-settings-YWJ4MVYM.js} +13 -17
  7. package/dist/{chunk-NVXVEGGM.js → chunk-5U4NZLBH.js} +4 -0
  8. package/dist/{chunk-DVJBO3M7.js → chunk-AGLPYXDT.js} +1 -1
  9. package/dist/{chunk-KQ4JOGUH.js → chunk-DWUOKF3W.js} +11 -5
  10. package/dist/{chunk-D7EGJ3EI.js → chunk-EQIJ5MHR.js} +119 -110
  11. package/dist/{chunk-3BWVOUQG.js → chunk-FLG4A5FJ.js} +119 -110
  12. package/dist/{chunk-2SDMENAL.js → chunk-JV4VNFMS.js} +1 -1
  13. package/dist/{chunk-LQMFCS54.js → chunk-KEDHHXKW.js} +3 -13
  14. package/dist/{chunk-CJQLPPEJ.js → chunk-MEZXWELT.js} +4 -14
  15. package/dist/{chunk-CVR4RJ6G.js → chunk-O7RWWPMR.js} +12 -13
  16. package/dist/{chunk-GWEEGE6L.js → chunk-OYOXLY6B.js} +404 -115
  17. package/dist/{chunk-4I4VKAPZ.js → chunk-SIMFKJIB.js} +13 -14
  18. package/dist/{chunk-SUCJAWV4.js → chunk-TGU3LSDG.js} +402 -113
  19. package/dist/{chunk-N27GVFZY.js → chunk-UBMCEZRE.js} +1 -1
  20. package/dist/{chunk-TIJ6QVX5.js → chunk-V4R6L2ZL.js} +15 -6
  21. package/dist/{coordinator-prompt-AM47SATF.js → coordinator-prompt-7NKY7QRK.js} +4 -4
  22. package/dist/{coordinator-prompt-26IJU2AV.js → coordinator-prompt-CNI6AK65.js} +3 -3
  23. package/dist/{global-workspace-QV7CC7SK.js → global-workspace-FKAJZHO5.js} +4 -4
  24. package/dist/{global-workspace-5BIW26YR.js → global-workspace-IJYCUO4M.js} +3 -3
  25. package/dist/index.cjs +1037 -648
  26. package/dist/index.d.cts +71 -57
  27. package/dist/index.d.ts +71 -57
  28. package/dist/index.js +339 -250
  29. package/dist/mcp/run-stdio.cjs +967 -575
  30. package/dist/mcp/run-stdio.js +283 -187
  31. package/dist/{orchestrator-BUH3LJLL.js → orchestrator-KFLS5BTP.js} +5 -5
  32. package/dist/{orchestrator-KQO4MXBI.js → orchestrator-NSVP7DJH.js} +7 -7
  33. package/dist/{plan-file-OZEBFSGQ.js → plan-file-I24VJVP2.js} +2 -2
  34. package/dist/{workspaces-NYSM2EPX.js → workspaces-D2M3AM2M.js} +3 -3
  35. package/dist/{workspaces-Q2VCHIAS.js → workspaces-OFSDJ7PZ.js} +4 -4
  36. package/dist/{worktree-PEWDAX5O.js → worktree-BQE5KLRY.js} +3 -3
  37. package/dist/{worktree-T4SWFSTT.js → worktree-EA6AD6D6.js} +2 -2
  38. package/package.json +1 -1
@@ -19,42 +19,34 @@ import { homedir, hostname } from "os";
19
19
  import { join as join2 } from "path";
20
20
 
21
21
  // src/store/account-profile.ts
22
- var ACCOUNT_ROLE_PRESETS = ["engineering", "design", "product"];
23
- var ACCOUNT_ROLES = ACCOUNT_ROLE_PRESETS;
24
- var ACCOUNT_ROLE_MAX = 16;
25
22
  var PROFILE_NOTES_MAX = 2e3;
26
- var ACCOUNT_ROLE_LABELS = {
23
+ var LEGACY_ROLE_LABELS = {
27
24
  engineering: "Engineering",
28
25
  design: "Design",
29
26
  product: "Product",
30
27
  qa: "QA"
31
28
  };
32
- var ROLE_TEAM_HINTS = {
33
- engineering: ["engineering-team", "engineering", "eng-team"],
34
- design: ["design-team", "design"],
35
- product: ["product-team", "product"]
36
- };
37
- function accountRoleLabel(role) {
38
- const known = ACCOUNT_ROLE_LABELS[role];
29
+ function legacyRoleLabel(role) {
30
+ const known = LEGACY_ROLE_LABELS[role];
39
31
  if (known) return known;
40
32
  return role.split("-").filter(Boolean).map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join(" ");
41
33
  }
42
- function normalizeAccountRole(value) {
34
+ function normalizeLegacyRole(value) {
43
35
  const key = (value ?? "").trim().toLowerCase().replace(/[_\s]+/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "");
44
36
  if (key === "both") return void 0;
45
37
  if (key.length < 2 || key.length > 40) return void 0;
46
38
  if (!/^[a-z][a-z0-9-]*$/.test(key)) return void 0;
47
39
  return key;
48
40
  }
49
- function normalizeAccountRoles(roles, legacyRole) {
41
+ function legacyRoleLabels(roles, legacyRole) {
50
42
  const raw = Array.isArray(roles) ? roles : [];
51
43
  const out = [];
52
44
  const seen = /* @__PURE__ */ new Set();
53
45
  const push = (value) => {
54
- const role = normalizeAccountRole(typeof value === "string" ? value : "");
55
- if (!role || seen.has(role) || out.length >= ACCOUNT_ROLE_MAX) return;
46
+ const role = normalizeLegacyRole(typeof value === "string" ? value : "");
47
+ if (!role || seen.has(role) || out.length >= 16) return;
56
48
  seen.add(role);
57
- out.push(role);
49
+ out.push(legacyRoleLabel(role));
58
50
  };
59
51
  for (const item of raw) push(item);
60
52
  if (out.length === 0) push(legacyRole);
@@ -64,97 +56,71 @@ function normalizeProfileNotes(value) {
64
56
  if (typeof value !== "string") return "";
65
57
  return value.replace(/\r\n/g, "\n").trim().slice(0, PROFILE_NOTES_MAX);
66
58
  }
67
- function reviewTeamHintsForRoles(roles) {
68
- const seen = /* @__PURE__ */ new Set();
69
- const out = [];
70
- for (const role of roles) {
71
- const hints = ROLE_TEAM_HINTS[role] ?? teamHintsForCustomRole(role);
72
- for (const hint of hints) {
73
- const key = hint.toLowerCase();
74
- if (seen.has(key)) continue;
75
- seen.add(key);
76
- out.push(hint);
77
- }
78
- }
79
- return out;
80
- }
81
- function teamHintsForCustomRole(role) {
82
- const slug = role.trim().toLowerCase();
83
- if (!slug) return [];
84
- if (slug.endsWith("-team") || slug.endsWith("-squad")) return [slug];
85
- return [`${slug}-team`, slug];
59
+ function foldLegacyRolesIntoNotes(roles, legacyRole, notes) {
60
+ const text = normalizeProfileNotes(notes);
61
+ const labels = legacyRoleLabels(roles, legacyRole);
62
+ if (!labels.length) return text;
63
+ if (text.toLowerCase().startsWith("roles:")) return text;
64
+ const prefix = `Roles: ${labels.join(", ")}`;
65
+ return text ? `${prefix}. ${text}` : prefix;
86
66
  }
87
67
  function resolveAccountProfile(input) {
88
68
  return resolveViewerProfile(input);
89
69
  }
90
70
  function resolveViewerProfile(account, project) {
91
- const accountRoles = normalizeAccountRoles(account?.roles, account?.role);
92
- const projectRoles = normalizeAccountRoles(project?.roles, project?.role);
93
- const rolesFromProject = projectRoles.length > 0;
94
- const roles = rolesFromProject ? projectRoles : accountRoles;
95
- const accountNotes = normalizeProfileNotes(account?.notes);
96
- const projectNotes = normalizeProfileNotes(project?.notes);
97
- const notes = [accountNotes, projectNotes].filter(Boolean).join("\n");
71
+ const accountNotes = foldLegacyRolesIntoNotes(
72
+ account?.roles,
73
+ account?.role,
74
+ account?.notes
75
+ );
76
+ const projectNotes = foldLegacyRolesIntoNotes(
77
+ project?.roles,
78
+ project?.role,
79
+ project?.notes
80
+ );
98
81
  return {
99
- roles,
100
- roleLabels: roles.map((role) => accountRoleLabel(role)),
101
- reviewTeamHints: reviewTeamHintsForRoles(roles),
102
- notes,
82
+ notes: [accountNotes, projectNotes].filter(Boolean).join("\n"),
103
83
  accountNotes,
104
- projectNotes,
105
- rolesFromProject
84
+ projectNotes
106
85
  };
107
86
  }
108
- function preferTeamsForRole(viewerTeams, hints) {
109
- const teams = viewerTeams.map((t) => t.trim()).filter(Boolean);
110
- const want = hints.map((t) => t.trim()).filter(Boolean);
111
- if (!want.length) return teams;
112
- if (!teams.length) return want;
113
- const hintKeys = want.map((t) => t.toLowerCase());
114
- const matched = teams.filter((team) => {
115
- const key = team.toLowerCase();
116
- return hintKeys.some((hint) => key === hint || key.includes(hint) || hint.includes(key));
117
- });
118
- return matched.length ? matched : teams;
119
- }
120
87
  function compactNotes(notes, max = 160) {
121
88
  const oneLine = notes.replace(/\s+/g, " ").trim();
122
89
  if (oneLine.length <= max) return oneLine;
123
90
  return `${oneLine.slice(0, max - 1).trimEnd()}\u2026`;
124
91
  }
125
92
  function formatAccountProfilePlaybookLine(profile) {
126
- if (profile.roleLabels.length === 0 && !profile.notes) return "";
127
- const parts = [];
128
- if (profile.roleLabels.length) {
129
- parts.push(
130
- `roles ${profile.roleLabels.join(", ")} (tickets to work on / PRs to review; prefer those teams)`
131
- );
132
- }
133
- if (profile.notes) {
134
- parts.push(`notes: ${compactNotes(profile.notes)}`);
135
- }
136
- return `- Viewer profile: ${parts.join(". ")}. A team review request is not a claim \u2014 only an individual reviewer is. When they ask to find work, use these notes with list_issues (tickets) and list_prs(queue=review) (reviews) and show the options. Only create_thread and start when they also asked to start.`;
93
+ if (!profile.accountNotes) return "";
94
+ return `- Account context (Settings \u2192 Agents): ${compactNotes(profile.accountNotes)}. When they ask to find work, use this with list_issues (tickets) and list_prs(queue=review) (reviews) and show the options. Only create_thread and start when they also asked to start. To change it, show the proposed text, ask_user (Save this context / Do not save), wait, then update_viewer_context(scope=account, confirmed=true).`;
137
95
  }
138
96
  function formatProjectProfilePlaybookLines(projects) {
139
97
  const lines = projects.map((project) => {
140
- const roles = (project.roleLabels ?? []).filter(Boolean);
141
98
  const notes = normalizeProfileNotes(project.notes);
142
- if (!roles.length && !notes) return "";
143
- const bits = [];
144
- if (roles.length) bits.push(`roles ${roles.join(", ")}`);
145
- if (notes) bits.push(compactNotes(notes, 120));
146
- return `- ${project.name}: ${bits.join(". ")}`;
99
+ if (!notes) return "";
100
+ return `- ${project.name}: ${compactNotes(notes, 120)}`;
147
101
  }).filter(Boolean);
148
102
  if (!lines.length) return "";
149
- return ["Project overrides (Settings \u2192 Projects; empty roles inherit account):", ...lines].join(
150
- "\n"
151
- );
103
+ return [
104
+ "Project context (Settings \u2192 Projects; adds to account context):",
105
+ ...lines
106
+ ].join("\n");
152
107
  }
153
108
  function formatWorkspaceProfileSuffix(profile) {
154
- const bits = [];
155
- if (profile.roles.length) bits.push(`roles:${profile.roles.join(",")}`);
156
- if (profile.projectNotes) bits.push(`notes:${compactNotes(profile.projectNotes, 80)}`);
157
- return bits.length ? ` ${bits.join(" ")}` : "";
109
+ if (!profile.projectNotes) return "";
110
+ return ` context:${compactNotes(profile.projectNotes, 80)}`;
111
+ }
112
+ function formatViewerContextDirective(profile) {
113
+ const account = profile.accountNotes || "(empty)";
114
+ const project = profile.projectNotes || "(empty \u2014 account context applies)";
115
+ return [
116
+ "Viewer context (Settings \u2192 Agents / Projects) \u2014 how to find this user\u2019s tickets and review PRs:",
117
+ `- Account: ${compactNotes(profile.accountNotes || account, 240)}`,
118
+ `- This project: ${compactNotes(profile.projectNotes || project, 240)}`,
119
+ "To change these, show the proposed text in chat, call ask_user (Save this context / Do not save), wait for the answer, then update_viewer_context with confirmed=true. Never write context without confirmation. get_viewer_context reads the current values."
120
+ ].join("\n");
121
+ }
122
+ function formatViewerContextReminder() {
123
+ return "Viewer context: get_viewer_context to read; update_viewer_context only after ask_user confirms (Save this context / Do not save).";
158
124
  }
159
125
 
160
126
  // src/store/secret-vault.ts
@@ -654,9 +620,7 @@ function normalizeDefaults(raw) {
654
620
  if (typeof source.fast === "boolean") {
655
621
  out.fast = source.fast;
656
622
  }
657
- const roles = normalizeAccountRoles(source.roles, source.role);
658
- if (roles.length) out.roles = roles;
659
- const notes = normalizeProfileNotes(source.notes);
623
+ const notes = foldLegacyRolesIntoNotes(source.roles, source.role, source.notes);
660
624
  if (notes) out.notes = notes;
661
625
  return out;
662
626
  }
@@ -667,11 +631,9 @@ function normalizeProjectProfile(raw) {
667
631
  if (!raw || typeof raw !== "object") return void 0;
668
632
  const source = raw;
669
633
  const out = {};
670
- const roles = normalizeAccountRoles(source.roles, source.role);
671
- if (roles.length) out.roles = roles;
672
- const notes = normalizeProfileNotes(source.notes);
634
+ const notes = foldLegacyRolesIntoNotes(source.roles, source.role, source.notes);
673
635
  if (notes) out.notes = notes;
674
- return out.roles || out.notes ? out : void 0;
636
+ return out.notes ? out : void 0;
675
637
  }
676
638
  function normalizeProjects(raw) {
677
639
  if (!raw || typeof raw !== "object" || Array.isArray(raw)) return {};
@@ -1241,17 +1203,13 @@ function updateDefaultsSettings(patch) {
1241
1203
  defaults.fast = Boolean(patch.fast);
1242
1204
  }
1243
1205
  }
1244
- if ("roles" in patch) {
1245
- const roles = normalizeAccountRoles(patch.roles);
1246
- if (!roles.length) delete defaults.roles;
1247
- else defaults.roles = roles;
1248
- delete defaults.role;
1249
- }
1250
1206
  if ("notes" in patch) {
1251
1207
  const notes = normalizeProfileNotes(patch.notes);
1252
1208
  if (!notes) delete defaults.notes;
1253
1209
  else defaults.notes = notes;
1254
1210
  }
1211
+ delete defaults.roles;
1212
+ delete defaults.role;
1255
1213
  return saveAppSettings({ ...current, defaults });
1256
1214
  }
1257
1215
  function updateProjectProfileSettings(repoPath, patch) {
@@ -1261,17 +1219,14 @@ function updateProjectProfileSettings(repoPath, patch) {
1261
1219
  const projects = { ...current.projects };
1262
1220
  const existing = projects[key] ?? {};
1263
1221
  const next = { ...existing };
1264
- if ("roles" in patch) {
1265
- const roles = normalizeAccountRoles(patch.roles);
1266
- if (!roles.length) delete next.roles;
1267
- else next.roles = roles;
1268
- }
1269
1222
  if ("notes" in patch) {
1270
1223
  const notes = normalizeProfileNotes(patch.notes);
1271
1224
  if (!notes) delete next.notes;
1272
1225
  else next.notes = notes;
1273
1226
  }
1274
- if (!next.roles?.length && !next.notes) delete projects[key];
1227
+ delete next.roles;
1228
+ delete next.role;
1229
+ if (!next.notes) delete projects[key];
1275
1230
  else projects[key] = next;
1276
1231
  return saveAppSettings({ ...current, projects });
1277
1232
  }
@@ -1296,6 +1251,62 @@ function resolveViewerProfileForRepo(repoPath, settings = loadAppSettings()) {
1296
1251
  const project = key ? settings.projects[key] : void 0;
1297
1252
  return resolveViewerProfile(settings.defaults, project);
1298
1253
  }
1254
+ function readViewerContext(repoPath) {
1255
+ const settings = loadAppSettings();
1256
+ const key = findProjectProfileKey(settings.projects, repoPath);
1257
+ const resolved = resolveViewerProfile(
1258
+ settings.defaults,
1259
+ key ? settings.projects[key] : void 0
1260
+ );
1261
+ return {
1262
+ account: resolved.accountNotes,
1263
+ project: resolved.projectNotes,
1264
+ combined: resolved.notes,
1265
+ repoPath: key ?? (repoPath?.trim() ? profileRepoKey(repoPath) : null)
1266
+ };
1267
+ }
1268
+ var CONFIRM_ACCOUNT = "Show the user the proposed account context, call ask_user (Save this context / Do not save), wait for their answer, then retry with confirmed=true.";
1269
+ var CONFIRM_PROJECT = "Show the user the proposed project context, call ask_user (Save this context / Do not save), wait for their answer, then retry with confirmed=true.";
1270
+ function writeViewerContext(input) {
1271
+ const proposed = normalizeProfileNotes(input.context);
1272
+ if (input.scope === "project") {
1273
+ const settings = loadAppSettings();
1274
+ const key = findProjectProfileKey(settings.projects, input.repoPath) ?? profileRepoKey(input.repoPath ?? "");
1275
+ if (!key) {
1276
+ return {
1277
+ ok: false,
1278
+ error: "repoPath required",
1279
+ message: "Pass repoPath (or run from a registered worktree) when updating project context.",
1280
+ current: "",
1281
+ proposed
1282
+ };
1283
+ }
1284
+ const current2 = resolveViewerProfileForRepo(key, settings).projectNotes;
1285
+ if (!input.confirmed) {
1286
+ return {
1287
+ ok: false,
1288
+ error: "Confirmation required",
1289
+ message: CONFIRM_PROJECT,
1290
+ current: current2,
1291
+ proposed
1292
+ };
1293
+ }
1294
+ updateProjectProfileSettings(key, { notes: proposed || null });
1295
+ return { ok: true, scope: "project", context: proposed, repoPath: key };
1296
+ }
1297
+ const current = resolveAccountProfileFromSettings().accountNotes;
1298
+ if (!input.confirmed) {
1299
+ return {
1300
+ ok: false,
1301
+ error: "Confirmation required",
1302
+ message: CONFIRM_ACCOUNT,
1303
+ current,
1304
+ proposed
1305
+ };
1306
+ }
1307
+ updateDefaultsSettings({ notes: proposed || null });
1308
+ return { ok: true, scope: "account", context: proposed };
1309
+ }
1299
1310
  function resolveThreadDefaults(settings = loadAppSettings()) {
1300
1311
  return {
1301
1312
  agent: getDefaultAgent(settings),
@@ -1650,19 +1661,15 @@ function harnessEnvKey(harness) {
1650
1661
  }
1651
1662
 
1652
1663
  export {
1653
- ACCOUNT_ROLE_PRESETS,
1654
- ACCOUNT_ROLES,
1655
- ACCOUNT_ROLE_MAX,
1656
1664
  PROFILE_NOTES_MAX,
1657
- ACCOUNT_ROLE_LABELS,
1658
- accountRoleLabel,
1659
- reviewTeamHintsForRoles,
1665
+ foldLegacyRolesIntoNotes,
1660
1666
  resolveAccountProfile,
1661
1667
  resolveViewerProfile,
1662
- preferTeamsForRole,
1663
1668
  formatAccountProfilePlaybookLine,
1664
1669
  formatProjectProfilePlaybookLines,
1665
1670
  formatWorkspaceProfileSuffix,
1671
+ formatViewerContextDirective,
1672
+ formatViewerContextReminder,
1666
1673
  setVaultMasterKey,
1667
1674
  persistVaultKeyInKeychain,
1668
1675
  readKeychainVaultKey,
@@ -1697,6 +1704,8 @@ export {
1697
1704
  getDefaultFast,
1698
1705
  resolveAccountProfileFromSettings,
1699
1706
  resolveViewerProfileForRepo,
1707
+ readViewerContext,
1708
+ writeViewerContext,
1700
1709
  resolveThreadDefaults,
1701
1710
  resolveNewThreadOptions,
1702
1711
  isLinearConnected,
@@ -4,7 +4,7 @@ import {
4
4
  ATTACHMENTS_DIR,
5
5
  LEGACY_ATTACHMENTS_DIR,
6
6
  attachmentsGitignoreBody
7
- } from "./chunk-NVXVEGGM.js";
7
+ } from "./chunk-5U4NZLBH.js";
8
8
 
9
9
  // src/plan/plan-file.ts
10
10
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
@@ -3,11 +3,8 @@ import {
3
3
  } from "./chunk-JRH62XC4.js";
4
4
  import {
5
5
  getGithubGitAuthMode,
6
- getGithubPat,
7
- preferTeamsForRole,
8
- resolveViewerProfile,
9
- resolveViewerProfileForRepo
10
- } from "./chunk-3BWVOUQG.js";
6
+ getGithubPat
7
+ } from "./chunk-FLG4A5FJ.js";
11
8
  import {
12
9
  listThreads
13
10
  } from "./chunk-7UURXPKD.js";
@@ -2060,14 +2057,7 @@ async function listPrs(repoPath, opts) {
2060
2057
  const limit = resolved.limit ?? 200;
2061
2058
  const reviewerKey = (resolved.reviewer ?? "").trim().toLowerCase();
2062
2059
  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);
2060
+ const viewerTeams = resolved.viewerTeams ?? (needsUnclaimed ? await listGithubViewerTeamSlugs(repoPath).catch(() => []) : void 0);
2071
2061
  const fetchLimit = prListFetchLimit(limit, resolved.reviewer);
2072
2062
  const args = buildGhPrListArgs({
2073
2063
  slug,
@@ -2,7 +2,7 @@
2
2
 
3
3
  import {
4
4
  isWorkspaceScratchPath
5
- } from "./chunk-NVXVEGGM.js";
5
+ } from "./chunk-5U4NZLBH.js";
6
6
  import {
7
7
  listThreads
8
8
  } from "./chunk-LZQULFIT.js";
@@ -21,11 +21,8 @@ import {
21
21
  } from "./chunk-FNQNJOHY.js";
22
22
  import {
23
23
  getGithubGitAuthMode,
24
- getGithubPat,
25
- preferTeamsForRole,
26
- resolveViewerProfile,
27
- resolveViewerProfileForRepo
28
- } from "./chunk-D7EGJ3EI.js";
24
+ getGithubPat
25
+ } from "./chunk-EQIJ5MHR.js";
29
26
  import {
30
27
  worktreesRoot
31
28
  } from "./chunk-JTJHOYCU.js";
@@ -2023,14 +2020,7 @@ async function listPrs(repoPath, opts) {
2023
2020
  const limit = resolved.limit ?? 200;
2024
2021
  const reviewerKey = (resolved.reviewer ?? "").trim().toLowerCase();
2025
2022
  const needsUnclaimed = reviewerKey === "unassigned" || reviewerKey === "none" || reviewerKey === "null";
2026
- let profile;
2027
- try {
2028
- profile = resolveViewerProfileForRepo(repoPath);
2029
- } catch {
2030
- profile = resolveViewerProfile();
2031
- }
2032
- const fetchedTeams = needsUnclaimed ? await listGithubViewerTeamSlugs(repoPath).catch(() => []) : [];
2033
- const viewerTeams = resolved.viewerTeams ?? (needsUnclaimed ? preferTeamsForRole(fetchedTeams, profile.reviewTeamHints) : void 0);
2023
+ const viewerTeams = resolved.viewerTeams ?? (needsUnclaimed ? await listGithubViewerTeamSlugs(repoPath).catch(() => []) : void 0);
2034
2024
  const fetchLimit = prListFetchLimit(limit, resolved.reviewer);
2035
2025
  const args = buildGhPrListArgs({
2036
2026
  slug,
@@ -5,7 +5,7 @@ import {
5
5
  resolveRepoRoot,
6
6
  takenSlugsFromThread,
7
7
  teamSlugFromName
8
- } from "./chunk-LQMFCS54.js";
8
+ } from "./chunk-KEDHHXKW.js";
9
9
  import {
10
10
  ATTACHMENTS_DIR,
11
11
  attachmentsGitignoreBody
@@ -20,7 +20,7 @@ import {
20
20
  resolveThreadDefaults,
21
21
  resolveViewerProfile,
22
22
  resolveViewerProfileForRepo
23
- } from "./chunk-3BWVOUQG.js";
23
+ } from "./chunk-FLG4A5FJ.js";
24
24
  import {
25
25
  createEmptyThread,
26
26
  listThreads,
@@ -392,10 +392,10 @@ var COORDINATOR_TOOL_PLAYBOOK = [
392
392
  "Role: you oversee Sideboard worktree agents across registered repos. You do not live inside one of those worktrees.",
393
393
  "Sideboard MCP (fleet control \u2014 prefer these for status and orchestration):",
394
394
  "Discover:",
395
- "- list_workspaces \u2014 registered repos (path + github slug + roles/notes when set). Use that profile to pick the right repo for tickets or reviews.",
395
+ "- list_workspaces \u2014 registered repos (path + github slug + project context when set). Use account / project context to pick the right repo for tickets or reviews.",
396
396
  "- list_board \u2014 Home Kanban of worktrees (New / Draft / Review / Merged; one card per checkout). Path to merge: no PR \u2192 draft PR \u2192 open PR \u2192 merged. Archive removes the card to Settings \u2192 History. Queued/running are activity on the card, not columns. Orchestration chats are not on the board. Filters: query, repoPath, kind, column, limit.",
397
- '- list_branches / list_prs / list_issues \u2014 pass repoPath from list_workspaces. Review is PRs (the surface for assigned ticket work), not the tickets: "Get me N tickets to review" \u2192 list_prs(queue=review, limit=N) then create_thread sourceType=pr. That is open non-draft PRs labeled eng-review with no individual user reviewer yet. A team request (engineering-team) is not a claim \u2014 the viewer is on that team and can pick it up; claimed means an individual account is the reviewer. Bots ignored. Prefer teams that match Settings \u2192 Agents / Projects roles (check one or more of Engineering, Design, Product, or extras they added \u2014 never a combined both value; project roles override account for that repo). queue=mine is review-requested:@me; queue=approved|changes uses those labels. Also: state, label, reviewer=me|unassigned|login, query, limit default 40 max 250; raise limit or tighten when truncated. list_issues (query, assignee=me|unassigned|all|user, limit default 40 max 250) lists Linear, AbleTime, or GitHub tickets \u2014 do not use it for that review-inbox ask. When they ask for tickets to work on, use their notes (assignee=me or unassigned as the notes say) and prefer ones that match their roles.',
398
- "- Find work: when they ask to find work, pick up tickets, or list reviews, use Settings \u2192 Agents (account) plus Settings \u2192 Projects (per-repo) roles and notes. Tickets \u2192 Sideboard list_issues / linear_* (Account Linear). Reviews \u2192 list_prs(queue=review). Do not call Claude Linear MCP or any other vendor Linear MCP \u2014 those HTTP connectors hang or flap on the first turn. If a vendor MCP is down or reconnecting, ignore it and keep going with Sideboard tools. Show the options \u2014 do not create_thread or start unless they also asked to start (e.g. \u201Cfind me work and start it\u201D). Do not start this unprompted.",
397
+ '- list_branches / list_prs / list_issues \u2014 pass repoPath from list_workspaces. Review is PRs (the surface for assigned ticket work), not the tickets: "Get me N tickets to review" \u2192 list_prs(queue=review, limit=N) then create_thread sourceType=pr. That is open non-draft PRs labeled eng-review with no individual user reviewer yet. A team request (engineering-team) is not a claim \u2014 the viewer is on that team and can pick it up; claimed means an individual account is the reviewer. Bots ignored. Use Settings \u2192 Agents / Projects context (roles, teams, labels \u2014 freeform text; project adds to account) to prefer the right queues. queue=mine is review-requested:@me; queue=approved|changes uses those labels. Also: state, label, reviewer=me|unassigned|login, query, limit default 40 max 250; raise limit or tighten when truncated. list_issues (query, assignee=me|unassigned|all|user, limit default 40 max 250) lists Linear, AbleTime, or GitHub tickets \u2014 do not use it for that review-inbox ask. When they ask for tickets to work on, follow their context (assignee=me or unassigned as it says).',
398
+ "- Find work: when they ask to find work, pick up tickets, or list reviews, use Settings \u2192 Agents (account) plus Settings \u2192 Projects (per-repo) context. Tickets \u2192 Sideboard list_issues / linear_* (Account Linear). Reviews \u2192 list_prs(queue=review). Do not call Claude Linear MCP or any other vendor Linear MCP \u2014 those HTTP connectors hang or flap on the first turn. If a vendor MCP is down or reconnecting, ignore it and keep going with Sideboard tools. Show the options \u2014 do not create_thread or start unless they also asked to start (e.g. \u201Cfind me work and start it\u201D). Do not start this unprompted. To change that context, show the proposed text, ask_user (Save this context / Do not save), wait, then update_viewer_context with confirmed=true. Never write it without confirmation.",
399
399
  "- linear_* (when Linear is connected) \u2014 list_teams for team key/states; get/create/update/comment with ENG-123. Worktree agents have the same Account tools \u2014 prefer they comment, update status, and create spin-offs (parent=) on their own ticket. Scope errors: reconnect Linear in Account settings. Prefer these over any Linear MCP the CLI may still list.",
400
400
  "- github_* \u2014 get/comment/update/create GitHub issues via Account `gh` (#123). Worktree agents have these too. Prefer over any vendor GitHub MCP. Pass parent= for spin-offs.",
401
401
  "- abletime_* (when AbleTime is connected) \u2014 orientation first; get/comment/update/create (parent= for spin-offs); ensure_task when work has no ticket (or create_thread from the default branch auto-creates one). Worktree agents have the same Account tools.",
@@ -405,7 +405,8 @@ var COORDINATOR_TOOL_PLAYBOOK = [
405
405
  "- get_pr_stack / open_pr_stack_layers / add_stack_layer / create_pr_stack \u2014 GitHub stacked PRs (`gh stack`); one worktree per layer",
406
406
  "- list_models \u2014 only when you need a specific model (rare); otherwise omit model so Account defaults apply",
407
407
  "- list_threads / get_thread \u2014 live thread list (parent id + last message preview). get_thread on this orchestration chat lists child worktree agents (status + lastText). Also includes usage / lastTurnUsage.",
408
- "- ask_user \u2014 composer multiple-choice only when blocked on a concrete choice (approach fork, which API). Never for hellos, check-ins, or invented \u201Cwhat should we do?\u201D menus \u2014 reply in chat. Explain options first, description on every option, then wait.",
408
+ "- ask_user \u2014 composer multiple-choice only when blocked on a concrete choice (approach fork, which API, Save this context / Do not save). Never for hellos, check-ins, or invented \u201Cwhat should we do?\u201D menus \u2014 reply in chat. Explain options first, description on every option, then wait.",
409
+ "- get_viewer_context / update_viewer_context \u2014 read or replace Settings \u2192 Agents (account) and Settings \u2192 Projects (per-repo) context. You can update a project: pass scope=project and repoPath from list_workspaces (this cwd is not a project). update_viewer_context requires confirmed=true after ask_user. Never write context unprompted.",
409
410
  "- set_caffeinate \u2014 keep this Mac awake across turns (macOS caffeinate). Turn on for Slack / away-from-keyboard work, overnight schedules, or when the user will be away. Turn OFF when they say they are done, wrapping up, going to sleep, or no longer need the machine awake. Closing this chat also releases it.",
410
411
  "- list_schedules / create_schedule / update_schedule / delete_schedule / run_schedule \u2014 local jobs that send a prompt to an orchestration chat (threadId or self) or start a new Global chat (omit threadId). One-shot `at`, interval `every` (15m/1h/6h/1d), or 5-field `cron`. Recurring jobs without threadId open a new chat each run. Jobs fire only while Sideboard.app is running; sleep skips until wake. Overnight/unattended runs: ask the user to enable Settings \u2192 Advanced \u2192 Caffeinate while schedules are enabled, or call set_caffeinate.",
411
412
  "Workspaces:",
@@ -464,16 +465,15 @@ function accountRolePlaybookLine() {
464
465
  return "";
465
466
  }
466
467
  }
467
- function accountRoleReminderLine() {
468
+ function accountContextReminderLine() {
468
469
  let profile;
469
470
  try {
470
471
  profile = resolveAccountProfileFromSettings();
471
472
  } catch {
472
473
  return "";
473
474
  }
474
- if (profile.roleLabels.length === 0 && !profile.notes) return "";
475
- const roles = profile.roleLabels.length ? profile.roleLabels.join(", ") : "no roles";
476
- return `- Viewer profile: ${roles}. Use Settings notes with list_issues / list_prs when they ask to find work.`;
475
+ if (!profile.accountNotes) return "";
476
+ return "- Account context is set. Use get_viewer_context / Settings notes with list_issues / list_prs when they ask to find work. Update only after ask_user confirms.";
477
477
  }
478
478
  function projectProfilePlaybookBlock() {
479
479
  let settings;
@@ -490,7 +490,6 @@ function projectProfilePlaybookBlock() {
490
490
  const key = path.replace(/\/+$/, "");
491
491
  return {
492
492
  name: names.get(key) ?? key.split("/").filter(Boolean).pop() ?? path,
493
- roleLabels: resolved.rolesFromProject ? resolved.roleLabels : [],
494
493
  notes: resolved.projectNotes
495
494
  };
496
495
  });
@@ -504,7 +503,7 @@ function coordinatorTurnReminder(opts) {
504
503
  `- YOUR orchestration thread id is ${opts.parentId} \u2014 pass parentThreadId="${opts.parentId}" on create_thread, or omit it.`,
505
504
  goal ? `- Goal / title: ${goal}` : null,
506
505
  accountDefaultsPlaybookLine(),
507
- accountRoleReminderLine() || null,
506
+ accountContextReminderLine() || null,
508
507
  "- Status: list_board (worktree Kanban: New \u2192 Draft \u2192 Review \u2192 Merged) or list_threads. Link chats as `[Title](sideboard://thread/<id>)`. Merge only if the user asked. If a child is stopped/error/broken, it did not finish \u2014 resume or tell the user."
509
508
  ].filter(Boolean).join("\n");
510
509
  }
@@ -558,7 +557,7 @@ function ensureGlobalCoordinatorCwd(opts) {
558
557
  "Never pass `agent=codex` when you yourself are Codex \u2014 nested Codex deadlocks on shared ~/.codex locks. Omit agent (Account default) or use cursor/claude.",
559
558
  "Typical flow (Home board): list_board \u2192 create_thread (sourceType=ticket|pr|branch) \u2192 send_to_thread \u2192 wait_for_turn (loop while stillRunning) \u2192 ask_git create-draft \u2192 wait_for_turn. Merge only if the user explicitly asked (`ask_git` merge).",
560
559
  "Typical flow (branch / explicit source): list_workspaces \u2192 list_branches|list_prs|list_issues \u2192 create_thread \u2192 send_to_thread \u2192 wait_for_turn (loop while stillRunning) \u2192 ask_git create-draft.",
561
- "Typical flow (find work): list_workspaces \u2192 pick repo(s) matching viewer roles/notes \u2192 Sideboard list_issues / linear_* (tickets) or list_prs(queue=review) (reviews) \u2192 show the options. Never wait on Claude Linear MCP. Only create_thread + send_to_thread when they asked to start (e.g. \u201Cfind me work and start it\u201D) \u2014 then wait_for_turn (loop while stillRunning) \u2192 ask_git create-draft.",
560
+ "Typical flow (find work): list_workspaces \u2192 pick repo(s) matching account / project context \u2192 Sideboard list_issues / linear_* (tickets) or list_prs(queue=review) (reviews) \u2192 show the options. Never wait on Claude Linear MCP. Only create_thread + send_to_thread when they asked to start (e.g. \u201Cfind me work and start it\u201D) \u2014 then wait_for_turn (loop while stillRunning) \u2192 ask_git create-draft.",
562
561
  'Typical flow (review inbox): list_workspaces \u2192 list_prs(queue=review, limit=N) \u2192 show those PRs (ticket ids in the title when present). create_thread sourceType=pr only when they asked to start / do the work. Do not list_issues for "tickets to review".',
563
562
  "Typical flow (new app): Bash create/clone under repos dir \u2192 add_workspace \u2192 create_thread \u2192 send_to_thread (implement) \u2192 wait_for_turn (loop while stillRunning) \u2192 ask_git create-draft.",
564
563
  "Always ask worktree agents to commit, push, and open draft PRs (`ask_git` / `send_to_thread`). If the user gave a goal (Greptile 5/5, CI green), pass that goal through so they watch-fix-push until it lands \u2014 do not start that loop on a plain push, and do not tell the human to poll. Tell them to merge only when the user explicitly asked. The worktree agent runs git/gh; never merge from this orchestration cwd."