Skip to content

Commit c57fee8

Browse files
committed
chore(deadcode): remove stale preview helper APIs
1 parent 23b4f33 commit c57fee8

6 files changed

Lines changed: 12 additions & 61 deletions

File tree

extensions/slack/src/monitor/message-handler/dispatch.preview-fallback.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -842,7 +842,6 @@ vi.mock("../../stream-mode.js", () => ({
842842
rendered: incoming,
843843
source: incoming,
844844
}),
845-
buildStatusFinalPreviewText: () => "status",
846845
resolveSlackStreamingConfig: () => ({
847846
mode: mockedSlackStreamingMode,
848847
nativeStreaming: mockedNativeStreaming,

extensions/slack/src/stream-mode.test.ts

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,6 @@
11
// Slack tests cover stream mode plugin behavior.
22
import { describe, expect, it } from "vitest";
3-
import {
4-
applyAppendOnlyStreamUpdate,
5-
buildStatusFinalPreviewText,
6-
resolveSlackStreamingConfig,
7-
resolveSlackStreamMode,
8-
} from "./stream-mode.js";
9-
10-
describe("resolveSlackStreamMode", () => {
11-
it("defaults to replace", () => {
12-
expect(resolveSlackStreamMode(undefined)).toBe("replace");
13-
expect(resolveSlackStreamMode("")).toBe("replace");
14-
expect(resolveSlackStreamMode("unknown")).toBe("replace");
15-
});
16-
17-
it("accepts valid modes", () => {
18-
expect(resolveSlackStreamMode("replace")).toBe("replace");
19-
expect(resolveSlackStreamMode("status_final")).toBe("status_final");
20-
expect(resolveSlackStreamMode("append")).toBe("append");
21-
});
22-
});
3+
import { applyAppendOnlyStreamUpdate, resolveSlackStreamingConfig } from "./stream-mode.js";
234

245
describe("resolveSlackStreamingConfig", () => {
256
it("defaults to partial mode with native streaming enabled", () => {
@@ -119,11 +100,3 @@ describe("applyAppendOnlyStreamUpdate", () => {
119100
});
120101
});
121102
});
122-
123-
describe("buildStatusFinalPreviewText", () => {
124-
it("cycles status dots", () => {
125-
expect(buildStatusFinalPreviewText(1)).toBe("Status: thinking..");
126-
expect(buildStatusFinalPreviewText(2)).toBe("Status: thinking...");
127-
expect(buildStatusFinalPreviewText(3)).toBe("Status: thinking.");
128-
});
129-
});

extensions/slack/src/stream-mode.ts

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
// Slack plugin module implements stream mode behavior.
2-
import { normalizeLowercaseStringOrEmpty } from "openclaw/plugin-sdk/string-coerce-runtime";
32
import {
43
mapStreamingModeToSlackLegacyDraftStreamMode,
54
resolveSlackNativeStreaming,
@@ -8,26 +7,17 @@ import {
87
type StreamingMode,
98
} from "./streaming-compat.js";
109

11-
type SlackStreamMode = SlackLegacyDraftStreamMode;
1210
type SlackStreamingMode = StreamingMode;
13-
const DEFAULT_STREAM_MODE: SlackStreamMode = "replace";
14-
15-
export function resolveSlackStreamMode(raw: unknown): SlackStreamMode {
16-
if (typeof raw !== "string") {
17-
return DEFAULT_STREAM_MODE;
18-
}
19-
const normalized = normalizeLowercaseStringOrEmpty(raw);
20-
if (normalized === "replace" || normalized === "status_final" || normalized === "append") {
21-
return normalized;
22-
}
23-
return DEFAULT_STREAM_MODE;
24-
}
2511

2612
export function resolveSlackStreamingConfig(params: {
2713
streaming?: unknown;
2814
streamMode?: unknown;
2915
nativeStreaming?: unknown;
30-
}): { mode: SlackStreamingMode; nativeStreaming: boolean; draftMode: SlackStreamMode } {
16+
}): {
17+
mode: SlackStreamingMode;
18+
nativeStreaming: boolean;
19+
draftMode: SlackLegacyDraftStreamMode;
20+
} {
3121
const mode = resolveSlackStreamingMode(params);
3222
const nativeStreaming = resolveSlackNativeStreaming(params);
3323
return {
@@ -70,8 +60,3 @@ export function applyAppendOnlyStreamUpdate(params: {
7060
changed: true,
7161
};
7262
}
73-
74-
export function buildStatusFinalPreviewText(updateCount: number): string {
75-
const dots = ".".repeat((Math.max(1, updateCount) % 3) + 1);
76-
return `Status: thinking${dots}`;
77-
}

src/commands/doctor-config-flow.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1242,7 +1242,6 @@ vi.mock("./doctor/shared/preview-warnings.js", () => {
12421242
warningNotes: await collectWarnings(params),
12431243
};
12441244
}),
1245-
collectDoctorPreviewWarnings: vi.fn(collectWarnings),
12461245
};
12471246
});
12481247

src/commands/doctor/shared/preview-warnings.test.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,16 @@ import type { OpenClawConfig } from "../../../config/config.js";
77
import {
88
collectDoctorPreviewNotes,
99
collectChannelBoundMessageToolPolicyWarnings,
10-
collectDoctorPreviewWarnings,
1110
collectProfileConfiguredToolSectionWarnings,
1211
collectVisibleReplyToolPolicyWarnings,
1312
} from "./preview-warnings.js";
1413

14+
async function collectDoctorPreviewWarnings(
15+
params: Parameters<typeof collectDoctorPreviewNotes>[0],
16+
): Promise<string[]> {
17+
return (await collectDoctorPreviewNotes(params)).warningNotes;
18+
}
19+
1520
type TestManifestRecord = {
1621
id: string;
1722
channels: string[];

src/commands/doctor/shared/preview-warnings.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -983,13 +983,3 @@ export async function collectDoctorPreviewNotes(params: {
983983

984984
return { infoNotes, warningNotes: warnings };
985985
}
986-
987-
/** Collect warning notes only for callers that do not display info notes. */
988-
export async function collectDoctorPreviewWarnings(params: {
989-
cfg: OpenClawConfig;
990-
doctorFixCommand: string;
991-
env?: NodeJS.ProcessEnv;
992-
allowExec?: boolean;
993-
}): Promise<string[]> {
994-
return (await collectDoctorPreviewNotes(params)).warningNotes;
995-
}

0 commit comments

Comments
 (0)