@uservane/vercel-ai/server: MintFeedbackTokenError
Type Alias: MintFeedbackTokenError
Section titled “Type Alias: MintFeedbackTokenError”MintFeedbackTokenError =
object
Defined in: server.d.ts:71
@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.
Example
Section titled “Example”// 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()});Properties
Section titled “Properties”message
Section titled “message”message:
string
Defined in: server.d.ts:74
ok:
false
Defined in: server.d.ts:72
status
Section titled “status”status:
number
Defined in: server.d.ts:73