Fix QA validation issues and add M7.1 security fixes (#318)
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
Co-authored-by: Jason Woltje <jason@diversecanvas.com> Co-committed-by: Jason Woltje <jason@diversecanvas.com>
This commit was merged in pull request #318.
This commit is contained in:
@@ -22,6 +22,7 @@ import type {
|
||||
AgentStatusResponseData,
|
||||
KillAgentResponseData,
|
||||
} from "./types/federation-agent.types";
|
||||
import { AgentCommandError, UnknownCommandTypeError } from "./errors/command.errors";
|
||||
|
||||
/**
|
||||
* Agent command response structure
|
||||
@@ -222,26 +223,19 @@ export class FederationAgentService {
|
||||
}
|
||||
|
||||
// Route command to appropriate handler
|
||||
try {
|
||||
switch (commandType) {
|
||||
case "agent.spawn":
|
||||
return await this.handleSpawnCommand(payload as unknown as SpawnAgentCommandPayload);
|
||||
switch (commandType) {
|
||||
case "agent.spawn":
|
||||
return await this.handleSpawnCommand(payload as unknown as SpawnAgentCommandPayload);
|
||||
|
||||
case "agent.status":
|
||||
return await this.handleStatusCommand(payload as unknown as AgentStatusCommandPayload);
|
||||
case "agent.status":
|
||||
return await this.handleStatusCommand(payload as unknown as AgentStatusCommandPayload);
|
||||
|
||||
case "agent.kill":
|
||||
return await this.handleKillCommand(payload as unknown as KillAgentCommandPayload);
|
||||
case "agent.kill":
|
||||
return await this.handleKillCommand(payload as unknown as KillAgentCommandPayload);
|
||||
|
||||
default:
|
||||
throw new Error(`Unknown agent command type: ${commandType}`);
|
||||
}
|
||||
} catch (error) {
|
||||
this.logger.error(`Error handling agent command: ${String(error)}`);
|
||||
return {
|
||||
success: false,
|
||||
error: error instanceof Error ? error.message : "Unknown error",
|
||||
};
|
||||
default:
|
||||
// Unknown command type - throw business logic error
|
||||
throw new UnknownCommandTypeError(commandType);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -285,8 +279,10 @@ export class FederationAgentService {
|
||||
data: responseData,
|
||||
};
|
||||
} catch (error) {
|
||||
this.logger.error(`Failed to spawn agent: ${String(error)}`);
|
||||
throw error;
|
||||
// Wrap orchestrator errors as business logic errors
|
||||
const errorMessage = error instanceof Error ? error.message : "Failed to spawn agent";
|
||||
this.logger.error(`Failed to spawn agent: ${errorMessage}`);
|
||||
throw new AgentCommandError(`Failed to spawn agent: ${errorMessage}`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -314,8 +310,10 @@ export class FederationAgentService {
|
||||
data: responseData,
|
||||
};
|
||||
} catch (error) {
|
||||
this.logger.error(`Failed to get agent status: ${String(error)}`);
|
||||
throw error;
|
||||
// Wrap orchestrator errors as business logic errors
|
||||
const errorMessage = error instanceof Error ? error.message : "Failed to get agent status";
|
||||
this.logger.error(`Failed to get agent status: ${errorMessage}`);
|
||||
throw new AgentCommandError(`Failed to get agent status: ${errorMessage}`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -347,8 +345,10 @@ export class FederationAgentService {
|
||||
data: responseData,
|
||||
};
|
||||
} catch (error) {
|
||||
this.logger.error(`Failed to kill agent: ${String(error)}`);
|
||||
throw error;
|
||||
// Wrap orchestrator errors as business logic errors
|
||||
const errorMessage = error instanceof Error ? error.message : "Failed to kill agent";
|
||||
this.logger.error(`Failed to kill agent: ${errorMessage}`);
|
||||
throw new AgentCommandError(`Failed to kill agent: ${errorMessage}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user