agent-inspect 6.31.19 → 6.31.21

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.
@@ -8246,13 +8246,33 @@ function classifyRetryAttempt(event, priorOrdered, allMembers) {
8246
8246
  }
8247
8247
  return { kind: "unknown", reason: "ambiguous attempt identity" };
8248
8248
  }
8249
- function hasDuplicateAttemptIds(members) {
8250
- const seen = /* @__PURE__ */ new Set();
8249
+ function redeliveryFingerprint(event) {
8250
+ const workflow = workflowFor(event);
8251
+ const stableEventId = (event.eventId ?? "").replace(/:\d+$/, "");
8252
+ return JSON.stringify({
8253
+ stableEventId,
8254
+ runId: event.runId,
8255
+ kind: event.kind,
8256
+ name: event.name,
8257
+ status: event.status,
8258
+ operationId: workflow.operationId ?? null,
8259
+ attemptId: workflow.attemptId ?? null,
8260
+ attemptNumber: workflow.attemptNumber ?? null,
8261
+ retryOf: workflow.retryOf ?? null
8262
+ });
8263
+ }
8264
+ function hasConflictingAttemptIdReuse(members) {
8265
+ const byAttempt = /* @__PURE__ */ new Map();
8251
8266
  for (const event of members) {
8267
+ if (event.kind !== "TOOL" && event.kind !== "LLM") continue;
8252
8268
  const id = attemptIdOf(event);
8253
8269
  if (!id) continue;
8254
- if (seen.has(id)) return true;
8255
- seen.add(id);
8270
+ const fingerprints = byAttempt.get(id) ?? /* @__PURE__ */ new Set();
8271
+ fingerprints.add(redeliveryFingerprint(event));
8272
+ byAttempt.set(id, fingerprints);
8273
+ }
8274
+ for (const fingerprints of byAttempt.values()) {
8275
+ if (fingerprints.size > 1) return true;
8256
8276
  }
8257
8277
  return false;
8258
8278
  }
@@ -8269,11 +8289,11 @@ function evaluateRetrySafetyRules(events, rules, _runEvidence) {
8269
8289
  }
8270
8290
  if (rules.maxAttempts !== void 0) {
8271
8291
  for (const [operationId, members] of byOperation) {
8272
- if (hasDuplicateAttemptIds(members)) {
8292
+ if (hasConflictingAttemptIdReuse(members)) {
8273
8293
  findings.push(
8274
8294
  fail2(
8275
8295
  "contract.retry.duplicate-attempt-id",
8276
- `Operation ${operationId} has duplicate attemptId values.`,
8296
+ `Operation ${operationId} has conflicting attemptId reuse (distinct executions).`,
8277
8297
  members.slice(0, 4).map(eventEvidence2),
8278
8298
  "unique attemptId",
8279
8299
  "duplicate"
@@ -8528,6 +8548,13 @@ function errorCodeOf(event) {
8528
8548
  const code = nested.code;
8529
8549
  if (typeof code === "string" && code.trim() !== "") return code.trim();
8530
8550
  }
8551
+ const meta2 = attrs.metadata;
8552
+ if (meta2 && typeof meta2 === "object") {
8553
+ for (const key of ["errorCode", "code"]) {
8554
+ const value = meta2[key];
8555
+ if (typeof value === "string" && value.trim() !== "") return value.trim();
8556
+ }
8557
+ }
8531
8558
  return void 0;
8532
8559
  }
8533
8560
  function argumentDigestOf(event) {
@@ -8651,7 +8678,7 @@ function attemptIdOf2(event) {
8651
8678
  const value = workflowFor2(event).attemptId;
8652
8679
  return typeof value === "string" && value.trim() !== "" ? value.trim() : void 0;
8653
8680
  }
8654
- function hasDuplicateAttemptIds2(members) {
8681
+ function hasDuplicateAttemptIds(members) {
8655
8682
  const seen = /* @__PURE__ */ new Set();
8656
8683
  for (const event of members) {
8657
8684
  const id = attemptIdOf2(event);
@@ -8747,7 +8774,7 @@ function evaluateRecoveryOperations(events, operations) {
8747
8774
  }
8748
8775
  for (const [operationKey, members] of groups) {
8749
8776
  const ordered = sortByTime2(members);
8750
- if (hasDuplicateAttemptIds2(members)) {
8777
+ if (hasDuplicateAttemptIds(members)) {
8751
8778
  findings.push(
8752
8779
  fail3(
8753
8780
  "contract.retry.operations.duplicate-attempt-id",
@@ -16953,7 +16980,7 @@ var init_src = __esm({
16953
16980
  });
16954
16981
 
16955
16982
  // package.json
16956
- var version = "6.31.19";
16983
+ var version = "6.31.21";
16957
16984
 
16958
16985
  // packages/cli/src/list.ts
16959
16986
  init_advanced();