Download packages/node-sdk/examples/t8-race-create-single.ts from SaylorTwift/kimi-code: direct link, hf CLI and curl.
- Browser
- Download file 875 Bytes
-
https://huggingface.co/SaylorTwift/kimi-code/resolve/main/packages/node-sdk/examples/t8-race-create-single.ts
- Command line
-
hf download hf://SaylorTwift/kimi-code/packages/node-sdk/examples/t8-race-create-single.ts
-
curl -L -o t8-race-create-single.ts https://huggingface.co/SaylorTwift/kimi-code/resolve/main/packages/node-sdk/examples/t8-race-create-single.ts
875 Bytes
| // One creator: meant to run twice as separate processes simultaneously. | |
| import { createKimiHarness } from '@moonshot-ai/kimi-code-sdk'; | |
| const workDir = process.argv[2]!; | |
| const homeDir = process.argv[3]!; | |
| const sessionId = process.argv[4]!; | |
| const label = process.argv[5] ?? 'P'; | |
| const identity: any = { productName: 'kimi-code-cli', version: '0.0.1-test', platform: 'kimi_code_cli' }; | |
| const h = createKimiHarness({ identity, homeDir }); | |
| try { | |
| const s = await h.createSession({ workDir, id: sessionId, model: 'kimi-code/kimi-for-coding' }); | |
| console.log(JSON.stringify({ label, ok: true, id: s.id, dir: s.summary?.sessionDir, pid: process.pid })); | |
| } catch (error: any) { | |
| console.log(JSON.stringify({ label, ok: false, msg: String(error.message ?? error), code: error.code ?? error.cause?.code, pid: process.pid })); | |
| } finally { | |
| await h.close(); | |
| process.exit(0); | |
| } | |