Skip to content

A self-improving RLM agent for coding workflows and long-running autonomous tasks.

Rust

Remove unused coding-agent helpers, barrel, and daemon types (#2951)

Sebastian Müllerf3bbc2c1ebb6
diff --git a/packages/coding-agent/.changes/dead-code-1.md b/packages/coding-agent/.changes/dead-code-1.md
new file mode 100644
index 0000000000..9e6e314cb2
--- /dev/null
+++ b/packages/coding-agent/.changes/dead-code-1.md
@@ -0,0 +1 @@
+- Removed unused internal code: the orphaned `core/index.ts` barrel, six uncalled helpers, and eleven unused daemon protocol types.
diff --git a/packages/coding-agent/src/core/index.ts b/packages/coding-agent/src/core/index.ts
deleted file mode 100644
index 587b0f5178..0000000000
--- a/packages/coding-agent/src/core/index.ts
+++ /dev/null
@@ -1,84 +0,0 @@
-/**
- * Core modules shared between all run modes.
- */
-
-export {
- AgentSession,
- type AgentSessionConfig,
- type AgentSessionEvent,
- type AgentSessionEventListener,
- type ModelCycleResult,
- type PromptOptions,
-} from "./agent-session.js";
-export type { AgentSessionRuntimeConfig } from "./agent-session-config.js";
-export {
- AgentSessionRuntime,
- type AgentSessionRuntimeKind,
- type AgentSessionRuntimeMetadata,
- type CreateAgentSessionRuntimeFactory,
- type CreateAgentSessionRuntimeResult,
- createAgentSessionRuntime,
-} from "./agent-session-runtime.js";
-export {
- type AgentSessionCreationOptions,
- type AgentSessionRuntimeDiagnostic,
- type AgentSessionServices,
- type CreateAgentSessionFromServicesOptions,
- type CreateAgentSessionServicesOptions,
- createAgentSessionFromServices,
- createAgentSessionServices,
-} from "./agent-session-services.js";
-export { type BashExecutorOptions, type BashResult, executeBashWithOperations } from "./bash-executor.js";
-export type { CompactionResult } from "./compaction/index.js";
-export { createEventBus, type EventBus, type EventBusController } from "./event-bus.js";
-// Extensions system
-export {
- type AgentEndEvent,
- type AgentStartEvent,
- type AgentToolResult,
- type AgentToolUpdateCallback,
- type BeforeAgentStartEvent,
- type BeforeAgentStartEventResult,
- type BuildSystemPromptOptions,
- type ContextEvent,
- defineTool,
- discoverAndLoadExtensions,
- type ExecOptions,
- type ExecResult,
- type Extension,
- type ExtensionAPI,
- type ExtensionCommandContext,
- type ExtensionContext,
- type ExtensionError,
- type ExtensionEvent,
- type ExtensionFactory,
- type ExtensionFlag,
- type ExtensionHandler,
- ExtensionRunner,
- type ExtensionShortcut,
- type ExtensionUIContext,
- type LoadExtensionsResult,
- type MessageRenderer,
- type RegisteredCommand,
- type SessionBeforeCompactEvent,
- type SessionBeforeForkEvent,
- type SessionBeforeSwitchEvent,
- type SessionBeforeTreeEvent,
- type SessionCompactEvent,
- type SessionShutdownEvent,
- type SessionStartEvent,
- type SessionTreeEvent,
- type ToolCallEvent,
- type ToolCallEventResult,
- type ToolDefinition,
- type ToolRenderResultOptions,
- type ToolResultEvent,
- type TurnEndEvent,
- type TurnStartEvent,
- type WorkingIndicatorOptions,
-} from "./extensions/index.js";
-export type { RefinementResult } from "./refinement/index.js";
-export type { CreateRlmSubagentRuntimeOptions, RlmSubagentRuntime, SubagentRuntimeHost } from "./rlm-runtime.js";
-export { SessionImportFileNotFoundError } from "./session-import-errors.js";
-export type { SessionStats } from "./session-stats.js";
-export { createSyntheticSourceInfo } from "./source-info.js";
diff --git a/packages/coding-agent/src/core/resolve-config-value.ts b/packages/coding-agent/src/core/resolve-config-value.ts
index 005daea205..53d1f86e3f 100644
--- a/packages/coding-agent/src/core/resolve-config-value.ts
+++ b/packages/coding-agent/src/core/resolve-config-value.ts
@@ -118,21 +118,6 @@ export function resolveConfigValueOrThrow(config: string, description: string):
throw new Error(`Failed to resolve ${description}`);
}
-/**
- * Resolve all header values using the same resolution logic as API keys.
- */
-export function resolveHeaders(headers: Record<string, string> | undefined): Record<string, string> | undefined {
- if (!headers) return undefined;
- const resolved: Record<string, string> = {};
- for (const [key, value] of Object.entries(headers)) {
- const resolvedValue = resolveConfigValue(value);
- if (resolvedValue) {
- resolved[key] = resolvedValue;
- }
- }
- return Object.keys(resolved).length > 0 ? resolved : undefined;
-}
-
export function resolveHeadersOrThrow(
headers: Record<string, string> | undefined,
description: string,
diff --git a/packages/coding-agent/src/core/tools/edit-diff.ts b/packages/coding-agent/src/core/tools/edit-diff.ts
index a1fe118647..36495eedde 100644
--- a/packages/coding-agent/src/core/tools/edit-diff.ts
+++ b/packages/coding-agent/src/core/tools/edit-diff.ts
@@ -409,16 +409,3 @@ export async function computeEditsDiff(
return { error: err instanceof Error ? err.message : String(err) };
}
}
-
-/**
- * Compute the diff for a single edit operation without applying it.
- * Kept as a convenience wrapper for single-edit callers.
- */
-export async function computeEditDiff(
- path: string,
- oldText: string,
- newText: string,
- cwd: string,
-): Promise<EditDiffResult | EditDiffError> {
- return computeEditsDiff(path, [{ oldText, newText }], cwd);
-}
diff --git a/packages/coding-agent/src/modes/agents-view/session-view-search.ts b/packages/coding-agent/src/modes/agents-view/session-view-search.ts
index ef36814b1f..f09fff5afb 100644
--- a/packages/coding-agent/src/modes/agents-view/session-view-search.ts
+++ b/packages/coding-agent/src/modes/agents-view/session-view-search.ts
@@ -17,11 +17,6 @@ function normalizeWhitespaceLower(text: string): string {
return text.toLowerCase().replace(/\s+/g, " ").trim();
}
-/** Join arbitrary session fields into the common search corpus. */
-export function createSessionSearchText(parts: readonly (string | undefined | null)[]): string {
- return parts.filter((part): part is string => typeof part === "string" && part.length > 0).join(" ");
-}
-
export function parseSearchQuery(query: string): ParsedSearchQuery {
const trimmed = query.trim();
if (!trimmed) {
diff --git a/packages/coding-agent/src/modes/daemon/daemon-protocol.ts b/packages/coding-agent/src/modes/daemon/daemon-protocol.ts
index 50dcc21aec..8f32868f46 100644
--- a/packages/coding-agent/src/modes/daemon/daemon-protocol.ts
+++ b/packages/coding-agent/src/modes/daemon/daemon-protocol.ts
@@ -1,17 +1,10 @@
import type { AgentMessage, ThinkingLevel } from "@earendil-works/pi-agent-core";
import type { ImageContent, ServiceTier, TextContent, Transport } from "@earendil-works/pi-ai";
-import type {
- AgentSessionMessageDeliveryMode,
- AgentSessionMessageReceipt,
- AgentSessionMessageSafetyStatus,
-} from "../../core/agent-messages.js";
+import type { AgentSessionMessageDeliveryMode } from "../../core/agent-messages.js";
import type { SessionActionRecoverySnapshot } from "../../core/agent-session.js";
import type { AgentSessionRuntimeConfig } from "../../core/agent-session-config.js";
import type { AgentSessionRuntimeMetadata } from "../../core/agent-session-runtime.js";
-import type { AgentAutonomousStatus } from "../../core/autonomous.js";
-import type { BashResult } from "../../core/bash-executor.js";
import type {
- AgentCronJob,
AgentHeartbeatDeliveryMode,
AgentHeartbeatManagementAction,
AgentHeartbeatUpdateAction,
@@ -25,16 +18,13 @@ import type { DeleteSessionFileResult } from "../../core/session-file-actions.js
import type { SessionUsageSummary } from "../../core/usage.js";
import type {
AgentConnectionAgentStatus,
- AgentConnectionHeartbeat,
AgentConnectionQueueMode,
- AgentConnectionResourceSnapshot,
AgentConnectionRlmChildAgentSnapshot,
AgentConnectionSavedSessionScope,
AgentConnectionSavedSessionState,
AgentConnectionScopedModel,
AgentConnectionSessionContext,
AgentConnectionSessionEvent,
- AgentConnectionSessionHeader,
AgentConnectionSessionTreeNode,
AgentConnectionSideQuestionEvent,
AgentConnectionSideQuestionTurn,
@@ -99,10 +89,6 @@ export type DaemonClientCapability =
| "client_owned_sessions"
// Client declaration, not a command gate: attach with it opts into heartbeats_changed pushes.
| "heartbeat_catalog";
-export type DaemonPromptAdmissionCancellationStatus = "cancelled" | "owned" | "unknown";
-export interface DaemonPromptAdmissionCancellationResult {
- status: DaemonPromptAdmissionCancellationStatus;
-}
export type DaemonServerCapability =
| DaemonClientCapability
| "delete_rlm_subagent"
@@ -290,8 +276,6 @@ export interface DaemonCommandEnvelope<TCommand extends DaemonCommand = DaemonCo
command: TCommand;
}
-export type DaemonCommandWire = DaemonCommand | DaemonCommandEnvelope;
-
export interface DaemonEventEnvelope<TEvent extends DaemonOutbound = DaemonOutbound> {
type: "event";
id: DaemonEventId;
@@ -1114,16 +1098,6 @@ export interface DaemonSavedSessionInfo {
}
export type DaemonDeleteSavedSessionResult = DeleteSessionFileResult;
-export type DaemonAutonomousStatus = AgentAutonomousStatus;
-export type DaemonBashResult = BashResult;
-export type DaemonSessionHeader = AgentConnectionSessionHeader;
-
-export type DaemonResourceSnapshot = AgentConnectionResourceSnapshot;
-
-export type DaemonCronJob = AgentCronJob;
-export type DaemonHeartbeat = AgentConnectionHeartbeat;
-export type DaemonAgentSessionMessageReceipt = AgentSessionMessageReceipt;
-export type DaemonAgentSessionMessageSafetyStatus = AgentSessionMessageSafetyStatus;
export type DaemonOutbound =
| DaemonResponse
diff --git a/packages/coding-agent/src/modes/interactive/theme/theme.ts b/packages/coding-agent/src/modes/interactive/theme/theme.ts
index 9284e06e4c..e8235a35ca 100644
--- a/packages/coding-agent/src/modes/interactive/theme/theme.ts
+++ b/packages/coding-agent/src/modes/interactive/theme/theme.ts
@@ -1183,14 +1183,6 @@ export function getResolvedThemeColors(themeName?: string): Record<string, strin
return cssColors;
}
-/**
- * Check if a theme is a "light" theme (for CSS that needs light/dark variants).
- */
-export function isLightTheme(themeName?: string): boolean {
- // Currently just check the name - could be extended to analyze colors
- return themeName === "light";
-}
-
/**
* Get explicit export colors from theme JSON, if specified.
* Returns undefined for each color that isn't explicitly set.
diff --git a/packages/coding-agent/src/utils/changelog.ts b/packages/coding-agent/src/utils/changelog.ts
index 79b17d0e01..24d2187953 100644
--- a/packages/coding-agent/src/utils/changelog.ts
+++ b/packages/coding-agent/src/utils/changelog.ts
@@ -70,30 +70,5 @@ export function parseChangelog(changelogPath: string): ChangelogEntry[] {
}
}
-/**
- * Compare versions. Returns: -1 if v1 < v2, 0 if v1 === v2, 1 if v1 > v2
- */
-export function compareVersions(v1: ChangelogEntry, v2: ChangelogEntry): number {
- if (v1.major !== v2.major) return v1.major - v2.major;
- if (v1.minor !== v2.minor) return v1.minor - v2.minor;
- return v1.patch - v2.patch;
-}
-
-/**
- * Get entries newer than lastVersion
- */
-export function getNewEntries(entries: ChangelogEntry[], lastVersion: string): ChangelogEntry[] {
- // Parse lastVersion
- const parts = lastVersion.split(".").map(Number);
- const last: ChangelogEntry = {
- major: parts[0] || 0,
- minor: parts[1] || 0,
- patch: parts[2] || 0,
- content: "",
- };
-
- return entries.filter((entry) => compareVersions(entry, last) > 0);
-}
-
// Re-export getChangelogPath from paths.ts for convenience
export { getChangelogPath } from "../config.js";