import { useCallback } from "react"; import { useComposer } from "@getpaseo/plugin/client"; import { Action, Select, Toggle } from "@getpaseo/plugin/client/ui"; type ContextLength = "short" | "long"; const CONTEXT_OPTIONS = [ { value: "short", label: "Short", description: "Answer from the files you name." }, { value: "long", label: "Long", description: "Read the surrounding code first." }, ] as const; const CONTEXT_KEY = "composer-controls.contextLength"; const REVIEW_KEY = "composer-controls.needsReview"; /** Reads and writes agent metadata, so the choice is saved with the agent. */ export function ContextLength() { const composer = useComposer(); const current: ContextLength = composer.agent.metadata[CONTEXT_KEY] === "long" ? "long" : "short"; const change = useCallback( ({ value }: { value: ContextLength }) => composer.setMetadata({ [CONTEXT_KEY]: value }), [composer], ); return (