@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
|
@@ -1,30 +1,37 @@
|
|
|
1
|
-
import"./cli-
|
|
2
|
-
import"./cli-
|
|
3
|
-
import"./cli-
|
|
1
|
+
import"./cli-98wmmphf.js";
|
|
2
|
+
import"./cli-9jscnhtg.js";
|
|
3
|
+
import"./cli-t4q4t4dx.js";
|
|
4
4
|
import {
|
|
5
5
|
TargetedPentestAgent2
|
|
6
|
-
} from "./cli-
|
|
6
|
+
} from "./cli-vdd1s3x9.js";
|
|
7
7
|
import {
|
|
8
8
|
startAgentExecution
|
|
9
9
|
} from "./cli-g06s7edq.js";
|
|
10
|
-
import"./cli-
|
|
10
|
+
import"./cli-72y76bpg.js";
|
|
11
11
|
import"./cli-qba2x69h.js";
|
|
12
|
-
import"./cli-
|
|
12
|
+
import"./cli-a6x4jm5a.js";
|
|
13
13
|
import"./cli-c2k4xxaw.js";
|
|
14
14
|
|
|
15
15
|
// src/core/api/targetedPentest.ts
|
|
16
|
-
function normalizeResult(result) {
|
|
16
|
+
function normalizeResult(result, findingPolicy) {
|
|
17
17
|
const r = result;
|
|
18
18
|
if (!r || !Array.isArray(r.findings)) {
|
|
19
19
|
console.error("runTargetedPentestAgent: consume() returned unexpected shape", { keys: result ? Object.keys(result) : null });
|
|
20
20
|
}
|
|
21
21
|
const findings = Array.isArray(r?.findings) ? r.findings : [];
|
|
22
|
-
|
|
22
|
+
const reportedFindings = Array.isArray(r?.reportedFindings) ? r.reportedFindings : [];
|
|
23
|
+
if (findingPolicy === "external") {
|
|
24
|
+
console.log(`
|
|
25
|
+
Reported ${reportedFindings.length} finding(s) for external evaluation`);
|
|
26
|
+
} else {
|
|
27
|
+
console.log(`
|
|
23
28
|
Found ${findings.length} vulnerabilities`);
|
|
24
|
-
|
|
25
|
-
|
|
29
|
+
console.log(`Findings: ${r?.findingsPath}`);
|
|
30
|
+
console.log(`POCs: ${r?.pocsPath}`);
|
|
31
|
+
}
|
|
26
32
|
return {
|
|
27
33
|
findings,
|
|
34
|
+
...findingPolicy === "external" ? { reportedFindings } : {},
|
|
28
35
|
findingsPath: r?.findingsPath,
|
|
29
36
|
pocsPath: r?.pocsPath,
|
|
30
37
|
objectiveResults: r?.objectiveResults,
|
|
@@ -41,7 +48,7 @@ function startTargetedPentestAgent(input) {
|
|
|
41
48
|
}
|
|
42
49
|
const { result, abortAndDrain, drained } = startAgentExecution(agent);
|
|
43
50
|
return {
|
|
44
|
-
result: result.then(normalizeResult),
|
|
51
|
+
result: result.then((value) => normalizeResult(value, input.findingPolicy)),
|
|
45
52
|
abortAndDrain,
|
|
46
53
|
drained
|
|
47
54
|
};
|
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
|
-
import"./cli-
|
|
3
|
-
import"./cli-
|
|
2
|
+
import"./cli-t4q4t4dx.js";
|
|
3
|
+
import"./cli-98wmmphf.js";
|
|
4
|
+
import"./cli-9jscnhtg.js";
|
|
4
5
|
import {
|
|
5
6
|
listPentestTargets2,
|
|
6
7
|
listTargetLogs2,
|
|
7
8
|
searchTargetLogs2
|
|
8
|
-
} from "./cli-
|
|
9
|
-
import"./cli-
|
|
10
|
-
import"./cli-
|
|
11
|
-
import"./cli-
|
|
12
|
-
import"./cli-
|
|
13
|
-
import"./cli-
|
|
14
|
-
import"./cli-
|
|
15
|
-
import"./cli-
|
|
16
|
-
import"./cli-n2en7j5b.js";
|
|
9
|
+
} from "./cli-5ab346kd.js";
|
|
10
|
+
import"./cli-t09zj814.js";
|
|
11
|
+
import"./cli-1pmfnz1a.js";
|
|
12
|
+
import"./cli-fdrrbb9p.js";
|
|
13
|
+
import"./cli-9pz9wjt2.js";
|
|
14
|
+
import"./cli-9kk9tm58.js";
|
|
15
|
+
import"./cli-vdd1s3x9.js";
|
|
16
|
+
import"./cli-z7ysyrr4.js";
|
|
17
17
|
import"./cli-xcy2vxj2.js";
|
|
18
18
|
import {
|
|
19
19
|
markCommandFailed
|
|
20
20
|
} from "./cli-z82n3qk1.js";
|
|
21
|
-
import"./cli-
|
|
21
|
+
import"./cli-72y76bpg.js";
|
|
22
22
|
import"./cli-qba2x69h.js";
|
|
23
|
-
import"./cli-
|
|
23
|
+
import"./cli-a6x4jm5a.js";
|
|
24
24
|
import"./cli-c2k4xxaw.js";
|
|
25
25
|
|
|
26
26
|
// src/cli/targets.ts
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import"./cli-t4q4t4dx.js";
|
|
2
|
+
import"./cli-98wmmphf.js";
|
|
3
|
+
import"./cli-9jscnhtg.js";
|
|
4
|
+
import {
|
|
5
|
+
runThreatModelWorkflow2
|
|
6
|
+
} from "./cli-5ab346kd.js";
|
|
7
|
+
import"./cli-t09zj814.js";
|
|
8
|
+
import"./cli-1pmfnz1a.js";
|
|
9
|
+
import"./cli-fdrrbb9p.js";
|
|
10
|
+
import"./cli-9pz9wjt2.js";
|
|
11
|
+
import"./cli-9kk9tm58.js";
|
|
12
|
+
import"./cli-vdd1s3x9.js";
|
|
13
|
+
import"./cli-z7ysyrr4.js";
|
|
14
|
+
import"./cli-xcy2vxj2.js";
|
|
15
|
+
import"./cli-72y76bpg.js";
|
|
16
|
+
import"./cli-qba2x69h.js";
|
|
17
|
+
import"./cli-a6x4jm5a.js";
|
|
18
|
+
import"./cli-c2k4xxaw.js";
|
|
19
|
+
export {
|
|
20
|
+
runThreatModelWorkflow2 as runThreatModelWorkflow
|
|
21
|
+
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import"./cli-
|
|
2
|
-
import"./cli-
|
|
1
|
+
import"./cli-98wmmphf.js";
|
|
2
|
+
import"./cli-9jscnhtg.js";
|
|
3
3
|
import {
|
|
4
4
|
resolveConfig,
|
|
5
5
|
createWeaveTracer
|
|
6
|
-
} from "./cli-
|
|
7
|
-
import"./cli-
|
|
6
|
+
} from "./cli-cfrdr25z.js";
|
|
7
|
+
import"./cli-a6x4jm5a.js";
|
|
8
8
|
import"./cli-c2k4xxaw.js";
|
|
9
9
|
|
|
10
10
|
// src/core/integrations/wandb/upload.ts
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import"./cli-
|
|
2
|
-
import"./cli-
|
|
1
|
+
import"./cli-98wmmphf.js";
|
|
2
|
+
import"./cli-9jscnhtg.js";
|
|
3
3
|
import {
|
|
4
4
|
init_types
|
|
5
5
|
} from "./cli-3gt761d2.js";
|
|
6
6
|
import {
|
|
7
7
|
AVAILABLE_MODELS,
|
|
8
8
|
init_ai
|
|
9
|
-
} from "./cli-
|
|
9
|
+
} from "./cli-a6x4jm5a.js";
|
|
10
10
|
import"./cli-c2k4xxaw.js";
|
|
11
11
|
|
|
12
12
|
// src/core/providers/utils.ts
|
package/package.json
CHANGED
package/src/cli.ts
CHANGED
|
@@ -301,6 +301,7 @@ pentest options:
|
|
|
301
301
|
--task-driven Enable task-driven architecture (experimental)
|
|
302
302
|
--fast-strike Single-operator fast strike: skip attack-surface/swarm
|
|
303
303
|
phases, one tight recon→exploit loop against the target
|
|
304
|
+
--external-findings Return findings without Apex's in-run finding judge
|
|
304
305
|
--prompt <text|@file> Guidance for the pentest agent (inline text or @filepath)
|
|
305
306
|
--threat-model <text|@file> Threat model to guide the pentest (inline or @filepath)
|
|
306
307
|
--header "Name: Value" Custom HTTP header (repeatable)
|
|
@@ -366,6 +367,7 @@ async function runPentest() {
|
|
|
366
367
|
const enableThinking = hasFlag("--extended-thinking");
|
|
367
368
|
const taskDriven = hasFlag("--task-driven");
|
|
368
369
|
const fastStrike = hasFlag("--fast-strike");
|
|
370
|
+
const externalFindings = hasFlag("--external-findings");
|
|
369
371
|
const evidenceOutput = nativeRolloutEvidenceOutput();
|
|
370
372
|
|
|
371
373
|
// Resolve and combine threat model + prompt
|
|
@@ -395,7 +397,7 @@ async function runPentest() {
|
|
|
395
397
|
PENTEST ORCHESTRATION
|
|
396
398
|
${sep}
|
|
397
399
|
Target: ${target}${cwd ? `\nCwd: ${cwd} (whitebox)` : ""}${exfilMode ? "\nMode: exfil" : ""}
|
|
398
|
-
Model: ${model}${enableThinking ? "\nThinking: enabled" : ""}${taskDriven ? "\nTask-driven: enabled" : ""}${fastStrike ? "\nFast strike: enabled" : ""}${headers ? `\nHeaders: ${Object.keys(headers).length} configured` : ""}
|
|
400
|
+
Model: ${model}${enableThinking ? "\nThinking: enabled" : ""}${taskDriven ? "\nTask-driven: enabled" : ""}${fastStrike ? "\nFast strike: enabled" : ""}${externalFindings ? "\nFindings: external evaluation" : ""}${headers ? `\nHeaders: ${Object.keys(headers).length} configured` : ""}
|
|
399
401
|
`);
|
|
400
402
|
|
|
401
403
|
const session = await sessions.create({
|
|
@@ -424,26 +426,58 @@ Model: ${model}${enableThinking ? "\nThinking: enabled" : ""}${taskDriven ? "\
|
|
|
424
426
|
const { bus: pentestBus, cleanup: wandbCleanup } =
|
|
425
427
|
await createInstrumentedBus(session, model);
|
|
426
428
|
try {
|
|
427
|
-
const {
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
429
|
+
const {
|
|
430
|
+
findings,
|
|
431
|
+
findingsPath,
|
|
432
|
+
pocsPath,
|
|
433
|
+
reportPath,
|
|
434
|
+
reportedFindings,
|
|
435
|
+
objectiveResults,
|
|
436
|
+
submissionJson,
|
|
437
|
+
solved,
|
|
438
|
+
summary,
|
|
439
|
+
} = await runPentestAgent({
|
|
440
|
+
target,
|
|
441
|
+
...(cwd ? { cwd } : {}),
|
|
442
|
+
session,
|
|
443
|
+
model,
|
|
444
|
+
enableThinking,
|
|
445
|
+
...(externalFindings ? { findingPolicy: "external" as const } : {}),
|
|
446
|
+
...(fastStrike ? { fastStrike: true } : {}),
|
|
447
|
+
surfaceIntegrationEnabled: pensarConfig.surfaceIntegrationEnabled,
|
|
448
|
+
authConfig: buildAuthConfig(pensarConfig),
|
|
449
|
+
eventBus: pentestBus,
|
|
450
|
+
});
|
|
439
451
|
|
|
440
|
-
|
|
452
|
+
if (externalFindings) {
|
|
453
|
+
console.log(`
|
|
454
|
+
${sep}
|
|
455
|
+
RESULTS
|
|
456
|
+
${sep}
|
|
457
|
+
Findings: ${reportedFindings?.length ?? 0}
|
|
458
|
+
Evaluation: external`);
|
|
459
|
+
console.log(
|
|
460
|
+
JSON.stringify(
|
|
461
|
+
{
|
|
462
|
+
reportedFindings: reportedFindings ?? [],
|
|
463
|
+
...(objectiveResults ? { objectiveResults } : {}),
|
|
464
|
+
...(submissionJson ? { submissionJson } : {}),
|
|
465
|
+
...(solved === undefined ? {} : { solved }),
|
|
466
|
+
...(summary === undefined ? {} : { summary }),
|
|
467
|
+
},
|
|
468
|
+
null,
|
|
469
|
+
2,
|
|
470
|
+
),
|
|
471
|
+
);
|
|
472
|
+
} else {
|
|
473
|
+
console.log(`
|
|
441
474
|
${sep}
|
|
442
475
|
RESULTS
|
|
443
476
|
${sep}
|
|
444
477
|
Findings: ${findings.length}
|
|
445
478
|
Path: ${findingsPath}
|
|
446
479
|
POCs: ${pocsPath}${reportPath ? `\nReport: ${reportPath}` : ""}`);
|
|
480
|
+
}
|
|
447
481
|
} finally {
|
|
448
482
|
await wandbCleanup();
|
|
449
483
|
}
|
|
@@ -175,6 +175,42 @@ describe("AgentRuntime — hook forwarding", () => {
|
|
|
175
175
|
|
|
176
176
|
expect(constructorCalls[0]!.stopWhen).toBe(callerStopWhen);
|
|
177
177
|
});
|
|
178
|
+
|
|
179
|
+
it("forwards an executed response tool's validated result to the definition resolver", () => {
|
|
180
|
+
constructorCalls.length = 0;
|
|
181
|
+
const opts: FakeOpts = {
|
|
182
|
+
model: "test-model" as AIModel,
|
|
183
|
+
// biome-ignore lint/suspicious/noExplicitAny: minimal SessionInfo stand-in
|
|
184
|
+
session: { rootPath: "/tmp", targets: [] } as any,
|
|
185
|
+
objective: "find a weakness",
|
|
186
|
+
};
|
|
187
|
+
const resolveResult = vi.fn(() => ({ reportedFindings: ["verified"] }));
|
|
188
|
+
const definition = defineAgent<FakeOpts, { reportedFindings: string[] }>({
|
|
189
|
+
name: "test-agent",
|
|
190
|
+
role: "worker",
|
|
191
|
+
prompt: (input) => input.objective,
|
|
192
|
+
activeTools: () => ["response"],
|
|
193
|
+
resolveResult,
|
|
194
|
+
});
|
|
195
|
+
|
|
196
|
+
new AgentRuntime(definition, opts);
|
|
197
|
+
|
|
198
|
+
const streamResult = { response: Promise.resolve({ messages: [] }) };
|
|
199
|
+
const validatedResponse = { reportedFindings: ["verified"] };
|
|
200
|
+
const forwarded = constructorCalls[0]?.resolveResult;
|
|
201
|
+
if (typeof forwarded !== "function") {
|
|
202
|
+
throw new Error("Missing forwarded result resolver");
|
|
203
|
+
}
|
|
204
|
+
expect(forwarded(streamResult, validatedResponse)).toEqual(
|
|
205
|
+
validatedResponse,
|
|
206
|
+
);
|
|
207
|
+
expect(resolveResult).toHaveBeenCalledWith(
|
|
208
|
+
opts,
|
|
209
|
+
undefined,
|
|
210
|
+
streamResult,
|
|
211
|
+
validatedResponse,
|
|
212
|
+
);
|
|
213
|
+
});
|
|
178
214
|
});
|
|
179
215
|
|
|
180
216
|
describe("assembleAgentHooks — compile-time completeness", () => {
|
|
@@ -197,6 +233,7 @@ describe("assembleAgentHooks — compile-time completeness", () => {
|
|
|
197
233
|
"abortSignal",
|
|
198
234
|
"extraTools",
|
|
199
235
|
"sandbox",
|
|
236
|
+
"findingPolicy",
|
|
200
237
|
].sort(),
|
|
201
238
|
);
|
|
202
239
|
});
|
|
@@ -217,6 +254,7 @@ describe("assembleAgentHooks — compile-time completeness", () => {
|
|
|
217
254
|
abortSignal: undefined,
|
|
218
255
|
extraTools: undefined,
|
|
219
256
|
sandbox: undefined,
|
|
257
|
+
findingPolicy: undefined,
|
|
220
258
|
};
|
|
221
259
|
expectTypeOf(complete).toEqualTypeOf<RequiredAgentHooks>();
|
|
222
260
|
|
|
@@ -13,7 +13,7 @@ import type { SubagentSpawner } from "./offSecAgent/subagentSpawner";
|
|
|
13
13
|
import type { EmailAdapterResolver } from "./offSecAgent/tools/email/adapters";
|
|
14
14
|
import type { UnifiedSandbox } from "./offSecAgent/tools/sandbox";
|
|
15
15
|
import type { SmsInbox } from "./offSecAgent/tools/smsInbox";
|
|
16
|
-
import type { StreamIdFactory } from "./offSecAgent/types";
|
|
16
|
+
import type { FindingPolicy, StreamIdFactory } from "./offSecAgent/types";
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
19
|
* {@link AgentHooks} with every key required (value types keep their
|
|
@@ -23,6 +23,7 @@ import type { StreamIdFactory } from "./offSecAgent/types";
|
|
|
23
23
|
* "dropping a hook is a type error".
|
|
24
24
|
*/
|
|
25
25
|
export interface RequiredAgentHooks {
|
|
26
|
+
findingPolicy: FindingPolicy | undefined;
|
|
26
27
|
backends: ToolBackends | undefined;
|
|
27
28
|
subagentSpawner: SubagentSpawner | undefined;
|
|
28
29
|
languageModelMiddleware:
|
|
@@ -51,6 +52,7 @@ export interface RequiredAgentHooks {
|
|
|
51
52
|
*/
|
|
52
53
|
export function assembleAgentHooks(opts: AgentHooks): RequiredAgentHooks {
|
|
53
54
|
return {
|
|
55
|
+
findingPolicy: opts.findingPolicy,
|
|
54
56
|
backends: opts.backends,
|
|
55
57
|
subagentSpawner: opts.subagentSpawner,
|
|
56
58
|
languageModelMiddleware: opts.languageModelMiddleware,
|
|
@@ -101,7 +103,8 @@ export class AgentRuntime<
|
|
|
101
103
|
definition.extraTools?.(opts, state),
|
|
102
104
|
),
|
|
103
105
|
resolveResult: resolveResult
|
|
104
|
-
? (streamResult) =>
|
|
106
|
+
? (streamResult, validatedResponse) =>
|
|
107
|
+
resolveResult(opts, state, streamResult, validatedResponse)
|
|
105
108
|
: undefined,
|
|
106
109
|
target: definition.target?.(opts, state) ?? opts.target,
|
|
107
110
|
grpc: definition.grpc?.(opts, state) ?? opts.grpc,
|
|
@@ -63,11 +63,13 @@ export interface AgentDefinition<
|
|
|
63
63
|
/** Extra tools this definition injects, merged on top of `opts.extraTools`. */
|
|
64
64
|
extraTools?: (opts: TOpts, state: TState) => ToolSet | undefined;
|
|
65
65
|
|
|
66
|
-
/** Produces `consume()`'s typed result from the finished stream
|
|
66
|
+
/** Produces `consume()`'s typed result from the finished stream and, when
|
|
67
|
+
* the response tool executes, its schema-validated result. */
|
|
67
68
|
resolveResult?: (
|
|
68
69
|
opts: TOpts,
|
|
69
70
|
state: TState,
|
|
70
71
|
streamResult: StreamTextResult<ToolSet, never>,
|
|
72
|
+
validatedResponse?: unknown,
|
|
71
73
|
) => TResult | Promise<TResult>;
|
|
72
74
|
|
|
73
75
|
/** Target URL/host, when this definition derives one instead of taking it verbatim from `opts`. */
|
|
@@ -8,6 +8,8 @@ export type { AgentEventMap } from "../../eventBus";
|
|
|
8
8
|
// ---------------------------------------------------------------------------
|
|
9
9
|
export { AgentEventBus } from "../../eventBus";
|
|
10
10
|
export { OffensiveSecurityAgent } from "./offensiveSecurityAgent";
|
|
11
|
+
/** Runtime marker for hosts that require Apex's externally graded finding policy. */
|
|
12
|
+
export const EXTERNAL_FINDING_POLICY_CAPABILITY = "v1" as const;
|
|
11
13
|
// ---------------------------------------------------------------------------
|
|
12
14
|
// System prompts
|
|
13
15
|
// ---------------------------------------------------------------------------
|
|
@@ -156,6 +158,7 @@ export {
|
|
|
156
158
|
type CommandCancelHandle,
|
|
157
159
|
type CreateAgentInput,
|
|
158
160
|
type Finding,
|
|
161
|
+
type FindingPolicy,
|
|
159
162
|
type OffensiveSecurityAgentInput,
|
|
160
163
|
type SpecializedAgentInput,
|
|
161
164
|
type SystemPentestScope,
|
|
@@ -361,6 +361,86 @@ describe("spawned-agent usage callbacks", () => {
|
|
|
361
361
|
});
|
|
362
362
|
|
|
363
363
|
describe("auxiliary model events", () => {
|
|
364
|
+
it("persists prepared context instead of restoring a fitted-away prefix", async () => {
|
|
365
|
+
streamResponseCalls.length = 0;
|
|
366
|
+
const rootPath = mkdtempSync(join(tmpdir(), "apex-fitted-history-"));
|
|
367
|
+
try {
|
|
368
|
+
const agent = new OffensiveSecurityAgent({
|
|
369
|
+
prompt: "test",
|
|
370
|
+
model: "test-model",
|
|
371
|
+
messages: [{ role: "user", content: "old large prefix" }],
|
|
372
|
+
session: { id: "ses_fitted_history", rootPath },
|
|
373
|
+
activeTools: [],
|
|
374
|
+
sandbox: {},
|
|
375
|
+
} as never);
|
|
376
|
+
void agent.streamResult;
|
|
377
|
+
const call = streamResponseCalls[0] as {
|
|
378
|
+
onContextPrepared: (context: {
|
|
379
|
+
messages: Array<{ role: string; content: unknown }>;
|
|
380
|
+
responseMessageOffset: number;
|
|
381
|
+
}) => void;
|
|
382
|
+
onStepFinish: (event: unknown) => Promise<void>;
|
|
383
|
+
};
|
|
384
|
+
const firstStep = [
|
|
385
|
+
{ role: "assistant", content: "first call" },
|
|
386
|
+
{ role: "tool", content: "full first result" },
|
|
387
|
+
];
|
|
388
|
+
const cachedSystem = {
|
|
389
|
+
role: "system",
|
|
390
|
+
content: "cached effective system prompt",
|
|
391
|
+
providerOptions: {
|
|
392
|
+
anthropic: { cacheControl: { type: "ephemeral" } },
|
|
393
|
+
},
|
|
394
|
+
};
|
|
395
|
+
const historySystem = {
|
|
396
|
+
role: "system",
|
|
397
|
+
content: "caller-supplied history instruction",
|
|
398
|
+
};
|
|
399
|
+
call.onContextPrepared({
|
|
400
|
+
messages: [
|
|
401
|
+
cachedSystem,
|
|
402
|
+
cachedSystem,
|
|
403
|
+
historySystem,
|
|
404
|
+
{ role: "user", content: "fitted prefix" },
|
|
405
|
+
],
|
|
406
|
+
responseMessageOffset: 0,
|
|
407
|
+
});
|
|
408
|
+
await call.onStepFinish({
|
|
409
|
+
response: { id: "step-1", messages: firstStep },
|
|
410
|
+
usage: { inputTokens: 10, outputTokens: 2 },
|
|
411
|
+
});
|
|
412
|
+
|
|
413
|
+
const compacted = [
|
|
414
|
+
historySystem,
|
|
415
|
+
{ role: "user", content: "fitted prefix" },
|
|
416
|
+
{ role: "assistant", content: "first call" },
|
|
417
|
+
{ role: "tool", content: "short first result" },
|
|
418
|
+
];
|
|
419
|
+
call.onContextPrepared({
|
|
420
|
+
messages: [cachedSystem, cachedSystem, ...compacted],
|
|
421
|
+
responseMessageOffset: 2,
|
|
422
|
+
});
|
|
423
|
+
const secondStep = [
|
|
424
|
+
{ role: "assistant", content: "second call" },
|
|
425
|
+
{ role: "tool", content: "second result" },
|
|
426
|
+
];
|
|
427
|
+
await call.onStepFinish({
|
|
428
|
+
response: {
|
|
429
|
+
id: "step-2",
|
|
430
|
+
messages: [...firstStep, ...secondStep],
|
|
431
|
+
},
|
|
432
|
+
usage: { inputTokens: 10, outputTokens: 2 },
|
|
433
|
+
});
|
|
434
|
+
|
|
435
|
+
const writer = (agent as unknown as { writer: AgentMessageWriter })
|
|
436
|
+
.writer;
|
|
437
|
+
expect(writer.latest).toEqual([...compacted, ...secondStep]);
|
|
438
|
+
writer.cancelTimer();
|
|
439
|
+
} finally {
|
|
440
|
+
rmSync(rootPath, { recursive: true, force: true });
|
|
441
|
+
}
|
|
442
|
+
});
|
|
443
|
+
|
|
364
444
|
it("keeps the last complete message snapshot while forwarding usage", async () => {
|
|
365
445
|
streamResponseCalls.length = 0;
|
|
366
446
|
traceRecordStepCalls.length = 0;
|
|
@@ -2806,6 +2886,11 @@ describe("trace identity and root IO", () => {
|
|
|
2806
2886
|
describe("contextRecorder integration", () => {
|
|
2807
2887
|
const streamTextChunk = { type: "text-delta", id: "t1", delta: "hi" };
|
|
2808
2888
|
const CANONICAL = [
|
|
2889
|
+
{
|
|
2890
|
+
role: "system",
|
|
2891
|
+
content: "cached effective system prompt",
|
|
2892
|
+
providerOptions: { anthropic: { cacheControl: { type: "ephemeral" } } },
|
|
2893
|
+
},
|
|
2809
2894
|
{ role: "user", content: "recorded prompt" },
|
|
2810
2895
|
{ role: "assistant", content: "recorded answer" },
|
|
2811
2896
|
] as never[];
|
|
@@ -2874,14 +2959,13 @@ describe("contextRecorder integration", () => {
|
|
|
2874
2959
|
expect(streamResponseCalls[0]?.inferenceRecorder).toBe(inferenceRecorder);
|
|
2875
2960
|
|
|
2876
2961
|
const stepEvent = {
|
|
2877
|
-
response: { id: "resp_1", messages: CANONICAL.slice(
|
|
2962
|
+
response: { id: "resp_1", messages: CANONICAL.slice(2) },
|
|
2878
2963
|
usage: {},
|
|
2879
2964
|
};
|
|
2880
2965
|
await streamOpts.onStepFinish(stepEvent);
|
|
2881
2966
|
|
|
2882
|
-
//
|
|
2883
|
-
//
|
|
2884
|
-
// projection must not re-prepend a base or duplicate them.
|
|
2967
|
+
// The cached system message is transport-only; it must not enter the
|
|
2968
|
+
// transcript reloaded with a fresh system prompt on the next turn.
|
|
2885
2969
|
const writer = agent["writer" as keyof typeof agent] as unknown as {
|
|
2886
2970
|
waitForPendingWrites: () => Promise<void>;
|
|
2887
2971
|
latest: unknown[] | null;
|
|
@@ -2894,6 +2978,9 @@ describe("contextRecorder integration", () => {
|
|
|
2894
2978
|
await streamOpts.onFinish(finishEvent);
|
|
2895
2979
|
|
|
2896
2980
|
expect(recorder.latest).toHaveBeenCalled();
|
|
2897
|
-
expect(
|
|
2981
|
+
expect(captured).toEqual(CANONICAL.slice(1));
|
|
2982
|
+
expect(
|
|
2983
|
+
JSON.parse(readFileSync(join(rootPath, "messages.json"), "utf8")),
|
|
2984
|
+
).toEqual(CANONICAL.slice(1));
|
|
2898
2985
|
});
|
|
2899
2986
|
});
|