@pensar/apex 2.0.0 → 2.0.1
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/README.md +20 -0
- package/build/agent-4g69jwmq.js +19 -0
- package/build/{agent-x1tnsg7n.js → agent-6nhperp2.js} +7 -10
- package/build/{agent-z8043nrm.js → agent-x7n47c84.js} +9 -12
- package/build/{apps-gdze0s68.js → apps-2ac4vt09.js} +15 -18
- package/build/{auth-24ca1qwx.js → auth-bmt98hz0.js} +16 -19
- package/build/authentication-c0aj9zaz.js +19 -0
- package/build/blackboxAgent-sgph70e4.js +19 -0
- package/build/{blackboxPentest-xwc031xm.js → blackboxPentest-xngbtdxb.js} +13 -16
- package/build/{cli-a20jcpmp.js → cli-0yptvbbm.js} +1 -1
- package/build/{cli-pkdjamer.js → cli-1f5zzrxj.js} +15 -5
- package/build/{cli-0v9x0eby.js → cli-88bhxzr1.js} +1 -1
- package/build/{cli-948dk60p.js → cli-8g5cwvbm.js} +1 -1
- package/build/{cli-mswm4k81.js → cli-cc13ydyx.js} +11 -1
- package/build/{cli-wdmqkshz.js → cli-ddtmgbqv.js} +2 -2
- package/build/{cli-h6nw89zf.js → cli-eptabm2j.js} +1 -1
- package/build/{cli-zpvmaxem.js → cli-f93g10xk.js} +2 -2
- package/build/{cli-zvq4gy61.js → cli-fa7nrded.js} +13 -6
- package/build/{cli-sw5swz40.js → cli-fxtbkw2f.js} +3 -3
- package/build/{cli-ntd42071.js → cli-hk03x6fq.js} +1 -1
- package/build/{cli-5fr9k6m4.js → cli-mfzkhttr.js} +58 -35
- package/build/{cli-31cara07.js → cli-pyzw545d.js} +8 -6
- package/build/{cli-cb5va0cs.js → cli-w2st266h.js} +10 -1
- package/build/{cli-h825qzmd.js → cli-z1dapp7v.js} +1492 -53
- package/build/{cli-k8mvghe1.js → cli-zpdmnz8c.js} +455 -921
- package/build/cli.js +105 -45
- package/build/{config-cmq1cxz3.js → config-j0gfjhrm.js} +3 -3
- package/build/{doctor-2bkpddws.js → doctor-zn8ms7gs.js} +8 -1
- package/build/{fixes-a4qscvkx.js → fixes-d8ytvyzn.js} +15 -18
- package/build/{index-hfhkjj2g.js → index-2t2cg8x0.js} +8 -11
- package/build/{index-54ep0ery.js → index-3cbcjqw1.js} +9 -12
- package/build/{index-48pjf9d2.js → index-528cyewc.js} +94 -126
- package/build/{index-2a1x5nnv.js → index-9d2es97h.js} +3 -3
- package/build/{index-aymt8k9w.js → index-a1sy2zak.js} +2 -2
- package/build/{index-s17r2akv.js → index-hjvqqkem.js} +4 -4
- package/build/{index-0fnbx38r.js → index-k6ttkac6.js} +20 -14
- package/build/{issues-5pnrspt7.js → issues-17kdjtdg.js} +15 -18
- package/build/{logs-1mfm901x.js → logs-r4rjar4m.js} +15 -18
- package/build/{offesecAgent-mrbyc93d.js → offesecAgent-azd8ahkm.js} +8 -11
- package/build/pentest-2vsjf0j8.js +28 -0
- package/build/{pentests-htmtq66d.js → pentests-npjb5q1h.js} +15 -18
- package/build/{targetedPentest-cpbd87rc.js → targetedPentest-m24wvscc.js} +9 -12
- package/build/threatModel-7akmfzzm.js +26 -0
- package/build/{uninstall-6y9dkgyt.js → uninstall-7pm6zcah.js} +1 -1
- package/build/{upload-7wtbr768.js → upload-wg0vxmk0.js} +8 -1
- package/build/{utils-trqnyj77.js → utils-gd1y4t26.js} +6 -8
- package/package.json +1 -1
- package/build/agent-84enr6xn.js +0 -22
- package/build/authentication-0k43jay4.js +0 -22
- package/build/blackboxAgent-76tnwwg7.js +0 -22
- package/build/cli-1yavz2pb.js +0 -17
- package/build/cli-3knnkdps.js +0 -666
- package/build/cli-s1nckt4k.js +0 -20
- package/build/pentest-wy4eeagc.js +0 -31
- package/build/threatModel-9n56z6a6.js +0 -29
|
@@ -7,21 +7,21 @@ import {
|
|
|
7
7
|
buildThreatModelPrompt,
|
|
8
8
|
createSkillsRegistry,
|
|
9
9
|
runOffensiveSecurityAgent
|
|
10
|
-
} from "./cli-
|
|
10
|
+
} from "./cli-pyzw545d.js";
|
|
11
11
|
import {
|
|
12
12
|
REPORT_FILENAME_MD,
|
|
13
13
|
convertModelMessagesToUI,
|
|
14
14
|
loadSubagents,
|
|
15
15
|
readExecutionMetrics,
|
|
16
16
|
writeExecutionMetrics
|
|
17
|
-
} from "./cli-
|
|
18
|
-
import"./cli-
|
|
19
|
-
import"./cli-
|
|
20
|
-
import"./cli-
|
|
21
|
-
import"./cli-
|
|
22
|
-
import"./cli-
|
|
17
|
+
} from "./cli-mfzkhttr.js";
|
|
18
|
+
import"./cli-fxtbkw2f.js";
|
|
19
|
+
import"./cli-w2st266h.js";
|
|
20
|
+
import"./cli-fa7nrded.js";
|
|
21
|
+
import"./cli-f93g10xk.js";
|
|
22
|
+
import"./cli-ddtmgbqv.js";
|
|
23
23
|
import"./cli-9fsre5pt.js";
|
|
24
|
-
import"./cli-
|
|
24
|
+
import"./cli-hk03x6fq.js";
|
|
25
25
|
import {
|
|
26
26
|
ALL_TOOL_NAMES,
|
|
27
27
|
ASK_USER_QUESTIONS_TOOL_NAME,
|
|
@@ -35,19 +35,12 @@ import {
|
|
|
35
35
|
buildBaseSystemPrompt,
|
|
36
36
|
createInitialOperatorState,
|
|
37
37
|
hasPlan,
|
|
38
|
-
list,
|
|
39
|
-
normalizeMessages,
|
|
40
38
|
planFilePath,
|
|
41
|
-
readPlan
|
|
42
|
-
|
|
43
|
-
} from "./cli-k8mvghe1.js";
|
|
39
|
+
readPlan
|
|
40
|
+
} from "./cli-zpdmnz8c.js";
|
|
44
41
|
import {
|
|
45
42
|
detectOSAndEnhancePrompt
|
|
46
|
-
} from "./cli-
|
|
47
|
-
import {
|
|
48
|
-
read,
|
|
49
|
-
write
|
|
50
|
-
} from "./cli-3knnkdps.js";
|
|
43
|
+
} from "./cli-cc13ydyx.js";
|
|
51
44
|
import {
|
|
52
45
|
formatParseError,
|
|
53
46
|
parseHeaderLine
|
|
@@ -60,31 +53,36 @@ import {
|
|
|
60
53
|
getAutoPopulatedPorts,
|
|
61
54
|
parseTargetUrl
|
|
62
55
|
} from "./cli-c8131c4q.js";
|
|
63
|
-
import {
|
|
64
|
-
init_toolset
|
|
65
|
-
} from "./cli-s1nckt4k.js";
|
|
66
56
|
import {
|
|
67
57
|
createWeaveTracer,
|
|
68
58
|
resolveConfig
|
|
69
|
-
} from "./cli-
|
|
59
|
+
} from "./cli-1f5zzrxj.js";
|
|
70
60
|
import {
|
|
71
61
|
AVAILABLE_PROVIDERS,
|
|
72
62
|
init_types
|
|
73
63
|
} from "./cli-yz80qkzn.js";
|
|
74
|
-
import {
|
|
75
|
-
init_ai
|
|
76
|
-
} from "./cli-1yavz2pb.js";
|
|
77
64
|
import {
|
|
78
65
|
AVAILABLE_MODELS,
|
|
79
66
|
DEFAULT_OPENAI_REASONING_EFFORT,
|
|
80
67
|
buildAuthConfig,
|
|
81
68
|
getOpenAIReasoningEfforts,
|
|
82
69
|
hasToolCall,
|
|
70
|
+
init_ai,
|
|
83
71
|
init_dist,
|
|
72
|
+
init_logger,
|
|
73
|
+
init_session,
|
|
74
|
+
init_storage,
|
|
75
|
+
init_toolset,
|
|
76
|
+
list1 as list,
|
|
84
77
|
modelSupportsOpenAIReasoning,
|
|
85
78
|
modelSupportsThinking,
|
|
86
|
-
|
|
87
|
-
|
|
79
|
+
normalizeMessages,
|
|
80
|
+
read,
|
|
81
|
+
sessions,
|
|
82
|
+
stepCountIs,
|
|
83
|
+
write,
|
|
84
|
+
writeErrorLog
|
|
85
|
+
} from "./cli-z1dapp7v.js";
|
|
88
86
|
import {
|
|
89
87
|
disconnect,
|
|
90
88
|
fetchWorkspaces,
|
|
@@ -98,21 +96,21 @@ import {
|
|
|
98
96
|
selectWorkspace,
|
|
99
97
|
startDeviceFlow,
|
|
100
98
|
validateGateway
|
|
101
|
-
} from "./cli-
|
|
99
|
+
} from "./cli-8g5cwvbm.js";
|
|
102
100
|
import"./cli-e6rgwtpb.js";
|
|
101
|
+
import"./cli-gpnb45ck.js";
|
|
103
102
|
import {
|
|
104
103
|
config,
|
|
105
104
|
init_config as init_config2
|
|
106
|
-
} from "./cli-
|
|
107
|
-
import"./cli-gpnb45ck.js";
|
|
105
|
+
} from "./cli-eptabm2j.js";
|
|
108
106
|
import {
|
|
109
107
|
init_config,
|
|
110
108
|
update
|
|
111
|
-
} from "./cli-
|
|
109
|
+
} from "./cli-88bhxzr1.js";
|
|
112
110
|
import {
|
|
113
111
|
checkForUpdate,
|
|
114
112
|
init_installation
|
|
115
|
-
} from "./cli-
|
|
113
|
+
} from "./cli-0yptvbbm.js";
|
|
116
114
|
import {
|
|
117
115
|
__commonJS,
|
|
118
116
|
__esm,
|
|
@@ -49366,67 +49364,11 @@ var require_lib = __commonJS((exports, module) => {
|
|
|
49366
49364
|
// src/tui/index.tsx
|
|
49367
49365
|
init_config2();
|
|
49368
49366
|
init_installation();
|
|
49367
|
+
init_logger();
|
|
49369
49368
|
import { createCliRenderer, FrameBufferRenderable, RGBA as RGBA25 } from "@opentui/core";
|
|
49370
49369
|
import { createRoot, extend } from "@opentui/react";
|
|
49371
49370
|
import { useEffect as useEffect27, useState as useState39 } from "react";
|
|
49372
49371
|
|
|
49373
|
-
// src/core/logger/index.ts
|
|
49374
|
-
import {
|
|
49375
|
-
appendFileSync,
|
|
49376
|
-
existsSync,
|
|
49377
|
-
mkdirSync,
|
|
49378
|
-
readFileSync,
|
|
49379
|
-
writeFileSync
|
|
49380
|
-
} from "fs";
|
|
49381
|
-
import os from "os";
|
|
49382
|
-
import path from "path";
|
|
49383
|
-
var ERROR_LOG_PATH = path.join(os.homedir(), ".pensar", "error.log");
|
|
49384
|
-
var RETENTION_DAYS = 7;
|
|
49385
|
-
var TIMESTAMP_RE = /^(\d{4}-\d{2}-\d{2}T[\d:.]+Z) - /;
|
|
49386
|
-
var hasPruned = false;
|
|
49387
|
-
function pruneErrorLog() {
|
|
49388
|
-
if (hasPruned)
|
|
49389
|
-
return;
|
|
49390
|
-
hasPruned = true;
|
|
49391
|
-
try {
|
|
49392
|
-
if (!existsSync(ERROR_LOG_PATH))
|
|
49393
|
-
return;
|
|
49394
|
-
const cutoff = Date.now() - RETENTION_DAYS * 86400000;
|
|
49395
|
-
const raw = readFileSync(ERROR_LOG_PATH, "utf8");
|
|
49396
|
-
const lines = raw.split(`
|
|
49397
|
-
`);
|
|
49398
|
-
const kept = [];
|
|
49399
|
-
let keeping = true;
|
|
49400
|
-
for (const line of lines) {
|
|
49401
|
-
const match = TIMESTAMP_RE.exec(line);
|
|
49402
|
-
if (match) {
|
|
49403
|
-
keeping = new Date(match[1]).getTime() >= cutoff;
|
|
49404
|
-
}
|
|
49405
|
-
if (keeping) {
|
|
49406
|
-
kept.push(line);
|
|
49407
|
-
}
|
|
49408
|
-
}
|
|
49409
|
-
writeFileSync(ERROR_LOG_PATH, kept.join(`
|
|
49410
|
-
`), "utf8");
|
|
49411
|
-
} catch {}
|
|
49412
|
-
}
|
|
49413
|
-
function writeErrorLog(error, source) {
|
|
49414
|
-
try {
|
|
49415
|
-
pruneErrorLog();
|
|
49416
|
-
const dir = path.dirname(ERROR_LOG_PATH);
|
|
49417
|
-
if (!existsSync(dir)) {
|
|
49418
|
-
mkdirSync(dir, { recursive: true });
|
|
49419
|
-
}
|
|
49420
|
-
const timestamp = new Date().toISOString();
|
|
49421
|
-
const tag = source ? `[${source}] ` : "";
|
|
49422
|
-
const message = error instanceof Error ? `${error.message}
|
|
49423
|
-
${error.stack ?? ""}` : String(error);
|
|
49424
|
-
const entry = `${timestamp} - [ERROR] ${tag}${message}
|
|
49425
|
-
`;
|
|
49426
|
-
appendFileSync(ERROR_LOG_PATH, entry, "utf8");
|
|
49427
|
-
} catch {}
|
|
49428
|
-
}
|
|
49429
|
-
|
|
49430
49372
|
// src/core/providers/index.ts
|
|
49431
49373
|
init_types();
|
|
49432
49374
|
init_utils();
|
|
@@ -52840,11 +52782,14 @@ function createClipboardManager(renderer) {
|
|
|
52840
52782
|
}
|
|
52841
52783
|
|
|
52842
52784
|
// src/tui/components/chat/index.tsx
|
|
52785
|
+
init_session();
|
|
52843
52786
|
import { useCallback as useCallback12, useEffect as useEffect12, useState as useState19 } from "react";
|
|
52844
52787
|
|
|
52845
52788
|
// src/tui/context/agent.tsx
|
|
52846
52789
|
init_ai();
|
|
52847
52790
|
init_config();
|
|
52791
|
+
init_logger();
|
|
52792
|
+
init_utils();
|
|
52848
52793
|
import {
|
|
52849
52794
|
createContext as createContext3,
|
|
52850
52795
|
useCallback as useCallback2,
|
|
@@ -52854,7 +52799,6 @@ import {
|
|
|
52854
52799
|
useRef,
|
|
52855
52800
|
useState as useState3
|
|
52856
52801
|
} from "react";
|
|
52857
|
-
init_utils();
|
|
52858
52802
|
|
|
52859
52803
|
// src/tui/context/config.tsx
|
|
52860
52804
|
init_config2();
|
|
@@ -53956,6 +53900,7 @@ function isValidUrl(url) {
|
|
|
53956
53900
|
import { useCallback as useCallback11, useEffect as useEffect11, useState as useState18 } from "react";
|
|
53957
53901
|
|
|
53958
53902
|
// src/core/history.ts
|
|
53903
|
+
init_storage();
|
|
53959
53904
|
var STORAGE_KEY = ["command-history"];
|
|
53960
53905
|
var MAX_ENTRIES = 500;
|
|
53961
53906
|
var entries = null;
|
|
@@ -54407,7 +54352,7 @@ function deobfuscate(input) {
|
|
|
54407
54352
|
init_config2();
|
|
54408
54353
|
|
|
54409
54354
|
// src/tui/utils/command-flags.ts
|
|
54410
|
-
import { readFileSync
|
|
54355
|
+
import { readFileSync } from "fs";
|
|
54411
54356
|
import { isAbsolute, resolve } from "path";
|
|
54412
54357
|
init_toolset();
|
|
54413
54358
|
function combinePromptParts(threatModel, prompt) {
|
|
@@ -54424,7 +54369,7 @@ function resolveFlagValue(value) {
|
|
|
54424
54369
|
if (value.startsWith("@")) {
|
|
54425
54370
|
const filePath = value.slice(1);
|
|
54426
54371
|
const resolved = isAbsolute(filePath) ? filePath : resolve(process.cwd(), filePath);
|
|
54427
|
-
return
|
|
54372
|
+
return readFileSync(resolved, "utf-8");
|
|
54428
54373
|
}
|
|
54429
54374
|
return value;
|
|
54430
54375
|
}
|
|
@@ -59629,7 +59574,10 @@ var PromptInput = forwardRef(function PromptInput2({
|
|
|
59629
59574
|
},
|
|
59630
59575
|
setValue: (value) => {
|
|
59631
59576
|
setInputValue(value);
|
|
59632
|
-
textareaRef.current
|
|
59577
|
+
const ta = textareaRef.current;
|
|
59578
|
+
ta?.setText(value);
|
|
59579
|
+
if (ta)
|
|
59580
|
+
ta.cursorOffset = value.length;
|
|
59633
59581
|
clearPaste();
|
|
59634
59582
|
},
|
|
59635
59583
|
getValue: () => inputValue,
|
|
@@ -60069,10 +60017,22 @@ function NormalInputAreaInner({
|
|
|
60069
60017
|
const promptRef = useRef9(null);
|
|
60070
60018
|
const isExternalUpdate = useRef9(false);
|
|
60071
60019
|
const prevValueRef = useRef9(value);
|
|
60020
|
+
const emittedRef = useRef9([]);
|
|
60072
60021
|
useEffect9(() => {
|
|
60073
60022
|
const prevValue = prevValueRef.current;
|
|
60074
60023
|
prevValueRef.current = value;
|
|
60075
|
-
if (value
|
|
60024
|
+
if (value === prevValue)
|
|
60025
|
+
return;
|
|
60026
|
+
const echoIdx = emittedRef.current.indexOf(value);
|
|
60027
|
+
if (echoIdx !== -1) {
|
|
60028
|
+
emittedRef.current.splice(0, echoIdx + 1);
|
|
60029
|
+
if (value !== "" || emittedRef.current.length > 0) {
|
|
60030
|
+
return;
|
|
60031
|
+
}
|
|
60032
|
+
} else {
|
|
60033
|
+
emittedRef.current.length = 0;
|
|
60034
|
+
}
|
|
60035
|
+
if (value !== inputValue) {
|
|
60076
60036
|
isExternalUpdate.current = true;
|
|
60077
60037
|
setInputValue(value);
|
|
60078
60038
|
promptRef.current?.setValue(value);
|
|
@@ -60084,6 +60044,7 @@ function NormalInputAreaInner({
|
|
|
60084
60044
|
return;
|
|
60085
60045
|
}
|
|
60086
60046
|
if (inputValue !== value) {
|
|
60047
|
+
emittedRef.current.push(inputValue);
|
|
60087
60048
|
onChange(inputValue);
|
|
60088
60049
|
}
|
|
60089
60050
|
}, [inputValue, value, onChange]);
|
|
@@ -62854,14 +62815,16 @@ function OnboardingChoice({
|
|
|
62854
62815
|
// src/tui/components/commands/sessions-display.tsx
|
|
62855
62816
|
import { useKeyboard as useKeyboard15 } from "@opentui/react";
|
|
62856
62817
|
import { useCallback as useCallback16, useEffect as useEffect18, useRef as useRef14, useState as useState28 } from "react";
|
|
62818
|
+
init_session();
|
|
62857
62819
|
|
|
62858
62820
|
// src/tui/hooks/use-sessions-list.ts
|
|
62859
|
-
import { existsSync
|
|
62821
|
+
import { existsSync, readdirSync } from "fs";
|
|
62860
62822
|
import { join } from "path";
|
|
62861
62823
|
import { useCallback as useCallback15, useEffect as useEffect17, useState as useState27 } from "react";
|
|
62824
|
+
init_session();
|
|
62862
62825
|
function countFindings(findingsPath) {
|
|
62863
62826
|
try {
|
|
62864
|
-
if (!
|
|
62827
|
+
if (!existsSync(findingsPath))
|
|
62865
62828
|
return 0;
|
|
62866
62829
|
return readdirSync(findingsPath).filter((f) => f.endsWith(".json")).length;
|
|
62867
62830
|
} catch {
|
|
@@ -62869,7 +62832,7 @@ function countFindings(findingsPath) {
|
|
|
62869
62832
|
}
|
|
62870
62833
|
}
|
|
62871
62834
|
function checkHasReport(rootPath) {
|
|
62872
|
-
return
|
|
62835
|
+
return existsSync(join(rootPath, REPORT_FILENAME_MD));
|
|
62873
62836
|
}
|
|
62874
62837
|
function useSessionsList() {
|
|
62875
62838
|
const [allSessions, setAllSessions] = useState27([]);
|
|
@@ -62879,7 +62842,7 @@ function useSessionsList() {
|
|
|
62879
62842
|
try {
|
|
62880
62843
|
const enriched = [];
|
|
62881
62844
|
for await (const session of list()) {
|
|
62882
|
-
const hasOperatorState =
|
|
62845
|
+
const hasOperatorState = existsSync(join(session.rootPath, "messages.json"));
|
|
62883
62846
|
const findingsCount = countFindings(session.findingsPath);
|
|
62884
62847
|
const hasReport = checkHasReport(session.rootPath);
|
|
62885
62848
|
enriched.push({
|
|
@@ -62957,7 +62920,7 @@ function useSessionsList() {
|
|
|
62957
62920
|
}
|
|
62958
62921
|
|
|
62959
62922
|
// src/tui/utils/open-report.ts
|
|
62960
|
-
import { existsSync as
|
|
62923
|
+
import { existsSync as existsSync2, readFileSync as readFileSync2 } from "node:fs";
|
|
62961
62924
|
import { join as join2 } from "node:path";
|
|
62962
62925
|
|
|
62963
62926
|
// src/tui/utils/open-file.ts
|
|
@@ -62995,17 +62958,17 @@ async function openFileInDefaultApp(filePath) {
|
|
|
62995
62958
|
// src/tui/utils/open-report.ts
|
|
62996
62959
|
async function openSessionReport(sessionRootPath) {
|
|
62997
62960
|
const reportPath = join2(sessionRootPath, REPORT_FILENAME_MD);
|
|
62998
|
-
if (!
|
|
62961
|
+
if (!existsSync2(reportPath)) {
|
|
62999
62962
|
return "Report not found";
|
|
63000
62963
|
}
|
|
63001
62964
|
return openFileInDefaultApp(reportPath);
|
|
63002
62965
|
}
|
|
63003
62966
|
function readSessionReport(sessionRootPath) {
|
|
63004
62967
|
const reportPath = join2(sessionRootPath, REPORT_FILENAME_MD);
|
|
63005
|
-
if (!
|
|
62968
|
+
if (!existsSync2(reportPath))
|
|
63006
62969
|
return null;
|
|
63007
62970
|
try {
|
|
63008
|
-
return
|
|
62971
|
+
return readFileSync2(reportPath, "utf-8");
|
|
63009
62972
|
} catch {
|
|
63010
62973
|
return null;
|
|
63011
62974
|
}
|
|
@@ -64695,6 +64658,7 @@ function WebWizard({
|
|
|
64695
64658
|
}
|
|
64696
64659
|
|
|
64697
64660
|
// src/tui/components/error-boundary.tsx
|
|
64661
|
+
init_logger();
|
|
64698
64662
|
import React, { useCallback as useCallback18 } from "react";
|
|
64699
64663
|
var MAX_ERRORS = 3;
|
|
64700
64664
|
var ERROR_WINDOW_MS = 5000;
|
|
@@ -64737,9 +64701,10 @@ function ErrorBoundary({ children }) {
|
|
|
64737
64701
|
}
|
|
64738
64702
|
|
|
64739
64703
|
// src/tui/components/footer.tsx
|
|
64740
|
-
import
|
|
64704
|
+
import os from "os";
|
|
64741
64705
|
|
|
64742
64706
|
// src/tui/context/session.tsx
|
|
64707
|
+
init_session();
|
|
64743
64708
|
import {
|
|
64744
64709
|
createContext as createContext12,
|
|
64745
64710
|
useContext as useContext12,
|
|
@@ -64805,7 +64770,7 @@ function Footer({
|
|
|
64805
64770
|
const { width: termWidth } = useDimensions();
|
|
64806
64771
|
const { enabled: obfuscateEnabled } = useObfuscation();
|
|
64807
64772
|
const effectiveCwd = sessionCwd || cwd;
|
|
64808
|
-
const relativeCwd = effectiveCwd.split(
|
|
64773
|
+
const relativeCwd = effectiveCwd.split(os.homedir()).pop() || "";
|
|
64809
64774
|
const segments = relativeCwd.split("/").filter(Boolean);
|
|
64810
64775
|
const rawDisplayCwd = segments.length <= 2 ? "~/" + segments.join("/") : "…/" + segments.slice(-2).join("/");
|
|
64811
64776
|
const displayCwd = obfuscateEnabled ? "~/[workdir]" : rawDisplayCwd;
|
|
@@ -64954,7 +64919,7 @@ function ContextProgress({
|
|
|
64954
64919
|
// src/tui/components/operator-dashboard/index.tsx
|
|
64955
64920
|
init_dist();
|
|
64956
64921
|
import { useKeyboard as useKeyboard25 } from "@opentui/react";
|
|
64957
|
-
import { existsSync as
|
|
64922
|
+
import { existsSync as existsSync3, readFileSync as readFileSync3, writeFileSync } from "fs";
|
|
64958
64923
|
import { isAbsolute as isAbsolute2, join as join3, resolve as resolve2 } from "path";
|
|
64959
64924
|
import {
|
|
64960
64925
|
useCallback as useCallback19,
|
|
@@ -64993,6 +64958,9 @@ async function attachWandbToEventBus(session, eventBus, opts) {
|
|
|
64993
64958
|
};
|
|
64994
64959
|
}
|
|
64995
64960
|
|
|
64961
|
+
// src/tui/components/operator-dashboard/index.tsx
|
|
64962
|
+
init_session();
|
|
64963
|
+
|
|
64996
64964
|
// src/tui/components/chat/approval-inline.tsx
|
|
64997
64965
|
import { jsxDEV as jsxDEV46 } from "@opentui/react/jsx-dev-runtime";
|
|
64998
64966
|
function InlineApprovalPrompt({ approval }) {
|
|
@@ -66098,8 +66066,8 @@ function nextImageId() {
|
|
|
66098
66066
|
return nextId2++;
|
|
66099
66067
|
}
|
|
66100
66068
|
function transmitImageFromFile(opts) {
|
|
66101
|
-
const { path
|
|
66102
|
-
const payload = Buffer.from(
|
|
66069
|
+
const { path, columns, rows, imageId, zIndex = 10 } = opts;
|
|
66070
|
+
const payload = Buffer.from(path).toString("base64");
|
|
66103
66071
|
const ctrl = `f=100,t=f,a=T,c=${columns},r=${rows},z=${zIndex},q=2,i=${imageId}`;
|
|
66104
66072
|
process.stdout.write(`${APC}${ctrl};${payload}${ST}`);
|
|
66105
66073
|
}
|
|
@@ -66114,8 +66082,8 @@ function moveCursor(row, col) {
|
|
|
66114
66082
|
import { jsxDEV as jsxDEV50 } from "@opentui/react/jsx-dev-runtime";
|
|
66115
66083
|
var HEADER_ROWS = 4;
|
|
66116
66084
|
var FOOTER_ROWS = 6;
|
|
66117
|
-
async function readPngDimensions(
|
|
66118
|
-
const fh = await open(
|
|
66085
|
+
async function readPngDimensions(path) {
|
|
66086
|
+
const fh = await open(path, "r");
|
|
66119
66087
|
try {
|
|
66120
66088
|
const buf = Buffer.alloc(24);
|
|
66121
66089
|
await fh.read(buf, 0, 24, 0);
|
|
@@ -66154,7 +66122,7 @@ function ScreenshotModal({ screenshots, initialIndex, onClose }) {
|
|
|
66154
66122
|
const supported = kittyGraphicsSupported();
|
|
66155
66123
|
const safeInitial = Math.min(Math.max(0, initialIndex ?? screenshots.length - 1), Math.max(0, screenshots.length - 1));
|
|
66156
66124
|
const [index, setIndex] = useState35(safeInitial);
|
|
66157
|
-
const
|
|
66125
|
+
const path = screenshots[index];
|
|
66158
66126
|
const total = screenshots.length;
|
|
66159
66127
|
useKeyboard21((key) => {
|
|
66160
66128
|
if (key.name === "left") {
|
|
@@ -66170,13 +66138,13 @@ function ScreenshotModal({ screenshots, initialIndex, onClose }) {
|
|
|
66170
66138
|
onClose();
|
|
66171
66139
|
});
|
|
66172
66140
|
useEffect22(() => {
|
|
66173
|
-
if (!supported || !
|
|
66141
|
+
if (!supported || !path)
|
|
66174
66142
|
return;
|
|
66175
66143
|
let cancelled = false;
|
|
66176
66144
|
const id = nextImageId();
|
|
66177
66145
|
(async () => {
|
|
66178
66146
|
try {
|
|
66179
|
-
const { width: w2, height: h } = await readPngDimensions(
|
|
66147
|
+
const { width: w2, height: h } = await readPngDimensions(path);
|
|
66180
66148
|
const availCols = Math.max(4, termW - 4);
|
|
66181
66149
|
const availRows = Math.max(4, termH - HEADER_ROWS - FOOTER_ROWS);
|
|
66182
66150
|
const imgCellAspect = h / w2 / 2;
|
|
@@ -66195,14 +66163,14 @@ function ScreenshotModal({ screenshots, initialIndex, onClose }) {
|
|
|
66195
66163
|
const xCell = Math.max(1, Math.floor((termW - cols) / 2) + 1);
|
|
66196
66164
|
const yCell = Math.max(HEADER_ROWS + 1, HEADER_ROWS + Math.floor((availRows - rows) / 2) + 1);
|
|
66197
66165
|
moveCursor(yCell, xCell);
|
|
66198
|
-
transmitImageFromFile({ path
|
|
66166
|
+
transmitImageFromFile({ path, columns: cols, rows, imageId: id });
|
|
66199
66167
|
} catch {}
|
|
66200
66168
|
})();
|
|
66201
66169
|
return () => {
|
|
66202
66170
|
cancelled = true;
|
|
66203
66171
|
deleteImage(id);
|
|
66204
66172
|
};
|
|
66205
|
-
}, [
|
|
66173
|
+
}, [path, termW, termH, supported]);
|
|
66206
66174
|
const counter = `${index + 1} / ${total}`;
|
|
66207
66175
|
const controls = total > 1 ? `← → navigate · esc close · ${counter}` : `esc close · ${counter}`;
|
|
66208
66176
|
const indicatorRow = Math.max(0, termH - FOOTER_ROWS);
|
|
@@ -66218,7 +66186,7 @@ function ScreenshotModal({ screenshots, initialIndex, onClose }) {
|
|
|
66218
66186
|
onClose();
|
|
66219
66187
|
},
|
|
66220
66188
|
children: [
|
|
66221
|
-
!supported &&
|
|
66189
|
+
!supported && path && /* @__PURE__ */ jsxDEV50("box", {
|
|
66222
66190
|
position: "absolute",
|
|
66223
66191
|
top: HEADER_ROWS,
|
|
66224
66192
|
left: 0,
|
|
@@ -66234,7 +66202,7 @@ function ScreenshotModal({ screenshots, initialIndex, onClose }) {
|
|
|
66234
66202
|
}, undefined, false, undefined, this),
|
|
66235
66203
|
/* @__PURE__ */ jsxDEV50("text", {
|
|
66236
66204
|
fg: colors2.textMuted,
|
|
66237
|
-
children:
|
|
66205
|
+
children: path
|
|
66238
66206
|
}, undefined, false, undefined, this),
|
|
66239
66207
|
/* @__PURE__ */ jsxDEV50("text", {
|
|
66240
66208
|
fg: colors2.textMuted,
|
|
@@ -67735,7 +67703,7 @@ function OperatorDashboard({
|
|
|
67735
67703
|
if (sessionRef.current) {
|
|
67736
67704
|
try {
|
|
67737
67705
|
const mp = join3(sessionRef.current.rootPath, "messages.json");
|
|
67738
|
-
|
|
67706
|
+
writeFileSync(mp, JSON.stringify(nextMessages, null, 2));
|
|
67739
67707
|
} catch {}
|
|
67740
67708
|
}
|
|
67741
67709
|
} else {
|
|
@@ -68119,8 +68087,8 @@ Error: ${errMsg}
|
|
|
68119
68087
|
try {
|
|
68120
68088
|
const rootPath = agentResult.session.rootPath;
|
|
68121
68089
|
const mp = join3(rootPath, "messages.json");
|
|
68122
|
-
if (
|
|
68123
|
-
const raw = JSON.parse(
|
|
68090
|
+
if (existsSync3(mp)) {
|
|
68091
|
+
const raw = JSON.parse(readFileSync3(mp, "utf-8"));
|
|
68124
68092
|
if (Array.isArray(raw) && raw.length > 0) {
|
|
68125
68093
|
conversationRef.current = normalizeMessages(sessions.getResumeMessages(raw));
|
|
68126
68094
|
}
|
|
@@ -68147,7 +68115,7 @@ Error: ${errMsg}
|
|
|
68147
68115
|
if (sessionRef.current) {
|
|
68148
68116
|
try {
|
|
68149
68117
|
const mp = join3(sessionRef.current.rootPath, "messages.json");
|
|
68150
|
-
|
|
68118
|
+
writeFileSync(mp, JSON.stringify(prevMessages, null, 2));
|
|
68151
68119
|
} catch {}
|
|
68152
68120
|
}
|
|
68153
68121
|
const errorMsg = e instanceof Error ? e.message : "Agent failed";
|
|
@@ -68545,8 +68513,8 @@ ${planContent}` : "No plan exists yet. Switch to plan mode (Shift+Tab) to create
|
|
|
68545
68513
|
if (activeSession) {
|
|
68546
68514
|
try {
|
|
68547
68515
|
const messagesPath = join3(activeSession.rootPath, "messages.json");
|
|
68548
|
-
if (
|
|
68549
|
-
const raw = JSON.parse(
|
|
68516
|
+
if (existsSync3(messagesPath)) {
|
|
68517
|
+
const raw = JSON.parse(readFileSync3(messagesPath, "utf-8"));
|
|
68550
68518
|
if (Array.isArray(raw) && raw.length > 0) {
|
|
68551
68519
|
conversationRef.current = normalizeMessages(sessions.getResumeMessages(raw));
|
|
68552
68520
|
}
|
|
@@ -68593,7 +68561,7 @@ ${planContent}` : "No plan exists yet. Switch to plan mode (Shift+Tab) to create
|
|
|
68593
68561
|
}
|
|
68594
68562
|
];
|
|
68595
68563
|
}
|
|
68596
|
-
|
|
68564
|
+
writeFileSync(join3(activeSession.rootPath, "messages.json"), JSON.stringify(conversationRef.current, null, 2));
|
|
68597
68565
|
}
|
|
68598
68566
|
} catch {}
|
|
68599
68567
|
}
|
|
@@ -68639,7 +68607,7 @@ ${planContent}` : "No plan exists yet. Switch to plan mode (Shift+Tab) to create
|
|
|
68639
68607
|
const activeSession = sessionRef.current;
|
|
68640
68608
|
if (activeSession) {
|
|
68641
68609
|
try {
|
|
68642
|
-
|
|
68610
|
+
writeFileSync(join3(activeSession.rootPath, "messages.json"), JSON.stringify(updated, null, 2));
|
|
68643
68611
|
} catch {}
|
|
68644
68612
|
}
|
|
68645
68613
|
pendingToolCallIdRef.current = null;
|
|
@@ -68784,7 +68752,7 @@ ${planContent}` : "No plan exists yet. Switch to plan mode (Shift+Tab) to create
|
|
|
68784
68752
|
const activeSession = sessionRef.current;
|
|
68785
68753
|
if (activeSession) {
|
|
68786
68754
|
try {
|
|
68787
|
-
|
|
68755
|
+
writeFileSync(join3(activeSession.rootPath, "messages.json"), JSON.stringify(conversationRef.current, null, 2));
|
|
68788
68756
|
} catch {}
|
|
68789
68757
|
}
|
|
68790
68758
|
}
|
|
@@ -69708,7 +69676,7 @@ function AppContent({
|
|
|
69708
69676
|
toast(`Update available: v${currentVersion} → v${latestVersion}. Run: pensar upgrade`, "warn", 8000);
|
|
69709
69677
|
});
|
|
69710
69678
|
const checkAuthToken = async () => {
|
|
69711
|
-
const { isTokenExpired, isConnected: isConnected2 } = await import("./index-
|
|
69679
|
+
const { isTokenExpired, isConnected: isConnected2 } = await import("./index-hjvqqkem.js");
|
|
69712
69680
|
if (isConnected2(config2.data) && config2.data.accessToken && isTokenExpired(config2.data.accessToken, 60) && !config2.data.refreshToken && !config2.data.pensarAPIKey) {
|
|
69713
69681
|
toast("Your Pensar Console session has expired. Run /login to refresh.", "warn", 8000);
|
|
69714
69682
|
}
|
|
@@ -12,10 +12,10 @@ import {
|
|
|
12
12
|
signGatewayRequest,
|
|
13
13
|
startDeviceFlow,
|
|
14
14
|
validateGateway
|
|
15
|
-
} from "./cli-
|
|
16
|
-
import"./cli-
|
|
17
|
-
import"./cli-
|
|
18
|
-
import"./cli-
|
|
15
|
+
} from "./cli-8g5cwvbm.js";
|
|
16
|
+
import"./cli-eptabm2j.js";
|
|
17
|
+
import"./cli-88bhxzr1.js";
|
|
18
|
+
import"./cli-0yptvbbm.js";
|
|
19
19
|
import"./cli-8rxa073f.js";
|
|
20
20
|
init_auth();
|
|
21
21
|
|
|
@@ -1,45 +1,51 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CredentialManager,
|
|
3
3
|
RateLimiter,
|
|
4
|
+
ToolsetStateSchema,
|
|
4
5
|
createDir,
|
|
5
6
|
descending,
|
|
6
7
|
generateRandomName,
|
|
7
8
|
generateSessionName,
|
|
9
|
+
init_credentials,
|
|
10
|
+
init_id,
|
|
11
|
+
init_name,
|
|
12
|
+
init_rateLimiter,
|
|
13
|
+
init_storage,
|
|
14
|
+
init_toolset,
|
|
8
15
|
read,
|
|
9
16
|
schema,
|
|
10
17
|
update,
|
|
11
18
|
write,
|
|
12
19
|
writeRaw
|
|
13
|
-
} from "./cli-
|
|
14
|
-
import
|
|
15
|
-
ToolsetStateSchema,
|
|
16
|
-
init_toolset
|
|
17
|
-
} from "./cli-s1nckt4k.js";
|
|
18
|
-
import"./cli-1yavz2pb.js";
|
|
19
|
-
import"./cli-h825qzmd.js";
|
|
20
|
-
import"./cli-948dk60p.js";
|
|
20
|
+
} from "./cli-z1dapp7v.js";
|
|
21
|
+
import"./cli-8g5cwvbm.js";
|
|
21
22
|
import {
|
|
22
23
|
init_zod,
|
|
23
24
|
zod_default
|
|
24
25
|
} from "./cli-e6rgwtpb.js";
|
|
25
|
-
import"./cli-h6nw89zf.js";
|
|
26
26
|
import"./cli-gpnb45ck.js";
|
|
27
|
-
import"./cli-
|
|
27
|
+
import"./cli-eptabm2j.js";
|
|
28
|
+
import"./cli-88bhxzr1.js";
|
|
28
29
|
import {
|
|
29
30
|
getCurrentVersion,
|
|
30
31
|
init_installation
|
|
31
|
-
} from "./cli-
|
|
32
|
+
} from "./cli-0yptvbbm.js";
|
|
32
33
|
import {
|
|
33
34
|
__require
|
|
34
35
|
} from "./cli-8rxa073f.js";
|
|
35
36
|
|
|
36
37
|
// src/core/session/index.ts
|
|
37
38
|
init_zod();
|
|
39
|
+
init_name();
|
|
40
|
+
init_credentials();
|
|
41
|
+
init_id();
|
|
42
|
+
init_installation();
|
|
43
|
+
init_rateLimiter();
|
|
44
|
+
init_storage();
|
|
45
|
+
init_toolset();
|
|
38
46
|
import { existsSync, readFileSync } from "fs";
|
|
39
47
|
import os from "os";
|
|
40
48
|
import path from "path";
|
|
41
|
-
init_installation();
|
|
42
|
-
init_toolset();
|
|
43
49
|
var DEFAULT_OUTCOME_GUIDANCE = "Prove the exploit can be run but do not exfiltrate data or cause any harm to the system. " + "Create proof-of-concept exploits that demonstrate the vulnerability exists without causing damage.";
|
|
44
50
|
var EXFIL_OUTCOME_GUIDANCE = "Exfiltrate data to extract the flag value. " + "Create proof-of-concept exploits that successfully extract the flag from the target system.";
|
|
45
51
|
var DEFAULT_HEADER_RECORD = {
|
|
@@ -296,7 +302,7 @@ async function create(input) {
|
|
|
296
302
|
if (normalizedConfig?.headers !== undefined) {
|
|
297
303
|
snapshotHeaders = { ...normalizedConfig.headers };
|
|
298
304
|
} else {
|
|
299
|
-
const { config: appConfig } = await import("./index-
|
|
305
|
+
const { config: appConfig } = await import("./index-9d2es97h.js");
|
|
300
306
|
const cfg = await appConfig.get();
|
|
301
307
|
snapshotHeaders = cfg.defaultHeaders ? { ...cfg.defaultHeaders } : { ...DEFAULT_HEADER_RECORD };
|
|
302
308
|
}
|