Skip to content

@uservane/vercel-ai/server: MintFeedbackTokenInput

MintFeedbackTokenInput = object

Defined in: server.d.ts:31

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

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 accepts session-level scores (sessionId alone).
  • Observation-level scores need developer-provided traceId + observationId.
  • Mint a token bound to those ids, then thread showToken + ids to the client for controller.bind(). Framework auto-read of trace/observation ids is deferred (developer-provided path only).
import { mintFeedbackToken } from "@uservane/agent-core/server";
const { tokens } = await mintFeedbackToken({
secretKey: process.env.USERVANE_SECRET_KEY!,
respondentId: userId,
sessionId,
// optional: per-step observation score
// observationId, traceId,
surveyId: "surv_post_task",
});
// thread tokens[surveyId] + sessionId (+ optional traceId/observationId) to bind()

optional allowModelRequested?: boolean

Defined in: server.d.ts:58

Issuer opt-in for the request_user_feedback agent tool. When true, each minted token attests amr:true so model-requested submits are accepted. Default false: the model cannot self-enable the tool. Enabling carries a self-selection warning: model-requested captures are headline-excluded (identity_kind=model-requested).


optional apiBase?: string

Defined in: server.d.ts:60

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


optional fetchImpl?: typeof fetch

Defined in: server.d.ts:62

Injected fetch (tests).


optional observationId?: string

Defined in: server.d.ts:43


respondentId: string

Defined in: server.d.ts:35

Respondent identity (identified userId or server-known anon key).


secretKey: string

Defined in: server.d.ts:33

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


sessionId: string

Defined in: server.d.ts:40

Authoritative session id - the same value passed to Langfuse propagateAttributes. Bound into the show-token server-side.


optional surveyId?: string

Defined in: server.d.ts:42

Optional: limit mint to one survey.


optional taskType?: string

Defined in: server.d.ts:50

Untrusted display metadata for PM segmentation.


optional traceId?: string

Defined in: server.d.ts:48

Authoritative trace id for observation-level scores. Pair with observationId. Developer-provided only; framework auto-read remains deferred.