@sideboard-ai/core 0.1.293 → 0.1.295

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 (62) hide show
  1. package/dist/{abletime-VFKYNSJT.js → abletime-APP3DZ4P.js} +4 -4
  2. package/dist/{abletime-4WJUVE64.js → abletime-RYDAQ3FE.js} +4 -4
  3. package/dist/{abletime-oauth-ICMB2XV2.js → abletime-oauth-KTERKARA.js} +3 -3
  4. package/dist/{abletime-oauth-FW24YHYX.js → abletime-oauth-ZURGXSY6.js} +3 -3
  5. package/dist/{abletime-rest-OGWC7BC6.js → abletime-rest-4TVIWLZK.js} +3 -3
  6. package/dist/{abletime-rest-HFMRTUDT.js → abletime-rest-EUB6RW7K.js} +3 -3
  7. package/dist/agents/cursor-runner.cjs +128 -50
  8. package/dist/agents/cursor-runner.js +62 -43
  9. package/dist/{agents-SITR5V6F.js → agents-EFHYZUZT.js} +8 -8
  10. package/dist/{agents-WT72O5A3.js → agents-S55DBAVO.js} +6 -6
  11. package/dist/{app-settings-EHMXHNG5.js → app-settings-2IH42VA5.js} +3 -1
  12. package/dist/{app-settings-MR2U6AXN.js → app-settings-3OQWRKOK.js} +3 -1
  13. package/dist/{chunk-3E4NOIXN.js → chunk-3D3GGL6X.js} +3 -3
  14. package/dist/{chunk-UO5C2L2G.js → chunk-6SGYGYH7.js} +1 -1
  15. package/dist/{chunk-RPCKGO3J.js → chunk-ABLHTRRG.js} +17 -12
  16. package/dist/{chunk-NXXQFLNQ.js → chunk-B42H6GJR.js} +2 -2
  17. package/dist/{chunk-MVZO7QZ2.js → chunk-BU6HH5VA.js} +4 -0
  18. package/dist/{chunk-PO3PDNMV.js → chunk-E7G7RY6T.js} +3 -3
  19. package/dist/{chunk-AFLNFGGB.js → chunk-ED4ZXQVO.js} +1 -0
  20. package/dist/{chunk-K6IOJI3L.js → chunk-ER6BGGME.js} +70 -1
  21. package/dist/{chunk-NFPWLDCH.js → chunk-FAXOEKQR.js} +5 -5
  22. package/dist/{chunk-MIVX7QKI.js → chunk-HO5R3ZRH.js} +1 -0
  23. package/dist/{chunk-GU6DT6NO.js → chunk-HSF2RQSQ.js} +5 -5
  24. package/dist/{chunk-WRDKJRWF.js → chunk-HWIIRVYE.js} +5 -5
  25. package/dist/{chunk-7UUILVMV.js → chunk-IOY2LF3Y.js} +1 -1
  26. package/dist/{chunk-OH4EN323.js → chunk-ISEYRGMP.js} +2 -2
  27. package/dist/{chunk-4YXXLWDI.js → chunk-KCP6IVRI.js} +6 -6
  28. package/dist/{chunk-MYJYINTS.js → chunk-LZVWKJXY.js} +3 -3
  29. package/dist/{chunk-Y67TBJD5.js → chunk-MOP5L5QZ.js} +3 -3
  30. package/dist/{chunk-YSLCWCMJ.js → chunk-Q3DPZ4DE.js} +1 -1
  31. package/dist/{chunk-AF2DMY3K.js → chunk-QDDTVIWE.js} +13 -4
  32. package/dist/{chunk-B3BPLPKQ.js → chunk-R3R3ZDFC.js} +2 -2
  33. package/dist/{chunk-36J3IZBS.js → chunk-RSATPXU4.js} +4 -0
  34. package/dist/{chunk-XZW3BXZW.js → chunk-RWIYYFID.js} +20 -14
  35. package/dist/{chunk-AHH5USEA.js → chunk-SSETL5EX.js} +2 -2
  36. package/dist/{chunk-W2KZTDET.js → chunk-WZCPZVUC.js} +2 -2
  37. package/dist/{chunk-4BXRRHDC.js → chunk-XCXUVX7I.js} +12 -3
  38. package/dist/{chunk-LSHGJI4S.js → chunk-XXT3C2EF.js} +22 -22
  39. package/dist/{chunk-ZRQWV3MS.js → chunk-YEIPPZ5W.js} +3 -3
  40. package/dist/{chunk-IP5WSADC.js → chunk-YFKAC4LB.js} +19 -19
  41. package/dist/{chunk-2VGLZIU6.js → chunk-ZEP6JIRF.js} +1 -1
  42. package/dist/{conductor-P7XPGYF4.js → conductor-GURU5XD7.js} +5 -5
  43. package/dist/{conductor-MAYZSFL6.js → conductor-HT2UANDY.js} +6 -6
  44. package/dist/{coordinator-prompt-NAM5JHLT.js → coordinator-prompt-AROMFCP2.js} +3 -3
  45. package/dist/{coordinator-prompt-OZFKNCM3.js → coordinator-prompt-K6XHUG3N.js} +3 -3
  46. package/dist/{global-workspace-UGR6FQXI.js → global-workspace-4WAU4PAL.js} +3 -3
  47. package/dist/{global-workspace-CTFQDG7G.js → global-workspace-PX4GUVLW.js} +3 -3
  48. package/dist/index.cjs +58 -13
  49. package/dist/index.d.cts +9 -1
  50. package/dist/index.d.ts +9 -1
  51. package/dist/index.js +40 -24
  52. package/dist/mcp/run-stdio.cjs +78 -37
  53. package/dist/mcp/run-stdio.js +39 -16
  54. package/dist/{optional-cli-FRUZSZ3U.js → optional-cli-JQVNSMSU.js} +3 -3
  55. package/dist/{optional-cli-6SW4OOX3.js → optional-cli-PZXDOVJJ.js} +4 -4
  56. package/dist/{orchestrator-BOGVTCWI.js → orchestrator-VDYZSZWY.js} +11 -11
  57. package/dist/{orchestrator-4QVF6CE2.js → orchestrator-VNSEXL62.js} +9 -9
  58. package/dist/{workspaces-QNKFBA63.js → workspaces-MFU3IGAP.js} +3 -3
  59. package/dist/{workspaces-YNZXVBSF.js → workspaces-U7SSD27C.js} +3 -3
  60. package/dist/{worktree-EMCWDPZJ.js → worktree-2VSHRI72.js} +2 -2
  61. package/dist/{worktree-ERRH4TAG.js → worktree-TQKASYPZ.js} +2 -2
  62. package/package.json +1 -1
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  DEFAULT_ABLETIME_HOST,
3
3
  normalizeAbleTimeHost
