deepline 0.3.216 → 0.3.218

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.
@@ -675,6 +675,8 @@ type ExecuteToolRawOptions = {
675
675
  onExecution?: (execution: { idempotencyKey: string }) => void | Promise<void>;
676
676
  /** Maximum time to reconnect to an in-progress keyed execution. Defaults to 15 minutes. */
677
677
  recoveryTimeoutMs?: number;
678
+ /** The `search_ref` of the tools search that found this tool. */
679
+ searchRef?: string;
678
680
  };
679
681
 
680
682
  /** Durable state returned for a keyed tool execution. */
@@ -3537,6 +3539,9 @@ export class DeeplineClient {
3537
3539
  : {}),
3538
3540
  [EXECUTE_RESPONSE_INTENT_HEADER]: options?.responseIntent ?? 'raw',
3539
3541
  ...(idempotencyKey ? { 'Idempotency-Key': idempotencyKey } : {}),
3542
+ ...(options?.searchRef
3543
+ ? { 'x-deepline-search-ref': options.searchRef }
3544
+ : {}),
3540
3545
  };
3541
3546
  const request = (requestTimeoutMs: number | undefined) =>
3542
3547
  this.http.post<ToolExecution<TData, TMeta>>(
@@ -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.216',
203
+ version: '0.3.218',
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: {
@@ -490,6 +490,8 @@ export interface ToolSearchOptions {
490
490
  export interface ToolSearchResult {
491
491
  /** Ranked matching tools. */
492
492
  tools: ToolDefinition[];
493
+ /** Identifies this search; pass it as `searchRef` when executing a tool it found. */
494
+ search_ref?: string;
493
495
  /** Count included in this response when available. */
494
496
  count?: number;
495
497
  /** Matching count within the selected retrieval set. Check total_is_exact. */
@@ -49,7 +49,11 @@ import {
49
49
  LEGACY_RUNTIME_RECEIPT_WIRE_HEADER,
50
50
  } from './/runtime-contract';
51
51
  import { PLAY_RUNTIME_API_COMPAT_PATH } from './/runtime-api-paths';
52
- import { buildRunLedgerEventsIdempotencyKey } from './run-ledger-projection-contract';
52
+ import {
53
+ buildRunLedgerEventsIdempotencyKey,
54
+ isRunLedgerProjectionLeaseLostReason,
55
+ type RunLedgerProjectionLeaseLostReason,
56
+ } from './run-ledger-projection-contract';
53
57
  import {
54
58
  RUNTIME_API_ACCEPTS_HEADER,
55
59
  gzipRuntimeApiRequestBody,
@@ -928,6 +932,21 @@ function appRuntimeErrorCode(response: Response, body: string): string | null {
928
932
  }
929
933
  }
930
934
 
935
+ function appRuntimeFailureReason(
936
+ responseCode: string | null,
937
+ body: string,
938
+ ): RunLedgerProjectionLeaseLostReason | null {
939
+ if (responseCode !== 'RUN_LEDGER_DELIVERY_LEASE_LOST') return null;
940
+ try {
941
+ const parsed = JSON.parse(body) as { failureReason?: unknown };
942
+ return isRunLedgerProjectionLeaseLostReason(parsed.failureReason)
943
+ ? parsed.failureReason
944
+ : null;
945
+ } catch {
946
+ return null;
947
+ }
948
+ }
949
+
931
950
  export function isTransientAppRuntimeFailureBody(body: string): boolean {
932
951
  return /WorkerOverloaded|"\s*code\s*"\s*:\s*"\s*InternalServerError\s*"|Your request couldn't be completed\. Try again later\.|timeout exceeded when trying to connect|timed out|fetch failed|ECONNRESET|ECONNREFUSED|UND_ERR_CONNECT_TIMEOUT|tuple concurrently updated|RUNTIME_SCHEDULER_(?:SATURATED|UNAVAILABLE|SCHEMA_NOT_READY)|Runtime scheduler DB pool is saturated|Runtime scheduler DB circuit breaker is open|Runtime scheduler schema .* is not ready|OptimisticConcurrencyControlFailure|changed while this mutation was being run|Documents read from or written to the .* table changed while this mutation/i.test(
933
952
  body,
@@ -1340,6 +1359,7 @@ export class AppRuntimeApiResponseError extends Error {
1340
1359
  readonly action: RuntimeApiRequest['action'];
1341
1360
  readonly status: number;
1342
1361
  readonly code: string | null;
1362
+ readonly failureReason: RunLedgerProjectionLeaseLostReason | null;
1343
1363
  readonly requestId: string | null;
1344
1364
  readonly retryable: boolean;
1345
1365
  /** Server-requested delay, retained for durable callers after local retries end. */
@@ -1350,6 +1370,7 @@ export class AppRuntimeApiResponseError extends Error {
1350
1370
  action: RuntimeApiRequest['action'];
1351
1371
  status: number;
1352
1372
  code?: string | null;
1373
+ failureReason?: RunLedgerProjectionLeaseLostReason | null;
1353
1374
  requestId?: string | null;
1354
1375
  retryable: boolean;
1355
1376
  retryAfterMs?: number | null;
@@ -1366,6 +1387,7 @@ export class AppRuntimeApiResponseError extends Error {
1366
1387
  this.action = input.action;
1367
1388
  this.status = input.status;
1368
1389
  this.code = input.code?.trim() || null;
1390
+ this.failureReason = input.failureReason ?? null;
1369
1391
  this.requestId = input.requestId?.trim() || null;
1370
1392
  this.retryable = input.retryable;
1371
1393
  this.retryAfterMs =
@@ -1830,6 +1852,7 @@ async function postAppRuntimeApi<TResponse>(
1830
1852
  action: body.action,
1831
1853
  status: response.status,
1832
1854
  code,
1855
+ failureReason: appRuntimeFailureReason(code, responseText),
1833
1856
  requestId,
1834
1857
  // The structured response is authoritative even for a 5xx. Retrying an
1835
1858
  // explicitly deterministic database failure here turns one rejected SQL
@@ -10,10 +10,41 @@ const UUID_PATTERN =
10
10
  /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
11
11
  const SHA256_HEX_PATTERN = /^[0-9a-f]{64}$/i;
12
12
 
13
+ export const RUN_LEDGER_PROJECTION_LEASE_LOST_REASONS = [
14
+ 'delivery_lease_not_current',
15
+ 'head_lease_missing',
16
+ 'head_lease_owner_mismatch',
17
+ 'prefix_lease_owner_mismatch',
18
+ 'lease_expired',
19
+ 'predecessor_not_due',
20
+ 'predecessor_failed',
21
+ 'delivery_key_mismatch',
22
+ 'projected_events_mismatch',
23
+ ] as const;
24
+
25
+ export type RunLedgerProjectionLeaseLostReason =
26
+ (typeof RUN_LEDGER_PROJECTION_LEASE_LOST_REASONS)[number];
27
+
28
+ export function isRunLedgerProjectionLeaseLostReason(
29
+ value: unknown,
30
+ ): value is RunLedgerProjectionLeaseLostReason {
31
+ return (
32
+ typeof value === 'string' &&
33
+ RUN_LEDGER_PROJECTION_LEASE_LOST_REASONS.includes(
34
+ value as RunLedgerProjectionLeaseLostReason,
35
+ )
36
+ );
37
+ }
38
+
13
39
  export class RunLedgerProjectionLeaseLostError extends Error {
14
- constructor() {
40
+ readonly reason: RunLedgerProjectionLeaseLostReason;
41
+
42
+ constructor(
43
+ reason: RunLedgerProjectionLeaseLostReason = 'delivery_lease_not_current',
44
+ ) {
15
45
  super('Run Ledger projection requires the current outbox delivery lease.');
16
46
  this.name = 'RunLedgerProjectionLeaseLostError';
47
+ this.reason = reason;
17
48
  }
18
49
  }
19
50
 
@@ -95,6 +95,7 @@ import {
95
95
  import {
96
96
  buildRunLedgerEventsIdempotencyKey,
97
97
  RunLedgerProjectionLeaseLostError,
98
+ type RunLedgerProjectionLeaseLostReason,
98
99
  buildRunLedgerStartIdempotencyKey,
99
100
  buildRunLedgerTerminalIdempotencyKey,
100
101
  } from '../run-ledger-projection-contract';
@@ -16013,7 +16014,7 @@ export async function renewPostgresRunLedgerDelivery(
16013
16014
  ],
16014
16015
  );
16015
16016
  if (result.rows.length !== input.eventIds.length)
16016
- throw new RunLedgerProjectionLeaseLostError();
16017
+ throw new RunLedgerProjectionLeaseLostError('delivery_lease_not_current');
16017
16018
  }
16018
16019
 
16019
16020
  /** Only the currently claimed causal prefix may use the projection write path. */
@@ -16060,21 +16061,33 @@ export async function assertPostgresRunLedgerDelivery(
16060
16061
  );
16061
16062
  const rows = result.rows;
16062
16063
  const leaseOwner = input.leaseOwner?.trim() || rows[0]?.lease_owner;
16063
- if (!leaseOwner || rows[0]?.lease_owner !== leaseOwner) {
16064
- throw new RunLedgerProjectionLeaseLostError();
16064
+ if (!leaseOwner) {
16065
+ throw new RunLedgerProjectionLeaseLostError('head_lease_missing');
16066
+ }
16067
+ if (rows[0]?.lease_owner !== leaseOwner) {
16068
+ throw new RunLedgerProjectionLeaseLostError('head_lease_owner_mismatch');
16065
16069
  }
16066
16070
 
16067
16071
  // Cancellation may own several pending facts at once. Validate the exact
16068
16072
  // contiguous, due prefix named by the receipt instead of all rows sharing
16069
16073
  // that cancellation lease.
16070
16074
  const prefix: typeof rows = [];
16075
+ let prefixStopReason: RunLedgerProjectionLeaseLostReason | null = null;
16071
16076
  for (const row of rows) {
16072
- if (
16073
- row.lease_owner !== leaseOwner ||
16074
- row.lease_live !== true ||
16075
- row.due !== true ||
16076
- row.blocked === true
16077
- ) {
16077
+ if (row.lease_owner !== leaseOwner) {
16078
+ prefixStopReason = 'prefix_lease_owner_mismatch';
16079
+ break;
16080
+ }
16081
+ if (row.lease_live !== true) {
16082
+ prefixStopReason = 'lease_expired';
16083
+ break;
16084
+ }
16085
+ if (row.due !== true) {
16086
+ prefixStopReason = 'predecessor_not_due';
16087
+ break;
16088
+ }
16089
+ if (row.blocked === true) {
16090
+ prefixStopReason = 'predecessor_failed';
16078
16091
  break;
16079
16092
  }
16080
16093
  if (prefix.length > 0 && row.event_type === 'run.events') break;
@@ -16160,7 +16173,7 @@ export async function assertPostgresRunLedgerDelivery(
16160
16173
  ) {
16161
16174
  return;
16162
16175
  }
16163
- throw new RunLedgerProjectionLeaseLostError();
16176
+ throw new RunLedgerProjectionLeaseLostError('projected_events_mismatch');
16164
16177
  }
16165
16178
 
16166
16179
  if (
@@ -16173,7 +16186,9 @@ export async function assertPostgresRunLedgerDelivery(
16173
16186
  break;
16174
16187
  }
16175
16188
  }
16176
- throw new RunLedgerProjectionLeaseLostError();
16189
+ throw new RunLedgerProjectionLeaseLostError(
16190
+ prefixStopReason ?? 'delivery_key_mismatch',
16191
+ );
16177
16192
  }
16178
16193
 
16179
16194
  /** Snapshot-creating facts precede progress, even when their intake was late. */
@@ -16693,6 +16708,7 @@ function runLedgerDeliveryFailure(input: { error: unknown }): {
16693
16708
  code: string | null;
16694
16709
  status: number | null;
16695
16710
  retryable: boolean;
16711
+ failureReason: RunLedgerProjectionLeaseLostReason | null;
16696
16712
  retryAfterMs: number | null;
16697
16713
  } {
16698
16714
  if (input.error instanceof AppRuntimeApiResponseError) {
@@ -16712,6 +16728,7 @@ function runLedgerDeliveryFailure(input: { error: unknown }): {
16712
16728
  code: input.error.code,
16713
16729
  status: input.error.status,
16714
16730
  retryable,
16731
+ failureReason: input.error.failureReason,
16715
16732
  retryAfterMs:
16716
16733
  input.error.retryAfterMs === null
16717
16734
  ? null
@@ -16727,6 +16744,7 @@ function runLedgerDeliveryFailure(input: { error: unknown }): {
16727
16744
  code: 'app_runtime_transport_error',
16728
16745
  status: null,
16729
16746
  retryable: true,
16747
+ failureReason: null,
16730
16748
  retryAfterMs: null,
16731
16749
  };
16732
16750
  }
@@ -16737,6 +16755,7 @@ function runLedgerDeliveryFailure(input: { error: unknown }): {
16737
16755
  code: null,
16738
16756
  status: null,
16739
16757
  retryable: true,
16758
+ failureReason: null,
16740
16759
  retryAfterMs: null,
16741
16760
  };
16742
16761
  }
@@ -16833,6 +16852,9 @@ export async function settlePostgresSchedulerOutboxFailure(
16833
16852
  code: failure.code,
16834
16853
  status: failure.status,
16835
16854
  retryable: failure.retryable,
16855
+ ...(failure.failureReason
16856
+ ? { failureReason: failure.failureReason }
16857
+ : {}),
16836
16858
  retryAfterMs: failure.retryAfterMs,
16837
16859
  recordedAt: new Date().toISOString(),
16838
16860
  }),
@@ -103,7 +103,11 @@ function dedupeStaticFieldNames(
103
103
 
104
104
  export function inputFieldFromStaticCsvArg(csvArg: unknown): string | null {
105
105
  if (typeof csvArg !== 'string') return null;
106
- const match = /^input\.([A-Za-z_$][\w$]*)$/.exec(csvArg.trim());
106
+ // Static analysis retains the authored expression, including its fallback.
107
+ const match =
108
+ /^\(?\s*input\.([A-Za-z_$][\w$]*)\s*\)?(?:\s*\?\?[\s\S]+)?$/.exec(
109
+ csvArg.trim(),
110
+ );
107
111
  return match?.[1] ?? null;
108
112
  }
109
113
 
package/dist/cli/index.js CHANGED
@@ -3051,7 +3051,7 @@ var SDK_RELEASE = {
3051
3051
  // getters keep their established compatibility behavior.
3052
3052
  // 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
3053
3053
  // 0.3.90 is the first deliberately versioned SDK release for API v3.
3054
- version: "0.3.216",
3054
+ version: "0.3.218",
3055
3055
  updateSummary: "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.",
3056
3056
  packageCapabilities: {
3057
3057
  updatePreferences: 1
@@ -7699,7 +7699,8 @@ var DeeplineClient = class _DeeplineClient {
7699
7699
  ),
7700
7700
  ...options?.includeToolMetadata ? { [INCLUDE_TOOL_METADATA_HEADER]: "true" } : {},
7701
7701
  [EXECUTE_RESPONSE_INTENT_HEADER]: options?.responseIntent ?? "raw",
7702
- ...idempotencyKey ? { "Idempotency-Key": idempotencyKey } : {}
7702
+ ...idempotencyKey ? { "Idempotency-Key": idempotencyKey } : {},
7703
+ ...options?.searchRef ? { "x-deepline-search-ref": options.searchRef } : {}
7703
7704
  };
7704
7705
  const request = (requestTimeoutMs) => this.http.post(
7705
7706
  `/api/v2/integrations/${encodeURIComponent(toolId)}/execute`,
@@ -49828,6 +49829,29 @@ async function listTools(category, options = {}) {
49828
49829
  }
49829
49830
  return listToolCategories(emitJson, compact);
49830
49831
  }
49832
+ var SEARCH_REF_TTL_MS = 15 * 6e4;
49833
+ function lastSearchPath() {
49834
+ return (0, import_node_path31.join)(sdkCliStateDirPath(resolveConfig().baseUrl), "last-search.json");
49835
+ }
49836
+ function rememberSearchRef(searchRef) {
49837
+ try {
49838
+ (0, import_node_fs26.mkdirSync)((0, import_node_path31.dirname)(lastSearchPath()), { recursive: true });
49839
+ (0, import_node_fs26.writeFileSync)(
49840
+ lastSearchPath(),
49841
+ JSON.stringify({ searchRef, at: Date.now() }),
49842
+ { mode: 384 }
49843
+ );
49844
+ } catch {
49845
+ }
49846
+ }
49847
+ function recentSearchRef() {
49848
+ try {
49849
+ const saved = JSON.parse((0, import_node_fs26.readFileSync)(lastSearchPath(), "utf8"));
49850
+ return typeof saved.searchRef === "string" && typeof saved.at === "number" && Date.now() - saved.at < SEARCH_REF_TTL_MS ? saved.searchRef : void 0;
49851
+ } catch {
49852
+ return void 0;
49853
+ }
49854
+ }
49831
49855
  async function searchTools(queryInput, options = {}) {
49832
49856
  const query = queryInput?.trim() ?? "";
49833
49857
  const hasStructuredSearch = Boolean(
@@ -49840,7 +49864,7 @@ async function searchTools(queryInput, options = {}) {
49840
49864
  return 1;
49841
49865
  }
49842
49866
  const client2 = new DeeplineClient();
49843
- const result = await client2.searchTools({
49867
+ const { search_ref: searchRef, ...result } = await client2.searchTools({
49844
49868
  query,
49845
49869
  categories: options.categories,
49846
49870
  searchTerms: options.searchTerms,
@@ -49849,6 +49873,7 @@ async function searchTools(queryInput, options = {}) {
49849
49873
  searchMode: options.searchMode,
49850
49874
  includeSearchDebug: options.includeSearchDebug
49851
49875
  });
49876
+ if (searchRef) rememberSearchRef(searchRef);
49852
49877
  const shouldCompact = options.compact || !options.json;
49853
49878
  const payload = shouldCompact && Array.isArray(result.tools) ? {
49854
49879
  ...result,
@@ -51986,7 +52011,8 @@ async function executeTool(args) {
51986
52011
  ...metadata.executionMetadata?.retrySafeTransientHttp === true ? { maxRetries: 2, retryApiErrors: true } : {},
51987
52012
  responseIntent,
51988
52013
  ...idempotencyKey ? { idempotencyKey } : {},
51989
- ...parsed.recoveryTimeoutMs !== void 0 ? { recoveryTimeoutMs: parsed.recoveryTimeoutMs } : {}
52014
+ ...parsed.recoveryTimeoutMs !== void 0 ? { recoveryTimeoutMs: parsed.recoveryTimeoutMs } : {},
52015
+ searchRef: recentSearchRef()
51990
52016
  });
51991
52017
  const listConversion = tryConvertToList(rawResponse, {
51992
52018
  listExtractorPaths: listExtractorPathsFromUsageGuidance(metadata)
@@ -3046,7 +3046,7 @@ var SDK_RELEASE = {
3046
3046
  // getters keep their established compatibility behavior.
3047
3047
  // 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
3048
3048
  // 0.3.90 is the first deliberately versioned SDK release for API v3.
3049
- version: "0.3.216",
3049
+ version: "0.3.218",
3050
3050
  updateSummary: "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.",
3051
3051
  packageCapabilities: {
3052
3052
  updatePreferences: 1
@@ -7694,7 +7694,8 @@ var DeeplineClient = class _DeeplineClient {
7694
7694
  ),
7695
7695
  ...options?.includeToolMetadata ? { [INCLUDE_TOOL_METADATA_HEADER]: "true" } : {},
7696
7696
  [EXECUTE_RESPONSE_INTENT_HEADER]: options?.responseIntent ?? "raw",
7697
- ...idempotencyKey ? { "Idempotency-Key": idempotencyKey } : {}
7697
+ ...idempotencyKey ? { "Idempotency-Key": idempotencyKey } : {},
7698
+ ...options?.searchRef ? { "x-deepline-search-ref": options.searchRef } : {}
7698
7699
  };
7699
7700
  const request = (requestTimeoutMs) => this.http.post(
7700
7701
  `/api/v2/integrations/${encodeURIComponent(toolId)}/execute`,
@@ -49976,6 +49977,29 @@ async function listTools(category, options = {}) {
49976
49977
  }
49977
49978
  return listToolCategories(emitJson, compact);
49978
49979
  }
49980
+ var SEARCH_REF_TTL_MS = 15 * 6e4;
49981
+ function lastSearchPath() {
49982
+ return join26(sdkCliStateDirPath(resolveConfig().baseUrl), "last-search.json");
49983
+ }
49984
+ function rememberSearchRef(searchRef) {
49985
+ try {
49986
+ mkdirSync16(dirname20(lastSearchPath()), { recursive: true });
49987
+ writeFileSync20(
49988
+ lastSearchPath(),
49989
+ JSON.stringify({ searchRef, at: Date.now() }),
49990
+ { mode: 384 }
49991
+ );
49992
+ } catch {
49993
+ }
49994
+ }
49995
+ function recentSearchRef() {
49996
+ try {
49997
+ const saved = JSON.parse(readFileSync22(lastSearchPath(), "utf8"));
49998
+ return typeof saved.searchRef === "string" && typeof saved.at === "number" && Date.now() - saved.at < SEARCH_REF_TTL_MS ? saved.searchRef : void 0;
49999
+ } catch {
50000
+ return void 0;
50001
+ }
50002
+ }
49979
50003
  async function searchTools(queryInput, options = {}) {
49980
50004
  const query = queryInput?.trim() ?? "";
49981
50005
  const hasStructuredSearch = Boolean(
@@ -49988,7 +50012,7 @@ async function searchTools(queryInput, options = {}) {
49988
50012
  return 1;
49989
50013
  }
49990
50014
  const client2 = new DeeplineClient();
49991
- const result = await client2.searchTools({
50015
+ const { search_ref: searchRef, ...result } = await client2.searchTools({
49992
50016
  query,
49993
50017
  categories: options.categories,
49994
50018
  searchTerms: options.searchTerms,
@@ -49997,6 +50021,7 @@ async function searchTools(queryInput, options = {}) {
49997
50021
  searchMode: options.searchMode,
49998
50022
  includeSearchDebug: options.includeSearchDebug
49999
50023
  });
50024
+ if (searchRef) rememberSearchRef(searchRef);
50000
50025
  const shouldCompact = options.compact || !options.json;
50001
50026
  const payload = shouldCompact && Array.isArray(result.tools) ? {
50002
50027
  ...result,
@@ -52134,7 +52159,8 @@ async function executeTool(args) {
52134
52159
  ...metadata.executionMetadata?.retrySafeTransientHttp === true ? { maxRetries: 2, retryApiErrors: true } : {},
52135
52160
  responseIntent,
52136
52161
  ...idempotencyKey ? { idempotencyKey } : {},
52137
- ...parsed.recoveryTimeoutMs !== void 0 ? { recoveryTimeoutMs: parsed.recoveryTimeoutMs } : {}
52162
+ ...parsed.recoveryTimeoutMs !== void 0 ? { recoveryTimeoutMs: parsed.recoveryTimeoutMs } : {},
52163
+ searchRef: recentSearchRef()
52138
52164
  });
52139
52165
  const listConversion = tryConvertToList(rawResponse, {
52140
52166
  listExtractorPaths: listExtractorPathsFromUsageGuidance(metadata)
package/dist/index.d.mts CHANGED
@@ -1505,6 +1505,8 @@ interface ToolSearchOptions {
1505
1505
  interface ToolSearchResult {
1506
1506
  /** Ranked matching tools. */
1507
1507
  tools: ToolDefinition[];
1508
+ /** Identifies this search; pass it as `searchRef` when executing a tool it found. */
1509
+ search_ref?: string;
1508
1510
  /** Count included in this response when available. */
1509
1511
  count?: number;
1510
1512
  /** Matching count within the selected retrieval set. Check total_is_exact. */
@@ -3312,6 +3314,8 @@ type ExecuteToolRawOptions = {
3312
3314
  }) => void | Promise<void>;
3313
3315
  /** Maximum time to reconnect to an in-progress keyed execution. Defaults to 15 minutes. */
3314
3316
  recoveryTimeoutMs?: number;
3317
+ /** The `search_ref` of the tools search that found this tool. */
3318
+ searchRef?: string;
3315
3319
  };
3316
3320
  /** Durable state returned for a keyed tool execution. */
3317
3321
  type ExecutionRecovery = {
package/dist/index.d.ts CHANGED
@@ -1505,6 +1505,8 @@ interface ToolSearchOptions {
1505
1505
  interface ToolSearchResult {
1506
1506
  /** Ranked matching tools. */
1507
1507
  tools: ToolDefinition[];
1508
+ /** Identifies this search; pass it as `searchRef` when executing a tool it found. */
1509
+ search_ref?: string;
1508
1510
  /** Count included in this response when available. */
1509
1511
  count?: number;
1510
1512
  /** Matching count within the selected retrieval set. Check total_is_exact. */
@@ -3312,6 +3314,8 @@ type ExecuteToolRawOptions = {
3312
3314
  }) => void | Promise<void>;
3313
3315
  /** Maximum time to reconnect to an in-progress keyed execution. Defaults to 15 minutes. */
3314
3316
  recoveryTimeoutMs?: number;
3317
+ /** The `search_ref` of the tools search that found this tool. */
3318
+ searchRef?: string;
3315
3319
  };
3316
3320
  /** Durable state returned for a keyed tool execution. */
3317
3321
  type ExecutionRecovery = {
package/dist/index.js CHANGED
@@ -864,7 +864,7 @@ var SDK_RELEASE = {
864
864
  // getters keep their established compatibility behavior.
865
865
  // 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
866
866
  // 0.3.90 is the first deliberately versioned SDK release for API v3.
867
- version: "0.3.216",
867
+ version: "0.3.218",
868
868
  updateSummary: "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.",
869
869
  packageCapabilities: {
870
870
  updatePreferences: 1
@@ -5371,7 +5371,8 @@ var DeeplineClient = class _DeeplineClient {
5371
5371
  ),
5372
5372
  ...options?.includeToolMetadata ? { [INCLUDE_TOOL_METADATA_HEADER]: "true" } : {},
5373
5373
  [EXECUTE_RESPONSE_INTENT_HEADER]: options?.responseIntent ?? "raw",
5374
- ...idempotencyKey ? { "Idempotency-Key": idempotencyKey } : {}
5374
+ ...idempotencyKey ? { "Idempotency-Key": idempotencyKey } : {},
5375
+ ...options?.searchRef ? { "x-deepline-search-ref": options.searchRef } : {}
5375
5376
  };
5376
5377
  const request = (requestTimeoutMs) => this.http.post(
5377
5378
  `/api/v2/integrations/${encodeURIComponent(toolId)}/execute`,
package/dist/index.mjs CHANGED
@@ -768,7 +768,7 @@ var SDK_RELEASE = {
768
768
  // getters keep their established compatibility behavior.
769
769
  // 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
770
770
  // 0.3.90 is the first deliberately versioned SDK release for API v3.
771
- version: "0.3.216",
771
+ version: "0.3.218",
772
772
  updateSummary: "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.",
773
773
  packageCapabilities: {
774
774
  updatePreferences: 1
@@ -5275,7 +5275,8 @@ var DeeplineClient = class _DeeplineClient {
5275
5275
  ),
5276
5276
  ...options?.includeToolMetadata ? { [INCLUDE_TOOL_METADATA_HEADER]: "true" } : {},
5277
5277
  [EXECUTE_RESPONSE_INTENT_HEADER]: options?.responseIntent ?? "raw",
5278
- ...idempotencyKey ? { "Idempotency-Key": idempotencyKey } : {}
5278
+ ...idempotencyKey ? { "Idempotency-Key": idempotencyKey } : {},
5279
+ ...options?.searchRef ? { "x-deepline-search-ref": options.searchRef } : {}
5279
5280
  };
5280
5281
  const request = (requestTimeoutMs) => this.http.post(
5281
5282
  `/api/v2/integrations/${encodeURIComponent(toolId)}/execute`,
@@ -149,7 +149,7 @@ type SdkRelease = {
149
149
  supportPolicy: SdkSupportPolicy;
150
150
  };
151
151
  declare const SDK_RELEASE: {
152
- readonly version: "0.3.216";
152
+ readonly version: "0.3.218";
153
153
  readonly updateSummary: "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.";
154
154
  readonly packageCapabilities: {
155
155
  readonly updatePreferences: 1;
package/dist/release.d.ts CHANGED
@@ -149,7 +149,7 @@ type SdkRelease = {
149
149
  supportPolicy: SdkSupportPolicy;
150
150
  };
151
151
  declare const SDK_RELEASE: {
152
- readonly version: "0.3.216";
152
+ readonly version: "0.3.218";
153
153
  readonly updateSummary: "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.";
154
154
  readonly packageCapabilities: {
155
155
  readonly updatePreferences: 1;
package/dist/release.js CHANGED
@@ -74,7 +74,7 @@ var SDK_RELEASE = {
74
74
  // getters keep their established compatibility behavior.
75
75
  // 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
76
76
  // 0.3.90 is the first deliberately versioned SDK release for API v3.
77
- version: "0.3.216",
77
+ version: "0.3.218",
78
78
  updateSummary: "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.",
79
79
  packageCapabilities: {
80
80
  updatePreferences: 1
package/dist/release.mjs CHANGED
@@ -48,7 +48,7 @@ var SDK_RELEASE = {
48
48
  // getters keep their established compatibility behavior.
49
49
  // 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
50
50
  // 0.3.90 is the first deliberately versioned SDK release for API v3.
51
- version: "0.3.216",
51
+ version: "0.3.218",
52
52
  updateSummary: "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.",
53
53
  packageCapabilities: {
54
54
  updatePreferences: 1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "deepline",
3
- "version": "0.3.216",
3
+ "version": "0.3.218",
4
4
  "description": "GTM data CLI and TypeScript SDK for coding agents",
5
5
  "license": "MIT",
6
6
  "homepage": "https://code.deepline.com",