mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-06 18:12:13 +00:00
refactor(extensions): drop unused approval and tunnel helpers
This commit is contained in:
@@ -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,
|
||||
);
|
||||
|
||||
@@ -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" });
|
||||
|
||||
@@ -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.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user