mirror of
https://github.com/Ed1s0nZ/CyberStrikeAI.git
synced 2026-07-10 14:28:43 +02:00
Add files via upload
This commit is contained in:
+75
-12
@@ -41,6 +41,14 @@ type Config struct {
|
|||||||
Vision VisionConfig `yaml:"vision,omitempty" json:"vision,omitempty"`
|
Vision VisionConfig `yaml:"vision,omitempty" json:"vision,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const (
|
||||||
|
DefaultSummarizationUserIntentLedgerMaxRunes = 96000
|
||||||
|
DefaultSummarizationUserIntentLedgerEntryMaxRunes = 16000
|
||||||
|
DefaultLatestUserMessageMaxRunes = 48000
|
||||||
|
DefaultLatestUserMessageHeadRunes = 24000
|
||||||
|
DefaultLatestUserMessageTailRunes = 24000
|
||||||
|
)
|
||||||
|
|
||||||
// ProjectConfig 项目黑板(跨对话共享事实)配置。
|
// ProjectConfig 项目黑板(跨对话共享事实)配置。
|
||||||
type ProjectConfig struct {
|
type ProjectConfig struct {
|
||||||
Enabled bool `yaml:"enabled" json:"enabled"`
|
Enabled bool `yaml:"enabled" json:"enabled"`
|
||||||
@@ -255,6 +263,16 @@ type MultiAgentEinoMiddlewareConfig struct {
|
|||||||
SummarizationTriggerRatio float64 `yaml:"summarization_trigger_ratio,omitempty" json:"summarization_trigger_ratio,omitempty"`
|
SummarizationTriggerRatio float64 `yaml:"summarization_trigger_ratio,omitempty" json:"summarization_trigger_ratio,omitempty"`
|
||||||
// SummarizationEmitInternalEvents controls middleware internal event emission (default true).
|
// SummarizationEmitInternalEvents controls middleware internal event emission (default true).
|
||||||
SummarizationEmitInternalEvents *bool `yaml:"summarization_emit_internal_events,omitempty" json:"summarization_emit_internal_events,omitempty"`
|
SummarizationEmitInternalEvents *bool `yaml:"summarization_emit_internal_events,omitempty" json:"summarization_emit_internal_events,omitempty"`
|
||||||
|
// SummarizationUserIntentLedgerMaxRunes caps the DB-backed immutable user input ledger injected into model context.
|
||||||
|
SummarizationUserIntentLedgerMaxRunes int `yaml:"summarization_user_intent_ledger_max_runes,omitempty" json:"summarization_user_intent_ledger_max_runes,omitempty"`
|
||||||
|
// SummarizationUserIntentLedgerEntryMaxRunes caps each user message entry inside the immutable user input ledger.
|
||||||
|
SummarizationUserIntentLedgerEntryMaxRunes int `yaml:"summarization_user_intent_ledger_entry_max_runes,omitempty" json:"summarization_user_intent_ledger_entry_max_runes,omitempty"`
|
||||||
|
// LatestUserMessageMaxRunes caps the current user turn inserted into model context; full text is persisted as an artifact when capped.
|
||||||
|
LatestUserMessageMaxRunes int `yaml:"latest_user_message_max_runes,omitempty" json:"latest_user_message_max_runes,omitempty"`
|
||||||
|
// LatestUserMessageHeadRunes keeps the head preview for an oversized current user turn.
|
||||||
|
LatestUserMessageHeadRunes int `yaml:"latest_user_message_head_runes,omitempty" json:"latest_user_message_head_runes,omitempty"`
|
||||||
|
// LatestUserMessageTailRunes keeps the tail preview for an oversized current user turn.
|
||||||
|
LatestUserMessageTailRunes int `yaml:"latest_user_message_tail_runes,omitempty" json:"latest_user_message_tail_runes,omitempty"`
|
||||||
// SummarizationRetryMaxAttempts 已废弃:summarization 与 run loop 共用 run_retry_max_attempts 及 isEinoTransientRunError。
|
// SummarizationRetryMaxAttempts 已废弃:summarization 与 run loop 共用 run_retry_max_attempts 及 isEinoTransientRunError。
|
||||||
SummarizationRetryMaxAttempts int `yaml:"summarization_retry_max_attempts,omitempty" json:"summarization_retry_max_attempts,omitempty"`
|
SummarizationRetryMaxAttempts int `yaml:"summarization_retry_max_attempts,omitempty" json:"summarization_retry_max_attempts,omitempty"`
|
||||||
// PlanExecuteUserInputBudgetRatio caps planner/replanner/executor userInput prompt budget ratio (default 0.35).
|
// PlanExecuteUserInputBudgetRatio caps planner/replanner/executor userInput prompt budget ratio (default 0.35).
|
||||||
@@ -302,6 +320,41 @@ func (c MultiAgentEinoMiddlewareConfig) SummarizationEmitInternalEventsEffective
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c MultiAgentEinoMiddlewareConfig) SummarizationUserIntentLedgerMaxRunesEffective() int {
|
||||||
|
if c.SummarizationUserIntentLedgerMaxRunes > 0 {
|
||||||
|
return c.SummarizationUserIntentLedgerMaxRunes
|
||||||
|
}
|
||||||
|
return DefaultSummarizationUserIntentLedgerMaxRunes
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c MultiAgentEinoMiddlewareConfig) SummarizationUserIntentLedgerEntryMaxRunesEffective() int {
|
||||||
|
if c.SummarizationUserIntentLedgerEntryMaxRunes > 0 {
|
||||||
|
return c.SummarizationUserIntentLedgerEntryMaxRunes
|
||||||
|
}
|
||||||
|
return DefaultSummarizationUserIntentLedgerEntryMaxRunes
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c MultiAgentEinoMiddlewareConfig) LatestUserMessageMaxRunesEffective() int {
|
||||||
|
if c.LatestUserMessageMaxRunes > 0 {
|
||||||
|
return c.LatestUserMessageMaxRunes
|
||||||
|
}
|
||||||
|
return DefaultLatestUserMessageMaxRunes
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c MultiAgentEinoMiddlewareConfig) LatestUserMessageHeadRunesEffective() int {
|
||||||
|
if c.LatestUserMessageHeadRunes > 0 {
|
||||||
|
return c.LatestUserMessageHeadRunes
|
||||||
|
}
|
||||||
|
return DefaultLatestUserMessageHeadRunes
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c MultiAgentEinoMiddlewareConfig) LatestUserMessageTailRunesEffective() int {
|
||||||
|
if c.LatestUserMessageTailRunes > 0 {
|
||||||
|
return c.LatestUserMessageTailRunes
|
||||||
|
}
|
||||||
|
return DefaultLatestUserMessageTailRunes
|
||||||
|
}
|
||||||
|
|
||||||
func (c MultiAgentEinoMiddlewareConfig) PlanExecuteUserInputBudgetRatioEffective() float64 {
|
func (c MultiAgentEinoMiddlewareConfig) PlanExecuteUserInputBudgetRatioEffective() float64 {
|
||||||
v := c.PlanExecuteUserInputBudgetRatio
|
v := c.PlanExecuteUserInputBudgetRatio
|
||||||
if v <= 0 {
|
if v <= 0 {
|
||||||
@@ -398,14 +451,19 @@ type MultiAgentSubConfig struct {
|
|||||||
|
|
||||||
// MultiAgentPublic 返回给前端的精简信息(不含子代理指令全文)。
|
// MultiAgentPublic 返回给前端的精简信息(不含子代理指令全文)。
|
||||||
type MultiAgentPublic struct {
|
type MultiAgentPublic struct {
|
||||||
Enabled bool `json:"enabled"`
|
Enabled bool `json:"enabled"`
|
||||||
RobotDefaultAgentMode string `json:"robot_default_agent_mode,omitempty"`
|
RobotDefaultAgentMode string `json:"robot_default_agent_mode,omitempty"`
|
||||||
BatchUseMultiAgent bool `json:"batch_use_multi_agent"`
|
BatchUseMultiAgent bool `json:"batch_use_multi_agent"`
|
||||||
SubAgentCount int `json:"sub_agent_count"`
|
SubAgentCount int `json:"sub_agent_count"`
|
||||||
Orchestration string `json:"orchestration,omitempty"`
|
Orchestration string `json:"orchestration,omitempty"`
|
||||||
PlanExecuteLoopMaxIterations int `json:"plan_execute_loop_max_iterations"`
|
PlanExecuteLoopMaxIterations int `json:"plan_execute_loop_max_iterations"`
|
||||||
ToolSearchAlwaysVisibleTools []string `json:"tool_search_always_visible_tools,omitempty"`
|
SummarizationUserIntentLedgerMaxRunes int `json:"summarization_user_intent_ledger_max_runes"`
|
||||||
ToolSearchAlwaysVisibleEffectiveTools []string `json:"tool_search_always_visible_effective_tools,omitempty"`
|
SummarizationUserIntentLedgerEntryMaxRunes int `json:"summarization_user_intent_ledger_entry_max_runes"`
|
||||||
|
LatestUserMessageMaxRunes int `json:"latest_user_message_max_runes"`
|
||||||
|
LatestUserMessageHeadRunes int `json:"latest_user_message_head_runes"`
|
||||||
|
LatestUserMessageTailRunes int `json:"latest_user_message_tail_runes"`
|
||||||
|
ToolSearchAlwaysVisibleTools []string `json:"tool_search_always_visible_tools,omitempty"`
|
||||||
|
ToolSearchAlwaysVisibleEffectiveTools []string `json:"tool_search_always_visible_effective_tools,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// NormalizeAgentMode 解析代理模式(eino_single | deep | plan_execute | supervisor);空值默认 eino_single。
|
// NormalizeAgentMode 解析代理模式(eino_single | deep | plan_execute | supervisor);空值默认 eino_single。
|
||||||
@@ -445,10 +503,15 @@ func NormalizeMultiAgentOrchestration(s string) string {
|
|||||||
|
|
||||||
// MultiAgentAPIUpdate 设置页/API 仅更新多代理标量字段;写入 YAML 时不覆盖 sub_agents 等块。
|
// MultiAgentAPIUpdate 设置页/API 仅更新多代理标量字段;写入 YAML 时不覆盖 sub_agents 等块。
|
||||||
type MultiAgentAPIUpdate struct {
|
type MultiAgentAPIUpdate struct {
|
||||||
Enabled bool `json:"enabled"`
|
Enabled bool `json:"enabled"`
|
||||||
RobotDefaultAgentMode string `json:"robot_default_agent_mode,omitempty"`
|
RobotDefaultAgentMode string `json:"robot_default_agent_mode,omitempty"`
|
||||||
BatchUseMultiAgent bool `json:"batch_use_multi_agent"`
|
BatchUseMultiAgent bool `json:"batch_use_multi_agent"`
|
||||||
PlanExecuteLoopMaxIterations *int `json:"plan_execute_loop_max_iterations,omitempty"`
|
PlanExecuteLoopMaxIterations *int `json:"plan_execute_loop_max_iterations,omitempty"`
|
||||||
|
SummarizationUserIntentLedgerMaxRunes *int `json:"summarization_user_intent_ledger_max_runes,omitempty"`
|
||||||
|
SummarizationUserIntentLedgerEntryMaxRunes *int `json:"summarization_user_intent_ledger_entry_max_runes,omitempty"`
|
||||||
|
LatestUserMessageMaxRunes *int `json:"latest_user_message_max_runes,omitempty"`
|
||||||
|
LatestUserMessageHeadRunes *int `json:"latest_user_message_head_runes,omitempty"`
|
||||||
|
LatestUserMessageTailRunes *int `json:"latest_user_message_tail_runes,omitempty"`
|
||||||
// 指针区分「JSON 未传该字段」与「传空数组要清空」;省略时不应覆盖 YAML 中的常驻工具白名单。
|
// 指针区分「JSON 未传该字段」与「传空数组要清空」;省略时不应覆盖 YAML 中的常驻工具白名单。
|
||||||
ToolSearchAlwaysVisibleTools *[]string `json:"tool_search_always_visible_tools,omitempty"`
|
ToolSearchAlwaysVisibleTools *[]string `json:"tool_search_always_visible_tools,omitempty"`
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -91,3 +91,52 @@ func TestHitlAuditModelEffectiveFallsBackToMainConfig(t *testing.T) {
|
|||||||
t.Fatalf("expected audit model override, got %q", got.Model)
|
t.Fatalf("expected audit model override, got %q", got.Model)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestSummarizationUserIntentLedgerRunesEffective(t *testing.T) {
|
||||||
|
var zero MultiAgentEinoMiddlewareConfig
|
||||||
|
if got := zero.SummarizationUserIntentLedgerMaxRunesEffective(); got != DefaultSummarizationUserIntentLedgerMaxRunes {
|
||||||
|
t.Fatalf("default ledger max runes = %d, want %d", got, DefaultSummarizationUserIntentLedgerMaxRunes)
|
||||||
|
}
|
||||||
|
if got := zero.SummarizationUserIntentLedgerEntryMaxRunesEffective(); got != DefaultSummarizationUserIntentLedgerEntryMaxRunes {
|
||||||
|
t.Fatalf("default ledger entry max runes = %d, want %d", got, DefaultSummarizationUserIntentLedgerEntryMaxRunes)
|
||||||
|
}
|
||||||
|
|
||||||
|
custom := MultiAgentEinoMiddlewareConfig{
|
||||||
|
SummarizationUserIntentLedgerMaxRunes: 12345,
|
||||||
|
SummarizationUserIntentLedgerEntryMaxRunes: 2345,
|
||||||
|
}
|
||||||
|
if got := custom.SummarizationUserIntentLedgerMaxRunesEffective(); got != 12345 {
|
||||||
|
t.Fatalf("custom ledger max runes = %d", got)
|
||||||
|
}
|
||||||
|
if got := custom.SummarizationUserIntentLedgerEntryMaxRunesEffective(); got != 2345 {
|
||||||
|
t.Fatalf("custom ledger entry max runes = %d", got)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestLatestUserMessageRunesEffective(t *testing.T) {
|
||||||
|
var zero MultiAgentEinoMiddlewareConfig
|
||||||
|
if got := zero.LatestUserMessageMaxRunesEffective(); got != DefaultLatestUserMessageMaxRunes {
|
||||||
|
t.Fatalf("default latest user max runes = %d, want %d", got, DefaultLatestUserMessageMaxRunes)
|
||||||
|
}
|
||||||
|
if got := zero.LatestUserMessageHeadRunesEffective(); got != DefaultLatestUserMessageHeadRunes {
|
||||||
|
t.Fatalf("default latest user head runes = %d, want %d", got, DefaultLatestUserMessageHeadRunes)
|
||||||
|
}
|
||||||
|
if got := zero.LatestUserMessageTailRunesEffective(); got != DefaultLatestUserMessageTailRunes {
|
||||||
|
t.Fatalf("default latest user tail runes = %d, want %d", got, DefaultLatestUserMessageTailRunes)
|
||||||
|
}
|
||||||
|
|
||||||
|
custom := MultiAgentEinoMiddlewareConfig{
|
||||||
|
LatestUserMessageMaxRunes: 100,
|
||||||
|
LatestUserMessageHeadRunes: 40,
|
||||||
|
LatestUserMessageTailRunes: 60,
|
||||||
|
}
|
||||||
|
if got := custom.LatestUserMessageMaxRunesEffective(); got != 100 {
|
||||||
|
t.Fatalf("custom latest user max runes = %d", got)
|
||||||
|
}
|
||||||
|
if got := custom.LatestUserMessageHeadRunesEffective(); got != 40 {
|
||||||
|
t.Fatalf("custom latest user head runes = %d", got)
|
||||||
|
}
|
||||||
|
if got := custom.LatestUserMessageTailRunesEffective(); got != 60 {
|
||||||
|
t.Fatalf("custom latest user tail runes = %d", got)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user