v0.1.0-pre.062

This commit is contained in:
2026-07-30 10:27:06 +02:00
parent f40fb78817
commit 460671e19d
319 changed files with 392513 additions and 9507 deletions

View File

@@ -1,5 +1,5 @@
// file: kb-app-demo-desktop/src/demo_decode_replay.rs
// version: 32
// version: 33
//! Tauri commands and UI payloads for contextual instruction decode replay.
@@ -600,7 +600,7 @@ pub(crate) fn coverage_payload(
pub(crate) fn annotation_payload(
row: kb_store::MaterializedEventQueryRow,
) -> std::result::Result<crate::DemoTransactionAnnotationRow, std::string::String> {
if row.processor_name != "transaction_annotations"
if row.processor_name != "materializer.transaction.annotations"
|| row.materialized_family != "transaction_annotation"
{
return std::result::Result::Err(
@@ -720,9 +720,9 @@ mod tests {
program_id: kb_lib::MdProgramId(
kb_program_ids::ASSOCIATED_TOKEN_PROGRAM_ID.to_string(),
),
protocol_code: kb_lib::MdProtocolCode("spl_associated_token_account".to_string()),
surface_code: kb_lib::MdSurfaceCode("spl_associated_token_account".to_string()),
event_code: kb_lib::MdEventCode(format!("spl_associated_token_account.{entry}")),
protocol_code: kb_lib::MdProtocolCode("spl.associated_token_account".to_string()),
surface_code: kb_lib::MdSurfaceCode("spl.associated_token_account".to_string()),
event_code: kb_lib::MdEventCode(format!("spl.associated_token_account.{entry}")),
event_name: kb_lib::MdEventName(entry.to_string()),
event_family: kb_lib::MdEventFamily::Lifecycle,
source_kind: kb_lib::MdEventSourceKind::Instruction,
@@ -750,13 +750,13 @@ mod tests {
.collect::<std::vec::Vec<_>>();
names.sort();
let mut expected_names = std::vec![
"metadata_metaplex_token_metadata".to_string(),
"solana_native_classifier".to_string(),
"spl_associated_token_account".to_string(),
"spl_elgamal_registry".to_string(),
"spl_memo".to_string(),
"spl_token".to_string(),
"spl_token_2022".to_string(),
"metadata.metaplex_token_metadata".to_string(),
"solana.core".to_string(),
"spl.associated_token_account".to_string(),
"spl.elgamal_registry".to_string(),
"spl.memo".to_string(),
"spl.token".to_string(),
"spl.token_2022".to_string(),
];
expected_names.sort();
assert_eq!(names, expected_names);
@@ -773,14 +773,14 @@ mod tests {
assert_eq!(
names,
std::vec![
"solana_native_admin".to_string(),
"solana_native_compliance_audit".to_string(),
"fees".to_string(),
"solana_native_lifecycle".to_string(),
"solana_native_staking".to_string(),
"spl_token_accounts".to_string(),
"spl_token_risk".to_string(),
"transaction_annotations".to_string(),
"materializer.admin".to_string(),
"materializer.compliance.audit".to_string(),
"materializer.fees".to_string(),
"materializer.lifecycle".to_string(),
"materializer.staking".to_string(),
"materializer.token.accounts".to_string(),
"materializer.risk".to_string(),
"materializer.transaction.annotations".to_string(),
]
);
}
@@ -788,10 +788,13 @@ mod tests {
#[test]
fn ata_materializer_ownership_is_exact_in_the_runtime_registry() {
for (entry, expected) in [
("create", std::vec!["spl_token_accounts".to_string()]),
("create", std::vec!["materializer.token.accounts".to_string()]),
(
"recover_nested",
std::vec!["spl_token_accounts".to_string(), "spl_token_risk".to_string(),],
std::vec![
"materializer.token.accounts".to_string(),
"materializer.risk".to_string(),
],
),
] {
let observation = ata_observation(entry);
@@ -821,7 +824,7 @@ mod tests {
program_id: std::option::Option::None,
instruction_state: "actionable".to_string(),
instruction_paths_text: std::option::Option::None,
decoder_names: std::vec!["solana_native_classifier".to_string()],
decoder_names: std::vec!["solana.core".to_string()],
limit: 10,
max_concurrent_inputs: 2,
all_compatible: false,
@@ -918,12 +921,12 @@ mod tests {
#[test]
fn committed_annotation_row_is_mapped_to_ui_safe_contract() {
let row = kb_store::MaterializedEventQueryRow {
processor_name: "transaction_annotations".to_string(),
processor_name: "materializer.transaction.annotations".to_string(),
processor_version: "0.4.3".to_string(),
input_key: "input".to_string(),
output_key: "output".to_string(),
source_event_key: "memo:0".to_string(),
source_decoder_name: "spl_memo".to_string(),
source_decoder_name: "spl.memo".to_string(),
source_decoder_version: "0.4.3".to_string(),
signature: "signature".to_string(),
slot: u64::MAX,
@@ -954,12 +957,12 @@ mod tests {
#[test]
fn malformed_annotation_payload_fails_closed() {
let row = kb_store::MaterializedEventQueryRow {
processor_name: "transaction_annotations".to_string(),
processor_name: "materializer.transaction.annotations".to_string(),
processor_version: "0.4.3".to_string(),
input_key: "input".to_string(),
output_key: "output".to_string(),
source_event_key: "memo:0".to_string(),
source_decoder_name: "spl_memo".to_string(),
source_decoder_name: "spl.memo".to_string(),
source_decoder_version: "0.4.3".to_string(),
signature: "signature".to_string(),
slot: 1,

View File

@@ -0,0 +1,50 @@
// file: kb-app-demo-desktop/src/demo_devnet_common.rs
// version: 2
//! Shared Devnet demo UI contracts.
use ts_rs::TS; // rust-rules: derive-import
/// Readiness report for one Devnet profile PostgreSQL store.
#[derive(Clone, Debug, serde::Serialize, TS)]
#[serde(rename_all = "camelCase")]
#[ts(
export,
export_to = "../frontend/ts/bindings/kb_app_demo_desktop/demo_execution_solana_core/DemoExecutionDevnetStoreReadinessPayload.ts"
)]
pub(crate) struct DemoExecutionDevnetStoreReadinessPayload {
/// Selected Devnet profile.
pub(crate) profile_name: std::string::String,
/// Whether schema creation was allowed by configuration.
pub(crate) auto_initialize_schema: bool,
/// Number of known tables already present before preparation.
pub(crate) existing_tables_before: u32,
/// Number of known tables created during preparation.
pub(crate) created_tables: u32,
/// Number of known tables present after preparation.
pub(crate) existing_tables_after: u32,
/// Total number of known tables expected by the current store.
pub(crate) expected_tables: u32,
}
/// Converts one collection length to the bounded UI counter type.
fn bounded_u32(value: usize) -> u32 {
return match u32::try_from(value) {
std::result::Result::Ok(converted) => converted,
std::result::Result::Err(_) => u32::MAX,
};
}
/// Converts the reusable scenario readiness report to the desktop TS-RS payload.
pub(crate) fn devnet_store_readiness_payload(
readiness: kb_pipeline_demo_scenarios::DevnetProfileStoreReadiness,
) -> DemoExecutionDevnetStoreReadinessPayload {
return DemoExecutionDevnetStoreReadinessPayload {
profile_name: readiness.profile_name,
auto_initialize_schema: readiness.auto_initialize_schema,
existing_tables_before: bounded_u32(readiness.existing_tables_before),
created_tables: bounded_u32(readiness.created_tables),
existing_tables_after: bounded_u32(readiness.existing_tables_after),
expected_tables: bounded_u32(readiness.expected_tables),
};
}

View File

@@ -1,5 +1,5 @@
// file: kb-app-demo-desktop/src/demo_execution_solana_core.rs
// version: 6
// version: 8
//! Tauri adapter for bounded Solana Core execution on Devnet.
@@ -395,18 +395,11 @@ pub(crate) fn select_devnet_profile(
config: &kb_config::AppConfig,
profile_name: &str,
) -> std::result::Result<kb_config::ProfileConfig, std::string::String> {
for profile in &config.profiles {
if profile.name == profile_name
&& profile.wallet.cluster == "devnet"
&& profile.wallet.temporary_wallet_enabled
&& profile.wallet.temporary_wallet_persist
{
return std::result::Result::Ok(profile.clone());
}
}
return std::result::Result::Err(format!(
"Devnet execution profile '{profile_name}' is unavailable"
));
return kb_pipeline_demo_scenarios::resolve_demo_devnet_profile(
config,
std::option::Option::Some(profile_name),
)
.map_err(|error| return error.to_string());
}
pub(crate) fn demo_execution_solana_core_summary_payload(

View File

@@ -1,5 +1,5 @@
// file: kb-app-demo-desktop/src/demo_spl_token.rs
// version: 3
// version: 4
//! Thin Tauri adapter for classic SPL Token execution and materialized journals.
@@ -109,7 +109,7 @@ pub(crate) struct DemoSplTokenJournalRequest {
pub(crate) account: std::option::Option<std::string::String>,
/// Optional exact materialized family.
pub(crate) family: std::option::Option<std::string::String>,
/// Optional exact operation code without the `spl_token.` prefix.
/// Optional exact operation code without the `spl.token.` prefix.
pub(crate) operation: std::option::Option<std::string::String>,
/// Maximum number of rows returned after typed filtering.
pub(crate) limit: u32,
@@ -463,12 +463,12 @@ mod tests {
std::option::Option::Some("18446744073709551615")
);
let row = crate::demo_spl_token_journal_row(kb_store::MaterializedEventQueryRow {
processor_name: "spl_token_accounts".to_string(),
processor_name: "materializer.token.accounts".to_string(),
processor_version: "0.4.4".to_string(),
input_key: "input".to_string(),
output_key: "output".to_string(),
source_event_key: "event".to_string(),
source_decoder_name: "spl_token".to_string(),
source_decoder_name: "spl.token".to_string(),
source_decoder_version: "0.4.4".to_string(),
signature: "signature".to_string(),
slot: u64::MAX,

View File

@@ -1,5 +1,5 @@
// file: kb-app-demo-desktop/src/demo_spl_token_2022.rs
// version: 6
// version: 7
//! Thin Tauri adapter for independent public Token-2022 Devnet validation scenarios.
@@ -33,8 +33,14 @@ pub(crate) struct DemoSplToken2022FixturePayload {
pub(crate) freeze_authority: std::string::String,
/// Mint decimals.
pub(crate) decimals: u8,
/// Default raw amount for the selected scenario.
pub(crate) default_amount_raw: std::string::String,
/// Raw amount used by `MintToChecked`.
pub(crate) mint_amount_raw: std::string::String,
/// Raw amount used by `TransferChecked`.
pub(crate) transfer_amount_raw: std::string::String,
/// Raw amount used by `ApproveChecked`.
pub(crate) approve_amount_raw: std::string::String,
/// Raw amount used by `BurnChecked`.
pub(crate) burn_amount_raw: std::string::String,
}
/// Request for one independent public Token-2022 Devnet scenario.

View File

@@ -1,5 +1,5 @@
// file: kb-app-demo-desktop/src/lib.rs
// version: 13
// version: 15
//! Tauri desktop demo application for `khadhroony-bot3`.
@@ -13,6 +13,7 @@ mod demo_backfill;
mod demo_config;
mod demo_core_extraction;
mod demo_decode_replay;
mod demo_devnet_common;
mod demo_execution_solana_core;
mod demo_execution_spl;
mod demo_http;
@@ -129,6 +130,10 @@ pub(crate) use self::demo_decode_replay::optional_line_count;
pub(crate) use self::demo_decode_replay::register_active_campaign;
/// Internal demo decode replay item.
pub(crate) use self::demo_decode_replay::text_sample;
/// Readiness report for one Devnet profile PostgreSQL store.
pub(crate) use self::demo_devnet_common::DemoExecutionDevnetStoreReadinessPayload;
/// Converts the reusable scenario readiness report to the desktop TS-RS payload.
pub(crate) use self::demo_devnet_common::devnet_store_readiness_payload;
/// Request sent by the Memo v4 Devnet execution panel.
pub(crate) use self::demo_execution_solana_core::DemoExecutionMemoRequest;
/// UI-safe result of one Memo v4 Devnet execution orchestration.

View File

@@ -1,5 +1,5 @@
// file: kb-app-demo-desktop/src/tauri.rs
// version: 17
// version: 21
//! Tauri runtime assembly and private command wrappers.
@@ -67,6 +67,7 @@ pub fn run() -> kb_core::Result<()> {
load_demo_sql_replay_entities,
export_demo_sql_replay_csv,
demo_execution_solana_core_options,
demo_execution_devnet_prepare_profile,
demo_execution_solana_core_generate_recipient,
demo_execution_solana_core_execute,
open_demo_execution_solana_core_window,
@@ -498,7 +499,7 @@ async fn demo_decode_replay_annotations(
request: crate::DemoTransactionAnnotationRequest,
) -> std::result::Result<std::vec::Vec<crate::DemoTransactionAnnotationRow>, std::string::String> {
let filter_result = kb_store::MaterializedEventFilter::new(
std::option::Option::Some("transaction_annotations".to_string()),
std::option::Option::Some("materializer.transaction.annotations".to_string()),
std::option::Option::Some("transaction_annotation".to_string()),
request.signature_contains,
request.limit,
@@ -1106,6 +1107,26 @@ fn open_demo_execution_solana_core_window(
);
}
/// Verifies or initializes the PostgreSQL schema selected by one Devnet profile.
#[tauri::command]
async fn demo_execution_devnet_prepare_profile(
state: tauri::State<'_, crate::AppState>,
profile_name: std::string::String,
) -> std::result::Result<crate::DemoExecutionDevnetStoreReadinessPayload, std::string::String> {
let profile = match crate::select_devnet_profile(state.app_config(), profile_name.as_str()) {
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => return std::result::Result::Err(error),
};
let readiness =
match kb_pipeline_demo_scenarios::prepare_demo_devnet_profile_store(&profile).await {
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => {
return std::result::Result::Err(error.to_string());
},
};
return std::result::Result::Ok(crate::devnet_store_readiness_payload(readiness));
}
/// Returns compatible Devnet profiles and conservative defaults.
#[tauri::command]
fn demo_execution_solana_core_options(
@@ -1506,7 +1527,7 @@ async fn demo_spl_token_journal(
};
let mut output = std::vec::Vec::new();
for row in rows {
if row.source_decoder_name != "spl_token"
if row.source_decoder_name != "spl.token"
|| !crate::payload_matches(&row.payload_json, &validated)
{
continue;
@@ -1683,7 +1704,7 @@ async fn demo_spl_ata_journal(
std::result::Result::Err(error) => return std::result::Result::Err(error.to_string()),
};
let filter = match kb_store::MaterializedEventFilter::new(
std::option::Option::Some("spl_token_accounts".to_string()),
std::option::Option::Some("materializer.token.accounts".to_string()),
std::option::Option::None,
request.signature_contains.clone(),
500,
@@ -1698,7 +1719,7 @@ async fn demo_spl_ata_journal(
};
let mut output = std::vec::Vec::new();
for row in rows {
if row.source_decoder_name != "spl_associated_token_account"
if row.source_decoder_name != "spl.associated_token_account"
|| !crate::journal_matches(&row.payload_json, &request)
{
continue;
@@ -1886,9 +1907,21 @@ fn demo_spl_token_2022_fixture(
authority,
freeze_authority,
decimals,
default_amount_raw: values
.get("TOKEN_2022_TRANSFER_AMOUNT_RAW")
.cloned()
.unwrap_or_else(|| return "1".to_string()),
mint_amount_raw: match required("TOKEN_2022_MINT_AMOUNT_RAW") {
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => return std::result::Result::Err(error),
},
transfer_amount_raw: match required("TOKEN_2022_TRANSFER_AMOUNT_RAW") {
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => return std::result::Result::Err(error),
},
approve_amount_raw: match required("TOKEN_2022_APPROVE_AMOUNT_RAW") {
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => return std::result::Result::Err(error),
},
burn_amount_raw: match required("TOKEN_2022_BURN_AMOUNT_RAW") {
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => return std::result::Result::Err(error),
},
});
}