@exla/rudder 4.2.8 → 4.2.10

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.
@@ -13,9 +13,10 @@ export declare class TerminalThemeWatcher {
13
13
  constructor(ask: () => void, changed: (colors: TerminalColors) => void);
14
14
  get known(): boolean;
15
15
  /**
16
- * Take color replies and appearance notices out of a chunk of input and
17
- * return the keys that are left. Terminals answer in one write, so a reply
18
- * split across chunks is not stitched; it passes through as keys.
16
+ * Take color replies, appearance notices and any other terminal reply out of
17
+ * a chunk of input and return the keys that are left. AttachSession hands
18
+ * over keys in whole escape sequences, so a reply split across reads arrives
19
+ * here whole.
19
20
  */
20
21
  filter(data: Buffer): Buffer;
21
22
  }
@@ -15,6 +15,12 @@ export const THEME_REPORTS_OFF = "\x1b[?2031l";
15
15
  const COLOR_REPLY = /\x1b\](1[01]);rgb:([0-9a-fA-F]{1,4})\/([0-9a-fA-F]{1,4})\/([0-9a-fA-F]{1,4})(?:\x07|\x1b\\)/g;
16
16
  // The appearance changed (1 dark, 2 light): ask for the colors again.
17
17
  const THEME_CHANGED = /\x1b\[\?997;[12]n/g;
18
+ // Any other reply a terminal can send: `CSI ? ...`, `CSI > ...` and `CSI = ...`
19
+ // (device attributes, mode and keyboard flag reports) and OSC, DCS and APC
20
+ // strings. No key is spelled like these. Nothing on this side asks for them,
21
+ // and the dashboard's parser would hold `CSI ? ... n` until a later key, or
22
+ // type the rest of `CSI > 1;10;0 c` or an OSC into the composer.
23
+ const OTHER_REPLY = /\x1b\[[=>?][0-?]*[ -/]*[@-~]|\x1b[\]P_][^\x07\x1b]*(?:\x07|\x1b\\)/g;
18
24
  function channel(hex) {
19
25
  // Scale 1 to 4 hex digits to 8 bits, as xterm does.
20
26
  const max = (1 << (hex.length * 4)) - 1;
@@ -32,13 +38,14 @@ export class TerminalThemeWatcher {
32
38
  return this.colors.bg !== null;
33
39
  }
34
40
  /**
35
- * Take color replies and appearance notices out of a chunk of input and
36
- * return the keys that are left. Terminals answer in one write, so a reply
37
- * split across chunks is not stitched; it passes through as keys.
41
+ * Take color replies, appearance notices and any other terminal reply out of
42
+ * a chunk of input and return the keys that are left. AttachSession hands
43
+ * over keys in whole escape sequences, so a reply split across reads arrives
44
+ * here whole.
38
45
  */
39
46
  filter(data) {
40
47
  const text = data.toString("latin1");
41
- if (!text.includes("\x1b]1") && !text.includes("\x1b[?997;")) {
48
+ if (!/\x1b(?:[\]P_]|\[[=>?])/.test(text)) {
42
49
  return data;
43
50
  }
44
51
  const next = { ...this.colors };
@@ -50,7 +57,7 @@ export class TerminalThemeWatcher {
50
57
  rest = rest.replace(THEME_CHANGED, () => {
51
58
  reask = true;
52
59
  return "";
53
- });
60
+ }).replace(OTHER_REPLY, "");
54
61
  if (next.fg !== this.colors.fg || next.bg !== this.colors.bg) {
55
62
  this.colors = next;
56
63
  this.changed(next);
@@ -1 +1 @@
1
- {"version":3,"file":"terminal-theme.js","sourceRoot":"","sources":["../src/terminal-theme.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,EAAE;AACF,4EAA4E;AAC5E,6EAA6E;AAC7E,uEAAuE;AACvE,gFAAgF;AAChF,2EAA2E;AAC3E,2EAA2E;AAC3E,2EAA2E;AAI3E,wEAAwE;AACxE,MAAM,CAAC,MAAM,WAAW,GAAG,gCAAgC,CAAC;AAC5D,MAAM,CAAC,MAAM,gBAAgB,GAAG,aAAa,CAAC;AAC9C,MAAM,CAAC,MAAM,iBAAiB,GAAG,aAAa,CAAC;AAE/C,iFAAiF;AACjF,MAAM,WAAW,GAAG,8FAA8F,CAAC;AACnH,sEAAsE;AACtE,MAAM,aAAa,GAAG,oBAAoB,CAAC;AAE3C,SAAS,OAAO,CAAC,GAAW;IAC1B,oDAAoD;IACpD,MAAM,GAAG,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IACxC,OAAO,IAAI,CAAC,KAAK,C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AAC,CAAC,CAAC,IAAI,CAAC,GAAG,IAAI,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC;YAChF,OAAO,EAAE,CAAC;QACZ,CAAC,CAAC,CAAC;QACH,IAAI,KAAK,GAAG,KAAK,CAAC;QAClB,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE,GAAG,EAAE;YACtC,KAAK,GAAG,IAAI,CAAC;YACb,OAAO,EAAE,CAAC;QACZ,CAAC,CAAC,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;QAC5B,IAAI,IAAI,CAAC,EAAE,KAAK,IAAI,CAAC,MAAM,CAAC,EAAE,IAAI,IAAI,CAAC,EAAE,KAAK,IAAI,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC;YAC7D,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;YACnB,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QACrB,CAAC;QACD,IAAI,KAAK,EAAE,CAAC;YACV,IAAI,CAAC,GAAG,EAAE,CAAC;QACb,CAAC;QACD,OAAO,IAAI,CAAC,MAAM,KAAK,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IAC1E,CAAC;CACF"}
package/dist/types.d.ts CHANGED
@@ -261,7 +261,7 @@ export type RunRecord = {
261
261
  turns?: Array<{
262
262
  ts: string;
263
263
  prompt: string;
264
- source: "user" | "steerer" | "regoal";
264
+ source: "user" | "steerer" | "regoal" | "resolver";
265
265
  }>;
266
266
  lastUserInputAt?: string;
267
267
  autoSteer?: {
@@ -2,8 +2,11 @@ export declare const WARM_WORKSPACE_PREFIX = "rudderwarm-";
2
2
  export type WarmSnapshot = {
3
3
  key: string;
4
4
  commit: string;
5
+ /** The snapshot's directory: the whole tree, or the top layer of a stack. */
5
6
  dir: string;
6
7
  builtAt: string;
8
+ /** OverlayFS layers, top first (`dir` first), when the snapshot is stacked. */
9
+ layers?: string[];
7
10
  };
8
11
  export declare function warmDir(repoRoot: string): string;
9
12
  export declare function forkStateDir(workspace: string): string;
@@ -20,11 +23,14 @@ export declare function readySnapshots(repoRoot: string): WarmSnapshot[];
20
23
  /** Commands from rudder.toml `[warm] commands = [...]`, else detected from lockfiles. */
21
24
  export declare function warmCommands(dir: string): string[];
22
25
  /**
23
- * Builds the warm snapshot for `commit` (blocking). Returns it, or null when
24
- * another builder holds the key or the build failed (a failed key is not
25
- * retried; a new base commit gets a new key).
26
+ * Builds the warm snapshot for `commit` (blocking), on top of the nearest
27
+ * ready snapshot when there is one. Returns it (or the ready snapshot with the
28
+ * same files), or null when another builder holds the key or the build failed
29
+ * (a failed key is not retried; a new base commit gets a new key).
26
30
  */
27
- export declare function buildWarmSnapshot(repoRoot: string, commit: string): Promise<WarmSnapshot | null>;
31
+ export declare function buildWarmSnapshot(repoRoot: string, commit: string, options?: {
32
+ maxLayers?: number;
33
+ }): Promise<WarmSnapshot | null>;
28
34
  /**
29
35
  * Incremental warm build: copies the previous snapshot's untracked top-level
30
36
  * entries (dependencies and build outputs such as node_modules, target, .venv)
@@ -39,19 +45,24 @@ export declare function seedFromPrevious(previousDir: string, dir: string): Prom
39
45
  */
40
46
  export declare function warmBuildSkipReason(dir: string, minFree?: number): string | null;
41
47
  /**
42
- * Starts a detached builder for `commit` unless one is ready, failed or
43
- * running. Returns why it did not start one when the disk lacks room.
48
+ * Makes sure the project's builder is following the base: starts the detached
49
+ * builder unless one is running or there is nothing to install or build.
50
+ * Never waits. Returns why it did not start one when the disk lacks room.
44
51
  */
45
- export declare function startWarmBuild(repoRoot: string, commit: string): string | null;
46
- /** Deletes ready snapshots beyond the newest few that no fork still uses. */
47
- export declare function pruneWarmSnapshots(repoRoot: string): Promise<void>;
52
+ export declare function startWarmBuild(repoRoot: string): string | null;
53
+ /**
54
+ * Deletes ready snapshots beyond the newest `keep`, unless a fork or a kept
55
+ * snapshot mounts them: a stacked snapshot keeps every layer under it.
56
+ */
57
+ export declare function pruneWarmSnapshots(repoRoot: string, keep?: number): Promise<void>;
48
58
  /**
49
59
  * Creates `targetPath` as a fork of the warm snapshot nearest its base: an
50
- * overlay fork on Linux, an APFS clone on macOS. A base without its own
51
- * snapshot starts a build for it; when every ready snapshot is far away, the
52
- * launch waits a while for that build. Returns a reason (after cleaning up) when
53
- * there is no snapshot or the fork cannot be made here; the caller then makes
54
- * a full jj checkout.
60
+ * overlay fork on Linux, an APFS clone on macOS. A launch never builds; it
61
+ * makes sure the project's builder runs. When every ready snapshot is far from
62
+ * the base (or there is none yet), a launch from the base waits a while for
63
+ * the builder; a branch launch forks the nearest base snapshot and patches the
64
+ * difference. Returns a reason (after cleaning up) when there is no snapshot
65
+ * or the fork cannot be made here; the caller then makes a full jj checkout.
55
66
  */
56
67
  export declare function createForkWorkspace(params: {
57
68
  repoRoot: string;