4
- } from "./chunk-NFPWLDCH.js";
4
+ } from "./chunk-FAXOEKQR.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-36J3IZBS.js";
13
+ } from "./chunk-RSATPXU4.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-4WJUVE64.js");
283
+ const { getAbleTimeOrientation } = await import("./abletime-RYDAQ3FE.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-MVZO7QZ2.js";
22
+ } from "./chunk-BU6HH5VA.js";
23
23
  import {
24
24
  allocateTeamName,
25
25
  listThreads,
@@ -21,16 +21,16 @@ import {
21
21
  looksLikeSkillBody,
22
22
  skillCommandFromBody,
23
23
  withEventParentId
24
- } from "./chunk-AFLNFGGB.js";
24
+ } from "./chunk-ED4ZXQVO.js";
25
25
  import {
26
26
  isOrchestratorThread
27
- } from "./chunk-PO3PDNMV.js";
27
+ } from "./chunk-E7G7RY6T.js";
28
28
  import {
29
29
  codexUnattendedGitConfigArgs,
30
30
  mergeAgentGitAuthEnv,
31
31
  resolveAgentGitAuthEnv,
32
32
  resolveCodexGitWritableRoots
33
- } from "./chunk-UO5C2L2G.js";
33
+ } from "./chunk-6SGYGYH7.js";
34
34
  import {
35
35
  npmGlobalNodeModules,
36
36
  run
@@ -40,10 +40,11 @@ import {
40
40
  fromInclusiveInputUsage,
41
41
  isAbleTimeConnected,
42
42
  isLinearConnected,
43
+ isPosthogConnected,
43
44
  loadAppSettings,
44
45
  resolveAgentExecutable,
45
46
  resolveClaudeExecutable
46
- } from "./chunk-MVZO7QZ2.js";
47
+ } from "./chunk-BU6HH5VA.js";
47
48
  import {
48
49
  isElectronLikeCommand,
49
50
  unwrapStrippedElectronLaunch,
@@ -483,6 +484,10 @@ var CLAUDE_CHROME_ALLOWED_TOOLS = [
483
484
  "mcp__claude-in-chrome__*",
484
485
  "Skill(claude-in-chrome)"
485
486
  ];
487
+ var CLAUDE_POSTHOG_CONNECTOR_ALLOWED_TOOLS = [
488
+ "mcp__claude_ai_PostHog",
489
+ "mcp__claude_ai_PostHog__*"
490
+ ];
486
491
 
487
492
  // src/agents/orch-mcp-isolation.ts
488
493
  import { existsSync as existsSync7, readFileSync as readFileSync3 } from "fs";
@@ -976,11 +981,9 @@ var SIDEBOARD_GITHUB_MCP_ALLOWED_TOOLS = ["mcp__sideboard__github_*"];
976
981
  var SIDEBOARD_LINEAR_MCP_ALLOWED_TOOLS = ["mcp__sideboard__linear_*"];
977
982
  var SIDEBOARD_ABLETIME_MCP_ALLOWED_TOOLS = ["mcp__sideboard__abletime_*"];
978
983
  function sideboardWorktreeAllowedTools(opts) {
979
- const out = [...SIDEBOARD_ARTIFACT_MCP_ALLOWED_TOOLS];
980
- if (!opts?.planMode) {
981
- const idx = out.indexOf("mcp__sideboard__present_plan");
982
- if (idx >= 0) out.splice(idx, 1);
983
- }
984
+ const out = SIDEBOARD_ARTIFACT_MCP_ALLOWED_TOOLS.filter(
985
+ (tool) => (opts?.planMode || tool !== "mcp__sideboard__present_plan") && (opts?.posthog || tool !== "mcp__sideboard__posthog_api")
986
+ );
984
987
  if (opts?.github !== false) out.push(...SIDEBOARD_GITHUB_MCP_ALLOWED_TOOLS);
985
988
  if (opts?.linear) out.push(...SIDEBOARD_LINEAR_MCP_ALLOWED_TOOLS);
986
989
  if (opts?.abletime) out.push(...SIDEBOARD_ABLETIME_MCP_ALLOWED_TOOLS);
@@ -2015,7 +2018,7 @@ var claudeAdapter = {
2015
2018
  );
2016
2019
  }
2017
2020
  const mode = permissionMode(thread);
2018
- const { isOrchestratorThread: isOrchestratorThread2 } = await import("./global-workspace-CTFQDG7G.js");
2021
+ const { isOrchestratorThread: isOrchestratorThread2 } = await import("./global-workspace-PX4GUVLW.js");
2019
2022
  const isOrchestrator = isOrchestratorThread2(thread);
2020
2023
  const rpc = worktreeAgentRpc(isOrchestrator);
2021
2024
  const injectedServers = await buildInjectedMcpServers({
@@ -2045,9 +2048,11 @@ var claudeAdapter = {
2045
2048
  github: true,
2046
2049
  linear: isLinearConnected(),
2047
2050
  abletime: isAbleTimeConnected(),
2048
- planMode: thread.planMode
2051
+ planMode: thread.planMode,
2052
+ posthog: isPosthogConnected()
2049
2053
  }),
2050
- ...brightsyMcpAllowedTools(injectedBrightsyNames)
2054
+ ...brightsyMcpAllowedTools(injectedBrightsyNames),
2055
+ ...isPosthogConnected() ? [] : CLAUDE_POSTHOG_CONNECTOR_ALLOWED_TOOLS
2051
2056
  ];
2052
2057
  }
