Files
fusion/plugins/fusion-plugin-cursor-runtime/src/provider.ts
gsxdsm 3e7e4a865b FN-7700: enrich Cursor model picker with reasoning/contextWindow metadata
Threads optional reasoning and context-window metadata from Cursor CLI model discovery through to the dashboard's Cursor model picker, replacing hardcoded false/0 defaults with pass-through values when the CLI reports them.
- Extend cursorDiscoveryToModels/discoverCursorProviderModels to carry reasoning/contextWindow from structured JSON model entries
- Update runtime-provider-probes.ts to surface the new metadata fields
- Update cursor-agent process-manager and provider to parse and propagate reasoning/contextWindow from CLI output
- Add/extend tests covering the new metadata plumbing in cursor-model-cache, process-manager, and provider
- Add changeset documenting the patch-level dashboard feature

Files changed:
 .changeset/fn-7700-cursor-picker-reasoning-context-window.md      |  7 ++++
 packages/dashboard/src/__tests__/cursor-model-cache.test.ts       | 26 ++++++++++++
 packages/dashboard/src/cursor-model-cache.ts                      | 24 +++++++----
 packages/dashboard/src/runtime-provider-probes.ts                 | 11 ++++-
 plugins/fusion-plugin-cursor-runtime/src/__tests__/process-manager.test.ts | 33 +++++++++++++++
 plugins/fusion-plugin-cursor-runtime/src/__tests__/provider.test.ts       | 23 +++++++++++
 plugins/fusion-plugin-cursor-runtime/src/process-manager.ts               | 48 +++++++++++++++++++---
 plugins/fusion-plugin-cursor-runtime/src/provider.ts                      | 19 ++++++++-
 8 files changed, 176 insertions(+), 15 deletions(-)

Fusion-Task-Id: FN-7700

Fusion-Task-Lineage: 6b371a92-204a-4201-8c7d-df65e9210a1b

Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-07-08 23:39:34 -07:00

43 lines
1.8 KiB
TypeScript

import { discoverCursorModels } from "./process-manager.js";
import { probeCursorBinary } from "./probe.js";
function normalizeDiscoveryOptions(options?: unknown): { binaryPath?: string; timeoutMs?: number } {
if (!options || typeof options !== "object") return {};
const record = options as Record<string, unknown>;
return {
binaryPath: typeof record.binaryPath === "string" ? record.binaryPath : undefined,
timeoutMs: typeof record.timeoutMs === "number" ? record.timeoutMs : undefined,
};
}
/*
FNXC:CursorCli 2026-07-08-00:00:
FN-7700: `reasoning`/`contextWindow` are carried through from the plugin's
`discoverCursorModels` `modelMeta` map (structured JSON discovery entries
only) into each returned `{ id, label, reasoning?, contextWindow? }` entry.
They are omitted (never defaulted here) when the discovery result did not
report them for a given id — pass-through only, never fabricated or parsed
from the plain-text `<id> - <Label>` output.
*/
export async function discoverCursorProviderModels(options?: unknown) {
const probe = await probeCursorBinary(normalizeDiscoveryOptions(options));
if (!probe.available || !probe.binaryName) {
return { models: [], source: "probe", fallbackUsed: true, reason: probe.reason ?? "binary unavailable" };
}
const result = await discoverCursorModels(probe.binaryPath ?? probe.binaryName);
return {
models: result.models.map((id) => {
const meta = result.modelMeta?.[id];
return {
id,
label: id,
...(meta?.reasoning !== undefined ? { reasoning: meta.reasoning } : {}),
...(meta?.contextWindow !== undefined ? { contextWindow: meta.contextWindow } : {}),
};
}),
source: result.source,
fallbackUsed: result.fallbackUsed,
reason: result.reason,
};
}