mobbdev 1.2.53 → 1.2.54
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.
|
@@ -239,6 +239,7 @@ type UploadAiBlameResult = {
|
|
|
239
239
|
inferenceCounts: SanitizationCounts;
|
|
240
240
|
promptsUUID?: string;
|
|
241
241
|
inferenceUUID?: string;
|
|
242
|
+
sanitizationDurationMs?: number;
|
|
242
243
|
};
|
|
243
244
|
declare function uploadAiBlameHandlerFromExtension(args: {
|
|
244
245
|
prompts: PromptItemArray;
|
|
@@ -251,6 +252,7 @@ declare function uploadAiBlameHandlerFromExtension(args: {
|
|
|
251
252
|
apiUrl?: string;
|
|
252
253
|
webAppUrl?: string;
|
|
253
254
|
repositoryUrl?: string | null;
|
|
255
|
+
sanitize?: boolean;
|
|
254
256
|
}): Promise<UploadAiBlameResult>;
|
|
255
257
|
type UploadAiBlameHandlerOptions = {
|
|
256
258
|
args: UploadAiBlameOptions;
|
|
@@ -7938,6 +7938,7 @@ function uploadAiBlameBuilder(args) {
|
|
|
7938
7938
|
}).strict();
|
|
7939
7939
|
}
|
|
7940
7940
|
async function uploadAiBlameHandlerFromExtension(args) {
|
|
7941
|
+
const shouldSanitize = args.sanitize ?? true;
|
|
7941
7942
|
const uploadArgs = {
|
|
7942
7943
|
prompt: [],
|
|
7943
7944
|
inference: [],
|
|
@@ -7951,28 +7952,50 @@ async function uploadAiBlameHandlerFromExtension(args) {
|
|
|
7951
7952
|
let inferenceCounts;
|
|
7952
7953
|
let promptsUUID;
|
|
7953
7954
|
let inferenceUUID;
|
|
7955
|
+
const zeroCounts = {
|
|
7956
|
+
detections: { total: 0, high: 0, medium: 0, low: 0 }
|
|
7957
|
+
};
|
|
7958
|
+
let sanitizationDurationMs;
|
|
7954
7959
|
await withFile(async (promptFile) => {
|
|
7955
|
-
const promptsResult = await sanitizeDataWithCounts(args.prompts);
|
|
7956
|
-
promptsCounts = promptsResult.counts;
|
|
7957
7960
|
promptsUUID = path6.basename(promptFile.path, path6.extname(promptFile.path));
|
|
7958
|
-
|
|
7959
|
-
|
|
7960
|
-
|
|
7961
|
-
|
|
7962
|
-
|
|
7961
|
+
if (shouldSanitize) {
|
|
7962
|
+
const sanitizeStart = performance.now();
|
|
7963
|
+
const promptsResult = await sanitizeDataWithCounts(args.prompts);
|
|
7964
|
+
promptsCounts = promptsResult.counts;
|
|
7965
|
+
await fsPromises2.writeFile(
|
|
7966
|
+
promptFile.path,
|
|
7967
|
+
JSON.stringify(promptsResult.sanitizedData, null, 2),
|
|
7968
|
+
"utf-8"
|
|
7969
|
+
);
|
|
7970
|
+
sanitizationDurationMs = performance.now() - sanitizeStart;
|
|
7971
|
+
} else {
|
|
7972
|
+
promptsCounts = zeroCounts;
|
|
7973
|
+
await fsPromises2.writeFile(
|
|
7974
|
+
promptFile.path,
|
|
7975
|
+
JSON.stringify(args.prompts, null, 2),
|
|
7976
|
+
"utf-8"
|
|
7977
|
+
);
|
|
7978
|
+
}
|
|
7963
7979
|
uploadArgs.prompt.push(promptFile.path);
|
|
7964
7980
|
await withFile(async (inferenceFile) => {
|
|
7965
|
-
const inferenceResult = await sanitizeDataWithCounts(args.inference);
|
|
7966
|
-
inferenceCounts = inferenceResult.counts;
|
|
7967
7981
|
inferenceUUID = path6.basename(
|
|
7968
7982
|
inferenceFile.path,
|
|
7969
7983
|
path6.extname(inferenceFile.path)
|
|
7970
7984
|
);
|
|
7971
|
-
|
|
7972
|
-
|
|
7973
|
-
inferenceResult.
|
|
7974
|
-
|
|
7975
|
-
|
|
7985
|
+
if (shouldSanitize) {
|
|
7986
|
+
const inferenceStart = performance.now();
|
|
7987
|
+
const inferenceResult = await sanitizeDataWithCounts(args.inference);
|
|
7988
|
+
inferenceCounts = inferenceResult.counts;
|
|
7989
|
+
await fsPromises2.writeFile(
|
|
7990
|
+
inferenceFile.path,
|
|
7991
|
+
inferenceResult.sanitizedData,
|
|
7992
|
+
"utf-8"
|
|
7993
|
+
);
|
|
7994
|
+
sanitizationDurationMs = (sanitizationDurationMs ?? 0) + (performance.now() - inferenceStart);
|
|
7995
|
+
} else {
|
|
7996
|
+
inferenceCounts = zeroCounts;
|
|
7997
|
+
await fsPromises2.writeFile(inferenceFile.path, args.inference, "utf-8");
|
|
7998
|
+
}
|
|
7976
7999
|
uploadArgs.inference.push(inferenceFile.path);
|
|
7977
8000
|
uploadArgs.model.push(args.model);
|
|
7978
8001
|
uploadArgs.toolName.push(args.tool);
|
|
@@ -7994,7 +8017,8 @@ async function uploadAiBlameHandlerFromExtension(args) {
|
|
|
7994
8017
|
promptsCounts,
|
|
7995
8018
|
inferenceCounts,
|
|
7996
8019
|
promptsUUID,
|
|
7997
|
-
inferenceUUID
|
|
8020
|
+
inferenceUUID,
|
|
8021
|
+
sanitizationDurationMs
|
|
7998
8022
|
};
|
|
7999
8023
|
}
|
|
8000
8024
|
async function uploadAiBlameHandler(options) {
|
package/dist/index.mjs
CHANGED
|
@@ -13421,6 +13421,7 @@ function uploadAiBlameBuilder(args) {
|
|
|
13421
13421
|
}).strict();
|
|
13422
13422
|
}
|
|
13423
13423
|
async function uploadAiBlameHandlerFromExtension(args) {
|
|
13424
|
+
const shouldSanitize = args.sanitize ?? true;
|
|
13424
13425
|
const uploadArgs = {
|
|
13425
13426
|
prompt: [],
|
|
13426
13427
|
inference: [],
|
|
@@ -13434,28 +13435,50 @@ async function uploadAiBlameHandlerFromExtension(args) {
|
|
|
13434
13435
|
let inferenceCounts;
|
|
13435
13436
|
let promptsUUID;
|
|
13436
13437
|
let inferenceUUID;
|
|
13438
|
+
const zeroCounts = {
|
|
13439
|
+
detections: { total: 0, high: 0, medium: 0, low: 0 }
|
|
13440
|
+
};
|
|
13441
|
+
let sanitizationDurationMs;
|
|
13437
13442
|
await withFile(async (promptFile) => {
|
|
13438
|
-
const promptsResult = await sanitizeDataWithCounts(args.prompts);
|
|
13439
|
-
promptsCounts = promptsResult.counts;
|
|
13440
13443
|
promptsUUID = path7.basename(promptFile.path, path7.extname(promptFile.path));
|
|
13441
|
-
|
|
13442
|
-
|
|
13443
|
-
|
|
13444
|
-
|
|
13445
|
-
|
|
13444
|
+
if (shouldSanitize) {
|
|
13445
|
+
const sanitizeStart = performance.now();
|
|
13446
|
+
const promptsResult = await sanitizeDataWithCounts(args.prompts);
|
|
13447
|
+
promptsCounts = promptsResult.counts;
|
|
13448
|
+
await fsPromises2.writeFile(
|
|
13449
|
+
promptFile.path,
|
|
13450
|
+
JSON.stringify(promptsResult.sanitizedData, null, 2),
|
|
13451
|
+
"utf-8"
|
|
13452
|
+
);
|
|
13453
|
+
sanitizationDurationMs = performance.now() - sanitizeStart;
|
|
13454
|
+
} else {
|
|
13455
|
+
promptsCounts = zeroCounts;
|
|
13456
|
+
await fsPromises2.writeFile(
|
|
13457
|
+
promptFile.path,
|
|
13458
|
+
JSON.stringify(args.prompts, null, 2),
|
|
13459
|
+
"utf-8"
|
|
13460
|
+
);
|
|
13461
|
+
}
|
|
13446
13462
|
uploadArgs.prompt.push(promptFile.path);
|
|
13447
13463
|
await withFile(async (inferenceFile) => {
|
|
13448
|
-
const inferenceResult = await sanitizeDataWithCounts(args.inference);
|
|
13449
|
-
inferenceCounts = inferenceResult.counts;
|
|
13450
13464
|
inferenceUUID = path7.basename(
|
|
13451
13465
|
inferenceFile.path,
|
|
13452
13466
|
path7.extname(inferenceFile.path)
|
|
13453
13467
|
);
|
|
13454
|
-
|
|
13455
|
-
|
|
13456
|
-
inferenceResult.
|
|
13457
|
-
|
|
13458
|
-
|
|
13468
|
+
if (shouldSanitize) {
|
|
13469
|
+
const inferenceStart = performance.now();
|
|
13470
|
+
const inferenceResult = await sanitizeDataWithCounts(args.inference);
|
|
13471
|
+
inferenceCounts = inferenceResult.counts;
|
|
13472
|
+
await fsPromises2.writeFile(
|
|
13473
|
+
inferenceFile.path,
|
|
13474
|
+
inferenceResult.sanitizedData,
|
|
13475
|
+
"utf-8"
|
|
13476
|
+
);
|
|
13477
|
+
sanitizationDurationMs = (sanitizationDurationMs ?? 0) + (performance.now() - inferenceStart);
|
|
13478
|
+
} else {
|
|
13479
|
+
inferenceCounts = zeroCounts;
|
|
13480
|
+
await fsPromises2.writeFile(inferenceFile.path, args.inference, "utf-8");
|
|
13481
|
+
}
|
|
13459
13482
|
uploadArgs.inference.push(inferenceFile.path);
|
|
13460
13483
|
uploadArgs.model.push(args.model);
|
|
13461
13484
|
uploadArgs.toolName.push(args.tool);
|
|
@@ -13477,7 +13500,8 @@ async function uploadAiBlameHandlerFromExtension(args) {
|
|
|
13477
13500
|
promptsCounts,
|
|
13478
13501
|
inferenceCounts,
|
|
13479
13502
|
promptsUUID,
|
|
13480
|
-
inferenceUUID
|
|
13503
|
+
inferenceUUID,
|
|
13504
|
+
sanitizationDurationMs
|
|
13481
13505
|
};
|
|
13482
13506
|
}
|
|
13483
13507
|
async function uploadAiBlameHandler(options) {
|