mirror of
https://github.com/morluto/rea.git
synced 2026-11-15 19:23:24 +00:00
* refactor(contracts): derive the public tool catalog from one contract-group list toolContracts.ts and toolFamilies.ts each imported and listed the same contract groups. toolContracts.ts now owns one ordered group object; TOOL_CONTRACTS is its flattened values in the same catalog order, and toolFamilies.ts reads TOOL_CONTRACT_GROUPS from it instead of re-importing every group. The static catalog-source lint rule learns the Object.values(groups).flat() composition so positional-contract enforcement still discovers every group without executing modules. * fix(lint): reject computed tool catalog groups
56 lines
1.5 KiB
TypeScript
56 lines
1.5 KiB
TypeScript
interface ProviderBinding {
|
|
readonly identity: {
|
|
readonly id: string;
|
|
readonly name: string;
|
|
readonly version: string | null;
|
|
};
|
|
readonly operations: readonly string[] | { readonly group: string };
|
|
}
|
|
|
|
interface ProviderCatalogSources {
|
|
readonly toolContracts: {
|
|
readonly TOOL_CONTRACTS: readonly { readonly name: string }[];
|
|
readonly TOOL_CONTRACT_GROUPS: Readonly<
|
|
Record<string, readonly { readonly name: string }[]>
|
|
>;
|
|
};
|
|
readonly capabilityDeclarations: {
|
|
readonly CAPABILITY_DECLARATIONS: Readonly<
|
|
Record<string, { readonly providers: readonly ProviderBinding[] }>
|
|
>;
|
|
};
|
|
}
|
|
|
|
export function providerCatalog(sources: ProviderCatalogSources): {
|
|
readonly id: string;
|
|
readonly name: string;
|
|
readonly version: string | null;
|
|
readonly capabilities: readonly string[];
|
|
}[];
|
|
|
|
export function toolFamilyCatalog(sources: {
|
|
readonly toolFamilies: {
|
|
readonly TOOL_FAMILY_DEFINITIONS: readonly {
|
|
readonly id: string;
|
|
readonly surface: string;
|
|
readonly contracts: readonly { readonly name: string }[];
|
|
}[];
|
|
};
|
|
readonly toolContracts: {
|
|
readonly TOOL_CONTRACTS: readonly unknown[];
|
|
};
|
|
readonly catalogIdentity: {
|
|
readonly FULL_CATALOG_IDENTITY: {
|
|
readonly counts: { readonly mcp_tools: number };
|
|
};
|
|
};
|
|
}): {
|
|
readonly total: number;
|
|
readonly families: readonly {
|
|
readonly id: string;
|
|
readonly surface: string;
|
|
readonly count: number;
|
|
readonly tools: readonly string[];
|
|
}[];
|
|
};
|