mirror of
https://github.com/simstudioai/sim.git
synced 2026-02-10 22:55:16 -05:00
* feat(deployed-form): added deployed form input * styling consolidation, finishing touches on form * updated docs * remove unused files with knip * added more form fields * consolidated more test utils * remove unused/unneeded zustand stores, refactored stores for consistency * improvement(files): uncolorized plan name * feat(emcn): button-group * feat(emcn): tag input, tooltip shortcut * improvement(emcn): modal padding, api, chat, form * fix: deleted migrations * feat(form): added migrations * fix(emcn): tag input * fix: failing tests on build * add suplementary hover and fix bg color in date picker * fix: build errors --------- Co-authored-by: Emir Karabeg <emirkarabeg@berkeley.edu>
25 lines
678 B
TypeScript
25 lines
678 B
TypeScript
const instances: Record<string, any> = {}
|
|
|
|
let syncStateFn: ((toolCallId: string, nextState: any, options?: { result?: any }) => void) | null =
|
|
null
|
|
|
|
export function registerClientTool(toolCallId: string, instance: any) {
|
|
instances[toolCallId] = instance
|
|
}
|
|
|
|
export function getClientTool(toolCallId: string): any | undefined {
|
|
return instances[toolCallId]
|
|
}
|
|
|
|
export function registerToolStateSync(
|
|
fn: (toolCallId: string, nextState: any, options?: { result?: any }) => void
|
|
) {
|
|
syncStateFn = fn
|
|
}
|
|
|
|
export function syncToolState(toolCallId: string, nextState: any, options?: { result?: any }) {
|
|
try {
|
|
syncStateFn?.(toolCallId, nextState, options)
|
|
} catch {}
|
|
}
|