deepline 0.1.286 → 0.1.287

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.
@@ -83,6 +83,10 @@ import type { PlayStagedFileRef } from './plays/local-file-discovery.js';
83
83
  import type { PlayCompilerManifest } from '../../shared_libs/plays/compiler-manifest.js';
84
84
  import type { EnrichCompiledConfig } from './cli/enrich-play-compiler.js';
85
85
  import { RUNTIME_ENVIRONMENT_TOKEN_HEADER } from '../../shared_libs/play-runtime/coordinator-headers.js';
86
+ import {
87
+ THEIRSTACK_SLOW_JOB_SEARCH_CLIENT_TIMEOUT_MS,
88
+ usesExtendedTheirstackJobSearchBudget,
89
+ } from '../../shared_libs/integrations/theirstack-execution-policy.js';
86
90
  import {
87
91
  normalizePlayRuntimeEnvironment,
88
92
  normalizePlayRuntimeNamespace,
@@ -398,6 +402,12 @@ function resolveToolExecuteTimeoutMs(
398
402
  return Math.floor(requestedTimeoutMs) + APIFY_SYNC_RESPONSE_GRACE_MS;
399
403
  }
400
404
  }
405
+ // Provider-specific slow-request policies live in shared modules so the SDK
406
+ // and server classify the same payloads. If more providers need this, replace
407
+ // these individual checks with a shared policy registry, not a wider default.
408
+ if (usesExtendedTheirstackJobSearchBudget(normalized, input)) {
409
+ return THEIRSTACK_SLOW_JOB_SEARCH_CLIENT_TIMEOUT_MS;
410
+ }
401
411
  return normalized === 'deeplineagent' ||
402
412
  normalized === 'deeplineagent_deeplineagent' ||
403
413
  normalized === 'ai_inference' ||
