@sideboard-ai/core 0.1.206 → 0.1.208

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 (50) hide show
  1. package/dist/{abletime-TONBQP4O.js → abletime-I4IYZBKU.js} +4 -4
  2. package/dist/{abletime-S3UHQZVW.js → abletime-UWSSLXH3.js} +4 -4
  3. package/dist/{abletime-oauth-SD4SZY5U.js → abletime-oauth-C3BQXKW3.js} +5 -3
  4. package/dist/{abletime-oauth-AVCEO2DY.js → abletime-oauth-UZHPB3W2.js} +14 -4
  5. package/dist/{abletime-rest-J2OBB4VA.js → abletime-rest-5YPPEOKK.js} +3 -3
  6. package/dist/{abletime-rest-6ODSXV7G.js → abletime-rest-HYNYDYK3.js} +3 -3
  7. package/dist/agents/cursor-runner.js +1 -1
  8. package/dist/{agents-UW2BUEDH.js → agents-CCS5IEBV.js} +6 -6
  9. package/dist/{agents-5SDF6KCI.js → agents-QHQXR55O.js} +5 -5
  10. package/dist/{app-settings-YEPF46IJ.js → app-settings-GJ6KDYEF.js} +1 -1
  11. package/dist/{app-settings-LGHMNHSP.js → app-settings-R2KNCT37.js} +1 -1
  12. package/dist/{chunk-X743YN5Y.js → chunk-4EGK47WV.js} +1 -0
  13. package/dist/{chunk-6Q7DFVDQ.js → chunk-6J4OQ6TF.js} +14 -4
  14. package/dist/{chunk-FO2NTJ7L.js → chunk-6YZLSZLK.js} +3 -3
  15. package/dist/{chunk-ARR4OGLY.js → chunk-7DKX5JLT.js} +2 -0
  16. package/dist/{chunk-64L62EZY.js → chunk-7PEIIN7P.js} +30 -5
  17. package/dist/{chunk-FX3P25X2.js → chunk-A6SOSLUV.js} +32 -5
  18. package/dist/{chunk-IQEBC3LD.js → chunk-C5MNMITQ.js} +95 -35
  19. package/dist/{chunk-SCIMSW7C.js → chunk-C6ZNQV5W.js} +91 -33
  20. package/dist/{chunk-R7QI3O74.js → chunk-DNTPX6HV.js} +3 -3
  21. package/dist/{chunk-CYLDJWRK.js → chunk-F4LZUEIO.js} +37 -7
  22. package/dist/{chunk-GD2WKFFA.js → chunk-HA4EZKFY.js} +3 -3
  23. package/dist/{chunk-4YXOCLJU.js → chunk-JZHRZ3DR.js} +1 -1
  24. package/dist/{chunk-6F2L3NTL.js → chunk-NJ2CCLV6.js} +2 -2
  25. package/dist/{chunk-EJX62RSX.js → chunk-OP6CFVTB.js} +2 -2
  26. package/dist/{chunk-3K257PCS.js → chunk-TEDEVD4O.js} +37 -7
  27. package/dist/{chunk-QAVWH2RQ.js → chunk-W6X4GZJG.js} +3 -3
  28. package/dist/{chunk-SGUVAK66.js → chunk-WXWJ5MJ4.js} +5 -5
  29. package/dist/{chunk-W6VM36YO.js → chunk-X45BV4VX.js} +5 -5
  30. package/dist/{chunk-QFBBUFD4.js → chunk-Y4CF7LHH.js} +1 -0
  31. package/dist/{chunk-DWGEBZ3C.js → chunk-ZHCB4CKR.js} +2 -0
  32. package/dist/{coordinator-prompt-EWHEK24X.js → coordinator-prompt-TUHB6ZFA.js} +4 -4
  33. package/dist/{coordinator-prompt-6Q5NDWOC.js → coordinator-prompt-WOTJQMD5.js} +4 -4
  34. package/dist/{global-workspace-2GMALKKE.js → global-workspace-5UUUNA4A.js} +4 -4
  35. package/dist/{global-workspace-KHSZZKIH.js → global-workspace-V6G2KH2V.js} +4 -4
  36. package/dist/index.cjs +164 -20
  37. package/dist/index.d.cts +39 -4
  38. package/dist/index.d.ts +39 -4
  39. package/dist/index.js +26 -13
  40. package/dist/mcp/run-stdio.cjs +150 -20
  41. package/dist/mcp/run-stdio.js +11 -11
  42. package/dist/{orchestrator-WIL5WFBL.js → orchestrator-4IGHVRAF.js} +6 -6
  43. package/dist/{orchestrator-NXZ5NDAM.js → orchestrator-D4AQNF25.js} +7 -7
  44. package/dist/{thread-store-XGYWXR2P.js → thread-store-ESZYZSVC.js} +1 -1
  45. package/dist/{thread-store-LS2T6RVH.js → thread-store-FMWDFAO5.js} +1 -1
  46. package/dist/{workspaces-6RGWGUFK.js → workspaces-CLNANACI.js} +4 -4
  47. package/dist/{workspaces-4CBMCP6N.js → workspaces-PZ36M7EQ.js} +4 -4
  48. package/dist/{worktree-SPH7Q2S6.js → worktree-JKTM47K5.js} +3 -3
  49. package/dist/{worktree-2U7SZBO2.js → worktree-NC4XQNQI.js} +3 -3
  50. package/package.json +1 -1
