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)
|
return OnboardResult(config=original_config, should_save=False)
|
||||||
if answer == "[A] Advanced Settings":
|
if answer == "[A] Advanced Settings":
|
||||||
_configure_advanced_settings(config)
|
_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,
|
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(
|
def for_turn(
|
||||||
self,
|
self,
|
||||||
*,
|
*,
|
||||||
|
|||||||
@@ -110,9 +110,6 @@ class WebUIGatewayEndpoint:
|
|||||||
self.webui_connections.add(connection)
|
self.webui_connections.add(connection)
|
||||||
return audience is not None
|
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:
|
def discard_connection(self, connection: ServerConnection) -> None:
|
||||||
self.webui_connections.discard(connection)
|
self.webui_connections.discard(connection)
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -444,7 +444,7 @@ interface RenderedRetryStatus extends RetryStatus {
|
|||||||
nextRetryAtMs?: number
|
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)
|
const label = retryFailureLabel(status.error_kind)
|
||||||
if (status.state === "exhausted") return `${label} · ending turn`
|
if (status.state === "exhausted") return `${label} · ending turn`
|
||||||
if (status.state === "recovered") return "Connection restored"
|
if (status.state === "recovered") return "Connection restored"
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ const IMAGE_MIME_TYPES = [
|
|||||||
] as const
|
] as const
|
||||||
const MAX_IMAGE_BYTES = 6 * 1024 * 1024
|
const MAX_IMAGE_BYTES = 6 * 1024 * 1024
|
||||||
|
|
||||||
export interface ClipboardImage {
|
interface ClipboardImage {
|
||||||
dataUrl: string
|
dataUrl: string
|
||||||
mimeType: typeof IMAGE_MIME_TYPES[number]
|
mimeType: typeof IMAGE_MIME_TYPES[number]
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
import { decodeNotification, isCompactionPhase, isRecoveryState } from "../../packages/client-events/notifications"
|
import { decodeNotification, isCompactionPhase, isRecoveryState } from "../../packages/client-events/notifications"
|
||||||
import type { ContextCompaction, NotificationEvent, RecoveryState } 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 =
|
export type ConnectionStatus =
|
||||||
| "starting"
|
| "starting"
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ export function FallbackResponseSources({
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** A persisted invocation identity; deliberately independent of live settings. */
|
/** A persisted invocation identity; deliberately independent of live settings. */
|
||||||
export function ResponseSourceBadge({
|
function ResponseSourceBadge({
|
||||||
source,
|
source,
|
||||||
className,
|
className,
|
||||||
}: {
|
}: {
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import { channelValidationMessage } from "@/components/settings/channels/validat
|
|||||||
import type { ChannelValidationPayload, NanobotFeatureInfo } from "@/lib/types";
|
import type { ChannelValidationPayload, NanobotFeatureInfo } from "@/lib/types";
|
||||||
import { cn } from "@/lib/utils";
|
import { cn } from "@/lib/utils";
|
||||||
|
|
||||||
export function channelValidationStatusLabel(
|
function channelValidationStatusLabel(
|
||||||
status: string,
|
status: string,
|
||||||
t: ReturnType<typeof useTranslation>["t"],
|
t: ReturnType<typeof useTranslation>["t"],
|
||||||
): string {
|
): string {
|
||||||
|
|||||||
@@ -910,7 +910,7 @@ type AppsActionButtonProps = Omit<
|
|||||||
children?: ReactNode;
|
children?: ReactNode;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const AppsActionButton = forwardRef<HTMLButtonElement, AppsActionButtonProps>(
|
const AppsActionButton = forwardRef<HTMLButtonElement, AppsActionButtonProps>(
|
||||||
function AppsActionButton({
|
function AppsActionButton({
|
||||||
ariaLabel,
|
ariaLabel,
|
||||||
visibleLabel,
|
visibleLabel,
|
||||||
|
|||||||
@@ -78,7 +78,3 @@ export function applyDocumentLocale(locale: SupportedLocale): void {
|
|||||||
if (typeof document === "undefined") return;
|
if (typeof document === "undefined") return;
|
||||||
document.documentElement.lang = locale;
|
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 },
|
newChat: { key: "O", shift: true },
|
||||||
search: { key: "K", shift: false },
|
search: { key: "K", shift: false },
|
||||||
apps: { key: "1", shift: true },
|
apps: { key: "1", shift: true },
|
||||||
|
|||||||
@@ -55,14 +55,14 @@ export function turnFieldsFromEvent(
|
|||||||
return fields;
|
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;
|
return !turn.turnId || !message.turnId || message.turnId === turn.turnId;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Find a still-open streamed assistant turn. Closed stream segments stay visible
|
/** Find a still-open streamed assistant turn. Closed stream segments stay visible
|
||||||
* as streaming until ``turn_end`` for visual continuity, but they must not
|
* as streaming until ``turn_end`` for visual continuity, but they must not
|
||||||
* receive later delta segments. */
|
* receive later delta segments. */
|
||||||
export function findStreamingAssistantIndex(
|
function findStreamingAssistantIndex(
|
||||||
prev: UIMessage[],
|
prev: UIMessage[],
|
||||||
closedStreamIds: ReadonlySet<string>,
|
closedStreamIds: ReadonlySet<string>,
|
||||||
turn: UIMessageTurnFields = {},
|
turn: UIMessageTurnFields = {},
|
||||||
@@ -85,7 +85,7 @@ export function findStreamingAssistantIndex(
|
|||||||
* Find the most recent assistant placeholder that an incoming answer
|
* Find the most recent assistant placeholder that an incoming answer
|
||||||
* delta should adopt instead of spawning a parallel row.
|
* delta should adopt instead of spawning a parallel row.
|
||||||
*/
|
*/
|
||||||
export function findActiveAssistantPlaceholderIndex(
|
function findActiveAssistantPlaceholderIndex(
|
||||||
prev: UIMessage[],
|
prev: UIMessage[],
|
||||||
turn: UIMessageTurnFields = {},
|
turn: UIMessageTurnFields = {},
|
||||||
): number | null {
|
): number | null {
|
||||||
@@ -98,7 +98,7 @@ export function findActiveAssistantPlaceholderIndex(
|
|||||||
return prev.length - 1;
|
return prev.length - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function replaceMessageAt(
|
function replaceMessageAt(
|
||||||
prev: UIMessage[],
|
prev: UIMessage[],
|
||||||
index: number,
|
index: number,
|
||||||
message: UIMessage,
|
message: UIMessage,
|
||||||
@@ -110,7 +110,7 @@ export function replaceMessageAt(
|
|||||||
|
|
||||||
/** Close the active reasoning stream segment. ``now`` is supplied by the caller
|
/** Close the active reasoning stream segment. ``now`` is supplied by the caller
|
||||||
* so the projection remains deterministic for replay and fixture tests. */
|
* 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) {
|
for (let i = prev.length - 1; i >= 0; i -= 1) {
|
||||||
const candidate = prev[i];
|
const candidate = prev[i];
|
||||||
if (!candidate.reasoningStreaming) continue;
|
if (!candidate.reasoningStreaming) continue;
|
||||||
@@ -131,7 +131,7 @@ export function closeReasoningStream(prev: UIMessage[], now?: number): UIMessage
|
|||||||
return prev;
|
return prev;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isReasoningOnlyPlaceholder(message: UIMessage): boolean {
|
function isReasoningOnlyPlaceholder(message: UIMessage): boolean {
|
||||||
return (
|
return (
|
||||||
message.role === "assistant"
|
message.role === "assistant"
|
||||||
&& message.kind !== "trace"
|
&& message.kind !== "trace"
|
||||||
@@ -142,7 +142,7 @@ export function isReasoningOnlyPlaceholder(message: UIMessage): boolean {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function stampLastAssistantCompletion(
|
function stampLastAssistantCompletion(
|
||||||
prev: UIMessage[],
|
prev: UIMessage[],
|
||||||
completion: Pick<
|
completion: Pick<
|
||||||
UIMessage,
|
UIMessage,
|
||||||
@@ -197,7 +197,7 @@ function hasFileEditForToolEvent(messages: UIMessage[], event: ToolProgressEvent
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function filterCoveredFileEditToolEvents(
|
function filterCoveredFileEditToolEvents(
|
||||||
messages: UIMessage[],
|
messages: UIMessage[],
|
||||||
events: ToolProgressEvent[],
|
events: ToolProgressEvent[],
|
||||||
): ToolProgressEvent[] {
|
): ToolProgressEvent[] {
|
||||||
@@ -254,7 +254,7 @@ function traceMessageIsEmpty(message: UIMessage): boolean {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function stripCoveredFileEditToolHintsFromMessages(
|
function stripCoveredFileEditToolHintsFromMessages(
|
||||||
messages: UIMessage[],
|
messages: UIMessage[],
|
||||||
edits: UIFileEdit[],
|
edits: UIFileEdit[],
|
||||||
turn: UIMessageTurnFields,
|
turn: UIMessageTurnFields,
|
||||||
@@ -299,7 +299,7 @@ function normalizeFileEdit(edit: UIFileEdit): UIFileEdit | null {
|
|||||||
return normalized;
|
return normalized;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function mergeFileEdits(
|
function mergeFileEdits(
|
||||||
existing: UIFileEdit[] | undefined,
|
existing: UIFileEdit[] | undefined,
|
||||||
incoming: UIFileEdit[],
|
incoming: UIFileEdit[],
|
||||||
): UIFileEdit[] {
|
): UIFileEdit[] {
|
||||||
@@ -330,7 +330,7 @@ export function mergeFileEdits(
|
|||||||
return next;
|
return next;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function findFileEditTraceIndex(
|
function findFileEditTraceIndex(
|
||||||
prev: UIMessage[],
|
prev: UIMessage[],
|
||||||
segmentId: string | null,
|
segmentId: string | null,
|
||||||
incoming: UIFileEdit[],
|
incoming: UIFileEdit[],
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import type { ContextCompaction, NotificationEvent, RecoveryState, RetryStatus as WireRetryStatus } from "../../../packages/client-events/notifications";
|
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";
|
type Role = "user" | "assistant" | "tool" | "system";
|
||||||
|
|
||||||
@@ -47,7 +47,7 @@ export interface UIMediaAttachment {
|
|||||||
|
|
||||||
interface UIMessageSource { kind: "cron" | "local_trigger" | "trigger" | string; label?: string; }
|
interface UIMessageSource { kind: "cron" | "local_trigger" | "trigger" | string; label?: string; }
|
||||||
|
|
||||||
export interface TurnUsage {
|
interface TurnUsage {
|
||||||
prompt_tokens?: number;
|
prompt_tokens?: number;
|
||||||
completion_tokens?: number;
|
completion_tokens?: number;
|
||||||
total_tokens?: number;
|
total_tokens?: number;
|
||||||
@@ -71,7 +71,7 @@ export interface ResponseSource {
|
|||||||
fallback?: boolean;
|
fallback?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface UITraceDetail {
|
interface UITraceDetail {
|
||||||
ref: string;
|
ref: string;
|
||||||
bytes: number;
|
bytes: number;
|
||||||
traceCount: number;
|
traceCount: number;
|
||||||
@@ -1027,7 +1027,7 @@ export interface ChannelSetupContract {
|
|||||||
verifies_connection?: boolean;
|
verifies_connection?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ChannelSetupContractRequirement {
|
interface ChannelSetupContractRequirement {
|
||||||
alternatives: string[][];
|
alternatives: string[][];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user