@sideboard-ai/core 0.1.346 → 0.1.348

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 (67) hide show
  1. package/dist/{abletime-MSIMJKKQ.js → abletime-3HRWLQZJ.js} +4 -4
  2. package/dist/{abletime-X2TJ6PPK.js → abletime-CGFJZB7L.js} +4 -4
  3. package/dist/{abletime-oauth-DEIENLHC.js → abletime-oauth-JQDSH5OL.js} +3 -3
  4. package/dist/{abletime-oauth-2RUKRZYZ.js → abletime-oauth-QNJQLHR4.js} +3 -3
  5. package/dist/{abletime-rest-UBLSGMSA.js → abletime-rest-TANL5TMY.js} +3 -3
  6. package/dist/{abletime-rest-HWBUPI4R.js → abletime-rest-UQA2CRZN.js} +3 -3
  7. package/dist/{agents-AQM7NLXD.js → agents-5MFGVK7C.js} +7 -7
  8. package/dist/{agents-7CHZO3K3.js → agents-T4XBZZDA.js} +7 -7
  9. package/dist/{app-settings-Q2F57NVK.js → app-settings-PPIMYJKS.js} +3 -1
  10. package/dist/{app-settings-A6JUT2SF.js → app-settings-SNOPJ7P5.js} +3 -1
  11. package/dist/{chunk-RTZO2YJC.js → chunk-2HPVGTHF.js} +2 -2
  12. package/dist/{chunk-GHKJBZW5.js → chunk-4NXGVJA6.js} +2 -2
  13. package/dist/{chunk-O5WRVQFT.js → chunk-5FUAOU3G.js} +1 -1
  14. package/dist/{chunk-3J3XOIHF.js → chunk-62ALWH3T.js} +3 -3
  15. package/dist/{chunk-J3BQHHDZ.js → chunk-6TV6L2DD.js} +4 -4
  16. package/dist/{chunk-4PHOJMZI.js → chunk-6WMNIX2U.js} +35 -2
  17. package/dist/{chunk-4PXHJA5K.js → chunk-7B2OUQON.js} +2 -2
  18. package/dist/{chunk-TD76ORBJ.js → chunk-AJMERXZP.js} +2 -2
  19. package/dist/{chunk-QTDCPMOW.js → chunk-ATS7SYHG.js} +1 -1
  20. package/dist/{chunk-AG2RM3DF.js → chunk-CEQ4Z32M.js} +3 -3
  21. package/dist/{chunk-5TS3KVGI.js → chunk-E77SRVVO.js} +1 -1
  22. package/dist/{chunk-5SJGR3VS.js → chunk-F7WP2U5I.js} +12 -9
  23. package/dist/{chunk-YFPSTG52.js → chunk-FDYMVJFU.js} +5 -5
  24. package/dist/{chunk-IYX53WZY.js → chunk-GAGTEI6B.js} +5 -5
  25. package/dist/{chunk-MB3GOWB3.js → chunk-IVRWRYTH.js} +19 -10
  26. package/dist/{chunk-3DMRQB4Y.js → chunk-JCYGQKER.js} +1 -1
  27. package/dist/{chunk-JHT3CYLT.js → chunk-MOUAM6ZC.js} +1 -1
  28. package/dist/{chunk-Z54FI4VL.js → chunk-NTY5WGRD.js} +2 -2
  29. package/dist/{chunk-5IMXA563.js → chunk-OH3BAUMC.js} +46 -33
  30. package/dist/{chunk-LHU6ZBFB.js → chunk-OHUAAX3O.js} +2 -2
  31. package/dist/{chunk-NQHEEGTH.js → chunk-PVCECFJK.js} +1 -1
  32. package/dist/{chunk-MHRU743Z.js → chunk-Q4TZA4MN.js} +2247 -2155
  33. package/dist/{chunk-4SNEW63T.js → chunk-RUIHNWRV.js} +3 -3
  34. package/dist/{chunk-NDBMDHQ5.js → chunk-RYPD7XWV.js} +5 -5
  35. package/dist/{chunk-FNAP6CCS.js → chunk-UJMCTGV7.js} +2 -2
  36. package/dist/{chunk-JZKNRDKF.js → chunk-WMD77UCY.js} +47 -34
  37. package/dist/{chunk-S3UGLMGE.js → chunk-WWU4SYZR.js} +35 -2
  38. package/dist/{chunk-4YGVJRXY.js → chunk-XNGW4OYD.js} +4 -4
  39. package/dist/{chunk-TW63CYUA.js → chunk-Y6VQX2LY.js} +2679 -2587
  40. package/dist/{chunk-BD7KUYJA.js → chunk-ZJMYCDYQ.js} +5 -5
  41. package/dist/{conductor-DUHRZUQY.js → conductor-EMGMDNHL.js} +5 -5
  42. package/dist/{conductor-3A2TNWUW.js → conductor-LYQKONSA.js} +5 -5
  43. package/dist/{coordinator-prompt-OX6A4MDA.js → coordinator-prompt-DLY3FS2L.js} +4 -4
  44. package/dist/{coordinator-prompt-7QALNDIV.js → coordinator-prompt-WALVMGKI.js} +4 -4
  45. package/dist/{global-workspace-HM2RKBCT.js → global-workspace-7OQ5O6JT.js} +4 -4
  46. package/dist/{global-workspace-6GGS3DWU.js → global-workspace-UG2A3CEM.js} +4 -4
  47. package/dist/index.cjs +1115 -651
  48. package/dist/index.d.cts +61 -6
  49. package/dist/index.d.ts +61 -6
  50. package/dist/index.js +326 -32
  51. package/dist/{linear-WYI64BMX.js → linear-MIJO6DCV.js} +2 -2
  52. package/dist/{linear-JE4WAZ3W.js → linear-PKYJH4WK.js} +2 -2
  53. package/dist/{linear-list-I4NAOWPN.js → linear-list-JPQ27RXG.js} +1 -1
  54. package/dist/{linear-list-CGUCPWTV.js → linear-list-N57PR6JM.js} +1 -1
  55. package/dist/mcp/run-stdio.cjs +524 -235
  56. package/dist/mcp/run-stdio.js +106 -21
  57. package/dist/{optional-cli-7QXXPEN6.js → optional-cli-4GTEDEYJ.js} +3 -3
  58. package/dist/{optional-cli-YHLVTVRK.js → optional-cli-RPJIQBDX.js} +4 -4
  59. package/dist/{orchestrator-OWO6LQ5U.js → orchestrator-4SXTORD2.js} +10 -10
  60. package/dist/{orchestrator-POMFVZLB.js → orchestrator-KNOMW5CZ.js} +10 -10
  61. package/dist/{thread-store-HETUMDVA.js → thread-store-MEUWZDVV.js} +2 -2
  62. package/dist/{thread-store-V5IDUJ4L.js → thread-store-R3G5VBII.js} +2 -2
  63. package/dist/{workspaces-DTMPNDPW.js → workspaces-35T6FW57.js} +4 -4
  64. package/dist/{workspaces-V6IIBSKA.js → workspaces-KWGTP7DI.js} +4 -4
  65. package/dist/{worktree-FX5FT6BI.js → worktree-5P7SCST3.js} +3 -3
  66. package/dist/{worktree-BD3EJE24.js → worktree-ROJXGBWS.js} +3 -3
  67. package/package.json +1 -1
