Skip to content

Commit 94b5cbf

Browse files
committed
feat: unit-benchmark-test use go version "1.25.6"
1 parent b07589a commit 94b5cbf

File tree

5 files changed

+41
-41
lines changed

5 files changed

+41
-41
lines changed

.github/workflows/tests.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,16 @@ jobs:
3232
# for module in $modules; do
3333
# echo "--------------------------------------------------"
3434
# echo "run unit test for ${module}"
35-
35+
3636
# cd ${module}
3737
# go test -race -coverprofile=./${COVERAGE_FILE} -gcflags="all=-l -N" -coverpkg=./... ./...
3838
# cd -
3939
# coverprofiles="${module}/${COVERAGE_FILE},$coverprofiles"
4040
# done
41-
41+
4242
# # Remove trailing comma from coverprofiles
4343
# coverprofiles=${coverprofiles%,}
44-
44+
4545
# echo "COVERAGE_PROFILES=$coverprofiles" >> $GITHUB_ENV
4646

4747
- name: Go test in go workspace
@@ -70,7 +70,7 @@ jobs:
7070
go test -race -coverprofile=coverage.out -gcflags="all=-l -N" -coverpkg=$coverpkg $list
7171
7272
echo "COVERAGE_PROFILES=$coverprofiles" >> $GITHUB_ENV
73-
73+
7474
- name: Download base.coverage for diff coverage rate
7575
id: download-base-coverage
7676
uses: actions/download-artifact@v4
@@ -86,7 +86,7 @@ jobs:
8686
config: ./.testcoverage.yml
8787
breakdown-file-name: ${{ github.ref_name == 'main' && env.BREAKDOWN_FILE || '' }}
8888
diff-base-breakdown-file-name: ${{ steps.download-base-coverage.outcome == 'success' && env.BREAKDOWN_FILE || '' }}
89-
89+
9090
- name: Upload base.coverage of main branch
9191
uses: actions/upload-artifact@v4
9292
if: github.ref_name == 'main'
@@ -124,7 +124,7 @@ jobs:
124124
- name: Set up Go
125125
uses: actions/setup-go@v5
126126
with:
127-
go-version: stable
127+
go-version: "1.25.6"
128128

129129
- name: Go BenchMark
130130
run: |
@@ -147,7 +147,7 @@ jobs:
147147
- uses: actions/checkout@v4
148148
with:
149149
fetch-depth: 0
150-
150+
151151
- name: Check modified files in submodules
152152
id: check-mods
153153
run: |

adk/backend/agentkit/sandbox.go

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ type Config struct {
104104
ExecutionTimeout int
105105
}
106106

