Skip to content

Add session commands, auth picker, and completion#191

Merged
OmarMcAdam merged 6 commits intodifferent-ai:devfrom
Golenspade:feat/session-rename-sort
Jan 23, 2026
Merged

Add session commands, auth picker, and completion#191
OmarMcAdam merged 6 commits intodifferent-ai:devfrom
Golenspade:feat/session-rename-sort

Conversation

@Golenspade
Copy link
Copy Markdown
Contributor

Summary

  • Add /model, /connect, /auth, /agent, /save, and /rename command support in the session prompt.
  • Provide a provider auth picker modal to avoid guessing provider IDs.
  • Add command autocomplete with arrow/Tab navigation and Enter-to-run.
  • Sort sessions by activity and support session renaming.

Testing

  • pnpm --filter @different-ai/openwork typecheck
  • pnpm --filter @different-ai/openwork test:e2e

Copilot AI review requested due to automatic review settings January 22, 2026 07:13
@github-actions
Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds comprehensive command support to the session prompt interface, including provider authentication, model selection, agent management, and session operations. It introduces a provider auth picker modal to simplify authentication flows and implements command autocomplete with keyboard navigation. Sessions are now sorted by activity timestamp for better UX.

Changes:

  • Added six new session commands: /model, /connect, /auth, /agent, /save, and /rename
  • Implemented command autocomplete with arrow key/Tab navigation and Enter-to-execute
  • Added provider authentication modal with OAuth/API key method display
  • Implemented session sorting by activity (updated/created timestamps)

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
packages/desktop/src/app/pages/session.tsx Added command handlers, autocomplete logic, provider auth modal integration, and helper functions for command argument extraction
packages/desktop/src/app/demo-state.ts Added session sorting by activity and demo session rename functionality
packages/desktop/src/app/context/session.ts Implemented session activity sorting utilities and remote session rename function
packages/desktop/src/app/components/provider-auth-modal.tsx New modal component for selecting and authenticating providers with OAuth/API key indicators
packages/desktop/src/app/app.tsx Added state management, API functions for auth/agent/save/rename operations, and integration with session view

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

}

if (!candidate) {
setCommandToast("Agent name is required");
Copy link

Copilot AI Jan 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing clearPrompt() call when agent name is required. When the candidate agent name is empty (line 473-475), the command shows a toast but doesn't clear the prompt. This is inconsistent with other error paths in commands which typically clear the prompt. Consider adding clearPrompt() after the toast message for consistency.

Suggested change
setCommandToast("Agent name is required");
setCommandToast("Agent name is required");
clearPrompt();

Copilot uses AI. Check for mistakes.
(agent) => agent.name.toLowerCase() === candidate.toLowerCase(),
);
if (!match) {
setCommandToast(`Unknown agent. Available: ${formatListHint(agentNames)}`);
Copy link

Copilot AI Jan 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing clearPrompt() call when agent is unknown. When an agent is not found (line 481-483), the command shows a toast but doesn't clear the prompt. This is inconsistent with other error paths in commands which typically clear the prompt. Consider adding clearPrompt() after the toast message for consistency.

Suggested change
setCommandToast(`Unknown agent. Available: ${formatListHint(agentNames)}`);
setCommandToast(`Unknown agent. Available: ${formatListHint(agentNames)}`);
clearPrompt();

Copilot uses AI. Check for mistakes.
}

if (!nextTitle) {
setCommandToast("Session name is required");
Copy link

Copilot AI Jan 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing clearPrompt() call when session name validation fails. When the session title is empty after trimming (line 531-533), the command shows a toast but doesn't clear the prompt. This is inconsistent with other error paths in commands which typically clear the prompt. Consider adding clearPrompt() after the toast message for consistency.

Suggested change
setCommandToast("Session name is required");
setCommandToast("Session name is required");
clearPrompt();

Copilot uses AI. Check for mistakes.
try {
const providerId = extractCommandArgs(props.prompt);
if (providerId) {
const message = await props.startProviderAuth(providerId || undefined);
Copy link

Copilot AI Jan 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Redundant condition in the auth command. Line 423 extracts providerId from the command args, and line 425 evaluates providerId || undefined. However, if providerId is truthy (line 424's condition), then providerId || undefined will always be providerId, making the || undefined part unnecessary. This should be simplified to just pass providerId.

Suggested change
const message = await props.startProviderAuth(providerId || undefined);
const message = await props.startProviderAuth(providerId);

Copilot uses AI. Check for mistakes.
Comment on lines +665 to +673
if (event.key === "Enter") {
event.preventDefault();
const active = matches[commandIndex()];
if (active) {
applyCommandCompletion(active.id);
runCommand(active.id);
return;
}
}
Copy link

Copilot AI Jan 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Enter key handling logic appears redundant. Lines 665-673 handle Enter when the command menu is open by applying the completion and running the command. However, lines 676-679 also handle Enter (after the menuOpen condition block), which calls handlePrimaryAction. The handlePrimaryAction function (lines 613-624) already contains logic to handle command menu execution. This creates duplication where Enter in the command menu context is handled twice - once explicitly here and once through handlePrimaryAction. Consider removing lines 665-673 and relying solely on the handlePrimaryAction logic for consistency.

Suggested change
if (event.key === "Enter") {
event.preventDefault();
const active = matches[commandIndex()];
if (active) {
applyCommandCompletion(active.id);
runCommand(active.id);
return;
}
}

Copilot uses AI. Check for mistakes.

const agents = await props.listAgents();
if (!agents.length) {
setCommandToast("No agents available");
Copy link

Copilot AI Jan 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing clearPrompt() call when no agents are available. When the agent list is empty (line 458-460), the command shows a toast but doesn't clear the prompt input. This is inconsistent with other error paths in commands which typically clear the prompt. Consider adding clearPrompt() after the toast message for consistency.

Suggested change
setCommandToast("No agents available");
setCommandToast("No agents available");
clearPrompt();

Copilot uses AI. Check for mistakes.
@benjaminshafii
Copy link
Copy Markdown
Member

@Golenspade wow that looks great. Will look a bit deeper and test and report back. But really appreciate the direction.

@OmarMcAdam OmarMcAdam force-pushed the feat/session-rename-sort branch from 6302150 to 9c22d56 Compare January 22, 2026 21:46
@OmarMcAdam OmarMcAdam merged commit 1d4a241 into different-ai:dev Jan 23, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants