Skip to content

Commit 4e2351d

Browse files
committed
refactor(runtime): remove unused internal wrappers
1 parent 8b8b134 commit 4e2351d

8 files changed

Lines changed: 0 additions & 84 deletions

File tree

src/commands/models/list.probe.ts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -673,17 +673,6 @@ export function formatProbeLatency(latencyMs?: number | null) {
673673
return formatMs(latencyMs);
674674
}
675675

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-
687676
/** Sorts probe results by provider and display label. */
688677
export function sortProbeResults(results: AuthProbeResult[]): AuthProbeResult[] {
689678
return results.slice().toSorted((a, b) => {

src/commands/models/shared.ts

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import {
55
buildModelAliasIndex,
66
legacyModelKey,
77
modelKey,
8-
parseModelRef,
98
resolveModelRefFromString,
109
} from "../../agents/model-selection.js";
1110
import { formatCliCommand } from "../../cli/command-format.js";
@@ -147,20 +146,6 @@ export function resolveModelKeysFromEntries(params: {
147146
.map((entry) => modelKey(entry.ref.provider, entry.ref.model));
148147
}
149148

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-
164149
/** Validates an optional agent id against configured agents. */
165150
export function resolveKnownAgentId(params: {
166151
cfg: OpenClawConfig;

src/commitments/store-writer.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import fs from "node:fs/promises";
66
import path from "node:path";
77
import { type FileLockOptions, withFileLock } from "../plugin-sdk/file-lock.js";
88
import {
9-
clearStoreWriterQueuesForTest,
109
runQueuedStoreWrite,
1110
type StoreWriterQueue,
1211
} from "../shared/store-writer-queue.js";
@@ -45,7 +44,3 @@ export async function runExclusiveCommitmentsStoreWrite<T>(
4544
},
4645
});
4746
}
48-
49-
export function clearCommitmentsStoreWriterQueuesForTest(): void {
50-
clearStoreWriterQueuesForTest(WRITER_QUEUES, "commitments store writer queue cleared for test");
51-
}

src/cron/isolated-agent.mocks.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
/** Shared Vitest module mocks for isolated-agent cron tests. */
22
import { vi } from "vitest";
3-
import {
4-
makeIsolatedAgentJobFixture,
5-
makeIsolatedAgentParamsFixture,
6-
} from "./isolated-agent/job-fixtures.js";
73

84
vi.mock("../agents/embedded-agent.js", () => ({
95
abortEmbeddedAgentRun: vi.fn().mockReturnValue(false),
@@ -36,6 +32,3 @@ vi.mock("../plugins/runtime-plugins.runtime.js", () => ({
3632
vi.mock("../gateway/call.js", () => ({
3733
callGateway: vi.fn(),
3834
}));
39-
40-
export const makeIsolatedAgentJob = makeIsolatedAgentJobFixture;
41-
export const makeIsolatedAgentParams = makeIsolatedAgentParamsFixture;

src/gateway/session-reset-service.ts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -127,17 +127,6 @@ function stripRuntimeModelState(entry?: SessionEntry): SessionEntry | undefined
127127
};
128128
}
129129

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-
141130
export function archiveSessionTranscriptsForSessionDetailed(params: {
142131
sessionId: string | undefined;
143132
storePath: string;

src/gateway/talk-session-registry.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,3 @@ export function requireUnifiedTalkSessionConn(
5454
}
5555
return connId;
5656
}
57-
58-
/** Clears process-local Talk session mappings between tests. */
59-
export function clearUnifiedTalkSessionsForTest(): void {
60-
unifiedTalkSessions.clear();
61-
}

src/infra/json-file.ts

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -36,31 +36,6 @@ export function saveJsonFile(pathname: string, data: unknown): void {
3636
writeJsonSync(resolveJsonSaveTarget(pathname), data);
3737
}
3838

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-
6439
// oxlint-disable-next-line typescript-eslint/no-unnecessary-type-parameters -- legacy typed JSON loader alias.
6540
export function loadJsonFile<T = unknown>(pathname: string): T | undefined {
6641
const direct = tryReadJsonSync<T>(pathname);

src/state/openclaw-agent-db.paths.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,3 @@ export function resolveOpenClawAgentSqlitePath(options: OpenClawAgentSqlitePathO
3030
),
3131
);
3232
}
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-
}

0 commit comments

Comments
 (0)