@sideboard-ai/core 0.1.287 → 0.1.288

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-I4RODUKT.js → abletime-4WJUVE64.js} +4 -4
  2. package/dist/{abletime-4CH2IOX5.js → abletime-VFKYNSJT.js} +4 -4
  3. package/dist/{abletime-oauth-7OZZ3ABX.js → abletime-oauth-FW24YHYX.js} +3 -3
  4. package/dist/{abletime-oauth-C2HN2Q6F.js → abletime-oauth-ICMB2XV2.js} +3 -3
  5. package/dist/{abletime-rest-E4LBRFLM.js → abletime-rest-HFMRTUDT.js} +3 -3
  6. package/dist/{abletime-rest-WFI2HWBU.js → abletime-rest-OGWC7BC6.js} +3 -3
  7. package/dist/agents/cursor-runner.js +3 -3
  8. package/dist/{agents-D3PU4UCP.js → agents-GZLTMGSH.js} +19 -17
  9. package/dist/{agents-KU4QPB3Y.js → agents-UQMHFZSM.js} +17 -15
  10. package/dist/{app-settings-EQQZQNYD.js → app-settings-EHMXHNG5.js} +1 -1
  11. package/dist/{app-settings-NI4X5HW3.js → app-settings-MR2U6AXN.js} +1 -1
  12. package/dist/{chunk-UFJLNCOF.js → chunk-2N77CLRQ.js} +8 -298
  13. package/dist/{chunk-YNTXWFXT.js → chunk-36J3IZBS.js} +12 -12
  14. package/dist/{chunk-IJMUYHPT.js → chunk-3E4NOIXN.js} +3 -3
  15. package/dist/{chunk-5MGLNVNK.js → chunk-3W5SL5EW.js} +1 -1
  16. package/dist/{chunk-QPBR5SAL.js → chunk-442O6OXM.js} +25 -127
  17. package/dist/chunk-4BXRRHDC.js +139 -0
  18. package/dist/{chunk-RFPMTOV2.js → chunk-4NM72HJZ.js} +5 -5
  19. package/dist/{chunk-Z3EE3PUZ.js → chunk-6NVQNTJO.js} +10 -300
  20. package/dist/{chunk-VOIWX5HA.js → chunk-7UUILVMV.js} +1 -1
  21. package/dist/chunk-AF2DMY3K.js +295 -0
  22. package/dist/{chunk-5QOLFOAX.js → chunk-AFLNFGGB.js} +1 -1
  23. package/dist/{chunk-5T4YWFLD.js → chunk-AHH5USEA.js} +2 -2
  24. package/dist/{chunk-6CVVNAIU.js → chunk-B3BPLPKQ.js} +2 -2
  25. package/dist/{chunk-ZGAMETNF.js → chunk-DBOFDEQ7.js} +3 -3
  26. package/dist/{chunk-VQEARG5H.js → chunk-GU6DT6NO.js} +5 -5
  27. package/dist/{chunk-K5XSTHHP.js → chunk-HNB2HTCV.js} +1 -1
  28. package/dist/{chunk-KLAQ4G34.js → chunk-IA4MPG7F.js} +3 -3
  29. package/dist/{chunk-S2OOM7AU.js → chunk-K6IOJI3L.js} +1 -1
  30. package/dist/{chunk-U6QDXT4K.js → chunk-MIVX7QKI.js} +1 -1
  31. package/dist/{chunk-WRIMAEF2.js → chunk-MVZO7QZ2.js} +12 -12
  32. package/dist/{chunk-LS4FFCPL.js → chunk-MYJYINTS.js} +3 -3
  33. package/dist/{chunk-DEJALWKM.js → chunk-NFPWLDCH.js} +5 -5
  34. package/dist/chunk-NXXQFLNQ.js +300 -0
  35. package/dist/chunk-OH4EN323.js +89 -0
  36. package/dist/chunk-W2KZTDET.js +302 -0
  37. package/dist/{chunk-L65YT2SC.js → chunk-WQSIUZEB.js} +6 -6
  38. package/dist/{chunk-LKVP7JCB.js → chunk-WW5XGEMY.js} +33 -313
  39. package/dist/{chunk-TMM4FEZ5.js → chunk-Y67TBJD5.js} +3 -3
  40. package/dist/{chunk-XSDCLM3F.js → chunk-YSLCWCMJ.js} +1 -1
  41. package/dist/{conductor-FOKYVMUE.js → conductor-MCU63Z5U.js} +5 -5
  42. package/dist/{conductor-KDUL6AMD.js → conductor-ZLYZVIAV.js} +6 -6
  43. package/dist/{coordinator-prompt-GU5PGLG6.js → coordinator-prompt-KHCXXDRO.js} +3 -3
  44. package/dist/{coordinator-prompt-YARYX53V.js → coordinator-prompt-UV6THLMD.js} +3 -3
  45. package/dist/{global-workspace-C5HMC66E.js → global-workspace-AXTSYVAE.js} +3 -3
  46. package/dist/{global-workspace-SMCPOWE5.js → global-workspace-GDHZSFP6.js} +3 -3
  47. package/dist/index.cjs +469 -274
  48. package/dist/index.d.cts +24 -8
  49. package/dist/index.d.ts +24 -8
  50. package/dist/index.js +369 -256
  51. package/dist/mcp/run-stdio.cjs +602 -225
  52. package/dist/mcp/run-stdio.js +333 -187
  53. package/dist/optional-cli-6SW4OOX3.js +23 -0
  54. package/dist/optional-cli-FRUZSZ3U.js +98 -0
  55. package/dist/{orchestrator-NWKE56BW.js → orchestrator-5ZBHR6BJ.js} +9 -7
  56. package/dist/{orchestrator-2UAVOXTN.js → orchestrator-SDH6W6ZL.js} +12 -10
  57. package/dist/{workspaces-DQMDCRB2.js → workspaces-L2UR4KC2.js} +3 -3
  58. package/dist/{workspaces-KHQ5ETSQ.js → workspaces-Q2R2XGO3.js} +3 -3
  59. package/dist/{worktree-NKLNVNXX.js → worktree-2GOK4VYT.js} +2 -2
  60. package/dist/{worktree-YTZC3UQN.js → worktree-YEUTJ7MZ.js} +2 -2
  61. package/package.json +1 -1
