@proxysoul/soulforge 2.14.4 → 2.14.6

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.4",
57931
+ version: "2.14.6",
57928
57932
  description: "Graph-powered code intelligence \u2014 multi-agent coding with codebase-aware AI",
57929
57933
  repository: {
57930
57934
  type: "git",
@@ -87734,7 +87738,7 @@ function getModelCapabilities3(modelId) {
87734
87738
  provider: "anthropic",
87735
87739
  thinking: true,
87736
87740
  adaptiveThinking: true,
87737
- effort: true,
87741
+ effort: !base.includes("haiku"),
87738
87742
  speed: base.includes("opus"),
87739
87743
  contextManagement: !base.includes("haiku"),
87740
87744
  interleavedThinking: true,
@@ -87803,6 +87807,8 @@ function getSupportedClaudeEfforts(modelId) {
87803
87807
  const base = extractBaseModel(modelId);
87804
87808
  if (!base.startsWith("claude"))
87805
87809
  return null;
87810
+ if (base.includes("haiku"))
87811
+ return null;
87806
87812
  const v = parseOpusVersion(base);
87807
87813
  if (v && (v.major >= 5 || v.major === 4 && v.minor >= 7)) {
87808
87814
  return ["max", "xhigh", "high", "medium", "low"];
@@ -349011,12 +349017,16 @@ class RepoMap {
349011
349017
  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
349018
  symbol_name = COALESCE((SELECT s.name FROM symbols s WHERE s.id = semantic_summaries.symbol_id), '')
349013
349019
  WHERE file_path = '' AND symbol_id IN (SELECT id FROM symbols)`);
349014
- } catch {}
349020
+ } catch (e) {
349021
+ this.onError?.(`backfillSummaryPaths failed: ${e instanceof Error ? e.message : String(e)}`);
349022
+ }
349015
349023
  }
349016
349024
  cleanOrphanedSummaries() {
349017
349025
  try {
349018
349026
  this.db.run("DELETE FROM semantic_summaries WHERE symbol_id NOT IN (SELECT id FROM symbols) AND (source != 'llm' OR file_path = '')");
349019
- } catch {}
349027
+ } catch (e) {
349028
+ this.onError?.(`cleanOrphanedSummaries failed: ${e instanceof Error ? e.message : String(e)}`);
349029
+ }
349020
349030
  }
349021
349031
  get isReady() {
349022
349032
  return this.ready;
@@ -350645,11 +350655,15 @@ class RepoMap {
350645
350655
  try {
350646
350656
  const st = await statAsync(absPath);
350647
350657
  this.indexFile(absPath, relPath, st.mtimeMs, language);
350648
- } catch {}
350658
+ } catch (e) {
350659
+ this.onError?.(`reindex failed for ${relPath}: ${e instanceof Error ? e.message : String(e)}`);
350660
+ }
350649
350661
  }
350650
350662
  this.markDirty();
350651
350663
  };
350652
- process3().catch(() => {});
350664
+ process3().catch((e) => {
350665
+ this.onError?.(`flushReindex failed: ${e instanceof Error ? e.message : String(e)}`);
350666
+ });
350653
350667
  }
350654
350668
  markDirty() {
350655
350669
  this.dirty = true;
@@ -350689,7 +350703,9 @@ class RepoMap {
350689
350703
  const content = readFileSync17(join26(this.cwd, file2.path), "utf-8");
350690
350704
  fileContents.set(file2.id, content.split(`
350691
350705
  `));
350692
- } catch {}
350706
+ } catch (e) {
350707
+ this.onError?.(`failed to read ${file2.path} for call graph: ${e instanceof Error ? e.message : String(e)}`);
350708
+ }
350693
350709
  if (i2 % 20 === 19)
350694
350710
  await tick();
350695
350711
  }
@@ -352097,7 +352113,9 @@ class RepoMap {
352097
352113
  if (this.flushPromise) {
352098
352114
  try {
352099
352115
  await this.flushPromise;
352100
- } catch {}
352116
+ } catch (e) {
352117
+ this.onError?.(`error awaiting pending flush during close: ${e instanceof Error ? e.message : String(e)}`);
352118
+ }
352101
352119
  }
352102
352120
  this.db.close();
352103
352121
  }
@@ -379599,8 +379617,20 @@ async function repairToolCall({
379599
379617
  input: repaired
379600
379618
  };
379601
379619
  }
379620
+ function isAbnormalFinish(reason) {
379621
+ return reason === "length" || reason === "content-filter" || reason === "error";
379622
+ }
379623
+ function describeAbnormalFinish(reason) {
379624
+ if (reason === "length")
379625
+ return `Model output truncated at ${MAX_OUTPUT_TOKENS} tokens (finish_reason=length). Set SOULFORGE_MAX_OUTPUT_TOKENS to raise the cap.`;
379626
+ if (reason === "content-filter")
379627
+ return "Model response blocked by content filter (finish_reason=content-filter).";
379628
+ return "Model returned finish_reason=error.";
379629
+ }
379630
+ var MAX_OUTPUT_TOKENS;
379602
379631
  var init_stream_options = __esm(() => {
379603
379632
  init_esm11();
379633
+ MAX_OUTPUT_TOKENS = Number(process.env.SOULFORGE_MAX_OUTPUT_TOKENS) || 32000;
379604
379634
  });
379605
379635
 
379606
379636
  // src/core/agents/web-search.ts
@@ -379617,6 +379647,12 @@ function createWebSearchAgent(model, opts) {
379617
379647
  ...supportsTemperature(getModelId(model)) ? {
379618
379648
  temperature: 0
379619
379649
  } : {},
379650
+ maxOutputTokens: MAX_OUTPUT_TOKENS,
379651
+ onStepFinish: (step) => {
379652
+ if (isAbnormalFinish(step.finishReason)) {
379653
+ logBackgroundError("agent-error", `web-search: ${describeAbnormalFinish(step.finishReason)}`);
379654
+ }
379655
+ },
379620
379656
  tools: {
379621
379657
  web_search: tool({
379622
379658
  description: webSearchScraper.description,
@@ -379672,6 +379708,7 @@ var init_web_search = __esm(() => {
379672
379708
  init_dist5();
379673
379709
  init_zod();
379674
379710
  init_config2();
379711
+ init_errors();
379675
379712
  init_provider_options();
379676
379713
  init_settings();
379677
379714
  init_fetch_page();
@@ -379853,72 +379890,21 @@ var init_web_search2 = __esm(() => {
379853
379890
  // src/core/tools/bus-cache.ts
379854
379891
  import { readFile as readFileAsync } from "fs/promises";
379855
379892
  import { resolve as resolve35 } from "path";
379856
- function wrapWithBusCache(tools, bus, agentId, repoMap) {
379893
+ function wrapWithBusCache(tools, bus, agentId) {
379857
379894
  const wrapped = {
379858
379895
  ...tools
379859
379896
  };
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) {
379897
+ function makeCachedExecute(origExecute, keyFn) {
379908
379898
  return async (args2, opts) => {
379909
379899
  const key2 = keyFn(args2);
379910
379900
  if (key2) {
379911
379901
  const acquired = bus.acquireToolResult(agentId, key2);
379912
- if (acquired.hit === true) {
379913
- onExecute?.(args2, true);
379902
+ if (acquired.hit === true)
379914
379903
  return acquired.result;
379915
- }
379916
379904
  if (acquired.hit === "waiting") {
379917
379905
  const waited = await acquired.result;
379918
- if (waited != null) {
379919
- onExecute?.(args2, true);
379906
+ if (waited != null)
379920
379907
  return waited;
379921
- }
379922
379908
  }
379923
379909
  }
379924
379910
  const result = await origExecute(args2, opts);
@@ -379926,64 +379912,60 @@ ${text2}`
379926
379912
  const content = typeof result === "string" ? result : typeof result?.output === "string" ? String(result.output) : JSON.stringify(result);
379927
379913
  bus.cacheToolResult(agentId, key2, content);
379928
379914
  }
379929
- onExecute?.(args2, false);
379930
379915
  return result;
379931
379916
  };
379932
379917
  }
379933
379918
  const readFile19 = tools.read;
379934
379919
  if (readFile19?.execute) {
379935
379920
  const origExecute = readFile19.execute;
379921
+ const collectPaths = (args2) => {
379922
+ if (Array.isArray(args2.files))
379923
+ return args2.files;
379924
+ if (args2.files && typeof args2.files === "object")
379925
+ return [args2.files];
379926
+ if (typeof args2.path === "string") {
379927
+ return [{
379928
+ path: args2.path,
379929
+ ...args2.startLine != null || args2.endLine != null ? {
379930
+ ranges: [{
379931
+ start: args2.startLine ?? 1,
379932
+ end: args2.endLine ?? 0
379933
+ }]
379934
+ } : {}
379935
+ }];
379936
+ }
379937
+ return [];
379938
+ };
379936
379939
  wrapped.read = deriveTool(readFile19, {
379937
379940
  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) {
379941
+ const result = await origExecute(args2, opts);
379942
+ for (const spec3 of collectPaths(args2)) {
379943
+ if (!spec3?.path)
379944
+ continue;
379945
+ const normalized = normalizePath(spec3.path);
379946
+ if (!normalized)
379947
+ continue;
379948
+ if (spec3.ranges && spec3.ranges.length > 0) {
379949
+ for (const r of spec3.ranges) {
379950
+ bus.recordFileRead(agentId, normalized, {
379951
+ tool: "read",
379952
+ startLine: r.start,
379953
+ endLine: r.end,
379954
+ cached: false
379955
+ });
379956
+ }
379957
+ } else {
379953
379958
  bus.recordFileRead(agentId, normalized, {
379954
379959
  tool: "read",
379955
- cached: true
379960
+ ...spec3.target ? {
379961
+ target: spec3.target,
379962
+ name: spec3.name
379963
+ } : {},
379964
+ cached: false
379956
379965
  });
379957
- return tagCacheHit(content, normalized);
379958
379966
  }
379959
379967
  }
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
- }
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
- }
379968
+ return result;
379987
379969
  }
379988
379970
  });
379989
379971
  }
