SimpleChatTC: Initial skeleton of a simple toolsworker

This commit is contained in:
hanishkvc 2025-10-13 23:07:44 +05:30
parent a6bccf934e
commit 510c65c721
1 changed files with 19 additions and 0 deletions

View File

@ -0,0 +1,19 @@
//@ts-check
// STILL DANGER DANGER DANGER - Simple and Stupid - Use from a discardable VM only
// Helpers to handle tools/functions calling using web worker
// by Humans for All
//
import * as tconsole from "./toolsconsole.mjs"
tconsole.console_redir()
onmessage = async (ev) => {
try {
eval(ev.data)
} catch (/** @type {any} */error) {
console.log(`\n\nTool/Function call raised an exception:${error.name}:${error.message}\n\n`)
}
tconsole.console_revert()
postMessage(tconsole.gConsoleStr)
}