Download packages/kap-server/src/transport/mainAgent.ts from SaylorTwift/kimi-code: direct link, hf CLI and curl.
- Browser
- Download file 562 Bytes
-
https://huggingface.co/SaylorTwift/kimi-code/resolve/main/packages/kap-server/src/transport/mainAgent.ts
- Command line
-
hf download hf://SaylorTwift/kimi-code/packages/kap-server/src/transport/mainAgent.ts
-
curl -L -o mainAgent.ts https://huggingface.co/SaylorTwift/kimi-code/resolve/main/packages/kap-server/src/transport/mainAgent.ts
562 Bytes
| import { | |
| ensureMainAgent as ensureMainAgentContext, | |
| IAgentLifecycleService, | |
| MAIN_AGENT_ID, | |
| type IAgentScopeHandle, | |
| type ISessionScopeHandle, | |
| } from '@moonshot-ai/agent-core-v2'; | |
| export { MAIN_AGENT_ID }; | |
| export async function ensureMainAgent(session: ISessionScopeHandle): Promise<IAgentScopeHandle> { | |
| const context = await ensureMainAgentContext(session); | |
| const handle = session.accessor.get(IAgentLifecycleService).handleOf(context.agentId); | |
| if (handle === undefined) { | |
| throw new Error('Main agent was not found'); | |
| } | |
| return handle; | |
| } | |