deepline 0.3.119 → 0.3.121

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.119',
203
+ version: '0.3.121',
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: {
@@ -31,6 +31,9 @@ export type TelemetryContext = {
31
31
  workflowOrigin?: string | null;
32
32
  playName?: string | null;
33
33
  machineId?: string | null;
34
+ gatewayRole?: string | null;
35
+ /** Stable identity for one in-process gateway handler lifecycle. */
36
+ gatewayLifecycleId?: string | null;
34
37
  };
35
38
 
36
39
  export type TelemetryLevel = 'debug' | 'info' | 'warn' | 'error';
@@ -182,6 +185,8 @@ const RESERVED_FIELDS = new Set([
182
185
  'workflowOrigin',
183
186
  'playName',
184
187
  'machineId',
188
+ 'gatewayRole',
189
+ 'gatewayLifecycleId',
185
190
  ]);
186
191
 
187
192
  function errorTriage(fields: TelemetryFields | undefined): TelemetryTriage {
@@ -110,6 +110,7 @@ import {
110
110
  type ToolResponseView,
111
111
  } from '../plays/tool-response-contract';
112
112
  import {
113
+ AllAdmittedRowsFailedError,
113
114
  isProviderExhaustedFailure,
114
115
  ProviderExhaustedError,
115
116
  } from './run-failure';
@@ -1529,10 +1530,13 @@ type FieldMapRunResult = {
1529
1530
  failedRows: PersistableMapRow[];
1530
1531
  completedRowCount: number;
1531
1532
  failedRowCount: number;
1533
+ failureSamples: Array<{ rowLabel: string; error: string }>;
1532
1534
  previewRows: Record<string, unknown>[];
1533
1535
  retainedRowsComplete: boolean;
1534
1536
  };
1535
1537
 
1538
+ const MAP_FAILURE_SAMPLE_LIMIT = 3;
1539
+
1536
1540
  type RuntimeMapRowPersistence = {
1537
1541
  persistRows: (rows: PersistableMapRow[]) => {
1538
1542
  admitted: Promise<void>;
@@ -6804,6 +6808,8 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
6804
6808
  let failedCount = 0;
6805
6809
  let duplicateReuseCount = 0;
6806
6810
  let executedCount = 0;
6811
+ const failureSamples: Array<{ rowLabel: string; error: string }> = [];
6812
+ const failureSampleErrors = new Set<string>();
6807
6813
  const previewRows: Record<string, unknown>[] = [];
6808
6814
  // A bounded dataset may be materialized by authored code immediately
6809
6815
  // after run(). Keep the rows produced by this exact awaited execution so
@@ -7179,6 +7185,16 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
7179
7185
  executedCount += rowsToExecute.length;
7180
7186
  successfulCount += mapResult.completedRowCount;
7181
7187
  failedCount += mapResult.failedRowCount;
7188
+ for (const sample of mapResult.failureSamples) {
7189
+ if (
7190
+ failureSamples.length >= MAP_FAILURE_SAMPLE_LIMIT ||
7191
+ failureSampleErrors.has(sample.error)
7192
+ ) {
7193
+ continue;
7194
+ }
7195
+ failureSampleErrors.add(sample.error);
7196
+ failureSamples.push(sample);
7197
+ }
7182
7198
  processedCount += rowsToExecute.length;
7183
7199
  page.rows.length = 0;
7184
7200
  }
@@ -7216,10 +7232,12 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
7216
7232
  totalRows: totalInputCount,
7217
7233
  at: Date.now(),
7218
7234
  });
7219
- throw new Error(
7220
- `ctx.dataset("${normalizedMapNamespace}") failed for every admitted row (${failedCount}/${totalInputCount}). ` +
7221
- 'Failed rows were persisted and will be retried on the next run.',
7222
- );
7235
+ throw new AllAdmittedRowsFailedError({
7236
+ mapName: normalizedMapNamespace,
7237
+ failedCount,
7238
+ totalInputCount,
7239
+ samples: failureSamples,
7240
+ });
7223
7241
  }
7224
7242
 