@@ -1,3 +1,9 @@
1
+ import {
2
+ extractPresentedPlan,
3
+ isPresentPlanToolName,
4
+ readPlanFile,
5
+ writePlanFile
6
+ } from "./chunk-PGPSIEMW.js";
1
7
  import {
2
8
  SIDEBOARD_THREAD_ID_ENV,
3
9
  adjustBrightsyTurnExit,
@@ -8,7 +14,7 @@ import {
8
14
  parseSessionQuotaResetAt,
9
15
  planModeTurnInstruction,
10
16
  resolveQuotaFallbackAgent
11
- } from "./chunk-Z3EE3PUZ.js";
17
+ } from "./chunk-6NVQNTJO.js";
12
18
  import {
13
19
  REVIEW_TAB_TITLE,
14
20
  applyWorktreePkgCacheEnv,
@@ -47,7 +53,7 @@ import {
47
53
  worktreeDevProcessKey,
48
54
  worktreeRunProcessKey,
49
55
  worktreeSetupProcessKey
50
- } from "./chunk-L65YT2SC.js";
56
+ } from "./chunk-WQSIUZEB.js";
51
57
  import {
52
58
  applyAgentEvent,
53
59
  clipAgentEventForPaint,
@@ -62,16 +68,14 @@ import {
62
68
  partsToAssistantText,
63
69
  stripBrightsyNdjsonNoise,
64
70
  toolDescription
65
- } from "./chunk-XSDCLM3F.js";
71
+ } from "./chunk-YSLCWCMJ.js";
66
72
  import {
67
73
  titleFromPrompt
68
74
  } from "./chunk-7H655NEW.js";
69
75
  import {
70
- extractPresentedPlan,
71
- isPresentPlanToolName,
72
- readPlanFile,
73
- writePlanFile
74
- } from "./chunk-PGPSIEMW.js";
76
+ formatOptionalServicesDirectiveForTurn,
77
+ formatOptionalServicesReminderForTurn
78
+ } from "./chunk-AF2DMY3K.js";
75
79
  import {
76
80
  SLACK_REPLY_FORMATTING,
77
81
  addWorkspace,
@@ -96,7 +100,7 @@ import {
96
100
  stageAbsolutePathsAsAttachments,
97
101
  stageBuffersAsAttachments,
98
102
  syncWorkspacesFromThreads
99
- } from "./chunk-ZGAMETNF.js";
103
+ } from "./chunk-DBOFDEQ7.js";
100
104
  import {
101
105
  addPrStackLayer,
102
106
  allocateTeamSlug,
@@ -138,7 +142,7 @@ import {
138
142
  resolveRepoRoot,
139
143
  switchWorktreeBranch,
140
144
  withRepoGitLock
141
- } from "./chunk-K5XSTHHP.js";
145
+ } from "./chunk-HNB2HTCV.js";
142
146
  import {
143
147
  agentNicknameFromWorktreePath,
144
148
  appendMessage,
@@ -163,16 +167,13 @@ import {
163
167
  worktreeSlugForTicket,
164
168
  writeThread
165
169
  } from "./chunk-N5UGX3JL.js";
166
- import {
167
- httpFetch
168
- } from "./chunk-JAT3JFOS.js";
169
170
  import {
170
171
  createAgentStreamCoalescer
171
172
  } from "./chunk-AXQ4ZWHK.js";
172
173
  import {
173
174
  applyAgentRunnerHeapEnv,
174
175
  packagedMcpDir
175
- } from "./chunk-VOIWX5HA.js";
176
+ } from "./chunk-7UUILVMV.js";
176
177
  import {
177
178
  fallbackTurnFailDetail,
178
179
  formatAgentErrorContinuePrompt,
@@ -187,7 +188,7 @@ import {
187
188
  shouldRetryFailedAgentTurn,
188
189
  summarizeTurnStderr,
189
190
  turnFailChatText
190
- } from "./chunk-U6QDXT4K.js";
191
+ } from "./chunk-MIVX7QKI.js";
191
192
  import {
192
193
  clearStaleIndexLocks,
193
194
  enrichPathWithNpmGlobalBin,
@@ -222,14 +223,13 @@ import {
222
223
  resolveNewThreadOptions,
223
224
  resolveOrchestratorDefaults,
224
225
  resolveViewerProfileForRepo,
225
- saveAppSettings,
226
226
  sumUsageList,
227
227
  updateAdvancedSettings,
228
228
  updateAppEnvironment,
229
229
  usageOnLimit,
230
230
  withTurnScopedCost,
231
231
  writeViewerContext
232
- } from "./chunk-YNTXWFXT.js";
232
+ } from "./chunk-36J3IZBS.js";
233
233
  import {
234
234
  examplePrefixedBranch,
235
235
  sanitizeGitBranchPrefix
@@ -451,9 +451,9 @@ async function spawnAgentTurn(thread, input, onEvent) {
451
451
  `Cannot spawn ${thread.agent}: thread ${thread.id} has no worktreePath`
452
452
  );
453
453
  }
