fix(tsc): Phase 3c — fix 33 type errors in contextCollapse + UI stubs (120→87)

This commit is contained in:
James Feng 2026-06-07 11:13:19 +08:00
parent 76965c5e8c
commit 38dde66af1
6 changed files with 37 additions and 10 deletions

View File

@ -24,10 +24,10 @@ export function BashModeProgress({
/> />
{progress ? ( {progress ? (
<ShellProgressMessage <ShellProgressMessage
fullOutput={progress.fullOutput} fullOutput={progress.fullOutput as string}
output={progress.output} output={progress.output as string}
elapsedTimeSeconds={progress.elapsedTimeSeconds} elapsedTimeSeconds={progress.elapsedTimeSeconds as number}
totalLines={progress.totalLines} totalLines={progress.totalLines as number}
verbose={verbose} verbose={verbose}
/> />
) : ( ) : (

View File

@ -1,4 +1,5 @@
import type { BetaToolUnion } from '@anthropic-ai/sdk/resources/beta/messages/messages.mjs' import type { BetaToolUnion } from '@anthropic-ai/sdk/resources/beta/messages/messages.mjs'
import type { ChatCompletionCreateParamsStreaming } from 'openai/resources/chat/completions/completions.mjs'
import type { SystemPrompt } from '../../../utils/systemPromptType.js' import type { SystemPrompt } from '../../../utils/systemPromptType.js'
import type { import type {
Message, Message,
@ -7,6 +8,7 @@ import type {
AssistantMessage, AssistantMessage,
UserMessage, UserMessage,
} from '../../../types/message.js' } from '../../../types/message.js'
import type { AgentId } from '../../../types/ids.js'
import type { Tools } from '../../../Tool.js' import type { Tools } from '../../../Tool.js'
import { getOpenAIClient } from './client.js' import { getOpenAIClient } from './client.js'
import { anthropicMessagesToOpenAI } from './convertMessages.js' import { anthropicMessagesToOpenAI } from './convertMessages.js'
@ -122,7 +124,7 @@ function assembleFinalAssistantOutputs(params: {
outputs.push({ outputs.push({
message: { message: {
...partialMessage, ...partialMessage,
content: normalizeContentFromAPI(allBlocks, tools, agentId), content: normalizeContentFromAPI(allBlocks, tools, agentId as AgentId),
usage, usage,
stop_reason: stopReason, stop_reason: stopReason,
stop_sequence: null, stop_sequence: null,
@ -222,7 +224,7 @@ export async function* queryModelOpenAI(
// Filter out non-standard tools (server tools like advisor) // Filter out non-standard tools (server tools like advisor)
const standardTools = toolSchemas.filter( const standardTools = toolSchemas.filter(
(t): t is BetaToolUnion & { type: string } => { (t): t is BetaToolUnion & { type: string } => {
const anyT = t as Record<string, unknown> const anyT = t as unknown as Record<string, unknown>
return ( return (
anyT.type !== 'advisor_20260301' && anyT.type !== 'computer_20250124' anyT.type !== 'advisor_20260301' && anyT.type !== 'computer_20250124'
) )
@ -285,7 +287,7 @@ export async function* queryModelOpenAI(
// 8. Get client and make streaming request // 8. Get client and make streaming request
const client = getOpenAIClient({ const client = getOpenAIClient({
maxRetries: 0, maxRetries: 0,
fetchOverride: options.fetchOverride, fetchOverride: options.fetchOverride as unknown as typeof fetch | undefined,
source: options.querySource, source: options.querySource,
}) })

View File

@ -2,6 +2,15 @@ interface CollapseStats {
totalMessages: number totalMessages: number
collapsedMessages: number collapsedMessages: number
emptySpawnWarningEmitted: boolean emptySpawnWarningEmitted: boolean
health: {
totalSpawns: number
totalErrors: number
lastError?: string
emptySpawnWarningEmitted: boolean
totalEmptySpawns: number
}
collapsedSpans: number
stagedSpans: number
} }
export function getStats(): CollapseStats { export function getStats(): CollapseStats {
@ -9,6 +18,14 @@ export function getStats(): CollapseStats {
totalMessages: 0, totalMessages: 0,
collapsedMessages: 0, collapsedMessages: 0,
emptySpawnWarningEmitted: false, emptySpawnWarningEmitted: false,
health: {
totalSpawns: 0,
totalErrors: 0,
emptySpawnWarningEmitted: false,
totalEmptySpawns: 0,
},
collapsedSpans: 0,
stagedSpans: 0,
} }
} }

View File

@ -5,6 +5,6 @@
import React from 'react' import React from 'react'
export function Byline(): React.ReactNode { export function Byline({ children: _children }: { children?: React.ReactNode }): React.ReactNode {
return null return null
} }

View File

@ -5,6 +5,14 @@
import React from 'react' import React from 'react'
export function Dialog({ children }: { children?: React.ReactNode }): React.ReactNode { type DialogProps = {
children?: React.ReactNode
title?: string
subtitle?: React.ReactNode
onCancel?: () => void
inputGuide?: () => React.ReactNode
}
export function Dialog({ children, title: _title, subtitle: _subtitle, onCancel: _onCancel, inputGuide: _inputGuide }: DialogProps): React.ReactNode {
return <>{children}</> return <>{children}</>
} }

View File

@ -5,6 +5,6 @@
import React from 'react' import React from 'react'
export function KeyboardShortcutHint(): React.ReactNode { export function KeyboardShortcutHint({ shortcut: _shortcut, action: _action }: { shortcut?: string; action?: string }): React.ReactNode {
return null return null
} }