@moxt-ai/mobius 0.0.161 → 0.0.162

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/runtime.js CHANGED
@@ -37989,13 +37989,17 @@ function encodePath(path2) {
37989
37989
  }
37990
37990
  return `path-${encoded}`;
37991
37991
  }
37992
+ function expandCurrentUserHome(path2) {
37993
+ return path2.replace(/^~(?=$|\/|\\)/, homedir2());
37994
+ }
37992
37995
  function decodePath(value, prefix) {
37993
37996
  const encoded = value.slice(prefix.length);
37994
37997
  if (encoded.length === 0 || encoded.length > 2e3 || !/^[a-zA-Z0-9_-]+$/.test(encoded)) {
37995
37998
  throw new LocalAuthorizationError("The directory identifier is invalid");
37996
37999
  }
37997
38000
  const decoded = Buffer.from(encoded, "base64url").toString("utf8");
37998
- if (Buffer.from(decoded, "utf8").toString("base64url") !== encoded || decoded.includes("\0") || normalize3(decoded) !== decoded) {
38001
+ const normalized = process.platform === "win32" && decoded.startsWith("~/") ? normalize3(decoded).replaceAll("\\", "/") : normalize3(decoded);
38002
+ if (Buffer.from(decoded, "utf8").toString("base64url") !== encoded || decoded.includes("\0") || normalized !== decoded) {
37999
38003
  throw new LocalAuthorizationError("The directory identifier is invalid");
38000
38004
  }
38001
38005
  return decoded;
@@ -38020,7 +38024,7 @@ var WorkspaceDirectoryService = class {
38020
38024
  return homedir2();
38021
38025
  }
38022
38026
  if (id.startsWith("path-")) {
38023
- const path2 = decodePath(id, "path-");
38027
+ const path2 = expandCurrentUserHome(decodePath(id, "path-"));
38024
38028
  if (isAbsolute9(path2)) {
38025
38029
  return path2;
38026
38030
  }