deepline 0.3.292 → 0.3.293

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.
@@ -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.292',
203
+ version: '0.3.293',
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: {
@@ -80,6 +80,7 @@ import {
80
80
  recognizedRuntimeTestFaultCount,
81
81
  } from './/test-runtime-seams';
82
82
  import {
83
+ fetchWithVercelProtectionBypass,
83
84
  isVercelSecurityCheckpointResponse,
84
85
  vercelProtectionBypassHeaders,
85
86
  } from './/vercel-protection';
@@ -1455,12 +1456,16 @@ async function postAppRuntimeApi<TResponse>(
1455
1456
  }
1456
1457
  const runtimeFetch = context.fetch ?? fetch;
1457
1458
  const boundaryLabel = runtimeApiBoundaryLabel(context);
1458
- const vercelHeaders = await vercelProtectionBypassHeaders({
1459
- baseUrl,
1460
- token: context.vercelProtectionBypassToken,
1461
- fetchImpl: runtimeFetch,
1462
- signal: context.signal,
1463
- });
1459
+ const fastRunLedgerBypass =
1460
+ body.action === 'append_run_events' || body.action === 'project_run_events';
1461
+ const vercelHeaders = fastRunLedgerBypass
1462
+ ? null
1463
+ : await vercelProtectionBypassHeaders({
1464
+ baseUrl,
1465
+ token: context.vercelProtectionBypassToken,
1466
+ fetchImpl: runtimeFetch,
1467
+ signal: context.signal,
1468
+ });
1464
1469
 
1465
1470
  const maxAttempts =
1466
1471
  context.retryPolicy === 'none' ? 1 : appRuntimeMaxAttempts(body.action);
@@ -1523,43 +1528,53 @@ async function postAppRuntimeApi<TResponse>(
1523
1528
  runtimeTestFaultHeader: context.runtimeTestFaultHeader,
1524
1529
  });
