@@ -10,11 +10,11 @@ def __init__(self):
1010 )
1111 self .client = httpx .Client (base_url = self .base_url , timeout = 30.0 )
1212
13- def search (self , query : str , top_k : int = 3 , type_filter : str = None ):
14- payload = {"query" : query , "top_k " : top_k }
15- if type_filter :
16- payload ["type " ] = type_filter
17-
13+ def search (self , query : str , limit : int = 3 , category : str = None ):
14+ payload : dict = {"query" : query , "limit " : limit }
15+ if category :
16+ payload ["category " ] = category
17+
1818 response = self .client .post ("/search" , json = payload )
1919 response .raise_for_status ()
2020 return response .json ()
@@ -37,13 +37,11 @@ def get_status(self):
3737 response .raise_for_status ()
3838 return response .json ()
3939
40- def get_diff (self , file_path : str = None , commits : int = None ):
41- params = {}
42- if file_path :
43- params ["file" ] = file_path
44- if commits :
45- params ["commits" ] = commits
46-
40+ def get_diff (self , days : int = 7 , paths : str = None ):
41+ params : dict = {"days" : days }
42+ if paths :
43+ params ["paths" ] = paths
44+
4745 response = self .client .get ("/diff" , params = params )
4846 response .raise_for_status ()
4947 return response .json ()
@@ -53,23 +51,23 @@ def consolidate(self, dry_run: bool = False, nightly: bool = False):
5351 response .raise_for_status ()
5452 return response .json ()
5553
56- def trigger_add (self , description : str , file_path : str , threshold : float = 0.4 ):
57- payload = {
54+ def trigger_add (self , description : str , memory_file : str , threshold : float = 0.75 ):
55+ payload : dict = {
5856 "description" : description ,
59- "file " : file_path ,
60- "threshold" : threshold
57+ "memory_file " : memory_file ,
58+ "threshold" : threshold ,
6159 }
62- response = self .client .post ("/trigger/add " , json = payload )
60+ response = self .client .post ("/triggers " , json = payload )
6361 response .raise_for_status ()
6462 return response .json ()
6563
6664 def trigger_list (self ):
67- response = self .client .get ("/trigger/list " )
65+ response = self .client .get ("/triggers " )
6866 response .raise_for_status ()
6967 return response .json ()
7068
7169 def trigger_remove (self , trigger_id : str ):
72- response = self .client .delete (f"/trigger/remove /{ trigger_id } " )
70+ response = self .client .delete (f"/triggers /{ trigger_id } " )
7371 response .raise_for_status ()
7472 return response .json ()
7573
@@ -121,22 +119,30 @@ def migrate_mem0(self):
121119 return response .json ()
122120
123121 def blame (self , file_path : str , search : str = None ):
124- # We need git_tools for these if they are not exposed by API yet
125- # But for now, let's assume they are or we handle them
126- from palinode .core import git_tools
127- return git_tools .blame (file_path , search )
122+ params : dict = {}
123+ if search :
124+ params ["search" ] = search
125+ response = self .client .get (f"/blame/{ file_path } " , params = params , timeout = 10.0 )
126+ response .raise_for_status ()
127+ return response .json ()
128128
129129 def timeline (self , file_path : str , limit : int = 20 ):
130- from palinode .core import git_tools
131- return git_tools .timeline (file_path , limit )
130+ response = self .client .get (f"/timeline/{ file_path } " , params = {"limit" : limit }, timeout = 10.0 )
131+ response .raise_for_status ()
132+ return response .json ()
132133
133- def rollback (self , file_path : str , commit : str , dry_run : bool = True ):
134- from palinode .core import git_tools
135- return git_tools .rollback (file_path , commit , dry_run = dry_run )
134+ def rollback (self , file_path : str , commit : str = None , dry_run : bool = True ):
135+ params : dict = {"file_path" : file_path , "dry_run" : dry_run }
136+ if commit :
137+ params ["commit" ] = commit
138+ response = self .client .post ("/rollback" , params = params , timeout = 30.0 )
139+ response .raise_for_status ()
140+ return response .json ()
136141
137142 def push (self ):
138- from palinode .core import git_tools
139- return git_tools .push ()
143+ response = self .client .post ("/push" , timeout = 60.0 )
144+ response .raise_for_status ()
145+ return response .json ()
140146
141147 def health_check (self ):
142148 try :
0 commit comments