@pensar/apex 0.0.54 → 0.0.55-canary.349def2d
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/index.js +336 -64
- package/package.json +1 -1
package/build/index.js
CHANGED
|
@@ -69284,7 +69284,7 @@ function createRoot(renderer) {
|
|
|
69284
69284
|
}
|
|
69285
69285
|
|
|
69286
69286
|
// src/tui/index.tsx
|
|
69287
|
-
var
|
|
69287
|
+
var import_react86 = __toESM(require_react(), 1);
|
|
69288
69288
|
|
|
69289
69289
|
// src/tui/components/footer.tsx
|
|
69290
69290
|
import os5 from "os";
|
|
@@ -70407,6 +70407,7 @@ init_zod();
|
|
|
70407
70407
|
import os3 from "os";
|
|
70408
70408
|
import path3 from "path";
|
|
70409
70409
|
import fs3 from "fs/promises";
|
|
70410
|
+
import { readdir } from "fs/promises";
|
|
70410
70411
|
|
|
70411
70412
|
// src/util/errors.ts
|
|
70412
70413
|
init_zod();
|
|
@@ -70532,7 +70533,6 @@ var Lock;
|
|
|
70532
70533
|
})(Lock ||= {});
|
|
70533
70534
|
|
|
70534
70535
|
// src/core/storage/index.ts
|
|
70535
|
-
import { mkdir } from "fs/promises";
|
|
70536
70536
|
var Storage;
|
|
70537
70537
|
((Storage) => {
|
|
70538
70538
|
Storage.NotFoundError = NamedError.create("NotFoundError", zod_default.object({
|
|
@@ -70559,7 +70559,8 @@ var Storage;
|
|
|
70559
70559
|
let __stack = [];
|
|
70560
70560
|
try {
|
|
70561
70561
|
const _ = __using(__stack, await Lock.write(target), 0);
|
|
70562
|
-
await
|
|
70562
|
+
await fs3.mkdir(path3.dirname(target), { recursive: true });
|
|
70563
|
+
await fs3.writeFile(target, JSON.stringify(content, null, 2), "utf-8");
|
|
70563
70564
|
} catch (_catch) {
|
|
70564
70565
|
var _err = _catch, _hasErr = 1;
|
|
70565
70566
|
} finally {
|
|
@@ -70575,7 +70576,7 @@ var Storage;
|
|
|
70575
70576
|
let __stack = [];
|
|
70576
70577
|
try {
|
|
70577
70578
|
const _ = __using(__stack, await Lock.write(target), 0);
|
|
70578
|
-
await mkdir(target, { recursive: true });
|
|
70579
|
+
await fs3.mkdir(target, { recursive: true });
|
|
70579
70580
|
} catch (_catch) {
|
|
70580
70581
|
var _err = _catch, _hasErr = 1;
|
|
70581
70582
|
} finally {
|
|
@@ -70592,8 +70593,8 @@ var Storage;
|
|
|
70592
70593
|
try {
|
|
70593
70594
|
const _ = __using(__stack, await Lock.write(target), 0);
|
|
70594
70595
|
const parentDir = path3.dirname(target);
|
|
70595
|
-
await mkdir(parentDir, { recursive: true });
|
|
70596
|
-
await
|
|
70596
|
+
await fs3.mkdir(parentDir, { recursive: true });
|
|
70597
|
+
await fs3.writeFile(target, content, "utf-8");
|
|
70597
70598
|
} catch (_catch) {
|
|
70598
70599
|
var _err = _catch, _hasErr = 1;
|
|
70599
70600
|
} finally {
|
|
@@ -70610,7 +70611,7 @@ var Storage;
|
|
|
70610
70611
|
try {
|
|
70611
70612
|
const _ = __using(__stack, await Lock.write(target), 0);
|
|
70612
70613
|
const parentDir = path3.dirname(target);
|
|
70613
|
-
await mkdir(parentDir, { recursive: true });
|
|
70614
|
+
await fs3.mkdir(parentDir, { recursive: true });
|
|
70614
70615
|
await fs3.appendFile(target, content);
|
|
70615
70616
|
} catch (_catch) {
|
|
70616
70617
|
var _err = _catch, _hasErr = 1;
|
|
@@ -70627,7 +70628,8 @@ var Storage;
|
|
|
70627
70628
|
let __stack = [];
|
|
70628
70629
|
try {
|
|
70629
70630
|
const _ = __using(__stack, await Lock.read(target), 0);
|
|
70630
|
-
const
|
|
70631
|
+
const text = await fs3.readFile(target, "utf-8");
|
|
70632
|
+
const result = ext ? text : JSON.parse(text);
|
|
70631
70633
|
return result;
|
|
70632
70634
|
} catch (_catch) {
|
|
70633
70635
|
var _err = _catch, _hasErr = 1;
|
|
@@ -70644,9 +70646,10 @@ var Storage;
|
|
|
70644
70646
|
let __stack = [];
|
|
70645
70647
|
try {
|
|
70646
70648
|
const _ = __using(__stack, await Lock.write(target), 0);
|
|
70647
|
-
const
|
|
70649
|
+
const text = await fs3.readFile(target, "utf-8");
|
|
70650
|
+
const content = ext ? text : JSON.parse(text);
|
|
70648
70651
|
fn(content);
|
|
70649
|
-
await
|
|
70652
|
+
await fs3.writeFile(target, JSON.stringify(content, null, 2), "utf-8");
|
|
70650
70653
|
return content;
|
|
70651
70654
|
} catch (_catch) {
|
|
70652
70655
|
var _err = _catch, _hasErr = 1;
|
|
@@ -70667,14 +70670,28 @@ var Storage;
|
|
|
70667
70670
|
throw e;
|
|
70668
70671
|
});
|
|
70669
70672
|
}
|
|
70670
|
-
|
|
70673
|
+
async function listFilesRecursively(dir) {
|
|
70674
|
+
const entries = await readdir(dir, { withFileTypes: true });
|
|
70675
|
+
const files = [];
|
|
70676
|
+
for (const entry of entries) {
|
|
70677
|
+
const fullPath = path3.join(dir, entry.name);
|
|
70678
|
+
if (entry.isDirectory()) {
|
|
70679
|
+
files.push(...await listFilesRecursively(fullPath));
|
|
70680
|
+
} else {
|
|
70681
|
+
files.push(fullPath);
|
|
70682
|
+
}
|
|
70683
|
+
}
|
|
70684
|
+
return files;
|
|
70685
|
+
}
|
|
70671
70686
|
async function list(prefix) {
|
|
70672
70687
|
const dir = path3.join(os3.homedir(), ".pensar");
|
|
70688
|
+
const targetDir = path3.join(dir, ...prefix);
|
|
70673
70689
|
try {
|
|
70674
|
-
const
|
|
70675
|
-
|
|
70676
|
-
|
|
70677
|
-
|
|
70690
|
+
const files = await listFilesRecursively(targetDir);
|
|
70691
|
+
const result = files.map((filePath) => {
|
|
70692
|
+
const relativePath = path3.relative(targetDir, filePath);
|
|
70693
|
+
return [...prefix, ...relativePath.slice(0, -5).split(path3.sep)];
|
|
70694
|
+
});
|
|
70678
70695
|
result.sort();
|
|
70679
70696
|
return result;
|
|
70680
70697
|
} catch {
|
|
@@ -71907,7 +71924,7 @@ var commands = [
|
|
|
71907
71924
|
handler: async (args, ctx3) => {
|
|
71908
71925
|
ctx3.navigate({
|
|
71909
71926
|
type: "base",
|
|
71910
|
-
path: "
|
|
71927
|
+
path: "home"
|
|
71911
71928
|
});
|
|
71912
71929
|
}
|
|
71913
71930
|
},
|
|
@@ -152671,17 +152688,268 @@ function WebWizard({
|
|
|
152671
152688
|
}, undefined, true, undefined, this);
|
|
152672
152689
|
}
|
|
152673
152690
|
|
|
152691
|
+
// src/tui/components/commands/resume-wizard.tsx
|
|
152692
|
+
var import_react68 = __toESM(require_react(), 1);
|
|
152693
|
+
import { existsSync as existsSync26, readdirSync as readdirSync7 } from "fs";
|
|
152694
|
+
import { join as join19 } from "path";
|
|
152695
|
+
var greenAccent5 = RGBA.fromInts(76, 175, 80, 255);
|
|
152696
|
+
var creamText12 = RGBA.fromInts(255, 248, 220, 255);
|
|
152697
|
+
var dimText13 = RGBA.fromInts(120, 120, 120, 255);
|
|
152698
|
+
function formatRelativeTime(timestamp) {
|
|
152699
|
+
const now2 = Date.now();
|
|
152700
|
+
const diff = now2 - timestamp;
|
|
152701
|
+
const minutes = Math.floor(diff / 60000);
|
|
152702
|
+
const hours = Math.floor(diff / 3600000);
|
|
152703
|
+
const days = Math.floor(diff / 86400000);
|
|
152704
|
+
if (minutes < 1)
|
|
152705
|
+
return "just now";
|
|
152706
|
+
if (minutes < 60)
|
|
152707
|
+
return `${minutes}m ago`;
|
|
152708
|
+
if (hours < 24)
|
|
152709
|
+
return `${hours}h ago`;
|
|
152710
|
+
if (days === 1)
|
|
152711
|
+
return "yesterday";
|
|
152712
|
+
if (days < 7)
|
|
152713
|
+
return `${days}d ago`;
|
|
152714
|
+
return new Date(timestamp).toLocaleDateString();
|
|
152715
|
+
}
|
|
152716
|
+
function countFindings(findingsPath) {
|
|
152717
|
+
try {
|
|
152718
|
+
if (!existsSync26(findingsPath))
|
|
152719
|
+
return 0;
|
|
152720
|
+
return readdirSync7(findingsPath).filter((f) => f.endsWith(".json")).length;
|
|
152721
|
+
} catch {
|
|
152722
|
+
return 0;
|
|
152723
|
+
}
|
|
152724
|
+
}
|
|
152725
|
+
function ResumeWizard() {
|
|
152726
|
+
const [sessions, setSessions] = import_react68.useState([]);
|
|
152727
|
+
const [selectedIndex, setSelectedIndex] = import_react68.useState(0);
|
|
152728
|
+
const [loading, setLoading] = import_react68.useState(true);
|
|
152729
|
+
const [statusMessage, setStatusMessage] = import_react68.useState("");
|
|
152730
|
+
const route = useRoute();
|
|
152731
|
+
const { load: loadSession } = useSession();
|
|
152732
|
+
const { refocusPrompt } = useFocus();
|
|
152733
|
+
import_react68.useEffect(() => {
|
|
152734
|
+
async function loadOperatorSessions() {
|
|
152735
|
+
setLoading(true);
|
|
152736
|
+
try {
|
|
152737
|
+
const enrichedSessions = [];
|
|
152738
|
+
for await (const session of Session.list()) {
|
|
152739
|
+
const statePath = join19(session.rootPath, "operator-state.json");
|
|
152740
|
+
const hasOperatorState = existsSync26(statePath);
|
|
152741
|
+
const findingsCount = countFindings(session.findingsPath);
|
|
152742
|
+
enrichedSessions.push({
|
|
152743
|
+
...session,
|
|
152744
|
+
findingsCount,
|
|
152745
|
+
hasOperatorState
|
|
152746
|
+
});
|
|
152747
|
+
}
|
|
152748
|
+
enrichedSessions.sort((a, b2) => b2.time.updated - a.time.updated);
|
|
152749
|
+
setSessions(enrichedSessions.slice(0, 20));
|
|
152750
|
+
} catch (error41) {
|
|
152751
|
+
console.error("Error loading sessions:", error41);
|
|
152752
|
+
setStatusMessage("Error loading sessions");
|
|
152753
|
+
} finally {
|
|
152754
|
+
setLoading(false);
|
|
152755
|
+
}
|
|
152756
|
+
}
|
|
152757
|
+
loadOperatorSessions();
|
|
152758
|
+
}, []);
|
|
152759
|
+
const resumeSession = async (session) => {
|
|
152760
|
+
try {
|
|
152761
|
+
const loaded = await loadSession(session.id);
|
|
152762
|
+
if (!loaded) {
|
|
152763
|
+
setStatusMessage("Error loading session");
|
|
152764
|
+
setTimeout(() => setStatusMessage(""), 2000);
|
|
152765
|
+
return;
|
|
152766
|
+
}
|
|
152767
|
+
route.navigate({
|
|
152768
|
+
type: "session",
|
|
152769
|
+
sessionId: session.id,
|
|
152770
|
+
isResume: true
|
|
152771
|
+
});
|
|
152772
|
+
} catch (error41) {
|
|
152773
|
+
console.error("Error resuming session:", error41);
|
|
152774
|
+
setStatusMessage("Error resuming session");
|
|
152775
|
+
setTimeout(() => setStatusMessage(""), 2000);
|
|
152776
|
+
}
|
|
152777
|
+
};
|
|
152778
|
+
useKeyboard((key) => {
|
|
152779
|
+
if (key.name === "escape") {
|
|
152780
|
+
refocusPrompt();
|
|
152781
|
+
route.navigate({ type: "base", path: "home" });
|
|
152782
|
+
return;
|
|
152783
|
+
}
|
|
152784
|
+
if (key.name === "up" && sessions.length > 0) {
|
|
152785
|
+
setSelectedIndex((i) => i > 0 ? i - 1 : sessions.length - 1);
|
|
152786
|
+
return;
|
|
152787
|
+
}
|
|
152788
|
+
if (key.name === "down" && sessions.length > 0) {
|
|
152789
|
+
setSelectedIndex((i) => i < sessions.length - 1 ? i + 1 : 0);
|
|
152790
|
+
return;
|
|
152791
|
+
}
|
|
152792
|
+
if (key.name === "return" && sessions.length > 0) {
|
|
152793
|
+
const selected = sessions[selectedIndex];
|
|
152794
|
+
if (selected) {
|
|
152795
|
+
resumeSession(selected);
|
|
152796
|
+
}
|
|
152797
|
+
return;
|
|
152798
|
+
}
|
|
152799
|
+
});
|
|
152800
|
+
if (loading) {
|
|
152801
|
+
return /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("box", {
|
|
152802
|
+
flexDirection: "column",
|
|
152803
|
+
padding: 2,
|
|
152804
|
+
width: "100%",
|
|
152805
|
+
children: /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("text", {
|
|
152806
|
+
fg: creamText12,
|
|
152807
|
+
children: "Loading sessions..."
|
|
152808
|
+
}, undefined, false, undefined, this)
|
|
152809
|
+
}, undefined, false, undefined, this);
|
|
152810
|
+
}
|
|
152811
|
+
if (sessions.length === 0) {
|
|
152812
|
+
return /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("box", {
|
|
152813
|
+
flexDirection: "column",
|
|
152814
|
+
padding: 2,
|
|
152815
|
+
gap: 1,
|
|
152816
|
+
width: "100%",
|
|
152817
|
+
children: [
|
|
152818
|
+
/* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("text", {
|
|
152819
|
+
fg: creamText12,
|
|
152820
|
+
children: "Resume Pentest Session"
|
|
152821
|
+
}, undefined, false, undefined, this),
|
|
152822
|
+
/* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("text", {
|
|
152823
|
+
fg: dimText13,
|
|
152824
|
+
children: "No sessions found to resume."
|
|
152825
|
+
}, undefined, false, undefined, this),
|
|
152826
|
+
/* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("text", {
|
|
152827
|
+
fg: dimText13,
|
|
152828
|
+
children: "Start a new session with /web or /operator"
|
|
152829
|
+
}, undefined, false, undefined, this),
|
|
152830
|
+
/* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("text", {
|
|
152831
|
+
fg: dimText13,
|
|
152832
|
+
children: "Press Esc to go back"
|
|
152833
|
+
}, undefined, false, undefined, this)
|
|
152834
|
+
]
|
|
152835
|
+
}, undefined, true, undefined, this);
|
|
152836
|
+
}
|
|
152837
|
+
return /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("box", {
|
|
152838
|
+
flexDirection: "column",
|
|
152839
|
+
padding: 2,
|
|
152840
|
+
gap: 1,
|
|
152841
|
+
width: "100%",
|
|
152842
|
+
children: [
|
|
152843
|
+
/* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("text", {
|
|
152844
|
+
fg: creamText12,
|
|
152845
|
+
children: "Resume Pentest Session"
|
|
152846
|
+
}, undefined, false, undefined, this),
|
|
152847
|
+
/* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("text", {
|
|
152848
|
+
fg: dimText13,
|
|
152849
|
+
children: "Select a session to continue where you left off"
|
|
152850
|
+
}, undefined, false, undefined, this),
|
|
152851
|
+
/* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("box", {
|
|
152852
|
+
flexDirection: "column",
|
|
152853
|
+
marginTop: 1,
|
|
152854
|
+
children: sessions.map((session, index) => {
|
|
152855
|
+
const isSelected = index === selectedIndex;
|
|
152856
|
+
const age = formatRelativeTime(session.time.updated);
|
|
152857
|
+
const target = session.targets[0] || "No target";
|
|
152858
|
+
const findingsText = session.findingsCount > 0 ? `${session.findingsCount} finding${session.findingsCount > 1 ? "s" : ""}` : "No findings";
|
|
152859
|
+
return /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("box", {
|
|
152860
|
+
flexDirection: "row",
|
|
152861
|
+
justifyContent: "space-between",
|
|
152862
|
+
width: "100%",
|
|
152863
|
+
border: isSelected ? ["left"] : undefined,
|
|
152864
|
+
borderColor: isSelected ? greenAccent5 : undefined,
|
|
152865
|
+
paddingLeft: isSelected ? 1 : 2,
|
|
152866
|
+
children: [
|
|
152867
|
+
/* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("box", {
|
|
152868
|
+
flexDirection: "row",
|
|
152869
|
+
gap: 1,
|
|
152870
|
+
children: [
|
|
152871
|
+
/* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("text", {
|
|
152872
|
+
fg: isSelected ? greenAccent5 : creamText12,
|
|
152873
|
+
children: [
|
|
152874
|
+
isSelected ? "▸ " : " ",
|
|
152875
|
+
session.name
|
|
152876
|
+
]
|
|
152877
|
+
}, undefined, true, undefined, this),
|
|
152878
|
+
session.hasOperatorState && /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("text", {
|
|
152879
|
+
fg: greenAccent5,
|
|
152880
|
+
children: "●"
|
|
152881
|
+
}, undefined, false, undefined, this)
|
|
152882
|
+
]
|
|
152883
|
+
}, undefined, true, undefined, this),
|
|
152884
|
+
/* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("text", {
|
|
152885
|
+
fg: dimText13,
|
|
152886
|
+
children: [
|
|
152887
|
+
target,
|
|
152888
|
+
" · ",
|
|
152889
|
+
findingsText,
|
|
152890
|
+
" · ",
|
|
152891
|
+
age
|
|
152892
|
+
]
|
|
152893
|
+
}, undefined, true, undefined, this)
|
|
152894
|
+
]
|
|
152895
|
+
}, session.id, true, undefined, this);
|
|
152896
|
+
})
|
|
152897
|
+
}, undefined, false, undefined, this),
|
|
152898
|
+
/* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("box", {
|
|
152899
|
+
marginTop: 2,
|
|
152900
|
+
flexDirection: "column",
|
|
152901
|
+
children: [
|
|
152902
|
+
/* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("text", {
|
|
152903
|
+
fg: dimText13,
|
|
152904
|
+
children: [
|
|
152905
|
+
/* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("span", {
|
|
152906
|
+
fg: greenAccent5,
|
|
152907
|
+
children: "↑↓"
|
|
152908
|
+
}, undefined, false, undefined, this),
|
|
152909
|
+
" Navigate ",
|
|
152910
|
+
/* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("span", {
|
|
152911
|
+
fg: greenAccent5,
|
|
152912
|
+
children: "Enter"
|
|
152913
|
+
}, undefined, false, undefined, this),
|
|
152914
|
+
" Resume ",
|
|
152915
|
+
/* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("span", {
|
|
152916
|
+
fg: greenAccent5,
|
|
152917
|
+
children: "Esc"
|
|
152918
|
+
}, undefined, false, undefined, this),
|
|
152919
|
+
" Cancel"
|
|
152920
|
+
]
|
|
152921
|
+
}, undefined, true, undefined, this),
|
|
152922
|
+
/* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("text", {
|
|
152923
|
+
fg: dimText13,
|
|
152924
|
+
children: [
|
|
152925
|
+
/* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("span", {
|
|
152926
|
+
fg: greenAccent5,
|
|
152927
|
+
children: "●"
|
|
152928
|
+
}, undefined, false, undefined, this),
|
|
152929
|
+
" = Has saved state (full context restore)"
|
|
152930
|
+
]
|
|
152931
|
+
}, undefined, true, undefined, this)
|
|
152932
|
+
]
|
|
152933
|
+
}, undefined, true, undefined, this),
|
|
152934
|
+
statusMessage && /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("text", {
|
|
152935
|
+
fg: greenAccent5,
|
|
152936
|
+
children: statusMessage
|
|
152937
|
+
}, undefined, false, undefined, this)
|
|
152938
|
+
]
|
|
152939
|
+
}, undefined, true, undefined, this);
|
|
152940
|
+
}
|
|
152941
|
+
|
|
152674
152942
|
// src/tui/components/commands/provider-manager.tsx
|
|
152675
|
-
var
|
|
152943
|
+
var import_react74 = __toESM(require_react(), 1);
|
|
152676
152944
|
// src/tui/components/commands/provider-selection.tsx
|
|
152677
|
-
var
|
|
152945
|
+
var import_react71 = __toESM(require_react(), 1);
|
|
152678
152946
|
function ProviderSelection({
|
|
152679
152947
|
onProviderSelected,
|
|
152680
152948
|
onClose
|
|
152681
152949
|
}) {
|
|
152682
152950
|
const route = useRoute();
|
|
152683
152951
|
const _config = useConfig();
|
|
152684
|
-
const [highlightedIndex, setHighlightedIndex] =
|
|
152952
|
+
const [highlightedIndex, setHighlightedIndex] = import_react71.useState(0);
|
|
152685
152953
|
const configuredProviders = getConfiguredProviders(_config.data);
|
|
152686
152954
|
useKeyboard((key) => {
|
|
152687
152955
|
if (key.name === "escape") {
|
|
@@ -152834,14 +153102,14 @@ function ProviderSelection({
|
|
|
152834
153102
|
}
|
|
152835
153103
|
|
|
152836
153104
|
// src/tui/components/commands/api-key-input.tsx
|
|
152837
|
-
var
|
|
153105
|
+
var import_react73 = __toESM(require_react(), 1);
|
|
152838
153106
|
function APIKeyInput({
|
|
152839
153107
|
provider,
|
|
152840
153108
|
providerName,
|
|
152841
153109
|
onSubmit,
|
|
152842
153110
|
onCancel
|
|
152843
153111
|
}) {
|
|
152844
|
-
const [apiKey, setApiKey] =
|
|
153112
|
+
const [apiKey, setApiKey] = import_react73.useState("");
|
|
152845
153113
|
useKeyboard((key) => {
|
|
152846
153114
|
if (key.name === "escape") {
|
|
152847
153115
|
onCancel();
|
|
@@ -152953,8 +153221,8 @@ function APIKeyInput({
|
|
|
152953
153221
|
function ProviderManager() {
|
|
152954
153222
|
const route = useRoute();
|
|
152955
153223
|
const _config = useConfig();
|
|
152956
|
-
const [flowState, setFlowState] =
|
|
152957
|
-
const [selectedProvider, setSelectedProvider] =
|
|
153224
|
+
const [flowState, setFlowState] = import_react74.useState("selecting");
|
|
153225
|
+
const [selectedProvider, setSelectedProvider] = import_react74.useState(null);
|
|
152958
153226
|
const handleProviderSelected = (providerId) => {
|
|
152959
153227
|
setSelectedProvider(providerId);
|
|
152960
153228
|
setFlowState("inputting");
|
|
@@ -153012,7 +153280,7 @@ function ProviderManager() {
|
|
|
153012
153280
|
}
|
|
153013
153281
|
|
|
153014
153282
|
// src/tui/components/switch.tsx
|
|
153015
|
-
var
|
|
153283
|
+
var import_react75 = __toESM(require_react(), 1);
|
|
153016
153284
|
var CaseSymbol = Symbol("Switch.Case");
|
|
153017
153285
|
var DefaultSymbol = Symbol("Switch.Default");
|
|
153018
153286
|
function CaseComponent({ children }) {
|
|
@@ -153033,8 +153301,8 @@ function SwitchComponent({
|
|
|
153033
153301
|
}) {
|
|
153034
153302
|
let matchedChild = null;
|
|
153035
153303
|
let defaultChild = null;
|
|
153036
|
-
|
|
153037
|
-
if (
|
|
153304
|
+
import_react75.default.Children.forEach(children, (child) => {
|
|
153305
|
+
if (import_react75.default.isValidElement(child)) {
|
|
153038
153306
|
if (child.type[CaseSymbol]) {
|
|
153039
153307
|
const caseChild = child;
|
|
153040
153308
|
if (caseChild.props.when === condition) {
|
|
@@ -153246,22 +153514,22 @@ function ShortcutsDialog({ open, onClose }) {
|
|
|
153246
153514
|
}
|
|
153247
153515
|
|
|
153248
153516
|
// src/tui/components/commands/help-dialog.tsx
|
|
153249
|
-
var
|
|
153517
|
+
var import_react78 = __toESM(require_react(), 1);
|
|
153250
153518
|
var bgOverlay2 = RGBA.fromInts(0, 0, 0, 200);
|
|
153251
153519
|
var bgPanel2 = RGBA.fromInts(20, 20, 20, 255);
|
|
153252
153520
|
var borderColor3 = RGBA.fromInts(60, 60, 60, 255);
|
|
153253
|
-
var
|
|
153254
|
-
var
|
|
153521
|
+
var greenAccent6 = RGBA.fromInts(76, 175, 80, 255);
|
|
153522
|
+
var dimText14 = RGBA.fromInts(120, 120, 120, 255);
|
|
153255
153523
|
var selectedBg2 = RGBA.fromInts(40, 40, 60, 255);
|
|
153256
153524
|
var white3 = RGBA.fromInts(255, 255, 255, 255);
|
|
153257
153525
|
function HelpDialog() {
|
|
153258
153526
|
const { commands: commands2 } = useCommand();
|
|
153259
153527
|
const route = useRoute();
|
|
153260
153528
|
const dimensions = useTerminalDimensions();
|
|
153261
|
-
const [selectedIndex, setSelectedIndex] =
|
|
153262
|
-
const [showDetail, setShowDetail] =
|
|
153263
|
-
const scrollboxRef =
|
|
153264
|
-
const commandsByCategory =
|
|
153529
|
+
const [selectedIndex, setSelectedIndex] = import_react78.useState(0);
|
|
153530
|
+
const [showDetail, setShowDetail] = import_react78.useState(false);
|
|
153531
|
+
const scrollboxRef = import_react78.useRef(null);
|
|
153532
|
+
const commandsByCategory = import_react78.useMemo(() => {
|
|
153265
153533
|
const grouped = {};
|
|
153266
153534
|
for (const cmd of commands2) {
|
|
153267
153535
|
const category = cmd.category || "Other";
|
|
@@ -153272,15 +153540,15 @@ function HelpDialog() {
|
|
|
153272
153540
|
}
|
|
153273
153541
|
return grouped;
|
|
153274
153542
|
}, [commands2]);
|
|
153275
|
-
const flatCommands =
|
|
153543
|
+
const flatCommands = import_react78.useMemo(() => {
|
|
153276
153544
|
return commands2;
|
|
153277
153545
|
}, [commands2]);
|
|
153278
|
-
|
|
153546
|
+
import_react78.useEffect(() => {
|
|
153279
153547
|
if (selectedIndex >= flatCommands.length) {
|
|
153280
153548
|
setSelectedIndex(Math.max(0, flatCommands.length - 1));
|
|
153281
153549
|
}
|
|
153282
153550
|
}, [flatCommands.length, selectedIndex]);
|
|
153283
|
-
|
|
153551
|
+
import_react78.useEffect(() => {
|
|
153284
153552
|
if (!scrollboxRef.current || flatCommands.length === 0)
|
|
153285
153553
|
return;
|
|
153286
153554
|
const scroll = scrollboxRef.current;
|
|
@@ -153357,7 +153625,7 @@ function HelpDialog() {
|
|
|
153357
153625
|
width: panelWidth,
|
|
153358
153626
|
height: detailHeight,
|
|
153359
153627
|
backgroundColor: bgPanel2,
|
|
153360
|
-
borderColor:
|
|
153628
|
+
borderColor: greenAccent6,
|
|
153361
153629
|
borderStyle: "single",
|
|
153362
153630
|
flexDirection: "column",
|
|
153363
153631
|
children: [
|
|
@@ -153367,14 +153635,14 @@ function HelpDialog() {
|
|
|
153367
153635
|
flexDirection: "row",
|
|
153368
153636
|
children: [
|
|
153369
153637
|
/* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("text", {
|
|
153370
|
-
fg:
|
|
153638
|
+
fg: greenAccent6,
|
|
153371
153639
|
children: [
|
|
153372
153640
|
"/",
|
|
153373
153641
|
selectedCommand.name
|
|
153374
153642
|
]
|
|
153375
153643
|
}, undefined, true, undefined, this),
|
|
153376
153644
|
/* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("text", {
|
|
153377
|
-
fg:
|
|
153645
|
+
fg: dimText14,
|
|
153378
153646
|
children: ` (${selectedCommand.category || "General"})`
|
|
153379
153647
|
}, undefined, false, undefined, this)
|
|
153380
153648
|
]
|
|
@@ -153402,7 +153670,7 @@ function HelpDialog() {
|
|
|
153402
153670
|
marginTop: 1,
|
|
153403
153671
|
children: [
|
|
153404
153672
|
/* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("text", {
|
|
153405
|
-
fg:
|
|
153673
|
+
fg: dimText14,
|
|
153406
153674
|
children: "Aliases: "
|
|
153407
153675
|
}, undefined, false, undefined, this),
|
|
153408
153676
|
/* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("text", {
|
|
@@ -153417,7 +153685,7 @@ function HelpDialog() {
|
|
|
153417
153685
|
height: 1
|
|
153418
153686
|
}, undefined, false, undefined, this),
|
|
153419
153687
|
/* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("text", {
|
|
153420
|
-
fg:
|
|
153688
|
+
fg: dimText14,
|
|
153421
153689
|
children: "Options:"
|
|
153422
153690
|
}, undefined, false, undefined, this),
|
|
153423
153691
|
/* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("box", {
|
|
@@ -153428,11 +153696,11 @@ function HelpDialog() {
|
|
|
153428
153696
|
paddingLeft: 2,
|
|
153429
153697
|
children: [
|
|
153430
153698
|
/* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("text", {
|
|
153431
|
-
fg:
|
|
153699
|
+
fg: greenAccent6,
|
|
153432
153700
|
children: opt.name
|
|
153433
153701
|
}, undefined, false, undefined, this),
|
|
153434
153702
|
opt.valueHint && /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("text", {
|
|
153435
|
-
fg:
|
|
153703
|
+
fg: dimText14,
|
|
153436
153704
|
children: ` ${opt.valueHint}`
|
|
153437
153705
|
}, undefined, false, undefined, this),
|
|
153438
153706
|
/* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("text", {
|
|
@@ -153458,7 +153726,7 @@ function HelpDialog() {
|
|
|
153458
153726
|
padding: 1,
|
|
153459
153727
|
flexDirection: "row",
|
|
153460
153728
|
children: /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("text", {
|
|
153461
|
-
fg:
|
|
153729
|
+
fg: dimText14,
|
|
153462
153730
|
children: "[enter/esc] back"
|
|
153463
153731
|
}, undefined, false, undefined, this)
|
|
153464
153732
|
}, undefined, false, undefined, this)
|
|
@@ -153489,11 +153757,11 @@ function HelpDialog() {
|
|
|
153489
153757
|
flexDirection: "row",
|
|
153490
153758
|
children: [
|
|
153491
153759
|
/* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("text", {
|
|
153492
|
-
fg:
|
|
153760
|
+
fg: greenAccent6,
|
|
153493
153761
|
children: "Help - Available Commands".padEnd(panelWidth - 20)
|
|
153494
153762
|
}, undefined, false, undefined, this),
|
|
153495
153763
|
/* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("text", {
|
|
153496
|
-
fg:
|
|
153764
|
+
fg: dimText14,
|
|
153497
153765
|
children: `${flatCommands.length} commands`
|
|
153498
153766
|
}, undefined, false, undefined, this)
|
|
153499
153767
|
]
|
|
@@ -153512,7 +153780,7 @@ function HelpDialog() {
|
|
|
153512
153780
|
paddingRight: 2,
|
|
153513
153781
|
flexDirection: "row",
|
|
153514
153782
|
children: /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("text", {
|
|
153515
|
-
fg:
|
|
153783
|
+
fg: dimText14,
|
|
153516
153784
|
children: [
|
|
153517
153785
|
"Command".padEnd(18),
|
|
153518
153786
|
"Category".padEnd(14),
|
|
@@ -153547,19 +153815,19 @@ function HelpDialog() {
|
|
|
153547
153815
|
paddingLeft: 1,
|
|
153548
153816
|
children: [
|
|
153549
153817
|
/* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("text", {
|
|
153550
|
-
fg: isSelected ?
|
|
153818
|
+
fg: isSelected ? greenAccent6 : white3,
|
|
153551
153819
|
children: name39
|
|
153552
153820
|
}, undefined, false, undefined, this),
|
|
153553
153821
|
/* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("text", {
|
|
153554
|
-
fg:
|
|
153822
|
+
fg: dimText14,
|
|
153555
153823
|
children: category
|
|
153556
153824
|
}, undefined, false, undefined, this),
|
|
153557
153825
|
/* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("text", {
|
|
153558
|
-
fg: isSelected ? white3 :
|
|
153826
|
+
fg: isSelected ? white3 : dimText14,
|
|
153559
153827
|
children: desc
|
|
153560
153828
|
}, undefined, false, undefined, this),
|
|
153561
153829
|
hasOptions && /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("text", {
|
|
153562
|
-
fg:
|
|
153830
|
+
fg: greenAccent6,
|
|
153563
153831
|
children: optionHint
|
|
153564
153832
|
}, undefined, false, undefined, this)
|
|
153565
153833
|
]
|
|
@@ -153579,7 +153847,7 @@ function HelpDialog() {
|
|
|
153579
153847
|
padding: 1,
|
|
153580
153848
|
flexDirection: "row",
|
|
153581
153849
|
children: /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("text", {
|
|
153582
|
-
fg:
|
|
153850
|
+
fg: dimText14,
|
|
153583
153851
|
children: "[j/k] navigate [enter/v] details [esc] close"
|
|
153584
153852
|
}, undefined, false, undefined, this)
|
|
153585
153853
|
}, undefined, false, undefined, this)
|
|
@@ -153589,10 +153857,10 @@ function HelpDialog() {
|
|
|
153589
153857
|
}
|
|
153590
153858
|
|
|
153591
153859
|
// src/tui/context/keybinding.tsx
|
|
153592
|
-
var
|
|
153860
|
+
var import_react84 = __toESM(require_react(), 1);
|
|
153593
153861
|
|
|
153594
153862
|
// src/tui/keybindings/keybind.tsx
|
|
153595
|
-
var
|
|
153863
|
+
var import_react80 = __toESM(require_react(), 1);
|
|
153596
153864
|
|
|
153597
153865
|
// src/tui/keybindings/actions.ts
|
|
153598
153866
|
var movementActions = [
|
|
@@ -153844,7 +154112,7 @@ var allActions = [
|
|
|
153844
154112
|
var actionsByKey = new Map(allActions.map((action) => [action.key, action]));
|
|
153845
154113
|
var actionsById = new Map(allActions.map((action) => [action.id, action]));
|
|
153846
154114
|
// src/tui/keybindings/keybind.tsx
|
|
153847
|
-
var LeaderKeyContext =
|
|
154115
|
+
var LeaderKeyContext = import_react80.createContext(null);
|
|
153848
154116
|
// src/tui/keybindings/registry.ts
|
|
153849
154117
|
function createKeybindings(deps) {
|
|
153850
154118
|
const {
|
|
@@ -154050,7 +154318,7 @@ var Keybind;
|
|
|
154050
154318
|
})(Keybind ||= {});
|
|
154051
154319
|
|
|
154052
154320
|
// src/tui/context/keybinding.tsx
|
|
154053
|
-
var KeybindingContext =
|
|
154321
|
+
var KeybindingContext = import_react84.createContext(undefined);
|
|
154054
154322
|
function KeybindingProvider({
|
|
154055
154323
|
children,
|
|
154056
154324
|
deps
|
|
@@ -154091,13 +154359,13 @@ function KeybindingProvider({
|
|
|
154091
154359
|
// src/tui/index.tsx
|
|
154092
154360
|
function App(props) {
|
|
154093
154361
|
const { appConfig } = props;
|
|
154094
|
-
const [focusIndex, setFocusIndex] =
|
|
154095
|
-
const [cwd, setCwd] =
|
|
154096
|
-
const [ctrlCPressTime, setCtrlCPressTime] =
|
|
154097
|
-
const [showExitWarning, setShowExitWarning] =
|
|
154098
|
-
const [inputKey, setInputKey] =
|
|
154099
|
-
const [showSessionsDialog, setShowSessionsDialog] =
|
|
154100
|
-
const [showShortcutsDialog, setShowShortcutsDialog] =
|
|
154362
|
+
const [focusIndex, setFocusIndex] = import_react86.useState(0);
|
|
154363
|
+
const [cwd, setCwd] = import_react86.useState(process.cwd());
|
|
154364
|
+
const [ctrlCPressTime, setCtrlCPressTime] = import_react86.useState(null);
|
|
154365
|
+
const [showExitWarning, setShowExitWarning] = import_react86.useState(false);
|
|
154366
|
+
const [inputKey, setInputKey] = import_react86.useState(0);
|
|
154367
|
+
const [showSessionsDialog, setShowSessionsDialog] = import_react86.useState(false);
|
|
154368
|
+
const [showShortcutsDialog, setShowShortcutsDialog] = import_react86.useState(false);
|
|
154101
154369
|
const navigableItems = ["command-input"];
|
|
154102
154370
|
return /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV(ConfigProvider, {
|
|
154103
154371
|
config: appConfig,
|
|
@@ -154171,7 +154439,7 @@ function AppContent({
|
|
|
154171
154439
|
path: "providers"
|
|
154172
154440
|
});
|
|
154173
154441
|
}
|
|
154174
|
-
|
|
154442
|
+
import_react86.useEffect(() => {
|
|
154175
154443
|
if (showExitWarning) {
|
|
154176
154444
|
const timer = setTimeout(() => {
|
|
154177
154445
|
setShowExitWarning(false);
|
|
@@ -154297,6 +154565,10 @@ function CommandDisplay({
|
|
|
154297
154565
|
when: "providers",
|
|
154298
154566
|
children: /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV(ProviderManager, {}, undefined, false, undefined, this)
|
|
154299
154567
|
}, undefined, false, undefined, this),
|
|
154568
|
+
/* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV(RouteSwitch.Case, {
|
|
154569
|
+
when: "resume",
|
|
154570
|
+
children: /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV(ResumeWizard, {}, undefined, false, undefined, this)
|
|
154571
|
+
}, undefined, false, undefined, this),
|
|
154300
154572
|
/* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV(RouteSwitch.Case, {
|
|
154301
154573
|
when: "help",
|
|
154302
154574
|
children: /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV(HelpDialog, {}, undefined, false, undefined, this)
|