Skip to content

Your lightweight open-source personal agent.

refactor: remove unused helpers and internal exports

chengyongru3ecc3d35566b
diff --git a/nanobot/cli/onboard.py b/nanobot/cli/onboard.py
index 575286d82..1f9ae263b 100644
--- a/nanobot/cli/onboard.py
+++ b/nanobot/cli/onboard.py
@@ -2131,12 +2131,3 @@ def run_onboard(initial_config: Config | None = None) -> OnboardResult:
return OnboardResult(config=original_config, should_save=False)
if answer == "[A] Advanced Settings":
_configure_advanced_settings(config)
-
-
-def run_quick_start_onboard(initial_config: Config) -> OnboardResult:
- """Run the compact provider + local WebUI setup path directly."""
- _get_questionary()
- draft = initial_config.model_copy(deep=True)
- if _configure_quick_start(draft):
- return OnboardResult(config=draft, should_save=True)
- return OnboardResult(config=initial_config, should_save=False)
diff --git a/nanobot/security/workspace_access.py b/nanobot/security/workspace_access.py
index 476723e93..f9e03c803 100644
--- a/nanobot/security/workspace_access.py
+++ b/nanobot/security/workspace_access.py
@@ -125,17 +125,6 @@ class WorkspaceScopeResolver:
self.default_restrict_to_workspace,
)
- def for_message(
- self,
- msg: Any,
- session_metadata: Any,
- ) -> WorkspaceScope:
- return self.for_turn(
- channel=getattr(msg, "channel", None),
- message_metadata=getattr(msg, "metadata", None),
- session_metadata=session_metadata,
- )
-
def for_turn(
self,
*,
diff --git a/nanobot/webui/gateway_endpoint.py b/nanobot/webui/gateway_endpoint.py
index 83217b2f6..49b5d870c 100644
--- a/nanobot/webui/gateway_endpoint.py
+++ b/nanobot/webui/gateway_endpoint.py
@@ -110,9 +110,6 @@ class WebUIGatewayEndpoint:
self.webui_connections.add(connection)
return audience is not None
- def is_webui_connection(self, connection: ServerConnection) -> bool:
- return connection in self.webui_connections
-
def discard_connection(self, connection: ServerConnection) -> None:
self.webui_connections.discard(connection)
diff --git a/tui/src/app.ts b/tui/src/app.ts
index 4a00a112f..05c17d701 100644
--- a/tui/src/app.ts
+++ b/tui/src/app.ts
@@ -444,7 +444,7 @@ interface RenderedRetryStatus extends RetryStatus {
nextRetryAtMs?: number
}
-export function retryStatusLine(status: RenderedRetryStatus, nowMs = Date.now()): string {
+function retryStatusLine(status: RenderedRetryStatus, nowMs = Date.now()): string {
const label = retryFailureLabel(status.error_kind)
if (status.state === "exhausted") return `${label} · ending turn`
if (status.state === "recovered") return "Connection restored"
diff --git a/tui/src/clipboard-image.ts b/tui/src/clipboard-image.ts
index ca0aaf90f..f4944045f 100644
--- a/tui/src/clipboard-image.ts
+++ b/tui/src/clipboard-image.ts
@@ -11,7 +11,7 @@ const IMAGE_MIME_TYPES = [
] as const
const MAX_IMAGE_BYTES = 6 * 1024 * 1024
-export interface ClipboardImage {
+interface ClipboardImage {
dataUrl: string
mimeType: typeof IMAGE_MIME_TYPES[number]
}
diff --git a/tui/src/protocol.ts b/tui/src/protocol.ts
index d17ad6064..f69cba440 100644
--- a/tui/src/protocol.ts
+++ b/tui/src/protocol.ts
@@ -1,6 +1,6 @@
import { decodeNotification, isCompactionPhase, isRecoveryState } from "../../packages/client-events/notifications"
import type { ContextCompaction, NotificationEvent, RecoveryState } from "../../packages/client-events/notifications"
-export type { ContextCompaction, RecoveryState, RecoveryStatus, RetryStatus } from "../../packages/client-events/notifications"
+export type { ContextCompaction, RecoveryState, RetryStatus } from "../../packages/client-events/notifications"
export type ConnectionStatus =
| "starting"
diff --git a/webui/src/components/ResponseSourceBadge.tsx b/webui/src/components/ResponseSourceBadge.tsx
index 19df1d086..cb599786e 100644
--- a/webui/src/components/ResponseSourceBadge.tsx
+++ b/webui/src/components/ResponseSourceBadge.tsx
@@ -31,7 +31,7 @@ export function FallbackResponseSources({
}
/** A persisted invocation identity; deliberately independent of live settings. */
-export function ResponseSourceBadge({
+function ResponseSourceBadge({
source,
className,
}: {
diff --git a/webui/src/components/settings/channels/ChannelValidationProgress.tsx b/webui/src/components/settings/channels/ChannelValidationProgress.tsx
index b81a2f168..e9c989253 100644
--- a/webui/src/components/settings/channels/ChannelValidationProgress.tsx
+++ b/webui/src/components/settings/channels/ChannelValidationProgress.tsx
@@ -7,7 +7,7 @@ import { channelValidationMessage } from "@/components/settings/channels/validat
import type { ChannelValidationPayload, NanobotFeatureInfo } from "@/lib/types";
import { cn } from "@/lib/utils";
-export function channelValidationStatusLabel(
+function channelValidationStatusLabel(
status: string,
t: ReturnType<typeof useTranslation>["t"],
): string {
diff --git a/webui/src/components/settings/system/AppsSettings.tsx b/webui/src/components/settings/system/AppsSettings.tsx
index 4ceb74477..dfd80ede6 100644
--- a/webui/src/components/settings/system/AppsSettings.tsx
+++ b/webui/src/components/settings/system/AppsSettings.tsx
@@ -910,7 +910,7 @@ type AppsActionButtonProps = Omit<
children?: ReactNode;
};
-export const AppsActionButton = forwardRef<HTMLButtonElement, AppsActionButtonProps>(
+const AppsActionButton = forwardRef<HTMLButtonElement, AppsActionButtonProps>(
function AppsActionButton({
ariaLabel,
visibleLabel,
diff --git a/webui/src/i18n/config.ts b/webui/src/i18n/config.ts
index 08742acc3..a56dee89d 100644
--- a/webui/src/i18n/config.ts
+++ b/webui/src/i18n/config.ts
@@ -78,7 +78,3 @@ export function applyDocumentLocale(locale: SupportedLocale): void {
if (typeof document === "undefined") return;
document.documentElement.lang = locale;
}
-
-export function localeOption(locale: SupportedLocale) {
- return supportedLocales.find((entry) => entry.code === locale) ?? supportedLocales[0];
-}
diff --git a/webui/src/lib/sidebar-shortcuts.ts b/webui/src/lib/sidebar-shortcuts.ts
index dc0b9c1f9..36a93b063 100644
--- a/webui/src/lib/sidebar-shortcuts.ts
+++ b/webui/src/lib/sidebar-shortcuts.ts
@@ -1,4 +1,4 @@
-export const SIDEBAR_SHORTCUTS = {
+const SIDEBAR_SHORTCUTS = {
newChat: { key: "O", shift: true },
search: { key: "K", shift: false },
apps: { key: "1", shift: true },
diff --git a/webui/src/lib/thread-event-projection.ts b/webui/src/lib/thread-event-projection.ts
index 89749ecb4..d78da705f 100644
--- a/webui/src/lib/thread-event-projection.ts
+++ b/webui/src/lib/thread-event-projection.ts
@@ -55,14 +55,14 @@ export function turnFieldsFromEvent(
return fields;
}
-export function matchesTurn(message: UIMessage, turn: UIMessageTurnFields): boolean {
+function matchesTurn(message: UIMessage, turn: UIMessageTurnFields): boolean {
return !turn.turnId || !message.turnId || message.turnId === turn.turnId;
}
/** Find a still-open streamed assistant turn. Closed stream segments stay visible
* as streaming until ``turn_end`` for visual continuity, but they must not
* receive later delta segments. */
-export function findStreamingAssistantIndex(
+function findStreamingAssistantIndex(
prev: UIMessage[],
closedStreamIds: ReadonlySet<string>,
turn: UIMessageTurnFields = {},
@@ -85,7 +85,7 @@ export function findStreamingAssistantIndex(
* Find the most recent assistant placeholder that an incoming answer
* delta should adopt instead of spawning a parallel row.
*/
-export function findActiveAssistantPlaceholderIndex(
+function findActiveAssistantPlaceholderIndex(
prev: UIMessage[],
turn: UIMessageTurnFields = {},
): number | null {
@@ -98,7 +98,7 @@ export function findActiveAssistantPlaceholderIndex(
return prev.length - 1;
}
-export function replaceMessageAt(
+function replaceMessageAt(
prev: UIMessage[],
index: number,
message: UIMessage,
@@ -110,7 +110,7 @@ export function replaceMessageAt(
/** Close the active reasoning stream segment. ``now`` is supplied by the caller
* so the projection remains deterministic for replay and fixture tests. */
-export function closeReasoningStream(prev: UIMessage[], now?: number): UIMessage[] {
+function closeReasoningStream(prev: UIMessage[], now?: number): UIMessage[] {
for (let i = prev.length - 1; i >= 0; i -= 1) {
const candidate = prev[i];
if (!candidate.reasoningStreaming) continue;
@@ -131,7 +131,7 @@ export function closeReasoningStream(prev: UIMessage[], now?: number): UIMessage
return prev;
}
-export function isReasoningOnlyPlaceholder(message: UIMessage): boolean {
+function isReasoningOnlyPlaceholder(message: UIMessage): boolean {
return (
message.role === "assistant"
&& message.kind !== "trace"
@@ -142,7 +142,7 @@ export function isReasoningOnlyPlaceholder(message: UIMessage): boolean {
);
}
-export function stampLastAssistantCompletion(
+function stampLastAssistantCompletion(
prev: UIMessage[],
completion: Pick<
UIMessage,
@@ -197,7 +197,7 @@ function hasFileEditForToolEvent(messages: UIMessage[], event: ToolProgressEvent
);
}
-export function filterCoveredFileEditToolEvents(
+function filterCoveredFileEditToolEvents(
messages: UIMessage[],
events: ToolProgressEvent[],
): ToolProgressEvent[] {
@@ -254,7 +254,7 @@ function traceMessageIsEmpty(message: UIMessage): boolean {
);
}
-export function stripCoveredFileEditToolHintsFromMessages(
+function stripCoveredFileEditToolHintsFromMessages(
messages: UIMessage[],
edits: UIFileEdit[],
turn: UIMessageTurnFields,
@@ -299,7 +299,7 @@ function normalizeFileEdit(edit: UIFileEdit): UIFileEdit | null {
return normalized;
}
-export function mergeFileEdits(
+function mergeFileEdits(
existing: UIFileEdit[] | undefined,
incoming: UIFileEdit[],
): UIFileEdit[] {
@@ -330,7 +330,7 @@ export function mergeFileEdits(
return next;
}
-export function findFileEditTraceIndex(
+function findFileEditTraceIndex(
prev: UIMessage[],
segmentId: string | null,
incoming: UIFileEdit[],
diff --git a/webui/src/lib/types.ts b/webui/src/lib/types.ts
index b61a6e888..e62a4025b 100644
--- a/webui/src/lib/types.ts
+++ b/webui/src/lib/types.ts
@@ -1,5 +1,5 @@
import type { ContextCompaction, NotificationEvent, RecoveryState, RetryStatus as WireRetryStatus } from "../../../packages/client-events/notifications";
-export type { RecoveryState, RecoveryStatus } from "../../../packages/client-events/notifications";
+export type { RecoveryState } from "../../../packages/client-events/notifications";
type Role = "user" | "assistant" | "tool" | "system";
@@ -47,7 +47,7 @@ export interface UIMediaAttachment {
interface UIMessageSource { kind: "cron" | "local_trigger" | "trigger" | string; label?: string; }
-export interface TurnUsage {
+interface TurnUsage {
prompt_tokens?: number;
completion_tokens?: number;
total_tokens?: number;
@@ -71,7 +71,7 @@ export interface ResponseSource {
fallback?: boolean;
}
-export interface UITraceDetail {
+interface UITraceDetail {
ref: string;
bytes: number;
traceCount: number;
@@ -1027,7 +1027,7 @@ export interface ChannelSetupContract {
verifies_connection?: boolean;
}
-export interface ChannelSetupContractRequirement {
+interface ChannelSetupContractRequirement {
alternatives: string[][];
}