MCPcopy Create free account
hub / github.com/compozy/agh / validateCreateSessionRequest

Function validateCreateSessionRequest

internal/api/core/session_workspace.go:27–41  ·  view source on GitHub ↗

ValidateCreateSessionRequest enforces the shared session workspace contract.

(prefix string, workspaceRef string, workspacePath string)

Source from the content-addressed store, hash-verified

25
26// ValidateCreateSessionRequest enforces the shared session workspace contract.
27func validateCreateSessionRequest(prefix string, workspaceRef string, workspacePath string) error {
28 trimmedRef := strings.TrimSpace(workspaceRef)
29 trimmedPath := strings.TrimSpace(workspacePath)
30
31 switch {
32 case trimmedRef == "" && trimmedPath == "":
33 return prefixedError(prefix, "workspace or workspace_path is required")
34 case trimmedRef != "" && trimmedPath != "":
35 return prefixedError(prefix, "workspace and workspace_path are mutually exclusive")
36 case trimmedPath != "":
37 return validateAbsolutePathInternal(prefix, "workspace_path", trimmedPath)
38 default:
39 return nil
40 }
41}
42
43// validateCreateSessionRuntimeOverrides enforces the model + reasoning_effort
44// invariants for create-session payloads. Provider must be set when either

Callers 2

Calls 2

prefixedErrorFunction · 0.85

Tested by 1