MCPcopy Create free account
hub / github.com/claude-code-best/claude-code / generateAndPatch

Function generateAndPatch

src/bridge/initReplBridge.ts:337–352  ·  view source on GitHub ↗
(input: string, bridgeSessionId: string)

Source from the content-addressed store, hash-verified

335 // out-of-order resolution (genSeq — count-1's Haiku resolving after count-3
336 // would clobber the richer title). generateSessionTitle never rejects.
337 const generateAndPatch = (input: string, bridgeSessionId: string): void => {
338 const gen = ++genSeq
339 const atCount = userMessageCount
340 void generateSessionTitle(input, AbortSignal.timeout(15_000)).then(
341 generated => {
342 if (
343 generated &&
344 gen === genSeq &&
345 lastBridgeSessionId === bridgeSessionId &&
346 !getCurrentSessionTitle(getSessionId())
347 ) {
348 patch(generated, bridgeSessionId, atCount)
349 }
350 },
351 )
352 }
353 const onUserMessage = (text: string, bridgeSessionId: string): boolean => {
354 if (hasExplicitTitle || getCurrentSessionTitle(getSessionId())) {
355 return true

Callers 1

onUserMessageFunction · 0.85

Calls 4

generateSessionTitleFunction · 0.85
getCurrentSessionTitleFunction · 0.85
getSessionIdFunction · 0.85
patchFunction · 0.85

Tested by

no test coverage detected