agent-inspect 6.31.8 → 6.31.10

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 (53) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +1 -1
  3. package/package.json +1 -1
  4. package/packages/cli/dist/{chunk-6FE47XSF.mjs → chunk-JCKC4ZRV.mjs} +212 -12
  5. package/packages/cli/dist/chunk-JCKC4ZRV.mjs.map +1 -0
  6. package/packages/cli/dist/index.cjs +215 -11
  7. package/packages/cli/dist/index.cjs.map +1 -1
  8. package/packages/cli/dist/index.mjs +4 -4
  9. package/packages/cli/dist/index.mjs.map +1 -1
  10. package/packages/cli/dist/{src-NXAYHG34.mjs → src-4UD7JNDR.mjs} +3 -3
  11. package/packages/cli/dist/{src-NXAYHG34.mjs.map → src-4UD7JNDR.mjs.map} +1 -1
  12. package/packages/core/dist/advanced.cjs +202 -15
  13. package/packages/core/dist/advanced.cjs.map +1 -1
  14. package/packages/core/dist/advanced.d.cts +1 -1
  15. package/packages/core/dist/advanced.d.ts +1 -1
  16. package/packages/core/dist/advanced.mjs +90 -15
  17. package/packages/core/dist/advanced.mjs.map +1 -1
  18. package/packages/core/dist/checks.cjs +79 -0
  19. package/packages/core/dist/checks.cjs.map +1 -1
  20. package/packages/core/dist/checks.d.cts +1 -1
  21. package/packages/core/dist/checks.d.ts +1 -1
  22. package/packages/core/dist/checks.mjs +3 -2
  23. package/packages/core/dist/{chunk-L5WLVBW4.mjs → chunk-AHUZNHFI.mjs} +4 -55
  24. package/packages/core/dist/chunk-AHUZNHFI.mjs.map +1 -0
  25. package/packages/core/dist/{chunk-2CCRUI42.mjs → chunk-CPQAOJW4.mjs} +72 -3
  26. package/packages/core/dist/chunk-CPQAOJW4.mjs.map +1 -0
  27. package/packages/core/dist/{chunk-2IRRUNIN.mjs → chunk-OAUNS5CS.mjs} +3 -3
  28. package/packages/core/dist/{chunk-2IRRUNIN.mjs.map → chunk-OAUNS5CS.mjs.map} +1 -1
  29. package/packages/core/dist/{chunk-IJJSPJXV.mjs → chunk-QOC3PJO3.mjs} +4 -4
  30. package/packages/core/dist/{chunk-IJJSPJXV.mjs.map → chunk-QOC3PJO3.mjs.map} +1 -1
  31. package/packages/core/dist/chunk-S6LQBLX5.mjs +67 -0
  32. package/packages/core/dist/chunk-S6LQBLX5.mjs.map +1 -0
  33. package/packages/core/dist/{chunk-VQUB3WRI.mjs → chunk-SSG3ICI4.mjs} +28 -3
  34. package/packages/core/dist/chunk-SSG3ICI4.mjs.map +1 -0
  35. package/packages/core/dist/index.cjs +89 -1
  36. package/packages/core/dist/index.cjs.map +1 -1
  37. package/packages/core/dist/index.mjs +3 -2
  38. package/packages/core/dist/index.mjs.map +1 -1
  39. package/packages/core/dist/persisted.cjs +11 -0
  40. package/packages/core/dist/persisted.cjs.map +1 -1
  41. package/packages/core/dist/persisted.mjs +4 -3
  42. package/packages/core/dist/persisted.mjs.map +1 -1
  43. package/packages/core/dist/{programmatic-gZTWLObB.d.cts → programmatic-BLlC7Ytq.d.cts} +1 -1
  44. package/packages/core/dist/{programmatic-gZTWLObB.d.ts → programmatic-BLlC7Ytq.d.ts} +1 -1
  45. package/packages/core/dist/readers.cjs +11 -0
  46. package/packages/core/dist/readers.cjs.map +1 -1
  47. package/packages/core/dist/readers.d.cts +1 -1
  48. package/packages/core/dist/readers.d.ts +1 -1
  49. package/packages/core/dist/readers.mjs +4 -3
  50. package/packages/cli/dist/chunk-6FE47XSF.mjs.map +0 -1
  51. package/packages/core/dist/chunk-2CCRUI42.mjs.map +0 -1
  52. package/packages/core/dist/chunk-L5WLVBW4.mjs.map +0 -1
  53. package/packages/core/dist/chunk-VQUB3WRI.mjs.map +0 -1
