@@ -32,10 +32,9 @@ pub async fn create_thread(
3232 ft_app_searchable : & str ,
3333 ft_app_specific : Value ,
3434 ft_toolset : Option < Vec < Value > > ,
35- parent_ft_id : Option < String > ,
3635) -> Result < Thread , String > {
3736 use crate :: cloud:: graphql_client:: { execute_graphql, GraphQLRequestConfig } ;
38-
37+
3938 let mutation = r#"
4039 mutation CreateThread($input: FThreadInput!) {
4140 thread_create(input: $input) {
@@ -64,8 +63,8 @@ pub async fn create_thread(
6463 Some ( toolset) => serde_json:: to_string ( & toolset) . map_err ( |e| format ! ( "Failed to serialize toolset: {}" , e) ) ?,
6564 None => "null" . to_string ( ) ,
6665 } ;
67-
68- let mut input = json ! ( {
66+
67+ let input = json ! ( {
6968 "owner_shared" : false ,
7069 "located_fgroup_id" : located_fgroup_id,
7170 "ft_fexp_id" : ft_fexp_id,
@@ -76,10 +75,6 @@ pub async fn create_thread(
7675 "ft_app_specific" : serde_json:: to_string( & ft_app_specific) . unwrap( ) ,
7776 } ) ;
7877
79- if let Some ( parent_id) = parent_ft_id {
80- input[ "parent_ft_id" ] = json ! ( parent_id) ;
81- }
82-
8378 let config = GraphQLRequestConfig {
8479 address : cmd_address_url. to_string ( ) ,
8580 api_key : api_key. to_string ( ) ,
@@ -104,7 +99,7 @@ pub async fn get_thread(
10499 thread_id : & str ,
105100) -> Result < Thread , String > {
106101 use crate :: cloud:: graphql_client:: { execute_graphql, GraphQLRequestConfig } ;
107-
102+
108103 let query = r#"
109104 query GetThread($id: String!) {
110105 thread_get(id: $id) {
@@ -151,12 +146,18 @@ pub async fn get_threads_app_captured(
151146 located_fgroup_id : & str ,
152147 ft_app_searchable : & str ,
153148 ft_app_capture : & str ,
149+ tool_call_id : Option < & str > ,
154150) -> Result < Vec < Thread > , String > {
155151 use crate :: cloud:: graphql_client:: { execute_graphql, GraphQLRequestConfig } ;
156-
152+
157153 let query = r#"
158- query GetThread($located_fgroup_id: String!, $ft_app_capture: String!, $ft_app_searchable: String!) {
159- threads_app_captured(located_fgroup_id: $located_fgroup_id, ft_app_capture: $ft_app_capture, ft_app_searchable: $ft_app_searchable) {
154+ query GetThread($located_fgroup_id: String!, $ft_app_capture: String!, $ft_app_searchable: String!, $ft_app_specific_filters: [FTAppSpecificFilter!]) {
155+ threads_app_captured(
156+ located_fgroup_id: $located_fgroup_id,
157+ ft_app_capture: $ft_app_capture,
158+ ft_app_searchable: $ft_app_searchable,
159+ ft_app_specific_filters: $ft_app_specific_filters
160+ ) {
160161 owner_fuser_id
161162 owner_shared
162163 located_fgroup_id
@@ -187,7 +188,11 @@ pub async fn get_threads_app_captured(
187188 let variables = json ! ( {
188189 "located_fgroup_id" : located_fgroup_id,
189190 "ft_app_capture" : ft_app_capture,
190- "ft_app_searchable" : ft_app_searchable
191+ "ft_app_searchable" : ft_app_searchable,
192+ "ft_app_specific_filters" : match tool_call_id {
193+ Some ( id) => vec![ json!( { "path" : "tool_call_id" , "equals" : id } ) ] ,
194+ None => Vec :: new( ) ,
195+ } ,
191196 } ) ;
192197 tracing:: info!( "get_threads_app_captured: address={}, located_fgroup_id={}, ft_app_capture={}, ft_app_searchable={}" ,
193198 config. address, located_fgroup_id, ft_app_capture, ft_app_searchable
@@ -209,15 +214,15 @@ pub async fn set_thread_toolset(
209214 ft_toolset : Vec < Value >
210215) -> Result < Vec < Value > , String > {
211216 use crate :: cloud:: graphql_client:: { execute_graphql, GraphQLRequestConfig } ;
212-
217+
213218 let mutation = r#"
214219 mutation UpdateThread($thread_id: String!, $patch: FThreadPatch!) {
215220 thread_patch(id: $thread_id, patch: $patch) {
216221 ft_toolset
217222 }
218223 }
219224 "# ;
220-
225+
221226 let variables = json ! ( {
222227 "thread_id" : thread_id,
223228 "patch" : {
@@ -258,12 +263,12 @@ pub async fn lock_thread(
258263 hash : & str ,
259264) -> Result < ( ) , String > {
260265 use crate :: cloud:: graphql_client:: { execute_graphql_bool_result, GraphQLRequestConfig } ;
261-
266+
262267 let worker_name = format ! ( "refact-lsp:{hash}" ) ;
263268 let query = r#"
264269 mutation AdvanceLock($ft_id: String!, $worker_name: String!) {
265270 thread_lock(ft_id: $ft_id, worker_name: $worker_name)
266- }
271+ }
267272 "# ;
268273
269274 let config = GraphQLRequestConfig {
@@ -273,7 +278,7 @@ pub async fn lock_thread(
273278 } ;
274279
275280 let variables = json ! ( {
276- "ft_id" : thread_id,
281+ "ft_id" : thread_id,
277282 "worker_name" : worker_name
278283 } ) ;
279284
@@ -303,7 +308,7 @@ pub async fn unlock_thread(
303308 hash : & str ,
304309) -> Result < ( ) , String > {
305310 use crate :: cloud:: graphql_client:: { execute_graphql_bool_result, GraphQLRequestConfig } ;
306-
311+
307312 let worker_name = format ! ( "refact-lsp:{hash}" ) ;
308313 let query = r#"
309314 mutation AdvanceUnlock($ft_id: String!, $worker_name: String!) {
@@ -318,7 +323,7 @@ pub async fn unlock_thread(
318323 } ;
319324
320325 let variables = json ! ( {
321- "ft_id" : thread_id,
326+ "ft_id" : thread_id,
322327 "worker_name" : worker_name
323328 } ) ;
324329
@@ -348,15 +353,15 @@ pub async fn set_error_thread(
348353 error : & str ,
349354) -> Result < ( ) , String > {
350355 use crate :: cloud:: graphql_client:: { execute_graphql_no_result, GraphQLRequestConfig } ;
351-
356+
352357 let mutation = r#"
353358 mutation SetThreadError($thread_id: String!, $patch: FThreadPatch!) {
354359 thread_patch(id: $thread_id, patch: $patch) {
355360 ft_error
356361 }
357362 }
358363 "# ;
359-
364+
360365 let variables = json ! ( {
361366 "thread_id" : thread_id,
362367 "patch" : {
@@ -369,7 +374,7 @@ pub async fn set_error_thread(
369374 api_key : api_key. to_string ( ) ,
370375 ..Default :: default ( )
371376 } ;
372-
377+
373378 tracing:: info!( "unlock_thread: address={}, thread_id={}, ft_error={}" ,
374379 config. address, thread_id, error
375380 ) ;
@@ -390,16 +395,16 @@ pub async fn set_thread_confirmation_request(
390395 confirmation_request : Value ,
391396) -> Result < bool , String > {
392397 use crate :: cloud:: graphql_client:: { execute_graphql_bool_result, GraphQLRequestConfig } ;
393-
398+
394399 let mutation = r#"
395400 mutation SetThreadConfirmationRequest($ft_id: String!, $confirmation_request: String!) {
396401 thread_set_confirmation_request(ft_id: $ft_id, confirmation_request: $confirmation_request)
397402 }
398403 "# ;
399-
404+
400405 let confirmation_request_str = serde_json:: to_string ( & confirmation_request)
401406 . map_err ( |e| format ! ( "Failed to serialize confirmation request: {}" , e) ) ?;
402-
407+
403408 let variables = json ! ( {
404409 "ft_id" : thread_id,
405410 "confirmation_request" : confirmation_request_str
0 commit comments