agent-inspect 6.31.12 → 6.31.13
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 +6 -0
- package/README.md +1 -1
- package/package.json +1 -1
- package/packages/cli/dist/{chunk-GBAGZVUX.mjs → chunk-ZAYVAHIH.mjs} +82 -13
- package/packages/cli/dist/chunk-ZAYVAHIH.mjs.map +1 -0
- package/packages/cli/dist/index.cjs +286 -44
- package/packages/cli/dist/index.cjs.map +1 -1
- package/packages/cli/dist/index.mjs +209 -36
- package/packages/cli/dist/index.mjs.map +1 -1
- package/packages/cli/dist/{src-F44EQY4S.mjs → src-KP4UIFK5.mjs} +3 -3
- package/packages/cli/dist/{src-F44EQY4S.mjs.map → src-KP4UIFK5.mjs.map} +1 -1
- package/packages/core/dist/advanced.cjs +80 -11
- package/packages/core/dist/advanced.cjs.map +1 -1
- package/packages/core/dist/advanced.mjs +27 -7
- package/packages/core/dist/advanced.mjs.map +1 -1
- package/packages/core/dist/{chunk-OAUNS5CS.mjs → chunk-JE3TUFAQ.mjs} +3 -3
- package/packages/core/dist/{chunk-OAUNS5CS.mjs.map → chunk-JE3TUFAQ.mjs.map} +1 -1
- package/packages/core/dist/{chunk-QOC3PJO3.mjs → chunk-NJUSSJX3.mjs} +3 -3
- package/packages/core/dist/{chunk-QOC3PJO3.mjs.map → chunk-NJUSSJX3.mjs.map} +1 -1
- package/packages/core/dist/{chunk-AK5EN4U2.mjs → chunk-YU6XT5A2.mjs} +58 -9
- package/packages/core/dist/chunk-YU6XT5A2.mjs.map +1 -0
- package/packages/core/dist/exporters.cjs +205 -32
- package/packages/core/dist/exporters.cjs.map +1 -1
- package/packages/core/dist/exporters.mjs +205 -32
- package/packages/core/dist/exporters.mjs.map +1 -1
- package/packages/core/dist/logs.cjs +56 -7
- package/packages/core/dist/logs.cjs.map +1 -1
- package/packages/core/dist/logs.mjs +2 -2
- package/packages/core/dist/persisted.cjs +56 -7
- package/packages/core/dist/persisted.cjs.map +1 -1
- package/packages/core/dist/persisted.mjs +3 -3
- package/packages/core/dist/readers.cjs +56 -7
- package/packages/core/dist/readers.cjs.map +1 -1
- package/packages/core/dist/readers.mjs +3 -3
- package/packages/cli/dist/chunk-GBAGZVUX.mjs.map +0 -1
- package/packages/core/dist/chunk-AK5EN4U2.mjs.map +0 -1
|
@@ -996,7 +996,14 @@ function exportOtlpJson(tree, options) {
|
|
|
996
996
|
|
|
997
997
|
// packages/core/src/exporters/validation.ts
|
|
998
998
|
var EXPERIMENTAL = "Experimental compatibility export \u2014 verify against your target tooling before relying on it.";
|
|
999
|
+
var UINT64_MAX = 18446744073709551615n;
|
|
1000
|
+
var INT64_MIN = -9223372036854775808n;
|
|
1001
|
+
var INT64_MAX = 9223372036854775807n;
|
|
1002
|
+
var MAX_ANYVALUE_DEPTH = 8;
|
|
1003
|
+
var MAX_ANYVALUE_ELEMENTS = 256;
|
|
1004
|
+
var MAX_DIAGNOSTIC_ERRORS = 64;
|
|
999
1005
|
function pushPath(errors, path, message) {
|
|
1006
|
+
if (errors.length >= MAX_DIAGNOSTIC_ERRORS) return;
|
|
1000
1007
|
errors.push(`${path}: ${message}`);
|
|
1001
1008
|
}
|
|
1002
1009
|
function isRecord2(value) {
|
|
@@ -1005,7 +1012,59 @@ function isRecord2(value) {
|
|
|
1005
1012
|
function isHexId(value, byteLen) {
|
|
1006
1013
|
return typeof value === "string" && new RegExp(`^[0-9a-fA-F]{${byteLen * 2}}$`).test(value);
|
|
1007
1014
|
}
|
|
1008
|
-
function
|
|
1015
|
+
function parseDecimalIntegerString(value) {
|
|
1016
|
+
if (typeof value !== "string" || !/^-?\d+$/.test(value)) {
|
|
1017
|
+
return { ok: false, reason: "must be a decimal integer string" };
|
|
1018
|
+
}
|
|
1019
|
+
try {
|
|
1020
|
+
return { ok: true, n: BigInt(value) };
|
|
1021
|
+
} catch {
|
|
1022
|
+
return { ok: false, reason: "out of integer range" };
|
|
1023
|
+
}
|
|
1024
|
+
}
|
|
1025
|
+
function validateUint64String(errors, path, value, label) {
|
|
1026
|
+
const parsed = parseDecimalIntegerString(value);
|
|
1027
|
+
if (!parsed.ok) {
|
|
1028
|
+
pushPath(errors, path, `${label} ${parsed.reason}`);
|
|
1029
|
+
return;
|
|
1030
|
+
}
|
|
1031
|
+
if (parsed.n < 0n || parsed.n > UINT64_MAX) {
|
|
1032
|
+
pushPath(
|
|
1033
|
+
errors,
|
|
1034
|
+
path,
|
|
1035
|
+
`${label} must be an unsigned 64-bit integer (0..${UINT64_MAX.toString()})`
|
|
1036
|
+
);
|
|
1037
|
+
}
|
|
1038
|
+
}
|
|
1039
|
+
function validateInt64String(errors, path, value) {
|
|
1040
|
+
const parsed = parseDecimalIntegerString(value);
|
|
1041
|
+
if (!parsed.ok) {
|
|
1042
|
+
pushPath(errors, path, parsed.reason);
|
|
1043
|
+
return;
|
|
1044
|
+
}
|
|
1045
|
+
if (parsed.n < INT64_MIN || parsed.n > INT64_MAX) {
|
|
1046
|
+
pushPath(
|
|
1047
|
+
errors,
|
|
1048
|
+
path,
|
|
1049
|
+
`must be a signed 64-bit integer (${INT64_MIN.toString()}..${INT64_MAX.toString()})`
|
|
1050
|
+
);
|
|
1051
|
+
}
|
|
1052
|
+
}
|
|
1053
|
+
function validateAnyValue(errors, path, value, depth = 0, counters = { elements: 0 }) {
|
|
1054
|
+
if (errors.length >= MAX_DIAGNOSTIC_ERRORS) return;
|
|
1055
|
+
if (depth > MAX_ANYVALUE_DEPTH) {
|
|
1056
|
+
pushPath(errors, path, `AnyValue nesting exceeds depth ${MAX_ANYVALUE_DEPTH}`);
|
|
1057
|
+
return;
|
|
1058
|
+
}
|
|
1059
|
+
counters.elements += 1;
|
|
1060
|
+
if (counters.elements > MAX_ANYVALUE_ELEMENTS) {
|
|
1061
|
+
pushPath(
|
|
1062
|
+
errors,
|
|
1063
|
+
path,
|
|
1064
|
+
`AnyValue element count exceeds ${MAX_ANYVALUE_ELEMENTS}`
|
|
1065
|
+
);
|
|
1066
|
+
return;
|
|
1067
|
+
}
|
|
1009
1068
|
if (!isRecord2(value)) {
|
|
1010
1069
|
pushPath(errors, path, "must be an AnyValue object");
|
|
1011
1070
|
return;
|
|
@@ -1025,12 +1084,98 @@ function validateAnyValue(errors, path, value) {
|
|
|
1025
1084
|
path,
|
|
1026
1085
|
`AnyValue must set exactly one variant (found ${variants.length}: ${variants.join(",")})`
|
|
1027
1086
|
);
|
|
1087
|
+
return;
|
|
1028
1088
|
}
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1089
|
+
const arm = variants[0];
|
|
1090
|
+
switch (arm) {
|
|
1091
|
+
case "stringValue":
|
|
1092
|
+
if (typeof value.stringValue !== "string") {
|
|
1093
|
+
pushPath(errors, `${path}.stringValue`, "must be a string");
|
|
1094
|
+
}
|
|
1095
|
+
break;
|
|
1096
|
+
case "boolValue":
|
|
1097
|
+
if (typeof value.boolValue !== "boolean") {
|
|
1098
|
+
pushPath(errors, `${path}.boolValue`, "must be a boolean");
|
|
1099
|
+
}
|
|
1100
|
+
break;
|
|
1101
|
+
case "intValue":
|
|
1102
|
+
validateInt64String(errors, `${path}.intValue`, value.intValue);
|
|
1103
|
+
break;
|
|
1104
|
+
case "doubleValue":
|
|
1105
|
+
if (typeof value.doubleValue !== "number" || !Number.isFinite(value.doubleValue)) {
|
|
1106
|
+
pushPath(errors, `${path}.doubleValue`, "must be a finite number");
|
|
1107
|
+
}
|
|
1108
|
+
break;
|
|
1109
|
+
case "bytesValue":
|
|
1110
|
+
if (typeof value.bytesValue !== "string") {
|
|
1111
|
+
pushPath(errors, `${path}.bytesValue`, "must be a base64 string");
|
|
1112
|
+
}
|
|
1113
|
+
break;
|
|
1114
|
+
case "arrayValue": {
|
|
1115
|
+
if (!isRecord2(value.arrayValue)) {
|
|
1116
|
+
pushPath(errors, `${path}.arrayValue`, "must be an object");
|
|
1117
|
+
break;
|
|
1118
|
+
}
|
|
1119
|
+
const values = value.arrayValue.values;
|
|
1120
|
+
if (values === void 0) break;
|
|
1121
|
+
if (!Array.isArray(values)) {
|
|
1122
|
+
pushPath(errors, `${path}.arrayValue.values`, "must be an array");
|
|
1123
|
+
break;
|
|
1124
|
+
}
|
|
1125
|
+
values.forEach((item, i) => {
|
|
1126
|
+
validateAnyValue(
|
|
1127
|
+
errors,
|
|
1128
|
+
`${path}.arrayValue.values[${i}]`,
|
|
1129
|
+
item,
|
|
1130
|
+
depth + 1,
|
|
1131
|
+
counters
|
|
1132
|
+
);
|
|
1133
|
+
});
|
|
1134
|
+
break;
|
|
1032
1135
|
}
|
|
1136
|
+
case "kvlistValue": {
|
|
1137
|
+
if (!isRecord2(value.kvlistValue)) {
|
|
1138
|
+
pushPath(errors, `${path}.kvlistValue`, "must be an object");
|
|
1139
|
+
break;
|
|
1140
|
+
}
|
|
1141
|
+
const values = value.kvlistValue.values;
|
|
1142
|
+
if (values === void 0) break;
|
|
1143
|
+
if (!Array.isArray(values)) {
|
|
1144
|
+
pushPath(errors, `${path}.kvlistValue.values`, "must be an array");
|
|
1145
|
+
break;
|
|
1146
|
+
}
|
|
1147
|
+
values.forEach((item, i) => {
|
|
1148
|
+
const itemPath = `${path}.kvlistValue.values[${i}]`;
|
|
1149
|
+
if (!isRecord2(item)) {
|
|
1150
|
+
pushPath(errors, itemPath, "must be a KeyValue object");
|
|
1151
|
+
return;
|
|
1152
|
+
}
|
|
1153
|
+
if (typeof item.key !== "string") {
|
|
1154
|
+
pushPath(errors, `${itemPath}.key`, "must be a string");
|
|
1155
|
+
}
|
|
1156
|
+
validateAnyValue(errors, `${itemPath}.value`, item.value, depth + 1, counters);
|
|
1157
|
+
});
|
|
1158
|
+
break;
|
|
1159
|
+
}
|
|
1160
|
+
}
|
|
1161
|
+
}
|
|
1162
|
+
function validateKeyValueList(errors, path, attrs) {
|
|
1163
|
+
if (attrs === void 0) return;
|
|
1164
|
+
if (!Array.isArray(attrs)) {
|
|
1165
|
+
pushPath(errors, path, "must be an array");
|
|
1166
|
+
return;
|
|
1033
1167
|
}
|
|
1168
|
+
attrs.forEach((attr, ai) => {
|
|
1169
|
+
const attrPath = `${path}[${ai}]`;
|
|
1170
|
+
if (!isRecord2(attr)) {
|
|
1171
|
+
pushPath(errors, attrPath, "must be an object");
|
|
1172
|
+
return;
|
|
1173
|
+
}
|
|
1174
|
+
if (typeof attr.key !== "string") {
|
|
1175
|
+
pushPath(errors, `${attrPath}.key`, "must be a string");
|
|
1176
|
+
}
|
|
1177
|
+
validateAnyValue(errors, `${attrPath}.value`, attr.value);
|
|
1178
|
+
});
|
|
1034
1179
|
}
|
|
1035
1180
|
function validateOtlpJson(content) {
|
|
1036
1181
|
const errors = [];
|
|
@@ -1060,6 +1205,13 @@ function validateOtlpJson(content) {
|
|
|
1060
1205
|
pushPath(errors, rsPath, "must be an object");
|
|
1061
1206
|
return;
|
|
1062
1207
|
}
|
|
1208
|
+
if (isRecord2(resourceSpan.resource)) {
|
|
1209
|
+
validateKeyValueList(
|
|
1210
|
+
errors,
|
|
1211
|
+
`${rsPath}.resource.attributes`,
|
|
1212
|
+
resourceSpan.resource.attributes
|
|
1213
|
+
);
|
|
1214
|
+
}
|
|
1063
1215
|
if (!Array.isArray(resourceSpan.scopeSpans)) {
|
|
1064
1216
|
pushPath(errors, `${rsPath}.scopeSpans`, "must be an array");
|
|
1065
1217
|
return;
|
|
@@ -1070,6 +1222,13 @@ function validateOtlpJson(content) {
|
|
|
1070
1222
|
pushPath(errors, ssPath, "must be an object");
|
|
1071
1223
|
return;
|
|
1072
1224
|
}
|
|
1225
|
+
if (isRecord2(scopeSpan.scope)) {
|
|
1226
|
+
validateKeyValueList(
|
|
1227
|
+
errors,
|
|
1228
|
+
`${ssPath}.scope.attributes`,
|
|
1229
|
+
scopeSpan.scope.attributes
|
|
1230
|
+
);
|
|
1231
|
+
}
|
|
1073
1232
|
if (!Array.isArray(scopeSpan.spans)) {
|
|
1074
1233
|
pushPath(errors, `${ssPath}.spans`, "must be an array");
|
|
1075
1234
|
return;
|
|
@@ -1104,44 +1263,58 @@ function validateOtlpJson(content) {
|
|
|
1104
1263
|
if (typeof span.name !== "string") {
|
|
1105
1264
|
pushPath(errors, `${spanPath}.name`, "must be a string");
|
|
1106
1265
|
}
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
pushPath(
|
|
1266
|
+
validateUint64String(
|
|
1267
|
+
errors,
|
|
1268
|
+
`${spanPath}.startTimeUnixNano`,
|
|
1269
|
+
span.startTimeUnixNano,
|
|
1270
|
+
"startTimeUnixNano"
|
|
1271
|
+
);
|
|
1272
|
+
if (span.endTimeUnixNano !== void 0) {
|
|
1273
|
+
validateUint64String(
|
|
1116
1274
|
errors,
|
|
1117
1275
|
`${spanPath}.endTimeUnixNano`,
|
|
1118
|
-
|
|
1276
|
+
span.endTimeUnixNano,
|
|
1277
|
+
"endTimeUnixNano"
|
|
1119
1278
|
);
|
|
1120
1279
|
}
|
|
1121
|
-
if (typeof span.startTimeUnixNano === "string" &&
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1280
|
+
if (typeof span.startTimeUnixNano === "string" && typeof span.endTimeUnixNano === "string") {
|
|
1281
|
+
const start = parseDecimalIntegerString(span.startTimeUnixNano);
|
|
1282
|
+
const end = parseDecimalIntegerString(span.endTimeUnixNano);
|
|
1283
|
+
if (start.ok && end.ok && end.n < start.n) {
|
|
1284
|
+
pushPath(
|
|
1285
|
+
errors,
|
|
1286
|
+
`${spanPath}.endTimeUnixNano`,
|
|
1287
|
+
"must be >= startTimeUnixNano"
|
|
1288
|
+
);
|
|
1289
|
+
}
|
|
1290
|
+
}
|
|
1291
|
+
validateKeyValueList(errors, `${spanPath}.attributes`, span.attributes);
|
|
1292
|
+
if (Array.isArray(span.events)) {
|
|
1293
|
+
span.events.forEach((event, ei) => {
|
|
1294
|
+
const eventPath = `${spanPath}.events[${ei}]`;
|
|
1295
|
+
if (!isRecord2(event)) {
|
|
1296
|
+
pushPath(errors, eventPath, "must be an object");
|
|
1297
|
+
return;
|
|
1298
|
+
}
|
|
1299
|
+
if (event.timeUnixNano !== void 0) {
|
|
1300
|
+
validateUint64String(
|
|
1125
1301
|
errors,
|
|
1126
|
-
`${
|
|
1127
|
-
|
|
1302
|
+
`${eventPath}.timeUnixNano`,
|
|
1303
|
+
event.timeUnixNano,
|
|
1304
|
+
"timeUnixNano"
|
|
1128
1305
|
);
|
|
1129
1306
|
}
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
}
|
|
1307
|
+
validateKeyValueList(errors, `${eventPath}.attributes`, event.attributes);
|
|
1308
|
+
});
|
|
1133
1309
|
}
|
|
1134
|
-
if (Array.isArray(span.
|
|
1135
|
-
span.
|
|
1136
|
-
const
|
|
1137
|
-
if (!isRecord2(
|
|
1138
|
-
pushPath(errors,
|
|
1310
|
+
if (Array.isArray(span.links)) {
|
|
1311
|
+
span.links.forEach((link, li) => {
|
|
1312
|
+
const linkPath = `${spanPath}.links[${li}]`;
|
|
1313
|
+
if (!isRecord2(link)) {
|
|
1314
|
+
pushPath(errors, linkPath, "must be an object");
|
|
1139
1315
|
return;
|
|
1140
1316
|
}
|
|
1141
|
-
|
|
1142
|
-
pushPath(errors, `${attrPath}.key`, "must be a string");
|
|
1143
|
-
}
|
|
1144
|
-
validateAnyValue(errors, `${attrPath}.value`, attr.value);
|
|
1317
|
+
validateKeyValueList(errors, `${linkPath}.attributes`, link.attributes);
|
|
1145
1318
|
});
|
|
1146
1319
|
}
|
|
1147
1320
|
if (typeof span.kind === "number") {
|