From e8be967295d1b50c2efaec70809ff8f76e06f0b2 Mon Sep 17 00:00:00 2001 From: Ben Davis <45952064+bmdavis419@users.noreply.github.com> Date: Fri, 24 Jul 2026 22:26:05 -0700 Subject: [PATCH] feat: surface the Hermes model on instance status MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `connection.hello` gained an optional `model` field, but the value died in the broker: `HermesGatewayInstanceStatus` carried pluginVersion and hermesVersion with nowhere for the model to go, so the provider picker had no way to name the model Hermes actually runs. Add `model` to the status struct as a required nullable field. Null covers both "no plugin has connected yet" and "the connected plugin predates the field" — the plugin ships separately from the server, so a plugin that never sends it must still complete the handshake rather than failing the frame decoder. Tests cover the present and absent paths on both the hello frame and the status projection. The model is volatile liveness, not durable config: it belongs in broker memory alongside pluginVersion/hermesVersion/capabilities and is never persisted to settings. Co-Authored-By: Claude Opus 5 (1M context) --- packages/contracts/src/hermesGateway.test.ts | 37 ++++++++++++++++++++ packages/contracts/src/hermesGateway.ts | 7 ++++ 2 files changed, 44 insertions(+) diff --git a/packages/contracts/src/hermesGateway.test.ts b/packages/contracts/src/hermesGateway.test.ts index 9c75ffc413..992e1c3d6c 100644 --- a/packages/contracts/src/hermesGateway.test.ts +++ b/packages/contracts/src/hermesGateway.test.ts @@ -69,6 +69,7 @@ describe("Hermes gateway management contracts", () => { lastConnectedAt: "2026-07-23T12:00:00.000Z", pluginVersion: "0.2.0", hermesVersion: "1.2.3", + model: "gpt-5.6-terra", activeSessionCount: 2, protocolVersion: 2, capabilities: { @@ -82,6 +83,12 @@ describe("Hermes gateway management contracts", () => { }); expect(connected.status).toBe("connected"); expect(connected.activeSessionCount).toBe(2); + expect(connected.model).toBe("gpt-5.6-terra"); + + // A plugin that predates the `model` field still produces a valid status; + // the picker falls back to the generic label rather than failing to decode. + const withoutModel = decodeInstanceStatus({ ...connected, model: null }); + expect(withoutModel.model).toBeNull(); const upgradeRequired = decodeInstanceStatus({ ...connected, @@ -134,6 +141,7 @@ describe("Hermes gateway handshake", () => { userInput: true, attachments: false, }, + model: "gpt-5.6-terra", authentication: { type: "instance-credential", instanceId: "hermes-research", @@ -142,6 +150,35 @@ describe("Hermes gateway handshake", () => { }); expect(hello.authentication.type).toBe("instance-credential"); + expect(hello.model).toBe("gpt-5.6-terra"); + }); + + // The plugin ships separately from the server, so a plugin that predates the + // `model` field must still complete the handshake rather than failing the + // frame decoder. T3 falls back to the generic model label. + it("accepts a hello from a plugin that reports no model", () => { + const hello = decodeHello({ + type: "connection.hello", + requestId: "hello-no-model", + protocolVersion: 2, + pluginVersion: "0.2.0", + hermesVersion: "1.2.3", + capabilities: { + protocolVersion: 2, + streaming: true, + activity: true, + approvals: true, + userInput: true, + attachments: false, + }, + authentication: { + type: "instance-credential", + instanceId: "hermes-research", + credential: "persistent-secret", + }, + }); + + expect(hello.model).toBeUndefined(); }); it("decodes a future-version hello so the broker can reject it explicitly", () => { diff --git a/packages/contracts/src/hermesGateway.ts b/packages/contracts/src/hermesGateway.ts index 74d0c88ea8..08d096ea39 100644 --- a/packages/contracts/src/hermesGateway.ts +++ b/packages/contracts/src/hermesGateway.ts @@ -123,6 +123,13 @@ export const HermesGatewayInstanceStatus = Schema.Struct({ lastConnectedAt: Schema.NullOr(IsoDateTime), pluginVersion: Schema.NullOr(TrimmedNonEmptyString), hermesVersion: Schema.NullOr(TrimmedNonEmptyString), + /** + * The model the connected plugin reported at handshake, surfaced so the + * provider picker can name the model Hermes actually runs instead of a + * placeholder. Null when no plugin has connected yet, or when the connected + * plugin predates the `model` field on `connection.hello`. + */ + model: Schema.NullOr(TrimmedNonEmptyString), activeSessionCount: NonNegativeInt, protocolVersion: Schema.NullOr(PositiveInt), capabilities: Schema.NullOr(HermesGatewayCapabilities),