deepline 0.3.146 → 0.3.147

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.146',
203
+ version: '0.3.147',
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: {
@@ -4,7 +4,7 @@ import {
4
4
  } from './batching-types';
5
5
 
6
6
  const FULLENRICH_BATCH_ITEM_KEY = 'deepline_batch_item_key';
7
- const FULLENRICH_BATCH_SIZE = 100;
7
+ export const FULLENRICH_MAX_BATCH_SIZE = 50;
8
8
 
9
9
  type FullEnrichContactRow = Record<string, unknown> & {
10
10
  custom?: Record<string, string>;
@@ -148,7 +148,7 @@ const fullenrichBulkSelfBatchStrategy: BatchOperationStrategy<
148
148
  sourceOperation: 'fullenrich_bulk_enrich',
149
149
  batchOperation: 'fullenrich_bulk_enrich',
150
150
  kind: 'identifier_batch',
151
- maxBatchSize: FULLENRICH_BATCH_SIZE,
151
+ maxBatchSize: FULLENRICH_MAX_BATCH_SIZE,
152
152
  canBatchWith(left, right) {
153
153
  return (
154
154
  isOneRowPayload(left) &&
@@ -19,6 +19,8 @@ import {
19
19
  export interface GatewayProgressRegistry {
20
20
  ingest: (input: {
21
21
  launch: PlaySchedulerSubmitInput;
22
+ /** Verified for this request; the persisted launch token may have expired. */
23
+ authenticatedExecutorToken: string;
22
24
  runId: string;
23
25
  attempt: number;
24
26
  events: unknown[];
@@ -40,6 +42,8 @@ export interface GatewayProgressRegistry {
40
42
  */
41
43
  finalizeTerminal: (input: {
42
44
  launch: PlaySchedulerSubmitInput;
45
+ /** Verified for this request; the persisted launch token may have expired. */
46
+ authenticatedExecutorToken: string;
43
47
  runId: string;
44
48
  attempt: number;
45
49
  result: PlayRunnerResult;
@@ -62,6 +66,8 @@ export interface GatewayProgressRegistry {
62
66
  export async function projectGatewayRunnerTerminalProgress(input: {
63
67
  registry: GatewayProgressRegistry;
64
68
  launch: PlaySchedulerSubmitInput;
69
+ /** Verified for this request; the persisted launch token may have expired. */
70
+ authenticatedExecutorToken: string;
65
71
  runId: string;
66
72
  attempt: number;
67
73
  result: PlayRunnerResult;
@@ -79,6 +85,7 @@ export async function projectGatewayRunnerTerminalProgress(input: {
79
85
  // before the caller can commit the terminal fact.
80
86
  await input.registry.finalizeTerminal({
81
87
  launch: input.launch,
88
+ authenticatedExecutorToken: input.authenticatedExecutorToken,
82
89
  runId: input.runId,
83
90
  attempt: input.attempt,
84
91
  result: input.result,
@@ -91,6 +98,7 @@ export async function projectGatewayRunnerTerminalProgress(input: {
91
98
  } else if (input.events.length > 0) {
92
99
  await input.registry.ingest({
93
100
  launch: input.launch,
101
+ authenticatedExecutorToken: input.authenticatedExecutorToken,
94
102
  runId: input.runId,
95
103
  attempt: input.attempt,
96
104
  events: input.events,
@@ -130,6 +138,7 @@ export function createGatewayProgressRegistry(options?: {
130
138
  return {
131
139
  async ingest({
132
140
  launch,
141
+ authenticatedExecutorToken,
133
142
  attempt,
134
143
  events,
135
144
  liveLogOffset,
@@ -137,7 +146,7 @@ export function createGatewayProgressRegistry(options?: {
137
146
  attemptAlreadyVerified,
138
147
  }) {
139
148
  const reporter = createReporter(
140
- launch,
149
+ { ...launch, executorToken: authenticatedExecutorToken },
141
150
  attempt,
142
151
  isCurrentAttempt,
143
152
  liveLogOffset,
@@ -154,7 +163,10 @@ export function createGatewayProgressRegistry(options?: {
154
163
  async finalize() {},
155
164
  async finalizeTerminal(input) {
156
165
  const reporter = createReporter(
157
- input.launch,
166
+ {
167
+ ...input.launch,
168
+ executorToken: input.authenticatedExecutorToken,
169
+ },
158
170
  input.attempt,
159
171
  input.isCurrentAttempt,
160
172
  input.liveLogOffset,
@@ -24,6 +24,8 @@ const RATE_BUCKET_TABLE = 'rate_bucket';
24
24
  const RATE_CONCURRENCY_LEASE_TABLE = 'rate_concurrency_leases';
25
25
  const RATE_CONCURRENCY_OBSERVER_TABLE = 'rate_concurrency_observers';
26
26
  const RATE_RESERVATION_TABLE = 'rate_reservations';
27
+ const RATE_RESERVATION_BUCKET_EXPIRY_INDEX =
28
+ 'runtime_scheduler_rate_reservation_bucket_expiry_idx';
27
29
  const RATE_REQUESTER_TABLE = 'rate_requesters';
28
30
  const MIN_CONCURRENCY_WAIT_MS = 10;
29
31
  /**
@@ -372,7 +374,10 @@ function positiveInt(value: number, label: string): number {
372
374
 
373
375
  export async function ensurePostgresRateStateSchema(
374
376
  client: PostgresSchedulerQueryClient,
375
- options?: { schema?: string | null },
377
+ options?: {
378
+ schema?: string | null;
379
+ deferReservationBucketExpiryIndex?: boolean;
380
+ },
376
381
  ): Promise<void> {
377
382
  // Token-bucket + AIMD-in-the-row state. One row per (bucket_id, rule_id). The
378
383
  // hot path is a single autocommit statement. It locks only the selected
@@ -486,6 +491,11 @@ export async function ensurePostgresRateStateSchema(
486
491
  CREATE INDEX IF NOT EXISTS runtime_scheduler_rate_concurrency_observer_expiry_idx
487
492
  ON ${concurrencyObserverTableName(options)} (expires_at_ms)
488
493
  `);
494
+ const reservationTableAlreadyExists = await client.query<{
495
+ present: boolean;
496
+ }>('SELECT to_regclass($1) IS NOT NULL AS present', [
497
+ reservationTableName(options),
498
+ ]);
489
499
  await client.query(`
490
500
  CREATE TABLE IF NOT EXISTS ${reservationTableName(options)} (
491
501
  bucket_id text NOT NULL,
@@ -498,6 +508,17 @@ export async function ensurePostgresRateStateSchema(
498
508
  CREATE INDEX IF NOT EXISTS runtime_scheduler_rate_reservation_expiry_idx
499
509
  ON ${reservationTableName(options)} (expires_at_ms)
500
510
  `);
511
+ // Shared populated tables need a concurrent build, but a missing table is
512
+ // created empty by this migration and can receive its index directly.
513
+ if (
514
+ !options?.deferReservationBucketExpiryIndex ||
515
+ reservationTableAlreadyExists.rows[0]?.present !== true
516
+ ) {
517
+ await client.query(`
518
+ CREATE INDEX IF NOT EXISTS ${RATE_RESERVATION_BUCKET_EXPIRY_INDEX}
519
+ ON ${reservationTableName(options)} (bucket_id, expires_at_ms)
520
+ `);
521
+ }
501
522
  await client.query(`
502
523
  CREATE INDEX IF NOT EXISTS runtime_scheduler_rate_bucket_bucket_idx
503
524
  ON ${bucketTableName(options)} (bucket_id)
@@ -264,7 +264,9 @@ const POSTGRES_SCHEDULER_SCHEMA_INIT_STATEMENT_TIMEOUT_MS = 60_000;
264
264
  // v44 moves the v39-v43 shared-schema expansion onto the online, statement-
265
265
  // scoped migration path. The reader contract is unchanged; the marker ensures
266
266
  // deployment retries do not re-enter the old cross-table DDL transaction.
267
- export const POSTGRES_SCHEDULER_SCHEMA_VERSION = 44;
267
+ // v45 adds the bucket-leading expiration index used by rate-reservation
268
+ // cleanup. Shared schemas build it concurrently through the deploy migrator.
269
+ export const POSTGRES_SCHEDULER_SCHEMA_VERSION = 45;
268
270
  const POSTGRES_SCHEDULER_SCHEMA_MIGRATIONS_TABLE =
269
271
  'scheduler_schema_migrations';
270
272
  export const POSTGRES_SCHEDULER_OPEN_RECOVERY_INDEX =
@@ -1829,6 +1831,15 @@ export async function hasCurrentPostgresSchedulerSchemaShape(
1829
1831
  AND index_class.relname = 'runtime_scheduler_runs_terminal_finished_idx'
1830
1832
  AND index_row.indrelid = to_regclass($4)
1831
1833
  AND index_row.indisready AND index_row.indisvalid
1834
+ )
1835
+ AND EXISTS (
1836
+ SELECT 1 FROM pg_index AS index_row
1837
+ JOIN pg_class AS index_class ON index_class.oid = index_row.indexrelid
1838
+ JOIN pg_namespace AS index_namespace ON index_namespace.oid = index_class.relnamespace
1839
+ WHERE index_namespace.nspname = $1
1840
+ AND index_class.relname = 'runtime_scheduler_rate_reservation_bucket_expiry_idx'
1841
+ AND index_row.indrelid = to_regclass($9)
1842
+ AND index_row.indisready AND index_row.indisvalid
1832
1843
  ) AS ready
1833
1844
  `,
1834
1845
  [
@@ -1840,6 +1851,7 @@ export async function hasCurrentPostgresSchedulerSchemaShape(
1840
1851
  requirements.blockedOutboxIndex !== false,
1841
1852
  `${quotedSchema}.${quoteIdent('sandbox_cleanup_jobs_v2')}`,
1842
1853
  `${quotedSchema}.${quoteIdent('compute_billing_jobs_v2')}`,
1854
+ `${quotedSchema}.${quoteIdent('rate_reservations')}`,
1843
1855
  ],
1844
1856
  );
1845
1857
  return runtimeAdminIndexes.rows[0]?.ready === true;
@@ -3434,7 +3446,10 @@ export async function ensurePostgresSchedulerSchema(
3434
3446
  END
3435
3447
  $$
3436
3448
  `);
3437
- await ensurePostgresRateStateSchema(client, options);
3449
+ await ensurePostgresRateStateSchema(client, {
3450
+ schema,
3451
+ deferReservationBucketExpiryIndex: options?.deferRuntimeAdminIndexes,
3452
+ });
3438
3453
  await ensurePostgresBudgetStateSchema(client, {
3439
3454
  schedulerSchema: schemaName(options),
3440
3455
  });
@@ -3792,6 +3807,11 @@ const POSTGRES_SCHEDULER_RUNTIME_ADMIN_INDEXES = [
3792
3807
  WHERE status IN ('completed', 'failed', 'cancelled')
3793
3808
  AND started_at IS NOT NULL`,
3794
3809
  },
3810
+ {
3811
+ name: 'runtime_scheduler_rate_reservation_bucket_expiry_idx',
3812
+ table: 'rate_reservations',
3813
+ definition: `(bucket_id, expires_at_ms)`,
3814
+ },
3795
3815
  ] as const;
3796
3816
 
3797
3817
  async function readPostgresSchedulerIndexState(
@@ -3824,7 +3844,7 @@ async function readPostgresSchedulerIndexState(
3824
3844
  }
3825
3845
 
3826
3846
  /**
3827
- * Remove interrupted dashboard index builds from a quiesced run-scoped
3847
+ * Remove interrupted deploy-owned index builds from a quiesced run-scoped
3828
3848
  * schema so transactional CREATE INDEX IF NOT EXISTS can recreate them.
3829
3849
  * Shared schemas must use the concurrent repair path below.
3830
3850
  */
@@ -3848,9 +3868,9 @@ export async function repairInvalidRunScopedRuntimeAdminIndexes(
3848
3868
  }
3849
3869
 
3850
3870
  /**
3851
- * The Runtime Workers dashboard and bounded delivered-outbox retention rely on
3852
- * these indexes. Deploy owns the builds because the live scheduler tables are
3853
- * too large for request or worker startup to run blocking DDL.
3871
+ * Runtime health surfaces, bounded retention, and hot-path cleanup rely on
3872
+ * these indexes. Deploy owns the builds because live scheduler tables are too
3873
+ * large for request or worker startup to run blocking DDL.
3854
3874
  */
3855
3875
  export async function ensurePostgresSchedulerRuntimeAdminIndexesConcurrently(
3856
3876
  client: PostgresSchedulerQueryClient,
@@ -3882,7 +3902,7 @@ export async function ensurePostgresSchedulerRuntimeAdminIndexesConcurrently(
3882
3902
  );
3883
3903
  if (installed.kind !== 'ready') {
3884
3904
  throw new Error(
3885
- `Runtime scheduler dashboard index ${schema}.${index.name} is not valid and ready after concurrent creation.`,
3905
+ `Runtime scheduler index ${schema}.${index.name} is not valid and ready after concurrent creation.`,
3886
3906
  );
3887
3907
  }
3888
3908
  }
@@ -202,11 +202,15 @@ export function runtimeSheetPageTailWriteMarkerEvent(
202
202
  ) {
203
203
  return null;
204
204
  }
205
+ const at = new Date().toISOString();
205
206
  return {
206
207
  type: 'log',
207
- at: new Date().toISOString(),
208
+ at,
208
209
  source: 'play',
209
- line: `[runtime.sheet-page-tail-write] phase=start table=${tableNamespace} rows=${rows.length}`,
210
+ // The status projection currently exposes the durable log line without
211
+ // the event envelope's `at`. Keep the emission time in the line so the
212
+ // runtime-preview proof can measure delayed projection accurately.
213
+ line: `[${at}] [runtime.sheet-page-tail-write] phase=start table=${tableNamespace} rows=${rows.length}`,
210
214
  };
211
215
  }
212
216
 
package/dist/cli/index.js CHANGED
@@ -3068,7 +3068,7 @@ var SDK_RELEASE = {
3068
3068
  // getters keep their established compatibility behavior.
3069
3069
  // 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
3070
3070
  // 0.3.90 is the first deliberately versioned SDK release for API v3.
3071
- version: "0.3.146",
3071
+ version: "0.3.147",
3072
3072
  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.",
3073
3073
  packageCapabilities: {
3074
3074
  updatePreferences: 1
@@ -3063,7 +3063,7 @@ var SDK_RELEASE = {
3063
3063
  // getters keep their established compatibility behavior.
3064
3064
  // 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
3065
3065
  // 0.3.90 is the first deliberately versioned SDK release for API v3.
3066
- version: "0.3.146",
3066
+ version: "0.3.147",
3067
3067
  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.",
3068
3068
  packageCapabilities: {
3069
3069
  updatePreferences: 1
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.146",
867
+ version: "0.3.147",
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
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.146",
771
+ version: "0.3.147",
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
@@ -149,7 +149,7 @@ type SdkRelease = {
149
149
  supportPolicy: SdkSupportPolicy;
150
150
  };
151
151
  declare const SDK_RELEASE: {
152
- readonly version: "0.3.146";
152
+ readonly version: "0.3.147";
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.146";
152
+ readonly version: "0.3.147";
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.146",
77
+ version: "0.3.147",
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.146",
51
+ version: "0.3.147",
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.146",
3
+ "version": "0.3.147",
4
4
  "description": "GTM data CLI and TypeScript SDK for coding agents",
5
5
  "license": "MIT",
6
6
  "homepage": "https://code.deepline.com",