forge-openclaw-plugin 0.2.112 → 0.2.114

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.
@@ -5527,8 +5527,11 @@ function rewriteMountPath(url) {
5527
5527
  const queryIndex = url.indexOf("?");
5528
5528
  const pathname = queryIndex >= 0 ? url.slice(0, queryIndex) : url;
5529
5529
  const search = queryIndex >= 0 ? url.slice(queryIndex) : "";
5530
+ if (pathname === "/") {
5531
+ return `/__forge-ui-root-redirect${search}`;
5532
+ }
5530
5533
  if (pathname === "/forge") {
5531
- return `/${search}`;
5534
+ return `/__forge-ui-base-redirect${search}`;
5532
5535
  }
5533
5536
  if (pathname.startsWith("/forge/")) {
5534
5537
  return `${pathname.slice("/forge".length) || "/"}${search}`;
@@ -6,7 +6,6 @@ import { fileURLToPath } from "node:url";
6
6
  import { logForgeDebug } from "../debug.js";
7
7
  import { getEffectiveDataRoot } from "../db.js";
8
8
  const projectRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..", "..", "..");
9
- const companionIrohManifestPath = path.join(projectRoot, "companion-iroh", "Cargo.toml");
10
9
  const DEFAULT_IROH_START_TIMEOUT_MS = 25_000;
11
10
  const COMPANION_IROH_ALPN = "forge-companion/1";
12
11
  const FORGE_IROH_AGENT = "forge";
@@ -295,21 +294,29 @@ function resolveIrohHostCommand(input) {
295
294
  function candidateIrohBinaries() {
296
295
  const binaryName = process.platform === "win32" ? "forge-companion-iroh.exe" : "forge-companion-iroh";
297
296
  const platformKey = `${process.platform}-${process.arch}`;
298
- return [
299
- path.join(projectRoot, "companion-iroh", "target", "release", binaryName),
300
- path.join(projectRoot, "companion-iroh", "target", "debug", binaryName),
301
- path.join(projectRoot, "openclaw-plugin", "dist", "companion-iroh", platformKey, binaryName),
302
- path.join(projectRoot, "companion-iroh", platformKey, binaryName),
303
- path.join(projectRoot, "companion-iroh", binaryName)
304
- ];
297
+ return candidateIrohAssetRoots().flatMap((root) => [
298
+ path.join(root, "companion-iroh", "target", "release", binaryName),
299
+ path.join(root, "companion-iroh", "target", "debug", binaryName),
300
+ path.join(root, "openclaw-plugin", "dist", "companion-iroh", platformKey, binaryName),
301
+ path.join(root, "companion-iroh", platformKey, binaryName),
302
+ path.join(root, "companion-iroh", binaryName)
303
+ ]);
305
304
  }
306
305
  function resolveCompanionIrohManifestPath() {
307
- const candidates = [
308
- companionIrohManifestPath,
309
- path.join(projectRoot, "companion-iroh-src", "Cargo.toml")
310
- ];
306
+ const candidates = candidateIrohAssetRoots().flatMap((root) => [
307
+ path.join(root, "companion-iroh", "Cargo.toml"),
308
+ path.join(root, "companion-iroh-src", "Cargo.toml")
309
+ ]);
311
310
  return candidates.find((candidate) => existsSync(candidate)) ?? null;
312
311
  }
312
+ function candidateIrohAssetRoots() {
313
+ const roots = [
314
+ projectRoot,
315
+ path.resolve(projectRoot, ".."),
316
+ path.resolve(projectRoot, "..", "..")
317
+ ];
318
+ return [...new Set(roots)];
319
+ }
313
320
  function shouldAutoStartIrohHost() {
314
321
  if (process.env.FORGE_COMPANION_IROH_DISABLED === "1") {
315
322
  return false;
@@ -487,6 +487,7 @@ export async function registerWebRoutes(app, options = {}) {
487
487
  const devWebRuntime = options.devWebRuntime ?? createManagedDevWebRuntime();
488
488
  const fetchImpl = options.fetchImpl ?? fetch;
489
489
  const devAssetProxy = options.devAssetProxy ?? createDevAssetProxy(fetchImpl);
490
+ const basePath = normalizeBasePath(getDefaultBasePath());
490
491
  app.addHook("onClose", async () => {
491
492
  await devWebRuntime.stop();
492
493
  devAssetProxy.close();
@@ -501,6 +502,16 @@ export async function registerWebRoutes(app, options = {}) {
501
502
  });
502
503
  })();
503
504
  });
505
+ app.get("/__forge-ui-root-redirect", async (_request, reply) => {
506
+ if (basePath !== "/") {
507
+ reply.redirect(basePath, 302);
508
+ return;
509
+ }
510
+ return serveAsset("/", reply, { devWebRuntime, devAssetProxy });
511
+ });
512
+ app.get("/__forge-ui-base-redirect", async (_request, reply) => {
513
+ reply.redirect(basePath, 302);
514
+ });
504
515
  app.get("/", async (_request, reply) => serveAsset("/", reply, { devWebRuntime, devAssetProxy }));
505
516
  app.get("/*", async (request, reply) => serveAsset(request.url, reply, { devWebRuntime, devAssetProxy }));
506
517
  }
@@ -2,7 +2,7 @@
2
2
  "id": "forge-openclaw-plugin",
3
3
  "name": "Forge",
4
4
  "description": "Curated OpenClaw adapter for the Forge collaboration API, UI entrypoint, and localhost auto-start runtime.",
5
- "version": "0.2.112",
5
+ "version": "0.2.114",
6
6
  "activation": {
7
7
  "onStartup": true,
8
8
  "onCapabilities": [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "forge-openclaw-plugin",
3
- "version": "0.2.112",
3
+ "version": "0.2.114",
4
4
  "description": "Curated OpenClaw adapter for the Forge collaboration API, UI entrypoint, and localhost auto-start runtime.",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",