agent-inspect 6.22.0 → 6.24.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 CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## 6.24.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 2fa9d46: Production adoption distribution: lifecycle guidance, init/doctor CLI docs, gate compact JSON and GitHub annotations, VS Code Marketplace deferral confirmed.
8
+
9
+ ## 6.23.0
10
+
11
+ ### Minor Changes
12
+
13
+ - 97b962f: Structured control contracts: JSON Pointer tool-argument checks, mixed orderRules, declared-versus-enforced controls, and retry/side-effect safety.
14
+
3
15
  ## 6.22.0
4
16
 
5
17
  ### Minor 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.22.0** · persisted schema `1.0` · Node.js `>=20` · MIT.
215
+ **Current published baseline:** **6.24.0** · 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/ADOPTION.md CHANGED
@@ -14,6 +14,8 @@ AgentInspect is **local-first**: traces stay on disk, checks run in CI, and shar
14
14
 
15
15
  See [FIRST-TRACE-IN-5-MINUTES.md](./FIRST-TRACE-IN-5-MINUTES.md) or the [docs site getting started](https://agentinspect.vercel.app/docs/getting-started/).
16
16
 
17
+ Lifecycle (flush/close by runtime): [LIFECYCLE.md](./LIFECYCLE.md).
18
+
17
19
  ```bash
18
20
  npm install agent-inspect
19
21
  npx agent-inspect init --yes
package/docs/CLI.md CHANGED
@@ -1026,9 +1026,9 @@ Options:
1026
1026
  - `--max-p95-duration <ms>` — maximum allowed p95 run duration
1027
1027
  - `--forbid-tool <name>` — forbidden tool (repeatable or comma-separated)
1028
1028
  - `--require-observation <name>` — required passed observation (repeatable or comma-separated)
1029
- - `--format <format>` — `markdown`, `json`, `html`, `junit`, or `github` (default: `markdown`)
1030
- - `-o, --output <dir>` — write `gate-results.json`, `gate-summary.md`, `gate-report.html`, `junit.xml`, `github-step-summary.md`
1031
- - `--json` — print deterministic JSON result
1029
+ - `--format <format>` — `markdown`, `json`, `json-compact`, `html`, `junit`, `github`, or `github-annotations` (default: `markdown`)
1030
+ - `-o, --output <dir>` — write `gate-results.json`, `gate-summary.md`, `gate-report.html`, `junit.xml`, `github-step-summary.md`, `github-annotations.txt`
1031
+ - `--json` — print deterministic JSON result (pretty); use `--format json-compact` for CI logs
1032
1032
  - `--evidence-on <fail|always|never>` — write local Evidence v2 (no upload); omitted = never
1033
1033
  - `--evidence-dir <path>` — Evidence output directory or base path
1034
1034
  - `--evidence-profile <local|share|strict>` — redaction profile (default `share`)
@@ -1042,6 +1042,8 @@ Example:
1042
1042
  npx agent-inspect gate --suite fixtures/configs/outcome-suite.suite.json --output ./gate-artifacts
1043
1043
  npx agent-inspect gate --dir fixtures/cohorts/before-after --max-error-rate 5 --forbid-tool deleteAccount
1044
1044
  npx agent-inspect gate --suite agent-inspect.suite.ts --evidence-on fail --evidence-profile share
1045
+ npx agent-inspect gate --suite agent-inspect.suite.ts --format github-annotations
1046
+ npx agent-inspect gate --suite agent-inspect.suite.ts --format json-compact
1045
1047
  ```
1046
1048
 
1047
1049
  Recipe: [github-actions-gate](../examples/recipes/github-actions-gate/README.md).
@@ -1069,6 +1071,36 @@ npx agent-inspect viewer --suite --config fixtures/configs/outcome-suite.suite.j
1069
1071
  npx agent-inspect viewer --workspace
1070
1072
  ```
1071
1073
 
1074
+ ### 6.29 `init`
1075
+
1076
+ Scaffold local AgentInspect config and a metadata-only demo (v3.1+). Does **not** install packages or rewrite application source unless you opt in later.
1077
+
1078
+ ```bash
1079
+ agent-inspect init [--framework <name>] [--ci github] [--dry-run] [--yes] [--json]
1080
+ ```
1081
+
1082
+ `--framework` values (adoption order):
1083
+
1084
+ | Value | Meaning |
1085
+ | --- | --- |
1086
+ | `ai-sdk` | AI SDK kit pointer + demo |
1087
+ | `langchain` / `langgraph` | LangChain/LangGraph kit pointer + demo |
1088
+ | `openai-agents` | OpenAI Agents kit pointer + demo |
1089
+ | `custom` | Manual `inspectRun` / `step` demo |
1090
+ | `observe` / `manual` | Aliases of `custom` (`observe(...)` demo) |
1091
+
1092
+ Also writes `.agent-inspect/.gitkeep` and optional GitHub Actions workflow when `--ci github` is set. See [ADOPTION.md](./ADOPTION.md), [INSTALL-KITS.md](./INSTALL-KITS.md), and [LIFECYCLE.md](./LIFECYCLE.md).
1093
+
1094
+ ### 6.30 `doctor`
1095
+
1096
+ Diagnose local setup **without network probes or installs** (v3.1+).
1097
+
1098
+ ```bash
1099
+ agent-inspect doctor [--framework <name>] [--trace-dir <path>] [--check-imports] [--json]
1100
+ ```
1101
+
1102
+ Reports version alignment, peer/package resolution, capture posture hints, writer path, redaction profile reminders, and no-default-egress expectations. Failures exit non-zero. Prefer `workspace doctor` when using a managed workspace layout.
1103
+
1072
1104
  ## 7. Optional TUI behavior
1073
1105
 
1074
1106
  `view --tui` delegates to `@agent-inspect/tui` and requires an interactive terminal. If the package is not installed, the CLI prints a short install hint.
@@ -11,6 +11,10 @@ Contracts compile to deterministic check rules for common cases:
11
11
  - run status / completion / max duration
12
12
  - tool required / forbidden / allowed / maxCalls / order (`requiredTools` / `forbiddenTools` aliases)
13
13
  - selectable `requiredOrderMode` (`first-occurrence` | `happens-before` | `all-occurrences`)
14
+ - additive `tools.orderRules` with per-rule occurrence modes
15
+ - bounded `tools.arguments` JSON Pointer checks (`exists` | `type` | `equals` | `oneOf`)
16
+ - `controls` declared-versus-enforced invariants
17
+ - `retry` / side-effect safety using explicit attempt identity
14
18
  - `alternatives.anyOf` for one level of legitimate alternate paths
15
19
  - actor `scope` selectors (`runId`, `subAgentId`, `groupId`, `workflowStep`, `rootEventId`)
16
20
  - observation `requireProvenance` (structural method / evidence / same-run event references)
@@ -165,6 +169,58 @@ defineTraceContract({
165
169
 
166
170
  Bounded evidence shapes: string event id, `{ eventId }`, or `{ eventIds }` (max 16). Method must be in the `ObservedOutcomeMethod` vocabulary. Omitting `requireProvenance` leaves prior observation behavior unchanged.
167
171
 
172
+ ### `tools.arguments` / `tools.orderRules` / `controls` / `retry` (shipped — experimental, 6.23)
173
+
174
+ See [ADR-0010](./decisions/ADR-0010-structured-control-contracts.md).
175
+
176
+ ```ts
177
+ defineTraceContract({
178
+ tools: {
179
+ defaultOccurrenceMode: "first-occurrence",
180
+ orderRules: [
181
+ { before: "authorize", after: "charge", occurrenceMode: "all-occurrences" },
182
+ ],
183
+ arguments: [
184
+ {
185
+ tool: "charge",
186
+ occurrence: "all",
187
+ path: "/dryRun",
188
+ operator: "equals",
189
+ expected: true,
190
+ },
191
+ ],
192
+ },
193
+ controls: {
194
+ declaredTools: ["search", "charge"],
195
+ enforcedTools: ["search", "charge"],
196
+ requireDeclaredMatchesEnforced: true,
197
+ requireObservedWithinEnforced: true,
198
+ requiredStages: [{ stage: "enforced" }],
199
+ },
200
+ retry: {
201
+ maxAttempts: 2,
202
+ nonIdempotentTools: ["charge"],
203
+ requireIdempotencyEvidenceForRetry: true,
204
+ requireRecoveredFailureVisible: true,
205
+ },
206
+ });
207
+ ```
208
+
209
+ Missing structured argument evidence fails closed (`AI_CHECK_TOOL_ARGUMENT_EVIDENCE_UNAVAILABLE`). Findings never include full actual inputs.
210
+
211
+ ### Capture capability matrix (tool-argument evidence)
212
+
213
+ | Source | Structured input | Preview only | Digest only | Unavailable |
214
+ | --- | :---: | :---: | :---: | :---: |
215
+ | Manual `attributes.arguments` / `attributes.input` (object) | yes | — | — | — |
216
+ | Manual `inputSummary` string | — | yes | — | for pointer checks |
217
+ | AI SDK / LangChain metadata-only default | — | sometimes | — | typical |
218
+ | OpenAI Agents metadata-only | — | sometimes | — | typical |
219
+ | MCP / OTLP / OpenInference import | varies | varies | optional digest | when unmapped |
220
+ | Custom TraceReader | reader-defined | reader-defined | reader-defined | fail closed |
221
+
222
+ Do not advertise a structured argument rule when the selected capture mode cannot supply object evidence.
223
+
168
224
  ### Lint and explain (shipped)
169
225
 
170
226
  ```ts
package/docs/VSCODE.md CHANGED
@@ -4,11 +4,16 @@ Read-only sidebar for local trace directories. The extension shells out to the p
4
4
 
5
5
  **Support level:** Experimental (unpublished). Ignored by Changesets; not part of the fixed npm release group.
6
6
 
7
- ## Product scope decision (6.18.0-H)
7
+ ## Product scope decision (6.24.0)
8
8
 
9
- **Disposition: defer (Option A).** Keep the in-repo extension unpublished. Core, official adapters, CLI, and Evidence take precedence over Marketplace packaging. Open PR #295 (sample trace command) and related issues (#66, #65) stay out of the active 6.18 implementation train until a later capacity window revisits VS Code.
9
+ **Disposition: close without Marketplace publish (Option A, confirmed).**
10
10
 
11
- Do not merge #295 merely to clear the contributor queue.
11
+ - Keep the in-repo extension unpublished.
12
+ - Do **not** publish to the VS Code Marketplace in this train (credentials + product priority).
13
+ - Open PR [#295](https://github.com/rajudandigam/agent-inspect/pull/295) (sample trace command) remains **out of the adoption train** — close or park as contributor-optional; do not merge solely to clear the queue while CI is red.
14
+ - Related issues (#66, #65) stay deferred until a later capacity window revisits VS Code.
15
+
16
+ Core, official adapters, CLI, Evidence, and TraceContract remain the adoption surface.
12
17
 
13
18
  ## Develop
14
19
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-inspect",
3
- "version": "6.22.0",
3
+ "version": "6.24.0",
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",
@@ -11794,15 +11794,34 @@ ${cases}
11794
11794
  </testsuite>
11795
11795
  </testsuites>`;
11796
11796
  }
11797
+ function renderGateGithubAnnotations(result) {
11798
+ return result.checks.filter((check) => !check.ok).map((check) => {
11799
+ const message = check.message.replace(/\r?\n/g, " ").replace(/%/g, "%25");
11800
+ return `::error title=${check.name}::${message}`;
11801
+ }).join("\n");
11802
+ }
11797
11803
  function renderGateReport(result, options = {}) {
11798
11804
  const format = options.format ?? "markdown";
11799
11805
  if (format === "json") return JSON.stringify(result, null, 2);
11806
+ if (format === "json-compact") {
11807
+ return JSON.stringify({
11808
+ ok: result.ok,
11809
+ exitCode: result.exitCode,
11810
+ failed: result.checks.filter((check) => !check.ok).map((check) => check.name),
11811
+ checks: result.checks.map((check) => ({
11812
+ name: check.name,
11813
+ ok: check.ok,
11814
+ message: check.message
11815
+ }))
11816
+ });
11817
+ }
11800
11818
  if (format === "html") return renderGateReportHtml(result);
11801
11819
  if (format === "junit") return renderGateJUnit(result);
11802
11820
  if (format === "github") return renderGateGithubStepSummary(result);
11821
+ if (format === "github-annotations") return renderGateGithubAnnotations(result);
11803
11822
  return renderGateSummaryMarkdown(result);
11804
11823
  }
11805
11824
 
11806
11825
  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 };
11807
- //# sourceMappingURL=chunk-CHBYF4LE.mjs.map
11808
- //# sourceMappingURL=chunk-CHBYF4LE.mjs.map
11826
+ //# sourceMappingURL=chunk-NHVN5AYW.mjs.map
11827
+ //# sourceMappingURL=chunk-NHVN5AYW.mjs.map