@ai-matrx/agents 0.59.186 → 0.59.188

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -972,6 +972,10 @@ interface LocalVariant {
972
972
  artifacts: LocalArtifact[];
973
973
  /** Set only on a variant that came from a pasted link or a search (`fromDiscovery`); catalog rows never carry it. */
974
974
  discovery?: VariantDiscovery;
975
+ /** ai.model_variant.review_state (set by `readModelCatalog`; "offered" = listed in apps). */
976
+ review_state?: string;
977
+ /** The public.catalog_entries rows this variant carries (metadata.catalog_entry_ids; set by `readModelCatalog`). */
978
+ catalog_entry_ids?: string[];
975
979
  }
976
980
  /** What discovery said about a variant: the server's own words, carried so the one judge can show them. */
977
981
  interface VariantDiscovery {
@@ -1002,6 +1006,12 @@ interface LocalPresentation {
1002
1006
  url: string;
1003
1007
  }>;
1004
1008
  thumbnail_file_id: string | null;
1009
+ /** The admin's curated position (ai.model_presentation.display_order); `orderCatalogModels` sorts by it. */
1010
+ display_order?: number | null;
1011
+ hero_file_id?: string | null;
1012
+ gallery_file_ids?: string[];
1013
+ /** Admin display facts (ai.model_presentation.facts): ratings, speed, cutoff, tier, notes. Always set by `readModelCatalog`. */
1014
+ facts?: Record<string, unknown>;
1005
1015
  }
1006
1016
  interface LocalModel {
1007
1017
  id: string;
@@ -1019,6 +1029,15 @@ interface LocalModel {
1019
1029
  };
1020
1030
  presentation: LocalPresentation | null;
1021
1031
  variants: LocalVariant[];
1032
+ /** Matrx 2's 1.48 id for a model seeded from its old list (metadata.desktop_id). */
1033
+ desktop_id?: string | null;
1034
+ maker_logo_file_id?: string | null;
1035
+ /** The admin Catalogs kind (`catalogKindOf`): llm_model, whisper_model, tts_model_file, image_gen_model, video_gen_model, ner_model, wake_word_model, lora. */
1036
+ kind?: string;
1037
+ /** At least one variant is offered (Matrx 2 lists it). */
1038
+ offered?: boolean;
1039
+ /** The later of the model's and its presentation's updated_at: what an admin edit sends as expected_updated_at. */
1040
+ updated_at?: string | null;
1022
1041
  }
