Download packages/agent-core-v2/src/wire/human.ts from SaylorTwift/kimi-code: direct link, hf CLI and curl.
- Browser
- Download file 980 Bytes
-
https://huggingface.co/SaylorTwift/kimi-code/resolve/main/packages/agent-core-v2/src/wire/human.ts
- Command line
-
hf download hf://SaylorTwift/kimi-code/packages/agent-core-v2/src/wire/human.ts
-
curl -L -o human.ts https://huggingface.co/SaylorTwift/kimi-code/resolve/main/packages/agent-core-v2/src/wire/human.ts
980 Bytes
| import { AGENT_SWITCHED_TYPE } from './tree/tree'; | |
| export const HUMAN_AGENT_DOMAIN = 'agent'; | |
| export const AGENT_WIRE_RECORD_TYPES: ReadonlySet<string> = new Set([ | |
| AGENT_SWITCHED_TYPE, | |
| 'agent.message.appended', | |
| 'agent.turn.started', | |
| 'agent.turn.ended', | |
| ]); | |
| const LEGACY_HUMAN_RECORD_PREFIX = 'human.'; | |
| export function isHumanRecordType(type: string): boolean { | |
| return AGENT_WIRE_RECORD_TYPES.has(type) || type.startsWith(LEGACY_HUMAN_RECORD_PREFIX); | |
| } | |
| export function humanRecordType(domain: string, type: string): string { | |
| return `${domain}.${type}`; | |
| } | |
| export function humanEventType(recordType: string, domain: string): string | undefined { | |
| if (recordType === AGENT_SWITCHED_TYPE) return undefined; | |
| for (const prefix of [`${domain}.`, `${LEGACY_HUMAN_RECORD_PREFIX}${domain}.`]) { | |
| if (!recordType.startsWith(prefix)) continue; | |
| const type = recordType.slice(prefix.length); | |
| return type.length === 0 ? undefined : type; | |
| } | |
| return undefined; | |
| } | |