@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/index.js CHANGED
@@ -38867,13 +38867,17 @@ function encodePath(path2) {
38867
38867
  }
38868
38868
  return `path-${encoded}`;
38869
38869
  }
38870
+ function expandCurrentUserHome(path2) {
38871
+ return path2.replace(/^~(?=$|\/|\\)/, homedir2());
38872
+ }
38870
38873
  function decodePath(value, prefix) {
38871
38874
  const encoded = value.slice(prefix.length);
38872
38875
  if (encoded.length === 0 || encoded.length > 2e3 || !/^[a-zA-Z0-9_-]+$/.test(encoded)) {
38873
38876
  throw new LocalAuthorizationError("The directory identifier is invalid");
38874
38877
  }
38875
38878
  const decoded = Buffer.from(encoded, "base64url").toString("utf8");
38876
- if (Buffer.from(decoded, "utf8").toString("base64url") !== encoded || decoded.includes("\0") || normalize3(decoded) !== decoded) {
38879
+ const normalized = process.platform === "win32" && decoded.startsWith("~/") ? normalize3(decoded).replaceAll("\\", "/") : normalize3(decoded);
38880
+ if (Buffer.from(decoded, "utf8").toString("base64url") !== encoded || decoded.includes("\0") || normalized !== decoded) {
38877
38881
  throw new LocalAuthorizationError("The directory identifier is invalid");
38878
38882
  }
38879
38883
  return decoded;
@@ -38898,7 +38902,7 @@ var WorkspaceDirectoryService = class {
38898
38902
  return homedir2();
38899
38903
  }
38900
38904
  if (id.startsWith("path-")) {
38901
- const path2 = decodePath(id, "path-");
38905
+ const path2 = expandCurrentUserHome(decodePath(id, "path-"));
38902
38906
  if (isAbsolute9(path2)) {
38903
38907
  return path2;
38904
38908
  }