@sideboard-ai/core 0.1.160 → 0.1.162

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.
@@ -37,7 +37,7 @@ import {
37
37
  resolveQuotaFallbackAgent,
38
38
  turnCostUsdFromCursorUsage,
39
39
  whichOnPath
40
- } from "./chunk-7OWRFJK6.js";
40
+ } from "./chunk-GGOU4JJU.js";
41
41
  import "./chunk-LZ6QMEQC.js";
42
42
  import "./chunk-S42XV45P.js";
43
43
  import "./chunk-6GN5WPYZ.js";
@@ -31,7 +31,7 @@ import {
31
31
  resolveLoginCommand,
32
32
  resolveQuotaFallbackAgent,
33
33
  whichOnPath
34
- } from "./chunk-RQNXLIXO.js";
34
+ } from "./chunk-QPJJ7H7C.js";
35
35
  import {
36
36
  ORCHESTRATOR_AGENT_KINDS,
37
37
  assertOrchestratorCapableAgent,
@@ -24,7 +24,7 @@ import {
24
24
  stripBrightsyNdjsonNoise,
25
25
  sumUsageList,
26
26
  toolDescription
27
- } from "./chunk-RQNXLIXO.js";
27
+ } from "./chunk-QPJJ7H7C.js";
28
28
  import {
29
29
  SLACK_REPLY_FORMATTING,
30
30
  addWorkspace,
@@ -464,7 +464,7 @@ async function continueSourceThread(threadId, prompt) {
464
464
  await continueOnReply(threadId, prompt);
465
465
  return;
466
466
  }
467
- const { getOrchestrator: getOrchestrator2 } = await import("./orchestrator-BSVSOTBK.js");
467
+ const { getOrchestrator: getOrchestrator2 } = await import("./orchestrator-6RDRATVE.js");
468
468
  await getOrchestrator2().send(threadId, prompt);
469
469
  } catch {
470
470
  }
@@ -3528,7 +3528,7 @@ async function createThread(input, _onSetupLine) {
3528
3528
  return readThread(thread.id) ?? thread;
3529
3529
  }
