Compare commits
3 Commits
a005236bcb
...
546bd1da18
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
546bd1da18 | ||
|
|
c82e09f0ff | ||
|
|
ea5eef634a |
16
README.md
16
README.md
@@ -127,6 +127,22 @@ Il token sta nell'archivio delle chiavi (`provider_api_key_store`, id `telegram-
|
|||||||
|
|
||||||
## Novità
|
## Novità
|
||||||
|
|
||||||
|
### 0.4.0
|
||||||
|
|
||||||
|
- Memoria a lungo termine di imeAI con il plugin `memoria` (nel repository imeai-console): aKode richiama le preferenze e le convenzioni del progetto prima di agire e propone i fatti da ricordare; le istruzioni del plugin entrano nel prompt solo se il plugin è attivo e il server risponde. Attivazione:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
akode plugin marketplace add /percorso/di/imeai-console
|
||||||
|
akode plugin add memoria@imeai
|
||||||
|
printf %s "$CHIAVE_IMEAI" | akode login --provider mcp:memoria --with-api-key
|
||||||
|
akode mcp list
|
||||||
|
```
|
||||||
|
|
||||||
|
Funziona con qualunque provider del modello: il server MCP è separato.
|
||||||
|
- Server MCP: `project_header` (progetto ricavato dal remote `origin` della cartella, connessioni separate per progetto), `pollutes_memory`, token Bearer anche dal portachiavi di aKode sotto `mcp:<server>` (mai le chiavi dei provider dei modelli).
|
||||||
|
- I tool con namespace (MCP, multi-agente) vengono inviati come `<namespace>__<tool>`, perché llama.cpp, ik_llama.cpp e vLLM accettano solo function tool; `capabilities.tool_namespaces = true` li lascia com'erano.
|
||||||
|
- `akode exec` avvisa se un server MCP non risponde e continua senza i suoi strumenti; `akode login --provider mcp:<server>` non mostra più l'avviso dei provider di modelli; tolti dai suggerimenti della TUI gli ultimi link a siti OpenAI.
|
||||||
|
|
||||||
### 0.3.2
|
### 0.3.2
|
||||||
|
|
||||||
- Nuove istruzioni di sistema: identità aKode, agisce senza annunciare cosa sta per fare, risponde nella lingua dell'utente, circa 1000 parole; gli originali di Codex restano in `protocol/src/prompts/base_instructions/codex-original.md`. Nell'output leggibile di `akode exec` i messaggi dell'agente sono etichettati «akode».
|
- Nuove istruzioni di sistema: identità aKode, agisce senza annunciare cosa sta per fare, risponde nella lingua dell'utente, circa 1000 parole; gli originali di Codex restano in `protocol/src/prompts/base_instructions/codex-original.md`. Nell'output leggibile di `akode exec` i messaggi dell'agente sono etichettati «akode».
|
||||||
|
|||||||
318
akode-rs/Cargo.lock
generated
318
akode-rs/Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -159,7 +159,7 @@ members = [
|
|||||||
resolver = "2"
|
resolver = "2"
|
||||||
|
|
||||||
[workspace.package]
|
[workspace.package]
|
||||||
version = "0.3.2"
|
version = "0.4.0"
|
||||||
# Track the edition for all workspace crates in one place. Individual
|
# Track the edition for all workspace crates in one place. Individual
|
||||||
# crates can still override this value, but keeping it here means new
|
# crates can still override this value, but keeping it here means new
|
||||||
# crates created with `cargo new -w ...` automatically inherit the 2024
|
# crates created with `cargo new -w ...` automatically inherit the 2024
|
||||||
|
|||||||
@@ -194,16 +194,9 @@ pub async fn run_login_provider_api_key(
|
|||||||
let config = load_config_or_exit(cli_config_overrides).await;
|
let config = load_config_or_exit(cli_config_overrides).await;
|
||||||
let _login_log_guard = init_login_file_logging(&config);
|
let _login_log_guard = init_login_file_logging(&config);
|
||||||
tracing::info!("storing a provider API key");
|
tracing::info!("storing a provider API key");
|
||||||
match config.model_providers.get(&provider_id) {
|
if let Some(notice) = provider_key_notice(&provider_id, config.model_providers.get(&provider_id))
|
||||||
Some(provider)
|
{
|
||||||
if provider.api_key
|
eprintln!("{notice}");
|
||||||
== Some(akode_model_provider_info::ProviderApiKeySource::Keyring) => {}
|
|
||||||
Some(_) => eprintln!(
|
|
||||||
"Warning: model_providers.{provider_id} does not set api_key = \"keyring\"; the stored key is used only after you add it."
|
|
||||||
),
|
|
||||||
None => eprintln!(
|
|
||||||
"Warning: model provider `{provider_id}` is not defined in config.toml yet; add [model_providers.{provider_id}] with api_key = \"keyring\"."
|
|
||||||
),
|
|
||||||
}
|
}
|
||||||
match akode_model_provider_info::save_provider_api_key(&provider_id, &api_key) {
|
match akode_model_provider_info::save_provider_api_key(&provider_id, &api_key) {
|
||||||
Ok(location) => {
|
Ok(location) => {
|
||||||
@@ -219,6 +212,33 @@ pub async fn run_login_provider_api_key(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Message printed before saving a key: keys under `mcp:<server>` belong to MCP servers, not
|
||||||
|
/// to model providers, so they never get the model-provider warnings.
|
||||||
|
fn provider_key_notice(
|
||||||
|
provider_id: &str,
|
||||||
|
provider: Option<&akode_model_provider_info::ModelProviderInfo>,
|
||||||
|
) -> Option<String> {
|
||||||
|
if let Some(server) = provider_id.strip_prefix("mcp:") {
|
||||||
|
return Some(format!(
|
||||||
|
"Key for MCP server `{server}`: sent as Bearer token when the server's bearer_token_env_var is not set."
|
||||||
|
));
|
||||||
|
}
|
||||||
|
match provider {
|
||||||
|
Some(provider)
|
||||||
|
if provider.api_key
|
||||||
|
== Some(akode_model_provider_info::ProviderApiKeySource::Keyring) =>
|
||||||
|
{
|
||||||
|
None
|
||||||
|
}
|
||||||
|
Some(_) => Some(format!(
|
||||||
|
"Warning: model_providers.{provider_id} does not set api_key = \"keyring\"; the stored key is used only after you add it."
|
||||||
|
)),
|
||||||
|
None => Some(format!(
|
||||||
|
"Warning: model provider `{provider_id}` is not defined in config.toml yet; add [model_providers.{provider_id}] with api_key = \"keyring\"."
|
||||||
|
)),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Removes the stored API key of one model provider.
|
/// Removes the stored API key of one model provider.
|
||||||
pub async fn run_logout_provider(
|
pub async fn run_logout_provider(
|
||||||
cli_config_overrides: CliConfigOverrides,
|
cli_config_overrides: CliConfigOverrides,
|
||||||
@@ -384,8 +404,22 @@ mod storage_tests;
|
|||||||
mod tests {
|
mod tests {
|
||||||
use pretty_assertions::assert_eq;
|
use pretty_assertions::assert_eq;
|
||||||
|
|
||||||
|
use super::provider_key_notice;
|
||||||
use super::safe_format_key;
|
use super::safe_format_key;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn mcp_keys_get_no_model_provider_warning() {
|
||||||
|
let notice = provider_key_notice("mcp:memoria", None).expect("notice");
|
||||||
|
assert!(notice.contains("MCP server `memoria`"), "{notice}");
|
||||||
|
assert!(!notice.contains("model_providers"), "{notice}");
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn unknown_model_provider_still_warns() {
|
||||||
|
let notice = provider_key_notice("imeai", None).expect("notice");
|
||||||
|
assert!(notice.contains("[model_providers.imeai]"), "{notice}");
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn formats_long_key() {
|
fn formats_long_key() {
|
||||||
let key = "sk-proj-1234567890ABCDE";
|
let key = "sk-proj-1234567890ABCDE";
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
use anyhow::Context;
|
use anyhow::Context;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
|
|
||||||
|
use akode_app_server_protocol::McpServerStartupState;
|
||||||
|
use akode_app_server_protocol::McpServerStatusUpdatedNotification;
|
||||||
use akode_app_server_protocol::ServerNotification;
|
use akode_app_server_protocol::ServerNotification;
|
||||||
use akode_core::config::Config;
|
use akode_core::config::Config;
|
||||||
use akode_exec_server::BoundOutput;
|
use akode_exec_server::BoundOutput;
|
||||||
@@ -45,3 +47,66 @@ pub(crate) fn handle_last_message(
|
|||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Message shown when an MCP server cannot be reached: the session goes on without its tools.
|
||||||
|
/// Returns `None` for every other startup state.
|
||||||
|
pub(crate) fn mcp_startup_failure_message(
|
||||||
|
notification: &McpServerStatusUpdatedNotification,
|
||||||
|
) -> Option<String> {
|
||||||
|
if notification.status != McpServerStartupState::Failed {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
let detail = notification
|
||||||
|
.error
|
||||||
|
.as_deref()
|
||||||
|
.map(str::trim)
|
||||||
|
.filter(|error| !error.is_empty())
|
||||||
|
.map(|error| format!(" ({error})"))
|
||||||
|
.unwrap_or_default();
|
||||||
|
Some(format!(
|
||||||
|
"MCP server `{}` is not reachable{detail}; aKode continues without its tools.",
|
||||||
|
notification.name
|
||||||
|
))
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod mcp_startup_tests {
|
||||||
|
use super::*;
|
||||||
|
|
||||||
|
fn notification(
|
||||||
|
status: McpServerStartupState,
|
||||||
|
error: Option<&str>,
|
||||||
|
) -> McpServerStatusUpdatedNotification {
|
||||||
|
McpServerStatusUpdatedNotification {
|
||||||
|
thread_id: None,
|
||||||
|
name: "memoria".to_string(),
|
||||||
|
status,
|
||||||
|
error: error.map(str::to_string),
|
||||||
|
failure_reason: None,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn failed_server_gets_a_clear_message() {
|
||||||
|
let message = mcp_startup_failure_message(¬ification(
|
||||||
|
McpServerStartupState::Failed,
|
||||||
|
Some("connection refused"),
|
||||||
|
))
|
||||||
|
.expect("message");
|
||||||
|
assert_eq!(
|
||||||
|
message,
|
||||||
|
"MCP server `memoria` is not reachable (connection refused); aKode continues without its tools."
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn other_states_are_silent() {
|
||||||
|
for status in [
|
||||||
|
McpServerStartupState::Starting,
|
||||||
|
McpServerStartupState::Ready,
|
||||||
|
McpServerStartupState::Cancelled,
|
||||||
|
] {
|
||||||
|
assert_eq!(mcp_startup_failure_message(¬ification(status, None)), None);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -243,6 +243,12 @@ impl EventProcessor for EventProcessorWithHumanOutput {
|
|||||||
CodexStatus::Running
|
CodexStatus::Running
|
||||||
}
|
}
|
||||||
ServerNotification::Warning(notification) => self.process_warning(notification.message),
|
ServerNotification::Warning(notification) => self.process_warning(notification.message),
|
||||||
|
ServerNotification::McpServerStatusUpdated(notification) => {
|
||||||
|
match crate::event_processor::mcp_startup_failure_message(¬ification) {
|
||||||
|
Some(message) => self.process_warning(message),
|
||||||
|
None => CodexStatus::Running,
|
||||||
|
}
|
||||||
|
}
|
||||||
ServerNotification::AuthRecoveryStarted(notification) => {
|
ServerNotification::AuthRecoveryStarted(notification) => {
|
||||||
eprintln!("{}", notification.message);
|
eprintln!("{}", notification.message);
|
||||||
CodexStatus::Running
|
CodexStatus::Running
|
||||||
|
|||||||
@@ -447,6 +447,16 @@ impl EventProcessorWithJsonOutput {
|
|||||||
events.extend(warning.events);
|
events.extend(warning.events);
|
||||||
warning.status
|
warning.status
|
||||||
}
|
}
|
||||||
|
ServerNotification::McpServerStatusUpdated(notification) => {
|
||||||
|
match crate::event_processor::mcp_startup_failure_message(¬ification) {
|
||||||
|
Some(message) => {
|
||||||
|
let warning = self.collect_warning(message);
|
||||||
|
events.extend(warning.events);
|
||||||
|
warning.status
|
||||||
|
}
|
||||||
|
None => CodexStatus::Running,
|
||||||
|
}
|
||||||
|
}
|
||||||
ServerNotification::Error(notification) => {
|
ServerNotification::Error(notification) => {
|
||||||
let message = match notification.error.additional_details {
|
let message = match notification.error.additional_details {
|
||||||
Some(details) if !details.is_empty() => {
|
Some(details) if !details.is_empty() => {
|
||||||
|
|||||||
@@ -1593,6 +1593,11 @@ fn should_process_notification(
|
|||||||
.thread_id
|
.thread_id
|
||||||
.as_deref()
|
.as_deref()
|
||||||
.is_none_or(|candidate| candidate == thread_id),
|
.is_none_or(|candidate| candidate == thread_id),
|
||||||
|
// MCP startup updates belong to the thread that owns the connection (or to none).
|
||||||
|
ServerNotification::McpServerStatusUpdated(notification) => notification
|
||||||
|
.thread_id
|
||||||
|
.as_deref()
|
||||||
|
.is_none_or(|candidate| candidate == thread_id),
|
||||||
ServerNotification::AuthRecoveryStarted(notification)
|
ServerNotification::AuthRecoveryStarted(notification)
|
||||||
| ServerNotification::AuthRecoveryCompleted(notification) => {
|
| ServerNotification::AuthRecoveryCompleted(notification) => {
|
||||||
notification.thread_id == thread_id && notification.turn_id == turn_id
|
notification.thread_id == thread_id && notification.turn_id == turn_id
|
||||||
|
|||||||
@@ -257,6 +257,28 @@ fn runtime_warnings_are_filtered_to_the_primary_thread() {
|
|||||||
assert_eq!(outcomes, [true, true, false, false]);
|
assert_eq!(outcomes, [true, true, false, false]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn mcp_startup_updates_are_filtered_to_the_primary_thread() {
|
||||||
|
let primary_thread_id = "thread-1";
|
||||||
|
let outcomes = [None, Some(primary_thread_id), Some("thread-2")].map(|thread_id| {
|
||||||
|
should_process_notification(
|
||||||
|
&ServerNotification::McpServerStatusUpdated(
|
||||||
|
akode_app_server_protocol::McpServerStatusUpdatedNotification {
|
||||||
|
thread_id: thread_id.map(str::to_string),
|
||||||
|
name: "memoria".to_string(),
|
||||||
|
status: akode_app_server_protocol::McpServerStartupState::Failed,
|
||||||
|
error: Some("connection refused".to_string()),
|
||||||
|
failure_reason: None,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
primary_thread_id,
|
||||||
|
"turn-1",
|
||||||
|
)
|
||||||
|
});
|
||||||
|
|
||||||
|
assert_eq!(outcomes, [true, true, false]);
|
||||||
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn resume_lookup_model_providers_filters_only_last_lookup() {
|
async fn resume_lookup_model_providers_filters_only_last_lookup() {
|
||||||
let codex_home = tempdir().expect("create temp codex home");
|
let codex_home = tempdir().expect("create temp codex home");
|
||||||
|
|||||||
@@ -14,8 +14,6 @@ Use **/side** to start a side conversation in a temporary fork without polluting
|
|||||||
Use **/init** to create an `AGENTS.md` with project-specific guidance.
|
Use **/init** to create an `AGENTS.md` with project-specific guidance.
|
||||||
Use **/mcp** to list configured MCP tools.
|
Use **/mcp** to list configured MCP tools.
|
||||||
Use **/rename** to rename your threads for easier thread resuming.
|
Use **/rename** to rename your threads for easier thread resuming.
|
||||||
Use the OpenAI docs MCP for API questions; enable it with `akode mcp add openaiDeveloperDocs --url https://developers.openai.com/mcp`.
|
|
||||||
Visit the [Codex community forum](https://community.openai.com/c/codex/37).
|
|
||||||
You can run any shell command from Codex using `!` (e.g. `!ls`)
|
You can run any shell command from Codex using `!` (e.g. `!ls`)
|
||||||
Type `/` to open the command popup; `Tab` autocompletes slash commands.
|
Type `/` to open the command popup; `Tab` autocompletes slash commands.
|
||||||
When the composer is empty, press `Esc` to step back and edit your last message; `Enter` confirms.
|
When the composer is empty, press `Esc` to step back and edit your last message; `Enter` confirms.
|
||||||
|
|||||||
Reference in New Issue
Block a user