@@ -26,31 +26,6 @@ import (
2626)
2727
2828var tools = map [string ]types.Tool {
29- "sys.workspace.ls" : {
30- Parameters : types.Parameters {
31- Description : "Lists the contents of a directory relative to the current workspace" ,
32- Arguments : types .ObjectSchema (
33- "dir" , "The directory to list" ),
34- },
35- BuiltinFunc : SysWorkspaceLs ,
36- },
37- "sys.workspace.write" : {
38- Parameters : types.Parameters {
39- Description : "Write the contents to a file relative to the current workspace" ,
40- Arguments : types .ObjectSchema (
41- "filename" , "The name of the file to write to" ,
42- "content" , "The content to write" ),
43- },
44- BuiltinFunc : SysWorkspaceWrite ,
45- },
46- "sys.workspace.read" : {
47- Parameters : types.Parameters {
48- Description : "Reads the contents of a file relative to the current workspace" ,
49- Arguments : types .ObjectSchema (
50- "filename" , "The name of the file to read" ),
51- },
52- BuiltinFunc : SysWorkspaceRead ,
53- },
5429 "sys.ls" : {
5530 Parameters : types.Parameters {
5631 Description : "Lists the contents of a directory" ,
@@ -332,14 +307,6 @@ func getWorkspaceDir(envs []string) (string, error) {
332307 return "" , fmt .Errorf ("no workspace directory found in env" )
333308}
334309
335- func SysWorkspaceLs (_ context.Context , env []string , input string ) (string , error ) {
336- dir , err := getWorkspaceDir (env )
337- if err != nil {
338- return "" , err
339- }
340- return sysLs (dir , input )
341- }
342-
343310func SysLs (_ context.Context , _ []string , input string ) (string , error ) {
344311 return sysLs ("" , input )
345312}
@@ -380,20 +347,7 @@ func sysLs(base, input string) (string, error) {
380347 return strings .Join (result , "\n " ), nil
381348}
382349
383- func SysWorkspaceRead (ctx context.Context , env []string , input string ) (string , error ) {
384- dir , err := getWorkspaceDir (env )
385- if err != nil {
386- return "" , err
387- }
388-
389- return sysRead (ctx , dir , env , input )
390- }
391-
392- func SysRead (ctx context.Context , env []string , input string ) (string , error ) {
393- return sysRead (ctx , "" , env , input )
394- }
395-
396- func sysRead (ctx context.Context , base string , env []string , input string ) (string , error ) {
350+ func SysRead (_ context.Context , _ []string , input string ) (string , error ) {
397351 var params struct {
398352 Filename string `json:"filename,omitempty"`
399353 }
@@ -402,9 +356,6 @@ func sysRead(ctx context.Context, base string, env []string, input string) (stri
402356 }
403357
404358 file := params .Filename
405- if base != "" {
406- file = filepath .Join (base , file )
407- }
408359
409360 // Lock the file to prevent concurrent writes from other tool calls.
410361 locker .RLock (file )
@@ -424,19 +375,7 @@ func sysRead(ctx context.Context, base string, env []string, input string) (stri
424375 return string (data ), nil
425376}
426377
427- func SysWorkspaceWrite (ctx context.Context , env []string , input string ) (string , error ) {
428- dir , err := getWorkspaceDir (env )
429- if err != nil {
430- return "" , err
431- }
432- return sysWrite (ctx , dir , env , input )
433- }
434-
435- func SysWrite (ctx context.Context , env []string , input string ) (string , error ) {
436- return sysWrite (ctx , "" , env , input )
437- }
438-
439- func sysWrite (ctx context.Context , base string , env []string , input string ) (string , error ) {
378+ func SysWrite (ctx context.Context , _ []string , input string ) (string , error ) {
440379 var params struct {
441380 Filename string `json:"filename,omitempty"`
442381 Content string `json:"content,omitempty"`
@@ -446,9 +385,6 @@ func sysWrite(ctx context.Context, base string, env []string, input string) (str
446385 }
447386
448387 file := params .Filename
449- if base != "" {
450- file = filepath .Join (base , file )
451- }
452388
453389 // Lock the file to prevent concurrent writes from other tool calls.
454390 locker .Lock (file )
0 commit comments