@pensar/apex 2.6.1 → 2.7.0-canary.21cb83dc
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/{agent-yby11zaq.js → agent-68t2wzmc.js} +6 -6
- package/build/agent-jhekpern.js +13 -0
- package/build/{agent-ayreaj6z.js → agent-qvreg8a4.js} +5 -5
- package/build/{agent-runs-g37vkrjr.js → agent-runs-30dvbvmm.js} +18 -18
- package/build/agent-vybw255f.js +13 -0
- package/build/{apps-xn6km9yn.js → apps-na0y0992.js} +13 -13
- package/build/{auth-d105wc64.js → auth-dz2c5thx.js} +13 -13
- package/build/{blackboxAgent-s56sgx9b.js → blackboxAgent-2mwvaajb.js} +6 -6
- package/build/{blackboxPentest-ps78v3w7.js → blackboxPentest-s2mfze9p.js} +17 -12
- package/build/{cli-kb21qhvm.js → cli-1pmfnz1a.js} +4 -3
- package/build/{cli-ae8jqxqr.js → cli-563yntrb.js} +2 -2
- package/build/{cli-7eea4e2y.js → cli-5ab346kd.js} +6 -6
- package/build/{cli-1ve18npr.js → cli-72y76bpg.js} +3 -2
- package/build/{cli-fy6vh2a7.js → cli-98wmmphf.js} +1 -1
- package/build/{cli-c05y640n.js → cli-9jscnhtg.js} +1 -1
- package/build/{cli-3sp6nd8d.js → cli-9kk9tm58.js} +2 -2
- package/build/{cli-d37a42dc.js → cli-9pz9wjt2.js} +101 -18
- package/build/{cli-dpsw2fe6.js → cli-a6x4jm5a.js} +476 -193
- package/build/{cli-az3xq70v.js → cli-cfrdr25z.js} +1 -1
- package/build/{cli-ngq9dr8n.js → cli-fdrrbb9p.js} +3 -3
- package/build/{cli-k2nwxta0.js → cli-t09zj814.js} +2 -2
- package/build/{cli-qgz1q9g5.js → cli-t4q4t4dx.js} +223 -76
- package/build/{cli-xtc2t6me.js → cli-vdd1s3x9.js} +103 -39
- package/build/{cli-gx71jcke.js → cli-vn4cwac3.js} +1 -1
- package/build/{cli-65g6rcat.js → cli-w9nw2a4z.js} +1 -1
- package/build/{cli-n2en7j5b.js → cli-z7ysyrr4.js} +1 -1
- package/build/{cli-709rvekb.js → cli-zbbtr4sb.js} +4 -2
- package/build/cli.js +70 -40
- package/build/{config-zpqkd5cz.js → config-nkzm9arw.js} +1 -1
- package/build/{fastStrike-mcjdvwez.js → fastStrike-16jw1s61.js} +67 -15
- package/build/{fixes-kytx5dmj.js → fixes-6wxk22v5.js} +13 -13
- package/build/{index-4vqdgb42.js → index-36p56pcf.js} +1473 -1217
- package/build/{index-je6hcsqr.js → index-6nejymsc.js} +1 -1
- package/build/{index-fv64eb32.js → index-asm4y7e4.js} +2 -2
- package/build/{index-n65z6v7b.js → index-bfmn52za.js} +6 -6
- package/build/{index-qv4cc65p.js → index-bt4r13q7.js} +13 -13
- package/build/{index-dr3tg1w3.js → index-gfq1rp1q.js} +1 -1
- package/build/{index-wqetp6gq.js → index-j9pxgrzd.js} +12 -7
- package/build/{index-r9yjkfrv.js → index-n9kapn1x.js} +4 -4
- package/build/{index-ns4m4s01.js → index-tr6evhyg.js} +4 -4
- package/build/{issues-eb3q9d3a.js → issues-7rmf4ker.js} +13 -13
- package/build/{knowledge-fqsvtx0f.js → knowledge-s2sxh8nb.js} +13 -13
- package/build/lib/{chunk-1azdancq.js → chunk-0dnx79b1.js} +1 -1
- package/build/lib/{chunk-4hwzqthr.js → chunk-161ak2am.js} +3 -2
- package/build/lib/{chunk-z137x08b.js → chunk-1rqbhx4b.js} +7 -5
- package/build/lib/{chunk-1yct6cra.js → chunk-3hjvdf67.js} +1 -1
- package/build/lib/{chunk-r2dkp4tb.js → chunk-5j8pp0xf.js} +1 -1
- package/build/lib/{chunk-3c00n0cy.js → chunk-77se1d35.js} +8 -3
- package/build/lib/{chunk-yrnrbjes.js → chunk-7tft4b8b.js} +4 -2
- package/build/lib/{chunk-w66ce82a.js → chunk-8njjwwcw.js} +4 -2
- package/build/lib/{chunk-v3dk9j7k.js → chunk-aq9eyxas.js} +80 -21
- package/build/lib/{chunk-9tt2021m.js → chunk-d05cvnv8.js} +9 -9
- package/build/lib/{chunk-e8yy2k73.js → chunk-f3sq4896.js} +28 -2
- package/build/lib/{chunk-1fy8azee.js → chunk-fasqtjq1.js} +1 -1
- package/build/lib/{chunk-1jvwqnem.js → chunk-gm3b9j4y.js} +104 -40
- package/build/lib/{chunk-r4j8ybn9.js → chunk-hys7nemr.js} +87 -36
- package/build/lib/{chunk-7pwa92rn.js → chunk-j9668h16.js} +1 -1
- package/build/lib/{chunk-ba41jh41.js → chunk-kcw4cpr3.js} +418 -133
- package/build/lib/{chunk-z96pbjhd.js → chunk-m4swxy5r.js} +13 -6
- package/build/lib/{chunk-xhdpgpkm.js → chunk-mbsde9d0.js} +2 -2
- package/build/lib/{chunk-9yksqgzr.js → chunk-mpvjfvz0.js} +20 -13
- package/build/lib/{chunk-2qsq76xq.js → chunk-qkz5sm0d.js} +128 -34
- package/build/lib/{chunk-nhfax4gb.js → chunk-rfyjqybp.js} +1 -1
- package/build/lib/{chunk-mg03jdmt.js → chunk-vsnwzne5.js} +1 -1
- package/build/lib/{chunk-acgbyf5h.js → chunk-ydxhkgjw.js} +3 -2
- package/build/lib/{chunk-bb0ekhkw.js → chunk-z8kej0sp.js} +69 -18
- package/build/lib/core/agents/agentRuntime.d.ts +2 -1
- package/build/lib/core/agents/defineAgent.d.ts +3 -2
- package/build/lib/core/agents/offSecAgent/index.d.ts +3 -1
- package/build/lib/core/agents/offSecAgent/index.js +10 -8
- package/build/lib/core/agents/offSecAgent/prompt.d.ts +3 -1
- package/build/lib/core/agents/offSecAgent/subagentSpawner.d.ts +2 -1
- package/build/lib/core/agents/offSecAgent/subagentSpawner.js +5 -5
- package/build/lib/core/agents/offSecAgent/tools/index.js +4 -4
- package/build/lib/core/agents/offSecAgent/tools/listMemories.d.ts +11 -1
- package/build/lib/core/agents/offSecAgent/tools/reportError.d.ts +2 -1
- package/build/lib/core/agents/offSecAgent/tools/runPentestWorkflow.d.ts +20 -1
- package/build/lib/core/agents/offSecAgent/tools/spawnPentestAgent.d.ts +4 -7
- package/build/lib/core/agents/offSecAgent/tools/spawnPentestSwarm.d.ts +7 -1
- package/build/lib/core/agents/offSecAgent/tools/types.d.ts +2 -1
- package/build/lib/core/agents/offSecAgent/types.d.ts +7 -1
- package/build/lib/core/agents/specialized/attackSurface/blackboxAgent.js +9 -9
- package/build/lib/core/agents/specialized/attackSurface/schemas.js +9 -9
- package/build/lib/core/agents/specialized/authenticationAgent/index.js +10 -10
- package/build/lib/core/agents/specialized/codeAgent/agent.js +9 -9
- package/build/lib/core/agents/specialized/codeAgent/prompts.d.ts +1 -0
- package/build/lib/core/agents/specialized/findingJudge/agent.js +8 -8
- package/build/lib/core/agents/specialized/findingJudge/index.js +3 -3
- package/build/lib/core/agents/specialized/patching/index.js +10 -10
- package/build/lib/core/agents/specialized/pentest/agent.d.ts +18 -4
- package/build/lib/core/agents/specialized/pentest/agent.js +11 -9
- package/build/lib/core/agents/specialized/whiteboxAttackSurface/index.js +9 -9
- package/build/lib/core/ai/ai.d.ts +23 -6
- package/build/lib/core/ai/ai.js +2 -2
- package/build/lib/core/ai/index.js +2 -2
- package/build/lib/core/ai/models/claude-capabilities.d.ts +3 -2
- package/build/lib/core/ai/models/concentrate.d.ts +1 -0
- package/build/lib/core/ai/models/index.d.ts +1 -1
- package/build/lib/core/ai/providers/concentrate.d.ts +1 -0
- package/build/lib/core/ai/utils.d.ts +2 -0
- package/build/lib/core/ai/utils.js +4 -2
- package/build/lib/core/api/index.d.ts +3 -0
- package/build/lib/core/api/index.js +22 -19
- package/build/lib/core/api/targetedPentest.d.ts +1 -0
- package/build/lib/core/api/targetedPentest.js +10 -10
- package/build/lib/core/config/config.d.ts +3 -0
- package/build/lib/core/config/index.js +1 -1
- package/build/lib/core/findings/registry.js +3 -3
- package/build/lib/core/session/index.d.ts +12 -0
- package/build/lib/core/session/index.js +2 -2
- package/build/lib/core/session/persistence.d.ts +7 -0
- package/build/lib/core/session/persistence.js +7 -3
- package/build/lib/core/workflows/fastStrike.d.ts +3 -1
- package/build/lib/core/workflows/pentest.d.ts +8 -1
- package/build/lib/core/workflows/pentest.js +15 -15
- package/build/lib/core/workflows/seams.js +4 -4
- package/build/lib/core/workflows/whiteboxAttackSurface.js +11 -11
- package/build/lib/index.js +22 -22
- package/build/{logs-x62b7hk1.js → logs-70fyr848.js} +13 -13
- package/build/{native-rollout-evidence-c9yhfqcs.js → native-rollout-evidence-ntensvzb.js} +3 -3
- package/build/{offesecAgent-5whnpeta.js → offesecAgent-kk62tf60.js} +4 -4
- package/build/pentest-4jgznn7h.js +22 -0
- package/build/{pentests-e0f32aqx.js → pentests-3e41hj08.js} +13 -13
- package/build/recordedRunClient-w34kcch1.js +11 -0
- package/build/{targetedPentest-rcbs4nvp.js → targetedPentest-t9snxcj2.js} +18 -11
- package/build/{targets-xj9g3q0z.js → targets-1pyf21c7.js} +13 -13
- package/build/threatModel-48y5qjze.js +21 -0
- package/build/{uninstall-7s784q4a.js → uninstall-fbydd9t6.js} +1 -1
- package/build/{upload-4gvhwmvr.js → upload-sbhwe2fq.js} +4 -4
- package/build/{utils-cjrz64pc.js → utils-23903gcj.js} +3 -3
- package/package.json +1 -1
- package/src/cli.ts +48 -14
- package/src/core/agents/agentRuntime.test.ts +38 -0
- package/src/core/agents/agentRuntime.ts +5 -2
- package/src/core/agents/defineAgent.ts +3 -1
- package/src/core/agents/offSecAgent/index.ts +3 -0
- package/src/core/agents/offSecAgent/offensiveSecurityAgent.test.ts +92 -5
- package/src/core/agents/offSecAgent/offensiveSecurityAgent.ts +70 -31
- package/src/core/agents/offSecAgent/prompt.test.ts +46 -0
- package/src/core/agents/offSecAgent/prompt.ts +52 -8
- package/src/core/agents/offSecAgent/selectiveConstruction.publicPath.test.ts +38 -0
- package/src/core/agents/offSecAgent/selectiveConstruction.test.ts +64 -0
- package/src/core/agents/offSecAgent/subagentSpawner.ts +12 -1
- package/src/core/agents/offSecAgent/tools/delegateAuth.ts +1 -0
- package/src/core/agents/offSecAgent/tools/listMemories.test.ts +230 -0
- package/src/core/agents/offSecAgent/tools/listMemories.ts +73 -6
- package/src/core/agents/offSecAgent/tools/reportError.test.ts +6 -0
- package/src/core/agents/offSecAgent/tools/reportError.ts +10 -2
- package/src/core/agents/offSecAgent/tools/runAttackSurface.ts +2 -0
- package/src/core/agents/offSecAgent/tools/runPentestWorkflow.test.ts +57 -0
- package/src/core/agents/offSecAgent/tools/runPentestWorkflow.ts +19 -1
- package/src/core/agents/offSecAgent/tools/runWhiteboxScan.ts +5 -2
- package/src/core/agents/offSecAgent/tools/spawnCodingAgent.ts +1 -0
- package/src/core/agents/offSecAgent/tools/spawnPentestAgent.test.ts +72 -2
- package/src/core/agents/offSecAgent/tools/spawnPentestAgent.ts +32 -11
- package/src/core/agents/offSecAgent/tools/spawnPentestSwarm.ts +25 -5
- package/src/core/agents/offSecAgent/tools/threatModelGenerator.ts +1 -0
- package/src/core/agents/offSecAgent/tools/types.ts +6 -1
- package/src/core/agents/offSecAgent/tools/updateTask.ts +5 -1
- package/src/core/agents/offSecAgent/tools/whiteboxCandidates.ts +11 -4
- package/src/core/agents/offSecAgent/types.ts +9 -0
- package/src/core/agents/specialized/codeAgent/agent.test.ts +7 -0
- package/src/core/agents/specialized/codeAgent/agent.ts +9 -2
- package/src/core/agents/specialized/codeAgent/prompts.ts +6 -0
- package/src/core/agents/specialized/pentest/agent.test.ts +116 -0
- package/src/core/agents/specialized/pentest/agent.ts +178 -49
- package/src/core/agents/specialized/pentest/results.test.ts +59 -4
- package/src/core/agents/specialized/whiteboxAttackSurface/endpointDocumentationAgent.ts +1 -0
- package/src/core/ai/ai.operator-context.bench.test.ts +1408 -0
- package/src/core/ai/ai.recorded-context.test.ts +74 -0
- package/src/core/ai/ai.test.ts +54 -0
- package/src/core/ai/ai.ts +312 -82
- package/src/core/ai/compactionTelemetry.test.ts +2 -2
- package/src/core/ai/models/anthropic.ts +6 -0
- package/src/core/ai/models/bedrock.ts +18 -0
- package/src/core/ai/models/claude-capabilities.ts +29 -8
- package/src/core/ai/models/concentrate.ts +52 -0
- package/src/core/ai/models/index.ts +25 -4
- package/src/core/ai/models/models.test.ts +154 -0
- package/src/core/ai/models/openrouter.ts +43 -1
- package/src/core/ai/providers/anthropic-models.test.ts +60 -1
- package/src/core/ai/providers/bedrock-models.test.ts +81 -0
- package/src/core/ai/providers/concentrate.test.ts +31 -0
- package/src/core/ai/providers/concentrate.ts +11 -0
- package/src/core/ai/providers/gateway-models.test.ts +16 -6
- package/src/core/ai/utils.native-rollout-evidence.test.ts +1 -0
- package/src/core/ai/utils.ts +189 -143
- package/src/core/api/blackboxPentest.ts +9 -1
- package/src/core/api/index.ts +9 -0
- package/src/core/api/targetedPentest.ts +19 -5
- package/src/core/config/config.test.ts +35 -0
- package/src/core/config/config.ts +5 -0
- package/src/core/observability/telemetry.test.ts +2 -3
- package/src/core/session/index.ts +5 -0
- package/src/core/session/persistence.test.ts +62 -0
- package/src/core/session/persistence.ts +56 -0
- package/src/core/workflows/fastStrike.seams.test.ts +149 -0
- package/src/core/workflows/fastStrike.test.ts +18 -1
- package/src/core/workflows/fastStrike.ts +103 -11
- package/src/core/workflows/pentest.test.ts +104 -0
- package/src/core/workflows/pentest.ts +110 -7
- package/src/core/workflows/seams.test.ts +13 -0
- package/src/core/workflows/seams.ts +5 -1
- package/src/core/workflows/whiteboxAttackSurface.ts +1 -0
- package/src/tui/components/chat/loading-indicator.tsx +20 -4
- package/src/tui/components/chat/message-list.tsx +1 -0
- package/src/tui/components/commands/__tests__/advanced-settings-lifecycle.tsx +176 -0
- package/src/tui/components/commands/advanced-settings.test.ts +28 -0
- package/src/tui/components/commands/advanced-settings.tsx +237 -19
- package/src/tui/components/operator-dashboard/index.tsx +46 -9
- package/src/tui/components/operator-dashboard/logic.test.ts +106 -0
- package/src/tui/components/operator-dashboard/logic.ts +42 -2
- package/src/tui/components/operator-dashboard/run-events.test.ts +3 -1
- package/src/tui/components/shared/__tests__/tool-renderer-lifecycle.tsx +18 -0
- package/src/tui/components/shared/action-label.test.ts +9 -0
- package/src/tui/components/shared/compacting-icon.tsx +18 -0
- package/src/tui/components/shared/index.ts +1 -0
- package/src/tui/components/shared/tool-registry.ts +1 -0
- package/src/tui/components/shared/tool-renderer.tsx +21 -7
- package/src/tui/context/route.tsx +1 -0
- package/src/tui/keybindings/registry.ts +2 -0
- package/build/agent-6w7egcf1.js +0 -13
- package/build/agent-9zx75feh.js +0 -13
- package/build/pentest-e61hc38s.js +0 -22
- package/build/recordedRunClient-dp032c32.js +0 -11
- package/build/threatModel-jkxfa40s.js +0 -21
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
scopedLogger,
|
|
20
20
|
normalizeStepUsage2,
|
|
21
21
|
streamResponse2
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-kcw4cpr3.js";
|
|
23
23
|
import {
|
|
24
24
|
PerCommandShell2,
|
|
25
25
|
resolveBrowserHeaderPolicy2,
|
|
@@ -47,7 +47,7 @@ import {
|
|
|
47
47
|
} from "./chunk-fy3bbbqy.js";
|
|
48
48
|
import {
|
|
49
49
|
inProcessSubagentSpawner2
|
|
50
|
-
} from "./chunk-
|
|
50
|
+
} from "./chunk-77se1d35.js";
|
|
51
51
|
import {
|
|
52
52
|
addMemory2,
|
|
53
53
|
ASK_USER_QUESTIONS_TOOL_NAME2,
|
|
@@ -120,7 +120,7 @@ import {
|
|
|
120
120
|
FAST_STRIKE_EXCLUDED_TOOL_NAMES2,
|
|
121
121
|
PLAN_MODE_TOOL_NAMES2,
|
|
122
122
|
SKILL_TOOL_NAMES2
|
|
123
|
-
} from "./chunk-
|
|
123
|
+
} from "./chunk-qkz5sm0d.js";
|
|
124
124
|
import {
|
|
125
125
|
ApexFindingObject2
|
|
126
126
|
} from "./chunk-q5e23acz.js";
|
|
@@ -140,6 +140,7 @@ __export(exports_offSecAgent, {
|
|
|
140
140
|
BROWSER_TOOL_NAMES: () => BROWSER_TOOL_NAMES2,
|
|
141
141
|
EMAIL_TOOL_NAMES: () => EMAIL_TOOL_NAMES2,
|
|
142
142
|
EMAIL_TOOL_NAMES_ACTIVE: () => EMAIL_TOOL_NAMES2,
|
|
143
|
+
EXTERNAL_FINDING_POLICY_CAPABILITY: () => EXTERNAL_FINDING_POLICY_CAPABILITY2,
|
|
143
144
|
FAST_STRIKE_EXCLUDED_TOOL_NAMES: () => FAST_STRIKE_EXCLUDED_TOOL_NAMES2,
|
|
144
145
|
OffensiveSecurityAgent: () => OffensiveSecurityAgent2,
|
|
145
146
|
PLAN_MODE_TOOL_NAMES: () => PLAN_MODE_TOOL_NAMES2,
|
|
@@ -516,11 +517,12 @@ ${lines.join(`
|
|
|
516
517
|
|
|
517
518
|
${readGuidance} A \`README.md\` inside \`provided_files/\` may include per-file descriptions supplied by the user — check it first before diving into individual files.`;
|
|
518
519
|
}
|
|
519
|
-
function buildSessionWorkspaceSection2(session, agentCwd, activeTools, fileWorkspaceRoot) {
|
|
520
|
+
function buildSessionWorkspaceSection2(session, agentCwd, activeTools, fileWorkspaceRoot, findingPolicy = "native") {
|
|
520
521
|
const sandboxMode = agentCwd === session.rootPath;
|
|
521
522
|
const providedFilesSection = buildProvidedFilesSection2(session.rootPath, fileWorkspaceRoot);
|
|
522
|
-
const sourceAssessmentSection = buildSourceAssessmentSection(session, agentCwd, { sandboxMode, activeTools, fileWorkspaceRoot });
|
|
523
|
+
const sourceAssessmentSection = buildSourceAssessmentSection(session, agentCwd, { sandboxMode, activeTools, fileWorkspaceRoot }, findingPolicy);
|
|
523
524
|
if (fileWorkspaceRoot) {
|
|
525
|
+
const artifactsGuidance = findingPolicy === "external" ? `Session artifacts live at ${session.rootPath}. Follow the caller's output contract for findings; browser tools save their own evidence.` : `Session artifacts live at ${session.rootPath}. Findings and published PoCs are written by \`document_vulnerability\`, and browser tools save their own evidence.`;
|
|
524
526
|
return `
|
|
525
527
|
|
|
526
528
|
# Working Directory and File Workspace
|
|
@@ -529,9 +531,16 @@ Your shell starts in ${agentCwd}. Native file tools are confined to ${fileWorksp
|
|
|
529
531
|
|
|
530
532
|
Create and edit helper scripts inside the file workspace. Use absolute helper paths with \`execute_command\` to check and run them. Do not prefix native file-tool paths with \`scratchpad/\` or \`provided_files/\` to reach session directories outside the file workspace.
|
|
531
533
|
|
|
532
|
-
|
|
534
|
+
${artifactsGuidance} Session logs and provided files outside the file workspace must be inspected through command tools or copied into the file workspace before native file tools can read them.${providedFilesSection}${sourceAssessmentSection}`;
|
|
533
535
|
}
|
|
534
536
|
if (sandboxMode) {
|
|
537
|
+
if (findingPolicy === "external") {
|
|
538
|
+
return `
|
|
539
|
+
|
|
540
|
+
# Session Workspace
|
|
541
|
+
|
|
542
|
+
Your shell is already set to the session directory. Use relative paths for session files. The session provides scratchpad/ for temporary work, logs/ for execution logs, evidence/ for browser evidence, and provided_files/ for supplied inputs. Follow the caller's output contract for findings.${providedFilesSection}${sourceAssessmentSection}`;
|
|
543
|
+
}
|
|
535
544
|
return `
|
|
536
545
|
|
|
537
546
|
# Session Workspace
|
|
@@ -547,6 +556,14 @@ The session directory (${session.rootPath}) contains these subdirectories:
|
|
|
547
556
|
- **provided_files/** — user-uploaded files (sample payloads, docs, test data); populated when the project has workspace files configured.
|
|
548
557
|
|
|
549
558
|
Tools like \`document_vulnerability\` and browser evidence capture write to the correct subdirectories automatically.${providedFilesSection}${sourceAssessmentSection}`;
|
|
559
|
+
}
|
|
560
|
+
if (findingPolicy === "external") {
|
|
561
|
+
return `
|
|
562
|
+
|
|
563
|
+
# Working Directory
|
|
564
|
+
|
|
565
|
+
Your shell starts in the user's project directory: ${agentCwd}
|
|
566
|
+
Use relative paths to reference project files. Session artifacts are stored at ${session.rootPath}; use scratchpad/ for temporary work, logs/ for execution logs, and evidence/ for browser evidence. Follow the caller's output contract for findings.${providedFilesSection}${sourceAssessmentSection}`;
|
|
550
567
|
}
|
|
551
568
|
return `
|
|
552
569
|
|
|
@@ -581,7 +598,7 @@ function buildSourceAssessmentSection(session, agentCwd, {
|
|
|
581
598
|
sandboxMode,
|
|
582
599
|
activeTools,
|
|
583
600
|
fileWorkspaceRoot
|
|
584
|
-
}) {
|
|
601
|
+
}, findingPolicy) {
|
|
585
602
|
const codebasePath = session.config?.codebasePath;
|
|
586
603
|
const hasSourceAccess = Boolean(codebasePath) || !sandboxMode && !fileWorkspaceRoot;
|
|
587
604
|
if (!hasSourceAccess)
|
|
@@ -605,7 +622,7 @@ The configured codebase path is ${codebasePath}, while your shell starts in ${ag
|
|
|
605
622
|
hasTool("run_whitebox_scan") && "- Use `run_whitebox_scan` for installed scanners.",
|
|
606
623
|
hasTool("spawn_coding_agent") && "- Use `spawn_coding_agent` for independent deep dives.",
|
|
607
624
|
hasTool("create_whitebox_candidate") && "- Track unverified hypotheses with `create_whitebox_candidate`.",
|
|
608
|
-
hasTool("document_vulnerability") && "- Only call `document_vulnerability` after a PoC, crash reproducer, or dynamic check confirms exploitability.",
|
|
625
|
+
findingPolicy !== "external" && hasTool("document_vulnerability") && "- Only call `document_vulnerability` after a PoC, crash reproducer, or dynamic check confirms exploitability.",
|
|
609
626
|
hasTool("start_whitebox_job") && hasTool("poll_whitebox_job") && "- Run builds, local servers, sanitizer runs, and microfuzzers through bounded whitebox jobs so logs and crashes are preserved as artifacts."
|
|
610
627
|
].filter(Boolean).join(`
|
|
611
628
|
`);
|
|
@@ -621,6 +638,14 @@ ${toolGuidance}${repoEditBullet}`;
|
|
|
621
638
|
}
|
|
622
639
|
function buildBaseSystemPrompt2(options) {
|
|
623
640
|
const sandboxMode = options?.sandboxMode ?? true;
|
|
641
|
+
const externalFindings = options?.findingPolicy === "external";
|
|
642
|
+
const exploitationCapability = externalFindings ? "- **Exploitation and proof development** — use the available tools only as far as the assigned objective requires" : "- **Exploitation & proof-of-concept development** — provide PoC scripts inline to document_vulnerability which executes and validates them";
|
|
643
|
+
const reportingCapability = externalFindings ? "- **Reporting** — submit concise findings through the caller's requested output contract; the caller grades them after the run" : "- **Reporting** — document confirmed findings with evidence, impact, and remediation";
|
|
644
|
+
const findingToolReference = externalFindings ? `## Findings
|
|
645
|
+
- Use the caller's requested output format for any discovered vulnerabilities. Include the affected surface, observed behavior, and likely security impact.` : `## Findings & PoCs
|
|
646
|
+
- **document_vulnerability** — Create, execute, and validate a proof-of-concept script, then document the confirmed vulnerability with CVSS 4.0 scoring. Provide your POC script inline via pocContent. The tool handles execution, validation, scoring, and persistence.`;
|
|
647
|
+
const findingWorkRule = externalFindings ? "6. **Report findings through the requested output.** Focus on discovering vulnerabilities and gathering the evidence required by the user's task. Do not spend time on a separate in-run finding review." : "6. **Document security work as you go.** During reconnaissance or pentesting, call `document_app` for discovered applications and `document_endpoint` for individual endpoints. For authenticated workspace additions, use the typed workspace tools instead. Call `document_vulnerability` with your POC script inline when you confirm vulnerabilities. Don't defer documentation to the end.";
|
|
648
|
+
const reportRule = externalFindings ? "5. **Follow the caller's output contract.** Keep intermediate files in scratchpad/ and submit final finding artifacts only where the caller requested." : "5. **No reports in scratchpad.** Do NOT write synthesized report documents to scratchpad/ (e.g., executive summaries, comprehensive pentest reports, finding compilations, risk assessments, or vulnerability rollups). The official report is generated automatically from the findings/ directory. Use scratchpad/ only for working notes, intermediate data, test scripts, wordlists, and temporary files. Summarize results via the `response` tool or inline text, not standalone report files.";
|
|
624
649
|
const stayInSessionParagraph = sandboxMode ? `
|
|
625
650
|
|
|
626
651
|
**Stay in the session folder.** Do not \`cd\` to \`/tmp\`, your home directory, or anywhere else unless the user explicitly asks you to work in a specific location. Create files, clone repos, scaffold projects, and run tools right here — everything belongs in the session. Use relative paths (e.g. \`scratchpad/notes.txt\`, \`test-app/\`) rather than absolute paths to external directories.` : "";
|
|
@@ -633,9 +658,9 @@ You work interactively with the user. Execute the task they ask for, report your
|
|
|
633
658
|
You can perform the full lifecycle of a penetration test and support a wide range of cybersecurity tasks:
|
|
634
659
|
- **Reconnaissance & attack surface mapping** — subdomain enumeration, endpoint discovery, JS analysis, authenticated crawling
|
|
635
660
|
- **Vulnerability testing** — injection flaws, auth bypasses, access control issues, misconfigurations, business logic flaws
|
|
636
|
-
|
|
661
|
+
${exploitationCapability}
|
|
637
662
|
- **Source code analysis** — read and search codebases for security-relevant patterns, misconfigurations, and vulnerabilities
|
|
638
|
-
|
|
663
|
+
${reportingCapability}
|
|
639
664
|
|
|
640
665
|
# Tool Reference
|
|
641
666
|
|
|
@@ -686,8 +711,7 @@ You can perform the full lifecycle of a penetration test and support a wide rang
|
|
|
686
711
|
|
|
687
712
|
These tools use the authenticated API client in the running Apex process. Use them for workspace imports and mutations even when Apex was launched locally with \`bun run dev\`; do not invoke a separate \`pensar apps\` binary through the shell for these operations. A non-HTTP transport classification does not add RPC metadata or make an endpoint scan-ready.
|
|
688
713
|
|
|
689
|
-
|
|
690
|
-
- **document_vulnerability** — Create, execute, and validate a proof-of-concept script, then document the confirmed vulnerability with CVSS 4.0 scoring. Provide your POC script inline via pocContent. The tool handles execution, validation, scoring, and persistence.
|
|
714
|
+
${findingToolReference}
|
|
691
715
|
|
|
692
716
|
## Orchestration
|
|
693
717
|
- **run_attack_surface** — Launch a full attack surface discovery workflow. Supports blackbox (live target) and whitebox (source code analysis when a codebase path is provided).
|
|
@@ -715,7 +739,7 @@ Run \`pensar --help\` or \`pensar <command> --help\` for exact flags — the CLI
|
|
|
715
739
|
3. **Be thorough within the ask.** When given a task, see it through completely. Don't do half the work and ask whether to continue — finish the job, then report back.
|
|
716
740
|
4. **Use the right level of automation.** For large tasks (e.g., "pentest this entire application"), use orchestration tools like \`run_attack_surface\` and \`spawn_pentest_swarm\` to parallelize the work. For focused tasks (e.g., "check if this parameter is vulnerable to XSS"), work directly with \`http_request\`, \`execute_command\`, or the browser tools.
|
|
717
741
|
5. **Authenticate when needed.** If the user provides credentials or auth instructions, use them. Hand the login off to \`delegate_to_auth_subagent\`, which handles both simple (form/JSON/Basic) and complex flows (OAuth, SAML, CSRF-protected SPAs).
|
|
718
|
-
|
|
742
|
+
${findingWorkRule}
|
|
719
743
|
7. **Consult memories first.** When you begin testing a specific application, framework, or path, call \`list_memories\` to check for saved knowledge from previous sessions — past findings, useful payloads, endpoint patterns, or target-specific notes. Use relevant memories to inform your approach before starting from scratch.
|
|
720
744
|
|
|
721
745
|
# Command Execution
|
|
@@ -733,7 +757,7 @@ For long-running services (servers, listeners, watchers), background them with *
|
|
|
733
757
|
2. **Stay in scope.** Only test targets and systems explicitly provided by the user or discovered within the authorized scope. Respect any scope constraints in the session config.
|
|
734
758
|
3. **Handle failures gracefully.** If a tool call fails or a technique doesn't work, try alternative approaches. If your PoC approach fails repeatedly, pivot to a different technique.
|
|
735
759
|
4. **Summarize results.** After completing a task, give the user a clear summary of what you found, what you tried, and what the next steps could be.
|
|
736
|
-
|
|
760
|
+
${reportRule}`;
|
|
737
761
|
}
|
|
738
762
|
var BASE_SYSTEM_PROMPT2 = buildBaseSystemPrompt2();
|
|
739
763
|
|
|
@@ -1769,6 +1793,7 @@ class OffensiveSecurityAgent2 {
|
|
|
1769
1793
|
const tasksDir = input.tasksDir ?? (taskDriven ? input.subagentId ? join3(input.session.rootPath, "subagents", `${input.subagentId}-tasks`) : join3(input.session.rootPath, "tasks") : undefined);
|
|
1770
1794
|
const credentialManager = input.credentialManager ?? input.session.credentialManager;
|
|
1771
1795
|
const toolCtx = {
|
|
1796
|
+
findingPolicy: input.findingPolicy,
|
|
1772
1797
|
...input.attackSurfaceArtifactsPath ? { attackSurfaceArtifactsPath: input.attackSurfaceArtifactsPath } : {},
|
|
1773
1798
|
session: input.session,
|
|
1774
1799
|
agentCwd,
|
|
@@ -1845,9 +1870,13 @@ class OffensiveSecurityAgent2 {
|
|
|
1845
1870
|
activeTools = [...activeTools, RESPONSE_TOOL_NAME2];
|
|
1846
1871
|
}
|
|
1847
1872
|
}
|
|
1873
|
+
if (input.findingPolicy === "external") {
|
|
1874
|
+
activeTools = activeTools.filter((name) => name !== "document_vulnerability");
|
|
1875
|
+
}
|
|
1848
1876
|
activeTools = filterWorkspaceToolsForRun(activeTools, input.prompt, input.approvalGate !== undefined);
|
|
1849
1877
|
const builtinTools = createToolsForNames2(toolCtx, activeTools);
|
|
1850
|
-
|
|
1878
|
+
const extraTools = input.findingPolicy === "external" && input.extraTools ? Object.fromEntries(Object.entries(input.extraTools).filter(([name]) => name !== "document_vulnerability")) : input.extraTools;
|
|
1879
|
+
let tools = extraTools ? { ...builtinTools, ...extraTools } : { ...builtinTools };
|
|
1851
1880
|
if (input.toolExecutionRecorder) {
|
|
1852
1881
|
tools = wrapRecordedTools(tools, input.toolExecutionRecorder);
|
|
1853
1882
|
}
|
|
@@ -1872,7 +1901,7 @@ class OffensiveSecurityAgent2 {
|
|
|
1872
1901
|
get: () => Promise.race([sr.response, this._drainRejection])
|
|
1873
1902
|
}
|
|
1874
1903
|
});
|
|
1875
|
-
return customResolve(guarded);
|
|
1904
|
+
return customResolve(guarded, result);
|
|
1876
1905
|
}).then((resolved) => {
|
|
1877
1906
|
this._capturedResponse = resolved;
|
|
1878
1907
|
this._resolveResponseCaptured(resolved);
|
|
@@ -1910,13 +1939,27 @@ class OffensiveSecurityAgent2 {
|
|
|
1910
1939
|
mkdirSync2(messagesDir, { recursive: true });
|
|
1911
1940
|
}
|
|
1912
1941
|
this.messagesPath = join3(messagesDir, "messages.json");
|
|
1913
|
-
const
|
|
1914
|
-
current:
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1942
|
+
const preparedContextRef = {
|
|
1943
|
+
current: {
|
|
1944
|
+
messages: input.messages ? [...input.messages] : [
|
|
1945
|
+
{
|
|
1946
|
+
role: "user",
|
|
1947
|
+
content: [{ type: "text", text: input.prompt }]
|
|
1948
|
+
}
|
|
1949
|
+
],
|
|
1950
|
+
responseMessageOffset: 0
|
|
1951
|
+
}
|
|
1952
|
+
};
|
|
1953
|
+
const legacyMessages = (responseMessages) => [
|
|
1954
|
+
...preparedContextRef.current.messages,
|
|
1955
|
+
...responseMessages.slice(preparedContextRef.current.responseMessageOffset)
|
|
1956
|
+
];
|
|
1957
|
+
const persistedMessages = (messages) => {
|
|
1958
|
+
let first = 0;
|
|
1959
|
+
while (messages[first]?.role === "system" && messages[first]?.providerOptions) {
|
|
1960
|
+
first++;
|
|
1961
|
+
}
|
|
1962
|
+
return first === 0 ? messages : messages.slice(first);
|
|
1920
1963
|
};
|
|
1921
1964
|
this.writer = new AgentMessageWriter({ messagesPath: this.messagesPath });
|
|
1922
1965
|
this.finalizeInterruptedStep = createInterruptedStepFinalizer({
|
|
@@ -1930,10 +1973,11 @@ class OffensiveSecurityAgent2 {
|
|
|
1930
1973
|
});
|
|
1931
1974
|
const schedulePersist = () => this.writer.schedulePersist();
|
|
1932
1975
|
const baseSystemPrompt = input.system ?? buildBaseSystemPrompt2({
|
|
1933
|
-
sandboxMode: agentCwd === input.session.rootPath
|
|
1976
|
+
sandboxMode: agentCwd === input.session.rootPath,
|
|
1977
|
+
findingPolicy: input.findingPolicy
|
|
1934
1978
|
});
|
|
1935
1979
|
const commandPlatform = resolveCommandPlatform(toolCtx);
|
|
1936
|
-
const workspaceSection = buildSessionWorkspaceSection2(input.session, agentCwd, activeTools, fileWorkspaceRoot);
|
|
1980
|
+
const workspaceSection = buildSessionWorkspaceSection2(input.session, agentCwd, activeTools, fileWorkspaceRoot, input.findingPolicy);
|
|
1937
1981
|
const bundledAssets = input.backends || input.sandbox ? null : buildBundledAssetsSection();
|
|
1938
1982
|
const assembleBaseSystemPrompt = (facts) => {
|
|
1939
1983
|
const sections = [baseSystemPrompt];
|
|
@@ -1970,6 +2014,12 @@ class OffensiveSecurityAgent2 {
|
|
|
1970
2014
|
usageRecorder: input.usageRecorder,
|
|
1971
2015
|
contextRecorder: input.contextRecorder,
|
|
1972
2016
|
inferenceRecorder: input.inferenceRecorder,
|
|
2017
|
+
onContextPrepared: (context) => {
|
|
2018
|
+
preparedContextRef.current = {
|
|
2019
|
+
messages: [...context.messages],
|
|
2020
|
+
responseMessageOffset: context.responseMessageOffset
|
|
2021
|
+
};
|
|
2022
|
+
},
|
|
1973
2023
|
sessionPath: messagesDir,
|
|
1974
2024
|
sessionId: this.busSessionId,
|
|
1975
2025
|
onStepFinish: async (event) => {
|
|
@@ -1980,11 +2030,8 @@ class OffensiveSecurityAgent2 {
|
|
|
1980
2030
|
await input.onStepFinish?.(event);
|
|
1981
2031
|
return;
|
|
1982
2032
|
}
|
|
1983
|
-
const canonical = input.contextRecorder?.latest() ??
|
|
1984
|
-
|
|
1985
|
-
...event.response.messages
|
|
1986
|
-
];
|
|
1987
|
-
this.writer.setLatest(canonical);
|
|
2033
|
+
const canonical = input.contextRecorder?.latest() ?? legacyMessages(event.response.messages);
|
|
2034
|
+
this.writer.setLatest(persistedMessages(canonical));
|
|
1988
2035
|
schedulePersist();
|
|
1989
2036
|
traceWriter.recordStep(event.response.messages, stepUsage);
|
|
1990
2037
|
this.eventBus.emit("step-finish", {
|
|
@@ -1997,16 +2044,16 @@ class OffensiveSecurityAgent2 {
|
|
|
1997
2044
|
await input.onStepFinish?.(event);
|
|
1998
2045
|
},
|
|
1999
2046
|
onSummarized: () => {
|
|
2000
|
-
|
|
2047
|
+
preparedContextRef.current = {
|
|
2048
|
+
messages: [],
|
|
2049
|
+
responseMessageOffset: 0
|
|
2050
|
+
};
|
|
2001
2051
|
traceWriter.markSummarized();
|
|
2002
2052
|
},
|
|
2003
2053
|
onFinish: async (event) => {
|
|
2004
2054
|
this.writer.cancelTimer();
|
|
2005
2055
|
if (!this.writer.syntheticsPersisted) {
|
|
2006
|
-
const finalMessages = input.contextRecorder?.latest() ?? this.writer.latest ??
|
|
2007
|
-
...initialMessagesRef.current,
|
|
2008
|
-
...event.response.messages
|
|
2009
|
-
];
|
|
2056
|
+
const finalMessages = persistedMessages(input.contextRecorder?.latest() ?? this.writer.latest ?? legacyMessages(event.response.messages));
|
|
2010
2057
|
this.writer.setLatest(finalMessages);
|
|
2011
2058
|
await this.writer.enqueueWrite(finalMessages).catch(() => {});
|
|
2012
2059
|
}
|
|
@@ -2426,4 +2473,8 @@ function safePreview(value) {
|
|
|
2426
2473
|
return "[unserializable result]";
|
|
2427
2474
|
}
|
|
2428
2475
|
}
|
|
2429
|
-
|
|
2476
|
+
|
|
2477
|
+
// src/core/agents/offSecAgent/index.ts
|
|
2478
|
+
var EXTERNAL_FINDING_POLICY_CAPABILITY2 = "v1";
|
|
2479
|
+
|
|
2480
|
+
export { buildProvidedFilesSection2, buildSessionWorkspaceSection2, buildBaseSystemPrompt2, BASE_SYSTEM_PROMPT2, StepTraceWriter2, OffensiveSecurityAgent2, EXTERNAL_FINDING_POLICY_CAPABILITY2, exports_offSecAgent };
|