pi-keeper 0.1.0 → 0.1.1

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,83 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.1 - 2026-11-18
4
+
5
+ A review of the whole package. Most entries close a way for a call to run without the
6
+ question it should get.
7
+
8
+ ### Security
9
+
10
+ - A single `subagent` call is judged by its `gate`, `acceptance` verify commands and
11
+ `output` file, as workflow children already were. A `schedule.create` of a workflow
12
+ asks.
13
+ - Shell keywords (`for`, `do`, `if`, ...) are never remembered as a command prefix,
14
+ which let any loop body run without a question. A loop gets the exact-command options.
15
+ - A backslash at the end of a line joins the lines as bash does (`su\⏎do id`).
16
+ - Project `deny` and `ask` rules match the command by path or behind a launcher: with
17
+ `Bash(make deploy *)`, `/usr/bin/make deploy` and `exec make deploy` are denied too.
18
+ `Bash(rm:*)` is read as `Bash(rm *)`.
19
+ - More secret reads ask in every mode: `grep -f.env`, `git show HEAD:.env`,
20
+ `ls | xargs cat`, a glob under `~` that matches a secret, and environment dumps
21
+ (`env`, `printenv`, `/proc/*/environ`). Exclude filters (`--exclude=.env`) do not ask.
22
+ - `~user/...`, `~-` and a glob outside the project (`cat /etc/pass*`) count as outside.
23
+ - Auto mode asks before a redirection writes outside the project (`echo x > ~/notes.txt`).
24
+ Writes to the system temp dir ask.
25
+ - `sudo` and dangerous commands are seen through more launchers and shells (`exec`,
26
+ `find -exec`, `pwsh`, `nsenter`). `runuser` is a privilege command. `sudo` after
27
+ `ssh host` asks instead of being denied.
28
+ - Download-and-run is caught behind a wrapper or a path (`curl x | env -i bash`).
29
+ - More commands are never remembered as a prefix (`tsx`, `uvx`, `dotnet`, `psql`, ...).
30
+ `git rebase --exec`, `git submodule foreach` and `git bisect run` are never covered
31
+ by a rule.
32
+ - Smaller: an awk `/` after `x++` hid a pipe to a shell; a restored plan file path must
33
+ be inside the plans directory; with a git repository as home, a subagent's working
34
+ directory is checked against the parent's; `/rules` prints no terminal escape
35
+ sequences; dialogs show zero-width characters as `�`.
36
+
37
+ ### Fixed
38
+
39
+ - `cd` into another repository combined with git asked again and again. The dialog now
40
+ offers *Yes, and allow git in `<repo>/` this session*.
41
+ - The session log redacts more secrets (non-bash tool input, `-u user:pass`, URL
42
+ passwords, token headers).
43
+ - A background ask larger than the mailbox limit made the child wait for the timeout.
44
+ It is now denied at once. Turning background asks off in `/keeper` denies pending
45
+ asks with "background asks were turned off in the parent session".
46
+ - A background ask that an open dialog already covers opens no second dialog.
47
+ - A malformed `trusted-rules.json` is no longer overwritten; pi-keeper warns instead.
48
+ - `/mode constructor` blocked every tool call.
49
+ - *Ignore for this session* on project rules no longer outlives `/new` and `/resume`.
50
+ - A glob with many `*` could freeze pi.
51
+ - `/rules` crashed with "Rendered line N exceeds terminal width" on long text.
52
+ - A command after `!` is matched by your rules like the same command alone.
53
+
54
+ ### Changed
55
+
56
+ - `project-exact-commands` is **on by default**: the dialog for a command no prefix can
57
+ cover offers *Yes, and always allow this exact command in this project*. Not offered
58
+ for removals, privilege commands, program-running flags or writes outside the project.
59
+ - `/keeper` has two tabs: **Settings** and **Subagents**.
60
+ - The mode line after a switch is **off by default**; turn it on in `/keeper` (Dialog)
61
+ or with `modeFlashSecs`.
62
+ - A rulebook file with no frontmatter, or a condition that matches ordinary text, is
63
+ skipped with a warning.
64
+
65
+ ### Added
66
+
67
+ - `BashExact(<command>)` entries in `.pi/settings.local.json` (`allow` only): this exact
68
+ command text runs without a question in default mode. The project option saves one
69
+ when the command cannot be written as `Bash(...)`, such as a `for` loop.
70
+ `/permissions` lists them as "(exact text)".
71
+ - *Yes, and allow git in `<repo>/` this session*: after `cd` into another repository,
72
+ git there runs without the question (dangerous git commands still ask). Session only,
73
+ shared with subagents, removable in `/permissions`.
74
+ - `/keeper mode-working-row` (`modeWorkingRow`, default off): the mode in the working
75
+ row (`⏵⏵ auto · Working`).
76
+ - `/keeper mode-status` (`modeStatus`, default on): off hides the mode in the footer.
77
+ - `example-rule.md`, a dummy rule that never fires, is created in
78
+ `~/.pi/agent/pi-keeper/rules/` when it holds no rule file.
79
+ - `/new-rule <what must not happen>`: the model writes a rule file and tests its regex.
80
+
3
81
  ## 0.1.0 - 2026-11-17
