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 / telemetry / hooks / entries / batch-of.ts
23 lines · 755 BRaw
1import type Batching from '../batching'
2import type { BatchStamp } from './batch-stamp'
3import { eventDataOf } from './event-data-of'
4import { wireOf } from './wire-of'
5
6/**
7 * The first-party event batch for the queued rows, shaped as the CLI's own
8 * event exporter shapes its batches: one ClaudeCodeInternalEvent per row.
9 *
10 * @param rows the rows as they were queued, oldest first
11 * @param stamp what the batch stamps on every row
12 * @returns the batch's JSON text, ready to POST to the ingest
13 */
14export const batchOf = (
15 rows: readonly Batching.PendingRow[],
16 stamp: BatchStamp,
17) =>
18 JSON.stringify({
19 events: rows.map(row => ({
20 event_type: 'ClaudeCodeInternalEvent',
21 event_data: wireOf(eventDataOf(row, stamp)),
22 })),
23 })