deepline 0.1.285 → 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.
- package/dist/bundling-sources/sdk/src/client.ts +13 -4
- package/dist/bundling-sources/sdk/src/release.ts +1 -1
- package/dist/bundling-sources/shared_libs/integrations/theirstack-execution-policy.ts +97 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-api.ts +63 -47
- package/dist/cli/index.js +53 -2
- package/dist/cli/index.mjs +53 -2
- package/dist/index.js +53 -2
- package/dist/index.mjs +53 -2
- package/package.json +1 -1
|
@@ -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)
|
|
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.
|
|
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
|
+
}
|
|
@@ -1737,7 +1737,10 @@ async function resetRuntimePostgresPool(postgresUrl: string): Promise<void> {
|
|
|
1737
1737
|
|
|
1738
1738
|
async function withRuntimePostgres<T>(
|
|
1739
1739
|
session: RuntimePostgresSession,
|
|
1740
|
-
fn: (
|
|
1740
|
+
fn: (
|
|
1741
|
+
client: RuntimePoolClient,
|
|
1742
|
+
transaction: { active: boolean },
|
|
1743
|
+
) => Promise<T>,
|
|
1741
1744
|
options: {
|
|
1742
1745
|
cachePool?: boolean;
|
|
1743
1746
|
maxConnectAttempts?: number;
|
|
@@ -1746,6 +1749,7 @@ async function withRuntimePostgres<T>(
|
|
|
1746
1749
|
): Promise<T> {
|
|
1747
1750
|
let client: RuntimePoolClient | null = null;
|
|
1748
1751
|
let requestLocalPool: RuntimePool | null = null;
|
|
1752
|
+
let roleTransactionStarted = false;
|
|
1749
1753
|
const cachePool =
|
|
1750
1754
|
(options.cachePool ?? true) && canReuseRuntimePostgresPoolsAcrossRequests();
|
|
1751
1755
|
const maxConnectAttempts =
|
|
@@ -1768,13 +1772,19 @@ async function withRuntimePostgres<T>(
|
|
|
1768
1772
|
options.signal,
|
|
1769
1773
|
);
|
|
1770
1774
|
if (session.executionRole) {
|
|
1775
|
+
await client.query('BEGIN');
|
|
1776
|
+
roleTransactionStarted = true;
|
|
1771
1777
|
await client.query(
|
|
1772
|
-
`SET ROLE ${quoteIdentifier(session.executionRole)}`,
|
|
1778
|
+
`SET LOCAL ROLE ${quoteIdentifier(session.executionRole)}`,
|
|
1773
1779
|
);
|
|
1774
1780
|
}
|
|
1775
1781
|
break;
|
|
1776
1782
|
} catch (error) {
|
|
1777
1783
|
if (client) {
|
|
1784
|
+
if (roleTransactionStarted) {
|
|
1785
|
+
await client.query('ROLLBACK').catch(() => {});
|
|
1786
|
+
roleTransactionStarted = false;
|
|
1787
|
+
}
|
|
1778
1788
|
client.release();
|
|
1779
1789
|
client = null;
|
|
1780
1790
|
}
|
|
@@ -1813,15 +1823,20 @@ async function withRuntimePostgres<T>(
|
|
|
1813
1823
|
throw new Error('Runtime Postgres connection was not acquired.');
|
|
1814
1824
|
}
|
|
1815
1825
|
try {
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
await client.query('RESET ROLE');
|
|
1821
|
-
}
|
|
1822
|
-
} finally {
|
|
1823
|
-
client.release();
|
|
1826
|
+
const result = await fn(client, { active: roleTransactionStarted });
|
|
1827
|
+
if (roleTransactionStarted) {
|
|
1828
|
+
await client.query('COMMIT');
|
|
1829
|
+
roleTransactionStarted = false;
|
|
1824
1830
|
}
|
|
1831
|
+
return result;
|
|
1832
|
+
} catch (error) {
|
|
1833
|
+
if (roleTransactionStarted) {
|
|
1834
|
+
await client.query('ROLLBACK').catch(() => {});
|
|
1835
|
+
roleTransactionStarted = false;
|
|
1836
|
+
}
|
|
1837
|
+
throw error;
|
|
1838
|
+
} finally {
|
|
1839
|
+
client.release();
|
|
1825
1840
|
if (requestLocalPool) {
|
|
1826
1841
|
await Promise.resolve(requestLocalPool.end()).catch(() => {});
|
|
1827
1842
|
}
|
|
@@ -2010,14 +2025,15 @@ async function withRuntimeSheetQueryClient<T>(
|
|
|
2010
2025
|
|
|
2011
2026
|
return await withRuntimePostgres(
|
|
2012
2027
|
session,
|
|
2013
|
-
async (client) => {
|
|
2014
|
-
|
|
2028
|
+
async (client, transaction) => {
|
|
2029
|
+
const managesTransaction = input.transactional && !transaction.active;
|
|
2030
|
+
if (managesTransaction) await client.query('BEGIN');
|
|
2015
2031
|
try {
|
|
2016
2032
|
const result = await operation(client);
|
|
2017
|
-
if (
|
|
2033
|
+
if (managesTransaction) await client.query('COMMIT');
|
|
2018
2034
|
return result;
|
|
2019
2035
|
} catch (error) {
|
|
2020
|
-
if (
|
|
2036
|
+
if (managesTransaction) {
|
|
2021
2037
|
await client.query('ROLLBACK').catch(() => {});
|
|
2022
2038
|
}
|
|
2023
2039
|
throw error;
|
|
@@ -2378,19 +2394,37 @@ async function withRuntimeWorkReceiptClient<T>(
|
|
|
2378
2394
|
// can let provider work continue after durable receipt persistence is gone.
|
|
2379
2395
|
// Only the schema-migration branch below may repair ownership before its
|
|
2380
2396
|
// retry. A genuinely missing schema or second failure also rethrows loudly.
|
|
2381
|
-
const
|
|
2397
|
+
const withClient = async <R>(
|
|
2398
|
+
run: (client: RuntimeQueryClient) => Promise<R>,
|
|
2399
|
+
): Promise<R> =>
|
|
2400
|
+
isRuntimeOneShotQueryFactoryRegistered()
|
|
2401
|
+
? await withRuntimeOneShotPostgres(session, run)
|
|
2402
|
+
: await withRuntimePostgres(session, run, {
|
|
2403
|
+
cachePool: !context.disablePostgresPoolCache,
|
|
2404
|
+
signal: context.abortSignal,
|
|
2405
|
+
});
|
|
2406
|
+
let selfHealAttempted = false;
|
|
2407
|
+
|
|
2408
|
+
for (
|
|
2409
|
+
let attempt = 1;
|
|
2410
|
+
attempt <= RUNTIME_WORK_RECEIPT_QUERY_MAX_ATTEMPTS;
|
|
2411
|
+
attempt += 1
|
|
2412
|
+
) {
|
|
2382
2413
|
try {
|
|
2383
|
-
return await operation
|
|
2414
|
+
return await withClient(operation);
|
|
2384
2415
|
} catch (error) {
|
|
2385
|
-
|
|
2416
|
+
const missingStorage =
|
|
2386
2417
|
isMissingRelationError(error) ||
|
|
2387
|
-
isMissingRuntimeWorkReceiptSelfHealColumnError(error)
|
|
2388
|
-
) {
|
|
2418
|
+
isMissingRuntimeWorkReceiptSelfHealColumnError(error);
|
|
2419
|
+
if (missingStorage && !selfHealAttempted) {
|
|
2420
|
+
selfHealAttempted = true;
|
|
2389
2421
|
runtimeWorkReceiptEnsureCache.delete(
|
|
2390
2422
|
runtimeWorkReceiptEnsureCacheKey(session),
|
|
2391
2423
|
);
|
|
2392
2424
|
try {
|
|
2393
|
-
await
|
|
2425
|
+
await withClient((client) =>
|
|
2426
|
+
ensureRuntimeWorkReceiptTable(session, client),
|
|
2427
|
+
);
|
|
2394
2428
|
} catch (ensureError) {
|
|
2395
2429
|
if (!isPostgresPermissionDeniedError(ensureError)) {
|
|
2396
2430
|
throw ensureError;
|
|
@@ -2401,31 +2435,12 @@ async function withRuntimeWorkReceiptClient<T>(
|
|
|
2401
2435
|
await repairRuntimeStorageGrants(context, {
|
|
2402
2436
|
playName: context.playName?.trim() || session.playName,
|
|
2403
2437
|
});
|
|
2438
|
+
await withClient((client) =>
|
|
2439
|
+
ensureRuntimeWorkReceiptTable(session, client),
|
|
2440
|
+
);
|
|
2404
2441
|
}
|
|
2405
|
-
|
|
2406
|
-
throw error;
|
|
2442
|
+
continue;
|
|
2407
2443
|
}
|
|
2408
|
-
return await operation(client);
|
|
2409
|
-
}
|
|
2410
|
-
};
|
|
2411
|
-
|
|
2412
|
-
for (
|
|
2413
|
-
let attempt = 1;
|
|
2414
|
-
attempt <= RUNTIME_WORK_RECEIPT_QUERY_MAX_ATTEMPTS;
|
|
2415
|
-
attempt += 1
|
|
2416
|
-
) {
|
|
2417
|
-
try {
|
|
2418
|
-
return isRuntimeOneShotQueryFactoryRegistered()
|
|
2419
|
-
? await withRuntimeOneShotPostgres(session, runWithSelfHeal)
|
|
2420
|
-
: await withRuntimePostgres(
|
|
2421
|
-
session,
|
|
2422
|
-
(client) => runWithSelfHeal(client),
|
|
2423
|
-
{
|
|
2424
|
-
cachePool: !context.disablePostgresPoolCache,
|
|
2425
|
-
signal: context.abortSignal,
|
|
2426
|
-
},
|
|
2427
|
-
);
|
|
2428
|
-
} catch (error) {
|
|
2429
2444
|
if (
|
|
2430
2445
|
attempt >= RUNTIME_WORK_RECEIPT_QUERY_MAX_ATTEMPTS ||
|
|
2431
2446
|
!isTransientRuntimePostgresOperationError(error)
|
|
@@ -2928,8 +2943,9 @@ async function writeRuntimeRows(
|
|
|
2928
2943
|
const chunks = chunkValues(rowEntries, DIRECT_POSTGRES_BATCH_SIZE);
|
|
2929
2944
|
const needsTransaction = input.mode === 'replace' || chunks.length > 1;
|
|
2930
2945
|
|
|
2931
|
-
return await withRuntimePostgres(session, async (client) => {
|
|
2932
|
-
|
|
2946
|
+
return await withRuntimePostgres(session, async (client, transaction) => {
|
|
2947
|
+
const managesTransaction = needsTransaction && !transaction.active;
|
|
2948
|
+
if (managesTransaction) await client.query('BEGIN');
|
|
2933
2949
|
try {
|
|
2934
2950
|
if (input.mode === 'replace') {
|
|
2935
2951
|
// Collapse 4 cleanup statements into one CTE-shaped query. Postgres
|
|
@@ -3048,10 +3064,10 @@ async function writeRuntimeRows(
|
|
|
3048
3064
|
writtenRows += Number(rows[0]?.inserted_count ?? 0);
|
|
3049
3065
|
}
|
|
3050
3066
|
|
|
3051
|
-
if (
|
|
3067
|
+
if (managesTransaction) await client.query('COMMIT');
|
|
3052
3068
|
return { disposition: 'completed', writtenRows };
|
|
3053
3069
|
} catch (error) {
|
|
3054
|
-
if (
|
|
3070
|
+
if (managesTransaction) {
|
|
3055
3071
|
await client.query('ROLLBACK').catch(() => {});
|
|
3056
3072
|
}
|
|
3057
3073
|
throw error;
|
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.
|
|
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)
|
|
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();
|
package/dist/cli/index.mjs
CHANGED
|
@@ -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.
|
|
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)
|
|
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.
|
|
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)
|
|
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.
|
|
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)
|
|
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();
|