Skip to content

@uservane/vercel-ai/server: MintDeferredAskLinkResult

MintDeferredAskLinkResult = object

Defined in: server.d.ts:100

@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()
});

issuedAt: string

Defined in: server.d.ts:117


respondentId: string

Defined in: server.d.ts:119


sessionId: string | null

Defined in: server.d.ts:120


showToken: string

Defined in: server.d.ts:116

Session-bound show-token (v2). This is the SESSION-LINKED deferred path: thread showToken + sessionId to the user’s NEXT in-app session and call controller.bind({ surveyId, showToken, sessionId }) there. That capture links (correlation_state=‘linked’) and round-trips a Langfuse session score. The URL above does not consume this token.


surveyId: string

Defined in: server.d.ts:118


url: string

Defined in: server.d.ts:108

Hosted ask URL (/l/:token) to deliver on your channel (e.g. a confirmation email). IMPORTANT: a response captured through this URL is a STANDALONE hosted capture - it is NOT correlated to the agent session (no Langfuse session score for it). Use it when you just want a deferred ask; use the session-linked path below when you need the deferred feedback to correlate to the run.