spacehub

surshar / claude-code

Claude Code is an agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster by executing routine tasks, explaining complex code, and handling git workflows - all through natural language commands.

Built by Anthropic · github.com/anthropics

claude-code / mods / diff / hooks / turns / turn-of / is-prompt-row / is-prompt-row.ts
13 lines · 485 BRaw
1import type { SessionMessage } from 'claude-code'
2
3/**
4 * Whether a transcript row starts a turn: a user message that carries text
5 * and no tool results (`$.session.messages()` already leaves out meta rows).
6 *
7 * @param message one row of the transcript
8 * @returns whether it is a typed prompt
9 */
10export const isPromptRow = (message: SessionMessage) =>
11 message.role === 'user' &&
12 (message.toolResults === undefined || message.toolResults.length === 0) &&
13 message.text !== ''