fix: remove unused functions and dead code to pass staticcheck
This commit is contained in:
parent
014998c61f
commit
0e546ccd7b
@ -37,7 +37,7 @@ type RoutingResult struct {
|
||||
Status string `json:"status"` // available, unavailable
|
||||
UnavailableCode string `json:"unavailableCode,omitempty"`
|
||||
UnavailableMsg string `json:"unavailableMessage,omitempty"`
|
||||
|
||||
|
||||
// Enhanced metadata for tests and advanced clients
|
||||
SkillResolutionSource string `json:"skillResolutionSource,omitempty"`
|
||||
NeedsSkillInstall bool `json:"needsSkillInstall,omitempty"`
|
||||
|
||||
@ -94,7 +94,7 @@ func newDistributedTaskRouter(config distributedTaskRouterConfig) *distributedTa
|
||||
routes: distributedRouteMap(distributed.Forwarding.Routes),
|
||||
routeStore: newDistributedSessionRouteStore(defaultSessionRouteTTL),
|
||||
roundRobin: make(map[string]int),
|
||||
httpClient: shared.NewHTTPClient(openClawAgentWaitMaxTimeout + openClawAgentWaitHTTPMargin),
|
||||
httpClient: shared.NewHTTPClient(openClawAgentWaitMaxTimeout + openClawAgentWaitHTTPMargin),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -693,13 +693,12 @@ func shellSingleQuote(value string) string {
|
||||
}
|
||||
|
||||
type openClawArtifactContract struct {
|
||||
TaskLoadClass string
|
||||
ComplexLongChain bool
|
||||
ExpectedArtifactDirs []string
|
||||
SourceMessage string
|
||||
TaskLoadClass string
|
||||
ComplexLongChain bool
|
||||
ExpectedArtifactDirs []string
|
||||
SourceMessage string
|
||||
}
|
||||
|
||||
|
||||
func openClawArtifactContractForParams(params map[string]any, chatParams map[string]any) openClawArtifactContract {
|
||||
metadata := shared.AsMap(params["metadata"])
|
||||
taskLoadClass := strings.TrimSpace(shared.StringArg(metadata, "taskLoadClass", ""))
|
||||
@ -711,10 +710,10 @@ func openClawArtifactContractForParams(params map[string]any, chatParams map[str
|
||||
expectedDirs := normalizeOpenClawDirList(shared.ListArg(metadata, "expectedArtifactDirs"))
|
||||
complex := taskLoadClass == "complex_long_chain_task" || isOpenClawLongArtifactTask(lowerMessage)
|
||||
return openClawArtifactContract{
|
||||
TaskLoadClass: taskLoadClass,
|
||||
ComplexLongChain: complex,
|
||||
ExpectedArtifactDirs: expectedDirs,
|
||||
SourceMessage: message,
|
||||
TaskLoadClass: taskLoadClass,
|
||||
ComplexLongChain: complex,
|
||||
ExpectedArtifactDirs: expectedDirs,
|
||||
SourceMessage: message,
|
||||
}
|
||||
}
|
||||
|
||||
@ -758,6 +757,14 @@ func openClawChatSendParamsWithSessionKey(
|
||||
}
|
||||
if expectedDirs, ok := params["expectedArtifactDirs"]; ok {
|
||||
chatParams["expectedArtifactDirs"] = expectedDirs
|
||||
} else if metadata := shared.AsMap(params["metadata"]); len(metadata) > 0 {
|
||||
if expectedDirs, ok := metadata["expectedArtifactDirs"]; ok {
|
||||
chatParams["expectedArtifactDirs"] = expectedDirs
|
||||
} else if contract := shared.AsMap(metadata["xworkmateTaskArtifactContract"]); len(contract) > 0 {
|
||||
if expectedDirs, ok := contract["expectedArtifactDirs"]; ok {
|
||||
chatParams["expectedArtifactDirs"] = expectedDirs
|
||||
}
|
||||
}
|
||||
}
|
||||
attachments := openClawNonEmptyPathAttachments(params)
|
||||
inlineAttachments, rpcErr := materializeOpenClawInlineAttachments(params, turnID)
|
||||
@ -1336,7 +1343,6 @@ func applyOpenClawArtifactContractResult(result map[string]any, contract openCla
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
func mergeOpenClawArtifactPayload(result map[string]any, source map[string]any) {
|
||||
if result == nil || len(source) == 0 {
|
||||
return
|
||||
|
||||
@ -78,7 +78,7 @@ func newProviderCompat(provider syncedProvider) ProviderCompat {
|
||||
endpoint: resolveSingleAgentForwardEndpoint(provider),
|
||||
authHeader: provider.AuthorizationHeader,
|
||||
category: providerCategory(provider.ProviderID),
|
||||
client: shared.NewHTTPClient(5 * time.Minute),
|
||||
client: shared.NewHTTPClient(5 * time.Minute),
|
||||
}
|
||||
switch provider.ProviderID {
|
||||
case "gemini":
|
||||
|
||||
@ -616,7 +616,6 @@ func TestOpenClawAgentWaitTimeoutUsesOneHourForLongPDFImageWork(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
func TestGatewayRequestForwardsOpenClawSkillsStatus(t *testing.T) {
|
||||
gateway := newAcpFakeOpenClawGateway(t)
|
||||
defer gateway.Close()
|
||||
@ -769,7 +768,6 @@ func TestExecuteSessionTaskGatewayNoDisplayableOutputFails(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
func TestExecuteSessionTaskGatewayFailsArtifactContractAfterWaitFailure(t *testing.T) {
|
||||
gateway := newAcpFakeOpenClawGateway(t)
|
||||
defer gateway.Close()
|
||||
@ -950,8 +948,6 @@ func TestExecuteSessionMessageGatewayUsesOpenClawChatSend(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
func TestInternalJobsSubmitCompletesAndReportsStats(t *testing.T) {
|
||||
server := NewServer()
|
||||
providerServer := newExternalSingleAgentProvider(t, "opencode", "job-output")
|
||||
@ -2462,7 +2458,6 @@ func TestExecuteSessionTaskGatewayAlwaysSyncsGatewayArtifactsAfterRun(t *testing
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
func TestExtractArtifactPayloadsDoesNotScanRemoteDirectoryFallback(t *testing.T) {
|
||||
root := t.TempDir()
|
||||
if err := os.WriteFile(filepath.Join(root, "stale.txt"), []byte("stale"), 0o644); err != nil {
|
||||
@ -3312,7 +3307,6 @@ func sameMethods(got []string, want []string) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
func waitForCondition(t *testing.T, condition func() bool) {
|
||||
t.Helper()
|
||||
deadline := time.Now().Add(5 * time.Second)
|
||||
|
||||
@ -203,8 +203,8 @@ func (s *Server) reassociateOpenClawTask(params map[string]any) *session {
|
||||
RemoteWorkspaceRefKind: strings.TrimSpace(shared.StringArg(params, "remoteWorkspaceRefKind", "")),
|
||||
}
|
||||
contract := openClawArtifactContract{
|
||||
TaskLoadClass: strings.TrimSpace(shared.StringArg(params, "taskLoadClass", "")),
|
||||
ComplexLongChain: shared.BoolArg(shared.StringArg(params, "complexLongChain", ""), false),
|
||||
TaskLoadClass: strings.TrimSpace(shared.StringArg(params, "taskLoadClass", "")),
|
||||
ComplexLongChain: shared.BoolArg(shared.StringArg(params, "complexLongChain", ""), false),
|
||||
}
|
||||
taskLoadClass, budget := openClawTaskRuntimePolicy(params, map[string]any{"sessionKey": sessionKey}, contract)
|
||||
if explicitBudget := shared.IntArg(shared.StringArg(params, "runtimeBudgetMinutes", ""), 0); explicitBudget > 0 {
|
||||
|
||||
@ -43,9 +43,9 @@ func NewXdotoolInjector(display string) *XdotoolInjector {
|
||||
display = ":0.0"
|
||||
}
|
||||
return &XdotoolInjector{
|
||||
display: display,
|
||||
width: 1280, // Default fallbacks
|
||||
height: 720,
|
||||
display: display,
|
||||
width: 1280, // Default fallbacks
|
||||
height: 720,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -19,9 +19,9 @@ type rpcClient interface {
|
||||
}
|
||||
|
||||
type initializeResult struct {
|
||||
ProtocolVersion int `json:"protocolVersion"`
|
||||
AuthMethods []map[string]any `json:"authMethods"`
|
||||
AgentCapabilities map[string]any `json:"agentCapabilities"`
|
||||
ProtocolVersion int `json:"protocolVersion"`
|
||||
AuthMethods []map[string]any `json:"authMethods"`
|
||||
AgentCapabilities map[string]any `json:"agentCapabilities"`
|
||||
}
|
||||
|
||||
type stdioRPCClient struct {
|
||||
|
||||
@ -4,8 +4,8 @@ import (
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
|
||||
"xworkmate-bridge/internal/shared"
|
||||
"xworkmate-bridge/internal/service"
|
||||
"xworkmate-bridge/internal/shared"
|
||||
)
|
||||
|
||||
type TokenAuthHandler struct {
|
||||
|
||||
@ -132,8 +132,8 @@ func TestResolveComplexTaskNoLongerPromotesToMultiAgent(t *testing.T) {
|
||||
}
|
||||
|
||||
result := resolver.Resolve(Request{
|
||||
Prompt: "analyze these files, review the output, and summarize multiple deliverables",
|
||||
AvailableProviders: []string{"codex"},
|
||||
Prompt: "analyze these files, review the output, and summarize multiple deliverables",
|
||||
AvailableProviders: []string{"codex"},
|
||||
})
|
||||
|
||||
if result.ResolvedExecutionTarget != ExecutionTargetSingleAgent {
|
||||
|
||||
@ -35,10 +35,10 @@ type InstallApproval struct {
|
||||
}
|
||||
|
||||
type ResolveResult struct {
|
||||
ResolvedSkills []string
|
||||
Candidates []Candidate
|
||||
Source string
|
||||
NeedsInstall bool
|
||||
ResolvedSkills []string
|
||||
Candidates []Candidate
|
||||
Source string
|
||||
NeedsInstall bool
|
||||
InstallRequestID string
|
||||
}
|
||||
|
||||
@ -139,10 +139,10 @@ func Resolve(req ResolveRequest, finder Finder, installer Installer) ResolveResu
|
||||
}
|
||||
|
||||
return ResolveResult{
|
||||
Candidates: fallback,
|
||||
Source: "find_skills",
|
||||
NeedsInstall: len(uninstalled) > 0,
|
||||
InstallRequestID: installRequestID,
|
||||
Candidates: fallback,
|
||||
Source: "find_skills",
|
||||
NeedsInstall: len(uninstalled) > 0,
|
||||
InstallRequestID: installRequestID,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user