@sideboard-ai/core 0.1.195 → 0.1.197

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.
@@ -9341,6 +9341,11 @@ function parseDiffStat(result) {
9341
9341
  }
9342
9342
  return {};
9343
9343
  }
9344
+ function clipThinkingForStore(text7, max = THINKING_PART_MAX_CHARS) {
9345
+ if (text7.length <= max) return text7;
9346
+ const marker = "\u2026(earlier thinking trimmed)\n";
9347
+ return marker + text7.slice(text7.length - Math.max(1, max - marker.length));
9348
+ }
9344
9349
  function withPartTimes(next, prev) {
9345
9350
  const now = Date.now();
9346
9351
  const startedAt = prev && typeof prev.startedAt === "number" ? prev.startedAt : now;
@@ -9383,7 +9388,7 @@ function applyAgentEvent(parts, event) {
9383
9388
  next[i] = withPartTimes(
9384
9389
  {
9385
9390
  type: "thinking",
9386
- text: data,
9391
+ text: clipThinkingForStore(data),
9387
9392
  ...event.parentId ? { parentId: event.parentId } : {}
9388
9393
  },
9389
9394
  prev
@@ -9394,7 +9399,7 @@ function applyAgentEvent(parts, event) {
9394
9399
  next.push(
9395
9400
  withPartTimes({
9396
9401
  type: "thinking",
9397
- text: data,
9402
+ text: clipThinkingForStore(data),
9398
9403
  ...event.parentId ? { parentId: event.parentId } : {}
9399
9404
  })
9400
9405
  );
@@ -9405,7 +9410,7 @@ function applyAgentEvent(parts, event) {
9405
9410
  next[next.length - 1] = withPartTimes(
9406
9411
  {
9407
9412
  type: "thinking",
9408
- text: last.text + data,
9413
+ text: clipThinkingForStore(last.text + data),
9409
9414
  ...event.parentId ? { parentId: event.parentId } : {}
9410
9415
  },
9411
9416
  last
@@ -9556,12 +9561,13 @@ function normalizeParseResult(parsed) {
9556
9561
  if (!parsed) return [];
9557
9562
  return Array.isArray(parsed) ? parsed : [parsed];
9558
9563
  }
9559
- var CHAT_DETAIL_MAX;
9564
+ var CHAT_DETAIL_MAX, THINKING_PART_MAX_CHARS;
9560
9565
  var init_message_parts = __esm({
9561
9566
  "src/agents/message-parts.ts"() {
9562
9567
  "use strict";
9563
9568
  init_error_detail();
9564
9569
  CHAT_DETAIL_MAX = 72;
9570
+ THINKING_PART_MAX_CHARS = 64e3;
9565
9571
  }
9566
9572
  });
9567
9573
 
@@ -10897,6 +10903,9 @@ function toCodexDisableUserMcpArgs(names) {
10897
10903
  }
10898
10904
  return args;
10899
10905
  }
10906
+ function toCodexUnattendedAppsArgs() {
10907
+ return ["-c", "features.apps=false", "-c", "apps._default.enabled=false"];
10908
+ }
10900
10909
  var import_node_fs28, import_node_os11, import_node_path29, import_smol_toml2;
10901
10910
  var init_orch_mcp_isolation = __esm({
10902
10911
  "src/agents/orch-mcp-isolation.ts"() {
@@ -11092,6 +11101,7 @@ var init_codex = __esm({
11092
11101
  orchestratorThreadId: isOrchestrator ? thread.id : null
11093
11102
  });
11094
11103
  const mcpOverrides = [
11104
+ ...toCodexUnattendedAppsArgs(),
11095
11105
  ...toCodexMcpConfigArgs(injected2),
11096
11106
  ...isOrchestrator ? toCodexDisableUserMcpArgs(
11097
11107
  userMcpNamesToDisable({
@@ -12793,7 +12803,7 @@ function formatToolPart(t, detail) {
12793
12803
  if (t.input && Object.keys(t.input).length > 0) {
12794
12804
  lines.push("Input:");
12795
12805
  lines.push("```json");
12796
- lines.push(JSON.stringify(t.input, null, 2));
12806
+ lines.push(clipToolResultForStore(JSON.stringify(t.input, null, 2)) ?? "");
12797
12807
  lines.push("```");
12798
12808
  } else if (t.detail) {
12799
12809
  lines.push(`Detail: ${t.detail}`);
@@ -12841,19 +12851,7 @@ ${m.text}`);
12841
12851
  }
12842
12852
  return bits.join("\n");
12843
12853
  }
12844
- function buildSessionSeed(messages, opts) {
12845
- if (messages.length === 0) return null;
12846
- const tools = opts?.tools ?? "full";
12847
- const fullCount = opts?.fullToolMessages ?? SEED_FULL_TOOL_MESSAGES;
12848
- const maxChars = opts?.maxChars ?? SEED_MAX_CHARS;
12849
- const olderTools = tools === "none" ? "none" : "summary";
12850
- const fullFrom = Math.max(0, messages.length - fullCount);
12851
- const blocks = messages.map(
12852
- (m, i) => formatMessageBlock(m, {
12853
- tools: i >= fullFrom ? tools : olderTools,
12854
- thinking: false
12855
- })
12856
- );
12854
+ function budgetSeedBlocks(messages, blocks, maxChars) {
12857
12855
  const keep = new Array(blocks.length).fill(false);
12858
12856
  let used = 0;
12859
12857
  for (let i = 0; i < blocks.length; i++) {
@@ -12870,20 +12868,34 @@ function buildSessionSeed(messages, opts) {
12870
12868
  used = next;
12871
12869
  }
12872
12870
  const dropped = keep.filter((k) => !k).length;
12871
+ const marker = `_(${dropped} older message${dropped === 1 ? "" : "s"} omitted for length)_`;
12873
12872
  const kept = [];
12874
12873
  let markerPlaced = false;
12875
12874
  for (let i = 0; i < blocks.length; i++) {
12876
12875
  if (!keep[i]) continue;
12877
12876
  if (dropped > 0 && !markerPlaced && messages[i].role !== "summary") {
12878
- kept.push(`_(${dropped} older message${dropped === 1 ? "" : "s"} omitted for length)_`);
12877
+ kept.push(marker);
12879
12878
  markerPlaced = true;
12880
12879
  }
12881
12880
  kept.push(blocks[i]);
12882
12881
  }
12883
- if (dropped > 0 && !markerPlaced) {
12884
- kept.push(`_(${dropped} older message${dropped === 1 ? "" : "s"} omitted for length)_`);
12885
- }
12886
- const body = kept.join("\n\n");
12882
+ if (dropped > 0 && !markerPlaced) kept.push(marker);
12883
+ return kept.join("\n\n");
12884
+ }
12885
+ function buildSessionSeed(messages, opts) {
12886
+ if (messages.length === 0) return null;
12887
+ const tools = opts?.tools ?? "full";
12888
+ const fullCount = opts?.fullToolMessages ?? SEED_FULL_TOOL_MESSAGES;
12889
+ const maxChars = opts?.maxChars ?? SEED_MAX_CHARS;
12890
+ const olderTools = tools === "none" ? "none" : "summary";
12891
+ const fullFrom = Math.max(0, messages.length - fullCount);
12892
+ const blocks = messages.map(
12893
+ (m, i) => formatMessageBlock(m, {
12894
+ tools: i >= fullFrom ? tools : olderTools,
12895
+ thinking: false
12896
+ })
12897
+ );
12898
+ const body = budgetSeedBlocks(messages, blocks, maxChars);
12887
12899
  if (!body.trim()) return null;
12888
12900
  return [
12889
12901
  "Sideboard conversation context (restored after compaction or a new session):",
@@ -12933,10 +12945,12 @@ function findLastBrightsyContextSummary(messages) {
12933
12945
  }
12934
12946
  return null;
12935
12947
  }
12936
- function buildBrightsySessionSeed(messages) {
12948
+ function buildBrightsySessionSeed(messages, opts) {
12937
12949
  const match = findLastBrightsyContextSummary(messages);
12938
12950
  const tail = match ? messages.slice(match.index + 1) : messages;
12939
- const body = formatMessagesAsTranscript(tail, { tools: "none", thinking: false });
12951
+ const budget = Math.max(1e3, (opts?.maxChars ?? SEED_MAX_CHARS) - (match?.text.length ?? 0));
12952
+ const tailBlocks = tail.map((m) => formatMessageBlock(m, { tools: "none", thinking: false }));
12953
+ const body = budgetSeedBlocks(tail, tailBlocks, budget);
12940
12954
  if (!match && !body.trim()) return null;
12941
12955
  const blocks = [
12942
12956
  "Sideboard conversation context (restored after compaction or a new session):",
@@ -13007,6 +13021,7 @@ var CONTEXT_COMPACT_CHARS, CONTEXT_KEEP_RECENT_CHARS, CONTEXT_KEEP_RECENT_MESSAG
13007
13021
  var init_context_compact = __esm({
13008
13022
  "src/composer/context-compact.ts"() {
13009
13023
  "use strict";
13024
+ init_error_detail();
13010
13025
  init_usage();
13011
13026
  init_context_estimate();
13012
13027
  init_summarize();
@@ -13057,6 +13072,10 @@ function pickRichestSetupLog(snaps) {
13057
13072
  }
13058
13073
  return best;
13059
13074
  }
13075
+ function resolveWorktreeSetupLog(shared, legacyChatLogs) {
13076
+ if (shared.output || shared.running || shared.exitCode != null) return shared;
13077
+ return pickRichestSetupLog(legacyChatLogs);
13078
+ }
13060
13079
  function mergeWorktreeActiveRuns(threads) {
13061
13080
  const byName = /* @__PURE__ */ new Map();
13062
13081
  let devPort = null;
@@ -13872,6 +13891,14 @@ var init_conductor = __esm({
13872
13891
  });
13873
13892
 
13874
13893
  // src/store/setup-log.ts
13894
+ function appendSetupOutput(prev, line, max = MAX_SETUP_LOG_CHARS) {
13895
+ const next = prev ? `${prev}
13896
+ ${line}` : line;
13897
+ if (next.length <= max) return next;
13898
+ const cut = next.slice(next.length - max);
13899
+ const nl = cut.indexOf("\n");
13900
+ return nl >= 0 && nl < cut.length - 1 ? cut.slice(nl + 1) : cut;
13901
+ }
13875
13902
  function setupLogPath(threadId) {
13876
13903
  return (0, import_node_path36.join)(threadsDir(), `${threadId}.setup.log.json`);
13877
13904
  }
@@ -13949,8 +13976,7 @@ function appendSetupLog(threadId, line) {
13949
13976
  const current = memory.get(threadId) ?? readSetupLog(threadId);
13950
13977
  const snap = {
13951
13978
  ...current,
13952
- output: current.output ? `${current.output}
13953
- ${line}` : line,
13979
+ output: appendSetupOutput(current.output, line),
13954
13980
  running: true
13955
13981
  };
13956
13982
  memory.set(threadId, snap);
@@ -13969,7 +13995,7 @@ function finishSetupLog(threadId, exitCode, source) {
13969
13995
  persistNow(threadId);
13970
13996
  return clone(snap);
13971
13997
  }
13972
- var import_node_crypto8, import_node_fs36, import_node_path36, EMPTY, memory, persistTimers;
13998
+ var import_node_crypto8, import_node_fs36, import_node_path36, EMPTY, MAX_SETUP_LOG_CHARS, memory, persistTimers;
13973
13999
  var init_setup_log = __esm({
13974
14000
  "src/store/setup-log.ts"() {
13975
14001
  "use strict";
@@ -13984,6 +14010,7 @@ var init_setup_log = __esm({
13984
14010
  exitCode: null,
13985
14011
  source: null
13986
14012
  };
14013
+ MAX_SETUP_LOG_CHARS = 256e3;
13987
14014
  memory = /* @__PURE__ */ new Map();
13988
14015
  persistTimers = /* @__PURE__ */ new Map();
13989
14016
  }
@@ -20306,6 +20333,7 @@ var init_orchestrator = __esm({
20306
20333
  return true;
20307
20334
  });
20308
20335
  if (!promoted) return this.requireThread(thread.id);
20336
+ if (!thisProcessShouldDrainAgentQueues()) return this.requireThread(thread.id);
20309
20337
  const current = this.requireThread(thread.id);
20310
20338
  const inFlight = this.activeTurns.has(thread.id) || this.startingTurns.has(thread.id);
20311
20339
  const livePid = current.agentPid;
@@ -21046,10 +21074,10 @@ var init_orchestrator = __esm({
21046
21074
  thread.id,
21047
21075
  ...threadsSharingWorktree(thread.worktreePath).map((t) => t.id)
21048
21076
  ];
21049
- const snap = pickRichestSetupLog([
21077
+ const snap = resolveWorktreeSetupLog(
21050
21078
  readSetupLog(setupLogKeyForWorktree(thread.worktreePath)),
21051
- ...[...new Set(siblingIds)].map((id) => readSetupLog(id))
21052
- ]) ?? readSetupLog(thread.id);
21079
+ [...new Set(siblingIds)].map((id) => readSetupLog(id))
21080
+ ) ?? readSetupLog(thread.id);
21053
21081
  if (snap.running && !this.hasWorktreeSetupProcess(thread.worktreePath)) {
21054
21082
  return { ...snap, running: false };
21055
21083
  }
@@ -26200,7 +26228,7 @@ async function startMcpServer() {
26200
26228
  );
26201
26229
  server.tool(
26202
26230
  "send_to_thread",
26203
- 'Steer a prompt on a worktree thread chat (Settings \u2192 Follow-up, default steer: interrupt and start now, skip the inbox). Use after create_thread to start or continue a conversation. For commit/push/PR, prefer ask_git (canonical desktop-button phrases). Send "Merge PR." / ask_git merge only when the user explicitly asked to merge. force_stop=true kills the in-flight turn and clears the queue before this prompt \u2014 only when the current request is wrong and must be replaced. Do not send_to_thread to check in, resume after a halt notice, or because wait_for_turn returned stillRunning; that interrupts the child mid-thought. Call wait_for_turn again instead.',
26231
+ 'Steer a prompt on a worktree thread chat (Settings \u2192 Follow-up, default steer: front of the queue, skips the inbox; while the desktop board is running it starts as soon as the in-flight turn yields). Use after create_thread to start or continue a conversation. For commit/push/PR, prefer ask_git (canonical desktop-button phrases). Send "Merge PR." / ask_git merge only when the user explicitly asked to merge. force_stop=true kills the in-flight turn and clears the queue before this prompt \u2014 only when the current request is wrong and must be replaced. Do not send_to_thread to check in, resume after a halt notice, or because wait_for_turn returned stillRunning; that interrupts the child mid-thought. Call wait_for_turn again instead.',
26204
26232
  {
26205
26233
  ref: import_zod9.z.string(),
26206
26234
  prompt: import_zod9.z.string(),
@@ -38,7 +38,7 @@ import {
38
38
  syncBoardPins,
39
39
  updateSchedule,
40
40
  waitForDetachedJob
41
- } from "../chunk-GFH3QVAV.js";
41
+ } from "../chunk-ZG7RONNQ.js";
42
42
  import "../chunk-YWI3IBP2.js";
43
43
  import {
44
44
  applySystemCaEnv,
@@ -48,7 +48,7 @@ import {
48
48
  materializeSystemCaBundle,
49
49
  sideboardMcpProfile,
50
50
  trustSystemCertificates
51
- } from "../chunk-6H2XPPPR.js";
51
+ } from "../chunk-PQBRCBIE.js";
52
52
  import {
53
53
  GLOBAL_WORKSPACE_ID,
54
54
  isCloudCoordinatorThread,
@@ -4353,7 +4353,7 @@ async function startMcpServer() {
4353
4353
  );
4354
4354
  server.tool(
4355
4355
  "send_to_thread",
4356
- 'Steer a prompt on a worktree thread chat (Settings \u2192 Follow-up, default steer: interrupt and start now, skip the inbox). Use after create_thread to start or continue a conversation. For commit/push/PR, prefer ask_git (canonical desktop-button phrases). Send "Merge PR." / ask_git merge only when the user explicitly asked to merge. force_stop=true kills the in-flight turn and clears the queue before this prompt \u2014 only when the current request is wrong and must be replaced. Do not send_to_thread to check in, resume after a halt notice, or because wait_for_turn returned stillRunning; that interrupts the child mid-thought. Call wait_for_turn again instead.',
4356
+ 'Steer a prompt on a worktree thread chat (Settings \u2192 Follow-up, default steer: front of the queue, skips the inbox; while the desktop board is running it starts as soon as the in-flight turn yields). Use after create_thread to start or continue a conversation. For commit/push/PR, prefer ask_git (canonical desktop-button phrases). Send "Merge PR." / ask_git merge only when the user explicitly asked to merge. force_stop=true kills the in-flight turn and clears the queue before this prompt \u2014 only when the current request is wrong and must be replaced. Do not send_to_thread to check in, resume after a halt notice, or because wait_for_turn returned stillRunning; that interrupts the child mid-thought. Call wait_for_turn again instead.',
4357
4357
  {
4358
4358
  ref: z9.string(),
4359
4359
  prompt: z9.string(),
@@ -7,9 +7,9 @@ import {
7
7
  resolveSendFollowUp,
8
8
  startOrchestration,
9
9
  waitForPidExit
10
- } from "./chunk-HAVI6AY3.js";
10
+ } from "./chunk-SIIDQV2B.js";
11
11
  import "./chunk-DJU54RYW.js";
12
- import "./chunk-2X6RGKLI.js";
12
+ import "./chunk-N5JBG3BF.js";
13
13
  import "./chunk-HZTHWU6A.js";
14
14
  import "./chunk-S4QCBBXS.js";
15
15
  import "./chunk-6K64FJDD.js";
@@ -9,9 +9,9 @@ import {
9
9
  resolveSendFollowUp,
10
10
  startOrchestration,
11
11
  waitForPidExit
12
- } from "./chunk-GFH3QVAV.js";
12
+ } from "./chunk-ZG7RONNQ.js";
13
13
  import "./chunk-YWI3IBP2.js";
14
- import "./chunk-6H2XPPPR.js";
14
+ import "./chunk-PQBRCBIE.js";
15
15
  import "./chunk-6YTI2HBG.js";
16
16
  import "./chunk-3OHR73VK.js";
17
17
  import "./chunk-Y4MIXGPA.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sideboard-ai/core",
3
- "version": "0.1.195",
3
+ "version": "0.1.197",
4
4
  "description": "Sideboard core — orchestration, agents, git worktrees, MCP server",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",