Rimossi i provider integrati OpenAI, Bedrock e GCP e ogni fallback a OpenAI (B)
Parte "sicurezza" della fase 3 di aKode (e39aae00), senza le funzioni di imeAI:
- via i provider integrati openai, amazon-bedrock, amazon-bedrock-runtime e gcp
(crate model-provider: moduli amazon_bedrock, gcp, chatgpt_base_url; login Bedrock;
onboarding Bedrock/GCP; richieste app-server di setup cloud);
- nessun URL predefinito verso api.openai.com / chatgpt.com: un provider senza
base_url non viene mai contattato; senza model_provider configurato exec e TUI
mostrano come scriverne uno in config.toml (NO_MODEL_PROVIDER_CONFIGURED_ERROR);
- via la skill openai-docs, la sample skill-installer (scaricava da github.com/openai/skills),
request_plugin_install, AppsInstructions, URL predefiniti di realtime e updater;
- test di sicurezza adattati (provider "mock" al posto di quello integrato), non cancellati.
Restano fuori da questo commit (categoria F/D/E, non portate): chiave per provider nel
portachiavi, modelli da /models, unione dei messaggi di sistema, crate web-tools e
SearXNG, header @@ in apply_patch, modello ausiliario, tool function per apply_patch.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
//! Onboarding screen orchestration and top-level keyboard routing.
|
||||
//!
|
||||
//! The onboarding flow is a small state machine over visible steps
|
||||
//! (welcome/auth/trust/GovCloud). This module decides which step receives key/paste
|
||||
//! (welcome/auth/trust). This module decides which step receives key/paste
|
||||
//! events and enforces flow-level safety rules that cut across individual step
|
||||
//! widgets. Folder-entry consent reuses this same event loop for startup and in-app navigation.
|
||||
//!
|
||||
@@ -41,7 +41,6 @@ use crate::legacy_core::config::Config;
|
||||
use crate::onboarding::auth::AuthModeWidget;
|
||||
use crate::onboarding::auth::SignInOption;
|
||||
use crate::onboarding::auth::SignInState;
|
||||
use crate::onboarding::bedrock::BedrockState;
|
||||
use crate::onboarding::keys;
|
||||
use crate::onboarding::trust_directory::TrustDirectorySelection;
|
||||
use crate::onboarding::trust_directory::TrustDirectoryWidget;
|
||||
@@ -67,10 +66,6 @@ enum Step {
|
||||
Welcome(WelcomeWidget),
|
||||
Auth(AuthModeWidget),
|
||||
TrustDirectory(TrustDirectoryWidget),
|
||||
GovCloudGuidance {
|
||||
state: BedrockState,
|
||||
acknowledged: bool,
|
||||
},
|
||||
}
|
||||
|
||||
pub(crate) trait KeyboardHandler {
|
||||
@@ -101,8 +96,6 @@ pub(crate) struct OnboardingScreenArgs {
|
||||
pub show_trust_screen: bool,
|
||||
pub remote_project_trust: Option<RemoteProjectTrust>,
|
||||
pub show_login_screen: bool,
|
||||
pub bedrock_setup_enabled: bool,
|
||||
pub gcp_setup_enabled: bool,
|
||||
pub gateway_setup_enabled: bool,
|
||||
pub login_status: LoginStatus,
|
||||
pub app_server_target: crate::AppServerTarget,
|
||||
@@ -131,8 +124,6 @@ impl OnboardingScreen {
|
||||
show_trust_screen,
|
||||
remote_project_trust,
|
||||
show_login_screen,
|
||||
bedrock_setup_enabled,
|
||||
gcp_setup_enabled,
|
||||
gateway_setup_enabled,
|
||||
login_status,
|
||||
app_server_target,
|
||||
@@ -180,8 +171,6 @@ impl OnboardingScreen {
|
||||
app_server_target,
|
||||
app_server_request_handle,
|
||||
auth_config,
|
||||
bedrock_setup_enabled,
|
||||
gcp_setup_enabled,
|
||||
gateway_setup_enabled,
|
||||
gateway: None,
|
||||
}));
|
||||
@@ -285,7 +274,7 @@ impl OnboardingScreen {
|
||||
pub(super) fn auth_widget_mut(&mut self) -> Option<&mut AuthModeWidget> {
|
||||
self.steps.iter_mut().find_map(|step| match step {
|
||||
Step::Auth(widget) => Some(widget),
|
||||
Step::Welcome(_) | Step::TrustDirectory(_) | Step::GovCloudGuidance { .. } => None,
|
||||
Step::Welcome(_) | Step::TrustDirectory(_) => None,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -326,7 +315,7 @@ impl KeyboardHandler for OnboardingScreen {
|
||||
/// Route key events to onboarding steps while preserving text-entry safety.
|
||||
///
|
||||
/// OpenAI API-key entry suppresses printable quit bindings after typing
|
||||
/// starts, while cloud provider fields suppress them from the first character.
|
||||
/// starts, while provider setup fields suppress them from the first character.
|
||||
/// Control/alt quit chords still work as emergency exits.
|
||||
fn handle_key_event(&mut self, key_event: KeyEvent) {
|
||||
if key_event.kind == KeyEventKind::Release {
|
||||
@@ -344,12 +333,7 @@ impl KeyboardHandler for OnboardingScreen {
|
||||
// If the user cancels the auth menu, exit the app rather than
|
||||
// leave the user at a prompt in an unauthed state.
|
||||
self.should_exit = true;
|
||||
} else if self.is_trust_step_active()
|
||||
|| self
|
||||
.steps
|
||||
.iter()
|
||||
.any(|step| matches!(step, Step::GovCloudGuidance { .. }))
|
||||
{
|
||||
} else if self.is_trust_step_active() {
|
||||
self.should_exit = true;
|
||||
}
|
||||
self.is_done = true;
|
||||
@@ -413,7 +397,7 @@ impl WidgetRef for &OnboardingScreen {
|
||||
for step in self.current_steps() {
|
||||
match step {
|
||||
Step::Welcome(widget) => widget.set_presentation(logo_presentation),
|
||||
Step::Auth(_) | Step::TrustDirectory(_) | Step::GovCloudGuidance { .. } => {}
|
||||
Step::Auth(_) | Step::TrustDirectory(_) => {}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -487,18 +471,12 @@ impl KeyboardHandler for Step {
|
||||
Step::Welcome(widget) => widget.handle_key_event(key_event),
|
||||
Step::Auth(widget) => widget.handle_key_event(key_event),
|
||||
Step::TrustDirectory(widget) => widget.handle_key_event(key_event),
|
||||
Step::GovCloudGuidance {
|
||||
state,
|
||||
acknowledged,
|
||||
} => {
|
||||
*acknowledged = state.handle_guidance_key_event(&key_event);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn handle_paste(&mut self, pasted: String) {
|
||||
match self {
|
||||
Step::Welcome(_) | Step::GovCloudGuidance { .. } => {}
|
||||
Step::Welcome(_) => {}
|
||||
Step::Auth(widget) => widget.handle_paste(pasted),
|
||||
Step::TrustDirectory(widget) => widget.handle_paste(pasted),
|
||||
}
|
||||
@@ -511,13 +489,6 @@ impl StepStateProvider for Step {
|
||||
Step::Welcome(w) => w.get_step_state(),
|
||||
Step::Auth(w) => w.get_step_state(),
|
||||
Step::TrustDirectory(w) => w.get_step_state(),
|
||||
Step::GovCloudGuidance { acknowledged, .. } => {
|
||||
if *acknowledged {
|
||||
StepState::Complete
|
||||
} else {
|
||||
StepState::InProgress
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -534,32 +505,10 @@ impl WidgetRef for Step {
|
||||
Step::TrustDirectory(widget) => {
|
||||
widget.render_ref(area, buf);
|
||||
}
|
||||
Step::GovCloudGuidance { state, .. } => state.render(area, buf, /*error*/ None),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) async fn run_gov_cloud_guidance(tui: &mut Tui) -> Result<()> {
|
||||
let screen = OnboardingScreen {
|
||||
request_frame: tui.frame_requester(),
|
||||
steps: vec![Step::GovCloudGuidance {
|
||||
state: BedrockState::guidance(),
|
||||
acknowledged: false,
|
||||
}],
|
||||
remote_trust_key: None,
|
||||
is_done: false,
|
||||
should_exit: false,
|
||||
};
|
||||
let result = run_onboarding_screen(
|
||||
screen, /*app_server_request_handle*/ None, /*app_server*/ None, tui,
|
||||
)
|
||||
.await?;
|
||||
if result.should_exit {
|
||||
return Err(std::io::Error::new(std::io::ErrorKind::Interrupted, StartupCancelled).into());
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) async fn run_onboarding_app(
|
||||
args: OnboardingScreenArgs,
|
||||
app_server: Option<&mut AppServerSession>,
|
||||
|
||||
Reference in New Issue
Block a user