chore: remove stale dead code

This commit is contained in:
Peter Steinberger
2026-05-31 03:04:04 -04:00
parent ce547bfd44
commit 444562b3de
14 changed files with 6 additions and 237 deletions

View File

@@ -1,65 +0,0 @@
declare module "acpx/runtime" {
export const ACPX_BACKEND_ID: string;
export type AcpRuntimeDoctorReport = import("../runtime-api.js").AcpRuntimeDoctorReport;
export type AcpRuntimeEnsureInput = import("../runtime-api.js").AcpRuntimeEnsureInput;
export type AcpRuntimeEvent = import("../runtime-api.js").AcpRuntimeEvent;
export type AcpRuntimeHandle = import("../runtime-api.js").AcpRuntimeHandle;
export type AcpRuntimeCapabilities = import("../runtime-api.js").AcpRuntimeCapabilities;
export type AcpRuntimeStatus = import("../runtime-api.js").AcpRuntimeStatus;
export type AcpRuntimeTurn = import("../runtime-api.js").AcpRuntimeTurn;
export type AcpRuntimeTurnInput = import("../runtime-api.js").AcpRuntimeTurnInput;
export type AcpRuntimeTurnResult = import("../runtime-api.js").AcpRuntimeTurnResult;
export type AcpAgentRegistry = {
resolve(agent: string): string | undefined;
list(): string[];
};
export type AcpSessionRecord = Record<string, unknown>;
export type AcpSessionStore = {
load(sessionId: string): Promise<AcpSessionRecord | undefined>;
save(record: AcpSessionRecord): Promise<void>;
};
export type AcpRuntimeOptions = {
cwd: string;
sessionStore: AcpSessionStore;
agentRegistry: AcpAgentRegistry;
probeAgent?: string;
mcpServers?: unknown;
permissionMode?: unknown;
nonInteractivePermissions?: unknown;
timeoutMs?: number;
probeAgent?: string;
};
export class AcpxRuntime {
constructor(options: AcpRuntimeOptions, testOptions?: unknown);
isHealthy(): boolean;
probeAvailability(): Promise<void>;
doctor(): Promise<AcpRuntimeDoctorReport>;
ensureSession(input: AcpRuntimeEnsureInput): Promise<AcpRuntimeHandle>;
startTurn(input: AcpRuntimeTurnInput): AcpRuntimeTurn;
runTurn(input: AcpRuntimeTurnInput): AsyncIterable<AcpRuntimeEvent>;
getCapabilities(input?: {
handle?: AcpRuntimeHandle;
}): AcpRuntimeCapabilities | Promise<AcpRuntimeCapabilities>;
getStatus(input: { handle: AcpRuntimeHandle; signal?: AbortSignal }): Promise<AcpRuntimeStatus>;
setMode(input: { handle: AcpRuntimeHandle; mode: string }): Promise<void>;
setConfigOption(input: { handle: AcpRuntimeHandle; key: string; value: string }): Promise<void>;
cancel(input: { handle: AcpRuntimeHandle; reason?: string }): Promise<void>;
close(input: {
handle: AcpRuntimeHandle;
reason?: string;
discardPersistentState?: boolean;
}): Promise<void>;
}
export function createAcpRuntime(...args: unknown[]): AcpxRuntime;
export function createAgentRegistry(params: { overrides?: unknown }): AcpAgentRegistry;
export function createFileSessionStore(params: { stateDir: string }): AcpSessionStore;
export function decodeAcpxRuntimeHandleState(...args: unknown[]): unknown;
export function encodeAcpxRuntimeHandleState(...args: unknown[]): unknown;
}

View File

