MCPcopy Create free account
hub / github.com/astercloud/aster / getCommandTimeout

Method getCommandTimeout

pkg/tools/builtin/bash.go:369–394  ·  view source on GitHub ↗
(cmd string)

Source from the content-addressed store, hash-verified

367}
368
369func (t *BashTool) getCommandTimeout(cmd string) time.Duration {
370 // 根据命令类型调整超时时间
371 lowerCmd := strings.ToLower(cmd)
372
373 // 长时间运行的命令
374 if strings.Contains(lowerCmd, "make") || strings.Contains(lowerCmd, "npm install") ||
375 strings.Contains(lowerCmd, "go build") || strings.Contains(lowerCmd, "cmake") ||
376 strings.Contains(lowerCmd, "docker build") {
377 return 30 * time.Minute
378 }
379
380 // 网络相关命令
381 if strings.Contains(lowerCmd, "git clone") || strings.Contains(lowerCmd, "curl") ||
382 strings.Contains(lowerCmd, "wget") || strings.Contains(lowerCmd, "pip install") {
383 return 10 * time.Minute
384 }
385
386 // 数据库操作
387 if strings.Contains(lowerCmd, "mysql") || strings.Contains(lowerCmd, "postgres") ||
388 strings.Contains(lowerCmd, "psql") || strings.Contains(lowerCmd, "mongod") {
389 return 5 * time.Minute
390 }
391
392 // 默认超时
393 return t.defaultTimeout
394}
395
396func (t *BashTool) Prompt() string {
397 return `执行bash命令在持久化shell会话中。

Callers 1

ExecuteMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected