refactor(runtime): remove unused internal wrappers · openclaw/openclaw@4e2351d
vincentkoc
·
2026-06-17
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -673,17 +673,6 @@ export function formatProbeLatency(latencyMs?: number | null) {
|
673 | 673 | return formatMs(latencyMs); |
674 | 674 | } |
675 | 675 | |
676 | | -/** Groups probe results by provider. */ |
677 | | -export function groupProbeResults(results: AuthProbeResult[]): Map<string, AuthProbeResult[]> { |
678 | | -const map = new Map<string, AuthProbeResult[]>(); |
679 | | -for (const result of results) { |
680 | | -const list = map.get(result.provider) ?? []; |
681 | | -list.push(result); |
682 | | -map.set(result.provider, list); |
683 | | -} |
684 | | -return map; |
685 | | -} |
686 | | - |
687 | 676 | /** Sorts probe results by provider and display label. */ |
688 | 677 | export function sortProbeResults(results: AuthProbeResult[]): AuthProbeResult[] { |
689 | 678 | return results.slice().toSorted((a, b) => { |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -5,7 +5,6 @@ import {
|
5 | 5 | buildModelAliasIndex, |
6 | 6 | legacyModelKey, |
7 | 7 | modelKey, |
8 | | -parseModelRef, |
9 | 8 | resolveModelRefFromString, |
10 | 9 | } from "../../agents/model-selection.js"; |
11 | 10 | import { formatCliCommand } from "../../cli/command-format.js"; |
@@ -147,20 +146,6 @@ export function resolveModelKeysFromEntries(params: {
|
147 | 146 | .map((entry) => modelKey(entry.ref.provider, entry.ref.model)); |
148 | 147 | } |
149 | 148 | |
150 | | -/** Builds the configured model allowlist from agents.defaults.models keys. */ |
151 | | -export function buildAllowlistSet(cfg: OpenClawConfig): Set<string> { |
152 | | -const allowed = new Set<string>(); |
153 | | -const models = cfg.agents?.defaults?.models ?? {}; |
154 | | -for (const raw of Object.keys(models)) { |
155 | | -const parsed = parseModelRef(raw, DEFAULT_PROVIDER); |
156 | | -if (!parsed) { |
157 | | -continue; |
158 | | -} |
159 | | -allowed.add(modelKey(parsed.provider, parsed.model)); |
160 | | -} |
161 | | -return allowed; |
162 | | -} |
163 | | - |
164 | 149 | /** Validates an optional agent id against configured agents. */ |
165 | 150 | export function resolveKnownAgentId(params: { |
166 | 151 | cfg: OpenClawConfig; |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -6,7 +6,6 @@ import fs from "node:fs/promises";
|
6 | 6 | import path from "node:path"; |
7 | 7 | import { type FileLockOptions, withFileLock } from "../plugin-sdk/file-lock.js"; |
8 | 8 | import { |
9 | | -clearStoreWriterQueuesForTest, |
10 | 9 | runQueuedStoreWrite, |
11 | 10 | type StoreWriterQueue, |
12 | 11 | } from "../shared/store-writer-queue.js"; |
@@ -45,7 +44,3 @@ export async function runExclusiveCommitmentsStoreWrite<T>(
|
45 | 44 | }, |
46 | 45 | }); |
47 | 46 | } |
48 | | - |
49 | | -export function clearCommitmentsStoreWriterQueuesForTest(): void { |
50 | | -clearStoreWriterQueuesForTest(WRITER_QUEUES, "commitments store writer queue cleared for test"); |
51 | | -} |
| Original file line number | Diff line number | Diff line change |
|---|
|
1 | 1 | /** Shared Vitest module mocks for isolated-agent cron tests. */ |
2 | 2 | import { vi } from "vitest"; |
3 | | -import { |
4 | | -makeIsolatedAgentJobFixture, |
5 | | -makeIsolatedAgentParamsFixture, |
6 | | -} from "./isolated-agent/job-fixtures.js"; |
7 | 3 | |
8 | 4 | vi.mock("../agents/embedded-agent.js", () => ({ |
9 | 5 | abortEmbeddedAgentRun: vi.fn().mockReturnValue(false), |
@@ -36,6 +32,3 @@ vi.mock("../plugins/runtime-plugins.runtime.js", () => ({
|
36 | 32 | vi.mock("../gateway/call.js", () => ({ |
37 | 33 | callGateway: vi.fn(), |
38 | 34 | })); |
39 | | - |
40 | | -export const makeIsolatedAgentJob = makeIsolatedAgentJobFixture; |
41 | | -export const makeIsolatedAgentParams = makeIsolatedAgentParamsFixture; |
| Original file line number | Diff line number | Diff line change |
|---|
@@ -127,17 +127,6 @@ function stripRuntimeModelState(entry?: SessionEntry): SessionEntry | undefined
|
127 | 127 | }; |
128 | 128 | } |
129 | 129 | |
130 | | -export function archiveSessionTranscriptsForSession(params: { |
131 | | -sessionId: string | undefined; |
132 | | -storePath: string; |
133 | | -sessionFile?: string; |
134 | | -agentId?: string; |
135 | | -reason: "reset" | "deleted"; |
136 | | -onArchiveError?: (err: unknown, sourcePath: string) => void; |
137 | | -}): string[] { |
138 | | -return archiveSessionTranscriptsForSessionDetailed(params).map((entry) => entry.archivedPath); |
139 | | -} |
140 | | - |
141 | 130 | export function archiveSessionTranscriptsForSessionDetailed(params: { |
142 | 131 | sessionId: string | undefined; |
143 | 132 | storePath: string; |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -54,8 +54,3 @@ export function requireUnifiedTalkSessionConn(
|
54 | 54 | } |
55 | 55 | return connId; |
56 | 56 | } |
57 | | - |
58 | | -/** Clears process-local Talk session mappings between tests. */ |
59 | | -export function clearUnifiedTalkSessionsForTest(): void { |
60 | | -unifiedTalkSessions.clear(); |
61 | | -} |
| Original file line number | Diff line number | Diff line change |
|---|
@@ -36,31 +36,6 @@ export function saveJsonFile(pathname: string, data: unknown): void {
|
36 | 36 | writeJsonSync(resolveJsonSaveTarget(pathname), data); |
37 | 37 | } |
38 | 38 | |
39 | | -export function repairJsonFilePermissions(pathname: string): void { |
40 | | -const target = resolveJsonSaveTarget(pathname); |
41 | | -let fd: number | undefined; |
42 | | -try { |
43 | | -fd = fs.openSync( |
44 | | -target, |
45 | | -fs.constants.O_RDONLY | |
46 | | -(process.platform !== "win32" && "O_NOFOLLOW" in fs.constants |
47 | | - ? fs.constants.O_NOFOLLOW |
48 | | - : 0), |
49 | | -); |
50 | | -fs.fchmodSync(fd, 0o600); |
51 | | -} catch { |
52 | | -// Matches fs-safe JSON writes: permission repair is best-effort. |
53 | | -} finally { |
54 | | -if (fd !== undefined) { |
55 | | -try { |
56 | | -fs.closeSync(fd); |
57 | | -} catch { |
58 | | -// best-effort cleanup |
59 | | -} |
60 | | -} |
61 | | -} |
62 | | -} |
63 | | - |
64 | 39 | // oxlint-disable-next-line typescript-eslint/no-unnecessary-type-parameters -- legacy typed JSON loader alias. |
65 | 40 | export function loadJsonFile<T = unknown>(pathname: string): T | undefined { |
66 | 41 | const direct = tryReadJsonSync<T>(pathname); |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -30,8 +30,3 @@ export function resolveOpenClawAgentSqlitePath(options: OpenClawAgentSqlitePathO
|
30 | 30 | ), |
31 | 31 | ); |
32 | 32 | } |
33 | | - |
34 | | -/** Resolve the containing directory for one agent's SQLite database. */ |
35 | | -export function resolveOpenClawAgentSqliteDir(options: OpenClawAgentSqlitePathOptions): string { |
36 | | -return path.dirname(resolveOpenClawAgentSqlitePath(options)); |
37 | | -} |
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。