chatroom-cli 1.27.0 → 1.29.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/index.js +52 -34
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -51816,23 +51816,13 @@ async function completeBacklog(chatroomId, options, deps) {
|
|
|
51816
51816
|
return;
|
|
51817
51817
|
}
|
|
51818
51818
|
try {
|
|
51819
|
-
const result = await d.backend.mutation(api.
|
|
51819
|
+
const result = await d.backend.mutation(api.backlog.completeBacklogItem, {
|
|
51820
51820
|
sessionId,
|
|
51821
|
-
|
|
51822
|
-
force: options.force
|
|
51821
|
+
itemId: options.backlogItemId
|
|
51823
51822
|
});
|
|
51824
51823
|
console.log("");
|
|
51825
|
-
|
|
51826
|
-
console.log("⚠️ Backlog item force-completed (was in_progress or pending)");
|
|
51827
|
-
} else {
|
|
51828
|
-
console.log("✅ Backlog item completed");
|
|
51829
|
-
}
|
|
51824
|
+
console.log("✅ Backlog item completed");
|
|
51830
51825
|
console.log(` ID: ${options.backlogItemId}`);
|
|
51831
|
-
if (result.promoted) {
|
|
51832
|
-
console.log(` \uD83D\uDCE4 Next task promoted: ${result.promoted}`);
|
|
51833
|
-
console.log("");
|
|
51834
|
-
console.log("\uD83D\uDCA1 The next queued task is now pending and ready for processing.");
|
|
51835
|
-
}
|
|
51836
51826
|
console.log("");
|
|
51837
51827
|
} catch (error) {
|
|
51838
51828
|
console.error(`❌ Failed to complete backlog item: ${getErrorMessage(error)}`);
|
|
@@ -56854,34 +56844,61 @@ function createDefaultDeps21() {
|
|
|
56854
56844
|
agentProcessManager: null
|
|
56855
56845
|
};
|
|
56856
56846
|
}
|
|
56857
|
-
function
|
|
56847
|
+
async function waitForAuthentication(convexUrl) {
|
|
56848
|
+
const startTime = Date.now();
|
|
56849
|
+
while (Date.now() - startTime < AUTH_WAIT_TIMEOUT_MS) {
|
|
56850
|
+
await new Promise((resolve5) => setTimeout(resolve5, AUTH_POLL_INTERVAL_MS2));
|
|
56851
|
+
const sessionId = getSessionId();
|
|
56852
|
+
if (sessionId) {
|
|
56853
|
+
console.log(`
|
|
56854
|
+
✅ Authentication detected. Resuming daemon initialization...`);
|
|
56855
|
+
return sessionId;
|
|
56856
|
+
}
|
|
56857
|
+
}
|
|
56858
|
+
console.error(`
|
|
56859
|
+
❌ Authentication timeout (5 minutes). Exiting.`);
|
|
56860
|
+
releaseLock();
|
|
56861
|
+
process.exit(1);
|
|
56862
|
+
}
|
|
56863
|
+
async function validateAuthentication(convexUrl) {
|
|
56858
56864
|
const sessionId = getSessionId();
|
|
56859
|
-
if (
|
|
56860
|
-
|
|
56861
|
-
|
|
56862
|
-
|
|
56863
|
-
|
|
56865
|
+
if (sessionId) {
|
|
56866
|
+
return sessionId;
|
|
56867
|
+
}
|
|
56868
|
+
const otherUrls = getOtherSessionUrls();
|
|
56869
|
+
console.error(`❌ Not authenticated for: ${convexUrl}`);
|
|
56870
|
+
if (otherUrls.length > 0) {
|
|
56871
|
+
console.error(`
|
|
56864
56872
|
\uD83D\uDCA1 You have sessions for other environments:`);
|
|
56865
|
-
|
|
56866
|
-
|
|
56867
|
-
}
|
|
56873
|
+
for (const url2 of otherUrls) {
|
|
56874
|
+
console.error(` • ${url2}`);
|
|
56868
56875
|
}
|
|
56869
|
-
console.error(`
|
|
56870
|
-
Run: chatroom auth login`);
|
|
56871
|
-
releaseLock();
|
|
56872
|
-
process.exit(1);
|
|
56873
56876
|
}
|
|
56874
|
-
|
|
56877
|
+
console.error(`
|
|
56878
|
+
Run: chatroom auth login`);
|
|
56879
|
+
console.log(`
|
|
56880
|
+
⏳ Waiting for authentication (timeout: 5 minutes)...`);
|
|
56881
|
+
return waitForAuthentication(convexUrl);
|
|
56875
56882
|
}
|
|
56876
56883
|
async function validateSession(client2, sessionId, convexUrl) {
|
|
56877
56884
|
const validation = await client2.query(api.cliAuth.validateSession, { sessionId });
|
|
56878
|
-
if (
|
|
56879
|
-
|
|
56880
|
-
|
|
56885
|
+
if (validation.valid) {
|
|
56886
|
+
return sessionId;
|
|
56887
|
+
}
|
|
56888
|
+
console.error(`❌ Session invalid: ${validation.reason}`);
|
|
56889
|
+
console.error(`
|
|
56881
56890
|
Run: chatroom auth login`);
|
|
56891
|
+
console.log(`
|
|
56892
|
+
⏳ Waiting for re-authentication (timeout: 5 minutes)...`);
|
|
56893
|
+
const newSessionId2 = await waitForAuthentication(convexUrl);
|
|
56894
|
+
const typedNewSession = newSessionId2;
|
|
56895
|
+
const revalidation = await client2.query(api.cliAuth.validateSession, { sessionId: typedNewSession });
|
|
56896
|
+
if (!revalidation.valid) {
|
|
56897
|
+
console.error(`❌ New session is also invalid: ${revalidation.reason}`);
|
|
56882
56898
|
releaseLock();
|
|
56883
56899
|
process.exit(1);
|
|
56884
56900
|
}
|
|
56901
|
+
return typedNewSession;
|
|
56885
56902
|
}
|
|
56886
56903
|
function setupMachine() {
|
|
56887
56904
|
ensureMachineRegistered();
|
|
@@ -56959,12 +56976,12 @@ async function initDaemon() {
|
|
|
56959
56976
|
process.exit(1);
|
|
56960
56977
|
}
|
|
56961
56978
|
const convexUrl = getConvexUrl();
|
|
56962
|
-
const sessionId = validateAuthentication(convexUrl);
|
|
56979
|
+
const sessionId = await validateAuthentication(convexUrl);
|
|
56963
56980
|
const client2 = await getConvexClient();
|
|
56964
|
-
|
|
56981
|
+
let typedSessionId = sessionId;
|
|
56965
56982
|
while (true) {
|
|
56966
56983
|
try {
|
|
56967
|
-
await validateSession(client2, typedSessionId, convexUrl);
|
|
56984
|
+
typedSessionId = await validateSession(client2, typedSessionId, convexUrl);
|
|
56968
56985
|
const config3 = setupMachine();
|
|
56969
56986
|
const { machineId } = config3;
|
|
56970
56987
|
initHarnessRegistry();
|
|
@@ -57016,7 +57033,7 @@ async function initDaemon() {
|
|
|
57016
57033
|
}
|
|
57017
57034
|
}
|
|
57018
57035
|
}
|
|
57019
|
-
var CONNECTION_RETRY_INTERVAL_MS = 1000;
|
|
57036
|
+
var AUTH_POLL_INTERVAL_MS2 = 2000, AUTH_WAIT_TIMEOUT_MS, CONNECTION_RETRY_INTERVAL_MS = 1000;
|
|
57020
57037
|
var init_init2 = __esm(() => {
|
|
57021
57038
|
init_state_recovery();
|
|
57022
57039
|
init_api3();
|
|
@@ -57033,6 +57050,7 @@ var init_init2 = __esm(() => {
|
|
|
57033
57050
|
init_convex_error();
|
|
57034
57051
|
init_version();
|
|
57035
57052
|
init_pid();
|
|
57053
|
+
AUTH_WAIT_TIMEOUT_MS = 5 * 60 * 1000;
|
|
57036
57054
|
});
|
|
57037
57055
|
|
|
57038
57056
|
// src/events/lifecycle/on-daemon-shutdown.ts
|