aKode fase 5: rinomina interna (crate akode-*, akode-rs/, akode-cli/, binario akode, AKODE_*, ~/.akode, snapshot)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
andrea.difonzo
2026-11-11 11:06:46 +01:00
parent df99318392
commit 86e7c72e5f
10383 changed files with 749164 additions and 749170 deletions

View File

@@ -0,0 +1,2 @@
pub(crate) mod session_telemetry;
pub(crate) mod shared;

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,70 @@
use chrono::SecondsFormat;
use chrono::Utc;
use akode_protocol::DEFAULT_FUNCTION_NAMESPACE;
use akode_protocol::ToolName;
pub(crate) fn tool_namespace(tool_name: &ToolName) -> &str {
tool_name
.namespace
.as_deref()
.filter(|namespace| !namespace.is_empty())
.unwrap_or(DEFAULT_FUNCTION_NAMESPACE)
}
macro_rules! log_event {
($self:expr, $($fields:tt)*) => {{
tracing::event!(
target: $crate::targets::OTEL_LOG_ONLY_TARGET,
tracing::Level::INFO,
$($fields)*
event.timestamp = %$crate::events::shared::timestamp(),
conversation.id = %$self.metadata.conversation_id,
app.version = %$self.metadata.app_version,
auth_mode = $self.metadata.auth_mode,
originator = %$self.metadata.originator,
user.account_id = $self.metadata.account_id,
user.email = $self.metadata.account_email,
terminal.type = %$self.metadata.terminal_type,
model = %$self.metadata.model,
slug = %$self.metadata.slug,
);
}};
}
macro_rules! trace_event {
($self:expr, $($fields:tt)*) => {{
tracing::event!(
target: $crate::targets::OTEL_TRACE_SAFE_TARGET,
tracing::Level::INFO,
$($fields)*
event.timestamp = %$crate::events::shared::timestamp(),
conversation.id = %$self.metadata.conversation_id,
app.version = %$self.metadata.app_version,
auth_mode = $self.metadata.auth_mode,
originator = %$self.metadata.originator,
terminal.type = %$self.metadata.terminal_type,
model = %$self.metadata.model,
slug = %$self.metadata.slug,
);
}};
}
macro_rules! log_and_trace_event {
(
$self:expr,
common: { $($common:tt)* },
log: { $($log:tt)* },
trace: { $($trace:tt)* },
) => {{
log_event!($self, $($common)* $($log)*);
trace_event!($self, $($common)* $($trace)*);
}};
}
pub(crate) use log_and_trace_event;
pub(crate) use log_event;
pub(crate) use trace_event;
pub(crate) fn timestamp() -> String {
Utc::now().to_rfc3339_opts(SecondsFormat::Millis, true)
}