@@ -3913,9 +3923,7 @@ export class DeeplineClient {
3913
3923
  * id for the compact inventory. Prefer `client.monitors.available(...)`.
3914
3924
  */
3915
3925
  async getMonitorsAvailable(
3916
- toolIdOrOptions?:
3917
- | string
3918
- | (MonitorsAvailableOptions & { tool?: string }),
3926
+ toolIdOrOptions?: string | (MonitorsAvailableOptions & { tool?: string }),
3919
3927
  maybeOptions?: MonitorsAvailableOptions,
3920
3928
  ): Promise<MonitorsAvailableResult> {
3921
3929
  const positionalTool =
@@ -3995,7 +4003,8 @@ export class DeeplineClient {
3995
4003
  ): Promise<MonitorsListResult> {
3996
4004
  const params = new URLSearchParams();
3997
4005
  if (options?.status) params.set('status', options.status);
3998
- if (options?.limit !== undefined) params.set('limit', String(options.limit));
4006
+ if (options?.limit !== undefined)
4007
+ params.set('limit', String(options.limit));
3999
4008
  if (options?.cursor) params.set('cursor', options.cursor);
4000
4009
  if (options?.compact) params.set('compact', 'true');
4001
4010
  const query = params.toString();
@@ -155,7 +155,7 @@ export const SDK_RELEASE = {
155
155
  // 0.1.253 makes play-page browser opening opt-in and retires --no-open.
156
156
  // 0.1.254 removes the internal operations tree from the published SDK CLI.
157
157
  // Operators use the checkout-local deepline-admin binary instead.
158
- version: '0.1.286',
158
+ version: '0.1.287',
159
159
  contracts: {
160
160
  api: {
161
161
  name: 'sdk-http-api',
@@ -0,0 +1,97 @@
1
+ /**
2
+ * TheirStack-specific thresholds backed by observed job-search latency. They
3
+ * are deliberately not global provider defaults: a larger timeout would hide
4
+ * unrelated provider failures and hold runtime permits longer for every tool.
5
+ *
6
+ * The reusable part is the deadline ordering below:
7
+ *
8
+ * client > runtime permit wait + provider request + response serialization
9
+ *
10
+ * A provider with the same measured failure mode should add its own shared
11
+ * request classifier and budgets, consumed by both its server runtime hook and
12
+ * the SDK timeout resolver. If several providers need that shape, promote the
13
+ * provider policies into a shared registry while keeping each provider's
14
+ * classifier and measured thresholds separate.
15
+ */
16
+ export const THEIRSTACK_SLOW_JOB_SEARCH_PROVIDER_TIMEOUT_MS = 135_000;
17
+
18
+ /**
19
+ * The provider request may spend up to 60 seconds waiting for its runtime
20
+ * permit before the provider timeout starts. Keep another 15 seconds for the
21
+ * execute route to serialize and return the response.
22
+ */
23
+ export const THEIRSTACK_SLOW_JOB_SEARCH_CLIENT_TIMEOUT_MS =
24
+ 60_000 + THEIRSTACK_SLOW_JOB_SEARCH_PROVIDER_TIMEOUT_MS + 15_000;
25
+
26
+ const LONG_JOB_SEARCH_WINDOW_MS = 365 * 24 * 60 * 60 * 1_000;
27
+ const DATE_ONLY_PATTERN = /^\d{4}-\d{2}-\d{2}$/;
28
+
29
+ function parseDateOnly(value: unknown): number | null {
30
+ if (typeof value !== 'string' || !DATE_ONLY_PATTERN.test(value)) {
31
+ return null;
32
+ }
33
+
34
+ const timestamp = Date.parse(`${value}T00:00:00.000Z`);
35
+ if (!Number.isFinite(timestamp)) {
36
+ return null;
37
+ }
38
+
39
+ return new Date(timestamp).toISOString().slice(0, 10) === value
40
+ ? timestamp
41
+ : null;
42
+ }
43
+
44
+ function usesLongExplicitDateWindow(payload: Record<string, unknown>): boolean {
45
+ const postedAtGte = parseDateOnly(payload.posted_at_gte);
46
+ const postedAtLte = parseDateOnly(payload.posted_at_lte);
47
+
48
+ if (postedAtGte !== null && postedAtLte !== null) {
49
+ return postedAtLte - postedAtGte >= LONG_JOB_SEARCH_WINDOW_MS;
50
+ }
51
+
52
+ if (postedAtGte !== null) {
53
+ return Date.now() - postedAtGte >= LONG_JOB_SEARCH_WINDOW_MS;
54
+ }
55
+
56
+ // With no lower bound, `posted_at_lte` searches the provider's full history
57
+ // through the supplied date and needs the same slow-search budget.
58
+ return postedAtLte !== null && payload.posted_at_gte == null;
59
+ }
60
+
61
+ function parseMaxAgeDays(value: unknown): number | null {
62
+ if (typeof value === 'number') {
63
+ return Number.isFinite(value) ? value : null;
64
+ }
65
+ if (typeof value !== 'string' || !/^-?\d+$/.test(value.trim())) {
66
+ return null;
67
+ }
68
+
69
+ const parsed = Number(value.trim());
70
+ return Number.isSafeInteger(parsed) ? parsed : null;
71
+ }
72
+
73
+ /**
74
+ * Classifies the TheirStack request shapes known to perform substantially more
75
+ * work. Keeping this predicate shared prevents the server from accepting a
76
+ * slow request that the SDK abandons at its default deadline.
77
+ *
78
+ * Do not add other providers to this predicate. Give each provider an
79
+ * evidence-backed classifier so its normal requests keep the global timeout.
80
+ */
81
+ export function usesExtendedTheirstackJobSearchBudget(
82
+ endpointId: string,
83
+ payload: Record<string, unknown>,
84
+ ): boolean {
85
+ if (endpointId !== 'theirstack_job_search') {
86
+ return false;
87
+ }
88
+
89
+ if (payload.include_total_results === true) {
90
+ return true;
91
+ }
92
+
93
+ const maxAgeDays = parseMaxAgeDays(payload.posted_at_max_age_days);
94
+ return maxAgeDays !== null && maxAgeDays >= 365
95
+ ? true
96
+ : usesLongExplicitDateWindow(payload);
97
+ }
package/dist/cli/index.js CHANGED
@@ -718,7 +718,7 @@ var SDK_RELEASE = {
718
718
  // 0.1.253 makes play-page browser opening opt-in and retires --no-open.
719
719
  // 0.1.254 removes the internal operations tree from the published SDK CLI.
720
720
  // Operators use the checkout-local deepline-admin binary instead.
721
- version: "0.1.286",
721
+ version: "0.1.287",
722
722
  contracts: {
723
723
  api: {
724
724
  name: "sdk-http-api",
@@ -2799,6 +2799,53 @@ async function* observeRunEvents(options) {
2799
2799
  }
2800
2800
  }
2801
2801
 
2802
+ // ../shared_libs/integrations/theirstack-execution-policy.ts
2803
+ var THEIRSTACK_SLOW_JOB_SEARCH_PROVIDER_TIMEOUT_MS = 135e3;
2804
+ var THEIRSTACK_SLOW_JOB_SEARCH_CLIENT_TIMEOUT_MS = 6e4 + THEIRSTACK_SLOW_JOB_SEARCH_PROVIDER_TIMEOUT_MS + 15e3;
2805
+ var LONG_JOB_SEARCH_WINDOW_MS = 365 * 24 * 60 * 60 * 1e3;
2806
+ var DATE_ONLY_PATTERN = /^\d{4}-\d{2}-\d{2}$/;
2807
+ function parseDateOnly(value) {
2808
+ if (typeof value !== "string" || !DATE_ONLY_PATTERN.test(value)) {
2809
+ return null;
2810
+ }
2811
+ const timestamp = Date.parse(`${value}T00:00:00.000Z`);
2812
+ if (!Number.isFinite(timestamp)) {
2813
+ return null;
2814
+ }
2815
+ return new Date(timestamp).toISOString().slice(0, 10) === value ? timestamp : null;
2816
+ }
2817
+ function usesLongExplicitDateWindow(payload) {
2818
+ const postedAtGte = parseDateOnly(payload.posted_at_gte);
2819
+ const postedAtLte = parseDateOnly(payload.posted_at_lte);
2820
+ if (postedAtGte !== null && postedAtLte !== null) {
2821
+ return postedAtLte - postedAtGte >= LONG_JOB_SEARCH_WINDOW_MS;
2822
+ }
2823
+ if (postedAtGte !== null) {
2824
+ return Date.now() - postedAtGte >= LONG_JOB_SEARCH_WINDOW_MS;
2825
+ }
2826
+ return postedAtLte !== null && payload.posted_at_gte == null;
2827
+ }
2828
+ function parseMaxAgeDays(value) {
2829
+ if (typeof value === "number") {
2830
+ return Number.isFinite(value) ? value : null;
2831
+ }
2832
+ if (typeof value !== "string" || !/^-?\d+$/.test(value.trim())) {
2833
+ return null;
2834
+ }
2835
+ const parsed = Number(value.trim());
2836
+ return Number.isSafeInteger(parsed) ? parsed : null;
2837
+ }
2838
+ function usesExtendedTheirstackJobSearchBudget(endpointId, payload) {
2839
+ if (endpointId !== "theirstack_job_search") {
2840
+ return false;
2841
+ }
2842
+ if (payload.include_total_results === true) {
2843
+ return true;
2844
+ }
2845
+ const maxAgeDays = parseMaxAgeDays(payload.posted_at_max_age_days);
2846
+ return maxAgeDays !== null && maxAgeDays >= 365 ? true : usesLongExplicitDateWindow(payload);
2847
+ }
2848
+
2802
2849
  // ../shared_libs/play-runtime/runtime-environment.ts
2803
2850
  var PLAY_RUNTIME_ENVIRONMENTS = ["preview"];
2804
2851
  var PLAY_RUNTIME_NAMESPACE_PATTERN = /^[a-z][a-z0-9-]{0,30}$/;
@@ -2999,6 +3046,9 @@ function resolveToolExecuteTimeoutMs(toolId, input2) {
2999
3046
  return Math.floor(requestedTimeoutMs) + APIFY_SYNC_RESPONSE_GRACE_MS;
3000
3047
  }
3001
3048
  }
3049
+ if (usesExtendedTheirstackJobSearchBudget(normalized, input2)) {
3050
+ return THEIRSTACK_SLOW_JOB_SEARCH_CLIENT_TIMEOUT_MS;
3051
+ }
3002
3052
  return normalized === "deeplineagent" || normalized === "deeplineagent_deeplineagent" || normalized === "ai_inference" || normalized === "deeplineagent_ai_inference" || normalized === "aiinference" ? DEEPLINEAGENT_EXECUTE_TIMEOUT_MS : void 0;
3003
3053
  }
3004
3054
  var RUNS_FAILED_LOG_LIMIT = 20;
@@ -5220,7 +5270,8 @@ var DeeplineClient = class {
5220
5270
  async listMonitors(options) {
5221
5271
  const params = new URLSearchParams();
5222
5272
  if (options?.status) params.set("status", options.status);
5223
- if (options?.limit !== void 0) params.set("limit", String(options.limit));
5273
+ if (options?.limit !== void 0)
5274
+ params.set("limit", String(options.limit));
5224
5275
  if (options?.cursor) params.set("cursor", options.cursor);
5225
5276
  if (options?.compact) params.set("compact", "true");
5226
5277
  const query = params.toString();
@@ -703,7 +703,7 @@ var SDK_RELEASE = {
703
703
  // 0.1.253 makes play-page browser opening opt-in and retires --no-open.
704
704
  // 0.1.254 removes the internal operations tree from the published SDK CLI.
705
705
  // Operators use the checkout-local deepline-admin binary instead.
706
- version: "0.1.286",
706
+ version: "0.1.287",
707
707
  contracts: {
708
708
  api: {
709
709
  name: "sdk-http-api",
@@ -2784,6 +2784,53 @@ async function* observeRunEvents(options) {
2784
2784
  }
2785
2785
  }
2786
2786
 
2787
+ // ../shared_libs/integrations/theirstack-execution-policy.ts
2788
+ var THEIRSTACK_SLOW_JOB_SEARCH_PROVIDER_TIMEOUT_MS = 135e3;
2789
+ var THEIRSTACK_SLOW_JOB_SEARCH_CLIENT_TIMEOUT_MS = 6e4 + THEIRSTACK_SLOW_JOB_SEARCH_PROVIDER_TIMEOUT_MS + 15e3;
2790
+ var LONG_JOB_SEARCH_WINDOW_MS = 365 * 24 * 60 * 60 * 1e3;
2791
+ var DATE_ONLY_PATTERN = /^\d{4}-\d{2}-\d{2}$/;
2792
+ function parseDateOnly(value) {
2793
+ if (typeof value !== "string" || !DATE_ONLY_PATTERN.test(value)) {
2794
+ return null;
2795
+ }
2796
+ const timestamp = Date.parse(`${value}T00:00:00.000Z`);
2797
+ if (!Number.isFinite(timestamp)) {
2798
+ return null;
2799
+ }
2800
+ return new Date(timestamp).toISOString().slice(0, 10) === value ? timestamp : null;
2801
+ }
2802
+ function usesLongExplicitDateWindow(payload) {
2803
+ const postedAtGte = parseDateOnly(payload.posted_at_gte);
2804
+ const postedAtLte = parseDateOnly(payload.posted_at_lte);
2805
+ if (postedAtGte !== null && postedAtLte !== null) {
2806
+ return postedAtLte - postedAtGte >= LONG_JOB_SEARCH_WINDOW_MS;
2807
+ }
2808
+ if (postedAtGte !== null) {
2809
+ return Date.now() - postedAtGte >= LONG_JOB_SEARCH_WINDOW_MS;
2810
+ }
2811
+ return postedAtLte !== null && payload.posted_at_gte == null;
2812
+ }
2813
+ function parseMaxAgeDays(value) {
2814
+ if (typeof value === "number") {
2815
+ return Number.isFinite(value) ? value : null;
2816
+ }
2817
+ if (typeof value !== "string" || !/^-?\d+$/.test(value.trim())) {
2818
+ return null;
2819
+ }
2820
+ const parsed = Number(value.trim());
2821
+ return Number.isSafeInteger(parsed) ? parsed : null;
2822
+ }
2823
+ function usesExtendedTheirstackJobSearchBudget(endpointId, payload) {
2824
+ if (endpointId !== "theirstack_job_search") {
2825
+ return false;
2826
+ }
2827
+ if (payload.include_total_results === true) {
2828
+ return true;
2829
+ }
2830
+ const maxAgeDays = parseMaxAgeDays(payload.posted_at_max_age_days);
2831
+ return maxAgeDays !== null && maxAgeDays >= 365 ? true : usesLongExplicitDateWindow(payload);
2832
+ }
2833
+
2787
2834
  // ../shared_libs/play-runtime/runtime-environment.ts
2788
2835
  var PLAY_RUNTIME_ENVIRONMENTS = ["preview"];
2789
2836
  var PLAY_RUNTIME_NAMESPACE_PATTERN = /^[a-z][a-z0-9-]{0,30}$/;
@@ -2984,6 +3031,9 @@ function resolveToolExecuteTimeoutMs(toolId, input2) {
2984
3031
  return Math.floor(requestedTimeoutMs) + APIFY_SYNC_RESPONSE_GRACE_MS;
2985
3032
  }
2986
3033
  }
3034
+ if (usesExtendedTheirstackJobSearchBudget(normalized, input2)) {
3035
+ return THEIRSTACK_SLOW_JOB_SEARCH_CLIENT_TIMEOUT_MS;
3036
+ }
2987
3037
  return normalized === "deeplineagent" || normalized === "deeplineagent_deeplineagent" || normalized === "ai_inference" || normalized === "deeplineagent_ai_inference" || normalized === "aiinference" ? DEEPLINEAGENT_EXECUTE_TIMEOUT_MS : void 0;
2988
3038
  }
2989
3039
  var RUNS_FAILED_LOG_LIMIT = 20;
@@ -5205,7 +5255,8 @@ var DeeplineClient = class {
5205
5255
  async listMonitors(options) {
5206
5256
  const params = new URLSearchParams();
5207
5257
  if (options?.status) params.set("status", options.status);
5208
- if (options?.limit !== void 0) params.set("limit", String(options.limit));
5258
+ if (options?.limit !== void 0)
5259
+ params.set("limit", String(options.limit));
5209
5260
  if (options?.cursor) params.set("cursor", options.cursor);
5210
5261
  if (options?.compact) params.set("compact", "true");
5211
5262
  const query = params.toString();
package/dist/index.js CHANGED
@@ -438,7 +438,7 @@ var SDK_RELEASE = {
438
438
  // 0.1.253 makes play-page browser opening opt-in and retires --no-open.
439
439
  // 0.1.254 removes the internal operations tree from the published SDK CLI.
440
440
  // Operators use the checkout-local deepline-admin binary instead.
441
- version: "0.1.286",
441
+ version: "0.1.287",
442
442
  contracts: {
443
443
  api: {
444
444
  name: "sdk-http-api",
@@ -2519,6 +2519,53 @@ async function* observeRunEvents(options) {
2519
2519
  }
2520
2520
  }
2521
2521
 
2522
+ // ../shared_libs/integrations/theirstack-execution-policy.ts
2523
+ var THEIRSTACK_SLOW_JOB_SEARCH_PROVIDER_TIMEOUT_MS = 135e3;
2524
+ var THEIRSTACK_SLOW_JOB_SEARCH_CLIENT_TIMEOUT_MS = 6e4 + THEIRSTACK_SLOW_JOB_SEARCH_PROVIDER_TIMEOUT_MS + 15e3;
2525
+ var LONG_JOB_SEARCH_WINDOW_MS = 365 * 24 * 60 * 60 * 1e3;
2526
+ var DATE_ONLY_PATTERN = /^\d{4}-\d{2}-\d{2}$/;
2527
+ function parseDateOnly(value) {
2528
+ if (typeof value !== "string" || !DATE_ONLY_PATTERN.test(value)) {
2529
+ return null;
2530
+ }
2531
+ const timestamp = Date.parse(`${value}T00:00:00.000Z`);
2532
+ if (!Number.isFinite(timestamp)) {
2533
+ return null;
2534
+ }
2535
+ return new Date(timestamp).toISOString().slice(0, 10) === value ? timestamp : null;
2536
+ }
2537
+ function usesLongExplicitDateWindow(payload) {
2538
+ const postedAtGte = parseDateOnly(payload.posted_at_gte);
2539
+ const postedAtLte = parseDateOnly(payload.posted_at_lte);
2540
+ if (postedAtGte !== null && postedAtLte !== null) {
2541
+ return postedAtLte - postedAtGte >= LONG_JOB_SEARCH_WINDOW_MS;
2542
+ }
2543
+ if (postedAtGte !== null) {
2544
+ return Date.now() - postedAtGte >= LONG_JOB_SEARCH_WINDOW_MS;
2545
+ }
2546
+ return postedAtLte !== null && payload.posted_at_gte == null;
2547
+ }
2548
+ function parseMaxAgeDays(value) {
2549
+ if (typeof value === "number") {
2550
+ return Number.isFinite(value) ? value : null;
2551
+ }
2552
+ if (typeof value !== "string" || !/^-?\d+$/.test(value.trim())) {
2553
+ return null;
2554
+ }
2555
+ const parsed = Number(value.trim());
2556
+ return Number.isSafeInteger(parsed) ? parsed : null;
2557
+ }
2558
+ function usesExtendedTheirstackJobSearchBudget(endpointId, payload) {
2559
+ if (endpointId !== "theirstack_job_search") {
2560
+ return false;
2561
+ }
2562
+ if (payload.include_total_results === true) {
2563
+ return true;
2564
+ }
2565
+ const maxAgeDays = parseMaxAgeDays(payload.posted_at_max_age_days);
2566
+ return maxAgeDays !== null && maxAgeDays >= 365 ? true : usesLongExplicitDateWindow(payload);
2567
+ }
2568
+
2522
2569
  // ../shared_libs/play-runtime/runtime-environment.ts
2523
2570
  var PLAY_RUNTIME_ENVIRONMENTS = ["preview"];
2524
2571
  var PLAY_RUNTIME_NAMESPACE_PATTERN = /^[a-z][a-z0-9-]{0,30}$/;
@@ -2719,6 +2766,9 @@ function resolveToolExecuteTimeoutMs(toolId, input) {
2719
2766
  return Math.floor(requestedTimeoutMs) + APIFY_SYNC_RESPONSE_GRACE_MS;
2720
2767
  }
2721
2768
  }
2769
+ if (usesExtendedTheirstackJobSearchBudget(normalized, input)) {
2770
+ return THEIRSTACK_SLOW_JOB_SEARCH_CLIENT_TIMEOUT_MS;
2771
+ }
2722
2772
  return normalized === "deeplineagent" || normalized === "deeplineagent_deeplineagent" || normalized === "ai_inference" || normalized === "deeplineagent_ai_inference" || normalized === "aiinference" ? DEEPLINEAGENT_EXECUTE_TIMEOUT_MS : void 0;
2723
2773
  }
2724
2774
  var RUNS_FAILED_LOG_LIMIT = 20;
@@ -4940,7 +4990,8 @@ var DeeplineClient = class {
4940
4990
  async listMonitors(options) {
4941
4991
  const params = new URLSearchParams();
4942
4992
  if (options?.status) params.set("status", options.status);
4943
- if (options?.limit !== void 0) params.set("limit", String(options.limit));
4993
+ if (options?.limit !== void 0)
4994
+ params.set("limit", String(options.limit));
4944
4995
  if (options?.cursor) params.set("cursor", options.cursor);
4945
4996
  if (options?.compact) params.set("compact", "true");
4946
4997
  const query = params.toString();
package/dist/index.mjs CHANGED
@@ -367,7 +367,7 @@ var SDK_RELEASE = {
367
367
  // 0.1.253 makes play-page browser opening opt-in and retires --no-open.
368
368
  // 0.1.254 removes the internal operations tree from the published SDK CLI.
369
369
  // Operators use the checkout-local deepline-admin binary instead.
370
- version: "0.1.286",
370
+ version: "0.1.287",
371
371
  contracts: {
372
372
  api: {
373
373
  name: "sdk-http-api",
@@ -2448,6 +2448,53 @@ async function* observeRunEvents(options) {
2448
2448
  }
2449
2449
  }
2450
2450
 
2451
+ // ../shared_libs/integrations/theirstack-execution-policy.ts
2452
+ var THEIRSTACK_SLOW_JOB_SEARCH_PROVIDER_TIMEOUT_MS = 135e3;
2453
+ var THEIRSTACK_SLOW_JOB_SEARCH_CLIENT_TIMEOUT_MS = 6e4 + THEIRSTACK_SLOW_JOB_SEARCH_PROVIDER_TIMEOUT_MS + 15e3;
2454
+ var LONG_JOB_SEARCH_WINDOW_MS = 365 * 24 * 60 * 60 * 1e3;
2455
+ var DATE_ONLY_PATTERN = /^\d{4}-\d{2}-\d{2}$/;
2456
+ function parseDateOnly(value) {
2457
+ if (typeof value !== "string" || !DATE_ONLY_PATTERN.test(value)) {
2458
+ return null;
2459
+ }
2460
+ const timestamp = Date.parse(`${value}T00:00:00.000Z`);
2461
+ if (!Number.isFinite(timestamp)) {
2462
+ return null;
2463
+ }
2464
+ return new Date(timestamp).toISOString().slice(0, 10) === value ? timestamp : null;
2465
+ }
2466
+ function usesLongExplicitDateWindow(payload) {
2467
+ const postedAtGte = parseDateOnly(payload.posted_at_gte);
2468
+ const postedAtLte = parseDateOnly(payload.posted_at_lte);
2469
+ if (postedAtGte !== null && postedAtLte !== null) {
2470
+ return postedAtLte - postedAtGte >= LONG_JOB_SEARCH_WINDOW_MS;
2471
+ }
2472
+ if (postedAtGte !== null) {
2473
+ return Date.now() - postedAtGte >= LONG_JOB_SEARCH_WINDOW_MS;
2474
+ }
2475
+ return postedAtLte !== null && payload.posted_at_gte == null;
2476
+ }
2477
+ function parseMaxAgeDays(value) {
2478
+ if (typeof value === "number") {
2479
+ return Number.isFinite(value) ? value : null;
2480
+ }
2481
+ if (typeof value !== "string" || !/^-?\d+$/.test(value.trim())) {
2482
+ return null;
2483
+ }
2484
+ const parsed = Number(value.trim());
2485
+ return Number.isSafeInteger(parsed) ? parsed : null;
2486
+ }
2487
+ function usesExtendedTheirstackJobSearchBudget(endpointId, payload) {
2488
+ if (endpointId !== "theirstack_job_search") {
2489
+ return false;
2490
+ }
2491
+ if (payload.include_total_results === true) {
2492
+ return true;
2493
+ }
2494
+ const maxAgeDays = parseMaxAgeDays(payload.posted_at_max_age_days);
2495
+ return maxAgeDays !== null && maxAgeDays >= 365 ? true : usesLongExplicitDateWindow(payload);
2496
+ }
2497
+
2451
2498
  // ../shared_libs/play-runtime/runtime-environment.ts
2452
2499
  var PLAY_RUNTIME_ENVIRONMENTS = ["preview"];
2453
2500
  var PLAY_RUNTIME_NAMESPACE_PATTERN = /^[a-z][a-z0-9-]{0,30}$/;
@@ -2648,6 +2695,9 @@ function resolveToolExecuteTimeoutMs(toolId, input) {
2648
2695
  return Math.floor(requestedTimeoutMs) + APIFY_SYNC_RESPONSE_GRACE_MS;
2649
2696
  }
2650
2697
  }
2698
+ if (usesExtendedTheirstackJobSearchBudget(normalized, input)) {
2699
+ return THEIRSTACK_SLOW_JOB_SEARCH_CLIENT_TIMEOUT_MS;
2700
+ }
2651
2701
  return normalized === "deeplineagent" || normalized === "deeplineagent_deeplineagent" || normalized === "ai_inference" || normalized === "deeplineagent_ai_inference" || normalized === "aiinference" ? DEEPLINEAGENT_EXECUTE_TIMEOUT_MS : void 0;
2652
2702
  }
2653
2703
  var RUNS_FAILED_LOG_LIMIT = 20;
@@ -4869,7 +4919,8 @@ var DeeplineClient = class {
4869
4919
  async listMonitors(options) {
4870
4920
  const params = new URLSearchParams();
4871
4921
  if (options?.status) params.set("status", options.status);
4872
- if (options?.limit !== void 0) params.set("limit", String(options.limit));
4922
+ if (options?.limit !== void 0)
4923
+ params.set("limit", String(options.limit));
4873
4924
  if (options?.cursor) params.set("cursor", options.cursor);
4874
4925
  if (options?.compact) params.set("compact", "true");
4875
4926
  const query = params.toString();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "deepline",
3
- "version": "0.1.286",
3
+ "version": "0.1.287",
4
4
  "description": "Deepline SDK + CLI — B2B data enrichment powered by durable cloud execution",
5
5
  "license": "MIT",
6
6
  "repository": {