agent-inspect 6.29.1 → 6.29.3

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.
Files changed (60) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/README.md +1 -1
  3. package/docs/API.md +4 -0
  4. package/docs/CLI.md +2 -0
  5. package/docs/LIMITATIONS.md +1 -0
  6. package/docs/NETWORK-BEHAVIOR.md +8 -0
  7. package/docs/TRACE-CONTRACTS.md +11 -0
  8. package/package.json +2 -2
  9. package/packages/cli/dist/{chunk-UK4HD5M3.mjs → chunk-TBTRH7KY.mjs} +5 -3
  10. package/packages/cli/dist/chunk-TBTRH7KY.mjs.map +1 -0
  11. package/packages/cli/dist/index.cjs +48 -11
  12. package/packages/cli/dist/index.cjs.map +1 -1
  13. package/packages/cli/dist/index.mjs +49 -14
  14. package/packages/cli/dist/index.mjs.map +1 -1
  15. package/packages/cli/dist/{src-CMPIJGUE.mjs → src-PGESGQ7G.mjs} +3 -3
  16. package/packages/cli/dist/{src-CMPIJGUE.mjs.map → src-PGESGQ7G.mjs.map} +1 -1
  17. package/packages/core/dist/advanced.cjs +41 -2
  18. package/packages/core/dist/advanced.cjs.map +1 -1
  19. package/packages/core/dist/advanced.d.cts +2 -2
  20. package/packages/core/dist/advanced.d.ts +2 -2
  21. package/packages/core/dist/advanced.mjs +14 -14
  22. package/packages/core/dist/checks.cjs +15 -2
  23. package/packages/core/dist/checks.cjs.map +1 -1
  24. package/packages/core/dist/checks.d.cts +2 -2
  25. package/packages/core/dist/checks.d.ts +2 -2
  26. package/packages/core/dist/checks.mjs +5 -5
  27. package/packages/core/dist/{chunk-QJI52TH3.mjs → chunk-3I6KX32E.mjs} +5 -3
  28. package/packages/core/dist/chunk-3I6KX32E.mjs.map +1 -0
  29. package/packages/core/dist/{chunk-COZPMOUF.mjs → chunk-5M4QUYFH.mjs} +3 -3
  30. package/packages/core/dist/{chunk-COZPMOUF.mjs.map → chunk-5M4QUYFH.mjs.map} +1 -1
  31. package/packages/core/dist/{chunk-SJ3C5RIS.mjs → chunk-7LSVGXCN.mjs} +3 -3
  32. package/packages/core/dist/{chunk-SJ3C5RIS.mjs.map → chunk-7LSVGXCN.mjs.map} +1 -1
  33. package/packages/core/dist/{chunk-FKUTGUFG.mjs → chunk-AT7TICCQ.mjs} +4 -4
  34. package/packages/core/dist/{chunk-FKUTGUFG.mjs.map → chunk-AT7TICCQ.mjs.map} +1 -1
  35. package/packages/core/dist/{chunk-65LFRW2T.mjs → chunk-BMRK6XHO.mjs} +4 -4
  36. package/packages/core/dist/{chunk-65LFRW2T.mjs.map → chunk-BMRK6XHO.mjs.map} +1 -1
  37. package/packages/core/dist/{chunk-AQMJFKI6.mjs → chunk-DZBNXCLA.mjs} +43 -6
  38. package/packages/core/dist/chunk-DZBNXCLA.mjs.map +1 -0
  39. package/packages/core/dist/{chunk-5RF7FYGL.mjs → chunk-FKVCTIP6.mjs} +4 -4
  40. package/packages/core/dist/{chunk-5RF7FYGL.mjs.map → chunk-FKVCTIP6.mjs.map} +1 -1
  41. package/packages/core/dist/{chunk-5B4DNGFB.mjs → chunk-KNRY24RS.mjs} +3 -3
  42. package/packages/core/dist/{chunk-5B4DNGFB.mjs.map → chunk-KNRY24RS.mjs.map} +1 -1
  43. package/packages/core/dist/{chunk-GPGBKN7W.mjs → chunk-XPDNO3KH.mjs} +18 -5
  44. package/packages/core/dist/{chunk-GPGBKN7W.mjs.map → chunk-XPDNO3KH.mjs.map} +1 -1
  45. package/packages/core/dist/exporters.mjs +5 -5
  46. package/packages/core/dist/{index-C61p7wBR.d.cts → index-BaQ48jrq.d.cts} +9 -1
  47. package/packages/core/dist/{index-DTO2iGeq.d.ts → index-CrnEOoRu.d.ts} +9 -1
  48. package/packages/core/dist/index.cjs +38 -1
  49. package/packages/core/dist/index.cjs.map +1 -1
  50. package/packages/core/dist/index.mjs +6 -6
  51. package/packages/core/dist/persisted.cjs +3 -1
  52. package/packages/core/dist/persisted.cjs.map +1 -1
  53. package/packages/core/dist/persisted.mjs +3 -3
  54. package/packages/core/dist/readers.cjs +3 -1
  55. package/packages/core/dist/readers.cjs.map +1 -1
  56. package/packages/core/dist/readers.mjs +4 -4
  57. package/packages/core/dist/writers.mjs +3 -3
  58. package/packages/cli/dist/chunk-UK4HD5M3.mjs.map +0 -1
  59. package/packages/core/dist/chunk-AQMJFKI6.mjs.map +0 -1
  60. package/packages/core/dist/chunk-QJI52TH3.mjs.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,26 @@
