Skip to content

The agent that grows with you

fmt(js): `npm run fix` on merge (#89619)

hermes-seaeye[bot]b7bed2419e65
diff --git a/apps/desktop/src/app/session/hooks/use-message-stream/gateway-event.ts b/apps/desktop/src/app/session/hooks/use-message-stream/gateway-event.ts
index a4d00bb0a76..df6e4c5b880 100644
--- a/apps/desktop/src/app/session/hooks/use-message-stream/gateway-event.ts
+++ b/apps/desktop/src/app/session/hooks/use-message-stream/gateway-event.ts
@@ -25,7 +25,13 @@ import { invalidateSlashCompletions } from '@/lib/slash-completion-cache'
import { type AgentNoticePayload, clearAgentNotice, nativeNoticeInput, showAgentNotice } from '@/store/agent-notices'
import { reconcileApprovalModeForProfile } from '@/store/approval-mode'
import { billingCtaLabel, clearBillingBlock, runBillingRecovery, setBillingBlock } from '@/store/billing-block'
-import { clearClarifyRequest, normalizeChoices, normalizeQuestions, setClarifyRequest, warnDroppedChoices } from '@/store/clarify'
+import {
+ clearClarifyRequest,
+ normalizeChoices,
+ normalizeQuestions,
+ setClarifyRequest,
+ warnDroppedChoices
+} from '@/store/clarify'
import { setSessionCompacting } from '@/store/compaction'
import { refreshBackgroundProcesses } from '@/store/composer-status'
import { $gateway, activeGatewayConnectionId } from '@/store/gateway'
@@ -1169,6 +1175,7 @@ export function useGatewayEventHandler(deps: GatewayEventDeps) {
// on the wire. `answers` rides along only on reconnect replay, carrying
// the per-question locks the server already accepted.
const questions = normalizeQuestions(payload?.questions)
+
const lockedAnswers =
typeof payload?.answers === 'object' && payload?.answers !== null
? Object.fromEntries(
diff --git a/apps/desktop/src/components/assistant-ui/clarify-tool.test.tsx b/apps/desktop/src/components/assistant-ui/clarify-tool.test.tsx
index 0da12eba131..5660ace8664 100644
--- a/apps/desktop/src/components/assistant-ui/clarify-tool.test.tsx
+++ b/apps/desktop/src/components/assistant-ui/clarify-tool.test.tsx
@@ -453,10 +453,7 @@ describe('ClarifyTool pending marker', () => {
function batchArgs(): { questions: { question: string; choices?: string[] }[] } {
return {
- questions: [
- { choices: ['red', 'blue'], question: 'Color?' },
- { question: 'Name?' }
- ]
+ questions: [{ choices: ['red', 'blue'], question: 'Color?' }, { question: 'Name?' }]
}
}
diff --git a/apps/desktop/src/components/assistant-ui/clarify-tool.tsx b/apps/desktop/src/components/assistant-ui/clarify-tool.tsx
index b7f0fabd97c..67624f0979b 100644
--- a/apps/desktop/src/components/assistant-ui/clarify-tool.tsx
+++ b/apps/desktop/src/components/assistant-ui/clarify-tool.tsx
@@ -394,13 +394,7 @@ function ClarifyToolPending(props: ToolCallMessagePartProps) {
return <ClarifyToolSinglePending fromArgs={fromArgs} request={request} />
}
-function ClarifyToolSinglePending({
- fromArgs,
- request
-}: {
- fromArgs: ClarifyArgs
- request: ClarifyRequest | null
-}) {
+function ClarifyToolSinglePending({ fromArgs, request }: { fromArgs: ClarifyArgs; request: ClarifyRequest | null }) {
const { t } = useI18n()
const copy = t.assistant.clarify
const gateway = useStore($gateway)
@@ -1011,6 +1005,7 @@ function ClarifyToolBatchPending({ request }: { request: ClarifyRequest | null }
const toggleChoice = useCallback((question: ClarifyQuestion, choice: string) => {
setStaged(current => {
const stage = current[question.qid] ?? emptyStage
+
const next = question.multiSelect
? stage.choices.includes(choice)
? stage.choices.filter(value => value !== choice)
diff --git a/apps/desktop/src/lib/chat-messages.ts b/apps/desktop/src/lib/chat-messages.ts
index 937a1024344..ea33f0c0af1 100644
--- a/apps/desktop/src/lib/chat-messages.ts
+++ b/apps/desktop/src/lib/chat-messages.ts
@@ -619,6 +619,7 @@ function collectToolMatchValues(query: string, context: string, preview: string)
function toolPayloadMatchValues(payload: GatewayEventPayload | undefined): string[] {
const payloadArgs = liveToolArgs(payload)
+
// `question` is clarify's identifying arg: a synthetic row hydrated from
// `clarify.request` (a fresh request id) must correlate with the `tool.start`
// row (the model's tool_call_id) so the two ids don't produce a duplicate
@@ -627,6 +628,7 @@ function toolPayloadMatchValues(payload: GatewayEventPayload | undefined): strin
const query =
firstStringField(payloadArgs, ['search_term', 'query', 'question', 'server', 'command', 'code', 'path']) ||
batchClarifyMatchValue(payloadArgs.questions)
+
const context = typeof payload?.context === 'string' ? payload.context.trim() : ''
const preview = typeof payload?.preview === 'string' ? payload.preview.trim() : ''
@@ -668,9 +670,11 @@ function toolPartMatchValues(part: ChatMessagePart): string[] {
}
const args = part.args as Record<string, unknown>
+
const query =
firstStringField(args, ['search_term', 'query', 'question', 'server', 'command', 'code', 'path']) ||
batchClarifyMatchValue(args.questions)
+
const context = typeof args.context === 'string' ? args.context.trim() : ''
const preview = typeof args.preview === 'string' ? args.preview.trim() : ''
diff --git a/ui-tui/src/__tests__/createGatewayEventHandler.test.ts b/ui-tui/src/__tests__/createGatewayEventHandler.test.ts
index 3ff7615d005..d36dbfa224a 100644
--- a/ui-tui/src/__tests__/createGatewayEventHandler.test.ts
+++ b/ui-tui/src/__tests__/createGatewayEventHandler.test.ts
@@ -1646,7 +1646,10 @@ describe('createGatewayEventHandler', () => {
payload: {
choices: ['x', 'y'],
question: 'Fallback?',
- questions: [{ qid: '', question: 'no qid' }, { qid: 'q1', question: ' ' }],
+ questions: [
+ { qid: '', question: 'no qid' },
+ { qid: 'q1', question: ' ' }
+ ],
request_id: 'req-bad'
},
type: 'clarify.request'
diff --git a/ui-tui/src/app/useMainApp.ts b/ui-tui/src/app/useMainApp.ts
index cb931e55c10..00eeab2ec19 100644
--- a/ui-tui/src/app/useMainApp.ts
+++ b/ui-tui/src/app/useMainApp.ts
@@ -35,7 +35,13 @@ import { DEFAULT_VOICE_RECORD_KEY, isMac, type ParsedVoiceRecordKey } from '../l
import { createResizeCoalescer } from '../lib/resizeCoalescer.js'
import { asRpcResult, rpcErrorMessage } from '../lib/rpc.js'
import { terminalParityHints } from '../lib/terminalParity.js'
-import { buildToolTrailLine, formatAbandonedClarify, formatAbandonedClarifyBatch, sameToolTrailGroup, toolTrailLabel } from '../lib/text.js'
+import {
+ buildToolTrailLine,
+ formatAbandonedClarify,
+ formatAbandonedClarifyBatch,
+ sameToolTrailGroup,
+ toolTrailLabel
+} from '../lib/text.js'
import { estimatedMsgHeight, messageHeightKey } from '../lib/virtualHeights.js'
import { onUserWidgets } from '../sdk/userWidgets.js'
import type { Msg, PanelSection, SlashCatalog } from '../types.js'
diff --git a/ui-tui/src/lib/text.test.ts b/ui-tui/src/lib/text.test.ts
index 6c3b87e6903..98c79300754 100644
--- a/ui-tui/src/lib/text.test.ts
+++ b/ui-tui/src/lib/text.test.ts
@@ -1,6 +1,11 @@
import { describe, expect, it } from 'vitest'
-import { clarifyBatchRevisitState, formatAbandonedClarify, formatAbandonedClarifyBatch, stripTrailingPasteNewlines } from './text.js'
+import {
+ clarifyBatchRevisitState,
+ formatAbandonedClarify,
+ formatAbandonedClarifyBatch,
+ stripTrailingPasteNewlines
+} from './text.js'
describe('stripTrailingPasteNewlines', () => {
it('removes trailing newline runs from pasted text', () => {
@@ -63,9 +68,7 @@ describe('formatAbandonedClarifyBatch', () => {
'timed out'
)
- expect(out).toBe(
- ['ask (2 questions)', ' ✓ One? → alpha', ' · Two? (no answer)', ' (timed out)'].join('\n')
- )
+ expect(out).toBe(['ask (2 questions)', ' ✓ One? → alpha', ' · Two? (no answer)', ' (timed out)'].join('\n'))
})
it('treats an empty locked answer as unanswered in the record', () => {