Skip to content

@uservane/vercel-ai/server: MintDeferredAskLinkInput

MintDeferredAskLinkInput = object

Defined in: server.d.ts:86

@uservane/vercel-ai/server - server-only helpers for agent-native capture.

Re-exports mintFeedbackToken from @uservane/agent-core/server.

SECURITY: This module MUST run only on the customer’s server (Next.js route handler / server action / edge function). It accepts the project SECRET key and POSTs to /v1/sdk/tokens. Never import this entry from client components or ship the secret key to the browser.

Correlation model (verified, 2026-07-27):

  • Langfuse + Vercel AI SDK: the developer controls sessionId via propagateAttributes({ sessionId }, () => generateText(…)). The trace id is auto-generated; we do NOT auto-read it.
  • Langfuse accepts session-level scores (sessionId alone).
  • Therefore: mint a token bound to the same sessionId the server already set for Langfuse, then thread the showToken + sessionId to the client.
// app/api/chat/route.ts (server)
import { mintFeedbackToken } from "@uservane/vercel-ai/server";
import { propagateAttributes } from "@langfuse/tracing";
const sessionId = crypto.randomUUID();
await propagateAttributes({ sessionId }, async () => {
const result = await generateText({ ... });
const { tokens } = await mintFeedbackToken({
secretKey: process.env.USERVANE_SECRET_KEY!,
respondentId: userId,
sessionId,
surveyId: "surv_post_task",
});
// stream tokens[surveyId] + sessionId to the client; client calls bind()
});

optional apiBase?: string

Defined in: server.d.ts:96

API origin. Defaults to https://api.uservane.com.


optional fetchImpl?: typeof fetch

Defined in: server.d.ts:98

Injected fetch (tests).


respondentId: string

Defined in: server.d.ts:90

Respondent identity for the bound show-token.


secretKey: string

Defined in: server.d.ts:88

Project secret key (uv_sk_...). NEVER ship to the browser.


optional sessionId?: string

Defined in: server.d.ts:94

Optional session id for linked deferred capture.


surveyId: string

Defined in: server.d.ts:92

Survey to ask.