deepline 0.3.237 → 0.3.238

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.
@@ -1,13 +1,9 @@
1
1
  import { DeeplineError } from './errors.js';
2
2
 
3
3
  /**
4
- * Shared reconnect policy for the canonical run SSE stream.
5
- *
6
- * Server stream windows are finite: the platform ends them cleanly at the
7
- * function ceiling even while the run keeps executing. Consumers that wait for
8
- * a terminal status (`plays run --watch`, `runs tail`, `client.runs.tail`)
9
- * therefore reconnect with full-jitter exponential backoff instead of treating
10
- * a window end as a failure.
4
+ * Retry policy for the legacy run SSE compatibility method. Ordinary run
5
+ * watching uses a fixed REST snapshot cadence and shares only the transient
6
+ * read-error classification below.
11
7
  */
12
8
 
13
9
  /** Base delay for the full-jitter exponential backoff between reconnects. */
@@ -29,7 +25,7 @@ export function streamReconnectDelayMs(attempt: number): number {
29
25
  return Math.max(1, Math.floor(Math.random() * (cappedExponentialMs + 1)));
30
26
  }
31
27
 
32
- export function isTransientPlayStreamError(error: unknown): boolean {
28
+ export function isTransientPlayRunReadError(error: unknown): boolean {
33
29
  if (
34
30
  error instanceof DeeplineError &&
35
31
  error.code === 'PLAY_STREAM_NETWORK_ABORTED'
@@ -37,10 +33,8 @@ export function isTransientPlayStreamError(error: unknown): boolean {
37
33
  return true;
38
34
  }
39
35
  if (error instanceof DeeplineError && typeof error.statusCode === 'number') {
40
- // Server-shaped errors with a definite status code are NOT transient by
41
- // pattern — only network-level failures are. 5xx counts as transient
42
- // since the server may recover, but 4xx (especially 404 = run gone) is
43
- // terminal and should not be hidden behind a silent retry loop.
36
+ // 5xx responses and network-level failures may recover. Client errors,
37
+ // especially 404, stay visible instead of disappearing into a retry loop.
44
38
  return error.statusCode >= 500 && error.statusCode < 600;
45
39
  }
46
40
  const text = error instanceof Error ? error.message : String(error);
@@ -48,3 +42,6 @@ export function isTransientPlayStreamError(error: unknown): boolean {
48
42
  text,
49
43
  );
50
44
  }
45
+
46
+ /** @deprecated Use `isTransientPlayRunReadError`. */
47
+ export const isTransientPlayStreamError = isTransientPlayRunReadError;
@@ -30,9 +30,9 @@ import { stripProvenanceTag } from './log-provenance';
30
30
  * The canonical client-side projection of a persisted Play Run document into
31
31
  * the live snapshot shape, plus the differ that turns successive snapshots
32
32
  * into incremental `play.*` live events. This module is shared between the
33
- * Vercel app (legacy SSE shim, dashboard) and the SDK subscription transport
34
- * (`packages/sdk/src/runs/observe-transport.ts`), so both watchers render identical
35
- * event streams from the same Convex Run Snapshot. See ADR-0008.
33
+ * Vercel app (dashboard and legacy SSE compatibility) and the SDK REST polling
34
+ * watcher (`packages/sdk/src/runs/watch-polling.ts`), so both use the same
35
+ * event projection from the persisted Run Snapshot. See ADR-0008.
36
36
  */
37
37
 
38
38
  export type PlayRunLiveStatus = PlayRunLifecycleStatus;
@@ -551,7 +551,7 @@ function diffLogLines(input: {
551
551
  const missingCount = tailFirstSeq - 1 - input.lastLogSeq;
552
552
  return {
553
553
  lines: [
554
- `[stream] ${missingCount} log lines not retained in the live window; full logs via runs logs`,
554
+ `[watch] ${missingCount} log lines not retained in the live window; full logs via runs logs`,
555
555
  ...logs,
556
556
  ],
557
557
  lastLogSeq: totalLogCount,