@pensar/apex 0.0.12 → 0.0.13
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/benchmark.js +25 -11
- package/build/index.js +25 -11
- package/build/quicktest.js +25 -11
- package/build/swarm.js +27 -12
- package/package.json +1 -1
package/build/benchmark.js
CHANGED
|
@@ -39828,7 +39828,7 @@ function createSummarizationStream(messages, opts, model) {
|
|
|
39828
39828
|
}
|
|
39829
39829
|
|
|
39830
39830
|
// src/core/ai/ai.ts
|
|
39831
|
-
function wrapStreamWithErrorHandler(originalStream, messagesContainer, opts, model) {
|
|
39831
|
+
function wrapStreamWithErrorHandler(originalStream, messagesContainer, opts, model, silent) {
|
|
39832
39832
|
let wrappedStream = null;
|
|
39833
39833
|
const handler = {
|
|
39834
39834
|
get(target, prop) {
|
|
@@ -39853,13 +39853,17 @@ function wrapStreamWithErrorHandler(originalStream, messagesContainer, opts, mod
|
|
|
39853
39853
|
currentMessages = response.messages;
|
|
39854
39854
|
}
|
|
39855
39855
|
} catch (e) {}
|
|
39856
|
-
|
|
39856
|
+
if (!silent) {
|
|
39857
|
+
console.warn(`Context length error in wrapper, summarizing ${messagesContainer.current.length} messages: `, error46.message);
|
|
39858
|
+
}
|
|
39857
39859
|
const summarizationStream = createSummarizationStream(currentMessages, opts, model);
|
|
39858
39860
|
for await (const chunk of summarizationStream.fullStream) {
|
|
39859
39861
|
yield chunk;
|
|
39860
39862
|
}
|
|
39861
39863
|
} else {
|
|
39862
|
-
|
|
39864
|
+
if (!silent) {
|
|
39865
|
+
console.error("Non-context length error, re-throwing", error46.message);
|
|
39866
|
+
}
|
|
39863
39867
|
throw error46;
|
|
39864
39868
|
}
|
|
39865
39869
|
}
|
|
@@ -39883,7 +39887,8 @@ function streamResponse(opts) {
|
|
|
39883
39887
|
tools,
|
|
39884
39888
|
onStepFinish,
|
|
39885
39889
|
abortSignal,
|
|
39886
|
-
activeTools
|
|
39890
|
+
activeTools,
|
|
39891
|
+
silent
|
|
39887
39892
|
} = opts;
|
|
39888
39893
|
const messagesContainer = { current: messages || [] };
|
|
39889
39894
|
const providerModel = getProviderModel(model);
|
|
@@ -39910,7 +39915,9 @@ function streamResponse(opts) {
|
|
|
39910
39915
|
error: error46
|
|
39911
39916
|
}) => {
|
|
39912
39917
|
try {
|
|
39913
|
-
|
|
39918
|
+
if (!silent) {
|
|
39919
|
+
console.log("Repairing tool call:", toolCall.toolName, "Error:", error46);
|
|
39920
|
+
}
|
|
39914
39921
|
const tool2 = tools2[toolCall.toolName];
|
|
39915
39922
|
if (!tool2 || !tool2.inputSchema) {
|
|
39916
39923
|
throw new Error(`Tool ${toolCall.toolName} not found or has no schema`);
|
|
@@ -39931,19 +39938,25 @@ function streamResponse(opts) {
|
|
|
39931
39938
|
});
|
|
39932
39939
|
return { ...toolCall, input: JSON.stringify(repairedArgs) };
|
|
39933
39940
|
} catch (repairError) {
|
|
39934
|
-
|
|
39941
|
+
if (!silent) {
|
|
39942
|
+
console.error("Error repairing tool call:", repairError.message);
|
|
39943
|
+
}
|
|
39935
39944
|
throw repairError;
|
|
39936
39945
|
}
|
|
39937
39946
|
}
|
|
39938
39947
|
});
|
|
39939
|
-
return wrapStreamWithErrorHandler(response, messagesContainer, opts, providerModel);
|
|
39948
|
+
return wrapStreamWithErrorHandler(response, messagesContainer, opts, providerModel, silent);
|
|
39940
39949
|
} catch (error46) {
|
|
39941
39950
|
const isContextLengthError = checkIfContextLengthError(error46);
|
|
39942
39951
|
if (isContextLengthError) {
|
|
39943
|
-
|
|
39952
|
+
if (!silent) {
|
|
39953
|
+
console.warn(`Context length error, summarizing ${messagesContainer.current.length} messages: `, error46.message);
|
|
39954
|
+
}
|
|
39944
39955
|
return createSummarizationStream(messagesContainer.current, opts, providerModel);
|
|
39945
39956
|
}
|
|
39946
|
-
|
|
39957
|
+
if (!silent) {
|
|
39958
|
+
console.error("Non-context length error, re-throwing", error46.message);
|
|
39959
|
+
}
|
|
39947
39960
|
throw error46;
|
|
39948
39961
|
}
|
|
39949
39962
|
}
|
|
@@ -43530,7 +43543,7 @@ Begin your analysis now.
|
|
|
43530
43543
|
// src/core/agent/pentestAgent/agent.ts
|
|
43531
43544
|
var execAsync2 = promisify2(exec2);
|
|
43532
43545
|
function runAgent(opts) {
|
|
43533
|
-
const { target, objective, model, onStepFinish, abortSignal } = opts;
|
|
43546
|
+
const { target, objective, model, onStepFinish, abortSignal, silent } = opts;
|
|
43534
43547
|
const session = opts.session || createSession(target, objective);
|
|
43535
43548
|
const pocsPath = join3(session.rootPath, "pocs");
|
|
43536
43549
|
if (!existsSync5(pocsPath)) {
|
|
@@ -43668,7 +43681,8 @@ Remember to follow a systematic methodology and explain your reasoning for each
|
|
|
43668
43681
|
stopWhen: stepCountIs(1e4),
|
|
43669
43682
|
toolChoice: "auto",
|
|
43670
43683
|
onStepFinish,
|
|
43671
|
-
abortSignal
|
|
43684
|
+
abortSignal,
|
|
43685
|
+
silent
|
|
43672
43686
|
});
|
|
43673
43687
|
streamResult.session = session;
|
|
43674
43688
|
return { streamResult, session };
|
package/build/index.js
CHANGED
|
@@ -71169,7 +71169,7 @@ function createSummarizationStream(messages, opts, model) {
|
|
|
71169
71169
|
}
|
|
71170
71170
|
|
|
71171
71171
|
// src/core/ai/ai.ts
|
|
71172
|
-
function wrapStreamWithErrorHandler(originalStream, messagesContainer, opts, model) {
|
|
71172
|
+
function wrapStreamWithErrorHandler(originalStream, messagesContainer, opts, model, silent) {
|
|
71173
71173
|
let wrappedStream = null;
|
|
71174
71174
|
const handler = {
|
|
71175
71175
|
get(target, prop) {
|
|
@@ -71194,13 +71194,17 @@ function wrapStreamWithErrorHandler(originalStream, messagesContainer, opts, mod
|
|
|
71194
71194
|
currentMessages = response.messages;
|
|
71195
71195
|
}
|
|
71196
71196
|
} catch (e) {}
|
|
71197
|
-
|
|
71197
|
+
if (!silent) {
|
|
71198
|
+
console.warn(`Context length error in wrapper, summarizing ${messagesContainer.current.length} messages: `, error46.message);
|
|
71199
|
+
}
|
|
71198
71200
|
const summarizationStream = createSummarizationStream(currentMessages, opts, model);
|
|
71199
71201
|
for await (const chunk of summarizationStream.fullStream) {
|
|
71200
71202
|
yield chunk;
|
|
71201
71203
|
}
|
|
71202
71204
|
} else {
|
|
71203
|
-
|
|
71205
|
+
if (!silent) {
|
|
71206
|
+
console.error("Non-context length error, re-throwing", error46.message);
|
|
71207
|
+
}
|
|
71204
71208
|
throw error46;
|
|
71205
71209
|
}
|
|
71206
71210
|
}
|
|
@@ -71224,7 +71228,8 @@ function streamResponse(opts) {
|
|
|
71224
71228
|
tools,
|
|
71225
71229
|
onStepFinish,
|
|
71226
71230
|
abortSignal,
|
|
71227
|
-
activeTools
|
|
71231
|
+
activeTools,
|
|
71232
|
+
silent
|
|
71228
71233
|
} = opts;
|
|
71229
71234
|
const messagesContainer = { current: messages || [] };
|
|
71230
71235
|
const providerModel = getProviderModel(model);
|
|
@@ -71251,7 +71256,9 @@ function streamResponse(opts) {
|
|
|
71251
71256
|
error: error46
|
|
71252
71257
|
}) => {
|
|
71253
71258
|
try {
|
|
71254
|
-
|
|
71259
|
+
if (!silent) {
|
|
71260
|
+
console.log("Repairing tool call:", toolCall.toolName, "Error:", error46);
|
|
71261
|
+
}
|
|
71255
71262
|
const tool2 = tools2[toolCall.toolName];
|
|
71256
71263
|
if (!tool2 || !tool2.inputSchema) {
|
|
71257
71264
|
throw new Error(`Tool ${toolCall.toolName} not found or has no schema`);
|
|
@@ -71272,19 +71279,25 @@ function streamResponse(opts) {
|
|
|
71272
71279
|
});
|
|
71273
71280
|
return { ...toolCall, input: JSON.stringify(repairedArgs) };
|
|
71274
71281
|
} catch (repairError) {
|
|
71275
|
-
|
|
71282
|
+
if (!silent) {
|
|
71283
|
+
console.error("Error repairing tool call:", repairError.message);
|
|
71284
|
+
}
|
|
71276
71285
|
throw repairError;
|
|
71277
71286
|
}
|
|
71278
71287
|
}
|
|
71279
71288
|
});
|
|
71280
|
-
return wrapStreamWithErrorHandler(response, messagesContainer, opts, providerModel);
|
|
71289
|
+
return wrapStreamWithErrorHandler(response, messagesContainer, opts, providerModel, silent);
|
|
71281
71290
|
} catch (error46) {
|
|
71282
71291
|
const isContextLengthError = checkIfContextLengthError(error46);
|
|
71283
71292
|
if (isContextLengthError) {
|
|
71284
|
-
|
|
71293
|
+
if (!silent) {
|
|
71294
|
+
console.warn(`Context length error, summarizing ${messagesContainer.current.length} messages: `, error46.message);
|
|
71295
|
+
}
|
|
71285
71296
|
return createSummarizationStream(messagesContainer.current, opts, providerModel);
|
|
71286
71297
|
}
|
|
71287
|
-
|
|
71298
|
+
if (!silent) {
|
|
71299
|
+
console.error("Non-context length error, re-throwing", error46.message);
|
|
71300
|
+
}
|
|
71288
71301
|
throw error46;
|
|
71289
71302
|
}
|
|
71290
71303
|
}
|
|
@@ -73642,7 +73655,7 @@ Begin your analysis now.
|
|
|
73642
73655
|
// src/core/agent/pentestAgent/agent.ts
|
|
73643
73656
|
var execAsync3 = promisify3(exec3);
|
|
73644
73657
|
function runAgent(opts) {
|
|
73645
|
-
const { target, objective, model, onStepFinish, abortSignal } = opts;
|
|
73658
|
+
const { target, objective, model, onStepFinish, abortSignal, silent } = opts;
|
|
73646
73659
|
const session = opts.session || createSession(target, objective);
|
|
73647
73660
|
const pocsPath = join4(session.rootPath, "pocs");
|
|
73648
73661
|
if (!existsSync9(pocsPath)) {
|
|
@@ -73780,7 +73793,8 @@ Remember to follow a systematic methodology and explain your reasoning for each
|
|
|
73780
73793
|
stopWhen: stepCountIs(1e4),
|
|
73781
73794
|
toolChoice: "auto",
|
|
73782
73795
|
onStepFinish,
|
|
73783
|
-
abortSignal
|
|
73796
|
+
abortSignal,
|
|
73797
|
+
silent
|
|
73784
73798
|
});
|
|
73785
73799
|
streamResult.session = session;
|
|
73786
73800
|
return { streamResult, session };
|
package/build/quicktest.js
CHANGED
|
@@ -39824,7 +39824,7 @@ function createSummarizationStream(messages, opts, model) {
|
|
|
39824
39824
|
}
|
|
39825
39825
|
|
|
39826
39826
|
// src/core/ai/ai.ts
|
|
39827
|
-
function wrapStreamWithErrorHandler(originalStream, messagesContainer, opts, model) {
|
|
39827
|
+
function wrapStreamWithErrorHandler(originalStream, messagesContainer, opts, model, silent) {
|
|
39828
39828
|
let wrappedStream = null;
|
|
39829
39829
|
const handler = {
|
|
39830
39830
|
get(target, prop) {
|
|
@@ -39849,13 +39849,17 @@ function wrapStreamWithErrorHandler(originalStream, messagesContainer, opts, mod
|
|
|
39849
39849
|
currentMessages = response.messages;
|
|
39850
39850
|
}
|
|
39851
39851
|
} catch (e) {}
|
|
39852
|
-
|
|
39852
|
+
if (!silent) {
|
|
39853
|
+
console.warn(`Context length error in wrapper, summarizing ${messagesContainer.current.length} messages: `, error46.message);
|
|
39854
|
+
}
|
|
39853
39855
|
const summarizationStream = createSummarizationStream(currentMessages, opts, model);
|
|
39854
39856
|
for await (const chunk of summarizationStream.fullStream) {
|
|
39855
39857
|
yield chunk;
|
|
39856
39858
|
}
|
|
39857
39859
|
} else {
|
|
39858
|
-
|
|
39860
|
+
if (!silent) {
|
|
39861
|
+
console.error("Non-context length error, re-throwing", error46.message);
|
|
39862
|
+
}
|
|
39859
39863
|
throw error46;
|
|
39860
39864
|
}
|
|
39861
39865
|
}
|
|
@@ -39879,7 +39883,8 @@ function streamResponse(opts) {
|
|
|
39879
39883
|
tools,
|
|
39880
39884
|
onStepFinish,
|
|
39881
39885
|
abortSignal,
|
|
39882
|
-
activeTools
|
|
39886
|
+
activeTools,
|
|
39887
|
+
silent
|
|
39883
39888
|
} = opts;
|
|
39884
39889
|
const messagesContainer = { current: messages || [] };
|
|
39885
39890
|
const providerModel = getProviderModel(model);
|
|
@@ -39906,7 +39911,9 @@ function streamResponse(opts) {
|
|
|
39906
39911
|
error: error46
|
|
39907
39912
|
}) => {
|
|
39908
39913
|
try {
|
|
39909
|
-
|
|
39914
|
+
if (!silent) {
|
|
39915
|
+
console.log("Repairing tool call:", toolCall.toolName, "Error:", error46);
|
|
39916
|
+
}
|
|
39910
39917
|
const tool2 = tools2[toolCall.toolName];
|
|
39911
39918
|
if (!tool2 || !tool2.inputSchema) {
|
|
39912
39919
|
throw new Error(`Tool ${toolCall.toolName} not found or has no schema`);
|
|
@@ -39927,19 +39934,25 @@ function streamResponse(opts) {
|
|
|
39927
39934
|
});
|
|
39928
39935
|
return { ...toolCall, input: JSON.stringify(repairedArgs) };
|
|
39929
39936
|
} catch (repairError) {
|
|
39930
|
-
|
|
39937
|
+
if (!silent) {
|
|
39938
|
+
console.error("Error repairing tool call:", repairError.message);
|
|
39939
|
+
}
|
|
39931
39940
|
throw repairError;
|
|
39932
39941
|
}
|
|
39933
39942
|
}
|
|
39934
39943
|
});
|
|
39935
|
-
return wrapStreamWithErrorHandler(response, messagesContainer, opts, providerModel);
|
|
39944
|
+
return wrapStreamWithErrorHandler(response, messagesContainer, opts, providerModel, silent);
|
|
39936
39945
|
} catch (error46) {
|
|
39937
39946
|
const isContextLengthError = checkIfContextLengthError(error46);
|
|
39938
39947
|
if (isContextLengthError) {
|
|
39939
|
-
|
|
39948
|
+
if (!silent) {
|
|
39949
|
+
console.warn(`Context length error, summarizing ${messagesContainer.current.length} messages: `, error46.message);
|
|
39950
|
+
}
|
|
39940
39951
|
return createSummarizationStream(messagesContainer.current, opts, providerModel);
|
|
39941
39952
|
}
|
|
39942
|
-
|
|
39953
|
+
if (!silent) {
|
|
39954
|
+
console.error("Non-context length error, re-throwing", error46.message);
|
|
39955
|
+
}
|
|
39943
39956
|
throw error46;
|
|
39944
39957
|
}
|
|
39945
39958
|
}
|
|
@@ -42276,7 +42289,7 @@ Begin your analysis now.
|
|
|
42276
42289
|
// src/core/agent/pentestAgent/agent.ts
|
|
42277
42290
|
var execAsync3 = promisify3(exec3);
|
|
42278
42291
|
function runAgent(opts) {
|
|
42279
|
-
const { target, objective, model, onStepFinish, abortSignal } = opts;
|
|
42292
|
+
const { target, objective, model, onStepFinish, abortSignal, silent } = opts;
|
|
42280
42293
|
const session = opts.session || createSession(target, objective);
|
|
42281
42294
|
const pocsPath = join4(session.rootPath, "pocs");
|
|
42282
42295
|
if (!existsSync6(pocsPath)) {
|
|
@@ -42414,7 +42427,8 @@ Remember to follow a systematic methodology and explain your reasoning for each
|
|
|
42414
42427
|
stopWhen: stepCountIs(1e4),
|
|
42415
42428
|
toolChoice: "auto",
|
|
42416
42429
|
onStepFinish,
|
|
42417
|
-
abortSignal
|
|
42430
|
+
abortSignal,
|
|
42431
|
+
silent
|
|
42418
42432
|
});
|
|
42419
42433
|
streamResult.session = session;
|
|
42420
42434
|
return { streamResult, session };
|
package/build/swarm.js
CHANGED
|
@@ -39824,7 +39824,7 @@ function createSummarizationStream(messages, opts, model) {
|
|
|
39824
39824
|
}
|
|
39825
39825
|
|
|
39826
39826
|
// src/core/ai/ai.ts
|
|
39827
|
-
function wrapStreamWithErrorHandler(originalStream, messagesContainer, opts, model) {
|
|
39827
|
+
function wrapStreamWithErrorHandler(originalStream, messagesContainer, opts, model, silent) {
|
|
39828
39828
|
let wrappedStream = null;
|
|
39829
39829
|
const handler = {
|
|
39830
39830
|
get(target, prop) {
|
|
@@ -39849,13 +39849,17 @@ function wrapStreamWithErrorHandler(originalStream, messagesContainer, opts, mod
|
|
|
39849
39849
|
currentMessages = response.messages;
|
|
39850
39850
|
}
|
|
39851
39851
|
} catch (e) {}
|
|
39852
|
-
|
|
39852
|
+
if (!silent) {
|
|
39853
|
+
console.warn(`Context length error in wrapper, summarizing ${messagesContainer.current.length} messages: `, error46.message);
|
|
39854
|
+
}
|
|
39853
39855
|
const summarizationStream = createSummarizationStream(currentMessages, opts, model);
|
|
39854
39856
|
for await (const chunk of summarizationStream.fullStream) {
|
|
39855
39857
|
yield chunk;
|
|
39856
39858
|
}
|
|
39857
39859
|
} else {
|
|
39858
|
-
|
|
39860
|
+
if (!silent) {
|
|
39861
|
+
console.error("Non-context length error, re-throwing", error46.message);
|
|
39862
|
+
}
|
|
39859
39863
|
throw error46;
|
|
39860
39864
|
}
|
|
39861
39865
|
}
|
|
@@ -39879,7 +39883,8 @@ function streamResponse(opts) {
|
|
|
39879
39883
|
tools,
|
|
39880
39884
|
onStepFinish,
|
|
39881
39885
|
abortSignal,
|
|
39882
|
-
activeTools
|
|
39886
|
+
activeTools,
|
|
39887
|
+
silent
|
|
39883
39888
|
} = opts;
|
|
39884
39889
|
const messagesContainer = { current: messages || [] };
|
|
39885
39890
|
const providerModel = getProviderModel(model);
|
|
@@ -39906,7 +39911,9 @@ function streamResponse(opts) {
|
|
|
39906
39911
|
error: error46
|
|
39907
39912
|
}) => {
|
|
39908
39913
|
try {
|
|
39909
|
-
|
|
39914
|
+
if (!silent) {
|
|
39915
|
+
console.log("Repairing tool call:", toolCall.toolName, "Error:", error46);
|
|
39916
|
+
}
|
|
39910
39917
|
const tool2 = tools2[toolCall.toolName];
|
|
39911
39918
|
if (!tool2 || !tool2.inputSchema) {
|
|
39912
39919
|
throw new Error(`Tool ${toolCall.toolName} not found or has no schema`);
|
|
@@ -39927,19 +39934,25 @@ function streamResponse(opts) {
|
|
|
39927
39934
|
});
|
|
39928
39935
|
return { ...toolCall, input: JSON.stringify(repairedArgs) };
|
|
39929
39936
|
} catch (repairError) {
|
|
39930
|
-
|
|
39937
|
+
if (!silent) {
|
|
39938
|
+
console.error("Error repairing tool call:", repairError.message);
|
|
39939
|
+
}
|
|
39931
39940
|
throw repairError;
|
|
39932
39941
|
}
|
|
39933
39942
|
}
|
|
39934
39943
|
});
|
|
39935
|
-
return wrapStreamWithErrorHandler(response, messagesContainer, opts, providerModel);
|
|
39944
|
+
return wrapStreamWithErrorHandler(response, messagesContainer, opts, providerModel, silent);
|
|
39936
39945
|
} catch (error46) {
|
|
39937
39946
|
const isContextLengthError = checkIfContextLengthError(error46);
|
|
39938
39947
|
if (isContextLengthError) {
|
|
39939
|
-
|
|
39948
|
+
if (!silent) {
|
|
39949
|
+
console.warn(`Context length error, summarizing ${messagesContainer.current.length} messages: `, error46.message);
|
|
39950
|
+
}
|
|
39940
39951
|
return createSummarizationStream(messagesContainer.current, opts, providerModel);
|
|
39941
39952
|
}
|
|
39942
|
-
|
|
39953
|
+
if (!silent) {
|
|
39954
|
+
console.error("Non-context length error, re-throwing", error46.message);
|
|
39955
|
+
}
|
|
39943
39956
|
throw error46;
|
|
39944
39957
|
}
|
|
39945
39958
|
}
|
|
@@ -42276,7 +42289,7 @@ Begin your analysis now.
|
|
|
42276
42289
|
// src/core/agent/pentestAgent/agent.ts
|
|
42277
42290
|
var execAsync3 = promisify3(exec3);
|
|
42278
42291
|
function runAgent(opts) {
|
|
42279
|
-
const { target, objective, model, onStepFinish, abortSignal } = opts;
|
|
42292
|
+
const { target, objective, model, onStepFinish, abortSignal, silent } = opts;
|
|
42280
42293
|
const session = opts.session || createSession(target, objective);
|
|
42281
42294
|
const pocsPath = join4(session.rootPath, "pocs");
|
|
42282
42295
|
if (!existsSync6(pocsPath)) {
|
|
@@ -42414,7 +42427,8 @@ Remember to follow a systematic methodology and explain your reasoning for each
|
|
|
42414
42427
|
stopWhen: stepCountIs(1e4),
|
|
42415
42428
|
toolChoice: "auto",
|
|
42416
42429
|
onStepFinish,
|
|
42417
|
-
abortSignal
|
|
42430
|
+
abortSignal,
|
|
42431
|
+
silent
|
|
42418
42432
|
});
|
|
42419
42433
|
streamResult.session = session;
|
|
42420
42434
|
return { streamResult, session };
|
|
@@ -42476,7 +42490,8 @@ async function swarm(options) {
|
|
|
42476
42490
|
session,
|
|
42477
42491
|
target: target.target,
|
|
42478
42492
|
objective: target.objective,
|
|
42479
|
-
model
|
|
42493
|
+
model,
|
|
42494
|
+
silent
|
|
42480
42495
|
});
|
|
42481
42496
|
for await (const delta of streamResult.fullStream) {
|
|
42482
42497
|
if (delta.type === "text-delta") {} else if (delta.type === "tool-call") {} else if (delta.type === "tool-result") {}
|