mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 07:40:44 +00:00
refactor: trim gateway helper state exports
This commit is contained in:
@@ -17,16 +17,16 @@ export type GetReplyFromConfigFn = (
|
||||
opts?: GetReplyOptions,
|
||||
configOverride?: OpenClawConfig,
|
||||
) => Promise<ReplyPayload | ReplyPayload[] | undefined>;
|
||||
export type CronIsolatedRunFn = (...args: unknown[]) => Promise<RunCronAgentTurnResult>;
|
||||
export type AgentCommandFn = (...args: unknown[]) => Promise<void>;
|
||||
export type SendWhatsAppFn = (...args: unknown[]) => Promise<{ messageId: string; toJid: string }>;
|
||||
type CronIsolatedRunFn = (...args: unknown[]) => Promise<RunCronAgentTurnResult>;
|
||||
type AgentCommandFn = (...args: unknown[]) => Promise<void>;
|
||||
type SendWhatsAppFn = (...args: unknown[]) => Promise<{ messageId: string; toJid: string }>;
|
||||
export type RunBtwSideQuestionFn = (...args: unknown[]) => Promise<unknown>;
|
||||
export type DispatchInboundMessageFn = (...args: unknown[]) => Promise<unknown>;
|
||||
export type CompactEmbeddedPiSessionFn = (...args: unknown[]) => Promise<unknown>;
|
||||
type DispatchInboundMessageFn = (...args: unknown[]) => Promise<unknown>;
|
||||
type CompactEmbeddedPiSessionFn = (...args: unknown[]) => Promise<unknown>;
|
||||
|
||||
const GATEWAY_TEST_CONFIG_ROOT_KEY = Symbol.for("openclaw.gatewayTestHelpers.configRoot");
|
||||
|
||||
export type GatewayTestHoistedState = {
|
||||
type GatewayTestHoistedState = {
|
||||
testTailnetIPv4: { value: string | undefined };
|
||||
piSdkMock: {
|
||||
enabled: boolean;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import fs from "node:fs/promises";
|
||||
import { type AddressInfo, createServer } from "node:net";
|
||||
import os from "node:os";
|
||||
import path from "node:path";
|
||||
import { afterAll, afterEach, beforeAll, beforeEach, expect, vi } from "vitest";
|
||||
@@ -492,20 +491,6 @@ export async function getFreePort(): Promise<number> {
|
||||
return await getDeterministicFreePortBlock({ offsets: [0, 1, 2, 3, 4] });
|
||||
}
|
||||
|
||||
export async function occupyPort(): Promise<{
|
||||
server: ReturnType<typeof createServer>;
|
||||
port: number;
|
||||
}> {
|
||||
return await new Promise((resolve, reject) => {
|
||||
const server = createServer();
|
||||
server.once("error", reject);
|
||||
server.listen(0, "127.0.0.1", () => {
|
||||
const port = (server.address() as AddressInfo).port;
|
||||
resolve({ server, port });
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
type GatewayTestMessage = {
|
||||
type?: string;
|
||||
id?: string;
|
||||
|
||||
Reference in New Issue
Block a user