(type, payload = {})
| 403 | const worker = new Worker("./ifc_worker.js", { type: "module" }); |
| 404 | |
| 405 | function callWorker(type, payload = {}) { |
| 406 | return new Promise((resolve, reject) => { |
| 407 | const id = crypto.randomUUID(); |
| 408 | const onMsg = (ev) => { |
| 409 | const msg = ev.data; |
| 410 | if (!msg || msg.id !== id) return; |
| 411 | worker.removeEventListener("message", onMsg); |
| 412 | if (msg.ok) resolve(msg); |
| 413 | else reject(new Error(msg.error || "Worker error")); |
| 414 | }; |
| 415 | worker.addEventListener("message", onMsg); |
| 416 | worker.postMessage({ id, type, payload }); |
| 417 | }); |
| 418 | } |
| 419 | |
| 420 | // ---- Tool schemas (should match ifcmcp.core openai_tools()) ---- |
| 421 | const tools = [ |
no outgoing calls
no test coverage detected