Files
reverse-engineering-anything/src/javascript/recovery/WakaruVersion.ts
T
gensokyo-dev e18594b247 refactor(composition): unify capability bindings and cleanup ownership (#8441)
Bind typed service creation, observed availability and retryable cleanup in one composition owner. Reuse selected CLI/MCP factories and canonical contract groups without copying provider operation inventories.

Closes #8429. Refs #740.

Validated paired real application workflows, actual local Codex CLI Terra/high use, complete Evidence and Unknown checkpoint parity, compiler-backed import boundaries, SDK schemas and final real mixed routing. Automated review findings were fixed at their producing owners. Existing exact-base CodeQL alerts are documented on the PR under the owner-authorized unrelated-check exception; no global alerts or security rules were changed.

Assisted-by: Suika (gensokyo-skills:suika-scatter-gather-planning)
2026-11-01 13:30:21 +08:00

41 lines
1.6 KiB
TypeScript

import { satisfies, valid } from "semver";
import { WAKARU_ACCEPTED_RANGE } from "./WakaruRelease.js";
import { WAKARU_RELEASE } from "./WakaruProviderIdentity.js";
/** Admission of one observed `wakaru --version` banner. */
export type WakaruVersionAdmission =
| { readonly status: "verified"; readonly version: string }
| {
readonly status: "compatible";
readonly version: string;
readonly limitation: string;
}
| { readonly status: "unsupported"; readonly message: string };
/** Caller-facing accepted releases, naming the verified build. */
export const wakaruReleaseLine = (): string =>
`Wakaru ${WAKARU_ACCEPTED_RANGE} (verified with ${WAKARU_RELEASE.version})`;
/** Classify a `wakaru <version>` banner against the accepted release range. */
export const admitWakaruVersion = (banner: string): WakaruVersionAdmission => {
const token = banner.startsWith("wakaru ")
? banner.slice("wakaru ".length)
: undefined;
if (
token === undefined ||
valid(token) !== token ||
!satisfies(token, WAKARU_ACCEPTED_RANGE)
)
return {
status: "unsupported",
message: `Unsupported Wakaru version ${banner.length === 0 ? "missing" : banner}; accepted releases are ${wakaruReleaseLine()}`,
};
if (token === WAKARU_RELEASE.version)
return { status: "verified", version: token };
return {
status: "compatible",
version: token,
limitation: `This session uses Wakaru ${token}. The report parser is verified against ${WAKARU_RELEASE.version}; other ${WAKARU_ACCEPTED_RANGE} releases are accepted and the observed version is reported.`,
};
};