deepline 0.3.305 → 0.3.306

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.
Files changed (96) hide show
  1. package/dist/bundling-sources/sdk/src/cli-invocation-id.ts +14 -0
  2. package/dist/bundling-sources/sdk/src/client.ts +24 -1
  3. package/dist/bundling-sources/sdk/src/http.ts +11 -0
  4. package/dist/bundling-sources/sdk/src/release.ts +1 -1
  5. package/dist/bundling-sources/sdk/src/tool-calls.ts +19 -1
  6. package/dist/cli/{auth-XMYFUM5L.mjs → auth-WTC7LCQ6.mjs} +4 -4
  7. package/dist/cli/auth-ZT3UF33R.js +31 -0
  8. package/dist/cli/{billing-NDUDRJ7T.js → billing-3DYTHO32.js} +70 -70
  9. package/dist/cli/{billing-RXT6NYAU.mjs → billing-VQM65LVP.mjs} +4 -4
  10. package/dist/cli/chunk-2IKIG333.js +65 -0
  11. package/dist/cli/{chunk-E4YSOJ2H.js → chunk-2KR56MPF.js} +2 -2
  12. package/dist/cli/{chunk-6C4SD4U3.mjs → chunk-4PSSDZQB.mjs} +7 -1
  13. package/dist/cli/{chunk-TGOAQTY3.mjs → chunk-5HS5EEFE.mjs} +3 -3
  14. package/dist/cli/{chunk-QFSISXKO.mjs → chunk-5V56XCQN.mjs} +1 -1
  15. package/dist/cli/{chunk-AEMR2R5H.mjs → chunk-6CRUYVU7.mjs} +4 -4
  16. package/dist/cli/{chunk-SCX2AZFY.mjs → chunk-7XORS6WQ.mjs} +2 -2
  17. package/dist/cli/{chunk-44GHROVJ.mjs → chunk-FJ3DANI4.mjs} +1 -1
  18. package/dist/cli/{chunk-ZQOFBLJN.js → chunk-FZNO6B4W.js} +6 -6
  19. package/dist/cli/{chunk-S3HPQWZ3.mjs → chunk-LLGF6V6I.mjs} +44 -8
  20. package/dist/cli/{chunk-B7PAZBJX.js → chunk-M6HCRRV2.js} +10 -4
  21. package/dist/cli/{chunk-COMHSM6F.js → chunk-MMNZ6GBT.js} +6 -6
  22. package/dist/cli/{chunk-LUBEGHJC.js → chunk-OF7QP2XX.js} +15 -15
  23. package/dist/cli/{chunk-DNSTXIU4.js → chunk-OZIFVQRY.js} +1 -1
  24. package/dist/cli/{chunk-KNHD6J3X.js → chunk-PHNAFCSB.js} +275 -239
  25. package/dist/cli/{chunk-HELHRPU6.mjs → chunk-QDC4XTO3.mjs} +2 -2
  26. package/dist/cli/{chunk-5UZQ75HD.js → chunk-RODIZCGU.js} +60 -60
  27. package/dist/cli/{chunk-DY72E7K2.js → chunk-SZQPJW2L.js} +6 -6
  28. package/dist/cli/{chunk-XZD3NYOL.js → chunk-U37SW6IK.js} +48 -48
  29. package/dist/cli/chunk-UABLQKTZ.mjs +65 -0
  30. package/dist/cli/{chunk-445RPDOQ.mjs → chunk-UT3VLSLM.mjs} +5 -5
  31. package/dist/cli/{chunk-UWDFJXBQ.js → chunk-W7ELTWDM.js} +26 -26
  32. package/dist/cli/{chunk-LYPASDJJ.mjs → chunk-WV64SNDV.mjs} +1 -1
  33. package/dist/cli/{chunk-KNK42P4M.mjs → chunk-WWPI4GJI.mjs} +1 -1
  34. package/dist/cli/{client-WOHHEX5X.mjs → client-DCEK34D5.mjs} +3 -3
  35. package/dist/cli/client-UQXVU2T6.js +20 -0
  36. package/dist/cli/{csv-WZ5BOOT7.js → csv-H42JDJ6G.js} +12 -12
  37. package/dist/cli/{csv-WNPLDGFR.mjs → csv-LXBF5UIV.mjs} +3 -3
  38. package/dist/cli/{db-GCQJHGME.mjs → db-3O5CFLNP.mjs} +4 -4
  39. package/dist/cli/{db-GBK4QSIU.js → db-DP5GU4MU.js} +20 -20
  40. package/dist/cli/{executions-BAS6T2BN.js → executions-5FFTPHEX.js} +6 -6
  41. package/dist/cli/{executions-MSB6FRNL.mjs → executions-QC2UZKIP.mjs} +4 -4
  42. package/dist/cli/{feedback-VREMIXAX.mjs → feedback-JCGE6JFW.mjs} +3 -3
  43. package/dist/cli/{feedback-UHOHIOPV.js → feedback-XAU3FI5S.js} +6 -6
  44. package/dist/cli/git-CNO2UFZE.js +23 -0
  45. package/dist/cli/{git-GQKD556H.mjs → git-S3Y3E2NL.mjs} +4 -4
  46. package/dist/cli/index.js +155 -121
  47. package/dist/cli/index.mjs +121 -87
  48. package/dist/cli/{legacy-noops-RI2ROZ6U.mjs → legacy-noops-FQF2IRVS.mjs} +4 -4
  49. package/dist/cli/{legacy-noops-PIL4KNVA.js → legacy-noops-TXOUX4FX.js} +7 -7
  50. package/dist/cli/{monitors-UVQLZDIO.js → monitors-4BQCO6B7.js} +85 -85
  51. package/dist/cli/{monitors-QHLEULAZ.mjs → monitors-F3PELPSH.mjs} +4 -4
  52. package/dist/cli/{org-BYWI4VI3.mjs → org-ER5J3ATG.mjs} +4 -4
  53. package/dist/cli/{org-KXJJZOSK.js → org-VQM6OOLK.js} +60 -60
  54. package/dist/cli/{play-WF7AJJ7J.mjs → play-B5H2RN4N.mjs} +6 -6
  55. package/dist/cli/{play-3XR54PQY.js → play-WKZPAOW3.js} +200 -200
  56. package/dist/cli/{providers-4FYRPS4E.js → providers-5TEA2FJG.js} +7 -7
  57. package/dist/cli/{providers-FG67H5N5.mjs → providers-6ODEAYC2.mjs} +4 -4
  58. package/dist/cli/{quickstart-IBWIR4LX.mjs → quickstart-BCYT7BCY.mjs} +3 -3
  59. package/dist/cli/{quickstart-3YCFHVKY.js → quickstart-GJYCNMFC.js} +5 -5
  60. package/dist/cli/{search-6PQ4QBMC.js → search-KKJ535OX.js} +6 -6
  61. package/dist/cli/{search-OZRXENTS.mjs → search-RY547KOT.mjs} +5 -5
  62. package/dist/cli/{secrets-2JW5HCHH.js → secrets-RFGDXSEW.js} +13 -13
  63. package/dist/cli/{secrets-S3GIROJA.mjs → secrets-U42ZEYIU.mjs} +4 -4
  64. package/dist/cli/{sessions-6HNVWH3C.mjs → sessions-YWEFB62D.mjs} +4 -4
  65. package/dist/cli/{sessions-AQQ6WHMK.js → sessions-ZRTWHMIH.js} +5 -5
  66. package/dist/cli/{settings-6FINI54L.mjs → settings-AS4U6NVP.mjs} +7 -7
  67. package/dist/cli/{settings-HSHA2FO5.js → settings-XUWFXIL7.js} +74 -74
  68. package/dist/cli/{setup-XHIBSXCC.mjs → setup-2GUIV2EW.mjs} +6 -6
  69. package/dist/cli/{setup-O7FZ5EUD.js → setup-2QPWP2FI.js} +41 -41
  70. package/dist/cli/skills-4E5KYW2Y.js +28 -0
  71. package/dist/cli/{skills-ZFIIWR5G.mjs → skills-5QS7ERVF.mjs} +4 -4
  72. package/dist/cli/{tools-4B4NLVOJ.js → tools-J47LIO2H.js} +120 -87
  73. package/dist/cli/{tools-WURPIECI.mjs → tools-PVWSGCZD.mjs} +76 -43
  74. package/dist/cli/update-GZKGOMKD.js +28 -0
  75. package/dist/cli/{update-2THOPAUS.mjs → update-KS4TRSZI.mjs} +6 -6
  76. package/dist/cli/{workflow-XS5JSKED.js → workflow-HQRUUTTL.js} +15 -15
  77. package/dist/cli/{workflow-S2G453ZX.mjs → workflow-QCLR7GVC.mjs} +5 -5
  78. package/dist/{client-BT11xxG8.d.mts → client-Dj8MAkDc.d.mts} +6 -1
  79. package/dist/{client-5Nsl0O0v.d.ts → client-DsrFGXJf.d.ts} +6 -1
  80. package/dist/index.d.mts +2 -2
  81. package/dist/index.d.ts +2 -2
  82. package/dist/index.js +6 -6
  83. package/dist/index.mjs +3 -3
  84. package/dist/install-integrity.json +73 -70
  85. package/dist/plays/run-request.d.mts +1 -1
  86. package/dist/plays/run-request.d.ts +1 -1
  87. package/dist/release.d.mts +1 -1
  88. package/dist/release.d.ts +1 -1
  89. package/dist/release.js +2 -2
  90. package/dist/release.mjs +1 -1
  91. package/package.json +1 -1
  92. package/dist/cli/auth-WRUUITRZ.js +0 -31
  93. package/dist/cli/client-KBAPBERE.js +0 -20
  94. package/dist/cli/git-6QYO4FQH.js +0 -23
  95. package/dist/cli/skills-3ASRSEF2.js +0 -28
  96. package/dist/cli/update-7ZPTMO6H.js +0 -28
