MCPcopy Create free account
hub / github.com/Noumena-Network/code / call

Function call

src/commands/repaint/repaint.ts:321–352  ·  view source on GitHub ↗
(
  _args: string,
  context: ToolUseContext,
)

Source from the content-addressed store, hash-verified

319}
320
321export async function call(
322 _args: string,
323 context: ToolUseContext,
324): Promise<LocalCommandResult> {
325 const diagnosticPath = writeRepaintDiagnostic(context)
326 // The visible command result is appended after this function resolves.
327 // Repainting synchronously repairs the old frame, then the command result
328 // adds rows and can reintroduce a vertical viewport offset. Defer one turn
329 // so the repaint targets the final transcript state that includes this
330 // command's own output.
331 setTimeout(() => {
332 requestReplTranscriptResetRedraw(process.stdout)
333 setTimeout(() => {
334 try {
335 const fs = require('fs') as typeof import('fs')
336 const before = fs.existsSync(diagnosticPath)
337 ? JSON.parse(fs.readFileSync(diagnosticPath, 'utf8'))
338 : { kind: 'ncode-repaint-diagnostic' }
339 writePayload(diagnosticPath, {
340 ...before,
341 after: buildPayload(context, 'after'),
342 })
343 } catch {
344 // Best-effort diagnostic update; repaint itself must not fail.
345 }
346 }, 75).unref?.()
347 }, 0).unref?.()
348 return {
349 type: 'text',
350 value: `Repaint requested. Renderer diagnostic written to:\n${diagnosticPath}`,
351 }
352}

Callers

nothing calls this directly

Calls 4

writeRepaintDiagnosticFunction · 0.85
writePayloadFunction · 0.85
buildPayloadFunction · 0.85

Tested by

no test coverage detected