MCPcopy Create free account
hub / github.com/MoonshotAI/kimi-code / main

Function main

packages/server-e2e/scenarios/_template.ts:21–49  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

19const KIMI_SERVER_URL = process.env['KIMI_SERVER_URL'] ?? 'http://127.0.0.1:58627';
20
21async function main() {
22 const client = new DaemonClient({
23 baseUrl: KIMI_SERVER_URL,
24 logger: (level, msg, meta) => console.log(`[${level}] ${msg}`, meta ?? ''),
25 });
26
27 let sid: string | undefined;
28 try {
29 const session = await client.createSession({ metadata: { cwd: process.cwd() } });
30 sid = session.id;
31
32 await client.connect();
33 await client.subscribe(sid);
34
35 // TODO: drive your scenario here. Examples:
36 // - await client.submitAndWait(sid, { content: [{ type: 'text', text: '...' }] });
37 // - client.onApprovalRequested((req) => ({ decision: 'approved' }));
38 // - const final = await client.waitForFrame(f => f.type === 'turn.ended');
39
40 console.log('✓ scenario template ran (no assertions)');
41 } finally {
42 try {
43 if (sid) await client.archiveSession(sid);
44 } catch {
45 // ignore
46 }
47 await client.close();
48 }
49}
50
51main().catch((err) => {
52 console.error('✗ scenario failed:', err);

Callers 1

_template.tsFile · 0.70

Calls 7

createSessionMethod · 0.95
connectMethod · 0.95
subscribeMethod · 0.95
archiveSessionMethod · 0.95
closeMethod · 0.95
cwdMethod · 0.80
logMethod · 0.65

Tested by

no test coverage detected