Download packages/agent-core-v2/src/wire/record.ts from SaylorTwift/kimi-code: direct link, hf CLI and curl.
- Browser
- Download file 1.36 kB
-
https://huggingface.co/SaylorTwift/kimi-code/resolve/main/packages/agent-core-v2/src/wire/record.ts
- Command line
-
hf download hf://SaylorTwift/kimi-code/packages/agent-core-v2/src/wire/record.ts
-
curl -L -o record.ts https://huggingface.co/SaylorTwift/kimi-code/resolve/main/packages/agent-core-v2/src/wire/record.ts
1.36 kB
| import { WIRE_PROTOCOL_VERSION } from './migration/migration'; | |
| export const AGENT_WIRE_RECORD_KEY = 'wire.jsonl'; | |
| export type PartsTransformer = (parts: readonly unknown[]) => Promise<readonly unknown[]>; | |
| export type RecordDehydrator = ( | |
| record: WireRecord, | |
| transform: PartsTransformer, | |
| ) => WireRecord | Promise<WireRecord>; | |
| export interface WireLineRange { | |
| readonly start: number; | |
| readonly end: number; | |
| } | |
| export interface WireRecord { | |
| readonly type: string; | |
| readonly time?: number; | |
| readonly [key: string]: unknown; | |
| } | |
| export interface WireMetadataRecord extends WireRecord { | |
| readonly type: 'metadata'; | |
| readonly protocol_version: string; | |
| readonly created_at: number; | |
| } | |
| export function isWireRecord(record: unknown): record is WireRecord { | |
| return ( | |
| record !== null && | |
| typeof record === 'object' && | |
| !Array.isArray(record) && | |
| typeof (record as { type?: unknown }).type === 'string' | |
| ); | |
| } | |
| export function createWireMetadataRecord(now = Date.now()): WireMetadataRecord { | |
| return { | |
| type: 'metadata', | |
| protocol_version: WIRE_PROTOCOL_VERSION, | |
| created_at: now, | |
| }; | |
| } | |
| export function isWireMetadataRecord(record: WireRecord): record is WireMetadataRecord { | |
| return ( | |
| record.type === 'metadata' && | |
| typeof record['protocol_version'] === 'string' && | |
| typeof record['created_at'] === 'number' | |
| ); | |
| } | |