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.
Files changed (45) hide show
  1. package/dist/cli/index.js +2849 -1407
  2. package/dist/cli/index.mjs +2587 -1152
  3. package/dist/index.d.mts +81 -17
  4. package/dist/index.d.ts +81 -17
  5. package/dist/index.js +179 -51
  6. package/dist/index.mjs +179 -51
  7. package/dist/repo/apps/play-runner-workers/src/child-play-submit.ts +196 -0
  8. package/dist/repo/apps/play-runner-workers/src/coordinator-entry.ts +42 -21
  9. package/dist/repo/apps/play-runner-workers/src/entry.ts +162 -320
  10. package/dist/repo/apps/play-runner-workers/src/runtime/csv-rows.ts +102 -0
  11. package/dist/repo/apps/play-runner-workers/src/runtime/dataset-handles.ts +8 -3
  12. package/dist/repo/apps/play-runner-workers/src/runtime/receipts.ts +18 -27
  13. package/dist/repo/apps/play-runner-workers/src/workflow-instance-create.ts +44 -0
  14. package/dist/repo/apps/play-runner-workers/src/workflow-retry.ts +7 -11
  15. package/dist/repo/sdk/src/client.ts +35 -12
  16. package/dist/repo/sdk/src/errors.ts +2 -2
  17. package/dist/repo/sdk/src/http.ts +109 -9
  18. package/dist/repo/sdk/src/index.ts +4 -0
  19. package/dist/repo/sdk/src/play.ts +77 -7
  20. package/dist/repo/sdk/src/plays/bundle-play-file.ts +5 -1
  21. package/dist/repo/sdk/src/release.ts +14 -11
  22. package/dist/repo/sdk/src/tool-output.ts +2 -2
  23. package/dist/repo/sdk/src/types.ts +9 -6
  24. package/dist/repo/shared_libs/play-data-plane/cell-policy.ts +76 -0
  25. package/dist/repo/shared_libs/play-data-plane/column-names.ts +17 -0
  26. package/dist/repo/shared_libs/play-data-plane/sheet-contract.ts +190 -0
  27. package/dist/repo/shared_libs/play-runtime/coordinator-headers.ts +2 -0
  28. package/dist/repo/shared_libs/play-runtime/db-session.ts +4 -0
  29. package/dist/repo/shared_libs/play-runtime/fullenrich-batching.ts +229 -0
  30. package/dist/repo/shared_libs/play-runtime/governor/policy.ts +1 -1
  31. package/dist/repo/shared_libs/play-runtime/play-runtime-batching-registry.ts +20 -0
  32. package/dist/repo/shared_libs/play-runtime/providers.ts +5 -24
  33. package/dist/repo/shared_libs/play-runtime/run-failure.ts +20 -12
  34. package/dist/repo/shared_libs/play-runtime/run-ledger.ts +115 -25
  35. package/dist/repo/shared_libs/play-runtime/run-snapshot-stream.ts +49 -0
  36. package/dist/repo/shared_libs/play-runtime/scheduler-backend.ts +22 -9
  37. package/dist/repo/shared_libs/play-runtime/secret-redaction.ts +15 -0
  38. package/dist/repo/shared_libs/play-runtime/work-receipts.ts +1 -0
  39. package/dist/repo/shared_libs/plays/bundling/index.ts +69 -11
  40. package/dist/repo/shared_libs/plays/static-pipeline.ts +4 -14
  41. package/dist/repo/shared_libs/security/outbound-url-policy.ts +238 -0
  42. package/dist/repo/shared_libs/security/safe-fetch.ts +118 -0
  43. package/dist/viewer/viewer.css +617 -0
  44. package/dist/viewer/viewer.js +1496 -0
  45. package/package.json +5 -1
