opencode-usage 0.5.1 → 0.5.2

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
@@ -30731,8 +30731,6 @@ async function runCommanderServer(args) {
30731
30731
  }
30732
30732
  }
30733
30733
  if (!url.pathname.startsWith("/api/")) {
30734
- const base = new URL(".", import.meta.url).pathname;
30735
- const UI_DIST = await Bun.file(join10(base, "commander-ui", "index.html")).exists() ? join10(base, "commander-ui") : join10(base, "..", "commander-ui", "dist");
30736
30734
  const filePath = url.pathname === "/" ? join10(UI_DIST, "index.html") : join10(UI_DIST, url.pathname);
30737
30735
  const file = Bun.file(filePath);
30738
30736
  if (await file.exists())
@@ -30753,12 +30751,29 @@ var isBun7 = typeof globalThis.Bun !== "undefined";
30753
30751
  var DEFAULT_PORT = 4466;
30754
30752
  var __dirname2 = dirname2(fileURLToPath2(import.meta.url));
30755
30753
  var PKG_VERSION = (() => {
30756
- try {
30757
- const pkg = JSON.parse(readFileSync2(join10(__dirname2, "..", "..", "package.json"), "utf-8"));
30758
- return String(pkg.version ?? "0.0.0");
30759
- } catch {
30760
- return "0.0.0";
30754
+ for (const rel of [
30755
+ join10(__dirname2, "..", "..", "package.json"),
30756
+ join10(__dirname2, "..", "package.json")
30757
+ ]) {
30758
+ try {
30759
+ const pkg = JSON.parse(readFileSync2(rel, "utf-8"));
30760
+ if (pkg.version)
30761
+ return String(pkg.version);
30762
+ } catch {
30763
+ }
30764
+ }
30765
+ return "0.0.0";
30766
+ })();
30767
+ var UI_DIST = await (async () => {
30768
+ const candidates = [
30769
+ join10(__dirname2, "commander-ui"),
30770
+ join10(__dirname2, "..", "commander-ui", "dist")
30771
+ ];
30772
+ for (const dir of candidates) {
30773
+ if (await Bun.file(join10(dir, "index.html")).exists())
30774
+ return dir;
30761
30775
  }
30776
+ return candidates[0];
30762
30777
  })();
30763
30778
  var usageWorkerPath = join10(__dirname2, "services", "usage-worker.ts");
30764
30779
  var canUseWorker = await Bun.file(usageWorkerPath).exists();
@@ -30872,4 +30887,4 @@ async function main2() {
30872
30887
  var WATCH_INTERVAL_MS = 5 * 60 * 1000;
30873
30888
  main2().catch(console.error);
30874
30889
 
30875
- //# debugId=AAD27BF82DBA8BEB64756E2164756E21
30890
+ //# debugId=2B2A0EC747EBB71864756E2164756E21