fmt(js): npm run fix on merge (#110837)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This commit is contained in:
hermes-seaeye[bot]
2026-09-14 12:34:28 +00:00
committed by GitHub
parent 3b733a7c8a
commit 916ef1e029
4 changed files with 48 additions and 9 deletions
@@ -22,9 +22,10 @@ export function skillActivityTitle(part: SkillCall, live = true): string | undef
const args = parseMaybeObject(part.args)
const result = parseMaybeObject(part.result)
const failed = result.success !== true && result.ok !== true && Boolean(
part.isError || extractToolErrorMessage(part.result) || result.success === false || result.ok === false
)
const failed =
result.success !== true &&
result.ok !== true &&
Boolean(part.isError || extractToolErrorMessage(part.result) || result.success === false || result.ok === false)
const pending = live && part.result === undefined && part.completedAt === undefined
const missing = !pending && part.result === undefined
@@ -15,11 +15,20 @@ describe('D1 competing implementation contracts', () => {
expect(parts).toHaveLength(2)
})
it('honors explicit successful skill results over stale envelope errors', () => {
const part = { type: 'tool-call' as const, toolName: 'skill_view', args: { name: 'loaded-skill' }, result: { success: true }, isError: true }
const part = {
type: 'tool-call' as const,
toolName: 'skill_view',
args: { name: 'loaded-skill' },
result: { success: true },
isError: true
}
expect(summarizeToolRun([part], false)).toContain('Loaded skill')
})
it('does not report a failed skill as loaded in the settled summary', () => {
const summary = summarizeToolRun([{ toolName: 'skill_view', args: { name: 'missing-skill' }, result: { error: 'missing' }, isError: true }], false)
const summary = summarizeToolRun(
[{ toolName: 'skill_view', args: { name: 'missing-skill' }, result: { error: 'missing' }, isError: true }],
false
)
expect(summary.toLowerCase()).toContain('failed')
expect(summary).not.toContain('Loaded')
})
@@ -7,11 +7,22 @@ import { sealOpenToolParts, upsertToolPart } from '@/lib/chat-messages'
import { toRuntimeMessage } from '@/lib/chat-runtime'
import { todosFromMessageContent } from '@/lib/todos'
const normalize = (parts: ReturnType<typeof upsertToolPart>) => fromThreadMessageLike(toRuntimeMessage({ id: 'd1', role: 'assistant', parts }), 'd1', getAutoStatus(false, false, false, false, undefined)).content
const normalize = (parts: ReturnType<typeof upsertToolPart>) =>
fromThreadMessageLike(
toRuntimeMessage({ id: 'd1', role: 'assistant', parts }),
'd1',
getAutoStatus(false, false, false, false, undefined)
).content
describe('D1 settlement and presentation consumers', () => {
it('seals unknown outcomes without fabricating success and remains idempotent', () => {
const messages = [{ id: 'd1', role: 'assistant' as const, parts: upsertToolPart([], { name: 'terminal', tool_id: 'missing' }, 'running', 1) }]
const messages = [
{
id: 'd1',
role: 'assistant' as const,
parts: upsertToolPart([], { name: 'terminal', tool_id: 'missing' }, 'running', 1)
}
]
const sealed = sealOpenToolParts(messages)
const part = sealed[0].parts[0]
expect('result' in part ? part.result : undefined).toBeUndefined()
@@ -20,7 +31,18 @@ describe('D1 settlement and presentation consumers', () => {
expect(sealOpenToolParts(sealed)).toBe(sealed)
})
it('keeps side-channel diffs in the changed-files consumer after normalization', () => {
const parts = upsertToolPart([], { name: 'patch', tool_id: 'patch', args: { path: '/tmp/a.ts' }, result: 'ok', inline_diff: '--- a/a.ts\n+++ b/a.ts\n@@ -1 +1 @@\n-old\n+new' }, 'complete', 2)
const parts = upsertToolPart(
[],
{
name: 'patch',
tool_id: 'patch',
args: { path: '/tmp/a.ts' },
result: 'ok',
inline_diff: '--- a/a.ts\n+++ b/a.ts\n@@ -1 +1 @@\n-old\n+new'
},
'complete',
2
)
expect(deriveChangedFiles(normalize(parts))).toEqual([{ path: '/tmp/a.ts', name: 'a.ts', added: 1, removed: 1 }])
})
it('keeps envelope-only todo completion and explicit clearing after normalization', () => {
@@ -193,7 +193,14 @@ function findToolPartIndex(
) {
// Interactive request IDs differ from provider call IDs and correlate by identifying arguments.
const requestBacked = name === 'clarify' || name === 'setup_mcp'
if (!requestBacked && stableId && phase === 'running' && part.toolCallId && !part.toolCallId.startsWith('live-tool:')) {
if (
!requestBacked &&
stableId &&
phase === 'running' &&
part.toolCallId &&
!part.toolCallId.startsWith('live-tool:')
) {
continue
}