refactor(extensions): drop unused approval and tunnel helpers

This commit is contained in:
Vincent Koc
2026-06-19 11:59:00 +08:00
parent 845ad1cf71
commit fb69db6365
3 changed files with 1 additions and 44 deletions

View File

@@ -1,6 +1,5 @@
import {
createApproverRestrictedNativeApprovalCapability,
splitChannelApprovalCapability,
} from "openclaw/plugin-sdk/approval-delivery-runtime";
import { createLazyChannelApprovalNativeRuntimeAdapter } from "openclaw/plugin-sdk/approval-handler-adapter-runtime";
import type { ChannelApprovalNativeRuntimeAdapter } from "openclaw/plugin-sdk/approval-handler-runtime";
@@ -240,7 +239,3 @@ export const googleChatApprovalCapability: ChannelApprovalCapability =
.googleChatApprovalNativeRuntime as unknown as ChannelApprovalNativeRuntimeAdapter,
}),
});
export const googleChatNativeApprovalAdapter = splitChannelApprovalCapability(
googleChatApprovalCapability,
);

View File

@@ -35,7 +35,7 @@ vi.mock("./webhook/tailscale.js", () => ({
getTailscaleDnsName: mocks.getTailscaleDnsName,
}));
import { isNgrokAvailable, startNgrokTunnel, startTailscaleTunnel, startTunnel } from "./tunnel.js";
import { startNgrokTunnel, startTailscaleTunnel, startTunnel } from "./tunnel.js";
function nextProcess(): FakeChildProcess {
const proc = new FakeChildProcess();
@@ -53,25 +53,6 @@ describe("voice-call tunnels", () => {
mocks.getTailscaleDnsName.mockReset();
});
it("checks ngrok availability from the version command exit code", async () => {
const proc = nextProcess();
const result = isNgrokAvailable();
proc.close(0);
await expect(result).resolves.toBe(true);
expect(mocks.spawn).toHaveBeenCalledWith("ngrok", ["version"], {
stdio: "ignore",
});
});
it("treats ngrok spawn failures as unavailable", async () => {
const proc = nextProcess();
const result = isNgrokAvailable();
proc.fail(new Error("spawn ngrok ENOENT"));
await expect(result).resolves.toBe(false);
});
it("starts ngrok and appends the webhook path to the public URL", async () => {
const proc = nextProcess();
const result = startNgrokTunnel({ port: 3334, path: "/voice/webhook" });

View File

@@ -201,25 +201,6 @@ async function runNgrokCommand(args: string[]): Promise<string> {
});
}
/**
* Check if ngrok is installed and available.
*/
export async function isNgrokAvailable(): Promise<boolean> {
return new Promise((resolve) => {
const proc = spawn("ngrok", ["version"], {
stdio: "ignore",
});
proc.on("close", (code) => {
resolve(code === 0);
});
proc.on("error", () => {
resolve(false);
});
});
}
/**
* Start a Tailscale serve/funnel tunnel.
*/