7225
7243
  this.setMapFrame({
@@ -8105,6 +8123,8 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
8105
8123
  const failFastOnRowError = runtimeOptions?.onRowError === 'fail';
8106
8124
  const completedRowsToPersist: PersistableMapRow[] = [];
8107
8125
  const failedRowsToPersist: PersistableMapRow[] = [];
8126
+ const failureSamples: Array<{ rowLabel: string; error: string }> = [];
8127
+ const failureSampleErrors = new Set<string>();
8108
8128
  const previewRows: Record<string, unknown>[] = [];
8109
8129
  let completedRowCount = 0;
8110
8130
  let failedRowCount = 0;
@@ -8368,6 +8388,7 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
8368
8388
  failedRows: [],
8369
8389
  completedRowCount: results.length,
8370
8390
  failedRowCount: 0,
8391
+ failureSamples: [],
8371
8392
  previewRows: results.slice(0, 5),
8372
8393
  retainedRowsComplete: true,
8373
8394
  };
@@ -8573,6 +8594,16 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
8573
8594
  error: formattedError,
8574
8595
  });
8575
8596
  failedRowCount += 1;
8597
+ if (
8598
+ failureSamples.length < MAP_FAILURE_SAMPLE_LIMIT &&
8599
+ !failureSampleErrors.has(formattedError)
8600
+ ) {
8601
+ failureSampleErrors.add(formattedError);
8602
+ failureSamples.push({
8603
+ rowLabel: failedMapRowLogLabel(failedRow),
8604
+ error: formattedError,
8605
+ });
8606
+ }
8576
8607
  retainPersistedRow(failedRow, failedRowsToPersist);
