MCPcopy Index your code
hub / github.com/ChatLab/ChatLab / main

Function main

packages/node-runtime/src/semantic-index/worker-thread-entry.ts:6–26  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

4const startup = workerData as SemanticIndexWorkerStartupOptions
5
6async function main(): Promise<void> {
7 const { createSemanticIndexWorkerRuntime, createSemanticIndexWorkerServiceFactory } =
8 (await import('./worker-runtime.js')) as typeof import('./worker-runtime')
9 const runtime = createSemanticIndexWorkerRuntime({
10 serviceFactory: createSemanticIndexWorkerServiceFactory(startup),
11 })
12
13 parentPort?.on('message', async (message) => {
14 const payload = message as { id: string; method: string; args?: unknown[] }
15 try {
16 const result = await runtime.handleRequest(payload.method, payload.args ?? [])
17 parentPort?.postMessage({ id: payload.id, success: true, result })
18 } catch (error) {
19 parentPort?.postMessage({
20 id: payload.id,
21 success: false,
22 error: error instanceof Error ? error.message : String(error),
23 })
24 }
25 })
26}
27
28void main().catch((error) => {
29 console.error('[semantic-index] worker failed to start:', error instanceof Error ? error.message : String(error))

Callers 1

Calls 5

onMethod · 0.80
handleRequestMethod · 0.80
postMessageMethod · 0.65

Tested by

no test coverage detected