v1.3.0: Bedrock translator refactor, usage metrics, session restore fixes, and predefined rules
Major changes: - **Bedrock translator architecture**: Extract orchestration logic from `impl.rs` into a dedicated `translator.rs` module. Rename `convert_request.rs` → `request_translator.rs` and `stream.rs` → `response_translator.rs` for clarity. Remove `tool_docs.rs` (inlined). Remove `fallback_to_warp` setting and server fallback path — Bedrock is now the sole backend. - **Unknown tool handling**: The response translator now detects hallucinated/unknown tool calls from the model and synthesizes error tool_results so the conversation doesn't deadlock waiting for a result that will never come. - **Usage display overhaul**: Replace credit-based usage display with detailed token metrics showing context window %, cache hit rate (read/write/miss), and estimated cost in dollars. Add `total_input_tokens`, `total_cache_read_tokens`, `total_cache_write_tokens`, and `cache_miss_tokens` accessors to `AIConversation`. - **Predefined rules system**: Add `predefined_rules.rs` with 11 system-defined behavioral rules that are auto-seeded on first launch. Add "Add Predefined Rules" button to the Rules UI for re-adding them later. Track seeding state via `has_seeded_predefined_rules` setting. - **Session restore improvements**: Rename database file from `warp.sqlite` to `galaxy.sqlite` with automatic migration from both same-directory and state_dir legacy paths. Improve CWD persistence by falling back to `session_startup_path` for agent-mode and fresh tabs. Add extensive session-save/restore logging. - **Shell bootstrap rebrand**: Rename `WARP_INITIAL_WORKING_DIR` environment variable to `GALAXY_INITIAL_WORKING_DIR` across bash, zsh, and fish bootstrap scripts. - **Model defaults**: Change default Bedrock model from Opus 4.7 to Opus 4.6. Add `context_window_for_model()` helper with model-aware context sizes. Remove `is_bedrock_model()` (no longer needed without server fallback). - **User query persistence**: The response translator now emits a `UserQuery` proto message at stream start so the user's prompt persists across sessions for conversation titles. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
ec99146ccc
commit
eaa2ddc75e
+19
-10
@@ -1110,16 +1110,6 @@ define_settings_group!(AISettings, settings: [
|
||||
toml_path: "ai.bedrock.cross_region_inference",
|
||||
description: "Whether to automatically add cross-region inference prefixes to model IDs.",
|
||||
}
|
||||
// Whether to fall back to routing through the Warp server when Bedrock credentials fail.
|
||||
bedrock_fallback_to_warp: BedrockFallbackToWarp {
|
||||
type: bool,
|
||||
default: false,
|
||||
supported_platforms: SupportedPlatforms::DESKTOP,
|
||||
sync_to_cloud: SyncToCloud::Globally(RespectUserSyncSetting::Yes),
|
||||
private: false,
|
||||
toml_path: "ai.bedrock.fallback_to_warp",
|
||||
description: "Whether to fall back to the Galaxy server when Bedrock credentials are invalid.",
|
||||
}
|
||||
// Custom Bedrock model configurations.
|
||||
bedrock_models: BedrockModels {
|
||||
type: Vec<BedrockModelConfig>,
|
||||
@@ -1528,6 +1518,17 @@ define_settings_group!(AISettings, settings: [
|
||||
toml_path: "agents.warp_agent.other.agent_attribution_enabled",
|
||||
description: "Whether the Galaxy Agent adds an attribution co-author line to commit messages and pull requests it creates.",
|
||||
}
|
||||
|
||||
// Tracks whether predefined system rules have been seeded on first launch.
|
||||
// Once set to true, predefined rules will not be auto-created again even if the user
|
||||
// deletes all their rules.
|
||||
has_seeded_predefined_rules: HasSeededPredefinedRules {
|
||||
type: bool,
|
||||
default: false,
|
||||
supported_platforms: SupportedPlatforms::ALL,
|
||||
sync_to_cloud: SyncToCloud::Globally(RespectUserSyncSetting::No),
|
||||
private: true,
|
||||
}
|
||||
]);
|
||||
|
||||
impl AISettings {
|
||||
@@ -1992,6 +1993,14 @@ impl AISettings {
|
||||
.plugin_update_chip_dismissed_for_version_map
|
||||
.set_value(map, ctx));
|
||||
}
|
||||
|
||||
pub fn has_seeded_predefined_rules(&self) -> bool {
|
||||
*self.has_seeded_predefined_rules
|
||||
}
|
||||
|
||||
pub fn mark_predefined_rules_seeded(&mut self, ctx: &mut ModelContext<Self>) {
|
||||
report_if_error!(self.has_seeded_predefined_rules.set_value(true, ctx));
|
||||
}
|
||||
}
|
||||
|
||||
/// Singleton model that caches compiled regexes for the `cli_agent_footer_enabled_commands`
|
||||
|
||||
Reference in New Issue
Block a user