@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
@@ -2237,22 +2237,21 @@ function applyAppEnvironment(target = process.env, settings = loadAppSettings())
2237
2237
  applyOptionalServiceTokens(target, settings.integrations);
2238
2238
  return target;
2239
2239
  }
2240
- function fillEnvGap(target, key, value) {
2240
+ function assignEnv(target, key, value) {
2241
2241
  const v = value?.trim();
2242
2242
  if (!key || !v) return;
2243
- if (target[key] == null || target[key] === "") target[key] = v;
2243
+ target[key] = v;
2244
+ }
2245
+ function scrubPosthogAgentEnv(target) {
2246
+ delete target.POSTHOG_PERSONAL_API_KEY;
2247
+ delete target.POSTHOG_HOST;
2244
2248
  }
2245
2249
  function applyOptionalServiceTokens(target, integrations) {
2246
- fillEnvGap(target, "VERCEL_TOKEN", integrations.vercelToken);
2247
- fillEnvGap(target, "SUPABASE_ACCESS_TOKEN", integrations.supabaseAccessToken);
2248
- fillEnvGap(target, "POSTHOG_PERSONAL_API_KEY", integrations.posthogPersonalApiKey);
2249
- fillEnvGap(
2250
- target,
2251
- "POSTHOG_HOST",
2252
- integrations.posthogPersonalApiKey ? integrations.posthogHost || "https://us.posthog.com" : void 0
2253
- );
2254
- fillEnvGap(target, "SENTRY_AUTH_TOKEN", integrations.sentryAuthToken);
2255
- fillEnvGap(
2250
+ assignEnv(target, "VERCEL_TOKEN", integrations.vercelToken);
2251
+ assignEnv(target, "SUPABASE_ACCESS_TOKEN", integrations.supabaseAccessToken);
2252
+ scrubPosthogAgentEnv(target);
2253
+ assignEnv(target, "SENTRY_AUTH_TOKEN", integrations.sentryAuthToken);
2254
+ assignEnv(
2256
2255
  target,
2257
2256
  "SENTRY_URL",
2258
2257
  integrations.sentryAuthToken ? integrations.sentryHost || "https://sentry.io" : void 0
@@ -2267,6 +2266,7 @@ function childEnvWithAppSettings(extra) {
2267
2266
  if (v != null) env[k] = v;
2268
2267
  }
2269
2268
  }
2269
+ scrubPosthogAgentEnv(env);
2270
2270
  return env;
2271
2271
  }
2272
2272
  function harnessEnvKey(harness) {
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  DEFAULT_ABLETIME_HOST,
3
3
  normalizeAbleTimeHost
4
- } from "./chunk-DEJALWKM.js";
4
+ } from "./chunk-NFPWLDCH.js";
5
5
  import {
6
6
  httpFetch
7
7
  } from "./chunk-JAT3JFOS.js";
@@ -10,7 +10,7 @@ import {
10
10
  getAbleTimeHost,
11
11
  loadAppSettings,
12
12
  saveAbleTimeConnection
13
- } from "./chunk-YNTXWFXT.js";
13
+ } from "./chunk-36J3IZBS.js";
14
14
 
15
15
  // src/integrations/abletime-oauth.ts
16
16
  import { createHash, randomBytes } from "crypto";
