refactor: remove unused helpers and internal exports
This commit is contained in:
1 parent
cab3a360ea
commit
3ecc3d3556
13 files changed
+22
-49
No files matched your search
@@ -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)
|
||||
@@ -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,
|
||||
*,
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
+1
-1
@@ -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"
|
||||
|
||||
@@ -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]
|
||||
}
|
||||
|
||||
+1
-1
@@ -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"
|
||||
|
||||
@@ -31,7 +31,7 @@ export function FallbackResponseSources({
|
||||
}
|
||||
|
||||
/** A persisted invocation identity; deliberately independent of live settings. */
|
||||
export function ResponseSourceBadge({
|
||||
function ResponseSourceBadge({
|
||||
source,
|
||||
className,
|
||||
}: {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -910,7 +910,7 @@ type AppsActionButtonProps = Omit<
|
||||
children?: ReactNode;
|
||||
};
|
||||
|
||||
export const AppsActionButton = forwardRef<HTMLButtonElement, AppsActionButtonProps>(
|
||||
const AppsActionButton = forwardRef<HTMLButtonElement, AppsActionButtonProps>(
|
||||
function AppsActionButton({
|
||||
ariaLabel,
|
||||
visibleLabel,
|
||||
|
||||
@@ -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];
|
||||
}
|
||||
@@ -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 },
|
||||
|
||||
@@ -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[],
|
||||
|
||||
@@ -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[][];
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user