@agent-inspect/mcp-server 5.0.0 → 5.1.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/dist/index.cjs CHANGED
@@ -3712,6 +3712,94 @@ function openTrace(input, options = {}) {
3712
3712
  return readTrace(input, options);
3713
3713
  }
3714
3714
 
3715
+ // packages/core/src/exporters/helpers.ts
3716
+ var REDACT_SUBSTRINGS = [
3717
+ "authorization",
3718
+ "cookie",
3719
+ "token",
3720
+ "apikey",
3721
+ "password",
3722
+ "secret",
3723
+ "email"
3724
+ ];
3725
+ function shouldRedactKey(key) {
3726
+ const k = key.toLowerCase();
3727
+ for (const s of REDACT_SUBSTRINGS) {
3728
+ if (k.includes(s)) return true;
3729
+ }
3730
+ return false;
3731
+ }
3732
+ function safeString(value, maxLength) {
3733
+ if (value === null || value === void 0) return "";
3734
+ let s;
3735
+ if (typeof value === "string") s = value;
3736
+ else if (typeof value === "number" || typeof value === "boolean") s = String(value);
3737
+ else s = stableJson(value, false);
3738
+ if (maxLength !== void 0 && maxLength >= 0 && s.length > maxLength) {
3739
+ return `${s.slice(0, maxLength)}\u2026`;
3740
+ }
3741
+ return s;
3742
+ }
3743
+ function escapeMarkdown(value) {
3744
+ return value.replace(/\|/g, "\\|").replace(/\r\n/g, "\n").replace(/\r/g, "\n").replace(/\n/g, " ");
3745
+ }
3746
+ function sortKeysDeep(input) {
3747
+ if (input === null || typeof input !== "object") return input;
3748
+ if (Array.isArray(input)) return input.map(sortKeysDeep);
3749
+ const o = input;
3750
+ const out = {};
3751
+ for (const k of Object.keys(o).sort()) {
3752
+ out[k] = sortKeysDeep(o[k]);
3753
+ }
3754
+ return out;
3755
+ }
3756
+ function stableJson(value, pretty) {
3757
+ const sorted = sortKeysDeep(value);
3758
+ return pretty === true ? JSON.stringify(sorted, null, 2) : JSON.stringify(sorted);
3759
+ }
3760
+ function compactAttributes3(attrs, options) {
3761
+ if (attrs === void 0) return {};
3762
+ const maxLen = options?.maxLength ?? 500;
3763
+ const out = {};
3764
+ for (const key of Object.keys(attrs).sort()) {
3765
+ if (shouldRedactKey(key)) {
3766
+ out[key] = "[REDACTED]";
3767
+ continue;
3768
+ }
3769
+ const v = attrs[key];
3770
+ out[key] = compactValue(v, maxLen);
3771
+ }
3772
+ return out;
3773
+ }
3774
+ function compactValue(value, maxLen, redacted) {
3775
+ if (value === null || typeof value !== "object") {
3776
+ return typeof value === "string" ? safeString(value, maxLen) : value;
3777
+ }
3778
+ if (Array.isArray(value)) {
3779
+ const arr = value.slice(0, 20).map((x) => compactValue(x, maxLen));
3780
+ if (value.length > 20) arr.push(`\u2026(+${value.length - 20} more)`);
3781
+ return arr;
3782
+ }
3783
+ const o = value;
3784
+ const inner = {};
3785
+ for (const k of Object.keys(o)) {
3786
+ if (shouldRedactKey(k)) inner[k] = "[REDACTED]";
3787
+ else inner[k] = compactValue(o[k], maxLen);
3788
+ }
3789
+ return inner;
3790
+ }
3791
+ function flattenTree(tree) {
3792
+ const out = [];
3793
+ function walk(nodes) {
3794
+ for (const n of nodes) {
3795
+ out.push(n);
3796
+ if (n.children.length > 0) walk(n.children);
3797
+ }
3798
+ }
3799
+ walk(tree.children);
3800
+ return out;
3801
+ }
3802
+
3715
3803
  // packages/core/src/diff/comparable.ts
