File tree Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -63,6 +63,12 @@ export function toolWithApproval<INPUT, OUTPUT>(
6363 return tool ;
6464}
6565
66+ type ToolSetWithPrefix < TOOLS extends ToolSet , PREFIX extends string > = {
67+ [ K in keyof TOOLS as `${PREFIX } ${K & string } `] : K extends string
68+ ? TOOLS [ K ]
69+ : never ;
70+ } ;
71+
6672/**
6773 * Tools are helpers for managing tools.
6874 */
@@ -253,12 +259,15 @@ export const tools = Object.freeze({
253259 * @param prefix The prefix to add to the tools.
254260 * @returns The prefixed tool set.
255261 */
256- prefix ( tools : ToolSet , prefix : string ) : ToolSet {
262+ prefix < PREFIX extends string , TOOLS extends ToolSet > (
263+ tools : TOOLS ,
264+ prefix : PREFIX
265+ ) : ToolSetWithPrefix < TOOLS , PREFIX > {
257266 const prefixed : ToolSet = { } ;
258267 for ( const [ key , tool ] of Object . entries ( tools ) ) {
259268 prefixed [ `${ prefix } ${ key } ` ] = tool ;
260269 }
261- return prefixed ;
270+ return prefixed as ToolSetWithPrefix < TOOLS , PREFIX > ;
262271 } ,
263272} ) ;
264273
Original file line number Diff line number Diff line change 11{
22 "name" : " @blink-sdk/slack" ,
3- "version" : " 1.1.1 " ,
3+ "version" : " 1.1.2 " ,
44 "author" : {
55 "name" : " Coder" ,
66 "email" : " support@blink.so" ,
You can’t perform that action at this time.
0 commit comments