mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 01:58:26 +00:00
refactor(agent): dedupe harness and command workflows
This commit is contained in:
@@ -10,29 +10,13 @@ import {
|
||||
resolveStorePath,
|
||||
type SessionEntry,
|
||||
} from "../config/sessions.js";
|
||||
import { listAgentsForGateway } from "../gateway/session-utils.js";
|
||||
import { classifySessionKey, listAgentsForGateway } from "../gateway/session-utils.js";
|
||||
import { buildChannelSummary } from "../infra/channel-summary.js";
|
||||
import { resolveHeartbeatSummaryForAgent } from "../infra/heartbeat-runner.js";
|
||||
import { peekSystemEvents } from "../infra/system-events.js";
|
||||
import { parseAgentSessionKey } from "../routing/session-key.js";
|
||||
import { resolveLinkChannelContext } from "./status.link-channel.js";
|
||||
|
||||
const classifyKey = (key: string, entry?: SessionEntry): SessionStatus["kind"] => {
|
||||
if (key === "global") {
|
||||
return "global";
|
||||
}
|
||||
if (key === "unknown") {
|
||||
return "unknown";
|
||||
}
|
||||
if (entry?.chatType === "group" || entry?.chatType === "channel") {
|
||||
return "group";
|
||||
}
|
||||
if (key.includes(":group:") || key.includes(":channel:")) {
|
||||
return "group";
|
||||
}
|
||||
return "direct";
|
||||
};
|
||||
|
||||
const buildFlags = (entry?: SessionEntry): string[] => {
|
||||
if (!entry) {
|
||||
return [];
|
||||
@@ -159,7 +143,7 @@ export async function getStatusSummary(
|
||||
return {
|
||||
agentId,
|
||||
key,
|
||||
kind: classifyKey(key, entry),
|
||||
kind: classifySessionKey(key, entry),
|
||||
sessionId: entry?.sessionId,
|
||||
updatedAt,
|
||||
age,
|
||||
|
||||
Reference in New Issue
Block a user