Import packages/plugin/src/harness-version.ts

This commit is contained in:
QQ 2026-11-17 08:47:17 +08:00
parent cd33e6a12c
commit 695d5ca0c6
1 changed files with 9 additions and 0 deletions

View File

@ -43,6 +43,15 @@ export function harnessSessionGeneration(version: string | undefined): HarnessSe
// 0.2.0 retains the existing Remote carrier; its on-disk format is unrelated.
return major === 0 && ((minor === 1 && patch >= 5) || minor === 2) ? 'v3' : 'legacy'
}
/** True on DSH 0.2.x+ hosts whose Session Controller emits `api-session/*` events. */
export function isLiveSessionEventsHarnessVersion(version: string | undefined): boolean {
if (version === undefined) return false
const match = /^(?:dsh-)?v?(\d+)\.(\d+)\.(\d+)(?:-|$)/u.exec(version.trim())
if (match === null) return false
const major = Number(match[1])
const minor = Number(match[2])
return major > 0 || (major === 0 && minor >= 2)
}
/** Read a candidate manifest, ignoring every package that is not the Harness CLI. */
async function readHarnessManifestVersion(manifestPath: string): Promise<string | undefined> {