omnius 1.0.909 → 1.0.910

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: 39004422 bytes
4
- sha256: 7b47ea6c12b34f6ae96d515d82c73c53e21cc786a0b30c481c9344d6cf149470
3
+ size: 39006464 bytes
4
+ sha256: 406d395ffae2c352b41163f3fa24a87080fa07647cdac30673e5845e70329770
package/dist/library.js CHANGED
@@ -406175,6 +406175,19 @@ ${blob}
406175
406175
  if (registeredTool.name === "generate_image") {
406176
406176
  this.maybeInstallImagePromptExpander(registeredTool);
406177
406177
  }
406178
+ this._feedAvailableTools();
406179
+ }
406180
+ /** Tools that reference other tools describe only those actually registered here. */
406181
+ _feedAvailableTools() {
406182
+ const names = /* @__PURE__ */ new Set();
406183
+ for (const tool of this.tools.values()) {
406184
+ names.add(tool.name);
406185
+ for (const alias of tool.aliases ?? [])
406186
+ names.add(alias);
406187
+ }
406188
+ for (const tool of this.tools.values())
406189
+ if (tool.setAvailableTools)
406190
+ tool.description = tool.setAvailableTools(names);
406178
406191
  }
406179
406192
  /** Scope-bound tool notes/state follow the admitted run and every new epoch. */
