deepline 0.1.48 → 0.1.50

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/index.d.mts CHANGED
@@ -1032,7 +1032,11 @@ declare class DeeplineClient {
1032
1032
  * console.log(`Found ${searchTools.length} search tools`);
1033
1033
  * ```
1034
1034
  */
1035
- listTools(): Promise<ToolDefinition[]>;
1035
+ listTools(options?: {
1036
+ categories?: string;
1037
+ grep?: string;
1038
+ grepMode?: 'all' | 'any' | 'phrase';
1039
+ }): Promise<ToolDefinition[]>;
1036
1040
  /**
1037
1041
  * Search available tools using Deepline's ranked backend search.
1038
1042
  *
@@ -1392,7 +1396,11 @@ declare class DeeplineClient {
1392
1396
  stopRun(runId: string, options?: {
1393
1397
  reason?: string;
1394
1398
  }): Promise<StopPlayRunResult>;
1395
- listPlays(): Promise<PlayListItem[]>;
1399
+ listPlays(options?: {
1400
+ origin?: 'prebuilt' | 'owned';
1401
+ grep?: string;
1402
+ grepMode?: 'all' | 'any' | 'phrase';
1403
+ }): Promise<PlayListItem[]>;
1396
1404
  searchPlays(options: {
1397
1405
  query: string;
1398
1406
  origin?: 'prebuilt' | 'owned';
@@ -1533,7 +1541,7 @@ declare class DeeplineClient {
1533
1541
  }>;
1534
1542
  }
1535
1543
 
1536
- declare const SDK_VERSION = "0.1.48";
1544
+ declare const SDK_VERSION = "0.1.50";
1537
1545
  declare const SDK_API_CONTRACT = "2026-05-stripe-promo-checkout";
1538
1546
 
1539
1547
  /**
@@ -2043,7 +2051,7 @@ interface DeeplinePlayRuntimeContext {
2043
2051
  staleAfterSeconds?: number;
2044
2052
  }): Promise<ToolExecuteResult<TOutput>>;
2045
2053
  };
2046
- runSteps<TInput extends Record<string, unknown>, TOutput>(program: StepProgram<TInput, any, TOutput>, input: TInput, options?: {
2054
+ runSteps<TInput extends Record<string, unknown>, TOutput>(program: StepProgram<TInput, unknown, TOutput>, input: TInput, options?: {
2047
2055
  description?: string;
2048
2056
  }): Promise<TOutput>;
2049
2057
  step<T>(id: string, run: () => T | Promise<T>, options?: {
package/dist/index.d.ts CHANGED
@@ -1032,7 +1032,11 @@ declare class DeeplineClient {
1032
1032
  * console.log(`Found ${searchTools.length} search tools`);
1033
1033
  * ```
1034
1034
  */
1035
- listTools(): Promise<ToolDefinition[]>;
1035
+ listTools(options?: {
1036
+ categories?: string;
1037
+ grep?: string;
1038
+ grepMode?: 'all' | 'any' | 'phrase';
1039
+ }): Promise<ToolDefinition[]>;
1036
1040
  /**
1037
1041
  * Search available tools using Deepline's ranked backend search.
1038
1042
  *
@@ -1392,7 +1396,11 @@ declare class DeeplineClient {
1392
1396
  stopRun(runId: string, options?: {
1393
1397
  reason?: string;
1394
1398
  }): Promise<StopPlayRunResult>;
1395
- listPlays(): Promise<PlayListItem[]>;
1399
+ listPlays(options?: {
1400
+ origin?: 'prebuilt' | 'owned';
1401
+ grep?: string;
1402
+ grepMode?: 'all' | 'any' | 'phrase';
1403
+ }): Promise<PlayListItem[]>;
1396
1404
  searchPlays(options: {
1397
1405
  query: string;
1398
1406
  origin?: 'prebuilt' | 'owned';
@@ -1533,7 +1541,7 @@ declare class DeeplineClient {
1533
1541
  }>;
1534
1542
  }
1535
1543
 
1536
- declare const SDK_VERSION = "0.1.48";
1544
+ declare const SDK_VERSION = "0.1.50";
1537
1545
  declare const SDK_API_CONTRACT = "2026-05-stripe-promo-checkout";
1538
1546
 
1539
1547
  /**
@@ -2043,7 +2051,7 @@ interface DeeplinePlayRuntimeContext {
2043
2051
  staleAfterSeconds?: number;
2044
2052
  }): Promise<ToolExecuteResult<TOutput>>;
2045
2053
  };
2046
- runSteps<TInput extends Record<string, unknown>, TOutput>(program: StepProgram<TInput, any, TOutput>, input: TInput, options?: {
2054
+ runSteps<TInput extends Record<string, unknown>, TOutput>(program: StepProgram<TInput, unknown, TOutput>, input: TInput, options?: {
2047
2055
  description?: string;
2048
2056
  }): Promise<TOutput>;
2049
2057
  step<T>(id: string, run: () => T | Promise<T>, options?: {
package/dist/index.js CHANGED
@@ -215,7 +215,7 @@ function resolveConfig(options) {
215
215
  }
216
216
 
217
217
  // src/version.ts
218
- var SDK_VERSION = "0.1.48";
218
+ var SDK_VERSION = "0.1.50";
219
219
  var SDK_API_CONTRACT = "2026-05-stripe-promo-checkout";
220
220
 
221
221
  // ../shared_libs/play-runtime/coordinator-headers.ts
@@ -735,9 +735,18 @@ var DeeplineClient = class {
735
735
  * console.log(`Found ${searchTools.length} search tools`);
736
736
  * ```
737
737
  */
738
- async listTools() {
738
+ async listTools(options) {
739
+ const params = new URLSearchParams();
740
+ if (options?.categories?.trim()) {
741
+ params.set("categories", options.categories.trim());
742
+ }
743
+ if (options?.grep?.trim()) {
744
+ params.set("grep", options.grep.trim());
745
+ params.set("grep_mode", options.grepMode ?? "all");
746
+ }
747
+ const suffix = params.toString() ? `?${params.toString()}` : "";
739
748
  const res = await this.http.get(
740
- "/api/v2/tools"
749
+ `/api/v2/tools${suffix}`
741
750
  );
742
751
  return res.tools;
743
752
  }
@@ -1372,9 +1381,17 @@ var DeeplineClient = class {
1372
1381
  options?.reason ? { reason: options.reason } : {}
1373
1382
  );
1374
1383
  }
1375
- async listPlays() {
1384
+ async listPlays(options) {
1385
+ const params = new URLSearchParams();
1386
+ if (options?.origin) params.set("origin", options.origin);
1387
+ if (options?.grep?.trim()) {
1388
+ params.set("grep", options.grep.trim());
1389
+ params.set("grep_mode", options.grepMode ?? "all");
1390
+ params.set("limit", "60");
1391
+ }
1392
+ const suffix = params.toString() ? `?${params.toString()}` : "";
1376
1393
  const response = await this.http.get(
1377
- "/api/v2/plays"
1394
+ `/api/v2/plays${suffix}`
1378
1395
  );
1379
1396
  return response.plays ?? [];
1380
1397
  }
@@ -1620,7 +1637,7 @@ function toV2RawToolOutputPath(path) {
1620
1637
  if (normalized === "toolResponse.raw" || normalized.startsWith("toolResponse.raw.")) {
1621
1638
  return normalized;
1622
1639
  }
1623
- const rawPath = normalized.replace(/^result\.data\.?/, "").replace(/^result\.?/, "").replace(/^data\.?/, "").replace(/^\./, "");
1640
+ const rawPath = normalized.replace(/^result\.data\.?/, "").replace(/^result(?:\.|$)/, "").replace(/^data\.?/, "").replace(/^\./, "");
1624
1641
  return rawPath ? `toolResponse.raw.${rawPath}` : "toolResponse.raw";
1625
1642
  }
1626
1643
  function isMeaningfulValue(value) {
@@ -1672,7 +1689,30 @@ function valuesAtSegments(current, segments, path = []) {
1672
1689
  return valuesAtSegments(current[segment], rest, [...path, segment]);
1673
1690
  }
1674
1691
  if (!isRecord2(current)) return [];
1675
- return valuesAtSegments(current[segment], rest, [...path, segment]);
1692
+ const directMatches = valuesAtSegments(current[segment], rest, [
1693
+ ...path,
1694
+ segment
1695
+ ]);
1696
+ if (directMatches.length > 0 || typeof segment !== "string") {
1697
+ return directMatches;
1698
+ }
1699
+ {
1700
+ for (let end = segments.length; end > 1; end -= 1) {
1701
+ const literalSegments = segments.slice(0, end);
1702
+ if (!literalSegments.every((entry) => typeof entry === "string")) {
1703
+ continue;
1704
+ }
1705
+ const literalKey = literalSegments.join(".");
1706
+ if (!Object.prototype.hasOwnProperty.call(current, literalKey)) {
1707
+ continue;
1708
+ }
1709
+ return valuesAtSegments(current[literalKey], segments.slice(end), [
1710
+ ...path,
1711
+ literalKey
1712
+ ]);
1713
+ }
1714
+ }
1715
+ return directMatches;
1676
1716
  }
1677
1717
  function getValuesAtPath(root, path) {
1678
1718
  return valuesAtSegments(root, parsePath(path)).map((entry) => entry.value);
@@ -1696,7 +1736,7 @@ function toV2RawToolOutputPathPreservingProviderData(path) {
1696
1736
  if (normalized === "toolResponse.raw" || normalized.startsWith("toolResponse.raw.")) {
1697
1737
  return normalized;
1698
1738
  }
1699
- const rawPath = normalized.replace(/^result\.?/, "").replace(/^\./, "");
1739
+ const rawPath = normalized.replace(/^result(?:\.|$)/, "").replace(/^\./, "");
1700
1740
  return rawPath ? `toolResponse.raw.${rawPath}` : "toolResponse.raw";
1701
1741
  }
1702
1742
  function candidateResultPaths(path) {
@@ -1870,6 +1910,11 @@ function deriveListKeys(input) {
1870
1910
  for (const rawPath of paths) {
1871
1911
  const path = String(rawPath || "").trim().replace(/^\./, "");
1872
1912
  if (!path) continue;
1913
+ const firstRow = input.rows[0];
1914
+ if (firstRow && Object.prototype.hasOwnProperty.call(firstRow, path)) {
1915
+ keys[target] = path;
1916
+ break;
1917
+ }
1873
1918
  for (const resultPath of candidateResultPaths(path)) {
1874
1919
  const directPrefix = `${listPrefix}.`;
1875
1920
  if (resultPath.startsWith(directPrefix)) {
package/dist/index.mjs CHANGED
@@ -169,7 +169,7 @@ function resolveConfig(options) {
169
169
  }
170
170
 
171
171
  // src/version.ts
172
- var SDK_VERSION = "0.1.48";
172
+ var SDK_VERSION = "0.1.50";
173
173
  var SDK_API_CONTRACT = "2026-05-stripe-promo-checkout";
174
174
 
175
175
  // ../shared_libs/play-runtime/coordinator-headers.ts
@@ -689,9 +689,18 @@ var DeeplineClient = class {
689
689
  * console.log(`Found ${searchTools.length} search tools`);
690
690
  * ```
691
691
  */
692
- async listTools() {
692
+ async listTools(options) {
693
+ const params = new URLSearchParams();
694
+ if (options?.categories?.trim()) {
695
+ params.set("categories", options.categories.trim());
696
+ }
697
+ if (options?.grep?.trim()) {
698
+ params.set("grep", options.grep.trim());
699
+ params.set("grep_mode", options.grepMode ?? "all");
700
+ }
701
+ const suffix = params.toString() ? `?${params.toString()}` : "";
693
702
  const res = await this.http.get(
694
- "/api/v2/tools"
703
+ `/api/v2/tools${suffix}`
695
704
  );
696
705
  return res.tools;
697
706
  }
@@ -1326,9 +1335,17 @@ var DeeplineClient = class {
1326
1335
  options?.reason ? { reason: options.reason } : {}
1327
1336
  );
1328
1337
  }
1329
- async listPlays() {
1338
+ async listPlays(options) {
1339
+ const params = new URLSearchParams();
1340
+ if (options?.origin) params.set("origin", options.origin);
1341
+ if (options?.grep?.trim()) {
1342
+ params.set("grep", options.grep.trim());
1343
+ params.set("grep_mode", options.grepMode ?? "all");
1344
+ params.set("limit", "60");
1345
+ }
1346
+ const suffix = params.toString() ? `?${params.toString()}` : "";
1330
1347
  const response = await this.http.get(
1331
- "/api/v2/plays"
1348
+ `/api/v2/plays${suffix}`
1332
1349
  );
1333
1350
  return response.plays ?? [];
1334
1351
  }
@@ -1574,7 +1591,7 @@ function toV2RawToolOutputPath(path) {
1574
1591
  if (normalized === "toolResponse.raw" || normalized.startsWith("toolResponse.raw.")) {
1575
1592
  return normalized;
1576
1593
  }
1577
- const rawPath = normalized.replace(/^result\.data\.?/, "").replace(/^result\.?/, "").replace(/^data\.?/, "").replace(/^\./, "");
1594
+ const rawPath = normalized.replace(/^result\.data\.?/, "").replace(/^result(?:\.|$)/, "").replace(/^data\.?/, "").replace(/^\./, "");
1578
1595
  return rawPath ? `toolResponse.raw.${rawPath}` : "toolResponse.raw";
1579
1596
  }
1580
1597
  function isMeaningfulValue(value) {
@@ -1626,7 +1643,30 @@ function valuesAtSegments(current, segments, path = []) {
1626
1643
  return valuesAtSegments(current[segment], rest, [...path, segment]);
1627
1644
  }
1628
1645
  if (!isRecord2(current)) return [];
1629
- return valuesAtSegments(current[segment], rest, [...path, segment]);
1646
+ const directMatches = valuesAtSegments(current[segment], rest, [
1647
+ ...path,
1648
+ segment
1649
+ ]);
1650
+ if (directMatches.length > 0 || typeof segment !== "string") {
1651
+ return directMatches;
1652
+ }
1653
+ {
1654
+ for (let end = segments.length; end > 1; end -= 1) {
1655
+ const literalSegments = segments.slice(0, end);
1656
+ if (!literalSegments.every((entry) => typeof entry === "string")) {
1657
+ continue;
1658
+ }
1659
+ const literalKey = literalSegments.join(".");
1660
+ if (!Object.prototype.hasOwnProperty.call(current, literalKey)) {
1661
+ continue;
1662
+ }
1663
+ return valuesAtSegments(current[literalKey], segments.slice(end), [
1664
+ ...path,
1665
+ literalKey
1666
+ ]);
1667
+ }
1668
+ }
1669
+ return directMatches;
1630
1670
  }
1631
1671
  function getValuesAtPath(root, path) {
1632
1672
  return valuesAtSegments(root, parsePath(path)).map((entry) => entry.value);
@@ -1650,7 +1690,7 @@ function toV2RawToolOutputPathPreservingProviderData(path) {
1650
1690
  if (normalized === "toolResponse.raw" || normalized.startsWith("toolResponse.raw.")) {
1651
1691
  return normalized;
1652
1692
  }
1653
- const rawPath = normalized.replace(/^result\.?/, "").replace(/^\./, "");
1693
+ const rawPath = normalized.replace(/^result(?:\.|$)/, "").replace(/^\./, "");
1654
1694
  return rawPath ? `toolResponse.raw.${rawPath}` : "toolResponse.raw";
1655
1695
  }
1656
1696
  function candidateResultPaths(path) {
@@ -1824,6 +1864,11 @@ function deriveListKeys(input) {
1824
1864
  for (const rawPath of paths) {
1825
1865
  const path = String(rawPath || "").trim().replace(/^\./, "");
1826
1866
  if (!path) continue;
1867
+ const firstRow = input.rows[0];
1868
+ if (firstRow && Object.prototype.hasOwnProperty.call(firstRow, path)) {
1869
+ keys[target] = path;
1870
+ break;
1871
+ }
1827
1872
  for (const resultPath of candidateResultPaths(path)) {
1828
1873
  const directPrefix = `${listPrefix}.`;
1829
1874
  if (resultPath.startsWith(directPrefix)) {
@@ -2408,12 +2408,15 @@ export class RuntimeApi extends WorkerEntrypoint<CoordinatorEnv, undefined> {
2408
2408
  { status: 403, headers: { 'content-type': 'application/json' } },
2409
2409
  );
2410
2410
  }
2411
- const apiBaseUrl =
2411
+ const configuredApiBaseUrl =
2412
2412
  typeof this.env.DEEPLINE_API_BASE_URL === 'string' &&
2413
2413
  this.env.DEEPLINE_API_BASE_URL.trim()
2414
2414
  ? this.env.DEEPLINE_API_BASE_URL.trim()
2415
2415
  : 'https://code.deepline.com';
2416
- const target = new URL(incoming.pathname + incoming.search, apiBaseUrl);
2416
+ const target = new URL(
2417
+ incoming.pathname + incoming.search,
2418
+ configuredApiBaseUrl,
2419
+ );
2417
2420
  const forwarded = new Request(target.toString(), request);
2418
2421
  const bypassToken = this.env.VERCEL_PROTECTION_BYPASS_TOKEN;
2419
2422
  if (typeof bypassToken === 'string' && bypassToken) {
@@ -456,6 +456,7 @@ async function probeHarnessOnce(
456
456
  */
457
457
  const RUNTIME_API_TIMEOUT_MS = 30_000;
458
458
  const RUNTIME_API_PLAY_RUN_TIMEOUT_MS = 75_000;
459
+ const RUNTIME_API_INTEGRATION_EXECUTE_TIMEOUT_MS = 180_000;
459
460
  const RUNTIME_API_RETRY_DELAYS_MS = [
460
461
  250, 750, 1500, 3000, 5000, 10000,
461
462
  ] as const;
@@ -469,6 +470,8 @@ async function fetchRuntimeApi(
469
470
  const timeoutMs =
470
471
  path === '/api/v2/plays/run'
471
472
  ? RUNTIME_API_PLAY_RUN_TIMEOUT_MS
473
+ : /^\/api\/v2\/integrations\/[^/]+\/execute$/.test(path)
474
+ ? RUNTIME_API_INTEGRATION_EXECUTE_TIMEOUT_MS
472
475
  : RUNTIME_API_TIMEOUT_MS;
473
476
  const controller = new AbortController();
474
477
  let timeout: ReturnType<typeof setTimeout> | null = null;
@@ -491,9 +491,22 @@ export class DeeplineClient {
491
491
  * console.log(`Found ${searchTools.length} search tools`);
492
492
  * ```
493
493
  */
494
- async listTools(): Promise<ToolDefinition[]> {
494
+ async listTools(options?: {
495
+ categories?: string;
496
+ grep?: string;
497
+ grepMode?: 'all' | 'any' | 'phrase';
498
+ }): Promise<ToolDefinition[]> {
499
+ const params = new URLSearchParams();
500
+ if (options?.categories?.trim()) {
501
+ params.set('categories', options.categories.trim());
502
+ }
503
+ if (options?.grep?.trim()) {
504
+ params.set('grep', options.grep.trim());
505
+ params.set('grep_mode', options.grepMode ?? 'all');
506
+ }
507
+ const suffix = params.toString() ? `?${params.toString()}` : '';
495
508
  const res = await this.http.get<{ tools: ToolDefinition[] }>(
496
- '/api/v2/tools',
509
+ `/api/v2/tools${suffix}`,
497
510
  );
498
511
  return res.tools;
499
512
  }
@@ -1365,9 +1378,21 @@ export class DeeplineClient {
1365
1378
  );
1366
1379
  }
1367
1380
 
1368
- async listPlays(): Promise<PlayListItem[]> {
1381
+ async listPlays(options?: {
1382
+ origin?: 'prebuilt' | 'owned';
1383
+ grep?: string;
1384
+ grepMode?: 'all' | 'any' | 'phrase';
1385
+ }): Promise<PlayListItem[]> {
1386
+ const params = new URLSearchParams();
1387
+ if (options?.origin) params.set('origin', options.origin);
1388
+ if (options?.grep?.trim()) {
1389
+ params.set('grep', options.grep.trim());
1390
+ params.set('grep_mode', options.grepMode ?? 'all');
1391
+ params.set('limit', '60');
1392
+ }
1393
+ const suffix = params.toString() ? `?${params.toString()}` : '';
1369
1394
  const response = await this.http.get<{ plays: PlayListItem[] }>(
1370
- '/api/v2/plays',
1395
+ `/api/v2/plays${suffix}`,
1371
1396
  );
1372
1397
  return response.plays ?? [];
1373
1398
  }
@@ -415,7 +415,7 @@ export interface DeeplinePlayRuntimeContext {
415
415
  ): Promise<ToolExecuteResult<TOutput>>;
416
416
  };
417
417
  runSteps<TInput extends Record<string, unknown>, TOutput>(
418
- program: StepProgram<TInput, any, TOutput>,
418
+ program: StepProgram<TInput, unknown, TOutput>,
419
419
  input: TInput,
420
420
  options?: { description?: string },
421
421
  ): Promise<TOutput>;
@@ -1,2 +1,2 @@
1
- export const SDK_VERSION = "0.1.48";
1
+ export const SDK_VERSION = "0.1.50";
2
2
  export const SDK_API_CONTRACT = "2026-05-stripe-promo-checkout";
@@ -93,7 +93,7 @@ export function toV2RawToolOutputPath(path: string): string {
93
93
  }
94
94
  const rawPath = normalized
95
95
  .replace(/^result\.data\.?/, '')
96
- .replace(/^result\.?/, '')
96
+ .replace(/^result(?:\.|$)/, '')
97
97
  .replace(/^data\.?/, '')
98
98
  .replace(/^\./, '');
99
99
  return rawPath ? `toolResponse.raw.${rawPath}` : 'toolResponse.raw';
@@ -163,7 +163,30 @@ function valuesAtSegments(
163
163
  return valuesAtSegments(current[segment], rest, [...path, segment]);
164
164
  }
165
165
  if (!isRecord(current)) return [];
166
- return valuesAtSegments(current[segment], rest, [...path, segment]);
166
+ const directMatches = valuesAtSegments(current[segment], rest, [
167
+ ...path,
168
+ segment,
169
+ ]);
170
+ if (directMatches.length > 0 || typeof segment !== 'string') {
171
+ return directMatches;
172
+ }
173
+ {
174
+ for (let end = segments.length; end > 1; end -= 1) {
175
+ const literalSegments = segments.slice(0, end);
176
+ if (!literalSegments.every((entry) => typeof entry === 'string')) {
177
+ continue;
178
+ }
179
+ const literalKey = literalSegments.join('.');
180
+ if (!Object.prototype.hasOwnProperty.call(current, literalKey)) {
181
+ continue;
182
+ }
183
+ return valuesAtSegments(current[literalKey], segments.slice(end), [
184
+ ...path,
185
+ literalKey,
186
+ ]);
187
+ }
188
+ }
189
+ return directMatches;
167
190
  }
168
191
 
169
192
  function getValuesAtPath(root: unknown, path: string): unknown[] {
@@ -198,7 +221,7 @@ function toV2RawToolOutputPathPreservingProviderData(path: string): string {
198
221
  ) {
199
222
  return normalized;
200
223
  }
201
- const rawPath = normalized.replace(/^result\.?/, '').replace(/^\./, '');
224
+ const rawPath = normalized.replace(/^result(?:\.|$)/, '').replace(/^\./, '');
202
225
  return rawPath ? `toolResponse.raw.${rawPath}` : 'toolResponse.raw';
203
226
  }
204
227
 
@@ -439,6 +462,14 @@ function deriveListKeys(input: {
439
462
  .trim()
440
463
  .replace(/^\./, '');
441
464
  if (!path) continue;
465
+ const firstRow = input.rows[0];
466
+ if (
467
+ firstRow &&
468
+ Object.prototype.hasOwnProperty.call(firstRow, path)
469
+ ) {
470
+ keys[target] = path;
471
+ break;
472
+ }
442
473
  for (const resultPath of candidateResultPaths(path)) {
443
474
  const directPrefix = `${listPrefix}.`;
444
475
  if (resultPath.startsWith(directPrefix)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "deepline",
3
- "version": "0.1.48",
3
+ "version": "0.1.50",
4
4
  "description": "Deepline SDK + CLI — B2B data enrichment powered by durable cloud execution",
5
5
  "license": "MIT",
6
6
  "repository": {