@@ -14,6 +14,7 @@ import {
14
14
  applyAgentEvent,
15
15
  applyAgentRunnerHeapEnv,
16
16
  applyTurnUsage,
17
+ clipAgentEventForPaint,
17
18
  clipToolResultForStore,
18
19
  contextTokens,
19
20
  fallbackTurnFailDetail,
@@ -44,7 +45,7 @@ import {
44
45
  summarizeTurnStderr,
45
46
  toolDescription,
46
47
  turnFailChatText
47
- } from "./chunk-64L62EZY.js";
48
+ } from "./chunk-7PEIIN7P.js";
48
49
  import {
49
50
  SLACK_REPLY_FORMATTING,
50
51
  addWorkspace,
@@ -67,7 +68,7 @@ import {
67
68
  stageAbsolutePathsAsAttachments,
68
69
  stageBuffersAsAttachments,
69
70
  syncWorkspacesFromThreads
70
- } from "./chunk-R7QI3O74.js";
71
+ } from "./chunk-DNTPX6HV.js";
71
72
  import {
72
73
  addPrStackLayer,
73
74
  allocateTeamName,
@@ -117,7 +118,7 @@ import {
117
118
  worktreeDisplayLabelForGroup,
118
119
  worktreeNameFromPath,
119
120
  worktreeSlugForTicket
120
- } from "./chunk-6F2L3NTL.js";
121
+ } from "./chunk-NJ2CCLV6.js";
121
122
  import {
122
123
  ATTACHMENTS_DIR,
123
124
  DETACHED_JOBS_DIR,
@@ -135,7 +136,7 @@ import {
135
136
  updateThread,
136
137
  withThreadLock,
137
138
  writeThread
138
- } from "./chunk-DWGEBZ3C.js";
139
+ } from "./chunk-ZHCB4CKR.js";
139
140
  import {
140
141
  ensureWorktreeSideboardIgnored
141
142
  } from "./chunk-SYFVUF2C.js";
@@ -171,7 +172,7 @@ import {
171
172
  updateAdvancedSettings,
172
173
  usageOnLimit,
173
174
  writeSecureJson
174
- } from "./chunk-X743YN5Y.js";
175
+ } from "./chunk-4EGK47WV.js";
175
176
  import {
176
177
  writePrivateFile
177
178
  } from "./chunk-NSTQ6QKD.js";
@@ -409,7 +410,7 @@ async function continueSourceThread(threadId, prompt) {
409
410
  await continueOnReply(threadId, prompt);
410
411
  return;
411
412
  }
412
- const { getOrchestrator: getOrchestrator2 } = await import("./orchestrator-WIL5WFBL.js");
413
+ const { getOrchestrator: getOrchestrator2 } = await import("./orchestrator-4IGHVRAF.js");
413
414
  await getOrchestrator2().send(threadId, prompt);
414
415
  } catch {
415
416
  }
@@ -802,9 +803,9 @@ async function spawnAgentTurn(thread, input, onEvent) {
802
803
  `Cannot spawn ${thread.agent}: thread ${thread.id} has no worktreePath`
803
804
  );
804
805
  }