@@ -8,11 +8,11 @@ import {
8
8
  isGlobalThread,
9
9
  isOrchestratorThread,
10
10
  isSlackCoordinatorThread
11
- } from "./chunk-4YGVJRXY.js";
11
+ } from "./chunk-XNGW4OYD.js";
12
12
  import {
13
13
  mergeAgentGitAuthEnv,
14
14
  resolveAgentGitAuthEnv
15
- } from "./chunk-Z54FI4VL.js";
15
+ } from "./chunk-NTY5WGRD.js";
16
16
  import {
17
17
  REVIEW_TAB_TITLE,
18
18
  allocateTeamName,
@@ -24,7 +24,7 @@ import {
24
24
  updateThread,
25
25
  worktreeNameFromPath,
26
26
  writeThread
27
- } from "./chunk-QTDCPMOW.js";
27
+ } from "./chunk-ATS7SYHG.js";
28
28
  import {
29
29
  ensureWorktreeSideboardIgnored
30
30
  } from "./chunk-BMRJNRQK.js";
@@ -49,7 +49,7 @@ import {
49
49
  import {
50
50
  assertOrchestratorCapableAgent,
51
51
  contextTokens
52
- } from "./chunk-4PHOJMZI.js";
52
+ } from "./chunk-6WMNIX2U.js";
53
53
  import {
54
54
  stripNestedElectronEnv
55
55
  } from "./chunk-4TR3HZFT.js";
@@ -1705,7 +1705,7 @@ var PORT_RANGE_SIZE = 10;
1705
1705
  var RECLAIM_RETRY_DELAY_MS = 40;
1706
1706
  var RECLAIM_TRIES = 8;
1707
1707
  async function killReclaimable(ports, worktreePath, signal) {
1708
- const { killListenersOnPorts: killListenersOnPorts2, killStaleWorktreeListeners: killStaleWorktreeListeners2 } = await import("./conductor-DUHRZUQY.js");
1708
+ const { killListenersOnPorts: killListenersOnPorts2, killStaleWorktreeListeners: killStaleWorktreeListeners2 } = await import("./conductor-EMGMDNHL.js");
1709
1709
  if (worktreePath) killStaleWorktreeListeners2(ports, worktreePath, signal);
1710
1710
  else killListenersOnPorts2(ports);
1711
1711
  }