2053
2058
  if (chromeOn) {
@@ -7,7 +7,7 @@ import {
7
7
  } from "./chunk-QVN2WOKJ.js";
8
8
  import {
9
9
  resolveAgentExecutable
10
- } from "./chunk-36J3IZBS.js";
10
+ } from "./chunk-RSATPXU4.js";
11
11
 
12
12
  // src/agents/install.ts
13
13
  import { existsSync } from "fs";
@@ -265,7 +265,7 @@ async function loginAgent(agent) {
265
265
  };
266
266
  }
267
267
  async function loginManagedAccount(accountId) {
268
- const { loadAppSettings } = await import("./app-settings-MR2U6AXN.js");
268
+ const { loadAppSettings } = await import("./app-settings-3OQWRKOK.js");
269
269
  const { loginEnvPrefix } = await import("./managed-accounts-2AK5RIAF.js");
270
270
  const account = loadAppSettings().accounts.accounts.find((a) => a.id === accountId);
271
271
  if (!account) {
@@ -1880,6 +1880,9 @@ function disconnectLinearConnection() {
1880
1880
  delete integrations.linearOrganizationName;
1881
1881
  return saveAppSettings({ ...current, integrations });
1882
1882
  }
1883
+ function isPosthogConnected(settings = loadAppSettings()) {
1884
+ return Boolean(settings.integrations.posthogPersonalApiKey?.trim());
1885
+ }
1883
1886
  function isAbleTimeConnected(settings = loadAppSettings()) {
1884
1887
  return Boolean(
1885
1888
  settings.integrations.abletimeAccessToken?.trim() || settings.integrations.abletimeRefreshToken?.trim()
@@ -2320,6 +2323,7 @@ export {
2320
2323
  isLinearConnected,
2321
2324
  saveLinearOAuth,
2322
2325
  disconnectLinearConnection,
2326
+ isPosthogConnected,
2323
2327
  isAbleTimeConnected,
2324
2328
  getAbleTimeAccessToken,
2325
2329
  getAbleTimeHost,
@@ -5,7 +5,7 @@ import {
5
5
  ensureGhPreferOrigin,
6
6
  resolveGithubRepoSlug,
7
7
  resolveRepoRoot
8
- } from "./chunk-UO5C2L2G.js";
8
+ } from "./chunk-6SGYGYH7.js";
9
9
  import {
10
10
  ATTACHMENTS_DIR,
11
11
  attachmentsGitignoreBody
@@ -22,7 +22,7 @@ import {
22
22
  resolveThreadDefaults,
23
23
  resolveViewerProfile,
24
24
  resolveViewerProfileForRepo
25
- } from "./chunk-MVZO7QZ2.js";
25
+ } from "./chunk-BU6HH5VA.js";
26
26
  import {
27
27
  allocateTeamName,
28
28
  createEmptyThread,
@@ -346,7 +346,7 @@ var COORDINATOR_TOOL_PLAYBOOK = [
346
346
  "- linear_* (when Linear is connected) \u2014 list_teams for team key/states; linear_list_projects for project names; get/search include the project a ticket is on; 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 when they were asked to do the work. When reviewing a PR or ticket, do not comment or update until the user types a next step \u2014 they should work through the feedback in chat first. Do not tell the child to ask_user after the review. Scope errors: reconnect Linear in Account settings. Prefer these over any Linear MCP the CLI may still list.",
347
347
  "- github_* \u2014 get/comment/update/create GitHub issues via Account `gh` (#123). github_list_projects and get/search include GitHub Projects. projectsError or a missing read:project scope \u2192 `gh auth refresh -s read:project`. Worktree agents have these too. Prefer over any vendor GitHub MCP. Pass parent= for spin-offs. When reviewing a PR or ticket, do not comment, submit `gh pr review`, or update the PR/ticket until the user types a next step.",
348
348
  "- abletime_* (when AbleTime is connected) \u2014 orientation first; abletime_list_projects lists projects; get/list include the project a task is on; get/comment/update/create (parent= for spin-offs); ensure_task when work has no ticket (or create_workspace from the default branch auto-creates one). Worktree agents have the same Account tools. Same review-write gate as Linear/GitHub.",
349
- "- Optional connectors (Vercel, Supabase, Sentry) in Settings \u2192 Connectors inject tokens into worktree agent env when connected. Prefer official CLIs (`vercel`, `supabase`, `sentry-cli`). PostHog is the Sideboard tool `posthog_api` (GET by default; POST `/api/projects/:id/query/` or `/api/environments/:id/query/` is a read and does not need write=true; other POST and PATCH need write=true only when the user asked to change data). The PostHog key stays in the vault \u2014 do not read it from the environment. If a connector MCP needsAuth or is unauthorized, do not sign in \u2014 use the native CLI or `posthog_api`. Tell any worktree agent (Claude / Cursor / Codex / OpenCode) to write CLI output to `.context/cli/` and read a slice. If a CLI is missing, the user presses Install CLI on that row. Do not add vendor MCPs. Git (`gh`) stays Settings \u2192 Git; issue tracking stays Settings \u2192 Issues. The phone remote is Settings \u2192 Remote \u2014 do not look up Slack users.",
349
+ "- Optional connectors (Vercel, Supabase, Sentry) in Settings \u2192 Connectors inject tokens into worktree agent env when connected. Prefer official CLIs (`vercel`, `supabase`, `sentry-cli`). When Settings \u2192 Connectors has a PostHog personal API key, PostHog is the Sideboard tool `posthog_api` (GET by default; POST `/api/projects/:id/query/` or `/api/environments/:id/query/` is a read and does not need write=true; other POST and PATCH need write=true only when the user asked to change data). The PostHog key stays in the vault \u2014 do not read it from the environment, and do not sign in to a PostHog MCP. When no PostHog API key is set, leave the Claude PostHog connector alone. If a Vercel, Supabase, or Sentry MCP needsAuth or is unauthorized, do not sign in \u2014 use the native CLI. Tell any worktree agent (Claude / Cursor / Codex / OpenCode) to write CLI output to `.context/cli/` and read a slice. If a CLI is missing, the user presses Install CLI on that row. Do not add vendor MCPs. Git (`gh`) stays Settings \u2192 Git; issue tracking stays Settings \u2192 Issues. The phone remote is Settings \u2192 Remote \u2014 do not look up Slack users.",
350
350
  "- get_pr_stack / open_pr_stack_layers / add_stack_layer / create_pr_stack \u2014 GitHub stacked PRs (`gh stack`); one worktree per layer",
351
351
  "- list_models \u2014 only when you need a specific model (rare); otherwise omit model so Account defaults apply",
352
352
  "- list_chats / get_chat \u2014 live thread list (parent id + last message preview). get_chat on this orchestration chat lists child worktree agents (status + lastText). blockedReason is why that agent is waiting on a person. Also includes usage / lastTurnUsage.",
@@ -1207,6 +1207,7 @@ export {
1207
1207
  looksLikeHugeToolResultDump,
1208
1208
  clipToolResultForStore,
1209
1209
  looksLikeV8Oom,
1210
+ HUGE_TOOL_RESULT_SUMMARY,
1210
1211
  summarizeTurnStderr,
1211
1212
  looksLikeInvalidAgentSession,
1212
1213
  looksLikeBrightsyEmptyCompletion,
@@ -1,7 +1,10 @@
1
1
  import {
2
+ HUGE_TOOL_RESULT_SUMMARY,
2
3
  clipToolResultForStore,
4
+ formatUnknownDetail,
5
+ looksLikeCursorStreamCutOff,
3
6
  looksLikeHugeToolResultDump
4
- } from "./chunk-MIVX7QKI.js";
7
+ } from "./chunk-HO5R3ZRH.js";
5
8
  import {
6
9
  CLI_DIR
7
10
  } from "./chunk-6K64FJDD.js";
@@ -73,6 +76,68 @@ function clipAgentEventForEmit(event, cwd) {
73
76
  return event;
74
77
  }
75
78
 
79
+ // src/agents/cursor-tool-guard.ts
80
+ var CURSOR_TOOL_RECOVERY_HINT = "Continue with a smaller request. If you were reading a large file or API payload, pass offset and limit or write the output to .context/cli/ and read a slice. Do not retry the same call.";
81
+ function cursorToolErrorText(err) {
82
+ const raw = formatUnknownDetail(err).replace(/\s+/g, " ").trim();
83
+ const message = looksLikeHugeToolResultDump(raw) ? HUGE_TOOL_RESULT_SUMMARY : (raw || "unknown tool error").slice(0, 500);
84
+ return `Error: ${message}
85
+ ${CURSOR_TOOL_RECOVERY_HINT}`;
86
+ }
87
+ function cursorToolErrorResult(err) {
88
+ return {
89
+ isError: true,
90
+ content: [{ type: "text", text: cursorToolErrorText(err) }]
91
+ };
92
+ }
93
+ function boundedCursorToolResult(result, opts) {
94
+ const prefix = opts?.name ?? "cursor-tool";
95
+ if (typeof result === "string") {
96
+ return spillAndClipToolResult(result, { cwd: opts?.cwd, prefix });
97
+ }
98
+ if (result == null) {
99
+ return cursorToolErrorText(new Error("tool returned no result"));
100
+ }
101
+ let json;
102
+ try {
103
+ json = JSON.stringify(result);
104
+ } catch (err) {
105
+ return cursorToolErrorText(err);
106
+ }
107
+ return spillAndClipToolResult(json, { cwd: opts?.cwd, prefix });
108
+ }
109
+ function guardCursorCustomTool(tool, opts) {
110
+ const execute = tool.execute.bind(tool);
111
+ return {
112
+ ...tool,
113
+ execute: async (args, context) => {
114
+ try {
115
+ const result = await execute(args, context);
116
+ return boundedCursorToolResult(result, opts);
117
+ } catch (err) {
118
+ return cursorToolErrorResult(err);
119
+ }
120
+ }
121
+ };
122
+ }
123
+ var NON_RECOVERABLE_RUN_ERROR = /invalid (?:user )?api key|not logged in|not authenticated|unauthorized|credit balance|out of credits|insufficient.?quota|usage limit|you've hit your|too many requests|rate.?limit/;
124
+ function shouldReturnRunErrorToAgent(detail) {
125
+ const text = detail.trim();
126
+ if (!text) return false;
127
+ if (looksLikeHugeToolResultDump(text) || looksLikeCursorStreamCutOff(text)) return true;
128
+ const head = text.slice(0, 2e3).toLowerCase();
129
+ if (NON_RECOVERABLE_RUN_ERROR.test(head)) return false;
130
+ return true;
131
+ }
132
+ function cursorRunErrorRecoveryPrompt(detail) {
133
+ const summary = looksLikeHugeToolResultDump(detail) ? HUGE_TOOL_RESULT_SUMMARY : detail.replace(/\s+/g, " ").trim().slice(0, 400);
134
+ return [
135
+ "A tool call failed before its result reached you. The session is still open.",
136
+ `Error: ${summary || "unknown"}`,
137
+ CURSOR_TOOL_RECOVERY_HINT
138
+ ].join("\n");
139
+ }
140
+
76
141
  // src/agent-rpc/cursor-tools.ts
77
142
  function sideboardCursorRpcTools(opts) {
78
143
  const exec = createPilotRpcExecutors(opts);
@@ -106,5 +171,9 @@ function sideboardCursorRpcTools(opts) {
106
171
  export {
107
172
  clipMcpToolResult,
108
173
  clipAgentEventForEmit,
174
+ cursorToolErrorText,
175
+ guardCursorCustomTool,
176
+ shouldReturnRunErrorToAgent,
177
+ cursorRunErrorRecoveryPrompt,
109
178
  sideboardCursorRpcTools
110
179
  };
@@ -4,7 +4,7 @@ import {
4
4
  import {
5
5
  getAbleTimeHost,
6
6
  isAbleTimeConnected
7
- } from "./chunk-36J3IZBS.js";
7
+ } from "./chunk-RSATPXU4.js";
8
8
 
9
9
  // src/integrations/abletime-mcp.ts
10
10
  var DEFAULT_ABLETIME_HOST = "https://track.abletime.com";
@@ -153,7 +153,7 @@ function textsFromUnknown(value) {
153
153
  return "";
154
154
  }
155
155
  async function abletimeMcpRequest(method, params, opts) {
156
- const rawToken = opts?.token ?? await import("./abletime-oauth-ICMB2XV2.js").then((m) => m.ensureAbleTimeAccessToken());
156
+ const rawToken = opts?.token ?? await import("./abletime-oauth-KTERKARA.js").then((m) => m.ensureAbleTimeAccessToken());
157
157
  if (!rawToken?.trim()) {
158
158
  throw new Error("AbleTime is not connected \u2014 paste a personal access token in Account settings");
159
159
  }
@@ -224,9 +224,9 @@ async function callAbleTimeTool(name, args = {}, opts) {
224
224
  if (!opts?.token && !isAbleTimeConnected()) {
225
225
  throw new Error("AbleTime is not connected \u2014 paste a personal access token in Account settings");
226
226
  }
227
- const rawToken = opts?.token ?? await import("./abletime-oauth-ICMB2XV2.js").then((m) => m.ensureAbleTimeAccessToken());
227
+ const rawToken = opts?.token ?? await import("./abletime-oauth-KTERKARA.js").then((m) => m.ensureAbleTimeAccessToken());
228
228
  if (rawToken && ableTimeUsesRest(rawToken)) {
229
- const { callAbleTimeRestTool } = await import("./abletime-rest-HFMRTUDT.js");
229
+ const { callAbleTimeRestTool } = await import("./abletime-rest-EUB6RW7K.js");
230
230
  return callAbleTimeRestTool(name, args, { ...opts, token: rawToken });
231
231
  }
232
232
  const requestOpts = { ...opts, pm: opts?.pm ?? abletimeToolUsesPm(name) };
@@ -242,7 +242,7 @@ async function callAbleTimeTool(name, args = {}, opts) {
242
242
  return await call();
243
243
  }
244
244
  if (rawToken && ableTimeUsesRest(rawToken) && isAbleTimeRejectedCredential(message)) {
245
- const { callAbleTimeRestTool } = await import("./abletime-rest-HFMRTUDT.js");
245
+ const { callAbleTimeRestTool } = await import("./abletime-rest-EUB6RW7K.js");
246
246
  return callAbleTimeRestTool(name, args, { ...opts, token: rawToken });
247
247
  }
248
248
  throw err instanceof Error ? new Error(rewriteAbleTimeError(err.message)) : err;
@@ -393,6 +393,7 @@ export {
393
393
  looksLikeHugeToolResultDump,
394
394
  clipToolResultForStore,
395
395
  looksLikeV8Oom,
396
+ HUGE_TOOL_RESULT_SUMMARY,
396
397
  TOOL_RESULT_STORE_MAX_CHARS,
397
398
  summarizeTurnStderr,
398
399
  looksLikeInvalidAgentSession,
@@ -6,7 +6,7 @@ import {
6
6
  import {
7
7
  getAbleTimeHost,
8
8
  isAbleTimeConnected
9
- } from "./chunk-MVZO7QZ2.js";
9
+ } from "./chunk-BU6HH5VA.js";
10
10
 
11
11
  // src/integrations/abletime-mcp.ts
12
12
  var DEFAULT_ABLETIME_HOST = "https://track.abletime.com";
@@ -155,7 +155,7 @@ function textsFromUnknown(value) {
155
155
  return "";
156
156
  }
157
157
  async function abletimeMcpRequest(method, params, opts) {
158
- const rawToken = opts?.token ?? await import("./abletime-oauth-FW24YHYX.js").then((m) => m.ensureAbleTimeAccessToken());
158
+ const rawToken = opts?.token ?? await import("./abletime-oauth-ZURGXSY6.js").then((m) => m.ensureAbleTimeAccessToken());
159
159
  if (!rawToken?.trim()) {
160
160
  throw new Error("AbleTime is not connected \u2014 paste a personal access token in Account settings");
161
161
  }
@@ -226,9 +226,9 @@ async function callAbleTimeTool(name, args = {}, opts) {
226
226
  if (!opts?.token && !isAbleTimeConnected()) {
227
227
  throw new Error("AbleTime is not connected \u2014 paste a personal access token in Account settings");
228
228
  }
229
- const rawToken = opts?.token ?? await import("./abletime-oauth-FW24YHYX.js").then((m) => m.ensureAbleTimeAccessToken());
229
+ const rawToken = opts?.token ?? await import("./abletime-oauth-ZURGXSY6.js").then((m) => m.ensureAbleTimeAccessToken());
230
230
  if (rawToken && ableTimeUsesRest(rawToken)) {
231
- const { callAbleTimeRestTool } = await import("./abletime-rest-OGWC7BC6.js");
231
+ const { callAbleTimeRestTool } = await import("./abletime-rest-4TVIWLZK.js");
232
232
  return callAbleTimeRestTool(name, args, { ...opts, token: rawToken });
233
233
  }
234
234
  const requestOpts = { ...opts, pm: opts?.pm ?? abletimeToolUsesPm(name) };
@@ -244,7 +244,7 @@ async function callAbleTimeTool(name, args = {}, opts) {
244
244
  return await call();
245
245
  }
246
246
  if (rawToken && ableTimeUsesRest(rawToken) && isAbleTimeRejectedCredential(message)) {
247
- const { callAbleTimeRestTool } = await import("./abletime-rest-OGWC7BC6.js");
247
+ const { callAbleTimeRestTool } = await import("./abletime-rest-4TVIWLZK.js");
248
248
  return callAbleTimeRestTool(name, args, { ...opts, token: rawToken });
249
249
  }
250
250
  throw err instanceof Error ? new Error(rewriteAbleTimeError(err.message)) : err;
@@ -5,17 +5,17 @@ import {
5
5
  compactSummaryPart,
6
6
  isInternalAgentStatusText,
7
7
  lastAssistantMessageText
8
- } from "./chunk-AFLNFGGB.js";
8
+ } from "./chunk-ED4ZXQVO.js";
9
9
  import {
10
10
  isCloudCoordinatorThread,
11
11
  isGlobalThread,
12
12
  isOrchestratorThread,
13
13
  isSlackCoordinatorThread
14
- } from "./chunk-PO3PDNMV.js";
14
+ } from "./chunk-E7G7RY6T.js";
15
15
  import {
16
16
  mergeAgentGitAuthEnv,
17
17
  resolveAgentGitAuthEnv
18
- } from "./chunk-UO5C2L2G.js";
18
+ } from "./chunk-6SGYGYH7.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-MVZO7QZ2.js";
35
+ } from "./chunk-BU6HH5VA.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-P7XPGYF4.js");
1677
+ const { killListenersOnPorts: killListenersOnPorts2, killStaleWorktreeListeners: killStaleWorktreeListeners2 } = await import("./conductor-GURU5XD7.js");
1678
1678
  if (worktreePath) killStaleWorktreeListeners2(ports, worktreePath, signal);
1679
1679
  else killListenersOnPorts2(ports);
1680
1680
  }
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  extractJsonErrorMessage,
3
3
  formatUnknownDetail
4
- } from "./chunk-MIVX7QKI.js";
4
+ } from "./chunk-HO5R3ZRH.js";
5
5
  import {
6
6
  npmGlobalNodeModules,
7
7
  run
@@ -2,11 +2,11 @@ import {
2
2
  OPTIONAL_SERVICES,
3
3
  isOptionalServiceId,
4
4
  optionalServiceSpec
5
- } from "./chunk-AF2DMY3K.js";
5
+ } from "./chunk-QDDTVIWE.js";
6
6
  import {
7
7
  installNpmGlobalPackage,
8
8
  whichOnPath
9
- } from "./chunk-NXXQFLNQ.js";
9
+ } from "./chunk-B42H6GJR.js";
10
10
  import {
11
11
  enrichPathWithNpmGlobalBin
12
12
  } from "./chunk-QVN2WOKJ.js";
@@ -2,17 +2,17 @@ import {
2
2
  compactSummaryPart,
3
3
  isInternalAgentStatusText,
4
4
  lastAssistantMessageText
5
- } from "./chunk-YSLCWCMJ.js";
5
+ } from "./chunk-Q3DPZ4DE.js";
6
6
  import {
7
7
  isCloudCoordinatorThread,
8
8
  isGlobalThread,
9
9
  isOrchestratorThread,
10
10
  isSlackCoordinatorThread
11
- } from "./chunk-ZRQWV3MS.js";
11
+ } from "./chunk-YEIPPZ5W.js";
12
12
  import {
13
13
  mergeAgentGitAuthEnv,
14
14
  resolveAgentGitAuthEnv
15
- } from "./chunk-2VGLZIU6.js";
15
+ } from "./chunk-ZEP6JIRF.js";
16
16
  import {
17
17
  allocateTeamName,
18
18
  createEmptyThread,
@@ -29,7 +29,7 @@ import {
29
29
  } from "./chunk-2P4XKWV2.js";
30
30
  import {
31
31
  clipToolResultForStore
32
- } from "./chunk-MIVX7QKI.js";
32
+ } from "./chunk-HO5R3ZRH.js";
33
33
  import {
34
34
  ATTACHMENTS_DIR,
35
35
  DETACHED_JOBS_DIR,
@@ -43,7 +43,7 @@ import {
43
43
  import {
44
44
  assertOrchestratorCapableAgent,
45
45
  contextTokens
46
- } from "./chunk-36J3IZBS.js";
46
+ } from "./chunk-RSATPXU4.js";
47
47
  import {
48
48
  stripNestedElectronEnv
49
49
  } from "./chunk-4TR3HZFT.js";
@@ -1776,7 +1776,7 @@ var PORT_RANGE_SIZE = 10;
1776
1776
  var RECLAIM_RETRY_DELAY_MS = 40;
1777
1777
  var RECLAIM_TRIES = 8;
1778
1778
  async function killReclaimable(ports, worktreePath, signal) {
1779
- const { killListenersOnPorts: killListenersOnPorts2, killStaleWorktreeListeners: killStaleWorktreeListeners2 } = await import("./conductor-MAYZSFL6.js");
1779
+ const { killListenersOnPorts: killListenersOnPorts2, killStaleWorktreeListeners: killStaleWorktreeListeners2 } = await import("./conductor-HT2UANDY.js");
1780
1780
  if (worktreePath) killStaleWorktreeListeners2(ports, worktreePath, signal);
1781
1781
  else killListenersOnPorts2(ports);
1782
1782
  }
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  abletimeRestUrl,
3
3
  textFromAbleTimeDoc
4
- } from "./chunk-B3BPLPKQ.js";
4
+ } from "./chunk-R3R3ZDFC.js";
5
5
  import {
6
6
  assertAbleTimeCredential,
7
7
  callAbleTimeTool,
8
8
  normalizeAbleTimeHost,
9
9
  rewriteAbleTimeError
10
- } from "./chunk-NFPWLDCH.js";
10
+ } from "./chunk-FAXOEKQR.js";
11
11
  import {
12
12
  httpFetch
13
13
  } from "./chunk-JAT3JFOS.js";
