@pensar/apex 0.0.91-canary.bb29f4ef → 0.0.91

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/build/index.js +508 -582
  2. package/package.json +1 -1
package/build/index.js CHANGED
@@ -31971,7 +31971,7 @@ var package_default2;
31971
31971
  var init_package = __esm(() => {
31972
31972
  package_default2 = {
31973
31973
  name: "@pensar/apex",
31974
- version: "0.0.91-canary.bb29f4ef",
31974
+ version: "0.0.91",
31975
31975
  description: "AI-powered penetration testing CLI tool with terminal UI",
31976
31976
  module: "src/tui/index.tsx",
31977
31977
  main: "build/index.js",
@@ -89526,22 +89526,44 @@ import {
89526
89526
  readdirSync as readdirSync2
89527
89527
  } from "fs";
89528
89528
  import { join as join4 } from "path";
89529
- function loadSubagentMessages(session, agentName) {
89530
- const filePath = join4(session.rootPath, SUBAGENTS_DIR, `${agentName}.json`);
89531
- if (!existsSync8(filePath))
89532
- return [];
89533
- try {
89534
- const data = JSON.parse(readFileSync3(filePath, "utf-8"));
89535
- return data.messages;
89536
- } catch {
89537
- return [];
89529
+ function mapToSavedMessage(msg) {
89530
+ const m2 = msg;
89531
+ if (typeof m2.content === "string") {
89532
+ return { role: m2.role, content: m2.content };
89533
+ }
89534
+ if (Array.isArray(m2.content)) {
89535
+ const mapped = m2.content.map((part) => {
89536
+ if (part.type === "tool-call") {
89537
+ return {
89538
+ type: "tool-call",
89539
+ toolCallId: part.toolCallId,
89540
+ toolName: part.toolName,
89541
+ input: part.args ?? part.input
89542
+ };
89543
+ }
89544
+ if (part.type === "tool-result") {
89545
+ return {
89546
+ type: "tool-result",
89547
+ toolCallId: part.toolCallId,
89548
+ toolName: part.toolName,
89549
+ output: part.result ?? part.output
89550
+ };
89551
+ }
89552
+ return {
89553
+ type: "text",
89554
+ text: part.text ?? ""
89555
+ };
89556
+ });
89557
+ return { role: m2.role, content: mapped };
89538
89558
  }
89559
+ return { role: m2.role, content: String(m2.content) };
89539
89560
  }
89540
89561
  function saveSubagentData(session, data) {
89541
89562
  const subagentsDir = join4(session.rootPath, SUBAGENTS_DIR);
89542
89563
  mkdirSync2(subagentsDir, { recursive: true });
89543
89564
  let toolCallCount = 0;
89544
89565
  let stepCount = 0;
89566
+ const savedMessages = [];
89545
89567
  for (const msg of data.messages) {
89546
89568
  if (msg.role === "assistant") {
89547
89569
  stepCount++;
@@ -89552,10 +89574,12 @@ function saveSubagentData(session, data) {
89552
89574
  }
89553
89575
  }
89554
89576
  }
89577
+ savedMessages.push(mapToSavedMessage(msg));
89555
89578
  }
89579
+ const now2 = new Date;
89556
89580
  const savedData = {
89557
89581
  agentName: data.agentName,
89558
- timestamp: new Date().toISOString(),
89582
+ timestamp: now2.toISOString(),
89559
89583
  target: data.target,
89560
89584
  objective: data.objective,
89561
89585
  vulnerabilityClass: data.vulnerabilityClass,
@@ -89564,24 +89588,16 @@ function saveSubagentData(session, data) {
89564
89588
  findingsCount: data.findingsCount ?? 0,
89565
89589
  status: data.status,
89566
89590
  error: data.error,
89567
- messages: data.messages
89591
+ messages: savedMessages
89568
89592
  };
89569
- writeFileSync2(join4(subagentsDir, `${data.agentName}.json`), JSON.stringify(savedData, null, 2));
89593
+ const ts = now2.toISOString().replace(/[:.]/g, "-");
89594
+ const filename = `${data.agentName}-${ts}.json`;
89595
+ writeFileSync2(join4(subagentsDir, filename), JSON.stringify(savedData, null, 2));
89570
89596
  }
89571
89597
  function writeAgentManifest(session, entries2) {
89572
89598
  const manifestPath = join4(session.rootPath, MANIFEST_FILE);
89573
89599
  writeFileSync2(manifestPath, JSON.stringify(entries2, null, 2));
89574
89600
  }
89575
- function readAgentManifest(session) {
89576
- const manifestPath = join4(session.rootPath, MANIFEST_FILE);
89577
- if (!existsSync8(manifestPath))
89578
- return [];
89579
- try {
89580
- return JSON.parse(readFileSync3(manifestPath, "utf-8"));
89581
- } catch {
89582
- return [];
89583
- }
89584
- }
89585
89601
  function buildManifestEntries(targets) {
89586
89602
  return targets.map((t2, i) => ({
89587
89603
  id: `pentest-agent-${i + 1}`,
@@ -89594,31 +89610,18 @@ function buildManifestEntries(targets) {
89594
89610
  }));
89595
89611
  }
89596
89612
  function finalizeManifest(session, entries2, results) {
89597
- const finalManifest = entries2.map((entry, i) => {
89598
- if (entry.status === "completed")
89599
- return entry;
89600
- return {
89601
- ...entry,
89602
- status: results[i] != null ? "completed" : "failed",
89603
- completedAt: new Date().toISOString()
89604
- };
89605
- });
89613
+ const finalManifest = entries2.map((entry, i) => ({
89614
+ ...entry,
89615
+ status: results[i] != null ? "completed" : "failed",
89616
+ completedAt: new Date().toISOString()
89617
+ }));
89606
89618
  writeAgentManifest(session, finalManifest);
89607
89619
  }
89608
- function updateManifestEntryStatus(session, agentId, status) {
89609
- const manifest = readAgentManifest(session);
89610
- const updated = manifest.map((e) => e.id === agentId ? { ...e, status, completedAt: new Date().toISOString() } : e);
89611
- writeAgentManifest(session, updated);
89612
- }
89613
- function getCompletedAgentIds(session) {
89614
- const manifest = readAgentManifest(session);
89615
- return new Set(manifest.filter((e) => e.id.startsWith("pentest-agent-") && e.status === "completed").map((e) => e.id));
89616
- }
89617
89620
  function parseSubagentFilename(filename) {
89618
89621
  if (filename.startsWith("attack-surface-agent")) {
89619
89622
  return { agentType: "attack-surface", name: "Attack Surface Discovery" };
89620
89623
  }
89621
- const pentestMatch = filename.match(/^pentest-agent-(\d+)/);
89624
+ const pentestMatch = filename.match(/^pentest-agent-(\d+)-/);
89622
89625
  if (pentestMatch) {
89623
89626
  return {
89624
89627
  agentType: "pentest",
@@ -89670,8 +89673,7 @@ function convertMessagesToUI(messages, baseTime) {
89670
89673
  createdAt
89671
89674
  });
89672
89675
  } else if (part.type === "tool-call") {
89673
- const input = part.input;
89674
- const toolDescription = typeof input?.toolCallDescription === "string" ? input.toolCallDescription : part.toolName || "tool";
89676
+ const toolDescription = typeof part.input?.toolCallDescription === "string" ? part.input.toolCallDescription : part.toolName || "tool";
89675
89677
  const result = part.toolCallId ? toolResults.get(part.toolCallId) : undefined;
89676
89678
  uiMessages.push({
89677
89679
  role: "tool",
@@ -89679,7 +89681,7 @@ function convertMessagesToUI(messages, baseTime) {
89679
89681
  createdAt,
89680
89682
  toolCallId: part.toolCallId,
89681
89683
  toolName: part.toolName,
89682
- args: input,
89684
+ args: part.input,
89683
89685
  result,
89684
89686
  status: "completed"
89685
89687
  });
@@ -89690,7 +89692,8 @@ function convertMessagesToUI(messages, baseTime) {
89690
89692
  return uiMessages;
89691
89693
  }
89692
89694
  function convertModelMessagesToUI(messages) {
89693
- return convertMessagesToUI(messages, new Date);
89695
+ const saved = messages.map((m2) => mapToSavedMessage(m2));
89696
+ return convertMessagesToUI(saved, new Date);
89694
89697
  }
89695
89698
  function loadSubagents(rootPath) {
89696
89699
  const subagentsPath = join4(rootPath, SUBAGENTS_DIR);
@@ -89698,7 +89701,11 @@ function loadSubagents(rootPath) {
89698
89701
  const agentNameIndex = new Map;
89699
89702
  if (existsSync8(subagentsPath)) {
89700
89703
  const files = readdirSync2(subagentsPath).filter((f) => f.endsWith(".json"));
89701
- files.sort();
89704
+ files.sort((a, b2) => {
89705
+ const timeA = a.match(/\d{4}-\d{2}-\d{2}T\d{2}-\d{2}-\d{2}/)?.[0] || "";
89706
+ const timeB = b2.match(/\d{4}-\d{2}-\d{2}T\d{2}-\d{2}-\d{2}/)?.[0] || "";
89707
+ return timeA.localeCompare(timeB);
89708
+ });
89702
89709
  for (const file2 of files) {
89703
89710
  if (file2.startsWith("orchestrator-"))
89704
89711
  continue;
@@ -89722,9 +89729,9 @@ function loadSubagents(rootPath) {
89722
89729
  }
89723
89730
  break;
89724
89731
  }
89725
- agentNameIndex.set(data.agentName, subagents.length);
89732
+ const idx = subagents.length;
89726
89733
  subagents.push({
89727
- id: data.agentName,
89734
+ id: `loaded-${file2.replace(".json", "")}`,
89728
89735
  name: data.agentName === "attack-surface-agent" ? "Attack Surface Discovery" : name26,
89729
89736
  type: agentType,
89730
89737
  target: data.target || "Unknown",
@@ -89732,6 +89739,7 @@ function loadSubagents(rootPath) {
89732
89739
  createdAt: timestamp,
89733
89740
  status
89734
89741
  });
89742
+ agentNameIndex.set(data.agentName, idx);
89735
89743
  } catch (e) {
89736
89744
  console.error(`Failed to load subagent file ${file2}:`, e);
89737
89745
  }
@@ -89779,116 +89787,6 @@ function loadSubagents(rootPath) {
89779
89787
  var SUBAGENTS_DIR = "subagents", MANIFEST_FILE = "agent-manifest.json";
89780
89788
  var init_persistence = () => {};
89781
89789
 
89782
- // src/core/session/loader.ts
89783
- import { join as join5 } from "path";
89784
- import { existsSync as existsSync9, readFileSync as readFileSync4 } from "fs";
89785
- function loadAttackSurfaceResults(rootPath) {
89786
- const resultsPath = join5(rootPath, "attack-surface-results.json");
89787
- if (!existsSync9(resultsPath)) {
89788
- return null;
89789
- }
89790
- try {
89791
- return JSON.parse(readFileSync4(resultsPath, "utf-8"));
89792
- } catch (e) {
89793
- console.error("Failed to load attack surface results:", e);
89794
- return null;
89795
- }
89796
- }
89797
- function hasReport(rootPath) {
89798
- const reportPath = join5(rootPath, REPORT_FILENAME_MD);
89799
- return existsSync9(reportPath);
89800
- }
89801
- function createDiscoveryFromLogs(rootPath, session) {
89802
- const logPath = join5(rootPath, "logs", "streamlined-pentest.log");
89803
- if (!existsSync9(logPath)) {
89804
- return null;
89805
- }
89806
- try {
89807
- const logContent = readFileSync4(logPath, "utf-8");
89808
- const lines = logContent.split(`
89809
- `).filter(Boolean);
89810
- const messages = [];
89811
- for (const line of lines) {
89812
- const match = line.match(/^(\d{4}-\d{2}-\d{2}T[\d:.]+Z) - \[(\w+)\] (.+)$/);
89813
- if (!match)
89814
- continue;
89815
- const [, timestamp, _level, content] = match;
89816
- const createdAt = new Date(timestamp);
89817
- if (content.startsWith("[Tool]")) {
89818
- const toolMatch = content.match(/\[Tool\] (\w+): (.+)/);
89819
- if (toolMatch) {
89820
- messages.push({
89821
- role: "tool",
89822
- content: `✓ ${toolMatch[2]}`,
89823
- createdAt,
89824
- toolName: toolMatch[1],
89825
- status: "completed"
89826
- });
89827
- }
89828
- } else if (content.startsWith("[Step")) {
89829
- const stepMatch = content.match(/\[Step \d+\] (.+)/);
89830
- if (stepMatch) {
89831
- messages.push({
89832
- role: "assistant",
89833
- content: stepMatch[1],
89834
- createdAt
89835
- });
89836
- }
89837
- }
89838
- }
89839
- if (messages.length === 0) {
89840
- return null;
89841
- }
89842
- return {
89843
- id: "discovery-from-logs",
89844
- name: "Attack Surface Discovery",
89845
- type: "attack-surface",
89846
- target: session.targets[0] || "Unknown",
89847
- messages,
89848
- createdAt: new Date(session.time.created),
89849
- status: "completed"
89850
- };
89851
- } catch (e) {
89852
- console.error("Failed to parse logs:", e);
89853
- return null;
89854
- }
89855
- }
89856
- async function loadSessionState(session) {
89857
- const rootPath = session.rootPath;
89858
- let subagents = loadSubagents(rootPath);
89859
- const hasAttackSurfaceAgent = subagents.some((s) => s.type === "attack-surface");
89860
- if (!hasAttackSurfaceAgent) {
89861
- const discoveryAgent = createDiscoveryFromLogs(rootPath, session);
89862
- if (discoveryAgent) {
89863
- subagents = [discoveryAgent, ...subagents];
89864
- }
89865
- }
89866
- const attackSurfaceResults = loadAttackSurfaceResults(rootPath);
89867
- const hasReportFile = hasReport(rootPath);
89868
- const hasDiscoverySubagent = subagents.some((s) => s.type === "attack-surface");
89869
- const interruptedDuringDiscovery = !attackSurfaceResults && !hasReportFile && hasDiscoverySubagent;
89870
- if (interruptedDuringDiscovery) {
89871
- for (let i = 0;i < subagents.length; i++) {
89872
- if (subagents[i].type === "attack-surface" && subagents[i].status === "completed") {
89873
- subagents[i] = { ...subagents[i], status: "paused" };
89874
- }
89875
- }
89876
- }
89877
- const isComplete = hasReportFile;
89878
- return {
89879
- session,
89880
- subagents,
89881
- attackSurfaceResults,
89882
- isComplete,
89883
- hasReport: hasReportFile,
89884
- interruptedDuringDiscovery
89885
- };
89886
- }
89887
- var init_loader = __esm(() => {
89888
- init_persistence();
89889
- init_report();
89890
- });
89891
-
89892
89790
  // src/core/agents/specialized/attackSurface/prompts.ts
89893
89791
  var SYSTEM = `You are an autonomous attack surface analysis agent. Your mission is to comprehensively map the attack surface of a target and produce a structured report of all discovered assets and pentest objectives.
89894
89792
 
@@ -105754,10 +105652,9 @@ class PlaywrightMcpSession {
105754
105652
  }
105755
105653
  function createBrowserTools(targetUrl, evidenceDir, mode = "pentest", logger, abortSignal, headless) {
105756
105654
  const session = new PlaywrightMcpSession(headless ?? defaultHeadless);
105757
- if (abortSignal) {
105758
- const onAbort = () => session.disconnect().catch(() => {});
105759
- abortSignal.addEventListener("abort", onAbort, { once: true });
105760
- }
105655
+ abortSignal?.addEventListener("abort", () => {
105656
+ session.disconnect().catch(() => {});
105657
+ });
105761
105658
  if (!existsSync11(evidenceDir)) {
105762
105659
  mkdirSync3(evidenceDir, { recursive: true });
105763
105660
  }
@@ -108620,17 +108517,9 @@ function runScript(runner, scriptPath, timeout, abortSignal) {
108620
108517
  let stderr = "";
108621
108518
  let killed = false;
108622
108519
  let resolved = false;
108623
- let abortCleanup;
108624
- if (abortSignal) {
108625
- const handler = () => killProcess();
108626
- abortSignal.addEventListener("abort", handler, { once: true });
108627
- abortCleanup = () => abortSignal.removeEventListener("abort", handler);
108628
- }
108629
108520
  const safeResolve = (result) => {
108630
108521
  if (!resolved) {
108631
108522
  resolved = true;
108632
- clearTimeout(timeoutTimer);
108633
- abortCleanup?.();
108634
108523
  resolve4(result);
108635
108524
  }
108636
108525
  };
@@ -108664,11 +108553,18 @@ function runScript(runner, scriptPath, timeout, abortSignal) {
108664
108553
  stderr += data.toString();
108665
108554
  });
108666
108555
  child.on("close", (code) => {
108556
+ clearTimeout(timeoutTimer);
108667
108557
  safeResolve({ stdout, stderr, exitCode: code ?? 1 });
108668
108558
  });
108669
108559
  child.on("error", (err) => {
108560
+ clearTimeout(timeoutTimer);
108670
108561
  safeResolve({ stdout, stderr, exitCode: 1 });
108671
108562
  });
108563
+ if (abortSignal) {
108564
+ const handler = () => killProcess();
108565
+ abortSignal.addEventListener("abort", handler, { once: true });
108566
+ child.on("close", () => abortSignal.removeEventListener("abort", handler));
108567
+ }
108672
108568
  });
108673
108569
  }
108674
108570
  var MAX_POC_ATTEMPTS = 3, createPocInputSchema;
@@ -108903,23 +108799,6 @@ search with flags or a more specific directory if results are truncated.`,
108903
108799
  });
108904
108800
  let stdout = "";
108905
108801
  let stderr = "";
108906
- let resolved = false;
108907
- let abortCleanup;
108908
- if (ctx4.abortSignal) {
108909
- const abortHandler = () => child.kill("SIGTERM");
108910
- ctx4.abortSignal.addEventListener("abort", abortHandler, {
108911
- once: true
108912
- });
108913
- abortCleanup = () => ctx4.abortSignal.removeEventListener("abort", abortHandler);
108914
- }
108915
- const safeResolve = (result) => {
108916
- if (resolved)
108917
- return;
108918
- resolved = true;
108919
- clearTimeout(timeout);
108920
- abortCleanup?.();
108921
- resolve4(result);
108922
- };
108923
108802
  const timeout = setTimeout(() => {
108924
108803
  child.kill("SIGTERM");
108925
108804
  }, 30000);
@@ -108930,6 +108809,7 @@ search with flags or a more specific directory if results are truncated.`,
108930
108809
  stderr += data.toString();
108931
108810
  });
108932
108811
  child.on("close", (code) => {
108812
+ clearTimeout(timeout);
108933
108813
  const noMatch = code === 1 && stderr === "";
108934
108814
  const matchCount = stdout ? stdout.trimEnd().split(`
108935
108815
  `).length : 0;
@@ -108937,7 +108817,7 @@ search with flags or a more specific directory if results are truncated.`,
108937
108817
  const output = truncated ? `${stdout.substring(0, 50000)}
108938
108818
 
108939
108819
  (truncated — narrow your search)` : stdout || "(no matches)";
108940
- safeResolve({
108820
+ resolve4({
108941
108821
  success: code === 0 || noMatch,
108942
108822
  error: noMatch || code === 0 ? "" : stderr || `Exit code: ${code}`,
108943
108823
  output,
@@ -108946,7 +108826,8 @@ search with flags or a more specific directory if results are truncated.`,
108946
108826
  });
108947
108827
  });
108948
108828
  child.on("error", (err) => {
108949
- safeResolve({
108829
+ clearTimeout(timeout);
108830
+ resolve4({
108950
108831
  success: false,
108951
108832
  error: err.message,
108952
108833
  output: "",
@@ -108954,6 +108835,15 @@ search with flags or a more specific directory if results are truncated.`,
108954
108835
  command
108955
108836
  });
108956
108837
  });
108838
+ if (ctx4.abortSignal) {
108839
+ const abortHandler = () => child.kill("SIGTERM");
108840
+ ctx4.abortSignal.addEventListener("abort", abortHandler, {
108841
+ once: true
108842
+ });
108843
+ child.on("close", () => {
108844
+ ctx4.abortSignal.removeEventListener("abort", abortHandler);
108845
+ });
108846
+ }
108957
108847
  });
108958
108848
  }
108959
108849
  });
@@ -194301,7 +194191,6 @@ var init_offensiveSecurityAgent = __esm(() => {
194301
194191
  resolveResult;
194302
194192
  subagentId;
194303
194193
  persistentShell;
194304
- abortSignal;
194305
194194
  _session;
194306
194195
  static async create(input) {
194307
194196
  let session = input.session;
@@ -194323,7 +194212,6 @@ var init_offensiveSecurityAgent = __esm(() => {
194323
194212
  constructor(input) {
194324
194213
  this._session = input.session;
194325
194214
  this.subagentId = input.subagentId;
194326
- this.abortSignal = input.abortSignal;
194327
194215
  if (!input.sandbox) {
194328
194216
  this.persistentShell = new PersistentShell({
194329
194217
  cwd: input.session.rootPath
@@ -194487,9 +194375,6 @@ var init_offensiveSecurityAgent = __esm(() => {
194487
194375
  }
194488
194376
  }
194489
194377
  this.persistentShell?.dispose();
194490
- if (this.abortSignal?.aborted) {
194491
- throw new DOMException("Agent aborted by user", "AbortError");
194492
- }
194493
194378
  if (this.resolveResult) {
194494
194379
  return this.resolveResult(this.streamResult);
194495
194380
  }
@@ -194598,7 +194483,6 @@ var init_blackboxAgent = __esm(() => {
194598
194483
  onStepFinish,
194599
194484
  abortSignal,
194600
194485
  attackSurfaceRegistry,
194601
- messages: opts.messages,
194602
194486
  activeTools: [
194603
194487
  "execute_command",
194604
194488
  "document_asset",
@@ -194874,8 +194758,7 @@ var init_agent4 = __esm(() => {
194874
194758
  onStepFinish,
194875
194759
  abortSignal,
194876
194760
  sandbox,
194877
- findingsRegistry,
194878
- messages
194761
+ findingsRegistry
194879
194762
  } = opts;
194880
194763
  super({
194881
194764
  system: buildSystemPrompt(session),
@@ -194888,7 +194771,6 @@ var init_agent4 = __esm(() => {
194888
194771
  abortSignal,
194889
194772
  sandbox,
194890
194773
  findingsRegistry,
194891
- messages,
194892
194774
  activeTools: [
194893
194775
  "execute_command",
194894
194776
  "http_request",
@@ -194998,7 +194880,7 @@ var EXECUTION_METRICS_FILENAME = "execution-metrics.json";
194998
194880
  var init_execution_metrics = () => {};
194999
194881
 
195000
194882
  // src/core/utils/concurrency.ts
195001
- async function runWithBoundedConcurrency(items, concurrency, fn, abortSignal) {
194883
+ async function runWithBoundedConcurrency(items, concurrency, fn) {
195002
194884
  const results = new Array(items.length).fill(null);
195003
194885
  let nextIdx = 0;
195004
194886
  let completed = 0;
@@ -195009,11 +194891,11 @@ async function runWithBoundedConcurrency(items, concurrency, fn, abortSignal) {
195009
194891
  }
195010
194892
  let active = 0;
195011
194893
  function next() {
195012
- if (completed >= nextIdx && (nextIdx === items.length || abortSignal?.aborted)) {
194894
+ if (completed === items.length) {
195013
194895
  resolve4();
195014
194896
  return;
195015
194897
  }
195016
- while (active < concurrency && nextIdx < items.length && !abortSignal?.aborted) {
194898
+ while (active < concurrency && nextIdx < items.length) {
195017
194899
  const idx = nextIdx++;
195018
194900
  active++;
195019
194901
  fn(items[idx], idx).then((r2) => {
@@ -195603,21 +195485,10 @@ async function runPentestSwarm(input) {
195603
195485
  concurrency = DEFAULT_CONCURRENCY4,
195604
195486
  onStepFinish
195605
195487
  } = input;
195606
- const completedIds = getCompletedAgentIds(session);
195607
- const existingManifest = readAgentManifest(session);
195608
- const freshEntries = buildManifestEntries(targets);
195609
- const manifestEntries = freshEntries.map((fresh) => {
195610
- const existing = existingManifest.find((e2) => e2.id === fresh.id);
195611
- if (existing && existing.status === "completed")
195612
- return existing;
195613
- return fresh;
195614
- });
195488
+ const manifestEntries = buildManifestEntries(targets);
195615
195489
  writeAgentManifest(session, manifestEntries);
195616
195490
  const results = await runWithBoundedConcurrency(targets, concurrency, async (target, index) => {
195617
195491
  const subagentId = `pentest-agent-${index + 1}`;
195618
- if (completedIds.has(subagentId))
195619
- return null;
195620
- const previousMessages = loadSubagentMessages(session, subagentId);
195621
195492
  let lastMessages = [];
195622
195493
  const handleStepFinish = (e2) => {
195623
195494
  if (e2.response.messages) {
@@ -195651,8 +195522,7 @@ async function runPentestSwarm(input) {
195651
195522
  authConfig,
195652
195523
  abortSignal,
195653
195524
  findingsRegistry,
195654
- onStepFinish: handleStepFinish,
195655
- messages: previousMessages.length > 0 ? previousMessages : undefined
195525
+ onStepFinish: handleStepFinish
195656
195526
  });
195657
195527
  const result = await agent.consume({
195658
195528
  onError: (e2) => onError?.(e2),
@@ -195664,9 +195534,8 @@ async function runPentestSwarm(input) {
195664
195534
  objective: target.objectives.join("; "),
195665
195535
  status: "completed",
195666
195536
  findingsCount: result.findings.length,
195667
- messages: [...previousMessages, ...lastMessages]
195537
+ messages: lastMessages
195668
195538
  });
195669
- updateManifestEntryStatus(session, subagentId, "completed");
195670
195539
  subagentCallbacks?.onSubagentComplete?.({
195671
195540
  subagentId,
195672
195541
  input: { target: target.target, objectives: target.objectives },
@@ -195680,9 +195549,8 @@ async function runPentestSwarm(input) {
195680
195549
  objective: target.objectives.join("; "),
195681
195550
  status: "failed",
195682
195551
  error: error40 instanceof Error ? error40.message : String(error40),
195683
- messages: [...previousMessages, ...lastMessages]
195552
+ messages: lastMessages
195684
195553
  });
195685
- updateManifestEntryStatus(session, subagentId, "failed");
195686
195554
  subagentCallbacks?.onSubagentComplete?.({
195687
195555
  subagentId,
195688
195556
  input: { target: target.target, objectives: target.objectives },
@@ -195690,7 +195558,7 @@ async function runPentestSwarm(input) {
195690
195558
  });
195691
195559
  throw error40;
195692
195560
  }
195693
- }, abortSignal);
195561
+ });
195694
195562
  finalizeManifest(session, manifestEntries, results);
195695
195563
  return results;
195696
195564
  }
@@ -195708,13 +195576,7 @@ async function runPentestWorkflow(input) {
195708
195576
  try {
195709
195577
  const mode = cwd ? "whitebox" : "blackbox";
195710
195578
  let swarmTargets;
195711
- const existingResults = loadAttackSurfaceResults(session.rootPath);
195712
- if (existingResults?.targets && existingResults.targets.length > 0) {
195713
- swarmTargets = existingResults.targets.map((t3) => ({
195714
- target: t3.target,
195715
- objectives: [t3.objective]
195716
- }));
195717
- } else if (mode === "whitebox") {
195579
+ if (mode === "whitebox") {
195718
195580
  swarmTargets = await runWhiteboxPhase({
195719
195581
  codebasePath: cwd,
195720
195582
  baseTarget: target,
@@ -195736,9 +195598,6 @@ async function runPentestWorkflow(input) {
195736
195598
  onStepFinish
195737
195599
  });
195738
195600
  }
195739
- if (abortSignal?.aborted) {
195740
- throw new DOMException("Pentest aborted by user", "AbortError");
195741
- }
195742
195601
  if (swarmTargets.length === 0) {
195743
195602
  const report2 = buildPentestReport([], {
195744
195603
  target,
@@ -195762,23 +195621,17 @@ async function runPentestWorkflow(input) {
195762
195621
  authConfig,
195763
195622
  abortSignal
195764
195623
  });
195765
- const completedCount = getCompletedAgentIds(session).size;
195766
- if (completedCount < swarmTargets.length) {
195767
- await runPentestSwarm({
195768
- targets: swarmTargets,
195769
- model,
195770
- session,
195771
- authConfig,
195772
- abortSignal,
195773
- findingsRegistry,
195774
- subagentCallbacks: callbacks?.subagentCallbacks,
195775
- onError: (e2) => callbacks?.onError?.(e2),
195776
- onStepFinish
195777
- });
195778
- }
195779
- if (abortSignal?.aborted) {
195780
- throw new DOMException("Pentest aborted by user", "AbortError");
195781
- }
195624
+ await runPentestSwarm({
195625
+ targets: swarmTargets,
195626
+ model,
195627
+ session,
195628
+ authConfig,
195629
+ abortSignal,
195630
+ findingsRegistry,
195631
+ subagentCallbacks: callbacks?.subagentCallbacks,
195632
+ onError: (e2) => callbacks?.onError?.(e2),
195633
+ onStepFinish
195634
+ });
195782
195635
  const findings = loadFindings2(session.findingsPath);
195783
195636
  const report = buildPentestReport(findings, {
195784
195637
  target,
@@ -195890,7 +195743,6 @@ var init_pentest = __esm(() => {
195890
195743
  init_report();
195891
195744
  init_persistence();
195892
195745
  init_execution_metrics();
195893
- init_loader();
195894
195746
  init_whiteboxAttackSurface();
195895
195747
  });
195896
195748
 
@@ -272498,7 +272350,7 @@ var useTerminalDimensions = () => {
272498
272350
  };
272499
272351
 
272500
272352
  // src/tui/index.tsx
272501
- var import_react87 = __toESM(require_react(), 1);
272353
+ var import_react89 = __toESM(require_react(), 1);
272502
272354
 
272503
272355
  // src/tui/components/footer.tsx
272504
272356
  import os6 from "os";
@@ -273969,7 +273821,7 @@ function CommandProvider({
273969
273821
  }
273970
273822
 
273971
273823
  // src/tui/components/commands/sessions-display.tsx
273972
- var import_react24 = __toESM(require_react(), 1);
273824
+ var import_react22 = __toESM(require_react(), 1);
273973
273825
 
273974
273826
  // src/tui/context/focus.tsx
273975
273827
  var import_react18 = __toESM(require_react(), 1);
@@ -274038,29 +273890,10 @@ function openSessionReport(sessionRootPath) {
274038
273890
  }
274039
273891
  }
274040
273892
 
274041
- // src/tui/context/dimensions.tsx
274042
- var import_react19 = __toESM(require_react(), 1);
274043
- var DimensionsContext = import_react19.createContext(null);
274044
- function TerminalDimensionsProvider({
274045
- children
274046
- }) {
274047
- const dimensions = useTerminalDimensions();
274048
- return /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV(DimensionsContext.Provider, {
274049
- value: dimensions,
274050
- children
274051
- }, undefined, false, undefined, this);
274052
- }
274053
- function useDimensions() {
274054
- const ctx3 = import_react19.useContext(DimensionsContext);
274055
- if (!ctx3)
274056
- throw new Error("useDimensions() must be used within <TerminalDimensionsProvider>");
274057
- return ctx3;
274058
- }
274059
-
274060
273893
  // src/tui/context/dialog.tsx
274061
- var import_react22 = __toESM(require_react(), 1);
273894
+ var import_react20 = __toESM(require_react(), 1);
274062
273895
  function Dialog({ size = "medium", onClose, children }) {
274063
- const dimensions = useDimensions();
273896
+ const dimensions = useTerminalDimensions();
274064
273897
  const renderer = useRenderer();
274065
273898
  const { colors: themeColors } = useTheme();
274066
273899
  return /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("box", {
@@ -274095,14 +273928,14 @@ function Dialog({ size = "medium", onClose, children }) {
274095
273928
  }, undefined, false, undefined, this)
274096
273929
  }, undefined, false, undefined, this);
274097
273930
  }
274098
- var DialogContext = import_react22.createContext(null);
273931
+ var DialogContext = import_react20.createContext(null);
274099
273932
  function DialogProvider({ children }) {
274100
- const [stack, setStack] = import_react22.useState([]);
274101
- const [size, setSize] = import_react22.useState("medium");
274102
- const [externalDialogOpen, setExternalDialogOpen] = import_react22.useState(false);
273933
+ const [stack, setStack] = import_react20.useState([]);
273934
+ const [size, setSize] = import_react20.useState("medium");
273935
+ const [externalDialogOpen, setExternalDialogOpen] = import_react20.useState(false);
274103
273936
  const renderer = useRenderer();
274104
- const focusRef = import_react22.useRef(null);
274105
- const refocus = import_react22.useCallback(() => {
273937
+ const focusRef = import_react20.useRef(null);
273938
+ const refocus = import_react20.useCallback(() => {
274106
273939
  setTimeout(() => {
274107
273940
  const focus = focusRef.current;
274108
273941
  if (!focus)
@@ -274124,7 +273957,7 @@ function DialogProvider({ children }) {
274124
273957
  focus.focus();
274125
273958
  }, 1);
274126
273959
  }, [renderer]);
274127
- const clear = import_react22.useCallback(() => {
273960
+ const clear = import_react20.useCallback(() => {
274128
273961
  for (const item of stack) {
274129
273962
  if (item.onClose)
274130
273963
  item.onClose();
@@ -274133,7 +273966,7 @@ function DialogProvider({ children }) {
274133
273966
  setStack([]);
274134
273967
  refocus();
274135
273968
  }, [stack, refocus]);
274136
- const replace = import_react22.useCallback((element, onClose) => {
273969
+ const replace = import_react20.useCallback((element, onClose) => {
274137
273970
  if (stack.length === 0) {
274138
273971
  focusRef.current = renderer.currentFocusedRenderable;
274139
273972
  }
@@ -274178,7 +274011,7 @@ function DialogProvider({ children }) {
274178
274011
  }, undefined, true, undefined, this);
274179
274012
  }
274180
274013
  function useDialog() {
274181
- const value = import_react22.useContext(DialogContext);
274014
+ const value = import_react20.useContext(DialogContext);
274182
274015
  if (!value) {
274183
274016
  throw new Error("useDialog must be used within a DialogProvider");
274184
274017
  }
@@ -274243,7 +274076,7 @@ function findChildById(scrollBox, id) {
274243
274076
  // src/tui/hooks/use-sessions-list.ts
274244
274077
  init_session();
274245
274078
  init_report();
274246
- var import_react23 = __toESM(require_react(), 1);
274079
+ var import_react21 = __toESM(require_react(), 1);
274247
274080
  import { existsSync as existsSync7, readdirSync } from "fs";
274248
274081
  import { join as join3 } from "path";
274249
274082
  function countFindings(findingsPath) {
@@ -274259,10 +274092,10 @@ function checkHasReport(rootPath) {
274259
274092
  return existsSync7(join3(rootPath, REPORT_FILENAME_MD));
274260
274093
  }
274261
274094
  function useSessionsList() {
274262
- const [allSessions, setAllSessions] = import_react23.useState([]);
274263
- const [loading, setLoading] = import_react23.useState(true);
274264
- const [searchTerm, setSearchTerm] = import_react23.useState("");
274265
- const loadSessions = import_react23.useCallback(async () => {
274095
+ const [allSessions, setAllSessions] = import_react21.useState([]);
274096
+ const [loading, setLoading] = import_react21.useState(true);
274097
+ const [searchTerm, setSearchTerm] = import_react21.useState("");
274098
+ const loadSessions = import_react21.useCallback(async () => {
274266
274099
  setLoading(true);
274267
274100
  try {
274268
274101
  const enriched = [];
@@ -274285,10 +274118,10 @@ function useSessionsList() {
274285
274118
  setLoading(false);
274286
274119
  }
274287
274120
  }, []);
274288
- import_react23.useEffect(() => {
274121
+ import_react21.useEffect(() => {
274289
274122
  loadSessions();
274290
274123
  }, [loadSessions]);
274291
- const deleteSession = import_react23.useCallback(async (id) => {
274124
+ const deleteSession = import_react21.useCallback(async (id) => {
274292
274125
  await sessions.remove({ sessionId: id });
274293
274126
  await loadSessions();
274294
274127
  }, [loadSessions]);
@@ -274347,10 +274180,10 @@ function useSessionsList() {
274347
274180
  function SessionsDisplay({ onClose }) {
274348
274181
  const { colors: colors2 } = useTheme();
274349
274182
  const { refocusPrompt } = useFocus();
274350
- const [selectedIndex, setSelectedIndex] = import_react24.useState(0);
274351
- const [statusMessage, setStatusMessage] = import_react24.useState("");
274183
+ const [selectedIndex, setSelectedIndex] = import_react22.useState(0);
274184
+ const [statusMessage, setStatusMessage] = import_react22.useState("");
274352
274185
  const route = useRoute();
274353
- const scroll = import_react24.useRef(null);
274186
+ const scroll = import_react22.useRef(null);
274354
274187
  const {
274355
274188
  groupedSessions,
274356
274189
  visualOrderSessions,
@@ -274366,7 +274199,7 @@ function SessionsDisplay({ onClose }) {
274366
274199
  setTimeout(() => setStatusMessage(""), 2000);
274367
274200
  }
274368
274201
  }
274369
- import_react24.useEffect(() => {
274202
+ import_react22.useEffect(() => {
274370
274203
  if (visualOrderSessions.length > 0 && selectedIndex >= visualOrderSessions.length) {
274371
274204
  setSelectedIndex(visualOrderSessions.length - 1);
274372
274205
  } else if (visualOrderSessions.length === 0) {
@@ -274402,7 +274235,7 @@ function SessionsDisplay({ onClose }) {
274402
274235
  setTimeout(() => setStatusMessage(""), 2000);
274403
274236
  return;
274404
274237
  }
274405
- const isOperator = currentSelection.config?.mode === "operator" || !currentSelection.config?.mode && currentSelection.hasOperatorState;
274238
+ const isOperator = currentSelection.config?.mode === "operator" || currentSelection.hasOperatorState;
274406
274239
  refocusPrompt();
274407
274240
  onClose();
274408
274241
  route.navigate({
@@ -274448,11 +274281,6 @@ function SessionsDisplay({ onClose }) {
274448
274281
  const currentSelection = visualOrderSessions[selectedIndex];
274449
274282
  if (!currentSelection)
274450
274283
  return;
274451
- if (!currentSelection.hasReport) {
274452
- setStatusMessage("No report available");
274453
- setTimeout(() => setStatusMessage(""), 2000);
274454
- return;
274455
- }
274456
274284
  openReport(currentSelection.id);
274457
274285
  return;
274458
274286
  }
@@ -274556,7 +274384,6 @@ function SessionsDisplay({ onClose }) {
274556
274384
  });
274557
274385
  const mode = session.config?.mode || "auto";
274558
274386
  const modeBadge = mode === "operator" ? "[operator]" : "[auto]";
274559
- const statusBadge = session.hasReport ? "✓" : "…";
274560
274387
  const findingsText = session.findingsCount > 0 ? `${session.findingsCount} finding${session.findingsCount > 1 ? "s" : ""}` : "";
274561
274388
  return /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("box", {
274562
274389
  id: session.id,
@@ -274581,10 +274408,6 @@ function SessionsDisplay({ onClose }) {
274581
274408
  fg: isSelected ? colors2.text : colors2.textMuted,
274582
274409
  children: session.name
274583
274410
  }, undefined, false, undefined, this),
274584
- /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("text", {
274585
- fg: session.hasReport ? colors2.primary : colors2.textMuted,
274586
- children: statusBadge
274587
- }, undefined, false, undefined, this),
274588
274411
  /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("text", {
274589
274412
  fg: mode === "operator" ? colors2.primary : colors2.textMuted,
274590
274413
  children: modeBadge
@@ -274648,7 +274471,7 @@ function SessionsDisplay({ onClose }) {
274648
274471
  }
274649
274472
 
274650
274473
  // src/tui/components/commands/config-dialog.tsx
274651
- var import_react27 = __toESM(require_react(), 1);
274474
+ var import_react25 = __toESM(require_react(), 1);
274652
274475
 
274653
274476
  // src/tui/components/alert-dialog.tsx
274654
274477
  function AlertDialog({
@@ -274661,7 +274484,7 @@ function AlertDialog({
274661
274484
  size = "medium"
274662
274485
  }) {
274663
274486
  const { colors: colors2 } = useTheme();
274664
- const dimensions = useDimensions();
274487
+ const dimensions = useTerminalDimensions();
274665
274488
  const renderer = useRenderer();
274666
274489
  useKeyboard((key) => {
274667
274490
  if (!open)
@@ -274735,8 +274558,8 @@ function AlertDialog({
274735
274558
  init_config2();
274736
274559
  function ConfigDialog() {
274737
274560
  const route = useRoute();
274738
- const [open, setOpen] = import_react27.useState(false);
274739
- import_react27.useEffect(() => {
274561
+ const [open, setOpen] = import_react25.useState(false);
274562
+ import_react25.useEffect(() => {
274740
274563
  if (route.data.type === "base" && route.data.path === "config") {
274741
274564
  setOpen(true);
274742
274565
  } else {
@@ -274750,8 +274573,8 @@ function ConfigDialog() {
274750
274573
  path: "home"
274751
274574
  });
274752
274575
  };
274753
- const [appConfig, setAppConfig] = import_react27.useState(null);
274754
- import_react27.useEffect(() => {
274576
+ const [appConfig, setAppConfig] = import_react25.useState(null);
274577
+ import_react25.useEffect(() => {
274755
274578
  async function getConfig() {
274756
274579
  const _appConfig = await config2.get();
274757
274580
  setAppConfig(_appConfig);
@@ -274826,11 +274649,11 @@ var import_react38 = __toESM(require_react(), 1);
274826
274649
 
274827
274650
  // src/tui/context/config.tsx
274828
274651
  init_config2();
274829
- var import_react28 = __toESM(require_react(), 1);
274830
- var ctx3 = import_react28.createContext(null);
274652
+ var import_react26 = __toESM(require_react(), 1);
274653
+ var ctx3 = import_react26.createContext(null);
274831
274654
  function ConfigProvider({ children, config: config3 }) {
274832
- const [appConfig, setAppConfig] = import_react28.useState(config3);
274833
- const value = import_react28.useMemo(() => ({
274655
+ const [appConfig, setAppConfig] = import_react26.useState(config3);
274656
+ const value = import_react26.useMemo(() => ({
274834
274657
  data: appConfig,
274835
274658
  update: async (newConfig) => {
274836
274659
  await config2.update(newConfig);
@@ -274850,7 +274673,7 @@ function ConfigProvider({ children, config: config3 }) {
274850
274673
  }, undefined, false, undefined, this);
274851
274674
  }
274852
274675
  var useConfig = () => {
274853
- const config3 = import_react28.useContext(ctx3);
274676
+ const config3 = import_react26.useContext(ctx3);
274854
274677
  if (!config3) {
274855
274678
  throw new Error("useConfig must be called within a ConfigProvider");
274856
274679
  }
@@ -274858,10 +274681,10 @@ var useConfig = () => {
274858
274681
  };
274859
274682
 
274860
274683
  // src/tui/components/chat/home-view.tsx
274861
- var import_react33 = __toESM(require_react(), 1);
274684
+ var import_react32 = __toESM(require_react(), 1);
274862
274685
 
274863
274686
  // src/tui/components/chat/petri-animation.tsx
274864
- var import_react29 = __toESM(require_react(), 1);
274687
+ var import_react27 = __toESM(require_react(), 1);
274865
274688
 
274866
274689
  // src/tui/components/chat/lib/play-core/num.ts
274867
274690
  function clamp(x2, min, max) {
@@ -274957,8 +274780,8 @@ function stopGlobalTick2() {
274957
274780
  }
274958
274781
  }
274959
274782
  function useGlobalTick2() {
274960
- const [, setTick] = import_react29.useState(0);
274961
- import_react29.useEffect(() => {
274783
+ const [, setTick] = import_react27.useState(0);
274784
+ import_react27.useEffect(() => {
274962
274785
  const listener = () => setTick((t2) => t2 + 1);
274963
274786
  globalListeners2.add(listener);
274964
274787
  startGlobalTick2();
@@ -274983,19 +274806,19 @@ function PetriAnimation({
274983
274806
  height = 0.4,
274984
274807
  width = "100%"
274985
274808
  }) {
274986
- const dimensions = useDimensions();
274809
+ const dimensions = useTerminalDimensions();
274987
274810
  const tick = useGlobalTick2();
274988
274811
  const { colors: colors2 } = useTheme();
274989
- const simulationRef = import_react29.useRef(null);
274990
- const [frame, setFrame] = import_react29.useState([]);
274991
- const gradientColors = import_react29.useMemo(() => generateGradient(colors2.primary, 9), [colors2.primary]);
274992
- const actualHeight = import_react29.useMemo(() => {
274812
+ const simulationRef = import_react27.useRef(null);
274813
+ const [frame, setFrame] = import_react27.useState([]);
274814
+ const gradientColors = import_react27.useMemo(() => generateGradient(colors2.primary, 9), [colors2.primary]);
274815
+ const actualHeight = import_react27.useMemo(() => {
274993
274816
  if (typeof height === "number" && height <= 1) {
274994
274817
  return Math.floor(dimensions.height * height);
274995
274818
  }
274996
274819
  return typeof height === "number" ? height : Math.floor(dimensions.height * 0.4);
274997
274820
  }, [height, dimensions.height]);
274998
- const actualWidth = import_react29.useMemo(() => {
274821
+ const actualWidth = import_react27.useMemo(() => {
274999
274822
  if (typeof width === "number" && width <= 1) {
275000
274823
  return Math.floor(dimensions.width * width);
275001
274824
  }
@@ -275004,7 +274827,7 @@ function PetriAnimation({
275004
274827
  }
275005
274828
  return typeof width === "number" ? width : dimensions.width;
275006
274829
  }, [width, dimensions.width]);
275007
- import_react29.useEffect(() => {
274830
+ import_react27.useEffect(() => {
275008
274831
  if (actualWidth <= 0 || actualHeight <= 0)
275009
274832
  return;
275010
274833
  if (!simulationRef.current) {
@@ -275013,7 +274836,7 @@ function PetriAnimation({
275013
274836
  simulationRef.current.resize(actualWidth, actualHeight);
275014
274837
  }
275015
274838
  }, [actualWidth, actualHeight]);
275016
- import_react29.useEffect(() => {
274839
+ import_react27.useEffect(() => {
275017
274840
  if (simulationRef.current) {
275018
274841
  simulationRef.current.step();
275019
274842
  setFrame(simulationRef.current.render());
@@ -275039,7 +274862,7 @@ function getRowColor(rowIdx, totalRows, gradient) {
275039
274862
  }
275040
274863
 
275041
274864
  // src/tui/components/shared/prompt-input.tsx
275042
- var import_react31 = __toESM(require_react(), 1);
274865
+ var import_react30 = __toESM(require_react(), 1);
275043
274866
 
275044
274867
  // src/tui/components/shared/prompt-input-logic.ts
275045
274868
  function filterSuggestions(inputValue, options, maxSuggestions) {
@@ -275160,13 +274983,13 @@ function shouldResetHistory(historyIndex, isNavigatingHistory) {
275160
274983
  }
275161
274984
 
275162
274985
  // src/tui/components/shared/use-paste-extmarks.ts
275163
- var import_react30 = __toESM(require_react(), 1);
274986
+ var import_react29 = __toESM(require_react(), 1);
275164
274987
  var LARGE_PASTE_MIN_LINES = 5;
275165
274988
  var LARGE_PASTE_MIN_CHARS = 500;
275166
274989
  function usePasteExtmarks(textareaRef) {
275167
- const countRef = import_react30.useRef(0);
275168
- const typeIdRef = import_react30.useRef(-1);
275169
- const dataRef = import_react30.useRef(new Map);
274990
+ const countRef = import_react29.useRef(0);
274991
+ const typeIdRef = import_react29.useRef(-1);
274992
+ const dataRef = import_react29.useRef(new Map);
275170
274993
  const clearPaste = () => {
275171
274994
  textareaRef.current?.extmarks.clear();
275172
274995
  countRef.current = 0;
@@ -275236,7 +275059,7 @@ var chatKeyBindings = [
275236
275059
  { name: "return", shift: true, action: "newline" },
275237
275060
  { name: "linefeed", shift: true, action: "newline" }
275238
275061
  ];
275239
- var PromptInput = import_react31.forwardRef(function PromptInput2({
275062
+ var PromptInput = import_react30.forwardRef(function PromptInput2({
275240
275063
  width,
275241
275064
  minHeight = 1,
275242
275065
  maxHeight = 6,
@@ -275261,31 +275084,31 @@ var PromptInput = import_react31.forwardRef(function PromptInput2({
275261
275084
  const { colors: colors2 } = useTheme();
275262
275085
  const { inputValue, setInputValue } = useInput();
275263
275086
  const { registerPromptRef } = useFocus();
275264
- const textareaRef = import_react31.useRef(null);
275265
- const [selectedSuggestionIndex, setSelectedSuggestionIndex] = import_react31.useState(-1);
275266
- const [historyIndex, setHistoryIndex] = import_react31.useState(-1);
275267
- const savedInputRef = import_react31.useRef("");
275268
- const historyRef = import_react31.useRef(commandHistory);
275087
+ const textareaRef = import_react30.useRef(null);
275088
+ const [selectedSuggestionIndex, setSelectedSuggestionIndex] = import_react30.useState(-1);
275089
+ const [historyIndex, setHistoryIndex] = import_react30.useState(-1);
275090
+ const savedInputRef = import_react30.useRef("");
275091
+ const historyRef = import_react30.useRef(commandHistory);
275269
275092
  historyRef.current = commandHistory;
275270
- const isNavigatingHistoryRef = import_react31.useRef(false);
275271
- const selectedIndexRef = import_react31.useRef(selectedSuggestionIndex);
275272
- const suggestionsRef = import_react31.useRef([]);
275273
- const onCommandExecuteRef = import_react31.useRef(onCommandExecute);
275093
+ const isNavigatingHistoryRef = import_react30.useRef(false);
275094
+ const selectedIndexRef = import_react30.useRef(selectedSuggestionIndex);
275095
+ const suggestionsRef = import_react30.useRef([]);
275096
+ const onCommandExecuteRef = import_react30.useRef(onCommandExecute);
275274
275097
  onCommandExecuteRef.current = onCommandExecute;
275275
- const onSubmitRef = import_react31.useRef(onSubmit);
275098
+ const onSubmitRef = import_react30.useRef(onSubmit);
275276
275099
  onSubmitRef.current = onSubmit;
275277
275100
  const { handlePaste, resolveText, clearPaste } = usePasteExtmarks(textareaRef);
275278
- const suggestions = import_react31.useMemo(() => enableAutocomplete ? filterSuggestions(inputValue, autocompleteOptions, maxSuggestions) : [], [enableAutocomplete, autocompleteOptions, inputValue, maxSuggestions]);
275279
- import_react31.useEffect(() => {
275101
+ const suggestions = import_react30.useMemo(() => enableAutocomplete ? filterSuggestions(inputValue, autocompleteOptions, maxSuggestions) : [], [enableAutocomplete, autocompleteOptions, inputValue, maxSuggestions]);
275102
+ import_react30.useEffect(() => {
275280
275103
  suggestionsRef.current = suggestions;
275281
275104
  }, [suggestions]);
275282
- import_react31.useEffect(() => {
275105
+ import_react30.useEffect(() => {
275283
275106
  selectedIndexRef.current = selectedSuggestionIndex;
275284
275107
  }, [selectedSuggestionIndex]);
275285
- import_react31.useEffect(() => {
275108
+ import_react30.useEffect(() => {
275286
275109
  setSelectedSuggestionIndex(suggestions.length > 0 ? 0 : -1);
275287
275110
  }, [suggestions.length]);
275288
- const imperativeRef = import_react31.useRef({
275111
+ const imperativeRef = import_react30.useRef({
275289
275112
  focus: () => textareaRef.current?.focus(),
275290
275113
  blur: () => textareaRef.current?.blur(),
275291
275114
  reset: () => {
@@ -275302,11 +275125,11 @@ var PromptInput = import_react31.forwardRef(function PromptInput2({
275302
275125
  getValue: () => inputValue,
275303
275126
  getTextareaRef: () => textareaRef.current
275304
275127
  });
275305
- import_react31.useEffect(() => {
275128
+ import_react30.useEffect(() => {
275306
275129
  imperativeRef.current.getValue = () => inputValue;
275307
275130
  }, [inputValue]);
275308
- import_react31.useImperativeHandle(ref, () => imperativeRef.current, []);
275309
- import_react31.useEffect(() => {
275131
+ import_react30.useImperativeHandle(ref, () => imperativeRef.current, []);
275132
+ import_react30.useEffect(() => {
275310
275133
  registerPromptRef(imperativeRef.current);
275311
275134
  return () => registerPromptRef(null);
275312
275135
  }, [registerPromptRef]);
@@ -275522,41 +275345,41 @@ function getEntries() {
275522
275345
  // src/tui/components/chat/home-view.tsx
275523
275346
  function HomeView({ onNavigate, onStartSession }) {
275524
275347
  const { colors: colors2 } = useTheme();
275525
- const dimensions = useDimensions();
275348
+ const dimensions = useTerminalDimensions();
275526
275349
  const config3 = useConfig();
275527
275350
  const route = useRoute();
275528
275351
  const { executeCommand, autocompleteOptions, resolveSkillContent, skills } = useCommand();
275529
275352
  const { setInputValue } = useInput();
275530
275353
  const { promptRef } = useFocus();
275531
275354
  const { externalDialogOpen, stack } = useDialog();
275532
- const [hintMessage, setHintMessage] = import_react33.useState(null);
275533
- const [commandHistory, setCommandHistory] = import_react33.useState(getEntries);
275534
- import_react33.useEffect(() => {
275355
+ const [hintMessage, setHintMessage] = import_react32.useState(null);
275356
+ const [commandHistory, setCommandHistory] = import_react32.useState(getEntries);
275357
+ import_react32.useEffect(() => {
275535
275358
  load().then(setCommandHistory);
275536
275359
  }, []);
275537
- const launchOperator = import_react33.useCallback((message, options) => {
275360
+ const launchOperator = import_react32.useCallback((message, options) => {
275538
275361
  route.navigate({
275539
275362
  type: "operator",
275540
275363
  initialMessage: message,
275541
275364
  initialConfig: { requireApproval: options?.requireApproval ?? true }
275542
275365
  });
275543
275366
  }, [route]);
275544
- const pushHistory = import_react33.useCallback((entry) => {
275367
+ const pushHistory = import_react32.useCallback((entry) => {
275545
275368
  push(entry).then(() => setCommandHistory([...getEntries()]));
275546
275369
  }, []);
275547
- const handleSubmit = import_react33.useCallback((value) => {
275370
+ const handleSubmit = import_react32.useCallback((value) => {
275548
275371
  if (!value.trim())
275549
275372
  return;
275550
275373
  pushHistory(value.trim());
275551
275374
  launchOperator(value.trim());
275552
275375
  }, [launchOperator, pushHistory]);
275553
- import_react33.useEffect(() => {
275376
+ import_react32.useEffect(() => {
275554
275377
  if (!hintMessage)
275555
275378
  return;
275556
275379
  const timer = setTimeout(() => setHintMessage(null), 3000);
275557
275380
  return () => clearTimeout(timer);
275558
275381
  }, [hintMessage]);
275559
- const handleCommandExecute = import_react33.useCallback(async (command) => {
275382
+ const handleCommandExecute = import_react32.useCallback(async (command) => {
275560
275383
  const trimmed = command.trim();
275561
275384
  pushHistory(trimmed);
275562
275385
  const parts = trimmed.replace(/^\/+/, "").split(/\s+/);
@@ -278420,7 +278243,7 @@ function ToastItem({
278420
278243
  }
278421
278244
  function ToastContainer() {
278422
278245
  const { toasts, dismiss } = useToast();
278423
- const dims = useDimensions();
278246
+ const dims = useTerminalDimensions();
278424
278247
  if (toasts.length === 0)
278425
278248
  return null;
278426
278249
  return /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("box", {
@@ -278441,11 +278264,11 @@ function ToastContainer() {
278441
278264
  }
278442
278265
 
278443
278266
  // src/tui/components/error-boundary.tsx
278444
- var import_react52 = __toESM(require_react(), 1);
278267
+ var import_react53 = __toESM(require_react(), 1);
278445
278268
  var MAX_ERRORS = 3;
278446
278269
  var ERROR_WINDOW_MS = 5000;
278447
278270
 
278448
- class ErrorBoundaryInner extends import_react52.default.Component {
278271
+ class ErrorBoundaryInner extends import_react53.default.Component {
278449
278272
  state = {
278450
278273
  hasError: false,
278451
278274
  errorTimestamps: [],
@@ -278476,10 +278299,10 @@ class ErrorBoundaryInner extends import_react52.default.Component {
278476
278299
  }
278477
278300
  function ErrorBoundary2({ children }) {
278478
278301
  const { toast } = useToast();
278479
- const handleError = import_react52.useCallback((message) => {
278302
+ const handleError = import_react53.useCallback((message) => {
278480
278303
  toast(message, "error");
278481
278304
  }, [toast]);
278482
- return import_react52.default.createElement(ErrorBoundaryInner, { onError: handleError }, children);
278305
+ return import_react53.default.createElement(ErrorBoundaryInner, { onError: handleError }, children);
278483
278306
  }
278484
278307
 
278485
278308
  // src/tui/index.tsx
@@ -278590,16 +278413,16 @@ function ShortcutsDialog({
278590
278413
  }
278591
278414
 
278592
278415
  // src/tui/components/commands/help-dialog.tsx
278593
- var import_react54 = __toESM(require_react(), 1);
278416
+ var import_react55 = __toESM(require_react(), 1);
278594
278417
  function HelpDialog() {
278595
278418
  const { colors: colors2 } = useTheme();
278596
278419
  const { commands: commands2 } = useCommand();
278597
278420
  const route = useRoute();
278598
- const dimensions = useDimensions();
278599
- const [selectedIndex, setSelectedIndex] = import_react54.useState(0);
278600
- const [showDetail, setShowDetail] = import_react54.useState(false);
278601
- const scrollboxRef = import_react54.useRef(null);
278602
- const commandsByCategory = import_react54.useMemo(() => {
278421
+ const dimensions = useTerminalDimensions();
278422
+ const [selectedIndex, setSelectedIndex] = import_react55.useState(0);
278423
+ const [showDetail, setShowDetail] = import_react55.useState(false);
278424
+ const scrollboxRef = import_react55.useRef(null);
278425
+ const commandsByCategory = import_react55.useMemo(() => {
278603
278426
  const grouped = {};
278604
278427
  for (const cmd of commands2) {
278605
278428
  const category = cmd.category || "Other";
@@ -278610,15 +278433,15 @@ function HelpDialog() {
278610
278433
  }
278611
278434
  return grouped;
278612
278435
  }, [commands2]);
278613
- const flatCommands = import_react54.useMemo(() => {
278436
+ const flatCommands = import_react55.useMemo(() => {
278614
278437
  return commands2;
278615
278438
  }, [commands2]);
278616
- import_react54.useEffect(() => {
278439
+ import_react55.useEffect(() => {
278617
278440
  if (selectedIndex >= flatCommands.length) {
278618
278441
  setSelectedIndex(Math.max(0, flatCommands.length - 1));
278619
278442
  }
278620
278443
  }, [flatCommands.length, selectedIndex]);
278621
- import_react54.useEffect(() => {
278444
+ import_react55.useEffect(() => {
278622
278445
  scrollToIndex(scrollboxRef.current, selectedIndex, flatCommands, (cmd) => cmd.name);
278623
278446
  }, [selectedIndex, flatCommands]);
278624
278447
  const handleClose = () => {
@@ -279053,24 +278876,24 @@ function ModelsDisplay() {
279053
278876
  }
279054
278877
 
279055
278878
  // src/tui/components/commands/auth-flow.tsx
279056
- var import_react57 = __toESM(require_react(), 1);
278879
+ var import_react58 = __toESM(require_react(), 1);
279057
278880
  init_config2();
279058
278881
  function AuthFlow({ onClose }) {
279059
278882
  const { colors: colors2 } = useTheme();
279060
278883
  const appConfig = useConfig();
279061
278884
  const isConnected = !!(appConfig.data.accessToken || appConfig.data.pensarAPIKey);
279062
- const [step, setStep] = import_react57.useState(isConnected ? "success" : "start");
279063
- const [error40, setError] = import_react57.useState(null);
279064
- const [authMode, setAuthMode] = import_react57.useState(null);
279065
- const [deviceInfo, setDeviceInfo] = import_react57.useState(null);
279066
- const [legacyDeviceInfo, setLegacyDeviceInfo] = import_react57.useState(null);
279067
- const [workspaces, setWorkspaces] = import_react57.useState([]);
279068
- const [selectedWorkspace, setSelectedWorkspace] = import_react57.useState(null);
279069
- const [selectedIndex, setSelectedIndex] = import_react57.useState(0);
279070
- const [billingUrl, setBillingUrl] = import_react57.useState(null);
279071
- const [balance, setBalance] = import_react57.useState(null);
279072
- const pollingRef = import_react57.useRef(null);
279073
- const cancelledRef = import_react57.useRef(false);
278885
+ const [step, setStep] = import_react58.useState(isConnected ? "success" : "start");
278886
+ const [error40, setError] = import_react58.useState(null);
278887
+ const [authMode, setAuthMode] = import_react58.useState(null);
278888
+ const [deviceInfo, setDeviceInfo] = import_react58.useState(null);
278889
+ const [legacyDeviceInfo, setLegacyDeviceInfo] = import_react58.useState(null);
278890
+ const [workspaces, setWorkspaces] = import_react58.useState([]);
278891
+ const [selectedWorkspace, setSelectedWorkspace] = import_react58.useState(null);
278892
+ const [selectedIndex, setSelectedIndex] = import_react58.useState(0);
278893
+ const [billingUrl, setBillingUrl] = import_react58.useState(null);
278894
+ const [balance, setBalance] = import_react58.useState(null);
278895
+ const pollingRef = import_react58.useRef(null);
278896
+ const cancelledRef = import_react58.useRef(false);
279074
278897
  const connectedWorkspace = appConfig.data.workspaceSlug ? { name: appConfig.data.workspaceSlug, slug: appConfig.data.workspaceSlug } : null;
279075
278898
  const goHome = () => {
279076
278899
  onClose();
@@ -279082,7 +278905,7 @@ function AuthFlow({ onClose }) {
279082
278905
  pollingRef.current = null;
279083
278906
  }
279084
278907
  };
279085
- import_react57.useEffect(() => {
278908
+ import_react58.useEffect(() => {
279086
278909
  return cleanup;
279087
278910
  }, []);
279088
278911
  const openUrl = (url2) => {
@@ -279715,14 +279538,14 @@ function AuthFlow({ onClose }) {
279715
279538
  }
279716
279539
 
279717
279540
  // src/tui/components/commands/credits-flow.tsx
279718
- var import_react59 = __toESM(require_react(), 1);
279541
+ var import_react60 = __toESM(require_react(), 1);
279719
279542
  init_tokenRefresh();
279720
279543
  function CreditsFlow({ onOpenAuthDialog }) {
279721
279544
  const route = useRoute();
279722
279545
  const appConfig = useConfig();
279723
- const [step, setStep] = import_react59.useState("loading");
279724
- const [credits, setCredits] = import_react59.useState(null);
279725
- const [error40, setError] = import_react59.useState(null);
279546
+ const [step, setStep] = import_react60.useState("loading");
279547
+ const [credits, setCredits] = import_react60.useState(null);
279548
+ const [error40, setError] = import_react60.useState(null);
279726
279549
  const creditsUrl = `${getPensarConsoleUrl()}/credits`;
279727
279550
  const goHome = () => {
279728
279551
  route.navigate({ type: "base", path: "home" });
@@ -279780,7 +279603,7 @@ function CreditsFlow({ onOpenAuthDialog }) {
279780
279603
  setStep("display");
279781
279604
  }
279782
279605
  };
279783
- import_react59.useEffect(() => {
279606
+ import_react60.useEffect(() => {
279784
279607
  fetchBalance();
279785
279608
  }, []);
279786
279609
  useKeyboard((key) => {
@@ -280019,10 +279842,10 @@ function CreditsFlow({ onOpenAuthDialog }) {
280019
279842
  }
280020
279843
 
280021
279844
  // src/tui/context/keybinding.tsx
280022
- var import_react65 = __toESM(require_react(), 1);
279845
+ var import_react66 = __toESM(require_react(), 1);
280023
279846
 
280024
279847
  // src/tui/keybindings/keybind.tsx
280025
- var import_react61 = __toESM(require_react(), 1);
279848
+ var import_react62 = __toESM(require_react(), 1);
280026
279849
 
280027
279850
  // src/tui/keybindings/actions.ts
280028
279851
  var movementActions = [
@@ -280274,7 +280097,7 @@ var allActions = [
280274
280097
  var actionsByKey = new Map(allActions.map((action) => [action.key, action]));
280275
280098
  var actionsById = new Map(allActions.map((action) => [action.id, action]));
280276
280099
  // src/tui/keybindings/keybind.tsx
280277
- var LeaderKeyContext = import_react61.createContext(null);
280100
+ var LeaderKeyContext = import_react62.createContext(null);
280278
280101
  // src/tui/keybindings/registry.ts
280279
280102
  function createKeybindings(deps) {
280280
280103
  const {
@@ -280455,7 +280278,7 @@ function matchesKeybind(pressed, combo) {
280455
280278
  }
280456
280279
 
280457
280280
  // src/tui/context/keybinding.tsx
280458
- var KeybindingContext = import_react65.createContext(undefined);
280281
+ var KeybindingContext = import_react66.createContext(undefined);
280459
280282
  function KeybindingProvider({
280460
280283
  children,
280461
280284
  deps
@@ -280495,12 +280318,121 @@ function KeybindingProvider({
280495
280318
  }
280496
280319
 
280497
280320
  // src/tui/components/pentest/pentest.tsx
280498
- var import_react73 = __toESM(require_react(), 1);
280321
+ var import_react75 = __toESM(require_react(), 1);
280499
280322
  init_report();
280500
280323
  import { existsSync as existsSync26, readdirSync as readdirSync6, readFileSync as readFileSync12 } from "fs";
280501
280324
  import { join as join27 } from "path";
280502
280325
  init_session();
280503
- init_loader();
280326
+
280327
+ // src/core/session/loader.ts
280328
+ init_persistence();
280329
+ init_report();
280330
+ import { join as join5 } from "path";
280331
+ import { existsSync as existsSync9, readFileSync as readFileSync4 } from "fs";
280332
+ function loadAttackSurfaceResults(rootPath) {
280333
+ const resultsPath = join5(rootPath, "attack-surface-results.json");
280334
+ if (!existsSync9(resultsPath)) {
280335
+ return null;
280336
+ }
280337
+ try {
280338
+ return JSON.parse(readFileSync4(resultsPath, "utf-8"));
280339
+ } catch (e) {
280340
+ console.error("Failed to load attack surface results:", e);
280341
+ return null;
280342
+ }
280343
+ }
280344
+ function hasReport(rootPath) {
280345
+ const reportPath = join5(rootPath, REPORT_FILENAME_MD);
280346
+ return existsSync9(reportPath);
280347
+ }
280348
+ function createDiscoveryFromLogs(rootPath, session) {
280349
+ const logPath = join5(rootPath, "logs", "streamlined-pentest.log");
280350
+ if (!existsSync9(logPath)) {
280351
+ return null;
280352
+ }
280353
+ try {
280354
+ const logContent = readFileSync4(logPath, "utf-8");
280355
+ const lines = logContent.split(`
280356
+ `).filter(Boolean);
280357
+ const messages = [];
280358
+ for (const line of lines) {
280359
+ const match = line.match(/^(\d{4}-\d{2}-\d{2}T[\d:.]+Z) - \[(\w+)\] (.+)$/);
280360
+ if (!match)
280361
+ continue;
280362
+ const [, timestamp, _level, content] = match;
280363
+ const createdAt = new Date(timestamp);
280364
+ if (content.startsWith("[Tool]")) {
280365
+ const toolMatch = content.match(/\[Tool\] (\w+): (.+)/);
280366
+ if (toolMatch) {
280367
+ messages.push({
280368
+ role: "tool",
280369
+ content: `✓ ${toolMatch[2]}`,
280370
+ createdAt,
280371
+ toolName: toolMatch[1],
280372
+ status: "completed"
280373
+ });
280374
+ }
280375
+ } else if (content.startsWith("[Step")) {
280376
+ const stepMatch = content.match(/\[Step \d+\] (.+)/);
280377
+ if (stepMatch) {
280378
+ messages.push({
280379
+ role: "assistant",
280380
+ content: stepMatch[1],
280381
+ createdAt
280382
+ });
280383
+ }
280384
+ }
280385
+ }
280386
+ if (messages.length === 0) {
280387
+ return null;
280388
+ }
280389
+ return {
280390
+ id: "discovery-from-logs",
280391
+ name: "Attack Surface Discovery",
280392
+ type: "attack-surface",
280393
+ target: session.targets[0] || "Unknown",
280394
+ messages,
280395
+ createdAt: new Date(session.time.created),
280396
+ status: "completed"
280397
+ };
280398
+ } catch (e) {
280399
+ console.error("Failed to parse logs:", e);
280400
+ return null;
280401
+ }
280402
+ }
280403
+ async function loadSessionState(session) {
280404
+ const rootPath = session.rootPath;
280405
+ let subagents = loadSubagents(rootPath);
280406
+ const hasAttackSurfaceAgent = subagents.some((s) => s.type === "attack-surface");
280407
+ if (!hasAttackSurfaceAgent) {
280408
+ const discoveryAgent = createDiscoveryFromLogs(rootPath, session);
280409
+ if (discoveryAgent) {
280410
+ subagents = [discoveryAgent, ...subagents];
280411
+ }
280412
+ }
280413
+ const attackSurfaceResults = loadAttackSurfaceResults(rootPath);
280414
+ const hasReportFile = hasReport(rootPath);
280415
+ const hasDiscoverySubagent = subagents.some((s) => s.type === "attack-surface");
280416
+ const interruptedDuringDiscovery = !attackSurfaceResults && !hasReportFile && hasDiscoverySubagent;
280417
+ if (interruptedDuringDiscovery) {
280418
+ for (let i = 0;i < subagents.length; i++) {
280419
+ if (subagents[i].type === "attack-surface" && subagents[i].status === "completed") {
280420
+ subagents[i] = { ...subagents[i], status: "paused" };
280421
+ }
280422
+ }
280423
+ }
280424
+ const pentestSubagents = subagents.filter((s) => s.type === "pentest");
280425
+ const allPentestDone = pentestSubagents.length > 0 && pentestSubagents.every((s) => s.status === "completed" || s.status === "failed");
280426
+ const isComplete = hasReportFile || attackSurfaceResults?.summary?.analysisComplete === true && allPentestDone;
280427
+ return {
280428
+ session,
280429
+ subagents,
280430
+ attackSurfaceResults,
280431
+ isComplete,
280432
+ hasReport: hasReportFile,
280433
+ interruptedDuringDiscovery
280434
+ };
280435
+ }
280504
280436
 
280505
280437
  // src/core/api/blackboxPentest.ts
280506
280438
  init_pentest();
@@ -280527,7 +280459,7 @@ Found ${findings.length} vulnerabilities`);
280527
280459
  init_utils();
280528
280460
 
280529
280461
  // src/tui/components/agent-display.tsx
280530
- var import_react72 = __toESM(require_react(), 1);
280462
+ var import_react73 = __toESM(require_react(), 1);
280531
280463
 
280532
280464
  // node_modules/marked/lib/marked.esm.js
280533
280465
  function L2() {
@@ -282859,14 +282791,14 @@ ${preview}${suffix}` : preview + suffix || "POC passed",
282859
282791
  return null;
282860
282792
  }
282861
282793
  // src/tui/components/shared/ascii-spinner.tsx
282862
- var import_react66 = __toESM(require_react(), 1);
282794
+ var import_react67 = __toESM(require_react(), 1);
282863
282795
  var SPINNER_FRAMES = ["/", "-", "\\", "|"];
282864
282796
  var SPINNER_INTERVAL = 100;
282865
282797
  function AsciiSpinner({ label, fg: fg2 }) {
282866
282798
  const { colors: colors2 } = useTheme();
282867
282799
  const spinnerColor = fg2 ?? colors2.info;
282868
- const [frame, setFrame] = import_react66.useState(0);
282869
- import_react66.useEffect(() => {
282800
+ const [frame, setFrame] = import_react67.useState(0);
282801
+ import_react67.useEffect(() => {
282870
282802
  const interval = setInterval(() => {
282871
282803
  setFrame((f3) => (f3 + 1) % SPINNER_FRAMES.length);
282872
282804
  }, SPINNER_INTERVAL);
@@ -282878,7 +282810,7 @@ function AsciiSpinner({ label, fg: fg2 }) {
282878
282810
  }, undefined, false, undefined, this);
282879
282811
  }
282880
282812
  // src/tui/components/shared/tool-renderer.tsx
282881
- var import_react67 = __toESM(require_react(), 1);
282813
+ var import_react68 = __toESM(require_react(), 1);
282882
282814
  var TOOLS_WITH_LOG_WINDOW = new Set([
282883
282815
  "execute_command",
282884
282816
  "run_attack_surface",
@@ -282891,13 +282823,13 @@ var TOOLS_WITH_LOG_WINDOW = new Set([
282891
282823
  "document_vulnerability"
282892
282824
  ]);
282893
282825
  var DEFAULT_SUBAGENT_LOG_LINES = 5;
282894
- var ToolRenderer = import_react67.memo(function ToolRenderer2({
282826
+ var ToolRenderer = import_react68.memo(function ToolRenderer2({
282895
282827
  message,
282896
282828
  verbose = false,
282897
282829
  expandedLogs = false
282898
282830
  }) {
282899
282831
  const { colors: colors2 } = useTheme();
282900
- const [showOutput, setShowOutput] = import_react67.useState(false);
282832
+ const [showOutput, setShowOutput] = import_react68.useState(false);
282901
282833
  if (!isToolMessage(message)) {
282902
282834
  return null;
282903
282835
  }
@@ -283037,7 +282969,7 @@ var ToolRenderer = import_react67.memo(function ToolRenderer2({
283037
282969
  ]
283038
282970
  }, undefined, true, undefined, this);
283039
282971
  });
283040
- var SubagentLogWindow = import_react67.memo(function SubagentLogWindow2({
282972
+ var SubagentLogWindow = import_react68.memo(function SubagentLogWindow2({
283041
282973
  subagentId,
283042
282974
  entry,
283043
282975
  expandedLogs
@@ -283094,8 +283026,8 @@ var SubagentLogWindow = import_react67.memo(function SubagentLogWindow2({
283094
283026
  }, undefined, true, undefined, this);
283095
283027
  });
283096
283028
  // src/tui/components/shared/message-renderer.tsx
283097
- var import_react68 = __toESM(require_react(), 1);
283098
- var MessageRenderer = import_react68.memo(function MessageRenderer2({
283029
+ var import_react69 = __toESM(require_react(), 1);
283030
+ var MessageRenderer = import_react69.memo(function MessageRenderer2({
283099
283031
  message,
283100
283032
  isStreaming = false,
283101
283033
  verbose = false,
@@ -283105,7 +283037,7 @@ var MessageRenderer = import_react68.memo(function MessageRenderer2({
283105
283037
  }) {
283106
283038
  const { colors: colors2 } = useTheme();
283107
283039
  const content = typeof message.content === "string" ? message.content : JSON.stringify(message.content);
283108
- const displayContent = import_react68.useMemo(() => message.role === "assistant" ? markdownToStyledText(content, colors2) : content, [content, message.role, colors2]);
283040
+ const displayContent = import_react69.useMemo(() => message.role === "assistant" ? markdownToStyledText(content, colors2) : content, [content, message.role, colors2]);
283109
283041
  if (isToolMessage(message)) {
283110
283042
  return /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV(ToolRenderer, {
283111
283043
  message,
@@ -283217,9 +283149,9 @@ var MessageRenderer = import_react68.memo(function MessageRenderer2({
283217
283149
  }, undefined, false, undefined, this);
283218
283150
  });
283219
283151
  // src/tui/components/shared/approval-prompt.tsx
283220
- var import_react69 = __toESM(require_react(), 1);
283152
+ var import_react70 = __toESM(require_react(), 1);
283221
283153
  // src/tui/components/shared/message-reducer.ts
283222
- var import_react71 = __toESM(require_react(), 1);
283154
+ var import_react72 = __toESM(require_react(), 1);
283223
283155
  // src/tui/components/agent-display.tsx
283224
283156
  function getStableKey(item, contextId = "root") {
283225
283157
  if ("messages" in item) {
@@ -283295,11 +283227,11 @@ function AgentDisplay({
283295
283227
  ]
283296
283228
  }, undefined, true, undefined, this);
283297
283229
  }
283298
- var SubAgentDisplay = import_react72.memo(function SubAgentDisplay2({
283230
+ var SubAgentDisplay = import_react73.memo(function SubAgentDisplay2({
283299
283231
  subagent
283300
283232
  }) {
283301
283233
  const { colors: colors2 } = useTheme();
283302
- const [open, setOpen] = import_react72.useState(false);
283234
+ const [open, setOpen] = import_react73.useState(false);
283303
283235
  return /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("box", {
283304
283236
  height: open ? 40 : "auto",
283305
283237
  onMouseDown: () => setOpen(!open),
@@ -283354,11 +283286,11 @@ var SubAgentDisplay = import_react72.memo(function SubAgentDisplay2({
283354
283286
  ]
283355
283287
  }, undefined, true, undefined, this);
283356
283288
  });
283357
- var AgentMessage = import_react72.memo(function AgentMessage2({
283289
+ var AgentMessage = import_react73.memo(function AgentMessage2({
283358
283290
  message
283359
283291
  }) {
283360
283292
  const { colors: colors2 } = useTheme();
283361
- const dimensions = useDimensions();
283293
+ const dimensions = useTerminalDimensions();
283362
283294
  let content = "";
283363
283295
  if (typeof message.content === "string") {
283364
283296
  content = message.content;
@@ -283463,8 +283395,8 @@ var AgentMessage = import_react72.memo(function AgentMessage2({
283463
283395
  });
283464
283396
  function ToolDetails({ message }) {
283465
283397
  const { colors: colors2 } = useTheme();
283466
- const [showArgs, setShowArgs] = import_react72.useState(false);
283467
- const [showResult, setShowResult] = import_react72.useState(false);
283398
+ const [showArgs, setShowArgs] = import_react73.useState(false);
283399
+ const [showResult, setShowResult] = import_react73.useState(false);
283468
283400
  if (message.role !== "tool") {
283469
283401
  return null;
283470
283402
  }
@@ -283570,27 +283502,27 @@ function Pentest({
283570
283502
  const config3 = useConfig();
283571
283503
  const { model, setThinking, setIsExecuting, isExecuting } = useAgent();
283572
283504
  const { stack, externalDialogOpen } = useDialog();
283573
- const [session, setSession] = import_react73.useState(null);
283574
- const [error40, setError] = import_react73.useState(null);
283575
- const [phase, setPhase] = import_react73.useState("loading");
283576
- const [abortController, setAbortController] = import_react73.useState(null);
283577
- const [panelMessages, setPanelMessages] = import_react73.useState([]);
283578
- const panelTextRef = import_react73.useRef("");
283579
- const panelSourceRef = import_react73.useRef(null);
283580
- const [pentestAgents, setPentestAgents] = import_react73.useState({});
283581
- const pentestTextRefs = import_react73.useRef({});
283582
- const [assets, setAssets] = import_react73.useState([]);
283583
- const [viewMode, setViewMode] = import_react73.useState("overview");
283584
- const [selectedAgentId, setSelectedAgentId] = import_react73.useState(null);
283585
- const [focusedIndex, setFocusedIndex] = import_react73.useState(0);
283586
- const [showOrchestratorPanel, setShowOrchestratorPanel] = import_react73.useState(false);
283587
- const [startTime, setStartTime] = import_react73.useState(null);
283588
- const pentestAgentList = import_react73.useMemo(() => Object.values(pentestAgents).sort((a, b3) => a.createdAt.getTime() - b3.createdAt.getTime()), [pentestAgents]);
283589
- const selectedAgent = import_react73.useMemo(() => selectedAgentId ? pentestAgents[selectedAgentId] ?? null : null, [pentestAgents, selectedAgentId]);
283590
- const { width: termWidth } = useDimensions();
283505
+ const [session, setSession] = import_react75.useState(null);
283506
+ const [error40, setError] = import_react75.useState(null);
283507
+ const [phase, setPhase] = import_react75.useState("loading");
283508
+ const [abortController, setAbortController] = import_react75.useState(null);
283509
+ const [panelMessages, setPanelMessages] = import_react75.useState([]);
283510
+ const panelTextRef = import_react75.useRef("");
283511
+ const panelSourceRef = import_react75.useRef(null);
283512
+ const [pentestAgents, setPentestAgents] = import_react75.useState({});
283513
+ const pentestTextRefs = import_react75.useRef({});
283514
+ const [assets, setAssets] = import_react75.useState([]);
283515
+ const [viewMode, setViewMode] = import_react75.useState("overview");
283516
+ const [selectedAgentId, setSelectedAgentId] = import_react75.useState(null);
283517
+ const [focusedIndex, setFocusedIndex] = import_react75.useState(0);
283518
+ const [showOrchestratorPanel, setShowOrchestratorPanel] = import_react75.useState(false);
283519
+ const [startTime, setStartTime] = import_react75.useState(null);
283520
+ const pentestAgentList = import_react75.useMemo(() => Object.values(pentestAgents).sort((a, b3) => a.createdAt.getTime() - b3.createdAt.getTime()), [pentestAgents]);
283521
+ const selectedAgent = import_react75.useMemo(() => selectedAgentId ? pentestAgents[selectedAgentId] ?? null : null, [pentestAgents, selectedAgentId]);
283522
+ const { width: termWidth } = useTerminalDimensions();
283591
283523
  const gridAvailableWidth = showOrchestratorPanel ? Math.floor((termWidth - 4) / 2) - 2 : termWidth - ORCHESTRATOR_PANEL_WIDTH - GRID_OUTER_PADDING;
283592
283524
  const gridColumns = Math.max(1, Math.floor((gridAvailableWidth + GRID_GAP) / (CARD_MIN_WIDTH + GRID_GAP)));
283593
- import_react73.useEffect(() => {
283525
+ import_react75.useEffect(() => {
283594
283526
  async function load2() {
283595
283527
  try {
283596
283528
  let s2;
@@ -283636,9 +283568,6 @@ function Pentest({
283636
283568
  if (attackSurfaceAgents.some((sa) => sa.messages.length > 0)) {
283637
283569
  setShowOrchestratorPanel(true);
283638
283570
  }
283639
- if (state.attackSurfaceResults?.summary?.analysisComplete) {
283640
- setPhase("pentesting");
283641
- }
283642
283571
  startPentest(s2);
283643
283572
  }
283644
283573
  } else {
@@ -283651,7 +283580,7 @@ function Pentest({
283651
283580
  }
283652
283581
  load2();
283653
283582
  }, [sessionId]);
283654
- import_react73.useEffect(() => {
283583
+ import_react75.useEffect(() => {
283655
283584
  if (!session)
283656
283585
  return;
283657
283586
  const assetsPath = join27(session.rootPath, "assets");
@@ -283674,12 +283603,12 @@ function Pentest({
283674
283603
  const interval = setInterval(readAssets, 2000);
283675
283604
  return () => clearInterval(interval);
283676
283605
  }, [session]);
283677
- import_react73.useEffect(() => {
283606
+ import_react75.useEffect(() => {
283678
283607
  return () => {
283679
283608
  abortController?.abort();
283680
283609
  };
283681
283610
  }, [abortController]);
283682
- const ensurePentestAgent = import_react73.useCallback((subagentId) => {
283611
+ const ensurePentestAgent = import_react75.useCallback((subagentId) => {
283683
283612
  setPentestAgents((prev) => {
283684
283613
  if (prev[subagentId])
283685
283614
  return prev;
@@ -283696,7 +283625,7 @@ function Pentest({
283696
283625
  };
283697
283626
  });
283698
283627
  }, []);
283699
- const handleSubagentSpawn = import_react73.useCallback(({
283628
+ const handleSubagentSpawn = import_react75.useCallback(({
283700
283629
  subagentId,
283701
283630
  input
283702
283631
  }) => {
@@ -283716,7 +283645,7 @@ function Pentest({
283716
283645
  }
283717
283646
  }));
283718
283647
  }, []);
283719
- const handleSubagentComplete = import_react73.useCallback(({ subagentId, status }) => {
283648
+ const handleSubagentComplete = import_react75.useCallback(({ subagentId, status }) => {
283720
283649
  if (!subagentId.startsWith("pentest-agent-"))
283721
283650
  return;
283722
283651
  setPentestAgents((prev) => {
@@ -283729,7 +283658,7 @@ function Pentest({
283729
283658
  };
283730
283659
  });
283731
283660
  }, []);
283732
- const appendPanelText = import_react73.useCallback((source, text2) => {
283661
+ const appendPanelText = import_react75.useCallback((source, text2) => {
283733
283662
  if (panelSourceRef.current !== source) {
283734
283663
  panelTextRef.current = "";
283735
283664
  panelSourceRef.current = source;
@@ -283754,7 +283683,7 @@ function Pentest({
283754
283683
  ];
283755
283684
  });
283756
283685
  }, []);
283757
- const appendPentestText = import_react73.useCallback((subagentId, text2) => {
283686
+ const appendPentestText = import_react75.useCallback((subagentId, text2) => {
283758
283687
  ensurePentestAgent(subagentId);
283759
283688
  if (!pentestTextRefs.current[subagentId]) {
283760
283689
  pentestTextRefs.current[subagentId] = "";
@@ -283787,8 +283716,8 @@ function Pentest({
283787
283716
  };
283788
283717
  });
283789
283718
  }, [ensurePentestAgent]);
283790
- const toolArgsDeltaRef = import_react73.useRef(new Map);
283791
- const addPanelStreamingToolCall = import_react73.useCallback((toolCallId, toolName) => {
283719
+ const toolArgsDeltaRef = import_react75.useRef(new Map);
283720
+ const addPanelStreamingToolCall = import_react75.useCallback((toolCallId, toolName) => {
283792
283721
  panelTextRef.current = "";
283793
283722
  panelSourceRef.current = null;
283794
283723
  toolArgsDeltaRef.current.set(toolCallId, "");
@@ -283807,7 +283736,7 @@ function Pentest({
283807
283736
  return [...prev, msg];
283808
283737
  });
283809
283738
  }, []);
283810
- const appendPanelToolCallDelta = import_react73.useCallback((toolCallId, argsTextDelta) => {
283739
+ const appendPanelToolCallDelta = import_react75.useCallback((toolCallId, argsTextDelta) => {
283811
283740
  const prev = toolArgsDeltaRef.current.get(toolCallId) ?? "";
283812
283741
  const accumulated = prev + argsTextDelta;
283813
283742
  toolArgsDeltaRef.current.set(toolCallId, accumulated);
@@ -283830,7 +283759,7 @@ function Pentest({
283830
283759
  return updated;
283831
283760
  });
283832
283761
  }, []);
283833
- const addPanelToolCall = import_react73.useCallback((toolCallId, toolName, args) => {
283762
+ const addPanelToolCall = import_react75.useCallback((toolCallId, toolName, args) => {
283834
283763
  panelTextRef.current = "";
283835
283764
  panelSourceRef.current = null;
283836
283765
  toolArgsDeltaRef.current.delete(toolCallId);
@@ -283862,7 +283791,7 @@ function Pentest({
283862
283791
  ];
283863
283792
  });
283864
283793
  }, []);
283865
- const addPentestStreamingToolCall = import_react73.useCallback((subagentId, toolCallId, toolName) => {
283794
+ const addPentestStreamingToolCall = import_react75.useCallback((subagentId, toolCallId, toolName) => {
283866
283795
  pentestTextRefs.current[subagentId] = "";
283867
283796
  ensurePentestAgent(subagentId);
283868
283797
  toolArgsDeltaRef.current.set(toolCallId, "");
@@ -283887,7 +283816,7 @@ function Pentest({
283887
283816
  };
283888
283817
  });
283889
283818
  }, [ensurePentestAgent]);
283890
- const appendPentestToolCallDelta = import_react73.useCallback((subagentId, toolCallId, argsTextDelta) => {
283819
+ const appendPentestToolCallDelta = import_react75.useCallback((subagentId, toolCallId, argsTextDelta) => {
283891
283820
  const prev = toolArgsDeltaRef.current.get(toolCallId) ?? "";
283892
283821
  const accumulated = prev + argsTextDelta;
283893
283822
  toolArgsDeltaRef.current.set(toolCallId, accumulated);
@@ -283913,7 +283842,7 @@ function Pentest({
283913
283842
  return { ...agents, [subagentId]: { ...agent, messages: updatedMsgs } };
283914
283843
  });
283915
283844
  }, []);
283916
- const addPentestToolCall = import_react73.useCallback((subagentId, toolCallId, toolName, args) => {
283845
+ const addPentestToolCall = import_react75.useCallback((subagentId, toolCallId, toolName, args) => {
283917
283846
  pentestTextRefs.current[subagentId] = "";
283918
283847
  ensurePentestAgent(subagentId);
283919
283848
  toolArgsDeltaRef.current.delete(toolCallId);
@@ -283974,12 +283903,12 @@ function Pentest({
283974
283903
  }
283975
283904
  ];
283976
283905
  };
283977
- const updatePanelToolResult = import_react73.useCallback((toolCallId, toolName, result) => {
283906
+ const updatePanelToolResult = import_react75.useCallback((toolCallId, toolName, result) => {
283978
283907
  panelTextRef.current = "";
283979
283908
  panelSourceRef.current = null;
283980
283909
  setPanelMessages((prev) => toolResultUpdater(prev, toolCallId, toolName, result));
283981
283910
  }, []);
283982
- const updatePentestToolResult = import_react73.useCallback((subagentId, toolCallId, toolName, result) => {
283911
+ const updatePentestToolResult = import_react75.useCallback((subagentId, toolCallId, toolName, result) => {
283983
283912
  pentestTextRefs.current[subagentId] = "";
283984
283913
  setPentestAgents((prev) => {
283985
283914
  const agent = prev[subagentId];
@@ -283994,12 +283923,11 @@ function Pentest({
283994
283923
  };
283995
283924
  });
283996
283925
  }, []);
283997
- const startPentest = import_react73.useCallback(async (s2) => {
283998
- setPhase((prev) => prev === "pentesting" || prev === "reporting" ? prev : "discovery");
283926
+ const startPentest = import_react75.useCallback(async (s2) => {
283927
+ setPhase("discovery");
283999
283928
  setStartTime(new Date);
284000
283929
  setIsExecuting(true);
284001
- const discoveryDone = existsSync26(join27(s2.rootPath, "attack-surface-results.json"));
284002
- setThinking(!discoveryDone);
283930
+ setThinking(true);
284003
283931
  const controller = new AbortController;
284004
283932
  setAbortController(controller);
284005
283933
  try {
@@ -284122,7 +284050,7 @@ function Pentest({
284122
284050
  handleSubagentSpawn,
284123
284051
  handleSubagentComplete
284124
284052
  ]);
284125
- import_react73.useEffect(() => {
284053
+ import_react75.useEffect(() => {
284126
284054
  if (phase === "completed") {
284127
284055
  setFocusedIndex(pentestAgentList.length);
284128
284056
  }
@@ -284185,7 +284113,7 @@ function Pentest({
284185
284113
  }
284186
284114
  }
284187
284115
  });
284188
- const openReport = import_react73.useCallback(() => {
284116
+ const openReport = import_react75.useCallback(() => {
284189
284117
  if (!session)
284190
284118
  return;
284191
284119
  const err = openSessionReport(session.rootPath);
@@ -284370,7 +284298,7 @@ function OrchestratorPanel({
284370
284298
  }) {
284371
284299
  const { colors: colors2 } = useTheme();
284372
284300
  const isRunning = phase !== "loading" && phase !== "completed" && phase !== "error";
284373
- const assetSummary = import_react73.useMemo(() => {
284301
+ const assetSummary = import_react75.useMemo(() => {
284374
284302
  const byType = {};
284375
284303
  for (const a of assets) {
284376
284304
  const key = a.assetType;
@@ -284613,13 +284541,13 @@ function AgentCardGrid({
284613
284541
  onSelectAgent
284614
284542
  }) {
284615
284543
  const { colors: colors2 } = useTheme();
284616
- const scrollRef = import_react73.useRef(null);
284617
- import_react73.useEffect(() => {
284544
+ const scrollRef = import_react75.useRef(null);
284545
+ import_react75.useEffect(() => {
284618
284546
  const agent = agents[focusedIndex];
284619
284547
  if (agent)
284620
284548
  scrollToChild(scrollRef.current, agent.id);
284621
284549
  }, [focusedIndex, agents]);
284622
- const rows = import_react73.useMemo(() => {
284550
+ const rows = import_react75.useMemo(() => {
284623
284551
  const result = [];
284624
284552
  for (let i2 = 0;i2 < agents.length; i2 += gridColumns) {
284625
284553
  result.push(agents.slice(i2, i2 + gridColumns));
@@ -284676,14 +284604,14 @@ function AgentCard({
284676
284604
  completed: colors2.primary,
284677
284605
  failed: colors2.error
284678
284606
  }[agent.status];
284679
- const lastActivity = import_react73.useMemo(() => {
284607
+ const lastActivity = import_react75.useMemo(() => {
284680
284608
  const last = agent.messages[agent.messages.length - 1];
284681
284609
  if (!last)
284682
284610
  return "Starting...";
284683
284611
  const text2 = typeof last.content === "string" ? last.content.replace(/\n/g, " ").trim() : "Working...";
284684
284612
  return text2.length > 50 ? text2.substring(0, 47) + "..." : text2;
284685
284613
  }, [agent.messages]);
284686
- const toolCalls = import_react73.useMemo(() => agent.messages.filter((m4) => m4.role === "tool").length, [agent.messages]);
284614
+ const toolCalls = import_react75.useMemo(() => agent.messages.filter((m4) => m4.role === "tool").length, [agent.messages]);
284687
284615
  return /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("box", {
284688
284616
  id: agent.id,
284689
284617
  flexGrow: 1,
@@ -284871,8 +284799,8 @@ function MetricsBar({
284871
284799
  isExecuting
284872
284800
  }) {
284873
284801
  const { colors: colors2 } = useTheme();
284874
- const [now2, setNow] = import_react73.useState(Date.now());
284875
- import_react73.useEffect(() => {
284802
+ const [now2, setNow] = import_react75.useState(Date.now());
284803
+ import_react75.useEffect(() => {
284876
284804
  if (!isExecuting)
284877
284805
  return;
284878
284806
  const interval = setInterval(() => setNow(Date.now()), 1000);
@@ -285015,7 +284943,7 @@ function MetricsBar({
285015
284943
  }
285016
284944
 
285017
284945
  // src/tui/components/operator-dashboard/index.tsx
285018
- var import_react78 = __toESM(require_react(), 1);
284946
+ var import_react80 = __toESM(require_react(), 1);
285019
284947
  init_session();
285020
284948
 
285021
284949
  // src/core/api/offesecAgent.ts
@@ -285118,7 +285046,7 @@ function InlineApprovalPrompt2({ approval }) {
285118
285046
  }
285119
285047
 
285120
285048
  // src/tui/components/chat/loading-indicator.tsx
285121
- var import_react75 = __toESM(require_react(), 1);
285049
+ var import_react77 = __toESM(require_react(), 1);
285122
285050
  var SPINNER_FRAMES2 = ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"];
285123
285051
  var SPINNER_INTERVAL2 = 80;
285124
285052
  var DOTS_FRAMES = ["", ".", "..", "..."];
@@ -285129,15 +285057,15 @@ function LoadingIndicator({
285129
285057
  toolName
285130
285058
  }) {
285131
285059
  const { colors: colors2 } = useTheme();
285132
- const [spinnerFrame, setSpinnerFrame] = import_react75.useState(0);
285133
- const [dotsFrame, setDotsFrame] = import_react75.useState(0);
285134
- import_react75.useEffect(() => {
285060
+ const [spinnerFrame, setSpinnerFrame] = import_react77.useState(0);
285061
+ const [dotsFrame, setDotsFrame] = import_react77.useState(0);
285062
+ import_react77.useEffect(() => {
285135
285063
  const interval = setInterval(() => {
285136
285064
  setSpinnerFrame((f3) => (f3 + 1) % SPINNER_FRAMES2.length);
285137
285065
  }, SPINNER_INTERVAL2);
285138
285066
  return () => clearInterval(interval);
285139
285067
  }, []);
285140
- import_react75.useEffect(() => {
285068
+ import_react77.useEffect(() => {
285141
285069
  const interval = setInterval(() => {
285142
285070
  setDotsFrame((f3) => (f3 + 1) % DOTS_FRAMES.length);
285143
285071
  }, DOTS_INTERVAL);
@@ -285391,7 +285319,7 @@ function MessageList({
285391
285319
  }
285392
285320
 
285393
285321
  // src/tui/components/chat/input-area.tsx
285394
- var import_react76 = __toESM(require_react(), 1);
285322
+ var import_react78 = __toESM(require_react(), 1);
285395
285323
  function NormalInputAreaInner({
285396
285324
  value,
285397
285325
  onChange,
@@ -285413,10 +285341,10 @@ function NormalInputAreaInner({
285413
285341
  }) {
285414
285342
  const { colors: colors2, theme, mode: colorMode } = useTheme();
285415
285343
  const { inputValue, setInputValue } = useInput();
285416
- const promptRef = import_react76.useRef(null);
285417
- const isExternalUpdate = import_react76.useRef(false);
285418
- const prevValueRef = import_react76.useRef(value);
285419
- import_react76.useEffect(() => {
285344
+ const promptRef = import_react78.useRef(null);
285345
+ const isExternalUpdate = import_react78.useRef(false);
285346
+ const prevValueRef = import_react78.useRef(value);
285347
+ import_react78.useEffect(() => {
285420
285348
  const prevValue = prevValueRef.current;
285421
285349
  prevValueRef.current = value;
285422
285350
  if (value !== prevValue && value !== inputValue) {
@@ -285425,7 +285353,7 @@ function NormalInputAreaInner({
285425
285353
  promptRef.current?.setValue(value);
285426
285354
  }
285427
285355
  }, [value, inputValue, setInputValue]);
285428
- import_react76.useEffect(() => {
285356
+ import_react78.useEffect(() => {
285429
285357
  if (isExternalUpdate.current) {
285430
285358
  isExternalUpdate.current = false;
285431
285359
  return;
@@ -285600,7 +285528,7 @@ function ApprovalInputArea2({
285600
285528
  lastDeclineNote
285601
285529
  }) {
285602
285530
  const { colors: colors2 } = useTheme();
285603
- const [focusedElement, setFocusedElement] = import_react76.useState(0);
285531
+ const [focusedElement, setFocusedElement] = import_react78.useState(0);
285604
285532
  useKeyboard((key) => {
285605
285533
  if (key.name === "up") {
285606
285534
  setFocusedElement((prev) => Math.max(0, prev - 1));
@@ -285927,29 +285855,29 @@ function OperatorDashboard({
285927
285855
  clear: clearDialog,
285928
285856
  setSize: setDialogSize
285929
285857
  } = useDialog();
285930
- const autocompleteOptions = import_react78.useMemo(() => {
285858
+ const autocompleteOptions = import_react80.useMemo(() => {
285931
285859
  const skillSlugs = new Set(skills.map((s2) => `/${slugify(s2.name)}`));
285932
285860
  return filterOperatorAutocomplete(allAutocompleteOptions, skillSlugs);
285933
285861
  }, [allAutocompleteOptions, skills]);
285934
- const [session, setSession] = import_react78.useState(null);
285935
- const [loading, setLoading] = import_react78.useState(true);
285936
- const [error40, setError] = import_react78.useState(null);
285937
- const pendingNameRef = import_react78.useRef(null);
285938
- const [status, setStatus] = import_react78.useState("idle");
285939
- const abortControllerRef = import_react78.useRef(null);
285940
- const generationRef = import_react78.useRef(0);
285941
- const cancelHandleRef = import_react78.useRef({
285862
+ const [session, setSession] = import_react80.useState(null);
285863
+ const [loading, setLoading] = import_react80.useState(true);
285864
+ const [error40, setError] = import_react80.useState(null);
285865
+ const pendingNameRef = import_react80.useRef(null);
285866
+ const [status, setStatus] = import_react80.useState("idle");
285867
+ const abortControllerRef = import_react80.useRef(null);
285868
+ const generationRef = import_react80.useRef(0);
285869
+ const cancelHandleRef = import_react80.useRef({
285942
285870
  cancel: () => false
285943
285871
  });
285944
- const commandCancelledRef = import_react78.useRef(false);
285945
- const [messages, setMessages] = import_react78.useState([]);
285946
- const textRef = import_react78.useRef("");
285947
- const conversationRef = import_react78.useRef([]);
285948
- const [inputValue, setInputValue] = import_react78.useState("");
285949
- const [queuedMessages, setQueuedMessages] = import_react78.useState([]);
285950
- const [selectedQueueIndex, setSelectedQueueIndex] = import_react78.useState(-1);
285951
- const queuedMessagesRef = import_react78.useRef([]);
285952
- import_react78.useEffect(() => {
285872
+ const commandCancelledRef = import_react80.useRef(false);
285873
+ const [messages, setMessages] = import_react80.useState([]);
285874
+ const textRef = import_react80.useRef("");
285875
+ const conversationRef = import_react80.useRef([]);
285876
+ const [inputValue, setInputValue] = import_react80.useState("");
285877
+ const [queuedMessages, setQueuedMessages] = import_react80.useState([]);
285878
+ const [selectedQueueIndex, setSelectedQueueIndex] = import_react80.useState(-1);
285879
+ const queuedMessagesRef = import_react80.useRef([]);
285880
+ import_react80.useEffect(() => {
285953
285881
  queuedMessagesRef.current = queuedMessages;
285954
285882
  if (queuedMessages.length === 0) {
285955
285883
  setSelectedQueueIndex(-1);
@@ -285957,17 +285885,17 @@ function OperatorDashboard({
285957
285885
  setSelectedQueueIndex(queuedMessages.length - 1);
285958
285886
  }
285959
285887
  }, [queuedMessages, selectedQueueIndex]);
285960
- const [operatorState, setOperatorState] = import_react78.useState(() => createInitialOperatorState("manual", true));
285961
- const approvalGateRef = import_react78.useRef(new ApprovalGate({ requireApproval: true }));
285962
- const [pendingApprovals, setPendingApprovals] = import_react78.useState([]);
285963
- const [lastApprovedAction, setLastApprovedAction] = import_react78.useState(null);
285964
- const [verboseMode, setVerboseMode] = import_react78.useState(false);
285965
- const [expandedLogs, setExpandedLogs] = import_react78.useState(false);
285966
- const tokenUsageRef = import_react78.useRef(tokenUsage);
285967
- import_react78.useEffect(() => {
285888
+ const [operatorState, setOperatorState] = import_react80.useState(() => createInitialOperatorState("manual", true));
285889
+ const approvalGateRef = import_react80.useRef(new ApprovalGate({ requireApproval: true }));
285890
+ const [pendingApprovals, setPendingApprovals] = import_react80.useState([]);
285891
+ const [lastApprovedAction, setLastApprovedAction] = import_react80.useState(null);
285892
+ const [verboseMode, setVerboseMode] = import_react80.useState(false);
285893
+ const [expandedLogs, setExpandedLogs] = import_react80.useState(false);
285894
+ const tokenUsageRef = import_react80.useRef(tokenUsage);
285895
+ import_react80.useEffect(() => {
285968
285896
  tokenUsageRef.current = tokenUsage;
285969
285897
  }, [tokenUsage]);
285970
- import_react78.useEffect(() => {
285898
+ import_react80.useEffect(() => {
285971
285899
  const gate = approvalGateRef.current;
285972
285900
  const onApprovalNeeded = () => {
285973
285901
  setPendingApprovals(gate.getPendingApprovals());
@@ -285989,7 +285917,7 @@ function OperatorDashboard({
285989
285917
  gate.off("approval-resolved", onApprovalResolved);
285990
285918
  };
285991
285919
  }, []);
285992
- import_react78.useEffect(() => {
285920
+ import_react80.useEffect(() => {
285993
285921
  async function loadSession() {
285994
285922
  try {
285995
285923
  if (sessionId) {
@@ -286046,10 +285974,10 @@ function OperatorDashboard({
286046
285974
  }
286047
285975
  loadSession();
286048
285976
  }, [sessionId]);
286049
- import_react78.useEffect(() => {
285977
+ import_react80.useEffect(() => {
286050
285978
  return () => setSessionCwd(null);
286051
285979
  }, [setSessionCwd]);
286052
- import_react78.useEffect(() => {
285980
+ import_react80.useEffect(() => {
286053
285981
  if (!session)
286054
285982
  return;
286055
285983
  resetTokenUsage();
@@ -286067,7 +285995,7 @@ function OperatorDashboard({
286067
285995
  });
286068
285996
  } catch {}
286069
285997
  }, [session, addTokenUsage, resetTokenUsage]);
286070
- const appendText = import_react78.useCallback((text2) => {
285998
+ const appendText = import_react80.useCallback((text2) => {
286071
285999
  textRef.current += text2;
286072
286000
  const accumulated = textRef.current;
286073
286001
  setMessages((prev) => {
@@ -286083,8 +286011,8 @@ function OperatorDashboard({
286083
286011
  ];
286084
286012
  });
286085
286013
  }, []);
286086
- const toolArgsDeltaRef = import_react78.useRef(new Map);
286087
- const addStreamingToolCall = import_react78.useCallback((toolCallId, toolName) => {
286014
+ const toolArgsDeltaRef = import_react80.useRef(new Map);
286015
+ const addStreamingToolCall = import_react80.useCallback((toolCallId, toolName) => {
286088
286016
  textRef.current = "";
286089
286017
  toolArgsDeltaRef.current.set(toolCallId, {
286090
286018
  toolName,
@@ -286103,7 +286031,7 @@ function OperatorDashboard({
286103
286031
  }
286104
286032
  ]);
286105
286033
  }, []);
286106
- const appendToolCallDelta = import_react78.useCallback((toolCallId, argsTextDelta) => {
286034
+ const appendToolCallDelta = import_react80.useCallback((toolCallId, argsTextDelta) => {
286107
286035
  const entry = toolArgsDeltaRef.current.get(toolCallId);
286108
286036
  const accumulated = (entry?.accumulated ?? "") + argsTextDelta;
286109
286037
  toolArgsDeltaRef.current.set(toolCallId, {
@@ -286125,7 +286053,7 @@ function OperatorDashboard({
286125
286053
  return updated;
286126
286054
  });
286127
286055
  }, []);
286128
- const addToolCall = import_react78.useCallback((toolCallId, toolName, args) => {
286056
+ const addToolCall = import_react80.useCallback((toolCallId, toolName, args) => {
286129
286057
  textRef.current = "";
286130
286058
  toolArgsDeltaRef.current.delete(toolCallId);
286131
286059
  setMessages((prev) => {
@@ -286154,7 +286082,7 @@ function OperatorDashboard({
286154
286082
  ];
286155
286083
  });
286156
286084
  }, []);
286157
- const updateToolResult = import_react78.useCallback((toolCallId, _toolName, result) => {
286085
+ const updateToolResult = import_react80.useCallback((toolCallId, _toolName, result) => {
286158
286086
  textRef.current = "";
286159
286087
  setMessages((prev) => {
286160
286088
  const idx = prev.findIndex((m4) => isToolMessage(m4) && m4.toolCallId === toolCallId);
@@ -286165,10 +286093,10 @@ function OperatorDashboard({
286165
286093
  return updated;
286166
286094
  });
286167
286095
  }, []);
286168
- const cmdOutputBufRef = import_react78.useRef("");
286169
- const cmdFlushTimerRef = import_react78.useRef(null);
286096
+ const cmdOutputBufRef = import_react80.useRef("");
286097
+ const cmdFlushTimerRef = import_react80.useRef(null);
286170
286098
  const MAX_LOG_LINES = 200;
286171
- const flushCommandOutput = import_react78.useCallback(() => {
286099
+ const flushCommandOutput = import_react80.useCallback(() => {
286172
286100
  const buf = cmdOutputBufRef.current;
286173
286101
  if (!buf)
286174
286102
  return;
@@ -286198,7 +286126,7 @@ function OperatorDashboard({
286198
286126
  return updated;
286199
286127
  });
286200
286128
  }, []);
286201
- const onCommandOutput = import_react78.useCallback((data) => {
286129
+ const onCommandOutput = import_react80.useCallback((data) => {
286202
286130
  cmdOutputBufRef.current += data;
286203
286131
  if (!cmdFlushTimerRef.current) {
286204
286132
  cmdFlushTimerRef.current = setInterval(() => {
@@ -286206,7 +286134,7 @@ function OperatorDashboard({
286206
286134
  }, 150);
286207
286135
  }
286208
286136
  }, [flushCommandOutput]);
286209
- import_react78.useEffect(() => {
286137
+ import_react80.useEffect(() => {
286210
286138
  return () => {
286211
286139
  if (cmdFlushTimerRef.current) {
286212
286140
  clearInterval(cmdFlushTimerRef.current);
@@ -286214,7 +286142,7 @@ function OperatorDashboard({
286214
286142
  }
286215
286143
  };
286216
286144
  }, []);
286217
- const appendLogToActiveTool = import_react78.useCallback((line) => {
286145
+ const appendLogToActiveTool = import_react80.useCallback((line) => {
286218
286146
  setMessages((prev) => {
286219
286147
  const idx = prev.findLastIndex((m4) => isToolMessage(m4) && (m4.status === "pending" || m4.status === "streaming"));
286220
286148
  if (idx === -1)
@@ -286229,7 +286157,7 @@ function OperatorDashboard({
286229
286157
  return updated;
286230
286158
  });
286231
286159
  }, []);
286232
- const initSubagent = import_react78.useCallback((subagentId, name26) => {
286160
+ const initSubagent = import_react80.useCallback((subagentId, name26) => {
286233
286161
  setMessages((prev) => {
286234
286162
  const idx = prev.findLastIndex((m4) => isToolMessage(m4) && (m4.status === "pending" || m4.status === "streaming"));
286235
286163
  if (idx === -1)
@@ -286244,7 +286172,7 @@ function OperatorDashboard({
286244
286172
  return updated;
286245
286173
  });
286246
286174
  }, []);
286247
- const completeSubagent = import_react78.useCallback((subagentId, status2) => {
286175
+ const completeSubagent = import_react80.useCallback((subagentId, status2) => {
286248
286176
  setMessages((prev) => {
286249
286177
  const idx = prev.findLastIndex((m4) => isToolMessage(m4) && (m4.status === "pending" || m4.status === "streaming"));
286250
286178
  if (idx === -1)
@@ -286262,7 +286190,7 @@ function OperatorDashboard({
286262
286190
  return updated;
286263
286191
  });
286264
286192
  }, []);
286265
- const appendLogToSubagent = import_react78.useCallback((subagentId, line) => {
286193
+ const appendLogToSubagent = import_react80.useCallback((subagentId, line) => {
286266
286194
  setMessages((prev) => {
286267
286195
  const idx = prev.findLastIndex((m4) => isToolMessage(m4) && (m4.status === "pending" || m4.status === "streaming"));
286268
286196
  if (idx === -1)
@@ -286284,13 +286212,13 @@ function OperatorDashboard({
286284
286212
  return updated;
286285
286213
  });
286286
286214
  }, []);
286287
- const handleApprove = import_react78.useCallback(() => {
286215
+ const handleApprove = import_react80.useCallback(() => {
286288
286216
  const pending = approvalGateRef.current.getPendingApprovals();
286289
286217
  if (pending.length > 0) {
286290
286218
  approvalGateRef.current.approve(pending[0].id);
286291
286219
  }
286292
286220
  }, []);
286293
- const handleAutoApprove = import_react78.useCallback(() => {
286221
+ const handleAutoApprove = import_react80.useCallback(() => {
286294
286222
  approvalGateRef.current.updateConfig({ requireApproval: false });
286295
286223
  setOperatorState((prev) => ({ ...prev, requireApproval: false }));
286296
286224
  const pending = approvalGateRef.current.getPendingApprovals();
@@ -286298,7 +286226,7 @@ function OperatorDashboard({
286298
286226
  approvalGateRef.current.approve(p.id);
286299
286227
  }
286300
286228
  }, []);
286301
- const runAgent = import_react78.useCallback(async (prompt) => {
286229
+ const runAgent = import_react80.useCallback(async (prompt) => {
286302
286230
  if (abortControllerRef.current) {
286303
286231
  abortControllerRef.current.abort();
286304
286232
  abortControllerRef.current = null;
@@ -286512,7 +286440,7 @@ function OperatorDashboard({
286512
286440
  setThinking,
286513
286441
  setIsExecuting
286514
286442
  ]);
286515
- const handleSubmit = import_react78.useCallback((value) => {
286443
+ const handleSubmit = import_react80.useCallback((value) => {
286516
286444
  const pending = approvalGateRef.current.getPendingApprovals();
286517
286445
  const result = resolveSubmit(value, status, pending.length > 0);
286518
286446
  if (result.denyPending) {
@@ -286530,16 +286458,16 @@ function OperatorDashboard({
286530
286458
  setInputValue("");
286531
286459
  runAgent(result.prompt);
286532
286460
  }, [status, runAgent]);
286533
- const initialMessageSentRef = import_react78.useRef(false);
286534
- const runAgentRef = import_react78.useRef(runAgent);
286461
+ const initialMessageSentRef = import_react80.useRef(false);
286462
+ const runAgentRef = import_react80.useRef(runAgent);
286535
286463
  runAgentRef.current = runAgent;
286536
- import_react78.useEffect(() => {
286464
+ import_react80.useEffect(() => {
286537
286465
  if (!loading && initialMessage && !initialMessageSentRef.current) {
286538
286466
  initialMessageSentRef.current = true;
286539
286467
  runAgentRef.current(initialMessage);
286540
286468
  }
286541
286469
  }, [loading, initialMessage]);
286542
- import_react78.useEffect(() => {
286470
+ import_react80.useEffect(() => {
286543
286471
  if (status !== "idle")
286544
286472
  return;
286545
286473
  const queue = queuedMessagesRef.current;
@@ -286550,7 +286478,7 @@ function OperatorDashboard({
286550
286478
  setSelectedQueueIndex(-1);
286551
286479
  runAgentRef.current(next);
286552
286480
  }, [status]);
286553
- const showModelPicker = import_react78.useCallback(() => {
286481
+ const showModelPicker = import_react80.useCallback(() => {
286554
286482
  setDialogSize("large");
286555
286483
  showDialog(/* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("box", {
286556
286484
  flexDirection: "column",
@@ -286612,7 +286540,7 @@ function OperatorDashboard({
286612
286540
  clearDialog,
286613
286541
  setDialogSize
286614
286542
  ]);
286615
- const handleCommandExecute = import_react78.useCallback(async (command) => {
286543
+ const handleCommandExecute = import_react80.useCallback(async (command) => {
286616
286544
  const action = routeCommand(command, resolveSkillContent);
286617
286545
  switch (action.type) {
286618
286546
  case "show-models":
@@ -286630,7 +286558,7 @@ function OperatorDashboard({
286630
286558
  return;
286631
286559
  }
286632
286560
  }, [resolveSkillContent, handleSubmit, executeCommand2, showModelPicker]);
286633
- const handleAbort = import_react78.useCallback(() => {
286561
+ const handleAbort = import_react80.useCallback(() => {
286634
286562
  if (!abortControllerRef.current)
286635
286563
  return;
286636
286564
  const action = resolveAbortAction(commandCancelledRef.current, () => cancelHandleRef.current.cancel());
@@ -286680,7 +286608,7 @@ function OperatorDashboard({
286680
286608
  ];
286681
286609
  });
286682
286610
  }, [session, setThinking, setIsExecuting]);
286683
- const toggleApproval = import_react78.useCallback(() => {
286611
+ const toggleApproval = import_react80.useCallback(() => {
286684
286612
  setOperatorState((prev) => {
286685
286613
  const newVal = !prev.requireApproval;
286686
286614
  approvalGateRef.current.updateConfig({ requireApproval: newVal });
@@ -286914,10 +286842,10 @@ function OperatorDashboard({
286914
286842
  }
286915
286843
 
286916
286844
  // src/tui/components/commands/theme-picker.tsx
286917
- var import_react80 = __toESM(require_react(), 1);
286845
+ var import_react82 = __toESM(require_react(), 1);
286918
286846
  init_config2();
286919
286847
  function ThemePicker({ onClose }) {
286920
- const dimensions = useDimensions();
286848
+ const dimensions = useTerminalDimensions();
286921
286849
  const {
286922
286850
  colors: colors2,
286923
286851
  theme,
@@ -286927,15 +286855,15 @@ function ThemePicker({ onClose }) {
286927
286855
  toggleMode,
286928
286856
  setMode
286929
286857
  } = useTheme();
286930
- const [selectedIndex, setSelectedIndex] = import_react80.useState(() => Math.max(0, availableThemes.indexOf(theme.name)));
286931
- const originalThemeRef = import_react80.useRef(theme.name);
286932
- const originalModeRef = import_react80.useRef(mode);
286933
- const handleClose = import_react80.useCallback(() => {
286858
+ const [selectedIndex, setSelectedIndex] = import_react82.useState(() => Math.max(0, availableThemes.indexOf(theme.name)));
286859
+ const originalThemeRef = import_react82.useRef(theme.name);
286860
+ const originalModeRef = import_react82.useRef(mode);
286861
+ const handleClose = import_react82.useCallback(() => {
286934
286862
  setTheme(originalThemeRef.current);
286935
286863
  setMode(originalModeRef.current);
286936
286864
  onClose();
286937
286865
  }, [setTheme, setMode, onClose]);
286938
- const handleConfirm = import_react80.useCallback(async () => {
286866
+ const handleConfirm = import_react82.useCallback(async () => {
286939
286867
  const currentThemeName = availableThemes[selectedIndex];
286940
286868
  if (currentThemeName) {
286941
286869
  await config2.update({ theme: currentThemeName });
@@ -287064,16 +286992,16 @@ function ThemePicker({ onClose }) {
287064
286992
  }
287065
286993
 
287066
286994
  // src/tui/components/commands/create-skill-wizard.tsx
287067
- var import_react82 = __toESM(require_react(), 1);
286995
+ var import_react84 = __toESM(require_react(), 1);
287068
286996
  function CreateSkillWizard() {
287069
286997
  const { colors: colors2 } = useTheme();
287070
286998
  const route = useRoute();
287071
- const [step, setStep] = import_react82.useState("name");
287072
- const [name26, setName] = import_react82.useState("");
287073
- const [description, setDescription] = import_react82.useState("");
287074
- const [content, setContent] = import_react82.useState("");
287075
- const [error40, setError] = import_react82.useState(null);
287076
- const [confirmFocused, setConfirmFocused] = import_react82.useState(0);
286999
+ const [step, setStep] = import_react84.useState("name");
287000
+ const [name26, setName] = import_react84.useState("");
287001
+ const [description, setDescription] = import_react84.useState("");
287002
+ const [content, setContent] = import_react84.useState("");
287003
+ const [error40, setError] = import_react84.useState(null);
287004
+ const [confirmFocused, setConfirmFocused] = import_react84.useState(0);
287077
287005
  const slug = slugify(name26);
287078
287006
  async function handleSave() {
287079
287007
  if (!name26.trim() || !content.trim())
@@ -289949,7 +289877,7 @@ async function detectTerminalMode(timeoutMs = 1000) {
289949
289877
  }
289950
289878
 
289951
289879
  // src/tui/console-theme.ts
289952
- var import_react84 = __toESM(require_react(), 1);
289880
+ var import_react86 = __toESM(require_react(), 1);
289953
289881
  var withAlpha = (rgba, a) => RGBA.fromValues(rgba.r, rgba.g, rgba.b, a);
289954
289882
  var overlayThemeRef = {
289955
289883
  current: null
@@ -289972,7 +289900,7 @@ function buildConsoleOptions(themeColors) {
289972
289900
  function ConsoleThemeSync() {
289973
289901
  const { colors: colors2 } = useTheme();
289974
289902
  const renderer = useRenderer();
289975
- import_react84.useEffect(() => {
289903
+ import_react86.useEffect(() => {
289976
289904
  overlayThemeRef.current = colors2;
289977
289905
  const c = renderer.console;
289978
289906
  c.backgroundColor = withAlpha(colors2.backgroundPanel, 0.85);
@@ -290060,17 +289988,17 @@ function setupAutoCopy(renderer, copyToClipboard) {
290060
289988
 
290061
289989
  // src/tui/index.tsx
290062
289990
  function App({ appConfig }) {
290063
- const [focusIndex, setFocusIndex] = import_react87.useState(0);
290064
- const [cwd, setCwd] = import_react87.useState(process.cwd());
290065
- const [ctrlCPressTime, setCtrlCPressTime] = import_react87.useState(null);
290066
- const [showExitWarning, setShowExitWarning] = import_react87.useState(false);
290067
- const [inputKey, setInputKey] = import_react87.useState(0);
290068
- const [showSessionsDialog, setShowSessionsDialog] = import_react87.useState(false);
290069
- const [showShortcutsDialog, setShowShortcutsDialog] = import_react87.useState(false);
290070
- const [showThemeDialog, setShowThemeDialog] = import_react87.useState(false);
290071
- const [showAuthDialog, setShowAuthDialog] = import_react87.useState(false);
290072
- const [showPentestDialog, setShowPentestDialog] = import_react87.useState(false);
290073
- const [pendingPentestFlags, setPendingPentestFlags] = import_react87.useState(undefined);
289991
+ const [focusIndex, setFocusIndex] = import_react89.useState(0);
289992
+ const [cwd, setCwd] = import_react89.useState(process.cwd());
289993
+ const [ctrlCPressTime, setCtrlCPressTime] = import_react89.useState(null);
289994
+ const [showExitWarning, setShowExitWarning] = import_react89.useState(false);
289995
+ const [inputKey, setInputKey] = import_react89.useState(0);
289996
+ const [showSessionsDialog, setShowSessionsDialog] = import_react89.useState(false);
289997
+ const [showShortcutsDialog, setShowShortcutsDialog] = import_react89.useState(false);
289998
+ const [showThemeDialog, setShowThemeDialog] = import_react89.useState(false);
289999
+ const [showAuthDialog, setShowAuthDialog] = import_react89.useState(false);
290000
+ const [showPentestDialog, setShowPentestDialog] = import_react89.useState(false);
290001
+ const [pendingPentestFlags, setPendingPentestFlags] = import_react89.useState(undefined);
290074
290002
  const navigableItems = ["command-input"];
290075
290003
  return /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV(ConfigProvider, {
290076
290004
  config: appConfig,
@@ -290157,14 +290085,14 @@ function AppContent({
290157
290085
  const { toast } = useToast();
290158
290086
  const { refocusPrompt } = useFocus();
290159
290087
  const { setExternalDialogOpen } = useDialog();
290160
- import_react87.useEffect(() => {
290088
+ import_react89.useEffect(() => {
290161
290089
  checkForUpdate().then(({ updateAvailable, currentVersion, latestVersion }) => {
290162
290090
  if (!updateAvailable)
290163
290091
  return;
290164
290092
  toast(`Update available: v${currentVersion} → v${latestVersion}. Run: pensar upgrade`, "warn", 8000);
290165
290093
  });
290166
290094
  }, []);
290167
- import_react87.useEffect(() => {
290095
+ import_react89.useEffect(() => {
290168
290096
  if (route.data.type !== "base")
290169
290097
  return;
290170
290098
  if (!config3.data.responsibleUseAccepted && route.data.path !== "disclosure") {
@@ -290173,12 +290101,12 @@ function AppContent({
290173
290101
  route.navigate({ type: "base", path: "providers" });
290174
290102
  }
290175
290103
  }, [config3.data.responsibleUseAccepted, route.data]);
290176
- import_react87.useEffect(() => {
290104
+ import_react89.useEffect(() => {
290177
290105
  if (showThemeDialog || showAuthDialog || showPentestDialog) {
290178
290106
  setExternalDialogOpen(true);
290179
290107
  }
290180
290108
  }, [showThemeDialog, showAuthDialog, showPentestDialog]);
290181
- import_react87.useEffect(() => {
290109
+ import_react89.useEffect(() => {
290182
290110
  if (showExitWarning) {
290183
290111
  const timer = setTimeout(() => {
290184
290112
  setShowExitWarning(false);
@@ -290432,18 +290360,16 @@ async function main2() {
290432
290360
  initialMode: mode,
290433
290361
  children: [
290434
290362
  /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV(ConsoleThemeSync, {}, undefined, false, undefined, this),
290435
- /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV(TerminalDimensionsProvider, {
290436
- children: /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV(ToastProvider, {
290437
- children: [
290438
- /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV(ErrorBoundary2, {
290439
- children: /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV(App, {
290440
- appConfig
290441
- }, undefined, false, undefined, this)
290442
- }, undefined, false, undefined, this),
290443
- /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV(ToastContainer, {}, undefined, false, undefined, this)
290444
- ]
290445
- }, undefined, true, undefined, this)
290446
- }, undefined, false, undefined, this)
290363
+ /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV(ToastProvider, {
290364
+ children: [
290365
+ /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV(ErrorBoundary2, {
290366
+ children: /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV(App, {
290367
+ appConfig
290368
+ }, undefined, false, undefined, this)
290369
+ }, undefined, false, undefined, this),
290370
+ /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV(ToastContainer, {}, undefined, false, undefined, this)
290371
+ ]
290372
+ }, undefined, true, undefined, this)
290447
290373
  ]
290448
290374
  }, undefined, true, undefined, this));
290449
290375
  }