3716
3804
  function extractOutputPreview(meta) {
3717
3805
  if (meta === void 0) return void 0;
@@ -3811,94 +3899,6 @@ function manualTraceEventsToComparableRun(events) {
3811
3899
  };
3812
3900
  }
3813
3901
 
3814
- // packages/core/src/exporters/helpers.ts
3815
- var REDACT_SUBSTRINGS = [
3816
- "authorization",
3817
- "cookie",
3818
- "token",
3819
- "apikey",
3820
- "password",
3821
- "secret",
3822
- "email"
3823
- ];
3824
- function shouldRedactKey(key) {
3825
- const k = key.toLowerCase();
3826
- for (const s of REDACT_SUBSTRINGS) {
3827
- if (k.includes(s)) return true;
3828
- }
3829
- return false;
3830
- }
3831
- function safeString(value, maxLength) {
3832
- if (value === null || value === void 0) return "";
3833
- let s;
3834
- if (typeof value === "string") s = value;
3835
- else if (typeof value === "number" || typeof value === "boolean") s = String(value);
3836
- else s = stableJson(value, false);
3837
- if (maxLength !== void 0 && maxLength >= 0 && s.length > maxLength) {
3838
- return `${s.slice(0, maxLength)}\u2026`;
3839
- }
3840
- return s;
3841
- }
3842
- function escapeMarkdown(value) {
3843
- return value.replace(/\|/g, "\\|").replace(/\r\n/g, "\n").replace(/\r/g, "\n").replace(/\n/g, " ");
3844
- }
3845
- function sortKeysDeep(input) {
3846
- if (input === null || typeof input !== "object") return input;
3847
- if (Array.isArray(input)) return input.map(sortKeysDeep);
3848
- const o = input;
3849
- const out = {};
3850
- for (const k of Object.keys(o).sort()) {
3851
- out[k] = sortKeysDeep(o[k]);
3852
- }
3853
- return out;
3854
- }
3855
- function stableJson(value, pretty) {
3856
- const sorted = sortKeysDeep(value);
3857
- return pretty === true ? JSON.stringify(sorted, null, 2) : JSON.stringify(sorted);
3858
- }
3859
- function compactAttributes3(attrs, options) {
3860
- if (attrs === void 0) return {};
3861
- const maxLen = options?.maxLength ?? 500;
3862
- const out = {};
3863
- for (const key of Object.keys(attrs).sort()) {
3864
- if (shouldRedactKey(key)) {
3865
- out[key] = "[REDACTED]";
3866
- continue;
3867
- }
3868
- const v = attrs[key];
3869
- out[key] = compactValue(v, maxLen);
3870
- }
3871
- return out;
3872
- }
3873
- function compactValue(value, maxLen, redacted) {
3874
- if (value === null || typeof value !== "object") {
3875
- return typeof value === "string" ? safeString(value, maxLen) : value;
3876
- }
3877
- if (Array.isArray(value)) {
3878
- const arr = value.slice(0, 20).map((x) => compactValue(x, maxLen));
3879
- if (value.length > 20) arr.push(`\u2026(+${value.length - 20} more)`);
3880
- return arr;
3881
- }
3882
- const o = value;
3883
- const inner = {};
3884
- for (const k of Object.keys(o)) {
3885
- if (shouldRedactKey(k)) inner[k] = "[REDACTED]";
3886
- else inner[k] = compactValue(o[k], maxLen);
3887
- }
3888
- return inner;
3889
- }
3890
- function flattenTree(tree) {
3891
- const out = [];
3892
- function walk(nodes) {
3893
- for (const n of nodes) {
3894
- out.push(n);
3895
- if (n.children.length > 0) walk(n.children);
3896
- }
3897
- }
3898
- walk(tree.children);
3899
- return out;
3900
- }
3901
-
3902
3902
  // packages/core/src/diff/engine.ts
3903
3903
  var DEFAULT_THRESHOLD_MS = 0;
3904
3904
  function pathSeg(step, index) {