@moxt-ai/mobius 0.0.391 → 0.0.392

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.
Files changed (24) hide show
  1. package/dist/{chunk-TQJ2GJH7.js → chunk-5CY7MW6G.js} +119 -36
  2. package/dist/{chunk-TQJ2GJH7.js.map → chunk-5CY7MW6G.js.map} +4 -4
  3. package/dist/{chunk-4VUCI4MS.js → chunk-GM7DKNVA.js} +2 -2
  4. package/dist/{chunk-4VUCI4MS.js.map → chunk-GM7DKNVA.js.map} +1 -1
  5. package/dist/{cli-FNJ2BQAZ.js → cli-SYSXXECN.js} +3 -3
  6. package/dist/cli.js +2 -2
  7. package/dist/engine/runtime/command/registry/runtime.d.ts.map +1 -1
  8. package/dist/engine/runtime/command/registry/runtime.js +3 -2
  9. package/dist/engine/runtime/command/registry/runtime.js.map +1 -1
  10. package/dist/engine/runtime/observability/diagnostic-log.d.ts +1 -1
  11. package/dist/engine/runtime/observability/diagnostic-log.d.ts.map +1 -1
  12. package/dist/engine/runtime/observability/diagnostic-log.js +16 -1
  13. package/dist/engine/runtime/observability/diagnostic-log.js.map +1 -1
  14. package/dist/engine/runtime/observability/environment-diagnostics.d.ts +4 -0
  15. package/dist/engine/runtime/observability/environment-diagnostics.d.ts.map +1 -0
  16. package/dist/engine/runtime/observability/environment-diagnostics.js +72 -0
  17. package/dist/engine/runtime/observability/environment-diagnostics.js.map +1 -0
  18. package/dist/engine/runtime/relay/diagnostics.d.ts +1 -1
  19. package/dist/engine/runtime/relay/diagnostics.d.ts.map +1 -1
  20. package/dist/engine/runtime/relay/diagnostics.js +1 -1
  21. package/dist/engine/runtime/relay/diagnostics.js.map +1 -1
  22. package/dist/engine.js +2 -2
  23. package/package.json +1 -1
  24. /package/dist/{cli-FNJ2BQAZ.js.map → cli-SYSXXECN.js.map} +0 -0
@@ -3,7 +3,7 @@ import {
3
3
  __export,
4
4
  __using,
5
5
  package_default
6
- } from "./chunk-4VUCI4MS.js";
6
+ } from "./chunk-GM7DKNVA.js";
7
7
 
8
8
  // src/engine/runtime/relay/runtime-revocation.ts
9
9
  var runtimeRevocationCloseCode = 1008;
@@ -44,14 +44,14 @@ var RuntimeOperations = class {
44
44
  this.#pending.delete(pending);
45
45
  }
46
46
  };
