@ouro.bot/cli 0.1.0-alpha.576 → 0.1.0-alpha.578
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.json +12 -0
- package/dist/repertoire/bitwarden-store.js +41 -7
- package/package.json +1 -1
package/changelog.json
CHANGED
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"_note": "This changelog is maintained as part of the PR/version-bump workflow. Agent-curated, not auto-generated. Agents read this file directly via read_file to understand what changed between versions.",
|
|
3
3
|
"versions": [
|
|
4
|
+
{
|
|
5
|
+
"version": "0.1.0-alpha.578",
|
|
6
|
+
"changes": [
|
|
7
|
+
"Release preflight now requires releasable implementation changes to keep the current version as the top changelog entry and update `changelog.json` no earlier than the changed source, script, skill, or wrapper-code paths."
|
|
8
|
+
]
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"version": "0.1.0-alpha.577",
|
|
12
|
+
"changes": [
|
|
13
|
+
"Bitwarden vault access now reaps over-age `.ouro-bw.lock` files even when the recorded owner PID is still alive, preventing stale local locks from making provider and vault status look broken after the `bw` child process is gone."
|
|
14
|
+
]
|
|
15
|
+
},
|
|
4
16
|
{
|
|
5
17
|
"version": "0.1.0-alpha.576",
|
|
6
18
|
"changes": [
|
|
@@ -170,6 +170,7 @@ function isBwItemNotFoundError(error) {
|
|
|
170
170
|
const BW_LOCK_FILENAME = ".ouro-bw.lock";
|
|
171
171
|
const BW_LOCK_TIMEOUT_MS = 30_000;
|
|
172
172
|
const BW_LOCK_POLL_MS = 100;
|
|
173
|
+
const BW_LOCK_STALE_MS = BW_LOCK_TIMEOUT_MS * 2;
|
|
173
174
|
const BW_DATA_FILENAME = "data.json";
|
|
174
175
|
const BW_SYNC_MARKER_FILENAME = ".ouro-last-sync";
|
|
175
176
|
const BW_SYNC_FRESH_MS = 60_000;
|
|
@@ -184,6 +185,43 @@ function isPidAlive(pid) {
|
|
|
184
185
|
return false;
|
|
185
186
|
}
|
|
186
187
|
}
|
|
188
|
+
function parseBwLockPid(content) {
|
|
189
|
+
const pid = Number.parseInt(content, 10);
|
|
190
|
+
return Number.isFinite(pid) ? pid : undefined;
|
|
191
|
+
}
|
|
192
|
+
function getStaleBwLock(lockPath, content) {
|
|
193
|
+
const pid = parseBwLockPid(content);
|
|
194
|
+
const ageMs = Date.now() - fs.statSync(lockPath).mtimeMs;
|
|
195
|
+
if (pid !== undefined && !isPidAlive(pid)) {
|
|
196
|
+
return { reason: "dead-pid", pid, ageMs };
|
|
197
|
+
}
|
|
198
|
+
if (ageMs >= BW_LOCK_STALE_MS) {
|
|
199
|
+
return { reason: "stale-age", pid, ageMs };
|
|
200
|
+
}
|
|
201
|
+
return undefined;
|
|
202
|
+
}
|
|
203
|
+
function reapStaleBwLock(lockPath, staleLock) {
|
|
204
|
+
try {
|
|
205
|
+
fs.unlinkSync(lockPath);
|
|
206
|
+
}
|
|
207
|
+
catch {
|
|
208
|
+
// Race with another process cleaning the same stale lock.
|
|
209
|
+
/* v8 ignore next -- race: another process may reap the same stale lock between stat and unlink @preserve */
|
|
210
|
+
return;
|
|
211
|
+
}
|
|
212
|
+
(0, runtime_1.emitNervesEvent)({
|
|
213
|
+
level: "warn",
|
|
214
|
+
event: "repertoire.bw_lock_stale_reaped",
|
|
215
|
+
component: "repertoire",
|
|
216
|
+
message: "stale bw CLI lock reaped",
|
|
217
|
+
meta: {
|
|
218
|
+
lockPath,
|
|
219
|
+
reason: staleLock.reason,
|
|
220
|
+
pid: staleLock.pid === undefined ? "unknown" : String(staleLock.pid),
|
|
221
|
+
ageMs: String(Math.round(staleLock.ageMs)),
|
|
222
|
+
},
|
|
223
|
+
});
|
|
224
|
+
}
|
|
187
225
|
async function acquireFileLock(lockPath) {
|
|
188
226
|
const content = `${process.pid}\n`;
|
|
189
227
|
const deadline = Date.now() + BW_LOCK_TIMEOUT_MS;
|
|
@@ -201,13 +239,9 @@ async function acquireFileLock(lockPath) {
|
|
|
201
239
|
// Lock file exists -- check for stale lock
|
|
202
240
|
try {
|
|
203
241
|
const existing = fs.readFileSync(lockPath, "utf8").trim();
|
|
204
|
-
const
|
|
205
|
-
if (
|
|
206
|
-
|
|
207
|
-
try {
|
|
208
|
-
fs.unlinkSync(lockPath);
|
|
209
|
-
}
|
|
210
|
-
catch { /* race with another cleaner is fine */ }
|
|
242
|
+
const staleLock = getStaleBwLock(lockPath, existing);
|
|
243
|
+
if (staleLock) {
|
|
244
|
+
reapStaleBwLock(lockPath, staleLock);
|
|
211
245
|
continue;
|
|
212
246
|
}
|
|
213
247
|
}
|