@sanctuary-framework/mcp-server 1.1.4 → 1.1.6

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/index.cjs CHANGED
@@ -26874,6 +26874,13 @@ var HubService = class {
26874
26874
  nowIso() {
26875
26875
  return this.now().toISOString();
26876
26876
  }
26877
+ refreshPersistedLocalAgents() {
26878
+ const readPersistedLocalAgents2 = this.deps.readPersistedLocalAgents;
26879
+ if (!readPersistedLocalAgents2) return;
26880
+ for (const record of readPersistedLocalAgents2()) {
26881
+ this.deps.agentRegistry.put(record);
26882
+ }
26883
+ }
26877
26884
  // ── Inbox ───────────────────────────────────────────────────────────
26878
26885
  listInbox() {
26879
26886
  const items = aggregateInbox(this.deps.inboxSources, this.inboxStore);
@@ -26885,6 +26892,7 @@ var HubService = class {
26885
26892
  }
26886
26893
  // ── Agents ──────────────────────────────────────────────────────────
26887
26894
  listAgents(filter) {
26895
+ this.refreshPersistedLocalAgents();
26888
26896
  const safeFilter = {
26889
26897
  ...filter ?? {},
26890
26898
  identity_id: this.deps.identityId
@@ -27301,6 +27309,21 @@ var HubService = class {
27301
27309
  return this.inboxStore.size();
27302
27310
  }
27303
27311
  };
27312
+ function localAgentsFilePath(storagePath) {
27313
+ return path.join(storagePath, "state", "_hub", "local-agents.json");
27314
+ }
27315
+ function readPersistedLocalAgents(storagePath) {
27316
+ const filePath = localAgentsFilePath(storagePath);
27317
+ if (!fs.existsSync(filePath)) return [];
27318
+ try {
27319
+ const raw = fs.readFileSync(filePath, "utf8");
27320
+ const parsed = JSON.parse(raw);
27321
+ if (!parsed || !Array.isArray(parsed.agents)) return [];
27322
+ return parsed.agents;
27323
+ } catch {
27324
+ return [];
27325
+ }
27326
+ }
27304
27327
 
27305
27328
  // src/dashboard/v1_1/wiring.ts
27306
27329
  var CapabilityErrorAgentController = class {
@@ -27332,11 +27355,15 @@ var CapabilityErrorAgentController = class {
27332
27355
  }
27333
27356
  };
27334
27357
  function buildV11Bindings(inputs) {
27335
- const registry = new InMemoryLocalAgentRegistry([]);
27358
+ const seed = inputs.storagePath !== void 0 ? readPersistedLocalAgents(inputs.storagePath) : [];
27359
+ const registry = new InMemoryLocalAgentRegistry(seed);
27360
+ const storagePath = inputs.storagePath;
27361
+ const readPersisted = storagePath !== void 0 ? () => readPersistedLocalAgents(storagePath) : void 0;
27336
27362
  const hubService = new HubService({
27337
27363
  identityId: inputs.identityId,
27338
27364
  fortressId: inputs.fortressId,
27339
27365
  agentRegistry: registry,
27366
+ ...readPersisted ? { readPersistedLocalAgents: readPersisted } : {},
27340
27367
  inboxSources: {
27341
27368
  listPendingApprovals: () => [],
27342
27369
  listRecentBlockedEgress: () => [],
@@ -29432,7 +29459,12 @@ Refusing to start the cocoon while the reset-history marker is unreadable.`
29432
29459
  buildV11Bindings({
29433
29460
  identityId: embeddedHubIdentityId,
29434
29461
  fortressId: fortressIdFromStoragePath(config.storage_path),
29435
- auditLog
29462
+ auditLog,
29463
+ // v1.1.5 (Finding Z): rehydrate the hub agent registry from
29464
+ // `<storagePath>/state/_hub/local-agents.json` so the embedded
29465
+ // dashboard surfaces wraps performed by prior `sanctuary wrap`
29466
+ // invocations against this same fortress.
29467
+ storagePath: config.storage_path
29436
29468
  })
29437
29469
  );
29438
29470
  await dashboard.start();