omnius 1.0.933 → 1.0.934
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/dist/index.js +2 -2
- package/dist/update-worker-runtime.js +72 -4
- package/dist/update-worker.js +89 -6
- package/docs/getting-started/install.md +26 -0
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
[diffend] Oversized file quarantined before diffing.
|
|
2
2
|
name: package/dist/index.js
|
|
3
|
-
size:
|
|
4
|
-
sha256:
|
|
3
|
+
size: 41409090 bytes
|
|
4
|
+
sha256: 75db10244c46c9e454a1b4b1a16022fbf00325ce81bff455e75b5cff51ec04a0
|
|
@@ -305646,6 +305646,63 @@ function processIdentity2(pid) {
|
|
|
305646
305646
|
return;
|
|
305647
305647
|
}
|
|
305648
305648
|
}
|
|
305649
|
+
function interruptedGuardSnapshot(path3) {
|
|
305650
|
+
try {
|
|
305651
|
+
const before = lstatSync4(path3), owner = privateRecord(path3), metadata = lstatSync4(path3);
|
|
305652
|
+
if (!owner || before.dev !== metadata.dev || before.ino !== metadata.ino || !Number.isSafeInteger(owner.pid) || owner.pid <= 0 || typeof owner.nonce !== "string" || !/^[A-Za-z0-9_-]{1,128}$/.test(owner.nonce) || process.platform === "linux" && (typeof owner.process_identity !== "string" || !/^[a-f0-9]{8}(?:-[a-f0-9]{4}){3}-[a-f0-9]{12}:\d+$/i.test(owner.process_identity))) return null;
|
|
305653
|
+
return { owner, metadata };
|
|
305654
|
+
} catch {
|
|
305655
|
+
return null;
|
|
305656
|
+
}
|
|
305657
|
+
}
|
|
305658
|
+
function guardOwnerIsProvablyDead(owner) {
|
|
305659
|
+
if (!isPidAlive(owner.pid)) return true;
|
|
305660
|
+
if (process.platform !== "linux" || !owner.process_identity) return false;
|
|
305661
|
+
try {
|
|
305662
|
+
const boot = readFileSync8("/proc/sys/kernel/random/boot_id", "utf8").trim();
|
|
305663
|
+
if (owner.process_identity.slice(0, owner.process_identity.lastIndexOf(":")) !== boot) return true;
|
|
305664
|
+
const identity = processIdentity2(owner.pid);
|
|
305665
|
+
if (identity) return identity !== owner.process_identity;
|
|
305666
|
+
const raw = readFileSync8(`/proc/${owner.pid}/stat`, "utf8");
|
|
305667
|
+
return /^[ZX](?:\s|$)/.test(raw.slice(raw.lastIndexOf(")") + 2));
|
|
305668
|
+
} catch {
|
|
305669
|
+
return false;
|
|
305670
|
+
}
|
|
305671
|
+
}
|
|
305672
|
+
function recoverInterruptedUpdateGuard(path3) {
|
|
305673
|
+
const initial = interruptedGuardSnapshot(path3);
|
|
305674
|
+
if (!initial || !guardOwnerIsProvablyDead(initial.owner)) return false;
|
|
305675
|
+
const recoveryPath = path3 + ".recovery", nonce = randomUUID4();
|
|
305676
|
+
let fd;
|
|
305677
|
+
try {
|
|
305678
|
+
fd = openSync4(recoveryPath, constants3.O_WRONLY | constants3.O_CREAT | constants3.O_EXCL | constants3.O_NOFOLLOW, 384);
|
|
305679
|
+
} catch (error) {
|
|
305680
|
+
if (error.code !== "EEXIST") throw error;
|
|
305681
|
+
const busy = new UpdateOwnershipBusyError(`Update guard recovery is active or was interrupted. Inspect the private ${recoveryPath} owner record before retrying.`);
|
|
305682
|
+
Object.assign(busy, { guardPath: recoveryPath });
|
|
305683
|
+
throw busy;
|
|
305684
|
+
}
|
|
305685
|
+
const claimed = fstatSync2(fd);
|
|
305686
|
+
let recorded = false;
|
|
305687
|
+
try {
|
|
305688
|
+
writeFileSync6(fd, JSON.stringify({ pid: process.pid, process_identity: processIdentity2(process.pid), nonce }));
|
|
305689
|
+
fsyncSync2(fd);
|
|
305690
|
+
recorded = true;
|
|
305691
|
+
const current = interruptedGuardSnapshot(path3);
|
|
305692
|
+
if (!current || current.metadata.dev !== initial.metadata.dev || current.metadata.ino !== initial.metadata.ino || current.owner.nonce !== initial.owner.nonce || current.owner.pid !== initial.owner.pid || current.owner.process_identity !== initial.owner.process_identity || !guardOwnerIsProvablyDead(current.owner)) return false;
|
|
305693
|
+
const final = lstatSync4(path3);
|
|
305694
|
+
if (final.dev !== current.metadata.dev || final.ino !== current.metadata.ino) return false;
|
|
305695
|
+
unlinkSync4(path3);
|
|
305696
|
+
return true;
|
|
305697
|
+
} finally {
|
|
305698
|
+
try {
|
|
305699
|
+
const current = lstatSync4(recoveryPath);
|
|
305700
|
+
if (current.dev === claimed.dev && current.ino === claimed.ino && (!recorded || privateRecord(recoveryPath)?.nonce === nonce)) unlinkSync4(recoveryPath);
|
|
305701
|
+
} catch {
|
|
305702
|
+
}
|
|
305703
|
+
closeSync4(fd);
|
|
305704
|
+
}
|
|
305705
|
+
}
|
|
305649
305706
|
function withUpdateOwnership(paths, mutation) {
|
|
305650
305707
|
ensurePrivateDirectories(paths);
|
|
305651
305708
|
const path3 = paths.lockFile + ".guard", nonce = randomUUID4();
|
|
@@ -305654,12 +305711,23 @@ function withUpdateOwnership(paths, mutation) {
|
|
|
305654
305711
|
fd = openSync4(path3, constants3.O_WRONLY | constants3.O_CREAT | constants3.O_EXCL | constants3.O_NOFOLLOW, 384);
|
|
305655
305712
|
} catch (error) {
|
|
305656
305713
|
if (error.code === "EEXIST") {
|
|
305657
|
-
|
|
305658
|
-
|
|
305659
|
-
|
|
305714
|
+
if (recoverInterruptedUpdateGuard(path3)) {
|
|
305715
|
+
try {
|
|
305716
|
+
fd = openSync4(path3, constants3.O_WRONLY | constants3.O_CREAT | constants3.O_EXCL | constants3.O_NOFOLLOW, 384);
|
|
305717
|
+
} catch (next) {
|
|
305718
|
+
if (next.code !== "EEXIST") throw next;
|
|
305719
|
+
}
|
|
305720
|
+
}
|
|
305721
|
+
if (fd === void 0) {
|
|
305722
|
+
const busy = new UpdateOwnershipBusyError(`Update ownership is busy or its guard was interrupted. Retry; if it persists, inspect the private ${path3} owner record before removing that guard.`);
|
|
305723
|
+
Object.assign(busy, { guardPath: path3 });
|
|
305724
|
+
throw busy;
|
|
305725
|
+
}
|
|
305726
|
+
} else {
|
|
305727
|
+
throw error;
|
|
305660
305728
|
}
|
|
305661
|
-
throw error;
|
|
305662
305729
|
}
|
|
305730
|
+
if (fd === void 0) throw new Error("Update ownership descriptor is unavailable");
|
|
305663
305731
|
let original;
|
|
305664
305732
|
try {
|
|
305665
305733
|
original = fstatSync2(fd);
|
package/dist/update-worker.js
CHANGED
|
@@ -161,6 +161,63 @@ function processIdentity(pid) {
|
|
|
161
161
|
return;
|
|
162
162
|
}
|
|
163
163
|
}
|
|
164
|
+
function interruptedGuardSnapshot(path) {
|
|
165
|
+
try {
|
|
166
|
+
const before = lstatSync(path), owner = privateRecord(path), metadata = lstatSync(path);
|
|
167
|
+
if (!owner || before.dev !== metadata.dev || before.ino !== metadata.ino || !Number.isSafeInteger(owner.pid) || owner.pid <= 0 || typeof owner.nonce !== "string" || !/^[A-Za-z0-9_-]{1,128}$/.test(owner.nonce) || process.platform === "linux" && (typeof owner.process_identity !== "string" || !/^[a-f0-9]{8}(?:-[a-f0-9]{4}){3}-[a-f0-9]{12}:\d+$/i.test(owner.process_identity))) return null;
|
|
168
|
+
return { owner, metadata };
|
|
169
|
+
} catch {
|
|
170
|
+
return null;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
function guardOwnerIsProvablyDead(owner) {
|
|
174
|
+
if (!isPidAlive(owner.pid)) return true;
|
|
175
|
+
if (process.platform !== "linux" || !owner.process_identity) return false;
|
|
176
|
+
try {
|
|
177
|
+
const boot = readFileSync("/proc/sys/kernel/random/boot_id", "utf8").trim();
|
|
178
|
+
if (owner.process_identity.slice(0, owner.process_identity.lastIndexOf(":")) !== boot) return true;
|
|
179
|
+
const identity = processIdentity(owner.pid);
|
|
180
|
+
if (identity) return identity !== owner.process_identity;
|
|
181
|
+
const raw = readFileSync(`/proc/${owner.pid}/stat`, "utf8");
|
|
182
|
+
return /^[ZX](?:\s|$)/.test(raw.slice(raw.lastIndexOf(")") + 2));
|
|
183
|
+
} catch {
|
|
184
|
+
return false;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
function recoverInterruptedUpdateGuard(path) {
|
|
188
|
+
const initial = interruptedGuardSnapshot(path);
|
|
189
|
+
if (!initial || !guardOwnerIsProvablyDead(initial.owner)) return false;
|
|
190
|
+
const recoveryPath = path + ".recovery", nonce = randomUUID();
|
|
191
|
+
let fd;
|
|
192
|
+
try {
|
|
193
|
+
fd = openSync(recoveryPath, constants.O_WRONLY | constants.O_CREAT | constants.O_EXCL | constants.O_NOFOLLOW, 384);
|
|
194
|
+
} catch (error) {
|
|
195
|
+
if (error.code !== "EEXIST") throw error;
|
|
196
|
+
const busy = new UpdateOwnershipBusyError(`Update guard recovery is active or was interrupted. Inspect the private ${recoveryPath} owner record before retrying.`);
|
|
197
|
+
Object.assign(busy, { guardPath: recoveryPath });
|
|
198
|
+
throw busy;
|
|
199
|
+
}
|
|
200
|
+
const claimed = fstatSync(fd);
|
|
201
|
+
let recorded = false;
|
|
202
|
+
try {
|
|
203
|
+
writeFileSync(fd, JSON.stringify({ pid: process.pid, process_identity: processIdentity(process.pid), nonce }));
|
|
204
|
+
fsyncSync(fd);
|
|
205
|
+
recorded = true;
|
|
206
|
+
const current = interruptedGuardSnapshot(path);
|
|
207
|
+
if (!current || current.metadata.dev !== initial.metadata.dev || current.metadata.ino !== initial.metadata.ino || current.owner.nonce !== initial.owner.nonce || current.owner.pid !== initial.owner.pid || current.owner.process_identity !== initial.owner.process_identity || !guardOwnerIsProvablyDead(current.owner)) return false;
|
|
208
|
+
const final = lstatSync(path);
|
|
209
|
+
if (final.dev !== current.metadata.dev || final.ino !== current.metadata.ino) return false;
|
|
210
|
+
unlinkSync(path);
|
|
211
|
+
return true;
|
|
212
|
+
} finally {
|
|
213
|
+
try {
|
|
214
|
+
const current = lstatSync(recoveryPath);
|
|
215
|
+
if (current.dev === claimed.dev && current.ino === claimed.ino && (!recorded || privateRecord(recoveryPath)?.nonce === nonce)) unlinkSync(recoveryPath);
|
|
216
|
+
} catch {
|
|
217
|
+
}
|
|
218
|
+
closeSync(fd);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
164
221
|
function withUpdateOwnership(paths, mutation) {
|
|
165
222
|
ensurePrivateDirectories(paths);
|
|
166
223
|
const path = paths.lockFile + ".guard", nonce = randomUUID();
|
|
@@ -169,12 +226,23 @@ function withUpdateOwnership(paths, mutation) {
|
|
|
169
226
|
fd = openSync(path, constants.O_WRONLY | constants.O_CREAT | constants.O_EXCL | constants.O_NOFOLLOW, 384);
|
|
170
227
|
} catch (error) {
|
|
171
228
|
if (error.code === "EEXIST") {
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
229
|
+
if (recoverInterruptedUpdateGuard(path)) {
|
|
230
|
+
try {
|
|
231
|
+
fd = openSync(path, constants.O_WRONLY | constants.O_CREAT | constants.O_EXCL | constants.O_NOFOLLOW, 384);
|
|
232
|
+
} catch (next) {
|
|
233
|
+
if (next.code !== "EEXIST") throw next;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
if (fd === void 0) {
|
|
237
|
+
const busy = new UpdateOwnershipBusyError(`Update ownership is busy or its guard was interrupted. Retry; if it persists, inspect the private ${path} owner record before removing that guard.`);
|
|
238
|
+
Object.assign(busy, { guardPath: path });
|
|
239
|
+
throw busy;
|
|
240
|
+
}
|
|
241
|
+
} else {
|
|
242
|
+
throw error;
|
|
175
243
|
}
|
|
176
|
-
throw error;
|
|
177
244
|
}
|
|
245
|
+
if (fd === void 0) throw new Error("Update ownership descriptor is unavailable");
|
|
178
246
|
let original;
|
|
179
247
|
try {
|
|
180
248
|
original = fstatSync(fd);
|
|
@@ -401,7 +469,7 @@ function formatPublicUpdateWorkerFailure(error, env = process.env) {
|
|
|
401
469
|
if (prefix) line = line.replace(/^Error(?: \[[A-Z0-9_]+\])?:\s*/, "");
|
|
402
470
|
return (prefix + line.replace(/(?:https?|wss?|file):\/\/[^\s"'<>]+/gi, "[URL omitted]")).slice(0, 384);
|
|
403
471
|
}
|
|
404
|
-
async function runUpdateWorkerBootstrap(args = process.argv.slice(2)) {
|
|
472
|
+
async function runUpdateWorkerBootstrap(args = process.argv.slice(2), options = {}) {
|
|
405
473
|
let operationId, paths, adopted = false, enteredRuntime = false;
|
|
406
474
|
try {
|
|
407
475
|
const input = parseUpdateWorkerArguments(args);
|
|
@@ -418,7 +486,22 @@ async function runUpdateWorkerBootstrap(args = process.argv.slice(2)) {
|
|
|
418
486
|
return;
|
|
419
487
|
}
|
|
420
488
|
const runtimeUrl = new URL("./update-worker-runtime.js", import.meta.url).href;
|
|
421
|
-
const
|
|
489
|
+
const requestedTimeout = options.runtimeInitializationTimeoutMs;
|
|
490
|
+
const timeoutMs = typeof requestedTimeout === "number" && Number.isFinite(requestedTimeout) ? Math.max(1, Math.min(3e4, requestedTimeout)) : 3e4;
|
|
491
|
+
let initializationTimer;
|
|
492
|
+
let runtime;
|
|
493
|
+
try {
|
|
494
|
+
runtime = await Promise.race([
|
|
495
|
+
import(runtimeUrl),
|
|
496
|
+
new Promise((_resolve, reject) => {
|
|
497
|
+
initializationTimer = setTimeout(() => reject(new Error(
|
|
498
|
+
`Update worker runtime initialization timed out after ${timeoutMs}ms; no installer was started`
|
|
499
|
+
)), timeoutMs);
|
|
500
|
+
})
|
|
501
|
+
]);
|
|
502
|
+
} finally {
|
|
503
|
+
clearTimeout(initializationTimer);
|
|
504
|
+
}
|
|
422
505
|
if (typeof runtime.runUpdateWorkerRuntime !== "function")
|
|
423
506
|
throw new Error("Packaged update runtime export is missing");
|
|
424
507
|
enteredRuntime = true;
|
|
@@ -117,3 +117,29 @@ pnpm --filter @omnius/execution exec vitest run tests/skill-discovery.test.ts
|
|
|
117
117
|
Omnius stores project runtime state under `.omnius/`. This directory includes settings, jobs, context, sponsor state, scoped Telegram persona state, and generated connector artifacts.
|
|
118
118
|
|
|
119
119
|
Do not commit `.omnius/`. Omnius adds it to `.gitignore` automatically for repositories that have or later create a `.gitignore`.
|
|
120
|
+
|
|
121
|
+
## Recover A Blocked Automatic Update
|
|
122
|
+
|
|
123
|
+
If an older installation repeatedly opens **Waiting for the update worker**,
|
|
124
|
+
use another shell in the affected project to disable automatic installation:
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
omnius config set updateMode manual
|
|
128
|
+
omnius config set updateMode manual --local
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
Close and relaunch the TUI. Manual mode still reports available releases; it
|
|
132
|
+
installs only when requested. After installing a release with the recovery fix,
|
|
133
|
+
`/update auto` restores automatic updates.
|
|
134
|
+
|
|
135
|
+
On Linux, update recovery checks the worker's boot and process-start identity.
|
|
136
|
+
A valid ownership guard left by a dead process can be recovered after a crash
|
|
137
|
+
or reboot. A live, incomplete or replaced guard is retained and reported as an
|
|
138
|
+
error with a Close action instead of an indefinite queued dialog. Avoid deleting
|
|
139
|
+
the update state or locks while an installer may still be running.
|
|
140
|
+
|
|
141
|
+
Worker runtime initialization has a 30-second limit before an installer starts.
|
|
142
|
+
Package preparation and a running installation retain their own lifecycle; the
|
|
143
|
+
initialization limit does not interrupt them. The progress view distinguishes
|
|
144
|
+
dispatch, runtime initialization and package preparation. Its elapsed counter
|
|
145
|
+
measures time, not proof of worker activity.
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "omnius",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.934",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "omnius",
|
|
9
|
-
"version": "1.0.
|
|
9
|
+
"version": "1.0.934",
|
|
10
10
|
"bundleDependencies": [
|
|
11
11
|
"image-to-ascii"
|
|
12
12
|
],
|
package/package.json
CHANGED