@moxt-ai/mobius 0.0.420 → 0.0.422

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.
@@ -3,7 +3,7 @@ import {
3
3
  __export,
4
4
  __using,
5
5
  package_default
6
- } from "./chunk-42NDUG4B.js";
6
+ } from "./chunk-LYXXD335.js";
7
7
 
8
8
  // src/engine/runtime/relay/runtime-revocation.ts
9
9
  var runtimeRevocationCloseCode = 1008;
@@ -22108,7 +22108,7 @@ function readFileChunks(path7, chunkBytes, signal) {
22108
22108
 
22109
22109
  // src/engine/storage/installation/installation-files.ts
22110
22110
  import { createHash, randomUUID } from "node:crypto";
22111
- import { mkdir as mkdir2, open as open3, readdir as readdir2, rename, unlink, writeFile } from "node:fs/promises";
22111
+ import { link, mkdir as mkdir2, open as open3, readdir as readdir2, rename, rm, unlink, writeFile } from "node:fs/promises";
22112
22112
  import { dirname, join } from "node:path";
22113
22113
 
22114
22114
  // src/engine/util/node-error.ts
@@ -22167,7 +22167,13 @@ async function writeInstallationFile(path7, text2, signal) {
22167
22167
  }
22168
22168
  }
22169
22169
  async function createInstallationFile(path7, text2) {
22170
- await writeFile(path7, text2, { flag: "wx", mode: 384 });
22170
+ const temporaryPath = join(dirname(path7), `.${randomUUID()}.tmp`);
22171
+ try {
22172
+ await writeFile(temporaryPath, text2, { flag: "wx", mode: 384 });
22173
+ await link(temporaryPath, path7);
22174
+ } finally {
22175
+ await rm(temporaryPath, { force: true });
22176
+ }
22171
22177
  }
