UNPKG

@code-yeongyu/senpi

Version:

Coding agent CLI with read, bash, edit, write tools and session management

43 lines • 2.95 kB
/** `epoch`: the epoch was defined at build time and may break a version tie. `nodef`: it was not. */ export type EngineOrdinalScheme = "epoch" | "nodef"; /** `[year, month, day, postReleaseIncrement, buildEpochSeconds]`. */ export type EngineOrdinal = readonly [number, number, number, number, number]; export interface EngineBuildIdentity { /** Human- and log-facing build string: `VERSION` plus `+<epoch>.<sha7>` when defined. */ readonly text: string; readonly ordinal: EngineOrdinal; readonly scheme: EngineOrdinalScheme; } export interface EngineBuildInput { /** CalVer package version: `2026.9.16` or `2026.9.16-3`. */ readonly version: string; /** Committer epoch of the built commit, in seconds. Absent or 0 selects scheme `nodef`. */ readonly epoch?: number; /** Short commit sha of the built commit, for the text only. */ readonly sha7?: string; } /** Builds an identity from explicit inputs. Never throws: an unparseable version is ordinal zero. */ export declare function engineBuildIdentityFrom(build: EngineBuildInput): EngineBuildIdentity; /** Identity of the running engine build. Constant for the life of the process. */ export declare function engineBuildIdentity(): EngineBuildIdentity; /** Whether both ordinals are senpi CalVer, the only vocabulary two builds are ordered in (senpi#7040). */ export declare function comparableEngines(a: EngineBuildIdentity, b: EngineBuildIdentity): boolean; /** * Orders two builds: `-1` when `a` is older, `1` when newer, `0` when they are equal * OR uncomparable. `[y, m, d, n]` is compared lexicographically; the build epoch breaks * a tie ONLY when BOTH sides carry one, so a build of unknown age can never outrank a * known one - the caller's handoff rule is "strictly greater", and 0 attaches instead. * A pair with an ordinal outside senpi CalVer (an omo version, an unparseable version) is * uncomparable: `[2026, 11, 18]` is not newer than an omo `[5, 1, 78]` that runs a later engine. */ export declare function compareEngineOrdinal(a: EngineBuildIdentity, b: EngineBuildIdentity): -1 | 0 | 1; /** The identity a running host advertises (`engineVersion`, `engineOrdinal`): a non-zero epoch is an `epoch` build. */ export declare function engineIdentityOf(text: string, ordinal: EngineOrdinal): EngineBuildIdentity; /** * Why handing `running` over to `successor` would DOWNGRADE it (senpi#7018), or `undefined` when it would not: * the successor is strictly older by `compareEngineOrdinal`. Equal builds, and builds uncomparable only for a * missing build epoch, are not older. A pair outside senpi CalVer cannot be proven not older, so it is refused * (senpi#7040): the running host keeps its engine, and an explicit downgrade is the only way past it. */ export declare function olderEngineDetail(successor: EngineBuildIdentity, running: EngineBuildIdentity): string | undefined; //# sourceMappingURL=engine-build-identity.d.ts.map