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

Method emitSnapshot

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

Source from the content-addressed store, hash-verified

453 }
454
455 emitSnapshot(): void {
456 if (!this.prepareForEmit()) {
457 return
458 }
459 emitAIDevtoolsEvent('hook:state-snapshot', {
460 ...this.createEnvelope('hook:state-snapshot'),
461 ...this.createMetadataPayload(),
462 // Wire envelope uses Record<string, unknown>; widen the typed snapshot
463 // here so the typed-snapshot constraint above can stay narrow.
464 // eslint-disable-next-line no-restricted-syntax -- TSnapshot extends object is structurally compatible but TS can't see the missing index signature
465 state: this.options.getSnapshot() as unknown as Record<string, unknown>,
466 })
467 }
468
469 emitToolsRegistered(): void {
470 if (!this.prepareForEmit()) {

Callers 15

handleRequestStateMethod · 0.95
mountDevtoolsMethod · 0.45
setStatusMethod · 0.45
setIsSubscribedMethod · 0.45
setConnectionStatusMethod · 0.45
setSessionGeneratingMethod · 0.45
appendMethod · 0.45
streamResponseMethod · 0.45
reloadMethod · 0.45
setMessagesManuallyMethod · 0.45
mountWithToolsMethod · 0.45

Calls 4

prepareForEmitMethod · 0.95
createEnvelopeMethod · 0.95
createMetadataPayloadMethod · 0.95
emitAIDevtoolsEventFunction · 0.90

Tested by

no test coverage detected