1023
1042
  interface LocalCompatRow {
1024
1043
  hardware_class: HardwareClass;
@@ -1055,6 +1074,14 @@ interface LocalModelCatalog {
1055
1074
  catalog_updated_at: string;
1056
1075
  models: LocalModel[];
1057
1076
  runtimes: LocalRuntime[];
1077
+ /**
1078
+ * sha256 of the whole shaped catalog (canonical JSON, this field left out), set by `readModelCatalog`:
1079
+ * changes on ANY change (unoffer, retire, delete, maker rename), where catalog_updated_at only moves
1080
+ * when a stamped row's updated_at does.
1081
+ */
1082
+ catalog_fingerprint?: string;
1083
+ /** Reads that failed but did not stop the catalog (each one line, said so a screen can show it). */
1084
+ warnings?: string[];
1058
1085
  }
1059
1086
  /** Whether a value is a v1 catalog with the fields every reader relies on (a cache or a fetch must pass this before it replaces anything). */
1060
1087
  declare function isLocalModelCatalog(value: unknown): value is LocalModelCatalog;
@@ -1469,13 +1496,13 @@ declare function orderCatalogGroups<T extends OrderedLike>(models: readonly T[],
1469
1496
  * one order (`orderCatalogModels` over ai.model_presentation.display_order). `curatedList` is the
1470
1497
  * only way a surface turns rows into its list, so two surfaces cannot drift apart.
1471
1498
  */
1472
- type Row = Record<string, unknown>;
1499
+ type Row$1 = Record<string, unknown>;
1473
1500
  /** A structural subset of `SupabaseClient` (only `schema().from().select()` is used). */
1474
1501
  interface CuratedCatalogClient {
1475
1502
  schema(name: string): {
1476
1503
  from(table: string): {
1477
1504
  select(columns: string): PromiseLike<{
1478
- data: Row[] | null;
1505
+ data: Row$1[] | null;
1479
1506
  error: {
1480
1507
  message: string;
1481
1508
  } | null;
@@ -1522,14 +1549,31 @@ interface CuratedModel {
1522
1549
  /** The later of the model's and its presentation's updated_at: what an edit sends as expected_updated_at. */
1523
1550
  updated_at: string | null;
1524
1551
  }
1525
- /** Shape raw ai.* rows into the curated models (pure; the query below feeds it). Dismissed variants are left out. */
1552
+ /**
1553
+ * The review states that take a variant OFF every list (ai.model_review_state: discovered, files_checked,
1554
+ * tested, offered, rejected, withdrawn). A rejected or withdrawn variant is never shown; a model left with
1555
+ * none is not listed.
1556
+ */
1557
+ declare const EXCLUDED_REVIEW_STATES: ReadonlySet<string>;
1558
+ /** Whether a variant row stays on the curated list (live, and not rejected or withdrawn). */
1559
+ declare const isListedVariant: (v: Row$1) => boolean;
1560
+ /** The four raw ai.* reads the curated list is shaped from (live rows only; RLS applies). */
1561
+ interface CuratedRows {
1562
+ models: Row$1[];
1563
+ variants: Row$1[];
1564
+ presentations: Row$1[];
1565
+ providers: Row$1[];
1566
+ }
1567
+ /** Shape raw ai.* rows into the curated models (pure; the query below feeds it). Rejected and withdrawn variants are left out. */
1526
1568
  declare function shapeCuratedModels(input: {
1527
- models: Row[];
1528
- variants: Row[];
1529
- presentations: Row[];
1530
- providers: Row[];
1569
+ models: Row$1[];
1570
+ variants: Row$1[];
1571
+ presentations: Row$1[];
1572
+ providers: Row$1[];
1531
1573
  }): CuratedModel[];
1532
- /** THE query: every live, unretired model with a non-dismissed variant, from ai.* (RLS applies). */
1574
+ /** The four reads behind the curated list (live rows of ai.model_definition, model_variant, model_presentation, provider). */
1575
+ declare function readCuratedRows(client: CuratedCatalogClient): Promise<CuratedRows>;
1576
+ /** THE query: every live, unretired model with a variant that is not rejected or withdrawn, from ai.* (RLS applies). */
1533
1577
  declare function fetchCuratedModels(client: CuratedCatalogClient): Promise<CuratedModel[]>;
1534
1578
  /**
1535
1579
  * THE list a surface shows, in the curated order. `offeredOnly` is Matrx 2's list; the admin page
@@ -1540,4 +1584,79 @@ declare function curatedList<T extends CuratedModel>(models: readonly T[], { off
1540
1584
  offeredOnly: boolean;
1541
1585
  }): T[];
1542
1586
 
1543
- export { type AdminOffering, type AdminPricingBand, type ArtifactUse, type AuditCapabilitiesRecord, CHAT_DEFAULT_MODEL_KNOB, CONTENT_TYPES, type CapabilitiesParseContext, type CatalogModel, type CatalogTier, type CompatStatus, type ContentType, type CuratedCatalogClient, type CuratedModel, type CuratedPresentation, type CuratedVariant, DEFAULT_CAPABILITIES, type DecidedBy, type DeviceGraphics, type DeviceHardware, type DiscoveryAmbiguity, type DiscoveryArtifact, type DiscoveryMedia, type DiscoveryResult, type DiscoveryRuntime, type DiscoverySource, type DiscoveryVariant, EMPTY_MODEL_RECORDS, FEATURE_BUCKETS, FEATURE_BUCKET_ORDER, FEATURE_KEYS, FILE_TYPE_QUANT, type FeatureBucket, type FeatureBucketMeta, type FeatureKey, GgufError, type GgufHeader, type GgufRead, type GgufTensor, type GroupedFeatures, type HardwareClass, type HardwareClasses, type HeaderFlag, type HeaderJudgement, type HeaderRefusal, INPUT_MODALITIES, INTERACTION_MODES, type Interaction, type InteractionMode, type LocalArtifact, type LocalCompatRow, type LocalModel, type LocalModelCatalog, type LocalPresentation, type LocalRuntime, type LocalRuntimeBuild, type LocalVariant, MAX_SUCCESSION_HOPS, MODEL_FAVORITE_ENTITY_TYPE, type Modality, type ModelCapabilities, type ModelCatalog, type ModelCatalogClient, type ModelCatalogConfig, type ModelCatalogErrorSink, type ModelCatalogPgError, type ModelCatalogPgResult, type ModelCatalogQuery, type ModelCatalogState, type ModelCatalogVariant, type ModelCatalogVariantState, type ModelClassConfig, type ModelClassEntry, type ModelClassIndex, type ModelDiagnosticEntry, type ModelDiagnosticsSink, type ModelFavorites, type ModelFavoritesCache, type ModelFavoritesClient, type ModelFavoritesConfig, type ModelFavoritesErrorSink, type ModelFavoritesState, type ModelFetchScope, type ModelFileHandle, type ModelFit, type ModelIdentityRow, type ModelJson, type ModelOfferingRow, type ModelOption, type ModelOptionWithLifecycle, type ModelRecord, type ModelRecordFetchType, type ModelRecords, type ModelRecordsClient, type ModelRecordsConfig, type ModelRecordsState, type ModelSelectionPurpose, type ModelSetEnv, type ModelSetFacts, type ModelSetValidation, type NoSelection, OUTPUT_MODALITIES, type OrderedLike, type PreferredModelChoice, type PreferredModelChoicePorts, type PriceTier, type RankedVariant, SERVICE_LABEL, SERVICE_LABEL_PLURAL, type SelectDevice, type Selection, type ShardName, type SuccessionClient, type SuccessionIndex, type SuccessionNode, TOP_TIER_COST_RATING, TOP_TIER_LOCKED_TITLE, type VariantDiscovery, type Want, acceptsTextInstructions, buildModelClassIndex, buildSuccessionIndex, catalogForApp, classConfigKey, collapseTiersByClass, costRatingTier, costRatingWord, createModelCatalog, createModelFavorites, createModelRecords, curatedList, displayOrderOf, favoriteIdsEqual, fetchCuratedModels, findNonCanonicalCapabilityValues, fitsMemory, fitsThisComputer, formatMemoryBytes, fromDiscovery, ggufEngine, ggufFacts, groupFeatures, hardwareClassesOf, hasCompatibleDecisionInteraction, isContentType, isConversationalModelCapability, isDecisionModelCapability, isFeatureKey, isHelperGguf, isInteractionMode, isLocalModelCatalog, isManagedAgentModelCapability, isProjectorName, isSupersedable, isTopTierRating, judgeHeaderFacts, mergeAuditRecordIntoCapabilities, missingShards, modelClassKnobFor, modelClassName, modelClassPinOf, modelsForSelectionPurpose, normalizeArch, normalizeModel, normalizeModels, normalizeOs, normalizePromptSettings, orderCatalogGroups, orderCatalogModels, outputFormatControlKey, parseCapabilities, pickProjector, priceTierRating, quantFromName, rankVariants, readGgufHeader, reconcileModelFavoriteIds, reportModelDiagnostic, requireCanonicalCapabilities, requiredArtifacts, resetSuccessionLogForTests, resolveLiveModelId, resolvePreferredModelChoice, resolveSuccessor, selectActiveModels, selectActiveModelsReady, selectAllModelOptions, selectAllModels, selectAllModelsReady, selectDeprecatedModels, selectDeprecatedModelsReady, selectModelById, selectModelClassConfig, selectModelClassName, selectModelControls, selectModelDetailError, selectModelFetchType, selectModelFullyLoaded, selectModelIdentityById, selectModelIdentityLookupStatus, selectModelLabelById, selectModelLabelWithClass, selectModelNameById, selectModelOptions, selectVariant, serviceCountLabel, setModelDiagnosticsSink, shapeCuratedModels, shardFileName, shardName, speedRatingLabel, speedRatingWord, splitSetProblems, toAuditRecord, validateModelSet, withModelClass };
1587
+ /**
1588
+ * `@ai-matrx/agents/models` — THE model-catalog reader. Every surface that shows the downloadable-model
1589
+ * catalog (AI Matrx admin › Applications › Catalogs, Matrx 2 › Models, any later client) reads it here,
1590
+ * so no two surfaces can drift apart:
1591
+ *
1592
+ * - members: the curated query (`readCuratedRows` + `shapeCuratedModels` + `curatedList`) — a live,
1593
+ * unretired model with a variant that is not rejected or withdrawn; `offeredOnly` (the default, for
1594
+ * apps) keeps only models and variants whose review_state is `offered`; the admin page passes false.
1595
+ * - order: the admin's order (`orderCatalogModels` over model name by code point), applied HERE, so a
1596
+ * consumer never re-sorts.
1597
+ * - shape: `LocalModelCatalog` (`matrx.model-catalog.snapshot/v1`, the snapshot exporter's shape), plus
1598
+ * every field the admin Catalogs editor writes, the admin kind (`catalogKindOf`) and a content
1599
+ * fingerprint (`catalog_fingerprint`) that changes on ANY change, not only a moved max(updated_at).
1600
+ *
1601
+ * The columns the Catalogs editor writes are pinned by `scripts/check-catalog-reader-columns.mjs`: drop a
1602
+ * mapping below and the guard goes red.
1603
+ */
1604
+
1605
+ type Row = Record<string, unknown>;
1606
+ type Result = {
1607
+ data: Row[] | null;
1608
+ error: {
1609
+ message: string;
1610
+ } | null;
1611
+ };
1612
+ /** A filterable PostgREST query (the subset of supabase-js's builder this reader uses). */
1613
+ interface LocalCatalogQuery extends PromiseLike<Result> {
1614
+ is(column: string, value: null): LocalCatalogQuery;
1615
+ eq(column: string, value: string): LocalCatalogQuery;
1616
+ in(column: string, values: readonly string[]): LocalCatalogQuery;
1617
+ }
1618
+ /** A structural subset of `SupabaseClient`: `schema(name).from(table).select(columns)` plus `is` / `eq` / `in`. */
1619
+ interface LocalCatalogClient {
1620
+ schema(name: string): {
1621
+ from(table: string): {
1622
+ select(columns: string): LocalCatalogQuery;
1623
+ };
1624
+ };
1625
+ }
1626
+ interface ReadModelCatalogOptions {
1627
+ /** Apps (default true): only offered models and their offered variants. The admin page passes false. */
1628
+ offeredOnly?: boolean;
1629
+ }
1630
+ /** The catalog kinds whose rows live in the unified catalog (ai.*): the admin Catalogs page's model kinds. */
1631
+ declare const MODEL_CATALOG_KINDS: ReadonlySet<string>;
1632
+ /** What `catalogKindOf` reads from a model (a CuratedModel or a LocalModel from `readModelCatalog` both fit). */
1633
+ interface CatalogKindInput {
1634
+ readonly variants: ReadonlyArray<{
1635
+ readonly catalog_entry_ids?: readonly string[];
1636
+ }>;
1637
+ readonly capabilities: {
1638
+ readonly input?: readonly string[];
1639
+ readonly output?: readonly string[];
1640
+ readonly interaction?: string;
1641
+ };
1642
+ readonly presentation?: {
1643
+ readonly shelf?: string | null;
1644
+ } | null;
1645
+ }
1646
+ /**
1647
+ * THE admin Catalogs kind of a unified model: the kind of the old public.catalog_entries rows its variants
1648
+ * carry (the list migration stamps them), when that is a model kind; else placed by what it does.
1649
+ * `kindOfEntry` maps catalog_entries.id → kind.
1650
+ */
1651
+ declare function catalogKindOf(m: CatalogKindInput, kindOfEntry: ReadonlyMap<string, string>): string;
1652
+ /** sha256 (hex) of the catalog's canonical JSON, its own `catalog_fingerprint` left out. Isomorphic (pure JS). */
1653
+ declare function catalogFingerprint(catalog: LocalModelCatalog): string;
1654
+ /**
1655
+ * THE catalog read: `LocalModelCatalog` in the admin's order, every admin-edited field carried, each model's
1656
+ * admin kind, and `catalog_fingerprint`. Reads ai.* (and public.catalog_entries id/kind for the kind) as the
1657
+ * signed-in caller (RLS applies). A failed ai.* read throws; a failed catalog_entries read only places models
1658
+ * by what they do and is said in `warnings`.
1659
+ */
1660
+ declare function readModelCatalog(client: CuratedCatalogClient, opts?: ReadModelCatalogOptions): Promise<LocalModelCatalog>;
1661
+
1662
+ export { type AdminOffering, type AdminPricingBand, type ArtifactUse, type AuditCapabilitiesRecord, CHAT_DEFAULT_MODEL_KNOB, CONTENT_TYPES, type CapabilitiesParseContext, type CatalogKindInput, type CatalogModel, type CatalogTier, type CompatStatus, type ContentType, type CuratedCatalogClient, type CuratedModel, type CuratedPresentation, type CuratedRows, type CuratedVariant, DEFAULT_CAPABILITIES, type DecidedBy, type DeviceGraphics, type DeviceHardware, type DiscoveryAmbiguity, type DiscoveryArtifact, type DiscoveryMedia, type DiscoveryResult, type DiscoveryRuntime, type DiscoverySource, type DiscoveryVariant, EMPTY_MODEL_RECORDS, EXCLUDED_REVIEW_STATES, FEATURE_BUCKETS, FEATURE_BUCKET_ORDER, FEATURE_KEYS, FILE_TYPE_QUANT, type FeatureBucket, type FeatureBucketMeta, type FeatureKey, GgufError, type GgufHeader, type GgufRead, type GgufTensor, type GroupedFeatures, type HardwareClass, type HardwareClasses, type HeaderFlag, type HeaderJudgement, type HeaderRefusal, INPUT_MODALITIES, INTERACTION_MODES, type Interaction, type InteractionMode, type LocalArtifact, type LocalCatalogClient, type LocalCatalogQuery, type LocalCompatRow, type LocalModel, type LocalModelCatalog, type LocalPresentation, type LocalRuntime, type LocalRuntimeBuild, type LocalVariant, MAX_SUCCESSION_HOPS, MODEL_CATALOG_KINDS, MODEL_FAVORITE_ENTITY_TYPE, type Modality, type ModelCapabilities, type ModelCatalog, type ModelCatalogClient, type ModelCatalogConfig, type ModelCatalogErrorSink, type ModelCatalogPgError, type ModelCatalogPgResult, type ModelCatalogQuery, type ModelCatalogState, type ModelCatalogVariant, type ModelCatalogVariantState, type ModelClassConfig, type ModelClassEntry, type ModelClassIndex, type ModelDiagnosticEntry, type ModelDiagnosticsSink, type ModelFavorites, type ModelFavoritesCache, type ModelFavoritesClient, type ModelFavoritesConfig, type ModelFavoritesErrorSink, type ModelFavoritesState, type ModelFetchScope, type ModelFileHandle, type ModelFit, type ModelIdentityRow, type ModelJson, type ModelOfferingRow, type ModelOption, type ModelOptionWithLifecycle, type ModelRecord, type ModelRecordFetchType, type ModelRecords, type ModelRecordsClient, type ModelRecordsConfig, type ModelRecordsState, type ModelSelectionPurpose, type ModelSetEnv, type ModelSetFacts, type ModelSetValidation, type NoSelection, OUTPUT_MODALITIES, type OrderedLike, type PreferredModelChoice, type PreferredModelChoicePorts, type PriceTier, type RankedVariant, type ReadModelCatalogOptions, SERVICE_LABEL, SERVICE_LABEL_PLURAL, type SelectDevice, type Selection, type ShardName, type SuccessionClient, type SuccessionIndex, type SuccessionNode, TOP_TIER_COST_RATING, TOP_TIER_LOCKED_TITLE, type VariantDiscovery, type Want, acceptsTextInstructions, buildModelClassIndex, buildSuccessionIndex, catalogFingerprint, catalogForApp, catalogKindOf, classConfigKey, collapseTiersByClass, costRatingTier, costRatingWord, createModelCatalog, createModelFavorites, createModelRecords, curatedList, displayOrderOf, favoriteIdsEqual, fetchCuratedModels, findNonCanonicalCapabilityValues, fitsMemory, fitsThisComputer, formatMemoryBytes, fromDiscovery, ggufEngine, ggufFacts, groupFeatures, hardwareClassesOf, hasCompatibleDecisionInteraction, isContentType, isConversationalModelCapability, isDecisionModelCapability, isFeatureKey, isHelperGguf, isInteractionMode, isListedVariant, isLocalModelCatalog, isManagedAgentModelCapability, isProjectorName, isSupersedable, isTopTierRating, judgeHeaderFacts, mergeAuditRecordIntoCapabilities, missingShards, modelClassKnobFor, modelClassName, modelClassPinOf, modelsForSelectionPurpose, normalizeArch, normalizeModel, normalizeModels, normalizeOs, normalizePromptSettings, orderCatalogGroups, orderCatalogModels, outputFormatControlKey, parseCapabilities, pickProjector, priceTierRating, quantFromName, rankVariants, readCuratedRows, readGgufHeader, readModelCatalog, reconcileModelFavoriteIds, reportModelDiagnostic, requireCanonicalCapabilities, requiredArtifacts, resetSuccessionLogForTests, resolveLiveModelId, resolvePreferredModelChoice, resolveSuccessor, selectActiveModels, selectActiveModelsReady, selectAllModelOptions, selectAllModels, selectAllModelsReady, selectDeprecatedModels, selectDeprecatedModelsReady, selectModelById, selectModelClassConfig, selectModelClassName, selectModelControls, selectModelDetailError, selectModelFetchType, selectModelFullyLoaded, selectModelIdentityById, selectModelIdentityLookupStatus, selectModelLabelById, selectModelLabelWithClass, selectModelNameById, selectModelOptions, selectVariant, serviceCountLabel, setModelDiagnosticsSink, shapeCuratedModels, shardFileName, shardName, speedRatingLabel, speedRatingWord, splitSetProblems, toAuditRecord, validateModelSet, withModelClass };
@@ -972,6 +972,10 @@ interface LocalVariant {
972
972
  artifacts: LocalArtifact[];
973
973
  /** Set only on a variant that came from a pasted link or a search (`fromDiscovery`); catalog rows never carry it. */
974
974
  discovery?: VariantDiscovery;
975
+ /** ai.model_variant.review_state (set by `readModelCatalog`; "offered" = listed in apps). */
976
+ review_state?: string;
977
+ /** The public.catalog_entries rows this variant carries (metadata.catalog_entry_ids; set by `readModelCatalog`). */
978
+ catalog_entry_ids?: string[];
975
979
  }
976
980
  /** What discovery said about a variant: the server's own words, carried so the one judge can show them. */
977
981
  interface VariantDiscovery {
@@ -1002,6 +1006,12 @@ interface LocalPresentation {
1002
1006
  url: string;
1003
1007
  }>;
1004
1008
  thumbnail_file_id: string | null;
1009
+ /** The admin's curated position (ai.model_presentation.display_order); `orderCatalogModels` sorts by it. */
1010
+ display_order?: number | null;
1011
+ hero_file_id?: string | null;
1012
+ gallery_file_ids?: string[];
1013
+ /** Admin display facts (ai.model_presentation.facts): ratings, speed, cutoff, tier, notes. Always set by `readModelCatalog`. */
1014
+ facts?: Record<string, unknown>;
1005
1015
  }
1006
1016
  interface LocalModel {
1007
1017
  id: string;
@@ -1019,6 +1029,15 @@ interface LocalModel {
1019
1029
  };
1020
1030
  presentation: LocalPresentation | null;
1021
1031
  variants: LocalVariant[];
1032
+ /** Matrx 2's 1.48 id for a model seeded from its old list (metadata.desktop_id). */
1033
+ desktop_id?: string | null;
1034
+ maker_logo_file_id?: string | null;
1035
+ /** The admin Catalogs kind (`catalogKindOf`): llm_model, whisper_model, tts_model_file, image_gen_model, video_gen_model, ner_model, wake_word_model, lora. */
1036
+ kind?: string;
1037
+ /** At least one variant is offered (Matrx 2 lists it). */
1038
+ offered?: boolean;
1039
+ /** The later of the model's and its presentation's updated_at: what an admin edit sends as expected_updated_at. */
1040
+ updated_at?: string | null;
1022
1041
  }
1023
1042
  interface LocalCompatRow {
1024
1043
  hardware_class: HardwareClass;
@@ -1055,6 +1074,14 @@ interface LocalModelCatalog {
1055
1074
  catalog_updated_at: string;
1056
1075
  models: LocalModel[];
1057
1076
  runtimes: LocalRuntime[];
1077
+ /**
1078
+ * sha256 of the whole shaped catalog (canonical JSON, this field left out), set by `readModelCatalog`:
1079
+ * changes on ANY change (unoffer, retire, delete, maker rename), where catalog_updated_at only moves
1080
+ * when a stamped row's updated_at does.
1081
+ */
1082
+ catalog_fingerprint?: string;
1083
+ /** Reads that failed but did not stop the catalog (each one line, said so a screen can show it). */
1084
+ warnings?: string[];
1058
1085
  }
1059
1086
  /** Whether a value is a v1 catalog with the fields every reader relies on (a cache or a fetch must pass this before it replaces anything). */
1060
1087
  declare function isLocalModelCatalog(value: unknown): value is LocalModelCatalog;
@@ -1469,13 +1496,13 @@ declare function orderCatalogGroups<T extends OrderedLike>(models: readonly T[],
1469
1496
  * one order (`orderCatalogModels` over ai.model_presentation.display_order). `curatedList` is the
1470
1497
  * only way a surface turns rows into its list, so two surfaces cannot drift apart.
1471
1498
  */
1472
- type Row = Record<string, unknown>;
1499
+ type Row$1 = Record<string, unknown>;
1473
1500
  /** A structural subset of `SupabaseClient` (only `schema().from().select()` is used). */
1474
1501
  interface CuratedCatalogClient {
1475
1502
  schema(name: string): {
1476
1503
  from(table: string): {
1477
1504
  select(columns: string): PromiseLike<{
1478
- data: Row[] | null;
1505
+ data: Row$1[] | null;
1479
1506
  error: {
1480
1507
  message: string;
1481
1508
  } | null;
@@ -1522,14 +1549,31 @@ interface CuratedModel {
1522
1549
  /** The later of the model's and its presentation's updated_at: what an edit sends as expected_updated_at. */
1523
1550
  updated_at: string | null;
1524
1551
  }
1525
- /** Shape raw ai.* rows into the curated models (pure; the query below feeds it). Dismissed variants are left out. */
1552
+ /**
1553
+ * The review states that take a variant OFF every list (ai.model_review_state: discovered, files_checked,
1554
+ * tested, offered, rejected, withdrawn). A rejected or withdrawn variant is never shown; a model left with
1555
+ * none is not listed.
1556
+ */
1557
+ declare const EXCLUDED_REVIEW_STATES: ReadonlySet<string>;
1558
+ /** Whether a variant row stays on the curated list (live, and not rejected or withdrawn). */
1559
+ declare const isListedVariant: (v: Row$1) => boolean;
1560
+ /** The four raw ai.* reads the curated list is shaped from (live rows only; RLS applies). */
1561
+ interface CuratedRows {
1562
+ models: Row$1[];
1563
+ variants: Row$1[];
1564
+ presentations: Row$1[];
1565
+ providers: Row$1[];
1566
+ }
1567
+ /** Shape raw ai.* rows into the curated models (pure; the query below feeds it). Rejected and withdrawn variants are left out. */
1526
1568
  declare function shapeCuratedModels(input: {
1527
- models: Row[];
1528
- variants: Row[];
1529
- presentations: Row[];
1530
- providers: Row[];
1569
+ models: Row$1[];
1570
+ variants: Row$1[];
1571
+ presentations: Row$1[];
1572
+ providers: Row$1[];
1531
1573
  }): CuratedModel[];
1532
- /** THE query: every live, unretired model with a non-dismissed variant, from ai.* (RLS applies). */
1574
+ /** The four reads behind the curated list (live rows of ai.model_definition, model_variant, model_presentation, provider). */
1575
+ declare function readCuratedRows(client: CuratedCatalogClient): Promise<CuratedRows>;
1576
+ /** THE query: every live, unretired model with a variant that is not rejected or withdrawn, from ai.* (RLS applies). */
1533
1577
  declare function fetchCuratedModels(client: CuratedCatalogClient): Promise<CuratedModel[]>;
1534
1578
  /**
1535
1579
  * THE list a surface shows, in the curated order. `offeredOnly` is Matrx 2's list; the admin page
@@ -1540,4 +1584,79 @@ declare function curatedList<T extends CuratedModel>(models: readonly T[], { off
1540
1584
  offeredOnly: boolean;
1541
1585
  }): T[];
1542
1586
 
1543
- export { type AdminOffering, type AdminPricingBand, type ArtifactUse, type AuditCapabilitiesRecord, CHAT_DEFAULT_MODEL_KNOB, CONTENT_TYPES, type CapabilitiesParseContext, type CatalogModel, type CatalogTier, type CompatStatus, type ContentType, type CuratedCatalogClient, type CuratedModel, type CuratedPresentation, type CuratedVariant, DEFAULT_CAPABILITIES, type DecidedBy, type DeviceGraphics, type DeviceHardware, type DiscoveryAmbiguity, type DiscoveryArtifact, type DiscoveryMedia, type DiscoveryResult, type DiscoveryRuntime, type DiscoverySource, type DiscoveryVariant, EMPTY_MODEL_RECORDS, FEATURE_BUCKETS, FEATURE_BUCKET_ORDER, FEATURE_KEYS, FILE_TYPE_QUANT, type FeatureBucket, type FeatureBucketMeta, type FeatureKey, GgufError, type GgufHeader, type GgufRead, type GgufTensor, type GroupedFeatures, type HardwareClass, type HardwareClasses, type HeaderFlag, type HeaderJudgement, type HeaderRefusal, INPUT_MODALITIES, INTERACTION_MODES, type Interaction, type InteractionMode, type LocalArtifact, type LocalCompatRow, type LocalModel, type LocalModelCatalog, type LocalPresentation, type LocalRuntime, type LocalRuntimeBuild, type LocalVariant, MAX_SUCCESSION_HOPS, MODEL_FAVORITE_ENTITY_TYPE, type Modality, type ModelCapabilities, type ModelCatalog, type ModelCatalogClient, type ModelCatalogConfig, type ModelCatalogErrorSink, type ModelCatalogPgError, type ModelCatalogPgResult, type ModelCatalogQuery, type ModelCatalogState, type ModelCatalogVariant, type ModelCatalogVariantState, type ModelClassConfig, type ModelClassEntry, type ModelClassIndex, type ModelDiagnosticEntry, type ModelDiagnosticsSink, type ModelFavorites, type ModelFavoritesCache, type ModelFavoritesClient, type ModelFavoritesConfig, type ModelFavoritesErrorSink, type ModelFavoritesState, type ModelFetchScope, type ModelFileHandle, type ModelFit, type ModelIdentityRow, type ModelJson, type ModelOfferingRow, type ModelOption, type ModelOptionWithLifecycle, type ModelRecord, type ModelRecordFetchType, type ModelRecords, type ModelRecordsClient, type ModelRecordsConfig, type ModelRecordsState, type ModelSelectionPurpose, type ModelSetEnv, type ModelSetFacts, type ModelSetValidation, type NoSelection, OUTPUT_MODALITIES, type OrderedLike, type PreferredModelChoice, type PreferredModelChoicePorts, type PriceTier, type RankedVariant, SERVICE_LABEL, SERVICE_LABEL_PLURAL, type SelectDevice, type Selection, type ShardName, type SuccessionClient, type SuccessionIndex, type SuccessionNode, TOP_TIER_COST_RATING, TOP_TIER_LOCKED_TITLE, type VariantDiscovery, type Want, acceptsTextInstructions, buildModelClassIndex, buildSuccessionIndex, catalogForApp, classConfigKey, collapseTiersByClass, costRatingTier, costRatingWord, createModelCatalog, createModelFavorites, createModelRecords, curatedList, displayOrderOf, favoriteIdsEqual, fetchCuratedModels, findNonCanonicalCapabilityValues, fitsMemory, fitsThisComputer, formatMemoryBytes, fromDiscovery, ggufEngine, ggufFacts, groupFeatures, hardwareClassesOf, hasCompatibleDecisionInteraction, isContentType, isConversationalModelCapability, isDecisionModelCapability, isFeatureKey, isHelperGguf, isInteractionMode, isLocalModelCatalog, isManagedAgentModelCapability, isProjectorName, isSupersedable, isTopTierRating, judgeHeaderFacts, mergeAuditRecordIntoCapabilities, missingShards, modelClassKnobFor, modelClassName, modelClassPinOf, modelsForSelectionPurpose, normalizeArch, normalizeModel, normalizeModels, normalizeOs, normalizePromptSettings, orderCatalogGroups, orderCatalogModels, outputFormatControlKey, parseCapabilities, pickProjector, priceTierRating, quantFromName, rankVariants, readGgufHeader, reconcileModelFavoriteIds, reportModelDiagnostic, requireCanonicalCapabilities, requiredArtifacts, resetSuccessionLogForTests, resolveLiveModelId, resolvePreferredModelChoice, resolveSuccessor, selectActiveModels, selectActiveModelsReady, selectAllModelOptions, selectAllModels, selectAllModelsReady, selectDeprecatedModels, selectDeprecatedModelsReady, selectModelById, selectModelClassConfig, selectModelClassName, selectModelControls, selectModelDetailError, selectModelFetchType, selectModelFullyLoaded, selectModelIdentityById, selectModelIdentityLookupStatus, selectModelLabelById, selectModelLabelWithClass, selectModelNameById, selectModelOptions, selectVariant, serviceCountLabel, setModelDiagnosticsSink, shapeCuratedModels, shardFileName, shardName, speedRatingLabel, speedRatingWord, splitSetProblems, toAuditRecord, validateModelSet, withModelClass };
1587
+ /**
1588
+ * `@ai-matrx/agents/models` — THE model-catalog reader. Every surface that shows the downloadable-model
1589
+ * catalog (AI Matrx admin › Applications › Catalogs, Matrx 2 › Models, any later client) reads it here,
1590
+ * so no two surfaces can drift apart:
1591
+ *
1592
+ * - members: the curated query (`readCuratedRows` + `shapeCuratedModels` + `curatedList`) — a live,
1593
+ * unretired model with a variant that is not rejected or withdrawn; `offeredOnly` (the default, for
1594
+ * apps) keeps only models and variants whose review_state is `offered`; the admin page passes false.
1595
+ * - order: the admin's order (`orderCatalogModels` over model name by code point), applied HERE, so a
1596
+ * consumer never re-sorts.
1597
+ * - shape: `LocalModelCatalog` (`matrx.model-catalog.snapshot/v1`, the snapshot exporter's shape), plus
1598
+ * every field the admin Catalogs editor writes, the admin kind (`catalogKindOf`) and a content
1599
+ * fingerprint (`catalog_fingerprint`) that changes on ANY change, not only a moved max(updated_at).
1600
+ *
1601
+ * The columns the Catalogs editor writes are pinned by `scripts/check-catalog-reader-columns.mjs`: drop a
1602
+ * mapping below and the guard goes red.
1603
+ */
1604
+
1605
+ type Row = Record<string, unknown>;
1606
+ type Result = {
1607
+ data: Row[] | null;
1608
+ error: {
1609
+ message: string;
1610
+ } | null;
1611
+ };
1612
+ /** A filterable PostgREST query (the subset of supabase-js's builder this reader uses). */
1613
+ interface LocalCatalogQuery extends PromiseLike<Result> {
1614
+ is(column: string, value: null): LocalCatalogQuery;
1615
+ eq(column: string, value: string): LocalCatalogQuery;
1616
+ in(column: string, values: readonly string[]): LocalCatalogQuery;
1617
+ }
1618
+ /** A structural subset of `SupabaseClient`: `schema(name).from(table).select(columns)` plus `is` / `eq` / `in`. */
1619
+ interface LocalCatalogClient {
1620
+ schema(name: string): {
1621
+ from(table: string): {
1622
+ select(columns: string): LocalCatalogQuery;
1623
+ };
1624
+ };
1625
+ }
1626
+ interface ReadModelCatalogOptions {
1627
+ /** Apps (default true): only offered models and their offered variants. The admin page passes false. */
1628
+ offeredOnly?: boolean;
1629
+ }
1630
+ /** The catalog kinds whose rows live in the unified catalog (ai.*): the admin Catalogs page's model kinds. */
1631
+ declare const MODEL_CATALOG_KINDS: ReadonlySet<string>;
1632
+ /** What `catalogKindOf` reads from a model (a CuratedModel or a LocalModel from `readModelCatalog` both fit). */
1633
+ interface CatalogKindInput {
1634
+ readonly variants: ReadonlyArray<{
1635
+ readonly catalog_entry_ids?: readonly string[];
1636
+ }>;
1637
+ readonly capabilities: {
1638
+ readonly input?: readonly string[];
1639
+ readonly output?: readonly string[];
1640
+ readonly interaction?: string;
1641
+ };
1642
+ readonly presentation?: {
1643
+ readonly shelf?: string | null;
1644
+ } | null;
1645
+ }
1646
+ /**
1647
+ * THE admin Catalogs kind of a unified model: the kind of the old public.catalog_entries rows its variants
1648
+ * carry (the list migration stamps them), when that is a model kind; else placed by what it does.
1649
+ * `kindOfEntry` maps catalog_entries.id → kind.
1650
+ */
1651
+ declare function catalogKindOf(m: CatalogKindInput, kindOfEntry: ReadonlyMap<string, string>): string;
1652
+ /** sha256 (hex) of the catalog's canonical JSON, its own `catalog_fingerprint` left out. Isomorphic (pure JS). */
1653
+ declare function catalogFingerprint(catalog: LocalModelCatalog): string;
1654
+ /**
1655
+ * THE catalog read: `LocalModelCatalog` in the admin's order, every admin-edited field carried, each model's
1656
+ * admin kind, and `catalog_fingerprint`. Reads ai.* (and public.catalog_entries id/kind for the kind) as the
1657
+ * signed-in caller (RLS applies). A failed ai.* read throws; a failed catalog_entries read only places models
1658
+ * by what they do and is said in `warnings`.
1659
+ */
1660
+ declare function readModelCatalog(client: CuratedCatalogClient, opts?: ReadModelCatalogOptions): Promise<LocalModelCatalog>;
1661
+
1662
+ export { type AdminOffering, type AdminPricingBand, type ArtifactUse, type AuditCapabilitiesRecord, CHAT_DEFAULT_MODEL_KNOB, CONTENT_TYPES, type CapabilitiesParseContext, type CatalogKindInput, type CatalogModel, type CatalogTier, type CompatStatus, type ContentType, type CuratedCatalogClient, type CuratedModel, type CuratedPresentation, type CuratedRows, type CuratedVariant, DEFAULT_CAPABILITIES, type DecidedBy, type DeviceGraphics, type DeviceHardware, type DiscoveryAmbiguity, type DiscoveryArtifact, type DiscoveryMedia, type DiscoveryResult, type DiscoveryRuntime, type DiscoverySource, type DiscoveryVariant, EMPTY_MODEL_RECORDS, EXCLUDED_REVIEW_STATES, FEATURE_BUCKETS, FEATURE_BUCKET_ORDER, FEATURE_KEYS, FILE_TYPE_QUANT, type FeatureBucket, type FeatureBucketMeta, type FeatureKey, GgufError, type GgufHeader, type GgufRead, type GgufTensor, type GroupedFeatures, type HardwareClass, type HardwareClasses, type HeaderFlag, type HeaderJudgement, type HeaderRefusal, INPUT_MODALITIES, INTERACTION_MODES, type Interaction, type InteractionMode, type LocalArtifact, type LocalCatalogClient, type LocalCatalogQuery, type LocalCompatRow, type LocalModel, type LocalModelCatalog, type LocalPresentation, type LocalRuntime, type LocalRuntimeBuild, type LocalVariant, MAX_SUCCESSION_HOPS, MODEL_CATALOG_KINDS, MODEL_FAVORITE_ENTITY_TYPE, type Modality, type ModelCapabilities, type ModelCatalog, type ModelCatalogClient, type ModelCatalogConfig, type ModelCatalogErrorSink, type ModelCatalogPgError, type ModelCatalogPgResult, type ModelCatalogQuery, type ModelCatalogState, type ModelCatalogVariant, type ModelCatalogVariantState, type ModelClassConfig, type ModelClassEntry, type ModelClassIndex, type ModelDiagnosticEntry, type ModelDiagnosticsSink, type ModelFavorites, type ModelFavoritesCache, type ModelFavoritesClient, type ModelFavoritesConfig, type ModelFavoritesErrorSink, type ModelFavoritesState, type ModelFetchScope, type ModelFileHandle, type ModelFit, type ModelIdentityRow, type ModelJson, type ModelOfferingRow, type ModelOption, type ModelOptionWithLifecycle, type ModelRecord, type ModelRecordFetchType, type ModelRecords, type ModelRecordsClient, type ModelRecordsConfig, type ModelRecordsState, type ModelSelectionPurpose, type ModelSetEnv, type ModelSetFacts, type ModelSetValidation, type NoSelection, OUTPUT_MODALITIES, type OrderedLike, type PreferredModelChoice, type PreferredModelChoicePorts, type PriceTier, type RankedVariant, type ReadModelCatalogOptions, SERVICE_LABEL, SERVICE_LABEL_PLURAL, type SelectDevice, type Selection, type ShardName, type SuccessionClient, type SuccessionIndex, type SuccessionNode, TOP_TIER_COST_RATING, TOP_TIER_LOCKED_TITLE, type VariantDiscovery, type Want, acceptsTextInstructions, buildModelClassIndex, buildSuccessionIndex, catalogFingerprint, catalogForApp, catalogKindOf, classConfigKey, collapseTiersByClass, costRatingTier, costRatingWord, createModelCatalog, createModelFavorites, createModelRecords, curatedList, displayOrderOf, favoriteIdsEqual, fetchCuratedModels, findNonCanonicalCapabilityValues, fitsMemory, fitsThisComputer, formatMemoryBytes, fromDiscovery, ggufEngine, ggufFacts, groupFeatures, hardwareClassesOf, hasCompatibleDecisionInteraction, isContentType, isConversationalModelCapability, isDecisionModelCapability, isFeatureKey, isHelperGguf, isInteractionMode, isListedVariant, isLocalModelCatalog, isManagedAgentModelCapability, isProjectorName, isSupersedable, isTopTierRating, judgeHeaderFacts, mergeAuditRecordIntoCapabilities, missingShards, modelClassKnobFor, modelClassName, modelClassPinOf, modelsForSelectionPurpose, normalizeArch, normalizeModel, normalizeModels, normalizeOs, normalizePromptSettings, orderCatalogGroups, orderCatalogModels, outputFormatControlKey, parseCapabilities, pickProjector, priceTierRating, quantFromName, rankVariants, readCuratedRows, readGgufHeader, readModelCatalog, reconcileModelFavoriteIds, reportModelDiagnostic, requireCanonicalCapabilities, requiredArtifacts, resetSuccessionLogForTests, resolveLiveModelId, resolvePreferredModelChoice, resolveSuccessor, selectActiveModels, selectActiveModelsReady, selectAllModelOptions, selectAllModels, selectAllModelsReady, selectDeprecatedModels, selectDeprecatedModelsReady, selectModelById, selectModelClassConfig, selectModelClassName, selectModelControls, selectModelDetailError, selectModelFetchType, selectModelFullyLoaded, selectModelIdentityById, selectModelIdentityLookupStatus, selectModelLabelById, selectModelLabelWithClass, selectModelNameById, selectModelOptions, selectVariant, serviceCountLabel, setModelDiagnosticsSink, shapeCuratedModels, shardFileName, shardName, speedRatingLabel, speedRatingWord, splitSetProblems, toAuditRecord, validateModelSet, withModelClass };