@proxysoul/soulforge 2.14.5 → 2.14.7

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.
package/dist/index.js CHANGED
@@ -51558,6 +51558,8 @@ var init_icons = __esm(() => {
51558
51558
  memory: "\uDB80\uDF7D",
51559
51559
  memory_alt: "\uDB80\uDDA3",
51560
51560
  dispatch: "\uDB81\uDEA9",
51561
+ spark: "\uF0E7",
51562
+ ember: "\uF06D",
51561
51563
  router: "\uDB81\uDCF9",
51562
51564
  tabs: "\uDB81\uDCE9",
51563
51565
  info: "\uDB80\uDED6",
@@ -51680,6 +51682,8 @@ var init_icons = __esm(() => {
51680
51682
  memory: "\u273F",
51681
51683
  memory_alt: "\u273F",
51682
51684
  dispatch: "\u25B9",
51685
+ spark: "\u2726",
51686
+ ember: "\u273A",
51683
51687
  router: "\u2699",
51684
51688
  tabs: "\u2630",
51685
51689
  info: "\u24D8",
@@ -57924,7 +57928,7 @@ var package_default;
57924
57928
  var init_package = __esm(() => {
57925
57929
  package_default = {
57926
57930
  name: "@proxysoul/soulforge",
57927
- version: "2.14.5",
57931
+ version: "2.14.7",
57928
57932
  description: "Graph-powered code intelligence \u2014 multi-agent coding with codebase-aware AI",
57929
57933
  repository: {
57930
57934
  type: "git",
@@ -83101,18 +83105,23 @@ function getProxyState() {
83101
83105
  };
83102
83106
  }
83103
83107
  function getInstalledProxyVersion() {
83108
+ const vendored = getVendoredPath("cli-proxy-api");
83109
+ const binaryVersion = vendored ? getBinaryVersion(vendored) : null;
83104
83110
  try {
83105
83111
  if (existsSync13(VERSION_FILE)) {
83106
83112
  const v = readFileSync12(VERSION_FILE, "utf-8").trim();
83107
- if (v)
83113
+ if (v) {
83114
+ if (binaryVersion && v !== binaryVersion) {
83115
+ saveInstalledProxyVersion(binaryVersion);
83116
+ return binaryVersion;
83117
+ }
83108
83118
  return v;
83119
+ }
83109
83120
  }
83110
83121
  } catch {}
83111
- const vendored = getVendoredPath("cli-proxy-api");
83112
- if (vendored) {
83113
- const v = getBinaryVersion(vendored);
83114
- if (v)
83115
- return v;
83122
+ if (binaryVersion) {
83123
+ saveInstalledProxyVersion(binaryVersion);
83124
+ return binaryVersion;
83116
83125
  }
83117
83126
  return "";
83118
83127
  }
@@ -83616,7 +83625,7 @@ async function upgradeProxy(onStatus) {
83616
83625
  if (wasRunning) {
83617
83626
  onStatus("Stopping proxy\u2026");
83618
83627
  stopProxy();
83619
- await new Promise((r) => setTimeout(r, 500));
83628
+ await waitForPortFree(3000);
83620
83629
  }
83621
83630
  onStatus(`Downloading CLIProxyAPI v${vinfo.latest}\u2026`);
83622
83631
  try {
@@ -87734,7 +87743,7 @@ function getModelCapabilities3(modelId) {
87734
87743
  provider: "anthropic",
87735
87744
  thinking: true,
87736
87745
  adaptiveThinking: true,
87737
- effort: true,
87746
+ effort: !base.includes("haiku"),
87738
87747
  speed: base.includes("opus"),
87739
87748
  contextManagement: !base.includes("haiku"),
87740
87749
  interleavedThinking: true,
@@ -87803,6 +87812,8 @@ function getSupportedClaudeEfforts(modelId) {
87803
87812
  const base = extractBaseModel(modelId);
87804
87813
  if (!base.startsWith("claude"))
87805
87814
  return null;
87815
+ if (base.includes("haiku"))
87816
+ return null;
87806
87817
  const v = parseOpusVersion(base);
87807
87818
  if (v && (v.major >= 5 || v.major === 4 && v.minor >= 7)) {
87808
87819
  return ["max", "xhigh", "high", "medium", "low"];
@@ -349011,12 +349022,16 @@ class RepoMap {
349011
349022
  file_path = COALESCE((SELECT f.path FROM symbols s JOIN files f ON f.id = s.file_id WHERE s.id = semantic_summaries.symbol_id), ''),
349012
349023
  symbol_name = COALESCE((SELECT s.name FROM symbols s WHERE s.id = semantic_summaries.symbol_id), '')
349013
349024
  WHERE file_path = '' AND symbol_id IN (SELECT id FROM symbols)`);
349014
- } catch {}
349025
+ } catch (e) {
349026
+ this.onError?.(`backfillSummaryPaths failed: ${e instanceof Error ? e.message : String(e)}`);
349027
+ }
349015
349028
  }
349016
349029
  cleanOrphanedSummaries() {
349017
349030
  try {
349018
349031
  this.db.run("DELETE FROM semantic_summaries WHERE symbol_id NOT IN (SELECT id FROM symbols) AND (source != 'llm' OR file_path = '')");
349019
- } catch {}
349032
+ } catch (e) {
349033
+ this.onError?.(`cleanOrphanedSummaries failed: ${e instanceof Error ? e.message : String(e)}`);
349034
+ }
349020
349035
  }
349021
349036
  get isReady() {
349022
349037
  return this.ready;
@@ -350645,11 +350660,15 @@ class RepoMap {
350645
350660
  try {
350646
350661
  const st = await statAsync(absPath);
350647
350662
  this.indexFile(absPath, relPath, st.mtimeMs, language);
350648
- } catch {}
350663
+ } catch (e) {
350664
+ this.onError?.(`reindex failed for ${relPath}: ${e instanceof Error ? e.message : String(e)}`);
350665
+ }
350649
350666
  }
350650
350667
  this.markDirty();
350651
350668
  };
350652
- process3().catch(() => {});
350669
+ process3().catch((e) => {
350670
+ this.onError?.(`flushReindex failed: ${e instanceof Error ? e.message : String(e)}`);
350671
+ });
350653
350672
  }
350654
350673
  markDirty() {
350655
350674
  this.dirty = true;
@@ -350689,7 +350708,9 @@ class RepoMap {
350689
350708
  const content = readFileSync17(join26(this.cwd, file2.path), "utf-8");
350690
350709
  fileContents.set(file2.id, content.split(`
350691
350710
  `));
350692
- } catch {}
350711
+ } catch (e) {
350712
+ this.onError?.(`failed to read ${file2.path} for call graph: ${e instanceof Error ? e.message : String(e)}`);
350713
+ }
350693
350714
  if (i2 % 20 === 19)
350694
350715
  await tick();
350695
350716
  }
@@ -352097,7 +352118,9 @@ class RepoMap {
352097
352118
  if (this.flushPromise) {
352098
352119
  try {
352099
352120
  await this.flushPromise;
352100
- } catch {}
352121
+ } catch (e) {
352122
+ this.onError?.(`error awaiting pending flush during close: ${e instanceof Error ? e.message : String(e)}`);
352123
+ }
352101
352124
  }
352102
352125
  this.db.close();
352103
352126
  }
@@ -379599,8 +379622,20 @@ async function repairToolCall({
379599
379622
  input: repaired
379600
379623
  };
379601
379624
  }
379625
+ function isAbnormalFinish(reason) {
379626
+ return reason === "length" || reason === "content-filter" || reason === "error";
379627
+ }
379628
+ function describeAbnormalFinish(reason) {
379629
+ if (reason === "length")
379630
+ return `Model output truncated at ${MAX_OUTPUT_TOKENS} tokens (finish_reason=length). Set SOULFORGE_MAX_OUTPUT_TOKENS to raise the cap.`;
379631
+ if (reason === "content-filter")
379632
+ return "Model response blocked by content filter (finish_reason=content-filter).";
379633
+ return "Model returned finish_reason=error.";
379634
+ }
379635
+ var MAX_OUTPUT_TOKENS;
379602
379636
  var init_stream_options = __esm(() => {
379603
379637
  init_esm11();
379638
+ MAX_OUTPUT_TOKENS = Number(process.env.SOULFORGE_MAX_OUTPUT_TOKENS) || 32000;
379604
379639
  });
379605
379640
 
379606
379641
  // src/core/agents/web-search.ts
@@ -379617,6 +379652,12 @@ function createWebSearchAgent(model, opts) {
379617
379652
  ...supportsTemperature(getModelId(model)) ? {
379618
379653
  temperature: 0
379619
379654
  } : {},
379655
+ maxOutputTokens: MAX_OUTPUT_TOKENS,
379656
+ onStepFinish: (step) => {
379657
+ if (isAbnormalFinish(step.finishReason)) {
379658
+ logBackgroundError("agent-error", `web-search: ${describeAbnormalFinish(step.finishReason)}`);
379659
+ }
379660
+ },
379620
379661
  tools: {
379621
379662
  web_search: tool({
379622
379663
  description: webSearchScraper.description,
@@ -379672,6 +379713,7 @@ var init_web_search = __esm(() => {
379672
379713
  init_dist5();
379673
379714
  init_zod();
379674
379715
  init_config2();
379716
+ init_errors();
379675
379717
  init_provider_options();
379676
379718
  init_settings();
379677
379719
  init_fetch_page();
@@ -379853,72 +379895,21 @@ var init_web_search2 = __esm(() => {
379853
379895
  // src/core/tools/bus-cache.ts
379854
379896
  import { readFile as readFileAsync } from "fs/promises";
379855
379897
  import { resolve as resolve35 } from "path";
379856
- function wrapWithBusCache(tools, bus, agentId, repoMap) {
379898
+ function wrapWithBusCache(tools, bus, agentId) {
379857
379899
  const wrapped = {
379858
379900
  ...tools
379859
379901
  };
379860
- const CACHE_HIT_LINES_THRESHOLD = 80;
379861
- async function tagCacheHit(result, path) {
379862
- const text2 = typeof result === "string" ? result : String(result?.output ?? "");
379863
- const lineCount2 = text2.split(`
379864
- `).length;
379865
- if (lineCount2 < CACHE_HIT_LINES_THRESHOLD)
379866
- return result;
379867
- let symbols = [];
379868
- if (repoMap) {
379869
- try {
379870
- symbols = (await repoMap.getFileSymbolRanges(path)).map((s) => ({
379871
- name: s.qualifiedName ?? s.name,
379872
- kind: s.kind,
379873
- line: s.line,
379874
- endLine: s.endLine
379875
- }));
379876
- } catch {}
379877
- }
379878
- if (symbols.length === 0) {
379879
- const tag = "[Cached]";
379880
- if (typeof result === "string")
379881
- return `${tag}
379882
- ${result}`;
379883
- if (result && typeof result === "object" && "output" in result) {
379884
- return {
379885
- ...result,
379886
- output: `${tag}
379887
- ${text2}`
379888
- };
379889
- }
379890
- return result;
379891
- }
379892
- const top = symbols.slice(0, 12);
379893
- const symbolHint = `Exported symbols: ${top.map((s) => `${s.name} (${s.kind} :${String(s.line)}-${String(s.endLine ?? s.line)})`).join(", ")}${symbols.length > 12 ? `, +${String(symbols.length - 12)} more` : ""}`;
379894
- const stub = [`[Cached \u2014 ${String(lineCount2)} lines, already read by another agent]`, symbolHint, `Use read(files=[{path:"${path}", target, name}]) for symbols, or ranges:[{start:N, end:M}] for sections.`, `Use check_findings to see what peer agents found in this file.`].join(`
379895
- `);
379896
- if (result && typeof result === "object") {
379897
- return {
379898
- ...result,
379899
- output: stub
379900
- };
379901
- }
379902
- return {
379903
- success: true,
379904
- output: stub
379905
- };
379906
- }
379907
- function makeCachedExecute(origExecute, keyFn, onExecute) {
379902
+ function makeCachedExecute(origExecute, keyFn) {
379908
379903
  return async (args2, opts) => {
379909
379904
  const key2 = keyFn(args2);
379910
379905
  if (key2) {
379911
379906
  const acquired = bus.acquireToolResult(agentId, key2);
379912
- if (acquired.hit === true) {
379913
- onExecute?.(args2, true);
379907
+ if (acquired.hit === true)
379914
379908
  return acquired.result;
379915
- }
379916
379909
  if (acquired.hit === "waiting") {
379917
379910
  const waited = await acquired.result;
379918
- if (waited != null) {
379919
- onExecute?.(args2, true);
379911
+ if (waited != null)
379920
379912
  return waited;
379921
- }
379922
379913
  }
379923
379914
  }
379924
379915
  const result = await origExecute(args2, opts);
@@ -379926,64 +379917,60 @@ ${text2}`
379926
379917
  const content = typeof result === "string" ? result : typeof result?.output === "string" ? String(result.output) : JSON.stringify(result);
379927
379918
  bus.cacheToolResult(agentId, key2, content);
379928
379919
  }
379929
- onExecute?.(args2, false);
379930
379920
  return result;
379931
379921
  };
379932
379922
  }
379933
379923
  const readFile19 = tools.read;
379934
379924
  if (readFile19?.execute) {
379935
379925
  const origExecute = readFile19.execute;
379926
+ const collectPaths = (args2) => {
379927
+ if (Array.isArray(args2.files))
379928
+ return args2.files;
379929
+ if (args2.files && typeof args2.files === "object")
379930
+ return [args2.files];
379931
+ if (typeof args2.path === "string") {
379932
+ return [{
379933
+ path: args2.path,
379934
+ ...args2.startLine != null || args2.endLine != null ? {
379935
+ ranges: [{
379936
+ start: args2.startLine ?? 1,
379937
+ end: args2.endLine ?? 0
379938
+ }]
379939
+ } : {}
379940
+ }];
379941
+ }
379942
+ return [];
379943
+ };
379936
379944
  wrapped.read = deriveTool(readFile19, {
379937
379945
  execute: async (args2, opts) => {
379938
- const normalized = normalizePath(args2.path);
379939
- if (args2.startLine != null || args2.endLine != null) {
379940
- const result = await origExecute(args2, opts);
379941
- bus.recordFileRead(agentId, normalized, {
379942
- tool: "read",
379943
- startLine: args2.startLine,
379944
- endLine: args2.endLine,
379945
- cached: false
379946
- });
379947
- return result;
379948
- }
379949
- const acquired = bus.acquireFileRead(agentId, normalized);
379950
- if (acquired.cached === "waiting") {
379951
- const content = await acquired.content;
379952
- if (content != null) {
379946
+ const result = await origExecute(args2, opts);
379947
+ for (const spec3 of collectPaths(args2)) {
379948
+ if (!spec3?.path)
379949
+ continue;
379950
+ const normalized = normalizePath(spec3.path);
379951
+ if (!normalized)
379952
+ continue;
379953
+ if (spec3.ranges && spec3.ranges.length > 0) {
379954
+ for (const r of spec3.ranges) {
379955
+ bus.recordFileRead(agentId, normalized, {
379956
+ tool: "read",
379957
+ startLine: r.start,
379958
+ endLine: r.end,
379959
+ cached: false
379960
+ });
379961
+ }
379962
+ } else {
379953
379963
  bus.recordFileRead(agentId, normalized, {
379954
379964
  tool: "read",
379955
- cached: true
379965
+ ...spec3.target ? {
379966
+ target: spec3.target,
379967
+ name: spec3.name
379968
+ } : {},
379969
+ cached: false
379956
379970
  });
379957
- return tagCacheHit(content, normalized);
379958
- }
379959
- }
379960
- const peerAlreadyRead = acquired.cached === true;
379961
- const gen = acquired.cached === false ? acquired.gen : -1;
379962
- try {
379963
- const result = await origExecute(args2, opts);
379964
- const isOutline = result && typeof result === "object" && result.outlineOnly === true;
379965
- if (isOutline) {
379966
- if (gen >= 0)
379967
- bus.failFileRead(normalized, gen);
379968
- return result;
379969
- }
379970
- if (gen >= 0) {
379971
- const rawText = typeof result === "string" ? result : typeof result?.output === "string" ? String(result.output) : JSON.stringify(result);
379972
- bus.releaseFileRead(normalized, rawText, gen);
379973
379971
  }
379974
- bus.recordFileRead(agentId, normalized, {
379975
- tool: "read",
379976
- cached: false
379977
- });
379978
- if (peerAlreadyRead) {
379979
- return tagCacheHit(result, normalized);
379980
- }
379981
- return result;
379982
- } catch (error48) {
379983
- if (gen >= 0)
379984
- bus.failFileRead(normalized, gen);
379985
- throw error48;
379986
379972
  }
379973
+ return result;
379987
379974
  }
379988
379975
  });
379989
379976
  }
@@ -380109,7 +380096,7 @@ ${text2}`;
380109
380096
  const t = tools[spec3.name];
380110
380097
  if (t?.execute) {
380111
380098
  wrapped[spec3.name] = deriveTool(t, {
380112
- execute: makeCachedExecute(t.execute, spec3.keyFn, spec3.onExecute)
380099
+ execute: makeCachedExecute(t.execute, spec3.keyFn)
380113
380100
  });
380114
380101
  }
380115
380102
  }
@@ -382436,9 +382423,6 @@ function buildPrepareStep({
382436
382423
  }
382437
382424
  if (sanitizedMessages)
382438
382425
  result.messages = sanitizedMessages;
382439
- if (stepNumber === 0) {
382440
- result.toolChoice = "required";
382441
- }
382442
382426
  if (!disablePruning && stepNumber >= 2) {
382443
382427
  const src = result.messages ?? messages;
382444
382428
  const compacted = compactOldToolResults(src, symbolLookup);
@@ -382719,7 +382703,7 @@ function createCodeAgent(model, options) {
382719
382703
  repoMap: options?.repoMap
382720
382704
  });
382721
382705
  if (hasBus) {
382722
- tools = wrapWithBusCache(tools, bus, agentId, options?.repoMap);
382706
+ tools = wrapWithBusCache(tools, bus, agentId);
382723
382707
  }
382724
382708
  allTools = {
382725
382709
  ...tools,
@@ -382752,6 +382736,12 @@ function createCodeAgent(model, options) {
382752
382736
  ...supportsTemperature(getModelId(model)) ? {
382753
382737
  temperature: 0
382754
382738
  } : {},
382739
+ maxOutputTokens: MAX_OUTPUT_TOKENS,
382740
+ onStepFinish: (step) => {
382741
+ if (isAbnormalFinish(step.finishReason)) {
382742
+ logBackgroundError("agent-error", `${options?.agentId ?? "code"}: ${describeAbnormalFinish(step.finishReason)}`);
382743
+ }
382744
+ },
382755
382745
  tools: allTools,
382756
382746
  instructions: {
382757
382747
  role: "system",
@@ -382786,6 +382776,7 @@ Coordination: report_finding after significant changes (paths, what changed, new
382786
382776
  var init_code = __esm(() => {
382787
382777
  init_dist5();
382788
382778
  init_config2();
382779
+ init_errors();
382789
382780
  init_provider_options();
382790
382781
  init_settings();
382791
382782
  init_tools();
@@ -382840,7 +382831,7 @@ function createExploreAgent(model, options) {
382840
382831
  tabId: options?.tabId
382841
382832
  });
382842
382833
  if (hasBus) {
382843
- tools = wrapWithBusCache(tools, bus, agentId, options?.repoMap);
382834
+ tools = wrapWithBusCache(tools, bus, agentId);
382844
382835
  }
382845
382836
  allTools = {
382846
382837
  ...tools,
@@ -382873,6 +382864,12 @@ function createExploreAgent(model, options) {
382873
382864
  ...supportsTemperature(getModelId(model)) ? {
382874
382865
  temperature: 0
382875
382866
  } : {},
382867
+ maxOutputTokens: MAX_OUTPUT_TOKENS,
382868
+ onStepFinish: (step) => {
382869
+ if (isAbnormalFinish(step.finishReason)) {
382870
+ logBackgroundError("agent-error", `${options?.agentId ?? "explore"}: ${describeAbnormalFinish(step.finishReason)}`);
382871
+ }
382872
+ },
382876
382873
  tools: allTools,
382877
382874
  instructions: {
382878
382875
  role: "system",
@@ -382905,6 +382902,7 @@ Coordination: report_finding after discoveries \u2014 especially shared symbols/
382905
382902
  var init_explore = __esm(() => {
382906
382903
  init_dist5();
382907
382904
  init_config2();
382905
+ init_errors();
382908
382906
  init_provider_options();
382909
382907
  init_settings();
382910
382908
  init_tools();
@@ -386905,147 +386903,42 @@ var init_mcp2 = __esm(() => {
386905
386903
  // src/core/agents/agent-results.ts
386906
386904
  import { mkdir as mkdir8, readdir as readdir6, rm as rm2, writeFile as writeFile15 } from "fs/promises";
386907
386905
  import { join as join35 } from "path";
386908
- function extractPathFromArgs(args2) {
386909
- if (!args2)
386910
- return;
386911
- const p = args2.path ?? args2.file ?? args2.filePath;
386912
- return typeof p === "string" ? p : undefined;
386913
- }
386914
- function extractText2(raw) {
386915
- if (!raw)
386916
- return "";
386917
- if (typeof raw === "string") {
386918
- try {
386919
- const parsed = JSON.parse(raw);
386920
- if (typeof parsed.output === "string")
386921
- return parsed.output;
386922
- } catch {}
386923
- return raw;
386924
- }
386925
- if (typeof raw === "object" && raw !== null) {
386926
- const obj = raw;
386927
- if (typeof obj.output === "string")
386928
- return obj.output;
386929
- if (typeof obj.value === "string")
386930
- return obj.value;
386931
- }
386932
- return String(raw);
386933
- }
386934
- function isStub(text2) {
386935
- return STUB_PATTERNS.some((p) => text2.startsWith(p) || text2.includes(p));
386936
- }
386937
386906
  function extractFinalText(result) {
386938
- const lastStep = result.steps[result.steps.length - 1];
386939
- const lastText = lastStep?.text?.trim();
386940
- if (lastText && lastText.length > 10)
386941
- return lastText;
386942
- return typeof result.text === "string" ? result.text.trim() : "";
386943
- }
386944
- function synthesizeDoneFromResults(result, agentFindings, task) {
386945
- const filesRead = new Set;
386946
- const filesEdited = new Set;
386947
- const keyFindings = [];
386948
- let budget = SYNTHESIS_BUDGET;
386949
- for (const f of agentFindings) {
386950
- if (budget <= 0)
386951
- break;
386952
- const detail = f.content.slice(0, budget);
386953
- keyFindings.push({
386954
- file: f.label,
386955
- detail
386956
- });
386957
- budget -= detail.length + BUDGET_OVERHEAD;
386958
- }
386959
- for (const step of result.steps) {
386960
- for (const tc of step.toolCalls ?? []) {
386961
- const args2 = tc.args;
386962
- const path = extractPathFromArgs(args2);
386963
- if (path) {
386964
- if (READ_TOOLS.has(tc.toolName) || SEARCH_TOOLS.has(tc.toolName))
386965
- filesRead.add(path);
386966
- if (EDIT_TOOLS2.has(tc.toolName))
386967
- filesEdited.add(path);
386968
- }
386969
- }
386970
- }
386971
- const seenFiles = new Set(keyFindings.map((kf) => kf.file));
386972
- for (const step of result.steps) {
386973
- if (budget <= 0)
386974
- break;
386975
- for (const tr of step.toolResults ?? []) {
386976
- if (budget <= 0)
386977
- break;
386978
- if (!READ_TOOLS.has(tr.toolName) && !SEARCH_TOOLS.has(tr.toolName))
386979
- continue;
386980
- const input = tr.input;
386981
- const filePath = extractPathFromArgs(input) ?? tr.toolName;
386982
- if (seenFiles.has(filePath))
386983
- continue;
386984
- const text3 = extractText2(tr.output);
386985
- if (text3.length < MIN_CONTENT_LEN || isStub(text3))
386986
- continue;
386987
- seenFiles.add(filePath);
386988
- const capped = text3.slice(0, Math.min(PER_FILE_CONTENT_CAP, budget));
386989
- keyFindings.push({
386990
- file: filePath,
386991
- detail: capped
386992
- });
386993
- budget -= capped.length + BUDGET_OVERHEAD;
386907
+ for (let i2 = result.steps.length - 1;i2 >= 0; i2--) {
386908
+ const step = result.steps[i2];
386909
+ if (!step)
386910
+ continue;
386911
+ const direct = step.text?.trim();
386912
+ if (direct && direct.length > 0)
386913
+ return direct;
386914
+ if (step.content && Array.isArray(step.content)) {
386915
+ const textParts = step.content.filter((p) => p.type === "text" && typeof p.text === "string").map((p) => (p.text ?? "").trim()).filter((t) => t.length > 0);
386916
+ if (textParts.length > 0)
386917
+ return textParts.join(`
386918
+ `);
386994
386919
  }
386995
386920
  }
386996
- if (keyFindings.length === 0) {
386997
- const allFiles = [...filesRead, ...filesEdited];
386998
- keyFindings.push({
386999
- file: allFiles[0] ?? task.task.slice(0, 80),
387000
- detail: allFiles.length > 0 ? `Examined ${String(allFiles.length)} files: ${allFiles.join(", ")}` : `No tool results captured for: ${task.task.slice(0, 200)}`
387001
- });
387002
- }
387003
- const text2 = result.text.trim();
387004
- const summary = text2.length > 10 ? text2 : `Examined ${String(filesRead.size)} files for: ${task.task.slice(0, 100)}`;
387005
- return {
387006
- summary,
387007
- filesExamined: [...filesRead],
387008
- ...filesEdited.size > 0 ? {
387009
- filesEdited: [...filesEdited].map((f) => ({
387010
- file: f,
387011
- changes: "edited"
387012
- }))
387013
- } : {},
387014
- keyFindings
387015
- };
386921
+ return typeof result.text === "string" ? result.text.trim() : "";
387016
386922
  }
387017
- function formatDoneResult(done) {
387018
- const parts2 = [done.summary];
387019
- if (done.filesEdited && done.filesEdited.length > 0) {
387020
- parts2.push(`
387021
- Files edited:`, ...done.filesEdited.map((f) => ` ${f.file}: ${f.changes}`));
387022
- }
387023
- if (done.filesExamined && done.filesExamined.length > 0) {
387024
- parts2.push(`
387025
- Files examined: ${done.filesExamined.join(", ")}`);
387026
- }
387027
- if (done.keyFindings && done.keyFindings.length > 0) {
387028
- parts2.push(`
387029
- Key findings:`, ...done.keyFindings.map((f) => {
387030
- const loc = f.lineNumbers ? `:${f.lineNumbers}` : "";
387031
- return ` ${f.file}${loc}: ${f.detail}`;
387032
- }));
387033
- }
387034
- if (done.gaps && done.gaps.length > 0) {
387035
- parts2.push(`
387036
- Gaps:`, ...done.gaps.map((g) => ` - ${g}`));
387037
- }
387038
- if (done.connections && done.connections.length > 0) {
387039
- parts2.push(`
387040
- Connections:`, ...done.connections.map((c) => ` - ${c}`));
387041
- }
387042
- if (done.verified != null) {
387043
- parts2.push(`
387044
- Verified: ${done.verified ? "yes" : "no"}`);
387045
- if (done.verificationOutput)
387046
- parts2.push(done.verificationOutput);
387047
- }
387048
- return parts2.join(`
386923
+ function truncateAgentText(text2, archivePath) {
386924
+ if (text2.length <= TRUNCATE_THRESHOLD)
386925
+ return text2;
386926
+ const head = text2.slice(0, HEAD_CHARS);
386927
+ const tail = text2.slice(-TAIL_CHARS);
386928
+ const footer = archivePath ? `
386929
+ \u2026 [truncated, full output: ${archivePath}]
386930
+ ` : `
386931
+ \u2026 [truncated]
386932
+ `;
386933
+ return `${head}${footer}${tail}`;
386934
+ }
386935
+ function busFooter(filesExamined, filesEdited) {
386936
+ const lines = [];
386937
+ if (filesExamined.length > 0)
386938
+ lines.push(`Files examined: ${filesExamined.join(", ")}`);
386939
+ if (filesEdited.length > 0)
386940
+ lines.push(`Files edited: ${filesEdited.join(", ")}`);
386941
+ return lines.join(`
387049
386942
  `);
387050
386943
  }
387051
386944
  async function writeAgentContext(dispatchId, agentId, task, agentResult, findings, agentText, cwd2, tabId) {
@@ -387061,7 +386954,7 @@ async function writeAgentContext(dispatchId, agentId, task, agentResult, finding
387061
386954
  const toolStubs = [];
387062
386955
  for (const step of agentResult.steps) {
387063
386956
  for (const tc of step.toolCalls ?? []) {
387064
- const args2 = tc.args;
386957
+ const args2 = tc.args ?? tc.input;
387065
386958
  const name39 = tc.toolName;
387066
386959
  if (name39 === "read") {
387067
386960
  const path = args2?.path ?? args2?.file ?? "";
@@ -387101,7 +386994,7 @@ async function writeAgentContext(dispatchId, agentId, task, agentResult, finding
387101
386994
  }
387102
386995
  if (agentText.trim()) {
387103
386996
  lines.push("## Agent Summary");
387104
- lines.push(agentText.trim().slice(0, 4000));
386997
+ lines.push(agentText.trim());
387105
386998
  lines.push("");
387106
386999
  }
387107
387000
  await writeFile15(filePath, lines.join(`
@@ -387125,13 +387018,8 @@ async function cleanupDispatchDir(cwd2, tabId, keepDispatchId) {
387125
387018
  function dispatchDir(cwd2, tabId, dispatchId) {
387126
387019
  return join35(cwd2, ".soulforge", "dispatch", `tab-${tabId}`, dispatchId);
387127
387020
  }
387128
- var PER_FILE_CONTENT_CAP = 4000, SYNTHESIS_BUDGET = 6000, BUDGET_OVERHEAD = 50, MIN_CONTENT_LEN = 20, READ_TOOLS, EDIT_TOOLS2, SEARCH_TOOLS, STUB_PATTERNS;
387129
- var init_agent_results = __esm(() => {
387130
- READ_TOOLS = new Set(["read", "navigate", "soul_analyze"]);
387131
- EDIT_TOOLS2 = new Set(["edit_file", "write_file", "create_file"]);
387132
- SEARCH_TOOLS = new Set(["grep", "glob", "soul_grep", "soul_find", "soul_impact"]);
387133
- STUB_PATTERNS = ["[Already in your context", "\u2190 file was edited", "\u2190", "[cached]"];
387134
- });
387021
+ var TRUNCATE_THRESHOLD = 4000, HEAD_CHARS = 2000, TAIL_CHARS = 1000;
387022
+ var init_agent_results = () => {};
387135
387023
 
387136
387024
  // src/core/agents/agent-runner.ts
387137
387025
  function getMaxConcurrentAgents() {
@@ -387245,23 +387133,6 @@ function stripContextManagement(opts) {
387245
387133
  }
387246
387134
  return changed ? out2 : opts;
387247
387135
  }
387248
- function stripMismatchedProviderOptions(opts, modelId) {
387249
- if (!opts)
387250
- return opts;
387251
- const family = detectModelFamily(modelId);
387252
- const allowedKeys = FAMILY_TO_KEYS[family];
387253
- if (!allowedKeys)
387254
- return;
387255
- const out2 = {};
387256
- let kept = 0;
387257
- for (const [key2, val] of Object.entries(opts)) {
387258
- if (allowedKeys.has(key2)) {
387259
- out2[key2] = val;
387260
- kept++;
387261
- }
387262
- }
387263
- return kept > 0 ? out2 : undefined;
387264
- }
387265
387136
  async function runAgentTask(task, models, bus, parentToolCallId, totalAgents, abortSignal) {
387266
387137
  if (task.dependsOn && task.dependsOn.length > 0) {
387267
387138
  try {
@@ -387481,20 +387352,20 @@ ${enrichedPrompt}`;
387481
387352
  const agentFindings2 = bus.getFindings().filter((f) => f.agentId === task.agentId);
387482
387353
  let doneResult2 = null;
387483
387354
  const agentText = extractFinalText(result);
387484
- if (agentText.length > 50) {
387355
+ if (agentText.length > 0) {
387485
387356
  doneResult2 = {
387486
387357
  summary: agentText
387487
387358
  };
387488
387359
  } else {
387489
- doneResult2 = synthesizeDoneFromResults(result, agentFindings2, task);
387490
- if (result.steps.length === 0) {
387491
- const busReads = bus.getFileReadRecords(task.agentId);
387492
- if (busReads.length > 0 && doneResult2.filesExamined?.length === 0) {
387493
- doneResult2.filesExamined = busReads.map((r) => r.path);
387494
- }
387495
- }
387360
+ const busReads = bus.getFileReadRecords(task.agentId);
387361
+ const readPaths = [...new Set(busReads.map((r) => r.path))];
387362
+ const editPaths = [...bus.getEditedFiles(task.agentId).keys()];
387363
+ const fallback = busFooter(readPaths, editPaths);
387364
+ doneResult2 = {
387365
+ summary: fallback || `No output from agent for: ${task.task.slice(0, 200)}`
387366
+ };
387496
387367
  }
387497
- const hasResult = !!doneResult2 && (doneResult2.summary?.length ?? 0) > 10;
387368
+ const hasResult = !!doneResult2 && (doneResult2.summary?.length ?? 0) > 0;
387498
387369
  const codeEdited = task.role !== "code" || task.agentId === "desloppify" || bus.getEditedFiles(task.agentId).size > 0;
387499
387370
  let succeeded = hasResult && codeEdited;
387500
387371
  if (!succeeded && task.role === "code" && attempt === 0 && task.agentId !== "desloppify") {
@@ -387555,10 +387426,16 @@ ${task.task}`;
387555
387426
  const retryEdits = bus.getEditedFiles(task.agentId);
387556
387427
  if (retryEdits.size > 0) {
387557
387428
  const retryText = extractFinalText(retryResult);
387558
- const retryDone = retryText.length > 50 ? {
387559
- summary: retryText
387560
- } : synthesizeDoneFromResults(retryResult, bus.getFindings().filter((f) => f.agentId === task.agentId), task);
387561
- doneResult2 = retryDone;
387429
+ if (retryText.length > 0) {
387430
+ doneResult2 = {
387431
+ summary: retryText
387432
+ };
387433
+ } else {
387434
+ const editPaths = [...retryEdits.keys()];
387435
+ doneResult2 = {
387436
+ summary: busFooter([], editPaths) || `Retry edited ${String(editPaths.length)} file(s)`
387437
+ };
387438
+ }
387562
387439
  succeeded = true;
387563
387440
  input += retryCallbacks._acc.input || (retryResult.totalUsage?.inputTokens ?? 0);
387564
387441
  output += retryCallbacks._acc.output || (retryResult.totalUsage?.outputTokens ?? 0);
@@ -387572,7 +387449,18 @@ ${task.task}`;
387572
387449
  }
387573
387450
  }
387574
387451
  }
387575
- const resultText = formatDoneResult(doneResult2);
387452
+ const busReadPaths = [...new Set(bus.getFileReadRecords(task.agentId).map((r) => r.path))];
387453
+ const busEditPaths = [...bus.getEditedFiles(task.agentId).keys()];
387454
+ const footer = busFooter(busReadPaths, busEditPaths);
387455
+ const fullText = footer ? `${doneResult2.summary}
387456
+
387457
+ ${footer}` : doneResult2.summary;
387458
+ let archivePath;
387459
+ try {
387460
+ archivePath = await writeAgentContext(parentToolCallId, task.agentId, task, result, agentFindings2, doneResult2.summary, process.cwd(), task.tabId);
387461
+ } catch {}
387462
+ const resultText = truncateAgentText(fullText, archivePath);
387463
+ doneResult2.archivePath = archivePath;
387576
387464
  let editVerificationWarning;
387577
387465
  if (task.role === "code" && succeeded) {
387578
387466
  const editedFiles = bus.getEditedFiles(task.agentId);
@@ -387610,7 +387498,6 @@ ${task.task}`;
387610
387498
  success: true
387611
387499
  };
387612
387500
  bus.setResult(agentResult2);
387613
- autoPostCompletionSummary(bus, task);
387614
387501
  emitMultiAgentEvent({
387615
387502
  parentToolCallId,
387616
387503
  type: "agent-done",
@@ -387651,10 +387538,6 @@ ${task.task}`;
387651
387538
  tabId: task.tabId
387652
387539
  });
387653
387540
  }
387654
- try {
387655
- const agentText2 = extractFinalText(result);
387656
- await writeAgentContext(parentToolCallId, task.agentId, task, result, agentFindings2, agentText2, process.cwd(), task.tabId);
387657
- } catch {}
387658
387541
  return {
387659
387542
  doneResult: doneResult2,
387660
387543
  resultText,
@@ -387727,18 +387610,7 @@ ${task.task}`;
387727
387610
  });
387728
387611
  }
387729
387612
  const doneResult = salvaged ? {
387730
- summary: `Partial result (agent errored): ${errMsg.slice(0, 200)}`,
387731
- filesExamined: agentReads.map((r) => r.path),
387732
- ...agentEdits.length > 0 ? {
387733
- filesEdited: agentEdits.map((f) => ({
387734
- file: f,
387735
- changes: "edited"
387736
- }))
387737
- } : {},
387738
- keyFindings: agentFindings.map((f) => ({
387739
- file: f.label,
387740
- detail: f.content
387741
- }))
387613
+ summary: errorResultText
387742
387614
  } : null;
387743
387615
  return {
387744
387616
  doneResult,
@@ -387747,12 +387619,11 @@ ${task.task}`;
387747
387619
  result: agentResult
387748
387620
  };
387749
387621
  }
387750
- var MAX_NO_EDIT_RETRIES = 1, DEFAULT_MAX_CONCURRENT_AGENTS = 3, RETRY_JITTER_MS = 1000, RETURN_FORMAT_INSTRUCTIONS, CONNECTION_ERROR_RE, PROXY_BOUNCE_TIMEOUT_MS = 8000, FAMILY_TO_KEYS;
387622
+ var MAX_NO_EDIT_RETRIES = 1, DEFAULT_MAX_CONCURRENT_AGENTS = 3, RETRY_JITTER_MS = 1000, RETURN_FORMAT_INSTRUCTIONS, CONNECTION_ERROR_RE, PROXY_BOUNCE_TIMEOUT_MS = 8000;
387751
387623
  var init_agent_runner = __esm(() => {
387752
387624
  init_dist5();
387753
387625
  init_errors();
387754
387626
  init_provider();
387755
- init_provider_options();
387756
387627
  init_lifecycle();
387757
387628
  init_task_list();
387758
387629
  init_agent_bus();
@@ -387772,11 +387643,6 @@ var init_agent_runner = __esm(() => {
387772
387643
  verdict: "Return a clear yes/no answer with a brief justification (1-3 sentences). " + "No code blocks unless they directly support the verdict."
387773
387644
  };
387774
387645
  CONNECTION_ERROR_RE = /cannot connect|unable to connect|fetch failed|failed to fetch|socket hang up|econnreset|econnrefused|enotfound|eai_again|network error|stream (?:error|closed)|premature close|terminated|connection (?:error|reset|refused|closed)/i;
387775
- FAMILY_TO_KEYS = {
387776
- claude: new Set(["anthropic", "proxy", "llmgateway", "openrouter", "vercel_gateway"]),
387777
- openai: new Set(["openai", "proxy", "llmgateway", "openrouter", "vercel_gateway"]),
387778
- google: new Set(["google", "proxy", "llmgateway", "openrouter", "vercel_gateway"])
387779
- };
387780
387646
  });
387781
387647
 
387782
387648
  // src/core/agents/agent-verification.ts
@@ -387828,7 +387694,8 @@ ${editedPaths.map((p) => `- ${p}`).join(`
387828
387694
  resultText
387829
387695
  } = await runAgentTask(desloppifyTask, {
387830
387696
  ...models,
387831
- emberModel: models.desloppifyModel
387697
+ emberModel: models.desloppifyModel,
387698
+ parentMessagesRef: undefined
387832
387699
  }, bus, parentToolCallId, tasks.length + 1, abortSignal);
387833
387700
  return resultText.length > 20 ? `
387834
387701
 
@@ -387903,7 +387770,8 @@ ${test2.output.slice(-500)}`);
387903
387770
  resultText
387904
387771
  } = await runAgentTask(verifyTask, {
387905
387772
  ...models,
387906
- sparkModel: reviewModel
387773
+ sparkModel: reviewModel,
387774
+ parentMessagesRef: undefined
387907
387775
  }, bus, parentToolCallId, tasks.length + 1, abortSignal);
387908
387776
  return `
387909
387777
 
@@ -388049,6 +387917,9 @@ function buildStepCallbacks(parentToolCallId, agentId, modelId) {
388049
387917
  },
388050
387918
  onStepFinish: (step) => {
388051
387919
  steps.push(step);
387920
+ if (isAbnormalFinish(step.finishReason)) {
387921
+ logBackgroundError("agent-error", `${agentId ?? "subagent"}: ${describeAbnormalFinish(step.finishReason)}`);
387922
+ }
388052
387923
  acc.stepCount++;
388053
387924
  acc.toolUses += step.toolCalls?.length ?? 0;
388054
387925
  acc.input += step.usage?.inputTokens ?? 0;
@@ -388076,26 +387947,6 @@ function buildStepCallbacks(parentToolCallId, agentId, modelId) {
388076
387947
  _steps: steps
388077
387948
  };
388078
387949
  }
388079
- function autoPostCompletionSummary(bus, task) {
388080
- const readMap = bus.getFilesRead(task.agentId);
388081
- const readFiles = readMap.get(task.agentId) ?? [];
388082
- const editedMap = bus.getEditedFiles(task.agentId);
388083
- const editedFiles = [...editedMap.keys()];
388084
- if (readFiles.length === 0 && editedFiles.length === 0)
388085
- return;
388086
- const parts2 = [];
388087
- if (readFiles.length > 0)
388088
- parts2.push(`Read: ${readFiles.join(", ")}`);
388089
- if (editedFiles.length > 0)
388090
- parts2.push(`Edited: ${editedFiles.join(", ")}`);
388091
- bus.postFinding({
388092
- agentId: task.agentId,
388093
- label: `${task.agentId} completed \u2014 ${String(readFiles.length)} files read, ${String(editedFiles.length)} edited`,
388094
- content: parts2.join(`
388095
- `),
388096
- timestamp: Date.now()
388097
- });
388098
- }
388099
387950
  async function createAgent(task, models, bus, parentToolCallId) {
388100
387951
  const useExplore = task.role === "explore" || task.role === "investigate" || models.readOnly === true;
388101
387952
  const {
@@ -388104,26 +387955,25 @@ async function createAgent(task, models, bus, parentToolCallId) {
388104
387955
  const tier = classifyTask(task, models);
388105
387956
  const modelId = typeof model === "object" && "modelId" in model ? String(model.modelId) : "unknown";
388106
387957
  const useSpark = models.forgeInstructions != null && tier === "spark";
388107
- let subagentProviderOptions = stripMismatchedProviderOptions(stripContextManagement(models.providerOptions), modelId);
388108
- if (useExplore && subagentProviderOptions) {
388109
- const patched2 = {};
388110
- for (const [provider, val] of Object.entries(subagentProviderOptions)) {
388111
- if (val && typeof val === "object" && "effort" in val) {
388112
- patched2[provider] = {
388113
- ...val,
388114
- effort: "low"
388115
- };
388116
- } else {
388117
- patched2[provider] = val;
388118
- }
388119
- }
388120
- subagentProviderOptions = patched2;
388121
- }
387958
+ const subagentConfig = loadConfig();
387959
+ const explorePerfOverride = useExplore && subagentConfig.performance?.effort && subagentConfig.performance.effort !== "off" ? {
387960
+ ...subagentConfig,
387961
+ performance: {
387962
+ ...subagentConfig.performance,
387963
+ effort: "low"
387964
+ }
387965
+ } : subagentConfig;
387966
+ const built = await buildProviderOptions(modelId, explorePerfOverride);
387967
+ const subagentProviderOptions = stripContextManagement(built.providerOptions);
388122
387968
  const contextWindow = await getModelContextWindow(modelId);
388123
387969
  const forgeInstructions = useSpark ? models.forgeInstructions : undefined;
388124
387970
  const agentRole = useExplore ? "explore" : "code";
388125
387971
  const stripProgrammatic = !supportsProgrammaticToolCalling(modelId);
388126
- const forgeToolsGuarded = useSpark && models.forgeTools ? guardForgeTools(models.forgeTools, agentRole, stripProgrammatic) : undefined;
387972
+ let forgeToolsGuarded;
387973
+ if (useSpark && models.forgeTools) {
387974
+ const guarded = guardForgeTools(models.forgeTools, agentRole, stripProgrammatic);
387975
+ forgeToolsGuarded = wrapWithBusCache(guarded, bus, task.agentId);
387976
+ }
388127
387977
  const isSoloAgent = task.agentId === "desloppify" || task.agentId === "verifier";
388128
387978
  const opts = {
388129
387979
  bus,
@@ -388722,25 +388572,17 @@ ${body2}
388722
388572
 
388723
388573
  ---`);
388724
388574
  }
388725
- const allGaps = [];
388726
- const allConnections = [];
388575
+ const archivePaths = [];
388727
388576
  for (const [agentId, done] of doneResults) {
388728
- if (done?.gaps)
388729
- allGaps.push(...done.gaps.map((g) => `[${agentId}] ${g}`));
388730
- if (done?.connections)
388731
- allConnections.push(...done.connections.map((c) => `[${agentId}] ${c}`));
388577
+ if (done?.archivePath)
388578
+ archivePaths.push(`- [${agentId}] ${done.archivePath}`);
388732
388579
  }
388733
- if (allGaps.length > 0 || allConnections.length > 0) {
388734
- const crossCut = [`
388735
- ### Cross-Cutting Analysis`];
388736
- if (allGaps.length > 0) {
388737
- crossCut.push("**Gaps:**", ...allGaps.map((g) => `- ${g}`));
388738
- }
388739
- if (allConnections.length > 0) {
388740
- crossCut.push("**Connections:**", ...allConnections.map((c) => `- ${c}`));
388741
- }
388742
- sections.push(crossCut.join(`
388743
- `));
388580
+ if (archivePaths.length > 0) {
388581
+ sections.push(`
388582
+ ### Full agent outputs
388583
+ ${archivePaths.join(`
388584
+ `)}
388585
+ (Read these files for the complete agent text when truncated.)`);
388744
388586
  }
388745
388587
  if (failed.length > 0) {
388746
388588
  sections.push(`
@@ -388804,44 +388646,7 @@ Files: ${String(m.fileHits)} hits, ${String(m.fileWaits)} waits, ${String(m.file
388804
388646
  output
388805
388647
  }) {
388806
388648
  const dispatch2 = output;
388807
- if (typeof dispatch2 === "string") {
388808
- return {
388809
- type: "text",
388810
- value: `<dispatch_result>
388811
- ${dispatch2}
388812
- </dispatch_result>`
388813
- };
388814
- }
388815
- const parts2 = [];
388816
- if (dispatch2.filesEdited.length > 0) {
388817
- parts2.push(`Files edited: ${dispatch2.filesEdited.join(", ")}`);
388818
- }
388819
- const rawText = dispatch2.output;
388820
- const agentSummaries = rawText.match(/### [\u2713\u2717!] Agent: .+[\s\S]*?(?=### [\u2713\u2717!] Agent:|$)/g);
388821
- if (agentSummaries) {
388822
- for (const section of agentSummaries) {
388823
- const headerMatch = section.match(/^### [\u2713\u2717!] Agent: (.+)/);
388824
- const header = headerMatch?.[1]?.trim() ?? "agent";
388825
- const lines = section.split(`
388826
- `).slice(1);
388827
- const summaryLines = [];
388828
- for (const line2 of lines) {
388829
- if (/^(?:Key findings:|Files examined:|Gaps:|Connections:|Verified:)/.test(line2))
388830
- break;
388831
- if (line2.trim())
388832
- summaryLines.push(line2.trim());
388833
- }
388834
- if (summaryLines.length > 0) {
388835
- parts2.push(`[${header}] ${summaryLines.join(" ")}`);
388836
- }
388837
- }
388838
- } else if (rawText.trim()) {
388839
- const text2 = rawText.trim();
388840
- if (text2)
388841
- parts2.push(text2);
388842
- }
388843
- const value = parts2.join(`
388844
- `);
388649
+ const value = typeof dispatch2 === "string" ? dispatch2 : dispatch2.output;
388845
388650
  return {
388846
388651
  type: "text",
388847
388652
  value: `<dispatch_result>
@@ -388856,10 +388661,12 @@ var EXPLORE_BLOCKED, CODE_BLOCKED, PROGRAMMATIC_ONLY_TOOLS, SKILL_TOKEN_RE, SKIL
388856
388661
  var init_subagent_tools = __esm(() => {
388857
388662
  init_dist5();
388858
388663
  init_zod();
388664
+ init_config2();
388859
388665
  init_errors();
388860
388666
  init_WorkspaceCoordinator();
388861
388667
  init_models();
388862
388668
  init_provider_options();
388669
+ init_bus_cache();
388863
388670
  init_task_list();
388864
388671
  init_agent_bus();
388865
388672
  init_agent_results();
@@ -388868,6 +388675,7 @@ var init_subagent_tools = __esm(() => {
388868
388675
  init_code();
388869
388676
  init_explore();
388870
388677
  init_step_utils();
388678
+ init_stream_options();
388871
388679
  init_subagent_events();
388872
388680
  EXPLORE_BLOCKED = new Set(["edit_file", "multi_edit", "write_file", "create_file", "rename_symbol", "move_symbol", "refactor", "dispatch", "shell"]);
388873
388681
  CODE_BLOCKED = new Set(["dispatch"]);
@@ -389415,8 +389223,14 @@ function createForgeAgent({
389415
389223
  ...supportsTemperature(fullModelId ?? getModelId(model)) ? {
389416
389224
  temperature: 0
389417
389225
  } : {},
389226
+ maxOutputTokens: MAX_OUTPUT_TOKENS,
389418
389227
  tools: allTools,
389419
389228
  stopWhen: () => false,
389229
+ onStepFinish: (step) => {
389230
+ if (isAbnormalFinish(step.finishReason)) {
389231
+ logBackgroundError("agent-error", `forge: ${describeAbnormalFinish(step.finishReason)}`);
389232
+ }
389233
+ },
389420
389234
  instructions: isProxyClaude ? undefined : {
389421
389235
  role: "system",
389422
389236
  content: buildInstructions(contextManager, modelId),
@@ -389451,6 +389265,7 @@ var init_forge = __esm(() => {
389451
389265
  init_dist5();
389452
389266
  init_zod();
389453
389267
  init_config2();
389268
+ init_errors();
389454
389269
  init_image_compress();
389455
389270
  init_provider_options();
389456
389271
  init_mcp2();
@@ -404255,7 +404070,9 @@ class ContextManager {
404255
404070
  const store = useRepoMapStore.getState();
404256
404071
  store.setSemanticStatus("generating");
404257
404072
  store.setSemanticProgress(`${String(count)} stale \u2014 regenerating...`);
404258
- this.generateSemanticSummaries(modelId).catch(() => {});
404073
+ this.generateSemanticSummaries(modelId).catch((e) => {
404074
+ logBackgroundError("context-manager", `generateSemanticSummaries failed: ${e instanceof Error ? e.message : String(e)}`);
404075
+ });
404259
404076
  } else {
404260
404077
  const stats = this.repoMap.getStatsCached();
404261
404078
  useRepoMapStore.getState().setSemanticCount(stats.summaries);
@@ -404362,7 +404179,9 @@ class ContextManager {
404362
404179
  if (!this.lastEmittedSoulMapDiff) {
404363
404180
  this.pendingSoulMapDiff = null;
404364
404181
  }
404365
- }).catch(() => {});
404182
+ }).catch((e) => {
404183
+ logBackgroundError("context-manager", `prefetchDiffBlock failed: ${e instanceof Error ? e.message : String(e)}`);
404184
+ });
404366
404185
  }, 300);
404367
404186
  }
404368
404187
  trackMentionedFile(absPath) {
@@ -404425,7 +404244,9 @@ class ContextManager {
404425
404244
  if (this.soulMapSnapshotPaths.size === 0) {
404426
404245
  this.soulMapSnapshotPaths = new Set(result.paths);
404427
404246
  }
404428
- } catch {}
404247
+ } catch (e) {
404248
+ logBackgroundError("context-manager", `warmRepoMapCache failed: ${e instanceof Error ? e.message : String(e)}`);
404249
+ }
404429
404250
  this.repoMapRefreshing = false;
404430
404251
  }
404431
404252
  getRepoMap() {
@@ -405206,6 +405027,7 @@ Project commands: ${parts2.join(" \xB7 ")}` : "";
405206
405027
  var DEFAULT_CONTEXT_WINDOW2 = 200000;
405207
405028
  var init_manager5 = __esm(() => {
405208
405029
  init_dist5();
405030
+ init_errors();
405209
405031
  init_repomap();
405210
405032
  init_neovim();
405211
405033
  init_instance2();
@@ -425191,11 +425013,15 @@ class HearthDaemon {
425191
425013
  if (existsSync35(this.config.daemon.socketPath)) {
425192
425014
  try {
425193
425015
  unlinkSync8(this.config.daemon.socketPath);
425194
- } catch {}
425016
+ } catch (e) {
425017
+ this.log(`failed to remove socket: ${e instanceof Error ? e.message : String(e)}`);
425018
+ }
425195
425019
  }
425196
425020
  try {
425197
425021
  unlinkSync8(DEFAULT_PID_PATH);
425198
- } catch {}
425022
+ } catch (e) {
425023
+ this.log(`failed to remove pidfile: ${e instanceof Error ? e.message : String(e)}`);
425024
+ }
425199
425025
  this.log("hearth stopped");
425200
425026
  }
425201
425027
  getConfig() {
@@ -425351,7 +425177,9 @@ class HearthDaemon {
425351
425177
  if (existsSync35(path)) {
425352
425178
  try {
425353
425179
  unlinkSync8(path);
425354
- } catch {}
425180
+ } catch (e) {
425181
+ this.log(`failed to remove stale socket: ${e instanceof Error ? e.message : String(e)}`);
425182
+ }
425355
425183
  }
425356
425184
  const daemonEuid = typeof process.geteuid === "function" ? process.geteuid() : typeof process.getuid === "function" ? process.getuid() : -1;
425357
425185
  this.socketServer = createServer2((sock) => {
@@ -425389,7 +425217,9 @@ class HearthDaemon {
425389
425217
  server2.listen(path, () => {
425390
425218
  try {
425391
425219
  chmodSync4(path, 384);
425392
- } catch {}
425220
+ } catch (e) {
425221
+ this.log(`failed to chmod socket: ${e instanceof Error ? e.message : String(e)}`);
425222
+ }
425393
425223
  resolve39();
425394
425224
  });
425395
425225
  });
@@ -472428,7 +472258,7 @@ function extractFilesFromToolCalls(msg) {
472428
472258
  edited
472429
472259
  };
472430
472260
  for (const tc of msg.toolCalls) {
472431
- if (EDIT_TOOLS3.has(tc.name) && tc.result?.success) {
472261
+ if (EDIT_TOOLS2.has(tc.name) && tc.result?.success) {
472432
472262
  const p2 = tc.args.path ?? tc.args.file;
472433
472263
  if (typeof p2 === "string")
472434
472264
  edited.push(p2);
@@ -472441,7 +472271,7 @@ function extractFilesFromToolCalls(msg) {
472441
472271
  edited.push(tc.args.path);
472442
472272
  }
472443
472273
  }
472444
- if (READ_TOOLS2.has(tc.name)) {
472274
+ if (READ_TOOLS.has(tc.name)) {
472445
472275
  const p2 = tc.args.path ?? tc.args.file;
472446
472276
  if (typeof p2 === "string")
472447
472277
  read.push(p2);
@@ -472474,14 +472304,14 @@ function emptyTab() {
472474
472304
  function getTab(tabs, tabId) {
472475
472305
  return tabs[tabId] ?? emptyTab();
472476
472306
  }
472477
- var _gitLocks, EDIT_TOOLS3, READ_TOOLS2, useCheckpointStore;
472307
+ var _gitLocks, EDIT_TOOLS2, READ_TOOLS, useCheckpointStore;
472478
472308
  var init_checkpoints = __esm(() => {
472479
472309
  init_esm();
472480
472310
  init_WorkspaceCoordinator();
472481
472311
  init_status();
472482
472312
  _gitLocks = new Map;
472483
- EDIT_TOOLS3 = new Set(["edit_file", "multi_edit", "rename_file", "rename_symbol", "move_symbol", "refactor", "undo_edit"]);
472484
- READ_TOOLS2 = new Set(["Read", "soul_grep", "navigate", "Grep", "Glob", "soul_find", "soul_analyze", "analyze"]);
472313
+ EDIT_TOOLS2 = new Set(["edit_file", "multi_edit", "rename_file", "rename_symbol", "move_symbol", "refactor", "undo_edit"]);
472314
+ READ_TOOLS = new Set(["Read", "soul_grep", "navigate", "Grep", "Glob", "soul_find", "soul_analyze", "analyze"]);
472485
472315
  useCheckpointStore = create()((set3, get) => ({
472486
472316
  tabs: {},
472487
472317
  skipCleanupTabs: new Set,
@@ -474826,9 +474656,17 @@ function handleContextClear(input, ctx) {
474826
474656
  const cleared = ctx.contextManager.clearContext(what);
474827
474657
  sysMsg(ctx, cleared.length > 0 ? `Cleared: ${cleared.join(", ")}` : "Nothing to clear.");
474828
474658
  }
474829
- function handleContext(_input, _ctx) {
474659
+ function handleContext(input, _ctx) {
474660
+ const cmd = input.trim().toLowerCase();
474661
+ const tab = cmd.includes("dispatch") ? "Dispatch" : cmd.includes("system") ? "System" : "Context";
474662
+ useUIStore.setState({
474663
+ statusDashboardTab: tab
474664
+ });
474665
+ useUIStore.getState().openModal("statusDashboard");
474666
+ }
474667
+ function handleDispatchStatus(_input, _ctx) {
474830
474668
  useUIStore.setState({
474831
- statusDashboardTab: "Context"
474669
+ statusDashboardTab: "Dispatch"
474832
474670
  });
474833
474671
  useUIStore.getState().openModal("statusDashboard");
474834
474672
  }
@@ -474843,6 +474681,7 @@ function handleTools(_input, _ctx) {
474843
474681
  }
474844
474682
  function register5(map2) {
474845
474683
  map2.set("/context", handleContext);
474684
+ map2.set("/dispatch-status", handleDispatchStatus);
474846
474685
  map2.set("/memory", handleMemory);
474847
474686
  map2.set("/repo-map", handleRepoMap);
474848
474687
  map2.set("/tools", handleTools);
@@ -477798,6 +477637,7 @@ var init_statusbar = __esm(() => {
477798
477637
  compactionStrategy: "v2",
477799
477638
  v2Slots: 0,
477800
477639
  browsingCheckpoint: false,
477640
+ lastDispatch: null,
477801
477641
  setTokenUsage: (usage, modelId) => set3({
477802
477642
  tokenUsage: usage,
477803
477643
  ...modelId ? {
@@ -477843,6 +477683,57 @@ var init_statusbar = __esm(() => {
477843
477683
  }),
477844
477684
  setBrowsingCheckpoint: (v4) => set3({
477845
477685
  browsingCheckpoint: v4
477686
+ }),
477687
+ startDispatch: (parentToolCallId, totalAgents) => set3({
477688
+ lastDispatch: {
477689
+ parentToolCallId,
477690
+ startedAt: Date.now(),
477691
+ totalAgents,
477692
+ completedAgents: 0,
477693
+ agents: {}
477694
+ }
477695
+ }),
477696
+ upsertDispatchAgent: (parentToolCallId, agent2) => set3((s2) => {
477697
+ const cur = s2.lastDispatch;
477698
+ if (!cur || cur.parentToolCallId !== parentToolCallId)
477699
+ return s2;
477700
+ const prev = cur.agents[agent2.agentId] ?? {
477701
+ agentId: agent2.agentId,
477702
+ toolUses: 0,
477703
+ input: 0,
477704
+ output: 0,
477705
+ cacheRead: 0,
477706
+ cacheWrite: 0,
477707
+ state: "running"
477708
+ };
477709
+ const merged = {
477710
+ ...prev,
477711
+ ...agent2
477712
+ };
477713
+ const wasRunning = prev.state === "running";
477714
+ const nowDone = merged.state === "done" || merged.state === "error";
477715
+ const completedAgents = wasRunning && nowDone ? cur.completedAgents + 1 : cur.completedAgents;
477716
+ return {
477717
+ lastDispatch: {
477718
+ ...cur,
477719
+ completedAgents,
477720
+ agents: {
477721
+ ...cur.agents,
477722
+ [agent2.agentId]: merged
477723
+ }
477724
+ }
477725
+ };
477726
+ }),
477727
+ finishDispatch: (parentToolCallId) => set3((s2) => {
477728
+ const cur = s2.lastDispatch;
477729
+ if (!cur || cur.parentToolCallId !== parentToolCallId)
477730
+ return s2;
477731
+ return {
477732
+ lastDispatch: {
477733
+ ...cur,
477734
+ finishedAt: Date.now()
477735
+ }
477736
+ };
477846
477737
  })
477847
477738
  })));
477848
477739
  });
@@ -480196,14 +480087,11 @@ async function handleProxyStop(_input, ctx) {
480196
480087
  }
480197
480088
  async function handleProxyRestart(_input, ctx) {
480198
480089
  const {
480199
- stopProxy: stopProxy2,
480200
- ensureProxy: ensureProxy2
480090
+ bounceProxy: bounceProxy2
480201
480091
  } = await Promise.resolve().then(() => (init_lifecycle(), exports_lifecycle));
480202
480092
  sysMsg(ctx, "Restarting proxy\u2026");
480203
- stopProxy2();
480204
- await new Promise((r4) => setTimeout(r4, 500));
480205
- const result = await ensureProxy2();
480206
- sysMsg(ctx, result.ok ? "Proxy restarted." : `Failed: ${result.error ?? "unknown"}`);
480093
+ const ok = await bounceProxy2();
480094
+ sysMsg(ctx, ok ? "Proxy restarted." : "Failed to restart proxy.");
480207
480095
  }
480208
480096
  function register11(map2) {
480209
480097
  map2.set("/proxy", handleProxyStatus);
@@ -481699,6 +481587,13 @@ var init_registry = __esm(() => {
481699
481587
  category: "System",
481700
481588
  tags: ["exit", "close"]
481701
481589
  },
481590
+ {
481591
+ cmd: "/exit",
481592
+ ic: "quit",
481593
+ desc: "Exit SoulForge",
481594
+ category: "System",
481595
+ tags: ["quit", "close"]
481596
+ },
481702
481597
  {
481703
481598
  cmd: "/restart",
481704
481599
  ic: "ghost",
@@ -485692,13 +485587,13 @@ var init_TabBar = __esm(async () => {
485692
485587
  // src/core/compaction/extractor.ts
485693
485588
  function extractFromToolCall(wsm, toolName, args2) {
485694
485589
  const filePath = extractFilePath(args2);
485695
- if (READ_TOOLS3.has(toolName) && filePath) {
485590
+ if (READ_TOOLS2.has(toolName) && filePath) {
485696
485591
  wsm.trackFile(filePath, {
485697
485592
  type: "read",
485698
485593
  summary: buildReadSummary(toolName, args2)
485699
485594
  });
485700
485595
  }
485701
- if (EDIT_TOOLS4.has(toolName) && filePath) {
485596
+ if (EDIT_TOOLS3.has(toolName) && filePath) {
485702
485597
  const detail = buildEditDetail(toolName, args2);
485703
485598
  wsm.trackFile(filePath, {
485704
485599
  type: toolName === "write_file" || toolName === "create_file" ? "create" : "edit",
@@ -485918,10 +485813,10 @@ function truncate2(s2, max) {
485918
485813
  return s2;
485919
485814
  return `${s2.slice(0, max)}...`;
485920
485815
  }
485921
- var READ_TOOLS3, EDIT_TOOLS4, SHELL_TOOL = "shell", PROJECT_TOOL = "project";
485816
+ var READ_TOOLS2, EDIT_TOOLS3, SHELL_TOOL = "shell", PROJECT_TOOL = "project";
485922
485817
  var init_extractor = __esm(() => {
485923
- READ_TOOLS3 = new Set(["read", "navigate", "grep", "glob", "analyze", "soul_grep", "soul_find", "soul_analyze", "soul_impact"]);
485924
- EDIT_TOOLS4 = new Set(["edit_file", "replace_file", "write_file", "create_file"]);
485818
+ READ_TOOLS2 = new Set(["read", "navigate", "grep", "glob", "analyze", "soul_grep", "soul_find", "soul_analyze", "soul_impact"]);
485819
+ EDIT_TOOLS3 = new Set(["edit_file", "replace_file", "write_file", "create_file"]);
485925
485820
  });
485926
485821
 
485927
485822
  // src/core/compaction/summarize.ts
@@ -487932,6 +487827,15 @@ ${description}`,
487932
487827
  const unsubAgentStats = onAgentStats((event) => {
487933
487828
  if (!isOurDispatch(event.parentToolCallId))
487934
487829
  return;
487830
+ useStatusBarStore.getState().upsertDispatchAgent(event.parentToolCallId, {
487831
+ agentId: event.agentId,
487832
+ modelId: event.modelId,
487833
+ toolUses: event.toolUses,
487834
+ input: event.tokenUsage.input,
487835
+ output: event.tokenUsage.output,
487836
+ cacheRead: event.cacheHits ?? 0,
487837
+ cacheWrite: event.cacheWrite ?? 0
487838
+ });
487935
487839
  const prev = subagentCumulative.get(event.agentId) ?? {
487936
487840
  input: 0,
487937
487841
  output: 0,
@@ -487976,7 +487880,18 @@ ${description}`,
487976
487880
  const unsubMultiAgent = onMultiAgentEvent((event) => {
487977
487881
  if (!isOurDispatch(event.parentToolCallId))
487978
487882
  return;
487883
+ if (event.type === "dispatch-start") {
487884
+ useStatusBarStore.getState().startDispatch(event.parentToolCallId, event.totalAgents ?? 0);
487885
+ }
487979
487886
  if (event.type === "agent-start" && event.agentId) {
487887
+ useStatusBarStore.getState().upsertDispatchAgent(event.parentToolCallId, {
487888
+ agentId: event.agentId,
487889
+ role: event.role,
487890
+ modelId: event.modelId,
487891
+ tier: event.tier,
487892
+ task: event.task,
487893
+ state: "running"
487894
+ });
487980
487895
  runHooks({
487981
487896
  event: "SubagentStart",
487982
487897
  toolInput: {
@@ -487987,6 +487902,25 @@ ${description}`,
487987
487902
  cwd: cwd2
487988
487903
  }).catch(() => {});
487989
487904
  }
487905
+ if ((event.type === "agent-done" || event.type === "agent-error") && event.agentId) {
487906
+ useStatusBarStore.getState().upsertDispatchAgent(event.parentToolCallId, {
487907
+ agentId: event.agentId,
487908
+ role: event.role,
487909
+ modelId: event.modelId,
487910
+ tier: event.tier,
487911
+ task: event.task,
487912
+ toolUses: event.toolUses,
487913
+ ...event.tokenUsage ? {
487914
+ input: event.tokenUsage.input,
487915
+ output: event.tokenUsage.output
487916
+ } : {},
487917
+ ...event.cacheHits != null ? {
487918
+ cacheRead: event.cacheHits
487919
+ } : {},
487920
+ succeeded: event.succeeded,
487921
+ state: event.type === "agent-error" ? "error" : "done"
487922
+ });
487923
+ }
487990
487924
  if (event.type === "agent-done" && event.agentId) {
487991
487925
  runHooks({
487992
487926
  event: "SubagentStop",
@@ -488003,6 +487937,7 @@ ${description}`,
488003
487937
  queueMicrotaskFlush();
488004
487938
  }
488005
487939
  if (event.type === "dispatch-done") {
487940
+ useStatusBarStore.getState().finishDispatch(event.parentToolCallId);
488006
487941
  completedResultChars.clear();
488007
487942
  subagentCumulative.clear();
488008
487943
  if (visibleRef.current)
@@ -489072,8 +489007,9 @@ ${errStack}` : `Error: ${displayErr}`);
489072
489007
  }
489073
489008
  const isAbort = abortController.signal.aborted;
489074
489009
  const msg = err2 instanceof Error ? err2.message : String(err2);
489075
- const isTransient = /overloaded|529|429|rate.?limit|too many requests|503|502|timeout|timed out|fetch failed|network|econnreset|econnrefused|enotfound|eai_again|socket hang up|connection (?:error|reset|refused|closed)|stream (?:error|closed)|premature close|terminated|aborted.*connection/i.test(msg);
489076
- const isConnErr = /cannot connect|unable to connect|fetch failed|failed to fetch|socket hang up|econnreset|econnrefused|enotfound|eai_again|network error|stream (?:error|closed)|premature close|terminated|connection (?:error|reset|refused|closed)/i.test(msg);
489010
+ const chain = causeChain(err2);
489011
+ const isTransient = /overloaded|529|429|rate.?limit|too many requests|503|502|timeout|timed out|fetch failed|network|econnreset|econnrefused|enotfound|eai_again|socket hang up|connection (?:error|reset|refused|closed)|stream (?:error|closed)|premature close|terminated|aborted.*connection/i.test(chain);
489012
+ const isConnErr = /cannot connect|unable to connect|fetch failed|failed to fetch|socket hang up|econnreset|econnrefused|enotfound|eai_again|network error|stream (?:error|closed)|premature close|terminated|connection (?:error|reset|refused|closed)/i.test(chain);
489077
489013
  if (!proxyBounced && isConnErr && getActiveProviderId() === "proxy") {
489078
489014
  proxyBounced = true;
489079
489015
  const healthy = await proxyHealthProbe().catch(() => false);
@@ -489244,8 +489180,15 @@ ${errStack}` : `Error: ${displayErr}`);
489244
489180
  return;
489245
489181
  }
489246
489182
  const rawMsg = err2 instanceof Error ? err2.message : String(err2);
489183
+ const rawStack = err2 instanceof Error ? err2.stack : undefined;
489184
+ const rawChain = causeChain(err2);
489247
489185
  if (!isAbort) {
489248
- logBackgroundError("agent-error", rawMsg);
489186
+ const parts2 = [rawChain];
489187
+ if (rawStack)
489188
+ parts2.push(rawStack);
489189
+ logBackgroundError("agent-error", parts2.join(`
489190
+
489191
+ `));
489249
489192
  }
489250
489193
  if (!isAbort) {
489251
489194
  runHooks({
@@ -489691,6 +489634,18 @@ ${pContent}`;
489691
489634
  cycleMode: cycleModeFn
489692
489635
  };
489693
489636
  }
489637
+ function causeChain(err2) {
489638
+ const parts2 = [];
489639
+ let cur = err2;
489640
+ const seen = new Set;
489641
+ while (cur && !seen.has(cur)) {
489642
+ seen.add(cur);
489643
+ parts2.push(cur instanceof Error ? `${cur.name}: ${cur.message}` : String(cur));
489644
+ cur = cur?.cause;
489645
+ }
489646
+ return parts2.join(`
489647
+ caused by: `);
489648
+ }
489694
489649
  var import_react32, CHARS_PER_TOKEN2 = 4, PRUNE_PROTECT_TOKENS = 40000, PRUNE_MINIMUM_TOKENS = 20000;
489695
489650
  var init_useChat = __esm(() => {
489696
489651
  init_dist5();
@@ -498055,7 +498010,7 @@ function _temp21(s2) {
498055
498010
  function isFailedEditCall(tc) {
498056
498011
  return EDIT_NAMES.has(tc.name) && !!tc.result && !tc.result.success;
498057
498012
  }
498058
- function extractPathFromArgs2(args2) {
498013
+ function extractPathFromArgs(args2) {
498059
498014
  if (!args2 || typeof args2.path !== "string")
498060
498015
  return null;
498061
498016
  return args2.path;
@@ -498758,7 +498713,7 @@ function WritePlanCall(t0) {
498758
498713
  function truncateUserContent(content, expanded, t2) {
498759
498714
  const lines = content.split(`
498760
498715
  `);
498761
- if (expanded || lines.length <= TRUNCATE_THRESHOLD) {
498716
+ if (expanded || lines.length <= TRUNCATE_THRESHOLD2) {
498762
498717
  return /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("text", {
498763
498718
  children: content
498764
498719
  }, undefined, false, undefined, this);
@@ -499058,12 +499013,12 @@ function renderSegments(segments, toolCallMap, diffStyle = "default", collapseDi
499058
499013
  return false;
499059
499014
  if (!isFailedEditCall(tc))
499060
499015
  return true;
499061
- const path6 = extractPathFromArgs2(tc.args);
499016
+ const path6 = extractPathFromArgs(tc.args);
499062
499017
  if (!path6)
499063
499018
  return true;
499064
499019
  for (let j4 = idx + 1;j4 < topLevel.length; j4++) {
499065
499020
  const later = topLevel[j4];
499066
- if (later && EDIT_NAMES.has(later.name) && extractPathFromArgs2(later.args) === path6)
499021
+ if (later && EDIT_NAMES.has(later.name) && extractPathFromArgs(later.args) === path6)
499067
499022
  return false;
499068
499023
  }
499069
499024
  return true;
@@ -499094,7 +499049,7 @@ function renderSegments(segments, toolCallMap, diffStyle = "default", collapseDi
499094
499049
  const cwd2 = process.cwd();
499095
499050
  const batchFiles = [];
499096
499051
  for (const tc of g3.calls) {
499097
- const directPath = extractPathFromArgs2(tc.args);
499052
+ const directPath = extractPathFromArgs(tc.args);
499098
499053
  if (directPath) {
499099
499054
  batchFiles.push({
499100
499055
  path: directPath,
@@ -499382,7 +499337,7 @@ function _temp102(tc_4) {
499382
499337
  collapseDiffs: true
499383
499338
  }, tc_4.id, false, undefined, this);
499384
499339
  }
499385
- var import_compiler_runtime22, import_react44, ReasoningExpandedContext, ReasoningExpandedProvider, REVEAL_INTERVAL = 45, MAX_REVEAL_STEPS = 8, CURSOR_CHAR = "\u2588", RAIL_BORDER, TRUNCATE_THRESHOLD = 10, TRUNCATE_HEAD = 4, TRUNCATE_TAIL = 4, UserMessageAccent, UserMessageBubble, AssistantMessage, StaticMessage, MessageList;
499340
+ var import_compiler_runtime22, import_react44, ReasoningExpandedContext, ReasoningExpandedProvider, REVEAL_INTERVAL = 45, MAX_REVEAL_STEPS = 8, CURSOR_CHAR = "\u2588", RAIL_BORDER, TRUNCATE_THRESHOLD2 = 10, TRUNCATE_HEAD = 4, TRUNCATE_TAIL = 4, UserMessageAccent, UserMessageBubble, AssistantMessage, StaticMessage, MessageList;
499386
499341
  var init_MessageList = __esm(async () => {
499387
499342
  init_icons();
499388
499343
  init_image2();
@@ -519982,6 +519937,11 @@ function StatusDashboard({
519982
519937
  label: "Tabs",
519983
519938
  icon: "tabs",
519984
519939
  blurb: "per-tab summary"
519940
+ }, {
519941
+ id: "Dispatch",
519942
+ label: "Dispatch",
519943
+ icon: "dispatch",
519944
+ blurb: "last dispatch \xB7 cache"
519985
519945
  }, {
519986
519946
  id: "System",
519987
519947
  label: "System",
@@ -520053,6 +520013,12 @@ function StatusDashboard({
520053
520013
  getTabUsage,
520054
520014
  contentW
520055
520015
  }, undefined, false, undefined, this),
520016
+ tab === "Dispatch" && /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV(DispatchPane, {
520017
+ sb,
520018
+ contentW,
520019
+ scrollOffset,
520020
+ scrollH
520021
+ }, undefined, false, undefined, this),
520056
520022
  tab === "System" && /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV(SystemPane, {
520057
520023
  sb,
520058
520024
  rm: rm3,
@@ -520993,6 +520959,388 @@ function TabsPane(t0) {
520993
520959
  }
520994
520960
  return t4;
520995
520961
  }
520962
+ function DispatchPane(t0) {
520963
+ const $5 = import_compiler_runtime66.c(67);
520964
+ const {
520965
+ sb,
520966
+ contentW,
520967
+ scrollOffset,
520968
+ scrollH
520969
+ } = t0;
520970
+ const t2 = useTheme();
520971
+ const dispatch2 = sb.lastDispatch;
520972
+ const ref = import_react117.useRef(null);
520973
+ let t1;
520974
+ let t22;
520975
+ if ($5[0] !== scrollOffset) {
520976
+ t1 = () => {
520977
+ ref.current?.scrollTo(scrollOffset);
520978
+ };
520979
+ t22 = [scrollOffset];
520980
+ $5[0] = scrollOffset;
520981
+ $5[1] = t1;
520982
+ $5[2] = t22;
520983
+ } else {
520984
+ t1 = $5[1];
520985
+ t22 = $5[2];
520986
+ }
520987
+ import_react117.useEffect(t1, t22);
520988
+ if (!dispatch2) {
520989
+ let t32;
520990
+ if ($5[3] !== t2.bgPopup || $5[4] !== t2.textMuted) {
520991
+ t32 = /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("box", {
520992
+ flexDirection: "column",
520993
+ paddingX: 2,
520994
+ paddingY: 2,
520995
+ children: /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("text", {
520996
+ bg: t2.bgPopup,
520997
+ fg: t2.textMuted,
520998
+ children: "No dispatch yet this session."
520999
+ }, undefined, false, undefined, this)
521000
+ }, undefined, false, undefined, this);
521001
+ $5[3] = t2.bgPopup;
521002
+ $5[4] = t2.textMuted;
521003
+ $5[5] = t32;
521004
+ } else {
521005
+ t32 = $5[5];
521006
+ }
521007
+ return t32;
521008
+ }
521009
+ let elapsedLabel;
521010
+ let overallCachePct;
521011
+ let t3;
521012
+ let totalCache;
521013
+ let totalCacheWrite;
521014
+ let totalIn;
521015
+ let totalOut;
521016
+ let totalTools;
521017
+ if ($5[6] !== dispatch2.agents || $5[7] !== dispatch2.finishedAt || $5[8] !== dispatch2.startedAt) {
521018
+ const agents = Object.values(dispatch2.agents);
521019
+ agents.sort(_temp78);
521020
+ totalIn = 0;
521021
+ totalOut = 0;
521022
+ totalCache = 0;
521023
+ totalCacheWrite = 0;
521024
+ totalTools = 0;
521025
+ for (const a_0 of agents) {
521026
+ totalIn = totalIn + (a_0.input ?? 0);
521027
+ totalOut = totalOut + (a_0.output ?? 0);
521028
+ totalCache = totalCache + (a_0.cacheRead ?? 0);
521029
+ totalCacheWrite = totalCacheWrite + (a_0.cacheWrite ?? 0);
521030
+ totalTools = totalTools + (a_0.toolUses ?? 0);
521031
+ }
521032
+ const allInput = totalIn;
521033
+ let t42;
521034
+ if ($5[17] !== allInput || $5[18] !== totalCache) {
521035
+ t42 = allInput > 0 ? Math.min(100, Math.round(totalCache / allInput * 100)) : 0;
521036
+ $5[17] = allInput;
521037
+ $5[18] = totalCache;
521038
+ $5[19] = t42;
521039
+ } else {
521040
+ t42 = $5[19];
521041
+ }
521042
+ overallCachePct = t42;
521043
+ let t52;
521044
+ if ($5[20] !== dispatch2.finishedAt) {
521045
+ t52 = dispatch2.finishedAt ?? Date.now();
521046
+ $5[20] = dispatch2.finishedAt;
521047
+ $5[21] = t52;
521048
+ } else {
521049
+ t52 = $5[21];
521050
+ }
521051
+ const elapsed = t52 - dispatch2.startedAt;
521052
+ let t62;
521053
+ if ($5[22] !== elapsed) {
521054
+ t62 = elapsed < 1000 ? `${String(elapsed)}ms` : elapsed < 60000 ? `${(elapsed / 1000).toFixed(1)}s` : `${String(Math.floor(elapsed / 60000))}m ${String(Math.floor(elapsed % 60000 / 1000))}s`;
521055
+ $5[22] = elapsed;
521056
+ $5[23] = t62;
521057
+ } else {
521058
+ t62 = $5[23];
521059
+ }
521060
+ elapsedLabel = t62;
521061
+ const compactModel = _temp85;
521062
+ t3 = agents.map((a_1) => {
521063
+ const cacheRead = a_1.cacheRead ?? 0;
521064
+ const input = a_1.input ?? 0;
521065
+ const pct = input > 0 ? Math.round(cacheRead / input * 100) : 0;
521066
+ const stateLabel = a_1.state === "running" ? `${icon("spinner")} run` : a_1.state === "error" ? `${icon("error")} err` : a_1.succeeded === false ? `${icon("warning")} done` : `${icon("success")} done`;
521067
+ const model = a_1.modelId ? compactModel(getShortModelLabel(a_1.modelId)) : "\u2014";
521068
+ const agentLabel = a_1.agentId.length > 18 ? `${a_1.agentId.slice(0, 17)}\u2026` : a_1.agentId;
521069
+ const tier = a_1.tier === "spark" ? `${icon("spark")} spark` : a_1.tier === "ember" ? `${icon("ember")} ember` : "\u2014";
521070
+ return {
521071
+ agent: agentLabel,
521072
+ tier,
521073
+ model,
521074
+ state: stateLabel,
521075
+ tools: String(a_1.toolUses ?? 0),
521076
+ input: fmtTokens(input),
521077
+ output: fmtTokens(a_1.output ?? 0),
521078
+ cache: cacheRead > 0 ? fmtTokens(cacheRead) : "\u2014",
521079
+ cachePct: cacheRead > 0 ? `${String(pct)}%` : "\u2014"
521080
+ };
521081
+ });
521082
+ $5[6] = dispatch2.agents;
521083
+ $5[7] = dispatch2.finishedAt;
521084
+ $5[8] = dispatch2.startedAt;
521085
+ $5[9] = elapsedLabel;
521086
+ $5[10] = overallCachePct;
521087
+ $5[11] = t3;
521088
+ $5[12] = totalCache;
521089
+ $5[13] = totalCacheWrite;
521090
+ $5[14] = totalIn;
521091
+ $5[15] = totalOut;
521092
+ $5[16] = totalTools;
521093
+ } else {
521094
+ elapsedLabel = $5[9];
521095
+ overallCachePct = $5[10];
521096
+ t3 = $5[11];
521097
+ totalCache = $5[12];
521098
+ totalCacheWrite = $5[13];
521099
+ totalIn = $5[14];
521100
+ totalOut = $5[15];
521101
+ totalTools = $5[16];
521102
+ }
521103
+ const rows = t3;
521104
+ const t4 = `${String(dispatch2.completedAgents)}/${String(dispatch2.totalAgents)} agents \xB7 ${elapsedLabel}`;
521105
+ const t5 = contentW - 4;
521106
+ let t6;
521107
+ if ($5[24] !== overallCachePct || $5[25] !== totalCache) {
521108
+ t6 = totalCache > 0 ? `${fmtTokens(totalCache)} (${String(overallCachePct)}%)` : "\u2014";
521109
+ $5[24] = overallCachePct;
521110
+ $5[25] = totalCache;
521111
+ $5[26] = t6;
521112
+ } else {
521113
+ t6 = $5[26];
521114
+ }
521115
+ const t7 = totalCache > 0 ? t2.success : t2.textFaint;
521116
+ let t8;
521117
+ if ($5[27] !== overallCachePct || $5[28] !== t5 || $5[29] !== t6 || $5[30] !== t7) {
521118
+ t8 = /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV(ProgressBar, {
521119
+ label: "Cache",
521120
+ labelWidth: 10,
521121
+ pct: overallCachePct,
521122
+ width: t5,
521123
+ value: t6,
521124
+ color: t7
521125
+ }, undefined, false, undefined, this);
521126
+ $5[27] = overallCachePct;
521127
+ $5[28] = t5;
521128
+ $5[29] = t6;
521129
+ $5[30] = t7;
521130
+ $5[31] = t8;
521131
+ } else {
521132
+ t8 = $5[31];
521133
+ }
521134
+ let t9;
521135
+ if ($5[32] === Symbol.for("react.memo_cache_sentinel")) {
521136
+ t9 = /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV(VSpacer, {}, undefined, false, undefined, this);
521137
+ $5[32] = t9;
521138
+ } else {
521139
+ t9 = $5[32];
521140
+ }
521141
+ const t10 = t2.bgPopup;
521142
+ const t11 = t2.info;
521143
+ let t12;
521144
+ if ($5[33] !== totalIn) {
521145
+ t12 = fmtTokens(totalIn);
521146
+ $5[33] = totalIn;
521147
+ $5[34] = t12;
521148
+ } else {
521149
+ t12 = $5[34];
521150
+ }
521151
+ let t13;
521152
+ if ($5[35] !== t2.bgPopup || $5[36] !== t2.info || $5[37] !== t12) {
521153
+ t13 = /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV(Field, {
521154
+ label: "Input",
521155
+ labelWidth: 14,
521156
+ value: /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("text", {
521157
+ bg: t10,
521158
+ fg: t11,
521159
+ children: t12
521160
+ }, undefined, false, undefined, this)
521161
+ }, undefined, false, undefined, this);
521162
+ $5[35] = t2.bgPopup;
521163
+ $5[36] = t2.info;
521164
+ $5[37] = t12;
521165
+ $5[38] = t13;
521166
+ } else {
521167
+ t13 = $5[38];
521168
+ }
521169
+ const t14 = t2.bgPopup;
521170
+ const t15 = t2.warning;
521171
+ let t16;
521172
+ if ($5[39] !== totalOut) {
521173
+ t16 = fmtTokens(totalOut);
521174
+ $5[39] = totalOut;
521175
+ $5[40] = t16;
521176
+ } else {
521177
+ t16 = $5[40];
521178
+ }
521179
+ let t17;
521180
+ if ($5[41] !== t2.bgPopup || $5[42] !== t2.warning || $5[43] !== t16) {
521181
+ t17 = /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV(Field, {
521182
+ label: "Output",
521183
+ labelWidth: 14,
521184
+ value: /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("text", {
521185
+ bg: t14,
521186
+ fg: t15,
521187
+ children: t16
521188
+ }, undefined, false, undefined, this)
521189
+ }, undefined, false, undefined, this);
521190
+ $5[41] = t2.bgPopup;
521191
+ $5[42] = t2.warning;
521192
+ $5[43] = t16;
521193
+ $5[44] = t17;
521194
+ } else {
521195
+ t17 = $5[44];
521196
+ }
521197
+ let t18;
521198
+ if ($5[45] !== t2.bgPopup || $5[46] !== t2.warning || $5[47] !== totalCacheWrite) {
521199
+ t18 = totalCacheWrite > 0 && /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV(Field, {
521200
+ label: "Cache Write",
521201
+ labelWidth: 14,
521202
+ value: /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("text", {
521203
+ bg: t2.bgPopup,
521204
+ fg: t2.warning,
521205
+ children: fmtTokens(totalCacheWrite)
521206
+ }, undefined, false, undefined, this)
521207
+ }, undefined, false, undefined, this);
521208
+ $5[45] = t2.bgPopup;
521209
+ $5[46] = t2.warning;
521210
+ $5[47] = totalCacheWrite;
521211
+ $5[48] = t18;
521212
+ } else {
521213
+ t18 = $5[48];
521214
+ }
521215
+ const t19 = String(totalTools);
521216
+ let t20;
521217
+ if ($5[49] !== t19) {
521218
+ t20 = /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV(Field, {
521219
+ label: "Tool calls",
521220
+ labelWidth: 14,
521221
+ value: t19
521222
+ }, undefined, false, undefined, this);
521223
+ $5[49] = t19;
521224
+ $5[50] = t20;
521225
+ } else {
521226
+ t20 = $5[50];
521227
+ }
521228
+ let t21;
521229
+ if ($5[51] !== t13 || $5[52] !== t17 || $5[53] !== t18 || $5[54] !== t20 || $5[55] !== t4 || $5[56] !== t8) {
521230
+ t21 = /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV(Section, {
521231
+ title: "Last Dispatch",
521232
+ description: t4,
521233
+ children: [
521234
+ t8,
521235
+ t9,
521236
+ t13,
521237
+ t17,
521238
+ t18,
521239
+ t20
521240
+ ]
521241
+ }, undefined, true, undefined, this);
521242
+ $5[51] = t13;
521243
+ $5[52] = t17;
521244
+ $5[53] = t18;
521245
+ $5[54] = t20;
521246
+ $5[55] = t4;
521247
+ $5[56] = t8;
521248
+ $5[57] = t21;
521249
+ } else {
521250
+ t21 = $5[57];
521251
+ }
521252
+ let t222;
521253
+ if ($5[58] !== contentW || $5[59] !== rows || $5[60] !== scrollH || $5[61] !== t2.bgPopup || $5[62] !== t2.textMuted) {
521254
+ t222 = /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV(Section, {
521255
+ title: "Per Agent",
521256
+ children: rows.length === 0 ? /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("text", {
521257
+ bg: t2.bgPopup,
521258
+ fg: t2.textMuted,
521259
+ children: "No agents recorded."
521260
+ }, undefined, false, undefined, this) : /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("scrollbox", {
521261
+ ref,
521262
+ height: Math.max(4, scrollH - 8),
521263
+ children: /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV(Table, {
521264
+ width: contentW - 4,
521265
+ maxRows: rows.length,
521266
+ columns: [{
521267
+ key: "agent",
521268
+ align: "left"
521269
+ }, {
521270
+ key: "tier",
521271
+ align: "left",
521272
+ width: 9
521273
+ }, {
521274
+ key: "model",
521275
+ align: "left",
521276
+ width: 14
521277
+ }, {
521278
+ key: "state",
521279
+ align: "left",
521280
+ width: 7
521281
+ }, {
521282
+ key: "tools",
521283
+ align: "right",
521284
+ width: 5
521285
+ }, {
521286
+ key: "input",
521287
+ align: "right",
521288
+ width: 8
521289
+ }, {
521290
+ key: "output",
521291
+ align: "right",
521292
+ width: 8
521293
+ }, {
521294
+ key: "cache",
521295
+ align: "right",
521296
+ width: 8
521297
+ }, {
521298
+ key: "cachePct",
521299
+ align: "right",
521300
+ width: 6
521301
+ }],
521302
+ rows
521303
+ }, undefined, false, undefined, this)
521304
+ }, undefined, false, undefined, this)
521305
+ }, undefined, false, undefined, this);
521306
+ $5[58] = contentW;
521307
+ $5[59] = rows;
521308
+ $5[60] = scrollH;
521309
+ $5[61] = t2.bgPopup;
521310
+ $5[62] = t2.textMuted;
521311
+ $5[63] = t222;
521312
+ } else {
521313
+ t222 = $5[63];
521314
+ }
521315
+ let t23;
521316
+ if ($5[64] !== t21 || $5[65] !== t222) {
521317
+ t23 = /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("box", {
521318
+ flexDirection: "column",
521319
+ flexGrow: 1,
521320
+ minHeight: 0,
521321
+ children: [
521322
+ t21,
521323
+ t222
521324
+ ]
521325
+ }, undefined, true, undefined, this);
521326
+ $5[64] = t21;
521327
+ $5[65] = t222;
521328
+ $5[66] = t23;
521329
+ } else {
521330
+ t23 = $5[66];
521331
+ }
521332
+ return t23;
521333
+ }
521334
+ function _temp85(raw2) {
521335
+ let s2 = raw2.replace(/^Claude\s+/i, "").replace(/^GPT\s+/i, "GPT-").replace(/^Gemini\s+/i, "");
521336
+ if (s2.length > 14) {
521337
+ s2 = `${s2.slice(0, 13)}\u2026`;
521338
+ }
521339
+ return s2;
521340
+ }
521341
+ function _temp78(a2, b5) {
521342
+ return a2.agentId.localeCompare(b5.agentId);
521343
+ }
520996
521344
  function SystemPane(t0) {
520997
521345
  const $5 = import_compiler_runtime66.c(139);
520998
521346
  const {
@@ -521041,7 +521389,7 @@ function SystemPane(t0) {
521041
521389
  t3 = $5[6];
521042
521390
  }
521043
521391
  const wkColor = t3;
521044
- const wkIcon = _temp78;
521392
+ const wkIcon = _temp94;
521045
521393
  let t4;
521046
521394
  if ($5[7] === Symbol.for("react.memo_cache_sentinel")) {
521047
521395
  t4 = getTerminalStats();
@@ -521676,7 +522024,7 @@ function SystemPane(t0) {
521676
522024
  }
521677
522025
  return t58;
521678
522026
  }
521679
- function _temp78(s_0) {
522027
+ function _temp94(s_0) {
521680
522028
  return s_0 === "busy" ? icon("worker_busy") : s_0 === "crashed" ? icon("worker_crash") : s_0 === "restarting" ? icon("worker_restart") : icon("worker");
521681
522029
  }
521682
522030
  var import_compiler_runtime66, import_react117, BOLD16, SIDEBAR_W2 = 22, TABS;
@@ -521701,7 +522049,7 @@ var init_StatusDashboard = __esm(async () => {
521701
522049
  import_compiler_runtime66 = __toESM(require_compiler_runtime(), 1);
521702
522050
  import_react117 = __toESM(require_react(), 1);
521703
522051
  BOLD16 = TextAttributes.BOLD;
521704
- TABS = ["Usage", "Prompt", "Cost", "Tabs", "System"];
522052
+ TABS = ["Usage", "Prompt", "Cost", "Tabs", "Dispatch", "System"];
521705
522053
  });
521706
522054
 
521707
522055
  // src/components/modals/TabNamePopup.tsx
@@ -529709,7 +530057,7 @@ function MCPSettings(t0) {
529709
530057
  const toolPageSize = Math.max(3, Math.floor(maxVisibleRows / 2));
529710
530058
  let t1;
529711
530059
  if ($5[0] !== projectServers) {
529712
- t1 = new Set(projectServers.map(_temp89));
530060
+ t1 = new Set(projectServers.map(_temp90));
529713
530061
  $5[0] = projectServers;
529714
530062
  $5[1] = t1;
529715
530063
  } else {
@@ -530073,7 +530421,7 @@ function MCPSettings(t0) {
530073
530421
  return;
530074
530422
  }
530075
530423
  if (evt.name === "tab" && !pendingDelete) {
530076
- setView(_temp85);
530424
+ setView(_temp89);
530077
530425
  return;
530078
530426
  }
530079
530427
  if (view === "list" && pendingDelete) {
@@ -530082,7 +530430,7 @@ function MCPSettings(t0) {
530082
530430
  return;
530083
530431
  }
530084
530432
  if (evt.name === "left" || evt.name === "right" || evt.name === "tab" || evt.name === "up" || evt.name === "down") {
530085
- setDeleteChoice(_temp94);
530433
+ setDeleteChoice(_temp95);
530086
530434
  return;
530087
530435
  }
530088
530436
  if (evt.name === "return") {
@@ -530491,10 +530839,10 @@ function _temp112(f_1) {
530491
530839
  return f_1.slice(0, -1);
530492
530840
  }
530493
530841
  function _temp03() {}
530494
- function _temp94(c_0) {
530842
+ function _temp95(c_0) {
530495
530843
  return c_0 === "no" ? "yes" : "no";
530496
530844
  }
530497
- function _temp85(v4) {
530845
+ function _temp89(v4) {
530498
530846
  return v4 === "list" ? "tools" : "list";
530499
530847
  }
530500
530848
  function _temp710(d_0) {
@@ -530519,7 +530867,7 @@ function _temp322(s_1) {
530519
530867
  function _temp228(s_0) {
530520
530868
  return s_0.servers;
530521
530869
  }
530522
- function _temp89(s2) {
530870
+ function _temp90(s2) {
530523
530871
  return s2.name;
530524
530872
  }
530525
530873
  function Sep(t0) {
@@ -532646,7 +532994,7 @@ function ProviderSettings(t0) {
532646
532994
  width: contentW,
532647
532995
  maxRows: Math.max(1, Math.floor(maxVisible / 3)),
532648
532996
  rowHeight: 3,
532649
- keyExtractor: _temp90,
532997
+ keyExtractor: _temp96,
532650
532998
  renderItem: (item_2, t142) => {
532651
532999
  const {
532652
533000
  selected
@@ -532891,7 +533239,7 @@ function _temp229(o3) {
532891
533239
  label: o3
532892
533240
  };
532893
533241
  }
532894
- function _temp90(item_1) {
533242
+ function _temp96(item_1) {
532895
533243
  return item_1.key;
532896
533244
  }
532897
533245
  var import_compiler_runtime73, import_react133, MAX_POPUP_WIDTH4 = 110, CHROME_ROWS6 = 10, TABS5, CLAUDE_ITEMS, OPENAI_ITEMS, GENERAL_ITEMS, TAB_ITEMS, DEFAULTS;
@@ -533542,19 +533890,24 @@ var init_RepoMapStatusPopup = __esm(async () => {
533542
533890
  });
533543
533891
 
533544
533892
  // src/components/settings/RouterSettings.tsx
533545
- function RouterSettings(t0) {
533546
- const $5 = import_compiler_runtime74.c(56);
533547
- const {
533548
- visible,
533549
- router: router2,
533550
- activeModel,
533551
- scope,
533552
- onScopeChange,
533553
- onPickSlot,
533554
- onClearSlot,
533555
- onPickerChange,
533556
- onClose
533557
- } = t0;
533893
+ function truncate4(s2, max) {
533894
+ if (s2.length <= max)
533895
+ return s2;
533896
+ if (max <= 1)
533897
+ return s2.slice(0, max);
533898
+ return `${s2.slice(0, max - 1)}\u2026`;
533899
+ }
533900
+ function RouterSettings({
533901
+ visible,
533902
+ router: router2,
533903
+ activeModel,
533904
+ scope,
533905
+ onScopeChange,
533906
+ onPickSlot,
533907
+ onClearSlot,
533908
+ onPickerChange,
533909
+ onClose
533910
+ }) {
533558
533911
  const t2 = useTheme();
533559
533912
  const {
533560
533913
  width: tw2,
@@ -533562,446 +533915,293 @@ function RouterSettings(t0) {
533562
533915
  } = useTerminalDimensions();
533563
533916
  const [cursor, setCursor] = import_react137.useState(0);
533564
533917
  const popupW = Math.min(100, Math.max(72, Math.floor(tw2 * 0.78)));
533565
- const popupH = Math.min(36, Math.max(22, th - 4));
533918
+ const popupH = Math.min(40, Math.max(26, th - 4));
533566
533919
  const contentW = popupW - 4;
533567
- let t1;
533568
- if ($5[0] !== activeModel || $5[1] !== router2 || $5[2] !== t2) {
533569
- t1 = SECTIONS.map((s2) => ({
533570
- id: s2.id,
533571
- label: s2.title,
533572
- accent: t2.brandAlt,
533573
- meta: s2.subtitle,
533574
- items: s2.defs.filter(_temp91).map((def_0) => {
533575
- const raw2 = router2?.[def_0.key] ?? null;
533576
- const modelId = typeof raw2 === "string" ? raw2 : null;
533577
- return {
533578
- id: def_0.key,
533579
- label: def_0.label,
533580
- icon: def_0.icon,
533581
- meta: modelId ?? `\u21B3 ${activeModel}`,
533582
- active: !!modelId,
533583
- def: def_0
533584
- };
533585
- })
533586
- }));
533587
- $5[0] = activeModel;
533588
- $5[1] = router2;
533589
- $5[2] = t2;
533590
- $5[3] = t1;
533591
- } else {
533592
- t1 = $5[3];
533593
- }
533594
- const groups = t1;
533595
- let t22;
533596
- if ($5[4] === Symbol.for("react.memo_cache_sentinel")) {
533597
- t22 = ALL_DEFS.filter(_temp230);
533598
- $5[4] = t22;
533599
- } else {
533600
- t22 = $5[4];
533601
- }
533602
- const pickerDefs = t22;
533603
- let t3;
533604
- if ($5[5] !== groups) {
533605
- t3 = new Set(groups.map(_temp324));
533606
- $5[5] = groups;
533607
- $5[6] = t3;
533608
- } else {
533609
- t3 = $5[6];
533610
- }
533611
- const expanded = t3;
533612
- let t4;
533613
- if ($5[7] !== expanded || $5[8] !== groups) {
533614
- t4 = buildGroupedRows(groups, expanded);
533615
- $5[7] = expanded;
533616
- $5[8] = groups;
533617
- $5[9] = t4;
533618
- } else {
533619
- t4 = $5[9];
533620
- }
533621
- const rows = t4;
533622
- const selectedRow = rows[cursor];
533623
- const selectedDef = selectedRow?.kind === "item" ? selectedRow.item.def : null;
533624
- let t5;
533625
- if ($5[10] !== cursor || $5[11] !== rows) {
533626
- t5 = (dir) => {
533627
- const total = rows.length;
533628
- if (total === 0) {
533629
- return;
533630
- }
533631
- let i4 = cursor + dir;
533632
- for (let n = 0;n < total; n++) {
533633
- if (i4 < 0) {
533634
- i4 = total - 1;
533635
- } else {
533636
- if (i4 >= total) {
533637
- i4 = 0;
533638
- }
533639
- }
533640
- if (rows[i4]?.kind === "item") {
533641
- setCursor(i4);
533642
- return;
533643
- }
533644
- i4 = i4 + dir;
533645
- }
533646
- };
533647
- $5[10] = cursor;
533648
- $5[11] = rows;
533649
- $5[12] = t5;
533650
- } else {
533651
- t5 = $5[12];
533652
- }
533653
- const moveItem = t5;
533654
- let t6;
533655
- if ($5[13] !== moveItem || $5[14] !== onClearSlot || $5[15] !== onClose || $5[16] !== onPickSlot || $5[17] !== onPickerChange || $5[18] !== onScopeChange || $5[19] !== router2 || $5[20] !== rows.length || $5[21] !== scope || $5[22] !== selectedDef || $5[23] !== visible) {
533656
- t6 = (evt) => {
533657
- if (!visible) {
533658
- return;
533659
- }
533660
- if (evt.name === "escape" || evt.name === "q") {
533661
- onClose();
533662
- return;
533663
- }
533664
- if (evt.name === "up" || evt.name === "k") {
533665
- moveItem(-1);
533666
- return;
533667
- }
533668
- if (evt.name === "down" || evt.name === "j") {
533669
- moveItem(1);
533670
- return;
533671
- }
533672
- if (evt.name === "return") {
533673
- if (selectedDef?.kind === "slot") {
533674
- onPickSlot(selectedDef.key);
533675
- }
533676
- return;
533677
- }
533678
- if (evt.name === "d" || evt.name === "delete" || evt.name === "backspace") {
533679
- if (selectedDef?.kind === "slot") {
533680
- onClearSlot(selectedDef.key);
533681
- } else {
533682
- if (selectedDef?.kind === "picker") {
533683
- onPickerChange(selectedDef.key, selectedDef.defaultValue);
533684
- }
533685
- }
533686
- return;
533687
- }
533688
- if (evt.name === "left" || evt.name === "right") {
533689
- if (selectedDef?.kind === "picker") {
533690
- const cur = router2?.[selectedDef.key] ?? selectedDef.defaultValue;
533691
- const curNum = typeof cur === "number" ? cur : selectedDef.defaultValue;
533692
- const idx = selectedDef.options.indexOf(curNum);
533693
- const base = idx < 0 ? selectedDef.options.indexOf(selectedDef.defaultValue) : idx;
533694
- const nextIdx = evt.name === "left" ? Math.max(0, base - 1) : Math.min(selectedDef.options.length - 1, base + 1);
533695
- onPickerChange(selectedDef.key, selectedDef.options[nextIdx] ?? selectedDef.defaultValue);
533696
- return;
533697
- }
533698
- const sIdx = CONFIG_SCOPES.indexOf(scope);
533699
- const next = evt.name === "left" ? CONFIG_SCOPES[(sIdx - 1 + CONFIG_SCOPES.length) % CONFIG_SCOPES.length] : CONFIG_SCOPES[(sIdx + 1) % CONFIG_SCOPES.length];
533700
- if (next && next !== scope) {
533701
- onScopeChange(next, scope);
533702
- }
533703
- return;
533920
+ const rows = import_react137.useMemo(() => {
533921
+ const out2 = [];
533922
+ for (const s2 of SECTIONS) {
533923
+ out2.push({
533924
+ kind: "header",
533925
+ section: s2
533926
+ });
533927
+ for (const d3 of s2.defs) {
533928
+ if (d3.kind === "slot")
533929
+ out2.push({
533930
+ kind: "slot",
533931
+ section: s2,
533932
+ def: d3
533933
+ });
533704
533934
  }
533705
- handleCursorNavKey(evt, setCursor, rows.length);
533706
- };
533707
- $5[13] = moveItem;
533708
- $5[14] = onClearSlot;
533709
- $5[15] = onClose;
533710
- $5[16] = onPickSlot;
533711
- $5[17] = onPickerChange;
533712
- $5[18] = onScopeChange;
533713
- $5[19] = router2;
533714
- $5[20] = rows.length;
533715
- $5[21] = scope;
533716
- $5[22] = selectedDef;
533717
- $5[23] = visible;
533718
- $5[24] = t6;
533719
- } else {
533720
- t6 = $5[24];
533721
- }
533722
- useKeyboard(t6);
533723
- if (!visible) {
533935
+ }
533936
+ return out2;
533937
+ }, []);
533938
+ const slotIndices = import_react137.useMemo(() => rows.map((r4, i4) => r4.kind === "slot" ? i4 : -1).filter((i_0) => i_0 >= 0), [rows]);
533939
+ const moveItem = (dir) => {
533940
+ if (slotIndices.length === 0)
533941
+ return;
533942
+ const cur = slotIndices.indexOf(cursor);
533943
+ const base = cur < 0 ? 0 : cur;
533944
+ const nextPos = (base + dir + slotIndices.length) % slotIndices.length;
533945
+ setCursor(slotIndices[nextPos] ?? slotIndices[0] ?? 0);
533946
+ };
533947
+ import_react137.useMemo(() => {
533948
+ if (cursor === 0 && slotIndices.length > 0 && slotIndices[0] !== 0) {
533949
+ setCursor(slotIndices[0] ?? 0);
533950
+ }
533951
+ }, [cursor, slotIndices]);
533952
+ const selectedRow = rows[cursor];
533953
+ const selectedDef = selectedRow?.kind === "slot" ? selectedRow.def : null;
533954
+ const pickerDefs = import_react137.useMemo(() => ALL_DEFS.filter((d_0) => d_0.kind === "picker"), []);
533955
+ useKeyboard((evt) => {
533956
+ if (!visible)
533957
+ return;
533958
+ if (evt.name === "escape" || evt.name === "q") {
533959
+ onClose();
533960
+ return;
533961
+ }
533962
+ if (evt.name === "up" || evt.name === "k") {
533963
+ moveItem(-1);
533964
+ return;
533965
+ }
533966
+ if (evt.name === "down" || evt.name === "j") {
533967
+ moveItem(1);
533968
+ return;
533969
+ }
533970
+ if (evt.name === "return") {
533971
+ if (selectedDef)
533972
+ onPickSlot(selectedDef.key);
533973
+ return;
533974
+ }
533975
+ if (evt.name === "d" || evt.name === "delete" || evt.name === "backspace") {
533976
+ if (selectedDef)
533977
+ onClearSlot(selectedDef.key);
533978
+ return;
533979
+ }
533980
+ if (evt.name === "left" || evt.name === "right") {
533981
+ const sIdx = CONFIG_SCOPES.indexOf(scope);
533982
+ const next = evt.name === "left" ? CONFIG_SCOPES[(sIdx - 1 + CONFIG_SCOPES.length) % CONFIG_SCOPES.length] : CONFIG_SCOPES[(sIdx + 1) % CONFIG_SCOPES.length];
533983
+ if (next && next !== scope)
533984
+ onScopeChange(next, scope);
533985
+ return;
533986
+ }
533987
+ handleCursorNavKey(evt, setCursor, rows.length);
533988
+ });
533989
+ if (!visible)
533724
533990
  return null;
533725
- }
533726
- let t7;
533727
- if ($5[25] !== router2) {
533728
- t7 = ALL_DEFS.filter((d_0) => d_0.kind === "slot" && typeof router2?.[d_0.key] === "string");
533729
- $5[25] = router2;
533730
- $5[26] = t7;
533731
- } else {
533732
- t7 = $5[26];
533733
- }
533734
- const customCount = t7.length;
533735
- let t8;
533736
- if ($5[27] === Symbol.for("react.memo_cache_sentinel")) {
533737
- t8 = ALL_DEFS.filter(_temp419);
533738
- $5[27] = t8;
533739
- } else {
533740
- t8 = $5[27];
533741
- }
533742
- const slotCount = t8.length;
533743
- const t9 = `${customCount} / ${slotCount} slots customized \xB7 scope: ${scope}`;
533744
- let t10;
533745
- if ($5[28] === Symbol.for("react.memo_cache_sentinel")) {
533746
- t10 = [{
533991
+ const customCount = ALL_DEFS.filter((d_1) => d_1.kind === "slot" && typeof router2?.[d_1.key] === "string").length;
533992
+ const slotCount = ALL_DEFS.filter((d_2) => d_2.kind === "slot").length;
533993
+ const labelCol = 12;
533994
+ const modelCol = Math.min(30, Math.max(18, Math.floor(contentW * 0.32)));
533995
+ const descCol = Math.max(8, contentW - 4 - labelCol - modelCol - 2);
533996
+ const shortModel = (m5) => {
533997
+ const slash = m5.indexOf("/");
533998
+ return slash > 0 ? m5.slice(slash + 1) : m5;
533999
+ };
534000
+ return /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV(PremiumPopup, {
534001
+ visible,
534002
+ width: popupW,
534003
+ height: popupH,
534004
+ title: "Task Router",
534005
+ titleIcon: "router",
534006
+ blurb: `${customCount}/${slotCount} set \xB7 ${scope} \xB7 default: ${shortModel(activeModel)}`,
534007
+ footerHints: [{
533747
534008
  key: "\u2191\u2193",
533748
534009
  label: "nav"
533749
534010
  }, {
533750
534011
  key: "Enter",
533751
- label: "pick model"
534012
+ label: "set"
533752
534013
  }, {
533753
534014
  key: "d",
533754
534015
  label: "reset"
533755
534016
  }, {
533756
534017
  key: "\u2190\u2192",
533757
- label: "scope / value"
534018
+ label: "scope"
533758
534019
  }, {
533759
534020
  key: "Esc",
533760
534021
  label: "close"
533761
- }];
533762
- $5[28] = t10;
533763
- } else {
533764
- t10 = $5[28];
533765
- }
533766
- const t11 = Math.max(6, popupH - 16);
533767
- let t12;
533768
- if ($5[29] !== contentW || $5[30] !== cursor || $5[31] !== expanded || $5[32] !== groups || $5[33] !== t11) {
533769
- t12 = /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV(GroupedList, {
533770
- groups,
533771
- expanded,
533772
- selectedIndex: cursor,
533773
- width: contentW,
533774
- maxRows: t11
533775
- }, undefined, false, undefined, this);
533776
- $5[29] = contentW;
533777
- $5[30] = cursor;
533778
- $5[31] = expanded;
533779
- $5[32] = groups;
533780
- $5[33] = t11;
533781
- $5[34] = t12;
533782
- } else {
533783
- t12 = $5[34];
533784
- }
533785
- let t13;
533786
- if ($5[35] === Symbol.for("react.memo_cache_sentinel")) {
533787
- t13 = /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV(VSpacer, {}, undefined, false, undefined, this);
533788
- $5[35] = t13;
533789
- } else {
533790
- t13 = $5[35];
533791
- }
533792
- let t14;
533793
- if ($5[36] !== router2) {
533794
- t14 = pickerDefs.map((def_1) => {
533795
- const cur_0 = router2?.[def_1.key];
533796
- const num = typeof cur_0 === "number" ? cur_0 : def_1.defaultValue;
533797
- return /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV(SegmentedControl, {
533798
- label: def_1.label,
533799
- labelWidth: 14,
533800
- options: def_1.options.map(_temp515),
533801
- value: num
533802
- }, def_1.key, false, undefined, this);
533803
- });
533804
- $5[36] = router2;
533805
- $5[37] = t14;
533806
- } else {
533807
- t14 = $5[37];
533808
- }
533809
- let t15;
533810
- if ($5[38] === Symbol.for("react.memo_cache_sentinel")) {
533811
- t15 = /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV(VSpacer, {}, undefined, false, undefined, this);
533812
- $5[38] = t15;
533813
- } else {
533814
- t15 = $5[38];
533815
- }
533816
- let t16;
533817
- if ($5[39] !== selectedDef) {
533818
- t16 = selectedDef ? /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV(Hint, {
533819
- children: selectedDef.hint
533820
- }, undefined, false, undefined, this) : null;
533821
- $5[39] = selectedDef;
533822
- $5[40] = t16;
533823
- } else {
533824
- t16 = $5[40];
533825
- }
533826
- let t17;
533827
- if ($5[41] === Symbol.for("react.memo_cache_sentinel")) {
533828
- t17 = /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV(VSpacer, {}, undefined, false, undefined, this);
533829
- $5[41] = t17;
533830
- } else {
533831
- t17 = $5[41];
533832
- }
533833
- let t18;
533834
- if ($5[42] === Symbol.for("react.memo_cache_sentinel")) {
533835
- t18 = CONFIG_SCOPES.map(_temp612);
533836
- $5[42] = t18;
533837
- } else {
533838
- t18 = $5[42];
533839
- }
533840
- let t19;
533841
- if ($5[43] !== scope) {
533842
- t19 = /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV(SegmentedControl, {
533843
- label: "Scope",
533844
- labelWidth: 14,
533845
- options: t18,
533846
- value: scope
533847
- }, undefined, false, undefined, this);
533848
- $5[43] = scope;
533849
- $5[44] = t19;
533850
- } else {
533851
- t19 = $5[44];
533852
- }
533853
- let t20;
533854
- if ($5[45] !== t12 || $5[46] !== t14 || $5[47] !== t16 || $5[48] !== t19) {
533855
- t20 = /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV(Section, {
534022
+ }],
534023
+ children: /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV(Section, {
533856
534024
  children: [
533857
- t12,
533858
- t13,
533859
- t14,
533860
- t15,
533861
- t16,
533862
- t17,
533863
- t19
534025
+ /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("box", {
534026
+ flexDirection: "column",
534027
+ backgroundColor: t2.bgPopup,
534028
+ children: rows.map((row, idx) => {
534029
+ if (row.kind === "header") {
534030
+ return /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("box", {
534031
+ flexDirection: "column",
534032
+ backgroundColor: t2.bgPopup,
534033
+ children: [
534034
+ idx > 0 ? /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("box", {
534035
+ height: 1,
534036
+ backgroundColor: t2.bgPopup
534037
+ }, undefined, false, undefined, this) : null,
534038
+ /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("text", {
534039
+ bg: t2.bgPopup,
534040
+ fg: t2.brandAlt,
534041
+ attributes: BOLD18,
534042
+ children: row.section.title
534043
+ }, undefined, false, undefined, this)
534044
+ ]
534045
+ }, `h-${idx}`, true, undefined, this);
534046
+ }
534047
+ const isSelected = idx === cursor;
534048
+ const rowBg = isSelected ? t2.bgPopupHighlight : t2.bgPopup;
534049
+ const raw2 = router2?.[row.def.key] ?? null;
534050
+ const modelId = typeof raw2 === "string" ? raw2 : null;
534051
+ const descFg = isSelected ? t2.textSecondary : t2.textMuted;
534052
+ const label = row.def.label.padEnd(labelCol).slice(0, labelCol);
534053
+ const desc = truncate4(row.def.hint, descCol).padEnd(descCol).slice(0, descCol);
534054
+ return /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("box", {
534055
+ flexDirection: "row",
534056
+ height: 1,
534057
+ backgroundColor: rowBg,
534058
+ children: [
534059
+ /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("text", {
534060
+ bg: rowBg,
534061
+ fg: isSelected ? t2.brandSecondary : t2.textFaint,
534062
+ attributes: BOLD18,
534063
+ children: isSelected ? "\u25B8 " : " "
534064
+ }, undefined, false, undefined, this),
534065
+ /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("text", {
534066
+ bg: rowBg,
534067
+ fg: t2.textPrimary,
534068
+ attributes: BOLD18,
534069
+ children: label
534070
+ }, undefined, false, undefined, this),
534071
+ /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("text", {
534072
+ bg: rowBg,
534073
+ fg: descFg,
534074
+ children: desc
534075
+ }, undefined, false, undefined, this),
534076
+ /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("box", {
534077
+ flexGrow: 1,
534078
+ backgroundColor: rowBg
534079
+ }, undefined, false, undefined, this),
534080
+ modelId ? /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("text", {
534081
+ bg: rowBg,
534082
+ fg: t2.brandAlt,
534083
+ attributes: BOLD18,
534084
+ children: truncate4(shortModel(modelId), modelCol)
534085
+ }, undefined, false, undefined, this) : /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("text", {
534086
+ bg: rowBg,
534087
+ fg: t2.textDim,
534088
+ children: "\u2014"
534089
+ }, undefined, false, undefined, this),
534090
+ /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("text", {
534091
+ bg: rowBg,
534092
+ children: " "
534093
+ }, undefined, false, undefined, this)
534094
+ ]
534095
+ }, `s-${idx}`, true, undefined, this);
534096
+ })
534097
+ }, undefined, false, undefined, this),
534098
+ /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV(VSpacer, {}, undefined, false, undefined, this),
534099
+ pickerDefs.map((def) => {
534100
+ const cur_0 = router2?.[def.key];
534101
+ const num = typeof cur_0 === "number" ? cur_0 : def.defaultValue;
534102
+ return /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV(SegmentedControl, {
534103
+ label: def.label,
534104
+ labelWidth: 14,
534105
+ options: def.options.map((o3) => ({
534106
+ value: o3,
534107
+ label: String(o3)
534108
+ })),
534109
+ value: num
534110
+ }, def.key, false, undefined, this);
534111
+ }),
534112
+ /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV(VSpacer, {}, undefined, false, undefined, this),
534113
+ /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV(SegmentedControl, {
534114
+ label: "Scope",
534115
+ labelWidth: 14,
534116
+ options: CONFIG_SCOPES.map((s_0) => ({
534117
+ value: s_0,
534118
+ label: s_0
534119
+ })),
534120
+ value: scope
534121
+ }, undefined, false, undefined, this)
533864
534122
  ]
533865
- }, undefined, true, undefined, this);
533866
- $5[45] = t12;
533867
- $5[46] = t14;
533868
- $5[47] = t16;
533869
- $5[48] = t19;
533870
- $5[49] = t20;
533871
- } else {
533872
- t20 = $5[49];
533873
- }
533874
- let t21;
533875
- if ($5[50] !== popupH || $5[51] !== popupW || $5[52] !== t20 || $5[53] !== t9 || $5[54] !== visible) {
533876
- t21 = /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV(PremiumPopup, {
533877
- visible,
533878
- width: popupW,
533879
- height: popupH,
533880
- title: "Task Router",
533881
- titleIcon: "router",
533882
- blurb: t9,
533883
- footerHints: t10,
533884
- children: t20
533885
- }, undefined, false, undefined, this);
533886
- $5[50] = popupH;
533887
- $5[51] = popupW;
533888
- $5[52] = t20;
533889
- $5[53] = t9;
533890
- $5[54] = visible;
533891
- $5[55] = t21;
533892
- } else {
533893
- t21 = $5[55];
533894
- }
533895
- return t21;
533896
- }
533897
- function _temp612(s_0) {
533898
- return {
533899
- value: s_0,
533900
- label: s_0
533901
- };
533902
- }
533903
- function _temp515(o3) {
533904
- return {
533905
- value: o3,
533906
- label: String(o3)
533907
- };
533908
- }
533909
- function _temp419(d_1) {
533910
- return d_1.kind === "slot";
533911
- }
533912
- function _temp324(g3) {
533913
- return g3.id;
533914
- }
533915
- function _temp230(d3) {
533916
- return d3.kind === "picker";
533917
- }
533918
- function _temp91(def) {
533919
- return def.kind === "slot";
534123
+ }, undefined, true, undefined, this)
534124
+ }, undefined, false, undefined, this);
533920
534125
  }
533921
- var import_compiler_runtime74, import_react137, SECTIONS, ALL_DEFS;
534126
+ var import_react137, BOLD18 = 1, SECTIONS, ALL_DEFS;
533922
534127
  var init_RouterSettings = __esm(async () => {
533923
534128
  init_theme();
533924
534129
  init_shared2();
533925
534130
  init_ui2();
533926
534131
  init_jsx_dev_runtime();
533927
534132
  await init_react2();
533928
- import_compiler_runtime74 = __toESM(require_compiler_runtime(), 1);
533929
534133
  import_react137 = __toESM(require_react(), 1);
533930
534134
  SECTIONS = [{
533931
534135
  id: "main",
533932
- title: "Main Agent",
533933
- subtitle: "Model that handles your conversation",
534136
+ title: "Main",
533934
534137
  defs: [{
533935
534138
  kind: "slot",
533936
534139
  key: "default",
533937
534140
  label: "Default",
533938
534141
  icon: "model",
533939
- hint: "Fallback for background tasks when no specific model is set"
534142
+ hint: "Conversation & fallback"
533940
534143
  }]
533941
534144
  }, {
533942
534145
  id: "dispatch",
533943
534146
  title: "Dispatch",
533944
- subtitle: "Models for parallel subagents",
533945
534147
  defs: [{
533946
534148
  kind: "slot",
533947
534149
  key: "spark",
533948
534150
  label: "Explore",
533949
534151
  icon: "read_only",
533950
- hint: "Read-only agents \u2014 searches, reads, analyzes"
534152
+ hint: "Read-only agents"
533951
534153
  }, {
533952
534154
  kind: "slot",
533953
534155
  key: "ember",
533954
534156
  label: "Code",
533955
534157
  icon: "edit",
533956
- hint: "Edit agents \u2014 reads files, makes changes"
534158
+ hint: "Edit agents"
533957
534159
  }, {
533958
534160
  kind: "slot",
533959
534161
  key: "webSearch",
533960
534162
  label: "Web",
533961
534163
  icon: "web",
533962
- hint: "Searches the web & fetches pages"
534164
+ hint: "Web search & fetch"
533963
534165
  }, {
533964
534166
  kind: "picker",
533965
534167
  key: "maxConcurrentAgents",
533966
534168
  label: "Concurrency",
533967
534169
  icon: "dispatch",
533968
- hint: "Max parallel agents per dispatch (default 3)",
534170
+ hint: "Max parallel agents",
533969
534171
  options: [2, 3, 4, 5, 6, 7, 8],
533970
534172
  defaultValue: 3
533971
534173
  }]
533972
534174
  }, {
533973
534175
  id: "post",
533974
534176
  title: "Post-Dispatch",
533975
- subtitle: "Quality checks after code agents finish",
533976
534177
  defs: [{
533977
534178
  kind: "slot",
533978
534179
  key: "desloppify",
533979
534180
  label: "Cleanup",
533980
534181
  icon: "cleanup",
533981
- hint: "Post-dispatch polish & style fixes"
534182
+ hint: "Polish & style fixes"
533982
534183
  }, {
533983
534184
  kind: "slot",
533984
534185
  key: "verify",
533985
534186
  label: "Review",
533986
534187
  icon: "review",
533987
- hint: "Adversarial review after code agents"
534188
+ hint: "Adversarial review"
533988
534189
  }]
533989
534190
  }, {
533990
534191
  id: "bg",
533991
534192
  title: "Background",
533992
- subtitle: "Internal tasks \u2014 usually fine on defaults",
533993
534193
  defs: [{
533994
534194
  kind: "slot",
533995
534195
  key: "compact",
533996
534196
  label: "Compaction",
533997
534197
  icon: "compact_task",
533998
- hint: "Summarizes old context when conversation grows long"
534198
+ hint: "Summarize old context"
533999
534199
  }, {
534000
534200
  kind: "slot",
534001
534201
  key: "semantic",
534002
534202
  label: "Soul Map",
534003
534203
  icon: "repomap",
534004
- hint: "Generates symbol summaries for the repo map"
534204
+ hint: "Symbol summaries"
534005
534205
  }]
534006
534206
  }];
534007
534207
  ALL_DEFS = SECTIONS.flatMap((s2) => s2.defs);
@@ -534011,7 +534211,7 @@ var init_RouterSettings = __esm(async () => {
534011
534211
  import { existsSync as existsSync51 } from "fs";
534012
534212
  import { join as join60 } from "path";
534013
534213
  function SearchSkillRow(t0) {
534014
- const $5 = import_compiler_runtime75.c(32);
534214
+ const $5 = import_compiler_runtime74.c(32);
534015
534215
  const {
534016
534216
  skill,
534017
534217
  isSelected,
@@ -534146,7 +534346,7 @@ function SearchSkillRow(t0) {
534146
534346
  return t12;
534147
534347
  }
534148
534348
  function InstalledSkillRow(t0) {
534149
- const $5 = import_compiler_runtime75.c(23);
534349
+ const $5 = import_compiler_runtime74.c(23);
534150
534350
  const {
534151
534351
  skill,
534152
534352
  isSelected,
@@ -534248,7 +534448,7 @@ function InstalledSkillRow(t0) {
534248
534448
  return t10;
534249
534449
  }
534250
534450
  function ActiveSkillRow(t0) {
534251
- const $5 = import_compiler_runtime75.c(17);
534451
+ const $5 = import_compiler_runtime74.c(17);
534252
534452
  const {
534253
534453
  name: name39,
534254
534454
  isSelected
@@ -534325,7 +534525,7 @@ function ActiveSkillRow(t0) {
534325
534525
  return t8;
534326
534526
  }
534327
534527
  function SkillSearch(t0) {
534328
- const $5 = import_compiler_runtime75.c(145);
534528
+ const $5 = import_compiler_runtime74.c(145);
534329
534529
  const {
534330
534530
  visible,
534331
534531
  contextManager,
@@ -534406,7 +534606,7 @@ function SkillSearch(t0) {
534406
534606
  const filterQuery = query2.toLowerCase().trim();
534407
534607
  let t82;
534408
534608
  if ($5[12] !== installed2) {
534409
- t82 = new Set(installed2.map(_temp96));
534609
+ t82 = new Set(installed2.map(_temp98));
534410
534610
  $5[12] = installed2;
534411
534611
  $5[13] = t82;
534412
534612
  } else {
@@ -534483,7 +534683,7 @@ function SkillSearch(t0) {
534483
534683
  setCursor(0);
534484
534684
  refreshInstalled();
534485
534685
  refreshActive();
534486
- listPopularSkills().then((r4) => setPopular(r4)).catch(_temp231);
534686
+ listPopularSkills().then((r4) => setPopular(r4)).catch(_temp230);
534487
534687
  }
534488
534688
  };
534489
534689
  t13 = [visible, refreshActive, refreshInstalled];
@@ -534649,7 +534849,7 @@ function SkillSearch(t0) {
534649
534849
  return;
534650
534850
  }
534651
534851
  if (evt.name === "up" || evt.name === "down") {
534652
- setScopeCursor(_temp325);
534852
+ setScopeCursor(_temp324);
534653
534853
  return;
534654
534854
  }
534655
534855
  if (evt.name === "return") {
@@ -534714,12 +534914,12 @@ function SkillSearch(t0) {
534714
534914
  return;
534715
534915
  }
534716
534916
  if (evt.name === "backspace" || evt.name === "delete") {
534717
- setQuery(_temp420);
534917
+ setQuery(_temp419);
534718
534918
  resetScroll();
534719
534919
  return;
534720
534920
  }
534721
534921
  if (evt.name === "space") {
534722
- setQuery(_temp516);
534922
+ setQuery(_temp515);
534723
534923
  resetScroll();
534724
534924
  return;
534725
534925
  }
@@ -534810,7 +535010,7 @@ function SkillSearch(t0) {
534810
535010
  t26 = $5[77];
534811
535011
  }
534812
535012
  t27 = tab;
534813
- t28 = footerHints.map(_temp613);
535013
+ t28 = footerHints.map(_temp612);
534814
535014
  $5[64] = popupWidth;
534815
535015
  $5[65] = tab;
534816
535016
  $5[66] = termRows;
@@ -535035,7 +535235,7 @@ function SkillSearch(t0) {
535035
535235
  selectedIndex: cursor,
535036
535236
  width: contentW,
535037
535237
  maxRows: maxVisible,
535038
- keyExtractor: _temp810,
535238
+ keyExtractor: _temp811,
535039
535239
  emptyMessage: query2 ? "no matching skills" : "no installed skills found",
535040
535240
  renderItem: (skill_4, t372) => {
535041
535241
  const {
@@ -535067,7 +535267,7 @@ function SkillSearch(t0) {
535067
535267
  selectedIndex: cursor,
535068
535268
  width: contentW,
535069
535269
  maxRows: maxVisible,
535070
- keyExtractor: _temp95,
535270
+ keyExtractor: _temp97,
535071
535271
  emptyMessage: query2 ? "no matching skills" : "no active skills \u2014 load from Installed tab",
535072
535272
  renderItem: (name_2, t382) => {
535073
535273
  const {
@@ -535129,35 +535329,35 @@ function SkillSearch(t0) {
535129
535329
  }
535130
535330
  return t38;
535131
535331
  }
535132
- function _temp95(name_1) {
535332
+ function _temp97(name_1) {
535133
535333
  return name_1;
535134
535334
  }
535135
- function _temp810(s_3) {
535335
+ function _temp811(s_3) {
535136
535336
  return s_3.path;
535137
535337
  }
535138
535338
  function _temp711(s_2) {
535139
535339
  return s_2.id;
535140
535340
  }
535141
- function _temp613(h3) {
535341
+ function _temp612(h3) {
535142
535342
  return {
535143
535343
  key: h3.key.replace("\u2191\u2193", "\u2191\u2193").replace("\u23CE", "Enter"),
535144
535344
  label: h3.label
535145
535345
  };
535146
535346
  }
535147
- function _temp516(prev_3) {
535347
+ function _temp515(prev_3) {
535148
535348
  return `${prev_3} `;
535149
535349
  }
535150
- function _temp420(prev_2) {
535350
+ function _temp419(prev_2) {
535151
535351
  return prev_2.slice(0, -1);
535152
535352
  }
535153
- function _temp325(prev) {
535353
+ function _temp324(prev) {
535154
535354
  return prev === 0 ? 1 : 0;
535155
535355
  }
535156
- function _temp231() {}
535157
- function _temp96(s2) {
535356
+ function _temp230() {}
535357
+ function _temp98(s2) {
535158
535358
  return s2.name;
535159
535359
  }
535160
- var import_compiler_runtime75, import_react139, MAX_POPUP_WIDTH5 = 120, CHROME_ROWS7 = 9, TABS6;
535360
+ var import_compiler_runtime74, import_react139, MAX_POPUP_WIDTH5 = 120, CHROME_ROWS7 = 9, TABS6;
535161
535361
  var init_SkillSearch = __esm(async () => {
535162
535362
  init_manager3();
535163
535363
  init_theme();
@@ -535167,14 +535367,14 @@ var init_SkillSearch = __esm(async () => {
535167
535367
  init_core4(),
535168
535368
  init_react2()
535169
535369
  ]);
535170
- import_compiler_runtime75 = __toESM(require_compiler_runtime(), 1);
535370
+ import_compiler_runtime74 = __toESM(require_compiler_runtime(), 1);
535171
535371
  import_react139 = __toESM(require_react(), 1);
535172
535372
  TABS6 = ["search", "installed", "active"];
535173
535373
  });
535174
535374
 
535175
535375
  // src/components/settings/ToolsPopup.tsx
535176
535376
  function ToolsPopup(t0) {
535177
- const $5 = import_compiler_runtime76.c(29);
535377
+ const $5 = import_compiler_runtime75.c(29);
535178
535378
  const {
535179
535379
  visible,
535180
535380
  disabledTools,
@@ -535354,13 +535554,13 @@ function ToolsPopup(t0) {
535354
535554
  }
535355
535555
  return t13;
535356
535556
  }
535357
- var import_compiler_runtime76, import_react141;
535557
+ var import_compiler_runtime75, import_react141;
535358
535558
  var init_ToolsPopup = __esm(async () => {
535359
535559
  init_constants();
535360
535560
  init_ui2();
535361
535561
  init_jsx_dev_runtime();
535362
535562
  await init_react2();
535363
- import_compiler_runtime76 = __toESM(require_compiler_runtime(), 1);
535563
+ import_compiler_runtime75 = __toESM(require_compiler_runtime(), 1);
535364
535564
  import_react141 = __toESM(require_react(), 1);
535365
535565
  });
535366
535566
 
@@ -535457,7 +535657,7 @@ __export(exports_App, {
535457
535657
  });
535458
535658
  import { spawn as spawn24 } from "child_process";
535459
535659
  import { join as join61 } from "path";
535460
- function truncate4(str, max) {
535660
+ function truncate5(str, max) {
535461
535661
  return str.length > max ? `${str.slice(0, max - 1)}\u2026` : str;
535462
535662
  }
535463
535663
  function lerpHex3(a2, b5, tVal) {
@@ -535474,7 +535674,7 @@ function lerpHex3(a2, b5, tVal) {
535474
535674
  return `#${hex3(r4)}${hex3(g3)}${hex3(bl)}`;
535475
535675
  }
535476
535676
  function ShutdownSplash(t0) {
535477
- const $5 = import_compiler_runtime77.c(39);
535677
+ const $5 = import_compiler_runtime76.c(39);
535478
535678
  const {
535479
535679
  phase,
535480
535680
  sessionId,
@@ -535497,7 +535697,7 @@ function ShutdownSplash(t0) {
535497
535697
  let t3;
535498
535698
  if ($5[2] === Symbol.for("react.memo_cache_sentinel")) {
535499
535699
  t2 = () => {
535500
- const timer = setInterval(() => setTick(_temp98), 80);
535700
+ const timer = setInterval(() => setTick(_temp99), 80);
535501
535701
  return () => clearInterval(timer);
535502
535702
  };
535503
535703
  t3 = [];
@@ -535711,11 +535911,11 @@ function ShutdownSplash(t0) {
535711
535911
  }
535712
535912
  return t13;
535713
535913
  }
535714
- function _temp98(t2) {
535914
+ function _temp99(t2) {
535715
535915
  return t2 + 1;
535716
535916
  }
535717
535917
  function CheckpointLegend(t0) {
535718
- const $5 = import_compiler_runtime77.c(35);
535918
+ const $5 = import_compiler_runtime76.c(35);
535719
535919
  const {
535720
535920
  tabId,
535721
535921
  fallbackSpacer
@@ -536931,7 +537131,7 @@ function App({
536931
537131
  }, undefined, true, undefined, this),
536932
537132
  /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("span", {
536933
537133
  fg: t2.textSecondary,
536934
- children: truncate4(displayModel, isProxy || isGateway ? 20 : 28)
537134
+ children: truncate5(displayModel, isProxy || isGateway ? 20 : 28)
536935
537135
  }, undefined, false, undefined, this)
536936
537136
  ]
536937
537137
  }, undefined, true, undefined, this),
@@ -536947,7 +537147,7 @@ function App({
536947
537147
  children: [
536948
537148
  UI_ICONS.git,
536949
537149
  " ",
536950
- truncate4(git.branch ?? "HEAD", termWidth >= 120 ? 30 : 15),
537150
+ truncate5(git.branch ?? "HEAD", termWidth >= 120 ? 30 : 15),
536951
537151
  git.isDirty ? "*" : ""
536952
537152
  ]
536953
537153
  }, undefined, true, undefined, this)
@@ -537387,7 +537587,7 @@ function App({
537387
537587
  ]
537388
537588
  }, undefined, true, undefined, this);
537389
537589
  }
537390
- var import_compiler_runtime77, import_react143, ABORT_ON_LOADING, DEFAULT_TASK_ROUTER, SHUTDOWN_STEPS, KITTY_PROTOCOL_RESPONSE_RE;
537590
+ var import_compiler_runtime76, import_react143, ABORT_ON_LOADING, DEFAULT_TASK_ROUTER, SHUTDOWN_STEPS, KITTY_PROTOCOL_RESPONSE_RE;
537391
537591
  var init_App = __esm(async () => {
537392
537592
  init_shallow2();
537393
537593
  init_config2();
@@ -537464,7 +537664,7 @@ var init_App = __esm(async () => {
537464
537664
  init_SkillSearch(),
537465
537665
  init_ToolsPopup()
537466
537666
  ]);
537467
- import_compiler_runtime77 = __toESM(require_compiler_runtime(), 1);
537667
+ import_compiler_runtime76 = __toESM(require_compiler_runtime(), 1);
537468
537668
  import_react143 = __toESM(require_react(), 1);
537469
537669
  startMemoryPoll();
537470
537670
  ABORT_ON_LOADING = new Set(["/clear", "/compact", "/plan", "/session clear", "/session compact", "/session plan"]);