fix: hide empty status rows
This commit is contained in:
@@ -184,9 +184,7 @@ export async function buildStatusReply(params: {
|
|||||||
const requesterKey = resolveInternalSessionKey({ key: sessionKey, alias, mainKey });
|
const requesterKey = resolveInternalSessionKey({ key: sessionKey, alias, mainKey });
|
||||||
const runs = listSubagentRunsForRequester(requesterKey);
|
const runs = listSubagentRunsForRequester(requesterKey);
|
||||||
const verboseEnabled = resolvedVerboseLevel && resolvedVerboseLevel !== "off";
|
const verboseEnabled = resolvedVerboseLevel && resolvedVerboseLevel !== "off";
|
||||||
if (runs.length === 0) {
|
if (runs.length > 0) {
|
||||||
if (verboseEnabled) subagentsLine = "🤖 Subagents: none";
|
|
||||||
} else {
|
|
||||||
const active = runs.filter((entry) => !entry.endedAt);
|
const active = runs.filter((entry) => !entry.endedAt);
|
||||||
const done = runs.length - active.length;
|
const done = runs.length - active.length;
|
||||||
if (verboseEnabled) {
|
if (verboseEnabled) {
|
||||||
|
|||||||
@@ -215,6 +215,20 @@ describe("handleCommands subagents", () => {
|
|||||||
expect(result.reply?.text).toContain("Subagents: none");
|
expect(result.reply?.text).toContain("Subagents: none");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("omits subagent status line when none exist", async () => {
|
||||||
|
resetSubagentRegistryForTests();
|
||||||
|
const cfg = {
|
||||||
|
commands: { text: true },
|
||||||
|
channels: { whatsapp: { allowFrom: ["*"] } },
|
||||||
|
session: { mainKey: "main", scope: "per-sender" },
|
||||||
|
} as ClawdbotConfig;
|
||||||
|
const params = buildParams("/status", cfg);
|
||||||
|
params.resolvedVerboseLevel = "on";
|
||||||
|
const result = await handleCommands(params);
|
||||||
|
expect(result.shouldContinue).toBe(false);
|
||||||
|
expect(result.reply?.text).not.toContain("Subagents:");
|
||||||
|
});
|
||||||
|
|
||||||
it("returns help for unknown subagents action", async () => {
|
it("returns help for unknown subagents action", async () => {
|
||||||
resetSubagentRegistryForTests();
|
resetSubagentRegistryForTests();
|
||||||
const cfg = {
|
const cfg = {
|
||||||
|
|||||||
@@ -143,6 +143,22 @@ describe("buildStatusMessage", () => {
|
|||||||
expect(normalized).toContain("Media: image ok (openai/gpt-5.2) · audio skipped (maxBytes)");
|
expect(normalized).toContain("Media: image ok (openai/gpt-5.2) · audio skipped (maxBytes)");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("omits media line when all decisions are none", () => {
|
||||||
|
const text = buildStatusMessage({
|
||||||
|
agent: { model: "anthropic/claude-opus-4-5" },
|
||||||
|
sessionEntry: { sessionId: "media-none", updatedAt: 0 },
|
||||||
|
sessionKey: "agent:main:main",
|
||||||
|
queue: { mode: "none" },
|
||||||
|
mediaDecisions: [
|
||||||
|
{ capability: "image", outcome: "no-attachment", attachments: [] },
|
||||||
|
{ capability: "audio", outcome: "no-attachment", attachments: [] },
|
||||||
|
{ capability: "video", outcome: "no-attachment", attachments: [] },
|
||||||
|
],
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(normalizeTestText(text)).not.toContain("Media:");
|
||||||
|
});
|
||||||
|
|
||||||
it("does not show elevated label when session explicitly disables it", () => {
|
it("does not show elevated label when session explicitly disables it", () => {
|
||||||
const text = buildStatusMessage({
|
const text = buildStatusMessage({
|
||||||
agent: { model: "anthropic/claude-opus-4-5", elevatedDefault: "on" },
|
agent: { model: "anthropic/claude-opus-4-5", elevatedDefault: "on" },
|
||||||
|
|||||||
@@ -203,6 +203,7 @@ const formatMediaUnderstandingLine = (decisions?: MediaUnderstandingDecision[])
|
|||||||
})
|
})
|
||||||
.filter(Boolean);
|
.filter(Boolean);
|
||||||
if (parts.length === 0) return null;
|
if (parts.length === 0) return null;
|
||||||
|
if (parts.every((part) => part.endsWith(" none"))) return null;
|
||||||
return `📎 Media: ${parts.join(" · ")}`;
|
return `📎 Media: ${parts.join(" · ")}`;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user