@uservane/langfuse-push
v0.1.0
Published
Server-only adapter: push UserVane linked feedback as Langfuse session scores
Readme
@uservane/langfuse-push
Server-only adapter that completes the UserVane → Langfuse round-trip.
Credential-safe by design. This package runs in the customer's server or cron. It holds the UserVane secret key (to poll the pending-scores queue) and the Langfuse write keys. UserVane never receives, stores, or transmits the Langfuse key and is never in the eval write path. Never import this package from a client component or browser bundle.
Install
npm install @uservane/langfuse-pushUsage (customer server / cron)
import { pushPendingScores } from "@uservane/langfuse-push";
const summary = await pushPendingScores({
uservane: {
secretKey: process.env.USERVANE_SECRET_KEY!, // uv_sk_...
// apiBase: "https://api.uservane.com", // default
},
langfuse: {
publicKey: process.env.LANGFUSE_PUBLIC_KEY!,
secretKey: process.env.LANGFUSE_SECRET_KEY!, // sk-lf-...
// baseUrl: "https://cloud.langfuse.com",
},
// scoreName: "uservane.satisfaction", // default, namespaced
// includeFailed: true, // re-poll previously failed rows
});
// { delivered: number, failed: number }
console.log(summary);Behavior
GET /v1/sdk/pending-scores(secret-key authed) — linked +score_state=pendingrows for this project only (verbatim PII).- For each row, create a Langfuse session-level score via the official
langfuseNode SDK:name = uservane.satisfaction(orscoreName),value = rating(0-10 raw),comment = text, keyed tosessionId. POST /v1/sdk/pending-scores/ackwith per-iddelivered|failed.- Transient Langfuse errors are retried with backoff; permanent failure is
acked as
failedand re-pollable later withincludeFailed: true.
Unlinked rows are never in the queue and never pushed.
Score create (verified)
Against installed [email protected] / langfuse-core types:
Langfuse.score(body: CreateLangfuseScoreBody): thisCreateLangfuseScoreBody/ScoreBodyincludes optionalsessionIdwith no requiredtraceId(session-only scores are supported).- Call
flushAsync()after score creation to drain the SDK ingestion queue.
See also: Langfuse custom scores (session-level scores, checked 2026-07-27).
