mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-15 12:55:51 +00:00
Tighten the UDS auth, framing, and response-reader boundaries while keeping the AgentSummary lifecycle covered so Codecov and CI fail on real regressions instead of missing coverage. The poorMode settings mock mirrors unrelated real settings defaults to avoid Bun mock retention changing later permission tests. Constraint: PR #369 must fix Codecov/CI precisely without warning suppression, fallback masking, or mock pollution Rejected: Delete AgentSummary lifecycle coverage | would hide Codecov loss and stale-summary behavior Rejected: Store inline UDS rejection in a hidden input sentinel | cloned observable inputs can drop it and bypass rejection Rejected: Ignore malformed UDS frames until timeout | leaves client slots and SendMessage calls open to exhaustion Confidence: high Scope-risk: moderate Directive: Keep empty #token= markers rejected; do not require a non-empty token value in hasInlineUdsToken Tested: bun test packages/builtin-tools/src/tools/SendMessageTool/__tests__/udsRecipientSanitization.test.ts src/utils/__tests__/udsMessaging.test.ts src/utils/__tests__/udsResponseReader.test.ts src/utils/__tests__/ndjsonFramer.test.ts Tested: bunx tsc --noEmit --pretty false Tested: bun run lint Tested: bun test --coverage --coverage-reporter lcov --coverage-dir coverage Tested: bun run test:all Tested: bun audit Tested: bun run build Tested: bun run build:vite Not-tested: GitHub-hosted Codecov upload until pushed PR checks rerun
33 lines
1.0 KiB
TypeScript
33 lines
1.0 KiB
TypeScript
import { randomUUID, type UUID } from 'node:crypto'
|
|
import type { UserMessage } from '../../types/message.js'
|
|
|
|
export function buildSummaryPrompt(previousSummary: string | null): string {
|
|
const prevLine = previousSummary
|
|
? `\nPrevious: "${previousSummary}" — say something NEW.\n`
|
|
: ''
|
|
|
|
return `Describe your most recent action in 3-5 words using present tense (-ing). Name the file or function, not the branch. Do not use tools.
|
|
${prevLine}
|
|
Good: "Reading runAgent.ts"
|
|
Good: "Fixing null check in validate.ts"
|
|
Good: "Running auth module tests"
|
|
Good: "Adding retry logic to fetchUser"
|
|
|
|
Bad (past tense): "Analyzed the branch diff"
|
|
Bad (too vague): "Investigating the issue"
|
|
Bad (too long): "Reviewing full branch diff and AgentTool.tsx integration"
|
|
Bad (branch name): "Analyzed adam/background-summary branch diff"`
|
|
}
|
|
|
|
export function createSummaryPromptMessage(content: string): UserMessage {
|
|
return {
|
|
type: 'user',
|
|
message: {
|
|
role: 'user',
|
|
content,
|
|
},
|
|
uuid: randomUUID() as UUID,
|
|
timestamp: new Date().toISOString(),
|
|
}
|
|
}
|