@@ -380109,7 +380091,7 @@ ${text2}`;
380109
380091
  const t = tools[spec3.name];
380110
380092
  if (t?.execute) {
380111
380093
  wrapped[spec3.name] = deriveTool(t, {
380112
- execute: makeCachedExecute(t.execute, spec3.keyFn, spec3.onExecute)
380094
+ execute: makeCachedExecute(t.execute, spec3.keyFn)
380113
380095
  });
380114
380096
  }
380115
380097
  }
@@ -382436,9 +382418,6 @@ function buildPrepareStep({
382436
382418
  }
382437
382419
  if (sanitizedMessages)
382438
382420
  result.messages = sanitizedMessages;
382439
- if (stepNumber === 0) {
382440
- result.toolChoice = "required";
382441
- }
382442
382421
  if (!disablePruning && stepNumber >= 2) {
382443
382422
  const src = result.messages ?? messages;
382444
382423
  const compacted = compactOldToolResults(src, symbolLookup);
@@ -382719,7 +382698,7 @@ function createCodeAgent(model, options) {
382719
382698
  repoMap: options?.repoMap
382720
382699
  });
382721
382700
  if (hasBus) {
382722
- tools = wrapWithBusCache(tools, bus, agentId, options?.repoMap);
382701
+ tools = wrapWithBusCache(tools, bus, agentId);
382723
382702
  }
382724
382703
  allTools = {
382725
382704
  ...tools,
@@ -382752,6 +382731,12 @@ function createCodeAgent(model, options) {
382752
382731
  ...supportsTemperature(getModelId(model)) ? {
382753
382732
  temperature: 0
382754
382733
  } : {},
382734
+ maxOutputTokens: MAX_OUTPUT_TOKENS,
382735
+ onStepFinish: (step) => {
382736
+ if (isAbnormalFinish(step.finishReason)) {
382737
+ logBackgroundError("agent-error", `${options?.agentId ?? "code"}: ${describeAbnormalFinish(step.finishReason)}`);
382738
+ }
382739
+ },
382755
382740
  tools: allTools,
382756
382741
  instructions: {
382757
382742
  role: "system",
@@ -382786,6 +382771,7 @@ Coordination: report_finding after significant changes (paths, what changed, new
382786
382771
  var init_code = __esm(() => {
382787
382772
  init_dist5();
382788
382773
  init_config2();
382774
+ init_errors();
382789
382775
  init_provider_options();
382790
382776
  init_settings();
382791
382777
  init_tools();
@@ -382840,7 +382826,7 @@ function createExploreAgent(model, options) {
382840
382826
  tabId: options?.tabId
382841
382827
  });
382842
382828
  if (hasBus) {
382843
- tools = wrapWithBusCache(tools, bus, agentId, options?.repoMap);
382829
+ tools = wrapWithBusCache(tools, bus, agentId);
382844
382830
  }
382845
382831
  allTools = {
382846
382832
  ...tools,
@@ -382873,6 +382859,12 @@ function createExploreAgent(model, options) {
382873
382859
  ...supportsTemperature(getModelId(model)) ? {
382874
382860
  temperature: 0
382875
382861
  } : {},
382862
+ maxOutputTokens: MAX_OUTPUT_TOKENS,
382863
+ onStepFinish: (step) => {
382864
+ if (isAbnormalFinish(step.finishReason)) {
382865
+ logBackgroundError("agent-error", `${options?.agentId ?? "explore"}: ${describeAbnormalFinish(step.finishReason)}`);
382866
+ }
382867
+ },
382876
382868
  tools: allTools,
382877
382869
  instructions: {
382878
382870
  role: "system",
@@ -382905,6 +382897,7 @@ Coordination: report_finding after discoveries \u2014 especially shared symbols/
382905
382897
  var init_explore = __esm(() => {
382906
382898
  init_dist5();
382907
382899
  init_config2();
382900
+ init_errors();
382908
382901
  init_provider_options();
382909
382902
  init_settings();
382910
382903
  init_tools();
@@ -386905,147 +386898,42 @@ var init_mcp2 = __esm(() => {
386905
386898
  // src/core/agents/agent-results.ts
386906
386899
  import { mkdir as mkdir8, readdir as readdir6, rm as rm2, writeFile as writeFile15 } from "fs/promises";
386907
386900
  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
386901
  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;
386902
+ for (let i2 = result.steps.length - 1;i2 >= 0; i2--) {
386903
+ const step = result.steps[i2];
386904
+ if (!step)
386905
+ continue;
386906
+ const direct = step.text?.trim();
386907
+ if (direct && direct.length > 0)
386908
+ return direct;
386909
+ if (step.content && Array.isArray(step.content)) {
386910
+ const textParts = step.content.filter((p) => p.type === "text" && typeof p.text === "string").map((p) => (p.text ?? "").trim()).filter((t) => t.length > 0);
386911
+ if (textParts.length > 0)
386912
+ return textParts.join(`
386913
+ `);
386994
386914
  }
386995
386915
  }
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
- };
386916
+ return typeof result.text === "string" ? result.text.trim() : "";
387016
386917
  }
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(`
386918
+ function truncateAgentText(text2, archivePath) {
386919
+ if (text2.length <= TRUNCATE_THRESHOLD)
386920
+ return text2;
386921
+ const head = text2.slice(0, HEAD_CHARS);
386922
+ const tail = text2.slice(-TAIL_CHARS);
386923
+ const footer = archivePath ? `
386924
+ \u2026 [truncated, full output: ${archivePath}]
386925
+ ` : `
386926
+ \u2026 [truncated]
386927
+ `;
386928
+ return `${head}${footer}${tail}`;
386929
+ }
386930
+ function busFooter(filesExamined, filesEdited) {
386931
+ const lines = [];
386932
+ if (filesExamined.length > 0)
386933
+ lines.push(`Files examined: ${filesExamined.join(", ")}`);
386934
+ if (filesEdited.length > 0)
386935
+ lines.push(`Files edited: ${filesEdited.join(", ")}`);
386936
+ return lines.join(`
387049
386937
  `);
387050
386938
  }
