@lousy-agents/cli 5.23.8 → 5.23.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.
@@ -10,7 +10,7 @@
10
10
  },
11
11
  "ghcr.io/devcontainers/features/copilot-cli:1.0.0": {},
12
12
  "ghcr.io/anthropics/devcontainer-features/claude-code:1": {
13
- "version": "v2.1.325"
13
+ "version": "v2.1.326"
14
14
  },
15
15
  "ghcr.io/rocker-org/devcontainer-features/apt-packages:1.0.2": {
16
16
  "packages": "yamllint, shellcheck",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "root": true,
3
- "$schema": "https://biomejs.dev/schemas/2.6.7/schema.json",
3
+ "$schema": "https://biomejs.dev/schemas/2.6.8/schema.json",
4
4
  "vcs": {
5
5
  "enabled": true,
6
6
  "clientKind": "git",
@@ -9,7 +9,7 @@
9
9
  "version": "0.1.0",
10
10
  "dependencies": {
11
11
  "@fastify/cors": "11.4.3",
12
- "@fastify/sensible": "6.0.7",
12
+ "@fastify/sensible": "6.0.8",
13
13
  "fastify": "5.12.8",
14
14
  "kysely": "0.29.9",
15
15
  "pino": "10.4.0",
@@ -17,8 +17,8 @@
17
17
  "zod": "4.6.7"
18
18
  },
19
19
  "devDependencies": {
20
- "@biomejs/biome": "2.6.7",
21
- "@lousy-agents/mcp": "5.23.7",
20
+ "@biomejs/biome": "2.6.8",
21
+ "@lousy-agents/mcp": "5.23.9",
22
22
  "@modelcontextprotocol/server-sequential-thinking": "2026.8.31",
23
23
  "@testcontainers/postgresql": "12.2.1",
24
24
  "@types/node": "26.6.6",
@@ -37,9 +37,9 @@
37
37
  "license": "Apache-2.0"
38
38
  },
39
39
  "node_modules/@biomejs/biome": {
40
- "version": "2.6.7",
41
- "resolved": "https://registry.npmjs.org/@biomejs/biome/-/biome-2.6.7.tgz",
42
- "integrity": "sha512-2bT1FE6FvZZgPLFw4BjcDyRwG8Ry9zYla4X+Lw8oj2SxvqiXHiYkkEpjcrsWQrik6iYHygAa/D67YxLbVz9P1Q==",
40
+ "version": "2.6.8",
41
+ "resolved": "https://registry.npmjs.org/@biomejs/biome/-/biome-2.6.8.tgz",
42
+ "integrity": "sha512-kqZUFvX6/aYQOmzfRN5ANcfNS9wLH4aHLWWP/dQKyhRZVoA6rdWszA7DGugFcxPbMiznUyVYyukVl+ExZN4PQA==",
43
43
  "dev": true,
44
44
  "license": "MIT OR Apache-2.0",
45
45
  "bin": {
@@ -53,22 +53,22 @@
53
53
  "url": "https://opencollective.com/biome"
54
54
  },
55
55
  "optionalDependencies": {
56
- "@biomejs/cli-android-arm64": "2.6.7",
57
- "@biomejs/cli-android-x64": "2.6.7",
58
- "@biomejs/cli-darwin-arm64": "2.6.7",
59
- "@biomejs/cli-darwin-x64": "2.6.7",
60
- "@biomejs/cli-linux-arm64": "2.6.7",
61
- "@biomejs/cli-linux-arm64-musl": "2.6.7",
62
- "@biomejs/cli-linux-x64": "2.6.7",
63
- "@biomejs/cli-linux-x64-musl": "2.6.7",
64
- "@biomejs/cli-win32-arm64": "2.6.7",
65
- "@biomejs/cli-win32-x64": "2.6.7"
56
+ "@biomejs/cli-android-arm64": "2.6.8",
57
+ "@biomejs/cli-android-x64": "2.6.8",
58
+ "@biomejs/cli-darwin-arm64": "2.6.8",
59
+ "@biomejs/cli-darwin-x64": "2.6.8",
60
+ "@biomejs/cli-linux-arm64": "2.6.8",
61
+ "@biomejs/cli-linux-arm64-musl": "2.6.8",
62
+ "@biomejs/cli-linux-x64": "2.6.8",
63
+ "@biomejs/cli-linux-x64-musl": "2.6.8",
64
+ "@biomejs/cli-win32-arm64": "2.6.8",
65
+ "@biomejs/cli-win32-x64": "2.6.8"
66
66
  }
67
67
  },
68
68
  "node_modules/@biomejs/cli-android-arm64": {
69
- "version": "2.6.7",
70
- "resolved": "https://registry.npmjs.org/@biomejs/cli-android-arm64/-/cli-android-arm64-2.6.7.tgz",
71
- "integrity": "sha512-f4fyRTl+rW6QZp+iHdZrKAKptG/xmIDijTnxWhpC1Hnzr8yvjaBm/aJ98JiMv5mMx7jL1MOu4+zwmQUzfcoKBg==",
69
+ "version": "2.6.8",
70
+ "resolved": "https://registry.npmjs.org/@biomejs/cli-android-arm64/-/cli-android-arm64-2.6.8.tgz",
71
+ "integrity": "sha512-X4JKPLK85kfUTwuuaORFplnBfGjKkp62PsFhhcL7F/Tpltc7pyUofjlkkMnlZZLWsifFl7LNB8ngVrwJg1uo1Q==",
72
72
  "cpu": [
73
73
  "arm64"
74
74
  ],
@@ -83,9 +83,9 @@
83
83
  }
84
84
  },
85
85
  "node_modules/@biomejs/cli-android-x64": {
86
- "version": "2.6.7",
87
- "resolved": "https://registry.npmjs.org/@biomejs/cli-android-x64/-/cli-android-x64-2.6.7.tgz",
88
- "integrity": "sha512-eUdeN+mh2bwen+By1feKzpFkFGAfLG3Pxi6tbwpzMvePBwFGMd4mnE6gaxDRMiWJ1eMuc+Xhtg3ErbLLbtL5wQ==",
86
+ "version": "2.6.8",
87
+ "resolved": "https://registry.npmjs.org/@biomejs/cli-android-x64/-/cli-android-x64-2.6.8.tgz",
88
+ "integrity": "sha512-C3Hk485vl+deEj53K08+SYYelPIPkdSZL3qHuD31Xi+qydVa4q2ze+aCYo1k3iJGWtvWtjHaGkDh7S2sX6wk8w==",
89
89
  "cpu": [
90
90
  "x64"
91
91
  ],
@@ -100,9 +100,9 @@
100
100
  }
101
101
  },
102
102
  "node_modules/@biomejs/cli-darwin-arm64": {
103
- "version": "2.6.7",
104
- "resolved": "https://registry.npmjs.org/@biomejs/cli-darwin-arm64/-/cli-darwin-arm64-2.6.7.tgz",
105
- "integrity": "sha512-GewLcsnCsVblgnWYw5QRz5ydy9xphCtlFP37TpLKarezqwZMrH2qxrYblhY6DPOir4gnKyaqDnS/xZWIGVjaKw==",
103
+ "version": "2.6.8",
104
+ "resolved": "https://registry.npmjs.org/@biomejs/cli-darwin-arm64/-/cli-darwin-arm64-2.6.8.tgz",
105
+ "integrity": "sha512-DHyj+JnRHcn4YdvpiqgTFZMYKSPELMCfFpNNlEuu1L8DKTGXhzW7raIwdsbo2Ie9nCljQLAQkVWQk/mwM0ueiA==",
106
106
  "cpu": [
107
107
  "arm64"
108
108
  ],
@@ -117,9 +117,9 @@
117
117
  }
118
118
  },
