fleetlens 0.2.6 → 0.2.8
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/app/apps/web/.next/BUILD_ID +1 -1
- package/app/apps/web/.next/build-manifest.json +3 -3
- package/app/apps/web/.next/prerender-manifest.json +3 -3
- package/app/apps/web/.next/required-server-files.json +3 -3
- package/app/apps/web/.next/server/app/_global-error.html +1 -1
- package/app/apps/web/.next/server/app/_global-error.rsc +1 -1
- package/app/apps/web/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/app/apps/web/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/app/apps/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/app/apps/web/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/app/apps/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/app/apps/web/.next/server/chunks/ssr/_0xies90._.js +1 -1
- package/app/apps/web/.next/server/middleware-build-manifest.js +3 -3
- package/app/apps/web/.next/server/pages/500.html +1 -1
- package/app/apps/web/.next/server/server-reference-manifest.js +1 -1
- package/app/apps/web/.next/server/server-reference-manifest.json +1 -1
- package/app/apps/web/package.json +1 -1
- package/app/apps/web/server.js +1 -1
- package/app/apps/web/tsconfig.tsbuildinfo +1 -1
- package/dist/daemon-worker.js +27 -5
- package/dist/index.js +61 -10
- package/package.json +1 -1
- /package/app/apps/web/.next/static/{xFotUhEk3wVr-guN_B8n_ → CH5VTNGEbso0WpO5B8BTA}/_buildManifest.js +0 -0
- /package/app/apps/web/.next/static/{xFotUhEk3wVr-guN_B8n_ → CH5VTNGEbso0WpO5B8BTA}/_clientMiddlewareManifest.js +0 -0
- /package/app/apps/web/.next/static/{xFotUhEk3wVr-guN_B8n_ → CH5VTNGEbso0WpO5B8BTA}/_ssgManifest.js +0 -0
package/dist/daemon-worker.js
CHANGED
|
@@ -137,6 +137,7 @@ var STATE_DIR = join2(homedir2(), ".cclens");
|
|
|
137
137
|
var USAGE_LOG = join2(STATE_DIR, "usage.jsonl");
|
|
138
138
|
var DAEMON_LOG = join2(STATE_DIR, "daemon.log");
|
|
139
139
|
var POLL_INTERVAL_MS = 5 * 60 * 1e3;
|
|
140
|
+
var WATCHDOG_INTERVAL_MS = 30 * 1e3;
|
|
140
141
|
mkdirSync2(dirname2(USAGE_LOG), { recursive: true });
|
|
141
142
|
function log(level, message) {
|
|
142
143
|
const line = `${(/* @__PURE__ */ new Date()).toISOString()} ${level.toUpperCase()} ${message}
|
|
@@ -146,7 +147,9 @@ function log(level, message) {
|
|
|
146
147
|
} catch {
|
|
147
148
|
}
|
|
148
149
|
}
|
|
150
|
+
var lastPollAtMs = 0;
|
|
149
151
|
async function tick() {
|
|
152
|
+
lastPollAtMs = Date.now();
|
|
150
153
|
try {
|
|
151
154
|
const snapshot = await fetchUsage();
|
|
152
155
|
appendSnapshot(USAGE_LOG, snapshot);
|
|
@@ -162,11 +165,30 @@ async function tick() {
|
|
|
162
165
|
}
|
|
163
166
|
}
|
|
164
167
|
}
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
168
|
+
function sleep(ms) {
|
|
169
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
170
|
+
}
|
|
171
|
+
async function runLoop() {
|
|
172
|
+
while (true) {
|
|
173
|
+
const now = Date.now();
|
|
174
|
+
const elapsed = now - lastPollAtMs;
|
|
175
|
+
if (elapsed >= POLL_INTERVAL_MS) {
|
|
176
|
+
if (lastPollAtMs > 0 && elapsed > POLL_INTERVAL_MS * 1.5) {
|
|
177
|
+
log(
|
|
178
|
+
"info",
|
|
179
|
+
`wake-from-sleep catch-up: ${Math.round(elapsed / 1e3)}s since last poll (expected ${POLL_INTERVAL_MS / 1e3}s)`
|
|
180
|
+
);
|
|
181
|
+
}
|
|
182
|
+
await tick();
|
|
183
|
+
}
|
|
184
|
+
await sleep(WATCHDOG_INTERVAL_MS);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
log(
|
|
188
|
+
"info",
|
|
189
|
+
`daemon started (pid=${process.pid}, interval=${POLL_INTERVAL_MS / 1e3}s, watchdog=${WATCHDOG_INTERVAL_MS / 1e3}s)`
|
|
190
|
+
);
|
|
191
|
+
void runLoop();
|
|
170
192
|
process.on("SIGTERM", () => {
|
|
171
193
|
log("info", `daemon stopping (pid=${process.pid})`);
|
|
172
194
|
process.exit(0);
|
package/dist/index.js
CHANGED
|
@@ -454,9 +454,9 @@ Installed: ${PACKAGE_NAME}@${verify.installedVersion} at ${verify.installedPath
|
|
|
454
454
|
console.warn(
|
|
455
455
|
` \u2022 reinstall in the correct Node env: 'npm install -g ${PACKAGE_NAME}@latest'`
|
|
456
456
|
);
|
|
457
|
-
} else if (verify.installedVersion !== "0.2.
|
|
457
|
+
} else if (verify.installedVersion !== "0.2.8") {
|
|
458
458
|
console.log(
|
|
459
|
-
` \u2192 This process is still running ${"0.2.
|
|
459
|
+
` \u2192 This process is still running ${"0.2.8"}. Next invocation will use ${verify.installedVersion}.`
|
|
460
460
|
);
|
|
461
461
|
}
|
|
462
462
|
}
|
|
@@ -492,7 +492,7 @@ async function checkForUpdate() {
|
|
|
492
492
|
if (process.env.__FLEETLENS_UPDATED === "1" || process.env.__CCLENS_UPDATED === "1") return;
|
|
493
493
|
const latest = await fetchLatestVersion();
|
|
494
494
|
if (latest === null) return;
|
|
495
|
-
const current = "0.2.
|
|
495
|
+
const current = "0.2.8";
|
|
496
496
|
if (!shouldUpdate(current, latest)) return;
|
|
497
497
|
console.log(`Updating ${PACKAGE_NAME} ${current} \u2192 ${latest}...`);
|
|
498
498
|
await stopRunningServices();
|
|
@@ -510,10 +510,17 @@ async function checkForUpdate() {
|
|
|
510
510
|
}
|
|
511
511
|
}
|
|
512
512
|
async function stopRunningServices() {
|
|
513
|
+
const state = {
|
|
514
|
+
serverWasRunning: false,
|
|
515
|
+
serverPort: null,
|
|
516
|
+
daemonWasRunning: false
|
|
517
|
+
};
|
|
513
518
|
try {
|
|
514
519
|
const { getServerStatus: getServerStatus2, stopServer: stopServer2 } = await Promise.resolve().then(() => (init_server(), server_exports));
|
|
515
520
|
const status2 = getServerStatus2();
|
|
516
521
|
if (status2.running) {
|
|
522
|
+
state.serverWasRunning = true;
|
|
523
|
+
state.serverPort = status2.port;
|
|
517
524
|
stopServer2();
|
|
518
525
|
console.log(` \u2713 Stopped old server (PID ${status2.pid})`);
|
|
519
526
|
}
|
|
@@ -523,33 +530,77 @@ async function stopRunningServices() {
|
|
|
523
530
|
const { stopDaemonSilent: stopDaemonSilent2 } = await Promise.resolve().then(() => (init_daemon(), daemon_exports));
|
|
524
531
|
const result = stopDaemonSilent2();
|
|
525
532
|
if (result.stopped) {
|
|
533
|
+
state.daemonWasRunning = true;
|
|
526
534
|
console.log(` \u2713 Stopped old daemon (PID ${result.pid})`);
|
|
527
535
|
}
|
|
528
536
|
} catch {
|
|
529
537
|
}
|
|
538
|
+
return state;
|
|
539
|
+
}
|
|
540
|
+
async function restartServices(state) {
|
|
541
|
+
if (!state.serverWasRunning && !state.daemonWasRunning) return;
|
|
542
|
+
if (state.serverWasRunning) {
|
|
543
|
+
try {
|
|
544
|
+
const { startServer: startServer2 } = await Promise.resolve().then(() => (init_server(), server_exports));
|
|
545
|
+
const result = await startServer2({ port: state.serverPort ?? void 0 });
|
|
546
|
+
console.log(
|
|
547
|
+
` \u2713 Restarted server on http://localhost:${result.port} (PID ${result.pid})`
|
|
548
|
+
);
|
|
549
|
+
} catch (err) {
|
|
550
|
+
console.warn(
|
|
551
|
+
` ! Could not restart server: ${err.message}
|
|
552
|
+
Run 'fleetlens start' manually.`
|
|
553
|
+
);
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
if (state.daemonWasRunning) {
|
|
557
|
+
try {
|
|
558
|
+
const { startDaemonSilent: startDaemonSilent2 } = await Promise.resolve().then(() => (init_daemon(), daemon_exports));
|
|
559
|
+
const result = startDaemonSilent2();
|
|
560
|
+
if (result.started) {
|
|
561
|
+
console.log(` \u2713 Restarted daemon (PID ${result.pid})`);
|
|
562
|
+
} else if (result.alreadyRunning) {
|
|
563
|
+
console.log(` \u2713 Daemon already running (PID ${result.pid})`);
|
|
564
|
+
} else {
|
|
565
|
+
console.warn(` ! Could not restart daemon: ${result.error}`);
|
|
566
|
+
}
|
|
567
|
+
} catch (err) {
|
|
568
|
+
console.warn(
|
|
569
|
+
` ! Could not restart daemon: ${err.message}
|
|
570
|
+
Run 'fleetlens daemon start' manually.`
|
|
571
|
+
);
|
|
572
|
+
}
|
|
573
|
+
}
|
|
530
574
|
}
|
|
531
575
|
async function forceUpdate() {
|
|
532
576
|
const latest = await fetchLatestVersion();
|
|
533
|
-
const current = "0.2.
|
|
577
|
+
const current = "0.2.8";
|
|
534
578
|
if (latest === null) {
|
|
535
579
|
console.error("Could not reach npm registry. Check your network.");
|
|
536
580
|
process.exit(1);
|
|
537
581
|
}
|
|
538
|
-
|
|
582
|
+
const isRealUpgrade = shouldUpdate(current, latest);
|
|
583
|
+
let priorState = null;
|
|
584
|
+
if (isRealUpgrade) {
|
|
539
585
|
console.log(`Updating ${PACKAGE_NAME} ${current} \u2192 ${latest}...`);
|
|
540
|
-
await stopRunningServices();
|
|
586
|
+
priorState = await stopRunningServices();
|
|
541
587
|
} else {
|
|
542
588
|
console.log(`Already on latest (${current}). Reinstalling...`);
|
|
543
589
|
}
|
|
544
590
|
const ok = runNpmInstall();
|
|
545
|
-
if (ok) {
|
|
546
|
-
reportInstallOutcome(latest);
|
|
547
|
-
} else {
|
|
591
|
+
if (!ok) {
|
|
548
592
|
console.error("Update failed.");
|
|
549
593
|
console.error(` \u2192 Try manually: npm install -g ${PACKAGE_NAME}@latest`);
|
|
550
594
|
console.error(` \u2192 Or with sudo if your global npm prefix needs it.`);
|
|
551
595
|
process.exit(1);
|
|
552
596
|
}
|
|
597
|
+
reportInstallOutcome(latest);
|
|
598
|
+
if (isRealUpgrade && priorState) {
|
|
599
|
+
if (priorState.serverWasRunning || priorState.daemonWasRunning) {
|
|
600
|
+
console.log("");
|
|
601
|
+
await restartServices(priorState);
|
|
602
|
+
}
|
|
603
|
+
}
|
|
553
604
|
}
|
|
554
605
|
var PACKAGE_NAME, CHECK_TIMEOUT_MS;
|
|
555
606
|
var init_updater = __esm({
|
|
@@ -1761,7 +1812,7 @@ async function main() {
|
|
|
1761
1812
|
case "version":
|
|
1762
1813
|
case "--version":
|
|
1763
1814
|
case "-v":
|
|
1764
|
-
console.log(`fleetlens ${"0.2.
|
|
1815
|
+
console.log(`fleetlens ${"0.2.8"}`);
|
|
1765
1816
|
break;
|
|
1766
1817
|
case "help":
|
|
1767
1818
|
case "--help":
|
package/package.json
CHANGED
/package/app/apps/web/.next/static/{xFotUhEk3wVr-guN_B8n_ → CH5VTNGEbso0WpO5B8BTA}/_buildManifest.js
RENAMED
|
File without changes
|
|
File without changes
|
/package/app/apps/web/.next/static/{xFotUhEk3wVr-guN_B8n_ → CH5VTNGEbso0WpO5B8BTA}/_ssgManifest.js
RENAMED
|
File without changes
|