@pensar/apex 2.0.1 → 2.0.2-canary.09dbe74f
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-x7n47c84.js → agent-067x1n67.js} +9 -9
- package/build/{agent-6nhperp2.js → agent-3n8msbqb.js} +10 -8
- package/build/agent-m3bsrs09.js +19 -0
- package/build/{apps-2ac4vt09.js → apps-7fhwknrj.js} +20 -15
- package/build/{auth-bmt98hz0.js → auth-a1z7ew5p.js} +15 -15
- package/build/authentication-69q16waz.js +19 -0
- package/build/blackboxAgent-80y8j499.js +19 -0
- package/build/{blackboxPentest-xngbtdxb.js → blackboxPentest-aay3kx94.js} +13 -13
- package/build/{cli-hk03x6fq.js → cli-117ypqqj.js} +2 -1
- package/build/{cli-fa7nrded.js → cli-2hw7jen3.js} +5 -5
- package/build/{cli-zpdmnz8c.js → cli-2p56h4nq.js} +881 -373
- package/build/{cli-mfzkhttr.js → cli-5e5gq617.js} +22 -20
- package/build/{cli-ddtmgbqv.js → cli-8q9kr0x9.js} +2 -2
- package/build/{cli-z1dapp7v.js → cli-a3pzv462.js} +71 -33
- package/build/{cli-eptabm2j.js → cli-eg35gebv.js} +1 -1
- package/build/{cli-0yptvbbm.js → cli-hh404jw6.js} +10 -9
- package/build/{cli-1f5zzrxj.js → cli-k8zpadm5.js} +1 -1
- package/build/{cli-f93g10xk.js → cli-mcn1ar96.js} +2 -2
- package/build/{cli-pyzw545d.js → cli-ncecs1a9.js} +76 -11
- package/build/{cli-w2st266h.js → cli-pppvjz87.js} +33 -4
- package/build/{cli-fxtbkw2f.js → cli-pyz8tnrp.js} +6 -6
- package/build/{cli-8xknm7d9.js → cli-q24twygk.js} +1 -1
- package/build/{cli-8g5cwvbm.js → cli-r9yh5mka.js} +2 -2
- package/build/{cli-cc13ydyx.js → cli-sgrt7t9v.js} +9 -9
- package/build/{cli-88bhxzr1.js → cli-tt7ps59g.js} +4 -4
- package/build/cli.js +52 -47
- package/build/{config-j0gfjhrm.js → config-8rnbn2d0.js} +4 -4
- package/build/{doctor-zn8ms7gs.js → doctor-jddjv64a.js} +8 -8
- package/build/{fixes-d8ytvyzn.js → fixes-rfrer4t8.js} +15 -15
- package/build/{index-hjvqqkem.js → index-0nz7y997.js} +4 -4
- package/build/{index-2t2cg8x0.js → index-mk5mxrjd.js} +8 -8
- package/build/{index-k6ttkac6.js → index-nw5vbcg9.js} +13 -12
- package/build/{index-528cyewc.js → index-pr80jx2t.js} +116 -70
- package/build/{index-a1sy2zak.js → index-rg2czyx7.js} +2 -2
- package/build/{index-3cbcjqw1.js → index-speg9ebc.js} +9 -9
- package/build/{index-9d2es97h.js → index-syz3srk7.js} +3 -3
- package/build/{issues-17kdjtdg.js → issues-484xb633.js} +15 -15
- package/build/{logs-r4rjar4m.js → logs-kmw11amx.js} +15 -15
- package/build/{offesecAgent-azd8ahkm.js → offesecAgent-ykx4cmb1.js} +8 -8
- package/build/{parse-15kqmy2v.js → parse-7djk9jyf.js} +1 -1
- package/build/pentest-4v06edvf.js +28 -0
- package/build/{pentests-npjb5q1h.js → pentests-jpc8hjdm.js} +15 -15
- package/build/{targetedPentest-m24wvscc.js → targetedPentest-zkezvsdt.js} +9 -9
- package/build/targets-p4d186xd.js +113 -0
- package/build/threatModel-k41x41eg.js +26 -0
- package/build/{uninstall-7pm6zcah.js → uninstall-s75nx85e.js} +9 -9
- package/build/{upload-wg0vxmk0.js → upload-57y9k8gs.js} +6 -6
- package/build/{utils-gd1y4t26.js → utils-dwkm0fb2.js} +5 -5
- package/package.json +9 -8
- package/build/agent-4g69jwmq.js +0 -19
- package/build/authentication-c0aj9zaz.js +0 -19
- package/build/blackboxAgent-sgph70e4.js +0 -19
- package/build/pentest-2vsjf0j8.js +0 -28
- package/build/threatModel-7akmfzzm.js +0 -26
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
BlackboxAttackSurfaceAgent
|
|
3
|
-
} from "./cli-
|
|
3
|
+
} from "./cli-pyz8tnrp.js";
|
|
4
4
|
import {
|
|
5
5
|
TargetedPentestAgent,
|
|
6
6
|
buildPentestSystemPrompt
|
|
7
|
-
} from "./cli-
|
|
7
|
+
} from "./cli-pppvjz87.js";
|
|
8
8
|
import {
|
|
9
9
|
CodeAgent
|
|
10
|
-
} from "./cli-
|
|
10
|
+
} from "./cli-mcn1ar96.js";
|
|
11
11
|
import {
|
|
12
12
|
AppsDiscoveryResultSchema,
|
|
13
13
|
DiscoverySummarySchema,
|
|
@@ -15,10 +15,10 @@ import {
|
|
|
15
15
|
WHITEBOX_APPS_DISCOVERY_SYSTEM_PROMPT,
|
|
16
16
|
WHITEBOX_DISCOVERY_SYSTEM_PROMPT,
|
|
17
17
|
WHITEBOX_ENDPOINT_DOCUMENTATION_SYSTEM_PROMPT
|
|
18
|
-
} from "./cli-
|
|
18
|
+
} from "./cli-8q9kr0x9.js";
|
|
19
19
|
import {
|
|
20
20
|
EvidenceFileEntrySchema
|
|
21
|
-
} from "./cli-
|
|
21
|
+
} from "./cli-117ypqqj.js";
|
|
22
22
|
import {
|
|
23
23
|
CweEntrySchema,
|
|
24
24
|
FindingsRegistry,
|
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
ValidatedCweEntrySchema,
|
|
28
28
|
hasCanonicalName,
|
|
29
29
|
runWithBoundedConcurrency
|
|
30
|
-
} from "./cli-
|
|
30
|
+
} from "./cli-2p56h4nq.js";
|
|
31
31
|
import {
|
|
32
32
|
createThreatModelPrompt
|
|
33
33
|
} from "./cli-fw5r7pfj.js";
|
|
@@ -38,7 +38,7 @@ import {
|
|
|
38
38
|
init_lazyLogger,
|
|
39
39
|
init_structured,
|
|
40
40
|
scopedLogger
|
|
41
|
-
} from "./cli-
|
|
41
|
+
} from "./cli-a3pzv462.js";
|
|
42
42
|
import {
|
|
43
43
|
exports_external1 as exports_external,
|
|
44
44
|
init_zod
|
|
@@ -46,8 +46,8 @@ import {
|
|
|
46
46
|
|
|
47
47
|
// src/core/workflows/pentest.ts
|
|
48
48
|
init_dist();
|
|
49
|
-
import { existsSync as existsSync13, readdirSync as readdirSync12, readFileSync as readFileSync11, writeFileSync as writeFileSync4 } from "fs";
|
|
50
|
-
import { join as join17 } from "path";
|
|
49
|
+
import { existsSync as existsSync13, readdirSync as readdirSync12, readFileSync as readFileSync11, writeFileSync as writeFileSync4 } from "node:fs";
|
|
50
|
+
import { join as join17 } from "node:path";
|
|
51
51
|
|
|
52
52
|
// src/core/agents/specialized/pentest/planPrompt.ts
|
|
53
53
|
var PLAN_PHASE_SYSTEM_PROMPT = `You are an expert penetration tester performing reconnaissance and planning.
|
|
@@ -110,6 +110,7 @@ var PentestReportFindingSchema = exports_external.object({
|
|
|
110
110
|
cwes: exports_external.array(ValidatedCweEntrySchema.or(CweEntrySchema)).optional(),
|
|
111
111
|
rootCauseGroup: exports_external.string().optional(),
|
|
112
112
|
relatedFindings: exports_external.array(exports_external.string()).optional(),
|
|
113
|
+
rootCauseLead: exports_external.boolean().optional(),
|
|
113
114
|
evidenceFiles: exports_external.array(EvidenceFileEntrySchema).optional()
|
|
114
115
|
});
|
|
115
116
|
var PentestReportSchema = exports_external.object({
|
|
@@ -168,6 +169,7 @@ function buildPentestReport(findings, context) {
|
|
|
168
169
|
cwes: f.cwes,
|
|
169
170
|
rootCauseGroup: f.rootCauseGroup,
|
|
170
171
|
relatedFindings: f.relatedFindings,
|
|
172
|
+
rootCauseLead: f.rootCauseLead,
|
|
171
173
|
evidenceFiles: f.evidenceFiles
|
|
172
174
|
}))
|
|
173
175
|
};
|
|
@@ -273,8 +275,8 @@ var REPORT_FILENAME_MD = "pentest-report.md";
|
|
|
273
275
|
var REPORT_FILENAME_JSON = "pentest-report.json";
|
|
274
276
|
|
|
275
277
|
// src/core/session/execution-metrics.ts
|
|
276
|
-
import { existsSync, readFileSync, writeFileSync } from "fs";
|
|
277
|
-
import { join } from "path";
|
|
278
|
+
import { existsSync, readFileSync, writeFileSync } from "node:fs";
|
|
279
|
+
import { join } from "node:path";
|
|
278
280
|
var EXECUTION_METRICS_FILENAME = "execution-metrics.json";
|
|
279
281
|
function toNonNegativeInteger(value) {
|
|
280
282
|
const n = Number(value);
|
|
@@ -351,8 +353,8 @@ function formatDurationHmsFromMs(durationMs) {
|
|
|
351
353
|
|
|
352
354
|
// src/core/session/loader.ts
|
|
353
355
|
init_structured();
|
|
354
|
-
import { existsSync as existsSync3, readFileSync as readFileSync3 } from "fs";
|
|
355
|
-
import { join as join3 } from "path";
|
|
356
|
+
import { existsSync as existsSync3, readFileSync as readFileSync3 } from "node:fs";
|
|
357
|
+
import { join as join3 } from "node:path";
|
|
356
358
|
init_lazyLogger();
|
|
357
359
|
|
|
358
360
|
// src/core/session/persistence.ts
|
|
@@ -365,8 +367,8 @@ import {
|
|
|
365
367
|
readFileSync as readFileSync2,
|
|
366
368
|
statSync,
|
|
367
369
|
writeFileSync as writeFileSync2
|
|
368
|
-
} from "fs";
|
|
369
|
-
import { join as join2 } from "path";
|
|
370
|
+
} from "node:fs";
|
|
371
|
+
import { join as join2 } from "node:path";
|
|
370
372
|
var log = scopedLogger(() => createLogger("session:persistence"));
|
|
371
373
|
var SUBAGENTS_DIR = "subagents";
|
|
372
374
|
var MANIFEST_FILE = "agent-manifest.json";
|
|
@@ -752,8 +754,8 @@ import {
|
|
|
752
754
|
readFileSync as readFileSync9,
|
|
753
755
|
statSync as statSync2,
|
|
754
756
|
writeFileSync as writeFileSync3
|
|
755
|
-
} from "fs";
|
|
756
|
-
import { join as join15 } from "path";
|
|
757
|
+
} from "node:fs";
|
|
758
|
+
import { join as join15 } from "node:path";
|
|
757
759
|
|
|
758
760
|
// src/core/agents/specialized/whiteboxAttackSurface/endpointDocumentationAgent.ts
|
|
759
761
|
init_structured();
|
|
@@ -4128,7 +4130,7 @@ var django = {
|
|
|
4128
4130
|
return name === "urls.py" || name === "routes.py";
|
|
4129
4131
|
});
|
|
4130
4132
|
const includePrefixes = {};
|
|
4131
|
-
const pathIncludeRe = /path\s*\(\s*['"]([^'"]*)['"]\s*,\s*include\s*\(\s*['"]([^'"]+)['"]/g;
|
|
4133
|
+
const pathIncludeRe = /(?:path|re_path)\s*\(\s*[rRbBuUfF]*['"]([^'"]*)['"]\s*,\s*include\s*\(\s*[rRbBuUfF]*['"]([^'"]+)['"]/g;
|
|
4132
4134
|
for (const f of urlFiles) {
|
|
4133
4135
|
const content = ctx.readFile(f);
|
|
4134
4136
|
if (!content)
|
|
@@ -4137,7 +4139,7 @@ var django = {
|
|
|
4137
4139
|
includePrefixes[m[2]] = m[1];
|
|
4138
4140
|
}
|
|
4139
4141
|
}
|
|
4140
|
-
const directPathRe = /path\s*\(\s*['"]([^'"]*)['"]\s*,\s*(?!include)(\w[\w.]*)/g;
|
|
4142
|
+
const directPathRe = /(?:path|re_path)\s*\(\s*[rRbBuUfF]*['"]([^'"]*)['"]\s*,\s*(?!include)(\w[\w.]*)/g;
|
|
4141
4143
|
const apiViewRe = /@api_view\s*\(\s*\[([^\]]*)\]\s*\)(.*?)def\s+(\w+)\s*\(/gs;
|
|
4142
4144
|
for (const f of urlFiles) {
|
|
4143
4145
|
const content = ctx.readFile(f);
|
|
@@ -6988,7 +6990,7 @@ async function runPentestWorkflow(input) {
|
|
|
6988
6990
|
if (!session.config) {
|
|
6989
6991
|
session.config = {};
|
|
6990
6992
|
}
|
|
6991
|
-
session.config.prompt = session.config
|
|
6993
|
+
session.config.prompt = session.config?.prompt ? `${session.config?.prompt}
|
|
6992
6994
|
|
|
6993
6995
|
${combined}` : combined;
|
|
6994
6996
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
OffensiveSecurityAgent
|
|
3
|
-
} from "./cli-
|
|
3
|
+
} from "./cli-2p56h4nq.js";
|
|
4
4
|
import {
|
|
5
5
|
hasToolCall,
|
|
6
6
|
init_dist
|
|
7
|
-
} from "./cli-
|
|
7
|
+
} from "./cli-a3pzv462.js";
|
|
8
8
|
import {
|
|
9
9
|
exports_external1 as exports_external,
|
|
10
10
|
init_zod,
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
init_auth,
|
|
5
5
|
init_constants,
|
|
6
6
|
signGatewayRequest
|
|
7
|
-
} from "./cli-
|
|
7
|
+
} from "./cli-r9yh5mka.js";
|
|
8
8
|
import {
|
|
9
9
|
AISDKError,
|
|
10
10
|
APICallError,
|
|
@@ -63,11 +63,11 @@ import {
|
|
|
63
63
|
import {
|
|
64
64
|
config,
|
|
65
65
|
init_config
|
|
66
|
-
} from "./cli-
|
|
66
|
+
} from "./cli-eg35gebv.js";
|
|
67
67
|
import {
|
|
68
68
|
getCurrentVersion,
|
|
69
69
|
init_installation
|
|
70
|
-
} from "./cli-
|
|
70
|
+
} from "./cli-hh404jw6.js";
|
|
71
71
|
import {
|
|
72
72
|
__callDispose,
|
|
73
73
|
__commonJS,
|
|
@@ -7747,6 +7747,24 @@ var init_bedrock = __esm(() => {
|
|
|
7747
7747
|
provider: "bedrock",
|
|
7748
7748
|
contextLength: 64000
|
|
7749
7749
|
},
|
|
7750
|
+
{
|
|
7751
|
+
id: "deepseek.v3-v1:0",
|
|
7752
|
+
name: "DeepSeek V3.1 (Bedrock)",
|
|
7753
|
+
provider: "bedrock",
|
|
7754
|
+
contextLength: 128000
|
|
7755
|
+
},
|
|
7756
|
+
{
|
|
7757
|
+
id: "qwen.qwen3-coder-480b-a35b-v1:0",
|
|
7758
|
+
name: "Qwen3 Coder 480B A35B Instruct (Bedrock)",
|
|
7759
|
+
provider: "bedrock",
|
|
7760
|
+
contextLength: 131072
|
|
7761
|
+
},
|
|
7762
|
+
{
|
|
7763
|
+
id: "zai.glm-5",
|
|
7764
|
+
name: "Z.AI GLM 5 (Bedrock)",
|
|
7765
|
+
provider: "bedrock",
|
|
7766
|
+
contextLength: 200000
|
|
7767
|
+
},
|
|
7750
7768
|
{
|
|
7751
7769
|
id: "us.mistral.pixtral-large-2502-v1:0",
|
|
7752
7770
|
name: "Pixtral Large-2502 (US)",
|
|
@@ -8696,6 +8714,9 @@ function getModelInfo(model) {
|
|
|
8696
8714
|
provider: "local"
|
|
8697
8715
|
};
|
|
8698
8716
|
}
|
|
8717
|
+
function prefersSequentialToolCalls(model) {
|
|
8718
|
+
return /(^|[./:-])deepseek([./:-]|$)/i.test(model);
|
|
8719
|
+
}
|
|
8699
8720
|
function getMaxOutputTokens(modelId) {
|
|
8700
8721
|
const fromPattern = lookupOutputBudgetByPattern(modelId);
|
|
8701
8722
|
const ctx = AVAILABLE_MODELS.find((m) => m.id === modelId)?.contextLength;
|
|
@@ -8760,9 +8781,15 @@ function lookupOutputBudgetByPattern(modelId) {
|
|
|
8760
8781
|
if (modelId.includes("minimax-m3")) {
|
|
8761
8782
|
return 128000;
|
|
8762
8783
|
}
|
|
8763
|
-
if (modelId.includes("glm-5
|
|
8784
|
+
if (modelId.includes("glm-5")) {
|
|
8764
8785
|
return 131072;
|
|
8765
8786
|
}
|
|
8787
|
+
if (modelId.includes("deepseek")) {
|
|
8788
|
+
return 8192;
|
|
8789
|
+
}
|
|
8790
|
+
if (modelId.includes("qwen")) {
|
|
8791
|
+
return 16000;
|
|
8792
|
+
}
|
|
8766
8793
|
return 4096;
|
|
8767
8794
|
}
|
|
8768
8795
|
var AVAILABLE_MODELS;
|
|
@@ -42064,8 +42091,8 @@ var init_caching = __esm(() => {
|
|
|
42064
42091
|
});
|
|
42065
42092
|
|
|
42066
42093
|
// src/core/ai/contextManagement.ts
|
|
42067
|
-
import { mkdirSync, writeFileSync } from "fs";
|
|
42068
|
-
import { join } from "path";
|
|
42094
|
+
import { mkdirSync, writeFileSync } from "node:fs";
|
|
42095
|
+
import { join } from "node:path";
|
|
42069
42096
|
function truncateWithMarker(text2, max, label) {
|
|
42070
42097
|
if (text2.length <= max)
|
|
42071
42098
|
return text2;
|
|
@@ -42112,7 +42139,7 @@ function applyToolResultBudget(messages, opts) {
|
|
|
42112
42139
|
[... truncated ${originalLength - preview.length} chars — full output saved to ${filePath}]`;
|
|
42113
42140
|
if (newValue.length >= text2.length)
|
|
42114
42141
|
return part;
|
|
42115
|
-
if (!persistedIds
|
|
42142
|
+
if (!persistedIds?.has(toolCallId)) {
|
|
42116
42143
|
if (!tailMatch) {
|
|
42117
42144
|
if (!dirCreated) {
|
|
42118
42145
|
mkdirSync(resultsDir, { recursive: true });
|
|
@@ -42144,7 +42171,7 @@ function snipOldSteps(messages, opts) {
|
|
|
42144
42171
|
let stepCount = 0;
|
|
42145
42172
|
let cutoffIdx = 0;
|
|
42146
42173
|
for (let i = messages.length - 1;i >= 0; i--) {
|
|
42147
|
-
if (messages[i]
|
|
42174
|
+
if (messages[i]?.role === "assistant") {
|
|
42148
42175
|
stepCount++;
|
|
42149
42176
|
if (stepCount === keepRecent) {
|
|
42150
42177
|
cutoffIdx = i;
|
|
@@ -42375,6 +42402,14 @@ function checkIfRateLimitError(error) {
|
|
|
42375
42402
|
const errorString = errorMessage || errorName ? "" : String(error).toLowerCase();
|
|
42376
42403
|
return errorMessage.includes("too many tokens") || errorMessage.includes("rate limit") || errorMessage.includes("request rate") || errorMessage.includes("throttl") || errorMessage.includes("overloaded") || errorMessage.includes("too many requests") || errorMessage.includes("please wait") || errorMessage.includes("service unavailable") || errorName.includes("throttl") || errorName.includes("toomanyrequests") || errorName.includes("serviceunavailable") || errorCode === "rate_limit_exceeded" || errorCode === "throttling" || errorCode === "429" || httpStatus === 429 || httpStatus === 529 || httpStatus === 503 || errorString.includes("throttl") || errorString.includes("too many") || errorString.includes("request rate");
|
|
42377
42404
|
}
|
|
42405
|
+
function applySequentialToolCallPolicy(system, tools, model) {
|
|
42406
|
+
if (tools && Object.keys(tools).length > 0 && prefersSequentialToolCalls(model)) {
|
|
42407
|
+
return `${system ? `${system}
|
|
42408
|
+
|
|
42409
|
+
` : ""}${SEQUENTIAL_TOOL_CALL_INSTRUCTION}`;
|
|
42410
|
+
}
|
|
42411
|
+
return system;
|
|
42412
|
+
}
|
|
42378
42413
|
async function* withIdleTimeout(stream, idleMs, isIdleTimerActive) {
|
|
42379
42414
|
const iterator = stream[Symbol.asyncIterator]();
|
|
42380
42415
|
try {
|
|
@@ -42438,7 +42473,7 @@ function createToolExecutionGate() {
|
|
|
42438
42473
|
function wrapStreamWithErrorHandler(originalStream, messagesContainer, opts, model, silent, rateLimitRetryCount = 0, idleResumeCount = 0) {
|
|
42439
42474
|
let wrappedStream = null;
|
|
42440
42475
|
const handler = {
|
|
42441
|
-
get(
|
|
42476
|
+
get(_target, prop) {
|
|
42442
42477
|
if (prop === "fullStream") {
|
|
42443
42478
|
if (!wrappedStream) {
|
|
42444
42479
|
const toolGate = createToolExecutionGate();
|
|
@@ -42497,7 +42532,7 @@ function wrapStreamWithErrorHandler(originalStream, messagesContainer, opts, mod
|
|
|
42497
42532
|
const fitted = fitMessagesToContext(currentMessages, {
|
|
42498
42533
|
contextWindow: getContextWindow(opts.model),
|
|
42499
42534
|
maxOutputTokens: getMaxOutputTokens(opts.model),
|
|
42500
|
-
system: opts.system,
|
|
42535
|
+
system: applySequentialToolCallPolicy(opts.system, opts.tools, opts.model),
|
|
42501
42536
|
tools: opts.tools,
|
|
42502
42537
|
sessionPath: opts.sessionPath
|
|
42503
42538
|
});
|
|
@@ -42632,13 +42667,14 @@ function streamResponse(opts) {
|
|
|
42632
42667
|
};
|
|
42633
42668
|
const providerModel = getProviderModel(model, authConfig);
|
|
42634
42669
|
const useAnthropicCaching = isAnthropicProvider(model);
|
|
42670
|
+
const systemWithToolPolicy = applySequentialToolCallPolicy(system, tools, model);
|
|
42635
42671
|
let fittedMessages = messages;
|
|
42636
42672
|
let proactiveFitFailed = false;
|
|
42637
42673
|
if (messages && messages.length > 0) {
|
|
42638
42674
|
const fitted = fitMessagesToContext(messages, {
|
|
42639
42675
|
contextWindow: getContextWindow(model),
|
|
42640
42676
|
maxOutputTokens: getMaxOutputTokens(model),
|
|
42641
|
-
system,
|
|
42677
|
+
system: systemWithToolPolicy,
|
|
42642
42678
|
tools,
|
|
42643
42679
|
sessionPath: opts.sessionPath
|
|
42644
42680
|
});
|
|
@@ -42655,13 +42691,13 @@ function streamResponse(opts) {
|
|
|
42655
42691
|
}
|
|
42656
42692
|
return wrapStreamWithErrorHandler(createSummarizationStream(fittedMessages, opts, providerModel), messagesContainer, opts, providerModel, silent);
|
|
42657
42693
|
}
|
|
42658
|
-
let effectiveSystem =
|
|
42694
|
+
let effectiveSystem = systemWithToolPolicy;
|
|
42659
42695
|
let effectiveMessages = fittedMessages;
|
|
42660
|
-
if (useAnthropicCaching &&
|
|
42696
|
+
if (useAnthropicCaching && systemWithToolPolicy) {
|
|
42661
42697
|
const baseMessages = fittedMessages ?? [
|
|
42662
42698
|
{ role: "user", content: prompt }
|
|
42663
42699
|
];
|
|
42664
|
-
effectiveMessages = withCachedSystemPrompt(
|
|
42700
|
+
effectiveMessages = withCachedSystemPrompt(systemWithToolPolicy, baseMessages);
|
|
42665
42701
|
effectiveSystem = undefined;
|
|
42666
42702
|
}
|
|
42667
42703
|
const useThinking = enableThinking && isAnthropicProvider(model) && modelSupportsThinking(model);
|
|
@@ -42752,7 +42788,7 @@ function streamResponse(opts) {
|
|
|
42752
42788
|
}
|
|
42753
42789
|
}
|
|
42754
42790
|
const tool6 = tools2[toolCall.toolName];
|
|
42755
|
-
if (!tool6
|
|
42791
|
+
if (!tool6?.inputSchema) {
|
|
42756
42792
|
if (!silent) {
|
|
42757
42793
|
log.warn(`Cannot repair tool call: ${toolCall.toolName} not found or has no schema`);
|
|
42758
42794
|
}
|
|
@@ -42920,7 +42956,7 @@ async function generateObjectResponse(opts) {
|
|
|
42920
42956
|
}
|
|
42921
42957
|
throw lastError;
|
|
42922
42958
|
}
|
|
42923
|
-
var log, DEFAULT_OPENAI_REASONING_EFFORT = "medium", OPENAI_REASONING_MODEL_IDS, _usageCallback = null, MAX_RATE_LIMIT_RETRIES = 20, MAX_IDLE_RESUME_RETRIES = 3, STREAM_IDLE_TIMEOUT_MS, StreamIdleTimeoutError, MAX_OBJECT_RATE_LIMIT_RETRIES = 8, ContextLengthError, ContextLengthExhaustedError, MAX_RESTART_DEPTH = 3, MAX_TOOL_INPUT_CHARS = 8000, MAX_SCHEMA_CHARS = 6000, MINIMAL_RESTART_PROMPT = "Continue the previous task. Earlier context was discarded due to repeated context-length errors.";
|
|
42959
|
+
var log, DEFAULT_OPENAI_REASONING_EFFORT = "medium", OPENAI_REASONING_MODEL_IDS, _usageCallback = null, SEQUENTIAL_TOOL_CALL_INSTRUCTION, MAX_RATE_LIMIT_RETRIES = 20, MAX_IDLE_RESUME_RETRIES = 3, STREAM_IDLE_TIMEOUT_MS, StreamIdleTimeoutError, MAX_OBJECT_RATE_LIMIT_RETRIES = 8, ContextLengthError, ContextLengthExhaustedError, MAX_RESTART_DEPTH = 3, MAX_TOOL_INPUT_CHARS = 8000, MAX_SCHEMA_CHARS = 6000, MINIMAL_RESTART_PROMPT = "Continue the previous task. Earlier context was discarded due to repeated context-length errors.";
|
|
42924
42960
|
var init_ai = __esm(() => {
|
|
42925
42961
|
init_dist4();
|
|
42926
42962
|
init_structured();
|
|
@@ -42947,6 +42983,7 @@ var init_ai = __esm(() => {
|
|
|
42947
42983
|
"gpt-5.5",
|
|
42948
42984
|
"gpt-5.5-2026-04-23"
|
|
42949
42985
|
]);
|
|
42986
|
+
SEQUENTIAL_TOOL_CALL_INSTRUCTION = "CRITICAL TOOL-CALLING RULE: Emit EXACTLY ONE tool call per response. " + "Never emit more than one tool call in a single turn. After each tool call, " + "wait for its result before making the next one. Emitting multiple tool " + "calls in one turn corrupts their arguments.";
|
|
42950
42987
|
STREAM_IDLE_TIMEOUT_MS = 5 * 60 * 1000;
|
|
42951
42988
|
StreamIdleTimeoutError = class StreamIdleTimeoutError extends Error {
|
|
42952
42989
|
constructor(idleMs) {
|
|
@@ -43095,7 +43132,7 @@ var init_name = __esm(() => {
|
|
|
43095
43132
|
});
|
|
43096
43133
|
|
|
43097
43134
|
// src/core/credentials/manager.ts
|
|
43098
|
-
import { randomBytes } from "crypto";
|
|
43135
|
+
import { randomBytes } from "node:crypto";
|
|
43099
43136
|
function generateCredentialId() {
|
|
43100
43137
|
return `cred_${randomBytes(8).toString("hex")}`;
|
|
43101
43138
|
}
|
|
@@ -43267,7 +43304,7 @@ var init_credentials = __esm(() => {
|
|
|
43267
43304
|
});
|
|
43268
43305
|
|
|
43269
43306
|
// src/core/id/id.ts
|
|
43270
|
-
import { randomBytes as randomBytes2 } from "crypto";
|
|
43307
|
+
import { randomBytes as randomBytes2 } from "node:crypto";
|
|
43271
43308
|
function schema(prefix) {
|
|
43272
43309
|
return zod_default.string().startsWith(prefixes[prefix]);
|
|
43273
43310
|
}
|
|
@@ -43504,9 +43541,9 @@ var init_lock = __esm(() => {
|
|
|
43504
43541
|
});
|
|
43505
43542
|
|
|
43506
43543
|
// src/core/storage/index.ts
|
|
43507
|
-
import fs, { readdir } from "fs/promises";
|
|
43508
|
-
import os from "os";
|
|
43509
|
-
import path from "path";
|
|
43544
|
+
import fs, { readdir } from "node:fs/promises";
|
|
43545
|
+
import os from "node:os";
|
|
43546
|
+
import path from "node:path";
|
|
43510
43547
|
function getBaseDir() {
|
|
43511
43548
|
return process.env.PENSAR_DATA_DIR ?? path.join(os.homedir(), ".pensar");
|
|
43512
43549
|
}
|
|
@@ -43657,9 +43694,9 @@ var init_toolset = __esm(() => {
|
|
|
43657
43694
|
});
|
|
43658
43695
|
|
|
43659
43696
|
// src/core/session/index.ts
|
|
43660
|
-
import { existsSync, readFileSync } from "fs";
|
|
43661
|
-
import os2 from "os";
|
|
43662
|
-
import path2 from "path";
|
|
43697
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
43698
|
+
import os2 from "node:os";
|
|
43699
|
+
import path2 from "node:path";
|
|
43663
43700
|
function resolveSmtpConfig(explicit) {
|
|
43664
43701
|
if (explicit)
|
|
43665
43702
|
return explicit;
|
|
@@ -43797,7 +43834,7 @@ async function create2(input) {
|
|
|
43797
43834
|
if (normalizedConfig?.headers !== undefined) {
|
|
43798
43835
|
snapshotHeaders = { ...normalizedConfig.headers };
|
|
43799
43836
|
} else {
|
|
43800
|
-
const { config: appConfig } = await import("./index-
|
|
43837
|
+
const { config: appConfig } = await import("./index-syz3srk7.js");
|
|
43801
43838
|
const cfg = await appConfig.get();
|
|
43802
43839
|
snapshotHeaders = cfg.defaultHeaders ? { ...cfg.defaultHeaders } : { ...DEFAULT_HEADER_RECORD };
|
|
43803
43840
|
}
|
|
@@ -43857,7 +43894,7 @@ async function* list2() {
|
|
|
43857
43894
|
const sessionsDir = getSessionsDir();
|
|
43858
43895
|
let entries;
|
|
43859
43896
|
try {
|
|
43860
|
-
entries = await import("fs/promises").then((fsp) => fsp.readdir(sessionsDir, { withFileTypes: true }));
|
|
43897
|
+
entries = await import("node:fs/promises").then((fsp) => fsp.readdir(sessionsDir, { withFileTypes: true }));
|
|
43861
43898
|
} catch {
|
|
43862
43899
|
return;
|
|
43863
43900
|
}
|
|
@@ -44009,7 +44046,7 @@ var DEFAULT_OUTCOME_GUIDANCE, EXFIL_OUTCOME_GUIDANCE, DEFAULT_HEADER_RECORD, Aut
|
|
|
44009
44046
|
}, RemoveInput, remove2 = async (input) => {
|
|
44010
44047
|
try {
|
|
44011
44048
|
const sessionDir = getSessionRoot(input.sessionId);
|
|
44012
|
-
const fsp = await import("fs/promises");
|
|
44049
|
+
const fsp = await import("node:fs/promises");
|
|
44013
44050
|
await fsp.rm(sessionDir, { recursive: true, force: true });
|
|
44014
44051
|
} catch (e) {
|
|
44015
44052
|
console.error(e);
|
|
@@ -44125,7 +44162,8 @@ var init_session = __esm(() => {
|
|
|
44125
44162
|
agentCwd: zod_default.string().optional(),
|
|
44126
44163
|
prompt: zod_default.string().optional(),
|
|
44127
44164
|
taskDriven: zod_default.boolean().optional(),
|
|
44128
|
-
requirePlan: zod_default.boolean().optional()
|
|
44165
|
+
requirePlan: zod_default.boolean().optional(),
|
|
44166
|
+
promptInjectionLibrarySource: zod_default.string().optional()
|
|
44129
44167
|
});
|
|
44130
44168
|
SessionInfoObject = zod_default.object({
|
|
44131
44169
|
id: schema("session"),
|
|
@@ -44171,9 +44209,9 @@ import {
|
|
|
44171
44209
|
mkdirSync as mkdirSync2,
|
|
44172
44210
|
readFileSync as readFileSync2,
|
|
44173
44211
|
writeFileSync as writeFileSync2
|
|
44174
|
-
} from "fs";
|
|
44175
|
-
import os3 from "os";
|
|
44176
|
-
import path3 from "path";
|
|
44212
|
+
} from "node:fs";
|
|
44213
|
+
import os3 from "node:os";
|
|
44214
|
+
import path3 from "node:path";
|
|
44177
44215
|
function pruneErrorLog() {
|
|
44178
44216
|
if (hasPruned)
|
|
44179
44217
|
return;
|
|
@@ -45237,8 +45275,8 @@ async function summarizeConversation(messages, opts, model) {
|
|
|
45237
45275
|
};
|
|
45238
45276
|
};
|
|
45239
45277
|
let slicedMessages;
|
|
45240
|
-
if (cleanMessages.length === 1 && typeof cleanMessages[0]
|
|
45241
|
-
const content = cleanMessages[0]
|
|
45278
|
+
if (cleanMessages.length === 1 && typeof cleanMessages[0]?.content === "string") {
|
|
45279
|
+
const content = cleanMessages[0]?.content;
|
|
45242
45280
|
const lines = content.split(`
|
|
45243
45281
|
`);
|
|
45244
45282
|
const truncatedContent = lines.slice(-50).join(`
|
|
@@ -25,9 +25,10 @@ var init_package = __esm(() => {
|
|
|
25
25
|
"@opentelemetry/api": "^1.9.0",
|
|
26
26
|
"@opentui/core": "^0.1.107",
|
|
27
27
|
"@opentui/react": "^0.1.107",
|
|
28
|
-
"@pensar/surface": "0.2.
|
|
28
|
+
"@pensar/surface": "0.2.2",
|
|
29
29
|
"@playwright/mcp": "^0.0.54",
|
|
30
30
|
ai: "^6.0.105",
|
|
31
|
+
"camoufox-js": "^0.11.1",
|
|
31
32
|
glob: "^13.0.0",
|
|
32
33
|
"highlight.js": "^11.11.1",
|
|
33
34
|
imapflow: "^1.2.10",
|
|
@@ -91,13 +92,13 @@ var init_package = __esm(() => {
|
|
|
91
92
|
url: "https://github.com/pensarai/apex.git"
|
|
92
93
|
},
|
|
93
94
|
scripts: {
|
|
94
|
-
build: "bun build src/cli.ts --outdir build --target node --format esm --splitting --external @opentui/core --external @opentui/react --external @opentui/react/* --external react --external react/jsx-runtime --external react/jsx-dev-runtime --external react-reconciler --external weave",
|
|
95
|
+
build: "bun build src/cli.ts --outdir build --target node --format esm --splitting --external @opentui/core --external @opentui/react --external @opentui/react/* --external react --external react/jsx-runtime --external react/jsx-dev-runtime --external react-reconciler --external weave --external electron --external chromium-bidi --external camoufox-js",
|
|
95
96
|
"build:binaries": "bun run generate:ascii && mkdir -p dist && bun run build:binary:macos-arm64 && bun run build:binary:macos-x64 && bun run build:binary:linux-x64 && bun run build:binary:linux-arm64",
|
|
96
|
-
"build:binary": "bun run generate:ascii && bun build src/cli.ts --compile --outfile pensar",
|
|
97
|
-
"build:binary:linux-arm64": "bun build src/cli.ts --compile --target=bun-linux-arm64 --outfile dist/pensar-linux-arm64",
|
|
98
|
-
"build:binary:linux-x64": "bun build src/cli.ts --compile --target=bun-linux-x64 --outfile dist/pensar-linux-x64",
|
|
99
|
-
"build:binary:macos-arm64": "bun build src/cli.ts --compile --target=bun-darwin-arm64 --outfile dist/pensar-darwin-arm64",
|
|
100
|
-
"build:binary:macos-x64": "bun build src/cli.ts --compile --target=bun-darwin-x64 --outfile dist/pensar-darwin-x64",
|
|
97
|
+
"build:binary": "bun run generate:ascii && bun build src/cli.ts --compile --external electron --external chromium-bidi --external camoufox-js --outfile pensar",
|
|
98
|
+
"build:binary:linux-arm64": "bun build src/cli.ts --compile --external electron --external chromium-bidi --external camoufox-js --target=bun-linux-arm64 --outfile dist/pensar-linux-arm64",
|
|
99
|
+
"build:binary:linux-x64": "bun build src/cli.ts --compile --external electron --external chromium-bidi --external camoufox-js --target=bun-linux-x64 --outfile dist/pensar-linux-x64",
|
|
100
|
+
"build:binary:macos-arm64": "bun build src/cli.ts --compile --external electron --external chromium-bidi --external camoufox-js --target=bun-darwin-arm64 --outfile dist/pensar-darwin-arm64",
|
|
101
|
+
"build:binary:macos-x64": "bun build src/cli.ts --compile --external electron --external chromium-bidi --external camoufox-js --target=bun-darwin-x64 --outfile dist/pensar-darwin-x64",
|
|
101
102
|
check: "biome check --write",
|
|
102
103
|
"check:ci": "biome check",
|
|
103
104
|
"daytona-benchmark": "bun run scripts/daytona-benchmark.ts",
|
|
@@ -119,12 +120,12 @@ var init_package = __esm(() => {
|
|
|
119
120
|
tsc: "tsc --noEmit"
|
|
120
121
|
},
|
|
121
122
|
type: "module",
|
|
122
|
-
version: "2.0.
|
|
123
|
+
version: "2.0.2-canary.09dbe74f"
|
|
123
124
|
};
|
|
124
125
|
});
|
|
125
126
|
|
|
126
127
|
// src/core/installation/index.ts
|
|
127
|
-
import { spawnSync } from "child_process";
|
|
128
|
+
import { spawnSync } from "node:child_process";
|
|
128
129
|
function getCurrentVersion() {
|
|
129
130
|
return package_default.version;
|
|
130
131
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
OffensiveSecurityAgent
|
|
3
|
-
} from "./cli-
|
|
3
|
+
} from "./cli-2p56h4nq.js";
|
|
4
4
|
import {
|
|
5
5
|
init_dist,
|
|
6
6
|
stepCountIs
|
|
7
|
-
} from "./cli-
|
|
7
|
+
} from "./cli-a3pzv462.js";
|
|
8
8
|
|
|
9
9
|
// src/core/agents/specialized/codeAgent/agent.ts
|
|
10
10
|
init_dist();
|