deepline 0.1.222 → 0.1.224
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/bundling-sources/apps/play-runner-workers/src/coordinator-entry.ts +396 -176
- package/dist/bundling-sources/apps/play-runner-workers/src/dedup-do.ts +6 -3
- package/dist/bundling-sources/apps/play-runner-workers/src/entry.ts +210 -105
- package/dist/bundling-sources/sdk/src/release.ts +2 -2
- package/dist/bundling-sources/shared_libs/observability/node-tracing.ts +125 -0
- package/dist/bundling-sources/shared_libs/observability/redaction.ts +94 -0
- package/dist/bundling-sources/shared_libs/observability/telemetry.ts +414 -0
- package/dist/bundling-sources/shared_libs/observability/tracing.ts +93 -0
- package/dist/bundling-sources/shared_libs/observability/worker-telemetry.ts +119 -0
- package/dist/bundling-sources/shared_libs/play-runtime/secret-redaction.ts +32 -14
- package/dist/cli/index.js +220 -164
- package/dist/cli/index.mjs +220 -164
- package/dist/index.js +72 -56
- package/dist/index.mjs +72 -56
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -354,10 +354,10 @@ var SDK_RELEASE = {
|
|
|
354
354
|
// 0.1.175 ships loud `deepline enrich` empty-waterfall reporting.
|
|
355
355
|
// 0.1.220 deprecates SDK CLI versions below 0.1.219 and updates them
|
|
356
356
|
// automatically without blocking their current command.
|
|
357
|
-
version: "0.1.
|
|
357
|
+
version: "0.1.224",
|
|
358
358
|
apiContract: "2026-06-dataset-handle-results-hard-cutover",
|
|
359
359
|
supportPolicy: {
|
|
360
|
-
latest: "0.1.
|
|
360
|
+
latest: "0.1.224",
|
|
361
361
|
minimumSupported: "0.1.53",
|
|
362
362
|
deprecatedBelow: "0.1.219",
|
|
363
363
|
commandMinimumSupported: [
|
|
@@ -1093,29 +1093,42 @@ function normalizePlayRunLedgerTerminalSource(value) {
|
|
|
1093
1093
|
// ../shared_libs/play-runtime/secret-redaction.ts
|
|
1094
1094
|
var SECRET_REDACTION_PLACEHOLDER = "[REDACTED_SECRET]";
|
|
1095
1095
|
var BEARER_TOKEN_RE = /\bBearer\s+[A-Za-z0-9._~+/=-]{12,}\b/g;
|
|
1096
|
-
var
|
|
1096
|
+
var BASIC_CREDENTIAL_RE = /\bBasic\s+[A-Za-z0-9+/]{4,}={0,2}\b/g;
|
|
1097
|
+
var JWT_RE = /\b[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{1,}\.[A-Za-z0-9_-]{8,}\b/g;
|
|
1097
1098
|
var PRIVATE_KEY_RE = /-----BEGIN [A-Z0-9 ]*PRIVATE KEY-----[\s\S]*?-----END [A-Z0-9 ]*PRIVATE KEY-----/g;
|
|
1098
|
-
var
|
|
1099
|
+
var SENSITIVE_FIELD_NAME = "authorization|cookie|password|(?:client[_-]?)?secret|(?:access|refresh)[_-]?token|(?:x[_-]?)?api[_-]?key|private[_-]?key|token|credentials";
|
|
1100
|
+
var COMMON_SECRET_RE = /\b(?:[prs]k_(?:live|test)_|(?:pat|ghp|github_pat)_|xox[baprs]-)[A-Za-z0-9_./+=:-]{12,}\b/gi;
|
|
1099
1101
|
var GENERIC_PREFIXED_SECRET_RE = /\b(?:key|token|secret|api[_-]?key)_[A-Za-z0-9_./+=:-]{12,}\b/gi;
|
|
1100
|
-
var URL_SECRET_VALUE_RE = /\b(?:
|
|
1102
|
+
var URL_SECRET_VALUE_RE = /\b(?:[spr]k|pat|ghp|github_pat|xox)[A-Za-z0-9_./+=:-]{12,}\b/i;
|
|
1101
1103
|
var GENERIC_SECRET_ASSIGNMENT_RE = /\b(?:api[_-]?key|token|secret|password)\b\s*[:=]\s*["']?[^"',\s]{12,}["']?/gi;
|
|
1102
|
-
var HIGH_ENTROPY_ASSIGNMENT_RE = /\b(?:api[_-]?key|token|secret|password|authorization|access
|
|
1104
|
+
var HIGH_ENTROPY_ASSIGNMENT_RE = /\b(?:api[_-]?key|token|secret|password|authorization|(?:access|refresh)[_-]?token)\b\s*[:=]\s*["']?[^"',\s]{16,}["']?/gi;
|
|
1103
1105
|
var SENSITIVE_URL_PARAM_RE = /[?#&](?:\w*(?:key|token)|secret|password|authorization|credential|signature|sig)(?:=|$)/i;
|
|
1106
|
+
var SENSITIVE_FIELD_NAME_RE = new RegExp(
|
|
1107
|
+
`(^|[._-])(?:${SENSITIVE_FIELD_NAME})$`,
|
|
1108
|
+
"i"
|
|
1109
|
+
);
|
|
1110
|
+
var SERIALIZED_SECRET_FIELD_RE = new RegExp(
|
|
1111
|
+
`"(${SENSITIVE_FIELD_NAME})"\\s*:\\s*(?:"[^"\\\\]*"|\\{[^{}]*\\})`,
|
|
1112
|
+
"gi"
|
|
1113
|
+
);
|
|
1104
1114
|
function escapeRegExp(value) {
|
|
1105
1115
|
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
1106
1116
|
}
|
|
1107
|
-
function isRecord(value) {
|
|
1108
|
-
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
1109
|
-
}
|
|
1110
1117
|
function redactSecretLikeString(value) {
|
|
1111
|
-
const
|
|
1118
|
+
const serializedRedacted = value.replace(
|
|
1119
|
+
SERIALIZED_SECRET_FIELD_RE,
|
|
1120
|
+
`"$1":"${SECRET_REDACTION_PLACEHOLDER}"`
|
|
1121
|
+
);
|
|
1122
|
+
const trimmed = serializedRedacted.trim();
|
|
1112
1123
|
if (/^https?:\/\/\S+$/i.test(trimmed)) {
|
|
1113
1124
|
if (/^https?:\/\/[^/?#@]+@/i.test(trimmed) || SENSITIVE_URL_PARAM_RE.test(trimmed)) {
|
|
1114
1125
|
return SECRET_REDACTION_PLACEHOLDER;
|
|
1115
1126
|
}
|
|
1116
|
-
if (!URL_SECRET_VALUE_RE.test(
|
|
1127
|
+
if (!URL_SECRET_VALUE_RE.test(serializedRedacted)) {
|
|
1128
|
+
return serializedRedacted;
|
|
1129
|
+
}
|
|
1117
1130
|
}
|
|
1118
|
-
return
|
|
1131
|
+
return serializedRedacted.replace(PRIVATE_KEY_RE, SECRET_REDACTION_PLACEHOLDER).replace(BEARER_TOKEN_RE, `Bearer ${SECRET_REDACTION_PLACEHOLDER}`).replace(BASIC_CREDENTIAL_RE, `Basic ${SECRET_REDACTION_PLACEHOLDER}`).replace(JWT_RE, SECRET_REDACTION_PLACEHOLDER).replace(COMMON_SECRET_RE, SECRET_REDACTION_PLACEHOLDER).replace(GENERIC_PREFIXED_SECRET_RE, SECRET_REDACTION_PLACEHOLDER).replace(GENERIC_SECRET_ASSIGNMENT_RE, SECRET_REDACTION_PLACEHOLDER).replace(HIGH_ENTROPY_ASSIGNMENT_RE, (match) => {
|
|
1119
1132
|
const separator = match.includes("=") ? "=" : ":";
|
|
1120
1133
|
const [key] = match.split(separator, 1);
|
|
1121
1134
|
return `${key.trim()}${separator}${SECRET_REDACTION_PLACEHOLDER}`;
|
|
@@ -1150,9 +1163,12 @@ function createSecretRedactionContext(initialValues = []) {
|
|
|
1150
1163
|
function redact(value) {
|
|
1151
1164
|
if (typeof value === "string") return redactString(value);
|
|
1152
1165
|
if (Array.isArray(value)) return value.map((entry) => redact(entry));
|
|
1153
|
-
if (
|
|
1166
|
+
if (value && typeof value === "object") {
|
|
1154
1167
|
return Object.fromEntries(
|
|
1155
|
-
Object.entries(value).map(([key, entry]) => [
|
|
1168
|
+
Object.entries(value).map(([key, entry]) => [
|
|
1169
|
+
key,
|
|
1170
|
+
SENSITIVE_FIELD_NAME_RE.test(key) ? SECRET_REDACTION_PLACEHOLDER : redact(entry)
|
|
1171
|
+
])
|
|
1156
1172
|
);
|
|
1157
1173
|
}
|
|
1158
1174
|
return value;
|
|
@@ -1176,7 +1192,7 @@ var ledgerIngressRedactor = createSecretRedactionContext();
|
|
|
1176
1192
|
|
|
1177
1193
|
// ../shared_libs/play-runtime/run-ledger.ts
|
|
1178
1194
|
var LOG_TAIL_LIMIT = 100;
|
|
1179
|
-
function
|
|
1195
|
+
function isRecord(value) {
|
|
1180
1196
|
return Boolean(value && typeof value === "object" && !Array.isArray(value));
|
|
1181
1197
|
}
|
|
1182
1198
|
function finiteNumber(value) {
|
|
@@ -1269,21 +1285,21 @@ function createEmptyPlayRunLedgerSnapshot(input) {
|
|
|
1269
1285
|
};
|
|
1270
1286
|
}
|
|
1271
1287
|
function normalizePlayRunLedgerSnapshot(value, fallback) {
|
|
1272
|
-
if (!
|
|
1288
|
+
if (!isRecord(value)) {
|
|
1273
1289
|
return createEmptyPlayRunLedgerSnapshot(fallback);
|
|
1274
1290
|
}
|
|
1275
1291
|
const orderedStepIds = Array.isArray(value.orderedStepIds) ? value.orderedStepIds.filter(
|
|
1276
1292
|
(entry) => typeof entry === "string" && Boolean(entry.trim())
|
|
1277
1293
|
) : [];
|
|
1278
|
-
const rawSteps =
|
|
1294
|
+
const rawSteps = isRecord(value.stepsById) ? value.stepsById : {};
|
|
1279
1295
|
const stepsById = {};
|
|
1280
1296
|
for (const [stepId, rawStep] of Object.entries(rawSteps)) {
|
|
1281
|
-
if (!stepId.trim() || !
|
|
1297
|
+
if (!stepId.trim() || !isRecord(rawStep)) continue;
|
|
1282
1298
|
const rawStatus = normalizeStepStatus(rawStep.status);
|
|
1283
1299
|
if (!rawStatus) continue;
|
|
1284
1300
|
const completedAt = finiteNumber(rawStep.completedAt);
|
|
1285
1301
|
const status = rawStatus === "running" && completedAt !== null ? "completed" : rawStatus;
|
|
1286
|
-
const rawProgress =
|
|
1302
|
+
const rawProgress = isRecord(rawStep.progress) ? rawStep.progress : null;
|
|
1287
1303
|
stepsById[stepId] = {
|
|
1288
1304
|
stepId,
|
|
1289
1305
|
label: optionalString(rawStep.label),
|
|
@@ -1298,10 +1314,10 @@ function normalizePlayRunLedgerSnapshot(value, fallback) {
|
|
|
1298
1314
|
progress: rawProgress ? normalizeStepProgress(rawProgress) : null
|
|
1299
1315
|
};
|
|
1300
1316
|
}
|
|
1301
|
-
const rawDatasets =
|
|
1317
|
+
const rawDatasets = isRecord(value.datasetsById) ? value.datasetsById : {};
|
|
1302
1318
|
const datasetsById = {};
|
|
1303
1319
|
for (const [datasetId, rawDataset] of Object.entries(rawDatasets)) {
|
|
1304
|
-
if (!datasetId.trim() || !
|
|
1320
|
+
if (!datasetId.trim() || !isRecord(rawDataset)) continue;
|
|
1305
1321
|
const phase = rawDataset.phase === "available" || rawDataset.phase === "failed" ? rawDataset.phase : "registered";
|
|
1306
1322
|
datasetsById[datasetId] = {
|
|
1307
1323
|
datasetId,
|
|
@@ -1432,18 +1448,18 @@ function normalizePlayRunLiveStatus(value) {
|
|
|
1432
1448
|
function isTerminalPlayRunLiveStatus(status) {
|
|
1433
1449
|
return isTerminalPlayRunLifecycleStatus(status);
|
|
1434
1450
|
}
|
|
1435
|
-
function
|
|
1451
|
+
function isRecord2(value) {
|
|
1436
1452
|
return Boolean(value && typeof value === "object" && !Array.isArray(value));
|
|
1437
1453
|
}
|
|
1438
1454
|
function finiteNumber2(value) {
|
|
1439
1455
|
return typeof value === "number" && Number.isFinite(value) ? value : null;
|
|
1440
1456
|
}
|
|
1441
1457
|
function extractTerminalRunLogTail(result) {
|
|
1442
|
-
if (!
|
|
1458
|
+
if (!isRecord2(result) || !isRecord2(result._metadata)) {
|
|
1443
1459
|
return null;
|
|
1444
1460
|
}
|
|
1445
1461
|
const runLogTail = result._metadata.runLogTail;
|
|
1446
|
-
if (!
|
|
1462
|
+
if (!isRecord2(runLogTail) || !Array.isArray(runLogTail.tail)) {
|
|
1447
1463
|
return null;
|
|
1448
1464
|
}
|
|
1449
1465
|
const logTail = runLogTail.tail.filter(
|
|
@@ -2180,7 +2196,7 @@ function resolveToolExecuteTimeoutMs(toolId) {
|
|
|
2180
2196
|
}
|
|
2181
2197
|
var RUNS_FAILED_LOG_LIMIT = 20;
|
|
2182
2198
|
var RUN_LOGS_PAGE_LIMIT = 1e3;
|
|
2183
|
-
function
|
|
2199
|
+
function isRecord3(value) {
|
|
2184
2200
|
return Boolean(value && typeof value === "object" && !Array.isArray(value));
|
|
2185
2201
|
}
|
|
2186
2202
|
function isPrebuiltPlayDescription(play) {
|
|
@@ -2337,7 +2353,7 @@ function updatePlayLiveStatusState(state, event) {
|
|
|
2337
2353
|
}
|
|
2338
2354
|
const runId = typeof payload.runId === "string" && payload.runId ? payload.runId : isPlayRunPackage(payload) ? payload.run.id : state.runId;
|
|
2339
2355
|
const status = normalizeLiveStatus(payload.status) ?? (isPlayRunPackage(payload) ? normalizeLiveStatus(payload.run.status) : null) ?? state.status;
|
|
2340
|
-
const progressPayload =
|
|
2356
|
+
const progressPayload = isRecord3(payload.progress) ? payload.progress : {};
|
|
2341
2357
|
if (event.type === "play.run.final_status" && state.logs.length === 0 && state.lastLogSeq === 0) {
|
|
2342
2358
|
const payloadLogs = readStringArray(payload.logs);
|
|
2343
2359
|
const progressLogs = readStringArray(progressPayload.logs);
|
|
@@ -2452,9 +2468,9 @@ var DeeplineClient = class {
|
|
|
2452
2468
|
return fields.length > 0 ? { fields } : schema;
|
|
2453
2469
|
}
|
|
2454
2470
|
schemaMetadata(schema, key) {
|
|
2455
|
-
if (!
|
|
2471
|
+
if (!isRecord3(schema)) return null;
|
|
2456
2472
|
const value = schema[key];
|
|
2457
|
-
return
|
|
2473
|
+
return isRecord3(value) ? value : null;
|
|
2458
2474
|
}
|
|
2459
2475
|
playRunCommand(play, options) {
|
|
2460
2476
|
const target = play.reference || play.name;
|
|
@@ -2503,7 +2519,7 @@ var DeeplineClient = class {
|
|
|
2503
2519
|
aliases,
|
|
2504
2520
|
inputSchema: options?.compact ? this.compactSchema(play.inputSchema) : play.inputSchema ?? null,
|
|
2505
2521
|
outputSchema: options?.compact ? this.compactSchema(play.outputSchema) : play.outputSchema ?? null,
|
|
2506
|
-
staticPipeline:
|
|
2522
|
+
staticPipeline: isRecord3(play.staticPipeline) ? play.staticPipeline : isRecord3(play.currentRevision?.staticPipeline) ? play.currentRevision.staticPipeline : isRecord3(play.liveRevision?.staticPipeline) ? play.liveRevision.staticPipeline : null,
|
|
2507
2523
|
...csvInput ? { csvInput } : {},
|
|
2508
2524
|
...rowOutputSchema ? { rowOutputSchema } : {},
|
|
2509
2525
|
runCommand,
|
|
@@ -4968,7 +4984,7 @@ var TARGET_FALLBACK_KEYS = {
|
|
|
4968
4984
|
status: [/^email_status$/i, /^status$/i],
|
|
4969
4985
|
email_status: [/^email_status$/i, /^status$/i]
|
|
4970
4986
|
};
|
|
4971
|
-
function
|
|
4987
|
+
function isRecord4(value) {
|
|
4972
4988
|
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
4973
4989
|
}
|
|
4974
4990
|
function toV2RawToolOutputPath(path) {
|
|
@@ -5028,7 +5044,7 @@ function valuesAtSegments(current, segments, path = []) {
|
|
|
5028
5044
|
if (!Array.isArray(current)) return [];
|
|
5029
5045
|
return valuesAtSegments(current[segment], rest, [...path, segment]);
|
|
5030
5046
|
}
|
|
5031
|
-
if (!
|
|
5047
|
+
if (!isRecord4(current)) return [];
|
|
5032
5048
|
const directMatches = valuesAtSegments(current[segment], rest, [
|
|
5033
5049
|
...path,
|
|
5034
5050
|
segment
|
|
@@ -5058,7 +5074,7 @@ function getValuesAtPath(root, path) {
|
|
|
5058
5074
|
return valuesAtSegments(root, parsePath(path)).map((entry) => entry.value);
|
|
5059
5075
|
}
|
|
5060
5076
|
function toResultEnvelope(value) {
|
|
5061
|
-
if (
|
|
5077
|
+
if (isRecord4(value) && "data" in value) {
|
|
5062
5078
|
const envelope = { data: value.data };
|
|
5063
5079
|
if ("meta" in value) envelope.meta = value.meta;
|
|
5064
5080
|
return envelope;
|
|
@@ -5111,7 +5127,7 @@ function getAtPath(root, path) {
|
|
|
5111
5127
|
current = current[segment];
|
|
5112
5128
|
continue;
|
|
5113
5129
|
}
|
|
5114
|
-
if (!
|
|
5130
|
+
if (!isRecord4(current)) return void 0;
|
|
5115
5131
|
current = current[segment];
|
|
5116
5132
|
}
|
|
5117
5133
|
return current;
|
|
@@ -5128,7 +5144,7 @@ function normalizeString(value) {
|
|
|
5128
5144
|
}
|
|
5129
5145
|
function normalizeRows(value) {
|
|
5130
5146
|
if (!Array.isArray(value)) return null;
|
|
5131
|
-
return value.map((entry) =>
|
|
5147
|
+
return value.map((entry) => isRecord4(entry) ? entry : { value: entry });
|
|
5132
5148
|
}
|
|
5133
5149
|
function findFirstTargetByPath(result, paths) {
|
|
5134
5150
|
for (const path of paths ?? []) {
|
|
@@ -5187,7 +5203,7 @@ function findFirstTargetByKey(result, target, depth = 0, path = []) {
|
|
|
5187
5203
|
}
|
|
5188
5204
|
return null;
|
|
5189
5205
|
}
|
|
5190
|
-
if (!
|
|
5206
|
+
if (!isRecord4(result)) return null;
|
|
5191
5207
|
const patterns = TARGET_FALLBACK_KEYS[target] ?? [
|
|
5192
5208
|
new RegExp(`^${target}$`, "i")
|
|
5193
5209
|
];
|
|
@@ -5247,7 +5263,7 @@ function normalizeJobChangeStatus(value) {
|
|
|
5247
5263
|
function firstExperienceDate(value) {
|
|
5248
5264
|
if (!Array.isArray(value)) return null;
|
|
5249
5265
|
for (const entry of value) {
|
|
5250
|
-
if (!
|
|
5266
|
+
if (!isRecord4(entry)) continue;
|
|
5251
5267
|
const date = normalizeString(
|
|
5252
5268
|
entry.start_date ?? entry.started_at ?? entry.startDate
|
|
5253
5269
|
);
|
|
@@ -5256,10 +5272,10 @@ function firstExperienceDate(value) {
|
|
|
5256
5272
|
return null;
|
|
5257
5273
|
}
|
|
5258
5274
|
function normalizeJobChange(value) {
|
|
5259
|
-
const record =
|
|
5260
|
-
const nested =
|
|
5261
|
-
const output =
|
|
5262
|
-
const person =
|
|
5275
|
+
const record = isRecord4(value) ? value : {};
|
|
5276
|
+
const nested = isRecord4(record.job_change) ? record.job_change : record;
|
|
5277
|
+
const output = isRecord4(nested.output) ? nested.output : nested;
|
|
5278
|
+
const person = isRecord4(output.person) ? output.person : {};
|
|
5263
5279
|
const status = normalizeJobChangeStatus(
|
|
5264
5280
|
output.status ?? output.job_change_status ?? output.job_changed ?? output.changed
|
|
5265
5281
|
);
|
|
@@ -5624,7 +5640,7 @@ function attachToolResultListDataset(result, input) {
|
|
|
5624
5640
|
root = replaceAtPath(root, candidate, serialized.preview);
|
|
5625
5641
|
break;
|
|
5626
5642
|
}
|
|
5627
|
-
if (
|
|
5643
|
+
if (isRecord4(root) && isRecord4(root.toolResponse) && Object.prototype.hasOwnProperty.call(root.toolResponse, "raw")) {
|
|
5628
5644
|
result.toolResponse.raw = root.toolResponse.raw;
|
|
5629
5645
|
result.toolOutput.raw = root.toolResponse.raw;
|
|
5630
5646
|
}
|
|
@@ -5642,7 +5658,7 @@ function replaceAtPath(root, path, replacement) {
|
|
|
5642
5658
|
copy[segment] = replace(copy[segment], index + 1);
|
|
5643
5659
|
return copy;
|
|
5644
5660
|
}
|
|
5645
|
-
if (!
|
|
5661
|
+
if (!isRecord4(current)) return current;
|
|
5646
5662
|
return {
|
|
5647
5663
|
...current,
|
|
5648
5664
|
[segment]: replace(current[segment], index + 1)
|
|
@@ -5963,11 +5979,11 @@ var Deepline = class {
|
|
|
5963
5979
|
return new DeeplineContext(options);
|
|
5964
5980
|
}
|
|
5965
5981
|
};
|
|
5966
|
-
function
|
|
5982
|
+
function isRecord5(value) {
|
|
5967
5983
|
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
5968
5984
|
}
|
|
5969
5985
|
function stringArrayRecord(value) {
|
|
5970
|
-
if (!
|
|
5986
|
+
if (!isRecord5(value)) return {};
|
|
5971
5987
|
return Object.fromEntries(
|
|
5972
5988
|
Object.entries(value).map(([key, paths]) => [
|
|
5973
5989
|
key,
|
|
@@ -5979,7 +5995,7 @@ function stringArray(value) {
|
|
|
5979
5995
|
return Array.isArray(value) ? value.map(String) : [];
|
|
5980
5996
|
}
|
|
5981
5997
|
function emailStatusExtractorConfig(value) {
|
|
5982
|
-
if (!
|
|
5998
|
+
if (!isRecord5(value)) return void 0;
|
|
5983
5999
|
const readPaths = (key) => {
|
|
5984
6000
|
const paths = stringArray(value[key]).map((path) => path.trim()).filter(Boolean);
|
|
5985
6001
|
return paths.length > 0 ? paths : void 0;
|
|
@@ -6006,7 +6022,7 @@ function emailStatusExtractorConfig(value) {
|
|
|
6006
6022
|
const paths = readPaths(key);
|
|
6007
6023
|
if (paths) config[key] = paths;
|
|
6008
6024
|
}
|
|
6009
|
-
if (
|
|
6025
|
+
if (isRecord5(value.statusMap)) {
|
|
6010
6026
|
config.statusMap = value.statusMap;
|
|
6011
6027
|
}
|
|
6012
6028
|
if (Array.isArray(value.rules)) {
|
|
@@ -6015,10 +6031,10 @@ function emailStatusExtractorConfig(value) {
|
|
|
6015
6031
|
return config;
|
|
6016
6032
|
}
|
|
6017
6033
|
function extractorDescriptorRecord(value) {
|
|
6018
|
-
if (!
|
|
6034
|
+
if (!isRecord5(value)) return {};
|
|
6019
6035
|
return Object.fromEntries(
|
|
6020
6036
|
Object.entries(value).flatMap(([key, descriptor]) => {
|
|
6021
|
-
if (!
|
|
6037
|
+
if (!isRecord5(descriptor)) return [];
|
|
6022
6038
|
const paths = stringArray(descriptor.paths).map((path) => path.trim()).filter(Boolean);
|
|
6023
6039
|
if (paths.length === 0) return [];
|
|
6024
6040
|
const transforms = stringArray(descriptor.transforms).map((transform) => transform.trim()).filter(Boolean);
|
|
@@ -6040,7 +6056,7 @@ function extractorDescriptorRecord(value) {
|
|
|
6040
6056
|
}
|
|
6041
6057
|
function rowsFromUnknown(value) {
|
|
6042
6058
|
if (!Array.isArray(value)) return [];
|
|
6043
|
-
return value.map((row) =>
|
|
6059
|
+
return value.map((row) => isRecord5(row) ? row : { value: row });
|
|
6044
6060
|
}
|
|
6045
6061
|
function finiteNonNegativeInteger(value) {
|
|
6046
6062
|
if (typeof value !== "number" || !Number.isFinite(value) || value < 0) {
|
|
@@ -6062,8 +6078,8 @@ function stableHash(value) {
|
|
|
6062
6078
|
}
|
|
6063
6079
|
function attachSdkQueryResultDatasetResult(toolId, result, options) {
|
|
6064
6080
|
if (!options || !isQueryResultDatasetTool(toolId)) return result;
|
|
6065
|
-
const raw =
|
|
6066
|
-
const dataset =
|
|
6081
|
+
const raw = isRecord5(result.toolResponse.raw) ? result.toolResponse.raw : null;
|
|
6082
|
+
const dataset = isRecord5(raw?.dataset) ? raw.dataset : null;
|
|
6067
6083
|
const totalRows = finiteNonNegativeInteger(dataset?.total_rows);
|
|
6068
6084
|
const sql = typeof options.input.sql === "string" ? options.input.sql : typeof options.input.query === "string" ? options.input.query : typeof raw?.sql === "string" ? raw.sql : null;
|
|
6069
6085
|
if (!dataset || totalRows === null || !sql) {
|
|
@@ -6093,7 +6109,7 @@ function attachSdkQueryResultDatasetResult(toolId, result, options) {
|
|
|
6093
6109
|
} : {}
|
|
6094
6110
|
}
|
|
6095
6111
|
});
|
|
6096
|
-
const pageRaw =
|
|
6112
|
+
const pageRaw = isRecord5(response.toolResponse?.raw) ? response.toolResponse.raw : null;
|
|
6097
6113
|
return rowsFromUnknown(pageRaw?.rows);
|
|
6098
6114
|
};
|
|
6099
6115
|
const collectRows = async (limit) => {
|
|
@@ -6146,8 +6162,8 @@ function attachSdkQueryResultDatasetResult(toolId, result, options) {
|
|
|
6146
6162
|
function toolExecutionEnvelopeToResult(fallbackToolId, response, options) {
|
|
6147
6163
|
const raw = response.toolResponse?.raw ?? null;
|
|
6148
6164
|
const meta = response.toolResponse?.meta;
|
|
6149
|
-
const metadata =
|
|
6150
|
-
const toolMetadata =
|
|
6165
|
+
const metadata = isRecord5(response._metadata) ? response._metadata.tool : null;
|
|
6166
|
+
const toolMetadata = isRecord5(metadata) ? metadata : {};
|
|
6151
6167
|
return attachSdkQueryResultDatasetResult(
|
|
6152
6168
|
fallbackToolId,
|
|
6153
6169
|
createToolExecuteResult({
|
|
@@ -6155,7 +6171,7 @@ function toolExecutionEnvelopeToResult(fallbackToolId, response, options) {
|
|
|
6155
6171
|
jobId: typeof response.job_id === "string" ? response.job_id : void 0,
|
|
6156
6172
|
result: {
|
|
6157
6173
|
data: raw,
|
|
6158
|
-
...
|
|
6174
|
+
...isRecord5(meta) ? { meta } : {}
|
|
6159
6175
|
},
|
|
6160
6176
|
metadata: {
|
|
6161
6177
|
toolId: typeof toolMetadata.toolId === "string" ? toolMetadata.toolId : fallbackToolId,
|
|
@@ -6171,7 +6187,7 @@ function toolExecutionEnvelopeToResult(fallbackToolId, response, options) {
|
|
|
6171
6187
|
cached: false,
|
|
6172
6188
|
source: "live"
|
|
6173
6189
|
},
|
|
6174
|
-
meta:
|
|
6190
|
+
meta: isRecord5(response.meta) ? response.meta : void 0
|
|
6175
6191
|
}),
|
|
6176
6192
|
options
|
|
6177
6193
|
);
|