fix(auto): cache lastCommandCtx from any SF command so Ctrl+Y works immediately
Previously required /autonomous first. Now any slash command (/next, /chat, /clear etc.) caches the ExtensionCommandContext, so Ctrl+Y YOLO shortcut works on first press after any command interaction. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
parent
d56e68c789
commit
d8c687702b
1 changed files with 11 additions and 0 deletions
|
|
@ -33,6 +33,17 @@ export function registerSFCommands(pi) {
|
|||
getArgumentCompletions: (prefix) =>
|
||||
getSfTopLevelCommandCompletions(command.cmd, prefix),
|
||||
handler: async (args, ctx) => {
|
||||
// Cache this command ctx so shortcut handlers (Ctrl+Y) can fall back
|
||||
// to a valid ExtensionCommandContext that has newSession().
|
||||
// Import lazily to avoid a circular dep at module load time.
|
||||
importExtensionModule(import.meta.url, "../auto/session.js").then(
|
||||
({ getAutoSession }) => {
|
||||
const s = getAutoSession();
|
||||
if (typeof ctx.newSession === "function") {
|
||||
s.lastCommandCtx = ctx;
|
||||
}
|
||||
},
|
||||
).catch(() => {});
|
||||
await dispatchDirectSFCommand(command.cmd, args, ctx, pi);
|
||||
},
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue