refactor: group native chat tool presentation modules (#33515)

This commit is contained in:
Neil
2026-10-25 08:29:47 -07:00
committed by GitHub
parent cc0e35ebcc
commit 4e3014a70e
62 changed files with 122 additions and 100 deletions
+9 -9
View File
@@ -11556,7 +11556,7 @@
"src/shared/native-chat-ask.test.ts": 51,
"src/shared/native-chat-background-task-row.test.ts": 45,
"src/shared/native-chat-command-envelope.test.ts": 37,
"src/shared/native-chat-command-output.test.ts": 47,
"src/shared/native-chat/tools/native-chat-command-output.test.ts": 47,
"src/shared/native-chat-context-usage.test.ts": 35,
"src/shared/native-chat-cut-turn-notice.test.ts": 364,
"src/shared/native-chat/tools/native-chat-edit-normalize.test.ts": 419,
@@ -11587,18 +11587,18 @@
"src/shared/native-chat-tool-activity.test.ts": 49,
"src/shared/native-chat/tools/native-chat-tool-attribution-allocation.test.ts": 112,
"src/shared/native-chat-tool-fold-attribution.test.ts": 39,
"src/shared/native-chat-tool-icon.test.ts": 83,
"src/shared/native-chat-tool-identity.test.ts": 64,
"src/shared/native-chat-tool-line-identity.test.ts": 33,
"src/shared/native-chat/tools/native-chat-tool-icon.test.ts": 83,
"src/shared/native-chat/tools/native-chat-tool-identity.test.ts": 64,
"src/shared/native-chat/tools/native-chat-tool-line-identity.test.ts": 33,
"src/shared/native-chat-tool-pair-limit.test.ts": 75,
"src/shared/native-chat/tools/native-chat-tool-pairing.performance.test.ts": 463,
"src/shared/native-chat-tool-pairing.test.ts": 41,
"src/shared/native-chat-tool-preview-prefix.test.ts": 31,
"src/shared/native-chat-tool-preview-scan.test.ts": 37,
"src/shared/native-chat/tools/native-chat-tool-preview-prefix.test.ts": 31,
"src/shared/native-chat/tools/native-chat-tool-preview-scan.test.ts": 37,
"src/shared/native-chat-tool-result-orphans.test.ts": 294,
"src/shared/native-chat-tool-run-outcome.test.ts": 58,
"src/shared/native-chat-tool-run-sentence.test.ts": 52,
"src/shared/native-chat-tool-summary.test.ts": 61,
"src/shared/native-chat/tools/native-chat-tool-run-outcome.test.ts": 58,
"src/shared/native-chat/tools/native-chat-tool-run-sentence.test.ts": 52,
"src/shared/native-chat/tools/native-chat-tool-summary.test.ts": 61,
"src/shared/native-chat-transcript-projection.test.ts": 250,
"src/shared/native-chat-transcript-retention.test.ts": 56,
"src/shared/native-chat-turn-activity.test.ts": 216,
+3 -3
View File
@@ -34,12 +34,12 @@
"contextSha256": "747ec5af67a0b60890da900a83fa255d3b96e2fa17d9199f8e483ef5051b213c"
},
{
"file": "src/shared/native-chat-tool-identity.ts",
"file": "src/shared/native-chat/tools/native-chat-tool-identity.ts",
"inputs": [],
"emptyEnv": [],
"sourceClosureSha256": "08558478f5a5a6c0aa2e4e4d92d609ff55c11564d04a957f999f2302c478ae80",
"sourceClosureSha256": "1e813201b2fb133e5166c14223d6d04bca99c2946c8dca5db155420a2b41d36c",
"reason": "Reviewed data/URL parsing only; no indirect repository input. Imported source dependencies remain graph edges.",
"contextSha256": "747ec5af67a0b60890da900a83fa255d3b96e2fa17d9199f8e483ef5051b213c"
"contextSha256": "030c2dd077f6b9d453554d2bb85b9a3362ef3d7c8f3f5def5c3821112f6c0632"
},
{
"file": "src/shared/pairing.ts",
@@ -4,26 +4,44 @@ import { dirname, resolve } from 'node:path'
import assert from 'node:assert/strict'
import { build } from 'esbuild'
const file = 'src/shared/native-chat-tool-summary.ts'
const currentFile = 'src/shared/native-chat/tools/native-chat-tool-summary.ts'
const baseline = process.argv[2] ?? '20ab9950654'
const beforeSource = execFileSync('git', ['show', `${baseline}:${file}`], {
encoding: 'utf8',
windowsHide: true
})
const afterSource = fs.readFileSync(file, 'utf8')
async function load(contents) {
const afterSource = fs.readFileSync(currentFile, 'utf8')
async function load(contents, sourceFile = file) {
const { outputFiles } = await build({
stdin: { contents, loader: 'ts', resolveDir: dirname(resolve(file)) },
stdin: { contents, loader: 'ts', resolveDir: dirname(resolve(sourceFile)) },
bundle: true,
platform: 'node',
format: 'esm',
write: false
write: false,
plugins: [
{
name: 'relocated-current-preview-dependencies',
setup(builder) {
builder.onResolve({ filter: /^\./ }, (args) => {
const target = resolve(args.resolveDir, args.path)
for (const name of ['native-chat-tool-preview-prefix', 'native-chat-tool-identity']) {
const previous = resolve('src/shared', name)
if (target === previous || target === `${previous}.ts`) {
return { path: resolve('src/shared/native-chat/tools', `${name}.ts`) }
}
}
return undefined
})
}
}
]
})
return import(
`data:text/javascript;base64,${Buffer.from(outputFiles[0].text).toString('base64')}`
)
}
const before = await load(beforeSource),
after = await load(afterSource)
after = await load(afterSource, currentFile)
const display = (m, input) => {
const d = m.createToolInputDisplay(input)
return { ...d, formatDetail: d.formatDetail() }
@@ -11,7 +11,7 @@ import {
type NativeChatEditFile,
type NativeChatEditLine
} from '../../../src/shared/native-chat/tools/native-chat-edit-model'
import { NATIVE_CHAT_TOOL_ROW_VERB_COPY } from '../../../src/shared/native-chat-tool-line-label'
import { NATIVE_CHAT_TOOL_ROW_VERB_COPY } from '../../../src/shared/native-chat/tools/native-chat-tool-line-label'
import { MobileSourceCopyButton } from '../components/MobileSourceCopyButton'
import { colors } from '../theme/mobile-theme'
import { useMobileNativeChatOpenedDetail } from './mobile-native-chat-opened-detail'
@@ -3,7 +3,7 @@ import { Pressable, Text, View, type TextStyle } from 'react-native'
import {
truncateToolDetail,
MAX_TOOL_DETAIL_LENGTH
} from '../../../src/shared/native-chat-tool-summary'
} from '../../../src/shared/native-chat/tools/native-chat-tool-summary'
import type {
NativeChatMessage,
NativeChatToolResultBlock
@@ -3,7 +3,7 @@ import { Text, View } from 'react-native'
import { INLINE_TEXT_SELECTION } from '../components/inline-text-selection'
import { MobileNativeChatLongPressContent as Content } from './MobileNativeChatLongPressContent'
import { splitNativeChatBlocks } from '../../../src/shared/native-chat/tools/native-chat-tool-fold'
import { selectActiveToolCall } from '../../../src/shared/native-chat-tool-activity'
import { selectActiveToolCall } from '../../../src/shared/native-chat/tools/native-chat-tool-activity'
import {
isImageRefBlock,
isSubagentGroupBlock,
@@ -13,7 +13,7 @@ import {
Wrench,
type LucideIcon
} from 'lucide-react-native'
import type { NativeChatToolIconName } from '../../../src/shared/native-chat-tool-icon'
import type { NativeChatToolIconName } from '../../../src/shared/native-chat/tools/native-chat-tool-icon'
const GLYPHS: Record<NativeChatToolIconName, LucideIcon> = {
eye: Eye,
@@ -13,12 +13,12 @@ import {
mcpToolIdentity,
toolWebSearchResults,
type NativeChatWebSearchResult
} from '../../../src/shared/native-chat-tool-identity'
import { nativeChatToolIconName } from '../../../src/shared/native-chat-tool-icon'
} from '../../../src/shared/native-chat/tools/native-chat-tool-identity'
import { nativeChatToolIconName } from '../../../src/shared/native-chat/tools/native-chat-tool-icon'
import {
NATIVE_CHAT_TOOL_ROW_VERB_COPY,
nativeChatToolLineLabel
} from '../../../src/shared/native-chat-tool-line-label'
} from '../../../src/shared/native-chat/tools/native-chat-tool-line-label'
import {
isToolCallBlock,
type NativeChatToolCallBlock,
@@ -2,7 +2,7 @@ import { createElement, type ReactNode } from 'react'
import { act, create, type ReactTestInstance, type ReactTestRenderer } from 'react-test-renderer'
import { afterEach, describe, expect, it, vi } from 'vitest'
import type { AgentJournalToolCallItem } from '../../../src/shared/agent-session-journal-types'
import { MAX_TOOL_DETAIL_LENGTH } from '../../../src/shared/native-chat-tool-summary'
import { MAX_TOOL_DETAIL_LENGTH } from '../../../src/shared/native-chat/tools/native-chat-tool-summary'
import { projectStructuredItemToNativeChat } from '../../../src/shared/structured-agent-session-projection'
import type {
NativeChatBlock,
@@ -23,16 +23,16 @@ import {
describeLatestToolCall,
NATIVE_CHAT_TOOL_ACTIVITY_COPY,
selectActiveToolCall
} from '../../../src/shared/native-chat-tool-activity'
import { nativeChatToolRunIconName } from '../../../src/shared/native-chat-tool-icon'
import { nativeChatToolLineIdentity } from '../../../src/shared/native-chat-tool-line-identity'
} from '../../../src/shared/native-chat/tools/native-chat-tool-activity'
import { nativeChatToolRunIconName } from '../../../src/shared/native-chat/tools/native-chat-tool-icon'
import { nativeChatToolLineIdentity } from '../../../src/shared/native-chat/tools/native-chat-tool-line-identity'
import { pairNativeChatToolResults } from '../../../src/shared/native-chat/tools/native-chat-tool-pairing'
import { nativeChatToolRunOutcome } from '../../../src/shared/native-chat-tool-run-outcome'
import { nativeChatToolRunOutcome } from '../../../src/shared/native-chat/tools/native-chat-tool-run-outcome'
import {
NATIVE_CHAT_TOOL_RUN_SENTENCE_ENGLISH,
nativeChatToolRunSentence
} from '../../../src/shared/native-chat-tool-run-sentence'
import { countToolCalls } from '../../../src/shared/native-chat-tool-summary'
} from '../../../src/shared/native-chat/tools/native-chat-tool-run-sentence'
import { countToolCalls } from '../../../src/shared/native-chat/tools/native-chat-tool-summary'
import { buildEditCards } from '../../../src/shared/native-chat/tools/native-chat-edit-cards'
import {
isToolCallBlock,
@@ -1,5 +1,8 @@
import { describe, expect, it, vi } from 'vitest'
import { summarizeToolInput, toolFilePath } from '../../../src/shared/native-chat-tool-summary'
import {
summarizeToolInput,
toolFilePath
} from '../../../src/shared/native-chat/tools/native-chat-tool-summary'
describe('summarizeToolInput', () => {
it('passes short strings through, collapsing whitespace', () => {
@@ -2,7 +2,7 @@ import { describe, expect, it } from 'vitest'
import { agentJournalItemKey } from '../../shared/agent-session-journal-item-key'
import { cancelledJournalPromptBody } from '../native-chat/agent-session-journal/journal-prompt-body-bounds'
import { MAX_JOURNAL_LIFECYCLE_BATCH_BYTES } from '../native-chat/agent-session-journal/journal-row-schema'
import { MAX_TOOL_DETAIL_LENGTH } from '../../shared/native-chat-tool-summary'
import { MAX_TOOL_DETAIL_LENGTH } from '../../shared/native-chat/tools/native-chat-tool-summary'
import { claudeApprovalItem, claudeQuestionItems } from './claude-structured-prompt-items'
import {
buildClaudePromptReply,
@@ -5,7 +5,10 @@ import type {
AgentJournalQuestion,
AgentJournalQuestionItem
} from '../../shared/agent-session-journal-types'
import { formatToolInput, truncateToolDetail } from '../../shared/native-chat-tool-summary'
import {
formatToolInput,
truncateToolDetail
} from '../../shared/native-chat/tools/native-chat-tool-summary'
import { isPlanApprovalSubject } from '../../shared/agent-session-approval-subject'
import { boundJournalPromptBody } from '../native-chat/agent-session-journal/journal-prompt-body-bounds'
import { claudeRecord, claudeText } from './claude-structured-item-translation'
@@ -3,7 +3,7 @@
// agentsStates holds caller snapshots; child turn frames determine execution state.
import { codexCollabToolRowName } from '../../shared/codex-collab-agent-tools'
import { collapsedToolInputPrefix } from '../../shared/native-chat-tool-preview-prefix'
import { collapsedToolInputPrefix } from '../../shared/native-chat/tools/native-chat-tool-preview-prefix'
import { readRecord, readString } from './codex-item-field-readers'
import type { CodexThreadItem } from './codex-thread-item-identity'
@@ -1,5 +1,5 @@
import type { AgentJournalItemIdentity } from '../../shared/agent-session-journal-types'
import { toolExecutionMetadata } from '../../shared/native-chat-tool-identity'
import { toolExecutionMetadata } from '../../shared/native-chat/tools/native-chat-tool-identity'
import type { CodexItemStreamState } from './codex-structured-item-stream-contracts'
import type { CodexThreadItem } from './codex-thread-item-identity'
@@ -4,7 +4,7 @@ import {
briefToolArg,
createToolInputDisplay,
describeToolInput
} from '../../shared/native-chat-tool-summary'
} from '../../shared/native-chat/tools/native-chat-tool-summary'
import {
codexItemBody,
codexItemIdentity,
@@ -1,4 +1,7 @@
import { toolExecutionMetadata, toolWebSearchResults } from '../../shared/native-chat-tool-identity'
import {
toolExecutionMetadata,
toolWebSearchResults
} from '../../shared/native-chat/tools/native-chat-tool-identity'
import type { AgentJournalItemBody } from '../../shared/agent-session-journal-types'
import type { NativeChatBlock } from '../../shared/native-chat-types'
import { CODEX_ASYNC_QUESTION_TOOL } from '../../shared/codex-async-question-input'
@@ -1,7 +1,7 @@
import { readFileSync } from 'node:fs'
import { join } from 'node:path'
import { describe, expect, it } from 'vitest'
import { surfaceNativeChatCommandOutputs } from '../../shared/native-chat-command-output'
import { surfaceNativeChatCommandOutputs } from '../../shared/native-chat/tools/native-chat-command-output'
import { stripNoiseMessages } from '../../shared/native-chat-noise'
import type { NativeChatMessage } from '../../shared/native-chat-types'
import { decodeClaudeTranscriptLine } from './transcript-line-decoders-claude'
@@ -1,5 +1,5 @@
import { useMemo } from 'react'
import { formatToolDuration } from '../../../../shared/native-chat-tool-identity'
import { formatToolDuration } from '../../../../shared/native-chat/tools/native-chat-tool-identity'
import { IpynbCellOutputs } from './IpynbCellOutputs'
import { IpynbRunPrompt } from './IpynbCellToolbar'
import { useCellRun } from './ipynb-kernel-store'
@@ -7,7 +7,7 @@ import {
formatToolDuration,
mcpToolIdentity,
toolWebSearchResults
} from '../../../../shared/native-chat-tool-identity'
} from '../../../../shared/native-chat/tools/native-chat-tool-identity'
export function NativeChatToolName({
name,
@@ -12,13 +12,13 @@ import {
SquareTerminal,
Wrench
} from 'lucide-react'
import type { NativeChatMcpIdentity } from '../../../../shared/native-chat-tool-identity'
import type { NativeChatMcpIdentity } from '../../../../shared/native-chat/tools/native-chat-tool-identity'
import type { LucideIcon } from 'lucide-react'
import { cn } from '@/lib/utils'
import {
nativeChatToolIconName,
type NativeChatToolIconName
} from '../../../../shared/native-chat-tool-icon'
} from '../../../../shared/native-chat/tools/native-chat-tool-icon'
const NATIVE_CHAT_TOOL_GLYPHS: Record<NativeChatToolIconName, LucideIcon> = {
eye: Eye,
@@ -12,9 +12,11 @@ import type {
AgentJournalItemBody
} from '../../../../shared/agent-session-journal-types'
import type { NativeChatToolResultBlock } from '../../../../shared/native-chat-types'
import { MAX_TOOL_DETAIL_LENGTH } from '../../../../shared/native-chat-tool-summary'
import {
MAX_TOOL_DETAIL_LENGTH,
truncateToolDetail
} from '../../../../shared/native-chat/tools/native-chat-tool-summary'
import { useNativeChatVisualOwner } from './native-chat-visual-owner'
import { truncateToolDetail } from './native-chat-tool-summary'
/** A partial detail response retains its original byte count. */
type FullOutput = { text: string; partial: { shown: number; total: number } | null }
@@ -15,15 +15,15 @@ import {
} from '../../../../shared/native-chat-types'
import { isRenderableSubagentGroup } from '../../../../shared/native-chat-subagent-summary'
import type { NativeChatDiffReveal } from './native-chat-turn-diffs'
import { countToolCalls } from './native-chat-tool-summary'
import { countToolCalls } from '../../../../shared/native-chat/tools/native-chat-tool-summary'
import { nativeChatToolRunSentence } from './native-chat-tool-run-label'
import {
describeLatestToolCall,
NATIVE_CHAT_TOOL_ACTIVITY_COPY,
selectActiveToolCall
} from '../../../../shared/native-chat-tool-activity'
import { nativeChatToolRunIconName } from '../../../../shared/native-chat-tool-icon'
import { nativeChatToolRunOutcome } from '../../../../shared/native-chat-tool-run-outcome'
} from '../../../../shared/native-chat/tools/native-chat-tool-activity'
import { nativeChatToolRunIconName } from '../../../../shared/native-chat/tools/native-chat-tool-icon'
import { nativeChatToolRunOutcome } from '../../../../shared/native-chat/tools/native-chat-tool-run-outcome'
import {
nativeChatAskRunBlocks,
nativeChatAskRunSubject
@@ -1,5 +1,5 @@
import { translate } from '@/i18n/i18n'
import { NATIVE_CHAT_TOOL_ACTIVITY_COPY } from '../../../../shared/native-chat-tool-activity'
import { NATIVE_CHAT_TOOL_ACTIVITY_COPY } from '../../../../shared/native-chat/tools/native-chat-tool-activity'
/** Count failures separately from calls interrupted by Stop. */
export function NativeChatToolRunCallCounts({
@@ -2,7 +2,7 @@ import { useMemo } from 'react'
import type { CommentMarkdownLinkClickHandler } from '@/components/sidebar/CommentMarkdown'
import type { NativeChatBlock, NativeChatToolCallBlock } from '../../../../shared/native-chat-types'
import { pairNativeChatToolResults } from '../../../../shared/native-chat/tools/native-chat-tool-pairing'
import { nativeChatToolLineIdentity } from '../../../../shared/native-chat-tool-line-identity'
import { nativeChatToolLineIdentity } from '../../../../shared/native-chat/tools/native-chat-tool-line-identity'
import { NativeChatDiffCard } from './NativeChatDiffCard'
import { NativeChatTaskList } from './NativeChatTaskList'
import { NativeChatToolLine } from './NativeChatToolLine'
@@ -1,6 +1,6 @@
import { describe, expect, it } from 'vitest'
import en from '@/i18n/locales/en.json'
import { NATIVE_CHAT_TOOL_ACTIVITY_COPY } from '../../../../shared/native-chat-tool-activity'
import { NATIVE_CHAT_TOOL_ACTIVITY_COPY } from '../../../../shared/native-chat/tools/native-chat-tool-activity'
import {
NATIVE_CHAT_COMPOSER_PLACEHOLDER,
NATIVE_CHAT_TURN_STATUS_COPY
@@ -9,8 +9,8 @@ import {
NATIVE_CHAT_TOOL_RUN_LIVE_SENTENCE_COPY,
NATIVE_CHAT_TOOL_RUN_SENTENCE_COPY,
NATIVE_CHAT_TOOL_RUN_SENTENCE_JOINERS
} from '../../../../shared/native-chat-tool-run-sentence'
import { NATIVE_CHAT_TOOL_ROW_VERB_COPY } from '../../../../shared/native-chat-tool-line-label'
} from '../../../../shared/native-chat/tools/native-chat-tool-run-sentence'
import { NATIVE_CHAT_TOOL_ROW_VERB_COPY } from '../../../../shared/native-chat/tools/native-chat-tool-line-label'
import { NATIVE_CHAT_DIFF_CARD_COPY } from '../../../../shared/native-chat/tools/native-chat-edit-cards'
import { NATIVE_CHAT_TASK_LIST_COPY } from '../../../../shared/native-chat-task-list'
@@ -3,7 +3,7 @@ import {
nativeChatToolLineLabel as sharedToolLineLabel,
type NativeChatToolLineLabel,
type NativeChatToolRowVerb
} from '../../../../shared/native-chat-tool-line-label'
} from '../../../../shared/native-chat/tools/native-chat-tool-line-label'
import type {
NativeChatToolCallBlock,
NativeChatToolResultBlock
@@ -2,8 +2,8 @@ import { translate } from '@/i18n/i18n'
import {
nativeChatToolRunSentence as sharedRunSentence,
type NativeChatToolRunSentenceWords
} from '../../../../shared/native-chat-tool-run-sentence'
import type { NativeChatToolCategory } from '../../../../shared/native-chat-tool-icon'
} from '../../../../shared/native-chat/tools/native-chat-tool-run-sentence'
import type { NativeChatToolCategory } from '../../../../shared/native-chat/tools/native-chat-tool-icon'
import type { NativeChatBlock } from '../../../../shared/native-chat-types'
/** Extraction requires literal keys/fallbacks; parity tests keep these clauses aligned with mobile’s shared record. */
@@ -5,7 +5,7 @@ import {
countToolCalls,
summarizeToolInput,
summarizeToolRun
} from './native-chat-tool-summary'
} from '../../../../shared/native-chat/tools/native-chat-tool-summary'
describe('summarizeToolInput', () => {
it('passes short strings through and collapses whitespace', () => {
@@ -1,10 +0,0 @@
export {
briefToolArg,
countToolCalls,
createToolInputDisplay,
formatToolInput,
summarizeToolInput,
summarizeToolRun,
toolFilePath,
truncateToolDetail
} from '../../../../shared/native-chat-tool-summary'
+1 -1
View File
@@ -9,7 +9,7 @@ import type { AgentSessionFailureRowWords } from './agent-session-failure-words'
import type { AgentType } from './agent-status-types'
import type { AgentSessionQuestionAnswer } from './agent-session-question-answer'
import type { AgentJournalTurnOutcome } from './agent-turn-outcome'
import type { NativeChatToolMetadata } from './native-chat-tool-identity'
import type { NativeChatToolMetadata } from './native-chat/tools/native-chat-tool-identity'
import type { AgentSessionContextUsage } from './agent-session-context-usage'
import type { AgentSessionProviderHandle } from './agent-session-provider-handle'
import type { NativeChatBlock, NativeChatRole } from './native-chat-types'
@@ -1,7 +1,7 @@
import { beforeAll, describe, expect, it } from 'vitest'
import { loadAnsiConsumers } from '../../config/scripts/check-job-log-consumer-oracles.mjs'
import { gitLabJobTraceToLogExcerpt } from './gitlab-job-log-excerpt'
import { surfaceNativeChatCommandOutputs } from './native-chat-command-output'
import { surfaceNativeChatCommandOutputs } from './native-chat/tools/native-chat-command-output'
import type { NativeChatMessage } from './native-chat-types'
import { normalizeNativeChatUserText } from './native-chat-image-transcript-markers'
@@ -3,7 +3,7 @@
import type { AgentType } from './agent-status-types'
import { getVerifiedNativeChatCommands } from './native-chat-agent-profiles'
import { surfaceSkillInvocationUserTurns } from './native-chat/native-chat-command-envelope'
import { surfaceNativeChatCommandOutputs } from './native-chat-command-output'
import { surfaceNativeChatCommandOutputs } from './native-chat/tools/native-chat-command-output'
import { normalizeImageTranscriptMessages } from './native-chat-image-transcript-markers'
import type { NativeChatMessage } from './native-chat-types'
@@ -1,6 +1,6 @@
import './native-chat-reasoning-row.spec'
import './native-chat-reasoning-order.spec'
import './native-chat-tool-activity.spec'
import './native-chat/tools/native-chat-tool-activity.spec'
import './native-chat/tools/native-chat-tool-pair-limit.spec'
import './native-chat/tools/native-chat-tool-fold-attribution.spec'
import './native-chat-turn-grouping.spec'
+4 -1
View File
@@ -3,7 +3,10 @@ import type { AgentJournalRenderItem } from './agent-session-journal-types'
import type { AgentSessionTurnActivity } from './agent-session-wire'
import { isRootAgentJournalItem } from './agent-session-journal-producer'
import { normalizePromptField } from './agent-status-field-normalization'
import { describeActiveToolCall, formatActiveToolLabel } from './native-chat-tool-activity'
import {
describeActiveToolCall,
formatActiveToolLabel
} from './native-chat/tools/native-chat-tool-activity'
export type NativeChatTurnActivity = { kind: 'description'; text: string }
+1 -1
View File
@@ -18,7 +18,7 @@ import type {
AgentJournalToolCallState
} from './agent-session-journal-types'
import type { AgentType } from './agent-status-types'
import type { NativeChatToolMetadata } from './native-chat-tool-identity'
import type { NativeChatToolMetadata } from './native-chat/tools/native-chat-tool-identity'
import type { AgentMessageSource } from './agent-session/agent-session-message-source'
export type { AgentType }
@@ -1,4 +1,4 @@
import { nativeChatToolInputText } from '../native-chat-tool-input-text'
import { nativeChatToolInputText } from './tools/native-chat-tool-input-text'
// A tool named after its shell ran there, whatever the host's own shell is.
const LANGUAGE_BY_TOOL_NAME: ReadonlyMap<string, string> = new Map([
@@ -1,7 +1,7 @@
import { describe, expect, it } from 'vitest'
import { surfaceNativeChatCommandOutputs } from './native-chat-command-output'
import { stripNoiseMessages } from './native-chat-noise'
import type { NativeChatMessage } from './native-chat-types'
import { stripNoiseMessages } from '../../native-chat-noise'
import type { NativeChatMessage } from '../../native-chat-types'
// The two user rows OpenClaude 0.31.0 writes for `/context` (its caveat row is
// `isMeta` and never decoded), as the transcript decoder emits them.
@@ -1,11 +1,11 @@
// Claude-family local-command-stdout user turns link to command envelopes. Hide effect-only feedback (/model, /compact);
// surface reporting-command replies as their answer.
import type { AgentType } from './agent-status-types'
import { stripAnsiEscapeSequences } from './ansi-escape-sequences'
import { getVerifiedNativeChatCommands } from './native-chat-agent-profiles'
import { parseNativeChatCommandEnvelope } from './native-chat/native-chat-command-envelope'
import { isTextBlock, type NativeChatMessage } from './native-chat-types'
import type { AgentType } from '../../agent-status-types'
import { stripAnsiEscapeSequences } from '../../ansi-escape-sequences'
import { getVerifiedNativeChatCommands } from '../../native-chat-agent-profiles'
import { parseNativeChatCommandEnvelope } from '../native-chat-command-envelope'
import { isTextBlock, type NativeChatMessage } from '../../native-chat-types'
const LOCAL_COMMAND_STDOUT = /^\s*<local-command-stdout>([\s\S]*?)<\/local-command-stdout>\s*$/
@@ -1,5 +1,5 @@
import { describe, expect, it } from 'vitest'
import type { NativeChatBlock } from './native-chat-types'
import type { NativeChatBlock } from '../../native-chat-types'
import {
describeActiveToolCall,
formatActiveToolLabel,
@@ -1,7 +1,7 @@
// Shared tool activity/copy for direct English mobile rows and desktop i18n fallbacks.
import { createToolInputDisplay } from './native-chat-tool-summary'
import { isToolCallBlock, type NativeChatBlock } from './native-chat-types'
import { isToolCallBlock, type NativeChatBlock } from '../../native-chat-types'
type NativeChatToolCallBlock = Extract<NativeChatBlock, { type: 'tool-call' }>
@@ -1,7 +1,7 @@
import { mcpToolIdentity, type NativeChatMcpIdentity } from './native-chat-tool-identity'
/** Share category glyphs across lifecycle states; change tone/failure marks only, preserving identity.
* Glyphs are decorative: render the identifying tool word alongside them, never alone. */
import { EDIT_TOOL_NAMES } from './native-chat/tools/native-chat-diff'
import { EDIT_TOOL_NAMES } from './native-chat-diff'
import { isCommandToolName } from './native-chat-tool-activity'
import { toolInputCommand } from './native-chat-tool-summary'
@@ -1,4 +1,4 @@
import { formatNativeChatDuration } from './native-chat-turn-status'
import { formatNativeChatDuration } from '../../native-chat-turn-status'
export type NativeChatWebSearchResult = { title: string; url: string }
@@ -1,5 +1,5 @@
import { expect, it } from 'vitest'
import type { NativeChatToolCallBlock, NativeChatToolResultBlock } from './native-chat-types'
import type { NativeChatToolCallBlock, NativeChatToolResultBlock } from '../../native-chat-types'
import { nativeChatToolLineIdentity } from './native-chat-tool-line-identity'
it('keys an anonymous mobile row by a bounded summary, so a refetched copy keeps it', () => {
@@ -1,4 +1,4 @@
import type { NativeChatBlock } from './native-chat-types'
import type { NativeChatBlock } from '../../native-chat-types'
import { summarizeToolInput } from './native-chat-tool-summary'
/** How much of an anonymous result's output identifies it, so a long log is never hashed whole. */
@@ -1,5 +1,5 @@
import { nativeChatCommandLanguage } from './native-chat/native-chat-command-language'
import { isNativeChatFileCountPath } from './native-chat/tools/native-chat-edit-patch-files'
import { nativeChatCommandLanguage } from '../native-chat-command-language'
import { isNativeChatFileCountPath } from './native-chat-edit-patch-files'
import { nativeChatToolCategory } from './native-chat-tool-icon'
import {
nativeChatFullCommand,
@@ -7,7 +7,7 @@ import {
nativeChatToolInputText
} from './native-chat-tool-input-text'
import { createToolInputDisplay, summarizeToolInput } from './native-chat-tool-summary'
import type { NativeChatToolCallBlock, NativeChatToolResultBlock } from './native-chat-types'
import type { NativeChatToolCallBlock, NativeChatToolResultBlock } from '../../native-chat-types'
/** Shared desktop/mobile tool verbs; desktop translates the English record. */
export const NATIVE_CHAT_TOOL_ROW_VERB_COPY = {
@@ -1,7 +1,7 @@
import { describe, expect, it } from 'vitest'
import { foldToolMessages } from './native-chat-tool-fold'
import { pairToolBlocks } from './native-chat-tool-pairs'
import { nativeChatToolRunOutcome } from '../../native-chat-tool-run-outcome'
import { nativeChatToolRunOutcome } from './native-chat-tool-run-outcome'
import { nativeChatWorkRunMember } from '../../native-chat-work-run'
import { nativeChatMessagesShareTranscriptRow } from '../../native-chat-types'
import type {
@@ -1,6 +1,6 @@
import { describe, expect, it } from 'vitest'
import { nativeChatToolRunOutcome } from './native-chat-tool-run-outcome'
import type { NativeChatBlock } from './native-chat-types'
import type { NativeChatBlock } from '../../native-chat-types'
function call(command: string, state?: 'running' | 'completed' | 'failed'): NativeChatBlock {
return { type: 'tool-call', name: 'shell', input: { command }, state }
@@ -1,8 +1,8 @@
// Derive success independently of live activity: no active call does not prove success, and collapsed headers must expose failures.
import { agentJournalToolCallLifecycle } from './agent-journal-tool-call-lifecycle'
import { agentJournalToolCallLifecycle } from '../../agent-journal-tool-call-lifecycle'
import { selectActiveToolCall } from './native-chat-tool-activity'
import type { NativeChatBlock } from './native-chat-types'
import type { NativeChatBlock } from '../../native-chat-types'
export type NativeChatToolRunOutcome = {
failedCallCount: number
@@ -3,7 +3,7 @@
import { nativeChatToolCategory, type NativeChatToolCategory } from './native-chat-tool-icon'
import type { NativeChatMcpIdentity } from './native-chat-tool-identity'
import { toolInputCommand } from './native-chat-tool-summary'
import { isToolCallBlock, type NativeChatBlock } from './native-chat-types'
import { isToolCallBlock, type NativeChatBlock } from '../../native-chat-types'
/** Shared singular/plural category copy; desktop translates and mobile formats directly. */
export const NATIVE_CHAT_TOOL_RUN_SENTENCE_COPY: Record<
@@ -1,5 +1,5 @@
import { describe, expect, it, vi } from 'vitest'
import type { NativeChatBlock } from './native-chat-types'
import type { NativeChatBlock } from '../../native-chat-types'
import {
briefToolArg,
createToolInputDisplay,
@@ -4,7 +4,7 @@ import {
MAX_TOOL_PREVIEW_LENGTH
} from './native-chat-tool-preview-prefix'
import type { NativeChatMcpIdentity } from './native-chat-tool-identity'
import { isToolCallBlock, type NativeChatBlock } from './native-chat-types'
import { isToolCallBlock, type NativeChatBlock } from '../../native-chat-types'
const MAX_PREVIEW_STRING_INPUT = 160
const MAX_PREVIEW_COLLECTION_ITEMS = 8
@@ -20,7 +20,7 @@ import {
AGENT_STATUS_TOOL_INPUT_MAX_LENGTH,
AGENT_STATUS_TOOL_NAME_MAX_LENGTH
} from './agent-status-types'
import { describeToolInput } from './native-chat-tool-summary'
import { describeToolInput } from './native-chat/tools/native-chat-tool-summary'
import { statusStructuredAgentSessionToolCall } from './structured-agent-session-live-turn'
import {
hasStructuredAgentSessionRequest,
@@ -4,7 +4,7 @@ import type {
AgentJournalSubmission,
AgentJournalToolCallState
} from './agent-session-journal-types'
import { describeToolInput } from './native-chat-tool-summary'
import { describeToolInput } from './native-chat/tools/native-chat-tool-summary'
import {
projectStructuredAgentSessionStatusSummary,
projectStructuredItemsToNativeChat