@@ -0,0 +1,14 @@
1
+ import { DeeplineError } from './errors.js';
2
+
3
+ const CLI_INVOCATION_ID_PATTERN =
4
+ /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
5
+
6
+ export function validateCliInvocationId(value: string): void {
7
+ if (!CLI_INVOCATION_ID_PATTERN.test(value)) {
8
+ throw new DeeplineError(
9
+ 'CLI invocation IDs must be UUID v4 values.',
10
+ undefined,
11
+ 'CLI_INVOCATION_ID_INVALID',
12
+ );
13
+ }
14
+ }
@@ -57,6 +57,7 @@ import {
57
57
  type ExecutionByKeyResult,
58
58
  type ToolExecution,
59
59
  } from './tool-calls.js';
60
+ import { validateCliInvocationId } from './cli-invocation-id.js';
60
61
  export type {
61
62
  ExecutionRecovery,
62
63
  ExecutionByKeyResult,
@@ -3263,7 +3264,13 @@ export class DeeplineClient {
3263
3264
  * console.log(`Input schema:`, meta.inputSchema);
3264
3265
  * ```
3265
3266
  */
3266
- async getTool(toolId: string): Promise<ToolMetadata> {
3267
+ async getTool(
3268
+ toolId: string,
3269
+ options?: { cliInvocationId?: string },
3270
+ ): Promise<ToolMetadata> {
3271
+ if (options?.cliInvocationId !== undefined) {
3272
+ validateCliInvocationId(options.cliInvocationId);
3273
+ }
3267
3274
  return this.http.request<ToolMetadata>(
3268
3275
  `/api/v2/integrations/${encodeURIComponent(toolId)}/get`,
3269
3276
  {
@@ -3274,6 +3281,9 @@ export class DeeplineClient {
3274
3281
  retryApiErrors: true,
3275
3282
  headers: {
3276
3283
  'x-deepline-tool-meta-only': '1',
3284
+ ...(options?.cliInvocationId !== undefined
3285
+ ? { 'x-deepline-cli-invocation-id': options.cliInvocationId }
3286
+ : {}),
3277
3287
  },
3278
3288
  },
3279
3289
  );
@@ -5427,7 +5437,11 @@ export class DeeplineClient {
5427
5437
  query: string;
5428
5438
  compact?: boolean;
5429
5439
  scope?: 'prebuilt' | 'owned' | 'all';
5440
+ cliInvocationId?: string;
5430
5441
  }): Promise<PlayDescription[]> {
5442
+ if (options.cliInvocationId !== undefined) {
5443
+ validateCliInvocationId(options.cliInvocationId);
5444
+ }
5431
5445
  const params = new URLSearchParams();
5432
5446
  params.set('search', options.query.trim());
5433
5447
  const scope = options.scope ?? 'prebuilt';
@@ -5436,6 +5450,15 @@ export class DeeplineClient {
5436
5450
  }
5437
5451
  const response = await this.http.get<{ plays: PlayListItem[] }>(
5438
5452
  `/api/v2/plays?${params.toString()}`,
5453
+ {
5454
+ ...(options.cliInvocationId !== undefined
5455
+ ? {
5456
+ headers: {
5457
+ 'x-deepline-cli-invocation-id': options.cliInvocationId,
5458
+ },
5459
+ }
5460
+ : {}),
5461
+ },
5439
5462
  );
5440
5463
  const plays = (response.plays ?? []).map((play) =>
5441
5464
  this.summarizePlayListItem(play, options),
@@ -8,6 +8,8 @@
8
8
  *
9
9
  * - **Max attempts**: `1 + maxRetries` (default: 4 total attempts)
10
10
  * - **Backoff**: exponential — 1s, 2s, 4s, 8s, ... capped at 30s
11
+ * - **Total automatic retry wait**: 30s per request; a longer upstream
12
+ * `Retry-After` is returned to the caller instead of blocking the request
11
13
  * - **Retryable**: network errors, timeouts, HTTP 429 (rate limit)
12
14
  * - **Not retryable**: HTTP 401 (auth error), HTTP 403 and other 4xx API errors
13
15
  *
@@ -54,6 +56,7 @@ const COWORK_NETWORK_HINT =
54
56
  '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.';
55
57
  const REQUEST_TIMEOUT_MARKER = Symbol('deeplineRequestTimeout');
56
58
  const REQUEST_ABORT_MARKER = Symbol('deeplineRequestAbort');
59
+ const MAX_AUTOMATIC_RETRY_WAIT_MS = 30_000;
57
60
 
58
61
  interface RequestOptions {
59
62
  method?: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
@@ -431,6 +434,7 @@ export class HttpClient {
431
434
  ? [url]
432
435
  : buildCandidateUrls(url);
433
436
  let retryAfterDelayMs: number | null = null;
437
+ let totalRetryWaitMs = 0;
434
438
 
435
439
  const maxRetries = options?.maxRetries ?? this.config.maxRetries;
436
440
 
@@ -447,6 +451,13 @@ export class HttpClient {
447
451
  ? backoffMs
448
452
  : Math.max(backoffMs, retryAfterDelayMs);
449
453
  retryAfterDelayMs = null;
454
+ if (totalRetryWaitMs + delayMs > MAX_AUTOMATIC_RETRY_WAIT_MS) {
455
+ // Honor the upstream delay by returning its original error. Never
456
+ // retry sooner than requested, and never let automatic retries hold
457
+ // the caller for an unbounded series of Retry-After sleeps.
458
+ break requestAttempts;
459
+ }
460
+ totalRetryWaitMs += delayMs;
450
461
  networkPhase = 'retry_wait';
451
462
  try {
452
463
  await sleep(delayMs, options?.signal);
@@ -200,7 +200,7 @@ export const SDK_RELEASE = {
200
200
  // getters keep their established compatibility behavior.
201
201
  // 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
202
202
  // 0.3.90 is the first deliberately versioned SDK release for API v3.
203
- version: '0.3.305',
203
+ version: '0.3.306',
204
204
  updateSummary:
205
205
  'Play grep now returns concise results with the matched fields and terms. Automatic CLI updates are enabled by default; use `deepline settings autoupdate off` to opt out, `deepline settings autoupdate on` to re-enable updates, or `deepline settings autoupdate pin <version>` to hold an exact release.',
206
206
  packageCapabilities: {
@@ -18,6 +18,7 @@ import {
18
18
 
19
19
  import { DeeplineError, ToolExecutionError } from './errors.js';
20
20
  import type { HttpClient } from './http.js';
21
+ import { validateCliInvocationId } from './cli-invocation-id.js';
21
22
 
22
23
  const INCLUDE_TOOL_METADATA_HEADER = 'x-deepline-include-tool-metadata';
23
24
  const EXECUTE_RESPONSE_CONTRACT_HEADER = 'x-deepline-execute-response-contract';
@@ -132,6 +133,8 @@ export type ExecuteToolRawOptions = {
132
133
  recoveryTimeoutMs?: number;
133
134
  /** The `search_ref` of the tools search that found this tool. */
134
135
  searchRef?: string;
136
+ /** Correlates one CLI command with its execute request and server telemetry. */
137
+ cliInvocationId?: string;
135
138
  };
136
139
 
137
140
  /** Durable state returned for a keyed tool execution. */
@@ -327,6 +330,9 @@ export class ToolCalls {
327
330
  input: Record<string, unknown>,
328
331
  options?: ExecuteToolRawOptions,
329
332
  ): Promise<ToolExecution<TData, TMeta>> {
333
+ if (options?.cliInvocationId !== undefined) {
334
+ validateCliInvocationId(options.cliInvocationId);
335
+ }
330
336
  // Snapshot JSON input before the caller's awaited onExecution callback and
331
337
  // before any retry, so every POST is byte-equivalent in meaning.
332
338
  const inputSnapshot = JSON.parse(JSON.stringify(input)) as Record<
@@ -365,7 +371,11 @@ export class ToolCalls {
365
371
  this.configuredRequestTimeoutMs,
366
372
  );
367
373
  if (idempotencyKey !== undefined) {
368
- await this.lookupExecutionByKey(idempotencyKey, timeoutMs);
374
+ await this.lookupExecutionByKey(
375
+ idempotencyKey,
376
+ timeoutMs,
377
+ options?.cliInvocationId,
378
+ );
369
379
  }
370
380
  const isApifySync = toolId.trim().toLowerCase() === 'apify_run_actor_sync';
371
381
  const headers = {
@@ -384,6 +394,9 @@ export class ToolCalls {
384
394
  ...(options?.searchRef
385
395
  ? { 'x-deepline-search-ref': options.searchRef }
386
396
  : {}),
397
+ ...(options?.cliInvocationId !== undefined
398
+ ? { 'x-deepline-cli-invocation-id': options.cliInvocationId }
399
+ : {}),
387
400
  };
388
401
  const request = (requestTimeoutMs: number | undefined) =>
389
402
  this.http.post<ToolExecution<TData, TMeta>>(
@@ -434,6 +447,7 @@ export class ToolCalls {
434
447
  this.defaultRequestTimeoutMs,
435
448
  remainingMs,
436
449
  ),
450
+ options?.cliInvocationId,
437
451
  );
438
452
  } catch (error) {
439
453
  if (!isRecoverableExecutionLookupError(error)) throw error;
@@ -525,6 +539,7 @@ export class ToolCalls {
525
539
  private async lookupExecutionByKey(
526
540
  idempotencyKey: string,
527
541
  timeoutMs?: number,
542
+ cliInvocationId?: string,
528
543
  ): Promise<ExecutionByKeyResult | null> {
529
544
  validateExecutionIdempotencyKey(idempotencyKey);
530
545
  let supported = false;
@@ -536,6 +551,9 @@ export class ToolCalls {
536
551
  timeout: timeoutMs,
537
552
  idempotencyKey,
538
553
  allowNotFound: true,
554
+ ...(cliInvocationId !== undefined
555
+ ? { headers: { 'x-deepline-cli-invocation-id': cliInvocationId } }
556
+ : {}),
539
557
  onResponse: (response) => {
540
558
  supported =
541
559
  response.headers.get('X-Deepline-Idempotency-Supported') === 'true';
@@ -9,11 +9,11 @@ import {
9
9
  registerAuthCommands,
10
10
  reportSetupCompleted,
11
11
  resolvePendingAuthClaimForResume
12
- } from "./chunk-SCX2AZFY.mjs";
13
- import "./chunk-QFSISXKO.mjs";
14
- import "./chunk-6C4SD4U3.mjs";
12
+ } from "./chunk-7XORS6WQ.mjs";
13
+ import "./chunk-5V56XCQN.mjs";
14
+ import "./chunk-4PSSDZQB.mjs";
15
15
  import "./chunk-DLIRSHV6.mjs";
16
- import "./chunk-KNK42P4M.mjs";
16
+ import "./chunk-WWPI4GJI.mjs";
17
17
  import "./chunk-NXGCO4JB.mjs";
18
18
  import "./chunk-WZYKRD7T.mjs";
19
19
  import "./chunk-KRD6H754.mjs";
@@ -0,0 +1,31 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+
4
+
5
+
6
+
7
+
8
+
9
+
10
+
11
+
12
+ var _chunkU37SW6IKjs = require('./chunk-U37SW6IK.js');
13
+ require('./chunk-MMNZ6GBT.js');
14
+ require('./chunk-M6HCRRV2.js');
15
+ require('./chunk-XNYIZMNQ.js');
16
+ require('./chunk-OZIFVQRY.js');
17
+ require('./chunk-7P5AA3SN.js');
18
+ require('./chunk-OG64RBAC.js');
19
+ require('./chunk-COGTRVWW.js');
20
+
21
+
22
+
23
+
24
+
25
+
26
+
27
+
28
+
29
+
30
+
31
+ exports.EXIT_WORKSPACE_MISMATCH = _chunkU37SW6IKjs.EXIT_WORKSPACE_MISMATCH; exports.clearPendingClaim = _chunkU37SW6IKjs.clearPendingClaim; exports.clearSatisfiedPendingClaim = _chunkU37SW6IKjs.clearSatisfiedPendingClaim; exports.handleRegister = _chunkU37SW6IKjs.handleRegister; exports.handleStatus = _chunkU37SW6IKjs.handleStatus; exports.handleWait = _chunkU37SW6IKjs.handleWait; exports.readPendingAuthClaim = _chunkU37SW6IKjs.readPendingAuthClaim; exports.registerAuthCommands = _chunkU37SW6IKjs.registerAuthCommands; exports.reportSetupCompleted = _chunkU37SW6IKjs.reportSetupCompleted; exports.resolvePendingAuthClaimForResume = _chunkU37SW6IKjs.resolvePendingAuthClaimForResume;