agent-inspect 6.12.2 → 6.14.0
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/package.json +1 -1
- package/packages/cli/dist/{chunk-4WA7DQCM.mjs → chunk-MEO2Z3KE.mjs} +40 -9
- package/packages/cli/dist/chunk-MEO2Z3KE.mjs.map +1 -0
- package/packages/cli/dist/index.cjs +87 -11
- package/packages/cli/dist/index.cjs.map +1 -1
- package/packages/cli/dist/index.mjs +47 -8
- package/packages/cli/dist/index.mjs.map +1 -1
- package/packages/cli/dist/{src-YAASTXGE.mjs → src-6VZNGIF6.mjs} +3 -3
- package/packages/cli/dist/{src-YAASTXGE.mjs.map → src-6VZNGIF6.mjs.map} +1 -1
- package/packages/core/dist/advanced.cjs +13 -6
- package/packages/core/dist/advanced.cjs.map +1 -1
- package/packages/core/dist/advanced.d.cts +24 -1
- package/packages/core/dist/advanced.d.ts +24 -1
- package/packages/core/dist/advanced.mjs +4 -2
- package/packages/core/dist/advanced.mjs.map +1 -1
- package/packages/core/dist/checks.cjs +78 -7
- package/packages/core/dist/checks.cjs.map +1 -1
- package/packages/core/dist/checks.d.cts +58 -4
- package/packages/core/dist/checks.d.ts +58 -4
- package/packages/core/dist/checks.mjs +1 -1
- package/packages/core/dist/{chunk-KJICERSD.mjs → chunk-BS2QCAJX.mjs} +79 -10
- package/packages/core/dist/chunk-BS2QCAJX.mjs.map +1 -0
- package/packages/core/dist/{index-CgCH8NE9.d.ts → index-Bu_vOjql.d.ts} +1 -1
- package/packages/core/dist/{index-BOP33T4O.d.cts → index-CmXMS-MF.d.cts} +1 -1
- package/packages/cli/dist/chunk-4WA7DQCM.mjs.map +0 -1
- package/packages/core/dist/chunk-KJICERSD.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, buildEvidenceCiPackage, verifyEvidenceDirectory, diffTraceEvents, renderRunDiff, buildRunTimeline, renderTimeline, buildTraceStats, renderTraceStats, parseDurationFilter, searchTraces, 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, 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-MEO2Z3KE.mjs';
|
|
3
3
|
import { realpathSync, constants as constants$1, existsSync, readFileSync } from 'fs';
|
|
4
4
|
import path16 from 'path';
|
|
5
5
|
import { fileURLToPath, pathToFileURL } from 'url';
|
|
@@ -11,7 +11,7 @@ import { createServer } from 'http';
|
|
|
11
11
|
import { createRequire } from 'module';
|
|
12
12
|
|
|
13
13
|
// package.json
|
|
14
|
-
var version = "6.
|
|
14
|
+
var version = "6.14.0";
|
|
15
15
|
|
|
16
16
|
// packages/cli/src/trace-dir-scale.ts
|
|
17
17
|
var TRACE_COUNT_WARN = 1e3;
|
|
@@ -3346,7 +3346,7 @@ async function newestTraceMtimeMs(traceDir) {
|
|
|
3346
3346
|
}
|
|
3347
3347
|
async function loadSessionRuns(traceDir) {
|
|
3348
3348
|
try {
|
|
3349
|
-
const mod = await import('./src-
|
|
3349
|
+
const mod = await import('./src-6VZNGIF6.mjs');
|
|
3350
3350
|
const dbPath = mod.resolveIndexDbPath(traceDir);
|
|
3351
3351
|
const status = mod.indexStatus(dbPath);
|
|
3352
3352
|
if (!status.healthy) {
|
|
@@ -8588,6 +8588,7 @@ async function artifactsCommand(target, options = {}, stdin = process.stdin) {
|
|
|
8588
8588
|
findings: check.findings.length
|
|
8589
8589
|
}))
|
|
8590
8590
|
});
|
|
8591
|
+
const parity = summarizeSemanticParity(read.events);
|
|
8591
8592
|
const evidencePackage = buildEvidenceCiPackage({
|
|
8592
8593
|
generatorVersion: version,
|
|
8593
8594
|
runIds,
|
|
@@ -8596,7 +8597,18 @@ async function artifactsCommand(target, options = {}, stdin = process.stdin) {
|
|
|
8596
8597
|
redactionProfile: "strict",
|
|
8597
8598
|
assessmentStatus: toEvidenceStatus(status),
|
|
8598
8599
|
checkResultsJson,
|
|
8599
|
-
summaryText: renderMarkdown(trace, check, diff)
|
|
8600
|
+
summaryText: renderMarkdown(trace, check, diff),
|
|
8601
|
+
semantics: {
|
|
8602
|
+
projectionVersion: "logical-lifecycle-0.1",
|
|
8603
|
+
rawEventCount: parity.rawEventCount,
|
|
8604
|
+
logicalEventCount: parity.logicalEventCount,
|
|
8605
|
+
runningLogicalCount: parity.runningLogicalCount,
|
|
8606
|
+
finishedToolCount: parity.finishedToolCount,
|
|
8607
|
+
finishedToolNames: [...parity.finishedToolNames],
|
|
8608
|
+
pairedCount: parity.pairedCount,
|
|
8609
|
+
parentRemapCount: parity.parentRemapCount,
|
|
8610
|
+
contractStatus: check.status === "pass" ? "pass" : check.status === "fail" ? "fail" : "error"
|
|
8611
|
+
}
|
|
8600
8612
|
});
|
|
8601
8613
|
await writeArtifact(outputDir, "evidence.html", evidencePackage["evidence.html"], files);
|
|
8602
8614
|
await writeArtifact(outputDir, "evidence.json", evidencePackage["evidence.json"], files);
|
|
@@ -9677,11 +9689,11 @@ var TRACE_DIR = ".agent-inspect";
|
|
|
9677
9689
|
var GITKEEP = ".agent-inspect/.gitkeep";
|
|
9678
9690
|
function normalizeFramework(value) {
|
|
9679
9691
|
const raw = (value ?? "custom").trim();
|
|
9680
|
-
if (raw === "ai-sdk" || raw === "openai-agents" || raw === "langchain" || raw === "custom") {
|
|
9692
|
+
if (raw === "ai-sdk" || raw === "openai-agents" || raw === "langchain" || raw === "langgraph" || raw === "custom") {
|
|
9681
9693
|
return raw;
|
|
9682
9694
|
}
|
|
9683
9695
|
throw new Error(
|
|
9684
|
-
"Unsupported --framework value. Use ai-sdk, openai-agents, langchain, or custom."
|
|
9696
|
+
"Unsupported --framework value. Use ai-sdk, openai-agents, langchain, langgraph, or custom."
|
|
9685
9697
|
);
|
|
9686
9698
|
}
|
|
9687
9699
|
function configTemplate(framework) {
|
|
@@ -9754,6 +9766,30 @@ async function main() {
|
|
|
9754
9766
|
console.log("Trace written to .agent-inspect/");
|
|
9755
9767
|
}
|
|
9756
9768
|
|
|
9769
|
+
main().catch((error) => {
|
|
9770
|
+
console.error(error);
|
|
9771
|
+
process.exitCode = 1;
|
|
9772
|
+
});
|
|
9773
|
+
`;
|
|
9774
|
+
case "langgraph":
|
|
9775
|
+
return `/**
|
|
9776
|
+
* LangGraph onboarding starter \u2014 no provider keys.
|
|
9777
|
+
* Prefer @agent-inspect/langchain callbacks with your StateGraph in app code.
|
|
9778
|
+
* This demo writes a bridged tool lifecycle you can check/gate locally.
|
|
9779
|
+
*/
|
|
9780
|
+
import { inspectRun, step } from "agent-inspect";
|
|
9781
|
+
|
|
9782
|
+
async function main() {
|
|
9783
|
+
await inspectRun("langgraph-demo", async () => {
|
|
9784
|
+
await step("chain:agent", async () => {
|
|
9785
|
+
await step.tool("lookup_orders", async () => ({ orders: 0 }));
|
|
9786
|
+
return { ok: true };
|
|
9787
|
+
});
|
|
9788
|
+
}, { traceDir: ".agent-inspect", silent: true });
|
|
9789
|
+
console.log("Trace written to .agent-inspect/");
|
|
9790
|
+
console.log("Next: npx agent-inspect check <run-id> --required-tool lookup_orders");
|
|
9791
|
+
}
|
|
9792
|
+
|
|
9757
9793
|
main().catch((error) => {
|
|
9758
9794
|
console.error(error);
|
|
9759
9795
|
process.exitCode = 1;
|
|
@@ -9909,7 +9945,8 @@ var OPTIONAL_PACKAGES = {
|
|
|
9909
9945
|
custom: [],
|
|
9910
9946
|
"ai-sdk": ["@agent-inspect/ai-sdk"],
|
|
9911
9947
|
"openai-agents": ["@agent-inspect/openai-agents"],
|
|
9912
|
-
langchain: ["@agent-inspect/langchain"]
|
|
9948
|
+
langchain: ["@agent-inspect/langchain"],
|
|
9949
|
+
langgraph: ["@agent-inspect/langchain"]
|
|
9913
9950
|
};
|
|
9914
9951
|
function nodeVersionCheck() {
|
|
9915
9952
|
const major = Number(process2.versions.node.split(".")[0]);
|
|
@@ -10622,7 +10659,7 @@ function isModuleNotFound4(e) {
|
|
|
10622
10659
|
}
|
|
10623
10660
|
async function loadIndexSqlite() {
|
|
10624
10661
|
try {
|
|
10625
|
-
return await import('./src-
|
|
10662
|
+
return await import('./src-6VZNGIF6.mjs');
|
|
10626
10663
|
} catch (e) {
|
|
10627
10664
|
if (isModuleNotFound4(e)) {
|
|
10628
10665
|
console.error(
|
|
@@ -11725,6 +11762,7 @@ function createCliProgram() {
|
|
|
11725
11762
|
"ai-sdk",
|
|
11726
11763
|
"openai-agents",
|
|
11727
11764
|
"langchain",
|
|
11765
|
+
"langgraph",
|
|
11728
11766
|
"custom"
|
|
11729
11767
|
])
|
|
11730
11768
|
).addOption(new Option("--ci <provider>", "optional CI snippet").choices(["github"])).option("--dry-run", "print planned files without writing").option("--yes", "non-interactive; skip existing files").option("--json", "print deterministic JSON plan/result").action((opts) => {
|
|
@@ -11735,6 +11773,7 @@ function createCliProgram() {
|
|
|
11735
11773
|
"ai-sdk",
|
|
11736
11774
|
"openai-agents",
|
|
11737
11775
|
"langchain",
|
|
11776
|
+
"langgraph",
|
|
11738
11777
|
"custom"
|
|
11739
11778
|
])
|
|
11740
11779
|
).action((opts) => {
|