chatroom-cli 1.0.64 → 1.0.65
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.js +26 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -10266,11 +10266,13 @@ async function waitForTask(chatroomId, options) {
|
|
|
10266
10266
|
}
|
|
10267
10267
|
const effectiveTimeout = timeout || DEFAULT_WAIT_TIMEOUT_MS;
|
|
10268
10268
|
const readyUntil = Date.now() + effectiveTimeout;
|
|
10269
|
+
const connectionId = `${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
|
|
10269
10270
|
await client2.mutation(api.participants.join, {
|
|
10270
10271
|
sessionId,
|
|
10271
10272
|
chatroomId,
|
|
10272
10273
|
role,
|
|
10273
|
-
readyUntil
|
|
10274
|
+
readyUntil,
|
|
10275
|
+
connectionId
|
|
10274
10276
|
});
|
|
10275
10277
|
const connectionTime = new Date().toISOString().replace("T", " ").substring(0, 19);
|
|
10276
10278
|
if (!silent) {
|
|
@@ -10326,6 +10328,29 @@ ${"─".repeat(50)}`);
|
|
|
10326
10328
|
const handlePendingTasks = async (pendingTasks) => {
|
|
10327
10329
|
if (taskProcessed)
|
|
10328
10330
|
return;
|
|
10331
|
+
const currentConnectionId = await client2.query(api.participants.getConnectionId, {
|
|
10332
|
+
sessionId,
|
|
10333
|
+
chatroomId,
|
|
10334
|
+
role
|
|
10335
|
+
});
|
|
10336
|
+
if (currentConnectionId && currentConnectionId !== connectionId) {
|
|
10337
|
+
if (unsubscribe)
|
|
10338
|
+
unsubscribe();
|
|
10339
|
+
clearTimeout(timeoutHandle);
|
|
10340
|
+
const takeoverTime = new Date().toISOString().replace("T", " ").substring(0, 19);
|
|
10341
|
+
console.log(`
|
|
10342
|
+
${"─".repeat(50)}`);
|
|
10343
|
+
console.log(`⚠️ CONNECTION SUPERSEDED
|
|
10344
|
+
`);
|
|
10345
|
+
console.log(`[${takeoverTime}] Why: Another wait-for-task process started for this role`);
|
|
10346
|
+
console.log(`Impact: This process is being replaced by the newer connection`);
|
|
10347
|
+
console.log(`Action: This is expected if you started a new wait-for-task session
|
|
10348
|
+
`);
|
|
10349
|
+
console.log(`If you meant to use THIS terminal, run:`);
|
|
10350
|
+
console.log(waitForTaskCommand({ chatroomId, role, cliEnvPrefix }));
|
|
10351
|
+
console.log(`${"─".repeat(50)}`);
|
|
10352
|
+
process.exit(0);
|
|
10353
|
+
}
|
|
10329
10354
|
const taskWithMessage = pendingTasks.length > 0 ? pendingTasks[0] : null;
|
|
10330
10355
|
if (!taskWithMessage) {
|
|
10331
10356
|
return;
|