805
- const { isGlobalThread: isGlobalThread2 } = await import("./global-workspace-KHSZZKIH.js");
806
+ const { isGlobalThread: isGlobalThread2 } = await import("./global-workspace-V6G2KH2V.js");
806
807
  if (isGlobalThread2(thread)) {
807
- const { ensureGlobalCoordinatorCwd: ensureGlobalCoordinatorCwd2 } = await import("./coordinator-prompt-EWHEK24X.js");
808
+ const { ensureGlobalCoordinatorCwd: ensureGlobalCoordinatorCwd2 } = await import("./coordinator-prompt-TUHB6ZFA.js");
808
809
  ensureGlobalCoordinatorCwd2(
809
810
  isOrchestratorThread(thread) ? { orchestratorThreadId: thread.id } : void 0
810
811
  );
@@ -1012,6 +1013,24 @@ var FIX_CI_RE = /^Fix CI: .+\.$/;
1012
1013
  function normalizePrState(state) {
1013
1014
  return (state ?? "").trim().toUpperCase();
1014
1015
  }
1016
+ function samePrIdentity(a, b) {
1017
+ const left = (a ?? "").trim().replace(/\/+$/, "");
1018
+ const right = (b ?? "").trim().replace(/\/+$/, "");
1019
+ if (!left || !right) return false;
1020
+ if (left === right) return true;
1021
+ const ln = left.match(/\/pull\/(\d+)/i)?.[1];
1022
+ const rn = right.match(/\/pull\/(\d+)/i)?.[1];
1023
+ return Boolean(ln && rn && ln === rn);
1024
+ }
1025
+ function shouldPersistFetchedPrMeta(opts) {
1026
+ const meta = opts.metaUrl?.trim() || "";
1027
+ if (!meta) return false;
1028
+ const head = opts.headPrUrl?.trim() || "";
1029
+ if (head) return samePrIdentity(meta, head);
1030
+ const live = opts.livePrUrl?.trim() || "";
1031
+ if (live) return samePrIdentity(meta, live);
1032
+ return true;
1033
+ }
1015
1034
  function sameLoginList(a, b) {
1016
1035
  const left = [...a ?? []].map((s) => s.trim().toLowerCase()).filter(Boolean).sort();
1017
1036
  const right = [...b ?? []].map((s) => s.trim().toLowerCase()).filter(Boolean).sort();
@@ -3630,7 +3649,7 @@ async function createThread(input, _onSetupLine) {
3630
3649
  });
3631
3650
  await requireAgent(resolved.agent);
3632
3651
  if (input.cowboy) {
3633
- const { cowboyModeEnabled } = await import("./app-settings-LGHMNHSP.js");
3652
+ const { cowboyModeEnabled } = await import("./app-settings-R2KNCT37.js");
3634
3653
  if (!cowboyModeEnabled()) {
3635
3654
  throw new Error(
3636
3655
  "Cowboy mode is off. Enable it in Settings \u2192 Advanced."
@@ -3688,7 +3707,7 @@ async function createThread(input, _onSetupLine) {
3688
3707
  let sourceIsFork = false;
3689
3708
  if (!input.cowboy && sourceType === "branch" && (!sourceRef || sourceRef === "HEAD" || sourceRef === "default")) {
3690
3709
  if (isAbleTimeConnected() && getIssueSource() === "abletime") {
3691
- const { ensureAbleTimeTask, issueAttachmentForAbleTimeTask } = await import("./abletime-S3UHQZVW.js");
3710
+ const { ensureAbleTimeTask, issueAttachmentForAbleTimeTask } = await import("./abletime-UWSSLXH3.js");
3692
3711
  const task = await ensureAbleTimeTask({
3693
3712
  title: title?.trim() || "Untitled work",
3694
3713
  description: input.prompt?.trim() || void 0
@@ -4224,7 +4243,7 @@ async function adoptThread(input) {
4224
4243
  messages: input.messages ?? []
4225
4244
  });
4226
4245
  writeThread(thread);
4227
- const { ensureWorkspace: ensureWorkspace2 } = await import("./workspaces-6RGWGUFK.js");
4246
+ const { ensureWorkspace: ensureWorkspace2 } = await import("./workspaces-CLNANACI.js");
4228
4247
  await ensureWorkspace2(repoPath);
4229
4248
  const { ensureWorktreeSideboardIgnored: ensureWorktreeSideboardIgnored2 } = await import("./worktree-exclude-N5X5I422.js");
4230
4249
  await ensureWorktreeSideboardIgnored2(input.worktreePath);
@@ -5969,6 +5988,28 @@ function expandComposerPrompt(worktreePath, prompt, opts) {
5969
5988
  };
5970
5989
  }
5971
5990
 
5991
+ // src/composer/consume-attachments.ts
5992
+ function consumeComposerAttachments(thread) {
5993
+ if (thread.attachments.length === 0) {
5994
+ return {
5995
+ attachments: [],
5996
+ pendingTurnAttachments: thread.pendingTurnAttachments ?? []
5997
+ };
5998
+ }
5999
+ return {
6000
+ attachments: [],
6001
+ pendingTurnAttachments: [
6002
+ ...thread.pendingTurnAttachments ?? [],
6003
+ ...thread.attachments
6004
+ ]
6005
+ };
6006
+ }
6007
+ function takePendingTurnAttachments(thread) {
6008
+ const pending = thread.pendingTurnAttachments ?? [];
6009
+ if (pending.length === 0 && thread.attachments.length === 0) return [];
6010
+ return [...pending, ...thread.attachments];
6011
+ }
6012
+
5972
6013
  // src/agents/instructions.ts
5973
6014
  import { existsSync as existsSync17 } from "fs";
5974
6015
  import { join as join16 } from "path";
@@ -6602,7 +6643,7 @@ function formatScheduledPrompt(name, prompt) {
6602
6643
  ${prompt}`;
6603
6644
  }
6604
6645
  async function defaultDeps() {
6605
- const { getOrchestrator: getOrchestrator2, startOrchestration: startOrchestration2 } = await import("./orchestrator-WIL5WFBL.js");
6646
+ const { getOrchestrator: getOrchestrator2, startOrchestration: startOrchestration2 } = await import("./orchestrator-4IGHVRAF.js");
6606
6647
  const orch = getOrchestrator2();
6607
6648
  return {
6608
6649
  findThread: (id) => findThreadByRef(id),
@@ -6872,7 +6913,7 @@ var Orchestrator = class {
6872
6913
  orphans: orphans.map((o) => ({ path: o.path, repoPath: o.repoPath }))
6873
6914
  });
6874
6915
  }
6875
- const { autoCleanupOrphansEnabled } = await import("./app-settings-LGHMNHSP.js");
6916
+ const { autoCleanupOrphansEnabled } = await import("./app-settings-R2KNCT37.js");
6876
6917
  if (autoCleanupOrphansEnabled() && shouldRunWorktreeCleanup() && orphans.length > 0) {
6877
6918
  await cleanupOrphanWorktrees({ repoPaths });
6878
6919
  }
@@ -7164,7 +7205,7 @@ var Orchestrator = class {
7164
7205
  }
7165
7206
  await setup;
7166
7207
  if (skipSetup) return;
7167
- const { autoRunAfterSetupEnabled } = await import("./app-settings-LGHMNHSP.js");
7208
+ const { autoRunAfterSetupEnabled } = await import("./app-settings-R2KNCT37.js");
7168
7209
  if (autoRunAfterSetupEnabled()) {
7169
7210
  try {
7170
7211
  await this.startDev(threadId);
@@ -7225,6 +7266,11 @@ var Orchestrator = class {
7225
7266
  const inFlight = this.activeTurns.has(thread.id) || this.startingTurns.has(thread.id) || current.status === "running";
7226
7267
  shouldSteer = followUp === "steer" && (inFlight || current.queue.length > 0);
7227
7268
  const patch = { queue };
7269
+ if (current.attachments.length > 0) {
7270
+ const consumed = consumeComposerAttachments(current);
7271
+ patch.attachments = consumed.attachments;
7272
+ patch.pendingTurnAttachments = consumed.pendingTurnAttachments;
7273
+ }
7228
7274
  if (!inFlight) patch.status = "queued";
7229
7275
  const pid = current.agentPid;
7230
7276
  if (typeof pid === "number" && pid > 0 && !isPidAlive(pid)) {
@@ -7405,7 +7451,8 @@ var Orchestrator = class {
7405
7451
  thread = this.requireThread(threadId);
7406
7452
  }
7407
7453
  const autoContinue = isJobContinuePrompt(prompt) || prompt.trim().startsWith("The previous agent process ended before it finished.");
7408
- const sentAttachments = !autoContinue && thread.attachments.length > 0 ? [...thread.attachments] : void 0;
7454
+ const parked = takePendingTurnAttachments(thread);
7455
+ const sentAttachments = !autoContinue && parked.length > 0 ? parked : void 0;
7409
7456
  appendMessage(threadId, {
7410
7457
  role: "user",
7411
7458
  text: prompt,
@@ -7472,8 +7519,8 @@ var Orchestrator = class {
7472
7519
  slackReplyContext,
7473
7520
  expandedPrompt
7474
7521
  ].filter(Boolean).join("\n\n");
7475
- if (!autoContinue && thread.attachments.length > 0) {
7476
- updateThread(threadId, { attachments: [] });
7522
+ if (!autoContinue && sentAttachments) {
7523
+ updateThread(threadId, { attachments: [], pendingTurnAttachments: [] });
7477
7524
  }
7478
7525
  const adapter = getAdapter(thread.agent);
7479
7526
  const resolved = await adapter.resolveSessionId(thread.worktreePath, thread.sessionId);
@@ -7488,7 +7535,7 @@ var Orchestrator = class {
7488
7535
  }
7489
7536
  const isBrightsy = fresh.agent === "brightsy";
7490
7537
  const isOrchestration = isOrchestratorThread(fresh);
7491
- const { autoRenameBranchEnabled, getGithubGitAuthMode, gitBranchPrefixSetting } = await import("./app-settings-LGHMNHSP.js");
7538
+ const { autoRenameBranchEnabled, getGithubGitAuthMode, gitBranchPrefixSetting } = await import("./app-settings-R2KNCT37.js");
7492
7539
  const gitAuthMode = getGithubGitAuthMode();
7493
7540
  const worktreeDirective = isBrightsy || isOrchestration ? null : formatWorktreeDirective(fresh, {
7494
7541
  githubSlug: await resolveGithubRepoSlug(fresh.worktreePath).catch(
@@ -7579,8 +7626,9 @@ var Orchestrator = class {
7579
7626
  isolateCodexPlugins: fresh.isolateCodexPlugins === true
7580
7627
  },
7581
7628
  (event) => {
7582
- this.emit({ type: "turn_output", threadId, event });
7583
- noteTurnLiveEvent(threadId, event);
7629
+ const paint = clipAgentEventForPaint(event);
7630
+ this.emit({ type: "turn_output", threadId, event: paint });
7631
+ noteTurnLiveEvent(threadId, paint);
7584
7632
  if (event.type === "session_id") {
7585
7633
  updateThread(threadId, { sessionId: event.data });
7586
7634
  }
@@ -7653,7 +7701,9 @@ var Orchestrator = class {
7653
7701
  let detail = lastStderr || (exitCode !== 0 ? fallbackTurnFailDetail(assistantText) : "");
7654
7702
  const liveThread = this.requireThread(threadId);
7655
7703
  const isolateCodexPluginRetry = liveThread.agent === "codex" && shouldRetryCodexPluginIsolate(detail, {
7656
- alreadyIsolated: liveThread.isolateCodexPlugins === true
7704
+ // Coordinators already pass toCodexUnattendedAppsArgs — a second
7705
+ // isolate exec keeps sessionId and burns the crash/OOM retry.
7706
+ alreadyIsolated: liveThread.isolateCodexPlugins === true || isOrchestratorThread(liveThread)
7657
7707
  });
7658
7708
  if (isolateCodexPluginRetry) {
7659
7709
  updateThread(threadId, { isolateCodexPlugins: true });
@@ -7703,7 +7753,8 @@ var Orchestrator = class {
7703
7753
  isolateCodexPlugins: isolateCodexPluginRetry || retryThread.isolateCodexPlugins === true
7704
7754
  },
7705
7755
  (event) => {
7706
- this.emit({ type: "turn_output", threadId, event });
7756
+ const paint = clipAgentEventForPaint(event);
7757
+ this.emit({ type: "turn_output", threadId, event: paint });
7707
7758
  if (event.type === "session_id") {
7708
7759
  updateThread(threadId, { sessionId: event.data });
7709
7760
  }
@@ -8456,7 +8507,7 @@ var Orchestrator = class {
8456
8507
  } catch {
8457
8508
  headUrl = null;
8458
8509
  }
8459
- return { thread, selectors: connectedPrSelectors(thread, headUrl), cwd };
8510
+ return { thread, selectors: connectedPrSelectors(thread, headUrl), cwd, headUrl };
8460
8511
  }
8461
8512
  async getPrChecks(threadRef) {
8462
8513
  const { selectors, cwd } = await this.withPrSelector(threadRef);
@@ -8467,13 +8518,20 @@ var Orchestrator = class {
8467
8518
  return null;
8468
8519
  }
8469
8520
  async getPrMeta(threadRef) {
8470
- const { thread, selectors, cwd } = await this.withPrSelector(threadRef);
8521
+ const { thread, selectors, cwd, headUrl } = await this.withPrSelector(threadRef);
8471
8522
  for (const selector of selectors) {
8472
8523
  const meta = await getPrMeta(cwd, selector);
8473
- if (meta) {
8474
- await this.persistPrMetaAndMaybeArchive(thread, meta);
8475
- return meta;
8524
+ if (!meta) continue;
8525
+ const live = this.requireThread(thread.id);
8526
+ if (!shouldPersistFetchedPrMeta({
8527
+ metaUrl: meta.url,
8528
+ livePrUrl: live.prUrl,
8529
+ headPrUrl: headUrl
8530
+ })) {
8531
+ continue;
8476
8532
  }
8533
+ await this.persistPrMetaAndMaybeArchive(live, meta);
8534
+ return meta;
8477
8535
  }
8478
8536
  return null;
8479
8537
  }
@@ -8495,7 +8553,7 @@ var Orchestrator = class {
8495
8553
  if (!titled.userSetTitle && meta.title && titled.title !== meta.title) {
8496
8554
  updateThread(thread.id, { title: meta.title });
8497
8555
  }
8498
- const { autoArchiveOnMergeEnabled } = await import("./app-settings-LGHMNHSP.js");
8556
+ const { autoArchiveOnMergeEnabled } = await import("./app-settings-R2KNCT37.js");
8499
8557
  const latest = this.requireThread(thread.id);
8500
8558
  if (!shouldAutoArchiveOnPrMerge({
8501
8559
  previousPrState: prevState || null,
@@ -8772,7 +8830,7 @@ var Orchestrator = class {
8772
8830
  this.emit({ type: "status_changed", threadId: archived.id, status: "archived" });
8773
8831
  if (thread.repoPath && !isGlobalRepoPath(thread.repoPath)) {
8774
8832
  try {
8775
- const { ensureWorkspace: ensureWorkspace2 } = await import("./workspaces-6RGWGUFK.js");
8833
+ const { ensureWorkspace: ensureWorkspace2 } = await import("./workspaces-CLNANACI.js");
8776
8834
  await ensureWorkspace2(thread.repoPath);
8777
8835
  } catch {
8778
8836
  }
@@ -8799,7 +8857,7 @@ var Orchestrator = class {
8799
8857
  await runArchiveScript(thread.repoPath, thread.worktreePath);
8800
8858
  } catch {
8801
8859
  }
8802
- const { deleteBranchOnPurgeEnabled } = await import("./app-settings-LGHMNHSP.js");
8860
+ const { deleteBranchOnPurgeEnabled } = await import("./app-settings-R2KNCT37.js");
8803
8861
  const deleteBranch = opts?.deleteBranch ?? deleteBranchOnPurgeEnabled();
8804
8862
  await removeWorktree(thread.repoPath, thread.worktreePath, {
8805
8863
  deleteBranch: deleteBranch ? thread.branchName : void 0
@@ -8826,7 +8884,7 @@ var Orchestrator = class {
8826
8884
  `Cowboy checkout missing: ${thread.worktreePath}. Re-add the project folder, then restore.`
8827
8885
  );
8828
8886
  }
8829
- const { createThreadWorktree: createThreadWorktree2 } = await import("./worktree-SPH7Q2S6.js");
8887
+ const { createThreadWorktree: createThreadWorktree2 } = await import("./worktree-JKTM47K5.js");
8830
8888
  const slug = thread.worktreePath.split("/").pop();
8831
8889
  const dest = thread.worktreePath;
8832
8890
  await withRepoGitLock(thread.repoPath, async () => {
@@ -8936,7 +8994,7 @@ async function startOrchestration(opts) {
8936
8994
  sourceRef: "default",
8937
8995
  ...createOpts
8938
8996
  }).catch(async () => {
8939
- const { resolveDefaultBranch: resolveDefaultBranch2, resolveRepoRoot: resolveRepoRoot2 } = await import("./worktree-SPH7Q2S6.js");
8997
+ const { resolveDefaultBranch: resolveDefaultBranch2, resolveRepoRoot: resolveRepoRoot2 } = await import("./worktree-JKTM47K5.js");
8940
8998
  const repo = await resolveRepoRoot2(repoPath);
8941
8999
  const def = await resolveDefaultBranch2(repo);
8942
9000
  return orch.createThread({
@@ -8946,7 +9004,7 @@ async function startOrchestration(opts) {
8946
9004
  repoPath: repo
8947
9005
  });
8948
9006
  });
8949
- const { updateThread: upd } = await import("./thread-store-LS2T6RVH.js");
9007
+ const { updateThread: upd } = await import("./thread-store-FMWDFAO5.js");
8950
9008
  const updated = upd(thread.id, {
8951
9009
  sourceType: "orchestration",
8952
9010
  sourceRef: goal
@@ -7,7 +7,7 @@ import {
7
7
  resolveRepoRoot,
8
8
  takenSlugsFromThread,
9
9
  teamSlugFromName
10
- } from "./chunk-6F2L3NTL.js";
10
+ } from "./chunk-NJ2CCLV6.js";
11
11
  import {
12
12
  ATTACHMENTS_DIR,
13
13
  attachmentsGitignoreBody
@@ -17,7 +17,7 @@ import {
17
17
  listThreads,
18
18
  updateThread,
19
19
  writeThread
20
- } from "./chunk-DWGEBZ3C.js";
20
+ } from "./chunk-ZHCB4CKR.js";
21
21
  import {
22
22
  assertOrchestratorCapableAgent,
23
23
  formatAccountProfilePlaybookLine,
@@ -30,7 +30,7 @@ import {
30
30
  resolveThreadDefaults,
31
31
  resolveViewerProfile,
32
32
  resolveViewerProfileForRepo
33
- } from "./chunk-X743YN5Y.js";
33
+ } from "./chunk-4EGK47WV.js";
34
34
  import {
35
35
  appDataDir,
36
36
  globalAgentCwd,
@@ -4,14 +4,14 @@ import {
4
4
  normalizeAbleTimeCredential,
5
5
  normalizeAbleTimeHost,
6
6
  rewriteAbleTimeError
7
- } from "./chunk-W6VM36YO.js";
7
+ } from "./chunk-X45BV4VX.js";
8
8
  import {
9
9
  httpFetch
10
10
  } from "./chunk-N7WZ6NIN.js";
11
11
  import {
12
12
  getAbleTimeAccessToken,
13
13
  getAbleTimeHost
14
- } from "./chunk-QFBBUFD4.js";
14
+ } from "./chunk-Y4CF7LHH.js";
15
15
 
16
16
  // src/integrations/abletime-rest.ts
17
17
  var ABLETIME_REST_PREFIX = "/api/public/v2";
@@ -153,6 +153,7 @@ function restTaskToRaw(raw, users) {
153
153
  description: textFromAbleTimeDoc(rec.description) || asString(rec.descriptionSanitized),
154
154
  projectId: asString(rec.projectId),
155
155
  categoryId: asString(rec.projectCategoryId) || asString(rec.categoryId),
156
+ parentId: asString(rec.parentTaskId) || asString(rec.parentId),
156
157
  tags: rec.tags,
157
158
  comments,
158
159
  createdAt: asString(rec.dateCreated) || asString(rec.createdAt),
@@ -243,6 +244,19 @@ function firstStringArg(args, keys) {
243
244
  }
244
245
  return "";
245
246
  }
247
+ function isNoneToken(value) {
248
+ return value.trim().toLowerCase() === "none";
249
+ }
250
+ function findRestProject(projects, projectId) {
251
+ const wanted = projectId.trim().toLowerCase();
252
+ return projects.find(
253
+ (item) => asString(item.id).toLowerCase() === wanted || asString(item.name).toLowerCase() === wanted
254
+ ) ?? null;
255
+ }
256
+ async function resolveRestParentTaskId(parent, opts) {
257
+ if (isNoneToken(parent)) return null;
258
+ return resolveTaskId(parent, opts);
259
+ }
246
260
  async function callAbleTimeRestTool(name, args = {}, opts) {
247
261
  const token = normalizeAbleTimeCredential(opts?.token ?? getAbleTimeAccessToken() ?? "");
248
262
  if (!token) {
@@ -288,9 +302,7 @@ async function callAbleTimeRestTool(name, args = {}, opts) {
288
302
  const projectId = firstStringArg(args, ["project_id", "projectId", "project"]);
289
303
  if (!projectId) throw new Error("AbleTime project is required");
290
304
  const projects = await listProjectsRaw(requestOpts);
291
- const project = projects.find(
292
- (item) => String(item.id).toLowerCase() === projectId.toLowerCase() || String(item.name).toLowerCase() === projectId.toLowerCase()
293
- ) ?? projects[0];
305
+ const project = findRestProject(projects, projectId) ?? projects[0];
294
306
  if (!project) throw new Error("AbleTime has no projects to create a task in");
295
307
  const categories = asList(project.categories);
296
308
  const wantedCategory = firstStringArg(args, ["category_id", "categoryId", "category"]);
@@ -298,13 +310,16 @@ async function callAbleTimeRestTool(name, args = {}, opts) {
298
310
  if (!item || !wantedCategory) return false;
299
311
  return asString(item.id).toLowerCase() === wantedCategory.toLowerCase() || asString(item.name).toLowerCase() === wantedCategory.toLowerCase();
300
312
  }) ?? asRecord(categories[0]);
313
+ const parentArg = firstStringArg(args, ["parent", "parent_id", "parentId", "related_task_id"]);
314
+ const parentTaskId = parentArg ? await resolveRestParentTaskId(parentArg, requestOpts) : void 0;
301
315
  const created = await abletimeRestRequest("/tasks", {
302
316
  ...requestOpts,
303
317
  method: "POST",
304
318
  body: {
305
- projectId: project.id,
319
+ projectId: asString(project.id),
306
320
  projectCategoryId: category ? asString(category.id) : void 0,
307
- title
321
+ title,
322
+ ...parentTaskId ? { parentTaskId } : {}
308
323
  }
309
324
  });
310
325
  const state = firstStringArg(args, ["state"]);
@@ -337,6 +352,21 @@ async function callAbleTimeRestTool(name, args = {}, opts) {
337
352
  if (args.tags !== void 0 || args.labels !== void 0) {
338
353
  patch.tags = args.tags ?? args.labels ?? args.tag_names;
339
354
  }
355
+ const projectArg = firstStringArg(args, ["project", "project_id", "projectId"]);
356
+ if (projectArg) {
357
+ if (isNoneToken(projectArg)) {
358
+ throw new Error("AbleTime tasks stay in a project \u2014 pass a project name or id");
359
+ }
360
+ const projects = await listProjectsRaw(requestOpts);
361
+ const project = findRestProject(projects, projectArg);
362
+ const nextProjectId = project ? asString(project.id) : "";
363
+ if (!nextProjectId) throw new Error(`AbleTime project not found: ${projectArg}`);
364
+ patch.projectId = nextProjectId;
365
+ }
366
+ const parentArg = firstStringArg(args, ["parent", "parent_id", "parentId", "related_task_id"]);
367
+ if (parentArg) {
368
+ patch.parentTaskId = await resolveRestParentTaskId(parentArg, requestOpts);
369
+ }
340
370
  if (Object.keys(patch).length > 0) {
341
371
  await abletimeRestRequest(`/tasks/${encodeURIComponent(id)}`, {
342
372
  ...requestOpts,
@@ -5,7 +5,7 @@ import {
5
5
  resolveRepoRoot,
6
6
  takenSlugsFromThread,
7
7
  teamSlugFromName
8
- } from "./chunk-EJX62RSX.js";
8
+ } from "./chunk-OP6CFVTB.js";
9
9
  import {
10
10
  ATTACHMENTS_DIR,
11
11
  attachmentsGitignoreBody
@@ -22,13 +22,13 @@ import {
22
22
  resolveThreadDefaults,
23
23
  resolveViewerProfile,
24
24
  resolveViewerProfileForRepo
25
- } from "./chunk-QFBBUFD4.js";
25
+ } from "./chunk-Y4CF7LHH.js";
26
26
  import {
27
27
  createEmptyThread,
28
28
  listThreads,
29
29
  updateThread,
30
30
  writeThread
31
- } from "./chunk-ARR4OGLY.js";
31
+ } from "./chunk-7DKX5JLT.js";
32
32
  import {
33
33
  appDataDir,
34
34
  globalAgentCwd,
@@ -340,7 +340,7 @@ function looksLikeCodexMcpError(text) {
340
340
  if (/\brmcp\b/.test(t) && /fatal|quit|transport|error|died|kill|auth/.test(t)) {
341
341
  return true;
342
342
  }
343
- return /mcp[_ -]?(server|tool|error|transport|client)/.test(t) && /fail|error|timeout|disconnect|auth|unauthorized/.test(t);
343
+ return /invalid transport in mcp_servers/.test(t);
344
344
  }
345
345
  function shouldFeedErrorBackToAgent(opts) {
346
346
  const detail = opts.detail.trim();
@@ -5,7 +5,7 @@ import {
5
5
  } from "./chunk-D6JWYJ4P.js";
6
6
  import {
7
7
  listThreads
8
- } from "./chunk-DWGEBZ3C.js";
8
+ } from "./chunk-ZHCB4CKR.js";
9
9
  import {
10
10
  ensureWorktreeSideboardIgnored
11
11
  } from "./chunk-SYFVUF2C.js";
@@ -22,7 +22,7 @@ import {
22
22
  import {
23
23
  getGithubGitAuthMode,
24
24
  getGithubPat
25
- } from "./chunk-X743YN5Y.js";
25
+ } from "./chunk-4EGK47WV.js";
26
26
  import {
27
27
  worktreesRoot
28
28
  } from "./chunk-EQNRWDLN.js";
@@ -7,10 +7,10 @@ import {
7
7
  import {
8
8
  getGithubGitAuthMode,
9
9
  getGithubPat
10
- } from "./chunk-QFBBUFD4.js";
10
+ } from "./chunk-Y4CF7LHH.js";
11
11
  import {
12
12
  listThreads
13
- } from "./chunk-ARR4OGLY.js";
13
+ } from "./chunk-7DKX5JLT.js";
14
14
  import {
15
15
  worktreesRoot
16
16
  } from "./chunk-WFUDY6PC.js";
@@ -6,14 +6,14 @@ import {
6
6
  normalizeAbleTimeCredential,
7
7
  normalizeAbleTimeHost,
8
8
  rewriteAbleTimeError
9
- } from "./chunk-SGUVAK66.js";
9
+ } from "./chunk-WXWJ5MJ4.js";
10
10
  import {
11
11
  httpFetch
12
12
  } from "./chunk-VKQGAWHY.js";
13
13
  import {
14
14
  getAbleTimeAccessToken,
15
15
  getAbleTimeHost
16
- } from "./chunk-X743YN5Y.js";
16
+ } from "./chunk-4EGK47WV.js";
17
17
 
18
18
  // src/integrations/abletime-rest.ts
19
19
  var ABLETIME_REST_PREFIX = "/api/public/v2";
@@ -155,6 +155,7 @@ function restTaskToRaw(raw, users) {
155
155
  description: textFromAbleTimeDoc(rec.description) || asString(rec.descriptionSanitized),
156
156
  projectId: asString(rec.projectId),
157
157
  categoryId: asString(rec.projectCategoryId) || asString(rec.categoryId),
158
+ parentId: asString(rec.parentTaskId) || asString(rec.parentId),
158
159
  tags: rec.tags,
159
160
  comments,
160
161
  createdAt: asString(rec.dateCreated) || asString(rec.createdAt),
@@ -245,6 +246,19 @@ function firstStringArg(args, keys) {
245
246
  }
246
247
  return "";
247
248
  }
249
+ function isNoneToken(value) {
250
+ return value.trim().toLowerCase() === "none";
251
+ }
252
+ function findRestProject(projects, projectId) {
253
+ const wanted = projectId.trim().toLowerCase();
254
+ return projects.find(
255
+ (item) => asString(item.id).toLowerCase() === wanted || asString(item.name).toLowerCase() === wanted
256
+ ) ?? null;
257
+ }
258
+ async function resolveRestParentTaskId(parent, opts) {
259
+ if (isNoneToken(parent)) return null;
260
+ return resolveTaskId(parent, opts);
261
+ }
248
262
  async function callAbleTimeRestTool(name, args = {}, opts) {
249
263
  const token = normalizeAbleTimeCredential(opts?.token ?? getAbleTimeAccessToken() ?? "");
250
264
  if (!token) {
@@ -290,9 +304,7 @@ async function callAbleTimeRestTool(name, args = {}, opts) {
290
304
  const projectId = firstStringArg(args, ["project_id", "projectId", "project"]);
291
305
  if (!projectId) throw new Error("AbleTime project is required");
292
306
  const projects = await listProjectsRaw(requestOpts);
293
- const project = projects.find(
294
- (item) => String(item.id).toLowerCase() === projectId.toLowerCase() || String(item.name).toLowerCase() === projectId.toLowerCase()
295
- ) ?? projects[0];
307
+ const project = findRestProject(projects, projectId) ?? projects[0];
296
308
  if (!project) throw new Error("AbleTime has no projects to create a task in");
297
309
  const categories = asList(project.categories);
298
310
  const wantedCategory = firstStringArg(args, ["category_id", "categoryId", "category"]);
@@ -300,13 +312,16 @@ async function callAbleTimeRestTool(name, args = {}, opts) {
300
312
  if (!item || !wantedCategory) return false;
301
313
  return asString(item.id).toLowerCase() === wantedCategory.toLowerCase() || asString(item.name).toLowerCase() === wantedCategory.toLowerCase();
302
314
  }) ?? asRecord(categories[0]);
315
+ const parentArg = firstStringArg(args, ["parent", "parent_id", "parentId", "related_task_id"]);
316
+ const parentTaskId = parentArg ? await resolveRestParentTaskId(parentArg, requestOpts) : void 0;
303
317
  const created = await abletimeRestRequest("/tasks", {
304
318
  ...requestOpts,
305
319
  method: "POST",
306
320
  body: {
307
- projectId: project.id,
321
+ projectId: asString(project.id),
308
322
  projectCategoryId: category ? asString(category.id) : void 0,
309
- title
323
+ title,
324
+ ...parentTaskId ? { parentTaskId } : {}
310
325
  }
311
326
  });
312
327
  const state = firstStringArg(args, ["state"]);
@@ -339,6 +354,21 @@ async function callAbleTimeRestTool(name, args = {}, opts) {
339
354
  if (args.tags !== void 0 || args.labels !== void 0) {
340
355
  patch.tags = args.tags ?? args.labels ?? args.tag_names;
341
356
  }
357
+ const projectArg = firstStringArg(args, ["project", "project_id", "projectId"]);
358
+ if (projectArg) {
359
+ if (isNoneToken(projectArg)) {
360
+ throw new Error("AbleTime tasks stay in a project \u2014 pass a project name or id");
361
+ }
362
+ const projects = await listProjectsRaw(requestOpts);
363
+ const project = findRestProject(projects, projectArg);
364
+ const nextProjectId = project ? asString(project.id) : "";
365
+ if (!nextProjectId) throw new Error(`AbleTime project not found: ${projectArg}`);
366
+ patch.projectId = nextProjectId;
367
+ }
368
+ const parentArg = firstStringArg(args, ["parent", "parent_id", "parentId", "related_task_id"]);
369
+ if (parentArg) {
370
+ patch.parentTaskId = await resolveRestParentTaskId(parentArg, requestOpts);
371
+ }
342
372
  if (Object.keys(patch).length > 0) {
343
373
  await abletimeRestRequest(`/tasks/${encodeURIComponent(id)}`, {
344
374
  ...requestOpts,
@@ -1,16 +1,16 @@
1
1
  import {
2
2
  textFromAbleTimeDoc
3
- } from "./chunk-CYLDJWRK.js";
3
+ } from "./chunk-F4LZUEIO.js";
4
4
  import {
5
5
  assertAbleTimeCredential,
6
6
  callAbleTimeTool,
7
7
  normalizeAbleTimeHost,
8
8
  rewriteAbleTimeError
9
- } from "./chunk-W6VM36YO.js";
9
+ } from "./chunk-X45BV4VX.js";
10
10
  import {
11
11
  isAbleTimeConnected,
12
12
  saveAbleTimeConnection
13
- } from "./chunk-QFBBUFD4.js";
13
+ } from "./chunk-Y4CF7LHH.js";
14
14
 
15
15
  // src/integrations/abletime.ts
16
16
  var CLOSED_STATES = /* @__PURE__ */ new Set([