talon-agent 5.12.0 → 5.14.0
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/package.json
CHANGED
|
@@ -38,6 +38,7 @@ import {
|
|
|
38
38
|
} from "./status-context.js";
|
|
39
39
|
import { getCacheVerdict, getMetrics } from "../../storage/metrics.js";
|
|
40
40
|
import { formatDuration } from "./format.js";
|
|
41
|
+
import { talonVersionLabel } from "../../util/version.js";
|
|
41
42
|
|
|
42
43
|
/**
|
|
43
44
|
* Clear a chat's session state everywhere it lives: Talon's session +
|
|
@@ -105,7 +106,7 @@ export interface SessionStatusData {
|
|
|
105
106
|
sessionId: string | undefined;
|
|
106
107
|
uptime: string;
|
|
107
108
|
activeSessionCount: number;
|
|
108
|
-
/**
|
|
109
|
+
/** Talon version plus runtime, e.g. "Talon v5.10.0 (ab12cd34) · Bun 1.3.9". */
|
|
109
110
|
runtime: string;
|
|
110
111
|
/** Daemon resident set size, in bytes. */
|
|
111
112
|
rssBytes: number;
|
|
@@ -234,9 +235,11 @@ export async function collectSessionStatus(
|
|
|
234
235
|
sessionId: info.sessionId,
|
|
235
236
|
uptime: formatDuration(process.uptime() * 1000),
|
|
236
237
|
activeSessionCount: getActiveSessionCount(),
|
|
237
|
-
runtime:
|
|
238
|
-
|
|
239
|
-
|
|
238
|
+
runtime: `Talon ${talonVersionLabel()} · ${
|
|
239
|
+
process.versions.bun
|
|
240
|
+
? `Bun ${process.versions.bun}`
|
|
241
|
+
: `Node ${process.versions.node}`
|
|
242
|
+
}`,
|
|
240
243
|
rssBytes: memory.rss,
|
|
241
244
|
daemon: buildDaemonDisplay({
|
|
242
245
|
rssBytes: memory.rss,
|
package/src/util/version.ts
CHANGED
|
@@ -8,9 +8,42 @@
|
|
|
8
8
|
* so it must exactly match the published tag (publish.yml verifies that).
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
+
import { execFileSync } from "node:child_process";
|
|
12
|
+
import { dirname, resolve } from "node:path";
|
|
13
|
+
import { fileURLToPath } from "node:url";
|
|
11
14
|
import pkg from "../../package.json" with { type: "json" };
|
|
12
15
|
|
|
13
16
|
/** Talon's semver (e.g. "3.3.0") — the release identity of this build. */
|
|
14
17
|
export function talonVersion(): string {
|
|
15
18
|
return pkg.version;
|
|
16
19
|
}
|
|
20
|
+
|
|
21
|
+
let commitCache: string | null | undefined;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Short git commit of the running checkout, or null for packaged builds
|
|
25
|
+
* (no .git) or when git isn't available. Read once and cached: the checkout
|
|
26
|
+
* can't change under a running daemon without a restart.
|
|
27
|
+
*/
|
|
28
|
+
export function talonCommit(): string | null {
|
|
29
|
+
if (commitCache !== undefined) return commitCache;
|
|
30
|
+
try {
|
|
31
|
+
const root = resolve(dirname(fileURLToPath(import.meta.url)), "../..");
|
|
32
|
+
const out = execFileSync("git", ["rev-parse", "--short=8", "HEAD"], {
|
|
33
|
+
cwd: root,
|
|
34
|
+
encoding: "utf8",
|
|
35
|
+
stdio: ["ignore", "pipe", "ignore"],
|
|
36
|
+
timeout: 2000,
|
|
37
|
+
}).trim();
|
|
38
|
+
commitCache = /^[0-9a-f]{7,40}$/.test(out) ? out : null;
|
|
39
|
+
} catch {
|
|
40
|
+
commitCache = null;
|
|
41
|
+
}
|
|
42
|
+
return commitCache;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** "v5.10.0" or "v5.10.0 (ab12cd34)" when running from a git checkout. */
|
|
46
|
+
export function talonVersionLabel(): string {
|
|
47
|
+
const commit = talonCommit();
|
|
48
|
+
return `v${talonVersion()}${commit ? ` (${commit})` : ""}`;
|
|
49
|
+
}
|