Skip to content

The open-source app everyone uses to manage agents at work

fix: honor Hermes local command override (#3503)

Hiuri Noronha1bf242437780
diff --git a/server/src/adapters/registry.ts b/server/src/adapters/registry.ts
index d3fa0fbec7..59f0128920 100644
--- a/server/src/adapters/registry.ts
+++ b/server/src/adapters/registry.ts
@@ -86,6 +86,37 @@ import { getDisabledAdapterTypes } from "../services/adapter-plugin-store.js";
import { processAdapter } from "./process/index.js";
import { httpAdapter } from "./http/index.js";
+function normalizeHermesConfig<T extends { config?: unknown; agent?: unknown }>(ctx: T): T {
+ const config =
+ ctx && typeof ctx === "object" && "config" in ctx && ctx.config && typeof ctx.config === "object"
+ ? (ctx.config as Record<string, unknown>)
+ : null;
+ const agent =
+ ctx && typeof ctx === "object" && "agent" in ctx && ctx.agent && typeof ctx.agent === "object"
+ ? (ctx.agent as Record<string, unknown>)
+ : null;
+ const agentAdapterConfig =
+ agent?.adapterConfig && typeof agent.adapterConfig === "object"
+ ? (agent.adapterConfig as Record<string, unknown>)
+ : null;
+
+ const configCommand =
+ typeof config?.command === "string" && config.command.length > 0 ? config.command : undefined;
+ const agentCommand =
+ typeof agentAdapterConfig?.command === "string" && agentAdapterConfig.command.length > 0
+ ? agentAdapterConfig.command
+ : undefined;
+
+ if (config && !config.hermesCommand && configCommand) {
+ config.hermesCommand = configCommand;
+ }
+ if (agentAdapterConfig && !agentAdapterConfig.hermesCommand && agentCommand) {
+ agentAdapterConfig.hermesCommand = agentCommand;
+ }
+
+ return ctx;
+}
+
const claudeLocalAdapter: ServerAdapterModule = {
type: "claude_local",
execute: claudeExecute,
@@ -202,8 +233,8 @@ const piLocalAdapter: ServerAdapterModule = {
const hermesLocalAdapter: ServerAdapterModule = {
type: "hermes_local",
- execute: hermesExecute,
- testEnvironment: hermesTestEnvironment,
+ execute: (ctx) => hermesExecute(normalizeHermesConfig(ctx) as never),
+ testEnvironment: (ctx) => hermesTestEnvironment(normalizeHermesConfig(ctx) as never),
sessionCodec: hermesSessionCodec,
listSkills: hermesListSkills,
syncSkills: hermesSyncSkills,
diff --git a/ui/src/adapters/hermes-local/index.ts b/ui/src/adapters/hermes-local/index.ts
index c037a747dc..a74491748b 100644
--- a/ui/src/adapters/hermes-local/index.ts
+++ b/ui/src/adapters/hermes-local/index.ts
@@ -1,12 +1,12 @@
import type { UIAdapterModule } from "../types";
import { parseHermesStdoutLine } from "hermes-paperclip-adapter/ui";
-import { SchemaConfigFields, buildSchemaAdapterConfig } from "../schema-config-fields";
import { buildHermesConfig } from "hermes-paperclip-adapter/ui";
+import { SchemaConfigFields } from "../schema-config-fields";
export const hermesLocalUIAdapter: UIAdapterModule = {
type: "hermes_local",
label: "Hermes Agent",
parseStdoutLine: parseHermesStdoutLine,
ConfigFields: SchemaConfigFields,
- buildAdapterConfig: buildSchemaAdapterConfig,
+ buildAdapterConfig: buildHermesConfig,
};
diff --git a/ui/src/components/AgentConfigForm.tsx b/ui/src/components/AgentConfigForm.tsx
index 17437bc84f..a053b26058 100644
--- a/ui/src/components/AgentConfigForm.tsx
+++ b/ui/src/components/AgentConfigForm.tsx
@@ -291,6 +291,8 @@ export function AgentConfigForm(props: AgentConfigFormProps) {
enabled: Boolean(selectedCompanyId),
});
const models = fetchedModels ?? externalModels ?? [];
+ const adapterCommandField =
+ adapterType === "hermes_local" ? "hermesCommand" : "command";
const {
data: detectedModelData,
refetch: refetchDetectedModel,
@@ -346,7 +348,19 @@ export function AgentConfigForm(props: AgentConfigFormProps) {
return uiAdapter.buildAdapterConfig(val!);
}
const base = config as Record<string, unknown>;
- return { ...base, ...overlay.adapterConfig };
+ const next = { ...base, ...overlay.adapterConfig };
+ if (adapterType === "hermes_local") {
+ const hermesCommand =
+ typeof next.hermesCommand === "string" && next.hermesCommand.length > 0
+ ? next.hermesCommand
+ : typeof next.command === "string" && next.command.length > 0
+ ? next.command
+ : undefined;
+ if (hermesCommand) {
+ next.hermesCommand = hermesCommand;
+ }
+ }
+ return next;
}
const testEnvironment = useMutation({
@@ -667,12 +681,20 @@ export function AgentConfigForm(props: AgentConfigFormProps) {
value={
isCreate
? val!.command
- : eff("adapterConfig", "command", String(config.command ?? ""))
+ : eff(
+ "adapterConfig",
+ adapterCommandField,
+ String(
+ (adapterType === "hermes_local"
+ ? config.hermesCommand ?? config.command
+ : config.command) ?? "",
+ ),
+ )
}
onCommit={(v) =>
isCreate
? set!({ command: v })
- : mark("adapterConfig", "command", v || null)
+ : mark("adapterConfig", adapterCommandField, v || null)
}
immediate
className={inputClass}