454
- const { isGlobalThread: isGlobalThread2 } = await import("./global-workspace-C5HMC66E.js");
454
+ const { isGlobalThread: isGlobalThread2 } = await import("./global-workspace-AXTSYVAE.js");
455
455
  if (isGlobalThread2(thread)) {
456
- const { ensureGlobalCoordinatorCwd: ensureGlobalCoordinatorCwd2 } = await import("./coordinator-prompt-GU5PGLG6.js");
456
+ const { ensureGlobalCoordinatorCwd: ensureGlobalCoordinatorCwd2 } = await import("./coordinator-prompt-KHCXXDRO.js");
457
457
  ensureGlobalCoordinatorCwd2(
458
458
  isOrchestratorThread(thread) ? { orchestratorThreadId: thread.id } : void 0
459
459
  );
@@ -2570,7 +2570,7 @@ async function createThread(input, _onSetupLine) {
2570
2570
  });
2571
2571
  await requireAgent(resolved.agent);
2572
2572
  if (input.cowboy) {
2573
- const { cowboyModeEnabled } = await import("./app-settings-NI4X5HW3.js");
2573
+ const { cowboyModeEnabled } = await import("./app-settings-MR2U6AXN.js");
2574
2574
  if (!cowboyModeEnabled()) {
2575
2575
  throw new Error(
2576
2576
  "Cowboy mode is off. Enable it in Settings \u2192 Advanced."
@@ -2629,7 +2629,7 @@ async function createThread(input, _onSetupLine) {
2629
2629
  let sourceIsFork = false;
2630
2630
  if (!input.cowboy && sourceType === "branch" && (!sourceRef || sourceRef === "HEAD" || sourceRef === "default")) {
2631
2631
  if (isAbleTimeConnected() && getIssueSource() === "abletime") {
2632
- const { ensureAbleTimeTask, issueAttachmentForAbleTimeTask } = await import("./abletime-I4RODUKT.js");
2632
+ const { ensureAbleTimeTask, issueAttachmentForAbleTimeTask } = await import("./abletime-4WJUVE64.js");
2633
2633
  const task = await ensureAbleTimeTask({
2634
2634
  title: title?.trim() || "Untitled work",
2635
2635
  description: input.prompt?.trim() || void 0
@@ -2740,7 +2740,7 @@ async function createThread(input, _onSetupLine) {
2740
2740
  return readThread(thread.id) ?? thread;
2741
2741
  }
2742
2742
  async function listLinearIssues(agent, repoPath) {
2743
- const { getAdapter: getAdapter2 } = await import("./agents-D3PU4UCP.js");
2743
+ const { getAdapter: getAdapter2 } = await import("./agents-GZLTMGSH.js");
2744
2744
  await requireAgent(agent, { requireLinear: true });
2745
2745
  const adapter = getAdapter2(agent);
2746
2746
  if (!adapter.listLinearIssues) {
@@ -3251,7 +3251,7 @@ async function adoptThread(input) {
3251
3251
  messages: input.messages ?? []
3252
3252
  });
3253
3253
  writeThread(thread);
3254
- const { addWorkspace: addWorkspace2 } = await import("./workspaces-DQMDCRB2.js");
3254
+ const { addWorkspace: addWorkspace2 } = await import("./workspaces-L2UR4KC2.js");
3255
3255
  await addWorkspace2(repoPath);
3256
3256
  const { ensureWorktreeSideboardIgnored } = await import("./worktree-exclude-RXZPTCNH.js");
3257
3257
  await ensureWorktreeSideboardIgnored(input.worktreePath);
@@ -5445,274 +5445,6 @@ function formatUiReminder() {
5445
5445
  return "Sideboard UI: markdown table is enough to read data; present_schema if they ask to edit/filter (even after markdown); present_files for the file manager. html fence or present_artifact, not both for the same document. type=log appends (same artifact_id, new lines only). ask_user only for a real multiple-choice (not hellos, \u201Cwhat next?\u201D, or after a review) \u2014 reply in chat. ask_user wakes the parent orchestrator; notify_orchestrator if blocked without a picker. Do not say artifacts/CMS UI are unavailable. Dev / preview: run_dev_script (same as the Dev button; pass name \u2014 several scripts can run at once) returns {url, port, preview} (SIDEBOARD_PORT \u2014 never guess :3000). preview=url \u2192 open url; preview=window \u2192 Electron window is the app, url is renderer/HMR only. list_run_scripts active[].url if already running; get_run_log for that script\u2019s Run-tab terminal; stop_dev_script to stop one.";
5446
5446
  }
5447
5447
 
5448
- // src/integrations/optional-services.ts
5449
- var OPTIONAL_SERVICE_IDS = ["vercel", "supabase", "posthog", "sentry"];
5450
- var OPTIONAL_SERVICES = [
5451
- {
5452
- id: "vercel",
5453
- label: "Vercel",
5454
- hint: "Deploys and project settings. Agents use the `vercel` CLI (`VERCEL_TOKEN`).",
5455
- tokenPlaceholder: "token from vercel.com/account/tokens",
5456
- tokenDocs: "https://vercel.com/account/tokens",
5457
- envKey: "VERCEL_TOKEN",
5458
- cli: "vercel",
5459
- npmPackage: "vercel"
5460
- },
5461
- {
5462
- id: "supabase",
5463
- label: "Supabase",
5464
- hint: "Database and project management. Agents use the `supabase` CLI (`SUPABASE_ACCESS_TOKEN`).",
5465
- tokenPlaceholder: "sbp_\u2026",
5466
- tokenDocs: "https://supabase.com/dashboard/account/tokens",
5467
- envKey: "SUPABASE_ACCESS_TOKEN",
5468
- cli: "supabase",
5469
- npmPackage: "supabase"
5470
- },
5471
- {
5472
- id: "posthog",
5473
- label: "PostHog",
5474
- hint: "Product analytics. No first-class CLI \u2014 agents use the HTTP API (`POSTHOG_PERSONAL_API_KEY`).",
5475
- tokenPlaceholder: "phx_\u2026",
5476
- tokenDocs: "https://app.posthog.com/settings/user-api-keys",
5477
- envKey: "POSTHOG_PERSONAL_API_KEY",
5478
- hostEnvKey: "POSTHOG_HOST",
5479
- defaultHost: "https://us.posthog.com",
5480
- hostPlaceholder: "https://us.posthog.com"
5481
- },
5482
- {
5483
- id: "sentry",
5484
- label: "Sentry",
5485
- hint: "Error tracking. Agents use `sentry-cli` (`SENTRY_AUTH_TOKEN`).",
5486
- tokenPlaceholder: "sntrys_\u2026 or auth token",
5487
- tokenDocs: "https://sentry.io/settings/account/api/auth-tokens/",
5488
- envKey: "SENTRY_AUTH_TOKEN",
5489
- cli: "sentry-cli",
5490
- npmPackage: "@sentry/cli",
5491
- hostEnvKey: "SENTRY_URL",
5492
- defaultHost: "https://sentry.io",
5493
- hostPlaceholder: "https://sentry.io"
5494
- }
5495
- ];
5496
- function optionalServiceSpec(id) {
5497
- const spec = OPTIONAL_SERVICES.find((s) => s.id === id);
5498
- if (!spec) throw new Error(`Unknown optional service: ${id}`);
5499
- return spec;
5500
- }
5501
- function isOptionalServiceId(value) {
5502
- return typeof value === "string" && OPTIONAL_SERVICE_IDS.includes(value);
5503
- }
5504
- function normalizeServiceOrigin(raw, fallback) {
5505
- const trimmed = raw?.trim() || fallback;
5506
- try {
5507
- const url = new URL(trimmed.includes("://") ? trimmed : `https://${trimmed}`);
5508
- if (url.protocol !== "http:" && url.protocol !== "https:") return fallback;
5509
- return `${url.protocol}//${url.host}`;
5510
- } catch {
5511
- return fallback;
5512
- }
5513
- }
5514
- function asRecord(value) {
5515
- return value && typeof value === "object" && !Array.isArray(value) ? value : null;
5516
- }
5517
- function asString(value) {
5518
- return typeof value === "string" ? value.trim() : "";
5519
- }
5520
- function firstString(record, keys) {
5521
- if (!record) return "";
5522
- for (const key of keys) {
5523
- const value = asString(record[key]);
5524
- if (value) return value;
5525
- }
5526
- return "";
5527
- }
5528
- async function readJson(res) {
5529
- const text3 = await res.text();
5530
- if (!text3.trim()) return null;
5531
- try {
5532
- return JSON.parse(text3);
5533
- } catch {
5534
- return text3;
5535
- }
5536
- }
5537
- async function authorizedGet(url, token) {
5538
- const res = await httpFetch(url, {
5539
- method: "GET",
5540
- headers: {
5541
- Authorization: `Bearer ${token}`,
5542
- Accept: "application/json"
5543
- }
5544
- });
5545
- const body = await readJson(res);
5546
- if (!res.ok) {
5547
- const record = asRecord(body);
5548
- const message = firstString(record, ["message", "error", "error_description", "detail"]) || (typeof body === "string" ? body.trim().slice(0, 160) : "");
5549
- throw new Error(
5550
- message ? `${res.status}: ${message}` : `Request failed (${res.status})`
5551
- );
5552
- }
5553
- return body;
5554
- }
5555
- async function verifyOptionalService(input) {
5556
- const token = input.token.trim();
5557
- if (!token) throw new Error("A token is required");
5558
- const spec = optionalServiceSpec(input.id);
5559
- try {
5560
- if (input.id === "vercel") {
5561
- const body2 = asRecord(await authorizedGet("https://api.vercel.com/v2/user", token));
5562
- const user = asRecord(body2?.user) ?? body2;
5563
- const name2 = firstString(user, ["username", "name", "email"]) || "Vercel user";
5564
- return { viewerName: name2 };
5565
- }
5566
- if (input.id === "supabase") {
5567
- const body2 = await authorizedGet("https://api.supabase.com/v1/organizations", token);
5568
- const list2 = Array.isArray(body2) ? body2 : [];
5569
- const first2 = asRecord(list2[0]);
5570
- const name2 = firstString(first2, ["name", "slug"]) || "Supabase";
5571
- return { viewerName: list2.length > 1 ? `${name2} +${list2.length - 1}` : name2 };
5572
- }
5573
- if (input.id === "posthog") {
5574
- const host2 = normalizeServiceOrigin(input.host, spec.defaultHost ?? "https://us.posthog.com");
5575
- const body2 = asRecord(await authorizedGet(`${host2}/api/users/@me/`, token));
5576
- const name2 = firstString(body2, ["email", "distinct_id"]) || [firstString(body2, ["first_name"]), firstString(body2, ["last_name"])].filter(Boolean).join(" ") || "PostHog user";
5577
- return { viewerName: name2, host: host2 };
5578
- }
5579
- const host = normalizeServiceOrigin(input.host, spec.defaultHost ?? "https://sentry.io");
5580
- const body = await authorizedGet(`${host}/api/0/organizations/`, token);
5581
- const list = Array.isArray(body) ? body : [];
5582
- const first = asRecord(list[0]);
5583
- const name = firstString(first, ["slug", "name"]) || "Sentry";
5584
- return { viewerName: list.length > 1 ? `${name} +${list.length - 1}` : name, host };
5585
- } catch (err) {
5586
- const detail = err instanceof Error ? err.message : String(err);
5587
- throw new Error(
5588
- `${spec.label} rejected this token. ${detail} Create a token at ${spec.tokenDocs}`
5589
- );
5590
- }
5591
- }
5592
- function applyConnection(integrations, id, input) {
5593
- if (id === "vercel") {
5594
- integrations.vercelToken = input.token;
5595
- if (input.viewerName) integrations.vercelViewerName = input.viewerName.slice(0, 120);
5596
- return;
5597
- }
5598
- if (id === "supabase") {
5599
- integrations.supabaseAccessToken = input.token;
5600
- if (input.viewerName) integrations.supabaseViewerName = input.viewerName.slice(0, 120);
5601
- return;
5602
- }
5603
- if (id === "posthog") {
5604
- integrations.posthogPersonalApiKey = input.token;
5605
- if (input.host) integrations.posthogHost = input.host;
5606
- if (input.viewerName) integrations.posthogViewerName = input.viewerName.slice(0, 120);
5607
- return;
5608
- }
5609
- integrations.sentryAuthToken = input.token;
5610
- if (input.host) integrations.sentryHost = input.host;
5611
- if (input.viewerName) integrations.sentryViewerName = input.viewerName.slice(0, 120);
5612
- }
5613
- function clearConnection(integrations, id) {
5614
- if (id === "vercel") {
5615
- delete integrations.vercelToken;
5616
- delete integrations.vercelViewerName;
5617
- return;
5618
- }
5619
- if (id === "supabase") {
5620
- delete integrations.supabaseAccessToken;
5621
- delete integrations.supabaseViewerName;
5622
- return;
5623
- }
5624
- if (id === "posthog") {
5625
- delete integrations.posthogPersonalApiKey;
5626
- delete integrations.posthogViewerName;
5627
- delete integrations.posthogHost;
5628
- return;
5629
- }
5630
- delete integrations.sentryAuthToken;
5631
- delete integrations.sentryViewerName;
5632
- delete integrations.sentryHost;
5633
- }
5634
- async function connectOptionalService(input) {
5635
- if (!isOptionalServiceId(input.id)) {
5636
- throw new Error("Unknown optional service");
5637
- }
5638
- const verified = await verifyOptionalService(input);
5639
- const current = loadAppSettings();
5640
- const integrations = { ...current.integrations };
5641
- applyConnection(integrations, input.id, {
5642
- token: input.token.trim(),
5643
- host: verified.host,
5644
- viewerName: verified.viewerName
5645
- });
5646
- return saveAppSettings({ ...current, integrations });
5647
- }
5648
- function disconnectOptionalService(id) {
5649
- if (!isOptionalServiceId(id)) {
5650
- throw new Error("Unknown optional service");
5651
- }
5652
- const current = loadAppSettings();
5653
- const integrations = { ...current.integrations };
5654
- clearConnection(integrations, id);
5655
- return saveAppSettings({ ...current, integrations });
5656
- }
5657
- function optionalServiceConnected(id, integrations) {
5658
- if (id === "vercel") return Boolean(integrations.vercelToken?.trim());
5659
- if (id === "supabase") return Boolean(integrations.supabaseAccessToken?.trim());
5660
- if (id === "posthog") return Boolean(integrations.posthogPersonalApiKey?.trim());
5661
- return Boolean(integrations.sentryAuthToken?.trim());
5662
- }
5663
- function connectedOptionalServices(integrations) {
5664
- return OPTIONAL_SERVICES.filter((spec) => optionalServiceConnected(spec.id, integrations));
5665
- }
5666
- function formatOptionalServicesDirective(integrations) {
5667
- const connected = connectedOptionalServices(integrations);
5668
- if (connected.length === 0) return null;
5669
- const lines = [
5670
- "Optional connectors (connected \u2014 tokens are already in this process env):"
5671
- ];
5672
- for (const spec of connected) {
5673
- if (spec.cli) {
5674
- const extras = spec.hostEnvKey ? ` / \`${spec.hostEnvKey}\`` : "";
5675
- lines.push(
5676
- `- ${spec.label}: use the \`${spec.cli}\` CLI (\`${spec.envKey}\`${extras}). Do not add a ${spec.label} MCP.`
5677
- );
5678
- } else {
5679
- const extras = spec.hostEnvKey ? ` / \`${spec.hostEnvKey}\`` : "";
5680
- lines.push(
5681
- `- ${spec.label}: no first-class CLI \u2014 call the HTTP API with \`${spec.envKey}\`${extras}. Do not add a ${spec.label} MCP.`
5682
- );
5683
- }
5684
- }
5685
- lines.push(
5686
- "If a connector MCP is listed but needsAuth or returns unauthorized, do not sign in to that MCP. Check the native CLI (or the HTTP API when there is no CLI) \u2014 the token is already in this process."
5687
- );
5688
- lines.push(
5689
- "If a CLI is missing, say so or use the HTTP API with the same token. The user can Install CLI from Settings \u2192 Connectors. Do not ask the user to install a vendor MCP."
5690
- );
5691
- lines.push(
5692
- "Safe CLI / HTTP (every connector \u2014 `vercel logs`, Supabase inspect, `sentry-cli`, PostHog API):"
5693
- );
5694
- lines.push(
5695
- '- Never put raw `--json` / `--expand` / huge dumps in the tool result. That crashes any worktree agent mid-turn (Claude / Cursor / Codex / OpenCode). Cursor chat fills with `file://\u2026/cursor-runtime/\u2026/@cursor/sdk/dist/esm/index.js` then minified `importas e from"@bufbuild/protobuf"`.'
5696
- );
5697
- lines.push(
5698
- "- Write output to `.context/cli/` (worktree scratch; not `.context/attachments/`). Then read a slice. Tight window first (`--limit`, recent `--since` / last N events); raise only if empty."
5699
- );
5700
- lines.push(
5701
- "- Filter (`jq`) to the fields you need (timestamp, path, status, message) \u2014 not the full request object."
5702
- );
5703
- lines.push(
5704
- "- One query at a time. After you have the error line, stop fetching. Piping to `head` does not help \u2014 the CLI still buffers until you kill it."
5705
- );
5706
- lines.push(
5707
- "- If a call is still running at ~40s with no useful output, stop waiting on the raw shell; detach (`/long-running`) or `stop_job` if it is hanging / doing the wrong thing."
5708
- );
5709
- return lines.join("\n");
5710
- }
5711
- function formatOptionalServicesReminder(integrations) {
5712
- if (connectedOptionalServices(integrations).length === 0) return null;
5713
- return "Settings \u2192 Connectors: official CLIs / PostHog HTTP with injected env. If a connector MCP needsAuth or is unauthorized, check the native CLI or HTTP API instead of signing in. Write output to `.context/cli/` (not `.context/attachments/`) and read a slice \u2014 never dump raw --json/--expand into the tool result (any agent). stop_job if a fetch hangs. Do not add vendor MCPs.";
5714
- }
5715
-
5716
5448
  // src/mcp/viewer-context-tools.ts
5717
5449
  import { z as z3 } from "zod";
5718
5450
 
@@ -6437,7 +6169,7 @@ function formatScheduledPrompt(name, prompt) {
6437
6169
  ${prompt}`;
6438
6170
  }
6439
6171
  async function defaultDeps() {
6440
- const { getOrchestrator: getOrchestrator2, startOrchestration: startOrchestration2 } = await import("./orchestrator-2UAVOXTN.js");
6172
+ const { getOrchestrator: getOrchestrator2, startOrchestration: startOrchestration2 } = await import("./orchestrator-SDH6W6ZL.js");
6441
6173
  const orch = getOrchestrator2();
6442
6174
  return {
6443
6175
  findThread: (id) => findThreadByRef(id),
@@ -6755,7 +6487,7 @@ var Orchestrator = class {
6755
6487
  orphans: orphans.map((o) => ({ path: o.path, repoPath: o.repoPath }))
6756
6488
  });
6757
6489
  }
6758
- const { autoCleanupOrphansEnabled } = await import("./app-settings-NI4X5HW3.js");
6490
+ const { autoCleanupOrphansEnabled } = await import("./app-settings-MR2U6AXN.js");
6759
6491
  if (autoCleanupOrphansEnabled() && shouldRunWorktreeCleanup() && orphans.length > 0) {
6760
6492
  await cleanupOrphanWorktrees({ repoPaths });
6761
6493
  }
@@ -7149,7 +6881,7 @@ var Orchestrator = class {
7149
6881
  }
7150
6882
  await setup;
7151
6883
  if (skipSetup) return;
7152
- const { autoRunAfterSetupEnabled } = await import("./app-settings-NI4X5HW3.js");
6884
+ const { autoRunAfterSetupEnabled } = await import("./app-settings-MR2U6AXN.js");
7153
6885
  if (autoRunAfterSetupEnabled()) {
7154
6886
  try {
7155
6887
  await this.startDev(threadId);
@@ -7488,7 +7220,7 @@ var Orchestrator = class {
7488
7220
  const artifactReminder = thread.agent !== "brightsy" ? formatUiReminder() : null;
7489
7221
  const longRunningReminder = thread.agent !== "brightsy" && !isOrchestratorThread(thread) ? formatLongRunningReminder({ activeRuns: worktreeActiveRuns }) : null;
7490
7222
  const worktreeReminder = thread.agent !== "brightsy" && !isOrchestratorThread(thread) ? formatWorktreeReminder() : null;
7491
- const optionalServicesReminder = thread.agent !== "brightsy" && !isOrchestratorThread(thread) ? formatOptionalServicesReminder(loadAppSettings().integrations) : null;
7223
+ const optionalServicesReminder = thread.agent !== "brightsy" && !isOrchestratorThread(thread) ? await formatOptionalServicesReminderForTurn(loadAppSettings().integrations) : null;
7492
7224
  const issueTicket = issueTicketFromThread(thread, resolveEffectiveIssueSource());
7493
7225
  const issueToolsReminder = thread.agent !== "brightsy" && !isOrchestratorThread(thread) ? formatIssueToolsReminder({
7494
7226
  linear: isLinearConnected(),
@@ -7540,7 +7272,7 @@ ${formatEnvReminder(projectNameForRepoPath(thread.repoPath || thread.worktreePat
7540
7272
  }
7541
7273
  const isBrightsy = fresh.agent === "brightsy";
7542
7274
  const isOrchestration = isOrchestratorThread(fresh);
7543
- const { autoRenameBranchEnabled, getGithubGitAuthMode, gitBranchPrefixSetting } = await import("./app-settings-NI4X5HW3.js");
7275
+ const { autoRenameBranchEnabled, getGithubGitAuthMode, gitBranchPrefixSetting } = await import("./app-settings-MR2U6AXN.js");
7544
7276
  const gitAuthMode = getGithubGitAuthMode();
7545
7277
  const worktreeDirective = isBrightsy || isOrchestration ? null : formatWorktreeDirective(fresh, {
7546
7278
  githubSlug: await withTimeout(
@@ -7559,7 +7291,7 @@ ${formatEnvReminder(projectNameForRepoPath(thread.repoPath || thread.worktreePat
7559
7291
  });
7560
7292
  const artifactDirective = isBrightsy ? null : formatArtifactDirective();
7561
7293
  const longRunningDirective = isBrightsy || isOrchestration ? null : formatLongRunningDirective();
7562
- const optionalServicesDirective = isBrightsy || isOrchestration ? null : formatOptionalServicesDirective(loadAppSettings().integrations);
7294
+ const optionalServicesDirective = isBrightsy || isOrchestration ? null : await formatOptionalServicesDirectiveForTurn(loadAppSettings().integrations);
7563
7295
  const freshIssueTicket = issueTicketFromThread(fresh, resolveEffectiveIssueSource());
7564
7296
  const issueToolsDirective = isBrightsy || isOrchestration ? null : formatIssueToolsDirective({
7565
7297
  linear: isLinearConnected(),
@@ -7736,7 +7468,7 @@ ${formatEnvReminder(projectNameForRepoPath(thread.repoPath || thread.worktreePat
7736
7468
  }
7737
7469
  } catch {
7738
7470
  }
7739
- const retryNote = isolateCodexPluginRetry ? "Codex plugin/MCP failed \u2014 continuing without that vendor plugin (Settings \u2192 Connectors + HTTP API)" : looksLikeInvalidAgentSession(detail) ? "Agent session missing \u2014 starting a fresh session" : looksLikeV8Oom(detail) ? "Agent ran out of memory \u2014 starting a fresh session" : "Agent runner crashed \u2014 restarting Node once";
7471
+ const retryNote = isolateCodexPluginRetry ? "Codex plugin/MCP failed \u2014 continuing without that vendor plugin (PostHog: Settings \u2192 Connectors and posthog_api)" : looksLikeInvalidAgentSession(detail) ? "Agent session missing \u2014 starting a fresh session" : looksLikeV8Oom(detail) ? "Agent ran out of memory \u2014 starting a fresh session" : "Agent runner crashed \u2014 restarting Node once";
7740
7472
  pushTurnStderr(stderrTail, retryNote);
7741
7473
  this.emit({
7742
7474
  type: "turn_output",
@@ -8856,7 +8588,7 @@ ${formatEnvReminder(projectNameForRepoPath(thread.repoPath || thread.worktreePat
8856
8588
  if (Object.keys(patch).length === 0) continue;
8857
8589
  updateThread(t.id, patch);
8858
8590
  }
8859
- const { autoArchiveOnMergeEnabled } = await import("./app-settings-NI4X5HW3.js");
8591
+ const { autoArchiveOnMergeEnabled } = await import("./app-settings-MR2U6AXN.js");
8860
8592
  const latest = this.requireThread(thread.id);
8861
8593
  if (!shouldAutoArchiveOnPrMerge({
8862
8594
  previousPrState: prevState || null,
@@ -9173,7 +8905,7 @@ ${formatEnvReminder(projectNameForRepoPath(thread.repoPath || thread.worktreePat
9173
8905
  await runArchiveScript(thread.repoPath, thread.worktreePath);
9174
8906
  } catch {
9175
8907
  }
9176
- const { deleteBranchOnPurgeEnabled } = await import("./app-settings-NI4X5HW3.js");
8908
+ const { deleteBranchOnPurgeEnabled } = await import("./app-settings-MR2U6AXN.js");
9177
8909
  const deleteBranch = opts?.deleteBranch ?? deleteBranchOnPurgeEnabled();
9178
8910
  await removeWorktree(thread.repoPath, thread.worktreePath, {
9179
8911
  deleteBranch: deleteBranch ? thread.branchName : void 0
@@ -9309,7 +9041,7 @@ async function startOrchestration(opts) {
9309
9041
  sourceRef: "default",
9310
9042
  ...createOpts
9311
9043
  }).catch(async () => {
9312
- const { resolveDefaultBranch: resolveDefaultBranch2, resolveRepoRoot: resolveRepoRoot2 } = await import("./worktree-YTZC3UQN.js");
9044
+ const { resolveDefaultBranch: resolveDefaultBranch2, resolveRepoRoot: resolveRepoRoot2 } = await import("./worktree-YEUTJ7MZ.js");
9313
9045
  const repo = await resolveRepoRoot2(repoPath);
9314
9046
  const def = await resolveDefaultBranch2(repo);
9315
9047
  return orch.createThread({
@@ -9495,18 +9227,6 @@ export {
9495
9227
  formatLongRunningReminder,
9496
9228
  formatArtifactDirective,
9497
9229
  formatUiReminder,
9498
- OPTIONAL_SERVICE_IDS,
9499
- OPTIONAL_SERVICES,
9500
- optionalServiceSpec,
9501
- isOptionalServiceId,
9502
- normalizeServiceOrigin,
9503
- verifyOptionalService,
9504
- connectOptionalService,
9505
- disconnectOptionalService,
9506
- optionalServiceConnected,
9507
- connectedOptionalServices,
9508
- formatOptionalServicesDirective,
9509
- formatOptionalServicesReminder,
9510
9230
  parseIssueSince,
9511
9231
  formatGitHubSearchUpdatedSince,
9512
9232
  issueMatchesUpdatedSince,
@@ -3,13 +3,13 @@
3
3
  import {
4
4
  abletimeRestUrl,
5
5
  textFromAbleTimeDoc
6
- } from "./chunk-5T4YWFLD.js";
6
+ } from "./chunk-AHH5USEA.js";
7
7
  import {
8
8
  assertAbleTimeCredential,
9
9
  callAbleTimeTool,
10
10
  normalizeAbleTimeHost,
11
11
  rewriteAbleTimeError
12
- } from "./chunk-VQEARG5H.js";
12
+ } from "./chunk-GU6DT6NO.js";
13
13
  import {
14
14
  httpFetch
15
15
  } from "./chunk-2GPQZZLY.js";
@@ -22,7 +22,7 @@ import {
22
22
  getAbleTimeHost,
23
23
  isAbleTimeConnected,
24
24
  saveAbleTimeConnection
25
- } from "./chunk-WRIMAEF2.js";
25
+ } from "./chunk-MVZO7QZ2.js";
26
26
 
27
27
  // src/integrations/issue-attachments.ts
28
28
  import { existsSync, mkdirSync, writeFileSync } from "fs";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  clipToolResultForStore
3
- } from "./chunk-U6QDXT4K.js";
3
+ } from "./chunk-MIVX7QKI.js";
4
4
 
5
5
  // src/agents/message-parts.ts
6
6
  function asRecord(input) {
@@ -33,14 +33,14 @@ import {
33
33
  tryReservePort,
34
34
  tryReservePorts,
35
35
  worktreeRunPortsPath
36
- } from "./chunk-RFPMTOV2.js";
37
- import "./chunk-5QOLFOAX.js";
38
- import "./chunk-KLAQ4G34.js";
39
- import "./chunk-5MGLNVNK.js";
36
+ } from "./chunk-4NM72HJZ.js";
37
+ import "./chunk-AFLNFGGB.js";
38
+ import "./chunk-IA4MPG7F.js";
39
+ import "./chunk-3W5SL5EW.js";
40
40
  import "./chunk-N2WW62LF.js";
41
41
  import "./chunk-DD67JWTN.js";
42
42
  import "./chunk-2UG25RMK.js";
43
- import "./chunk-WRIMAEF2.js";
43
+ import "./chunk-MVZO7QZ2.js";
44
44
  import "./chunk-NSTQ6QKD.js";
45
45
  import {
46
46
  stripNestedElectronEnv
@@ -31,17 +31,17 @@ import {
31
31
  tryReservePort,
32
32
  tryReservePorts,
33
33
  worktreeRunPortsPath
34
- } from "./chunk-L65YT2SC.js";
35
- import "./chunk-XSDCLM3F.js";
36
- import "./chunk-ZGAMETNF.js";
37
- import "./chunk-K5XSTHHP.js";
34
+ } from "./chunk-WQSIUZEB.js";
35
+ import "./chunk-YSLCWCMJ.js";
36
+ import "./chunk-DBOFDEQ7.js";
37
+ import "./chunk-HNB2HTCV.js";
38
38
  import "./chunk-N5UGX3JL.js";
39
39
  import "./chunk-2P4XKWV2.js";
40
- import "./chunk-U6QDXT4K.js";
40
+ import "./chunk-MIVX7QKI.js";
41
41
  import "./chunk-6K64FJDD.js";
42
42
  import "./chunk-UWQ6UCIB.js";
43
43
  import "./chunk-QVN2WOKJ.js";
44
- import "./chunk-YNTXWFXT.js";
44
+ import "./chunk-36J3IZBS.js";
45
45
  import "./chunk-77WWLBCI.js";
46
46
  import {
47
47
  stripNestedElectronEnv
@@ -7,14 +7,14 @@ import {
7
7
  enrichWorkspacesWithGithub,
8
8
  ensureGlobalCoordinatorCwd,
9
9
  formatWorkspaceInventory
10
- } from "./chunk-ZGAMETNF.js";
11
- import "./chunk-K5XSTHHP.js";
10
+ } from "./chunk-DBOFDEQ7.js";
11
+ import "./chunk-HNB2HTCV.js";
12
12
  import "./chunk-N5UGX3JL.js";
13
13
  import "./chunk-2P4XKWV2.js";
14
14
  import "./chunk-6K64FJDD.js";
15
15
  import "./chunk-UWQ6UCIB.js";
16
16
  import "./chunk-QVN2WOKJ.js";
17
- import "./chunk-YNTXWFXT.js";
17
+ import "./chunk-36J3IZBS.js";
18
18
  import "./chunk-77WWLBCI.js";
19
19
  import "./chunk-4TR3HZFT.js";
20
20
  import "./chunk-WDRMZKVB.js";
@@ -9,12 +9,12 @@ import {
9
9
  enrichWorkspacesWithGithub,
10
10
  ensureGlobalCoordinatorCwd,
11
11
  formatWorkspaceInventory
12
- } from "./chunk-KLAQ4G34.js";
13
- import "./chunk-5MGLNVNK.js";
12
+ } from "./chunk-IA4MPG7F.js";
13
+ import "./chunk-3W5SL5EW.js";
14
14
  import "./chunk-N2WW62LF.js";
15
15
  import "./chunk-DD67JWTN.js";
16
16
  import "./chunk-2UG25RMK.js";
17
- import "./chunk-WRIMAEF2.js";
17
+ import "./chunk-MVZO7QZ2.js";
18
18
  import "./chunk-NSTQ6QKD.js";
19
19
  import "./chunk-WWUABK6B.js";
20
20
  import "./chunk-FJZWM2ON.js";
@@ -18,14 +18,14 @@ import {
18
18
  remoteCoordinatorSourceRef,
19
19
  slackCoordinatorSourceRef,
20
20
  takenTeamSlugsForOrchestration
21
- } from "./chunk-ZGAMETNF.js";
22
- import "./chunk-K5XSTHHP.js";
21
+ } from "./chunk-DBOFDEQ7.js";
22
+ import "./chunk-HNB2HTCV.js";
23
23
  import "./chunk-N5UGX3JL.js";
24
24
  import "./chunk-2P4XKWV2.js";
25
25
  import "./chunk-6K64FJDD.js";
26
26
  import "./chunk-UWQ6UCIB.js";
27
27
  import "./chunk-QVN2WOKJ.js";
28
- import "./chunk-YNTXWFXT.js";
28
+ import "./chunk-36J3IZBS.js";
29
29
  import "./chunk-77WWLBCI.js";
30
30
  import "./chunk-4TR3HZFT.js";
31
31
  import "./chunk-WDRMZKVB.js";