deepline 0.3.253 → 0.3.255

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.253',
203
+ version: '0.3.255',
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: {
@@ -308,7 +308,8 @@ const POSTGRES_SCHEDULER_SCHEMA_INIT_STATEMENT_TIMEOUT_MS = 60_000;
308
308
  // receipt transitions; no existing runtime wire field changes.
309
309
  // v48 expands optional compact-log columns and readers before writer enablement.
310
310
  // v49 installs transactional compact-log writers; only new admissions opt in.
311
- export const POSTGRES_SCHEDULER_SCHEMA_VERSION = 49;
311
+ // v50 adds a partial run-scoped outbox index for projection lease verification.
312
+ export const POSTGRES_SCHEDULER_SCHEMA_VERSION = 50;
312
313
  const POSTGRES_SCHEDULER_SCHEMA_MIGRATIONS_TABLE =
313
314
  'scheduler_schema_migrations';
314
315
  export const POSTGRES_SCHEDULER_OPEN_RECOVERY_INDEX =
@@ -3935,6 +3936,14 @@ const POSTGRES_SCHEDULER_RUNTIME_ADMIN_INDEXES = [
3935
3936
  definition: `(created_at, event_id)
3936
3937
  WHERE delivered_at IS NULL AND failed_at IS NULL`,
3937
3938
  },
3939
+ {
3940
+ name: 'runtime_scheduler_outbox_run_pending_order_idx',
3941
+ table: 'outbox',
3942
+ definition: `(run_id,
3943
+ (CASE event_type WHEN 'run.created' THEN 0 WHEN 'run.started' THEN 1 ELSE 2 END),
3944
+ created_at, event_id)
3945
+ WHERE delivered_at IS NULL`,
3946
+ },
3938
3947
  {
3939
3948
  name: 'runtime_scheduler_outbox_lease_health_idx',
3940
3949
  table: 'outbox',
@@ -7037,7 +7046,7 @@ export async function resumePostgresSchedulerDetachedRunnerAttempt(
7037
7046
  SELECT 1 FROM ${tableName('control', options)} AS control
7038
7047
  WHERE control.key = 'runtime_cancel:' || $1
7039
7048
  )
7040
- FOR UPDATE
7049
+ FOR NO KEY UPDATE
7041
7050
  ), detached_attempt AS MATERIALIZED (
7042
7051
  SELECT attempt.run_id, attempt.attempt, attempt.status, attempt.lease_token
7043
7052
  FROM ${tableName('attempts', options)} AS attempt
@@ -7060,7 +7069,7 @@ export async function resumePostgresSchedulerDetachedRunnerAttempt(
7060
7069
  WHERE target.run_id = detached_attempt.run_id
7061
7070
  AND target.attempt = detached_attempt.attempt
7062
7071
  AND target.lease_token = detached_attempt.lease_token
7063
- AND target.status = 'running'
7072
+ AND detached_attempt.status = 'running'
7064
7073
  RETURNING target.run_id
7065
7074
  ), restored_run AS (
7066
7075
  UPDATE ${tableName('runs', options)} AS target
@@ -7073,8 +7082,12 @@ export async function resumePostgresSchedulerDetachedRunnerAttempt(
7073
7082
  (target.suspension_json ->> 'ceilingMs')::double precision) / 1000
7074
7083
  ) ELSE target.wait_deadline END,
7075
7084
  updated_at = now()
7076
- WHERE target.run_id IN (SELECT run_id FROM detached_attempt)
7077
- AND target.status = 'running'
7085
+ -- The locked CTE may have followed a concurrent resume's new version.
7086
+ -- Qualify by that version, not the UPDATE scan's earlier snapshot.
7087
+ FROM detached_run
7088
+ WHERE target.run_id = detached_run.run_id
7089
+ AND target.run_id IN (SELECT run_id FROM detached_attempt)
7090
+ AND detached_run.status = 'running'
7078
7091
  RETURNING target.run_id
7079
7092
  ), restored_outbox AS (
7080
7093
  INSERT INTO ${tableName('outbox', options)} (
@@ -7290,7 +7303,15 @@ export async function markPostgresSchedulerAttemptRunning(
7290
7303
  const outboxEventId = `run-resumed:${input.runId}:${randomUUID()}`;
7291
7304
  const running = await client.query<{ run_id: string; event_id: string }>(
7292
7305
  `
7293
- WITH running_attempt AS (
7306
+ WITH waiting_run AS MATERIALIZED (
7307
+ SELECT target.run_id, target.suspension_json
7308
+ FROM ${tableName('runs', options)} AS target
7309
+ WHERE target.run_id = $1 AND target.status = 'waiting'
7310
+ -- Match detached restore's Run -> attempt order. NO KEY UPDATE also
7311
+ -- allows the outbox reference while its trigger owns the log mutex.
7312
+ FOR NO KEY UPDATE
7313
+ ),
7314
+ running_attempt AS (
7294
7315
  UPDATE ${tableName('attempts', options)} AS target
7295
7316
  SET status = 'running',
7296
7317
  heartbeat_at = CASE WHEN $5::boolean THEN heartbeat_at ELSE now() END,
@@ -7299,6 +7320,7 @@ export async function markPostgresSchedulerAttemptRunning(
7299
7320
  AND target.attempt = $2
7300
7321
  AND target.status = 'waiting'
7301
7322
  AND target.lease_token = $3
7323
+ AND target.run_id IN (SELECT run_id FROM waiting_run)
7302
7324
  AND NOT EXISTS (
7303
7325
  SELECT 1
7304
7326
  FROM ${tableName('attempts', options)} AS newer
@@ -7308,13 +7330,6 @@ export async function markPostgresSchedulerAttemptRunning(
7308
7330
  )
7309
7331
  RETURNING run_id
7310
7332
  ),
7311
- waiting_run AS (
7312
- SELECT target.run_id, target.suspension_json
7313
- FROM ${tableName('runs', options)} AS target
7314
- WHERE target.run_id IN (SELECT run_id FROM running_attempt)
7315
- AND target.status = 'waiting'
7316
- FOR UPDATE
7317
- ),
7318
7333
  running_run AS (
7319
7334
  UPDATE ${tableName('runs', options)} AS target
7320
7335
  SET status = 'running',
@@ -7325,6 +7340,7 @@ export async function markPostgresSchedulerAttemptRunning(
7325
7340
  updated_at = now()
7326
7341
  FROM waiting_run
7327
7342
  WHERE target.run_id = waiting_run.run_id
7343
+ AND target.run_id IN (SELECT run_id FROM running_attempt)
7328
7344
  RETURNING target.run_id, waiting_run.suspension_json
7329
7345
  ),
7330
7346
  resumed_outbox AS (
@@ -7392,7 +7408,7 @@ export async function claimPostgresSchedulerCompletedDetachedRunnerTerminal(
7392
7408
  AND status = 'waiting'
7393
7409
  AND suspension_json ->> 'kind' = 'detached_runner'
7394
7410
  AND suspension_json -> 'runnerAttempt' = to_jsonb($2::integer)
7395
- FOR UPDATE
7411
+ FOR NO KEY UPDATE
7396
7412
  ),
7397
7413
  running_attempt AS (
7398
7414
  UPDATE ${tableName('attempts', options)} AS target
@@ -7540,7 +7556,8 @@ export async function claimPostgresSchedulerOverdueDetachedRunnerCeilings(
7540
7556
  END
7541
7557
  ) ASC, runs.run_id ASC
7542
7558
  LIMIT $2
7543
- FOR UPDATE OF runs, attempts SKIP LOCKED
7559
+ FOR NO KEY UPDATE OF runs SKIP LOCKED
7560
+ FOR UPDATE OF attempts SKIP LOCKED
7544
7561
  ),
7545
7562
  running_attempts AS (
7546
7563
  UPDATE ${tableName('attempts', options)} AS target
@@ -8277,7 +8294,13 @@ export async function handoffPostgresSchedulerAttemptContinuation(
8277
8294
  const outboxEventId = `run-resumed:${input.runId}:${randomUUID()}`;
8278
8295
  const handedOff = await client.query<{ run_id: string; event_id: string }>(
8279
8296
  `
8280
- WITH continuation_attempt AS (
8297
+ WITH waiting_run AS MATERIALIZED (
8298
+ SELECT target.run_id, target.suspension_json
8299
+ FROM ${tableName('runs', options)} AS target
8300
+ WHERE target.run_id = $1 AND target.status = 'waiting'
8301
+ FOR NO KEY UPDATE
8302
+ ),
8303
+ continuation_attempt AS (
8281
8304
  UPDATE ${tableName('attempts', options)}
8282
8305
  SET status = 'stale',
8283
8306
  lease_expires_at = NULL,
@@ -8287,15 +8310,9 @@ export async function handoffPostgresSchedulerAttemptContinuation(
8287
8310
  AND attempt = $2
8288
8311
  AND status = 'waiting'
8289
8312
  AND lease_token = $3
8313
+ AND run_id IN (SELECT run_id FROM waiting_run)
8290
8314
  RETURNING run_id
8291
8315
  ),
8292
- waiting_run AS (
8293
- SELECT target.run_id, target.suspension_json
8294
- FROM ${tableName('runs', options)} AS target
8295
- WHERE target.run_id IN (SELECT run_id FROM continuation_attempt)
8296
- AND target.status = 'waiting'
8297
- FOR UPDATE
8298
- ),
8299
8316
  continuation_run AS (
8300
8317
  UPDATE ${tableName('runs', options)} AS target
8301
8318
  SET status = 'queued',
@@ -8305,6 +8322,7 @@ export async function handoffPostgresSchedulerAttemptContinuation(
8305
8322
  updated_at = now()
8306
8323
  FROM waiting_run
8307
8324
  WHERE target.run_id = waiting_run.run_id
8325
+ AND target.run_id IN (SELECT run_id FROM continuation_attempt)
8308
8326
  RETURNING target.run_id, waiting_run.suspension_json
8309
8327
  ),
8310
8328
  resumed_outbox AS (
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.253",
3510
+ version: "0.3.255",
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.253",
3505
+ version: "0.3.255",
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.253",
1323
+ version: "0.3.255",
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.253",
1227
+ version: "0.3.255",
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.253";
152
+ readonly version: "0.3.255";
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.253";
152
+ readonly version: "0.3.255";
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.253",
77
+ version: "0.3.255",
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.253",
51
+ version: "0.3.255",
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.253",
3
+ "version": "0.3.255",
4
4
  "description": "GTM data CLI and TypeScript SDK for coding agents",
5
5
  "license": "MIT",
6
6
  "homepage": "https://code.deepline.com",