1525
1530
  try {
1526
- response = await runtimeFetch(resolveAppRuntimeApiUrl(context), {
1527
- method: 'POST',
1528
- headers: {
1529
- // The payload is JSON either way; `content-encoding` describes only
1530
- // how those JSON bytes were packed for the wire.
1531
- 'content-type': 'application/json',
1532
- ...(wireBody.contentEncoding
1533
- ? { 'content-encoding': wireBody.contentEncoding }
1534
- : {}),
1535
- authorization: `Bearer ${token}`,
1536
- [LEGACY_RUNTIME_RECEIPT_WIRE_HEADER]: String(
1537
- LEGACY_RUNTIME_RECEIPT_WIRE_FORMAT,
1538
- ),
1539
- [PLAY_RUNTIME_TRANSPORT_ATTEMPT_HEADER]: transportAttemptId,
1540
- ...vercelHeaders,
1541
- ...(context.preferredReceiptGatewayMachineId?.trim()
1542
- ? {
1543
- 'fly-force-instance-id':
1544
- context.preferredReceiptGatewayMachineId.trim(),
1545
- }
1546
- : {}),
1547
- ...(runtimeTestFaultHeader
1548
- ? {
1549
- [PLAY_RUNTIME_TEST_FAULT_HEADER]: runtimeTestFaultHeader,
1550
- }
1551
- : {}),
1552
- },
1553
- // DOM fetch accepts ArrayBuffer, while Node 24 deliberately rejects a
1554
- // Uint8Array backed by an arbitrary ArrayBufferLike. Copy only the
1555
- // compressed branch into an exact ArrayBuffer; its wire bytes remain
1556
- // identical and the plain JSON fast path stays allocation-free.
1557
- body:
1558
- typeof wireBody.body === 'string'
1559
- ? wireBody.body
1560
- : Uint8Array.from(wireBody.body).buffer,
1561
- signal: requestSignal,
1562
- });
1531
+ const sendRequest = (protectionHeaders: Record<string, string>) =>
1532
+ runtimeFetch(resolveAppRuntimeApiUrl(context), {
1533
+ method: 'POST',
1534
+ headers: {
1535
+ // The payload is JSON either way; `content-encoding` describes only
1536
+ // how those JSON bytes were packed for the wire.
1537
+ 'content-type': 'application/json',
1538
+ ...(wireBody.contentEncoding
1539
+ ? { 'content-encoding': wireBody.contentEncoding }
1540
+ : {}),
1541
+ authorization: `Bearer ${token}`,
1542
+ [LEGACY_RUNTIME_RECEIPT_WIRE_HEADER]: String(
1543
+ LEGACY_RUNTIME_RECEIPT_WIRE_FORMAT,
1544
+ ),
1545
+ [PLAY_RUNTIME_TRANSPORT_ATTEMPT_HEADER]: transportAttemptId,
1546
+ ...protectionHeaders,
1547
+ ...(context.preferredReceiptGatewayMachineId?.trim()
1548
+ ? {
1549
+ 'fly-force-instance-id':
1550
+ context.preferredReceiptGatewayMachineId.trim(),
1551
+ }
1552
+ : {}),
1553
+ ...(runtimeTestFaultHeader
1554
+ ? {
1555
+ [PLAY_RUNTIME_TEST_FAULT_HEADER]: runtimeTestFaultHeader,
1556
+ }
1557
+ : {}),
1558
+ },
1559
+ // DOM fetch accepts ArrayBuffer, while Node 24 deliberately rejects a
1560
+ // Uint8Array backed by an arbitrary ArrayBufferLike. Copy only the
1561
+ // compressed branch into an exact ArrayBuffer; its wire bytes remain
1562
+ // identical and the plain JSON fast path stays allocation-free.
1563
+ body:
1564
+ typeof wireBody.body === 'string'
1565
+ ? wireBody.body
1566
+ : Uint8Array.from(wireBody.body).buffer,
1567
+ signal: requestSignal,
1568
+ });
1569
+ response = fastRunLedgerBypass
1570
+ ? await fetchWithVercelProtectionBypass({
1571
+ baseUrl,
1572
+ token: context.vercelProtectionBypassToken,
1573
+ fetchImpl: runtimeFetch,
1574
+ signal: requestSignal,
1575
+ send: sendRequest,
1576
+ })
1577
+ : await sendRequest(vercelHeaders ?? {});
1563
1578
  const preferredMachineId =
1564
1579
  context.preferredReceiptGatewayMachineId?.trim() ?? '';
1565
1580
  if (
@@ -197,6 +197,7 @@ import {
197
197
  runtimeTokenOriginFromLaunch,
198
198
  } from './runtime-api-origin';
199
199
  import {
200
+ fetchWithVercelProtectionBypass,
200
201
  isVercelSecurityCheckpointResponse,
201
202
  vercelProtectionBypassHeaders,
202
203
  } from '../vercel-protection';
@@ -20312,7 +20313,8 @@ async function dispatchRunLedgerOutboxBatchWithScope(
20312
20313
  error.status !== 401
20313
20314
  )
20314
20315
  throw error;
20315
- runtimeApi.executorToken = await gatewayRuntimeApi.refreshExecutorToken();
20316
+ runtimeApi.executorToken =
20317
+ await gatewayRuntimeApi.refreshExecutorToken();
20316
20318
  await append(runtimeApi);
20317
20319
  }
20318
20320
  } else if (tokenAuthority !== 'gateway') {
@@ -21027,34 +21029,35 @@ async function requestRunLedgerDispatchToken(
21027
21029
  };
21028
21030
  runLedgerDispatchTokens.delete(cacheKey);
21029
21031
  const url = `${runtimeApiBaseUrlFromLaunch(input.launch).replace(/\/$/, '')}/api/v2/internal/play-runtime/run-ledger-dispatch-token`;
21030
- const vercelProtectionHeaders = await vercelProtectionBypassHeaders({
21032
+ const requestSignal = input.signal
21033
+ ? AbortSignal.any([
21034
+ input.signal,
21035
+ AbortSignal.timeout(RUN_LEDGER_DISPATCH_TOKEN_TIMEOUT_MS),
21036
+ ])
21037
+ : AbortSignal.timeout(RUN_LEDGER_DISPATCH_TOKEN_TIMEOUT_MS);
21038
+ const requestBody = JSON.stringify({
21039
+ runId: input.launch.runId,
21040
+ eventId: input.eventId,
21041
+ leaseOwner: input.leaseOwner,
21042
+ schedulerSchema: input.schedulerSchema,
21043
+ });
21044
+ const response = await fetchWithVercelProtectionBypass({
21031
21045
  baseUrl: runtimeApiBaseUrlFromLaunch(input.launch),
21032
21046
  token: input.launch.vercelProtectionBypassToken,
21033
- signal: input.signal,
21034
- });
21035
- const response = await fetch(url, {
21036
- method: 'POST',
21037
- signal: input.signal
21038
- ? AbortSignal.any([
21039
- input.signal,
21040
- AbortSignal.timeout(RUN_LEDGER_DISPATCH_TOKEN_TIMEOUT_MS),
21041
- ])
21042
- : AbortSignal.timeout(RUN_LEDGER_DISPATCH_TOKEN_TIMEOUT_MS),
21043
- headers: {
21044
- 'content-type': 'application/json',
21045
- 'x-deepline-internal-token': internalToken,
21046
- // Thread the durable outbox identity through the authority hop. This is
21047
- // not a credential; it lets the app-side lease lookup report one stable
21048
- // correlation id when a retryable scheduler failure occurs.
21049
- 'x-deepline-runtime-trace-id': `run-ledger:${input.eventId}`,
21050
- ...vercelProtectionHeaders,
21051
- },
21052
- body: JSON.stringify({
21053
- runId: input.launch.runId,
21054
- eventId: input.eventId,
21055
- leaseOwner: input.leaseOwner,
21056
- schedulerSchema: input.schedulerSchema,
21057
- }),
21047
+ signal: requestSignal,
21048
+ send: (protectionHeaders) =>
21049
+ fetch(url, {
21050
+ method: 'POST',
21051
+ signal: requestSignal,
21052
+ headers: {
21053
+ 'content-type': 'application/json',
21054
+ 'x-deepline-internal-token': internalToken,
21055
+ // Preserve the durable identity across a pre-app checkpoint retry.
21056
+ 'x-deepline-runtime-trace-id': `run-ledger:${input.eventId}`,
21057
+ ...protectionHeaders,
21058
+ },
21059
+ body: requestBody,
21060
+ }),
21058
21061
  });
21059
21062
  const responseText = await response.text();
21060
21063
  const body = (() => {
@@ -157,6 +157,49 @@ export async function vercelProtectionBypassHeaders(input: {
157
157
  };
158
158
  }
159
159
 
160
+ /**
161
+ * Use the server-to-server bypass header without a blocking cookie preflight.
162
+ * A Vercel checkpoint is generated before the application sees the request,
163
+ * so replaying the same request once with its bypass cookie is safe.
164
+ */
165
+ export async function fetchWithVercelProtectionBypass(input: {
166
+ baseUrl: string;
167
+ token: string | null | undefined;
168
+ fetchImpl?: FetchLike;
169
+ signal?: AbortSignal;
170
+ send: (headers: Record<string, string>) => Promise<Response>;
171
+ }): Promise<Response> {
172
+ const token = input.token?.trim();
173
+ const response = await input.send(vercelProtectionBypassHeader(token));
174
+ if (!token || response.status !== 403) return response;
175
+ const contentType = response.headers.get('content-type');
176
+ if (!/^text\/html(?:\s*;|$)/i.test(contentType?.trim() ?? '')) {
177
+ return response;
178
+ }
179
+ let body: string;
180
+ try {
181
+ body = await response.clone().text();
182
+ } catch {
183
+ return response;
184
+ }
185
+ if (
186
+ !isVercelSecurityCheckpointResponse({
187
+ status: response.status,
188
+ contentType,
189
+ body,
190
+ })
191
+ ) {
192
+ return response;
193
+ }
194
+ const bypassHeaders = await vercelProtectionBypassHeaders({
195
+ baseUrl: input.baseUrl,
196
+ token,
197
+ fetchImpl: input.fetchImpl,
198
+ signal: input.signal,
199
+ });
200
+ return bypassHeaders.cookie ? input.send(bypassHeaders) : response;
201
+ }
202
+
160
203
  export function resolveVercelProtectionBypassTokenForRequest(
161
204
  req: Pick<Request, 'headers'>,
162
205
  ): string | null {
package/dist/cli/index.js CHANGED
@@ -3515,7 +3515,7 @@ var SDK_RELEASE = {
3515
3515
  // getters keep their established compatibility behavior.
3516
3516
  // 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
3517
3517
  // 0.3.90 is the first deliberately versioned SDK release for API v3.
3518
- version: "0.3.292",
3518
+ version: "0.3.293",
3519
3519
  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.",
3520
3520
  packageCapabilities: {
3521
3521
  updatePreferences: 1
@@ -3510,7 +3510,7 @@ var SDK_RELEASE = {
3510
3510
  // getters keep their established compatibility behavior.
3511
3511
  // 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
3512
3512
  // 0.3.90 is the first deliberately versioned SDK release for API v3.
3513
- version: "0.3.292",
3513
+ version: "0.3.293",
3514
3514
  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.",
3515
3515
  packageCapabilities: {
3516
3516
  updatePreferences: 1
package/dist/index.js CHANGED
@@ -1328,7 +1328,7 @@ var SDK_RELEASE = {
1328
1328
  // getters keep their established compatibility behavior.
1329
1329
  // 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
1330
1330
  // 0.3.90 is the first deliberately versioned SDK release for API v3.
1331
- version: "0.3.292",
1331
+ version: "0.3.293",
1332
1332
  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.",
1333
1333
  packageCapabilities: {
1334
1334
  updatePreferences: 1
package/dist/index.mjs CHANGED
@@ -1232,7 +1232,7 @@ var SDK_RELEASE = {
1232
1232
  // getters keep their established compatibility behavior.
1233
1233
  // 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
1234
1234
  // 0.3.90 is the first deliberately versioned SDK release for API v3.
1235
- version: "0.3.292",
1235
+ version: "0.3.293",
1236
1236
  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.",
1237
1237
  packageCapabilities: {
1238
1238
  updatePreferences: 1
@@ -149,7 +149,7 @@ type SdkRelease = {
149
149
  supportPolicy: SdkSupportPolicy;
150
150
  };
151
151
  declare const SDK_RELEASE: {
152
- readonly version: "0.3.292";
152
+ readonly version: "0.3.293";
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.292";
152
+ readonly version: "0.3.293";
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.292",
77
+ version: "0.3.293",
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.292",
51
+ version: "0.3.293",
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.292",
3
+ "version": "0.3.293",
4
4
  "description": "GTM data CLI and TypeScript SDK for coding agents",
5
5
  "license": "MIT",
6
6
  "homepage": "https://code.deepline.com",