agent-inspect 6.31.33 → 6.31.34
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/CHANGELOG.md +6 -0
- package/README.md +1 -1
- package/package.json +1 -1
- package/packages/cli/dist/{chunk-AILSHDEF.mjs → chunk-6TXW53UR.mjs} +32 -17
- package/packages/cli/dist/chunk-6TXW53UR.mjs.map +1 -0
- package/packages/cli/dist/index.cjs +91 -31
- package/packages/cli/dist/index.cjs.map +1 -1
- package/packages/cli/dist/index.mjs +64 -19
- package/packages/cli/dist/index.mjs.map +1 -1
- package/packages/cli/dist/{src-SP36M4VB.mjs → src-GCLC4DIC.mjs} +3 -3
- package/packages/cli/dist/{src-SP36M4VB.mjs.map → src-GCLC4DIC.mjs.map} +1 -1
- package/packages/core/dist/advanced.cjs +3 -2
- package/packages/core/dist/advanced.cjs.map +1 -1
- package/packages/core/dist/advanced.mjs +9 -9
- package/packages/core/dist/checks.cjs +27 -13
- package/packages/core/dist/checks.cjs.map +1 -1
- package/packages/core/dist/checks.mjs +3 -3
- package/packages/core/dist/{chunk-6S666BF4.mjs → chunk-2SKAI5ZN.mjs} +3 -3
- package/packages/core/dist/{chunk-6S666BF4.mjs.map → chunk-2SKAI5ZN.mjs.map} +1 -1
- package/packages/core/dist/{chunk-FBPDF7HO.mjs → chunk-6F6KLGCR.mjs} +3 -3
- package/packages/core/dist/{chunk-FBPDF7HO.mjs.map → chunk-6F6KLGCR.mjs.map} +1 -1
- package/packages/core/dist/{chunk-EMDJLFRK.mjs → chunk-CXC7L4PY.mjs} +30 -16
- package/packages/core/dist/chunk-CXC7L4PY.mjs.map +1 -0
- package/packages/core/dist/{chunk-RB6WANSW.mjs → chunk-PU3FF5AP.mjs} +5 -4
- package/packages/core/dist/chunk-PU3FF5AP.mjs.map +1 -0
- package/packages/core/dist/{chunk-VIEJJ5JB.mjs → chunk-X5RP2E2H.mjs} +4 -4
- package/packages/core/dist/{chunk-VIEJJ5JB.mjs.map → chunk-X5RP2E2H.mjs.map} +1 -1
- package/packages/core/dist/exporters.cjs +33 -9
- package/packages/core/dist/exporters.cjs.map +1 -1
- package/packages/core/dist/exporters.mjs +33 -10
- package/packages/core/dist/exporters.mjs.map +1 -1
- package/packages/core/dist/index.cjs +3 -2
- package/packages/core/dist/index.cjs.map +1 -1
- package/packages/core/dist/index.mjs +4 -4
- package/packages/core/dist/writers.cjs +3 -2
- package/packages/core/dist/writers.cjs.map +1 -1
- package/packages/core/dist/writers.mjs +1 -1
- package/packages/cli/dist/chunk-AILSHDEF.mjs.map +0 -1
- package/packages/core/dist/chunk-EMDJLFRK.mjs.map +0 -1
- package/packages/core/dist/chunk-RB6WANSW.mjs.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { ATTRIBUTION_CONFIDENCES, createSafetyRawContentRule, createSafetyRedactionRule, createSafetySecretPatternRule, createSafetyOversizedAttributeRule, resolveTraceDir, parseDuration, buildSessionIndex, resolveBundleRunIds, getTraceFilePath, openTrace, sha256Hex, collectTraceSchemaVersions, persistedInspectEventsToRunTrees, aggregateBundleSafeStatus, bundleFailsOnSafety, bundleRunAssetRelativePath, buildPlaceholderArtifact, EVIDENCE_HTML_FILENAME, EVIDENCE_MANIFEST_FILENAME, buildBundleMetadata, buildBundleSummaryMarkdown, buildEvidenceHtmlShell, buildEvidenceProvenanceViewHtml, EVIDENCE_FORMAT_VERSION, inferEvidenceFileRole, buildEvidenceSafetyViewHtml, buildEvidenceDiffViewHtml, buildEvidenceCircuitViewHtml, buildEvidenceOutcomesViewHtml, buildEvidenceContractsViewHtml, buildEvidenceToolsLlmViewHtml, buildEvidenceCausalFailureViewHtml, buildEvidenceTimelineViewHtml, buildEvidenceTreeViewHtml, buildEvidenceManifest, serializeEvidenceManifest, buildZipArchive, assertBundlePathContained, enrichSessionRunRecord, normalizeBundleOutputPath, sanitizeBundleRunId, defaultBundleOutputPath, runTraceChecks, assertEvidenceRelativePath, TraceDirectory, loadTraceMetadataList, loadSessionRunRecords, TraceReadError, resolveRedactionProfile, applyProfileMetadataCaps, Redactor, flattenTree, escapeHtml, safeString, compactAttributes, stableJson, escapeMarkdown, IDENTITY_CONFLICT_ATTR, DELIVERY_CONFLICT_ATTR, DELIVERY_EVENT_BASE_ATTR, DEFAULT_REDACT_KEYS, truncateStringForProfile, stringContainsHighConfidenceCredential, isCredentialSensitiveKey, extractMetadata, filterTraces, truncateName, buildRunSummary, formatDuration, formatTimestamp, renderErrorLine, isAgentInspectTrace, defineTraceContract, filterMetasBySessionScope, evaluateTraceContract, aggregateSessionCheckResults, createBaselineRegressionRule, summarizeSemanticParity, buildEvidenceCiPackage, verifyEvidenceDirectory, diffTraceEvents, renderRunDiff, buildRunTimeline, renderTimeline, buildTraceStats, renderTraceStats, parseDurationFilter, searchTraces, formatStepLabel, buildActivitySummary, renderActivitySummaryHuman, buildRunWhatSummary, renderRunWhat, buildLocalExplanation, resolveSuiteTemplate, defaultSuiteConfigTemplate, loadSuiteConfig, validateSuiteConfig, runSuite, renderSuiteReport, analyzeCohort, renderCohortReport, gateHasThresholds, runGate, renderGateReport, persistedInspectEventsToTraceEvents, renderStepLine, getIndent, TreeBuilder, validateEvent, traceEventToPersistedInspectEvent, isPersistedInspectEvent, createRunStatusRule, createStructureOrphanRule, createStructureCycleRule, createRunDurationRule, createMaxStepDurationRule, createRequireCompletedRule, createStallDetectionRule, createObservedOutcomeRule, createRunDepthRule, createToolUsageRule, createLlmUsageRule, createStructureRelationshipRule, createStructureParallelWidthRule, projectLogicalEvents, summarizeObservedOutcomes, extractOutcomesFromTraceEvents, renderObservedOutcomesMarkdown, renderObservedOutcomesHtml, DEFAULT_SUITE_ARTIFACTS_DIR, parseCohortMetricList, COHORT_METRIC_IDS, parseGateList, nanoid, isAttributionConfidence, zeroKinds, diffRuns, manualTraceEventsToComparableRun } from './chunk-
|
|
2
|
+
import { ATTRIBUTION_CONFIDENCES, createSafetyRawContentRule, createSafetyRedactionRule, createSafetySecretPatternRule, createSafetyOversizedAttributeRule, resolveTraceDir, parseDuration, buildSessionIndex, resolveBundleRunIds, getTraceFilePath, openTrace, sha256Hex, collectTraceSchemaVersions, persistedInspectEventsToRunTrees, aggregateBundleSafeStatus, bundleFailsOnSafety, bundleRunAssetRelativePath, buildPlaceholderArtifact, EVIDENCE_HTML_FILENAME, EVIDENCE_MANIFEST_FILENAME, buildBundleMetadata, buildBundleSummaryMarkdown, buildEvidenceHtmlShell, buildEvidenceProvenanceViewHtml, EVIDENCE_FORMAT_VERSION, inferEvidenceFileRole, buildEvidenceSafetyViewHtml, buildEvidenceDiffViewHtml, buildEvidenceCircuitViewHtml, buildEvidenceOutcomesViewHtml, buildEvidenceContractsViewHtml, buildEvidenceToolsLlmViewHtml, buildEvidenceCausalFailureViewHtml, buildEvidenceTimelineViewHtml, buildEvidenceTreeViewHtml, buildEvidenceManifest, serializeEvidenceManifest, buildZipArchive, assertBundlePathContained, enrichSessionRunRecord, normalizeBundleOutputPath, sanitizeBundleRunId, defaultBundleOutputPath, runTraceChecks, assertEvidenceRelativePath, TraceDirectory, loadTraceMetadataList, loadSessionRunRecords, TraceReadError, resolveRedactionProfile, applyProfileMetadataCaps, Redactor, flattenTree, escapeHtml, safeString, compactAttributes, stableJson, escapeMarkdown, IDENTITY_CONFLICT_ATTR, DELIVERY_CONFLICT_ATTR, DELIVERY_EVENT_BASE_ATTR, DEFAULT_REDACT_KEYS, truncateStringForProfile, stringContainsHighConfidenceCredential, isCredentialSensitiveKey, extractMetadata, filterTraces, truncateName, buildRunSummary, formatDuration, formatTimestamp, renderErrorLine, isAgentInspectTrace, defineTraceContract, filterMetasBySessionScope, evaluateTraceContract, aggregateSessionCheckResults, createBaselineRegressionRule, summarizeSemanticParity, buildEvidenceCiPackage, verifyEvidenceDirectory, diffTraceEvents, renderRunDiff, buildRunTimeline, renderTimeline, buildTraceStats, renderTraceStats, parseDurationFilter, searchTraces, formatStepLabel, buildActivitySummary, renderActivitySummaryHuman, buildRunWhatSummary, renderRunWhat, buildLocalExplanation, resolveSuiteTemplate, defaultSuiteConfigTemplate, loadSuiteConfig, validateSuiteConfig, runSuite, renderSuiteReport, analyzeCohort, renderCohortReport, gateHasThresholds, runGate, renderGateReport, persistedInspectEventsToTraceEvents, renderStepLine, getIndent, TreeBuilder, validateEvent, traceEventToPersistedInspectEvent, isPersistedInspectEvent, createRunStatusRule, createStructureOrphanRule, createStructureCycleRule, createRunDurationRule, createMaxStepDurationRule, createRequireCompletedRule, createStallDetectionRule, createObservedOutcomeRule, createRunDepthRule, createToolUsageRule, createLlmUsageRule, createStructureRelationshipRule, createStructureParallelWidthRule, projectLogicalEvents, summarizeObservedOutcomes, extractOutcomesFromTraceEvents, renderObservedOutcomesMarkdown, renderObservedOutcomesHtml, DEFAULT_SUITE_ARTIFACTS_DIR, parseCohortMetricList, COHORT_METRIC_IDS, parseGateList, nanoid, isAttributionConfidence, zeroKinds, diffRuns, manualTraceEventsToComparableRun } from './chunk-6TXW53UR.mjs';
|
|
3
3
|
import { realpathSync, constants as constants$1, existsSync, readFileSync } from 'fs';
|
|
4
4
|
import path19 from 'path';
|
|
5
5
|
import { fileURLToPath, pathToFileURL } from 'url';
|
|
@@ -14,7 +14,7 @@ import { createServer } from 'http';
|
|
|
14
14
|
import { createRequire } from 'module';
|
|
15
15
|
|
|
16
16
|
// package.json
|
|
17
|
-
var version = "6.31.
|
|
17
|
+
var version = "6.31.34";
|
|
18
18
|
|
|
19
19
|
// packages/cli/src/trace-dir-scale.ts
|
|
20
20
|
var TRACE_COUNT_WARN = 1e3;
|
|
@@ -2188,11 +2188,25 @@ function attemptIdOf(event) {
|
|
|
2188
2188
|
}
|
|
2189
2189
|
return void 0;
|
|
2190
2190
|
}
|
|
2191
|
+
function operationIdOf(event) {
|
|
2192
|
+
const direct = event.attributes?.operationId;
|
|
2193
|
+
if (typeof direct === "string" && direct.trim() !== "") return direct;
|
|
2194
|
+
const meta = event.attributes?.metadata;
|
|
2195
|
+
if (meta && typeof meta === "object" && !Array.isArray(meta)) {
|
|
2196
|
+
const nested = meta.operationId;
|
|
2197
|
+
if (typeof nested === "string" && nested.trim() !== "") return nested;
|
|
2198
|
+
}
|
|
2199
|
+
return void 0;
|
|
2200
|
+
}
|
|
2191
2201
|
function lifecycleKey(event) {
|
|
2192
2202
|
if (event.kind === "RUN") return `run:${event.runId}`;
|
|
2193
2203
|
const stepId = stepIdOf(event);
|
|
2194
|
-
if (stepId
|
|
2195
|
-
|
|
2204
|
+
if (stepId === void 0) return `event:${event.eventId}`;
|
|
2205
|
+
const attemptId = attemptIdOf(event);
|
|
2206
|
+
if (attemptId !== void 0) return `step:${stepId}:attempt:${attemptId}`;
|
|
2207
|
+
const operationId = operationIdOf(event);
|
|
2208
|
+
if (operationId !== void 0) return `step:${stepId}:op:${operationId}`;
|
|
2209
|
+
return `step:${stepId}`;
|
|
2196
2210
|
}
|
|
2197
2211
|
function isTerminal(status) {
|
|
2198
2212
|
return status === "ok" || status === "error";
|
|
@@ -2243,6 +2257,12 @@ function joinSiblingGroup(group) {
|
|
|
2243
2257
|
const others = group.filter(
|
|
2244
2258
|
(n) => !isTerminal(n.event.status) && n.event.status !== "running"
|
|
2245
2259
|
);
|
|
2260
|
+
const operationIds = new Set(
|
|
2261
|
+
group.map((n) => operationIdOf(n.event)).filter((id) => id !== void 0)
|
|
2262
|
+
);
|
|
2263
|
+
if (operationIds.size > 1) {
|
|
2264
|
+
return group;
|
|
2265
|
+
}
|
|
2246
2266
|
const terminalStatuses = new Set(terminals.map((n) => n.event.status));
|
|
2247
2267
|
if (terminalStatuses.size > 1) {
|
|
2248
2268
|
return group;
|
|
@@ -2254,19 +2274,22 @@ function joinSiblingGroup(group) {
|
|
|
2254
2274
|
const out = [];
|
|
2255
2275
|
for (const terminal of terminals) {
|
|
2256
2276
|
const terminalAttempt = attemptIdOf(terminal.event);
|
|
2277
|
+
const terminalOp = operationIdOf(terminal.event);
|
|
2257
2278
|
const terminalTs = eventTime(terminal.event);
|
|
2258
|
-
const
|
|
2279
|
+
const candidates = runnings.filter((r) => {
|
|
2259
2280
|
if (usedRunning.has(r.event.eventId)) return false;
|
|
2260
2281
|
if (eventTime(r.event) > terminalTs) return false;
|
|
2282
|
+
const runningOp = operationIdOf(r.event);
|
|
2283
|
+
if (terminalOp !== void 0 && runningOp !== void 0 && terminalOp !== runningOp) {
|
|
2284
|
+
return false;
|
|
2285
|
+
}
|
|
2261
2286
|
const runningAttempt = attemptIdOf(r.event);
|
|
2262
2287
|
if (terminalAttempt !== void 0) {
|
|
2263
2288
|
return runningAttempt === terminalAttempt;
|
|
2264
2289
|
}
|
|
2265
|
-
|
|
2266
|
-
return true;
|
|
2267
|
-
}
|
|
2268
|
-
return true;
|
|
2290
|
+
return runningAttempt === void 0;
|
|
2269
2291
|
});
|
|
2292
|
+
const candidate = candidates.length === 1 ? candidates[0] : void 0;
|
|
2270
2293
|
if (candidate) {
|
|
2271
2294
|
usedRunning.add(candidate.event.eventId);
|
|
2272
2295
|
out.push(joinOnePair(candidate, terminal));
|
|
@@ -4243,7 +4266,7 @@ async function newestTraceMtimeMs(traceDir) {
|
|
|
4243
4266
|
}
|
|
4244
4267
|
async function loadSessionRuns(traceDir) {
|
|
4245
4268
|
try {
|
|
4246
|
-
const mod = await import('./src-
|
|
4269
|
+
const mod = await import('./src-GCLC4DIC.mjs');
|
|
4247
4270
|
const dbPath = mod.resolveIndexDbPath(traceDir);
|
|
4248
4271
|
const status = mod.indexStatus(dbPath);
|
|
4249
4272
|
if (!status.healthy) {
|
|
@@ -5117,10 +5140,11 @@ var credentialDetectors = [
|
|
|
5117
5140
|
severity: "error"
|
|
5118
5141
|
}),
|
|
5119
5142
|
// Stripe secret/restricted keys (underscore form). Keep in sync with
|
|
5120
|
-
// packages/core/src/safety/credential-value-patterns.ts + checks DEFAULT_SECRET_PATTERNS (#520).
|
|
5143
|
+
// packages/core/src/safety/credential-value-patterns.ts + checks DEFAULT_SECRET_PATTERNS (#520/#528).
|
|
5144
|
+
// Non-alnum lookarounds so underscore-adjacent forms (acct_sk_live_…, …_eu) match.
|
|
5121
5145
|
patternDetector({
|
|
5122
5146
|
id: "value.stripeSecretKey",
|
|
5123
|
-
pattern:
|
|
5147
|
+
pattern: /(?<![A-Za-z0-9])(?:sk|rk)_(?:live|test)_[A-Za-z0-9]{16,}(?![A-Za-z0-9])/,
|
|
5124
5148
|
severity: "error"
|
|
5125
5149
|
}),
|
|
5126
5150
|
patternDetector({
|
|
@@ -6883,6 +6907,21 @@ function stableJson2(value) {
|
|
|
6883
6907
|
return `${JSON.stringify(value, null, 2)}
|
|
6884
6908
|
`;
|
|
6885
6909
|
}
|
|
6910
|
+
function alignCheckResultsAggregateStatus(checkResultsJson, assessmentStatus) {
|
|
6911
|
+
let parsed;
|
|
6912
|
+
try {
|
|
6913
|
+
parsed = JSON.parse(checkResultsJson);
|
|
6914
|
+
} catch {
|
|
6915
|
+
return stableJson2({
|
|
6916
|
+
aggregateStatus: assessmentStatus,
|
|
6917
|
+
raw: checkResultsJson
|
|
6918
|
+
});
|
|
6919
|
+
}
|
|
6920
|
+
return stableJson2({
|
|
6921
|
+
...parsed,
|
|
6922
|
+
aggregateStatus: assessmentStatus
|
|
6923
|
+
});
|
|
6924
|
+
}
|
|
6886
6925
|
async function writeLocalEvidence(input3) {
|
|
6887
6926
|
const profile = input3.redactionProfile ?? "share";
|
|
6888
6927
|
const format = input3.format ?? "directory";
|
|
@@ -6921,6 +6960,10 @@ async function writeLocalEvidence(input3) {
|
|
|
6921
6960
|
format: "agent-inspect-jsonl"
|
|
6922
6961
|
});
|
|
6923
6962
|
const assessmentStatus = residualStatusToEvidenceSafe(residual.status);
|
|
6963
|
+
const checkResultsJson = alignCheckResultsAggregateStatus(
|
|
6964
|
+
input3.checkResultsJson,
|
|
6965
|
+
assessmentStatus
|
|
6966
|
+
);
|
|
6924
6967
|
const evidencePackage = buildEvidenceCiPackage({
|
|
6925
6968
|
generatorVersion: version,
|
|
6926
6969
|
runIds: input3.runIds,
|
|
@@ -6928,7 +6971,7 @@ async function writeLocalEvidence(input3) {
|
|
|
6928
6971
|
redactedTraceJsonl: combined,
|
|
6929
6972
|
redactionProfile: profile,
|
|
6930
6973
|
assessmentStatus,
|
|
6931
|
-
checkResultsJson
|
|
6974
|
+
checkResultsJson,
|
|
6932
6975
|
...input3.summaryText !== void 0 ? { summaryText: input3.summaryText } : {},
|
|
6933
6976
|
...input3.contractPackage !== void 0 ? { contractPackage: input3.contractPackage } : {}
|
|
6934
6977
|
});
|
|
@@ -6989,12 +7032,12 @@ async function writeLocalEvidence(input3) {
|
|
|
6989
7032
|
return baseDir;
|
|
6990
7033
|
}
|
|
6991
7034
|
function checkResultToEvidenceJson(result, runIds) {
|
|
6992
|
-
const status = result.status === "pass" ? "SAFE" : result.status === "fail" ? "UNSAFE" : "UNKNOWN";
|
|
6993
7035
|
return stableJson2({
|
|
6994
|
-
aggregateStatus:
|
|
7036
|
+
aggregateStatus: "UNKNOWN",
|
|
7037
|
+
checkStatus: result.status,
|
|
6995
7038
|
runs: runIds.map((runId) => ({
|
|
6996
7039
|
runId,
|
|
6997
|
-
status,
|
|
7040
|
+
checkStatus: result.status,
|
|
6998
7041
|
errors: result.summary.errors,
|
|
6999
7042
|
warnings: result.summary.warnings,
|
|
7000
7043
|
findings: result.findings.length,
|
|
@@ -14256,7 +14299,7 @@ function isModuleNotFound4(e) {
|
|
|
14256
14299
|
}
|
|
14257
14300
|
async function loadIndexSqlite() {
|
|
14258
14301
|
try {
|
|
14259
|
-
return await import('./src-
|
|
14302
|
+
return await import('./src-GCLC4DIC.mjs');
|
|
14260
14303
|
} catch (e) {
|
|
14261
14304
|
if (isModuleNotFound4(e)) {
|
|
14262
14305
|
console.error(
|
|
@@ -15014,10 +15057,12 @@ async function gateCommand(options = {}) {
|
|
|
15014
15057
|
runIds: runIds.length > 0 ? runIds : ["gate"],
|
|
15015
15058
|
sourceContents,
|
|
15016
15059
|
...gateOptions.traceDir !== void 0 ? { dir: gateOptions.traceDir } : {},
|
|
15017
|
-
|
|
15060
|
+
// aggregateStatus is filled from residual assessment before hashing (#529).
|
|
15061
|
+
// Gate pass/fail stays in `gate` / process.exitCode, not aggregateStatus.
|
|
15018
15062
|
checkResultsJson: `${JSON.stringify(
|
|
15019
15063
|
{
|
|
15020
|
-
aggregateStatus:
|
|
15064
|
+
aggregateStatus: "UNKNOWN",
|
|
15065
|
+
gateStatus: failed ? "fail" : "pass",
|
|
15021
15066
|
gate: result
|
|
15022
15067
|
},
|
|
15023
15068
|
null,
|