@ai-matrx/agents 0.59.201 → 0.59.203

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.
package/CHANGELOG.md CHANGED
@@ -1,10 +1,15 @@
1
1
  # Changelog
2
2
 
3
- ## 0.59.201
3
+ ## 0.59.203
4
4
 
5
5
  UNVERIFIED: this release has no Unreleased entry and the source comparison could not be made (the caller supplied no source comparison). Whether source changed is unknown; consumer action is unknown.
6
6
  Check the package's gitHead on npm against this version's gitHead: `git diff <previous gitHead> <this gitHead> -- apps/shared/matrx-agents/src`.
7
7
 
8
+ ## 0.59.201
9
+
10
+ Automatic changed-only republish (docs/metadata drift since the last published version; verified: `git diff ea809490d8 6085e09f65 -- apps/shared/matrx-agents/src`
11
+ has no shipped-source changes outside tests, fixtures and docs). No consumer action required.
12
+
8
13
  ## 0.59.200
9
14
 
10
15
  Automatic changed-only republish (docs/metadata drift since the last published version; verified: `git diff 85ba8e9e58 ea809490d8 -- apps/shared/matrx-agents/src`
@@ -703,7 +703,7 @@ var MANDATE_KEYS = {
703
703
  */
704
704
  brand_discovery__offering_roles: "brand_discovery.offering_roles",
705
705
  /**
706
- * @deprecated retiring since 0.59.201 — no longer declared in
706
+ * @deprecated retiring since 0.59.203 — no longer declared in
707
707
  * aidream. It leaves this union once no snapshot within the last
708
708
  * 3 published versions still carries it as active.
709
709
  */
@@ -680,7 +680,7 @@ var MANDATE_KEYS = {
680
680
  */
681
681
  brand_discovery__offering_roles: "brand_discovery.offering_roles",
682
682
  /**
683
- * @deprecated retiring since 0.59.201 — no longer declared in
683
+ * @deprecated retiring since 0.59.203 — no longer declared in
684
684
  * aidream. It leaves this union once no snapshot within the last
685
685
  * 3 published versions still carries it as active.
686
686
  */
@@ -656,7 +656,7 @@ var MANDATE_KEYS = {
656
656
  */
657
657
  brand_discovery__offering_roles: "brand_discovery.offering_roles",
658
658
  /**
659
- * @deprecated retiring since 0.59.201 — no longer declared in
659
+ * @deprecated retiring since 0.59.203 — no longer declared in
660
660
  * aidream. It leaves this union once no snapshot within the last
661
661
  * 3 published versions still carries it as active.
662
662
  */
@@ -628,7 +628,7 @@ var MANDATE_KEYS = {
628
628
  */
629
629
  brand_discovery__offering_roles: "brand_discovery.offering_roles",
630
630
  /**
631
- * @deprecated retiring since 0.59.201 — no longer declared in
631
+ * @deprecated retiring since 0.59.203 — no longer declared in
632
632
  * aidream. It leaves this union once no snapshot within the last
633
633
  * 3 published versions still carries it as active.
634
634
  */
@@ -47,9 +47,9 @@ module.exports = __toCommonJS(mandates_exports);
47
47
 
48
48
  // mandates/keys.generated.ts
49
49
  var MANDATE_KEYS_META = {
50
- aidreamRevision: "6085e09f65f8512280be0a8be5e3db2b4d1888c9",
50
+ aidreamRevision: "5a78bc1e32253c3f46527ed9d519c3562e446cf7",
51
51
  generatorVersion: "1.0.0",
52
- packageVersion: "0.59.201",
52
+ packageVersion: "0.59.203",
53
53
  retireWindow: 3
54
54
  };
55
55
  var MANDATE_KEYS = {
@@ -666,7 +666,7 @@ var MANDATE_KEYS = {
666
666
  */
667
667
  brand_discovery__offering_roles: "brand_discovery.offering_roles",
668
668
  /**
669
- * @deprecated retiring since 0.59.201 — no longer declared in
669
+ * @deprecated retiring since 0.59.203 — no longer declared in
670
670
  * aidream. It leaves this union once no snapshot within the last
671
671
  * 3 published versions still carries it as active.
672
672
  */
@@ -693,7 +693,7 @@ var MANDATE_KEYS = {
693
693
  var ALL_MANDATE_KEYS = Object.values(MANDATE_KEYS);
694
694
  var RETIRING_MANDATE_KEYS = {
695
695
  "brand_discovery.offering_roles": "0.59.0",
696
- "coding_session.managed_translation_reference": "0.59.201",
696
+ "coding_session.managed_translation_reference": "0.59.203",
697
697
  "pdf.content_cleaner": "0.59.0",
698
698
  "sms.owner_beta": "0.59.0",
699
699
  "voice.owner_beta": "0.59.0"
@@ -6,9 +6,9 @@
6
6
  * from the IN-PROCESS mandate declarations — the same `declared_mandates()` the
7
7
  * boot sync writes to the database from. There is no hand list anywhere.
8
8
  *
9
- * aidream revision: 6085e09f65f8512280be0a8be5e3db2b4d1888c9
9
+ * aidream revision: 5a78bc1e32253c3f46527ed9d519c3562e446cf7
10
10
  * generator version: 1.0.0
11
- * package version: 0.59.201
11
+ * package version: 0.59.203
12
12
  * active keys: 606
13
13
  * retiring keys: 5
14
14
  *
@@ -19,9 +19,9 @@
19
19
  */
20
20
  /** Where this module came from — surfaced so a report can name the exact build. */
21
21
  declare const MANDATE_KEYS_META: {
22
- readonly aidreamRevision: "6085e09f65f8512280be0a8be5e3db2b4d1888c9";
22
+ readonly aidreamRevision: "5a78bc1e32253c3f46527ed9d519c3562e446cf7";
23
23
  readonly generatorVersion: "1.0.0";
24
- readonly packageVersion: "0.59.201";
24
+ readonly packageVersion: "0.59.203";
25
25
  readonly retireWindow: 3;
26
26
  };
27
27
  /** Every declared mandate key, by THE IDENTIFIER RULE. */
@@ -639,7 +639,7 @@ declare const MANDATE_KEYS: {
639
639
  */
640
640
  readonly brand_discovery__offering_roles: "brand_discovery.offering_roles";
641
641
  /**
642
- * @deprecated retiring since 0.59.201 — no longer declared in
642
+ * @deprecated retiring since 0.59.203 — no longer declared in
643
643
  * aidream. It leaves this union once no snapshot within the last
644
644
  * 3 published versions still carries it as active.
645
645
  */
@@ -670,7 +670,7 @@ declare const ALL_MANDATE_KEYS: readonly MandateKey[];
670
670
  /** Keys still in the union but no longer declared (two-phase retire, phase 1). */
671
671
  declare const RETIRING_MANDATE_KEYS: {
672
672
  readonly "brand_discovery.offering_roles": "0.59.0";
673
- readonly "coding_session.managed_translation_reference": "0.59.201";
673
+ readonly "coding_session.managed_translation_reference": "0.59.203";
674
674
  readonly "pdf.content_cleaner": "0.59.0";
675
675
  readonly "sms.owner_beta": "0.59.0";
676
676
  readonly "voice.owner_beta": "0.59.0";
@@ -6,9 +6,9 @@
6
6
  * from the IN-PROCESS mandate declarations — the same `declared_mandates()` the
7
7
  * boot sync writes to the database from. There is no hand list anywhere.
8
8
  *
9
- * aidream revision: 6085e09f65f8512280be0a8be5e3db2b4d1888c9
9
+ * aidream revision: 5a78bc1e32253c3f46527ed9d519c3562e446cf7
10
10
  * generator version: 1.0.0
11
- * package version: 0.59.201
11
+ * package version: 0.59.203
12
12
  * active keys: 606
13
13
  * retiring keys: 5
14
14
  *
@@ -19,9 +19,9 @@
19
19
  */
20
20
  /** Where this module came from — surfaced so a report can name the exact build. */
21
21
  declare const MANDATE_KEYS_META: {
22
- readonly aidreamRevision: "6085e09f65f8512280be0a8be5e3db2b4d1888c9";
22
+ readonly aidreamRevision: "5a78bc1e32253c3f46527ed9d519c3562e446cf7";
23
23
  readonly generatorVersion: "1.0.0";
24
- readonly packageVersion: "0.59.201";
24
+ readonly packageVersion: "0.59.203";
25
25
  readonly retireWindow: 3;
26
26
  };
27
27
  /** Every declared mandate key, by THE IDENTIFIER RULE. */
@@ -639,7 +639,7 @@ declare const MANDATE_KEYS: {
639
639
  */
640
640
  readonly brand_discovery__offering_roles: "brand_discovery.offering_roles";
641
641
  /**
642
- * @deprecated retiring since 0.59.201 — no longer declared in
642
+ * @deprecated retiring since 0.59.203 — no longer declared in
643
643
  * aidream. It leaves this union once no snapshot within the last
644
644
  * 3 published versions still carries it as active.
645
645
  */
@@ -670,7 +670,7 @@ declare const ALL_MANDATE_KEYS: readonly MandateKey[];
670
670
  /** Keys still in the union but no longer declared (two-phase retire, phase 1). */
671
671
  declare const RETIRING_MANDATE_KEYS: {
672
672
  readonly "brand_discovery.offering_roles": "0.59.0";
673
- readonly "coding_session.managed_translation_reference": "0.59.201";
673
+ readonly "coding_session.managed_translation_reference": "0.59.203";
674
674
  readonly "pdf.content_cleaner": "0.59.0";
675
675
  readonly "sms.owner_beta": "0.59.0";
676
676
  readonly "voice.owner_beta": "0.59.0";
@@ -1,8 +1,8 @@
1
1
  // mandates/keys.generated.ts
2
2
  var MANDATE_KEYS_META = {
3
- aidreamRevision: "6085e09f65f8512280be0a8be5e3db2b4d1888c9",
3
+ aidreamRevision: "5a78bc1e32253c3f46527ed9d519c3562e446cf7",
4
4
  generatorVersion: "1.0.0",
5
- packageVersion: "0.59.201",
5
+ packageVersion: "0.59.203",
6
6
  retireWindow: 3
7
7
  };
8
8
  var MANDATE_KEYS = {
@@ -619,7 +619,7 @@ var MANDATE_KEYS = {
619
619
  */
620
620
  brand_discovery__offering_roles: "brand_discovery.offering_roles",
621
621
  /**
622
- * @deprecated retiring since 0.59.201 — no longer declared in
622
+ * @deprecated retiring since 0.59.203 — no longer declared in
623
623
  * aidream. It leaves this union once no snapshot within the last
624
624
  * 3 published versions still carries it as active.
625
625
  */
@@ -646,7 +646,7 @@ var MANDATE_KEYS = {
646
646
  var ALL_MANDATE_KEYS = Object.values(MANDATE_KEYS);
647
647
  var RETIRING_MANDATE_KEYS = {
648
648
  "brand_discovery.offering_roles": "0.59.0",
649
- "coding_session.managed_translation_reference": "0.59.201",
649
+ "coding_session.managed_translation_reference": "0.59.203",
650
650
  "pdf.content_cleaner": "0.59.0",
651
651
  "sms.owner_beta": "0.59.0",
652
652
  "voice.owner_beta": "0.59.0"
@@ -20,7 +20,6 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // models/index.ts
21
21
  var models_exports = {};
22
22
  __export(models_exports, {
23
- AGENT_AUTHORING_DEFAULT_MODEL_KNOB: () => AGENT_AUTHORING_DEFAULT_MODEL_KNOB,
24
23
  CHAT_DEFAULT_MODEL_KNOB: () => CHAT_DEFAULT_MODEL_KNOB,
25
24
  CONTENT_TYPES: () => CONTENT_TYPES,
26
25
  DEFAULT_CAPABILITIES: () => DEFAULT_CAPABILITIES,
@@ -36,6 +35,7 @@ __export(models_exports, {
36
35
  MAX_SUCCESSION_HOPS: () => MAX_SUCCESSION_HOPS,
37
36
  MODEL_CATALOG_KINDS: () => MODEL_CATALOG_KINDS,
38
37
  MODEL_FAVORITE_ENTITY_TYPE: () => MODEL_FAVORITE_ENTITY_TYPE,
38
+ NEW_AGENT_DEFAULT_MODEL_KNOB: () => NEW_AGENT_DEFAULT_MODEL_KNOB,
39
39
  OUTPUT_MODALITIES: () => OUTPUT_MODALITIES,
40
40
  SERVICE_LABEL: () => SERVICE_LABEL,
41
41
  SERVICE_LABEL_PLURAL: () => SERVICE_LABEL_PLURAL,
@@ -91,7 +91,6 @@ __export(models_exports, {
91
91
  modelClassName: () => modelClassName,
92
92
  modelClassPinOf: () => modelClassPinOf,
93
93
  modelsForSelectionPurpose: () => modelsForSelectionPurpose,
94
- newAgentModelStandInCount: () => newAgentModelStandInCount,
95
94
  normalizeArch: () => normalizeArch,
96
95
  normalizeModel: () => normalizeModel,
97
96
  normalizeModels: () => normalizeModels,
@@ -117,6 +116,7 @@ __export(models_exports, {
117
116
  resolveNewAgentModelId: () => resolveNewAgentModelId,
118
117
  resolvePreferredModelChoice: () => resolvePreferredModelChoice,
119
118
  resolveSuccessor: () => resolveSuccessor,
119
+ runtimesOnEngine: () => runtimesOnEngine,
120
120
  seesImages: () => seesImages,
121
121
  selectActiveModels: () => selectActiveModels,
122
122
  selectActiveModelsReady: () => selectActiveModelsReady,
@@ -150,6 +150,7 @@ __export(models_exports, {
150
150
  takesInput: () => takesInput,
151
151
  toAuditRecord: () => toAuditRecord,
152
152
  validateModelSet: () => validateModelSet,
153
+ variantVerdict: () => variantVerdict,
153
154
  withModelClass: () => withModelClass
154
155
  });
155
156
  module.exports = __toCommonJS(models_exports);
@@ -1881,13 +1882,26 @@ function byOrder(a, b) {
1881
1882
  function asCandidate(j) {
1882
1883
  return j.candidate ?? { variant: j.variant, build: null, hardware_class: null, compat: "expected", fits: null };
1883
1884
  }
1884
- function judgeAll(model, want, device, runtimes) {
1885
+ function judgeAll(model, want, device, runtimes, options = {}) {
1885
1886
  const checkFormat = runtimes.length > 0 || device !== null;
1886
1887
  const list = want.variant_policy === "exact" ? model.variants.filter((x) => x.key === want.variant_key) : model.variants;
1887
- return list.map((v) => judge(v, device, runtimes, checkFormat));
1888
+ return list.map((v) => judge(v, device, options.onEngine && device ? runtimesOnEngine(runtimes, v, device) : runtimes, checkFormat));
1888
1889
  }
1889
- function rankVariants(model, want, device, runtimes) {
1890
- const judged = judgeAll(model, want, device, runtimes);
1890
+ function ggufEngine(runtimes, device) {
1891
+ const arch = normalizeArch(device.arch);
1892
+ for (const r of runtimes)
1893
+ for (const b of r.builds)
1894
+ if (b.is_active && normalizeOs(b.os) === normalizeOs(device.os) && normalizeArch(b.arch) === arch && b.compat.some((c) => c.format === "gguf")) return b;
1895
+ return null;
1896
+ }
1897
+ function runtimesOnEngine(runtimes, variant, device) {
1898
+ const engine = ggufEngine(runtimes, device);
1899
+ if (!engine || variant.format !== "gguf") return [...runtimes];
1900
+ const rows3 = device.classes.map((hardware_class) => ({ hardware_class, format: variant.format, quant: variant.quant, architecture: variant.architecture, chat_template_kind: variant.chat_template_kind, status: "expected" }));
1901
+ return runtimes.map((r) => ({ ...r, builds: r.builds.map((b) => b === engine ? { ...b, compat: [...b.compat, ...rows3] } : b) }));
1902
+ }
1903
+ function rankVariants(model, want, device, runtimes, options = {}) {
1904
+ const judged = judgeAll(model, want, device, runtimes, options);
1891
1905
  const usable = judged.filter((j) => j.usable).sort((a, b) => byOrder(asCandidate(a), asCandidate(b)));
1892
1906
  const rest = judged.filter((j) => !j.usable);
1893
1907
  return [...usable, ...rest].map((j, i) => ({
@@ -1896,9 +1910,31 @@ function rankVariants(model, want, device, runtimes) {
1896
1910
  reasons: j.reasons,
1897
1911
  recommended: j.usable && i === 0,
1898
1912
  fits: j.candidate?.fits ?? null,
1899
- build: j.candidate?.build ?? null
1913
+ build: j.candidate?.build ?? null,
1914
+ compat: j.usable ? j.candidate?.compat ?? null : null,
1915
+ engine: j.usable ? engineName(j, runtimes, device) : null
1900
1916
  }));
1901
1917
  }
1918
+ function engineName(j, runtimes, device) {
1919
+ if (j.candidate?.compat === "app_runtime") return "Matrx\u2019s own engine";
1920
+ const build = j.candidate?.build ?? (device ? null : runtimes.flatMap((r) => r.builds).find((b) => b.is_active && b.compat.some((c) => c.format === j.variant.format)) ?? null);
1921
+ if (!build) return null;
1922
+ return runtimes.find((r) => r.builds.some((b) => b.id === build.id))?.name ?? null;
1923
+ }
1924
+ var RUNS_ON = /^Runs on /;
1925
+ function variantVerdict(ranked, mode) {
1926
+ const rt = ranked.variant.discovery?.runtime ?? null;
1927
+ if (mode === "catalog") {
1928
+ const runtime = rt ? rt.available ? `Runs on ${rt.name}` : rt.note || `Matrx 2 has no ${rt.name} runtime yet.` : null;
1929
+ return { runs: null, badge: null, runtime, reason: null, lines: ranked.reasons.filter((l) => !RUNS_ON.test(l)) };
1930
+ }
1931
+ const lines = ranked.reasons.filter((l) => !RUNS_ON.test(l));
1932
+ if (!ranked.usable) {
1933
+ return { runs: false, badge: "Will not run", runtime: null, reason: lines[0] ?? "This version does not run on this computer.", lines: lines.slice(1) };
1934
+ }
1935
+ const name = ranked.engine ?? (rt?.available ? rt.name : null);
1936
+ return { runs: true, badge: null, runtime: name ? `Runs on ${name}` : null, reason: null, lines };
1937
+ }
1902
1938
  function selectVariant(model, want, device, runtimes) {
1903
1939
  if (!model.variants.length) return { ok: false, code: "no_variant", reason: "This model has no downloadable form yet" };
1904
1940
  const judged = judgeAll(model, want, device, runtimes);
@@ -2288,13 +2324,6 @@ function pickProjector(quant, projectors) {
2288
2324
  }
2289
2325
  return null;
2290
2326
  }
2291
- function ggufEngine(runtimes, device) {
2292
- const arch = normalizeArch(device.arch);
2293
- for (const r of runtimes)
2294
- for (const b of r.builds)
2295
- if (b.is_active && normalizeOs(b.os) === normalizeOs(device.os) && normalizeArch(b.arch) === arch && b.compat.some((c) => c.format === "gguf")) return b;
2296
- return null;
2297
- }
2298
2327
  var extOf = (name) => {
2299
2328
  const i = name.lastIndexOf(".");
2300
2329
  return i > 0 ? name.slice(i).toLowerCase() : "";
@@ -2736,22 +2765,18 @@ function cheapestAdequateModel(catalog, need, options = {}) {
2736
2765
  }
2737
2766
 
2738
2767
  // models/default-model.ts
2739
- var AGENT_AUTHORING_DEFAULT_MODEL_KNOB = "agents.model_prefs.agent_authoring_default_model";
2740
- var PENDING_KNOB_ROW_MODEL_ID = "617abdcd-79e2-4a4b-be76-4a9960cdffa1";
2741
- var standInCount = 0;
2742
- var newAgentModelStandInCount = () => standInCount;
2768
+ var NEW_AGENT_DEFAULT_MODEL_KNOB = "agents.model_prefs.new_agent_default_model";
2743
2769
  async function resolveNewAgentModelId(resolveKnob) {
2744
- let why;
2770
+ let value;
2745
2771
  try {
2746
- const value = await resolveKnob(AGENT_AUTHORING_DEFAULT_MODEL_KNOB);
2747
- if (typeof value === "string" && value.trim() !== "") return { modelId: value.trim(), standIn: false };
2748
- why = "has no value (its platform default row is pending)";
2772
+ value = await resolveKnob(NEW_AGENT_DEFAULT_MODEL_KNOB);
2749
2773
  } catch (error) {
2750
- why = `could not be read (${error instanceof Error ? error.message : String(error)})`;
2774
+ throw new Error(
2775
+ `The model new agents start on (${NEW_AGENT_DEFAULT_MODEL_KNOB}) could not be read, so no agent was created: ${error instanceof Error ? error.message : String(error)}`
2776
+ );
2751
2777
  }
2752
- standInCount += 1;
2753
- console.error(
2754
- `[newAgentModel] STAND-IN: ${AGENT_AUTHORING_DEFAULT_MODEL_KNOB} ${why} \u2014 this new agent starts on ${PENDING_KNOB_ROW_MODEL_ID} (today's model). Set the knob's default to remove this stand-in.`
2778
+ if (typeof value === "string" && value.trim() !== "") return { modelId: value.trim() };
2779
+ throw new Error(
2780
+ `No model is set for new agents (${NEW_AGENT_DEFAULT_MODEL_KNOB} is empty for this organization), so no agent was created. Set it in Settings.`
2755
2781
  );
2756
- return { modelId: PENDING_KNOB_ROW_MODEL_ID, standIn: true };
2757
2782
  }
@@ -1188,12 +1188,28 @@ interface RankedVariant {
1188
1188
  fits: boolean | null;
1189
1189
  /** The runtime build it runs on here (null on the web or for an app-shipped runtime). */
1190
1190
  build: LocalRuntimeBuild | null;
1191
+ /** How it runs here: tested, expected (not yet tested), Matrx's own engine; null when it does not run or on the web. */
1192
+ compat: CompatStatus | "app_runtime" | null;
1193
+ /** The name of the runtime it runs on ("llama.cpp", "Matrx’s own engine"); null when it does not run or is unknown. */
1194
+ engine: string | null;
1191
1195
  }
1192
1196
  /** The parts of a sharded set that are missing ("part 2 of 3"), from the files' own shard numbers. */
1193
1197
  declare function missingShards(variant: LocalVariant): Array<{
1194
1198
  index: number;
1195
1199
  count: number;
1196
1200
  }>;
1201
+ /** The active llama-server build for this computer that runs GGUF, or null. */
1202
+ declare function ggufEngine(runtimes: readonly LocalRuntime[], device: SelectDevice): LocalRuntimeBuild | null;
1203
+ /**
1204
+ * The runtimes a version NO catalog reviewed (the person's own model, a version found on Hugging Face) is
1205
+ * judged against: our GGUF engine on this computer takes its signature as "expected" (not yet tested),
1206
+ * so it is judged on what our runtime runs, never on the reviewed list. Without an engine, unchanged.
1207
+ */
1208
+ declare function runtimesOnEngine(runtimes: readonly LocalRuntime[], variant: LocalVariant, device: SelectDevice): LocalRuntime[];
1209
+ interface RankOptions {
1210
+ /** Judge every version on our engine for its format (`runtimesOnEngine`): a person's own or found model, never on a reviewed list. */
1211
+ onEngine?: boolean;
1212
+ }
1197
1213
  /**
1198
1214
  * THE judge every screen shows (unified-models §1.4a): every variant of `model` with whether it can be
1199
1215
  * used here, its reasons in plain words (format our runtimes run, a complete file set, os/arch, and
@@ -1201,7 +1217,23 @@ declare function missingShards(variant: LocalVariant): Array<{
1201
1217
  * memory line says what it needs instead of yes/no. Ordered: the recommended first, then the other
1202
1218
  * usable ones in the selection order, then the rest. `selectVariant` is this judge's winner.
1203
1219
  */
1204
- declare function rankVariants(model: LocalModel, want: Want, device: SelectDevice | null, runtimes: readonly LocalRuntime[]): RankedVariant[];
1220
+ declare function rankVariants(model: LocalModel, want: Want, device: SelectDevice | null, runtimes: readonly LocalRuntime[], options?: RankOptions): RankedVariant[];
1221
+ /**
1222
+ * ONE verdict for a version on a screen (Find models, the Discovery page): every line a version row
1223
+ * draws comes from this, so a row can never say "Will not run" beside "Runs on llama.cpp". `runs` false:
1224
+ * `reason` is the first plain line (memory with both numbers, or the format) and there is NO runtime line.
1225
+ * `runs` true: `runtime` names what it runs on ("Runs on llama.cpp") when known. `lines` are the rest.
1226
+ * Catalog mode (admin) never gates: `runs` is null and the runtime line is the server's per-runtime word.
1227
+ */
1228
+ interface VariantVerdict {
1229
+ runs: boolean | null;
1230
+ /** "Will not run" when it does not run here; null otherwise. */
1231
+ badge: string | null;
1232
+ runtime: string | null;
1233
+ reason: string | null;
1234
+ lines: string[];
1235
+ }
1236
+ declare function variantVerdict(ranked: RankedVariant, mode: "device" | "catalog"): VariantVerdict;
1205
1237
  /**
1206
1238
  * Choose the variant of `model` this device downloads and runs, and exactly the files to fetch — the
1207
1239
  * recommended entry of `rankVariants`. The choice is returned with `decided_by` (the order step that
@@ -1452,8 +1484,6 @@ declare const quantFromName: (name: string) => string | null;
1452
1484
  declare function splitSetProblems(names: readonly string[]): string[];
1453
1485
  /** huggingface.py pick_projector over names: the projector a variant of `quant` takes, or null. */
1454
1486
  declare function pickProjector(quant: string | null, projectors: readonly string[]): string | null;
1455
- /** The active llama-server build for this computer that runs GGUF, or null. */
1456
- declare function ggufEngine(runtimes: readonly LocalRuntime[], device: SelectDevice): LocalRuntime["builds"][number] | null;
1457
1487
  /**
1458
1488
  * Judge `primary` (the file the person chose) with the files beside it (`siblings`: the rest of its
1459
1489
  * folder or download; split parts and projectors are taken from here, anything else is ignored).
@@ -1740,28 +1770,20 @@ declare function cheapestAdequateModel<T extends PricedCatalogModel>(catalog: re
1740
1770
 
1741
1771
  /**
1742
1772
  * `@ai-matrx/agents/models` — THE model a new agent starts on comes from a knob, never a constant:
1743
- * `agents.model_prefs.agent_authoring_default_model` (organization → person → device ladder, through the
1744
- * host's knob port). Every "make me an agent" path (blank agent, quick agent, templates, the web's manual
1745
- * create and system-agent create) asks `resolveNewAgentModelId`.
1773
+ * `agents.model_prefs.new_agent_default_model` (organization → person → device ladder, through the host's knob
1774
+ * port; platform default Claude Sonnet 5.5, migration 1512). Every "make me an agent" path (blank agent, quick
1775
+ * agent, templates, the web's manual create, system-agent create and builder form) asks `resolveNewAgentModelId`.
1776
+ *
1777
+ * It is NOT `agent_authoring_default_model`: that knob is the agent FACTORY's own model.
1746
1778
  *
1747
- * KNOB ROW PENDING (2026-10-21): the register row exists with `default_value = null`. Until its default is
1748
- * set to today's model (the SQL is with the owner), an unset knob answers the stand-in below — LOUDLY, every
1749
- * time, naming the knob — so creating an agent keeps working exactly as before. When the row lands the stand-in
1750
- * never fires; delete it then. This file is the ONE place a model id literal may appear in shared runtime code
1751
- * (guard: apps/shared/scripts/check-no-model-literals.mjs).
1779
+ * No code fallback: an unset or unreadable knob refuses, naming the knob, so nothing is created on a model nobody
1780
+ * chose (the knob's platform default makes "unset" an admin act, not a normal state).
1752
1781
  */
1753
- declare const AGENT_AUTHORING_DEFAULT_MODEL_KNOB = "agents.model_prefs.agent_authoring_default_model";
1782
+ declare const NEW_AGENT_DEFAULT_MODEL_KNOB = "agents.model_prefs.new_agent_default_model";
1754
1783
  interface NewAgentModel {
1755
1784
  modelId: string;
1756
- /** True when the knob held no value and the pending-row stand-in answered (it screamed). */
1757
- standIn: boolean;
1758
1785
  }
1759
- /** How many times the stand-in answered in this process (tests, diagnostics). */
1760
- declare const newAgentModelStandInCount: () => number;
1761
- /**
1762
- * The model a new agent starts on. `resolveKnob(fullKey)` is the host's effective-knob read. A knob value
1763
- * that is a non-empty string wins; an unset knob, or a knob read that fails, answers the stand-in and says so.
1764
- */
1786
+ /** The model a new agent starts on. `resolveKnob(fullKey)` is the host's effective-knob read. Throws, naming the knob, when it answers nothing. */
1765
1787
  declare function resolveNewAgentModelId(resolveKnob: (fullKey: string) => Promise<unknown>): Promise<NewAgentModel>;
1766
1788
 
1767
- export { AGENT_AUTHORING_DEFAULT_MODEL_KNOB, type AdminOffering, type AdminPricingBand, type ArtifactUse, type AuditCapabilitiesRecord, CHAT_DEFAULT_MODEL_KNOB, CONTENT_TYPES, type CapabilitiesParseContext, type CatalogKindInput, type CatalogModel, type CatalogTier, type CheapestAdequateOptions, 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, type FitCapabilities, 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 ModelNeed, 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 NewAgentModel, type NoSelection, OUTPUT_MODALITIES, type OrderedLike, type PreferredModelChoice, type PreferredModelChoicePorts, type PriceTier, type PricedCatalogModel, 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, blendedPrice, buildModelClassIndex, buildSuccessionIndex, catalogFingerprint, catalogForApp, catalogKindOf, cheapestAdequateModel, classConfigKey, collapseTiersByClass, costRatingTier, costRatingWord, createModelCatalog, createModelFavorites, createModelRecords, curatedList, displayOrderOf, favoriteIdsEqual, fetchCuratedModels, findNonCanonicalCapabilityValues, fitsMemory, fitsNeed, fitsThisComputer, formatMemoryBytes, fromDiscovery, ggufEngine, ggufFacts, groupFeatures, hardwareClassesOf, hasCompatibleDecisionInteraction, isChatModelCapability, isContentType, isConversationalModelCapability, isDecisionModelCapability, isFeatureKey, isHelperGguf, isInteractionMode, isListedVariant, isLocalModelCatalog, isManagedAgentModelCapability, isProjectorName, isSupersedable, isTopTierRating, judgeHeaderFacts, mergeAuditRecordIntoCapabilities, missingShards, modelClassKnobFor, modelClassName, modelClassPinOf, modelsForSelectionPurpose, newAgentModelStandInCount, normalizeArch, normalizeModel, normalizeModels, normalizeOs, normalizePromptSettings, orderCatalogGroups, orderCatalogModels, outputFormatControlKey, parseCapabilities, pickProjector, priceTierRating, quantFromName, rankVariants, readCuratedRows, readGgufHeader, readModelCatalog, reconcileModelFavoriteIds, reportModelDiagnostic, requireCanonicalCapabilities, requiredArtifacts, resetSuccessionLogForTests, resolveLiveModelId, resolveNewAgentModelId, resolvePreferredModelChoice, resolveSuccessor, seesImages, 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, takesInput, toAuditRecord, validateModelSet, withModelClass };
1789
+ export { type AdminOffering, type AdminPricingBand, type ArtifactUse, type AuditCapabilitiesRecord, CHAT_DEFAULT_MODEL_KNOB, CONTENT_TYPES, type CapabilitiesParseContext, type CatalogKindInput, type CatalogModel, type CatalogTier, type CheapestAdequateOptions, 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, type FitCapabilities, 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 ModelNeed, 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, NEW_AGENT_DEFAULT_MODEL_KNOB, type NewAgentModel, type NoSelection, OUTPUT_MODALITIES, type OrderedLike, type PreferredModelChoice, type PreferredModelChoicePorts, type PriceTier, type PricedCatalogModel, type RankOptions, 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 VariantVerdict, type Want, acceptsTextInstructions, blendedPrice, buildModelClassIndex, buildSuccessionIndex, catalogFingerprint, catalogForApp, catalogKindOf, cheapestAdequateModel, classConfigKey, collapseTiersByClass, costRatingTier, costRatingWord, createModelCatalog, createModelFavorites, createModelRecords, curatedList, displayOrderOf, favoriteIdsEqual, fetchCuratedModels, findNonCanonicalCapabilityValues, fitsMemory, fitsNeed, fitsThisComputer, formatMemoryBytes, fromDiscovery, ggufEngine, ggufFacts, groupFeatures, hardwareClassesOf, hasCompatibleDecisionInteraction, isChatModelCapability, 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, resolveNewAgentModelId, resolvePreferredModelChoice, resolveSuccessor, runtimesOnEngine, seesImages, 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, takesInput, toAuditRecord, validateModelSet, variantVerdict, withModelClass };
@@ -1188,12 +1188,28 @@ interface RankedVariant {
1188
1188
  fits: boolean | null;
1189
1189
  /** The runtime build it runs on here (null on the web or for an app-shipped runtime). */
1190
1190
  build: LocalRuntimeBuild | null;
1191
+ /** How it runs here: tested, expected (not yet tested), Matrx's own engine; null when it does not run or on the web. */
1192
+ compat: CompatStatus | "app_runtime" | null;
1193
+ /** The name of the runtime it runs on ("llama.cpp", "Matrx’s own engine"); null when it does not run or is unknown. */
1194
+ engine: string | null;
1191
1195
  }
1192
1196
  /** The parts of a sharded set that are missing ("part 2 of 3"), from the files' own shard numbers. */
1193
1197
  declare function missingShards(variant: LocalVariant): Array<{
1194
1198
  index: number;
1195
1199
  count: number;
1196
1200
  }>;
1201
+ /** The active llama-server build for this computer that runs GGUF, or null. */
1202
+ declare function ggufEngine(runtimes: readonly LocalRuntime[], device: SelectDevice): LocalRuntimeBuild | null;
1203
+ /**
1204
+ * The runtimes a version NO catalog reviewed (the person's own model, a version found on Hugging Face) is
1205
+ * judged against: our GGUF engine on this computer takes its signature as "expected" (not yet tested),
1206
+ * so it is judged on what our runtime runs, never on the reviewed list. Without an engine, unchanged.
1207
+ */
1208
+ declare function runtimesOnEngine(runtimes: readonly LocalRuntime[], variant: LocalVariant, device: SelectDevice): LocalRuntime[];
1209
+ interface RankOptions {
1210
+ /** Judge every version on our engine for its format (`runtimesOnEngine`): a person's own or found model, never on a reviewed list. */
1211
+ onEngine?: boolean;
1212
+ }
1197
1213
  /**
1198
1214
  * THE judge every screen shows (unified-models §1.4a): every variant of `model` with whether it can be
1199
1215
  * used here, its reasons in plain words (format our runtimes run, a complete file set, os/arch, and
@@ -1201,7 +1217,23 @@ declare function missingShards(variant: LocalVariant): Array<{
1201
1217
  * memory line says what it needs instead of yes/no. Ordered: the recommended first, then the other
1202
1218
  * usable ones in the selection order, then the rest. `selectVariant` is this judge's winner.
1203
1219
  */
1204
- declare function rankVariants(model: LocalModel, want: Want, device: SelectDevice | null, runtimes: readonly LocalRuntime[]): RankedVariant[];
1220
+ declare function rankVariants(model: LocalModel, want: Want, device: SelectDevice | null, runtimes: readonly LocalRuntime[], options?: RankOptions): RankedVariant[];
1221
+ /**
1222
+ * ONE verdict for a version on a screen (Find models, the Discovery page): every line a version row
1223
+ * draws comes from this, so a row can never say "Will not run" beside "Runs on llama.cpp". `runs` false:
1224
+ * `reason` is the first plain line (memory with both numbers, or the format) and there is NO runtime line.
1225
+ * `runs` true: `runtime` names what it runs on ("Runs on llama.cpp") when known. `lines` are the rest.
1226
+ * Catalog mode (admin) never gates: `runs` is null and the runtime line is the server's per-runtime word.
1227
+ */
1228
+ interface VariantVerdict {
1229
+ runs: boolean | null;
1230
+ /** "Will not run" when it does not run here; null otherwise. */
1231
+ badge: string | null;
1232
+ runtime: string | null;
1233
+ reason: string | null;
1234
+ lines: string[];
1235
+ }
1236
+ declare function variantVerdict(ranked: RankedVariant, mode: "device" | "catalog"): VariantVerdict;
1205
1237
  /**
1206
1238
  * Choose the variant of `model` this device downloads and runs, and exactly the files to fetch — the
1207
1239
  * recommended entry of `rankVariants`. The choice is returned with `decided_by` (the order step that
@@ -1452,8 +1484,6 @@ declare const quantFromName: (name: string) => string | null;
1452
1484
  declare function splitSetProblems(names: readonly string[]): string[];
1453
1485
  /** huggingface.py pick_projector over names: the projector a variant of `quant` takes, or null. */
1454
1486
  declare function pickProjector(quant: string | null, projectors: readonly string[]): string | null;
1455
- /** The active llama-server build for this computer that runs GGUF, or null. */
1456
- declare function ggufEngine(runtimes: readonly LocalRuntime[], device: SelectDevice): LocalRuntime["builds"][number] | null;
1457
1487
  /**
1458
1488
  * Judge `primary` (the file the person chose) with the files beside it (`siblings`: the rest of its
1459
1489
  * folder or download; split parts and projectors are taken from here, anything else is ignored).
@@ -1740,28 +1770,20 @@ declare function cheapestAdequateModel<T extends PricedCatalogModel>(catalog: re
1740
1770
 
1741
1771
  /**
1742
1772
  * `@ai-matrx/agents/models` — THE model a new agent starts on comes from a knob, never a constant:
1743
- * `agents.model_prefs.agent_authoring_default_model` (organization → person → device ladder, through the
1744
- * host's knob port). Every "make me an agent" path (blank agent, quick agent, templates, the web's manual
1745
- * create and system-agent create) asks `resolveNewAgentModelId`.
1773
+ * `agents.model_prefs.new_agent_default_model` (organization → person → device ladder, through the host's knob
1774
+ * port; platform default Claude Sonnet 5.5, migration 1512). Every "make me an agent" path (blank agent, quick
1775
+ * agent, templates, the web's manual create, system-agent create and builder form) asks `resolveNewAgentModelId`.
1776
+ *
1777
+ * It is NOT `agent_authoring_default_model`: that knob is the agent FACTORY's own model.
1746
1778
  *
1747
- * KNOB ROW PENDING (2026-10-21): the register row exists with `default_value = null`. Until its default is
1748
- * set to today's model (the SQL is with the owner), an unset knob answers the stand-in below — LOUDLY, every
1749
- * time, naming the knob — so creating an agent keeps working exactly as before. When the row lands the stand-in
1750
- * never fires; delete it then. This file is the ONE place a model id literal may appear in shared runtime code
1751
- * (guard: apps/shared/scripts/check-no-model-literals.mjs).
1779
+ * No code fallback: an unset or unreadable knob refuses, naming the knob, so nothing is created on a model nobody
1780
+ * chose (the knob's platform default makes "unset" an admin act, not a normal state).
1752
1781
  */
1753
- declare const AGENT_AUTHORING_DEFAULT_MODEL_KNOB = "agents.model_prefs.agent_authoring_default_model";
1782
+ declare const NEW_AGENT_DEFAULT_MODEL_KNOB = "agents.model_prefs.new_agent_default_model";
1754
1783
  interface NewAgentModel {
1755
1784
  modelId: string;
1756
- /** True when the knob held no value and the pending-row stand-in answered (it screamed). */
1757
- standIn: boolean;
1758
1785
  }
1759
- /** How many times the stand-in answered in this process (tests, diagnostics). */
1760
- declare const newAgentModelStandInCount: () => number;
1761
- /**
1762
- * The model a new agent starts on. `resolveKnob(fullKey)` is the host's effective-knob read. A knob value
1763
- * that is a non-empty string wins; an unset knob, or a knob read that fails, answers the stand-in and says so.
1764
- */
1786
+ /** The model a new agent starts on. `resolveKnob(fullKey)` is the host's effective-knob read. Throws, naming the knob, when it answers nothing. */
1765
1787
  declare function resolveNewAgentModelId(resolveKnob: (fullKey: string) => Promise<unknown>): Promise<NewAgentModel>;
1766
1788
 
1767
- export { AGENT_AUTHORING_DEFAULT_MODEL_KNOB, type AdminOffering, type AdminPricingBand, type ArtifactUse, type AuditCapabilitiesRecord, CHAT_DEFAULT_MODEL_KNOB, CONTENT_TYPES, type CapabilitiesParseContext, type CatalogKindInput, type CatalogModel, type CatalogTier, type CheapestAdequateOptions, 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, type FitCapabilities, 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 ModelNeed, 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 NewAgentModel, type NoSelection, OUTPUT_MODALITIES, type OrderedLike, type PreferredModelChoice, type PreferredModelChoicePorts, type PriceTier, type PricedCatalogModel, 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, blendedPrice, buildModelClassIndex, buildSuccessionIndex, catalogFingerprint, catalogForApp, catalogKindOf, cheapestAdequateModel, classConfigKey, collapseTiersByClass, costRatingTier, costRatingWord, createModelCatalog, createModelFavorites, createModelRecords, curatedList, displayOrderOf, favoriteIdsEqual, fetchCuratedModels, findNonCanonicalCapabilityValues, fitsMemory, fitsNeed, fitsThisComputer, formatMemoryBytes, fromDiscovery, ggufEngine, ggufFacts, groupFeatures, hardwareClassesOf, hasCompatibleDecisionInteraction, isChatModelCapability, isContentType, isConversationalModelCapability, isDecisionModelCapability, isFeatureKey, isHelperGguf, isInteractionMode, isListedVariant, isLocalModelCatalog, isManagedAgentModelCapability, isProjectorName, isSupersedable, isTopTierRating, judgeHeaderFacts, mergeAuditRecordIntoCapabilities, missingShards, modelClassKnobFor, modelClassName, modelClassPinOf, modelsForSelectionPurpose, newAgentModelStandInCount, normalizeArch, normalizeModel, normalizeModels, normalizeOs, normalizePromptSettings, orderCatalogGroups, orderCatalogModels, outputFormatControlKey, parseCapabilities, pickProjector, priceTierRating, quantFromName, rankVariants, readCuratedRows, readGgufHeader, readModelCatalog, reconcileModelFavoriteIds, reportModelDiagnostic, requireCanonicalCapabilities, requiredArtifacts, resetSuccessionLogForTests, resolveLiveModelId, resolveNewAgentModelId, resolvePreferredModelChoice, resolveSuccessor, seesImages, 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, takesInput, toAuditRecord, validateModelSet, withModelClass };
1789
+ export { type AdminOffering, type AdminPricingBand, type ArtifactUse, type AuditCapabilitiesRecord, CHAT_DEFAULT_MODEL_KNOB, CONTENT_TYPES, type CapabilitiesParseContext, type CatalogKindInput, type CatalogModel, type CatalogTier, type CheapestAdequateOptions, 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, type FitCapabilities, 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 ModelNeed, 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, NEW_AGENT_DEFAULT_MODEL_KNOB, type NewAgentModel, type NoSelection, OUTPUT_MODALITIES, type OrderedLike, type PreferredModelChoice, type PreferredModelChoicePorts, type PriceTier, type PricedCatalogModel, type RankOptions, 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 VariantVerdict, type Want, acceptsTextInstructions, blendedPrice, buildModelClassIndex, buildSuccessionIndex, catalogFingerprint, catalogForApp, catalogKindOf, cheapestAdequateModel, classConfigKey, collapseTiersByClass, costRatingTier, costRatingWord, createModelCatalog, createModelFavorites, createModelRecords, curatedList, displayOrderOf, favoriteIdsEqual, fetchCuratedModels, findNonCanonicalCapabilityValues, fitsMemory, fitsNeed, fitsThisComputer, formatMemoryBytes, fromDiscovery, ggufEngine, ggufFacts, groupFeatures, hardwareClassesOf, hasCompatibleDecisionInteraction, isChatModelCapability, 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, resolveNewAgentModelId, resolvePreferredModelChoice, resolveSuccessor, runtimesOnEngine, seesImages, 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, takesInput, toAuditRecord, validateModelSet, variantVerdict, withModelClass };
@@ -1725,13 +1725,26 @@ function byOrder(a, b) {
1725
1725
  function asCandidate(j) {
1726
1726
  return j.candidate ?? { variant: j.variant, build: null, hardware_class: null, compat: "expected", fits: null };
1727
1727
  }
1728
- function judgeAll(model, want, device, runtimes) {
1728
+ function judgeAll(model, want, device, runtimes, options = {}) {
1729
1729
  const checkFormat = runtimes.length > 0 || device !== null;
1730
1730
  const list = want.variant_policy === "exact" ? model.variants.filter((x) => x.key === want.variant_key) : model.variants;
1731
- return list.map((v) => judge(v, device, runtimes, checkFormat));
1731
+ return list.map((v) => judge(v, device, options.onEngine && device ? runtimesOnEngine(runtimes, v, device) : runtimes, checkFormat));
1732
1732
  }
1733
- function rankVariants(model, want, device, runtimes) {
1734
- const judged = judgeAll(model, want, device, runtimes);
1733
+ function ggufEngine(runtimes, device) {
1734
+ const arch = normalizeArch(device.arch);
1735
+ for (const r of runtimes)
1736
+ for (const b of r.builds)
1737
+ if (b.is_active && normalizeOs(b.os) === normalizeOs(device.os) && normalizeArch(b.arch) === arch && b.compat.some((c) => c.format === "gguf")) return b;
1738
+ return null;
1739
+ }
1740
+ function runtimesOnEngine(runtimes, variant, device) {
1741
+ const engine = ggufEngine(runtimes, device);
1742
+ if (!engine || variant.format !== "gguf") return [...runtimes];
1743
+ const rows3 = device.classes.map((hardware_class) => ({ hardware_class, format: variant.format, quant: variant.quant, architecture: variant.architecture, chat_template_kind: variant.chat_template_kind, status: "expected" }));
1744
+ return runtimes.map((r) => ({ ...r, builds: r.builds.map((b) => b === engine ? { ...b, compat: [...b.compat, ...rows3] } : b) }));
1745
+ }
1746
+ function rankVariants(model, want, device, runtimes, options = {}) {
1747
+ const judged = judgeAll(model, want, device, runtimes, options);
1735
1748
  const usable = judged.filter((j) => j.usable).sort((a, b) => byOrder(asCandidate(a), asCandidate(b)));
1736
1749
  const rest = judged.filter((j) => !j.usable);
1737
1750
  return [...usable, ...rest].map((j, i) => ({
@@ -1740,9 +1753,31 @@ function rankVariants(model, want, device, runtimes) {
1740
1753
  reasons: j.reasons,
1741
1754
  recommended: j.usable && i === 0,
1742
1755
  fits: j.candidate?.fits ?? null,
1743
- build: j.candidate?.build ?? null
1756
+ build: j.candidate?.build ?? null,
1757
+ compat: j.usable ? j.candidate?.compat ?? null : null,
1758
+ engine: j.usable ? engineName(j, runtimes, device) : null
1744
1759
  }));
1745
1760
  }
1761
+ function engineName(j, runtimes, device) {
1762
+ if (j.candidate?.compat === "app_runtime") return "Matrx\u2019s own engine";
1763
+ const build = j.candidate?.build ?? (device ? null : runtimes.flatMap((r) => r.builds).find((b) => b.is_active && b.compat.some((c) => c.format === j.variant.format)) ?? null);
1764
+ if (!build) return null;
1765
+ return runtimes.find((r) => r.builds.some((b) => b.id === build.id))?.name ?? null;
1766
+ }
1767
+ var RUNS_ON = /^Runs on /;
1768
+ function variantVerdict(ranked, mode) {
1769
+ const rt = ranked.variant.discovery?.runtime ?? null;
1770
+ if (mode === "catalog") {
1771
+ const runtime = rt ? rt.available ? `Runs on ${rt.name}` : rt.note || `Matrx 2 has no ${rt.name} runtime yet.` : null;
1772
+ return { runs: null, badge: null, runtime, reason: null, lines: ranked.reasons.filter((l) => !RUNS_ON.test(l)) };
1773
+ }
1774
+ const lines = ranked.reasons.filter((l) => !RUNS_ON.test(l));
1775
+ if (!ranked.usable) {
1776
+ return { runs: false, badge: "Will not run", runtime: null, reason: lines[0] ?? "This version does not run on this computer.", lines: lines.slice(1) };
1777
+ }
1778
+ const name = ranked.engine ?? (rt?.available ? rt.name : null);
1779
+ return { runs: true, badge: null, runtime: name ? `Runs on ${name}` : null, reason: null, lines };
1780
+ }
1746
1781
  function selectVariant(model, want, device, runtimes) {
1747
1782
  if (!model.variants.length) return { ok: false, code: "no_variant", reason: "This model has no downloadable form yet" };
1748
1783
  const judged = judgeAll(model, want, device, runtimes);
@@ -2132,13 +2167,6 @@ function pickProjector(quant, projectors) {
2132
2167
  }
2133
2168
  return null;
2134
2169
  }
2135
- function ggufEngine(runtimes, device) {
2136
- const arch = normalizeArch(device.arch);
2137
- for (const r of runtimes)
2138
- for (const b of r.builds)
2139
- if (b.is_active && normalizeOs(b.os) === normalizeOs(device.os) && normalizeArch(b.arch) === arch && b.compat.some((c) => c.format === "gguf")) return b;
2140
- return null;
2141
- }
2142
2170
  var extOf = (name) => {
2143
2171
  const i = name.lastIndexOf(".");
2144
2172
  return i > 0 ? name.slice(i).toLowerCase() : "";
@@ -2580,27 +2608,22 @@ function cheapestAdequateModel(catalog, need, options = {}) {
2580
2608
  }
2581
2609
 
2582
2610
  // models/default-model.ts
2583
- var AGENT_AUTHORING_DEFAULT_MODEL_KNOB = "agents.model_prefs.agent_authoring_default_model";
2584
- var PENDING_KNOB_ROW_MODEL_ID = "617abdcd-79e2-4a4b-be76-4a9960cdffa1";
2585
- var standInCount = 0;
2586
- var newAgentModelStandInCount = () => standInCount;
2611
+ var NEW_AGENT_DEFAULT_MODEL_KNOB = "agents.model_prefs.new_agent_default_model";
2587
2612
  async function resolveNewAgentModelId(resolveKnob) {
2588
- let why;
2613
+ let value;
2589
2614
  try {
2590
- const value = await resolveKnob(AGENT_AUTHORING_DEFAULT_MODEL_KNOB);
2591
- if (typeof value === "string" && value.trim() !== "") return { modelId: value.trim(), standIn: false };
2592
- why = "has no value (its platform default row is pending)";
2615
+ value = await resolveKnob(NEW_AGENT_DEFAULT_MODEL_KNOB);
2593
2616
  } catch (error) {
2594
- why = `could not be read (${error instanceof Error ? error.message : String(error)})`;
2617
+ throw new Error(
2618
+ `The model new agents start on (${NEW_AGENT_DEFAULT_MODEL_KNOB}) could not be read, so no agent was created: ${error instanceof Error ? error.message : String(error)}`
2619
+ );
2595
2620
  }
2596
- standInCount += 1;
2597
- console.error(
2598
- `[newAgentModel] STAND-IN: ${AGENT_AUTHORING_DEFAULT_MODEL_KNOB} ${why} \u2014 this new agent starts on ${PENDING_KNOB_ROW_MODEL_ID} (today's model). Set the knob's default to remove this stand-in.`
2621
+ if (typeof value === "string" && value.trim() !== "") return { modelId: value.trim() };
2622
+ throw new Error(
2623
+ `No model is set for new agents (${NEW_AGENT_DEFAULT_MODEL_KNOB} is empty for this organization), so no agent was created. Set it in Settings.`
2599
2624
  );
2600
- return { modelId: PENDING_KNOB_ROW_MODEL_ID, standIn: true };
2601
2625
  }
2602
2626
  export {
2603
- AGENT_AUTHORING_DEFAULT_MODEL_KNOB,
2604
2627
  CHAT_DEFAULT_MODEL_KNOB,
2605
2628
  CONTENT_TYPES,
2606
2629
  DEFAULT_CAPABILITIES,
@@ -2616,6 +2639,7 @@ export {
2616
2639
  MAX_SUCCESSION_HOPS,
2617
2640
  MODEL_CATALOG_KINDS,
2618
2641
  MODEL_FAVORITE_ENTITY_TYPE,
2642
+ NEW_AGENT_DEFAULT_MODEL_KNOB,
2619
2643
  OUTPUT_MODALITIES,
2620
2644
  SERVICE_LABEL,
2621
2645
  SERVICE_LABEL_PLURAL,
@@ -2671,7 +2695,6 @@ export {
2671
2695
  modelClassName,
2672
2696
  modelClassPinOf,
2673
2697
  modelsForSelectionPurpose,
2674
- newAgentModelStandInCount,
2675
2698
  normalizeArch,
2676
2699
  normalizeModel,
2677
2700
  normalizeModels,
@@ -2697,6 +2720,7 @@ export {
2697
2720
  resolveNewAgentModelId,
2698
2721
  resolvePreferredModelChoice,
2699
2722
  resolveSuccessor,
2723
+ runtimesOnEngine,
2700
2724
  seesImages,
2701
2725
  selectActiveModels,
2702
2726
  selectActiveModelsReady,
@@ -2730,5 +2754,6 @@ export {
2730
2754
  takesInput,
2731
2755
  toAuditRecord,
2732
2756
  validateModelSet,
2757
+ variantVerdict,
2733
2758
  withModelClass
2734
2759
  };
@@ -2378,13 +2378,26 @@ function byOrder(a, b) {
2378
2378
  function asCandidate(j) {
2379
2379
  return j.candidate ?? { variant: j.variant, build: null, hardware_class: null, compat: "expected", fits: null };
2380
2380
  }
2381
- function judgeAll(model, want, device, runtimes) {
2381
+ function judgeAll(model, want, device, runtimes, options = {}) {
2382
2382
  const checkFormat = runtimes.length > 0 || device !== null;
2383
2383
  const list = want.variant_policy === "exact" ? model.variants.filter((x) => x.key === want.variant_key) : model.variants;
2384
- return list.map((v) => judge(v, device, runtimes, checkFormat));
2384
+ return list.map((v) => judge(v, device, options.onEngine && device ? runtimesOnEngine(runtimes, v, device) : runtimes, checkFormat));
2385
2385
  }
2386
- function rankVariants(model, want, device, runtimes) {
2387
- const judged = judgeAll(model, want, device, runtimes);
2386
+ function ggufEngine(runtimes, device) {
2387
+ const arch = normalizeArch(device.arch);
2388
+ for (const r of runtimes)
2389
+ for (const b of r.builds)
2390
+ if (b.is_active && normalizeOs(b.os) === normalizeOs(device.os) && normalizeArch(b.arch) === arch && b.compat.some((c) => c.format === "gguf")) return b;
2391
+ return null;
2392
+ }
2393
+ function runtimesOnEngine(runtimes, variant, device) {
2394
+ const engine = ggufEngine(runtimes, device);
2395
+ if (!engine || variant.format !== "gguf") return [...runtimes];
2396
+ const rows = device.classes.map((hardware_class) => ({ hardware_class, format: variant.format, quant: variant.quant, architecture: variant.architecture, chat_template_kind: variant.chat_template_kind, status: "expected" }));
2397
+ return runtimes.map((r) => ({ ...r, builds: r.builds.map((b) => b === engine ? { ...b, compat: [...b.compat, ...rows] } : b) }));
2398
+ }
2399
+ function rankVariants(model, want, device, runtimes, options = {}) {
2400
+ const judged = judgeAll(model, want, device, runtimes, options);
2388
2401
  const usable = judged.filter((j) => j.usable).sort((a, b) => byOrder(asCandidate(a), asCandidate(b)));
2389
2402
  const rest = judged.filter((j) => !j.usable);
2390
2403
  return [...usable, ...rest].map((j, i) => ({
@@ -2393,9 +2406,31 @@ function rankVariants(model, want, device, runtimes) {
2393
2406
  reasons: j.reasons,
2394
2407
  recommended: j.usable && i === 0,
2395
2408
  fits: j.candidate?.fits ?? null,
2396
- build: j.candidate?.build ?? null
2409
+ build: j.candidate?.build ?? null,
2410
+ compat: j.usable ? j.candidate?.compat ?? null : null,
2411
+ engine: j.usable ? engineName(j, runtimes, device) : null
2397
2412
  }));
2398
2413
  }
2414
+ function engineName(j, runtimes, device) {
2415
+ if (j.candidate?.compat === "app_runtime") return "Matrx\u2019s own engine";
2416
+ const build = j.candidate?.build ?? (device ? null : runtimes.flatMap((r) => r.builds).find((b) => b.is_active && b.compat.some((c) => c.format === j.variant.format)) ?? null);
2417
+ if (!build) return null;
2418
+ return runtimes.find((r) => r.builds.some((b) => b.id === build.id))?.name ?? null;
2419
+ }
2420
+ var RUNS_ON = /^Runs on /;
2421
+ function variantVerdict(ranked, mode) {
2422
+ const rt = ranked.variant.discovery?.runtime ?? null;
2423
+ if (mode === "catalog") {
2424
+ const runtime = rt ? rt.available ? `Runs on ${rt.name}` : rt.note || `Matrx 2 has no ${rt.name} runtime yet.` : null;
2425
+ return { runs: null, badge: null, runtime, reason: null, lines: ranked.reasons.filter((l) => !RUNS_ON.test(l)) };
2426
+ }
2427
+ const lines = ranked.reasons.filter((l) => !RUNS_ON.test(l));
2428
+ if (!ranked.usable) {
2429
+ return { runs: false, badge: "Will not run", runtime: null, reason: lines[0] ?? "This version does not run on this computer.", lines: lines.slice(1) };
2430
+ }
2431
+ const name = ranked.engine ?? (rt?.available ? rt.name : null);
2432
+ return { runs: true, badge: null, runtime: name ? `Runs on ${name}` : null, reason: null, lines };
2433
+ }
2399
2434
  var USES = ["core", "vision", "audio_in", "voices"];
2400
2435
  function fromDiscovery(result) {
2401
2436
  const ambiguities = result.ambiguities ?? [];
@@ -2652,7 +2687,7 @@ function SearchTab({ port, onPick }) {
2652
2687
  }
2653
2688
  function DiscoveryResultView({ result, device, runtimes, want = DEFAULT_WANT, chooseLabel = "Choose", mode = "device", onChoose, renderVariantActions, renderActions }) {
2654
2689
  const model = (0, import_react4.useMemo)(() => fromDiscovery(result), [result]);
2655
- const ranked = (0, import_react4.useMemo)(() => rankVariants(model, want, device, runtimes), [model, want, device, runtimes]);
2690
+ const ranked = (0, import_react4.useMemo)(() => rankVariants(model, want, device, runtimes, { onEngine: mode === "device" }), [model, want, device, runtimes, mode]);
2656
2691
  const [choosing, setChoosing] = (0, import_react4.useState)(null);
2657
2692
  const [done, setDone] = (0, import_react4.useState)(null);
2658
2693
  const logo = (result.media ?? []).find((m) => m.kind === "maker_logo");
@@ -2703,27 +2738,26 @@ function DiscoveryResultView({ result, device, runtimes, want = DEFAULT_WANT, ch
2703
2738
  }
2704
2739
  function VariantRow({ ranked, mode, chooseLabel, busy, choosingThis, onChoose, extra }) {
2705
2740
  const v = ranked.variant;
2706
- const runtime = v.discovery?.runtime ?? null;
2707
2741
  const catalog = mode === "catalog";
2708
- const blocked = !catalog && !ranked.usable;
2709
- const why = blocked ? ranked.reasons[0] ?? "This version does not run on this computer." : null;
2742
+ const verdict = variantVerdict(ranked, mode);
2743
+ const blocked = !catalog && verdict.runs === false;
2710
2744
  const label = v.quant || v.key;
2711
2745
  const publisher = v.discovery?.publisher ?? null;
2712
2746
  const size = sizeOf(v.total_bytes);
2713
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("li", { className: "flex flex-col gap-2 rounded-md border border-border p-3", "data-testid": "discovery-variant", "data-recommended": ranked.recommended ? "true" : void 0, children: [
2747
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("li", { className: "flex flex-col gap-2 rounded-md border border-border p-3", "data-testid": "discovery-variant", "data-runs": verdict.runs === null ? void 0 : String(verdict.runs), "data-recommended": ranked.recommended ? "true" : void 0, children: [
2714
2748
  /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
2715
2749
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "text-sm font-medium text-foreground", children: label }),
2716
2750
  ranked.recommended ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_controls2.Badge, { tone: "primary", children: "Recommended" }) : null,
2717
- ranked.usable || catalog ? null : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_controls2.Badge, { tone: "warning", children: "Will not run" }),
2751
+ verdict.badge ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_controls2.Badge, { tone: "warning", children: verdict.badge }) : null,
2718
2752
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "text-xs text-muted-foreground", children: [v.format.toUpperCase(), size, publisher ? `by ${publisher}` : null].filter(Boolean).join(" \xB7 ") }),
2719
2753
  /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: "ml-auto flex items-center gap-2", children: [
2720
2754
  extra,
2721
- why ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "text-xs text-muted-foreground", "data-testid": "choose-reason", children: why }) : null,
2755
+ verdict.reason ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "text-xs text-muted-foreground", "data-testid": "choose-reason", children: verdict.reason }) : null,
2722
2756
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_controls2.Button, { variant: ranked.recommended ? "primary" : "outline", disabled: busy || blocked, onClick: onChoose, children: choosingThis ? "Working\u2026" : chooseLabel })
2723
2757
  ] })
2724
2758
  ] }),
2725
- runtime ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: runtime.available ? "text-xs text-muted-foreground" : "text-xs text-foreground", "data-testid": "variant-runtime", children: runtime.available ? `Runs on ${runtime.name}` : runtime.note || `Matrx 2 has no ${runtime.name} runtime yet.` }) : null,
2726
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("ul", { className: "flex flex-col gap-0.5", children: ranked.reasons.map((line) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("li", { className: "text-xs text-muted-foreground", children: line }, line)) }),
2759
+ verdict.runtime ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "text-xs text-muted-foreground", "data-testid": "variant-runtime", children: verdict.runtime }) : null,
2760
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("ul", { className: "flex flex-col gap-0.5", children: verdict.lines.map((line) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("li", { className: "text-xs text-muted-foreground", children: line }, line)) }),
2727
2761
  v.artifacts.length ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_design_system2.Collapsible, { children: [
2728
2762
  /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_design_system2.CollapsibleTrigger, { className: "text-xs text-muted-foreground hover:text-foreground", children: [
2729
2763
  "Files in this version (",
@@ -770,6 +770,10 @@ interface RankedVariant {
770
770
  fits: boolean | null;
771
771
  /** The runtime build it runs on here (null on the web or for an app-shipped runtime). */
772
772
  build: LocalRuntimeBuild | null;
773
+ /** How it runs here: tested, expected (not yet tested), Matrx's own engine; null when it does not run or on the web. */
774
+ compat: CompatStatus | "app_runtime" | null;
775
+ /** The name of the runtime it runs on ("llama.cpp", "Matrx’s own engine"); null when it does not run or is unknown. */
776
+ engine: string | null;
773
777
  }
774
778
  /** One file of a discovered variant. Newer servers send `path`/`size`; older ones `path_in_repo`/`size_bytes`. */
775
779
  interface DiscoveryArtifact {
@@ -770,6 +770,10 @@ interface RankedVariant {
770
770
  fits: boolean | null;
771
771
  /** The runtime build it runs on here (null on the web or for an app-shipped runtime). */
772
772
  build: LocalRuntimeBuild | null;
773
+ /** How it runs here: tested, expected (not yet tested), Matrx's own engine; null when it does not run or on the web. */
774
+ compat: CompatStatus | "app_runtime" | null;
775
+ /** The name of the runtime it runs on ("llama.cpp", "Matrx’s own engine"); null when it does not run or is unknown. */
776
+ engine: string | null;
773
777
  }
774
778
  /** One file of a discovered variant. Newer servers send `path`/`size`; older ones `path_in_repo`/`size_bytes`. */
775
779
  interface DiscoveryArtifact {
@@ -2360,13 +2360,26 @@ function byOrder(a, b) {
2360
2360
  function asCandidate(j) {
2361
2361
  return j.candidate ?? { variant: j.variant, build: null, hardware_class: null, compat: "expected", fits: null };
2362
2362
  }
2363
- function judgeAll(model, want, device, runtimes) {
2363
+ function judgeAll(model, want, device, runtimes, options = {}) {
2364
2364
  const checkFormat = runtimes.length > 0 || device !== null;
2365
2365
  const list = want.variant_policy === "exact" ? model.variants.filter((x) => x.key === want.variant_key) : model.variants;
2366
- return list.map((v) => judge(v, device, runtimes, checkFormat));
2366
+ return list.map((v) => judge(v, device, options.onEngine && device ? runtimesOnEngine(runtimes, v, device) : runtimes, checkFormat));
2367
2367
  }
2368
- function rankVariants(model, want, device, runtimes) {
2369
- const judged = judgeAll(model, want, device, runtimes);
2368
+ function ggufEngine(runtimes, device) {
2369
+ const arch = normalizeArch(device.arch);
2370
+ for (const r of runtimes)
2371
+ for (const b of r.builds)
2372
+ if (b.is_active && normalizeOs(b.os) === normalizeOs(device.os) && normalizeArch(b.arch) === arch && b.compat.some((c) => c.format === "gguf")) return b;
2373
+ return null;
2374
+ }
2375
+ function runtimesOnEngine(runtimes, variant, device) {
2376
+ const engine = ggufEngine(runtimes, device);
2377
+ if (!engine || variant.format !== "gguf") return [...runtimes];
2378
+ const rows = device.classes.map((hardware_class) => ({ hardware_class, format: variant.format, quant: variant.quant, architecture: variant.architecture, chat_template_kind: variant.chat_template_kind, status: "expected" }));
2379
+ return runtimes.map((r) => ({ ...r, builds: r.builds.map((b) => b === engine ? { ...b, compat: [...b.compat, ...rows] } : b) }));
2380
+ }
2381
+ function rankVariants(model, want, device, runtimes, options = {}) {
2382
+ const judged = judgeAll(model, want, device, runtimes, options);
2370
2383
  const usable = judged.filter((j) => j.usable).sort((a, b) => byOrder(asCandidate(a), asCandidate(b)));
2371
2384
  const rest = judged.filter((j) => !j.usable);
2372
2385
  return [...usable, ...rest].map((j, i) => ({
@@ -2375,9 +2388,31 @@ function rankVariants(model, want, device, runtimes) {
2375
2388
  reasons: j.reasons,
2376
2389
  recommended: j.usable && i === 0,
2377
2390
  fits: j.candidate?.fits ?? null,
2378
- build: j.candidate?.build ?? null
2391
+ build: j.candidate?.build ?? null,
2392
+ compat: j.usable ? j.candidate?.compat ?? null : null,
2393
+ engine: j.usable ? engineName(j, runtimes, device) : null
2379
2394
  }));
2380
2395
  }
2396
+ function engineName(j, runtimes, device) {
2397
+ if (j.candidate?.compat === "app_runtime") return "Matrx\u2019s own engine";
2398
+ const build = j.candidate?.build ?? (device ? null : runtimes.flatMap((r) => r.builds).find((b) => b.is_active && b.compat.some((c) => c.format === j.variant.format)) ?? null);
2399
+ if (!build) return null;
2400
+ return runtimes.find((r) => r.builds.some((b) => b.id === build.id))?.name ?? null;
2401
+ }
2402
+ var RUNS_ON = /^Runs on /;
2403
+ function variantVerdict(ranked, mode) {
2404
+ const rt = ranked.variant.discovery?.runtime ?? null;
2405
+ if (mode === "catalog") {
2406
+ const runtime = rt ? rt.available ? `Runs on ${rt.name}` : rt.note || `Matrx 2 has no ${rt.name} runtime yet.` : null;
2407
+ return { runs: null, badge: null, runtime, reason: null, lines: ranked.reasons.filter((l) => !RUNS_ON.test(l)) };
2408
+ }
2409
+ const lines = ranked.reasons.filter((l) => !RUNS_ON.test(l));
2410
+ if (!ranked.usable) {
2411
+ return { runs: false, badge: "Will not run", runtime: null, reason: lines[0] ?? "This version does not run on this computer.", lines: lines.slice(1) };
2412
+ }
2413
+ const name = ranked.engine ?? (rt?.available ? rt.name : null);
2414
+ return { runs: true, badge: null, runtime: name ? `Runs on ${name}` : null, reason: null, lines };
2415
+ }
2381
2416
  var USES = ["core", "vision", "audio_in", "voices"];
2382
2417
  function fromDiscovery(result) {
2383
2418
  const ambiguities = result.ambiguities ?? [];
@@ -2634,7 +2669,7 @@ function SearchTab({ port, onPick }) {
2634
2669
  }
2635
2670
  function DiscoveryResultView({ result, device, runtimes, want = DEFAULT_WANT, chooseLabel = "Choose", mode = "device", onChoose, renderVariantActions, renderActions }) {
2636
2671
  const model = useMemo3(() => fromDiscovery(result), [result]);
2637
- const ranked = useMemo3(() => rankVariants(model, want, device, runtimes), [model, want, device, runtimes]);
2672
+ const ranked = useMemo3(() => rankVariants(model, want, device, runtimes, { onEngine: mode === "device" }), [model, want, device, runtimes, mode]);
2638
2673
  const [choosing, setChoosing] = useState2(null);
2639
2674
  const [done, setDone] = useState2(null);
2640
2675
  const logo = (result.media ?? []).find((m) => m.kind === "maker_logo");
@@ -2685,27 +2720,26 @@ function DiscoveryResultView({ result, device, runtimes, want = DEFAULT_WANT, ch
2685
2720
  }
2686
2721
  function VariantRow({ ranked, mode, chooseLabel, busy, choosingThis, onChoose, extra }) {
2687
2722
  const v = ranked.variant;
2688
- const runtime = v.discovery?.runtime ?? null;
2689
2723
  const catalog = mode === "catalog";
2690
- const blocked = !catalog && !ranked.usable;
2691
- const why = blocked ? ranked.reasons[0] ?? "This version does not run on this computer." : null;
2724
+ const verdict = variantVerdict(ranked, mode);
2725
+ const blocked = !catalog && verdict.runs === false;
2692
2726
  const label = v.quant || v.key;
2693
2727
  const publisher = v.discovery?.publisher ?? null;
2694
2728
  const size = sizeOf(v.total_bytes);
2695
- return /* @__PURE__ */ jsxs4("li", { className: "flex flex-col gap-2 rounded-md border border-border p-3", "data-testid": "discovery-variant", "data-recommended": ranked.recommended ? "true" : void 0, children: [
2729
+ return /* @__PURE__ */ jsxs4("li", { className: "flex flex-col gap-2 rounded-md border border-border p-3", "data-testid": "discovery-variant", "data-runs": verdict.runs === null ? void 0 : String(verdict.runs), "data-recommended": ranked.recommended ? "true" : void 0, children: [
2696
2730
  /* @__PURE__ */ jsxs4("div", { className: "flex flex-wrap items-center gap-2", children: [
2697
2731
  /* @__PURE__ */ jsx5("span", { className: "text-sm font-medium text-foreground", children: label }),
2698
2732
  ranked.recommended ? /* @__PURE__ */ jsx5(Badge, { tone: "primary", children: "Recommended" }) : null,
2699
- ranked.usable || catalog ? null : /* @__PURE__ */ jsx5(Badge, { tone: "warning", children: "Will not run" }),
2733
+ verdict.badge ? /* @__PURE__ */ jsx5(Badge, { tone: "warning", children: verdict.badge }) : null,
2700
2734
  /* @__PURE__ */ jsx5("span", { className: "text-xs text-muted-foreground", children: [v.format.toUpperCase(), size, publisher ? `by ${publisher}` : null].filter(Boolean).join(" \xB7 ") }),
2701
2735
  /* @__PURE__ */ jsxs4("span", { className: "ml-auto flex items-center gap-2", children: [
2702
2736
  extra,
2703
- why ? /* @__PURE__ */ jsx5("span", { className: "text-xs text-muted-foreground", "data-testid": "choose-reason", children: why }) : null,
2737
+ verdict.reason ? /* @__PURE__ */ jsx5("span", { className: "text-xs text-muted-foreground", "data-testid": "choose-reason", children: verdict.reason }) : null,
2704
2738
  /* @__PURE__ */ jsx5(Button, { variant: ranked.recommended ? "primary" : "outline", disabled: busy || blocked, onClick: onChoose, children: choosingThis ? "Working\u2026" : chooseLabel })
2705
2739
  ] })
2706
2740
  ] }),
2707
- runtime ? /* @__PURE__ */ jsx5("p", { className: runtime.available ? "text-xs text-muted-foreground" : "text-xs text-foreground", "data-testid": "variant-runtime", children: runtime.available ? `Runs on ${runtime.name}` : runtime.note || `Matrx 2 has no ${runtime.name} runtime yet.` }) : null,
2708
- /* @__PURE__ */ jsx5("ul", { className: "flex flex-col gap-0.5", children: ranked.reasons.map((line) => /* @__PURE__ */ jsx5("li", { className: "text-xs text-muted-foreground", children: line }, line)) }),
2741
+ verdict.runtime ? /* @__PURE__ */ jsx5("p", { className: "text-xs text-muted-foreground", "data-testid": "variant-runtime", children: verdict.runtime }) : null,
2742
+ /* @__PURE__ */ jsx5("ul", { className: "flex flex-col gap-0.5", children: verdict.lines.map((line) => /* @__PURE__ */ jsx5("li", { className: "text-xs text-muted-foreground", children: line }, line)) }),
2709
2743
  v.artifacts.length ? /* @__PURE__ */ jsxs4(Collapsible, { children: [
2710
2744
  /* @__PURE__ */ jsxs4(CollapsibleTrigger, { className: "text-xs text-muted-foreground hover:text-foreground", children: [
2711
2745
  "Files in this version (",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-matrx/agents",
3
- "version": "0.59.201",
3
+ "version": "0.59.203",
4
4
  "description": "Portable AI Matrx agent stream protocol, event projection, and safe result-presentation primitives.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -511,9 +511,9 @@
511
511
  "@ai-matrx/alchemy": "latest",
512
512
  "@ai-matrx/associations": "latest",
513
513
  "@ai-matrx/content-ir": "latest",
514
+ "@ai-matrx/api": "latest",
514
515
  "@ai-matrx/data": "latest",
515
516
  "@ai-matrx/design-system": "latest",
516
- "@ai-matrx/api": "latest",
517
517
  "@ai-matrx/diff": "latest",
518
518
  "@ai-matrx/icons": "latest",
519
519
  "@ai-matrx/kit": "latest"
@@ -561,5 +561,5 @@
561
561
  "verify:tarball": "node ./scripts/verify-tarball.mjs",
562
562
  "typegen:self-test": "node scripts/typegen/drop-guard.self-test.mjs && node scripts/typegen/check-api-types-fresh.mjs --self-test"
563
563
  },
564
- "gitHead": "6085e09f65f8512280be0a8be5e3db2b4d1888c9"
564
+ "gitHead": "5a78bc1e32253c3f46527ed9d519c3562e446cf7"
565
565
  }