@zqagent/core 0.2.7 → 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/dist/cli/index.cjs +41 -9
- package/dist/cli/index.cjs.map +1 -1
- package/dist/cli/index.js +41 -9
- package/dist/cli/index.js.map +1 -1
- package/dist/server/index.cjs +40 -8
- package/dist/server/index.cjs.map +1 -1
- package/dist/server/index.js +40 -8
- package/dist/server/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -13562,7 +13562,7 @@ function buildNodeInfo(store, opts) {
|
|
|
13562
13562
|
nodeId: opts.nodeId ?? ensureNodeId2(store),
|
|
13563
13563
|
platform: process.platform,
|
|
13564
13564
|
mode: process.env.NODE_MODE ?? "standalone",
|
|
13565
|
-
version: "0.2.
|
|
13565
|
+
version: "0.2.8",
|
|
13566
13566
|
admin: opts.admin,
|
|
13567
13567
|
projects: opts.projects
|
|
13568
13568
|
};
|
|
@@ -14555,7 +14555,7 @@ function buildNodeHost(store, manager, diskPath) {
|
|
|
14555
14555
|
arch: process.arch,
|
|
14556
14556
|
release: os6.release(),
|
|
14557
14557
|
uptimeSec: Math.round(os6.uptime()),
|
|
14558
|
-
version: "0.2.
|
|
14558
|
+
version: "0.2.8",
|
|
14559
14559
|
mode: process.env.NODE_MODE ?? "standalone",
|
|
14560
14560
|
cpu: {
|
|
14561
14561
|
count: cpus2.length,
|
|
@@ -16107,7 +16107,7 @@ function createApp(store, manager, opts = {}) {
|
|
|
16107
16107
|
json(res, 200, {
|
|
16108
16108
|
status: "ok",
|
|
16109
16109
|
// 版本让运维/探针能确认线上跑的是哪个构建(更新与回滚据此判断)
|
|
16110
|
-
version: "0.2.
|
|
16110
|
+
version: "0.2.8",
|
|
16111
16111
|
features: { mcp: hasServerMcpConfig() }
|
|
16112
16112
|
});
|
|
16113
16113
|
return;
|
|
@@ -17745,7 +17745,7 @@ var FleetNodeBridge = class {
|
|
|
17745
17745
|
label: this.opts.deps.store.loadNodeLabel() ?? void 0,
|
|
17746
17746
|
platform: process.platform,
|
|
17747
17747
|
mode: process.env.NODE_MODE ?? "standalone",
|
|
17748
|
-
version: "0.2.
|
|
17748
|
+
version: "0.2.8",
|
|
17749
17749
|
ip: primaryIp()
|
|
17750
17750
|
};
|
|
17751
17751
|
}
|
|
@@ -17800,7 +17800,7 @@ var FleetNodeBridge = class {
|
|
|
17800
17800
|
label: this.opts.deps.store.loadNodeLabel() ?? void 0,
|
|
17801
17801
|
platform: process.platform,
|
|
17802
17802
|
mode: process.env.NODE_MODE ?? "standalone",
|
|
17803
|
-
version: "0.2.
|
|
17803
|
+
version: "0.2.8",
|
|
17804
17804
|
ip: primaryIp(),
|
|
17805
17805
|
projects,
|
|
17806
17806
|
totals,
|
|
@@ -19466,9 +19466,10 @@ function selfCheck(binPath, expectedVersion) {
|
|
|
19466
19466
|
init_esm_shims();
|
|
19467
19467
|
import * as fs27 from "fs";
|
|
19468
19468
|
import * as path34 from "path";
|
|
19469
|
+
import { spawnSync as spawnSync4 } from "child_process";
|
|
19469
19470
|
import { createRequire as createRequire3 } from "module";
|
|
19470
19471
|
function currentVersion() {
|
|
19471
|
-
const injected = "0.2.
|
|
19472
|
+
const injected = "0.2.8"?.trim();
|
|
19472
19473
|
if (injected) return injected;
|
|
19473
19474
|
try {
|
|
19474
19475
|
const req2 = createRequire3(import.meta.url);
|
|
@@ -19511,6 +19512,35 @@ function serviceManager() {
|
|
|
19511
19512
|
if (v === "systemd" || v === "launchd") return v;
|
|
19512
19513
|
return detectServiceManager();
|
|
19513
19514
|
}
|
|
19515
|
+
function parseServiceEnvironment(raw) {
|
|
19516
|
+
const out = {};
|
|
19517
|
+
for (const token of raw.trim().split(/\s+/)) {
|
|
19518
|
+
const idx = token.indexOf("=");
|
|
19519
|
+
if (idx > 0) out[token.slice(0, idx)] = token.slice(idx + 1);
|
|
19520
|
+
}
|
|
19521
|
+
return out;
|
|
19522
|
+
}
|
|
19523
|
+
var cachedServiceEnv = null;
|
|
19524
|
+
function readServiceEnvironment() {
|
|
19525
|
+
const serviceName = process.env.ZQAGENT_SERVICE_NAME?.trim() || DEFAULT_SERVICE_NAME;
|
|
19526
|
+
try {
|
|
19527
|
+
const res = spawnSync4(
|
|
19528
|
+
"systemctl",
|
|
19529
|
+
["show", serviceName, "--property=Environment", "--value", "--no-pager"],
|
|
19530
|
+
{ encoding: "utf8", timeout: 3e3 }
|
|
19531
|
+
);
|
|
19532
|
+
if (res.status !== 0 || !res.stdout) return {};
|
|
19533
|
+
return parseServiceEnvironment(res.stdout);
|
|
19534
|
+
} catch {
|
|
19535
|
+
return {};
|
|
19536
|
+
}
|
|
19537
|
+
}
|
|
19538
|
+
function serviceEnvValue(key) {
|
|
19539
|
+
if (process.platform !== "linux") return void 0;
|
|
19540
|
+
if (serviceManager() !== "systemd") return void 0;
|
|
19541
|
+
cachedServiceEnv ??= readServiceEnvironment();
|
|
19542
|
+
return cachedServiceEnv[key];
|
|
19543
|
+
}
|
|
19514
19544
|
function selfUpdateCapability(hasPublicKey) {
|
|
19515
19545
|
if (!isSeaRuntime()) {
|
|
19516
19546
|
return {
|
|
@@ -19663,7 +19693,9 @@ function readRollbackTarget(dataDir) {
|
|
|
19663
19693
|
var DEFAULT_BASE = "https://agent.cd-zq.com/downloads/zqagent";
|
|
19664
19694
|
function env(key) {
|
|
19665
19695
|
const v = process.env[key]?.trim();
|
|
19666
|
-
|
|
19696
|
+
if (v) return v;
|
|
19697
|
+
const fromService = serviceEnvValue(key)?.trim();
|
|
19698
|
+
return fromService ? fromService : void 0;
|
|
19667
19699
|
}
|
|
19668
19700
|
function num(key, fallback) {
|
|
19669
19701
|
const n = Number(env(key));
|
|
@@ -19700,7 +19732,7 @@ var UpdateController = class {
|
|
|
19700
19732
|
return parsePublicKey(env("ZQAGENT_UPDATE_PUBKEY") ?? "");
|
|
19701
19733
|
}
|
|
19702
19734
|
get autoUpdateOff() {
|
|
19703
|
-
return
|
|
19735
|
+
return env("ZQAGENT_AUTO_UPDATE") === "0";
|
|
19704
19736
|
}
|
|
19705
19737
|
get enabled() {
|
|
19706
19738
|
return !this.autoUpdateOff && selfUpdateCapability(Boolean(this.publicKey)).ok;
|
|
@@ -21613,7 +21645,7 @@ async function offerTerminalSetup(engine, canUseAgent) {
|
|
|
21613
21645
|
}
|
|
21614
21646
|
var KNOWN_SUBCOMMANDS = /* @__PURE__ */ new Set(["link", "serve", "update"]);
|
|
21615
21647
|
function cliVersion() {
|
|
21616
|
-
const env3 = "0.2.
|
|
21648
|
+
const env3 = "0.2.8"?.trim();
|
|
21617
21649
|
if (env3) return env3;
|
|
21618
21650
|
try {
|
|
21619
21651
|
const req2 = createRequire4(import.meta.url);
|