@adapt-toolkit/a2adapt 0.9.0 → 0.9.1

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
@@ -384,18 +384,33 @@ async function runIdentitySurvey() {
384
384
  rl.close();
385
385
  }
386
386
  }
387
- function cmdWatch(which) {
387
+ async function resolveWatchDir() {
388
+ try {
389
+ const ctrl = new AbortController();
390
+ const t = setTimeout(() => ctrl.abort(), 1500);
391
+ const resp = await fetch(`http://127.0.0.1:${PORT}/state-dir`, { signal: ctrl.signal });
392
+ clearTimeout(t);
393
+ if (resp.ok) {
394
+ const body = await resp.json();
395
+ if (typeof body.stateDir === "string" && body.stateDir) return resolve2(body.stateDir);
396
+ }
397
+ } catch {
398
+ }
399
+ return STATE_DIR;
400
+ }
401
+ async function cmdWatch(which) {
402
+ const watchDir = await resolveWatchDir();
388
403
  const offsets = /* @__PURE__ */ new Map();
389
404
  const scan = (initial) => {
390
405
  let names;
391
406
  try {
392
- names = fs2.readdirSync(STATE_DIR, { withFileTypes: true }).filter((d) => d.isDirectory()).map((d) => d.name);
407
+ names = fs2.readdirSync(watchDir, { withFileTypes: true }).filter((d) => d.isDirectory()).map((d) => d.name);
393
408
  } catch {
394
409
  return;
395
410
  }
396
411
  for (const name of names) {
397
412
  if (which && name !== which) continue;
398
- const logPath = join2(STATE_DIR, name, "notifications.log");
413
+ const logPath = join2(watchDir, name, "notifications.log");
399
414
  let size;
400
415
  try {
401
416
  size = fs2.statSync(logPath).size;
@@ -444,7 +459,7 @@ function cmdWatch(which) {
444
459
  }
445
460
  };
446
461
  err(
447
- `a2adapt-mcp watch: watching ${which ? `identity "${which}"` : "all identities"} under ${STATE_DIR} (Ctrl-C to stop)`
462
+ `a2adapt-mcp watch: watching ${which ? `identity "${which}"` : "all identities"} under ${watchDir} (Ctrl-C to stop)`
448
463
  );
449
464
  scan(true);
450
465
  const timer = setInterval(() => scan(false), 1e3);
@@ -651,7 +666,7 @@ async function main() {
651
666
  await cmdDefineLocalIdentityFile(process.argv.slice(3));
652
667
  break;
653
668
  case "watch":
654
- cmdWatch(process.argv[3]);
669
+ await cmdWatch(process.argv[3]);
655
670
  break;
656
671
  case "install-service":
657
672
  await cmdInstallService();
package/dist/index.js CHANGED
@@ -22512,7 +22512,7 @@ function writeIdentityFile(target, opts, overwrite = false) {
22512
22512
  }
22513
22513
 
22514
22514
  // src/index.ts
22515
- var VERSION = true ? "0.9.0" : "0.0.0-dev";
22515
+ var VERSION = true ? "0.9.1" : "0.0.0-dev";
22516
22516
  var CONFIG = loadConfig();
22517
22517
  var STATE_DIR = CONFIG.stateDir;
22518
22518
  var BROKER_URL = CONFIG.brokerUrl;
@@ -23531,6 +23531,11 @@ async function main() {
23531
23531
  const transports = {};
23532
23532
  const httpServer = createHttpServer(async (req, res) => {
23533
23533
  const url = new URL(req.url, `http://localhost:${PORT}`);
23534
+ if (req.method === "GET" && url.pathname === "/state-dir") {
23535
+ res.writeHead(200, { "Content-Type": "application/json" });
23536
+ res.end(JSON.stringify({ stateDir: STATE_DIR, version: VERSION }));
23537
+ return;
23538
+ }
23534
23539
  if (url.pathname !== "/mcp") {
23535
23540
  res.writeHead(404, { "Content-Type": "text/plain" });
23536
23541
  res.end("Not found");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adapt-toolkit/a2adapt",
3
- "version": "0.9.0",
3
+ "version": "0.9.1",
4
4
  "description": "MCP server daemon for a2adapt — one native ADAPT wrapper hosting N self-sovereign identities, exposing secure agent-to-agent messaging tools over HTTP (Streamable HTTP). Run `a2adapt-mcp start`.",
5
5
  "type": "module",
6
6
  "license": "MIT",