The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(desktop,ink): finish the shared GatewayEventMap merge; map dialapus for attribution
teknium126d16a9660bd
diff --git a/apps/desktop/src/api/client.ts b/apps/desktop/src/api/client.tsindex 10bacb1502c..10934052768 100644--- a/apps/desktop/src/api/client.ts+++ b/apps/desktop/src/api/client.ts@@ -31,8 +31,8 @@ export class HermesGateway extends JsonRpcGatewayClient {private canonical = falseprivate readonly protocol = new CanonicalDesktopProtocol()- override on<P = unknown>(type: GatewayEventName, handler: (event: GatewayEvent<P>) => void): () => void {- return super.on<P>(type, event => {+ override on<K extends GatewayEventName>(type: K, handler: (event: GatewayEvent<K>) => void): () => void {+ return super.on<K>(type, event => {// Named listeners run before wildcard listeners in the shared client.// Normalize before either kind sees the prompt, including replay delivery.if (this.canonical) { this.protocol.event(event) }diff --git a/apps/desktop/src/app/session/hooks/use-message-stream/execution-authority.test.tsx b/apps/desktop/src/app/session/hooks/use-message-stream/execution-authority.test.tsxindex b88527cc096..726b4d00eb1 100644--- a/apps/desktop/src/app/session/hooks/use-message-stream/execution-authority.test.tsx+++ b/apps/desktop/src/app/session/hooks/use-message-stream/execution-authority.test.tsx@@ -1,3 +1,4 @@+import type { GatewayEventName } from '@hermes/shared'import { act, cleanup } from '@testing-library/react'import { afterEach, expect, it } from 'vitest'@@ -8,7 +9,7 @@ afterEach(cleanup)it('rejects stale snapshots and terminal frames across generations and owner epochs', () => {const stream = renderMessageStream('authority-session')- const send = (type: string, authority_epoch: number | undefined, execution_generation: number | undefined, running?: boolean) =>+ const send = (type: GatewayEventName, authority_epoch: number | undefined, execution_generation: number | undefined, running?: boolean) =>act(() => stream.handleEvent({ type, session_id: 'authority-session', authority_epoch, execution_generation, payload: { running } }))send('message.start', 1, 9)diff --git a/apps/desktop/src/app/session/hooks/use-message-stream/replay-gap.test.tsx b/apps/desktop/src/app/session/hooks/use-message-stream/replay-gap.test.tsxindex 61ef8c04db4..69d3fad4e99 100644--- a/apps/desktop/src/app/session/hooks/use-message-stream/replay-gap.test.tsx+++ b/apps/desktop/src/app/session/hooks/use-message-stream/replay-gap.test.tsx@@ -1,3 +1,4 @@+import type { GatewayEvent } from '@hermes/shared'import { act, cleanup, waitFor } from '@testing-library/react'import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'@@ -14,19 +15,18 @@ import {sessionTileDelegate,setSessionTileDelegate} from '@/store/session-states'-import type { RpcEvent } from '@/types/hermes'import { renderMessageStream } from './test-harness'const replayGap = (sessionId: string,owner: { connectionId?: string; profile?: string }-): RpcEvent => ({+): GatewayEvent => ({...owner,payload: { latest_seq: 41, replay_epoch: 'epoch-next' },session_id: sessionId,type: 'session.replay_gap'-}) as RpcEvent+}) as GatewayEventconst inertDelegate = () => ({archiveSession: vi.fn(async () => undefined),diff --git a/apps/desktop/src/app/session/hooks/use-message-stream/steer-arrival-order.test.tsx b/apps/desktop/src/app/session/hooks/use-message-stream/steer-arrival-order.test.tsxindex 487b64fff4d..676c121d2ba 100644--- a/apps/desktop/src/app/session/hooks/use-message-stream/steer-arrival-order.test.tsx+++ b/apps/desktop/src/app/session/hooks/use-message-stream/steer-arrival-order.test.tsx@@ -28,7 +28,6 @@ import { chatMessageText } from '@/lib/chat-messages'import { createClientSessionState } from '@/lib/chat-runtime'import { setSessionTileDelegate } from '@/store/session-states'-import { STREAM_DELTA_FLUSH_MS } from './utils'import { useMessageStream } from './index'diff --git a/apps/desktop/src/app/session/hooks/use-prompt-actions/index.test.tsx b/apps/desktop/src/app/session/hooks/use-prompt-actions/index.test.tsxindex 04d1c202a16..e4077bae89c 100644--- a/apps/desktop/src/app/session/hooks/use-prompt-actions/index.test.tsx+++ b/apps/desktop/src/app/session/hooks/use-prompt-actions/index.test.tsx@@ -1,4 +1,5 @@import { JsonRpcGatewayError } from '@hermes/shared'+import type { GatewayEvent, GatewayEventName } from '@hermes/shared'import { QueryClient } from '@tanstack/react-query'import { act, cleanup, render, waitFor } from '@testing-library/react'import type { MutableRefObject } from 'react'@@ -30,7 +31,6 @@ import {} from '@/store/session'import { dropSessionState, publishSessionState } from '@/store/session-states'import { $wakeWord, resetWakeWordState } from '@/store/wake-word'-import type { RpcEvent } from '@/types/hermes'import type { SessionInfo } from '@/types/hermes'import { useMessageStream } from '../use-message-stream'@@ -101,7 +101,7 @@ async function actRender(ui: React.ReactElement) {}interface HarnessHandle {- handleEvent: (event: RpcEvent) => void+ handleEvent: (event: GatewayEvent) => voidstate: () => ClientSessionStateactiveSessionIdRef: MutableRefObject<string | null>cancelRun: () => Promise<void>@@ -513,7 +513,7 @@ describe('Stop and shared-owner execution', () => {await actRender(<Harness onReady={h => (handle = h)} rawAdmissionReceipts refreshSessions={async () => undefined} requestGateway={requestGateway} />)await handle!.submitText('first turn')- const send = (type: string, authority_epoch = 1, execution_generation = 4, extra = {}) =>+ const send = (type: GatewayEventName, authority_epoch = 1, execution_generation = 4, extra = {}) =>handle!.handleEvent({ type, session_id: RUNTIME_SESSION_ID, authority_epoch, execution_generation, payload: extra })send('message.start')diff --git a/apps/desktop/src/app/settings/config-settings.test.tsx b/apps/desktop/src/app/settings/config-settings.test.tsxindex 8060c781cc8..fb42ea448ae 100644--- a/apps/desktop/src/app/settings/config-settings.test.tsx+++ b/apps/desktop/src/app/settings/config-settings.test.tsx@@ -7,8 +7,6 @@ import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from 'viteimport type { ConfigSettings as ConfigSettingsType } from './config-settings'-import { ConfigSettings } from './config-settings'-const getHermesConfigRecord = vi.fn()const getHermesConfigSchema = vi.fn()const saveHermesConfig = vi.fn()diff --git a/contributors/emails/[email protected] b/contributors/emails/[email protected]new file mode 100644index 00000000000..ac0707a01ac--- /dev/null+++ b/contributors/emails/[email protected]@@ -0,0 +1 @@+dialapusdiff --git a/ui-tui/src/app/useSessionLifecycle.ts b/ui-tui/src/app/useSessionLifecycle.tsindex 7cdda5db494..f61e7dc3014 100644--- a/ui-tui/src/app/useSessionLifecycle.ts+++ b/ui-tui/src/app/useSessionLifecycle.ts@@ -164,6 +164,7 @@ export function useSessionLifecycle(opts: UseSessionLifecycleOptions) {canonicalSubscriptions.current.delete(sessionId)}}).catch(() => undefined)+const previous = canonicalDetachFlights.current.get(sessionId)const pending = previous ? previous.then(detach) : detach()@@ -395,6 +396,7 @@ export function useSessionLifecycle(opts: UseSessionLifecycleOptions) {patchUiState({ status: 'switching session…' })const pendingDetach = canonicalDetachFlights.current.get(id)+const request = pendingDetach? pendingDetach.then(() => flight === attachmentFlight.current? gw.request<SessionActivateResponse>('session.activate', { session_id: id }) : null)@@ -473,6 +475,7 @@ export function useSessionLifecycle(opts: UseSessionLifecycleOptions) {}const pendingDetach = canonicalDetachFlights.current.get(id)+const request = pendingDetach? pendingDetach.then(() => flight === attachmentFlight.current? gw.request<SessionResumeResponse<SessionInfo>>('session.resume', { cols: colsRef.current, session_id: id }) : null)diff --git a/ui-tui/src/types.ts b/ui-tui/src/types.tsindex 8bfbd209c15..9ae49d1b92b 100644--- a/ui-tui/src/types.ts+++ b/ui-tui/src/types.ts@@ -1,6 +1,7 @@-import type { SharedControl } from './canonicalGateway.js'import type { SubagentStatus, Usage } from '@hermes/shared/gateway-events'+import type { SharedControl } from './canonicalGateway.js'+export interface ActiveTool {context?: stringid: string