Refactor and clean up code across multiple modules

- Simplified token type assignment in OAuth service.
- Removed unused session_lock module and re-exported Session from zesdex_entities.
- Cleaned up session entity by removing unnecessary comments and code.
- Consolidated session handling in HTTP handlers for better readability.
- Improved formatting and readability in OAuth repository tests.
- Enhanced session lock repository with clearer match statements.
- Streamlined session repository error handling.
- Refined RNG tests for better clarity.
- Adjusted module visibility and organization in lib.rs.
- Updated IPC client and connection code for better error handling and clarity.
- Improved frame handling in IPC for better readability.
- Organized module imports and added test utilities for IPC.
- Enhanced database connection error handling.
- Simplified JWT token creation error handling.
- Improved password verification error handling.
- Cleaned up state management code for better readability.
- Refactored middleware for session authentication and rate limiting.
- Simplified clipboard utility for better error handling.
- Enhanced logging initialization for better error reporting.
- Improved pagination utility with clearer method annotations.
- Cleaned up sanitization functions for filenames and paths.
- Enhanced slug generation functions for better clarity and usability.
This commit is contained in:
asepharyana
2026-07-17 09:08:41 +07:00
parent 22dd6fdda7
commit 1f0ae9f551
95 changed files with 1792 additions and 2131 deletions
+5 -14
View File
@@ -58,13 +58,10 @@ impl Tool for WorkflowRun {
/// Return: the workflow engine's output string, or an error if the
/// script argument is missing or fails to parse as JSON.
fn run(&self, ctx: &ToolCtx, args: &Value) -> Result<String> {
let script_str = args
.get("script")
.and_then(|v| v.as_str())
.ok_or_else(|| anyhow!("missing required argument: script"))?;
let script_str = crate::tool::arg_str(args, "script")?;
let workflow_script: crate::app::workflow::script::WorkflowScript =
serde_json::from_str(script_str)
serde_json::from_str(&script_str)
.map_err(|e| anyhow!("failed to parse workflow script: {e}"))?;
let workflow_args: std::collections::HashMap<String, String> = args
@@ -125,10 +122,7 @@ impl Tool for NoteFinding {
/// Return: confirmation string containing up to the first 80 chars
/// of the recorded text.
fn run(&self, ctx: &ToolCtx, args: &Value) -> Result<String> {
let text = args
.get("text")
.and_then(|v| v.as_str())
.ok_or_else(|| anyhow!("missing required argument: text"))?;
let text = crate::tool::arg_str(args, "text")?;
if let Some(ref findings) = ctx.workflow_findings {
if let Ok(mut f) = findings.lock() {
@@ -211,10 +205,7 @@ impl Tool for HiveMind {
}
fn run(&self, ctx: &ToolCtx, args: &Value) -> Result<String> {
let request = args
.get("request")
.and_then(|v| v.as_str())
.ok_or_else(|| anyhow!("missing required argument: request"))?;
let request = crate::tool::arg_str(args, "request")?;
let cycles_value = args
.get("cycles")
@@ -228,7 +219,7 @@ impl Tool for HiveMind {
// itself (guaranteed, even if synthesis fails) — do not write it
// again here.
let (consensus, _reports) = crate::app::workflow::hive_mind::run_hive_mind(
request,
&request,
&plan,
&ctx.session_dir,
&ctx.workspaces,