deepline 0.3.250 → 0.3.252

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.250',
203
+ version: '0.3.252',
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: {
@@ -6426,16 +6426,11 @@ export async function repairPostgresSchedulerCronFire(
6426
6426
  };
6427
6427
  }
6428
6428
 
6429
- export async function setPostgresSchedulerRuntimeReleaseAdmission(
6430
- client: PostgresSchedulerQueryClient,
6431
- input: {
6432
- releaseId: string;
6433
- accepting: boolean;
6434
- admissionEpoch: number;
6435
- environment?: 'preview' | 'production';
6436
- },
6437
- options?: Pick<PostgresSchedulerOptions, 'schema'>,
6438
- ): Promise<void> {
6429
+ function runtimeReleaseAdmissionKeys(input: {
6430
+ releaseId: string;
6431
+ admissionEpoch: number;
6432
+ environment?: 'preview' | 'production';
6433
+ }) {
6439
6434
  const releaseId = input.releaseId.trim();
6440
6435
  const environment = input.environment ?? 'production';
6441
6436
  const releaseAdmissionKey = `${environment}:${releaseId}`;
@@ -6458,6 +6453,21 @@ export async function setPostgresSchedulerRuntimeReleaseAdmission(
6458
6453
  'Runtime release admission requires a non-negative safe-integer admissionEpoch.',
6459
6454
  );
6460
6455
  }
6456
+ return { releaseAdmissionLockKeys, releaseAdmissionWriteKeys };
6457
+ }
6458
+
6459
+ export async function setPostgresSchedulerRuntimeReleaseAdmission(
6460
+ client: PostgresSchedulerQueryClient,
6461
+ input: {
6462
+ releaseId: string;
6463
+ accepting: boolean;
6464
+ admissionEpoch: number;
6465
+ environment?: 'preview' | 'production';
6466
+ },
6467
+ options?: Pick<PostgresSchedulerOptions, 'schema'>,
6468
+ ): Promise<void> {
6469
+ const { releaseAdmissionLockKeys, releaseAdmissionWriteKeys } =
6470
+ runtimeReleaseAdmissionKeys(input);
6461
6471
  await client.query(
6462
6472
  `
6463
6473
  WITH admission_lock AS MATERIALIZED (
@@ -6493,6 +6503,61 @@ export async function setPostgresSchedulerRuntimeReleaseAdmission(
6493
6503
  );
6494
6504
  }
6495
6505
 
6506
+ /**
6507
+ * Keep a retired lane's final PostgreSQL-only cleanup ordered with admission
6508
+ * and Preview reclaim. The callback must not await remote control-plane work.
6509
+ * A separate statement after the lock wait sees any epoch committed by the
6510
+ * preceding owner; a lock and check in one CTE would retain the old snapshot.
6511
+ */
6512
+ export async function withPostgresSchedulerClosedReleaseAdmission<T>(
6513
+ client: PostgresSchedulerQueryClient,
6514
+ input: {
6515
+ releaseId: string;
6516
+ admissionEpoch: number;
6517
+ environment: 'preview' | 'production';
6518
+ },
6519
+ operation: () => Promise<T>,
6520
+ options?: Pick<PostgresSchedulerOptions, 'schema'>,
6521
+ ): Promise<{ guarded: false } | { guarded: true; value: T }> {
6522
+ const { releaseAdmissionLockKeys } = runtimeReleaseAdmissionKeys(input);
6523
+ await client.query('BEGIN ISOLATION LEVEL READ COMMITTED');
6524
+ try {
6525
+ await client.query(
6526
+ `SELECT pg_advisory_xact_lock(
6527
+ ${POSTGRES_SCHEDULER_RELEASE_ADMISSION_LOCK_NAMESPACE},
6528
+ ${quoteIdent(schemaName(options))}.runtime_release_admission_lock_id(lock_key)
6529
+ )
6530
+ FROM unnest($1::text[]) AS lock_key
6531
+ ORDER BY lock_key`,
6532
+ [releaseAdmissionLockKeys],
6533
+ );
6534
+ const admission = await client.query<{ closed: boolean }>(
6535
+ `SELECT count(*)::integer = cardinality($1::text[])
6536
+ AND coalesce(bool_and(NOT accepting AND admission_epoch = $2::bigint), false) AS closed
6537
+ FROM ${tableName('runtime_release_admission', options)}
6538
+ WHERE release_id = ANY($1::text[])`,
6539
+ [releaseAdmissionLockKeys, input.admissionEpoch],
6540
+ );
6541
+ if (admission.rows[0]?.closed !== true) {
6542
+ await client.query('COMMIT');
6543
+ return { guarded: false };
6544
+ }
6545
+ const value = await operation();
6546
+ await client.query('COMMIT');
6547
+ return { guarded: true, value };
6548
+ } catch (error) {
6549
+ try {
6550
+ await client.query('ROLLBACK');
6551
+ } catch (rollbackError) {
6552
+ throw new AggregateError(
6553
+ [error, rollbackError],
6554
+ 'Retired release cleanup failed and its transaction could not roll back.',
6555
+ );
6556
+ }
6557
+ throw error;
6558
+ }
6559
+ }
6560
+
6496
6561
  /**
6497
6562
  * Scheduler-run statuses and suspension kinds a newer release lane may adopt.
6498
6563
  *
@@ -9936,7 +10001,11 @@ export async function directCompletePostgresSchedulerRunnerTerminal(
9936
10001
  $15::boolean
9937
10002
  OR run.launch_json #>> '{contractSnapshot,billingLimit,maxCreditsPerRun}' IS NULL
9938
10003
  )
9939
- FOR UPDATE
10004
+ -- Progress outbox inserts hold the run's projection mutex before
10005
+ -- their foreign-key check takes KEY SHARE on this row. Completion
10006
+ -- must permit that reference while retaining exclusive status writes,
10007
+ -- or its log-acceptance trigger deadlocks on the same mutex.
10008
+ FOR NO KEY UPDATE
9940
10009
  ),
9941
10010
  completed_attempt AS (
9942
10011
  UPDATE ${tableName('attempts', options)} AS target
package/dist/cli/index.js CHANGED
@@ -3507,7 +3507,7 @@ var SDK_RELEASE = {
3507
3507
  // getters keep their established compatibility behavior.
3508
3508
  // 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
3509
3509
  // 0.3.90 is the first deliberately versioned SDK release for API v3.
3510
- version: "0.3.250",
3510
+ version: "0.3.252",
3511
3511
  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.",
3512
3512
  packageCapabilities: {
3513
3513
  updatePreferences: 1
@@ -3502,7 +3502,7 @@ var SDK_RELEASE = {
3502
3502
  // getters keep their established compatibility behavior.
3503
3503
  // 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
3504
3504
  // 0.3.90 is the first deliberately versioned SDK release for API v3.
3505
- version: "0.3.250",
3505
+ version: "0.3.252",
3506
3506
  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.",
3507
3507
  packageCapabilities: {
3508
3508
  updatePreferences: 1
package/dist/index.js CHANGED
@@ -1320,7 +1320,7 @@ var SDK_RELEASE = {
1320
1320
  // getters keep their established compatibility behavior.
1321
1321
  // 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
1322
1322
  // 0.3.90 is the first deliberately versioned SDK release for API v3.
1323
- version: "0.3.250",
1323
+ version: "0.3.252",
1324
1324
  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.",
1325
1325
  packageCapabilities: {
1326
1326
  updatePreferences: 1
package/dist/index.mjs CHANGED
@@ -1224,7 +1224,7 @@ var SDK_RELEASE = {
1224
1224
  // getters keep their established compatibility behavior.
1225
1225
  // 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
1226
1226
  // 0.3.90 is the first deliberately versioned SDK release for API v3.
1227
- version: "0.3.250",
1227
+ version: "0.3.252",
1228
1228
  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.",
1229
1229
  packageCapabilities: {
1230
1230
  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.250";
152
+ readonly version: "0.3.252";
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.250";
152
+ readonly version: "0.3.252";
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.250",
77
+ version: "0.3.252",
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.250",
51
+ version: "0.3.252",
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.250",
3
+ "version": "0.3.252",
4
4
  "description": "GTM data CLI and TypeScript SDK for coding agents",
5
5
  "license": "MIT",
6
6
  "homepage": "https://code.deepline.com",