@moxt-ai/mobius 0.0.189 → 0.0.191

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/cli.js CHANGED
@@ -3381,7 +3381,7 @@ var program = new Command();
3381
3381
  // package.json
3382
3382
  var package_default = {
3383
3383
  name: "@moxt-ai/mobius",
3384
- version: "0.0.189",
3384
+ version: "0.0.191",
3385
3385
  description: "Mobius CLI for pairing and running local AI agent services.",
3386
3386
  type: "module",
3387
3387
  bin: {
@@ -28930,6 +28930,7 @@ var sessionCommandsUpdatedEventSchema = external_exports.object({
28930
28930
  }).readonly();
28931
28931
  var sessionInfoUpdatedEventSchema = external_exports.object({
28932
28932
  kind: external_exports.literal(SESSION_INFO_UPDATED_KIND),
28933
+ projectId: identifierStringSchema.optional(),
28933
28934
  sessionId: identifierStringSchema,
28934
28935
  title: external_exports.string().max(500).nullable(),
28935
28936
  updatedAt: external_exports.string().max(128)
@@ -29115,6 +29116,8 @@ var decodeSessionConfigureCommand = (encoded) => decode3(encoded, sessionConfigu
29115
29116
  var encodeSessionConfigureCommand = (message) => encode3(message, sessionConfigureCommandSchema);
29116
29117
  var decodeSessionConfigUpdatedEvent = (encoded) => decode3(encoded, sessionConfigUpdatedEventSchema);
29117
29118
  var encodeSessionConfigUpdatedEvent = (message) => encode3(message, sessionConfigUpdatedEventSchema);
29119
+ var decodeSessionInfoUpdatedEvent = (encoded) => decode3(encoded, sessionInfoUpdatedEventSchema);
29120
+ var encodeSessionInfoUpdatedEvent = (message) => encode3(message, sessionInfoUpdatedEventSchema);
29118
29121
  var decodeSessionPermissionRespondCommand = (encoded) => decode3(encoded, sessionPermissionRespondCommandSchema);
29119
29122
  var encodeSessionPermissionRespondCommand = (message) => encode3(message, sessionPermissionRespondCommandSchema);
29120
29123
  var decodeSessionElicitationRespondCommand = (encoded) => decode3(encoded, sessionElicitationRespondCommandSchema);
@@ -29652,6 +29655,24 @@ var encodeNativeSessionResult = (value) => JSON.stringify(nativeSessionResultSch
29652
29655
  var decodeNativeSessionCancel = (encoded) => decode4(nativeSessionCancelSchema, encoded);
29653
29656
  var encodeNativeSessionCancel = (value) => JSON.stringify(nativeSessionCancelSchema.parse(value));
29654
29657
 
29658
+ // ../protocol/src/runtime-diagnostics.ts
29659
+ var identifier = external_exports.custom(isIdentifier);
29660
+ var runtimeDiagnosticsRequestSchema = external_exports.strictObject({
29661
+ kind: external_exports.literal("runtime.diagnostics.read"),
29662
+ requestId: identifier
29663
+ });
29664
+ var runtimeDiagnosticsResultSchema = external_exports.strictObject({
29665
+ kind: external_exports.literal("runtime.diagnostics.result"),
29666
+ requestId: identifier,
29667
+ truncated: external_exports.boolean(),
29668
+ version: external_exports.string().max(32),
29669
+ entries: external_exports.array(external_exports.record(external_exports.string(), external_exports.string().max(256)).readonly()).max(200).readonly()
29670
+ }).refine((value) => JSON.stringify(value).length <= 65536, "Diagnostics exceed the report limit");
29671
+ var decodeRuntimeDiagnosticsRequest = (raw) => runtimeDiagnosticsRequestSchema.parse(JSON.parse(raw));
29672
+ var decodeRuntimeDiagnosticsResult = (raw) => runtimeDiagnosticsResultSchema.parse(JSON.parse(raw));
29673
+ var encodeRuntimeDiagnosticsRequest = (value) => JSON.stringify(runtimeDiagnosticsRequestSchema.parse(value));
29674
+ var encodeRuntimeDiagnosticsResult = (value) => JSON.stringify(runtimeDiagnosticsResultSchema.parse(value));
29675
+
29655
29676
  // ../protocol/src/session-event-log-v2.ts
29656
29677
  var MAX_EVENT_COUNT = 1e4;
29657
29678
  var MAX_COLLECTION_SIZE = 1e3;
@@ -30225,6 +30246,11 @@ var serviceToDaemonSignatures = {
30225
30246
  encodeRuntimeLivenessReadyEvent,
30226
30247
  decodeRuntimeLivenessReadyEvent
30227
30248
  ),
30249
+ "runtime.diagnostics.read": defineMessageSignature(
30250
+ "runtime.diagnostics.read",
30251
+ encodeRuntimeDiagnosticsRequest,
30252
+ decodeRuntimeDiagnosticsRequest
30253
+ ),
30228
30254
  [RUNTIME_PING_KIND]: defineMessageSignature(RUNTIME_PING_KIND, encodeRuntimePingCommand, decodeRuntimePingCommand),
30229
30255
  [SESSION_CANCEL_KIND]: defineMessageSignature(
30230
30256
  SESSION_CANCEL_KIND,
@@ -30351,6 +30377,11 @@ var daemonToServiceSignatures = {
30351
30377
  encodeSessionStatusChangedEvent,
30352
30378
  decodeSessionStatusChangedEvent
30353
30379
  ),
30380
+ [SESSION_INFO_UPDATED_KIND]: defineMessageSignature(
30381
+ SESSION_INFO_UPDATED_KIND,
30382
+ encodeSessionInfoUpdatedEvent,
30383
+ decodeSessionInfoUpdatedEvent
30384
+ ),
30354
30385
  [SESSION_QUEUED_KIND]: defineMessageSignature(
30355
30386
  SESSION_QUEUED_KIND,
30356
30387
  encodeSessionQueuedEvent,
@@ -30366,6 +30397,11 @@ var daemonToServiceSignatures = {
30366
30397
  encodeRuntimeHeartbeatEvent,
30367
30398
  decodeRuntimeHeartbeatEvent
30368
30399
  ),
30400
+ "runtime.diagnostics.result": defineMessageSignature(
30401
+ "runtime.diagnostics.result",
30402
+ encodeRuntimeDiagnosticsResult,
30403
+ decodeRuntimeDiagnosticsResult
30404
+ ),
30369
30405
  [RUNTIME_PONG_KIND]: defineMessageSignature(RUNTIME_PONG_KIND, encodeRuntimePongEvent, decodeRuntimePongEvent),
30370
30406
  [SESSION_EVENT_V2_KIND]: defineMessageSignature(
30371
30407
  SESSION_EVENT_V2_KIND,
@@ -34218,10 +34254,10 @@ function sql(strings, ...params) {
34218
34254
  return new SQL(result);
34219
34255
  }
34220
34256
  _sql.join = join21;
34221
- function identifier(value) {
34257
+ function identifier2(value) {
34222
34258
  return new Name(value);
34223
34259
  }
34224
- _sql.identifier = identifier;
34260
+ _sql.identifier = identifier2;
34225
34261
  function placeholder2(name2) {
34226
34262
  return new Placeholder(name2);
34227
34263
  }
@@ -35817,19 +35853,19 @@ var SQLiteCustomColumn = class extends SQLiteColumn {
35817
35853
  mapFromJsonValue(value) {
35818
35854
  return typeof this.mapJson === "function" ? this.mapJson(value) : this.mapFromDriverValue(value);
35819
35855
  }
35820
- jsonSelectIdentifier(identifier, sql2) {
35821
- if (typeof this.forJsonSelect === "function") return this.forJsonSelect(identifier, sql2);
35856
+ jsonSelectIdentifier(identifier2, sql2) {
35857
+ if (typeof this.forJsonSelect === "function") return this.forJsonSelect(identifier2, sql2);
35822
35858
  const rawType = this.getSQLType().toLowerCase();
35823
35859
  const parenPos = rawType.indexOf("(");
35824
35860
  switch (parenPos + 1 ? rawType.slice(0, parenPos) : rawType) {
35825
35861
  case "numeric":
35826
35862
  case "decimal":
35827
35863
  case "bigint":
35828
- return sql2`cast(${identifier} as text)`;
35864
+ return sql2`cast(${identifier2} as text)`;
35829
35865
  case "blob":
35830
- return sql2`hex(${identifier})`;
35866
+ return sql2`hex(${identifier2})`;
35831
35867
  default:
35832
- return identifier;
35868
+ return identifier2;
35833
35869
  }
35834
35870
  }
35835
35871
  mapToDriverValue = (value) => {
@@ -42399,6 +42435,74 @@ var DaemonDiagnosticLog = class {
42399
42435
  this.#path = join18(this.#directory, "daemon.log");
42400
42436
  this.#maximumBytes = maximumBytes;
42401
42437
  }
42438
+ // Export only correlation and failure metadata. Local messages and paths stay local.
42439
+ snapshot = () => {
42440
+ let content;
42441
+ try {
42442
+ content = readFileSync2(this.#path, "utf8");
42443
+ } catch (cause) {
42444
+ if (cause instanceof Error && Reflect.get(cause, "code") === "ENOENT") {
42445
+ return { entries: [], truncated: false };
42446
+ }
42447
+ throw cause;
42448
+ }
42449
+ const lines = content.split("\n").filter((line) => line.length > 0);
42450
+ const entries = [];
42451
+ const fields = [
42452
+ "agentId",
42453
+ "operation",
42454
+ "runtimeId",
42455
+ "closeCode",
42456
+ "timeoutMilliseconds",
42457
+ "proxyRoute",
42458
+ "timestamp",
42459
+ "event",
42460
+ "channelId",
42461
+ "requestId",
42462
+ "commandId",
42463
+ "sessionId",
42464
+ "turnId",
42465
+ "connectionEpoch",
42466
+ "code",
42467
+ "source",
42468
+ "failureName",
42469
+ "failureCode",
42470
+ "failureStatusCode",
42471
+ "cause1Name",
42472
+ "cause1Code",
42473
+ "cause2Name",
42474
+ "cause2Code"
42475
+ ];
42476
+ for (const line of lines.slice(-200)) {
42477
+ const start = line.indexOf("{");
42478
+ if (start < 0) {
42479
+ continue;
42480
+ }
42481
+ let value;
42482
+ try {
42483
+ value = JSON.parse(line.slice(start));
42484
+ } catch {
42485
+ continue;
42486
+ }
42487
+ if (typeof value !== "object" || value === null) {
42488
+ continue;
42489
+ }
42490
+ const entry = {};
42491
+ for (const field of fields) {
42492
+ const item = Reflect.get(value, field);
42493
+ if (typeof item === "string" && /^[a-zA-Z0-9_.: -]{1,256}$/u.test(item)) {
42494
+ entry[field] = item;
42495
+ }
42496
+ }
42497
+ entries.push(entry);
42498
+ }
42499
+ let truncated = lines.length > 200 || Buffer.byteLength(content) >= this.#maximumBytes - 4096;
42500
+ while (JSON.stringify(entries).length > 6e4) {
42501
+ entries.shift();
42502
+ truncated = true;
42503
+ }
42504
+ return { entries, truncated };
42505
+ };
42402
42506
  record = (diagnostic) => {
42403
42507
  const encoded = `${diagnostic.replace(/[\r\n]+/gu, " ").trim()}
42404
42508
  `;
@@ -44710,6 +44814,7 @@ var RelayConnectionDiagnostics = class {
44710
44814
  this.#relayOrigin = relayUrl.origin;
44711
44815
  this.#route = describeEnvironmentProxyRoute(relayUrl);
44712
44816
  }
44817
+ snapshot = () => this.#localLog.snapshot();
44713
44818
  catalogFailed = (failure2) => {
44714
44819
  const details = { ...this.#route, relayOrigin: this.#relayOrigin };
44715
44820
  addFailureDetails(details, failure2);
@@ -44781,6 +44886,7 @@ var RelayConnectionDiagnostics = class {
44781
44886
  }
44782
44887
  this.#localLog.record(
44783
44888
  `Mobius daemon diagnostic ${JSON.stringify({
44889
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
44784
44890
  channelId: this.#channelId,
44785
44891
  event,
44786
44892
  requestId,
@@ -44795,7 +44901,12 @@ var RelayConnectionDiagnostics = class {
44795
44901
  event,
44796
44902
  sessionId: this.#channelId
44797
44903
  });
44798
- const encoded = JSON.stringify({ channelId: this.#channelId, event, ...details });
44904
+ const encoded = JSON.stringify({
44905
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
44906
+ channelId: this.#channelId,
44907
+ event,
44908
+ ...details
44909
+ });
44799
44910
  this.#localLog.record(`Mobius relay diagnostic ${encoded}`);
44800
44911
  if (warning) {
44801
44912
  process.stderr.write(`Mobius relay diagnostic ${encoded}
@@ -46428,6 +46539,37 @@ function createDaemonCommandHandler({
46428
46539
  return {
46429
46540
  handle: (message) => {
46430
46541
  const kind = message.kind;
46542
+ if (kind === "runtime.diagnostics.read") {
46543
+ audit.record({
46544
+ event: "runtime_diagnostics_read",
46545
+ commandId: message.requestId,
46546
+ sessionId: "runtime",
46547
+ details: {}
46548
+ });
46549
+ try {
46550
+ send(socket, {
46551
+ kind: "runtime.diagnostics.result",
46552
+ requestId: message.requestId,
46553
+ version: package_default.version,
46554
+ ...diagnostics.snapshot()
46555
+ });
46556
+ } catch {
46557
+ audit.record({
46558
+ event: "runtime_diagnostics_failed",
46559
+ commandId: message.requestId,
46560
+ sessionId: "runtime",
46561
+ details: { code: "diagnostics_unavailable" }
46562
+ });
46563
+ send(socket, {
46564
+ kind: "session.operation.failed",
46565
+ requestId: message.requestId,
46566
+ sessionId: "runtime",
46567
+ code: "diagnostics_unavailable",
46568
+ message: "Local diagnostics are unavailable."
46569
+ });
46570
+ }
46571
+ return;
46572
+ }
46431
46573
  if (kind === RUNTIME_PING_KIND) {
46432
46574
  send(socket, { kind: RUNTIME_PONG_KIND, requestId: message.requestId });
46433
46575
  return;
@@ -47148,6 +47290,7 @@ var DaemonSessionEventPublisher = class {
47148
47290
  this.#send({ kind: "session.operation.failed", sessionId, requestId, code, message });
47149
47291
  };
47150
47292
  publishStatus = (event) => this.#send(event);
47293
+ publishInfo = (event) => this.#send(event);
47151
47294
  #send = (message) => {
47152
47295
  const socket = this.#socket;
47153
47296
  if (socket === null || socket.readyState !== WebSocket8.OPEN) {
@@ -47454,6 +47597,9 @@ async function runDaemon(config2, audit, signal, timer = systemDaemonTimer, opti
47454
47597
  const agentRuntime = new AgentRuntimeManager(
47455
47598
  new DaemonAcpObserver((_sessionId, event) => {
47456
47599
  activeTurns.recordEvent(event);
47600
+ if (event.kind === "session.info.updated") {
47601
+ publisher.publishInfo(event);
47602
+ }
47457
47603
  }, eventLogV2.record),
47458
47604
  sessionStore,
47459
47605
  {