22172
22178
  async function listInstallationFiles(directory) {
22173
22179
  return await readdir2(directory);
@@ -52686,7 +52692,7 @@ var JC = class {
52686
52692
  function nm(e) {
52687
52693
  return typeof e === "number" && Number.isInteger(e) && e > 0 ? e : void 0;
52688
52694
  }
52689
- var rm2 = /* @__PURE__ */ Symbol("suppressControlResponse");
52695
+ var rm3 = /* @__PURE__ */ Symbol("suppressControlResponse");
52690
52696
  var Gy = class _Gy {
52691
52697
  transport;
52692
52698
  isSingleUserTurn;
@@ -52891,7 +52897,7 @@ var Gy = class _Gy {
52891
52897
  try {
52892
52898
  let n = await this.processControlRequest(e, t.signal);
52893
52899
  if (this.cleanupPerformed) return;
52894
- if (n === rm2) return;
52900
+ if (n === rm3) return;
52895
52901
  let r = { type: "control_response", response: { subtype: "success", request_id: e.request_id, response: n } };
52896
52902
  await Promise.resolve(this.transport.write(me(r) + `
52897
52903
  `));
@@ -52916,7 +52922,7 @@ var Gy = class _Gy {
52916
52922
  if (e.request.subtype === "can_use_tool") {
52917
52923
  if (!this.canUseTool) throw Error("canUseTool callback is not provided.");
52918
52924
  let n = await this.canUseTool(e.request.tool_name, e.request.input, { signal: t, suggestions: e.request.permission_suggestions, blockedPath: e.request.blocked_path, decisionReason: e.request.decision_reason, title: e.request.title, displayName: e.request.display_name, description: e.request.description, toolUseID: e.request.tool_use_id, agentID: e.request.agent_id, requestId: e.request_id, ...e.request.matched_ask_rule && { matchedAskRule: { source: e.request.matched_ask_rule.source, toolName: e.request.matched_ask_rule.tool_name, ...e.request.matched_ask_rule.rule_content !== void 0 && { ruleContent: e.request.matched_ask_rule.rule_content } } } });
52919
- if (n === null) return rm2;
52925
+ if (n === null) return rm3;
52920
52926
  return { ...n, toolUseID: e.request.tool_use_id };
52921
52927
  } else if (e.request.subtype === "hook_callback") return await this.handleHookCallbacks(e.request.callback_id, e.request.input, e.request.tool_use_id, t);
52922
52928
  else if (e.request.subtype === "mcp_message") {
@@ -52931,17 +52937,17 @@ var Gy = class _Gy {
52931
52937
  let n = e.request;
52932
52938
  if (this.onElicitation) {
52933
52939
  let r = await this.onElicitation({ serverName: n.mcp_server_name, message: n.message, mode: n.mode, url: n.url, elicitationId: n.elicitation_id, requestedSchema: n.requested_schema, title: n.title, displayName: n.display_name, description: n.description }, { signal: t, requestId: e.request_id });
52934
- if (r === null) return rm2;
52940
+ if (r === null) return rm3;
52935
52941
  return r;
52936
52942
  }
52937
52943
  return { action: "decline" };
52938
52944
  } else if (e.request.subtype === "request_user_dialog") {
52939
52945
  if (this.onUserDialog) {
52940
52946
  let n = await this.onUserDialog({ dialogKind: e.request.dialog_kind, payload: e.request.payload, toolUseID: e.request.tool_use_id }, { signal: t, requestId: e.request_id });
52941
- if (n === null) return rm2;
52947
+ if (n === null) return rm3;
52942
52948
  return n;
52943
52949
  }
52944
- return ce(`[Query] No onUserDialog handler for request_user_dialog (kind=${e.request.dialog_kind}) \u2014 staying silent so a capable client (or the worker's park deadline) settles it`), Li("tengu_request_user_dialog_response_ignored", { shape: yi("auto_cancel") }), rm2;
52950
+ return ce(`[Query] No onUserDialog handler for request_user_dialog (kind=${e.request.dialog_kind}) \u2014 staying silent so a capable client (or the worker's park deadline) settles it`), Li("tengu_request_user_dialog_response_ignored", { shape: yi("auto_cancel") }), rm3;
52945
52951
  } else if (e.request.subtype === "oauth_token_refresh") {
52946
52952
  if (!this.getOAuthToken) throw Error("getOAuthToken callback is not provided.");
52947
52953
  let n, r = await this.getOAuthToken({ signal: t, onDecline: (o) => {
@@ -90927,18 +90933,13 @@ var SessionManager2 = class {
90927
90933
  retireIdle: (runtime) => this.#stopSessionProcess(sessionId, runtime)
90928
90934
  };
90929
90935
  }
90936
+ /**
90937
+ * Retires a Session's process. The stored Session outlives it, whatever ended the process: only an operation
90938
+ * that ends the Session itself removes its title, settings and native identity.
90939
+ */
90930
90940
  async #retireSessionProcess(sessionId, runtime, close) {
90931
- const retained = this.#executionProcesses.detach(sessionId, runtime);
90932
- try {
90933
- await this.#processes.retire(runtime, close);
90934
- } finally {
90935
- if (retained && this.#sessionIdentity === "native") {
90936
- const stored = this.#store.read(sessionId);
90937
- if (stored instanceof FoundStoredSession && stored.session.nativeSessionId === sessionId && isNativeChatSessionId(stored.session.agentId, sessionId)) {
90938
- this.#store.remove(sessionId);
90939
- }
90940
- }
90941
- }
90941
+ this.#executionProcesses.detach(sessionId, runtime);
90942
+ await this.#processes.retire(runtime, close);
90942
90943
  }
90943
90944
  /**
90944
90945
  * Releases a closed or idle Session's process while keeping its title, settings and native
@@ -93544,7 +93545,7 @@ import { pathToFileURL as pathToFileURL3 } from "node:url";
93544
93545
 
93545
93546
  // src/engine/storage/files/scratch-directory.ts
93546
93547
  import { randomUUID as randomUUID17 } from "node:crypto";
93547
- import { lstat as lstat4, mkdir as mkdir5, readdir as readdir6, readFile as readFile7, realpath as realpath7, rename as rename4, rm as rm3, stat as stat6, utimes, writeFile as writeFile2 } from "node:fs/promises";
93548
+ import { lstat as lstat4, mkdir as mkdir5, readdir as readdir6, readFile as readFile7, realpath as realpath7, rename as rename4, rm as rm4, stat as stat6, utimes, writeFile as writeFile2 } from "node:fs/promises";
93548
93549
  import { dirname as dirname11, join as join28 } from "node:path";
93549
93550
  async function atomicWrite(path7, bytes, signal) {
93550
93551
  const temporary = `${path7}.${randomUUID17()}.tmp`;
@@ -93553,7 +93554,7 @@ async function atomicWrite(path7, bytes, signal) {
93553
93554
  signal.throwIfAborted();
93554
93555
  await rename4(temporary, path7);
93555
93556
  } finally {
93556
- await rm3(temporary, { force: true });
93557
+ await rm4(temporary, { force: true });
93557
93558
  }
93558
93559
  }
93559
93560
  var ScratchDirectory = class {
@@ -93579,7 +93580,7 @@ var ScratchDirectory = class {
93579
93580
  () => Date.now()
93580
93581
  );
93581
93582
  if (modified + leaseMilliseconds <= Date.now()) {
93582
- await rm3(path7, { force: true, recursive: true });
93583
+ await rm4(path7, { force: true, recursive: true });
93583
93584
  }
93584
93585
  }
93585
93586
  };
@@ -93593,7 +93594,7 @@ var ScratchDirectory = class {
93593
93594
  return path7;
93594
93595
  };
93595
93596
  remove = async (path7) => {
93596
- await rm3(path7, { force: true });
93597
+ await rm4(path7, { force: true });
93597
93598
  };
93598
93599
  /** The canonical path of a written file, or null when it is gone, is not a regular file, or escapes its directory. */
93599
93600
  resolveFile = async (path7) => {
@@ -93615,7 +93616,7 @@ var ScratchDirectory = class {
93615
93616
  return resolved === null ? null : new Uint8Array(await readFile7(resolved, { signal }));
93616
93617
  };
93617
93618
  removeAll = async () => {
93618
- await rm3(this.#root, { force: true, recursive: true });
93619
+ await rm4(this.#root, { force: true, recursive: true });
93619
93620
  };
93620
93621
  };
93621
93622
 
@@ -97682,4 +97683,4 @@ export {
97682
97683
  * MIT Licensed
97683
97684
  *)
97684
97685
  */
97685
- //# sourceMappingURL=chunk-MCPMMRRU.js.map
97686
+ //# sourceMappingURL=chunk-KZSWPDB2.js.map