package/dist/index.js CHANGED
@@ -266,7 +266,7 @@ var SDK_RELEASE = {
266
266
  // preflight (existence, data rows, quotes, duplicate headers), HTML error
267
267
  // scrubbing, and word-boundary watch truncation.
268
268
  // 0.1.103 ships the refined SDK CLI command surface.
269
- // 0.1.104 ships postgres_fast suspension/billing parity and runtime worker hardening.
269
+ // 0.1.104 shipped the retired Postgres scheduler suspension/billing parity and runtime worker hardening.
270
270
  // 0.1.105 ships the billing catalog surface: billing plans, subscribe,
271
271
  // subscription status/cancel, invoices, and the client.billing namespace.
272
272
  // 0.1.106 ships play cell provenance metadata and v2 preview retry hardening.
@@ -274,10 +274,10 @@ var SDK_RELEASE = {
274
274
  // skill on the sdk sync surface, and the people-search-to-email prebuilt.
275
275
  // 0.1.108 ships explicit dataset column/tool recompute policy and removes
276
276
  // the SDK enrich generator's one-second stale policy.
277
- version: "0.1.108",
277
+ version: "0.1.110",
278
278
  apiContract: "2026-06-dataset-column-cell-stale-hard-cutover",
279
279
  supportPolicy: {
280
- latest: "0.1.108",
280
+ latest: "0.1.110",
281
281
  minimumSupported: "0.1.53",
282
282
  deprecatedBelow: "0.1.53",
283
283
  commandMinimumSupported: [
@@ -299,10 +299,12 @@ var SDK_API_CONTRACT = SDK_RELEASE.apiContract;
299
299
  var COORDINATOR_INTERNAL_TOKEN_HEADER = "x-deepline-internal-token";
300
300
  var COORDINATOR_URL_OVERRIDE_HEADER = "x-deepline-coordinator-url";
301
301
  var WORKER_CALLBACK_URL_OVERRIDE_HEADER = "x-deepline-worker-callback-url";
302
+ var RUNTIME_SCHEDULER_SCHEMA_OVERRIDE_HEADER = "x-deepline-runtime-scheduler-schema";
302
303
  var SYNTHETIC_RUN_HEADER = "x-deepline-synthetic-run";
303
304
 
304
305
  // src/http.ts
305
306
  var MAX_DIAGNOSTIC_HEADER_LENGTH = 120;
307
+ 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.";
306
308
  var HttpClient = class {
307
309
  constructor(config) {
308
310
  this.config = config;
@@ -338,6 +340,7 @@ var HttpClient = class {
338
340
  "User-Agent": `deepline-ts-sdk/${SDK_VERSION}`,
339
341
  "X-Deepline-Client-Family": "sdk",
340
342
  "X-Deepline-CLI-Family": "sdk",
343
+ "X-Deepline-Agent-Runtime": detectAgentRuntime(),
341
344
  "X-Deepline-CLI-Version": SDK_VERSION,
342
345
  "X-Deepline-SDK-Version": SDK_VERSION,
343
346
  "X-Deepline-API-Contract": SDK_API_CONTRACT,
@@ -367,6 +370,10 @@ var HttpClient = class {
367
370
  if (workerCallbackUrl?.trim()) {
368
371
  headers[WORKER_CALLBACK_URL_OVERRIDE_HEADER] = workerCallbackUrl.trim();
369
372
  }
373
+ const runtimeSchedulerSchema = typeof process !== "undefined" ? process.env?.DEEPLINE_RUNTIME_SCHEDULER_SCHEMA : void 0;
374
+ if (runtimeSchedulerSchema?.trim()) {
375
+ headers[RUNTIME_SCHEDULER_SCHEMA_OVERRIDE_HEADER] = runtimeSchedulerSchema.trim();
376
+ }
370
377
  const syntheticRun = typeof process !== "undefined" ? process.env?.DEEPLINE_SYNTHETIC_RUN : void 0;
371
378
  if (syntheticRun && syntheticRun.trim() && syntheticRun.trim() !== "0") {
372
379
  headers[SYNTHETIC_RUN_HEADER] = "1";
@@ -436,12 +443,13 @@ var HttpClient = class {
436
443
  parsed = body;
437
444
  }
438
445
  if (!response.ok) {
446
+ const retryableApiError = options?.retryApiErrors === true && isRetryableApiErrorResponse(response.status);
439
447
  const htmlError = detectHtmlErrorBody(
440
448
  body,
441
449
  response.headers.get("content-type")
442
450
  );
443
451
  if (htmlError) {
444
- throw new DeeplineError(
452
+ lastError = new DeeplineError(
445
453
  htmlError.message(response.status),
446
454
  response.status,
447
455
  "API_ERROR",
@@ -451,12 +459,23 @@ var HttpClient = class {
451
459
  ...htmlError.workerThrewException ? { workerThrewException: true } : {}
452
460
  }
453
461
  );
462
+ if (retryableApiError && attempt < this.config.maxRetries) {
463
+ retryAfterDelayMs = parseOptionalRetryAfter(response);
464
+ break;
465
+ }
466
+ throw lastError;
454
467
  }
455
468
  const errorValue = typeof parsed === "object" && parsed && "error" in parsed ? parsed.error : void 0;
456
469
  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}`;
457
- throw new DeeplineError(msg, response.status, "API_ERROR", {
470
+ const apiErrorCode = errorValue && typeof errorValue === "object" && typeof errorValue.code === "string" ? errorValue.code : "API_ERROR";
471
+ lastError = new DeeplineError(msg, response.status, apiErrorCode, {
458
472
  response: parsed
459
473
  });
474
+ if (retryableApiError && attempt < this.config.maxRetries) {
475
+ retryAfterDelayMs = parseOptionalRetryAfter(response);
476
+ break;
477
+ }
478
+ throw lastError;
460
479
  }
461
480
  return parsed;
462
481
  } catch (error) {
@@ -477,7 +496,7 @@ var HttpClient = class {
477
496
  throw lastError;
478
497
  }
479
498
  const errorMessage = lastError?.message ? `Unable to connect to ${baseUrl}. ${lastError.message}` : `Unable to connect to ${baseUrl}. Is the computer able to access the url?`;
480
- throw new DeeplineError(errorMessage);
499
+ throw new DeeplineError(withCoworkNetworkHint(errorMessage));
481
500
  }
482
501
  /**
483
502
  * Send a GET request.
@@ -549,7 +568,9 @@ var HttpClient = class {
549
568
  }
550
569
  }
551
570
  throw new DeeplineError(
552
- lastError?.message ? `Unable to stream from ${this.config.baseUrl}. ${lastError.message}` : `Unable to stream from ${this.config.baseUrl}.`
571
+ withCoworkNetworkHint(
572
+ lastError?.message ? `Unable to stream from ${this.config.baseUrl}. ${lastError.message}` : `Unable to stream from ${this.config.baseUrl}.`
573
+ )
553
574
  );
554
575
  }
555
576
  /**
@@ -559,11 +580,12 @@ var HttpClient = class {
559
580
  * @param path - API path
560
581
  * @param body - Request body (will be JSON-serialized)
561
582
  */
562
- async post(path, body, headers) {
583
+ async post(path, body, headers, options) {
563
584
  return this.request(path, {
564
585
  method: "POST",
565
586
  body,
566
- headers
587
+ headers,
588
+ ...options
567
589
  });
568
590
  }
569
591
  async postFormData(path, formData, headers) {
@@ -573,8 +595,19 @@ var HttpClient = class {
573
595
  headers
574
596
  });
575
597
  }
598
+ /**
599
+ * Send a PATCH request with a JSON body.
600
+ *
601
+ * @typeParam T - Expected response body type
602
+ * @param path - API path
603
+ * @param body - JSON-serializable request body
604
+ */
576
605
  async patch(path, body, headers) {
577
- return this.request(path, { method: "PATCH", body, headers });
606
+ return this.request(path, {
607
+ method: "PATCH",
608
+ body,
609
+ headers
610
+ });
578
611
  }
579
612
  /**
580
613
  * Send a DELETE request.
@@ -593,6 +626,9 @@ function parseResponseBody(body) {
593
626
  return body;
594
627
  }
595
628
  }
629
+ function isRetryableApiErrorResponse(status) {
630
+ return status === 408 || status === 425 || status >= 500 && status < 600;
631
+ }
596
632
  function detectHtmlErrorBody(body, contentType) {
597
633
  const trimmed = body.trim();
598
634
  const lower = trimmed.toLowerCase();
@@ -632,6 +668,9 @@ function apiErrorMessage(parsed, status) {
632
668
  return `HTTP ${status}`;
633
669
  }
634
670
  function parseRetryAfter(response) {
671
+ return parseOptionalRetryAfter(response) ?? 5e3;
672
+ }
673
+ function parseOptionalRetryAfter(response) {
635
674
  const header = response.headers.get("retry-after");
636
675
  if (header) {
637
676
  const seconds = Number(header);
@@ -639,7 +678,7 @@ function parseRetryAfter(response) {
639
678
  return seconds * 1e3;
640
679
  }
641
680
  }
642
- return 5e3;
681
+ return null;
643
682
  }
644
683
  function buildCandidateUrls(url) {
645
684
  try {
@@ -696,6 +735,39 @@ function decodeSseFrame(frame) {
696
735
  function sleep(ms) {
697
736
  return new Promise((resolve2) => setTimeout(resolve2, ms));
698
737
  }
738
+ function isTruthyEnv(name) {
739
+ const normalized = process.env[name]?.trim().toLowerCase();
740
+ return ["1", "true", "yes", "on"].includes(normalized ?? "");
741
+ }
742
+ function isCoworkLikeSandbox() {
743
+ const pluginMode = isTruthyEnv("DEEPLINE_PLUGIN_MODE");
744
+ const claudeRemote = isTruthyEnv("CLAUDE_CODE_REMOTE");
745
+ const projectDir = Boolean(process.env.CLAUDE_PROJECT_DIR?.trim());
746
+ const pluginRoot = Boolean(process.env.DEEPLINE_PLUGIN_ROOT?.trim());
747
+ const home = process.env.HOME?.trim() ?? "";
748
+ const sessionHome = home.startsWith("/sessions/");
749
+ return (pluginMode || pluginRoot) && (claudeRemote || projectDir || sessionHome);
750
+ }
751
+ function detectAgentRuntime() {
752
+ if (process.env.CODEX_THREAD_ID?.trim()) return "codex";
753
+ if (isCoworkLikeSandbox()) return "claude_cowork";
754
+ if (process.env.CLAUDECODE?.trim() === "1") return "claude_code";
755
+ if (process.env.CLINE_ACTIVE?.trim().toLowerCase() === "true") return "cline";
756
+ if (process.env.CURSOR_TRACE_ID?.trim() || process.env.CURSOR_AGENT?.trim()) {
757
+ return "cursor";
758
+ }
759
+ if (process.env.WINDSURF?.trim() || process.env.CASCADE?.trim()) {
760
+ return "windsurf";
761
+ }
762
+ return "unknown";
763
+ }
764
+ function withCoworkNetworkHint(message) {
765
+ if (!isCoworkLikeSandbox() || message.includes(COWORK_NETWORK_HINT)) {
766
+ return message;
767
+ }
768
+ return `${message}
769
+ ${COWORK_NETWORK_HINT}`;
770
+ }
699
771
 
700
772
  // src/stream-reconnect.ts
701
773
  var STREAM_RECONNECT_BASE_DELAY_MS = 500;
@@ -925,6 +997,35 @@ function normalizePlayRunLiveStatus(value) {
925
997
  function isTerminalPlayRunLiveStatus(status) {
926
998
  return status === "completed" || status === "failed" || status === "cancelled" || status === "terminated" || status === "timed_out";
927
999
  }
1000
+ function isRecord2(value) {
1001
+ return Boolean(value && typeof value === "object" && !Array.isArray(value));
1002
+ }
1003
+ function finiteNumber2(value) {
1004
+ return typeof value === "number" && Number.isFinite(value) ? value : null;
1005
+ }
1006
+ function extractTerminalRunLogTail(result) {
1007
+ if (!isRecord2(result) || !isRecord2(result._metadata)) {
1008
+ return null;
1009
+ }
1010
+ const runLogTail = result._metadata.runLogTail;
1011
+ if (!isRecord2(runLogTail) || !Array.isArray(runLogTail.tail)) {
1012
+ return null;
1013
+ }
1014
+ const logTail = runLogTail.tail.filter(
1015
+ (line) => typeof line === "string" && line.trim().length > 0
1016
+ );
1017
+ if (logTail.length === 0) {
1018
+ return null;
1019
+ }
1020
+ const totalLogCount = Math.max(
1021
+ finiteNumber2(runLogTail.totalLogCount) ?? logTail.length,
1022
+ logTail.length
1023
+ );
1024
+ return {
1025
+ logTail: logTail.slice(-LOG_TAIL_LIMIT),
1026
+ totalLogCount
1027
+ };
1028
+ }
928
1029
  function buildSnapshotFromLedger(snapshot) {
929
1030
  const nodeStates = snapshot.orderedStepIds.map((stepId) => snapshot.stepsById[stepId]).filter((step) => Boolean(step)).map((step) => ({
930
1031
  nodeId: step.stepId,
@@ -971,6 +1072,14 @@ function buildPlayRunStatusSnapshot(input) {
971
1072
  updatedAt: input.run.updatedAt ?? null,
972
1073
  finishedAt: input.run.finishedAt ?? null
973
1074
  });
1075
+ const terminalRunLogTail = extractTerminalRunLogTail(input.run.result);
1076
+ if (terminalRunLogTail && terminalRunLogTail.totalLogCount > ledgerSnapshot.totalLogCount) {
1077
+ return buildSnapshotFromLedger({
1078
+ ...ledgerSnapshot,
1079
+ logTail: terminalRunLogTail.logTail,
1080
+ totalLogCount: terminalRunLogTail.totalLogCount
1081
+ });
1082
+ }
974
1083
  return buildSnapshotFromLedger(ledgerSnapshot);
975
1084
  }
976
1085
  function makeRunStreamEvent(input) {
@@ -1565,7 +1674,7 @@ function chunkRegisterPlayArtifacts(artifacts) {
1565
1674
  return chunks;
1566
1675
  }
1567
1676
  var RUN_LOGS_PAGE_LIMIT = 1e3;
1568
- function isRecord2(value) {
1677
+ function isRecord3(value) {
1569
1678
  return Boolean(value && typeof value === "object" && !Array.isArray(value));
1570
1679
  }
1571
1680
  function isPrebuiltPlayDescription(play) {
@@ -1667,7 +1776,7 @@ function updatePlayLiveStatusState(state, event) {
1667
1776
  }
1668
1777
  const runId = typeof payload.runId === "string" && payload.runId ? payload.runId : isPlayRunPackage(payload) ? payload.run.id : state.runId;
1669
1778
  const status = normalizeLiveStatus(payload.status) ?? (isPlayRunPackage(payload) ? normalizeLiveStatus(payload.run.status) : null) ?? state.status;
1670
- const progressPayload = isRecord2(payload.progress) ? payload.progress : {};
1779
+ const progressPayload = isRecord3(payload.progress) ? payload.progress : {};
1671
1780
  if (event.type === "play.run.final_status" && state.logs.length === 0 && state.lastLogSeq === 0) {
1672
1781
  const payloadLogs = readStringArray(payload.logs);
1673
1782
  const progressLogs = readStringArray(progressPayload.logs);
@@ -1780,9 +1889,9 @@ var DeeplineClient = class {
1780
1889
  return fields.length > 0 ? { fields } : schema;
1781
1890
  }
1782
1891
  schemaMetadata(schema, key) {
1783
- if (!isRecord2(schema)) return null;
1892
+ if (!isRecord3(schema)) return null;
1784
1893
  const value = schema[key];
1785
- return isRecord2(value) ? value : null;
1894
+ return isRecord3(value) ? value : null;
1786
1895
  }
1787
1896
  playRunCommand(play, options) {
1788
1897
  const target = play.reference || play.name;
@@ -1829,7 +1938,7 @@ var DeeplineClient = class {
1829
1938
  aliases,
1830
1939
  inputSchema: options?.compact ? this.compactSchema(play.inputSchema) : play.inputSchema ?? null,
1831
1940
  outputSchema: options?.compact ? this.compactSchema(play.outputSchema) : play.outputSchema ?? null,
1832
- staticPipeline: isRecord2(play.staticPipeline) ? play.staticPipeline : isRecord2(play.currentRevision?.staticPipeline) ? play.currentRevision.staticPipeline : isRecord2(play.liveRevision?.staticPipeline) ? play.liveRevision.staticPipeline : null,
1941
+ staticPipeline: isRecord3(play.staticPipeline) ? play.staticPipeline : isRecord3(play.currentRevision?.staticPipeline) ? play.currentRevision.staticPipeline : isRecord3(play.liveRevision?.staticPipeline) ? play.liveRevision.staticPipeline : null,
1833
1942
  ...csvInput ? { csvInput } : {},
1834
1943
  ...rowOutputSchema ? { rowOutputSchema } : {},
1835
1944
  runCommand,
@@ -1935,12 +2044,12 @@ var DeeplineClient = class {
1935
2044
  * Returns everything from {@link ToolDefinition} plus pricing info, sample
1936
2045
  * inputs/outputs, failure modes, and cost estimates.
1937
2046
  *
1938
- * @param toolId - Tool identifier (e.g. `"apollo_people_search"`)
2047
+ * @param toolId - Tool identifier (e.g. `"dropleads_search_people"`)
1939
2048
  * @returns Full tool metadata
1940
2049
  *
1941
2050
  * @example
1942
2051
  * ```typescript
1943
- * const meta = await client.getTool('apollo_people_search');
2052
+ * const meta = await client.getTool('dropleads_search_people');
1944
2053
  * console.log(`Cost: ${meta.estimatedCreditsRange} credits`);
1945
2054
  * console.log(`Input schema:`, meta.inputSchema);
1946
2055
  * ```
@@ -1972,7 +2081,8 @@ var DeeplineClient = class {
1972
2081
  return this.http.post(
1973
2082
  `/api/v2/integrations/${encodeURIComponent(toolId)}/execute`,
1974
2083
  { payload: input },
1975
- headers
2084
+ headers,
2085
+ { forbiddenAsApiError: true }
1976
2086
  );
1977
2087
  }
1978
2088
  /**
@@ -2054,7 +2164,7 @@ var DeeplineClient = class {
2054
2164
  ...request.force ? { force: true } : {},
2055
2165
  ...typeof request.waitForCompletionMs === "number" ? { waitForCompletionMs: request.waitForCompletionMs } : {},
2056
2166
  // Profile selection is the API's job, not the CLI's. The server
2057
- // hardcodes workers_edge as the default; tests that want a
2167
+ // defaults to workers_edge; tests and runtime probes that want a
2058
2168
  // different profile pass `request.profile` explicitly.
2059
2169
  ...request.profile ? { profile: request.profile } : {}
2060
2170
  }
@@ -2119,10 +2229,15 @@ var DeeplineClient = class {
2119
2229
  sourceFiles: input.sourceFiles,
2120
2230
  artifact: input.artifact
2121
2231
  });
2122
- return this.http.post("/api/v2/plays/artifacts", {
2123
- ...input,
2124
- compilerManifest
2125
- });
2232
+ return this.http.post(
2233
+ "/api/v2/plays/artifacts",
2234
+ {
2235
+ ...input,
2236
+ compilerManifest
2237
+ },
2238
+ void 0,
2239
+ { forbiddenAsApiError: true, retryApiErrors: true }
2240
+ );
2126
2241
  }
2127
2242
  /**
2128
2243
  * Register multiple bundled play artifacts in one request.
@@ -2132,7 +2247,12 @@ var DeeplineClient = class {
2132
2247
  */
2133
2248
  async registerPlayArtifacts(artifacts) {
2134
2249
  if (artifacts.length === 0) {
2135
- return this.http.post("/api/v2/plays/artifacts", { artifacts });
2250
+ return this.http.post(
2251
+ "/api/v2/plays/artifacts",
2252
+ { artifacts },
2253
+ void 0,
2254
+ { forbiddenAsApiError: true, retryApiErrors: true }
2255
+ );
2136
2256
  }
2137
2257
  const compiledArtifacts = await mapWithConcurrency(
2138
2258
  artifacts,
@@ -2150,9 +2270,14 @@ var DeeplineClient = class {
2150
2270
  const responses = [];
2151
2271
  for (const chunk of chunkRegisterPlayArtifacts(compiledArtifacts)) {
2152
2272
  responses.push(
2153
- await this.http.post("/api/v2/plays/artifacts", {
2154
- artifacts: chunk
2155
- })
2273
+ await this.http.post(
2274
+ "/api/v2/plays/artifacts",
2275
+ {
2276
+ artifacts: chunk
2277
+ },
2278
+ void 0,
2279
+ { forbiddenAsApiError: true, retryApiErrors: true }
2280
+ )
2156
2281
  );
2157
2282
  }
2158
2283
  return {
@@ -2957,7 +3082,9 @@ var DeeplineClient = class {
2957
3082
  const encodedName = encodeURIComponent(name);
2958
3083
  return this.http.post(
2959
3084
  `/api/v2/plays/${encodedName}/live`,
2960
- request
3085
+ request,
3086
+ void 0,
3087
+ { forbiddenAsApiError: true }
2961
3088
  );
2962
3089
  }
2963
3090
  /**
@@ -3473,7 +3600,7 @@ var TARGET_FALLBACK_KEYS = {
3473
3600
  status: [/^email_status$/i, /^status$/i],
3474
3601
  email_status: [/^email_status$/i, /^status$/i]
3475
3602
  };
3476
- function isRecord3(value) {
3603
+ function isRecord4(value) {
3477
3604
  return Boolean(value) && typeof value === "object" && !Array.isArray(value);
3478
3605
  }
3479
3606
  function toV2RawToolOutputPath(path) {
@@ -3533,7 +3660,7 @@ function valuesAtSegments(current, segments, path = []) {
3533
3660
  if (!Array.isArray(current)) return [];
3534
3661
  return valuesAtSegments(current[segment], rest, [...path, segment]);
3535
3662
  }
3536
- if (!isRecord3(current)) return [];
3663
+ if (!isRecord4(current)) return [];
3537
3664
  const directMatches = valuesAtSegments(current[segment], rest, [
3538
3665
  ...path,
3539
3666
  segment
@@ -3563,7 +3690,7 @@ function getValuesAtPath(root, path) {
3563
3690
  return valuesAtSegments(root, parsePath(path)).map((entry) => entry.value);
3564
3691
  }
3565
3692
  function toResultEnvelope(value) {
3566
- if (isRecord3(value) && "data" in value) {
3693
+ if (isRecord4(value) && "data" in value) {
3567
3694
  const envelope = { data: value.data };
3568
3695
  if ("meta" in value) envelope.meta = value.meta;
3569
3696
  return envelope;
@@ -3616,7 +3743,7 @@ function getAtPath(root, path) {
3616
3743
  current = current[segment];
3617
3744
  continue;
3618
3745
  }
3619
- if (!isRecord3(current)) return void 0;
3746
+ if (!isRecord4(current)) return void 0;
3620
3747
  current = current[segment];
3621
3748
  }
3622
3749
  return current;
@@ -3633,7 +3760,7 @@ function normalizeString(value) {
3633
3760
  }
3634
3761
  function normalizeRows(value) {
3635
3762
  if (!Array.isArray(value)) return null;
3636
- return value.map((entry) => isRecord3(entry) ? entry : { value: entry });
3763
+ return value.map((entry) => isRecord4(entry) ? entry : { value: entry });
3637
3764
  }
3638
3765
  function findFirstTargetByPath(result, paths) {
3639
3766
  for (const path of paths ?? []) {
@@ -3692,7 +3819,7 @@ function findFirstTargetByKey(result, target, depth = 0, path = []) {
3692
3819
  }
3693
3820
  return null;
3694
3821
  }
3695
- if (!isRecord3(result)) return null;
3822
+ if (!isRecord4(result)) return null;
3696
3823
  const patterns = TARGET_FALLBACK_KEYS[target] ?? [
3697
3824
  new RegExp(`^${target}$`, "i")
3698
3825
  ];
@@ -3752,7 +3879,7 @@ function normalizeJobChangeStatus(value) {
3752
3879
  function firstExperienceDate(value) {
3753
3880
  if (!Array.isArray(value)) return null;
3754
3881
  for (const entry of value) {
3755
- if (!isRecord3(entry)) continue;
3882
+ if (!isRecord4(entry)) continue;
3756
3883
  const date = normalizeString(
3757
3884
  entry.start_date ?? entry.started_at ?? entry.startDate
3758
3885
  );
@@ -3761,10 +3888,10 @@ function firstExperienceDate(value) {
3761
3888
  return null;
3762
3889
  }
3763
3890
  function normalizeJobChange(value) {
3764
- const record = isRecord3(value) ? value : {};
3765
- const nested = isRecord3(record.job_change) ? record.job_change : record;
3766
- const output = isRecord3(nested.output) ? nested.output : nested;
3767
- const person = isRecord3(output.person) ? output.person : {};
3891
+ const record = isRecord4(value) ? value : {};
3892
+ const nested = isRecord4(record.job_change) ? record.job_change : record;
3893
+ const output = isRecord4(nested.output) ? nested.output : nested;
3894
+ const person = isRecord4(output.person) ? output.person : {};
3768
3895
  const status = normalizeJobChangeStatus(
3769
3896
  output.status ?? output.job_change_status ?? output.job_changed ?? output.changed
3770
3897
  );
@@ -4169,6 +4296,7 @@ function createNamedPlayHandle(clientFactory, name) {
4169
4296
  const started = await client.startPlayRun({
4170
4297
  name,
4171
4298
  ...options?.revisionId ? { revisionId: options.revisionId } : {},
4299
+ ...options?.profile ? { profile: options.profile } : {},
4172
4300
  input
4173
4301
  });
4174
4302
  return new DeeplinePlayJobImpl(client, started.workflowId);
@@ -4198,7 +4326,7 @@ var DeeplineContext = class {
4198
4326
  * @example
4199
4327
  * ```typescript
4200
4328
  * const tools = await deepline.tools.list();
4201
- * const meta = await deepline.tools.get('apollo_people_search');
4329
+ * const meta = await deepline.tools.get('dropleads_search_people');
4202
4330
  * const companyLookup = await deepline.tools.execute('test_company_search', { domain: 'stripe.com' });
4203
4331
  * const company = companyLookup.toolResponse.raw;
4204
4332
  * ```
@@ -4334,11 +4462,11 @@ var Deepline = class {
4334
4462
  return new DeeplineContext(options);
4335
4463
  }
4336
4464
  };
4337
- function isRecord4(value) {
4465
+ function isRecord5(value) {
4338
4466
  return Boolean(value) && typeof value === "object" && !Array.isArray(value);
4339
4467
  }
4340
4468
  function stringArrayRecord(value) {
4341
- if (!isRecord4(value)) return {};
4469
+ if (!isRecord5(value)) return {};
4342
4470
  return Object.fromEntries(
4343
4471
  Object.entries(value).map(([key, paths]) => [
4344
4472
  key,
@@ -4350,7 +4478,7 @@ function stringArray(value) {
4350
4478
  return Array.isArray(value) ? value.map(String) : [];
4351
4479
  }
4352
4480
  function emailStatusExtractorConfig(value) {
4353
- if (!isRecord4(value)) return void 0;
4481
+ if (!isRecord5(value)) return void 0;
4354
4482
  const readPaths = (key) => {
4355
4483
  const paths = stringArray(value[key]).map((path) => path.trim()).filter(Boolean);
4356
4484
  return paths.length > 0 ? paths : void 0;
@@ -4377,7 +4505,7 @@ function emailStatusExtractorConfig(value) {
4377
4505
  const paths = readPaths(key);
4378
4506
  if (paths) config[key] = paths;
4379
4507
  }
4380
- if (isRecord4(value.statusMap)) {
4508
+ if (isRecord5(value.statusMap)) {
4381
4509
  config.statusMap = value.statusMap;
4382
4510
  }
4383
4511
  if (Array.isArray(value.rules)) {
@@ -4386,10 +4514,10 @@ function emailStatusExtractorConfig(value) {
4386
4514
  return config;
4387
4515
  }
4388
4516
  function extractorDescriptorRecord(value) {
4389
- if (!isRecord4(value)) return {};
4517
+ if (!isRecord5(value)) return {};
4390
4518
  return Object.fromEntries(
4391
4519
  Object.entries(value).flatMap(([key, descriptor]) => {
4392
- if (!isRecord4(descriptor)) return [];
4520
+ if (!isRecord5(descriptor)) return [];
4393
4521
  const paths = stringArray(descriptor.paths).map((path) => path.trim()).filter(Boolean);
4394
4522
  if (paths.length === 0) return [];
4395
4523
  const transforms = stringArray(descriptor.transforms).map((transform) => transform.trim()).filter(Boolean);
@@ -4412,14 +4540,14 @@ function extractorDescriptorRecord(value) {
4412
4540
  function toolExecutionEnvelopeToResult(fallbackToolId, response) {
4413
4541
  const raw = response.toolResponse?.raw ?? null;
4414
4542
  const meta = response.toolResponse?.meta;
4415
- const metadata = isRecord4(response._metadata) ? response._metadata.tool : null;
4416
- const toolMetadata = isRecord4(metadata) ? metadata : {};
4543
+ const metadata = isRecord5(response._metadata) ? response._metadata.tool : null;
4544
+ const toolMetadata = isRecord5(metadata) ? metadata : {};
4417
4545
  return createToolExecuteResult({
4418
4546
  status: typeof response.status === "string" ? response.status : "completed",
4419
4547
  jobId: typeof response.job_id === "string" ? response.job_id : void 0,
4420
4548
  result: {
4421
4549
  data: raw,
4422
- ...isRecord4(meta) ? { meta } : {}
4550
+ ...isRecord5(meta) ? { meta } : {}
4423
4551
  },
4424
4552
  metadata: {
4425
4553
  toolId: typeof toolMetadata.toolId === "string" ? toolMetadata.toolId : fallbackToolId,
@@ -4433,7 +4561,7 @@ function toolExecutionEnvelopeToResult(fallbackToolId, response) {
4433
4561
  cached: false,
4434
4562
  source: "live"
4435
4563
  },
4436
- meta: isRecord4(response.meta) ? response.meta : void 0
4564
+ meta: isRecord5(response.meta) ? response.meta : void 0
4437
4565
  });
4438
4566
  }
4439
4567
  function defineInput(schema) {