vibedate 0.7.1 → 0.7.2
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 +67 -23
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -387,30 +387,60 @@ function uninstallDaemonService(opts) {
|
|
|
387
387
|
}
|
|
388
388
|
|
|
389
389
|
// src/pairing.ts
|
|
390
|
+
var MAX_BUFFERED = 100;
|
|
390
391
|
function createPairing() {
|
|
391
392
|
const queue = [];
|
|
392
393
|
const matchCbs = /* @__PURE__ */ new Set();
|
|
394
|
+
const msgCbs = /* @__PURE__ */ new Set();
|
|
395
|
+
const queuedCbs = /* @__PURE__ */ new Set();
|
|
396
|
+
const buffers = /* @__PURE__ */ new Map();
|
|
393
397
|
let current;
|
|
394
|
-
const
|
|
398
|
+
const emitMatch = (link) => {
|
|
395
399
|
for (const cb of matchCbs) cb(link);
|
|
396
400
|
};
|
|
401
|
+
const deliver = (from, m) => {
|
|
402
|
+
for (const cb of msgCbs) cb(from, m);
|
|
403
|
+
};
|
|
404
|
+
const notifyQueued = (from, n) => {
|
|
405
|
+
for (const cb of queuedCbs) cb(from, n);
|
|
406
|
+
};
|
|
407
|
+
const flush = (link) => {
|
|
408
|
+
const buf = buffers.get(link);
|
|
409
|
+
if (buf !== void 0 && buf.length > 0) {
|
|
410
|
+
for (const m of buf) deliver(link.hello.handle, m);
|
|
411
|
+
buffers.set(link, []);
|
|
412
|
+
}
|
|
413
|
+
};
|
|
414
|
+
const setCurrent = (link) => {
|
|
415
|
+
current = link;
|
|
416
|
+
if (link !== void 0) flush(link);
|
|
417
|
+
emitMatch(link);
|
|
418
|
+
};
|
|
397
419
|
const watch = (link) => {
|
|
398
420
|
link.onClose(() => {
|
|
421
|
+
buffers.delete(link);
|
|
399
422
|
if (current === link) {
|
|
400
|
-
current = void 0;
|
|
401
423
|
const nextUp = queue.shift();
|
|
402
|
-
|
|
403
|
-
current = nextUp;
|
|
404
|
-
emit(current);
|
|
405
|
-
} else {
|
|
406
|
-
emit(void 0);
|
|
407
|
-
}
|
|
424
|
+
setCurrent(nextUp);
|
|
408
425
|
} else {
|
|
409
426
|
const idx = queue.indexOf(link);
|
|
410
427
|
if (idx >= 0) queue.splice(idx, 1);
|
|
411
428
|
}
|
|
412
429
|
});
|
|
413
430
|
};
|
|
431
|
+
const bindMessages = (link) => {
|
|
432
|
+
link.onMessage((m) => {
|
|
433
|
+
if (link === current) {
|
|
434
|
+
deliver(link.hello.handle, m);
|
|
435
|
+
} else {
|
|
436
|
+
const buf = buffers.get(link) ?? [];
|
|
437
|
+
buf.push(m);
|
|
438
|
+
if (buf.length > MAX_BUFFERED) buf.shift();
|
|
439
|
+
buffers.set(link, buf);
|
|
440
|
+
notifyQueued(link.hello.handle, buf.length);
|
|
441
|
+
}
|
|
442
|
+
});
|
|
443
|
+
};
|
|
414
444
|
return {
|
|
415
445
|
get available() {
|
|
416
446
|
return queue.length;
|
|
@@ -420,9 +450,9 @@ function createPairing() {
|
|
|
420
450
|
},
|
|
421
451
|
add(link) {
|
|
422
452
|
watch(link);
|
|
453
|
+
bindMessages(link);
|
|
423
454
|
if (current === void 0) {
|
|
424
|
-
|
|
425
|
-
emit(link);
|
|
455
|
+
setCurrent(link);
|
|
426
456
|
} else {
|
|
427
457
|
queue.push(link);
|
|
428
458
|
}
|
|
@@ -433,10 +463,7 @@ function createPairing() {
|
|
|
433
463
|
current = void 0;
|
|
434
464
|
}
|
|
435
465
|
const nextUp = queue.shift();
|
|
436
|
-
|
|
437
|
-
current = nextUp;
|
|
438
|
-
}
|
|
439
|
-
emit(current);
|
|
466
|
+
setCurrent(nextUp);
|
|
440
467
|
return current;
|
|
441
468
|
},
|
|
442
469
|
open(handle2) {
|
|
@@ -447,12 +474,17 @@ function createPairing() {
|
|
|
447
474
|
current.close();
|
|
448
475
|
current = void 0;
|
|
449
476
|
}
|
|
450
|
-
|
|
451
|
-
emit(current);
|
|
477
|
+
setCurrent(link);
|
|
452
478
|
return current;
|
|
453
479
|
},
|
|
454
480
|
onMatch(cb) {
|
|
455
481
|
matchCbs.add(cb);
|
|
482
|
+
},
|
|
483
|
+
onMessage(cb) {
|
|
484
|
+
msgCbs.add(cb);
|
|
485
|
+
},
|
|
486
|
+
onQueued(cb) {
|
|
487
|
+
queuedCbs.add(cb);
|
|
456
488
|
}
|
|
457
489
|
};
|
|
458
490
|
}
|
|
@@ -2608,7 +2640,7 @@ async function handle(req, res, opts) {
|
|
|
2608
2640
|
}
|
|
2609
2641
|
|
|
2610
2642
|
// src/cli.ts
|
|
2611
|
-
var VERSION = "0.7.
|
|
2643
|
+
var VERSION = "0.7.2";
|
|
2612
2644
|
function parsePort(raw) {
|
|
2613
2645
|
const n = Number(raw);
|
|
2614
2646
|
if (!Number.isInteger(n) || n < 1 || n > 65535) return void 0;
|
|
@@ -3084,10 +3116,16 @@ async function cmdLiveViaRelay(profile, to) {
|
|
|
3084
3116
|
` \xB7 relayed to ${sanitizePeerText(l.hello.handle)} (${l.hello.league}${qual} \xB7 ${l.hello.harness}) ${usageMark(l.hello)}${idMark(l.hello)}
|
|
3085
3117
|
`
|
|
3086
3118
|
);
|
|
3087
|
-
|
|
3088
|
-
|
|
3119
|
+
});
|
|
3120
|
+
pairing.onMessage((from, m) => {
|
|
3121
|
+
process2.stdout.write(` <${sanitizePeerText(from)}> ${sanitizePeerText(m.text)}
|
|
3089
3122
|
`);
|
|
3090
|
-
|
|
3123
|
+
});
|
|
3124
|
+
pairing.onQueued((from, n) => {
|
|
3125
|
+
process2.stdout.write(
|
|
3126
|
+
` \xB7 ${sanitizePeerText(from)} sent a message (${n} queued) \u2014 /open ${sanitizePeerText(from)} to read
|
|
3127
|
+
`
|
|
3128
|
+
);
|
|
3091
3129
|
});
|
|
3092
3130
|
pairing.add(link);
|
|
3093
3131
|
process2.stdout.write(" type to chat \xB7 /quit\n");
|
|
@@ -3166,10 +3204,16 @@ async function cmdLive(dating, any, to, keepAlive, viaRelay) {
|
|
|
3166
3204
|
` \xB7 matched ${sanitizePeerText(link.hello.handle)} (${link.hello.league}${qual} \xB7 ${link.hello.harness}) ${usageMark(link.hello)}${idMark(link.hello)}
|
|
3167
3205
|
`
|
|
3168
3206
|
);
|
|
3169
|
-
|
|
3170
|
-
|
|
3207
|
+
});
|
|
3208
|
+
pairing.onMessage((from, m) => {
|
|
3209
|
+
process2.stdout.write(` <${sanitizePeerText(from)}> ${sanitizePeerText(m.text)}
|
|
3171
3210
|
`);
|
|
3172
|
-
|
|
3211
|
+
});
|
|
3212
|
+
pairing.onQueued((from, n) => {
|
|
3213
|
+
process2.stdout.write(
|
|
3214
|
+
` \xB7 ${sanitizePeerText(from)} sent a message (${n} queued) \u2014 /open ${sanitizePeerText(from)} to read
|
|
3215
|
+
`
|
|
3216
|
+
);
|
|
3173
3217
|
});
|
|
3174
3218
|
const { topics, acceptLeague } = discoveryScope(profile.league, any);
|
|
3175
3219
|
const session = await startDiscovery({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vibedate",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.2",
|
|
4
4
|
"description": "Dating by tokens — matched by usage league across agentic CLIs. Raw usage stays local; only your league is shared. CLI + local web app + MCP. Local-first.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|