47
- close = (release) => {
47
+ close = (release2) => {
48
48
  if (this.#closing !== null) {
49
49
  return this.#closing;
50
50
  }
51
51
  this.#shutdown.abort();
52
52
  this.#closing = (async () => {
53
53
  await Promise.allSettled([...this.#pending]);
54
- await release();
54
+ await release2();
55
55
  })();
56
56
  return this.#closing;
57
57
  };
@@ -2098,10 +2098,10 @@ function nanoidOfLength(length) {
2098
2098
  var duration = /^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;
2099
2099
  var extendedDuration = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/;
2100
2100
  var guid = /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/;
2101
- var uuid = (version2) => {
2102
- if (!version2)
2101
+ var uuid = (version3) => {
2102
+ if (!version3)
2103
2103
  return /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;
2104
- return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${version2}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`);
2104
+ return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${version3}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`);
2105
2105
  };
2106
2106
  var uuid4 = /* @__PURE__ */ uuid(4);
2107
2107
  var uuid6 = /* @__PURE__ */ uuid(6);
@@ -19590,10 +19590,10 @@ function fromJSONSchema(schema, params) {
19590
19590
  } catch {
19591
19591
  throw new Error("fromJSONSchema input is not valid JSON (possibly cyclic); use $defs/$ref for recursive schemas");
19592
19592
  }
19593
- const version2 = detectVersion(normalized, params?.defaultTarget);
19593
+ const version3 = detectVersion(normalized, params?.defaultTarget);
19594
19594
  const defs = normalized.$defs || normalized.definitions || {};
19595
19595
  const ctx = {
19596
- version: version2,
19596
+ version: version3,
19597
19597
  defs,
19598
19598
  refs: /* @__PURE__ */ new Map(),
19599
19599
  processing: /* @__PURE__ */ new Set(),
@@ -22199,9 +22199,9 @@ function installedDirectories(directory) {
22199
22199
  function claudeDesktopExecutablePaths(roots, executablePaths) {
22200
22200
  const paths = [];
22201
22201
  for (const root of roots) {
22202
- const versions = installedDirectories(root).filter((version2) => /^\d+\.\d+\.\d+$/.test(version2)).toSorted((left, right) => right.localeCompare(left, "en", { numeric: true }));
22203
- for (const version2 of versions) {
22204
- const directory = join4(root, version2);
22202
+ const versions = installedDirectories(root).filter((version3) => /^\d+\.\d+\.\d+$/.test(version3)).toSorted((left, right) => right.localeCompare(left, "en", { numeric: true }));
22203
+ for (const version3 of versions) {
22204
+ const directory = join4(root, version3);
22205
22205
  const installations = [
22206
22206
  directory,
22207
22207
  ...installedDirectories(directory).map((build) => join4(directory, build))
@@ -75730,8 +75730,8 @@ function isAgentVersionSupported(reportedVersion, minimumSupportedVersion) {
75730
75730
 
75731
75731
  // src/engine/agent/discovery/executable-discovery.ts
75732
75732
  import { isAbsolute as isAbsolute13 } from "node:path";
75733
- async function resolveSpecificationExecutables(executableName, overrideVariable, resolveInstalled, context) {
75734
- const override = context.environment[overrideVariable];
75733
+ async function resolveSpecificationExecutables(executableName, overrideVariable2, resolveInstalled, context) {
75734
+ const override = context.environment[overrideVariable2];
75735
75735
  if (override !== void 0) {
75736
75736
  if (override.length === 0 || !isAbsolute13(override)) {
75737
75737
  return [];
@@ -75775,8 +75775,8 @@ async function probeVersion(executable, arguments_, environment, defaultWorkspac
75775
75775
  signal,
75776
75776
  timeoutMilliseconds
75777
75777
  });
75778
- const version2 = normalize4(result.stdout || result.stderr);
75779
- if (version2.length === 0) {
75778
+ const version3 = normalize4(result.stdout || result.stderr);
75779
+ if (version3.length === 0) {
75780
75780
  throw new ProcessExecutionError("process_exit_failed", "The executable did not report a version", {
75781
75781
  diagnosticDetails: {
75782
75782
  probeReason: "empty_version_output",
@@ -75786,7 +75786,7 @@ async function probeVersion(executable, arguments_, environment, defaultWorkspac
75786
75786
  }
75787
75787
  });
75788
75788
  }
75789
- return version2;
75789
+ return version3;
75790
75790
  }
75791
75791
 
75792
75792
  // src/engine/agent/discovery/discover-agent.ts
@@ -83200,11 +83200,11 @@ var LocalSqliteDatabase = class {
83200
83200
  }
83201
83201
  }
83202
83202
  #migrate = (label, migrations) => {
83203
- const version2 = external_exports.object({ user_version: external_exports.number().int().nonnegative() }).parse(this.#sqlite.prepare("PRAGMA user_version").get()).user_version;
83204
- if (version2 > migrations.length) {
83203
+ const version3 = external_exports.object({ user_version: external_exports.number().int().nonnegative() }).parse(this.#sqlite.prepare("PRAGMA user_version").get()).user_version;
83204
+ if (version3 > migrations.length) {
83205
83205
  throw new Error(`The ${label} was created by a newer Mobius version`);
83206
83206
  }
83207
- for (let index2 = version2; index2 < migrations.length; index2 += 1) {
83207
+ for (let index2 = version3; index2 < migrations.length; index2 += 1) {
83208
83208
  const migration = migrations[index2];
83209
83209
  if (migration === void 0) {
83210
83210
  throw new Error(`The ${label} migration is unavailable`);
@@ -83251,9 +83251,9 @@ function recordAppliedAdmissionOrder(path7) {
83251
83251
  }
83252
83252
  const database = new DatabaseSync3(path7);
83253
83253
  try {
83254
- const version2 = database.prepare("PRAGMA user_version").get()?.["user_version"];
83254
+ const version3 = database.prepare("PRAGMA user_version").get()?.["user_version"];
83255
83255
  const column = database.prepare("SELECT name FROM pragma_table_info('execution_receipt') WHERE name = 'admission_order'").get();
83256
- if (version2 === 9 && column !== void 0) {
83256
+ if (version3 === 9 && column !== void 0) {
83257
83257
  database.exec("PRAGMA user_version = 10");
83258
83258
  }
83259
83259
  } finally {
@@ -84325,7 +84325,20 @@ var REMOTE_DIAGNOSTIC_FIELDS = [
84325
84325
  "cause1Name",
84326
84326
  "cause1Code",
84327
84327
  "cause2Name",
84328
- "cause2Code"
84328
+ "cause2Code",
84329
+ "platform",
84330
+ "architecture",
84331
+ "osRelease",
84332
+ "nodeVersion",
84333
+ "uptimeSeconds",
84334
+ "agentCount",
84335
+ "omittedAgents",
84336
+ "agentVersion",
84337
+ "adapterVersion",
84338
+ "versionSource",
84339
+ "executableLocation",
84340
+ "executableOverride",
84341
+ "codexHome"
84329
84342
  ];
84330
84343
  var FIELD_VALUE_PATTERN = /^[a-zA-Z0-9_.: -]{1,256}$/u;
84331
84344
  var RuntimeDiagnosticLog = class {
@@ -84345,7 +84358,7 @@ var RuntimeDiagnosticLog = class {
84345
84358
  ];
84346
84359
  }
84347
84360
  // Export only correlation and failure metadata. Local messages and paths stay local.
84348
- snapshot = () => {
84361
+ snapshot = (current = []) => {
84349
84362
  const merged = [];
84350
84363
  let truncated = false;
84351
84364
  for (const source of this.#sources) {
@@ -84354,6 +84367,7 @@ var RuntimeDiagnosticLog = class {
84354
84367
  truncated ||= collected.truncated;
84355
84368
  }
84356
84369
  merged.sort(compareTimestamp);
84370
+ merged.push(...current.map(exportedFields));
84357
84371
  const entries = merged.slice(-MAXIMUM_ENTRIES);
84358
84372
  truncated ||= entries.length < merged.length;
84359
84373
  while (JSON.stringify(entries).length > MAXIMUM_REPORT_BYTES && entries.length > 0) {
@@ -84702,9 +84716,9 @@ function createCatalogAgentResolver(discover, readConfig, publish) {
84702
84716
  await pending;
84703
84717
  return config2.catalog.find(agent.id);
84704
84718
  }
84705
- let release = () => void 0;
84719
+ let release2 = () => void 0;
84706
84720
  const gate = new Promise((resolveGate) => {
84707
- release = resolveGate;
84721
+ release2 = resolveGate;
84708
84722
  });
84709
84723
  swaps.set(agent.id, gate);
84710
84724
  try {
@@ -84728,7 +84742,7 @@ function createCatalogAgentResolver(discover, readConfig, publish) {
84728
84742
  return config2.catalog.find(agent.id);
84729
84743
  } finally {
84730
84744
  swaps.delete(agent.id);
84731
- release();
84745
+ release2();
84732
84746
  }
84733
84747
  };
84734
84748
  }
@@ -87777,7 +87791,7 @@ var SessionManager2 = class {
87777
87791
  return;
87778
87792
  }
87779
87793
  this.#announceClosed(options.sessionId, "This Session was closed on request.");
87780
- const release = (async () => {
87794
+ const release2 = (async () => {
87781
87795
  const retiring = this.#sessionRetirements.get(options.sessionId);
87782
87796
  if (retiring !== void 0) {
87783
87797
  await retiring;
@@ -87799,14 +87813,14 @@ var SessionManager2 = class {
87799
87813
  ),
87800
87814
  SESSION_CLOSE_TIMEOUT_MILLISECONDS
87801
87815
  );
87802
- const completion = Promise.race([release, deadline.promise]).finally(timeout.cancel);
87816
+ const completion = Promise.race([release2, deadline.promise]).finally(timeout.cancel);
87803
87817
  this.#sessionClosures.set(options.sessionId, completion);
87804
87818
  const releaseFinished = () => {
87805
87819
  if (this.#sessionClosures.get(options.sessionId) === completion) {
87806
87820
  this.#sessionClosures.delete(options.sessionId);
87807
87821
  }
87808
87822
  };
87809
- void release.then(releaseFinished, releaseFinished);
87823
+ void release2.then(releaseFinished, releaseFinished);
87810
87824
  await waitForSharedOperation(completion, options.signal);
87811
87825
  });
87812
87826
  close = async () => {
@@ -90262,7 +90276,7 @@ var RelayConnectionDiagnostics = class {
90262
90276
  this.#relayOrigin = relayUrl.origin;
90263
90277
  this.#route = describeEnvironmentProxyRoute(relayUrl);
90264
90278
  }
90265
- snapshot = () => this.#localLog.snapshot();
90279
+ snapshot = (current = []) => this.#localLog.snapshot(current);
90266
90280
  catalogFailed = (failure2) => {
90267
90281
  const details = { ...this.#route, relayOrigin: this.#relayOrigin };
90268
90282
  addFailureDetails(details, failure2);
@@ -92156,10 +92170,79 @@ var sessionPromptCommand = {
92156
92170
  }
92157
92171
  };
92158
92172
 
92173
+ // src/engine/runtime/observability/environment-diagnostics.ts
92174
+ import { release } from "node:os";
92175
+ function version2(value) {
92176
+ return /(?:^|[\s(v])(\d{1,6}\.\d{1,6}\.\d{1,6}(?:-(?:alpha|beta|rc|dev|preview)(?:[.\d-]{0,24}))?(?:\+[a-f0-9]{1,16})?)(?=$|[\s)])/u.exec(
92177
+ value.slice(0, 128)
92178
+ )?.[1] ?? "unavailable";
92179
+ }
92180
+ function executableLocation(agent) {
92181
+ const path7 = agent.agentIdentity.realPath.replaceAll("\\", "/");
92182
+ if (/\/(?:ChatGPT|Codex)\.app\//u.test(path7)) {
92183
+ return "desktop_bundle";
92184
+ }
92185
+ if (path7.includes("/node_modules/")) {
92186
+ return "node_package";
92187
+ }
92188
+ if (path7.includes("/Cellar/") || path7.includes("/homebrew/")) {
92189
+ return "homebrew";
92190
+ }
92191
+ if (path7.startsWith("/usr/bin/") || path7.startsWith("/bin/")) {
92192
+ return "system";
92193
+ }
92194
+ return "other";
92195
+ }
92196
+ function overrideVariable(agentId) {
92197
+ switch (agentId) {
92198
+ case "codex":
92199
+ return "MOBIUS_CODEX_PATH";
92200
+ case "claude":
92201
+ return "MOBIUS_CLAUDE_PATH";
92202
+ case "pi":
92203
+ return "MOBIUS_PI_PATH";
92204
+ case "opencode":
92205
+ return "MOBIUS_OPENCODE_PATH";
92206
+ default:
92207
+ return null;
92208
+ }
92209
+ }
92210
+ function runtimeEnvironmentDiagnostics(config2) {
92211
+ const agents = config2.catalog.read().agents;
92212
+ const timestamp = (/* @__PURE__ */ new Date()).toISOString();
92213
+ return [
92214
+ {
92215
+ event: "runtime_environment",
92216
+ timestamp,
92217
+ platform: process.platform,
92218
+ architecture: process.arch,
92219
+ osRelease: /^(\d+(?:\.\d+){1,3})/u.exec(release())?.[1] ?? "unavailable",
92220
+ nodeVersion: process.versions.node,
92221
+ uptimeSeconds: Math.floor(process.uptime()).toString(),
92222
+ agentCount: agents.length.toString(),
92223
+ omittedAgents: Math.max(0, agents.length - 16).toString()
92224
+ },
92225
+ ...agents.slice(0, 16).map((agent) => {
92226
+ const override = overrideVariable(agent.id);
92227
+ return {
92228
+ event: "agent_inventory",
92229
+ timestamp,
92230
+ agentId: override === null ? "custom" : agent.id,
92231
+ agentVersion: version2(agent.agentVersion),
92232
+ adapterVersion: version2(agent.adapterVersion),
92233
+ versionSource: "runtime_catalog",
92234
+ executableLocation: executableLocation(agent),
92235
+ executableOverride: override === null ? "unknown" : agent.environment[override] === void 0 ? "unset" : "set",
92236
+ codexHome: agent.id !== "codex" ? "not_applicable" : agent.environment["CODEX_HOME"] === void 0 ? "default" : "custom"
92237
+ };
92238
+ })
92239
+ ];
92240
+ }
92241
+
92159
92242
  // src/engine/runtime/command/registry/runtime.ts
92160
92243
  var runtimeDiagnosticsCommand = {
92161
92244
  kind: "runtime.diagnostics.read",
92162
- handle: ({ diagnostics, socket }, message) => {
92245
+ handle: ({ config: config2, diagnostics, socket }, message) => {
92163
92246
  if (message.kind !== "runtime.diagnostics.read") {
92164
92247
  throw new Error("Command kind mismatch");
92165
92248
  }
@@ -92168,7 +92251,7 @@ var runtimeDiagnosticsCommand = {
92168
92251
  kind: "runtime.diagnostics.result",
92169
92252
  requestId: message.requestId,
92170
92253
  version: package_default.version,
92171
- ...diagnostics.snapshot()
92254
+ ...diagnostics.snapshot(runtimeEnvironmentDiagnostics(config2))
92172
92255
  });
92173
92256
  } catch {
92174
92257
  send(socket, {
@@ -92707,7 +92790,7 @@ function connectRelay(url2, signal, transportFailed = () => void 0) {
92707
92790
  headers
92708
92791
  });
92709
92792
  socket.binaryType = "arraybuffer";
92710
- const release = (reason) => {
92793
+ const release2 = (reason) => {
92711
92794
  if (released) {
92712
92795
  return;
92713
92796
  }
@@ -92731,7 +92814,7 @@ function connectRelay(url2, signal, transportFailed = () => void 0) {
92731
92814
  finished = true;
92732
92815
  cleanup();
92733
92816
  socket.close();
92734
- release(error62);
92817
+ release2(error62);
92735
92818
  reject2(error62);
92736
92819
  };
92737
92820
  const onAbort = () => {
@@ -92775,7 +92858,7 @@ function connectRelay(url2, signal, transportFailed = () => void 0) {
92775
92858
  }
92776
92859
  finished = true;
92777
92860
  cleanup();
92778
- resolve19({ release, socket });
92861
+ resolve19({ release: release2, socket });
92779
92862
  };
92780
92863
  function onTimeout() {
92781
92864
  fail(
@@ -93746,4 +93829,4 @@ export {
93746
93829
  * MIT Licensed
93747
93830
  *)
93748
93831
  */
93749
- //# sourceMappingURL=chunk-TQJ2GJH7.js.map
93832
+ //# sourceMappingURL=chunk-5CY7MW6G.js.map