387051
386939
  async function writeAgentContext(dispatchId, agentId, task, agentResult, findings, agentText, cwd2, tabId) {
@@ -387061,7 +386949,7 @@ async function writeAgentContext(dispatchId, agentId, task, agentResult, finding
387061
386949
  const toolStubs = [];
387062
386950
  for (const step of agentResult.steps) {
387063
386951
  for (const tc of step.toolCalls ?? []) {
387064
- const args2 = tc.args;
386952
+ const args2 = tc.args ?? tc.input;
387065
386953
  const name39 = tc.toolName;
387066
386954
  if (name39 === "read") {
387067
386955
  const path = args2?.path ?? args2?.file ?? "";
@@ -387101,7 +386989,7 @@ async function writeAgentContext(dispatchId, agentId, task, agentResult, finding
387101
386989
  }
387102
386990
  if (agentText.trim()) {
387103
386991
  lines.push("## Agent Summary");
387104
- lines.push(agentText.trim().slice(0, 4000));
386992
+ lines.push(agentText.trim());
387105
386993
  lines.push("");
387106
386994
  }
387107
386995
  await writeFile15(filePath, lines.join(`
@@ -387125,13 +387013,8 @@ async function cleanupDispatchDir(cwd2, tabId, keepDispatchId) {
387125
387013
  function dispatchDir(cwd2, tabId, dispatchId) {
387126
387014
  return join35(cwd2, ".soulforge", "dispatch", `tab-${tabId}`, dispatchId);
387127
387015
  }
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
- });
387016
+ var TRUNCATE_THRESHOLD = 4000, HEAD_CHARS = 2000, TAIL_CHARS = 1000;
387017
+ var init_agent_results = () => {};
387135
387018
 
387136
387019
  // src/core/agents/agent-runner.ts
387137
387020
  function getMaxConcurrentAgents() {
@@ -387245,23 +387128,6 @@ function stripContextManagement(opts) {
387245
387128
  }
387246
387129
  return changed ? out2 : opts;
387247
387130
  }
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
387131
  async function runAgentTask(task, models, bus, parentToolCallId, totalAgents, abortSignal) {
387266
387132
  if (task.dependsOn && task.dependsOn.length > 0) {
387267
387133
  try {
@@ -387481,20 +387347,20 @@ ${enrichedPrompt}`;
387481
387347
  const agentFindings2 = bus.getFindings().filter((f) => f.agentId === task.agentId);
387482
387348
  let doneResult2 = null;
387483
387349
  const agentText = extractFinalText(result);
387484
- if (agentText.length > 50) {
387350
+ if (agentText.length > 0) {
387485
387351
  doneResult2 = {
387486
387352
  summary: agentText
387487
387353
  };
387488
387354
  } 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
- }
387355
+ const busReads = bus.getFileReadRecords(task.agentId);
387356
+ const readPaths = [...new Set(busReads.map((r) => r.path))];
387357
+ const editPaths = [...bus.getEditedFiles(task.agentId).keys()];
387358
+ const fallback = busFooter(readPaths, editPaths);
387359
+ doneResult2 = {
387360
+ summary: fallback || `No output from agent for: ${task.task.slice(0, 200)}`
387361
+ };
387496
387362
  }
387497
- const hasResult = !!doneResult2 && (doneResult2.summary?.length ?? 0) > 10;
387363
+ const hasResult = !!doneResult2 && (doneResult2.summary?.length ?? 0) > 0;
387498
387364
  const codeEdited = task.role !== "code" || task.agentId === "desloppify" || bus.getEditedFiles(task.agentId).size > 0;
387499
387365
  let succeeded = hasResult && codeEdited;
387500
387366
  if (!succeeded && task.role === "code" && attempt === 0 && task.agentId !== "desloppify") {
@@ -387555,10 +387421,16 @@ ${task.task}`;
387555
387421
  const retryEdits = bus.getEditedFiles(task.agentId);
387556
387422
  if (retryEdits.size > 0) {
387557
387423
  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;
387424
+ if (retryText.length > 0) {
387425
+ doneResult2 = {
387426
+ summary: retryText
387427
+ };
387428
+ } else {
387429
+ const editPaths = [...retryEdits.keys()];
387430
+ doneResult2 = {
387431
+ summary: busFooter([], editPaths) || `Retry edited ${String(editPaths.length)} file(s)`
387432
+ };
387433
+ }
387562
387434
  succeeded = true;
387563
387435
  input += retryCallbacks._acc.input || (retryResult.totalUsage?.inputTokens ?? 0);
387564
387436
  output += retryCallbacks._acc.output || (retryResult.totalUsage?.outputTokens ?? 0);
@@ -387572,7 +387444,18 @@ ${task.task}`;
387572
387444
  }
387573
387445
  }
387574
387446
  }
387575
- const resultText = formatDoneResult(doneResult2);
387447
+ const busReadPaths = [...new Set(bus.getFileReadRecords(task.agentId).map((r) => r.path))];
387448
+ const busEditPaths = [...bus.getEditedFiles(task.agentId).keys()];
387449
+ const footer = busFooter(busReadPaths, busEditPaths);
387450
+ const fullText = footer ? `${doneResult2.summary}
387451
+
387452
+ ${footer}` : doneResult2.summary;
387453
+ let archivePath;
387454
+ try {
387455
+ archivePath = await writeAgentContext(parentToolCallId, task.agentId, task, result, agentFindings2, doneResult2.summary, process.cwd(), task.tabId);
387456
+ } catch {}
387457
+ const resultText = truncateAgentText(fullText, archivePath);
387458
+ doneResult2.archivePath = archivePath;
387576
387459
  let editVerificationWarning;
387577
387460
  if (task.role === "code" && succeeded) {
387578
387461
  const editedFiles = bus.getEditedFiles(task.agentId);
@@ -387610,7 +387493,6 @@ ${task.task}`;
387610
387493
  success: true
387611
387494
  };
387612
387495
  bus.setResult(agentResult2);
387613
- autoPostCompletionSummary(bus, task);
387614
387496
  emitMultiAgentEvent({
387615
387497
  parentToolCallId,
387616
387498
  type: "agent-done",
@@ -387651,10 +387533,6 @@ ${task.task}`;
387651
387533
  tabId: task.tabId
387652
387534
  });
387653
387535
  }
387654
- try {
387655
- const agentText2 = extractFinalText(result);
387656
- await writeAgentContext(parentToolCallId, task.agentId, task, result, agentFindings2, agentText2, process.cwd(), task.tabId);
387657
- } catch {}
387658
387536
  return {
387659
387537
  doneResult: doneResult2,
387660
387538
  resultText,
@@ -387727,18 +387605,7 @@ ${task.task}`;
387727
387605
  });
387728
387606
  }
387729
387607
  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
- }))
387608
+ summary: errorResultText
387742
387609
  } : null;
387743
387610
  return {
387744
387611
  doneResult,
@@ -387747,12 +387614,11 @@ ${task.task}`;
387747
387614
  result: agentResult
387748
387615
  };
387749
387616
  }
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;
387617
+ 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
387618
  var init_agent_runner = __esm(() => {
387752
387619
  init_dist5();
387753
387620
  init_errors();
387754
387621
  init_provider();
387755
- init_provider_options();
387756
387622
  init_lifecycle();
387757
387623
  init_task_list();
387758
387624
  init_agent_bus();
@@ -387772,11 +387638,6 @@ var init_agent_runner = __esm(() => {
387772
387638
  verdict: "Return a clear yes/no answer with a brief justification (1-3 sentences). " + "No code blocks unless they directly support the verdict."
387773
387639
  };
387774
387640
  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
387641
  });
387781
387642
 
387782
387643
  // src/core/agents/agent-verification.ts
@@ -387828,7 +387689,8 @@ ${editedPaths.map((p) => `- ${p}`).join(`
387828
387689
  resultText
387829
387690
  } = await runAgentTask(desloppifyTask, {
387830
387691
  ...models,
387831
- emberModel: models.desloppifyModel
387692
+ emberModel: models.desloppifyModel,
387693
+ parentMessagesRef: undefined
387832
387694
  }, bus, parentToolCallId, tasks.length + 1, abortSignal);
387833
387695
  return resultText.length > 20 ? `
387834
387696
 
@@ -387903,7 +387765,8 @@ ${test2.output.slice(-500)}`);
387903
387765
  resultText
387904
387766
  } = await runAgentTask(verifyTask, {
387905
387767
  ...models,
387906
- sparkModel: reviewModel
387768
+ sparkModel: reviewModel,
387769
+ parentMessagesRef: undefined
387907
387770
  }, bus, parentToolCallId, tasks.length + 1, abortSignal);
387908
387771
  return `
387909
387772
 
@@ -388049,6 +387912,9 @@ function buildStepCallbacks(parentToolCallId, agentId, modelId) {
388049
387912
  },
388050
387913
  onStepFinish: (step) => {
388051
387914
  steps.push(step);
387915
+ if (isAbnormalFinish(step.finishReason)) {
387916
+ logBackgroundError("agent-error", `${agentId ?? "subagent"}: ${describeAbnormalFinish(step.finishReason)}`);
387917
+ }
388052
387918
  acc.stepCount++;
388053
387919
  acc.toolUses += step.toolCalls?.length ?? 0;
388054
387920
  acc.input += step.usage?.inputTokens ?? 0;
@@ -388076,26 +387942,6 @@ function buildStepCallbacks(parentToolCallId, agentId, modelId) {
388076
387942
  _steps: steps
388077
387943
  };
388078
387944
  }
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
387945
  async function createAgent(task, models, bus, parentToolCallId) {
388100
387946
  const useExplore = task.role === "explore" || task.role === "investigate" || models.readOnly === true;
388101
387947
  const {
@@ -388104,26 +387950,25 @@ async function createAgent(task, models, bus, parentToolCallId) {
388104
387950
  const tier = classifyTask(task, models);
388105
387951
  const modelId = typeof model === "object" && "modelId" in model ? String(model.modelId) : "unknown";
388106
387952
  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
- }
387953
+ const subagentConfig = loadConfig();
387954
+ const explorePerfOverride = useExplore && subagentConfig.performance?.effort && subagentConfig.performance.effort !== "off" ? {
387955
+ ...subagentConfig,
387956
+ performance: {
387957
+ ...subagentConfig.performance,
387958
+ effort: "low"
387959
+ }
387960
+ } : subagentConfig;
387961
+ const built = await buildProviderOptions(modelId, explorePerfOverride);
387962
+ const subagentProviderOptions = stripContextManagement(built.providerOptions);
388122
387963
  const contextWindow = await getModelContextWindow(modelId);
388123
387964
  const forgeInstructions = useSpark ? models.forgeInstructions : undefined;
388124
387965
  const agentRole = useExplore ? "explore" : "code";
388125
387966
  const stripProgrammatic = !supportsProgrammaticToolCalling(modelId);
388126
- const forgeToolsGuarded = useSpark && models.forgeTools ? guardForgeTools(models.forgeTools, agentRole, stripProgrammatic) : undefined;
387967
+ let forgeToolsGuarded;
387968
+ if (useSpark && models.forgeTools) {
387969
+ const guarded = guardForgeTools(models.forgeTools, agentRole, stripProgrammatic);
387970
+ forgeToolsGuarded = wrapWithBusCache(guarded, bus, task.agentId);
387971
+ }
388127
387972
  const isSoloAgent = task.agentId === "desloppify" || task.agentId === "verifier";
388128
387973
  const opts = {
388129
387974
  bus,
@@ -388722,25 +388567,17 @@ ${body2}
388722
388567
 
388723
388568
  ---`);
388724
388569
  }
388725
- const allGaps = [];
388726
- const allConnections = [];
388570
+ const archivePaths = [];
388727
388571
  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}`));
388572
+ if (done?.archivePath)
388573
+ archivePaths.push(`- [${agentId}] ${done.archivePath}`);
388732
388574
  }
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
- `));
388575
+ if (archivePaths.length > 0) {
388576
+ sections.push(`
388577
+ ### Full agent outputs
388578
+ ${archivePaths.join(`
388579
+ `)}
388580
+ (Read these files for the complete agent text when truncated.)`);
388744
388581
  }
388745
388582
  if (failed.length > 0) {
388746
388583
  sections.push(`
@@ -388804,44 +388641,7 @@ Files: ${String(m.fileHits)} hits, ${String(m.fileWaits)} waits, ${String(m.file
388804
388641
  output
388805
388642
  }) {
388806
388643
  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
- `);
388644
+ const value = typeof dispatch2 === "string" ? dispatch2 : dispatch2.output;
388845
388645
  return {
388846
388646
  type: "text",
388847
388647
  value: `<dispatch_result>
@@ -388856,10 +388656,12 @@ var EXPLORE_BLOCKED, CODE_BLOCKED, PROGRAMMATIC_ONLY_TOOLS, SKILL_TOKEN_RE, SKIL
388856
388656
  var init_subagent_tools = __esm(() => {
388857
388657
  init_dist5();
388858
388658
  init_zod();
388659
+ init_config2();
388859
388660
  init_errors();
388860
388661
  init_WorkspaceCoordinator();
388861
388662
  init_models();
388862
388663
  init_provider_options();
388664
+ init_bus_cache();
388863
388665
  init_task_list();
388864
388666
  init_agent_bus();
388865
388667
  init_agent_results();
@@ -388868,6 +388670,7 @@ var init_subagent_tools = __esm(() => {
388868
388670
  init_code();
388869
388671
  init_explore();
388870
388672
  init_step_utils();
388673
+ init_stream_options();
388871
388674
  init_subagent_events();
388872
388675
  EXPLORE_BLOCKED = new Set(["edit_file", "multi_edit", "write_file", "create_file", "rename_symbol", "move_symbol", "refactor", "dispatch", "shell"]);
388873
388676
  CODE_BLOCKED = new Set(["dispatch"]);
@@ -389415,8 +389218,14 @@ function createForgeAgent({
389415
389218
  ...supportsTemperature(fullModelId ?? getModelId(model)) ? {
389416
389219
  temperature: 0
389417
389220
  } : {},
389221
+ maxOutputTokens: MAX_OUTPUT_TOKENS,
389418
389222
  tools: allTools,
389419
389223
  stopWhen: () => false,
389224
+ onStepFinish: (step) => {
389225
+ if (isAbnormalFinish(step.finishReason)) {
389226
+ logBackgroundError("agent-error", `forge: ${describeAbnormalFinish(step.finishReason)}`);
389227
+ }
389228
+ },
389420
389229
  instructions: isProxyClaude ? undefined : {
389421
389230
  role: "system",
389422
389231
  content: buildInstructions(contextManager, modelId),
@@ -389451,6 +389260,7 @@ var init_forge = __esm(() => {
389451
389260
  init_dist5();
389452
389261
  init_zod();
389453
389262
  init_config2();
389263
+ init_errors();
389454
389264
  init_image_compress();
389455
389265
  init_provider_options();
389456
389266
  init_mcp2();
@@ -404255,7 +404065,9 @@ class ContextManager {
404255
404065
  const store = useRepoMapStore.getState();
404256
404066
  store.setSemanticStatus("generating");
404257
404067
  store.setSemanticProgress(`${String(count)} stale \u2014 regenerating...`);
404258
- this.generateSemanticSummaries(modelId).catch(() => {});
404068
+ this.generateSemanticSummaries(modelId).catch((e) => {
404069
+ logBackgroundError("context-manager", `generateSemanticSummaries failed: ${e instanceof Error ? e.message : String(e)}`);
404070
+ });
404259
404071
  } else {
404260
404072
  const stats = this.repoMap.getStatsCached();
404261
404073
  useRepoMapStore.getState().setSemanticCount(stats.summaries);
@@ -404362,7 +404174,9 @@ class ContextManager {
404362
404174
  if (!this.lastEmittedSoulMapDiff) {
404363
404175
  this.pendingSoulMapDiff = null;
404364
404176
  }
404365
- }).catch(() => {});
404177
+ }).catch((e) => {
404178
+ logBackgroundError("context-manager", `prefetchDiffBlock failed: ${e instanceof Error ? e.message : String(e)}`);
404179
+ });
404366
404180
  }, 300);
404367
404181
  }
404368
404182
  trackMentionedFile(absPath) {
@@ -404425,7 +404239,9 @@ class ContextManager {
404425
404239
  if (this.soulMapSnapshotPaths.size === 0) {
404426
404240
  this.soulMapSnapshotPaths = new Set(result.paths);
404427
404241
  }
404428
- } catch {}
404242
+ } catch (e) {
404243
+ logBackgroundError("context-manager", `warmRepoMapCache failed: ${e instanceof Error ? e.message : String(e)}`);
404244
+ }
404429
404245
  this.repoMapRefreshing = false;
404430
404246
  }
404431
404247
  getRepoMap() {
@@ -405206,6 +405022,7 @@ Project commands: ${parts2.join(" \xB7 ")}` : "";
405206
405022
  var DEFAULT_CONTEXT_WINDOW2 = 200000;
405207
405023
  var init_manager5 = __esm(() => {
405208
405024
  init_dist5();
405025
+ init_errors();
405209
405026
  init_repomap();
405210
405027
  init_neovim();
405211
405028
  init_instance2();
@@ -425191,11 +425008,15 @@ class HearthDaemon {
425191
425008
  if (existsSync35(this.config.daemon.socketPath)) {
425192
425009
  try {
425193
425010
  unlinkSync8(this.config.daemon.socketPath);
425194
- } catch {}
425011
+ } catch (e) {
425012
+ this.log(`failed to remove socket: ${e instanceof Error ? e.message : String(e)}`);
425013
+ }
425195
425014
  }
425196
425015
  try {
425197
425016
  unlinkSync8(DEFAULT_PID_PATH);
425198
- } catch {}
425017
+ } catch (e) {
425018
+ this.log(`failed to remove pidfile: ${e instanceof Error ? e.message : String(e)}`);
425019
+ }
425199
425020
  this.log("hearth stopped");
425200
425021
  }
425201
425022
  getConfig() {
@@ -425351,7 +425172,9 @@ class HearthDaemon {
425351
425172
  if (existsSync35(path)) {
425352
425173
  try {
425353
425174
  unlinkSync8(path);
425354
- } catch {}
425175
+ } catch (e) {
425176
+ this.log(`failed to remove stale socket: ${e instanceof Error ? e.message : String(e)}`);
425177
+ }
425355
425178
  }
425356
425179
  const daemonEuid = typeof process.geteuid === "function" ? process.geteuid() : typeof process.getuid === "function" ? process.getuid() : -1;
425357
425180
  this.socketServer = createServer2((sock) => {
@@ -425389,7 +425212,9 @@ class HearthDaemon {
425389
425212
  server2.listen(path, () => {
425390
425213
  try {
425391
425214
  chmodSync4(path, 384);
425392
- } catch {}
425215
+ } catch (e) {
425216
+ this.log(`failed to chmod socket: ${e instanceof Error ? e.message : String(e)}`);
425217
+ }
425393
425218
  resolve39();
425394
425219
  });
425395
425220
  });
@@ -472428,7 +472253,7 @@ function extractFilesFromToolCalls(msg) {
472428
472253
  edited
472429
472254
  };
472430
472255
  for (const tc of msg.toolCalls) {
472431
- if (EDIT_TOOLS3.has(tc.name) && tc.result?.success) {
472256
+ if (EDIT_TOOLS2.has(tc.name) && tc.result?.success) {
472432
472257
  const p2 = tc.args.path ?? tc.args.file;
472433
472258
  if (typeof p2 === "string")
472434
472259
  edited.push(p2);
@@ -472441,7 +472266,7 @@ function extractFilesFromToolCalls(msg) {
472441
472266
  edited.push(tc.args.path);
472442
472267
  }
472443
472268
  }
472444
- if (READ_TOOLS2.has(tc.name)) {
472269
+ if (READ_TOOLS.has(tc.name)) {
472445
472270
  const p2 = tc.args.path ?? tc.args.file;
472446
472271
  if (typeof p2 === "string")
472447
472272
  read.push(p2);
@@ -472474,14 +472299,14 @@ function emptyTab() {
472474
472299
  function getTab(tabs, tabId) {
472475
472300
  return tabs[tabId] ?? emptyTab();
472476
472301
  }
472477
- var _gitLocks, EDIT_TOOLS3, READ_TOOLS2, useCheckpointStore;
472302
+ var _gitLocks, EDIT_TOOLS2, READ_TOOLS, useCheckpointStore;
472478
472303
  var init_checkpoints = __esm(() => {
472479
472304
  init_esm();
472480
472305
  init_WorkspaceCoordinator();
472481
472306
  init_status();
472482
472307
  _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"]);
472308
+ EDIT_TOOLS2 = new Set(["edit_file", "multi_edit", "rename_file", "rename_symbol", "move_symbol", "refactor", "undo_edit"]);
472309
+ READ_TOOLS = new Set(["Read", "soul_grep", "navigate", "Grep", "Glob", "soul_find", "soul_analyze", "analyze"]);
472485
472310
  useCheckpointStore = create()((set3, get) => ({
472486
472311
  tabs: {},
472487
472312
  skipCleanupTabs: new Set,
@@ -474826,9 +474651,17 @@ function handleContextClear(input, ctx) {
474826
474651
  const cleared = ctx.contextManager.clearContext(what);
474827
474652
  sysMsg(ctx, cleared.length > 0 ? `Cleared: ${cleared.join(", ")}` : "Nothing to clear.");
474828
474653
  }
474829
- function handleContext(_input, _ctx) {
474654
+ function handleContext(input, _ctx) {
474655
+ const cmd = input.trim().toLowerCase();
474656
+ const tab = cmd.includes("dispatch") ? "Dispatch" : cmd.includes("system") ? "System" : "Context";
474657
+ useUIStore.setState({
474658
+ statusDashboardTab: tab
474659
+ });
474660
+ useUIStore.getState().openModal("statusDashboard");
474661
+ }
474662
+ function handleDispatchStatus(_input, _ctx) {
474830
474663
  useUIStore.setState({
474831
- statusDashboardTab: "Context"
474664
+ statusDashboardTab: "Dispatch"
474832
474665
  });
474833
474666
  useUIStore.getState().openModal("statusDashboard");
474834
474667
  }
@@ -474843,6 +474676,7 @@ function handleTools(_input, _ctx) {
474843
474676
  }
474844
474677
  function register5(map2) {
474845
474678
  map2.set("/context", handleContext);
474679
+ map2.set("/dispatch-status", handleDispatchStatus);
474846
474680
  map2.set("/memory", handleMemory);
474847
474681
  map2.set("/repo-map", handleRepoMap);
474848
474682
  map2.set("/tools", handleTools);
@@ -477798,6 +477632,7 @@ var init_statusbar = __esm(() => {
477798
477632
  compactionStrategy: "v2",
477799
477633
  v2Slots: 0,
477800
477634
  browsingCheckpoint: false,
477635
+ lastDispatch: null,
477801
477636
  setTokenUsage: (usage, modelId) => set3({
477802
477637
  tokenUsage: usage,
477803
477638
  ...modelId ? {
@@ -477843,6 +477678,57 @@ var init_statusbar = __esm(() => {
477843
477678
  }),
477844
477679
  setBrowsingCheckpoint: (v4) => set3({
477845
477680
  browsingCheckpoint: v4
477681
+ }),
477682
+ startDispatch: (parentToolCallId, totalAgents) => set3({
477683
+ lastDispatch: {
477684
+ parentToolCallId,
477685
+ startedAt: Date.now(),
477686
+ totalAgents,
477687
+ completedAgents: 0,
477688
+ agents: {}
477689
+ }
477690
+ }),
477691
+ upsertDispatchAgent: (parentToolCallId, agent2) => set3((s2) => {
477692
+ const cur = s2.lastDispatch;
477693
+ if (!cur || cur.parentToolCallId !== parentToolCallId)
477694
+ return s2;
477695
+ const prev = cur.agents[agent2.agentId] ?? {
477696
+ agentId: agent2.agentId,
477697
+ toolUses: 0,
477698
+ input: 0,
477699
+ output: 0,
477700
+ cacheRead: 0,
477701
+ cacheWrite: 0,
477702
+ state: "running"
477703
+ };
477704
+ const merged = {
477705
+ ...prev,
477706
+ ...agent2
477707
+ };
477708
+ const wasRunning = prev.state === "running";
477709
+ const nowDone = merged.state === "done" || merged.state === "error";
477710
+ const completedAgents = wasRunning && nowDone ? cur.completedAgents + 1 : cur.completedAgents;
477711
+ return {
477712
+ lastDispatch: {
477713
+ ...cur,
477714
+ completedAgents,
477715
+ agents: {
477716
+ ...cur.agents,
477717
+ [agent2.agentId]: merged
477718
+ }
477719
+ }
477720
+ };
477721
+ }),
477722
+ finishDispatch: (parentToolCallId) => set3((s2) => {
477723
+ const cur = s2.lastDispatch;
477724
+ if (!cur || cur.parentToolCallId !== parentToolCallId)
477725
+ return s2;
477726
+ return {
477727
+ lastDispatch: {
477728
+ ...cur,
477729
+ finishedAt: Date.now()
477730
+ }
477731
+ };
477846
477732
  })
477847
477733
  })));
477848
477734
  });
@@ -481699,6 +481585,13 @@ var init_registry = __esm(() => {
481699
481585
  category: "System",
481700
481586
  tags: ["exit", "close"]
481701
481587
  },
481588
+ {
481589
+ cmd: "/exit",
481590
+ ic: "quit",
481591
+ desc: "Exit SoulForge",
481592
+ category: "System",
481593
+ tags: ["quit", "close"]
481594
+ },
481702
481595
  {
481703
481596
  cmd: "/restart",
481704
481597
  ic: "ghost",
@@ -485692,13 +485585,13 @@ var init_TabBar = __esm(async () => {
485692
485585
  // src/core/compaction/extractor.ts
485693
485586
  function extractFromToolCall(wsm, toolName, args2) {
485694
485587
  const filePath = extractFilePath(args2);
485695
- if (READ_TOOLS3.has(toolName) && filePath) {
485588
+ if (READ_TOOLS2.has(toolName) && filePath) {
485696
485589
  wsm.trackFile(filePath, {
485697
485590
  type: "read",
485698
485591
  summary: buildReadSummary(toolName, args2)
485699
485592
  });
485700
485593
  }
485701
- if (EDIT_TOOLS4.has(toolName) && filePath) {
485594
+ if (EDIT_TOOLS3.has(toolName) && filePath) {
485702
485595
  const detail = buildEditDetail(toolName, args2);
485703
485596
  wsm.trackFile(filePath, {
485704
485597
  type: toolName === "write_file" || toolName === "create_file" ? "create" : "edit",
@@ -485918,10 +485811,10 @@ function truncate2(s2, max) {
485918
485811
  return s2;
485919
485812
  return `${s2.slice(0, max)}...`;
485920
485813
  }
485921
- var READ_TOOLS3, EDIT_TOOLS4, SHELL_TOOL = "shell", PROJECT_TOOL = "project";
485814
+ var READ_TOOLS2, EDIT_TOOLS3, SHELL_TOOL = "shell", PROJECT_TOOL = "project";
485922
485815
  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"]);
485816
+ READ_TOOLS2 = new Set(["read", "navigate", "grep", "glob", "analyze", "soul_grep", "soul_find", "soul_analyze", "soul_impact"]);
485817
+ EDIT_TOOLS3 = new Set(["edit_file", "replace_file", "write_file", "create_file"]);
485925
485818
  });
485926
485819
 
485927
485820
  // src/core/compaction/summarize.ts
@@ -487932,6 +487825,15 @@ ${description}`,
487932
487825
  const unsubAgentStats = onAgentStats((event) => {
487933
487826
  if (!isOurDispatch(event.parentToolCallId))
487934
487827
  return;
487828
+ useStatusBarStore.getState().upsertDispatchAgent(event.parentToolCallId, {
487829
+ agentId: event.agentId,
487830
+ modelId: event.modelId,
487831
+ toolUses: event.toolUses,
487832
+ input: event.tokenUsage.input,
487833
+ output: event.tokenUsage.output,
487834
+ cacheRead: event.cacheHits ?? 0,
487835
+ cacheWrite: event.cacheWrite ?? 0
487836
+ });
487935
487837
  const prev = subagentCumulative.get(event.agentId) ?? {
487936
487838
  input: 0,
487937
487839
  output: 0,
@@ -487976,7 +487878,18 @@ ${description}`,
487976
487878
  const unsubMultiAgent = onMultiAgentEvent((event) => {
487977
487879
  if (!isOurDispatch(event.parentToolCallId))
487978
487880
  return;
487881
+ if (event.type === "dispatch-start") {
487882
+ useStatusBarStore.getState().startDispatch(event.parentToolCallId, event.totalAgents ?? 0);
487883
+ }
487979
487884
  if (event.type === "agent-start" && event.agentId) {
487885
+ useStatusBarStore.getState().upsertDispatchAgent(event.parentToolCallId, {
487886
+ agentId: event.agentId,
487887
+ role: event.role,
487888
+ modelId: event.modelId,
487889
+ tier: event.tier,
487890
+ task: event.task,
487891
+ state: "running"
487892
+ });
487980
487893
  runHooks({
487981
487894
  event: "SubagentStart",
487982
487895
  toolInput: {
@@ -487987,6 +487900,25 @@ ${description}`,
487987
487900
  cwd: cwd2
487988
487901
  }).catch(() => {});
487989
487902
  }
487903
+ if ((event.type === "agent-done" || event.type === "agent-error") && event.agentId) {
487904
+ useStatusBarStore.getState().upsertDispatchAgent(event.parentToolCallId, {
487905
+ agentId: event.agentId,
487906
+ role: event.role,
487907
+ modelId: event.modelId,
487908
+ tier: event.tier,
487909
+ task: event.task,
487910
+ toolUses: event.toolUses,
487911
+ ...event.tokenUsage ? {
487912
+ input: event.tokenUsage.input,
487913
+ output: event.tokenUsage.output
487914
+ } : {},
487915
+ ...event.cacheHits != null ? {
487916
+ cacheRead: event.cacheHits
487917
+ } : {},
487918
+ succeeded: event.succeeded,
487919
+ state: event.type === "agent-error" ? "error" : "done"
487920
+ });
487921
+ }
487990
487922
  if (event.type === "agent-done" && event.agentId) {
487991
487923
  runHooks({
487992
487924
  event: "SubagentStop",
@@ -488003,6 +487935,7 @@ ${description}`,
488003
487935
  queueMicrotaskFlush();
488004
487936
  }
488005
487937
  if (event.type === "dispatch-done") {
487938
+ useStatusBarStore.getState().finishDispatch(event.parentToolCallId);
488006
487939
  completedResultChars.clear();
488007
487940
  subagentCumulative.clear();
488008
487941
  if (visibleRef.current)
@@ -489072,8 +489005,9 @@ ${errStack}` : `Error: ${displayErr}`);
489072
489005
  }
489073
489006
  const isAbort = abortController.signal.aborted;
489074
489007
  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);
489008
+ const chain = causeChain(err2);
489009
+ 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);
489010
+ 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
489011
  if (!proxyBounced && isConnErr && getActiveProviderId() === "proxy") {
489078
489012
  proxyBounced = true;
489079
489013
  const healthy = await proxyHealthProbe().catch(() => false);
@@ -489244,8 +489178,15 @@ ${errStack}` : `Error: ${displayErr}`);
489244
489178
  return;
489245
489179
  }
489246
489180
  const rawMsg = err2 instanceof Error ? err2.message : String(err2);
489181
+ const rawStack = err2 instanceof Error ? err2.stack : undefined;
489182
+ const rawChain = causeChain(err2);
489247
489183
  if (!isAbort) {
489248
- logBackgroundError("agent-error", rawMsg);
489184
+ const parts2 = [rawChain];
489185
+ if (rawStack)
489186
+ parts2.push(rawStack);
489187
+ logBackgroundError("agent-error", parts2.join(`
489188
+
489189
+ `));
489249
489190
  }
489250
489191
  if (!isAbort) {
489251
489192
  runHooks({
@@ -489691,6 +489632,18 @@ ${pContent}`;
489691
489632
  cycleMode: cycleModeFn
489692
489633
  };
489693
489634
  }
489635
+ function causeChain(err2) {
489636
+ const parts2 = [];
489637
+ let cur = err2;
489638
+ const seen = new Set;
489639
+ while (cur && !seen.has(cur)) {
489640
+ seen.add(cur);
489641
+ parts2.push(cur instanceof Error ? `${cur.name}: ${cur.message}` : String(cur));
489642
+ cur = cur?.cause;
489643
+ }
489644
+ return parts2.join(`
489645
+ caused by: `);
489646
+ }
489694
489647
  var import_react32, CHARS_PER_TOKEN2 = 4, PRUNE_PROTECT_TOKENS = 40000, PRUNE_MINIMUM_TOKENS = 20000;
489695
489648
  var init_useChat = __esm(() => {
489696
489649
  init_dist5();
@@ -498055,7 +498008,7 @@ function _temp21(s2) {
498055
498008
  function isFailedEditCall(tc) {
498056
498009
  return EDIT_NAMES.has(tc.name) && !!tc.result && !tc.result.success;
498057
498010
  }
498058
- function extractPathFromArgs2(args2) {
498011
+ function extractPathFromArgs(args2) {
498059
498012
  if (!args2 || typeof args2.path !== "string")
498060
498013
  return null;
498061
498014
  return args2.path;
@@ -498758,7 +498711,7 @@ function WritePlanCall(t0) {
498758
498711
  function truncateUserContent(content, expanded, t2) {
498759
498712
  const lines = content.split(`
498760
498713
  `);
498761
- if (expanded || lines.length <= TRUNCATE_THRESHOLD) {
498714
+ if (expanded || lines.length <= TRUNCATE_THRESHOLD2) {
498762
498715
  return /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("text", {
498763
498716
  children: content
498764
498717
  }, undefined, false, undefined, this);
@@ -499058,12 +499011,12 @@ function renderSegments(segments, toolCallMap, diffStyle = "default", collapseDi
499058
499011
  return false;
499059
499012
  if (!isFailedEditCall(tc))
499060
499013
  return true;
499061
- const path6 = extractPathFromArgs2(tc.args);
499014
+ const path6 = extractPathFromArgs(tc.args);
499062
499015
  if (!path6)
499063
499016
  return true;
499064
499017
  for (let j4 = idx + 1;j4 < topLevel.length; j4++) {
499065
499018
  const later = topLevel[j4];
499066
- if (later && EDIT_NAMES.has(later.name) && extractPathFromArgs2(later.args) === path6)
499019
+ if (later && EDIT_NAMES.has(later.name) && extractPathFromArgs(later.args) === path6)
499067
499020
  return false;
499068
499021
  }
499069
499022
  return true;
@@ -499094,7 +499047,7 @@ function renderSegments(segments, toolCallMap, diffStyle = "default", collapseDi
499094
499047
  const cwd2 = process.cwd();
499095
499048
  const batchFiles = [];
499096
499049
  for (const tc of g3.calls) {
499097
- const directPath = extractPathFromArgs2(tc.args);
499050
+ const directPath = extractPathFromArgs(tc.args);
499098
499051
  if (directPath) {
499099
499052
  batchFiles.push({
499100
499053
  path: directPath,
@@ -499382,7 +499335,7 @@ function _temp102(tc_4) {
499382
499335
  collapseDiffs: true
499383
499336
  }, tc_4.id, false, undefined, this);
499384
499337
  }
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;
499338
+ 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
499339
  var init_MessageList = __esm(async () => {
499387
499340
  init_icons();
499388
499341
  init_image2();
@@ -519982,6 +519935,11 @@ function StatusDashboard({
519982
519935
  label: "Tabs",
519983
519936
  icon: "tabs",
519984
519937
  blurb: "per-tab summary"
519938
+ }, {
519939
+ id: "Dispatch",
519940
+ label: "Dispatch",
519941
+ icon: "dispatch",
519942
+ blurb: "last dispatch \xB7 cache"
519985
519943
  }, {
519986
519944
  id: "System",
519987
519945
  label: "System",
@@ -520053,6 +520011,12 @@ function StatusDashboard({
520053
520011
  getTabUsage,
520054
520012
  contentW
520055
520013
  }, undefined, false, undefined, this),
520014
+ tab === "Dispatch" && /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV(DispatchPane, {
520015
+ sb,
520016
+ contentW,
520017
+ scrollOffset,
520018
+ scrollH
520019
+ }, undefined, false, undefined, this),
520056
520020
  tab === "System" && /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV(SystemPane, {
520057
520021
  sb,
520058
520022
  rm: rm3,
@@ -520993,6 +520957,388 @@ function TabsPane(t0) {
520993
520957
  }
520994
520958
  return t4;
520995
520959
  }
520960
+ function DispatchPane(t0) {
520961
+ const $5 = import_compiler_runtime66.c(67);
520962
+ const {
520963
+ sb,
520964
+ contentW,
520965
+ scrollOffset,
520966
+ scrollH
520967
+ } = t0;
520968
+ const t2 = useTheme();
520969
+ const dispatch2 = sb.lastDispatch;
520970
+ const ref = import_react117.useRef(null);
520971
+ let t1;
520972
+ let t22;
520973
+ if ($5[0] !== scrollOffset) {
520974
+ t1 = () => {
520975
+ ref.current?.scrollTo(scrollOffset);
520976
+ };
520977
+ t22 = [scrollOffset];
520978
+ $5[0] = scrollOffset;
520979
+ $5[1] = t1;
520980
+ $5[2] = t22;
520981
+ } else {
520982
+ t1 = $5[1];
520983
+ t22 = $5[2];
520984
+ }
520985
+ import_react117.useEffect(t1, t22);
520986
+ if (!dispatch2) {
520987
+ let t32;
520988
+ if ($5[3] !== t2.bgPopup || $5[4] !== t2.textMuted) {
520989
+ t32 = /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("box", {
520990
+ flexDirection: "column",
520991
+ paddingX: 2,
520992
+ paddingY: 2,
520993
+ children: /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("text", {
520994
+ bg: t2.bgPopup,
520995
+ fg: t2.textMuted,
520996
+ children: "No dispatch yet this session."
520997
+ }, undefined, false, undefined, this)
520998
+ }, undefined, false, undefined, this);
520999
+ $5[3] = t2.bgPopup;
521000
+ $5[4] = t2.textMuted;
521001
+ $5[5] = t32;
521002
+ } else {
521003
+ t32 = $5[5];
521004
+ }
521005
+ return t32;
521006
+ }
521007
+ let elapsedLabel;
521008
+ let overallCachePct;
521009
+ let t3;
521010
+ let totalCache;
521011
+ let totalCacheWrite;
521012
+ let totalIn;
521013
+ let totalOut;
521014
+ let totalTools;
521015
+ if ($5[6] !== dispatch2.agents || $5[7] !== dispatch2.finishedAt || $5[8] !== dispatch2.startedAt) {
521016
+ const agents = Object.values(dispatch2.agents);
521017
+ agents.sort(_temp78);
521018
+ totalIn = 0;
521019
+ totalOut = 0;
521020
+ totalCache = 0;
521021
+ totalCacheWrite = 0;
521022
+ totalTools = 0;
521023
+ for (const a_0 of agents) {
521024
+ totalIn = totalIn + (a_0.input ?? 0);
521025
+ totalOut = totalOut + (a_0.output ?? 0);
521026
+ totalCache = totalCache + (a_0.cacheRead ?? 0);
521027
+ totalCacheWrite = totalCacheWrite + (a_0.cacheWrite ?? 0);
521028
+ totalTools = totalTools + (a_0.toolUses ?? 0);
521029
+ }
521030
+ const allInput = totalIn;
521031
+ let t42;
521032
+ if ($5[17] !== allInput || $5[18] !== totalCache) {
521033
+ t42 = allInput > 0 ? Math.min(100, Math.round(totalCache / allInput * 100)) : 0;
521034
+ $5[17] = allInput;
521035
+ $5[18] = totalCache;
521036
+ $5[19] = t42;
521037
+ } else {
521038
+ t42 = $5[19];
521039
+ }
521040
+ overallCachePct = t42;
521041
+ let t52;
521042
+ if ($5[20] !== dispatch2.finishedAt) {
521043
+ t52 = dispatch2.finishedAt ?? Date.now();
521044
+ $5[20] = dispatch2.finishedAt;
521045
+ $5[21] = t52;
521046
+ } else {
521047
+ t52 = $5[21];
521048
+ }
521049
+ const elapsed = t52 - dispatch2.startedAt;
521050
+ let t62;
521051
+ if ($5[22] !== elapsed) {
521052
+ 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`;
521053
+ $5[22] = elapsed;
521054
+ $5[23] = t62;
521055
+ } else {
521056
+ t62 = $5[23];
521057
+ }
521058
+ elapsedLabel = t62;
521059
+ const compactModel = _temp85;
521060
+ t3 = agents.map((a_1) => {
521061
+ const cacheRead = a_1.cacheRead ?? 0;
521062
+ const input = a_1.input ?? 0;
521063
+ const pct = input > 0 ? Math.round(cacheRead / input * 100) : 0;
521064
+ 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`;
521065
+ const model = a_1.modelId ? compactModel(getShortModelLabel(a_1.modelId)) : "\u2014";
521066
+ const agentLabel = a_1.agentId.length > 18 ? `${a_1.agentId.slice(0, 17)}\u2026` : a_1.agentId;
521067
+ const tier = a_1.tier === "spark" ? `${icon("spark")} spark` : a_1.tier === "ember" ? `${icon("ember")} ember` : "\u2014";
521068
+ return {
521069
+ agent: agentLabel,
521070
+ tier,
521071
+ model,
521072
+ state: stateLabel,
521073
+ tools: String(a_1.toolUses ?? 0),
521074
+ input: fmtTokens(input),
521075
+ output: fmtTokens(a_1.output ?? 0),
521076
+ cache: cacheRead > 0 ? fmtTokens(cacheRead) : "\u2014",
521077
+ cachePct: cacheRead > 0 ? `${String(pct)}%` : "\u2014"
521078
+ };
521079
+ });
521080
+ $5[6] = dispatch2.agents;
521081
+ $5[7] = dispatch2.finishedAt;
521082
+ $5[8] = dispatch2.startedAt;
521083
+ $5[9] = elapsedLabel;
521084
+ $5[10] = overallCachePct;
521085
+ $5[11] = t3;
521086
+ $5[12] = totalCache;
521087
+ $5[13] = totalCacheWrite;
521088
+ $5[14] = totalIn;
521089
+ $5[15] = totalOut;
521090
+ $5[16] = totalTools;
521091
+ } else {
521092
+ elapsedLabel = $5[9];
521093
+ overallCachePct = $5[10];
521094
+ t3 = $5[11];
521095
+ totalCache = $5[12];
521096
+ totalCacheWrite = $5[13];
521097
+ totalIn = $5[14];
521098
+ totalOut = $5[15];
521099
+ totalTools = $5[16];
521100
+ }
521101
+ const rows = t3;
521102
+ const t4 = `${String(dispatch2.completedAgents)}/${String(dispatch2.totalAgents)} agents \xB7 ${elapsedLabel}`;
521103
+ const t5 = contentW - 4;
521104
+ let t6;
521105
+ if ($5[24] !== overallCachePct || $5[25] !== totalCache) {
521106
+ t6 = totalCache > 0 ? `${fmtTokens(totalCache)} (${String(overallCachePct)}%)` : "\u2014";
521107
+ $5[24] = overallCachePct;
521108
+ $5[25] = totalCache;
521109
+ $5[26] = t6;
521110
+ } else {
521111
+ t6 = $5[26];
521112
+ }
521113
+ const t7 = totalCache > 0 ? t2.success : t2.textFaint;
521114
+ let t8;
521115
+ if ($5[27] !== overallCachePct || $5[28] !== t5 || $5[29] !== t6 || $5[30] !== t7) {
521116
+ t8 = /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV(ProgressBar, {
521117
+ label: "Cache",
521118
+ labelWidth: 10,
521119
+ pct: overallCachePct,
521120
+ width: t5,
521121
+ value: t6,
521122
+ color: t7
521123
+ }, undefined, false, undefined, this);
521124
+ $5[27] = overallCachePct;
521125
+ $5[28] = t5;
521126
+ $5[29] = t6;
521127
+ $5[30] = t7;
521128
+ $5[31] = t8;
521129
+ } else {
521130
+ t8 = $5[31];
521131
+ }
521132
+ let t9;
521133
+ if ($5[32] === Symbol.for("react.memo_cache_sentinel")) {
521134
+ t9 = /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV(VSpacer, {}, undefined, false, undefined, this);
521135
+ $5[32] = t9;
521136
+ } else {
521137
+ t9 = $5[32];
521138
+ }
521139
+ const t10 = t2.bgPopup;
521140
+ const t11 = t2.info;
521141
+ let t12;
521142
+ if ($5[33] !== totalIn) {
521143
+ t12 = fmtTokens(totalIn);
521144
+ $5[33] = totalIn;
521145
+ $5[34] = t12;
521146
+ } else {
521147
+ t12 = $5[34];
521148
+ }
521149
+ let t13;
521150
+ if ($5[35] !== t2.bgPopup || $5[36] !== t2.info || $5[37] !== t12) {
521151
+ t13 = /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV(Field, {
521152
+ label: "Input",
521153
+ labelWidth: 14,
521154
+ value: /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("text", {
521155
+ bg: t10,
521156
+ fg: t11,
521157
+ children: t12
521158
+ }, undefined, false, undefined, this)
521159
+ }, undefined, false, undefined, this);
521160
+ $5[35] = t2.bgPopup;
521161
+ $5[36] = t2.info;
521162
+ $5[37] = t12;
521163
+ $5[38] = t13;
521164
+ } else {
521165
+ t13 = $5[38];
521166
+ }
521167
+ const t14 = t2.bgPopup;
521168
+ const t15 = t2.warning;
521169
+ let t16;
521170
+ if ($5[39] !== totalOut) {
521171
+ t16 = fmtTokens(totalOut);
521172
+ $5[39] = totalOut;
521173
+ $5[40] = t16;
521174
+ } else {
521175
+ t16 = $5[40];
521176
+ }
521177
+ let t17;
521178
+ if ($5[41] !== t2.bgPopup || $5[42] !== t2.warning || $5[43] !== t16) {
521179
+ t17 = /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV(Field, {
521180
+ label: "Output",
521181
+ labelWidth: 14,
521182
+ value: /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("text", {
521183
+ bg: t14,
521184
+ fg: t15,
521185
+ children: t16
521186
+ }, undefined, false, undefined, this)
521187
+ }, undefined, false, undefined, this);
521188
+ $5[41] = t2.bgPopup;
521189
+ $5[42] = t2.warning;
521190
+ $5[43] = t16;
521191
+ $5[44] = t17;
521192
+ } else {
521193
+ t17 = $5[44];
521194
+ }
521195
+ let t18;
521196
+ if ($5[45] !== t2.bgPopup || $5[46] !== t2.warning || $5[47] !== totalCacheWrite) {
521197
+ t18 = totalCacheWrite > 0 && /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV(Field, {
521198
+ label: "Cache Write",
521199
+ labelWidth: 14,
521200
+ value: /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("text", {
521201
+ bg: t2.bgPopup,
521202
+ fg: t2.warning,
521203
+ children: fmtTokens(totalCacheWrite)
521204
+ }, undefined, false, undefined, this)
521205
+ }, undefined, false, undefined, this);
521206
+ $5[45] = t2.bgPopup;
521207
+ $5[46] = t2.warning;
521208
+ $5[47] = totalCacheWrite;
521209
+ $5[48] = t18;
521210
+ } else {
521211
+ t18 = $5[48];
521212
+ }
521213
+ const t19 = String(totalTools);
521214
+ let t20;
521215
+ if ($5[49] !== t19) {
521216
+ t20 = /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV(Field, {
521217
+ label: "Tool calls",
521218
+ labelWidth: 14,
521219
+ value: t19
521220
+ }, undefined, false, undefined, this);
521221
+ $5[49] = t19;
521222
+ $5[50] = t20;
521223
+ } else {
521224
+ t20 = $5[50];
521225
+ }
521226
+ let t21;
521227
+ if ($5[51] !== t13 || $5[52] !== t17 || $5[53] !== t18 || $5[54] !== t20 || $5[55] !== t4 || $5[56] !== t8) {
521228
+ t21 = /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV(Section, {
521229
+ title: "Last Dispatch",
521230
+ description: t4,
521231
+ children: [
521232
+ t8,
521233
+ t9,
521234
+ t13,
521235
+ t17,
521236
+ t18,
521237
+ t20
521238
+ ]
521239
+ }, undefined, true, undefined, this);
521240
+ $5[51] = t13;
521241
+ $5[52] = t17;
521242
+ $5[53] = t18;
521243
+ $5[54] = t20;
521244
+ $5[55] = t4;
521245
+ $5[56] = t8;
521246
+ $5[57] = t21;
521247
+ } else {
521248
+ t21 = $5[57];
521249
+ }
521250
+ let t222;
521251
+ if ($5[58] !== contentW || $5[59] !== rows || $5[60] !== scrollH || $5[61] !== t2.bgPopup || $5[62] !== t2.textMuted) {
521252
+ t222 = /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV(Section, {
521253
+ title: "Per Agent",
521254
+ children: rows.length === 0 ? /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("text", {
521255
+ bg: t2.bgPopup,
521256
+ fg: t2.textMuted,
521257
+ children: "No agents recorded."
521258
+ }, undefined, false, undefined, this) : /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("scrollbox", {
521259
+ ref,
521260
+ height: Math.max(4, scrollH - 8),
521261
+ children: /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV(Table, {
521262
+ width: contentW - 4,
521263
+ maxRows: rows.length,
521264
+ columns: [{
521265
+ key: "agent",
521266
+ align: "left"
521267
+ }, {
521268
+ key: "tier",
521269
+ align: "left",
521270
+ width: 9
521271
+ }, {
521272
+ key: "model",
521273
+ align: "left",
521274
+ width: 14
521275
+ }, {
521276
+ key: "state",
521277
+ align: "left",
521278
+ width: 7
521279
+ }, {
521280
+ key: "tools",
521281
+ align: "right",
521282
+ width: 5
521283
+ }, {
521284
+ key: "input",
521285
+ align: "right",
521286
+ width: 8
521287
+ }, {
521288
+ key: "output",
521289
+ align: "right",
521290
+ width: 8
521291
+ }, {
521292
+ key: "cache",
521293
+ align: "right",
521294
+ width: 8
521295
+ }, {
521296
+ key: "cachePct",
521297
+ align: "right",
521298
+ width: 6
521299
+ }],
521300
+ rows
521301
+ }, undefined, false, undefined, this)
521302
+ }, undefined, false, undefined, this)
521303
+ }, undefined, false, undefined, this);
521304
+ $5[58] = contentW;
521305
+ $5[59] = rows;
521306
+ $5[60] = scrollH;
521307
+ $5[61] = t2.bgPopup;
521308
+ $5[62] = t2.textMuted;
521309
+ $5[63] = t222;
521310
+ } else {
521311
+ t222 = $5[63];
521312
+ }
521313
+ let t23;
521314
+ if ($5[64] !== t21 || $5[65] !== t222) {
521315
+ t23 = /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("box", {
521316
+ flexDirection: "column",
521317
+ flexGrow: 1,
521318
+ minHeight: 0,
521319
+ children: [
521320
+ t21,
521321
+ t222
521322
+ ]
521323
+ }, undefined, true, undefined, this);
521324
+ $5[64] = t21;
521325
+ $5[65] = t222;
521326
+ $5[66] = t23;
521327
+ } else {
521328
+ t23 = $5[66];
521329
+ }
521330
+ return t23;
521331
+ }
521332
+ function _temp85(raw2) {
521333
+ let s2 = raw2.replace(/^Claude\s+/i, "").replace(/^GPT\s+/i, "GPT-").replace(/^Gemini\s+/i, "");
521334
+ if (s2.length > 14) {
521335
+ s2 = `${s2.slice(0, 13)}\u2026`;
521336
+ }
521337
+ return s2;
521338
+ }
521339
+ function _temp78(a2, b5) {
521340
+ return a2.agentId.localeCompare(b5.agentId);
521341
+ }
520996
521342
  function SystemPane(t0) {
520997
521343
  const $5 = import_compiler_runtime66.c(139);
520998
521344
  const {
@@ -521041,7 +521387,7 @@ function SystemPane(t0) {
521041
521387
  t3 = $5[6];
521042
521388
  }
521043
521389
  const wkColor = t3;
521044
- const wkIcon = _temp78;
521390
+ const wkIcon = _temp94;
521045
521391
  let t4;
521046
521392
  if ($5[7] === Symbol.for("react.memo_cache_sentinel")) {
521047
521393
  t4 = getTerminalStats();
@@ -521676,7 +522022,7 @@ function SystemPane(t0) {
521676
522022
  }
521677
522023
  return t58;
521678
522024
  }
521679
- function _temp78(s_0) {
522025
+ function _temp94(s_0) {
521680
522026
  return s_0 === "busy" ? icon("worker_busy") : s_0 === "crashed" ? icon("worker_crash") : s_0 === "restarting" ? icon("worker_restart") : icon("worker");
521681
522027
  }
521682
522028
  var import_compiler_runtime66, import_react117, BOLD16, SIDEBAR_W2 = 22, TABS;
@@ -521701,7 +522047,7 @@ var init_StatusDashboard = __esm(async () => {
521701
522047
  import_compiler_runtime66 = __toESM(require_compiler_runtime(), 1);
521702
522048
  import_react117 = __toESM(require_react(), 1);
521703
522049
  BOLD16 = TextAttributes.BOLD;
521704
- TABS = ["Usage", "Prompt", "Cost", "Tabs", "System"];
522050
+ TABS = ["Usage", "Prompt", "Cost", "Tabs", "Dispatch", "System"];
521705
522051
  });
521706
522052
 
521707
522053
  // src/components/modals/TabNamePopup.tsx
@@ -529709,7 +530055,7 @@ function MCPSettings(t0) {
529709
530055
  const toolPageSize = Math.max(3, Math.floor(maxVisibleRows / 2));
529710
530056
  let t1;
529711
530057
  if ($5[0] !== projectServers) {
529712
- t1 = new Set(projectServers.map(_temp89));
530058
+ t1 = new Set(projectServers.map(_temp90));
529713
530059
  $5[0] = projectServers;
529714
530060
  $5[1] = t1;
529715
530061
  } else {
@@ -530073,7 +530419,7 @@ function MCPSettings(t0) {
530073
530419
  return;
530074
530420
  }
530075
530421
  if (evt.name === "tab" && !pendingDelete) {
530076
- setView(_temp85);
530422
+ setView(_temp89);
530077
530423
  return;
530078
530424
  }
530079
530425
  if (view === "list" && pendingDelete) {
@@ -530082,7 +530428,7 @@ function MCPSettings(t0) {
530082
530428
  return;
530083
530429
  }
530084
530430
  if (evt.name === "left" || evt.name === "right" || evt.name === "tab" || evt.name === "up" || evt.name === "down") {
530085
- setDeleteChoice(_temp94);
530431
+ setDeleteChoice(_temp95);
530086
530432
  return;
530087
530433
  }
530088
530434
  if (evt.name === "return") {
@@ -530491,10 +530837,10 @@ function _temp112(f_1) {
530491
530837
  return f_1.slice(0, -1);
530492
530838
  }
530493
530839
  function _temp03() {}
530494
- function _temp94(c_0) {
530840
+ function _temp95(c_0) {
530495
530841
  return c_0 === "no" ? "yes" : "no";
530496
530842
  }
530497
- function _temp85(v4) {
530843
+ function _temp89(v4) {
530498
530844
  return v4 === "list" ? "tools" : "list";
530499
530845
  }
530500
530846
  function _temp710(d_0) {
@@ -530519,7 +530865,7 @@ function _temp322(s_1) {
530519
530865
  function _temp228(s_0) {
530520
530866
  return s_0.servers;
530521
530867
  }
530522
- function _temp89(s2) {
530868
+ function _temp90(s2) {
530523
530869
  return s2.name;
530524
530870
  }
530525
530871
  function Sep(t0) {
@@ -532646,7 +532992,7 @@ function ProviderSettings(t0) {
532646
532992
  width: contentW,
532647
532993
  maxRows: Math.max(1, Math.floor(maxVisible / 3)),
532648
532994
  rowHeight: 3,
532649
- keyExtractor: _temp90,
532995
+ keyExtractor: _temp96,
532650
532996
  renderItem: (item_2, t142) => {
532651
532997
  const {
532652
532998
  selected
@@ -532891,7 +533237,7 @@ function _temp229(o3) {
532891
533237
  label: o3
532892
533238
  };
532893
533239
  }
532894
- function _temp90(item_1) {
533240
+ function _temp96(item_1) {
532895
533241
  return item_1.key;
532896
533242
  }
532897
533243
  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 +533888,24 @@ var init_RepoMapStatusPopup = __esm(async () => {
533542
533888
  });
533543
533889
 
533544
533890
  // 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;
533891
+ function truncate4(s2, max) {
533892
+ if (s2.length <= max)
533893
+ return s2;
533894
+ if (max <= 1)
533895
+ return s2.slice(0, max);
533896
+ return `${s2.slice(0, max - 1)}\u2026`;
533897
+ }
533898
+ function RouterSettings({
533899
+ visible,
533900
+ router: router2,
533901
+ activeModel,
533902
+ scope,
533903
+ onScopeChange,
533904
+ onPickSlot,
533905
+ onClearSlot,
533906
+ onPickerChange,
533907
+ onClose
533908
+ }) {
533558
533909
  const t2 = useTheme();
533559
533910
  const {
533560
533911
  width: tw2,
@@ -533562,446 +533913,293 @@ function RouterSettings(t0) {
533562
533913
  } = useTerminalDimensions();
533563
533914
  const [cursor, setCursor] = import_react137.useState(0);
533564
533915
  const popupW = Math.min(100, Math.max(72, Math.floor(tw2 * 0.78)));
533565
- const popupH = Math.min(36, Math.max(22, th - 4));
533916
+ const popupH = Math.min(40, Math.max(26, th - 4));
533566
533917
  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;
533918
+ const rows = import_react137.useMemo(() => {
533919
+ const out2 = [];
533920
+ for (const s2 of SECTIONS) {
533921
+ out2.push({
533922
+ kind: "header",
533923
+ section: s2
533924
+ });
533925
+ for (const d3 of s2.defs) {
533926
+ if (d3.kind === "slot")
533927
+ out2.push({
533928
+ kind: "slot",
533929
+ section: s2,
533930
+ def: d3
533931
+ });
533704
533932
  }
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) {
533933
+ }
533934
+ return out2;
533935
+ }, []);
533936
+ const slotIndices = import_react137.useMemo(() => rows.map((r4, i4) => r4.kind === "slot" ? i4 : -1).filter((i_0) => i_0 >= 0), [rows]);
533937
+ const moveItem = (dir) => {
533938
+ if (slotIndices.length === 0)
533939
+ return;
533940
+ const cur = slotIndices.indexOf(cursor);
533941
+ const base = cur < 0 ? 0 : cur;
533942
+ const nextPos = (base + dir + slotIndices.length) % slotIndices.length;
533943
+ setCursor(slotIndices[nextPos] ?? slotIndices[0] ?? 0);
533944
+ };
533945
+ import_react137.useMemo(() => {
533946
+ if (cursor === 0 && slotIndices.length > 0 && slotIndices[0] !== 0) {
533947
+ setCursor(slotIndices[0] ?? 0);
533948
+ }
533949
+ }, [cursor, slotIndices]);
533950
+ const selectedRow = rows[cursor];
533951
+ const selectedDef = selectedRow?.kind === "slot" ? selectedRow.def : null;
533952
+ const pickerDefs = import_react137.useMemo(() => ALL_DEFS.filter((d_0) => d_0.kind === "picker"), []);
533953
+ useKeyboard((evt) => {
533954
+ if (!visible)
533955
+ return;
533956
+ if (evt.name === "escape" || evt.name === "q") {
533957
+ onClose();
533958
+ return;
533959
+ }
533960
+ if (evt.name === "up" || evt.name === "k") {
533961
+ moveItem(-1);
533962
+ return;
533963
+ }
533964
+ if (evt.name === "down" || evt.name === "j") {
533965
+ moveItem(1);
533966
+ return;
533967
+ }
533968
+ if (evt.name === "return") {
533969
+ if (selectedDef)
533970
+ onPickSlot(selectedDef.key);
533971
+ return;
533972
+ }
533973
+ if (evt.name === "d" || evt.name === "delete" || evt.name === "backspace") {
533974
+ if (selectedDef)
533975
+ onClearSlot(selectedDef.key);
533976
+ return;
533977
+ }
533978
+ if (evt.name === "left" || evt.name === "right") {
533979
+ const sIdx = CONFIG_SCOPES.indexOf(scope);
533980
+ const next = evt.name === "left" ? CONFIG_SCOPES[(sIdx - 1 + CONFIG_SCOPES.length) % CONFIG_SCOPES.length] : CONFIG_SCOPES[(sIdx + 1) % CONFIG_SCOPES.length];
533981
+ if (next && next !== scope)
533982
+ onScopeChange(next, scope);
533983
+ return;
533984
+ }
533985
+ handleCursorNavKey(evt, setCursor, rows.length);
533986
+ });
533987
+ if (!visible)
533724
533988
  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 = [{
533989
+ const customCount = ALL_DEFS.filter((d_1) => d_1.kind === "slot" && typeof router2?.[d_1.key] === "string").length;
533990
+ const slotCount = ALL_DEFS.filter((d_2) => d_2.kind === "slot").length;
533991
+ const labelCol = 12;
533992
+ const modelCol = Math.min(30, Math.max(18, Math.floor(contentW * 0.32)));
533993
+ const descCol = Math.max(8, contentW - 4 - labelCol - modelCol - 2);
533994
+ const shortModel = (m5) => {
533995
+ const slash = m5.indexOf("/");
533996
+ return slash > 0 ? m5.slice(slash + 1) : m5;
533997
+ };
533998
+ return /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV(PremiumPopup, {
533999
+ visible,
534000
+ width: popupW,
534001
+ height: popupH,
534002
+ title: "Task Router",
534003
+ titleIcon: "router",
534004
+ blurb: `${customCount}/${slotCount} set \xB7 ${scope} \xB7 default: ${shortModel(activeModel)}`,
534005
+ footerHints: [{
533747
534006
  key: "\u2191\u2193",
533748
534007
  label: "nav"
533749
534008
  }, {
533750
534009
  key: "Enter",
533751
- label: "pick model"
534010
+ label: "set"
533752
534011
  }, {
533753
534012
  key: "d",
533754
534013
  label: "reset"
533755
534014
  }, {
533756
534015
  key: "\u2190\u2192",
533757
- label: "scope / value"
534016
+ label: "scope"
533758
534017
  }, {
533759
534018
  key: "Esc",
533760
534019
  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, {
534020
+ }],
534021
+ children: /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV(Section, {
533856
534022
  children: [
533857
- t12,
533858
- t13,
533859
- t14,
533860
- t15,
533861
- t16,
533862
- t17,
533863
- t19
534023
+ /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("box", {
534024
+ flexDirection: "column",
534025
+ backgroundColor: t2.bgPopup,
534026
+ children: rows.map((row, idx) => {
534027
+ if (row.kind === "header") {
534028
+ return /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("box", {
534029
+ flexDirection: "column",
534030
+ backgroundColor: t2.bgPopup,
534031
+ children: [
534032
+ idx > 0 ? /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("box", {
534033
+ height: 1,
534034
+ backgroundColor: t2.bgPopup
534035
+ }, undefined, false, undefined, this) : null,
534036
+ /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("text", {
534037
+ bg: t2.bgPopup,
534038
+ fg: t2.brandAlt,
534039
+ attributes: BOLD18,
534040
+ children: row.section.title
534041
+ }, undefined, false, undefined, this)
534042
+ ]
534043
+ }, `h-${idx}`, true, undefined, this);
534044
+ }
534045
+ const isSelected = idx === cursor;
534046
+ const rowBg = isSelected ? t2.bgPopupHighlight : t2.bgPopup;
534047
+ const raw2 = router2?.[row.def.key] ?? null;
534048
+ const modelId = typeof raw2 === "string" ? raw2 : null;
534049
+ const descFg = isSelected ? t2.textSecondary : t2.textMuted;
534050
+ const label = row.def.label.padEnd(labelCol).slice(0, labelCol);
534051
+ const desc = truncate4(row.def.hint, descCol).padEnd(descCol).slice(0, descCol);
534052
+ return /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("box", {
534053
+ flexDirection: "row",
534054
+ height: 1,
534055
+ backgroundColor: rowBg,
534056
+ children: [
534057
+ /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("text", {
534058
+ bg: rowBg,
534059
+ fg: isSelected ? t2.brandSecondary : t2.textFaint,
534060
+ attributes: BOLD18,
534061
+ children: isSelected ? "\u25B8 " : " "
534062
+ }, undefined, false, undefined, this),
534063
+ /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("text", {
534064
+ bg: rowBg,
534065
+ fg: t2.textPrimary,
534066
+ attributes: BOLD18,
534067
+ children: label
534068
+ }, undefined, false, undefined, this),
534069
+ /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("text", {
534070
+ bg: rowBg,
534071
+ fg: descFg,
534072
+ children: desc
534073
+ }, undefined, false, undefined, this),
534074
+ /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("box", {
534075
+ flexGrow: 1,
534076
+ backgroundColor: rowBg
534077
+ }, undefined, false, undefined, this),
534078
+ modelId ? /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("text", {
534079
+ bg: rowBg,
534080
+ fg: t2.brandAlt,
534081
+ attributes: BOLD18,
534082
+ children: truncate4(shortModel(modelId), modelCol)
534083
+ }, undefined, false, undefined, this) : /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("text", {
534084
+ bg: rowBg,
534085
+ fg: t2.textDim,
534086
+ children: "\u2014"
534087
+ }, undefined, false, undefined, this),
534088
+ /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("text", {
534089
+ bg: rowBg,
534090
+ children: " "
534091
+ }, undefined, false, undefined, this)
534092
+ ]
534093
+ }, `s-${idx}`, true, undefined, this);
534094
+ })
534095
+ }, undefined, false, undefined, this),
534096
+ /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV(VSpacer, {}, undefined, false, undefined, this),
534097
+ pickerDefs.map((def) => {
534098
+ const cur_0 = router2?.[def.key];
534099
+ const num = typeof cur_0 === "number" ? cur_0 : def.defaultValue;
534100
+ return /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV(SegmentedControl, {
534101
+ label: def.label,
534102
+ labelWidth: 14,
534103
+ options: def.options.map((o3) => ({
534104
+ value: o3,
534105
+ label: String(o3)
534106
+ })),
534107
+ value: num
534108
+ }, def.key, false, undefined, this);
534109
+ }),
534110
+ /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV(VSpacer, {}, undefined, false, undefined, this),
534111
+ /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV(SegmentedControl, {
534112
+ label: "Scope",
534113
+ labelWidth: 14,
534114
+ options: CONFIG_SCOPES.map((s_0) => ({
534115
+ value: s_0,
534116
+ label: s_0
534117
+ })),
534118
+ value: scope
534119
+ }, undefined, false, undefined, this)
533864
534120
  ]
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";
534121
+ }, undefined, true, undefined, this)
534122
+ }, undefined, false, undefined, this);
533920
534123
  }
533921
- var import_compiler_runtime74, import_react137, SECTIONS, ALL_DEFS;
534124
+ var import_react137, BOLD18 = 1, SECTIONS, ALL_DEFS;
533922
534125
  var init_RouterSettings = __esm(async () => {
533923
534126
  init_theme();
533924
534127
  init_shared2();
533925
534128
  init_ui2();
533926
534129
  init_jsx_dev_runtime();
533927
534130
  await init_react2();
533928
- import_compiler_runtime74 = __toESM(require_compiler_runtime(), 1);
533929
534131
  import_react137 = __toESM(require_react(), 1);
533930
534132
  SECTIONS = [{
533931
534133
  id: "main",
533932
- title: "Main Agent",
533933
- subtitle: "Model that handles your conversation",
534134
+ title: "Main",
533934
534135
  defs: [{
533935
534136
  kind: "slot",
533936
534137
  key: "default",
533937
534138
  label: "Default",
533938
534139
  icon: "model",
533939
- hint: "Fallback for background tasks when no specific model is set"
534140
+ hint: "Conversation & fallback"
533940
534141
  }]
533941
534142
  }, {
533942
534143
  id: "dispatch",
533943
534144
  title: "Dispatch",
533944
- subtitle: "Models for parallel subagents",
533945
534145
  defs: [{
533946
534146
  kind: "slot",
533947
534147
  key: "spark",
533948
534148
  label: "Explore",
533949
534149
  icon: "read_only",
533950
- hint: "Read-only agents \u2014 searches, reads, analyzes"
534150
+ hint: "Read-only agents"
533951
534151
  }, {
533952
534152
  kind: "slot",
533953
534153
  key: "ember",
533954
534154
  label: "Code",
533955
534155
  icon: "edit",
533956
- hint: "Edit agents \u2014 reads files, makes changes"
534156
+ hint: "Edit agents"
533957
534157
  }, {
533958
534158
  kind: "slot",
533959
534159
  key: "webSearch",
533960
534160
  label: "Web",
533961
534161
  icon: "web",
533962
- hint: "Searches the web & fetches pages"
534162
+ hint: "Web search & fetch"
533963
534163
  }, {
533964
534164
  kind: "picker",
533965
534165
  key: "maxConcurrentAgents",
533966
534166
  label: "Concurrency",
533967
534167
  icon: "dispatch",
533968
- hint: "Max parallel agents per dispatch (default 3)",
534168
+ hint: "Max parallel agents",
533969
534169
  options: [2, 3, 4, 5, 6, 7, 8],
533970
534170
  defaultValue: 3
533971
534171
  }]
533972
534172
  }, {
533973
534173
  id: "post",
533974
534174
  title: "Post-Dispatch",
533975
- subtitle: "Quality checks after code agents finish",
533976
534175
  defs: [{
533977
534176
  kind: "slot",
533978
534177
  key: "desloppify",
533979
534178
  label: "Cleanup",
533980
534179
  icon: "cleanup",
533981
- hint: "Post-dispatch polish & style fixes"
534180
+ hint: "Polish & style fixes"
533982
534181
  }, {
533983
534182
  kind: "slot",
533984
534183
  key: "verify",
533985
534184
  label: "Review",
533986
534185
  icon: "review",
533987
- hint: "Adversarial review after code agents"
534186
+ hint: "Adversarial review"
533988
534187
  }]
533989
534188
  }, {
533990
534189
  id: "bg",
533991
534190
  title: "Background",
533992
- subtitle: "Internal tasks \u2014 usually fine on defaults",
533993
534191
  defs: [{
533994
534192
  kind: "slot",
533995
534193
  key: "compact",
533996
534194
  label: "Compaction",
533997
534195
  icon: "compact_task",
533998
- hint: "Summarizes old context when conversation grows long"
534196
+ hint: "Summarize old context"
533999
534197
  }, {
534000
534198
  kind: "slot",
534001
534199
  key: "semantic",
534002
534200
  label: "Soul Map",
534003
534201
  icon: "repomap",
534004
- hint: "Generates symbol summaries for the repo map"
534202
+ hint: "Symbol summaries"
534005
534203
  }]
534006
534204
  }];
534007
534205
  ALL_DEFS = SECTIONS.flatMap((s2) => s2.defs);
@@ -534011,7 +534209,7 @@ var init_RouterSettings = __esm(async () => {
534011
534209
  import { existsSync as existsSync51 } from "fs";
534012
534210
  import { join as join60 } from "path";
534013
534211
  function SearchSkillRow(t0) {
534014
- const $5 = import_compiler_runtime75.c(32);
534212
+ const $5 = import_compiler_runtime74.c(32);
534015
534213
  const {
534016
534214
  skill,
534017
534215
  isSelected,
@@ -534146,7 +534344,7 @@ function SearchSkillRow(t0) {
534146
534344
  return t12;
534147
534345
  }
534148
534346
  function InstalledSkillRow(t0) {
534149
- const $5 = import_compiler_runtime75.c(23);
534347
+ const $5 = import_compiler_runtime74.c(23);
534150
534348
  const {
534151
534349
  skill,
534152
534350
  isSelected,
@@ -534248,7 +534446,7 @@ function InstalledSkillRow(t0) {
534248
534446
  return t10;
534249
534447
  }
534250
534448
  function ActiveSkillRow(t0) {
534251
- const $5 = import_compiler_runtime75.c(17);
534449
+ const $5 = import_compiler_runtime74.c(17);
534252
534450
  const {
534253
534451
  name: name39,
534254
534452
  isSelected
@@ -534325,7 +534523,7 @@ function ActiveSkillRow(t0) {
534325
534523
  return t8;
534326
534524
  }
534327
534525
  function SkillSearch(t0) {
534328
- const $5 = import_compiler_runtime75.c(145);
534526
+ const $5 = import_compiler_runtime74.c(145);
534329
534527
  const {
534330
534528
  visible,
534331
534529
  contextManager,
@@ -534406,7 +534604,7 @@ function SkillSearch(t0) {
534406
534604
  const filterQuery = query2.toLowerCase().trim();
534407
534605
  let t82;
534408
534606
  if ($5[12] !== installed2) {
534409
- t82 = new Set(installed2.map(_temp96));
534607
+ t82 = new Set(installed2.map(_temp98));
534410
534608
  $5[12] = installed2;
534411
534609
  $5[13] = t82;
534412
534610
  } else {
@@ -534483,7 +534681,7 @@ function SkillSearch(t0) {
534483
534681
  setCursor(0);
534484
534682
  refreshInstalled();
534485
534683
  refreshActive();
534486
- listPopularSkills().then((r4) => setPopular(r4)).catch(_temp231);
534684
+ listPopularSkills().then((r4) => setPopular(r4)).catch(_temp230);
534487
534685
  }
534488
534686
  };
534489
534687
  t13 = [visible, refreshActive, refreshInstalled];
@@ -534649,7 +534847,7 @@ function SkillSearch(t0) {
534649
534847
  return;
534650
534848
  }
534651
534849
  if (evt.name === "up" || evt.name === "down") {
534652
- setScopeCursor(_temp325);
534850
+ setScopeCursor(_temp324);
534653
534851
  return;
534654
534852
  }
534655
534853
  if (evt.name === "return") {
@@ -534714,12 +534912,12 @@ function SkillSearch(t0) {
534714
534912
  return;
534715
534913
  }
534716
534914
  if (evt.name === "backspace" || evt.name === "delete") {
534717
- setQuery(_temp420);
534915
+ setQuery(_temp419);
534718
534916
  resetScroll();
534719
534917
  return;
534720
534918
  }
534721
534919
  if (evt.name === "space") {
534722
- setQuery(_temp516);
534920
+ setQuery(_temp515);
534723
534921
  resetScroll();
534724
534922
  return;
534725
534923
  }
@@ -534810,7 +535008,7 @@ function SkillSearch(t0) {
534810
535008
  t26 = $5[77];
534811
535009
  }
534812
535010
  t27 = tab;
534813
- t28 = footerHints.map(_temp613);
535011
+ t28 = footerHints.map(_temp612);
534814
535012
  $5[64] = popupWidth;
534815
535013
  $5[65] = tab;
534816
535014
  $5[66] = termRows;
@@ -535035,7 +535233,7 @@ function SkillSearch(t0) {
535035
535233
  selectedIndex: cursor,
535036
535234
  width: contentW,
535037
535235
  maxRows: maxVisible,
535038
- keyExtractor: _temp810,
535236
+ keyExtractor: _temp811,
535039
535237
  emptyMessage: query2 ? "no matching skills" : "no installed skills found",
535040
535238
  renderItem: (skill_4, t372) => {
535041
535239
  const {
@@ -535067,7 +535265,7 @@ function SkillSearch(t0) {
535067
535265
  selectedIndex: cursor,
535068
535266
  width: contentW,
535069
535267
  maxRows: maxVisible,
535070
- keyExtractor: _temp95,
535268
+ keyExtractor: _temp97,
535071
535269
  emptyMessage: query2 ? "no matching skills" : "no active skills \u2014 load from Installed tab",
535072
535270
  renderItem: (name_2, t382) => {
535073
535271
  const {
@@ -535129,35 +535327,35 @@ function SkillSearch(t0) {
535129
535327
  }
535130
535328
  return t38;
535131
535329
  }
535132
- function _temp95(name_1) {
535330
+ function _temp97(name_1) {
535133
535331
  return name_1;
535134
535332
  }
535135
- function _temp810(s_3) {
535333
+ function _temp811(s_3) {
535136
535334
  return s_3.path;
535137
535335
  }
535138
535336
  function _temp711(s_2) {
535139
535337
  return s_2.id;
535140
535338
  }
535141
- function _temp613(h3) {
535339
+ function _temp612(h3) {
535142
535340
  return {
535143
535341
  key: h3.key.replace("\u2191\u2193", "\u2191\u2193").replace("\u23CE", "Enter"),
535144
535342
  label: h3.label
535145
535343
  };
535146
535344
  }
535147
- function _temp516(prev_3) {
535345
+ function _temp515(prev_3) {
535148
535346
  return `${prev_3} `;
535149
535347
  }
535150
- function _temp420(prev_2) {
535348
+ function _temp419(prev_2) {
535151
535349
  return prev_2.slice(0, -1);
535152
535350
  }
535153
- function _temp325(prev) {
535351
+ function _temp324(prev) {
535154
535352
  return prev === 0 ? 1 : 0;
535155
535353
  }
535156
- function _temp231() {}
535157
- function _temp96(s2) {
535354
+ function _temp230() {}
535355
+ function _temp98(s2) {
535158
535356
  return s2.name;
535159
535357
  }
535160
- var import_compiler_runtime75, import_react139, MAX_POPUP_WIDTH5 = 120, CHROME_ROWS7 = 9, TABS6;
535358
+ var import_compiler_runtime74, import_react139, MAX_POPUP_WIDTH5 = 120, CHROME_ROWS7 = 9, TABS6;
535161
535359
  var init_SkillSearch = __esm(async () => {
535162
535360
  init_manager3();
535163
535361
  init_theme();
@@ -535167,14 +535365,14 @@ var init_SkillSearch = __esm(async () => {
535167
535365
  init_core4(),
535168
535366
  init_react2()
535169
535367
  ]);
535170
- import_compiler_runtime75 = __toESM(require_compiler_runtime(), 1);
535368
+ import_compiler_runtime74 = __toESM(require_compiler_runtime(), 1);
535171
535369
  import_react139 = __toESM(require_react(), 1);
535172
535370
  TABS6 = ["search", "installed", "active"];
535173
535371
  });
535174
535372
 
535175
535373
  // src/components/settings/ToolsPopup.tsx
535176
535374
  function ToolsPopup(t0) {
535177
- const $5 = import_compiler_runtime76.c(29);
535375
+ const $5 = import_compiler_runtime75.c(29);
535178
535376
  const {
535179
535377
  visible,
535180
535378
  disabledTools,
@@ -535354,13 +535552,13 @@ function ToolsPopup(t0) {
535354
535552
  }
535355
535553
  return t13;
535356
535554
  }
535357
- var import_compiler_runtime76, import_react141;
535555
+ var import_compiler_runtime75, import_react141;
535358
535556
  var init_ToolsPopup = __esm(async () => {
535359
535557
  init_constants();
535360
535558
  init_ui2();
535361
535559
  init_jsx_dev_runtime();
535362
535560
  await init_react2();
535363
- import_compiler_runtime76 = __toESM(require_compiler_runtime(), 1);
535561
+ import_compiler_runtime75 = __toESM(require_compiler_runtime(), 1);
535364
535562
  import_react141 = __toESM(require_react(), 1);
535365
535563
  });
535366
535564
 
@@ -535457,7 +535655,7 @@ __export(exports_App, {
535457
535655
  });
535458
535656
  import { spawn as spawn24 } from "child_process";
535459
535657
  import { join as join61 } from "path";
535460
- function truncate4(str, max) {
535658
+ function truncate5(str, max) {
535461
535659
  return str.length > max ? `${str.slice(0, max - 1)}\u2026` : str;
535462
535660
  }
535463
535661
  function lerpHex3(a2, b5, tVal) {
@@ -535474,7 +535672,7 @@ function lerpHex3(a2, b5, tVal) {
535474
535672
  return `#${hex3(r4)}${hex3(g3)}${hex3(bl)}`;
535475
535673
  }
535476
535674
  function ShutdownSplash(t0) {
535477
- const $5 = import_compiler_runtime77.c(39);
535675
+ const $5 = import_compiler_runtime76.c(39);
535478
535676
  const {
535479
535677
  phase,
535480
535678
  sessionId,
@@ -535497,7 +535695,7 @@ function ShutdownSplash(t0) {
535497
535695
  let t3;
535498
535696
  if ($5[2] === Symbol.for("react.memo_cache_sentinel")) {
535499
535697
  t2 = () => {
535500
- const timer = setInterval(() => setTick(_temp98), 80);
535698
+ const timer = setInterval(() => setTick(_temp99), 80);
535501
535699
  return () => clearInterval(timer);
535502
535700
  };
535503
535701
  t3 = [];
@@ -535711,11 +535909,11 @@ function ShutdownSplash(t0) {
535711
535909
  }
535712
535910
  return t13;
535713
535911
  }
535714
- function _temp98(t2) {
535912
+ function _temp99(t2) {
535715
535913
  return t2 + 1;
535716
535914
  }
535717
535915
  function CheckpointLegend(t0) {
535718
- const $5 = import_compiler_runtime77.c(35);
535916
+ const $5 = import_compiler_runtime76.c(35);
535719
535917
  const {
535720
535918
  tabId,
535721
535919
  fallbackSpacer
@@ -536931,7 +537129,7 @@ function App({
536931
537129
  }, undefined, true, undefined, this),
536932
537130
  /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("span", {
536933
537131
  fg: t2.textSecondary,
536934
- children: truncate4(displayModel, isProxy || isGateway ? 20 : 28)
537132
+ children: truncate5(displayModel, isProxy || isGateway ? 20 : 28)
536935
537133
  }, undefined, false, undefined, this)
536936
537134
  ]
536937
537135
  }, undefined, true, undefined, this),
@@ -536947,7 +537145,7 @@ function App({
536947
537145
  children: [
536948
537146
  UI_ICONS.git,
536949
537147
  " ",
536950
- truncate4(git.branch ?? "HEAD", termWidth >= 120 ? 30 : 15),
537148
+ truncate5(git.branch ?? "HEAD", termWidth >= 120 ? 30 : 15),
536951
537149
  git.isDirty ? "*" : ""
536952
537150
  ]
536953
537151
  }, undefined, true, undefined, this)
@@ -537387,7 +537585,7 @@ function App({
537387
537585
  ]
537388
537586
  }, undefined, true, undefined, this);
537389
537587
  }
537390
- var import_compiler_runtime77, import_react143, ABORT_ON_LOADING, DEFAULT_TASK_ROUTER, SHUTDOWN_STEPS, KITTY_PROTOCOL_RESPONSE_RE;
537588
+ var import_compiler_runtime76, import_react143, ABORT_ON_LOADING, DEFAULT_TASK_ROUTER, SHUTDOWN_STEPS, KITTY_PROTOCOL_RESPONSE_RE;
537391
537589
  var init_App = __esm(async () => {
537392
537590
  init_shallow2();
537393
537591
  init_config2();
@@ -537464,7 +537662,7 @@ var init_App = __esm(async () => {
537464
537662
  init_SkillSearch(),
537465
537663
  init_ToolsPopup()
537466
537664
  ]);
537467
- import_compiler_runtime77 = __toESM(require_compiler_runtime(), 1);
537665
+ import_compiler_runtime76 = __toESM(require_compiler_runtime(), 1);
537468
537666
  import_react143 = __toESM(require_react(), 1);
537469
537667
  startMemoryPoll();
537470
537668
  ABORT_ON_LOADING = new Set(["/clear", "/compact", "/plan", "/session clear", "/session compact", "/session plan"]);