deepline 0.1.108 → 0.1.110
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/cli/index.js +2849 -1407
- package/dist/cli/index.mjs +2587 -1152
- package/dist/index.d.mts +81 -17
- package/dist/index.d.ts +81 -17
- package/dist/index.js +179 -51
- package/dist/index.mjs +179 -51
- package/dist/repo/apps/play-runner-workers/src/child-play-submit.ts +196 -0
- package/dist/repo/apps/play-runner-workers/src/coordinator-entry.ts +42 -21
- package/dist/repo/apps/play-runner-workers/src/entry.ts +162 -320
- package/dist/repo/apps/play-runner-workers/src/runtime/csv-rows.ts +102 -0
- package/dist/repo/apps/play-runner-workers/src/runtime/dataset-handles.ts +8 -3
- package/dist/repo/apps/play-runner-workers/src/runtime/receipts.ts +18 -27
- package/dist/repo/apps/play-runner-workers/src/workflow-instance-create.ts +44 -0
- package/dist/repo/apps/play-runner-workers/src/workflow-retry.ts +7 -11
- package/dist/repo/sdk/src/client.ts +35 -12
- package/dist/repo/sdk/src/errors.ts +2 -2
- package/dist/repo/sdk/src/http.ts +109 -9
- package/dist/repo/sdk/src/index.ts +4 -0
- package/dist/repo/sdk/src/play.ts +77 -7
- package/dist/repo/sdk/src/plays/bundle-play-file.ts +5 -1
- package/dist/repo/sdk/src/release.ts +14 -11
- package/dist/repo/sdk/src/tool-output.ts +2 -2
- package/dist/repo/sdk/src/types.ts +9 -6
- package/dist/repo/shared_libs/play-data-plane/cell-policy.ts +76 -0
- package/dist/repo/shared_libs/play-data-plane/column-names.ts +17 -0
- package/dist/repo/shared_libs/play-data-plane/sheet-contract.ts +190 -0
- package/dist/repo/shared_libs/play-runtime/coordinator-headers.ts +2 -0
- package/dist/repo/shared_libs/play-runtime/db-session.ts +4 -0
- package/dist/repo/shared_libs/play-runtime/fullenrich-batching.ts +229 -0
- package/dist/repo/shared_libs/play-runtime/governor/policy.ts +1 -1
- package/dist/repo/shared_libs/play-runtime/play-runtime-batching-registry.ts +20 -0
- package/dist/repo/shared_libs/play-runtime/providers.ts +5 -24
- package/dist/repo/shared_libs/play-runtime/run-failure.ts +20 -12
- package/dist/repo/shared_libs/play-runtime/run-ledger.ts +115 -25
- package/dist/repo/shared_libs/play-runtime/run-snapshot-stream.ts +49 -0
- package/dist/repo/shared_libs/play-runtime/scheduler-backend.ts +22 -9
- package/dist/repo/shared_libs/play-runtime/secret-redaction.ts +15 -0
- package/dist/repo/shared_libs/play-runtime/work-receipts.ts +1 -0
- package/dist/repo/shared_libs/plays/bundling/index.ts +69 -11
- package/dist/repo/shared_libs/plays/static-pipeline.ts +4 -14
- package/dist/repo/shared_libs/security/outbound-url-policy.ts +238 -0
- package/dist/repo/shared_libs/security/safe-fetch.ts +118 -0
- package/dist/viewer/viewer.css +617 -0
- package/dist/viewer/viewer.js +1496 -0
- package/package.json +5 -1
package/dist/index.mjs
CHANGED
|
@@ -188,7 +188,7 @@ var SDK_RELEASE = {
|
|
|
188
188
|
// preflight (existence, data rows, quotes, duplicate headers), HTML error
|
|
189
189
|
// scrubbing, and word-boundary watch truncation.
|
|
190
190
|
// 0.1.103 ships the refined SDK CLI command surface.
|
|
191
|
-
// 0.1.104
|
|
191
|
+
// 0.1.104 shipped the retired Postgres scheduler suspension/billing parity and runtime worker hardening.
|
|
192
192
|
// 0.1.105 ships the billing catalog surface: billing plans, subscribe,
|
|
193
193
|
// subscription status/cancel, invoices, and the client.billing namespace.
|
|
194
194
|
// 0.1.106 ships play cell provenance metadata and v2 preview retry hardening.
|
|
@@ -196,10 +196,10 @@ var SDK_RELEASE = {
|
|
|
196
196
|
// skill on the sdk sync surface, and the people-search-to-email prebuilt.
|
|
197
197
|
// 0.1.108 ships explicit dataset column/tool recompute policy and removes
|
|
198
198
|
// the SDK enrich generator's one-second stale policy.
|
|
199
|
-
version: "0.1.
|
|
199
|
+
version: "0.1.110",
|
|
200
200
|
apiContract: "2026-06-dataset-column-cell-stale-hard-cutover",
|
|
201
201
|
supportPolicy: {
|
|
202
|
-
latest: "0.1.
|
|
202
|
+
latest: "0.1.110",
|
|
203
203
|
minimumSupported: "0.1.53",
|
|
204
204
|
deprecatedBelow: "0.1.53",
|
|
205
205
|
commandMinimumSupported: [
|
|
@@ -221,10 +221,12 @@ var SDK_API_CONTRACT = SDK_RELEASE.apiContract;
|
|
|
221
221
|
var COORDINATOR_INTERNAL_TOKEN_HEADER = "x-deepline-internal-token";
|
|
222
222
|
var COORDINATOR_URL_OVERRIDE_HEADER = "x-deepline-coordinator-url";
|
|
223
223
|
var WORKER_CALLBACK_URL_OVERRIDE_HEADER = "x-deepline-worker-callback-url";
|
|
224
|
+
var RUNTIME_SCHEDULER_SCHEMA_OVERRIDE_HEADER = "x-deepline-runtime-scheduler-schema";
|
|
224
225
|
var SYNTHETIC_RUN_HEADER = "x-deepline-synthetic-run";
|
|
225
226
|
|
|
226
227
|
// src/http.ts
|
|
227
228
|
var MAX_DIAGNOSTIC_HEADER_LENGTH = 120;
|
|
229
|
+
var COWORK_NETWORK_HINT = "Claude Cowork appears to be running Deepline in a network-restricted sandbox. In Claude Desktop, open Settings > Capabilities, turn on Allow network egress, and set Domain allowlist to All domains for the Cowork session.";
|
|
228
230
|
var HttpClient = class {
|
|
229
231
|
constructor(config) {
|
|
230
232
|
this.config = config;
|
|
@@ -260,6 +262,7 @@ var HttpClient = class {
|
|
|
260
262
|
"User-Agent": `deepline-ts-sdk/${SDK_VERSION}`,
|
|
261
263
|
"X-Deepline-Client-Family": "sdk",
|
|
262
264
|
"X-Deepline-CLI-Family": "sdk",
|
|
265
|
+
"X-Deepline-Agent-Runtime": detectAgentRuntime(),
|
|
263
266
|
"X-Deepline-CLI-Version": SDK_VERSION,
|
|
264
267
|
"X-Deepline-SDK-Version": SDK_VERSION,
|
|
265
268
|
"X-Deepline-API-Contract": SDK_API_CONTRACT,
|
|
@@ -289,6 +292,10 @@ var HttpClient = class {
|
|
|
289
292
|
if (workerCallbackUrl?.trim()) {
|
|
290
293
|
headers[WORKER_CALLBACK_URL_OVERRIDE_HEADER] = workerCallbackUrl.trim();
|
|
291
294
|
}
|
|
295
|
+
const runtimeSchedulerSchema = typeof process !== "undefined" ? process.env?.DEEPLINE_RUNTIME_SCHEDULER_SCHEMA : void 0;
|
|
296
|
+
if (runtimeSchedulerSchema?.trim()) {
|
|
297
|
+
headers[RUNTIME_SCHEDULER_SCHEMA_OVERRIDE_HEADER] = runtimeSchedulerSchema.trim();
|
|
298
|
+
}
|
|
292
299
|
const syntheticRun = typeof process !== "undefined" ? process.env?.DEEPLINE_SYNTHETIC_RUN : void 0;
|
|
293
300
|
if (syntheticRun && syntheticRun.trim() && syntheticRun.trim() !== "0") {
|
|
294
301
|
headers[SYNTHETIC_RUN_HEADER] = "1";
|
|
@@ -358,12 +365,13 @@ var HttpClient = class {
|
|
|
358
365
|
parsed = body;
|
|
359
366
|
}
|
|
360
367
|
if (!response.ok) {
|
|
368
|
+
const retryableApiError = options?.retryApiErrors === true && isRetryableApiErrorResponse(response.status);
|
|
361
369
|
const htmlError = detectHtmlErrorBody(
|
|
362
370
|
body,
|
|
363
371
|
response.headers.get("content-type")
|
|
364
372
|
);
|
|
365
373
|
if (htmlError) {
|
|
366
|
-
|
|
374
|
+
lastError = new DeeplineError(
|
|
367
375
|
htmlError.message(response.status),
|
|
368
376
|
response.status,
|
|
369
377
|
"API_ERROR",
|
|
@@ -373,12 +381,23 @@ var HttpClient = class {
|
|
|
373
381
|
...htmlError.workerThrewException ? { workerThrewException: true } : {}
|
|
374
382
|
}
|
|
375
383
|
);
|
|
384
|
+
if (retryableApiError && attempt < this.config.maxRetries) {
|
|
385
|
+
retryAfterDelayMs = parseOptionalRetryAfter(response);
|
|
386
|
+
break;
|
|
387
|
+
}
|
|
388
|
+
throw lastError;
|
|
376
389
|
}
|
|
377
390
|
const errorValue = typeof parsed === "object" && parsed && "error" in parsed ? parsed.error : void 0;
|
|
378
391
|
const msg = typeof errorValue === "string" ? errorValue : errorValue && typeof errorValue === "object" && "message" in errorValue && typeof errorValue.message === "string" ? errorValue.message : typeof parsed === "object" && parsed && "message" in parsed && typeof parsed.message === "string" ? parsed.message : `HTTP ${response.status}`;
|
|
379
|
-
|
|
392
|
+
const apiErrorCode = errorValue && typeof errorValue === "object" && typeof errorValue.code === "string" ? errorValue.code : "API_ERROR";
|
|
393
|
+
lastError = new DeeplineError(msg, response.status, apiErrorCode, {
|
|
380
394
|
response: parsed
|
|
381
395
|
});
|
|
396
|
+
if (retryableApiError && attempt < this.config.maxRetries) {
|
|
397
|
+
retryAfterDelayMs = parseOptionalRetryAfter(response);
|
|
398
|
+
break;
|
|
399
|
+
}
|
|
400
|
+
throw lastError;
|
|
382
401
|
}
|
|
383
402
|
return parsed;
|
|
384
403
|
} catch (error) {
|
|
@@ -399,7 +418,7 @@ var HttpClient = class {
|
|
|
399
418
|
throw lastError;
|
|
400
419
|
}
|
|
401
420
|
const errorMessage = lastError?.message ? `Unable to connect to ${baseUrl}. ${lastError.message}` : `Unable to connect to ${baseUrl}. Is the computer able to access the url?`;
|
|
402
|
-
throw new DeeplineError(errorMessage);
|
|
421
|
+
throw new DeeplineError(withCoworkNetworkHint(errorMessage));
|
|
403
422
|
}
|
|
404
423
|
/**
|
|
405
424
|
* Send a GET request.
|
|
@@ -471,7 +490,9 @@ var HttpClient = class {
|
|
|
471
490
|
}
|
|
472
491
|
}
|
|
473
492
|
throw new DeeplineError(
|
|
474
|
-
|
|
493
|
+
withCoworkNetworkHint(
|
|
494
|
+
lastError?.message ? `Unable to stream from ${this.config.baseUrl}. ${lastError.message}` : `Unable to stream from ${this.config.baseUrl}.`
|
|
495
|
+
)
|
|
475
496
|
);
|
|
476
497
|
}
|
|
477
498
|
/**
|
|
@@ -481,11 +502,12 @@ var HttpClient = class {
|
|
|
481
502
|
* @param path - API path
|
|
482
503
|
* @param body - Request body (will be JSON-serialized)
|
|
483
504
|
*/
|
|
484
|
-
async post(path, body, headers) {
|
|
505
|
+
async post(path, body, headers, options) {
|
|
485
506
|
return this.request(path, {
|
|
486
507
|
method: "POST",
|
|
487
508
|
body,
|
|
488
|
-
headers
|
|
509
|
+
headers,
|
|
510
|
+
...options
|
|
489
511
|
});
|
|
490
512
|
}
|
|
491
513
|
async postFormData(path, formData, headers) {
|
|
@@ -495,8 +517,19 @@ var HttpClient = class {
|
|
|
495
517
|
headers
|
|
496
518
|
});
|
|
497
519
|
}
|
|
520
|
+
/**
|
|
521
|
+
* Send a PATCH request with a JSON body.
|
|
522
|
+
*
|
|
523
|
+
* @typeParam T - Expected response body type
|
|
524
|
+
* @param path - API path
|
|
525
|
+
* @param body - JSON-serializable request body
|
|
526
|
+
*/
|
|
498
527
|
async patch(path, body, headers) {
|
|
499
|
-
return this.request(path, {
|
|
528
|
+
return this.request(path, {
|
|
529
|
+
method: "PATCH",
|
|
530
|
+
body,
|
|
531
|
+
headers
|
|
532
|
+
});
|
|
500
533
|
}
|
|
501
534
|
/**
|
|
502
535
|
* Send a DELETE request.
|
|
@@ -515,6 +548,9 @@ function parseResponseBody(body) {
|
|
|
515
548
|
return body;
|
|
516
549
|
}
|
|
517
550
|
}
|
|
551
|
+
function isRetryableApiErrorResponse(status) {
|
|
552
|
+
return status === 408 || status === 425 || status >= 500 && status < 600;
|
|
553
|
+
}
|
|
518
554
|
function detectHtmlErrorBody(body, contentType) {
|
|
519
555
|
const trimmed = body.trim();
|
|
520
556
|
const lower = trimmed.toLowerCase();
|
|
@@ -554,6 +590,9 @@ function apiErrorMessage(parsed, status) {
|
|
|
554
590
|
return `HTTP ${status}`;
|
|
555
591
|
}
|
|
556
592
|
function parseRetryAfter(response) {
|
|
593
|
+
return parseOptionalRetryAfter(response) ?? 5e3;
|
|
594
|
+
}
|
|
595
|
+
function parseOptionalRetryAfter(response) {
|
|
557
596
|
const header = response.headers.get("retry-after");
|
|
558
597
|
if (header) {
|
|
559
598
|
const seconds = Number(header);
|
|
@@ -561,7 +600,7 @@ function parseRetryAfter(response) {
|
|
|
561
600
|
return seconds * 1e3;
|
|
562
601
|
}
|
|
563
602
|
}
|
|
564
|
-
return
|
|
603
|
+
return null;
|
|
565
604
|
}
|
|
566
605
|
function buildCandidateUrls(url) {
|
|
567
606
|
try {
|
|
@@ -618,6 +657,39 @@ function decodeSseFrame(frame) {
|
|
|
618
657
|
function sleep(ms) {
|
|
619
658
|
return new Promise((resolve2) => setTimeout(resolve2, ms));
|
|
620
659
|
}
|
|
660
|
+
function isTruthyEnv(name) {
|
|
661
|
+
const normalized = process.env[name]?.trim().toLowerCase();
|
|
662
|
+
return ["1", "true", "yes", "on"].includes(normalized ?? "");
|
|
663
|
+
}
|
|
664
|
+
function isCoworkLikeSandbox() {
|
|
665
|
+
const pluginMode = isTruthyEnv("DEEPLINE_PLUGIN_MODE");
|
|
666
|
+
const claudeRemote = isTruthyEnv("CLAUDE_CODE_REMOTE");
|
|
667
|
+
const projectDir = Boolean(process.env.CLAUDE_PROJECT_DIR?.trim());
|
|
668
|
+
const pluginRoot = Boolean(process.env.DEEPLINE_PLUGIN_ROOT?.trim());
|
|
669
|
+
const home = process.env.HOME?.trim() ?? "";
|
|
670
|
+
const sessionHome = home.startsWith("/sessions/");
|
|
671
|
+
return (pluginMode || pluginRoot) && (claudeRemote || projectDir || sessionHome);
|
|
672
|
+
}
|
|
673
|
+
function detectAgentRuntime() {
|
|
674
|
+
if (process.env.CODEX_THREAD_ID?.trim()) return "codex";
|
|
675
|
+
if (isCoworkLikeSandbox()) return "claude_cowork";
|
|
676
|
+
if (process.env.CLAUDECODE?.trim() === "1") return "claude_code";
|
|
677
|
+
if (process.env.CLINE_ACTIVE?.trim().toLowerCase() === "true") return "cline";
|
|
678
|
+
if (process.env.CURSOR_TRACE_ID?.trim() || process.env.CURSOR_AGENT?.trim()) {
|
|
679
|
+
return "cursor";
|
|
680
|
+
}
|
|
681
|
+
if (process.env.WINDSURF?.trim() || process.env.CASCADE?.trim()) {
|
|
682
|
+
return "windsurf";
|
|
683
|
+
}
|
|
684
|
+
return "unknown";
|
|
685
|
+
}
|
|
686
|
+
function withCoworkNetworkHint(message) {
|
|
687
|
+
if (!isCoworkLikeSandbox() || message.includes(COWORK_NETWORK_HINT)) {
|
|
688
|
+
return message;
|
|
689
|
+
}
|
|
690
|
+
return `${message}
|
|
691
|
+
${COWORK_NETWORK_HINT}`;
|
|
692
|
+
}
|
|
621
693
|
|
|
622
694
|
// src/stream-reconnect.ts
|
|
623
695
|
var STREAM_RECONNECT_BASE_DELAY_MS = 500;
|
|
@@ -847,6 +919,35 @@ function normalizePlayRunLiveStatus(value) {
|
|
|
847
919
|
function isTerminalPlayRunLiveStatus(status) {
|
|
848
920
|
return status === "completed" || status === "failed" || status === "cancelled" || status === "terminated" || status === "timed_out";
|
|
849
921
|
}
|
|
922
|
+
function isRecord2(value) {
|
|
923
|
+
return Boolean(value && typeof value === "object" && !Array.isArray(value));
|
|
924
|
+
}
|
|
925
|
+
function finiteNumber2(value) {
|
|
926
|
+
return typeof value === "number" && Number.isFinite(value) ? value : null;
|
|
927
|
+
}
|
|
928
|
+
function extractTerminalRunLogTail(result) {
|
|
929
|
+
if (!isRecord2(result) || !isRecord2(result._metadata)) {
|
|
930
|
+
return null;
|
|
931
|
+
}
|
|
932
|
+
const runLogTail = result._metadata.runLogTail;
|
|
933
|
+
if (!isRecord2(runLogTail) || !Array.isArray(runLogTail.tail)) {
|
|
934
|
+
return null;
|
|
935
|
+
}
|
|
936
|
+
const logTail = runLogTail.tail.filter(
|
|
937
|
+
(line) => typeof line === "string" && line.trim().length > 0
|
|
938
|
+
);
|
|
939
|
+
if (logTail.length === 0) {
|
|
940
|
+
return null;
|
|
941
|
+
}
|
|
942
|
+
const totalLogCount = Math.max(
|
|
943
|
+
finiteNumber2(runLogTail.totalLogCount) ?? logTail.length,
|
|
944
|
+
logTail.length
|
|
945
|
+
);
|
|
946
|
+
return {
|
|
947
|
+
logTail: logTail.slice(-LOG_TAIL_LIMIT),
|
|
948
|
+
totalLogCount
|
|
949
|
+
};
|
|
950
|
+
}
|
|
850
951
|
function buildSnapshotFromLedger(snapshot) {
|
|
851
952
|
const nodeStates = snapshot.orderedStepIds.map((stepId) => snapshot.stepsById[stepId]).filter((step) => Boolean(step)).map((step) => ({
|
|
852
953
|
nodeId: step.stepId,
|
|
@@ -893,6 +994,14 @@ function buildPlayRunStatusSnapshot(input) {
|
|
|
893
994
|
updatedAt: input.run.updatedAt ?? null,
|
|
894
995
|
finishedAt: input.run.finishedAt ?? null
|
|
895
996
|
});
|
|
997
|
+
const terminalRunLogTail = extractTerminalRunLogTail(input.run.result);
|
|
998
|
+
if (terminalRunLogTail && terminalRunLogTail.totalLogCount > ledgerSnapshot.totalLogCount) {
|
|
999
|
+
return buildSnapshotFromLedger({
|
|
1000
|
+
...ledgerSnapshot,
|
|
1001
|
+
logTail: terminalRunLogTail.logTail,
|
|
1002
|
+
totalLogCount: terminalRunLogTail.totalLogCount
|
|
1003
|
+
});
|
|
1004
|
+
}
|
|
896
1005
|
return buildSnapshotFromLedger(ledgerSnapshot);
|
|
897
1006
|
}
|
|
898
1007
|
function makeRunStreamEvent(input) {
|
|
@@ -1487,7 +1596,7 @@ function chunkRegisterPlayArtifacts(artifacts) {
|
|
|
1487
1596
|
return chunks;
|
|
1488
1597
|
}
|
|
1489
1598
|
var RUN_LOGS_PAGE_LIMIT = 1e3;
|
|
1490
|
-
function
|
|
1599
|
+
function isRecord3(value) {
|
|
1491
1600
|
return Boolean(value && typeof value === "object" && !Array.isArray(value));
|
|
1492
1601
|
}
|
|
1493
1602
|
function isPrebuiltPlayDescription(play) {
|
|
@@ -1589,7 +1698,7 @@ function updatePlayLiveStatusState(state, event) {
|
|
|
1589
1698
|
}
|
|
1590
1699
|
const runId = typeof payload.runId === "string" && payload.runId ? payload.runId : isPlayRunPackage(payload) ? payload.run.id : state.runId;
|
|
1591
1700
|
const status = normalizeLiveStatus(payload.status) ?? (isPlayRunPackage(payload) ? normalizeLiveStatus(payload.run.status) : null) ?? state.status;
|
|
1592
|
-
const progressPayload =
|
|
1701
|
+
const progressPayload = isRecord3(payload.progress) ? payload.progress : {};
|
|
1593
1702
|
if (event.type === "play.run.final_status" && state.logs.length === 0 && state.lastLogSeq === 0) {
|
|
1594
1703
|
const payloadLogs = readStringArray(payload.logs);
|
|
1595
1704
|
const progressLogs = readStringArray(progressPayload.logs);
|
|
@@ -1702,9 +1811,9 @@ var DeeplineClient = class {
|
|
|
1702
1811
|
return fields.length > 0 ? { fields } : schema;
|
|
1703
1812
|
}
|
|
1704
1813
|
schemaMetadata(schema, key) {
|
|
1705
|
-
if (!
|
|
1814
|
+
if (!isRecord3(schema)) return null;
|
|
1706
1815
|
const value = schema[key];
|
|
1707
|
-
return
|
|
1816
|
+
return isRecord3(value) ? value : null;
|
|
1708
1817
|
}
|
|
1709
1818
|
playRunCommand(play, options) {
|
|
1710
1819
|
const target = play.reference || play.name;
|
|
@@ -1751,7 +1860,7 @@ var DeeplineClient = class {
|
|
|
1751
1860
|
aliases,
|
|
1752
1861
|
inputSchema: options?.compact ? this.compactSchema(play.inputSchema) : play.inputSchema ?? null,
|
|
1753
1862
|
outputSchema: options?.compact ? this.compactSchema(play.outputSchema) : play.outputSchema ?? null,
|
|
1754
|
-
staticPipeline:
|
|
1863
|
+
staticPipeline: isRecord3(play.staticPipeline) ? play.staticPipeline : isRecord3(play.currentRevision?.staticPipeline) ? play.currentRevision.staticPipeline : isRecord3(play.liveRevision?.staticPipeline) ? play.liveRevision.staticPipeline : null,
|
|
1755
1864
|
...csvInput ? { csvInput } : {},
|
|
1756
1865
|
...rowOutputSchema ? { rowOutputSchema } : {},
|
|
1757
1866
|
runCommand,
|
|
@@ -1857,12 +1966,12 @@ var DeeplineClient = class {
|
|
|
1857
1966
|
* Returns everything from {@link ToolDefinition} plus pricing info, sample
|
|
1858
1967
|
* inputs/outputs, failure modes, and cost estimates.
|
|
1859
1968
|
*
|
|
1860
|
-
* @param toolId - Tool identifier (e.g. `"
|
|
1969
|
+
* @param toolId - Tool identifier (e.g. `"dropleads_search_people"`)
|
|
1861
1970
|
* @returns Full tool metadata
|
|
1862
1971
|
*
|
|
1863
1972
|
* @example
|
|
1864
1973
|
* ```typescript
|
|
1865
|
-
* const meta = await client.getTool('
|
|
1974
|
+
* const meta = await client.getTool('dropleads_search_people');
|
|
1866
1975
|
* console.log(`Cost: ${meta.estimatedCreditsRange} credits`);
|
|
1867
1976
|
* console.log(`Input schema:`, meta.inputSchema);
|
|
1868
1977
|
* ```
|
|
@@ -1894,7 +2003,8 @@ var DeeplineClient = class {
|
|
|
1894
2003
|
return this.http.post(
|
|
1895
2004
|
`/api/v2/integrations/${encodeURIComponent(toolId)}/execute`,
|
|
1896
2005
|
{ payload: input },
|
|
1897
|
-
headers
|
|
2006
|
+
headers,
|
|
2007
|
+
{ forbiddenAsApiError: true }
|
|
1898
2008
|
);
|
|
1899
2009
|
}
|
|
1900
2010
|
/**
|
|
@@ -1976,7 +2086,7 @@ var DeeplineClient = class {
|
|
|
1976
2086
|
...request.force ? { force: true } : {},
|
|
1977
2087
|
...typeof request.waitForCompletionMs === "number" ? { waitForCompletionMs: request.waitForCompletionMs } : {},
|
|
1978
2088
|
// Profile selection is the API's job, not the CLI's. The server
|
|
1979
|
-
//
|
|
2089
|
+
// defaults to workers_edge; tests and runtime probes that want a
|
|
1980
2090
|
// different profile pass `request.profile` explicitly.
|
|
1981
2091
|
...request.profile ? { profile: request.profile } : {}
|
|
1982
2092
|
}
|
|
@@ -2041,10 +2151,15 @@ var DeeplineClient = class {
|
|
|
2041
2151
|
sourceFiles: input.sourceFiles,
|
|
2042
2152
|
artifact: input.artifact
|
|
2043
2153
|
});
|
|
2044
|
-
return this.http.post(
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2154
|
+
return this.http.post(
|
|
2155
|
+
"/api/v2/plays/artifacts",
|
|
2156
|
+
{
|
|
2157
|
+
...input,
|
|
2158
|
+
compilerManifest
|
|
2159
|
+
},
|
|
2160
|
+
void 0,
|
|
2161
|
+
{ forbiddenAsApiError: true, retryApiErrors: true }
|
|
2162
|
+
);
|
|
2048
2163
|
}
|
|
2049
2164
|
/**
|
|
2050
2165
|
* Register multiple bundled play artifacts in one request.
|
|
@@ -2054,7 +2169,12 @@ var DeeplineClient = class {
|
|
|
2054
2169
|
*/
|
|
2055
2170
|
async registerPlayArtifacts(artifacts) {
|
|
2056
2171
|
if (artifacts.length === 0) {
|
|
2057
|
-
return this.http.post(
|
|
2172
|
+
return this.http.post(
|
|
2173
|
+
"/api/v2/plays/artifacts",
|
|
2174
|
+
{ artifacts },
|
|
2175
|
+
void 0,
|
|
2176
|
+
{ forbiddenAsApiError: true, retryApiErrors: true }
|
|
2177
|
+
);
|
|
2058
2178
|
}
|
|
2059
2179
|
const compiledArtifacts = await mapWithConcurrency(
|
|
2060
2180
|
artifacts,
|
|
@@ -2072,9 +2192,14 @@ var DeeplineClient = class {
|
|
|
2072
2192
|
const responses = [];
|
|
2073
2193
|
for (const chunk of chunkRegisterPlayArtifacts(compiledArtifacts)) {
|
|
2074
2194
|
responses.push(
|
|
2075
|
-
await this.http.post(
|
|
2076
|
-
artifacts
|
|
2077
|
-
|
|
2195
|
+
await this.http.post(
|
|
2196
|
+
"/api/v2/plays/artifacts",
|
|
2197
|
+
{
|
|
2198
|
+
artifacts: chunk
|
|
2199
|
+
},
|
|
2200
|
+
void 0,
|
|
2201
|
+
{ forbiddenAsApiError: true, retryApiErrors: true }
|
|
2202
|
+
)
|
|
2078
2203
|
);
|
|
2079
2204
|
}
|
|
2080
2205
|
return {
|
|
@@ -2879,7 +3004,9 @@ var DeeplineClient = class {
|
|
|
2879
3004
|
const encodedName = encodeURIComponent(name);
|
|
2880
3005
|
return this.http.post(
|
|
2881
3006
|
`/api/v2/plays/${encodedName}/live`,
|
|
2882
|
-
request
|
|
3007
|
+
request,
|
|
3008
|
+
void 0,
|
|
3009
|
+
{ forbiddenAsApiError: true }
|
|
2883
3010
|
);
|
|
2884
3011
|
}
|
|
2885
3012
|
/**
|
|
@@ -3395,7 +3522,7 @@ var TARGET_FALLBACK_KEYS = {
|
|
|
3395
3522
|
status: [/^email_status$/i, /^status$/i],
|
|
3396
3523
|
email_status: [/^email_status$/i, /^status$/i]
|
|
3397
3524
|
};
|
|
3398
|
-
function
|
|
3525
|
+
function isRecord4(value) {
|
|
3399
3526
|
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
3400
3527
|
}
|
|
3401
3528
|
function toV2RawToolOutputPath(path) {
|
|
@@ -3455,7 +3582,7 @@ function valuesAtSegments(current, segments, path = []) {
|
|
|
3455
3582
|
if (!Array.isArray(current)) return [];
|
|
3456
3583
|
return valuesAtSegments(current[segment], rest, [...path, segment]);
|
|
3457
3584
|
}
|
|
3458
|
-
if (!
|
|
3585
|
+
if (!isRecord4(current)) return [];
|
|
3459
3586
|
const directMatches = valuesAtSegments(current[segment], rest, [
|
|
3460
3587
|
...path,
|
|
3461
3588
|
segment
|
|
@@ -3485,7 +3612,7 @@ function getValuesAtPath(root, path) {
|
|
|
3485
3612
|
return valuesAtSegments(root, parsePath(path)).map((entry) => entry.value);
|
|
3486
3613
|
}
|
|
3487
3614
|
function toResultEnvelope(value) {
|
|
3488
|
-
if (
|
|
3615
|
+
if (isRecord4(value) && "data" in value) {
|
|
3489
3616
|
const envelope = { data: value.data };
|
|
3490
3617
|
if ("meta" in value) envelope.meta = value.meta;
|
|
3491
3618
|
return envelope;
|
|
@@ -3538,7 +3665,7 @@ function getAtPath(root, path) {
|
|
|
3538
3665
|
current = current[segment];
|
|
3539
3666
|
continue;
|
|
3540
3667
|
}
|
|
3541
|
-
if (!
|
|
3668
|
+
if (!isRecord4(current)) return void 0;
|
|
3542
3669
|
current = current[segment];
|
|
3543
3670
|
}
|
|
3544
3671
|
return current;
|
|
@@ -3555,7 +3682,7 @@ function normalizeString(value) {
|
|
|
3555
3682
|
}
|
|
3556
3683
|
function normalizeRows(value) {
|
|
3557
3684
|
if (!Array.isArray(value)) return null;
|
|
3558
|
-
return value.map((entry) =>
|
|
3685
|
+
return value.map((entry) => isRecord4(entry) ? entry : { value: entry });
|
|
3559
3686
|
}
|
|
3560
3687
|
function findFirstTargetByPath(result, paths) {
|
|
3561
3688
|
for (const path of paths ?? []) {
|
|
@@ -3614,7 +3741,7 @@ function findFirstTargetByKey(result, target, depth = 0, path = []) {
|
|
|
3614
3741
|
}
|
|
3615
3742
|
return null;
|
|
3616
3743
|
}
|
|
3617
|
-
if (!
|
|
3744
|
+
if (!isRecord4(result)) return null;
|
|
3618
3745
|
const patterns = TARGET_FALLBACK_KEYS[target] ?? [
|
|
3619
3746
|
new RegExp(`^${target}$`, "i")
|
|
3620
3747
|
];
|
|
@@ -3674,7 +3801,7 @@ function normalizeJobChangeStatus(value) {
|
|
|
3674
3801
|
function firstExperienceDate(value) {
|
|
3675
3802
|
if (!Array.isArray(value)) return null;
|
|
3676
3803
|
for (const entry of value) {
|
|
3677
|
-
if (!
|
|
3804
|
+
if (!isRecord4(entry)) continue;
|
|
3678
3805
|
const date = normalizeString(
|
|
3679
3806
|
entry.start_date ?? entry.started_at ?? entry.startDate
|
|
3680
3807
|
);
|
|
@@ -3683,10 +3810,10 @@ function firstExperienceDate(value) {
|
|
|
3683
3810
|
return null;
|
|
3684
3811
|
}
|
|
3685
3812
|
function normalizeJobChange(value) {
|
|
3686
|
-
const record =
|
|
3687
|
-
const nested =
|
|
3688
|
-
const output =
|
|
3689
|
-
const person =
|
|
3813
|
+
const record = isRecord4(value) ? value : {};
|
|
3814
|
+
const nested = isRecord4(record.job_change) ? record.job_change : record;
|
|
3815
|
+
const output = isRecord4(nested.output) ? nested.output : nested;
|
|
3816
|
+
const person = isRecord4(output.person) ? output.person : {};
|
|
3690
3817
|
const status = normalizeJobChangeStatus(
|
|
3691
3818
|
output.status ?? output.job_change_status ?? output.job_changed ?? output.changed
|
|
3692
3819
|
);
|
|
@@ -4091,6 +4218,7 @@ function createNamedPlayHandle(clientFactory, name) {
|
|
|
4091
4218
|
const started = await client.startPlayRun({
|
|
4092
4219
|
name,
|
|
4093
4220
|
...options?.revisionId ? { revisionId: options.revisionId } : {},
|
|
4221
|
+
...options?.profile ? { profile: options.profile } : {},
|
|
4094
4222
|
input
|
|
4095
4223
|
});
|
|
4096
4224
|
return new DeeplinePlayJobImpl(client, started.workflowId);
|
|
@@ -4120,7 +4248,7 @@ var DeeplineContext = class {
|
|
|
4120
4248
|
* @example
|
|
4121
4249
|
* ```typescript
|
|
4122
4250
|
* const tools = await deepline.tools.list();
|
|
4123
|
-
* const meta = await deepline.tools.get('
|
|
4251
|
+
* const meta = await deepline.tools.get('dropleads_search_people');
|
|
4124
4252
|
* const companyLookup = await deepline.tools.execute('test_company_search', { domain: 'stripe.com' });
|
|
4125
4253
|
* const company = companyLookup.toolResponse.raw;
|
|
4126
4254
|
* ```
|
|
@@ -4256,11 +4384,11 @@ var Deepline = class {
|
|
|
4256
4384
|
return new DeeplineContext(options);
|
|
4257
4385
|
}
|
|
4258
4386
|
};
|
|
4259
|
-
function
|
|
4387
|
+
function isRecord5(value) {
|
|
4260
4388
|
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
4261
4389
|
}
|
|
4262
4390
|
function stringArrayRecord(value) {
|
|
4263
|
-
if (!
|
|
4391
|
+
if (!isRecord5(value)) return {};
|
|
4264
4392
|
return Object.fromEntries(
|
|
4265
4393
|
Object.entries(value).map(([key, paths]) => [
|
|
4266
4394
|
key,
|
|
@@ -4272,7 +4400,7 @@ function stringArray(value) {
|
|
|
4272
4400
|
return Array.isArray(value) ? value.map(String) : [];
|
|
4273
4401
|
}
|
|
4274
4402
|
function emailStatusExtractorConfig(value) {
|
|
4275
|
-
if (!
|
|
4403
|
+
if (!isRecord5(value)) return void 0;
|
|
4276
4404
|
const readPaths = (key) => {
|
|
4277
4405
|
const paths = stringArray(value[key]).map((path) => path.trim()).filter(Boolean);
|
|
4278
4406
|
return paths.length > 0 ? paths : void 0;
|
|
@@ -4299,7 +4427,7 @@ function emailStatusExtractorConfig(value) {
|
|
|
4299
4427
|
const paths = readPaths(key);
|
|
4300
4428
|
if (paths) config[key] = paths;
|
|
4301
4429
|
}
|
|
4302
|
-
if (
|
|
4430
|
+
if (isRecord5(value.statusMap)) {
|
|
4303
4431
|
config.statusMap = value.statusMap;
|
|
4304
4432
|
}
|
|
4305
4433
|
if (Array.isArray(value.rules)) {
|
|
@@ -4308,10 +4436,10 @@ function emailStatusExtractorConfig(value) {
|
|
|
4308
4436
|
return config;
|
|
4309
4437
|
}
|
|
4310
4438
|
function extractorDescriptorRecord(value) {
|
|
4311
|
-
if (!
|
|
4439
|
+
if (!isRecord5(value)) return {};
|
|
4312
4440
|
return Object.fromEntries(
|
|
4313
4441
|
Object.entries(value).flatMap(([key, descriptor]) => {
|
|
4314
|
-
if (!
|
|
4442
|
+
if (!isRecord5(descriptor)) return [];
|
|
4315
4443
|
const paths = stringArray(descriptor.paths).map((path) => path.trim()).filter(Boolean);
|
|
4316
4444
|
if (paths.length === 0) return [];
|
|
4317
4445
|
const transforms = stringArray(descriptor.transforms).map((transform) => transform.trim()).filter(Boolean);
|
|
@@ -4334,14 +4462,14 @@ function extractorDescriptorRecord(value) {
|
|
|
4334
4462
|
function toolExecutionEnvelopeToResult(fallbackToolId, response) {
|
|
4335
4463
|
const raw = response.toolResponse?.raw ?? null;
|
|
4336
4464
|
const meta = response.toolResponse?.meta;
|
|
4337
|
-
const metadata =
|
|
4338
|
-
const toolMetadata =
|
|
4465
|
+
const metadata = isRecord5(response._metadata) ? response._metadata.tool : null;
|
|
4466
|
+
const toolMetadata = isRecord5(metadata) ? metadata : {};
|
|
4339
4467
|
return createToolExecuteResult({
|
|
4340
4468
|
status: typeof response.status === "string" ? response.status : "completed",
|
|
4341
4469
|
jobId: typeof response.job_id === "string" ? response.job_id : void 0,
|
|
4342
4470
|
result: {
|
|
4343
4471
|
data: raw,
|
|
4344
|
-
...
|
|
4472
|
+
...isRecord5(meta) ? { meta } : {}
|
|
4345
4473
|
},
|
|
4346
4474
|
metadata: {
|
|
4347
4475
|
toolId: typeof toolMetadata.toolId === "string" ? toolMetadata.toolId : fallbackToolId,
|
|
@@ -4355,7 +4483,7 @@ function toolExecutionEnvelopeToResult(fallbackToolId, response) {
|
|
|
4355
4483
|
cached: false,
|
|
4356
4484
|
source: "live"
|
|
4357
4485
|
},
|
|
4358
|
-
meta:
|
|
4486
|
+
meta: isRecord5(response.meta) ? response.meta : void 0
|
|
4359
4487
|
});
|
|
4360
4488
|
}
|
|
4361
4489
|
function defineInput(schema) {
|