agent-inspect 6.31.16 → 6.31.18
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/CHANGELOG.md +12 -0
- package/README.md +1 -1
- package/SECURITY.md +1 -0
- package/docs/COMPARE.md +11 -0
- package/package.json +2 -2
- package/packages/cli/dist/{chunk-ZAYVAHIH.mjs → chunk-AHARYDFO.mjs} +62 -28
- package/packages/cli/dist/chunk-AHARYDFO.mjs.map +1 -0
- package/packages/cli/dist/index.cjs +122 -32
- package/packages/cli/dist/index.cjs.map +1 -1
- package/packages/cli/dist/index.mjs +64 -9
- package/packages/cli/dist/index.mjs.map +1 -1
- package/packages/cli/dist/{src-KP4UIFK5.mjs → src-YNZZ2KYR.mjs} +3 -3
- package/packages/cli/dist/{src-KP4UIFK5.mjs.map → src-YNZZ2KYR.mjs.map} +1 -1
- package/packages/core/dist/advanced.cjs +1 -1
- package/packages/core/dist/advanced.cjs.map +1 -1
- package/packages/core/dist/advanced.mjs +9 -9
- package/packages/core/dist/checks.cjs +59 -25
- package/packages/core/dist/checks.cjs.map +1 -1
- package/packages/core/dist/checks.mjs +3 -3
- package/packages/core/dist/{chunk-SSG3ICI4.mjs → chunk-6C244CAV.mjs} +4 -4
- package/packages/core/dist/{chunk-SSG3ICI4.mjs.map → chunk-6C244CAV.mjs.map} +1 -1
- package/packages/core/dist/{chunk-N5PZAI6Q.mjs → chunk-77UZIMMD.mjs} +3 -3
- package/packages/core/dist/{chunk-N5PZAI6Q.mjs.map → chunk-77UZIMMD.mjs.map} +1 -1
- package/packages/core/dist/{chunk-DK3OW6UI.mjs → chunk-EOXUEQB6.mjs} +3 -3
- package/packages/core/dist/chunk-EOXUEQB6.mjs.map +1 -0
- package/packages/core/dist/{chunk-CCYKNAOD.mjs → chunk-FRBBZUEP.mjs} +62 -28
- package/packages/core/dist/chunk-FRBBZUEP.mjs.map +1 -0
- package/packages/core/dist/{chunk-M3RJD3BP.mjs → chunk-NX25C7JZ.mjs} +3 -3
- package/packages/core/dist/{chunk-M3RJD3BP.mjs.map → chunk-NX25C7JZ.mjs.map} +1 -1
- package/packages/core/dist/exporters.cjs +55 -3
- package/packages/core/dist/exporters.cjs.map +1 -1
- package/packages/core/dist/exporters.mjs +57 -5
- package/packages/core/dist/exporters.mjs.map +1 -1
- package/packages/core/dist/index.cjs +1 -1
- package/packages/core/dist/index.cjs.map +1 -1
- package/packages/core/dist/index.mjs +4 -4
- package/packages/core/dist/writers.cjs +1 -1
- package/packages/core/dist/writers.cjs.map +1 -1
- package/packages/core/dist/writers.mjs +1 -1
- package/packages/cli/dist/chunk-ZAYVAHIH.mjs.map +0 -1
- package/packages/core/dist/chunk-CCYKNAOD.mjs.map +0 -1
- package/packages/core/dist/chunk-DK3OW6UI.mjs.map +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { buildRunWhatSummary, renderRunWhat, renderTimeline, buildRunTimeline } from './chunk-
|
|
2
|
-
import { summarizeObservedOutcomes, extractOutcomesFromTraceEvents, renderObservedOutcomesMarkdown, renderObservedOutcomesHtml } from './chunk-
|
|
1
|
+
import { buildRunWhatSummary, renderRunWhat, renderTimeline, buildRunTimeline } from './chunk-NX25C7JZ.mjs';
|
|
2
|
+
import { summarizeObservedOutcomes, extractOutcomesFromTraceEvents, renderObservedOutcomesMarkdown, renderObservedOutcomesHtml } from './chunk-77UZIMMD.mjs';
|
|
3
3
|
import { escapeHtml, flattenTree, safeString, compactAttributes, stableJson, escapeMarkdown, zeroKinds } from './chunk-CAWPF22J.mjs';
|
|
4
4
|
export { compactAttributes, escapeHtml, escapeMarkdown, flattenTree, safeString, stableJson, summarizeTree } from './chunk-CAWPF22J.mjs';
|
|
5
|
-
import { resolveRedactionProfile, applyProfileMetadataCaps, truncateStringForProfile, stringContainsHighConfidenceCredential } from './chunk-
|
|
5
|
+
import { resolveRedactionProfile, applyProfileMetadataCaps, truncateStringForProfile, stringContainsHighConfidenceCredential } from './chunk-EOXUEQB6.mjs';
|
|
6
6
|
import { Redactor, DEFAULT_REDACT_KEYS, isCredentialSensitiveKey } from './chunk-VLVCLAPB.mjs';
|
|
7
7
|
import './chunk-7DHSWDKB.mjs';
|
|
8
8
|
import './chunk-EE5Z2GQ3.mjs';
|
|
@@ -853,6 +853,51 @@ function genAiOperationName(kind) {
|
|
|
853
853
|
return void 0;
|
|
854
854
|
}
|
|
855
855
|
}
|
|
856
|
+
var STRUCTURAL_IDENTITY_KEYS = [
|
|
857
|
+
"operationId",
|
|
858
|
+
"attemptId",
|
|
859
|
+
"retryOf",
|
|
860
|
+
"attemptNumber",
|
|
861
|
+
"attempt"
|
|
862
|
+
];
|
|
863
|
+
function pickBoundedIdentityString(bag, key, maxLen) {
|
|
864
|
+
if (!bag || typeof bag !== "object") return void 0;
|
|
865
|
+
const direct = bag[key];
|
|
866
|
+
if (typeof direct === "string" && direct.trim() !== "") {
|
|
867
|
+
return direct.trim().slice(0, maxLen);
|
|
868
|
+
}
|
|
869
|
+
const nested = bag.metadata && typeof bag.metadata === "object" ? bag.metadata[key] : void 0;
|
|
870
|
+
if (typeof nested === "string" && nested.trim() !== "") {
|
|
871
|
+
return nested.trim().slice(0, maxLen);
|
|
872
|
+
}
|
|
873
|
+
return void 0;
|
|
874
|
+
}
|
|
875
|
+
function pickBoundedIdentityNumber(bag, key) {
|
|
876
|
+
if (!bag || typeof bag !== "object") return void 0;
|
|
877
|
+
const direct = bag[key];
|
|
878
|
+
if (typeof direct === "number" && Number.isFinite(direct)) return direct;
|
|
879
|
+
const nested = bag.metadata && typeof bag.metadata === "object" ? bag.metadata[key] : void 0;
|
|
880
|
+
if (typeof nested === "number" && Number.isFinite(nested)) return nested;
|
|
881
|
+
return void 0;
|
|
882
|
+
}
|
|
883
|
+
function appendStructuralIdentityAttrs(attrs, meta, maxLen) {
|
|
884
|
+
const operationId = pickBoundedIdentityString(meta, "operationId", maxLen);
|
|
885
|
+
if (operationId !== void 0) {
|
|
886
|
+
attrs.push(stringAttr("agent_inspect.operation_id", operationId));
|
|
887
|
+
}
|
|
888
|
+
const attemptId = pickBoundedIdentityString(meta, "attemptId", maxLen);
|
|
889
|
+
if (attemptId !== void 0) {
|
|
890
|
+
attrs.push(stringAttr("agent_inspect.attempt_id", attemptId));
|
|
891
|
+
}
|
|
892
|
+
const retryOf = pickBoundedIdentityString(meta, "retryOf", maxLen);
|
|
893
|
+
if (retryOf !== void 0) {
|
|
894
|
+
attrs.push(stringAttr("agent_inspect.retry_of", retryOf));
|
|
895
|
+
}
|
|
896
|
+
const attemptNumber = pickBoundedIdentityNumber(meta, "attemptNumber") ?? pickBoundedIdentityNumber(meta, "attempt");
|
|
897
|
+
if (attemptNumber !== void 0) {
|
|
898
|
+
attrs.push(intAttr("agent_inspect.attempt_number", attemptNumber));
|
|
899
|
+
}
|
|
900
|
+
}
|
|
856
901
|
function resolveSpanTimes(ev) {
|
|
857
902
|
const startedAtMs = typeof ev.attributes?.startedAtMs === "number" && Number.isFinite(ev.attributes.startedAtMs) ? ev.attributes.startedAtMs : void 0;
|
|
858
903
|
const endedAtMs = typeof ev.attributes?.endedAtMs === "number" && Number.isFinite(ev.attributes.endedAtMs) ? ev.attributes.endedAtMs : void 0;
|
|
@@ -873,7 +918,8 @@ function exportOtlpJson(tree, options) {
|
|
|
873
918
|
const warnings = [
|
|
874
919
|
"OTLP JSON export uses OTel GenAI-aligned attributes where applicable; experimental until verified against specific collectors.",
|
|
875
920
|
"Not OTLP gRPC/protobuf \u2014 JSON mapping only. Generated locally; no network upload.",
|
|
876
|
-
"Status and span kind use OTLP numeric enums (StatusCode 0/1/2, SpanKind INTERNAL=1)."
|
|
921
|
+
"Status and span kind use OTLP numeric enums (StatusCode 0/1/2, SpanKind INTERNAL=1).",
|
|
922
|
+
"When present on source events, operationId/attemptId/retryOf/attemptNumber are emitted as bounded agent_inspect.* identity attributes (not a broad attribute dump)."
|
|
877
923
|
];
|
|
878
924
|
const traceId = hexFrom2(`trace:${tree.runId}`, 16);
|
|
879
925
|
const includeAttributes = options?.includeAttributes ?? false;
|
|
@@ -921,6 +967,11 @@ function exportOtlpJson(tree, options) {
|
|
|
921
967
|
if (typeof inp === "number") attrs.push(intAttr("gen_ai.usage.input_tokens", inp));
|
|
922
968
|
if (typeof outp === "number") attrs.push(intAttr("gen_ai.usage.output_tokens", outp));
|
|
923
969
|
}
|
|
970
|
+
appendStructuralIdentityAttrs(
|
|
971
|
+
attrs,
|
|
972
|
+
meta && typeof meta === "object" ? meta : void 0,
|
|
973
|
+
maxLen
|
|
974
|
+
);
|
|
924
975
|
if (includeAttributes && meta && typeof meta === "object") {
|
|
925
976
|
const skipKeys = /* @__PURE__ */ new Set([
|
|
926
977
|
"tokens",
|
|
@@ -929,7 +980,8 @@ function exportOtlpJson(tree, options) {
|
|
|
929
980
|
"responseModel",
|
|
930
981
|
"responseModelId",
|
|
931
982
|
"provider",
|
|
932
|
-
"originalSourceType"
|
|
983
|
+
"originalSourceType",
|
|
984
|
+
...STRUCTURAL_IDENTITY_KEYS
|
|
933
985
|
]);
|
|
934
986
|
for (const [k, v] of Object.entries(meta)) {
|
|
935
987
|
if (skipKeys.has(k)) continue;
|