107-
type SandboxToolBackend struct {
107+
type SandboxTool struct {
108108
secretAccessKey string
109109
accessKeyID string
110110
baseURL string
@@ -117,14 +117,14 @@ type SandboxToolBackend struct {
117117
executionTimeout int
118118
}
119119

120-
// NewSandboxToolBackend creates a new SandboxToolBackend instance.
121-
// SandboxToolBackend refers to the sandbox running instance created by the sandbox tool in Volcengine.
120+
// NewSandboxToolBackend creates a new SandboxTool instance.
121+
// SandboxTool refers to the sandbox running instance created by the sandbox tool in Volcengine.
122122
// For creating a sandbox tool environment, please refer to: https://www.volcengine.com/docs/86681/1847934?lang=zh;
123123
// For creating a sandbox tool running instance, please refer to: https://www.volcengine.com/docs/86681/1860266?lang=zh.
124124
// Note: The execution paths within the sandbox environment may be subject to permission restrictions (read, write, execute, etc.).
125125
// Improper path selection can result in operation failures or permission errors.
126126
// It is recommended to perform operations within paths where the sandbox environment has explicit permissions to mitigate permission-related risks.
127-
func NewSandboxToolBackend(config *Config) (*SandboxToolBackend, error) {
127+
func NewSandboxToolBackend(config *Config) (*SandboxTool, error) {
128128
if config.AccessKeyID == "" {
129129
return nil, fmt.Errorf("AccessKeyID is required")
130130
}
@@ -159,7 +159,7 @@ func NewSandboxToolBackend(config *Config) (*SandboxToolBackend, error) {
159159
return nil, fmt.Errorf("invalid region: %s", region)
160160
}
161161

162-
return &SandboxToolBackend{
162+
return &SandboxTool{
163163
accessKeyID: config.AccessKeyID,
164164
secretAccessKey: config.SecretAccessKey,
165165
httpClient: httpClient,
@@ -174,7 +174,7 @@ func NewSandboxToolBackend(config *Config) (*SandboxToolBackend, error) {
174174
}
175175

176176
// LsInfo lists file information under the given path.
177-
func (s *SandboxToolBackend) LsInfo(ctx context.Context, req *filesystem.LsInfoRequest) ([]filesystem.FileInfo, error) {
177+
func (s *SandboxTool) LsInfo(ctx context.Context, req *filesystem.LsInfoRequest) ([]filesystem.FileInfo, error) {
178178
path, err := formatPath(req.Path, "/", true)
179179
if err != nil {
180180
return nil, err
@@ -216,7 +216,7 @@ func (s *SandboxToolBackend) LsInfo(ctx context.Context, req *filesystem.LsInfoR
216216
}
217217

218218
// Read reads file content with support for line-based offset and limit.
219-
func (s *SandboxToolBackend) Read(ctx context.Context, req *filesystem.ReadRequest) (string, error) {
219+
func (s *SandboxTool) Read(ctx context.Context, req *filesystem.ReadRequest) (string, error) {
220220
path, err := formatPath(req.FilePath, "", true)
221221
if err != nil {
222222
return "", err
@@ -251,7 +251,7 @@ func (s *SandboxToolBackend) Read(ctx context.Context, req *filesystem.ReadReque
251251
}
252252

253253
// GrepRaw searches for content matching the specified pattern in files.
254-
func (s *SandboxToolBackend) GrepRaw(ctx context.Context, req *filesystem.GrepRequest) ([]filesystem.GrepMatch, error) {
254+
func (s *SandboxTool) GrepRaw(ctx context.Context, req *filesystem.GrepRequest) ([]filesystem.GrepMatch, error) {
255255
path, _ := formatPath(req.Path, "", false)
256256
params := map[string]any{
257257
"pattern": req.Pattern,
@@ -292,7 +292,7 @@ func (s *SandboxToolBackend) GrepRaw(ctx context.Context, req *filesystem.GrepRe
292292
}
293293

294294
// GlobInfo returns file information matching the glob pattern.
295-
func (s *SandboxToolBackend) GlobInfo(ctx context.Context, req *filesystem.GlobInfoRequest) ([]filesystem.FileInfo, error) {
295+
func (s *SandboxTool) GlobInfo(ctx context.Context, req *filesystem.GlobInfoRequest) ([]filesystem.FileInfo, error) {
296296
path, _ := formatPath(req.Path, "/", false)
297297
params := map[string]any{
298298
"path_b64": base64.StdEncoding.EncodeToString([]byte(path)),
@@ -330,7 +330,7 @@ func (s *SandboxToolBackend) GlobInfo(ctx context.Context, req *filesystem.GlobI
330330
}
331331

332332
// Write creates file content.
333-
func (s *SandboxToolBackend) Write(ctx context.Context, req *filesystem.WriteRequest) error {
333+
func (s *SandboxTool) Write(ctx context.Context, req *filesystem.WriteRequest) error {
334334
path, err := formatPath(req.FilePath, "", true)
335335
if err != nil {
336336
return err
@@ -358,7 +358,7 @@ func (s *SandboxToolBackend) Write(ctx context.Context, req *filesystem.WriteReq
358358
}
359359

360360
// Edit replaces string occurrences in a file.
361-
func (s *SandboxToolBackend) Edit(ctx context.Context, req *filesystem.EditRequest) error {
361+
func (s *SandboxTool) Edit(ctx context.Context, req *filesystem.EditRequest) error {
362362
path, err := formatPath(req.FilePath, "", true)
363363
if err != nil {
364364
return err
@@ -401,7 +401,7 @@ func (s *SandboxToolBackend) Edit(ctx context.Context, req *filesystem.EditReque
401401
}
402402

403403
// execute executes a command in the sandbox.
404-
func (s *SandboxToolBackend) execute(ctx context.Context, command string) (text string, exitCode *int, err error) {
404+
func (s *SandboxTool) execute(ctx context.Context, command string) (text string, exitCode *int, err error) {
405405
var operationPayload string
406406
if s.executionTimeout <= 0 {
407407
operationPayload, err = sonic.MarshalString(map[string]any{
@@ -473,7 +473,7 @@ func (s *SandboxToolBackend) execute(ctx context.Context, command string) (text
473473
return text, exitCode, nil
474474
}
475475

476-
func (s *SandboxToolBackend) invokeTool(ctx context.Context, method string, body []byte) ([]byte, error) {
476+
func (s *SandboxTool) invokeTool(ctx context.Context, method string, body []byte) ([]byte, error) {
477477
queries := make(url.Values)
478478
queries.Set("Action", "InvokeTool")
479479
queries.Set("Version", "2025-10-30")
@@ -506,7 +506,7 @@ func (s *SandboxToolBackend) invokeTool(ctx context.Context, method string, body
506506
return responseBody, nil
507507
}
508508

509-
func (s *SandboxToolBackend) signRequest(request *http.Request, queries url.Values, body []byte) {
509+
func (s *SandboxTool) signRequest(request *http.Request, queries url.Values, body []byte) {
510510
now := time.Now()
511511
date := now.UTC().Format("20060102T150405Z")
512512
authDate := date[:8]
@@ -558,7 +558,7 @@ func (s *SandboxToolBackend) signRequest(request *http.Request, queries url.Valu
558558
request.Header.Set("Authorization", authorization)
559559
}
560560

561-
func (s *SandboxToolBackend) Execute(ctx context.Context, input *filesystem.ExecuteRequest) (result *filesystem.ExecuteResponse, err error) {
561+
func (s *SandboxTool) Execute(ctx context.Context, input *filesystem.ExecuteRequest) (result *filesystem.ExecuteResponse, err error) {
562562
if input.Command == "" {
563563
return nil, fmt.Errorf("command is required")
564564
}

adk/backend/agentkit/sandbox_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ func TestNewArkSandbox(t *testing.T) {
115115
var mockAPIHandler http.HandlerFunc
116116

117117
// setupTest creates a mock server and an ArkSandbox client configured to use it.
118-
func setupTest(t *testing.T) (*SandboxToolBackend, *httptest.Server) {
118+
func setupTest(t *testing.T) (*SandboxTool, *httptest.Server) {
119119
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
120120
if mockAPIHandler != nil {
121121
mockAPIHandler(w, r)

adk/backend/local/examples/middlewares/main.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,14 @@ func main() {
3535
ctx := context.Background()
3636

3737
fmt.Println("========================================")
38-
fmt.Println("Local Backend Middleware Example")
38+
fmt.Println("Local Local Middleware Example")
3939
fmt.Println("========================================")
4040
fmt.Println()
4141

4242
// ========================================
43-
// Step 1: Initialize Local Backend
43+
// Step 1: Initialize Local Local
4444
// ========================================
45-
fmt.Println("Step 1: Initializing Local Backend...")
45+
fmt.Println("Step 1: Initializing Local Local...")
4646

4747
// The local backend operates directly on the local filesystem
4848
// Optionally provide ValidateCommand for Execute() method security
@@ -53,7 +53,7 @@ func main() {
5353
log.Fatalf("✗ Failed to create LocalBackend: %v", err)
5454
}
5555

56-
fmt.Println("✓ Local Backend initialized")
56+
fmt.Println("✓ Local Local initialized")
5757
fmt.Println()
5858

5959
// ========================================
@@ -69,7 +69,7 @@ func main() {
6969
defer os.RemoveAll(tempDir)
7070

7171
testFilePath := filepath.Join(tempDir, "example_file.txt")
72-
testContent := "Hello from Local Backend!\nThis is a test for file operations.\n"
72+
testContent := "Hello from Local Local!\nThis is a test for file operations.\n"
7373

7474
err = backend.Write(ctx, &filesystem.WriteRequest{
7575
FilePath: testFilePath,

adk/backend/local/local.go

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -40,22 +40,22 @@ type Config struct {
4040
ValidateCommand func(string) error
4141
}
4242

43-
type Backend struct {
43+
type Local struct {
4444
validateCommand func(string) error
4545
}
4646

4747
var defaultValidateCommand = func(string) error {
4848
return nil
4949
}
5050

51-
// NewBackend creates a new local filesystem Backend instance.
51+
// NewBackend creates a new local filesystem Local instance.
5252
//
5353
// IMPORTANT - System Compatibility:
5454
// - Supported: Unix/MacOS only
55-
// - NOT Supported: Windows (requires custom implementation of Backend)
55+
// - NOT Supported: Windows (requires custom implementation of Local)
5656
// - Command Execution: Uses /bin/sh by default for Execute method
57-
// - If /bin/sh does not meet your requirements, please implement your own Backend
58-
func NewBackend(_ context.Context, cfg *Config) (*Backend, error) {
57+
// - If /bin/sh does not meet your requirements, please implement your own Local
58+
func NewBackend(_ context.Context, cfg *Config) (*Local, error) {
5959
if cfg == nil {
6060
return nil, errors.New("config is required")
6161
}
@@ -65,12 +65,12 @@ func NewBackend(_ context.Context, cfg *Config) (*Backend, error) {
6565
validateCommand = cfg.ValidateCommand
6666
}
6767

68-
return &Backend{
68+
return &Local{
6969
validateCommand: validateCommand,
7070
}, nil
7171
}
7272

73-
func (s *Backend) LsInfo(ctx context.Context, req *filesystem.LsInfoRequest) ([]filesystem.FileInfo, error) {
73+
func (s *Local) LsInfo(ctx context.Context, req *filesystem.LsInfoRequest) ([]filesystem.FileInfo, error) {
7474
if req.Path == "" {
7575
req.Path = defaultRootPath
7676
}
@@ -105,7 +105,7 @@ func (s *Backend) LsInfo(ctx context.Context, req *filesystem.LsInfoRequest) ([]
105105
return files, nil
106106
}
107107

108-
func (s *Backend) Read(ctx context.Context, req *filesystem.ReadRequest) (string, error) {
108+
func (s *Local) Read(ctx context.Context, req *filesystem.ReadRequest) (string, error) {
109109
path := filepath.Clean(req.FilePath)
110110
if !filepath.IsAbs(path) {
111111
return "", fmt.Errorf("path must be an absolute path: %s", path)
@@ -160,7 +160,7 @@ func (s *Backend) Read(ctx context.Context, req *filesystem.ReadRequest) (string
160160
return result.String(), nil
161161
}
162162

163-
func (s *Backend) GrepRaw(ctx context.Context, req *filesystem.GrepRequest) ([]filesystem.GrepMatch, error) {
163+
func (s *Local) GrepRaw(ctx context.Context, req *filesystem.GrepRequest) ([]filesystem.GrepMatch, error) {
164164
path := filepath.Clean(req.Path)
165165

166166
var matches []filesystem.GrepMatch
@@ -232,7 +232,7 @@ func (s *Backend) GrepRaw(ctx context.Context, req *filesystem.GrepRequest) ([]f
232232
return matches, nil
233233
}
234234

235-
func (s *Backend) GlobInfo(ctx context.Context, req *filesystem.GlobInfoRequest) ([]filesystem.FileInfo, error) {
235+
func (s *Local) GlobInfo(ctx context.Context, req *filesystem.GlobInfoRequest) ([]filesystem.FileInfo, error) {
236236
if req.Path == "" {
237237
req.Path = defaultRootPath
238238
}
@@ -337,7 +337,7 @@ func globToRegex(pattern string) (*regexp.Regexp, error) {
337337
return regexp.Compile(pattern)
338338
}
339339

340-
func (s *Backend) Write(ctx context.Context, req *filesystem.WriteRequest) error {
340+
func (s *Local) Write(ctx context.Context, req *filesystem.WriteRequest) error {
341341
if !filepath.IsAbs(req.FilePath) {
342342
return fmt.Errorf("path must be an absolute path: %s", req.FilePath)
343343
}
@@ -364,7 +364,7 @@ func (s *Backend) Write(ctx context.Context, req *filesystem.WriteRequest) error
364364
return nil
365365
}
366366

367-
func (s *Backend) Edit(ctx context.Context, req *filesystem.EditRequest) error {
367+
func (s *Local) Edit(ctx context.Context, req *filesystem.EditRequest) error {
368368
path := filepath.Clean(req.FilePath)
369369
if !filepath.IsAbs(path) {
370370
return fmt.Errorf("path must be an absolute path: %s", path)
@@ -403,7 +403,7 @@ func (s *Backend) Edit(ctx context.Context, req *filesystem.EditRequest) error {
403403
return os.WriteFile(path, []byte(newText), 0644)
404404
}
405405

406-
func (s *Backend) ExecuteStreaming(ctx context.Context, input *filesystem.ExecuteRequest) (result *schema.StreamReader[*filesystem.ExecuteResponse], err error) {
406+
func (s *Local) ExecuteStreaming(ctx context.Context, input *filesystem.ExecuteRequest) (result *schema.StreamReader[*filesystem.ExecuteResponse], err error) {
407407
if input.Command == "" {
408408
return nil, fmt.Errorf("command is required")
409409
}

0 commit comments

Comments
 (0)