MCPcopy Index your code
hub / github.com/TanStack/ai / activate

Method activate

packages/ai-client/src/devtools.ts:577–610  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

575 }
576
577 private activate(): void {
578 if (this.disposed) {
579 return
580 }
581
582 const activeBridgeByHookId = getActiveBridgeRegistry()
583 const activeBridge = activeBridgeByHookId.get(this.options.hookId)
584 if (activeBridge && activeBridge !== this) {
585 if (typeof activeBridge.supersede === 'function') {
586 activeBridge.supersede()
587 } else {
588 activeBridge.deactivate()
589 }
590 }
591 activeBridgeByHookId.set(this.options.hookId, this)
592
593 if (this.unsubscribers.length > 0) {
594 return
595 }
596
597 this.unsubscribers.push(
598 aiEventClient.on('devtools:request-state', (event) => {
599 this.handleRequestState(event)
600 }),
601 )
602
603 if (this.options.applyToolFixture) {
604 this.unsubscribers.push(
605 aiEventClient.on('devtools:tool-fixture:apply', (event) => {
606 void this.handleToolFixtureApply(event)
607 }),
608 )
609 }
610 }
611
612 private handleRequestState(
613 event: AIDevtoolsEvent<{ targetHookId?: string }>,

Callers 2

prepareForEmitMethod · 0.95
prepareForMountEmitMethod · 0.95

Calls 8

handleRequestStateMethod · 0.95
getActiveBridgeRegistryFunction · 0.85
getMethod · 0.65
setMethod · 0.65
supersedeMethod · 0.45
deactivateMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected