import { dockerStrategy } from "./docker";
import { manualStrategy } from "./manual";
import { pm2Strategy } from "./pm2";
import { systemdStrategy } from "./systemd";
import type { DeployMethod, DeployStrategy } from "./types";

export * from "./types";

const STRATEGIES: Record<DeployMethod, DeployStrategy> = {
  systemd: systemdStrategy,
  docker: dockerStrategy,
  pm2: pm2Strategy,
  manual: manualStrategy,
};

export function getStrategy(method: DeployMethod): DeployStrategy {
  return STRATEGIES[method] ?? systemdStrategy;
}

import type { AgentKind } from "../agents/types";

export const VERSION_PROBE: Record<AgentKind, string> = {
  // Plain command — strategy lo phần PATH (bash -lc cho systemd, pm2Cmd cho pm2, docker exec cho docker)
  opencode: "opencode --version 2>&1 | head -1",
  openclaw: "openclaw --version 2>&1 | head -1",
  hermes: "hermes --version 2>&1 | head -1",
};
