@moxt-ai/mobius 0.0.313 → 0.0.314

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
@@ -2086,7 +2086,7 @@ var init_package = __esm({
2086
2086
  "package.json"() {
2087
2087
  package_default = {
2088
2088
  name: "@moxt-ai/mobius",
2089
- version: "0.0.313",
2089
+ version: "0.0.314",
2090
2090
  description: "Mobius CLI for pairing and running local AI agent services.",
2091
2091
  type: "module",
2092
2092
  bin: {
@@ -93265,6 +93265,24 @@ var init_quit = __esm({
93265
93265
  }
93266
93266
  });
93267
93267
 
93268
+ // src/runtime/catalog/refresh-agent-catalog.ts
93269
+ async function refreshAgentCatalog(config2, discover, signal) {
93270
+ const readyAgents = await discover(signal);
93271
+ signal.throwIfAborted();
93272
+ return await config2.catalog.replaceAndPublish(
93273
+ () => readyAgents.map((agent) => withRuntimeEnvironment(agent, config2.localContext.environment)),
93274
+ (publishSignal) => publishAgentCatalog(config2, publishSignal),
93275
+ signal
93276
+ );
93277
+ }
93278
+ var init_refresh_agent_catalog = __esm({
93279
+ "src/runtime/catalog/refresh-agent-catalog.ts"() {
93280
+ "use strict";
93281
+ init_config();
93282
+ init_publish_agent_catalog();
93283
+ }
93284
+ });
93285
+
93268
93286
  // src/schema/acp-session-store/acp-session.ts
93269
93287
  var acpSession;
93270
93288
  var init_acp_session = __esm({
@@ -98498,13 +98516,7 @@ function createAgentCatalogDiscoveryHandler(dependencies) {
98498
98516
  );
98499
98517
  completion = (async () => {
98500
98518
  try {
98501
- const readyAgents = await discover(operationSignal);
98502
- operationSignal.throwIfAborted();
98503
- const published = await config2.catalog.replaceAndPublish(
98504
- () => readyAgents.map((agent) => withRuntimeEnvironment(agent, config2.localContext.environment)),
98505
- (publishSignal) => publishAgentCatalog(config2, publishSignal),
98506
- operationSignal
98507
- );
98519
+ const published = await refreshAgentCatalog(config2, discover, operationSignal);
98508
98520
  operationSignal.throwIfAborted();
98509
98521
  if (socket.readyState === WebSocket3.OPEN) {
98510
98522
  send(
@@ -98554,8 +98566,7 @@ var init_handle_agent_catalog_discovery = __esm({
98554
98566
  init_protocol();
98555
98567
  init_operation_error();
98556
98568
  init_transport();
98557
- init_config();
98558
- init_publish_agent_catalog();
98569
+ init_refresh_agent_catalog();
98559
98570
  CATALOG_DISCOVERY_TIMEOUT_MILLISECONDS = 9e4;
98560
98571
  }
98561
98572
  });
@@ -102127,7 +102138,7 @@ async function runWorkerRuntime(version2, combined, shutdown, rejectionGuard) {
102127
102138
  }
102128
102139
  }
102129
102140
  ).finally(() => active.delete(connection.connectionId));
102130
- active.set(connection.connectionId, { controller, completion });
102141
+ active.set(connection.connectionId, { config: paired.config, controller, completion });
102131
102142
  } catch (cause) {
102132
102143
  combined.throwIfAborted();
102133
102144
  fail(connection.connectionId, cause);
@@ -102135,6 +102146,26 @@ async function runWorkerRuntime(version2, combined, shutdown, rejectionGuard) {
102135
102146
  }
102136
102147
  }
102137
102148
  };
102149
+ const refreshRunningCatalogs = async (connectionIds) => {
102150
+ await Promise.all(
102151
+ [...connectionIds].map(async (connectionId2) => {
102152
+ const config2 = active.get(connectionId2)?.config;
102153
+ if (config2?.rediscoverAgents === void 0) {
102154
+ return;
102155
+ }
102156
+ try {
102157
+ await refreshAgentCatalog(
102158
+ config2,
102159
+ config2.rediscoverAgents,
102160
+ AbortSignal.any([combined, AbortSignal.timeout(9e4)])
102161
+ );
102162
+ } catch (cause) {
102163
+ combined.throwIfAborted();
102164
+ console.error(`Runtime ${connectionId2} could not refresh its Agent catalog`, cause);
102165
+ }
102166
+ })
102167
+ );
102168
+ };
102138
102169
  let reload = Promise.resolve();
102139
102170
  let upgrades = Promise.resolve();
102140
102171
  try {
@@ -102147,7 +102178,8 @@ async function runWorkerRuntime(version2, combined, shutdown, rejectionGuard) {
102147
102178
  if (typeof request !== "object" || request === null || !("kind" in request) || request.kind !== "reload") {
102148
102179
  return { kind: "error", code: "invalid_reload", message: "Expected a configuration reload" };
102149
102180
  }
102150
- const pending = reload.then(reconcile);
102181
+ const running = new Set(active.keys());
102182
+ const pending = reload.then(reconcile).then(async () => await refreshRunningCatalogs(running));
102151
102183
  reload = pending.catch(() => void 0);
102152
102184
  await pending;
102153
102185
  return { kind: "reloaded" };
@@ -102176,6 +102208,7 @@ var WorkerRuntimeError;
102176
102208
  var init_worker = __esm({
102177
102209
  "src/daemon/lifecycle/worker.ts"() {
102178
102210
  "use strict";
102211
+ init_refresh_agent_catalog();
102179
102212
  init_engine();
102180
102213
  init_runtime_turn_activity();
102181
102214
  init_manager_lock();