@@ -89,13 +89,12 @@ export class TaskService {
8989 return `sid_${ timestamp } _${ random } ` ;
9090 }
9191 /**
92- * Split subtask action into description and function/details parts
93- * @param action The full action string to split
94- * @returns Object containing description and functionOrDetails
95- */
92+ * Split subtask action into description and function/details parts
93+ * @param action The full action string to split
94+ * @returns Object containing description and functionOrDetails
95+ */
9696 static splitSubtaskAction ( action : string ) : { description : string ; functionOrDetails : string | null } {
97- // Check for "Function:" pattern
98- // Check for "Function:" pattern
97+ // Check for "Function:" pattern (with period before Function)
9998 const functionMatch = action . match ( / ^ ( .+ ?) \. \s * F u n c t i o n : \s * ( .+ ) $ / ) ;
10099 if ( functionMatch ) {
101100 return {
@@ -104,31 +103,37 @@ export class TaskService {
104103 } ;
105104 }
106105
107- // Check for "Provide more details about:" pattern
108- const detailsMatch = action . match ( / ^ P r o v i d e m o r e d e t a i l s a b o u t : \s * ( .+ ) $ / ) ;
109- if ( detailsMatch ) {
110- return {
111- description : "Provide more details about" ,
112- functionOrDetails : detailsMatch [ 1 ] . trim ( )
113- } ;
114- }
115-
116- // Check for "Analyze the task:" pattern
117- const analyzeMatch = action . match ( / ^ A n a l y z e t h e t a s k : \s * ( .+ ) $ / ) ;
118- if ( analyzeMatch ) {
106+ // Check for any colon pattern - split on first colon
107+ const colonIndex = action . indexOf ( ':' ) ;
108+ if ( colonIndex !== - 1 ) {
119109 return {
120- description : "Analyze the task" ,
121- functionOrDetails : analyzeMatch [ 1 ] . trim ( )
110+ description : action . substring ( 0 , colonIndex ) . trim ( ) ,
111+ functionOrDetails : action . substring ( colonIndex + 1 ) . trim ( )
122112 } ;
123113 }
124114
125- // If no pattern matches , return the full action as description
115+ // If no colon found , return the full action as description
126116 return {
127117 description : action ,
128118 functionOrDetails : null
129119 } ;
130120 }
121+ /**
122+ * Clean text by converting any non-alphanumeric character to spaces
123+ * @param text The text string to clean
124+ * @returns Cleaned text string with only letters, numbers, and spaces
125+ */
126+ static cleanTextToSpaces ( text : string ) : string {
127+ if ( ! text ) return '' ;
128+
129+ // Replace any non-alphanumeric character with a space
130+ let cleanedText = text . replace ( / [ ^ a - z A - Z 0 - 9 ] / g, ' ' ) ;
131131
132+ // Clean up multiple spaces and trim
133+ cleanedText = cleanedText . replace ( / \s + / g, ' ' ) . trim ( ) ;
134+
135+ return cleanedText ;
136+ }
132137 /**
133138 * Submit an input task to create a new plan
134139 * @param description Task description
0 commit comments