deepline 0.1.109 → 0.1.111
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/index.js +2634 -1532
- package/dist/cli/index.mjs +2547 -1451
- package/dist/index.d.mts +21 -14
- package/dist/index.d.ts +21 -14
- package/dist/index.js +97 -23
- package/dist/index.mjs +97 -23
- package/dist/repo/apps/play-runner-workers/src/coordinator-entry.ts +192 -121
- package/dist/repo/apps/play-runner-workers/src/entry.ts +254 -65
- package/dist/repo/apps/play-runner-workers/src/runtime/receipts.ts +18 -27
- package/dist/repo/apps/play-runner-workers/src/workflow-instance-create.ts +44 -0
- package/dist/repo/apps/play-runner-workers/src/workflow-retry.ts +7 -11
- package/dist/repo/sdk/src/client.ts +35 -12
- package/dist/repo/sdk/src/errors.ts +2 -2
- package/dist/repo/sdk/src/http.ts +87 -7
- package/dist/repo/sdk/src/play.ts +1 -1
- package/dist/repo/sdk/src/plays/bundle-play-file.ts +5 -1
- package/dist/repo/sdk/src/release.ts +13 -10
- package/dist/repo/sdk/src/tool-output.ts +2 -2
- package/dist/repo/sdk/src/types.ts +9 -6
- package/dist/repo/shared_libs/play-runtime/fullenrich-batching.ts +229 -0
- package/dist/repo/shared_libs/play-runtime/governor/policy.ts +1 -1
- package/dist/repo/shared_libs/play-runtime/play-runtime-batching-registry.ts +20 -0
- package/dist/repo/shared_libs/play-runtime/run-failure.ts +20 -12
- package/dist/repo/shared_libs/play-runtime/run-ledger.ts +147 -70
- package/dist/repo/shared_libs/play-runtime/scheduler-backend.ts +6 -2
- package/dist/repo/shared_libs/play-runtime/secret-redaction.ts +15 -0
- package/dist/repo/shared_libs/play-runtime/work-receipts.ts +1 -0
- package/dist/repo/shared_libs/plays/bundling/index.ts +193 -21
- package/dist/repo/shared_libs/plays/static-pipeline.ts +1 -3
- package/dist/repo/shared_libs/security/outbound-url-policy.ts +238 -0
- package/dist/repo/shared_libs/security/safe-fetch.ts +118 -0
- package/dist/viewer/viewer.css +617 -0
- package/dist/viewer/viewer.js +1496 -0
- package/package.json +5 -1
package/dist/index.d.mts
CHANGED
|
@@ -353,9 +353,9 @@ interface ToolPricingSummary {
|
|
|
353
353
|
* schema, examples, pricing, and extraction guidance before executing.
|
|
354
354
|
*/
|
|
355
355
|
interface ToolDefinition {
|
|
356
|
-
/** Unique tool identifier used in API calls (e.g. `"
|
|
356
|
+
/** Unique tool identifier used in API calls (e.g. `"dropleads_search_people"`). */
|
|
357
357
|
toolId: string;
|
|
358
|
-
/** Provider that backs this tool (e.g. `"
|
|
358
|
+
/** Provider that backs this tool (e.g. `"hunter"`, `"dropleads"`, `"test"`). */
|
|
359
359
|
provider: string;
|
|
360
360
|
/** Human-readable name for display. */
|
|
361
361
|
displayName: string;
|
|
@@ -369,6 +369,8 @@ interface ToolDefinition {
|
|
|
369
369
|
operationId?: string;
|
|
370
370
|
/** Alternative names that resolve to this tool. */
|
|
371
371
|
operationAliases?: string[];
|
|
372
|
+
/** Explicit globally runnable play reference for play-backed catalog entries. */
|
|
373
|
+
playReference?: `prebuilt/${string}`;
|
|
372
374
|
/** Whether detailed input schema is available from `tools describe`. */
|
|
373
375
|
hasInputSchema?: boolean;
|
|
374
376
|
/** Whether detailed output schema is available from `tools describe`. */
|
|
@@ -515,8 +517,8 @@ interface ToolSearchResult {
|
|
|
515
517
|
*
|
|
516
518
|
* @example
|
|
517
519
|
* ```typescript
|
|
518
|
-
* const meta = await client.getTool('
|
|
519
|
-
* console.log(meta.displayName); // "
|
|
520
|
+
* const meta = await client.getTool('dropleads_search_people');
|
|
521
|
+
* console.log(meta.displayName); // "DropLeads People Search"
|
|
520
522
|
* console.log(meta.estimatedCreditsRange); // "1-5"
|
|
521
523
|
* console.log(meta.samples); // { input: {...}, output: {...} }
|
|
522
524
|
* ```
|
|
@@ -1101,8 +1103,9 @@ interface StartPlayRunRequest {
|
|
|
1101
1103
|
/** Optionally let the start request wait briefly and return a terminal result. */
|
|
1102
1104
|
waitForCompletionMs?: number;
|
|
1103
1105
|
/**
|
|
1104
|
-
* Per-run execution profile override. The server defaults to
|
|
1105
|
-
* tests can pass
|
|
1106
|
+
* Per-run execution profile override. The server defaults to workers_edge;
|
|
1107
|
+
* tests and runtime probes can pass a different profile here. Most callers
|
|
1108
|
+
* should leave this unset.
|
|
1106
1109
|
*/
|
|
1107
1110
|
profile?: string;
|
|
1108
1111
|
}
|
|
@@ -1462,10 +1465,12 @@ type BillingPlanEntry = {
|
|
|
1462
1465
|
acquirable: boolean;
|
|
1463
1466
|
};
|
|
1464
1467
|
/** One usage metric published in the billing catalog. */
|
|
1465
|
-
type
|
|
1468
|
+
type BillingMeterEntry = {
|
|
1466
1469
|
id: string;
|
|
1467
1470
|
name: string;
|
|
1468
1471
|
};
|
|
1472
|
+
/** @deprecated Use BillingMeterEntry. Retained for wire/API alias compatibility. */
|
|
1473
|
+
type BillingMetricEntry = BillingMeterEntry;
|
|
1469
1474
|
/** The caller's active plan as reported by the plans endpoint. */
|
|
1470
1475
|
type BillingActivePlan = {
|
|
1471
1476
|
plan_family_id: string;
|
|
@@ -1487,6 +1492,8 @@ type BillingPlansResult = {
|
|
|
1487
1492
|
catalog_version: string;
|
|
1488
1493
|
active_plan: BillingActivePlan;
|
|
1489
1494
|
plans: BillingPlanEntry[];
|
|
1495
|
+
meters: BillingMeterEntry[];
|
|
1496
|
+
/** @deprecated Use meters. Retained for installed SDK compatibility. */
|
|
1490
1497
|
metrics: BillingMetricEntry[];
|
|
1491
1498
|
};
|
|
1492
1499
|
/**
|
|
@@ -1610,12 +1617,12 @@ declare class DeeplineClient {
|
|
|
1610
1617
|
* Returns everything from {@link ToolDefinition} plus pricing info, sample
|
|
1611
1618
|
* inputs/outputs, failure modes, and cost estimates.
|
|
1612
1619
|
*
|
|
1613
|
-
* @param toolId - Tool identifier (e.g. `"
|
|
1620
|
+
* @param toolId - Tool identifier (e.g. `"dropleads_search_people"`)
|
|
1614
1621
|
* @returns Full tool metadata
|
|
1615
1622
|
*
|
|
1616
1623
|
* @example
|
|
1617
1624
|
* ```typescript
|
|
1618
|
-
* const meta = await client.getTool('
|
|
1625
|
+
* const meta = await client.getTool('dropleads_search_people');
|
|
1619
1626
|
* console.log(`Cost: ${meta.estimatedCreditsRange} credits`);
|
|
1620
1627
|
* console.log(`Input schema:`, meta.inputSchema);
|
|
1621
1628
|
* ```
|
|
@@ -2362,7 +2369,7 @@ declare const SDK_API_CONTRACT: string;
|
|
|
2362
2369
|
*
|
|
2363
2370
|
* const client = new DeeplineClient();
|
|
2364
2371
|
* try {
|
|
2365
|
-
* await client.executeTool('
|
|
2372
|
+
* await client.executeTool('dropleads_search_people', { query: 'cto' });
|
|
2366
2373
|
* } catch (err) {
|
|
2367
2374
|
* if (err instanceof AuthError) {
|
|
2368
2375
|
* console.error('Bad API key — run: deepline auth register');
|
|
@@ -2425,7 +2432,7 @@ declare class AuthError extends DeeplineError {
|
|
|
2425
2432
|
* import { RateLimitError } from 'deepline';
|
|
2426
2433
|
*
|
|
2427
2434
|
* try {
|
|
2428
|
-
* await client.executeTool('
|
|
2435
|
+
* await client.executeTool('dropleads_search_people', { query: 'cto' });
|
|
2429
2436
|
* } catch (err) {
|
|
2430
2437
|
* if (err instanceof RateLimitError) {
|
|
2431
2438
|
* console.log(`Retry after ${err.retryAfterMs}ms`);
|
|
@@ -3819,7 +3826,7 @@ declare class DeeplineContext {
|
|
|
3819
3826
|
* @example
|
|
3820
3827
|
* ```typescript
|
|
3821
3828
|
* const tools = await deepline.tools.list();
|
|
3822
|
-
* const meta = await deepline.tools.get('
|
|
3829
|
+
* const meta = await deepline.tools.get('dropleads_search_people');
|
|
3823
3830
|
* const companyLookup = await deepline.tools.execute('test_company_search', { domain: 'stripe.com' });
|
|
3824
3831
|
* const company = companyLookup.toolResponse.raw;
|
|
3825
3832
|
* ```
|
|
@@ -4080,8 +4087,8 @@ type Scalar = string | number | boolean | null;
|
|
|
4080
4087
|
*
|
|
4081
4088
|
* @example Using configured paths (from tool metadata)
|
|
4082
4089
|
* ```typescript
|
|
4083
|
-
* const meta = await client.getTool('
|
|
4084
|
-
* const result = await client.executeTool('
|
|
4090
|
+
* const meta = await client.getTool('dropleads_search_people');
|
|
4091
|
+
* const result = await client.executeTool('dropleads_search_people', { query: 'cto' });
|
|
4085
4092
|
*
|
|
4086
4093
|
* const list = tryConvertToList(result, {
|
|
4087
4094
|
* listExtractorPaths: meta.listExtractorPaths,
|
package/dist/index.d.ts
CHANGED
|
@@ -353,9 +353,9 @@ interface ToolPricingSummary {
|
|
|
353
353
|
* schema, examples, pricing, and extraction guidance before executing.
|
|
354
354
|
*/
|
|
355
355
|
interface ToolDefinition {
|
|
356
|
-
/** Unique tool identifier used in API calls (e.g. `"
|
|
356
|
+
/** Unique tool identifier used in API calls (e.g. `"dropleads_search_people"`). */
|
|
357
357
|
toolId: string;
|
|
358
|
-
/** Provider that backs this tool (e.g. `"
|
|
358
|
+
/** Provider that backs this tool (e.g. `"hunter"`, `"dropleads"`, `"test"`). */
|
|
359
359
|
provider: string;
|
|
360
360
|
/** Human-readable name for display. */
|
|
361
361
|
displayName: string;
|
|
@@ -369,6 +369,8 @@ interface ToolDefinition {
|
|
|
369
369
|
operationId?: string;
|
|
370
370
|
/** Alternative names that resolve to this tool. */
|
|
371
371
|
operationAliases?: string[];
|
|
372
|
+
/** Explicit globally runnable play reference for play-backed catalog entries. */
|
|
373
|
+
playReference?: `prebuilt/${string}`;
|
|
372
374
|
/** Whether detailed input schema is available from `tools describe`. */
|
|
373
375
|
hasInputSchema?: boolean;
|
|
374
376
|
/** Whether detailed output schema is available from `tools describe`. */
|
|
@@ -515,8 +517,8 @@ interface ToolSearchResult {
|
|
|
515
517
|
*
|
|
516
518
|
* @example
|
|
517
519
|
* ```typescript
|
|
518
|
-
* const meta = await client.getTool('
|
|
519
|
-
* console.log(meta.displayName); // "
|
|
520
|
+
* const meta = await client.getTool('dropleads_search_people');
|
|
521
|
+
* console.log(meta.displayName); // "DropLeads People Search"
|
|
520
522
|
* console.log(meta.estimatedCreditsRange); // "1-5"
|
|
521
523
|
* console.log(meta.samples); // { input: {...}, output: {...} }
|
|
522
524
|
* ```
|
|
@@ -1101,8 +1103,9 @@ interface StartPlayRunRequest {
|
|
|
1101
1103
|
/** Optionally let the start request wait briefly and return a terminal result. */
|
|
1102
1104
|
waitForCompletionMs?: number;
|
|
1103
1105
|
/**
|
|
1104
|
-
* Per-run execution profile override. The server defaults to
|
|
1105
|
-
* tests can pass
|
|
1106
|
+
* Per-run execution profile override. The server defaults to workers_edge;
|
|
1107
|
+
* tests and runtime probes can pass a different profile here. Most callers
|
|
1108
|
+
* should leave this unset.
|
|
1106
1109
|
*/
|
|
1107
1110
|
profile?: string;
|
|
1108
1111
|
}
|
|
@@ -1462,10 +1465,12 @@ type BillingPlanEntry = {
|
|
|
1462
1465
|
acquirable: boolean;
|
|
1463
1466
|
};
|
|
1464
1467
|
/** One usage metric published in the billing catalog. */
|
|
1465
|
-
type
|
|
1468
|
+
type BillingMeterEntry = {
|
|
1466
1469
|
id: string;
|
|
1467
1470
|
name: string;
|
|
1468
1471
|
};
|
|
1472
|
+
/** @deprecated Use BillingMeterEntry. Retained for wire/API alias compatibility. */
|
|
1473
|
+
type BillingMetricEntry = BillingMeterEntry;
|
|
1469
1474
|
/** The caller's active plan as reported by the plans endpoint. */
|
|
1470
1475
|
type BillingActivePlan = {
|
|
1471
1476
|
plan_family_id: string;
|
|
@@ -1487,6 +1492,8 @@ type BillingPlansResult = {
|
|
|
1487
1492
|
catalog_version: string;
|
|
1488
1493
|
active_plan: BillingActivePlan;
|
|
1489
1494
|
plans: BillingPlanEntry[];
|
|
1495
|
+
meters: BillingMeterEntry[];
|
|
1496
|
+
/** @deprecated Use meters. Retained for installed SDK compatibility. */
|
|
1490
1497
|
metrics: BillingMetricEntry[];
|
|
1491
1498
|
};
|
|
1492
1499
|
/**
|
|
@@ -1610,12 +1617,12 @@ declare class DeeplineClient {
|
|
|
1610
1617
|
* Returns everything from {@link ToolDefinition} plus pricing info, sample
|
|
1611
1618
|
* inputs/outputs, failure modes, and cost estimates.
|
|
1612
1619
|
*
|
|
1613
|
-
* @param toolId - Tool identifier (e.g. `"
|
|
1620
|
+
* @param toolId - Tool identifier (e.g. `"dropleads_search_people"`)
|
|
1614
1621
|
* @returns Full tool metadata
|
|
1615
1622
|
*
|
|
1616
1623
|
* @example
|
|
1617
1624
|
* ```typescript
|
|
1618
|
-
* const meta = await client.getTool('
|
|
1625
|
+
* const meta = await client.getTool('dropleads_search_people');
|
|
1619
1626
|
* console.log(`Cost: ${meta.estimatedCreditsRange} credits`);
|
|
1620
1627
|
* console.log(`Input schema:`, meta.inputSchema);
|
|
1621
1628
|
* ```
|
|
@@ -2362,7 +2369,7 @@ declare const SDK_API_CONTRACT: string;
|
|
|
2362
2369
|
*
|
|
2363
2370
|
* const client = new DeeplineClient();
|
|
2364
2371
|
* try {
|
|
2365
|
-
* await client.executeTool('
|
|
2372
|
+
* await client.executeTool('dropleads_search_people', { query: 'cto' });
|
|
2366
2373
|
* } catch (err) {
|
|
2367
2374
|
* if (err instanceof AuthError) {
|
|
2368
2375
|
* console.error('Bad API key — run: deepline auth register');
|
|
@@ -2425,7 +2432,7 @@ declare class AuthError extends DeeplineError {
|
|
|
2425
2432
|
* import { RateLimitError } from 'deepline';
|
|
2426
2433
|
*
|
|
2427
2434
|
* try {
|
|
2428
|
-
* await client.executeTool('
|
|
2435
|
+
* await client.executeTool('dropleads_search_people', { query: 'cto' });
|
|
2429
2436
|
* } catch (err) {
|
|
2430
2437
|
* if (err instanceof RateLimitError) {
|
|
2431
2438
|
* console.log(`Retry after ${err.retryAfterMs}ms`);
|
|
@@ -3819,7 +3826,7 @@ declare class DeeplineContext {
|
|
|
3819
3826
|
* @example
|
|
3820
3827
|
* ```typescript
|
|
3821
3828
|
* const tools = await deepline.tools.list();
|
|
3822
|
-
* const meta = await deepline.tools.get('
|
|
3829
|
+
* const meta = await deepline.tools.get('dropleads_search_people');
|
|
3823
3830
|
* const companyLookup = await deepline.tools.execute('test_company_search', { domain: 'stripe.com' });
|
|
3824
3831
|
* const company = companyLookup.toolResponse.raw;
|
|
3825
3832
|
* ```
|
|
@@ -4080,8 +4087,8 @@ type Scalar = string | number | boolean | null;
|
|
|
4080
4087
|
*
|
|
4081
4088
|
* @example Using configured paths (from tool metadata)
|
|
4082
4089
|
* ```typescript
|
|
4083
|
-
* const meta = await client.getTool('
|
|
4084
|
-
* const result = await client.executeTool('
|
|
4090
|
+
* const meta = await client.getTool('dropleads_search_people');
|
|
4091
|
+
* const result = await client.executeTool('dropleads_search_people', { query: 'cto' });
|
|
4085
4092
|
*
|
|
4086
4093
|
* const list = tryConvertToList(result, {
|
|
4087
4094
|
* listExtractorPaths: meta.listExtractorPaths,
|
package/dist/index.js
CHANGED
|
@@ -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.
|
|
277
|
+
version: "0.1.111",
|
|
278
278
|
apiContract: "2026-06-dataset-column-cell-stale-hard-cutover",
|
|
279
279
|
supportPolicy: {
|
|
280
|
-
latest: "0.1.
|
|
280
|
+
latest: "0.1.111",
|
|
281
281
|
minimumSupported: "0.1.53",
|
|
282
282
|
deprecatedBelow: "0.1.53",
|
|
283
283
|
commandMinimumSupported: [
|
|
@@ -304,6 +304,7 @@ var SYNTHETIC_RUN_HEADER = "x-deepline-synthetic-run";
|
|
|
304
304
|
|
|
305
305
|
// src/http.ts
|
|
306
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.";
|
|
307
308
|
var HttpClient = class {
|
|
308
309
|
constructor(config) {
|
|
309
310
|
this.config = config;
|
|
@@ -339,6 +340,7 @@ var HttpClient = class {
|
|
|
339
340
|
"User-Agent": `deepline-ts-sdk/${SDK_VERSION}`,
|
|
340
341
|
"X-Deepline-Client-Family": "sdk",
|
|
341
342
|
"X-Deepline-CLI-Family": "sdk",
|
|
343
|
+
"X-Deepline-Agent-Runtime": detectAgentRuntime(),
|
|
342
344
|
"X-Deepline-CLI-Version": SDK_VERSION,
|
|
343
345
|
"X-Deepline-SDK-Version": SDK_VERSION,
|
|
344
346
|
"X-Deepline-API-Contract": SDK_API_CONTRACT,
|
|
@@ -441,12 +443,13 @@ var HttpClient = class {
|
|
|
441
443
|
parsed = body;
|
|
442
444
|
}
|
|
443
445
|
if (!response.ok) {
|
|
446
|
+
const retryableApiError = options?.retryApiErrors === true && isRetryableApiErrorResponse(response.status);
|
|
444
447
|
const htmlError = detectHtmlErrorBody(
|
|
445
448
|
body,
|
|
446
449
|
response.headers.get("content-type")
|
|
447
450
|
);
|
|
448
451
|
if (htmlError) {
|
|
449
|
-
|
|
452
|
+
lastError = new DeeplineError(
|
|
450
453
|
htmlError.message(response.status),
|
|
451
454
|
response.status,
|
|
452
455
|
"API_ERROR",
|
|
@@ -456,12 +459,23 @@ var HttpClient = class {
|
|
|
456
459
|
...htmlError.workerThrewException ? { workerThrewException: true } : {}
|
|
457
460
|
}
|
|
458
461
|
);
|
|
462
|
+
if (retryableApiError && attempt < this.config.maxRetries) {
|
|
463
|
+
retryAfterDelayMs = parseOptionalRetryAfter(response);
|
|
464
|
+
break;
|
|
465
|
+
}
|
|
466
|
+
throw lastError;
|
|
459
467
|
}
|
|
460
468
|
const errorValue = typeof parsed === "object" && parsed && "error" in parsed ? parsed.error : void 0;
|
|
461
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}`;
|
|
462
|
-
|
|
470
|
+
const apiErrorCode = errorValue && typeof errorValue === "object" && typeof errorValue.code === "string" ? errorValue.code : "API_ERROR";
|
|
471
|
+
lastError = new DeeplineError(msg, response.status, apiErrorCode, {
|
|
463
472
|
response: parsed
|
|
464
473
|
});
|
|
474
|
+
if (retryableApiError && attempt < this.config.maxRetries) {
|
|
475
|
+
retryAfterDelayMs = parseOptionalRetryAfter(response);
|
|
476
|
+
break;
|
|
477
|
+
}
|
|
478
|
+
throw lastError;
|
|
465
479
|
}
|
|
466
480
|
return parsed;
|
|
467
481
|
} catch (error) {
|
|
@@ -482,7 +496,7 @@ var HttpClient = class {
|
|
|
482
496
|
throw lastError;
|
|
483
497
|
}
|
|
484
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?`;
|
|
485
|
-
throw new DeeplineError(errorMessage);
|
|
499
|
+
throw new DeeplineError(withCoworkNetworkHint(errorMessage));
|
|
486
500
|
}
|
|
487
501
|
/**
|
|
488
502
|
* Send a GET request.
|
|
@@ -554,7 +568,9 @@ var HttpClient = class {
|
|
|
554
568
|
}
|
|
555
569
|
}
|
|
556
570
|
throw new DeeplineError(
|
|
557
|
-
|
|
571
|
+
withCoworkNetworkHint(
|
|
572
|
+
lastError?.message ? `Unable to stream from ${this.config.baseUrl}. ${lastError.message}` : `Unable to stream from ${this.config.baseUrl}.`
|
|
573
|
+
)
|
|
558
574
|
);
|
|
559
575
|
}
|
|
560
576
|
/**
|
|
@@ -564,11 +580,12 @@ var HttpClient = class {
|
|
|
564
580
|
* @param path - API path
|
|
565
581
|
* @param body - Request body (will be JSON-serialized)
|
|
566
582
|
*/
|
|
567
|
-
async post(path, body, headers) {
|
|
583
|
+
async post(path, body, headers, options) {
|
|
568
584
|
return this.request(path, {
|
|
569
585
|
method: "POST",
|
|
570
586
|
body,
|
|
571
|
-
headers
|
|
587
|
+
headers,
|
|
588
|
+
...options
|
|
572
589
|
});
|
|
573
590
|
}
|
|
574
591
|
async postFormData(path, formData, headers) {
|
|
@@ -609,6 +626,9 @@ function parseResponseBody(body) {
|
|
|
609
626
|
return body;
|
|
610
627
|
}
|
|
611
628
|
}
|
|
629
|
+
function isRetryableApiErrorResponse(status) {
|
|
630
|
+
return status === 408 || status === 425 || status >= 500 && status < 600;
|
|
631
|
+
}
|
|
612
632
|
function detectHtmlErrorBody(body, contentType) {
|
|
613
633
|
const trimmed = body.trim();
|
|
614
634
|
const lower = trimmed.toLowerCase();
|
|
@@ -648,6 +668,9 @@ function apiErrorMessage(parsed, status) {
|
|
|
648
668
|
return `HTTP ${status}`;
|
|
649
669
|
}
|
|
650
670
|
function parseRetryAfter(response) {
|
|
671
|
+
return parseOptionalRetryAfter(response) ?? 5e3;
|
|
672
|
+
}
|
|
673
|
+
function parseOptionalRetryAfter(response) {
|
|
651
674
|
const header = response.headers.get("retry-after");
|
|
652
675
|
if (header) {
|
|
653
676
|
const seconds = Number(header);
|
|
@@ -655,7 +678,7 @@ function parseRetryAfter(response) {
|
|
|
655
678
|
return seconds * 1e3;
|
|
656
679
|
}
|
|
657
680
|
}
|
|
658
|
-
return
|
|
681
|
+
return null;
|
|
659
682
|
}
|
|
660
683
|
function buildCandidateUrls(url) {
|
|
661
684
|
try {
|
|
@@ -712,6 +735,39 @@ function decodeSseFrame(frame) {
|
|
|
712
735
|
function sleep(ms) {
|
|
713
736
|
return new Promise((resolve2) => setTimeout(resolve2, ms));
|
|
714
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
|
+
}
|
|
715
771
|
|
|
716
772
|
// src/stream-reconnect.ts
|
|
717
773
|
var STREAM_RECONNECT_BASE_DELAY_MS = 500;
|
|
@@ -1988,12 +2044,12 @@ var DeeplineClient = class {
|
|
|
1988
2044
|
* Returns everything from {@link ToolDefinition} plus pricing info, sample
|
|
1989
2045
|
* inputs/outputs, failure modes, and cost estimates.
|
|
1990
2046
|
*
|
|
1991
|
-
* @param toolId - Tool identifier (e.g. `"
|
|
2047
|
+
* @param toolId - Tool identifier (e.g. `"dropleads_search_people"`)
|
|
1992
2048
|
* @returns Full tool metadata
|
|
1993
2049
|
*
|
|
1994
2050
|
* @example
|
|
1995
2051
|
* ```typescript
|
|
1996
|
-
* const meta = await client.getTool('
|
|
2052
|
+
* const meta = await client.getTool('dropleads_search_people');
|
|
1997
2053
|
* console.log(`Cost: ${meta.estimatedCreditsRange} credits`);
|
|
1998
2054
|
* console.log(`Input schema:`, meta.inputSchema);
|
|
1999
2055
|
* ```
|
|
@@ -2025,7 +2081,8 @@ var DeeplineClient = class {
|
|
|
2025
2081
|
return this.http.post(
|
|
2026
2082
|
`/api/v2/integrations/${encodeURIComponent(toolId)}/execute`,
|
|
2027
2083
|
{ payload: input },
|
|
2028
|
-
headers
|
|
2084
|
+
headers,
|
|
2085
|
+
{ forbiddenAsApiError: true }
|
|
2029
2086
|
);
|
|
2030
2087
|
}
|
|
2031
2088
|
/**
|
|
@@ -2107,7 +2164,7 @@ var DeeplineClient = class {
|
|
|
2107
2164
|
...request.force ? { force: true } : {},
|
|
2108
2165
|
...typeof request.waitForCompletionMs === "number" ? { waitForCompletionMs: request.waitForCompletionMs } : {},
|
|
2109
2166
|
// Profile selection is the API's job, not the CLI's. The server
|
|
2110
|
-
//
|
|
2167
|
+
// defaults to workers_edge; tests and runtime probes that want a
|
|
2111
2168
|
// different profile pass `request.profile` explicitly.
|
|
2112
2169
|
...request.profile ? { profile: request.profile } : {}
|
|
2113
2170
|
}
|
|
@@ -2172,10 +2229,15 @@ var DeeplineClient = class {
|
|
|
2172
2229
|
sourceFiles: input.sourceFiles,
|
|
2173
2230
|
artifact: input.artifact
|
|
2174
2231
|
});
|
|
2175
|
-
return this.http.post(
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
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
|
+
);
|
|
2179
2241
|
}
|
|
2180
2242
|
/**
|
|
2181
2243
|
* Register multiple bundled play artifacts in one request.
|
|
@@ -2185,7 +2247,12 @@ var DeeplineClient = class {
|
|
|
2185
2247
|
*/
|
|
2186
2248
|
async registerPlayArtifacts(artifacts) {
|
|
2187
2249
|
if (artifacts.length === 0) {
|
|
2188
|
-
return this.http.post(
|
|
2250
|
+
return this.http.post(
|
|
2251
|
+
"/api/v2/plays/artifacts",
|
|
2252
|
+
{ artifacts },
|
|
2253
|
+
void 0,
|
|
2254
|
+
{ forbiddenAsApiError: true, retryApiErrors: true }
|
|
2255
|
+
);
|
|
2189
2256
|
}
|
|
2190
2257
|
const compiledArtifacts = await mapWithConcurrency(
|
|
2191
2258
|
artifacts,
|
|
@@ -2203,9 +2270,14 @@ var DeeplineClient = class {
|
|
|
2203
2270
|
const responses = [];
|
|
2204
2271
|
for (const chunk of chunkRegisterPlayArtifacts(compiledArtifacts)) {
|
|
2205
2272
|
responses.push(
|
|
2206
|
-
await this.http.post(
|
|
2207
|
-
artifacts
|
|
2208
|
-
|
|
2273
|
+
await this.http.post(
|
|
2274
|
+
"/api/v2/plays/artifacts",
|
|
2275
|
+
{
|
|
2276
|
+
artifacts: chunk
|
|
2277
|
+
},
|
|
2278
|
+
void 0,
|
|
2279
|
+
{ forbiddenAsApiError: true, retryApiErrors: true }
|
|
2280
|
+
)
|
|
2209
2281
|
);
|
|
2210
2282
|
}
|
|
2211
2283
|
return {
|
|
@@ -3010,7 +3082,9 @@ var DeeplineClient = class {
|
|
|
3010
3082
|
const encodedName = encodeURIComponent(name);
|
|
3011
3083
|
return this.http.post(
|
|
3012
3084
|
`/api/v2/plays/${encodedName}/live`,
|
|
3013
|
-
request
|
|
3085
|
+
request,
|
|
3086
|
+
void 0,
|
|
3087
|
+
{ forbiddenAsApiError: true }
|
|
3014
3088
|
);
|
|
3015
3089
|
}
|
|
3016
3090
|
/**
|
|
@@ -4252,7 +4326,7 @@ var DeeplineContext = class {
|
|
|
4252
4326
|
* @example
|
|
4253
4327
|
* ```typescript
|
|
4254
4328
|
* const tools = await deepline.tools.list();
|
|
4255
|
-
* const meta = await deepline.tools.get('
|
|
4329
|
+
* const meta = await deepline.tools.get('dropleads_search_people');
|
|
4256
4330
|
* const companyLookup = await deepline.tools.execute('test_company_search', { domain: 'stripe.com' });
|
|
4257
4331
|
* const company = companyLookup.toolResponse.raw;
|
|
4258
4332
|
* ```
|