@@ -20,7 +20,7 @@ import {
20
20
  getAbleTimeHost,
21
21
  isAbleTimeConnected,
22
22
  saveAbleTimeConnection
23
- } from "./chunk-36J3IZBS.js";
23
+ } from "./chunk-RSATPXU4.js";
24
24
 
25
25
  // src/integrations/issue-attachments.ts
26
26
  import { existsSync, mkdirSync, writeFileSync } from "fs";
@@ -3,13 +3,13 @@
3
3
  import {
4
4
  abletimeRestUrl,
5
5
  textFromAbleTimeDoc
6
- } from "./chunk-AHH5USEA.js";
6
+ } from "./chunk-SSETL5EX.js";
7
7
  import {
8
8
  assertAbleTimeCredential,
9
9
  callAbleTimeTool,
10
10
  normalizeAbleTimeHost,
11
11
  rewriteAbleTimeError
12
- } from "./chunk-GU6DT6NO.js";
12
+ } from "./chunk-HSF2RQSQ.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-MVZO7QZ2.js";
25
+ } from "./chunk-BU6HH5VA.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-MIVX7QKI.js";
3
+ } from "./chunk-HO5R3ZRH.js";
4
4
 
5
5
  // src/agents/message-parts.ts
6
6
  function asRecord(input) {
@@ -4,7 +4,7 @@ import {
4
4
  import {
5
5
  loadAppSettings,
6
6
  saveAppSettings
7
- } from "./chunk-36J3IZBS.js";
7
+ } from "./chunk-RSATPXU4.js";
8
8
 
9
9
  // src/integrations/optional-services.ts
10
10
  var OPTIONAL_SERVICE_IDS = ["vercel", "supabase", "posthog", "sentry"];
@@ -235,6 +235,12 @@ function connectorDirectiveLine(spec, cli) {
235
235
  }
236
236
  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.`;
237
237
  }
238
+ function connectorAuthCaution(posthog, cliConnected) {
239
+ const signIn = posthog ? "If a connector MCP is listed but needsAuth or returns unauthorized, do not sign in to that MCP." : "If a Vercel, Supabase, or Sentry MCP is listed but needsAuth or returns unauthorized, do not sign in to that MCP.";
240
+ const token = cliConnected ? " CLI tokens are already in this process." : "";
241
+ const key = posthog ? " Do not read a PostHog key from the environment." : "";
242
+ return `${signIn}${token}${key}`;
243
+ }
238
244
  function connectorReminderBit(spec, cli) {
239
245
  if (!spec.cli) return `${spec.label}: \`posthog_api\``;
240
246
  const presence = cliPresencePhrase(spec, cli);
@@ -244,10 +250,11 @@ function formatOptionalServicesDirective(integrations, cli) {
244
250
  const connected = connectedOptionalServices(integrations);
245
251
  if (connected.length === 0) return null;
246
252
  const cliConnected = connected.some((spec) => spec.cli);
253
+ const posthog = connected.some((spec) => spec.id === "posthog");
247
254
  const lines = [
248
255
  cliConnected ? "Optional connectors (connected \u2014 CLI tokens are already in this process env):" : "Optional connectors (connected):",
249
256
  ...connected.map((spec) => connectorDirectiveLine(spec, cli)),
250
- 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.",
257
+ connectorAuthCaution(posthog, cliConnected),
251
258
  "Do not add a vendor MCP. When a binary is missing, ask the user to press Install CLI in Settings \u2192 Connectors.",
252
259
  "When you shell a connector CLI, write bulky output to `.context/cli/` and read a slice."
253
260
  ];
@@ -258,13 +265,15 @@ function formatOptionalServicesReminder(integrations, cli) {
258
265
  if (connected.length === 0) return null;
259
266
  const bits = connected.map((spec) => connectorReminderBit(spec, cli)).join(". ");
260
267
  const tokenBit = connected.some((spec) => spec.cli) ? "CLI tokens are already in this process. " : "";
261
- 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.`;
268
+ const posthog = connected.some((spec) => spec.id === "posthog");
269
+ const auth = posthog ? "If a connector MCP needsAuth or is unauthorized, ignore it and use the CLI or `posthog_api`. Do not read a PostHog key from the environment." : "If a Vercel, Supabase, or Sentry MCP needsAuth or is unauthorized, ignore it and use the CLI.";
270
+ return `Settings \u2192 Connectors: ${tokenBit}${bits}. ${auth} Do not add vendor MCPs. Shell dumps from those CLIs go in \`.context/cli/\` \u2014 read a slice.`;
262
271
  }
263
272
  async function connectedCliPresence(integrations) {
264
273
  const ids = connectedOptionalServices(integrations).filter((spec) => spec.cli).map((spec) => spec.id);
265
274
  if (ids.length === 0) return void 0;
266
275
  try {
267
- const { optionalCliPresence } = await import("./optional-cli-6SW4OOX3.js");
276
+ const { optionalCliPresence } = await import("./optional-cli-PZXDOVJJ.js");
268
277
  return await optionalCliPresence(ids);
269
278
  } catch {
270
279
  return void 0;
@@ -4,14 +4,14 @@ import {
4
4
  normalizeAbleTimeCredential,
5
5
  normalizeAbleTimeHost,
6
6
  rewriteAbleTimeError
7
- } from "./chunk-NFPWLDCH.js";
7
+ } from "./chunk-FAXOEKQR.js";
8
8
  import {
9
9
  httpFetch
10
10
  } from "./chunk-JAT3JFOS.js";
11
11
  import {
12
12
  getAbleTimeAccessToken,
13
13
  getAbleTimeHost
14
- } from "./chunk-36J3IZBS.js";
14
+ } from "./chunk-RSATPXU4.js";
15
15
 
16
16
  // src/integrations/abletime-rest.ts
17
17
  var ABLETIME_REST_PREFIX = "/api/public/v2";
@@ -1906,6 +1906,9 @@ function disconnectLinearConnection() {
1906
1906
  delete integrations.linearOrganizationName;
1907
1907
  return saveAppSettings({ ...current, integrations });
1908
1908
  }
1909
+ function isPosthogConnected(settings = loadAppSettings()) {
1910
+ return Boolean(settings.integrations.posthogPersonalApiKey?.trim());
1911
+ }
1909
1912
  function isAbleTimeConnected(settings = loadAppSettings()) {
1910
1913
  return Boolean(
1911
1914
  settings.integrations.abletimeAccessToken?.trim() || settings.integrations.abletimeRefreshToken?.trim()
@@ -2375,6 +2378,7 @@ export {
2375
2378
  isLinearConnected,
2376
2379
  saveLinearOAuth,
2377
2380
  disconnectLinearConnection,
2381
+ isPosthogConnected,
2378
2382
  isAbleTimeConnected,
2379
2383
  getAbleTimeAccessToken,
2380
2384
  getAbleTimeHost,