@sideboard-ai/core 0.1.311 → 0.1.313

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.
@@ -14,7 +14,7 @@ import {
14
14
  parseSessionQuotaResetAt,
15
15
  planModeTurnInstruction,
16
16
  resolveQuotaFallbackAgent
17
- } from "./chunk-4YBQBVYL.js";
17
+ } from "./chunk-TDXORDN6.js";
18
18
  import {
19
19
  REVIEW_TAB_TITLE,
20
20
  applyWorktreePkgCacheEnv,
@@ -1485,6 +1485,20 @@ function thisProcessShouldDrainAgentQueues() {
1485
1485
  return !isDesktopHostAlive();
1486
1486
  }
1487
1487
 
1488
+ // src/mcp-ui/model-context.ts
1489
+ function stashMcpAppModelContext(threadId, text3) {
1490
+ const body = text3.trim().slice(0, 8e3);
1491
+ if (!body) return;
1492
+ updateThread(threadId, { mcpAppModelContext: body });
1493
+ }
1494
+ function takeMcpAppModelContext(threadId) {
1495
+ const thread = readThread(threadId);
1496
+ const text3 = thread?.mcpAppModelContext?.trim();
1497
+ if (!text3) return void 0;
1498
+ updateThread(threadId, { mcpAppModelContext: null });
1499
+ return text3;
1500
+ }
1501
+
1488
1502
  // src/agents/tool-permission.ts
1489
1503
  import { randomUUID } from "crypto";
1490
1504
  import { dirname } from "path";
@@ -3066,7 +3080,7 @@ async function createThread(input, _onSetupLine) {
3066
3080
  return readThread(thread.id) ?? thread;
3067
3081
  }
3068
3082
  async function listLinearIssues(agent, repoPath) {
3069
- const { getAdapter: getAdapter2 } = await import("./agents-XXXRQJJO.js");
3083
+ const { getAdapter: getAdapter2 } = await import("./agents-PSNWJMEC.js");
3070
3084
  await requireAgent(agent, { requireLinear: true });
3071
3085
  const adapter = getAdapter2(agent);
3072
3086
  if (!adapter.listLinearIssues) {
@@ -6781,7 +6795,7 @@ function formatScheduledPrompt(name, prompt) {
6781
6795
  ${prompt}`;
6782
6796
  }
6783
6797
  async function defaultDeps() {
6784
- const { getOrchestrator: getOrchestrator2, startOrchestration: startOrchestration2 } = await import("./orchestrator-2CCFGYAA.js");
6798
+ const { getOrchestrator: getOrchestrator2, startOrchestration: startOrchestration2 } = await import("./orchestrator-BF7TKSA2.js");
6785
6799
  const orch = getOrchestrator2();
6786
6800
  return {
6787
6801
  findThread: (id) => findThreadByRef(id),
@@ -7868,6 +7882,7 @@ ${formatEnvReminder(projectNameForRepoPath(thread.repoPath || thread.worktreePat
7868
7882
  orchestrationReminder,
7869
7883
  prGateDirective,
7870
7884
  injectedNoticeContext,
7885
+ takeMcpAppModelContext(threadId),
7871
7886
  expandedPrompt
7872
7887
  ].filter(Boolean).join("\n\n");
7873
7888
  if (!autoContinue && sentAttachments) {
@@ -9764,6 +9779,7 @@ export {
9764
9779
  shouldRunHistoryCleanup,
9765
9780
  applyThreadIntoMain,
9766
9781
  cloneRepoIntoSideboard,
9782
+ stashMcpAppModelContext,
9767
9783
  connectedOrchestrator,
9768
9784
  formatAskUserNotifyMessage,
9769
9785
  formatNotifyOrchestratorPrompt,
@@ -7,7 +7,7 @@ import {
7
7
  loadBrightsyConfig,
8
8
  refreshBrightsyAccessToken,
9
9
  saveBrightsyConfig
10
- } from "./chunk-PXMLMBMI.js";
10
+ } from "./chunk-E63AM3PW.js";
11
11
  import {
12
12
  run
13
13
  } from "./chunk-2UG25RMK.js";
@@ -93,6 +93,25 @@ function listConnectedBrightsyTeams() {
93
93
  function getConnectedBrightsyTeamsRaw() {
94
94
  return readStore();
95
95
  }
96
+ function teamFromCliSession(cfg, current) {
97
+ return {
98
+ ...current,
99
+ access_token: cfg.access_token,
100
+ refresh_token: cfg.refresh_token ?? current.refresh_token,
101
+ expires_at: cfg.expires_at ?? current.expires_at,
102
+ endpoint: cfg.endpoint ?? current.endpoint,
103
+ oauth_client_id: cfg.oauth_client_id ?? current.oauth_client_id,
104
+ slug: cfg.account_slug || current.slug
105
+ };
106
+ }
107
+ function brightsySessionShouldReplace(a, b) {
108
+ if (!a.access_token) return false;
109
+ const aStale = brightsyAccessTokenNeedsRefresh(a.expires_at);
110
+ const bStale = !b.access_token || brightsyAccessTokenNeedsRefresh(b.expires_at);
111
+ if (!aStale && bStale) return true;
112
+ if (aStale) return false;
113
+ return (a.expires_at ?? 0) > (b.expires_at ?? 0);
114
+ }
96
115
  function applyConnectedTeamToCli(team) {
97
116
  let base = {};
98
117
  try {
@@ -179,22 +198,34 @@ async function ensureConnectedBrightsyTeamTokens(opts) {
179
198
  }
180
199
  next.push(refreshed);
181
200
  }
182
- if (changed) writeStore(next);
183
201
  try {
184
202
  const cfg2 = loadBrightsyConfig();
185
- const active = next.find((t) => t.id === cfg2.account_id);
186
- if (active && active.access_token !== cfg2.access_token) {
187
- applyConnectedTeamToCli(active);
203
+ const idx = next.findIndex((t) => t.id === cfg2.account_id);
204
+ if (idx >= 0) {
205
+ const active = next[idx];
206
+ if (brightsySessionShouldReplace(cfg2, active)) {
207
+ next[idx] = teamFromCliSession(cfg2, active);
208
+ changed = true;
209
+ } else if (active.access_token !== cfg2.access_token) {
210
+ applyConnectedTeamToCli(active);
211
+ }
188
212
  }
189
213
  } catch {
190
214
  }
215
+ if (changed) writeStore(next);
191
216
  return next;
192
217
  }
193
218
  function ensureCliTeamTracked(meta) {
194
219
  try {
195
220
  const cfg = loadBrightsyConfig();
196
221
  const existing = readStore();
197
- if (existing.some((t) => t.id === cfg.account_id)) {
222
+ const idx = existing.findIndex((t) => t.id === cfg.account_id);
223
+ if (idx >= 0) {
224
+ const current = existing[idx];
225
+ if (brightsySessionShouldReplace(cfg, current)) {
226
+ existing[idx] = teamFromCliSession(cfg, current);
227
+ writeStore(existing);
228
+ }
198
229
  return listConnectedBrightsyTeams();
199
230
  }
200
231
  const team = {
@@ -268,6 +299,7 @@ function brightsyMcpServerName(slug) {
268
299
  export {
269
300
  listConnectedBrightsyTeams,
270
301
  getConnectedBrightsyTeamsRaw,
302
+ brightsySessionShouldReplace,
271
303
  applyConnectedTeamToCli,
272
304
  ensureConnectedBrightsyTeamTokens,
273
305
  ensureCliTeamTracked,
@@ -3,14 +3,15 @@
3
3
  import {
4
4
  applyConnectedTeamToCli,
5
5
  brightsyMcpServerName,
6
+ brightsySessionShouldReplace,
6
7
  connectBrightsyTeam,
7
8
  disconnectBrightsyTeam,
8
9
  ensureCliTeamTracked,
9
10
  ensureConnectedBrightsyTeamTokens,
10
11
  getConnectedBrightsyTeamsRaw,
11
12
  listConnectedBrightsyTeams
12
- } from "./chunk-42JGPPVS.js";
13
- import "./chunk-PXMLMBMI.js";
13
+ } from "./chunk-V5BTGQ6M.js";
14
+ import "./chunk-E63AM3PW.js";
14
15
  import "./chunk-2GPQZZLY.js";
15
16
  import "./chunk-2UG25RMK.js";
16
17
  import "./chunk-WWUABK6B.js";
@@ -18,6 +19,7 @@ import "./chunk-WOU343SI.js";
18
19
  export {
19
20
  applyConnectedTeamToCli,
20
21
  brightsyMcpServerName,
22
+ brightsySessionShouldReplace,
21
23
  connectBrightsyTeam,
22
24
  disconnectBrightsyTeam,
23
25
  ensureCliTeamTracked,
@@ -1,14 +1,15 @@
1
1
  import {
2
2
  applyConnectedTeamToCli,
3
3
  brightsyMcpServerName,
4
+ brightsySessionShouldReplace,
4
5
  connectBrightsyTeam,
5
6
  disconnectBrightsyTeam,
6
7
  ensureCliTeamTracked,
7
8
  ensureConnectedBrightsyTeamTokens,
8
9
  getConnectedBrightsyTeamsRaw,
9
10
  listConnectedBrightsyTeams
10
- } from "./chunk-VEVFHO6K.js";
11
- import "./chunk-33KDPEK4.js";
11
+ } from "./chunk-HH3VVTEC.js";
12
+ import "./chunk-RSA47QYR.js";
12
13
  import "./chunk-JAT3JFOS.js";
13
14
  import "./chunk-QVN2WOKJ.js";
14
15
  import "./chunk-4TR3HZFT.js";
@@ -16,6 +17,7 @@ import "./chunk-H4UEFJRI.js";
16
17
  export {
17
18
  applyConnectedTeamToCli,
18
19
  brightsyMcpServerName,
20
+ brightsySessionShouldReplace,
19
21
  connectBrightsyTeam,
20
22
  disconnectBrightsyTeam,
21
23
  ensureCliTeamTracked,