@fml-inc/fml 0.8.6-rc.1 → 0.8.6-rc.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/README.md
CHANGED
|
@@ -257,10 +257,11 @@ modes. An existing caller-supplied state directory retains its directory mode.
|
|
|
257
257
|
## Automatic updates
|
|
258
258
|
|
|
259
259
|
While the observer is running it checks npm for a newer FML release about once
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
260
|
+
a day (with jitter). A session-start hook also requests a check, limited to one
|
|
261
|
+
session-start check per hour. When a newer release exists, the observer applies
|
|
262
|
+
it by running `fml update` in the background: `npm install --global` followed by
|
|
263
|
+
`fml setup`, which restarts the observer onto the new version. Output from that
|
|
264
|
+
background update is written to `update.log` in the FML log directory.
|
|
264
265
|
|
|
265
266
|
Auto-update is on by default. To disable it, set `FML_AUTO_UPDATE=off` and
|
|
266
267
|
restart the observer so it picks up the change:
|
|
@@ -990,7 +990,7 @@ var PACKAGE_NAME = "@fml-inc/fml";
|
|
|
990
990
|
var UPDATE_TIMEOUT_MS = 12e4;
|
|
991
991
|
var SETUP_TIMEOUT_MS = 3e5;
|
|
992
992
|
function getCurrentVersion() {
|
|
993
|
-
return true ? "0.8.6-rc.
|
|
993
|
+
return true ? "0.8.6-rc.2+bda7cc0a" : "unknown";
|
|
994
994
|
}
|
|
995
995
|
function parseVersion(version) {
|
|
996
996
|
const match = SEMVER_PATTERN.exec(version);
|
package/dist/cli.js
CHANGED
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
readObserverStateStatus,
|
|
14
14
|
removeObserverStateIfOwned,
|
|
15
15
|
resolveBin
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-GQ2WVOGY.js";
|
|
17
17
|
import {
|
|
18
18
|
readJsonFile,
|
|
19
19
|
setHookCaptureDisabled,
|
|
@@ -127,7 +127,7 @@ var POLL_INTERVAL_MS = 50;
|
|
|
127
127
|
var LOG_ROTATE_BYTES = 10 * 1024 * 1024;
|
|
128
128
|
var LOG_ROTATE_FILES = 3;
|
|
129
129
|
function expectedObserverVersion() {
|
|
130
|
-
return true ? "0.8.6-rc.
|
|
130
|
+
return true ? "0.8.6-rc.2+bda7cc0a" : "dev";
|
|
131
131
|
}
|
|
132
132
|
function delay(ms) {
|
|
133
133
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
@@ -8841,7 +8841,7 @@ async function handleConfigDetail(opts) {
|
|
|
8841
8841
|
// src/commands/tools.ts
|
|
8842
8842
|
import { readFileSync } from "fs";
|
|
8843
8843
|
import path28 from "path";
|
|
8844
|
-
var pluginVersion = true ? "0.8.6-rc.
|
|
8844
|
+
var pluginVersion = true ? "0.8.6-rc.2+bda7cc0a" : void 0;
|
|
8845
8845
|
async function getApi() {
|
|
8846
8846
|
const api = await getAuthenticatedClient();
|
|
8847
8847
|
if (!api) {
|
|
@@ -8998,7 +8998,7 @@ if (process.argv.length <= 2 || process.argv.includes("--help") || process.argv.
|
|
|
8998
8998
|
printBanner();
|
|
8999
8999
|
}
|
|
9000
9000
|
var program = new Command().name("fml").description("FML CLI and agent tools").version(
|
|
9001
|
-
true ? "0.8.6-rc.
|
|
9001
|
+
true ? "0.8.6-rc.2+bda7cc0a" : "dev"
|
|
9002
9002
|
);
|
|
9003
9003
|
function formatCommandInventory(cmd, prefix = "") {
|
|
9004
9004
|
const name = prefix ? `${prefix} ${cmd.name()}` : cmd.name();
|
package/dist/observer-server.js
CHANGED
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
removeObserverStateIfOwned,
|
|
12
12
|
resolveBin,
|
|
13
13
|
updateObserverState
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-GQ2WVOGY.js";
|
|
15
15
|
import {
|
|
16
16
|
createHookSyncLoop,
|
|
17
17
|
getActiveHookDestinationBinding
|
|
@@ -1200,14 +1200,17 @@ function createObserverSyncLoop(opts) {
|
|
|
1200
1200
|
}
|
|
1201
1201
|
|
|
1202
1202
|
// src/observer/auto-update.ts
|
|
1203
|
-
var AUTO_UPDATE_INTERVAL_MS = 60 * 60 * 1e3;
|
|
1203
|
+
var AUTO_UPDATE_INTERVAL_MS = 24 * 60 * 60 * 1e3;
|
|
1204
1204
|
var AUTO_UPDATE_JITTER_MS = 10 * 60 * 1e3;
|
|
1205
|
+
var AUTO_UPDATE_SESSION_START_COOLDOWN_MS = 60 * 60 * 1e3;
|
|
1205
1206
|
function errorMessage2(error) {
|
|
1206
1207
|
return error instanceof Error ? error.message : String(error);
|
|
1207
1208
|
}
|
|
1208
1209
|
function createAutoUpdater(dependencies) {
|
|
1209
1210
|
let timer;
|
|
1210
1211
|
let stopped = true;
|
|
1212
|
+
let checkInFlight = false;
|
|
1213
|
+
let lastSessionStartCheckAtMs;
|
|
1211
1214
|
let generation = 0;
|
|
1212
1215
|
const nextDelay = () => {
|
|
1213
1216
|
if (dependencies.jitterMs <= 0) return dependencies.intervalMs;
|
|
@@ -1220,18 +1223,35 @@ function createAutoUpdater(dependencies) {
|
|
|
1220
1223
|
timer = setTimeout(onTick, nextDelay());
|
|
1221
1224
|
timer.unref();
|
|
1222
1225
|
};
|
|
1223
|
-
const
|
|
1224
|
-
const tickGeneration = generation;
|
|
1225
|
-
timer = void 0;
|
|
1226
|
+
const runUpdateCheck = async (checkGeneration) => {
|
|
1226
1227
|
try {
|
|
1227
1228
|
const result = await dependencies.runCheck();
|
|
1228
|
-
if (!stopped && result.newer)
|
|
1229
|
+
if (!stopped && checkGeneration === generation && result.newer) {
|
|
1230
|
+
dependencies.spawnUpdate();
|
|
1231
|
+
}
|
|
1229
1232
|
} catch (error) {
|
|
1230
|
-
if (!stopped) {
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1233
|
+
if (!stopped && checkGeneration === generation) {
|
|
1234
|
+
try {
|
|
1235
|
+
dependencies.log(
|
|
1236
|
+
`[fml] Auto-update check failed: ${errorMessage2(error)}`
|
|
1237
|
+
);
|
|
1238
|
+
} catch {
|
|
1239
|
+
}
|
|
1234
1240
|
}
|
|
1241
|
+
} finally {
|
|
1242
|
+
checkInFlight = false;
|
|
1243
|
+
}
|
|
1244
|
+
};
|
|
1245
|
+
const startUpdateCheck = (checkGeneration) => {
|
|
1246
|
+
if (stopped || checkInFlight) return null;
|
|
1247
|
+
checkInFlight = true;
|
|
1248
|
+
return runUpdateCheck(checkGeneration);
|
|
1249
|
+
};
|
|
1250
|
+
const onTick = async () => {
|
|
1251
|
+
const tickGeneration = generation;
|
|
1252
|
+
timer = void 0;
|
|
1253
|
+
try {
|
|
1254
|
+
await startUpdateCheck(tickGeneration);
|
|
1235
1255
|
} finally {
|
|
1236
1256
|
if (tickGeneration === generation) schedule();
|
|
1237
1257
|
}
|
|
@@ -1244,6 +1264,17 @@ function createAutoUpdater(dependencies) {
|
|
|
1244
1264
|
stopped = false;
|
|
1245
1265
|
schedule();
|
|
1246
1266
|
},
|
|
1267
|
+
onSessionStart() {
|
|
1268
|
+
if (stopped) return;
|
|
1269
|
+
const now = dependencies.nowMs();
|
|
1270
|
+
if (lastSessionStartCheckAtMs !== void 0 && now - lastSessionStartCheckAtMs < dependencies.sessionStartCooldownMs) {
|
|
1271
|
+
return;
|
|
1272
|
+
}
|
|
1273
|
+
const check = startUpdateCheck(generation);
|
|
1274
|
+
if (!check) return;
|
|
1275
|
+
lastSessionStartCheckAtMs = now;
|
|
1276
|
+
void check;
|
|
1277
|
+
},
|
|
1247
1278
|
stop() {
|
|
1248
1279
|
stopped = true;
|
|
1249
1280
|
generation += 1;
|
|
@@ -1449,7 +1480,7 @@ var hookRejectionStatus = () => ({
|
|
|
1449
1480
|
...lastRejectedReason !== void 0 ? { lastRejectedReason } : {},
|
|
1450
1481
|
...lastRejectedTarget !== void 0 ? { lastRejectedTarget } : {}
|
|
1451
1482
|
});
|
|
1452
|
-
var packageVersion = true ? "0.8.6-rc.
|
|
1483
|
+
var packageVersion = true ? "0.8.6-rc.2+bda7cc0a" : "dev";
|
|
1453
1484
|
var health = () => ({
|
|
1454
1485
|
status: "ok",
|
|
1455
1486
|
service: OBSERVER_SERVICE_NAME,
|
|
@@ -1626,8 +1657,9 @@ var captureHookRequest = (request, metadata) => {
|
|
|
1626
1657
|
} catch {
|
|
1627
1658
|
}
|
|
1628
1659
|
}
|
|
1660
|
+
let captured;
|
|
1629
1661
|
try {
|
|
1630
|
-
database.captureHookEvent({
|
|
1662
|
+
captured = database.captureHookEvent({
|
|
1631
1663
|
...event,
|
|
1632
1664
|
...destination ? { destination } : {}
|
|
1633
1665
|
});
|
|
@@ -1639,6 +1671,9 @@ var captureHookRequest = (request, metadata) => {
|
|
|
1639
1671
|
);
|
|
1640
1672
|
return terminal ? "terminal_rejected" : "retry";
|
|
1641
1673
|
}
|
|
1674
|
+
if (captured && event.eventType === "SessionStart") {
|
|
1675
|
+
autoUpdater?.onSessionStart();
|
|
1676
|
+
}
|
|
1642
1677
|
hookSyncLoop?.wake();
|
|
1643
1678
|
return "committed";
|
|
1644
1679
|
};
|
|
@@ -1732,6 +1767,7 @@ try {
|
|
|
1732
1767
|
}),
|
|
1733
1768
|
spawnUpdate: spawnObserverUpdate,
|
|
1734
1769
|
intervalMs: AUTO_UPDATE_INTERVAL_MS,
|
|
1770
|
+
sessionStartCooldownMs: AUTO_UPDATE_SESSION_START_COOLDOWN_MS,
|
|
1735
1771
|
jitterMs: AUTO_UPDATE_JITTER_MS,
|
|
1736
1772
|
log: console.warn
|
|
1737
1773
|
});
|