MCPcopy
hub / github.com/TanStack/ai / buildDevtoolsBridgeOptions

Method buildDevtoolsBridgeOptions

packages/ai-client/src/chat-client.ts:539–563  ·  view source on GitHub ↗
(
    devtools: ChatClientOptions['devtools'],
  )

Source from the content-addressed store, hash-verified

537 }
538
539 private buildDevtoolsBridgeOptions(
540 devtools: ChatClientOptions['devtools'],
541 ): ChatDevtoolsBridgeOptions {
542 return {
543 hookId: this.uniqueId,
544 clientId: this.uniqueId,
545 threadId: this.threadId,
546 metadata: {
547 hookName: devtools?.hookName ?? 'useChat',
548 outputKind: devtools?.outputKind ?? 'chat',
549 ...(devtools?.framework ? { framework: devtools.framework } : {}),
550 ...(devtools?.name ? { name: devtools.name } : {}),
551 },
552 getSnapshot: () => this.getDevtoolsSnapshot(),
553 getTools: () => this.clientToolsRef.current.values(),
554 getMessages: () => this.processor.getMessages(),
555 setMessages: (messages: Array<UIMessage>) => {
556 this.processor.setMessages(messages)
557 },
558 addToolResult: (toolCallId, output, errorText) => {
559 this.processor.addToolResult(toolCallId, output, errorText)
560 },
561 generateId: (prefix) => this.generateUniqueId(prefix),
562 }
563 }
564
565 private getDevtoolsSnapshot(): AIDevtoolsChatSnapshot {
566 return {

Callers 1

constructorMethod · 0.95

Calls 6

getDevtoolsSnapshotMethod · 0.95
generateUniqueIdMethod · 0.95
valuesMethod · 0.80
setMessagesMethod · 0.80
getMessagesMethod · 0.45
addToolResultMethod · 0.45

Tested by

no test coverage detected