@agent-inspect/mcp-server 6.31.30 → 6.31.32

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/cli.cjs CHANGED
@@ -225,6 +225,10 @@ var HIGH_CONFIDENCE_CREDENTIAL_PATTERNS = [
225
225
  /\b[a-z0-9_.-]+=[^;\s]+(?:;\s*[a-z0-9_.-]+=[^;\s]+)+/i,
226
226
  /\beyJ[a-zA-Z0-9_-]{8,}\.[a-zA-Z0-9_-]{8,}\.[a-zA-Z0-9_-]{8,}\b/,
227
227
  /\b(?:sk-(?:proj-)?[a-zA-Z0-9_-]{16,}|sk-ant-[a-zA-Z0-9_-]{16,}|AIza[0-9A-Za-z_-]{20,})\b/,
228
+ // Stripe secret / restricted keys use underscores (not sk-). Keep in sync with
229
+ // packages/redact/src/index.ts + packages/core/src/checks DEFAULT_SECRET_PATTERNS (#520).
230
+ /\b(?:sk|rk)_(?:live|test)_[A-Za-z0-9]{16,}\b/,
231
+ /\bxox[abposr]-[A-Za-z0-9-]{10,}\b/,
228
232
  /\b(?:ghp|gho|ghu|ghs|ghr)_[A-Za-z0-9_]{20,}\b/,
229
233
  /\b(?:AKIA|ASIA)[A-Z0-9]{16}\b/,
230
234
  /-----BEGIN [A-Z ]*PRIVATE KEY-----[\s\S]*-----END [A-Z ]*PRIVATE KEY-----/,
@@ -3421,6 +3425,12 @@ var SAFE_USAGE_LEAF_KEYS = /* @__PURE__ */ new Set([
3421
3425
  var DEFAULT_SECRET_PATTERNS = [
3422
3426
  { id: "bearer-token", pattern: /Bearer\s+[A-Za-z0-9._~+/-]{12,}=*/ },
3423
3427
  { id: "openai-key", pattern: /sk-[A-Za-z0-9_-]{16,}/ },
3428
+ // Stripe + Slack: keep in sync with packages/redact + credential-value-patterns (#520).
3429
+ {
3430
+ id: "stripe-key",
3431
+ pattern: /\b(?:sk|rk)_(?:live|test)_[A-Za-z0-9]{16,}\b/
3432
+ },
3433
+ { id: "slack-token", pattern: /\bxox[abposr]-[A-Za-z0-9-]{10,}\b/ },
3424
3434
  { id: "aws-access-key", pattern: /AKIA[0-9A-Z]{16}/ },
3425
3435
  { id: "github-token", pattern: /gh[opsu]_[A-Za-z0-9_]{20,}/ },
3426
3436
  // Keep in sync with packages/redact/src/key-value-secret.ts (KEY_VALUE_SECRET_PATTERN_SOURCE).
@@ -7510,6 +7520,16 @@ function stepIdOf2(event) {
7510
7520
  const value = event.attributes?.stepId;
7511
7521
  return typeof value === "string" && value.trim() !== "" ? value : void 0;
7512
7522
  }
7523
+ function attemptIdOf(event) {
7524
+ const direct = event.attributes?.attemptId;
7525
+ if (typeof direct === "string" && direct.trim() !== "") return direct;
7526
+ const meta = event.attributes?.metadata;
7527
+ if (meta && typeof meta === "object" && !Array.isArray(meta)) {
7528
+ const nested = meta.attemptId;
7529
+ if (typeof nested === "string" && nested.trim() !== "") return nested;
7530
+ }
7531
+ return void 0;
7532
+ }
7513
7533
  function lifecycleKey(event) {
7514
7534
  if (event.kind === "RUN") return `run:${event.runId}`;
7515
7535
  const stepId = stepIdOf2(event);
@@ -7519,6 +7539,9 @@ function lifecycleKey(event) {
7519
7539
  function isTerminal(status) {
7520
7540
  return status === "ok" || status === "error";
7521
7541
  }
7542
+ function eventTime(event) {
7543
+ return typeof event.timestamp === "number" ? event.timestamp : 0;
7544
+ }
7522
7545
  function cloneNode(node) {
7523
7546
  return {
7524
7547
  event: {
@@ -7529,37 +7552,87 @@ function cloneNode(node) {
7529
7552
  depth: node.depth
7530
7553
  };
7531
7554
  }
7555
+ function joinOnePair(start, terminal) {
7556
+ const childMap = /* @__PURE__ */ new Map();
7557
+ if (start) {
7558
+ for (const child of start.children) {
7559
+ childMap.set(child.event.eventId, child);
7560
+ }
7561
+ }
7562
+ for (const child of terminal.children) {
7563
+ childMap.set(child.event.eventId, child);
7564
+ }
7565
+ return {
7566
+ event: {
7567
+ ...terminal.event,
7568
+ name: start?.event.name ?? terminal.event.name,
7569
+ kind: start?.event.kind ?? terminal.event.kind,
7570
+ ...start && attemptIdOf(terminal.event) === void 0 && attemptIdOf(start.event) ? {
7571
+ attributes: {
7572
+ ...terminal.event.attributes,
7573
+ attemptId: attemptIdOf(start.event)
7574
+ }
7575
+ } : {}
7576
+ },
7577
+ children: presentSiblingNodes([...childMap.values()]),
7578
+ depth: terminal.depth
7579
+ };
7580
+ }
7532
7581
  function joinSiblingGroup(group) {
7533
7582
  if (group.length <= 1) return group;
7534
- const terminals = group.filter((n) => isTerminal(n.event.status));
7535
- const runnings = group.filter((n) => n.event.status === "running");
7583
+ const terminals = group.filter((n) => isTerminal(n.event.status)).sort((a, b) => eventTime(a.event) - eventTime(b.event));
7584
+ const runnings = group.filter((n) => n.event.status === "running").sort((a, b) => eventTime(a.event) - eventTime(b.event));
7585
+ const others = group.filter(
7586
+ (n) => !isTerminal(n.event.status) && n.event.status !== "running"
7587
+ );
7536
7588
  const terminalStatuses = new Set(terminals.map((n) => n.event.status));
7537
7589
  if (terminalStatuses.size > 1) {
7538
7590
  return group;
7539
7591
  }
7540
- if (terminals.length >= 1) {
7541
- const terminal = terminals[terminals.length - 1];
7542
- const start = runnings[0];
7543
- const childMap = /* @__PURE__ */ new Map();
7544
- for (const n of group) {
7545
- for (const child of n.children) {
7546
- childMap.set(child.event.eventId, child);
7592
+ if (terminals.length > 1 && terminals.every((t) => attemptIdOf(t.event) === void 0) && runnings.every((r) => attemptIdOf(r.event) === void 0)) {
7593
+ return group;
7594
+ }
7595
+ const usedRunning = /* @__PURE__ */ new Set();
7596
+ const out = [];
7597
+ for (const terminal of terminals) {
7598
+ const terminalAttempt = attemptIdOf(terminal.event);
7599
+ const terminalTs = eventTime(terminal.event);
7600
+ const candidate = runnings.find((r) => {
7601
+ if (usedRunning.has(r.event.eventId)) return false;
7602
+ if (eventTime(r.event) > terminalTs) return false;
7603
+ const runningAttempt = attemptIdOf(r.event);
7604
+ if (terminalAttempt !== void 0) {
7605
+ return runningAttempt === terminalAttempt;
7547
7606
  }
7548
- }
7549
- return [
7550
- {
7551
- event: {
7552
- ...terminal.event,
7553
- name: start?.event.name ?? terminal.event.name,
7554
- kind: start?.event.kind ?? terminal.event.kind,
7555
- ...start?.event.timestamp !== void 0 && terminal.event.durationMs === void 0 ? {} : {}
7556
- },
7557
- children: presentSiblingNodes([...childMap.values()]),
7558
- depth: terminal.depth
7607
+ if (runningAttempt !== void 0) {
7608
+ return true;
7559
7609
  }
7560
- ];
7610
+ return true;
7611
+ });
7612
+ if (candidate) {
7613
+ usedRunning.add(candidate.event.eventId);
7614
+ out.push(joinOnePair(candidate, terminal));
7615
+ } else {
7616
+ out.push({
7617
+ ...terminal,
7618
+ children: presentSiblingNodes(terminal.children)
7619
+ });
7620
+ }
7621
+ }
7622
+ for (const running of runnings) {
7623
+ if (usedRunning.has(running.event.eventId)) continue;
7624
+ out.push({
7625
+ ...running,
7626
+ children: presentSiblingNodes(running.children)
7627
+ });
7561
7628
  }
7562
- return group;
7629
+ for (const other of others) {
7630
+ out.push({
7631
+ ...other,
7632
+ children: presentSiblingNodes(other.children)
7633
+ });
7634
+ }
7635
+ return out;
7563
7636
  }
7564
7637
  function presentSiblingNodes(nodes) {
7565
7638
  const prepared = nodes.map((n) => ({
@@ -8707,6 +8780,18 @@ var credentialDetectors = [
8707
8780
  pattern: /\b(?:sk-(?:proj-)?[a-zA-Z0-9_-]{16,}|sk-ant-[a-zA-Z0-9_-]{16,}|AIza[0-9A-Za-z_-]{20,})\b/,
8708
8781
  severity: "error"
8709
8782
  }),
8783
+ // Stripe secret/restricted keys (underscore form). Keep in sync with
8784
+ // packages/core/src/safety/credential-value-patterns.ts + checks DEFAULT_SECRET_PATTERNS (#520).
8785
+ patternDetector({
8786
+ id: "value.stripeSecretKey",
8787
+ pattern: /\b(?:sk|rk)_(?:live|test)_[A-Za-z0-9]{16,}\b/,
8788
+ severity: "error"
8789
+ }),
8790
+ patternDetector({
8791
+ id: "value.slackToken",
8792
+ pattern: /\bxox[abposr]-[A-Za-z0-9-]{10,}\b/,
8793
+ severity: "error"
8794
+ }),
8710
8795
  patternDetector({
8711
8796
  id: "value.githubToken",
8712
8797
  pattern: /\b(?:ghp|gho|ghu|ghs|ghr)_[A-Za-z0-9_]{20,}\b/,