omnius 1.0.933 → 1.0.935

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 CHANGED
@@ -1,4 +1,4 @@
1
1
  [diffend] Oversized file quarantined before diffing.
2
2
  name: package/dist/index.js
3
- size: 41404006 bytes
4
- sha256: be58a5d5d2b8a9eef20e5f59cd795bec65dd19e397280be9577570655f952bd0
3
+ size: 41409076 bytes
4
+ sha256: 8208308a2da0a8580126271f6c62da48933ede40e6a199ebfe4a4fca1955af75
@@ -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,21 @@ 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
- 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.`);
305658
- Object.assign(busy, { guardPath: path3 });
305659
- throw busy;
305660
- }
305661
- throw error;
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 throw error;
305662
305727
  }
305728
+ if (fd === void 0) throw new Error("Update ownership descriptor is unavailable");
305663
305729
  let original;
305664
305730
  try {
305665
305731
  original = fstatSync2(fd);
@@ -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,21 @@ 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
- 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.`);
173
- Object.assign(busy, { guardPath: path });
174
- throw busy;
175
- }
176
- throw error;
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 throw error;
177
242
  }
243
+ if (fd === void 0) throw new Error("Update ownership descriptor is unavailable");
178
244
  let original;
179
245
  try {
180
246
  original = fstatSync(fd);
@@ -401,7 +467,7 @@ function formatPublicUpdateWorkerFailure(error, env = process.env) {
401
467
  if (prefix) line = line.replace(/^Error(?: \[[A-Z0-9_]+\])?:\s*/, "");
402
468
  return (prefix + line.replace(/(?:https?|wss?|file):\/\/[^\s"'<>]+/gi, "[URL omitted]")).slice(0, 384);
403
469
  }
404
- async function runUpdateWorkerBootstrap(args = process.argv.slice(2)) {
470
+ async function runUpdateWorkerBootstrap(args = process.argv.slice(2), options = {}) {
405
471
  let operationId, paths, adopted = false, enteredRuntime = false;
406
472
  try {
407
473
  const input = parseUpdateWorkerArguments(args);
@@ -418,7 +484,22 @@ async function runUpdateWorkerBootstrap(args = process.argv.slice(2)) {
418
484
  return;
419
485
  }
420
486
  const runtimeUrl = new URL("./update-worker-runtime.js", import.meta.url).href;
421
- const runtime = await import(runtimeUrl);
487
+ const requestedTimeout = options.runtimeInitializationTimeoutMs;
488
+ const timeoutMs = typeof requestedTimeout === "number" && Number.isFinite(requestedTimeout) ? Math.max(1, Math.min(3e4, requestedTimeout)) : 3e4;
489
+ let initializationTimer;
490
+ let runtime;
491
+ try {
492
+ runtime = await Promise.race([
493
+ import(runtimeUrl),
494
+ new Promise((_resolve, reject) => {
495
+ initializationTimer = setTimeout(() => reject(new Error(
496
+ `Update worker runtime initialization timed out after ${timeoutMs}ms; no installer was started`
497
+ )), timeoutMs);
498
+ })
499
+ ]);
500
+ } finally {
501
+ clearTimeout(initializationTimer);
502
+ }
422
503
  if (typeof runtime.runUpdateWorkerRuntime !== "function")
423
504
  throw new Error("Packaged update runtime export is missing");
424
505
  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.
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "omnius",
3
- "version": "1.0.933",
3
+ "version": "1.0.935",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "omnius",
9
- "version": "1.0.933",
9
+ "version": "1.0.935",
10
10
  "bundleDependencies": [
11
11
  "image-to-ascii"
12
12
  ],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "omnius",
3
- "version": "1.0.933",
3
+ "version": "1.0.935",
4
4
  "description": "AI coding agent powered by open-source models (Ollama/vLLM) — interactive TUI with agentic tool-calling loop",
5
5
  "type": "module",
6
6
  "main": "./dist/library.js",