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
@@ -1,10 +1,10 @@
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, renderErrorLine, 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, 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-UK4HD5M3.mjs';
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, renderErrorLine, 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, 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-TBTRH7KY.mjs';
3
3
  import { realpathSync, constants as constants$1, existsSync, readFileSync } from 'fs';
4
4
  import path19 from 'path';
5
5
  import { fileURLToPath, pathToFileURL } from 'url';
6
6
  import { Command, Option } from 'commander';
7
- import { readFile, stat, mkdir, writeFile, unlink, appendFile, access, rm, open, readdir, constants } from 'fs/promises';
7
+ import { readFile, stat, mkdir, writeFile, unlink, appendFile, access, rm, open, readdir, lstat, constants } from 'fs/promises';
8
8
  import process2, { stdin, stdout } from 'process';
9
9
  import crypto, { createHash } from 'crypto';
10
10
  import { execFile, spawn } from 'child_process';
@@ -13,7 +13,7 @@ import { createServer } from 'http';
13
13
  import { createRequire } from 'module';
14
14
 
15
15
  // package.json
16
- var version = "6.29.1";
16
+ var version = "6.29.3";
17
17
 
18
18
  // packages/cli/src/trace-dir-scale.ts
19
19
  var TRACE_COUNT_WARN = 1e3;
@@ -3397,7 +3397,7 @@ async function newestTraceMtimeMs(traceDir) {
3397
3397
  }
3398
3398
  async function loadSessionRuns(traceDir) {
3399
3399
  try {
3400
- const mod = await import('./src-CMPIJGUE.mjs');
3400
+ const mod = await import('./src-PGESGQ7G.mjs');
3401
3401
  const dbPath = mod.resolveIndexDbPath(traceDir);
3402
3402
  const status = mod.indexStatus(dbPath);
3403
3403
  if (!status.healthy) {
@@ -12070,7 +12070,7 @@ function isModuleNotFound4(e) {
12070
12070
  }
12071
12071
  async function loadIndexSqlite() {
12072
12072
  try {
12073
- return await import('./src-CMPIJGUE.mjs');
12073
+ return await import('./src-PGESGQ7G.mjs');
12074
12074
  } catch (e) {
12075
12075
  if (isModuleNotFound4(e)) {
12076
12076
  console.error(
@@ -12348,18 +12348,56 @@ async function workspacePathCommand(options = {}) {
12348
12348
  console.log(location.workspaceDir);
12349
12349
  }
12350
12350
  var DEFAULT_CONFIG_FILENAME = "agent-inspect.suite.json";
12351
+ var CONFIG_EXISTS_ERROR = `${DEFAULT_CONFIG_FILENAME} already exists; refusing to overwrite it.`;
12351
12352
  function printJson5(value) {
12352
12353
  console.log(JSON.stringify(value, null, 2));
12353
12354
  }
12354
12355
  function resolveCwd(options) {
12355
12356
  return path19.resolve(options.cwd ?? process.cwd());
12356
12357
  }
12358
+ function getErrorCode(error) {
12359
+ if (typeof error !== "object" || error === null || !("code" in error)) {
12360
+ return void 0;
12361
+ }
12362
+ return typeof error.code === "string" ? error.code : void 0;
12363
+ }
12364
+ function getErrorMessage(error) {
12365
+ return error instanceof Error ? error.message : String(error);
12366
+ }
12367
+ function failInit(options, message) {
12368
+ if (options.json) {
12369
+ printJson5({ ok: false, error: message });
12370
+ } else {
12371
+ console.error(`[AgentInspect] suite init failed: ${message}`);
12372
+ }
12373
+ process.exitCode = 1;
12374
+ }
12375
+ async function pathExists2(filePath) {
12376
+ try {
12377
+ await lstat(filePath);
12378
+ return true;
12379
+ } catch (error) {
12380
+ if (getErrorCode(error) === "ENOENT") return false;
12381
+ throw error;
12382
+ }
12383
+ }
12357
12384
  async function suiteInitCommand(options = {}) {
12358
12385
  const cwd = resolveCwd(options);
12359
12386
  const configPath = path19.join(cwd, DEFAULT_CONFIG_FILENAME);
12360
12387
  const template = options.template?.trim();
12361
12388
  const suiteConfig = template !== void 0 && template !== "" ? resolveSuiteTemplate(template) : defaultSuiteConfigTemplate();
12389
+ const content = `${JSON.stringify(suiteConfig, null, 2)}
12390
+ `;
12362
12391
  if (options.dryRun) {
12392
+ try {
12393
+ if (await pathExists2(configPath)) {
12394
+ failInit(options, CONFIG_EXISTS_ERROR);
12395
+ return;
12396
+ }
12397
+ } catch (error) {
12398
+ failInit(options, getErrorMessage(error));
12399
+ return;
12400
+ }
12363
12401
  if (options.json) {
12364
12402
  printJson5({
12365
12403
  ok: true,
@@ -12376,8 +12414,10 @@ async function suiteInitCommand(options = {}) {
12376
12414
  return;
12377
12415
  }
12378
12416
  try {
12379
- await writeFile(configPath, `${JSON.stringify(suiteConfig, null, 2)}
12380
- `, "utf-8");
12417
+ await writeFile(configPath, content, {
12418
+ encoding: "utf-8",
12419
+ flag: "wx"
12420
+ });
12381
12421
  if (options.json) {
12382
12422
  printJson5({
12383
12423
  ok: true,
@@ -12394,13 +12434,8 @@ async function suiteInitCommand(options = {}) {
12394
12434
  console.log(" npx agent-inspect suite validate");
12395
12435
  console.log(" npx agent-inspect suite run --json");
12396
12436
  } catch (error) {
12397
- const message = error instanceof Error ? error.message : String(error);
12398
- if (options.json) {
12399
- printJson5({ ok: false, error: message });
12400
- } else {
12401
- console.error(`[AgentInspect] suite init failed: ${message}`);
12402
- }
12403
- process.exitCode = 1;
12437
+ const message = getErrorCode(error) === "EEXIST" ? CONFIG_EXISTS_ERROR : getErrorMessage(error);
12438
+ failInit(options, message);
12404
12439
  }
12405
12440
  }
12406
12441
  async function suiteValidateCommand(options = {}) {