@moxt-ai/mobius 0.0.145 → 0.0.147

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 (33) hide show
  1. package/dist/acp/agent-runtime-manager.d.ts +1 -0
  2. package/dist/acp/agent-runtime-manager.d.ts.map +1 -1
  3. package/dist/acp/agent-runtime-manager.js +4 -0
  4. package/dist/acp/agent-runtime-manager.js.map +1 -1
  5. package/dist/agent-catalog/agent-diagnostics.d.ts +1 -1
  6. package/dist/agent-catalog/agent-diagnostics.d.ts.map +1 -1
  7. package/dist/agent-catalog/agent-diagnostics.js +31 -8
  8. package/dist/agent-catalog/agent-diagnostics.js.map +1 -1
  9. package/dist/agent-catalog/agent-discovery.d.ts +15 -1
  10. package/dist/agent-catalog/agent-discovery.d.ts.map +1 -1
  11. package/dist/agent-catalog/agent-discovery.js +34 -1
  12. package/dist/agent-catalog/agent-discovery.js.map +1 -1
  13. package/dist/agent-catalog/discover-agent.d.ts.map +1 -1
  14. package/dist/agent-catalog/discover-agent.js +3 -2
  15. package/dist/agent-catalog/discover-agent.js.map +1 -1
  16. package/dist/agent-catalog/discover-local-agents.d.ts +1 -0
  17. package/dist/agent-catalog/discover-local-agents.d.ts.map +1 -1
  18. package/dist/agent-catalog/discover-local-agents.js +8 -3
  19. package/dist/agent-catalog/discover-local-agents.js.map +1 -1
  20. package/dist/cli.js +135 -19
  21. package/dist/cli.js.map +2 -2
  22. package/dist/daemon-command-handler.d.ts.map +1 -1
  23. package/dist/daemon-command-handler.js +17 -1
  24. package/dist/daemon-command-handler.js.map +1 -1
  25. package/dist/index.js +90 -9
  26. package/dist/index.js.map +2 -2
  27. package/dist/native-sessions/service.d.ts +2 -0
  28. package/dist/native-sessions/service.d.ts.map +1 -1
  29. package/dist/native-sessions/service.js +4 -2
  30. package/dist/native-sessions/service.js.map +1 -1
  31. package/dist/runtime.js +90 -9
  32. package/dist/runtime.js.map +2 -2
  33. package/package.json +1 -1
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.145",
3384
+ version: "0.0.147",
3385
3385
  description: "Mobius CLI for pairing and running local AI agent services.",
3386
3386
  type: "module",
3387
3387
  bin: {
@@ -4227,6 +4227,17 @@ var AgentProbeFailed = class extends UnavailableAgent {
4227
4227
  this.message = message;
4228
4228
  }
4229
4229
  };
4230
+ var UnsupportedAgentVersion = class extends UnavailableInstalledAgent {
4231
+ code = "agent_version_unsupported";
4232
+ message;
4233
+ minimumSupportedVersion;
4234
+ status = "unsupported_version";
4235
+ constructor(specification, agent, minimumSupportedVersion) {
4236
+ super(specification, agent);
4237
+ this.minimumSupportedVersion = minimumSupportedVersion;
4238
+ this.message = `Agent version ${agent.agentVersion} is below the minimum supported version ${minimumSupportedVersion}`;
4239
+ }
4240
+ };
4230
4241
  var IntegrationProbeFailed = class extends UnavailableInstalledAgent {
4231
4242
  code;
4232
4243
  message;
@@ -4254,12 +4265,25 @@ var AuthenticationRequiredAgent = class extends UnavailableInstalledAgent {
4254
4265
  super(specification, agent);
4255
4266
  }
4256
4267
  };
