Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
nicarq committed Dec 20, 2024
1 parent 951d6b6 commit fc8add6
Show file tree
Hide file tree
Showing 14 changed files with 641 additions and 381 deletions.
4 changes: 2 additions & 2 deletions shinkai-bin/shinkai-node/src/managers/sheet_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use shinkai_message_primitives::schemas::ws_types::{WSMessageType, WSUpdateHandl
use shinkai_message_primitives::shinkai_message::shinkai_message_schemas::{
CallbackAction, JobCreationInfo, JobMessage, SheetJobAction, SheetManagerAction, WSTopic,
};
use shinkai_message_primitives::shinkai_utils::job_scope::JobScope;
use shinkai_message_primitives::shinkai_utils::job_scope::MinimalJobScope;
use shinkai_sheet::cell_name_converter::CellNameConverter;
use shinkai_sheet::sheet::{Sheet, SheetUpdate};
use shinkai_sqlite::errors::SqliteManagerError;
Expand Down Expand Up @@ -209,7 +209,7 @@ impl SheetManager {

for job_data in jobs {
let job_creation_info = JobCreationInfo {
scope: JobScope::new_default(),
scope: MinimalJobScope::default(),
is_hidden: Some(true),
associated_ui: None,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ use shinkai_http_api::{
node_api_router::{APIError, GetPublicKeysResponse},
};
use shinkai_message_primitives::{
schemas::ws_types::WSUpdateHandler,
shinkai_message::shinkai_message_schemas::{CallbackAction, JobCreationInfo},
schemas::ws_types::WSUpdateHandler, shinkai_message::shinkai_message_schemas::JobCreationInfo,
shinkai_utils::job_scope::MinimalJobScope,
};
use shinkai_message_primitives::{
Expand All @@ -34,10 +33,6 @@ use shinkai_message_primitives::{
},
};
use shinkai_sqlite::SqliteManager;
use shinkai_vector_fs::vector_fs::vector_fs::VectorFS;
use shinkai_vector_resources::{
embedding_generator::RemoteEmbeddingGenerator, model_type::EmbeddingModelType, shinkai_time::ShinkaiStringTime,
};
use tokio::sync::Mutex;
use x25519_dalek::PublicKey as EncryptionPublicKey;

Expand Down Expand Up @@ -1450,7 +1445,7 @@ impl Node {
match tool_generation::v2_create_and_send_job_message(
bearer.clone(),
JobCreationInfo {
scope: JobScope::new_default(),
scope: MinimalJobScope::default(),
is_hidden: Some(true),
associated_ui: None,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1206,7 +1206,7 @@ impl Node {

// We auto create a new job with the same configuration as the one from job_id
let job_creation_info = JobCreationInfo {
scope: job.scope_with_files().cloned().unwrap_or(JobScope::new_default()),
scope: job.scope().clone(),
is_hidden: Some(job.is_hidden()),
associated_ui: None,
};
Expand Down Expand Up @@ -1687,8 +1687,7 @@ impl Node {
};

// Save the tool to the database
let mut db_write = db;
match db_write.add_tool(tool).await {
match db.add_tool(tool).await {
Ok(tool) => {
let archive_clone = archive.clone();
let files = archive_clone.file_names();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use shinkai_message_primitives::{
shinkai_utils::shinkai_path::ShinkaiPath,
};
use shinkai_sqlite::SqliteManager;
use tokio::sync::{Mutex, RwLock};
use tokio::sync::Mutex;

use crate::{
managers::IdentityManager,
Expand Down Expand Up @@ -684,7 +684,7 @@ impl Node {
}
};

let search_path_str = input_payload.path.as_deref().unwrap_or("/").clone();
let search_path_str = input_payload.path.as_deref().unwrap_or("/").to_string();
let search_path = match ShinkaiPath::from_string(search_path_str) {
Ok(path) => path,
Err(e) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ impl ToolExecutor for LmPromptProcessorTool {
let response = v2_create_and_send_job_message(
bearer.clone(),
JobCreationInfo {
scope: JobScope::new_default(),
scope: MinimalJobScope::default(),
is_hidden: Some(true),
associated_ui: None,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ impl ToolExecutor for KnowledgeTool {
// TODO: how do we use app_id here? is it linked to a job somehow?
// TODO: create e2e test using this fn so we can test it with some real data

let mut scope = JobScope::new_default();
let mut scope = MinimalJobScope::default();

// Checks if job_id is provided in the parameters
if let Some(job_id_value) = parameters.get("job_id") {
Expand Down
26 changes: 13 additions & 13 deletions shinkai-bin/shinkai-node/tests/it/db_job_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ mod tests {
async fn test_create_new_job() {
let job_id = "job1".to_string();
let agent_id = "agent1".to_string();
let scope = JobScope::new_default();
let scope = MinimalJobScope::default();
let db = setup_test_db();
let shinkai_db = Arc::new(db);

Expand Down Expand Up @@ -125,7 +125,7 @@ mod tests {
for i in 1..=5 {
let job_id = format!("job{}", i);
eprintln!("job_id: {}", job_id.clone());
let scope = JobScope::new_default();
let scope = MinimalJobScope::default();
let _ = create_new_job(&shinkai_db, job_id, agent_id.clone(), scope).await;
}

Expand All @@ -148,7 +148,7 @@ mod tests {
let job_id = "job_to_change_agent".to_string();
let initial_agent_id = "initial_agent".to_string();
let new_agent_id = "new_agent".to_string();
let scope = JobScope::new_default();
let scope = MinimalJobScope::default();
let db = setup_test_db();
let shinkai_db = Arc::new(db);

Expand Down Expand Up @@ -180,7 +180,7 @@ mod tests {
// let inbox_name =
// InboxName::new("inbox::@@node1.shinkai/subidentity::@@node2.shinkai/subidentity2::true".to_string())
// .unwrap();
let scope = JobScope::new_default();
let scope = MinimalJobScope::default();
let db = setup_test_db();
let shinkai_db = Arc::new(db);

Expand All @@ -207,7 +207,7 @@ mod tests {
let (node1_encryption_sk, node1_encryption_pk) = unsafe_deterministic_encryption_keypair(0);

let agent_id = "agent_test".to_string();
let scope = JobScope::new_default();
let scope = MinimalJobScope::default();

// Create a new job
let _ = create_new_job(&shinkai_db, job_id.clone(), agent_id.clone(), scope).await;
Expand Down Expand Up @@ -318,7 +318,7 @@ mod tests {
// let inbox_names = vec![inbox_name];
// let documents = vec!["document1".to_string(), "document2".to_string()];

let scope = JobScope::new_default();
let scope = MinimalJobScope::default();
let _ = create_new_job(&shinkai_db, job_id, agent_id.clone(), scope).await;
}

Expand All @@ -337,7 +337,7 @@ mod tests {
async fn test_job_inbox_empty() {
let job_id = "job_test".to_string();
let agent_id = "agent_test".to_string();
let scope = JobScope::new_default();
let scope = MinimalJobScope::default();
let db = setup_test_db();
let shinkai_db = Arc::new(db);

Expand Down Expand Up @@ -372,7 +372,7 @@ mod tests {
async fn test_job_inbox_tree_structure() {
let job_id = "job_test".to_string();
let agent_id = "agent_test".to_string();
let scope = JobScope::new_default();
let scope = MinimalJobScope::default();
let db = setup_test_db();
let shinkai_db = Arc::new(db);

Expand Down Expand Up @@ -468,7 +468,7 @@ mod tests {
async fn test_job_inbox_tree_structure_with_step_history_and_execution_context() {
let job_id = "job_test".to_string();
let agent_id = "agent_test".to_string();
let scope = JobScope::new_default();
let scope = MinimalJobScope::default();
let db = setup_test_db();
let shinkai_db = Arc::new(db);

Expand Down Expand Up @@ -609,7 +609,7 @@ mod tests {

let job_id = "test_job";
let agent_id = "agent_test".to_string();
let scope = JobScope::new_default();
let scope = MinimalJobScope::default();

let db = setup_test_db();
let shinkai_db = Arc::new(db);
Expand Down Expand Up @@ -760,7 +760,7 @@ mod tests {
async fn test_job_inbox_tree_structure_with_invalid_date() {
let job_id = "job_test".to_string();
let agent_id = "agent_test".to_string();
let scope = JobScope::new_default();
let scope = MinimalJobScope::default();
let db = setup_test_db();
let shinkai_db = Arc::new(db);

Expand Down Expand Up @@ -843,7 +843,7 @@ mod tests {
async fn test_add_forked_job() {
let job_id = "job1".to_string();
let agent_id = "agent1".to_string();
let scope = JobScope::new_default();
let scope = MinimalJobScope::default();
let db = setup_test_db();
let shinkai_db = Arc::new(db);

Expand Down Expand Up @@ -953,7 +953,7 @@ mod tests {
let job1_id = "job1".to_string();
let job2_id = "job2".to_string();
let agent_id = "agent1".to_string();
let scope = JobScope::new_default();
let scope = MinimalJobScope::default();
let db = setup_test_db();
let shinkai_db = Arc::new(db);

Expand Down
2 changes: 1 addition & 1 deletion shinkai-bin/shinkai-node/tests/it/utils/node_test_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ pub async fn api_create_job(
sender_subidentity: &str,
recipient_subidentity: &str,
) -> String {
let job_scope = JobScope::new_default();
let job_scope = MinimalJobScope::default();
api_create_job_with_scope(
node_commands_sender,
subidentity_encryption_sk,
Expand Down
4 changes: 2 additions & 2 deletions shinkai-bin/shinkai-node/tests/it/websocket_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ async fn test_websocket() {
};

let _ = shinkai_db.insert_profile(sender_subidentity.clone());
let scope = JobScope::new_default();
let scope = MinimalJobScope::default();
match shinkai_db.create_new_job(job_id1, agent_id.clone(), scope.clone(), false, None, None) {
Ok(_) => (),
Err(e) => panic!("Failed to create a new job: {}", e),
Expand Down Expand Up @@ -562,7 +562,7 @@ async fn test_websocket_smart_inbox() {
};

let _ = shinkai_db.insert_profile(sender_subidentity.clone());
let scope = JobScope::new_default();
let scope = MinimalJobScope::default();
match shinkai_db.create_new_job(job_id1, agent_id.clone(), scope.clone(), false, None, None) {
Ok(_) => (),
Err(e) => panic!("Failed to create a new job: {}", e),
Expand Down
3 changes: 2 additions & 1 deletion shinkai-libs/shinkai-fs/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// pub mod file_parser;
pub mod shinkai_fs_error;
pub mod shinkai_file_manager;
pub mod shinkai_file_manager;
pub mod shinkai_file_manager_ops;
Loading

0 comments on commit fc8add6

Please sign in to comment.