agentaudit 3.9.24 → 3.9.25
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/cli.mjs +24 -1
- package/package.json +1 -1
package/cli.mjs
CHANGED
|
@@ -1506,6 +1506,7 @@ async function auditRepo(url) {
|
|
|
1506
1506
|
|
|
1507
1507
|
let report = null;
|
|
1508
1508
|
let _lastLlmText = '';
|
|
1509
|
+
let providerMeta = {}; // Collect provider metadata for attestation
|
|
1509
1510
|
|
|
1510
1511
|
try {
|
|
1511
1512
|
if (resolvedProvider.id === 'anthropic') {
|
|
@@ -1534,6 +1535,12 @@ async function auditRepo(url) {
|
|
|
1534
1535
|
const text = data.content?.[0]?.text || '';
|
|
1535
1536
|
_lastLlmText = text;
|
|
1536
1537
|
report = extractJSON(text);
|
|
1538
|
+
providerMeta = {
|
|
1539
|
+
provider_msg_id: data.id || null,
|
|
1540
|
+
input_tokens: data.usage?.input_tokens || null,
|
|
1541
|
+
output_tokens: data.usage?.output_tokens || null,
|
|
1542
|
+
reported_model: data.model || null,
|
|
1543
|
+
};
|
|
1537
1544
|
} else {
|
|
1538
1545
|
// OpenAI, OpenRouter, Ollama, or Custom (all use OpenAI-compatible chat completions API)
|
|
1539
1546
|
let apiUrl, modelName, authHeaders;
|
|
@@ -1582,6 +1589,13 @@ async function auditRepo(url) {
|
|
|
1582
1589
|
const text = data.choices?.[0]?.message?.content || '';
|
|
1583
1590
|
_lastLlmText = text;
|
|
1584
1591
|
report = extractJSON(text);
|
|
1592
|
+
providerMeta = {
|
|
1593
|
+
provider_msg_id: data.id || null,
|
|
1594
|
+
provider_fingerprint: data.system_fingerprint || null,
|
|
1595
|
+
input_tokens: data.usage?.prompt_tokens || null,
|
|
1596
|
+
output_tokens: data.usage?.completion_tokens || null,
|
|
1597
|
+
reported_model: data.model || null,
|
|
1598
|
+
};
|
|
1585
1599
|
}
|
|
1586
1600
|
|
|
1587
1601
|
console.log(` ${c.green}done${c.reset} ${c.dim}(${elapsed(start)})${c.reset}`);
|
|
@@ -1642,7 +1656,16 @@ async function auditRepo(url) {
|
|
|
1642
1656
|
'Authorization': `Bearer ${creds.api_key}`,
|
|
1643
1657
|
'Content-Type': 'application/json',
|
|
1644
1658
|
},
|
|
1645
|
-
body: JSON.stringify({
|
|
1659
|
+
body: JSON.stringify({
|
|
1660
|
+
...report,
|
|
1661
|
+
audit_model: providerMeta.reported_model || actualModel,
|
|
1662
|
+
audit_provider: resolvedProvider.id,
|
|
1663
|
+
provider_msg_id: providerMeta.provider_msg_id || undefined,
|
|
1664
|
+
provider_fingerprint: providerMeta.provider_fingerprint || undefined,
|
|
1665
|
+
input_tokens: providerMeta.input_tokens || undefined,
|
|
1666
|
+
output_tokens: providerMeta.output_tokens || undefined,
|
|
1667
|
+
audit_duration_ms: Date.now() - start,
|
|
1668
|
+
}),
|
|
1646
1669
|
signal: AbortSignal.timeout(15_000),
|
|
1647
1670
|
});
|
|
1648
1671
|
if (res.ok) {
|