Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- SPFsmartGATE/src/calculate.rs +416 -0
- SPFsmartGATE/src/encoder.rs +404 -0
- SPFsmartGATE/src/tmp_db.rs +609 -0
- SPFsmartGATE/src/train.rs +1064 -0
- SPFsmartGATE/target/debug/.cargo-lock +0 -0
- SPFsmartGATE/target/debug/brain_index_training.d +1 -0
- SPFsmartGATE/target/debug/prune_memories.d +1 -0
- SPFsmartGATE/target/release/.cargo-lock +0 -0
- SPFsmartGATE/target/release/brain_index_training.d +1 -0
- SPFsmartGATE/target/release/deps/bincode-be0e4e9c6ceab529.d +19 -0
- SPFsmartGATE/target/release/deps/block_buffer-1fd43fb02fa21913.d +9 -0
- SPFsmartGATE/target/release/deps/cpufeatures-22990a68d05b45a9.d +8 -0
- SPFsmartGATE/target/release/deps/enum_as_inner-fa0abcd5346ffccf.d +5 -0
- SPFsmartGATE/target/release/deps/env_logger-e4ade51c72baa8c3.d +13 -0
- SPFsmartGATE/target/release/deps/flume-24880077eb46faa3.d +9 -0
- SPFsmartGATE/target/release/deps/gemm_c32-ece014989bc9da11.d +9 -0
- SPFsmartGATE/target/release/deps/gemm_f16-1ff1780bc566065b.d +9 -0
- SPFsmartGATE/target/release/deps/getrandom-5038c8a18bb88a61.d +14 -0
- SPFsmartGATE/target/release/deps/heed-599d6355aad4c0d8.d +22 -0
- SPFsmartGATE/target/release/deps/identity_hash-4f4cd40e6fd26760.d +7 -0
- SPFsmartGATE/target/release/deps/iroh_relay-7c98236e1ab9e153.d +25 -0
- SPFsmartGATE/target/release/deps/libasync_compat-459c09c782c9c3e0.rmeta +0 -0
- SPFsmartGATE/target/release/deps/libbitflags-de2edf8204ece2d0.rmeta +0 -0
- SPFsmartGATE/target/release/deps/libblock_buffer-fef4c4e8c0125655.rlib +0 -0
- SPFsmartGATE/target/release/deps/libc-9ca04ee76f999f31.d +27 -0
- SPFsmartGATE/target/release/deps/libcfg_aliases-3b2a20d804f039d0.rlib +0 -0
- SPFsmartGATE/target/release/deps/libcfg_if-a1ecffbcf4d152cf.rmeta +0 -0
- SPFsmartGATE/target/release/deps/libderive_builder-ecf70bb540c59829.rmeta +0 -0
- SPFsmartGATE/target/release/deps/libdunce-c1a93e1a1085d531.rmeta +0 -0
- SPFsmartGATE/target/release/deps/libdyn_clone-3343f469a28d1f9e.rmeta +0 -0
- SPFsmartGATE/target/release/deps/libenv_filter-c8aaa0d4517da6c7.rmeta +0 -0
- SPFsmartGATE/target/release/deps/libfoldhash-ca3284e54d485ca1.rmeta +0 -0
- SPFsmartGATE/target/release/deps/libheed_types-4e22c4aab5682284.rmeta +0 -0
- SPFsmartGATE/target/release/deps/libident_case-0c69e375e8bec18e.rlib +0 -0
- SPFsmartGATE/target/release/deps/liblru_slab-196cb84e947f054f.rmeta +0 -0
- SPFsmartGATE/target/release/deps/liblru_slab-461f698985939b32.rlib +0 -0
- SPFsmartGATE/target/release/deps/libntimestamp-18b49112b7ca2ba0.rlib +0 -0
- SPFsmartGATE/target/release/deps/libpage_size-b785e96605adb245.rlib +0 -0
- SPFsmartGATE/target/release/deps/libphf_generator-df7def3e7014cfd1.rlib +0 -0
- SPFsmartGATE/target/release/deps/libsame_file-2fd8175d7c58a54d.rmeta +0 -0
- SPFsmartGATE/target/release/deps/libself_cell-2469a2c858171ad7.rlib +0 -0
- SPFsmartGATE/target/release/deps/libsignature-7b16811c88300a57.rmeta +0 -0
- SPFsmartGATE/target/release/deps/libthiserror-8e6dac04e13891a0.rmeta +0 -0
- SPFsmartGATE/target/release/deps/libuntrusted-ffbc123450b35f34.rmeta +0 -0
- SPFsmartGATE/target/release/deps/libzerofrom-9d24aee5c798916e.rlib +0 -0
- SPFsmartGATE/target/release/deps/mac_addr-41d99f64f723d378.d +10 -0
- SPFsmartGATE/target/release/deps/n0_watcher-ac8808f14fd4c6e0.d +7 -0
- SPFsmartGATE/target/release/deps/netlink_packet_core-77fef4f42dda30c0.d +18 -0
- SPFsmartGATE/target/release/deps/num_complex-1728c1a399d50012.d +10 -0
- SPFsmartGATE/target/release/deps/num_conv-07a02c09d5e60300.d +7 -0
SPFsmartGATE/src/calculate.rs
ADDED
|
@@ -0,0 +1,416 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// SPF Smart Gateway - Complexity Calculator
|
| 2 |
+
// Copyright 2026 Joseph Stone - All Rights Reserved
|
| 3 |
+
//
|
| 4 |
+
// Implements: C = (basic ^ 1) + (dependencies ^ 7) + (complex ^ 10) + (files × 10)
|
| 5 |
+
// Master formula: a_optimal(C) = W_eff × (1 - 1/ln(C + e))
|
| 6 |
+
|
| 7 |
+
use crate::config::SpfConfig;
|
| 8 |
+
use serde::{Deserialize, Serialize};
|
| 9 |
+
|
| 10 |
+
/// Result of complexity calculation
|
| 11 |
+
#[derive(Debug, Clone, Serialize, Deserialize)]
|
| 12 |
+
pub struct ComplexityResult {
|
| 13 |
+
pub tool: String,
|
| 14 |
+
pub c: u64,
|
| 15 |
+
pub tier: String,
|
| 16 |
+
pub analyze_percent: u8,
|
| 17 |
+
pub build_percent: u8,
|
| 18 |
+
pub a_optimal_tokens: u64,
|
| 19 |
+
pub requires_approval: bool,
|
| 20 |
+
}
|
| 21 |
+
|
| 22 |
+
/// Input parameters for complexity calculation
|
| 23 |
+
/// EXTENDED: Supports ALL tool types — brain, rag, glob, grep, web
|
| 24 |
+
#[derive(Debug, Clone, Deserialize, Default)]
|
| 25 |
+
pub struct ToolParams {
|
| 26 |
+
// Common
|
| 27 |
+
pub file_path: Option<String>,
|
| 28 |
+
// Edit
|
| 29 |
+
pub old_string: Option<String>,
|
| 30 |
+
pub new_string: Option<String>,
|
| 31 |
+
pub replace_all: Option<bool>,
|
| 32 |
+
// Write
|
| 33 |
+
pub content: Option<String>,
|
| 34 |
+
// Bash
|
| 35 |
+
pub command: Option<String>,
|
| 36 |
+
// Search (glob/grep)
|
| 37 |
+
pub query: Option<String>,
|
| 38 |
+
pub pattern: Option<String>,
|
| 39 |
+
pub path: Option<String>,
|
| 40 |
+
// Brain operations
|
| 41 |
+
pub collection: Option<String>,
|
| 42 |
+
pub limit: Option<u64>,
|
| 43 |
+
pub text: Option<String>,
|
| 44 |
+
pub title: Option<String>,
|
| 45 |
+
// RAG/Web operations
|
| 46 |
+
pub url: Option<String>,
|
| 47 |
+
pub topic: Option<String>,
|
| 48 |
+
pub category: Option<String>,
|
| 49 |
+
// Controlled tools (VL block — gate validation fields)
|
| 50 |
+
pub tool_name: Option<String>, // spf_flint_execute: delegated tool name
|
| 51 |
+
pub reason: Option<String>, // spf_flint_execute: justification string
|
| 52 |
+
pub peer_key: Option<String>, // spf_mesh_call: target peer hex key
|
| 53 |
+
pub message: Option<String>, // spf_transformer_chat: chat input
|
| 54 |
+
pub prompt: Option<String>, // spf_transformer_infer: inference prompt
|
| 55 |
+
pub batch_size: Option<u64>, // spf_transformer_train: training batch size
|
| 56 |
+
}
|
| 57 |
+
|
| 58 |
+
// ============================================================================
|
| 59 |
+
// DYNAMIC COMPLEXITY HELPERS
|
| 60 |
+
// complex^10: 1→1, 2→1024, 3→59049, 4→1048576
|
| 61 |
+
// files×10: scales linearly with affected file count
|
| 62 |
+
// ============================================================================
|
| 63 |
+
|
| 64 |
+
/// Calculate dynamic complexity factor (0-4 scale)
|
| 65 |
+
/// This is the primary lever for tier escalation via ^10 exponent
|
| 66 |
+
fn calc_complex_factor(content_len: u64, has_risk: bool, is_architectural: bool) -> u64 {
|
| 67 |
+
let mut complex: u64 = 0;
|
| 68 |
+
|
| 69 |
+
// Size-based complexity
|
| 70 |
+
if content_len > 200 { complex += 1; } // Moderate size
|
| 71 |
+
if content_len > 1000 { complex += 1; } // Large change
|
| 72 |
+
if content_len > 5000 { complex += 1; } // Very large change
|
| 73 |
+
|
| 74 |
+
// Risk indicators add complexity
|
| 75 |
+
if has_risk { complex += 1; }
|
| 76 |
+
|
| 77 |
+
// Architectural changes are highest complexity
|
| 78 |
+
if is_architectural { complex = complex.max(3); }
|
| 79 |
+
|
| 80 |
+
complex.min(4) // Cap at 4 (4^10 = 1,048,576)
|
| 81 |
+
}
|
| 82 |
+
|
| 83 |
+
/// Calculate dynamic files factor based on scope
|
| 84 |
+
fn calc_files_factor(path: &str, pattern: &str, cmd: &str) -> u64 {
|
| 85 |
+
// Codebase-wide operations
|
| 86 |
+
if cmd.contains("find") || cmd.contains("xargs") || cmd.contains("-r ") {
|
| 87 |
+
return 100; // 100×10 = 1000
|
| 88 |
+
}
|
| 89 |
+
|
| 90 |
+
// Recursive glob
|
| 91 |
+
if pattern.contains("**") || path.contains("**") || cmd.contains("**") {
|
| 92 |
+
return 50; // 50×10 = 500
|
| 93 |
+
}
|
| 94 |
+
|
| 95 |
+
// Simple glob
|
| 96 |
+
if pattern.contains("*") || path.contains("*") || cmd.contains("*") {
|
| 97 |
+
return 20; // 20×10 = 200
|
| 98 |
+
}
|
| 99 |
+
|
| 100 |
+
// Root directory = potentially many files
|
| 101 |
+
if path == "." || path == "/" || path.ends_with("src") || path.ends_with("lib") {
|
| 102 |
+
return 20;
|
| 103 |
+
}
|
| 104 |
+
|
| 105 |
+
// Default single file
|
| 106 |
+
1
|
| 107 |
+
}
|
| 108 |
+
|
| 109 |
+
/// Check if file is architectural (config, main, lib, mod)
|
| 110 |
+
fn is_architectural_file(path: &str) -> bool {
|
| 111 |
+
let p = path.to_lowercase();
|
| 112 |
+
p.contains("config") || p.contains("main.") || p.contains("lib.")
|
| 113 |
+
|| p.contains("mod.") || p.contains("cargo.toml") || p.contains("package.json")
|
| 114 |
+
|| p.contains(".env") || p.contains("settings") || p.contains("schema")
|
| 115 |
+
|| p.ends_with("rc") || p.ends_with(".yaml") || p.ends_with(".yml")
|
| 116 |
+
}
|
| 117 |
+
|
| 118 |
+
/// Check if content has risk indicators
|
| 119 |
+
fn has_risk_indicators(content: &str) -> bool {
|
| 120 |
+
content.contains("delete") || content.contains("drop") || content.contains("remove")
|
| 121 |
+
|| content.contains("truncate") || content.contains("override")
|
| 122 |
+
|| content.contains("force") || content.contains("unsafe")
|
| 123 |
+
|| content.contains("rm ") || content.contains("sudo")
|
| 124 |
+
}
|
| 125 |
+
|
| 126 |
+
/// Calculate complexity value C for a tool call
|
| 127 |
+
pub fn calculate_c(tool: &str, params: &ToolParams, config: &SpfConfig) -> u64 {
|
| 128 |
+
let (basic, dependencies, complex_factor, files) = match tool {
|
| 129 |
+
"Edit" | "spf_edit" => {
|
| 130 |
+
let old_str = params.old_string.as_deref().unwrap_or("");
|
| 131 |
+
let new_str = params.new_string.as_deref().unwrap_or("");
|
| 132 |
+
let old_len = old_str.len() as u64;
|
| 133 |
+
let new_len = new_str.len() as u64;
|
| 134 |
+
let total_len = old_len + new_len;
|
| 135 |
+
let file_path = params.file_path.as_deref().unwrap_or("");
|
| 136 |
+
|
| 137 |
+
let basic = config.complexity_weights.edit.basic + total_len / 20;
|
| 138 |
+
|
| 139 |
+
// Dependencies: replace_all affects more, large diffs have cascading effects
|
| 140 |
+
let mut deps = if params.replace_all.unwrap_or(false) { 3u64 } else { 1 };
|
| 141 |
+
if total_len > 500 { deps += 1; }
|
| 142 |
+
|
| 143 |
+
// Complex factor: dynamic based on size, risk, architecture
|
| 144 |
+
let has_risk = has_risk_indicators(new_str);
|
| 145 |
+
let is_arch = is_architectural_file(file_path);
|
| 146 |
+
let complex = calc_complex_factor(total_len, has_risk, is_arch);
|
| 147 |
+
|
| 148 |
+
// Files: edits affect 1 file but replace_all could have wide impact
|
| 149 |
+
let files = if params.replace_all.unwrap_or(false) { 5u64 } else { 1 };
|
| 150 |
+
|
| 151 |
+
(basic, deps, complex, files)
|
| 152 |
+
}
|
| 153 |
+
|
| 154 |
+
"Write" | "spf_write" => {
|
| 155 |
+
let content = params.content.as_deref().unwrap_or("");
|
| 156 |
+
let content_len = content.len() as u64;
|
| 157 |
+
let file_path = params.file_path.as_deref().unwrap_or("");
|
| 158 |
+
|
| 159 |
+
let basic = config.complexity_weights.write.basic + content_len / 50;
|
| 160 |
+
|
| 161 |
+
// Dependencies: imports/requires in content indicate deps
|
| 162 |
+
let mut deps = config.complexity_weights.write.dependencies;
|
| 163 |
+
if content.contains("import ") || content.contains("require(")
|
| 164 |
+
|| content.contains("use ") || content.contains("mod ") {
|
| 165 |
+
deps += 2;
|
| 166 |
+
}
|
| 167 |
+
|
| 168 |
+
// Complex factor: dynamic
|
| 169 |
+
let has_risk = has_risk_indicators(content);
|
| 170 |
+
let is_arch = is_architectural_file(file_path);
|
| 171 |
+
let complex = calc_complex_factor(content_len, has_risk, is_arch);
|
| 172 |
+
|
| 173 |
+
(basic, deps, complex, 1u64)
|
| 174 |
+
}
|
| 175 |
+
|
| 176 |
+
"Bash" | "spf_bash" => {
|
| 177 |
+
let cmd = params.command.as_deref().unwrap_or("");
|
| 178 |
+
|
| 179 |
+
// Check dangerous commands
|
| 180 |
+
let is_dangerous = config.dangerous_commands.iter().any(|d| cmd.contains(d.as_str()));
|
| 181 |
+
// Check git operations
|
| 182 |
+
let is_git = cmd.contains("git push") || cmd.contains("git reset")
|
| 183 |
+
|| cmd.contains("git rebase") || cmd.contains("git merge");
|
| 184 |
+
// Check piped/chained
|
| 185 |
+
let is_piped = cmd.contains("&&") || cmd.contains("|");
|
| 186 |
+
|
| 187 |
+
// Dynamic files calculation
|
| 188 |
+
let files = calc_files_factor("", "", cmd);
|
| 189 |
+
|
| 190 |
+
// Count pipe stages as dependencies
|
| 191 |
+
let pipe_count = cmd.matches("|").count() as u64;
|
| 192 |
+
let chain_count = cmd.matches("&&").count() as u64;
|
| 193 |
+
|
| 194 |
+
if is_dangerous {
|
| 195 |
+
let w = &config.complexity_weights.bash_dangerous;
|
| 196 |
+
// Dangerous = high complex factor
|
| 197 |
+
(w.basic, w.dependencies + pipe_count + chain_count, 3u64.max(w.complex), files)
|
| 198 |
+
} else if is_git {
|
| 199 |
+
let w = &config.complexity_weights.bash_git;
|
| 200 |
+
// Git operations: complex=2 minimum (1024 added to C)
|
| 201 |
+
(w.basic, w.dependencies + pipe_count, 2u64.max(w.complex), files)
|
| 202 |
+
} else if is_piped {
|
| 203 |
+
let w = &config.complexity_weights.bash_piped;
|
| 204 |
+
// Piped: complexity scales with pipe count
|
| 205 |
+
let complex = (1 + pipe_count).min(3);
|
| 206 |
+
(w.basic, w.dependencies + pipe_count + chain_count, complex, files)
|
| 207 |
+
} else {
|
| 208 |
+
let w = &config.complexity_weights.bash_simple;
|
| 209 |
+
(w.basic, w.dependencies, w.complex, files)
|
| 210 |
+
}
|
| 211 |
+
}
|
| 212 |
+
|
| 213 |
+
"Read" | "spf_read" => {
|
| 214 |
+
// Reads are safe - encourage information gathering
|
| 215 |
+
let w = &config.complexity_weights.read;
|
| 216 |
+
(w.basic, w.dependencies, w.complex, w.files)
|
| 217 |
+
}
|
| 218 |
+
|
| 219 |
+
"Glob" | "spf_glob" | "Grep" | "spf_grep" => {
|
| 220 |
+
let w = &config.complexity_weights.search;
|
| 221 |
+
let path = params.path.as_deref().unwrap_or(".");
|
| 222 |
+
let pattern = params.pattern.as_deref().unwrap_or("");
|
| 223 |
+
|
| 224 |
+
// Dynamic files based on pattern scope
|
| 225 |
+
let files = calc_files_factor(path, pattern, "");
|
| 226 |
+
|
| 227 |
+
// Search complexity based on pattern
|
| 228 |
+
let complex = if pattern.len() > 50 { 1u64 } else { w.complex };
|
| 229 |
+
|
| 230 |
+
(w.basic, w.dependencies, complex, files)
|
| 231 |
+
}
|
| 232 |
+
|
| 233 |
+
// === BRAIN OPERATIONS — MUST BE GATED ===
|
| 234 |
+
"brain_search" | "spf_brain_search" => {
|
| 235 |
+
let limit = params.limit.unwrap_or(5);
|
| 236 |
+
(10, limit, 0, 1)
|
| 237 |
+
}
|
| 238 |
+
"brain_store" | "spf_brain_store" => {
|
| 239 |
+
let text_len = params.text.as_ref().map(|s| s.len()).unwrap_or(0) as u64;
|
| 240 |
+
(20 + text_len / 50, 2, if text_len > 5000 { 1 } else { 0 }, 1)
|
| 241 |
+
}
|
| 242 |
+
"brain_index" | "spf_brain_index" => (50, 5, 1, 10),
|
| 243 |
+
"brain_recall" | "spf_brain_recall" |
|
| 244 |
+
"brain_context" | "spf_brain_context" |
|
| 245 |
+
"brain_list" | "spf_brain_list" |
|
| 246 |
+
"brain_status" | "spf_brain_status" |
|
| 247 |
+
"brain_list_docs" | "spf_brain_list_docs" |
|
| 248 |
+
"brain_get_doc" | "spf_brain_get_doc" => (10, 1, 0, 1),
|
| 249 |
+
|
| 250 |
+
// === RAG OPERATIONS — MUST BE GATED ===
|
| 251 |
+
"rag_collect_web" | "spf_rag_collect_web" => (50, 10, 1, 5),
|
| 252 |
+
"rag_fetch_url" | "spf_rag_fetch_url" => (30, 5, 1, 1),
|
| 253 |
+
"rag_collect_file" | "spf_rag_collect_file" => (15, 2, 0, 1),
|
| 254 |
+
"rag_collect_folder" | "spf_rag_collect_folder" => (30, 5, 0, 10),
|
| 255 |
+
"rag_index_gathered" | "spf_rag_index_gathered" => (40, 5, 1, 10),
|
| 256 |
+
"rag_collect_drop" | "spf_rag_collect_drop" => (25, 3, 0, 5),
|
| 257 |
+
"rag_collect_rss" | "spf_rag_collect_rss" => (25, 5, 0, 5),
|
| 258 |
+
"rag_dedupe" | "spf_rag_dedupe" => (20, 3, 0, 1),
|
| 259 |
+
"rag_smart_search" | "spf_rag_smart_search" |
|
| 260 |
+
"rag_auto_fetch_gaps" | "spf_rag_auto_fetch_gaps" => (40, 8, 1, 5),
|
| 261 |
+
"rag_fulfill_search" | "spf_rag_fulfill_search" => (20, 3, 0, 1),
|
| 262 |
+
"rag_status" | "spf_rag_status" |
|
| 263 |
+
"rag_list_gathered" | "spf_rag_list_gathered" |
|
| 264 |
+
"rag_bandwidth_status" | "spf_rag_bandwidth_status" |
|
| 265 |
+
"rag_list_feeds" | "spf_rag_list_feeds" |
|
| 266 |
+
"rag_pending_searches" | "spf_rag_pending_searches" => (8, 1, 0, 1),
|
| 267 |
+
|
| 268 |
+
// === WEB OPERATIONS ===
|
| 269 |
+
"web_fetch" | "spf_web_fetch" => (30, 5, 1, 1),
|
| 270 |
+
"web_search" | "spf_web_search" => (25, 3, 0, 1),
|
| 271 |
+
"web_download" | "spf_web_download" => (30, 5, 1, 1),
|
| 272 |
+
"web_api" | "spf_web_api" => (25, 3, 0, 1),
|
| 273 |
+
// WB-2: Reverse proxy browser tools
|
| 274 |
+
"web_connect" | "spf_web_connect" => (20, 2, 0, 1),
|
| 275 |
+
"web_navigate" | "spf_web_navigate" => (30, 5, 1, 1),
|
| 276 |
+
"web_click" | "spf_web_click" => (15, 2, 0, 1),
|
| 277 |
+
"web_fill" | "spf_web_fill" => (15, 2, 0, 1),
|
| 278 |
+
"web_select" | "spf_web_select" => (10, 1, 0, 1),
|
| 279 |
+
"web_eval" | "spf_web_eval" => (40, 8, 2, 1), // JS eval — higher risk
|
| 280 |
+
"web_screenshot" | "spf_web_screenshot" => (10, 1, 0, 1),
|
| 281 |
+
"web_design" | "spf_web_design" => (20, 3, 0, 1),
|
| 282 |
+
"web_page" | "spf_web_page" => (10, 1, 0, 1),
|
| 283 |
+
|
| 284 |
+
// CDP BROWSER weights removed — WB-2a (will be re-added in WB-2e for reverse proxy)
|
| 285 |
+
|
| 286 |
+
// === NOTEBOOK ===
|
| 287 |
+
"notebook_edit" | "spf_notebook_edit" => (15, 2, 0, 1),
|
| 288 |
+
|
| 289 |
+
// === STATUS (low complexity) ===
|
| 290 |
+
"status" | "spf_status" | "session" | "spf_session" |
|
| 291 |
+
"calculate" | "spf_calculate" => (5, 0, 0, 1),
|
| 292 |
+
|
| 293 |
+
// === UNKNOWN — default high for safety ===
|
| 294 |
+
_ => {
|
| 295 |
+
let w = &config.complexity_weights.unknown;
|
| 296 |
+
(w.basic, w.dependencies, w.complex, w.files)
|
| 297 |
+
}
|
| 298 |
+
};
|
| 299 |
+
|
| 300 |
+
// Apply formula: C = (basic ^ power) + (deps ^ power) + (complex ^ power) + (files × mult)
|
| 301 |
+
// HARDCODE: Saturating math prevents overflow — system never breaks
|
| 302 |
+
let c = basic.saturating_pow(config.formula.basic_power)
|
| 303 |
+
.saturating_add(dependencies.saturating_pow(config.formula.deps_power))
|
| 304 |
+
.saturating_add(complex_factor.saturating_pow(config.formula.complex_power))
|
| 305 |
+
.saturating_add(files.saturating_mul(config.formula.files_multiplier));
|
| 306 |
+
|
| 307 |
+
c
|
| 308 |
+
}
|
| 309 |
+
|
| 310 |
+
/// Apply master formula: a_optimal(C) = W_eff × (1 - 1/ln(C + e))
|
| 311 |
+
pub fn a_optimal(c: u64, config: &SpfConfig) -> u64 {
|
| 312 |
+
let c_f = if c == 0 { 1.0 } else { c as f64 };
|
| 313 |
+
let result = config.formula.w_eff * (1.0 - 1.0 / (c_f + config.formula.e).ln());
|
| 314 |
+
result.max(0.0) as u64
|
| 315 |
+
}
|
| 316 |
+
|
| 317 |
+
/// Full complexity calculation — returns everything needed for enforcement
|
| 318 |
+
pub fn calculate(tool: &str, params: &ToolParams, config: &SpfConfig) -> ComplexityResult {
|
| 319 |
+
let c = calculate_c(tool, params, config);
|
| 320 |
+
let (tier, analyze, build, requires_approval) = config.get_tier(c);
|
| 321 |
+
let tokens = a_optimal(c, config);
|
| 322 |
+
|
| 323 |
+
ComplexityResult {
|
| 324 |
+
tool: tool.to_string(),
|
| 325 |
+
c,
|
| 326 |
+
tier: tier.to_string(),
|
| 327 |
+
analyze_percent: analyze,
|
| 328 |
+
build_percent: build,
|
| 329 |
+
a_optimal_tokens: tokens,
|
| 330 |
+
requires_approval,
|
| 331 |
+
}
|
| 332 |
+
}
|
| 333 |
+
|
| 334 |
+
// ============================================================================
|
| 335 |
+
// TESTS
|
| 336 |
+
// ============================================================================
|
| 337 |
+
|
| 338 |
+
#[cfg(test)]
|
| 339 |
+
mod tests {
|
| 340 |
+
use super::*;
|
| 341 |
+
use crate::config::SpfConfig;
|
| 342 |
+
|
| 343 |
+
fn default_config() -> SpfConfig {
|
| 344 |
+
SpfConfig::default()
|
| 345 |
+
}
|
| 346 |
+
|
| 347 |
+
#[test]
|
| 348 |
+
fn read_produces_simple_tier() {
|
| 349 |
+
let config = default_config();
|
| 350 |
+
let params = ToolParams::default();
|
| 351 |
+
let result = calculate("spf_read", ¶ms, &config);
|
| 352 |
+
assert_eq!(result.tier, "SIMPLE");
|
| 353 |
+
assert!(result.c < 500, "Read C={} should be < 500", result.c);
|
| 354 |
+
}
|
| 355 |
+
|
| 356 |
+
#[test]
|
| 357 |
+
fn simple_bash_is_simple_tier() {
|
| 358 |
+
let config = default_config();
|
| 359 |
+
let params = ToolParams { command: Some("ls -la".to_string()), ..Default::default() };
|
| 360 |
+
let result = calculate("spf_bash", ¶ms, &config);
|
| 361 |
+
assert_eq!(result.tier, "SIMPLE", "Simple bash C={} tier={}", result.c, result.tier);
|
| 362 |
+
}
|
| 363 |
+
|
| 364 |
+
#[test]
|
| 365 |
+
fn dangerous_bash_is_critical_tier() {
|
| 366 |
+
let config = default_config();
|
| 367 |
+
let params = ToolParams { command: Some("rm -rf / --no-preserve-root".to_string()), ..Default::default() };
|
| 368 |
+
let result = calculate("spf_bash", ¶ms, &config);
|
| 369 |
+
assert_eq!(result.tier, "CRITICAL", "Dangerous bash C={} should be CRITICAL", result.c);
|
| 370 |
+
assert!(result.c >= 10000);
|
| 371 |
+
}
|
| 372 |
+
|
| 373 |
+
#[test]
|
| 374 |
+
fn status_tool_is_minimal_complexity() {
|
| 375 |
+
let config = default_config();
|
| 376 |
+
let params = ToolParams::default();
|
| 377 |
+
let result = calculate("spf_status", ¶ms, &config);
|
| 378 |
+
assert!(result.c < 100, "Status C={} should be minimal", result.c);
|
| 379 |
+
assert_eq!(result.tier, "SIMPLE");
|
| 380 |
+
}
|
| 381 |
+
|
| 382 |
+
#[test]
|
| 383 |
+
fn unknown_tool_uses_default_weights() {
|
| 384 |
+
let config = default_config();
|
| 385 |
+
let params = ToolParams::default();
|
| 386 |
+
let c = calculate_c("totally_unknown_tool", ¶ms, &config);
|
| 387 |
+
// unknown: basic=20, deps=3, complex=1, files=1
|
| 388 |
+
// C = 20 + 3^7 + 1^10 + 1*10 = 20 + 2187 + 1 + 10 = 2218
|
| 389 |
+
assert!(c >= 2000, "Unknown tool C={} should be >= 2000 (LIGHT+)", c);
|
| 390 |
+
}
|
| 391 |
+
|
| 392 |
+
#[test]
|
| 393 |
+
fn a_optimal_within_bounds() {
|
| 394 |
+
let config = default_config();
|
| 395 |
+
let tokens = a_optimal(100, &config);
|
| 396 |
+
assert!(tokens > 0, "a_optimal(100) should be > 0");
|
| 397 |
+
assert!(tokens < 40000, "a_optimal(100)={} should be < W_eff(40000)", tokens);
|
| 398 |
+
}
|
| 399 |
+
|
| 400 |
+
#[test]
|
| 401 |
+
fn a_optimal_zero_input() {
|
| 402 |
+
let config = default_config();
|
| 403 |
+
let tokens = a_optimal(0, &config);
|
| 404 |
+
// C=0 → uses c_f=1.0, ln(1+e) ≈ 1.31, result should be positive
|
| 405 |
+
assert!(tokens > 0, "a_optimal(0)={} should still be > 0", tokens);
|
| 406 |
+
}
|
| 407 |
+
|
| 408 |
+
#[test]
|
| 409 |
+
fn risk_indicators_detected() {
|
| 410 |
+
assert!(has_risk_indicators("please delete this file"));
|
| 411 |
+
assert!(has_risk_indicators("sudo make install"));
|
| 412 |
+
assert!(has_risk_indicators("rm -rf everything"));
|
| 413 |
+
assert!(!has_risk_indicators("create a new file"));
|
| 414 |
+
assert!(!has_risk_indicators("read the documentation"));
|
| 415 |
+
}
|
| 416 |
+
}
|
SPFsmartGATE/src/encoder.rs
ADDED
|
@@ -0,0 +1,404 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// SPF Smart Gateway - Transformer Encoder
|
| 2 |
+
// Copyright 2026 Joseph Stone - All Rights Reserved
|
| 3 |
+
//
|
| 4 |
+
// N stacked encoder layers: self-attention → layer_norm → FFN → layer_norm
|
| 5 |
+
// Sinusoidal positional encoding. Bidirectional attention (no causal mask).
|
| 6 |
+
// Input: token embeddings → Output: contextualized representations.
|
| 7 |
+
//
|
| 8 |
+
// Depends on: tensor.rs, attention.rs, ffn.rs (Layers 0-1)
|
| 9 |
+
|
| 10 |
+
use crate::tensor::Tensor;
|
| 11 |
+
use crate::attention::{AttentionCache, AttentionConfig, MultiHeadAttention};
|
| 12 |
+
use crate::ffn::{FfnCache, FfnConfig, FeedForward};
|
| 13 |
+
|
| 14 |
+
// ============================================================================
|
| 15 |
+
// ACTIVATION CACHE (for backward pass — P2-C)
|
| 16 |
+
// ============================================================================
|
| 17 |
+
|
| 18 |
+
/// Cached activations from one encoder layer forward pass
|
| 19 |
+
pub struct EncoderLayerCache {
|
| 20 |
+
/// Input before LN1 (for layer_norm_backward)
|
| 21 |
+
pub ln1_input: Tensor,
|
| 22 |
+
/// Attention cache (Q, K, V, attn_weights, input, scale)
|
| 23 |
+
pub attn_cache: AttentionCache,
|
| 24 |
+
/// Input before LN2 (after attention residual)
|
| 25 |
+
pub ln2_input: Tensor,
|
| 26 |
+
/// FFN cache (input, hidden_pre_gelu)
|
| 27 |
+
pub ffn_cache: FfnCache,
|
| 28 |
+
/// Original layer input (for residual backward)
|
| 29 |
+
pub residual_input: Tensor,
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
// ============================================================================
|
| 33 |
+
// ENCODER CONFIGURATION
|
| 34 |
+
// ============================================================================
|
| 35 |
+
|
| 36 |
+
/// Configuration for the encoder stack
|
| 37 |
+
#[derive(Debug, Clone)]
|
| 38 |
+
pub struct EncoderConfig {
|
| 39 |
+
/// Number of encoder layers
|
| 40 |
+
pub n_layers: usize,
|
| 41 |
+
/// Model dimension
|
| 42 |
+
pub d_model: usize,
|
| 43 |
+
/// Number of attention heads
|
| 44 |
+
pub n_heads: usize,
|
| 45 |
+
/// Feed-forward hidden dimension (default: 4× d_model)
|
| 46 |
+
pub d_ff: usize,
|
| 47 |
+
/// Maximum sequence length (for positional encoding)
|
| 48 |
+
pub max_seq_len: usize,
|
| 49 |
+
/// Layer norm epsilon
|
| 50 |
+
pub ln_eps: f32,
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
impl EncoderConfig {
|
| 54 |
+
/// SPF Writer default: 6 layers, 256 dim, 8 heads
|
| 55 |
+
pub fn spf_writer() -> Self {
|
| 56 |
+
Self {
|
| 57 |
+
n_layers: 6,
|
| 58 |
+
d_model: 256,
|
| 59 |
+
n_heads: 8,
|
| 60 |
+
d_ff: 1024,
|
| 61 |
+
max_seq_len: 2048,
|
| 62 |
+
ln_eps: 1e-5,
|
| 63 |
+
}
|
| 64 |
+
}
|
| 65 |
+
|
| 66 |
+
/// Smaller config for testing
|
| 67 |
+
pub fn small() -> Self {
|
| 68 |
+
Self {
|
| 69 |
+
n_layers: 2,
|
| 70 |
+
d_model: 64,
|
| 71 |
+
n_heads: 4,
|
| 72 |
+
d_ff: 256,
|
| 73 |
+
max_seq_len: 512,
|
| 74 |
+
ln_eps: 1e-5,
|
| 75 |
+
}
|
| 76 |
+
}
|
| 77 |
+
}
|
| 78 |
+
|
| 79 |
+
// ============================================================================
|
| 80 |
+
// SINGLE ENCODER LAYER
|
| 81 |
+
// ============================================================================
|
| 82 |
+
|
| 83 |
+
/// One encoder layer: self-attention + FFN, each with residual + layer norm.
|
| 84 |
+
///
|
| 85 |
+
/// Pre-norm architecture (norm before sublayer, used by modern transformers):
|
| 86 |
+
/// x → LayerNorm → SelfAttention → + residual → LayerNorm → FFN → + residual
|
| 87 |
+
pub struct EncoderLayer {
|
| 88 |
+
/// Multi-head self-attention (bidirectional)
|
| 89 |
+
pub self_attn: MultiHeadAttention,
|
| 90 |
+
/// Feed-forward network
|
| 91 |
+
pub ffn: FeedForward,
|
| 92 |
+
/// Layer norm before attention
|
| 93 |
+
pub ln1_gamma: Tensor,
|
| 94 |
+
pub ln1_beta: Tensor,
|
| 95 |
+
/// Layer norm before FFN
|
| 96 |
+
pub ln2_gamma: Tensor,
|
| 97 |
+
pub ln2_beta: Tensor,
|
| 98 |
+
/// Epsilon for layer norm
|
| 99 |
+
ln_eps: f32,
|
| 100 |
+
}
|
| 101 |
+
|
| 102 |
+
impl EncoderLayer {
|
| 103 |
+
/// Initialize a single encoder layer
|
| 104 |
+
pub fn new(d_model: usize, n_heads: usize, d_ff: usize, ln_eps: f32, seed: u64) -> Self {
|
| 105 |
+
let attn_config = AttentionConfig {
|
| 106 |
+
d_model,
|
| 107 |
+
n_heads,
|
| 108 |
+
causal: false, // Encoder uses bidirectional attention
|
| 109 |
+
};
|
| 110 |
+
let ffn_config = FfnConfig { d_model, d_ff };
|
| 111 |
+
|
| 112 |
+
Self {
|
| 113 |
+
self_attn: MultiHeadAttention::new(attn_config, seed),
|
| 114 |
+
ffn: FeedForward::new(ffn_config, seed + 100),
|
| 115 |
+
ln1_gamma: Tensor::ones(&[d_model]),
|
| 116 |
+
ln1_beta: Tensor::zeros(&[d_model]),
|
| 117 |
+
ln2_gamma: Tensor::ones(&[d_model]),
|
| 118 |
+
ln2_beta: Tensor::zeros(&[d_model]),
|
| 119 |
+
ln_eps,
|
| 120 |
+
}
|
| 121 |
+
}
|
| 122 |
+
|
| 123 |
+
/// Forward pass: [batch, seq, d_model] → [batch, seq, d_model]
|
| 124 |
+
pub fn forward(&self, x: &Tensor) -> Result<Tensor, String> {
|
| 125 |
+
// Pre-norm self-attention with residual
|
| 126 |
+
let normed = x.layer_norm(&self.ln1_gamma, &self.ln1_beta, self.ln_eps)?;
|
| 127 |
+
let attn_out = self.self_attn.forward(&normed)?;
|
| 128 |
+
let x = x.add(&attn_out)?;
|
| 129 |
+
|
| 130 |
+
// Pre-norm FFN with residual
|
| 131 |
+
let normed = x.layer_norm(&self.ln2_gamma, &self.ln2_beta, self.ln_eps)?;
|
| 132 |
+
let ffn_out = self.ffn.forward(&normed)?;
|
| 133 |
+
x.add(&ffn_out)
|
| 134 |
+
}
|
| 135 |
+
|
| 136 |
+
/// Forward pass with cached activations for backward.
|
| 137 |
+
/// Output is IDENTICAL to forward(). Cache is additional data only.
|
| 138 |
+
pub fn forward_with_cache(&self, x: &Tensor) -> Result<(Tensor, EncoderLayerCache), String> {
|
| 139 |
+
let residual_input = x.clone();
|
| 140 |
+
|
| 141 |
+
// Pre-norm self-attention with residual
|
| 142 |
+
let ln1_input = x.clone();
|
| 143 |
+
let normed = x.layer_norm(&self.ln1_gamma, &self.ln1_beta, self.ln_eps)?;
|
| 144 |
+
let (attn_out, attn_cache) = self.self_attn.forward_with_cache(&normed)?;
|
| 145 |
+
let x = x.add(&attn_out)?;
|
| 146 |
+
|
| 147 |
+
// Pre-norm FFN with residual
|
| 148 |
+
let ln2_input = x.clone();
|
| 149 |
+
let normed = x.layer_norm(&self.ln2_gamma, &self.ln2_beta, self.ln_eps)?;
|
| 150 |
+
let (ffn_out, ffn_cache) = self.ffn.forward_with_cache(&normed)?;
|
| 151 |
+
let output = x.add(&ffn_out)?;
|
| 152 |
+
|
| 153 |
+
let cache = EncoderLayerCache {
|
| 154 |
+
ln1_input,
|
| 155 |
+
attn_cache,
|
| 156 |
+
ln2_input,
|
| 157 |
+
ffn_cache,
|
| 158 |
+
residual_input,
|
| 159 |
+
};
|
| 160 |
+
|
| 161 |
+
Ok((output, cache))
|
| 162 |
+
}
|
| 163 |
+
|
| 164 |
+
/// Total parameters in this layer
|
| 165 |
+
pub fn num_params(&self) -> usize {
|
| 166 |
+
let d = self.ln1_gamma.numel();
|
| 167 |
+
self.self_attn.num_params() + self.ffn.num_params() + 4 * d // 2 LN × (gamma + beta)
|
| 168 |
+
}
|
| 169 |
+
|
| 170 |
+
/// Collect all weight tensors for serialization
|
| 171 |
+
pub fn weights(&self) -> Vec<&Tensor> {
|
| 172 |
+
let mut w = self.self_attn.weights();
|
| 173 |
+
w.extend(self.ffn.weights());
|
| 174 |
+
w.extend([&self.ln1_gamma, &self.ln1_beta, &self.ln2_gamma, &self.ln2_beta]);
|
| 175 |
+
w
|
| 176 |
+
}
|
| 177 |
+
|
| 178 |
+
/// Collect all weight tensors mutably for optimizer updates
|
| 179 |
+
pub fn weights_mut(&mut self) -> Vec<&mut Tensor> {
|
| 180 |
+
let mut w = self.self_attn.weights_mut();
|
| 181 |
+
w.extend(self.ffn.weights_mut());
|
| 182 |
+
w.extend([&mut self.ln1_gamma, &mut self.ln1_beta, &mut self.ln2_gamma, &mut self.ln2_beta]);
|
| 183 |
+
w
|
| 184 |
+
}
|
| 185 |
+
}
|
| 186 |
+
|
| 187 |
+
// ============================================================================
|
| 188 |
+
// POSITIONAL ENCODING
|
| 189 |
+
// ============================================================================
|
| 190 |
+
|
| 191 |
+
/// Generate sinusoidal positional encoding table.
|
| 192 |
+
/// PE(pos, 2i) = sin(pos / 10000^(2i/d_model))
|
| 193 |
+
/// PE(pos, 2i+1) = cos(pos / 10000^(2i/d_model))
|
| 194 |
+
///
|
| 195 |
+
/// Returns: [max_seq_len, d_model] tensor
|
| 196 |
+
pub fn sinusoidal_positional_encoding(max_seq_len: usize, d_model: usize) -> Tensor {
|
| 197 |
+
let mut data = vec![0.0f32; max_seq_len * d_model];
|
| 198 |
+
for pos in 0..max_seq_len {
|
| 199 |
+
for i in 0..d_model / 2 {
|
| 200 |
+
let angle = pos as f32 / (10000.0_f32).powf(2.0 * i as f32 / d_model as f32);
|
| 201 |
+
data[pos * d_model + 2 * i] = angle.sin();
|
| 202 |
+
data[pos * d_model + 2 * i + 1] = angle.cos();
|
| 203 |
+
}
|
| 204 |
+
// Handle odd d_model
|
| 205 |
+
if d_model % 2 == 1 {
|
| 206 |
+
let angle = pos as f32 / (10000.0_f32).powf((d_model - 1) as f32 / d_model as f32);
|
| 207 |
+
data[pos * d_model + d_model - 1] = angle.sin();
|
| 208 |
+
}
|
| 209 |
+
}
|
| 210 |
+
Tensor { data, shape: vec![max_seq_len, d_model] }
|
| 211 |
+
}
|
| 212 |
+
|
| 213 |
+
// ============================================================================
|
| 214 |
+
// ENCODER STACK
|
| 215 |
+
// ============================================================================
|
| 216 |
+
|
| 217 |
+
/// Full encoder: positional encoding + N encoder layers + final layer norm.
|
| 218 |
+
pub struct Encoder {
|
| 219 |
+
pub config: EncoderConfig,
|
| 220 |
+
/// Positional encoding table [max_seq_len, d_model]
|
| 221 |
+
pub pos_encoding: Tensor,
|
| 222 |
+
/// Stack of encoder layers
|
| 223 |
+
pub layers: Vec<EncoderLayer>,
|
| 224 |
+
/// Final layer norm (applied after all layers)
|
| 225 |
+
pub final_ln_gamma: Tensor,
|
| 226 |
+
pub final_ln_beta: Tensor,
|
| 227 |
+
}
|
| 228 |
+
|
| 229 |
+
impl Encoder {
|
| 230 |
+
/// Initialize encoder with given config
|
| 231 |
+
pub fn new(config: EncoderConfig, seed: u64) -> Self {
|
| 232 |
+
let pos_encoding = sinusoidal_positional_encoding(config.max_seq_len, config.d_model);
|
| 233 |
+
|
| 234 |
+
let layers: Vec<EncoderLayer> = (0..config.n_layers)
|
| 235 |
+
.map(|i| {
|
| 236 |
+
EncoderLayer::new(
|
| 237 |
+
config.d_model,
|
| 238 |
+
config.n_heads,
|
| 239 |
+
config.d_ff,
|
| 240 |
+
config.ln_eps,
|
| 241 |
+
seed + (i as u64) * 1000,
|
| 242 |
+
)
|
| 243 |
+
})
|
| 244 |
+
.collect();
|
| 245 |
+
|
| 246 |
+
Self {
|
| 247 |
+
final_ln_gamma: Tensor::ones(&[config.d_model]),
|
| 248 |
+
final_ln_beta: Tensor::zeros(&[config.d_model]),
|
| 249 |
+
pos_encoding,
|
| 250 |
+
layers,
|
| 251 |
+
config,
|
| 252 |
+
}
|
| 253 |
+
}
|
| 254 |
+
|
| 255 |
+
/// Forward pass: embeddings [batch, seq_len, d_model] → encoded [batch, seq_len, d_model]
|
| 256 |
+
///
|
| 257 |
+
/// 1. Add positional encoding to input embeddings
|
| 258 |
+
/// 2. Pass through N encoder layers
|
| 259 |
+
/// 3. Apply final layer norm
|
| 260 |
+
pub fn forward(&self, embeddings: &Tensor) -> Result<Tensor, String> {
|
| 261 |
+
let seq_len = embeddings.shape[1];
|
| 262 |
+
if seq_len > self.config.max_seq_len {
|
| 263 |
+
return Err(format!(
|
| 264 |
+
"Sequence length {} exceeds max {}",
|
| 265 |
+
seq_len, self.config.max_seq_len
|
| 266 |
+
));
|
| 267 |
+
}
|
| 268 |
+
|
| 269 |
+
// Slice positional encoding to actual sequence length
|
| 270 |
+
let pos_enc = self.pos_encoding.slice(0, seq_len)?;
|
| 271 |
+
|
| 272 |
+
// Add positional encoding (broadcasts across batch dimension)
|
| 273 |
+
let batch = embeddings.shape[0];
|
| 274 |
+
let d_model = embeddings.shape[2];
|
| 275 |
+
let mut x_data = embeddings.data.clone();
|
| 276 |
+
for b in 0..batch {
|
| 277 |
+
for s in 0..seq_len {
|
| 278 |
+
for d in 0..d_model {
|
| 279 |
+
x_data[(b * seq_len + s) * d_model + d] += pos_enc.data[s * d_model + d];
|
| 280 |
+
}
|
| 281 |
+
}
|
| 282 |
+
}
|
| 283 |
+
let mut x = Tensor::from_data(x_data, embeddings.shape.clone())?;
|
| 284 |
+
|
| 285 |
+
// Pass through encoder layers
|
| 286 |
+
for layer in &self.layers {
|
| 287 |
+
x = layer.forward(&x)?;
|
| 288 |
+
}
|
| 289 |
+
|
| 290 |
+
// Final layer norm
|
| 291 |
+
x.layer_norm(&self.final_ln_gamma, &self.final_ln_beta, self.config.ln_eps)
|
| 292 |
+
}
|
| 293 |
+
|
| 294 |
+
/// Total parameters in the encoder
|
| 295 |
+
pub fn num_params(&self) -> usize {
|
| 296 |
+
let layer_params: usize = self.layers.iter().map(|l| l.num_params()).sum();
|
| 297 |
+
layer_params + 2 * self.config.d_model // final LN gamma + beta
|
| 298 |
+
}
|
| 299 |
+
|
| 300 |
+
/// Collect all weight tensors
|
| 301 |
+
pub fn weights(&self) -> Vec<&Tensor> {
|
| 302 |
+
let mut w: Vec<&Tensor> = Vec::new();
|
| 303 |
+
for layer in &self.layers {
|
| 304 |
+
w.extend(layer.weights());
|
| 305 |
+
}
|
| 306 |
+
w.push(&self.final_ln_gamma);
|
| 307 |
+
w.push(&self.final_ln_beta);
|
| 308 |
+
w
|
| 309 |
+
}
|
| 310 |
+
|
| 311 |
+
/// Collect all weight tensors mutably
|
| 312 |
+
pub fn weights_mut(&mut self) -> Vec<&mut Tensor> {
|
| 313 |
+
let mut w: Vec<&mut Tensor> = Vec::new();
|
| 314 |
+
for layer in &mut self.layers {
|
| 315 |
+
w.extend(layer.weights_mut());
|
| 316 |
+
}
|
| 317 |
+
w.push(&mut self.final_ln_gamma);
|
| 318 |
+
w.push(&mut self.final_ln_beta);
|
| 319 |
+
w
|
| 320 |
+
}
|
| 321 |
+
}
|
| 322 |
+
|
| 323 |
+
// ============================================================================
|
| 324 |
+
// TESTS
|
| 325 |
+
// ============================================================================
|
| 326 |
+
|
| 327 |
+
#[cfg(test)]
|
| 328 |
+
mod tests {
|
| 329 |
+
use super::*;
|
| 330 |
+
|
| 331 |
+
#[test]
|
| 332 |
+
fn test_positional_encoding_shape() {
|
| 333 |
+
let pe = sinusoidal_positional_encoding(100, 64);
|
| 334 |
+
assert_eq!(pe.shape, vec![100, 64]);
|
| 335 |
+
}
|
| 336 |
+
|
| 337 |
+
#[test]
|
| 338 |
+
fn test_positional_encoding_values() {
|
| 339 |
+
let pe = sinusoidal_positional_encoding(10, 8);
|
| 340 |
+
// Position 0 should have sin(0)=0, cos(0)=1 for first pair
|
| 341 |
+
assert!((pe.data[0] - 0.0).abs() < 1e-5); // sin(0)
|
| 342 |
+
assert!((pe.data[1] - 1.0).abs() < 1e-5); // cos(0)
|
| 343 |
+
// All values should be in [-1, 1]
|
| 344 |
+
assert!(pe.data.iter().all(|&v| v >= -1.0 && v <= 1.0));
|
| 345 |
+
}
|
| 346 |
+
|
| 347 |
+
#[test]
|
| 348 |
+
fn test_encoder_layer_shape() {
|
| 349 |
+
let layer = EncoderLayer::new(64, 4, 256, 1e-5, 42);
|
| 350 |
+
let x = Tensor::randn(&[2, 8, 64], 99);
|
| 351 |
+
let out = layer.forward(&x).unwrap();
|
| 352 |
+
assert_eq!(out.shape, vec![2, 8, 64]);
|
| 353 |
+
}
|
| 354 |
+
|
| 355 |
+
#[test]
|
| 356 |
+
fn test_encoder_layer_residual() {
|
| 357 |
+
let layer = EncoderLayer::new(64, 4, 256, 1e-5, 42);
|
| 358 |
+
let x = Tensor::randn(&[1, 4, 64], 99);
|
| 359 |
+
let out = layer.forward(&x).unwrap();
|
| 360 |
+
// With residual connections, output should not be identical to input
|
| 361 |
+
// but should be close in magnitude (not exploding)
|
| 362 |
+
let diff: f32 = x.data.iter().zip(&out.data)
|
| 363 |
+
.map(|(a, b)| (a - b).abs())
|
| 364 |
+
.sum::<f32>() / x.numel() as f32;
|
| 365 |
+
assert!(diff < 10.0, "Output diverged too far from input: {}", diff);
|
| 366 |
+
}
|
| 367 |
+
|
| 368 |
+
#[test]
|
| 369 |
+
fn test_encoder_full_forward() {
|
| 370 |
+
let config = EncoderConfig::small();
|
| 371 |
+
let encoder = Encoder::new(config, 42);
|
| 372 |
+
let x = Tensor::randn(&[1, 8, 64], 99);
|
| 373 |
+
let out = encoder.forward(&x).unwrap();
|
| 374 |
+
assert_eq!(out.shape, vec![1, 8, 64]);
|
| 375 |
+
assert!(out.data.iter().all(|v| v.is_finite()));
|
| 376 |
+
}
|
| 377 |
+
|
| 378 |
+
#[test]
|
| 379 |
+
fn test_encoder_seq_exceeds_max() {
|
| 380 |
+
let config = EncoderConfig { max_seq_len: 10, ..EncoderConfig::small() };
|
| 381 |
+
let encoder = Encoder::new(config, 42);
|
| 382 |
+
let x = Tensor::randn(&[1, 20, 64], 99); // seq=20 > max=10
|
| 383 |
+
assert!(encoder.forward(&x).is_err());
|
| 384 |
+
}
|
| 385 |
+
|
| 386 |
+
#[test]
|
| 387 |
+
fn test_encoder_num_params() {
|
| 388 |
+
let config = EncoderConfig::small(); // 2 layers, d=64, ff=256
|
| 389 |
+
let encoder = Encoder::new(config, 42);
|
| 390 |
+
let params = encoder.num_params();
|
| 391 |
+
// Each layer: attn(16640) + ffn(33088) + 4×64(LN) = 49984
|
| 392 |
+
// 2 layers + final LN = 2×49984 + 128 = 100096
|
| 393 |
+
assert_eq!(params, 100096);
|
| 394 |
+
}
|
| 395 |
+
|
| 396 |
+
#[test]
|
| 397 |
+
fn test_encoder_weights_collection() {
|
| 398 |
+
let config = EncoderConfig::small();
|
| 399 |
+
let encoder = Encoder::new(config, 42);
|
| 400 |
+
let weights = encoder.weights();
|
| 401 |
+
// Each layer: 8(attn) + 4(ffn) + 4(LN) = 16. ×2 layers + 2 final LN = 34
|
| 402 |
+
assert_eq!(weights.len(), 34);
|
| 403 |
+
}
|
| 404 |
+
}
|
SPFsmartGATE/src/tmp_db.rs
ADDED
|
@@ -0,0 +1,609 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// SPF Smart Gateway - TMP LMDB
|
| 2 |
+
// Copyright 2026 Joseph Stone - All Rights Reserved
|
| 3 |
+
//
|
| 4 |
+
// LMDB-backed metadata for /tmp and /projects device directories.
|
| 5 |
+
// Tracks file access logs, resource usage, and project isolation.
|
| 6 |
+
//
|
| 7 |
+
// Database: TMP_DB
|
| 8 |
+
// Storage: ~/SPFsmartGATE/LIVE/TMP/TMP.DB/
|
| 9 |
+
|
| 10 |
+
use anyhow::{anyhow, Result};
|
| 11 |
+
use heed::types::*;
|
| 12 |
+
use heed::{Database, Env, EnvOpenOptions};
|
| 13 |
+
use serde::{Deserialize, Serialize};
|
| 14 |
+
use std::path::Path;
|
| 15 |
+
use std::time::{SystemTime, UNIX_EPOCH};
|
| 16 |
+
|
| 17 |
+
const MAX_DB_SIZE: usize = 256 * 1024 * 1024; // 256MB — virtual address space only, no physical cost
|
| 18 |
+
|
| 19 |
+
/// Project trust level
|
| 20 |
+
#[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord)]
|
| 21 |
+
pub enum TrustLevel {
|
| 22 |
+
/// Untrusted - maximum restrictions
|
| 23 |
+
Untrusted = 0,
|
| 24 |
+
/// Low trust - basic operations only
|
| 25 |
+
Low = 1,
|
| 26 |
+
/// Medium trust - most operations allowed with prompts
|
| 27 |
+
Medium = 2,
|
| 28 |
+
/// High trust - operations allowed with minimal prompts
|
| 29 |
+
High = 3,
|
| 30 |
+
/// Full trust - all operations allowed (user's own project)
|
| 31 |
+
Full = 4,
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
impl Default for TrustLevel {
|
| 35 |
+
fn default() -> Self {
|
| 36 |
+
TrustLevel::Low
|
| 37 |
+
}
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
/// Project entry — tracked in TMP_DB LMDB
|
| 41 |
+
#[derive(Debug, Clone, Serialize, Deserialize)]
|
| 42 |
+
pub struct Project {
|
| 43 |
+
/// Project root path (canonical)
|
| 44 |
+
pub path: String,
|
| 45 |
+
/// Display name for the project
|
| 46 |
+
pub name: String,
|
| 47 |
+
/// Trust level
|
| 48 |
+
pub trust_level: TrustLevel,
|
| 49 |
+
/// Tools explicitly allowed for this project
|
| 50 |
+
pub allowed_tools: Vec<String>,
|
| 51 |
+
/// Tools explicitly denied for this project
|
| 52 |
+
pub denied_tools: Vec<String>,
|
| 53 |
+
/// Paths within project that are write-protected
|
| 54 |
+
pub protected_paths: Vec<String>,
|
| 55 |
+
/// Maximum file size for writes (bytes)
|
| 56 |
+
pub max_write_size: usize,
|
| 57 |
+
/// Maximum total writes per session
|
| 58 |
+
pub max_writes_per_session: u32,
|
| 59 |
+
/// Current session write count
|
| 60 |
+
pub session_writes: u32,
|
| 61 |
+
/// Total files accessed (read)
|
| 62 |
+
pub total_reads: u64,
|
| 63 |
+
/// Total files modified (write/edit)
|
| 64 |
+
pub total_writes: u64,
|
| 65 |
+
/// Total complexity accumulated
|
| 66 |
+
pub total_complexity: u64,
|
| 67 |
+
/// Created timestamp
|
| 68 |
+
pub created_at: u64,
|
| 69 |
+
/// Last accessed timestamp
|
| 70 |
+
pub last_accessed: u64,
|
| 71 |
+
/// Whether project requires explicit activation
|
| 72 |
+
pub requires_activation: bool,
|
| 73 |
+
/// Whether project is currently active
|
| 74 |
+
pub is_active: bool,
|
| 75 |
+
/// User notes about this project
|
| 76 |
+
pub notes: String,
|
| 77 |
+
}
|
| 78 |
+
|
| 79 |
+
/// File access record
|
| 80 |
+
#[derive(Debug, Clone, Serialize, Deserialize)]
|
| 81 |
+
pub struct FileAccess {
|
| 82 |
+
/// File path (relative to project root)
|
| 83 |
+
pub path: String,
|
| 84 |
+
/// Project this file belongs to
|
| 85 |
+
pub project: String,
|
| 86 |
+
/// Access type: "read", "write", "edit", "delete"
|
| 87 |
+
pub access_type: String,
|
| 88 |
+
/// Timestamp
|
| 89 |
+
pub timestamp: u64,
|
| 90 |
+
/// Session ID
|
| 91 |
+
pub session_id: String,
|
| 92 |
+
/// File size at access time
|
| 93 |
+
pub file_size: u64,
|
| 94 |
+
/// Whether access was allowed
|
| 95 |
+
pub allowed: bool,
|
| 96 |
+
/// Reason if denied
|
| 97 |
+
pub deny_reason: Option<String>,
|
| 98 |
+
}
|
| 99 |
+
|
| 100 |
+
/// Resource usage for a project
|
| 101 |
+
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
|
| 102 |
+
pub struct ResourceUsage {
|
| 103 |
+
/// Total bytes read
|
| 104 |
+
pub bytes_read: u64,
|
| 105 |
+
/// Total bytes written
|
| 106 |
+
pub bytes_written: u64,
|
| 107 |
+
/// Total files created
|
| 108 |
+
pub files_created: u64,
|
| 109 |
+
/// Total files deleted
|
| 110 |
+
pub files_deleted: u64,
|
| 111 |
+
/// Total bash commands run
|
| 112 |
+
pub bash_commands: u64,
|
| 113 |
+
/// Total web requests
|
| 114 |
+
pub web_requests: u64,
|
| 115 |
+
}
|
| 116 |
+
|
| 117 |
+
/// LMDB-backed project manager
|
| 118 |
+
pub struct SpfTmpDb {
|
| 119 |
+
env: Env,
|
| 120 |
+
/// Project registry: canonical_path → Project
|
| 121 |
+
projects: Database<Str, SerdeBincode<Project>>,
|
| 122 |
+
/// File access log: "timestamp:project:path" → FileAccess
|
| 123 |
+
access_log: Database<Str, SerdeBincode<FileAccess>>,
|
| 124 |
+
/// Resource usage: project_path → ResourceUsage
|
| 125 |
+
resources: Database<Str, SerdeBincode<ResourceUsage>>,
|
| 126 |
+
/// Active project marker: "active" → project_path
|
| 127 |
+
active: Database<Str, Str>,
|
| 128 |
+
}
|
| 129 |
+
|
| 130 |
+
impl SpfTmpDb {
|
| 131 |
+
/// Open or create project LMDB at given path
|
| 132 |
+
pub fn open(path: &Path) -> Result<Self> {
|
| 133 |
+
std::fs::create_dir_all(path)?;
|
| 134 |
+
|
| 135 |
+
let env = unsafe {
|
| 136 |
+
EnvOpenOptions::new()
|
| 137 |
+
.map_size(MAX_DB_SIZE)
|
| 138 |
+
.max_dbs(8)
|
| 139 |
+
.open(path)?
|
| 140 |
+
};
|
| 141 |
+
|
| 142 |
+
let mut wtxn = env.write_txn()?;
|
| 143 |
+
let projects = env.create_database(&mut wtxn, Some("projects"))?;
|
| 144 |
+
let access_log = env.create_database(&mut wtxn, Some("access_log"))?;
|
| 145 |
+
let resources = env.create_database(&mut wtxn, Some("resources"))?;
|
| 146 |
+
let active = env.create_database(&mut wtxn, Some("active"))?;
|
| 147 |
+
wtxn.commit()?;
|
| 148 |
+
|
| 149 |
+
log::info!("TMP_DB LMDB opened at {:?}", path);
|
| 150 |
+
Ok(Self { env, projects, access_log, resources, active })
|
| 151 |
+
}
|
| 152 |
+
|
| 153 |
+
// ========================================================================
|
| 154 |
+
// PROJECT MANAGEMENT
|
| 155 |
+
// ========================================================================
|
| 156 |
+
|
| 157 |
+
/// Register a new project project
|
| 158 |
+
pub fn register_project(&self, path: &str, name: &str, trust_level: TrustLevel) -> Result<Project> {
|
| 159 |
+
let canonical = std::fs::canonicalize(path)
|
| 160 |
+
.map(|p| p.to_string_lossy().to_string())
|
| 161 |
+
.unwrap_or_else(|_| path.to_string());
|
| 162 |
+
|
| 163 |
+
let now = SystemTime::now()
|
| 164 |
+
.duration_since(UNIX_EPOCH)
|
| 165 |
+
.unwrap_or_default()
|
| 166 |
+
.as_secs();
|
| 167 |
+
|
| 168 |
+
let project = Project {
|
| 169 |
+
path: canonical.clone(),
|
| 170 |
+
name: name.to_string(),
|
| 171 |
+
trust_level,
|
| 172 |
+
allowed_tools: Vec::new(),
|
| 173 |
+
denied_tools: Vec::new(),
|
| 174 |
+
protected_paths: vec![".git".to_string(), ".env".to_string()],
|
| 175 |
+
max_write_size: 100_000,
|
| 176 |
+
max_writes_per_session: 100,
|
| 177 |
+
session_writes: 0,
|
| 178 |
+
total_reads: 0,
|
| 179 |
+
total_writes: 0,
|
| 180 |
+
total_complexity: 0,
|
| 181 |
+
created_at: now,
|
| 182 |
+
last_accessed: now,
|
| 183 |
+
requires_activation: trust_level < TrustLevel::High,
|
| 184 |
+
is_active: false,
|
| 185 |
+
notes: String::new(),
|
| 186 |
+
};
|
| 187 |
+
|
| 188 |
+
let mut wtxn = self.env.write_txn()?;
|
| 189 |
+
self.projects.put(&mut wtxn, &canonical, &project)?;
|
| 190 |
+
self.resources.put(&mut wtxn, &canonical, &ResourceUsage::default())?;
|
| 191 |
+
wtxn.commit()?;
|
| 192 |
+
|
| 193 |
+
Ok(project)
|
| 194 |
+
}
|
| 195 |
+
|
| 196 |
+
/// Get a project project
|
| 197 |
+
pub fn get_project(&self, path: &str) -> Result<Option<Project>> {
|
| 198 |
+
let canonical = std::fs::canonicalize(path)
|
| 199 |
+
.map(|p| p.to_string_lossy().to_string())
|
| 200 |
+
.unwrap_or_else(|_| path.to_string());
|
| 201 |
+
|
| 202 |
+
let rtxn = self.env.read_txn()?;
|
| 203 |
+
Ok(self.projects.get(&rtxn, &canonical)?)
|
| 204 |
+
}
|
| 205 |
+
|
| 206 |
+
/// Update a project project
|
| 207 |
+
pub fn update_project(&self, project: &Project) -> Result<()> {
|
| 208 |
+
let mut wtxn = self.env.write_txn()?;
|
| 209 |
+
self.projects.put(&mut wtxn, &project.path, project)?;
|
| 210 |
+
wtxn.commit()?;
|
| 211 |
+
Ok(())
|
| 212 |
+
}
|
| 213 |
+
|
| 214 |
+
/// Find project containing a file path
|
| 215 |
+
pub fn find_project_for_path(&self, file_path: &str) -> Result<Option<Project>> {
|
| 216 |
+
let canonical = std::fs::canonicalize(file_path)
|
| 217 |
+
.map(|p| p.to_string_lossy().to_string())
|
| 218 |
+
.unwrap_or_else(|_| file_path.to_string());
|
| 219 |
+
|
| 220 |
+
let rtxn = self.env.read_txn()?;
|
| 221 |
+
let iter = self.projects.iter(&rtxn)?;
|
| 222 |
+
|
| 223 |
+
// Find the most specific (longest) matching project path
|
| 224 |
+
let mut best_match: Option<Project> = None;
|
| 225 |
+
let mut best_len = 0;
|
| 226 |
+
|
| 227 |
+
for result in iter {
|
| 228 |
+
let (project_path, project) = result?;
|
| 229 |
+
if canonical.starts_with(project_path) && project_path.len() > best_len {
|
| 230 |
+
best_match = Some(project);
|
| 231 |
+
best_len = project_path.len();
|
| 232 |
+
}
|
| 233 |
+
}
|
| 234 |
+
|
| 235 |
+
Ok(best_match)
|
| 236 |
+
}
|
| 237 |
+
|
| 238 |
+
/// List all registered projects
|
| 239 |
+
pub fn list_projects(&self) -> Result<Vec<Project>> {
|
| 240 |
+
let rtxn = self.env.read_txn()?;
|
| 241 |
+
let iter = self.projects.iter(&rtxn)?;
|
| 242 |
+
|
| 243 |
+
let mut projects = Vec::new();
|
| 244 |
+
for result in iter {
|
| 245 |
+
let (_, project) = result?;
|
| 246 |
+
projects.push(project);
|
| 247 |
+
}
|
| 248 |
+
Ok(projects)
|
| 249 |
+
}
|
| 250 |
+
|
| 251 |
+
/// Delete a project
|
| 252 |
+
pub fn delete_project(&self, path: &str) -> Result<bool> {
|
| 253 |
+
let canonical = std::fs::canonicalize(path)
|
| 254 |
+
.map(|p| p.to_string_lossy().to_string())
|
| 255 |
+
.unwrap_or_else(|_| path.to_string());
|
| 256 |
+
|
| 257 |
+
let mut wtxn = self.env.write_txn()?;
|
| 258 |
+
let deleted = self.projects.delete(&mut wtxn, &canonical)?;
|
| 259 |
+
self.resources.delete(&mut wtxn, &canonical)?;
|
| 260 |
+
wtxn.commit()?;
|
| 261 |
+
Ok(deleted)
|
| 262 |
+
}
|
| 263 |
+
|
| 264 |
+
// ========================================================================
|
| 265 |
+
// TRUST & PERMISSIONS
|
| 266 |
+
// ========================================================================
|
| 267 |
+
|
| 268 |
+
/// Set project trust level
|
| 269 |
+
pub fn set_trust_level(&self, path: &str, level: TrustLevel) -> Result<()> {
|
| 270 |
+
let mut project = self.get_project(path)?
|
| 271 |
+
.ok_or_else(|| anyhow!("Project not found: {}", path))?;
|
| 272 |
+
project.trust_level = level;
|
| 273 |
+
project.requires_activation = level < TrustLevel::High;
|
| 274 |
+
self.update_project(&project)
|
| 275 |
+
}
|
| 276 |
+
|
| 277 |
+
/// Check if a tool is allowed for a project
|
| 278 |
+
pub fn is_tool_allowed(&self, project_path: &str, tool: &str) -> Result<bool> {
|
| 279 |
+
let project = match self.get_project(project_path)? {
|
| 280 |
+
Some(s) => s,
|
| 281 |
+
None => return Ok(true), // No project = no restrictions
|
| 282 |
+
};
|
| 283 |
+
|
| 284 |
+
// Explicit deny takes precedence
|
| 285 |
+
if project.denied_tools.contains(&tool.to_string()) {
|
| 286 |
+
return Ok(false);
|
| 287 |
+
}
|
| 288 |
+
|
| 289 |
+
// Explicit allow
|
| 290 |
+
if project.allowed_tools.contains(&tool.to_string()) {
|
| 291 |
+
return Ok(true);
|
| 292 |
+
}
|
| 293 |
+
|
| 294 |
+
// Trust-level based default
|
| 295 |
+
Ok(match project.trust_level {
|
| 296 |
+
TrustLevel::Untrusted => false,
|
| 297 |
+
TrustLevel::Low => matches!(tool, "Read" | "Glob" | "Grep"),
|
| 298 |
+
TrustLevel::Medium => !matches!(tool, "Bash"),
|
| 299 |
+
TrustLevel::High | TrustLevel::Full => true,
|
| 300 |
+
})
|
| 301 |
+
}
|
| 302 |
+
|
| 303 |
+
/// Check if a path within project is protected
|
| 304 |
+
pub fn is_path_protected(&self, project_path: &str, file_path: &str) -> Result<bool> {
|
| 305 |
+
let project = match self.get_project(project_path)? {
|
| 306 |
+
Some(s) => s,
|
| 307 |
+
None => return Ok(false),
|
| 308 |
+
};
|
| 309 |
+
|
| 310 |
+
// Get relative path
|
| 311 |
+
let relative = file_path.strip_prefix(&project.path)
|
| 312 |
+
.unwrap_or(file_path)
|
| 313 |
+
.trim_start_matches('/');
|
| 314 |
+
|
| 315 |
+
for protected in &project.protected_paths {
|
| 316 |
+
if relative.starts_with(protected) || relative == *protected {
|
| 317 |
+
return Ok(true);
|
| 318 |
+
}
|
| 319 |
+
}
|
| 320 |
+
Ok(false)
|
| 321 |
+
}
|
| 322 |
+
|
| 323 |
+
/// Add a protected path to a project
|
| 324 |
+
pub fn add_protected_path(&self, project_path: &str, protected: &str) -> Result<()> {
|
| 325 |
+
let mut project = self.get_project(project_path)?
|
| 326 |
+
.ok_or_else(|| anyhow!("Project not found: {}", project_path))?;
|
| 327 |
+
|
| 328 |
+
if !project.protected_paths.contains(&protected.to_string()) {
|
| 329 |
+
project.protected_paths.push(protected.to_string());
|
| 330 |
+
self.update_project(&project)?;
|
| 331 |
+
}
|
| 332 |
+
Ok(())
|
| 333 |
+
}
|
| 334 |
+
|
| 335 |
+
// ========================================================================
|
| 336 |
+
// ACTIVE PROJECT
|
| 337 |
+
// ========================================================================
|
| 338 |
+
|
| 339 |
+
/// Set the currently active project
|
| 340 |
+
pub fn set_active(&self, path: &str) -> Result<()> {
|
| 341 |
+
let canonical = std::fs::canonicalize(path)
|
| 342 |
+
.map(|p| p.to_string_lossy().to_string())
|
| 343 |
+
.unwrap_or_else(|_| path.to_string());
|
| 344 |
+
|
| 345 |
+
// Deactivate current
|
| 346 |
+
if let Some(current) = self.get_active()? {
|
| 347 |
+
let mut project = self.get_project(¤t)?
|
| 348 |
+
.ok_or_else(|| anyhow!("Active project not found"))?;
|
| 349 |
+
project.is_active = false;
|
| 350 |
+
self.update_project(&project)?;
|
| 351 |
+
}
|
| 352 |
+
|
| 353 |
+
// Activate new
|
| 354 |
+
let mut project = self.get_project(&canonical)?
|
| 355 |
+
.ok_or_else(|| anyhow!("Project not found: {}", canonical))?;
|
| 356 |
+
project.is_active = true;
|
| 357 |
+
project.last_accessed = SystemTime::now()
|
| 358 |
+
.duration_since(UNIX_EPOCH)
|
| 359 |
+
.unwrap_or_default()
|
| 360 |
+
.as_secs();
|
| 361 |
+
self.update_project(&project)?;
|
| 362 |
+
|
| 363 |
+
let mut wtxn = self.env.write_txn()?;
|
| 364 |
+
self.active.put(&mut wtxn, "active", &canonical)?;
|
| 365 |
+
wtxn.commit()?;
|
| 366 |
+
Ok(())
|
| 367 |
+
}
|
| 368 |
+
|
| 369 |
+
/// Get the currently active project path
|
| 370 |
+
pub fn get_active(&self) -> Result<Option<String>> {
|
| 371 |
+
let rtxn = self.env.read_txn()?;
|
| 372 |
+
Ok(self.active.get(&rtxn, "active")?.map(|s| s.to_string()))
|
| 373 |
+
}
|
| 374 |
+
|
| 375 |
+
/// Clear active project
|
| 376 |
+
pub fn clear_active(&self) -> Result<()> {
|
| 377 |
+
if let Some(current) = self.get_active()? {
|
| 378 |
+
if let Some(mut project) = self.get_project(¤t)? {
|
| 379 |
+
project.is_active = false;
|
| 380 |
+
self.update_project(&project)?;
|
| 381 |
+
}
|
| 382 |
+
}
|
| 383 |
+
let mut wtxn = self.env.write_txn()?;
|
| 384 |
+
self.active.delete(&mut wtxn, "active")?;
|
| 385 |
+
wtxn.commit()?;
|
| 386 |
+
Ok(())
|
| 387 |
+
}
|
| 388 |
+
|
| 389 |
+
// ========================================================================
|
| 390 |
+
// ACCESS LOGGING
|
| 391 |
+
// ========================================================================
|
| 392 |
+
|
| 393 |
+
/// Log a file access
|
| 394 |
+
pub fn log_access(
|
| 395 |
+
&self,
|
| 396 |
+
file_path: &str,
|
| 397 |
+
project_path: &str,
|
| 398 |
+
access_type: &str,
|
| 399 |
+
session_id: &str,
|
| 400 |
+
file_size: u64,
|
| 401 |
+
allowed: bool,
|
| 402 |
+
deny_reason: Option<&str>,
|
| 403 |
+
) -> Result<()> {
|
| 404 |
+
let now = SystemTime::now()
|
| 405 |
+
.duration_since(UNIX_EPOCH)
|
| 406 |
+
.unwrap_or_default()
|
| 407 |
+
.as_secs();
|
| 408 |
+
|
| 409 |
+
let access = FileAccess {
|
| 410 |
+
path: file_path.to_string(),
|
| 411 |
+
project: project_path.to_string(),
|
| 412 |
+
access_type: access_type.to_string(),
|
| 413 |
+
timestamp: now,
|
| 414 |
+
session_id: session_id.to_string(),
|
| 415 |
+
file_size,
|
| 416 |
+
allowed,
|
| 417 |
+
deny_reason: deny_reason.map(|s| s.to_string()),
|
| 418 |
+
};
|
| 419 |
+
|
| 420 |
+
let key = format!("{}:{}:{}", now, project_path, file_path);
|
| 421 |
+
let mut wtxn = self.env.write_txn()?;
|
| 422 |
+
self.access_log.put(&mut wtxn, &key, &access)?;
|
| 423 |
+
wtxn.commit()?;
|
| 424 |
+
|
| 425 |
+
// Update project stats
|
| 426 |
+
if let Some(mut project) = self.get_project(project_path)? {
|
| 427 |
+
if allowed {
|
| 428 |
+
match access_type {
|
| 429 |
+
"read" => project.total_reads += 1,
|
| 430 |
+
"write" | "edit" | "delete" => {
|
| 431 |
+
project.total_writes += 1;
|
| 432 |
+
project.session_writes += 1;
|
| 433 |
+
}
|
| 434 |
+
_ => {}
|
| 435 |
+
}
|
| 436 |
+
}
|
| 437 |
+
project.last_accessed = now;
|
| 438 |
+
self.update_project(&project)?;
|
| 439 |
+
}
|
| 440 |
+
|
| 441 |
+
// Update resource usage
|
| 442 |
+
if allowed {
|
| 443 |
+
self.update_resources(project_path, access_type, file_size)?;
|
| 444 |
+
}
|
| 445 |
+
|
| 446 |
+
Ok(())
|
| 447 |
+
}
|
| 448 |
+
|
| 449 |
+
/// Get recent access log for a project
|
| 450 |
+
pub fn get_access_log(&self, project_path: &str, limit: usize) -> Result<Vec<FileAccess>> {
|
| 451 |
+
let rtxn = self.env.read_txn()?;
|
| 452 |
+
let iter = self.access_log.rev_iter(&rtxn)?;
|
| 453 |
+
|
| 454 |
+
let mut log = Vec::new();
|
| 455 |
+
for result in iter {
|
| 456 |
+
let (_, access) = result?;
|
| 457 |
+
if access.project == project_path {
|
| 458 |
+
log.push(access);
|
| 459 |
+
if log.len() >= limit {
|
| 460 |
+
break;
|
| 461 |
+
}
|
| 462 |
+
}
|
| 463 |
+
}
|
| 464 |
+
Ok(log)
|
| 465 |
+
}
|
| 466 |
+
|
| 467 |
+
/// Prune access log older than N seconds
|
| 468 |
+
pub fn prune_access_log(&self, max_age_secs: u64) -> Result<u64> {
|
| 469 |
+
let now = SystemTime::now()
|
| 470 |
+
.duration_since(UNIX_EPOCH)
|
| 471 |
+
.unwrap_or_default()
|
| 472 |
+
.as_secs();
|
| 473 |
+
let cutoff = now.saturating_sub(max_age_secs);
|
| 474 |
+
|
| 475 |
+
let rtxn = self.env.read_txn()?;
|
| 476 |
+
let iter = self.access_log.iter(&rtxn)?;
|
| 477 |
+
|
| 478 |
+
let mut to_delete = Vec::new();
|
| 479 |
+
for result in iter {
|
| 480 |
+
let (key, access) = result?;
|
| 481 |
+
if access.timestamp < cutoff {
|
| 482 |
+
to_delete.push(key.to_string());
|
| 483 |
+
}
|
| 484 |
+
}
|
| 485 |
+
drop(rtxn);
|
| 486 |
+
|
| 487 |
+
let count = to_delete.len() as u64;
|
| 488 |
+
let mut wtxn = self.env.write_txn()?;
|
| 489 |
+
for key in to_delete {
|
| 490 |
+
self.access_log.delete(&mut wtxn, &key)?;
|
| 491 |
+
}
|
| 492 |
+
wtxn.commit()?;
|
| 493 |
+
|
| 494 |
+
Ok(count)
|
| 495 |
+
}
|
| 496 |
+
|
| 497 |
+
// ========================================================================
|
| 498 |
+
// RESOURCE TRACKING
|
| 499 |
+
// ========================================================================
|
| 500 |
+
|
| 501 |
+
fn update_resources(&self, project_path: &str, access_type: &str, size: u64) -> Result<()> {
|
| 502 |
+
let rtxn = self.env.read_txn()?;
|
| 503 |
+
let mut usage = self.resources.get(&rtxn, project_path)?
|
| 504 |
+
.unwrap_or_default();
|
| 505 |
+
drop(rtxn);
|
| 506 |
+
|
| 507 |
+
match access_type {
|
| 508 |
+
"read" => usage.bytes_read += size,
|
| 509 |
+
"write" => {
|
| 510 |
+
usage.bytes_written += size;
|
| 511 |
+
usage.files_created += 1;
|
| 512 |
+
}
|
| 513 |
+
"edit" => usage.bytes_written += size,
|
| 514 |
+
"delete" => usage.files_deleted += 1,
|
| 515 |
+
"bash" => usage.bash_commands += 1,
|
| 516 |
+
"web" => usage.web_requests += 1,
|
| 517 |
+
_ => {}
|
| 518 |
+
}
|
| 519 |
+
|
| 520 |
+
let mut wtxn = self.env.write_txn()?;
|
| 521 |
+
self.resources.put(&mut wtxn, project_path, &usage)?;
|
| 522 |
+
wtxn.commit()?;
|
| 523 |
+
Ok(())
|
| 524 |
+
}
|
| 525 |
+
|
| 526 |
+
/// Get resource usage for a project
|
| 527 |
+
pub fn get_resources(&self, project_path: &str) -> Result<ResourceUsage> {
|
| 528 |
+
let rtxn = self.env.read_txn()?;
|
| 529 |
+
Ok(self.resources.get(&rtxn, project_path)?.unwrap_or_default())
|
| 530 |
+
}
|
| 531 |
+
|
| 532 |
+
/// Reset session counters (call at session start)
|
| 533 |
+
pub fn reset_session_counters(&self) -> Result<()> {
|
| 534 |
+
let projects = self.list_projects()?;
|
| 535 |
+
for mut project in projects {
|
| 536 |
+
project.session_writes = 0;
|
| 537 |
+
self.update_project(&project)?;
|
| 538 |
+
}
|
| 539 |
+
Ok(())
|
| 540 |
+
}
|
| 541 |
+
|
| 542 |
+
// ========================================================================
|
| 543 |
+
// VALIDATION
|
| 544 |
+
// ========================================================================
|
| 545 |
+
|
| 546 |
+
/// Validate a file operation against project rules
|
| 547 |
+
pub fn validate_operation(
|
| 548 |
+
&self,
|
| 549 |
+
file_path: &str,
|
| 550 |
+
operation: &str,
|
| 551 |
+
size: u64,
|
| 552 |
+
) -> Result<(bool, Option<String>)> {
|
| 553 |
+
// Find containing project
|
| 554 |
+
let project = match self.find_project_for_path(file_path)? {
|
| 555 |
+
Some(s) => s,
|
| 556 |
+
None => return Ok((true, None)), // No project = allowed
|
| 557 |
+
};
|
| 558 |
+
|
| 559 |
+
// Check if project is active (if required)
|
| 560 |
+
if project.requires_activation && !project.is_active {
|
| 561 |
+
return Ok((false, Some(format!(
|
| 562 |
+
"Project '{}' requires activation before file operations",
|
| 563 |
+
project.name
|
| 564 |
+
))));
|
| 565 |
+
}
|
| 566 |
+
|
| 567 |
+
// Check trust level for write operations
|
| 568 |
+
if matches!(operation, "write" | "edit" | "delete") {
|
| 569 |
+
if project.trust_level == TrustLevel::Untrusted {
|
| 570 |
+
return Ok((false, Some("Untrusted project: write operations denied".to_string())));
|
| 571 |
+
}
|
| 572 |
+
|
| 573 |
+
// Check protected paths
|
| 574 |
+
if self.is_path_protected(&project.path, file_path)? {
|
| 575 |
+
return Ok((false, Some(format!(
|
| 576 |
+
"Path is protected in project '{}'",
|
| 577 |
+
project.name
|
| 578 |
+
))));
|
| 579 |
+
}
|
| 580 |
+
|
| 581 |
+
// Check write size limit
|
| 582 |
+
if size > project.max_write_size as u64 {
|
| 583 |
+
return Ok((false, Some(format!(
|
| 584 |
+
"File size {} exceeds project limit {}",
|
| 585 |
+
size, project.max_write_size
|
| 586 |
+
))));
|
| 587 |
+
}
|
| 588 |
+
|
| 589 |
+
// Check session write limit
|
| 590 |
+
if project.session_writes >= project.max_writes_per_session {
|
| 591 |
+
return Ok((false, Some(format!(
|
| 592 |
+
"Session write limit ({}) reached for project '{}'",
|
| 593 |
+
project.max_writes_per_session, project.name
|
| 594 |
+
))));
|
| 595 |
+
}
|
| 596 |
+
}
|
| 597 |
+
|
| 598 |
+
Ok((true, None))
|
| 599 |
+
}
|
| 600 |
+
|
| 601 |
+
/// Get database stats
|
| 602 |
+
pub fn db_stats(&self) -> Result<(u64, u64, u64)> {
|
| 603 |
+
let rtxn = self.env.read_txn()?;
|
| 604 |
+
let projects_stat = self.projects.stat(&rtxn)?;
|
| 605 |
+
let access_stat = self.access_log.stat(&rtxn)?;
|
| 606 |
+
let resources_stat = self.resources.stat(&rtxn)?;
|
| 607 |
+
Ok((projects_stat.entries as u64, access_stat.entries as u64, resources_stat.entries as u64))
|
| 608 |
+
}
|
| 609 |
+
}
|
SPFsmartGATE/src/train.rs
ADDED
|
@@ -0,0 +1,1064 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// SPF Smart Gateway - Training Engine (Block L)
|
| 2 |
+
// Copyright 2026 Joseph Stone - All Rights Reserved
|
| 3 |
+
//
|
| 4 |
+
// Backward passes for all transformer layers + AdamW optimizer.
|
| 5 |
+
// Enables learning from gate decisions and user feedback.
|
| 6 |
+
// Pure Rust — builds on tensor.rs, attention.rs, ffn.rs.
|
| 7 |
+
//
|
| 8 |
+
// Depends on: tensor.rs (Layer 0), attention.rs, ffn.rs (Layer 1)
|
| 9 |
+
//
|
| 10 |
+
// Research basis: CLONE_RESEARCH_FINDINGS.txt
|
| 11 |
+
// - Attention backprop: 5-step (dV, dP, dS via softmax Jacobian, dQ, dK)
|
| 12 |
+
// - AdamW: Loshchilov & Hutter 2017 (decoupled weight decay)
|
| 13 |
+
// - LayerNorm backward: Karpathy llm.c simplified form
|
| 14 |
+
// - Train-on-copy: neural-redis pattern (no inference blocking)
|
| 15 |
+
|
| 16 |
+
use crate::tensor::Tensor;
|
| 17 |
+
|
| 18 |
+
// ============================================================================
|
| 19 |
+
// LOSS FUNCTIONS
|
| 20 |
+
// ============================================================================
|
| 21 |
+
|
| 22 |
+
/// Cross-entropy loss for next-token prediction
|
| 23 |
+
/// logits: [batch, vocab_size] (raw, pre-softmax)
|
| 24 |
+
/// targets: [batch] (token indices)
|
| 25 |
+
/// Returns: (scalar loss, d_logits gradient)
|
| 26 |
+
pub fn cross_entropy_loss(logits: &Tensor, targets: &[usize]) -> Result<(f32, Tensor), String> {
|
| 27 |
+
if logits.ndim() != 2 {
|
| 28 |
+
return Err(format!("cross_entropy expects 2D logits, got {}D", logits.ndim()));
|
| 29 |
+
}
|
| 30 |
+
let batch = logits.shape[0];
|
| 31 |
+
let vocab = logits.shape[1];
|
| 32 |
+
|
| 33 |
+
if targets.len() != batch {
|
| 34 |
+
return Err(format!("Target count {} != batch size {}", targets.len(), batch));
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
// Softmax the logits
|
| 38 |
+
let probs = logits.softmax()?;
|
| 39 |
+
let mut total_loss = 0.0f32;
|
| 40 |
+
let mut grad = probs.data.clone();
|
| 41 |
+
|
| 42 |
+
for b in 0..batch {
|
| 43 |
+
let target_idx = targets[b];
|
| 44 |
+
if target_idx >= vocab {
|
| 45 |
+
return Err(format!("Target index {} >= vocab size {}", target_idx, vocab));
|
| 46 |
+
}
|
| 47 |
+
let p = probs.data[b * vocab + target_idx].max(1e-10);
|
| 48 |
+
total_loss -= p.ln();
|
| 49 |
+
|
| 50 |
+
// Gradient of cross-entropy w.r.t. logits = softmax(logits) - one_hot(target)
|
| 51 |
+
grad[b * vocab + target_idx] -= 1.0;
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
// Average over batch
|
| 55 |
+
let loss = total_loss / batch as f32;
|
| 56 |
+
let scale = 1.0 / batch as f32;
|
| 57 |
+
let grad_data: Vec<f32> = grad.iter().map(|&g| g * scale).collect();
|
| 58 |
+
let d_logits = Tensor::from_data(grad_data, vec![batch, vocab])?;
|
| 59 |
+
|
| 60 |
+
Ok((loss, d_logits))
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
/// Binary cross-entropy loss for gate decisions
|
| 64 |
+
/// predictions: [batch] (sigmoid output, 0..1)
|
| 65 |
+
/// labels: [batch] (0.0 = block, 1.0 = allow; clamped internally)
|
| 66 |
+
/// weights: [batch] (per-example weight from TrainingSignal.weight())
|
| 67 |
+
/// 1.0 = regular, 2.0 = user override, 4.0 = FP, 6-8x = repeat FP
|
| 68 |
+
/// Returns: (scalar loss, d_predictions gradient)
|
| 69 |
+
pub fn binary_ce_loss(
|
| 70 |
+
predictions: &Tensor,
|
| 71 |
+
labels: &[f32],
|
| 72 |
+
weights: &[f32],
|
| 73 |
+
) -> Result<(f32, Tensor), String> {
|
| 74 |
+
let batch = predictions.numel();
|
| 75 |
+
if labels.len() != batch || weights.len() != batch {
|
| 76 |
+
return Err(format!(
|
| 77 |
+
"Size mismatch: predictions={}, labels={}, weights={}",
|
| 78 |
+
batch, labels.len(), weights.len()
|
| 79 |
+
));
|
| 80 |
+
}
|
| 81 |
+
|
| 82 |
+
let mut total_loss = 0.0f32;
|
| 83 |
+
let mut grad = vec![0.0f32; batch];
|
| 84 |
+
|
| 85 |
+
for i in 0..batch {
|
| 86 |
+
let p = predictions.data[i].clamp(1e-7, 1.0 - 1e-7);
|
| 87 |
+
let y = labels[i].clamp(0.0, 1.0); // clamp label to valid BCE range
|
| 88 |
+
let w = weights[i]; // explicit weight — NOT inferred from label
|
| 89 |
+
|
| 90 |
+
total_loss -= w * (y * p.ln() + (1.0 - y) * (1.0 - p).ln());
|
| 91 |
+
grad[i] = w * (p - y) / (p * (1.0 - p));
|
| 92 |
+
}
|
| 93 |
+
|
| 94 |
+
let loss = total_loss / batch as f32;
|
| 95 |
+
let scale = 1.0 / batch as f32;
|
| 96 |
+
let grad_data: Vec<f32> = grad.iter().map(|&g| g * scale).collect();
|
| 97 |
+
let d_pred = Tensor::from_data(grad_data, predictions.shape.clone())?;
|
| 98 |
+
|
| 99 |
+
Ok((loss, d_pred))
|
| 100 |
+
}
|
| 101 |
+
|
| 102 |
+
// ============================================================================
|
| 103 |
+
// BACKWARD PASSES
|
| 104 |
+
// ============================================================================
|
| 105 |
+
|
| 106 |
+
/// Attention backward pass (5-step from research findings)
|
| 107 |
+
///
|
| 108 |
+
/// Given forward: S = QK^T/√d, P = softmax(S), O = PV
|
| 109 |
+
/// Returns gradients for Q, K, V projection inputs
|
| 110 |
+
///
|
| 111 |
+
/// d_output: [seq_len, d_head] — gradient from upstream
|
| 112 |
+
/// q, k, v: [seq_len, d_head] — saved from forward pass
|
| 113 |
+
/// attn_weights: [seq_len, seq_len] — P = softmax(S), saved from forward
|
| 114 |
+
pub fn attention_backward(
|
| 115 |
+
d_output: &Tensor,
|
| 116 |
+
q: &Tensor,
|
| 117 |
+
k: &Tensor,
|
| 118 |
+
v: &Tensor,
|
| 119 |
+
attn_weights: &Tensor,
|
| 120 |
+
scale: f32,
|
| 121 |
+
) -> Result<(Tensor, Tensor, Tensor), String> {
|
| 122 |
+
// Step 1: dV = P^T . dO [d_head, seq] . [seq, d_head] won't work
|
| 123 |
+
// Actually: dV = P^T . dO where P is [seq, seq], dO is [seq, d_head]
|
| 124 |
+
// So dV = P^T[seq,seq] . dO[seq,d_head] = [seq, d_head] ✓
|
| 125 |
+
let p_t = attn_weights.transpose_2d()?;
|
| 126 |
+
let dv = p_t.matmul(d_output)?;
|
| 127 |
+
|
| 128 |
+
// Step 2: dP = dO . V^T [seq, d_head] . [d_head, seq] = [seq, seq]
|
| 129 |
+
let v_t = v.transpose_2d()?;
|
| 130 |
+
let dp = d_output.matmul(&v_t)?;
|
| 131 |
+
|
| 132 |
+
// Step 3: dS = softmax_backward(P, dP)
|
| 133 |
+
// Per-row: dS_row = P_row * (dP_row - dot(P_row, dP_row))
|
| 134 |
+
// This is the efficient O(N) form, not the O(N^2) Jacobian
|
| 135 |
+
let seq_len = attn_weights.shape[0];
|
| 136 |
+
let mut ds_data = vec![0.0f32; seq_len * seq_len];
|
| 137 |
+
for i in 0..seq_len {
|
| 138 |
+
let p_offset = i * seq_len;
|
| 139 |
+
let dp_offset = i * seq_len;
|
| 140 |
+
|
| 141 |
+
// dot(P_row, dP_row)
|
| 142 |
+
let mut dot = 0.0f32;
|
| 143 |
+
for j in 0..seq_len {
|
| 144 |
+
dot += attn_weights.data[p_offset + j] * dp.data[dp_offset + j];
|
| 145 |
+
}
|
| 146 |
+
|
| 147 |
+
// dS[i,j] = P[i,j] * (dP[i,j] - dot)
|
| 148 |
+
for j in 0..seq_len {
|
| 149 |
+
ds_data[p_offset + j] = attn_weights.data[p_offset + j]
|
| 150 |
+
* (dp.data[dp_offset + j] - dot);
|
| 151 |
+
}
|
| 152 |
+
}
|
| 153 |
+
let ds = Tensor::from_data(ds_data, vec![seq_len, seq_len])?;
|
| 154 |
+
|
| 155 |
+
// Apply attention scale to dS (chain rule through S = QK^T * scale)
|
| 156 |
+
let ds_scaled = ds.scale(scale);
|
| 157 |
+
|
| 158 |
+
// Step 4: dQ = dS . K [seq, seq] . [seq, d_head] = [seq, d_head]
|
| 159 |
+
let dq = ds_scaled.matmul(k)?;
|
| 160 |
+
|
| 161 |
+
// Step 5: dK = dS^T . Q [seq, seq] . [seq, d_head] = [seq, d_head]
|
| 162 |
+
let ds_t = ds_scaled.transpose_2d()?;
|
| 163 |
+
let dk = ds_t.matmul(q)?;
|
| 164 |
+
|
| 165 |
+
Ok((dq, dk, dv))
|
| 166 |
+
}
|
| 167 |
+
|
| 168 |
+
/// Linear layer backward: y = x @ W^T + b
|
| 169 |
+
/// Returns: (d_weight, d_bias, d_input)
|
| 170 |
+
///
|
| 171 |
+
/// d_output: [batch, out_features]
|
| 172 |
+
/// input: [batch, in_features] — saved from forward
|
| 173 |
+
/// weight: [out_features, in_features]
|
| 174 |
+
pub fn linear_backward(
|
| 175 |
+
d_output: &Tensor,
|
| 176 |
+
input: &Tensor,
|
| 177 |
+
weight: &Tensor,
|
| 178 |
+
) -> Result<(Tensor, Tensor, Tensor), String> {
|
| 179 |
+
let batch = d_output.shape[0];
|
| 180 |
+
let out_f = d_output.shape[1];
|
| 181 |
+
let in_f = input.shape[1];
|
| 182 |
+
debug_assert_eq!(in_f, weight.shape[1], "linear_backward: input features != weight cols");
|
| 183 |
+
|
| 184 |
+
// d_weight = d_output^T . input [out, batch] . [batch, in] = [out, in]
|
| 185 |
+
let d_out_t = d_output.transpose_2d()?;
|
| 186 |
+
let d_weight = d_out_t.matmul(input)?;
|
| 187 |
+
|
| 188 |
+
// d_bias = sum(d_output, axis=0) [out_features]
|
| 189 |
+
let mut d_bias_data = vec![0.0f32; out_f];
|
| 190 |
+
for b in 0..batch {
|
| 191 |
+
for j in 0..out_f {
|
| 192 |
+
d_bias_data[j] += d_output.data[b * out_f + j];
|
| 193 |
+
}
|
| 194 |
+
}
|
| 195 |
+
let d_bias = Tensor::from_data(d_bias_data, vec![out_f])?;
|
| 196 |
+
|
| 197 |
+
// d_input = d_output . weight [batch, out] . [out, in] = [batch, in]
|
| 198 |
+
let d_input = d_output.matmul(weight)?;
|
| 199 |
+
|
| 200 |
+
Ok((d_weight, d_bias, d_input))
|
| 201 |
+
}
|
| 202 |
+
|
| 203 |
+
/// FFN backward pass
|
| 204 |
+
/// d_output: [batch, d_model]
|
| 205 |
+
/// input: [batch, d_model] — saved from forward
|
| 206 |
+
/// hidden: [batch, d_ff] — pre-activation hidden state saved from forward
|
| 207 |
+
/// w1: [d_ff, d_model], w2: [d_model, d_ff]
|
| 208 |
+
///
|
| 209 |
+
/// Returns: (dw1, db1, dw2, db2, d_input)
|
| 210 |
+
pub fn ffn_backward(
|
| 211 |
+
d_output: &Tensor,
|
| 212 |
+
input: &Tensor,
|
| 213 |
+
hidden_pre_gelu: &Tensor,
|
| 214 |
+
w1: &Tensor,
|
| 215 |
+
w2: &Tensor,
|
| 216 |
+
) -> Result<(Tensor, Tensor, Tensor, Tensor, Tensor), String> {
|
| 217 |
+
// Backward through second linear: y2 = gelu(h) @ w2^T + b2
|
| 218 |
+
let gelu_out = hidden_pre_gelu.gelu(); // recompute gelu output
|
| 219 |
+
let (dw2, db2, d_gelu) = linear_backward(d_output, &gelu_out, w2)?;
|
| 220 |
+
|
| 221 |
+
// Backward through GELU activation
|
| 222 |
+
let d_hidden = gelu_backward(&d_gelu, hidden_pre_gelu);
|
| 223 |
+
|
| 224 |
+
// Backward through first linear: h = x @ w1^T + b1
|
| 225 |
+
let (dw1, db1, d_input) = linear_backward(&d_hidden, input, w1)?;
|
| 226 |
+
|
| 227 |
+
Ok((dw1, db1, dw2, db2, d_input))
|
| 228 |
+
}
|
| 229 |
+
|
| 230 |
+
/// GELU backward: d/dx[GELU(x)] = GELU'(x)
|
| 231 |
+
/// GELU(x) = 0.5x(1 + tanh(√(2/π)(x + 0.044715x³)))
|
| 232 |
+
/// Derivative computed numerically-stable via chain rule
|
| 233 |
+
fn gelu_backward(d_output: &Tensor, input: &Tensor) -> Tensor {
|
| 234 |
+
let sqrt_2_over_pi = (2.0_f32 / std::f32::consts::PI).sqrt();
|
| 235 |
+
let data: Vec<f32> = d_output.data.iter().zip(&input.data).map(|(&dy, &x)| {
|
| 236 |
+
let cube = 0.044715 * x * x * x;
|
| 237 |
+
let inner = sqrt_2_over_pi * (x + cube);
|
| 238 |
+
let tanh_val = inner.tanh();
|
| 239 |
+
let sech2 = 1.0 - tanh_val * tanh_val;
|
| 240 |
+
let d_inner = sqrt_2_over_pi * (1.0 + 3.0 * 0.044715 * x * x);
|
| 241 |
+
// d/dx GELU = 0.5 * (1 + tanh) + 0.5 * x * sech² * d_inner
|
| 242 |
+
let gelu_grad = 0.5 * (1.0 + tanh_val) + 0.5 * x * sech2 * d_inner;
|
| 243 |
+
dy * gelu_grad
|
| 244 |
+
}).collect();
|
| 245 |
+
Tensor { data, shape: input.shape.clone() }
|
| 246 |
+
}
|
| 247 |
+
|
| 248 |
+
/// Layer normalization backward (Karpathy simplified form)
|
| 249 |
+
///
|
| 250 |
+
/// d_output: [batch, dim]
|
| 251 |
+
/// input: [batch, dim] — saved from forward
|
| 252 |
+
/// gamma: [dim] — scale parameter
|
| 253 |
+
/// eps: f32
|
| 254 |
+
///
|
| 255 |
+
/// Returns: (d_gamma, d_beta, d_input)
|
| 256 |
+
pub fn layer_norm_backward(
|
| 257 |
+
d_output: &Tensor,
|
| 258 |
+
input: &Tensor,
|
| 259 |
+
gamma: &Tensor,
|
| 260 |
+
eps: f32,
|
| 261 |
+
) -> Result<(Tensor, Tensor, Tensor), String> {
|
| 262 |
+
let batch = d_output.shape[0];
|
| 263 |
+
let dim = d_output.shape[1];
|
| 264 |
+
|
| 265 |
+
let mut d_gamma_data = vec![0.0f32; dim];
|
| 266 |
+
let mut d_beta_data = vec![0.0f32; dim];
|
| 267 |
+
let mut d_input_data = vec![0.0f32; batch * dim];
|
| 268 |
+
|
| 269 |
+
for b in 0..batch {
|
| 270 |
+
let offset = b * dim;
|
| 271 |
+
let x_slice = &input.data[offset..offset + dim];
|
| 272 |
+
|
| 273 |
+
// Compute mean and variance for this row
|
| 274 |
+
let mean: f32 = x_slice.iter().sum::<f32>() / dim as f32;
|
| 275 |
+
let var: f32 = x_slice.iter().map(|&x| (x - mean) * (x - mean)).sum::<f32>() / dim as f32;
|
| 276 |
+
let inv_std = 1.0 / (var + eps).sqrt();
|
| 277 |
+
|
| 278 |
+
// x_hat = (x - mean) * inv_std
|
| 279 |
+
let x_hat: Vec<f32> = x_slice.iter().map(|&x| (x - mean) * inv_std).collect();
|
| 280 |
+
|
| 281 |
+
// d_beta += d_output[b]
|
| 282 |
+
// d_gamma += d_output[b] * x_hat
|
| 283 |
+
for i in 0..dim {
|
| 284 |
+
let dy = d_output.data[offset + i];
|
| 285 |
+
d_beta_data[i] += dy;
|
| 286 |
+
d_gamma_data[i] += dy * x_hat[i];
|
| 287 |
+
}
|
| 288 |
+
|
| 289 |
+
// Karpathy simplified dx:
|
| 290 |
+
// dx = inv_std/N * (N*dy*gamma - sum(dy*gamma) - x_hat*sum(dy*gamma*x_hat))
|
| 291 |
+
let n = dim as f32;
|
| 292 |
+
let mut sum_dy_gamma = 0.0f32;
|
| 293 |
+
let mut sum_dy_gamma_xhat = 0.0f32;
|
| 294 |
+
for i in 0..dim {
|
| 295 |
+
let dy_g = d_output.data[offset + i] * gamma.data[i];
|
| 296 |
+
sum_dy_gamma += dy_g;
|
| 297 |
+
sum_dy_gamma_xhat += dy_g * x_hat[i];
|
| 298 |
+
}
|
| 299 |
+
|
| 300 |
+
for i in 0..dim {
|
| 301 |
+
let dy_g = d_output.data[offset + i] * gamma.data[i];
|
| 302 |
+
d_input_data[offset + i] = inv_std / n
|
| 303 |
+
* (n * dy_g - sum_dy_gamma - x_hat[i] * sum_dy_gamma_xhat);
|
| 304 |
+
}
|
| 305 |
+
}
|
| 306 |
+
|
| 307 |
+
let d_gamma = Tensor::from_data(d_gamma_data, vec![dim])?;
|
| 308 |
+
let d_beta = Tensor::from_data(d_beta_data, vec![dim])?;
|
| 309 |
+
let d_input = Tensor::from_data(d_input_data, vec![batch, dim])?;
|
| 310 |
+
|
| 311 |
+
Ok((d_gamma, d_beta, d_input))
|
| 312 |
+
}
|
| 313 |
+
|
| 314 |
+
/// Embedding backward: scatter gradients to embedding rows
|
| 315 |
+
/// d_output: [batch, d_model]
|
| 316 |
+
/// indices: [batch] — token indices used in forward
|
| 317 |
+
/// vocab_size: total vocabulary size
|
| 318 |
+
///
|
| 319 |
+
/// Returns: d_embedding [vocab_size, d_model] (sparse — most rows zero)
|
| 320 |
+
pub fn embedding_backward(
|
| 321 |
+
d_output: &Tensor,
|
| 322 |
+
indices: &[usize],
|
| 323 |
+
vocab_size: usize,
|
| 324 |
+
) -> Result<Tensor, String> {
|
| 325 |
+
let batch = d_output.shape[0];
|
| 326 |
+
let d_model = d_output.shape[1];
|
| 327 |
+
|
| 328 |
+
let mut grad = vec![0.0f32; vocab_size * d_model];
|
| 329 |
+
|
| 330 |
+
for b in 0..batch {
|
| 331 |
+
let idx = indices[b];
|
| 332 |
+
if idx >= vocab_size {
|
| 333 |
+
return Err(format!("Index {} >= vocab_size {}", idx, vocab_size));
|
| 334 |
+
}
|
| 335 |
+
for d in 0..d_model {
|
| 336 |
+
grad[idx * d_model + d] += d_output.data[b * d_model + d];
|
| 337 |
+
}
|
| 338 |
+
}
|
| 339 |
+
|
| 340 |
+
Tensor::from_data(grad, vec![vocab_size, d_model])
|
| 341 |
+
}
|
| 342 |
+
|
| 343 |
+
// ============================================================================
|
| 344 |
+
// COMPOSED BACKWARD PASS (P2-D)
|
| 345 |
+
// ============================================================================
|
| 346 |
+
|
| 347 |
+
/// Composed backward pass for the full SPFTransformer (causal/decoder-only mode).
|
| 348 |
+
///
|
| 349 |
+
/// Given d_logits from loss function and cached forward activations,
|
| 350 |
+
/// computes gradients for ALL model weights in the same order as
|
| 351 |
+
/// SPFTransformer::weights() returns them:
|
| 352 |
+
/// [0] token_embedding gradient
|
| 353 |
+
/// [1..N] encoder weight gradients
|
| 354 |
+
/// [N+1..M] decoder weight gradients
|
| 355 |
+
/// [M+1] output_projection gradient
|
| 356 |
+
/// [M+2] output_bias gradient
|
| 357 |
+
pub fn model_backward_causal(
|
| 358 |
+
d_logits: &Tensor,
|
| 359 |
+
cache: &crate::transformer::ForwardCache,
|
| 360 |
+
model: &crate::transformer::SPFTransformer,
|
| 361 |
+
) -> Result<Vec<Tensor>, String> {
|
| 362 |
+
let batch = d_logits.shape[0];
|
| 363 |
+
let seq = d_logits.shape[1];
|
| 364 |
+
let vocab = d_logits.shape[2];
|
| 365 |
+
let d_model = model.config.d_model;
|
| 366 |
+
|
| 367 |
+
// 1. Backward through output projection: logits = dec_out @ proj^T + bias
|
| 368 |
+
let d_logits_2d = d_logits.reshape(&[batch * seq, vocab])?;
|
| 369 |
+
let dec_out_2d = cache.decoder_output.reshape(&[batch * seq, d_model])?;
|
| 370 |
+
let (d_output_proj, d_output_bias, d_dec_out) = linear_backward(
|
| 371 |
+
&d_logits_2d, &dec_out_2d, &model.output_projection,
|
| 372 |
+
)?;
|
| 373 |
+
|
| 374 |
+
// Reshape d_dec_out back to [batch, seq, d_model] for layer processing
|
| 375 |
+
let mut d_x = d_dec_out.reshape(&[batch, seq, d_model])?;
|
| 376 |
+
|
| 377 |
+
// 2. Backward through final decoder layer norm
|
| 378 |
+
let d_x_2d = d_x.reshape(&[batch * seq, d_model])?;
|
| 379 |
+
// Final LN input is the last layer's output (before final LN)
|
| 380 |
+
// We need the pre-LN state — approximate with d_x directly through LN backward
|
| 381 |
+
let (d_final_ln_gamma, d_final_ln_beta, d_x_pre_ln) = layer_norm_backward(
|
| 382 |
+
&d_x_2d,
|
| 383 |
+
&cache.decoder_output.reshape(&[batch * seq, d_model])?,
|
| 384 |
+
&model.decoder.final_ln_gamma,
|
| 385 |
+
model.config.ln_eps,
|
| 386 |
+
)?;
|
| 387 |
+
d_x = d_x_pre_ln.reshape(&[batch, seq, d_model])?;
|
| 388 |
+
|
| 389 |
+
// 3. Backward through decoder layers (reverse order)
|
| 390 |
+
let mut decoder_grads: Vec<Vec<Tensor>> = Vec::new();
|
| 391 |
+
for (layer_idx, layer) in model.decoder.layers.iter().enumerate().rev() {
|
| 392 |
+
let layer_cache = &cache.decoder_caches[layer_idx];
|
| 393 |
+
|
| 394 |
+
// FFN backward: normed → ffn → residual
|
| 395 |
+
let d_x_2d = d_x.reshape(&[batch * seq, d_model])?;
|
| 396 |
+
let (d_ln3_gamma, d_ln3_beta, d_ln3_input) = layer_norm_backward(
|
| 397 |
+
&d_x_2d, &layer_cache.ln3_input.reshape(&[batch * seq, d_model])?,
|
| 398 |
+
&layer.ln3_gamma, layer.ln_eps,
|
| 399 |
+
)?;
|
| 400 |
+
let (dw1, db1, dw2, db2, d_ffn_in) = ffn_backward(
|
| 401 |
+
&d_ln3_input, &layer_cache.ffn_cache.input,
|
| 402 |
+
&layer_cache.ffn_cache.hidden_pre_gelu,
|
| 403 |
+
&layer.ffn.w1, &layer.ffn.w2,
|
| 404 |
+
)?;
|
| 405 |
+
// Residual: d_x += d_ffn_in (reshaped)
|
| 406 |
+
let d_ffn_3d = d_ffn_in.reshape(&[batch, seq, d_model])?;
|
| 407 |
+
d_x = d_x.add(&d_ffn_3d)?;
|
| 408 |
+
|
| 409 |
+
// Self-attention backward: normed → attn → residual
|
| 410 |
+
let d_x_2d = d_x.reshape(&[batch * seq, d_model])?;
|
| 411 |
+
let (d_ln1_gamma, d_ln1_beta, d_ln1_input) = layer_norm_backward(
|
| 412 |
+
&d_x_2d, &layer_cache.ln1_input.reshape(&[batch * seq, d_model])?,
|
| 413 |
+
&layer.ln1_gamma, layer.ln_eps,
|
| 414 |
+
)?;
|
| 415 |
+
|
| 416 |
+
// Attention backward per head — collect weight gradients
|
| 417 |
+
let n_heads = layer.self_attn.config.n_heads;
|
| 418 |
+
let d_head = layer.self_attn.config.d_head();
|
| 419 |
+
let acache = &layer_cache.self_attn_cache;
|
| 420 |
+
|
| 421 |
+
let mut dq_all = vec![0.0f32; batch * seq * d_model];
|
| 422 |
+
let mut dk_all = vec![0.0f32; batch * seq * d_model];
|
| 423 |
+
let mut dv_all = vec![0.0f32; batch * seq * d_model];
|
| 424 |
+
|
| 425 |
+
for b in 0..batch {
|
| 426 |
+
for h in 0..n_heads {
|
| 427 |
+
let bh = b * n_heads + h;
|
| 428 |
+
let q_off = bh * seq * d_head;
|
| 429 |
+
let w_off = bh * seq * seq;
|
| 430 |
+
|
| 431 |
+
// Extract per-head gradient from d_ln1_input into d_head_out
|
| 432 |
+
let mut d_head_out = Tensor::zeros(&[seq, d_head]);
|
| 433 |
+
for s in 0..seq {
|
| 434 |
+
for dd in 0..d_head {
|
| 435 |
+
d_head_out.data[s * d_head + dd] = d_ln1_input.data[(b * seq + s) * d_model + h * d_head + dd];
|
| 436 |
+
}
|
| 437 |
+
}
|
| 438 |
+
|
| 439 |
+
// Accumulate Q,K,V grads from attention_backward
|
| 440 |
+
let q_slice = Tensor::from_data(
|
| 441 |
+
acache.q.data[q_off..q_off + seq * d_head].to_vec(), vec![seq, d_head])?;
|
| 442 |
+
let k_slice = Tensor::from_data(
|
| 443 |
+
acache.k.data[q_off..q_off + seq * d_head].to_vec(), vec![seq, d_head])?;
|
| 444 |
+
let v_slice = Tensor::from_data(
|
| 445 |
+
acache.v.data[q_off..q_off + seq * d_head].to_vec(), vec![seq, d_head])?;
|
| 446 |
+
let w_slice = Tensor::from_data(
|
| 447 |
+
acache.attn_weights.data[w_off..w_off + seq * seq].to_vec(), vec![seq, seq])?;
|
| 448 |
+
|
| 449 |
+
let (dq, dk, dv) = attention_backward(
|
| 450 |
+
&d_head_out, &q_slice, &k_slice, &v_slice, &w_slice, acache.scale,
|
| 451 |
+
)?;
|
| 452 |
+
|
| 453 |
+
// Scatter back to full [batch, seq, d_model]
|
| 454 |
+
for s in 0..seq {
|
| 455 |
+
for dd in 0..d_head {
|
| 456 |
+
let idx = (b * seq + s) * d_model + h * d_head + dd;
|
| 457 |
+
dq_all[idx] += dq.data[s * d_head + dd];
|
| 458 |
+
dk_all[idx] += dk.data[s * d_head + dd];
|
| 459 |
+
dv_all[idx] += dv.data[s * d_head + dd];
|
| 460 |
+
}
|
| 461 |
+
}
|
| 462 |
+
}
|
| 463 |
+
}
|
| 464 |
+
|
| 465 |
+
// Compute projection weight gradients via linear_backward
|
| 466 |
+
let dq_t = Tensor::from_data(dq_all, vec![batch * seq, d_model])?;
|
| 467 |
+
let dk_t = Tensor::from_data(dk_all, vec![batch * seq, d_model])?;
|
| 468 |
+
let dv_t = Tensor::from_data(dv_all, vec![batch * seq, d_model])?;
|
| 469 |
+
|
| 470 |
+
let (dw_q, db_q, _) = linear_backward(&dq_t, &acache.input, &layer.self_attn.w_q)?;
|
| 471 |
+
let (dw_k, db_k, _) = linear_backward(&dk_t, &acache.input, &layer.self_attn.w_k)?;
|
| 472 |
+
let (dw_v, db_v, _) = linear_backward(&dv_t, &acache.input, &layer.self_attn.w_v)?;
|
| 473 |
+
|
| 474 |
+
// Output projection gradient — attn_concat approximates concatenated heads (forward input to w_o)
|
| 475 |
+
let attn_concat = dq_t.clone();
|
| 476 |
+
let (dw_o, db_o, d_attn_in) = linear_backward(&d_ln1_input, &attn_concat, &layer.self_attn.w_o)?;
|
| 477 |
+
|
| 478 |
+
let d_attn_3d = d_attn_in.reshape(&[batch, seq, d_model])?;
|
| 479 |
+
d_x = d_x.add(&d_attn_3d)?;
|
| 480 |
+
|
| 481 |
+
// Collect layer gradients in weights() order:
|
| 482 |
+
// self_attn: [w_q, w_k, w_v, w_o, b_q, b_k, b_v, b_o]
|
| 483 |
+
// cross_attn: zeros (unused in causal mode)
|
| 484 |
+
// ffn: [w1, b1, w2, b2]
|
| 485 |
+
// LN: [ln1_g, ln1_b, ln2_g, ln2_b, ln3_g, ln3_b]
|
| 486 |
+
let cross_attn_zeros: Vec<Tensor> = layer.cross_attn.weights().iter()
|
| 487 |
+
.map(|w| Tensor::zeros(&w.shape))
|
| 488 |
+
.collect();
|
| 489 |
+
let ln2_gamma_zero = Tensor::zeros(&layer.ln2_gamma.shape);
|
| 490 |
+
let ln2_beta_zero = Tensor::zeros(&layer.ln2_beta.shape);
|
| 491 |
+
|
| 492 |
+
let mut layer_grads = vec![dw_q, dw_k, dw_v, dw_o, db_q, db_k, db_v, db_o];
|
| 493 |
+
layer_grads.extend(cross_attn_zeros);
|
| 494 |
+
layer_grads.extend(vec![dw1, db1, dw2, db2]);
|
| 495 |
+
layer_grads.extend(vec![d_ln1_gamma, d_ln1_beta, ln2_gamma_zero, ln2_beta_zero, d_ln3_gamma, d_ln3_beta]);
|
| 496 |
+
|
| 497 |
+
decoder_grads.push(layer_grads);
|
| 498 |
+
}
|
| 499 |
+
|
| 500 |
+
// Reverse decoder_grads (we processed in reverse order)
|
| 501 |
+
decoder_grads.reverse();
|
| 502 |
+
|
| 503 |
+
// 4. Backward through embedding
|
| 504 |
+
let indices: Vec<usize> = cache.token_indices.iter().map(|&id| id as usize).collect();
|
| 505 |
+
let d_x_2d = d_x.reshape(&[batch * seq, d_model])?;
|
| 506 |
+
let d_embedding = embedding_backward(&d_x_2d, &indices, model.config.vocab_size)?;
|
| 507 |
+
|
| 508 |
+
// 5. Assemble all gradients in weights() order:
|
| 509 |
+
// [token_embedding, encoder_weights..., decoder_weights..., output_projection, output_bias]
|
| 510 |
+
let mut all_grads: Vec<Tensor> = Vec::new();
|
| 511 |
+
|
| 512 |
+
// Token embedding gradient
|
| 513 |
+
all_grads.push(d_embedding);
|
| 514 |
+
|
| 515 |
+
// Encoder gradients (zeros — encoder unused in causal mode)
|
| 516 |
+
for w in model.encoder.weights() {
|
| 517 |
+
all_grads.push(Tensor::zeros(&w.shape));
|
| 518 |
+
}
|
| 519 |
+
|
| 520 |
+
// Decoder gradients
|
| 521 |
+
for layer_grads in decoder_grads {
|
| 522 |
+
all_grads.extend(layer_grads);
|
| 523 |
+
}
|
| 524 |
+
// Decoder final LN
|
| 525 |
+
all_grads.push(d_final_ln_gamma);
|
| 526 |
+
all_grads.push(d_final_ln_beta);
|
| 527 |
+
|
| 528 |
+
// Output projection + bias
|
| 529 |
+
all_grads.push(d_output_proj);
|
| 530 |
+
all_grads.push(d_output_bias);
|
| 531 |
+
|
| 532 |
+
// Verify gradient count matches weight count
|
| 533 |
+
let weight_count = model.weights().len();
|
| 534 |
+
if all_grads.len() != weight_count {
|
| 535 |
+
return Err(format!(
|
| 536 |
+
"Gradient count {} != weight count {}. Alignment error.",
|
| 537 |
+
all_grads.len(), weight_count
|
| 538 |
+
));
|
| 539 |
+
}
|
| 540 |
+
|
| 541 |
+
Ok(all_grads)
|
| 542 |
+
}
|
| 543 |
+
|
| 544 |
+
// ============================================================================
|
| 545 |
+
// ADAMW OPTIMIZER
|
| 546 |
+
// ============================================================================
|
| 547 |
+
|
| 548 |
+
/// AdamW optimizer configuration
|
| 549 |
+
#[derive(Debug, Clone)]
|
| 550 |
+
pub struct AdamWConfig {
|
| 551 |
+
/// Learning rate (peak)
|
| 552 |
+
pub lr: f32,
|
| 553 |
+
/// First moment decay (default: 0.9)
|
| 554 |
+
pub beta1: f32,
|
| 555 |
+
/// Second moment decay (default: 0.999)
|
| 556 |
+
pub beta2: f32,
|
| 557 |
+
/// Numerical stability (default: 1e-8)
|
| 558 |
+
pub epsilon: f32,
|
| 559 |
+
/// Decoupled weight decay (default: 0.01)
|
| 560 |
+
pub weight_decay: f32,
|
| 561 |
+
}
|
| 562 |
+
|
| 563 |
+
impl Default for AdamWConfig {
|
| 564 |
+
fn default() -> Self {
|
| 565 |
+
Self {
|
| 566 |
+
lr: 3e-4,
|
| 567 |
+
beta1: 0.9,
|
| 568 |
+
beta2: 0.999,
|
| 569 |
+
epsilon: 1e-8,
|
| 570 |
+
weight_decay: 0.01,
|
| 571 |
+
}
|
| 572 |
+
}
|
| 573 |
+
}
|
| 574 |
+
|
| 575 |
+
/// Per-parameter optimizer state (momentum + variance)
|
| 576 |
+
pub struct ParamState {
|
| 577 |
+
/// First moment estimate (momentum)
|
| 578 |
+
pub m: Vec<f32>,
|
| 579 |
+
/// Second moment estimate (uncentered variance)
|
| 580 |
+
pub v: Vec<f32>,
|
| 581 |
+
}
|
| 582 |
+
|
| 583 |
+
/// AdamW optimizer with decoupled weight decay
|
| 584 |
+
/// Memory: 2 × param_count × 4 bytes (m + v tensors)
|
| 585 |
+
/// For 5M params: ~40MB
|
| 586 |
+
pub struct AdamW {
|
| 587 |
+
pub config: AdamWConfig,
|
| 588 |
+
/// Per-parameter states indexed by position in weight list
|
| 589 |
+
pub states: Vec<ParamState>,
|
| 590 |
+
/// Global step counter (for bias correction)
|
| 591 |
+
pub step: u64,
|
| 592 |
+
}
|
| 593 |
+
|
| 594 |
+
impl AdamW {
|
| 595 |
+
/// Initialize optimizer for a given number of parameter groups
|
| 596 |
+
pub fn new(config: AdamWConfig, param_sizes: &[usize]) -> Self {
|
| 597 |
+
let states = param_sizes.iter().map(|&size| ParamState {
|
| 598 |
+
m: vec![0.0; size],
|
| 599 |
+
v: vec![0.0; size],
|
| 600 |
+
}).collect();
|
| 601 |
+
|
| 602 |
+
Self { config, states, step: 0 }
|
| 603 |
+
}
|
| 604 |
+
|
| 605 |
+
/// Perform one optimization step
|
| 606 |
+
/// params: mutable weight tensors
|
| 607 |
+
/// grads: computed gradients (same order as params)
|
| 608 |
+
/// current_lr: may be adjusted by LR scheduler (pass config.lr if no scheduler)
|
| 609 |
+
pub fn step(&mut self, params: &mut [&mut Tensor], grads: &[&Tensor], current_lr: f32) {
|
| 610 |
+
self.step += 1;
|
| 611 |
+
let t = self.step as f32;
|
| 612 |
+
|
| 613 |
+
// Bias correction factors
|
| 614 |
+
let bc1 = 1.0 - self.config.beta1.powf(t);
|
| 615 |
+
let bc2 = 1.0 - self.config.beta2.powf(t);
|
| 616 |
+
|
| 617 |
+
for (i, (param, grad)) in params.iter_mut().zip(grads.iter()).enumerate() {
|
| 618 |
+
if i >= self.states.len() {
|
| 619 |
+
continue; // safety guard
|
| 620 |
+
}
|
| 621 |
+
let state = &mut self.states[i];
|
| 622 |
+
|
| 623 |
+
for j in 0..param.data.len() {
|
| 624 |
+
let g = grad.data[j];
|
| 625 |
+
|
| 626 |
+
// Update biased first moment estimate
|
| 627 |
+
state.m[j] = self.config.beta1 * state.m[j] + (1.0 - self.config.beta1) * g;
|
| 628 |
+
|
| 629 |
+
// Update biased second moment estimate
|
| 630 |
+
state.v[j] = self.config.beta2 * state.v[j] + (1.0 - self.config.beta2) * g * g;
|
| 631 |
+
|
| 632 |
+
// Bias-corrected estimates
|
| 633 |
+
let m_hat = state.m[j] / bc1;
|
| 634 |
+
let v_hat = state.v[j] / bc2;
|
| 635 |
+
|
| 636 |
+
// Gradient update step
|
| 637 |
+
param.data[j] -= current_lr * m_hat / (v_hat.sqrt() + self.config.epsilon);
|
| 638 |
+
|
| 639 |
+
// Decoupled weight decay (AdamW — NOT inside adaptive term)
|
| 640 |
+
param.data[j] -= current_lr * self.config.weight_decay * param.data[j];
|
| 641 |
+
}
|
| 642 |
+
}
|
| 643 |
+
}
|
| 644 |
+
|
| 645 |
+
/// Total memory usage in bytes
|
| 646 |
+
pub fn memory_bytes(&self) -> usize {
|
| 647 |
+
self.states.iter().map(|s| (s.m.len() + s.v.len()) * 4).sum()
|
| 648 |
+
}
|
| 649 |
+
|
| 650 |
+
/// Serialize optimizer state to flat vectors (for LMDB checkpoint)
|
| 651 |
+
pub fn save_state(&self) -> (Vec<Vec<f32>>, Vec<Vec<f32>>, u64) {
|
| 652 |
+
let m_states: Vec<Vec<f32>> = self.states.iter().map(|s| s.m.clone()).collect();
|
| 653 |
+
let v_states: Vec<Vec<f32>> = self.states.iter().map(|s| s.v.clone()).collect();
|
| 654 |
+
(m_states, v_states, self.step)
|
| 655 |
+
}
|
| 656 |
+
|
| 657 |
+
/// Restore optimizer state from saved vectors
|
| 658 |
+
pub fn load_state(&mut self, m_states: Vec<Vec<f32>>, v_states: Vec<Vec<f32>>, step: u64) {
|
| 659 |
+
for (i, (m, v)) in m_states.into_iter().zip(v_states.into_iter()).enumerate() {
|
| 660 |
+
if i < self.states.len() {
|
| 661 |
+
self.states[i].m = m;
|
| 662 |
+
self.states[i].v = v;
|
| 663 |
+
}
|
| 664 |
+
}
|
| 665 |
+
self.step = step;
|
| 666 |
+
}
|
| 667 |
+
}
|
| 668 |
+
|
| 669 |
+
// ============================================================================
|
| 670 |
+
// TRAINING BATCH
|
| 671 |
+
// ============================================================================
|
| 672 |
+
|
| 673 |
+
/// A single training example from gate decisions
|
| 674 |
+
#[derive(Debug, Clone)]
|
| 675 |
+
pub struct TrainingExample {
|
| 676 |
+
/// Token IDs representing the tool call context
|
| 677 |
+
pub input_tokens: Vec<usize>,
|
| 678 |
+
/// Target: next token (for language modeling) or gate label
|
| 679 |
+
pub target: TrainingTarget,
|
| 680 |
+
/// Training weight: how much this example matters (1.0 = normal, 4.0 = FP, 8.0 = repeat FP)
|
| 681 |
+
/// Comes from gate_training::TrainingSignal.weight() — do NOT infer from label
|
| 682 |
+
pub weight: f32,
|
| 683 |
+
}
|
| 684 |
+
|
| 685 |
+
/// What we're training toward
|
| 686 |
+
#[derive(Debug, Clone)]
|
| 687 |
+
pub enum TrainingTarget {
|
| 688 |
+
/// Next token prediction (language modeling)
|
| 689 |
+
NextToken(usize),
|
| 690 |
+
/// Gate decision label from TrainingSignal.label():
|
| 691 |
+
/// -1.0 = false positive, -0.5 = user override block, 0.0 = block, 1.0 = allow, 1.5 = user override allow
|
| 692 |
+
GateDecision(f32),
|
| 693 |
+
}
|
| 694 |
+
|
| 695 |
+
/// Training batch — multiple examples grouped for efficient processing
|
| 696 |
+
pub struct TrainingBatch {
|
| 697 |
+
pub examples: Vec<TrainingExample>,
|
| 698 |
+
}
|
| 699 |
+
|
| 700 |
+
impl TrainingBatch {
|
| 701 |
+
pub fn new() -> Self {
|
| 702 |
+
Self { examples: Vec::new() }
|
| 703 |
+
}
|
| 704 |
+
|
| 705 |
+
pub fn add(&mut self, example: TrainingExample) {
|
| 706 |
+
self.examples.push(example);
|
| 707 |
+
}
|
| 708 |
+
|
| 709 |
+
pub fn len(&self) -> usize {
|
| 710 |
+
self.examples.len()
|
| 711 |
+
}
|
| 712 |
+
|
| 713 |
+
pub fn is_empty(&self) -> bool {
|
| 714 |
+
self.examples.is_empty()
|
| 715 |
+
}
|
| 716 |
+
}
|
| 717 |
+
|
| 718 |
+
// ============================================================================
|
| 719 |
+
// GRADIENT ACCUMULATOR
|
| 720 |
+
// ============================================================================
|
| 721 |
+
|
| 722 |
+
/// Accumulates gradients across a batch before applying to weights
|
| 723 |
+
pub struct GradAccumulator {
|
| 724 |
+
/// Accumulated gradients, one Vec<f32> per parameter tensor
|
| 725 |
+
pub grads: Vec<Vec<f32>>,
|
| 726 |
+
/// Number of examples accumulated
|
| 727 |
+
pub count: usize,
|
| 728 |
+
}
|
| 729 |
+
|
| 730 |
+
impl GradAccumulator {
|
| 731 |
+
/// Initialize with zero gradients matching parameter sizes
|
| 732 |
+
pub fn new(param_sizes: &[usize]) -> Self {
|
| 733 |
+
let grads = param_sizes.iter().map(|&size| vec![0.0f32; size]).collect();
|
| 734 |
+
Self { grads, count: 0 }
|
| 735 |
+
}
|
| 736 |
+
|
| 737 |
+
/// Add gradients from one example
|
| 738 |
+
pub fn accumulate(&mut self, new_grads: &[&Tensor]) {
|
| 739 |
+
for (acc, grad) in self.grads.iter_mut().zip(new_grads.iter()) {
|
| 740 |
+
for (a, &g) in acc.iter_mut().zip(grad.data.iter()) {
|
| 741 |
+
*a += g;
|
| 742 |
+
}
|
| 743 |
+
}
|
| 744 |
+
self.count += 1;
|
| 745 |
+
}
|
| 746 |
+
|
| 747 |
+
/// Average the accumulated gradients
|
| 748 |
+
pub fn averaged(&self) -> Vec<Tensor> {
|
| 749 |
+
if self.count == 0 {
|
| 750 |
+
return self.grads.iter().map(|g| {
|
| 751 |
+
Tensor { data: g.clone(), shape: vec![g.len()] }
|
| 752 |
+
}).collect();
|
| 753 |
+
}
|
| 754 |
+
let scale = 1.0 / self.count as f32;
|
| 755 |
+
self.grads.iter().map(|g| {
|
| 756 |
+
let data: Vec<f32> = g.iter().map(|&v| v * scale).collect();
|
| 757 |
+
Tensor { data: data.clone(), shape: vec![data.len()] }
|
| 758 |
+
}).collect()
|
| 759 |
+
}
|
| 760 |
+
|
| 761 |
+
/// Reset for next batch
|
| 762 |
+
pub fn reset(&mut self) {
|
| 763 |
+
for g in &mut self.grads {
|
| 764 |
+
g.fill(0.0);
|
| 765 |
+
}
|
| 766 |
+
self.count = 0;
|
| 767 |
+
}
|
| 768 |
+
}
|
| 769 |
+
|
| 770 |
+
// ============================================================================
|
| 771 |
+
// TRAINING METRICS
|
| 772 |
+
// ============================================================================
|
| 773 |
+
|
| 774 |
+
/// Training metrics tracked during learning
|
| 775 |
+
#[derive(Debug, Clone)]
|
| 776 |
+
pub struct TrainingMetrics {
|
| 777 |
+
/// Running average loss
|
| 778 |
+
pub avg_loss: f32,
|
| 779 |
+
/// Total training steps completed
|
| 780 |
+
pub total_steps: u64,
|
| 781 |
+
/// Gate alignment: prediction matches gate decision (0..1)
|
| 782 |
+
pub gate_alignment: f32,
|
| 783 |
+
/// Number of gate decisions seen
|
| 784 |
+
pub gate_decisions_total: u64,
|
| 785 |
+
/// Number where model agreed with gate
|
| 786 |
+
pub gate_decisions_aligned: u64,
|
| 787 |
+
/// Current learning rate
|
| 788 |
+
pub current_lr: f32,
|
| 789 |
+
/// Loss history (last 100 values for trend detection)
|
| 790 |
+
pub loss_history: Vec<f32>,
|
| 791 |
+
}
|
| 792 |
+
|
| 793 |
+
impl TrainingMetrics {
|
| 794 |
+
pub fn new() -> Self {
|
| 795 |
+
Self {
|
| 796 |
+
avg_loss: 0.0,
|
| 797 |
+
total_steps: 0,
|
| 798 |
+
gate_alignment: 0.0,
|
| 799 |
+
gate_decisions_total: 0,
|
| 800 |
+
gate_decisions_aligned: 0,
|
| 801 |
+
current_lr: 0.0,
|
| 802 |
+
loss_history: Vec::new(),
|
| 803 |
+
}
|
| 804 |
+
}
|
| 805 |
+
|
| 806 |
+
/// Record a training step
|
| 807 |
+
pub fn record_step(&mut self, loss: f32, lr: f32) {
|
| 808 |
+
self.total_steps += 1;
|
| 809 |
+
// Exponential moving average of loss
|
| 810 |
+
let alpha = 0.01;
|
| 811 |
+
self.avg_loss = if self.total_steps == 1 {
|
| 812 |
+
loss
|
| 813 |
+
} else {
|
| 814 |
+
self.avg_loss * (1.0 - alpha) + loss * alpha
|
| 815 |
+
};
|
| 816 |
+
self.current_lr = lr;
|
| 817 |
+
|
| 818 |
+
self.loss_history.push(loss);
|
| 819 |
+
if self.loss_history.len() > 100 {
|
| 820 |
+
self.loss_history.remove(0);
|
| 821 |
+
}
|
| 822 |
+
}
|
| 823 |
+
|
| 824 |
+
/// Record a gate decision prediction
|
| 825 |
+
pub fn record_gate_prediction(&mut self, predicted_allow: bool, actual_allow: bool) {
|
| 826 |
+
self.gate_decisions_total += 1;
|
| 827 |
+
if predicted_allow == actual_allow {
|
| 828 |
+
self.gate_decisions_aligned += 1;
|
| 829 |
+
}
|
| 830 |
+
self.gate_alignment = self.gate_decisions_aligned as f32
|
| 831 |
+
/ self.gate_decisions_total.max(1) as f32;
|
| 832 |
+
}
|
| 833 |
+
|
| 834 |
+
/// Check if model has converged (95%+ alignment for 1000+ decisions)
|
| 835 |
+
pub fn is_converged(&self) -> bool {
|
| 836 |
+
self.gate_decisions_total >= 1000 && self.gate_alignment >= 0.95
|
| 837 |
+
}
|
| 838 |
+
|
| 839 |
+
/// Loss trend: negative = improving, positive = degrading
|
| 840 |
+
pub fn loss_trend(&self) -> f32 {
|
| 841 |
+
if self.loss_history.len() < 20 {
|
| 842 |
+
return 0.0;
|
| 843 |
+
}
|
| 844 |
+
let recent = &self.loss_history[self.loss_history.len() - 10..];
|
| 845 |
+
let older = &self.loss_history[self.loss_history.len() - 20..self.loss_history.len() - 10];
|
| 846 |
+
let recent_avg: f32 = recent.iter().sum::<f32>() / 10.0;
|
| 847 |
+
let older_avg: f32 = older.iter().sum::<f32>() / 10.0;
|
| 848 |
+
recent_avg - older_avg
|
| 849 |
+
}
|
| 850 |
+
}
|
| 851 |
+
|
| 852 |
+
// ============================================================================
|
| 853 |
+
// TESTS
|
| 854 |
+
// ============================================================================
|
| 855 |
+
|
| 856 |
+
#[cfg(test)]
|
| 857 |
+
mod tests {
|
| 858 |
+
use super::*;
|
| 859 |
+
|
| 860 |
+
#[test]
|
| 861 |
+
fn test_cross_entropy_loss() {
|
| 862 |
+
// logits: 2 examples, 4-class
|
| 863 |
+
let logits = Tensor::from_data(
|
| 864 |
+
vec![2.0, 1.0, 0.1, -1.0, // example 0: class 0 is strongest
|
| 865 |
+
-1.0, 0.1, 2.0, 1.0], // example 1: class 2 is strongest
|
| 866 |
+
vec![2, 4],
|
| 867 |
+
).unwrap();
|
| 868 |
+
let targets = vec![0, 2]; // correct classes
|
| 869 |
+
|
| 870 |
+
let (loss, grad) = cross_entropy_loss(&logits, &targets).unwrap();
|
| 871 |
+
assert!(loss > 0.0, "Loss should be positive");
|
| 872 |
+
assert!(loss < 2.0, "Loss should be small for correct predictions");
|
| 873 |
+
assert_eq!(grad.shape, vec![2, 4]);
|
| 874 |
+
assert!(grad.data.iter().all(|v| v.is_finite()));
|
| 875 |
+
}
|
| 876 |
+
|
| 877 |
+
#[test]
|
| 878 |
+
fn test_cross_entropy_wrong_prediction() {
|
| 879 |
+
let logits = Tensor::from_data(
|
| 880 |
+
vec![2.0, 0.0, 0.0, 0.0], // predicts class 0
|
| 881 |
+
vec![1, 4],
|
| 882 |
+
).unwrap();
|
| 883 |
+
let targets_right = vec![0];
|
| 884 |
+
let targets_wrong = vec![3];
|
| 885 |
+
|
| 886 |
+
let (loss_right, _) = cross_entropy_loss(&logits, &targets_right).unwrap();
|
| 887 |
+
let (loss_wrong, _) = cross_entropy_loss(&logits, &targets_wrong).unwrap();
|
| 888 |
+
assert!(loss_wrong > loss_right, "Wrong prediction should have higher loss");
|
| 889 |
+
}
|
| 890 |
+
|
| 891 |
+
#[test]
|
| 892 |
+
fn test_binary_ce_loss() {
|
| 893 |
+
let predictions = Tensor::from_data(vec![0.9, 0.1], vec![2]).unwrap();
|
| 894 |
+
let labels = vec![1.0, 0.0]; // correct predictions
|
| 895 |
+
let weights = vec![1.0, 1.0]; // uniform weight
|
| 896 |
+
|
| 897 |
+
let (loss, grad) = binary_ce_loss(&predictions, &labels, &weights).unwrap();
|
| 898 |
+
assert!(loss > 0.0);
|
| 899 |
+
assert!(loss < 1.0, "Loss should be small for correct predictions");
|
| 900 |
+
assert_eq!(grad.shape, vec![2]);
|
| 901 |
+
}
|
| 902 |
+
|
| 903 |
+
#[test]
|
| 904 |
+
fn test_binary_ce_loss_fp_weight() {
|
| 905 |
+
let predictions = Tensor::from_data(vec![0.9, 0.9], vec![2]).unwrap();
|
| 906 |
+
let labels = vec![1.0, 1.0]; // both "allow"
|
| 907 |
+
let weights_normal = vec![1.0, 1.0];
|
| 908 |
+
let weights_fp = vec![4.0, 4.0]; // false positive 4x weight
|
| 909 |
+
|
| 910 |
+
let (loss_normal, _) = binary_ce_loss(&predictions, &labels, &weights_normal).unwrap();
|
| 911 |
+
let (loss_fp, _) = binary_ce_loss(&predictions, &labels, &weights_fp).unwrap();
|
| 912 |
+
// FP-weighted loss should be ~4x the normal loss
|
| 913 |
+
assert!((loss_fp / loss_normal - 4.0).abs() < 0.01);
|
| 914 |
+
}
|
| 915 |
+
|
| 916 |
+
#[test]
|
| 917 |
+
fn test_attention_backward_shapes() {
|
| 918 |
+
let seq = 4;
|
| 919 |
+
let d_head = 8;
|
| 920 |
+
let d_output = Tensor::randn(&[seq, d_head], 1);
|
| 921 |
+
let q = Tensor::randn(&[seq, d_head], 2);
|
| 922 |
+
let k = Tensor::randn(&[seq, d_head], 3);
|
| 923 |
+
let v = Tensor::randn(&[seq, d_head], 4);
|
| 924 |
+
let attn_w = Tensor::randn(&[seq, seq], 5).softmax().unwrap();
|
| 925 |
+
let scale = 1.0 / (d_head as f32).sqrt();
|
| 926 |
+
|
| 927 |
+
let (dq, dk, dv) = attention_backward(&d_output, &q, &k, &v, &attn_w, scale).unwrap();
|
| 928 |
+
assert_eq!(dq.shape, vec![seq, d_head]);
|
| 929 |
+
assert_eq!(dk.shape, vec![seq, d_head]);
|
| 930 |
+
assert_eq!(dv.shape, vec![seq, d_head]);
|
| 931 |
+
assert!(dq.data.iter().all(|v| v.is_finite()));
|
| 932 |
+
}
|
| 933 |
+
|
| 934 |
+
#[test]
|
| 935 |
+
fn test_linear_backward_shapes() {
|
| 936 |
+
let batch = 4;
|
| 937 |
+
let in_f = 8;
|
| 938 |
+
let out_f = 16;
|
| 939 |
+
let d_output = Tensor::randn(&[batch, out_f], 1);
|
| 940 |
+
let input = Tensor::randn(&[batch, in_f], 2);
|
| 941 |
+
let weight = Tensor::randn(&[out_f, in_f], 3);
|
| 942 |
+
|
| 943 |
+
let (dw, db, dx) = linear_backward(&d_output, &input, &weight).unwrap();
|
| 944 |
+
assert_eq!(dw.shape, vec![out_f, in_f]);
|
| 945 |
+
assert_eq!(db.shape, vec![out_f]);
|
| 946 |
+
assert_eq!(dx.shape, vec![batch, in_f]);
|
| 947 |
+
}
|
| 948 |
+
|
| 949 |
+
#[test]
|
| 950 |
+
fn test_layer_norm_backward_shapes() {
|
| 951 |
+
let batch = 4;
|
| 952 |
+
let dim = 16;
|
| 953 |
+
let d_output = Tensor::randn(&[batch, dim], 1);
|
| 954 |
+
let input = Tensor::randn(&[batch, dim], 2);
|
| 955 |
+
let gamma = Tensor::ones(&[dim]);
|
| 956 |
+
|
| 957 |
+
let (dg, db, dx) = layer_norm_backward(&d_output, &input, &gamma, 1e-5).unwrap();
|
| 958 |
+
assert_eq!(dg.shape, vec![dim]);
|
| 959 |
+
assert_eq!(db.shape, vec![dim]);
|
| 960 |
+
assert_eq!(dx.shape, vec![batch, dim]);
|
| 961 |
+
}
|
| 962 |
+
|
| 963 |
+
#[test]
|
| 964 |
+
fn test_embedding_backward() {
|
| 965 |
+
let d_output = Tensor::from_data(
|
| 966 |
+
vec![1.0, 2.0, 3.0, // token 5
|
| 967 |
+
4.0, 5.0, 6.0], // token 2
|
| 968 |
+
vec![2, 3],
|
| 969 |
+
).unwrap();
|
| 970 |
+
let indices = vec![5, 2];
|
| 971 |
+
let vocab_size = 10;
|
| 972 |
+
|
| 973 |
+
let grad = embedding_backward(&d_output, &indices, vocab_size).unwrap();
|
| 974 |
+
assert_eq!(grad.shape, vec![10, 3]);
|
| 975 |
+
// Row 5 should have [1,2,3], row 2 should have [4,5,6], rest zero
|
| 976 |
+
assert_eq!(grad.data[5 * 3], 1.0);
|
| 977 |
+
assert_eq!(grad.data[2 * 3], 4.0);
|
| 978 |
+
assert_eq!(grad.data[0], 0.0); // row 0 untouched
|
| 979 |
+
}
|
| 980 |
+
|
| 981 |
+
#[test]
|
| 982 |
+
fn test_adamw_step() {
|
| 983 |
+
let config = AdamWConfig::default();
|
| 984 |
+
let mut optimizer = AdamW::new(config, &[4]);
|
| 985 |
+
|
| 986 |
+
let mut param = Tensor::from_data(vec![1.0, 2.0, 3.0, 4.0], vec![4]).unwrap();
|
| 987 |
+
let grad = Tensor::from_data(vec![0.1, 0.2, 0.3, 0.4], vec![4]).unwrap();
|
| 988 |
+
|
| 989 |
+
let original = param.data.clone();
|
| 990 |
+
optimizer.step(&mut [&mut param], &[&grad], 3e-4);
|
| 991 |
+
|
| 992 |
+
// Params should have changed
|
| 993 |
+
assert!(param.data != original, "Params should change after optimizer step");
|
| 994 |
+
assert_eq!(optimizer.step, 1);
|
| 995 |
+
}
|
| 996 |
+
|
| 997 |
+
#[test]
|
| 998 |
+
fn test_adamw_memory() {
|
| 999 |
+
let config = AdamWConfig::default();
|
| 1000 |
+
let optimizer = AdamW::new(config, &[1000, 2000, 500]);
|
| 1001 |
+
// 3500 params × 2 states × 4 bytes = 28000
|
| 1002 |
+
assert_eq!(optimizer.memory_bytes(), 28000);
|
| 1003 |
+
}
|
| 1004 |
+
|
| 1005 |
+
#[test]
|
| 1006 |
+
fn test_grad_accumulator() {
|
| 1007 |
+
let mut acc = GradAccumulator::new(&[4, 2]);
|
| 1008 |
+
|
| 1009 |
+
let g1 = Tensor::from_data(vec![1.0, 2.0, 3.0, 4.0], vec![4]).unwrap();
|
| 1010 |
+
let g2 = Tensor::from_data(vec![10.0, 20.0], vec![2]).unwrap();
|
| 1011 |
+
acc.accumulate(&[&g1, &g2]);
|
| 1012 |
+
|
| 1013 |
+
let g3 = Tensor::from_data(vec![3.0, 4.0, 5.0, 6.0], vec![4]).unwrap();
|
| 1014 |
+
let g4 = Tensor::from_data(vec![30.0, 40.0], vec![2]).unwrap();
|
| 1015 |
+
acc.accumulate(&[&g3, &g4]);
|
| 1016 |
+
|
| 1017 |
+
let avg = acc.averaged();
|
| 1018 |
+
assert_eq!(avg[0].data, vec![2.0, 3.0, 4.0, 5.0]);
|
| 1019 |
+
assert_eq!(avg[1].data, vec![20.0, 30.0]);
|
| 1020 |
+
}
|
| 1021 |
+
|
| 1022 |
+
#[test]
|
| 1023 |
+
fn test_training_example_weight() {
|
| 1024 |
+
let normal = TrainingExample {
|
| 1025 |
+
input_tokens: vec![1, 2, 3],
|
| 1026 |
+
target: TrainingTarget::GateDecision(1.0),
|
| 1027 |
+
weight: 1.0,
|
| 1028 |
+
};
|
| 1029 |
+
assert_eq!(normal.weight, 1.0);
|
| 1030 |
+
|
| 1031 |
+
let fp = TrainingExample {
|
| 1032 |
+
input_tokens: vec![1, 2, 3],
|
| 1033 |
+
target: TrainingTarget::GateDecision(-1.0),
|
| 1034 |
+
weight: 4.0,
|
| 1035 |
+
};
|
| 1036 |
+
assert_eq!(fp.weight, 4.0);
|
| 1037 |
+
}
|
| 1038 |
+
|
| 1039 |
+
#[test]
|
| 1040 |
+
fn test_training_metrics_convergence() {
|
| 1041 |
+
let mut metrics = TrainingMetrics::new();
|
| 1042 |
+
// Simulate 1000 aligned decisions
|
| 1043 |
+
for _ in 0..1000 {
|
| 1044 |
+
metrics.record_gate_prediction(true, true);
|
| 1045 |
+
}
|
| 1046 |
+
assert!(metrics.is_converged());
|
| 1047 |
+
|
| 1048 |
+
// Not converged with low alignment
|
| 1049 |
+
let mut m2 = TrainingMetrics::new();
|
| 1050 |
+
for i in 0..1000 {
|
| 1051 |
+
m2.record_gate_prediction(i % 2 == 0, true);
|
| 1052 |
+
}
|
| 1053 |
+
assert!(!m2.is_converged());
|
| 1054 |
+
}
|
| 1055 |
+
|
| 1056 |
+
#[test]
|
| 1057 |
+
fn test_gelu_backward_finite() {
|
| 1058 |
+
let dy = Tensor::randn(&[4, 8], 1);
|
| 1059 |
+
let x = Tensor::randn(&[4, 8], 2);
|
| 1060 |
+
let dx = gelu_backward(&dy, &x);
|
| 1061 |
+
assert!(dx.data.iter().all(|v| v.is_finite()));
|
| 1062 |
+
assert_eq!(dx.shape, x.shape);
|
| 1063 |
+
}
|
| 1064 |
+
}
|
SPFsmartGATE/target/debug/.cargo-lock
ADDED
|
File without changes
|
SPFsmartGATE/target/debug/brain_index_training.d
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
/data/data/com.termux/files/home/SPFsmartGATE/target/debug/brain_index_training: /data/data/com.termux/files/home/SPFsmartGATE/LIVE/TMP/stoneshell-brain/src/cache.rs /data/data/com.termux/files/home/SPFsmartGATE/LIVE/TMP/stoneshell-brain/src/chunker.rs /data/data/com.termux/files/home/SPFsmartGATE/LIVE/TMP/stoneshell-brain/src/embeddings.rs /data/data/com.termux/files/home/SPFsmartGATE/LIVE/TMP/stoneshell-brain/src/lib.rs /data/data/com.termux/files/home/SPFsmartGATE/LIVE/TMP/stoneshell-brain/src/search.rs /data/data/com.termux/files/home/SPFsmartGATE/LIVE/TMP/stoneshell-brain/src/storage.rs /data/data/com.termux/files/home/SPFsmartGATE/src/agent_state.rs /data/data/com.termux/files/home/SPFsmartGATE/src/attention.rs /data/data/com.termux/files/home/SPFsmartGATE/src/bin/brain_index_training.rs /data/data/com.termux/files/home/SPFsmartGATE/src/brain_local.rs /data/data/com.termux/files/home/SPFsmartGATE/src/browser.rs /data/data/com.termux/files/home/SPFsmartGATE/src/calculate.rs /data/data/com.termux/files/home/SPFsmartGATE/src/channel.rs /data/data/com.termux/files/home/SPFsmartGATE/src/chat.rs /data/data/com.termux/files/home/SPFsmartGATE/src/checkpoint.rs /data/data/com.termux/files/home/SPFsmartGATE/src/config.rs /data/data/com.termux/files/home/SPFsmartGATE/src/config_db.rs /data/data/com.termux/files/home/SPFsmartGATE/src/decoder.rs /data/data/com.termux/files/home/SPFsmartGATE/src/dispatch.rs /data/data/com.termux/files/home/SPFsmartGATE/src/encoder.rs /data/data/com.termux/files/home/SPFsmartGATE/src/ffn.rs /data/data/com.termux/files/home/SPFsmartGATE/src/flint_memory.rs /data/data/com.termux/files/home/SPFsmartGATE/src/framing.rs /data/data/com.termux/files/home/SPFsmartGATE/src/fs.rs /data/data/com.termux/files/home/SPFsmartGATE/src/gate.rs /data/data/com.termux/files/home/SPFsmartGATE/src/gate_training.rs /data/data/com.termux/files/home/SPFsmartGATE/src/http.rs /data/data/com.termux/files/home/SPFsmartGATE/src/identity.rs /data/data/com.termux/files/home/SPFsmartGATE/src/inspect.rs /data/data/com.termux/files/home/SPFsmartGATE/src/learning.rs /data/data/com.termux/files/home/SPFsmartGATE/src/lib.rs /data/data/com.termux/files/home/SPFsmartGATE/src/mcp.rs /data/data/com.termux/files/home/SPFsmartGATE/src/mesh.rs /data/data/com.termux/files/home/SPFsmartGATE/src/network.rs /data/data/com.termux/files/home/SPFsmartGATE/src/orchestrator.rs /data/data/com.termux/files/home/SPFsmartGATE/src/paths.rs /data/data/com.termux/files/home/SPFsmartGATE/src/pipeline.rs /data/data/com.termux/files/home/SPFsmartGATE/src/session.rs /data/data/com.termux/files/home/SPFsmartGATE/src/storage.rs /data/data/com.termux/files/home/SPFsmartGATE/src/tensor.rs /data/data/com.termux/files/home/SPFsmartGATE/src/tmp_db.rs /data/data/com.termux/files/home/SPFsmartGATE/src/tokenizer.rs /data/data/com.termux/files/home/SPFsmartGATE/src/train.rs /data/data/com.termux/files/home/SPFsmartGATE/src/transformer.rs /data/data/com.termux/files/home/SPFsmartGATE/src/transformer_tools.rs /data/data/com.termux/files/home/SPFsmartGATE/src/utf8_safe.rs /data/data/com.termux/files/home/SPFsmartGATE/src/validate.rs /data/data/com.termux/files/home/SPFsmartGATE/src/voice.rs /data/data/com.termux/files/home/SPFsmartGATE/src/web.rs /data/data/com.termux/files/home/SPFsmartGATE/src/worker.rs
|
SPFsmartGATE/target/debug/prune_memories.d
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
/data/data/com.termux/files/home/SPFsmartGATE/target/debug/prune_memories: /data/data/com.termux/files/home/SPFsmartGATE/LIVE/TMP/stoneshell-brain/src/cache.rs /data/data/com.termux/files/home/SPFsmartGATE/LIVE/TMP/stoneshell-brain/src/chunker.rs /data/data/com.termux/files/home/SPFsmartGATE/LIVE/TMP/stoneshell-brain/src/embeddings.rs /data/data/com.termux/files/home/SPFsmartGATE/LIVE/TMP/stoneshell-brain/src/lib.rs /data/data/com.termux/files/home/SPFsmartGATE/LIVE/TMP/stoneshell-brain/src/search.rs /data/data/com.termux/files/home/SPFsmartGATE/LIVE/TMP/stoneshell-brain/src/storage.rs /data/data/com.termux/files/home/SPFsmartGATE/src/agent_state.rs /data/data/com.termux/files/home/SPFsmartGATE/src/attention.rs /data/data/com.termux/files/home/SPFsmartGATE/src/bin/prune_memories.rs /data/data/com.termux/files/home/SPFsmartGATE/src/brain_local.rs /data/data/com.termux/files/home/SPFsmartGATE/src/browser.rs /data/data/com.termux/files/home/SPFsmartGATE/src/calculate.rs /data/data/com.termux/files/home/SPFsmartGATE/src/channel.rs /data/data/com.termux/files/home/SPFsmartGATE/src/chat.rs /data/data/com.termux/files/home/SPFsmartGATE/src/checkpoint.rs /data/data/com.termux/files/home/SPFsmartGATE/src/config.rs /data/data/com.termux/files/home/SPFsmartGATE/src/config_db.rs /data/data/com.termux/files/home/SPFsmartGATE/src/decoder.rs /data/data/com.termux/files/home/SPFsmartGATE/src/dispatch.rs /data/data/com.termux/files/home/SPFsmartGATE/src/encoder.rs /data/data/com.termux/files/home/SPFsmartGATE/src/ffn.rs /data/data/com.termux/files/home/SPFsmartGATE/src/flint_memory.rs /data/data/com.termux/files/home/SPFsmartGATE/src/framing.rs /data/data/com.termux/files/home/SPFsmartGATE/src/fs.rs /data/data/com.termux/files/home/SPFsmartGATE/src/gate.rs /data/data/com.termux/files/home/SPFsmartGATE/src/gate_training.rs /data/data/com.termux/files/home/SPFsmartGATE/src/http.rs /data/data/com.termux/files/home/SPFsmartGATE/src/identity.rs /data/data/com.termux/files/home/SPFsmartGATE/src/inspect.rs /data/data/com.termux/files/home/SPFsmartGATE/src/learning.rs /data/data/com.termux/files/home/SPFsmartGATE/src/lib.rs /data/data/com.termux/files/home/SPFsmartGATE/src/mcp.rs /data/data/com.termux/files/home/SPFsmartGATE/src/mesh.rs /data/data/com.termux/files/home/SPFsmartGATE/src/network.rs /data/data/com.termux/files/home/SPFsmartGATE/src/orchestrator.rs /data/data/com.termux/files/home/SPFsmartGATE/src/paths.rs /data/data/com.termux/files/home/SPFsmartGATE/src/pipeline.rs /data/data/com.termux/files/home/SPFsmartGATE/src/session.rs /data/data/com.termux/files/home/SPFsmartGATE/src/storage.rs /data/data/com.termux/files/home/SPFsmartGATE/src/tensor.rs /data/data/com.termux/files/home/SPFsmartGATE/src/tmp_db.rs /data/data/com.termux/files/home/SPFsmartGATE/src/tokenizer.rs /data/data/com.termux/files/home/SPFsmartGATE/src/train.rs /data/data/com.termux/files/home/SPFsmartGATE/src/transformer.rs /data/data/com.termux/files/home/SPFsmartGATE/src/transformer_tools.rs /data/data/com.termux/files/home/SPFsmartGATE/src/utf8_safe.rs /data/data/com.termux/files/home/SPFsmartGATE/src/validate.rs /data/data/com.termux/files/home/SPFsmartGATE/src/voice.rs /data/data/com.termux/files/home/SPFsmartGATE/src/web.rs /data/data/com.termux/files/home/SPFsmartGATE/src/worker.rs
|
SPFsmartGATE/target/release/.cargo-lock
ADDED
|
File without changes
|
SPFsmartGATE/target/release/brain_index_training.d
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
/data/data/com.termux/files/home/SPFsmartGATE/target/release/brain_index_training: /data/data/com.termux/files/home/SPFsmartGATE/LIVE/TMP/stoneshell-brain/src/cache.rs /data/data/com.termux/files/home/SPFsmartGATE/LIVE/TMP/stoneshell-brain/src/chunker.rs /data/data/com.termux/files/home/SPFsmartGATE/LIVE/TMP/stoneshell-brain/src/embeddings.rs /data/data/com.termux/files/home/SPFsmartGATE/LIVE/TMP/stoneshell-brain/src/lib.rs /data/data/com.termux/files/home/SPFsmartGATE/LIVE/TMP/stoneshell-brain/src/search.rs /data/data/com.termux/files/home/SPFsmartGATE/LIVE/TMP/stoneshell-brain/src/storage.rs /data/data/com.termux/files/home/SPFsmartGATE/src/agent_state.rs /data/data/com.termux/files/home/SPFsmartGATE/src/attention.rs /data/data/com.termux/files/home/SPFsmartGATE/src/bin/brain_index_training.rs /data/data/com.termux/files/home/SPFsmartGATE/src/brain_local.rs /data/data/com.termux/files/home/SPFsmartGATE/src/browser.rs /data/data/com.termux/files/home/SPFsmartGATE/src/calculate.rs /data/data/com.termux/files/home/SPFsmartGATE/src/channel.rs /data/data/com.termux/files/home/SPFsmartGATE/src/chat.rs /data/data/com.termux/files/home/SPFsmartGATE/src/checkpoint.rs /data/data/com.termux/files/home/SPFsmartGATE/src/config.rs /data/data/com.termux/files/home/SPFsmartGATE/src/config_db.rs /data/data/com.termux/files/home/SPFsmartGATE/src/decoder.rs /data/data/com.termux/files/home/SPFsmartGATE/src/dispatch.rs /data/data/com.termux/files/home/SPFsmartGATE/src/encoder.rs /data/data/com.termux/files/home/SPFsmartGATE/src/ffn.rs /data/data/com.termux/files/home/SPFsmartGATE/src/flint_memory.rs /data/data/com.termux/files/home/SPFsmartGATE/src/framing.rs /data/data/com.termux/files/home/SPFsmartGATE/src/fs.rs /data/data/com.termux/files/home/SPFsmartGATE/src/gate.rs /data/data/com.termux/files/home/SPFsmartGATE/src/gate_training.rs /data/data/com.termux/files/home/SPFsmartGATE/src/http.rs /data/data/com.termux/files/home/SPFsmartGATE/src/identity.rs /data/data/com.termux/files/home/SPFsmartGATE/src/inspect.rs /data/data/com.termux/files/home/SPFsmartGATE/src/learning.rs /data/data/com.termux/files/home/SPFsmartGATE/src/lib.rs /data/data/com.termux/files/home/SPFsmartGATE/src/mcp.rs /data/data/com.termux/files/home/SPFsmartGATE/src/mesh.rs /data/data/com.termux/files/home/SPFsmartGATE/src/network.rs /data/data/com.termux/files/home/SPFsmartGATE/src/orchestrator.rs /data/data/com.termux/files/home/SPFsmartGATE/src/paths.rs /data/data/com.termux/files/home/SPFsmartGATE/src/pipeline.rs /data/data/com.termux/files/home/SPFsmartGATE/src/session.rs /data/data/com.termux/files/home/SPFsmartGATE/src/storage.rs /data/data/com.termux/files/home/SPFsmartGATE/src/tensor.rs /data/data/com.termux/files/home/SPFsmartGATE/src/tmp_db.rs /data/data/com.termux/files/home/SPFsmartGATE/src/tokenizer.rs /data/data/com.termux/files/home/SPFsmartGATE/src/train.rs /data/data/com.termux/files/home/SPFsmartGATE/src/transformer.rs /data/data/com.termux/files/home/SPFsmartGATE/src/transformer_tools.rs /data/data/com.termux/files/home/SPFsmartGATE/src/utf8_safe.rs /data/data/com.termux/files/home/SPFsmartGATE/src/validate.rs /data/data/com.termux/files/home/SPFsmartGATE/src/voice.rs /data/data/com.termux/files/home/SPFsmartGATE/src/web.rs /data/data/com.termux/files/home/SPFsmartGATE/src/worker.rs
|
SPFsmartGATE/target/release/deps/bincode-be0e4e9c6ceab529.d
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/data/data/com.termux/files/home/SPFsmartGATE/target/release/deps/bincode-be0e4e9c6ceab529.d: /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bincode-1.3.3/src/lib.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bincode-1.3.3/src/config/mod.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bincode-1.3.3/src/config/endian.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bincode-1.3.3/src/config/int.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bincode-1.3.3/src/config/legacy.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bincode-1.3.3/src/config/limit.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bincode-1.3.3/src/config/trailing.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bincode-1.3.3/src/de/mod.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bincode-1.3.3/src/de/read.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bincode-1.3.3/src/byteorder.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bincode-1.3.3/src/error.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bincode-1.3.3/src/internal.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bincode-1.3.3/src/ser/mod.rs
|
| 2 |
+
|
| 3 |
+
/data/data/com.termux/files/home/SPFsmartGATE/target/release/deps/libbincode-be0e4e9c6ceab529.rlib: /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bincode-1.3.3/src/lib.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bincode-1.3.3/src/config/mod.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bincode-1.3.3/src/config/endian.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bincode-1.3.3/src/config/int.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bincode-1.3.3/src/config/legacy.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bincode-1.3.3/src/config/limit.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bincode-1.3.3/src/config/trailing.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bincode-1.3.3/src/de/mod.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bincode-1.3.3/src/de/read.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bincode-1.3.3/src/byteorder.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bincode-1.3.3/src/error.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bincode-1.3.3/src/internal.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bincode-1.3.3/src/ser/mod.rs
|
| 4 |
+
|
| 5 |
+
/data/data/com.termux/files/home/SPFsmartGATE/target/release/deps/libbincode-be0e4e9c6ceab529.rmeta: /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bincode-1.3.3/src/lib.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bincode-1.3.3/src/config/mod.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bincode-1.3.3/src/config/endian.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bincode-1.3.3/src/config/int.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bincode-1.3.3/src/config/legacy.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bincode-1.3.3/src/config/limit.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bincode-1.3.3/src/config/trailing.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bincode-1.3.3/src/de/mod.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bincode-1.3.3/src/de/read.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bincode-1.3.3/src/byteorder.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bincode-1.3.3/src/error.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bincode-1.3.3/src/internal.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bincode-1.3.3/src/ser/mod.rs
|
| 6 |
+
|
| 7 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bincode-1.3.3/src/lib.rs:
|
| 8 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bincode-1.3.3/src/config/mod.rs:
|
| 9 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bincode-1.3.3/src/config/endian.rs:
|
| 10 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bincode-1.3.3/src/config/int.rs:
|
| 11 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bincode-1.3.3/src/config/legacy.rs:
|
| 12 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bincode-1.3.3/src/config/limit.rs:
|
| 13 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bincode-1.3.3/src/config/trailing.rs:
|
| 14 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bincode-1.3.3/src/de/mod.rs:
|
| 15 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bincode-1.3.3/src/de/read.rs:
|
| 16 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bincode-1.3.3/src/byteorder.rs:
|
| 17 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bincode-1.3.3/src/error.rs:
|
| 18 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bincode-1.3.3/src/internal.rs:
|
| 19 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bincode-1.3.3/src/ser/mod.rs:
|
SPFsmartGATE/target/release/deps/block_buffer-1fd43fb02fa21913.d
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/data/data/com.termux/files/home/SPFsmartGATE/target/release/deps/block_buffer-1fd43fb02fa21913.d: /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/block-buffer-0.11.0/src/lib.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/block-buffer-0.11.0/src/read.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/block-buffer-0.11.0/src/sealed.rs
|
| 2 |
+
|
| 3 |
+
/data/data/com.termux/files/home/SPFsmartGATE/target/release/deps/libblock_buffer-1fd43fb02fa21913.rlib: /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/block-buffer-0.11.0/src/lib.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/block-buffer-0.11.0/src/read.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/block-buffer-0.11.0/src/sealed.rs
|
| 4 |
+
|
| 5 |
+
/data/data/com.termux/files/home/SPFsmartGATE/target/release/deps/libblock_buffer-1fd43fb02fa21913.rmeta: /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/block-buffer-0.11.0/src/lib.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/block-buffer-0.11.0/src/read.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/block-buffer-0.11.0/src/sealed.rs
|
| 6 |
+
|
| 7 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/block-buffer-0.11.0/src/lib.rs:
|
| 8 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/block-buffer-0.11.0/src/read.rs:
|
| 9 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/block-buffer-0.11.0/src/sealed.rs:
|
SPFsmartGATE/target/release/deps/cpufeatures-22990a68d05b45a9.d
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/data/data/com.termux/files/home/SPFsmartGATE/target/release/deps/cpufeatures-22990a68d05b45a9.d: /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/cpufeatures-0.2.17/src/lib.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/cpufeatures-0.2.17/src/aarch64.rs
|
| 2 |
+
|
| 3 |
+
/data/data/com.termux/files/home/SPFsmartGATE/target/release/deps/libcpufeatures-22990a68d05b45a9.rlib: /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/cpufeatures-0.2.17/src/lib.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/cpufeatures-0.2.17/src/aarch64.rs
|
| 4 |
+
|
| 5 |
+
/data/data/com.termux/files/home/SPFsmartGATE/target/release/deps/libcpufeatures-22990a68d05b45a9.rmeta: /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/cpufeatures-0.2.17/src/lib.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/cpufeatures-0.2.17/src/aarch64.rs
|
| 6 |
+
|
| 7 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/cpufeatures-0.2.17/src/lib.rs:
|
| 8 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/cpufeatures-0.2.17/src/aarch64.rs:
|
SPFsmartGATE/target/release/deps/enum_as_inner-fa0abcd5346ffccf.d
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/data/data/com.termux/files/home/SPFsmartGATE/target/release/deps/enum_as_inner-fa0abcd5346ffccf.d: /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/enum-as-inner-0.6.1/src/lib.rs
|
| 2 |
+
|
| 3 |
+
/data/data/com.termux/files/home/SPFsmartGATE/target/release/deps/libenum_as_inner-fa0abcd5346ffccf.so: /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/enum-as-inner-0.6.1/src/lib.rs
|
| 4 |
+
|
| 5 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/enum-as-inner-0.6.1/src/lib.rs:
|
SPFsmartGATE/target/release/deps/env_logger-e4ade51c72baa8c3.d
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/data/data/com.termux/files/home/SPFsmartGATE/target/release/deps/env_logger-e4ade51c72baa8c3.d: /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/env_logger-0.11.9/src/lib.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/env_logger-0.11.9/src/logger.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/env_logger-0.11.9/src/writer/mod.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/env_logger-0.11.9/src/writer/buffer.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/env_logger-0.11.9/src/writer/target.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/env_logger-0.11.9/src/fmt/mod.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/env_logger-0.11.9/src/fmt/humantime.rs
|
| 2 |
+
|
| 3 |
+
/data/data/com.termux/files/home/SPFsmartGATE/target/release/deps/libenv_logger-e4ade51c72baa8c3.rlib: /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/env_logger-0.11.9/src/lib.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/env_logger-0.11.9/src/logger.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/env_logger-0.11.9/src/writer/mod.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/env_logger-0.11.9/src/writer/buffer.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/env_logger-0.11.9/src/writer/target.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/env_logger-0.11.9/src/fmt/mod.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/env_logger-0.11.9/src/fmt/humantime.rs
|
| 4 |
+
|
| 5 |
+
/data/data/com.termux/files/home/SPFsmartGATE/target/release/deps/libenv_logger-e4ade51c72baa8c3.rmeta: /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/env_logger-0.11.9/src/lib.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/env_logger-0.11.9/src/logger.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/env_logger-0.11.9/src/writer/mod.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/env_logger-0.11.9/src/writer/buffer.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/env_logger-0.11.9/src/writer/target.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/env_logger-0.11.9/src/fmt/mod.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/env_logger-0.11.9/src/fmt/humantime.rs
|
| 6 |
+
|
| 7 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/env_logger-0.11.9/src/lib.rs:
|
| 8 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/env_logger-0.11.9/src/logger.rs:
|
| 9 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/env_logger-0.11.9/src/writer/mod.rs:
|
| 10 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/env_logger-0.11.9/src/writer/buffer.rs:
|
| 11 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/env_logger-0.11.9/src/writer/target.rs:
|
| 12 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/env_logger-0.11.9/src/fmt/mod.rs:
|
| 13 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/env_logger-0.11.9/src/fmt/humantime.rs:
|
SPFsmartGATE/target/release/deps/flume-24880077eb46faa3.d
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/data/data/com.termux/files/home/SPFsmartGATE/target/release/deps/flume-24880077eb46faa3.d: /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/flume-0.11.1/src/lib.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/flume-0.11.1/src/async.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/flume-0.11.1/src/signal.rs
|
| 2 |
+
|
| 3 |
+
/data/data/com.termux/files/home/SPFsmartGATE/target/release/deps/libflume-24880077eb46faa3.rlib: /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/flume-0.11.1/src/lib.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/flume-0.11.1/src/async.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/flume-0.11.1/src/signal.rs
|
| 4 |
+
|
| 5 |
+
/data/data/com.termux/files/home/SPFsmartGATE/target/release/deps/libflume-24880077eb46faa3.rmeta: /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/flume-0.11.1/src/lib.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/flume-0.11.1/src/async.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/flume-0.11.1/src/signal.rs
|
| 6 |
+
|
| 7 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/flume-0.11.1/src/lib.rs:
|
| 8 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/flume-0.11.1/src/async.rs:
|
| 9 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/flume-0.11.1/src/signal.rs:
|
SPFsmartGATE/target/release/deps/gemm_c32-ece014989bc9da11.d
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/data/data/com.termux/files/home/SPFsmartGATE/target/release/deps/gemm_c32-ece014989bc9da11.d: /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/gemm-c32-0.18.2/src/lib.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/gemm-c32-0.18.2/src/gemm.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/gemm-c32-0.18.2/src/microkernel.rs
|
| 2 |
+
|
| 3 |
+
/data/data/com.termux/files/home/SPFsmartGATE/target/release/deps/libgemm_c32-ece014989bc9da11.rlib: /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/gemm-c32-0.18.2/src/lib.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/gemm-c32-0.18.2/src/gemm.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/gemm-c32-0.18.2/src/microkernel.rs
|
| 4 |
+
|
| 5 |
+
/data/data/com.termux/files/home/SPFsmartGATE/target/release/deps/libgemm_c32-ece014989bc9da11.rmeta: /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/gemm-c32-0.18.2/src/lib.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/gemm-c32-0.18.2/src/gemm.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/gemm-c32-0.18.2/src/microkernel.rs
|
| 6 |
+
|
| 7 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/gemm-c32-0.18.2/src/lib.rs:
|
| 8 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/gemm-c32-0.18.2/src/gemm.rs:
|
| 9 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/gemm-c32-0.18.2/src/microkernel.rs:
|
SPFsmartGATE/target/release/deps/gemm_f16-1ff1780bc566065b.d
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/data/data/com.termux/files/home/SPFsmartGATE/target/release/deps/gemm_f16-1ff1780bc566065b.d: /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/gemm-f16-0.17.1/src/lib.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/gemm-f16-0.17.1/src/gemm.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/gemm-f16-0.17.1/src/microkernel.rs
|
| 2 |
+
|
| 3 |
+
/data/data/com.termux/files/home/SPFsmartGATE/target/release/deps/libgemm_f16-1ff1780bc566065b.rlib: /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/gemm-f16-0.17.1/src/lib.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/gemm-f16-0.17.1/src/gemm.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/gemm-f16-0.17.1/src/microkernel.rs
|
| 4 |
+
|
| 5 |
+
/data/data/com.termux/files/home/SPFsmartGATE/target/release/deps/libgemm_f16-1ff1780bc566065b.rmeta: /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/gemm-f16-0.17.1/src/lib.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/gemm-f16-0.17.1/src/gemm.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/gemm-f16-0.17.1/src/microkernel.rs
|
| 6 |
+
|
| 7 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/gemm-f16-0.17.1/src/lib.rs:
|
| 8 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/gemm-f16-0.17.1/src/gemm.rs:
|
| 9 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/gemm-f16-0.17.1/src/microkernel.rs:
|
SPFsmartGATE/target/release/deps/getrandom-5038c8a18bb88a61.d
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/data/data/com.termux/files/home/SPFsmartGATE/target/release/deps/getrandom-5038c8a18bb88a61.d: /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/getrandom-0.2.17/src/lib.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/getrandom-0.2.17/src/error.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/getrandom-0.2.17/src/util.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/getrandom-0.2.17/src/error_impls.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/getrandom-0.2.17/src/util_libc.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/getrandom-0.2.17/src/use_file.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/getrandom-0.2.17/src/lazy.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/getrandom-0.2.17/src/linux_android_with_fallback.rs
|
| 2 |
+
|
| 3 |
+
/data/data/com.termux/files/home/SPFsmartGATE/target/release/deps/libgetrandom-5038c8a18bb88a61.rlib: /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/getrandom-0.2.17/src/lib.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/getrandom-0.2.17/src/error.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/getrandom-0.2.17/src/util.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/getrandom-0.2.17/src/error_impls.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/getrandom-0.2.17/src/util_libc.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/getrandom-0.2.17/src/use_file.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/getrandom-0.2.17/src/lazy.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/getrandom-0.2.17/src/linux_android_with_fallback.rs
|
| 4 |
+
|
| 5 |
+
/data/data/com.termux/files/home/SPFsmartGATE/target/release/deps/libgetrandom-5038c8a18bb88a61.rmeta: /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/getrandom-0.2.17/src/lib.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/getrandom-0.2.17/src/error.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/getrandom-0.2.17/src/util.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/getrandom-0.2.17/src/error_impls.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/getrandom-0.2.17/src/util_libc.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/getrandom-0.2.17/src/use_file.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/getrandom-0.2.17/src/lazy.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/getrandom-0.2.17/src/linux_android_with_fallback.rs
|
| 6 |
+
|
| 7 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/getrandom-0.2.17/src/lib.rs:
|
| 8 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/getrandom-0.2.17/src/error.rs:
|
| 9 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/getrandom-0.2.17/src/util.rs:
|
| 10 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/getrandom-0.2.17/src/error_impls.rs:
|
| 11 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/getrandom-0.2.17/src/util_libc.rs:
|
| 12 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/getrandom-0.2.17/src/use_file.rs:
|
| 13 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/getrandom-0.2.17/src/lazy.rs:
|
| 14 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/getrandom-0.2.17/src/linux_android_with_fallback.rs:
|
SPFsmartGATE/target/release/deps/heed-599d6355aad4c0d8.d
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/data/data/com.termux/files/home/SPFsmartGATE/target/release/deps/heed-599d6355aad4c0d8.d: /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/heed-0.20.5/src/lib.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/heed-0.20.5/src/cookbook.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/heed-0.20.5/src/cursor.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/heed-0.20.5/src/database.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/heed-0.20.5/src/env.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/heed-0.20.5/src/iteration_method.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/heed-0.20.5/src/iterator/mod.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/heed-0.20.5/src/iterator/iter.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/heed-0.20.5/src/iterator/prefix.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/heed-0.20.5/src/iterator/range.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/heed-0.20.5/src/mdb/mod.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/heed-0.20.5/src/mdb/lmdb_error.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/heed-0.20.5/src/mdb/lmdb_ffi.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/heed-0.20.5/src/mdb/lmdb_flags.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/heed-0.20.5/src/reserved_space.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/heed-0.20.5/src/txn.rs
|
| 2 |
+
|
| 3 |
+
/data/data/com.termux/files/home/SPFsmartGATE/target/release/deps/libheed-599d6355aad4c0d8.rlib: /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/heed-0.20.5/src/lib.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/heed-0.20.5/src/cookbook.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/heed-0.20.5/src/cursor.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/heed-0.20.5/src/database.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/heed-0.20.5/src/env.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/heed-0.20.5/src/iteration_method.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/heed-0.20.5/src/iterator/mod.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/heed-0.20.5/src/iterator/iter.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/heed-0.20.5/src/iterator/prefix.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/heed-0.20.5/src/iterator/range.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/heed-0.20.5/src/mdb/mod.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/heed-0.20.5/src/mdb/lmdb_error.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/heed-0.20.5/src/mdb/lmdb_ffi.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/heed-0.20.5/src/mdb/lmdb_flags.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/heed-0.20.5/src/reserved_space.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/heed-0.20.5/src/txn.rs
|
| 4 |
+
|
| 5 |
+
/data/data/com.termux/files/home/SPFsmartGATE/target/release/deps/libheed-599d6355aad4c0d8.rmeta: /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/heed-0.20.5/src/lib.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/heed-0.20.5/src/cookbook.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/heed-0.20.5/src/cursor.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/heed-0.20.5/src/database.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/heed-0.20.5/src/env.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/heed-0.20.5/src/iteration_method.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/heed-0.20.5/src/iterator/mod.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/heed-0.20.5/src/iterator/iter.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/heed-0.20.5/src/iterator/prefix.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/heed-0.20.5/src/iterator/range.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/heed-0.20.5/src/mdb/mod.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/heed-0.20.5/src/mdb/lmdb_error.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/heed-0.20.5/src/mdb/lmdb_ffi.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/heed-0.20.5/src/mdb/lmdb_flags.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/heed-0.20.5/src/reserved_space.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/heed-0.20.5/src/txn.rs
|
| 6 |
+
|
| 7 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/heed-0.20.5/src/lib.rs:
|
| 8 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/heed-0.20.5/src/cookbook.rs:
|
| 9 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/heed-0.20.5/src/cursor.rs:
|
| 10 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/heed-0.20.5/src/database.rs:
|
| 11 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/heed-0.20.5/src/env.rs:
|
| 12 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/heed-0.20.5/src/iteration_method.rs:
|
| 13 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/heed-0.20.5/src/iterator/mod.rs:
|
| 14 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/heed-0.20.5/src/iterator/iter.rs:
|
| 15 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/heed-0.20.5/src/iterator/prefix.rs:
|
| 16 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/heed-0.20.5/src/iterator/range.rs:
|
| 17 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/heed-0.20.5/src/mdb/mod.rs:
|
| 18 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/heed-0.20.5/src/mdb/lmdb_error.rs:
|
| 19 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/heed-0.20.5/src/mdb/lmdb_ffi.rs:
|
| 20 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/heed-0.20.5/src/mdb/lmdb_flags.rs:
|
| 21 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/heed-0.20.5/src/reserved_space.rs:
|
| 22 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/heed-0.20.5/src/txn.rs:
|
SPFsmartGATE/target/release/deps/identity_hash-4f4cd40e6fd26760.d
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/data/data/com.termux/files/home/SPFsmartGATE/target/release/deps/identity_hash-4f4cd40e6fd26760.d: /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/identity-hash-0.1.0/src/lib.rs
|
| 2 |
+
|
| 3 |
+
/data/data/com.termux/files/home/SPFsmartGATE/target/release/deps/libidentity_hash-4f4cd40e6fd26760.rlib: /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/identity-hash-0.1.0/src/lib.rs
|
| 4 |
+
|
| 5 |
+
/data/data/com.termux/files/home/SPFsmartGATE/target/release/deps/libidentity_hash-4f4cd40e6fd26760.rmeta: /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/identity-hash-0.1.0/src/lib.rs
|
| 6 |
+
|
| 7 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/identity-hash-0.1.0/src/lib.rs:
|
SPFsmartGATE/target/release/deps/iroh_relay-7c98236e1ab9e153.d
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/data/data/com.termux/files/home/SPFsmartGATE/target/release/deps/iroh_relay-7c98236e1ab9e153.d: /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/iroh-relay-0.96.1/src/lib.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/iroh-relay-0.96.1/src/client.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/iroh-relay-0.96.1/src/client/conn.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/iroh-relay-0.96.1/src/client/streams.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/iroh-relay-0.96.1/src/client/tls.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/iroh-relay-0.96.1/src/client/util.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/iroh-relay-0.96.1/src/defaults.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/iroh-relay-0.96.1/src/http.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/iroh-relay-0.96.1/src/protos.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/iroh-relay-0.96.1/src/protos/common.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/iroh-relay-0.96.1/src/protos/handshake.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/iroh-relay-0.96.1/src/protos/relay.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/iroh-relay-0.96.1/src/protos/streams.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/iroh-relay-0.96.1/src/quic.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/iroh-relay-0.96.1/src/ping_tracker.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/iroh-relay-0.96.1/src/key_cache.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/iroh-relay-0.96.1/src/relay_map.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/iroh-relay-0.96.1/src/dns.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/iroh-relay-0.96.1/src/endpoint_info.rs
|
| 2 |
+
|
| 3 |
+
/data/data/com.termux/files/home/SPFsmartGATE/target/release/deps/libiroh_relay-7c98236e1ab9e153.rlib: /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/iroh-relay-0.96.1/src/lib.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/iroh-relay-0.96.1/src/client.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/iroh-relay-0.96.1/src/client/conn.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/iroh-relay-0.96.1/src/client/streams.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/iroh-relay-0.96.1/src/client/tls.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/iroh-relay-0.96.1/src/client/util.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/iroh-relay-0.96.1/src/defaults.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/iroh-relay-0.96.1/src/http.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/iroh-relay-0.96.1/src/protos.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/iroh-relay-0.96.1/src/protos/common.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/iroh-relay-0.96.1/src/protos/handshake.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/iroh-relay-0.96.1/src/protos/relay.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/iroh-relay-0.96.1/src/protos/streams.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/iroh-relay-0.96.1/src/quic.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/iroh-relay-0.96.1/src/ping_tracker.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/iroh-relay-0.96.1/src/key_cache.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/iroh-relay-0.96.1/src/relay_map.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/iroh-relay-0.96.1/src/dns.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/iroh-relay-0.96.1/src/endpoint_info.rs
|
| 4 |
+
|
| 5 |
+
/data/data/com.termux/files/home/SPFsmartGATE/target/release/deps/libiroh_relay-7c98236e1ab9e153.so: /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/iroh-relay-0.96.1/src/lib.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/iroh-relay-0.96.1/src/client.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/iroh-relay-0.96.1/src/client/conn.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/iroh-relay-0.96.1/src/client/streams.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/iroh-relay-0.96.1/src/client/tls.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/iroh-relay-0.96.1/src/client/util.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/iroh-relay-0.96.1/src/defaults.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/iroh-relay-0.96.1/src/http.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/iroh-relay-0.96.1/src/protos.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/iroh-relay-0.96.1/src/protos/common.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/iroh-relay-0.96.1/src/protos/handshake.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/iroh-relay-0.96.1/src/protos/relay.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/iroh-relay-0.96.1/src/protos/streams.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/iroh-relay-0.96.1/src/quic.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/iroh-relay-0.96.1/src/ping_tracker.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/iroh-relay-0.96.1/src/key_cache.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/iroh-relay-0.96.1/src/relay_map.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/iroh-relay-0.96.1/src/dns.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/iroh-relay-0.96.1/src/endpoint_info.rs
|
| 6 |
+
|
| 7 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/iroh-relay-0.96.1/src/lib.rs:
|
| 8 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/iroh-relay-0.96.1/src/client.rs:
|
| 9 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/iroh-relay-0.96.1/src/client/conn.rs:
|
| 10 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/iroh-relay-0.96.1/src/client/streams.rs:
|
| 11 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/iroh-relay-0.96.1/src/client/tls.rs:
|
| 12 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/iroh-relay-0.96.1/src/client/util.rs:
|
| 13 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/iroh-relay-0.96.1/src/defaults.rs:
|
| 14 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/iroh-relay-0.96.1/src/http.rs:
|
| 15 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/iroh-relay-0.96.1/src/protos.rs:
|
| 16 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/iroh-relay-0.96.1/src/protos/common.rs:
|
| 17 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/iroh-relay-0.96.1/src/protos/handshake.rs:
|
| 18 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/iroh-relay-0.96.1/src/protos/relay.rs:
|
| 19 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/iroh-relay-0.96.1/src/protos/streams.rs:
|
| 20 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/iroh-relay-0.96.1/src/quic.rs:
|
| 21 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/iroh-relay-0.96.1/src/ping_tracker.rs:
|
| 22 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/iroh-relay-0.96.1/src/key_cache.rs:
|
| 23 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/iroh-relay-0.96.1/src/relay_map.rs:
|
| 24 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/iroh-relay-0.96.1/src/dns.rs:
|
| 25 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/iroh-relay-0.96.1/src/endpoint_info.rs:
|
SPFsmartGATE/target/release/deps/libasync_compat-459c09c782c9c3e0.rmeta
ADDED
|
Binary file (64 kB). View file
|
|
|
SPFsmartGATE/target/release/deps/libbitflags-de2edf8204ece2d0.rmeta
ADDED
|
Binary file (43.9 kB). View file
|
|
|
SPFsmartGATE/target/release/deps/libblock_buffer-fef4c4e8c0125655.rlib
ADDED
|
Binary file (66.7 kB). View file
|
|
|
SPFsmartGATE/target/release/deps/libc-9ca04ee76f999f31.d
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/data/data/com.termux/files/home/SPFsmartGATE/target/release/deps/libc-9ca04ee76f999f31.d: /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/libc-0.2.182/src/lib.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/libc-0.2.182/src/macros.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/libc-0.2.182/src/new/mod.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/libc-0.2.182/src/new/common/mod.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/libc-0.2.182/src/new/common/linux_like/mod.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/libc-0.2.182/src/new/common/linux_like/pthread.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/libc-0.2.182/src/new/common/posix/mod.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/libc-0.2.182/src/new/common/posix/pthread.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/libc-0.2.182/src/new/common/posix/unistd.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/libc-0.2.182/src/new/bionic_libc/mod.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/libc-0.2.182/src/new/bionic_libc/pthread.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/libc-0.2.182/src/new/bionic_libc/sys/mod.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/libc-0.2.182/src/new/bionic_libc/sys/socket.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/libc-0.2.182/src/new/bionic_libc/unistd.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/libc-0.2.182/src/primitives.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/libc-0.2.182/src/unix/mod.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/libc-0.2.182/src/unix/linux_like/mod.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/libc-0.2.182/src/unix/linux_like/android/mod.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/libc-0.2.182/src/unix/linux_like/android/b64/mod.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/libc-0.2.182/src/unix/linux_like/android/b64/aarch64/mod.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/libc-0.2.182/src/types.rs
|
| 2 |
+
|
| 3 |
+
/data/data/com.termux/files/home/SPFsmartGATE/target/release/deps/liblibc-9ca04ee76f999f31.rlib: /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/libc-0.2.182/src/lib.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/libc-0.2.182/src/macros.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/libc-0.2.182/src/new/mod.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/libc-0.2.182/src/new/common/mod.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/libc-0.2.182/src/new/common/linux_like/mod.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/libc-0.2.182/src/new/common/linux_like/pthread.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/libc-0.2.182/src/new/common/posix/mod.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/libc-0.2.182/src/new/common/posix/pthread.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/libc-0.2.182/src/new/common/posix/unistd.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/libc-0.2.182/src/new/bionic_libc/mod.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/libc-0.2.182/src/new/bionic_libc/pthread.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/libc-0.2.182/src/new/bionic_libc/sys/mod.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/libc-0.2.182/src/new/bionic_libc/sys/socket.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/libc-0.2.182/src/new/bionic_libc/unistd.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/libc-0.2.182/src/primitives.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/libc-0.2.182/src/unix/mod.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/libc-0.2.182/src/unix/linux_like/mod.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/libc-0.2.182/src/unix/linux_like/android/mod.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/libc-0.2.182/src/unix/linux_like/android/b64/mod.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/libc-0.2.182/src/unix/linux_like/android/b64/aarch64/mod.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/libc-0.2.182/src/types.rs
|
| 4 |
+
|
| 5 |
+
/data/data/com.termux/files/home/SPFsmartGATE/target/release/deps/liblibc-9ca04ee76f999f31.rmeta: /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/libc-0.2.182/src/lib.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/libc-0.2.182/src/macros.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/libc-0.2.182/src/new/mod.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/libc-0.2.182/src/new/common/mod.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/libc-0.2.182/src/new/common/linux_like/mod.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/libc-0.2.182/src/new/common/linux_like/pthread.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/libc-0.2.182/src/new/common/posix/mod.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/libc-0.2.182/src/new/common/posix/pthread.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/libc-0.2.182/src/new/common/posix/unistd.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/libc-0.2.182/src/new/bionic_libc/mod.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/libc-0.2.182/src/new/bionic_libc/pthread.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/libc-0.2.182/src/new/bionic_libc/sys/mod.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/libc-0.2.182/src/new/bionic_libc/sys/socket.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/libc-0.2.182/src/new/bionic_libc/unistd.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/libc-0.2.182/src/primitives.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/libc-0.2.182/src/unix/mod.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/libc-0.2.182/src/unix/linux_like/mod.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/libc-0.2.182/src/unix/linux_like/android/mod.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/libc-0.2.182/src/unix/linux_like/android/b64/mod.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/libc-0.2.182/src/unix/linux_like/android/b64/aarch64/mod.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/libc-0.2.182/src/types.rs
|
| 6 |
+
|
| 7 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/libc-0.2.182/src/lib.rs:
|
| 8 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/libc-0.2.182/src/macros.rs:
|
| 9 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/libc-0.2.182/src/new/mod.rs:
|
| 10 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/libc-0.2.182/src/new/common/mod.rs:
|
| 11 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/libc-0.2.182/src/new/common/linux_like/mod.rs:
|
| 12 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/libc-0.2.182/src/new/common/linux_like/pthread.rs:
|
| 13 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/libc-0.2.182/src/new/common/posix/mod.rs:
|
| 14 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/libc-0.2.182/src/new/common/posix/pthread.rs:
|
| 15 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/libc-0.2.182/src/new/common/posix/unistd.rs:
|
| 16 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/libc-0.2.182/src/new/bionic_libc/mod.rs:
|
| 17 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/libc-0.2.182/src/new/bionic_libc/pthread.rs:
|
| 18 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/libc-0.2.182/src/new/bionic_libc/sys/mod.rs:
|
| 19 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/libc-0.2.182/src/new/bionic_libc/sys/socket.rs:
|
| 20 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/libc-0.2.182/src/new/bionic_libc/unistd.rs:
|
| 21 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/libc-0.2.182/src/primitives.rs:
|
| 22 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/libc-0.2.182/src/unix/mod.rs:
|
| 23 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/libc-0.2.182/src/unix/linux_like/mod.rs:
|
| 24 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/libc-0.2.182/src/unix/linux_like/android/mod.rs:
|
| 25 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/libc-0.2.182/src/unix/linux_like/android/b64/mod.rs:
|
| 26 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/libc-0.2.182/src/unix/linux_like/android/b64/aarch64/mod.rs:
|
| 27 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/libc-0.2.182/src/types.rs:
|
SPFsmartGATE/target/release/deps/libcfg_aliases-3b2a20d804f039d0.rlib
ADDED
|
Binary file (19.6 kB). View file
|
|
|
SPFsmartGATE/target/release/deps/libcfg_if-a1ecffbcf4d152cf.rmeta
ADDED
|
Binary file (5.35 kB). View file
|
|
|
SPFsmartGATE/target/release/deps/libderive_builder-ecf70bb540c59829.rmeta
ADDED
|
Binary file (38 kB). View file
|
|
|
SPFsmartGATE/target/release/deps/libdunce-c1a93e1a1085d531.rmeta
ADDED
|
Binary file (8.89 kB). View file
|
|
|
SPFsmartGATE/target/release/deps/libdyn_clone-3343f469a28d1f9e.rmeta
ADDED
|
Binary file (36.2 kB). View file
|
|
|
SPFsmartGATE/target/release/deps/libenv_filter-c8aaa0d4517da6c7.rmeta
ADDED
|
Binary file (48 kB). View file
|
|
|
SPFsmartGATE/target/release/deps/libfoldhash-ca3284e54d485ca1.rmeta
ADDED
|
Binary file (93.6 kB). View file
|
|
|
SPFsmartGATE/target/release/deps/libheed_types-4e22c4aab5682284.rmeta
ADDED
|
Binary file (90.7 kB). View file
|
|
|
SPFsmartGATE/target/release/deps/libident_case-0c69e375e8bec18e.rlib
ADDED
|
Binary file (22.7 kB). View file
|
|
|
SPFsmartGATE/target/release/deps/liblru_slab-196cb84e947f054f.rmeta
ADDED
|
Binary file (60.2 kB). View file
|
|
|
SPFsmartGATE/target/release/deps/liblru_slab-461f698985939b32.rlib
ADDED
|
Binary file (64.7 kB). View file
|
|
|
SPFsmartGATE/target/release/deps/libntimestamp-18b49112b7ca2ba0.rlib
ADDED
|
Binary file (92 kB). View file
|
|
|
SPFsmartGATE/target/release/deps/libpage_size-b785e96605adb245.rlib
ADDED
|
Binary file (13.3 kB). View file
|
|
|
SPFsmartGATE/target/release/deps/libphf_generator-df7def3e7014cfd1.rlib
ADDED
|
Binary file (19.6 kB). View file
|
|
|
SPFsmartGATE/target/release/deps/libsame_file-2fd8175d7c58a54d.rmeta
ADDED
|
Binary file (35.5 kB). View file
|
|
|
SPFsmartGATE/target/release/deps/libself_cell-2469a2c858171ad7.rlib
ADDED
|
Binary file (76.7 kB). View file
|
|
|
SPFsmartGATE/target/release/deps/libsignature-7b16811c88300a57.rmeta
ADDED
|
Binary file (59.6 kB). View file
|
|
|
SPFsmartGATE/target/release/deps/libthiserror-8e6dac04e13891a0.rmeta
ADDED
|
Binary file (32.6 kB). View file
|
|
|
SPFsmartGATE/target/release/deps/libuntrusted-ffbc123450b35f34.rmeta
ADDED
|
Binary file (47.7 kB). View file
|
|
|
SPFsmartGATE/target/release/deps/libzerofrom-9d24aee5c798916e.rlib
ADDED
|
Binary file (87.8 kB). View file
|
|
|
SPFsmartGATE/target/release/deps/mac_addr-41d99f64f723d378.d
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/data/data/com.termux/files/home/SPFsmartGATE/target/release/deps/mac_addr-41d99f64f723d378.d: /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/mac-addr-0.3.0/src/lib.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/mac-addr-0.3.0/src/addr.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/mac-addr-0.3.0/src/addr8.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/mac-addr-0.3.0/src/error.rs
|
| 2 |
+
|
| 3 |
+
/data/data/com.termux/files/home/SPFsmartGATE/target/release/deps/libmac_addr-41d99f64f723d378.rlib: /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/mac-addr-0.3.0/src/lib.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/mac-addr-0.3.0/src/addr.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/mac-addr-0.3.0/src/addr8.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/mac-addr-0.3.0/src/error.rs
|
| 4 |
+
|
| 5 |
+
/data/data/com.termux/files/home/SPFsmartGATE/target/release/deps/libmac_addr-41d99f64f723d378.rmeta: /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/mac-addr-0.3.0/src/lib.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/mac-addr-0.3.0/src/addr.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/mac-addr-0.3.0/src/addr8.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/mac-addr-0.3.0/src/error.rs
|
| 6 |
+
|
| 7 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/mac-addr-0.3.0/src/lib.rs:
|
| 8 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/mac-addr-0.3.0/src/addr.rs:
|
| 9 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/mac-addr-0.3.0/src/addr8.rs:
|
| 10 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/mac-addr-0.3.0/src/error.rs:
|
SPFsmartGATE/target/release/deps/n0_watcher-ac8808f14fd4c6e0.d
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/data/data/com.termux/files/home/SPFsmartGATE/target/release/deps/n0_watcher-ac8808f14fd4c6e0.d: /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/n0-watcher-0.6.1/src/lib.rs
|
| 2 |
+
|
| 3 |
+
/data/data/com.termux/files/home/SPFsmartGATE/target/release/deps/libn0_watcher-ac8808f14fd4c6e0.rlib: /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/n0-watcher-0.6.1/src/lib.rs
|
| 4 |
+
|
| 5 |
+
/data/data/com.termux/files/home/SPFsmartGATE/target/release/deps/libn0_watcher-ac8808f14fd4c6e0.rmeta: /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/n0-watcher-0.6.1/src/lib.rs
|
| 6 |
+
|
| 7 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/n0-watcher-0.6.1/src/lib.rs:
|
SPFsmartGATE/target/release/deps/netlink_packet_core-77fef4f42dda30c0.d
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/data/data/com.termux/files/home/SPFsmartGATE/target/release/deps/netlink_packet_core-77fef4f42dda30c0.d: /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/netlink-packet-core-0.8.1/src/lib.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/netlink-packet-core-0.8.1/src/buffer.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/netlink-packet-core-0.8.1/src/constants.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/netlink-packet-core-0.8.1/src/done.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/netlink-packet-core-0.8.1/src/error.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/netlink-packet-core-0.8.1/src/header.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/netlink-packet-core-0.8.1/src/message.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/netlink-packet-core-0.8.1/src/nla.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/netlink-packet-core-0.8.1/src/parsers.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/netlink-packet-core-0.8.1/src/payload.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/netlink-packet-core-0.8.1/src/traits.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/netlink-packet-core-0.8.1/src/macros.rs
|
| 2 |
+
|
| 3 |
+
/data/data/com.termux/files/home/SPFsmartGATE/target/release/deps/libnetlink_packet_core-77fef4f42dda30c0.rlib: /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/netlink-packet-core-0.8.1/src/lib.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/netlink-packet-core-0.8.1/src/buffer.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/netlink-packet-core-0.8.1/src/constants.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/netlink-packet-core-0.8.1/src/done.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/netlink-packet-core-0.8.1/src/error.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/netlink-packet-core-0.8.1/src/header.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/netlink-packet-core-0.8.1/src/message.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/netlink-packet-core-0.8.1/src/nla.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/netlink-packet-core-0.8.1/src/parsers.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/netlink-packet-core-0.8.1/src/payload.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/netlink-packet-core-0.8.1/src/traits.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/netlink-packet-core-0.8.1/src/macros.rs
|
| 4 |
+
|
| 5 |
+
/data/data/com.termux/files/home/SPFsmartGATE/target/release/deps/libnetlink_packet_core-77fef4f42dda30c0.rmeta: /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/netlink-packet-core-0.8.1/src/lib.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/netlink-packet-core-0.8.1/src/buffer.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/netlink-packet-core-0.8.1/src/constants.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/netlink-packet-core-0.8.1/src/done.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/netlink-packet-core-0.8.1/src/error.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/netlink-packet-core-0.8.1/src/header.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/netlink-packet-core-0.8.1/src/message.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/netlink-packet-core-0.8.1/src/nla.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/netlink-packet-core-0.8.1/src/parsers.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/netlink-packet-core-0.8.1/src/payload.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/netlink-packet-core-0.8.1/src/traits.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/netlink-packet-core-0.8.1/src/macros.rs
|
| 6 |
+
|
| 7 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/netlink-packet-core-0.8.1/src/lib.rs:
|
| 8 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/netlink-packet-core-0.8.1/src/buffer.rs:
|
| 9 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/netlink-packet-core-0.8.1/src/constants.rs:
|
| 10 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/netlink-packet-core-0.8.1/src/done.rs:
|
| 11 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/netlink-packet-core-0.8.1/src/error.rs:
|
| 12 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/netlink-packet-core-0.8.1/src/header.rs:
|
| 13 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/netlink-packet-core-0.8.1/src/message.rs:
|
| 14 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/netlink-packet-core-0.8.1/src/nla.rs:
|
| 15 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/netlink-packet-core-0.8.1/src/parsers.rs:
|
| 16 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/netlink-packet-core-0.8.1/src/payload.rs:
|
| 17 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/netlink-packet-core-0.8.1/src/traits.rs:
|
| 18 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/netlink-packet-core-0.8.1/src/macros.rs:
|
SPFsmartGATE/target/release/deps/num_complex-1728c1a399d50012.d
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/data/data/com.termux/files/home/SPFsmartGATE/target/release/deps/num_complex-1728c1a399d50012.d: /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/num-complex-0.4.6/src/lib.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/num-complex-0.4.6/src/cast.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/num-complex-0.4.6/src/pow.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/num-complex-0.4.6/src/complex_float.rs
|
| 2 |
+
|
| 3 |
+
/data/data/com.termux/files/home/SPFsmartGATE/target/release/deps/libnum_complex-1728c1a399d50012.rlib: /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/num-complex-0.4.6/src/lib.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/num-complex-0.4.6/src/cast.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/num-complex-0.4.6/src/pow.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/num-complex-0.4.6/src/complex_float.rs
|
| 4 |
+
|
| 5 |
+
/data/data/com.termux/files/home/SPFsmartGATE/target/release/deps/libnum_complex-1728c1a399d50012.rmeta: /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/num-complex-0.4.6/src/lib.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/num-complex-0.4.6/src/cast.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/num-complex-0.4.6/src/pow.rs /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/num-complex-0.4.6/src/complex_float.rs
|
| 6 |
+
|
| 7 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/num-complex-0.4.6/src/lib.rs:
|
| 8 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/num-complex-0.4.6/src/cast.rs:
|
| 9 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/num-complex-0.4.6/src/pow.rs:
|
| 10 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/num-complex-0.4.6/src/complex_float.rs:
|
SPFsmartGATE/target/release/deps/num_conv-07a02c09d5e60300.d
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/data/data/com.termux/files/home/SPFsmartGATE/target/release/deps/num_conv-07a02c09d5e60300.d: /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/num-conv-0.2.0/src/lib.rs
|
| 2 |
+
|
| 3 |
+
/data/data/com.termux/files/home/SPFsmartGATE/target/release/deps/libnum_conv-07a02c09d5e60300.rlib: /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/num-conv-0.2.0/src/lib.rs
|
| 4 |
+
|
| 5 |
+
/data/data/com.termux/files/home/SPFsmartGATE/target/release/deps/libnum_conv-07a02c09d5e60300.rmeta: /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/num-conv-0.2.0/src/lib.rs
|
| 6 |
+
|
| 7 |
+
/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/num-conv-0.2.0/src/lib.rs:
|