@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.cjs
CHANGED
|
@@ -13579,7 +13579,7 @@ function buildNodeInfo(store, opts) {
|
|
|
13579
13579
|
nodeId: opts.nodeId ?? ensureNodeId2(store),
|
|
13580
13580
|
platform: process.platform,
|
|
13581
13581
|
mode: process.env.NODE_MODE ?? "standalone",
|
|
13582
|
-
version: "0.2.
|
|
13582
|
+
version: "0.2.8",
|
|
13583
13583
|
admin: opts.admin,
|
|
13584
13584
|
projects: opts.projects
|
|
13585
13585
|
};
|
|
@@ -14572,7 +14572,7 @@ function buildNodeHost(store, manager, diskPath) {
|
|
|
14572
14572
|
arch: process.arch,
|
|
14573
14573
|
release: os6.release(),
|
|
14574
14574
|
uptimeSec: Math.round(os6.uptime()),
|
|
14575
|
-
version: "0.2.
|
|
14575
|
+
version: "0.2.8",
|
|
14576
14576
|
mode: process.env.NODE_MODE ?? "standalone",
|
|
14577
14577
|
cpu: {
|
|
14578
14578
|
count: cpus2.length,
|
|
@@ -16124,7 +16124,7 @@ function createApp(store, manager, opts = {}) {
|
|
|
16124
16124
|
json(res, 200, {
|
|
16125
16125
|
status: "ok",
|
|
16126
16126
|
// 版本让运维/探针能确认线上跑的是哪个构建(更新与回滚据此判断)
|
|
16127
|
-
version: "0.2.
|
|
16127
|
+
version: "0.2.8",
|
|
16128
16128
|
features: { mcp: hasServerMcpConfig() }
|
|
16129
16129
|
});
|
|
16130
16130
|
return;
|
|
@@ -17762,7 +17762,7 @@ var FleetNodeBridge = class {
|
|
|
17762
17762
|
label: this.opts.deps.store.loadNodeLabel() ?? void 0,
|
|
17763
17763
|
platform: process.platform,
|
|
17764
17764
|
mode: process.env.NODE_MODE ?? "standalone",
|
|
17765
|
-
version: "0.2.
|
|
17765
|
+
version: "0.2.8",
|
|
17766
17766
|
ip: primaryIp()
|
|
17767
17767
|
};
|
|
17768
17768
|
}
|
|
@@ -17817,7 +17817,7 @@ var FleetNodeBridge = class {
|
|
|
17817
17817
|
label: this.opts.deps.store.loadNodeLabel() ?? void 0,
|
|
17818
17818
|
platform: process.platform,
|
|
17819
17819
|
mode: process.env.NODE_MODE ?? "standalone",
|
|
17820
|
-
version: "0.2.
|
|
17820
|
+
version: "0.2.8",
|
|
17821
17821
|
ip: primaryIp(),
|
|
17822
17822
|
projects,
|
|
17823
17823
|
totals,
|
|
@@ -19483,9 +19483,10 @@ function selfCheck(binPath, expectedVersion) {
|
|
|
19483
19483
|
init_cjs_shims();
|
|
19484
19484
|
var fs27 = __toESM(require("fs"), 1);
|
|
19485
19485
|
var path33 = __toESM(require("path"), 1);
|
|
19486
|
+
var import_node_child_process6 = require("child_process");
|
|
19486
19487
|
var import_node_module3 = require("module");
|
|
19487
19488
|
function currentVersion() {
|
|
19488
|
-
const injected = "0.2.
|
|
19489
|
+
const injected = "0.2.8"?.trim();
|
|
19489
19490
|
if (injected) return injected;
|
|
19490
19491
|
try {
|
|
19491
19492
|
const req2 = (0, import_node_module3.createRequire)(importMetaUrl);
|
|
@@ -19528,6 +19529,35 @@ function serviceManager() {
|
|
|
19528
19529
|
if (v === "systemd" || v === "launchd") return v;
|
|
19529
19530
|
return detectServiceManager();
|
|
19530
19531
|
}
|
|
19532
|
+
function parseServiceEnvironment(raw) {
|
|
19533
|
+
const out = {};
|
|
19534
|
+
for (const token of raw.trim().split(/\s+/)) {
|
|
19535
|
+
const idx = token.indexOf("=");
|
|
19536
|
+
if (idx > 0) out[token.slice(0, idx)] = token.slice(idx + 1);
|
|
19537
|
+
}
|
|
19538
|
+
return out;
|
|
19539
|
+
}
|
|
19540
|
+
var cachedServiceEnv = null;
|
|
19541
|
+
function readServiceEnvironment() {
|
|
19542
|
+
const serviceName = process.env.ZQAGENT_SERVICE_NAME?.trim() || DEFAULT_SERVICE_NAME;
|
|
19543
|
+
try {
|
|
19544
|
+
const res = (0, import_node_child_process6.spawnSync)(
|
|
19545
|
+
"systemctl",
|
|
19546
|
+
["show", serviceName, "--property=Environment", "--value", "--no-pager"],
|
|
19547
|
+
{ encoding: "utf8", timeout: 3e3 }
|
|
19548
|
+
);
|
|
19549
|
+
if (res.status !== 0 || !res.stdout) return {};
|
|
19550
|
+
return parseServiceEnvironment(res.stdout);
|
|
19551
|
+
} catch {
|
|
19552
|
+
return {};
|
|
19553
|
+
}
|
|
19554
|
+
}
|
|
19555
|
+
function serviceEnvValue(key) {
|
|
19556
|
+
if (process.platform !== "linux") return void 0;
|
|
19557
|
+
if (serviceManager() !== "systemd") return void 0;
|
|
19558
|
+
cachedServiceEnv ??= readServiceEnvironment();
|
|
19559
|
+
return cachedServiceEnv[key];
|
|
19560
|
+
}
|
|
19531
19561
|
function selfUpdateCapability(hasPublicKey) {
|
|
19532
19562
|
if (!isSeaRuntime()) {
|
|
19533
19563
|
return {
|
|
@@ -19680,7 +19710,9 @@ function readRollbackTarget(dataDir) {
|
|
|
19680
19710
|
var DEFAULT_BASE = "https://agent.cd-zq.com/downloads/zqagent";
|
|
19681
19711
|
function env(key) {
|
|
19682
19712
|
const v = process.env[key]?.trim();
|
|
19683
|
-
|
|
19713
|
+
if (v) return v;
|
|
19714
|
+
const fromService = serviceEnvValue(key)?.trim();
|
|
19715
|
+
return fromService ? fromService : void 0;
|
|
19684
19716
|
}
|
|
19685
19717
|
function num(key, fallback) {
|
|
19686
19718
|
const n = Number(env(key));
|
|
@@ -19717,7 +19749,7 @@ var UpdateController = class {
|
|
|
19717
19749
|
return parsePublicKey(env("ZQAGENT_UPDATE_PUBKEY") ?? "");
|
|
19718
19750
|
}
|
|
19719
19751
|
get autoUpdateOff() {
|
|
19720
|
-
return
|
|
19752
|
+
return env("ZQAGENT_AUTO_UPDATE") === "0";
|
|
19721
19753
|
}
|
|
19722
19754
|
get enabled() {
|
|
19723
19755
|
return !this.autoUpdateOff && selfUpdateCapability(Boolean(this.publicKey)).ok;
|
|
@@ -21630,7 +21662,7 @@ async function offerTerminalSetup(engine, canUseAgent) {
|
|
|
21630
21662
|
}
|
|
21631
21663
|
var KNOWN_SUBCOMMANDS = /* @__PURE__ */ new Set(["link", "serve", "update"]);
|
|
21632
21664
|
function cliVersion() {
|
|
21633
|
-
const env3 = "0.2.
|
|
21665
|
+
const env3 = "0.2.8"?.trim();
|
|
21634
21666
|
if (env3) return env3;
|
|
21635
21667
|
try {
|
|
21636
21668
|
const req2 = (0, import_module.createRequire)(importMetaUrl);
|