mirror of
https://github.com/YspCoder/clawgo.git
synced 2026-05-09 03:17:36 +08:00
fix loop
This commit is contained in:
@@ -159,13 +159,12 @@ clawgo channel test --channel telegram --to <chat_id> -m "ping"
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
运行控制配置示例(意图阈值 / 自主循环守卫 / 运行态保留):
|
运行控制配置示例(自主循环守卫 / 运行态保留):
|
||||||
|
|
||||||
```json
|
```json
|
||||||
"agents": {
|
"agents": {
|
||||||
"defaults": {
|
"defaults": {
|
||||||
"runtime_control": {
|
"runtime_control": {
|
||||||
"intent_high_confidence": 0.75,
|
|
||||||
"intent_max_input_chars": 1200,
|
"intent_max_input_chars": 1200,
|
||||||
"autonomy_tick_interval_sec": 20,
|
"autonomy_tick_interval_sec": 20,
|
||||||
"autonomy_min_run_interval_sec": 20,
|
"autonomy_min_run_interval_sec": 20,
|
||||||
|
|||||||
@@ -159,13 +159,12 @@ Context compaction config example:
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
Runtime-control config example (intent thresholds / autonomy guards / run-state retention):
|
Runtime-control config example (autonomy guards / run-state retention):
|
||||||
|
|
||||||
```json
|
```json
|
||||||
"agents": {
|
"agents": {
|
||||||
"defaults": {
|
"defaults": {
|
||||||
"runtime_control": {
|
"runtime_control": {
|
||||||
"intent_high_confidence": 0.75,
|
|
||||||
"intent_max_input_chars": 1200,
|
"intent_max_input_chars": 1200,
|
||||||
"autonomy_tick_interval_sec": 20,
|
"autonomy_tick_interval_sec": 20,
|
||||||
"autonomy_min_run_interval_sec": 20,
|
"autonomy_min_run_interval_sec": 20,
|
||||||
|
|||||||
@@ -16,7 +16,6 @@
|
|||||||
"max_transcript_chars": 20000
|
"max_transcript_chars": 20000
|
||||||
},
|
},
|
||||||
"runtime_control": {
|
"runtime_control": {
|
||||||
"intent_high_confidence": 0.75,
|
|
||||||
"intent_max_input_chars": 1200,
|
"intent_max_input_chars": 1200,
|
||||||
"autonomy_tick_interval_sec": 20,
|
"autonomy_tick_interval_sec": 20,
|
||||||
"autonomy_min_run_interval_sec": 20,
|
"autonomy_min_run_interval_sec": 20,
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -42,7 +42,6 @@ type AgentDefaults struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type RuntimeControlConfig struct {
|
type RuntimeControlConfig struct {
|
||||||
IntentHighConfidence float64 `json:"intent_high_confidence" env:"CLAWGO_INTENT_HIGH_CONFIDENCE"`
|
|
||||||
IntentMaxInputChars int `json:"intent_max_input_chars" env:"CLAWGO_INTENT_MAX_INPUT_CHARS"`
|
IntentMaxInputChars int `json:"intent_max_input_chars" env:"CLAWGO_INTENT_MAX_INPUT_CHARS"`
|
||||||
AutonomyTickIntervalSec int `json:"autonomy_tick_interval_sec" env:"CLAWGO_AUTONOMY_TICK_INTERVAL_SEC"`
|
AutonomyTickIntervalSec int `json:"autonomy_tick_interval_sec" env:"CLAWGO_AUTONOMY_TICK_INTERVAL_SEC"`
|
||||||
AutonomyMinRunIntervalSec int `json:"autonomy_min_run_interval_sec" env:"CLAWGO_AUTONOMY_MIN_RUN_INTERVAL_SEC"`
|
AutonomyMinRunIntervalSec int `json:"autonomy_min_run_interval_sec" env:"CLAWGO_AUTONOMY_MIN_RUN_INTERVAL_SEC"`
|
||||||
@@ -253,7 +252,6 @@ func DefaultConfig() *Config {
|
|||||||
MaxTranscriptChars: 20000,
|
MaxTranscriptChars: 20000,
|
||||||
},
|
},
|
||||||
RuntimeControl: RuntimeControlConfig{
|
RuntimeControl: RuntimeControlConfig{
|
||||||
IntentHighConfidence: 0.75,
|
|
||||||
IntentMaxInputChars: 1200,
|
IntentMaxInputChars: 1200,
|
||||||
AutonomyTickIntervalSec: 20,
|
AutonomyTickIntervalSec: 20,
|
||||||
AutonomyMinRunIntervalSec: 20,
|
AutonomyMinRunIntervalSec: 20,
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ func TestLoadConfigRejectsUnknownField(t *testing.T) {
|
|||||||
"agents": {
|
"agents": {
|
||||||
"defaults": {
|
"defaults": {
|
||||||
"runtime_control": {
|
"runtime_control": {
|
||||||
"intent_high_confidence": 0.8,
|
"intent_max_input_chars": 1200,
|
||||||
"unknown_field": 1
|
"unknown_field": 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -40,7 +40,7 @@ func TestLoadConfigRejectsTrailingJSONContent(t *testing.T) {
|
|||||||
|
|
||||||
dir := t.TempDir()
|
dir := t.TempDir()
|
||||||
cfgPath := filepath.Join(dir, "config.json")
|
cfgPath := filepath.Join(dir, "config.json")
|
||||||
content := `{"agents":{"defaults":{"runtime_control":{"intent_high_confidence":0.8}}}}{"extra":true}`
|
content := `{"agents":{"defaults":{"runtime_control":{"intent_max_input_chars":1200}}}}{"extra":true}`
|
||||||
if err := os.WriteFile(cfgPath, []byte(content), 0o644); err != nil {
|
if err := os.WriteFile(cfgPath, []byte(content), 0o644); err != nil {
|
||||||
t.Fatalf("write config: %v", err)
|
t.Fatalf("write config: %v", err)
|
||||||
}
|
}
|
||||||
@@ -63,7 +63,6 @@ func TestLoadConfigAllowsKnownRuntimeControlFields(t *testing.T) {
|
|||||||
"agents": {
|
"agents": {
|
||||||
"defaults": {
|
"defaults": {
|
||||||
"runtime_control": {
|
"runtime_control": {
|
||||||
"intent_high_confidence": 0.88,
|
|
||||||
"run_state_max": 321,
|
"run_state_max": 321,
|
||||||
"tool_parallel_safe_names": ["read_file", "memory_search"],
|
"tool_parallel_safe_names": ["read_file", "memory_search"],
|
||||||
"tool_max_parallel_calls": 3
|
"tool_max_parallel_calls": 3
|
||||||
@@ -79,9 +78,6 @@ func TestLoadConfigAllowsKnownRuntimeControlFields(t *testing.T) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("load config: %v", err)
|
t.Fatalf("load config: %v", err)
|
||||||
}
|
}
|
||||||
if got := cfg.Agents.Defaults.RuntimeControl.IntentHighConfidence; got != 0.88 {
|
|
||||||
t.Fatalf("intent_high_confidence mismatch: got %.2f", got)
|
|
||||||
}
|
|
||||||
if got := cfg.Agents.Defaults.RuntimeControl.RunStateMax; got != 321 {
|
if got := cfg.Agents.Defaults.RuntimeControl.RunStateMax; got != 321 {
|
||||||
t.Fatalf("run_state_max mismatch: got %d", got)
|
t.Fatalf("run_state_max mismatch: got %d", got)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,9 +18,6 @@ func Validate(cfg *Config) []error {
|
|||||||
errs = append(errs, fmt.Errorf("agents.defaults.max_tool_iterations must be > 0"))
|
errs = append(errs, fmt.Errorf("agents.defaults.max_tool_iterations must be > 0"))
|
||||||
}
|
}
|
||||||
rc := cfg.Agents.Defaults.RuntimeControl
|
rc := cfg.Agents.Defaults.RuntimeControl
|
||||||
if rc.IntentHighConfidence <= 0 || rc.IntentHighConfidence > 1 {
|
|
||||||
errs = append(errs, fmt.Errorf("agents.defaults.runtime_control.intent_high_confidence must be in (0,1]"))
|
|
||||||
}
|
|
||||||
if rc.IntentMaxInputChars < 200 {
|
if rc.IntentMaxInputChars < 200 {
|
||||||
errs = append(errs, fmt.Errorf("agents.defaults.runtime_control.intent_max_input_chars must be >= 200"))
|
errs = append(errs, fmt.Errorf("agents.defaults.runtime_control.intent_max_input_chars must be >= 200"))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user