agent-inspect 6.17.6 → 6.17.8
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 +16 -0
- package/README.md +1 -1
- package/SECURITY.md +5 -0
- package/docs/API.md +1 -1
- package/docs/CLI.md +2 -2
- package/docs/GETTING-STARTED.md +2 -1
- package/docs/SAFE-TRACE-SHARING.md +5 -1
- package/docs/STANDARDS.md +1 -0
- package/package.json +1 -1
- package/packages/cli/dist/{chunk-GOHYSE7W.mjs → chunk-25LUDS4T.mjs} +30 -25
- package/packages/cli/dist/chunk-25LUDS4T.mjs.map +1 -0
- package/packages/cli/dist/index.cjs +85 -34
- package/packages/cli/dist/index.cjs.map +1 -1
- package/packages/cli/dist/index.mjs +60 -14
- package/packages/cli/dist/index.mjs.map +1 -1
- package/packages/cli/dist/{src-OYGG7QAZ.mjs → src-2FS6BLR7.mjs} +3 -3
- package/packages/cli/dist/{src-OYGG7QAZ.mjs.map → src-2FS6BLR7.mjs.map} +1 -1
- package/packages/core/dist/advanced.cjs +23 -22
- package/packages/core/dist/advanced.cjs.map +1 -1
- package/packages/core/dist/advanced.mjs +24 -23
- package/packages/core/dist/advanced.mjs.map +1 -1
- package/packages/core/dist/checks.cjs +5 -1
- package/packages/core/dist/checks.cjs.map +1 -1
- package/packages/core/dist/checks.mjs +1 -1
- package/packages/core/dist/{chunk-DIZPIPY2.mjs → chunk-LQC7IED3.mjs} +7 -3
- package/packages/core/dist/chunk-LQC7IED3.mjs.map +1 -0
- package/packages/cli/dist/chunk-GOHYSE7W.mjs.map +0 -1
- package/packages/core/dist/chunk-DIZPIPY2.mjs.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { createSafetyRawContentRule, createSafetyRedactionRule, createSafetySecretPatternRule, createSafetyOversizedAttributeRule, resolveTraceDir, parseDuration, buildSessionIndex, resolveBundleRunIds, getTraceFilePath, openTrace, sha256Hex, collectTraceSchemaVersions, 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, truncateStringForProfile, extractMetadata, filterTraces, truncateName, buildRunSummary, formatDuration, formatTimestamp, isAgentInspectTrace, filterMetasBySessionScope, 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, renderErrorLine, getIndent, TreeBuilder, zeroKinds, validateEvent, traceEventToPersistedInspectEvent, isPersistedInspectEvent, createRunStatusRule, createStructureOrphanRule, createStructureCycleRule, createRunDurationRule, createMaxStepDurationRule, createRequireCompletedRule, createStallDetectionRule, createObservedOutcomeRule, createRunDepthRule, createToolUsageRule, createLlmUsageRule, createStructureRelationshipRule, createStructureParallelWidthRule, summarizeObservedOutcomes, extractOutcomesFromTraceEvents, renderObservedOutcomesMarkdown, renderObservedOutcomesHtml, DEFAULT_SUITE_ARTIFACTS_DIR, parseCohortMetricList, COHORT_METRIC_IDS, parseGateList, nanoid, diffRuns, manualTraceEventsToComparableRun } from './chunk-
|
|
2
|
+
import { createSafetyRawContentRule, createSafetyRedactionRule, createSafetySecretPatternRule, createSafetyOversizedAttributeRule, resolveTraceDir, parseDuration, buildSessionIndex, resolveBundleRunIds, getTraceFilePath, openTrace, sha256Hex, collectTraceSchemaVersions, 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, truncateStringForProfile, extractMetadata, filterTraces, truncateName, buildRunSummary, formatDuration, formatTimestamp, isAgentInspectTrace, filterMetasBySessionScope, 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, renderErrorLine, getIndent, TreeBuilder, zeroKinds, validateEvent, traceEventToPersistedInspectEvent, isPersistedInspectEvent, createRunStatusRule, createStructureOrphanRule, createStructureCycleRule, createRunDurationRule, createMaxStepDurationRule, createRequireCompletedRule, createStallDetectionRule, createObservedOutcomeRule, createRunDepthRule, createToolUsageRule, createLlmUsageRule, createStructureRelationshipRule, createStructureParallelWidthRule, summarizeObservedOutcomes, extractOutcomesFromTraceEvents, renderObservedOutcomesMarkdown, renderObservedOutcomesHtml, DEFAULT_SUITE_ARTIFACTS_DIR, parseCohortMetricList, COHORT_METRIC_IDS, parseGateList, nanoid, diffRuns, manualTraceEventsToComparableRun } from './chunk-25LUDS4T.mjs';
|
|
3
3
|
import { realpathSync, constants as constants$1, existsSync, readFileSync } from 'fs';
|
|
4
4
|
import path18 from 'path';
|
|
5
5
|
import { fileURLToPath, pathToFileURL } from 'url';
|
|
@@ -13,7 +13,7 @@ import { createServer } from 'http';
|
|
|
13
13
|
import { createRequire } from 'module';
|
|
14
14
|
|
|
15
15
|
// package.json
|
|
16
|
-
var version = "6.17.
|
|
16
|
+
var version = "6.17.8";
|
|
17
17
|
|
|
18
18
|
// packages/cli/src/trace-dir-scale.ts
|
|
19
19
|
var TRACE_COUNT_WARN = 1e3;
|
|
@@ -162,13 +162,14 @@ async function list(options = {}) {
|
|
|
162
162
|
process.exitCode = 1;
|
|
163
163
|
}
|
|
164
164
|
}
|
|
165
|
+
var DECIMAL_INTEGER_PATTERN = /^\d+$/;
|
|
165
166
|
function parseKeep(raw) {
|
|
166
167
|
const trimmed = typeof raw === "string" ? raw.trim() : "";
|
|
167
|
-
if (trimmed
|
|
168
|
+
if (!DECIMAL_INTEGER_PATTERN.test(trimmed)) {
|
|
168
169
|
throw new Error(`Invalid --keep value: ${raw}. Provide a positive integer.`);
|
|
169
170
|
}
|
|
170
|
-
const n = Number
|
|
171
|
-
if (!Number.
|
|
171
|
+
const n = Number(trimmed);
|
|
172
|
+
if (!Number.isSafeInteger(n) || n <= 0) {
|
|
172
173
|
throw new Error(`Invalid --keep value: ${raw}. Provide a positive integer.`);
|
|
173
174
|
}
|
|
174
175
|
return n;
|
|
@@ -3353,7 +3354,7 @@ async function newestTraceMtimeMs(traceDir) {
|
|
|
3353
3354
|
}
|
|
3354
3355
|
async function loadSessionRuns(traceDir) {
|
|
3355
3356
|
try {
|
|
3356
|
-
const mod = await import('./src-
|
|
3357
|
+
const mod = await import('./src-2FS6BLR7.mjs');
|
|
3357
3358
|
const dbPath = mod.resolveIndexDbPath(traceDir);
|
|
3358
3359
|
const status = mod.indexStatus(dbPath);
|
|
3359
3360
|
if (!status.healthy) {
|
|
@@ -3875,6 +3876,17 @@ function isCredentialSensitiveKey(key, sensitiveKeys) {
|
|
|
3875
3876
|
return false;
|
|
3876
3877
|
}
|
|
3877
3878
|
|
|
3879
|
+
// packages/redact/src/key-value-secret.ts
|
|
3880
|
+
var KEY_VALUE_SECRET_PATTERN_SOURCE = String.raw`\b(?:api[_-]?key|internal[_-]?token|access[_-]?token|auth[_-]?token|password|secret|token)=([^\s"'\\]{8,})`;
|
|
3881
|
+
var KEY_VALUE_SECRET_PATTERN = new RegExp(
|
|
3882
|
+
KEY_VALUE_SECRET_PATTERN_SOURCE,
|
|
3883
|
+
"i"
|
|
3884
|
+
);
|
|
3885
|
+
function valueContainsKeyValueSecret(value) {
|
|
3886
|
+
KEY_VALUE_SECRET_PATTERN.lastIndex = 0;
|
|
3887
|
+
return KEY_VALUE_SECRET_PATTERN.test(value);
|
|
3888
|
+
}
|
|
3889
|
+
|
|
3878
3890
|
// packages/redact/src/index.ts
|
|
3879
3891
|
var DEFAULT_REDACT_KEYS2 = [
|
|
3880
3892
|
"authorization",
|
|
@@ -4081,6 +4093,15 @@ var credentialDetectors = [
|
|
|
4081
4093
|
pattern: /-----BEGIN [A-Z ]*PRIVATE KEY-----[\s\S]*-----END [A-Z ]*PRIVATE KEY-----/,
|
|
4082
4094
|
severity: "error"
|
|
4083
4095
|
}),
|
|
4096
|
+
{
|
|
4097
|
+
id: "value.keyValueSecret",
|
|
4098
|
+
severity: "error",
|
|
4099
|
+
matchKind: "value",
|
|
4100
|
+
detect(input3) {
|
|
4101
|
+
if (typeof input3.value !== "string") return [];
|
|
4102
|
+
return valueContainsKeyValueSecret(input3.value) ? [{ action: "replace", severity: "error", matchKind: "value" }] : [];
|
|
4103
|
+
}
|
|
4104
|
+
},
|
|
4084
4105
|
{
|
|
4085
4106
|
id: "value.creditCard",
|
|
4086
4107
|
severity: "error",
|
|
@@ -5800,12 +5821,30 @@ function uniqueSelectIds(ids) {
|
|
|
5800
5821
|
}
|
|
5801
5822
|
return out;
|
|
5802
5823
|
}
|
|
5824
|
+
function resolveForbiddenToolOptions(options) {
|
|
5825
|
+
const merged = [...options.forbiddenTool ?? [], ...options.forbidTool ?? []];
|
|
5826
|
+
const seen = /* @__PURE__ */ new Set();
|
|
5827
|
+
const out = [];
|
|
5828
|
+
for (const name of merged) {
|
|
5829
|
+
if (seen.has(name)) continue;
|
|
5830
|
+
seen.add(name);
|
|
5831
|
+
out.push(name);
|
|
5832
|
+
}
|
|
5833
|
+
return out;
|
|
5834
|
+
}
|
|
5835
|
+
function withResolvedForbiddenTools(options) {
|
|
5836
|
+
return {
|
|
5837
|
+
...options,
|
|
5838
|
+
forbiddenTool: resolveForbiddenToolOptions(options),
|
|
5839
|
+
forbidTool: void 0
|
|
5840
|
+
};
|
|
5841
|
+
}
|
|
5803
5842
|
function cliShorthandSelectIds(options) {
|
|
5804
5843
|
const ids = [];
|
|
5805
5844
|
if (options.failOnObservation !== void 0 && options.failOnObservation.trim() !== "") {
|
|
5806
5845
|
ids.push("outcome.status");
|
|
5807
5846
|
}
|
|
5808
|
-
if ((options.requiredTool?.length ?? 0) > 0 || (options.forbiddenTool?.length ?? 0) > 0) {
|
|
5847
|
+
if ((options.requiredTool?.length ?? 0) > 0 || (options.forbiddenTool?.length ?? 0) > 0 || (options.forbidTool?.length ?? 0) > 0) {
|
|
5809
5848
|
ids.push("tool.usage");
|
|
5810
5849
|
}
|
|
5811
5850
|
if ((options.allowedModel?.length ?? 0) > 0 || options.maxTotalTokens !== void 0) {
|
|
@@ -6526,6 +6565,7 @@ function readErrorResult(error) {
|
|
|
6526
6565
|
);
|
|
6527
6566
|
}
|
|
6528
6567
|
async function checkCommand(target, options = {}, stdin = process.stdin) {
|
|
6568
|
+
options = withResolvedForbiddenTools(options);
|
|
6529
6569
|
let result;
|
|
6530
6570
|
let phase = "config";
|
|
6531
6571
|
let evidenceRead;
|
|
@@ -10914,6 +10954,9 @@ async function initCommand(options = {}) {
|
|
|
10914
10954
|
process.exitCode = 1;
|
|
10915
10955
|
}
|
|
10916
10956
|
}
|
|
10957
|
+
var DOCS_BASE = "https://github.com/rajudandigam/agent-inspect/blob/main/docs";
|
|
10958
|
+
var AGENT_INSPECT_NOT_RESOLVABLE_MESSAGE = "agent-inspect does not resolve from this project. A global CLI install is not enough \u2014 the package must be a dependency here.";
|
|
10959
|
+
var AGENT_INSPECT_NOT_RESOLVABLE_REMEDIATION = `Install it in this project: npm install agent-inspect (or pnpm add agent-inspect). See ${DOCS_BASE}/FIRST-TRACE-IN-5-MINUTES.md`;
|
|
10917
10960
|
var OPTIONAL_PACKAGES = {
|
|
10918
10961
|
custom: [],
|
|
10919
10962
|
"ai-sdk": ["@agent-inspect/ai-sdk"],
|
|
@@ -10928,7 +10971,7 @@ function nodeVersionCheck() {
|
|
|
10928
10971
|
id: "node-version",
|
|
10929
10972
|
status: "fail",
|
|
10930
10973
|
message: `Node ${process2.versions.node} is below the supported minimum (20).`,
|
|
10931
|
-
remediation:
|
|
10974
|
+
remediation: `Upgrade to Node 20 LTS or newer, then reinstall. See ${DOCS_BASE}/GETTING-STARTED.md`,
|
|
10932
10975
|
evidence: process2.versions.node
|
|
10933
10976
|
};
|
|
10934
10977
|
}
|
|
@@ -10972,7 +11015,7 @@ async function traceDirWritable(traceDir) {
|
|
|
10972
11015
|
id: "trace-dir-writable",
|
|
10973
11016
|
status: "fail",
|
|
10974
11017
|
message: `Trace directory is not writable: ${resolved}`,
|
|
10975
|
-
remediation:
|
|
11018
|
+
remediation: `Create the directory or set AGENT_INSPECT_TRACE_DIR to a writable path. See ${DOCS_BASE}/GETTING-STARTED.md`,
|
|
10976
11019
|
evidence: error instanceof Error ? error.message : String(error)
|
|
10977
11020
|
};
|
|
10978
11021
|
}
|
|
@@ -11035,8 +11078,8 @@ function importSmoke(cwd) {
|
|
|
11035
11078
|
results.push({
|
|
11036
11079
|
id: "import-agent-inspect",
|
|
11037
11080
|
status: "warn",
|
|
11038
|
-
message:
|
|
11039
|
-
remediation:
|
|
11081
|
+
message: AGENT_INSPECT_NOT_RESOLVABLE_MESSAGE,
|
|
11082
|
+
remediation: AGENT_INSPECT_NOT_RESOLVABLE_REMEDIATION
|
|
11040
11083
|
});
|
|
11041
11084
|
results.push({
|
|
11042
11085
|
id: "import-agent-inspect-cjs",
|
|
@@ -11085,8 +11128,8 @@ function versionMismatchCheck(cwd) {
|
|
|
11085
11128
|
return {
|
|
11086
11129
|
id: "version-alignment",
|
|
11087
11130
|
status: "warn",
|
|
11088
|
-
message: `CLI version ${version} differs from local agent-inspect@${root.version}.`,
|
|
11089
|
-
remediation:
|
|
11131
|
+
message: `CLI version ${version} differs from local agent-inspect@${root.version}. A packed consumer can hit this when npx uses a cached global CLI.`,
|
|
11132
|
+
remediation: `Align versions with npm install agent-inspect@${version}, or run via the local binary. See ${DOCS_BASE}/KNOWN-ISSUES.md`,
|
|
11090
11133
|
evidence: `cli=${version};local=${root.version}`
|
|
11091
11134
|
};
|
|
11092
11135
|
}
|
|
@@ -11632,7 +11675,7 @@ function isModuleNotFound4(e) {
|
|
|
11632
11675
|
}
|
|
11633
11676
|
async function loadIndexSqlite() {
|
|
11634
11677
|
try {
|
|
11635
|
-
return await import('./src-
|
|
11678
|
+
return await import('./src-2FS6BLR7.mjs');
|
|
11636
11679
|
} catch (e) {
|
|
11637
11680
|
if (isModuleNotFound4(e)) {
|
|
11638
11681
|
console.error(
|
|
@@ -12521,6 +12564,9 @@ function createCliProgram() {
|
|
|
12521
12564
|
]).option("--forbidden-tool <name>", "forbid a tool name (repeatable)", (value, previous = []) => [
|
|
12522
12565
|
...previous,
|
|
12523
12566
|
value
|
|
12567
|
+
]).option("--forbid-tool <name>", "alias for --forbidden-tool (repeatable)", (value, previous = []) => [
|
|
12568
|
+
...previous,
|
|
12569
|
+
value
|
|
12524
12570
|
]).option("--allowed-model <model>", "allow an LLM model (repeatable)", (value, previous = []) => [
|
|
12525
12571
|
...previous,
|
|
12526
12572
|
value
|