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 / telemetry-deps / telemetry-deps.ts
35 lines · 931 BRaw
1import type { HttpInit, HttpResponse, SessionAuthorization } from 'claude-code'
2
3import type { Environment } from '../environment'
4
5/**
6 * What `telemetryOf` reaches on the nouns beneath: the session's authorize
7 * and reads, and one fetch. Each is a call on the plugin's own `$`.
8 */
9export type TelemetryDeps = {
10 /**
11 * Resolves the session's held credential, or null.
12 */
13 authorize: () => Promise<SessionAuthorization>
14
15 /**
16 * The session's id, for the row.
17 */
18 id: () => Promise<string>
19
20 /**
21 * The session's model, for the row.
22 */
23 model: () => Promise<string>
24
25 /**
26 * Reads, at each call, what the row and the off switch need of the
27 * environment: the build's user type and every analytics-off variable.
28 */
29 environment: () => Promise<Environment>
30
31 /**
32 * Posts the batch to the ingest with the credential handle.
33 */
34 fetch: (url: string, init: HttpInit) => Promise<HttpResponse>
35}