4268
+ var AgentDiscoveryResult = class {
4269
+ detectionMilliseconds;
4270
+ discovery;
4271
+ constructor(discovery, detectionMilliseconds) {
4272
+ if (!Number.isFinite(detectionMilliseconds) || detectionMilliseconds < 0) {
4273
+ throw new Error("The Agent detection duration is invalid");
4274
+ }
4275
+ this.detectionMilliseconds = Math.round(detectionMilliseconds * 1e3) / 1e3;
4276
+ this.discovery = discovery;
4277
+ }
4278
+ };
4257
4279
  var LocalAgentInventory = class {
4258
4280
  available;
4259
4281
  discoveries;
4260
4282
  installable;
4283
+ results;
4261
4284
  unavailable;
4262
- constructor(discoveries) {
4285
+ constructor(results) {
4286
+ const discoveries = results.map((result) => result.discovery);
4263
4287
  const available = [];
4264
4288
  const unavailable = [];
4265
4289
  for (const discovery of discoveries) {
@@ -4278,8 +4302,17 @@ var LocalAgentInventory = class {
4278
4302
  (discovery) => discovery instanceof UnavailableInstalledAgent ? discovery.agent : new MissingAgentDefinition(discovery.specification.id, discovery.specification.label)
4279
4303
  )
4280
4304
  );
4305
+ this.results = Object.freeze([...results]);
4281
4306
  this.unavailable = Object.freeze(unavailable);
4282
4307
  }
4308
+ detectionMillisecondsFor = (discovery) => {
4309
+ for (const result of this.results) {
4310
+ if (result.discovery === discovery) {
4311
+ return result.detectionMilliseconds;
4312
+ }
4313
+ }
4314
+ throw new Error("The Agent discovery result is unavailable");
4315
+ };
4283
4316
  readyAgents = () => this.available.map((discovery) => discovery.agent);
4284
4317
  };
4285
4318
 
@@ -4313,19 +4346,48 @@ var UnavailableAgentDiagnostic = class {
4313
4346
  this.status = discovery.status;
4314
4347
  }
4315
4348
  };
