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.
@@ -4346,6 +4346,7 @@ function buildEvidenceManifest(parts) {
4346
4346
  verificationPolicy: parts.verificationPolicy ?? parts.redactionProfile
4347
4347
  },
4348
4348
  assessment,
4349
+ ...parts.semantics !== void 0 ? { semantics: { ...parts.semantics } } : {},
4349
4350
  files: buildEvidenceFileEntries(parts.files)
4350
4351
  };
4351
4352
  }
@@ -5986,7 +5987,8 @@ function buildEvidenceCiPackage(input3) {
5986
5987
  sourceStatus: input3.sourceStatus,
5987
5988
  files: packaged,
5988
5989
  createdAt,
5989
- note: EVIDENCE_ASSESSMENT_NOTE
5990
+ note: EVIDENCE_ASSESSMENT_NOTE,
5991
+ ...input3.semantics !== void 0 ? { semantics: input3.semantics } : {}
5990
5992
  });
5991
5993
  return {
5992
5994
  "evidence.html": evidenceHtml,
@@ -6548,11 +6550,16 @@ function projectLogicalEvents(events) {
6548
6550
  }
6549
6551
  if (!remapped) {
6550
6552
  if (!logicalById.has(originalParentId) && !logicalByRawId.has(originalParentId)) {
6551
- diagnostics.push({
6552
- code: "AI_LOGICAL_PARENT_UNRESOLVED",
6553
- message: `Parent ${originalParentId} unresolved for ${event.eventId}.`,
6554
- eventIds: [event.eventId]
6555
- });
6553
+ const mapping = event.attributes?.parentMapping;
6554
+ const unresolved = mapping === "unresolved" || event.attributes?.parentUnresolved === true || event.attributes?.unresolvedParent === true || // LangGraph/framework scaffolding sentinel labels are not event ids.
6555
+ /^LangGraph$/i.test(originalParentId) || originalParentId.startsWith("unresolved:");
6556
+ if (!unresolved) {
6557
+ diagnostics.push({
6558
+ code: "AI_LOGICAL_PARENT_UNRESOLVED",
6559
+ message: `Parent ${originalParentId} unresolved for ${event.eventId}.`,
6560
+ eventIds: [event.eventId]
6561
+ });
6562
+ }
6556
6563
  }
6557
6564
  normalized.push(event);
6558
6565
  continue;
@@ -6610,6 +6617,35 @@ var init_logical_events = __esm({
6610
6617
  }
6611
6618
  });
6612
6619
 
6620
+ // packages/core/src/checks/trace-facts.ts
6621
+ function summarizeSemanticParity(events) {
6622
+ const projection = projectLogicalEvents(events);
6623
+ const logical = projection.logicalEvents;
6624
+ const finishedTools = logical.filter(
6625
+ (event) => event.kind === "TOOL" && event.status !== "running"
6626
+ );
6627
+ const finishedToolNames = Object.freeze(
6628
+ finishedTools.map((event) => resolveCanonicalToolName(event)).sort((a, b) => a.localeCompare(b))
6629
+ );
6630
+ return {
6631
+ rawEventCount: events.length,
6632
+ logicalEventCount: logical.length,
6633
+ runningLogicalCount: logical.filter((event) => event.status === "running").length,
6634
+ finishedToolNames,
6635
+ finishedToolCount: finishedTools.length,
6636
+ pairedCount: logical.filter((event) => event.projection.paired).length,
6637
+ parentRemapCount: projection.diagnostics.filter(
6638
+ (item) => item.code === "AI_LOGICAL_PARENT_REMAPPED"
6639
+ ).length,
6640
+ diagnostics: projection.diagnostics
6641
+ };
6642
+ }
6643
+ var init_trace_facts = __esm({
6644
+ "packages/core/src/checks/trace-facts.ts"() {
6645
+ init_logical_events();
6646
+ }
6647
+ });
6648
+
6613
6649
  // packages/core/src/checks/contract.ts
6614
6650
  var init_contract = __esm({
6615
6651
  "packages/core/src/checks/contract.ts"() {
@@ -8026,6 +8062,7 @@ var init_checks2 = __esm({
8026
8062
  init_outcomes();
8027
8063
  init_logical_events();
8028
8064
  init_logical_events();
8065
+ init_trace_facts();
8029
8066
  init_contract();
8030
8067
  SEVERITY_RANK = {
8031
8068
  error: 0,
@@ -12156,7 +12193,7 @@ var init_src = __esm({
12156
12193
  });
12157
12194
 
12158
12195
  // package.json
12159
- var version = "6.12.2";
12196
+ var version = "6.14.0";
12160
12197
 
12161
12198
  // packages/cli/src/list.ts
12162
12199
  init_advanced();
@@ -20841,6 +20878,7 @@ async function artifactsCommand(target, options = {}, stdin = process.stdin) {
20841
20878
  findings: check.findings.length
20842
20879
  }))
20843
20880
  });
20881
+ const parity = summarizeSemanticParity(read.events);
20844
20882
  const evidencePackage = buildEvidenceCiPackage({
20845
20883
  generatorVersion: version,
20846
20884
  runIds,
@@ -20849,7 +20887,18 @@ async function artifactsCommand(target, options = {}, stdin = process.stdin) {
20849
20887
  redactionProfile: "strict",
20850
20888
  assessmentStatus: toEvidenceStatus(status),
20851
20889
  checkResultsJson,
20852
- summaryText: renderMarkdown(trace, check, diff)
20890
+ summaryText: renderMarkdown(trace, check, diff),
20891
+ semantics: {
20892
+ projectionVersion: "logical-lifecycle-0.1",
20893
+ rawEventCount: parity.rawEventCount,
20894
+ logicalEventCount: parity.logicalEventCount,
20895
+ runningLogicalCount: parity.runningLogicalCount,
20896
+ finishedToolCount: parity.finishedToolCount,
20897
+ finishedToolNames: [...parity.finishedToolNames],
20898
+ pairedCount: parity.pairedCount,
20899
+ parentRemapCount: parity.parentRemapCount,
20900
+ contractStatus: check.status === "pass" ? "pass" : check.status === "fail" ? "fail" : "error"
20901
+ }
20853
20902
  });
20854
20903
  await writeArtifact(outputDir, "evidence.html", evidencePackage["evidence.html"], files);
20855
20904
  await writeArtifact(outputDir, "evidence.json", evidencePackage["evidence.json"], files);
@@ -21936,11 +21985,11 @@ var TRACE_DIR = ".agent-inspect";
21936
21985
  var GITKEEP = ".agent-inspect/.gitkeep";
21937
21986
  function normalizeFramework(value) {
21938
21987
  const raw = (value ?? "custom").trim();
21939
- if (raw === "ai-sdk" || raw === "openai-agents" || raw === "langchain" || raw === "custom") {
21988
+ if (raw === "ai-sdk" || raw === "openai-agents" || raw === "langchain" || raw === "langgraph" || raw === "custom") {
21940
21989
  return raw;
21941
21990
  }
21942
21991
  throw new Error(
21943
- "Unsupported --framework value. Use ai-sdk, openai-agents, langchain, or custom."
21992
+ "Unsupported --framework value. Use ai-sdk, openai-agents, langchain, langgraph, or custom."
21944
21993
  );
21945
21994
  }
21946
21995
  function configTemplate(framework) {
@@ -22013,6 +22062,30 @@ async function main() {
22013
22062
  console.log("Trace written to .agent-inspect/");
22014
22063
  }
22015
22064
 
22065
+ main().catch((error) => {
22066
+ console.error(error);
22067
+ process.exitCode = 1;
22068
+ });
22069
+ `;
22070
+ case "langgraph":
22071
+ return `/**
22072
+ * LangGraph onboarding starter \u2014 no provider keys.
22073
+ * Prefer @agent-inspect/langchain callbacks with your StateGraph in app code.
22074
+ * This demo writes a bridged tool lifecycle you can check/gate locally.
22075
+ */
22076
+ import { inspectRun, step } from "agent-inspect";
22077
+
22078
+ async function main() {
22079
+ await inspectRun("langgraph-demo", async () => {
22080
+ await step("chain:agent", async () => {
22081
+ await step.tool("lookup_orders", async () => ({ orders: 0 }));
22082
+ return { ok: true };
22083
+ });
22084
+ }, { traceDir: ".agent-inspect", silent: true });
22085
+ console.log("Trace written to .agent-inspect/");
22086
+ console.log("Next: npx agent-inspect check <run-id> --required-tool lookup_orders");
22087
+ }
22088
+
22016
22089
  main().catch((error) => {
22017
22090
  console.error(error);
22018
22091
  process.exitCode = 1;
@@ -22168,7 +22241,8 @@ var OPTIONAL_PACKAGES = {
22168
22241
  custom: [],
22169
22242
  "ai-sdk": ["@agent-inspect/ai-sdk"],
22170
22243
  "openai-agents": ["@agent-inspect/openai-agents"],
22171
- langchain: ["@agent-inspect/langchain"]
22244
+ langchain: ["@agent-inspect/langchain"],
22245
+ langgraph: ["@agent-inspect/langchain"]
22172
22246
  };
22173
22247
  function nodeVersionCheck() {
22174
22248
  const major = Number(process3__default.default.versions.node.split(".")[0]);
@@ -23998,6 +24072,7 @@ function createCliProgram() {
23998
24072
  "ai-sdk",
23999
24073
  "openai-agents",
24000
24074
  "langchain",
24075
+ "langgraph",
24001
24076
  "custom"
24002
24077
  ])
24003
24078
  ).addOption(new commander.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) => {
@@ -24008,6 +24083,7 @@ function createCliProgram() {
24008
24083
  "ai-sdk",
24009
24084
  "openai-agents",
24010
24085
  "langchain",
24086
+ "langgraph",
24011
24087
  "custom"
24012
24088
  ])
24013
24089
  ).action((opts) => {