1
1
  # Changelog
2
2
 
3
+ ## 6.29.3
4
+
5
+ ### Patch Changes
6
+
7
+ - cf87bc9: Corrective patch after 6.29.2:
8
+
9
+ - Preserve MCP client prototype methods and private state via Proxy in `wrapMcpClient` (#420).
10
+ - Preserve `cacheWrite` and `reasoning` when converting persisted token usage back to TraceEvent metadata (#423 / #424).
11
+
12
+ ## 6.29.2
13
+
14
+ ### Patch Changes
15
+
16
+ - 555052d: Published runtime and fidelity patches for the post-6.29.1 adoption train:
17
+
18
+ - Externalize `agent-inspect` from `@agent-inspect/mcp` so packed ESM/CJS consumers share the application `inspectRun` context (#413).
19
+ - Refuse `suite init` overwrite of an existing suite config (#411 / #412).
20
+ - Recognize nested manual `attributes.metadata.arguments|input|toolArguments` in tool-argument checks (#414).
21
+ - Persist bounded safe thrown error codes from manual instrumentation (#415).
22
+ - Normalize OpenAI Agents cached tokens from `input_tokens_details.cached_tokens` (#416).
23
+
3
24
  ## 6.29.1
4
25
 
5
26
  ### Patch Changes
package/README.md CHANGED
@@ -212,7 +212,7 @@ The root package is enough for custom capture, the CLI, checks, and Evidence wor
212
212
 
213
213
  ## Status and documentation
214
214
 
215
- **Current published baseline:** **6.29.1** · persisted schema `1.0` · Node.js `>=20` · MIT.
215
+ **Current published baseline:** **6.29.3** · persisted schema `1.0` · Node.js `>=20` · MIT.
216
216
 
217
217
  Legacy v0.1 and v0.2 traces remain readable. Check the npm badge and [changelog](CHANGELOG.md) for the current published version.
218
218
 
package/docs/API.md CHANGED
@@ -474,6 +474,10 @@ Public methods:
474
474
 
475
475
  `capture` is explicit and metadata-only. `onSuccess: "metadata-only"` records safe type/length/key-count summaries in `outputSummary`; `onError: "metadata-only"` records thrown-value type/name summaries. It does not store raw return values, prompts, outputs, or thrown objects. Use `"none"` to disable a capture side.
476
476
 
477
+ Persisted step/run errors keep `name` and `message`. When present, a **bounded safe** `code` is also retained: finite numeric `code`/`status` values (for example HTTP `404`) or short strings matching letters, digits, underscore, hyphen, dot, and colon (max 128 characters). Response bodies, headers, multiline values, and arbitrary enumerable error properties are not persisted.
478
+
479
+ Pass structured tool arguments for contracts via step `metadata.arguments` / `metadata.input` / `metadata.toolArguments` (or top-level attributes with the same keys). TraceContract tool-argument checks read those locations; they do not enable default raw capture.
480
+
477
481
  `traceDir` and `silent` on `createInspector()` are context metadata for compatibility with existing helpers. They do not configure persistence or terminal output. Prefer writer-owned output configuration such as `fileWriter({ dir })` or `fileWriter({ filePath })`.
478
482
 
479
483
  `createInspectorRuntime()` is available from `agent-inspect/advanced` as the low-level isolation primitive. Most users should prefer `createInspector()` and `inspector.getDiagnostics()`.
package/docs/CLI.md CHANGED
@@ -979,6 +979,8 @@ Options (shared):
979
979
 
980
980
  - `--template <name>` — PM/QA template (v5.4+): `customer-support-agent`, `refund-agent`, `sales-assistant`, `browser-task-agent`, `mcp-tool-agent`, `workflow-agent`, `rag-answer-agent`, `human-approval-agent`
981
981
 
982
+ `suite init` creates a new `agent-inspect.suite.json` and **refuses to overwrite** an existing file (valid, malformed, or empty). Edit or delete the existing config explicitly before recreating it. There is no `--force` flag.
983
+
982
984
  `run` also supports:
983
985
 
984
986
  - `-o, --output <dir>` — write JSON run artifact (default: `.agent-inspect/suite-runs`)
@@ -9,6 +9,7 @@ This document states what AgentInspect **does not** provide today. It complement
9
9
  - **No vendor upload pipeline**: no built-in Langfuse/Braintrust/New Relic/Datadog direct exporters as live sinks.
10
10
  - **No automatic universal instrumentation** of every framework: integration is explicit (manual traces, log ingest, optional adapters).
11
11
  - **No retry execution engine:** TraceContract `retry` rules (including additive `retry.operations[]` recovery oracles in 6.27) evaluate attempt identity and evidence only. AgentInspect does not retry tools, remediates nothing, and does not treat a client `idempotencyKey` as proof of exactly-once writes. Write-tool timeout/unknown completion is unevaluable without authoritative idempotency evidence; write-retry is not safe by default.
12
+ - **Transport facts are source-boundary only:** HTTP status, server-advertised retry delay, selected delay, and their sources must be captured at the transport/fetch boundary. An MCP wrapper cannot recover facts already collapsed into an SDK error message.
12
13
  - **Omitted-payload digests** (`createOmittedPayloadCommitment`) are bounded (1 MiB preflight). Digests prove omitted bytes existed; they are not redaction or authorization.
13
14
 
14
15
  ## Correlation metadata (v1.3.0)
@@ -27,6 +27,14 @@ AgentInspect is **local-first**. Core tracing writes local files and does **not*
27
27
  4. Prefer **redact / verify-safe** before any share or ingest path.
28
28
  5. Redaction is best-effort, not certification.
29
29
 
30
+ ## Transport evidence (HTTP / fetch / MCP)
31
+
32
+ Capture **HTTP status**, **server-advertised retry delay**, **selected delay**, and their **sources** at the transport or fetch boundary that observes them.
33
+
34
+ An MCP client wrapper or SDK error string cannot recover facts already collapsed into a message such as `"fetch failed"` or `"429 Too Many Requests"`. If the application needs TraceFacts or contracts over status/retry behavior, instrument the fetch/transport layer (or an observer that reads response headers before they are discarded).
35
+
36
+ AgentInspect does not invent transport facts from error message text.
37
+
30
38
  ## Enabling Studio ingest
31
39
 
32
40
  See [SELF-HOSTING.md](./SELF-HOSTING.md) and [`@agent-inspect/studio`](https://github.com/rajudandigam/agent-inspect/tree/main/packages/studio). HTTP ingest remains off until you configure token and binding.
@@ -229,11 +229,22 @@ defineTraceContract({
229
229
 
230
230
  Missing structured argument evidence fails closed (`AI_CHECK_TOOL_ARGUMENT_EVIDENCE_UNAVAILABLE`). Findings never include full actual inputs.
231
231
 
232
+ Manual instrumentation stores caller metadata under `attributes.metadata`. Tool-argument checks therefore also accept structured object/array evidence at:
233
+
234
+ ```text
235
+ attributes.metadata.arguments
236
+ attributes.metadata.input
237
+ attributes.metadata.toolArguments
238
+ ```
239
+
240
+ Precedence: top-level `attributes.arguments|input|toolArguments`, then nested metadata keys, then structured `inputSummary`. Preview strings are never parsed as JSON. This does not enable default raw argument capture.
241
+
232
242
  ### Capture capability matrix (tool-argument evidence)
233
243
 
234
244
  | Source | Structured input | Preview only | Digest only | Unavailable |
235
245
  | --- | :---: | :---: | :---: | :---: |
236
246
  | Manual `attributes.arguments` / `attributes.input` (object) | yes | — | — | — |
247
+ | Manual `attributes.metadata.arguments` / `input` / `toolArguments` (object/array) | yes | — | — | — |
237
248
  | Manual `inputSummary` string | — | yes | — | for pointer checks |
238
249
  | AI SDK / LangChain metadata-only default | — | sometimes | — | typical |
239
250
  | OpenAI Agents metadata-only | — | sometimes | — | typical |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-inspect",
3
- "version": "6.29.1",
3
+ "version": "6.29.3",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "description": "Local evidence debugger and trajectory-test toolkit for TypeScript AI agents — execution trees, TraceContract checks, Evidence v2, and read-only MCP",
@@ -235,7 +235,7 @@
235
235
  "test:all": "pnpm run typecheck && pnpm run linked-versions:check && pnpm run build && pnpm run test && pnpm run size",
236
236
  "prepublish:checks": "pnpm run typecheck && pnpm run test && pnpm run test:coverage && pnpm run build && pnpm run fixtures:check && pnpm run recipes:check && pnpm run size && pnpm run linked-versions:check && pnpm run repo:health && pnpm run pack:smoke",
237
237
  "pack:dry-run": "pnpm run build && npm pack --dry-run",
238
- "pack:smoke": "pnpm run build && node scripts/package-smoke.mjs && node scripts/packed-openai-agents-e2e.mjs && node scripts/packed-ai-sdk-e2e.mjs && node scripts/packed-quickstart-e2e.mjs && node scripts/packed-semantic-loop-e2e.mjs && node scripts/packed-swarm-loop-e2e.mjs && node scripts/evidence-ci-golden-paths.mjs",
238
+ "pack:smoke": "pnpm run build && node scripts/package-smoke.mjs && node scripts/packed-openai-agents-e2e.mjs && node scripts/packed-ai-sdk-e2e.mjs && node scripts/packed-mcp-e2e.mjs && node scripts/packed-quickstart-e2e.mjs && node scripts/packed-semantic-loop-e2e.mjs && node scripts/packed-swarm-loop-e2e.mjs && node scripts/evidence-ci-golden-paths.mjs",
239
239
  "linked-versions:check": "node scripts/check-linked-versions.mjs",
240
240
  "docs:commands": "node scripts/validate-doc-commands.mjs",
241
241
  "docs:links": "node scripts/validate-doc-links.mjs",
@@ -386,7 +386,9 @@ function mapTokenUsageToMetadata(tokenUsage, attributes) {
386
386
  ...tokenUsage.input !== void 0 ? { input: tokenUsage.input } : {},
387
387
  ...tokenUsage.output !== void 0 ? { output: tokenUsage.output } : {},
388
388
  ...tokenUsage.total !== void 0 ? { total: tokenUsage.total } : {},
389
- ...tokenUsage.cached !== void 0 ? { cached: tokenUsage.cached } : {}
389
+ ...tokenUsage.cached !== void 0 ? { cached: tokenUsage.cached } : {},
390
+ ...tokenUsage.cacheWrite !== void 0 ? { cacheWrite: tokenUsage.cacheWrite } : {},
391
+ ...tokenUsage.reasoning !== void 0 ? { reasoning: tokenUsage.reasoning } : {}
390
392
  };
391
393
  }
392
394
  return Object.keys(metadata).length > 0 ? metadata : void 0;
@@ -12486,5 +12488,5 @@ function renderGateReport(result, options = {}) {
12486
12488
  }
12487
12489
 
12488
12490
  export { COHORT_METRIC_IDS, DEFAULT_SUITE_ARTIFACTS_DIR, EVIDENCE_FORMAT_VERSION, EVIDENCE_HTML_FILENAME, EVIDENCE_MANIFEST_FILENAME, Redactor, TraceDirectory, TraceReadError, TreeBuilder, aggregateBundleSafeStatus, aggregateSessionCheckResults, analyzeCohort, applyProfileMetadataCaps, assertBundlePathContained, assertEvidenceRelativePath, buildActivitySummary, buildBundleMetadata, buildBundleSummaryMarkdown, buildEvidenceCausalFailureViewHtml, buildEvidenceCiPackage, buildEvidenceCircuitViewHtml, buildEvidenceContractsViewHtml, buildEvidenceDiffViewHtml, buildEvidenceHtmlShell, buildEvidenceManifest, buildEvidenceOutcomesViewHtml, buildEvidenceProvenanceViewHtml, buildEvidenceSafetyViewHtml, buildEvidenceTimelineViewHtml, buildEvidenceToolsLlmViewHtml, buildEvidenceTreeViewHtml, buildLocalExplanation, buildPlaceholderArtifact, buildRunSummary, buildRunTimeline, buildRunWhatSummary, buildSessionIndex, buildTraceStats, buildZipArchive, bundleFailsOnSafety, bundleRunAssetRelativePath, collectTraceSchemaVersions, compactAttributes, createBaselineRegressionRule, createLlmUsageRule, createMaxStepDurationRule, createObservedOutcomeRule, createRequireCompletedRule, createRunDepthRule, createRunDurationRule, createRunStatusRule, createSafetyOversizedAttributeRule, createSafetyRawContentRule, createSafetyRedactionRule, createSafetySecretPatternRule, createStallDetectionRule, createStructureCycleRule, createStructureOrphanRule, createStructureParallelWidthRule, createStructureRelationshipRule, createToolUsageRule, defaultBundleOutputPath, defaultSuiteConfigTemplate, diffRuns, diffTraceEvents, enrichSessionRunRecord, escapeHtml, escapeMarkdown, extractMetadata, extractOutcomesFromTraceEvents, filterMetasBySessionScope, filterTraces, flattenTree, formatDuration2 as formatDuration, formatStepLabel, formatTimestamp, gateHasThresholds, getIndent, getTraceFilePath, inferEvidenceFileRole, isAgentInspectTrace, isPersistedInspectEvent, loadSessionRunRecords, loadSuiteConfig, loadTraceMetadataList, manualTraceEventsToComparableRun, nanoid, normalizeBundleOutputPath, openTrace, parseCohortMetricList, parseDuration, parseDurationFilter, parseGateList, parseTraceJsonl, persistedInspectEventsToTraceEvents, renderActivitySummaryHuman, renderCohortReport, renderErrorLine, renderGateReport, renderObservedOutcomesHtml, renderObservedOutcomesMarkdown, renderRunDiff, renderRunWhat, renderStepLine, renderSuiteReport, renderTimeline, renderTraceStats, resolveBundleRunIds, resolveRedactionProfile, resolveSuiteTemplate, resolveTraceDir, runGate, runSuite, runTraceChecks, safeString, sanitizeBundleRunId, searchTraces, serializeEvidenceManifest, sha256Hex, stableJson, summarizeObservedOutcomes, summarizeSemanticParity, traceEventToPersistedInspectEvent, truncateName, truncateStringForProfile, validateEvent, validateSuiteConfig, verifyEvidenceDirectory, zeroKinds };
12489
- //# sourceMappingURL=chunk-UK4HD5M3.mjs.map
12490
- //# sourceMappingURL=chunk-UK4HD5M3.mjs.map
12491
+ //# sourceMappingURL=chunk-TBTRH7KY.mjs.map
12492
+ //# sourceMappingURL=chunk-TBTRH7KY.mjs.map