@@ -4,7 +4,7 @@ import {
4
4
  import {
5
5
  loadAppSettings,
6
6
  saveAppSettings
7
- } from "./chunk-4PHOJMZI.js";
7
+ } from "./chunk-6WMNIX2U.js";
8
8
 
9
9
  // src/integrations/optional-services.ts
10
10
  var OPTIONAL_SERVICE_IDS = ["vercel", "supabase", "posthog", "sentry"];
@@ -32,13 +32,12 @@ var OPTIONAL_SERVICES = [
32
32
  {
33
33
  id: "posthog",
34
34
  label: "PostHog",
35
- hint: "Product analytics. Agents call `posthog_api` on the Sideboard MCP server.",
35
+ hint: "Product analytics. Sign in with your browser. Agents call `posthog_api`.",
36
36
  tokenPlaceholder: "phx_\u2026",
37
- tokenDocs: "https://app.posthog.com/settings/user-api-keys",
37
+ tokenDocs: "https://posthog.com/docs/api/oauth",
38
38
  envKey: "POSTHOG_PERSONAL_API_KEY",
39
39
  hostEnvKey: "POSTHOG_HOST",
40
- defaultHost: "https://us.posthog.com",
41
- hostPlaceholder: "https://us.posthog.com"
40
+ defaultHost: "https://us.posthog.com"
42
41
  },
43
42
  {
44
43
  id: "sentry",
@@ -184,6 +183,9 @@ function clearConnection(integrations, id) {
184
183
  }
185
184
  if (id === "posthog") {
186
185
  delete integrations.posthogPersonalApiKey;
186
+ delete integrations.posthogAccessToken;
187
+ delete integrations.posthogRefreshToken;
188
+ delete integrations.posthogTokenExpiresAt;
187
189
  delete integrations.posthogViewerName;
188
190
  delete integrations.posthogHost;
189
191
  return;
@@ -196,6 +198,9 @@ async function connectOptionalService(input) {
196
198
  if (!isOptionalServiceId(input.id)) {
197
199
  throw new Error("Unknown optional service");
198
200
  }
201
+ if (input.id === "posthog") {
202
+ throw new Error("PostHog connects with Sign in, not an API key.");
203
+ }
199
204
  const verified = await verifyOptionalService(input);
200
205
  const current = loadAppSettings();
201
206
  const integrations = { ...current.integrations };
@@ -218,7 +223,11 @@ function disconnectOptionalService(id) {
218
223
  function optionalServiceConnected(id, integrations) {
219
224
  if (id === "vercel") return Boolean(integrations.vercelToken?.trim());
220
225
  if (id === "supabase") return Boolean(integrations.supabaseAccessToken?.trim());
221
- if (id === "posthog") return Boolean(integrations.posthogPersonalApiKey?.trim());
226
+ if (id === "posthog") {
227
+ return Boolean(
228
+ integrations.posthogAccessToken?.trim() || integrations.posthogRefreshToken?.trim() || integrations.posthogPersonalApiKey?.trim()
229
+ );
230
+ }
222
231
  return Boolean(integrations.sentryAuthToken?.trim());
223
232
  }
224
233
  function connectedOptionalServices(integrations) {
@@ -233,12 +242,12 @@ function connectorDirectiveLine(spec, cli) {
233
242
  if (spec.cli) {
234
243
  return `- ${spec.label}: use \`${spec.cli}\` (\`${spec.envKey}\`${extras})${cliPresencePhrase(spec, cli)}. Do not add a ${spec.label} MCP.`;
235
244
  }
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.`;
245
+ 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 token from the environment. Do not add a ${spec.label} MCP.`;
237
246
  }
238
247
  function connectorAuthCaution(posthog, cliConnected) {
239
248
  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
249
  const token = cliConnected ? " CLI tokens are already in this process." : "";
241
- const key = posthog ? " Do not read a PostHog key from the environment." : "";
250
+ const key = posthog ? " Do not read a PostHog token from the environment." : "";
242
251
  return `${signIn}${token}${key} When this Sideboard connection works, ignore a Claude connector that failed to start. Use the Claude connector only when this connection is not set or the CLI call fails.`;
243
252
  }
244
253
  function connectorReminderBit(spec, cli) {
@@ -266,14 +275,14 @@ function formatOptionalServicesReminder(integrations, cli) {
266
275
  const bits = connected.map((spec) => connectorReminderBit(spec, cli)).join(". ");
267
276
  const tokenBit = connected.some((spec) => spec.cli) ? "CLI tokens are already in this process. " : "";
268
277
  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` while this Sideboard connection works. Use the Claude connector only when it is not set or the call fails. 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 while this Sideboard connection works. Use the Claude connector only when it is not set or the CLI call fails.";
278
+ const auth = posthog ? "If a connector MCP needsAuth or is unauthorized, ignore it and use the CLI or `posthog_api` while this Sideboard connection works. Use the Claude connector only when it is not set or the call fails. Do not read a PostHog token from the environment." : "If a Vercel, Supabase, or Sentry MCP needsAuth or is unauthorized, ignore it and use the CLI while this Sideboard connection works. Use the Claude connector only when it is not set or the CLI call fails.";
270
279
  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.`;
271
280
  }
272
281
  async function connectedCliPresence(integrations) {
273
282
  const ids = connectedOptionalServices(integrations).filter((spec) => spec.cli).map((spec) => spec.id);
274
283
  if (ids.length === 0) return void 0;
275
284
  try {
276
- const { optionalCliPresence } = await import("./optional-cli-YHLVTVRK.js");
285
+ const { optionalCliPresence } = await import("./optional-cli-RPJIQBDX.js");
277
286
  return await optionalCliPresence(ids);
278
287
  } catch {
279
288
  return void 0;
@@ -5,7 +5,7 @@
5
5
  var LIST_TIMEOUT_MS = 15e3;
6
6
  async function listAssignedLinearIssues(opts) {
7
7
  try {
8
- const { listLinearIssuesDirect } = await import("./linear-JE4WAZ3W.js");
8
+ const { listLinearIssuesDirect } = await import("./linear-PKYJH4WK.js");
9
9
  const listed = listLinearIssuesDirect({ limit: 50 }).catch(() => []);
10
10
  let timer;
11
11
  try {
@@ -9,7 +9,7 @@ import {
9
9
  isOrchestratorCapableAgent,
10
10
  normalizeThinkingEffort,
11
11
  updateAdvancedSettings
12
- } from "./chunk-S3UGLMGE.js";
12
+ } from "./chunk-WWU4SYZR.js";
13
13
  import {
14
14
  writePrivateFile
15
15
  } from "./chunk-NSTQ6QKD.js";
@@ -4,7 +4,7 @@ import {
4
4
  normalizeTakenSlug,
5
5
  normalizeWorktreePath,
6
6
  takenSlugsFromThread
7
- } from "./chunk-QTDCPMOW.js";
7
+ } from "./chunk-ATS7SYHG.js";
8
8
  import {
9
9
  ensureWorktreeSideboardIgnored
10
10
  } from "./chunk-BMRJNRQK.js";
@@ -25,7 +25,7 @@ import {
25
25
  import {
26
26
  getGithubGitAuthMode,
27
27
  getGithubPat
28
- } from "./chunk-4PHOJMZI.js";
28
+ } from "./chunk-6WMNIX2U.js";
29
29
  import {
30
30
  worktreesRoot
31
31
  } from "./chunk-H4UEFJRI.js";
@@ -14,7 +14,7 @@ import {
14
14
  parseSessionQuotaResetAt,
15
15
  planModeTurnInstruction,
16
16
  resolveQuotaFallbackAgent
17
- } from "./chunk-TW63CYUA.js";
17
+ } from "./chunk-Y6VQX2LY.js";
18
18
  import {
19
19
  applyWorktreePkgCacheEnv,
20
20
  askBlockStillWaiting,
@@ -54,7 +54,7 @@ import {
54
54
  worktreeDevProcessKey,
55
55
  worktreeRunProcessKey,
56
56
  worktreeSetupProcessKey
57
- } from "./chunk-BD7KUYJA.js";
57
+ } from "./chunk-ZJMYCDYQ.js";
58
58
  import {
59
59
  applyAgentEvent,
60
60
  clipAgentEventForPaint,
@@ -88,7 +88,7 @@ import {
88
88
  import {
89
89
  formatOptionalServicesDirectiveForTurn,
90
90
  formatOptionalServicesReminderForTurn
91
- } from "./chunk-5SJGR3VS.js";
91
+ } from "./chunk-F7WP2U5I.js";
92
92
  import {
93
93
  extractPresentedPlan,
94
94
  isPresentPlanToolName,
@@ -121,7 +121,7 @@ import {
121
121
  stageAbsolutePathsAsAttachments,
122
122
  stageBuffersAsAttachments,
123
123
  syncWorkspacesFromThreads
124
- } from "./chunk-J3BQHHDZ.js";
124
+ } from "./chunk-6TV6L2DD.js";
125
125
  import {
126
126
  addPrStackLayer,
127
127
  allocateTeamSlug,
@@ -172,7 +172,7 @@ import {
172
172
  resolveRepoRoot,
173
173
  switchWorktreeBranch,
174
174
  withRepoGitLock
175
- } from "./chunk-RTZO2YJC.js";
175
+ } from "./chunk-2HPVGTHF.js";
176
176
  import {
177
177
  issueActivityKind
178
178
  } from "./chunk-OYRN356W.js";
@@ -215,7 +215,7 @@ import {
215
215
  worktreeNameFromPath,
216
216
  worktreeSlugForTicket,
217
217
  writeThread
218
- } from "./chunk-JHT3CYLT.js";
218
+ } from "./chunk-MOUAM6ZC.js";
219
219
  import {
220
220
  HISTORY_CLEANUP_INTERVAL_HOURS_DEFAULT,
221
221
  applyTurnUsage,
@@ -252,7 +252,7 @@ import {
252
252
  wakeOrchestratorOnGithubEdgesEnabled,
253
253
  withTurnScopedCost,
254
254
  writeViewerContext
255
- } from "./chunk-S3UGLMGE.js";
255
+ } from "./chunk-WWU4SYZR.js";
256
256
  import {
257
257
  writePrivateFile
258
258
  } from "./chunk-NSTQ6QKD.js";
@@ -571,9 +571,9 @@ async function spawnAgentTurn(thread, input, onEvent) {
571
571
  `Cannot spawn ${thread.agent}: thread ${thread.id} has no worktreePath`
572
572
  );
573
573
  }
574
- const { isGlobalThread: isGlobalThread2 } = await import("./global-workspace-HM2RKBCT.js");
574
+ const { isGlobalThread: isGlobalThread2 } = await import("./global-workspace-7OQ5O6JT.js");
575
575
  if (isGlobalThread2(thread)) {
576
- const { ensureGlobalCoordinatorCwd: ensureGlobalCoordinatorCwd2 } = await import("./coordinator-prompt-7QALNDIV.js");
576
+ const { ensureGlobalCoordinatorCwd: ensureGlobalCoordinatorCwd2 } = await import("./coordinator-prompt-WALVMGKI.js");
577
577
  ensureGlobalCoordinatorCwd2(
578
578
  isOrchestratorThread(thread) ? { orchestratorThreadId: thread.id } : void 0
579
579
  );
@@ -2215,6 +2215,10 @@ function resolveStopReason(opts) {
2215
2215
  if (opts?.clearQueue === false) return "Stopped by the user";
2216
2216
  return "Stopped (queue cleared)";
2217
2217
  }
2218
+ function isRoutineStopNote(err) {
2219
+ const text3 = err?.trim() ?? "";
2220
+ return text3 === "Stopped" || text3 === "Stopped by the user" || text3 === "Stopped (queue cleared)" || text3 === "Stopped to send the next prompt";
2221
+ }
2218
2222
  function reasonToKeepOnStop(existing, incoming) {
2219
2223
  const next = incoming?.trim();
2220
2224
  if (next) return next.slice(0, STOP_REASON_MAX);
@@ -2222,6 +2226,16 @@ function reasonToKeepOnStop(existing, incoming) {
2222
2226
  if (prior) return prior.slice(0, STOP_REASON_MAX);
2223
2227
  return "Stopped";
2224
2228
  }
2229
+ function turnFinishedEvent(threadId, exitCode, userStopped, lastError) {
2230
+ const note = lastError?.trim() ?? "";
2231
+ const routineStop = userStopped && (note.length === 0 || isRoutineStopNote(note));
2232
+ return {
2233
+ type: "turn_finished",
2234
+ threadId,
2235
+ exitCode,
2236
+ ...routineStop ? { routineStop: true } : {}
2237
+ };
2238
+ }
2225
2239
  function writeStoppedStatus(threadId, reason) {
2226
2240
  const latest = readThread(threadId);
2227
2241
  if (!latest || latest.status === "archived") return latest;
@@ -2996,7 +3010,7 @@ async function createThread(input, _onSetupLine) {
2996
3010
  });
2997
3011
  await requireAgent(resolved.agent);
2998
3012
  if (input.cowboy) {
2999
- const { cowboyModeEnabled } = await import("./app-settings-Q2F57NVK.js");
3013
+ const { cowboyModeEnabled } = await import("./app-settings-PPIMYJKS.js");
3000
3014
  if (!cowboyModeEnabled()) {
3001
3015
  throw new Error(
3002
3016
  "Cowboy mode is off. Enable it in Settings \u2192 Advanced."
@@ -3055,7 +3069,7 @@ async function createThread(input, _onSetupLine) {
3055
3069
  let sourceIsFork = false;
3056
3070
  if (!input.cowboy && sourceType === "branch" && (!sourceRef || sourceRef === "HEAD" || sourceRef === "default")) {
3057
3071
  if (isAbleTimeConnected() && getIssueSource() === "abletime") {
3058
- const { ensureAbleTimeTask, issueAttachmentForAbleTimeTask } = await import("./abletime-MSIMJKKQ.js");
3072
+ const { ensureAbleTimeTask, issueAttachmentForAbleTimeTask } = await import("./abletime-3HRWLQZJ.js");
3059
3073
  const task = await ensureAbleTimeTask({
3060
3074
  title: title?.trim() || "Untitled work",
3061
3075
  description: input.prompt?.trim() || void 0
@@ -3937,7 +3951,7 @@ async function adoptThread(input) {
3937
3951
  messages: input.messages ?? []
3938
3952
  });
3939
3953
  writeThread(thread);
3940
- const { addWorkspace: addWorkspace2 } = await import("./workspaces-V6IIBSKA.js");
3954
+ const { addWorkspace: addWorkspace2 } = await import("./workspaces-KWGTP7DI.js");
3941
3955
  await addWorkspace2(repoPath);
3942
3956
  const { ensureWorktreeSideboardIgnored } = await import("./worktree-exclude-KMZQXZKP.js");
3943
3957
  await ensureWorktreeSideboardIgnored(input.worktreePath);
@@ -7527,11 +7541,11 @@ function realDeps() {
7527
7541
  parentIdForThread,
7528
7542
  designatedId: designatedOrchestratorId,
7529
7543
  send: async (threadId, prompt) => {
7530
- const { getOrchestrator: getOrchestrator2 } = await import("./orchestrator-OWO6LQ5U.js");
7544
+ const { getOrchestrator: getOrchestrator2 } = await import("./orchestrator-4SXTORD2.js");
7531
7545
  await getOrchestrator2().send(threadId, prompt, { followUp: "queue" });
7532
7546
  },
7533
7547
  startOrchestration: async (prompt) => {
7534
- const { startOrchestration: startOrchestration2 } = await import("./orchestrator-OWO6LQ5U.js");
7548
+ const { startOrchestration: startOrchestration2 } = await import("./orchestrator-4SXTORD2.js");
7535
7549
  const defaults = resolveOrchestratorDefaults();
7536
7550
  await startOrchestration2({
7537
7551
  goal: prompt,
@@ -7558,7 +7572,7 @@ function formatScheduledPrompt(name, prompt) {
7558
7572
  ${prompt}`;
7559
7573
  }
7560
7574
  async function defaultDeps() {
7561
- const { getOrchestrator: getOrchestrator2, startOrchestration: startOrchestration2 } = await import("./orchestrator-OWO6LQ5U.js");
7575
+ const { getOrchestrator: getOrchestrator2, startOrchestration: startOrchestration2 } = await import("./orchestrator-4SXTORD2.js");
7562
7576
  const orch = getOrchestrator2();
7563
7577
  return {
7564
7578
  findThread: (id) => findThreadByRef(id),
@@ -7914,7 +7928,7 @@ var Orchestrator = class {
7914
7928
  orphans: orphans.map((o) => ({ path: o.path, repoPath: o.repoPath }))
7915
7929
  });
7916
7930
  }
7917
- const { autoCleanupOrphansEnabled } = await import("./app-settings-Q2F57NVK.js");
7931
+ const { autoCleanupOrphansEnabled } = await import("./app-settings-PPIMYJKS.js");
7918
7932
  if (autoCleanupOrphansEnabled() && shouldRunWorktreeCleanup() && orphans.length > 0) {
7919
7933
  await cleanupOrphanWorktrees({ repoPaths });
7920
7934
  }
@@ -8033,7 +8047,7 @@ var Orchestrator = class {
8033
8047
  if (!this.shouldReclaimRunningThread(thread)) continue;
8034
8048
  setStatus(thread.id, "stopped", "Process died (agent exited)");
8035
8049
  this.emit({ type: "status_changed", threadId: thread.id, status: "stopped" });
8036
- this.emit({ type: "turn_finished", threadId: thread.id, exitCode: 1 });
8050
+ this.emit(turnFinishedEvent(thread.id, 1, this.stoppedTurns.has(thread.id), readThread(thread.id)?.lastError));
8037
8051
  const latest = readThread(thread.id);
8038
8052
  if (latest) {
8039
8053
  notifyParentOfChildHalt(latest, "stopped", (id, prompt) => this.send(id, prompt));
@@ -8304,7 +8318,7 @@ var Orchestrator = class {
8304
8318
  }
8305
8319
  await setup;
8306
8320
  if (skipSetup) return;
8307
- const { autoRunAfterSetupEnabled } = await import("./app-settings-Q2F57NVK.js");
8321
+ const { autoRunAfterSetupEnabled } = await import("./app-settings-PPIMYJKS.js");
8308
8322
  if (autoRunAfterSetupEnabled()) {
8309
8323
  try {
8310
8324
  await this.startDev(threadId);
@@ -8598,7 +8612,7 @@ var Orchestrator = class {
8598
8612
  if (stopped?.status === "stopped") {
8599
8613
  this.emit({ type: "status_changed", threadId, status: "stopped" });
8600
8614
  }
8601
- this.emit({ type: "turn_finished", threadId, exitCode: 1 });
8615
+ this.emit(turnFinishedEvent(threadId, 1, this.stoppedTurns.has(threadId), readThread(threadId)?.lastError));
8602
8616
  return;
8603
8617
  }
8604
8618
  thread = this.requireThread(threadId);
@@ -8688,7 +8702,7 @@ ${formatEnvReminder(projectNameForRepoPath(thread.repoPath || thread.worktreePat
8688
8702
  }
8689
8703
  const isBrightsy = fresh.agent === "brightsy";
8690
8704
  const isOrchestration = isOrchestratorThread(fresh);
8691
- const { autoRenameBranchEnabled, getGithubGitAuthMode, gitBranchPrefixSetting } = await import("./app-settings-Q2F57NVK.js");
8705
+ const { autoRenameBranchEnabled, getGithubGitAuthMode, gitBranchPrefixSetting } = await import("./app-settings-PPIMYJKS.js");
8692
8706
  const gitAuthMode = getGithubGitAuthMode();
8693
8707
  const worktreeDirective = isBrightsy || isOrchestration ? null : formatWorktreeDirective(fresh, {
8694
8708
  githubSlug: turnOrigin?.forge === "github" ? turnOrigin.slug : await withTimeout(resolveGithubRepoSlug(fresh.worktreePath), 8e3, "resolveGithubRepoSlug").catch(() => null),
@@ -9006,7 +9020,7 @@ ${formatEnvReminder(projectNameForRepoPath(thread.repoPath || thread.worktreePat
9006
9020
  if (stopped?.status === "stopped") {
9007
9021
  this.emit({ type: "status_changed", threadId, status: "stopped" });
9008
9022
  }
9009
- this.emit({ type: "turn_finished", threadId, exitCode });
9023
+ this.emit(turnFinishedEvent(threadId, exitCode, this.stoppedTurns.has(threadId), readThread(threadId)?.lastError));
9010
9024
  } else {
9011
9025
  const failDetail = formatTurnExitError(exitCode, detail);
9012
9026
  const explainedInChat = exitCode !== 0 && Boolean(chatText) && (looksLikeAgentFailureMessage(chatText) || failDetail && chatText.includes(failDetail.replace(/^exit\s*\d+:\s*/i, "").trim()));
@@ -9023,7 +9037,7 @@ ${formatEnvReminder(projectNameForRepoPath(thread.repoPath || thread.worktreePat
9023
9037
  status: written.status
9024
9038
  });
9025
9039
  }
9026
- this.emit({ type: "turn_finished", threadId, exitCode });
9040
+ this.emit(turnFinishedEvent(threadId, exitCode, this.stoppedTurns.has(threadId), readThread(threadId)?.lastError));
9027
9041
  if (exitCode === 0) {
9028
9042
  this.crashContinued.delete(threadId);
9029
9043
  this.maybeEnqueueJobContinue(threadId, chatText, parts);
@@ -9058,14 +9072,14 @@ ${formatEnvReminder(projectNameForRepoPath(thread.repoPath || thread.worktreePat
9058
9072
  if (stopped?.status === "stopped") {
9059
9073
  this.emit({ type: "status_changed", threadId, status: "stopped" });
9060
9074
  }
9061
- this.emit({ type: "turn_finished", threadId, exitCode: 1 });
9075
+ this.emit(turnFinishedEvent(threadId, 1, this.stoppedTurns.has(threadId), readThread(threadId)?.lastError));
9062
9076
  } else {
9063
9077
  const written = writeLiveStatus(threadId, "error", message);
9064
9078
  if (written?.status === "error") {
9065
9079
  this.emit({ type: "error", threadId, message });
9066
9080
  this.emit({ type: "status_changed", threadId, status: "error" });
9067
9081
  }
9068
- this.emit({ type: "turn_finished", threadId, exitCode: 1 });
9082
+ this.emit(turnFinishedEvent(threadId, 1, this.stoppedTurns.has(threadId), readThread(threadId)?.lastError));
9069
9083
  const failedOver = await isolateQuotaFailover(
9070
9084
  () => this.maybeHandleOrchestrationQuotaFailover(threadId, message)
9071
9085
  );
@@ -9113,9 +9127,7 @@ ${formatEnvReminder(projectNameForRepoPath(thread.repoPath || thread.worktreePat
9113
9127
  const continueQueue = opts?.continueQueue === true;
9114
9128
  const thread = this.requireThread(threadRef);
9115
9129
  const inFlight = this.activeTurns.has(thread.id) || this.startingTurns.has(thread.id);
9116
- if (inFlight) {
9117
- this.stoppedTurns.add(thread.id);
9118
- }
9130
+ if (inFlight) this.stoppedTurns.add(thread.id);
9119
9131
  if (clearQueue && thread.queue.length > 0) {
9120
9132
  this.haltDrain.delete(thread.id);
9121
9133
  updateThread(thread.id, { queue: [], queueAttachments: [] });
@@ -9125,6 +9137,7 @@ ${formatEnvReminder(projectNameForRepoPath(thread.repoPath || thread.worktreePat
9125
9137
  } else if (continueQueue) {
9126
9138
  this.haltDrain.delete(thread.id);
9127
9139
  }
9140
+ let stopped = writeStoppedStatus(thread.id, resolveStopReason(opts)) ?? readThread(thread.id) ?? thread;
9128
9141
  const handle = this.activeTurns.get(thread.id);
9129
9142
  if (handle) handle.kill();
9130
9143
  const proc = this.processes.get(`${thread.id}:agent`);
@@ -9143,10 +9156,10 @@ ${formatEnvReminder(projectNameForRepoPath(thread.repoPath || thread.worktreePat
9143
9156
  }
9144
9157
  }
9145
9158
  }
9146
- const stopped = writeStoppedStatus(thread.id, resolveStopReason(opts)) ?? readThread(thread.id) ?? thread;
9159
+ stopped = readThread(thread.id) ?? stopped;
9147
9160
  if (stopped.status === "stopped") {
9148
9161
  this.emit({ type: "status_changed", threadId: thread.id, status: "stopped" });
9149
- if (inFlight && opts?.notifyParent !== false) {
9162
+ if (inFlight && opts?.notifyParent !== false && !continueQueue) {
9150
9163
  notifyParentOfChildHalt(stopped, "stopped", (id, prompt) => this.send(id, prompt));
9151
9164
  }
9152
9165
  }
@@ -10030,7 +10043,7 @@ ${formatEnvReminder(projectNameForRepoPath(thread.repoPath || thread.worktreePat
10030
10043
  if (Object.keys(patch).length === 0) continue;
10031
10044
  updateThread(t.id, patch);
10032
10045
  }
10033
- const { autoArchiveOnMergeEnabled } = await import("./app-settings-Q2F57NVK.js");
10046
+ const { autoArchiveOnMergeEnabled } = await import("./app-settings-PPIMYJKS.js");
10034
10047
  const latest = this.requireThread(thread.id);
10035
10048
  if (!shouldAutoArchiveOnPrMerge({
10036
10049
  previousPrState: prevState || null,
@@ -10354,7 +10367,7 @@ ${formatEnvReminder(projectNameForRepoPath(thread.repoPath || thread.worktreePat
10354
10367
  await runArchiveScript(thread.repoPath, thread.worktreePath);
10355
10368
  } catch {
10356
10369
  }
10357
- const { deleteBranchOnPurgeEnabled } = await import("./app-settings-Q2F57NVK.js");
10370
+ const { deleteBranchOnPurgeEnabled } = await import("./app-settings-PPIMYJKS.js");
10358
10371
  const deleteBranch = opts?.deleteBranch ?? deleteBranchOnPurgeEnabled();
10359
10372
  await removeWorktree(thread.repoPath, thread.worktreePath, {
10360
10373
  deleteBranch: deleteBranch ? thread.branchName : void 0
@@ -10492,7 +10505,7 @@ async function startOrchestration(opts) {
10492
10505
  sourceRef: "default",
10493
10506
  ...createOpts
10494
10507
  }).catch(async () => {
10495
- const { resolveDefaultBranch: resolveDefaultBranch2, resolveRepoRoot: resolveRepoRoot2 } = await import("./worktree-BD3EJE24.js");
10508
+ const { resolveDefaultBranch: resolveDefaultBranch2, resolveRepoRoot: resolveRepoRoot2 } = await import("./worktree-ROJXGBWS.js");
10496
10509
  const repo = await resolveRepoRoot2(repoPath);
10497
10510
  const def = await resolveDefaultBranch2(repo);
10498
10511
  return orch.createThread({
@@ -10502,7 +10515,7 @@ async function startOrchestration(opts) {
10502
10515
  repoPath: repo
10503
10516
  });
10504
10517
  });
10505
- const { updateThread: upd } = await import("./thread-store-HETUMDVA.js");
10518
+ const { updateThread: upd } = await import("./thread-store-MEUWZDVV.js");
10506
10519
  const updated = upd(thread.id, {
10507
10520
  sourceType: "orchestration",
10508
10521
  sourceRef: goal
@@ -6,14 +6,14 @@ import {
6
6
  normalizeAbleTimeCredential,
7
7
  normalizeAbleTimeHost,
8
8
  rewriteAbleTimeError
9
- } from "./chunk-NDBMDHQ5.js";
9
+ } from "./chunk-RYPD7XWV.js";
10
10
  import {
11
11
  httpFetch
12
12
  } from "./chunk-2GPQZZLY.js";
13
13
  import {
14
14
  getAbleTimeAccessToken,
15
15
  getAbleTimeHost
16
- } from "./chunk-S3UGLMGE.js";
16
+ } from "./chunk-WWU4SYZR.js";
17
17
 
18
18
  // src/integrations/abletime-rest.ts
19
19
  var ABLETIME_REST_PREFIX = "/api/public/v2";
@@ -16,7 +16,7 @@ import {
16
16
  disconnectLinearConnection,
17
17
  loadAppSettings,
18
18
  saveLinearOAuth
19
- } from "./chunk-4PHOJMZI.js";
19
+ } from "./chunk-6WMNIX2U.js";
20
20
 
21
21
  // src/integrations/linear-oauth.ts
22
22
  import { createHash, randomBytes } from "crypto";