diff --git a/src/cli/App.tsx b/src/cli/App.tsx index 5b1862e..2f40f1e 100644 --- a/src/cli/App.tsx +++ b/src/cli/App.tsx @@ -96,6 +96,7 @@ import { import { buildMessageContentFromDisplay, clearPlaceholdersInText, + resolvePlaceholders, } from "./helpers/pasteRegistry"; import { generatePlanFilePath } from "./helpers/planName"; import { safeJsonParseOr } from "./helpers/safeJsonParse"; @@ -440,7 +441,11 @@ export default function App({ | "oauth" | null; const [activeOverlay, setActiveOverlay] = useState(null); - const closeOverlay = useCallback(() => setActiveOverlay(null), []); + const [feedbackPrefill, setFeedbackPrefill] = useState(""); + const closeOverlay = useCallback(() => { + setActiveOverlay(null); + setFeedbackPrefill(""); + }, []); // Pin dialog state const [pinDialogLocal, setPinDialogLocal] = useState(false); @@ -3161,8 +3166,9 @@ ${gitContext} return { submitted: true }; } - // Special handling for /feedback command - open feedback dialog - if (trimmed === "/feedback") { + if (trimmed.startsWith("/feedback")) { + const maybeMsg = msg.slice("/feedback".length).trim(); + setFeedbackPrefill(maybeMsg); setActiveOverlay("feedback"); return { submitted: true }; } @@ -4269,6 +4275,8 @@ DO NOT respond to these messages or otherwise consider them in your response unl const cmdId = uid("cmd"); try { + const resolvedMessage = resolvePlaceholders(message); + // Immediately add command to transcript with "running" phase buffersRef.current.byId.set(cmdId, { kind: "command", @@ -4298,11 +4306,12 @@ DO NOT respond to these messages or otherwise consider them in your response unl method: "POST", headers: { "Content-Type": "application/json", - Authorization: `Bearer ${apiKey}`, + ...(apiKey ? { Authorization: `Bearer ${apiKey}` } : {}), "X-Letta-Source": "letta-code", + "X-Letta-Code-Device-ID": settingsManager.getOrCreateDeviceId(), }, body: JSON.stringify({ - message: message, + message: resolvedMessage, feature: "letta-code", agent_id: agentId, session_id: telemetry.getSessionId(), @@ -4938,6 +4947,7 @@ Plan file path: ${planFilePath}`; )} diff --git a/src/cli/components/FeedbackDialog.tsx b/src/cli/components/FeedbackDialog.tsx index 09f6748..9266ed4 100644 --- a/src/cli/components/FeedbackDialog.tsx +++ b/src/cli/components/FeedbackDialog.tsx @@ -6,10 +6,15 @@ import { PasteAwareTextInput } from "./PasteAwareTextInput"; interface FeedbackDialogProps { onSubmit: (message: string) => void; onCancel: () => void; + initialValue?: string; } -export function FeedbackDialog({ onSubmit, onCancel }: FeedbackDialogProps) { - const [feedbackText, setFeedbackText] = useState(""); +export function FeedbackDialog({ + onSubmit, + onCancel, + initialValue = "", +}: FeedbackDialogProps) { + const [feedbackText, setFeedbackText] = useState(initialValue); const [error, setError] = useState(""); useInput((_input, key) => { diff --git a/src/telemetry/index.ts b/src/telemetry/index.ts index b4a07f0..54d992a 100644 --- a/src/telemetry/index.ts +++ b/src/telemetry/index.ts @@ -397,7 +397,7 @@ class TelemetryManager { method: "POST", headers: { "Content-Type": "application/json", - Authorization: `Bearer ${apiKey}`, + ...(apiKey ? { Authorization: `Bearer ${apiKey}` } : {}), "X-Letta-Source": "letta-code", "X-Letta-Code-Device-ID": this.deviceId || "", },