deepline 0.2.41 → 0.2.42

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.
@@ -86,7 +86,10 @@ import type { PlayStagedFileRef } from './plays/local-file-discovery.js';
86
86
  import type { PlayCompilerManifest } from '../../shared_libs/plays/compiler-manifest.js';
87
87
  import type { EnrichCompiledConfig } from './cli/enrich-play-compiler.js';
88
88
  import { RUNTIME_ENVIRONMENT_TOKEN_HEADER } from '../../shared_libs/play-runtime/coordinator-headers.js';
89
- import { resolveTheirstackClientTimeoutMs } from '../../shared_libs/integrations/theirstack-execution-policy.js';
89
+ import {
90
+ THEIRSTACK_SLOW_JOB_SEARCH_CLIENT_TIMEOUT_MS,
91
+ usesExtendedTheirstackJobSearchBudget,
92
+ } from '../../shared_libs/integrations/theirstack-execution-policy.js';
90
93
  import {
91
94
  normalizePlayRuntimeEnvironment,
92
95
  normalizePlayRuntimeNamespace,
@@ -421,11 +424,9 @@ function resolveToolExecuteTimeoutMs(
421
424
  // Provider-specific slow-request policies live in shared modules so the SDK
422
425
  // and server classify the same payloads. If more providers need this, replace
423
426
  // these individual checks with a shared policy registry, not a wider default.
424
- const theirstackTimeoutMs = resolveTheirstackClientTimeoutMs(
425
- normalized,
426
- input,
427
- );
428
- if (theirstackTimeoutMs !== null) return theirstackTimeoutMs;
427
+ if (usesExtendedTheirstackJobSearchBudget(normalized, input)) {
428
+ return THEIRSTACK_SLOW_JOB_SEARCH_CLIENT_TIMEOUT_MS;
429
+ }
429
430
  return normalized === 'deeplineagent' ||
430
431
  normalized === 'deeplineagent_deeplineagent' ||
431
432
  normalized === 'ai_inference' ||
@@ -160,7 +160,7 @@ export const SDK_RELEASE = {
160
160
  // 0.2.0 makes Dataset Handles uniformly async-only after 0.1.320 briefly
161
161
  // exposed storage-dependent synchronous access. This deliberate minor
162
162
  // release keeps lazy paging semantics independent of row residency.
163
- version: '0.2.41',
163
+ version: '0.2.42',
164
164
  contracts: {
165
165
  api: {
166
166
  name: 'sdk-http-api',
@@ -23,14 +23,6 @@ export const THEIRSTACK_SLOW_JOB_SEARCH_PROVIDER_TIMEOUT_MS = 135_000;
23
23
  export const THEIRSTACK_SLOW_JOB_SEARCH_CLIENT_TIMEOUT_MS =
24
24
  60_000 + THEIRSTACK_SLOW_JOB_SEARCH_PROVIDER_TIMEOUT_MS + 15_000;
25
25
 
26
- /**
27
- * TheirStack company search is synchronous but can spend the full upstream
28
- * request window before returning a large result set. The SDK default is only
29
- * 60 seconds, so keep it alive through the server's 120-second provider
30
- * deadline plus the same permit and response grace used for slow job search.
31
- */
32
- export const THEIRSTACK_COMPANY_SEARCH_CLIENT_TIMEOUT_MS = 210_000;
33
-
34
26
  const LONG_JOB_SEARCH_WINDOW_MS = 365 * 24 * 60 * 60 * 1_000;
35
27
  const DATE_ONLY_PATTERN = /^\d{4}-\d{2}-\d{2}$/;
36
28
 
@@ -103,16 +95,3 @@ export function usesExtendedTheirstackJobSearchBudget(
103
95
  ? true
104
96
  : usesLongExplicitDateWindow(payload);
105
97
  }
106
-
107
- /** SDK-only timeout selection. Provider request timeouts remain action-local. */
108
- export function resolveTheirstackClientTimeoutMs(
109
- endpointId: string,
110
- payload: Record<string, unknown>,
111
- ): number | null {
112
- if (endpointId === 'theirstack_company_search') {
113
- return THEIRSTACK_COMPANY_SEARCH_CLIENT_TIMEOUT_MS;
114
- }
115
- return usesExtendedTheirstackJobSearchBudget(endpointId, payload)
116
- ? THEIRSTACK_SLOW_JOB_SEARCH_CLIENT_TIMEOUT_MS
117
- : null;
118
- }
@@ -77,16 +77,7 @@ export function workReceiptClaimConflictPredicateSql(input: {
77
77
  const forceFailedRefreshSql = input.forceFailedRefreshSql ?? 'false';
78
78
  return `${table}.status = ANY(${input.claimableStatusesSql}::smallint[])
79
79
  AND (
80
- (
81
- ${input.forceRefreshSql}::boolean
82
- AND (
83
- ${table}.status NOT IN (
84
- ${RECEIPT_STATUS_CODE.completed}::smallint,
85
- ${RECEIPT_STATUS_CODE.skipped}::smallint
86
- )
87
- OR ${table}.run_id IS DISTINCT FROM ${input.claimantRunIdSql}
88
- )
89
- )
80
+ ${input.forceRefreshSql}::boolean
90
81
  OR (
91
82
  ${forceFailedRefreshSql}::boolean
92
83
  AND ${table}.status = ${RECEIPT_STATUS_CODE.failed}::smallint
@@ -120,7 +111,6 @@ export function workReceiptClaimConflictPredicateSql(input: {
120
111
  ${RECEIPT_STATUS_CODE.completed}::smallint,
121
112
  ${RECEIPT_STATUS_CODE.skipped}::smallint
122
113
  )
123
- AND ${table}.run_id IS DISTINCT FROM ${input.claimantRunIdSql}
124
114
  AND (
125
115
  (
126
116
  ${table}.lease_id IS NULL
@@ -4402,8 +4402,8 @@ export async function claimRuntimeWorkReceipt(
4402
4402
  }
4403
4403
  if (
4404
4404
  latest &&
4405
- isReusableWorkReceipt(latest) &&
4406
- (input.forceRefresh !== true || latest.runId === input.runId)
4405
+ input.forceRefresh !== true &&
4406
+ isReusableWorkReceipt(latest)
4407
4407
  ) {
4408
4408
  return { disposition: 'reused', receipt: latest };
4409
4409
  }
@@ -4697,10 +4697,7 @@ export async function claimRuntimeWorkReceipts(
4697
4697
  });
4698
4698
  continue;
4699
4699
  }
4700
- if (
4701
- isReusableWorkReceipt(receipt) &&
4702
- (input.forceRefresh !== true || receipt.runId === input.runId)
4703
- ) {
4700
+ if (input.forceRefresh !== true && isReusableWorkReceipt(receipt)) {
4704
4701
  claimsByKey.set(receipt.key, {
4705
4702
  disposition: 'reused',
4706
4703
  receipt,
@@ -277,22 +277,6 @@ export function decideWorkReceiptClaim(input: {
277
277
  }): WorkReceiptClaimDecision {
278
278
  if (!input.receipt) return { kind: 'claim' };
279
279
  const state = classifyWorkReceiptState(input.receipt, input.nowMs);
280
- const sameLogicalRun =
281
- normalize(input.claimantRunId) !== null &&
282
- normalize(input.claimantRunId) === normalize(input.receipt.runId);
283
- const sameRunNewerLeaseAttempt =
284
- state.reusable &&
285
- state.lease.kind === 'active' &&
286
- state.lease.ownerRunId === normalize(input.claimantRunId) &&
287
- state.lease.ownerAttempt < normalizeAttempt(input.claimantRunAttempt);
288
- // Force refresh means new intent across runs. Within one run it is a replay,
289
- // so reuse terminal output instead of creating a second terminal payload
290
- // under the run's existing Runtime Sheet write version. A newer lease
291
- // generation is the exception: it is a new attempt and retains the existing
292
- // stale-owner fence semantics.
293
- if (state.reusable && sameLogicalRun && !sameRunNewerLeaseAttempt) {
294
- return { kind: 'reuse_terminal' };
295
- }
296
280
  if (state.reusable && input.forceRefresh !== true) {
297
281
  return { kind: 'reuse_terminal' };
298
282
  }
package/dist/cli/index.js CHANGED
@@ -1044,7 +1044,7 @@ var SDK_RELEASE = {
1044
1044
  // 0.2.0 makes Dataset Handles uniformly async-only after 0.1.320 briefly
1045
1045
  // exposed storage-dependent synchronous access. This deliberate minor
1046
1046
  // release keeps lazy paging semantics independent of row residency.
1047
- version: "0.2.41",
1047
+ version: "0.2.42",
1048
1048
  contracts: {
1049
1049
  api: {
1050
1050
  name: "sdk-http-api",
@@ -3272,7 +3272,6 @@ async function* observeRunEvents(options) {
3272
3272
  // ../shared_libs/integrations/theirstack-execution-policy.ts
3273
3273
  var THEIRSTACK_SLOW_JOB_SEARCH_PROVIDER_TIMEOUT_MS = 135e3;
3274
3274
  var THEIRSTACK_SLOW_JOB_SEARCH_CLIENT_TIMEOUT_MS = 6e4 + THEIRSTACK_SLOW_JOB_SEARCH_PROVIDER_TIMEOUT_MS + 15e3;
3275
- var THEIRSTACK_COMPANY_SEARCH_CLIENT_TIMEOUT_MS = 21e4;
3276
3275
  var LONG_JOB_SEARCH_WINDOW_MS = 365 * 24 * 60 * 60 * 1e3;
3277
3276
  var DATE_ONLY_PATTERN = /^\d{4}-\d{2}-\d{2}$/;
3278
3277
  function parseDateOnly(value) {
@@ -3316,12 +3315,6 @@ function usesExtendedTheirstackJobSearchBudget(endpointId, payload) {
3316
3315
  const maxAgeDays = parseMaxAgeDays(payload.posted_at_max_age_days);
3317
3316
  return maxAgeDays !== null && maxAgeDays >= 365 ? true : usesLongExplicitDateWindow(payload);
3318
3317
  }
3319
- function resolveTheirstackClientTimeoutMs(endpointId, payload) {
3320
- if (endpointId === "theirstack_company_search") {
3321
- return THEIRSTACK_COMPANY_SEARCH_CLIENT_TIMEOUT_MS;
3322
- }
3323
- return usesExtendedTheirstackJobSearchBudget(endpointId, payload) ? THEIRSTACK_SLOW_JOB_SEARCH_CLIENT_TIMEOUT_MS : null;
3324
- }
3325
3318
 
3326
3319
  // ../shared_libs/play-runtime/backend.ts
3327
3320
  var PLAY_RUNTIME_BACKENDS = {
@@ -3568,11 +3561,9 @@ function resolveToolExecuteTimeoutMs(toolId, input2) {
3568
3561
  return Math.floor(requestedTimeoutMs) + APIFY_SYNC_RESPONSE_GRACE_MS;
3569
3562
  }
3570
3563
  }
3571
- const theirstackTimeoutMs = resolveTheirstackClientTimeoutMs(
3572
- normalized,
3573
- input2
3574
- );
3575
- if (theirstackTimeoutMs !== null) return theirstackTimeoutMs;
3564
+ if (usesExtendedTheirstackJobSearchBudget(normalized, input2)) {
3565
+ return THEIRSTACK_SLOW_JOB_SEARCH_CLIENT_TIMEOUT_MS;
3566
+ }
3576
3567
  return normalized === "deeplineagent" || normalized === "deeplineagent_deeplineagent" || normalized === "ai_inference" || normalized === "deeplineagent_ai_inference" || normalized === "aiinference" ? DEEPLINEAGENT_EXECUTE_TIMEOUT_MS : void 0;
3577
3568
  }
3578
3569
  var RUNS_FAILED_LOG_LIMIT = 20;
@@ -1030,7 +1030,7 @@ var SDK_RELEASE = {
1030
1030
  // 0.2.0 makes Dataset Handles uniformly async-only after 0.1.320 briefly
1031
1031
  // exposed storage-dependent synchronous access. This deliberate minor
1032
1032
  // release keeps lazy paging semantics independent of row residency.
1033
- version: "0.2.41",
1033
+ version: "0.2.42",
1034
1034
  contracts: {
1035
1035
  api: {
1036
1036
  name: "sdk-http-api",
@@ -3258,7 +3258,6 @@ async function* observeRunEvents(options) {
3258
3258
  // ../shared_libs/integrations/theirstack-execution-policy.ts
3259
3259
  var THEIRSTACK_SLOW_JOB_SEARCH_PROVIDER_TIMEOUT_MS = 135e3;
3260
3260
  var THEIRSTACK_SLOW_JOB_SEARCH_CLIENT_TIMEOUT_MS = 6e4 + THEIRSTACK_SLOW_JOB_SEARCH_PROVIDER_TIMEOUT_MS + 15e3;
3261
- var THEIRSTACK_COMPANY_SEARCH_CLIENT_TIMEOUT_MS = 21e4;
3262
3261
  var LONG_JOB_SEARCH_WINDOW_MS = 365 * 24 * 60 * 60 * 1e3;
3263
3262
  var DATE_ONLY_PATTERN = /^\d{4}-\d{2}-\d{2}$/;
3264
3263
  function parseDateOnly(value) {
@@ -3302,12 +3301,6 @@ function usesExtendedTheirstackJobSearchBudget(endpointId, payload) {
3302
3301
  const maxAgeDays = parseMaxAgeDays(payload.posted_at_max_age_days);
3303
3302
  return maxAgeDays !== null && maxAgeDays >= 365 ? true : usesLongExplicitDateWindow(payload);
3304
3303
  }
3305
- function resolveTheirstackClientTimeoutMs(endpointId, payload) {
3306
- if (endpointId === "theirstack_company_search") {
3307
- return THEIRSTACK_COMPANY_SEARCH_CLIENT_TIMEOUT_MS;
3308
- }
3309
- return usesExtendedTheirstackJobSearchBudget(endpointId, payload) ? THEIRSTACK_SLOW_JOB_SEARCH_CLIENT_TIMEOUT_MS : null;
3310
- }
3311
3304
 
3312
3305
  // ../shared_libs/play-runtime/backend.ts
3313
3306
  var PLAY_RUNTIME_BACKENDS = {
@@ -3554,11 +3547,9 @@ function resolveToolExecuteTimeoutMs(toolId, input2) {
3554
3547
  return Math.floor(requestedTimeoutMs) + APIFY_SYNC_RESPONSE_GRACE_MS;
3555
3548
  }
3556
3549
  }
3557
- const theirstackTimeoutMs = resolveTheirstackClientTimeoutMs(
3558
- normalized,
3559
- input2
3560
- );
3561
- if (theirstackTimeoutMs !== null) return theirstackTimeoutMs;
3550
+ if (usesExtendedTheirstackJobSearchBudget(normalized, input2)) {
3551
+ return THEIRSTACK_SLOW_JOB_SEARCH_CLIENT_TIMEOUT_MS;
3552
+ }
3562
3553
  return normalized === "deeplineagent" || normalized === "deeplineagent_deeplineagent" || normalized === "ai_inference" || normalized === "deeplineagent_ai_inference" || normalized === "aiinference" ? DEEPLINEAGENT_EXECUTE_TIMEOUT_MS : void 0;
3563
3554
  }
3564
3555
  var RUNS_FAILED_LOG_LIMIT = 20;
package/dist/index.js CHANGED
@@ -763,7 +763,7 @@ var SDK_RELEASE = {
763
763
  // 0.2.0 makes Dataset Handles uniformly async-only after 0.1.320 briefly
764
764
  // exposed storage-dependent synchronous access. This deliberate minor
765
765
  // release keeps lazy paging semantics independent of row residency.
766
- version: "0.2.41",
766
+ version: "0.2.42",
767
767
  contracts: {
768
768
  api: {
769
769
  name: "sdk-http-api",
@@ -2991,7 +2991,6 @@ async function* observeRunEvents(options) {
2991
2991
  // ../shared_libs/integrations/theirstack-execution-policy.ts
2992
2992
  var THEIRSTACK_SLOW_JOB_SEARCH_PROVIDER_TIMEOUT_MS = 135e3;
2993
2993
  var THEIRSTACK_SLOW_JOB_SEARCH_CLIENT_TIMEOUT_MS = 6e4 + THEIRSTACK_SLOW_JOB_SEARCH_PROVIDER_TIMEOUT_MS + 15e3;
2994
- var THEIRSTACK_COMPANY_SEARCH_CLIENT_TIMEOUT_MS = 21e4;
2995
2994
  var LONG_JOB_SEARCH_WINDOW_MS = 365 * 24 * 60 * 60 * 1e3;
2996
2995
  var DATE_ONLY_PATTERN = /^\d{4}-\d{2}-\d{2}$/;
2997
2996
  function parseDateOnly(value) {
@@ -3035,12 +3034,6 @@ function usesExtendedTheirstackJobSearchBudget(endpointId, payload) {
3035
3034
  const maxAgeDays = parseMaxAgeDays(payload.posted_at_max_age_days);
3036
3035
  return maxAgeDays !== null && maxAgeDays >= 365 ? true : usesLongExplicitDateWindow(payload);
3037
3036
  }
3038
- function resolveTheirstackClientTimeoutMs(endpointId, payload) {
3039
- if (endpointId === "theirstack_company_search") {
3040
- return THEIRSTACK_COMPANY_SEARCH_CLIENT_TIMEOUT_MS;
3041
- }
3042
- return usesExtendedTheirstackJobSearchBudget(endpointId, payload) ? THEIRSTACK_SLOW_JOB_SEARCH_CLIENT_TIMEOUT_MS : null;
3043
- }
3044
3037
 
3045
3038
  // ../shared_libs/play-runtime/backend.ts
3046
3039
  var PLAY_RUNTIME_BACKENDS = {
@@ -3287,11 +3280,9 @@ function resolveToolExecuteTimeoutMs(toolId, input) {
3287
3280
  return Math.floor(requestedTimeoutMs) + APIFY_SYNC_RESPONSE_GRACE_MS;
3288
3281
  }
3289
3282
  }
3290
- const theirstackTimeoutMs = resolveTheirstackClientTimeoutMs(
3291
- normalized,
3292
- input
3293
- );
3294
- if (theirstackTimeoutMs !== null) return theirstackTimeoutMs;
3283
+ if (usesExtendedTheirstackJobSearchBudget(normalized, input)) {
3284
+ return THEIRSTACK_SLOW_JOB_SEARCH_CLIENT_TIMEOUT_MS;
3285
+ }
3295
3286
  return normalized === "deeplineagent" || normalized === "deeplineagent_deeplineagent" || normalized === "ai_inference" || normalized === "deeplineagent_ai_inference" || normalized === "aiinference" ? DEEPLINEAGENT_EXECUTE_TIMEOUT_MS : void 0;
3296
3287
  }
3297
3288
  var RUNS_FAILED_LOG_LIMIT = 20;
package/dist/index.mjs CHANGED
@@ -689,7 +689,7 @@ var SDK_RELEASE = {
689
689
  // 0.2.0 makes Dataset Handles uniformly async-only after 0.1.320 briefly
690
690
  // exposed storage-dependent synchronous access. This deliberate minor
691
691
  // release keeps lazy paging semantics independent of row residency.
692
- version: "0.2.41",
692
+ version: "0.2.42",
693
693
  contracts: {
694
694
  api: {
695
695
  name: "sdk-http-api",
@@ -2917,7 +2917,6 @@ async function* observeRunEvents(options) {
2917
2917
  // ../shared_libs/integrations/theirstack-execution-policy.ts
2918
2918
  var THEIRSTACK_SLOW_JOB_SEARCH_PROVIDER_TIMEOUT_MS = 135e3;
2919
2919
  var THEIRSTACK_SLOW_JOB_SEARCH_CLIENT_TIMEOUT_MS = 6e4 + THEIRSTACK_SLOW_JOB_SEARCH_PROVIDER_TIMEOUT_MS + 15e3;
2920
- var THEIRSTACK_COMPANY_SEARCH_CLIENT_TIMEOUT_MS = 21e4;
2921
2920
  var LONG_JOB_SEARCH_WINDOW_MS = 365 * 24 * 60 * 60 * 1e3;
2922
2921
  var DATE_ONLY_PATTERN = /^\d{4}-\d{2}-\d{2}$/;
2923
2922
  function parseDateOnly(value) {
@@ -2961,12 +2960,6 @@ function usesExtendedTheirstackJobSearchBudget(endpointId, payload) {
2961
2960
  const maxAgeDays = parseMaxAgeDays(payload.posted_at_max_age_days);
2962
2961
  return maxAgeDays !== null && maxAgeDays >= 365 ? true : usesLongExplicitDateWindow(payload);
2963
2962
  }
2964
- function resolveTheirstackClientTimeoutMs(endpointId, payload) {
2965
- if (endpointId === "theirstack_company_search") {
2966
- return THEIRSTACK_COMPANY_SEARCH_CLIENT_TIMEOUT_MS;
2967
- }
2968
- return usesExtendedTheirstackJobSearchBudget(endpointId, payload) ? THEIRSTACK_SLOW_JOB_SEARCH_CLIENT_TIMEOUT_MS : null;
2969
- }
2970
2963
 
2971
2964
  // ../shared_libs/play-runtime/backend.ts
2972
2965
  var PLAY_RUNTIME_BACKENDS = {
@@ -3213,11 +3206,9 @@ function resolveToolExecuteTimeoutMs(toolId, input) {
3213
3206
  return Math.floor(requestedTimeoutMs) + APIFY_SYNC_RESPONSE_GRACE_MS;
3214
3207
  }
3215
3208
  }
3216
- const theirstackTimeoutMs = resolveTheirstackClientTimeoutMs(
3217
- normalized,
3218
- input
3219
- );
3220
- if (theirstackTimeoutMs !== null) return theirstackTimeoutMs;
3209
+ if (usesExtendedTheirstackJobSearchBudget(normalized, input)) {
3210
+ return THEIRSTACK_SLOW_JOB_SEARCH_CLIENT_TIMEOUT_MS;
3211
+ }
3221
3212
  return normalized === "deeplineagent" || normalized === "deeplineagent_deeplineagent" || normalized === "ai_inference" || normalized === "deeplineagent_ai_inference" || normalized === "aiinference" ? DEEPLINEAGENT_EXECUTE_TIMEOUT_MS : void 0;
3222
3213
  }
3223
3214
  var RUNS_FAILED_LOG_LIMIT = 20;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "deepline",
3
- "version": "0.2.41",
3
+ "version": "0.2.42",
4
4
  "description": "Deepline SDK + CLI — B2B data enrichment powered by durable cloud execution",
5
5
  "license": "MIT",
6
6
  "repository": {