From a07871a55ee77eea15e4e7d1b6cccce720c6f066 Mon Sep 17 00:00:00 2001 From: Wiedzmin <56316383+art-wiedzmin@users.noreply.github.com> Date: Thu, 30 Jul 2026 21:44:25 +0300 Subject: [PATCH] fix(omp): support Windows session paths (#2092) --- src/integration/assets/herdr-agent-state.test.ts | 11 +++++++++++ src/integration/assets/omp/herdr-agent-state.ts | 13 ++++++++++--- src/integration/mod.rs | 2 +- 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/src/integration/assets/herdr-agent-state.test.ts b/src/integration/assets/herdr-agent-state.test.ts index 1dadbd5f..f54332ce 100644 --- a/src/integration/assets/herdr-agent-state.test.ts +++ b/src/integration/assets/herdr-agent-state.test.ts @@ -227,6 +227,17 @@ for (const integration of integrations) { }); } +test("OMP accepts POSIX and Windows session paths", async () => { + const { isAbsoluteSessionPath } = await importFresh("./omp/herdr-agent-state.ts"); + + expect(isAbsoluteSessionPath("/tmp/omp-session.jsonl")).toBe(true); + expect(isAbsoluteSessionPath("C:\\Users\\User\\.omp\\agent\\sessions\\omp-session.jsonl")).toBe( + true, + ); + expect(isAbsoluteSessionPath("C:/Users/User/.omp/agent/sessions/omp-session.jsonl")).toBe(true); + expect(isAbsoluteSessionPath("relative/omp-session.jsonl")).toBe(false); +}); + test("Pi reports idle only after the agent settles", async () => { const requests = await startRecordingServer("pi-settled"); const { handlers, pi } = createExtensionHarness(); diff --git a/src/integration/assets/omp/herdr-agent-state.ts b/src/integration/assets/omp/herdr-agent-state.ts index b3f88c93..88f804aa 100644 --- a/src/integration/assets/omp/herdr-agent-state.ts +++ b/src/integration/assets/omp/herdr-agent-state.ts @@ -2,10 +2,11 @@ // managed by herdr; reinstalling or updating the integration overwrites this file. // add custom hooks/plugins beside this file instead of editing it. // HERDR_INTEGRATION_ID=omp -// HERDR_INTEGRATION_VERSION=7 +// HERDR_INTEGRATION_VERSION=8 // @ts-nocheck import net from "node:net"; +import path from "node:path"; const HERDR_ENV = process.env.HERDR_ENV; const socketPath = process.env.HERDR_SOCKET_PATH; @@ -84,11 +85,17 @@ function nextReportSeq(): number { return reportSeq; } +export function isAbsoluteSessionPath(file: unknown): file is string { + return ( + typeof file === "string" && + (path.posix.isAbsolute(file) || path.win32.isAbsolute(file)) + ); +} + function updateSessionRef(ctx: any): void { try { const file = ctx?.sessionManager?.getSessionFile?.(); - currentAgentSessionPath = - typeof file === "string" && file.startsWith("/") ? file : undefined; + currentAgentSessionPath = isAbsoluteSessionPath(file) ? file : undefined; } catch { currentAgentSessionPath = undefined; } diff --git a/src/integration/mod.rs b/src/integration/mod.rs index 77d8ddda..b691dce9 100644 --- a/src/integration/mod.rs +++ b/src/integration/mod.rs @@ -25,7 +25,7 @@ const PI_EXTENSION_ASSET: &str = include_str!("assets/pi/herdr-agent-state.ts"); const PI_INTEGRATION_VERSION: u32 = 7; const OMP_EXTENSION_INSTALL_NAME: &str = "herdr-omp-agent-state.ts"; const OMP_EXTENSION_ASSET: &str = include_str!("assets/omp/herdr-agent-state.ts"); -const OMP_INTEGRATION_VERSION: u32 = 7; +const OMP_INTEGRATION_VERSION: u32 = 8; const CLAUDE_HOOK_INSTALL_NAME: &str = if cfg!(windows) { "herdr-agent-state.ps1" } else {