Files
rea/src/domain/native/inventoryCoverage.ts
T
morluto b51ed4c3ec refactor(kernel): migrate the remaining SHA-256 hex digests to sha256Hex and move isRecord into src/kernel (#11571)
* refactor(kernel): migrate the remaining one-shot SHA-256 hex digests to sha256Hex

* refactor(kernel): move isRecord into src/kernel and replace its inline copies (#11574)

* fix(scripts): import isRecord from src/kernel in the managed manifest parser
2026-11-15 20:53:36 -05:00

35 lines
1.2 KiB
TypeScript

import { z } from "zod";
import { isRecord } from "../../kernel/isRecord.js";
/**
* Whether a provider inventory discovered every procedure, string or name in
* the file. No provider establishes that today, so it is always unknown.
*/
export const inventoryDiscoveryCoverageSchema = z.literal("unknown");
/**
* What overview counts measure: every row the bound provider's procedure and
* string inventories returned, not discovery of the file. The tool
* description carries the agent-facing explanation once.
*/
export const overviewInventoryCoverageSchema = z.strictObject({
scope: z.literal("provider_inventory"),
discovery_coverage: inventoryDiscoveryCoverageSchema,
});
/**
* Label an overview from any producer, including a replayed snapshot saved
* before this record existed: the counts' meaning does not depend on who
* produced them.
*/
export const withOverviewInventoryCoverage = <Value>(overview: Value): Value =>
isRecord(overview)
? {
...overview,
inventory_coverage: {
scope: "provider_inventory",
discovery_coverage: "unknown",
} satisfies z.output<typeof overviewInventoryCoverageSchema>,
}
: overview;