mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 05:50:43 +00:00
chore: remove unused internal entrypoints
This commit is contained in:
@@ -1,17 +0,0 @@
|
||||
export {
|
||||
abortEmbeddedAgentRun,
|
||||
compactEmbeddedAgentSession,
|
||||
isEmbeddedAgentRunActive,
|
||||
isEmbeddedAgentRunStreaming,
|
||||
queueEmbeddedAgentMessage,
|
||||
resolveActiveEmbeddedAgentRunSessionId,
|
||||
resolveEmbeddedSessionLane,
|
||||
runEmbeddedAgent,
|
||||
waitForEmbeddedAgentRunEnd,
|
||||
} from "./pi-embedded-runner.js";
|
||||
export type {
|
||||
EmbeddedAgentCompactResult,
|
||||
EmbeddedAgentMeta,
|
||||
EmbeddedAgentRunMeta,
|
||||
EmbeddedAgentRunResult,
|
||||
} from "./pi-embedded-runner.js";
|
||||
@@ -1,5 +1,4 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { runEmbeddedAgent as runEmbeddedAgentFromNeutralBarrel } from "../embedded-runner.js";
|
||||
import {
|
||||
abortEmbeddedAgentRun,
|
||||
abortEmbeddedPiRun,
|
||||
@@ -12,7 +11,6 @@ import {
|
||||
describe("embedded runner compatibility aliases", () => {
|
||||
it("keeps neutral embedded-agent aliases bound to the PI compatibility exports", () => {
|
||||
expect(runEmbeddedAgent).toBe(runEmbeddedPiAgent);
|
||||
expect(runEmbeddedAgentFromNeutralBarrel).toBe(runEmbeddedPiAgent);
|
||||
expect(compactEmbeddedAgentSession).toBe(compactEmbeddedPiSession);
|
||||
expect(abortEmbeddedAgentRun).toBe(abortEmbeddedPiRun);
|
||||
});
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
// Barrel exports for the web channel pieces. Splitting the original 900+ line
|
||||
// module keeps responsibilities small and testable.
|
||||
import { resolveWebChannelAuthDir } from "./plugins/runtime/runtime-web-channel-plugin.js";
|
||||
|
||||
export { HEARTBEAT_PROMPT } from "./auto-reply/heartbeat.js";
|
||||
export { HEARTBEAT_TOKEN } from "./auto-reply/tokens.js";
|
||||
export { loadWebMedia, optimizeImageToJpeg } from "./media/web-media.js";
|
||||
export {
|
||||
createWebChannelSocket as createWaSocket,
|
||||
extractMediaPlaceholder,
|
||||
extractText,
|
||||
formatError,
|
||||
getStatusCode,
|
||||
logWebSelfId,
|
||||
loginWeb,
|
||||
logoutWeb,
|
||||
monitorWebChannel,
|
||||
monitorWebInbox,
|
||||
pickWebChannel,
|
||||
resolveHeartbeatRecipients,
|
||||
runWebHeartbeatOnce,
|
||||
sendWebChannelMessage as sendMessageWhatsApp,
|
||||
sendWebChannelReaction as sendReactionWhatsApp,
|
||||
waitForWebChannelConnection as waitForWaConnection,
|
||||
webAuthExists,
|
||||
} from "./plugins/runtime/runtime-web-channel-plugin.js";
|
||||
|
||||
// Keep the historic constant surface available, but resolve it through the
|
||||
// web-channel plugin boundary only when a caller actually coerces the value to string.
|
||||
class LazyWebChannelAuthDir {
|
||||
#value: string | null = null;
|
||||
|
||||
#read(): string {
|
||||
this.#value ??= resolveWebChannelAuthDir();
|
||||
return this.#value;
|
||||
}
|
||||
|
||||
toString(): string {
|
||||
return this.#read();
|
||||
}
|
||||
|
||||
valueOf(): string {
|
||||
return this.#read();
|
||||
}
|
||||
|
||||
[Symbol.toPrimitive](): string {
|
||||
return this.#read();
|
||||
}
|
||||
}
|
||||
|
||||
export const WA_WEB_AUTH_DIR = new LazyWebChannelAuthDir() as unknown as string;
|
||||
@@ -1,8 +1,6 @@
|
||||
import { afterEach, describe, expect, it, vi } from "vitest";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { normalizeChatType } from "./chat-type.js";
|
||||
|
||||
const readLazyString = (value: unknown): string => String(value);
|
||||
|
||||
describe("normalizeChatType", () => {
|
||||
it.each([
|
||||
{ name: "normalizes direct", value: "direct", expected: "direct" },
|
||||
@@ -28,43 +26,3 @@ describe("normalizeChatType", () => {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("WA_WEB_AUTH_DIR", () => {
|
||||
afterEach(() => {
|
||||
vi.doUnmock("../plugins/runtime/runtime-web-channel-plugin.js");
|
||||
});
|
||||
|
||||
it("resolves lazily and caches across the legacy and channels/web entrypoints", async () => {
|
||||
const resolveWebChannelAuthDir = vi.fn(() => "/tmp/openclaw-whatsapp-auth");
|
||||
|
||||
vi.resetModules();
|
||||
vi.doMock("../plugins/runtime/runtime-web-channel-plugin.js", () => ({
|
||||
createWebChannelSocket: vi.fn(),
|
||||
extractMediaPlaceholder: vi.fn(),
|
||||
extractText: vi.fn(),
|
||||
formatError: vi.fn(),
|
||||
getStatusCode: vi.fn(),
|
||||
logWebSelfId: vi.fn(),
|
||||
loginWeb: vi.fn(),
|
||||
logoutWeb: vi.fn(),
|
||||
monitorWebChannel: vi.fn(),
|
||||
monitorWebInbox: vi.fn(),
|
||||
pickWebChannel: vi.fn(),
|
||||
resolveHeartbeatRecipients: vi.fn(),
|
||||
resolveWebChannelAuthDir,
|
||||
runWebHeartbeatOnce: vi.fn(),
|
||||
sendWebChannelMessage: vi.fn(),
|
||||
sendWebChannelReaction: vi.fn(),
|
||||
waitForWebChannelConnection: vi.fn(),
|
||||
webAuthExists: vi.fn(),
|
||||
}));
|
||||
|
||||
const channelWeb = await import("../channel-web.js");
|
||||
const webEntry = await import("./web/index.js");
|
||||
|
||||
expect(resolveWebChannelAuthDir).not.toHaveBeenCalled();
|
||||
expect(readLazyString(channelWeb.WA_WEB_AUTH_DIR)).toBe("/tmp/openclaw-whatsapp-auth");
|
||||
expect(readLazyString(webEntry.WA_WEB_AUTH_DIR)).toBe("/tmp/openclaw-whatsapp-auth");
|
||||
expect(resolveWebChannelAuthDir).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
/* istanbul ignore file */
|
||||
export {
|
||||
createWaSocket,
|
||||
loginWeb,
|
||||
logWebSelfId,
|
||||
monitorWebChannel,
|
||||
monitorWebInbox,
|
||||
pickWebChannel,
|
||||
sendMessageWhatsApp,
|
||||
WA_WEB_AUTH_DIR,
|
||||
waitForWaConnection,
|
||||
webAuthExists,
|
||||
} from "../../channel-web.js";
|
||||
@@ -438,10 +438,6 @@ vi.mock("node:fs/promises", () => ({
|
||||
},
|
||||
}));
|
||||
|
||||
vi.mock("../channel-web.js", () => ({
|
||||
loginWeb: vi.fn(async () => {}),
|
||||
}));
|
||||
|
||||
vi.mock("../channels/plugins/catalog.js", async () => {
|
||||
const actual = await vi.importActual<typeof import("../channels/plugins/catalog.js")>(
|
||||
"../channels/plugins/catalog.js",
|
||||
|
||||
@@ -260,16 +260,6 @@ vi.mock("../commands/health.js", () => ({
|
||||
vi.mock("../commands/status.js", () => ({
|
||||
getStatusSummary: vi.fn().mockResolvedValue({ ok: true }),
|
||||
}));
|
||||
vi.mock("../channels/web/index.js", async () => {
|
||||
const actual = await vi.importActual<typeof import("../channels/web/index.js")>(
|
||||
"../channels/web/index.js",
|
||||
);
|
||||
return {
|
||||
...actual,
|
||||
sendMessageWhatsApp: (...args: unknown[]) =>
|
||||
(gatewayTestHoisted.sendWhatsAppMock as (...args: unknown[]) => unknown)(...args),
|
||||
};
|
||||
});
|
||||
vi.mock("../commands/agent.js", () => ({
|
||||
agentCommand,
|
||||
agentCommandFromIngress: agentCommand,
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
/**
|
||||
* Network proxy module — public API surface.
|
||||
*
|
||||
* This module routes OpenClaw process HTTP and WebSocket traffic through an
|
||||
* operator-managed filtering forward proxy. The proxy must enforce
|
||||
* destination filtering at connect time; OpenClaw only owns process-wide
|
||||
* routing into that proxy.
|
||||
*
|
||||
* Integration:
|
||||
* 1. Call startProxy(config?.proxy) early in protected daemon/CLI startup.
|
||||
* 2. Subsequent normal HTTP and WebSocket egress routes through the
|
||||
* configured operator proxy.
|
||||
* 3. On shutdown, call stopProxy(handle).
|
||||
*
|
||||
* Fail-closed behavior:
|
||||
* If proxy.enabled=true but no valid proxy URL is configured, or activation
|
||||
* fails, protected commands must fail startup instead of falling back to
|
||||
* direct network access.
|
||||
*/
|
||||
|
||||
export { startProxy, stopProxy } from "./proxy-lifecycle.js";
|
||||
export type { ProxyHandle } from "./proxy-lifecycle.js";
|
||||
|
||||
export { ProxyConfigSchema } from "../../../config/zod-schema.proxy.js";
|
||||
export type { ProxyConfig } from "../../../config/zod-schema.proxy.js";
|
||||
@@ -317,7 +317,6 @@ export const sharedVitestConfig = {
|
||||
"src/entry.ts",
|
||||
"src/index.ts",
|
||||
"src/runtime.ts",
|
||||
"src/channel-web.ts",
|
||||
"src/logging.ts",
|
||||
"src/cli/**",
|
||||
"src/commands/**",
|
||||
@@ -363,7 +362,6 @@ export const sharedVitestConfig = {
|
||||
"src/tui/**",
|
||||
"src/wizard/**",
|
||||
"src/browser/**",
|
||||
"src/channels/web/**",
|
||||
"src/webchat/**",
|
||||
"src/gateway/server.ts",
|
||||
"src/gateway/client.ts",
|
||||
|
||||
Reference in New Issue
Block a user