UNPKG

@fusedashlabs/ui9000-workspace

Version:

UI9000 workspace MCP. One tool, show_workspace, draws a chart from your table. Set TYPESAFE_API_KEY to let Jev choose the chart.

91 lines (90 loc) • 3.01 kB
/** * Jev question pack. The options are chart ids from chart-roles, never free text. * * Step 1 asks which class fits. Step 2 asks which drawing inside that class fits. */ import { type ChartFamily } from '../catalog/chart-roles.js'; import type { DataProfile } from '../spec/data-profile.js'; export declare const JEV_MODEL = "jev-latest"; export type JevColumn = { name: string; role: string; }; export type JevChartState = { utterance: string; columns: JevColumn[]; categoryCardinality: number; rowCount: number; /** The tool's classification. Context for Jev, not a filter on the options. */ intent: string; }; export type JevChoiceQuestion = { type: 'choice'; instructions: string; criteria: Record<string, string>; }; export type JevNoulQuestion = { type: 'noul'; instructions: string; }; export type JevChartRequest = { state: JevChartState; model: typeof JEV_MODEL; questions: { chart: JevChoiceQuestion; /** Present on the class question only, and only when the tool call omitted requestedChart. */ named_chart?: JevNoulQuestion; }; }; /** Step 1. One option per eligible family: its main chart, described by the family question. */ export declare function classChoiceRequest(input: { utterance: string; columns: readonly JevColumn[]; profile: DataProfile; intent: string; askNamedChart: boolean; }): JevChartRequest; /** Step 2. Only the drawings of the class Jev already chose. */ export declare function markChoiceRequest(input: { utterance: string; columns: readonly JevColumn[]; profile: DataProfile; intent: string; family: ChartFamily; }): JevChartRequest; export type JevChoiceAnswer = { type: 'choice'; choice: string; probabilities?: Record<string, number>; confidence?: number; }; export type JevNoulAnswer = { type: 'noul'; noul: number; }; export type JevChartResponse = { answers?: { intent?: JevChoiceAnswer; chart?: JevChoiceAnswer; named_chart?: JevNoulAnswer; }; }; export declare const JEV_MIN_CONFIDENCE = 0.5; export declare const JEV_MIN_LEAD = 0.15; export type AcceptedReading = { /** Offered id Jev named. Null when that id was not one of the options. */ top: string | null; runnerUp: string | null; confidence: number; /** Top probability minus the runner-up. Zero when probabilities were not sent. */ lead: number; /** * Confidence clears the gate, the id was offered, and either there is one * option or the lead clears the gate. Missing probabilities do not fail the lead. */ clear: boolean; namedChart: boolean; }; /** Trust only an id we offered, and only when confidence and lead both clear. */ export declare function acceptReading(response: JevChartResponse, allowed: readonly string[], minConfidence?: number, minLead?: number): AcceptedReading; export declare function offeredChartIds(request: JevChartRequest): string[];