@@ -549,16 +549,15 @@ function appendCodexAcpConfigOverrides(command: string, override: CodexAcpModelO
function createModelScopedAgentRegistry(params: {
agentRegistry: AcpAgentRegistry;
scope: AsyncLocalStorage<CodexAcpModelOverride | undefined>;
leaseCommand: (command: string | undefined) => string | undefined;
leaseCommand: (command: string) => string;
}): AcpAgentRegistry {
return {
resolve(agentName: string): string | undefined {
resolve(agentName: string): string {
const command = params.agentRegistry.resolve(agentName);
const override = params.scope.getStore();
if (
!override ||
normalizeAgentName(agentName) !== CODEX_ACP_AGENT_ID ||
typeof command !== "string" ||
!isCodexAcpCommand(command)
) {
return params.leaseCommand(command);
@@ -700,9 +699,9 @@ export class AcpxRuntime implements AcpRuntime {
});
}
private commandWithLaunchLease(command: string | undefined): string | undefined {
private commandWithLaunchLease(command: string): string {
const launch = this.launchLeaseScope.getStore();
if (!command || !launch) {
if (!launch) {
return command;
}
launch.stableCommand = command;

View File

@@ -1,6 +0,0 @@
declare module "@aws/bedrock-token-generator" {
export function getTokenProvider(opts?: {
region?: string;
expiresInSeconds?: number;
}): () => Promise<string>;
}

View File

@@ -1,6 +0,0 @@
export { buildAnthropicCliBackend } from "./cli-backend.js";
export {
CLAUDE_CLI_BACKEND_ID,
isClaudeCliProvider,
normalizeClaudeBackendConfig,
} from "./cli-shared.js";

View File

@@ -1 +0,0 @@
export * from "./src/browser-runtime.js";

View File

@@ -1,68 +0,0 @@
import { describe, expect, it } from "vitest";
import type { ClawdbotConfig } from "../runtime-api.js";
import {
resolveReactionSyntheticEvent,
type FeishuReactionCreatedEvent,
} from "./monitor.account.js";
const cfg = {} as ClawdbotConfig;
function makeReactionEvent(
overrides: Partial<FeishuReactionCreatedEvent> = {},
): FeishuReactionCreatedEvent {
return {
message_id: "om_msg1",
reaction_type: { emoji_type: "THUMBSUP" },
operator_type: "user",
user_id: { open_id: "ou_user1" },
...overrides,
};
}
describe("Feishu reaction lifecycle", () => {
it("builds a created synthetic interaction payload", async () => {
const result = await resolveReactionSyntheticEvent({
cfg,
accountId: "default",
event: makeReactionEvent({ user_id: { open_id: "ou_user1", user_id: "on_user1" } }),
botOpenId: "ou_bot",
fetchMessage: async () => ({
messageId: "om_msg1",
chatId: "oc_group_1",
chatType: "group",
senderOpenId: "ou_bot",
senderType: "app",
content: "hello",
contentType: "text",
}),
uuid: () => "fixed-uuid",
});
expect(result?.sender.sender_id).toEqual({ open_id: "ou_user1", user_id: "on_user1" });
expect(result?.message.content).toBe('{"text":"[reacted with THUMBSUP to message om_msg1]"}');
});
it("builds a deleted synthetic interaction payload", async () => {
const result = await resolveReactionSyntheticEvent({
cfg,
accountId: "default",
event: makeReactionEvent(),
botOpenId: "ou_bot",
fetchMessage: async () => ({
messageId: "om_msg1",
chatId: "oc_group_1",
chatType: "group",
senderOpenId: "ou_bot",
senderType: "app",
content: "hello",
contentType: "text",
}),
uuid: () => "fixed-uuid",
action: "deleted",
});
expect(result?.message.content).toBe(
'{"text":"[removed reaction THUMBSUP from message om_msg1]"}',
);
});
});

View File

@@ -44,4 +44,3 @@ export const testing = {
});
},
};
export { testing as __testing };

View File

@@ -8,7 +8,7 @@ export { normalizeXaiModelId as normalizeNativeXaiModelId } from "./model-id.js"
export const XAI_TOOL_SCHEMA_PROFILE = "xai";
export const HTML_ENTITY_TOOL_CALL_ARGUMENTS_ENCODING = "html-entities";
export const XAI_UNSUPPORTED_SCHEMA_KEYWORDS = new Set([
const XAI_UNSUPPORTED_SCHEMA_KEYWORDS = new Set([
"minLength",
"maxLength",
"minItems",
@@ -17,7 +17,7 @@ export const XAI_UNSUPPORTED_SCHEMA_KEYWORDS = new Set([
"maxContains",
]);
export function resolveXaiModelCompatPatch(): ModelCompatConfig {
function resolveXaiModelCompatPatch(): ModelCompatConfig {
return {
toolSchemaProfile: XAI_TOOL_SCHEMA_PROFILE,
unsupportedToolSchemaKeywords: Array.from(XAI_UNSUPPORTED_SCHEMA_KEYWORDS),

View File

@@ -1,17 +0,0 @@
/**
* Conformance snapshot for tool policy.
*
* Security note:
* - This is static, build-time information (no runtime I/O, no network exposure).
* - Intended for CI/tools to detect drift between the implementation policy and
* the formal models/extractors.
*/
import { TOOL_GROUPS } from "./tool-policy.js";
// Tool name aliases are intentionally not exported from tool-policy today.
// Keep the conformance snapshot focused on exported policy constants.
export const TOOL_POLICY_CONFORMANCE = {
toolGroups: TOOL_GROUPS,
} as const;

View File

@@ -4,7 +4,6 @@ import { pickSandboxToolPolicy } from "./sandbox-tool-policy.js";
import { isToolAllowed, resolveSandboxToolPolicyForAgent } from "./sandbox/tool-policy.js";
import type { SandboxToolPolicy } from "./sandbox/types.js";
import { isToolAllowedByPolicyName } from "./tool-policy-match.js";
import { TOOL_POLICY_CONFORMANCE } from "./tool-policy.conformance.js";
import {
collectExplicitAllowlist,
DEFAULT_PLUGIN_TOOLS_ALLOWLIST_ENTRY,
@@ -78,17 +77,6 @@ describe("tool-policy", () => {
});
});
describe("TOOL_POLICY_CONFORMANCE", () => {
it("matches exported TOOL_GROUPS exactly", () => {
expect(TOOL_POLICY_CONFORMANCE.toolGroups).toEqual(TOOL_GROUPS);
});
it("is JSON-serializable", () => {
const serialized = JSON.stringify(TOOL_POLICY_CONFORMANCE);
expect(JSON.parse(serialized)).toEqual({ toolGroups: TOOL_GROUPS });
});
});
describe("sandbox tool policy", () => {
it("allows all tools with * allow", () => {
const policy: SandboxToolPolicy = { allow: ["*"], deny: [] };

View File

@@ -1,19 +0,0 @@
import type { ChannelOutboundAdapter } from "openclaw/plugin-sdk/channel-contract";
import type { ChannelPlugin } from "openclaw/plugin-sdk/channel-plugin-common";
import { loadBundledPluginTestApiSync } from "../../../../test-utils/bundled-plugin-public-surface.js";
type CreateIMessageTestPlugin = (params?: { outbound?: ChannelOutboundAdapter }) => ChannelPlugin;
let createIMessageTestPluginCache: CreateIMessageTestPlugin | undefined;
function getCreateIMessageTestPlugin(): CreateIMessageTestPlugin {
if (!createIMessageTestPluginCache) {
({ createIMessageTestPlugin: createIMessageTestPluginCache } = loadBundledPluginTestApiSync<{
createIMessageTestPlugin: CreateIMessageTestPlugin;
}>("imessage"));
}
return createIMessageTestPluginCache;
}
export const createIMessageTestPlugin: CreateIMessageTestPlugin = (...args) =>
getCreateIMessageTestPlugin()(...args);

View File

@@ -1,3 +0,0 @@
export function shouldExpectNativeJitiForJavaScriptTestRuntime(): boolean {
return typeof (process.versions as { bun?: string }).bun !== "string";
}

View File

@@ -1,15 +0,0 @@
export async function runWithModelFallback(params: {
provider: string;
model: string;
run: (
provider: string,
model: string,
options?: { allowTransientCooldownProbe?: boolean },
) => Promise<unknown>;
}) {
return {
result: await params.run(params.provider, params.model),
provider: params.provider,
model: params.model,
};
}

View File

@@ -1,17 +0,0 @@
import { setTimeout as nativeSetTimeout } from "node:timers";
import { vi } from "vitest";
export function useFastShortTimeouts(maxDelayMs = 2000): () => void {
const spy = vi.spyOn(global, "setTimeout").mockImplementation(((
handler: TimerHandler,
timeout?: number,
...args: unknown[]
) => {
const delay = typeof timeout === "number" ? timeout : 0;
if (delay > 0 && delay <= maxDelayMs) {
return nativeSetTimeout(handler, 0, ...args);
}
return nativeSetTimeout(handler, delay, ...args);
}) as typeof setTimeout);
return () => spy.mockRestore();
}