@hermespilot/link 0.5.7 → 0.5.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.
|
@@ -4502,7 +4502,7 @@ import os2 from "os";
|
|
|
4502
4502
|
import path5 from "path";
|
|
4503
4503
|
|
|
4504
4504
|
// src/constants.ts
|
|
4505
|
-
var LINK_VERSION = "0.5.
|
|
4505
|
+
var LINK_VERSION = "0.5.8";
|
|
4506
4506
|
var LINK_COMMAND = "hermeslink";
|
|
4507
4507
|
var LINK_DEFAULT_PORT = 52379;
|
|
4508
4508
|
var LINK_RUNTIME_DIR_NAME = ".hermeslink";
|
|
@@ -24812,13 +24812,15 @@ async function writeFailedStartState(options, error, targetVersion = null) {
|
|
|
24812
24812
|
return readLinkUpdateStatus(options.paths);
|
|
24813
24813
|
}
|
|
24814
24814
|
async function readRemoteLinkPolicy(options) {
|
|
24815
|
-
const
|
|
24815
|
+
const channel = normalizeLinkReleaseChannel(options.channel);
|
|
24816
|
+
const context = await readLinkReleaseCheckContext(options.paths, channel).catch(
|
|
24816
24817
|
() => null
|
|
24817
24818
|
);
|
|
24818
24819
|
try {
|
|
24819
24820
|
const response = await fetchCurrentLinkReleaseFromServer(
|
|
24820
24821
|
options,
|
|
24821
|
-
options.fetchImpl ?? fetch
|
|
24822
|
+
options.fetchImpl ?? fetch,
|
|
24823
|
+
channel
|
|
24822
24824
|
);
|
|
24823
24825
|
if (!response.ok) {
|
|
24824
24826
|
throw new Error(`HermesPilot Server returned HTTP ${response.status}`);
|
|
@@ -24875,10 +24877,10 @@ function normalizeServerSnapshot(payload) {
|
|
|
24875
24877
|
issue: readString18(snapshot, "issue")
|
|
24876
24878
|
};
|
|
24877
24879
|
}
|
|
24878
|
-
async function fetchCurrentLinkReleaseFromServer(options, fetcher) {
|
|
24880
|
+
async function fetchCurrentLinkReleaseFromServer(options, fetcher, channel) {
|
|
24879
24881
|
const config = await loadConfig(options.paths);
|
|
24880
24882
|
const url = new URL(SERVER_LINK_CURRENT_RELEASE_PATH, config.serverBaseUrl);
|
|
24881
|
-
url.searchParams.set("channel",
|
|
24883
|
+
url.searchParams.set("channel", channel);
|
|
24882
24884
|
url.searchParams.set("lang", "en");
|
|
24883
24885
|
const controller = new AbortController();
|
|
24884
24886
|
const timer = setTimeout(() => controller.abort(), UPDATE_FETCH_TIMEOUT_MS);
|
|
@@ -25153,16 +25155,20 @@ function spawnInstallCommand(input) {
|
|
|
25153
25155
|
shell: false
|
|
25154
25156
|
});
|
|
25155
25157
|
}
|
|
25156
|
-
async function readLinkReleaseCheckContext(paths) {
|
|
25158
|
+
async function readLinkReleaseCheckContext(paths, channel) {
|
|
25157
25159
|
const config = await loadConfig(paths);
|
|
25158
25160
|
const url = new URL(SERVER_LINK_CURRENT_RELEASE_PATH, config.serverBaseUrl);
|
|
25159
|
-
url.searchParams.set("channel",
|
|
25161
|
+
url.searchParams.set("channel", channel);
|
|
25160
25162
|
url.searchParams.set("lang", "en");
|
|
25161
25163
|
return {
|
|
25162
25164
|
serverBaseUrl: config.serverBaseUrl,
|
|
25163
25165
|
releaseCheckUrl: url.toString()
|
|
25164
25166
|
};
|
|
25165
25167
|
}
|
|
25168
|
+
function normalizeLinkReleaseChannel(value) {
|
|
25169
|
+
const channel = value?.trim().toLowerCase();
|
|
25170
|
+
return channel === "beta" || channel === "dev" ? channel : "stable";
|
|
25171
|
+
}
|
|
25166
25172
|
function computeLinkUpdateState(localVersion, remote) {
|
|
25167
25173
|
if (!remote?.current_version) {
|
|
25168
25174
|
return "unknown";
|
|
@@ -25966,6 +25972,7 @@ function registerSystemRoutes(router, options) {
|
|
|
25966
25972
|
router.get("/api/v1/status", async (ctx) => {
|
|
25967
25973
|
await authenticateRequest(ctx, paths);
|
|
25968
25974
|
ctx.set("cache-control", "no-store");
|
|
25975
|
+
const linkUpdateChannel = readQueryString(ctx.query.link_update_channel) ?? readQueryString(ctx.query.channel);
|
|
25969
25976
|
const [
|
|
25970
25977
|
identity,
|
|
25971
25978
|
config,
|
|
@@ -26010,22 +26017,24 @@ function registerSystemRoutes(router, options) {
|
|
|
26010
26017
|
lines: [],
|
|
26011
26018
|
error: error instanceof Error ? error.message : String(error)
|
|
26012
26019
|
})),
|
|
26013
|
-
readLinkUpdateCheck({ paths, logger }).catch(
|
|
26014
|
-
|
|
26015
|
-
|
|
26016
|
-
|
|
26017
|
-
|
|
26018
|
-
|
|
26019
|
-
|
|
26020
|
-
|
|
26021
|
-
|
|
26022
|
-
|
|
26023
|
-
|
|
26024
|
-
|
|
26025
|
-
|
|
26026
|
-
|
|
26027
|
-
|
|
26028
|
-
|
|
26020
|
+
readLinkUpdateCheck({ paths, logger, channel: linkUpdateChannel }).catch(
|
|
26021
|
+
(error) => ({
|
|
26022
|
+
ok: true,
|
|
26023
|
+
local: { version: LINK_VERSION, raw: LINK_VERSION },
|
|
26024
|
+
remote: null,
|
|
26025
|
+
state: "unknown",
|
|
26026
|
+
update_available: false,
|
|
26027
|
+
unsafe: false,
|
|
26028
|
+
blocked: false,
|
|
26029
|
+
check_state: "unavailable",
|
|
26030
|
+
issue: error instanceof Error ? error.message : String(error),
|
|
26031
|
+
manual: {
|
|
26032
|
+
command: null,
|
|
26033
|
+
package: "@hermespilot/link",
|
|
26034
|
+
version: null
|
|
26035
|
+
}
|
|
26036
|
+
})
|
|
26037
|
+
),
|
|
26029
26038
|
readLinkUsageStatistics(paths, { days: 7 }).catch(() => null),
|
|
26030
26039
|
readRecentGatewayLogEntries({ paths, limit: 1e3 }).catch(() => [])
|
|
26031
26040
|
]);
|
|
@@ -26300,7 +26309,11 @@ function registerLinkUpdateRoutes(router, options) {
|
|
|
26300
26309
|
router.get("/api/v1/link/update-check", async (ctx) => {
|
|
26301
26310
|
await authenticateRequest(ctx, paths);
|
|
26302
26311
|
ctx.set("cache-control", "no-store");
|
|
26303
|
-
ctx.body = await readLinkUpdateCheck({
|
|
26312
|
+
ctx.body = await readLinkUpdateCheck({
|
|
26313
|
+
paths,
|
|
26314
|
+
logger,
|
|
26315
|
+
channel: readQueryString(ctx.query.channel)
|
|
26316
|
+
});
|
|
26304
26317
|
});
|
|
26305
26318
|
router.get("/api/v1/link/update/status", async (ctx) => {
|
|
26306
26319
|
await authenticateRequest(ctx, paths);
|
|
@@ -26314,6 +26327,7 @@ function registerLinkUpdateRoutes(router, options) {
|
|
|
26314
26327
|
ctx.body = await startLinkUpdate({
|
|
26315
26328
|
paths,
|
|
26316
26329
|
logger,
|
|
26330
|
+
channel: readString14(body, "channel"),
|
|
26317
26331
|
targetVersion: readString14(body, "target_version") ?? readString14(body, "targetVersion")
|
|
26318
26332
|
});
|
|
26319
26333
|
});
|
package/dist/cli/index.js
CHANGED
package/dist/http/app.js
CHANGED