3530
3530
  async function listLinearIssues(agent, repoPath) {
3531
- const { getAdapter: getAdapter2 } = await import("./agents-RD774UEV.js");
3531
+ const { getAdapter: getAdapter2 } = await import("./agents-KAWRVTRR.js");
3532
3532
  await requireAgent(agent, { requireLinear: true });
3533
3533
  const adapter = getAdapter2(agent);
3534
3534
  if (!adapter.listLinearIssues) {
@@ -3537,6 +3537,17 @@ async function listLinearIssues(agent, repoPath) {
3537
3537
  return adapter.listLinearIssues(repoPath);
3538
3538
  }
3539
3539
 
3540
+ // src/threads/implied-first-prompt.ts
3541
+ var IMPLIED_TICKET_RESOLVE_PROMPT = "Resolve this issue.";
3542
+ function resolveCreateFirstPrompt(input) {
3543
+ const typed = input.prompt?.trim();
3544
+ if (typed) return typed;
3545
+ if (input.sourceType !== "ticket") return void 0;
3546
+ if (input.parentThreadId) return void 0;
3547
+ if (input.reused && input.hasUserMessages) return void 0;
3548
+ return IMPLIED_TICKET_RESOLVE_PROMPT;
3549
+ }
3550
+
3540
3551
  // src/threads/cowboy.ts
3541
3552
  function isCowboyThread(thread) {
3542
3553
  return Boolean(thread?.cowboy);
@@ -5783,17 +5794,17 @@ function formatIssueToolsDirective(opts) {
5783
5794
  ];
5784
5795
  if (opts.linear) {
5785
5796
  lines.push(
5786
- "- Linear: `linear_get_issue` (comments), `linear_comment`, `linear_update_issue` (state), `linear_create_issue` (pass `parent` for spin-offs; call `linear_list_teams` first). Scope errors: reconnect Linear in Settings \u2192 Issues."
5797
+ "- Linear: `linear_get_issue` (comments; pass `include=full` if crush.truncated), `linear_comment`, `linear_update_issue` (state), `linear_create_issue` (pass `parent` for spin-offs; call `linear_list_teams` first). Scope errors: reconnect Linear in Settings \u2192 Issues."
5787
5798
  );
5788
5799
  }
5789
5800
  if (github) {
5790
5801
  lines.push(
5791
- "- GitHub: `github_get_issue` (comments), `github_comment`, `github_update_issue` (state open|closed), `github_create_issue` (pass `parent` for spin-offs). Uses Account `gh`."
5802
+ "- GitHub: `github_get_issue` (comments; pass `include=full` if crush.truncated), `github_comment`, `github_update_issue` (state open|closed), `github_create_issue` (pass `parent` for spin-offs). Uses Account `gh`."
5792
5803
  );
5793
5804
  }
5794
5805
  if (opts.abletime) {
5795
5806
  lines.push(
5796
- "- AbleTime: `abletime_get_task` (comments), `abletime_comment`, `abletime_update_task` (state), `abletime_create_task` (pass `parent` for spin-offs; `abletime_list_projects` if needed)."
5807
+ "- AbleTime: `abletime_get_task` (comments; pass `include=full` if crush.truncated), `abletime_comment`, `abletime_update_task` (state), `abletime_create_task` (pass `parent` for spin-offs; `abletime_list_projects` if needed)."
5797
5808
  );
5798
5809
  }
5799
5810
  lines.push(
@@ -6493,7 +6504,7 @@ function formatScheduledPrompt(name, prompt) {
6493
6504
  ${prompt}`;
6494
6505
  }
6495
6506
  async function defaultDeps() {
6496
- const { getOrchestrator: getOrchestrator2, startOrchestration: startOrchestration2 } = await import("./orchestrator-BSVSOTBK.js");
6507
+ const { getOrchestrator: getOrchestrator2, startOrchestration: startOrchestration2 } = await import("./orchestrator-6RDRATVE.js");
6497
6508
  const orch = getOrchestrator2();
6498
6509
  return {
6499
6510
  findThread: (id) => findThreadByRef(id),
@@ -6993,10 +7004,18 @@ var Orchestrator = class {
6993
7004
  listThreads({ includeArchived: false }).map((t) => t.id)
6994
7005
  );
6995
7006
  const thread = await createThread(input);
6996
- if (prior.has(thread.id)) {
6997
- if (input.prompt?.trim()) {
7007
+ const reused = prior.has(thread.id);
7008
+ const prompt = resolveCreateFirstPrompt({
7009
+ sourceType: input.sourceType,
7010
+ prompt: input.prompt,
7011
+ parentThreadId: input.parentThreadId ?? thread.parentThreadId,
7012
+ reused,
7013
+ hasUserMessages: thread.messages.some((m) => m.role === "user")
7014
+ });
7015
+ if (reused) {
7016
+ if (prompt) {
6998
7017
  try {
6999
- await this.send(thread.id, input.prompt.trim());
7018
+ await this.send(thread.id, prompt);
7000
7019
  } catch (err) {
7001
7020
  const message = err instanceof Error ? err.message : String(err);
7002
7021
  updateThread(thread.id, {
@@ -7007,7 +7026,7 @@ var Orchestrator = class {
7007
7026
  return thread;
7008
7027
  }
7009
7028
  this.emit({ type: "status_changed", threadId: thread.id, status: thread.status });
7010
- void this.finishCreateThread(thread.id, input.prompt?.trim() || void 0);
7029
+ void this.finishCreateThread(thread.id, prompt);
7011
7030
  return thread;
7012
7031
  }
7013
7032
  async finishCreateThread(threadId, prompt) {
@@ -8905,6 +8924,8 @@ export {
8905
8924
  HOME_BOARD_AGENT_HINT,
8906
8925
  createThread,
8907
8926
  listLinearIssues,
8927
+ IMPLIED_TICKET_RESOLVE_PROMPT,
8928
+ resolveCreateFirstPrompt,
8908
8929
  isCowboyThread,
8909
8930
  isPrimaryCheckoutThread,
8910
8931
  shouldRemoveWorktreeOnTeardown,
@@ -1096,6 +1096,17 @@ function partsToAssistantText(parts) {
1096
1096
  (p) => p.type === "text" && !messagePartParentId(p)
1097
1097
  ).map((p) => p.text).join("").trim();
1098
1098
  }
1099
+ function lastAssistantMessageText(parts) {
1100
+ if (!parts?.length) return "";
1101
+ for (let i = parts.length - 1; i >= 0; i--) {
1102
+ const p = parts[i];
1103
+ if (!p || p.type !== "text" || messagePartParentId(p)) continue;
1104
+ const text = p.text.trim();
1105
+ if (!text || isInternalAgentStatusText(text)) continue;
1106
+ return text;
1107
+ }
1108
+ return "";
1109
+ }
1099
1110
  function stripBrightsyNdjsonNoise(text) {
1100
1111
  if (!text || !text.includes('"type"')) return text;
1101
1112
  let out = text;
@@ -3632,6 +3643,7 @@ export {
3632
3643
  toolFilePath,
3633
3644
  applyAgentEvent,
3634
3645
  partsToAssistantText,
3646
+ lastAssistantMessageText,
3635
3647
  stripBrightsyNdjsonNoise,
3636
3648
  isBrightsyNdjsonLine,
3637
3649
  finalizeParts,
@@ -33,7 +33,7 @@ import {
33
33
  summarizeTurnStderr,
34
34
  toolDescription,
35
35
  turnFailChatText
36
- } from "./chunk-7OWRFJK6.js";
36
+ } from "./chunk-GGOU4JJU.js";
37
37
  import {
38
38
  extractPresentedPlan,
39
39
  readPlanFile,
@@ -399,7 +399,7 @@ async function continueSourceThread(threadId, prompt) {
399
399
  await continueOnReply(threadId, prompt);
400
400
  return;
401
401
  }
402
- const { getOrchestrator: getOrchestrator2 } = await import("./orchestrator-KVKPIUVU.js");
402
+ const { getOrchestrator: getOrchestrator2 } = await import("./orchestrator-AXE7GCJA.js");
403
403
  await getOrchestrator2().send(threadId, prompt);
404
404
  } catch {
405
405
  }
@@ -3401,6 +3401,17 @@ async function createThread(input, _onSetupLine) {
3401
3401
  return readThread(thread.id) ?? thread;
3402
3402
  }
3403
3403
 
3404
+ // src/threads/implied-first-prompt.ts
3405
+ var IMPLIED_TICKET_RESOLVE_PROMPT = "Resolve this issue.";
3406
+ function resolveCreateFirstPrompt(input) {
3407
+ const typed = input.prompt?.trim();
3408
+ if (typed) return typed;
3409
+ if (input.sourceType !== "ticket") return void 0;
3410
+ if (input.parentThreadId) return void 0;
3411
+ if (input.reused && input.hasUserMessages) return void 0;
3412
+ return IMPLIED_TICKET_RESOLVE_PROMPT;
3413
+ }
3414
+
3404
3415
  // src/threads/cowboy.ts
3405
3416
  function isCowboyThread(thread) {
3406
3417
  return Boolean(thread?.cowboy);
@@ -5627,17 +5638,17 @@ function formatIssueToolsDirective(opts) {
5627
5638
  ];
5628
5639
  if (opts.linear) {
5629
5640
  lines.push(
5630
- "- Linear: `linear_get_issue` (comments), `linear_comment`, `linear_update_issue` (state), `linear_create_issue` (pass `parent` for spin-offs; call `linear_list_teams` first). Scope errors: reconnect Linear in Settings \u2192 Issues."
5641
+ "- Linear: `linear_get_issue` (comments; pass `include=full` if crush.truncated), `linear_comment`, `linear_update_issue` (state), `linear_create_issue` (pass `parent` for spin-offs; call `linear_list_teams` first). Scope errors: reconnect Linear in Settings \u2192 Issues."
5631
5642
  );
5632
5643
  }
5633
5644
  if (github) {
5634
5645
  lines.push(
5635
- "- GitHub: `github_get_issue` (comments), `github_comment`, `github_update_issue` (state open|closed), `github_create_issue` (pass `parent` for spin-offs). Uses Account `gh`."
5646
+ "- GitHub: `github_get_issue` (comments; pass `include=full` if crush.truncated), `github_comment`, `github_update_issue` (state open|closed), `github_create_issue` (pass `parent` for spin-offs). Uses Account `gh`."
5636
5647
  );
5637
5648
  }
5638
5649
  if (opts.abletime) {
5639
5650
  lines.push(
5640
- "- AbleTime: `abletime_get_task` (comments), `abletime_comment`, `abletime_update_task` (state), `abletime_create_task` (pass `parent` for spin-offs; `abletime_list_projects` if needed)."
5651
+ "- AbleTime: `abletime_get_task` (comments; pass `include=full` if crush.truncated), `abletime_comment`, `abletime_update_task` (state), `abletime_create_task` (pass `parent` for spin-offs; `abletime_list_projects` if needed)."
5641
5652
  );
5642
5653
  }
5643
5654
  lines.push(
@@ -6083,7 +6094,7 @@ function formatScheduledPrompt(name, prompt) {
6083
6094
  ${prompt}`;
6084
6095
  }
6085
6096
  async function defaultDeps() {
6086
- const { getOrchestrator: getOrchestrator2, startOrchestration: startOrchestration2 } = await import("./orchestrator-KVKPIUVU.js");
6097
+ const { getOrchestrator: getOrchestrator2, startOrchestration: startOrchestration2 } = await import("./orchestrator-AXE7GCJA.js");
6087
6098
  const orch = getOrchestrator2();
6088
6099
  return {
6089
6100
  findThread: (id) => findThreadByRef(id),
@@ -6583,10 +6594,18 @@ var Orchestrator = class {
6583
6594
  listThreads({ includeArchived: false }).map((t) => t.id)
6584
6595
  );
6585
6596
  const thread = await createThread(input);
6586
- if (prior.has(thread.id)) {
6587
- if (input.prompt?.trim()) {
6597
+ const reused = prior.has(thread.id);
6598
+ const prompt = resolveCreateFirstPrompt({
6599
+ sourceType: input.sourceType,
6600
+ prompt: input.prompt,
6601
+ parentThreadId: input.parentThreadId ?? thread.parentThreadId,
6602
+ reused,
6603
+ hasUserMessages: thread.messages.some((m) => m.role === "user")
6604
+ });
6605
+ if (reused) {
6606
+ if (prompt) {
6588
6607
  try {
6589
- await this.send(thread.id, input.prompt.trim());
6608
+ await this.send(thread.id, prompt);
6590
6609
  } catch (err) {
6591
6610
  const message = err instanceof Error ? err.message : String(err);
6592
6611
  updateThread(thread.id, {
@@ -6597,7 +6616,7 @@ var Orchestrator = class {
6597
6616
  return thread;
6598
6617
  }
6599
6618
  this.emit({ type: "status_changed", threadId: thread.id, status: thread.status });
6600
- void this.finishCreateThread(thread.id, input.prompt?.trim() || void 0);
6619
+ void this.finishCreateThread(thread.id, prompt);
6601
6620
  return thread;
6602
6621
  }
6603
6622
  async finishCreateThread(threadId, prompt) {