feat: agent-aware rename via command-io hints [LET-7755] (#1250)

This commit is contained in:
Devansh Jain
2026-03-03 16:12:53 -08:00
committed by GitHub
parent 28ba2e7e1f
commit fd59b8c46b
4 changed files with 33 additions and 4 deletions

View File

@@ -2712,6 +2712,7 @@ export default function App({
input,
output: event.output,
success: event.success,
agentHint: event.agentHint,
});
}, []);
@@ -8160,6 +8161,7 @@ export default function App({
await client.agents.update(agentId, { name: newValue });
updateAgentName(newValue);
cmd.agentHint = `Your name is now "${newValue}" — acknowledge this and save your new name to memory.`;
cmd.finish(`Agent renamed to "${newValue}"`, true);
} catch (error) {
const errorDetails = formatErrorDetails(error, agentId);
@@ -13838,6 +13840,9 @@ If using apply_patch, use this exact relative patch path: ${applyPatchRelativePa
settingsManager.pinGlobal(agentId);
}
if (newName && newName !== agentName) {
cmd.agentHint = `Your name is now "${newName}" — acknowledge this and save your new name to memory.`;
}
cmd.finish(
`Pinned "${newName || agentName || agentId.slice(0, 12)}" ${scopeText}.`,
true,

View File

@@ -22,6 +22,8 @@ export type CommandHandle = {
preformatted?: boolean,
) => void;
fail: (output: string) => void;
/** Extra context included only in the agent-facing reminder, not shown in the UI. */
agentHint?: string;
};
export type CommandFinishedEvent = {
@@ -31,6 +33,8 @@ export type CommandFinishedEvent = {
success: boolean;
dimOutput?: boolean;
preformatted?: boolean;
/** Extra context included only in the agent-facing reminder, not shown in the UI. */
agentHint?: string;
};
type CreateId = (prefix: string) => string;
@@ -69,6 +73,14 @@ export function createCommandRunner({
onCommandFinished,
}: RunnerDeps) {
function getHandle(id: string, input: string): CommandHandle {
const handle: CommandHandle = {
id,
input,
update: null!,
finish: null!,
fail: null!,
};
const update = (updateData: CommandUpdate) => {
const previous = buffersRef.current.byId.get(id);
const wasFinished =
@@ -90,13 +102,16 @@ export function createCommandRunner({
success: next.success !== false,
dimOutput: next.dimOutput,
preformatted: next.preformatted,
agentHint: handle.agentHint,
});
}
refreshDerived();
};
const finish = (
handle.update = update;
handle.finish = (
finalOutput: string,
success = true,
dimOutput?: boolean,
@@ -110,14 +125,14 @@ export function createCommandRunner({
preformatted,
});
const fail = (finalOutput: string) =>
handle.fail = (finalOutput: string) =>
update({
output: finalOutput,
phase: "finished",
success: false,
});
return { id, input, update, finish, fail };
return handle;
}
function start(input: string, output: string): CommandHandle {