@ascenda-one/agent-mcp 0.1.26 → 0.1.27

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 (2) hide show
  1. package/dist/cli.js +64 -29
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -3367,16 +3367,20 @@ var require_liveBus = __commonJS({
3367
3367
  path.join(home, "Library", "Containers", SAVER_HOST_BUNDLE_ID, "Data", "l.sock")
3368
3368
  ];
3369
3369
  }
3370
- function liveBusSocketPath() {
3370
+ function existingSocketCandidates() {
3371
3371
  const candidates = liveBusSocketCandidates();
3372
- for (const candidate of candidates) {
3372
+ if (process.env.ASCENDA_LIVE_BUS_SOCKET)
3373
+ return candidates;
3374
+ return candidates.filter((candidate) => {
3373
3375
  try {
3374
- if (fs.statSync(candidate).isSocket())
3375
- return candidate;
3376
+ return fs.statSync(candidate).isSocket();
3376
3377
  } catch {
3378
+ return false;
3377
3379
  }
3378
- }
3379
- return candidates[0];
3380
+ });
3381
+ }
3382
+ function liveBusSocketPath() {
3383
+ return existingSocketCandidates()[0] ?? liveBusSocketCandidates()[0];
3380
3384
  }
3381
3385
  function bucketPromptSize(text) {
3382
3386
  const length = typeof text === "string" ? text.length : 0;
@@ -3388,44 +3392,75 @@ var require_liveBus = __commonJS({
3388
3392
  return "l";
3389
3393
  return "xl";
3390
3394
  }
3395
+ var NOBODY_LISTENING = /* @__PURE__ */ new Set(["ECONNREFUSED", "ENOENT"]);
3391
3396
  function emitLiveSignal(signal) {
3392
3397
  return new Promise((resolve) => {
3398
+ const candidates = existingSocketCandidates();
3399
+ if (candidates.length === 0) {
3400
+ resolve();
3401
+ return;
3402
+ }
3393
3403
  let settled = false;
3404
+ let socket;
3405
+ const drop = () => {
3406
+ try {
3407
+ socket?.destroy();
3408
+ } catch {
3409
+ }
3410
+ socket = void 0;
3411
+ };
3394
3412
  const done = () => {
3395
3413
  if (settled)
3396
3414
  return;
3397
3415
  settled = true;
3398
- try {
3399
- socket.destroy();
3400
- } catch {
3401
- }
3416
+ clearTimeout(timer);
3417
+ drop();
3402
3418
  resolve();
3403
3419
  };
3404
- let socket;
3405
- try {
3406
- socket = net.createConnection(liveBusSocketPath());
3407
- } catch {
3408
- resolve();
3409
- return;
3410
- }
3411
3420
  const timer = setTimeout(done, WRITE_TIMEOUT_MS);
3412
3421
  if (typeof timer.unref === "function")
3413
3422
  timer.unref();
3414
- if (typeof socket.unref === "function")
3415
- socket.unref();
3416
- socket.on("error", done);
3417
- socket.on("connect", () => {
3423
+ const tryFrom = (index) => {
3424
+ if (settled)
3425
+ return;
3426
+ if (index >= candidates.length) {
3427
+ done();
3428
+ return;
3429
+ }
3430
+ let attempt;
3418
3431
  try {
3419
- socket.write(`${JSON.stringify(signal)}
3420
- `, () => {
3421
- clearTimeout(timer);
3422
- done();
3423
- });
3432
+ attempt = net.createConnection(candidates[index]);
3424
3433
  } catch {
3425
- clearTimeout(timer);
3426
- done();
3434
+ tryFrom(index + 1);
3435
+ return;
3427
3436
  }
3428
- });
3437
+ socket = attempt;
3438
+ if (typeof attempt.unref === "function")
3439
+ attempt.unref();
3440
+ let connected = false;
3441
+ attempt.on("error", (error2) => {
3442
+ if (settled || socket !== attempt)
3443
+ return;
3444
+ if (!connected && error2.code && NOBODY_LISTENING.has(error2.code)) {
3445
+ drop();
3446
+ tryFrom(index + 1);
3447
+ return;
3448
+ }
3449
+ done();
3450
+ });
3451
+ attempt.on("connect", () => {
3452
+ if (settled || socket !== attempt)
3453
+ return;
3454
+ connected = true;
3455
+ try {
3456
+ attempt.write(`${JSON.stringify(signal)}
3457
+ `, done);
3458
+ } catch {
3459
+ done();
3460
+ }
3461
+ });
3462
+ };
3463
+ tryFrom(0);
3429
3464
  });
3430
3465
  }
3431
3466
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "publishConfig": { "access": "public" },
3
3
  "name": "@ascenda-one/agent-mcp",
4
- "version": "0.1.26",
4
+ "version": "0.1.27",
5
5
  "description": "MCP server exposing ascenda_emit_work_signal — the one submission interface for agent-observed (semantic) work-friction signals.",
6
6
  "repository": {
7
7
  "type": "git",