deepline 0.3.227 → 0.3.228

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.227',
203
+ version: '0.3.228',
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: {
@@ -132,3 +132,32 @@ export function selectRunEventsForAppRuntimeProjectionChunk(
132
132
  const batches = partitionRunEventsForAppRuntime(events);
133
133
  return batches.length === chunk.count ? batches[chunk.index] : undefined;
134
134
  }
135
+
136
+ /**
137
+ * Return the wire shapes accepted by the lease verifier. Older projectors sent
138
+ * the canonical events directly; current projectors also split large log
139
+ * events before grouping them into HTTP batches. A split can still fit in one
140
+ * HTTP batch, so that request has no projection chunk marker.
141
+ */
142
+ export function runEventsForAppRuntimeProjectionCandidates(
143
+ events: readonly PlayRunLedgerIngressEvent[],
144
+ chunk?: RunLedgerProjectionChunk,
145
+ ): Array<PlayRunLedgerIngressEvent[] | null> {
146
+ if (chunk) {
147
+ return [selectRunEventsForAppRuntimeProjectionChunk(events, chunk) ?? null];
148
+ }
149
+
150
+ const candidates: PlayRunLedgerIngressEvent[][] = [[...events]];
151
+ const batches = partitionRunEventsForAppRuntime(events);
152
+ if (batches.length === 1) {
153
+ const transportBatch = batches[0];
154
+ if (
155
+ transportBatch &&
156
+ (transportBatch.length !== events.length ||
157
+ transportBatch.some((event, index) => event !== events[index]))
158
+ ) {
159
+ candidates.push(transportBatch);
160
+ }
161
+ }
162
+ return candidates;
163
+ }
@@ -15,6 +15,10 @@ type ComparableRunLedgerEvent =
15
15
  | AcceptedPlayRunLedgerEvent
16
16
  | PlayRunLedgerIngressEvent;
17
17
 
18
+ type RunLedgerProjectionEventCandidate =
19
+ | readonly ComparableRunLedgerEvent[]
20
+ | null;
21
+
18
22
  /**
19
23
  * A newer app may receive a projection from a worker that predates optional
20
24
  * wait metadata. Normalize only those absent fields before the exact compare.
@@ -95,7 +99,7 @@ function safeMismatchedFields(
95
99
  */
96
100
  export function runLedgerProjectionMismatch(input: {
97
101
  projectedEvents: readonly AcceptedPlayRunLedgerEvent[];
98
- expectedEvents: readonly ComparableRunLedgerEvent[] | null;
102
+ expectedEvents: RunLedgerProjectionEventCandidate;
99
103
  chunk?: RunLedgerProjectionChunk;
100
104
  }): RunLedgerProjectionMismatchDiagnostic | null {
101
105
  const chunkIndex = input.chunk?.index ?? null;
@@ -149,3 +153,41 @@ export function runLedgerProjectionMismatch(input: {
149
153
  }
150
154
  return null;
151
155
  }
156
+
157
+ /**
158
+ * Compare a received projection against every wire shape accepted for its
159
+ * canonical prefix. Prefer a mismatch with the same event count as the
160
+ * received projection, since it identifies the first content difference
161
+ * instead of reporting a secondary count difference.
162
+ */
163
+ export function runLedgerProjectionMismatchAcrossCandidates(input: {
164
+ projectedEvents: readonly AcceptedPlayRunLedgerEvent[];
165
+ expectedEventCandidates: readonly RunLedgerProjectionEventCandidate[];
166
+ chunk?: RunLedgerProjectionChunk;
167
+ }): RunLedgerProjectionMismatchDiagnostic | null {
168
+ if (input.expectedEventCandidates.length === 0) {
169
+ return runLedgerProjectionMismatch({
170
+ projectedEvents: input.projectedEvents,
171
+ expectedEvents: null,
172
+ ...(input.chunk ? { chunk: input.chunk } : {}),
173
+ });
174
+ }
175
+
176
+ let bestMismatch: RunLedgerProjectionMismatchDiagnostic | null = null;
177
+ for (const expectedEvents of input.expectedEventCandidates) {
178
+ const mismatch = runLedgerProjectionMismatch({
179
+ projectedEvents: input.projectedEvents,
180
+ expectedEvents,
181
+ ...(input.chunk ? { chunk: input.chunk } : {}),
182
+ });
183
+ if (mismatch === null) return null;
184
+ if (
185
+ bestMismatch === null ||
186
+ (mismatch.expectedEventCount === input.projectedEvents.length &&
187
+ bestMismatch.expectedEventCount !== input.projectedEvents.length)
188
+ ) {
189
+ bestMismatch = mismatch;
190
+ }
191
+ }
192
+ return bestMismatch;
193
+ }
@@ -93,7 +93,6 @@ import {
93
93
  } from '../log-provenance';
94
94
  import {
95
95
  buildRunLedgerEventsIdempotencyKey,
96
- isRunLedgerProjectionChunk,
97
96
  RunLedgerProjectionLeaseLostError,
98
97
  type RunLedgerProjectionChunk,
99
98
  type RunLedgerProjectionLeaseLostReason,
@@ -101,8 +100,8 @@ import {
101
100
  buildRunLedgerStartIdempotencyKey,
102
101
  buildRunLedgerTerminalIdempotencyKey,
103
102
  } from '../run-ledger-projection-contract';
104
- import { runLedgerProjectionMismatch } from '../run-ledger-projection-diagnostics';
105
- import { selectRunEventsForAppRuntimeProjectionChunk } from '../run-ledger-event-transport';
103
+ import { runLedgerProjectionMismatchAcrossCandidates } from '../run-ledger-projection-diagnostics';
104
+ import { runEventsForAppRuntimeProjectionCandidates } from '../run-ledger-event-transport';
106
105
  import {
107
106
  assertTerminalRunResultWithinLimit,
108
107
  isLedgerTerminalResultRef,
@@ -16106,32 +16105,22 @@ export async function assertPostgresRunLedgerDelivery(
16106
16105
  }),
16107
16106
  );
16108
16107
  }
16109
- let expectedProjectionEvents:
16110
- | readonly (AcceptedPlayRunLedgerEvent | PlayRunLedgerIngressEvent)[]
16111
- | undefined;
16112
- if (input.projectionChunk) {
16113
- const chunk = input.projectionChunk;
16114
- // The sender partitions ingress events before the route sanitizes each chunk.
16115
- const expectedTransportChunk = isRunLedgerProjectionChunk(chunk)
16116
- ? selectRunEventsForAppRuntimeProjectionChunk(prefixEvents, chunk)
16117
- : undefined;
16118
- expectedProjectionEvents =
16119
- expectedTransportChunk === undefined
16120
- ? undefined
16108
+ const expectedProjectionCandidates =
16109
+ runEventsForAppRuntimeProjectionCandidates(
16110
+ prefixEvents,
16111
+ input.projectionChunk,
16112
+ ).map((candidate) =>
16113
+ candidate === null
16114
+ ? null
16121
16115
  : input.sanitizeExpectedProjectionEvents
16122
- ? input.sanitizeExpectedProjectionEvents(expectedTransportChunk)
16123
- : expectedTransportChunk;
16124
- } else {
16125
- expectedProjectionEvents = input.sanitizeExpectedProjectionEvents
16126
- ? input.sanitizeExpectedProjectionEvents(prefixEvents)
16127
- : prefixEvents;
16128
- }
16129
- const projectionMismatch: RunLedgerProjectionMismatchDiagnostic | null =
16130
- runLedgerProjectionMismatch({
16131
- projectedEvents: input.projectedEvents,
16132
- expectedEvents: expectedProjectionEvents ?? null,
16133
- ...(input.projectionChunk ? { chunk: input.projectionChunk } : {}),
16134
- });
16116
+ ? input.sanitizeExpectedProjectionEvents(candidate)
16117
+ : candidate,
16118
+ );
16119
+ const projectionMismatch = runLedgerProjectionMismatchAcrossCandidates({
16120
+ projectedEvents: input.projectedEvents,
16121
+ expectedEventCandidates: expectedProjectionCandidates,
16122
+ ...(input.projectionChunk ? { chunk: input.projectionChunk } : {}),
16123
+ });
16135
16124
  if (projectionMismatch === null) return;
16136
16125
  throw new RunLedgerProjectionLeaseLostError(
16137
16126
  'projected_events_mismatch',
package/dist/cli/index.js CHANGED
@@ -3051,7 +3051,7 @@ var SDK_RELEASE = {
3051
3051
  // getters keep their established compatibility behavior.
3052
3052
  // 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
3053
3053
  // 0.3.90 is the first deliberately versioned SDK release for API v3.
3054
- version: "0.3.227",
3054
+ version: "0.3.228",
3055
3055
  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.",
3056
3056
  packageCapabilities: {
3057
3057
  updatePreferences: 1
@@ -3046,7 +3046,7 @@ var SDK_RELEASE = {
3046
3046
  // getters keep their established compatibility behavior.
3047
3047
  // 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
3048
3048
  // 0.3.90 is the first deliberately versioned SDK release for API v3.
3049
- version: "0.3.227",
3049
+ version: "0.3.228",
3050
3050
  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.",
3051
3051
  packageCapabilities: {
3052
3052
  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.227",
867
+ version: "0.3.228",
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.227",
771
+ version: "0.3.228",
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.227";
152
+ readonly version: "0.3.228";
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.227";
152
+ readonly version: "0.3.228";
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.227",
77
+ version: "0.3.228",
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.227",
51
+ version: "0.3.228",
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.227",
3
+ "version": "0.3.228",
4
4
  "description": "GTM data CLI and TypeScript SDK for coding agents",
5
5
  "license": "MIT",
6
6
  "homepage": "https://code.deepline.com",