@moxt-ai/mobius 0.0.160 → 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
  }
@@ -41765,7 +41769,7 @@ function replayEvent(sessionId, position, update) {
41765
41769
  type: "acp"
41766
41770
  };
41767
41771
  }
41768
- async function executeSessionLiveHistoryV2PageLoad(socket, command, config2, directories, audit, sessions, executingPromptRequest, signal) {
41772
+ async function executeSessionLiveHistoryV2PageLoad(socket, command, config2, directories, audit, diagnostics, sessions, executingPromptRequest, signal) {
41769
41773
  try {
41770
41774
  const resolved = await resolveSessionDirectories(
41771
41775
  directories,
@@ -41812,6 +41816,25 @@ async function executeSessionLiveHistoryV2PageLoad(socket, command, config2, dir
41812
41816
  });
41813
41817
  } catch (error62) {
41814
41818
  if (!signal.aborted) {
41819
+ diagnostics.daemonDiagnostic(
41820
+ "session_history_v2_load_failed",
41821
+ command.requestId,
41822
+ {
41823
+ agentId: command.agentId,
41824
+ code: operationErrorCode(error62),
41825
+ sessionId: command.sessionId
41826
+ },
41827
+ error62
41828
+ );
41829
+ audit.record({
41830
+ commandId: command.requestId,
41831
+ details: {
41832
+ agentId: command.agentId,
41833
+ code: operationErrorCode(error62)
41834
+ },
41835
+ event: "session_history_v2_load_failed",
41836
+ sessionId: command.sessionId
41837
+ });
41815
41838
  reportOperationFailure(socket, command.requestId, command.sessionId, error62);
41816
41839
  }
41817
41840
  }
@@ -42712,6 +42735,7 @@ function createDaemonCommandHandler({
42712
42735
  config2,
42713
42736
  directories,
42714
42737
  audit,
42738
+ diagnostics,
42715
42739
  sessions,
42716
42740
  eventLogV2.executingPromptRequest,
42717
42741
  signal