@moxt-ai/mobius 0.0.391 → 0.0.393

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 (30) hide show
  1. package/dist/{chunk-TQJ2GJH7.js → chunk-XABCAZR5.js} +131 -38
  2. package/dist/{chunk-TQJ2GJH7.js.map → chunk-XABCAZR5.js.map} +4 -4
  3. package/dist/{chunk-4VUCI4MS.js → chunk-ZAKI67IE.js} +2 -2
  4. package/dist/{chunk-4VUCI4MS.js.map → chunk-ZAKI67IE.js.map} +1 -1
  5. package/dist/{cli-FNJ2BQAZ.js → cli-ZZJXURU5.js} +3 -3
  6. package/dist/cli.js +2 -2
  7. package/dist/engine/runtime/command/registry/interactions.d.ts.map +1 -1
  8. package/dist/engine/runtime/command/registry/interactions.js +2 -2
  9. package/dist/engine/runtime/command/registry/interactions.js.map +1 -1
  10. package/dist/engine/runtime/command/registry/runtime.d.ts.map +1 -1
  11. package/dist/engine/runtime/command/registry/runtime.js +3 -2
  12. package/dist/engine/runtime/command/registry/runtime.js.map +1 -1
  13. package/dist/engine/runtime/observability/diagnostic-log.d.ts +1 -1
  14. package/dist/engine/runtime/observability/diagnostic-log.d.ts.map +1 -1
  15. package/dist/engine/runtime/observability/diagnostic-log.js +16 -1
  16. package/dist/engine/runtime/observability/diagnostic-log.js.map +1 -1
  17. package/dist/engine/runtime/observability/environment-diagnostics.d.ts +4 -0
  18. package/dist/engine/runtime/observability/environment-diagnostics.d.ts.map +1 -0
  19. package/dist/engine/runtime/observability/environment-diagnostics.js +72 -0
  20. package/dist/engine/runtime/observability/environment-diagnostics.js.map +1 -0
  21. package/dist/engine/runtime/relay/diagnostics.d.ts +1 -1
  22. package/dist/engine/runtime/relay/diagnostics.d.ts.map +1 -1
  23. package/dist/engine/runtime/relay/diagnostics.js +1 -1
  24. package/dist/engine/runtime/relay/diagnostics.js.map +1 -1
  25. package/dist/engine/session/turn/execution-receipts.d.ts.map +1 -1
  26. package/dist/engine/session/turn/execution-receipts.js +2 -2
  27. package/dist/engine/session/turn/execution-receipts.js.map +1 -1
  28. package/dist/engine.js +2 -2
  29. package/package.json +2 -2
  30. /package/dist/{cli-FNJ2BQAZ.js.map → cli-ZZJXURU5.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-ZAKI67IE.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(),
@@ -20781,6 +20781,16 @@ var isPromptTerminal = (payload) => {
20781
20781
  }
20782
20782
  }
20783
20783
  };
