feat(chat): propage l'intention chat → require_structured dans le pipeline de lancement
- Ajoute le champ cell_kind dans LaunchAgentRequestDto pour distinguer les demandes chat (custom CLI) des lancements PTY historiques - Convertit cellKind:Chat en require_structured:true dans commands.rs et web-server/src/lib.rs - Implémente la logique de routing structuré dans LaunchAgent::execute : - valide que require_structured implique un profil avec structured_adapter - remplace une session PTY existante quand require_structured est vrai - route vers structured seulement quand wants_structured est vrai - Met à jour tous les appels historiques avec require_structured:false pour préserver le contrat PTY - Ajoute les tests unitaires human_launcher_with_chat_intent_routes_structured_profile_to_chat_session et chat_intent_replaces_existing_pty_instead_of_returning_pty_session - Wire les ports structured dans BackendCore pour le launcher humain Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@ -2823,6 +2823,11 @@ pub struct LaunchAgentRequestDto {
|
||||
/// refused).
|
||||
#[serde(default)]
|
||||
pub node_id: Option<String>,
|
||||
/// Requested render/runtime kind for this launch. Omitted by historical callers
|
||||
/// and native TUI cells, which keeps the backend on the PTY path. The custom chat
|
||||
/// view sends `"chat"` to require a structured/headless session.
|
||||
#[serde(default)]
|
||||
pub cell_kind: Option<CellKind>,
|
||||
}
|
||||
|
||||
impl From<LaunchAgentOutput> for TerminalSessionDto {
|
||||
|
||||
@ -725,6 +725,7 @@ impl WakeSessionProvider for AppWakeSessionProvider {
|
||||
conversation_id: None,
|
||||
mcp_runtime: None,
|
||||
allow_structured_alongside_pty: true,
|
||||
require_structured: false,
|
||||
})
|
||||
.await
|
||||
.map_err(|err| WakeError::Session(err.to_string()))?;
|
||||
@ -844,6 +845,7 @@ impl AgentResumer for AppAgentResumer {
|
||||
conversation_id,
|
||||
mcp_runtime,
|
||||
allow_structured_alongside_pty: false,
|
||||
require_structured: false,
|
||||
})
|
||||
.await?;
|
||||
|
||||
@ -2028,9 +2030,9 @@ impl BackendCore {
|
||||
// LaunchAgent shares the SAME pty_port and terminal_sessions as the terminal
|
||||
// use cases — indispensable for transport bridges to work correctly.
|
||||
//
|
||||
// The human-facing launcher intentionally stays PTY-only: when the user opens an
|
||||
// agent cell, they keep the native Claude/Codex CLI and its commands. Inter-agent
|
||||
// delegation gets its own launcher below, wired to structured/headless sessions.
|
||||
// The human-facing launcher defaults to PTY for native Claude/Codex TUI cells, but
|
||||
// it also carries the structured ports so the custom chat CLI can explicitly
|
||||
// request a structured/headless launch through the same Tauri command.
|
||||
|
||||
// --- Permission projectors (lot LP3-5) ---
|
||||
// UN seul registre, source unique de vérité, injecté à l'identique dans
|
||||
@ -2084,7 +2086,11 @@ impl BackendCore {
|
||||
clock: Arc::clone(&clock) as Arc<dyn Clock>,
|
||||
}) as Arc<dyn LiveStateLeanProvider>)
|
||||
.with_local_model_server(Arc::clone(&ensure_local_model_server))
|
||||
.with_secret_store(Arc::clone(&secret_store_port)),
|
||||
.with_secret_store(Arc::clone(&secret_store_port))
|
||||
.with_structured(
|
||||
Arc::clone(&session_factory),
|
||||
Arc::clone(&structured_sessions),
|
||||
),
|
||||
);
|
||||
|
||||
// Inter-agent launcher: same context, memory, permissions and live-state
|
||||
|
||||
Reference in New Issue
Block a user