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.js
CHANGED
|
@@ -424,10 +424,10 @@ var SDK_RELEASE = {
|
|
|
424
424
|
// 0.1.175 ships loud `deepline enrich` empty-waterfall reporting.
|
|
425
425
|
// 0.1.220 deprecates SDK CLI versions below 0.1.219 and updates them
|
|
426
426
|
// automatically without blocking their current command.
|
|
427
|
-
version: "0.1.
|
|
427
|
+
version: "0.1.224",
|
|
428
428
|
apiContract: "2026-06-dataset-handle-results-hard-cutover",
|
|
429
429
|
supportPolicy: {
|
|
430
|
-
latest: "0.1.
|
|
430
|
+
latest: "0.1.224",
|
|
431
431
|
minimumSupported: "0.1.53",
|
|
432
432
|
deprecatedBelow: "0.1.219",
|
|
433
433
|
commandMinimumSupported: [
|
|
@@ -1163,29 +1163,42 @@ function normalizePlayRunLedgerTerminalSource(value) {
|
|
|
1163
1163
|
// ../shared_libs/play-runtime/secret-redaction.ts
|
|
1164
1164
|
var SECRET_REDACTION_PLACEHOLDER = "[REDACTED_SECRET]";
|
|
1165
1165
|
var BEARER_TOKEN_RE = /\bBearer\s+[A-Za-z0-9._~+/=-]{12,}\b/g;
|
|
1166
|
-
var
|
|
1166
|
+
var BASIC_CREDENTIAL_RE = /\bBasic\s+[A-Za-z0-9+/]{4,}={0,2}\b/g;
|
|
1167
|
+
var JWT_RE = /\b[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{1,}\.[A-Za-z0-9_-]{8,}\b/g;
|
|
1167
1168
|
var PRIVATE_KEY_RE = /-----BEGIN [A-Z0-9 ]*PRIVATE KEY-----[\s\S]*?-----END [A-Z0-9 ]*PRIVATE KEY-----/g;
|
|
1168
|
-
var
|
|
1169
|
+
var SENSITIVE_FIELD_NAME = "authorization|cookie|password|(?:client[_-]?)?secret|(?:access|refresh)[_-]?token|(?:x[_-]?)?api[_-]?key|private[_-]?key|token|credentials";
|
|
1170
|
+
var COMMON_SECRET_RE = /\b(?:[prs]k_(?:live|test)_|(?:pat|ghp|github_pat)_|xox[baprs]-)[A-Za-z0-9_./+=:-]{12,}\b/gi;
|
|
1169
1171
|
var GENERIC_PREFIXED_SECRET_RE = /\b(?:key|token|secret|api[_-]?key)_[A-Za-z0-9_./+=:-]{12,}\b/gi;
|
|
1170
|
-
var URL_SECRET_VALUE_RE = /\b(?:
|
|
1172
|
+
var URL_SECRET_VALUE_RE = /\b(?:[spr]k|pat|ghp|github_pat|xox)[A-Za-z0-9_./+=:-]{12,}\b/i;
|
|
1171
1173
|
var GENERIC_SECRET_ASSIGNMENT_RE = /\b(?:api[_-]?key|token|secret|password)\b\s*[:=]\s*["']?[^"',\s]{12,}["']?/gi;
|
|
1172
|
-
var HIGH_ENTROPY_ASSIGNMENT_RE = /\b(?:api[_-]?key|token|secret|password|authorization|access
|
|
1174
|
+
var HIGH_ENTROPY_ASSIGNMENT_RE = /\b(?:api[_-]?key|token|secret|password|authorization|(?:access|refresh)[_-]?token)\b\s*[:=]\s*["']?[^"',\s]{16,}["']?/gi;
|
|
1173
1175
|
var SENSITIVE_URL_PARAM_RE = /[?#&](?:\w*(?:key|token)|secret|password|authorization|credential|signature|sig)(?:=|$)/i;
|
|
1176
|
+
var SENSITIVE_FIELD_NAME_RE = new RegExp(
|
|
1177
|
+
`(^|[._-])(?:${SENSITIVE_FIELD_NAME})$`,
|
|
1178
|
+
"i"
|
|
1179
|
+
);
|
|
1180
|
+
var SERIALIZED_SECRET_FIELD_RE = new RegExp(
|
|
1181
|
+
`"(${SENSITIVE_FIELD_NAME})"\\s*:\\s*(?:"[^"\\\\]*"|\\{[^{}]*\\})`,
|
|
1182
|
+
"gi"
|
|
1183
|
+
);
|
|
1174
1184
|
function escapeRegExp(value) {
|
|
1175
1185
|
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
1176
1186
|
}
|
|
1177
|
-
function isRecord(value) {
|
|
1178
|
-
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
1179
|
-
}
|
|
1180
1187
|
function redactSecretLikeString(value) {
|
|
1181
|
-
const
|
|
1188
|
+
const serializedRedacted = value.replace(
|
|
1189
|
+
SERIALIZED_SECRET_FIELD_RE,
|
|
1190
|
+
`"$1":"${SECRET_REDACTION_PLACEHOLDER}"`
|
|
1191
|
+
);
|
|
1192
|
+
const trimmed = serializedRedacted.trim();
|
|
1182
1193
|
if (/^https?:\/\/\S+$/i.test(trimmed)) {
|
|
1183
1194
|
if (/^https?:\/\/[^/?#@]+@/i.test(trimmed) || SENSITIVE_URL_PARAM_RE.test(trimmed)) {
|
|
1184
1195
|
return SECRET_REDACTION_PLACEHOLDER;
|
|
1185
1196
|
}
|
|
1186
|
-
if (!URL_SECRET_VALUE_RE.test(
|
|
1197
|
+
if (!URL_SECRET_VALUE_RE.test(serializedRedacted)) {
|
|
1198
|
+
return serializedRedacted;
|
|
1199
|
+
}
|
|
1187
1200
|
}
|
|
1188
|
-
return
|
|
1201
|
+
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) => {
|
|
1189
1202
|
const separator = match.includes("=") ? "=" : ":";
|
|
1190
1203
|
const [key] = match.split(separator, 1);
|
|
1191
1204
|
return `${key.trim()}${separator}${SECRET_REDACTION_PLACEHOLDER}`;
|
|
@@ -1220,9 +1233,12 @@ function createSecretRedactionContext(initialValues = []) {
|
|
|
1220
1233
|
function redact(value) {
|
|
1221
1234
|
if (typeof value === "string") return redactString(value);
|
|
1222
1235
|
if (Array.isArray(value)) return value.map((entry) => redact(entry));
|
|
1223
|
-
if (
|
|
1236
|
+
if (value && typeof value === "object") {
|
|
1224
1237
|
return Object.fromEntries(
|
|
1225
|
-
Object.entries(value).map(([key, entry]) => [
|
|
1238
|
+
Object.entries(value).map(([key, entry]) => [
|
|
1239
|
+
key,
|
|
1240
|
+
SENSITIVE_FIELD_NAME_RE.test(key) ? SECRET_REDACTION_PLACEHOLDER : redact(entry)
|
|
1241
|
+
])
|
|
1226
1242
|
);
|
|
1227
1243
|
}
|
|
1228
1244
|
return value;
|
|
@@ -1246,7 +1262,7 @@ var ledgerIngressRedactor = createSecretRedactionContext();
|
|
|
1246
1262
|
|
|
1247
1263
|
// ../shared_libs/play-runtime/run-ledger.ts
|
|
1248
1264
|
var LOG_TAIL_LIMIT = 100;
|
|
1249
|
-
function
|
|
1265
|
+
function isRecord(value) {
|
|
1250
1266
|
return Boolean(value && typeof value === "object" && !Array.isArray(value));
|
|
1251
1267
|
}
|
|
1252
1268
|
function finiteNumber(value) {
|
|
@@ -1339,21 +1355,21 @@ function createEmptyPlayRunLedgerSnapshot(input) {
|
|
|
1339
1355
|
};
|
|
1340
1356
|
}
|
|
1341
1357
|
function normalizePlayRunLedgerSnapshot(value, fallback) {
|
|
1342
|
-
if (!
|
|
1358
|
+
if (!isRecord(value)) {
|
|
1343
1359
|
return createEmptyPlayRunLedgerSnapshot(fallback);
|
|
1344
1360
|
}
|
|
1345
1361
|
const orderedStepIds = Array.isArray(value.orderedStepIds) ? value.orderedStepIds.filter(
|
|
1346
1362
|
(entry) => typeof entry === "string" && Boolean(entry.trim())
|
|
1347
1363
|
) : [];
|
|
1348
|
-
const rawSteps =
|
|
1364
|
+
const rawSteps = isRecord(value.stepsById) ? value.stepsById : {};
|
|
1349
1365
|
const stepsById = {};
|
|
1350
1366
|
for (const [stepId, rawStep] of Object.entries(rawSteps)) {
|
|
1351
|
-
if (!stepId.trim() || !
|
|
1367
|
+
if (!stepId.trim() || !isRecord(rawStep)) continue;
|
|
1352
1368
|
const rawStatus = normalizeStepStatus(rawStep.status);
|
|
1353
1369
|
if (!rawStatus) continue;
|
|
1354
1370
|
const completedAt = finiteNumber(rawStep.completedAt);
|
|
1355
1371
|
const status = rawStatus === "running" && completedAt !== null ? "completed" : rawStatus;
|
|
1356
|
-
const rawProgress =
|
|
1372
|
+
const rawProgress = isRecord(rawStep.progress) ? rawStep.progress : null;
|
|
1357
1373
|
stepsById[stepId] = {
|
|
1358
1374
|
stepId,
|
|
1359
1375
|
label: optionalString(rawStep.label),
|
|
@@ -1368,10 +1384,10 @@ function normalizePlayRunLedgerSnapshot(value, fallback) {
|
|
|
1368
1384
|
progress: rawProgress ? normalizeStepProgress(rawProgress) : null
|
|
1369
1385
|
};
|
|
1370
1386
|
}
|
|
1371
|
-
const rawDatasets =
|
|
1387
|
+
const rawDatasets = isRecord(value.datasetsById) ? value.datasetsById : {};
|
|
1372
1388
|
const datasetsById = {};
|
|
1373
1389
|
for (const [datasetId, rawDataset] of Object.entries(rawDatasets)) {
|
|
1374
|
-
if (!datasetId.trim() || !
|
|
1390
|
+
if (!datasetId.trim() || !isRecord(rawDataset)) continue;
|
|
1375
1391
|
const phase = rawDataset.phase === "available" || rawDataset.phase === "failed" ? rawDataset.phase : "registered";
|
|
1376
1392
|
datasetsById[datasetId] = {
|
|
1377
1393
|
datasetId,
|
|
@@ -1502,18 +1518,18 @@ function normalizePlayRunLiveStatus(value) {
|
|
|
1502
1518
|
function isTerminalPlayRunLiveStatus(status) {
|
|
1503
1519
|
return isTerminalPlayRunLifecycleStatus(status);
|
|
1504
1520
|
}
|
|
1505
|
-
function
|
|
1521
|
+
function isRecord2(value) {
|
|
1506
1522
|
return Boolean(value && typeof value === "object" && !Array.isArray(value));
|
|
1507
1523
|
}
|
|
1508
1524
|
function finiteNumber2(value) {
|
|
1509
1525
|
return typeof value === "number" && Number.isFinite(value) ? value : null;
|
|
1510
1526
|
}
|
|
1511
1527
|
function extractTerminalRunLogTail(result) {
|
|
1512
|
-
if (!
|
|
1528
|
+
if (!isRecord2(result) || !isRecord2(result._metadata)) {
|
|
1513
1529
|
return null;
|
|
1514
1530
|
}
|
|
1515
1531
|
const runLogTail = result._metadata.runLogTail;
|
|
1516
|
-
if (!
|
|
1532
|
+
if (!isRecord2(runLogTail) || !Array.isArray(runLogTail.tail)) {
|
|
1517
1533
|
return null;
|
|
1518
1534
|
}
|
|
1519
1535
|
const logTail = runLogTail.tail.filter(
|
|
@@ -2250,7 +2266,7 @@ function resolveToolExecuteTimeoutMs(toolId) {
|
|
|
2250
2266
|
}
|
|
2251
2267
|
var RUNS_FAILED_LOG_LIMIT = 20;
|
|
2252
2268
|
var RUN_LOGS_PAGE_LIMIT = 1e3;
|
|
2253
|
-
function
|
|
2269
|
+
function isRecord3(value) {
|
|
2254
2270
|
return Boolean(value && typeof value === "object" && !Array.isArray(value));
|
|
2255
2271
|
}
|
|
2256
2272
|
function isPrebuiltPlayDescription(play) {
|
|
@@ -2407,7 +2423,7 @@ function updatePlayLiveStatusState(state, event) {
|
|
|
2407
2423
|
}
|
|
2408
2424
|
const runId = typeof payload.runId === "string" && payload.runId ? payload.runId : isPlayRunPackage(payload) ? payload.run.id : state.runId;
|
|
2409
2425
|
const status = normalizeLiveStatus(payload.status) ?? (isPlayRunPackage(payload) ? normalizeLiveStatus(payload.run.status) : null) ?? state.status;
|
|
2410
|
-
const progressPayload =
|
|
2426
|
+
const progressPayload = isRecord3(payload.progress) ? payload.progress : {};
|
|
2411
2427
|
if (event.type === "play.run.final_status" && state.logs.length === 0 && state.lastLogSeq === 0) {
|
|
2412
2428
|
const payloadLogs = readStringArray(payload.logs);
|
|
2413
2429
|
const progressLogs = readStringArray(progressPayload.logs);
|
|
@@ -2522,9 +2538,9 @@ var DeeplineClient = class {
|
|
|
2522
2538
|
return fields.length > 0 ? { fields } : schema;
|
|
2523
2539
|
}
|
|
2524
2540
|
schemaMetadata(schema, key) {
|
|
2525
|
-
if (!
|
|
2541
|
+
if (!isRecord3(schema)) return null;
|
|
2526
2542
|
const value = schema[key];
|
|
2527
|
-
return
|
|
2543
|
+
return isRecord3(value) ? value : null;
|
|
2528
2544
|
}
|
|
2529
2545
|
playRunCommand(play, options) {
|
|
2530
2546
|
const target = play.reference || play.name;
|
|
@@ -2573,7 +2589,7 @@ var DeeplineClient = class {
|
|
|
2573
2589
|
aliases,
|
|
2574
2590
|
inputSchema: options?.compact ? this.compactSchema(play.inputSchema) : play.inputSchema ?? null,
|
|
2575
2591
|
outputSchema: options?.compact ? this.compactSchema(play.outputSchema) : play.outputSchema ?? null,
|
|
2576
|
-
staticPipeline:
|
|
2592
|
+
staticPipeline: isRecord3(play.staticPipeline) ? play.staticPipeline : isRecord3(play.currentRevision?.staticPipeline) ? play.currentRevision.staticPipeline : isRecord3(play.liveRevision?.staticPipeline) ? play.liveRevision.staticPipeline : null,
|
|
2577
2593
|
...csvInput ? { csvInput } : {},
|
|
2578
2594
|
...rowOutputSchema ? { rowOutputSchema } : {},
|
|
2579
2595
|
runCommand,
|
|
@@ -5038,7 +5054,7 @@ var TARGET_FALLBACK_KEYS = {
|
|
|
5038
5054
|
status: [/^email_status$/i, /^status$/i],
|
|
5039
5055
|
email_status: [/^email_status$/i, /^status$/i]
|
|
5040
5056
|
};
|
|
5041
|
-
function
|
|
5057
|
+
function isRecord4(value) {
|
|
5042
5058
|
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
5043
5059
|
}
|
|
5044
5060
|
function toV2RawToolOutputPath(path) {
|
|
@@ -5098,7 +5114,7 @@ function valuesAtSegments(current, segments, path = []) {
|
|
|
5098
5114
|
if (!Array.isArray(current)) return [];
|
|
5099
5115
|
return valuesAtSegments(current[segment], rest, [...path, segment]);
|
|
5100
5116
|
}
|
|
5101
|
-
if (!
|
|
5117
|
+
if (!isRecord4(current)) return [];
|
|
5102
5118
|
const directMatches = valuesAtSegments(current[segment], rest, [
|
|
5103
5119
|
...path,
|
|
5104
5120
|
segment
|
|
@@ -5128,7 +5144,7 @@ function getValuesAtPath(root, path) {
|
|
|
5128
5144
|
return valuesAtSegments(root, parsePath(path)).map((entry) => entry.value);
|
|
5129
5145
|
}
|
|
5130
5146
|
function toResultEnvelope(value) {
|
|
5131
|
-
if (
|
|
5147
|
+
if (isRecord4(value) && "data" in value) {
|
|
5132
5148
|
const envelope = { data: value.data };
|
|
5133
5149
|
if ("meta" in value) envelope.meta = value.meta;
|
|
5134
5150
|
return envelope;
|
|
@@ -5181,7 +5197,7 @@ function getAtPath(root, path) {
|
|
|
5181
5197
|
current = current[segment];
|
|
5182
5198
|
continue;
|
|
5183
5199
|
}
|
|
5184
|
-
if (!
|
|
5200
|
+
if (!isRecord4(current)) return void 0;
|
|
5185
5201
|
current = current[segment];
|
|
5186
5202
|
}
|
|
5187
5203
|
return current;
|
|
@@ -5198,7 +5214,7 @@ function normalizeString(value) {
|
|
|
5198
5214
|
}
|
|
5199
5215
|
function normalizeRows(value) {
|
|
5200
5216
|
if (!Array.isArray(value)) return null;
|
|
5201
|
-
return value.map((entry) =>
|
|
5217
|
+
return value.map((entry) => isRecord4(entry) ? entry : { value: entry });
|
|
5202
5218
|
}
|
|
5203
5219
|
function findFirstTargetByPath(result, paths) {
|
|
5204
5220
|
for (const path of paths ?? []) {
|
|
@@ -5257,7 +5273,7 @@ function findFirstTargetByKey(result, target, depth = 0, path = []) {
|
|
|
5257
5273
|
}
|
|
5258
5274
|
return null;
|
|
5259
5275
|
}
|
|
5260
|
-
if (!
|
|
5276
|
+
if (!isRecord4(result)) return null;
|
|
5261
5277
|
const patterns = TARGET_FALLBACK_KEYS[target] ?? [
|
|
5262
5278
|
new RegExp(`^${target}$`, "i")
|
|
5263
5279
|
];
|
|
@@ -5317,7 +5333,7 @@ function normalizeJobChangeStatus(value) {
|
|
|
5317
5333
|
function firstExperienceDate(value) {
|
|
5318
5334
|
if (!Array.isArray(value)) return null;
|
|
5319
5335
|
for (const entry of value) {
|
|
5320
|
-
if (!
|
|
5336
|
+
if (!isRecord4(entry)) continue;
|
|
5321
5337
|
const date = normalizeString(
|
|
5322
5338
|
entry.start_date ?? entry.started_at ?? entry.startDate
|
|
5323
5339
|
);
|
|
@@ -5326,10 +5342,10 @@ function firstExperienceDate(value) {
|
|
|
5326
5342
|
return null;
|
|
5327
5343
|
}
|
|
5328
5344
|
function normalizeJobChange(value) {
|
|
5329
|
-
const record =
|
|
5330
|
-
const nested =
|
|
5331
|
-
const output =
|
|
5332
|
-
const person =
|
|
5345
|
+
const record = isRecord4(value) ? value : {};
|
|
5346
|
+
const nested = isRecord4(record.job_change) ? record.job_change : record;
|
|
5347
|
+
const output = isRecord4(nested.output) ? nested.output : nested;
|
|
5348
|
+
const person = isRecord4(output.person) ? output.person : {};
|
|
5333
5349
|
const status = normalizeJobChangeStatus(
|
|
5334
5350
|
output.status ?? output.job_change_status ?? output.job_changed ?? output.changed
|
|
5335
5351
|
);
|
|
@@ -5694,7 +5710,7 @@ function attachToolResultListDataset(result, input) {
|
|
|
5694
5710
|
root = replaceAtPath(root, candidate, serialized.preview);
|
|
5695
5711
|
break;
|
|
5696
5712
|
}
|
|
5697
|
-
if (
|
|
5713
|
+
if (isRecord4(root) && isRecord4(root.toolResponse) && Object.prototype.hasOwnProperty.call(root.toolResponse, "raw")) {
|
|
5698
5714
|
result.toolResponse.raw = root.toolResponse.raw;
|
|
5699
5715
|
result.toolOutput.raw = root.toolResponse.raw;
|
|
5700
5716
|
}
|
|
@@ -5712,7 +5728,7 @@ function replaceAtPath(root, path, replacement) {
|
|
|
5712
5728
|
copy[segment] = replace(copy[segment], index + 1);
|
|
5713
5729
|
return copy;
|
|
5714
5730
|
}
|
|
5715
|
-
if (!
|
|
5731
|
+
if (!isRecord4(current)) return current;
|
|
5716
5732
|
return {
|
|
5717
5733
|
...current,
|
|
5718
5734
|
[segment]: replace(current[segment], index + 1)
|
|
@@ -6033,11 +6049,11 @@ var Deepline = class {
|
|
|
6033
6049
|
return new DeeplineContext(options);
|
|
6034
6050
|
}
|
|
6035
6051
|
};
|
|
6036
|
-
function
|
|
6052
|
+
function isRecord5(value) {
|
|
6037
6053
|
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
6038
6054
|
}
|
|
6039
6055
|
function stringArrayRecord(value) {
|
|
6040
|
-
if (!
|
|
6056
|
+
if (!isRecord5(value)) return {};
|
|
6041
6057
|
return Object.fromEntries(
|
|
6042
6058
|
Object.entries(value).map(([key, paths]) => [
|
|
6043
6059
|
key,
|
|
@@ -6049,7 +6065,7 @@ function stringArray(value) {
|
|
|
6049
6065
|
return Array.isArray(value) ? value.map(String) : [];
|
|
6050
6066
|
}
|
|
6051
6067
|
function emailStatusExtractorConfig(value) {
|
|
6052
|
-
if (!
|
|
6068
|
+
if (!isRecord5(value)) return void 0;
|
|
6053
6069
|
const readPaths = (key) => {
|
|
6054
6070
|
const paths = stringArray(value[key]).map((path) => path.trim()).filter(Boolean);
|
|
6055
6071
|
return paths.length > 0 ? paths : void 0;
|
|
@@ -6076,7 +6092,7 @@ function emailStatusExtractorConfig(value) {
|
|
|
6076
6092
|
const paths = readPaths(key);
|
|
6077
6093
|
if (paths) config[key] = paths;
|
|
6078
6094
|
}
|
|
6079
|
-
if (
|
|
6095
|
+
if (isRecord5(value.statusMap)) {
|
|
6080
6096
|
config.statusMap = value.statusMap;
|
|
6081
6097
|
}
|
|
6082
6098
|
if (Array.isArray(value.rules)) {
|
|
@@ -6085,10 +6101,10 @@ function emailStatusExtractorConfig(value) {
|
|
|
6085
6101
|
return config;
|
|
6086
6102
|
}
|
|
6087
6103
|
function extractorDescriptorRecord(value) {
|
|
6088
|
-
if (!
|
|
6104
|
+
if (!isRecord5(value)) return {};
|
|
6089
6105
|
return Object.fromEntries(
|
|
6090
6106
|
Object.entries(value).flatMap(([key, descriptor]) => {
|
|
6091
|
-
if (!
|
|
6107
|
+
if (!isRecord5(descriptor)) return [];
|
|
6092
6108
|
const paths = stringArray(descriptor.paths).map((path) => path.trim()).filter(Boolean);
|
|
6093
6109
|
if (paths.length === 0) return [];
|
|
6094
6110
|
const transforms = stringArray(descriptor.transforms).map((transform) => transform.trim()).filter(Boolean);
|
|
@@ -6110,7 +6126,7 @@ function extractorDescriptorRecord(value) {
|
|
|
6110
6126
|
}
|
|
6111
6127
|
function rowsFromUnknown(value) {
|
|
6112
6128
|
if (!Array.isArray(value)) return [];
|
|
6113
|
-
return value.map((row) =>
|
|
6129
|
+
return value.map((row) => isRecord5(row) ? row : { value: row });
|
|
6114
6130
|
}
|
|
6115
6131
|
function finiteNonNegativeInteger(value) {
|
|
6116
6132
|
if (typeof value !== "number" || !Number.isFinite(value) || value < 0) {
|
|
@@ -6132,8 +6148,8 @@ function stableHash(value) {
|
|
|
6132
6148
|
}
|
|
6133
6149
|
function attachSdkQueryResultDatasetResult(toolId, result, options) {
|
|
6134
6150
|
if (!options || !isQueryResultDatasetTool(toolId)) return result;
|
|
6135
|
-
const raw =
|
|
6136
|
-
const dataset =
|
|
6151
|
+
const raw = isRecord5(result.toolResponse.raw) ? result.toolResponse.raw : null;
|
|
6152
|
+
const dataset = isRecord5(raw?.dataset) ? raw.dataset : null;
|
|
6137
6153
|
const totalRows = finiteNonNegativeInteger(dataset?.total_rows);
|
|
6138
6154
|
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;
|
|
6139
6155
|
if (!dataset || totalRows === null || !sql) {
|
|
@@ -6163,7 +6179,7 @@ function attachSdkQueryResultDatasetResult(toolId, result, options) {
|
|
|
6163
6179
|
} : {}
|
|
6164
6180
|
}
|
|
6165
6181
|
});
|
|
6166
|
-
const pageRaw =
|
|
6182
|
+
const pageRaw = isRecord5(response.toolResponse?.raw) ? response.toolResponse.raw : null;
|
|
6167
6183
|
return rowsFromUnknown(pageRaw?.rows);
|
|
6168
6184
|
};
|
|
6169
6185
|
const collectRows = async (limit) => {
|
|
@@ -6216,8 +6232,8 @@ function attachSdkQueryResultDatasetResult(toolId, result, options) {
|
|
|
6216
6232
|
function toolExecutionEnvelopeToResult(fallbackToolId, response, options) {
|
|
6217
6233
|
const raw = response.toolResponse?.raw ?? null;
|
|
6218
6234
|
const meta = response.toolResponse?.meta;
|
|
6219
|
-
const metadata =
|
|
6220
|
-
const toolMetadata =
|
|
6235
|
+
const metadata = isRecord5(response._metadata) ? response._metadata.tool : null;
|
|
6236
|
+
const toolMetadata = isRecord5(metadata) ? metadata : {};
|
|
6221
6237
|
return attachSdkQueryResultDatasetResult(
|
|
6222
6238
|
fallbackToolId,
|
|
6223
6239
|
createToolExecuteResult({
|
|
@@ -6225,7 +6241,7 @@ function toolExecutionEnvelopeToResult(fallbackToolId, response, options) {
|
|
|
6225
6241
|
jobId: typeof response.job_id === "string" ? response.job_id : void 0,
|
|
6226
6242
|
result: {
|
|
6227
6243
|
data: raw,
|
|
6228
|
-
...
|
|
6244
|
+
...isRecord5(meta) ? { meta } : {}
|
|
6229
6245
|
},
|
|
6230
6246
|
metadata: {
|
|
6231
6247
|
toolId: typeof toolMetadata.toolId === "string" ? toolMetadata.toolId : fallbackToolId,
|
|
@@ -6241,7 +6257,7 @@ function toolExecutionEnvelopeToResult(fallbackToolId, response, options) {
|
|
|
6241
6257
|
cached: false,
|
|
6242
6258
|
source: "live"
|
|
6243
6259
|
},
|
|
6244
|
-
meta:
|
|
6260
|
+
meta: isRecord5(response.meta) ? response.meta : void 0
|
|
6245
6261
|
}),
|
|
6246
6262
|
options
|
|
6247
6263
|
);
|