feat: add lesson export and import functionality
- Implemented `LessonExport` and `LessonImport` actions in the action module. - Added corresponding command parsing for lesson export and import. - Created functions to handle lesson export and import in the memory module. - Updated state management to reflect changes after lesson operations. - Introduced deferred operations for handling asynchronous tasks in the event loop. - Enhanced the tool execution context to include graduated checks for file operations. - Added OAuth support with PKCE for secure authorization flows. - Implemented a loopback server for handling OAuth redirects. - Refactored various modules to improve code organization and maintainability.
This commit is contained in:
+23
@@ -127,6 +127,8 @@ fn _wire_models() -> Result<()> {
|
||||
let _ = model::session::Session::load("sid", base_dir);
|
||||
let _ = model::session::Session::list(base_dir);
|
||||
let _ = model::memory::create_retrospective(base_dir, &_session, &[_mem]);
|
||||
let _ = model::memory::export_lessons(base_dir, &std::path::PathBuf::from("/tmp/test-lessons.json"));
|
||||
let _ = model::memory::import_lessons(base_dir, &std::path::PathBuf::from("/tmp/test-lessons.json"));
|
||||
|
||||
// OpenRouterClient
|
||||
let _orc = service::openrouter::OpenRouterClient::new("key".to_string(), "model".to_string());
|
||||
@@ -134,6 +136,23 @@ fn _wire_models() -> Result<()> {
|
||||
let _ = &_orc.model;
|
||||
let _ = _orc.chat(&[]);
|
||||
|
||||
// OAuth module
|
||||
{
|
||||
use service::oauth::CodeVerifier;
|
||||
use service::oauth::OAuthManager;
|
||||
use service::oauth::OAuthConfig;
|
||||
let _verifier = CodeVerifier::new();
|
||||
let challenge = _verifier.challenge();
|
||||
let _ = challenge.as_str();
|
||||
if let Ok(_server) = service::oauth::LoopbackServer::bind() {
|
||||
let _ = _server.port();
|
||||
let _ = _server.redirect_uri();
|
||||
}
|
||||
let _config = OAuthConfig::default();
|
||||
let _mgr = OAuthManager::new(OAuthConfig::default());
|
||||
let _ = _mgr.build_auth_url("http://localhost:0/callback", "state", challenge.as_str());
|
||||
}
|
||||
|
||||
let _ = _mem;
|
||||
let _ = _cfg;
|
||||
let _ = _provider_cfg;
|
||||
@@ -191,6 +210,10 @@ fn main() -> Result<()> {
|
||||
let _ = &ctx.download_dir;
|
||||
let _ = &ctx.dir_cache;
|
||||
let _ = &ctx.origin;
|
||||
let _ = &ctx.graduated_checks;
|
||||
|
||||
let _ = tool::GraduatedCheck { name: "test".to_string(), pattern: "test".to_string(), rule: "test".to_string() };
|
||||
let _ = tool::check_graduated_checks("/tmp/test", "content", &[]);
|
||||
|
||||
let _tools = tool::all_tools();
|
||||
for _t in &_tools {
|
||||
|
||||
Reference in New Issue
Block a user