refactor: remove redundant comments and docstrings (#6527)

* refactor: remove redundant comments and docstrings

* fix(signal): annotate async context manager as a generator
This commit is contained in:
chengyongru authored and GitHub committed 2026-10-30 13:07:03 +08:00
1 parent cb3ba45317
commit a4d2430140
922 files changed
+406 -7738

No files matched your search

-7
View File
@@ -381,9 +381,6 @@ export class NanobotTui {
onPrimaryMouseDown: () => {
const restoreComposerFocus = !this.diffViewer.visible && !this.transcript.diagrams.viewer.visible
if (restoreComposerFocus) this.composer.focus()
// Runtime pickers are transient popovers. A primary click anywhere
// outside their trigger or body dismisses them; hide() restores the
// composer focus through the shared visibility callback.
this.dismissRuntimeControls()
if (this.sessionLoading || this.sessionMenu.visible) this.closeSessions()
return restoreComposerFocus
@@ -2077,7 +2074,6 @@ export class NanobotTui {
)
if (this.activeMentionQuery) this.syncComposerMenus()
} catch {
// Mentions are additive; plain text input remains fully functional.
}
}
@@ -2096,7 +2092,6 @@ export class NanobotTui {
this.syncComposerMenus()
}
} catch {
// Skill completion is additive; explicit $skill-name input still works.
}
}
@@ -2422,7 +2417,6 @@ export class NanobotTui {
)
this.status.content = sessions.length ? `${sessions.length} sessions` : "No saved sessions"
} catch {
// Keep the existing picker usable during a transient refresh failure.
} finally {
this.sessionRefreshPending = false
}
@@ -2550,7 +2544,6 @@ export class NanobotTui {
if (!this.activeTurn) this.status.content = this.readyStatus()
this.updateMeta()
} catch {
// Keep the last known estimate; it is intentionally informational.
}
}
-1
View File
@@ -25,7 +25,6 @@ async function waitUntil(predicate: () => boolean): Promise<void> {
expect(predicate()).toBe(true)
}
// The mounted app owns these retained renderables; assertions exercise keyboard input and frames.
interface MountedUI {
composer: TextareaRenderable
usagePanel: UsagePanel
-1
View File
@@ -137,7 +137,6 @@ async function fetchThreadPage(
throw new Error("Unsupported history response format")
}
/** Same recent model-call samples and context boundary as the WebUI usage popover. */
export async function fetchSessionUsage(
apiUrl: string,
apiToken: string,
-1
View File
@@ -6,7 +6,6 @@ export interface QueuedPrompt {
options: MessageOptions
}
/** Owns prompts that should start after the active turn finishes. */
export class PromptQueue {
private prompts: QueuedPrompt[] = []
-1
View File
@@ -20,7 +20,6 @@ export interface QueuePreviewTheme {
const MAX_VISIBLE = 3
/** A compact, retained projection of follow-ups waiting behind the active turn. */
export class QueuePreview {
readonly root: BoxRenderable
private readonly header: TextRenderable
-1
View File
@@ -55,7 +55,6 @@ export function resolveSlashCommandLifecycle(
return command.lifecycle
}
/** Retained slash-command discovery with one small completion interface. */
export class CommandMenu {
readonly root: BoxRenderable
private readonly picker: PickerMenu<CommandChoice>
-1
View File
@@ -29,7 +29,6 @@ interface PickerMenuOptions<T> {
onSelect?: (item: T) => void
}
/** Shared retained picker for command discovery and session navigation. */
export class PickerMenu<T> {
readonly root: BoxRenderable
private items: T[] = []
-1
View File
@@ -23,7 +23,6 @@ function updatedLabel(value: string | null): string {
return `${Math.floor(age / 86_400_000)}d`
}
/** Searchable session navigation over the gateway-owned session list. */
export class SessionMenu {
readonly root: BoxRenderable
private readonly picker: PickerMenu<SessionMenuRow>
-1
View File
@@ -11,7 +11,6 @@ export async function copyWithSystemClipboard(text: string): Promise<void> {
child.stdin.end()
if (await child.exited === 0) return
} catch {
// Try the next platform clipboard provider.
}
}
throw new Error("no clipboard provider available")
+1 -2
View File
@@ -108,7 +108,6 @@ function projectUserMessage(media: readonly UserMessageMedia[]): UserMessageProj
return { imageLabels, attachmentNames }
}
/** Projects gateway events into retained, reflowable conversation cells. */
export class Transcript {
readonly root: ScrollBoxRenderable
readonly diagrams: TranscriptDiagrams
@@ -273,7 +272,7 @@ export class Transcript {
if (messages.length === 0) return
const previousTop = this.root.scrollTop
const previousHeight = this.root.scrollHeight
let index = 1 // Keep the launch header first.
let index = 1
for (const message of messages) {
if (message.compaction) {
if (this.compaction(message.compaction, index)) index += 1
-1
View File
@@ -19,7 +19,6 @@ export function formatTokenCount(value: number): string {
return `${compact}k`
}
/** Read-only explanation of the session-owned context replayed to the agent. */
export class ContextPanel {
readonly root: BoxRenderable
private readonly stats: TextRenderable
-1
View File
@@ -96,7 +96,6 @@ function stat(edit: FileEditEvent): string {
return `+${added} -${deleted}`
}
/** Full-screen, read-only projection of file-edit events owned by the session. */
export class DiffViewer {
readonly root: BoxRenderable
private readonly header: TextRenderable
-1
View File
@@ -53,7 +53,6 @@ export function footerTelemetry(
return new StyledText([chunk(`${percentage}% context`, theme.accent, true)])
}
/** Give shortcuts visual hierarchy without turning the footer into a toolbar. */
export function footerHints(hints: readonly FooterHint[], theme: FooterHintTheme): StyledText {
const chunks: TextChunk[] = []
hints.forEach((hint, index) => {
-1
View File
@@ -26,7 +26,6 @@ interface RecoveryNoticeOptions {
onDismiss: () => void
}
/** A quiet action surface for a gateway-owned interrupted turn. */
export class RecoveryNotice {
readonly root: BoxRenderable
private readonly title: TextRenderable
-2
View File
@@ -41,7 +41,6 @@ interface RuntimeControlsOptions {
onVisibilityChange: (visible: boolean) => void
}
/** Model and workspace policy controls expose one small, mouse-optional interface. */
export class RuntimeControls {
readonly modelText: TextRenderable
readonly accessText: TextRenderable
@@ -110,7 +109,6 @@ export class RuntimeControls {
this.contextText.content = text
}
/** Warm the small settings payload while the user is reading the first frame. */
preload(): void {
void this.load().catch(() => {})
}
-1
View File
@@ -75,7 +75,6 @@ describe("UsagePanel", () => {
const split = bars.find((span) => span.text.includes("▆"))!
expect(split.fg.equals(cachedColor)).toBe(true)
expect(split.bg.equals(uncachedColor)).toBe(true)
// Every solid cell below the split is cached; the cell above is uncached.
expect(bars.filter((span) => span.fg.equals(cachedColor)).length).toBe(height === 30 ? 5 : 1)
expect(setup.captureSpans().lines.flatMap((line) => line.spans)
.filter((span) => span.bg.equals(uncachedColor)).map((span) => span.text)).toEqual(["▆▆▆"])
-1
View File
@@ -35,7 +35,6 @@ function chunk(text: string, color: ColorInput, bold = false): TextChunk {
}
}
/** A bounded, read-only view of persisted model-call usage. */
export class UsagePanel {
readonly root: BoxRenderable
private readonly body: TextRenderable