119
119
  "node_modules/@biomejs/cli-darwin-x64": {
120
- "version": "2.6.7",
121
- "resolved": "https://registry.npmjs.org/@biomejs/cli-darwin-x64/-/cli-darwin-x64-2.6.7.tgz",
122
- "integrity": "sha512-AMPl+Q+bHjRcNUBn8gwBl+dJAnKRUWGZ7ZiJo2U8tQtdpqJ32OqvIg4cwTH+xv0jrcNVkUSE69nj57zsHZ1WBA==",
120
+ "version": "2.6.8",
121
+ "resolved": "https://registry.npmjs.org/@biomejs/cli-darwin-x64/-/cli-darwin-x64-2.6.8.tgz",
122
+ "integrity": "sha512-QWWUPjlA0RnkkgYnFLUHZu+RrDc0FdK0A+wEPA+dENQJwsuSHMH89lspnAw2QUWWc9VHyfluGx1Xmp6Y2GZi8Q==",
123
123
  "cpu": [
124
124
  "x64"
125
125
  ],
@@ -134,9 +134,9 @@
134
134
  }
135
135
  },
136
136
  "node_modules/@biomejs/cli-linux-arm64": {
137
- "version": "2.6.7",
138
- "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-arm64/-/cli-linux-arm64-2.6.7.tgz",
139
- "integrity": "sha512-Qa2edxQClKn17y1ASWkOOuT96K2si1nTLiPbXMOMilNJ79eNsa1as1kaSbgxOXy1kRUENw76sp4pAddneq3l8Q==",
137
+ "version": "2.6.8",
138
+ "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-arm64/-/cli-linux-arm64-2.6.8.tgz",
139
+ "integrity": "sha512-0Bjim8lKwnrvXUHoI4k3Tb51BjoiLEwDnovCI8nSzkk6wj3dShiuAjrx6+X0Hjf4ejR1sRZgTQiSDHlpy9vB7w==",
140
140
  "cpu": [
141
141
  "arm64"
142
142
  ],
@@ -154,9 +154,9 @@
154
154
  }
155
155
  },
156
156
  "node_modules/@biomejs/cli-linux-arm64-musl": {
157
- "version": "2.6.7",
158
- "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-arm64-musl/-/cli-linux-arm64-musl-2.6.7.tgz",
159
- "integrity": "sha512-BIA7qVO1O15D2wVKxLTcvEWszgOqJVZRUhlksg1KQ9N0VtYCbvknV1vyjFiSrzuBT57+z59gbzhYQCinw9lRSQ==",
157
+ "version": "2.6.8",
158
+ "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-arm64-musl/-/cli-linux-arm64-musl-2.6.8.tgz",
159
+ "integrity": "sha512-WB9PhOitX+bRc0G3+GNJGlvbKoWn3JoB9z4E04JQizIC9aPCQyIvwvWG7QZHxw6k20Fi+dHLmZ2fSEmBa9HqiA==",
160
160
  "cpu": [
161
161
  "arm64"
162
162
  ],
@@ -174,9 +174,9 @@
174
174
  }
175
175
  },
176
176
  "node_modules/@biomejs/cli-linux-x64": {
177
- "version": "2.6.7",
178
- "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-x64/-/cli-linux-x64-2.6.7.tgz",
179
- "integrity": "sha512-VpHQ33CPNYrlIn0vyDdRS1KUlS3AiM17FiyEE2gwU000NwzyY4MgjzVHEv2KrmMb5D9Ksm3gFkwg+IOx/ULJNQ==",
177
+ "version": "2.6.8",
178
+ "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-x64/-/cli-linux-x64-2.6.8.tgz",
179
+ "integrity": "sha512-XIk3pLQT56I6Tti+u0DF8FtSNXjCMTPbxVTzfJ9cS2t1ImVKvrqV5b52GuEaJg6/wuiXvz0sjfb5saB4TPRjzA==",
180
180
  "cpu": [
181
181
  "x64"
182
182
  ],
@@ -194,9 +194,9 @@
194
194
  }
195
195
  },
196
196
  "node_modules/@biomejs/cli-linux-x64-musl": {
197
- "version": "2.6.7",
198
- "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-x64-musl/-/cli-linux-x64-musl-2.6.7.tgz",
199
- "integrity": "sha512-+AOQyCsPR4nH5L4Hjzp8T0iaHm4UxY3unjL/KUJKc/8ziLnbkbmL3adtWmQW5ERB1zi6LRA1fsjaSuf/xGnLaQ==",
197
+ "version": "2.6.8",
198
+ "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-x64-musl/-/cli-linux-x64-musl-2.6.8.tgz",
199
+ "integrity": "sha512-64Yzo+J4fEk7Kf9SMnVdVxC+Y2A2e/L86QTP9JjGQ57lsddyELLpbBcNMxSJggre2T1AvISwwSrOApkBAHDqNA==",
200
200
  "cpu": [
201
201
  "x64"
202
202
  ],
@@ -214,9 +214,9 @@
214
214
  }
215
215
  },
216
216
  "node_modules/@biomejs/cli-win32-arm64": {
217
- "version": "2.6.7",
218
- "resolved": "https://registry.npmjs.org/@biomejs/cli-win32-arm64/-/cli-win32-arm64-2.6.7.tgz",
219
- "integrity": "sha512-2nLivZfgcGMIXP/bI8w1FZP5JE2MetP+XZInyMQ7SvJBKlDoGrm/nRjN7uUi9dOaaSlpbRWkHSfb7PqcQR3nXg==",
217
+ "version": "2.6.8",
218
+ "resolved": "https://registry.npmjs.org/@biomejs/cli-win32-arm64/-/cli-win32-arm64-2.6.8.tgz",
219
+ "integrity": "sha512-ezjCEZzHIWE2pdh83a7zLVcAAcDaERcTcvfA7uWlxqz/1CuDxgtfO19pDg9B6YY4wKYIDvYBw2QCMnqIshSwmw==",
220
220
  "cpu": [
221
221
  "arm64"
222
222
  ],
@@ -231,9 +231,9 @@
231
231
  }
232
232
  },
233
233
  "node_modules/@biomejs/cli-win32-x64": {
234
- "version": "2.6.7",
235
- "resolved": "https://registry.npmjs.org/@biomejs/cli-win32-x64/-/cli-win32-x64-2.6.7.tgz",
236
- "integrity": "sha512-uYfH+n+IAtVz3lh7m6JxdjxfJ3WCvAJDE3spHIUbU955V42oKymlhiQiu92fAhXZb7KOjvRcrfImySQbc1MFFg==",
234
+ "version": "2.6.8",
235
+ "resolved": "https://registry.npmjs.org/@biomejs/cli-win32-x64/-/cli-win32-x64-2.6.8.tgz",
236
+ "integrity": "sha512-cD6HvGczZUiAYsY8s2TxxXj2AHFzEdMomvVJfEjzOjBM45nGqIDfBpbtvwGQzDCN8X2yKKk9u1jnDZisT2nxIg==",
237
237
  "cpu": [
238
238
  "x64"
239
239
  ],
@@ -853,9 +853,9 @@
853
853
  }
854
854
  },