@@ -72,6 +72,17 @@ var PROGRAMMATIC_DIAGNOSTIC_SPECS = Object.freeze({
72
72
  summary: "Trace contains a parentId cycle.",
73
73
  remediation: "Use visibility-first tree linking for legacy fixtures; prefer acyclic capture for new adapter output.",
74
74
  relatedCodes: ["structure.cycle"]
75
+ },
76
+ AI_TRACE_CONTRACT_INPUT_INVALID: {
77
+ code: "AI_TRACE_CONTRACT_INPUT_INVALID",
78
+ summary: "evaluateTraceContract expects ({ read }, contract) or use evaluateTraceContractRead(read, contract).",
79
+ remediation: "Pass TraceCheckInput as the first argument: evaluateTraceContract({ read }, contract).",
80
+ relatedCodes: ["AI_CHECK_INVALID_ARGUMENTS"]
81
+ },
82
+ AI_INSPECT_RUN_UNSUPPORTED_OPTION: {
83
+ code: "AI_INSPECT_RUN_UNSUPPORTED_OPTION",
84
+ summary: 'inspectRun does not accept a "writer" option.',
85
+ remediation: "Use createInspector({ writer }) then inspector.run(...). inspectRun persists via the global JSONL path (schema 0.1)."
75
86
  }
76
87
  });
77
88
  function formatProgrammaticDiagnostic(code, detail) {
@@ -3221,7 +3232,72 @@ function defineTraceContract(input) {
3221
3232
  ...alternatives ? { alternatives } : {}
3222
3233
  };
3223
3234
  }
3235
+ function isTraceReadLike(value) {
3236
+ if (typeof value !== "object" || value === null) return false;
3237
+ const candidate = value;
3238
+ return typeof candidate.format === "string" && Array.isArray(candidate.runs) && Array.isArray(candidate.events);
3239
+ }
3240
+ function isTraceCheckInputLike(value) {
3241
+ if (typeof value !== "object" || value === null || Array.isArray(value)) {
3242
+ return false;
3243
+ }
3244
+ return isTraceReadLike(value.read);
3245
+ }
3246
+ function looksLikeTraceContract(value) {
3247
+ if (typeof value !== "object" || value === null || Array.isArray(value)) {
3248
+ return false;
3249
+ }
3250
+ if (isTraceReadLike(value) || isTraceCheckInputLike(value)) {
3251
+ return false;
3252
+ }
3253
+ return true;
3254
+ }
3255
+ function invalidContractInputResult() {
3256
+ return {
3257
+ ok: false,
3258
+ status: "error",
3259
+ format: "unknown",
3260
+ summary: {
3261
+ passed: 0,
3262
+ failed: 0,
3263
+ warnings: 0,
3264
+ errors: 1,
3265
+ rulesEvaluated: 0
3266
+ },
3267
+ findings: [],
3268
+ diagnostics: [
3269
+ {
3270
+ code: "AI_CHECK_INVALID_ARGUMENTS",
3271
+ message: formatProgrammaticDiagnostic("AI_TRACE_CONTRACT_INPUT_INVALID"),
3272
+ severity: "error"
3273
+ }
3274
+ ],
3275
+ ruleExecutions: []
3276
+ };
3277
+ }
3278
+ function validateEvaluateTraceContractArgs(input, contract) {
3279
+ if (isTraceCheckInputLike(input) && looksLikeTraceContract(contract)) {
3280
+ return void 0;
3281
+ }
3282
+ if (looksLikeTraceContract(input) && (isTraceCheckInputLike(contract) || isTraceReadLike(contract))) {
3283
+ return invalidContractInputResult();
3284
+ }
3285
+ if (isTraceReadLike(input)) {
3286
+ return invalidContractInputResult();
3287
+ }
3288
+ if (!isTraceCheckInputLike(input)) {
3289
+ return invalidContractInputResult();
3290
+ }
3291
+ if (!looksLikeTraceContract(contract)) {
3292
+ return invalidContractInputResult();
3293
+ }
3294
+ return void 0;
3295
+ }
3224
3296
  function evaluateTraceContract(input, contract, options = {}) {
3297
+ const inputGuard = validateEvaluateTraceContractArgs(input, contract);
3298
+ if (inputGuard !== void 0) {
3299
+ return inputGuard;
3300
+ }
3225
3301
  const shapeErrors = [
3226
3302
  ...validateAllowedStatusesShape(contract.run?.allowedStatuses),
3227
3303
  ...validateAlternativesShape(contract.alternatives),
@@ -3360,6 +3436,9 @@ function evaluateTraceContract(input, contract, options = {}) {
3360
3436
  );
3361
3437
  }
3362
3438
  function evaluateTraceContractRead(read, contract, options = {}) {
3439
+ if (!isTraceReadLike(read) || !looksLikeTraceContract(contract)) {
3440
+ return invalidContractInputResult();
3441
+ }
3363
3442
  return evaluateTraceContract({ read }, contract, options);
3364
3443
  }
3365
3444
  function lintTraceContract(contract) {