agent-inspect 6.31.18 → 6.31.19

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.
@@ -3851,7 +3851,7 @@ function extractSessionWorkflowMetadata(record) {
3851
3851
  assignString("conversationId", record.conversationId);
3852
3852
  assignString("groupId", record.groupId);
3853
3853
  assignString("parentGroupId", record.parentGroupId);
3854
- assignString("retryOf", record.retryOf);
3854
+ assignString("retryOf", record.retryOf ?? record["agent_inspect.retry_of"]);
3855
3855
  assignString("retryReason", record.retryReason);
3856
3856
  assignString("handoffFrom", record.handoffFrom);
3857
3857
  assignString("handoffTo", record.handoffTo);
@@ -3864,8 +3864,8 @@ function extractSessionWorkflowMetadata(record) {
3864
3864
  assignString("toolCallId", record.toolCallId);
3865
3865
  assignString("mcpToolCallId", record.mcpToolCallId);
3866
3866
  assignString("linkedStepId", record.linkedStepId);
3867
- assignString("operationId", record.operationId);
3868
- assignString("attemptId", record.attemptId);
3867
+ assignString("operationId", record.operationId ?? record["agent_inspect.operation_id"]);
3868
+ assignString("attemptId", record.attemptId ?? record["agent_inspect.attempt_id"]);
3869
3869
  assignString("fallbackOf", record.fallbackOf);
3870
3870
  assignString("idempotencyKey", record.idempotencyKey);
3871
3871
  assignString("correlationId", record.correlationId);
@@ -3876,7 +3876,9 @@ function extractSessionWorkflowMetadata(record) {
3876
3876
  out.attempt = attempt;
3877
3877
  found = true;
3878
3878
  }
3879
- const attemptNumber2 = finitePositiveInt(record.attemptNumber);
3879
+ const attemptNumber2 = finitePositiveInt(
3880
+ record.attemptNumber ?? record["agent_inspect.attempt_number"]
3881
+ );
3880
3882
  if (attemptNumber2 !== void 0) {
3881
3883
  out.attemptNumber = attemptNumber2;
3882
3884
  found = true;
@@ -8180,12 +8182,21 @@ function countOperationAttempts(members) {
8180
8182
  if (identified.size > 0) {
8181
8183
  return identified.size + unidentified;
8182
8184
  }
8183
- const numbers = members.map((event) => attemptNumberOf(event)).filter((value) => value !== void 0).sort((a, b) => a - b);
8184
- if (numbers.length > 0) {
8185
- const unique = [...new Set(numbers)];
8186
- return unique.length;
8185
+ const numbered = /* @__PURE__ */ new Set();
8186
+ let unnumbered = 0;
8187
+ for (const event of members) {
8188
+ if (event.kind !== "TOOL" && event.kind !== "LLM") continue;
8189
+ const num2 = attemptNumberOf(event);
8190
+ if (num2 !== void 0) {
8191
+ numbered.add(num2);
8192
+ continue;
8193
+ }
8194
+ unnumbered += 1;
8195
+ }
8196
+ if (numbered.size > 0) {
8197
+ return numbered.size + unnumbered;
8187
8198
  }
8188
- return unidentified;
8199
+ return unnumbered;
8189
8200
  }
8190
8201
  function classifyRetryAttempt(event, priorOrdered, allMembers) {
8191
8202
  const workflow = workflowFor(event);
@@ -8475,11 +8486,23 @@ function consumerStartMs(event) {
8475
8486
  return parseComparableMs(event.startedAt) ?? parseComparableMs(event.timestamp);
8476
8487
  }
8477
8488
  function resultAvailableMs(event) {
8478
- const ended = parseComparableMs(event.endedAt);
8479
- if (ended !== void 0) return ended;
8480
8489
  const started = parseComparableMs(event.startedAt) ?? parseComparableMs(event.timestamp);
8481
- if (started !== void 0 && event.durationMs !== void 0 && Number.isFinite(event.durationMs)) {
8482
- return started + event.durationMs;
8490
+ const endedRaw = event.endedAt;
8491
+ const endedPresent = endedRaw !== void 0 && endedRaw !== null && String(endedRaw).trim() !== "";
8492
+ if (endedPresent) {
8493
+ const ended = parseComparableMs(typeof endedRaw === "string" ? endedRaw : String(endedRaw));
8494
+ if (ended === void 0) return void 0;
8495
+ if (started !== void 0 && ended < started) return void 0;
8496
+ return ended;
8497
+ }
8498
+ if (event.durationMs !== void 0) {
8499
+ if (!Number.isFinite(event.durationMs) || event.durationMs < 0) {
8500
+ return void 0;
8501
+ }
8502
+ if (started !== void 0) {
8503
+ return started + event.durationMs;
8504
+ }
8505
+ return void 0;
8483
8506
  }
8484
8507
  return parseComparableMs(event.timestamp);
8485
8508
  }
@@ -14132,6 +14155,70 @@ function mapOtlpEvents(value, pathPrefix) {
14132
14155
  unsupportedFields
14133
14156
  };
14134
14157
  }
14158
+ function promoteAgentInspectWorkflowIdentity(attributes, pathPrefix) {
14159
+ const warnings = [];
14160
+ const mapping = [
14161
+ ["agent_inspect.operation_id", "operationId", "string"],
14162
+ ["agent_inspect.attempt_id", "attemptId", "string"],
14163
+ ["agent_inspect.retry_of", "retryOf", "string"],
14164
+ ["agent_inspect.attempt_number", "attemptNumber", "int"]
14165
+ ];
14166
+ const metadata = attributes.metadata && typeof attributes.metadata === "object" && !Array.isArray(attributes.metadata) ? { ...attributes.metadata } : {};
14167
+ for (const [dotted, camel, kind] of mapping) {
14168
+ const raw = attributes[dotted];
14169
+ if (raw === void 0 || raw === null) continue;
14170
+ let promoted;
14171
+ if (kind === "int") {
14172
+ const n = typeof raw === "number" ? raw : typeof raw === "string" ? Number(raw) : NaN;
14173
+ if (!Number.isFinite(n) || n < 1) {
14174
+ warnings.push({
14175
+ code: "otlp_identity_invalid",
14176
+ message: `Ignoring invalid ${dotted} identity value.`,
14177
+ severity: "warning",
14178
+ field: `${pathPrefix}.${dotted}`
14179
+ });
14180
+ continue;
14181
+ }
14182
+ promoted = Math.trunc(n);
14183
+ } else if (typeof raw === "string" && raw.trim() !== "") {
14184
+ promoted = raw.trim();
14185
+ } else {
14186
+ warnings.push({
14187
+ code: "otlp_identity_invalid",
14188
+ message: `Ignoring non-string ${dotted} identity value.`,
14189
+ severity: "warning",
14190
+ field: `${pathPrefix}.${dotted}`
14191
+ });
14192
+ continue;
14193
+ }
14194
+ const direct = attributes[camel];
14195
+ const nested = metadata[camel];
14196
+ if (direct !== void 0 && direct !== promoted) {
14197
+ warnings.push({
14198
+ code: "otlp_identity_conflict",
14199
+ message: `Conflicting ${camel}: attributes.${camel} vs ${dotted}; keeping camelCase.`,
14200
+ severity: "warning",
14201
+ field: `${pathPrefix}.${dotted}`
14202
+ });
14203
+ continue;
14204
+ }
14205
+ if (nested !== void 0 && nested !== promoted && direct === void 0) {
14206
+ warnings.push({
14207
+ code: "otlp_identity_conflict",
14208
+ message: `Conflicting ${camel}: attributes.metadata.${camel} vs ${dotted}; keeping nested.`,
14209
+ severity: "warning",
14210
+ field: `${pathPrefix}.${dotted}`
14211
+ });
14212
+ continue;
14213
+ }
14214
+ if (direct === void 0) attributes[camel] = promoted;
14215
+ if (nested === void 0) metadata[camel] = promoted;
14216
+ }
14217
+ if (Object.keys(metadata).length > 0) {
14218
+ attributes.metadata = metadata;
14219
+ }
14220
+ return warnings;
14221
+ }
14135
14222
  function mapOtlpSpan(context) {
14136
14223
  const { span, pathPrefix } = context;
14137
14224
  const warnings = [];
@@ -14163,6 +14250,7 @@ function mapOtlpSpan(context) {
14163
14250
  if (context.scopeVersion !== void 0) {
14164
14251
  attributes["scope.version"] = context.scopeVersion;
14165
14252
  }
14253
+ warnings.push(...promoteAgentInspectWorkflowIdentity(attributes, pathPrefix));
14166
14254
  for (const [key, value] of Object.entries(span)) {
14167
14255
  if (OTLP_SPAN_KEYS.has(key)) continue;
14168
14256
  unsupportedFields.push(`${pathPrefix}.${key}`);
@@ -14200,6 +14288,7 @@ function mapOtlpSpan(context) {
14200
14288
  if (events.events !== void 0) {
14201
14289
  attributes["otlp.events"] = events.events;
14202
14290
  }
14291
+ warnings.push(...promoteAgentInspectWorkflowIdentity(attributes, pathPrefix));
14203
14292
  const traceId = readStringField(span, ["traceId"]) ?? "trace-unknown";
14204
14293
  const spanId = readStringField(span, ["spanId"]) ?? "span-unknown";
14205
14294
  const parentSpanId = readStringField(span, ["parentSpanId"]);
@@ -16864,7 +16953,7 @@ var init_src = __esm({
16864
16953
  });
16865
16954
 
16866
16955
  // package.json
16867
- var version = "6.31.18";
16956
+ var version = "6.31.19";
16868
16957
 
16869
16958
  // packages/cli/src/list.ts
16870
16959
  init_advanced();