855
855
  "node_modules/@fastify/sensible": {
856
- "version": "6.0.7",
857
- "resolved": "https://registry.npmjs.org/@fastify/sensible/-/sensible-6.0.7.tgz",
858
- "integrity": "sha512-e4+bJEcAPGdKsIljulWtEKeECuYGLkVTB1dgWh19m2u4ttETS/5EWZhw6KPXlgi6ZiSet5IqYrcMRMrRub0Hrg==",
856
+ "version": "6.0.8",
857
+ "resolved": "https://registry.npmjs.org/@fastify/sensible/-/sensible-6.0.8.tgz",
858
+ "integrity": "sha512-hc/q+esn+I0djWva/zplEOplZ8SECJBQ0Dx1/qUeOwITR+PTPcuLHNhgJf0fhZ+82Z6En5YhpQxqwIYXWIzerw==",
859
859
  "funding": [
860
860
  {
861
861
  "type": "github",
@@ -1010,9 +1010,9 @@
1010
1010
  }
1011
1011
  },
1012
1012
  "node_modules/@lousy-agents/mcp": {
1013
- "version": "5.23.7",
1014
- "resolved": "https://registry.npmjs.org/@lousy-agents/mcp/-/mcp-5.23.7.tgz",
1015
- "integrity": "sha512-1GXDSNoRMomFd/8bZ3cqeV3FtpzzeOF6avWhcDPQUYbXTiX/Nf3zAcKkbcr4GQz//zLNB1Giy5gIigEoCVlmkA==",
1013
+ "version": "5.23.9",
1014
+ "resolved": "https://registry.npmjs.org/@lousy-agents/mcp/-/mcp-5.23.9.tgz",
1015
+ "integrity": "sha512-ZbrnLwgIt3QuHWM3tipG4lrroH7mFLR0yH5VdmVaAzuwFayzBJzCL3d7SNCB3uw0yeN7nYix3zYR79MMQPm64w==",
1016
1016
  "dev": true,
1017
1017
  "license": "BSD-2-Clause-Patent",
1018
1018
  "dependencies": {
@@ -17,7 +17,7 @@
17
17
  },
18
18
  "dependencies": {
19
19
  "@fastify/cors": "11.4.3",
20
- "@fastify/sensible": "6.0.7",
20
+ "@fastify/sensible": "6.0.8",
21
21
  "fastify": "5.12.8",
22
22
  "kysely": "0.29.9",
23
23
  "pino": "10.4.0",
@@ -28,8 +28,8 @@
28
28
  "zod": "4.6.7"
29
29
  },
30
30
  "devDependencies": {
31
- "@biomejs/biome": "2.6.7",
32
- "@lousy-agents/mcp": "5.23.7",
31
+ "@biomejs/biome": "2.6.8",
32
+ "@lousy-agents/mcp": "5.23.9",
33
33
  "@modelcontextprotocol/server-sequential-thinking": "2026.8.31",
34
34
  "@testcontainers/postgresql": "12.2.1",
35
35
  "@types/node": "26.6.6",
@@ -10,7 +10,7 @@
10
10
  },
11
11
  "ghcr.io/devcontainers/features/copilot-cli:1.0.0": {},
12
12
  "ghcr.io/anthropics/devcontainer-features/claude-code:1": {
13
- "version": "v2.1.325"
13
+ "version": "v2.1.326"
14
14
  },
15
15
  "ghcr.io/rocker-org/devcontainer-features/apt-packages:1.0.2": {
16
16
  "packages": "yamllint, shellcheck",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "root": true,
3
- "$schema": "https://biomejs.dev/schemas/2.6.7/schema.json",
3
+ "$schema": "https://biomejs.dev/schemas/2.6.8/schema.json",
4
4
  "vcs": {
5
5
  "enabled": true,
6
6
  "clientKind": "git",
@@ -19,8 +19,8 @@
19
19
  "zod": "4.6.7"
20
20
  },
21
21
  "devDependencies": {
22
- "@biomejs/biome": "2.6.7",
23
- "@lousy-agents/mcp": "5.23.7",
22
+ "@biomejs/biome": "2.6.8",
23
+ "@lousy-agents/mcp": "5.23.9",
24
24
  "@modelcontextprotocol/server-sequential-thinking": "2026.8.31",
25
25
  "@types/node": "26.6.6",
26
26
  "chance": "1.1.13",
package/dist/index.js CHANGED
@@ -3195,7 +3195,7 @@ const external_node_async_hooks_namespaceObject = __rspack_createRequire_require
3195
3195
 
3196
3196
  const file_observation_active = new external_node_async_hooks_namespaceObject.AsyncLocalStorage();
3197
3197
  function recordFileObservationFailure(error, kind) {
3198
- const failures = file_observation_active.getStore();
3198
+ const failures = file_observation_active.getStore()?.failures;
3199
3199
  if (!failures)
3200
3200
  return;
3201
3201
  let kinds = failures.get(error);
@@ -3204,13 +3204,17 @@ function recordFileObservationFailure(error, kind) {
3204
3204
  kinds.add(kind);
3205
3205
  }
3206
3206
  function isFileObservationFailure(error, kind) {
3207
- return file_observation_active.getStore()?.get(error)?.has(kind) === true;
3207
+ return file_observation_active.getStore()?.failures.get(error)?.has(kind) === true;
3208
+ }
3209
+ async function observedFilePublicationPending(filePath, identity) {
3210
+ return await file_observation_active.getStore()?.publicationPending?.(filePath, identity) ?? false;
3208
3211
  }
3209
3212
  // Each Root observation owns its receipts, including nested and concurrent reads.
3210
- function fileObservation() {
3213
+ function fileObservation(options = {}) {
3211
3214
  const failures = new Map();
3215
+ const context = { failures, ...options };
3212
3216
  return {
3213
- run(operation) { return file_observation_active.run(failures, operation); },
3217
+ run(operation) { return file_observation_active.run(context, operation); },
3214
3218
  has(error, kind) { return failures.get(error)?.has(kind) === true; },
3215
3219
  };
3216
3220
  }
@@ -5489,17 +5493,19 @@ function cleanupSidecarStages(target, assertCurrent, native, onlyStage) {
5489
5493
  }
5490
5494
  // Readers reject the linked record and retry. Authorized cleanup may handle
5491
5495
  // the one matching stage; recognition streams past the opportunistic budget.
5492
- function sidecar_lock_staging_sidecarPublicationPending(target, onStage) {
5496
+ function sidecar_lock_staging_sidecarPublicationPending(target, onStage, options = {}) {
5493
5497
  let entries;
5494
5498
  let callbackFailure;
5495
5499
  try {
5496
5500
  const current = external_node_fs_.lstatSync(target, { bigint: true, throwIfNoEntry: false });
5497
5501
  if (!current)
5498
- return true;
5502
+ return !options.requireStage;
5503
+ if (options.identity && !sameFileIdentityForCleanup(current, options.identity))
5504
+ return false;
5499
5505
  if (!current.isFile() || current.isSymbolicLink())
5500
5506
  return false;
5501
5507
  if (current.nlink === 1n)
5502
- return true;
5508
+ return !options.requireStage;
5503
5509
  if (current.nlink !== 2n)
5504
5510
  return false;
5505
5511
  const prefix = stagingPrefix(target);
@@ -5523,7 +5529,7 @@ function sidecar_lock_staging_sidecarPublicationPending(target, onStage) {
5523
5529
  }
5524
5530
  }
5525
5531
  const after = external_node_fs_.lstatSync(target, { bigint: true, throwIfNoEntry: false });
5526
- return !after || !sameFileIdentityForCleanup(after, current) || after.nlink === 1n;
5532
+ return !options.requireStage && (!after || !sameFileIdentityForCleanup(after, current) || after.nlink === 1n);
5527
5533
  }
5528
5534
  catch {
5529
5535
  if (callbackFailure)
@@ -6052,6 +6058,236 @@ function pinNodeDirectoryForModeSync(dirPath, options = {}) {
6052
6058
  }
6053
6059
  }
6054
6060
 
6061
+ ;// CONCATENATED MODULE: ../../node_modules/@openclaw/fs-safe/dist/test-hooks.js
6062
+
6063
+ let test_hooks_fsSafeTestHooks;
6064
+ function allowFsSafeTestHooks() {
6065
+ return false || process.env.VITEST === "true";
6066
+ }
6067
+ function getFsSafeTestHooks() {
6068
+ return test_hooks_fsSafeTestHooks;
6069
+ }
6070
+ function __setFsSafeTestHooksForTest(hooks) {
6071
+ if (hooks && !allowFsSafeTestHooks()) {
6072
+ throw new Error("__setFsSafeTestHooksForTest is only available in tests");
6073
+ }
6074
+ test_hooks_fsSafeTestHooks = hooks;
6075
+ }
6076
+
6077
+ ;// CONCATENATED MODULE: ../../node_modules/@openclaw/fs-safe/dist/timing.js
6078
+ const MAX_TIMER_DELAY_MS = 2 ** 31 - 1;
6079
+ function scheduleTimeout(callback, ms) {
6080
+ let timer;
6081
+ if (Number.isFinite(ms) && ms > MAX_TIMER_DELAY_MS) {
6082
+ const startedAt = performance.now();
6083
+ const tick = () => {
6084
+ const remaining = ms - (performance.now() - startedAt);
6085
+ if (remaining <= 0)
6086
+ callback();
6087
+ else
6088
+ timer = setTimeout(tick, Math.min(remaining, MAX_TIMER_DELAY_MS));
6089
+ };
6090
+ // Node clamps overflowing delays to 1 ms. Rearm bounded timers against a
6091
+ // monotonic clock so clock changes and event-loop stalls cannot shorten them.
6092
+ timer = setTimeout(tick, MAX_TIMER_DELAY_MS);
6093
+ }
6094
+ else {
6095
+ timer = setTimeout(callback, ms);
6096
+ }
6097
+ return () => clearTimeout(timer);
6098
+ }
6099
+ function sleep(ms) {
6100
+ return new Promise((resolve) => { scheduleTimeout(resolve, ms); });
6101
+ }
6102
+ function sleepSync(ms) {
6103
+ if (ms <= 0) {
6104
+ return;
6105
+ }
6106
+ Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, ms);
6107
+ }
6108
+ async function withTimeout(promise, timeoutMs, labelOrOptions = {
6109
+ message: "timeout",
6110
+ }) {
6111
+ if (!Number.isFinite(timeoutMs) || timeoutMs <= 0) {
6112
+ return await promise;
6113
+ }
6114
+ const options = typeof labelOrOptions === "string" ? { label: labelOrOptions } : labelOrOptions;
6115
+ const createError = options.createError ??
6116
+ (() => new Error(options.message ?? `${options.label ?? "operation"} timed out after ${timeoutMs}ms`));
6117
+ let cancelTimeout;
6118
+ try {
6119
+ return await Promise.race([
6120
+ promise,
6121
+ new Promise((_, reject) => {
6122
+ cancelTimeout = scheduleTimeout(() => {
6123
+ try {
6124
+ reject(createError());
6125
+ }
6126
+ catch (error) {
6127
+ reject(error);
6128
+ }
6129
+ }, timeoutMs);
6130
+ }),
6131
+ ]);
6132
+ }
6133
+ finally {
6134
+ cancelTimeout?.();
6135
+ }
6136
+ }
6137
+
6138
+ ;// CONCATENATED MODULE: ../../node_modules/@openclaw/fs-safe/dist/publication-recovery.js
6139
+
6140
+
6141
+
6142
+
6143
+
6144
+
6145
+
6146
+
6147
+ const non9pDevices = new Set();
6148
+ /** Other platforms keep their existing path even when the option is enabled. */
6149
+ function shouldPrepareDrvfsRecovery(enabled, dev) {
6150
+ if (enabled !== true)
6151
+ return false;
6152
+ // Synthetic mount evidence must not inherit observations from the real host.
6153
+ if (getFsSafeTestHooks()?.drvfsMountObservation)
6154
+ return true;
6155
+ if (process.platform !== "linux")
6156
+ return false;
6157
+ if (dev === undefined)
6158
+ return true;
6159
+ // Linux 9p allocates anonymous devices (major zero), never block devices.
6160
+ if (((dev >> 8n) & 0xfffn) !== 0n || ((dev >> 32n) & 0xfffff000n) !== 0n)
6161
+ return false;
6162
+ return !non9pDevices.has(dev);
6163
+ }
6164
+ /** Negative evidence only: a stale/reused device number can only disable recovery. */
6165
+ function mayPrepareDrvfsRecoveryAtFd(parentFd, dev) {
6166
+ if (!shouldPrepareDrvfsRecovery(true, dev))
6167
+ return false;
6168
+ if (getFsSafeTestHooks()?.drvfsMountObservation)
6169
+ return true;
6170
+ try {
6171
+ if (native_getNativeBinding()?.is9pFilesystem?.(parentFd) === false) {
6172
+ non9pDevices.add(dev);
6173
+ return false;
6174
+ }
6175
+ }
6176
+ catch { /* Unavailable evidence preserves full recovery-time verification. */ }
6177
+ return true;
6178
+ }
6179
+ /** No sampling or positive cache: the retained directory's exact mount owns admission. */
6180
+ function admitsDrvfsRenameRecoveryAtFd(parentFd) {
6181
+ try {
6182
+ const hook = getFsSafeTestHooks()?.drvfsMountObservation;
6183
+ if (!hook && process.platform !== "linux")
6184
+ return false;
6185
+ if (!Number.isInteger(parentFd) || parentFd < 0)
6186
+ return false;
6187
+ const observation = hook ? hook(parentFd) : (() => {
6188
+ if (external_node_fs_.statfsSync("/proc/self/fd", { bigint: true }).type !== 0x9fa0n)
6189
+ return undefined;
6190
+ // statfs follows this kernel-owned descriptor alias to the retained parent.
6191
+ return {
6192
+ magic: external_node_fs_.statfsSync(`/proc/self/fd/${parentFd}`, { bigint: true }).type,
6193
+ fdinfo: external_node_fs_.readFileSync(`/proc/self/fdinfo/${parentFd}`, "utf8"),
6194
+ mountinfo: external_node_fs_.readFileSync("/proc/self/mountinfo", "utf8"),
6195
+ };
6196
+ })();
6197
+ if (!observation || observation.magic !== 0x01021997n)
6198
+ return false;
6199
+ const ids = [...observation.fdinfo.matchAll(/^mnt_id:\s*(\d+)\s*$/gm)];
6200
+ if (ids.length !== 1)
6201
+ return false;
6202
+ const entries = observation.mountinfo.split("\n").filter(line => line.split(" ")[0] === ids[0][1]);
6203
+ if (entries.length !== 1)
6204
+ return false;
6205
+ const [before, after, extra] = entries[0].split(" - ");
6206
+ if (!before || !after || extra !== undefined || before.split(" ").length < 6)
6207
+ return false;
6208
+ const fields = after.split(" ");
6209
+ return fields.length === 3 && fields[0] === "9p" &&
6210
+ fields[2].split(",").some(option => option === "aname=drvfs" || option.startsWith("aname=drvfs;"));
6211
+ }
6212
+ catch {
6213
+ return false;
6214
+ }
6215
+ }
6216
+ /** Exact metadata is necessary but cannot exclude inode reuse after the final close. */
6217
+ function assertRecoveredPublication(actual, expected) {
6218
+ if (!actual.isFile() || actual.isSymbolicLink() || actual.nlink !== 1n ||
6219
+ actual.dev !== expected.dev || actual.ino !== expected.ino || actual.size !== expected.size ||
6220
+ actual.mode !== expected.mode || actual.uid !== expected.uid || actual.gid !== expected.gid) {
6221
+ throw new errors_FsSafeError("path-mismatch", "published file changed during DrvFS recovery");
6222
+ }
6223
+ }
6224
+ async function recoverAfterHiddenRename(params) {
6225
+ if (!admitsDrvfsRenameRecoveryAtFd(params.parentFd)) {
6226
+ throw new errors_FsSafeError("path-mismatch", "hidden rename recovery requires a verified DrvFS mount");
6227
+ }
6228
+ await params.closeWriter();
6229
+ for (let attempt = 0;; attempt++) {
6230
+ let recovered;
6231
+ try {
6232
+ recovered = await params.reopen();
6233
+ }
6234
+ catch (error) {
6235
+ if (!hasErrorCode(error, "ENOENT") || attempt === 4)
6236
+ throw error;
6237
+ await sleep(20);
6238
+ continue;
6239
+ }
6240
+ try {
6241
+ await params.retain?.(recovered);
6242
+ }
6243
+ catch (error) {
6244
+ await params.dispose?.(recovered).catch(() => undefined);
6245
+ throw error;
6246
+ }
6247
+ return recovered;
6248
+ }
6249
+ }
6250
+ function recoverAfterHiddenRenameSync(params) {
6251
+ if (!admitsDrvfsRenameRecoveryAtFd(params.parentFd)) {
6252
+ throw new errors_FsSafeError("path-mismatch", "hidden rename recovery requires a verified DrvFS mount");
6253
+ }
6254
+ params.closeWriter();
6255
+ for (let attempt = 0;; attempt++) {
6256
+ try {
6257
+ return params.reopen();
6258
+ }
6259
+ catch (error) {
6260
+ if (!hasErrorCode(error, "ENOENT") || attempt === 4)
6261
+ throw error;
6262
+ sleepSync(20);
6263
+ }
6264
+ }
6265
+ }
6266
+ function assertRecoveredFile(fd, expected, content) {
6267
+ assertRecoveredPublication(external_node_fs_.fstatSync(fd, { bigint: true }), expected);
6268
+ if (content && !bounded_read_readFileDescriptorBoundedSync(fd, content.byteLength).equals(content)) {
6269
+ throw new errors_FsSafeError("path-mismatch", "published content changed during DrvFS recovery");
6270
+ }
6271
+ assertRecoveredPublication(external_node_fs_.fstatSync(fd, { bigint: true }), expected);
6272
+ }
6273
+ function reopenRecoveredNativeFile(binding, parentFd, basename, expected, content) {
6274
+ if (!binding.openBeneath || !binding.closeOwnedFd || !binding.stagedFileMatches) {
6275
+ throw new errors_FsSafeError("helper-unavailable", "native DrvFS recovery requires descriptor-relative verification");
6276
+ }
6277
+ const fd = binding.openBeneath(parentFd, basename, nativeOpenFlags(external_node_fs_.constants.O_RDONLY | external_node_fs_.constants.O_NONBLOCK)).fd;
6278
+ try {
6279
+ assertRecoveredFile(fd, expected, content);
6280
+ if (!binding.stagedFileMatches(parentFd, basename, fd)) {
6281
+ throw new errors_FsSafeError("path-mismatch", "published name changed during DrvFS recovery");
6282
+ }
6283
+ return fd;
6284
+ }
6285
+ catch (error) {
6286
+ binding.closeOwnedFd(fd);
6287
+ throw error;
6288
+ }
6289
+ }
6290
+
6055
6291
  ;// CONCATENATED MODULE: ../../node_modules/@openclaw/fs-safe/dist/root-boundary.js
6056
6292
 
6057
6293
 
@@ -6430,67 +6666,6 @@ function recursiveMkdirPath(directory) {
6430
6666
  return needsAbsolutePath ? absolutePathWithRawSegments(directory) : directory;
6431
6667
  }
6432
6668
 
6433
- ;// CONCATENATED MODULE: ../../node_modules/@openclaw/fs-safe/dist/timing.js
6434
- const MAX_TIMER_DELAY_MS = 2 ** 31 - 1;
6435
- function scheduleTimeout(callback, ms) {
6436
- let timer;
6437
- if (Number.isFinite(ms) && ms > MAX_TIMER_DELAY_MS) {
6438
- const startedAt = performance.now();
6439
- const tick = () => {
6440
- const remaining = ms - (performance.now() - startedAt);
6441
- if (remaining <= 0)
6442
- callback();
6443
- else
6444
- timer = setTimeout(tick, Math.min(remaining, MAX_TIMER_DELAY_MS));
6445
- };
6446
- // Node clamps overflowing delays to 1 ms. Rearm bounded timers against a
6447
- // monotonic clock so clock changes and event-loop stalls cannot shorten them.
6448
- timer = setTimeout(tick, MAX_TIMER_DELAY_MS);
6449
- }
6450
- else {
6451
- timer = setTimeout(callback, ms);
6452
- }
6453
- return () => clearTimeout(timer);
6454
- }
6455
- function sleep(ms) {
6456
- return new Promise((resolve) => { scheduleTimeout(resolve, ms); });
6457
- }
6458
- function sleepSync(ms) {
6459
- if (ms <= 0) {
6460
- return;
6461
- }
6462
- Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, ms);
6463
- }
6464
- async function withTimeout(promise, timeoutMs, labelOrOptions = {
6465
- message: "timeout",
6466
- }) {
6467
- if (!Number.isFinite(timeoutMs) || timeoutMs <= 0) {
6468
- return await promise;
6469
- }
6470
- const options = typeof labelOrOptions === "string" ? { label: labelOrOptions } : labelOrOptions;
6471
- const createError = options.createError ??
6472
- (() => new Error(options.message ?? `${options.label ?? "operation"} timed out after ${timeoutMs}ms`));
6473
- let cancelTimeout;
6474
- try {
6475
- return await Promise.race([
6476
- promise,
6477
- new Promise((_, reject) => {
6478
- cancelTimeout = scheduleTimeout(() => {
6479
- try {
6480
- reject(createError());
6481
- }
6482
- catch (error) {
6483
- reject(error);
6484
- }
6485
- }, timeoutMs);
6486
- }),
6487
- ]);
6488
- }
6489
- finally {
6490
- cancelTimeout?.();
6491
- }
6492
- }
6493
-
6494
6669
  ;// CONCATENATED MODULE: ../../node_modules/@openclaw/fs-safe/dist/exclusive-create.js
6495
6670
 
6496
6671
 
@@ -6782,6 +6957,7 @@ class AtomicFile {
6782
6957
 
6783
6958
 
6784
6959
 
6960
+
6785
6961
  function replace_file_descriptor_parentCloseFailure(primary, closeError) {
6786
6962
  return primary ? new AggregateError([primary.error, closeError], "Atomic parent preparation and close failed") : closeError;
6787
6963
  }
@@ -6844,6 +7020,8 @@ async function pinDirectoryForMode(params) {
6844
7020
  ignoreChmodError: params.ignoreChmodError,
6845
7021
  });
6846
7022
  await owner.verify();
7023
+ if (params.allowDrvfsRenameRecovery)
7024
+ mayPrepareDrvfsRecoveryAtFd(handle.fd, expected.dev);
6847
7025
  return owner;
6848
7026
  }
6849
7027
  catch (error) {
@@ -6890,6 +7068,8 @@ function* applyDirectoryMode(io, params) {
6890
7068
  let primary;
6891
7069
  try {
6892
7070
  inspectAtomicIdentity(io, () => file.statExact(), expected, false, admit);
7071
+ if (params.allowDrvfsRenameRecovery)
7072
+ mayPrepareDrvfsRecoveryAtFd(file.fd, expected.dev);
6893
7073
  if (params.mode !== "preserve") {
6894
7074
  params.mutation?.assert();
6895
7075
  file.chmod(params.mode & 0o7777);
@@ -7115,146 +7295,6 @@ function __cleanupRegisteredTempPathForTest(tempPath) {
7115
7295
  }
7116
7296
  }
7117
7297
 
7118
- ;// CONCATENATED MODULE: ../../node_modules/@openclaw/fs-safe/dist/test-hooks.js
7119
-
7120
- let test_hooks_fsSafeTestHooks;
7121
- function allowFsSafeTestHooks() {
7122
- return false || process.env.VITEST === "true";
7123
- }
7124
- function getFsSafeTestHooks() {
7125
- return test_hooks_fsSafeTestHooks;
7126
- }
7127
- function __setFsSafeTestHooksForTest(hooks) {
7128
- if (hooks && !allowFsSafeTestHooks()) {
7129
- throw new Error("__setFsSafeTestHooksForTest is only available in tests");
7130
- }
7131
- test_hooks_fsSafeTestHooks = hooks;
7132
- }
7133
-
7134
- ;// CONCATENATED MODULE: ../../node_modules/@openclaw/fs-safe/dist/publication-recovery.js
7135
-
7136
-
7137
-
7138
-
7139
-
7140
-
7141
-
7142
- /** Other platforms keep their existing path even when the option is enabled. */
7143
- function shouldPrepareDrvfsRecovery(enabled) {
7144
- return enabled === true && (process.platform === "linux" || getFsSafeTestHooks()?.drvfsMountObservation !== undefined);
7145
- }
7146
- /** No sampling or positive cache: the retained directory's exact mount owns admission. */
7147
- function admitsDrvfsRenameRecoveryAtFd(parentFd) {
7148
- try {
7149
- const hook = getFsSafeTestHooks()?.drvfsMountObservation;
7150
- if (!hook && process.platform !== "linux")
7151
- return false;
7152
- if (!Number.isInteger(parentFd) || parentFd < 0)
7153
- return false;
7154
- const observation = hook ? hook(parentFd) : (() => {
7155
- if (external_node_fs_.statfsSync("/proc/self/fd", { bigint: true }).type !== 0x9fa0n)
7156
- return undefined;
7157
- // statfs follows this kernel-owned descriptor alias to the retained parent.
7158
- return {
7159
- magic: external_node_fs_.statfsSync(`/proc/self/fd/${parentFd}`, { bigint: true }).type,
7160
- fdinfo: external_node_fs_.readFileSync(`/proc/self/fdinfo/${parentFd}`, "utf8"),
7161
- mountinfo: external_node_fs_.readFileSync("/proc/self/mountinfo", "utf8"),
7162
- };
7163
- })();
7164
- if (!observation || observation.magic !== 0x01021997n)
7165
- return false;
7166
- const ids = [...observation.fdinfo.matchAll(/^mnt_id:\s*(\d+)\s*$/gm)];
7167
- if (ids.length !== 1)
7168
- return false;
7169
- const entries = observation.mountinfo.split("\n").filter(line => line.split(" ")[0] === ids[0][1]);
7170
- if (entries.length !== 1)
7171
- return false;
7172
- const [before, after, extra] = entries[0].split(" - ");
7173
- if (!before || !after || extra !== undefined || before.split(" ").length < 6)
7174
- return false;
7175
- const fields = after.split(" ");
7176
- return fields.length === 3 && fields[0] === "9p" &&
7177
- fields[2].split(",").some(option => option === "aname=drvfs" || option.startsWith("aname=drvfs;"));
7178
- }
7179
- catch {
7180
- return false;
7181
- }
7182
- }
7183
- /** Exact metadata is necessary but cannot exclude inode reuse after the final close. */
7184
- function assertRecoveredPublication(actual, expected) {
7185
- if (!actual.isFile() || actual.isSymbolicLink() || actual.nlink !== 1n ||
7186
- actual.dev !== expected.dev || actual.ino !== expected.ino || actual.size !== expected.size ||
7187
- actual.mode !== expected.mode || actual.uid !== expected.uid || actual.gid !== expected.gid) {
7188
- throw new errors_FsSafeError("path-mismatch", "published file changed during DrvFS recovery");
7189
- }
7190
- }
7191
- async function recoverAfterHiddenRename(params) {
7192
- if (!admitsDrvfsRenameRecoveryAtFd(params.parentFd)) {
7193
- throw new errors_FsSafeError("path-mismatch", "hidden rename recovery requires a verified DrvFS mount");
7194
- }
7195
- await params.closeWriter();
7196
- for (let attempt = 0;; attempt++) {
7197
- let recovered;
7198
- try {
7199
- recovered = await params.reopen();
7200
- }
7201
- catch (error) {
7202
- if (!hasErrorCode(error, "ENOENT") || attempt === 4)
7203
- throw error;
7204
- await sleep(20);
7205
- continue;
7206
- }
7207
- try {
7208
- await params.retain?.(recovered);
7209
- }
7210
- catch (error) {
7211
- await params.dispose?.(recovered).catch(() => undefined);
7212
- throw error;
7213
- }
7214
- return recovered;
7215
- }
7216
- }
7217
- function recoverAfterHiddenRenameSync(params) {
7218
- if (!admitsDrvfsRenameRecoveryAtFd(params.parentFd)) {
7219
- throw new errors_FsSafeError("path-mismatch", "hidden rename recovery requires a verified DrvFS mount");
7220
- }
7221
- params.closeWriter();
7222
- for (let attempt = 0;; attempt++) {
7223
- try {
7224
- return params.reopen();
7225
- }
7226
- catch (error) {
7227
- if (!hasErrorCode(error, "ENOENT") || attempt === 4)
7228
- throw error;
7229
- sleepSync(20);
7230
- }
7231
- }
7232
- }
7233
- function assertRecoveredFile(fd, expected, content) {
7234
- assertRecoveredPublication(external_node_fs_.fstatSync(fd, { bigint: true }), expected);
7235
- if (content && !bounded_read_readFileDescriptorBoundedSync(fd, content.byteLength).equals(content)) {
7236
- throw new errors_FsSafeError("path-mismatch", "published content changed during DrvFS recovery");
7237
- }
7238
- assertRecoveredPublication(external_node_fs_.fstatSync(fd, { bigint: true }), expected);
7239
- }
7240
- function reopenRecoveredNativeFile(binding, parentFd, basename, expected, content) {
7241
- if (!binding.openBeneath || !binding.closeOwnedFd || !binding.stagedFileMatches) {
7242
- throw new errors_FsSafeError("helper-unavailable", "native DrvFS recovery requires descriptor-relative verification");
7243
- }
7244
- const fd = binding.openBeneath(parentFd, basename, nativeOpenFlags(external_node_fs_.constants.O_RDONLY | external_node_fs_.constants.O_NONBLOCK)).fd;
7245
- try {
7246
- assertRecoveredFile(fd, expected, content);
7247
- if (!binding.stagedFileMatches(parentFd, basename, fd)) {
7248
- throw new errors_FsSafeError("path-mismatch", "published name changed during DrvFS recovery");
7249
- }
7250
- return fd;
7251
- }
7252
- catch (error) {
7253
- binding.closeOwnedFd(fd);
7254
- throw error;
7255
- }
7256
- }
7257
-
7258
7298
  ;// CONCATENATED MODULE: ../../node_modules/@openclaw/fs-safe/dist/directory-receipt.js
7259
7299
 
7260
7300
 
@@ -7847,8 +7887,11 @@ function staged_directory_openStagedDirectory(directory) {
7847
7887
 
7848
7888
 
7849
7889
 
7890
+
7850
7891
  /** Retained only for an explicitly enabled operation; no new default-path I/O. */
7851
- function retainDrvfsParent(directory) {
7892
+ function retainDrvfsParent(directory, dev, filesystemChecked = false) {
7893
+ if (!shouldPrepareDrvfsRecovery(true, dev))
7894
+ return undefined;
7852
7895
  let parent;
7853
7896
  try {
7854
7897
  // Resolve through the filesystem first: lexical normalization of link/..
@@ -7862,6 +7905,11 @@ function retainDrvfsParent(directory) {
7862
7905
  assertStagedDirectoryCurrent(retained.receipt);
7863
7906
  };
7864
7907
  assertCurrent();
7908
+ if (!filesystemChecked && !mayPrepareDrvfsRecoveryAtFd(retained.fd, retained.receipt.identity.dev)) {
7909
+ parent = undefined;
7910
+ external_node_fs_.closeSync(retained.fd);
7911
+ return undefined;
7912
+ }
7865
7913
  return { fd: retained.fd, assertCurrent, close() { external_node_fs_.closeSync(retained.fd); } };
7866
7914
  }
7867
7915
  catch {
@@ -7981,10 +8029,10 @@ class AtomicTempOwner {
7981
8029
  throw new Error("Atomic temp owner has no descriptor");
7982
8030
  return this.resource.fd;
7983
8031
  }
7984
- *prepareRecovery(content, directory = external_node_path_.dirname(this.pathname)) {
8032
+ *prepareRecovery(content, directory = external_node_path_.dirname(this.pathname), filesystemChecked = false) {
7985
8033
  if (!shouldPrepareDrvfsRecovery(true))
7986
8034
  return;
7987
- this.recoveryParent = retainDrvfsParent(directory);
8035
+ this.recoveryParent = retainDrvfsParent(directory, this.identity.dev, filesystemChecked);
7988
8036
  if (!this.recoveryParent)
7989
8037
  return;
7990
8038
  const observed = this.resource.statExact();
@@ -10337,11 +10385,11 @@ function fileLockSyncRootReceiptStillCurrent(pathAuthority, receipt) {
10337
10385
 
10338
10386
 
10339
10387
 
10340
- async function rootSidecarPublicationPending(lockRoot, relative, cleanAbandoned = false) {
10388
+ async function rootSidecarPublicationPending(lockRoot, relative, options = {}) {
10341
10389
  const resolved = await lockRoot.resolve(relative);
10342
10390
  const parent = external_node_path_.dirname(resolved);
10343
10391
  const identity = await directory_guard_inspectDirectoryIdentity(parent);
10344
- if (cleanAbandoned) {
10392
+ if (options.cleanAbandoned) {
10345
10393
  const admitted = admitFileLockSyncRootPath(captureFileLockSyncRootAuthority(lockRoot), resolved);
10346
10394
  const receipt = observeDirectory(external_node_path_.dirname(admitted.path));
10347
10395
  cleanupSidecarStages(admitted.path, candidate => {
@@ -10352,7 +10400,7 @@ async function rootSidecarPublicationPending(lockRoot, relative, cleanAbandoned
10352
10400
  assertFileLockSyncRootMutationAllowed(candidate, admitted.authority.denyMutations);
10353
10401
  });
10354
10402
  }
10355
- const pending = sidecar_lock_staging_sidecarPublicationPending(resolved);
10403
+ const pending = sidecar_lock_staging_sidecarPublicationPending(resolved, undefined, options);
10356
10404
  await directory_guard_inspectDirectoryIdentity(parent, identity);
10357
10405
  return pending && await lockRoot.resolve(relative) === resolved;
10358
10406
  }
@@ -10384,7 +10432,10 @@ async function openSidecarRoot(lockRoot, relative, discardObservation, onOpenFai
10384
10432
  break;
10385
10433
  }
10386
10434
  }
10387
- const observation = fileObservation();
10435
+ const observation = fileObservation({
10436
+ publicationPending: async (candidate, identity) => discardObservation === "changed" && candidate === resolved &&
10437
+ await rootSidecarPublicationPending(lockRoot, relative, { requireStage: true, identity }),
10438
+ });
10388
10439
  try {
10389
10440
  const opened = await observation.run(() => lockRoot.open(relative));
10390
10441
  if (opened.realPath !== expectedRealPath) {
@@ -10405,13 +10456,19 @@ async function openSidecarRoot(lockRoot, relative, discardObservation, onOpenFai
10405
10456
  return null;
10406
10457
  const discardable = observation.has(error, `unlinked:${resolved}`) ||
10407
10458
  (discardObservation === "changed" && observation.has(error, `changed:${resolved}`));
10408
- if (!discardObservation || (!missing && (!completeParents || !discardable)))
10459
+ const linkedChange = discardObservation === "changed" && observation.has(error, `linked-change:${resolved}`);
10460
+ if (!discardObservation || (!missing && (!completeParents || (!discardable && !linkedChange))))
10409
10461
  throw error;
10410
10462
  try {
10463
+ // Linked-change receipts already proved a matching stage while the exact
10464
+ // descriptor was open; retained ancestry and the current path still fence it.
10411
10465
  const probe = fileObservation();
10412
10466
  try {
10413
10467
  const current = await probe.run(() => lockRoot.stat(relative));
10414
- if (!current.isFile || current.isSymbolicLink || current.nlink !== 1)
10468
+ // A successor can still hold its matching publication-stage link.
10469
+ // Discard only the old read; retained ancestry is revalidated below.
10470
+ if (!current.isFile || current.isSymbolicLink || (current.nlink !== 1 &&
10471
+ !(current.nlink === 2 && await rootSidecarPublicationPending(lockRoot, relative))))
10415
10472
  throw error;
10416
10473
  }
10417
10474
  catch (probeError) {
@@ -18063,6 +18120,7 @@ class NativeStagedFile {
18063
18120
  #recoveryIdentity;
18064
18121
  #recoveryContent;
18065
18122
  #recovered = false;
18123
+ #prepareRecovery;
18066
18124
  #publicationTask;
18067
18125
  #rejectFinalSymlink = false;
18068
18126
  #unsupportedNoReplace;
@@ -18076,6 +18134,8 @@ class NativeStagedFile {
18076
18134
  this.#assertBeforeMutation = owner.assertBeforeMutation;
18077
18135
  this.#private = owner.permissionPolicy === "private-creation";
18078
18136
  this.#verifyMode = owner.permissionPolicy !== undefined;
18137
+ this.#prepareRecovery = shouldPrepareDrvfsRecovery(owner.allowDrvfsRenameRecovery, owner.directory.identity.dev) &&
18138
+ mayPrepareDrvfsRecoveryAtFd(owner.parentFd, owner.directory.identity.dev);
18079
18139
  }
18080
18140
  // The supplied closer owns parentFd even on construction or preparation failure.
18081
18141
  static async create(owner, input, maxBytes) {
@@ -18092,7 +18152,7 @@ class NativeStagedFile {
18092
18152
  }
18093
18153
  throw error;
18094
18154
  }
18095
- if (shouldPrepareDrvfsRecovery(owner.allowDrvfsRenameRecovery) && input.kind === "buffer") {
18155
+ if (staged.#prepareRecovery && input.kind === "buffer") {
18096
18156
  staged.#recoveryContent = typeof input.data === "string" ? Buffer.from(input.data, input.encoding) : Buffer.from(input.data);
18097
18157
  }
18098
18158
  await staged.#prepare(input, maxBytes);
@@ -18330,7 +18390,7 @@ class NativeStagedFile {
18330
18390
  this.#assertCurrent();
18331
18391
  assertFinalSymlinkRejected(external_node_path_.join(this.#owner.directory.realPath, basename), this.#rejectFinalSymlink);
18332
18392
  }
18333
- if (shouldPrepareDrvfsRecovery(this.#owner.allowDrvfsRenameRecovery)) {
18393
+ if (this.#prepareRecovery) {
18334
18394
  // Apply restrictive modes before exposing the name or releasing its last fd.
18335
18395
  if ((this.#owner.mode & 0o600) !== 0o600)
18336
18396
  external_node_fs_.fchmodSync(this.#file(), this.#owner.mode);
@@ -18930,10 +18990,11 @@ async function handleStaleSidecarAdmission(params) {
18930
18990
  throw error;
18931
18991
  }
18932
18992
  // An incomplete owner can still be writing; age is not liveness evidence.
18933
- if (!snapshot || (!params.parserState.parser && snapshot.payload === null) || isIncompleteSidecarLockRecord(snapshot.raw)) {
18993
+ if (!snapshot) {
18934
18994
  await params.waitForRetry();
18935
18995
  return;
18936
18996
  }
18997
+ const incomplete = (!params.parserState.parser && snapshot.payload === null) || isIncompleteSidecarLockRecord(snapshot.raw);
18937
18998
  const staleOptions = params.staleOptionsState;
18938
18999
  try {
18939
19000
  if (!staleOptions.shouldReclaimObserved) {
@@ -18969,7 +19030,7 @@ async function handleStaleSidecarAdmission(params) {
18969
19030
  assertUnheld();
18970
19031
  try {
18971
19032
  if (!shouldReclaim)
18972
- return defaultSidecarLockShouldReclaim(snapshot, params.staleMs, Date.now());
19033
+ return !incomplete && defaultSidecarLockShouldReclaim(snapshot, params.staleMs, Date.now());
18973
19034
  return await Reflect.apply(shouldReclaim, undefined, [{
18974
19035
  lockPath,
18975
19036
  normalizedTargetPath,
@@ -19015,6 +19076,9 @@ async function handleStaleSidecarAdmission(params) {
19015
19076
  await params.waitForRetry();
19016
19077
  return;
19017
19078
  }
19079
+ // Policy may diagnose an incomplete record, but can never authorize its removal.
19080
+ if (incomplete)
19081
+ throw sidecarLockStale(lockPath, normalizedTargetPath);
19018
19082
  if ((staleOptions.staleRecovery ?? "fail-closed") === "remove-if-unchanged") {
19019
19083
  const acquiredGuard = await admission.run(() => tryAcquireSidecarReclaimGuard(params.reclaimGuards, params.reclaimGuardPath, params.lockRoot));
19020
19084
  if (acquiredGuard)
@@ -19723,7 +19787,7 @@ async function acquireSidecarLock(options, context) {
19723
19787
  catch (error) {
19724
19788
  let cause = error;
19725
19789
  for (let depth = 0; depth < 4 && cause && typeof cause === "object"; depth++) {
19726
- if (observation.has(cause, "hardlink") && await rootSidecarPublicationPending(lockRoot, relativeLockPath, true)) {
19790
+ if (observation.has(cause, "hardlink") && await rootSidecarPublicationPending(lockRoot, relativeLockPath, { cleanAbandoned: true })) {
19727
19791
  exclusiveCreateConflict = true;
19728
19792
  throw Object.assign(new Error("sidecar publication in progress"), { code: "EEXIST" });
19729
19793
  }
@@ -20643,7 +20707,7 @@ async function runPinnedStagedWrite(params, parentPath, parentGuard) {
20643
20707
  ((params.mode & 0o400) !== 0 ||
20644
20708
  (process.platform === "linux" && (process.arch === "x64" || process.arch === "arm64")));
20645
20709
  if (shouldPrepareDrvfsRecovery(params.allowDrvfsRenameRecovery)) {
20646
- recoveryParent = retainDrvfsParent(parentPath);
20710
+ recoveryParent = retainDrvfsParent(parentPath, parentGuard.stat.dev);
20647
20711
  if (recoveryParent)
20648
20712
  recoveryIdentity = external_node_fs_.fstatSync(handle.fd, { bigint: true });
20649
20713
  if (recoveryParent && params.input.kind === "buffer")
@@ -21230,16 +21294,26 @@ function openedPathResolutionError(error = new errors_FsSafeError("path-mismatch
21230
21294
  }
21231
21295
  async function recordPreOpenFileChange(error, handle, filePath, before, opened) {
21232
21296
  if (!isFileObservationFailure(error, "identity") || !before?.isFile() || !opened?.isFile() ||
21233
- ![0n, 1n].includes(before.nlink) || ![0n, 1n].includes(opened.nlink))
21297
+ ![0n, 1n].includes(before.nlink) || ![0n, 1n, 2n].includes(opened.nlink))
21234
21298
  return;
21235
21299
  try {
21236
21300
  await strict_file_identity_inspectFileIdentity(async () => before);
21237
- const current = await strict_file_identity_inspectFileIdentity(() => process.platform === "win32"
21301
+ // A fresh exact descriptor distinguishes a completed handoff from a
21302
+ // still-linked generation that needs separate publication proof.
21303
+ const inspectCurrent = () => strict_file_identity_inspectFileIdentity(() => process.platform === "win32"
21238
21304
  ? external_node_fs_.fstatSync(handle.fd, { bigint: true }) : handle.stat({ bigint: true }), opened);
21239
- if (current.isFile() && [0n, 1n].includes(current.nlink) &&
21240
- (before.dev !== current.dev || before.ino !== current.ino)) {
21305
+ let current = await inspectCurrent();
21306
+ let publication = false;
21307
+ if (current.isFile() && current.nlink === 2n) {
21308
+ publication = await observedFilePublicationPending(filePath, current);
21309
+ current = await inspectCurrent();
21310
+ }
21311
+ if (current.isFile() && (before.dev !== current.dev || before.ino !== current.ino)) {
21241
21312
  // A stale pathname sample is not proof that its former inode was unlinked.
21242
- recordFileObservationFailure(error, `changed:${filePath}`);
21313
+ if ([0n, 1n].includes(current.nlink))
21314
+ recordFileObservationFailure(error, `changed:${filePath}`);
21315
+ else if (current.nlink === 2n && publication)
21316
+ recordFileObservationFailure(error, `linked-change:${filePath}`);
21243
21317
  }
21244
21318
  }
21245
21319
  catch {
@@ -21345,7 +21419,7 @@ async function openLocalFileDescriptor(filePath, options) {
21345
21419
  : await strict_file_identity_inspectFileIdentity(async () => inspect(await handle.stat({ bigint: true })), expected);
21346
21420
  }
21347
21421
  catch (error) {
21348
- if (openedIdentity && [0n, 1n].includes(openedIdentity.nlink)) {
21422
+ if (openedIdentity && [0n, 1n, 2n].includes(openedIdentity.nlink)) {
21349
21423
  await recordPreOpenFileChange(error, handle, filePath, preOpenStat, openedIdentity);
21350
21424
  }
21351
21425
  throw error;
@@ -25477,8 +25551,12 @@ async function commitPinnedWriteInRoot(root, pinned, params, input) {
25477
25551
  });
25478
25552
  }
25479
25553
  catch (error) {
25480
- if (error instanceof SidecarFallbackWriteError)
25481
- throw error.failure;
25554
+ if (error instanceof SidecarFallbackWriteError) {
25555
+ // Windows keeps its historical direct-write error identity.
25556
+ if (process.platform === "win32")
25557
+ throw error.failure;
25558
+ error = error.failure;
25559
+ }
25482
25560
  if (verifyingPublication)
25483
25561
  throw error;
25484
25562
  const errorCode = error?.code;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lousy-agents/cli",
3
- "version": "5.23.8",
3
+ "version": "5.23.10",
4
4
  "description": "CLI scaffolding tool that sets up projects with structure, instructions, and feedback loops for AI coding assistants",
5
5
  "type": "module",
6
6
  "repository": {
@@ -10,7 +10,7 @@
10
10
  },
11
11
  "ghcr.io/devcontainers/features/copilot-cli:1.0.0": {},
12
12
  "ghcr.io/anthropics/devcontainer-features/claude-code:1": {
13
- "version": "v2.1.325"
13
+ "version": "v2.1.326"
14
14
  },
15
15
  "ghcr.io/rocker-org/devcontainer-features/apt-packages:1.0.2": {
16
16
  "packages": "libnss3, libnspr4, libatk1.0-0t64, libatk-bridge2.0-0t64, libcups2t64, libdrm2, libdbus-1-3, libatspi2.0-0t64, libxcomposite1, libxdamage1, libxfixes3, libxrandr2, libgbm1, libxkbcommon0, libasound2t64, yamllint, shellcheck",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "root": true,
3
- "$schema": "https://biomejs.dev/schemas/2.6.7/schema.json",
3
+ "$schema": "https://biomejs.dev/schemas/2.6.8/schema.json",
4
4
  "vcs": {
5
5
  "enabled": true,
6
6
  "clientKind": "git",
@@ -21,9 +21,9 @@
21
21
  "react-dom": "19.3.1"
22
22
  },
23
23
  "devDependencies": {
24
- "@biomejs/biome": "2.6.7",
24
+ "@biomejs/biome": "2.6.8",
25
25
  "@eslint/eslintrc": "3.3.7",
26
- "@lousy-agents/mcp": "5.23.7",
26
+ "@lousy-agents/mcp": "5.23.9",
27
27
  "@modelcontextprotocol/server-sequential-thinking": "2026.8.31",
28
28
  "@testing-library/jest-dom": "7.0.1",
29
29
  "@testing-library/react": "16.3.3",
@@ -32,7 +32,7 @@
32
32
  "@types/react-dom": "19.3.0",
33
33
  "@vitejs/plugin-react": "6.3.0",
34
34
  "@vitest/ui": "5.1.0",
35
- "eslint": "10.14.0",
35
+ "eslint": "10.15.0",
36
36
  "eslint-config-next": "16.4.6",
37
37
  "happy-dom": "21.0.4",
38
38
  "jsdom": "31.0.1",