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
| 1 | import type Batching from '../../batching' |
| 2 | import type { BatchStamp } from '../batch-stamp' |
| 3 | import { authOf } from './auth-of' |
| 4 | import { metadataOf } from './metadata-of' |
| 5 | |
| 6 | /** |
| 7 | * One row as a ClaudeCodeInternalEvent, keyed as the plugin builds it; |
| 8 | * wireOf spells it for the ingest. |
| 9 | * |
| 10 | * Its id, name and time, who and where it is from, the session's fields, |
| 11 | * its `env` block, and its properties in `additionalMetadata`. |
| 12 | * |
| 13 | * @param row the row as it was queued |
| 14 | * @param stamp what the batch stamps on every row |
| 15 | * @returns the event's data |
| 16 | */ |
| 17 | export const eventDataOf = (row: Batching.PendingRow, stamp: BatchStamp) => ({ |
| 18 | eventId: row.eventId, |
| 19 | eventName: row.fields.name, |
| 20 | clientTimestamp: row.loggedAt, |
| 21 | deviceId: stamp.context.identity.deviceId, |
| 22 | email: stamp.context.identity.email, |
| 23 | auth: authOf(stamp.context.identity), |
| 24 | sessionId: stamp.sessionId, |
| 25 | model: stamp.model, |
| 26 | userType: stamp.userType, |
| 27 | isInteractive: stamp.isInteractive, |
| 28 | ...stamp.context.session, |
| 29 | env: { ...stamp.context.environment, isClaudeAiAuth: stamp.isClaudeAiAuth }, |
| 30 | additionalMetadata: metadataOf(row, stamp.context.remoteHash), |
| 31 | }) |