406180
406193
  _rebindToolExecutionScopes() {
@@ -430084,6 +430097,7 @@ ${result}${unavailableNote}`;
430084
430097
  });
430085
430098
  } else {
430086
430099
  this.tools.delete("tool_search");
430100
+ this._feedAvailableTools();
430087
430101
  }
430088
430102
  const finalContracts = this._activeCanonicalToolContracts(projectionTurn);
430089
430103
  const searchPromotedNames = /* @__PURE__ */ new Set();
@@ -435837,6 +435851,9 @@ function adaptExecutionTool(tool, options = {}) {
435837
435851
  if (typeof tool.bindExecutionScope === "function") {
435838
435852
  adapted.bindExecutionScope = (scope) => tool.bindExecutionScope(scope);
435839
435853
  }
435854
+ if (typeof tool.setAvailableTools === "function") {
435855
+ adapted.setAvailableTools = (names) => adapted.description = tool.setAvailableTools(names);
435856
+ }
435840
435857
  if (typeof tool.prepareDurableWorkIntent === "function") {
435841
435858
  adapted.prepareDurableWorkIntent = (args, context) => tool.prepareDurableWorkIntent(args, context);
435842
435859
  }
@@ -303234,7 +303234,7 @@ import {
303234
303234
  fchmodSync,
303235
303235
  fstatSync as fstatSync2,
303236
303236
  fsyncSync as fsyncSync2,
303237
- lstatSync as lstatSync2,
303237
+ lstatSync as lstatSync3,
303238
303238
  readlinkSync as readlinkSync2,
303239
303239
  mkdirSync as mkdirSync6,
303240
303240
  openSync as openSync4,
@@ -303303,6 +303303,26 @@ function compareOmniusVersions(left, right) {
303303
303303
  return 0;
303304
303304
  }
303305
303305
 
303306
+ // packages/cli/src/user-systemd-environment.ts
303307
+ import { lstatSync } from "node:fs";
303308
+ function userManagerEnvironment(env, uid = process.getuid?.(), inspect = lstatSync) {
303309
+ if (env["XDG_RUNTIME_DIR"] && env["DBUS_SESSION_BUS_ADDRESS"]) return env;
303310
+ if (uid === void 0 || !Number.isSafeInteger(uid) || uid < 0) return env;
303311
+ const runtimeDir = env["XDG_RUNTIME_DIR"] || `/run/user/${uid}`;
303312
+ const bus = `${runtimeDir}/bus`;
303313
+ try {
303314
+ const socket = inspect(bus);
303315
+ if (!socket.isSocket() || socket.uid !== uid) return env;
303316
+ } catch {
303317
+ return env;
303318
+ }
303319
+ return {
303320
+ ...env,
303321
+ XDG_RUNTIME_DIR: runtimeDir,
303322
+ DBUS_SESSION_BUS_ADDRESS: env["DBUS_SESSION_BUS_ADDRESS"] || `unix:path=${bus}`
303323
+ };
303324
+ }
303325
+
303306
303326
  // packages/cli/src/npm-recovery-retention.ts
303307
303327
  import { lstat, readdir, readFile, rm } from "node:fs/promises";
303308
303328
  import { join as join16 } from "node:path";
@@ -303335,7 +303355,7 @@ async function pruneStaleUpdateRecoveries(modulesRoot, options = {}) {
303335
303355
 
303336
303356
  // packages/cli/src/npm-install-recovery.ts
303337
303357
  import { createHash as createHash2, randomUUID as randomUUID2 } from "node:crypto";
303338
- import { closeSync as closeSync3, constants, fstatSync, fsyncSync, ftruncateSync, lstatSync, openSync as openSync3, readFileSync as readFileSync7, readdirSync, readSync as readSync2, unlinkSync as unlinkSync3, writeFileSync as writeFileSync5 } from "node:fs";
303358
+ import { closeSync as closeSync3, constants, fstatSync, fsyncSync, ftruncateSync, lstatSync as lstatSync2, openSync as openSync3, readFileSync as readFileSync7, readdirSync, readSync as readSync2, unlinkSync as unlinkSync3, writeFileSync as writeFileSync5 } from "node:fs";
303339
303359
  import { chmod, cp, lstat as lstat2, mkdir, readdir as readdir2, realpath, rename, rm as rm2 } from "node:fs/promises";
303340
303360
  import { basename as basename8, dirname as dirname9, isAbsolute as isAbsolute7, join as join17, resolve as resolve11 } from "node:path";
303341
303361
  var NpmInstallBusyError = class extends Error {
@@ -303477,7 +303497,7 @@ function processIdentity(pid) {
303477
303497
  }
303478
303498
  }
303479
303499
  function readInstallOwner(path3) {
303480
- const before = lstatSync(path3);
303500
+ const before = lstatSync2(path3);
303481
303501
  const valid = (value) => value.isFile() && !value.isSymbolicLink() && value.size > 0 && value.size <= 4096 && value.nlink === 1 && (process.platform === "win32" || value.uid === process.getuid?.() && (value.mode & 63) === 0);
303482
303502
  if (!valid(before)) throw new NpmInstallBusyError("The npm install owner record is unsafe or unknown; it was retained for inspection.");
303483
303503
  const fd = openSync3(path3, constants.O_RDONLY | constants.O_NOFOLLOW | constants.O_NONBLOCK);
@@ -303520,9 +303540,9 @@ function provedAbsent(owner) {
303520
303540
  var ABANDONED_EMPTY_GUARD_MS = 6e4;
303521
303541
  function removeAbandonedEmptyGuard(guardPath) {
303522
303542
  try {
303523
- const metadata = lstatSync(guardPath);
303543
+ const metadata = lstatSync2(guardPath);
303524
303544
  if (!metadata.isFile() || metadata.size !== 0 || metadata.nlink !== 1 || metadata.uid !== process.getuid?.() || (metadata.mode & 63) !== 0 || Date.now() - metadata.mtimeMs < ABANDONED_EMPTY_GUARD_MS) return false;
303525
- const current = lstatSync(guardPath);
303545
+ const current = lstatSync2(guardPath);
303526
303546
  if (!sameIdentity(metadata, current) || current.size !== 0) return false;
303527
303547
  unlinkSync3(guardPath);
303528
303548
  return true;
@@ -303540,7 +303560,7 @@ async function acquireNpmInstallLease(modulesRoot, options = {}) {
303540
303560
  if (!sameIdentity(logicalMetadata, rootMetadata)) throw new Error("npm modules root changed before installer admission.");
303541
303561
  const lockPath = join17(root, ".omnius-install.lock"), guardPath = lockPath + ".guard", nonce = randomUUID2();
303542
303562
  const assertRoot = () => {
303543
- const current = lstatSync(root);
303563
+ const current = lstatSync2(root);
303544
303564
  assertOwnedDirectory(current, "global modules root");
303545
303565
  if (!sameIdentity(rootMetadata, current)) throw new Error("npm modules root changed; no installer may proceed.");
303546
303566
  };
@@ -303567,7 +303587,7 @@ async function acquireNpmInstallLease(modulesRoot, options = {}) {
303567
303587
  } finally {
303568
303588
  try {
303569
303589
  if (!recorded) {
303570
- if (sameIdentity(metadata, lstatSync(guardPath))) unlinkSync3(guardPath);
303590
+ if (sameIdentity(metadata, lstatSync2(guardPath))) unlinkSync3(guardPath);
303571
303591
  } else {
303572
303592
  const current = readInstallOwner(guardPath);
303573
303593
  if (sameIdentity(metadata, current.metadata) && current.owner.nonce === guardNonce) unlinkSync3(guardPath);
@@ -303657,7 +303677,7 @@ var REQUIRED_OMNIUS_RUNTIME_FILES = [
303657
303677
  "dist/update-worker-runtime.js"
303658
303678
  ];
303659
303679
  function hashOwnedFile(path3) {
303660
- const before = lstatSync(path3);
303680
+ const before = lstatSync2(path3);
303661
303681
  const valid = (metadata) => metadata.isFile() && !metadata.isSymbolicLink() && metadata.size > 0 && metadata.size <= 128 * 1024 * 1024 && (process.platform === "win32" || metadata.uid === process.getuid?.() && (metadata.mode & 2) === 0);
303662
303682
  if (!valid(before)) throw new Error(`Omnius runtime file is missing or unsafe: ${path3}`);
303663
303683
  const fd = openSync3(path3, constants.O_RDONLY | constants.O_NOFOLLOW | constants.O_NONBLOCK);
@@ -303687,10 +303707,10 @@ function inspectNpmRuntimeInstallation(packagePath) {
303687
303707
  return inspectRuntimeDirectory(canonical, root);
303688
303708
  }
303689
303709
  function inspectRuntimeDirectory(canonical, root) {
303690
- const before = lstatSync(canonical);
303691
- assertOwnedDirectory(lstatSync(root), "global modules root");
303710
+ const before = lstatSync2(canonical);
303711
+ assertOwnedDirectory(lstatSync2(root), "global modules root");
303692
303712
  assertOwnedDirectory(before, "Omnius package");
303693
- assertOwnedDirectory(lstatSync(join17(canonical, "dist")), "Omnius runtime");
303713
+ assertOwnedDirectory(lstatSync2(join17(canonical, "dist")), "Omnius runtime");
303694
303714
  const files = {};
303695
303715
  for (const file of REQUIRED_OMNIUS_RUNTIME_FILES) files[file] = hashOwnedFile(join17(canonical, file));
303696
303716
  const manifest = JSON.parse(readFileSync7(join17(canonical, "package.json"), "utf8"));
@@ -303700,11 +303720,11 @@ function inspectRuntimeDirectory(canonical, root) {
303700
303720
  if (typeof binTarget !== "string" || !/^[A-Za-z0-9_./-]+$/.test(binTarget) || isAbsolute7(binTarget) || binTarget.split("/").some((part) => !part || part === ".." || part === "."))
303701
303721
  throw new Error("Omnius runtime manifest has no safe declared omnius executable.");
303702
303722
  for (const directory of binTarget.split("/").slice(0, -1).reduce((paths, part) => [...paths, join17(paths.at(-1) ?? canonical, part)], []))
303703
- assertOwnedDirectory(lstatSync(directory), "Omnius executable directory");
303723
+ assertOwnedDirectory(lstatSync2(directory), "Omnius executable directory");
303704
303724
  files[binTarget] ??= hashOwnedFile(join17(canonical, binTarget));
303705
303725
  if (!readFileSync7(join17(canonical, "dist/update-worker.js"), "utf8").includes("omnius.update-worker-bootstrap.v2"))
303706
303726
  throw new Error("Omnius runtime has no compatible update worker bootstrap.");
303707
- if (hashOwnedFile(join17(canonical, "package.json")) !== files["package.json"] || !sameIdentity(before, lstatSync(canonical)))
303727
+ if (hashOwnedFile(join17(canonical, "package.json")) !== files["package.json"] || !sameIdentity(before, lstatSync2(canonical)))
303708
303728
  throw new Error("Omnius package changed during runtime verification.");
303709
303729
  return {
303710
303730
  modulesRoot: root,
@@ -303779,19 +303799,19 @@ async function restoreVerifiedNpmInstallation(snapshot, options) {
303779
303799
  if (!validPath(path3)) return false;
303780
303800
  let metadata;
303781
303801
  try {
303782
- metadata = lstatSync(path3);
303802
+ metadata = lstatSync2(path3);
303783
303803
  } catch (error) {
303784
303804
  if (error.code === "ENOENT") return false;
303785
303805
  throw error;
303786
303806
  }
303787
303807
  if (metadata.dev !== snapshot.device || metadata.ino !== snapshot.inode) return false;
303788
303808
  assertOwnedDirectory(metadata, "prior Omnius package");
303789
- assertOwnedDirectory(lstatSync(join17(path3, "dist")), "prior Omnius runtime");
303809
+ assertOwnedDirectory(lstatSync2(join17(path3, "dist")), "prior Omnius runtime");
303790
303810
  for (const [file, digest] of Object.entries(snapshot.files)) {
303791
303811
  if (!/^[A-Za-z0-9_./-]+$/.test(file) || isAbsolute7(file) || file.split("/").some((part) => !part || part === "." || part === "..") || hashOwnedFile(join17(path3, file)) !== digest) throw new Error("Prior Omnius runtime changed; restoration was held.");
303792
303812
  }
303793
303813
  for (const directory of snapshot.binTarget.split("/").slice(0, -1).reduce((paths, part) => [...paths, join17(paths.at(-1) ?? path3, part)], []))
303794
- assertOwnedDirectory(lstatSync(directory), "prior Omnius executable directory");
303814
+ assertOwnedDirectory(lstatSync2(directory), "prior Omnius executable directory");
303795
303815
  return true;
303796
303816
  };
303797
303817
  const source = [canonical, retiredNpmPackagePath(canonical), ...(options.backups ?? []).map((backup) => backup.backupPath)].find(matches);
@@ -303884,7 +303904,7 @@ function watchUpdateCancellation(operationId, paths = resolveUpdatePaths()) {
303884
303904
  const check = () => {
303885
303905
  if (controller.signal.aborted) return;
303886
303906
  try {
303887
- const metadata = lstatSync2(path3);
303907
+ const metadata = lstatSync3(path3);
303888
303908
  if (!metadata.isFile() || metadata.isSymbolicLink() || metadata.size > 1024) return;
303889
303909
  const request = JSON.parse(readFileSync8(path3, "utf8"));
303890
303910
  const state = readUpdateState(paths);
@@ -303919,7 +303939,7 @@ function resolveUpdatePaths(env = process.env, platform2 = process.platform, hom
303919
303939
  function ensurePrivateDirectories(paths) {
303920
303940
  for (const path3 of [paths.stateDir, paths.cacheDir]) {
303921
303941
  mkdirSync6(path3, { recursive: true, mode: 448 });
303922
- const before = lstatSync2(path3);
303942
+ const before = lstatSync3(path3);
303923
303943
  if (!before.isDirectory() || before.isSymbolicLink() || process.platform !== "win32" && (before.uid !== process.getuid?.() || (before.mode & 18) !== 0)) throw new Error("Update coordination directories must be owned and not writable by other users");
303924
303944
  const fd = openSync4(path3, constants2.O_RDONLY | constants2.O_DIRECTORY | constants2.O_NOFOLLOW);
303925
303945
  try {
@@ -303934,7 +303954,7 @@ function ensurePrivateDirectories(paths) {
303934
303954
  function privateRecord(path3, limit = 4096) {
303935
303955
  let before;
303936
303956
  try {
303937
- before = lstatSync2(path3);
303957
+ before = lstatSync3(path3);
303938
303958
  } catch (error) {
303939
303959
  if (error.code === "ENOENT") return null;
303940
303960
  throw error;
@@ -303995,7 +304015,7 @@ function withUpdateOwnership(paths, mutation) {
303995
304015
  }
303996
304016
  const created = () => {
303997
304017
  try {
303998
- const current = lstatSync2(path3);
304018
+ const current = lstatSync3(path3);
303999
304019
  return current.ino === original.ino && current.dev === original.dev;
304000
304020
  } catch {
304001
304021
  return false;
@@ -304333,11 +304353,11 @@ function restoreOmniusExecutableLink(prefix, installation) {
304333
304353
  }
304334
304354
  const directory = dirname10(executable);
304335
304355
  if (!existsSync7(directory)) mkdirSync6(directory, { recursive: false, mode: 493 });
304336
- const metadata = lstatSync2(directory);
304356
+ const metadata = lstatSync3(directory);
304337
304357
  if (!metadata.isDirectory() || metadata.isSymbolicLink() || metadata.uid !== process.getuid?.() || (metadata.mode & 2) !== 0)
304338
304358
  throw new Error("The Omnius executable directory is unsafe; no link was changed.");
304339
304359
  try {
304340
- const existing = lstatSync2(executable);
304360
+ const existing = lstatSync3(executable);
304341
304361
  if (!existing.isSymbolicLink() || existing.uid !== process.getuid?.() || resolve12(directory, readlinkSync2(executable)) !== target)
304342
304362
  throw new Error("A different executable occupies the Omnius bin path; it was retained.");
304343
304363
  } catch (error) {
@@ -305309,7 +305329,7 @@ var PROVIDER_PRESETS = [
305309
305329
  ];
305310
305330
 
305311
305331
  // packages/cli/src/provider-credentials.ts
305312
- import { constants as constants3, closeSync as closeSync5, existsSync as existsSync8, fstatSync as fstatSync3, fsyncSync as fsyncSync3, lstatSync as lstatSync3, mkdirSync as mkdirSync7, openSync as openSync5, readFileSync as readFileSync9, readdirSync as readdirSync2, renameSync as renameSync6, unlinkSync as unlinkSync5, writeFileSync as writeFileSync7 } from "node:fs";
305332
+ import { constants as constants3, closeSync as closeSync5, existsSync as existsSync8, fstatSync as fstatSync3, fsyncSync as fsyncSync3, lstatSync as lstatSync4, mkdirSync as mkdirSync7, openSync as openSync5, readFileSync as readFileSync9, readdirSync as readdirSync2, renameSync as renameSync6, unlinkSync as unlinkSync5, writeFileSync as writeFileSync7 } from "node:fs";
305313
305333
  var NOFOLLOW = constants3.O_NOFOLLOW ?? 0;
305314
305334
 
305315
305335
  // packages/cli/src/config.ts
@@ -305708,10 +305728,52 @@ async function stopTray() {
305708
305728
  return false;
305709
305729
  }
305710
305730
 
305731
+ // packages/cli/src/tray-service-supervisor.ts
305732
+ import { execFile as execFile5 } from "node:child_process";
305733
+ import { readFileSync as readFileSync11 } from "node:fs";
305734
+ var TRAY_SERVICE_UNIT = "omnius-tray.service";
305735
+ function trayServiceUnitForPid(pid, readCgroup = (path3) => readFileSync11(path3, "utf8")) {
305736
+ let cgroup;
305737
+ try {
305738
+ cgroup = readCgroup(`/proc/${pid}/cgroup`);
305739
+ } catch {
305740
+ return void 0;
305741
+ }
305742
+ for (const line of cgroup.split("\n")) {
305743
+ const path3 = line.split(":").slice(2).join(":");
305744
+ if (!path3.includes("/user@")) continue;
305745
+ if (path3.split("/").at(-1) === TRAY_SERVICE_UNIT) return TRAY_SERVICE_UNIT;
305746
+ }
305747
+ return void 0;
305748
+ }
305749
+ function restartTrayServiceUnit(unit, env = process.env) {
305750
+ return new Promise((resolve13) => {
305751
+ execFile5(
305752
+ "systemctl",
305753
+ ["--user", "restart", unit],
305754
+ { env: userManagerEnvironment(env), timeout: 15e3 },
305755
+ (error) => resolve13(!error)
305756
+ );
305757
+ });
305758
+ }
305759
+
305711
305760
  // packages/cli/src/update-worker-runtime.ts
305712
305761
  async function restartTrayWithInstalledExecutable(executable, endpoint) {
305762
+ const previous = await getTrayStatus(endpoint);
305763
+ const unit = previous.pid ? trayServiceUnitForPid(previous.pid) : void 0;
305764
+ const launched = unit ? await restartTrayServiceUnit(unit) : await launchDetachedTray(executable, endpoint);
305765
+ if (!launched) return false;
305766
+ for (let attempt = 0; attempt < 60; attempt++) {
305767
+ const status = await getTrayStatus(endpoint);
305768
+ if (status.running && status.ready && status.endpoint === endpoint && status.pid !== previous.pid)
305769
+ return true;
305770
+ await new Promise((resolve13) => setTimeout(resolve13, 250));
305771
+ }
305772
+ return false;
305773
+ }
305774
+ async function launchDetachedTray(executable, endpoint) {
305713
305775
  await stopTray();
305714
- const launched = await new Promise((resolve13) => {
305776
+ return new Promise((resolve13) => {
305715
305777
  const child = spawn5(executable, ["tray", "start", "--endpoint", endpoint], {
305716
305778
  stdio: "ignore",
305717
305779
  windowsHide: true
@@ -305732,14 +305794,6 @@ async function restartTrayWithInstalledExecutable(executable, endpoint) {
305732
305794
  resolve13(code === 0);
305733
305795
  });
305734
305796
  });
305735
- if (!launched) return false;
305736
- for (let attempt = 0; attempt < 30; attempt++) {
305737
- const status = await getTrayStatus(endpoint);
305738
- if (status.running && status.ready && status.endpoint === endpoint)
305739
- return true;
305740
- await new Promise((resolve13) => setTimeout(resolve13, 250));
305741
- }
305742
- return false;
305743
305797
  }
305744
305798
  async function runUpdateWorkerRuntime(state, paths, endpoint) {
305745
305799
  const cancellation = watchUpdateCancellation(state.operation_id, paths);
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "omnius",
3
- "version": "1.0.909",
3
+ "version": "1.0.910",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "omnius",
9
- "version": "1.0.909",
9
+ "version": "1.0.910",
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.909",
3
+ "version": "1.0.910",
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",