20784
+ var promptCompletion = (completed) => {
20785
+ switch (completed.stopReason) {
20786
+ case "cancelled":
20787
+ return { kind: "cancelled", started: completed.execution !== "not-started" };
20788
+ case "steered":
20789
+ return { kind: "steered" };
20790
+ default:
20791
+ return { kind: "ended", stopReason: completed.stopReason };
20792
+ }
20793
+ };
20784
20794
  var sessionEventPayloadSchema = external_exports.discriminatedUnion("type", [
20785
20795
  external_exports.object({ payload: acpSessionUpdateSchema, type: external_exports.literal("acp") }).readonly(),
20786
20796
  external_exports.object({ payload: lifecycleMetadataSchema, type: external_exports.literal("lifecycle-metadata") }).readonly()
@@ -22199,9 +22209,9 @@ function installedDirectories(directory) {
22199
22209
  function claudeDesktopExecutablePaths(roots, executablePaths) {
22200
22210
  const paths = [];
22201
22211
  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);
22212
+ const versions = installedDirectories(root).filter((version3) => /^\d+\.\d+\.\d+$/.test(version3)).toSorted((left, right) => right.localeCompare(left, "en", { numeric: true }));
22213
+ for (const version3 of versions) {
22214
+ const directory = join4(root, version3);
22205
22215
  const installations = [
22206
22216
  directory,
22207
22217
  ...installedDirectories(directory).map((build) => join4(directory, build))
@@ -75730,8 +75740,8 @@ function isAgentVersionSupported(reportedVersion, minimumSupportedVersion) {
75730
75740
 
75731
75741
  // src/engine/agent/discovery/executable-discovery.ts
75732
75742
  import { isAbsolute as isAbsolute13 } from "node:path";
75733
- async function resolveSpecificationExecutables(executableName, overrideVariable, resolveInstalled, context) {
75734
- const override = context.environment[overrideVariable];
75743
+ async function resolveSpecificationExecutables(executableName, overrideVariable2, resolveInstalled, context) {
75744
+ const override = context.environment[overrideVariable2];
75735
75745
  if (override !== void 0) {
75736
75746
  if (override.length === 0 || !isAbsolute13(override)) {
75737
75747
  return [];
@@ -75775,8 +75785,8 @@ async function probeVersion(executable, arguments_, environment, defaultWorkspac
75775
75785
  signal,
75776
75786
  timeoutMilliseconds
75777
75787
  });
75778
- const version2 = normalize4(result.stdout || result.stderr);
75779
- if (version2.length === 0) {
75788
+ const version3 = normalize4(result.stdout || result.stderr);
75789
+ if (version3.length === 0) {
75780
75790
  throw new ProcessExecutionError("process_exit_failed", "The executable did not report a version", {
75781
75791
  diagnosticDetails: {
75782
75792
  probeReason: "empty_version_output",
@@ -75786,7 +75796,7 @@ async function probeVersion(executable, arguments_, environment, defaultWorkspac
75786
75796
  }
75787
75797
  });
75788
75798
  }
75789
- return version2;
75799
+ return version3;
75790
75800
  }
75791
75801
 
75792
75802
  // src/engine/agent/discovery/discover-agent.ts
@@ -83200,11 +83210,11 @@ var LocalSqliteDatabase = class {
83200
83210
  }
83201
83211
  }
83202
83212
  #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) {
83213
+ const version3 = external_exports.object({ user_version: external_exports.number().int().nonnegative() }).parse(this.#sqlite.prepare("PRAGMA user_version").get()).user_version;
83214
+ if (version3 > migrations.length) {
83205
83215
  throw new Error(`The ${label} was created by a newer Mobius version`);
83206
83216
  }
83207
- for (let index2 = version2; index2 < migrations.length; index2 += 1) {
83217
+ for (let index2 = version3; index2 < migrations.length; index2 += 1) {
83208
83218
  const migration = migrations[index2];
83209
83219
  if (migration === void 0) {
83210
83220
  throw new Error(`The ${label} migration is unavailable`);
@@ -83251,9 +83261,9 @@ function recordAppliedAdmissionOrder(path7) {
83251
83261
  }
83252
83262
  const database = new DatabaseSync3(path7);
83253
83263
  try {
83254
- const version2 = database.prepare("PRAGMA user_version").get()?.["user_version"];
83264
+ const version3 = database.prepare("PRAGMA user_version").get()?.["user_version"];
83255
83265
  const column = database.prepare("SELECT name FROM pragma_table_info('execution_receipt') WHERE name = 'admission_order'").get();
83256
- if (version2 === 9 && column !== void 0) {
83266
+ if (version3 === 9 && column !== void 0) {
83257
83267
  database.exec("PRAGMA user_version = 10");
83258
83268
  }
83259
83269
  } finally {
@@ -84325,7 +84335,20 @@ var REMOTE_DIAGNOSTIC_FIELDS = [
84325
84335
  "cause1Name",
84326
84336
  "cause1Code",
84327
84337
  "cause2Name",
84328
- "cause2Code"
84338
+ "cause2Code",
84339
+ "platform",
84340
+ "architecture",
84341
+ "osRelease",
84342
+ "nodeVersion",
84343
+ "uptimeSeconds",
84344
+ "agentCount",
84345
+ "omittedAgents",
84346
+ "agentVersion",
84347
+ "adapterVersion",
84348
+ "versionSource",
84349
+ "executableLocation",
84350
+ "executableOverride",
84351
+ "codexHome"
84329
84352
  ];
84330
84353
  var FIELD_VALUE_PATTERN = /^[a-zA-Z0-9_.: -]{1,256}$/u;
84331
84354
  var RuntimeDiagnosticLog = class {
@@ -84345,7 +84368,7 @@ var RuntimeDiagnosticLog = class {
84345
84368
  ];
84346
84369
  }
84347
84370
  // Export only correlation and failure metadata. Local messages and paths stay local.
84348
- snapshot = () => {
84371
+ snapshot = (current = []) => {
84349
84372
  const merged = [];
84350
84373
  let truncated = false;
84351
84374
  for (const source of this.#sources) {
@@ -84354,6 +84377,7 @@ var RuntimeDiagnosticLog = class {
84354
84377
  truncated ||= collected.truncated;
84355
84378
  }
84356
84379
  merged.sort(compareTimestamp);
84380
+ merged.push(...current.map(exportedFields));
84357
84381
  const entries = merged.slice(-MAXIMUM_ENTRIES);
84358
84382
  truncated ||= entries.length < merged.length;
84359
84383
  while (JSON.stringify(entries).length > MAXIMUM_REPORT_BYTES && entries.length > 0) {
@@ -84702,9 +84726,9 @@ function createCatalogAgentResolver(discover, readConfig, publish) {
84702
84726
  await pending;
84703
84727
  return config2.catalog.find(agent.id);
84704
84728
  }
84705
- let release = () => void 0;
84729
+ let release2 = () => void 0;
84706
84730
  const gate = new Promise((resolveGate) => {
84707
- release = resolveGate;
84731
+ release2 = resolveGate;
84708
84732
  });
84709
84733
  swaps.set(agent.id, gate);
84710
84734
  try {
@@ -84728,7 +84752,7 @@ function createCatalogAgentResolver(discover, readConfig, publish) {
84728
84752
  return config2.catalog.find(agent.id);
84729
84753
  } finally {
84730
84754
  swaps.delete(agent.id);
84731
- release();
84755
+ release2();
84732
84756
  }
84733
84757
  };
84734
84758
  }
@@ -87777,7 +87801,7 @@ var SessionManager2 = class {
87777
87801
  return;
87778
87802
  }
87779
87803
  this.#announceClosed(options.sessionId, "This Session was closed on request.");
87780
- const release = (async () => {
87804
+ const release2 = (async () => {
87781
87805
  const retiring = this.#sessionRetirements.get(options.sessionId);
87782
87806
  if (retiring !== void 0) {
87783
87807
  await retiring;
@@ -87799,14 +87823,14 @@ var SessionManager2 = class {
87799
87823
  ),
87800
87824
  SESSION_CLOSE_TIMEOUT_MILLISECONDS
87801
87825
  );
87802
- const completion = Promise.race([release, deadline.promise]).finally(timeout.cancel);
87826
+ const completion = Promise.race([release2, deadline.promise]).finally(timeout.cancel);
87803
87827
  this.#sessionClosures.set(options.sessionId, completion);
87804
87828
  const releaseFinished = () => {
87805
87829
  if (this.#sessionClosures.get(options.sessionId) === completion) {
87806
87830
  this.#sessionClosures.delete(options.sessionId);
87807
87831
  }
87808
87832
  };
87809
- void release.then(releaseFinished, releaseFinished);
87833
+ void release2.then(releaseFinished, releaseFinished);
87810
87834
  await waitForSharedOperation(completion, options.signal);
87811
87835
  });
87812
87836
  close = async () => {
@@ -88658,7 +88682,7 @@ function cancelledBeforeStart(state) {
88658
88682
  return false;
88659
88683
  }
88660
88684
  const outcome = decodeKnownSessionEventPayload(JSON.parse(state.outcome));
88661
- return outcome?.type === "lifecycle-metadata" && outcome.payload.kind === "prompt.completed" && outcome.payload.stopReason === "cancelled";
88685
+ return outcome?.type === "lifecycle-metadata" && outcome.payload.kind === "prompt.completed" && promptCompletion(outcome.payload).kind === "cancelled";
88662
88686
  }
88663
88687
  function executionOutcome(state) {
88664
88688
  switch (state.kind) {
@@ -90262,7 +90286,7 @@ var RelayConnectionDiagnostics = class {
90262
90286
  this.#relayOrigin = relayUrl.origin;
90263
90287
  this.#route = describeEnvironmentProxyRoute(relayUrl);
90264
90288
  }
90265
- snapshot = () => this.#localLog.snapshot();
90289
+ snapshot = (current = []) => this.#localLog.snapshot(current);
90266
90290
  catalogFailed = (failure2) => {
90267
90291
  const details = { ...this.#route, relayOrigin: this.#relayOrigin };
90268
90292
  addFailureDetails(details, failure2);
@@ -91513,7 +91537,7 @@ var sessionCancelBeforeStartCommand = {
91513
91537
  const turn = sessionTurns.get(message.commandId, message.sessionId);
91514
91538
  if (turn === void 0) {
91515
91539
  const outcome = operations.recordCancellationBeforeAdmission(message.commandId, message.sessionId);
91516
- if (outcome?.type === "lifecycle-metadata" && outcome.payload.kind === "prompt.completed" && outcome.payload.stopReason === "cancelled") {
91540
+ if (outcome?.type === "lifecycle-metadata" && outcome.payload.kind === "prompt.completed" && promptCompletion(outcome.payload).kind === "cancelled") {
91517
91541
  void eventProjection.replayOutcome(message.sessionId, outcome).catch((error62) => {
91518
91542
  reportOperationFailure(socket, message.commandId, message.sessionId, error62);
91519
91543
  });
@@ -92156,10 +92180,79 @@ var sessionPromptCommand = {
92156
92180
  }
92157
92181
  };
92158
92182
 
92183
+ // src/engine/runtime/observability/environment-diagnostics.ts
92184
+ import { release } from "node:os";
92185
+ function version2(value) {
92186
+ 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(
92187
+ value.slice(0, 128)
92188
+ )?.[1] ?? "unavailable";
92189
+ }
92190
+ function executableLocation(agent) {
92191
+ const path7 = agent.agentIdentity.realPath.replaceAll("\\", "/");
92192
+ if (/\/(?:ChatGPT|Codex)\.app\//u.test(path7)) {
92193
+ return "desktop_bundle";
92194
+ }
92195
+ if (path7.includes("/node_modules/")) {
92196
+ return "node_package";
92197
+ }
92198
+ if (path7.includes("/Cellar/") || path7.includes("/homebrew/")) {
92199
+ return "homebrew";
92200
+ }
92201
+ if (path7.startsWith("/usr/bin/") || path7.startsWith("/bin/")) {
92202
+ return "system";
92203
+ }
92204
+ return "other";
92205
+ }
92206
+ function overrideVariable(agentId) {
92207
+ switch (agentId) {
92208
+ case "codex":
92209
+ return "MOBIUS_CODEX_PATH";
92210
+ case "claude":
92211
+ return "MOBIUS_CLAUDE_PATH";
92212
+ case "pi":
92213
+ return "MOBIUS_PI_PATH";
92214
+ case "opencode":
92215
+ return "MOBIUS_OPENCODE_PATH";
92216
+ default:
92217
+ return null;
92218
+ }
92219
+ }
92220
+ function runtimeEnvironmentDiagnostics(config2) {
92221
+ const agents = config2.catalog.read().agents;
92222
+ const timestamp = (/* @__PURE__ */ new Date()).toISOString();
92223
+ return [
92224
+ {
92225
+ event: "runtime_environment",
92226
+ timestamp,
92227
+ platform: process.platform,
92228
+ architecture: process.arch,
92229
+ osRelease: /^(\d+(?:\.\d+){1,3})/u.exec(release())?.[1] ?? "unavailable",
92230
+ nodeVersion: process.versions.node,
92231
+ uptimeSeconds: Math.floor(process.uptime()).toString(),
92232
+ agentCount: agents.length.toString(),
92233
+ omittedAgents: Math.max(0, agents.length - 16).toString()
92234
+ },
92235
+ ...agents.slice(0, 16).map((agent) => {
92236
+ const override = overrideVariable(agent.id);
92237
+ return {
92238
+ event: "agent_inventory",
92239
+ timestamp,
92240
+ agentId: override === null ? "custom" : agent.id,
92241
+ agentVersion: version2(agent.agentVersion),
92242
+ adapterVersion: version2(agent.adapterVersion),
92243
+ versionSource: "runtime_catalog",
92244
+ executableLocation: executableLocation(agent),
92245
+ executableOverride: override === null ? "unknown" : agent.environment[override] === void 0 ? "unset" : "set",
92246
+ codexHome: agent.id !== "codex" ? "not_applicable" : agent.environment["CODEX_HOME"] === void 0 ? "default" : "custom"
92247
+ };
92248
+ })
92249
+ ];
92250
+ }
92251
+
92159
92252
  // src/engine/runtime/command/registry/runtime.ts
92160
92253
  var runtimeDiagnosticsCommand = {
92161
92254
  kind: "runtime.diagnostics.read",
92162
- handle: ({ diagnostics, socket }, message) => {
92255
+ handle: ({ config: config2, diagnostics, socket }, message) => {
92163
92256
  if (message.kind !== "runtime.diagnostics.read") {
92164
92257
  throw new Error("Command kind mismatch");
92165
92258
  }
@@ -92168,7 +92261,7 @@ var runtimeDiagnosticsCommand = {
92168
92261
  kind: "runtime.diagnostics.result",
92169
92262
  requestId: message.requestId,
92170
92263
  version: package_default.version,
92171
- ...diagnostics.snapshot()
92264
+ ...diagnostics.snapshot(runtimeEnvironmentDiagnostics(config2))
92172
92265
  });
92173
92266
  } catch {
92174
92267
  send(socket, {
@@ -92707,7 +92800,7 @@ function connectRelay(url2, signal, transportFailed = () => void 0) {
92707
92800
  headers
92708
92801
  });
92709
92802
  socket.binaryType = "arraybuffer";
92710
- const release = (reason) => {
92803
+ const release2 = (reason) => {
92711
92804
  if (released) {
92712
92805
  return;
92713
92806
  }
@@ -92731,7 +92824,7 @@ function connectRelay(url2, signal, transportFailed = () => void 0) {
92731
92824
  finished = true;
92732
92825
  cleanup();
92733
92826
  socket.close();
92734
- release(error62);
92827
+ release2(error62);
92735
92828
  reject2(error62);
92736
92829
  };
92737
92830
  const onAbort = () => {
@@ -92775,7 +92868,7 @@ function connectRelay(url2, signal, transportFailed = () => void 0) {
92775
92868
  }
92776
92869
  finished = true;
92777
92870
  cleanup();
92778
- resolve19({ release, socket });
92871
+ resolve19({ release: release2, socket });
92779
92872
  };
92780
92873
  function onTimeout() {
92781
92874
  fail(
@@ -93746,4 +93839,4 @@ export {
93746
93839
  * MIT Licensed
93747
93840
  *)
93748
93841
  */
93749
- //# sourceMappingURL=chunk-TQJ2GJH7.js.map
93842
+ //# sourceMappingURL=chunk-XABCAZR5.js.map