4
82
 
5
83
  First public release.
@@ -59,11 +59,11 @@ const BAD_KEYS: readonly string[] = ["__proto__", "constructor", "prototype"];
59
59
 
60
60
  export type ChildMode = "default" | "auto" | "plan";
61
61
  export type ReplyDecision = "allow" | "deny" | "cancelled";
62
- export type ReplyReason = "parent-session-ended" | "timeout" | "user" | "rules" | "no-ui";
62
+ export type ReplyReason = "parent-session-ended" | "asks-turned-off" | "timeout" | "user" | "rules" | "no-ui";
63
63
 
64
64
  const MODES: readonly string[] = ["default", "auto", "plan"];
65
65
  const DECISIONS: readonly string[] = ["allow", "deny", "cancelled"];
66
- const REASONS: readonly string[] = ["parent-session-ended", "timeout", "user", "rules", "no-ui"];
66
+ const REASONS: readonly string[] = ["parent-session-ended", "asks-turned-off", "timeout", "user", "rules", "no-ui"];
67
67
 
68
68
  const ID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
69
69
  const TOOL_NAME = /^[A-Za-z0-9_.:-]{1,64}$/;
@@ -253,12 +253,30 @@ function isFile(file: string): boolean {
253
253
 
254
254
  // --- child side ---------------------------------------------------------
255
255
 
256
+ /** Thrown by writeRequest for a request the parent would drop unread: over MAX_BYTES, or over the key budget. */
257
+ export class RequestTooLargeError extends Error {
258
+ readonly code = "request-too-large";
259
+
260
+ constructor() {
261
+ super("request too large to send to the parent");
262
+ this.name = "RequestTooLargeError";
263
+ }
264
+ }
265
+
256
266
  /** Child: file a request. Validated first; throws on an invalid one or an unusable dir. */
257
267
  export function writeRequest(dir: string, request: AskRequest, options: MailboxOptions = {}): void {
258
- if (parseRequest(request) === undefined) throw new Error("invalid ask request");
268
+ const text = JSON.stringify(request);
269
+ // the parent's reader counts bytes, not UTF-16 units: a request of CJK text is three bytes a character
270
+ if (Buffer.byteLength(text, "utf8") > MAX_BYTES) throw new RequestTooLargeError();
271
+ if (parseRequest(request) === undefined) {
272
+ const budget = { keys: 0 };
273
+ isPlainJson((request as { call?: { input?: unknown } }).call?.input, 0, budget);
274
+ if (budget.keys > MAX_KEYS) throw new RequestTooLargeError();
275
+ throw new Error("invalid ask request");
276
+ }
259
277
  ensureAskDir(dir, options);
260
278
  remove(replyFile(dir, request.id)); // never accept a reply that predates this request
261
- writeFileAtomic(requestFile(dir, request.id), JSON.stringify(request));
279
+ writeFileAtomic(requestFile(dir, request.id), text);
262
280
  }
263
281
 
264
282
  /**
@@ -112,7 +112,7 @@ export interface Verdict {
112
112
  matcher: string | null;
113
113
  }
114
114
 
115
- type EventKind = "auto-allow" | "auto-deny" | "no-ui" | "cancelled" | "timeout" | "parent-gone" | "dropped" | "clamped";
115
+ type EventKind = "auto-allow" | "auto-deny" | "no-ui" | "cancelled" | "timeout" | "parent-gone" | "asks-off" | "dropped" | "clamped";
116
116
 
117
117
  /** What happened to a request without a dialog of its own (a dialog's answer is logged where it is shown). */
118
118
  export interface ServerEvent {
@@ -162,8 +162,11 @@ export interface AskServer {
162
162
  openNow(): number;
163
163
  /** Requests held (queued or on screen). */
164
164
  pending(): number;
165
- /** The session is ending: deny everything pending, close its dialogs, stop polling. */
166
- stop(): void;
165
+ /**
166
+ * The session is ending (or background asks were turned off): deny everything pending with `reason`,
167
+ * close its dialogs, stop polling. Files left for children that are gone are removed.
168
+ */
169
+ stop(reason?: "parent-session-ended" | "asks-turned-off"): void;
167
170
  }
168
171
 
169
172
  type Why = "cancel" | "timeout" | "dropped" | "ended";
@@ -198,6 +201,8 @@ export function startAskServer(options: AskServerOptions): AskServer {
198
201
  let stopped = false;
199
202
  let shownBadge = 0;
200
203
  const warned = new Set<string>();
204
+ /** Requests this server claimed: id -> the child's pid. Their reply and .taken files are this server's to clean up. */
205
+ const claimedBy = new Map<string, number>();
201
206
  let lastBeat = Number.NEGATIVE_INFINITY;
202
207
 
203
208
  /** Keep the "listening" note fresh (throttled); a mailbox that cannot be written just leaves it stale. */
@@ -263,6 +268,7 @@ export function startAskServer(options: AskServerOptions): AskServer {
263
268
  }
264
269
 
265
270
  function enqueue(request: AskRequest): void {
271
+ claimedBy.set(request.id, request.childPid);
266
272
  const entry: Entry = { request, receivedAt: now() };
267
273
  if (queue.length >= MAX_QUEUE) {
268
274
  reply(entry, "deny", "rules");
@@ -418,7 +424,7 @@ export function startAskServer(options: AskServerOptions): AskServer {
418
424
  return waiting;
419
425
  },
420
426
  pending: () => queue.length,
421
- stop() {
427
+ stop(reason = "parent-session-ended") {
422
428
  if (stopped) return;
423
429
  // one last look, so a request that just arrived is denied too and not left waiting
424
430
  try {
@@ -433,9 +439,12 @@ export function startAskServer(options: AskServerOptions): AskServer {
433
439
  for (const entry of [...queue]) {
434
440
  if (!held.has(entry.request.id)) continue;
435
441
  entry.why = "ended";
436
- reply(entry, "deny", "parent-session-ended");
437
- emit("parent-gone", entry);
442
+ reply(entry, "deny", reason);
443
+ emit(reason === "asks-turned-off" ? "asks-off" : "parent-gone", entry);
438
444
  }
445
+ // a child that is still running reads its reply and removes its own files; the rest would stay forever
446
+ for (const [id, pid] of claimedBy) if (!alive(pid)) cleanup(dir, id);
447
+ claimedBy.clear();
439
448
  for (const entry of queue) entry.controller?.abort();
440
449
  queue.length = 0;
441
450
  open = undefined;
@@ -69,8 +69,10 @@ export function childCwdProblem(childCwd: string, parentCwd: string | undefined,
69
69
  }
70
70
  const parent = real(parentCwd);
71
71
  const parentRoot = real(findProjectRoot(parent));
72
- if (inside(cwd, parent) || inside(cwd, parentRoot)) return undefined;
72
+ // a repository at or above the home directory (a dotfiles repo in $HOME) is no project: it would accept all of home
73
+ const projectRoot = parentRoot === sep || parentRoot === realHome || inside(realHome, parentRoot) ? undefined : parentRoot;
74
+ if (inside(cwd, parent) || (projectRoot !== undefined && inside(cwd, projectRoot))) return undefined;
73
75
  const gitDir = worktreeGitDir(cwd);
74
- if (gitDir !== undefined && inside(gitDir, join(parentRoot, ".git", "worktrees"))) return undefined;
76
+ if (gitDir !== undefined && projectRoot !== undefined && inside(gitDir, join(projectRoot, ".git", "worktrees"))) return undefined;
75
77
  return `your working directory ${cwd} is outside the parent session's project (${parentRoot})`;
76
78
  }
@@ -18,9 +18,10 @@
18
18
  * `subagentsFollowAuto` (default false) lets subagents of an auto-mode parent run in
19
19
  * auto mode too, as long as their permission asks can reach the user; `/keeper`
20
20
  * toggles it and saves it here.
21
- * `projectExactCommands` (default false) adds "Yes, and always allow this exact
21
+ * `projectExactCommands` (default true) adds "Yes, and always allow this exact
22
22
  * command in this project" to the approval dialog for commands no prefix
23
- * can cover, saved to the project's .pi/settings.local.json; `/keeper` toggles it and saves it here.
23
+ * can cover, saved to the project's .pi/settings.local.json (as a token rule when the
24
+ * command can be written as one, else as the exact text `BashExact(...)`); `/keeper` toggles it and saves it here.
24
25
  * `backgroundAutoFallback` (default false) lets children whose asks cannot reach a
25
26
  * user (background asks off, or a parent without a UI, which writes no
26
27
  * heartbeat so its children fall back at launch) run in auto mode
@@ -40,7 +41,10 @@
40
41
  * "prompt" is the old behaviour of appending them to the system prompt, for
41
42
  * small local models that follow prompt rules better. Written by
42
43
  * hand only — `/keeper` has no entry for it yet.
43
- * `modeFlashSecs` (default 2; 0 turns it off, otherwise 0.1 to 10) is how long the
44
+ * `modeStatus` (default true) shows the mode in the footer status line; false hides it.
45
+ * `modeWorkingRow` (default false) shows it in the working row too (`⏵⏵ auto · Working`,
46
+ * plan and auto mode only). Both are set by the `/keeper` panel or by hand.
47
+ * `modeFlashSecs` (default 0, which is off; otherwise 0.1 to 10) is how long the
44
48
  * mode (icon and badge, in the mode's color) shows above the prompt after a real
45
49
  * switch; it adds no permanent row. Set by the `/keeper` panel (off, 1, 2, 3 or 5 s) or by hand.
46
50
  * `backgroundAskPopup` (default "always") says when a permission ask from a
@@ -88,7 +92,7 @@ export const MIN_BACKGROUND_ASK_TIMEOUT_MS = 10_000;
88
92
  export const MAX_BACKGROUND_ASK_TIMEOUT_MS = 30 * 60_000;
89
93
 
90
94
  /** How long the mode line stays above the prompt after a switch: default and bounds (seconds); 0 turns it off. */
91
- export const DEFAULT_MODE_FLASH_SECS = 2;
95
+ export const DEFAULT_MODE_FLASH_SECS = 0;
92
96
  export const MIN_MODE_FLASH_SECS = 0.1;
93
97
  export const MAX_MODE_FLASH_SECS = 10;
94
98
 
@@ -139,7 +143,7 @@ export interface KeeperConfig {
139
143
  readOnlyTools: ReadonlySet<string>;
140
144
  /** Subagents of an auto-mode parent run in auto mode too, while their asks can reach the user (the `/keeper` setting). Default false. */
141
145
  subagentsFollowAuto: boolean;
142
- /** Exact-command dialogs offer a persistent project rule (the `/keeper` setting). Default false. */
146
+ /** Exact-command dialogs offer a persistent project rule (the `/keeper` setting). Default true. */
143
147
  projectExactCommands: boolean;
144
148
  /** Relay-less (background) children run in auto mode instead of being denied (the `/keeper` setting). Default false. */
145
149
  backgroundAutoFallback: boolean;
@@ -149,8 +153,12 @@ export interface KeeperConfig {
149
153
  ccExtensionsPrompt: boolean;
150
154
  /** Where the mode rules go: a message in the conversation, or (old behaviour) the system prompt. */
151
155
  modeInstructions: "message" | "prompt";
152
- /** Seconds the mode line shows above the prompt after a switch; 0 = off (also hides the mode in the working row). Default 2. */
156
+ /** Seconds the mode line shows above the prompt after a switch; 0 = off. Default 0 (off): it is intrusive. */
153
157
  modeFlashSecs: number;
158
+ /** The mode in the footer status line. Default true; false hides it. */
159
+ modeStatus: boolean;
160
+ /** The mode in the working row (`<mode> · Working`) in plan and auto mode. Default false: the footer already shows it. */
161
+ modeWorkingRow: boolean;
154
162
  /** Outside-read dialogs offer "always allow reading from <dir>/ in this project" (the `/keeper` setting). Default false: read grants stay session-only. */
155
163
  projectReadApprovals: boolean;
156
164
  /** Background subagents' asks reach this session's user instead of being denied (the `/keeper` setting). Default true. */
@@ -199,15 +207,15 @@ export function parseConfig(text: string): KeeperConfig {
199
207
  const rawAuto = (value as { subagentsFollowAuto?: unknown }).subagentsFollowAuto;
200
208
  if (typeof rawAuto === "boolean") subagentsFollowAuto = rawAuto;
201
209
  else if (rawAuto !== undefined) warnings.push("subagentsFollowAuto must be true or false; using false");
202
- let projectExactCommands = false;
210
+ let projectExactCommands = true;
203
211
  const rawExact = (value as { projectExactCommands?: unknown }).projectExactCommands;
204
212
  if (typeof rawExact === "boolean") projectExactCommands = rawExact;
205
- else if (rawExact !== undefined) warnings.push("projectExactCommands must be true or false; using false");
213
+ else if (rawExact !== undefined) warnings.push("projectExactCommands must be true or false; using true");
206
214
  let backgroundAutoFallback = false;
207
215
  const rawHeadless = (value as { backgroundAutoFallback?: unknown }).backgroundAutoFallback;
208
216
  if (typeof rawHeadless === "boolean") backgroundAutoFallback = rawHeadless;
209
217
  else if (rawHeadless !== undefined) warnings.push("backgroundAutoFallback must be true or false; using false");
210
- const flag = (key: "projectCommandApprovals" | "projectReadApprovals" | "backgroundAsks" | "ccExtensionsPrompt", fallbackValue: boolean): boolean => {
218
+ const flag = (key: "projectCommandApprovals" | "projectReadApprovals" | "backgroundAsks" | "ccExtensionsPrompt" | "modeStatus" | "modeWorkingRow", fallbackValue: boolean): boolean => {
211
219
  const raw = (value as Record<string, unknown>)[key];
212
220
  if (typeof raw === "boolean") return raw;
213
221
  if (raw !== undefined) warnings.push(`${key} must be true or false; using ${fallbackValue}`);
@@ -216,6 +224,8 @@ export function parseConfig(text: string): KeeperConfig {
216
224
  const projectCommandApprovals = flag("projectCommandApprovals", true);
217
225
  const projectReadApprovals = flag("projectReadApprovals", false);
218
226
  const ccExtensionsPrompt = flag("ccExtensionsPrompt", true);
227
+ const modeStatus = flag("modeStatus", true);
228
+ const modeWorkingRow = flag("modeWorkingRow", false);
219
229
  let modeInstructions: "message" | "prompt" = "message";
220
230
  const rawInstructions = (value as { modeInstructions?: unknown }).modeInstructions;
221
231
  if (rawInstructions === "prompt") modeInstructions = "prompt";
@@ -246,11 +256,11 @@ export function parseConfig(text: string): KeeperConfig {
246
256
  if (backgroundAskTimeoutMs !== rawTimeout) warnings.push(`backgroundAskTimeoutMs must be between ${MIN_BACKGROUND_ASK_TIMEOUT_MS} and ${MAX_BACKGROUND_ASK_TIMEOUT_MS}; using ${backgroundAskTimeoutMs}`);
247
257
  } else if (rawTimeout !== undefined) warnings.push(`backgroundAskTimeoutMs must be a number of milliseconds; using ${DEFAULT_BACKGROUND_ASK_TIMEOUT_MS}`);
248
258
  // readOnlyTools absent or unusable: the defaults; a valid list (empty included) replaces them
249
- return { readOnlyTools: Array.isArray(listed) ? names : new Set(DEFAULT_READ_ONLY_TOOLS), subagentsFollowAuto, projectExactCommands, backgroundAutoFallback, projectCommandApprovals, projectReadApprovals, ccExtensionsPrompt, modeInstructions, modeFlashSecs, backgroundAsks, backgroundAskTimeoutMs, backgroundAskPopup, subagentThinking, commandColors, warnings };
259
+ return { readOnlyTools: Array.isArray(listed) ? names : new Set(DEFAULT_READ_ONLY_TOOLS), subagentsFollowAuto, projectExactCommands, backgroundAutoFallback, projectCommandApprovals, projectReadApprovals, ccExtensionsPrompt, modeInstructions, modeFlashSecs, modeStatus, modeWorkingRow, backgroundAsks, backgroundAskTimeoutMs, backgroundAskPopup, subagentThinking, commandColors, warnings };
250
260
  }
251
261
 
252
262
  function fallback(warnings: string[]): KeeperConfig {
253
- return { readOnlyTools: new Set(DEFAULT_READ_ONLY_TOOLS), subagentsFollowAuto: false, projectExactCommands: false, backgroundAutoFallback: false, projectCommandApprovals: true, projectReadApprovals: false, ccExtensionsPrompt: true, modeInstructions: "message", modeFlashSecs: DEFAULT_MODE_FLASH_SECS, backgroundAsks: true, backgroundAskTimeoutMs: DEFAULT_BACKGROUND_ASK_TIMEOUT_MS, backgroundAskPopup: "always",subagentThinking: "follow", commandColors: undefined, warnings };
263
+ return { readOnlyTools: new Set(DEFAULT_READ_ONLY_TOOLS), subagentsFollowAuto: false, projectExactCommands: true, backgroundAutoFallback: false, projectCommandApprovals: true, projectReadApprovals: false, ccExtensionsPrompt: true, modeInstructions: "message", modeFlashSecs: DEFAULT_MODE_FLASH_SECS, modeStatus: true, modeWorkingRow: false, backgroundAsks: true, backgroundAskTimeoutMs: DEFAULT_BACKGROUND_ASK_TIMEOUT_MS, backgroundAskPopup: "always",subagentThinking: "follow", commandColors: undefined, warnings };
254
264
  }
255
265
 
256
266
  /** Background asks are on in this process: the setting, and the env kill switch not set to "0". */
@@ -276,7 +286,7 @@ export function loadConfig(agentDir: string): KeeperConfig {
276
286
  * temp file in the same directory, then rename), so a crash mid-write leaves
277
287
  * the old file. Returns a warning instead of throwing on any problem.
278
288
  */
279
- export function saveConfig(agentDir: string, update: { subagentsFollowAuto?: boolean; projectExactCommands?: boolean; backgroundAutoFallback?: boolean; backgroundAsks?: boolean; projectCommandApprovals?: boolean; projectReadApprovals?: boolean; ccExtensionsPrompt?: boolean; backgroundAskPopup?: BackgroundAskPopup; backgroundAskTimeoutMs?: number; subagentThinking?: SubagentThinkingMode; commandColors?: PreviewTextColor; modeFlashSecs?: number }): string | undefined {
289
+ export function saveConfig(agentDir: string, update: { subagentsFollowAuto?: boolean; projectExactCommands?: boolean; backgroundAutoFallback?: boolean; backgroundAsks?: boolean; projectCommandApprovals?: boolean; projectReadApprovals?: boolean; ccExtensionsPrompt?: boolean; backgroundAskPopup?: BackgroundAskPopup; backgroundAskTimeoutMs?: number; subagentThinking?: SubagentThinkingMode; commandColors?: PreviewTextColor; modeFlashSecs?: number; modeStatus?: boolean; modeWorkingRow?: boolean }): string | undefined {
280
290
  const file = join(agentDir, CONFIG_FILE);
281
291
  let value: Record<string, unknown>;
282
292
  try {
@@ -311,6 +321,8 @@ export function saveConfig(agentDir: string, update: { subagentsFollowAuto?: boo
311
321
  if (update.subagentThinking !== undefined) value.subagentThinking = update.subagentThinking;
312
322
  if (update.commandColors !== undefined) value.commandColors = update.commandColors;
313
323
  if (update.modeFlashSecs !== undefined) value.modeFlashSecs = update.modeFlashSecs;
324
+ if (update.modeStatus !== undefined) value.modeStatus = update.modeStatus;
325
+ if (update.modeWorkingRow !== undefined) value.modeWorkingRow = update.modeWorkingRow;
314
326
  const temp = `${file}.tmp-${process.pid}-${Date.now()}`;
315
327
  try {
316
328
  writeFileSync(temp, `${JSON.stringify(value, null, "\t")}\n`);