diff --git a/agent/test/runner.go b/agent/test/runner.go index 9159df4d..5fc9b242 100644 --- a/agent/test/runner.go +++ b/agent/test/runner.go @@ -502,8 +502,8 @@ func (r *Executor) runSingleTest(ast *assistant.Assistant, tc *Case, agentID str // Extract output result.Output = extractOutput(response) - // Validate result using asserter - asserter := NewAsserter() + // Validate result using asserter (with response for tool_called assertions) + asserter := NewAsserter().WithResponse(response) passed, errMsg := asserter.Validate(tc, result.Output) if passed { result.Status = StatusPassed diff --git a/agent/test/script.go b/agent/test/script.go index 6f048c17..fc99674c 100644 --- a/agent/test/script.go +++ b/agent/test/script.go @@ -28,29 +28,43 @@ func NewScriptRunner(opts *Options) *ScriptRunner { } } -// ResolveScript resolves the script path from scripts.xxx.yyy format +// ResolveScript resolves the script path from scripts.xxx.yyy or scripts.xxx.yyy.zzz format func ResolveScript(input string) (*ScriptInfo, error) { // Remove "scripts." prefix path := strings.TrimPrefix(input, "scripts.") - // Split into parts: "expense.setup" -> ["expense", "setup"] + // Split into parts: + // "expense.setup" -> ["expense", "setup"] + // "expense.submission.validation" -> ["expense", "submission", "validation"] parts := strings.Split(path, ".") if len(parts) < 2 { - return nil, fmt.Errorf("invalid script path: %s (expected format: scripts.assistant.module)", input) + return nil, fmt.Errorf("invalid script path: %s (expected format: scripts.assistant.module or scripts.assistant.sub_agent.module)", input) } - // Build paths - // assistantDir: expense - // moduleName: setup - // scriptPath: expense/src/setup.ts (or assistants/expense/src/setup.ts) - // testPath: expense/src/setup_test.ts - assistantDir := parts[0] - moduleName := parts[1] + // Build paths based on number of parts + var basePaths []string + var assistantDir, moduleName string - // Try different path patterns - basePaths := []string{ - filepath.Join("assistants", assistantDir, "src"), - filepath.Join(assistantDir, "src"), + if len(parts) == 2 { + // Format: scripts.expense.setup + // assistantDir: expense + // moduleName: setup + assistantDir = parts[0] + moduleName = parts[1] + basePaths = []string{ + filepath.Join("assistants", assistantDir, "src"), + filepath.Join(assistantDir, "src"), + } + } else { + // Format: scripts.expense.submission.validation (sub-agent) + // assistantDir: expense/submission (or expense.submission) + // moduleName: validation + assistantDir = strings.Join(parts[:len(parts)-1], "/") + moduleName = parts[len(parts)-1] + basePaths = []string{ + filepath.Join("assistants", assistantDir, "src"), + filepath.Join(assistantDir, "src"), + } } var scriptPath, testPath string diff --git a/openapi/kb/document.go b/openapi/kb/document.go index 826a5832..3b055d2e 100644 --- a/openapi/kb/document.go +++ b/openapi/kb/document.go @@ -363,12 +363,14 @@ func extractCollectionIDFromDocID(docID string) string { if len(parts) < 2 { return "" } - // First part contains prefix_collection_id - prefix := parts[0] - // Find the first underscore to skip the prefix - idx := strings.Index(prefix, "_") - if idx == -1 { - return prefix - } - return prefix[idx+1:] + + return parts[0] + // // First part contains prefix_collection_id + // prefix := parts[0] + // // Find the first underscore to skip the prefix + // idx := strings.Index(prefix, "_") + // if idx == -1 { + // return prefix + // } + // return prefix[idx+1:] }