Skip to content

feat(preview): auto-cerrar sidebar al abrir panel de previsualización#213

Open
Saul-Gomez-J wants to merge 20 commits intolevante-hub:developfrom
Saul-Gomez-J:improve/lateral-pannel
Open

feat(preview): auto-cerrar sidebar al abrir panel de previsualización#213
Saul-Gomez-J wants to merge 20 commits intolevante-hub:developfrom
Saul-Gomez-J:improve/lateral-pannel

Conversation

@Saul-Gomez-J
Copy link
Contributor

Summary

  • Al abrir el panel de previsualización web, el sidebar izquierdo se cierra automáticamente para dar más espacio
  • El ancho por defecto del panel aumenta de 480px a 640px para una mejor visualización inicial
  • El sidebar puede reabrirse manualmente con el trigger existente (botón PanelLeft en el header)

Cambios

  • src/renderer/components/chat/WebPreviewPanel.tsx: añadido useSidebar hook + useEffect que colapsa el sidebar al detectar isPanelOpen = true, y DEFAULT_PANEL_WIDTH 480 → 640

Test plan

  • Levantar la app en desarrollo
  • Iniciar una tarea que arranque un servidor local
  • Al aparecer el toast y abrir el preview, verificar que el sidebar se cierra automáticamente
  • Verificar que el panel aparece con ~640px de ancho inicial
  • Verificar que el sidebar se puede reabrir pulsando el trigger del header

🤖 Generated with Claude Code

Saúl Gómez Jiménez and others added 20 commits February 22, 2026 22:19
Los comandos ejecutados en background ya no tienen timeout. Se elimina el
parámetro timeout de SpawnTaskOptions, la lógica handleTimeout y el mapa
de timeouts en BackgroundTaskManager, y el parámetro timeout de la bash tool.
La descripción de la tool se actualiza para reflejar que los foreground
commands mantienen timeout pero los background corren indefinidamente.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
El componente BackgroundTasksDropdown retorna null cuando stats.running
es 0, evitando mostrar el control en la UI sin tareas en ejecución.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Añade ProjectPage como vista dedicada para un proyecto, que muestra sus
conversaciones y un input para iniciar una nueva con mensaje inicial.
Los proyectos en el sidebar pasan de ser acordeones expandibles a items
clickables que navegan a ProjectPage. Se reemplaza onNewSessionInProject
por onProjectSelect y selectedProjectId en ChatList y ChatPage.
El manejo de pendingPrompt en ChatPage se mejora para auto-enviar cuando
aún no existe sesión activa (caso de venir desde ProjectPage).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- write.ts: genera diff, linesAdded y linesRemoved comparando con contenido previo antes de sobrescribir. Solo silencia ENOENT; cualquier otro error de lectura se propaga.
- diff-viewer.tsx: nuevo componente que parsea unified diff e imprime líneas añadidas (verde), eliminadas (rojo) y contexto con numeración de líneas.
- tool-call.tsx: ResultSection detecta tools write/edit y muestra DiffViewer por defecto. Botones Raw/Diff permiten alternar vistas. Early return evita serialización JSON pesada cuando se muestra el diff.
- Tests: write.test.ts (4 casos) y edit-diff.test.ts (2 casos), todos pasando.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ter is absent

Skills without an explicit user-invocable field in their frontmatter were
being parsed as false, causing them to be silently filtered out of the AI
context. When the field is absent it should default to undefined so that
buildSkillsContext includes the skill by default.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Restores the complete tool approval system that was removed when PR levante-hub#173
was reverted. The code is recovered from commit 3b917fc before it was
lost in the develop merge.

Changes:
- Add tool-approval.tsx component with Approve / Deny / Approve for session buttons
- Add useToolAutoApproval hook for per-session server auto-approval
- Add toolApproval field to ChatStreamChunk type (preload and aiService)
- Handle tool-approval-request chunks in aiService switch statement
- Handle toolApproval chunks in ElectronChatTransport (emits AI SDK tool-approval-request)
- Render ToolApprovalInline in ChatMessageItem when part.state === approval-requested
- Add addToolApprovalResponse + sendAutomaticallyWhen to useChat in ChatPage
- Convert denied tools to output-available in sanitizeMessagesForModel to avoid Anthropic 500 errors
- Clear auto-approvals on session change

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…l parameters

- Add needsApproval: true to bash, write, and edit coding tools so they
  require user approval in cowork mode before execution
- Fix tool parameters not being passed after approval: AI SDK v5 puts
  tool arguments in chunk.input, not chunk.arguments. Restore the
  dual-source fallback: chunk.input || chunk.arguments || {}

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… approval

- Use toolCall.arguments.file_path as fallback when diffContent.path is absent so the filename always appears in the diff collapsible trigger
- Add diff preview (DiffViewer + Collapsible) to ToolApprovalInline for edit/write tools
- Remove duplicate diff rendering from ResultSection in tool-call.tsx (now rendered inline in ChatMessageItem)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Remove Mini Chat modules from main process (tray, global shortcuts,
  mini-chat window creation and IPC registration)
- Remove mini-chat entry point from Vite renderer build config
- Add docs: skills-in-chat UI plan, MCP tools diagnostics, tool approval recovery plan

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Implements full Skills management from the chat input bar:

- New `enableSkills` preference (default true) controls panel visibility
- Settings gear: toggle "Show skills in chat" alongside MCP/Cowork
- BookOpen button in toolbar opens a Skills panel dropdown
- SkillsPanel shows installed skills filtered by chat context:
  - With project → project + global skills (new `project-and-global` mode)
  - Without project → global skills only