8577
8608
  this.emitScopedRowUpdate(rowKey, normalizedTableNamespace, {
8578
8609
  rowId: idx,
@@ -8985,6 +9016,7 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
8985
9016
  failedRows: failedRowsToPersist,
8986
9017
  completedRowCount,
8987
9018
  failedRowCount,
9019
+ failureSamples,
8988
9020
  previewRows,
8989
9021
  retainedRowsComplete,
8990
9022
  };
@@ -23,12 +23,23 @@ export const PLAY_RUN_PRE_RUN_VALIDATION_FAILED =
23
23
  'PLAY_RUN_PRE_RUN_VALIDATION_FAILED' as const;
24
24
  export const RUNTIME_DB_SESSION_PRELOAD_INCOMPLETE =
25
25
  'RUNTIME_DB_SESSION_PRELOAD_INCOMPLETE' as const;
26
+ /**
27
+ * A disabled-source replay cannot create a new Runtime Run. If the original
28
+ * Run is absent, retrying the same existing-only admission can never make
29
+ * progress and only keeps the receipt on the 503 retry path.
30
+ */
31
+ export const PLAY_RUN_ADMISSION_REPLAY_MISSING =
32
+ 'PLAY_RUN_ADMISSION_REPLAY_MISSING' as const;
33
+ /** A reused Run identity with different launch facts is permanently invalid. */
34
+ export const PLAY_RUN_LAUNCH_CONFLICT = 'PLAY_RUN_LAUNCH_CONFLICT' as const;
26
35
 
27
36
  export type PlayAdmissionBlockedCode =
28
37
  | typeof PLAY_ADMISSION_PAYLOAD_UNREADABLE
29
38
  | typeof PLAY_SECRET_UNAVAILABLE
30
39
  | typeof PLAY_RUN_PRE_RUN_VALIDATION_FAILED
31
- | typeof RUNTIME_DB_SESSION_PRELOAD_INCOMPLETE;
40
+ | typeof RUNTIME_DB_SESSION_PRELOAD_INCOMPLETE
41
+ | typeof PLAY_RUN_ADMISSION_REPLAY_MISSING
42
+ | typeof PLAY_RUN_LAUNCH_CONFLICT;
32
43
 
33
44
  export type PlayAdmissionRetryableCode = typeof PLAY_ADMISSION_INTERNAL_FAILURE;
34
45
 
@@ -49,6 +60,8 @@ export type PlayAdmissionFailure =
49
60
  const TERMINAL_PRE_ADMISSION_CODES = new Set<PlayAdmissionBlockedCode>([
50
61
  PLAY_RUN_PRE_RUN_VALIDATION_FAILED,
51
62
  RUNTIME_DB_SESSION_PRELOAD_INCOMPLETE,
63
+ PLAY_RUN_ADMISSION_REPLAY_MISSING,
64
+ PLAY_RUN_LAUNCH_CONFLICT,
52
65
  ]);
53
66
 
54
67
  function stableErrorCode(error: unknown): string | null {
@@ -58,6 +58,93 @@ export const MODAL_PAYLOAD_UPLOAD_TIMEOUT_MESSAGE =
58
58
 
59
59
  export const WORKSPACE_STORAGE_NOT_READY_CODE = 'WORKSPACE_STORAGE_NOT_READY';
60
60
 
61
+ export const ALL_ADMITTED_ROWS_FAILED_CODE = 'ALL_ADMITTED_ROWS_FAILED';
62
+
63
+ export type AllAdmittedRowsFailedSample = {
64
+ rowLabel: string;
65
+ error: string;
66
+ };
67
+
68
+ const ALL_ADMITTED_ROWS_FAILED_SAMPLE_LIMIT = 3;
69
+ const ALL_ADMITTED_ROWS_FAILED_SAMPLE_TEXT_LIMIT = 500;
70
+
71
+ function boundedAllAdmittedRowsFailedSample(value: string): string {
72
+ const normalized = value.trim();
73
+ if (normalized.length <= ALL_ADMITTED_ROWS_FAILED_SAMPLE_TEXT_LIMIT) {
74
+ return normalized;
75
+ }
76
+ return `${normalized.slice(0, ALL_ADMITTED_ROWS_FAILED_SAMPLE_TEXT_LIMIT - 1)}…`;
77
+ }
78
+
79
+ function allAdmittedRowsFailedMessage(input: {
80
+ mapName: string;
81
+ failedCount: number;
82
+ totalInputCount: number;
83
+ samples: readonly AllAdmittedRowsFailedSample[];
84
+ }): string {
85
+ const representativeFailures = input.samples
86
+ .slice(0, ALL_ADMITTED_ROWS_FAILED_SAMPLE_LIMIT)
87
+ .map(
88
+ (sample) =>
89
+ `${boundedAllAdmittedRowsFailedSample(sample.rowLabel)}: ${boundedAllAdmittedRowsFailedSample(sample.error)}`,
90
+ )
91
+ .join('; ');
92
+ const omittedCount = Math.max(
93
+ 0,
94
+ input.failedCount -
95
+ Math.min(input.samples.length, ALL_ADMITTED_ROWS_FAILED_SAMPLE_LIMIT),
96
+ );
97
+ const omittedSuffix =
98
+ omittedCount > 0 ? `; ${omittedCount} additional failure(s) omitted` : '';
99
+ return (
100
+ `ctx.dataset("${input.mapName}") produced no successful rows ` +
101
+ `(${input.failedCount}/${input.totalInputCount} admitted rows failed). ` +
102
+ (representativeFailures
103
+ ? `Representative failures: ${representativeFailures}${omittedSuffix}. `
104
+ : '') +
105
+ 'Failed rows were persisted for review and may be retried on a later run.'
106
+ );
107
+ }
108
+
109
+ export class AllAdmittedRowsFailedError extends Error {
110
+ readonly code = ALL_ADMITTED_ROWS_FAILED_CODE;
111
+
112
+ constructor(input: {
113
+ mapName: string;
114
+ failedCount: number;
115
+ totalInputCount: number;
116
+ samples?: readonly AllAdmittedRowsFailedSample[];
117
+ }) {
118
+ super(
119
+ `${ALL_ADMITTED_ROWS_FAILED_CODE}: ${allAdmittedRowsFailedMessage({
120
+ ...input,
121
+ samples: input.samples ?? [],
122
+ })}`,
123
+ );
124
+ this.name = 'AllAdmittedRowsFailedError';
125
+ }
126
+ }
127
+
128
+ export function isAllAdmittedRowsFailedFailure(error: unknown): boolean {
129
+ if (error instanceof AllAdmittedRowsFailedError) return true;
130
+ const code =
131
+ error && typeof error === 'object'
132
+ ? (error as { code?: unknown }).code
133
+ : null;
134
+ const message = error instanceof Error ? error.message : String(error ?? '');
135
+ return (
136
+ code === ALL_ADMITTED_ROWS_FAILED_CODE ||
137
+ new RegExp(`^${ALL_ADMITTED_ROWS_FAILED_CODE}:\\s*`).test(message)
138
+ );
139
+ }
140
+
141
+ function allAdmittedRowsFailedPublicMessage(cause: string): string {
142
+ return cause.replace(
143
+ new RegExp(`^${ALL_ADMITTED_ROWS_FAILED_CODE}:\\s*`),
144
+ '',
145
+ );
146
+ }
147
+
61
148
  // User-facing message. Contains NO SQL, role names, database names, or hosts by
62
149
  // construction, so it is safe past redactRuntimeInternalError (which only strips
63
150
  // postgres-URI passwords). The raw pg error goes in the Error `cause` for server
@@ -323,6 +410,15 @@ function toErrorText(error: unknown): string {
323
410
  export function normalizePlayRunFailure(error: unknown): PlayRunFailureDetails {
324
411
  const rawCause = toErrorText(error);
325
412
  const cause = boundedFailureText(rawCause);
413
+ if (isAllAdmittedRowsFailedFailure(error)) {
414
+ return {
415
+ code: ALL_ADMITTED_ROWS_FAILED_CODE,
416
+ phase: 'runtime',
417
+ message: allAdmittedRowsFailedPublicMessage(cause),
418
+ retryable: false,
419
+ cause,
420
+ };
421
+ }
326
422
  if (
327
423
  error instanceof ToolExecutionError &&
328
424
  error.origin === 'deepline' &&
@@ -2043,6 +2043,16 @@ async function prepareAbsurdAttempt(input: {
2043
2043
  exists: projection.exists,
2044
2044
  blocked: projection.blocked,
2045
2045
  });
2046
+ console.info('[runtime.scheduler.projection_deferred]', {
2047
+ runId: input.runId,
2048
+ eventId,
2049
+ phase: 'run_created_projection_gate',
2050
+ status: 'deferred',
2051
+ exists: projection.exists,
2052
+ blocked: projection.blocked,
2053
+ delaySeconds: projection.blocked ? 5 : 1,
2054
+ attemptAllocated: false,
2055
+ });
2046
2056
  throw new DeferTask(
2047
2057
  `Run-created projection is not yet delivered for ${input.runId}.`,
2048
2058
  projection.blocked ? 5 : 1,
@@ -1,11 +1,15 @@
1
1
  import { createHash } from 'node:crypto';
2
2
  import {
3
3
  classifyPlayAdmissionFailure,
4
+ PLAY_RUN_ADMISSION_REPLAY_MISSING,
5
+ PLAY_RUN_LAUNCH_CONFLICT,
4
6
  PLAY_RUN_PRE_RUN_VALIDATION_FAILED,
5
7
  RUNTIME_DB_SESSION_PRELOAD_INCOMPLETE,
6
8
  } from './/play-admission-outcome';
7
9
 
8
10
  export {
11
+ PLAY_RUN_ADMISSION_REPLAY_MISSING,
12
+ PLAY_RUN_LAUNCH_CONFLICT,
9
13
  PLAY_RUN_PRE_RUN_VALIDATION_FAILED,
10
14
  RUNTIME_DB_SESSION_PRELOAD_INCOMPLETE,
11
15
  };
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.119",
3071
+ version: "0.3.121",
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.119",
3066
+ version: "0.3.121",
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
@@ -863,7 +863,7 @@ var SDK_RELEASE = {
863
863
  // getters keep their established compatibility behavior.
864
864
  // 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
865
865
  // 0.3.90 is the first deliberately versioned SDK release for API v3.
866
- version: "0.3.119",
866
+ version: "0.3.121",
867
867
  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.",
868
868
  packageCapabilities: {
869
869
  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.119",
771
+ version: "0.3.121",
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.119";
152
+ readonly version: "0.3.121";
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.119";
152
+ readonly version: "0.3.121";
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.119",
77
+ version: "0.3.121",
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.119",
51
+ version: "0.3.121",
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.119",
3
+ "version": "0.3.121",
4
4
  "description": "GTM data CLI and TypeScript SDK for coding agents",
5
5
  "license": "MIT",
6
6
  "homepage": "https://code.deepline.com",