mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 16:38:27 +00:00
refactor(agent): dedupe harness and command workflows
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import type { SessionStatus } from "./status.types.js";
|
||||
import { formatDurationPrecise } from "../infra/format-time/format-duration.ts";
|
||||
import { formatRuntimeStatusWithDetails } from "../infra/runtime-status.ts";
|
||||
|
||||
export const formatKTokens = (value: number) =>
|
||||
`${(value / 1000).toFixed(value >= 10_000 ? 0 : 1)}k`;
|
||||
@@ -44,19 +45,17 @@ export const formatDaemonRuntimeShort = (runtime?: {
|
||||
if (!runtime) {
|
||||
return null;
|
||||
}
|
||||
const status = runtime.status ?? "unknown";
|
||||
const details: string[] = [];
|
||||
if (runtime.pid) {
|
||||
details.push(`pid ${runtime.pid}`);
|
||||
}
|
||||
if (runtime.state && runtime.state.toLowerCase() !== status) {
|
||||
details.push(`state ${runtime.state}`);
|
||||
}
|
||||
const detail = runtime.detail?.replace(/\s+/g, " ").trim() || "";
|
||||
const noisyLaunchctlDetail =
|
||||
runtime.missingUnit === true && detail.toLowerCase().includes("could not find service");
|
||||
if (detail && !noisyLaunchctlDetail) {
|
||||
details.push(detail);
|
||||
}
|
||||
return details.length > 0 ? `${status} (${details.join(", ")})` : status;
|
||||
return formatRuntimeStatusWithDetails({
|
||||
status: runtime.status,
|
||||
pid: runtime.pid,
|
||||
state: runtime.state,
|
||||
details,
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user