- Per-skill toggle (Switch) persists `user-invocable` in skill.md via IPC
- Optimistic update with rollback on failure
- Source label removed from Cowork indicator in chat bar (kept in settings)

Backend changes:
- New `SetUserInvocableOptions` type and `project-and-global` list mode
- `skillsService.setUserInvocable()` updates frontmatter without touching markdown
- IPC handler `levante/skills:setUserInvocable`
- Preload API + LevanteAPI interface extended
- `skillsStore.loadInstalledForChat()` and `toggleUserInvocable()` actions
- 23 unit tests passing (skillsService + skillsStore)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…royecto directamente desde new-chat, si tenemos el side-panel plegado
Unify navigation between installed items and the store catalog.
Both MCP and Skills sections now share the same pattern: a default
installed view and a store view toggled via a centered button below
the section tabs.

- StorePage: add `installed` state, centered tabs, See store / Back button
- StoreLayout: accept `installed` prop, render only installed or catalog section
- SkillsPage: accept `installed` prop, filter to installed-only, unify layout
  with MCP (max-w-4xl, text-3xl title, single scrollable div)
- SkillCard: show 'Add to project' button when skill is already installed

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…OAuth

Refactor Levante Platform from a regular provider into a dedicated app mode
(platform vs standalone) with OAuth 2.1 + PKCE authentication, JWT-based
model access, reactive mode switching, and dedicated Account page.

- Add PlatformService (main) with OAuth login/logout, JWT decode, model fetch
- Add platformStore (Zustand) for app mode, auth state, and platform models
- Add ModeSelectionStep to onboarding wizard for platform vs standalone choice
- Add AccountPage with user info, allowed models, and logout confirmation
- Add platform sign-in card to ModelPage for standalone → platform transition
- Update providerResolver to route chat completions through platform in platform mode
- Update useModelSelection to branch model loading by appMode
- Update MainLayout sidebar to reactively switch between Account and Models
- Update App.tsx with reactive mode switching (welcome dialog, auto-navigation)
- Add IPC handlers and preload bridge for levante/platform/* channels
- Add i18n support (en/es) for all platform UI strings
- Remove legacy levante-platform provider code (levanteProvider, useLevantePlatformOAuth)
- Add platform-mode.md architecture documentation

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…asoning panel

## OAuth Anthropic (Claude Max/Pro)

Implementa autenticación OAuth 2.0 + PKCE para usuarios con suscripción
Claude Max o Claude Pro, permitiendo usar Levante sin API key de Anthropic.

### Nuevos archivos
- `AnthropicOAuthService`: servicio singleton con flujo completo OAuth 2.0 +
  PKCE, refresco automático de tokens y soporte para múltiples formatos de
  entrada del código de autorización (URL, query string, código plano)
- `anthropicOAuthHandlers`: IPC handlers (`levante/anthropic/oauth/*`) con
  TTL de 10 min para el flujo pendiente
- `anthropicOAuth` (preload): bridge seguro al renderer para start/exchange/
  status/disconnect

### Cambios en la cadena de providers
- `ProviderConfig`: nuevo campo `authMode: 'api-key' | 'oauth'`
- `providerResolver`: `configureAnthropic` pasa a async e inyecta token OAuth
  como Bearer con header `anthropic-beta: oauth-2025-04-20`
- `modelFetchService`: `fetchAnthropicModels` acepta `{ apiKey?, authMode? }`;
  en modo OAuth hace la llamada con Bearer token y tiene lista de fallback si
  el endpoint devuelve vacío
- `modelService`: lógica de sync considera `authMode === 'oauth'` como
  credencial válida
- `anthropicProvider` (renderer): actualiza firma a objeto params
- `initialization`: registra los nuevos IPC handlers

### UI
- `ProviderConfigs`: nuevo componente `AnthropicConfig` con selector de modo
  (API Key / Claude Max·Pro), flujo guiado de conexión OAuth y estado de
  sesión (conectado / expirado / desconectar)
- `ModelPage`: usa `AnthropicConfig` para el provider anthropic; las
  condiciones de badge "Configurado" y botón de sync contemplan `authMode`

## Fix reasoning panel

Corrige el bug donde el panel de razonamiento se reabría automáticamente
durante el streaming tras haberlo cerrado manualmente. Se añade el flag
`userManuallyClosed` para bloquear el auto-open mientras el usuario lo
haya cerrado explícitamente en esa sesión de streaming.

## Fix Anthropic thinking options

Corrige el formato del objeto `thinking` en `reasoningResolver`:
usaba `enabled: boolean` pero la SDK espera `type: 'enabled' | 'disabled'`.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Añade ModelSearchableSelect en la barra inferior del textarea de ProjectPage,
  permitiendo al usuario elegir el modelo antes de crear el chat
- Pre-selecciona automáticamente lastUsedModel si está disponible entre los modelos activos
- Deshabilita el botón de envío si no hay texto o no hay modelo seleccionado
- Pasa el modelId seleccionado a handleNewSessionInProject para evitar la
  auto-detección redundante en App.tsx (se mantiene como fallback)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Cierra el sidebar izquierdo automáticamente al abrir WebPreviewPanel
- Aumenta el ancho por defecto del panel de 480px a 640px para mayor visibilidad

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.

2 participants