4349
+ var UnsupportedAgentVersionDiagnostic = class extends UnavailableAgentDiagnostic {
4350
+ agentVersion;
4351
+ minimumSupportedVersion;
4352
+ constructor(discovery) {
4353
+ super(discovery);
4354
+ this.agentVersion = discovery.agent.agentVersion;
4355
+ this.minimumSupportedVersion = discovery.minimumSupportedVersion;
4356
+ }
4357
+ };
4358
+ function withDetectionTime(diagnostic, detectionMilliseconds, verbose) {
4359
+ return verbose ? { ...diagnostic, detectionMilliseconds } : diagnostic;
4360
+ }
4361
+ function unavailableDiagnostic(discovery) {
4362
+ return discovery instanceof UnsupportedAgentVersion ? new UnsupportedAgentVersionDiagnostic(discovery) : new UnavailableAgentDiagnostic(discovery);
4363
+ }
4316
4364
  var AgentDiagnostics = class {
4317
4365
  available;
4318
4366
  unavailable;
4319
- constructor(inventory) {
4320
- this.available = inventory.available.map((discovery) => new AvailableAgentDiagnostic(discovery));
4321
- this.unavailable = inventory.unavailable.map((discovery) => new UnavailableAgentDiagnostic(discovery));
4367
+ constructor(inventory, verbose) {
4368
+ this.available = inventory.available.map(
4369
+ (discovery) => withDetectionTime(
4370
+ new AvailableAgentDiagnostic(discovery),
4371
+ inventory.detectionMillisecondsFor(discovery),
4372
+ verbose
4373
+ )
4374
+ );
4375
+ this.unavailable = inventory.unavailable.map(
4376
+ (discovery) => withDetectionTime(unavailableDiagnostic(discovery), inventory.detectionMillisecondsFor(discovery), verbose)
4377
+ );
4322
4378
  }
4323
4379
  };
4324
4380
  function humanLine(label, status, detail) {
4325
4381
  return `${label.padEnd(13)} ${status.padEnd(17)} ${detail}`.trimEnd();
4326
4382
  }
4327
- function formatAgentDiagnostics(inventory, json2) {
4328
- const diagnostics = new AgentDiagnostics(inventory);
4383
+ function detectionSuffix(diagnostic) {
4384
+ if (!("detectionMilliseconds" in diagnostic) || typeof diagnostic.detectionMilliseconds !== "number") {
4385
+ return "";
4386
+ }
4387
+ return ` detection=${Math.round(diagnostic.detectionMilliseconds).toString()}ms`;
4388
+ }
4389
+ function formatAgentDiagnostics(inventory, json2, verbose = false) {
4390
+ const diagnostics = new AgentDiagnostics(inventory, verbose);
4329
4391
  if (json2) {
4330
4392
  return `${JSON.stringify(diagnostics, null, 2)}
4331
4393
  `;
@@ -4333,11 +4395,17 @@ function formatAgentDiagnostics(inventory, json2) {
4333
4395
  const lines = [];
4334
4396
  for (const available of diagnostics.available) {
4335
4397
  lines.push(
4336
- humanLine(available.label, available.status, `${available.agentVersion} ${available.adapterVersion}`)
4398
+ humanLine(
4399
+ available.label,
4400
+ available.status,
4401
+ `${available.agentVersion} ${available.adapterVersion}${detectionSuffix(available)}`
4402
+ )
4337
4403
  );
4338
4404
  }
4339
4405
  for (const unavailable of diagnostics.unavailable) {
4340
- lines.push(humanLine(unavailable.label, unavailable.status, unavailable.message));
4406
+ lines.push(
4407
+ humanLine(unavailable.label, unavailable.status, `${unavailable.message}${detectionSuffix(unavailable)}`)
4408
+ );
4341
4409
  if (unavailable.recoveryCommand.length > 0) {
4342
4410
  lines.push(
4343
4411
  unavailable.code === "authentication_required" ? ` Authenticate locally: ${unavailable.recoveryCommand}` : ` Install adapter: ${unavailable.recoveryCommand}`
@@ -28077,15 +28145,20 @@ async function discoverAgent(specification, context) {
28077
28145
  );
28078
28146
  continue;
28079
28147
  }
28080
- if (!supportedVersion) {
28081
- continue;
28082
- }
28083
28148
  const installedAgent = new AgentIntegrationDefinition(
28084
28149
  specification.id,
28085
28150
  specification.label,
28086
28151
  agent.identity.requestedPath,
28087
28152
  agentVersion
28088
28153
  );
28154
+ if (!supportedVersion) {
28155
+ lastFailure = new UnsupportedAgentVersion(
28156
+ specification,
28157
+ installedAgent,
28158
+ specification.minimumSupportedAgentVersion
28159
+ );
28160
+ continue;
28161
+ }
28089
28162
  if (adapters.length === 0 && !(specification instanceof InProcessAcpAgentDefinition2)) {
28090
28163
  return new MissingAdapter(specification, installedAgent);
28091
28164
  }
@@ -28179,10 +28252,15 @@ async function discoverAgent(specification, context) {
28179
28252
  // src/agent-catalog/discover-local-agents.ts
28180
28253
  async function discoverLocalAgentInventory(options) {
28181
28254
  const specifications = options.specifications ?? supportedLocalAgentSpecifications();
28182
- const discoveries = await Promise.all(
28183
- specifications.map(async (specification) => await discoverAgent(specification, options))
28255
+ const monotonicTimeMilliseconds = options.monotonicTimeMilliseconds ?? (() => performance.now());
28256
+ const results = await Promise.all(
28257
+ specifications.map(async (specification) => {
28258
+ const startedAt = monotonicTimeMilliseconds();
28259
+ const discovery = await discoverAgent(specification, options);
28260
+ return new AgentDiscoveryResult(discovery, monotonicTimeMilliseconds() - startedAt);
28261
+ })
28184
28262
  );
28185
- return new LocalAgentInventory(discoveries);
28263
+ return new LocalAgentInventory(results);
28186
28264
  }
28187
28265
 
28188
28266
  // src/config.ts
@@ -28273,6 +28351,8 @@ var WORKSPACE_LIST_KIND = "workspace.list";
28273
28351
  var WORKSPACE_ENTRIES_KIND = "workspace.entries";
28274
28352
  var SESSION_PREPARE_KIND = "session.prepare";
28275
28353
  var SESSION_READY_KIND = "session.ready";
28354
+ var SESSION_LIST_KIND = "session.list";
28355
+ var SESSION_LISTED_KIND = "session.listed";
28276
28356
  var SESSION_QUERY_KIND = "session.query";
28277
28357
  var SESSION_QUERIED_KIND = "session.queried";
28278
28358
  var SESSION_CONFIGURE_KIND = "session.configure";
@@ -28324,6 +28404,16 @@ var sessionMetadataSchema = external_exports.strictObject({
28324
28404
  title: external_exports.string().max(500),
28325
28405
  updatedAt: external_exports.iso.datetime({ offset: true })
28326
28406
  }).readonly();
28407
+ var sessionListCommandSchema = external_exports.strictObject({
28408
+ kind: external_exports.literal(SESSION_LIST_KIND),
28409
+ limit: external_exports.number().int().positive().max(500),
28410
+ requestId: identifierStringSchema
28411
+ }).readonly();
28412
+ var sessionsListedEventSchema = external_exports.strictObject({
28413
+ entries: external_exports.array(sessionMetadataSchema).max(500).readonly(),
28414
+ kind: external_exports.literal(SESSION_LISTED_KIND),
28415
+ requestId: identifierStringSchema
28416
+ }).readonly();
28327
28417
  var sessionQueryCommandSchema = external_exports.strictObject({
28328
28418
  kind: external_exports.literal(SESSION_QUERY_KIND),
28329
28419
  requestId: identifierStringSchema,
@@ -28877,6 +28967,10 @@ var decodeWorkspaceListCommand = (encoded) => decode3(encoded, workspaceListComm
28877
28967
  var encodeWorkspaceListCommand = (message) => encode3(message, workspaceListCommandSchema);
28878
28968
  var decodeWorkspaceEntriesEvent = (encoded) => decode3(encoded, workspaceEntriesEventSchema);
28879
28969
  var encodeWorkspaceEntriesEvent = (message) => encode3(message, workspaceEntriesEventSchema);
28970
+ var decodeSessionListCommand = (encoded) => decode3(encoded, sessionListCommandSchema);
28971
+ var encodeSessionListCommand = (message) => encode3(message, sessionListCommandSchema);
28972
+ var decodeSessionsListedEvent = (encoded) => decode3(encoded, sessionsListedEventSchema);
28973
+ var encodeSessionsListedEvent = (message) => encode3(message, sessionsListedEventSchema);
28880
28974
  var decodeSessionQueryCommand = (encoded) => decode3(encoded, sessionQueryCommandSchema);
28881
28975
  var encodeSessionQueryCommand = (message) => encode3(message, sessionQueryCommandSchema);
28882
28976
  var decodeSessionsQueriedEvent = (encoded) => decode3(encoded, sessionsQueriedEventSchema);
@@ -29864,6 +29958,7 @@ var serviceToDaemonSignatures = {
29864
29958
  decodeAgentSettingsDiscoverCommand
29865
29959
  ),
29866
29960
  [FILE_READ_KIND]: defineMessageSignature(FILE_READ_KIND, encodeFileReadCommand, decodeFileReadCommand),
29961
+ [SESSION_LIST_KIND]: defineMessageSignature(SESSION_LIST_KIND, encodeSessionListCommand, decodeSessionListCommand),
29867
29962
  [SESSION_QUERY_KIND]: defineMessageSignature(
29868
29963
  SESSION_QUERY_KIND,
29869
29964
  encodeSessionQueryCommand,
@@ -29999,6 +30094,11 @@ var daemonToServiceSignatures = {
29999
30094
  [FILE_CHUNK_KIND]: defineMessageSignature(FILE_CHUNK_KIND, encodeFileChunkEvent, decodeFileChunkEvent),
30000
30095
  [FILE_END_KIND]: defineMessageSignature(FILE_END_KIND, encodeFileEndEvent, decodeFileEndEvent),
30001
30096
  [FILE_FAILED_KIND]: defineMessageSignature(FILE_FAILED_KIND, encodeFileFailedEvent, decodeFileFailedEvent),
30097
+ [SESSION_LISTED_KIND]: defineMessageSignature(
30098
+ SESSION_LISTED_KIND,
30099
+ encodeSessionsListedEvent,
30100
+ decodeSessionsListedEvent
30101
+ ),
30002
30102
  [SESSION_QUERIED_KIND]: defineMessageSignature(
30003
30103
  SESSION_QUERIED_KIND,
30004
30104
  encodeSessionsQueriedEvent,
@@ -40680,6 +40780,7 @@ var AgentRuntimeManager = class {
40680
40780
  const stored = this.#store.read(sessionId);
40681
40781
  return stored instanceof FoundAcpStoredSession ? [stored.session] : [];
40682
40782
  });
40783
+ listSessions = (limit) => this.#store.list().filter((session) => session.prompted).slice(0, limit);
40683
40784
  findLinkedSessions = (agentId, nativeSessionId) => this.#store.findNative(agentId, nativeSessionId);
40684
40785
  hasPreparedSession = (sessionId, agentId, cwd, additionalDirectories) => this.#executionProcesses.get(sessionId)?.belongsTo(agentId, cwd, additionalDirectories) === true;
40685
40786
  createNativeSession = async (options) => this.#operations.run(options, async (options2) => {
@@ -43561,9 +43662,11 @@ var NativeSessionService = class {
43561
43662
  title: target.info.title ?? "Untitled session"
43562
43663
  };
43563
43664
  };
43564
- querySessions = async (sessionIds, signal) => {
43665
+ listSessions = async (limit, signal) => await this.describeSessions(this.#sessions.listSessions(limit), signal);
43666
+ querySessions = async (sessionIds, signal) => await this.describeSessions(this.#sessions.findSessions(sessionIds), signal);
43667
+ describeSessions = async (sessions, signal) => {
43565
43668
  const entries = [];
43566
- for (const session of this.#sessions.findSessions(sessionIds)) {
43669
+ for (const session of sessions) {
43567
43670
  signal.throwIfAborted();
43568
43671
  const directory = await this.#directories.identify(this.#config.bindingId, session.cwd, signal);
43569
43672
  const additionalDirectories = [];
@@ -45978,6 +46081,19 @@ function createDaemonCommandHandler({
45978
46081
  void executeSessionConfigure(publisher, socket, command2, config2, directories, audit, sessions, signal);
45979
46082
  return;
45980
46083
  }
46084
+ if (kind === SESSION_LIST_KIND) {
46085
+ const command2 = message;
46086
+ void nativeSessions.listSessions(command2.limit, signal).then((entries) => {
46087
+ send(socket, {
46088
+ entries,
46089
+ kind: SESSION_LISTED_KIND,
46090
+ requestId: command2.requestId
46091
+ });
46092
+ }).catch((error62) => {
46093
+ reportOperationFailure(socket, command2.requestId, "", error62);
46094
+ });
46095
+ return;
46096
+ }
45981
46097
  if (kind === SESSION_QUERY_KIND) {
45982
46098
  const command2 = message;
45983
46099
  void nativeSessions.querySessions(command2.sessionIds, signal).then((entries) => {
@@ -47536,7 +47652,7 @@ function createProgram() {
47536
47652
  process.stdout.write(`${package_default.version}
47537
47653
  `);
47538
47654
  });
47539
- program2.command("agents").description("show detected, missing, and integration-ready Agents").option("--json", "write the Agent inventory as JSON").action(async (options) => {
47655
+ program2.command("agents").description("show detected, missing, and integration-ready Agents").option("--json", "write the Agent inventory as JSON").option("--verbose", "include per-Agent detection timing").action(async (options) => {
47540
47656
  const installation = await openMobiusCliInstallation(shutdown.signal, process.env);
47541
47657
  const localContext = new DaemonLocalContext(installation.stateDirectory, process.env);
47542
47658
  const defaultWorkspace = loadDefaultWorkspace(localContext.environment);
@@ -47546,7 +47662,7 @@ function createProgram() {
47546
47662
  environment: localContext.environment,
47547
47663
  signal: shutdown.signal
47548
47664
  });
47549
- process.stdout.write(formatAgentDiagnostics(inventory, options.json === true));
47665
+ process.stdout.write(formatAgentDiagnostics(inventory, options.json === true, options.verbose === true));
47550
47666
  });
47551
47667
  program2.command("__manager", { hidden: true }).action(async () => {
47552
47668
  const installation = await openMobiusCliInstallation(shutdown.signal, process.env);