mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-06 18:12:13 +00:00
refactor(extensions): remove unused helper exports
This commit is contained in:
@@ -4,7 +4,6 @@ import "./test-runtime-mocks.js";
|
||||
|
||||
// Avoid exporting vitest mock types (TS2742 under pnpm + d.ts emit).
|
||||
type EmbedBatchMock = Mock<(texts: string[]) => Promise<number[][]>>;
|
||||
type EmbedQueryMock = Mock<() => Promise<number[]>>;
|
||||
|
||||
const hoisted = vi.hoisted(() => ({
|
||||
embedBatch: vi.fn(async (texts: string[]) => texts.map(() => [0, 1, 0])),
|
||||
@@ -15,10 +14,6 @@ export function getEmbedBatchMock(): EmbedBatchMock {
|
||||
return hoisted.embedBatch;
|
||||
}
|
||||
|
||||
export function getEmbedQueryMock(): EmbedQueryMock {
|
||||
return hoisted.embedQuery;
|
||||
}
|
||||
|
||||
export function resetEmbeddingMocks(): void {
|
||||
hoisted.embedBatch.mockReset();
|
||||
hoisted.embedQuery.mockReset();
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
// Memory Core plugin module implements manager sync control behavior.
|
||||
import type { DatabaseSync } from "node:sqlite";
|
||||
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
||||
import {
|
||||
createSubsystemLogger,
|
||||
type OpenClawConfig,
|
||||
} from "openclaw/plugin-sdk/memory-core-host-engine-foundation";
|
||||
import { createSubsystemLogger } from "openclaw/plugin-sdk/memory-core-host-engine-foundation";
|
||||
import type { MemorySyncProgressUpdate } from "openclaw/plugin-sdk/memory-core-host-engine-storage";
|
||||
|
||||
const log = createSubsystemLogger("memory");
|
||||
@@ -166,25 +163,3 @@ export function enqueueMemoryTargetedSessionSync(
|
||||
}
|
||||
return state.getQueuedSessionSync() ?? Promise.resolve();
|
||||
}
|
||||
|
||||
export function createMemorySyncControlConfigForTests(
|
||||
workspaceDir: string,
|
||||
indexPath: string,
|
||||
): OpenClawConfig {
|
||||
return {
|
||||
agents: {
|
||||
defaults: {
|
||||
workspace: workspaceDir,
|
||||
memorySearch: {
|
||||
provider: "openai",
|
||||
model: "mock-embed",
|
||||
store: { path: indexPath, vector: { enabled: false } },
|
||||
cache: { enabled: false },
|
||||
query: { minScore: 0, hybrid: { enabled: false } },
|
||||
sync: { watch: false, onSessionStart: false, onSearch: false },
|
||||
},
|
||||
},
|
||||
list: [{ id: "main", default: true }],
|
||||
},
|
||||
} as OpenClawConfig;
|
||||
}
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
// Msteams plugin module implements bot framework service url behavior.
|
||||
import {
|
||||
buildHostnameAllowlistPolicyFromSuffixAllowlist,
|
||||
isHttpsUrlAllowedByHostnameSuffixAllowlist,
|
||||
normalizeHostnameSuffixAllowlist,
|
||||
type SsrFPolicy,
|
||||
} from "openclaw/plugin-sdk/ssrf-policy";
|
||||
|
||||
const DEFAULT_BOT_FRAMEWORK_SERVICE_URL_HOST_ALLOWLIST = [
|
||||
@@ -22,16 +20,6 @@ export const BOT_FRAMEWORK_SERVICE_URL_HOST_ALLOWLIST = normalizeHostnameSuffixA
|
||||
DEFAULT_BOT_FRAMEWORK_SERVICE_URL_HOST_ALLOWLIST,
|
||||
);
|
||||
|
||||
const serviceUrlSsrfPolicy = buildHostnameAllowlistPolicyFromSuffixAllowlist(
|
||||
BOT_FRAMEWORK_SERVICE_URL_HOST_ALLOWLIST,
|
||||
);
|
||||
|
||||
if (!serviceUrlSsrfPolicy) {
|
||||
throw new Error("Microsoft Teams Bot Framework serviceUrl allowlist is empty");
|
||||
}
|
||||
|
||||
export const BOT_FRAMEWORK_SERVICE_URL_SSRF_POLICY: SsrFPolicy = serviceUrlSsrfPolicy;
|
||||
|
||||
export function describeBotFrameworkServiceUrlHost(serviceUrl: string): string {
|
||||
try {
|
||||
const parsed = new URL(serviceUrl.trim());
|
||||
|
||||
@@ -132,18 +132,6 @@ function getOpenClawMediaDir(): string {
|
||||
return path.join(resolveOpenClawHome(), ".openclaw", "media");
|
||||
}
|
||||
|
||||
// ---- Basic platform information ----
|
||||
|
||||
type PlatformType = "darwin" | "linux" | "win32" | "other";
|
||||
|
||||
export function getPlatform(): PlatformType {
|
||||
const p = process.platform;
|
||||
if (p === "darwin" || p === "linux" || p === "win32") {
|
||||
return p;
|
||||
}
|
||||
return "other";
|
||||
}
|
||||
|
||||
export function isWindows(): boolean {
|
||||
return process.platform === "win32";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user