@@ -280,7 +280,7 @@ async function startAbleTimeOAuth(opts) {
280
280
  persistAbleTimeTokens(data, { host });
281
281
  const token = data.access_token.trim();
282
282
  try {
283
- const { getAbleTimeOrientation } = await import("./abletime-I4RODUKT.js");
283
+ const { getAbleTimeOrientation } = await import("./abletime-4WJUVE64.js");
284
284
  const orientation = await getAbleTimeOrientation({ token, host });
285
285
  return saveAbleTimeConnection({
286
286
  accessToken: token,
@@ -19,7 +19,7 @@ import {
19
19
  import {
20
20
  getGithubGitAuthMode,
21
21
  getGithubPat
22
- } from "./chunk-WRIMAEF2.js";
22
+ } from "./chunk-MVZO7QZ2.js";
23
23
  import {
24
24
  allocateTeamName,
25
25
  listThreads,
@@ -3,6 +3,10 @@
3
3
  import {
4
4
  titleFromPrompt
5
5
  } from "./chunk-LX5R5JOR.js";
6
+ import {
7
+ formatOptionalServicesDirectiveForTurn,
8
+ formatOptionalServicesReminderForTurn
9
+ } from "./chunk-4BXRRHDC.js";
6
10
  import {
7
11
  extractPresentedPlan,
8
12
  isPresentPlanToolName,
@@ -23,7 +27,7 @@ import {
23
27
  parseSessionQuotaResetAt,
24
28
  planModeTurnInstruction,
25
29
  resolveQuotaFallbackAgent
26
- } from "./chunk-UFJLNCOF.js";
30
+ } from "./chunk-2N77CLRQ.js";
27
31
  import {
28
32
  REVIEW_TAB_TITLE,
29
33
  applyWorktreePkgCacheEnv,
@@ -62,7 +66,7 @@ import {
62
66
  worktreeDevProcessKey,
63
67
  worktreeRunProcessKey,
64
68
  worktreeSetupProcessKey
65
- } from "./chunk-RFPMTOV2.js";
69
+ } from "./chunk-4NM72HJZ.js";
66
70
  import {
67
71
  applyAgentEvent,
68
72
  clipAgentEventForPaint,
@@ -89,7 +93,7 @@ import {
89
93
  summarizeTurnStderr,
90
94
  toolDescription,
91
95
  turnFailChatText
92
- } from "./chunk-5QOLFOAX.js";
96
+ } from "./chunk-AFLNFGGB.js";
93
97
  import {
94
98
  SLACK_REPLY_FORMATTING,
95
99
  addWorkspace,
@@ -114,7 +118,7 @@ import {
114
118
  stageAbsolutePathsAsAttachments,
115
119
  stageBuffersAsAttachments,
116
120
  syncWorkspacesFromThreads
117
- } from "./chunk-KLAQ4G34.js";
121
+ } from "./chunk-IA4MPG7F.js";
118
122
  import {
119
123
  addPrStackLayer,
120
124
  allocateTeamSlug,
@@ -156,7 +160,7 @@ import {
156
160
  resolveRepoRoot,
157
161
  switchWorktreeBranch,
158
162
  withRepoGitLock
159
- } from "./chunk-5MGLNVNK.js";
163
+ } from "./chunk-3W5SL5EW.js";
160
164
  import {
161
165
  clearStaleIndexLocks,
162
166
  enrichPathWithNpmGlobalBin,
@@ -197,7 +201,7 @@ import {
197
201
  usageOnLimit,
198
202
  withTurnScopedCost,
199
203
  writeViewerContext
200
- } from "./chunk-WRIMAEF2.js";
204
+ } from "./chunk-MVZO7QZ2.js";
201
205
  import {
202
206
  writePrivateFile
203
207
  } from "./chunk-NSTQ6QKD.js";
@@ -499,9 +503,9 @@ async function spawnAgentTurn(thread, input, onEvent) {
499
503
  `Cannot spawn ${thread.agent}: thread ${thread.id} has no worktreePath`
500
504
  );
501
505
  }
502
- const { isGlobalThread: isGlobalThread2 } = await import("./global-workspace-SMCPOWE5.js");
506
+ const { isGlobalThread: isGlobalThread2 } = await import("./global-workspace-GDHZSFP6.js");
503
507
  if (isGlobalThread2(thread)) {
504
- const { ensureGlobalCoordinatorCwd: ensureGlobalCoordinatorCwd2 } = await import("./coordinator-prompt-YARYX53V.js");
508
+ const { ensureGlobalCoordinatorCwd: ensureGlobalCoordinatorCwd2 } = await import("./coordinator-prompt-UV6THLMD.js");
505
509
  ensureGlobalCoordinatorCwd2(
506
510
  isOrchestratorThread(thread) ? { orchestratorThreadId: thread.id } : void 0
507
511
  );
@@ -2449,7 +2453,7 @@ async function createThread(input, _onSetupLine) {
2449
2453
  });
2450
2454
  await requireAgent(resolved.agent);
2451
2455
  if (input.cowboy) {
2452
- const { cowboyModeEnabled } = await import("./app-settings-EQQZQNYD.js");
2456
+ const { cowboyModeEnabled } = await import("./app-settings-EHMXHNG5.js");
2453
2457
  if (!cowboyModeEnabled()) {
2454
2458
  throw new Error(
2455
2459
  "Cowboy mode is off. Enable it in Settings \u2192 Advanced."
@@ -2508,7 +2512,7 @@ async function createThread(input, _onSetupLine) {
2508
2512
  let sourceIsFork = false;
2509
2513
  if (!input.cowboy && sourceType === "branch" && (!sourceRef || sourceRef === "HEAD" || sourceRef === "default")) {
2510
2514
  if (isAbleTimeConnected() && getIssueSource() === "abletime") {
2511
- const { ensureAbleTimeTask, issueAttachmentForAbleTimeTask } = await import("./abletime-4CH2IOX5.js");
2515
+ const { ensureAbleTimeTask, issueAttachmentForAbleTimeTask } = await import("./abletime-VFKYNSJT.js");
2512
2516
  const task = await ensureAbleTimeTask({
2513
2517
  title: title?.trim() || "Untitled work",
2514
2518
  description: input.prompt?.trim() || void 0
@@ -3115,7 +3119,7 @@ async function adoptThread(input) {
3115
3119
  messages: input.messages ?? []
3116
3120
  });
3117
3121
  writeThread(thread);
3118
- const { addWorkspace: addWorkspace2 } = await import("./workspaces-KHQ5ETSQ.js");
3122
+ const { addWorkspace: addWorkspace2 } = await import("./workspaces-Q2R2XGO3.js");
3119
3123
  await addWorkspace2(repoPath);
3120
3124
  const { ensureWorktreeSideboardIgnored } = await import("./worktree-exclude-5N2KTYIT.js");
3121
3125
  await ensureWorktreeSideboardIgnored(input.worktreePath);
@@ -5274,112 +5278,6 @@ function formatUiReminder() {
5274
5278
  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.";
5275
5279
  }
5276
5280
 
5277
- // src/integrations/optional-services.ts
5278
- var OPTIONAL_SERVICES = [
5279
- {
5280
- id: "vercel",
5281
- label: "Vercel",
5282
- hint: "Deploys and project settings. Agents use the `vercel` CLI (`VERCEL_TOKEN`).",
5283
- tokenPlaceholder: "token from vercel.com/account/tokens",
5284
- tokenDocs: "https://vercel.com/account/tokens",
5285
- envKey: "VERCEL_TOKEN",
5286
- cli: "vercel",
5287
- npmPackage: "vercel"
5288
- },
5289
- {
5290
- id: "supabase",
5291
- label: "Supabase",
5292
- hint: "Database and project management. Agents use the `supabase` CLI (`SUPABASE_ACCESS_TOKEN`).",
5293
- tokenPlaceholder: "sbp_\u2026",
5294
- tokenDocs: "https://supabase.com/dashboard/account/tokens",
5295
- envKey: "SUPABASE_ACCESS_TOKEN",
5296
- cli: "supabase",
5297
- npmPackage: "supabase"
5298
- },
5299
- {
5300
- id: "posthog",
5301
- label: "PostHog",
5302
- hint: "Product analytics. No first-class CLI \u2014 agents use the HTTP API (`POSTHOG_PERSONAL_API_KEY`).",
5303
- tokenPlaceholder: "phx_\u2026",
5304
- tokenDocs: "https://app.posthog.com/settings/user-api-keys",
5305
- envKey: "POSTHOG_PERSONAL_API_KEY",
5306
- hostEnvKey: "POSTHOG_HOST",
5307
- defaultHost: "https://us.posthog.com",
5308
- hostPlaceholder: "https://us.posthog.com"
5309
- },
5310
- {
5311
- id: "sentry",
5312
- label: "Sentry",
5313
- hint: "Error tracking. Agents use `sentry-cli` (`SENTRY_AUTH_TOKEN`).",
5314
- tokenPlaceholder: "sntrys_\u2026 or auth token",
5315
- tokenDocs: "https://sentry.io/settings/account/api/auth-tokens/",
5316
- envKey: "SENTRY_AUTH_TOKEN",
5317
- cli: "sentry-cli",
5318
- npmPackage: "@sentry/cli",
5319
- hostEnvKey: "SENTRY_URL",
5320
- defaultHost: "https://sentry.io",
5321
- hostPlaceholder: "https://sentry.io"
5322
- }
5323
- ];
5324
- function optionalServiceConnected(id, integrations) {
5325
- if (id === "vercel") return Boolean(integrations.vercelToken?.trim());
5326
- if (id === "supabase") return Boolean(integrations.supabaseAccessToken?.trim());
5327
- if (id === "posthog") return Boolean(integrations.posthogPersonalApiKey?.trim());
5328
- return Boolean(integrations.sentryAuthToken?.trim());
5329
- }
5330
- function connectedOptionalServices(integrations) {
5331
- return OPTIONAL_SERVICES.filter((spec) => optionalServiceConnected(spec.id, integrations));
5332
- }
5333
- function formatOptionalServicesDirective(integrations) {
5334
- const connected = connectedOptionalServices(integrations);
5335
- if (connected.length === 0) return null;
5336
- const lines = [
5337
- "Optional connectors (connected \u2014 tokens are already in this process env):"
5338
- ];
5339
- for (const spec of connected) {
5340
- if (spec.cli) {
5341
- const extras = spec.hostEnvKey ? ` / \`${spec.hostEnvKey}\`` : "";
5342
- lines.push(
5343
- `- ${spec.label}: use the \`${spec.cli}\` CLI (\`${spec.envKey}\`${extras}). Do not add a ${spec.label} MCP.`
5344
- );
5345
- } else {
5346
- const extras = spec.hostEnvKey ? ` / \`${spec.hostEnvKey}\`` : "";
5347
- lines.push(
5348
- `- ${spec.label}: no first-class CLI \u2014 call the HTTP API with \`${spec.envKey}\`${extras}. Do not add a ${spec.label} MCP.`
5349
- );
5350
- }
5351
- }
5352
- lines.push(
5353
- "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."
5354
- );
5355
- lines.push(
5356
- "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."
5357
- );
5358
- lines.push(
5359
- "Safe CLI / HTTP (every connector \u2014 `vercel logs`, Supabase inspect, `sentry-cli`, PostHog API):"
5360
- );
5361
- lines.push(
5362
- '- 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"`.'
5363
- );
5364
- lines.push(
5365
- "- 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."
5366
- );
5367
- lines.push(
5368
- "- Filter (`jq`) to the fields you need (timestamp, path, status, message) \u2014 not the full request object."
5369
- );
5370
- lines.push(
5371
- "- 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."
5372
- );
5373
- lines.push(
5374
- "- 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."
5375
- );
5376
- return lines.join("\n");
5377
- }
5378
- function formatOptionalServicesReminder(integrations) {
5379
- if (connectedOptionalServices(integrations).length === 0) return null;
5380
- 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.";
5381
- }
5382
-
5383
5281
  // src/mcp/viewer-context-tools.ts
5384
5282
  import { z as z3 } from "zod";
5385
5283
 
@@ -6095,7 +5993,7 @@ function formatScheduledPrompt(name, prompt) {
6095
5993
  ${prompt}`;
6096
5994
  }
6097
5995
  async function defaultDeps() {
6098
- const { getOrchestrator: getOrchestrator2, startOrchestration: startOrchestration2 } = await import("./orchestrator-NWKE56BW.js");
5996
+ const { getOrchestrator: getOrchestrator2, startOrchestration: startOrchestration2 } = await import("./orchestrator-5ZBHR6BJ.js");
6099
5997
  const orch = getOrchestrator2();
6100
5998
  return {
6101
5999
  findThread: (id) => findThreadByRef(id),
@@ -6413,7 +6311,7 @@ var Orchestrator = class {
6413
6311
  orphans: orphans.map((o) => ({ path: o.path, repoPath: o.repoPath }))
6414
6312
  });
6415
6313
  }
6416
- const { autoCleanupOrphansEnabled } = await import("./app-settings-EQQZQNYD.js");
6314
+ const { autoCleanupOrphansEnabled } = await import("./app-settings-EHMXHNG5.js");
6417
6315
  if (autoCleanupOrphansEnabled() && shouldRunWorktreeCleanup() && orphans.length > 0) {
6418
6316
  await cleanupOrphanWorktrees({ repoPaths });
6419
6317
  }
@@ -6807,7 +6705,7 @@ var Orchestrator = class {
6807
6705
  }
6808
6706
  await setup;
6809
6707
  if (skipSetup) return;
6810
- const { autoRunAfterSetupEnabled } = await import("./app-settings-EQQZQNYD.js");
6708
+ const { autoRunAfterSetupEnabled } = await import("./app-settings-EHMXHNG5.js");
6811
6709
  if (autoRunAfterSetupEnabled()) {
6812
6710
  try {
6813
6711
  await this.startDev(threadId);
@@ -7146,7 +7044,7 @@ var Orchestrator = class {
7146
7044
  const artifactReminder = thread.agent !== "brightsy" ? formatUiReminder() : null;
7147
7045
  const longRunningReminder = thread.agent !== "brightsy" && !isOrchestratorThread(thread) ? formatLongRunningReminder({ activeRuns: worktreeActiveRuns }) : null;
7148
7046
  const worktreeReminder = thread.agent !== "brightsy" && !isOrchestratorThread(thread) ? formatWorktreeReminder() : null;
7149
- const optionalServicesReminder = thread.agent !== "brightsy" && !isOrchestratorThread(thread) ? formatOptionalServicesReminder(loadAppSettings().integrations) : null;
7047
+ const optionalServicesReminder = thread.agent !== "brightsy" && !isOrchestratorThread(thread) ? await formatOptionalServicesReminderForTurn(loadAppSettings().integrations) : null;
7150
7048
  const issueTicket = issueTicketFromThread(thread, resolveEffectiveIssueSource());
7151
7049
  const issueToolsReminder = thread.agent !== "brightsy" && !isOrchestratorThread(thread) ? formatIssueToolsReminder({
7152
7050
  linear: isLinearConnected(),
@@ -7198,7 +7096,7 @@ ${formatEnvReminder(projectNameForRepoPath(thread.repoPath || thread.worktreePat
7198
7096
  }
7199
7097
  const isBrightsy = fresh.agent === "brightsy";
7200
7098
  const isOrchestration = isOrchestratorThread(fresh);
7201
- const { autoRenameBranchEnabled, getGithubGitAuthMode, gitBranchPrefixSetting } = await import("./app-settings-EQQZQNYD.js");
7099
+ const { autoRenameBranchEnabled, getGithubGitAuthMode, gitBranchPrefixSetting } = await import("./app-settings-EHMXHNG5.js");
7202
7100
  const gitAuthMode = getGithubGitAuthMode();
7203
7101
  const worktreeDirective = isBrightsy || isOrchestration ? null : formatWorktreeDirective(fresh, {
7204
7102
  githubSlug: await withTimeout(
@@ -7217,7 +7115,7 @@ ${formatEnvReminder(projectNameForRepoPath(thread.repoPath || thread.worktreePat
7217
7115
  });
7218
7116
  const artifactDirective = isBrightsy ? null : formatArtifactDirective();
7219
7117
  const longRunningDirective = isBrightsy || isOrchestration ? null : formatLongRunningDirective();
7220
- const optionalServicesDirective = isBrightsy || isOrchestration ? null : formatOptionalServicesDirective(loadAppSettings().integrations);
7118
+ const optionalServicesDirective = isBrightsy || isOrchestration ? null : await formatOptionalServicesDirectiveForTurn(loadAppSettings().integrations);
7221
7119
  const freshIssueTicket = issueTicketFromThread(fresh, resolveEffectiveIssueSource());
7222
7120
  const issueToolsDirective = isBrightsy || isOrchestration ? null : formatIssueToolsDirective({
7223
7121
  linear: isLinearConnected(),
@@ -7394,7 +7292,7 @@ ${formatEnvReminder(projectNameForRepoPath(thread.repoPath || thread.worktreePat
7394
7292
  }
7395
7293
  } catch {
7396
7294
  }
7397
- 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";
7295
+ 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";
7398
7296
  pushTurnStderr(stderrTail, retryNote);
7399
7297
  this.emit({
7400
7298
  type: "turn_output",
@@ -8514,7 +8412,7 @@ ${formatEnvReminder(projectNameForRepoPath(thread.repoPath || thread.worktreePat
8514
8412
  if (Object.keys(patch).length === 0) continue;
8515
8413
  updateThread(t.id, patch);
8516
8414
  }
8517
- const { autoArchiveOnMergeEnabled } = await import("./app-settings-EQQZQNYD.js");
8415
+ const { autoArchiveOnMergeEnabled } = await import("./app-settings-EHMXHNG5.js");
8518
8416
  const latest = this.requireThread(thread.id);
8519
8417
  if (!shouldAutoArchiveOnPrMerge({
8520
8418
  previousPrState: prevState || null,
@@ -8831,7 +8729,7 @@ ${formatEnvReminder(projectNameForRepoPath(thread.repoPath || thread.worktreePat
8831
8729
  await runArchiveScript(thread.repoPath, thread.worktreePath);
8832
8730
  } catch {
8833
8731
  }
8834
- const { deleteBranchOnPurgeEnabled } = await import("./app-settings-EQQZQNYD.js");
8732
+ const { deleteBranchOnPurgeEnabled } = await import("./app-settings-EHMXHNG5.js");
8835
8733
  const deleteBranch = opts?.deleteBranch ?? deleteBranchOnPurgeEnabled();
8836
8734
  await removeWorktree(thread.repoPath, thread.worktreePath, {
8837
8735
  deleteBranch: deleteBranch ? thread.branchName : void 0
@@ -8967,7 +8865,7 @@ async function startOrchestration(opts) {
8967
8865
  sourceRef: "default",
8968
8866
  ...createOpts
8969
8867
  }).catch(async () => {
8970
- const { resolveDefaultBranch: resolveDefaultBranch2, resolveRepoRoot: resolveRepoRoot2 } = await import("./worktree-NKLNVNXX.js");
8868
+ const { resolveDefaultBranch: resolveDefaultBranch2, resolveRepoRoot: resolveRepoRoot2 } = await import("./worktree-2GOK4VYT.js");
8971
8869
  const repo = await resolveRepoRoot2(repoPath);
8972
8870
  const def = await resolveDefaultBranch2(repo);
8973
8871
  return orch.createThread({
@@ -0,0 +1,139 @@
1
+ #!/usr/bin/env node
2
+
3
+
4
+ // src/integrations/optional-services.ts
5
+ var OPTIONAL_SERVICE_IDS = ["vercel", "supabase", "posthog", "sentry"];
6
+ var OPTIONAL_SERVICES = [
7
+ {
8
+ id: "vercel",
9
+ label: "Vercel",
10
+ hint: "Deploys and project settings. Agents use the `vercel` CLI (`VERCEL_TOKEN`).",
11
+ tokenPlaceholder: "token from vercel.com/account/tokens",
12
+ tokenDocs: "https://vercel.com/account/tokens",
13
+ envKey: "VERCEL_TOKEN",
14
+ cli: "vercel",
15
+ npmPackage: "vercel"
16
+ },
17
+ {
18
+ id: "supabase",
19
+ label: "Supabase",
20
+ hint: "Database and project management. Agents use the `supabase` CLI (`SUPABASE_ACCESS_TOKEN`).",
21
+ tokenPlaceholder: "sbp_\u2026",
22
+ tokenDocs: "https://supabase.com/dashboard/account/tokens",
23
+ envKey: "SUPABASE_ACCESS_TOKEN",
24
+ cli: "supabase",
25
+ npmPackage: "supabase"
26
+ },
27
+ {
28
+ id: "posthog",
29
+ label: "PostHog",
30
+ hint: "Product analytics. Agents call `posthog_api` on the Sideboard MCP server.",
31
+ tokenPlaceholder: "phx_\u2026",
32
+ tokenDocs: "https://app.posthog.com/settings/user-api-keys",
33
+ envKey: "POSTHOG_PERSONAL_API_KEY",
34
+ hostEnvKey: "POSTHOG_HOST",
35
+ defaultHost: "https://us.posthog.com",
36
+ hostPlaceholder: "https://us.posthog.com"
37
+ },
38
+ {
39
+ id: "sentry",
40
+ label: "Sentry",
41
+ hint: "Error tracking. Agents use `sentry-cli` (`SENTRY_AUTH_TOKEN`).",
42
+ tokenPlaceholder: "sntrys_\u2026 or auth token",
43
+ tokenDocs: "https://sentry.io/settings/account/api/auth-tokens/",
44
+ envKey: "SENTRY_AUTH_TOKEN",
45
+ cli: "sentry-cli",
46
+ npmPackage: "@sentry/cli",
47
+ hostEnvKey: "SENTRY_URL",
48
+ defaultHost: "https://sentry.io",
49
+ hostPlaceholder: "https://sentry.io"
50
+ }
51
+ ];
52
+ function optionalServiceSpec(id) {
53
+ const spec = OPTIONAL_SERVICES.find((s) => s.id === id);
54
+ if (!spec) throw new Error(`Unknown optional service: ${id}`);
55
+ return spec;
56
+ }
57
+ function isOptionalServiceId(value) {
58
+ return typeof value === "string" && OPTIONAL_SERVICE_IDS.includes(value);
59
+ }
60
+ function normalizeServiceOrigin(raw, fallback) {
61
+ const trimmed = raw?.trim() || fallback;
62
+ try {
63
+ const url = new URL(trimmed.includes("://") ? trimmed : `https://${trimmed}`);
64
+ if (url.protocol !== "http:" && url.protocol !== "https:") return fallback;
65
+ return `${url.protocol}//${url.host}`;
66
+ } catch {
67
+ return fallback;
68
+ }
69
+ }
70
+ function optionalServiceConnected(id, integrations) {
71
+ if (id === "vercel") return Boolean(integrations.vercelToken?.trim());
72
+ if (id === "supabase") return Boolean(integrations.supabaseAccessToken?.trim());
73
+ if (id === "posthog") return Boolean(integrations.posthogPersonalApiKey?.trim());
74
+ return Boolean(integrations.sentryAuthToken?.trim());
75
+ }
76
+ function connectedOptionalServices(integrations) {
77
+ return OPTIONAL_SERVICES.filter((spec) => optionalServiceConnected(spec.id, integrations));
78
+ }
79
+ function cliPresencePhrase(spec, cli) {
80
+ if (!spec.cli || !cli || !(spec.id in cli)) return "";
81
+ return cli[spec.id] ? " (installed)" : " (not installed \u2014 ask the user to press Install CLI in Settings \u2192 Connectors)";
82
+ }
83
+ function connectorDirectiveLine(spec, cli) {
84
+ const extras = spec.hostEnvKey ? ` / \`${spec.hostEnvKey}\`` : "";
85
+ if (spec.cli) {
86
+ return `- ${spec.label}: use \`${spec.cli}\` (\`${spec.envKey}\`${extras})${cliPresencePhrase(spec, cli)}. Do not add a ${spec.label} MCP.`;
87
+ }
88
+ return `- ${spec.label}: call \`posthog_api\`. Path must start with \`/api/\`. GET is the default. POST \`/api/projects/:id/query/\` or \`/api/environments/:id/query/\` is a read and does not need \`write=true\`. Other POST and PATCH require \`write=true\` only when the user asked to change data. Do not read the API key from the environment. Do not add a ${spec.label} MCP.`;
89
+ }
90
+ function connectorReminderBit(spec, cli) {
91
+ if (!spec.cli) return `${spec.label}: \`posthog_api\``;
92
+ const presence = cliPresencePhrase(spec, cli);
93
+ return `${spec.label}: \`${spec.cli}\`${presence}`;
94
+ }
95
+ function formatOptionalServicesDirective(integrations, cli) {
96
+ const connected = connectedOptionalServices(integrations);
97
+ if (connected.length === 0) return null;
98
+ const cliConnected = connected.some((spec) => spec.cli);
99
+ const lines = [
100
+ cliConnected ? "Optional connectors (connected \u2014 CLI tokens are already in this process env):" : "Optional connectors (connected):",
101
+ ...connected.map((spec) => connectorDirectiveLine(spec, cli)),
102
+ cliConnected ? "If a connector MCP is listed but needsAuth or returns unauthorized, do not sign in to that MCP. CLI tokens are already in this process. Do not read a PostHog key from the environment." : "If a connector MCP is listed but needsAuth or returns unauthorized, do not sign in to that MCP. Do not read a PostHog key from the environment.",
103
+ "Do not add a vendor MCP. When a binary is missing, ask the user to press Install CLI in Settings \u2192 Connectors.",
104
+ "When you shell a connector CLI, write bulky output to `.context/cli/` and read a slice."
105
+ ];
106
+ return lines.join("\n");
107
+ }
108
+ function formatOptionalServicesReminder(integrations, cli) {
109
+ const connected = connectedOptionalServices(integrations);
110
+ if (connected.length === 0) return null;
111
+ const bits = connected.map((spec) => connectorReminderBit(spec, cli)).join(". ");
112
+ const tokenBit = connected.some((spec) => spec.cli) ? "CLI tokens are already in this process. " : "";
113
+ return `Settings \u2192 Connectors: ${tokenBit}${bits}. If a connector MCP needsAuth or is unauthorized, ignore it and use the CLI or \`posthog_api\`. Do not add vendor MCPs. Do not read a PostHog key from the environment. Shell dumps from those CLIs go in \`.context/cli/\` \u2014 read a slice.`;
114
+ }
115
+ async function connectedCliPresence(integrations) {
116
+ const ids = connectedOptionalServices(integrations).filter((spec) => spec.cli).map((spec) => spec.id);
117
+ if (ids.length === 0) return void 0;
118
+ try {
119
+ const { optionalCliPresence } = await import("./optional-cli-FRUZSZ3U.js");
120
+ return await optionalCliPresence(ids);
121
+ } catch {
122
+ return void 0;
123
+ }
124
+ }
125
+ async function formatOptionalServicesDirectiveForTurn(integrations) {
126
+ return formatOptionalServicesDirective(integrations, await connectedCliPresence(integrations));
127
+ }
128
+ async function formatOptionalServicesReminderForTurn(integrations) {
129
+ return formatOptionalServicesReminder(integrations, await connectedCliPresence(integrations));
130
+ }
131
+
132
+ export {
133
+ OPTIONAL_SERVICES,
134
+ optionalServiceSpec,
135
+ isOptionalServiceId,
136
+ normalizeServiceOrigin,
137
+ formatOptionalServicesDirectiveForTurn,
138
+ formatOptionalServicesReminderForTurn
139
+ };
@@ -5,17 +5,17 @@ import {
5
5
  compactSummaryPart,
6
6
  isInternalAgentStatusText,
7
7
  lastAssistantMessageText
8
- } from "./chunk-5QOLFOAX.js";
8
+ } from "./chunk-AFLNFGGB.js";
9
9
  import {
10
10
  isCloudCoordinatorThread,
11
11
  isGlobalThread,
12
12
  isOrchestratorThread,
13
13
  isSlackCoordinatorThread
14
- } from "./chunk-KLAQ4G34.js";
14
+ } from "./chunk-IA4MPG7F.js";
15
15
  import {
16
16
  mergeAgentGitAuthEnv,
17
17
  resolveAgentGitAuthEnv
18
- } from "./chunk-5MGLNVNK.js";
18
+ } from "./chunk-3W5SL5EW.js";
19
19
  import {
20
20
  ATTACHMENTS_DIR,
21
21
  DETACHED_JOBS_DIR,
@@ -32,7 +32,7 @@ import {
32
32
  import {
33
33
  assertOrchestratorCapableAgent,
34
34
  contextTokens
35
- } from "./chunk-WRIMAEF2.js";
35
+ } from "./chunk-MVZO7QZ2.js";
36
36
  import {
37
37
  stripNestedElectronEnv
38
38
  } from "./chunk-WWUABK6B.js";
@@ -1674,7 +1674,7 @@ var PORT_RANGE_SIZE = 10;
1674
1674
  var RECLAIM_RETRY_DELAY_MS = 40;
1675
1675
  var RECLAIM_TRIES = 8;
1676
1676
  async function killReclaimable(ports, worktreePath, signal) {
1677
- const { killListenersOnPorts: killListenersOnPorts2, killStaleWorktreeListeners: killStaleWorktreeListeners2 } = await import("./conductor-FOKYVMUE.js");
1677
+ const { killListenersOnPorts: killListenersOnPorts2, killStaleWorktreeListeners: killStaleWorktreeListeners2 } = await import("./conductor-MCU63Z5U.js");
1678
1678
  if (worktreePath) killStaleWorktreeListeners2(ports, worktreePath, signal);
1679
1679
  else killListenersOnPorts2(ports);
1680
1680
  }