refactor(agent): dedupe harness and command workflows

This commit is contained in:
Peter Steinberger
2026-02-16 14:52:09 +00:00
parent 04892ee230
commit f717a13039
204 changed files with 7366 additions and 11540 deletions

View File

@@ -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,
});
};