MCPcopy Create free account
hub / github.com/TanStack/ai / upsertUnknownHook

Function upsertUnknownHook

packages/ai-devtools/src/store/hook-registry.ts:593–613  ·  view source on GitHub ↗
(
  state: HookRegistryState,
  hookId: string,
  event: RunLifecycleEvent,
)

Source from the content-addressed store, hash-verified

591}
592
593function upsertUnknownHook(
594 state: HookRegistryState,
595 hookId: string,
596 event: RunLifecycleEvent,
597): void {
598 if (state.hooks[hookId]) return
599 state.hooks[hookId] = {
600 id: hookId,
601 hookName: hookId,
602 lifecycle: 'active',
603 ...(event.clientId ? { clientId: event.clientId } : {}),
604 ...(event.threadId ? { threadId: event.threadId } : {}),
605 registeredAt: event.timestamp,
606 updatedAt: event.timestamp,
607 state: {},
608 tools: [],
609 runIds: [],
610 eventIds: [],
611 activityRunIds: [],
612 }
613}
614
615function removeHookRecord(state: HookRegistryState, hookId: string): void {
616 const hook = state.hooks[hookId]

Callers 1

applyHookEventFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected